@redsift/table 11.2.0-muiv5 → 11.2.1-muiv5
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/index.d.ts +5 -17
- package/index.js +51 -62
- package/index.js.map +1 -1
- package/package.json +4 -4
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _mui_x_data_grid_pro from '@mui/x-data-grid-pro';
|
|
2
|
-
import { GridNativeColTypes, GridColumnTypesRecord, GridFilterItem, GridCellParams, GridFilterOperator, GridFilterInputValue, GridFilterInputMultipleValue, DataGridProProps,
|
|
2
|
+
import { GridNativeColTypes, GridColumnTypesRecord, GridFilterItem, GridCellParams, GridFilterOperator, GridFilterInputValue, GridFilterInputMultipleValue, DataGridProProps, GridFilterModel, GridSortModel, GridSortItem, GridColumnVisibilityModel, GridPinnedColumns, GridSlotsComponent, GridSelectionModel, GridRowParams, GridToolbarExportProps, GridToolbarFilterButtonProps, GridToolbarColumnsButton, GridToolbarDensitySelector } from '@mui/x-data-grid-pro';
|
|
3
3
|
export { GridAlignment, GridColDef, GridColumns, GridFilterItem, GridFilterModel, GridSelectionModel, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators } from '@mui/x-data-grid-pro';
|
|
4
4
|
import { GridInitialStatePro } from '@mui/x-data-grid-pro/models/gridStatePro';
|
|
5
5
|
import React, { ReactNode, ComponentProps, MutableRefObject, RefObject } from 'react';
|
|
@@ -132,16 +132,6 @@ interface DataGridProps extends Partial<Pick<DataGridProProps, 'rows'>>, Omit<Da
|
|
|
132
132
|
paginationProps?: Omit<TablePaginationProps, 'component' | 'count' | 'page' | 'onPageChange' | 'rowsPerPage' | 'onRowsPerPageChange' | 'rowsPerPageOptions' | 'paginationMode'>;
|
|
133
133
|
/** Theme. */
|
|
134
134
|
theme?: Theme;
|
|
135
|
-
/** If set, the DataGrid configuration will be stored and synced in the URL and the local storage. useRouter prop should be defined. */
|
|
136
|
-
isStateful?: boolean;
|
|
137
|
-
/** Hook returning pathname, search params and a method to update query params. Used in stateful mode only. */
|
|
138
|
-
useRouter?: () => {
|
|
139
|
-
pathname: string;
|
|
140
|
-
search: string;
|
|
141
|
-
historyReplace: (newSearch: string) => void;
|
|
142
|
-
};
|
|
143
|
-
/** Pinned custom columns. */
|
|
144
|
-
pinnedCustomColumns?: Required<GridPinnedColumns>;
|
|
145
135
|
}
|
|
146
136
|
type SelectionStatus = {
|
|
147
137
|
type: 'page' | 'table' | 'other' | 'none';
|
|
@@ -165,8 +155,6 @@ interface StatefulDataGridProps extends DataGridProps {
|
|
|
165
155
|
search: string;
|
|
166
156
|
historyReplace: (newSearch: string) => void;
|
|
167
157
|
};
|
|
168
|
-
/** Pinned custom columns. */
|
|
169
|
-
pinnedCustomColumns?: Required<GridPinnedColumns>;
|
|
170
158
|
/** Local Storage version, to upgrade when we want to force a clean out. */
|
|
171
159
|
localStorageVersion?: number;
|
|
172
160
|
}
|
|
@@ -189,15 +177,15 @@ declare const numberOperatorDecoder: Record<string, string>;
|
|
|
189
177
|
declare const getFilterModelFromString: (searchString: string, columns: DataGridProps['columns']) => GridFilterModel | 'invalid';
|
|
190
178
|
declare const getSearchParamsFromFilterModel: (filterModel: GridFilterModel) => URLSearchParams;
|
|
191
179
|
/** SORT */
|
|
192
|
-
declare const getSortingFromString: (searchString: string, columns: DataGridProps['columns']) => GridSortModel |
|
|
180
|
+
declare const getSortingFromString: (searchString: string, columns: DataGridProps['columns']) => GridSortModel | 'invalid';
|
|
193
181
|
declare const getSearchParamsFromSorting: (sorting: GridSortItem[]) => URLSearchParams;
|
|
194
182
|
/** PAGINATION */
|
|
195
|
-
declare const getPaginationFromString: (searchString: string) => ExtendedGridPaginationModel |
|
|
183
|
+
declare const getPaginationFromString: (searchString: string) => ExtendedGridPaginationModel | 'invalid';
|
|
196
184
|
declare const getSearchParamsFromPagination: (pagination: ExtendedGridPaginationModel) => URLSearchParams;
|
|
197
185
|
/** COLUMN VISIBILITY */
|
|
198
186
|
declare const getSearchParamsFromColumnVisibility: (columnVisibility: GridColumnVisibilityModel, columns: DataGridProps['columns']) => URLSearchParams;
|
|
199
|
-
declare const getColumnVisibilityFromString: (notParsed: string, tableColumns: DataGridProps['columns']) => GridColumnVisibilityModel |
|
|
200
|
-
declare const getPinnedColumnsFromString: (notParsed: string, tableColumns: DataGridProps['columns']) => PinnedColumns |
|
|
187
|
+
declare const getColumnVisibilityFromString: (notParsed: string, tableColumns: DataGridProps['columns']) => GridColumnVisibilityModel | 'invalid';
|
|
188
|
+
declare const getPinnedColumnsFromString: (notParsed: string, tableColumns: DataGridProps['columns']) => PinnedColumns | 'invalid';
|
|
201
189
|
declare const getSearchParamsFromPinnedColumns: (pinnedColumns: GridPinnedColumns) => URLSearchParams;
|
|
202
190
|
declare const getSearchParamsFromTab: (search: string) => URLSearchParams;
|
|
203
191
|
type FinalSearchInput = {
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GRID_DETAIL_PANEL_TOGGLE_COL_DEF, getGridNumericOperators as getGridNumericOperators$1, GridFilterInputValue, GridFilterInputMultipleValue, getGridStringOperators as getGridStringOperators$1, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators, GridLinkOperator, GridToolbarContainer, GridToolbarFilterButton, GridToolbarColumnsButton, GridToolbarDensitySelector, GridToolbarExport, gridVisibleSortedRowIdsSelector, gridPaginatedVisibleSortedGridRowEntriesSelector, gridPaginatedVisibleSortedGridRowIdsSelector, gridFilteredSortedRowEntriesSelector, gridFilteredSortedRowIdsSelector, useGridApiRef, DataGridPro
|
|
1
|
+
import { GRID_DETAIL_PANEL_TOGGLE_COL_DEF, getGridNumericOperators as getGridNumericOperators$1, GridFilterInputValue, GridFilterInputMultipleValue, getGridStringOperators as getGridStringOperators$1, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators, GridLinkOperator, GridToolbarContainer, GridToolbarFilterButton, GridToolbarColumnsButton, GridToolbarDensitySelector, GridToolbarExport, gridVisibleSortedRowIdsSelector, gridPaginatedVisibleSortedGridRowEntriesSelector, gridPaginatedVisibleSortedGridRowIdsSelector, gridFilteredSortedRowEntriesSelector, gridFilteredSortedRowIdsSelector, useGridApiRef, DataGridPro } from '@mui/x-data-grid-pro';
|
|
2
2
|
export { getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators } from '@mui/x-data-grid-pro';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import React__default, { Children, isValidElement, cloneElement, forwardRef, useLayoutEffect, useEffect, useRef, useContext, useState, useCallback, createElement, useMemo } from 'react';
|
|
@@ -18250,7 +18250,7 @@ const getFilterModel = (search, columns, localStorageFilters, setLocalStorageFil
|
|
|
18250
18250
|
|
|
18251
18251
|
const getSortingFromString = (searchString, columns) => {
|
|
18252
18252
|
if (!searchString) {
|
|
18253
|
-
return
|
|
18253
|
+
return 'invalid';
|
|
18254
18254
|
}
|
|
18255
18255
|
const searchParams = new URLSearchParams(searchString);
|
|
18256
18256
|
const value = searchParams.get('_sortColumn');
|
|
@@ -18265,7 +18265,7 @@ const getSortingFromString = (searchString, columns) => {
|
|
|
18265
18265
|
sort: order
|
|
18266
18266
|
}];
|
|
18267
18267
|
}
|
|
18268
|
-
return
|
|
18268
|
+
return 'invalid';
|
|
18269
18269
|
};
|
|
18270
18270
|
const getSearchParamsFromSorting = sorting => {
|
|
18271
18271
|
const searchParams = new URLSearchParams();
|
|
@@ -18277,9 +18277,10 @@ const getSearchParamsFromSorting = sorting => {
|
|
|
18277
18277
|
// - if we have something in the URL, use that info
|
|
18278
18278
|
// - if we don't have that, use the localStorage and update the URL
|
|
18279
18279
|
// - if we don't have that, return an empty SortModel
|
|
18280
|
-
const getSortModel = (search, columns, localStorageSorting, setLocalStorageSorting) => {
|
|
18280
|
+
const getSortModel = (search, columns, localStorageSorting, setLocalStorageSorting, initialState) => {
|
|
18281
|
+
var _initialState$sorting;
|
|
18281
18282
|
const sorting = getSortingFromString(search, columns);
|
|
18282
|
-
if (sorting) {
|
|
18283
|
+
if (sorting !== 'invalid') {
|
|
18283
18284
|
const searchFromSortModel = getSearchParamsFromSorting(sorting);
|
|
18284
18285
|
const searchString = urlSearchParamsToString(searchFromSortModel);
|
|
18285
18286
|
if (searchString !== localStorageSorting) {
|
|
@@ -18288,30 +18289,22 @@ const getSortModel = (search, columns, localStorageSorting, setLocalStorageSorti
|
|
|
18288
18289
|
return sorting;
|
|
18289
18290
|
}
|
|
18290
18291
|
const sortModelFromLocalStorage = getSortingFromString(localStorageSorting, columns);
|
|
18291
|
-
if (sortModelFromLocalStorage) {
|
|
18292
|
+
if (sortModelFromLocalStorage !== 'invalid') {
|
|
18292
18293
|
return sortModelFromLocalStorage;
|
|
18293
18294
|
}
|
|
18294
|
-
return [];
|
|
18295
|
+
return initialState !== null && initialState !== void 0 && (_initialState$sorting = initialState.sorting) !== null && _initialState$sorting !== void 0 && _initialState$sorting.sortModel ? initialState.sorting.sortModel : [];
|
|
18295
18296
|
};
|
|
18296
18297
|
|
|
18297
18298
|
/** PAGINATION */
|
|
18298
18299
|
|
|
18299
18300
|
const getPaginationFromString = searchString => {
|
|
18300
18301
|
if (!searchString) {
|
|
18301
|
-
return
|
|
18302
|
-
page: 0,
|
|
18303
|
-
pageSize: 25,
|
|
18304
|
-
direction: 'next'
|
|
18305
|
-
};
|
|
18302
|
+
return 'invalid';
|
|
18306
18303
|
}
|
|
18307
18304
|
const searchParams = new URLSearchParams(searchString);
|
|
18308
18305
|
const value = searchParams.get('_pagination');
|
|
18309
18306
|
if (value === '' || value === null || value === '[]') {
|
|
18310
|
-
return
|
|
18311
|
-
page: 0,
|
|
18312
|
-
pageSize: 25,
|
|
18313
|
-
direction: 'next'
|
|
18314
|
-
};
|
|
18307
|
+
return 'invalid';
|
|
18315
18308
|
}
|
|
18316
18309
|
const pagination = value.slice(1, value.length - 1).split(',');
|
|
18317
18310
|
const page = parseFloat(pagination[0]);
|
|
@@ -18324,11 +18317,7 @@ const getPaginationFromString = searchString => {
|
|
|
18324
18317
|
direction: direction
|
|
18325
18318
|
};
|
|
18326
18319
|
}
|
|
18327
|
-
return
|
|
18328
|
-
page: 0,
|
|
18329
|
-
pageSize: 25,
|
|
18330
|
-
direction: 'next'
|
|
18331
|
-
};
|
|
18320
|
+
return 'invalid';
|
|
18332
18321
|
};
|
|
18333
18322
|
const getSearchParamsFromPagination = pagination => {
|
|
18334
18323
|
const searchParams = new URLSearchParams();
|
|
@@ -18340,9 +18329,9 @@ const getSearchParamsFromPagination = pagination => {
|
|
|
18340
18329
|
// - if we have something in the URL, use that info
|
|
18341
18330
|
// - if we don't have that, use the localStorage and update the URL
|
|
18342
18331
|
// - if we don't have that, return an empty PaginationModel
|
|
18343
|
-
const getPaginationModel = (search, localStoragePagination, setLocalStoragePagination) => {
|
|
18332
|
+
const getPaginationModel = (search, localStoragePagination, setLocalStoragePagination, initialState) => {
|
|
18344
18333
|
const pagination = getPaginationFromString(search);
|
|
18345
|
-
if (pagination) {
|
|
18334
|
+
if (pagination !== 'invalid') {
|
|
18346
18335
|
const searchFromPaginationModel = getSearchParamsFromPagination(pagination);
|
|
18347
18336
|
const searchString = urlSearchParamsToString(searchFromPaginationModel);
|
|
18348
18337
|
if (searchString !== localStoragePagination) {
|
|
@@ -18351,10 +18340,14 @@ const getPaginationModel = (search, localStoragePagination, setLocalStoragePagin
|
|
|
18351
18340
|
return pagination;
|
|
18352
18341
|
}
|
|
18353
18342
|
const paginationModelFromLocalStorage = getPaginationFromString(localStoragePagination);
|
|
18354
|
-
if (paginationModelFromLocalStorage) {
|
|
18343
|
+
if (paginationModelFromLocalStorage !== 'invalid') {
|
|
18355
18344
|
return paginationModelFromLocalStorage;
|
|
18356
18345
|
}
|
|
18357
|
-
return {
|
|
18346
|
+
return initialState !== null && initialState !== void 0 && initialState.pagination ? _objectSpread2({
|
|
18347
|
+
page: 0,
|
|
18348
|
+
pageSize: 25,
|
|
18349
|
+
direction: 'next'
|
|
18350
|
+
}, initialState.pagination) : {
|
|
18358
18351
|
page: 0,
|
|
18359
18352
|
pageSize: 25,
|
|
18360
18353
|
direction: 'next'
|
|
@@ -18396,7 +18389,7 @@ const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
|
|
|
18396
18389
|
};
|
|
18397
18390
|
const getColumnVisibilityFromString = (notParsed, tableColumns) => {
|
|
18398
18391
|
if (!notParsed || notParsed.length === 1 && notParsed[0] === '?') {
|
|
18399
|
-
return
|
|
18392
|
+
return 'invalid';
|
|
18400
18393
|
}
|
|
18401
18394
|
// remove the initial ? if present
|
|
18402
18395
|
const parsed = notParsed[0] === '?' ? notParsed.slice(1) : notParsed;
|
|
@@ -18433,7 +18426,7 @@ const getColumnVisibilityFromString = (notParsed, tableColumns) => {
|
|
|
18433
18426
|
}
|
|
18434
18427
|
}
|
|
18435
18428
|
if (visibleColumnsCount === 0 && !exist) {
|
|
18436
|
-
return
|
|
18429
|
+
return 'invalid';
|
|
18437
18430
|
}
|
|
18438
18431
|
return visibility;
|
|
18439
18432
|
};
|
|
@@ -18444,9 +18437,10 @@ const getColumnVisibilityFromString = (notParsed, tableColumns) => {
|
|
|
18444
18437
|
// - if we don't have that, return an empty ColumnVisibilityModel (which is all columns)
|
|
18445
18438
|
// NOTE: the `defaultHidden` is a custom field and not standard DataGrid
|
|
18446
18439
|
// The reason is the following bug: https://github.com/mui/mui-x/issues/8407
|
|
18447
|
-
const getColumnsVisibility = (search, columns, localStorageColumnsVisibility, setLocalStorageColumnsVisibility) => {
|
|
18440
|
+
const getColumnsVisibility = (search, columns, localStorageColumnsVisibility, setLocalStorageColumnsVisibility, initialState) => {
|
|
18441
|
+
var _initialState$columns;
|
|
18448
18442
|
const columnVisibility = getColumnVisibilityFromString(search, columns);
|
|
18449
|
-
if (columnVisibility) {
|
|
18443
|
+
if (columnVisibility !== 'invalid') {
|
|
18450
18444
|
const searchColumnVisibility = getSearchParamsFromColumnVisibility(columnVisibility, columns);
|
|
18451
18445
|
if (searchColumnVisibility.toString() !== localStorageColumnsVisibility) {
|
|
18452
18446
|
setLocalStorageColumnsVisibility(searchColumnVisibility.toString());
|
|
@@ -18454,9 +18448,12 @@ const getColumnsVisibility = (search, columns, localStorageColumnsVisibility, se
|
|
|
18454
18448
|
return columnVisibility;
|
|
18455
18449
|
}
|
|
18456
18450
|
const columnVisibilityFromLocalStorage = getColumnVisibilityFromString(localStorageColumnsVisibility, columns);
|
|
18457
|
-
if (columnVisibilityFromLocalStorage) {
|
|
18451
|
+
if (columnVisibilityFromLocalStorage !== 'invalid') {
|
|
18458
18452
|
return columnVisibilityFromLocalStorage;
|
|
18459
18453
|
}
|
|
18454
|
+
if (initialState !== null && initialState !== void 0 && (_initialState$columns = initialState.columns) !== null && _initialState$columns !== void 0 && _initialState$columns.columnVisibilityModel) {
|
|
18455
|
+
return initialState.columns.columnVisibilityModel;
|
|
18456
|
+
}
|
|
18460
18457
|
|
|
18461
18458
|
// No columns in URL or localStorage, just show them all expect the hidden ones
|
|
18462
18459
|
const res = {};
|
|
@@ -18469,7 +18466,7 @@ const getColumnsVisibility = (search, columns, localStorageColumnsVisibility, se
|
|
|
18469
18466
|
};
|
|
18470
18467
|
const getPinnedColumnsFromString = (notParsed, tableColumns) => {
|
|
18471
18468
|
if (!notParsed || notParsed.length === 1 && notParsed[0] === '?') {
|
|
18472
|
-
return
|
|
18469
|
+
return 'invalid';
|
|
18473
18470
|
}
|
|
18474
18471
|
// remove the initial ? if present
|
|
18475
18472
|
const parsed = notParsed[0] === '?' ? notParsed.slice(1) : notParsed;
|
|
@@ -18496,13 +18493,10 @@ const getPinnedColumnsFromString = (notParsed, tableColumns) => {
|
|
|
18496
18493
|
pinnedColumns['right'] = columns;
|
|
18497
18494
|
}
|
|
18498
18495
|
}
|
|
18499
|
-
|
|
18500
|
-
|
|
18501
|
-
|
|
18502
|
-
|
|
18503
|
-
};
|
|
18504
|
-
}
|
|
18505
|
-
return null;
|
|
18496
|
+
return pinnedColumns['left'] || pinnedColumns['right'] ? {
|
|
18497
|
+
left: pinnedColumns['left'] || [],
|
|
18498
|
+
right: pinnedColumns['right'] || []
|
|
18499
|
+
} : 'invalid';
|
|
18506
18500
|
};
|
|
18507
18501
|
const getSearchParamsFromPinnedColumns = pinnedColumns => {
|
|
18508
18502
|
var _pinnedColumns$left, _pinnedColumns$right;
|
|
@@ -18518,9 +18512,9 @@ const getSearchParamsFromPinnedColumns = pinnedColumns => {
|
|
|
18518
18512
|
// - if we have something in the URL, use that info
|
|
18519
18513
|
// - if we don't have that, use the localStorage and update the URL
|
|
18520
18514
|
// - if we don't have that, return an empty ColumnVisibilityModel (which is all columns)
|
|
18521
|
-
const getPinnedColumns = (search, columns, localStoragePinnedColumns, setLocalStoragePinnedColumns) => {
|
|
18515
|
+
const getPinnedColumns = (search, columns, localStoragePinnedColumns, setLocalStoragePinnedColumns, initialState) => {
|
|
18522
18516
|
const pinnedColumns = getPinnedColumnsFromString(search, columns);
|
|
18523
|
-
if (pinnedColumns) {
|
|
18517
|
+
if (pinnedColumns !== 'invalid') {
|
|
18524
18518
|
const searchPinnedColumns = getSearchParamsFromPinnedColumns(pinnedColumns);
|
|
18525
18519
|
if (searchPinnedColumns.toString() !== localStoragePinnedColumns) {
|
|
18526
18520
|
setLocalStoragePinnedColumns(searchPinnedColumns.toString());
|
|
@@ -18528,9 +18522,15 @@ const getPinnedColumns = (search, columns, localStoragePinnedColumns, setLocalSt
|
|
|
18528
18522
|
return pinnedColumns;
|
|
18529
18523
|
}
|
|
18530
18524
|
const pinnedColumnsFromLocalStorage = getPinnedColumnsFromString(localStoragePinnedColumns, columns);
|
|
18531
|
-
if (pinnedColumnsFromLocalStorage) {
|
|
18525
|
+
if (pinnedColumnsFromLocalStorage !== 'invalid') {
|
|
18532
18526
|
return pinnedColumnsFromLocalStorage;
|
|
18533
18527
|
}
|
|
18528
|
+
if (initialState !== null && initialState !== void 0 && initialState.pinnedColumns) {
|
|
18529
|
+
return {
|
|
18530
|
+
left: (initialState === null || initialState === void 0 ? void 0 : initialState.pinnedColumns['left']) || [],
|
|
18531
|
+
right: (initialState === null || initialState === void 0 ? void 0 : initialState.pinnedColumns['right']) || []
|
|
18532
|
+
};
|
|
18533
|
+
}
|
|
18534
18534
|
|
|
18535
18535
|
// No pinnedColumn in URL or localStorage, TODO: decide what is the default state
|
|
18536
18536
|
const res = {
|
|
@@ -18586,10 +18586,10 @@ const getModelsParsedOrUpdateLocalStorage = (search, columns, historyReplace, in
|
|
|
18586
18586
|
setLocalStoragePinnedColumns
|
|
18587
18587
|
} = localStorage;
|
|
18588
18588
|
const filterModel = getFilterModel(search, columns, localStorageFilters, setLocalStorageFilters, initialState);
|
|
18589
|
-
const sortModel = getSortModel(search, columns, localStorageSorting, setLocalStorageSorting);
|
|
18590
|
-
const paginationModel = getPaginationModel(search, localStoragePagination, setLocalStoragePagination);
|
|
18591
|
-
const columnVisibilityModel = getColumnsVisibility(search, columns, localStorageColumnsVisibility, setLocalStorageColumnsVisibility);
|
|
18592
|
-
const pinnedColumnsModel = getPinnedColumns(search, columns, localStoragePinnedColumns, setLocalStoragePinnedColumns);
|
|
18589
|
+
const sortModel = getSortModel(search, columns, localStorageSorting, setLocalStorageSorting, initialState);
|
|
18590
|
+
const paginationModel = getPaginationModel(search, localStoragePagination, setLocalStoragePagination, initialState);
|
|
18591
|
+
const columnVisibilityModel = getColumnsVisibility(search, columns, localStorageColumnsVisibility, setLocalStorageColumnsVisibility, initialState);
|
|
18592
|
+
const pinnedColumnsModel = getPinnedColumns(search, columns, localStoragePinnedColumns, setLocalStoragePinnedColumns, initialState);
|
|
18593
18593
|
const finalSearch = getFinalSearch({
|
|
18594
18594
|
search,
|
|
18595
18595
|
filterModel,
|
|
@@ -27520,13 +27520,13 @@ const useFetchState = (defaultValue, key) => {
|
|
|
27520
27520
|
return [parsedValue, updateValue];
|
|
27521
27521
|
};
|
|
27522
27522
|
|
|
27523
|
-
const useTableStates = (id, version
|
|
27523
|
+
const useTableStates = (id, version) => {
|
|
27524
27524
|
const [paginationModel, setPaginationModel] = useFetchState('', buildStorageKey({
|
|
27525
27525
|
id,
|
|
27526
27526
|
version,
|
|
27527
27527
|
category: PAGINATION_MODEL_KEY
|
|
27528
27528
|
}));
|
|
27529
|
-
const [sortModel, setSortModel] = useFetchState(
|
|
27529
|
+
const [sortModel, setSortModel] = useFetchState('', buildStorageKey({
|
|
27530
27530
|
id,
|
|
27531
27531
|
version,
|
|
27532
27532
|
category: SORT_MODEL_KEY
|
|
@@ -27541,7 +27541,7 @@ const useTableStates = (id, version, customDefaults) => {
|
|
|
27541
27541
|
version,
|
|
27542
27542
|
category: VISIBILITY_MODEL_KEY
|
|
27543
27543
|
}));
|
|
27544
|
-
const [pinnedColumns, setPinnedColumns] = useFetchState(
|
|
27544
|
+
const [pinnedColumns, setPinnedColumns] = useFetchState('_pinnedColumnsLeft=[]&_pinnedColumnsRight=[]', buildStorageKey({
|
|
27545
27545
|
id,
|
|
27546
27546
|
version,
|
|
27547
27547
|
category: PINNED_COLUMNS
|
|
@@ -27580,10 +27580,6 @@ const useStatefulTable = props => {
|
|
|
27580
27580
|
onPageSizeChange: propsOnPageSizeChange,
|
|
27581
27581
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
27582
27582
|
onSortModelChange: propsOnSortModelChange,
|
|
27583
|
-
pinnedCustomColumns = {
|
|
27584
|
-
left: [],
|
|
27585
|
-
right: []
|
|
27586
|
-
},
|
|
27587
27583
|
useRouter,
|
|
27588
27584
|
localStorageVersion = 2
|
|
27589
27585
|
} = props;
|
|
@@ -27593,11 +27589,6 @@ const useStatefulTable = props => {
|
|
|
27593
27589
|
historyReplace
|
|
27594
27590
|
} = useRouter();
|
|
27595
27591
|
const id = pathname;
|
|
27596
|
-
const customDefaults = useMemo(() => {
|
|
27597
|
-
return {
|
|
27598
|
-
pinnedColumns: `_pinnedColumnsLeft=[${[GRID_CHECKBOX_SELECTION_COL_DEF.field, ...pinnedCustomColumns.left].join(',')}]&_pinnedColumnsRight=[${pinnedCustomColumns.right.join(',')}]`
|
|
27599
|
-
};
|
|
27600
|
-
}, [pinnedCustomColumns]);
|
|
27601
27592
|
|
|
27602
27593
|
// States and setters persisted in the local storage for this table
|
|
27603
27594
|
const {
|
|
@@ -27613,7 +27604,7 @@ const useStatefulTable = props => {
|
|
|
27613
27604
|
setPinnedColumns,
|
|
27614
27605
|
dimensionModel,
|
|
27615
27606
|
setDimensionModel
|
|
27616
|
-
} = useTableStates(id, localStorageVersion
|
|
27607
|
+
} = useTableStates(id, localStorageVersion);
|
|
27617
27608
|
|
|
27618
27609
|
// clearing up old version keys, triggering only on first render
|
|
27619
27610
|
useEffect(() => clearPreviousVersionStorage(id, localStorageVersion), [id, localStorageVersion]);
|
|
@@ -27748,7 +27739,7 @@ const useStatefulTable = props => {
|
|
|
27748
27739
|
};
|
|
27749
27740
|
};
|
|
27750
27741
|
|
|
27751
|
-
const _excluded$1 = ["apiRef", "autoHeight", "className", "columns", "columnTypes", "components", "componentsProps", "filterModel", "columnVisibilityModel", "pinnedColumns", "sortModel", "page", "pageSize", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "localStorageVersion", "onFilterModelChange", "selectionModel", "onColumnWidthChange", "onPageChange", "onPageSizeChange", "onSelectionModelChange", "onColumnVisibilityModelChange", "onPinnedColumnsChange", "onSortModelChange", "pagination", "paginationPlacement", "paginationProps", "
|
|
27742
|
+
const _excluded$1 = ["apiRef", "autoHeight", "className", "columns", "columnTypes", "components", "componentsProps", "filterModel", "columnVisibilityModel", "pinnedColumns", "sortModel", "page", "pageSize", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "localStorageVersion", "onFilterModelChange", "selectionModel", "onColumnWidthChange", "onPageChange", "onPageSizeChange", "onSelectionModelChange", "onColumnVisibilityModelChange", "onPinnedColumnsChange", "onSortModelChange", "pagination", "paginationPlacement", "paginationProps", "rows", "rowsPerPageOptions", "sx", "theme", "useRouter", "paginationMode", "rowCount"];
|
|
27752
27743
|
const COMPONENT_NAME$1 = 'DataGrid';
|
|
27753
27744
|
const CLASSNAME$1 = 'redsift-datagrid';
|
|
27754
27745
|
const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -27785,7 +27776,6 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27785
27776
|
pagination,
|
|
27786
27777
|
paginationPlacement = 'both',
|
|
27787
27778
|
paginationProps,
|
|
27788
|
-
pinnedCustomColumns,
|
|
27789
27779
|
rows,
|
|
27790
27780
|
rowsPerPageOptions,
|
|
27791
27781
|
sx,
|
|
@@ -27849,7 +27839,6 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27849
27839
|
onPageSizeChange: controlledOnPageSizeChange,
|
|
27850
27840
|
onPinnedColumnsChange: controlledOnPinnedColumnsChange,
|
|
27851
27841
|
onSortModelChange: controlledOnSortModelChange,
|
|
27852
|
-
pinnedCustomColumns,
|
|
27853
27842
|
useRouter: useRouter,
|
|
27854
27843
|
localStorageVersion
|
|
27855
27844
|
});
|