@etsoo/materialui 1.5.88 → 1.5.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.
@@ -29,7 +29,7 @@ function ComboBoxMultiple(props) {
29
29
  // Labels
30
30
  const labels = app?.getLabels("noOptions", "loading");
31
31
  // Destruct
32
- 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 }) => ((0, jsx_runtime_1.jsxs)("li", { ...props, children: [(0, jsx_runtime_1.jsx)(Checkbox_1.default, { icon: icon, checkedIcon: checkedIcon, style: { marginRight: 8 }, checked: selected }), `${option[labelField]}`] })), getOptionLabel = (option) => `${option[labelField]}`, sx = { minWidth: "150px" }, noOptionsText = labels?.noOptions, loadingText = labels?.loading, ...rest } = props;
32
+ 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 }) => ((0, jsx_runtime_1.jsxs)("li", { ...props, children: [(0, jsx_runtime_1.jsx)(Checkbox_1.default, { icon: icon, checkedIcon: checkedIcon, style: { marginRight: 8 }, checked: selected }), `${option[labelField]}`] })), getOptionLabel = (option) => `${option[labelField]}`, getOptionKey = (option) => `${option[idField]}`, sx = { minWidth: "150px" }, noOptionsText = labels?.noOptions, loadingText = labels?.loading, ...rest } = props;
33
33
  // Value input ref
34
34
  const inputRef = react_1.default.createRef();
35
35
  // Options state
@@ -125,7 +125,7 @@ function ComboBoxMultiple(props) {
125
125
  ? []
126
126
  : Array.isArray(stateValue)
127
127
  ? stateValue
128
- : [stateValue], disableCloseOnSelect: disableCloseOnSelect, getOptionLabel: getOptionLabel, multiple: true, isOptionEqualToValue: (option, value) => option[idField] === value[idField], onChange: (event, value, reason, details) => {
128
+ : [stateValue], disableCloseOnSelect: disableCloseOnSelect, getOptionLabel: getOptionLabel, getOptionKey: getOptionKey, multiple: true, isOptionEqualToValue: (option, value) => option[idField] === value[idField], onChange: (event, value, reason, details) => {
129
129
  // Set value
130
130
  setInputValue(value.concat());
131
131
  // Custom
@@ -16,7 +16,7 @@ function ComboBoxPro(props) {
16
16
  // Labels
17
17
  const { noOptions, loading: loadingLabel, open: openDefault } = app?.getLabels("noOptions", "loading", "open") ?? {};
18
18
  // Destruct
19
- const { noOptionsText = noOptions, loadingText = loadingLabel, openText = openDefault, options, openOnFocus = true, label, inputProps, name, value, idValue, onChange, onValueChange, ...rest } = props;
19
+ const { getOptionKey = (option) => typeof option === "string" ? option : option.id, getOptionLabel = (option) => typeof option === "object" ? shared_1.DataTypes.getListItemLabel(option) : option, noOptionsText = noOptions, loadingText = loadingLabel, openText = openDefault, options, openOnFocus = true, label, inputProps, name, value, idValue, onChange, onValueChange, ...rest } = props;
20
20
  const [open, setOpen] = react_1.default.useState(false);
21
21
  const [localOptions, setOptions] = react_1.default.useState([]);
22
22
  const [localValue, setValue] = react_1.default.useState(null);
@@ -61,7 +61,7 @@ function ComboBoxPro(props) {
61
61
  if (!localValue && localValue != value)
62
62
  onChange(event, value, "blur", undefined);
63
63
  }
64
- } })), getOptionLabel: (item) => typeof item === "object" ? shared_1.DataTypes.getListItemLabel(item) : item, isOptionEqualToValue: (option, value) => option.id === value.id, noOptionsText: noOptionsText, loadingText: loadingText, openText: openText, onChange: (event, value, reason, details) => {
64
+ } })), getOptionLabel: getOptionLabel, getOptionKey: getOptionKey, isOptionEqualToValue: (option, value) => option.id === value.id, noOptionsText: noOptionsText, loadingText: loadingText, openText: openText, onChange: (event, value, reason, details) => {
65
65
  setValue(value);
66
66
  if (onChange)
67
67
  onChange(event, value, reason, details);
@@ -22,7 +22,7 @@ function TagListPro(props) {
22
22
  const moreLabel = more + "...";
23
23
  const getLabel = (item) => shared_1.DataTypes.getListItemLabel(item);
24
24
  // Destruct
25
- const { renderOption = ({ key, ...props }, option, { selected }) => ((0, jsx_runtime_1.jsx)("li", { ...props, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Checkbox_1.default, { icon: (0, jsx_runtime_1.jsx)(CheckBoxOutlineBlank_1.default, { fontSize: "small" }), checkedIcon: (0, jsx_runtime_1.jsx)(CheckBox_1.default, { fontSize: "small" }), style: { marginRight: 8 }, checked: selected }), getLabel(option)] }) }, key)), renderTags = (value, getTagProps) => value.map((option, index) => {
25
+ const { getOptionKey = (option) => typeof option === "string" ? option : option.id, renderOption = ({ key, ...props }, option, { selected }) => ((0, jsx_runtime_1.jsx)("li", { ...props, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Checkbox_1.default, { icon: (0, jsx_runtime_1.jsx)(CheckBoxOutlineBlank_1.default, { fontSize: "small" }), checkedIcon: (0, jsx_runtime_1.jsx)(CheckBox_1.default, { fontSize: "small" }), style: { marginRight: 8 }, checked: selected }), getLabel(option)] }) }, key)), renderValue = (value, getTagProps) => value.map((option, index) => {
26
26
  const { key, ...rest } = getTagProps({ index });
27
27
  return ((0, jsx_runtime_1.jsx)(Chip_1.default, { variant: "outlined", label: getLabel(option), ...rest }, key));
28
28
  }), noOptionsText = noOptions, loadingText = loadingLabel, openText = openDefault, loadData, maxItems = 16, disableCloseOnSelect = true, openOnFocus = true, label, inputProps, onChange, value, ...rest } = props;
