@etsoo/materialui 1.6.40 → 1.6.42

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.
Files changed (110) hide show
  1. package/__tests__/SwitchAnt.tsx +6 -7
  2. package/lib/cjs/ButtonPopupCheckbox.js +8 -3
  3. package/lib/cjs/ButtonPopupRadio.js +6 -2
  4. package/lib/cjs/ComboBox.js +7 -5
  5. package/lib/cjs/ComboBoxMultiple.js +5 -3
  6. package/lib/cjs/DataGridEx.js +25 -6
  7. package/lib/cjs/DataSteps.js +21 -11
  8. package/lib/cjs/FileUploadButton.js +5 -1
  9. package/lib/cjs/FlexBox.d.ts +2 -2
  10. package/lib/cjs/FlexBox.js +3 -2
  11. package/lib/cjs/InputField.js +3 -4
  12. package/lib/cjs/MoreFab.js +1 -1
  13. package/lib/cjs/NotifierMU.js +12 -5
  14. package/lib/cjs/OptionGroup.js +1 -1
  15. package/lib/cjs/OptionGroupFlag.js +1 -1
  16. package/lib/cjs/QuickList.js +3 -3
  17. package/lib/cjs/ResponsibleContainer.js +4 -1
  18. package/lib/cjs/SearchBar.js +9 -2
  19. package/lib/cjs/SearchField.js +8 -9
  20. package/lib/cjs/SwitchAnt.js +2 -2
  21. package/lib/cjs/SwitchField.js +1 -1
  22. package/lib/cjs/TextFieldEx.js +6 -11
  23. package/lib/cjs/Tiplist.js +2 -2
  24. package/lib/cjs/TiplistPro.js +1 -1
  25. package/lib/cjs/TwoFieldInput.d.ts +1 -1
  26. package/lib/cjs/TwoFieldInput.js +12 -7
  27. package/lib/cjs/UserAvatarEditor.js +2 -2
  28. package/lib/cjs/ViewContainer.js +2 -2
  29. package/lib/cjs/custom/CustomAttributeArea.js +2 -2
  30. package/lib/cjs/custom/CustomFieldViewer.js +3 -2
  31. package/lib/cjs/custom/CustomFieldWindow.js +2 -1
  32. package/lib/cjs/custom/FieldJson.js +1 -1
  33. package/lib/cjs/custom/FieldTexarea.js +1 -1
  34. package/lib/cjs/index.d.ts +1 -0
  35. package/lib/cjs/index.js +7 -0
  36. package/lib/cjs/pages/EditPage.js +3 -1
  37. package/lib/cjs/pages/ViewPage.js +8 -2
  38. package/lib/mjs/ButtonPopupCheckbox.js +8 -3
  39. package/lib/mjs/ButtonPopupRadio.js +6 -2
  40. package/lib/mjs/ComboBox.js +7 -5
  41. package/lib/mjs/ComboBoxMultiple.js +5 -3
  42. package/lib/mjs/DataGridEx.js +25 -6
  43. package/lib/mjs/DataSteps.js +21 -11
  44. package/lib/mjs/FileUploadButton.js +5 -1
  45. package/lib/mjs/FlexBox.d.ts +2 -2
  46. package/lib/mjs/FlexBox.js +3 -2
  47. package/lib/mjs/InputField.js +3 -4
  48. package/lib/mjs/MoreFab.js +1 -1
  49. package/lib/mjs/NotifierMU.js +12 -5
  50. package/lib/mjs/OptionGroup.js +1 -1
  51. package/lib/mjs/OptionGroupFlag.js +1 -1
  52. package/lib/mjs/QuickList.js +3 -3
  53. package/lib/mjs/ResponsibleContainer.js +4 -1
  54. package/lib/mjs/SearchBar.js +9 -2
  55. package/lib/mjs/SearchField.js +8 -9
  56. package/lib/mjs/SwitchAnt.js +2 -2
  57. package/lib/mjs/SwitchField.js +1 -1
  58. package/lib/mjs/TextFieldEx.js +6 -11
  59. package/lib/mjs/Tiplist.js +2 -2
  60. package/lib/mjs/TiplistPro.js +1 -1
  61. package/lib/mjs/TwoFieldInput.d.ts +1 -1
  62. package/lib/mjs/TwoFieldInput.js +12 -7
  63. package/lib/mjs/UserAvatarEditor.js +2 -2
  64. package/lib/mjs/ViewContainer.js +2 -2
  65. package/lib/mjs/custom/CustomAttributeArea.js +2 -2
  66. package/lib/mjs/custom/CustomFieldViewer.js +3 -2
  67. package/lib/mjs/custom/CustomFieldWindow.js +2 -1
  68. package/lib/mjs/custom/FieldJson.js +1 -1
  69. package/lib/mjs/custom/FieldTexarea.js +1 -1
  70. package/lib/mjs/index.d.ts +1 -0
  71. package/lib/mjs/index.js +2 -0
  72. package/lib/mjs/pages/EditPage.js +3 -1
  73. package/lib/mjs/pages/ViewPage.js +8 -2
  74. package/package.json +8 -8
  75. package/src/ButtonPopupCheckbox.tsx +10 -8
  76. package/src/ButtonPopupRadio.tsx +8 -6
  77. package/src/ComboBox.tsx +7 -5
  78. package/src/ComboBoxMultiple.tsx +5 -3
  79. package/src/ComboBoxPro.tsx +1 -1
  80. package/src/CultureDataTable.tsx +1 -1
  81. package/src/DataGridEx.tsx +27 -20
  82. package/src/DataSteps.tsx +27 -22
  83. package/src/FileUploadButton.tsx +6 -5
  84. package/src/FlexBox.tsx +7 -7
  85. package/src/InputField.tsx +2 -5
  86. package/src/MoreFab.tsx +8 -8
  87. package/src/NotifierMU.tsx +12 -12
  88. package/src/NumberInputField.tsx +1 -0
  89. package/src/OptionGroup.tsx +3 -5
  90. package/src/OptionGroupFlag.tsx +3 -5
  91. package/src/QuickList.tsx +4 -4
  92. package/src/ResponsibleContainer.tsx +3 -3
  93. package/src/SearchBar.tsx +7 -7
  94. package/src/SearchField.tsx +8 -14
  95. package/src/SwitchAnt.tsx +2 -2
  96. package/src/SwitchField.tsx +1 -3
  97. package/src/TextFieldEx.tsx +32 -36
  98. package/src/Tiplist.tsx +2 -2
  99. package/src/TiplistPro.tsx +2 -2
  100. package/src/TwoFieldInput.tsx +33 -31
  101. package/src/UserAvatarEditor.tsx +2 -3
  102. package/src/ViewContainer.tsx +6 -2
  103. package/src/custom/CustomAttributeArea.tsx +3 -3
  104. package/src/custom/CustomFieldViewer.tsx +8 -3
  105. package/src/custom/CustomFieldWindow.tsx +4 -4
  106. package/src/custom/FieldJson.tsx +3 -3
  107. package/src/custom/FieldTexarea.tsx +1 -1
  108. package/src/index.ts +3 -0
  109. package/src/pages/EditPage.tsx +4 -5
  110. package/src/pages/ViewPage.tsx +11 -8
