@etsoo/materialui 1.5.76 → 1.5.77
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/MobileListItemRenderer.js +2 -3
- package/lib/cjs/ScrollerListEx.d.ts +4 -0
- package/lib/cjs/ScrollerListEx.js +11 -1
- package/lib/mjs/MobileListItemRenderer.js +2 -3
- package/lib/mjs/ScrollerListEx.d.ts +4 -0
- package/lib/mjs/ScrollerListEx.js +10 -1
- package/package.json +1 -1
- package/src/MobileListItemRenderer.tsx +5 -4
- package/src/ScrollerListEx.tsx +13 -2
|
@@ -10,6 +10,7 @@ const LinearProgress_1 = __importDefault(require("@mui/material/LinearProgress")
|
|
|
10
10
|
const Card_1 = __importDefault(require("@mui/material/Card"));
|
|
11
11
|
const CardHeader_1 = __importDefault(require("@mui/material/CardHeader"));
|
|
12
12
|
const CardContent_1 = __importDefault(require("@mui/material/CardContent"));
|
|
13
|
+
const ScrollerListEx_1 = require("./ScrollerListEx");
|
|
13
14
|
/**
|
|
14
15
|
* Default mobile list item renderer
|
|
15
16
|
* @param param0 List renderer props
|
|
@@ -25,9 +26,7 @@ function MobileListItemRenderer({ data }, renderer, cellSX) {
|
|
|
25
26
|
// Elements
|
|
26
27
|
const [title, subheader, actions, children, cardActions] = renderer(data);
|
|
27
28
|
return ((0, jsx_runtime_1.jsxs)(Card_1.default, { sx: {
|
|
28
|
-
|
|
29
|
-
marginTop: "8px",
|
|
30
|
-
overflow: "auto",
|
|
29
|
+
...ScrollerListEx_1.ScrollerListExItemDefaultStyles,
|
|
31
30
|
...cellSX
|
|
32
31
|
}, children: [(0, jsx_runtime_1.jsx)(CardHeader_1.default, { sx: { paddingBottom: 0.5 }, action: Array.isArray(actions) ? ((0, jsx_runtime_1.jsx)(MoreFab_1.MoreFab, { iconButton: true, size: "small", anchorOrigin: {
|
|
33
32
|
vertical: "bottom",
|
|
@@ -22,6 +22,10 @@ export type ScrollerListExItemRendererProps<T> = {
|
|
|
22
22
|
*/
|
|
23
23
|
selected: boolean;
|
|
24
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Default styles for item renderer
|
|
27
|
+
*/
|
|
28
|
+
export declare const ScrollerListExItemDefaultStyles: React.CSSProperties;
|
|
25
29
|
/**
|
|
26
30
|
* Extended ScrollerList Props
|
|
27
31
|
*/
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ScrollerListExItemDefaultStyles = void 0;
|
|
6
7
|
exports.ScrollerListEx = ScrollerListEx;
|
|
7
8
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
9
|
const css_1 = require("@emotion/css");
|
|
@@ -46,6 +47,15 @@ const createGridStyle = (alternatingColors, selectedColor) => {
|
|
|
46
47
|
}
|
|
47
48
|
});
|
|
48
49
|
};
|
|
50
|
+
/**
|
|
51
|
+
* Default styles for item renderer
|
|
52
|
+
*/
|
|
53
|
+
exports.ScrollerListExItemDefaultStyles = {
|
|
54
|
+
height: `calc(100% - 16px)`,
|
|
55
|
+
marginTop: "8px",
|
|
56
|
+
marginBottom: "8px",
|
|
57
|
+
overflow: "auto"
|
|
58
|
+
};
|
|
49
59
|
/**
|
|
50
60
|
* Extended ScrollerList
|
|
51
61
|
* @param props Props
|
|
@@ -73,7 +83,7 @@ function ScrollerListEx(props) {
|
|
|
73
83
|
return selected;
|
|
74
84
|
};
|
|
75
85
|
// Destruct
|
|
76
|
-
const { alternatingColors = [undefined, undefined], className, cacheKey, cacheMinutes = 15, idField = "id", itemRenderer = ({ data }) => ((0, jsx_runtime_1.jsx)(Box_1.default, { component: "pre", sx:
|
|
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;
|
|
77
87
|
// Init handler
|
|
78
88
|
const initHandler = (0, useListCacheInitLoad_1.useListCacheInitLoad)(cacheKey, cacheMinutes);
|
|
79
89
|
const onUpdateRowsHandler = react_2.default.useCallback((rows, state) => {
|
|
@@ -4,6 +4,7 @@ import LinearProgress from "@mui/material/LinearProgress";
|
|
|
4
4
|
import Card from "@mui/material/Card";
|
|
5
5
|
import CardHeader from "@mui/material/CardHeader";
|
|
6
6
|
import CardContent from "@mui/material/CardContent";
|
|
7
|
+
import { ScrollerListExItemDefaultStyles } from "./ScrollerListEx";
|
|
7
8
|
/**
|
|
8
9
|
* Default mobile list item renderer
|
|
9
10
|
* @param param0 List renderer props
|
|
@@ -19,9 +20,7 @@ export function MobileListItemRenderer({ data }, renderer, cellSX) {
|
|
|
19
20
|
// Elements
|
|
20
21
|
const [title, subheader, actions, children, cardActions] = renderer(data);
|
|
21
22
|
return (_jsxs(Card, { sx: {
|
|
22
|
-
|
|
23
|
-
marginTop: "8px",
|
|
24
|
-
overflow: "auto",
|
|
23
|
+
...ScrollerListExItemDefaultStyles,
|
|
25
24
|
...cellSX
|
|
26
25
|
}, children: [_jsx(CardHeader, { sx: { paddingBottom: 0.5 }, action: Array.isArray(actions) ? (_jsx(MoreFab, { iconButton: true, size: "small", anchorOrigin: {
|
|
27
26
|
vertical: "bottom",
|
|
@@ -22,6 +22,10 @@ export type ScrollerListExItemRendererProps<T> = {
|
|
|
22
22
|
*/
|
|
23
23
|
selected: boolean;
|
|
24
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Default styles for item renderer
|
|
27
|
+
*/
|
|
28
|
+
export declare const ScrollerListExItemDefaultStyles: React.CSSProperties;
|
|
25
29
|
/**
|
|
26
30
|
* Extended ScrollerList Props
|
|
27
31
|
*/
|
|
@@ -40,6 +40,15 @@ const createGridStyle = (alternatingColors, selectedColor) => {
|
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
};
|
|
43
|
+
/**
|
|
44
|
+
* Default styles for item renderer
|
|
45
|
+
*/
|
|
46
|
+
export const ScrollerListExItemDefaultStyles = {
|
|
47
|
+
height: `calc(100% - 16px)`,
|
|
48
|
+
marginTop: "8px",
|
|
49
|
+
marginBottom: "8px",
|
|
50
|
+
overflow: "auto"
|
|
51
|
+
};
|
|
43
52
|
/**
|
|
44
53
|
* Extended ScrollerList
|
|
45
54
|
* @param props Props
|
|
@@ -67,7 +76,7 @@ export function ScrollerListEx(props) {
|
|
|
67
76
|
return selected;
|
|
68
77
|
};
|
|
69
78
|
// Destruct
|
|
70
|
-
const { alternatingColors = [undefined, undefined], className, cacheKey, cacheMinutes = 15, idField = "id", itemRenderer = ({ data }) => (_jsx(Box, { component: "pre", sx:
|
|
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;
|
|
71
80
|
// Init handler
|
|
72
81
|
const initHandler = useListCacheInitLoad(cacheKey, cacheMinutes);
|
|
73
82
|
const onUpdateRowsHandler = React.useCallback((rows, state) => {
|
package/package.json
CHANGED
|
@@ -5,7 +5,10 @@ import LinearProgress from "@mui/material/LinearProgress";
|
|
|
5
5
|
import Card from "@mui/material/Card";
|
|
6
6
|
import CardHeader from "@mui/material/CardHeader";
|
|
7
7
|
import CardContent from "@mui/material/CardContent";
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
ScrollerListExItemDefaultStyles,
|
|
10
|
+
ScrollerListExItemRendererProps
|
|
11
|
+
} from "./ScrollerListEx";
|
|
9
12
|
import { SxProps, Theme } from "@mui/material/styles";
|
|
10
13
|
|
|
11
14
|
/**
|
|
@@ -38,9 +41,7 @@ export function MobileListItemRenderer<T>(
|
|
|
38
41
|
return (
|
|
39
42
|
<Card
|
|
40
43
|
sx={{
|
|
41
|
-
|
|
42
|
-
marginTop: "8px",
|
|
43
|
-
overflow: "auto",
|
|
44
|
+
...ScrollerListExItemDefaultStyles,
|
|
44
45
|
...cellSX
|
|
45
46
|
}}
|
|
46
47
|
>
|
package/src/ScrollerListEx.tsx
CHANGED
|
@@ -13,6 +13,7 @@ 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";
|
|
16
17
|
|
|
17
18
|
// Scroll bar size
|
|
18
19
|
const scrollbarSize = 16;
|
|
@@ -79,6 +80,16 @@ export type ScrollerListExItemRendererProps<T> = {
|
|
|
79
80
|
selected: boolean;
|
|
80
81
|
};
|
|
81
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Default styles for item renderer
|
|
85
|
+
*/
|
|
86
|
+
export const ScrollerListExItemDefaultStyles: React.CSSProperties = {
|
|
87
|
+
height: `calc(100% - 16px)`,
|
|
88
|
+
marginTop: "8px",
|
|
89
|
+
marginBottom: "8px",
|
|
90
|
+
overflow: "auto"
|
|
91
|
+
};
|
|
92
|
+
|
|
82
93
|
/**
|
|
83
94
|
* Extended ScrollerList Props
|
|
84
95
|
*/
|
|
@@ -173,7 +184,7 @@ export function ScrollerListEx<T extends object>(
|
|
|
173
184
|
cacheMinutes = 15,
|
|
174
185
|
idField = "id" as DataTypes.Keys<T>,
|
|
175
186
|
itemRenderer = ({ data }) => (
|
|
176
|
-
<Box component="pre" sx={
|
|
187
|
+
<Box component="pre" sx={ScrollerListExItemDefaultStyles}>
|
|
177
188
|
{JSON.stringify(data)}
|
|
178
189
|
</Box>
|
|
179
190
|
),
|
|
@@ -181,7 +192,7 @@ export function ScrollerListEx<T extends object>(
|
|
|
181
192
|
onDoubleClick,
|
|
182
193
|
onUpdateRows,
|
|
183
194
|
onSelectChange,
|
|
184
|
-
rowHeight =
|
|
195
|
+
rowHeight = 142,
|
|
185
196
|
selectedColor = "#edf4fb",
|
|
186
197
|
...rest
|
|
187
198
|
} = props;
|