slickgrid-react 9.13.0 → 10.0.0
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 +3 -2
- package/dist/components/slickgrid-react.d.ts +7 -6
- package/dist/components/slickgrid-react.js +32 -54
- package/dist/components/slickgrid-react.js.map +1 -1
- package/dist/global-grid-options.d.ts +1 -3
- package/dist/global-grid-options.js +4 -287
- package/dist/global-grid-options.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.js +1 -0
- package/dist/services/index.js.map +1 -1
- package/package.json +10 -11
- package/src/components/slickgrid-react.tsx +42 -65
- package/src/global-grid-options.ts +4 -288
- package/src/index.ts +11 -3
- package/src/services/index.ts +1 -0
- package/dist/extensions/slickRowDetailView.d.ts +0 -82
- package/dist/extensions/slickRowDetailView.js +0 -334
- package/dist/extensions/slickRowDetailView.js.map +0 -1
- package/src/extensions/slickRowDetailView.ts +0 -421
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
collectionObserver,
|
|
5
5
|
CollectionService,
|
|
6
6
|
emptyElement,
|
|
7
|
-
EventNamingStyle,
|
|
8
7
|
ExtensionService,
|
|
9
8
|
ExtensionUtility,
|
|
10
9
|
FilterFactory,
|
|
@@ -15,6 +14,7 @@ import {
|
|
|
15
14
|
HeaderGroupingService,
|
|
16
15
|
isColumnDateType,
|
|
17
16
|
PaginationService,
|
|
17
|
+
PluginFlagMappings,
|
|
18
18
|
ResizerService,
|
|
19
19
|
SharedService,
|
|
20
20
|
SlickDataView,
|
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
type EventSubscription,
|
|
35
35
|
type ExtensionList,
|
|
36
36
|
type ExternalResource,
|
|
37
|
+
type ExternalResourceConstructor,
|
|
37
38
|
type Metrics,
|
|
38
39
|
type Observable,
|
|
39
40
|
type Pagination,
|
|
@@ -106,7 +107,7 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
|
|
|
106
107
|
protected _isPaginationInitialized = false;
|
|
107
108
|
protected _isLocalGrid = true;
|
|
108
109
|
protected _paginationOptions: Pagination | undefined;
|
|
109
|
-
protected _registeredResources: ExternalResource
|
|
110
|
+
protected _registeredResources: Array<ExternalResource | ExternalResourceConstructor> = [];
|
|
110
111
|
protected _scrollEndCalled = false;
|
|
111
112
|
|
|
112
113
|
protected get options(): GridOption {
|
|
@@ -262,7 +263,7 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
|
|
|
262
263
|
|
|
263
264
|
// initialize and assign all Service Dependencies
|
|
264
265
|
this._eventPubSubService = new EventPubSubService();
|
|
265
|
-
this._eventPubSubService.eventNamingStyle =
|
|
266
|
+
this._eventPubSubService.eventNamingStyle = 'camelCase';
|
|
266
267
|
|
|
267
268
|
this.backendUtilityService = new BackendUtilityService();
|
|
268
269
|
this.gridEventService = new GridEventService();
|
|
@@ -365,7 +366,7 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
|
|
|
365
366
|
this._isDatasetHierarchicalInitialized = isInitialized;
|
|
366
367
|
}
|
|
367
368
|
|
|
368
|
-
get registeredResources(): ExternalResource
|
|
369
|
+
get registeredResources(): Array<ExternalResource | ExternalResourceConstructor> {
|
|
369
370
|
return this._registeredResources;
|
|
370
371
|
}
|
|
371
372
|
|
|
@@ -450,7 +451,7 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
|
|
|
450
451
|
this._options.enableMouseWheelScrollHandler = true;
|
|
451
452
|
}
|
|
452
453
|
|
|
453
|
-
this._eventPubSubService.eventNamingStyle = this._options?.eventNamingStyle ??
|
|
454
|
+
this._eventPubSubService.eventNamingStyle = this._options?.eventNamingStyle ?? 'camelCase';
|
|
454
455
|
this._eventPubSubService.publish(`onBeforeGridCreate`, true);
|
|
455
456
|
|
|
456
457
|
// make sure the dataset is initialized (if not it will throw an error that it cannot getLength of null)
|
|
@@ -509,7 +510,6 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
|
|
|
509
510
|
|
|
510
511
|
// save reference for all columns before they optionally become hidden/visible
|
|
511
512
|
this.sharedService.allColumns = this._columns;
|
|
512
|
-
this.sharedService.visibleColumns = this._columns;
|
|
513
513
|
|
|
514
514
|
// after subscribing to potential columns changed, we are ready to create these optional extensions
|
|
515
515
|
// when we did find some to create (RowMove, RowDetail, RowSelections), it will automatically modify column definitions (by previous subscribe)
|
|
@@ -535,15 +535,15 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
|
|
|
535
535
|
this.grid.registerPlugin(this.groupItemMetadataProvider); // register GroupItemMetadataProvider when Grouping is enabled
|
|
536
536
|
}
|
|
537
537
|
|
|
538
|
+
// get any possible Services that user want to register
|
|
539
|
+
this.registerResources();
|
|
540
|
+
|
|
538
541
|
this.extensionService.bindDifferentExtensions();
|
|
539
542
|
this.bindDifferentHooks(this.grid, this._options, this.dataView);
|
|
540
543
|
|
|
541
544
|
// 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
|
|
542
545
|
this.sharedService.frozenVisibleColumnId = this.grid.getFrozenColumnId();
|
|
543
546
|
|
|
544
|
-
// get any possible Services that user want to register
|
|
545
|
-
this.registerResources();
|
|
546
|
-
|
|
547
547
|
// initialize the SlickGrid grid
|
|
548
548
|
this.grid.init();
|
|
549
549
|
|
|
@@ -595,10 +595,7 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
|
|
|
595
595
|
}
|
|
596
596
|
|
|
597
597
|
if (this._dataset.length > 0) {
|
|
598
|
-
if (
|
|
599
|
-
!this._isDatasetInitialized &&
|
|
600
|
-
(this._options.enableCheckboxSelector || this._options.enableRowSelection || this._options.enableHybridSelection)
|
|
601
|
-
) {
|
|
598
|
+
if (!this._isDatasetInitialized && (this._options.enableCheckboxSelector || this._options.enableSelection)) {
|
|
602
599
|
this.loadRowSelectionPresetWhenExists();
|
|
603
600
|
}
|
|
604
601
|
this.loadFilterPresetsWhenDatasetInitialized();
|
|
@@ -747,8 +744,8 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
|
|
|
747
744
|
if (Array.isArray(this._registeredResources)) {
|
|
748
745
|
while (this._registeredResources.length > 0) {
|
|
749
746
|
const res = this._registeredResources.pop();
|
|
750
|
-
if (res?.dispose) {
|
|
751
|
-
res.dispose();
|
|
747
|
+
if (typeof (res as ExternalResource)?.dispose === 'function') {
|
|
748
|
+
(res as ExternalResource).dispose!();
|
|
752
749
|
}
|
|
753
750
|
}
|
|
754
751
|
}
|
|
@@ -881,10 +878,9 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
|
|
|
881
878
|
}
|
|
882
879
|
}
|
|
883
880
|
|
|
884
|
-
// when column are reordered, we need to update
|
|
885
|
-
this._eventHandler.subscribe(grid.onColumnsReordered, (
|
|
881
|
+
// when column are reordered, we need to update SharedService flag
|
|
882
|
+
this._eventHandler.subscribe(grid.onColumnsReordered, () => {
|
|
886
883
|
this.sharedService.hasColumnsReordered = true;
|
|
887
|
-
this.sharedService.visibleColumns = args.impactedColumns;
|
|
888
884
|
});
|
|
889
885
|
|
|
890
886
|
this._eventHandler.subscribe(grid.onSetOptions, (_e, args) => {
|
|
@@ -1113,7 +1109,7 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
|
|
|
1113
1109
|
this.grid &&
|
|
1114
1110
|
!isSyncGridSelectionEnabled &&
|
|
1115
1111
|
this.options?.backendServiceApi &&
|
|
1116
|
-
(this.options.
|
|
1112
|
+
(this.options.enableSelection || this.options.enableCheckboxSelector)
|
|
1117
1113
|
) {
|
|
1118
1114
|
this.grid.setSelectedRows([]);
|
|
1119
1115
|
}
|
|
@@ -1258,9 +1254,8 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
|
|
|
1258
1254
|
|
|
1259
1255
|
if (this._options.enableTranslate) {
|
|
1260
1256
|
this.extensionService.translateColumnHeaders(undefined, newColumns);
|
|
1261
|
-
} else {
|
|
1262
|
-
this.extensionService.renderColumnHeaders(newColumns, true);
|
|
1263
1257
|
}
|
|
1258
|
+
this.extensionService.renderColumnHeaders(newColumns, true);
|
|
1264
1259
|
|
|
1265
1260
|
if (this._options?.enableAutoSizeColumns) {
|
|
1266
1261
|
this.grid.autosizeColumns();
|
|
@@ -1414,46 +1409,13 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
|
|
|
1414
1409
|
}
|
|
1415
1410
|
}
|
|
1416
1411
|
|
|
1417
|
-
protected insertDynamicPresetColumns(columnId: string, gridPresetColumns: Column<TData>[]) {
|
|
1418
|
-
if (this._columns) {
|
|
1419
|
-
const columnPosition = this._columns.findIndex((c) => c.id === columnId);
|
|
1420
|
-
if (columnPosition >= 0) {
|
|
1421
|
-
const dynColumn = this._columns[columnPosition];
|
|
1422
|
-
if (dynColumn?.id === columnId && !gridPresetColumns.some((c) => c.id === columnId)) {
|
|
1423
|
-
columnPosition > 0 ? gridPresetColumns.splice(columnPosition, 0, dynColumn) : gridPresetColumns.unshift(dynColumn);
|
|
1424
|
-
}
|
|
1425
|
-
}
|
|
1426
|
-
}
|
|
1427
|
-
}
|
|
1428
|
-
|
|
1429
1412
|
/** Load any possible Columns Grid Presets */
|
|
1430
1413
|
protected loadColumnPresetsWhenDatasetInitialized() {
|
|
1431
1414
|
// if user entered some Columns "presets", we need to reflect them all in the grid
|
|
1432
1415
|
if (this.grid && this.options.presets && Array.isArray(this.options.presets.columns) && this.options.presets.columns.length > 0) {
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
if (this.options.enableRowMoveManager) {
|
|
1437
|
-
const rmmColId = this.options?.rowMoveManager?.columnId ?? '_move';
|
|
1438
|
-
this.insertDynamicPresetColumns(rmmColId, gridPresetColumns);
|
|
1439
|
-
}
|
|
1440
|
-
if (this.options.enableCheckboxSelector) {
|
|
1441
|
-
const chkColId = this.options?.checkboxSelector?.columnId ?? '_checkbox_selector';
|
|
1442
|
-
this.insertDynamicPresetColumns(chkColId, gridPresetColumns);
|
|
1443
|
-
}
|
|
1444
|
-
if (this.options.enableRowDetailView) {
|
|
1445
|
-
const rdvColId = this.options?.rowDetailView?.columnId ?? '_detail_selector';
|
|
1446
|
-
this.insertDynamicPresetColumns(rdvColId, gridPresetColumns);
|
|
1447
|
-
}
|
|
1448
|
-
|
|
1449
|
-
// keep copy the original optional `width` properties optionally provided by the user.
|
|
1450
|
-
// We will use this when doing a resize by cell content, if user provided a `width` it won't override it.
|
|
1451
|
-
gridPresetColumns.forEach((col) => (col.originalWidth = col.width));
|
|
1452
|
-
|
|
1453
|
-
// finally set the new presets columns (including checkbox selector if need be)
|
|
1454
|
-
this.grid.setColumns(gridPresetColumns);
|
|
1455
|
-
this.sharedService.visibleColumns = gridPresetColumns;
|
|
1456
|
-
}
|
|
1416
|
+
// delegate to GridStateService for centralized column arrangement logic
|
|
1417
|
+
// we pass `false` for triggerAutoSizeColumns to maintain original behavior on preset load
|
|
1418
|
+
this.gridStateService.changeColumnsArrangement(this.options.presets.columns, false);
|
|
1457
1419
|
}
|
|
1458
1420
|
}
|
|
1459
1421
|
|
|
@@ -1494,8 +1456,7 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
|
|
|
1494
1456
|
protected loadRowSelectionPresetWhenExists() {
|
|
1495
1457
|
// if user entered some Row Selections "presets"
|
|
1496
1458
|
const presets = this._options?.presets;
|
|
1497
|
-
const enableRowSelection =
|
|
1498
|
-
this._options && (this._options.enableCheckboxSelector || this._options.enableRowSelection || this._options.enableHybridSelection);
|
|
1459
|
+
const enableRowSelection = this._options && (this._options.enableCheckboxSelector || this._options.enableSelection);
|
|
1499
1460
|
if (
|
|
1500
1461
|
enableRowSelection &&
|
|
1501
1462
|
this.grid?.getSelectionModel() &&
|
|
@@ -1565,7 +1526,7 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
|
|
|
1565
1526
|
}
|
|
1566
1527
|
|
|
1567
1528
|
/** Add a register a new external resource, user could also optional dispose all previous resources before pushing any new resources to the resources array list. */
|
|
1568
|
-
registerExternalResources(resources: ExternalResource
|
|
1529
|
+
registerExternalResources(resources: Array<ExternalResource | ExternalResourceConstructor>, disposePreviousResources = false) {
|
|
1569
1530
|
if (disposePreviousResources) {
|
|
1570
1531
|
this.disposeExternalResources();
|
|
1571
1532
|
}
|
|
@@ -1585,19 +1546,35 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
|
|
|
1585
1546
|
// register all services by executing their init method and providing them with the Grid object
|
|
1586
1547
|
if (Array.isArray(this._registeredResources)) {
|
|
1587
1548
|
for (const resource of this._registeredResources) {
|
|
1588
|
-
if (resource?.
|
|
1549
|
+
if ((resource as ExternalResource)?.pluginName === 'RxJsResource') {
|
|
1589
1550
|
this.registerRxJsResource(resource as RxJsFacade);
|
|
1590
1551
|
}
|
|
1591
1552
|
}
|
|
1592
1553
|
}
|
|
1593
1554
|
}
|
|
1594
1555
|
|
|
1595
|
-
|
|
1556
|
+
/** initialized & auto-enable external registered resources, e.g. if user registers `ExcelExportService` then let's auto-enable `enableExcelExport:true` */
|
|
1557
|
+
protected autoEnableInitializedResources(resource: ExternalResource | ExternalResourceConstructor): void {
|
|
1558
|
+
if (this.grid && typeof (resource as ExternalResource).init === 'function') {
|
|
1559
|
+
(resource as ExternalResource).init!(this.grid, this.props.containerService);
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
// auto-enable unless the flag was specifically disabled by the end user
|
|
1563
|
+
if ('pluginName' in (resource as ExternalResource)) {
|
|
1564
|
+
const pluginFlagName = PluginFlagMappings.get((resource as ExternalResource).pluginName!);
|
|
1565
|
+
if (pluginFlagName && this.options[pluginFlagName] !== false) {
|
|
1566
|
+
this.options[pluginFlagName] = true;
|
|
1567
|
+
this.grid?.setOptions({ [pluginFlagName]: true });
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
protected initializeExternalResources(resources: Array<ExternalResource | ExternalResourceConstructor>) {
|
|
1573
|
+
PluginFlagMappings.set('ReactRowDetailView', 'enableRowDetailView'); // map the external Row Detail View resource to its flag
|
|
1574
|
+
|
|
1596
1575
|
if (Array.isArray(resources)) {
|
|
1597
1576
|
for (const resource of resources) {
|
|
1598
|
-
|
|
1599
|
-
resource.init(this.grid, this.props.containerService);
|
|
1600
|
-
}
|
|
1577
|
+
this.autoEnableInitializedResources(resource);
|
|
1601
1578
|
}
|
|
1602
1579
|
}
|
|
1603
1580
|
}
|
|
@@ -1,255 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GlobalGridOptions as UniversalGridOptions } from '@slickgrid-universal/common';
|
|
2
2
|
import type { GridOption, RowDetailView } from './models/index.js';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* Default Options that can be passed to the Slickgrid-React
|
|
6
|
-
*/
|
|
4
|
+
/** Global Grid Options Defaults */
|
|
7
5
|
export const GlobalGridOptions: Partial<GridOption> = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
asyncEditorLoading: false,
|
|
11
|
-
autoFitColumnsOnFirstLoad: true,
|
|
12
|
-
autoResize: {
|
|
13
|
-
applyResizeToContainer: true,
|
|
14
|
-
autoHeight: true,
|
|
15
|
-
autoHeightRecalcRow: 100,
|
|
16
|
-
calculateAvailableSizeBy: 'window',
|
|
17
|
-
bottomPadding: 20,
|
|
18
|
-
minHeight: 250,
|
|
19
|
-
minWidth: 300,
|
|
20
|
-
rightPadding: 0,
|
|
21
|
-
},
|
|
22
|
-
cellHighlightCssClass: 'slick-cell-modified',
|
|
23
|
-
checkboxSelector: {
|
|
24
|
-
cssClass: 'slick-cell-checkboxsel',
|
|
25
|
-
width: 40,
|
|
26
|
-
},
|
|
27
|
-
cellMenu: {
|
|
28
|
-
autoAdjustDrop: true,
|
|
29
|
-
autoAlignSide: true,
|
|
30
|
-
hideCloseButton: true,
|
|
31
|
-
hideCommandSection: false,
|
|
32
|
-
hideOptionSection: false,
|
|
33
|
-
},
|
|
34
|
-
columnGroupSeparator: ' - ',
|
|
35
|
-
columnPicker: {
|
|
36
|
-
hideForceFitButton: false,
|
|
37
|
-
hideSyncResizeButton: true,
|
|
38
|
-
headerColumnValueExtractor: pickerHeaderColumnValueExtractor,
|
|
39
|
-
},
|
|
40
|
-
compositeEditorOptions: {
|
|
41
|
-
labels: {
|
|
42
|
-
cancelButtonKey: 'CANCEL',
|
|
43
|
-
cloneButtonKey: 'CLONE',
|
|
44
|
-
resetEditorButtonTooltipKey: 'RESET_INPUT_VALUE',
|
|
45
|
-
resetFormButtonKey: 'RESET_FORM',
|
|
46
|
-
massSelectionButtonKey: 'APPLY_TO_SELECTION',
|
|
47
|
-
massSelectionStatusKey: 'X_OF_Y_MASS_SELECTED',
|
|
48
|
-
massUpdateButtonKey: 'APPLY_MASS_UPDATE',
|
|
49
|
-
massUpdateStatusKey: 'ALL_X_RECORDS_SELECTED',
|
|
50
|
-
saveButtonKey: 'SAVE',
|
|
51
|
-
},
|
|
52
|
-
resetEditorButtonCssClass: 'mdi mdi-refresh font-15px',
|
|
53
|
-
resetFormButtonIconCssClass: 'mdi mdi-refresh font-16px mdi-flip-h',
|
|
54
|
-
},
|
|
55
|
-
contextMenu: {
|
|
56
|
-
autoAdjustDrop: true,
|
|
57
|
-
autoAlignSide: true,
|
|
58
|
-
hideCloseButton: true,
|
|
59
|
-
hideClearAllGrouping: false,
|
|
60
|
-
hideCollapseAllGroups: false,
|
|
61
|
-
hideCommandSection: false,
|
|
62
|
-
hideCopyCellValueCommand: false,
|
|
63
|
-
hideExpandAllGroups: false,
|
|
64
|
-
hideExportCsvCommand: false,
|
|
65
|
-
hideExportExcelCommand: false,
|
|
66
|
-
hideExportPdfCommand: false,
|
|
67
|
-
hideExportTextDelimitedCommand: true,
|
|
68
|
-
hideMenuOnScroll: true,
|
|
69
|
-
hideOptionSection: false,
|
|
70
|
-
iconCollapseAllGroupsCommand: 'mdi mdi-arrow-collapse',
|
|
71
|
-
iconExpandAllGroupsCommand: 'mdi mdi-arrow-expand',
|
|
72
|
-
iconClearGroupingCommand: 'mdi mdi-close',
|
|
73
|
-
iconCopyCellValueCommand: 'mdi mdi-content-copy',
|
|
74
|
-
iconExportCsvCommand: 'mdi mdi-download',
|
|
75
|
-
iconExportExcelCommand: 'mdi mdi-file-excel-outline text-success',
|
|
76
|
-
iconExportTextDelimitedCommand: 'mdi mdi-download',
|
|
77
|
-
},
|
|
78
|
-
customFooterOptions: {
|
|
79
|
-
dateFormat: 'YYYY-MM-DD, hh:mm a',
|
|
80
|
-
hideRowSelectionCount: false,
|
|
81
|
-
hideTotalItemCount: false,
|
|
82
|
-
hideLastUpdateTimestamp: true,
|
|
83
|
-
footerHeight: 25,
|
|
84
|
-
leftContainerClass: 'col-xs-12 col-sm-5',
|
|
85
|
-
rightContainerClass: 'col-xs-6 col-sm-7',
|
|
86
|
-
metricSeparator: '|',
|
|
87
|
-
metricTexts: {
|
|
88
|
-
items: 'items',
|
|
89
|
-
itemsKey: 'ITEMS',
|
|
90
|
-
of: 'of',
|
|
91
|
-
ofKey: 'OF',
|
|
92
|
-
itemsSelected: 'items selected',
|
|
93
|
-
itemsSelectedKey: 'ITEMS_SELECTED',
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
dataView: {
|
|
97
|
-
// when enabled, this will preserve the row selection even after filtering/sorting/grouping
|
|
98
|
-
syncGridSelection: {
|
|
99
|
-
preserveHidden: false,
|
|
100
|
-
preserveHiddenOnSelectionChange: true,
|
|
101
|
-
},
|
|
102
|
-
syncGridSelectionWithBackendService: false, // but disable it when using backend services
|
|
103
|
-
},
|
|
104
|
-
datasetIdPropertyName: 'id',
|
|
105
|
-
defaultFilter: Filters.input,
|
|
106
|
-
defaultBackendServiceFilterTypingDebounce: 500,
|
|
107
|
-
defaultColumnSortFieldId: 'id',
|
|
108
|
-
defaultFilterPlaceholder: '🔎︎', // magnifying glass icon
|
|
109
|
-
defaultFilterRangeOperator: 'RangeInclusive',
|
|
110
|
-
editable: false,
|
|
111
|
-
editorTypingDebounce: 450,
|
|
112
|
-
filterTypingDebounce: 0,
|
|
113
|
-
enableEmptyDataWarningMessage: true,
|
|
114
|
-
enableFilterTrimWhiteSpace: false, // do we want to trim white spaces on all Filters?
|
|
115
|
-
emptyDataWarning: {
|
|
116
|
-
className: 'slick-empty-data-warning',
|
|
117
|
-
message: 'No data to display.',
|
|
118
|
-
messageKey: 'EMPTY_DATA_WARNING_MESSAGE',
|
|
119
|
-
hideFrozenLeftWarning: false,
|
|
120
|
-
hideFrozenRightWarning: false,
|
|
121
|
-
leftViewportMarginLeft: '40%',
|
|
122
|
-
rightViewportMarginLeft: '40%',
|
|
123
|
-
frozenLeftViewportMarginLeft: '0px',
|
|
124
|
-
frozenRightViewportMarginLeft: '40%',
|
|
125
|
-
},
|
|
126
|
-
enableAutoResize: true,
|
|
127
|
-
enableAutoSizeColumns: true,
|
|
128
|
-
enableCellNavigation: false,
|
|
129
|
-
enableColumnPicker: true,
|
|
130
|
-
enableColumnReorder: true,
|
|
131
|
-
enableColumnResizeOnDoubleClick: true,
|
|
132
|
-
enableContextMenu: true,
|
|
133
|
-
enableExcelExport: false,
|
|
134
|
-
enableTextExport: false,
|
|
135
|
-
enableGridMenu: true,
|
|
136
|
-
enableHeaderMenu: true,
|
|
137
|
-
enableMouseHoverHighlightRow: true,
|
|
138
|
-
enableSorting: true,
|
|
139
|
-
enableTextSelectionOnCells: true,
|
|
140
|
-
eventNamingStyle: EventNamingStyle.camelCase,
|
|
141
|
-
explicitInitialization: true,
|
|
142
|
-
excelExportOptions: {
|
|
143
|
-
addGroupIndentation: true,
|
|
144
|
-
exportWithFormatter: false,
|
|
145
|
-
filename: 'export',
|
|
146
|
-
format: 'xlsx',
|
|
147
|
-
groupingColumnHeaderTitle: 'Group By',
|
|
148
|
-
groupCollapsedSymbol: '⮞',
|
|
149
|
-
groupExpandedSymbol: '⮟',
|
|
150
|
-
groupingAggregatorRowText: '',
|
|
151
|
-
sanitizeDataExport: false,
|
|
152
|
-
},
|
|
153
|
-
pdfExportOptions: {
|
|
154
|
-
addGroupIndentation: true,
|
|
155
|
-
exportWithFormatter: false,
|
|
156
|
-
filename: 'export',
|
|
157
|
-
pageOrientation: 'portrait',
|
|
158
|
-
pageSize: 'a4',
|
|
159
|
-
fontSize: 10,
|
|
160
|
-
headerFontSize: 11,
|
|
161
|
-
includeColumnHeaders: true,
|
|
162
|
-
htmlDecode: true,
|
|
163
|
-
sanitizeDataExport: false,
|
|
164
|
-
groupingColumnHeaderTitle: 'Group By',
|
|
165
|
-
groupCollapsedSymbol: '+',
|
|
166
|
-
groupExpandedSymbol: '-',
|
|
167
|
-
groupingAggregatorRowText: '',
|
|
168
|
-
repeatHeadersOnEachPage: true,
|
|
169
|
-
},
|
|
170
|
-
textExportOptions: {
|
|
171
|
-
delimiter: DelimiterType.comma,
|
|
172
|
-
exportWithFormatter: false,
|
|
173
|
-
filename: 'export',
|
|
174
|
-
format: 'csv',
|
|
175
|
-
groupingColumnHeaderTitle: 'Group By',
|
|
176
|
-
groupingAggregatorRowText: '',
|
|
177
|
-
sanitizeDataExport: false,
|
|
178
|
-
useUtf8WithBom: true,
|
|
179
|
-
},
|
|
180
|
-
forceFitColumns: false,
|
|
181
|
-
frozenHeaderWidthCalcDifferential: 1,
|
|
182
|
-
gridMenu: {
|
|
183
|
-
commandLabels: {
|
|
184
|
-
clearAllFiltersCommandKey: 'CLEAR_ALL_FILTERS',
|
|
185
|
-
clearAllSortingCommandKey: 'CLEAR_ALL_SORTING',
|
|
186
|
-
clearFrozenColumnsCommandKey: 'CLEAR_PINNING',
|
|
187
|
-
exportCsvCommandKey: 'EXPORT_TO_CSV',
|
|
188
|
-
exportExcelCommandKey: 'EXPORT_TO_EXCEL',
|
|
189
|
-
exportPdfCommandKey: 'EXPORT_TO_PDF',
|
|
190
|
-
exportTextDelimitedCommandKey: 'EXPORT_TO_TAB_DELIMITED',
|
|
191
|
-
refreshDatasetCommandKey: 'REFRESH_DATASET',
|
|
192
|
-
toggleDarkModeCommandKey: 'TOGGLE_DARK_MODE',
|
|
193
|
-
toggleFilterCommandKey: 'TOGGLE_FILTER_ROW',
|
|
194
|
-
togglePreHeaderCommandKey: 'TOGGLE_PRE_HEADER_ROW',
|
|
195
|
-
},
|
|
196
|
-
hideClearAllFiltersCommand: false,
|
|
197
|
-
hideClearAllSortingCommand: false,
|
|
198
|
-
hideClearFrozenColumnsCommand: true, // opt-in command
|
|
199
|
-
hideExportCsvCommand: false,
|
|
200
|
-
hideExportExcelCommand: false,
|
|
201
|
-
hideExportPdfCommand: false,
|
|
202
|
-
hideExportTextDelimitedCommand: true,
|
|
203
|
-
hideForceFitButton: false,
|
|
204
|
-
hideRefreshDatasetCommand: false,
|
|
205
|
-
hideSyncResizeButton: true,
|
|
206
|
-
hideToggleDarkModeCommand: true,
|
|
207
|
-
hideToggleFilterCommand: false,
|
|
208
|
-
hideTogglePreHeaderCommand: false,
|
|
209
|
-
iconCssClass: 'mdi mdi-menu',
|
|
210
|
-
iconClearAllFiltersCommand: 'mdi mdi-filter-remove-outline',
|
|
211
|
-
iconClearAllSortingCommand: 'mdi mdi-sort-variant-off',
|
|
212
|
-
iconClearFrozenColumnsCommand: 'mdi mdi-close',
|
|
213
|
-
iconExportCsvCommand: 'mdi mdi-download',
|
|
214
|
-
iconExportExcelCommand: 'mdi mdi-file-excel-outline',
|
|
215
|
-
iconExportTextDelimitedCommand: 'mdi mdi-download',
|
|
216
|
-
iconRefreshDatasetCommand: 'mdi mdi-sync',
|
|
217
|
-
iconToggleDarkModeCommand: 'mdi mdi-brightness-4 mdi mdi-brightness-4',
|
|
218
|
-
iconToggleFilterCommand: 'mdi mdi-flip-vertical',
|
|
219
|
-
iconTogglePreHeaderCommand: 'mdi mdi-flip-vertical',
|
|
220
|
-
menuWidth: 16,
|
|
221
|
-
resizeOnShowHeaderRow: true,
|
|
222
|
-
headerColumnValueExtractor: pickerHeaderColumnValueExtractor,
|
|
223
|
-
},
|
|
224
|
-
headerMenu: {
|
|
225
|
-
autoAlign: true,
|
|
226
|
-
autoAlignOffset: 12,
|
|
227
|
-
minWidth: 140,
|
|
228
|
-
iconClearFilterCommand: 'mdi mdi-filter-remove-outline',
|
|
229
|
-
iconClearSortCommand: 'mdi mdi-sort-variant-off',
|
|
230
|
-
iconFreezeColumns: 'mdi mdi-pin-outline',
|
|
231
|
-
iconUnfreezeColumns: 'mdi mdi-pin-off-outline',
|
|
232
|
-
iconSortAscCommand: 'mdi mdi-sort-ascending',
|
|
233
|
-
iconSortDescCommand: 'mdi mdi-sort-descending',
|
|
234
|
-
iconColumnHideCommand: 'mdi mdi-close',
|
|
235
|
-
iconColumnResizeByContentCommand: 'mdi mdi-arrow-expand-horizontal',
|
|
236
|
-
hideColumnResizeByContentCommand: false,
|
|
237
|
-
hideColumnHideCommand: false,
|
|
238
|
-
hideClearFilterCommand: false,
|
|
239
|
-
hideClearSortCommand: false,
|
|
240
|
-
hideFreezeColumnsCommand: true, // opt-in command
|
|
241
|
-
hideSortCommands: false,
|
|
242
|
-
},
|
|
243
|
-
multiColumnSort: true,
|
|
244
|
-
numberedMultiColumnSort: true,
|
|
245
|
-
tristateMultiColumnSort: false,
|
|
246
|
-
sortColNumberInSeparateSpan: true,
|
|
247
|
-
suppressActiveCellChangeOnEdit: false,
|
|
248
|
-
pagination: {
|
|
249
|
-
pageSizes: [10, 15, 20, 25, 30, 40, 50, 75, 100],
|
|
250
|
-
pageSize: 25,
|
|
251
|
-
totalItems: 0,
|
|
252
|
-
},
|
|
6
|
+
...UniversalGridOptions,
|
|
7
|
+
eventNamingStyle: 'camelCase',
|
|
253
8
|
rowDetailView: {
|
|
254
9
|
collapseAllOnSort: true,
|
|
255
10
|
cssClass: 'detail-view-toggle',
|
|
@@ -258,43 +13,4 @@ export const GlobalGridOptions: Partial<GridOption> = {
|
|
|
258
13
|
useRowClick: false,
|
|
259
14
|
saveDetailViewOnScroll: false,
|
|
260
15
|
} as RowDetailView,
|
|
261
|
-
headerRowHeight: 35,
|
|
262
|
-
rowHeight: 35,
|
|
263
|
-
topPanelHeight: 30,
|
|
264
|
-
preHeaderPanelWidth: '100%', // mostly useful for Draggable Grouping dropzone to take full width
|
|
265
|
-
translationNamespaceSeparator: ':',
|
|
266
|
-
resetFilterSearchValueAfterOnBeforeCancellation: true,
|
|
267
|
-
resizeByContentOnlyOnFirstLoad: true,
|
|
268
|
-
resizeByContentOptions: {
|
|
269
|
-
alwaysRecalculateColumnWidth: false,
|
|
270
|
-
cellPaddingWidthInPx: 14,
|
|
271
|
-
defaultRatioForStringType: 0.88,
|
|
272
|
-
formatterPaddingWidthInPx: 0,
|
|
273
|
-
maxItemToInspectCellContentWidth: 1000,
|
|
274
|
-
maxItemToInspectSingleColumnWidthByContent: 5000,
|
|
275
|
-
widthToRemoveFromExceededWidthReadjustment: 50,
|
|
276
|
-
},
|
|
277
|
-
rowTopOffsetRenderType: 'transform',
|
|
278
|
-
treeDataOptions: {
|
|
279
|
-
exportIndentMarginLeft: 5,
|
|
280
|
-
exportIndentationLeadingChar: '͏͏͏͏͏͏͏͏͏·',
|
|
281
|
-
} as unknown as TreeDataOption,
|
|
282
16
|
};
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* Value Extractor for both ColumnPicker & GridMenu Picker
|
|
286
|
-
* when using Column Header Grouping, we'll prefix the column group title
|
|
287
|
-
* else we'll simply return the column name title
|
|
288
|
-
*/
|
|
289
|
-
function pickerHeaderColumnValueExtractor(column: Column, gridOptions?: GridOption) {
|
|
290
|
-
let colName = column?.columnPickerLabel ?? column?.name ?? '';
|
|
291
|
-
if (colName instanceof HTMLElement || colName instanceof DocumentFragment) {
|
|
292
|
-
colName = colName.textContent || '';
|
|
293
|
-
}
|
|
294
|
-
const headerGroup = column?.columnGroup || '';
|
|
295
|
-
const columnGroupSeparator = gridOptions?.columnGroupSeparator ?? ' - ';
|
|
296
|
-
if (headerGroup) {
|
|
297
|
-
return headerGroup + columnGroupSeparator + colName;
|
|
298
|
-
}
|
|
299
|
-
return colName;
|
|
300
|
-
}
|
package/src/index.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { SlickgridReact } from './components/slickgrid-react.js';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import type {
|
|
3
|
+
GridOption,
|
|
4
|
+
RowDetailView,
|
|
5
|
+
SlickgridReactComponentOutput,
|
|
6
|
+
SlickgridReactInstance,
|
|
7
|
+
ViewModelBindableData,
|
|
8
|
+
ViewModelBindableInputData,
|
|
9
|
+
} from './models/index.js';
|
|
4
10
|
import type { SlickgridConfig } from './slickgrid-config.js';
|
|
5
11
|
|
|
6
12
|
export * from '@slickgrid-universal/common';
|
|
7
13
|
|
|
8
14
|
// expose all public classes & contexts
|
|
15
|
+
export { createReactComponentDynamically } from './services/reactUtils.js';
|
|
9
16
|
export { TranslaterI18NextService, disposeAllSubscriptions } from './services/index.js';
|
|
10
17
|
export { I18nextContext, I18nextProvider } from './contexts/i18nextContext.js';
|
|
11
18
|
|
|
@@ -14,7 +21,8 @@ export {
|
|
|
14
21
|
type SlickgridReactComponentOutput,
|
|
15
22
|
type GridOption,
|
|
16
23
|
type RowDetailView,
|
|
24
|
+
type ViewModelBindableData,
|
|
25
|
+
type ViewModelBindableInputData,
|
|
17
26
|
SlickgridReact,
|
|
18
27
|
SlickgridConfig,
|
|
19
|
-
SlickRowDetailView,
|
|
20
28
|
};
|
package/src/services/index.ts
CHANGED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { SlickEventData, type EventSubscription, type OnBeforeRowDetailToggleArgs, type OnRowBackOrOutOfViewportRangeArgs, type SelectionModel, type SlickGrid } from '@slickgrid-universal/common';
|
|
2
|
-
import { type EventPubSubService } from '@slickgrid-universal/event-pub-sub';
|
|
3
|
-
import { SlickRowDetailView as UniversalSlickRowDetailView } from '@slickgrid-universal/row-detail-view-plugin';
|
|
4
|
-
import type { Root } from 'react-dom/client';
|
|
5
|
-
import type { GridOption, RowDetailView } from '../models/index.js';
|
|
6
|
-
export interface CreatedView {
|
|
7
|
-
id: string | number;
|
|
8
|
-
dataContext: any;
|
|
9
|
-
root: Root | null;
|
|
10
|
-
rendered?: boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare class SlickRowDetailView extends UniversalSlickRowDetailView {
|
|
13
|
-
private readonly eventPubSubService;
|
|
14
|
-
protected _component?: any;
|
|
15
|
-
protected _preloadComponent?: any;
|
|
16
|
-
protected _preloadRoot?: Root;
|
|
17
|
-
protected _views: CreatedView[];
|
|
18
|
-
protected _subscriptions: EventSubscription[];
|
|
19
|
-
protected _userProcessFn?: (item: any) => Promise<any>;
|
|
20
|
-
protected gridContainerElement: HTMLElement;
|
|
21
|
-
_root?: Root;
|
|
22
|
-
constructor(eventPubSubService: EventPubSubService);
|
|
23
|
-
get addonOptions(): import("@slickgrid-universal/common").RowDetailViewOption;
|
|
24
|
-
protected get datasetIdPropName(): string;
|
|
25
|
-
get gridOptions(): GridOption;
|
|
26
|
-
get rowDetailViewOptions(): RowDetailView | undefined;
|
|
27
|
-
/** Dispose of the RowDetailView Extension */
|
|
28
|
-
dispose(): void;
|
|
29
|
-
/** Dispose of all the opened Row Detail Panels Components */
|
|
30
|
-
disposeAllViewComponents(): void;
|
|
31
|
-
/** Get the instance of the SlickGrid addon (control or plugin). */
|
|
32
|
-
getAddonInstance(): SlickRowDetailView | null;
|
|
33
|
-
init(grid: SlickGrid): void;
|
|
34
|
-
/**
|
|
35
|
-
* Create the plugin before the Grid creation, else it will behave oddly.
|
|
36
|
-
* Mostly because the column definitions might change after the grid creation
|
|
37
|
-
*/
|
|
38
|
-
register(rowSelectionPlugin?: SelectionModel): this;
|
|
39
|
-
/** Redraw (re-render) all the expanded row detail View Components */
|
|
40
|
-
redrawAllViewComponents(forceRedraw?: boolean): Promise<void>;
|
|
41
|
-
/** Render all the expanded row detail View Components */
|
|
42
|
-
renderAllViewModels(): Promise<void>;
|
|
43
|
-
/** Redraw the necessary View Component */
|
|
44
|
-
redrawViewComponent(view: CreatedView): void;
|
|
45
|
-
/** Render (or re-render) the View Component (Row Detail) */
|
|
46
|
-
renderPreloadView(item: any): void;
|
|
47
|
-
/** Render (or re-render) the View Component (Row Detail) */
|
|
48
|
-
renderViewModel(item: any): void;
|
|
49
|
-
protected upsertViewRefs(item: any, root: Root | null): void;
|
|
50
|
-
protected disposeViewByItem(item: any, removeFromArray?: boolean): void;
|
|
51
|
-
protected disposeViewComponent(expandedView: CreatedView): CreatedView | void;
|
|
52
|
-
/**
|
|
53
|
-
* Just before the row get expanded or collapsed we will do the following
|
|
54
|
-
* First determine if the row is expanding or collapsing,
|
|
55
|
-
* if it's expanding we will add it to our View Components reference array,
|
|
56
|
-
* if we don't already have it or if it's collapsing we will remove it from our View Components reference array
|
|
57
|
-
*/
|
|
58
|
-
protected handleOnBeforeRowDetailToggle(_e: SlickEventData<OnBeforeRowDetailToggleArgs>, args: {
|
|
59
|
-
grid: SlickGrid;
|
|
60
|
-
item: any;
|
|
61
|
-
}): void;
|
|
62
|
-
/** When Row comes back to Viewport Range, we need to redraw the View */
|
|
63
|
-
protected handleOnRowBackToViewportRange(_e: SlickEventData<OnRowBackOrOutOfViewportRangeArgs>, args: {
|
|
64
|
-
item: any;
|
|
65
|
-
rowId: string | number;
|
|
66
|
-
rowIndex: number;
|
|
67
|
-
expandedRows: (string | number)[];
|
|
68
|
-
rowIdsOutOfViewport: (string | number)[];
|
|
69
|
-
grid: SlickGrid;
|
|
70
|
-
}): Promise<void>;
|
|
71
|
-
/**
|
|
72
|
-
* notify the onAsyncResponse with the "args.item" (required property)
|
|
73
|
-
* the plugin will then use item to populate the row detail panel with the "postTemplate"
|
|
74
|
-
* @param item
|
|
75
|
-
*/
|
|
76
|
-
protected notifyTemplate(item: any): void;
|
|
77
|
-
/**
|
|
78
|
-
* On Processing, we will notify the plugin with the new item detail once backend server call completes
|
|
79
|
-
* @param item
|
|
80
|
-
*/
|
|
81
|
-
protected onProcessing(item: any): Promise<void>;
|
|
82
|
-
}
|