@etsoo/materialui 1.6.66 → 1.6.68

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.
@@ -1,5 +1,5 @@
1
1
  import { DataTypes } from "@etsoo/shared";
2
- import { AutocompleteProps } from "@mui/material/Autocomplete";
2
+ import { AutocompleteChangeReason, AutocompleteProps } from "@mui/material/Autocomplete";
3
3
  import { ChangeEventHandler } from "react";
4
4
  /**
5
5
  * Autocomplete extended props
@@ -74,6 +74,7 @@ export type AutocompleteExtendedProps<T extends object, D extends DataTypes.Keys
74
74
  * Value change handler
75
75
  * @param value New value
76
76
  * @param input Input element
77
+ * @param reason Reason for the change, 'undefined' for initial value change
77
78
  */
78
- onValueChange?: (value: T | null, input?: HTMLInputElement | null) => void;
79
+ onValueChange?: (value: T | null, input?: HTMLInputElement | null, reason?: AutocompleteChangeReason) => void;
79
80
  };
@@ -133,7 +133,7 @@ function ComboBox(props) {
133
133
  if (onChange != null)
134
134
  onChange(event, value, reason, details);
135
135
  if (onValueChange)
136
- onValueChange(value, inputRef.current);
136
+ onValueChange(value, inputRef.current, reason);
137
137
  }, openOnFocus: openOnFocus, sx: sx, renderInput: (params) => search ? ((0, jsx_runtime_1.jsx)(SearchField_1.SearchField, { ...addReadOnly(params), label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, error: inputError, helperText: inputHelperText })) : ((0, jsx_runtime_1.jsx)(InputField_1.InputField, { ...addReadOnly(params), label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, error: inputError, helperText: inputHelperText })), options: localOptions, noOptionsText: noOptionsText, loadingText: loadingText, openText: openText, getOptionKey: getOptionKey, ...rest }), onAdd && ((0, jsx_runtime_1.jsx)(IconButton_1.default, { size: "small", onClick: () => {
138
138
  onAdd(doLoadData);
139
139
  }, title: addLabel, children: (0, jsx_runtime_1.jsx)(Add_1.default, {}) }))] })] }));
@@ -49,7 +49,7 @@ function SelectEx(props) {
49
49
  };
50
50
  // Local value
51
51
  const v = defaultValue ?? value;
52
- const valueSource = react_1.default.useMemo(() => (multiple ? (v ? (Array.isArray(v) ? v : [v]) : []) : v ?? ""), [multiple, v]);
52
+ const valueSource = react_1.default.useMemo(() => (multiple ? (v ? (Array.isArray(v) ? v : [v]) : []) : (v ?? "")), [multiple, v]);
53
53
  const setOptionsAdd = react_1.default.useCallback((options) => {
54
54
  const localOptions = [...options];
55
55
  if (autoAddBlankItem) {
@@ -192,7 +192,7 @@ function SelectEx(props) {
192
192
  }
193
193
  }, style: itemStyle == null ? undefined : itemStyle(option), children: [multiple && ((0, jsx_runtime_1.jsx)(Checkbox_1.default, { checked: Array.isArray(valueState)
194
194
  ? valueState.includes(id)
195
- : valueState === id })), (0, jsx_runtime_1.jsx)(ListItemText_1.default, { primary: label }), itemIconRenderer && ((0, jsx_runtime_1.jsx)(ListItemRightIcon_1.ListItemRightIcon, { children: itemIconRenderer(option[idField]) }))] }, id));
195
+ : valueState === id })), (0, jsx_runtime_1.jsx)(ListItemText_1.default, { primary: label, slotProps: { primary: { noWrap: true } } }), itemIconRenderer && ((0, jsx_runtime_1.jsx)(ListItemRightIcon_1.ListItemRightIcon, { children: itemIconRenderer(option[idField]) }))] }, id));
196
196
  }) }), helperText != null && (0, jsx_runtime_1.jsx)(FormHelperText_1.default, { children: helperText })] }), refresh != null &&
197
197
  loadData != null &&
198
198
  (typeof refresh === "string" ? ((0, jsx_runtime_1.jsx)(IconButton_1.default, { size: "small", title: refresh, onClick: refreshData, children: (0, jsx_runtime_1.jsx)(Refresh_1.default, {}) })) : (refresh))] }));
