revdev-components 0.88.0 → 0.90.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/build/index.js +19 -3
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -5342,7 +5342,12 @@ function OptionsAutocomplete(_a) {
|
|
|
5342
5342
|
}
|
|
5343
5343
|
}, [requestResponse]);
|
|
5344
5344
|
var onSelect = React.useCallback(function (value, option) {
|
|
5345
|
-
setValues(function (prev) {
|
|
5345
|
+
setValues(function (prev) {
|
|
5346
|
+
if (prev.find(function (x) { return x.value === option.value; })) {
|
|
5347
|
+
return prev;
|
|
5348
|
+
}
|
|
5349
|
+
return __spreadArray(__spreadArray([], prev, true), [option], false);
|
|
5350
|
+
});
|
|
5346
5351
|
setOptions([]);
|
|
5347
5352
|
setText("");
|
|
5348
5353
|
}, []);
|
|
@@ -5357,9 +5362,20 @@ function OptionsAutocomplete(_a) {
|
|
|
5357
5362
|
React.useEffect(function () {
|
|
5358
5363
|
onChange(values.map(function (w) { return w.label; }));
|
|
5359
5364
|
}, [values]);
|
|
5365
|
+
var optionsModified = React.useMemo(function () {
|
|
5366
|
+
var result = __spreadArray([], options, true);
|
|
5367
|
+
if (text) {
|
|
5368
|
+
var textParsed_1 = text.trim().toLowerCase();
|
|
5369
|
+
var hasOption = options.find(function (x) { return x.label === textParsed_1; });
|
|
5370
|
+
if (!hasOption) {
|
|
5371
|
+
result.push({ label: text, value: "" });
|
|
5372
|
+
}
|
|
5373
|
+
}
|
|
5374
|
+
return result;
|
|
5375
|
+
}, [options]);
|
|
5360
5376
|
return (React.createElement("div", null,
|
|
5361
|
-
React.createElement(antd.AutoComplete, { options:
|
|
5362
|
-
React.createElement(antd.Input.Search, {
|
|
5377
|
+
React.createElement(antd.AutoComplete, { options: optionsModified, onSelect: onSelect, onSearch: setText, value: text, className: s$2.autocomplete },
|
|
5378
|
+
React.createElement(antd.Input.Search, { placeholder: placeholder, enterButton: true, loading: requestResponse.isLoading, allowClear: true })),
|
|
5363
5379
|
React.createElement("div", { className: s$2.options }, values.map(function (w) { return (React.createElement(antd.Tag, { key: w.value, closable: true, onClose: function () { return setValues(function (data) { return data.filter(function (x) { return x.value !== w.value; }); }); }, color: "blue" }, w.label)); }))));
|
|
5364
5380
|
}
|
|
5365
5381
|
|