@@ -56,7 +56,7 @@ function TagListPro(props) {
56
56
  }
57
57
  }, onClose: () => {
58
58
  setOpen(false);
59
- }, options: options, loading: loading, disableCloseOnSelect: disableCloseOnSelect, openOnFocus: openOnFocus, renderOption: renderOption, renderTags: renderTags, renderInput: (params) => ((0, jsx_runtime_1.jsx)(InputField_1.InputField, { label: label, changeDelay: 480, onChange: async (event) => {
59
+ }, options: options, loading: loading, disableCloseOnSelect: disableCloseOnSelect, openOnFocus: openOnFocus, renderOption: renderOption, renderValue: renderValue, renderInput: (params) => ((0, jsx_runtime_1.jsx)(InputField_1.InputField, { label: label, changeDelay: 480, onChange: async (event) => {
60
60
  // Stop bubble
61
61
  event.preventDefault();
62
62
  event.stopPropagation();
@@ -65,7 +65,7 @@ function TagListPro(props) {
65
65
  return (typeof item.id === "number" &&
66
66
  item.id < 0 &&
67
67
  getLabel(item) === moreLabel);
68
- }, getOptionLabel: (item) => getLabel(item), isOptionEqualToValue: (option, value) => option.id === value.id, noOptionsText: noOptionsText, loadingText: loadingText, openText: openText, value: value, onChange: (event, value, reason, details) => {
68
+ }, getOptionLabel: (item) => getLabel(item), getOptionKey: getOptionKey, isOptionEqualToValue: (option, value) => option.id === value.id, noOptionsText: noOptionsText, loadingText: loadingText, openText: openText, value: value, onChange: (event, value, reason, details) => {
69
69
  currentValue.current = value;
70
70
  if (onChange)
71
71
  onChange(event, value, reason, details);
@@ -23,7 +23,7 @@ function Tiplist(props) {
23
23
  // Labels
24
24
  const { noOptions, loading, more1 = "More", open: openDefault } = app?.getLabels("noOptions", "loading", "more1", "open") ?? {};
25
25
  // Destruct
26
- const { search = false, idField = "id", idValue, idIsString = false, 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 = {}, minChars, ...rest } = props;
26
+ const { search = false, idField = "id", idValue, idIsString = false, 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, getOptionKey = (option) => `${option[idField]}`, getOptionLabel, getOptionDisabled, sx = {}, minChars, ...rest } = props;
27
27
  if (width && sx)
28
28
  Object.assign(sx, { width: `${width}px` });
29
29
  // Value input ref
@@ -209,5 +209,5 @@ function Tiplist(props) {
209
209
  return getOptionLabel
210
210
  ? getOptionLabel(item)
211
211
  : shared_1.DataTypes.getObjectItemLabel(item);
212
- }, ...rest })] }));
212
+ }, getOptionKey: getOptionKey, ...rest })] }));
213
213
  }
