@oceanbase/design 1.0.0-alpha.15 → 1.0.0-alpha.17

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.
Files changed (79) hide show
  1. package/dist/design.min.js +1 -1
  2. package/es/alert/index.d.ts +1 -1
  3. package/es/alert/index.js +4 -2
  4. package/es/filter/components/CountNumber.js +2 -1
  5. package/es/filter/components/FilterButton.d.ts +2 -0
  6. package/es/filter/components/FilterButton.js +6 -3
  7. package/es/filter/components/FilterCascader/components/CascaderOption/OptionCheckbox.d.ts +20 -0
  8. package/es/filter/components/FilterCascader/components/CascaderOption/OptionCheckbox.js +101 -0
  9. package/es/filter/components/FilterCascader/components/CascaderOption/OptionItem.d.ts +13 -0
  10. package/es/filter/components/FilterCascader/components/CascaderOption/OptionItem.js +44 -0
  11. package/es/filter/components/FilterCascader/components/FlatCascaderContent/index.d.ts +16 -0
  12. package/es/filter/components/FilterCascader/components/FlatCascaderContent/index.js +64 -0
  13. package/es/filter/components/FilterCascader/components/NormalCascaderContent.d.ts +24 -0
  14. package/es/filter/components/FilterCascader/components/NormalCascaderContent.js +284 -0
  15. package/es/filter/components/FilterCascader/constants.d.ts +7 -0
  16. package/es/filter/components/FilterCascader/constants.js +8 -0
  17. package/es/filter/components/FilterCascader/hooks/useCascaderCallbacks.d.ts +12 -0
  18. package/es/filter/components/FilterCascader/hooks/useCascaderCallbacks.js +101 -0
  19. package/es/filter/components/FilterCascader/hooks/useCascaderLabels.d.ts +9 -0
  20. package/es/filter/components/FilterCascader/hooks/useCascaderLabels.js +50 -0
  21. package/es/filter/components/FilterCascader/hooks/useNormalizedValue.d.ts +7 -0
  22. package/es/filter/components/FilterCascader/hooks/useNormalizedValue.js +53 -0
  23. package/es/filter/components/FilterCascader/index.d.ts +5 -0
  24. package/es/filter/components/FilterCascader/index.js +317 -0
  25. package/es/filter/components/FilterCascader/types.d.ts +56 -0
  26. package/es/filter/components/FilterCascader/types.js +1 -0
  27. package/es/filter/components/FilterCascader/utils/countUtils.d.ts +13 -0
  28. package/es/filter/components/FilterCascader/utils/countUtils.js +48 -0
  29. package/es/filter/components/FilterCascader/utils/pathUtils.d.ts +17 -0
  30. package/es/filter/components/FilterCascader/utils/pathUtils.js +91 -0
  31. package/es/filter/components/FilterCheckbox.js +29 -7
  32. package/es/filter/components/FilterWrap.js +30 -1
  33. package/es/filter/components/ResponsiveFilterGroup.js +252 -359
  34. package/es/filter/index.d.ts +1 -1
  35. package/es/filter/index.js +11 -7
  36. package/es/filter/style/index.js +9 -2
  37. package/es/filter/type.d.ts +5 -0
  38. package/es/table/index.d.ts +2 -2
  39. package/lib/alert/index.d.ts +1 -1
  40. package/lib/alert/index.js +3 -1
  41. package/lib/filter/components/CountNumber.js +2 -1
  42. package/lib/filter/components/FilterButton.d.ts +2 -0
  43. package/lib/filter/components/FilterButton.js +4 -2
  44. package/lib/filter/components/FilterCascader/components/CascaderOption/OptionCheckbox.d.ts +20 -0
  45. package/lib/filter/components/FilterCascader/components/CascaderOption/OptionCheckbox.js +91 -0
  46. package/lib/filter/components/FilterCascader/components/CascaderOption/OptionItem.d.ts +13 -0
  47. package/lib/filter/components/FilterCascader/components/CascaderOption/OptionItem.js +51 -0
  48. package/lib/filter/components/FilterCascader/components/FlatCascaderContent/index.d.ts +16 -0
  49. package/lib/filter/components/FilterCascader/components/FlatCascaderContent/index.js +70 -0
  50. package/lib/filter/components/FilterCascader/components/NormalCascaderContent.d.ts +24 -0
  51. package/lib/filter/components/FilterCascader/components/NormalCascaderContent.js +263 -0
  52. package/lib/filter/components/FilterCascader/constants.d.ts +7 -0
  53. package/lib/filter/components/FilterCascader/constants.js +14 -0
  54. package/lib/filter/components/FilterCascader/hooks/useCascaderCallbacks.d.ts +12 -0
  55. package/lib/filter/components/FilterCascader/hooks/useCascaderCallbacks.js +81 -0
  56. package/lib/filter/components/FilterCascader/hooks/useCascaderLabels.d.ts +9 -0
  57. package/lib/filter/components/FilterCascader/hooks/useCascaderLabels.js +56 -0
  58. package/lib/filter/components/FilterCascader/hooks/useNormalizedValue.d.ts +7 -0
  59. package/lib/filter/components/FilterCascader/hooks/useNormalizedValue.js +48 -0
  60. package/lib/filter/components/FilterCascader/index.d.ts +5 -0
  61. package/lib/filter/components/FilterCascader/index.js +298 -0
  62. package/lib/filter/components/FilterCascader/types.d.ts +56 -0
  63. package/lib/filter/components/FilterCascader/types.js +5 -0
  64. package/lib/filter/components/FilterCascader/utils/countUtils.d.ts +13 -0
  65. package/lib/filter/components/FilterCascader/utils/countUtils.js +49 -0
  66. package/lib/filter/components/FilterCascader/utils/pathUtils.d.ts +17 -0
  67. package/lib/filter/components/FilterCascader/utils/pathUtils.js +56 -0
  68. package/lib/filter/components/FilterCheckbox.js +29 -7
  69. package/lib/filter/components/FilterWrap.js +28 -1
  70. package/lib/filter/components/ResponsiveFilterGroup.js +214 -340
  71. package/lib/filter/index.d.ts +1 -1
  72. package/lib/filter/index.js +11 -7
  73. package/lib/filter/style/index.js +10 -1
  74. package/lib/filter/type.d.ts +5 -0
  75. package/package.json +3 -3
  76. package/es/filter/components/FilterCascader.d.ts +0 -31
  77. package/es/filter/components/FilterCascader.js +0 -529
  78. package/lib/filter/components/FilterCascader.d.ts +0 -31
  79. package/lib/filter/components/FilterCascader.js +0 -449
