Skip to content

Commit 0973495

Browse files
committed
Merge branch 'PMiteva/fix-9717-12.1.x' of https://github.com/IgniteUI/igniteui-angular into PMiteva/fix-9717-12.1.x
2 parents 80791db + f14e601 commit 0973495

File tree

7 files changed

+67
-30
lines changed

7 files changed

+67
-30
lines changed

projects/igniteui-angular/migrations/common/UpdateChanges.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ export class UpdateChanges {
196196
this.valueTransforms.set(functionName, callback);
197197
}
198198

199-
public getDefaultLanguageService(entryPath: string): tss.LanguageService | undefined {
199+
/** Path must be absolute. If calling externally, use this.getAbsolutePath */
200+
protected getDefaultLanguageService(entryPath: string): tss.LanguageService | undefined {
200201
const project = this.getDefaultProjectForFile(entryPath);
201202
return project.getLanguageService();
202203
}

projects/igniteui-angular/migrations/common/tsUtils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ const getTypeDefinitions = (langServ: tss.LanguageService, entryPath: string, po
247247
* Get type information about a TypeScript identifier
248248
*
249249
* @param langServ TypeScript/Angular LanguageService
250-
* @param entryPath path to file
250+
* @param entryPath path to file (absolute)
251251
* @param position Index of identifier
252252
*/
253253
export const getTypeDefinitionAtPosition =

projects/igniteui-angular/migrations/update-11_1_0/changes/members.json

+14
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,20 @@
363363
"definedIn": [
364364
"IgxTooltipTargetDirective"
365365
]
366+
},
367+
{
368+
"member": "remote",
369+
"replaceWith": "Remote",
370+
"definedIn": [
371+
"GridPagingMode"
372+
]
373+
},
374+
{
375+
"member": "local",
376+
"replaceWith": "Local",
377+
"definedIn": [
378+
"GridPagingMode"
379+
]
366380
}
367381
]
368382
}

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

+45
Original file line numberDiff line numberDiff line change
@@ -749,4 +749,49 @@ export class CsvExportComponent {
749749
)
750750
).toEqual(expectedContent);
751751
});
752+
753+
it('should update GridPagingMode enum from lowerCase to TitleCase', async () => {
754+
pending('set up tests for migrations through lang service');
755+
appTree.create(
756+
'/testSrc/appPrefix/component/paging-test.component.ts',
757+
`import { Component } from '@angular/core';
758+
import { GridPagingMode } from "igniteui-angular";
759+
760+
@Component({
761+
selector: "app-paging-test",
762+
styleUrls: ["./paging-test.component.scss"],
763+
templateUrl: "./paging-test.component.html"
764+
})
765+
export class PagingComponent {
766+
public pagingLocal: GridPagingMode = GridPagingMode.Local;
767+
public pagingRemote: GridPagingMode = GridPagingMode.Remote;
768+
constructor(){}
769+
}
770+
`);
771+
772+
const tree = await runner
773+
.runSchematicAsync('migration-19', {}, appTree)
774+
.toPromise();
775+
776+
const expectedContent =
777+
`import { Component } from '@angular/core';
778+
import { GridPagingMode } from "igniteui-angular";
779+
780+
@Component({
781+
selector: "app-paging-test",
782+
styleUrls: ["./paging-test.component.scss"],
783+
templateUrl: "./paging-test.component.html"
784+
})
785+
export class PagingComponent {
786+
public pagingLocal: GridPagingMode = GridPagingMode.local;
787+
public pagingRemote: GridPagingMode = GridPagingMode.remote;
788+
constructor(){}
789+
}
790+
`;
791+
expect(
792+
tree.readContent(
793+
'/testSrc/appPrefix/component/paging-test.component.ts'
794+
)
795+
).toEqual(expectedContent);
796+
});
752797
});
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';
2-
import { findMatches, replaceMatch } from '../common/tsUtils';
32
import { UpdateChanges } from '../common/UpdateChanges';
43

54
const version = '11.1.0';
@@ -8,28 +7,5 @@ export default (): Rule => (host: Tree, context: SchematicContext) => {
87
context.logger.info(`Applying migration for Ignite UI for Angular to version ${version}`);
98

109
const update = new UpdateChanges(__dirname, host, context);
11-
const tsFiles = update.tsFiles;
12-
const targetEnum = 'GridPagingMode';
13-
const changes = [
14-
{ member: 'remote', replaceWith: 'Remote', definedIn: [targetEnum] },
15-
{ member: 'local', replaceWith: 'Local', definedIn: [targetEnum] }
16-
];
1710
update.applyChanges();
18-
for (const entryPath of tsFiles) {
19-
const ls = update.getDefaultLanguageService(entryPath);
20-
let content = host.read(entryPath).toString();
21-
for (const change of changes) {
22-
const matches = findMatches(content, change.member);
23-
for (const position of matches) {
24-
const definition = ls.getDefinitionAndBoundSpan(entryPath, position - 1)?.definitions[0];
25-
if (definition
26-
&& definition.kind === 'enum'
27-
&& definition.name === targetEnum
28-
&& definition.fileName.includes('igniteui-angular')) {
29-
content = replaceMatch(content, change.member, change.replaceWith, position);
30-
host.overwrite(entryPath, content);
31-
}
32-
}
33-
}
34-
}
3511
};

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

+3
Original file line numberDiff line numberDiff line change
@@ -7003,6 +7003,9 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
70037003

70047004
this.hideOverlays();
70057005
this.actionStrip?.hide();
7006+
if (this.actionStrip) {
7007+
this.actionStrip.context = null;
7008+
}
70067009
const args: IGridScrollEventArgs = {
70077010
direction: 'vertical',
70087011
event,
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
<div>
22
<igx-tree-grid [pinning]="pinningConfig" #grid [allowFiltering]="true" [data]="data" primaryKey="employeeID" foreignKey="PID"
3-
[width]="'900px'" [height]="'800px'" [rowEditable]="true"
4-
(mouseleave)="onMouseLeave(actionstrip)"
5-
(mouseover)="onMouseOver($event, grid, actionstrip)">
3+
[width]="'900px'" [height]="'800px'" [rowEditable]="true">
64
<igx-column *ngFor="let c of columns" [field]="c.field" [dataType]="c.dataType" [header]="c.label"
75
[pinned]="c.pinned" [movable]="c.movable" [groupable]="false" [resizable]="c.resizable" [width]="c.width"
86
[sortable]="true" [filterable]="true" [editable]="true" [hidden]="c.hidden"
97
[minWidth]="c.minWidth" [maxWidth]="c.maxWidth">
108
</igx-column>
119
<igx-action-strip #actionstrip>
1210
<igx-grid-pinning-actions></igx-grid-pinning-actions>
13-
<igx-grid-editing-actions [addRow]="true" [addChild]='true'></igx-grid-editing-actions>
11+
<igx-grid-editing-actions [addRow]="true" [addChild]="actionstrip.context?.treeRow.level < 1"></igx-grid-editing-actions>
1412
</igx-action-strip>
1513
</igx-tree-grid>
1614
</div>

0 commit comments

Comments
 (0)