@@ -22,7 +22,7 @@ function TiplistPro(props) {
22
22
  // Labels
23
23
  const { noOptions, loading, more, open: openDefault } = app?.getLabels("noOptions", "loading", "more", "open") ?? {};
24
24
  // Destruct
25
- const { label, loadData, defaultValue, value, idValue, idIsString = false, maxItems = 16, width, name, inputOnChange, inputProps, inputReset, sx, openOnFocus = true, noOptionsText = noOptions, loadingText = loading, openText = openDefault, getOptionDisabled, getOptionLabel, onChange, onValueChange, minChars, ...rest } = props;
25
+ const { label, loadData, defaultValue, value, idValue, idIsString = false, maxItems = 16, width, name, inputOnChange, inputProps, inputReset, sx, openOnFocus = true, noOptionsText = noOptions, loadingText = loading, openText = openDefault, getOptionDisabled, getOptionLabel, getOptionKey = (option) => typeof option === "string" ? option : option.id, onChange, onValueChange, minChars, ...rest } = props;
26
26
  if (width && sx)
27
27
  Object.assign(sx, { width: `${width}px` });
28
28
  // Value input ref
@@ -192,7 +192,7 @@ function TiplistPro(props) {
192
192
  }, loading: states.loading, renderInput: (params) => ((0, jsx_runtime_1.jsx)(InputField_1.InputField, { minChars: minChars, ...inputProps, ...params, onChange: changeHandle, label: label, name: name + "Input", onBlur: (event) => {
193
193
  if (states.value == null && onChange)
194
194
  onChange(event, event.target.value, "blur", undefined);
195
- }, "data-reset": inputReset })), isOptionEqualToValue: (option, value) => option.id === value.id, sx: sx, noOptionsText: noOptionsText, loadingText: loadingText, openText: openText, getOptionDisabled: (item) => {
195
+ }, "data-reset": inputReset })), isOptionEqualToValue: (option, value) => option.id === value.id, sx: sx, noOptionsText: noOptionsText, loadingText: loadingText, openText: openText, getOptionKey: getOptionKey, getOptionDisabled: (item) => {
196
196
  if (item.id === -1)
197
197
  return true;
198
198
  return getOptionDisabled ? getOptionDisabled(item) : false;
@@ -23,7 +23,7 @@ export function ComboBoxMultiple(props) {
23
23
  // Labels
24
24
  const labels = app?.getLabels("noOptions", "loading");
25
25
  // Destruct
26
- 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 }) => (_jsxs("li", { ...props, children: [_jsx(Checkbox, { icon: icon, checkedIcon: checkedIcon, style: { marginRight: 8 }, checked: selected }), `${option[labelField]}`] })), getOptionLabel = (option) => `${option[labelField]}`, sx = { minWidth: "150px" }, noOptionsText = labels?.noOptions, loadingText = labels?.loading, ...rest } = props;
26
+ 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 }) => (_jsxs("li", { ...props, children: [_jsx(Checkbox, { icon: icon, checkedIcon: checkedIcon, style: { marginRight: 8 }, checked: selected }), `${option[labelField]}`] })), getOptionLabel = (option) => `${option[labelField]}`, getOptionKey = (option) => `${option[idField]}`, sx = { minWidth: "150px" }, noOptionsText = labels?.noOptions, loadingText = labels?.loading, ...rest } = props;
27
27
  // Value input ref
