Skip to content

Commit 100a5be

Browse files
Deprecated properties cleanup (#14323)
* refactor(banner): remove deprecated event arg * refactor(column): remove deprecated movable prop * refactor(pivot-grid): remove deprecated date dimension props * refactor(overlay): remove deprecated position settings target * refactor(overlay): remove deprecated attach overload module ref param * chore(migrations): add banner event migration * chore(combo): add migration for filterable prop * docs(changelog): add entries for removed deprecated props * test(overlay): fix unit tests that unintentionally trigger component creation --------- Co-authored-by: Stamen Stoychev <[email protected]>
1 parent f578262 commit 100a5be

26 files changed

+173
-268
lines changed

CHANGELOG.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ All notable changes for each version of this project will be documented in this
55
## 18.0.0
66
### New Features
77
- `IgxCombo`, `IgxSimpleCombo`:
8-
- Introduced abillity for hiding the clear icon button when the custom clear icon template is empty.
8+
- Introduced ability for hiding the clear icon button when the custom clear icon template is empty.
99
- `IgxDateTimeEditor`, `IgxTimePicker`:
1010
- Now accept the following custom `inputFormat` options, as Angular's DatePipe:
1111
- Fractional seconds: S, SS, SSS.
@@ -38,8 +38,15 @@ All notable changes for each version of this project will be documented in this
3838

3939
### General
4040
- Removed deprecated property `displayDensity`. Size is now controlled only through the custom CSS property `--ig-size`. Refer to the [Update Guide](https://www.infragistics.com/products/ignite-ui-angular/angular/components/general/update-guide) and components documentation for usage details.
41-
42-
### General
41+
- `IgxBanner`
42+
- Removed the deprecated `banner` property of `BannerEventArgs` and `BannerCancelEventArgs`. Automatic migration to `owner` is applied.
43+
- `IgxGrid`, `IgxTreeGrid`, `IgxHierarchicalGrid`
44+
- Removed the deprecated `movable` property of `IgxColumnComponent`.
45+
- `IgxOverlayService`
46+
- Removed the deprecated `PositionSettings.target` (in favor of general `OverlaySettings.target`).
47+
- Replaced deprecated `attach` method overload accepting `ComponentFactoryResolver` (trough `NgModuleRef`-like object) with shortcut overload that uses just the root scope and `createComponent`. The overload accepting `ViewComponentRef` is still recommended for local injection context.
48+
- `IgxPivotGrid`
49+
- The `IgxPivotDateDimension` deprecated getters `inBaseDimension` and `inOption` have been removed.
4350
- `IgxSimpleCombo`
4451
- **Behavioral Change** When bound to `ngModel` and `formControlName` directives, the model would not be updated when the user types into the input and will only be updated on selection.
4552

projects/igniteui-angular/migrations/update-12_1_0/index.spec.ts

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -231,51 +231,6 @@ export class TestComponent implements OnInit {
231231
</igx-expansion-panel>`);
232232
});
233233

234-
it('Should remove references to deprecated `banner` property of `BannerEventArgs`', async () => {
235-
pending('set up tests for migrations through lang service');
236-
appTree.create(
237-
'/testSrc/appPrefix/component/expansion-test.component.ts',
238-
`import { Component, ViewChild } from '@angular/core';
239-
import { IgxBanner } from 'igniteui-angular';
240-
241-
@Component({
242-
selector: 'app-banner-test',
243-
templateUrl: './banner-test.component.html',
244-
styleUrls: ['./banner-test.component.scss']
245-
})
246-
export class BannerTestComponent {
247-
248-
@ViewChild(IgxBannerComponent, { static: true })
249-
public panel: IgxBannerComponent;
250-
251-
public onBannerOpened(event: BannerEventArgs) {
252-
console.log(event.banner);
253-
}
254-
}`
255-
);
256-
const tree = await schematicRunner
257-
.runSchematic('migration-17', {}, appTree);
258-
const expectedContent = `import { Component, ViewChild } from '@angular/core';
259-
import { IgxBanner } from 'igniteui-angular';
260-
261-
@Component({
262-
selector: 'app-banner-test',
263-
templateUrl: './banner-test.component.html',
264-
styleUrls: ['./banner-test.component.scss']
265-
})
266-
export class BannerTestComponent {
267-
268-
@ViewChild(IgxBannerComponent, { static: true })
269-
public panel: IgxBannerComponent;
270-
271-
public onBannerOpened(event: BannerEventArgs) {
272-
console.log(event.owner);
273-
}
274-
}`;
275-
expect(
276-
tree.readContent('/testSrc/appPrefix/component/expansion-test.component.ts')
277-
).toEqual(expectedContent);
278-
});
279234
it('should remove paging property and define a igx-paginator component instead', async () => {
280235
appTree.create(
281236
'/testSrc/appPrefix/component/test.component.html', `

projects/igniteui-angular/migrations/update-18_0_0/changes/inputs.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,15 @@
161161
"selector": "igx-pivot-grid",
162162
"type": "component"
163163
}
164+
},
165+
{
166+
"name": "filterable",
167+
"replaceWith": "filteringOptions",
168+
"valueTransform": "comboFilteringTransform",
169+
"owner": {
170+
"selector": "igx-combo",
171+
"type": "component"
172+
}
164173
}
165174
]
166175
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"$schema": "../../common/schema/members-changes.schema.json",
3+
"changes": [
4+
{
5+
"member": "banner",
6+
"replaceWith": "owner",
7+
"definedIn": [
8+
"BannerEventArgs",
9+
"BannerCancelEventArgs"
10+
]
11+
}
12+
]
13+
}

