Skip to content

Commit 9983453

Browse files
committed
feat: auto-enabled external resources with their associated flags
1 parent e0c1951 commit 9983453

File tree

24 files changed

+185
-77
lines changed

24 files changed

+185
-77
lines changed

demos/aurelia/src/examples/slickgrid/example18.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,13 @@ export class Example18 {
253253
initialGroupBy: ['duration'],
254254
},
255255
darkMode: this._darkMode,
256-
enableTextExport: true,
257-
enableExcelExport: true,
258256
excelExportOptions: { sanitizeDataExport: true },
259257
textExportOptions: { sanitizeDataExport: true },
260258
externalResources: [this.excelExportService, this.pdfExportService, this.textExportService],
261-
enablePdfExport: true,
259+
// -- NOTE: registered resources are auto-enabled
260+
// enableTextExport: true,
261+
// enablePdfExport: true,
262+
// enableExcelExport: true,
262263
pdfExportOptions: {
263264
repeatHeadersOnEachPage: true, // defaults to true
264265
documentTitle: 'Grouping Grid',

demos/aurelia/test/cypress/e2e/example18.cy.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,10 @@ describe('Example 18 - Draggable Grouping & Aggregators', () => {
122122
it('should expand all rows with "Expand All" from context menu and expect all the Groups to be expanded and the Toogle All icon to be collapsed', () => {
123123
cy.get('#grid18').find('.slick-row .slick-cell:nth(1)').rightclick({ force: true });
124124

125-
cy.get('.slick-context-menu .slick-menu-command-list')
126-
.find('.slick-menu-item')
127-
.find('.slick-menu-content')
128-
.contains('Expand all Groups')
129-
.click();
125+
cy.get('.slick-context-menu .slick-menu-command-list').find('.slick-menu-content').contains('Export in CSV format');
126+
cy.get('.slick-context-menu .slick-menu-command-list').find('.slick-menu-content').contains('Export to Excel');
127+
cy.get('.slick-context-menu .slick-menu-command-list').find('.slick-menu-content').contains('Export to PDF');
128+
cy.get('.slick-context-menu .slick-menu-command-list').find('.slick-menu-content').contains('Expand all Groups').click();
130129

131130
cy.get('#grid18').find('.slick-group-toggle.collapsed').should('have.length', 0);
132131

demos/react/src/examples/slickgrid/Example18.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,16 +245,17 @@ const Example18: React.FC = () => {
245245
initialGroupBy: ['duration'],
246246
},
247247
darkMode,
248-
enableTextExport: true,
249-
enableExcelExport: true,
250248
excelExportOptions: { sanitizeDataExport: true },
251249
textExportOptions: { sanitizeDataExport: true },
252-
enablePdfExport: true,
253250
pdfExportOptions: {
254251
repeatHeadersOnEachPage: true, // defaults to true
255252
documentTitle: 'Grouping Grid',
256253
},
257254
externalResources: [excelExportService, pdfExportService, textExportService],
255+
// -- NOTE: registered resources are auto-enabled
256+
// enableTextExport: true,
257+
// enablePdfExport: true,
258+
// enableExcelExport: true,
258259
};
259260

260261
setColumnDefinitions(columnDefinitions);

demos/react/test/cypress/e2e/example18.cy.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,10 @@ describe('Example 18 - Draggable Grouping & Aggregators', () => {
122122
it('should expand all rows with "Expand All" from context menu and expect all the Groups to be expanded and the Toogle All icon to be collapsed', () => {
123123
cy.get('#grid18').find('.slick-row .slick-cell:nth(1)').rightclick({ force: true });
124124

125-
cy.get('.slick-context-menu .slick-menu-command-list')
126-
.find('.slick-menu-item')
127-
.find('.slick-menu-content')
128-
.contains('Expand all Groups')
129-
.click();
125+
cy.get('.slick-context-menu .slick-menu-command-list').find('.slick-menu-content').contains('Export in CSV format');
126+
cy.get('.slick-context-menu .slick-menu-command-list').find('.slick-menu-content').contains('Export to Excel');
127+
cy.get('.slick-context-menu .slick-menu-command-list').find('.slick-menu-content').contains('Export to PDF');
128+
cy.get('.slick-context-menu .slick-menu-command-list').find('.slick-menu-content').contains('Expand all Groups').click();
130129

131130
cy.get('#grid18').find('.slick-group-toggle.collapsed').should('have.length', 0);
132131

demos/vanilla/src/examples/example03.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,6 @@ export default class Example03 {
355355
enableAutoSizeColumns: true,
356356
enableAutoResize: true,
357357
enableCellNavigation: true,
358-
enablePdfExport: true,
359-
enableTextExport: true,
360-
enableExcelExport: true,
361358
excelExportOptions: {
362359
exportWithFormatter: true,
363360
},
@@ -367,6 +364,10 @@ export default class Example03 {
367364
repeatHeadersOnEachPage: true, // defaults to true
368365
},
369366
externalResources: [new TextExportService(), this.excelExportService, this.pdfExportService],
367+
// -- NOTE: registered resources are auto-enabled
368+
// enableTextExport: true,
369+
// enablePdfExport: true,
370+
// enableExcelExport: true,
370371
enableFiltering: true,
371372
selectionOptions: {
372373
// True (Single Selection), False (Multiple Selections)

demos/vue/src/components/Example18.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,12 +243,13 @@ function defineGrid() {
243243
initialGroupBy: ['duration'],
244244
},
245245
darkMode: darkMode.value,
246-
enableTextExport: true,
247-
enableExcelExport: true,
248246
excelExportOptions: { sanitizeDataExport: true },
249247
textExportOptions: { sanitizeDataExport: true },
250248
externalResources: [excelExportService, pdfExportService, textExportService],
251-
enablePdfExport: true,
249+
// -- NOTE: registered resources are auto-enabled
250+
// enableTextExport: true,
251+
// enableExcelExport: true,
252+
// enablePdfExport: true,
252253
pdfExportOptions: {
253254
repeatHeadersOnEachPage: true, // defaults to true
254255
documentTitle: 'Grouping Grid',

demos/vue/test/cypress/e2e/example18.cy.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,10 @@ describe('Example 18 - Draggable Grouping & Aggregators', () => {
122122
it('should expand all rows with "Expand All" from context menu and expect all the Groups to be expanded and the Toogle All icon to be collapsed', () => {
123123
cy.get('#grid18').find('.slick-row .slick-cell:nth(1)').rightclick({ force: true });
124124

125-
cy.get('.slick-context-menu .slick-menu-command-list')
126-
.find('.slick-menu-item')
127-
.find('.slick-menu-content')
128-
.contains('Expand all Groups')
129-
.click();
125+
cy.get('.slick-context-menu .slick-menu-command-list').find('.slick-menu-content').contains('Export in CSV format');
126+
cy.get('.slick-context-menu .slick-menu-command-list').find('.slick-menu-content').contains('Export to Excel');
127+
cy.get('.slick-context-menu .slick-menu-command-list').find('.slick-menu-content').contains('Export to PDF');
128+
cy.get('.slick-context-menu .slick-menu-command-list').find('.slick-menu-content').contains('Expand all Groups').click();
130129

131130
cy.get('#grid18').find('.slick-group-toggle.collapsed').should('have.length', 0);
132131

docs/migrations/migration-to-10.x.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ gridOptions = {
6363
};
6464
```
6565

66+
### External Resources are now auto-enabled
67+
68+
This change does not require any change from the end user, but it is a change that you should probably be aware of nonetheless. The reason I've implemented that is because I forgot to enable them myself and typically if you wanted to load the resource, ten it's because you also want it enabled. So for example, if your register `ExcelExportService` then the library will now auto-enable the resource with its associated flag which in this case is `enableExcelExport:true`... unless the flag is already is disabled by the user, if so then it will skip that flag. Also just to be clear, the list of auto-enabled external resources is rather small, it will auto-enable the following resources: ExcelExportService, PdfExportService, TextExportService, CompositeEditorComponent and RowDetailView.
69+
6670
---
6771

6872
{% hint style="note" %}

frameworks/angular-slickgrid/docs/migrations/migration-to-10.x.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ gridOptions = {
8888
};
8989
```
9090

91+
### External Resources are now auto-enabled
92+
93+
This change does not require any change from the end user, but it is a change that you should probably be aware of nonetheless. The reason I've implemented that is because I forgot to enable them myself and typically if you wanted to load the resource, ten it's because you also want it enabled. So for example, if your register `ExcelExportService` then the library will now auto-enable the resource with its associated flag which in this case is `enableExcelExport:true`... unless the flag is already is disabled by the user, if so then it will skip that flag. Also just to be clear, the list of auto-enabled external resources is rather small, it will auto-enable the following resources: ExcelExportService, PdfExportService, TextExportService, CompositeEditorComponent and RowDetailView.
94+
9195
### `ngx-translate` v17.x now required
9296

9397
Because of the Angular v21 upgrade, the user (you) will also need to upgrade [`ngx-translate`](https://ngx-translate.org/) to its latest version 17.x.

frameworks/angular-slickgrid/src/demos/examples/example18.component.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,11 +280,12 @@ export class Example18Component implements OnInit, OnDestroy {
280280
initialGroupBy: ['duration'],
281281
},
282282
darkMode: this._darkMode,
283-
enableTextExport: true,
284-
enableExcelExport: true,
285283
excelExportOptions: { sanitizeDataExport: true },
286284
externalResources: [this.excelExportService, this.pdfExportService, this.textExportService],
287-
enablePdfExport: true,
285+
// -- NOTE: registered resources are auto-enabled
286+
// enableTextExport: true,
287+
// enablePdfExport: true,
288+
// enableExcelExport: true,
288289
pdfExportOptions: {
289290
repeatHeadersOnEachPage: true, // defaults to true
290291
documentTitle: 'Grouping Grid',

0 commit comments

Comments
 (0)