28
28
  const inputRef = React.createRef();
29
29
  // Options state
@@ -119,7 +119,7 @@ export function ComboBoxMultiple(props) {
119
119
  ? []
120
120
  : Array.isArray(stateValue)
121
121
  ? stateValue
122
- : [stateValue], disableCloseOnSelect: disableCloseOnSelect, getOptionLabel: getOptionLabel, multiple: true, isOptionEqualToValue: (option, value) => option[idField] === value[idField], onChange: (event, value, reason, details) => {
122
+ : [stateValue], disableCloseOnSelect: disableCloseOnSelect, getOptionLabel: getOptionLabel, getOptionKey: getOptionKey, multiple: true, isOptionEqualToValue: (option, value) => option[idField] === value[idField], onChange: (event, value, reason, details) => {
123
123
  // Set value
124
124
  setInputValue(value.concat());
125
125
  // Custom
@@ -10,7 +10,7 @@ export function ComboBoxPro(props) {
10
10
  // Labels
11
11
  const { noOptions, loading: loadingLabel, open: openDefault } = app?.getLabels("noOptions", "loading", "open") ?? {};
12
12
  // Destruct
13
- const { noOptionsText = noOptions, loadingText = loadingLabel, openText = openDefault, options, openOnFocus = true, label, inputProps, name, value, idValue, onChange, onValueChange, ...rest } = props;
13
+ const { getOptionKey = (option) => typeof option === "string" ? option : option.id, getOptionLabel = (option) => typeof option === "object" ? DataTypes.getListItemLabel(option) : option, noOptionsText = noOptions, loadingText = loadingLabel, openText = openDefault, options, openOnFocus = true, label, inputProps, name, value, idValue, onChange, onValueChange, ...rest } = props;
14
14
  const [open, setOpen] = React.useState(false);
15
15
  const [localOptions, setOptions] = React.useState([]);
16
16
  const [localValue, setValue] = React.useState(null);
@@ -55,7 +55,7 @@ export function ComboBoxPro(props) {
55
55
  if (!localValue && localValue != value)
56
56
  onChange(event, value, "blur", undefined);
57
57
  }
58
- } })), getOptionLabel: (item) => typeof item === "object" ? DataTypes.getListItemLabel(item) : item, isOptionEqualToValue: (option, value) => option.id === value.id, noOptionsText: noOptionsText, loadingText: loadingText, openText: openText, onChange: (event, value, reason, details) => {
58
+ } })), getOptionLabel: getOptionLabel, getOptionKey: getOptionKey, isOptionEqualToValue: (option, value) => option.id === value.id, noOptionsText: noOptionsText, loadingText: loadingText, openText: openText, onChange: (event, value, reason, details) => {
59
59
  setValue(value);
60
60
  if (onChange)
61
61
  onChange(event, value, reason, details);
@@ -16,7 +16,7 @@ export function TagListPro(props) {
16
16
  const moreLabel = more + "...";
17
17
  const getLabel = (item) => DataTypes.getListItemLabel(item);
18
18
  // Destruct
19
- const { renderOption = ({ key, ...props }, option, { selected }) => (_jsx("li", { ...props, children: _jsxs(_Fragment, { children: [_jsx(Checkbox, { icon: _jsx(CheckBoxOutlineBlankIcon, { fontSize: "small" }), checkedIcon: _jsx(CheckBoxIcon, { fontSize: "small" }), style: { marginRight: 8 }, checked: selected }), getLabel(option)] }) }, key)), renderTags = (value, getTagProps) => value.map((option, index) => {
19
+ const { getOptionKey = (option) => typeof option === "string" ? option : option.id, renderOption = ({ key, ...props }, option, { selected }) => (_jsx("li", { ...props, children: _jsxs(_Fragment, { children: [_jsx(Checkbox, { icon: _jsx(CheckBoxOutlineBlankIcon, { fontSize: "small" }), checkedIcon: _jsx(CheckBoxIcon, { fontSize: "small" }), style: { marginRight: 8 }, checked: selected }), getLabel(option)] }) }, key)), renderValue = (value, getTagProps) => value.map((option, index) => {
20
20
  const { key, ...rest } = getTagProps({ index });
21
21
  return (_jsx(Chip, { variant: "outlined", label: getLabel(option), ...rest }, key));
22
22
  }), noOptionsText = noOptions, loadingText = loadingLabel, openText = openDefault, loadData, maxItems = 16, disableCloseOnSelect = true, openOnFocus = true, label, inputProps, onChange, value, ...rest } = props;
@@ -50,7 +50,7 @@ export function TagListPro(props) {
50
50
  }
51
51
  }, onClose: () => {
52
52
  setOpen(false);
53
- }, options: options, loading: loading, disableCloseOnSelect: disableCloseOnSelect, openOnFocus: openOnFocus, renderOption: renderOption, renderTags: renderTags, renderInput: (params) => (_jsx(InputField, { label: label, changeDelay: 480, onChange: async (event) => {
53
+ }, options: options, loading: loading, disableCloseOnSelect: disableCloseOnSelect, openOnFocus: openOnFocus, renderOption: renderOption, renderValue: renderValue, renderInput: (params) => (_jsx(InputField, { label: label, changeDelay: 480, onChange: async (event) => {
54
54
  // Stop bubble
55
55
  event.preventDefault();
56
56
  event.stopPropagation();
@@ -59,7 +59,7 @@ export function TagListPro(props) {
59
59
  return (typeof item.id === "number" &&
60
60
  item.id < 0 &&
61
61
  getLabel(item) === moreLabel);
62
- }, getOptionLabel: (item) => getLabel(item), isOptionEqualToValue: (option, value) => option.id === value.id, noOptionsText: noOptionsText, loadingText: loadingText, openText: openText, value: value, onChange: (event, value, reason, details) => {
62
+ }, getOptionLabel: (item) => getLabel(item), getOptionKey: getOptionKey, isOptionEqualToValue: (option, value) => option.id === value.id, noOptionsText: noOptionsText, loadingText: loadingText, openText: openText, value: value, onChange: (event, value, reason, details) => {
63
63
  currentValue.current = value;
64
64
  if (onChange)
65
65
  onChange(event, value, reason, details);
@@ -17,7 +17,7 @@ export function Tiplist(props) {
17
17
  // Labels
18
18
  const { noOptions, loading, more1 = "More", open: openDefault } = app?.getLabels("noOptions", "loading", "more1", "open") ?? {};
19
19
  // Destruct
20
- const { search = false, idField = "id", idValue, idIsString = false, 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 = {}, minChars, ...rest } = props;
20
+ const { search = false, idField = "id", idValue, idIsString = false, 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, getOptionKey = (option) => `${option[idField]}`, getOptionLabel, getOptionDisabled, sx = {}, minChars, ...rest } = props;
21
21
  if (width && sx)
22
22
  Object.assign(sx, { width: `${width}px` });
23
23
  // Value input ref
@@ -203,5 +203,5 @@ export function Tiplist(props) {
203
203
  return getOptionLabel
204
204
  ? getOptionLabel(item)
205
205
  : DataTypes.getObjectItemLabel(item);
206
- }, ...rest })] }));
206
+ }, getOptionKey: getOptionKey, ...rest })] }));
207
207
  }
