@etsoo/materialui 1.4.3 → 1.4.5

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.
@@ -1,6 +1,7 @@
1
1
  import { AddressApi, AddressCity, AddressDistrict, AddressRegionDb, AddressState } from "@etsoo/appscript";
2
+ import { GridSize } from "@mui/material";
2
3
  import React from "react";
3
- import { RegularBreakpoints } from "@mui/material/Grid";
4
+ import { ResponsiveStyleValue } from "./ResponsiveStyleValue";
4
5
  /**
5
6
  * Address field
6
7
  */
@@ -23,7 +24,7 @@ export type AddressSelectorProps = {
23
24
  /**
24
25
  * Break points
25
26
  */
26
- breakPoints?: RegularBreakpoints;
27
+ breakPoints?: ResponsiveStyleValue<GridSize>;
27
28
  /**
28
29
  * City
29
30
  */
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { FormLabel, Grid } from "@mui/material";
2
+ import { FormLabel, Grid2 } from "@mui/material";
3
3
  import React from "react";
4
4
  import { globalApp } from "./app/ReactApp";
5
5
  import { ComboBox } from "./ComboBox";
@@ -123,12 +123,12 @@ export function AddressSelector(props) {
123
123
  }
124
124
  };
125
125
  // Layout
126
- return (_jsxs(React.Fragment, { children: [label && (_jsx(Grid, { item: true, xs: 12, children: _jsx(FormLabel, { required: required, sx: { fontSize: (theme) => theme.typography.caption }, children: label }) })), !hideRegion && (_jsx(Grid, { item: true, ...breakPoints, children: _jsx(Tiplist, { label: regionLabel, name: AddressField.Region, search: search, fullWidth: true, idValue: regionState, loadData: (keyword, id, items) => api.getRegions({
126
+ return (_jsxs(React.Fragment, { children: [label && (_jsx(Grid2, { size: { xs: 12 }, children: _jsx(FormLabel, { required: required, sx: { fontSize: (theme) => theme.typography.caption }, children: label }) })), !hideRegion && (_jsx(Grid2, { size: breakPoints, children: _jsx(Tiplist, { label: regionLabel, name: AddressField.Region, search: search, fullWidth: true, idValue: regionState, loadData: (keyword, id, items) => api.getRegions({
127
127
  keyword,
128
128
  id,
129
129
  items,
130
130
  favoredIds: favoredIds == null
131
131
  ? undefined
132
132
  : favoredIds(AddressField.Region)
133
- }), inputRequired: required, inputError: error, inputHelperText: helperText, onChange: (_event, value) => handleChange([AddressField.Region, value]) }) })), _jsx(Grid, { item: true, ...breakPoints, children: _jsx(ComboBox, { name: AddressField.State, label: stateLabel, search: search, fullWidth: true, idValue: stateState, options: states, inputRequired: required, inputError: hideRegion ? error : undefined, inputHelperText: hideRegion ? helperText : undefined, onChange: (_event, value) => handleChange([AddressField.State, value]) }) }), _jsx(Grid, { item: true, ...breakPoints, children: _jsx(ComboBox, { name: AddressField.City, label: cityLabel, search: search, fullWidth: true, idValue: cityState, options: cities, onChange: (_event, value) => handleChange([AddressField.City, value]) }) }), _jsx(Grid, { item: true, ...breakPoints, children: _jsx(ComboBox, { name: AddressField.District, label: districtLabel, search: search, fullWidth: true, idValue: districtState, options: districts, onChange: (_event, value) => handleChange([AddressField.District, value]) }) })] }));
133
+ }), inputRequired: required, inputError: error, inputHelperText: helperText, onChange: (_event, value) => handleChange([AddressField.Region, value]) }) })), _jsx(Grid2, { size: breakPoints, children: _jsx(ComboBox, { name: AddressField.State, label: stateLabel, search: search, fullWidth: true, idValue: stateState, options: states, inputRequired: required, inputError: hideRegion ? error : undefined, inputHelperText: hideRegion ? helperText : undefined, onChange: (_event, value) => handleChange([AddressField.State, value]) }) }), _jsx(Grid2, { size: breakPoints, children: _jsx(ComboBox, { name: AddressField.City, label: cityLabel, search: search, fullWidth: true, idValue: cityState, options: cities, onChange: (_event, value) => handleChange([AddressField.City, value]) }) }), _jsx(Grid2, { size: breakPoints, children: _jsx(ComboBox, { name: AddressField.District, label: districtLabel, search: search, fullWidth: true, idValue: districtState, options: districts, onChange: (_event, value) => handleChange([AddressField.District, value]) }) })] }));
134
134
  }
@@ -1,7 +1,7 @@
1
1
  import { DataTypes, IdDefaultType, LabelDefaultType } from "@etsoo/shared";
2
- import { SelectChangeEvent } from "@mui/material";
2
+ import { GridSize, SelectChangeEvent } from "@mui/material";
3
3
  import React from "react";
4
- import { RegularBreakpoints } from "@mui/material/Grid";
4
+ import { ResponsiveStyleValue } from "./ResponsiveStyleValue";
5
5
  /**
6
6
  * Hierarchy selector props
7
7
  */
@@ -9,7 +9,7 @@ export type HiSelectorProps<T extends object, D extends DataTypes.Keys<T> = IdDe
9
9
  /**
10
10
  * Break points
11
11
  */
12
- breakPoints?: RegularBreakpoints;
12
+ breakPoints?: ResponsiveStyleValue<GridSize>;
13
13
  /**
14
14
  * Id field
15
15
  */
package/lib/HiSelector.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { FormLabel, Grid } from "@mui/material";
2
+ import { FormLabel, Grid2 } from "@mui/material";
3
3
  import React from "react";
4
4
  import { SelectEx } from "./SelectEx";
