@etsoo/materialui 1.2.88 → 1.2.90

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.
package/lib/ComboBox.js CHANGED
@@ -52,10 +52,8 @@ export function ComboBox(props) {
52
52
  const addReadOnly = (params) => {
53
53
  if (readOnly != null) {
54
54
  Object.assign(params, { readOnly });
55
- if (readOnly) {
56
- Object.assign(params.inputProps, { "data-reset": true });
57
- }
58
55
  }
56
+ Object.assign(params.inputProps, { "data-reset": inputReset });
59
57
  if (dataReadonly) {
60
58
  params.inputProps.onKeyDown = (event) => {
61
59
  if (Keyboard.isTypingContent(event.key)) {
@@ -115,7 +113,7 @@ export function ComboBox(props) {
115
113
  }, []);
116
114
  // Layout
117
115
  return (React.createElement("div", null,
118
- React.createElement("input", { ref: inputRef, "data-reset": "true", type: "text", style: { display: "none" }, name: name, value: getValue(stateValue), readOnly: true, onChange: inputOnChange }),
116
+ React.createElement("input", { ref: inputRef, "data-reset": inputReset !== null && inputReset !== void 0 ? inputReset : true, type: "text", style: { display: "none" }, name: name, value: getValue(stateValue), readOnly: true, onChange: inputOnChange }),
119
117
  React.createElement(Stack, { gap: 0.5, direction: "row", width: "100%" },
120
118
  React.createElement(Autocomplete, { value: stateValue, disableCloseOnSelect: disableCloseOnSelect, getOptionLabel: getOptionLabel, isOptionEqualToValue: (option, value) => option[idField] === value[idField], onChange: (event, value, reason, details) => {
121
119
  // Set value
@@ -125,7 +123,7 @@ export function ComboBox(props) {
125
123
  onChange(event, value, reason, details);
126
124
  if (onValueChange)
127
125
  onValueChange(value);
128
- }, openOnFocus: openOnFocus, sx: sx, renderInput: (params) => search ? (React.createElement(SearchField, { ...addReadOnly(params), label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, error: inputError, helperText: inputHelperText, "data-reset": inputReset })) : (React.createElement(InputField, { ...addReadOnly(params), label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, error: inputError, helperText: inputHelperText, "data-reset": inputReset })), options: localOptions, noOptionsText: noOptionsText, loadingText: loadingText, openText: openText, ...rest }),
126
+ }, openOnFocus: openOnFocus, sx: sx, renderInput: (params) => search ? (React.createElement(SearchField, { ...addReadOnly(params), label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, error: inputError, helperText: inputHelperText })) : (React.createElement(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, ...rest }),
129
127
  onAdd && (React.createElement(IconButton, { size: "small", onClick: () => {
130
128
  onAdd(doLoadData);
131
129
  }, title: addLabel },
@@ -61,10 +61,8 @@ export function ComboBoxMultiple(props) {
61
61
  const addReadOnly = (params) => {
62
62
  if (readOnly != null) {
63
63
  Object.assign(params, { readOnly });
64
- if (readOnly) {
65
- Object.assign(params.inputProps, { "data-reset": true });
66
- }
67
64
  }
65
+ Object.assign(params.inputProps, { "data-reset": inputReset });
68
66
  if (dataReadonly) {
69
67
  params.inputProps.onKeyDown = (event) => {
70
68
  if (Keyboard.isTypingContent(event.key)) {
@@ -117,7 +115,7 @@ export function ComboBoxMultiple(props) {
117
115
  }, []);
118
116
  // Layout
119
117
  return (React.createElement("div", null,
120
- React.createElement("input", { ref: inputRef, "data-reset": "true", type: "text", style: { display: "none" }, name: name, value: getValue(stateValue), readOnly: true, onChange: inputOnChange }),
118
+ React.createElement("input", { ref: inputRef, "data-reset": inputReset !== null && inputReset !== void 0 ? inputReset : true, type: "text", style: { display: "none" }, name: name, value: getValue(stateValue), readOnly: true, onChange: inputOnChange }),
121
119
  React.createElement(Autocomplete, { value: stateValue == null
122
120
  ? []
123
121
  : Array.isArray(stateValue)
@@ -128,5 +126,5 @@ export function ComboBoxMultiple(props) {
128
126
  // Custom
129
127
  if (onChange != null)
130
128
  onChange(event, value, reason, details);
131
- }, openOnFocus: openOnFocus, sx: sx, renderInput: (params) => search ? (React.createElement(SearchField, { ...addReadOnly(params), label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, error: inputError, helperText: inputHelperText, "data-reset": inputReset })) : (React.createElement(InputField, { ...addReadOnly(params), label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, error: inputError, helperText: inputHelperText, "data-reset": inputReset })), options: localOptions, renderOption: renderOption, noOptionsText: noOptionsText, loadingText: loadingText, ...rest })));
129
+ }, openOnFocus: openOnFocus, sx: sx, renderInput: (params) => search ? (React.createElement(SearchField, { ...addReadOnly(params), label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, error: inputError, helperText: inputHelperText })) : (React.createElement(InputField, { ...addReadOnly(params), label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, error: inputError, helperText: inputHelperText })), options: localOptions, renderOption: renderOption, noOptionsText: noOptionsText, loadingText: loadingText, ...rest })));
132
130
  }
package/lib/Tiplist.js CHANGED
@@ -54,7 +54,10 @@ export function Tiplist(props) {
54
54
  }
55
55
  // https://stackoverflow.com/questions/15738259/disabling-chrome-autofill
56
56
  // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html
57
- Object.assign(params.inputProps, { autoComplete: inputAutoComplete });
57
+ Object.assign(params.inputProps, {
58
+ autoComplete: inputAutoComplete,
59
+ "data-reset": inputReset
60
+ });
58
61
  return params;
59
62
  };
60
63
  // Change handler
@@ -163,7 +166,7 @@ export function Tiplist(props) {
163
166
  }, []);
164
167
  // Layout
165
168
  return (React.createElement("div", null,
166
- React.createElement("input", { ref: inputRef, "data-reset": "true", type: "text", style: { display: "none" }, name: name, value: `${inputValue !== null && inputValue !== void 0 ? inputValue : (state.current.idSet ? "" : localIdValue !== null && localIdValue !== void 0 ? localIdValue : "")}`, readOnly: true, onChange: inputOnChange }),
169
+ React.createElement("input", { ref: inputRef, "data-reset": inputReset !== null && inputReset !== void 0 ? inputReset : true, type: "text", style: { display: "none" }, name: name, value: `${inputValue !== null && inputValue !== void 0 ? inputValue : (state.current.idSet ? "" : localIdValue !== null && localIdValue !== void 0 ? localIdValue : "")}`, readOnly: true, onChange: inputOnChange }),
167
170
  React.createElement(Autocomplete, { filterOptions: (options, _state) => options, value: states.value, options: states.options, onChange: (event, value, reason, details) => {
168
171
  // Set value
169
172
  setInputValue(value);
@@ -189,7 +192,7 @@ export function Tiplist(props) {
189
192
  open: false,
190
193
  ...(!states.value && { options: [] })
191
194
  });
192
- }, loading: states.loading, renderInput: (params) => search ? (React.createElement(SearchField, { onChange: changeHandle, ...addReadOnly(params), readOnly: readOnly, label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, autoComplete: inputAutoComplete, error: inputError, helperText: inputHelperText, "data-reset": inputReset })) : (React.createElement(InputField, { onChange: changeHandle, ...addReadOnly(params), label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, autoComplete: inputAutoComplete, error: inputError, helperText: inputHelperText, "data-reset": inputReset })), isOptionEqualToValue: (option, value) => option[idField] === value[idField], sx: sx, noOptionsText: noOptionsText, loadingText: loadingText, openText: openText, getOptionDisabled: (item) => {
195
+ }, loading: states.loading, renderInput: (params) => search ? (React.createElement(SearchField, { onChange: changeHandle, ...addReadOnly(params), readOnly: readOnly, label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, autoComplete: inputAutoComplete, error: inputError, helperText: inputHelperText })) : (React.createElement(InputField, { onChange: changeHandle, ...addReadOnly(params), label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, autoComplete: inputAutoComplete, error: inputError, helperText: inputHelperText })), isOptionEqualToValue: (option, value) => option[idField] === value[idField], sx: sx, noOptionsText: noOptionsText, loadingText: loadingText, openText: openText, getOptionDisabled: (item) => {
193
196
  if (item[idField] === "n/a")
194
197
  return true;
195
198
  return getOptionDisabled ? getOptionDisabled(item) : false;
@@ -38,6 +38,10 @@ export type TiplistProProps<T extends ListType2 = ListType2> = Omit<Autocomplete
38
38
  * Input props
39
39
  */
40
40
  inputProps?: Omit<InputFieldProps, "onChange">;
41
+ /**
42
+ * Set 'data-reset'
43
+ */
44
+ inputReset?: boolean;
41
45
  /**
42
46
  * Value change handler
43
47
  * @param value New value
package/lib/TiplistPro.js CHANGED
@@ -13,7 +13,7 @@ export function TiplistPro(props) {
13
13
  // Labels
14
14
  const { noOptions, loading, more, open: openDefault } = (_a = globalApp === null || globalApp === void 0 ? void 0 : globalApp.getLabels("noOptions", "loading", "more", "open")) !== null && _a !== void 0 ? _a : {};
15
15
  // Destruct
16
- const { label, loadData, defaultValue, value, idValue, maxItems = 16, width, name, inputOnChange, inputProps, sx, openOnFocus = true, noOptionsText = noOptions, loadingText = loading, openText = openDefault, getOptionDisabled, getOptionLabel, onChange, onValueChange, ...rest } = props;
16
+ const { label, loadData, defaultValue, value, idValue, maxItems = 16, width, name, inputOnChange, inputProps, inputReset, sx, openOnFocus = true, noOptionsText = noOptions, loadingText = loading, openText = openDefault, getOptionDisabled, getOptionLabel, onChange, onValueChange, ...rest } = props;
17
17
  if (width && sx)
18
18
  Object.assign(sx, { width: `${width}px` });
19
19
  // Value input ref
@@ -150,7 +150,7 @@ export function TiplistPro(props) {
150
150
  }, []);
151
151
  // Layout
152
152
  return (React.createElement("div", null,
153
- React.createElement("input", { ref: inputRef, "data-reset": "true", type: "text", style: { display: "none" }, name: name, value: inputValue !== null && inputValue !== void 0 ? inputValue : (state.current.idSet ? "" : localIdValue !== null && localIdValue !== void 0 ? localIdValue : ""), readOnly: true, onChange: inputOnChange }),
153
+ React.createElement("input", { ref: inputRef, "data-reset": inputReset !== null && inputReset !== void 0 ? inputReset : true, type: "text", style: { display: "none" }, name: name, value: inputValue !== null && inputValue !== void 0 ? inputValue : (state.current.idSet ? "" : localIdValue !== null && localIdValue !== void 0 ? localIdValue : ""), readOnly: true, onChange: inputOnChange }),
154
154
  React.createElement(Autocomplete, { filterOptions: (options, _state) => options, value: states.value, options: states.options, freeSolo: true, clearOnBlur: false, onChange: (event, value, reason, details) => {
155
155
  if (typeof value === "object") {
156
156
  // Set value
@@ -185,7 +185,7 @@ export function TiplistPro(props) {
185
185
  }, loading: states.loading, renderInput: (params) => (React.createElement(InputField, { ...inputProps, ...params, onChange: changeHandle, label: label, name: name + "Input", onBlur: (event) => {
186
186
  if (states.value == null && onChange)
187
187
  onChange(event, event.target.value, "blur", undefined);
188
- } })), isOptionEqualToValue: (option, value) => option.id === value.id, sx: sx, noOptionsText: noOptionsText, loadingText: loadingText, openText: openText, getOptionDisabled: (item) => {
188
+ }, "data-reset": inputReset })), isOptionEqualToValue: (option, value) => option.id === value.id, sx: sx, noOptionsText: noOptionsText, loadingText: loadingText, openText: openText, getOptionDisabled: (item) => {
189
189
  if (item.id === -1)
190
190
  return true;
191
191
  return getOptionDisabled ? getOptionDisabled(item) : false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.2.88",
3
+ "version": "1.2.90",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
package/src/ComboBox.tsx CHANGED
@@ -163,12 +163,10 @@ export function ComboBox<
163
163
  const addReadOnly = (params: AutocompleteRenderInputParams) => {
164
164
  if (readOnly != null) {
165
165
  Object.assign(params, { readOnly });
166
-
167
- if (readOnly) {
168
- Object.assign(params.inputProps, { "data-reset": true });
169
- }
170
166
  }
171
167
 
168
+ Object.assign(params.inputProps, { "data-reset": inputReset });
169
+
172
170
  if (dataReadonly) {
173
171
  params.inputProps.onKeyDown = (event) => {
174
172
  if (Keyboard.isTypingContent(event.key)) {
@@ -236,7 +234,7 @@ export function ComboBox<
236
234
  <div>
237
235
  <input
238
236
  ref={inputRef}
239
- data-reset="true"
237
+ data-reset={inputReset ?? true}
240
238
  type="text"
241
239
  style={{ display: "none" }}
242
240
  name={name}
@@ -275,7 +273,6 @@ export function ComboBox<
275
273
  required={inputRequired}
276
274
  error={inputError}
277
275
  helperText={inputHelperText}
278
- data-reset={inputReset}
279
276
  />
280
277
  ) : (
281
278
  <InputField
@@ -287,7 +284,6 @@ export function ComboBox<
287
284
  required={inputRequired}
288
285
  error={inputError}
289
286
  helperText={inputHelperText}
290
- data-reset={inputReset}
291
287
  />
292
288
  )
293
289
  }
@@ -178,12 +178,10 @@ export function ComboBoxMultiple<
178
178
  const addReadOnly = (params: AutocompleteRenderInputParams) => {
179
179
  if (readOnly != null) {
180
180
  Object.assign(params, { readOnly });
181
-
182
- if (readOnly) {
183
- Object.assign(params.inputProps, { "data-reset": true });
184
- }
185
181
  }
186
182
 
183
+ Object.assign(params.inputProps, { "data-reset": inputReset });
184
+
187
185
  if (dataReadonly) {
188
186
  params.inputProps.onKeyDown = (event) => {
189
187
  if (Keyboard.isTypingContent(event.key)) {
@@ -244,7 +242,7 @@ export function ComboBoxMultiple<
244
242
  <div>
245
243
  <input
246
244
  ref={inputRef}
247
- data-reset="true"
245
+ data-reset={inputReset ?? true}
248
246
  type="text"
249
247
  style={{ display: "none" }}
250
248
  name={name}
@@ -287,7 +285,6 @@ export function ComboBoxMultiple<
287
285
  required={inputRequired}
288
286
  error={inputError}
289
287
  helperText={inputHelperText}
290
- data-reset={inputReset}
291
288
  />
292
289
  ) : (
293
290
  <InputField
@@ -299,7 +296,6 @@ export function ComboBoxMultiple<
299
296
  required={inputRequired}
300
297
  error={inputError}
301
298
  helperText={inputHelperText}
302
- data-reset={inputReset}
303
299
  />
304
300
  )
305
301
  }
package/src/Tiplist.tsx CHANGED
@@ -145,7 +145,10 @@ export function Tiplist<
145
145
 
146
146
  // https://stackoverflow.com/questions/15738259/disabling-chrome-autofill
147
147
  // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html
148
- Object.assign(params.inputProps, { autoComplete: inputAutoComplete });
148
+ Object.assign(params.inputProps, {
149
+ autoComplete: inputAutoComplete,
150
+ "data-reset": inputReset
151
+ });
149
152
 
150
153
  return params;
151
154
  };
@@ -272,7 +275,7 @@ export function Tiplist<
272
275
  <div>
273
276
  <input
274
277
  ref={inputRef}
275
- data-reset="true"
278
+ data-reset={inputReset ?? true}
276
279
  type="text"
277
280
  style={{ display: "none" }}
278
281
  name={name}
@@ -338,7 +341,6 @@ export function Tiplist<
338
341
  autoComplete={inputAutoComplete}
339
342
  error={inputError}
340
343
  helperText={inputHelperText}
341
- data-reset={inputReset}
342
344
  />
343
345
  ) : (
344
346
  <InputField
@@ -352,7 +354,6 @@ export function Tiplist<
352
354
  autoComplete={inputAutoComplete}
353
355
  error={inputError}
354
356
  helperText={inputHelperText}
355
- data-reset={inputReset}
356
357
  />
357
358
  )
358
359
  }
@@ -56,6 +56,11 @@ export type TiplistProProps<T extends ListType2 = ListType2> = Omit<
56
56
  */
57
57
  inputProps?: Omit<InputFieldProps, "onChange">;
58
58
 
59
+ /**
60
+ * Set 'data-reset'
61
+ */
62
+ inputReset?: boolean;
63
+
59
64
  /**
60
65
  * Value change handler
61
66
  * @param value New value
@@ -99,6 +104,7 @@ export function TiplistPro<T extends ListType2 = ListType2>(
99
104
  name,
100
105
  inputOnChange,
101
106
  inputProps,
107
+ inputReset,
102
108
  sx,
103
109
  openOnFocus = true,
104
110
  noOptionsText = noOptions,
@@ -278,7 +284,7 @@ export function TiplistPro<T extends ListType2 = ListType2>(
278
284
  <div>
279
285
  <input
280
286
  ref={inputRef}
281
- data-reset="true"
287
+ data-reset={inputReset ?? true}
282
288
  type="text"
283
289
  style={{ display: "none" }}
284
290
  name={name}
@@ -348,6 +354,7 @@ export function TiplistPro<T extends ListType2 = ListType2>(
348
354
  if (states.value == null && onChange)
349
355
  onChange(event, event.target.value, "blur", undefined);
350
356
  }}
357
+ data-reset={inputReset}
351
358
  />
352
359
  )}
353
360
  isOptionEqualToValue={(option, value) => option.id === value.id}