@etsoo/materialui 1.6.44 → 1.6.46

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.
@@ -319,9 +319,7 @@ function DataGridEx(props) {
319
319
  const child = cellRenderer({
320
320
  data,
321
321
  field,
322
- formattedValue: valueFormatter
323
- ? valueFormatter(formatProps)
324
- : undefined,
322
+ formattedValue: valueFormatter ? valueFormatter(formatProps) : null,
325
323
  selected,
326
324
  type,
327
325
  rowIndex,
@@ -27,16 +27,19 @@ var DataGridRenderers;
27
27
  // First column, show loading indicator
28
28
  if (columnIndex === 0)
29
29
  return (0, jsx_runtime_1.jsx)(CircularProgress_1.default, { size: 15 });
30
- // Others return undefined
31
- return undefined;
30
+ // Others return
31
+ return;
32
32
  }
33
+ // No formatted value
34
+ if (formattedValue === undefined)
35
+ return;
33
36
  // No formatted value and data field
34
37
  if (formattedValue == null && field == null)
35
- return undefined;
38
+ return;
36
39
  // Cell value
37
40
  const value = formattedValue ?? data[field];
38
41
  if (value == null)
39
- return undefined;
42
+ return;
40
43
  // For unknow and string type, keep the simple format
41
44
  if (type === react_1.GridDataType.Unkwown)
42
45
  return value;
@@ -104,7 +107,6 @@ var DataGridRenderers;
104
107
  return loadedItems.toLocaleString() + (hasNextPage ? "+" : "");
105
108
  }
106
109
  }
107
- return undefined;
108
110
  }
109
111
  DataGridRenderers.defaultFooterItemRenderer = defaultFooterItemRenderer;
110
112
  })(DataGridRenderers || (exports.DataGridRenderers = DataGridRenderers = {}));
@@ -16,6 +16,10 @@ export type InputFieldProps = TextFieldProps & {
16
16
  * Is the field read only?
17
17
  */
18
18
  readOnly?: boolean;
19
+ /**
20
+ * Search case
21
+ */
22
+ search?: boolean;
19
23
  };
20
24
  /**
21
25
  * Input field
@@ -16,7 +16,7 @@ const TextField_1 = __importDefault(require("@mui/material/TextField"));
16
16
  */
