@etsoo/materialui 1.4.4 → 1.4.6
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/AddresSelector.d.ts +3 -2
- package/lib/AddresSelector.js +3 -3
- package/lib/HiSelector.d.ts +3 -3
- package/lib/HiSelector.js +2 -2
- package/lib/HiSelectorTL.d.ts +3 -3
- package/lib/HiSelectorTL.js +2 -2
- package/lib/ResponsiveStyleValue.d.ts +7 -0
- package/lib/ResponsiveStyleValue.js +1 -0
- package/lib/app/CommonApp.d.ts +2 -7
- package/lib/app/CommonApp.js +13 -70
- package/lib/app/ReactApp.d.ts +1 -2
- package/lib/app/ReactApp.js +2 -3
- package/lib/app/ServiceApp.d.ts +5 -7
- package/lib/app/ServiceApp.js +12 -9
- package/lib/custom/CustomFieldUtils.d.ts +8 -2
- package/lib/custom/CustomFieldUtils.js +5 -5
- package/lib/custom/CustomFieldViewer.d.ts +2 -2
- package/lib/custom/CustomFieldViewer.js +3 -3
- package/lib/custom/CustomFieldWindow.d.ts +2 -2
- package/lib/custom/CustomFieldWindow.js +2 -2
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/pages/EditPage.js +2 -2
- package/lib/pages/ViewPage.d.ts +3 -3
- package/lib/pages/ViewPage.js +7 -6
- package/package.json +8 -8
- package/src/AddresSelector.tsx +13 -13
- package/src/HiSelector.tsx +13 -13
- package/src/HiSelectorTL.tsx +14 -13
- package/src/ResponsiveStyleValue.ts +11 -0
- package/src/app/CommonApp.ts +16 -99
- package/src/app/ReactApp.ts +2 -8
- package/src/app/ServiceApp.ts +14 -14
- package/src/custom/CustomFieldUtils.tsx +10 -11
- package/src/custom/CustomFieldViewer.tsx +7 -8
- package/src/custom/CustomFieldWindow.tsx +4 -4
- package/src/index.ts +1 -0
- package/src/pages/EditPage.tsx +10 -5
- package/src/pages/ViewPage.tsx +26 -25
|
@@ -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 {
|
|
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
|
-
<
|
|
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
|
-
</
|
|
92
|
+
</Grid2>
|
|
93
93
|
);
|
|
94
94
|
}
|
|
95
95
|
|
|
@@ -115,14 +115,13 @@ export namespace CustomFieldUtils {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
return (
|
|
118
|
-
<
|
|
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
|
-
</
|
|
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
|
|
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
|
|
164
|
+
return size;
|
|
166
165
|
}
|
|
167
166
|
|
|
168
167
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CustomFieldData } from "@etsoo/appscript";
|
|
2
|
-
import {
|
|
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?:
|
|
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
|
-
<
|
|
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
|
-
<
|
|
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
|
-
</
|
|
132
|
+
</Grid2>
|
|
134
133
|
);
|
|
135
134
|
})}
|
|
136
|
-
</
|
|
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 {
|
|
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?:
|
|
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
|
-
<
|
|
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
|
-
</
|
|
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";
|
package/src/pages/EditPage.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Button,
|
|
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
|
-
<
|
|
89
|
+
<Grid2
|
|
90
|
+
container
|
|
91
|
+
justifyContent="left"
|
|
92
|
+
spacing={paddings}
|
|
93
|
+
paddingTop={1}
|
|
94
|
+
>
|
|
90
95
|
{children}
|
|
91
|
-
</
|
|
92
|
-
<
|
|
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
|
-
</
|
|
129
|
+
</Grid2>
|
|
125
130
|
</form>
|
|
126
131
|
{bottomPart}
|
|
127
132
|
</CommonPage>
|
package/src/pages/ViewPage.tsx
CHANGED
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
} from "@etsoo/react";
|
|
6
6
|
import { DataTypes, DateUtils, Utils } from "@etsoo/shared";
|
|
7
7
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
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 =
|
|
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.
|
|
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
|
-
<
|
|
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
|
-
</
|
|
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
|
|
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
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
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,
|
|
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:
|
|
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
|
-
<
|
|
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
|
-
</
|
|
368
|
+
</Grid2>
|
|
368
369
|
{actions !== null && (
|
|
369
370
|
<Stack
|
|
370
371
|
className="ET-ViewPage-Actions"
|