slickgrid-react 9.8.0 → 9.10.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 +1 -1
- package/dist/components/slickgrid-react.d.ts +2 -2
- package/dist/components/slickgrid-react.js +10 -18
- package/dist/components/slickgrid-react.js.map +1 -1
- package/dist/components/slickgridReactProps.d.ts +5 -1
- package/dist/components/slickgridReactProps.js.map +1 -1
- package/dist/contexts/i18nextContext.js.map +1 -1
- package/dist/extensions/slickRowDetailView.d.ts +2 -2
- package/dist/extensions/slickRowDetailView.js +8 -7
- package/dist/extensions/slickRowDetailView.js.map +1 -1
- package/dist/global-grid-options.js.map +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/models/gridOption.interface.js.map +1 -1
- package/dist/models/reactComponentOutput.interface.js.map +1 -1
- package/dist/services/singletons.js.map +1 -1
- package/dist/services/translaterI18Next.service.js.map +1 -1
- package/dist/slickgrid-config.js.map +1 -1
- package/package.json +10 -10
- package/src/components/slickgrid-react.tsx +35 -44
- package/src/components/slickgridReactProps.ts +16 -15
- package/src/contexts/i18nextContext.ts +0 -1
- package/src/extensions/slickRowDetailView.ts +13 -11
- package/src/global-grid-options.ts +1 -2
- package/src/index.ts +3 -4
- package/src/models/gridOption.interface.ts +0 -1
- package/src/models/reactComponentOutput.interface.ts +1 -1
- package/src/services/singletons.ts +0 -1
- package/src/services/translaterI18Next.service.ts +0 -1
- package/src/slickgrid-config.ts +1 -1
|
@@ -1,27 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
type AutocompleterEditor,
|
|
4
|
-
type BackendService,
|
|
5
|
-
type BackendServiceApi,
|
|
6
|
-
type BackendServiceOption,
|
|
7
|
-
type BasePaginationComponent,
|
|
8
|
-
type Column,
|
|
9
|
-
type DataViewOption,
|
|
10
|
-
type EventSubscription,
|
|
11
|
-
type ExtensionList,
|
|
12
|
-
type ExternalResource,
|
|
13
|
-
type Metrics,
|
|
14
|
-
type Pagination,
|
|
15
|
-
type PaginationMetadata,
|
|
16
|
-
type SelectEditor,
|
|
17
|
-
SlickDataView,
|
|
18
|
-
SlickEventHandler,
|
|
19
|
-
SlickGrid,
|
|
20
|
-
|
|
21
|
-
// services
|
|
2
|
+
autoAddEditorFormatterToColumnsWithEditor,
|
|
22
3
|
BackendUtilityService,
|
|
23
4
|
collectionObserver,
|
|
24
5
|
CollectionService,
|
|
6
|
+
emptyElement,
|
|
25
7
|
EventNamingStyle,
|
|
26
8
|
ExtensionService,
|
|
27
9
|
ExtensionUtility,
|
|
@@ -31,37 +13,49 @@ import {
|
|
|
31
13
|
GridService,
|
|
32
14
|
GridStateService,
|
|
33
15
|
HeaderGroupingService,
|
|
34
|
-
|
|
16
|
+
isColumnDateType,
|
|
35
17
|
PaginationService,
|
|
36
18
|
ResizerService,
|
|
37
|
-
type RxJsFacade,
|
|
38
19
|
SharedService,
|
|
39
|
-
|
|
20
|
+
SlickDataView,
|
|
21
|
+
SlickEventHandler,
|
|
22
|
+
SlickGrid,
|
|
40
23
|
SlickgridConfig,
|
|
24
|
+
SlickGroupItemMetadataProvider,
|
|
41
25
|
SortService,
|
|
42
26
|
TreeDataService,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
27
|
+
type AutocompleterEditor,
|
|
28
|
+
type BackendService,
|
|
29
|
+
type BackendServiceApi,
|
|
30
|
+
type BackendServiceOption,
|
|
31
|
+
type BasePaginationComponent,
|
|
32
|
+
type Column,
|
|
33
|
+
type DataViewOption,
|
|
34
|
+
type EventSubscription,
|
|
35
|
+
type ExtensionList,
|
|
36
|
+
type ExternalResource,
|
|
37
|
+
type Metrics,
|
|
38
|
+
type Observable,
|
|
39
|
+
type Pagination,
|
|
40
|
+
type PaginationMetadata,
|
|
41
|
+
type RxJsFacade,
|
|
42
|
+
type SelectEditor,
|
|
48
43
|
} from '@slickgrid-universal/common';
|
|
49
|
-
import { EventPubSubService } from '@slickgrid-universal/event-pub-sub';
|
|
50
44
|
import { SlickFooterComponent } from '@slickgrid-universal/custom-footer-component';
|
|
51
45
|
import { SlickEmptyWarningComponent } from '@slickgrid-universal/empty-warning-component';
|
|
46
|
+
import { EventPubSubService } from '@slickgrid-universal/event-pub-sub';
|
|
52
47
|
import { SlickPaginationComponent } from '@slickgrid-universal/pagination-component';
|
|
53
48
|
import { deepCopy, extend } from '@slickgrid-universal/utils';
|
|
54
49
|
import { dequal } from 'dequal/lite';
|
|
55
50
|
import React from 'react';
|
|
56
51
|
import type { Subscription } from 'rxjs';
|
|
57
|
-
|
|
58
52
|
import { I18nextContext } from '../contexts/i18nextContext.js';
|
|
59
53
|
import { GlobalGridOptions } from '../global-grid-options.js';
|
|
60
54
|
import type { GridOption, I18Next, SlickgridReactInstance } from '../models/index.js';
|
|
61
|
-
import { disposeAllSubscriptions } from '../services/utilities.js';
|
|
62
|
-
import { GlobalContainerService } from '../services/singletons.js';
|
|
63
55
|
import { loadReactComponentDynamically } from '../services/reactUtils.js';
|
|
56
|
+
import { GlobalContainerService } from '../services/singletons.js';
|
|
64
57
|
import { TranslaterI18NextService } from '../services/translaterI18Next.service.js';
|
|
58
|
+
import { disposeAllSubscriptions } from '../services/utilities.js';
|
|
65
59
|
import type { SlickgridReactProps } from './slickgridReactProps.js';
|
|
66
60
|
|
|
67
61
|
const WARN_NO_PREPARSE_DATE_SIZE = 10000; // data size to warn user when pre-parse isn't enabled
|
|
@@ -188,7 +182,7 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
|
|
|
188
182
|
set dataset(newDataset: any[]) {
|
|
189
183
|
const prevDatasetLn = this._currentDatasetLength;
|
|
190
184
|
const isDatasetEqual = dequal(newDataset, this.dataset || []);
|
|
191
|
-
let data =
|
|
185
|
+
let data = this._options?.enableDeepCopyDatasetOnPageLoad ? deepCopy(newDataset) : newDataset;
|
|
192
186
|
|
|
193
187
|
// when Tree Data is enabled and we don't yet have the hierarchical dataset filled, we can force a convert+sort of the array
|
|
194
188
|
if (
|
|
@@ -545,14 +539,7 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
|
|
|
545
539
|
this.bindDifferentHooks(this.grid, this._options, this.dataView);
|
|
546
540
|
|
|
547
541
|
// 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
|
|
548
|
-
|
|
549
|
-
if (
|
|
550
|
-
frozenColumnIndex >= 0 &&
|
|
551
|
-
frozenColumnIndex <= this.sharedService.visibleColumns.length &&
|
|
552
|
-
this.sharedService.visibleColumns.length > 0
|
|
553
|
-
) {
|
|
554
|
-
this.sharedService.frozenVisibleColumnId = this.sharedService.visibleColumns[frozenColumnIndex]?.id ?? '';
|
|
555
|
-
}
|
|
542
|
+
this.sharedService.frozenVisibleColumnId = this.grid.getFrozenColumnId();
|
|
556
543
|
|
|
557
544
|
// get any possible Services that user want to register
|
|
558
545
|
this.registerResources();
|
|
@@ -608,7 +595,10 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
|
|
|
608
595
|
}
|
|
609
596
|
|
|
610
597
|
if (this._dataset.length > 0) {
|
|
611
|
-
if (
|
|
598
|
+
if (
|
|
599
|
+
!this._isDatasetInitialized &&
|
|
600
|
+
(this._options.enableCheckboxSelector || this._options.enableRowSelection || this._options.enableHybridSelection)
|
|
601
|
+
) {
|
|
612
602
|
this.loadRowSelectionPresetWhenExists();
|
|
613
603
|
}
|
|
614
604
|
this.loadFilterPresetsWhenDatasetInitialized();
|
|
@@ -1123,7 +1113,7 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
|
|
|
1123
1113
|
this.grid &&
|
|
1124
1114
|
!isSyncGridSelectionEnabled &&
|
|
1125
1115
|
this.options?.backendServiceApi &&
|
|
1126
|
-
(this.options.enableRowSelection || this.options.enableCheckboxSelector)
|
|
1116
|
+
(this.options.enableRowSelection || this.options.enableHybridSelection || this.options.enableCheckboxSelector)
|
|
1127
1117
|
) {
|
|
1128
1118
|
this.grid.setSelectedRows([]);
|
|
1129
1119
|
}
|
|
@@ -1504,7 +1494,8 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
|
|
|
1504
1494
|
protected loadRowSelectionPresetWhenExists() {
|
|
1505
1495
|
// if user entered some Row Selections "presets"
|
|
1506
1496
|
const presets = this._options?.presets;
|
|
1507
|
-
const enableRowSelection =
|
|
1497
|
+
const enableRowSelection =
|
|
1498
|
+
this._options && (this._options.enableCheckboxSelector || this._options.enableRowSelection || this._options.enableHybridSelection);
|
|
1508
1499
|
if (
|
|
1509
1500
|
enableRowSelection &&
|
|
1510
1501
|
this.grid?.getSelectionModel() &&
|
|
@@ -3,8 +3,14 @@ import type {
|
|
|
3
3
|
ContainerService,
|
|
4
4
|
DragRowMove,
|
|
5
5
|
ExtensionList,
|
|
6
|
+
GridMenuCommandItemCallbackArgs,
|
|
7
|
+
GridMenuEventWithElementCallbackArgs,
|
|
6
8
|
GridOption,
|
|
7
9
|
HeaderButtonOnCommandArgs,
|
|
10
|
+
HeaderMenuCommandItemCallbackArgs,
|
|
11
|
+
MenuCommandItemCallbackArgs,
|
|
12
|
+
MenuFromCellCallbackArgs,
|
|
13
|
+
MenuOptionItemCallbackArgs,
|
|
8
14
|
OnActiveCellChangedEventArgs,
|
|
9
15
|
OnAddNewRowEventArgs,
|
|
10
16
|
OnAutosizeColumnsEventArgs,
|
|
@@ -25,9 +31,12 @@ import type {
|
|
|
25
31
|
OnColumnsResizedEventArgs,
|
|
26
32
|
OnCompositeEditorChangeEventArgs,
|
|
27
33
|
OnDblClickEventArgs,
|
|
34
|
+
OnDragReplaceCellsEventArgs,
|
|
28
35
|
OnFooterClickEventArgs,
|
|
29
36
|
OnFooterContextMenuEventArgs,
|
|
30
37
|
OnFooterRowCellRenderedEventArgs,
|
|
38
|
+
OnGroupCollapsedEventArgs,
|
|
39
|
+
OnGroupExpandedEventArgs,
|
|
31
40
|
OnHeaderCellRenderedEventArgs,
|
|
32
41
|
OnHeaderClickEventArgs,
|
|
33
42
|
OnHeaderContextMenuEventArgs,
|
|
@@ -35,33 +44,24 @@ import type {
|
|
|
35
44
|
OnHeaderRowCellRenderedEventArgs,
|
|
36
45
|
OnKeyDownEventArgs,
|
|
37
46
|
OnRenderedEventArgs,
|
|
38
|
-
OnScrollEventArgs,
|
|
39
|
-
OnSelectedRowsChangedEventArgs,
|
|
40
|
-
OnSetOptionsEventArgs,
|
|
41
|
-
OnValidationErrorEventArgs,
|
|
42
|
-
SingleColumnSort,
|
|
43
|
-
OnGroupCollapsedEventArgs,
|
|
44
|
-
OnGroupExpandedEventArgs,
|
|
45
47
|
OnRowCountChangedEventArgs,
|
|
46
48
|
OnRowsChangedEventArgs,
|
|
47
49
|
OnRowsOrCountChangedEventArgs,
|
|
50
|
+
OnScrollEventArgs,
|
|
51
|
+
OnSelectedRowsChangedEventArgs,
|
|
48
52
|
OnSetItemsCalledEventArgs,
|
|
53
|
+
OnSetOptionsEventArgs,
|
|
54
|
+
OnValidationErrorEventArgs,
|
|
49
55
|
Pagination,
|
|
56
|
+
PaginationChangedArgs,
|
|
50
57
|
PagingInfo,
|
|
58
|
+
SingleColumnSort,
|
|
51
59
|
SlickControlList,
|
|
52
60
|
SlickDataView,
|
|
53
61
|
SlickGrid,
|
|
54
62
|
SlickPluginList,
|
|
55
63
|
SlickRange,
|
|
56
|
-
GridMenuCommandItemCallbackArgs,
|
|
57
|
-
GridMenuEventWithElementCallbackArgs,
|
|
58
|
-
MenuCommandItemCallbackArgs,
|
|
59
|
-
HeaderMenuCommandItemCallbackArgs,
|
|
60
|
-
PaginationChangedArgs,
|
|
61
|
-
MenuFromCellCallbackArgs,
|
|
62
|
-
MenuOptionItemCallbackArgs,
|
|
63
64
|
} from '@slickgrid-universal/common';
|
|
64
|
-
|
|
65
65
|
import type { SlickgridReactInstance } from '../models/index.js';
|
|
66
66
|
import type { TranslaterI18NextService } from '../services/translaterI18Next.service.js';
|
|
67
67
|
|
|
@@ -112,6 +112,7 @@ export interface SlickgridReactProps {
|
|
|
112
112
|
onDragEnd?: (e: CustomEvent<{ eventData: any; args: DragRowMove }>) => void;
|
|
113
113
|
onDragInit?: (e: CustomEvent<{ eventData: any; args: DragRowMove }>) => void;
|
|
114
114
|
onDragStart?: (e: CustomEvent<{ eventData: any; args: DragRowMove }>) => void;
|
|
115
|
+
onDragReplaceCells?: (e: CustomEvent<{ eventData: any; args: OnDragReplaceCellsEventArgs }>) => void;
|
|
115
116
|
onDblClick?: (e: CustomEvent<{ eventData: any; args: OnDblClickEventArgs }>) => void;
|
|
116
117
|
onFooterContextMenu?: (e: CustomEvent<{ eventData: any; args: OnFooterContextMenuEventArgs }>) => void;
|
|
117
118
|
onFooterRowCellRendered?: (e: CustomEvent<{ eventData: any; args: OnFooterRowCellRenderedEventArgs }>) => void;
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
addToArrayWhenNotExists,
|
|
3
3
|
createDomElement,
|
|
4
|
+
SlickEventData,
|
|
5
|
+
SlickHybridSelectionModel,
|
|
6
|
+
SlickRowSelectionModel,
|
|
7
|
+
unsubscribeAll,
|
|
4
8
|
type EventSubscription,
|
|
5
9
|
type OnBeforeRowDetailToggleArgs,
|
|
6
10
|
type OnRowBackOrOutOfViewportRangeArgs,
|
|
7
|
-
|
|
11
|
+
type SelectionModel,
|
|
8
12
|
type SlickGrid,
|
|
9
|
-
SlickRowSelectionModel,
|
|
10
|
-
unsubscribeAll,
|
|
11
13
|
} from '@slickgrid-universal/common';
|
|
12
14
|
import { type EventPubSubService } from '@slickgrid-universal/event-pub-sub';
|
|
13
15
|
import { SlickRowDetailView as UniversalSlickRowDetailView } from '@slickgrid-universal/row-detail-view-plugin';
|
|
14
16
|
import type { Root } from 'react-dom/client';
|
|
15
|
-
|
|
16
17
|
import type { GridOption, RowDetailView, ViewModelBindableInputData } from '../models/index.js';
|
|
17
18
|
import { createReactComponentDynamically } from '../services/reactUtils.js';
|
|
18
19
|
|
|
@@ -81,16 +82,16 @@ export class SlickRowDetailView extends UniversalSlickRowDetailView {
|
|
|
81
82
|
|
|
82
83
|
init(grid: SlickGrid) {
|
|
83
84
|
this._grid = grid;
|
|
84
|
-
super.init(
|
|
85
|
+
super.init(grid);
|
|
85
86
|
this.gridContainerElement = grid.getContainerNode();
|
|
86
|
-
this.register(grid
|
|
87
|
+
this.register(grid.getSelectionModel());
|
|
87
88
|
}
|
|
88
89
|
|
|
89
90
|
/**
|
|
90
91
|
* Create the plugin before the Grid creation, else it will behave oddly.
|
|
91
92
|
* Mostly because the column definitions might change after the grid creation
|
|
92
93
|
*/
|
|
93
|
-
register(rowSelectionPlugin?:
|
|
94
|
+
register(rowSelectionPlugin?: SelectionModel) {
|
|
94
95
|
if (typeof this.gridOptions.rowDetailView?.process === 'function') {
|
|
95
96
|
// we need to keep the user "process" method and replace it with our own execution method
|
|
96
97
|
// we do this because when we get the item detail, we need to call "onAsyncResponse.notify" for the plugin to work
|
|
@@ -104,11 +105,11 @@ export class SlickRowDetailView extends UniversalSlickRowDetailView {
|
|
|
104
105
|
// load the Preload & RowDetail Templates (could be straight HTML or React Components)
|
|
105
106
|
// when those are React Components, we need to create View Component & provide the html containers to the Plugin (preTemplate/postTemplate methods)
|
|
106
107
|
if (!this.gridOptions.rowDetailView.preTemplate) {
|
|
107
|
-
this._preloadComponent = this.gridOptions
|
|
108
|
+
this._preloadComponent = this.gridOptions.rowDetailView.preloadComponent;
|
|
108
109
|
this.addonOptions.preTemplate = () => createDomElement('div', { className: `${PRELOAD_CONTAINER_PREFIX}` });
|
|
109
110
|
}
|
|
110
111
|
if (!this.gridOptions.rowDetailView.postTemplate) {
|
|
111
|
-
this._component = this.gridOptions
|
|
112
|
+
this._component = this.gridOptions.rowDetailView.viewComponent;
|
|
112
113
|
this.addonOptions.postTemplate = (itemDetail: any) =>
|
|
113
114
|
createDomElement('div', { className: `${ROW_DETAIL_CONTAINER_PREFIX}${itemDetail[this.datasetIdPropName]}` });
|
|
114
115
|
}
|
|
@@ -116,7 +117,8 @@ export class SlickRowDetailView extends UniversalSlickRowDetailView {
|
|
|
116
117
|
if (this._grid && this.gridOptions) {
|
|
117
118
|
// this also requires the Row Selection Model to be registered as well
|
|
118
119
|
if (!rowSelectionPlugin || !this._grid.getSelectionModel()) {
|
|
119
|
-
|
|
120
|
+
const SelectionModelClass = this.gridOptions.enableHybridSelection ? SlickHybridSelectionModel : SlickRowSelectionModel;
|
|
121
|
+
rowSelectionPlugin = new SelectionModelClass(this.gridOptions.rowSelectionOptions || { selectActiveRow: true });
|
|
120
122
|
this._grid.setSelectionModel(rowSelectionPlugin);
|
|
121
123
|
}
|
|
122
124
|
|
|
@@ -196,7 +198,7 @@ export class SlickRowDetailView extends UniversalSlickRowDetailView {
|
|
|
196
198
|
this.eventHandler.subscribe(this._grid.onColumnsReordered, () => this.redrawAllViewComponents(false));
|
|
197
199
|
|
|
198
200
|
// on row selection changed, we also need to redraw
|
|
199
|
-
if (this.gridOptions.enableRowSelection || this.gridOptions.enableCheckboxSelector) {
|
|
201
|
+
if (this.gridOptions.enableRowSelection || this.gridOptions.enableHybridSelection || this.gridOptions.enableCheckboxSelector) {
|
|
200
202
|
this._eventHandler.subscribe(this._grid.onSelectedRowsChanged, () => this.redrawAllViewComponents(false));
|
|
201
203
|
}
|
|
202
204
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { DelimiterType, EventNamingStyle, Filters, type Column, type TreeDataOption } from '@slickgrid-universal/common';
|
|
3
2
|
import type { GridOption, RowDetailView } from './models/index.js';
|
|
4
3
|
|
|
5
4
|
/**
|
package/src/index.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import 'regenerator-runtime/runtime.js';
|
|
2
|
-
export * from '@slickgrid-universal/common';
|
|
3
|
-
|
|
4
1
|
import { SlickgridReact } from './components/slickgrid-react.js';
|
|
5
2
|
import { SlickRowDetailView } from './extensions/slickRowDetailView.js';
|
|
3
|
+
import type { GridOption, RowDetailView, SlickgridReactComponentOutput, SlickgridReactInstance } from './models/index.js';
|
|
6
4
|
import type { SlickgridConfig } from './slickgrid-config.js';
|
|
7
|
-
|
|
5
|
+
|
|
6
|
+
export * from '@slickgrid-universal/common';
|
|
8
7
|
|
|
9
8
|
// expose all public classes & contexts
|
|
10
9
|
export { TranslaterI18NextService, disposeAllSubscriptions } from './services/index.js';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { BasePaginationComponent, BasePaginationModel, GridOption as UniversalGridOption } from '@slickgrid-universal/common';
|
|
2
2
|
import type { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
3
|
-
|
|
4
3
|
import type { I18Next } from './i18next.interface.js';
|
|
5
4
|
import type { RowDetailView } from './rowDetailView.interface.js';
|
|
6
5
|
|
package/src/slickgrid-config.ts
CHANGED