@@ -183,7 +183,7 @@ function Tiplist(props) {
183
183
  if (onChange != null)
184
184
  onChange(event, value, reason, details);
185
185
  if (onValueChange)
186
- onValueChange(value, inputRef.current);
186
+ onValueChange(value, inputRef.current, reason);
187
187
  // For clear case
188
188
  if (reason === "clear") {
189
189
  stateUpdate({ options: [], open: event.type === "click" });
@@ -1,5 +1,5 @@
1
1
  import { DataTypes } from "@etsoo/shared";
2
- import { AutocompleteProps } from "@mui/material/Autocomplete";
2
+ import { AutocompleteChangeReason, AutocompleteProps } from "@mui/material/Autocomplete";
3
3
  import { ChangeEventHandler } from "react";
4
4
  /**
5
5
  * Autocomplete extended props
@@ -74,6 +74,7 @@ export type AutocompleteExtendedProps<T extends object, D extends DataTypes.Keys
74
74
  * Value change handler
75
75
  * @param value New value
76
76
  * @param input Input element
77
+ * @param reason Reason for the change, 'undefined' for initial value change
77
78
  */
78
- onValueChange?: (value: T | null, input?: HTMLInputElement | null) => void;
79
+ onValueChange?: (value: T | null, input?: HTMLInputElement | null, reason?: AutocompleteChangeReason) => void;
79
80
  };
@@ -127,7 +127,7 @@ export function ComboBox(props) {
127
127
  if (onChange != null)
128
128
  onChange(event, value, reason, details);
129
129
  if (onValueChange)
130
- onValueChange(value, inputRef.current);
130
+ onValueChange(value, inputRef.current, reason);
131
131
  }, openOnFocus: openOnFocus, sx: sx, renderInput: (params) => search ? (_jsx(SearchField, { ...addReadOnly(params), label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, error: inputError, helperText: inputHelperText })) : (_jsx(InputField, { ...addReadOnly(params), label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, error: inputError, helperText: inputHelperText })), options: localOptions, noOptionsText: noOptionsText, loadingText: loadingText, openText: openText, getOptionKey: getOptionKey, ...rest }), onAdd && (_jsx(IconButton, { size: "small", onClick: () => {
132
132
  onAdd(doLoadData);
133
133
  }, title: addLabel, children: _jsx(AddIcon, {}) }))] })] }));
@@ -43,7 +43,7 @@ export function SelectEx(props) {
43
43
  };
44
44
  // Local value
45
45
  const v = defaultValue ?? value;
46
- const valueSource = React.useMemo(() => (multiple ? (v ? (Array.isArray(v) ? v : [v]) : []) : v ?? ""), [multiple, v]);
46
+ const valueSource = React.useMemo(() => (multiple ? (v ? (Array.isArray(v) ? v : [v]) : []) : (v ?? "")), [multiple, v]);
47
47
  const setOptionsAdd = React.useCallback((options) => {
48
48
  const localOptions = [...options];
49
49
  if (autoAddBlankItem) {
@@ -186,7 +186,7 @@ export function SelectEx(props) {
186
186
  }
187
187
  }, style: itemStyle == null ? undefined : itemStyle(option), children: [multiple && (_jsx(Checkbox, { checked: Array.isArray(valueState)
188
188
  ? valueState.includes(id)
189
- : valueState === id })), _jsx(ListItemText, { primary: label }), itemIconRenderer && (_jsx(ListItemRightIcon, { children: itemIconRenderer(option[idField]) }))] }, id));
189
+ : valueState === id })), _jsx(ListItemText, { primary: label, slotProps: { primary: { noWrap: true } } }), itemIconRenderer && (_jsx(ListItemRightIcon, { children: itemIconRenderer(option[idField]) }))] }, id));
190
190
  }) }), helperText != null && _jsx(FormHelperText, { children: helperText })] }), refresh != null &&
191
191
  loadData != null &&
192
192
  (typeof refresh === "string" ? (_jsx(IconButton, { size: "small", title: refresh, onClick: refreshData, children: _jsx(RefreshIcon, {}) })) : (refresh))] }));
