@redsift/table 11.2.2 → 11.3.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/index.d.ts +7 -4
- package/index.js +115 -98
- package/index.js.map +1 -1
- package/package.json +4 -4
package/index.d.ts
CHANGED
|
@@ -115,7 +115,7 @@ declare const buildStorageKey: ({ id, version, category }: {
|
|
|
115
115
|
version: number;
|
|
116
116
|
category: Category;
|
|
117
117
|
}) => `${string}:${number}:paginationModel` | `${string}:${number}:filterModel` | `${string}:${number}:sortModel` | `${string}:${number}:visibilityModel` | `${string}:${number}:pinnedColumns` | `${string}:${number}:dimension` | `${string}:${number}:searchModel`;
|
|
118
|
-
declare const clearPreviousVersionStorage: (id: string,
|
|
118
|
+
declare const clearPreviousVersionStorage: (id: string, previousLocalStorageVersions: number[]) => void;
|
|
119
119
|
|
|
120
120
|
interface DataGridProps extends Partial<Pick<DataGridProProps, 'rows'>>, Omit<DataGridProProps, 'rows'> {
|
|
121
121
|
/** License key for MUI Datagrid Pro. */
|
|
@@ -157,6 +157,8 @@ interface StatefulDataGridProps extends DataGridProps {
|
|
|
157
157
|
};
|
|
158
158
|
/** Local Storage version, to upgrade when we want to force a clean out. */
|
|
159
159
|
localStorageVersion?: number;
|
|
160
|
+
/** Previous Local Storage versions to clean out when a new one is released. */
|
|
161
|
+
previousLocalStorageVersions?: number[];
|
|
160
162
|
}
|
|
161
163
|
|
|
162
164
|
declare const StatefulDataGrid: Comp<StatefulDataGridProps, HTMLDivElement>;
|
|
@@ -189,6 +191,7 @@ declare const getPinnedColumnsFromString: (notParsed: string, tableColumns: Data
|
|
|
189
191
|
declare const getSearchParamsFromPinnedColumns: (pinnedColumns: GridPinnedColumns) => URLSearchParams;
|
|
190
192
|
declare const getSearchParamsFromTab: (search: string) => URLSearchParams;
|
|
191
193
|
type FinalSearchInput = {
|
|
194
|
+
localStorageVersion: number;
|
|
192
195
|
filterModel: GridFilterModel;
|
|
193
196
|
sortModel: GridSortModel;
|
|
194
197
|
paginationModel: ExtendedGridPaginationModel;
|
|
@@ -197,7 +200,7 @@ type FinalSearchInput = {
|
|
|
197
200
|
search: string;
|
|
198
201
|
columns: DataGridProps['columns'];
|
|
199
202
|
};
|
|
200
|
-
declare const getFinalSearch: ({ search, filterModel, sortModel, paginationModel, columnsVisibilityModel, pinnedColumnsModel, columns, }: FinalSearchInput) => URLSearchParams;
|
|
203
|
+
declare const getFinalSearch: ({ search, localStorageVersion, filterModel, sortModel, paginationModel, columnsVisibilityModel, pinnedColumnsModel, columns, }: FinalSearchInput) => URLSearchParams;
|
|
201
204
|
type PinnedColumns = {
|
|
202
205
|
left: string[];
|
|
203
206
|
right: string[];
|
|
@@ -222,7 +225,7 @@ type ModelsTable = {
|
|
|
222
225
|
pinnedColumnsModel: PinnedColumns;
|
|
223
226
|
};
|
|
224
227
|
/** Return the state of the table given the URL and the local storage state */
|
|
225
|
-
declare const getModelsParsedOrUpdateLocalStorage: (search: string, columns: DataGridProps['columns'], historyReplace: (newSearch: string) => void, initialState: GridInitialStatePro | undefined, localStorage: ModelsLocalStorage) => ModelsTable;
|
|
228
|
+
declare const getModelsParsedOrUpdateLocalStorage: (search: string, localStorageVersion: number, columns: DataGridProps['columns'], historyReplace: (newSearch: string) => void, initialState: GridInitialStatePro | undefined, localStorage: ModelsLocalStorage) => ModelsTable;
|
|
226
229
|
type DataGridModel = {
|
|
227
230
|
filterModel: GridFilterModel;
|
|
228
231
|
sortModel: GridSortModel;
|
|
@@ -230,7 +233,7 @@ type DataGridModel = {
|
|
|
230
233
|
columnsModel: GridColumnVisibilityModel;
|
|
231
234
|
pinnedColumnsModel: GridPinnedColumns;
|
|
232
235
|
};
|
|
233
|
-
declare const updateUrl: ({ filterModel, sortModel, paginationModel, columnsModel: columnsVisibilityModel, pinnedColumnsModel }: DataGridModel, search: string, historyReplace: (newSearch: string) => void, columns: DataGridProps['columns']) => void;
|
|
236
|
+
declare const updateUrl: ({ filterModel, sortModel, paginationModel, columnsModel: columnsVisibilityModel, pinnedColumnsModel }: DataGridModel, search: string, localStorageVersion: number, historyReplace: (newSearch: string) => void, columns: DataGridProps['columns']) => void;
|
|
234
237
|
declare const areFilterModelsEquivalent: (filterModel: GridFilterModel, filterModelToMatch: GridFilterModel) => boolean;
|
|
235
238
|
|
|
236
239
|
declare const BaseButton: React.JSXElementConstructor<any>;
|
package/index.js
CHANGED
|
@@ -17939,45 +17939,43 @@ const buildStorageKey = _ref => {
|
|
|
17939
17939
|
} = _ref;
|
|
17940
17940
|
return `${id}:${version}:${category}`;
|
|
17941
17941
|
};
|
|
17942
|
-
const clearPreviousVersionStorage = (id,
|
|
17943
|
-
const
|
|
17944
|
-
|
|
17945
|
-
|
|
17946
|
-
|
|
17947
|
-
|
|
17948
|
-
|
|
17949
|
-
|
|
17950
|
-
|
|
17951
|
-
|
|
17952
|
-
|
|
17953
|
-
|
|
17954
|
-
|
|
17955
|
-
|
|
17956
|
-
|
|
17957
|
-
|
|
17958
|
-
|
|
17959
|
-
|
|
17960
|
-
|
|
17961
|
-
|
|
17962
|
-
|
|
17963
|
-
|
|
17964
|
-
|
|
17965
|
-
|
|
17966
|
-
|
|
17967
|
-
|
|
17968
|
-
|
|
17969
|
-
|
|
17970
|
-
|
|
17971
|
-
|
|
17972
|
-
|
|
17973
|
-
|
|
17974
|
-
|
|
17975
|
-
|
|
17976
|
-
|
|
17977
|
-
|
|
17978
|
-
|
|
17979
|
-
} catch (e) {
|
|
17980
|
-
// Ignore
|
|
17942
|
+
const clearPreviousVersionStorage = (id, previousLocalStorageVersions) => {
|
|
17943
|
+
for (const version of previousLocalStorageVersions) {
|
|
17944
|
+
const keysToDelete = [buildStorageKey({
|
|
17945
|
+
id,
|
|
17946
|
+
version,
|
|
17947
|
+
category: PAGINATION_MODEL_KEY
|
|
17948
|
+
}), buildStorageKey({
|
|
17949
|
+
id,
|
|
17950
|
+
version,
|
|
17951
|
+
category: SORT_MODEL_KEY
|
|
17952
|
+
}), buildStorageKey({
|
|
17953
|
+
id,
|
|
17954
|
+
version,
|
|
17955
|
+
category: FILTER_MODEL_KEY
|
|
17956
|
+
}), buildStorageKey({
|
|
17957
|
+
id,
|
|
17958
|
+
version,
|
|
17959
|
+
category: VISIBILITY_MODEL_KEY
|
|
17960
|
+
}), buildStorageKey({
|
|
17961
|
+
id,
|
|
17962
|
+
version,
|
|
17963
|
+
category: PINNED_COLUMNS
|
|
17964
|
+
}), buildStorageKey({
|
|
17965
|
+
id,
|
|
17966
|
+
version,
|
|
17967
|
+
category: FILTER_SEARCH_KEY
|
|
17968
|
+
}), buildStorageKey({
|
|
17969
|
+
id,
|
|
17970
|
+
version,
|
|
17971
|
+
category: DIMENSION_MODEL_KEY
|
|
17972
|
+
})];
|
|
17973
|
+
for (const keyToDelete of keysToDelete) {
|
|
17974
|
+
try {
|
|
17975
|
+
window.localStorage.removeItem(keyToDelete);
|
|
17976
|
+
} catch (e) {
|
|
17977
|
+
// Ignore
|
|
17978
|
+
}
|
|
17981
17979
|
}
|
|
17982
17980
|
}
|
|
17983
17981
|
};
|
|
@@ -18223,7 +18221,14 @@ const getSearchParamsFromFilterModel = filterModel => {
|
|
|
18223
18221
|
// - if we have something in the URL, use that info
|
|
18224
18222
|
// - if we don't have that, use the localStorage and update the URL
|
|
18225
18223
|
// - if we don't have that, return an empty FilterModel
|
|
18226
|
-
const getFilterModel = (search, columns, localStorageFilters, setLocalStorageFilters, initialState) => {
|
|
18224
|
+
const getFilterModel = (search, columns, localStorageFilters, setLocalStorageFilters, initialState, isNewVersion) => {
|
|
18225
|
+
const defaultValue = initialState && initialState.filter && initialState.filter.filterModel ? initialState.filter.filterModel : {
|
|
18226
|
+
items: [],
|
|
18227
|
+
logicOperator: GridLogicOperator.And
|
|
18228
|
+
};
|
|
18229
|
+
if (isNewVersion) {
|
|
18230
|
+
return defaultValue;
|
|
18231
|
+
}
|
|
18227
18232
|
const filterModelFromSearch = getFilterModelFromString(search, columns);
|
|
18228
18233
|
if (filterModelFromSearch !== 'invalid') {
|
|
18229
18234
|
const searchFromFilterModel = getSearchParamsFromFilterModel(filterModelFromSearch);
|
|
@@ -18237,10 +18242,7 @@ const getFilterModel = (search, columns, localStorageFilters, setLocalStorageFil
|
|
|
18237
18242
|
if (filterModelFromLocalStorage !== 'invalid') {
|
|
18238
18243
|
return filterModelFromLocalStorage;
|
|
18239
18244
|
}
|
|
18240
|
-
return
|
|
18241
|
-
items: [],
|
|
18242
|
-
logicOperator: GridLogicOperator.And
|
|
18243
|
-
};
|
|
18245
|
+
return defaultValue;
|
|
18244
18246
|
};
|
|
18245
18247
|
|
|
18246
18248
|
/** SORT */
|
|
@@ -18274,8 +18276,12 @@ const getSearchParamsFromSorting = sorting => {
|
|
|
18274
18276
|
// - if we have something in the URL, use that info
|
|
18275
18277
|
// - if we don't have that, use the localStorage and update the URL
|
|
18276
18278
|
// - if we don't have that, return an empty SortModel
|
|
18277
|
-
const getSortModel = (search, columns, localStorageSorting, setLocalStorageSorting, initialState) => {
|
|
18279
|
+
const getSortModel = (search, columns, localStorageSorting, setLocalStorageSorting, initialState, isNewVersion) => {
|
|
18278
18280
|
var _initialState$sorting;
|
|
18281
|
+
const defaultValue = initialState !== null && initialState !== void 0 && (_initialState$sorting = initialState.sorting) !== null && _initialState$sorting !== void 0 && _initialState$sorting.sortModel ? initialState.sorting.sortModel : [];
|
|
18282
|
+
if (isNewVersion) {
|
|
18283
|
+
return defaultValue;
|
|
18284
|
+
}
|
|
18279
18285
|
const sorting = getSortingFromString(search, columns);
|
|
18280
18286
|
if (sorting !== 'invalid') {
|
|
18281
18287
|
const searchFromSortModel = getSearchParamsFromSorting(sorting);
|
|
@@ -18289,7 +18295,7 @@ const getSortModel = (search, columns, localStorageSorting, setLocalStorageSorti
|
|
|
18289
18295
|
if (sortModelFromLocalStorage !== 'invalid') {
|
|
18290
18296
|
return sortModelFromLocalStorage;
|
|
18291
18297
|
}
|
|
18292
|
-
return
|
|
18298
|
+
return defaultValue;
|
|
18293
18299
|
};
|
|
18294
18300
|
|
|
18295
18301
|
/** PAGINATION */
|
|
@@ -18326,8 +18332,19 @@ const getSearchParamsFromPagination = pagination => {
|
|
|
18326
18332
|
// - if we have something in the URL, use that info
|
|
18327
18333
|
// - if we don't have that, use the localStorage and update the URL
|
|
18328
18334
|
// - if we don't have that, return an empty PaginationModel
|
|
18329
|
-
const getPaginationModel = (search, localStoragePagination, setLocalStoragePagination, initialState) => {
|
|
18330
|
-
|
|
18335
|
+
const getPaginationModel = (search, localStoragePagination, setLocalStoragePagination, initialState, isNewVersion) => {
|
|
18336
|
+
const defaultValue = initialState !== null && initialState !== void 0 && initialState.pagination ? _objectSpread2({
|
|
18337
|
+
page: 0,
|
|
18338
|
+
pageSize: 25,
|
|
18339
|
+
direction: 'next'
|
|
18340
|
+
}, initialState.pagination) : {
|
|
18341
|
+
page: 0,
|
|
18342
|
+
pageSize: 25,
|
|
18343
|
+
direction: 'next'
|
|
18344
|
+
};
|
|
18345
|
+
if (isNewVersion) {
|
|
18346
|
+
return defaultValue;
|
|
18347
|
+
}
|
|
18331
18348
|
const pagination = getPaginationFromString(search);
|
|
18332
18349
|
if (pagination !== 'invalid') {
|
|
18333
18350
|
const searchFromPaginationModel = getSearchParamsFromPagination(pagination);
|
|
@@ -18341,15 +18358,7 @@ const getPaginationModel = (search, localStoragePagination, setLocalStoragePagin
|
|
|
18341
18358
|
if (paginationModelFromLocalStorage !== 'invalid') {
|
|
18342
18359
|
return paginationModelFromLocalStorage;
|
|
18343
18360
|
}
|
|
18344
|
-
return
|
|
18345
|
-
page: 0,
|
|
18346
|
-
pageSize: 25,
|
|
18347
|
-
direction: 'next'
|
|
18348
|
-
}, initialState.pagination.paginationModel) : {
|
|
18349
|
-
page: 0,
|
|
18350
|
-
pageSize: 25,
|
|
18351
|
-
direction: 'next'
|
|
18352
|
-
};
|
|
18361
|
+
return defaultValue;
|
|
18353
18362
|
};
|
|
18354
18363
|
|
|
18355
18364
|
/** COLUMN VISIBILITY */
|
|
@@ -18407,8 +18416,17 @@ const getSearchParamsFromColumnVisibility = (columnVisibility, columns) => {
|
|
|
18407
18416
|
// - if we don't have that, return an empty ColumnVisibilityModel (which is all columns)
|
|
18408
18417
|
// NOTE: the `defaultHidden` is a custom field and not standard DataGrid
|
|
18409
18418
|
// The reason is the following bug: https://github.com/mui/mui-x/issues/8407
|
|
18410
|
-
const getColumnsVisibility = (search, columns, localStorageColumnsVisibility, setLocalStorageColumnsVisibility, initialState) => {
|
|
18419
|
+
const getColumnsVisibility = (search, columns, localStorageColumnsVisibility, setLocalStorageColumnsVisibility, initialState, isNewVersion) => {
|
|
18411
18420
|
var _initialState$columns;
|
|
18421
|
+
const defaultValue = {};
|
|
18422
|
+
for (const column of columns) {
|
|
18423
|
+
const field = column.field;
|
|
18424
|
+
defaultValue[field] = column.defaultHidden !== true; // undefined will be true
|
|
18425
|
+
}
|
|
18426
|
+
|
|
18427
|
+
if (isNewVersion) {
|
|
18428
|
+
return defaultValue;
|
|
18429
|
+
}
|
|
18412
18430
|
const columnVisibility = getColumnVisibilityFromString(search, columns);
|
|
18413
18431
|
if (columnVisibility !== 'invalid') {
|
|
18414
18432
|
const searchColumnVisibility = getSearchParamsFromColumnVisibility(columnVisibility, columns);
|
|
@@ -18424,15 +18442,7 @@ const getColumnsVisibility = (search, columns, localStorageColumnsVisibility, se
|
|
|
18424
18442
|
if (initialState !== null && initialState !== void 0 && (_initialState$columns = initialState.columns) !== null && _initialState$columns !== void 0 && _initialState$columns.columnVisibilityModel) {
|
|
18425
18443
|
return initialState.columns.columnVisibilityModel;
|
|
18426
18444
|
}
|
|
18427
|
-
|
|
18428
|
-
// No columns in URL or localStorage, just show them all expect the hidden ones
|
|
18429
|
-
const res = {};
|
|
18430
|
-
for (const column of columns) {
|
|
18431
|
-
const field = column.field;
|
|
18432
|
-
res[field] = column.defaultHidden !== true; // undefined will be true
|
|
18433
|
-
}
|
|
18434
|
-
|
|
18435
|
-
return res;
|
|
18445
|
+
return defaultValue;
|
|
18436
18446
|
};
|
|
18437
18447
|
const getPinnedColumnsFromString = (notParsed, tableColumns) => {
|
|
18438
18448
|
if (!notParsed || notParsed.length === 1 && notParsed[0] === '?') {
|
|
@@ -18482,7 +18492,17 @@ const getSearchParamsFromPinnedColumns = pinnedColumns => {
|
|
|
18482
18492
|
// - if we have something in the URL, use that info
|
|
18483
18493
|
// - if we don't have that, use the localStorage and update the URL
|
|
18484
18494
|
// - if we don't have that, return an empty ColumnVisibilityModel (which is all columns)
|
|
18485
|
-
const getPinnedColumns = (search, columns, localStoragePinnedColumns, setLocalStoragePinnedColumns, initialState) => {
|
|
18495
|
+
const getPinnedColumns = (search, columns, localStoragePinnedColumns, setLocalStoragePinnedColumns, initialState, isNewVersion) => {
|
|
18496
|
+
const defaultValue = initialState !== null && initialState !== void 0 && initialState.pinnedColumns ? {
|
|
18497
|
+
left: (initialState === null || initialState === void 0 ? void 0 : initialState.pinnedColumns['left']) || [],
|
|
18498
|
+
right: (initialState === null || initialState === void 0 ? void 0 : initialState.pinnedColumns['right']) || []
|
|
18499
|
+
} : {
|
|
18500
|
+
left: [],
|
|
18501
|
+
right: []
|
|
18502
|
+
};
|
|
18503
|
+
if (isNewVersion) {
|
|
18504
|
+
return defaultValue;
|
|
18505
|
+
}
|
|
18486
18506
|
const pinnedColumns = getPinnedColumnsFromString(search, columns);
|
|
18487
18507
|
if (pinnedColumns !== 'invalid') {
|
|
18488
18508
|
const searchPinnedColumns = getSearchParamsFromPinnedColumns(pinnedColumns);
|
|
@@ -18495,19 +18515,7 @@ const getPinnedColumns = (search, columns, localStoragePinnedColumns, setLocalSt
|
|
|
18495
18515
|
if (pinnedColumnsFromLocalStorage !== 'invalid') {
|
|
18496
18516
|
return pinnedColumnsFromLocalStorage;
|
|
18497
18517
|
}
|
|
18498
|
-
|
|
18499
|
-
return {
|
|
18500
|
-
left: (initialState === null || initialState === void 0 ? void 0 : initialState.pinnedColumns['left']) || [],
|
|
18501
|
-
right: (initialState === null || initialState === void 0 ? void 0 : initialState.pinnedColumns['right']) || []
|
|
18502
|
-
};
|
|
18503
|
-
}
|
|
18504
|
-
|
|
18505
|
-
// No pinnedColumn in URL or localStorage, TODO: decide what is the default state
|
|
18506
|
-
const res = {
|
|
18507
|
-
left: [],
|
|
18508
|
-
right: []
|
|
18509
|
-
};
|
|
18510
|
-
return res;
|
|
18518
|
+
return defaultValue;
|
|
18511
18519
|
};
|
|
18512
18520
|
const getSearchParamsFromTab = search => {
|
|
18513
18521
|
const searchParams = new URLSearchParams();
|
|
@@ -18520,6 +18528,7 @@ const getSearchParamsFromTab = search => {
|
|
|
18520
18528
|
const getFinalSearch = _ref => {
|
|
18521
18529
|
let {
|
|
18522
18530
|
search,
|
|
18531
|
+
localStorageVersion,
|
|
18523
18532
|
filterModel,
|
|
18524
18533
|
sortModel,
|
|
18525
18534
|
paginationModel,
|
|
@@ -18539,10 +18548,13 @@ const getFinalSearch = _ref => {
|
|
|
18539
18548
|
searchParams.set(key, value);
|
|
18540
18549
|
}
|
|
18541
18550
|
}
|
|
18551
|
+
searchParams.set('v', `${localStorageVersion}`);
|
|
18542
18552
|
return new URLSearchParams([...searchParams, ...filterModelSearch, ...sortModelSearch, ...paginationModelSearch, ...tabSearch, ...pinnedColumnsModelSearch, ...columnVisibilityModelSearch]);
|
|
18543
18553
|
};
|
|
18544
18554
|
/** Return the state of the table given the URL and the local storage state */
|
|
18545
|
-
const getModelsParsedOrUpdateLocalStorage = (search, columns, historyReplace, initialState, localStorage) => {
|
|
18555
|
+
const getModelsParsedOrUpdateLocalStorage = (search, localStorageVersion, columns, historyReplace, initialState, localStorage) => {
|
|
18556
|
+
const currentVersion = new URLSearchParams(search).get('v');
|
|
18557
|
+
const isNewVersion = !currentVersion || Number(currentVersion) !== localStorageVersion;
|
|
18546
18558
|
const {
|
|
18547
18559
|
localStorageFilters,
|
|
18548
18560
|
setLocalStorageFilters,
|
|
@@ -18555,12 +18567,13 @@ const getModelsParsedOrUpdateLocalStorage = (search, columns, historyReplace, in
|
|
|
18555
18567
|
localStoragePinnedColumns,
|
|
18556
18568
|
setLocalStoragePinnedColumns
|
|
18557
18569
|
} = localStorage;
|
|
18558
|
-
const filterModel = getFilterModel(search, columns, localStorageFilters, setLocalStorageFilters, initialState);
|
|
18559
|
-
const sortModel = getSortModel(search, columns, localStorageSorting, setLocalStorageSorting, initialState);
|
|
18560
|
-
const paginationModel = getPaginationModel(search, localStoragePagination, setLocalStoragePagination, initialState);
|
|
18561
|
-
const columnVisibilityModel = getColumnsVisibility(search, columns, localStorageColumnsVisibility, setLocalStorageColumnsVisibility, initialState);
|
|
18562
|
-
const pinnedColumnsModel = getPinnedColumns(search, columns, localStoragePinnedColumns, setLocalStoragePinnedColumns, initialState);
|
|
18570
|
+
const filterModel = getFilterModel(search, columns, localStorageFilters, setLocalStorageFilters, initialState, isNewVersion);
|
|
18571
|
+
const sortModel = getSortModel(search, columns, localStorageSorting, setLocalStorageSorting, initialState, isNewVersion);
|
|
18572
|
+
const paginationModel = getPaginationModel(search, localStoragePagination, setLocalStoragePagination, initialState, isNewVersion);
|
|
18573
|
+
const columnVisibilityModel = getColumnsVisibility(search, columns, localStorageColumnsVisibility, setLocalStorageColumnsVisibility, initialState, isNewVersion);
|
|
18574
|
+
const pinnedColumnsModel = getPinnedColumns(search, columns, localStoragePinnedColumns, setLocalStoragePinnedColumns, initialState, isNewVersion);
|
|
18563
18575
|
const finalSearch = getFinalSearch({
|
|
18576
|
+
localStorageVersion,
|
|
18564
18577
|
search,
|
|
18565
18578
|
filterModel,
|
|
18566
18579
|
sortModel,
|
|
@@ -18581,7 +18594,7 @@ const getModelsParsedOrUpdateLocalStorage = (search, columns, historyReplace, in
|
|
|
18581
18594
|
pinnedColumnsModel
|
|
18582
18595
|
};
|
|
18583
18596
|
};
|
|
18584
|
-
const updateUrl = (_ref2, search, historyReplace, columns) => {
|
|
18597
|
+
const updateUrl = (_ref2, search, localStorageVersion, historyReplace, columns) => {
|
|
18585
18598
|
let {
|
|
18586
18599
|
filterModel,
|
|
18587
18600
|
sortModel,
|
|
@@ -18591,6 +18604,7 @@ const updateUrl = (_ref2, search, historyReplace, columns) => {
|
|
|
18591
18604
|
} = _ref2;
|
|
18592
18605
|
const newSearch = getFinalSearch({
|
|
18593
18606
|
search,
|
|
18607
|
+
localStorageVersion,
|
|
18594
18608
|
filterModel,
|
|
18595
18609
|
sortModel,
|
|
18596
18610
|
paginationModel,
|
|
@@ -27512,7 +27526,8 @@ const useStatefulTable = props => {
|
|
|
27512
27526
|
onPinnedColumnsChange: propsOnPinnedColumnsChange,
|
|
27513
27527
|
onSortModelChange: propsOnSortModelChange,
|
|
27514
27528
|
useRouter,
|
|
27515
|
-
localStorageVersion =
|
|
27529
|
+
localStorageVersion = 1,
|
|
27530
|
+
previousLocalStorageVersions = []
|
|
27516
27531
|
} = props;
|
|
27517
27532
|
const {
|
|
27518
27533
|
search,
|
|
@@ -27538,7 +27553,7 @@ const useStatefulTable = props => {
|
|
|
27538
27553
|
} = useTableStates(id, localStorageVersion);
|
|
27539
27554
|
|
|
27540
27555
|
// clearing up old version keys, triggering only on first render
|
|
27541
|
-
useEffect(() => clearPreviousVersionStorage(id,
|
|
27556
|
+
useEffect(() => clearPreviousVersionStorage(id, previousLocalStorageVersions), [id, previousLocalStorageVersions]);
|
|
27542
27557
|
const onColumnDimensionChange = useCallback(_ref => {
|
|
27543
27558
|
let {
|
|
27544
27559
|
newWidth,
|
|
@@ -27554,7 +27569,7 @@ const useStatefulTable = props => {
|
|
|
27554
27569
|
paginationModel: paginationModelParsed,
|
|
27555
27570
|
columnVisibilityModel: visibilityModel,
|
|
27556
27571
|
pinnedColumnsModel
|
|
27557
|
-
} = getModelsParsedOrUpdateLocalStorage(search || '', propsColumns, historyReplace, initialState, {
|
|
27572
|
+
} = getModelsParsedOrUpdateLocalStorage(search || '', localStorageVersion, propsColumns, historyReplace, initialState, {
|
|
27558
27573
|
localStorageFilters,
|
|
27559
27574
|
setLocalStorageFilters,
|
|
27560
27575
|
localStorageSorting: sortModel,
|
|
@@ -27592,7 +27607,7 @@ const useStatefulTable = props => {
|
|
|
27592
27607
|
paginationModel: paginationModelParsed,
|
|
27593
27608
|
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
27594
27609
|
pinnedColumnsModel: pinnedColumnsModel
|
|
27595
|
-
}, search, historyReplace, columns);
|
|
27610
|
+
}, search, localStorageVersion, historyReplace, columns);
|
|
27596
27611
|
},
|
|
27597
27612
|
filterModel: filterParsed,
|
|
27598
27613
|
onSortModelChange: (model, details) => {
|
|
@@ -27603,7 +27618,7 @@ const useStatefulTable = props => {
|
|
|
27603
27618
|
paginationModel: paginationModelParsed,
|
|
27604
27619
|
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
27605
27620
|
pinnedColumnsModel: pinnedColumnsModel
|
|
27606
|
-
}, search, historyReplace, columns);
|
|
27621
|
+
}, search, localStorageVersion, historyReplace, columns);
|
|
27607
27622
|
},
|
|
27608
27623
|
sortModel: sortModelParsed,
|
|
27609
27624
|
onPinnedColumnsChange: (pinnedColumns, details) => {
|
|
@@ -27614,7 +27629,7 @@ const useStatefulTable = props => {
|
|
|
27614
27629
|
paginationModel: paginationModelParsed,
|
|
27615
27630
|
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
27616
27631
|
pinnedColumnsModel: pinnedColumns
|
|
27617
|
-
}, search, historyReplace, columns);
|
|
27632
|
+
}, search, localStorageVersion, historyReplace, columns);
|
|
27618
27633
|
},
|
|
27619
27634
|
pinnedColumns: pinnedColumnsModel,
|
|
27620
27635
|
paginationModel: paginationModelParsed,
|
|
@@ -27629,7 +27644,7 @@ const useStatefulTable = props => {
|
|
|
27629
27644
|
paginationModel: paginationModel,
|
|
27630
27645
|
columnsModel: apiRef.current.state.columns.columnVisibilityModel,
|
|
27631
27646
|
pinnedColumnsModel: pinnedColumnsModel
|
|
27632
|
-
}, search, historyReplace, columns);
|
|
27647
|
+
}, search, localStorageVersion, historyReplace, columns);
|
|
27633
27648
|
},
|
|
27634
27649
|
columnVisibilityModel: visibilityModel,
|
|
27635
27650
|
onColumnVisibilityModelChange: (columnsVisibilityModel, details) => {
|
|
@@ -27640,7 +27655,7 @@ const useStatefulTable = props => {
|
|
|
27640
27655
|
paginationModel: paginationModelParsed,
|
|
27641
27656
|
columnsModel: columnsVisibilityModel,
|
|
27642
27657
|
pinnedColumnsModel: pinnedColumnsModel
|
|
27643
|
-
}, search, historyReplace, columns);
|
|
27658
|
+
}, search, localStorageVersion, historyReplace, columns);
|
|
27644
27659
|
},
|
|
27645
27660
|
onColumnWidthChange: (params, event, details) => {
|
|
27646
27661
|
propsOnColumnWidthChange === null || propsOnColumnWidthChange === void 0 ? void 0 : propsOnColumnWidthChange(params, event, details);
|
|
@@ -27652,7 +27667,7 @@ const useStatefulTable = props => {
|
|
|
27652
27667
|
};
|
|
27653
27668
|
};
|
|
27654
27669
|
|
|
27655
|
-
const _excluded$1 = ["apiRef", "autoHeight", "className", "columns", "slots", "slotProps", "filterModel", "columnVisibilityModel", "pinnedColumns", "sortModel", "paginationModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "localStorageVersion", "onFilterModelChange", "rowSelectionModel", "onColumnWidthChange", "onPaginationModelChange", "onRowSelectionModelChange", "onColumnVisibilityModelChange", "onPinnedColumnsChange", "onSortModelChange", "pagination", "paginationPlacement", "paginationProps", "rows", "pageSizeOptions", "sx", "theme", "useRouter", "paginationMode", "rowCount"];
|
|
27670
|
+
const _excluded$1 = ["apiRef", "autoHeight", "className", "columns", "slots", "slotProps", "filterModel", "columnVisibilityModel", "pinnedColumns", "sortModel", "paginationModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "localStorageVersion", "previousLocalStorageVersions", "onFilterModelChange", "rowSelectionModel", "onColumnWidthChange", "onPaginationModelChange", "onRowSelectionModelChange", "onColumnVisibilityModelChange", "onPinnedColumnsChange", "onSortModelChange", "pagination", "paginationPlacement", "paginationProps", "rows", "pageSizeOptions", "sx", "theme", "useRouter", "paginationMode", "rowCount"];
|
|
27656
27671
|
const COMPONENT_NAME$1 = 'DataGrid';
|
|
27657
27672
|
const CLASSNAME$1 = 'redsift-datagrid';
|
|
27658
27673
|
const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
@@ -27675,6 +27690,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27675
27690
|
isRowSelectable,
|
|
27676
27691
|
license = process.env.MUI_LICENSE_KEY,
|
|
27677
27692
|
localStorageVersion,
|
|
27693
|
+
previousLocalStorageVersions,
|
|
27678
27694
|
onFilterModelChange: propsOnFilterModelChange,
|
|
27679
27695
|
rowSelectionModel: propsRowSelectionModel,
|
|
27680
27696
|
onColumnWidthChange: propsOnColumnWidthChange,
|
|
@@ -27744,7 +27760,8 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
27744
27760
|
onPinnedColumnsChange: controlledOnPinnedColumnsChange,
|
|
27745
27761
|
onSortModelChange: controlledOnSortModelChange,
|
|
27746
27762
|
useRouter: useRouter,
|
|
27747
|
-
localStorageVersion
|
|
27763
|
+
localStorageVersion,
|
|
27764
|
+
previousLocalStorageVersions
|
|
27748
27765
|
});
|
|
27749
27766
|
const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
|
|
27750
27767
|
useEffect(() => {
|