@mw-kit/mw-ui 1.7.88 → 1.7.90

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.
@@ -35,7 +35,7 @@ export interface CommonProps extends Omit<InputProps, 'type' | 'mask' | 'icon' |
35
35
  loader: Loader;
36
36
  maxHeight?: string;
37
37
  emptyContent?: ReactNode;
38
- initialOptions?: Option[];
38
+ initialLoader?: () => Option[];
39
39
  }
40
40
  interface BaseContext {
41
41
  setOpen: React.Dispatch<React.SetStateAction<boolean>>;
package/dist/index.js CHANGED
@@ -15049,9 +15049,9 @@ var EmptyContentContainer = styled__default.div(_templateObject3$f || (_template
15049
15049
  var Select = React__default.forwardRef(function (props, ref) {
15050
15050
  var position = props.position,
15051
15051
  loader = props.loader,
15052
- withOptions = props.initialOptions;
15052
+ initialLoader = props.initialLoader;
15053
15053
 
15054
- var _useState = React.useState([].concat(withOptions || [])),
15054
+ var _useState = React.useState(initialLoader || []),
15055
15055
  options = _useState[0],
15056
15056
  setOptions = _useState[1];
15057
15057
 
@@ -15096,7 +15096,7 @@ var Select = React__default.forwardRef(function (props, ref) {
15096
15096
  setPage(1);
15097
15097
  };
15098
15098
 
15099
- var inputProps = filterObject(props, ['type', 'onScrollEnd', 'position', 'value', 'onClear', 'placeholder', 'initialOptions']);
15099
+ var inputProps = filterObject(props, ['type', 'onScrollEnd', 'position', 'value', 'onClear', 'placeholder', 'initialLoader']);
15100
15100
 
15101
15101
  var _onScrollEnd = props.onScrollEnd || function () {};
15102
15102
 
@@ -15120,14 +15120,15 @@ var Select = React__default.forwardRef(function (props, ref) {
15120
15120
  options = _ref2[0],
15121
15121
  lastPage = _ref2[1];
15122
15122
 
15123
- var filtered = withOptions ? options.filter(function (x) {
15124
- return !withOptions.some(function (y) {
15123
+ var initial = initialLoader ? initialLoader() : [];
15124
+ var filtered = initialLoader ? options.filter(function (x) {
15125
+ return !initial.some(function (y) {
15125
15126
  return x.value === y.value;
15126
15127
  });
15127
15128
  }) : options;
15128
15129
 
15129
15130
  var getWithOptions = function getWithOptions() {
15130
- return !search && withOptions ? [].concat(withOptions, filtered) : options;
15131
+ return !search && initialLoader ? [].concat(initial, filtered) : options;
15131
15132
  };
15132
15133
 
15133
15134
  setOptions(page === 1 ? getWithOptions() : function (prev) {
@@ -15139,10 +15140,7 @@ var Select = React__default.forwardRef(function (props, ref) {
15139
15140
  } catch (e) {
15140
15141
  return Promise.reject(e);
15141
15142
  }
15142
- }, [loader, search, page, withOptions]);
15143
- React.useEffect(function () {
15144
- setSearch('');
15145
- }, [loader]);
15143
+ }, [loader, search, page, initialLoader]);
15146
15144
  React.useEffect(function () {
15147
15145
  var timeoutId = setTimeout(function () {
15148
15146
  return onSubmit();
@@ -17889,7 +17887,11 @@ var Submenu = function Submenu(props) {
17889
17887
  _setSearch(value);
17890
17888
 
17891
17889
  setPage(1);
17892
- if (force && changed === false) onSearch();
17890
+
17891
+ if (force && changed === false) {
17892
+ setLoading(true);
17893
+ onSearch();
17894
+ }
17893
17895
  };
17894
17896
 
17895
17897
  React.useEffect(function () {