Skip to content

Commit 7c6e021

Browse files
authored
Merge branch 'master' into mkirkova/fix-10242-master
2 parents 0d228d2 + d380ced commit 7c6e021

File tree

15 files changed

+205
-68
lines changed

15 files changed

+205
-68
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ All notable changes for each version of this project will be documented in this
7373
- Inputs `showToolbar`, `toolbarTitle`, `columnHiding`, `columnHidingTitle`, `hiddenColumnsText`,
7474
`columnPinning`, `columnPinningTitle`, `pinnedColumnsText`.
7575
Use `IgxGridToolbarComponent`, `IgxGridToolbarHidingComponent`, `IgxGridToolbarPinningComponent` instead.
76-
- **Breaking Change** - The `rowSelected` event is renamed to `rowSelectionChanging` to better reflect its function
76+
- **Breaking Change** - The `rowSelected` event is renamed to `rowSelectionChanging` to better reflect its function.
77+
- **Breaking Change** - The `columnSelected` event is renamed to `columnSelectionChanging` to better reflect its function.
7778
- `igxGrid`
7879
- Exposed a `groupStrategy` input that functions similarly to `sortStrategy`, allowing customization of the grouping behavior of the grid. Please, refer to the [Group By ](https://www.infragistics.com/products/ignite-ui-angular/angular/components/grid/groupby) topic for more information.
7980
- `IgxColumnActionsComponent`

projects/igniteui-angular/migrations/update-13_0_0/changes/members.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@
3131
"IgxHierarchicalGridComponent",
3232
"IgxRowIslandComponent"
3333
]
34+
},
35+
{
36+
"member": "columnSelected",
37+
"replaceWith": "columnSelectionChanging",
38+
"definedIn": [
39+
"IgxGridComponent",
40+
"IgxTreeGridComponent",
41+
"IgxHierarchicalGridComponent",
42+
"IgxRowIslandComponent"
43+
]
3444
}
3545
]
3646
}

