@etsoo/materialui 1.2.87 → 1.2.89

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.
@@ -40,6 +40,10 @@ export type AutocompleteExtendedProps<T extends object, D extends DataTypes.Keys
40
40
  * @default false
41
41
  */
42
42
  inputRequired?: boolean;
43
+ /**
44
+ * Set 'data-reset'
45
+ */
46
+ inputReset?: boolean;
43
47
  /**
44
48
  * The variant to use.
45
49
  * @default 'outlined'
package/lib/ComboBox.js CHANGED
@@ -16,7 +16,7 @@ export function ComboBox(props) {
16
16
  // Labels
17
17
  const labels = globalApp === null || globalApp === void 0 ? void 0 : globalApp.getLabels("noOptions", "loading", "open", "add");
18
18
  // Destruct
19
- const { search = false, autoAddBlankItem = search, idField = "id", idValue, inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputVariant, defaultValue, label, labelField = "label", loadData, onLoadData, name, inputAutoComplete = "off", options, dataReadonly = true, readOnly, onChange, onValueChange, openOnFocus = true, value, disableCloseOnSelect = false, getOptionLabel = (option) => `${option[labelField]}`, sx = { minWidth: "150px", flexGrow: 2 }, noOptionsText = labels === null || labels === void 0 ? void 0 : labels.noOptions, loadingText = labels === null || labels === void 0 ? void 0 : labels.loading, openText = labels === null || labels === void 0 ? void 0 : labels.open, addLabel = labels === null || labels === void 0 ? void 0 : labels.add, onAdd, ...rest } = props;
19
+ const { search = false, autoAddBlankItem = search, idField = "id", idValue, inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputReset, inputVariant, defaultValue, label, labelField = "label", loadData, onLoadData, name, inputAutoComplete = "off", options, dataReadonly = true, readOnly, onChange, onValueChange, openOnFocus = true, value, disableCloseOnSelect = false, getOptionLabel = (option) => `${option[labelField]}`, sx = { minWidth: "150px", flexGrow: 2 }, noOptionsText = labels === null || labels === void 0 ? void 0 : labels.noOptions, loadingText = labels === null || labels === void 0 ? void 0 : labels.loading, openText = labels === null || labels === void 0 ? void 0 : labels.open, addLabel = labels === null || labels === void 0 ? void 0 : labels.add, onAdd, ...rest } = props;
20
20
  // Value input ref
21
21
  const inputRef = React.createRef();
22
22
  // Options state
@@ -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)) {
@@ -19,7 +19,7 @@ export function ComboBoxMultiple(props) {
19
19
  // Labels
20
20
  const labels = globalApp === null || globalApp === void 0 ? void 0 : globalApp.getLabels("noOptions", "loading");
21
21
  // Destruct
22
- const { search = false, autoAddBlankItem = search, idField = "id", idValue, idValues, inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputVariant, defaultValue, label, labelField = "label", loadData, onLoadData, name, inputAutoComplete = "off", options, dataReadonly = true, readOnly, onChange, openOnFocus = true, value, disableCloseOnSelect = true, renderOption = (props, option, { selected }) => (React.createElement("li", { ...props },
22
+ const { search = false, autoAddBlankItem = search, idField = "id", idValue, idValues, inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputReset, inputVariant, defaultValue, label, labelField = "label", loadData, onLoadData, name, inputAutoComplete = "off", options, dataReadonly = true, readOnly, onChange, openOnFocus = true, value, disableCloseOnSelect = true, renderOption = (props, option, { selected }) => (React.createElement("li", { ...props },
23
23
  React.createElement(React.Fragment, null,
24
24
  React.createElement(Checkbox, { icon: icon, checkedIcon: checkedIcon, style: { marginRight: 8 }, checked: selected }),
25
25
  option[labelField]))), getOptionLabel = (option) => `${option[labelField]}`, sx = { minWidth: "150px" }, noOptionsText = labels === null || labels === void 0 ? void 0 : labels.noOptions, loadingText = labels === null || labels === void 0 ? void 0 : labels.loading, ...rest } = props;
@@ -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)) {
package/lib/Tiplist.js CHANGED
@@ -15,7 +15,7 @@ export function Tiplist(props) {
15
15
  // Labels
16
16
  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 : {};
17
17
  // Destruct
18
- const { search = false, idField = "id", idValue, inputAutoComplete = "off", inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputVariant, label, loadData, defaultValue, value, maxItems = 16, width = search ? 160 : undefined, name, readOnly, onChange, onValueChange, openOnFocus = true, noOptionsText = noOptions, loadingText = loading, openText = openDefault, getOptionLabel, getOptionDisabled, sx = {}, ...rest } = props;
18
+ const { search = false, idField = "id", idValue, inputAutoComplete = "off", inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputReset, inputVariant, label, loadData, defaultValue, value, maxItems = 16, width = search ? 160 : undefined, name, readOnly, onChange, onValueChange, openOnFocus = true, noOptionsText = noOptions, loadingText = loading, openText = openDefault, getOptionLabel, getOptionDisabled, sx = {}, ...rest } = props;
19
19
  if (width && sx)
20
20
  Object.assign(sx, { width: `${width}px` });
21
21
  // Value input ref
@@ -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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.2.87",
3
+ "version": "1.2.89",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -56,6 +56,11 @@ export type AutocompleteExtendedProps<
56
56
  */
