react-asc 18.7.1 → 18.7.2

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.
@@ -11,6 +11,7 @@ export interface IAutoCompleteProps {
11
11
  placeholder?: string;
12
12
  readOnly?: boolean;
13
13
  debounce?: number;
14
+ showClearButton?: boolean;
14
15
  onSelect?: (val: ISelectOption) => void;
15
16
  onChange?: (val: string | undefined) => void;
16
17
  onKeyDown?: (event: any) => void;
package/index.es.js CHANGED
@@ -253,7 +253,7 @@ styleInject(css_248z$I);
253
253
  // multiple
254
254
  // custom template render items
255
255
  const AutoComplete = (props) => {
256
- const { id, name, className, options = [], openOnFocus = true, disabled, readOnly, debounce = 0, placeholder, onChange, onSelect, value } = props;
256
+ const { id, name, className, options = [], openOnFocus = true, disabled, readOnly, debounce = 0, placeholder, showClearButton, onChange, onSelect, value } = props;
257
257
  const [model, setModel] = useState('');
258
258
  const [searchText, setSearchText] = useState('');
259
259
  const [isShow, setIsShow] = useState(false);
@@ -297,9 +297,16 @@ const AutoComplete = (props) => {
297
297
  const handleOnFocus = () => {
298
298
  openOnFocus && show();
299
299
  };
300
+ const handleClickReset = () => {
301
+ setModel('');
302
+ setSearchText('');
303
+ };
300
304
  return (React.createElement(React.Fragment, null,
301
305
  React.createElement("div", { ref: selectConainter, className: styles$I.selectContainer },
302
- React.createElement("input", { type: "text", className: getCssClass(), id: id, name: name, tabIndex: 0, readOnly: readOnly, disabled: disabled, onChange: handleOnChange, onFocus: handleOnFocus, placeholder: placeholder, value: model }),
306
+ React.createElement("div", { className: "d-flex" },
307
+ React.createElement("input", { type: "text", className: getCssClass(), id: id, name: name, tabIndex: 0, readOnly: readOnly, disabled: disabled, onChange: handleOnChange, onFocus: handleOnFocus, placeholder: placeholder, value: model }),
308
+ showClearButton && (model === null || model === void 0 ? void 0 : model.length) > 0 &&
309
+ React.createElement(IconButton, { icon: React.createElement(TimesSolidIcon, null), onClick: handleClickReset })),
303
310
  isShow &&
304
311
  React.createElement(React.Fragment, null,
305
312
  React.createElement("div", { className: styles$I.selectMenu },