@redsift/table 12.5.4 → 12.5.5-alpha.2
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/_internal/StatefulDataGrid.js +1 -1
- package/_internal/StatefulDataGrid2.js +50 -11
- package/_internal/StatefulDataGrid2.js.map +1 -1
- package/index.d.ts +19 -1
- package/index.js +1 -1
- package/package.json +4 -4
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { aJ as StatefulDataGrid } from './StatefulDataGrid2.js';
|
|
2
2
|
//# sourceMappingURL=StatefulDataGrid.js.map
|
|
@@ -2289,6 +2289,29 @@ const getSearchParamsFromPivotActive = active => {
|
|
|
2289
2289
|
searchParams.set('_pivotActive', String(active));
|
|
2290
2290
|
return searchParams;
|
|
2291
2291
|
};
|
|
2292
|
+
|
|
2293
|
+
/**
|
|
2294
|
+
* Builds the `v=<version>` search param the grid uses to detect stale URLs.
|
|
2295
|
+
*
|
|
2296
|
+
* Use this when constructing a deep link or share URL outside the grid (e.g. via
|
|
2297
|
+
* `getSearchParamsFromFilterModel` + `buildQueryParamsString`). The grid itself
|
|
2298
|
+
* always includes `v` in URLs it writes via `getFinalSearch`, but external helpers
|
|
2299
|
+
* do not — include this when you want a stale `localStorageVersion` bump to invalidate
|
|
2300
|
+
* the link. Omitting `v` is also safe: a missing `v` is treated as "current version"
|
|
2301
|
+
* and the URL state is applied as-is.
|
|
2302
|
+
*
|
|
2303
|
+
* @example
|
|
2304
|
+
* const params = new URLSearchParams([
|
|
2305
|
+
* ...getSearchParamsFromFilterModel(filterModel),
|
|
2306
|
+
* ...getSearchParamsFromVersion(1),
|
|
2307
|
+
* ]);
|
|
2308
|
+
* const url = `/my-grid${buildQueryParamsString(urlSearchParamsToString(params))}`;
|
|
2309
|
+
*/
|
|
2310
|
+
const getSearchParamsFromVersion = version => {
|
|
2311
|
+
const searchParams = new URLSearchParams();
|
|
2312
|
+
searchParams.set('v', String(version));
|
|
2313
|
+
return searchParams;
|
|
2314
|
+
};
|
|
2292
2315
|
const getPivotActive = (search, localStoragePivotActive, setLocalStoragePivotActive, initialState, isNewVersion) => {
|
|
2293
2316
|
var _initialState$pivotin2, _initialState$pivotin3;
|
|
2294
2317
|
const defaultValue = (_initialState$pivotin2 = initialState === null || initialState === void 0 ? void 0 : (_initialState$pivotin3 = initialState.pivoting) === null || _initialState$pivotin3 === void 0 ? void 0 : _initialState$pivotin3.enabled) !== null && _initialState$pivotin2 !== void 0 ? _initialState$pivotin2 : false;
|
|
@@ -2374,11 +2397,21 @@ const getModelsParsedOrUpdateLocalStorage = (search, localStorageVersion, column
|
|
|
2374
2397
|
const decodedSearch = getDecodedSearchFromUrl(decompressedSearch, columns);
|
|
2375
2398
|
const decodedParams = new URLSearchParams(decodedSearch);
|
|
2376
2399
|
const currentVersion = decodedParams.get('v');
|
|
2377
|
-
// Only treat as "new version reset" when the URL
|
|
2378
|
-
//
|
|
2379
|
-
//
|
|
2400
|
+
// Only treat as "new version reset" when the URL carries params AND explicitly declares a
|
|
2401
|
+
// stale version (`v=` present but not matching `localStorageVersion`).
|
|
2402
|
+
//
|
|
2403
|
+
// Two cases that must NOT trigger a reset:
|
|
2404
|
+
// 1. Empty URL — fall through to the localStorage branch of each getter so persisted
|
|
2405
|
+
// preferences are restored instead of being clobbered by defaults.
|
|
2406
|
+
// 2. URL has params but no `v` — externally-constructed deep links / share links built
|
|
2407
|
+
// with `getSearchParamsFromFilterModel`, `buildQueryParamsString`, etc. do not include
|
|
2408
|
+
// `v` by default. Treating a missing `v` as "stale" silently discards the very state
|
|
2409
|
+
// the integrator just encoded into the URL (and wipes localStorage on the way out).
|
|
2410
|
+
// A missing `v` is interpreted as "current" so external URLs work out of the box.
|
|
2411
|
+
// URLs written by the grid itself (`getFinalSearch`) always include `v`, so a stale
|
|
2412
|
+
// bookmark from a previous `localStorageVersion` still resets correctly.
|
|
2380
2413
|
const hasUrlState = Array.from(decodedParams.keys()).length > 0;
|
|
2381
|
-
const isNewVersion = hasUrlState &&
|
|
2414
|
+
const isNewVersion = hasUrlState && currentVersion != null && Number(currentVersion) !== localStorageVersion;
|
|
2382
2415
|
const {
|
|
2383
2416
|
localStorageFilters,
|
|
2384
2417
|
setLocalStorageFilters,
|
|
@@ -3545,7 +3578,6 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3545
3578
|
onColumnWidthChange: onColumnWidthChange,
|
|
3546
3579
|
onRowGroupingModelChange: onRowGroupingModelChange,
|
|
3547
3580
|
onAggregationModelChange: onAggregationModelChange,
|
|
3548
|
-
pivotModel: pivotModel,
|
|
3549
3581
|
onPivotModelChange: onPivotModelChange,
|
|
3550
3582
|
pivotActive: pivotActive,
|
|
3551
3583
|
onPivotActiveChange: onPivotActiveChange
|
|
@@ -3553,11 +3585,16 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3553
3585
|
// onChange handlers are write-only for URL/localStorage persistence,
|
|
3554
3586
|
// and initialState seeds MUI on mount from the persisted URL state.
|
|
3555
3587
|
// columnVisibilityModel / pinnedColumns / rowGroupingModel /
|
|
3556
|
-
// aggregationModel are also uncontrolled here to
|
|
3557
|
-
// re-render race with consumer-side
|
|
3558
|
-
// updates (otherwise user toggles
|
|
3559
|
-
// the stale controlled value).
|
|
3560
|
-
//
|
|
3588
|
+
// aggregationModel / pivotModel are also uncontrolled here to
|
|
3589
|
+
// avoid a controlled re-render race with consumer-side
|
|
3590
|
+
// microtask-deferred history updates (otherwise user toggles
|
|
3591
|
+
// flip back when MUI re-emits with the stale controlled value).
|
|
3592
|
+
// pivotModel specifically also carries `hidden`/`sort` field
|
|
3593
|
+
// metadata that our simplified URL representation strips — so
|
|
3594
|
+
// controlling it would prevent users from unchecking fields in
|
|
3595
|
+
// the pivot panel (the controlled prop would immediately re-add
|
|
3596
|
+
// them). Consumers needing programmatic changes should use the
|
|
3597
|
+
// apiRef imperative API.
|
|
3561
3598
|
}, isDataSourceMode ? {
|
|
3562
3599
|
onFilterModelChange: onFilterModelChange,
|
|
3563
3600
|
onSortModelChange: onSortModelChange,
|
|
@@ -3585,6 +3622,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3585
3622
|
paginationModel
|
|
3586
3623
|
},
|
|
3587
3624
|
pivoting: _objectSpread2(_objectSpread2({}, initialState === null || initialState === void 0 ? void 0 : initialState.pivoting), {}, {
|
|
3625
|
+
model: pivotModel,
|
|
3588
3626
|
enabled: pivotActive
|
|
3589
3627
|
})
|
|
3590
3628
|
})
|
|
@@ -3596,6 +3634,7 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3596
3634
|
filterModel,
|
|
3597
3635
|
sortModel,
|
|
3598
3636
|
paginationModel,
|
|
3637
|
+
pivotModel,
|
|
3599
3638
|
onFilterModelChange: onFilterModelChange,
|
|
3600
3639
|
onSortModelChange: onSortModelChange,
|
|
3601
3640
|
onPaginationModelChange: wrappedOnPaginationModelChange,
|
|
@@ -3776,5 +3815,5 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3776
3815
|
StatefulDataGrid.className = CLASSNAME;
|
|
3777
3816
|
StatefulDataGrid.displayName = COMPONENT_NAME;
|
|
3778
3817
|
|
|
3779
|
-
export { buildStorageKey as $, ARRAY_IS_EMPTY as A, IS as B, CONTAINS_ANY_OF as C, DOES_NOT_CONTAIN as D, ENDS_WITH_ANY_OF as E, IS_NOT as F, getGridStringOperators as G, HAS_WITH_SELECT as H, IS_ANY_OF as I, getGridStringArrayOperators as J, getGridStringArrayOperatorsWithSelect as K, getGridStringArrayOperatorsWithSelectOnStringArrayColumns as L, FILTER_MODEL_KEY as M, SORT_MODEL_KEY as N, PINNED_COLUMNS as O, PAGINATION_MODEL_KEY as P, DIMENSION_MODEL_KEY as Q, FILTER_SEARCH_KEY as R, STARTS_WITH_ANY_OF as S, DENSITY_MODEL_KEY as T, COLUMN_ORDER_MODEL_KEY as U, VISIBILITY_MODEL_KEY as V, ROW_GROUPING_MODEL_KEY as W, AGGREGATION_MODEL_KEY as X, PIVOT_MODEL_KEY as Y, PIVOT_ACTIVE_KEY as Z, CATEGORIES as _, DOES_NOT_EQUAL as a, clearPreviousVersionStorage as a0, clearAllVersionStorage as a1, resetStatefulDataGridState as a2, convertToDisplayFormat as a3, convertFromDisplayFormat as a4, getDecodedSearchFromUrl as a5, buildQueryParamsString as a6, areSearchStringsEqual as a7, decodeValue as a8, encodeValue as a9, getPivotFromString as aA, getSearchParamsFromPivot as aB, getPivotActiveFromString as aC, getSearchParamsFromPivotActive as aD,
|
|
3818
|
+
export { buildStorageKey as $, ARRAY_IS_EMPTY as A, IS as B, CONTAINS_ANY_OF as C, DOES_NOT_CONTAIN as D, ENDS_WITH_ANY_OF as E, IS_NOT as F, getGridStringOperators as G, HAS_WITH_SELECT as H, IS_ANY_OF as I, getGridStringArrayOperators as J, getGridStringArrayOperatorsWithSelect as K, getGridStringArrayOperatorsWithSelectOnStringArrayColumns as L, FILTER_MODEL_KEY as M, SORT_MODEL_KEY as N, PINNED_COLUMNS as O, PAGINATION_MODEL_KEY as P, DIMENSION_MODEL_KEY as Q, FILTER_SEARCH_KEY as R, STARTS_WITH_ANY_OF as S, DENSITY_MODEL_KEY as T, COLUMN_ORDER_MODEL_KEY as U, VISIBILITY_MODEL_KEY as V, ROW_GROUPING_MODEL_KEY as W, AGGREGATION_MODEL_KEY as X, PIVOT_MODEL_KEY as Y, PIVOT_ACTIVE_KEY as Z, CATEGORIES as _, DOES_NOT_EQUAL as a, clearPreviousVersionStorage as a0, clearAllVersionStorage as a1, resetStatefulDataGridState as a2, convertToDisplayFormat as a3, convertFromDisplayFormat as a4, getDecodedSearchFromUrl as a5, buildQueryParamsString as a6, areSearchStringsEqual as a7, decodeValue as a8, encodeValue as a9, getPivotFromString as aA, getSearchParamsFromPivot as aB, getPivotActiveFromString as aC, getSearchParamsFromPivotActive as aD, getSearchParamsFromVersion as aE, getFinalSearch as aF, getModelsParsedOrUpdateLocalStorage as aG, updateUrl as aH, areFilterModelsEquivalent as aI, StatefulDataGrid as aJ, urlSearchParamsToString as aa, numberOperatorEncoder as ab, numberOperatorDecoder as ac, isOperatorValueValid as ad, isValueValid as ae, getFilterModelFromString as af, getSearchParamsFromFilterModel as ag, getSortingFromString as ah, getSearchParamsFromSorting as ai, getPaginationFromString as aj, getSearchParamsFromPagination as ak, getColumnVisibilityFromString as al, getSearchParamsFromColumnVisibility as am, getPinnedColumnsFromString as an, getSearchParamsFromPinnedColumns as ao, getSearchParamsFromTab as ap, getDensityFromString as aq, getSearchParamsFromDensity as ar, getDensityModel as as, getColumnOrderFromString as at, getSearchParamsFromColumnOrder as au, getRowGroupingFromString as av, getSearchParamsFromRowGrouping as aw, getAggregationFromString as ax, getSearchParamsFromAggregation as ay, fromGridPivotModel as az, DOES_NOT_START_WITH as b, DOES_NOT_END_WITH as c, IS_NOT_ANY_OF as d, DOES_NOT_CONTAIN_ANY_OF as e, DOES_NOT_START_WITH_ANY_OF as f, DOES_NOT_END_WITH_ANY_OF as g, IS_BETWEEN as h, IS_WITH_SELECT as i, IS_NOT_WITH_SELECT as j, IS_ANY_OF_WITH_SELECT as k, IS_NOT_ANY_OF_WITH_SELECT as l, ARRAY_IS_NOT_EMPTY as m, DOES_NOT_HAVE_WITH_SELECT as n, operatorList as o, HAS_ANY_OF_WITH_SELECT as p, HAS_ALL_OF_WITH_SELECT as q, DOES_NOT_HAVE_ANY_OF_WITH_SELECT as r, HAS_ONLY_WITH_SELECT as s, HAS as t, DOES_NOT_HAVE as u, HAS_ANY_OF as v, HAS_ALL_OF as w, DOES_NOT_HAVE_ANY_OF as x, HAS_ONLY as y, getGridNumericOperators as z };
|
|
3780
3819
|
//# sourceMappingURL=StatefulDataGrid2.js.map
|