57
57
  inputRequired?: boolean;
58
58
 
59
+ /**
60
+ * Set 'data-reset'
61
+ */
62
+ inputReset?: boolean;
63
+
59
64
  /**
60
65
  * The variant to use.
61
66
  * @default 'outlined'
package/src/ComboBox.tsx CHANGED
@@ -93,6 +93,7 @@ export function ComboBox<
93
93
  inputMargin,
94
94
  inputOnChange,
95
95
  inputRequired,
96
+ inputReset,
96
97
  inputVariant,
97
98
  defaultValue,
98
99
  label,
@@ -162,12 +163,10 @@ export function ComboBox<
162
163
  const addReadOnly = (params: AutocompleteRenderInputParams) => {
163
164
  if (readOnly != null) {
164
165
  Object.assign(params, { readOnly });
165
-
166
- if (readOnly) {
167
- Object.assign(params.inputProps, { "data-reset": true });
168
- }
169
166
  }
170
167
 
168
+ Object.assign(params.inputProps, { "data-reset": inputReset });
169
+
171
170
  if (dataReadonly) {
172
171
  params.inputProps.onKeyDown = (event) => {
173
172
  if (Keyboard.isTypingContent(event.key)) {
@@ -93,6 +93,7 @@ export function ComboBoxMultiple<
93
93
  inputMargin,
94
94
  inputOnChange,
95
95
  inputRequired,
96
+ inputReset,
96
97
  inputVariant,
97
98
  defaultValue,
98
99
  label,
@@ -177,12 +178,10 @@ export function ComboBoxMultiple<
177
178
  const addReadOnly = (params: AutocompleteRenderInputParams) => {
178
179
  if (readOnly != null) {
179
180
  Object.assign(params, { readOnly });
180
-
181
- if (readOnly) {
182
- Object.assign(params.inputProps, { "data-reset": true });
183
- }
184
181
  }
185
182
 
183
+ Object.assign(params.inputProps, { "data-reset": inputReset });
184
+
186
185
  if (dataReadonly) {
187
186
  params.inputProps.onKeyDown = (event) => {
188
187
  if (Keyboard.isTypingContent(event.key)) {
package/src/Tiplist.tsx CHANGED
@@ -70,6 +70,7 @@ export function Tiplist<
70
70
  inputMargin,
71
71
  inputOnChange,
72
72
  inputRequired,
73
+ inputReset,
73
74
  inputVariant,
74
75
  label,
75
76
  loadData,
@@ -144,7 +145,10 @@ export function Tiplist<
144
145
 
145
146
  // https://stackoverflow.com/questions/15738259/disabling-chrome-autofill
146
147
  // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html
147
- Object.assign(params.inputProps, { autoComplete: inputAutoComplete });
148
+ Object.assign(params.inputProps, {
149
+ autoComplete: inputAutoComplete,
150
+ "data-reset": inputReset
151
+ });
148
152
 
149
153
  return params;
150
154
  };