react-asc 21.0.5 → 21.0.6
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/components/AutoComplete/AutoComplete.d.ts +0 -1
- package/index.es.js +4 -9
- package/index.js +4 -9
- package/package.json +1 -1
package/index.es.js
CHANGED
|
@@ -398,11 +398,11 @@ styleInject(css_248z$Q);
|
|
|
398
398
|
// multiple
|
|
399
399
|
// custom template render items
|
|
400
400
|
const AutoComplete = (props) => {
|
|
401
|
-
const { id, name, className, options = [], openOnFocus = true, disabled, readOnly, debounce = 0, placeholder,
|
|
401
|
+
const { id, name, className, options = [], openOnFocus = true, disabled, readOnly, debounce = 0, placeholder, showClearButton, onChange, onSelect, value } = props;
|
|
402
402
|
const [model, setModel] = useState('');
|
|
403
403
|
const [searchText, setSearchText] = useState('');
|
|
404
404
|
const [isShow, setIsShow] = useState(false);
|
|
405
|
-
const [
|
|
405
|
+
const [_options, setOptions] = useState([]);
|
|
406
406
|
const selectConainter = useRef(null);
|
|
407
407
|
useEffect(() => {
|
|
408
408
|
if (value !== model) {
|
|
@@ -411,12 +411,7 @@ const AutoComplete = (props) => {
|
|
|
411
411
|
}
|
|
412
412
|
}, [value]);
|
|
413
413
|
useEffect(() => {
|
|
414
|
-
|
|
415
|
-
setOptionsTemp([{ value: '', label: '- no entry found -' }]);
|
|
416
|
-
}
|
|
417
|
-
else {
|
|
418
|
-
setOptionsTemp(options);
|
|
419
|
-
}
|
|
414
|
+
setOptions(options);
|
|
420
415
|
}, [options]);
|
|
421
416
|
useDebounce(() => { onChange && onChange(searchText); }, debounce, [searchText]);
|
|
422
417
|
useEffect(() => {
|
|
@@ -473,7 +468,7 @@ const AutoComplete = (props) => {
|
|
|
473
468
|
isShow &&
|
|
474
469
|
React.createElement(React.Fragment, null,
|
|
475
470
|
React.createElement("div", { className: styles$Q.selectMenu },
|
|
476
|
-
React.createElement(List, null,
|
|
471
|
+
React.createElement(List, null, _options && _options.map((option, index) => React.createElement(ListItem, { id: `list-item-${index}`, key: option.value, onClick: () => handleOnClick(option), disabled: !option.value },
|
|
477
472
|
React.createElement(ListItemText, { primary: option.label ? option.label : option.value }))))),
|
|
478
473
|
React.createElement(Backdrop, { isTransparent: true, onClick: () => hide() }))));
|
|
479
474
|
};
|
package/index.js
CHANGED
|
@@ -406,11 +406,11 @@ styleInject(css_248z$Q);
|
|
|
406
406
|
// multiple
|
|
407
407
|
// custom template render items
|
|
408
408
|
const AutoComplete = (props) => {
|
|
409
|
-
const { id, name, className, options = [], openOnFocus = true, disabled, readOnly, debounce = 0, placeholder,
|
|
409
|
+
const { id, name, className, options = [], openOnFocus = true, disabled, readOnly, debounce = 0, placeholder, showClearButton, onChange, onSelect, value } = props;
|
|
410
410
|
const [model, setModel] = React.useState('');
|
|
411
411
|
const [searchText, setSearchText] = React.useState('');
|
|
412
412
|
const [isShow, setIsShow] = React.useState(false);
|
|
413
|
-
const [
|
|
413
|
+
const [_options, setOptions] = React.useState([]);
|
|
414
414
|
const selectConainter = React.useRef(null);
|
|
415
415
|
React.useEffect(() => {
|
|
416
416
|
if (value !== model) {
|
|
@@ -419,12 +419,7 @@ const AutoComplete = (props) => {
|
|
|
419
419
|
}
|
|
420
420
|
}, [value]);
|
|
421
421
|
React.useEffect(() => {
|
|
422
|
-
|
|
423
|
-
setOptionsTemp([{ value: '', label: '- no entry found -' }]);
|
|
424
|
-
}
|
|
425
|
-
else {
|
|
426
|
-
setOptionsTemp(options);
|
|
427
|
-
}
|
|
422
|
+
setOptions(options);
|
|
428
423
|
}, [options]);
|
|
429
424
|
useDebounce(() => { onChange && onChange(searchText); }, debounce, [searchText]);
|
|
430
425
|
React.useEffect(() => {
|
|
@@ -481,7 +476,7 @@ const AutoComplete = (props) => {
|
|
|
481
476
|
isShow &&
|
|
482
477
|
React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
483
478
|
React__default["default"].createElement("div", { className: styles$Q.selectMenu },
|
|
484
|
-
React__default["default"].createElement(List, null,
|
|
479
|
+
React__default["default"].createElement(List, null, _options && _options.map((option, index) => React__default["default"].createElement(ListItem, { id: `list-item-${index}`, key: option.value, onClick: () => handleOnClick(option), disabled: !option.value },
|
|
485
480
|
React__default["default"].createElement(ListItemText, { primary: option.label ? option.label : option.value }))))),
|
|
486
481
|
React__default["default"].createElement(Backdrop, { isTransparent: true, onClick: () => hide() }))));
|
|
487
482
|
};
|