@etsoo/materialui 1.0.74 → 1.0.77

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.
@@ -3,7 +3,10 @@ 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
- declare type RowType = boolean | 'default' | 'small';
6
+ /**
7
+ * View page row width type
8
+ */
9
+ export declare type ViewPageRowType = boolean | 'default' | 'small' | object;
7
10
  /**
8
11
  * View page display field
9
12
  */
@@ -23,13 +26,13 @@ export interface ViewPageField<T extends object> extends GridProps {
23
26
  /**
24
27
  * Display as single row
25
28
  */
26
- singleRow?: RowType;
29
+ singleRow?: ViewPageRowType;
27
30
  /**
28
31
  * Render props
29
32
  */
30
33
  renderProps?: GridColumnRenderProps;
31
34
  }
32
- declare type ViewPageFieldTypeNarrow<T extends object> = (string & keyof T) | [string & keyof T, GridDataType, GridColumnRenderProps?, RowType?] | ViewPageField<T>;
35
+ declare type ViewPageFieldTypeNarrow<T extends object> = (string & keyof T) | [string & keyof T, GridDataType, GridColumnRenderProps?, ViewPageRowType?] | ViewPageField<T>;
33
36
  /**
34
37
  * View page field type
35
38
  */
@@ -17,17 +17,19 @@ function formatItemData(fieldData) {
17
17
  return `${fieldData}`;
18
18
  }
19
19
  function getResp(singleRow) {
20
- return singleRow === 'default'
21
- ? { xs: 12, sm: 12, md: 12, lg: 6, xl: 6 }
22
- : singleRow === true
23
- ? { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }
24
- : {
25
- xs: singleRow === false ? 12 : 6,
26
- sm: 6,
27
- md: 6,
28
- lg: 4,
29
- xl: 3
30
- };
20
+ return typeof singleRow === 'object'
21
+ ? singleRow
22
+ : singleRow === 'default'
23
+ ? { xs: 12, sm: 12, md: 12, lg: 6, xl: 6 }
24
+ : singleRow === true
25
+ ? { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }
26
+ : {
27
+ xs: singleRow === false ? 12 : 6,
28
+ sm: 6,
29
+ md: 6,
30
+ lg: 4,
31
+ xl: 3
32
+ };
31
33
  }
