@etsoo/materialui 1.5.77 → 1.5.79
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/lib/cjs/DataGridEx.js +18 -15
- package/lib/cjs/ResponsibleContainer.js +4 -4
- package/lib/cjs/ScrollerListEx.js +9 -3
- package/lib/mjs/DataGridEx.js +18 -15
- package/lib/mjs/ResponsibleContainer.js +4 -4
- package/lib/mjs/ScrollerListEx.js +9 -3
- package/package.json +3 -3
- package/src/DataGridEx.tsx +23 -18
- package/src/ResponsibleContainer.tsx +4 -4
- package/src/ScrollerListEx.tsx +12 -4
package/lib/cjs/DataGridEx.js
CHANGED
|
@@ -44,20 +44,20 @@ const createGridStyle = (alternatingColors, selectedColor, hoverColor) => {
|
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
};
|
|
47
|
-
const
|
|
47
|
+
const rowItem = (div, callback) => {
|
|
48
48
|
const row = div.dataset["row"];
|
|
49
49
|
if (div.parentElement == null || row == null)
|
|
50
50
|
return;
|
|
51
|
-
|
|
51
|
+
doRowItem(div.parentElement, parseFloat(row), callback);
|
|
52
52
|
};
|
|
53
|
-
const
|
|
54
|
-
if (parent == null || rowIndex == null)
|
|
53
|
+
const doRowItem = (parent, rowIndex, callback) => {
|
|
54
|
+
if (parent == null || parent.parentElement == null || rowIndex == null)
|
|
55
55
|
return;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
// New react-window version uses an extra div
|
|
57
|
+
// <div role="row" aria-rowindex="1">...</div>
|
|
58
|
+
const row = parent.parentElement?.querySelector(`div[role="row"] > div[data-row="${rowIndex}"]`);
|
|
59
|
+
if (row)
|
|
60
|
+
callback(row);
|
|
61
61
|
};
|
|
62
62
|
/**
|
|
63
63
|
* Extended datagrid columns calculation
|
|
@@ -211,22 +211,22 @@ function DataGridEx(props) {
|
|
|
211
211
|
if (isNaN(rowIndex) || rowIndex === selectedRowIndex.current)
|
|
212
212
|
return;
|
|
213
213
|
if (selectedRowIndex.current != -1) {
|
|
214
|
-
|
|
214
|
+
doRowItem(div.parentElement, selectedRowIndex.current, (preDiv) => {
|
|
215
215
|
preDiv.classList.remove("DataGridEx-Selected");
|
|
216
216
|
});
|
|
217
217
|
}
|
|
218
|
-
|
|
218
|
+
rowItem(div, (currentDiv) => {
|
|
219
219
|
currentDiv.classList.add("DataGridEx-Selected");
|
|
220
220
|
});
|
|
221
221
|
selectedRowIndex.current = rowIndex;
|
|
222
222
|
};
|
|
223
223
|
const handleMouseOver = (event) => {
|
|
224
|
-
|
|
224
|
+
rowItem(event.currentTarget, (div) => {
|
|
225
225
|
div.classList.add("DataGridEx-Hover");
|
|
226
226
|
});
|
|
227
227
|
};
|
|
228
228
|
const handleMouseOut = (event) => {
|
|
229
|
-
|
|
229
|
+
rowItem(event.currentTarget, (div) => {
|
|
230
230
|
div.classList.remove("DataGridEx-Hover");
|
|
231
231
|
});
|
|
232
232
|
};
|
|
@@ -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(() => {
|
|
@@ -38,15 +38,15 @@ function ResponsibleContainer(props) {
|
|
|
38
38
|
// Refs
|
|
39
39
|
const refs = react_1.default.useRef({});
|
|
40
40
|
const state = refs.current;
|
|
41
|
+
// Screen size detection
|
|
42
|
+
const showDataGrid = (0, useMediaQuery_1.default)("(min-width:600px)");
|
|
41
43
|
const mRefs = (0, react_2.useCombinedRefs)(mRef, (ref) => {
|
|
42
44
|
if (ref == null)
|
|
43
45
|
return;
|
|
44
46
|
state.ref = ref;
|
|
45
|
-
if (ref.element
|
|
46
|
-
elementReady(ref.element,
|
|
47
|
+
if (ref.element)
|
|
48
|
+
elementReady?.(ref.element, showDataGrid);
|
|
47
49
|
});
|
|
48
|
-
// Screen size detection
|
|
49
|
-
const showDataGrid = (0, useMediaQuery_1.default)("(min-width:600px)");
|
|
50
50
|
// Update mounted state
|
|
51
51
|
react_1.default.useEffect(() => {
|
|
52
52
|
return () => {
|
|
@@ -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 =
|
|
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
|
package/lib/mjs/DataGridEx.js
CHANGED
|
@@ -37,20 +37,20 @@ const createGridStyle = (alternatingColors, selectedColor, hoverColor) => {
|
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
|
-
const
|
|
40
|
+
const rowItem = (div, callback) => {
|
|
41
41
|
const row = div.dataset["row"];
|
|
42
42
|
if (div.parentElement == null || row == null)
|
|
43
43
|
return;
|
|
44
|
-
|
|
44
|
+
doRowItem(div.parentElement, parseFloat(row), callback);
|
|
45
45
|
};
|
|
46
|
-
const
|
|
47
|
-
if (parent == null || rowIndex == null)
|
|
46
|
+
const doRowItem = (parent, rowIndex, callback) => {
|
|
47
|
+
if (parent == null || parent.parentElement == null || rowIndex == null)
|
|
48
48
|
return;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
// New react-window version uses an extra div
|
|
50
|
+
// <div role="row" aria-rowindex="1">...</div>
|
|
51
|
+
const row = parent.parentElement?.querySelector(`div[role="row"] > div[data-row="${rowIndex}"]`);
|
|
52
|
+
if (row)
|
|
53
|
+
callback(row);
|
|
54
54
|
};
|
|
55
55
|
/**
|
|
56
56
|
* Extended datagrid columns calculation
|
|
@@ -204,22 +204,22 @@ export function DataGridEx(props) {
|
|
|
204
204
|
if (isNaN(rowIndex) || rowIndex === selectedRowIndex.current)
|
|
205
205
|
return;
|
|
206
206
|
if (selectedRowIndex.current != -1) {
|
|
207
|
-
|
|
207
|
+
doRowItem(div.parentElement, selectedRowIndex.current, (preDiv) => {
|
|
208
208
|
preDiv.classList.remove("DataGridEx-Selected");
|
|
209
209
|
});
|
|
210
210
|
}
|
|
211
|
-
|
|
211
|
+
rowItem(div, (currentDiv) => {
|
|
212
212
|
currentDiv.classList.add("DataGridEx-Selected");
|
|
213
213
|
});
|
|
214
214
|
selectedRowIndex.current = rowIndex;
|
|
215
215
|
};
|
|
216
216
|
const handleMouseOver = (event) => {
|
|
217
|
-
|
|
217
|
+
rowItem(event.currentTarget, (div) => {
|
|
218
218
|
div.classList.add("DataGridEx-Hover");
|
|
219
219
|
});
|
|
220
220
|
};
|
|
221
221
|
const handleMouseOut = (event) => {
|
|
222
|
-
|
|
222
|
+
rowItem(event.currentTarget, (div) => {
|
|
223
223
|
div.classList.remove("DataGridEx-Hover");
|
|
224
224
|
});
|
|
225
225
|
};
|
|
@@ -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(() => {
|
|
@@ -32,15 +32,15 @@ export function ResponsibleContainer(props) {
|
|
|
32
32
|
// Refs
|
|
33
33
|
const refs = React.useRef({});
|
|
34
34
|
const state = refs.current;
|
|
35
|
+
// Screen size detection
|
|
36
|
+
const showDataGrid = useMediaQuery("(min-width:600px)");
|
|
35
37
|
const mRefs = useCombinedRefs(mRef, (ref) => {
|
|
36
38
|
if (ref == null)
|
|
37
39
|
return;
|
|
38
40
|
state.ref = ref;
|
|
39
|
-
if (ref.element
|
|
40
|
-
elementReady(ref.element,
|
|
41
|
+
if (ref.element)
|
|
42
|
+
elementReady?.(ref.element, showDataGrid);
|
|
41
43
|
});
|
|
42
|
-
// Screen size detection
|
|
43
|
-
const showDataGrid = useMediaQuery("(min-width:600px)");
|
|
44
44
|
// Update mounted state
|
|
45
45
|
React.useEffect(() => {
|
|
46
46
|
return () => {
|
|
@@ -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 =
|
|
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.
|
|
3
|
+
"version": "1.5.79",
|
|
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.
|
|
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.
|
|
84
|
+
"jsdom": "^27.0.1",
|
|
85
85
|
"typescript": "^5.9.3",
|
|
86
86
|
"vitest": "^3.2.4"
|
|
87
87
|
}
|
package/src/DataGridEx.tsx
CHANGED
|
@@ -188,29 +188,30 @@ const createGridStyle = (
|
|
|
188
188
|
});
|
|
189
189
|
};
|
|
190
190
|
|
|
191
|
-
const
|
|
191
|
+
const rowItem = (
|
|
192
192
|
div: HTMLDivElement,
|
|
193
193
|
callback: (div: HTMLDivElement) => void
|
|
194
194
|
) => {
|
|
195
195
|
const row = div.dataset["row"];
|
|
196
196
|
if (div.parentElement == null || row == null) return;
|
|
197
|
-
|
|
197
|
+
doRowItem(div.parentElement, parseFloat(row), callback);
|
|
198
198
|
};
|
|
199
199
|
|
|
200
|
-
const
|
|
200
|
+
const doRowItem = (
|
|
201
201
|
parent: HTMLElement,
|
|
202
202
|
rowIndex: number,
|
|
203
203
|
callback: (div: HTMLDivElement) => void
|
|
204
204
|
) => {
|
|
205
|
-
if (parent == null || rowIndex == null)
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
205
|
+
if (parent == null || parent.parentElement == null || rowIndex == null)
|
|
206
|
+
return;
|
|
207
|
+
|
|
208
|
+
// New react-window version uses an extra div
|
|
209
|
+
// <div role="row" aria-rowindex="1">...</div>
|
|
210
|
+
const row = parent.parentElement?.querySelector<HTMLDivElement>(
|
|
211
|
+
`div[role="row"] > div[data-row="${rowIndex}"]`
|
|
212
|
+
);
|
|
213
|
+
|
|
214
|
+
if (row) callback(row);
|
|
214
215
|
};
|
|
215
216
|
|
|
216
217
|
/**
|
|
@@ -507,12 +508,12 @@ export function DataGridEx<T extends object>(props: DataGridExProps<T>) {
|
|
|
507
508
|
if (isNaN(rowIndex) || rowIndex === selectedRowIndex.current) return;
|
|
508
509
|
|
|
509
510
|
if (selectedRowIndex.current != -1) {
|
|
510
|
-
|
|
511
|
+
doRowItem(div.parentElement, selectedRowIndex.current, (preDiv) => {
|
|
511
512
|
preDiv.classList.remove("DataGridEx-Selected");
|
|
512
513
|
});
|
|
513
514
|
}
|
|
514
515
|
|
|
515
|
-
|
|
516
|
+
rowItem(div, (currentDiv) => {
|
|
516
517
|
currentDiv.classList.add("DataGridEx-Selected");
|
|
517
518
|
});
|
|
518
519
|
|
|
@@ -520,13 +521,13 @@ export function DataGridEx<T extends object>(props: DataGridExProps<T>) {
|
|
|
520
521
|
};
|
|
521
522
|
|
|
522
523
|
const handleMouseOver = (event: React.MouseEvent<HTMLDivElement>) => {
|
|
523
|
-
|
|
524
|
+
rowItem(event.currentTarget, (div) => {
|
|
524
525
|
div.classList.add("DataGridEx-Hover");
|
|
525
526
|
});
|
|
526
527
|
};
|
|
527
528
|
|
|
528
529
|
const handleMouseOut = (event: React.MouseEvent<HTMLDivElement>) => {
|
|
529
|
-
|
|
530
|
+
rowItem(event.currentTarget, (div) => {
|
|
530
531
|
div.classList.remove("DataGridEx-Hover");
|
|
531
532
|
});
|
|
532
533
|
};
|
|
@@ -560,9 +561,13 @@ export function DataGridEx<T extends object>(props: DataGridExProps<T>) {
|
|
|
560
561
|
);
|
|
561
562
|
|
|
562
563
|
const onUpdateRowsHandler = React.useCallback(
|
|
563
|
-
(rows: T[], state: GridLoaderStates<T
|
|
564
|
+
(rows: T[], state: GridLoaderStates<T>, reset: boolean) => {
|
|
564
565
|
GridUtils.getUpdateRowsHandler<T>(cacheKey)?.(rows, state);
|
|
565
|
-
onUpdateRows?.(rows, state);
|
|
566
|
+
onUpdateRows?.(rows, state, reset);
|
|
567
|
+
|
|
568
|
+
if (cacheKey && reset) {
|
|
569
|
+
sessionStorage.removeItem(gridCacheKeyGenerator(cacheKey));
|
|
570
|
+
}
|
|
566
571
|
},
|
|
567
572
|
[onUpdateRows, cacheKey]
|
|
568
573
|
);
|
|
@@ -208,16 +208,16 @@ export function ResponsibleContainer<T extends object, F>(
|
|
|
208
208
|
const refs = React.useRef<LocalRefs<T>>({});
|
|
209
209
|
const state = refs.current;
|
|
210
210
|
|
|
211
|
+
// Screen size detection
|
|
212
|
+
const showDataGrid = useMediaQuery("(min-width:600px)");
|
|
213
|
+
|
|
211
214
|
const mRefs = useCombinedRefs(mRef, (ref: GridMethodRef<T>) => {
|
|
212
215
|
if (ref == null) return;
|
|
213
216
|
state.ref = ref;
|
|
214
217
|
|
|
215
|
-
if (ref.element
|
|
218
|
+
if (ref.element) elementReady?.(ref.element, showDataGrid);
|
|
216
219
|
});
|
|
217
220
|
|
|
218
|
-
// Screen size detection
|
|
219
|
-
const showDataGrid = useMediaQuery("(min-width:600px)");
|
|
220
|
-
|
|
221
221
|
// Update mounted state
|
|
222
222
|
React.useEffect(() => {
|
|
223
223
|
return () => {
|
package/src/ScrollerListEx.tsx
CHANGED
|
@@ -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 =
|
|
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
|
);
|