@etsoo/materialui 1.4.86 → 1.4.87
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/ResponsibleContainer.js +1 -1
- package/lib/cjs/SearchBar.d.ts +4 -0
- package/lib/cjs/SearchBar.js +3 -3
- package/lib/cjs/pages/DataGridPage.js +1 -1
- package/lib/cjs/pages/FixedListPage.js +1 -1
- package/lib/cjs/pages/ListPage.js +6 -3
- package/lib/cjs/pages/TablePage.js +2 -2
- package/lib/mjs/ResponsibleContainer.js +1 -1
- package/lib/mjs/SearchBar.d.ts +4 -0
- package/lib/mjs/SearchBar.js +4 -4
- package/lib/mjs/pages/DataGridPage.js +1 -1
- package/lib/mjs/pages/FixedListPage.js +1 -1
- package/lib/mjs/pages/ListPage.js +7 -4
- package/lib/mjs/pages/TablePage.js +2 -2
- package/package.json +1 -1
- package/src/ResponsibleContainer.tsx +1 -0
- package/src/SearchBar.tsx +11 -4
- package/src/pages/DataGridPage.tsx +8 -1
- package/src/pages/FixedListPage.tsx +8 -1
- package/src/pages/ListPage.tsx +16 -2
- package/src/pages/TablePage.tsx +9 -1
|
@@ -176,7 +176,7 @@ function ResponsibleContainer(props) {
|
|
|
176
176
|
rect.width < 20)
|
|
177
177
|
return;
|
|
178
178
|
const f = typeof fields == "function" ? fields(searchData ?? {}) : fields;
|
|
179
|
-
return ((0, jsx_runtime_1.jsx)(SearchBar_1.SearchBar, { fields: f, onSubmit: onSubmit, className: `searchBar${showDataGrid ? "Grid" : "List"}`, top: searchBarTop }));
|
|
179
|
+
return ((0, jsx_runtime_1.jsx)(SearchBar_1.SearchBar, { fields: f, onSubmit: onSubmit, className: `searchBar${showDataGrid ? "Grid" : "List"}`, width: rect.width, top: searchBarTop }));
|
|
180
180
|
}, [showDataGrid, hasFields, searchBarHeight, rect?.width]);
|
|
181
181
|
// Pull container
|
|
182
182
|
const pullContainer = showDataGrid == null
|
package/lib/cjs/SearchBar.d.ts
CHANGED
package/lib/cjs/SearchBar.js
CHANGED
|
@@ -76,7 +76,7 @@ function checkFormEvent(event) {
|
|
|
76
76
|
*/
|
|
77
77
|
function SearchBar(props) {
|
|
78
78
|
// Destruct
|
|
79
|
-
const { className, fields, onSubmit, itemGap = 6, itemWidth = 160, top } = props;
|
|
79
|
+
const { className, fields, onSubmit, itemGap = 6, itemWidth = 160, top, width } = props;
|
|
80
80
|
// Labels
|
|
81
81
|
const labels = Labels_1.Labels.CommonPage;
|
|
82
82
|
// Menu index
|
|
@@ -240,10 +240,10 @@ function SearchBar(props) {
|
|
|
240
240
|
};
|
|
241
241
|
}, [className]);
|
|
242
242
|
// Layout
|
|
243
|
-
return ((0, jsx_runtime_1.jsxs)(
|
|
243
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)("form", { id: "SearchBarForm", className: className, onChange: handleForm, ref: (form) => {
|
|
244
244
|
if (form)
|
|
245
245
|
state.form = form;
|
|
246
|
-
}, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { className: "SearchBarContainer", justifyContent: "center", alignItems: "center", direction: "row", spacing: `${itemGap}px`, width:
|
|
246
|
+
}, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { ref: dimensions[0][0], className: "SearchBarContainer", justifyContent: "center", alignItems: "center", direction: "row", spacing: `${itemGap}px`, width: width, overflow: "hidden", paddingTop: "6px", sx: {
|
|
247
247
|
"& > :not(style)": {
|
|
248
248
|
flexBasis: "auto",
|
|
249
249
|
flexGrow: 0,
|
|
@@ -110,5 +110,5 @@ function DataGridPage(props) {
|
|
|
110
110
|
// Layout
|
|
111
111
|
return ((0, jsx_runtime_1.jsx)(CommonPage_1.CommonPage, { ...pageProps, scrollContainer: states.element, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, { ref: dimensions[0][0], sx: {
|
|
112
112
|
paddingBottom: pageProps.paddings
|
|
113
|
-
}, children: (0, jsx_runtime_1.jsx)(SearchBar_1.SearchBar, { fields: f, onSubmit: onSubmit, top: searchBarTop }) }), list] }) }));
|
|
113
|
+
}, children: rect && rect.width > 100 && ((0, jsx_runtime_1.jsx)(SearchBar_1.SearchBar, { fields: f, onSubmit: onSubmit, top: searchBarTop, width: rect.width })) }), list] }) }));
|
|
114
114
|
}
|
|
@@ -100,5 +100,5 @@ function FixedListPage(props) {
|
|
|
100
100
|
const f = typeof fields == "function" ? fields(searchData ?? {}) : fields;
|
|
101
101
|
const { paddings, ...pageRest } = pageProps;
|
|
102
102
|
// Layout
|
|
103
|
-
return ((0, jsx_runtime_1.jsx)(CommonPage_1.CommonPage, { ...pageRest, paddings: {}, scrollContainer: scrollContainer, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, { ref: dimensions[0][0], sx: { padding: paddings }, children: (0, jsx_runtime_1.jsx)(SearchBar_1.SearchBar, { fields: f, onSubmit: onSubmit, top: searchBarTop }) }), list] }) }));
|
|
103
|
+
return ((0, jsx_runtime_1.jsx)(CommonPage_1.CommonPage, { ...pageRest, paddings: {}, scrollContainer: scrollContainer, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, { ref: dimensions[0][0], sx: { padding: paddings }, children: rect && rect.width > 100 && ((0, jsx_runtime_1.jsx)(SearchBar_1.SearchBar, { fields: f, onSubmit: onSubmit, top: searchBarTop, width: rect.width })) }), list] }) }));
|
|
104
104
|
}
|
|
@@ -20,7 +20,7 @@ const GridUtils_1 = require("../GridUtils");
|
|
|
20
20
|
*/
|
|
21
21
|
function ListPage(props) {
|
|
22
22
|
// Destruct
|
|
23
|
-
const { fields, fieldTemplate, loadData, mRef, pageProps = {}, cacheKey, cacheMinutes = 15, searchBarTop, ...rest } = props;
|
|
23
|
+
const { fields, fieldTemplate, loadData, mRef, pageProps = {}, cacheKey, cacheMinutes = 15, sizeReadyMiliseconds = 0, searchBarTop, ...rest } = props;
|
|
24
24
|
pageProps.paddings ??= MUGlobal_1.MUGlobal.pagePaddings;
|
|
25
25
|
// States
|
|
26
26
|
const [states] = react_2.default.useState({});
|
|
@@ -46,6 +46,9 @@ function ListPage(props) {
|
|
|
46
46
|
const localLoadData = (props, lastItem) => {
|
|
47
47
|
return loadData(GridUtils_1.GridUtils.createLoader(props, fieldTemplate, cacheKey, false), lastItem);
|
|
48
48
|
};
|
|
49
|
+
// Watch container
|
|
50
|
+
const { dimensions } = (0, react_1.useDimensions)(1, undefined, sizeReadyMiliseconds);
|
|
51
|
+
const rect = dimensions[0][2];
|
|
49
52
|
// Search data
|
|
50
53
|
const searchData = GridUtils_1.GridUtils.getSearchData(cacheKey);
|
|
51
54
|
const onInitLoad = (ref) => {
|
|
@@ -77,7 +80,7 @@ function ListPage(props) {
|
|
|
77
80
|
};
|
|
78
81
|
const f = typeof fields == "function" ? fields(searchData ?? {}) : fields;
|
|
79
82
|
// Layout
|
|
80
|
-
return ((0, jsx_runtime_1.jsx)(CommonPage_1.CommonPage, { ...pageProps, scrollContainer: globalThis, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
83
|
+
return ((0, jsx_runtime_1.jsx)(CommonPage_1.CommonPage, { ...pageProps, scrollContainer: globalThis, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, { ref: dimensions[0][0], sx: {
|
|
81
84
|
paddingBottom: pageProps.paddings
|
|
82
|
-
}, children: (0, jsx_runtime_1.jsx)(SearchBar_1.SearchBar, { fields: f, onSubmit: onSubmit, top: searchBarTop }) }), (0, jsx_runtime_1.jsx)(ScrollerListEx_1.ScrollerListEx, { autoLoad: false, loadData: localLoadData, onUpdateRows: GridUtils_1.GridUtils.getUpdateRowsHandler(cacheKey), onInitLoad: onInitLoad, onScroll: onListScroll, mRef: refs, ...rest })] }) }));
|
|
85
|
+
}, children: rect && rect.width > 100 && ((0, jsx_runtime_1.jsx)(SearchBar_1.SearchBar, { fields: f, onSubmit: onSubmit, top: searchBarTop, width: rect.width })) }), (0, jsx_runtime_1.jsx)(ScrollerListEx_1.ScrollerListEx, { autoLoad: false, loadData: localLoadData, onUpdateRows: GridUtils_1.GridUtils.getUpdateRowsHandler(cacheKey), onInitLoad: onInitLoad, onScroll: onListScroll, mRef: refs, ...rest })] }) }));
|
|
83
86
|
}
|
|
@@ -20,7 +20,7 @@ const GridUtils_1 = require("../GridUtils");
|
|
|
20
20
|
*/
|
|
21
21
|
function TablePage(props) {
|
|
22
22
|
// Destruct
|
|
23
|
-
const { columns, fields, fieldTemplate, loadData, mRef, sizeReadyMiliseconds = 0, pageProps = {}, cacheKey, cacheMinutes = 15, ...rest } = props;
|
|
23
|
+
const { columns, fields, fieldTemplate, loadData, mRef, sizeReadyMiliseconds = 0, pageProps = {}, cacheKey, cacheMinutes = 15, searchBarTop, ...rest } = props;
|
|
24
24
|
pageProps.paddings ??= MUGlobal_1.MUGlobal.pagePaddings;
|
|
25
25
|
// States
|
|
26
26
|
const [states] = react_2.default.useState({});
|
|
@@ -68,5 +68,5 @@ function TablePage(props) {
|
|
|
68
68
|
// Layout
|
|
69
69
|
return ((0, jsx_runtime_1.jsx)(CommonPage_1.CommonPage, { ...pageProps, scrollContainer: globalThis, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, { ref: dimensions[0][0], sx: {
|
|
70
70
|
paddingBottom: pageProps.paddings
|
|
71
|
-
}, children: (0, jsx_runtime_1.jsx)(SearchBar_1.SearchBar, { fields: f, onSubmit: onSubmit }) }), list] }) }));
|
|
71
|
+
}, children: rect && rect.width > 100 && ((0, jsx_runtime_1.jsx)(SearchBar_1.SearchBar, { fields: f, onSubmit: onSubmit, top: searchBarTop, width: rect.width })) }), list] }) }));
|
|
72
72
|
}
|
|
@@ -170,7 +170,7 @@ export function ResponsibleContainer(props) {
|
|
|
170
170
|
rect.width < 20)
|
|
171
171
|
return;
|
|
172
172
|
const f = typeof fields == "function" ? fields(searchData ?? {}) : fields;
|
|
173
|
-
return (_jsx(SearchBar, { fields: f, onSubmit: onSubmit, className: `searchBar${showDataGrid ? "Grid" : "List"}`, top: searchBarTop }));
|
|
173
|
+
return (_jsx(SearchBar, { fields: f, onSubmit: onSubmit, className: `searchBar${showDataGrid ? "Grid" : "List"}`, width: rect.width, top: searchBarTop }));
|
|
174
174
|
}, [showDataGrid, hasFields, searchBarHeight, rect?.width]);
|
|
175
175
|
// Pull container
|
|
176
176
|
const pullContainer = showDataGrid == null
|
package/lib/mjs/SearchBar.d.ts
CHANGED
package/lib/mjs/SearchBar.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Button,
|
|
2
|
+
import { Button, Drawer, IconButton, Stack, Toolbar } from "@mui/material";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import MoreHorizIcon from "@mui/icons-material/MoreHoriz";
|
|
5
5
|
import { DomUtils, NumberUtils } from "@etsoo/shared";
|
|
@@ -70,7 +70,7 @@ function checkFormEvent(event) {
|
|
|
70
70
|
*/
|
|
71
71
|
export function SearchBar(props) {
|
|
72
72
|
// Destruct
|
|
73
|
-
const { className, fields, onSubmit, itemGap = 6, itemWidth = 160, top } = props;
|
|
73
|
+
const { className, fields, onSubmit, itemGap = 6, itemWidth = 160, top, width } = props;
|
|
74
74
|
// Labels
|
|
75
75
|
const labels = Labels.CommonPage;
|
|
76
76
|
// Menu index
|
|
@@ -234,10 +234,10 @@ export function SearchBar(props) {
|
|
|
234
234
|
};
|
|
235
235
|
}, [className]);
|
|
236
236
|
// Layout
|
|
237
|
-
return (_jsxs(
|
|
237
|
+
return (_jsxs(React.Fragment, { children: [_jsx("form", { id: "SearchBarForm", className: className, onChange: handleForm, ref: (form) => {
|
|
238
238
|
if (form)
|
|
239
239
|
state.form = form;
|
|
240
|
-
}, children: _jsxs(Stack, { className: "SearchBarContainer", justifyContent: "center", alignItems: "center", direction: "row", spacing: `${itemGap}px`, width:
|
|
240
|
+
}, children: _jsxs(Stack, { ref: dimensions[0][0], className: "SearchBarContainer", justifyContent: "center", alignItems: "center", direction: "row", spacing: `${itemGap}px`, width: width, overflow: "hidden", paddingTop: "6px", sx: {
|
|
241
241
|
"& > :not(style)": {
|
|
242
242
|
flexBasis: "auto",
|
|
243
243
|
flexGrow: 0,
|
|
@@ -104,5 +104,5 @@ export function DataGridPage(props) {
|
|
|
104
104
|
// Layout
|
|
105
105
|
return (_jsx(CommonPage, { ...pageProps, scrollContainer: states.element, children: _jsxs(Stack, { children: [_jsx(Box, { ref: dimensions[0][0], sx: {
|
|
106
106
|
paddingBottom: pageProps.paddings
|
|
107
|
-
}, children: _jsx(SearchBar, { fields: f, onSubmit: onSubmit, top: searchBarTop }) }), list] }) }));
|
|
107
|
+
}, children: rect && rect.width > 100 && (_jsx(SearchBar, { fields: f, onSubmit: onSubmit, top: searchBarTop, width: rect.width })) }), list] }) }));
|
|
108
108
|
}
|
|
@@ -94,5 +94,5 @@ export function FixedListPage(props) {
|
|
|
94
94
|
const f = typeof fields == "function" ? fields(searchData ?? {}) : fields;
|
|
95
95
|
const { paddings, ...pageRest } = pageProps;
|
|
96
96
|
// Layout
|
|
97
|
-
return (_jsx(CommonPage, { ...pageRest, paddings: {}, scrollContainer: scrollContainer, children: _jsxs(Stack, { children: [_jsx(Box, { ref: dimensions[0][0], sx: { padding: paddings }, children: _jsx(SearchBar, { fields: f, onSubmit: onSubmit, top: searchBarTop }) }), list] }) }));
|
|
97
|
+
return (_jsx(CommonPage, { ...pageRest, paddings: {}, scrollContainer: scrollContainer, children: _jsxs(Stack, { children: [_jsx(Box, { ref: dimensions[0][0], sx: { padding: paddings }, children: rect && rect.width > 100 && (_jsx(SearchBar, { fields: f, onSubmit: onSubmit, top: searchBarTop, width: rect.width })) }), list] }) }));
|
|
98
98
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCombinedRefs } from "@etsoo/react";
|
|
2
|
+
import { useCombinedRefs, useDimensions } from "@etsoo/react";
|
|
3
3
|
import { Box, Stack } from "@mui/material";
|
|
4
4
|
import React from "react";
|
|
5
5
|
import { MUGlobal } from "../MUGlobal";
|
|
@@ -14,7 +14,7 @@ import { GridUtils } from "../GridUtils";
|
|
|
14
14
|
*/
|
|
15
15
|
export function ListPage(props) {
|
|
16
16
|
// Destruct
|
|
17
|
-
const { fields, fieldTemplate, loadData, mRef, pageProps = {}, cacheKey, cacheMinutes = 15, searchBarTop, ...rest } = props;
|
|
17
|
+
const { fields, fieldTemplate, loadData, mRef, pageProps = {}, cacheKey, cacheMinutes = 15, sizeReadyMiliseconds = 0, searchBarTop, ...rest } = props;
|
|
18
18
|
pageProps.paddings ??= MUGlobal.pagePaddings;
|
|
19
19
|
// States
|
|
20
20
|
const [states] = React.useState({});
|
|
@@ -40,6 +40,9 @@ export function ListPage(props) {
|
|
|
40
40
|
const localLoadData = (props, lastItem) => {
|
|
41
41
|
return loadData(GridUtils.createLoader(props, fieldTemplate, cacheKey, false), lastItem);
|
|
42
42
|
};
|
|
43
|
+
// Watch container
|
|
44
|
+
const { dimensions } = useDimensions(1, undefined, sizeReadyMiliseconds);
|
|
45
|
+
const rect = dimensions[0][2];
|
|
43
46
|
// Search data
|
|
44
47
|
const searchData = GridUtils.getSearchData(cacheKey);
|
|
45
48
|
const onInitLoad = (ref) => {
|
|
@@ -71,7 +74,7 @@ export function ListPage(props) {
|
|
|
71
74
|
};
|
|
72
75
|
const f = typeof fields == "function" ? fields(searchData ?? {}) : fields;
|
|
73
76
|
// Layout
|
|
74
|
-
return (_jsx(CommonPage, { ...pageProps, scrollContainer: globalThis, children: _jsxs(Stack, { children: [_jsx(Box, { sx: {
|
|
77
|
+
return (_jsx(CommonPage, { ...pageProps, scrollContainer: globalThis, children: _jsxs(Stack, { children: [_jsx(Box, { ref: dimensions[0][0], sx: {
|
|
75
78
|
paddingBottom: pageProps.paddings
|
|
76
|
-
}, children: _jsx(SearchBar, { fields: f, onSubmit: onSubmit, top: searchBarTop }) }), _jsx(ScrollerListEx, { autoLoad: false, loadData: localLoadData, onUpdateRows: GridUtils.getUpdateRowsHandler(cacheKey), onInitLoad: onInitLoad, onScroll: onListScroll, mRef: refs, ...rest })] }) }));
|
|
79
|
+
}, children: rect && rect.width > 100 && (_jsx(SearchBar, { fields: f, onSubmit: onSubmit, top: searchBarTop, width: rect.width })) }), _jsx(ScrollerListEx, { autoLoad: false, loadData: localLoadData, onUpdateRows: GridUtils.getUpdateRowsHandler(cacheKey), onInitLoad: onInitLoad, onScroll: onListScroll, mRef: refs, ...rest })] }) }));
|
|
77
80
|
}
|
|
@@ -14,7 +14,7 @@ import { GridUtils } from "../GridUtils";
|
|
|
14
14
|
*/
|
|
15
15
|
export function TablePage(props) {
|
|
16
16
|
// Destruct
|
|
17
|
-
const { columns, fields, fieldTemplate, loadData, mRef, sizeReadyMiliseconds = 0, pageProps = {}, cacheKey, cacheMinutes = 15, ...rest } = props;
|
|
17
|
+
const { columns, fields, fieldTemplate, loadData, mRef, sizeReadyMiliseconds = 0, pageProps = {}, cacheKey, cacheMinutes = 15, searchBarTop, ...rest } = props;
|
|
18
18
|
pageProps.paddings ??= MUGlobal.pagePaddings;
|
|
19
19
|
// States
|
|
20
20
|
const [states] = React.useState({});
|
|
@@ -62,5 +62,5 @@ export function TablePage(props) {
|
|
|
62
62
|
// Layout
|
|
63
63
|
return (_jsx(CommonPage, { ...pageProps, scrollContainer: globalThis, children: _jsxs(Stack, { children: [_jsx(Box, { ref: dimensions[0][0], sx: {
|
|
64
64
|
paddingBottom: pageProps.paddings
|
|
65
|
-
}, children: _jsx(SearchBar, { fields: f, onSubmit: onSubmit }) }), list] }) }));
|
|
65
|
+
}, children: rect && rect.width > 100 && (_jsx(SearchBar, { fields: f, onSubmit: onSubmit, top: searchBarTop, width: rect.width })) }), list] }) }));
|
|
66
66
|
}
|
package/package.json
CHANGED
package/src/SearchBar.tsx
CHANGED
|
@@ -45,6 +45,11 @@ export interface SearchBarProps {
|
|
|
45
45
|
* Top position, true means Toolbar's height
|
|
46
46
|
*/
|
|
47
47
|
top?: number | true;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Width
|
|
51
|
+
*/
|
|
52
|
+
width: number;
|
|
48
53
|
}
|
|
49
54
|
|
|
50
55
|
// Cached width attribute name
|
|
@@ -126,7 +131,8 @@ export function SearchBar(props: SearchBarProps) {
|
|
|
126
131
|
onSubmit,
|
|
127
132
|
itemGap = 6,
|
|
128
133
|
itemWidth = 160,
|
|
129
|
-
top
|
|
134
|
+
top,
|
|
135
|
+
width
|
|
130
136
|
} = props;
|
|
131
137
|
|
|
132
138
|
// Labels
|
|
@@ -337,7 +343,7 @@ export function SearchBar(props: SearchBarProps) {
|
|
|
337
343
|
|
|
338
344
|
// Layout
|
|
339
345
|
return (
|
|
340
|
-
<
|
|
346
|
+
<React.Fragment>
|
|
341
347
|
<form
|
|
342
348
|
id="SearchBarForm"
|
|
343
349
|
className={className}
|
|
@@ -347,12 +353,13 @@ export function SearchBar(props: SearchBarProps) {
|
|
|
347
353
|
}}
|
|
348
354
|
>
|
|
349
355
|
<Stack
|
|
356
|
+
ref={dimensions[0][0]}
|
|
350
357
|
className="SearchBarContainer"
|
|
351
358
|
justifyContent="center"
|
|
352
359
|
alignItems="center"
|
|
353
360
|
direction="row"
|
|
354
361
|
spacing={`${itemGap}px`}
|
|
355
|
-
width=
|
|
362
|
+
width={width}
|
|
356
363
|
overflow="hidden"
|
|
357
364
|
paddingTop="6px"
|
|
358
365
|
sx={{
|
|
@@ -429,6 +436,6 @@ export function SearchBar(props: SearchBarProps) {
|
|
|
429
436
|
</form>
|
|
430
437
|
</Drawer>
|
|
431
438
|
)}
|
|
432
|
-
</
|
|
439
|
+
</React.Fragment>
|
|
433
440
|
);
|
|
434
441
|
}
|
|
@@ -186,7 +186,14 @@ export function DataGridPage<T extends object, F>(
|
|
|
186
186
|
paddingBottom: pageProps.paddings
|
|
187
187
|
}}
|
|
188
188
|
>
|
|
189
|
-
|
|
189
|
+
{rect && rect.width > 100 && (
|
|
190
|
+
<SearchBar
|
|
191
|
+
fields={f}
|
|
192
|
+
onSubmit={onSubmit}
|
|
193
|
+
top={searchBarTop}
|
|
194
|
+
width={rect.width}
|
|
195
|
+
/>
|
|
196
|
+
)}
|
|
190
197
|
</Box>
|
|
191
198
|
{list}
|
|
192
199
|
</Stack>
|
|
@@ -179,7 +179,14 @@ export function FixedListPage<T extends object, F>(
|
|
|
179
179
|
<CommonPage {...pageRest} paddings={{}} scrollContainer={scrollContainer}>
|
|
180
180
|
<Stack>
|
|
181
181
|
<Box ref={dimensions[0][0]} sx={{ padding: paddings }}>
|
|
182
|
-
|
|
182
|
+
{rect && rect.width > 100 && (
|
|
183
|
+
<SearchBar
|
|
184
|
+
fields={f}
|
|
185
|
+
onSubmit={onSubmit}
|
|
186
|
+
top={searchBarTop}
|
|
187
|
+
width={rect.width}
|
|
188
|
+
/>
|
|
189
|
+
)}
|
|
183
190
|
</Box>
|
|
184
191
|
{list}
|
|
185
192
|
</Stack>
|
package/src/pages/ListPage.tsx
CHANGED
|
@@ -4,7 +4,8 @@ import {
|
|
|
4
4
|
ListOnScrollProps,
|
|
5
5
|
ScrollerListForwardRef,
|
|
6
6
|
ScrollerListRef,
|
|
7
|
-
useCombinedRefs
|
|
7
|
+
useCombinedRefs,
|
|
8
|
+
useDimensions
|
|
8
9
|
} from "@etsoo/react";
|
|
9
10
|
import { Box, Stack } from "@mui/material";
|
|
10
11
|
import React from "react";
|
|
@@ -36,6 +37,7 @@ export function ListPage<T extends object, F>(props: ListPageProps<T, F>) {
|
|
|
36
37
|
pageProps = {},
|
|
37
38
|
cacheKey,
|
|
38
39
|
cacheMinutes = 15,
|
|
40
|
+
sizeReadyMiliseconds = 0,
|
|
39
41
|
searchBarTop,
|
|
40
42
|
...rest
|
|
41
43
|
} = props;
|
|
@@ -78,6 +80,10 @@ export function ListPage<T extends object, F>(props: ListPageProps<T, F>) {
|
|
|
78
80
|
);
|
|
79
81
|
};
|
|
80
82
|
|
|
83
|
+
// Watch container
|
|
84
|
+
const { dimensions } = useDimensions(1, undefined, sizeReadyMiliseconds);
|
|
85
|
+
const rect = dimensions[0][2];
|
|
86
|
+
|
|
81
87
|
// Search data
|
|
82
88
|
const searchData = GridUtils.getSearchData(cacheKey);
|
|
83
89
|
|
|
@@ -123,11 +129,19 @@ export function ListPage<T extends object, F>(props: ListPageProps<T, F>) {
|
|
|
123
129
|
<CommonPage {...pageProps} scrollContainer={globalThis}>
|
|
124
130
|
<Stack>
|
|
125
131
|
<Box
|
|
132
|
+
ref={dimensions[0][0]}
|
|
126
133
|
sx={{
|
|
127
134
|
paddingBottom: pageProps.paddings
|
|
128
135
|
}}
|
|
129
136
|
>
|
|
130
|
-
|
|
137
|
+
{rect && rect.width > 100 && (
|
|
138
|
+
<SearchBar
|
|
139
|
+
fields={f}
|
|
140
|
+
onSubmit={onSubmit}
|
|
141
|
+
top={searchBarTop}
|
|
142
|
+
width={rect.width}
|
|
143
|
+
/>
|
|
144
|
+
)}
|
|
131
145
|
</Box>
|
|
132
146
|
<ScrollerListEx<T>
|
|
133
147
|
autoLoad={false}
|
package/src/pages/TablePage.tsx
CHANGED
|
@@ -48,6 +48,7 @@ export function TablePage<
|
|
|
48
48
|
pageProps = {},
|
|
49
49
|
cacheKey,
|
|
50
50
|
cacheMinutes = 15,
|
|
51
|
+
searchBarTop,
|
|
51
52
|
...rest
|
|
52
53
|
} = props;
|
|
53
54
|
|
|
@@ -139,7 +140,14 @@ export function TablePage<
|
|
|
139
140
|
paddingBottom: pageProps.paddings
|
|
140
141
|
}}
|
|
141
142
|
>
|
|
142
|
-
|
|
143
|
+
{rect && rect.width > 100 && (
|
|
144
|
+
<SearchBar
|
|
145
|
+
fields={f}
|
|
146
|
+
onSubmit={onSubmit}
|
|
147
|
+
top={searchBarTop}
|
|
148
|
+
width={rect.width}
|
|
149
|
+
/>
|
|
150
|
+
)}
|
|
143
151
|
</Box>
|
|
144
152
|
{list}
|
|
145
153
|
</Stack>
|