32
34
  function getItemField(field, data) {
33
35
  var _a, _b, _c;
@@ -10,5 +10,7 @@ export function MoneyText(props) {
10
10
  // Destruct
11
11
  const { currency, isInteger = false, locale, options = {}, value, ...rest } = props;
12
12
  // Layout
13
- return (React.createElement(Typography, { component: "span", fontSize: "inherit", ...rest }, NumberUtils.formatMoney(value, currency, locale, isInteger, options)));
13
+ return (React.createElement(Typography, { component: "span", fontSize: "inherit", ...rest }, value == null
14
+ ? ''
15
+ : NumberUtils.formatMoney(value, currency, locale, isInteger, options)));
14
16
  }
@@ -15,7 +15,7 @@ export interface NumberTextProps extends TypographyProps {
15
15
  /**
16
16
  * Value
17
17
  */
18
- value?: number | bigint;
18
+ value?: number | bigint | null;
19
19
  }
20
20
  /**
21
21
  * Number text
@@ -10,5 +10,5 @@ export function NumberText(props) {
10
10
  // Destruct
11
11
  const { locale, options = {}, value, ...rest } = props;
12
12
  // Layout
13
- return (React.createElement(Typography, { component: "span", fontSize: "inherit", ...rest }, NumberUtils.format(value, locale, options)));
13
+ return (React.createElement(Typography, { component: "span", fontSize: "inherit", ...rest }, value == null ? '' : NumberUtils.format(value, locale, options)));
14
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.0.74",
3
+ "version": "1.0.77",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -51,10 +51,10 @@
51
51
  "@emotion/css": "^11.10.5",
52
52
  "@emotion/react": "^11.10.5",
53
53
  "@emotion/styled": "^11.10.5",
54
- "@etsoo/appscript": "^1.3.30",
55
- "@etsoo/notificationbase": "^1.1.14",
56
- "@etsoo/react": "^1.6.24",
57
- "@etsoo/shared": "^1.1.75",
54
+ "@etsoo/appscript": "^1.3.33",
55
+ "@etsoo/notificationbase": "^1.1.16",
56
+ "@etsoo/react": "^1.6.26",
57
+ "@etsoo/shared": "^1.1.77",
58
58
  "@mui/icons-material": "^5.10.9",
59
59
  "@mui/material": "^5.10.13",
60
60
  "@types/pica": "^9.0.1",
@@ -16,7 +16,10 @@ import { PullToRefreshUI } from '../PullToRefreshUI';
16
16
  import { CommonPage } from './CommonPage';
17
17
  import { CommonPageProps } from './CommonPageProps';
18
18
 
19
- type RowType = boolean | 'default' | 'small';
19
+ /**
20
+ * View page row width type
21
+ */
22
+ export type ViewPageRowType = boolean | 'default' | 'small' | object;
20
23
 
21
24
  /**
22
25
  * View page display field
@@ -40,7 +43,7 @@ export interface ViewPageField<T extends object> extends GridProps {
40
43
  /**
41
44
  * Display as single row
42
45
  */
43
- singleRow?: RowType;
46
+ singleRow?: ViewPageRowType;
44
47
 
45
48
  /**
46
49
  * Render props
@@ -50,7 +53,7 @@ export interface ViewPageField<T extends object> extends GridProps {
50
53
 
51
54
  type ViewPageFieldTypeNarrow<T extends object> =
52
55
  | (string & keyof T)
53
- | [string & keyof T, GridDataType, GridColumnRenderProps?, RowType?]
56
+ | [string & keyof T, GridDataType, GridColumnRenderProps?, ViewPageRowType?]
54
57
  | ViewPageField<T>;
55
58
 
56
59
  /**
@@ -107,8 +110,10 @@ function formatItemData(fieldData: unknown): string | undefined {
107
110
  return `${fieldData}`;
108
111
  }
109
112
 
110
- function getResp(singleRow: RowType) {
111
- return singleRow === 'default'
113
+ function getResp(singleRow: ViewPageRowType) {
114
+ return typeof singleRow === 'object'
115
+ ? singleRow
116
+ : singleRow === 'default'
112
117
  ? { xs: 12, sm: 12, md: 12, lg: 6, xl: 6 }
113
118
  : singleRow === true
114
119
  ? { xs: 12, sm: 12, md: 12, lg: 12, xl: 12 }
@@ -37,13 +37,15 @@ export function MoneyText(props: MoneyTextProps) {
37
37
  // Layout
38
38
  return (
39
39
  <Typography component="span" fontSize="inherit" {...rest}>
40
- {NumberUtils.formatMoney(
41
- value,
42
- currency,
43
- locale,
44
- isInteger,
45
- options
46
- )}
40
+ {value == null
41
+ ? ''
42
+ : NumberUtils.formatMoney(
43
+ value,
44
+ currency,
45
+ locale,
46
+ isInteger,
47
+ options
48
+ )}
47
49
  </Typography>
48
50
  );
49
51
  }
@@ -19,7 +19,7 @@ export interface NumberTextProps extends TypographyProps {
19
19
  /**
20
20
  * Value
21
21
  */
22
- value?: number | bigint;
22
+ value?: number | bigint | null;
23
23
  }
24
24
 
25
25
  /**
@@ -34,7 +34,7 @@ export function NumberText(props: NumberTextProps) {
34
34
  // Layout
35
35
  return (
36
36
  <Typography component="span" fontSize="inherit" {...rest}>
37
- {NumberUtils.format(value, locale, options)}
37
+ {value == null ? '' : NumberUtils.format(value, locale, options)}
38
38
  </Typography>
39
39
  );
40
40
  }