Skip to content

Commit ac685cb

Browse files
committed
Merge branch 'pickers-refactoring' of https://github.com/IgniteUI/igniteui-angular into PMiteva/time-picker-refactoring
2 parents 304a0a3 + 6ce03c5 commit ac685cb

File tree

115 files changed

+3884
-1277
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+3884
-1277
lines changed

Diff for: CHANGELOG.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ All notable changes for each version of this project will be documented in this
77
### General
88
- `IgxGrid`, `IgxTreeGrid`, `IgxHierarchicalGrid`
99
- **Breaking Change** - The `locale` and `pipeArgs` parameters are removed from the `operate` method exposed by the `IgxNumberSummaryOperand`, `IgxDateSummaryOperand`, `IgxCurrencySummaryOperand` and `IgxPercentSummaryOperand`. They are now set in the `igx-grid-summary-cell` template. To change the locale and format setting of the `igx-grid-summary-cell` the user can use the new `summaryFormatter` property of the `IgxColumnComponent`.
10-
- `IgxTabs`, `IgxBottomNav`
10+
- `IgxGridRowComponent`, `IgxGridGroupByRowComponent`, `IgxTreeGridRowComponent`, `IgxHierarchicalRowComponent` are no longer exposed in the public API. Automatic migration will change these imports with `RowType`.
11+
- **Behavioral changes**
12+
- `getRowByIndex`, `getRowByKey`, `cell.row` now return an object implemening the `RowType` interface.
13+
- `dragData` emitted with `IRowDragEndEventArgs`, `IRowDragStartEventArgs` is now `RowType`
14+
- `IRowDragEndEventArgs`, `IRowDragStartEventArgs` now emit `dragElement`, which holds the dragged row html element.
15+
- `row` in `IPinRowEventArgs` is now `RowType`
1116
- **Breaking Change** - `IgxTabs` and `IgxBottomNav` components were completely refactored in order to provide more flexible and descriptive way to define tab headers and contents. Please make sure to update via `ng update` in order to migrate the existing `igx-tabs` and `igx-bottom-nav` definitions to the new ones.
1217
- `IgxForOfDirective`
1318
- **Breaking Change** - `IgxForOfDirective` events are renamed as follows:

Diff for: projects/igniteui-angular/migrations/update-12_0_0/changes/members.json

+13-7
Original file line numberDiff line numberDiff line change
@@ -47,42 +47,48 @@
4747
"member": "onChunkLoad",
4848
"replaceWith": "chunkLoad",
4949
"definedIn": [
50-
"IgxForOfDirective"
50+
"IgxForOfDirective",
51+
"IgxGridForOfDirective"
5152
]
5253
},
5354
{
5455
"member": "onScrollbarVisibilityChanged",
5556
"replaceWith": "scrollbarVisibilityChanged",
5657
"definedIn": [
57-
"IgxForOfDirective"
58+
"IgxForOfDirective",
59+
"IgxGridForOfDirective"
5860
]
5961
},
6062
{
6163
"member": "onContentSizeChange",
6264
"replaceWith": "contentSizeChange",
6365
"definedIn": [
64-
"IgxForOfDirective"
66+
"IgxForOfDirective",
67+
"IgxGridForOfDirective"
6568
]
6669
},
6770
{
6871
"member": "onDataChanged",
6972
"replaceWith": "dataChanged",
7073
"definedIn": [
71-
"IgxForOfDirective"
74+
"IgxForOfDirective",
75+
"IgxGridForOfDirective"
7276
]
7377
},
7478
{
7579
"member": "onBeforeViewDestroyed",
7680
"replaceWith": "beforeViewDestroyed",
7781
"definedIn": [
78-
"IgxForOfDirective"
82+
"IgxForOfDirective",
83+
"IgxGridForOfDirective"
7984
]
8085
},
8186
{
8287
"member": "onChunkPreload",
8388
"replaceWith": "chunkPreload",
8489
"definedIn": [
85-
"IgxForOfDirective"
90+
"IgxForOfDirective",
91+
"IgxGridForOfDirective"
8692
]
8793
},
8894
{
@@ -93,4 +99,4 @@
9399
]
94100
}
95101
]
96-
}
102+
}

Diff for: projects/igniteui-angular/migrations/update-12_0_0/changes/outputs.json