projects/igniteui-angular/migrations/update-18_0_0/index.spec.ts

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,4 +462,69 @@ describe(`Update to ${version}`, () => {
462462
`$custom-bottom-nav: bottom-nav-theme($icon-selected-color: red);`
463463
);
464464
});
465+
466+
it('Should remove references to deprecated `banner` property of `BannerEventArgs`', async () => {
467+
pending('set up tests for migrations through lang service');
468+
appTree.create(
469+
'/testSrc/appPrefix/component/expansion-test.component.ts',
470+
`import { Component, ViewChild } from '@angular/core';
471+
import { IgxBanner } from 'igniteui-angular';
472+
473+
@Component({
474+
selector: 'app-banner-test',
475+
templateUrl: './banner-test.component.html',
476+
styleUrls: ['./banner-test.component.scss']
477+
})
478+
export class BannerTestComponent {
479+
480+
@ViewChild(IgxBannerComponent, { static: true })
481+
public panel: IgxBannerComponent;
482+
483+
public onBannerOpened(event: BannerEventArgs) {
484+
console.log(event.banner);
485+
}
486+
}`
487+
);
488+
const tree = await schematicRunner.runSchematic(migrationName, { shouldInvokeLS: false }, appTree);
489+
const expectedContent = `import { Component, ViewChild } from '@angular/core';
490+
import { IgxBanner } from 'igniteui-angular';
491+
492+
@Component({
493+
selector: 'app-banner-test',
494+
templateUrl: './banner-test.component.html',
495+
styleUrls: ['./banner-test.component.scss']
496+
})
497+
export class BannerTestComponent {
498+
499+
@ViewChild(IgxBannerComponent, { static: true })
500+
public panel: IgxBannerComponent;
501+
502+
public onBannerOpened(event: BannerEventArgs) {
503+
console.log(event.owner);
504+
}
505+
}`;
506+
expect(
507+
tree.readContent('/testSrc/appPrefix/component/expansion-test.component.ts')
508+
).toEqual(expectedContent);
509+
});
510+
511+
it('should replace Combo property `filterable` with `filteringOptions`', async () => {
512+
appTree.create(`/testSrc/appPrefix/component/test.component.html`,
513+
`
514+
<igx-combo [filterable]="false"></igx-combo>
515+
<igx-combo filterable="true"></igx-combo>
516+
<igx-combo [filterable]="myProp"></igx-combo>
517+
`
518+
);
519+
520+
const tree = await schematicRunner.runSchematic(migrationName, { shouldInvokeLS: false }, appTree);
521+
522+
expect(tree.readContent('/testSrc/appPrefix/component/test.component.html')).toEqual(
523+
`
524+
<igx-combo [filteringOptions]="{ filterable: false }"></igx-combo>
525+
<igx-combo [filteringOptions]="{ filterable: true }"></igx-combo>
526+
<igx-combo [filteringOptions]="{ filterable: myProp }"></igx-combo>
527+
`
528+
);
529+
});
465530
});

