@etsoo/materialui 1.2.68 → 1.2.70
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/pages/ViewPage.d.ts +14 -1
- package/lib/pages/ViewPage.js +17 -6
- package/package.json +1 -1
- package/src/pages/ViewPage.tsx +43 -14
package/lib/pages/ViewPage.d.ts
CHANGED
|
@@ -3,10 +3,23 @@ import { DataTypes } from "@etsoo/shared";
|
|
|
3
3
|
import { GridProps } from "@mui/material";
|
|
4
4
|
import React from "react";
|
|
5
5
|
import { CommonPageProps } from "./CommonPageProps";
|
|
6
|
+
/**
|
|
7
|
+
* View page grid item properties
|
|
8
|
+
*/
|
|
9
|
+
export type ViewPageGridItemProps = GridProps & {
|
|
10
|
+
data: React.ReactNode;
|
|
11
|
+
label?: React.ReactNode;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* View page grid item
|
|
15
|
+
* @param props Props
|
|
16
|
+
* @returns Result
|
|
17
|
+
*/
|
|
18
|
+
export declare function ViewPageGridItem(props: ViewPageGridItemProps): React.JSX.Element;
|
|
6
19
|
/**
|
|
7
20
|
* View page row width type
|
|
8
21
|
*/
|
|
9
|
-
export type ViewPageRowType = boolean | "default" | "small" | object;
|
|
22
|
+
export type ViewPageRowType = boolean | "default" | "small" | "medium" | object;
|
|
10
23
|
/**
|
|
11
24
|
* View page display field
|
|
12
25
|
*/
|
package/lib/pages/ViewPage.js
CHANGED
|
@@ -8,6 +8,21 @@ import { GridDataFormat } from "../GridDataFormat";
|
|
|
8
8
|
import { MUGlobal } from "../MUGlobal";
|
|
9
9
|
import { PullToRefreshUI } from "../PullToRefreshUI";
|
|
10
10
|
import { CommonPage } from "./CommonPage";
|
|
11
|
+
/**
|
|
12
|
+
* View page grid item
|
|
13
|
+
* @param props Props
|
|
14
|
+
* @returns Result
|
|
15
|
+
*/
|
|
16
|
+
export function ViewPageGridItem(props) {
|
|
17
|
+
// Destruct
|
|
18
|
+
const { data, label, ...gridProps } = props;
|
|
19
|
+
// Layout
|
|
20
|
+
return (React.createElement(Grid, { item: true, ...gridProps },
|
|
21
|
+
label != null && (React.createElement(Typography, { variant: "caption", component: "div" },
|
|
22
|
+
label,
|
|
23
|
+
":")),
|
|
24
|
+
typeof data === "object" ? (data) : (React.createElement(Typography, { variant: "subtitle2" }, data))));
|
|
25
|
+
}
|
|
11
26
|
function formatItemData(fieldData) {
|
|
12
27
|
if (fieldData == null)
|
|
13
28
|
return undefined;
|
|
@@ -22,7 +37,7 @@ function formatItemData(fieldData) {
|
|
|
22
37
|
function getResp(singleRow) {
|
|
23
38
|
return typeof singleRow === "object"
|
|
24
39
|
? singleRow
|
|
25
|
-
: singleRow === "
|
|
40
|
+
: singleRow === "medium"
|
|
26
41
|
? { xs: 12, sm: 12, md: 6, lg: 4, xl: 3 }
|
|
27
42
|
: singleRow === true
|
|
28
43
|
? { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }
|
|
@@ -114,11 +129,7 @@ export function ViewPage(props) {
|
|
|
114
129
|
if (itemData == null || itemData === "")
|
|
115
130
|
return undefined;
|
|
116
131
|
// Layout
|
|
117
|
-
return (React.createElement(
|
|
118
|
-
itemLabel != null && (React.createElement(Typography, { variant: "caption", component: "div" },
|
|
119
|
-
itemLabel,
|
|
120
|
-
":")),
|
|
121
|
-
typeof itemData === "object" ? (itemData) : (React.createElement(Typography, { variant: "subtitle2" }, itemData))));
|
|
132
|
+
return (React.createElement(ViewPageGridItem, { item: true, ...gridProps, key: index, data: itemData, label: itemLabel }));
|
|
122
133
|
})),
|
|
123
134
|
actions !== null && (React.createElement(Stack, { className: "ET-ViewPage-Actions", direction: "row", width: "100%", flexWrap: "wrap", justifyContent: "flex-end", paddingTop: actions == null ? undefined : paddings, paddingBottom: paddings, gap: paddings }, actions != null && Utils.getResult(actions, data, refresh))),
|
|
124
135
|
Utils.getResult(children, data, refresh),
|
package/package.json
CHANGED
package/src/pages/ViewPage.tsx
CHANGED
|
@@ -20,10 +20,44 @@ import { PullToRefreshUI } from "../PullToRefreshUI";
|
|
|
20
20
|
import { CommonPage } from "./CommonPage";
|
|
21
21
|
import { CommonPageProps } from "./CommonPageProps";
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* View page grid item properties
|
|
25
|
+
*/
|
|
26
|
+
export type ViewPageGridItemProps = GridProps & {
|
|
27
|
+
data: React.ReactNode;
|
|
28
|
+
label?: React.ReactNode;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* View page grid item
|
|
33
|
+
* @param props Props
|
|
34
|
+
* @returns Result
|
|
35
|
+
*/
|
|
36
|
+
export function ViewPageGridItem(props: ViewPageGridItemProps) {
|
|
37
|
+
// Destruct
|
|
38
|
+
const { data, label, ...gridProps } = props;
|
|
39
|
+
|
|
40
|
+
// Layout
|
|
41
|
+
return (
|
|
42
|
+
<Grid item {...gridProps}>
|
|
43
|
+
{label != null && (
|
|
44
|
+
<Typography variant="caption" component="div">
|
|
45
|
+
{label}:
|
|
46
|
+
</Typography>
|
|
47
|
+
)}
|
|
48
|
+
{typeof data === "object" ? (
|
|
49
|
+
data
|
|
50
|
+
) : (
|
|
51
|
+
<Typography variant="subtitle2">{data}</Typography>
|
|
52
|
+
)}
|
|
53
|
+
</Grid>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
23
57
|
/**
|
|
24
58
|
* View page row width type
|
|
25
59
|
*/
|
|
26
|
-
export type ViewPageRowType = boolean | "default" | "small" | object;
|
|
60
|
+
export type ViewPageRowType = boolean | "default" | "small" | "medium" | object;
|
|
27
61
|
|
|
28
62
|
/**
|
|
29
63
|
* View page display field
|
|
@@ -135,7 +169,7 @@ function formatItemData(fieldData: unknown): string | undefined {
|
|
|
135
169
|
function getResp(singleRow: ViewPageRowType) {
|
|
136
170
|
return typeof singleRow === "object"
|
|
137
171
|
? singleRow
|
|
138
|
-
: singleRow === "
|
|
172
|
+
: singleRow === "medium"
|
|
139
173
|
? { xs: 12, sm: 12, md: 6, lg: 4, xl: 3 }
|
|
140
174
|
: singleRow === true
|
|
141
175
|
? { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }
|
|
@@ -289,18 +323,13 @@ export function ViewPage<T extends DataTypes.StringRecord>(
|
|
|
289
323
|
|
|
290
324
|
// Layout
|
|
291
325
|
return (
|
|
292
|
-
<
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
itemData
|
|
300
|
-
) : (
|
|
301
|
-
<Typography variant="subtitle2">{itemData}</Typography>
|
|
302
|
-
)}
|
|
303
|
-
</Grid>
|
|
326
|
+
<ViewPageGridItem
|
|
327
|
+
item
|
|
328
|
+
{...gridProps}
|
|
329
|
+
key={index}
|
|
330
|
+
data={itemData}
|
|
331
|
+
label={itemLabel}
|
|
332
|
+
/>
|
|
304
333
|
);
|
|
305
334
|
})}
|
|
306
335
|
</Grid>
|