Skip to content

Commit cc03855

Browse files
committed
feat(*): refactor for typescript 4 support #8116
1 parent 76e3c89 commit cc03855

19 files changed

+65
-70
lines changed

projects/igniteui-angular/src/lib/directives/autocomplete/autocomplete.directive.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,12 @@ export class IgxAutocompleteDirective extends IgxDropDownItemNavigationDirective
132132
* ```
133133
*/
134134
@Input('igxAutocomplete')
135-
public target: IgxDropDownComponent;
135+
public get target(): IgxDropDownComponent {
136+
return this._target as IgxDropDownComponent;
137+
}
138+
public set target(v: IgxDropDownComponent) {
139+
this._target = v;
140+
}
136141

137142
/**
138143
* Enables/disables autocomplete component

projects/igniteui-angular/src/lib/directives/drag-drop/drag-drop.directive.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1331,7 +1331,13 @@ export class IgxDropDirective implements OnInit, OnDestroy {
13311331
* @memberof IgxDropDirective
13321332
*/
13331333
@Input('igxDrop')
1334-
public data: any;
1334+
private _data: any;
1335+
public get data(): any {
1336+
return this._data;
1337+
}
1338+
public set data(v: any) {
1339+
this._data = v;
1340+
}
13351341

13361342
/**
13371343
* An @Input property that provide a way for igxDrag and igxDrop to be linked through channels.

projects/igniteui-angular/src/lib/drop-down/drop-down.base.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@ let NEXT_ID = 0;
1717
* Properties and methods for navigating (highlighting/focusing) items from the collection
1818
* Properties and methods for selecting items from the collection
1919
*/
20-
@Directive({
21-
selector: '[igxDropDownBase]'
22-
})
23-
export class IgxDropDownBaseDirective extends DisplayDensityBase implements IDropDownList {
20+
@Directive()
21+
export abstract class IgxDropDownBaseDirective extends DisplayDensityBase implements IDropDownList {
2422
protected _width;
2523
protected _height;
2624
protected _focusedItem: any = null;
@@ -93,7 +91,12 @@ export class IgxDropDownBaseDirective extends DisplayDensityBase implements IDro
9391
* ```
9492
*/
9593
@Input()
96-
public id: string;
94+
public get id(): string {
95+
return this._id;
96+
}
97+
public set id(value: string) {
98+
this._id = value;
99+
}
97100

98101
/**
99102
* Gets/Sets the drop down's container max height.
@@ -171,7 +174,7 @@ export class IgxDropDownBaseDirective extends DisplayDensityBase implements IDro
171174
/**
172175
* Gets if the dropdown is collapsed
173176
*/
174-
public collapsed: boolean;
177+
public abstract readonly collapsed: boolean;
175178

176179
constructor(
177180
protected elementRef: ElementRef,

projects/igniteui-angular/src/lib/drop-down/drop-down.component.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,10 @@ export class IgxDropDownComponent extends IgxDropDownBaseDirective implements ID
162162
this.selection.set(`${this.id}-active`, new Set([this._focusedItem]));
163163
}
164164

