@antscorp/antsomi-ui 1.3.5-beta.716 → 1.3.5-beta.717
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.
|
@@ -15,7 +15,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
15
15
|
import { ConfigProvider } from 'antd';
|
|
16
16
|
import clsx from 'clsx';
|
|
17
17
|
import { isEmpty, uniqBy } from 'lodash';
|
|
18
|
-
import React, { useCallback, useEffect, useState } from 'react';
|
|
18
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
19
19
|
// Components
|
|
20
20
|
import { Button, Flex, Icon, Input, Popover, Spin, Tooltip, Typography, } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
21
21
|
import { EmptyData, PopoverSelect, Select } from '@antscorp/antsomi-ui/es/components/molecules';
|
|
@@ -66,6 +66,7 @@ export function MatchesAny(props) {
|
|
|
66
66
|
}
|
|
67
67
|
},
|
|
68
68
|
});
|
|
69
|
+
const searchInputRef = useRef(null);
|
|
69
70
|
// Effects
|
|
70
71
|
/**
|
|
71
72
|
* Updates the `selectedItems` state when the `selectedItems` prop changes.
|
|
@@ -76,6 +77,8 @@ export function MatchesAny(props) {
|
|
|
76
77
|
useEffect(() => {
|
|
77
78
|
// Delay for show load more el
|
|
78
79
|
setTimeout(() => {
|
|
80
|
+
var _a;
|
|
81
|
+
(_a = searchInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
79
82
|
setState(prev => (Object.assign(Object.assign({}, prev), { isShowLoadMoreEl: true })));
|
|
80
83
|
}, 500);
|
|
81
84
|
}, []);
|
|
@@ -235,7 +238,7 @@ export function MatchesAny(props) {
|
|
|
235
238
|
":"),
|
|
236
239
|
`${((_a = groupSelectProps === null || groupSelectProps === void 0 ? void 0 : groupSelectProps.selected) === null || _a === void 0 ? void 0 : _a.length) || 0} ${t(translations.global.selected)}`))),
|
|
237
240
|
React.createElement("div", { style: { width: '100%' } },
|
|
238
|
-
React.createElement(Input.CustomSearch, { value: searchValue, placeholder: `${(_b = t(translations.global.search)) === null || _b === void 0 ? void 0 : _b.toString()}...`, onAfterChange: searchValue => {
|
|
241
|
+
React.createElement(Input.CustomSearch, { ref: searchInputRef, autoFocus: true, value: searchValue, placeholder: `${(_b = t(translations.global.search)) === null || _b === void 0 ? void 0 : _b.toString()}...`, onAfterChange: searchValue => {
|
|
239
242
|
if (onChangeSearch) {
|
|
240
243
|
onChangeSearch(searchValue);
|
|
241
244
|
}
|
|
@@ -313,10 +316,8 @@ export function MatchesAnySelect(props) {
|
|
|
313
316
|
: undefined;
|
|
314
317
|
// Effects
|
|
315
318
|
useDeepCompareEffect(() => {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
}
|
|
319
|
-
}, [props.searchValue, state.searchValue]);
|
|
319
|
+
setState(prev => (Object.assign(Object.assign({}, prev), { searchValue: props.searchValue || '' })));
|
|
320
|
+
}, [props.searchValue]);
|
|
320
321
|
// Handlers
|
|
321
322
|
const onApplyMatchesAny = (selectedItems, selectedTreeData) => {
|
|
322
323
|
onChange(selectedItems, selectedTreeData);
|