@@ -16,7 +16,7 @@ export function TiplistPro(props) {
16
16
  // Labels
17
17
  const { noOptions, loading, more, open: openDefault } = app?.getLabels("noOptions", "loading", "more", "open") ?? {};
18
18
  // Destruct
19
- const { label, loadData, defaultValue, value, idValue, idIsString = false, maxItems = 16, width, name, inputOnChange, inputProps, inputReset, sx, openOnFocus = true, noOptionsText = noOptions, loadingText = loading, openText = openDefault, getOptionDisabled, getOptionLabel, onChange, onValueChange, minChars, ...rest } = props;
19
+ const { label, loadData, defaultValue, value, idValue, idIsString = false, maxItems = 16, width, name, inputOnChange, inputProps, inputReset, sx, openOnFocus = true, noOptionsText = noOptions, loadingText = loading, openText = openDefault, getOptionDisabled, getOptionLabel, getOptionKey = (option) => typeof option === "string" ? option : option.id, onChange, onValueChange, minChars, ...rest } = props;
20
20
  if (width && sx)
21
21
  Object.assign(sx, { width: `${width}px` });
22
22
  // Value input ref
@@ -186,7 +186,7 @@ export function TiplistPro(props) {
186
186
  }, loading: states.loading, renderInput: (params) => (_jsx(InputField, { minChars: minChars, ...inputProps, ...params, onChange: changeHandle, label: label, name: name + "Input", onBlur: (event) => {
187
187
  if (states.value == null && onChange)
188
188
  onChange(event, event.target.value, "blur", undefined);
189
- }, "data-reset": inputReset })), isOptionEqualToValue: (option, value) => option.id === value.id, sx: sx, noOptionsText: noOptionsText, loadingText: loadingText, openText: openText, getOptionDisabled: (item) => {
189
+ }, "data-reset": inputReset })), isOptionEqualToValue: (option, value) => option.id === value.id, sx: sx, noOptionsText: noOptionsText, loadingText: loadingText, openText: openText, getOptionKey: getOptionKey, getOptionDisabled: (item) => {
190
190
  if (item.id === -1)
191
191
  return true;
192
192
  return getOptionDisabled ? getOptionDisabled(item) : false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.5.88",
3
+ "version": "1.5.89",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -43,10 +43,10 @@
43
43
  "@etsoo/appscript": "^1.6.48",
44
44
  "@etsoo/notificationbase": "^1.1.66",
45
45
  "@etsoo/react": "^1.8.63",
46
- "@etsoo/shared": "^1.2.79",
46
+ "@etsoo/shared": "^1.2.80",
47
47
  "@mui/icons-material": "^7.3.5",
48
48
  "@mui/material": "^7.3.5",
49
- "@mui/x-data-grid": "^8.18.0",
49
+ "@mui/x-data-grid": "^8.19.0",
50
50
  "chart.js": "^4.5.1",
51
51
  "chartjs-plugin-datalabels": "^2.2.0",
52
52
  "dompurify": "^3.3.0",
@@ -76,13 +76,13 @@
76
76
  "@testing-library/react": "^16.3.0",
77
77
  "@types/pica": "^9.0.5",
78
78
  "@types/pulltorefreshjs": "^0.1.7",
79
- "@types/react": "^19.2.5",
79
+ "@types/react": "^19.2.7",
80
80
  "@types/react-avatar-editor": "^13.0.4",
81
81
  "@types/react-dom": "^19.2.3",
82
82
  "@types/react-input-mask": "^3.0.6",
83
83
  "@vitejs/plugin-react": "^5.1.1",
84
84
  "jsdom": "^27.2.0",
85
85
  "typescript": "^5.9.3",
86
- "vitest": "^4.0.9"
86
+ "vitest": "^4.0.14"
87
87
  }