165-
@Input()
166-
get id(): string {
165+
public get id(): string {
167166
return this._id;
168167
}
169-
set id(value: string) {
168+
public set id(value: string) {
170169
this.selection.set(value, this.selection.get(this.id));
171170
this.selection.clear(this.id);
172171
this.selection.set(value, this.selection.get(`${this.id}-active`));
@@ -460,9 +459,9 @@ export class IgxDropDownComponent extends IgxDropDownBaseDirective implements ID
460459
/**
461460
* @hidden @internal
462461
*/
463-
// temp workaround until fix --> https://github.com/angular/angular/issues/34992
464462
ngOnChanges(changes: SimpleChanges) {
465463
if (changes.id) {
464+
// temp workaround until fix --> https://github.com/angular/angular/issues/34992
466465
this.toggleDirective.id = changes.id.currentValue;
467466
}
468467
}

projects/igniteui-angular/src/lib/drop-down/public_api.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import { IgxDropDownItemComponent } from './drop-down-item.component';
44
import { IgxDropDownItemNavigationDirective } from './drop-down-navigation.directive';
55
import { CommonModule } from '@angular/common';
66
import { IgxToggleModule } from '../directives/toggle/toggle.directive';
7-
import { IgxSelectionAPIService } from '../core/selection';
87
import { IgxDropDownGroupComponent } from './drop-down-group.component';
9-
import { IgxDropDownBaseDirective } from './drop-down.base';
108
import { IgxDropDownItemBaseDirective } from './drop-down-item.base';
119

1210
export * from './drop-down.component';
@@ -22,7 +20,6 @@ export * from './drop-down-group.component';
2220
*/
2321
@NgModule({
2422
declarations: [
25-
IgxDropDownBaseDirective,
2623
IgxDropDownComponent,
2724
IgxDropDownItemBaseDirective,
2825
IgxDropDownItemComponent,

projects/igniteui-angular/src/lib/grids/cell.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
421421
*/
422422
@Input()
423423
@HostBinding('class.igx-grid__td--active')
424-
public active: boolean;
424+
public active = false;
425425

426426
@HostBinding('attr.aria-selected')
427427
get ariaSelected() {
@@ -547,6 +547,7 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
547547
};
548548
}
549549

550+
/** @hidden @internal @deprecated */
550551
public focused = this.active;
551552
protected compositionStartHandler;
552553
protected compositionEndHandler;

projects/igniteui-angular/src/lib/grids/columns/column-group.component.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,7 @@ export class IgxColumnGroupComponent extends IgxColumnComponent implements After
159159
* @memberof IgxColumnGroupComponent
160160
*/
161161
@Input()
162-
get collapsibleIndicatorTemplate(): TemplateRef<any> {
163-
return this._collapseIndicatorTemplate;
164-
}
165-
set collapsibleIndicatorTemplate(template: TemplateRef<any>) {
166-
this._collapseIndicatorTemplate = template;
167-
}
162+
public collapsibleIndicatorTemplate: TemplateRef<any>;
168163

169164
/**
170165
* Returns a reference to the inline editor template.
@@ -271,7 +266,7 @@ export class IgxColumnGroupComponent extends IgxColumnComponent implements After
271266
this._headerTemplate = this.headTemplate.toArray()[0].template;
272267
}
273268
if (this.collapseIndicatorTemplate) {
274-
this._collapseIndicatorTemplate = this.collapseIndicatorTemplate.template;
269+
this.collapsibleIndicatorTemplate = this.collapseIndicatorTemplate.template;
275270
}
276271
// currently only ivy fixes the issue, we have to slice only if the first child is group
277272
if (this.children.first === this) {

projects/igniteui-angular/src/lib/grids/columns/column.component.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ export class IgxColumnComponent implements AfterContentInit {
969969
}
970970

971971
/** @hidden */
972-
@Input('collapsibleIndicatorTemplate')
972+
@Input()
973973
public collapsibleIndicatorTemplate: TemplateRef<any>;
974974
/**
975975
* Gets the cells of the column.
@@ -1184,13 +1184,15 @@ export class IgxColumnComponent implements AfterContentInit {
11841184
* @hidden
11851185
* @internal
11861186
*/
1187-
public collapsible = false;
1187+
public get collapsible() { return false; }
1188+
public set collapsible(_value: boolean) {}
11881189

11891190
/**
11901191
* @hidden
11911192
* @internal
11921193
*/
1193-
public expanded = true;
1194+
public get expanded() { return true; }
1195+
public set expanded(_value: boolean) {}
11941196

11951197
/**
11961198
* hidden
@@ -1259,10 +1261,6 @@ export class IgxColumnComponent implements AfterContentInit {
12591261
* @hidden
12601262
*/
12611263
protected _filterCellTemplate: TemplateRef<any>;
1262-
/**
1263-
* @hidden
1264-
*/
1265-
protected _collapseIndicatorTemplate: TemplateRef<any>;
12661264
/**
12671265
* @hidden
12681266
*/

projects/igniteui-angular/src/lib/grids/grid-base.directive.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,8 @@ const MIN_ROW_EDITING_COUNT_THRESHOLD = 2;
161161

162162
export const IgxGridTransaction = new InjectionToken<string>('IgxGridTransaction');
163163

164-
@Directive({
165-
selector: '[igxGridBaseComponent]'
166-
})
167-
export class IgxGridBaseDirective extends DisplayDensityBase implements
164+
@Directive()
165+
export abstract class IgxGridBaseDirective extends DisplayDensityBase implements GridType,
168166
OnInit, DoCheck, OnDestroy, AfterContentInit, AfterViewInit {
169167
private _customDragIndicatorIconTemplate: TemplateRef<any>;
170168
protected _init = true;
@@ -247,7 +245,7 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
247245
/**
248246
* @hidden @internal
249247
*/
250-
public id: string;
248+
public abstract id: string;
251249

252250
/**
253251
* Gets/Sets a custom template when empty.
@@ -2535,8 +2533,8 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
25352533
*/
25362534
public unpinnedRecords: any[];
25372535

2538-
data: any[];
2539-
filteredData: any[];
2536+
abstract data: any[];
2537+
abstract filteredData: any[];
25402538

25412539
/**
25422540
* @hidden

projects/igniteui-angular/src/lib/grids/grid-common.module.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { IgxGridFooterComponent } from './grid-footer/grid-footer.component';
44
import {
55
IgxGridBodyDirective
66
} from './grid.common';
7-
import { IgxGridTransaction, IgxGridBaseDirective } from './grid-base.directive';
7+
import { IgxGridTransaction } from './grid-base.directive';
88
import { IgxBaseTransactionService } from '../services/transaction/base-transaction';
99
import {
1010
IgxRowEditTemplateDirective,
@@ -35,7 +35,6 @@ import { IgxRowDirective } from './row.directive';
3535
*/
3636
@NgModule({
3737
declarations: [
38-
IgxGridBaseDirective,
3938
IgxRowDirective,
4039
IgxGridCellComponent,
4140
IgxRowEditTemplateDirective,

0 commit comments

Comments
 (0)