@@ -1,31 +0,0 @@
1
- import type { ReactNode } from 'react';
2
- import React from 'react';
3
- import type { BaseFilterProps, InternalFilterProps } from '../type';
4
- export interface CascaderOption {
5
- label?: ReactNode;
6
- value: string;
7
- disabled?: boolean;
8
- children?: {
9
- label?: ReactNode;
10
- value: string;
11
- disabled?: boolean;
12
- }[];
13
- }
14
- export interface FilterCascaderProps extends BaseFilterProps, InternalFilterProps {
15
- /** 是否多选 */
16
- multiple?: boolean;
17
- /** 选项列表 */
18
- options?: CascaderOption[];
19
- /** 当前选中值,格式为 [[parentValue, childValue], ...] */
20
- value?: string[][];
21
- /** 值变化回调 */
22
- onChange?: (value: string[][]) => void;
23
- /** 是否显示计数,可传入 { showTotal: true } 同时显示总数 */
24
- count?: boolean | {
25
- showTotal?: boolean;
26
- };
27
- /** 是否显示搜索框,默认为 false */
28
- showSearch?: boolean;
29
- }
30
- declare const FilterCascader: React.FC<FilterCascaderProps>;
31
- export default FilterCascader;
@@ -1,449 +0,0 @@
1
- "use strict";
2
- "use client";
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = _interopRequireWildcard(require("react"));
8
- var _antd = require("antd");
9
- var _checkbox = _interopRequireDefault(require("../../checkbox"));
10
- var _theme = _interopRequireDefault(require("../../theme"));
11
- var _input = _interopRequireDefault(require("../../input"));
12
- var _empty = _interopRequireDefault(require("../../empty"));
13
- var _icons = require("@oceanbase/icons");
14
- var _classnames = _interopRequireDefault(require("classnames"));
15
- var _useControlledState = require("../hooks/useControlledState");
16
- var _FilterContext = require("../FilterContext");
17
- var _useFilterCollapsed = require("../hooks/useFilterCollapsed");
18
- var _useFilterTooltip = require("../hooks/useFilterTooltip");
19
- var _style = _interopRequireWildcard(require("../style"));
20
- var _utils = require("../utils");
21
- var _CountNumber = _interopRequireDefault(require("./CountNumber"));
22
- var _FilterButton = _interopRequireDefault(require("./FilterButton"));
23
- var _WrappedTagsDisplay = _interopRequireDefault(require("./WrappedTagsDisplay"));
24
- var _jsxRuntime = require("react/jsx-runtime");
25
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
26
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
27
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
28
- const FilterCascader = ({
29
- options = [],
30
- value,
31
- onChange,
32
- icon,
33
- label,
34
- bordered = true,
35
- multiple = false,
36
- count = false,
37
- showSearch = false,
38
- _isCollapsed = false,
39
- ...restProps
40
- }) => {
41
- const isCollapsed = (0, _useFilterCollapsed.useFilterCollapsed)(_isCollapsed);
42
- const {
43
- prefixCls
44
- } = (0, _style.default)();
45
- const {
46
- token
47
- } = _theme.default.useToken();
48
- const filterButtonRef = (0, _react.useRef)(null);
49
- const {
50
- updateFilterValue
51
- } = (0, _FilterContext.useFilterContext)();
52
- const filterId = (0, _react.useMemo)(() => (0, _utils.generateFilterId)('cascader', label), [label]);
53
- const stableOptionsKey = (0, _react.useMemo)(() => (0, _utils.getStableOptionsKey)(options), [options]);
54
- // 用于控制二级 Popover 的打开状态(仅在单选模式下使用)
55
- const [openPopoverKey, setOpenPopoverKey] = (0, _react.useState)(null);
56
-
57
- // 搜索关键词状态
58
- const [searchKeyword, setSearchKeyword] = (0, _react.useState)('');
59
-
60
- // 从 restProps 中排除 onOpenChange,避免类型冲突
61
- const {
62
- onOpenChange: externalOnOpenChange,
63
- ...filterButtonProps
64
- } = restProps;
65
-
66
- // 解析 count 配置
67
- const showCount = !!count;
68
- const showTotal = typeof count === 'object' ? count.showTotal ?? false : false;
69
-
70
- // 使用受控状态 hook
71
- const [currentValue, setValue] = (0, _useControlledState.useControlledState)(value, [], onChange);
72
-
73
- // 获取当前选中值的 label(用于单选模式显示)
74
- const getSelectedLabel = (0, _react.useCallback)(() => {
75
- if (isCollapsed && currentValue.length === 0) {
76
- return '';
77
- }
78
- if (currentValue.length === 0) {
79
- return label;
80
- }
81
- if (!multiple && currentValue.length === 1) {
82
- const [parentValue, childValue] = currentValue[0];
83
- const parentOption = options.find(opt => opt.value === parentValue);
84
- const childOption = parentOption?.children?.find(child => child.value === childValue);
85
- return childOption?.label || label;
86
- }
87
- return label;
88
- }, [currentValue, isCollapsed, label, multiple, options]);
89
-
90
- // 获取选中值的 tags(用于多选模式 Tag 显示)
91
- const getSelectedTags = (0, _react.useCallback)(() => {
92
- return currentValue.map(([parentValue, childValue], index) => {
93
- const parentOption = options.find(opt => opt.value === parentValue);
94
- const childOption = parentOption?.children?.find(child => child.value === childValue);
95
- return {
96
- label: childOption?.label || childValue,
97
- value: `${parentValue}::${childValue}::${index}`,
98
- parentValue,
99
- childValue
100
- };
101
- });
102
- }, [currentValue, options]);
103
-
104
- // 移除某个选中的值
105
- const handleRemoveTag = (0, _react.useCallback)(tagValue => {
106
- const parts = tagValue.split('::');
107
- if (parts.length >= 2) {
108
- const [parentValue, childValue] = parts;
109
- const newValueList = currentValue.filter(item => !(item[0] === parentValue && item[1] === childValue));
110
- setValue(newValueList);
111
- }
112
- }, [currentValue, setValue]);
113
-
114
- // 使用 Tooltip hook
115
- const {
116
- onPopoverOpenChange,
117
- wrapWithTooltip
118
- } = (0, _useFilterTooltip.useFilterTooltip)({
119
- hasValue: currentValue.length > 0,
120
- label,
121
- content: currentValue.length > 0 ? getSelectedTags().map(i => i.label).join(', ') : null,
122
- disabled: isCollapsed
123
- });
124
-
125
- // 处理主弹窗状态变化
126
- const handleMainPopoverOpenChange = (0, _react.useCallback)(open => {
127
- onPopoverOpenChange(open);
128
- // 当主弹窗关闭时,同步关闭二级弹窗(单选模式)
129
- if (!open && !multiple) {
130
- setOpenPopoverKey(null);
131
- }
132
- // 弹窗关闭时清空搜索关键词
133
- if (!open) {
134
- setSearchKeyword('');
135
- }
136
- externalOnOpenChange?.(open);
137
- }, [onPopoverOpenChange, externalOnOpenChange, multiple]);
138
-
139
- // 当值变化时,更新 context 中的值
140
- (0, _react.useEffect)(() => {
141
- if (isCollapsed && updateFilterValue) {
142
- updateFilterValue(filterId, label, currentValue, options, 'cascader');
143
- }
144
- }, [isCollapsed, updateFilterValue, filterId, label, currentValue, options]);
145
- const handleChange = (0, _react.useCallback)((parentValue, childValue) => {
146
- const parentOption = options.find(opt => opt.value === parentValue);
147
- const childOption = parentOption?.children?.find(child => child.value === childValue);
148
- if (parentOption?.disabled || childOption?.disabled) {
149
- return;
150
- }
151
- if (multiple) {
152
- const existingIndex = currentValue.findIndex(item => item[0] === parentValue && item[1] === childValue);
153
- let newValueList;
154
- if (existingIndex !== -1) {
155
- newValueList = currentValue.filter((_, index) => index !== existingIndex);
156
- } else {
157
- newValueList = [...currentValue, [parentValue, childValue]];
158
- }
159
- setValue(newValueList);
160
- } else {
161
- const isCurrentSelected = currentValue.length === 1 && currentValue[0][0] === parentValue && currentValue[0][1] === childValue;
162
- let newValueList;
163
- if (isCurrentSelected) {
164
- newValueList = [];
165
- } else {
166
- newValueList = [[parentValue, childValue]];
167
- }
168
- setValue(newValueList);
169
- setOpenPopoverKey(null);
170
- setTimeout(() => {
171
- filterButtonRef.current?.closePopover();
172
- }, 0);
173
- }
174
- }, [currentValue, multiple, setValue, options]);
175
- const clearByParent = (0, _react.useCallback)(parentValue => {
176
- const newValueList = currentValue.filter(item => item[0] !== parentValue);
177
- setValue(newValueList);
178
- }, [currentValue, setValue]);
179
- const handleClear = (0, _react.useCallback)(() => {
180
- setValue([]);
181
- }, [setValue]);
182
- const selectAllChildren = (0, _react.useCallback)(option => {
183
- if (option.disabled) {
184
- return;
185
- }
186
- const otherValues = currentValue.filter(item => item[0] !== option.value);
187
-
188
- // 当搜索时,只选择当前显示的子选项(filteredOptions 中的)
189
- const childrenToSelect = option.children?.filter(child => !child.disabled) || [];
190
- const allChildValues = childrenToSelect.map(child => [option.value, child.value]);
191
- const newValueList = [...otherValues, ...allChildValues];
192
- setValue(newValueList);
193
- }, [currentValue, setValue]);
194
-
195
- // 根据搜索关键词过滤选项(同时搜索父级和子级)
196
- const filteredOptions = (0, _react.useMemo)(() => {
197
- if (!showSearch || !searchKeyword) return options;
198
- const lowerKeyword = searchKeyword.toLowerCase().trim();
199
- return options.map(option => {
200
- const parentLabel = (0, _utils.normalizeLabel)(option.label).toLowerCase();
201
- const parentMatches = parentLabel.includes(lowerKeyword);
202
-
203
- // 过滤子级选项
204
- const filteredChildren = option.children?.filter(child => {
205
- const childLabel = (0, _utils.normalizeLabel)(child.label).toLowerCase();
206
- return childLabel.includes(lowerKeyword);
207
- });
208
-
209
- // 如果父级匹配或有匹配的子级,则保留该选项
210
- if (parentMatches || filteredChildren && filteredChildren.length > 0) {
211
- return {
212
- ...option,
213
- // 如果父级不匹配但子级匹配,只显示匹配的子级
214
- children: parentMatches ? option.children : filteredChildren
215
- };
216
- }
217
- return null;
218
- }).filter(option => option !== null);
219
- }, [showSearch, searchKeyword, options]);
220
-
221
- // 渲染弹框内容
222
- const renderContent = /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
223
- style: {
224
- padding: '8px 0px',
225
- maxHeight: 300,
226
- overflowY: 'auto'
227
- },
228
- children: [showSearch && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
229
- style: {
230
- marginInline: 12,
231
- marginBottom: 8
232
- },
233
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_input.default, {
234
- placeholder: "\u641C\u7D22",
235
- prefix: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.SearchOutlined, {}),
236
- allowClear: true,
237
- value: searchKeyword,
238
- onChange: e => setSearchKeyword(e.target.value),
239
- onClick: e => e.stopPropagation()
240
- })
241
- }), filteredOptions.length === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_empty.default, {
242
- image: _empty.default.PRESENTED_IMAGE_SIMPLE,
243
- description: "\u65E0\u5339\u914D\u7ED3\u679C",
244
- style: {
245
- padding: '16px 0'
246
- }
247
- }) : filteredOptions.map(option => {
248
- const selectedChildren = currentValue.filter(item => item[0] === option.value).map(item => item[1]);
249
- const hasSelectedChildren = selectedChildren.length > 0;
250
- const allChildrenSelected = multiple && option.children && option.children.length > 0 && selectedChildren.length === option.children.length;
251
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Popover, {
252
- placement: "rightTop",
253
- trigger: 'hover',
254
- arrow: false,
255
- open: option?.disabled ? false : multiple ? undefined : openPopoverKey === option.value,
256
- onOpenChange: multiple ? undefined : open => {
257
- if (!open) {
258
- setOpenPopoverKey(null);
259
- } else {
260
- setOpenPopoverKey(option.value);
261
- }
262
- },
263
- content: option.children?.map(child => {
264
- const isSelected = selectedChildren.includes(child.value);
265
- const isChildDisabled = child.disabled || false;
266
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Flex, {
267
- gap: 8,
268
- className: (0, _style.getFilterCls)(prefixCls, 'select-option'),
269
- justify: "space-between",
270
- onClick: e => {
271
- e.stopPropagation();
272
- if (!isChildDisabled) {
273
- handleChange(option.value, child.value);
274
- }
275
- },
276
- style: {
277
- cursor: isChildDisabled ? 'not-allowed' : 'pointer',
278
- color: isChildDisabled ? token.colorTextDisabled : 'inherit'
279
- },
280
- children: multiple ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_checkbox.default, {
281
- checked: isSelected,
282
- disabled: isChildDisabled,
283
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
284
- className: (0, _style.getFilterCls)(prefixCls, 'text-ellipsis'),
285
- children: child.label
286
- })
287
- }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
288
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
289
- className: (0, _style.getFilterCls)(prefixCls, 'text-ellipsis'),
290
- children: child.label
291
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
292
- children: isSelected && /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.CheckOutlined, {
293
- style: {
294
- color: token.colorPrimary
295
- }
296
- })
297
- })]
298
- })
299
- }, child.value);
300
- }),
301
- styles: {
302
- body: {
303
- padding: 8,
304
- maxHeight: 220,
305
- maxWidth: 300,
306
- overflowY: 'auto'
307
- }
308
- },
309
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
310
- style: {
311
- padding: '0px 8px'
312
- },
313
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.Flex, {
314
- gap: 8,
315
- className: (0, _classnames.default)((0, _style.getFilterCls)(prefixCls, 'select-option'), {
316
- [(0, _style.getFilterCls)(prefixCls, 'has-selected')]: hasSelectedChildren
317
- }),
318
- justify: "space-between",
319
- align: "center",
320
- style: {
321
- cursor: option.disabled ? 'not-allowed' : 'pointer',
322
- color: option.disabled ? token.colorTextDisabled : 'inherit'
323
- },
324
- children: [multiple ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_checkbox.default, {
325
- checked: allChildrenSelected,
326
- indeterminate: hasSelectedChildren && !allChildrenSelected,
327
- disabled: option.disabled,
328
- onClick: e => e.stopPropagation(),
329
- onChange: () => {
330
- if (!option.disabled) {
331
- if (allChildrenSelected) {
332
- clearByParent(option.value);
333
- } else {
334
- selectAllChildren(option);
335
- }
336
- }
337
- },
338
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
339
- className: (0, _style.getFilterCls)(prefixCls, 'text-ellipsis'),
340
- children: option.label
341
- })
342
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
343
- className: (0, _style.getFilterCls)(prefixCls, 'text-ellipsis'),
344
- children: option.label
345
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Flex, {
346
- align: "center",
347
- gap: 4,
348
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
349
- className: (0, _style.getFilterCls)(prefixCls, 'icon-wrapper'),
350
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.RightOutlined, {
351
- className: hasSelectedChildren ? (0, _style.getFilterCls)(prefixCls, 'arrow-icon') : ''
352
- }), hasSelectedChildren && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
353
- className: (0, _style.getFilterCls)(prefixCls, 'clear-icon'),
354
- onClick: e => {
355
- e.stopPropagation();
356
- clearByParent(option.value);
357
- },
358
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.CloseOutlined, {})
359
- })]
360
- })
361
- })]
362
- })
363
- })
364
- }, option.value);
365
- })]
366
- });
367
-
368
- // Wrapped 模式
369
- if (isCollapsed) {
370
- const hasValue = currentValue.length > 0;
371
- if (multiple) {
372
- const selectedTags = getSelectedTags();
373
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
374
- style: {
375
- paddingBlock: token.paddingXXS
376
- },
377
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
378
- style: {
379
- marginBottom: 8
380
- },
381
- children: label
382
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FilterButton.default, {
383
- ref: filterButtonRef,
384
- icon: icon,
385
- label: label,
386
- bordered: bordered,
387
- onClear: handleClear,
388
- content: renderContent,
389
- selected: hasValue,
390
- onOpenChange: handleMainPopoverOpenChange,
391
- ...filterButtonProps,
392
- style: {
393
- ...filterButtonProps?.style,
394
- paddingInline: token.paddingXXS
395
- },
396
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_WrappedTagsDisplay.default, {
397
- tags: selectedTags,
398
- onRemove: handleRemoveTag
399
- })
400
- })]
401
- });
402
- }
403
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
404
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
405
- style: {
406
- marginBottom: 8
407
- },
408
- children: label
409
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FilterButton.default, {
410
- ref: filterButtonRef,
411
- icon: icon,
412
- label: label,
413
- bordered: bordered,
414
- onClear: handleClear,
415
- content: renderContent,
416
- selected: hasValue,
417
- onOpenChange: handleMainPopoverOpenChange,
418
- ...filterButtonProps,
419
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
420
- className: (0, _style.getFilterCls)(prefixCls, 'text-ellipsis'),
421
- style: (0, _utils.getWrappedValueStyle)(hasValue),
422
- children: hasValue ? getSelectedLabel() : (0, _utils.getPlaceholder)()
423
- })
424
- })]
425
- });
426
- }
427
-
428
- // 正常模式
429
- const filterButton = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_FilterButton.default, {
430
- ref: filterButtonRef,
431
- icon: icon,
432
- label: label,
433
- bordered: bordered,
434
- onClear: handleClear,
435
- content: renderContent,
436
- selected: !!currentValue.length,
437
- onOpenChange: handleMainPopoverOpenChange,
438
- ...filterButtonProps,
439
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
440
- className: (0, _style.getFilterCls)(prefixCls, 'text-ellipsis'),
441
- children: getSelectedLabel()
442
- }), multiple && showCount && currentValue.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CountNumber.default, {
443
- count: currentValue.length,
444
- total: showTotal ? options.reduce((acc, curr) => acc + (curr.children?.length || 0), 0) : 0
445
- })]
446
- });
447
- return wrapWithTooltip(filterButton);
448
- };
449
- var _default = exports.default = FilterCascader;