@etsoo/materialui 1.2.71 → 1.2.72

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.
@@ -9,6 +9,7 @@ import { CommonPageProps } from "./CommonPageProps";
9
9
  export type ViewPageGridItemProps = GridProps & {
10
10
  data: React.ReactNode;
11
11
  label?: React.ReactNode;
12
+ singleRow?: ViewPageRowType;
12
13
  };
13
14
  /**
14
15
  * View page grid item
@@ -91,18 +92,6 @@ export interface ViewPageProps<T extends DataTypes.StringRecord> extends Omit<Co
91
92
  */
92
93
  refreshSeed?: number;
93
94
  }
94
- /**
95
- * View page format item data
96
- * @param fieldData Field data
97
- * @returns Result
98
- */
99
- export declare function formatItemData(fieldData: unknown): string | undefined;
100
- /**
101
- * View page get row options
102
- * @param singleRow Row option
103
- * @returns Result
104
- */
105
- export declare function getResp(singleRow: ViewPageRowType): object;
106
95
  /**
107
96
  * View page
108
97
  * @param props Props
@@ -15,20 +15,23 @@ import { CommonPage } from "./CommonPage";
15
15
  */
16
16
  export function ViewPageGridItem(props) {
17
17
  // Destruct
18
- const { data, label, ...gridProps } = props;
18
+ const { data, label, singleRow, ...gridProps } = props;
19
+ // Default options
20
+ let options = {};
21
+ if (gridProps.xs == null && gridProps.md == null) {
22
+ options = getResp(singleRow !== null && singleRow !== void 0 ? singleRow : "small");
23
+ }
24
+ else if (singleRow != null) {
25
+ options = getResp(singleRow !== null && singleRow !== void 0 ? singleRow : "small");
26
+ }
19
27
  // Layout
20
- return (React.createElement(Grid, { item: true, ...gridProps },
28
+ return (React.createElement(Grid, { item: true, ...gridProps, ...options },
21
29
  label != null && (React.createElement(Typography, { variant: "caption", component: "div" },
22
30
  label,
23
31
  ":")),
24
32
  typeof data === "object" ? (data) : (React.createElement(Typography, { variant: "subtitle2" }, data))));
25
33
  }
26
- /**
27
- * View page format item data
28
- * @param fieldData Field data
29
- * @returns Result
30
- */
31
- export function formatItemData(fieldData) {
34
+ function formatItemData(fieldData) {
32
35
  if (fieldData == null)
33
36
  return undefined;
34
37
  if (typeof fieldData === "string")
@@ -39,12 +42,7 @@ export function formatItemData(fieldData) {
39
42
  : DateUtils.format(fieldData, "d");
40
43
  return `${fieldData}`;
41
44
  }
42
- /**
43
- * View page get row options
44
- * @param singleRow Row option
45
- * @returns Result
46
- */
47
- export function getResp(singleRow) {
45
+ function getResp(singleRow) {
48
46
  return typeof singleRow === "object"
49
47
  ? singleRow
50
48
  : singleRow === "medium"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.2.71",
3
+ "version": "1.2.72",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -26,6 +26,7 @@ import { CommonPageProps } from "./CommonPageProps";
26
26
  export type ViewPageGridItemProps = GridProps & {
27
27
  data: React.ReactNode;
28
28
  label?: React.ReactNode;
29
+ singleRow?: ViewPageRowType;
29
30
  };
30
31
 
31
32
  /**
@@ -35,11 +36,19 @@ export type ViewPageGridItemProps = GridProps & {
35
36
  */
36
37
  export function ViewPageGridItem(props: ViewPageGridItemProps) {
37
38
  // Destruct
38
- const { data, label, ...gridProps } = props;
39
+ const { data, label, singleRow, ...gridProps } = props;
40
+
41
+ // Default options
42
+ let options = {};
43
+ if (gridProps.xs == null && gridProps.md == null) {
44
+ options = getResp(singleRow ?? "small");
45
+ } else if (singleRow != null) {
46
+ options = getResp(singleRow ?? "small");
47
+ }
39
48
 
40
49
  // Layout
41
50
  return (
42
- <Grid item {...gridProps}>
51
+ <Grid item {...gridProps} {...options}>
43
52
  {label != null && (
44
53
  <Typography variant="caption" component="div">
45
54
  {label}:
@@ -156,12 +165,7 @@ export interface ViewPageProps<T extends DataTypes.StringRecord>
156
165
  refreshSeed?: number;
157
166
  }
158
167
 
159
- /**
160
- * View page format item data
161
- * @param fieldData Field data
162
- * @returns Result
163
- */
164
- export function formatItemData(fieldData: unknown): string | undefined {
168
+ function formatItemData(fieldData: unknown): string | undefined {
165
169
  if (fieldData == null) return undefined;
166
170
  if (typeof fieldData === "string") return fieldData;
167
171
  if (fieldData instanceof Date)
@@ -171,12 +175,7 @@ export function formatItemData(fieldData: unknown): string | undefined {
171
175
  return `${fieldData}`;
172
176
  }
173
177
 
174
- /**
175
- * View page get row options
176
- * @param singleRow Row option
177
- * @returns Result
178
- */
179
- export function getResp(singleRow: ViewPageRowType) {
178
+ function getResp(singleRow: ViewPageRowType) {
180
179
  return typeof singleRow === "object"
181
180
  ? singleRow
182
181
  : singleRow === "medium"