17
17
  function InputField(props) {
18
18
  // Destruct
19
- const { slotProps, onChange, onChangeDelay, changeDelay = onChangeDelay ? [480] : undefined, readOnly, size = MUGlobal_1.MUGlobal.inputFieldSize, variant = MUGlobal_1.MUGlobal.inputFieldVariant, ...rest } = props;
19
+ const { slotProps, onChange, onChangeDelay, changeDelay = onChangeDelay ? [480] : undefined, readOnly, search = false, size = search ? MUGlobal_1.MUGlobal.searchFieldSize : MUGlobal_1.MUGlobal.inputFieldSize, variant = search ? MUGlobal_1.MUGlobal.searchFieldVariant : MUGlobal_1.MUGlobal.inputFieldVariant, ...rest } = props;
20
20
  // Slot props
21
21
  const { htmlInput, input, inputLabel, ...restSlotProps } = slotProps ?? {};
22
22
  const isMounted = react_2.default.useRef(true);
@@ -54,7 +54,9 @@ function InputField(props) {
54
54
  },
55
55
  input: { readOnly, ...input },
56
56
  inputLabel: {
57
- shrink: MUGlobal_1.MUGlobal.inputFieldShrink,
57
+ shrink: search
58
+ ? MUGlobal_1.MUGlobal.searchFieldShrink
59
+ : MUGlobal_1.MUGlobal.inputFieldShrink,
58
60
  ...inputLabel
59
61
  },
60
62
  ...restSlotProps
@@ -29,10 +29,6 @@ export type NumberInputFieldProps = Omit<InputFieldProps, "type" | "inputProps">
29
29
  * Maximum value
30
30
  */
31
31
  max?: number;
32
- /**
33
- * Is search field?
34
- */
35
- search?: boolean;
36
32
  /**
37
33
  * Step value
38
34
  */
@@ -9,7 +9,6 @@ const react_1 = __importDefault(require("react"));
9
9
  const InputField_1 = require("./InputField");
10
10
  const shared_1 = require("@etsoo/shared");
11
11
  const InputAdornment_1 = __importDefault(require("@mui/material/InputAdornment"));
12
- const MUGlobal_1 = require("./MUGlobal");
13
12
  /**
14
13
  * Number input field, for controlled only components, please see IntInputField and MoneyInputField
15
14
  * @param props Props
@@ -18,13 +17,12 @@ const MUGlobal_1 = require("./MUGlobal");
18
17
  function NumberInputField(props) {
19
18
  const { currency, inputStyle, min = 0, step = 1, symbol = currency
20
19
  ? `${currency} ${shared_1.NumberUtils.getCurrencySymbol(currency)}`
21
- : undefined, endSymbol, max = 9999999, search = false, slotProps = {}, ...rest } = props;
22
- return ((0, jsx_runtime_1.jsx)(InputField_1.InputField, { type: "number", size: search ? MUGlobal_1.MUGlobal.searchFieldSize : undefined, slotProps: Object.assign(slotProps, {
20
+ : undefined, endSymbol, max = 9999999, slotProps = {}, ...rest } = props;
21
+ return ((0, jsx_runtime_1.jsx)(InputField_1.InputField, { type: "number", slotProps: Object.assign(slotProps, {
23
22
  input: {
24
23
  startAdornment: symbol ? ((0, jsx_runtime_1.jsx)(react_1.default.Fragment, { children: (0, jsx_runtime_1.jsx)(InputAdornment_1.default, { position: "start", children: symbol }) })) : undefined,
25
24
  endAdornment: endSymbol ? ((0, jsx_runtime_1.jsx)(InputAdornment_1.default, { position: "end", children: endSymbol })) : undefined
26
25
  },
27
- inputLabel: { shrink: search ? MUGlobal_1.MUGlobal.searchFieldShrink : undefined },
28
26
  htmlInput: {
29
27
  min,
30
28
  step,
@@ -32,5 +30,5 @@ function NumberInputField(props) {
32
30
  style: inputStyle,
33
31
  inputMode: "numeric"
34
32
  }
35
- }), variant: search ? MUGlobal_1.MUGlobal.searchFieldVariant : undefined, ...rest }));
33
+ }), ...rest }));
36
34
  }
@@ -312,9 +312,7 @@ export function DataGridEx(props) {
312
312
  const child = cellRenderer({
313
313
  data,
314
314
  field,
315
- formattedValue: valueFormatter
316
- ? valueFormatter(formatProps)
317
- : undefined,
315
+ formattedValue: valueFormatter ? valueFormatter(formatProps) : null,
318
316
  selected,
319
317
  type,
320
318
  rowIndex,
@@ -21,16 +21,19 @@ export var DataGridRenderers;
21
21
  // First column, show loading indicator
22
22
  if (columnIndex === 0)
23
23
  return _jsx(CircularProgress, { size: 15 });
24
- // Others return undefined
25
- return undefined;
24
+ // Others return
25
+ return;
26
26
  }
27
+ // No formatted value
28
+ if (formattedValue === undefined)
29
+ return;
27
30
  // No formatted value and data field
28
31
  if (formattedValue == null && field == null)
29
- return undefined;
32
+ return;
30
33
  // Cell value
31
34
  const value = formattedValue ?? data[field];
32
35
  if (value == null)
33
- return undefined;
36
+ return;
34
37
  // For unknow and string type, keep the simple format
35
38
  if (type === GridDataType.Unkwown)
36
39
  return value;
@@ -98,7 +101,6 @@ export var DataGridRenderers;
98
101
  return loadedItems.toLocaleString() + (hasNextPage ? "+" : "");
99
102
  }
100
103
  }
101
- return undefined;
102
104
  }
103
105
  DataGridRenderers.defaultFooterItemRenderer = defaultFooterItemRenderer;
104
106
  })(DataGridRenderers || (DataGridRenderers = {}));
@@ -16,6 +16,10 @@ export type InputFieldProps = TextFieldProps & {
16
16
  * Is the field read only?
17
17
  */
18
18
  readOnly?: boolean;
19
+ /**
20
+ * Search case
21
+ */
22
+ search?: boolean;
19
23
  };
20
24
  /**
21
25
  * Input field
@@ -10,7 +10,7 @@ import TextField from "@mui/material/TextField";
10
10
  */