88
88
  }
@@ -122,6 +122,7 @@ export function ComboBoxMultiple<
122
122
  </li>
123
123
  ),
124
124
  getOptionLabel = (option: T) => `${option[labelField]}`,
125
+ getOptionKey = (option: T) => `${option[idField]}`,
125
126
  sx = { minWidth: "150px" },
126
127
  noOptionsText = labels?.noOptions,
127
128
  loadingText = labels?.loading,
@@ -260,6 +261,7 @@ export function ComboBoxMultiple<
260
261
  }
261
262
  disableCloseOnSelect={disableCloseOnSelect}
262
263
  getOptionLabel={getOptionLabel}
264
+ getOptionKey={getOptionKey}
263
265
  multiple
264
266
  isOptionEqualToValue={(option: T, value: T) =>
265
267
  option[idField] === value[idField]
@@ -55,6 +55,10 @@ export function ComboBoxPro<D extends ListType2 = ListType2>(
55
55
 
56
56
  // Destruct
57
57
  const {
58
+ getOptionKey = (option) =>
59
+ typeof option === "string" ? option : option.id,
60
+ getOptionLabel = (option) =>
61
+ typeof option === "object" ? DataTypes.getListItemLabel(option) : option,
58
62
  noOptionsText = noOptions,
59
63
  loadingText = loadingLabel,
60
64
  openText = openDefault,
@@ -132,9 +136,8 @@ export function ComboBoxPro<D extends ListType2 = ListType2>(
132
136
  }}
133
137
  />
134
138
  )}
