@unicom-cloud/ui 0.8.75 → 0.8.77
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/Affix.js +1 -1
- package/Alert.js +1 -1
- package/AutoComplete.js +3 -5
- package/BackTop.js +1 -1
- package/Badge.js +1 -1
- package/Breadcrumb.js +2 -2
- package/Button.js +1 -1
- package/Calendar.js +3 -3
- package/Card.js +1 -1
- package/Carousel.js +1 -1
- package/Cascader.js +1 -1
- package/Checkbox.js +6 -2
- package/Collapse.js +1 -1
- package/ColorPicker.js +3 -4
- package/Comment.js +1 -1
- package/ConfigProvider.js +2 -3
- package/Copy.js +1 -1
- package/DatePicker.js +1 -1
- package/Descriptions.js +1 -1
- package/Divider.js +1 -1
- package/Draggable.js +1 -1
- package/Dropdown.js +1 -1
- package/Empty.js +1 -1
- package/Icon.js +1 -1
- package/IconHover.js +1 -1
- package/Image.js +1 -1
- package/InputNumber.js +1 -1
- package/Layout.js +1 -1
- package/Link.js +1 -1
- package/List.js +5 -6
- package/Mentions.js +3 -4
- package/Menu.js +1 -1
- package/Message.js +1 -1
- package/Modal.js +1 -1
- package/Notice.js +1 -1
- package/Notification.js +1 -1
- package/OverflowEllipsis.js +1 -1
- package/PageHeader.js +1 -1
- package/Pagination.js +2 -2
- package/Popconfirm.js +1 -1
- package/Popover.js +1 -1
- package/Progress.js +1 -1
- package/Radio.js +5 -4
- package/Rate.js +1 -1
- package/ResizeBox.js +1 -1
- package/Result.js +1 -1
- package/Select.js +5 -6
- package/Skeleton.js +1 -1
- package/Slider.js +1 -1
- package/Space.js +1 -1
- package/SpeechSynthesis.js +4 -3
- package/Spin.js +1 -1
- package/Statistic.js +1 -1
- package/Steps.js +1 -1
- package/Switch.js +1 -1
- package/Table.js +15 -16
- package/Tabs.js +1 -1
- package/Tag.js +1 -1
- package/Tooltip.js +2 -2
- package/Transfer.js +3 -4
- package/Tree.js +2 -3
- package/TreeSelect.js +3 -3
- package/Trigger.js +1 -1
- package/Typography.js +3 -3
- package/affix/index.js +86 -82
- package/alert/index.js +1 -1
- package/anchor/Anchor.js +1 -1
- package/anchor/Link.js +1 -1
- package/auto-complete/index.js +13 -147
- package/avatar/Avatar.js +1 -1
- package/avatar/Group.js +1 -1
- package/back-top/index.js +1 -1
- package/badge/index.js +1 -1
- package/breadcrumb/index.js +2 -2
- package/button/Group.js +1 -1
- package/button/index.js +1 -1
- package/calendar/index.js +12 -318
- package/card/Grid.js +1 -1
- package/card/Meta.js +1 -1
- package/card/index.js +1 -1
- package/carousel/Arrow.js +1 -1
- package/carousel/Indicator.js +1 -1
- package/carousel/index.js +1 -1
- package/cascader/Cascader.js +4 -4
- package/cascader/index.js +1 -1
- package/cascader/util.js +8 -8
- package/checkbox/Checkbox.js +7 -4
- package/checkbox/Group.js +5 -5
- package/checkbox/GroupBlock.js +8 -0
- package/checkbox/index.js +7 -2
- package/chunk/{BbqvFW5R.js → 9TSjT7x_.js} +112 -112
- package/chunk/ATwvJ8j2.js +6 -0
- package/chunk/{Dv6USvVF.js → BC5fEyWK.js} +2 -1
- package/chunk/{WVoGhvMI.js → BPQXH_5i.js} +32 -31
- package/chunk/{BPD5iNdA.js → CB4jGw4K.js} +22 -18
- package/chunk/{B8hkFIar.js → CBgu99gQ.js} +1 -1
- package/chunk/CBzE-PUr.js +23 -0
- package/chunk/CNcLypMY.js +723 -0
- package/chunk/{CPlPBkN7.js → C_4I3haT.js} +1 -1
- package/chunk/{0mWCmQHr.js → CjqvxJml.js} +2 -2
- package/chunk/Cwm8LL5p.js +7818 -0
- package/chunk/D0ZWT7db.js +5 -0
- package/chunk/{CWlklVfi.js → tpmioyz1.js} +1 -1
- package/collapse/Collapse.js +2 -2
- package/collapse/Item.js +2 -2
- package/collapse/index.js +1 -1
- package/color-picker/ControlBar.js +1 -1
- package/color-picker/InputAlpha.js +1 -1
- package/color-picker/InputHex.js +2 -2
- package/color-picker/InputRgb.js +2 -2
- package/color-picker/Palette.js +2 -2
- package/color-picker/Panel.js +15 -266
- package/color-picker/colors.js +4 -4
- package/color-picker/index.js +13 -268
- package/color-picker/utils.js +1 -1
- package/comment/index.js +1 -1
- package/config-provider/ConfigProvider.js +4 -6
- package/config-provider/context.js +3 -2
- package/config-provider/index.js +4 -5
- package/copy/index.js +1 -1
- package/date-picker/Picker.js +1 -1
- package/date-picker/PickerRange.js +2 -2
- package/date-picker/index.js +1 -1
- package/descriptions/index.js +1 -1
- package/divider/index.js +1 -1
- package/draggable/index.js +1 -1
- package/drawer/Drawer.js +30 -21
- package/dropdown/Button.js +1 -1
- package/dropdown/index.js +1 -1
- package/empty/index.js +1 -1
- package/form/Form.js +10 -10
- package/form/FormItem.js +1 -1
- package/form/context.js +1 -1
- package/grid/Col.js +1 -1
- package/grid/Row.js +1 -1
- package/grid/grid-item.js +1 -1
- package/grid/grid.js +1 -1
- package/hooks/index.js +1 -1
- package/hooks/useWindowSize.js +1 -1
- package/icon/index.js +1 -1
- package/icon-hover/index.js +1 -1
- package/image/Image.js +2 -2
- package/image/ImagePreview.js +2 -2
- package/image/ImagePreviewArrow.js +1 -1
- package/image/ImagePreviewGroup.js +1 -1
- package/image/index.js +1 -1
- package/index.js +453 -463
- package/input/Group.js +1 -1
- package/input/Input.js +1 -1
- package/input/InputElement.js +1 -1
- package/input/Password.js +1 -1
- package/input/Search.js +1 -1
- package/input/Textarea.js +1 -1
- package/input-number/index.js +1 -1
- package/input-tag/InputTag.js +1 -1
- package/layout/Content.js +1 -1
- package/layout/Footer.js +1 -1
- package/layout/Header.js +1 -1
- package/layout/Sider.js +1 -1
- package/layout/index.js +1 -1
- package/link/index.js +1 -1
- package/list/Item.js +1 -1
- package/list/Meta.js +1 -1
- package/list/index.js +17 -267
- package/mentions/index.js +11 -144
- package/menu/Menu.js +2 -2
- package/menu/OverflowWrap.js +1 -1
- package/menu/index.js +2 -2
- package/message/index.js +1 -1
- package/message/useMessage.js +1 -1
- package/modal/Confirm.js +2 -2
- package/modal/Modal.js +2 -2
- package/modal/index.js +1 -1
- package/notice/index.js +1 -1
- package/notification/index.js +1 -1
- package/notification/useNotification.js +1 -1
- package/overflow-ellipsis/OverflowItem.js +1 -1
- package/overflow-ellipsis/index.js +1 -1
- package/package.json +1 -1
- package/page-header/index.js +1 -1
- package/pagination/PageItem.js +1 -1
- package/pagination/PageJumper.js +1 -1
- package/pagination/PageOption.js +5 -45
- package/pagination/Pagination.js +11 -243
- package/pagination/index.js +2 -2
- package/picker/Input.js +1 -1
- package/picker/InputRange.js +1 -1
- package/popconfirm/index.js +1 -1
- package/popover/index.js +1 -1
- package/progress/index.js +1 -1
- package/radio/Group.js +5 -5
- package/radio/GroupBlock.js +9 -0
- package/radio/Radio.js +6 -5
- package/radio/index.js +4 -3
- package/rate/index.js +1 -1
- package/resize-box/ResizeTrigger.js +1 -1
- package/resize-box/Split.js +1 -1
- package/resize-box/SplitGroup.js +1 -1
- package/resize-box/index.js +1 -1
- package/result/index.js +1 -1
- package/select/Option.js +6 -93
- package/select/Select.js +23 -546
- package/select/index.js +3 -3
- package/select/util.js +18 -139
- package/select-view/Core.js +1 -1
- package/skeleton/index.js +1 -1
- package/slider/Button.js +1 -1
- package/slider/index.js +1 -1
- package/space/index.js +1 -1
- package/speech-synthesis/index.js +4 -3
- package/spin/DotLoading.js +1 -1
- package/spin/index.js +1 -1
- package/statistic/Countdown.js +1 -1
- package/statistic/index.js +1 -1
- package/steps/index.js +1 -1
- package/style/variables.less +0 -484
- package/style.css +1 -1
- package/switch/index.js +1 -1
- package/table/Table.js +2 -3
- package/table/index.js +15 -109
- package/tabs/Tab.js +2 -2
- package/tabs/TabContent.js +2 -2
- package/tabs/TabPane.js +1 -1
- package/tabs/index.js +2 -2
- package/tag/index.js +1 -1
- package/time-picker/Picker.js +1 -1
- package/time-picker/TimePicker.js +1 -1
- package/timeline/Item.js +1 -1
- package/timeline/Timeline.js +1 -1
- package/tooltip/index.js +2 -2
- package/transfer/Item.js +9 -104
- package/transfer/List.js +13 -184
- package/transfer/index.js +13 -180
- package/tree/Animation.js +2 -2
- package/tree/Node.js +3 -4
- package/tree/NodeList.js +6 -80
- package/tree/Tree.js +17 -578
- package/tree/index.js +2 -3
- package/tree-select/List.js +6 -122
- package/tree-select/Select.js +22 -392
- package/tree-select/index.js +3 -3
- package/trigger/index.js +1 -1
- package/types/checkbox/Checkbox.d.ts +5 -2
- package/types/checkbox/GroupBlock.d.ts +7 -0
- package/types/checkbox/index.d.ts +2 -1
- package/types/config-provider/ConfigProvider.d.ts +0 -27
- package/types/config-provider/interface.d.ts +3 -1
- package/types/index.d.ts +2 -2
- package/types/menu/context.d.ts +1 -1
- package/types/radio/GroupBlock.d.ts +7 -0
- package/types/radio/Radio.d.ts +5 -3
- package/types/utils/constant.d.ts +2 -1
- package/types/utils/index.d.ts +1 -0
- package/types/utils/setDarkTheme.d.ts +2 -3
- package/types/utils/setPrimaryColor.d.ts +2 -0
- package/typography/Base.js +1 -1
- package/typography/Ellipsis.js +9 -22
- package/typography/Paragraph.js +1 -1
- package/typography/Typography.js +1 -1
- package/typography/index.js +10 -276
- package/upload/TriggerNode.js +1 -1
- package/upload/Upload.js +1 -1
- package/upload/Uploader.js +43 -44
- package/upload/request.js +1 -1
- package/upload/request_.js +1 -1
- package/utils/caseName.js +1 -1
- package/utils/color.js +1 -1
- package/utils/constant.js +7 -5
- package/utils/contextHolder.js +1 -1
- package/utils/dom.js +1 -1
- package/utils/index.js +199 -195
- package/utils/setDarkTheme.js +34 -5
- package/utils/setPrimaryColor.js +26 -0
- package/utils/tinycolor.js +1 -1
- package/verification-code/VerificationCode.js +1 -1
- package/version/index.js +1 -1
- package/watermark/Watermark.js +1 -1
- package/chunk/BViFMHr-.js +0 -1820
- package/chunk/BsWphzcT.js +0 -20
- package/chunk/BxZ39GzB.js +0 -209
- package/chunk/C9XYyypq.js +0 -713
- package/chunk/CIkPwQlq.js +0 -6
- package/chunk/DFcz9ZPP.js +0 -1020
- package/chunk/DeCsZrXb.js +0 -310
- package/chunk/DskaI8QL.js +0 -25
- package/chunk/EL5Jmjgr.js +0 -170
package/chunk/DFcz9ZPP.js
DELETED
|
@@ -1,1020 +0,0 @@
|
|
|
1
|
-
var He = Object.defineProperty;
|
|
2
|
-
var Be = (t, e, n) => e in t ? He(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
-
var d = (t, e, n) => Be(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
-
import { jsxs as X, Fragment as ne, jsx as p } from "react/jsx-runtime";
|
|
5
|
-
import je from "@unicom-cloud/icons/IconUiCheck";
|
|
6
|
-
import Ue from "@unicom-cloud/icons/IconUiLeft";
|
|
7
|
-
import We from "@unicom-cloud/icons/IconUiLoading";
|
|
8
|
-
import Ke from "@unicom-cloud/icons/IconUiRight";
|
|
9
|
-
import { g as ze, y as qe } from "./C0pRaDCf.js";
|
|
10
|
-
import _e from "lodash/isArray";
|
|
11
|
-
import W from "lodash/isFunction";
|
|
12
|
-
import oe from "lodash/isPlainObject";
|
|
13
|
-
import Y from "lodash/isString";
|
|
14
|
-
import Je, { useRef as z, useState as le, useCallback as se, useEffect as Z, forwardRef as Ge, useContext as Qe, useImperativeHandle as Xe } from "react";
|
|
15
|
-
import { a as Ye } from "./C9XYyypq.js";
|
|
16
|
-
import { u as ue } from "./CQ_WOOmf.js";
|
|
17
|
-
import { u as Ze } from "./B4YRLi8r.js";
|
|
18
|
-
import { u as et } from "./BFTV6myl.js";
|
|
19
|
-
import { u as ve } from "./DeV0v__J.js";
|
|
20
|
-
import { u as re } from "./a3hR6zLw.js";
|
|
21
|
-
import tt from "../select-view/index.js";
|
|
22
|
-
import nt from "../trigger/index.js";
|
|
23
|
-
import { p as q } from "./CUFsOxJ2.js";
|
|
24
|
-
import { e as he, y as rt, n as lt, d as we, r as ae, o as fe, c as st } from "./BrOW642m.js";
|
|
25
|
-
import { b as at } from "./BJ9_azwQ.js";
|
|
26
|
-
import me from "lodash/isEqualWith";
|
|
27
|
-
import ee from "lodash/get";
|
|
28
|
-
import { p as it } from "./Coz3rCng.js";
|
|
29
|
-
import { C as Oe } from "./BxZ39GzB.js";
|
|
30
|
-
import { u as ct } from "./oopARUrq.js";
|
|
31
|
-
import { on as Le, off as de } from "../utils/dom.js";
|
|
32
|
-
import "./DAAff-FT.js";
|
|
33
|
-
import Pe from "../virtual-list/VirtualList.js";
|
|
34
|
-
import xe from "lodash/isPlainObject.js";
|
|
35
|
-
import { u as ot } from "./Bg3uJGPu.js";
|
|
36
|
-
import { P as dt } from "./BpYX5PN4.js";
|
|
37
|
-
function ut(t, e) {
|
|
38
|
-
const n = z(null), l = ue();
|
|
39
|
-
return n.current || (n.current = t()), re(() => {
|
|
40
|
-
n.current = t(), l();
|
|
41
|
-
}, [...e]), n.current;
|
|
42
|
-
}
|
|
43
|
-
class ge {
|
|
44
|
-
constructor(e, n, l) {
|
|
45
|
-
d(this, "value");
|
|
46
|
-
d(this, "label");
|
|
47
|
-
// 是否禁用
|
|
48
|
-
d(this, "disabled");
|
|
49
|
-
d(this, "_level");
|
|
50
|
-
d(this, "_index");
|
|
51
|
-
d(this, "isLeaf");
|
|
52
|
-
d(this, "disableCheckbox");
|
|
53
|
-
// 是否选中
|
|
54
|
-
d(this, "_checked");
|
|
55
|
-
/** 是否半选 */
|
|
56
|
-
d(this, "_halfChecked");
|
|
57
|
-
/** 当前选项节点的父节点 */
|
|
58
|
-
d(this, "parent");
|
|
59
|
-
/** 当前选项节点路径的所有节点的值 */
|
|
60
|
-
d(this, "pathValue", []);
|
|
61
|
-
d(this, "pathLabel", []);
|
|
62
|
-
/** 下一级选项 */
|
|
63
|
-
d(this, "children");
|
|
64
|
-
/** 是否在加载中 */
|
|
65
|
-
d(this, "loading");
|
|
66
|
-
/** 是否加载完成 */
|
|
67
|
-
d(this, "loaded");
|
|
68
|
-
d(this, "config", {});
|
|
69
|
-
// 保存暴露给外部的属性
|
|
70
|
-
d(this, "_data");
|
|
71
|
-
d(this, "_initNode", (e, n = null) => {
|
|
72
|
-
const { showEmptyChildren: l, lazyload: a } = this.config, c = { ...Ae, ...this.config.fieldNames }, r = ee(e, c.children) || e[c.children];
|
|
73
|
-
let C = Array.isArray(r) ? l ? !1 : r.length === 0 : !0;
|
|
74
|
-
a && (c.isLeaf in e ? C = !!ee(e, c.isLeaf) || !!e[c.isLeaf] : C = !1);
|
|
75
|
-
const O = ee(e, c.value) || e[c.value], I = ee(e, c.label) || e[c.label], k = {
|
|
76
|
-
...e,
|
|
77
|
-
value: O,
|
|
78
|
-
label: I,
|
|
79
|
-
isLeaf: C,
|
|
80
|
-
loading: !1,
|
|
81
|
-
loaded: !1,
|
|
82
|
-
disabled: n && n.disabled || ee(e, c.disabled) || e[c.disabled],
|
|
83
|
-
parent: n,
|
|
84
|
-
pathValue: n ? [...n.pathValue, O] : [O],
|
|
85
|
-
pathLabel: n ? [...n.pathLabel, I] : [I],
|
|
86
|
-
_level: n ? n._level + 1 : 0,
|
|
87
|
-
_checked: !1,
|
|
88
|
-
_halfChecked: !1
|
|
89
|
-
};
|
|
90
|
-
this._data = {
|
|
91
|
-
...k,
|
|
92
|
-
parent: k.parent && k.parent._data
|
|
93
|
-
}, Object.keys(k).forEach((x) => {
|
|
94
|
-
this[x] = k[x];
|
|
95
|
-
}), r && r.length && (this.children = r.map((x, N) => new ge({ ...x, _index: N }, this.config, this)), this._data.children = this.children.map((x) => x._data));
|
|
96
|
-
});
|
|
97
|
-
/**
|
|
98
|
-
* 根据this.children 计算是否当前node半选状态
|
|
99
|
-
* 假设半选是 0.5,全选是1,不选是0。
|
|
100
|
-
* 那么只有当前节点的所有children加起来等于children.length,才是全选,否则和大于0,就是半选。
|
|
101
|
-
*/
|
|
102
|
-
d(this, "_isHalfChecked", () => {
|
|
103
|
-
const e = this.children.reduce((n, l) => {
|
|
104
|
-
const a = l._halfChecked ? 0.5 : l._checked ? 1 : 0;
|
|
105
|
-
return n + a;
|
|
106
|
-
}, 0);
|
|
107
|
-
return e !== this.children.length && e > 0;
|
|
108
|
-
});
|
|
109
|
-
/**
|
|
110
|
-
*
|
|
111
|
-
* @param checked 选中状态
|
|
112
|
-
* @param ignoreDisabled 是否忽略节点禁用设置选中状态,一般在初始化设置选中状态时传参为true
|
|
113
|
-
*/
|
|
114
|
-
d(this, "_setNodeChildrenChecked", (e, n) => {
|
|
115
|
-
!n && this.disabled || this.children && this.children.length && (this.children.forEach((l) => {
|
|
116
|
-
l.disabled ? n && l.setCheckedStateIgnoreDisabled(e) : l.setCheckedState(e);
|
|
117
|
-
}), this.updateHalfState(e));
|
|
118
|
-
});
|
|
119
|
-
d(this, "getSelfChildrenValue", () => {
|
|
120
|
-
const e = [], n = (l, a) => {
|
|
121
|
-
if (!a || !a.length) {
|
|
122
|
-
e.push(l);
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
(a || []).forEach((c) => {
|
|
126
|
-
n(c.pathValue, c.children);
|
|
127
|
-
});
|
|
128
|
-
};
|
|
129
|
-
return n(this.pathValue, this.children), e;
|
|
130
|
-
});
|
|
131
|
-
d(this, "updateHalfState", (e) => {
|
|
132
|
-
this._halfChecked = this._isHalfChecked(), this._checked = this._halfChecked ? !1 : e;
|
|
133
|
-
});
|
|
134
|
-
// 直接设置选中状态
|
|
135
|
-
d(this, "setCheckedProperty", (e) => {
|
|
136
|
-
this._checked = e, this._halfChecked = !1;
|
|
137
|
-
});
|
|
138
|
-
// 设置当前节点选中状态
|
|
139
|
-
d(this, "setCheckedState", (e) => {
|
|
140
|
-
const n = e ? this._checked : !this._checked && !this._halfChecked;
|
|
141
|
-
if (!(this.disabled || n) && (this.setCheckedProperty(e), !this.config.changeOnSelect)) {
|
|
142
|
-
this._setNodeChildrenChecked(e);
|
|
143
|
-
let l = this.parent;
|
|
144
|
-
for (; l && !l.disabled; )
|
|
145
|
-
l.updateHalfState(e), l = l.parent;
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
// 忽略禁用设置选中状态
|
|
149
|
-
d(this, "setCheckedStateIgnoreDisabled", (e) => {
|
|
150
|
-
if (e !== !!this._checked && (this.setCheckedProperty(e), !this.config.changeOnSelect)) {
|
|
151
|
-
this._setNodeChildrenChecked(e, !0);
|
|
152
|
-
let n = this.parent;
|
|
153
|
-
for (; n; )
|
|
154
|
-
n.updateHalfState(e), n = n.parent;
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
/**
|
|
158
|
-
* 遍历节点的parent,获取当前节点的路径节点。
|
|
159
|
-
* node: { label: '1-1-1', parent: { label: '1-1', parent: { label: '1' }, ... }, ...}
|
|
160
|
-
* @return [node.parent.parent, node.parent, node]
|
|
161
|
-
* @memberof Store
|
|
162
|
-
*/
|
|
163
|
-
d(this, "getPathNodes", () => {
|
|
164
|
-
const e = [this];
|
|
165
|
-
let n = this.parent;
|
|
166
|
-
for (; n; )
|
|
167
|
-
e.unshift(n), n = n.parent;
|
|
168
|
-
return e;
|
|
169
|
-
});
|
|
170
|
-
d(this, "getChildren", () => this.children);
|
|
171
|
-
d(this, "setLoading", (e) => {
|
|
172
|
-
this.loading = e, (e || e === void 0) && (this.loaded = !1), e === !1 && (this.loaded = !0);
|
|
173
|
-
});
|
|
174
|
-
this.config = n || {}, this._initNode(e, l || null);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
class ht {
|
|
178
|
-
constructor(e, n, l) {
|
|
179
|
-
d(this, "nodes", []);
|
|
180
|
-
d(this, "flatNodes", []);
|
|
181
|
-
d(this, "config", {});
|
|
182
|
-
// 初始化节点状态,附加状态信息字段: _checked,_halfChecked,parent,disabled
|
|
183
|
-
d(this, "_calcNodes", (e, n) => e ? e.map((l, a) => new ge({ ...l, _index: a }, this.config, n)) : []);
|
|
184
|
-
// this.flatNodes 保存所有可能的选中项
|
|
185
|
-
d(this, "_updateFlatNodes", () => {
|
|
186
|
-
const e = !this.config.changeOnSelect;
|
|
187
|
-
this.flatNodes = [];
|
|
188
|
-
const n = (l) => {
|
|
189
|
-
l && ((!e || l.isLeaf) && this.flatNodes.push(l), _e(l.children) && l.children.forEach((a) => {
|
|
190
|
-
n(a);
|
|
191
|
-
}));
|
|
192
|
-
};
|
|
193
|
-
this.nodes.forEach((l) => {
|
|
194
|
-
n(l);
|
|
195
|
-
});
|
|
196
|
-
});
|
|
197
|
-
/**
|
|
198
|
-
* values: 全部的选中值
|
|
199
|
-
* 根据values更新节点状态。不包含在values的节点都设置为未选中状态
|
|
200
|
-
* @memberof Store
|
|
201
|
-
*/
|
|
202
|
-
d(this, "setNodeCheckedByValue", (e) => {
|
|
203
|
-
const n = ie(e);
|
|
204
|
-
this.flatNodes.forEach((l) => {
|
|
205
|
-
let a = !1;
|
|
206
|
-
this.config.showParent ? l.pathValue.some(
|
|
207
|
-
(c, r, C) => J(n, C.slice(0, r + 1))
|
|
208
|
-
) && (a = !0) : J(n, l.pathValue) && (a = !0), l.setCheckedStateIgnoreDisabled(a);
|
|
209
|
-
});
|
|
210
|
-
});
|
|
211
|
-
/**
|
|
212
|
-
* 为当前节点插入子节点。动态加载时候用到
|
|
213
|
-
*/
|
|
214
|
-
d(this, "appendOptionChildren", (e, n) => {
|
|
215
|
-
if (n && e) {
|
|
216
|
-
const l = this._calcNodes(n, e);
|
|
217
|
-
e.children = l, this._updateFlatNodes(), this.config.changeOnSelect || e.setCheckedState(!1);
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
/**
|
|
221
|
-
* 通过 value 查找对应的node节点。
|
|
222
|
-
* value: 是路径节点的value组成的数组
|
|
223
|
-
*/
|
|
224
|
-
d(this, "findNodeByValue", (e) => {
|
|
225
|
-
let n = null;
|
|
226
|
-
return !e || !e.length || this.flatNodes.some((l) => {
|
|
227
|
-
me(l.pathValue, e) && (n = l);
|
|
228
|
-
}), n;
|
|
229
|
-
});
|
|
230
|
-
/**
|
|
231
|
-
* 搜索所有label含有关键字的节点
|
|
232
|
-
*/
|
|
233
|
-
d(this, "searchNodeByLabel", (e) => {
|
|
234
|
-
if (!e)
|
|
235
|
-
return this.flatNodes;
|
|
236
|
-
const { filterOption: n } = this.config, l = W(n) ? n : (a, c) => Y(c.label) && c.label.indexOf(a) > -1;
|
|
237
|
-
return this.flatNodes.filter((a) => a.getPathNodes().some((r) => l(e, r._data)));
|
|
238
|
-
});
|
|
239
|
-
/** 获取所有节点 */
|
|
240
|
-
d(this, "getOptions", () => this.nodes);
|
|
241
|
-
/** 获取所有选中状态的节点。 aggregation: 是否聚合节点 */
|
|
242
|
-
d(this, "getCheckedNodes", () => this.config.showParent ? this.getCheckedParentNodes() : this.flatNodes.filter((e) => e._checked));
|
|
243
|
-
// 按照父节点纬度聚合当前所有选中节点。
|
|
244
|
-
d(this, "getCheckedParentNodes", () => {
|
|
245
|
-
const e = /* @__PURE__ */ new Set();
|
|
246
|
-
return this.flatNodes.forEach((n) => {
|
|
247
|
-
n._checked && n.getPathNodes().some((a) => {
|
|
248
|
-
if (a._checked)
|
|
249
|
-
return e.has(a) || e.add(a), !0;
|
|
250
|
-
});
|
|
251
|
-
}), Array.from(e);
|
|
252
|
-
});
|
|
253
|
-
this.config = { ...l };
|
|
254
|
-
const a = Array.isArray(n) ? n : [];
|
|
255
|
-
this.nodes = this._calcNodes(e, null), this._updateFlatNodes(), this.setNodeCheckedByValue(a);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
const G = "__pqb_cascader__", ft = "parent", mt = "child", ye = {
|
|
259
|
-
cascader: "cascader",
|
|
260
|
-
select: "select"
|
|
261
|
-
};
|
|
262
|
-
function Ee(t) {
|
|
263
|
-
return {
|
|
264
|
-
showEmptyChildren: t.showEmptyChildren,
|
|
265
|
-
changeOnSelect: t.changeOnSelect,
|
|
266
|
-
lazyload: !!t.loadMore,
|
|
267
|
-
fieldNames: t.fieldNames,
|
|
268
|
-
filterOption: t.filterOption,
|
|
269
|
-
showParent: t.mode === "multiple" && !t.changeOnSelect && t.checkedStrategy === ft
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
function gt(t, e) {
|
|
273
|
-
const n = e ? Array.isArray(e[0]) ? e : [e] : [];
|
|
274
|
-
return new ht(t.options || [], n, Ee(t));
|
|
275
|
-
}
|
|
276
|
-
const ie = (t) => (t || []).reduce((l, a) => (l.add([].concat(a).join(G)), l), /* @__PURE__ */ new Set()), J = (t, e) => {
|
|
277
|
-
const n = e || [];
|
|
278
|
-
return t.has(n.join(G));
|
|
279
|
-
}, pt = (t, e) => {
|
|
280
|
-
const n = e || [];
|
|
281
|
-
return t.delete(n.join(G));
|
|
282
|
-
}, te = (t, e, n) => {
|
|
283
|
-
let l = [];
|
|
284
|
-
if (t === void 0 ? l = [] : e ? l = t : l = [t], n && n.config.showParent) {
|
|
285
|
-
const a = n.getCheckedNodes(), c = ie(
|
|
286
|
-
a.map((O) => O.pathValue)
|
|
287
|
-
), r = [], C = {};
|
|
288
|
-
return l.map((O) => {
|
|
289
|
-
O.some((I, k, x) => {
|
|
290
|
-
const N = x.slice(0, k + 1), E = J(c, N);
|
|
291
|
-
return E && !C[N.join(G)] && (r.push(N), C[N.join(G)] = 1), E;
|
|
292
|
-
});
|
|
293
|
-
}), r;
|
|
294
|
-
}
|
|
295
|
-
return l;
|
|
296
|
-
}, Ct = (t) => {
|
|
297
|
-
const e = (n) => Array.isArray(n) ? n.every((l) => l._checked || l.disabled ? !0 : e(l.children)) : !1;
|
|
298
|
-
return t._halfChecked && e(t == null ? void 0 : t.children);
|
|
299
|
-
}, Me = (t, e, n, l) => {
|
|
300
|
-
const a = l && Ct(n) ? !1 : l, c = e.getCheckedNodes().reduce((k, x) => (k.add(x.pathValue.join(G)), k), /* @__PURE__ */ new Set());
|
|
301
|
-
n.setCheckedState(a);
|
|
302
|
-
const C = e.getCheckedNodes().map((k) => k.pathValue), O = ie(C), I = /* @__PURE__ */ new Set();
|
|
303
|
-
return t.filter((k) => {
|
|
304
|
-
if (!J(c, k) || J(O, k))
|
|
305
|
-
return I.add(k.join(G)), !0;
|
|
306
|
-
}).concat(
|
|
307
|
-
C.filter((k) => !J(I, k))
|
|
308
|
-
);
|
|
309
|
-
}, kt = (t) => {
|
|
310
|
-
const { prefixCls: e, multiple: n, option: l, renderOption: a, selected: c, icons: r } = t, C = l.disabled || n && l.disableCheckbox;
|
|
311
|
-
return /* @__PURE__ */ X(ne, { children: [
|
|
312
|
-
n ? /* @__PURE__ */ p(
|
|
313
|
-
Oe,
|
|
314
|
-
{
|
|
315
|
-
disabled: C,
|
|
316
|
-
checked: l._checked,
|
|
317
|
-
indeterminate: l._halfChecked,
|
|
318
|
-
onChange: t.onMultipleChecked,
|
|
319
|
-
value: l.value
|
|
320
|
-
}
|
|
321
|
-
) : "",
|
|
322
|
-
/* @__PURE__ */ X(
|
|
323
|
-
"div",
|
|
324
|
-
{
|
|
325
|
-
className: `${e}-list-item-label`,
|
|
326
|
-
onClick: l.disabled ? void 0 : t.onClickOption,
|
|
327
|
-
onMouseEnter: t.onMouseEnter,
|
|
328
|
-
onDoubleClick: C ? void 0 : t.onDoubleClickOption,
|
|
329
|
-
children: [
|
|
330
|
-
a ? a() : l.label,
|
|
331
|
-
l.isLeaf ? c && r.checked : l.loading ? r.loading : r.next
|
|
332
|
-
]
|
|
333
|
-
}
|
|
334
|
-
)
|
|
335
|
-
] });
|
|
336
|
-
}, bt = (t) => {
|
|
337
|
-
for (let e = 0; e < t.length; e++)
|
|
338
|
-
if (!t[e].disabled)
|
|
339
|
-
return t[e];
|
|
340
|
-
}, Ne = (t) => {
|
|
341
|
-
if (t && t.disabled) {
|
|
342
|
-
let e = t;
|
|
343
|
-
for (; e.parent && e.parent.disabled; )
|
|
344
|
-
e = e.parent;
|
|
345
|
-
return e;
|
|
346
|
-
}
|
|
347
|
-
return t;
|
|
348
|
-
}, Ve = (t, e) => t < 0 ? e : t > e ? 0 : t, vt = (t) => {
|
|
349
|
-
var M;
|
|
350
|
-
const [e, n] = ot(), l = ue(), {
|
|
351
|
-
store: a,
|
|
352
|
-
prefixCls: c,
|
|
353
|
-
value: r,
|
|
354
|
-
multiple: C,
|
|
355
|
-
renderFooter: O,
|
|
356
|
-
renderOption: I,
|
|
357
|
-
showEmptyChildren: k,
|
|
358
|
-
loadMore: x,
|
|
359
|
-
renderEmpty: N,
|
|
360
|
-
rtl: E,
|
|
361
|
-
icons: T
|
|
362
|
-
} = t, [h, V] = le(
|
|
363
|
-
a.findNodeByValue(r && r[r.length - 1]) || null
|
|
364
|
-
), L = a.getOptions(), j = (s) => {
|
|
365
|
-
var u;
|
|
366
|
-
(u = t.onChange) == null || u.call(t, s);
|
|
367
|
-
}, S = async (s) => {
|
|
368
|
-
if (!s.isLeaf && W(x) && !s.children) {
|
|
369
|
-
s.setLoading(!0), l();
|
|
370
|
-
try {
|
|
371
|
-
const u = await x(
|
|
372
|
-
s.pathValue,
|
|
373
|
-
s.pathValue.length
|
|
374
|
-
);
|
|
375
|
-
a.appendOptionChildren(s, u), a.setNodeCheckedByValue(t.value);
|
|
376
|
-
} catch (u) {
|
|
377
|
-
console.error(u);
|
|
378
|
-
}
|
|
379
|
-
s.setLoading(!1), l();
|
|
380
|
-
}
|
|
381
|
-
}, f = async (s, u = !0) => {
|
|
382
|
-
!s || s.disabled || (V(s), S(s), !C && u && (t.changeOnSelect || s.isLeaf) && j([s.pathValue]));
|
|
383
|
-
}, P = (s, u) => {
|
|
384
|
-
const g = Me(t.value, a, s, u);
|
|
385
|
-
s === h && l(), V(s), t.changeOnSelect || S(s), j(g);
|
|
386
|
-
}, w = se(
|
|
387
|
-
(s = h) => {
|
|
388
|
-
var g;
|
|
389
|
-
let u = s;
|
|
390
|
-
for (; u; )
|
|
391
|
-
(g = e[u._level]) == null || g.scrollTo({
|
|
392
|
-
index: u._index,
|
|
393
|
-
options: { block: "nearest" }
|
|
394
|
-
}), u = u._level < 1 ? null : u.parent;
|
|
395
|
-
},
|
|
396
|
-
[h]
|
|
397
|
-
), b = se(
|
|
398
|
-
(s) => {
|
|
399
|
-
var o;
|
|
400
|
-
const u = s.key;
|
|
401
|
-
let g;
|
|
402
|
-
switch (u) {
|
|
403
|
-
case fe.key: {
|
|
404
|
-
s.preventDefault(), (o = t.onEsc) == null || o.call(t);
|
|
405
|
-
break;
|
|
406
|
-
}
|
|
407
|
-
case ae.key:
|
|
408
|
-
case we.key: {
|
|
409
|
-
if (!h)
|
|
410
|
-
g = bt(L);
|
|
411
|
-
else {
|
|
412
|
-
const A = Ne(h), U = A.parent && A.parent.children || L, F = u === ae.key ? 1 : -1;
|
|
413
|
-
let K = Ve(
|
|
414
|
-
A._index + F,
|
|
415
|
-
U.length - 1
|
|
416
|
-
);
|
|
417
|
-
for (; K !== A._index && (g = U[K], g.disabled); )
|
|
418
|
-
K = Ve(K + F, U.length - 1);
|
|
419
|
-
}
|
|
420
|
-
return w(g), f(g, !1), s.preventDefault(), !1;
|
|
421
|
-
}
|
|
422
|
-
case lt.key:
|
|
423
|
-
return h && !h.disabled && (g = (h.children || [])[0] || h, f(g, !1)), s.preventDefault(), !1;
|
|
424
|
-
case rt.key: {
|
|
425
|
-
if (h) {
|
|
426
|
-
const A = Ne(h);
|
|
427
|
-
g = A.parent || A;
|
|
428
|
-
}
|
|
429
|
-
return f(g, !1), s.preventDefault(), !1;
|
|
430
|
-
}
|
|
431
|
-
case he.key:
|
|
432
|
-
return h && (C ? P(h, !h._checked) : f(h)), s.preventDefault(), !1;
|
|
433
|
-
}
|
|
434
|
-
},
|
|
435
|
-
[h]
|
|
436
|
-
);
|
|
437
|
-
re(() => {
|
|
438
|
-
V((s) => {
|
|
439
|
-
let u;
|
|
440
|
-
if (s && s.pathValue && s.pathValue.length) {
|
|
441
|
-
const g = s.pathValue;
|
|
442
|
-
let o = { children: L };
|
|
443
|
-
g.map((A) => {
|
|
444
|
-
const F = (o.children || []).find((K) => K.value === A);
|
|
445
|
-
F && (o = F, u = F);
|
|
446
|
-
});
|
|
447
|
-
}
|
|
448
|
-
return u;
|
|
449
|
-
});
|
|
450
|
-
}, [a]), Z(() => {
|
|
451
|
-
t.popupVisible && L.length && setTimeout(w);
|
|
452
|
-
}, [t.popupVisible]), Z(() => {
|
|
453
|
-
const s = t.getTriggerElement();
|
|
454
|
-
if (s)
|
|
455
|
-
return t.popupVisible ? Le(s, "keydown", b) : de(s, "keydown", b), () => {
|
|
456
|
-
de(s, "keydown", b);
|
|
457
|
-
};
|
|
458
|
-
}, [t.popupVisible, b]);
|
|
459
|
-
const $ = (() => {
|
|
460
|
-
const s = [L];
|
|
461
|
-
return (h ? h.getPathNodes() : []).forEach((g) => {
|
|
462
|
-
g && g.children && s.push(g.children);
|
|
463
|
-
}), s;
|
|
464
|
-
})(), _ = W(t.dropdownColumnRender) ? t.dropdownColumnRender : (s) => s;
|
|
465
|
-
return !$.length || !((M = $[0]) != null && M.length) ? /* @__PURE__ */ p(ne, { children: N() }) : /* @__PURE__ */ p(at, { component: Je.Fragment, children: $.map((s, u) => {
|
|
466
|
-
const g = O ? O(u, h || null) : null;
|
|
467
|
-
return s.length === 0 && !k ? null : /* @__PURE__ */ p(
|
|
468
|
-
dt,
|
|
469
|
-
{
|
|
470
|
-
timeout: {
|
|
471
|
-
enter: 300,
|
|
472
|
-
exit: 0
|
|
473
|
-
},
|
|
474
|
-
classNames: "cascaderSlide",
|
|
475
|
-
onEnter: (o) => {
|
|
476
|
-
o && (o.style.marginLeft = `-${o.scrollWidth}px`);
|
|
477
|
-
},
|
|
478
|
-
onEntering: (o) => {
|
|
479
|
-
o && (o.style.marginLeft = "0px");
|
|
480
|
-
},
|
|
481
|
-
onEntered: (o) => {
|
|
482
|
-
o && (o.style.marginLeft = "");
|
|
483
|
-
},
|
|
484
|
-
children: /* @__PURE__ */ p(
|
|
485
|
-
"div",
|
|
486
|
-
{
|
|
487
|
-
className: q(`${c}-list-column`, {
|
|
488
|
-
[`${c}-list-column-virtual`]: t.virtualListProps && t.virtualListProps.threshold !== null,
|
|
489
|
-
[`${c}-list-column-rtl`]: E
|
|
490
|
-
}),
|
|
491
|
-
style: {
|
|
492
|
-
zIndex: $.length - u,
|
|
493
|
-
...t.dropdownMenuColumnStyle
|
|
494
|
-
},
|
|
495
|
-
children: _(
|
|
496
|
-
/* @__PURE__ */ X(
|
|
497
|
-
"div",
|
|
498
|
-
{
|
|
499
|
-
className: q(`${c}-list-wrapper`, {
|
|
500
|
-
[`${c}-list-wrapper-with-footer`]: g !== null
|
|
501
|
-
}),
|
|
502
|
-
children: [
|
|
503
|
-
s.length === 0 ? N == null ? void 0 : N(t.virtualListProps ? "100%" : 120) : /* @__PURE__ */ p(
|
|
504
|
-
Pe,
|
|
505
|
-
{
|
|
506
|
-
needFiller: !1,
|
|
507
|
-
threshold: t.virtualListProps ? 100 : null,
|
|
508
|
-
data: s,
|
|
509
|
-
isStaticItemHeight: !0,
|
|
510
|
-
itemKey: "value",
|
|
511
|
-
...xe(t.virtualListProps) ? t.virtualListProps : {},
|
|
512
|
-
wrapper: "ul",
|
|
513
|
-
role: "menu",
|
|
514
|
-
ref: (o) => n(o, u),
|
|
515
|
-
className: q(
|
|
516
|
-
`${c}-list`,
|
|
517
|
-
`${c}-list-select`,
|
|
518
|
-
{
|
|
519
|
-
[`${c}-list-multiple`]: C,
|
|
520
|
-
[`${c}-list-rtl`]: E
|
|
521
|
-
}
|
|
522
|
-
),
|
|
523
|
-
children: (o) => {
|
|
524
|
-
let A = !1;
|
|
525
|
-
return h && (A = h.pathValue[u] === o.value), /* @__PURE__ */ p(
|
|
526
|
-
"li",
|
|
527
|
-
{
|
|
528
|
-
tabIndex: 0,
|
|
529
|
-
role: "menuitem",
|
|
530
|
-
"aria-haspopup": !o.isLeaf,
|
|
531
|
-
"aria-expanded": A && !o.isLeaf,
|
|
532
|
-
"aria-disabled": o.disabled,
|
|
533
|
-
title: Y(o.label) ? o.label : void 0,
|
|
534
|
-
className: q(`${c}-list-item`, {
|
|
535
|
-
[`${c}-list-item-active`]: A,
|
|
536
|
-
[`${c}-list-item-disabled`]: o.disabled
|
|
537
|
-
}),
|
|
538
|
-
children: /* @__PURE__ */ p(
|
|
539
|
-
kt,
|
|
540
|
-
{
|
|
541
|
-
prefixCls: c,
|
|
542
|
-
rtl: E,
|
|
543
|
-
multiple: C,
|
|
544
|
-
option: o,
|
|
545
|
-
selected: !C && o.isLeaf && me(t.value, o.pathValue),
|
|
546
|
-
icons: T,
|
|
547
|
-
onMouseEnter: () => {
|
|
548
|
-
o.disabled || t.expandTrigger === "hover" && (V(o), !o.isLeaf && S(o));
|
|
549
|
-
},
|
|
550
|
-
renderOption: I && (() => I(o._data, u)),
|
|
551
|
-
onClickOption: () => {
|
|
552
|
-
o.isLeaf && C && !o.disableCheckbox ? P(o, !o._checked) : f(o);
|
|
553
|
-
},
|
|
554
|
-
onMultipleChecked: (U) => {
|
|
555
|
-
P(o, U);
|
|
556
|
-
},
|
|
557
|
-
onDoubleClickOption: t.onDoubleClickOption
|
|
558
|
-
}
|
|
559
|
-
)
|
|
560
|
-
},
|
|
561
|
-
o.value
|
|
562
|
-
);
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
),
|
|
566
|
-
g && /* @__PURE__ */ p(
|
|
567
|
-
"div",
|
|
568
|
-
{
|
|
569
|
-
className: `${c}-list-footer`,
|
|
570
|
-
onMouseDown: (o) => {
|
|
571
|
-
o.stopPropagation();
|
|
572
|
-
},
|
|
573
|
-
children: g
|
|
574
|
-
}
|
|
575
|
-
)
|
|
576
|
-
]
|
|
577
|
-
}
|
|
578
|
-
),
|
|
579
|
-
u
|
|
580
|
-
)
|
|
581
|
-
}
|
|
582
|
-
)
|
|
583
|
-
},
|
|
584
|
-
u
|
|
585
|
-
);
|
|
586
|
-
}) });
|
|
587
|
-
}, Se = (t, e) => t < 0 ? e : t > e ? 0 : t, yt = (t, e, n) => {
|
|
588
|
-
let l = e;
|
|
589
|
-
if (Y(e)) {
|
|
590
|
-
const a = e.toUpperCase().indexOf(t.toUpperCase());
|
|
591
|
-
if (a > -1) {
|
|
592
|
-
const c = e.substring(0, a + 1), r = e.substring(a + t.length);
|
|
593
|
-
l = /* @__PURE__ */ X(ne, { children: [
|
|
594
|
-
c,
|
|
595
|
-
/* @__PURE__ */ p("span", { className: `${n}-highlight`, children: e.substring(a, t.length + 1) }),
|
|
596
|
-
r
|
|
597
|
-
] });
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
return l;
|
|
601
|
-
}, Nt = (t) => {
|
|
602
|
-
const {
|
|
603
|
-
store: e,
|
|
604
|
-
prefixCls: n,
|
|
605
|
-
multiple: l,
|
|
606
|
-
onChange: a,
|
|
607
|
-
inputValue: c,
|
|
608
|
-
renderEmpty: r,
|
|
609
|
-
style: C,
|
|
610
|
-
defaultActiveFirstOption: O,
|
|
611
|
-
rtl: I,
|
|
612
|
-
icons: k
|
|
613
|
-
} = t, x = t.value || [], [N, E] = le(
|
|
614
|
-
e.searchNodeByLabel(c) || []
|
|
615
|
-
), T = z(), h = z(), V = ct(), [L, j] = le(
|
|
616
|
-
O ? 0 : -1
|
|
617
|
-
), S = (f, P, w) => {
|
|
618
|
-
if (w.stopPropagation(), !f.disabled)
|
|
619
|
-
if (l) {
|
|
620
|
-
const b = Me(
|
|
621
|
-
t.value,
|
|
622
|
-
e,
|
|
623
|
-
f,
|
|
624
|
-
P
|
|
625
|
-
);
|
|
626
|
-
a == null || a(b);
|
|
627
|
-
} else
|
|
628
|
-
a == null || a([f.pathValue]);
|
|
629
|
-
};
|
|
630
|
-
return re(() => {
|
|
631
|
-
E(e.searchNodeByLabel(c));
|
|
632
|
-
}, [c, e]), re(() => {
|
|
633
|
-
j((f) => f > N.length - 1 ? O ? 0 : -1 : f);
|
|
634
|
-
}, [N]), Z(() => {
|
|
635
|
-
const f = t.getTriggerElement();
|
|
636
|
-
if (!f)
|
|
637
|
-
return;
|
|
638
|
-
const P = (w) => {
|
|
639
|
-
var $;
|
|
640
|
-
w.stopPropagation();
|
|
641
|
-
const b = w.key;
|
|
642
|
-
switch (b) {
|
|
643
|
-
case fe.key:
|
|
644
|
-
return ($ = t.onEsc) == null || $.call(t), !1;
|
|
645
|
-
case ae.key:
|
|
646
|
-
case we.key: {
|
|
647
|
-
h.current = !0;
|
|
648
|
-
const _ = ae.key === b ? 1 : -1;
|
|
649
|
-
let M = Se(
|
|
650
|
-
L + _,
|
|
651
|
-
N.length - 1
|
|
652
|
-
);
|
|
653
|
-
for (; M !== L && N[M].disabled; )
|
|
654
|
-
M = Se(M + _, N.length - 1);
|
|
655
|
-
return j(M), !1;
|
|
656
|
-
}
|
|
657
|
-
case he.key: {
|
|
658
|
-
const _ = N[L];
|
|
659
|
-
if (_) {
|
|
660
|
-
const M = x.some((s) => me(s, _.pathValue));
|
|
661
|
-
S(_, !M, w);
|
|
662
|
-
}
|
|
663
|
-
return !1;
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
};
|
|
667
|
-
return Le(f, "keydown", P), () => {
|
|
668
|
-
de(f, "keydown", P);
|
|
669
|
-
};
|
|
670
|
-
}, [N, L, x]), Z(() => {
|
|
671
|
-
var P;
|
|
672
|
-
const f = T.current;
|
|
673
|
-
f && (h.current || V) && it(f, {
|
|
674
|
-
behavior: "auto",
|
|
675
|
-
block: "nearest",
|
|
676
|
-
scrollMode: "if-needed",
|
|
677
|
-
boundary: (P = f.parentNode) == null ? void 0 : P.parentNode
|
|
678
|
-
});
|
|
679
|
-
}, [L, N]), T.current = null, N.length ? /* @__PURE__ */ p("div", { className: `${n}-list-wrapper`, children: /* @__PURE__ */ p(
|
|
680
|
-
Pe,
|
|
681
|
-
{
|
|
682
|
-
needFiller: !1,
|
|
683
|
-
wrapper: "ul",
|
|
684
|
-
role: "menu",
|
|
685
|
-
style: C,
|
|
686
|
-
data: N,
|
|
687
|
-
isStaticItemHeight: !0,
|
|
688
|
-
threshold: t.virtualListProps ? 100 : null,
|
|
689
|
-
...xe(t.virtualListProps) ? t.virtualListProps : {},
|
|
690
|
-
onMouseMove: () => {
|
|
691
|
-
h.current = !1;
|
|
692
|
-
},
|
|
693
|
-
className: q(`${n}-list`, `${n}-list-search`, {
|
|
694
|
-
[`${n}-list-multiple`]: l,
|
|
695
|
-
[`${n}-list-rtl`]: I
|
|
696
|
-
}),
|
|
697
|
-
children: (f, P) => {
|
|
698
|
-
const w = f.getPathNodes(), b = w.map((s, u, g) => /* @__PURE__ */ X("span", { children: [
|
|
699
|
-
s.label,
|
|
700
|
-
w.length === u + 1 ? "" : " / "
|
|
701
|
-
] }, `${s.label}_${s._level}`)), $ = f._checked, _ = { checked: $ }, M = W(t.renderOption) ? t.renderOption(c, f._data, _) : yt(c, b, n);
|
|
702
|
-
return /* @__PURE__ */ p(
|
|
703
|
-
"li",
|
|
704
|
-
{
|
|
705
|
-
title: Y(M) ? M : Y(b) ? b : void 0,
|
|
706
|
-
role: "menuitem",
|
|
707
|
-
"aria-disabled": f.disabled,
|
|
708
|
-
ref: (s) => {
|
|
709
|
-
P === L && (T.current = s), $ && !T.current && (T.current = s);
|
|
710
|
-
},
|
|
711
|
-
className: q(`${n}-list-search-item`, {
|
|
712
|
-
[`${n}-list-search-item-active`]: $,
|
|
713
|
-
[`${n}-list-search-item-hover`]: P === L,
|
|
714
|
-
[`${n}-list-search-item-disabled`]: f.disabled
|
|
715
|
-
}),
|
|
716
|
-
onClick: (s) => {
|
|
717
|
-
S(f, !$, s);
|
|
718
|
-
},
|
|
719
|
-
onMouseEnter: () => {
|
|
720
|
-
!h.current && !f.disabled && j(P);
|
|
721
|
-
},
|
|
722
|
-
onMouseLeave: () => {
|
|
723
|
-
!h.current && !f.disabled && j(O ? 0 : -1);
|
|
724
|
-
},
|
|
725
|
-
children: /* @__PURE__ */ p("div", { className: `${n}-list-item-label`, children: W(t.renderOption) ? M : l ? /* @__PURE__ */ p(Oe, { checked: $, disabled: f.disabled, children: M }) : /* @__PURE__ */ X(ne, { children: [
|
|
726
|
-
M,
|
|
727
|
-
$ && /* @__PURE__ */ p("span", { className: `${n}-check-icon`, children: k.checked })
|
|
728
|
-
] }) })
|
|
729
|
-
},
|
|
730
|
-
P
|
|
731
|
-
);
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
) }) : /* @__PURE__ */ p(ne, { children: r == null ? void 0 : r() });
|
|
735
|
-
}, Ae = {
|
|
736
|
-
label: "label",
|
|
737
|
-
value: "value",
|
|
738
|
-
isLeaf: "isLeaf",
|
|
739
|
-
children: "children",
|
|
740
|
-
disabled: "disabled"
|
|
741
|
-
}, Vt = {
|
|
742
|
-
options: [],
|
|
743
|
-
bordered: !0,
|
|
744
|
-
fieldNames: Ae,
|
|
745
|
-
trigger: "click",
|
|
746
|
-
expandTrigger: "click",
|
|
747
|
-
checkedStrategy: mt,
|
|
748
|
-
defaultActiveFirstOption: !0
|
|
749
|
-
}, St = { bottom: 4 };
|
|
750
|
-
function _t(t, e) {
|
|
751
|
-
const { getPrefixCls: n, renderEmpty: l, componentConfig: a, rtl: c } = Qe(Ye), r = et(
|
|
752
|
-
t,
|
|
753
|
-
Vt,
|
|
754
|
-
a == null ? void 0 : a.Cascader
|
|
755
|
-
), {
|
|
756
|
-
disabled: C,
|
|
757
|
-
renderFormat: O,
|
|
758
|
-
getPopupContainer: I,
|
|
759
|
-
children: k,
|
|
760
|
-
triggerProps: x,
|
|
761
|
-
expandTrigger: N,
|
|
762
|
-
icons: E
|
|
763
|
-
} = r, T = {
|
|
764
|
-
loading: (E == null ? void 0 : E.loading) || /* @__PURE__ */ p(We, {}),
|
|
765
|
-
checked: (E == null ? void 0 : E.checked) || /* @__PURE__ */ p(je, {}),
|
|
766
|
-
next: (E == null ? void 0 : E.next) || (c ? /* @__PURE__ */ p(Ue, {}) : /* @__PURE__ */ p(Ke, {}))
|
|
767
|
-
}, h = n("cascader"), V = r.mode === "multiple", L = z(null), j = ue(), S = ut(() => gt(
|
|
768
|
-
r,
|
|
769
|
-
te(
|
|
770
|
-
"value" in r ? r.value : r.defaultValue,
|
|
771
|
-
V
|
|
772
|
-
)
|
|
773
|
-
), [JSON.stringify(Ee(r)), r.options]), [f, P] = le(() => "value" in r ? te(r.value, V, S) : "defaultValue" in r ? te(r.defaultValue, V, S) : []), w = "value" in r ? te(r.value, V, S) : f, [b, $] = ve(!1, {
|
|
774
|
-
value: r.popupVisible,
|
|
775
|
-
defaultValue: r.defaultPopupVisible
|
|
776
|
-
}), [_, M, s] = ve("", {
|
|
777
|
-
value: "inputValue" in r ? r.inputValue || "" : void 0
|
|
778
|
-
}), u = z(_), g = z(null), o = z(null), A = z((S == null ? void 0 : S.getCheckedNodes()) || []), U = Ze(`${h}-popup-`), F = (i, m) => {
|
|
779
|
-
var v;
|
|
780
|
-
i !== u.current && (M(i), u.current = i, g.current = m, (v = r.onInputValueChange) == null || v.call(r, i, m));
|
|
781
|
-
};
|
|
782
|
-
function K(i) {
|
|
783
|
-
return ze(i) || qe(i);
|
|
784
|
-
}
|
|
785
|
-
Z(() => {
|
|
786
|
-
var m;
|
|
787
|
-
const { current: i } = g;
|
|
788
|
-
s === _ && (i === "manual" || i === "optionListHide") && ((m = r.onSearch) == null || m.call(r, _, i)), _ !== u.current && (u.current = _);
|
|
789
|
-
}, [_]), Z(() => {
|
|
790
|
-
const i = () => {
|
|
791
|
-
clearTimeout(L.current), L.current = null;
|
|
792
|
-
};
|
|
793
|
-
return !b && _ && (L.current && i(), L.current = setTimeout(() => {
|
|
794
|
-
F("", "optionListHide"), L.current = null;
|
|
795
|
-
}, 200)), () => {
|
|
796
|
-
i();
|
|
797
|
-
};
|
|
798
|
-
}, [b]), re(() => {
|
|
799
|
-
if ("value" in r && r.value !== f) {
|
|
800
|
-
const i = te(r.value, V);
|
|
801
|
-
S.setNodeCheckedByValue(i), P(i);
|
|
802
|
-
}
|
|
803
|
-
}, [r.value, V]), Xe(e, () => o.current, []);
|
|
804
|
-
const De = (i) => {
|
|
805
|
-
A.current = Array.from(
|
|
806
|
-
new Set([].concat(i, A.current))
|
|
807
|
-
);
|
|
808
|
-
}, pe = (i) => {
|
|
809
|
-
const m = [], v = ie(i), D = (y) => {
|
|
810
|
-
y.some((R) => {
|
|
811
|
-
if (J(v, R.pathValue) && (m.push(R.getPathNodes().map((B) => B._data)), pt(v, R.pathValue)), !v.size)
|
|
812
|
-
return !0;
|
|
813
|
-
});
|
|
814
|
-
};
|
|
815
|
-
return D(S.getCheckedNodes()), v.size && D(A.current), m;
|
|
816
|
-
}, H = se(
|
|
817
|
-
(i) => {
|
|
818
|
-
var m;
|
|
819
|
-
i !== b && ((m = r.onVisibleChange) == null || m.call(r, i), "popupVisible" in r || $(i));
|
|
820
|
-
},
|
|
821
|
-
[r.onVisibleChange, b]
|
|
822
|
-
), $e = se(
|
|
823
|
-
(i) => {
|
|
824
|
-
var y;
|
|
825
|
-
const m = pe([i])[0] || [];
|
|
826
|
-
let v, D = _e(i) ? i.map((R) => String(R)) : [];
|
|
827
|
-
return m.length && (D = m.map((R) => R.label)), W(O) ? v = O(D) : D.every((R) => Y(R)) ? v = D.join(" / ") : v = D.reduce((R, B, ce) => R.concat(ce === 0 ? [B] : [" / ", B]), []), {
|
|
828
|
-
text: v || "",
|
|
829
|
-
disabled: (y = m[m.length - 1]) == null ? void 0 : y.disabled
|
|
830
|
-
};
|
|
831
|
-
},
|
|
832
|
-
[S, f, O]
|
|
833
|
-
// 这里把 stateValue 放到依赖里面,是因为当受控时props.value改变或非受控时内部stateValue改变,都会需要出发节点选中状态的更新
|
|
834
|
-
// 此时需要重新渲染已选中值的展示
|
|
835
|
-
), Q = (i, m) => {
|
|
836
|
-
var be;
|
|
837
|
-
m === "panel" && oe(r.showSearch) && !r.showSearch.retainInputValueWhileSelect && V && F("", "optionChecked");
|
|
838
|
-
const { onChange: v, changeOnSelect: D, expandTrigger: y } = r;
|
|
839
|
-
if (w === i)
|
|
840
|
-
return;
|
|
841
|
-
V || S.setNodeCheckedByValue(i), De(S.getCheckedNodes());
|
|
842
|
-
const B = pe(i), ce = V ? i : i[0], Fe = V ? B : B[0];
|
|
843
|
-
V || (_ || B[0] && ((be = B[0][B[0].length - 1]) != null && be.isLeaf) || D && y === "hover") && H(!1), "value" in r ? (S.setNodeCheckedByValue(w), j()) : P(i), v == null || v(ce, Fe, {
|
|
844
|
-
dropdownVisible: b
|
|
845
|
-
});
|
|
846
|
-
}, Ie = (i, m, v) => {
|
|
847
|
-
if (v.stopPropagation(), i.disabled)
|
|
848
|
-
return;
|
|
849
|
-
const D = w.filter((y, R) => R !== m);
|
|
850
|
-
S.setNodeCheckedByValue(D), Q(D);
|
|
851
|
-
}, Ce = (i) => {
|
|
852
|
-
const m = i || o.current && o.current.getWidth();
|
|
853
|
-
return /* @__PURE__ */ p(
|
|
854
|
-
"div",
|
|
855
|
-
{
|
|
856
|
-
className: `${h}-list-empty`,
|
|
857
|
-
style: { width: m },
|
|
858
|
-
children: r.notFoundContent || l("Cascader")
|
|
859
|
-
}
|
|
860
|
-
);
|
|
861
|
-
}, Re = () => {
|
|
862
|
-
const i = oe(r.showSearch) ? r.showSearch.panelMode : void 0, m = i === ye.select ? !0 : i === ye.cascader ? !1 : !W(r.onSearch) && !!_, v = o.current && o.current.getWidth(), D = W(r.dropdownRender) ? r.dropdownRender : (y) => y;
|
|
863
|
-
return /* @__PURE__ */ p(
|
|
864
|
-
"div",
|
|
865
|
-
{
|
|
866
|
-
id: U,
|
|
867
|
-
className: q(`${h}-popup`, r.dropdownMenuClassName, {
|
|
868
|
-
[`${h}-popup-trigger-hover`]: r.expandTrigger === "hover"
|
|
869
|
-
}),
|
|
870
|
-
children: D(
|
|
871
|
-
/* @__PURE__ */ p(
|
|
872
|
-
"div",
|
|
873
|
-
{
|
|
874
|
-
className: `${h}-popup-inner`,
|
|
875
|
-
onMouseDown: (y) => y.preventDefault(),
|
|
876
|
-
children: m ? /* @__PURE__ */ p(
|
|
877
|
-
Nt,
|
|
878
|
-
{
|
|
879
|
-
style: { minWidth: v },
|
|
880
|
-
store: S,
|
|
881
|
-
inputValue: _,
|
|
882
|
-
renderEmpty: () => Ce(v),
|
|
883
|
-
multiple: V,
|
|
884
|
-
onChange: (y) => {
|
|
885
|
-
Q(y, "panel");
|
|
886
|
-
},
|
|
887
|
-
prefixCls: h,
|
|
888
|
-
rtl: c,
|
|
889
|
-
onEsc: () => {
|
|
890
|
-
H(!1);
|
|
891
|
-
},
|
|
892
|
-
renderOption: oe(r.showSearch) && r.showSearch.renderOption || void 0,
|
|
893
|
-
getTriggerElement: () => {
|
|
894
|
-
var y;
|
|
895
|
-
return (y = o.current) == null ? void 0 : y.dom;
|
|
896
|
-
},
|
|
897
|
-
value: w,
|
|
898
|
-
virtualListProps: r.virtualListProps,
|
|
899
|
-
defaultActiveFirstOption: r.defaultActiveFirstOption,
|
|
900
|
-
icons: T
|
|
901
|
-
}
|
|
902
|
-
) : /* @__PURE__ */ p(
|
|
903
|
-
vt,
|
|
904
|
-
{
|
|
905
|
-
dropdownMenuColumnStyle: r.dropdownMenuColumnStyle,
|
|
906
|
-
virtualListProps: r.virtualListProps,
|
|
907
|
-
expandTrigger: N,
|
|
908
|
-
store: S,
|
|
909
|
-
dropdownColumnRender: r.dropdownColumnRender,
|
|
910
|
-
renderOption: r.renderOption,
|
|
911
|
-
changeOnSelect: r.changeOnSelect,
|
|
912
|
-
showEmptyChildren: r.showEmptyChildren || !!r.loadMore,
|
|
913
|
-
multiple: V,
|
|
914
|
-
onChange: (y) => {
|
|
915
|
-
Q(y, "panel");
|
|
916
|
-
},
|
|
917
|
-
loadMore: r.loadMore,
|
|
918
|
-
prefixCls: h,
|
|
919
|
-
rtl: c,
|
|
920
|
-
getTriggerElement: () => {
|
|
921
|
-
var y;
|
|
922
|
-
return (y = o.current) == null ? void 0 : y.dom;
|
|
923
|
-
},
|
|
924
|
-
renderEmpty: Ce,
|
|
925
|
-
popupVisible: b,
|
|
926
|
-
value: w,
|
|
927
|
-
renderFooter: r.renderFooter,
|
|
928
|
-
icons: T,
|
|
929
|
-
onEsc: () => {
|
|
930
|
-
H(!1);
|
|
931
|
-
},
|
|
932
|
-
onDoubleClickOption: () => {
|
|
933
|
-
r.changeOnSelect && !V && H(!1);
|
|
934
|
-
}
|
|
935
|
-
}
|
|
936
|
-
)
|
|
937
|
-
}
|
|
938
|
-
)
|
|
939
|
-
)
|
|
940
|
-
}
|
|
941
|
-
);
|
|
942
|
-
}, Te = (i) => {
|
|
943
|
-
Q(i);
|
|
944
|
-
}, ke = (i) => /* @__PURE__ */ p(
|
|
945
|
-
nt,
|
|
946
|
-
{
|
|
947
|
-
popup: Re,
|
|
948
|
-
trigger: r.trigger,
|
|
949
|
-
disabled: C,
|
|
950
|
-
getPopupContainer: I,
|
|
951
|
-
position: c ? "br" : "bl",
|
|
952
|
-
classNames: "slideDynamicOrigin",
|
|
953
|
-
popupAlign: St,
|
|
954
|
-
unmountOnExit: "unmountOnExit" in r ? r.unmountOnExit : !W(r.loadMore),
|
|
955
|
-
popupVisible: b,
|
|
956
|
-
...x,
|
|
957
|
-
onVisibleChange: H,
|
|
958
|
-
children: i
|
|
959
|
-
}
|
|
960
|
-
);
|
|
961
|
-
return k ? ke(k) : /* @__PURE__ */ p(
|
|
962
|
-
tt,
|
|
963
|
-
{
|
|
964
|
-
...r,
|
|
965
|
-
ref: o,
|
|
966
|
-
ariaControls: U,
|
|
967
|
-
popupVisible: b,
|
|
968
|
-
value: V ? w : w && w[0],
|
|
969
|
-
inputValue: _,
|
|
970
|
-
rtl: c,
|
|
971
|
-
isEmptyValue: K(w),
|
|
972
|
-
prefixCls: h,
|
|
973
|
-
isMultiple: V,
|
|
974
|
-
renderText: $e,
|
|
975
|
-
onRemoveCheckedItem: Ie,
|
|
976
|
-
onSort: Te,
|
|
977
|
-
renderView: ke,
|
|
978
|
-
onClear: (i) => {
|
|
979
|
-
var m;
|
|
980
|
-
if (i.stopPropagation(), !V)
|
|
981
|
-
Q([]);
|
|
982
|
-
else {
|
|
983
|
-
const D = S.getCheckedNodes().filter((y) => y.disabled).map((y) => y.pathValue);
|
|
984
|
-
S.setNodeCheckedByValue(D), Q(D);
|
|
985
|
-
}
|
|
986
|
-
(m = r.onClear) == null || m.call(r, !!b);
|
|
987
|
-
},
|
|
988
|
-
onKeyDown: (i) => {
|
|
989
|
-
var v;
|
|
990
|
-
if (C)
|
|
991
|
-
return;
|
|
992
|
-
i.stopPropagation();
|
|
993
|
-
const m = i.key;
|
|
994
|
-
b ? (m === fe.key && (H(!1), i.preventDefault()), m === st.key && H(!1)) : m === he.key && (H(!0), i.preventDefault()), (v = r.onKeyDown) == null || v.call(r, i);
|
|
995
|
-
},
|
|
996
|
-
onChangeInputValue: (i) => {
|
|
997
|
-
F(i, "manual"), b || H(!0);
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
);
|
|
1001
|
-
}
|
|
1002
|
-
const wt = Ge(
|
|
1003
|
-
_t
|
|
1004
|
-
);
|
|
1005
|
-
wt.displayName = "Cascader";
|
|
1006
|
-
export {
|
|
1007
|
-
wt as C,
|
|
1008
|
-
Ae as D,
|
|
1009
|
-
ye as P,
|
|
1010
|
-
ft as S,
|
|
1011
|
-
G as V,
|
|
1012
|
-
mt as a,
|
|
1013
|
-
gt as b,
|
|
1014
|
-
Me as c,
|
|
1015
|
-
te as f,
|
|
1016
|
-
Ee as g,
|
|
1017
|
-
pt as r,
|
|
1018
|
-
ie as t,
|
|
1019
|
-
J as v
|
|
1020
|
-
};
|