11
11
  export function InputField(props) {
12
12
  // Destruct
13
- const { slotProps, onChange, onChangeDelay, changeDelay = onChangeDelay ? [480] : undefined, readOnly, size = MUGlobal.inputFieldSize, variant = MUGlobal.inputFieldVariant, ...rest } = props;
13
+ const { slotProps, onChange, onChangeDelay, changeDelay = onChangeDelay ? [480] : undefined, readOnly, search = false, size = search ? MUGlobal.searchFieldSize : MUGlobal.inputFieldSize, variant = search ? MUGlobal.searchFieldVariant : MUGlobal.inputFieldVariant, ...rest } = props;
14
14
  // Slot props
15
15
  const { htmlInput, input, inputLabel, ...restSlotProps } = slotProps ?? {};
16
16
  const isMounted = React.useRef(true);
@@ -48,7 +48,9 @@ export function InputField(props) {
48
48
  },
49
49
  input: { readOnly, ...input },
50
50
  inputLabel: {
51
- shrink: MUGlobal.inputFieldShrink,
51
+ shrink: search
52
+ ? MUGlobal.searchFieldShrink
53
+ : MUGlobal.inputFieldShrink,
52
54
  ...inputLabel
53
55
  },
54
56
  ...restSlotProps
@@ -29,10 +29,6 @@ export type NumberInputFieldProps = Omit<InputFieldProps, "type" | "inputProps">
29
29
  * Maximum value
30
30
  */
31
31
  max?: number;
32
- /**
33
- * Is search field?
34
- */
35
- search?: boolean;
36
32
  /**
37
33
  * Step value
38
34
  */
@@ -3,7 +3,6 @@ import React from "react";
3
3
  import { InputField } from "./InputField";
4
4
  import { NumberUtils } from "@etsoo/shared";
5
5
  import InputAdornment from "@mui/material/InputAdornment";
6
- import { MUGlobal } from "./MUGlobal";
7
6
  /**
8
7
  * Number input field, for controlled only components, please see IntInputField and MoneyInputField
9
8
  * @param props Props
@@ -12,13 +11,12 @@ import { MUGlobal } from "./MUGlobal";
12
11
  export function NumberInputField(props) {
13
12
  const { currency, inputStyle, min = 0, step = 1, symbol = currency
14
13
  ? `${currency} ${NumberUtils.getCurrencySymbol(currency)}`
15
- : undefined, endSymbol, max = 9999999, search = false, slotProps = {}, ...rest } = props;
16
- return (_jsx(InputField, { type: "number", size: search ? MUGlobal.searchFieldSize : undefined, slotProps: Object.assign(slotProps, {
14
+ : undefined, endSymbol, max = 9999999, slotProps = {}, ...rest } = props;
15
+ return (_jsx(InputField, { type: "number", slotProps: Object.assign(slotProps, {
17
16
  input: {
18
17
  startAdornment: symbol ? (_jsx(React.Fragment, { children: _jsx(InputAdornment, { position: "start", children: symbol }) })) : undefined,
19
18
  endAdornment: endSymbol ? (_jsx(InputAdornment, { position: "end", children: endSymbol })) : undefined
20
19
  },
21
- inputLabel: { shrink: search ? MUGlobal.searchFieldShrink : undefined },
22
20
  htmlInput: {
23
21
  min,
24
22
  step,
@@ -26,5 +24,5 @@ export function NumberInputField(props) {
26
24
  style: inputStyle,
27
25
  inputMode: "numeric"
28
26
  }
29
- }), variant: search ? MUGlobal.searchFieldVariant : undefined, ...rest }));
27
+ }), ...rest }));
30
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.6.44",
3
+ "version": "1.6.46",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -40,9 +40,9 @@
40
40
  "@dnd-kit/react": "^0.4.0",
41
41
  "@emotion/react": "^11.14.0",
42
42
  "@emotion/styled": "^11.14.1",
43
- "@etsoo/appscript": "^1.6.60",
43
+ "@etsoo/appscript": "^1.6.61",
44
44
  "@etsoo/notificationbase": "^1.1.69",
45
- "@etsoo/react": "^1.8.84",
45
+ "@etsoo/react": "^1.8.85",
46
46
  "@etsoo/shared": "^1.2.83",
47
47
  "@mui/icons-material": "^9.0.0",
48
48
  "@mui/material": "^9.0.0",
@@ -665,9 +665,7 @@ export function DataGridEx<T extends object>(props: DataGridExProps<T>) {
665
665
  const child = cellRenderer({
666
666
  data,
667
667
  field,
668
- formattedValue: valueFormatter
669
- ? valueFormatter(formatProps)
670
- : undefined,
668
+ formattedValue: valueFormatter ? valueFormatter(formatProps) : null,
671
669
  selected,
672
670
  type,
673
671
  rowIndex,
@@ -31,16 +31,19 @@ export namespace DataGridRenderers {
31
31
  // First column, show loading indicator
32
32
  if (columnIndex === 0) return <CircularProgress size={15} />;
33
33
 
34
- // Others return undefined
35
- return undefined;
34
+ // Others return
35
+ return;
36
36
  }
37
37
 
38
+ // No formatted value
39
+ if (formattedValue === undefined) return;
40
+
38
41
  // No formatted value and data field
39
- if (formattedValue == null && field == null) return undefined;
42
+ if (formattedValue == null && field == null) return;
40
43
 
41
44
  // Cell value
42
45
  const value = formattedValue ?? data[field!];
43
- if (value == null) return undefined;
46
+ if (value == null) return;
44
47
 
45
48
  // For unknow and string type, keep the simple format
46
49
  if (type === GridDataType.Unkwown) return value;
@@ -139,7 +142,5 @@ export namespace DataGridRenderers {
139
142
  return loadedItems.toLocaleString() + (hasNextPage ? "+" : "");
140
143
  }
141
144
  }
142
-
143
- return undefined;
144
145
  }
145
146
  }
@@ -23,6 +23,11 @@ export type InputFieldProps = TextFieldProps & {
23
23
  * Is the field read only?
24
24
  */
25
25
  readOnly?: boolean;
26
+
27
+ /**
28
+ * Search case
29
+ */
30
+ search?: boolean;
26
31
  };