5
5
  /**
@@ -39,5 +39,5 @@ export function HiSelector(props) {
39
39
  React.useEffect(() => {
40
40
  updateValue(currentValue);
41
41
  }, [currentValue]);
42
- return (_jsxs(React.Fragment, { children: [label && (_jsx(Grid, { item: true, xs: 12, children: _jsx(FormLabel, { required: required, sx: { fontSize: (theme) => theme.typography.caption }, children: label }) })), _jsx("input", { type: "hidden", name: name, value: `${currentValue ?? ""}` }), _jsx(Grid, { item: true, ...breakPoints, children: _jsx(SelectEx, { idField: idField, label: labels[0], labelField: labelField, name: "tab1", search: search, fullWidth: true, loadData: () => loadData(), value: values[0], onChange: (event) => doChange(event, 0), onItemChange: doItemChange, required: required, error: error, helperText: helperText, variant: variant }) }), localValues[0] != null && (_jsx(Grid, { item: true, ...breakPoints, children: _jsx(SelectEx, { idField: idField, label: labels[1], labelField: labelField, name: "tab2", search: search, fullWidth: true, loadData: () => loadData(localValues[0]), value: values[1], onChange: (event) => doChange(event, 1), onItemChange: doItemChange, variant: variant }, `${localValues[0]}`) })), localValues[1] != null && (_jsx(Grid, { item: true, ...breakPoints, children: _jsx(SelectEx, { idField: idField, label: labels[2], labelField: labelField, name: "tab3", search: search, fullWidth: true, loadData: () => loadData(localValues[1]), value: values[2], onChange: (event) => doChange(event, 2), onItemChange: doItemChange, variant: variant }, `${localValues[1]}`) })), localValues[2] != null && (_jsx(Grid, { item: true, ...breakPoints, children: _jsx(SelectEx, { idField: idField, label: labels[3], labelField: labelField, name: "tab4", search: search, fullWidth: true, loadData: () => loadData(localValues[2]), value: values[3], onChange: (event) => doChange(event, 3), onItemChange: doItemChange, variant: variant }, `${localValues[2]}`) }))] }));
42
+ return (_jsxs(React.Fragment, { children: [label && (_jsx(Grid2, { size: { xs: 12 }, children: _jsx(FormLabel, { required: required, sx: { fontSize: (theme) => theme.typography.caption }, children: label }) })), _jsx("input", { type: "hidden", name: name, value: `${currentValue ?? ""}` }), _jsx(Grid2, { size: breakPoints, children: _jsx(SelectEx, { idField: idField, label: labels[0], labelField: labelField, name: "tab1", search: search, fullWidth: true, loadData: () => loadData(), value: values[0], onChange: (event) => doChange(event, 0), onItemChange: doItemChange, required: required, error: error, helperText: helperText, variant: variant }) }), localValues[0] != null && (_jsx(Grid2, { size: breakPoints, children: _jsx(SelectEx, { idField: idField, label: labels[1], labelField: labelField, name: "tab2", search: search, fullWidth: true, loadData: () => loadData(localValues[0]), value: values[1], onChange: (event) => doChange(event, 1), onItemChange: doItemChange, variant: variant }, `${localValues[0]}`) })), localValues[1] != null && (_jsx(Grid2, { size: breakPoints, children: _jsx(SelectEx, { idField: idField, label: labels[2], labelField: labelField, name: "tab3", search: search, fullWidth: true, loadData: () => loadData(localValues[1]), value: values[2], onChange: (event) => doChange(event, 2), onItemChange: doItemChange, variant: variant }, `${localValues[1]}`) })), localValues[2] != null && (_jsx(Grid2, { size: breakPoints, children: _jsx(SelectEx, { idField: idField, label: labels[3], labelField: labelField, name: "tab4", search: search, fullWidth: true, loadData: () => loadData(localValues[2]), value: values[3], onChange: (event) => doChange(event, 3), onItemChange: doItemChange, variant: variant }, `${localValues[2]}`) }))] }));
43
43
  }
@@ -1,7 +1,7 @@
1
1
  import { DataTypes, IdDefaultType } from "@etsoo/shared";
2
- import { AutocompleteChangeReason } from "@mui/material";
2
+ import { AutocompleteChangeReason, GridSize } from "@mui/material";
3
3
  import React from "react";
4
- import { RegularBreakpoints } from "@mui/material/Grid";
4
+ import { ResponsiveStyleValue } from "./ResponsiveStyleValue";
5
5
  /**
6
6
  * Hierarchy tiplist selector props
7
7
  */
@@ -9,7 +9,7 @@ export type HiSelectorTLProps<T extends object, D extends DataTypes.Keys<T> = Id
9
9
  /**
10
10
  * Break points
11
11
  */
12
- breakPoints?: RegularBreakpoints;
12
+ breakPoints?: ResponsiveStyleValue<GridSize>;
13
13
  /**
14
14
  * Id field
15
15
  */
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { FormLabel, Grid } from "@mui/material";
2
+ import { FormLabel, Grid2 } from "@mui/material";
3
3
  import React from "react";
4
4
  import { Tiplist } from "./Tiplist";