projects/igniteui-angular/migrations/update-18_0_0/index.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,21 @@ export default (): Rule => async (host: Tree, context: SchematicContext) => {
7777
}
7878
});
7979

80+
update.addValueTransform('comboFilteringTransform', (args: BoundPropertyObject): void => {
81+
args.bindingType = InputPropertyType.EVAL;
82+
83+
switch (args.value) {
84+
case 'true':
85+
args.value = '{ filterable: true }';
86+
break;
87+
case 'false':
88+
args.value = '{ filterable: false }';
89+
break;
90+
default:
91+
args.value = `{ filterable: ${args.value} }`;
92+
}
93+
});
94+
8095
const updateMainCSSFile = (host: Tree, context: SchematicContext): Tree => {
8196
const angularConfigBuffer = host.read('angular.json');
8297
if (!angularConfigBuffer) {

projects/igniteui-angular/src/lib/banner/banner.component.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ import { BannerResourceStringsEN, IBannerResourceStrings } from '../core/i18n/ba
2323
import { getCurrentResourceStrings } from '../core/i18n/resources';
2424

2525
export interface BannerEventArgs extends IBaseEventArgs {
26-
/**
27-
* @deprecated in 12.1.0. To get a reference to the banner, use `owner` instead
28-
*/
29-
banner: IgxBannerComponent;
3026
event?: Event;
3127
}
3228

@@ -221,9 +217,8 @@ export class IgxBannerComponent implements IToggleView {
221217
* ```
222218
*/
223219
public open(event?: Event) {
224-
this._bannerEvent = { banner: this, owner: this, event};
220+
this._bannerEvent = { owner: this, event};
225221
const openingArgs: BannerCancelEventArgs = {
226-
banner: this,
227222
owner: this,
228223
event,
229224
cancel: false
@@ -250,9 +245,8 @@ export class IgxBannerComponent implements IToggleView {
250245
* ```
251246
*/
252247
public close(event?: Event) {
253-
this._bannerEvent = { banner: this, owner: this, event};
248+
this._bannerEvent = { owner: this, event};
254249
const closingArgs: BannerCancelEventArgs = {
255-
banner: this,
256250
owner: this,
257251
event,
258252
cancel: false

projects/igniteui-angular/src/lib/date-range-picker/date-range-picker.component.spec.ts

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { DateRangeType } from '../core/dates';
1616
import { IgxDateRangePickerComponent, IgxDateRangeEndComponent } from './public_api';
1717
import { AutoPositionStrategy, IgxOverlayService } from '../services/public_api';
1818
import { AnimationMetadata, AnimationOptions } from '@angular/animations';
19-
import { IgxCalendarContainerComponent } from '../date-common/calendar-container/calendar-container.component';
2019
import { IgxCalendarComponent, WEEKDAYS } from '../calendar/public_api';
2120
import { Subject } from 'rxjs';
2221
import { AsyncPipe } from '@angular/common';
@@ -47,8 +46,6 @@ const CSS_CLASS_INACTIVE_DATE = 'igx-days-view__date--inactive';
4746
describe('IgxDateRangePicker', () => {
4847
describe('Unit tests: ', () => {
4948
let mockElement: any;
50-
let mockElementRef: any;
51-
let mockFactoryResolver: any;
5249
let mockApplicationRef: any;
5350
let mockAnimationBuilder: any;
5451
let mockDocument: any;
@@ -67,17 +64,6 @@ describe('IgxDateRangePicker', () => {
6764
'registerOnValidatorChangeCb']);
6865
/* eslint-disable @typescript-eslint/no-unused-vars */
6966
beforeEach(() => {
70-
mockFactoryResolver = {
71-
resolveComponentFactory: (c: any) => ({
72-
create: (i: any) => ({
73-
hostView: '',
74-
location: mockElementRef,
75-
changeDetectorRef: { detectChanges: () => { } },
76-
destroy: () => { },
77-
instance: new IgxCalendarContainerComponent()
78-
})
79-
})
80-
};
8167
mockElement = {
8268
style: { visibility: '', cursor: '', transitionDuration: '' },
8369
classList: { add: () => { }, remove: () => { } },
@@ -91,7 +77,6 @@ describe('IgxDateRangePicker', () => {
9177
};
9278
mockElement.parent = mockElement;
9379
mockElement.parentElement = mockElement;
94-
mockElementRef = { nativeElement: mockElement };
9580
// eslint-disable-next-line @typescript-eslint/no-unused-vars
9681
mockApplicationRef = { attachView: (h: any) => { }, detachView: (h: any) => { } };
9782
mockInjector = jasmine.createSpyObj('Injector', {
@@ -143,7 +128,7 @@ describe('IgxDateRangePicker', () => {
143128
mockPlatformUtil = { isIOS: false };
144129
mockAnimationService = new IgxAngularAnimationService(mockAnimationBuilder);
145130
overlay = new IgxOverlayService(
146-
mockFactoryResolver, mockApplicationRef, mockInjector, mockDocument, mockNgZone, mockPlatformUtil, mockAnimationService);
131+
mockApplicationRef, mockDocument, mockNgZone, mockPlatformUtil, mockAnimationService);
147132
mockCalendar = new IgxCalendarComponent(platform, 'en');
148133

149134
mockDaysView = {
@@ -264,15 +249,6 @@ describe('IgxDateRangePicker', () => {
264249
dateRange.minValue = new Date(2000, 10, 1);
265250
dateRange.maxValue = new Date(2000, 10, 20);
266251

267-
dateRange.open({
268-
closeOnOutsideClick: true,
269-
modal: false,
270-
target: dateRange.element.nativeElement,
271-
positionStrategy: new AutoPositionStrategy({
272-
openAnimation: null,
273-
closeAnimation: null
274-
})
275-
});
276252
(dateRange as any).updateCalendar();
277253
expect(mockCalendar.disabledDates.length).toEqual(2);
278254
expect(mockCalendar.disabledDates[0].type).toEqual(DateRangeType.Before);

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,7 @@ export class IgxAutocompleteDirective extends IgxDropDownItemNavigationDirective
171171

172172
private get settings(): OverlaySettings {
173173
const settings = Object.assign({}, this.defaultSettings, this.autocompleteSettings);
174-
const target = settings.target || settings.positionStrategy.settings.target;
175-
if (!target) {
174+
if (!settings.target) {
176175
const positionStrategyClone: IPositionStrategy = settings.positionStrategy.clone();
177176
settings.target = this.parentElement;
178177
settings.positionStrategy = positionStrategyClone;

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

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -440,21 +440,7 @@ export class IgxColumnComponent implements AfterContentInit, OnDestroy, ColumnTy
440440
@WatchColumnChanges()
441441
@Input({ transform: booleanAttribute })
442442
public disablePinning = false;
443-
/**
444-
* Sets/gets whether the column is movable.
445-
* Default value is `false`.
446-
*
447-
* ```typescript
448-
* let isMovable = this.column.movable;
449-
* ```
450-
* ```html
451-
* <igx-column [movable] = "true"></igx-column>
452-
* ```
453-
*
454-
* @deprecated in version 13.1.0. Use the Grid's `moving` property instead.
455-
*/
456-
@Input({ transform: booleanAttribute })
457-
public movable = false;
443+
458444
/**
459445
* Gets the `width` of the column.
460446
* ```typescript

0 commit comments

Comments
 (0)