Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.

Commit 18e07da

Browse files
committed
Merge branch 'master' into bugfix/dark-mode-grid-menu
2 parents 0fa6591 + a20c213 commit 18e07da

File tree

4 files changed

+165
-146
lines changed

4 files changed

+165
-146
lines changed

package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@
5050
},
5151
"dependencies": {
5252
"@ngx-translate/core": "^15.0.0",
53-
"@slickgrid-universal/common": "~4.5.0",
54-
"@slickgrid-universal/custom-footer-component": "~4.5.0",
55-
"@slickgrid-universal/empty-warning-component": "~4.5.0",
56-
"@slickgrid-universal/event-pub-sub": "~4.5.0",
57-
"@slickgrid-universal/pagination-component": "~4.5.0",
58-
"@slickgrid-universal/row-detail-view-plugin": "~4.5.0",
59-
"@slickgrid-universal/rxjs-observable": "~4.5.0",
53+
"@slickgrid-universal/common": "~4.6.0",
54+
"@slickgrid-universal/custom-footer-component": "~4.6.0",
55+
"@slickgrid-universal/empty-warning-component": "~4.6.0",
56+
"@slickgrid-universal/event-pub-sub": "~4.6.0",
57+
"@slickgrid-universal/pagination-component": "~4.6.0",
58+
"@slickgrid-universal/row-detail-view-plugin": "~4.6.0",
59+
"@slickgrid-universal/rxjs-observable": "~4.6.0",
6060
"dequal": "^2.0.3",
6161
"isomorphic-dompurify": "^2.4.0",
6262
"rxjs": "^7.8.1",
@@ -87,12 +87,12 @@
8787
"@ngx-translate/http-loader": "^8.0.0",
8888
"@popperjs/core": "^2.11.8",
8989
"@release-it/conventional-changelog": "^8.0.1",
90-
"@slickgrid-universal/composite-editor-component": "~4.5.0",
91-
"@slickgrid-universal/custom-tooltip-plugin": "~4.5.0",
92-
"@slickgrid-universal/excel-export": "~4.5.0",
93-
"@slickgrid-universal/graphql": "~4.5.0",
94-
"@slickgrid-universal/odata": "~4.5.0",
95-
"@slickgrid-universal/text-export": "~4.5.0",
90+
"@slickgrid-universal/composite-editor-component": "~4.6.0",
91+
"@slickgrid-universal/custom-tooltip-plugin": "~4.6.0",
92+
"@slickgrid-universal/excel-export": "~4.6.0",
93+
"@slickgrid-universal/graphql": "~4.6.0",
94+
"@slickgrid-universal/odata": "~4.6.0",
95+
"@slickgrid-universal/text-export": "~4.6.0",
9696
"@types/dompurify": "^3.0.5",
9797
"@types/flatpickr": "^3.1.2",
9898
"@types/fnando__sparkline": "^0.3.7",

src/app/modules/angular-slickgrid/components/angular-slickgrid.component.ts

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import {
2121
BackendServiceApi,
2222
BackendServiceOption,
2323
Column,
24-
ColumnEditor,
2524
DataViewOption,
2625
EventSubscription,
2726
ExternalResource,
@@ -1107,19 +1106,23 @@ export class AngularSlickgridComponent<TData = any> implements AfterViewInit, On
11071106

11081107
/** Load the Editor Collection asynchronously and replace the "collection" property when Observable resolves */
11091108
protected loadEditorCollectionAsync(column: Column) {
1110-
const collectionAsync = column && column.editor && (column.editor as ColumnEditor).collectionAsync;
1111-
if (collectionAsync instanceof Observable) {
1112-
this.subscriptions.push(
1113-
collectionAsync.subscribe((resolvedCollection) => this.updateEditorCollection(column, resolvedCollection))
1114-
);
1115-
} else if (collectionAsync instanceof Promise) {
1116-
// wait for the "collectionAsync", once resolved we will save it into the "collection"
1117-
// the collectionAsync can be of 3 types HttpClient, HttpFetch or a Promise
1118-
collectionAsync.then((response: any | any[]) => {
1119-
if (Array.isArray(response)) {
1120-
this.updateEditorCollection(column, response); // from Promise
1121-
}
1122-
});
1109+
if (column?.editor) {
1110+
const collectionAsync = column.editor.collectionAsync;
1111+
column.editor.disabled = true; // disable the Editor DOM element, we'll re-enable it after receiving the collection with "updateEditorCollection()"
1112+
1113+
if (collectionAsync instanceof Observable) {
1114+
this.subscriptions.push(
1115+
collectionAsync.subscribe((resolvedCollection) => this.updateEditorCollection(column, resolvedCollection))
1116+
);
1117+
} else if (collectionAsync instanceof Promise) {
1118+
// wait for the "collectionAsync", once resolved we will save it into the "collection"
1119+
// the collectionAsync can be of 3 types HttpClient, HttpFetch or a Promise
1120+
collectionAsync.then((response: any | any[]) => {
1121+
if (Array.isArray(response)) {
1122+
this.updateEditorCollection(column, response); // from Promise
1123+
}
1124+
});
1125+
}
11231126
}
11241127
}
11251128

@@ -1420,7 +1423,7 @@ export class AngularSlickgridComponent<TData = any> implements AfterViewInit, On
14201423
if (column?.editor?.collectionAsync) {
14211424
this.loadEditorCollectionAsync(column);
14221425
}
1423-
return { ...column, editor: column.editor?.model, internalColumnEditor: { ...column.editor } };
1426+
return { ...column, editorClass: column.editor?.model, internalColumnEditor: { ...column.editor } };
14241427
});
14251428
}
14261429