27
32
 
28
33
  /**
@@ -38,8 +43,9 @@ export function InputField(props: InputFieldProps) {
38
43
  onChangeDelay,
39
44
  changeDelay = onChangeDelay ? [480] : undefined,
40
45
  readOnly,
41
- size = MUGlobal.inputFieldSize,
42
- variant = MUGlobal.inputFieldVariant,
46
+ search = false,
47
+ size = search ? MUGlobal.searchFieldSize : MUGlobal.inputFieldSize,
48
+ variant = search ? MUGlobal.searchFieldVariant : MUGlobal.inputFieldVariant,
43
49
  ...rest
44
50
  } = props;
45
51
 
@@ -90,7 +96,9 @@ export function InputField(props: InputFieldProps) {
90
96
  },
91
97
  input: { readOnly, ...input },
92
98
  inputLabel: {
93
- shrink: MUGlobal.inputFieldShrink,
99
+ shrink: search
100
+ ? MUGlobal.searchFieldShrink
101
+ : MUGlobal.inputFieldShrink,
94
102
  ...inputLabel
95
103
  },
96
104
  ...restSlotProps
@@ -42,11 +42,6 @@ export type NumberInputFieldProps = Omit<
42
42
  */
43
43
  max?: number;
44
44
 
45
- /**
46
- * Is search field?
47
- */
48
- search?: boolean;
49
-
50
45
  /**
51
46
  * Step value
52
47
  */
@@ -69,7 +64,6 @@ export function NumberInputField(props: NumberInputFieldProps) {
69
64
  : undefined,
70
65
  endSymbol,
71
66
  max = 9999999,
72
- search = false,
73
67
  slotProps = {},
74
68
  ...rest
75
69
  } = props;
@@ -77,7 +71,6 @@ export function NumberInputField(props: NumberInputFieldProps) {
77
71
  return (
78
72
  <InputField
79
73
  type="number"
80
- size={search ? MUGlobal.searchFieldSize : undefined}
81
74
  slotProps={Object.assign(slotProps, {
82
75
  input: {
83
76
  startAdornment: symbol ? (
@@ -89,7 +82,6 @@ export function NumberInputField(props: NumberInputFieldProps) {
89
82
  <InputAdornment position="end">{endSymbol}</InputAdornment>
90
83
  ) : undefined
91
84
  },
92
- inputLabel: { shrink: search ? MUGlobal.searchFieldShrink : undefined },
93
85
  htmlInput: {
94
86
  min,
95
87
  step,
@@ -98,7 +90,6 @@ export function NumberInputField(props: NumberInputFieldProps) {
98
90
  inputMode: "numeric"
99
91
  }
100
92
  })}
101
- variant={search ? MUGlobal.searchFieldVariant : undefined}
102
93
  {...rest}
103
94
  />
104
95
  );