projects/igniteui-angular/migrations/update-13_0_0/changes/outputs.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,38 @@
3232
"selector": "igx-row-island",
3333
"type": "component"
3434
}
35+
},
36+
{
37+
"name": "columnSelected",
38+
"replaceWith": "columnSelectionChanging",
39+
"owner": {
40+
"selector": "igx-grid",
41+
"type": "component"
42+
}
43+
},
44+
{
45+
"name": "columnSelected",
46+
"replaceWith": "columnSelectionChanging",
47+
"owner": {
48+
"selector": "igx-tree-grid",
49+
"type": "component"
50+
}
51+
},
52+
{
53+
"name": "columnSelected",
54+
"replaceWith": "columnSelectionChanging",
55+
"owner": {
56+
"selector": "igx-hierarchical-grid",
57+
"type": "component"
58+
}
59+
},
60+
{
61+
"name": "columnSelected",
62+
"replaceWith": "columnSelectionChanging",
63+
"owner": {
64+
"selector": "igx-row-island",
65+
"type": "component"
66+
}
3567
}
3668
]
3769
}

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

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,4 +200,73 @@ describe(`Update to ${version}`, () => {
200200
</div>
201201
`.replace(lineBreaksAndSpaceRegex, ''));
202202
});
203+
204+
it('should insert a comment when exporter services are present in module.ts files', async () => {
205+
appTree.create('/testSrc/appPrefix/component/app.module.ts',
206+
`import { NgModule } from "@angular/core";
207+
import { FormsModule } from "@angular/forms";
208+
import { BrowserModule } from "@angular/platform-browser";
209+
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
210+
import { AppComponent } from "./app.component";
211+
import { IgxCsvExporterService, IgxExcelExporterService } from "igniteui-angular";
212+
import { ExcelExportComponent } from "./services/export-excel/excel-export.component";
213+
214+
@NgModule({
215+
bootstrap: [AppComponent],
216+
declarations: [
217+
AppComponent,
218+
ExcelExportComponent
219+
],
220+
imports: [
221+
BrowserModule,
222+
BrowserAnimationsModule,
223+
FormsModule
224+
],
225+
providers: [
226+
IgxCsvExporterService,
227+
IgxExcelExporterService
228+
],
229+
entryComponents: [],
230+
schemas: []
231+
})
232+
export class AppModule {}
233+
`);
234+
235+
const tree = await schematicRunner
236+
.runSchematicAsync(migrationName, {}, appTree)
237+
.toPromise();
238+
239+
expect(
240+
tree.readContent('/testSrc/appPrefix/component/app.module.ts')
241+
).toEqual(
242+
`// IgxCsvExporterService and IgxExcelExporterService no longer need to be manually provided and can be safely removed.
243+
import { NgModule } from "@angular/core";
244+
import { FormsModule } from "@angular/forms";
245+
import { BrowserModule } from "@angular/platform-browser";
246+
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
247+
import { AppComponent } from "./app.component";
248+
import { IgxCsvExporterService, IgxExcelExporterService } from "igniteui-angular";
249+
import { ExcelExportComponent } from "./services/export-excel/excel-export.component";
250+
251+
@NgModule({
252+
bootstrap: [AppComponent],
253+
declarations: [
254+
AppComponent,
255+
ExcelExportComponent
256+
],
257+
imports: [
258+
BrowserModule,
259+
BrowserAnimationsModule,
260+
FormsModule
261+
],
262+
providers: [
263+
IgxCsvExporterService,
264+
IgxExcelExporterService
265+
],
266+
entryComponents: [],
267+
schemas: []
268+
})
269+
export class AppModule {}
270+
`);
271+
});
203272
});

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export default (): Rule => (host: Tree, context: SchematicContext) => {
1616
const GRIDS = ['IgxGridComponent', 'IgxTreeGridComponent', 'IgxHierarchicalGridComponent'];
1717
const TAGS = ['igx-grid', 'igx-tree-grid', 'igx-hierarchical-grid'];
1818
const tsFiles = update.tsFiles;
19+
const SERVICES = ['IgxCsvExporterService', 'IgxExcelExporterService'];
1920

2021
for (const path of update.templateFiles) {
2122
findElementNodes(parseFile(host, path), TAGS)
@@ -61,5 +62,29 @@ export default (): Rule => (host: Tree, context: SchematicContext) => {
6162
}
6263
});
6364
}
65+
66+
const moduleTsFiles = tsFiles.filter(x => x.endsWith('.module.ts'));
67+
for (const path of moduleTsFiles) {
68+
let content = host.read(path)?.toString();
69+
const servicesInFile = [];
70+
SERVICES.forEach(service => {
71+
if (content.indexOf(service) > -1) {
72+
servicesInFile.push(service);
73+
}
74+
});
75+
76+
if (servicesInFile.length > 0) {
77+
let newLine = '\n';
78+
if (content.indexOf('\r\n') > -1) {
79+
newLine = '\r\n';
80+
}
81+
82+
const comment =
83+
'// ' + servicesInFile.join(' and ') + ' no longer need to be manually provided and can be safely removed.' + newLine;
84+
content = comment + content;
85+
host.overwrite(path, content);
86+
}
87+
}
88+
6489
update.applyChanges();
6590
};

projects/igniteui-angular/src/lib/grids/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ A list of the events emitted by the **igx-grid**:
229229
|`columnMovingStart`|Emitted when a column moving starts. Returns the moved column object.|
230230
|`selected`|Emitted when a cell is selected. Returns the cell object.|
231231
|`rowSelectionChanging`|Emitted when row selection is changing. Returns array with old and new selected rows' IDs and the target row, if available.|
232-
|`columnSelected`|Emitted when a column selection has changed. Returns array with old and new selected column' fields|
232+
|`columnSelectionChanging`|Emitted when a column selection is changing. Returns array with old and new selected column' fields|
233233
|`columnInit`|Emitted when the grid columns are initialized. Returns the column object.|
234234
|`sortingDone`|Emitted when sorting is performed through the UI. Returns the sorting expression.|
235235
|`filteringDone`|Emitted when filtering is performed through the UI. Returns the filtering expressions tree of the column for which the filtering was performed.|

projects/igniteui-angular/src/lib/grids/common/events.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ export interface IRowSelectionEventArgs extends CancelableEventArgs, IBaseEventA
9191
}
9292

9393
export interface IColumnSelectionEventArgs extends CancelableEventArgs, IBaseEventArgs {
94-
oldSelection: string[];
94+
readonly oldSelection: string[];
9595
newSelection: string[];
96-
added: string[];
97-
removed: string[];
98-
event?: Event;
96+
readonly added: string[];
97+
readonly removed: string[];
98+
readonly event?: Event;
9999
}
100100

101101
export interface ISearchInfo {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,11 +476,11 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
476476
*
477477
* @example
478478
* ```html
479-
* <igx-grid #grid (columnSelected)="columnSelected($event)" [data]="localData" [autoGenerate]="true"></igx-grid>
479+
* <igx-grid #grid (columnSelectionChanging)="columnSelectionChanging($event)" [data]="localData" [autoGenerate]="true"></igx-grid>
480480
* ```
481481
*/
482482
@Output()
483-
public columnSelected = new EventEmitter<IColumnSelectionEventArgs>();
483+
public columnSelectionChanging = new EventEmitter<IColumnSelectionEventArgs>();
484484

485485
/**
486486
* Emitted before `IgxColumnComponent` is pinned.

0 commit comments

Comments
 (0)