slickgrid-react 4.2.0 → 4.3.1
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 +4 -4
- package/dist/cjs/components/slickgrid-react.js +12 -28
- package/dist/cjs/components/slickgrid-react.js.map +1 -1
- package/dist/esm/components/slickgrid-react.js +12 -28
- package/dist/esm/components/slickgrid-react.js.map +1 -1
- package/dist/types/components/slickgrid-react.d.ts +1 -4
- package/dist/types/components/slickgrid-react.d.ts.map +1 -1
- package/dist/types/components/slickgridReactProps.d.ts +19 -7
- package/dist/types/components/slickgridReactProps.d.ts.map +1 -1
- package/package.json +37 -37
- package/src/slickgrid-react/components/slickgrid-react.tsx +12 -31
- package/src/slickgrid-react/components/slickgridReactProps.ts +7 -7
|
@@ -109,6 +109,7 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
|
|
|
109
109
|
protected _eventHandler!: SlickEventHandler;
|
|
110
110
|
protected _eventPubSubService!: EventPubSubService;
|
|
111
111
|
protected _hideHeaderRowAfterPageLoad = false;
|
|
112
|
+
protected _isAutosizeColsCalled = false;
|
|
112
113
|
protected _isGridInitialized = false;
|
|
113
114
|
protected _isDatasetInitialized = false;
|
|
114
115
|
protected _isDatasetHierarchicalInitialized = false;
|
|
@@ -215,8 +216,9 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
|
|
|
215
216
|
|
|
216
217
|
// expand/autofit columns on first page load
|
|
217
218
|
// we can assume that if the prevDataset was empty then we are on first load
|
|
218
|
-
if (this.grid && this.gridOptions.autoFitColumnsOnFirstLoad && prevDatasetLn === 0) {
|
|
219
|
+
if (this.grid && this.gridOptions.autoFitColumnsOnFirstLoad && prevDatasetLn === 0 && !this._isAutosizeColsCalled) {
|
|
219
220
|
this.grid.autosizeColumns();
|
|
221
|
+
this._isAutosizeColsCalled = true;
|
|
220
222
|
}
|
|
221
223
|
}
|
|
222
224
|
|
|
@@ -288,6 +290,7 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
|
|
|
288
290
|
this.sortService,
|
|
289
291
|
this.treeDataService,
|
|
290
292
|
this.props.translaterService,
|
|
293
|
+
() => this.gridService
|
|
291
294
|
);
|
|
292
295
|
|
|
293
296
|
this.gridStateService = this.props.externalServices?.gridStateService ?? new GridStateService(this.extensionService, this.filterService, this._eventPubSubService, this.sharedService, this.sortService, this.treeDataService);
|
|
@@ -400,6 +403,7 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
|
|
|
400
403
|
|
|
401
404
|
this._gridOptions.translater = this.props.translaterService;
|
|
402
405
|
this._eventHandler = eventHandler;
|
|
406
|
+
this._isAutosizeColsCalled = false;
|
|
403
407
|
|
|
404
408
|
// when detecting a frozen grid, we'll automatically enable the mousewheel scroll handler so that we can scroll from both left/right frozen containers
|
|
405
409
|
if (this._gridOptions && ((this._gridOptions.frozenRow !== undefined && this._gridOptions.frozenRow >= 0) || this._gridOptions.frozenColumn !== undefined && this._gridOptions.frozenColumn >= 0) && this._gridOptions.enableMouseWheelScrollHandler === undefined) {
|
|
@@ -756,19 +760,15 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
|
|
|
756
760
|
// translate some of them on first load, then on each language change
|
|
757
761
|
if (gridOptions.enableTranslate) {
|
|
758
762
|
this.extensionService.translateAllExtensions();
|
|
759
|
-
this.translateColumnHeaderTitleKeys();
|
|
760
|
-
this.translateColumnGroupKeys();
|
|
761
763
|
}
|
|
762
764
|
|
|
763
765
|
// on locale change, we have to manually translate the Headers, GridMenu
|
|
764
|
-
i18next.on('languageChanged', () => {
|
|
766
|
+
i18next.on('languageChanged', (lang) => {
|
|
765
767
|
// publish event of the same name that Slickgrid-Universal uses on a language change event
|
|
766
768
|
this._eventPubSubService.publish('onLanguageChange');
|
|
767
769
|
|
|
768
770
|
if (gridOptions.enableTranslate) {
|
|
769
|
-
this.extensionService.translateAllExtensions();
|
|
770
|
-
this.translateColumnHeaderTitleKeys();
|
|
771
|
-
this.translateColumnGroupKeys();
|
|
771
|
+
this.extensionService.translateAllExtensions(lang);
|
|
772
772
|
if (gridOptions.createPreHeaderPanel && !gridOptions.enableDraggableGrouping) {
|
|
773
773
|
this.groupingService.translateGroupingAndColSpan();
|
|
774
774
|
}
|
|
@@ -966,11 +966,6 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
|
|
|
966
966
|
throw new Error(`[Slickgrid-React] You cannot enable both autosize/fit viewport & resize by content, you must choose which resize technique to use. You can enable these 2 options ("autoFitColumnsOnFirstLoad" and "enableAutoSizeColumns") OR these other 2 options ("autosizeColumnsByCellContentOnFirstLoad" and "enableAutoResizeColumnsByCellContent").`);
|
|
967
967
|
}
|
|
968
968
|
|
|
969
|
-
// expand/autofit columns on first page load
|
|
970
|
-
if (grid && options.autoFitColumnsOnFirstLoad && options.enableAutoSizeColumns && typeof grid.autosizeColumns === 'function') {
|
|
971
|
-
this.grid.autosizeColumns();
|
|
972
|
-
}
|
|
973
|
-
|
|
974
969
|
// auto-resize grid on browser resize
|
|
975
970
|
if (options.gridHeight || options.gridWidth) {
|
|
976
971
|
this.resizerService.resizeGrid(0, { height: options.gridHeight, width: options.gridWidth });
|
|
@@ -978,10 +973,10 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
|
|
|
978
973
|
this.resizerService.resizeGrid();
|
|
979
974
|
}
|
|
980
975
|
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
976
|
+
// expand/autofit columns on first page load
|
|
977
|
+
if (grid && options?.enableAutoResize && options.autoFitColumnsOnFirstLoad && options.enableAutoSizeColumns && !this._isAutosizeColsCalled) {
|
|
978
|
+
grid.autosizeColumns();
|
|
979
|
+
this._isAutosizeColsCalled = true;
|
|
985
980
|
}
|
|
986
981
|
}
|
|
987
982
|
|
|
@@ -1065,10 +1060,6 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
|
|
|
1065
1060
|
this._isDatasetInitialized = true;
|
|
1066
1061
|
}
|
|
1067
1062
|
|
|
1068
|
-
if (dataset) {
|
|
1069
|
-
this.grid.invalidate();
|
|
1070
|
-
}
|
|
1071
|
-
|
|
1072
1063
|
// display the Pagination component only after calling this refresh data first, we call it here so that if we preset pagination page number it will be shown correctly
|
|
1073
1064
|
this.showPagination = (this._gridOptions && (this._gridOptions.enablePagination || (this._gridOptions.backendServiceApi && this._gridOptions.enablePagination === undefined))) ? true : false;
|
|
1074
1065
|
if (this._paginationOptions && this._gridOptions?.pagination && this._gridOptions?.backendServiceApi) {
|
|
@@ -1138,7 +1129,7 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
|
|
|
1138
1129
|
}
|
|
1139
1130
|
|
|
1140
1131
|
if (this._gridOptions.enableTranslate) {
|
|
1141
|
-
this.extensionService.translateColumnHeaders(
|
|
1132
|
+
this.extensionService.translateColumnHeaders(undefined, newColumnDefinitions);
|
|
1142
1133
|
} else {
|
|
1143
1134
|
this.extensionService.renderColumnHeaders(newColumnDefinitions, true);
|
|
1144
1135
|
}
|
|
@@ -1547,16 +1538,6 @@ export class SlickgridReact<TData = any> extends React.Component<SlickgridReactP
|
|
|
1547
1538
|
});
|
|
1548
1539
|
}
|
|
1549
1540
|
|
|
1550
|
-
/** translate all columns (including hidden columns) */
|
|
1551
|
-
protected translateColumnHeaderTitleKeys() {
|
|
1552
|
-
this.extensionUtility.translateItems(this.sharedService.allColumns, 'nameKey', 'name');
|
|
1553
|
-
}
|
|
1554
|
-
|
|
1555
|
-
/** translate all column groups (including hidden columns) */
|
|
1556
|
-
protected translateColumnGroupKeys() {
|
|
1557
|
-
this.extensionUtility.translateItems(this.sharedService.allColumns, 'columnGroupKey', 'columnGroup');
|
|
1558
|
-
}
|
|
1559
|
-
|
|
1560
1541
|
/**
|
|
1561
1542
|
* Update the "internalColumnEditor.collection" property.
|
|
1562
1543
|
* Since this is called after the async call resolves, the pointer will not be the same as the "column" argument passed.
|
|
@@ -23,7 +23,6 @@ import {
|
|
|
23
23
|
SortService,
|
|
24
24
|
TranslaterService,
|
|
25
25
|
TreeDataService,
|
|
26
|
-
SlickGridEventData,
|
|
27
26
|
OnActiveCellChangedEventArgs,
|
|
28
27
|
DragRowMove,
|
|
29
28
|
OnAddNewRowEventArgs,
|
|
@@ -67,6 +66,7 @@ import {
|
|
|
67
66
|
OnRowsOrCountChangedEventArgs,
|
|
68
67
|
OnSetItemsCalledEventArgs,
|
|
69
68
|
PagingInfo,
|
|
69
|
+
SlickGrid,
|
|
70
70
|
} from '@slickgrid-universal/common';
|
|
71
71
|
import { EventPubSubService } from '@slickgrid-universal/event-pub-sub';
|
|
72
72
|
import { SlickgridReactInstance } from '../models';
|
|
@@ -111,14 +111,14 @@ export interface SlickgridReactProps {
|
|
|
111
111
|
|
|
112
112
|
// Slick Grid events
|
|
113
113
|
onActiveCellChanged?: (e: CustomEvent<{ eventData: any; args: OnActiveCellChangedEventArgs; }>) => void;
|
|
114
|
-
onActiveCellPositionChanged?: (e: CustomEvent<{ eventData: any; args:
|
|
114
|
+
onActiveCellPositionChanged?: (e: CustomEvent<{ eventData: any; args: { grid: SlickGrid; }; }>) => void;
|
|
115
115
|
onAddNewRow?: (e: CustomEvent<{ eventData: any; args: OnAddNewRowEventArgs; }>) => void;
|
|
116
116
|
onAutosizeColumns?: (e: CustomEvent<{ eventData: any; args: OnAutosizeColumnsEventArgs; }>) => void;
|
|
117
117
|
onBeforeAppendCell?: (e: CustomEvent<{ eventData: any; args: OnBeforeAppendCellEventArgs; }>) => void;
|
|
118
118
|
onBeforeSearchChange?: (e: CustomEvent<{ eventData: any; args: OnCellChangeEventArgs; }>) => void;
|
|
119
119
|
onBeforeCellEditorDestroy?: (e: CustomEvent<{ eventData: any; args: OnBeforeCellEditorDestroyEventArgs; }>) => void;
|
|
120
120
|
onBeforeColumnsResize?: (e: CustomEvent<{ eventData: any; args: OnBeforeColumnsResizeEventArgs; }>) => void;
|
|
121
|
-
onBeforeDestroy?: (e: CustomEvent<{ eventData: any; args:
|
|
121
|
+
onBeforeDestroy?: (e: CustomEvent<{ eventData: any; args: { grid: SlickGrid; }; }>) => void;
|
|
122
122
|
onBeforeEditCell?: (e: CustomEvent<{ eventData: any; args: OnBeforeEditCellEventArgs; }>) => void;
|
|
123
123
|
onBeforeHeaderCellDestroy?: (e: CustomEvent<{ eventData: any; args: OnBeforeHeaderCellDestroyEventArgs; }>) => void;
|
|
124
124
|
onBeforeHeaderRowCellDestroy?: (e: CustomEvent<{ eventData: any; args: OnBeforeHeaderRowCellDestroyEventArgs; }>) => void;
|
|
@@ -133,7 +133,7 @@ export interface SlickgridReactProps {
|
|
|
133
133
|
onColumnsResized?: (e: CustomEvent<{ eventData: any; args: OnColumnsResizedEventArgs; }>) => void;
|
|
134
134
|
onColumnsResizeDblClick?: (e: CustomEvent<{ eventData: any; args: OnColumnsResizeDblClickEventArgs; }>) => void;
|
|
135
135
|
onCompositeEditorChange?: (e: CustomEvent<{ eventData: any; args: OnCompositeEditorChangeEventArgs; }>) => void;
|
|
136
|
-
onContextMenu?: (e: CustomEvent<{ eventData: any; args:
|
|
136
|
+
onContextMenu?: (e: CustomEvent<{ eventData: any; args: { grid: SlickGrid; }; }>) => void;
|
|
137
137
|
onDrag?: (e: CustomEvent<{ eventData: any; args: DragRowMove; }>) => void;
|
|
138
138
|
onDragEnd?: (e: CustomEvent<{ eventData: any; args: DragRowMove; }>) => void;
|
|
139
139
|
onDragInit?: (e: CustomEvent<{ eventData: any; args: DragRowMove; }>) => void;
|
|
@@ -151,10 +151,10 @@ export interface SlickgridReactProps {
|
|
|
151
151
|
onHeaderRowMouseEnter?: (e: CustomEvent<{ eventData: any; args: OnHeaderMouseEventArgs; }>) => void;
|
|
152
152
|
onHeaderRowMouseLeave?: (e: CustomEvent<{ eventData: any; args: OnHeaderMouseEventArgs; }>) => void;
|
|
153
153
|
onKeyDown?: (e: CustomEvent<{ eventData: any; args: OnKeyDownEventArgs; }>) => void;
|
|
154
|
-
onMouseEnter?: (e: CustomEvent<{ eventData: any; args:
|
|
155
|
-
onMouseLeave?: (e: CustomEvent<{ eventData: any; args:
|
|
154
|
+
onMouseEnter?: (e: CustomEvent<{ eventData: any; args: { grid: SlickGrid; }; }>) => void;
|
|
155
|
+
onMouseLeave?: (e: CustomEvent<{ eventData: any; args: { grid: SlickGrid; }; }>) => void;
|
|
156
156
|
onValidationError?: (e: CustomEvent<{ eventData: any; args: OnValidationErrorEventArgs; }>) => void;
|
|
157
|
-
onViewportChanged?: (e: CustomEvent<{ eventData: any; args:
|
|
157
|
+
onViewportChanged?: (e: CustomEvent<{ eventData: any; args: { grid: SlickGrid; }; }>) => void;
|
|
158
158
|
onRendered?: (e: CustomEvent<{ eventData: any; args: OnRenderedEventArgs; }>) => void;
|
|
159
159
|
onSelectedRowsChanged?: (e: CustomEvent<{ eventData: any; args: OnSelectedRowsChangedEventArgs; }>) => void;
|
|
160
160
|
onSetOptions?: (e: CustomEvent<{ eventData: any; args: OnSetOptionsEventArgs; }>) => void;
|