@etsoo/materialui 1.5.77 → 1.5.78

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.
@@ -247,9 +247,12 @@ function DataGridEx(props) {
247
247
  const sharedWidth = leftWidth > 0 ? leftWidth / widthCalculator.unset : 0;
248
248
  return (column.minWidth || minWidth) + sharedWidth;
249
249
  }, [columns, width]);
250
- const onUpdateRowsHandler = react_2.default.useCallback((rows, state) => {
250
+ const onUpdateRowsHandler = react_2.default.useCallback((rows, state, reset) => {
251
251
  GridUtils_1.GridUtils.getUpdateRowsHandler(cacheKey)?.(rows, state);
252
- onUpdateRows?.(rows, state);
252
+ onUpdateRows?.(rows, state, reset);
253
+ if (cacheKey && reset) {
254
+ sessionStorage.removeItem((0, useGridCacheInitLoad_1.gridCacheKeyGenerator)(cacheKey));
255
+ }
253
256
  }, [onUpdateRows, cacheKey]);
254
257
  // Table
255
258
  const table = react_2.default.useMemo(() => {
@@ -52,6 +52,9 @@ const createGridStyle = (alternatingColors, selectedColor) => {
52
52
  */
53
53
  exports.ScrollerListExItemDefaultStyles = {
54
54
  height: `calc(100% - 16px)`,
55
+ /**
56
+ * default rowHeight is 150px when 16px margin top/bottom
57
+ */
55
58
  marginTop: "8px",
56
59
  marginBottom: "8px",
57
60
  overflow: "auto"
@@ -83,12 +86,15 @@ function ScrollerListEx(props) {
83
86
  return selected;
84
87
  };
85
88
  // Destruct
86
- const { alternatingColors = [undefined, undefined], className, cacheKey, cacheMinutes = 15, idField = "id", itemRenderer = ({ data }) => ((0, jsx_runtime_1.jsx)(Box_1.default, { component: "pre", sx: exports.ScrollerListExItemDefaultStyles, children: JSON.stringify(data) })), onClick, onDoubleClick, onUpdateRows, onSelectChange, rowHeight = 142, selectedColor = "#edf4fb", ...rest } = props;
89
+ const { alternatingColors = [undefined, undefined], className, cacheKey, cacheMinutes = 15, idField = "id", itemRenderer = ({ data }) => ((0, jsx_runtime_1.jsx)(Box_1.default, { component: "pre", sx: exports.ScrollerListExItemDefaultStyles, children: JSON.stringify(data) })), onClick, onDoubleClick, onUpdateRows, onSelectChange, rowHeight = 150, selectedColor = "#edf4fb", ...rest } = props;
87
90
  // Init handler
88
91
  const initHandler = (0, useListCacheInitLoad_1.useListCacheInitLoad)(cacheKey, cacheMinutes);
89
- const onUpdateRowsHandler = react_2.default.useCallback((rows, state) => {
92
+ const onUpdateRowsHandler = react_2.default.useCallback((rows, state, reset) => {
90
93
  GridUtils_1.GridUtils.getUpdateRowsHandler(cacheKey)?.(rows, state);
91
- onUpdateRows?.(rows, state);
94
+ onUpdateRows?.(rows, state, reset);
95
+ if (cacheKey && reset) {
96
+ sessionStorage.removeItem((0, useListCacheInitLoad_1.listCacheKeyGenerator)(cacheKey));
97
+ }
92
98
  }, [onUpdateRows, cacheKey]);
93
99
  // Layout
94
100
  return ((0, jsx_runtime_1.jsx)(react_1.ScrollerList, { className: shared_1.Utils.mergeClasses("ScrollerListEx-Body", className, createGridStyle(alternatingColors, selectedColor)), idField: idField, onRowsRendered: cacheKey
@@ -240,9 +240,12 @@ export function DataGridEx(props) {
240
240
  const sharedWidth = leftWidth > 0 ? leftWidth / widthCalculator.unset : 0;
241
241
  return (column.minWidth || minWidth) + sharedWidth;
242
242
  }, [columns, width]);
243
- const onUpdateRowsHandler = React.useCallback((rows, state) => {
243
+ const onUpdateRowsHandler = React.useCallback((rows, state, reset) => {
244
244
  GridUtils.getUpdateRowsHandler(cacheKey)?.(rows, state);
245
- onUpdateRows?.(rows, state);
245
+ onUpdateRows?.(rows, state, reset);
246
+ if (cacheKey && reset) {
247
+ sessionStorage.removeItem(gridCacheKeyGenerator(cacheKey));
248
+ }
246
249
  }, [onUpdateRows, cacheKey]);
247
250
  // Table
248
251
  const table = React.useMemo(() => {
@@ -45,6 +45,9 @@ const createGridStyle = (alternatingColors, selectedColor) => {
45
45
  */
46
46
  export const ScrollerListExItemDefaultStyles = {
47
47
  height: `calc(100% - 16px)`,
48
+ /**
49
+ * default rowHeight is 150px when 16px margin top/bottom
50
+ */
48
51
  marginTop: "8px",
49
52
  marginBottom: "8px",
50
53
  overflow: "auto"
@@ -76,12 +79,15 @@ export function ScrollerListEx(props) {
76
79
  return selected;
77
80
  };
78
81
  // Destruct
79
- const { alternatingColors = [undefined, undefined], className, cacheKey, cacheMinutes = 15, idField = "id", itemRenderer = ({ data }) => (_jsx(Box, { component: "pre", sx: ScrollerListExItemDefaultStyles, children: JSON.stringify(data) })), onClick, onDoubleClick, onUpdateRows, onSelectChange, rowHeight = 142, selectedColor = "#edf4fb", ...rest } = props;
82
+ const { alternatingColors = [undefined, undefined], className, cacheKey, cacheMinutes = 15, idField = "id", itemRenderer = ({ data }) => (_jsx(Box, { component: "pre", sx: ScrollerListExItemDefaultStyles, children: JSON.stringify(data) })), onClick, onDoubleClick, onUpdateRows, onSelectChange, rowHeight = 150, selectedColor = "#edf4fb", ...rest } = props;
80
83
  // Init handler
81
84
  const initHandler = useListCacheInitLoad(cacheKey, cacheMinutes);
82
- const onUpdateRowsHandler = React.useCallback((rows, state) => {
85
+ const onUpdateRowsHandler = React.useCallback((rows, state, reset) => {
83
86
  GridUtils.getUpdateRowsHandler(cacheKey)?.(rows, state);
84
- onUpdateRows?.(rows, state);
87
+ onUpdateRows?.(rows, state, reset);
88
+ if (cacheKey && reset) {
89
+ sessionStorage.removeItem(listCacheKeyGenerator(cacheKey));
90
+ }
85
91
  }, [onUpdateRows, cacheKey]);
86
92
  // Layout
87
93
  return (_jsx(ScrollerList, { className: Utils.mergeClasses("ScrollerListEx-Body", className, createGridStyle(alternatingColors, selectedColor)), idField: idField, onRowsRendered: cacheKey
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.5.77",
3
+ "version": "1.5.78",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -42,7 +42,7 @@
42
42
  "@emotion/styled": "^11.14.1",
43
43
  "@etsoo/appscript": "^1.6.45",
44
44
  "@etsoo/notificationbase": "^1.1.64",
45
- "@etsoo/react": "^1.8.59",
45
+ "@etsoo/react": "^1.8.60",
46
46
  "@etsoo/shared": "^1.2.76",
47
47
  "@mui/icons-material": "^7.3.4",
48
48
  "@mui/material": "^7.3.4",
@@ -81,7 +81,7 @@
81
81
  "@types/react-dom": "^19.2.2",
82
82
  "@types/react-input-mask": "^3.0.6",
83
83
  "@vitejs/plugin-react": "^5.0.4",
84
- "jsdom": "^27.0.0",
84
+ "jsdom": "^27.0.1",
85
85
  "typescript": "^5.9.3",
86
86
  "vitest": "^3.2.4"
87
87
  }
@@ -560,9 +560,13 @@ export function DataGridEx<T extends object>(props: DataGridExProps<T>) {
560
560
  );
561
561
 
562
562
  const onUpdateRowsHandler = React.useCallback(
563
- (rows: T[], state: GridLoaderStates<T>) => {
563
+ (rows: T[], state: GridLoaderStates<T>, reset: boolean) => {
564
564
  GridUtils.getUpdateRowsHandler<T>(cacheKey)?.(rows, state);
565
- onUpdateRows?.(rows, state);
565
+ onUpdateRows?.(rows, state, reset);
566
+
567
+ if (cacheKey && reset) {
568
+ sessionStorage.removeItem(gridCacheKeyGenerator(cacheKey));
569
+ }
566
570
  },
567
571
  [onUpdateRows, cacheKey]
568
572
  );
@@ -13,7 +13,6 @@ import {
13
13
  useListCacheInitLoad
14
14
  } from "./uses/useListCacheInitLoad";
15
15
  import Box from "@mui/material/Box";
16
- import { SxProps, Theme } from "@mui/material/styles";
17
16
 
18
17
  // Scroll bar size
19
18
  const scrollbarSize = 16;
@@ -85,8 +84,13 @@ export type ScrollerListExItemRendererProps<T> = {
85
84
  */
86
85
  export const ScrollerListExItemDefaultStyles: React.CSSProperties = {
87
86
  height: `calc(100% - 16px)`,
87
+
88
+ /**
89
+ * default rowHeight is 150px when 16px margin top/bottom
90
+ */
88
91
  marginTop: "8px",
89
92
  marginBottom: "8px",
93
+
90
94
  overflow: "auto"
91
95
  };
92
96
 
@@ -192,7 +196,7 @@ export function ScrollerListEx<T extends object>(
192
196
  onDoubleClick,
193
197
  onUpdateRows,
194
198
  onSelectChange,
195
- rowHeight = 142,
199
+ rowHeight = 150,
196
200
  selectedColor = "#edf4fb",
197
201
  ...rest
198
202
  } = props;
@@ -201,9 +205,13 @@ export function ScrollerListEx<T extends object>(
201
205
  const initHandler = useListCacheInitLoad<T>(cacheKey, cacheMinutes);
202
206
 
203
207
  const onUpdateRowsHandler = React.useCallback(
204
- (rows: T[], state: GridLoaderStates<T>) => {
208
+ (rows: T[], state: GridLoaderStates<T>, reset: boolean) => {
205
209
  GridUtils.getUpdateRowsHandler<T>(cacheKey)?.(rows, state);
206
- onUpdateRows?.(rows, state);
210
+ onUpdateRows?.(rows, state, reset);
211
+
212
+ if (cacheKey && reset) {
213
+ sessionStorage.removeItem(listCacheKeyGenerator(cacheKey));
214
+ }
207
215
  },
208
216
  [onUpdateRows, cacheKey]
209
217
  );