5
5
  /**
@@ -33,5 +33,5 @@ export function HiSelectorTL(props) {
33
33
  React.useEffect(() => {
34
34
  updateValue(currentValue);
35
35
  }, [currentValue]);
36
- return (_jsxs(React.Fragment, { children: [label && (_jsx(Grid, { item: true, xs: 12, children: _jsx(FormLabel, { required: required, sx: { fontSize: (theme) => theme.typography.caption }, children: label }) })), _jsx("input", { type: "hidden", name: name, value: `${currentValue ?? ""}` }), _jsx(Grid, { item: true, ...breakPoints, children: _jsx(Tiplist, { idField: idField, label: labels[0], name: "tab1", search: search, fullWidth: true, idValue: values[0], loadData: (keyword, id, items) => loadData(keyword, id, items), inputRequired: required, inputError: error, inputHelperText: helperText, onChange: (event, value, reason) => doChange(0, event, value, reason) }) }), localValues[0] != null && (_jsx(Grid, { item: true, ...breakPoints, children: _jsx(Tiplist, { label: labels[1], idField: idField, name: "tab2", search: search, fullWidth: true, loadData: (keyword, id, items) => loadData(keyword, id, items, localValues[0]), idValue: values[1], onChange: (event, value, reason) => doChange(1, event, value, reason) }, `${localValues[0]}`) })), localValues[1] != null && (_jsx(Grid, { item: true, ...breakPoints, children: _jsx(Tiplist, { label: labels[2], idField: idField, name: "tab3", search: search, fullWidth: true, loadData: (keyword, id, items) => loadData(keyword, id, items, localValues[1]), idValue: values[2], onChange: (event, value, reason) => doChange(2, event, value, reason) }, `${localValues[1]}`) })), localValues[2] != null && (_jsx(Grid, { item: true, ...breakPoints, children: _jsx(Tiplist, { label: labels[3], idField: idField, name: "tab4", search: search, fullWidth: true, loadData: (keyword, id, items) => loadData(keyword, id, items, localValues[2]), idValue: values[3], onChange: (event, value, reason) => doChange(3, event, value, reason) }, `${localValues[2]}`) }))] }));
36
+ return (_jsxs(React.Fragment, { children: [label && (_jsx(Grid2, { size: { xs: 12 }, children: _jsx(FormLabel, { required: required, sx: { fontSize: (theme) => theme.typography.caption }, children: label }) })), _jsx("input", { type: "hidden", name: name, value: `${currentValue ?? ""}` }), _jsx(Grid2, { size: breakPoints, children: _jsx(Tiplist, { idField: idField, label: labels[0], name: "tab1", search: search, fullWidth: true, idValue: values[0], loadData: (keyword, id, items) => loadData(keyword, id, items), inputRequired: required, inputError: error, inputHelperText: helperText, onChange: (event, value, reason) => doChange(0, event, value, reason) }) }), localValues[0] != null && (_jsx(Grid2, { size: breakPoints, children: _jsx(Tiplist, { label: labels[1], idField: idField, name: "tab2", search: search, fullWidth: true, loadData: (keyword, id, items) => loadData(keyword, id, items, localValues[0]), idValue: values[1], onChange: (event, value, reason) => doChange(1, event, value, reason) }, `${localValues[0]}`) })), localValues[1] != null && (_jsx(Grid2, { size: breakPoints, children: _jsx(Tiplist, { label: labels[2], idField: idField, name: "tab3", search: search, fullWidth: true, loadData: (keyword, id, items) => loadData(keyword, id, items, localValues[1]), idValue: values[2], onChange: (event, value, reason) => doChange(2, event, value, reason) }, `${localValues[1]}`) })), localValues[2] != null && (_jsx(Grid2, { size: breakPoints, children: _jsx(Tiplist, { label: labels[3], idField: idField, name: "tab4", search: search, fullWidth: true, loadData: (keyword, id, items) => loadData(keyword, id, items, localValues[2]), idValue: values[3], onChange: (event, value, reason) => doChange(3, event, value, reason) }, `${localValues[2]}`) }))] }));
37
37
  }
@@ -0,0 +1,7 @@
1
+ import { Breakpoint } from "@mui/material";
2
+ /**
3
+ * Responsive style value
4
+ */
5
+ export type ResponsiveStyleValue<T> = T | Array<T | null> | {
6
+ [key in Breakpoint]?: T | null;
7
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,7 +1,7 @@
1
1
  import { CustomFieldData, CustomFieldSpace } from "@etsoo/appscript";
2
2
  import { CustomFieldReactCollection, ICustomFieldReact } from "@etsoo/react";
3
3
  import { IdType, ListType2 } from "@etsoo/shared";
4
- import { GridProps } from "@mui/material";
4
+ import { GridSize } from "@mui/material";
5
5
  import { TypographyProps } from "@mui/material/Typography";
6
6
  /**
7
7
  * Custom field utilities
@@ -34,7 +34,13 @@ export declare namespace CustomFieldUtils {
34
34
  * @param space Space
35
35
  * @returns Result
36
36
  */
37
- function transformSpace(space?: CustomFieldSpace): GridProps;
37
+ function transformSpace(space?: CustomFieldSpace): {
38
+ xs?: GridSize | null | undefined;
39
+ sm?: GridSize | null | undefined;
40
+ md?: GridSize | null | undefined;
41
+ lg?: GridSize | null | undefined;
42
+ xl?: GridSize | null | undefined;
43
+ };
38
44
  /**
39
45
  * Update ref options
40
46
  * @param fields Fields
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Grid, Typography } from "@mui/material";
2
+ import { Grid2, Typography } from "@mui/material";
3
3
  import React from "react";
4
4
  import { FieldCheckbox } from "./FieldCheckbox";
5
5
  import { FieldAmountLabel } from "./FieldAmountLabel";
@@ -63,7 +63,7 @@ export var CustomFieldUtils;
63
63
  fieldCalback(field);
64
64
  const creator = CustomFieldUtils.customFieldCreators[field.type];
65
65
  if (creator == null) {
66
- return (_jsx(Grid, { item: true, ...field.gridItemProps, ...transformSpace(field.space), children: `Type ${field.type} is not supported currently` }, index));
66
+ return (_jsx(Grid2, { size: transformSpace(field.space), ...field.gridItemProps, children: `Type ${field.type} is not supported currently` }, index));
67
67
  }
68
68
  const Creator = creator;
69
69
  const mref = React.createRef();
@@ -77,7 +77,7 @@ export var CustomFieldUtils;
77
77
  ui = `Duplicate custom field ${name}`;
78
78
  }
79
79
  }
80
- return (_jsx(Grid, { item: true, ...field.gridItemProps, ...transformSpace(field.space), children: ui }, name ?? index));
80
+ return (_jsx(Grid2, { size: transformSpace(field.space), ...field.gridItemProps, children: ui }, name ?? index));
81
81
  });
82
82
  }
83
83
  CustomFieldUtils.create = create;
@@ -97,7 +97,7 @@ export var CustomFieldUtils;
97
97
  * @returns Result
98
98
  */
99
99
  function transformSpace(space) {
100
- const props = space === "full"
100
+ const size = space === "full"
101
101
  ? { xs: 12 }
102
102
  : space === "quater"
103
103
  ? { sm: 12, md: 6, lg: 3 }
@@ -108,7 +108,7 @@ export var CustomFieldUtils;
108
108
  : space === "half1"
109
109
  ? { xs: 12, sm: 6 }
110
110
  : { sm: 12, md: 6 };
111
- return props;
111
+ return size;
112
112
  }
113
113
  CustomFieldUtils.transformSpace = transformSpace;
114
114
  /**
@@ -1,5 +1,5 @@
1
1
  import { CustomFieldData } from "@etsoo/appscript";
2
- import { GridProps, TypographyProps } from "@mui/material";
2
+ import { Grid2Props, TypographyProps } from "@mui/material";
3
3
  /**
4
4
  * Custom field viewer props
5
5
  * 自定义字段查看器属性
@@ -14,7 +14,7 @@ export type CustomFieldViewerProps = {
14
14
  * Grid props
15
15
  * 网格属性
16
16
  */
17
- gridProps?: GridProps;
17
+ gridProps?: Grid2Props;
18
18
  /**
19
19
  * JSON data
20
20
  * JSON 数据
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Grid, Typography } from "@mui/material";
2
+ import { Grid2, Typography } from "@mui/material";
3
3
  import { CustomFieldUtils } from "./CustomFieldUtils";
4
4
  import { MUGlobal } from "../MUGlobal";
5
5
  import { VBox } from "../FlexBox";
@@ -38,7 +38,7 @@ export function CustomFieldViewer(props) {
38
38
  if (data == null || typeof data !== "object" || Array.isArray(data)) {
39
39
  throw new Error("Invalid JSON data");
40
40
  }
41
- return (_jsx(Grid, { container: true, justifyContent: "left", spacing: spacing, sx: {
41
+ return (_jsx(Grid2, { container: true, justifyContent: "left", spacing: spacing, sx: {
42
42
  ".MuiTypography-subtitle2": {
43
43
  fontWeight: "bold"
44
44
  }
@@ -49,6 +49,6 @@ export function CustomFieldViewer(props) {
49
49
  return;
50
50
  // Field value
51
51
  const value = Utils.getNestedValue(data, name);
52
- return (_jsx(Grid, { item: true, ...field.gridItemProps, ...CustomFieldUtils.transformSpace(field.space), children: _jsxs(VBox, { gap: verticalGap, children: [_jsx(Typography, { fontWeight: "bold", fontSize: "small", ...titleProps, children: field.label ?? name }), _jsx(Typography, { ...valueProps, children: valueLabelFormatter(value, field) })] }) }, name ?? index));
52
+ return (_jsx(Grid2, { size: CustomFieldUtils.transformSpace(field.space), ...field.gridItemProps, children: _jsxs(VBox, { gap: verticalGap, children: [_jsx(Typography, { fontWeight: "bold", fontSize: "small", ...titleProps, children: field.label ?? name }), _jsx(Typography, { ...valueProps, children: valueLabelFormatter(value, field) })] }) }, name ?? index));
53
53
  }) }));
54
54
  }
@@ -1,5 +1,5 @@
1
1
  import { CustomFieldData } from "@etsoo/appscript";
2
- import { GridProps } from "@mui/material";
2
+ import { Grid2Props } from "@mui/material";
3
3
  import React from "react";
4
4
  /**
5
5
  * Custom field window props
@@ -24,7 +24,7 @@ export type CustomFieldWindowProps<D extends CustomFieldData> = {
24
24
  * Grid props
25
25
  * 网格属性
26
26
  */
27
- gridProps?: GridProps;
27
+ gridProps?: Grid2Props;
28
28
  /**
29
29
  * JSON data
30
30
  * JSON 数据
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Utils } from "@etsoo/shared";
3
- import { Grid, Stack } from "@mui/material";
3
+ import { Grid2, Stack } from "@mui/material";
4
4
  import React from "react";
5
5
  import { globalApp } from "../app/ReactApp";
6
6
  import { MUGlobal } from "../MUGlobal";
@@ -73,7 +73,7 @@ export function CustomFieldWindow(props) {
73
73
  }
74
74
  }, {
75
75
  fullScreen: app.smDown,
76
- inputs: (_jsx(Stack, { marginTop: 1.5, children: _jsx(Grid, { container: true, justifyContent: "left", spacing: spacing, sx: {
76
+ inputs: (_jsx(Stack, { marginTop: 1.5, children: _jsx(Grid2, { container: true, justifyContent: "left", spacing: spacing, sx: {
77
77
  ".MuiTypography-subtitle2": {
78
78
  fontWeight: "bold"
79
79
  }
package/lib/index.d.ts CHANGED
@@ -90,6 +90,7 @@ export * from "./ProgressCount";
90
90
  export * from "./PullToRefreshUI";
91
91
  export * from "./QuickList";
92
92
  export * from "./ResponsibleContainer";
93
+ export * from "./ResponsiveStyleValue";
93
94
  export * from "./ScrollerListEx";
94
95
  export * from "./ScrollTopFab";
95
96
  export * from "./SearchBar";
package/lib/index.js CHANGED
@@ -90,6 +90,7 @@ export * from "./ProgressCount";
90
90
  export * from "./PullToRefreshUI";
91
91
  export * from "./QuickList";
92
92
  export * from "./ResponsibleContainer";
93
+ export * from "./ResponsiveStyleValue";
93
94
  export * from "./ScrollerListEx";
94
95
  export * from "./ScrollTopFab";
95
96
  export * from "./SearchBar";
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Button, Grid } from "@mui/material";
2
+ import { Button, Grid2 } from "@mui/material";
3
3
  import { MUGlobal } from "../MUGlobal";
4
4
  import { CommonPage } from "./CommonPage";
5
5
  import SaveIcon from "@mui/icons-material/Save";
@@ -16,7 +16,7 @@ export function EditPage(props) {
16
16
  const { children, isEditing, onDelete, onSubmit, paddings = MUGlobal.pagePaddings, scrollContainer = globalThis, supportBack = true, submitDisabled = false, bottomPart, topPart, operationMessageHandler, ...rest } = props;
17
17
  // Labels
18
18
  const labels = Labels.CommonPage;
19
- return (_jsxs(CommonPage, { paddings: paddings, scrollContainer: scrollContainer, ...rest, children: [operationMessageHandler && (_jsx(OperationMessageContainer, { handler: operationMessageHandler })), topPart, _jsxs("form", { onSubmit: onSubmit, children: [_jsx(Grid, { container: true, justifyContent: "left", spacing: paddings, paddingTop: 1, children: children }), _jsxs(Grid, { container: true, position: "sticky", display: "flex", gap: paddings, sx: {
19
+ return (_jsxs(CommonPage, { paddings: paddings, scrollContainer: scrollContainer, ...rest, children: [operationMessageHandler && (_jsx(OperationMessageContainer, { handler: operationMessageHandler })), topPart, _jsxs("form", { onSubmit: onSubmit, children: [_jsx(Grid2, { container: true, justifyContent: "left", spacing: paddings, paddingTop: 1, children: children }), _jsxs(Grid2, { container: true, position: "sticky", display: "flex", gap: paddings, sx: {
20
20
  top: "auto",
21
21
  bottom: (theme) => MUGlobal.updateWithTheme(paddings, theme.spacing),
22
22
  paddingTop: paddings
@@ -1,13 +1,13 @@
1
1
  import { GridColumnRenderProps, GridDataType } from "@etsoo/react";
2
2
  import { DataTypes } from "@etsoo/shared";
3
- import { GridProps } from "@mui/material";
3
+ import { Grid2Props } from "@mui/material";
4
4
  import React from "react";
5
5
  import { CommonPageProps } from "./CommonPage";
6
6
  import type { OperationMessageHandlerAll } from "../messages/OperationMessageHandler";
7
7
  /**
8
8
  * View page grid item properties
9
9
  */
10
- export type ViewPageGridItemProps = GridProps & {
10
+ export type ViewPageGridItemProps = Grid2Props & {
11
11
  data: React.ReactNode;
12
12
  label?: React.ReactNode;
13
13
  singleRow?: ViewPageRowType;
@@ -25,7 +25,7 @@ export type ViewPageRowType = boolean | "default" | "small" | "medium" | object;
25
25
  /**
26
26
  * View page display field
27
27
  */
28
- export interface ViewPageField<T extends object> extends GridProps {
28
+ export interface ViewPageField<T extends object> extends Grid2Props {
29
29
  /**
30
30
  * Data field
31
31
  */
@@ -2,7 +2,7 @@ import { createElement as _createElement } from "react";
2
2
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
3
3
  import { ScrollRestoration } from "@etsoo/react";
4
4
  import { DateUtils, Utils } from "@etsoo/shared";
5
- import { Grid, LinearProgress, Stack, Typography } from "@mui/material";
5
+ import { Grid2, LinearProgress, Stack, Typography } from "@mui/material";
6
6
  import React from "react";
7
7
  import { Labels } from "../app/Labels";
8
8
  import { globalApp } from "../app/ReactApp";
@@ -22,14 +22,14 @@ export function ViewPageGridItem(props) {
22
22
  const { data, label, singleRow, ...gridProps } = props;
23
23
  // Default options
24
24
  let options = {};
25
- if (gridProps.xs == null && gridProps.md == null) {
25
+ if (gridProps.size == null) {
26
26
  options = getResp(singleRow ?? "small");
27
27
  }
28
28
  else if (singleRow != null) {
29
29
  options = getResp(singleRow ?? "small");
30
30
  }
31
31
  // Layout
32
- return (_jsxs(Grid, { item: true, ...gridProps, ...options, children: [label != null && (_jsxs(Typography, { variant: "caption", component: "div", children: [label, ":"] })), typeof data === "object" ? (data) : (_jsx(Typography, { variant: "subtitle2", children: data }))] }));
32
+ return (_jsxs(Grid2, { ...gridProps, ...options, children: [label != null && (_jsxs(Typography, { variant: "caption", component: "div", children: [label, ":"] })), typeof data === "object" ? (data) : (_jsx(Typography, { variant: "subtitle2", children: data }))] }));
33
33
  }
34
34
  function formatItemData(fieldData) {
35
35
  if (fieldData == null)
@@ -43,7 +43,7 @@ function formatItemData(fieldData) {
43
43
  return `${fieldData}`;
44
44
  }
45
45
  function getResp(singleRow) {
46
- return typeof singleRow === "object"
46
+ const size = typeof singleRow === "object"
47
47
  ? singleRow
48
48
  : singleRow === "medium"
49
49
  ? { xs: 12, sm: 12, md: 6, lg: 4, xl: 3 }
@@ -56,6 +56,7 @@ function getResp(singleRow) {
56
56
  lg: 3,
57
57
  xl: 2
58
58
  };
59
+ return { size };
59
60
  }
60
61
  function getItemField(field, data) {
61
62
  // Item data and label
@@ -129,7 +130,7 @@ export function ViewPage(props) {
129
130
  refresh,
130
131
  operationMessageHandler.id
131
132
  ]
132
- : operationMessageHandler })), _jsx(Grid, { container: true, justifyContent: "left", spacing: spacing, className: "ET-ViewPage", ref: gridRef, sx: {
133
+ : operationMessageHandler })), _jsx(Grid2, { container: true, justifyContent: "left", spacing: spacing, className: "ET-ViewPage", ref: gridRef, sx: {
133
134
  ".MuiTypography-subtitle2": {
134
135
  fontWeight: "bold"
135
136
  }
@@ -144,7 +145,7 @@ export function ViewPage(props) {
144
145
  if (itemData == null || itemData === "")
145
146
  return undefined;
146
147
  // Layout
147
- return (_createElement(ViewPageGridItem, { item: true, ...gridProps, key: index, data: itemData, label: itemLabel }));
148
+ return (_createElement(ViewPageGridItem, { ...gridProps, key: index, data: itemData, label: itemLabel }));
148
149
  }) }), actions !== null && (_jsx(Stack, { className: "ET-ViewPage-Actions", direction: "row", width: "100%", flexWrap: "wrap", justifyContent: "flex-end", paddingTop: actions == null ? undefined : paddings, paddingBottom: paddings, gap: paddings, children: actions != null && Utils.getResult(actions, data, refresh) })), Utils.getResult(children, data, refresh), pullToRefresh && (_jsx(PullToRefreshUI, { mainElement: pullContainer, triggerElement: pullContainer, instructionsPullToRefresh: labels.pullToRefresh, instructionsReleaseToRefresh: labels.releaseToRefresh, instructionsRefreshing: labels.refreshing, onRefresh: refresh, shouldPullToRefresh: () => {
149
150
  const container = document.querySelector(pullContainer);
150
151
  return !container?.scrollTop;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.4.3",
3
+ "version": "1.4.5",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -50,9 +50,9 @@
50
50
  "@emotion/css": "^11.13.4",
51
51
  "@emotion/react": "^11.13.3",
52
52
  "@emotion/styled": "^11.13.0",
53
- "@etsoo/appscript": "^1.5.38",
53
+ "@etsoo/appscript": "^1.5.39",
54
54
  "@etsoo/notificationbase": "^1.1.49",
55
- "@etsoo/react": "^1.7.74",
55
+ "@etsoo/react": "^1.7.75",
56
56
  "@etsoo/shared": "^1.2.48",
57
57
  "@mui/icons-material": "^6.1.3",
58
58
  "@mui/material": "^6.1.3",
@@ -5,12 +5,12 @@ import {
5
5
  AddressRegionDb,
6
6
  AddressState
7
7
  } from "@etsoo/appscript";
8
- import { FormLabel, Grid } from "@mui/material";
8
+ import { FormLabel, Grid2, GridSize } from "@mui/material";
9
9
  import React from "react";
10
10
  import { globalApp } from "./app/ReactApp";
11
11
  import { ComboBox } from "./ComboBox";
12
12
  import { Tiplist } from "./Tiplist";
13
- import { RegularBreakpoints } from "@mui/material/Grid";
13
+ import { ResponsiveStyleValue } from "./ResponsiveStyleValue";
14
14
 
15
15
  /**
16
16
  * Address field
@@ -48,7 +48,7 @@ export type AddressSelectorProps = {
48
48
  /**
49
49
  * Break points
50
50
  */
51
- breakPoints?: RegularBreakpoints;
51
+ breakPoints?: ResponsiveStyleValue<GridSize>;
52
52
 
53
53
  /**
54
54
  * City
@@ -287,17 +287,17 @@ export function AddressSelector(props: AddressSelectorProps) {
287
287
  return (
288
288
  <React.Fragment>
289
289
  {label && (
290
- <Grid item xs={12}>
290
+ <Grid2 size={{ xs: 12 }}>
291
291
  <FormLabel
292
292
  required={required}
293
293
  sx={{ fontSize: (theme) => theme.typography.caption }}
294
294
  >
295
295
  {label}
296
296
  </FormLabel>
297
- </Grid>
297
+ </Grid2>
298
298
  )}
299
299
  {!hideRegion && (
300
- <Grid item {...breakPoints}>
300
+ <Grid2 size={breakPoints}>
301
301
  <Tiplist<AddressRegionDb>
302
302
  label={regionLabel}
303
303
  name={AddressField.Region}
@@ -322,9 +322,9 @@ export function AddressSelector(props: AddressSelectorProps) {
322
322
  handleChange([AddressField.Region, value])
323
323
  }
324
324
  />
325
- </Grid>
325
+ </Grid2>
326
326
  )}
327
- <Grid item {...breakPoints}>
327
+ <Grid2 size={breakPoints}>
328
328
  <ComboBox<AddressState>
329
329
  name={AddressField.State}
330
330
  label={stateLabel}
@@ -339,8 +339,8 @@ export function AddressSelector(props: AddressSelectorProps) {
339
339
  handleChange([AddressField.State, value])
340
340
  }
341
341
  />
342
- </Grid>
343
- <Grid item {...breakPoints}>
342
+ </Grid2>
343
+ <Grid2 size={breakPoints}>
344
344
  <ComboBox<AddressCity>
345
345
  name={AddressField.City}
346
346
  label={cityLabel}
@@ -350,8 +350,8 @@ export function AddressSelector(props: AddressSelectorProps) {
350
350
  options={cities}
351
351
  onChange={(_event, value) => handleChange([AddressField.City, value])}
352
352
  />
353
- </Grid>
354
- <Grid item {...breakPoints}>
353
+ </Grid2>
354
+ <Grid2 size={breakPoints}>
355
355
  <ComboBox<AddressDistrict>
356
356
  name={AddressField.District}
357
357
  label={districtLabel}
@@ -363,7 +363,7 @@ export function AddressSelector(props: AddressSelectorProps) {
363
363
  handleChange([AddressField.District, value])
364
364
  }
365
365
  />
366
- </Grid>
366
+ </Grid2>
367
367
  </React.Fragment>
368
368
  );
369
369
  }
@@ -1,8 +1,8 @@
1
1
  import { DataTypes, IdDefaultType, LabelDefaultType } from "@etsoo/shared";
2
- import { FormLabel, Grid, SelectChangeEvent } from "@mui/material";
2
+ import { FormLabel, Grid2, GridSize, SelectChangeEvent } from "@mui/material";
3
3
  import React from "react";
4
4
  import { SelectEx } from "./SelectEx";
5
- import { RegularBreakpoints } from "@mui/material/Grid";
5
+ import { ResponsiveStyleValue } from "./ResponsiveStyleValue";
6
6
 
7
7
  /**
8
8
  * Hierarchy selector props
@@ -15,7 +15,7 @@ export type HiSelectorProps<
15
15
  /**
16
16
  * Break points
17
17
  */
18
- breakPoints?: RegularBreakpoints;
18
+ breakPoints?: ResponsiveStyleValue<GridSize>;
19
19
 
20
20
  /**
21
21
  * Id field
@@ -161,17 +161,17 @@ export function HiSelector<
161
161
  return (
162
162
  <React.Fragment>
163
163
  {label && (
164
- <Grid item xs={12}>
164
+ <Grid2 size={{ xs: 12 }}>
165
165
  <FormLabel
166
166
  required={required}
167
167
  sx={{ fontSize: (theme) => theme.typography.caption }}
168
168
  >
169
169
  {label}
170
170
  </FormLabel>
171
- </Grid>
171
+ </Grid2>
172
172
  )}
173
173
  <input type="hidden" name={name} value={`${currentValue ?? ""}`} />
174
- <Grid item {...breakPoints}>
174
+ <Grid2 size={breakPoints}>
175
175
  <SelectEx<T, D, L>
176
176
  idField={idField}
177
177
  label={labels[0]}
@@ -188,9 +188,9 @@ export function HiSelector<
188
188
  helperText={helperText}
189
189
  variant={variant}
190
190
  />
191
- </Grid>
191
+ </Grid2>
192
192
  {localValues[0] != null && (
193
- <Grid item {...breakPoints}>
193
+ <Grid2 size={breakPoints}>
194
194
  <SelectEx<T, D, L>
195
195
  key={`${localValues[0]}`}
196
196
  idField={idField}
@@ -205,10 +205,10 @@ export function HiSelector<
205
205
  onItemChange={doItemChange}
206
206
  variant={variant}
207
207
  />
208
- </Grid>
208
+ </Grid2>
209
209
  )}
210
210
  {localValues[1] != null && (
211
- <Grid item {...breakPoints}>
211
+ <Grid2 size={breakPoints}>
212
212
  <SelectEx<T, D, L>
213
213
  key={`${localValues[1]}`}
214
214
  idField={idField}
@@ -223,10 +223,10 @@ export function HiSelector<
223
223
  onItemChange={doItemChange}
224
224
  variant={variant}
225
225
  />
226
- </Grid>
226
+ </Grid2>
227
227
  )}
228
228
  {localValues[2] != null && (
229
- <Grid item {...breakPoints}>
229
+ <Grid2 size={breakPoints}>
230
230
  <SelectEx<T, D, L>
231
231
  key={`${localValues[2]}`}
232
232
  idField={idField}
@@ -241,7 +241,7 @@ export function HiSelector<
241
241
  onItemChange={doItemChange}
242
242
  variant={variant}
243
243
  />
244
- </Grid>
244
+ </Grid2>
245
245
  )}
246
246
  </React.Fragment>
247
247
  );
@@ -3,11 +3,12 @@ import {
3
3
  AutocompleteChangeReason,
4
4
  AutocompleteValue,
5
5
  FormLabel,
6
- Grid
6
+ Grid2,
7
+ GridSize
7
8
  } from "@mui/material";
8
9
  import React from "react";
9
10
  import { Tiplist } from "./Tiplist";
10
- import { RegularBreakpoints } from "@mui/material/Grid";
11
+ import { ResponsiveStyleValue } from "./ResponsiveStyleValue";
11
12
 
12
13
  /**
13
14
  * Hierarchy tiplist selector props
@@ -19,7 +20,7 @@ export type HiSelectorTLProps<
19
20
  /**
20
21
  * Break points
21
22
  */
22
- breakPoints?: RegularBreakpoints;
23
+ breakPoints?: ResponsiveStyleValue<GridSize>;
23
24
 
24
25
  /**
25
26
  * Id field
@@ -154,17 +155,17 @@ export function HiSelectorTL<
154
155
  return (
155
156
  <React.Fragment>
156
157
  {label && (
157
- <Grid item xs={12}>
158
+ <Grid2 size={{ xs: 12 }}>
158
159
  <FormLabel
159
160
  required={required}
160
161
  sx={{ fontSize: (theme) => theme.typography.caption }}
161
162
  >
162
163
  {label}
163
164
  </FormLabel>
164
- </Grid>
165
+ </Grid2>
165
166
  )}
166
167
  <input type="hidden" name={name} value={`${currentValue ?? ""}`} />
167
- <Grid item {...breakPoints}>
168
+ <Grid2 size={breakPoints}>
168
169
  <Tiplist<T, D>
169
170
  idField={idField}
170
171
  label={labels[0]}
@@ -178,9 +179,9 @@ export function HiSelectorTL<
178
179
  inputHelperText={helperText}
179
180
  onChange={(event, value, reason) => doChange(0, event, value, reason)}
180
181
  />
181
- </Grid>
182
+ </Grid2>
182
183
  {localValues[0] != null && (
183
- <Grid item {...breakPoints}>
184
+ <Grid2 size={breakPoints}>
184
185
  <Tiplist<T, D>
185
186
  key={`${localValues[0]}`}
186
187
  label={labels[1]}
@@ -196,10 +197,10 @@ export function HiSelectorTL<
196
197
  doChange(1, event, value, reason)
197
198
  }
198
199
  />
199
- </Grid>
200
+ </Grid2>
200
201
  )}
201
202
  {localValues[1] != null && (
202
- <Grid item {...breakPoints}>
203
+ <Grid2 size={breakPoints}>
203
204
  <Tiplist<T, D>
204
205
  key={`${localValues[1]}`}
205
206
  label={labels[2]}
@@ -215,10 +216,10 @@ export function HiSelectorTL<
215
216
  doChange(2, event, value, reason)
216
217
  }
217
218
  />
218
- </Grid>
219
+ </Grid2>
219
220
  )}
220
221
  {localValues[2] != null && (
221
- <Grid item {...breakPoints}>
222
+ <Grid2 size={breakPoints}>
222
223
  <Tiplist<T, D>
223
224
  key={`${localValues[2]}`}
224
225
  label={labels[3]}
@@ -234,7 +235,7 @@ export function HiSelectorTL<
234
235
  doChange(3, event, value, reason)
235
236
  }
236
237
  />
237
- </Grid>
238
+ </Grid2>
238
239
  )}
239
240
  </React.Fragment>
240
241
  );
@@ -0,0 +1,11 @@
1
+ import { Breakpoint } from "@mui/material";
2
+
3
+ /**
4
+ * Responsive style value
5
+ */
6
+ export type ResponsiveStyleValue<T> =
7
+ | T
8
+ | Array<T | null>
9
+ | {
10
+ [key in Breakpoint]?: T | null;
11
+ };
@@ -5,7 +5,7 @@ import {
5
5
  } from "@etsoo/appscript";
6
6
  import { CustomFieldReactCollection, ICustomFieldReact } from "@etsoo/react";
7
7
  import { IdType, ListType2 } from "@etsoo/shared";
8
- import { Grid, GridProps, Typography } from "@mui/material";
8
+ import { Grid2, GridSize, Typography } from "@mui/material";
9
9
  import { TypographyProps } from "@mui/material/Typography";
10
10
  import React from "react";
11
11
  import { FieldCheckbox } from "./FieldCheckbox";
@@ -21,6 +21,7 @@ import { FieldJson } from "./FieldJson";
21
21
  import { FieldRadio } from "./FieldRadio";
22
22
  import { FieldSelect } from "./FieldSelect";
23
23
  import { FieldSwitch } from "./FieldSwitch";
24
+ import { ResponsiveStyleValue } from "../ResponsiveStyleValue";
24
25
 
25
26
  /**
26
27
  * Custom field utilities
@@ -82,14 +83,13 @@ export namespace CustomFieldUtils {
82
83
  const creator = customFieldCreators[field.type];
83
84
  if (creator == null) {
84
85
  return (
85
- <Grid
86
- item
86
+ <Grid2
87
87
  key={index}
88
+ size={transformSpace(field.space)}
88
89
  {...field.gridItemProps}
89
- {...transformSpace(field.space)}
90
90
  >
91
91
  {`Type ${field.type} is not supported currently`}
92
- </Grid>
92
+ </Grid2>
93
93
  );
94
94
  }
95
95
 
@@ -115,14 +115,13 @@ export namespace CustomFieldUtils {
115
115
  }
116
116
 
117
117
  return (
118
- <Grid
119
- item
118
+ <Grid2
120
119
  key={name ?? index}
120
+ size={transformSpace(field.space)}
121
121
  {...field.gridItemProps}
122
- {...transformSpace(field.space)}
123
122
  >
124
123
  {ui}
125
- </Grid>
124
+ </Grid2>
126
125
  );
127
126
  });
128
127
  }
@@ -150,7 +149,7 @@ export namespace CustomFieldUtils {
150
149
  * @returns Result
151
150
  */
152
151
  export function transformSpace(space?: CustomFieldSpace) {
153
- const props: GridProps =
152
+ const size: ResponsiveStyleValue<GridSize> =
154
153
  space === "full"
155
154
  ? { xs: 12 }
156
155
  : space === "quater"
@@ -162,7 +161,7 @@ export namespace CustomFieldUtils {
162
161
  : space === "half1"
163
162
  ? { xs: 12, sm: 6 }
164
163
  : { sm: 12, md: 6 };
165
- return props;
164
+ return size;
166
165
  }
167
166
 
168
167
  /**
@@ -1,5 +1,5 @@
1
1
  import { CustomFieldData } from "@etsoo/appscript";
2
- import { Grid, GridProps, Typography, TypographyProps } from "@mui/material";
2
+ import { Grid2, Grid2Props, Typography, TypographyProps } from "@mui/material";
3
3
  import { CustomFieldUtils } from "./CustomFieldUtils";
4
4
  import { MUGlobal } from "../MUGlobal";
5
5
  import { VBox } from "../FlexBox";
@@ -20,7 +20,7 @@ export type CustomFieldViewerProps = {
20
20
  * Grid props
21
21
  * 网格属性
22
22
  */
23
- gridProps?: GridProps;
23
+ gridProps?: Grid2Props;
24
24
 
25
25
  /**
26
26
  * JSON data
@@ -96,7 +96,7 @@ export function CustomFieldViewer(props: CustomFieldViewerProps) {
96
96
  }
97
97
 
98
98
  return (
99
- <Grid
99
+ <Grid2
100
100
  container
101
101
  justifyContent="left"
102
102
  spacing={spacing}
@@ -116,11 +116,10 @@ export function CustomFieldViewer(props: CustomFieldViewerProps) {
116
116
  const value = Utils.getNestedValue(data, name);
117
117
 
118
118
  return (
119
- <Grid
120
- item
119
+ <Grid2
121
120
  key={name ?? index}
121
+ size={CustomFieldUtils.transformSpace(field.space)}
122
122
  {...field.gridItemProps}
123
- {...CustomFieldUtils.transformSpace(field.space)}
124
123
  >
125
124
  <VBox gap={verticalGap}>
126
125
  <Typography fontWeight="bold" fontSize="small" {...titleProps}>
@@ -130,9 +129,9 @@ export function CustomFieldViewer(props: CustomFieldViewerProps) {
130
129
  {valueLabelFormatter(value, field)}
131
130
  </Typography>
132
131
  </VBox>
133
- </Grid>
132
+ </Grid2>
134
133
  );
135
134
  })}
136
- </Grid>
135
+ </Grid2>
137
136
  );
138
137
  }
@@ -1,7 +1,7 @@
1
1
  import { CustomFieldData } from "@etsoo/appscript";
2
2
  import { CustomFieldReactCollection } from "@etsoo/react";
3
3
  import { Utils } from "@etsoo/shared";
4
- import { Grid, GridProps, Stack } from "@mui/material";
4
+ import { Grid2, Grid2Props, Stack } from "@mui/material";
5
5
  import React from "react";
6
6
  import { globalApp } from "../app/ReactApp";
7
7
  import { MUGlobal } from "../MUGlobal";
@@ -64,7 +64,7 @@ export type CustomFieldWindowProps<D extends CustomFieldData> = {
64
64
  * Grid props
65
65
  * 网格属性
66
66
  */
67
- gridProps?: GridProps;
67
+ gridProps?: Grid2Props;
68
68
 
69
69
  /**
70
70
  * JSON data
@@ -156,7 +156,7 @@ export function CustomFieldWindow<D extends CustomFieldData = CustomFieldData>(
156
156
  fullScreen: app.smDown,
157
157
  inputs: (
158
158
  <Stack marginTop={1.5}>
159
- <Grid
159
+ <Grid2
160
160
  container
161
161
  justifyContent="left"
162
162
  spacing={spacing}
@@ -178,7 +178,7 @@ export function CustomFieldWindow<D extends CustomFieldData = CustomFieldData>(
178
178
  Utils.setNestedValue(data, name, value);
179
179
  }
180
180
  )}
181
- </Grid>
181
+ </Grid2>
182
182
  </Stack>
183
183
  )
184
184
  }
package/src/index.ts CHANGED
@@ -95,6 +95,7 @@ export * from "./ProgressCount";
95
95
  export * from "./PullToRefreshUI";
96
96
  export * from "./QuickList";
97
97
  export * from "./ResponsibleContainer";
98
+ export * from "./ResponsiveStyleValue";
98
99
  export * from "./ScrollerListEx";
99
100
  export * from "./ScrollTopFab";
100
101
  export * from "./SearchBar";
@@ -1,4 +1,4 @@
1
- import { Button, Grid } from "@mui/material";
1
+ import { Button, Grid2 } from "@mui/material";
2
2
  import React, { FormEventHandler } from "react";
3
3
  import { MUGlobal } from "../MUGlobal";
4
4
  import { CommonPage, CommonPageProps } from "./CommonPage";
@@ -86,10 +86,15 @@ export function EditPage(props: EditPageProps) {
86
86
  )}
87
87
  {topPart}
88
88
  <form onSubmit={onSubmit}>
89
- <Grid container justifyContent="left" spacing={paddings} paddingTop={1}>
89
+ <Grid2
90
+ container
91
+ justifyContent="left"
92
+ spacing={paddings}
93
+ paddingTop={1}
94
+ >
90
95
  {children}
91
- </Grid>
92
- <Grid
96
+ </Grid2>
97
+ <Grid2
93
98
  container
94
99
  position="sticky"
95
100
  display="flex"
@@ -121,7 +126,7 @@ export function EditPage(props: EditPageProps) {
121
126
  {labels.save}
122
127
  </Button>
123
128
  {supportBack && <BackButton title={labels.back} />}
124
- </Grid>
129
+ </Grid2>
125
130
  </form>
126
131
  {bottomPart}
127
132
  </CommonPage>
@@ -5,8 +5,8 @@ import {
5
5
  } from "@etsoo/react";
6
6
  import { DataTypes, DateUtils, Utils } from "@etsoo/shared";
7
7
  import {
8
- Grid,
9
- GridProps,
8
+ Grid2,
9
+ Grid2Props,
10
10
  LinearProgress,
11
11
  Stack,
12
12
  Typography
@@ -26,7 +26,7 @@ import { OperationMessageContainer } from "../messages/OperationMessageContainer
26
26
  /**
27
27
  * View page grid item properties
28
28
  */
29
- export type ViewPageGridItemProps = GridProps & {
29
+ export type ViewPageGridItemProps = Grid2Props & {
30
30
  data: React.ReactNode;
31
31
  label?: React.ReactNode;
32
32
  singleRow?: ViewPageRowType;
@@ -43,7 +43,7 @@ export function ViewPageGridItem(props: ViewPageGridItemProps) {
43
43
 
44
44
  // Default options
45
45
  let options = {};
46
- if (gridProps.xs == null && gridProps.md == null) {
46
+ if (gridProps.size == null) {
47
47
  options = getResp(singleRow ?? "small");
48
48
  } else if (singleRow != null) {
49
49
  options = getResp(singleRow ?? "small");
@@ -51,7 +51,7 @@ export function ViewPageGridItem(props: ViewPageGridItemProps) {
51
51
 
52
52
  // Layout
53
53
  return (
54
- <Grid item {...gridProps} {...options}>
54
+ <Grid2 {...gridProps} {...options}>
55
55
  {label != null && (
56
56
  <Typography variant="caption" component="div">
57
57
  {label}:
@@ -62,7 +62,7 @@ export function ViewPageGridItem(props: ViewPageGridItemProps) {
62
62
  ) : (
63
63
  <Typography variant="subtitle2">{data}</Typography>
64
64
  )}
65
- </Grid>
65
+ </Grid2>
66
66
  );
67
67
  }
68
68
 
@@ -74,7 +74,7 @@ export type ViewPageRowType = boolean | "default" | "small" | "medium" | object;
74
74
  /**
75
75
  * View page display field
76
76
  */
77
- export interface ViewPageField<T extends object> extends GridProps {
77
+ export interface ViewPageField<T extends object> extends Grid2Props {
78
78
  /**
79
79
  * Data field
80
80
  */
@@ -181,29 +181,31 @@ function formatItemData(fieldData: unknown): string | undefined {
181
181
  }
182
182
 
183
183
  function getResp(singleRow: ViewPageRowType) {
184
- return typeof singleRow === "object"
185
- ? singleRow
186
- : singleRow === "medium"
187
- ? { xs: 12, sm: 12, md: 6, lg: 4, xl: 3 }
188
- : singleRow === true
189
- ? { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }
190
- : {
191
- xs: singleRow === false ? 12 : 6,
192
- sm: 6,
193
- md: 4,
194
- lg: 3,
195
- xl: 2
196
- };
184
+ const size =
185
+ typeof singleRow === "object"
186
+ ? singleRow
187
+ : singleRow === "medium"
188
+ ? { xs: 12, sm: 12, md: 6, lg: 4, xl: 3 }
189
+ : singleRow === true
190
+ ? { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }
191
+ : {
192
+ xs: singleRow === false ? 12 : 6,
193
+ sm: 6,
194
+ md: 4,
195
+ lg: 3,
196
+ xl: 2
197
+ };
198
+ return { size };
197
199
  }
198
200
 
199
201
  function getItemField<T extends object>(
200
202
  field: ViewPageFieldTypeNarrow<T>,
201
203
  data: T
202
- ): [React.ReactNode, React.ReactNode, GridProps] {
204
+ ): [React.ReactNode, React.ReactNode, Grid2Props] {
203
205
  // Item data and label
204
206
  let itemData: React.ReactNode,
205
207
  itemLabel: React.ReactNode,
206
- gridProps: GridProps = {};
208
+ gridProps: Grid2Props = {};
207
209
 
208
210
  if (Array.isArray(field)) {
209
211
  const [fieldData, fieldType, renderProps, singleRow = "small"] = field;
@@ -326,7 +328,7 @@ export function ViewPage<T extends DataTypes.StringRecord>(
326
328
  }
327
329
  />
328
330
  )}
329
- <Grid
331
+ <Grid2
330
332
  container
331
333
  justifyContent="left"
332
334
  spacing={spacing}
@@ -356,7 +358,6 @@ export function ViewPage<T extends DataTypes.StringRecord>(
356
358
  // Layout
357
359
  return (
358
360
  <ViewPageGridItem
359
- item
360
361
  {...gridProps}
361
362
  key={index}
362
363
  data={itemData}
@@ -364,7 +365,7 @@ export function ViewPage<T extends DataTypes.StringRecord>(
364
365
  />
365
366
  );
366
367
  })}
367
- </Grid>
368
+ </Grid2>
368
369
  {actions !== null && (
369
370
  <Stack
370
371
  className="ET-ViewPage-Actions"