@etsoo/materialui 1.5.13 → 1.5.14

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/' ADDED
File without changes
@@ -59,7 +59,7 @@ function ResponsibleContainer(props) {
59
59
  return loadData(GridUtils_1.GridUtils.createLoader(props, fieldTemplate, cacheKey, false), lastItem);
60
60
  };
61
61
  // Search data
62
- const searchData = GridUtils_1.GridUtils.getSearchData(cacheKey);
62
+ const searchData = (0, react_2.useSearchParamsWithCache)(cacheKey);
63
63
  // On submit callback
64
64
  const onSubmit = (data, _reset) => {
65
65
  if (data == null || state.ref == null)
@@ -177,7 +177,7 @@ function ResponsibleContainer(props) {
177
177
  rect?.width == null ||
178
178
  rect.width < 20)
179
179
  return;
180
- const f = typeof fields == "function" ? fields(searchData ?? {}) : fields;
180
+ const f = typeof fields == "function" ? fields(searchData) : fields;
181
181
  return ((0, jsx_runtime_1.jsx)(SearchBar_1.SearchBar, { fields: f, onSubmit: onSubmit, className: `searchBar${showDataGrid ? "Grid" : "List"}`, width: rect.width, top: searchBarTop }));
182
182
  }, [showDataGrid, hasFields, searchBarHeight, rect?.width]);
183
183
  // Pull container
@@ -7,8 +7,8 @@ exports.SearchField = SearchField;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const react_1 = require("@etsoo/react");
9
9
  const react_2 = __importDefault(require("react"));
10
- const MUGlobal_1 = require("./MUGlobal");
11
10
  const TextField_1 = __importDefault(require("@mui/material/TextField"));
11
+ const MUGlobal_1 = require("./MUGlobal");
12
12
  /**
13
13
  * Search field
14
14
  * @param props Props
@@ -16,14 +16,13 @@ const TextField_1 = __importDefault(require("@mui/material/TextField"));
16
16
  */
17
17
  function SearchField(props) {
18
18
  // Destruct
19
- const { changeDelay, InputLabelProps = {}, InputProps = {}, inputProps = {}, onChange, readOnly, size = MUGlobal_1.MUGlobal.searchFieldSize, variant = MUGlobal_1.MUGlobal.searchFieldVariant, minChars = 0, ...rest } = props;
19
+ const { changeDelay, onChange, readOnly, slotProps = {}, size = MUGlobal_1.MUGlobal.searchFieldSize, variant = MUGlobal_1.MUGlobal.searchFieldVariant, minChars = 0, ...rest } = props;
20
20
  // Shrink
21
- InputLabelProps.shrink ??= MUGlobal_1.MUGlobal.searchFieldShrink;
22
- // Read only
23
- if (readOnly != null)
24
- InputProps.readOnly = readOnly;
25
- // Min characters
26
- inputProps["data-min-chars"] = minChars;
21
+ const defaultProps = {
22
+ input: { readOnly: readOnly },
23
+ inputLabel: { shrink: MUGlobal_1.MUGlobal.searchFieldShrink },
24
+ htmlInput: { "data-min-chars": minChars }
25
+ };
27
26
  const isMounted = react_2.default.useRef(true);
28
27
  const delayed = onChange != null && changeDelay != null && changeDelay >= 1
29
28
  ? (0, react_1.useDelayedExecutor)(onChange, changeDelay)
@@ -52,5 +51,5 @@ function SearchField(props) {
52
51
  };
53
52
  }, []);
54
53
  // Layout
55
- return ((0, jsx_runtime_1.jsx)(TextField_1.default, { InputLabelProps: InputLabelProps, InputProps: InputProps, inputProps: inputProps, onChange: onChangeEx, size: size, variant: variant, ...rest }));
54
+ return ((0, jsx_runtime_1.jsx)(TextField_1.default, { slotProps: Object.assign(slotProps, defaultProps), onChange: onChangeEx, size: size, variant: variant, ...rest }));
56
55
  }
@@ -44,7 +44,7 @@ function DataGridPage(props) {
44
44
  return loadData(GridUtils_1.GridUtils.createLoader(props, fieldTemplate, cacheKey, false), lastItem);
45
45
  };
