@redsift/table 12.5.6-muiv8-alpha.6 → 12.5.6
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 +60 -14
- package/_internal/StatefulDataGrid2.js.map +1 -1
- package/index.d.ts +20 -1
- package/index.js +1 -1
- package/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { aL as StatefulDataGrid } from './StatefulDataGrid2.js';
|
|
2
2
|
//# sourceMappingURL=StatefulDataGrid.js.map
|
|
@@ -1534,8 +1534,9 @@ const isValueValid = (value, field, columns, operator) => {
|
|
|
1534
1534
|
}
|
|
1535
1535
|
const type = (_column$type = column['type']) !== null && _column$type !== void 0 ? _column$type : 'string';
|
|
1536
1536
|
|
|
1537
|
-
// Only date and rating
|
|
1538
|
-
|
|
1537
|
+
// Only date, dateTime and rating need value validation; other types either
|
|
1538
|
+
// accept any string or reset themselves to undefined.
|
|
1539
|
+
if (type !== 'date' && type !== 'dateTime' && type !== 'rating') {
|
|
1539
1540
|
return true;
|
|
1540
1541
|
}
|
|
1541
1542
|
|
|
@@ -1544,16 +1545,18 @@ const isValueValid = (value, field, columns, operator) => {
|
|
|
1544
1545
|
return !isNaN(Number(value));
|
|
1545
1546
|
}
|
|
1546
1547
|
|
|
1547
|
-
// format: YYYY-MM-DD
|
|
1548
|
-
//
|
|
1549
|
-
//
|
|
1548
|
+
// format: YYYY-MM-DD — strict, so corrupt/locale/ISO strings (e.g. a
|
|
1549
|
+
// stringified Date, or an ISO value with a `T` suffix) are rejected rather
|
|
1550
|
+
// than reaching a server consumer. Canonical values come from
|
|
1551
|
+
// `normalizeDateValue`.
|
|
1550
1552
|
if (type === 'date') {
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1553
|
+
return /^\d{4}-\d{2}-\d{2}$/.test(value);
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
// format: YYYY-MM-DDTHH:mm:ss — local wall-clock, matching the datetime-local
|
|
1557
|
+
// input (see `normalizeDateValue`).
|
|
1558
|
+
if (type === 'dateTime') {
|
|
1559
|
+
return /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/.test(value);
|
|
1557
1560
|
}
|
|
1558
1561
|
return false;
|
|
1559
1562
|
};
|
|
@@ -1654,6 +1657,48 @@ const getFilterModelFromString = (searchString, columns) => {
|
|
|
1654
1657
|
quickFilterValues
|
|
1655
1658
|
};
|
|
1656
1659
|
};
|
|
1660
|
+
|
|
1661
|
+
/**
|
|
1662
|
+
* Normalises a `date` / `dateTime` filter value to a canonical, URL-safe string
|
|
1663
|
+
* before it is serialised into the URL.
|
|
1664
|
+
*
|
|
1665
|
+
* MUI's `GridFilterInputDate` commits filter values as JS `Date` objects. The
|
|
1666
|
+
* generic `encodeValue` would stringify those via `String(value)`, producing a
|
|
1667
|
+
* locale string (e.g. `"Thu Jun 25 2026 02:00:00 GMT+0200 (…)"`) that cannot
|
|
1668
|
+
* survive the URL round-trip and is rejected by `isValueValid`, silently erasing
|
|
1669
|
+
* the filter value (DS-90). We instead mirror MUI's own
|
|
1670
|
+
* `convertFilterItemValueToInputValue` so the canonical string matches what the
|
|
1671
|
+
* date input renders and round-trips losslessly:
|
|
1672
|
+
* - `date` → `YYYY-MM-DD` (UTC, timezone-stable)
|
|
1673
|
+
* - `dateTime` → `YYYY-MM-DDTHH:mm:ss` (local wall-clock, matching the
|
|
1674
|
+
* datetime-local input)
|
|
1675
|
+
* Non-date types, empty values, arrays of dates (e.g. `isBetween`) and
|
|
1676
|
+
* unparseable values are handled so the existing string / number / list / rating
|
|
1677
|
+
* paths are untouched and invalid values still fall through to `isValueValid`.
|
|
1678
|
+
*/
|
|
1679
|
+
const normalizeDateValue = (value, type) => {
|
|
1680
|
+
if (type !== 'date' && type !== 'dateTime') {
|
|
1681
|
+
return value;
|
|
1682
|
+
}
|
|
1683
|
+
if (value === undefined || value === null || value === '') {
|
|
1684
|
+
return value;
|
|
1685
|
+
}
|
|
1686
|
+
if (Array.isArray(value)) {
|
|
1687
|
+
return value.map(entry => normalizeDateValue(entry, type));
|
|
1688
|
+
}
|
|
1689
|
+
const date = value instanceof Date ? value : new Date(value);
|
|
1690
|
+
if (isNaN(date.getTime())) {
|
|
1691
|
+
return value;
|
|
1692
|
+
}
|
|
1693
|
+
if (type === 'date') {
|
|
1694
|
+
return date.toISOString().substring(0, 10);
|
|
1695
|
+
}
|
|
1696
|
+
// dateTime: mirror MUI's datetime-local conversion (subtract the timezone
|
|
1697
|
+
// offset so the serialised wall-clock time matches the rendered input value).
|
|
1698
|
+
const local = new Date(date.getTime());
|
|
1699
|
+
local.setMinutes(local.getMinutes() - local.getTimezoneOffset());
|
|
1700
|
+
return local.toISOString().substring(0, 19);
|
|
1701
|
+
};
|
|
1657
1702
|
const getSearchParamsFromFilterModel = filterModel => {
|
|
1658
1703
|
var _filterModel$quickFil;
|
|
1659
1704
|
const searchParams = new URLSearchParams();
|
|
@@ -1665,10 +1710,11 @@ const getSearchParamsFromFilterModel = filterModel => {
|
|
|
1665
1710
|
value,
|
|
1666
1711
|
type
|
|
1667
1712
|
} = item;
|
|
1713
|
+
const normalizedValue = normalizeDateValue(value, type);
|
|
1668
1714
|
if (Object.keys(numberOperatorEncoder).includes(operator)) {
|
|
1669
|
-
searchParams.set(`_${field}[${numberOperatorEncoder[operator]},${encodeValue(type)}]`, encodeValue(
|
|
1715
|
+
searchParams.set(`_${field}[${numberOperatorEncoder[operator]},${encodeValue(type)}]`, encodeValue(normalizedValue));
|
|
1670
1716
|
} else {
|
|
1671
|
-
searchParams.set(`_${field}[${encodeValue(operator)},${encodeValue(type)}]`, encodeValue(
|
|
1717
|
+
searchParams.set(`_${field}[${encodeValue(operator)},${encodeValue(type)}]`, encodeValue(normalizedValue));
|
|
1672
1718
|
}
|
|
1673
1719
|
});
|
|
1674
1720
|
if ((_filterModel$quickFil = filterModel.quickFilterValues) !== null && _filterModel$quickFil !== void 0 && _filterModel$quickFil.length) {
|
|
@@ -4017,5 +4063,5 @@ const StatefulDataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
4017
4063
|
StatefulDataGrid.className = CLASSNAME;
|
|
4018
4064
|
StatefulDataGrid.displayName = COMPONENT_NAME;
|
|
4019
4065
|
|
|
4020
|
-
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, resetColumnVisibility as a3, convertToDisplayFormat as a4, convertFromDisplayFormat as a5, getDecodedSearchFromUrl as a6, buildQueryParamsString as a7, areSearchStringsEqual as a8, decodeValue as a9,
|
|
4066
|
+
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, resetColumnVisibility as a3, convertToDisplayFormat as a4, convertFromDisplayFormat as a5, getDecodedSearchFromUrl as a6, buildQueryParamsString as a7, areSearchStringsEqual as a8, decodeValue as a9, getSearchParamsFromAggregation as aA, fromGridPivotModel as aB, getPivotFromString as aC, getSearchParamsFromPivot as aD, getPivotActiveFromString as aE, getSearchParamsFromPivotActive as aF, getSearchParamsFromVersion as aG, getFinalSearch as aH, getModelsParsedOrUpdateLocalStorage as aI, updateUrl as aJ, areFilterModelsEquivalent as aK, StatefulDataGrid as aL, encodeValue as aa, urlSearchParamsToString as ab, numberOperatorEncoder as ac, numberOperatorDecoder as ad, isOperatorValueValid as ae, isValueValid as af, getFilterModelFromString as ag, normalizeDateValue as ah, getSearchParamsFromFilterModel as ai, getSortingFromString as aj, getSearchParamsFromSorting as ak, getPaginationFromString as al, getSearchParamsFromPagination as am, getColumnVisibilityFromString as an, getSearchParamsFromColumnVisibility as ao, getPinnedColumnsFromString as ap, getSearchParamsFromPinnedColumns as aq, getSearchParamsFromTab as ar, getDensityFromString as as, getSearchParamsFromDensity as at, getDensityModel as au, getColumnOrderFromString as av, getSearchParamsFromColumnOrder as aw, getRowGroupingFromString as ax, getSearchParamsFromRowGrouping as ay, getAggregationFromString 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 };
|
|
4021
4067
|
//# sourceMappingURL=StatefulDataGrid2.js.map
|