@@ -1430,23 +1433,25 @@ export class AngularSlickgridComponent<TData = any> implements AfterViewInit, On
14301433
* Once we found the new pointer, we will reassign the "editor" and "collection" to the "internalColumnEditor" so it has newest collection
14311434
*/
14321435
protected updateEditorCollection<T = any>(column: Column<T>, newCollection: T[]) {
1433-
(column.editor as ColumnEditor).collection = newCollection;
1434-
(column.editor as ColumnEditor).disabled = false;
1435-
1436-
// find the new column reference pointer & re-assign the new editor to the internalColumnEditor
1437-
if (Array.isArray(this.columnDefinitions)) {
1438-
const columnRef = this.columnDefinitions.find((col: Column) => col.id === column.id);
1439-
if (columnRef) {
1440-
columnRef.internalColumnEditor = column.editor as ColumnEditor;
1436+
if (this.slickGrid && column.editor) {
1437+
column.editor.collection = newCollection;
1438+
column.editor.disabled = false;
1439+
1440+
// find the new column reference pointer & re-assign the new editor to the internalColumnEditor
1441+
if (Array.isArray(this.columnDefinitions)) {
1442+
const columnRef = this.columnDefinitions.find((col: Column) => col.id === column.id);
1443+
if (columnRef) {
1444+
columnRef.internalColumnEditor = column.editor;
1445+
}
14411446
}
1442-
}
14431447

1444-
// get current Editor, remove it from the DOM then re-enable it and re-render it with the new collection.
1445-
const currentEditor = this.slickGrid.getCellEditor() as AutocompleterEditor | SelectEditor;
1446-
if (currentEditor?.disable && currentEditor?.renderDomElement) {
1447-
currentEditor.destroy();
1448-
currentEditor.disable(false);
1449-
currentEditor.renderDomElement(newCollection);
1448+
// get current Editor, remove it from the DOM then re-enable it and re-render it with the new collection.
1449+
const currentEditor = this.slickGrid.getCellEditor() as AutocompleterEditor | SelectEditor;
1450+
if (currentEditor?.disable && currentEditor?.renderDomElement) {
1451+
currentEditor.destroy();
1452+
currentEditor.disable(false);
1453+
currentEditor.renderDomElement(newCollection);
1454+
}
14501455
}
14511456
}
14521457
}

test/cypress/e2e/example17.cy.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ describe('Example 17 - Row Move & Checkbox Selector Selector Plugins', () => {
149149
cy.get('[data-test="toggle-filtering-btn"]').click(); // show it back
150150
});
151151

152-
it('should expect "Clear all Filters" command to be hidden in the Grid Menu', () => {
152+
it.skip('should expect "Clear all Filters" command to be hidden in the Grid Menu', () => {
153153
const expectedFullHeaderMenuCommands = ['Clear all Filters', 'Clear all Sorting', 'Toggle Filter Row', 'Export to Excel'];
154154

155155
cy.get('#grid17')
@@ -170,7 +170,7 @@ describe('Example 17 - Row Move & Checkbox Selector Selector Plugins', () => {
170170
});
171171
});
172172

173-
it('should be able to toggle Filters functionality', () => {
173+
it.skip('should be able to toggle Filters functionality', () => {
174174
const expectedTitles = ['', '', 'Title', '% Complete', 'Start', 'Finish', 'Completed', 'Title'];
175175

176176
cy.get('[data-test="toggle-filtering-btn"]').click(); // hide it
@@ -192,7 +192,7 @@ describe('Example 17 - Row Move & Checkbox Selector Selector Plugins', () => {
192192
.each(($child, index) => expect($child.text()).to.eq(expectedTitles[index]));
193193
});
194194

195-
it('should be able to toggle Sorting functionality (disable) and expect all header menu Sorting commands to be hidden and also not show Sort hint while hovering a column', () => {
195+
it.skip('should be able to toggle Sorting functionality (disable) and expect all header menu Sorting commands to be hidden and also not show Sort hint while hovering a column', () => {
196196
const expectedFullHeaderMenuCommands = ['Resize by Content', '', 'Sort Ascending', 'Sort Descending', '', 'Remove Filter', 'Remove Sort', 'Hide Column'];
197197

198198
cy.get('.slick-sort-indicator').should('have.length.greaterThan', 0); // sort icon hints
@@ -220,7 +220,7 @@ describe('Example 17 - Row Move & Checkbox Selector Selector Plugins', () => {
220220
});
221221
});
222222

223-
it('should expect "Clear Sorting" command to be hidden in the Grid Menu', () => {
223+
it.skip('should expect "Clear Sorting" command to be hidden in the Grid Menu', () => {
224224
const expectedFullHeaderMenuCommands = ['Clear all Filters', 'Clear all Sorting', 'Toggle Filter Row', 'Export to Excel'];
225225

226226
cy.get('#grid17')
@@ -241,7 +241,7 @@ describe('Example 17 - Row Move & Checkbox Selector Selector Plugins', () => {
241241
});
242242
});
243243

244-
it('should be able to toggle Sorting functionality (re-enable) and expect all Sorting header menu commands to be hidden and also not show Sort hint while hovering a column', () => {
244+
it.skip('should be able to toggle Sorting functionality (re-enable) and expect all Sorting header menu commands to be hidden and also not show Sort hint while hovering a column', () => {
245245
const expectedFullHeaderMenuCommands = ['Resize by Content', '', 'Sort Ascending', 'Sort Descending', '', 'Remove Filter', 'Remove Sort', 'Hide Column'];
246246

247247
cy.get('.slick-sort-indicator').should('have.length', 0); // sort icon hints
@@ -265,7 +265,7 @@ describe('Example 17 - Row Move & Checkbox Selector Selector Plugins', () => {
265265
});
266266
});
267267

268-
it('should expect "Clear Sorting" command to be hidden in the Grid Menu', () => {
268+
it.skip('should expect "Clear Sorting" command to be hidden in the Grid Menu', () => {
269269
const expectedFullHeaderMenuCommands = ['Clear all Filters', 'Clear all Sorting', 'Toggle Filter Row', 'Export to Excel'];
270270

271271
cy.get('#grid17')
@@ -286,7 +286,7 @@ describe('Example 17 - Row Move & Checkbox Selector Selector Plugins', () => {
286286
});
287287
});
288288

289-
it('should be able to click disable Sorting functionality button and expect all Sorting commands to be hidden and also not show Sort hint while hovering a column', () => {
289+
it.skip('should be able to click disable Sorting functionality button and expect all Sorting commands to be hidden and also not show Sort hint while hovering a column', () => {
290290
const expectedFullHeaderMenuCommands = ['Resize by Content', '', 'Sort Ascending', 'Sort Descending', '', 'Remove Filter', 'Remove Sort', 'Hide Column'];
291291

292292
cy.get('.slick-sort-indicator').should('have.length.greaterThan', 0); // sort icon hints
@@ -314,7 +314,7 @@ describe('Example 17 - Row Move & Checkbox Selector Selector Plugins', () => {
314314
});
315315
});
316316

317-
it('should be able to click disable Filter functionality button and expect all Filter commands to be hidden and also not show Sort hint while hovering a column', () => {
317+
it.skip('should be able to click disable Filter functionality button and expect all Filter commands to be hidden and also not show Sort hint while hovering a column', () => {
318318
const expectedFullHeaderMenuCommands = ['Resize by Content', '', 'Sort Ascending', 'Sort Descending', '', 'Remove Filter', 'Remove Sort', 'Hide Column'];
319319

320320
cy.get('[data-test="disable-filters-btn"]').click().click(); // even clicking twice should have same result
@@ -340,7 +340,7 @@ describe('Example 17 - Row Move & Checkbox Selector Selector Plugins', () => {
340340
});
341341
});
342342

343-
it('should expect "Clear all Filters" command to be hidden in the Grid Menu', () => {
343+
it.skip('should expect "Clear all Filters" command to be hidden in the Grid Menu', () => {
344344
const expectedFullHeaderMenuCommands = ['Clear all Filters', 'Clear all Sorting', 'Toggle Filter Row', 'Export to Excel'];
345345

346346
cy.get('#grid17')
@@ -361,7 +361,7 @@ describe('Example 17 - Row Move & Checkbox Selector Selector Plugins', () => {
361361
});
362362
});
363363

364-
it('should open Column Picker and show the "Duration" column back to visible and expect it to have kept its position after toggling filter/sorting', () => {
364+
it.skip('should open Column Picker and show the "Duration" column back to visible and expect it to have kept its position after toggling filter/sorting', () => {
365365
// first 2 cols are hidden but they do count as li item
366366
const expectedFullPickerTitles = ['', '', 'Title', '% Complete', 'Start', 'Finish', 'Duration', 'Completed'];
367367

@@ -404,7 +404,7 @@ describe('Example 17 - Row Move & Checkbox Selector Selector Plugins', () => {
404404
});
405405
});
406406

407-
it('should add Edit/Delete columns and expect 2 new columns added at the beginning of the grid', () => {
407+
it.skip('should add Edit/Delete columns and expect 2 new columns added at the beginning of the grid', () => {
408408
const newExpectedColumns = ['', '', ...fullTitles];
409409
cy.get('[data-test="add-crud-columns-btn"]').click();
410410

0 commit comments

Comments
 (0)