@@ -86,8 +86,6 @@ export function TextFieldEx(props: TextFieldExProps) {
86
86
  error,
87
87
  fullWidth = true,
88
88
  helperText,
89
- InputLabelProps = {},
90
- InputProps = {},
91
89
  slotProps,
92
90
  onChange,
93
91
  onClear,
@@ -107,16 +105,10 @@ export function TextFieldEx(props: TextFieldExProps) {
107
105
  // Slot props
108
106
  const { input, inputLabel, ...restSlotProps } = slotProps ?? {};
109
107
 
110
- // Shrink
111
- InputLabelProps.shrink ??= MUGlobal.searchFieldShrink;
112
-
113
108
  // State
114
109
  const [errorText, updateErrorText] = React.useState<React.ReactNode>();
115
110
  const [empty, updateEmpty] = React.useState<boolean>(true);
116
111
 
117
- // Read only
118
- if (readOnly != null) InputProps.readOnly = readOnly;
119
-
120
112
  // Calculate
121
113
  let errorEx = error;
122
114
  let helperTextEx = helperText;
@@ -181,33 +173,6 @@ export function TextFieldEx(props: TextFieldExProps) {
181
173
  preventDefault(e);
182
174
  };
183
175
 
184
- // Show password and/or clear button
185
- if (!empty && (showPassword || showClear)) {
186
- InputProps.endAdornment = (
187
- <InputAdornment position="end">
188
- {showPassword && (
189
- <IconButton
190
- tabIndex={-1}
191
- onContextMenu={(event) => event.preventDefault()}
192
- onMouseDown={touchStart}
193
- onMouseUp={touchEnd}
194
- onTouchStart={touchStart}
195
- onTouchCancel={touchEnd}
196
- onTouchEnd={touchEnd}
197
- title={showIt}
198
- >
199
- <VisibilityIcon />
200
- </IconButton>
201
- )}
202
- {showClear && (
203
- <IconButton onClick={clearClick} tabIndex={-1} title={clearLabel}>
204
- <ClearIcon />
205
- </IconButton>
206
- )}
207
- </InputAdornment>
208
- );
209
- }
210
-
211
176
  // Extend key precess
212
177
  const onKeyPressEx =
213
178
  onEnter == null
@@ -287,7 +252,38 @@ export function TextFieldEx(props: TextFieldExProps) {
287
252
  onChange={onChangeEx}
288
253
  onKeyDown={onKeyPressEx}
289
254
  slotProps={{
290
- input: { readOnly, ...input, ...InputProps },
255
+ input: {
256
+ endAdornment:
257
+ !empty && (showPassword || showClear) ? (
258
+ <InputAdornment position="end">
259
+ {showPassword && (
260
+ <IconButton
261
+ tabIndex={-1}
262
+ onContextMenu={(event) => event.preventDefault()}
263
+ onMouseDown={touchStart}
264
+ onMouseUp={touchEnd}
265
+ onTouchStart={touchStart}
266
+ onTouchCancel={touchEnd}
267
+ onTouchEnd={touchEnd}
268
+ title={showIt}
269
+ >
270
+ <VisibilityIcon />
271
+ </IconButton>
272
+ )}
273
+ {showClear && (
274
+ <IconButton
275
+ onClick={clearClick}
276
+ tabIndex={-1}
277
+ title={clearLabel}
278
+ >
279
+ <ClearIcon />
280
+ </IconButton>
281
+ )}
282
+ </InputAdornment>
283
+ ) : undefined,
284
+ readOnly,
285
+ ...input
286
+ },
291
287
  inputLabel: {
292
288
  shrink: MUGlobal.inputFieldShrink,
293
289
  ...inputLabel
package/src/Tiplist.tsx CHANGED
@@ -159,7 +159,7 @@ export function Tiplist<
159
159
 
160
160
  // https://stackoverflow.com/questions/15738259/disabling-chrome-autofill
161
161
  // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html
162
- Object.assign(params.inputProps, {
162
+ Object.assign(params.slotProps.htmlInput, {
163
163
  autoComplete: inputAutoComplete,
164
164
  "data-reset": inputReset
165
165
  });
@@ -299,7 +299,7 @@ export function Tiplist<
299
299
  style={{ display: "none" }}
300
300
  name={name}
301
301
  value={`${
302
- inputValue ?? (state.current.idSet ? "" : localIdValue ?? "")
302
+ inputValue ?? (state.current.idSet ? "" : (localIdValue ?? ""))
303
303
  }`}
304
304
  readOnly
305
305
  onChange={inputOnChange}
@@ -312,7 +312,7 @@ export function TiplistPro<T extends ListType2 = ListType2>(
312
312
  type={idIsString ? "text" : "number"}
313
313
  style={{ display: "none" }}
314
314
  name={name}
315
- value={inputValue ?? (state.current.idSet ? "" : localIdValue ?? "")}
315
+ value={inputValue ?? (state.current.idSet ? "" : (localIdValue ?? ""))}
316
316
  readOnly
317
317
  onChange={inputOnChange}
318
318
  disabled={disabled}
@@ -383,7 +383,7 @@ export function TiplistPro<T extends ListType2 = ListType2>(
383
383
  data-reset={inputReset}
384
384
  />
385
385
  )}
386
- isOptionEqualToValue={(option, value) => option.id === value.id}
386
+ isOptionEqualToValue={(option, value) => option.id === (value as T).id}
387
387
  sx={sx}
388
388
  noOptionsText={noOptionsText}
389
389
  loadingText={loadingText}
@@ -11,10 +11,7 @@ type ValueType = string | number | Date | null | undefined;
11
11
  /**
12
12
  * TwoField Input props
13
13
  */
14
- export type TwoFieldInputProps = Omit<
15
- InputFieldProps,
16
- "InputProps" | "value"
17
- > & {
14
+ export type TwoFieldInputProps = Omit<InputFieldProps, "value"> & {
18
15
  /**
19
16
  * Values
20
17
  */
@@ -37,8 +34,8 @@ export function TwoFieldInput(props: TwoFieldInputProps) {
37
34
  // Destruct
38
35
  const {
39
36
  name,
40
- inputProps,
41
- type = inputProps?.inputMode,
37
+ slotProps,
38
+ type,
42
39
  values,
43
40
  onValuesChange,
44
41
  onChange,
@@ -46,13 +43,15 @@ export function TwoFieldInput(props: TwoFieldInputProps) {
46
43
  ...rest
47
44
  } = props;
48
45
 
46
+ const { htmlInput, input, ...restSlotProps } = slotProps ?? {};
47
+
49
48
  // Local values
50
49
  const localValues: [ValueType, ValueType] =
51
50
  values == null
52
51
  ? [null, null]
53
52
  : Array.isArray(values)
54
- ? (values as [ValueType, ValueType])
55
- : [values as ValueType, null];
53
+ ? (values as [ValueType, ValueType])
54
+ : [values as ValueType, null];
56
55
 
57
56
  // Ref
58
57
  const valueRef = React.useRef<[ValueType, ValueType]>(localValues);
@@ -100,29 +99,32 @@ export function TwoFieldInput(props: TwoFieldInputProps) {
100
99
  type={type}
101
100
  value={formatValue(localValues[0], type)}
102
101
  ref={dimensions[0][0]}
103
- inputProps={inputProps}
104
- InputProps={{
105
- endAdornment: (
106
- <InputAdornment
107
- position="end"
108
- sx={{
109
- display: "flex",
110
- alignItems: "center",
111
- gap: 1
112
- }}
113
- >
114
- <ArrowRightAltIcon />
115
- <Input
116
- type={type}
117
- name={`${name}-end`}
118
- value={formatValue(localValues[1], type)}
119
- disableUnderline
120
- onInput={onInput}
121
- onChange={handleChange}
122
- inputProps={inputProps}
123
- />
124
- </InputAdornment>
125
- )
102
+ slotProps={{
103
+ input: {
104
+ ...input,
105
+ endAdornment: (
106
+ <InputAdornment
107
+ position="end"
108
+ sx={{
109
+ display: "flex",
110
+ alignItems: "center",
111
+ gap: 1
112
+ }}
113
+ >
114
+ <ArrowRightAltIcon />
115
+ <Input
116
+ type={type}
117
+ name={`${name}-end`}
118
+ value={formatValue(localValues[1], type)}
119
+ disableUnderline
120
+ onInput={onInput}
121
+ onChange={handleChange}
122
+ slotProps={{ input: htmlInput as any }} // Fix it in the future
123
+ />
124
+ </InputAdornment>
125
+ )
126
+ },
127
+ ...restSlotProps
126
128
  }}
127
129
  onInput={onInput}
128
130
  onChange={handleChange}
@@ -303,7 +303,7 @@ export function UserAvatarEditor(props: UserAvatarEditorProps) {
303
303
  };
304
304
 
305
305
  return (
306
- <Stack direction="column" spacing={0.5} width={containerWidth}>
306
+ <Stack direction="column" spacing={0.5} sx={{ width: containerWidth }}>
307
307
  <FileUploadButton
308
308
  variant="outlined"
309
309
  size="medium"
@@ -349,8 +349,7 @@ export function UserAvatarEditor(props: UserAvatarEditorProps) {
349
349
  <Stack
350
350
  spacing={0.5}
351
351
  direction="row"
352
- sx={{ paddingBottom: 2 }}
353
- alignItems="center"
352
+ sx={{ alignItems: "center", paddingBottom: 2 }}
354
353
  >
355
354
  <IconButton
356
355
  size="small"
@@ -222,7 +222,11 @@ export function ViewPageGridItem(props: ViewPageGridItemProps) {
222
222
  {typeof data === "object" ? (
223
223
  data
224
224
  ) : horizontal ? (
225
- <Typography variant="subtitle2" component="span" marginLeft={0.5}>
225
+ <Typography
226
+ variant="subtitle2"
227
+ component="span"
228
+ sx={{ marginLeft: 0.5 }}
229
+ >
226
230
  {data}
227
231
  </Typography>
228
232
  ) : (
@@ -423,10 +427,10 @@ export function ViewContainer<T extends DataTypes.StringRecord>(
423
427
  return (
424
428
  <Grid
425
429
  container
426
- justifyContent="left"
427
430
  className="ET-ViewContainer"
428
431
  ref={gridRef}
429
432
  spacing={spacing}
433
+ sx={{ justifyContent: "left" }}
430
434
  >
431
435
  {leftContainer && (leftResult = leftContainer(data)) != null && (
432
436
  <React.Fragment>
@@ -55,7 +55,7 @@ function InputItemUIs({ data }: { data?: CustomFieldData }) {
55
55
  const optionsRef = React.useRef<HTMLInputElement>(null);
56
56
 
57
57
  return (
58
- <Grid container spacing={2} marginTop={1}>
58
+ <Grid container spacing={2} sx={{ marginTop: 1 }}>
59
59
  <Grid size={{ xs: 12, sm: 6 }}>
60
60
  <ComboBox
61
61
  name="type"
@@ -334,7 +334,7 @@ function InputUIs({
334
334
 
335
335
  return (
336
336
  <React.Fragment>
337
- <HBox marginBottom={0.5} gap={1} alignItems="center">
337
+ <HBox spacing={1} sx={{ marginTop: 0.5, alignItems: "center" }}>
338
338
  <Typography>{labels.sortTip}</Typography>
339
339
  <Button
340
340
  size="small"
@@ -364,7 +364,7 @@ function InputUIs({
364
364
  size={{ xs: 12, sm: 12 }}
365
365
  ref={ref}
366
366
  style={style}
367
- gap={1}
367
+ spacing={1}
368
368
  >
369
369
  <Grid size={smallSize}>
370
370
  <IconButton
@@ -99,9 +99,9 @@ export function CustomFieldViewer(props: CustomFieldViewerProps) {
99
99
  return (
100
100
  <Grid
101
101
  container
102
- justifyContent="left"
103
102
  spacing={spacing}
104
103
  sx={{
104
+ justifyContent: "left",
105
105
  ".MuiTypography-subtitle2": {
106
106
  fontWeight: "bold"
107
107
  }
@@ -122,8 +122,13 @@ export function CustomFieldViewer(props: CustomFieldViewerProps) {
122
122
  size={CustomFieldUtils.transformSpace(field.space)}
123
123
  {...field.gridItemProps}
124
124
  >
125
- <VBox gap={verticalGap}>
126
- <Typography fontWeight="bold" fontSize="small" {...titleProps}>
125
+ <VBox spacing={verticalGap}>
126
+ <Typography
127
+ component="div"
128
+ fontWeight="bold"
129
+ fontSize="small"
130
+ {...titleProps}
131
+ >
127
132
  {field.label ?? name}
128
133
  </Typography>
129
134
  <Typography {...valueProps}>
@@ -29,8 +29,8 @@ function parseJsonData(jsonData: unknown): [Record<string, unknown>, number] {
29
29
  typeof jsonData === "object"
30
30
  ? jsonData
31
31
  : typeof jsonData === "string"
32
- ? JSON.parse(jsonData)
33
- : {};
32
+ ? JSON.parse(jsonData)
33
+ : {};
34
34
  } catch {}
35
35
  }
36
36
  return [data, calculateKeys(data)];
@@ -153,12 +153,12 @@ export function CustomFieldWindow<D extends CustomFieldData = CustomFieldData>(
153
153
  {
154
154
  fullScreen: app.smDown,
155
155
  inputs: (
156
- <Stack marginTop={1.5}>
156
+ <Stack sx={{ marginTop: 1.5 }}>
157
157
  <Grid
158
158
  container
159
- justifyContent="left"
160
159
  spacing={spacing}
161
160
  sx={{
161
+ justifyContent: "left",
162
162
  ".MuiTypography-subtitle2": {
163
163
  fontWeight: "bold"
164
164
  }
@@ -36,8 +36,8 @@ export const FieldJson: ICustomFieldReact<object> = ({
36
36
  typeof value === "object"
37
37
  ? value
38
38
  : typeof value === "string"
39
- ? parseJson(value)
40
- : undefined;
39
+ ? parseJson(value)
40
+ : undefined;
41
41
  inputRef.current.value = obj ? JSON.stringify(obj, null, 4) : "";
42
42
  }
43
43
  };
@@ -68,7 +68,7 @@ export const FieldJson: ICustomFieldReact<object> = ({
68
68
  fullWidth
69
69
  multiline
70
70
  rows={4}
71
- inputProps={{ maxLength: 1280 }}
71
+ slotProps={{ htmlInput: { maxLength: 1280 } }}
72
72
  inputRef={inputRef}
73
73
  onChange={() => onChange(name, getValue())}
74
74
  {...field.mainSlotProps}
@@ -44,7 +44,7 @@ export const FieldTexarea: ICustomFieldReact<string> = ({
44
44
  fullWidth
45
45
  multiline
46
46
  rows={4}
47
- inputProps={{ maxLength: 1280 }}
47
+ slotProps={{ htmlInput: { maxLength: 1280 } }}
48
48
  inputRef={inputRef}
49
49
  defaultValue={defaultValue}
50
50
  onChange={() => onChange(name, getValue())}
package/src/index.ts CHANGED
@@ -140,3 +140,6 @@ export * from "./TooltipClick";
140
140
  export * from "./UserAvatar";
141
141
  export * from "./UserAvatarEditor";
142
142
  export * from "./ViewContainer";
143
+
144
+ // Icons
145
+ export { default as AccountTreeIcon } from "@mui/icons-material/AccountTree";
@@ -95,18 +95,17 @@ export function EditPage(props: EditPageProps) {
95
95
  <form onSubmit={onSubmit}>
96
96
  <Grid
97
97
  container
98
- justifyContent="left"
99
98
  spacing={gridSpacing}
100
- paddingTop={1}
99
+ sx={{ justifyContent: "left", paddingTop: 1 }}
101
100
  >
102
101
  {children}
103
102
  </Grid>
104
103
  <Grid
105
104
  container
106
- position="sticky"
107
- display="flex"
108
- gap={gridSpacing}
105
+ spacing={gridSpacing}
109
106
  sx={{
107
+ position: "sticky",
108
+ display: "flex",
110
109
  top: "auto",
111
110
  bottom: (theme) =>
112
111
  MUGlobal.updateWithTheme(gridSpacing, theme.spacing),
@@ -23,18 +23,20 @@ export function ViewPageActionBar(
23
23
  actionPaddings?: number | Record<string, string | number>;
24
24
  }
25
25
  ) {
26
- const { actionPaddings = MUGlobal.pagePaddings, ...rest } = props;
26
+ const { actionPaddings = MUGlobal.pagePaddings, sx, ...rest } = props;
27
27
 
28
28
  return (
29
29
  <Stack
30
30
  className="ET-ViewPage-Actions"
31
31
  direction="row"
32
- width="100%"
33
- flexWrap="wrap"
34
- justifyContent="center"
35
- paddingTop={actionPaddings}
36
- paddingBottom={actionPaddings}
37
- gap={actionPaddings}
32
+ spacing={actionPaddings}
33
+ sx={{
34
+ flexWrap: "wrap",
35
+ justifyContent: "center",
36
+ paddingTop: actionPaddings,
37
+ paddingBottom: actionPaddings,
38
+ ...sx
39
+ }}
38
40
  {...rest}
39
41
  ></Stack>
40
42
  );
@@ -44,7 +46,8 @@ export function ViewPageActionBar(
44
46
  * View page props
45
47
  */
46
48
  export interface ViewPageProps<T extends DataTypes.StringRecord>
47
- extends Omit<CommonPageProps, "children">,
49
+ extends
50
+ Omit<CommonPageProps, "children">,
48
51
  Omit<ViewContainerProps<T>, "data" | "refresh"> {
49
52
  /**
50
53
  * Actions