Skip to content

Commit e0d8c64

Browse files
committed
chore: lint fix
Signed-off-by: Akshat Patel <[email protected]>
1 parent f00e818 commit e0d8c64

19 files changed

+108
-152
lines changed

src/accordion/accordion-item.component.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ import {
1919
class="cds--accordion__heading">
2020
<svg cdsIcon="chevron--right" size="16" class="cds--accordion__arrow"></svg>
2121
@if (isTemplate(title)) {
22-
<ng-template
23-
[ngTemplateOutlet]="title"
24-
[ngTemplateOutletContext]="context">
25-
</ng-template>
22+
<ng-template [ngTemplateOutlet]="title" [ngTemplateOutletContext]="context" />
2623
} @else {
2724
<p
2825
class="cds--accordion__title"

src/breadcrumb/breadcrumb.component.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,7 @@ const MINIMUM_OVERFLOW_THRESHOLD = 4;
9898
[ariaCurrent]="last?.ariaCurrent"
9999
(navigation)="navigation.emit($event)">
100100
@if (last?.template) {
101-
<ng-template
102-
[ngTemplateOutlet]="last?.template"
103-
[ngTemplateOutletContext]="{ $implicit: last }" />
101+
<ng-template [ngTemplateOutlet]="last?.template" [ngTemplateOutletContext]="{ $implicit: last }" />
104102
} @else {
105103
{{last?.content}}
106104
}

src/datepicker-input/datepicker-input.component.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,19 @@ import { NG_VALUE_ACCESSOR } from "@angular/forms";
2626
@if (skeleton) {
2727
<span class="cds--label cds--skeleton"></span>
2828
<div class="cds--date-picker__input cds--skeleton"></div>
29-
}
30-
@if (label && !skeleton) {
31-
<label
32-
[for]="id"
33-
class="cds--label"
34-
[ngClass]="{'cds--label--disabled': disabled}">
35-
@if (isTemplate(label)) {
36-
<ng-template [ngTemplateOutlet]="label" />
37-
} @else {
38-
{{label}}
39-
}
40-
</label>
41-
}
42-
@if (!skeleton) {
29+
} @else {
30+
@if (label) {
31+
<label
32+
[for]="id"
33+
class="cds--label"
34+
[ngClass]="{'cds--label--disabled': disabled}">
35+
@if (isTemplate(label)) {
36+
<ng-template [ngTemplateOutlet]="label" />
37+
} @else {
38+
{{label}}
39+
}
40+
</label>
41+
}
4342
<div class="cds--date-picker-input__wrapper"
4443
[ngClass]="{
4544
'cds--date-picker-input__wrapper--invalid': invalid,
@@ -87,6 +86,7 @@ import { NG_VALUE_ACCESSOR } from "@angular/forms";
8786
</span>
8887
</div>
8988
}
89+
9090
@if (invalid) {
9191
<div class="cds--form-requirement">
9292
@if (isTemplate(invalidText)) {

src/dialog/overflow-menu/overflow-menu-custom-pane.component.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ import { Dialog } from "../dialog.component";
2323
(click)="onClick($event)"
2424
#dialog
2525
[attr.aria-label]="dialogConfig.menuLabel">
26-
<ng-template
27-
[ngTemplateOutlet]="dialogConfig.content"
28-
[ngTemplateOutletContext]="{overflowMenu: this}">
29-
</ng-template>
26+
<ng-template [ngTemplateOutlet]="dialogConfig.content" [ngTemplateOutletContext]="{overflowMenu: this}" />
3027
</div>
3128
`
3229
})

src/dialog/overflow-menu/overflow-menu-pane.component.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ import { closestAttr } from "carbon-components-angular/utils";
3232
class="cds--overflow-menu-options cds--overflow-menu-options--open"
3333
(click)="onClose($event)"
3434
[attr.aria-label]="dialogConfig.menuLabel">
35-
<ng-template
36-
[ngTemplateOutlet]="dialogConfig.content"
37-
[ngTemplateOutletContext]="{overflowMenu: this}">
38-
</ng-template>
35+
<ng-template [ngTemplateOutlet]="dialogConfig.content" [ngTemplateOutletContext]="{overflowMenu: this}" />
3936
</ul>
4037
`
4138
})

src/dropdown/dropdown.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ import { hasScrollableParents } from "carbon-components-angular/utils";
195195
[ngClass]="{
196196
'cds--form__helper-text--disabled': disabled
197197
}">
198-
199198
@if (isTemplate(helperText)) {
200199
<ng-template [ngTemplateOutlet]="helperText" />
201200
} @else {

src/dropdown/list/dropdown-list.component.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,7 @@ import { ScrollCustomEvent } from "./scroll-custom-event.interface";
8080
@if (!listTpl && type === 'multi') {
8181
<div
8282
class="cds--form-item cds--checkbox-wrapper">
83-
<label
84-
[attr.data-contained-checkbox-state]="item.selected"
85-
class="cds--checkbox-label">
83+
<label [attr.data-contained-checkbox-state]="item.selected" class="cds--checkbox-label">
8684
<input
8785
class="cds--checkbox"
8886
type="checkbox"
@@ -103,10 +101,7 @@ import { ScrollCustomEvent } from "./scroll-custom-event.interface";
103101
</svg>
104102
}
105103
@if (listTpl) {
106-
<ng-template
107-
[ngTemplateOutletContext]="{item: item}"
108-
[ngTemplateOutlet]="listTpl">
109-
</ng-template>
104+
<ng-template [ngTemplateOutletContext]="{item: item}" [ngTemplateOutlet]="listTpl" />
110105
}
111106
</div>
112107
</li>

src/pagination/pagination-nav/pagination-nav.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
HostBinding
88
} from "@angular/core";
99

10-
import { I18n, Overridable } from "carbon-components-angular/i18n";
10+
import { I18n } from "carbon-components-angular/i18n";
1111
import { ExperimentalService } from "carbon-components-angular/experimental";
1212
import { merge } from "carbon-components-angular/utils";
1313
import { range } from "carbon-components-angular/common";

src/pagination/pagination-nav/pagination-overflow.component.ts

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
Output,
55
EventEmitter
66
} from "@angular/core";
7+
import { range } from "carbon-components-angular/common";
78
import { I18n } from "carbon-components-angular/i18n";
89

