@antscorp/antsomi-ui 1.3.5-beta.697 → 1.3.5-beta.699
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/es/components/molecules/DatePicker/components/AdvancedPicker/AdvancedPicker.d.ts +13 -0
- package/es/components/molecules/DatePicker/components/AdvancedPicker/AdvancedPicker.js +2 -2
- package/es/components/molecules/MatchAnySelect/MatchesAnySelect.d.ts +2 -2
- package/es/components/molecules/MatchAnySelect/MatchesAnySelect.js +53 -35
- package/es/components/molecules/MatchAnySelect/constants.js +0 -20
- package/es/components/molecules/MatchAnySelect/mock.d.ts +21 -0
- package/es/components/molecules/MatchAnySelect/mock.js +3309 -0
- package/es/components/molecules/MatchAnySelect/types.d.ts +10 -6
- package/es/components/molecules/MatchAnySelect/utils.d.ts +2 -0
- package/es/components/molecules/MatchAnySelect/utils.js +34 -0
- package/es/components/organism/DataTable/hooks/useAddFilterButton.d.ts +1 -1
- package/package.json +3 -1
|
@@ -22,6 +22,19 @@ export interface AdvancedPickerProps {
|
|
|
22
22
|
showTime?: boolean;
|
|
23
23
|
timezone?: string;
|
|
24
24
|
isViewMode?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @example const disabledTime = () => ({
|
|
28
|
+
disabledHours: () => range(0, 24).splice(4, 20),
|
|
29
|
+
disabledMinutes: () => range(30, 60),
|
|
30
|
+
disabledSeconds: () => [55, 56],
|
|
31
|
+
});
|
|
32
|
+
*/
|
|
33
|
+
disabledTime?: () => {
|
|
34
|
+
disabledHours: () => number[];
|
|
35
|
+
disabledMinutes: () => number[];
|
|
36
|
+
disabledSeconds: () => number[];
|
|
37
|
+
};
|
|
25
38
|
/**
|
|
26
39
|
* Only show fixed calendar (hide dynamic and )
|
|
27
40
|
*/
|
|
@@ -30,7 +30,7 @@ const { Text } = Typography;
|
|
|
30
30
|
export const AdvancedPicker = props => {
|
|
31
31
|
var _a, _b;
|
|
32
32
|
// Props
|
|
33
|
-
const { label, inputStyle, popupStyle, dateTypeKeysShow, calculationTypeKeysShow, showCalculationTypeCondition, defaultDateTypeKey, valueType, option: propsOption, operatorKey, type, date: propsDate, format, formatInputDisplay, errorMessage, disableAfterDate, disableBeforeDate, showTime, disabled, timezone, isViewMode, onlyShowFixed, onUpdatedNewDate, onApply, } = props;
|
|
33
|
+
const { label, inputStyle, popupStyle, dateTypeKeysShow, calculationTypeKeysShow, showCalculationTypeCondition, defaultDateTypeKey, valueType, option: propsOption, operatorKey, type, date: propsDate, format, formatInputDisplay, errorMessage, disableAfterDate, disableBeforeDate, showTime, disabled, timezone, isViewMode, onlyShowFixed, disabledTime, onUpdatedNewDate, onApply, } = props;
|
|
34
34
|
// Memo
|
|
35
35
|
const newDateTypes = useMemo(() => {
|
|
36
36
|
if (dateTypeKeysShow && dateTypeKeysShow.length) {
|
|
@@ -397,7 +397,7 @@ export const AdvancedPicker = props => {
|
|
|
397
397
|
// style={{
|
|
398
398
|
// width: 120,
|
|
399
399
|
// }}
|
|
400
|
-
disabledDate: disableDate, format: formatDisplay, showToday: false, popupClassName: clsx('antsomi-picker-dropdown__advanced', {
|
|
400
|
+
disabledDate: disableDate, disabledTime: disabledTime, format: formatDisplay, showToday: false, popupClassName: clsx('antsomi-picker-dropdown__advanced', {
|
|
401
401
|
'--error': errorMessage,
|
|
402
402
|
'hide-picker-header': ['QUARTER', 'MONTH'].includes(valueType),
|
|
403
403
|
'only-show-time-picker': ['HOUR', 'MINUTE'].includes(valueType),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { MatchesAnyProps, MatchesAnySelectProps } from './types';
|
|
3
|
-
export declare function MatchesAny<TItem =
|
|
4
|
-
export declare function MatchesAnySelect<TItem =
|
|
3
|
+
export declare function MatchesAny<TItem = any>(props: MatchesAnyProps<TItem>): React.JSX.Element;
|
|
4
|
+
export declare function MatchesAnySelect<TItem = any>(props: MatchesAnySelectProps<TItem>): React.JSX.Element;
|
|
@@ -13,26 +13,29 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
13
13
|
/* eslint-disable react/destructuring-assignment */
|
|
14
14
|
// Libraries
|
|
15
15
|
import { ConfigProvider } from 'antd';
|
|
16
|
-
import
|
|
16
|
+
import clsx from 'clsx';
|
|
17
|
+
import { isEmpty, uniqBy } from 'lodash';
|
|
17
18
|
import React, { useEffect, useState } from 'react';
|
|
19
|
+
import deepmerge from 'deepmerge';
|
|
18
20
|
// Components
|
|
21
|
+
import { Button, Flex, Icon, Input, Popover, Spin, Tooltip, Typography, } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
19
22
|
import { EmptyData, PopoverSelect, Select } from '@antscorp/antsomi-ui/es/components/molecules';
|
|
20
|
-
import { Button, Flex, Icon, Input, Popover, Spin, Typography, Tooltip, } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
21
23
|
import { ExtendValuePopup } from './components/ExtendValuePopup';
|
|
22
24
|
// Styled
|
|
23
|
-
import {
|
|
25
|
+
import { ActionButton, ExtraValueLabel, GroupSelectButton, MatchesAnyWrapper, StyledTree, TextButton, } from './styled';
|
|
24
26
|
// Locales
|
|
25
27
|
import i18nInstance from '@antscorp/antsomi-ui/es/locales/i18n';
|
|
26
28
|
import { translations } from '@antscorp/antsomi-ui/es/locales/translations';
|
|
27
29
|
// Constants
|
|
28
|
-
import { MATCHES_ANY_THEME } from './constants';
|
|
29
30
|
import { globalToken } from '@antscorp/antsomi-ui/es/constants';
|
|
31
|
+
import { MATCHES_ANY_THEME } from './constants';
|
|
30
32
|
// Hooks
|
|
31
33
|
import { useDeepCompareEffect, useDeepCompareMemo, useIntersectionObserver, } from '@antscorp/antsomi-ui/es/hooks';
|
|
32
34
|
// Utils
|
|
33
|
-
import { flatTree,
|
|
35
|
+
import { flatTree, recursiveSearchItems } from '@antscorp/antsomi-ui/es/utils';
|
|
36
|
+
import { getSelectedTreeData } from './utils';
|
|
37
|
+
// Icons
|
|
34
38
|
import { DataIcon, WarningIcon } from '../../icons';
|
|
35
|
-
import clsx from 'clsx';
|
|
36
39
|
const initialState = {
|
|
37
40
|
isOpenPopover: false,
|
|
38
41
|
};
|
|
@@ -40,17 +43,16 @@ const matchesAnyInitialState = {
|
|
|
40
43
|
searchValue: '',
|
|
41
44
|
selectedItems: [],
|
|
42
45
|
isShowLoadMoreEl: false,
|
|
43
|
-
selectedExpandedKeys: [],
|
|
44
46
|
};
|
|
45
47
|
const { t } = i18nInstance;
|
|
46
48
|
const { Text } = Typography;
|
|
47
49
|
export function MatchesAny(props) {
|
|
48
50
|
// Props
|
|
49
|
-
const { objectName, loading = false, showExtendValue = true, items, groupSelectProps, renderExtraValues, customItemRenders, listEmptyProps, selectedListEmptyProps, onApply = () => { }, onCancel = () => { }, onLoadMore = () => { }, onChangeSearch } = props, restOfProps = __rest(props, ["objectName", "loading", "showExtendValue", "items", "groupSelectProps", "renderExtraValues", "customItemRenders", "listEmptyProps", "selectedListEmptyProps", "onApply", "onCancel", "onLoadMore", "onChangeSearch"]);
|
|
51
|
+
const { objectName, loading = false, showExtendValue = true, items, groupSelectProps, renderExtraValues, customItemRenders, listEmptyProps, selectedListEmptyProps, selectedTreeData: selectedTreeDataProp, onSelectedTreeDataChange = () => { }, onApply = () => { }, onCancel = () => { }, onLoadMore = () => { }, onChangeSearch } = props, restOfProps = __rest(props, ["objectName", "loading", "showExtendValue", "items", "groupSelectProps", "renderExtraValues", "customItemRenders", "listEmptyProps", "selectedListEmptyProps", "selectedTreeData", "onSelectedTreeDataChange", "onApply", "onCancel", "onLoadMore", "onChangeSearch"]);
|
|
50
52
|
// State
|
|
51
53
|
const [state, setState] = useState(matchesAnyInitialState);
|
|
52
54
|
// Variables
|
|
53
|
-
const { searchValue, selectedItems, isShowLoadMoreEl
|
|
55
|
+
const { searchValue, selectedItems, isShowLoadMoreEl } = state;
|
|
54
56
|
const _a = listEmptyProps || {}, { icon: listEmptyIcon, description: listEmptyDescription = t(translations.global.noResultsMatchesKeyWord).toString() } = _a, restListEmptyProps = __rest(_a, ["icon", "description"]);
|
|
55
57
|
const _b = selectedListEmptyProps || {}, { description: selectedListEmptyDescription = t(translations.global.selectItemsFromList).toString(), icon: selectedListEmptyIcon = React.createElement(DataIcon, { color: globalToken === null || globalToken === void 0 ? void 0 : globalToken.bw5, size: 48 }) } = _b, restSelectedListEmptyProps = __rest(_b, ["description", "icon"]);
|
|
56
58
|
// Refs
|
|
@@ -76,6 +78,13 @@ export function MatchesAny(props) {
|
|
|
76
78
|
setState(prev => (Object.assign(Object.assign({}, prev), { isShowLoadMoreEl: true })));
|
|
77
79
|
}, 500);
|
|
78
80
|
}, []);
|
|
81
|
+
useDeepCompareEffect(() => {
|
|
82
|
+
const selectedTreeData = getSelectedTreeData(items || [], selectedItems || [], selectedTreeDataProp || []);
|
|
83
|
+
if (!isEmpty(selectedTreeData)) {
|
|
84
|
+
onSelectedTreeDataChange(selectedTreeData);
|
|
85
|
+
}
|
|
86
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
87
|
+
}, [items, selectedItems]);
|
|
79
88
|
// Handlers
|
|
80
89
|
/**
|
|
81
90
|
* Adds an item and, if applicable, its leaf descendants to the list of selected items.
|
|
@@ -88,16 +97,15 @@ export function MatchesAny(props) {
|
|
|
88
97
|
* This item can have children.
|
|
89
98
|
*/
|
|
90
99
|
const onSelectItem = (item) => {
|
|
100
|
+
let newSelectedItems = [...(selectedItems || [])];
|
|
91
101
|
if (item.children) {
|
|
92
102
|
const flattenChild = flatTree(item.children, 'children');
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
return;
|
|
103
|
+
newSelectedItems = newSelectedItems.concat(flattenChild.filter(item => !item.children));
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
newSelectedItems = newSelectedItems.concat(item);
|
|
98
107
|
}
|
|
99
|
-
|
|
100
|
-
setState(prev => (Object.assign(Object.assign({}, prev), { selectedItems: [...(prev.selectedItems || []), item], selectedExpandedKeys: [...(prev.selectedExpandedKeys || []), ...parentExpandedKeys] })));
|
|
108
|
+
setState(prev => (Object.assign(Object.assign({}, prev), { selectedItems: newSelectedItems })));
|
|
101
109
|
};
|
|
102
110
|
/**
|
|
103
111
|
* Removes an item and its descendants from the list of selected items.
|
|
@@ -122,13 +130,15 @@ export function MatchesAny(props) {
|
|
|
122
130
|
const onSelectAll = () => {
|
|
123
131
|
const flattenTreeData = flatTree(items, 'children').filter(item => !item.children &&
|
|
124
132
|
!(selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.some(selectedItem => selectedItem.key === item.key || selectedItem.title === item.title)));
|
|
125
|
-
setState(prev => (Object.assign(Object.assign({}, prev), { selectedItems: uniqBy([...(prev.selectedItems || []), ...flattenTreeData], 'key')
|
|
126
|
-
.filter(item => !!item.children)
|
|
127
|
-
.map(item => item.key) })));
|
|
133
|
+
setState(prev => (Object.assign(Object.assign({}, prev), { selectedItems: uniqBy([...(prev.selectedItems || []), ...flattenTreeData], 'key') })));
|
|
128
134
|
};
|
|
129
135
|
const onRemoveAll = () => {
|
|
130
136
|
setState(prev => (Object.assign(Object.assign({}, prev), { selectedItems: [] })));
|
|
131
137
|
};
|
|
138
|
+
const onClickApply = () => {
|
|
139
|
+
const selectedTreeData = getSelectedTreeData(items || [], selectedItems || [], selectedTreeDataProp || []);
|
|
140
|
+
onApply(selectedItems || [], selectedTreeData);
|
|
141
|
+
};
|
|
132
142
|
const renderItemError = (item) => {
|
|
133
143
|
if (customItemRenders === null || customItemRenders === void 0 ? void 0 : customItemRenders.error) {
|
|
134
144
|
return customItemRenders === null || customItemRenders === void 0 ? void 0 : customItemRenders.error(item);
|
|
@@ -204,12 +214,13 @@ export function MatchesAny(props) {
|
|
|
204
214
|
treeData = treeData.filter(item => { var _a; return (_a = groupSelectProps.selected) === null || _a === void 0 ? void 0 : _a.includes(item.key); });
|
|
205
215
|
}
|
|
206
216
|
return { treeData, matchedParents };
|
|
217
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
207
218
|
}, [items, searchValue, selectedItems, groupSelectProps, onChangeSearch]);
|
|
219
|
+
// const selectedTreeData = useDeepCompareMemo(() => [], [items, selectedItems]);
|
|
208
220
|
const selectedTreeData = useDeepCompareMemo(() => {
|
|
209
221
|
var _a;
|
|
210
222
|
const notExtendValueSelectedItems = (selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.filter(item => !item.isExtendValue)) || [];
|
|
211
223
|
const extendValueSelectedItems = (selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.filter(item => item.isExtendValue)) || [];
|
|
212
|
-
const lazyLoadSelectedItems = (notExtendValueSelectedItems === null || notExtendValueSelectedItems === void 0 ? void 0 : notExtendValueSelectedItems.filter(selectedItem => !flatTree(items || [], 'children').some(item => item.key === selectedItem.key))) || [];
|
|
213
224
|
const serializeTreeData = (list) => {
|
|
214
225
|
var _a;
|
|
215
226
|
return ((_a = list
|
|
@@ -229,8 +240,14 @@ export function MatchesAny(props) {
|
|
|
229
240
|
children: serializeTreeData(item.children),
|
|
230
241
|
})), (!!item.error && { className: 'error-node' }))))) || [];
|
|
231
242
|
};
|
|
232
|
-
|
|
233
|
-
|
|
243
|
+
const mergeItems = deepmerge(selectedTreeDataProp || [], items || [], {
|
|
244
|
+
arrayMerge(target, source) {
|
|
245
|
+
return uniqBy([...target, ...source], 'key');
|
|
246
|
+
},
|
|
247
|
+
});
|
|
248
|
+
return serializeTreeData(mergeItems).concat(((_a = [...extendValueSelectedItems]) === null || _a === void 0 ? void 0 : _a.map(item => (Object.assign(Object.assign({}, item), { title: renderItemNodeTitle({ item, mode: 'select', onRemoveItem }) })))) || []);
|
|
249
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
250
|
+
}, [items, selectedItems, selectedTreeDataProp]);
|
|
234
251
|
const isDisableRemoveAll = useDeepCompareMemo(() => !(selectedTreeData === null || selectedTreeData === void 0 ? void 0 : selectedTreeData.length), [selectedTreeData]);
|
|
235
252
|
const isDisableSelectAll = useDeepCompareMemo(() => {
|
|
236
253
|
const flattenTreeData = flatTree(treeData, 'children');
|
|
@@ -268,7 +285,9 @@ export function MatchesAny(props) {
|
|
|
268
285
|
renderExtraValueLabels(),
|
|
269
286
|
React.createElement(TextButton, { disabled: isDisableSelectAll, onClick: onSelectAll }, t(translations.global.selectAll).toString()))),
|
|
270
287
|
React.createElement(Spin, { spinning: loading }, (treeData === null || treeData === void 0 ? void 0 : treeData.length) ? (React.createElement(React.Fragment, null,
|
|
271
|
-
React.createElement(StyledTree, { key: searchValue,
|
|
288
|
+
React.createElement(StyledTree, { key: searchValue, defaultExpandedKeys: (matchedParents === null || matchedParents === void 0 ? void 0 : matchedParents.length)
|
|
289
|
+
? matchedParents.map(item => item.key)
|
|
290
|
+
: items === null || items === void 0 ? void 0 : items.map(item => item.key), selectable: false, treeData: treeData, switcherIcon: props => (React.createElement(Icon, { type: "icon-ants-caret-down", style: {
|
|
272
291
|
transform: props.expanded ? 'rotate(0)' : 'rotate(-90deg)',
|
|
273
292
|
transition: 'transform 0.3s ease',
|
|
274
293
|
}, color: globalToken === null || globalToken === void 0 ? void 0 : globalToken.bw8 })), height: 396 }),
|
|
@@ -278,14 +297,10 @@ export function MatchesAny(props) {
|
|
|
278
297
|
React.createElement(Flex, { className: "matches-any__header", justify: "space-between" },
|
|
279
298
|
React.createElement(Text, { strong: true }, `${t(translations.global.selected)} (${(selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.length) || 0})`),
|
|
280
299
|
React.createElement(TextButton, { disabled: isDisableRemoveAll, onClick: onRemoveAll }, t(translations.global.removeAll).toString())),
|
|
281
|
-
React.createElement("div", { className: "matches-any__body" }, !(selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.length) ? (React.createElement(EmptyData, Object.assign({ icon: selectedListEmptyIcon, description: selectedListEmptyDescription }, restSelectedListEmptyProps))) : (React.createElement(StyledTree,
|
|
282
|
-
expandedKeys: selectedExpandedKeys,
|
|
283
|
-
}), { switcherIcon: props => (React.createElement(Icon, { type: "icon-ants-caret-down", style: {
|
|
300
|
+
React.createElement("div", { className: "matches-any__body" }, !(selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.length) ? (React.createElement(EmptyData, Object.assign({ icon: selectedListEmptyIcon, description: selectedListEmptyDescription }, restSelectedListEmptyProps))) : (React.createElement(StyledTree, { defaultExpandedKeys: selectedTreeData === null || selectedTreeData === void 0 ? void 0 : selectedTreeData.map(item => item.key), selectable: false, treeData: selectedTreeData, height: 420, switcherIcon: props => (React.createElement(Icon, { type: "icon-ants-caret-down", style: {
|
|
284
301
|
transform: props.expanded ? 'rotate(0)' : 'rotate(-90deg)',
|
|
285
302
|
transition: 'transform 0.3s ease',
|
|
286
|
-
}, color: globalToken === null || globalToken === void 0 ? void 0 : globalToken.bw8 }))
|
|
287
|
-
setState(prev => (Object.assign(Object.assign({}, prev), { selectedExpandedKeys: expandedKeys })));
|
|
288
|
-
} }))))));
|
|
303
|
+
}, color: globalToken === null || globalToken === void 0 ? void 0 : globalToken.bw8 })) })))));
|
|
289
304
|
// Handlers
|
|
290
305
|
const onApplyExtendValue = (extendValues) => {
|
|
291
306
|
// Filter out values that are already present in selectedItems
|
|
@@ -308,14 +323,14 @@ export function MatchesAny(props) {
|
|
|
308
323
|
renderSelectedList()),
|
|
309
324
|
React.createElement(Flex, { className: "matches-any__footer", align: "center", justify: "space-between" },
|
|
310
325
|
React.createElement(Flex, { align: "center", gap: 10 },
|
|
311
|
-
React.createElement(Button, { type: "primary", onClick:
|
|
326
|
+
React.createElement(Button, { type: "primary", onClick: onClickApply }, t(translations.apply.title).toString()),
|
|
312
327
|
React.createElement(Button, { onClick: () => onCancel() }, t(translations.cancel.title).toString())),
|
|
313
328
|
showExtendValue && (React.createElement(ExtendValuePopup, { getPopupContainer: trigger => trigger.parentElement || document.body, onApply: onApplyExtendValue },
|
|
314
329
|
React.createElement(Button, { icon: React.createElement(Icon, { type: "icon-ants-empty-flag" }) }, t(translations.extendValue.title).toString())))))));
|
|
315
330
|
}
|
|
316
331
|
export function MatchesAnySelect(props) {
|
|
317
332
|
var _a, _b, _c;
|
|
318
|
-
const { placeholder = 'Select an item', dropdownStyle, objectName, selectedItems, items, loading, popupClassName, groupSelectProps, renderExtraValues, customItemRenders, popoverProps, listEmptyProps, selectedListEmptyProps, onChangeSearch, onChange = () => { }, onLoadMore } = props, restProps = __rest(props, ["placeholder", "dropdownStyle", "objectName", "selectedItems", "items", "loading", "popupClassName", "groupSelectProps", "renderExtraValues", "customItemRenders", "popoverProps", "listEmptyProps", "selectedListEmptyProps", "onChangeSearch", "onChange", "onLoadMore"]);
|
|
333
|
+
const { placeholder = 'Select an item', dropdownStyle, objectName, selectedItems, items, loading, popupClassName, groupSelectProps, renderExtraValues, customItemRenders, popoverProps, listEmptyProps, selectedListEmptyProps, selectedTreeData, onChangeSearch, onChange = () => { }, onSelectedTreeDataChange, onLoadMore } = props, restProps = __rest(props, ["placeholder", "dropdownStyle", "objectName", "selectedItems", "items", "loading", "popupClassName", "groupSelectProps", "renderExtraValues", "customItemRenders", "popoverProps", "listEmptyProps", "selectedListEmptyProps", "selectedTreeData", "onChangeSearch", "onChange", "onSelectedTreeDataChange", "onLoadMore"]);
|
|
319
334
|
// State
|
|
320
335
|
const [state, setState] = useState(initialState);
|
|
321
336
|
// Variables
|
|
@@ -324,11 +339,11 @@ export function MatchesAnySelect(props) {
|
|
|
324
339
|
? `${(_a = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.map(item => item.title)) === null || _a === void 0 ? void 0 : _a[0]}${((_b = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.slice(1)) === null || _b === void 0 ? void 0 : _b.length) ? `, and +${(_c = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.slice(1)) === null || _c === void 0 ? void 0 : _c.length} more` : ''}` || []
|
|
325
340
|
: undefined;
|
|
326
341
|
// Handlers
|
|
327
|
-
const onApplyMatchesAny = (selectedItems) => {
|
|
328
|
-
onChange(selectedItems);
|
|
342
|
+
const onApplyMatchesAny = (selectedItems, selectedTreeData) => {
|
|
343
|
+
onChange(selectedItems, selectedTreeData);
|
|
329
344
|
setState(prev => (Object.assign(Object.assign({}, prev), { isOpenPopover: false })));
|
|
330
345
|
};
|
|
331
|
-
return (React.createElement(Popover, Object.assign({ open: isOpenPopover, arrow: false, placement: "bottomLeft", content: React.createElement(MatchesAny, { className: popupClassName, items: items, selectedItems: selectedItems, loading: loading, objectName: objectName, groupSelectProps: groupSelectProps, renderExtraValues: renderExtraValues, customItemRenders: customItemRenders, listEmptyProps: listEmptyProps, selectedListEmptyProps: selectedListEmptyProps, onChangeSearch: onChangeSearch, onApply: onApplyMatchesAny, onCancel: () => setState(prev => (Object.assign(Object.assign({}, prev), { isOpenPopover: false }))), onLoadMore: onLoadMore }), align: {
|
|
346
|
+
return (React.createElement(Popover, Object.assign({ open: isOpenPopover, arrow: false, placement: "bottomLeft", content: React.createElement(MatchesAny, { className: popupClassName, items: items, selectedItems: selectedItems, loading: loading, objectName: objectName, groupSelectProps: groupSelectProps, renderExtraValues: renderExtraValues, customItemRenders: customItemRenders, listEmptyProps: listEmptyProps, selectedListEmptyProps: selectedListEmptyProps, selectedTreeData: selectedTreeData, onChangeSearch: onChangeSearch, onApply: onApplyMatchesAny, onCancel: () => setState(prev => (Object.assign(Object.assign({}, prev), { isOpenPopover: false }))), onLoadMore: onLoadMore, onSelectedTreeDataChange: onSelectedTreeDataChange }), align: {
|
|
332
347
|
overflow: {
|
|
333
348
|
shiftY: 0,
|
|
334
349
|
shiftX: 0,
|
|
@@ -336,6 +351,9 @@ export function MatchesAnySelect(props) {
|
|
|
336
351
|
}, overlayStyle: { width: 700 }, overlayInnerStyle: {
|
|
337
352
|
padding: 0,
|
|
338
353
|
}, trigger: ['click'], destroyTooltipOnHide: true, onOpenChange: () => setState(prev => (Object.assign(Object.assign({}, prev), { isOpenPopover: !isOpenPopover }))), zIndex: 1400 }, popoverProps),
|
|
339
|
-
React.createElement(Tooltip, { mouseEnterDelay: 0.5, title: `${selectedItems ? selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.map(item => item.title).join(', ') : ''}
|
|
354
|
+
React.createElement(Tooltip, { mouseEnterDelay: 0.5, title: `${selectedItems ? selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.map(item => item.title).join(', ') : ''}`, overlayInnerStyle: {
|
|
355
|
+
maxHeight: 300,
|
|
356
|
+
overflow: 'auto',
|
|
357
|
+
} },
|
|
340
358
|
React.createElement(Select, Object.assign({ title: "", value: value, placeholder: placeholder, popupMatchSelectWidth: 700, dropdownStyle: Object.assign(Object.assign({}, dropdownStyle), { display: 'none', padding: 0 }), loading: loading }, restProps)))));
|
|
341
359
|
}
|
|
@@ -6,26 +6,6 @@ export const SAMPLE_DATA = [
|
|
|
6
6
|
{
|
|
7
7
|
key: '12179',
|
|
8
8
|
title: 'Untitled Project#2024-06-27 09:40:18',
|
|
9
|
-
children: [
|
|
10
|
-
{
|
|
11
|
-
key: '3j2i',
|
|
12
|
-
title: 'dsjfioasdjf',
|
|
13
|
-
children: [
|
|
14
|
-
{
|
|
15
|
-
key: '3j2323i323',
|
|
16
|
-
title: 'fewfwe',
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
key: '3j2323i',
|
|
20
|
-
title: 'me owi',
|
|
21
|
-
},
|
|
22
|
-
],
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
key: '3j2i-1',
|
|
26
|
-
title: 'dsjfioasdjf',
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
9
|
},
|
|
30
10
|
{
|
|
31
11
|
key: '11923',
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const countryItems: {
|
|
2
|
+
name: string;
|
|
3
|
+
countryId: number;
|
|
4
|
+
countryName: string;
|
|
5
|
+
provinces: {
|
|
6
|
+
provinceId: number;
|
|
7
|
+
provinceName: string;
|
|
8
|
+
}[];
|
|
9
|
+
value: string;
|
|
10
|
+
label: string;
|
|
11
|
+
title: string;
|
|
12
|
+
key: string;
|
|
13
|
+
id: number;
|
|
14
|
+
children: {
|
|
15
|
+
provinceId: number;
|
|
16
|
+
provinceName: string;
|
|
17
|
+
key: string;
|
|
18
|
+
title: string;
|
|
19
|
+
value: string;
|
|
20
|
+
}[];
|
|
21
|
+
}[];
|