135
- getOptionLabel={(item) =>
136
- typeof item === "object" ? DataTypes.getListItemLabel(item) : item
137
- }
139
+ getOptionLabel={getOptionLabel}
140
+ getOptionKey={getOptionKey}
138
141
  isOptionEqualToValue={(option, value) => option.id === value.id}
139
142
  noOptionsText={noOptionsText}
140
143
  loadingText={loadingText}
@@ -56,6 +56,8 @@ export function TagListPro<D extends ListType2 = ListType2>(
56
56
 
57
57
  // Destruct
58
58
  const {
59
+ getOptionKey = (option) =>
60
+ typeof option === "string" ? option : option.id,
59
61
  renderOption = ({ key, ...props }, option, { selected }) => (
60
62
  <li key={key} {...props}>
61
63
  <>
@@ -69,7 +71,7 @@ export function TagListPro<D extends ListType2 = ListType2>(
69
71
  </>
70
72
  </li>
71
73
  ),
72
- renderTags = (value: readonly D[], getTagProps) =>
74
+ renderValue = (value: readonly D[], getTagProps) =>
73
75
  value.map((option, index) => {
74
76
  const { key, ...rest } = getTagProps({ index });
75
77
  return (
@@ -141,7 +143,7 @@ export function TagListPro<D extends ListType2 = ListType2>(
141
143
  disableCloseOnSelect={disableCloseOnSelect}
142
144
  openOnFocus={openOnFocus}
143
145
  renderOption={renderOption}
144
- renderTags={renderTags}
146
+ renderValue={renderValue}
145
147
  renderInput={(params) => (
146
148
  <InputField
147
149
  label={label}
@@ -165,6 +167,7 @@ export function TagListPro<D extends ListType2 = ListType2>(
165
167
  );
166
168
  }}
167
169
  getOptionLabel={(item) => getLabel(item)}
170
+ getOptionKey={getOptionKey}
168
171
  isOptionEqualToValue={(option, value) => option.id === value.id}
169
172
  noOptionsText={noOptionsText}
170
173
  loadingText={loadingText}
package/src/Tiplist.tsx CHANGED
@@ -97,6 +97,7 @@ export function Tiplist<
97
97
  noOptionsText = noOptions,
98
98
  loadingText = loading,
99
99
  openText = openDefault,
100
+ getOptionKey = (option) => `${option[idField]}`,
100
101
  getOptionLabel,
101
102
  getOptionDisabled,
102
103
  sx = {},
@@ -389,6 +390,7 @@ export function Tiplist<
389
390
  ? getOptionLabel(item)
390
391
  : DataTypes.getObjectItemLabel(item);
391
392
  }}
393
+ getOptionKey={getOptionKey}
392
394
  {...rest}
393
395
  />
394
396
  </div>
@@ -127,6 +127,8 @@ export function TiplistPro<T extends ListType2 = ListType2>(
127
127
  openText = openDefault,
128
128
  getOptionDisabled,
129
129
  getOptionLabel,
130
+ getOptionKey = (option) =>
131
+ typeof option === "string" ? option : option.id,
130
132
  onChange,
131
133
  onValueChange,
132
134
  minChars,
@@ -379,6 +381,7 @@ export function TiplistPro<T extends ListType2 = ListType2>(
379
381
  noOptionsText={noOptionsText}
380
382
  loadingText={loadingText}
381
383
  openText={openText}
384
+ getOptionKey={getOptionKey}
382
385
  getOptionDisabled={(item) => {
383
386
  if (item.id === -1) return true;
384
387
  return getOptionDisabled ? getOptionDisabled(item) : false;