@symply.io/basic-components 1.2.14-beta.2 → 1.3.0
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/Autocomplete/index.js +4 -9
- package/AutocompleteWithFilter/index.js +3 -10
- package/README.md +10 -10
- package/package.json +1 -1
package/Autocomplete/index.js
CHANGED
@@ -33,15 +33,10 @@ function CustomAutocomplete(props) {
|
|
33
33
|
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Autocomplete, { size: size, fullWidth: true, loading: loading, disabled: disabled, limitTags: limitTags !== null && limitTags !== void 0 ? limitTags : -1, options: options, multiple: multiple, onChange: function (event, val) {
|
34
34
|
event.preventDefault();
|
35
35
|
onChange(val);
|
36
|
-
}, getOptionLabel: function (option) {
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
if (option.value) {
|
41
|
-
return String(option.value);
|
42
|
-
}
|
43
|
-
return option.label;
|
44
|
-
}, renderOption: function (props, option) { return (_jsx("li", __assign({}, props, { children: option.label || "" }))); }, isOptionEqualToValue: function (opt, val) {
|
36
|
+
}, getOptionLabel: function (option) { return option.label || ""; }, renderOption: function (props, option) {
|
37
|
+
var _a, _b;
|
38
|
+
return (_jsx("li", __assign({}, __assign(__assign({}, props), { key: (_b = (_a = option.value) !== null && _a !== void 0 ? _a : option.label) !== null && _b !== void 0 ? _b : option }), { children: option.label || "" })));
|
39
|
+
}, isOptionEqualToValue: function (opt, val) {
|
45
40
|
if (typeof opt === "string") {
|
46
41
|
return opt === val;
|
47
42
|
}
|
@@ -42,15 +42,7 @@ function AutocompleteWithFilter(props) {
|
|
42
42
|
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Autocomplete, { size: size, fullWidth: true, loading: loading, limitTags: limitTags !== null && limitTags !== void 0 ? limitTags : -1, options: options, disabled: disabled, multiple: multiple, filterOptions: filter, onChange: function (event, val) {
|
43
43
|
event.preventDefault();
|
44
44
|
onChange(val);
|
45
|
-
}, value: value, disableCloseOnSelect: disableCloseOnSelect || multiple, getOptionLabel: function (option) {
|
46
|
-
if (typeof option === "string") {
|
47
|
-
return option;
|
48
|
-
}
|
49
|
-
if (option.value) {
|
50
|
-
return String(option.value);
|
51
|
-
}
|
52
|
-
return option.label;
|
53
|
-
}, isOptionEqualToValue: function (opt, val) {
|
45
|
+
}, value: value, disableCloseOnSelect: disableCloseOnSelect || multiple, getOptionLabel: function (option) { return option.label; }, isOptionEqualToValue: function (opt, val) {
|
54
46
|
if (typeof opt === "string") {
|
55
47
|
return opt === val;
|
56
48
|
}
|
@@ -59,8 +51,9 @@ function AutocompleteWithFilter(props) {
|
|
59
51
|
}
|
60
52
|
return opt.label === val.label;
|
61
53
|
}, renderOption: function (props, option, _a) {
|
54
|
+
var _b, _c;
|
62
55
|
var selected = _a.selected;
|
63
|
-
return (_jsxs("li", __assign({}, props, { children: [_jsx(Checkbox, { icon: icon, color: "primary", checkedIcon: checkedIcon, style: { marginRight: 8 }, checked: selected }), option.label || ""] })));
|
56
|
+
return (_jsxs("li", __assign({}, __assign(__assign({}, props), { key: (_c = (_b = option.value) !== null && _b !== void 0 ? _b : option.label) !== null && _c !== void 0 ? _c : option }), { children: [_jsx(Checkbox, { icon: icon, color: "primary", checkedIcon: checkedIcon, style: { marginRight: 8 }, checked: selected }), option.label || ""] })));
|
64
57
|
}, renderInput: function (params) { return (_jsx(TextField, __assign({}, params, rest, { variant: "outlined", required: required, inputProps: __assign(__assign({}, params.inputProps), { required: required && (Array.isArray(value) ? value.length === 0 : !value) }) }))); } }) })));
|
65
58
|
}
|
66
59
|
export default AutocompleteWithFilter;
|
package/README.md
CHANGED
@@ -119,11 +119,11 @@ import Autocomplete from '@symply.io/basic-components/Autocomplete';
|
|
119
119
|
|
120
120
|
<h5>Option Props (IOption)</h5>
|
121
121
|
|
122
|
-
| Name | Type
|
123
|
-
| ------ |
|
124
|
-
| label | string
|
125
|
-
| value |
|
126
|
-
| [name] | unknown
|
122
|
+
| Name | Type | Default | Required | Description |
|
123
|
+
| ------ | ---------------- | ------- | -------- | -------------------------- |
|
124
|
+
| label | string | | true | Option label. |
|
125
|
+
| value | string \| number | | false | Option valie. |
|
126
|
+
| [name] | unknown | | false | Customized option property |
|
127
127
|
|
128
128
|
<h5>Props</h5>
|
129
129
|
|
@@ -153,11 +153,11 @@ import AutocompleteWithFilter from '@symply.io/basic-components/AutocompleteWith
|
|
153
153
|
|
154
154
|
<h5>Option Props (IOption)</h5>
|
155
155
|
|
156
|
-
| Name | Type
|
157
|
-
| ------ |
|
158
|
-
| label | string
|
159
|
-
| value |
|
160
|
-
| [name] | unknown
|
156
|
+
| Name | Type | Default | Required | Description |
|
157
|
+
| ------ | ---------------- | ------- | -------- | -------------------------- |
|
158
|
+
| label | string | | true | Option label. |
|
159
|
+
| value | string \| number | | false | Option valie. |
|
160
|
+
| [name] | unknown | | false | Customized option property |
|
161
161
|
|
162
162
|
<h5>Props</h5>
|
163
163
|
|