46
46
  // Search data
47
- const searchData = GridUtils_1.GridUtils.getSearchData(cacheKey);
47
+ const searchData = (0, react_1.useSearchParamsWithCache)(cacheKey);
48
48
  const onInitLoad = (ref) => {
49
49
  // Avoid repeatedly load from cache
50
50
  if (initLoadedRef.current || !cacheKey)
@@ -50,7 +50,7 @@ function FixedListPage(props) {
50
50
  return loadData(GridUtils_1.GridUtils.createLoader(props, fieldTemplate, cacheKey, false), lastItem);
51
51
  };
52
52
  // Search data
53
- const searchData = GridUtils_1.GridUtils.getSearchData(cacheKey);
53
+ const searchData = (0, react_1.useSearchParamsWithCache)(cacheKey);
54
54
  const onInitLoad = (ref) => {
55
55
  // Avoid repeatedly load from cache
56
56
  if (initLoadedRef.current || !cacheKey)
@@ -51,7 +51,7 @@ function ListPage(props) {
51
51
  const { dimensions } = (0, react_1.useDimensions)(1, undefined, sizeReadyMiliseconds);
52
52
  const rect = dimensions[0][2];
53
53
  // Search data
54
- const searchData = GridUtils_1.GridUtils.getSearchData(cacheKey);
54
+ const searchData = (0, react_1.useSearchParamsWithCache)(cacheKey);
55
55
  const onInitLoad = (ref) => {
56
56
  // Avoid repeatedly load from cache
57
57
  if (initLoadedRef.current || !cacheKey)
@@ -47,7 +47,7 @@ function TablePage(props) {
47
47
  return loadData(GridUtils_1.GridUtils.createLoader(props, fieldTemplate, cacheKey, false), lastItem);
48
48
  };
49
49
  // Search data
50
- const searchData = GridUtils_1.GridUtils.getSearchData(cacheKey);
50
+ const searchData = (0, react_1.useSearchParamsWithCache)(cacheKey);
51
51
  // Total width
52
52
  const totalWidth = react_2.default.useMemo(() => columns.reduce((previousValue, { width, minWidth }) => {
53
53
  return previousValue + (width ?? minWidth ?? TableEx_1.TableExMinWidth);
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React from "react";
3
- import { ReactUtils, useCombinedRefs, useDimensions } from "@etsoo/react";
3
+ import { ReactUtils, useCombinedRefs, useDimensions, useSearchParamsWithCache } from "@etsoo/react";
4
4
  import { DataGridEx } from "./DataGridEx";
5
5
  import { MUGlobal } from "./MUGlobal";
6
6
  import { PullToRefreshUI } from "./PullToRefreshUI";
@@ -53,7 +53,7 @@ export function ResponsibleContainer(props) {
53
53
  return loadData(GridUtils.createLoader(props, fieldTemplate, cacheKey, false), lastItem);
54
54
  };
55
55
  // Search data
56
- const searchData = GridUtils.getSearchData(cacheKey);
56
+ const searchData = useSearchParamsWithCache(cacheKey);
57
57
  // On submit callback
58
58
  const onSubmit = (data, _reset) => {
59
59
  if (data == null || state.ref == null)
@@ -171,7 +171,7 @@ export function ResponsibleContainer(props) {
171
171
  rect?.width == null ||
172
172
  rect.width < 20)
173
173
  return;
174
- const f = typeof fields == "function" ? fields(searchData ?? {}) : fields;
174
+ const f = typeof fields == "function" ? fields(searchData) : fields;
175
175
  return (_jsx(SearchBar, { fields: f, onSubmit: onSubmit, className: `searchBar${showDataGrid ? "Grid" : "List"}`, width: rect.width, top: searchBarTop }));
176
176
  }, [showDataGrid, hasFields, searchBarHeight, rect?.width]);
177
177
  // Pull container
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useDelayedExecutor } from "@etsoo/react";
3
3
  import React from "react";
4
- import { MUGlobal } from "./MUGlobal";
5
4
  import TextField from "@mui/material/TextField";
5
+ import { MUGlobal } from "./MUGlobal";
6
6
  /**
7
7
  * Search field
8
8
  * @param props Props
@@ -10,14 +10,13 @@ import TextField from "@mui/material/TextField";
10
10
  */
11
11
  export function SearchField(props) {
12
12
  // Destruct
13
- const { changeDelay, InputLabelProps = {}, InputProps = {}, inputProps = {}, onChange, readOnly, size = MUGlobal.searchFieldSize, variant = MUGlobal.searchFieldVariant, minChars = 0, ...rest } = props;
13
+ const { changeDelay, onChange, readOnly, slotProps = {}, size = MUGlobal.searchFieldSize, variant = MUGlobal.searchFieldVariant, minChars = 0, ...rest } = props;
14
14
  // Shrink
15
- InputLabelProps.shrink ??= MUGlobal.searchFieldShrink;
16
- // Read only
17
- if (readOnly != null)
18
- InputProps.readOnly = readOnly;
19
- // Min characters
20
- inputProps["data-min-chars"] = minChars;
15
+ const defaultProps = {
16
+ input: { readOnly: readOnly },
17
+ inputLabel: { shrink: MUGlobal.searchFieldShrink },
18
+ htmlInput: { "data-min-chars": minChars }
19
+ };
21
20
  const isMounted = React.useRef(true);
22
21
  const delayed = onChange != null && changeDelay != null && changeDelay >= 1
23
22
  ? useDelayedExecutor(onChange, changeDelay)
@@ -46,5 +45,5 @@ export function SearchField(props) {
46
45
  };
47
46
  }, []);
48
47
  // Layout
49
- return (_jsx(TextField, { InputLabelProps: InputLabelProps, InputProps: InputProps, inputProps: inputProps, onChange: onChangeEx, size: size, variant: variant, ...rest }));
48
+ return (_jsx(TextField, { slotProps: Object.assign(slotProps, defaultProps), onChange: onChangeEx, size: size, variant: variant, ...rest }));
50
49
  }
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useCombinedRefs, useDimensions } from "@etsoo/react";
2
+ import { useCombinedRefs, useDimensions, useSearchParamsWithCache } from "@etsoo/react";
3
3
  import React from "react";
4
4
  import { DataGridEx } from "../DataGridEx";
5
5
  import { MUGlobal } from "../MUGlobal";
@@ -38,7 +38,7 @@ export function DataGridPage(props) {
38
38
  return loadData(GridUtils.createLoader(props, fieldTemplate, cacheKey, false), lastItem);
39
39
  };
40
40
  // Search data
41
- const searchData = GridUtils.getSearchData(cacheKey);
41
+ const searchData = useSearchParamsWithCache(cacheKey);
42
42
  const onInitLoad = (ref) => {
43
43
  // Avoid repeatedly load from cache
44
44
  if (initLoadedRef.current || !cacheKey)
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useCombinedRefs, useDimensions } from "@etsoo/react";
2
+ import { useCombinedRefs, useDimensions, useSearchParamsWithCache } from "@etsoo/react";
3
3
  import React from "react";
4
4
  import { MUGlobal } from "../MUGlobal";
5
5
  import { ScrollerListEx } from "../ScrollerListEx";
@@ -44,7 +44,7 @@ export function FixedListPage(props) {
44
44
  return loadData(GridUtils.createLoader(props, fieldTemplate, cacheKey, false), lastItem);
45
45
  };
46
46
  // Search data
47
- const searchData = GridUtils.getSearchData(cacheKey);
47
+ const searchData = useSearchParamsWithCache(cacheKey);
48
48
  const onInitLoad = (ref) => {
49
49
  // Avoid repeatedly load from cache
50
50
  if (initLoadedRef.current || !cacheKey)
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useCombinedRefs, useDimensions } from "@etsoo/react";
2
+ import { useCombinedRefs, useDimensions, useSearchParamsWithCache } from "@etsoo/react";
3
3
  import React from "react";
4
4
  import { MUGlobal } from "../MUGlobal";
5
5
  import { ScrollerListEx } from "../ScrollerListEx";
@@ -45,7 +45,7 @@ export function ListPage(props) {
45
45
  const { dimensions } = useDimensions(1, undefined, sizeReadyMiliseconds);
46
46
  const rect = dimensions[0][2];
47
47
  // Search data
48
- const searchData = GridUtils.getSearchData(cacheKey);
48
+ const searchData = useSearchParamsWithCache(cacheKey);
49
49
  const onInitLoad = (ref) => {
50
50
  // Avoid repeatedly load from cache
51
51
  if (initLoadedRef.current || !cacheKey)
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useCombinedRefs, useDimensions } from "@etsoo/react";
2
+ import { useCombinedRefs, useDimensions, useSearchParamsWithCache } from "@etsoo/react";
3
3
  import React from "react";
4
4
  import { MUGlobal } from "../MUGlobal";
5
5
  import { SearchBar } from "../SearchBar";
@@ -41,7 +41,7 @@ export function TablePage(props) {
41
41
  return loadData(GridUtils.createLoader(props, fieldTemplate, cacheKey, false), lastItem);
42
42
  };
43
43
  // Search data
44
- const searchData = GridUtils.getSearchData(cacheKey);
44
+ const searchData = useSearchParamsWithCache(cacheKey);
45
45
  // Total width
46
46
  const totalWidth = React.useMemo(() => columns.reduce((previousValue, { width, minWidth }) => {
47
47
  return previousValue + (width ?? minWidth ?? TableExMinWidth);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.5.13",
3
+ "version": "1.5.14",
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.0",
43
43
  "@etsoo/appscript": "^1.6.21",
44
44
  "@etsoo/notificationbase": "^1.1.60",
45
- "@etsoo/react": "^1.8.35",
45
+ "@etsoo/react": "^1.8.37",
46
46
  "@etsoo/shared": "^1.2.66",
47
47
  "@mui/icons-material": "^7.0.1",
48
48
  "@mui/material": "^7.0.1",
@@ -15,7 +15,8 @@ import {
15
15
  ReactUtils,
16
16
  ScrollerListRef,
17
17
  useCombinedRefs,
18
- useDimensions
18
+ useDimensions,
19
+ useSearchParamsWithCache
19
20
  } from "@etsoo/react";
20
21
  import { DataGridEx, DataGridExProps } from "./DataGridEx";
21
22
  import { MUGlobal } from "./MUGlobal";
@@ -252,7 +253,7 @@ export function ResponsibleContainer<T extends object, F>(
252
253
  };
253
254
 
254
255
  // Search data
255
- const searchData = GridUtils.getSearchData(cacheKey);
256
+ const searchData = useSearchParamsWithCache(cacheKey);
256
257
 
257
258
  // On submit callback
258
259
  const onSubmit = (data: FormData, _reset: boolean) => {
@@ -437,7 +438,7 @@ export function ResponsibleContainer<T extends object, F>(
437
438
  )
438
439
  return;
439
440
 
440
- const f = typeof fields == "function" ? fields(searchData ?? {}) : fields;
441
+ const f = typeof fields == "function" ? fields(searchData) : fields;
441
442
 
442
443
  return (
443
444
  <SearchBar
@@ -1,7 +1,7 @@
1
1
  import { useDelayedExecutor } from "@etsoo/react";
2
2
  import React from "react";
3
- import { MUGlobal } from "./MUGlobal";
4
3
  import TextField, { TextFieldProps } from "@mui/material/TextField";
4
+ import { MUGlobal } from "./MUGlobal";
5
5
 
6
6
  /**
7
7
  * Search field props
@@ -32,11 +32,9 @@ export function SearchField(props: SearchFieldProps) {
32
32
  // Destruct
33
33
  const {
34
34
  changeDelay,
35
- InputLabelProps = {},
36
- InputProps = {},
37
- inputProps = {},
38
35
  onChange,
39
36
  readOnly,
37
+ slotProps = {},
40
38
  size = MUGlobal.searchFieldSize,
41
39
  variant = MUGlobal.searchFieldVariant,
42
40
  minChars = 0,
@@ -44,13 +42,11 @@ export function SearchField(props: SearchFieldProps) {
44
42
  } = props;
45
43
 
46
44
  // Shrink
47
- InputLabelProps.shrink ??= MUGlobal.searchFieldShrink;
48
-
49
- // Read only
50
- if (readOnly != null) InputProps.readOnly = readOnly;
51
-
52
- // Min characters
53
- inputProps["data-min-chars"] = minChars;
45
+ const defaultProps: typeof slotProps = {
46
+ input: { readOnly: readOnly },
47
+ inputLabel: { shrink: MUGlobal.searchFieldShrink },
48
+ htmlInput: { "data-min-chars": minChars }
49
+ };
54
50
 
55
51
  const isMounted = React.useRef(true);
56
52
  const delayed =
@@ -90,9 +86,7 @@ export function SearchField(props: SearchFieldProps) {
90
86
  // Layout
91
87
  return (
92
88
  <TextField
93
- InputLabelProps={InputLabelProps}
94
- InputProps={InputProps}
95
- inputProps={inputProps}
89
+ slotProps={Object.assign(slotProps, defaultProps)}
96
90
  onChange={onChangeEx}
97
91
  size={size}
98
92
  variant={variant}
@@ -5,7 +5,8 @@ import {
5
5
  ScrollerGridForwardRef,
6
6
  VariableSizeGrid,
7
7
  useCombinedRefs,
8
- useDimensions
8
+ useDimensions,
9
+ useSearchParamsWithCache
9
10
  } from "@etsoo/react";
10
11
  import React from "react";
11
12
  import { DataGridEx } from "../DataGridEx";
@@ -84,7 +85,7 @@ export function DataGridPage<T extends object, F>(
84
85
  };
85
86
 
86
87
  // Search data
87
- const searchData = GridUtils.getSearchData(cacheKey);
88
+ const searchData = useSearchParamsWithCache(cacheKey);
88
89
 
89
90
  const onInitLoad = (
90
91
  ref: VariableSizeGrid<T>
@@ -5,7 +5,8 @@ import {
5
5
  ScrollerListForwardRef,
6
6
  ScrollerListRef,
7
7
  useCombinedRefs,
8
- useDimensions
8
+ useDimensions,
9
+ useSearchParamsWithCache
9
10
  } from "@etsoo/react";
10
11
  import React from "react";
11
12
  import { MUGlobal } from "../MUGlobal";
@@ -94,7 +95,7 @@ export function FixedListPage<T extends object, F>(
94
95
  };
95
96
 
96
97
  // Search data
97
- const searchData = GridUtils.getSearchData(cacheKey);
98
+ const searchData = useSearchParamsWithCache(cacheKey);
98
99
 
99
100
  const onInitLoad = (
100
101
  ref: ScrollerListRef
@@ -5,7 +5,8 @@ import {
5
5
  ScrollerListForwardRef,
6
6
  ScrollerListRef,
7
7
  useCombinedRefs,
8
- useDimensions
8
+ useDimensions,
9
+ useSearchParamsWithCache
9
10
  } from "@etsoo/react";
10
11
  import React from "react";
11
12
  import { MUGlobal } from "../MUGlobal";
@@ -86,7 +87,7 @@ export function ListPage<T extends object, F>(props: ListPageProps<T, F>) {
86
87
  const rect = dimensions[0][2];
87
88
 
88
89
  // Search data
89
- const searchData = GridUtils.getSearchData(cacheKey);
90
+ const searchData = useSearchParamsWithCache(cacheKey);
90
91
 
91
92
  const onInitLoad = (
92
93
  ref: ScrollerListRef
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  GridLoadDataProps,
3
3
  useCombinedRefs,
4
- useDimensions
4
+ useDimensions,
5
+ useSearchParamsWithCache
5
6
  } from "@etsoo/react";
6
7
  import { DataTypes, IdDefaultType } from "@etsoo/shared";
7
8
  import React from "react";
@@ -93,7 +94,7 @@ export function TablePage<
93
94
  };
94
95
 
95
96
  // Search data
96
- const searchData = GridUtils.getSearchData(cacheKey);
97
+ const searchData = useSearchParamsWithCache(cacheKey);
97
98
 
98
99
  // Total width
99
100
  const totalWidth = React.useMemo(