@slickgrid-universal/vanilla-bundle 5.14.0 → 9.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -3
- package/dist/{types/components → components}/slick-vanilla-grid-bundle.d.ts +5 -5
- package/dist/components/slick-vanilla-grid-bundle.d.ts.map +1 -0
- package/dist/{esm/components → components}/slick-vanilla-grid-bundle.js +37 -53
- package/dist/components/slick-vanilla-grid-bundle.js.map +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/index.d.ts.map +1 -0
- package/dist/{cjs/interfaces → interfaces}/index.js.map +1 -1
- package/dist/{types/interfaces → interfaces}/slickerGridInstance.interface.d.ts +0 -2
- package/dist/interfaces/slickerGridInstance.interface.d.ts.map +1 -0
- package/dist/interfaces/slickerGridInstance.interface.js.map +1 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/universalContainer.service.d.ts.map +1 -0
- package/dist/services/universalContainer.service.js.map +1 -0
- package/package.json +15 -18
- package/src/components/slick-vanilla-grid-bundle.ts +41 -64
- package/src/interfaces/slickerGridInstance.interface.ts +0 -3
- package/dist/cjs/components/slick-vanilla-grid-bundle.js +0 -1309
- package/dist/cjs/components/slick-vanilla-grid-bundle.js.map +0 -1
- package/dist/cjs/index.js +0 -55
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/interfaces/index.js +0 -3
- package/dist/cjs/interfaces/slickerGridInstance.interface.js +0 -3
- package/dist/cjs/interfaces/slickerGridInstance.interface.js.map +0 -1
- package/dist/cjs/services/index.js +0 -18
- package/dist/cjs/services/index.js.map +0 -1
- package/dist/cjs/services/universalContainer.service.js +0 -26
- package/dist/cjs/services/universalContainer.service.js.map +0 -1
- package/dist/esm/components/slick-vanilla-grid-bundle.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/interfaces/index.js.map +0 -1
- package/dist/esm/interfaces/slickerGridInstance.interface.js.map +0 -1
- package/dist/esm/services/index.js.map +0 -1
- package/dist/esm/services/universalContainer.service.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/types/components/slick-vanilla-grid-bundle.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/interfaces/index.d.ts.map +0 -1
- package/dist/types/interfaces/slickerGridInstance.interface.d.ts.map +0 -1
- package/dist/types/services/index.d.ts.map +0 -1
- package/dist/types/services/universalContainer.service.d.ts.map +0 -1
- /package/dist/{types/index.d.ts → index.d.ts} +0 -0
- /package/dist/{esm/index.js → index.js} +0 -0
- /package/dist/{types/interfaces → interfaces}/index.d.ts +0 -0
- /package/dist/{esm/interfaces → interfaces}/index.js +0 -0
- /package/dist/{esm/interfaces → interfaces}/slickerGridInstance.interface.js +0 -0
- /package/dist/{types/services → services}/index.d.ts +0 -0
- /package/dist/{esm/services → services}/index.js +0 -0
- /package/dist/{types/services → services}/universalContainer.service.d.ts +0 -0
- /package/dist/{esm/services → services}/universalContainer.service.js +0 -0
|
@@ -21,7 +21,6 @@ import {
|
|
|
21
21
|
autoAddEditorFormatterToColumnsWithEditor,
|
|
22
22
|
type AutocompleterEditor,
|
|
23
23
|
GlobalGridOptions,
|
|
24
|
-
GridStateType,
|
|
25
24
|
SlickGroupItemMetadataProvider,
|
|
26
25
|
|
|
27
26
|
// services
|
|
@@ -70,7 +69,7 @@ export class SlickVanillaGridBundle<TData = any> {
|
|
|
70
69
|
protected _eventPubSubService!: EventPubSubService;
|
|
71
70
|
protected _darkMode = false;
|
|
72
71
|
protected _collectionObservers: Array<null | { disconnect: () => void }> = [];
|
|
73
|
-
protected
|
|
72
|
+
protected _columns?: Column<TData>[];
|
|
74
73
|
protected _gridOptions: GridOption = {};
|
|
75
74
|
protected _gridContainerElm!: HTMLElement;
|
|
76
75
|
protected _gridParentContainerElm!: HTMLElement;
|
|
@@ -140,10 +139,10 @@ export class SlickVanillaGridBundle<TData = any> {
|
|
|
140
139
|
}
|
|
141
140
|
|
|
142
141
|
get columnDefinitions(): Column<TData>[] {
|
|
143
|
-
return this.
|
|
142
|
+
return this._columns || [];
|
|
144
143
|
}
|
|
145
|
-
set columnDefinitions(
|
|
146
|
-
this.columnDefinitionsChanged(
|
|
144
|
+
set columnDefinitions(columns: Column<TData>[]) {
|
|
145
|
+
this.columnDefinitionsChanged(columns);
|
|
147
146
|
}
|
|
148
147
|
|
|
149
148
|
get dataset(): TData[] {
|
|
@@ -334,9 +333,9 @@ export class SlickVanillaGridBundle<TData = any> {
|
|
|
334
333
|
// we only want to do this check once in the constructor
|
|
335
334
|
this._hideHeaderRowAfterPageLoad = options?.showHeaderRow === false;
|
|
336
335
|
|
|
337
|
-
this.
|
|
338
|
-
if (this.
|
|
339
|
-
this.copyColumnWidthsReference(this.
|
|
336
|
+
this._columns = columnDefs || [];
|
|
337
|
+
if (this._columns.length > 0) {
|
|
338
|
+
this.copyColumnWidthsReference(this._columns);
|
|
340
339
|
}
|
|
341
340
|
|
|
342
341
|
// save resource refs to register before the grid options are merged and possibly deep copied
|
|
@@ -487,7 +486,7 @@ export class SlickVanillaGridBundle<TData = any> {
|
|
|
487
486
|
(this.sharedService as any)[prop] = null;
|
|
488
487
|
}
|
|
489
488
|
this.datasetHierarchical = undefined;
|
|
490
|
-
this.
|
|
489
|
+
this._columns = [];
|
|
491
490
|
|
|
492
491
|
// we could optionally also empty the content of the grid container DOM element
|
|
493
492
|
if (shouldEmptyDomElementContainer) {
|
|
@@ -556,16 +555,16 @@ export class SlickVanillaGridBundle<TData = any> {
|
|
|
556
555
|
this.preRegisterResources();
|
|
557
556
|
|
|
558
557
|
// prepare and load all SlickGrid editors, if an async editor is found then we'll also execute it.
|
|
559
|
-
this.
|
|
558
|
+
this._columns = this.loadSlickGridEditors(this._columns || []);
|
|
560
559
|
|
|
561
560
|
// if the user wants to automatically add a Custom Editor Formatter, we need to call the auto add function again
|
|
562
561
|
if (this._gridOptions?.autoAddCustomEditorFormatter) {
|
|
563
|
-
autoAddEditorFormatterToColumnsWithEditor(this.
|
|
562
|
+
autoAddEditorFormatterToColumnsWithEditor(this._columns, this._gridOptions.autoAddCustomEditorFormatter);
|
|
564
563
|
}
|
|
565
564
|
|
|
566
565
|
// save reference for all columns before they optionally become hidden/visible
|
|
567
|
-
this.sharedService.allColumns = this.
|
|
568
|
-
this.sharedService.visibleColumns = this.
|
|
566
|
+
this.sharedService.allColumns = this._columns;
|
|
567
|
+
this.sharedService.visibleColumns = this._columns;
|
|
569
568
|
|
|
570
569
|
// TODO: revisit later, this is conflicting with Grid State & Presets
|
|
571
570
|
// before certain extentions/plugins potentially adds extra columns not created by the user itself (RowMove, RowDetail, RowSelections)
|
|
@@ -578,7 +577,7 @@ export class SlickVanillaGridBundle<TData = any> {
|
|
|
578
577
|
|
|
579
578
|
// after subscribing to potential columns changed, we are ready to create these optional extensions
|
|
580
579
|
// when we did find some to create (RowMove, RowDetail, RowSelections), it will automatically modify column definitions (by previous subscribe)
|
|
581
|
-
this.extensionService.createExtensionsBeforeGridCreation(this.
|
|
580
|
+
this.extensionService.createExtensionsBeforeGridCreation(this._columns, this._gridOptions);
|
|
582
581
|
|
|
583
582
|
// if user entered some Pinning/Frozen "presets", we need to apply them in the grid options
|
|
584
583
|
if (this.gridOptions.presets?.pinning) {
|
|
@@ -588,7 +587,7 @@ export class SlickVanillaGridBundle<TData = any> {
|
|
|
588
587
|
this.slickGrid = new SlickGrid<TData, Column<TData>, GridOption<Column<TData>>>(
|
|
589
588
|
gridContainerElm,
|
|
590
589
|
this.dataView as SlickDataView<TData>,
|
|
591
|
-
this.
|
|
590
|
+
this._columns,
|
|
592
591
|
this._gridOptions,
|
|
593
592
|
this._eventPubSubService
|
|
594
593
|
);
|
|
@@ -605,8 +604,8 @@ export class SlickVanillaGridBundle<TData = any> {
|
|
|
605
604
|
|
|
606
605
|
// when it's a frozen grid, we need to keep the frozen column id for reference if we ever show/hide column from ColumnPicker/GridMenu afterward
|
|
607
606
|
const frozenColumnIndex = this._gridOptions?.frozenColumn ?? -1;
|
|
608
|
-
if (frozenColumnIndex >= 0 && frozenColumnIndex <= this.
|
|
609
|
-
this.sharedService.frozenVisibleColumnId = this.
|
|
607
|
+
if (frozenColumnIndex >= 0 && frozenColumnIndex <= this._columns.length && this._columns.length > 0) {
|
|
608
|
+
this.sharedService.frozenVisibleColumnId = this._columns[frozenColumnIndex]?.id ?? '';
|
|
610
609
|
}
|
|
611
610
|
|
|
612
611
|
// get any possible Services that user want to register
|
|
@@ -731,7 +730,6 @@ export class SlickVanillaGridBundle<TData = any> {
|
|
|
731
730
|
gridEventService: this.gridEventService,
|
|
732
731
|
gridStateService: this.gridStateService,
|
|
733
732
|
gridService: this.gridService,
|
|
734
|
-
groupingService: this.headerGroupingService,
|
|
735
733
|
headerGroupingService: this.headerGroupingService,
|
|
736
734
|
extensionService: this.extensionService,
|
|
737
735
|
extensionUtility: this.extensionUtility,
|
|
@@ -804,13 +802,13 @@ export class SlickVanillaGridBundle<TData = any> {
|
|
|
804
802
|
backendApi.internalPostProcess = (processResult: any) => {
|
|
805
803
|
// prettier-ignore
|
|
806
804
|
const datasetName = (backendApi && backendApiService && typeof backendApiService.getDatasetName === 'function') ? backendApiService.getDatasetName() : '';
|
|
807
|
-
if (processResult
|
|
805
|
+
if (processResult?.data?.[datasetName]) {
|
|
808
806
|
const data = processResult.data[datasetName].hasOwnProperty('nodes')
|
|
809
|
-
?
|
|
810
|
-
:
|
|
807
|
+
? processResult.data[datasetName].nodes
|
|
808
|
+
: processResult.data[datasetName];
|
|
811
809
|
const totalCount = processResult.data[datasetName].hasOwnProperty('totalCount')
|
|
812
|
-
?
|
|
813
|
-
:
|
|
810
|
+
? processResult.data[datasetName].totalCount
|
|
811
|
+
: processResult.data[datasetName].length;
|
|
814
812
|
this.refreshGridData(data, totalCount || 0);
|
|
815
813
|
}
|
|
816
814
|
};
|
|
@@ -835,10 +833,7 @@ export class SlickVanillaGridBundle<TData = any> {
|
|
|
835
833
|
this._eventPubSubService.subscribe('onLanguageChange', (args: { language: string }) => {
|
|
836
834
|
if (gridOptions.enableTranslate) {
|
|
837
835
|
this.extensionService.translateAllExtensions(args.language);
|
|
838
|
-
if (
|
|
839
|
-
(gridOptions.createPreHeaderPanel && gridOptions.createTopHeaderPanel) ||
|
|
840
|
-
(gridOptions.createPreHeaderPanel && !gridOptions.enableDraggableGrouping)
|
|
841
|
-
) {
|
|
836
|
+
if (gridOptions.createPreHeaderPanel && (gridOptions.createTopHeaderPanel || !gridOptions.enableDraggableGrouping)) {
|
|
842
837
|
this.headerGroupingService.translateHeaderGrouping();
|
|
843
838
|
}
|
|
844
839
|
}
|
|
@@ -931,18 +926,6 @@ export class SlickVanillaGridBundle<TData = any> {
|
|
|
931
926
|
this.loadColumnPresetsWhenDatasetInitialized();
|
|
932
927
|
this.loadFilterPresetsWhenDatasetInitialized();
|
|
933
928
|
}
|
|
934
|
-
|
|
935
|
-
// @deprecated @use `dataview.globalItemMetadataProvider.getRowMetadata`
|
|
936
|
-
// did the user add a colspan callback? If so, hook it into the DataView getItemMetadata
|
|
937
|
-
if (gridOptions?.colspanCallback && dataView?.getItem && dataView?.getItemMetadata) {
|
|
938
|
-
dataView.getItemMetadata = (rowNumber: number) => {
|
|
939
|
-
let callbackResult = null;
|
|
940
|
-
if (gridOptions.colspanCallback) {
|
|
941
|
-
callbackResult = gridOptions.colspanCallback(dataView.getItem(rowNumber));
|
|
942
|
-
}
|
|
943
|
-
return callbackResult;
|
|
944
|
-
};
|
|
945
|
-
}
|
|
946
929
|
}
|
|
947
930
|
|
|
948
931
|
bindBackendCallbackFunctions(gridOptions: GridOption): void {
|
|
@@ -990,9 +973,7 @@ export class SlickVanillaGridBundle<TData = any> {
|
|
|
990
973
|
const startTime = new Date();
|
|
991
974
|
|
|
992
975
|
// run any pre-process, if defined, for example a spinner
|
|
993
|
-
|
|
994
|
-
backendApi.preProcess();
|
|
995
|
-
}
|
|
976
|
+
backendApi.preProcess?.();
|
|
996
977
|
|
|
997
978
|
// the processes can be a Promise (like Http)
|
|
998
979
|
const totalItems = this.gridOptions?.pagination?.totalItems ?? 0;
|
|
@@ -1131,7 +1112,7 @@ export class SlickVanillaGridBundle<TData = any> {
|
|
|
1131
1112
|
this.sharedService.currentPagination = { pageNumber, pageSize };
|
|
1132
1113
|
}
|
|
1133
1114
|
this._eventPubSubService.publish('onGridStateChanged', {
|
|
1134
|
-
change: { newValues: { pageNumber, pageSize }, type:
|
|
1115
|
+
change: { newValues: { pageNumber, pageSize }, type: 'pagination' },
|
|
1135
1116
|
gridState: this.gridStateService.getCurrentGridState(),
|
|
1136
1117
|
});
|
|
1137
1118
|
}
|
|
@@ -1159,7 +1140,6 @@ export class SlickVanillaGridBundle<TData = any> {
|
|
|
1159
1140
|
if (dataset.length > 0) {
|
|
1160
1141
|
if (!this._isDatasetInitialized) {
|
|
1161
1142
|
this.loadFilterPresetsWhenDatasetInitialized();
|
|
1162
|
-
|
|
1163
1143
|
if (this._gridOptions.enableCheckboxSelector) {
|
|
1164
1144
|
this.loadRowSelectionPresetWhenExists();
|
|
1165
1145
|
}
|
|
@@ -1209,20 +1189,20 @@ export class SlickVanillaGridBundle<TData = any> {
|
|
|
1209
1189
|
* We will re-render the grid so that the new header and data shows up correctly.
|
|
1210
1190
|
* If using translater, we also need to trigger a re-translate of the column headers
|
|
1211
1191
|
*/
|
|
1212
|
-
updateColumnDefinitionsList(
|
|
1213
|
-
if (this.slickGrid && this._gridOptions && Array.isArray(
|
|
1192
|
+
updateColumnDefinitionsList(newColumns: Column<TData>[]): void {
|
|
1193
|
+
if (this.slickGrid && this._gridOptions && Array.isArray(newColumns)) {
|
|
1214
1194
|
// map the Editor model to editorClass and load editor collectionAsync
|
|
1215
|
-
|
|
1195
|
+
newColumns = this.loadSlickGridEditors(newColumns);
|
|
1216
1196
|
|
|
1217
1197
|
// if the user wants to automatically add a Custom Editor Formatter, we need to call the auto add function again
|
|
1218
1198
|
if (this._gridOptions.autoAddCustomEditorFormatter) {
|
|
1219
|
-
autoAddEditorFormatterToColumnsWithEditor(
|
|
1199
|
+
autoAddEditorFormatterToColumnsWithEditor(newColumns, this._gridOptions.autoAddCustomEditorFormatter);
|
|
1220
1200
|
}
|
|
1221
1201
|
|
|
1222
1202
|
if (this._gridOptions.enableTranslate) {
|
|
1223
|
-
this.extensionService.translateColumnHeaders(undefined,
|
|
1203
|
+
this.extensionService.translateColumnHeaders(undefined, newColumns);
|
|
1224
1204
|
} else {
|
|
1225
|
-
this.extensionService.renderColumnHeaders(
|
|
1205
|
+
this.extensionService.renderColumnHeaders(newColumns, true);
|
|
1226
1206
|
}
|
|
1227
1207
|
|
|
1228
1208
|
if (this.slickGrid && this._gridOptions?.enableAutoSizeColumns) {
|
|
@@ -1285,8 +1265,8 @@ export class SlickVanillaGridBundle<TData = any> {
|
|
|
1285
1265
|
* Loop through all column definitions and copy the original optional `width` properties optionally provided by the user.
|
|
1286
1266
|
* We will use this when doing a resize by cell content, if user provided a `width` it won't override it.
|
|
1287
1267
|
*/
|
|
1288
|
-
protected copyColumnWidthsReference(
|
|
1289
|
-
|
|
1268
|
+
protected copyColumnWidthsReference(columns: Column<TData>[]): void {
|
|
1269
|
+
columns.forEach((col) => (col.originalWidth = col.width));
|
|
1290
1270
|
}
|
|
1291
1271
|
|
|
1292
1272
|
protected displayEmptyDataWarning(showWarning = true): void {
|
|
@@ -1349,9 +1329,9 @@ export class SlickVanillaGridBundle<TData = any> {
|
|
|
1349
1329
|
}
|
|
1350
1330
|
|
|
1351
1331
|
/** handler for when column definitions changes */
|
|
1352
|
-
protected columnDefinitionsChanged(
|
|
1353
|
-
if (
|
|
1354
|
-
this.
|
|
1332
|
+
protected columnDefinitionsChanged(columns?: Column[]): void {
|
|
1333
|
+
if (columns) {
|
|
1334
|
+
this._columns = columns;
|
|
1355
1335
|
}
|
|
1356
1336
|
if (this._isGridInitialized) {
|
|
1357
1337
|
this.updateColumnDefinitionsList(this.columnDefinitions);
|
|
@@ -1400,10 +1380,10 @@ export class SlickVanillaGridBundle<TData = any> {
|
|
|
1400
1380
|
}
|
|
1401
1381
|
|
|
1402
1382
|
protected insertDynamicPresetColumns(columnId: string, gridPresetColumns: Column<TData>[]): void {
|
|
1403
|
-
if (this.
|
|
1404
|
-
const columnPosition = this.
|
|
1383
|
+
if (this._columns) {
|
|
1384
|
+
const columnPosition = this._columns.findIndex((c) => c.id === columnId);
|
|
1405
1385
|
if (columnPosition >= 0) {
|
|
1406
|
-
const dynColumn = this.
|
|
1386
|
+
const dynColumn = this._columns[columnPosition];
|
|
1407
1387
|
if (dynColumn?.id === columnId && !gridPresetColumns.some((c) => c.id === columnId)) {
|
|
1408
1388
|
columnPosition > 0 ? gridPresetColumns.splice(columnPosition, 0, dynColumn) : gridPresetColumns.unshift(dynColumn);
|
|
1409
1389
|
}
|
|
@@ -1424,7 +1404,7 @@ export class SlickVanillaGridBundle<TData = any> {
|
|
|
1424
1404
|
this.slickGrid,
|
|
1425
1405
|
this.gridOptions.presets.columns
|
|
1426
1406
|
);
|
|
1427
|
-
if (gridPresetColumns && Array.isArray(gridPresetColumns) && gridPresetColumns.length > 0 && Array.isArray(this.
|
|
1407
|
+
if (gridPresetColumns && Array.isArray(gridPresetColumns) && gridPresetColumns.length > 0 && Array.isArray(this._columns)) {
|
|
1428
1408
|
// make sure that the dynamic columns are included in presets (1.Row Move, 2. Row Selection, 3. Row Detail)
|
|
1429
1409
|
if (this.gridOptions.enableRowMoveManager) {
|
|
1430
1410
|
const rmmColId = this.gridOptions?.rowMoveManager?.columnId ?? '_move';
|
|
@@ -1567,10 +1547,7 @@ export class SlickVanillaGridBundle<TData = any> {
|
|
|
1567
1547
|
this._registeredResources.push(this.gridService, this.gridStateService);
|
|
1568
1548
|
|
|
1569
1549
|
// when using Grouping/DraggableGrouping/Colspan register its Service
|
|
1570
|
-
if (
|
|
1571
|
-
(this.gridOptions.createPreHeaderPanel && this.gridOptions.createTopHeaderPanel) ||
|
|
1572
|
-
(this.gridOptions.createPreHeaderPanel && !this.gridOptions.enableDraggableGrouping)
|
|
1573
|
-
) {
|
|
1550
|
+
if (this.gridOptions.createPreHeaderPanel && (this.gridOptions.createTopHeaderPanel || !this.gridOptions.enableDraggableGrouping)) {
|
|
1574
1551
|
this._registeredResources.push(this.headerGroupingService);
|
|
1575
1552
|
}
|
|
1576
1553
|
|
|
@@ -1623,7 +1600,7 @@ export class SlickVanillaGridBundle<TData = any> {
|
|
|
1623
1600
|
// we'll also add props, by mutation, required by the TreeDataService on the flat array like `__hasChildren`, `parentId` and anything else to work properly
|
|
1624
1601
|
sortedDatasetResult = this.treeDataService.convertFlatParentChildToTreeDatasetAndSort(
|
|
1625
1602
|
flatDatasetInput,
|
|
1626
|
-
this.
|
|
1603
|
+
this._columns || [],
|
|
1627
1604
|
this.gridOptions
|
|
1628
1605
|
);
|
|
1629
1606
|
this.sharedService.hierarchicalDataset = sortedDatasetResult.hierarchical;
|
|
@@ -56,9 +56,6 @@ export interface SlickerGridInstance<TData = any> {
|
|
|
56
56
|
/** Grid State Service */
|
|
57
57
|
gridStateService: GridStateService;
|
|
58
58
|
|
|
59
|
-
/** @deprecated @use `headerGroupingService` */
|
|
60
|
-
groupingService: HeaderGroupingService;
|
|
61
|
-
|
|
62
59
|
/** Grouping (and colspan) Service */
|
|
63
60
|
headerGroupingService: HeaderGroupingService;
|
|
64
61
|
|