+48
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@
1717
"type": "directive"
1818
}
1919
},
20+
{
21+
"name": "onChunkLoad",
22+
"replaceWith": "chunkLoad",
23+
"owner": {
24+
"selector": "[igxGridFor][igxGridForOf]",
25+
"type": "directive"
26+
}
27+
},
2028
{
2129
"name": "onScrollbarVisibilityChanged",
2230
"replaceWith": "scrollbarVisibilityChanged",
@@ -25,6 +33,14 @@
2533
"type": "directive"
2634
}
2735
},
36+
{
37+
"name": "onScrollbarVisibilityChanged",
38+
"replaceWith": "scrollbarVisibilityChanged",
39+
"owner": {
40+
"selector": "[igxGridFor][igxGridForOf]",
41+
"type": "directive"
42+
}
43+
},
2844
{
2945
"name": "onContentSizeChange",
3046
"replaceWith": "contentSizeChange",
@@ -33,6 +49,14 @@
3349
"type": "directive"
3450
}
3551
},
52+
{
53+
"name": "onContentSizeChange",
54+
"replaceWith": "contentSizeChange",
55+
"owner": {
56+
"selector": "[igxGridFor][igxGridForOf]",
57+
"type": "directive"
58+
}
59+
},
3660
{
3761
"name": "onDataChanged",
3862
"replaceWith": "dataChanged",
@@ -41,6 +65,14 @@
4165
"type": "directive"
4266
}
4367
},
68+
{
69+
"name": "onDataChanged",
70+
"replaceWith": "dataChanged",
71+
"owner": {
72+
"selector": "[igxGridFor][igxGridForOf]",
73+
"type": "directive"
74+
}
75+
},
4476
{
4577
"name": "onBeforeViewDestroyed",
4678
"replaceWith": "beforeViewDestroyed",
@@ -49,6 +81,14 @@
4981
"type": "directive"
5082
}
5183
},
84+
{
85+
"name": "onBeforeViewDestroyed",
86+
"replaceWith": "beforeViewDestroyed",
87+
"owner": {
88+
"selector": "[igxGridFor][igxGridForOf]",
89+
"type": "directive"
90+
}
91+
},
5292
{
5393
"name": "onChunkPreload",
5494
"replaceWith": "chunkPreload",
@@ -57,6 +97,14 @@
5797
"type": "directive"
5898
}
5999
},
100+
{
101+
"name": "onChunkPreload",
102+
"replaceWith": "chunkPreload",
103+
"owner": {
104+
"selector": "[igxGridFor][igxGridForOf]",
105+
"type": "directive"
106+
}
107+
},
60108
{
61109
"name": "onDataChanging",
62110
"replaceWith": "dataChanging",

Diff for: projects/igniteui-angular/migrations/update-12_0_0/index.spec.ts

+46
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,52 @@ igx-bottom-nav-content {
336336
}
337337
igx-bottom-nav-header {
338338
padding: 8px;
339+
}`);
340+
});
341+
342+
it('Should update row component types with RowType', async () => {
343+
appTree.create(
344+
'/testSrc/appPrefix/component/rows.component.ts', `
345+
import { IgxGridComponent, IgxGridRowComponent, IgxHierarchicalRowComponent, RowPinningPosition } from 'igniteui-angular';
346+
export class HGridMultiRowDragComponent {
347+
public onDropAllowed(args: IDropDroppedEventArgs)
348+
const hierRow: IgxHierarchicalRowComponent = args.dragData;
349+
const row: IgxGridRowComponent = args.dragData;
350+
const treeRow: IgxTreeGridRowComponent = args.dragData;
351+
const groupByRow: IgxGridGroupByRowComponent = args.dragData;
352+
const children = (cell.row as IgxTreeGridRowComponent).children;
353+
}
354+
public ngOnInit() {
355+
const hierRow: this.hierGrid1.getRowByIndex(0) as IgxHierarchicalRowComponent;
356+
const row: this.grid1.getRowByIndex(0) as IgxGridRowComponent;
357+
const treeRow: this.treeGrid1.getRowByIndex(0) as IgxTreeGridRowComponent;
358+
const hierRowComp: this.hierGrid1.hGridAPI.get_row_by_index(0) as IgxHierarchicalRowComponent;
359+
const rowComp: this.grid1.gridAPI.get_row_by_index(0) as IgxGridRowComponent;
360+
const treeRowComp: this.gridAPI.get_row_by_index(0) as IgxTreeGridRowComponent;
361+
}
362+
}`);
363+
const tree = await schematicRunner.runSchematicAsync('migration-20', {}, appTree)
364+
.toPromise();
365+
366+
expect(tree.readContent('/testSrc/appPrefix/component/rows.component.ts'))
367+
.toEqual(`
368+
import { IgxGridComponent, RowType, RowPinningPosition } from 'igniteui-angular';
369+
export class HGridMultiRowDragComponent {
370+
public onDropAllowed(args: IDropDroppedEventArgs)
371+
const hierRow: RowType = args.dragData;
372+
const row: RowType = args.dragData;
373+
const treeRow: RowType = args.dragData;
374+
const groupByRow: RowType = args.dragData;
375+
const children = (cell.row as RowType).children;
376+
}
377+
public ngOnInit() {
378+
const hierRow: this.hierGrid1.getRowByIndex(0) as RowType;
379+
const row: this.grid1.getRowByIndex(0) as RowType;
380+
const treeRow: this.treeGrid1.getRowByIndex(0) as RowType;
381+
const hierRowComp: this.hierGrid1.hGridAPI.get_row_by_index(0) as RowType;
382+
const rowComp: this.grid1.gridAPI.get_row_by_index(0) as RowType;
383+
const treeRowComp: this.gridAPI.get_row_by_index(0) as RowType;
384+
}
339385
}`);
340386
});
341387
});

Diff for: projects/igniteui-angular/migrations/update-12_0_0/index.ts

+107-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export default (): Rule => (host: Tree, context: SchematicContext) => {
3434
const changes = new Map<string, FileChange[]>();
3535
const htmlFiles = update.templateFiles;
3636
const sassFiles = update.sassFiles;
37+
const tsFiles = update.tsFiles;
3738
let applyComment = false;
3839

3940
const applyChanges = () => {
@@ -217,6 +218,111 @@ export default (): Rule => (host: Tree, context: SchematicContext) => {
217218
}
218219
}
219220

220-
// Apply all selector and input changes
221+
// update row components imports and typings with new RowType interface
222+
const rowsImports = [
223+
'IgxGridRowComponent, ',
224+
'IgxGridGroupByRowComponent, ',
225+
'IgxTreeGridRowComponent, ',
226+
'IgxHierarchicalRowComponent, '];
227+
228+
const rowsImportsNoSpace = [
229+
'IgxGridRowComponent,',
230+
'IgxGridGroupByRowComponent,',
231+
'IgxTreeGridRowComponent,',
232+
'IgxHierarchicalRowComponent,'];
233+
234+
const rowsImportsEnd = [
235+
', IgxGridRowComponent }',
236+
', IgxGridGroupByRowComponent }',
237+
', IgxTreeGridRowComponent }',
238+
', IgxHierarchicalRowComponent }'];
239+
240+
const rowsImportsEndNewLIne = [
241+
'IgxGridRowComponent }',
242+
'IgxGridGroupByRowComponent }',
243+
'IgxTreeGridRowComponent }',
244+
'IgxHierarchicalRowComponent }'];
245+
246+
const typyingsToReplace = [
247+
'as IgxGridRowComponent;',
248+
'as IgxGridRowComponent).',
249+
': IgxGridRowComponent',
250+
251+
'as IgxGridGroupByRowComponent;',
252+
'as IgxGridGroupByRowComponent).',
253+
': IgxGridGroupByRowComponent',
254+
255+
'as IgxTreeGridRowComponent;',
256+
'as IgxTreeGridRowComponent).',
257+
': IgxTreeGridRowComponent',
258+
259+
'as IgxHierarchicalRowComponent;',
260+
'as IgxHierarchicalRowComponent).',
261+
': IgxHierarchicalRowComponent'
262+
];
263+
264+
const replacements = [
265+
'as RowType;',
266+
'as RowType).',
267+
': RowType'
268+
];
269+
270+
271+
for (const entryPath of tsFiles) {
272+
let content = host.read(entryPath).toString();
273+
let importChanged = 0;
274+
275+
rowsImports.forEach((n, i) => {
276+
if (content.indexOf(n) !== -1) {
277+
if (importChanged === 0) {
278+
content = content.replace(n, 'RowType, ');
279+
importChanged++;
280+
} else {
281+
content = content.split(n).join('');
282+
}
283+
}
284+
});
285+
286+
rowsImportsNoSpace.forEach((n, i) => {
287+
if (content.indexOf(n) !== -1) {
288+
if (importChanged === 0) {
289+
content = content.replace(n, 'RowType,');
290+
importChanged++;
291+
} else {
292+
content = content.split(n).join('');
293+
}
294+
}
295+
});
296+
297+
rowsImportsEnd.forEach((n, i) => {
298+
if (content.indexOf(n) !== -1) {
299+
if (importChanged === 0) {
300+
content = content.replace(n, ', RowType }');
301+
importChanged++;
302+
} else {
303+
content = content.split(n).join(' }');
304+
}
305+
}
306+
});
307+
308+
rowsImportsEndNewLIne.forEach((n, i) => {
309+
if (content.indexOf(n) !== -1) {
310+
if (importChanged === 0) {
311+
content = content.replace(n, 'RowType }');
312+
importChanged++;
313+
} else {
314+
content = content.split(n).join('}');
315+
}
316+
}
317+
});
318+
319+
typyingsToReplace.forEach((n, i) => {
320+
if (content.indexOf(n) !== -1) {
321+
content = content.split(n).join(replacements[i % 3]);
322+
}
323+
});
324+
host.overwrite(entryPath, content);
325+
}
326+
221327
update.applyChanges();
222328
};

0 commit comments

Comments
 (0)