@etsoo/materialui 1.2.86 → 1.2.88

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
@@ -125,7 +125,7 @@ export function ComboBox(props) {
125
125
  onChange(event, value, reason, details);
126
126
  if (onValueChange)
127
127
  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 })) : (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 }),
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 }),
129
129
  onAdd && (React.createElement(IconButton, { size: "small", onClick: () => {
130
130
  onAdd(doLoadData);
131
131
  }, title: addLabel },
@@ -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;
@@ -128,5 +128,5 @@ export function ComboBoxMultiple(props) {
128
128
  // Custom
129
129
  if (onChange != null)
130
130
  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 })) : (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 })));
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 })));
132
132
  }
package/lib/SearchBar.js CHANGED
@@ -14,11 +14,12 @@ const resetForm = (form) => {
14
14
  continue;
15
15
  // All non hidden inputs
16
16
  if (input instanceof HTMLInputElement) {
17
- // Ignore hidden input
18
- if (input.type === "hidden")
17
+ // Ignore hidden and data-reset=false input
18
+ var reset = input.dataset.reset;
19
+ if (input.type === "hidden" || reset === "false")
19
20
  continue;
20
21
  // Ignore readOnly without data-reset=true inputs
21
- if (!input.readOnly || input.dataset.reset === "true") {
22
+ if (!input.readOnly || reset === "true") {
22
23
  ReactUtils.triggerChange(input, "", true);
23
24
  }
24
25
  continue;
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
@@ -189,7 +189,7 @@ export function Tiplist(props) {
189
189
  open: false,
190
190
  ...(!states.value && { options: [] })
191
191
  });
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 })) : (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) => {
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) => {
193
193
  if (item[idField] === "n/a")
194
194
  return true;
195
195
  return getOptionDisabled ? getOptionDisabled(item) : false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.2.86",
3
+ "version": "1.2.88",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -54,16 +54,16 @@
54
54
  "@etsoo/notificationbase": "^1.1.26",
55
55
  "@etsoo/react": "^1.7.3",
56
56
  "@etsoo/shared": "^1.2.8",
57
- "@mui/icons-material": "^5.14.3",
58
- "@mui/material": "^5.14.5",
57
+ "@mui/icons-material": "^5.14.6",
58
+ "@mui/material": "^5.14.6",
59
59
  "@mui/x-data-grid": "^6.11.2",
60
60
  "@types/pica": "^9.0.1",
61
61
  "@types/pulltorefreshjs": "^0.1.5",
62
- "@types/react": "^18.2.20",
62
+ "@types/react": "^18.2.21",
63
63
  "@types/react-avatar-editor": "^13.0.0",
64
64
  "@types/react-dom": "^18.2.7",
65
65
  "@types/react-input-mask": "^3.0.2",
66
- "chart.js": "^4.3.3",
66
+ "chart.js": "^4.4.0",
67
67
  "chartjs-plugin-datalabels": "^2.2.0",
68
68
  "pica": "^9.0.1",
69
69
  "pulltorefreshjs": "^0.1.22",
@@ -76,19 +76,19 @@
76
76
  },
77
77
  "devDependencies": {
78
78
  "@babel/cli": "^7.22.10",
79
- "@babel/core": "^7.22.10",
79
+ "@babel/core": "^7.22.11",
80
80
  "@babel/plugin-transform-runtime": "^7.22.10",
81
81
  "@babel/preset-env": "^7.22.10",
82
82
  "@babel/preset-react": "^7.22.5",
83
- "@babel/preset-typescript": "^7.22.5",
84
- "@babel/runtime-corejs3": "^7.22.10",
85
- "@testing-library/jest-dom": "^6.0.1",
83
+ "@babel/preset-typescript": "^7.22.11",
84
+ "@babel/runtime-corejs3": "^7.22.11",
85
+ "@testing-library/jest-dom": "^6.1.2",
86
86
  "@testing-library/react": "^14.0.0",
87
- "@types/jest": "^29.5.3",
88
- "@typescript-eslint/eslint-plugin": "^6.4.0",
89
- "@typescript-eslint/parser": "^6.4.0",
90
- "jest": "^29.6.2",
91
- "jest-environment-jsdom": "^29.6.2",
92
- "typescript": "^5.1.6"
87
+ "@types/jest": "^29.5.4",
88
+ "@typescript-eslint/eslint-plugin": "^6.4.1",
89
+ "@typescript-eslint/parser": "^6.4.1",
90
+ "jest": "^29.6.4",
91
+ "jest-environment-jsdom": "^29.6.4",
92
+ "typescript": "^5.2.2"
93
93
  }
94
94
  }
@@ -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,
@@ -274,6 +275,7 @@ export function ComboBox<
274
275
  required={inputRequired}
275
276
  error={inputError}
276
277
  helperText={inputHelperText}
278
+ data-reset={inputReset}
277
279
  />
278
280
  ) : (
279
281
  <InputField
@@ -285,6 +287,7 @@ export function ComboBox<
285
287
  required={inputRequired}
286
288
  error={inputError}
287
289
  helperText={inputHelperText}
290
+ data-reset={inputReset}
288
291
  />
289
292
  )
290
293
  }
@@ -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,
@@ -286,6 +287,7 @@ export function ComboBoxMultiple<
286
287
  required={inputRequired}
287
288
  error={inputError}
288
289
  helperText={inputHelperText}
290
+ data-reset={inputReset}
289
291
  />
290
292
  ) : (
291
293
  <InputField
@@ -297,6 +299,7 @@ export function ComboBoxMultiple<
297
299
  required={inputRequired}
298
300
  error={inputError}
299
301
  helperText={inputHelperText}
302
+ data-reset={inputReset}
300
303
  />
301
304
  )
302
305
  }
package/src/SearchBar.tsx CHANGED
@@ -41,11 +41,12 @@ const resetForm = (form: HTMLFormElement) => {
41
41
 
42
42
  // All non hidden inputs
43
43
  if (input instanceof HTMLInputElement) {
44
- // Ignore hidden input
45
- if (input.type === "hidden") continue;
44
+ // Ignore hidden and data-reset=false input
45
+ var reset = input.dataset.reset;
46
+ if (input.type === "hidden" || reset === "false") continue;
46
47
 
47
48
  // Ignore readOnly without data-reset=true inputs
48
- if (!input.readOnly || input.dataset.reset === "true") {
49
+ if (!input.readOnly || reset === "true") {
49
50
  ReactUtils.triggerChange(input, "", true);
50
51
  }
51
52
  continue;
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,
@@ -337,6 +338,7 @@ export function Tiplist<
337
338
  autoComplete={inputAutoComplete}
338
339
  error={inputError}
339
340
  helperText={inputHelperText}
341
+ data-reset={inputReset}
340
342
  />
341
343
  ) : (
342
344
  <InputField
@@ -350,6 +352,7 @@ export function Tiplist<
350
352
  autoComplete={inputAutoComplete}
351
353
  error={inputError}
352
354
  helperText={inputHelperText}
355
+ data-reset={inputReset}
353
356
  />
354
357
  )
355
358
  }