910
/**
@@ -17,32 +18,32 @@ import { I18n } from "carbon-components-angular/i18n";
1718
@Component({
1819
selector: "cds-pagination-overflow, ibm-pagination-overflow",
1920
template: `
20-
@if (count > 1) {
21+
@if (count === 1) {
22+
<cds-pagination-nav-item [page]="fromIndex + 1"></cds-pagination-nav-item>
23+
} @else if (count > 1) {
2124
<li class="cds--pagination-nav__list-item">
2225
<div class="cds--pagination-nav__select">
23-
<select
24-
[attr.aria-label]="ariaLabel"
25-
class="cds--pagination-nav__page cds--pagination-nav__page--select"
26-
(change)="handleChange($event)">
27-
<option value="" hidden></option>
28-
@for (item of countAsArray; track item; let i = $index) {
29-
<option>
30-
{{fromIndex + i + 1}}
31-
</option>
32-
}
33-
</select>
34-
<div class="cds--pagination-nav__select-icon-wrapper">
35-
<svg
36-
cdsIcon="overflow-menu--horizontal"
37-
size="16"
38-
style="display: inherit"
39-
class="cds--pagination-nav__select-icon">
40-
</svg>
41-
</div>
26+
<select
27+
[attr.aria-label]="ariaLabel"
28+
class="cds--pagination-nav__page cds--pagination-nav__page--select"
29+
(change)="handleChange($event)">
30+
<option value="" hidden></option>
31+
@for (item of countAsArray; track item; let i = $index) {
32+
<option>
33+
{{fromIndex + i + 1}}
34+
</option>
35+
}
36+
</select>
37+
<div class="cds--pagination-nav__select-icon-wrapper">
38+
<svg
39+
cdsIcon="overflow-menu--horizontal"
40+
size="16"
41+
style="display: inherit"
42+
class="cds--pagination-nav__select-icon">
43+
</svg>
44+
</div>
4245
</div>
4346
</li>
44-
} @else if (count === 1) {
45-
<cds-pagination-nav-item [page]="fromIndex + 1"></cds-pagination-nav-item>
4647
}
4748
`
4849
})
@@ -62,10 +63,7 @@ export class PaginationOverflow {
6263
@Output() change = new EventEmitter<number>();
6364

6465
get countAsArray() {
65-
const rangeArray = Array(this.count >= 0 ? this.count : 0);
66-
for (let i = 0; i < rangeArray.length; i++) {
67-
rangeArray[i] = i + 1;
68-
}
66+
const rangeArray = range((this.count >= 0 ? this.count : 0), 1);
6967
return rangeArray;
7068
}
7169

src/pagination/pagination.component.ts

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ import {
66
EventEmitter
77
} from "@angular/core";
88

9-
import { I18n, Overridable } from "carbon-components-angular/i18n";
9+
import { I18n } from "carbon-components-angular/i18n";
1010
import { ExperimentalService } from "carbon-components-angular/experimental";
1111
import { merge } from "carbon-components-angular/utils";
12+
import { range } from "carbon-components-angular/common";
1213

1314
export interface PaginationTranslations {
1415
ITEMS_PER_PAGE: string;
@@ -78,10 +79,8 @@ export interface PaginationTranslations {
7879
[disabled]="pageInputDisabled"
7980
class="cds--select-input">
8081
@for (option of itemsPerPageOptions; track option) {
81-
<option
82-
class="cds--select-option"
83-
[value]="option">
84-
{{ option }}
82+
<option class="cds--select-option" [value]="option">
83+
{{ option }}
8584
</option>
8685
}
8786
</select>
@@ -167,20 +166,20 @@ export interface PaginationTranslations {
167166
}
168167
169168
@if (!pagesUnknown && lastPage <= 1) {
170-
<span class="cds--pagination__text">
171-
@if (!showPageInput) {
172-
{{currentPage}}
173-
}
174-
{{ofLastPageText.subject | i18nReplace: {last: lastPage} | async}}
175-
</span>
169+
<span class="cds--pagination__text">
170+
@if (!showPageInput) {
171+
{{currentPage}}
172+
}
173+
{{ofLastPageText.subject | i18nReplace: {last: lastPage} | async}}
174+
</span>
176175
}
177176
@if (!pagesUnknown && lastPage > 1) {
178-
<span class="cds--pagination__text">
179-
@if (!showPageInput) {
180-
{{currentPage}}
181-
}
182-
{{ofLastPagesText.subject | i18nReplace: {last: lastPage} | async}}
183-
</span>
177+
<span class="cds--pagination__text">
178+
@if (!showPageInput) {
179+
{{currentPage}}
180+
}
181+
{{ofLastPagesText.subject | i18nReplace: {last: lastPage} | async}}
182+
</span>
184183
}
185184
<div class="cds--pagination__control-buttons">
186185
<button
@@ -200,9 +199,7 @@ export interface PaginationTranslations {
200199
<button
201200
cdsButton="ghost"
202201
iconOnly="true"
203-
class="
204-
cds--pagination__button
205-
cds--pagination__button--forward"
202+
class="cds--pagination__button cds--pagination__button--forward"
206203
[ngClass]="{
207204
'cds--pagination__button--no-index': currentPage >= lastPage || disabled
208205
}"
@@ -355,11 +352,7 @@ export class Pagination {
355352
*/
356353
const numberOfPages = Math.max(Math.ceil(this.totalDataLength / this.itemsPerPage), 1);
357354
if (this._pageOptions.length !== numberOfPages) {
358-
const pageArray = Array(numberOfPages);
359-
for (let i = 0; i < numberOfPages; i++) {
360-
pageArray[i] = i + 1;
361-
}
362-
this._pageOptions = pageArray;
355+
this._pageOptions = range(numberOfPages, 1);
363356
}
364357
return this._pageOptions;
365358
}

0 commit comments

Comments
 (0)