@@ -177,7 +177,7 @@ export function Tiplist(props) {
177
177
  if (onChange != null)
178
178
  onChange(event, value, reason, details);
179
179
  if (onValueChange)
180
- onValueChange(value, inputRef.current);
180
+ onValueChange(value, inputRef.current, reason);
181
181
  // For clear case
182
182
  if (reason === "clear") {
183
183
  stateUpdate({ options: [], open: event.type === "click" });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.6.66",
3
+ "version": "1.6.68",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -65,12 +65,12 @@
65
65
  "react-dom": "$react-dom"
66
66
  },
67
67
  "devDependencies": {
68
- "@babel/core": "^7.29.0",
69
- "@babel/plugin-transform-runtime": "^7.29.0",
70
- "@babel/preset-env": "^7.29.5",
71
- "@babel/preset-react": "^7.28.5",
72
- "@babel/preset-typescript": "^7.28.5",
73
- "@babel/runtime-corejs3": "^7.29.2",
68
+ "@babel/core": "^7.29.7",
69
+ "@babel/plugin-transform-runtime": "^7.29.7",
70
+ "@babel/preset-env": "^7.29.7",
71
+ "@babel/preset-react": "^7.29.7",
72
+ "@babel/preset-typescript": "^7.29.7",
73
+ "@babel/runtime-corejs3": "^7.29.7",
74
74
  "@testing-library/jest-dom": "^6.9.1",
75
75
  "@testing-library/react": "^16.3.2",
76
76
  "@types/pica": "^9.0.5",
@@ -1,5 +1,8 @@
1
1
  import { DataTypes } from "@etsoo/shared";
2
- import { AutocompleteProps } from "@mui/material/Autocomplete";
2
+ import {
3
+ AutocompleteChangeReason,
4
+ AutocompleteProps
5
+ } from "@mui/material/Autocomplete";
3
6
  import { ChangeEventHandler } from "react";
4
7
 
5
8
  /**
@@ -97,6 +100,11 @@ export type AutocompleteExtendedProps<
97
100
  * Value change handler
98
101
  * @param value New value
99
102
  * @param input Input element
103
+ * @param reason Reason for the change, 'undefined' for initial value change
100
104
  */
101
- onValueChange?: (value: T | null, input?: HTMLInputElement | null) => void;
105
+ onValueChange?: (
106
+ value: T | null,
107
+ input?: HTMLInputElement | null,
108
+ reason?: AutocompleteChangeReason
109
+ ) => void;
102
110
  };
package/src/ComboBox.tsx CHANGED
@@ -268,7 +268,7 @@ export function ComboBox<
268
268
  // Custom
269
269
  if (onChange != null) onChange(event, value, reason, details);
270
270
 
271
- if (onValueChange) onValueChange(value, inputRef.current);
271
+ if (onValueChange) onValueChange(value, inputRef.current, reason);
272
272
  }}
273
273
  openOnFocus={openOnFocus}
274
274
  sx={sx}
package/src/SelectEx.tsx CHANGED
@@ -184,7 +184,7 @@ export function SelectEx<
184
184
  // Local value
185
185
  const v = defaultValue ?? value;
186
186
  const valueSource = React.useMemo(
187
- () => (multiple ? (v ? (Array.isArray(v) ? v : [v]) : []) : v ?? ""),
187
+ () => (multiple ? (v ? (Array.isArray(v) ? v : [v]) : []) : (v ?? "")),
188
188
  [multiple, v]
189
189
  );
190
190
 
@@ -326,8 +326,8 @@ export function SelectEx<
326
326
  multiple
327
327
  ? valueState
328
328
  : localOptions.some((o) => o[idField] === valueState)
329
- ? valueState
330
- : ""
329
+ ? valueState
330
+ : ""
331
331
  }
332
332
  input={
333
333
  <OutlinedInput
@@ -409,7 +409,10 @@ export function SelectEx<
409
409
  }
410
410
  />
411
411
  )}
412
- <ListItemText primary={label} />
412
+ <ListItemText
413
+ primary={label}
414
+ slotProps={{ primary: { noWrap: true } }}
415
+ />
413
416
  {itemIconRenderer && (
414
417
  <ListItemRightIcon>
415
418
  {itemIconRenderer(option[idField])}
package/src/Tiplist.tsx CHANGED
@@ -318,7 +318,7 @@ export function Tiplist<
318
318
  // Custom
319
319
  if (onChange != null) onChange(event, value, reason, details);
320
320
 
321
- if (onValueChange) onValueChange(value, inputRef.current);
321
+ if (onValueChange) onValueChange(value, inputRef.current, reason);
322
322
 
323
323
  // For clear case
324
324
  if (reason === "clear") {