@unicom-cloud/ui 0.8.106 → 0.8.108
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/App.js +7 -0
- package/BackTop.js +2 -4
- package/Calendar.js +2 -2
- package/ColorPicker.js +15 -14
- package/Constant.js +4 -0
- package/Copy.js +4 -3
- package/Countdown.js +25 -0
- package/Grid.js +8 -10
- package/LiquidFill.js +4 -3
- package/List.js +7 -6
- package/Marquee.js +4 -3
- package/Modal.js +4 -2
- package/PageHeader.js +3 -2
- package/QrCode.js +4 -3
- package/RowCol.js +8 -0
- package/Segmented.js +14 -4
- package/Statistic.js +5 -4
- package/Tour.js +4 -3
- package/Transfer.js +4 -2
- package/anchor/Link.js +1 -1
- package/app/App.js +26 -0
- package/app/context.js +9 -0
- package/app/index.js +9 -0
- package/app/interface.js +1 -0
- package/app/useApp.js +8 -0
- package/avatar/Group.js +1 -1
- package/back-top/index.js +44 -56
- package/button/index.js +52 -51
- package/calendar/Lunar.js +71 -0
- package/calendar/index.js +11 -11
- package/cascader/base/node.js +22 -20
- package/cascader/base/store.js +10 -10
- package/cascader/util.js +29 -27
- package/color-picker/Mode.js +8 -7
- package/color-picker/hooks/useColorPicker.js +56 -55
- package/color-picker/index.js +49 -48
- package/color-picker/utils.js +58 -57
- package/components/common/empty/index.js +2 -2
- package/components/common/flex/index.js +64 -55
- package/components/common/flex/interface.js +6 -6
- package/components/common/hooks/useInterval.js +6 -6
- package/components/common/icons/file/index.js +13 -11
- package/components/common/space/index.js +53 -53
- package/components/common/utils/dayjs.js +114 -126
- package/components/common/utils/is.js +98 -104
- package/components/common/utils/setDir.js +12 -0
- package/components/common/utils/setTheme.js +13 -13
- package/components/common/utils/toArray.js +7 -5
- package/config-provider/ConfigProvider.js +32 -30
- package/constant/index.js +4 -0
- package/copy/index.js +2 -1
- package/countdown/index.js +113 -0
- package/countdown/interface.js +1 -0
- package/countdown/util.js +29 -0
- package/descriptions/index.js +45 -45
- package/divider/index.js +28 -20
- package/dropdown/Button.js +1 -1
- package/empty/index.js +1 -1
- package/flex/index.js +30 -29
- package/form/FormItem.js +126 -122
- package/grid/Grid.js +56 -90
- package/grid/Item.js +44 -65
- package/grid/context.js +2 -6
- package/grid/index.js +6 -8
- package/grid/util.js +6 -44
- package/hooks/useResponsiveState.js +54 -0
- package/index.js +614 -605
- package/input/Button.js +12 -12
- package/input/Group.js +11 -12
- package/input/Input.js +112 -102
- package/input/InputElement.js +25 -24
- package/input/Search.js +24 -24
- package/layout/Sider.js +1 -1
- package/liquid-fill/index.js +4 -3
- package/list/Item.js +21 -21
- package/list/index.js +53 -52
- package/marquee/index.js +20 -19
- package/marquee-/index.js +4 -3
- package/mentions/util.js +9 -8
- package/modal/Confirm.js +17 -17
- package/modal/Modal.js +247 -237
- package/modal/index.js +4 -2
- package/modal/use-modal/index.js +2 -2
- package/package.json +1 -1
- package/page-header/index.js +57 -56
- package/pagination/Pagination.js +89 -92
- package/qr-code/index.js +4 -3
- package/radio/Group.js +1 -1
- package/row-col/Col-.js +88 -0
- package/row-col/Col.js +159 -0
- package/row-col/Row.js +73 -0
- package/row-col/context.js +5 -0
- package/row-col/index.js +11 -0
- package/row-col/interface.js +1 -0
- package/segmented/index.js +257 -206
- package/select/Select.js +191 -191
- package/select/util.js +50 -50
- package/select-view/Core.js +31 -28
- package/space/index.js +15 -13
- package/splitter/SplitBar.js +44 -46
- package/statistic/index.js +56 -55
- package/statistic/interface.js +4 -1
- package/style.css +1 -1
- package/table/Table.js +198 -210
- package/table/hook/useColumns.js +27 -26
- package/table/hook/useStickyClassNames.js +9 -8
- package/table/hook/useThResizable.js +4 -3
- package/table/th-resizable/index.js +2 -2
- package/table/thead/index.js +18 -16
- package/time-picker/util.js +20 -30
- package/timeline/Item.js +1 -1
- package/tour/index.js +4 -3
- package/transfer/index.js +93 -91
- package/trigger/index.js +66 -66
- package/types/common/development/interface.d.ts +3 -3
- package/types/common/flex/index.d.ts +3 -9
- package/types/common/flex/interface.d.ts +15 -4
- package/types/common/space/index.d.ts +3 -5
- package/types/common/space/interface.d.ts +2 -0
- package/types/common/utils/dayjs.d.ts +3 -1
- package/types/common/utils/is.d.ts +3 -4
- package/types/common/utils/setDir.d.ts +2 -0
- package/types/pc/app/App.d.ts +6 -0
- package/types/pc/app/context.d.ts +4 -0
- package/types/pc/app/index.d.ts +5 -0
- package/types/pc/app/interface.d.ts +17 -0
- package/types/pc/app/useApp.d.ts +3 -0
- package/types/pc/back-top/interface.d.ts +4 -17
- package/types/pc/button/interface.d.ts +2 -2
- package/types/pc/calendar/Lunar.d.ts +17 -0
- package/types/pc/calendar/index.d.ts +1 -1
- package/types/pc/config-provider/interface.d.ts +17 -12
- package/types/pc/constant/index.d.ts +1 -0
- package/types/pc/countdown/interface.d.ts +65 -0
- package/types/pc/countdown/util.d.ts +7 -0
- package/types/pc/divider/interface.d.ts +1 -0
- package/types/pc/flex/index.d.ts +8 -6
- package/types/pc/flex/interface.d.ts +3 -10
- package/types/pc/form/FormItem.d.ts +1 -1
- package/types/pc/form/interface.d.ts +1 -1
- package/types/pc/grid/Grid.d.ts +2 -4
- package/types/pc/grid/Item.d.ts +1 -5
- package/types/pc/grid/context.d.ts +4 -15
- package/types/pc/grid/index.d.ts +4 -6
- package/types/pc/grid/interface.d.ts +14 -142
- package/types/pc/grid/util.d.ts +1 -10
- package/types/pc/hooks/useResponsiveState.d.ts +3 -0
- package/types/pc/index.d.ts +10 -4
- package/types/pc/input/Button.d.ts +2 -2
- package/types/pc/list/interface.d.ts +2 -1
- package/types/pc/message/index.d.ts +1 -9
- package/types/pc/message/interface.d.ts +8 -0
- package/types/pc/message/useMessage.d.ts +1 -2
- package/types/pc/modal/Modal.d.ts +1 -0
- package/types/pc/modal/config.d.ts +1 -2
- package/types/pc/modal/index.d.ts +2 -1
- package/types/pc/modal/interface.d.ts +17 -5
- package/types/pc/notification/index.d.ts +2 -9
- package/types/pc/notification/interface.d.ts +7 -0
- package/types/pc/notification/useNotification.d.ts +1 -2
- package/types/pc/pagination/PageOption.d.ts +0 -1
- package/types/pc/pagination/interface.d.ts +5 -6
- package/types/pc/{grid → row-col}/Col-.d.ts +1 -1
- package/types/pc/{grid → row-col}/Col.d.ts +1 -2
- package/types/pc/{grid → row-col}/Row.d.ts +1 -2
- package/types/pc/row-col/context.d.ts +6 -0
- package/types/pc/row-col/index.d.ts +7 -0
- package/types/pc/row-col/interface.d.ts +112 -0
- package/types/pc/segmented/index.d.ts +3 -7
- package/types/pc/segmented/interface.d.ts +38 -5
- package/types/pc/select-view/Core.d.ts +1 -8
- package/types/pc/select-view/index.d.ts +1 -8
- package/types/pc/select-view/interface.d.ts +9 -2
- package/types/pc/space/index.d.ts +5 -7
- package/types/pc/space/interface.d.ts +3 -10
- package/types/pc/statistic/index.d.ts +1 -1
- package/types/pc/statistic/interface.d.ts +1 -49
- package/types/pc/utils/is.d.ts +1 -1
- package/types/pc/utils/names.d.ts +422 -111
- package/types/pc/utils/responsiveObserve.d.ts +8 -8
- package/typography/Ellipsis.js +5 -4
- package/typography/Operations.js +4 -3
- package/utils/dayjs.js +13 -11
- package/utils/index.js +245 -244
- package/utils/is.js +65 -66
- package/utils/names.js +309 -150
- package/utils/responsiveObserve.js +43 -36
- package/version/index.js +1 -1
- package/grid/Col-.js +0 -86
- package/grid/Col.js +0 -169
- package/grid/Row.js +0 -96
- package/grid/hook/useResponsiveState.js +0 -38
- package/statistic/Countdown.js +0 -56
- package/statistic/util.js +0 -33
- package/types/pc/grid/hook/useResponsiveState.d.ts +0 -2
- package/types/pc/statistic/util.d.ts +0 -1
- /package/types/pc/{statistic/Countdown.d.ts → countdown/index.d.ts} +0 -0
package/select/Select.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
1
|
+
import { jsx as E, jsxs as ct } from "react/jsx-runtime";
|
|
2
|
+
import m from "lodash/isArray";
|
|
3
3
|
import ft from "lodash/isFunction";
|
|
4
|
-
import dt, { useContext as mt, useState as j, useMemo as
|
|
4
|
+
import dt, { useContext as mt, useState as j, useMemo as Pe, useRef as b, useCallback as ne, useEffect as V, useImperativeHandle as gt } from "react";
|
|
5
5
|
import ht from "../checkbox/Checkbox.js";
|
|
6
6
|
import "../checkbox/Group.js";
|
|
7
7
|
import "../config-provider/ConfigProvider.js";
|
|
8
8
|
import Ct from "../components/common/hooks/useId.js";
|
|
9
9
|
import Ot from "../components/common/hooks/useMergeProps.js";
|
|
10
|
-
import
|
|
10
|
+
import Ie from "../components/common/hooks/useMergeValue.js";
|
|
11
11
|
import vt from "../select-view/index.js";
|
|
12
12
|
import bt from "../trigger/index.js";
|
|
13
|
-
import
|
|
14
|
-
import { getHotkeyHandler as
|
|
13
|
+
import oe from "@unicom-cloud/utils/class-name";
|
|
14
|
+
import { getHotkeyHandler as Vt } from "../components/common/utils/getHotkeyHandler.js";
|
|
15
15
|
import "../components/common/utils/is.js";
|
|
16
|
-
import { Esc as
|
|
16
|
+
import { Esc as yt, Enter as _e, Tab as Ee, ArrowUp as wt, ArrowDown as kt } from "@unicom-cloud/utils/constant/keyboardCode";
|
|
17
17
|
import { omit as xt } from "../components/common/utils/omit.js";
|
|
18
18
|
import { resizeObserver as St } from "../components/common/utils/resizeObserver.js";
|
|
19
|
-
import { warning as
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import { getValidValue as
|
|
19
|
+
import { warning as Pt } from "../components/common/utils/warning.js";
|
|
20
|
+
import It from "../virtual-list/VirtualList.js";
|
|
21
|
+
import _t from "./OptGroup.js";
|
|
22
|
+
import Et from "./Option.js";
|
|
23
|
+
import { getValidValue as Me, flatChildren as Mt, isEmpty as re, preventDefaultEvent as At, isSelectOptGroup as Ft, isSelectOption as Lt } from "./util.js";
|
|
24
24
|
import Nt from "../config-provider/context.js";
|
|
25
|
-
import { isPlainObject as
|
|
26
|
-
const
|
|
25
|
+
import { isPlainObject as O } from "@unicom-cloud/utils/is";
|
|
26
|
+
const Ae = "userCreatingOption", Tt = {
|
|
27
27
|
trigger: "click",
|
|
28
28
|
bordered: !0,
|
|
29
29
|
filterOption: !0,
|
|
@@ -71,172 +71,172 @@ function Dt(Fe, Le) {
|
|
|
71
71
|
onKeyDown: Ze
|
|
72
72
|
} = a;
|
|
73
73
|
let { mode: q, allowCheckAll: Oe, allowCreate: c } = a;
|
|
74
|
-
q === "tags" && (q = "multiple", c = !0,
|
|
74
|
+
q === "tags" && (q = "multiple", c = !0, Pt(
|
|
75
75
|
!0,
|
|
76
76
|
`[Pqb Select] The 'tags' mode will be removed in the next major version, please use {mode: "multiple", allowCreate: true} instead.`
|
|
77
77
|
));
|
|
78
78
|
const f = Ne?.("select"), u = q === "multiple";
|
|
79
79
|
u || (Oe = !1);
|
|
80
80
|
const [et, z] = j(
|
|
81
|
-
|
|
82
|
-
), n = "value" in a ?
|
|
81
|
+
Me(a.defaultValue, u, U)
|
|
82
|
+
), n = "value" in a ? Me(a.value, u, U) : et, [d, tt, nt] = Ie("", {
|
|
83
83
|
value: "inputValue" in a ? a.inputValue || "" : void 0
|
|
84
|
-
}), [
|
|
84
|
+
}), [g, ot] = Ie(!1, {
|
|
85
85
|
defaultValue: a.defaultPopupVisible,
|
|
86
86
|
value: "popupVisible" in a ? a.popupVisible : y && "popupVisible" in y ? y.popupVisible : void 0
|
|
87
|
-
}), [
|
|
88
|
-
|
|
87
|
+
}), [F, rt] = j(null), [L, it] = j([]), [h, M] = j(
|
|
88
|
+
m(n) ? n[0] : n
|
|
89
89
|
), {
|
|
90
90
|
childrenList: J,
|
|
91
91
|
optionInfoMap: p,
|
|
92
|
-
optionValueList:
|
|
93
|
-
optionIndexListForArrowKey:
|
|
92
|
+
optionValueList: w,
|
|
93
|
+
optionIndexListForArrowKey: S,
|
|
94
94
|
hasOptGroup: lt,
|
|
95
95
|
hasComplexLabelInOptions: st
|
|
96
|
-
} =
|
|
96
|
+
} = Pe(() => Mt(
|
|
97
97
|
{ children: se, options: ce, filterOption: fe },
|
|
98
98
|
{
|
|
99
99
|
prefixCls: f,
|
|
100
100
|
inputValue: d,
|
|
101
|
-
userCreatedOptions:
|
|
102
|
-
userCreatingOption:
|
|
101
|
+
userCreatedOptions: L,
|
|
102
|
+
userCreatingOption: F
|
|
103
103
|
}
|
|
104
104
|
), [
|
|
105
105
|
se,
|
|
106
106
|
ce,
|
|
107
107
|
fe,
|
|
108
108
|
d,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
]), Q =
|
|
109
|
+
F,
|
|
110
|
+
L
|
|
111
|
+
]), Q = b(null), ve = b(null), v = b(null), P = b([]), k = b(null), be = b(d), X = b(null), D = b(0), Y = b(!1), Ve = Ct(`${f}-popup-`), R = re(n, u), ye = Pe(() => {
|
|
112
112
|
if (ue) {
|
|
113
|
-
const e =
|
|
114
|
-
return t && !
|
|
113
|
+
const e = m(n) ? n[0] : n, t = !R && p.get(e)?._valid, r = p?.get(w[0])?._origin === Ae;
|
|
114
|
+
return t && !r ? e : w[S[0]];
|
|
115
115
|
}
|
|
116
116
|
}, [
|
|
117
117
|
n,
|
|
118
118
|
p,
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
w,
|
|
120
|
+
S,
|
|
121
121
|
ue,
|
|
122
122
|
R
|
|
123
123
|
]), H = ne(
|
|
124
124
|
(e, t) => {
|
|
125
|
-
const
|
|
126
|
-
Q.current &&
|
|
127
|
-
key:
|
|
125
|
+
const r = p.get(e);
|
|
126
|
+
Q.current && r?.child?.props && Q.current.scrollTo({
|
|
127
|
+
key: r.child.props._key,
|
|
128
128
|
options: t
|
|
129
129
|
});
|
|
130
130
|
},
|
|
131
131
|
[p]
|
|
132
132
|
), $ = ne(
|
|
133
|
-
(e, t = !1) =>
|
|
133
|
+
(e, t = !1) => O(c) && typeof c?.formatter == "function" ? c.formatter(e, t) : e,
|
|
134
134
|
[c]
|
|
135
|
-
),
|
|
135
|
+
), I = (e, t) => {
|
|
136
136
|
(e !== be.current || t !== X.current) && (tt(e), be.current = e, X.current = t, Xe?.(e, t));
|
|
137
|
-
},
|
|
138
|
-
|
|
137
|
+
}, A = (e) => {
|
|
138
|
+
g !== e && (ot(e), Qe?.(e), y?.onVisibleChange?.(e));
|
|
139
139
|
};
|
|
140
|
-
|
|
141
|
-
u ?
|
|
142
|
-
}, [u, n]),
|
|
143
|
-
if (
|
|
144
|
-
|
|
145
|
-
const e =
|
|
140
|
+
V(() => {
|
|
141
|
+
u ? m(n) || z(n === void 0 ? [] : [n]) : m(n) && z(n.length === 0 ? void 0 : n[0]);
|
|
142
|
+
}, [u, n]), V(() => {
|
|
143
|
+
if (g) {
|
|
144
|
+
M(ye);
|
|
145
|
+
const e = m(n) ? n[0] : n;
|
|
146
146
|
!R && p.has(e) && setTimeout(() => H(e));
|
|
147
147
|
}
|
|
148
|
-
}, [
|
|
149
|
-
(
|
|
150
|
-
}, [
|
|
151
|
-
|
|
152
|
-
}, [JSON.stringify(J.map((e) => e?.props?.value))]),
|
|
153
|
-
|
|
154
|
-
}, [n, u]),
|
|
148
|
+
}, [g]), V(() => {
|
|
149
|
+
(k.current === "up" || k.current === "down") && (H(h), k.current = "none");
|
|
150
|
+
}, [h]), V(() => {
|
|
151
|
+
M(ye);
|
|
152
|
+
}, [JSON.stringify(J.map((e) => e?.props?.value))]), V(() => {
|
|
153
|
+
P.current = P.current.filter((e) => u ? m(n) && n.indexOf(e.value) > -1 : e.value === n);
|
|
154
|
+
}, [n, u]), V(() => {
|
|
155
155
|
if (c) {
|
|
156
156
|
let e;
|
|
157
|
-
if (
|
|
157
|
+
if (re(n, u))
|
|
158
158
|
e = [];
|
|
159
159
|
else {
|
|
160
|
-
const
|
|
161
|
-
const
|
|
162
|
-
return !
|
|
160
|
+
const r = m(n) ? n : [n], o = r.filter((i, l, C) => {
|
|
161
|
+
const x = p.get(i) || P.current.find((te) => te.value === i)?.option;
|
|
162
|
+
return !x || x._origin === Ae;
|
|
163
163
|
}).map((i) => $(i));
|
|
164
|
-
e =
|
|
165
|
-
const l =
|
|
166
|
-
return
|
|
164
|
+
e = L.filter((i) => {
|
|
165
|
+
const l = O(i) ? i.value : i;
|
|
166
|
+
return r.indexOf(l) !== -1;
|
|
167
167
|
}).concat(
|
|
168
|
-
|
|
168
|
+
o
|
|
169
169
|
);
|
|
170
170
|
}
|
|
171
|
-
const t = (
|
|
172
|
-
t(e) !== t(
|
|
171
|
+
const t = (r) => r.map((o) => O(o) ? o.value : o).toString();
|
|
172
|
+
t(e) !== t(L) && it(e);
|
|
173
173
|
}
|
|
174
|
-
}, [n, c, u, $]),
|
|
175
|
-
c &&
|
|
174
|
+
}, [n, c, u, $]), V(() => {
|
|
175
|
+
c && rt(
|
|
176
176
|
d && !p.has(d) ? $(d, !0) : null
|
|
177
177
|
);
|
|
178
|
-
}, [d, $]),
|
|
178
|
+
}, [d, $]), V(() => {
|
|
179
179
|
const { current: e } = X;
|
|
180
180
|
nt === d && (e === "manual" || e === "optionListHide") && Be?.(d, e);
|
|
181
181
|
}, [d]);
|
|
182
|
-
const
|
|
182
|
+
const N = ne(
|
|
183
183
|
(e) => {
|
|
184
184
|
const t = p.get(e);
|
|
185
185
|
if (t) {
|
|
186
|
-
const
|
|
186
|
+
const o = P.current.findIndex(
|
|
187
187
|
(s) => s.value === e
|
|
188
188
|
);
|
|
189
|
-
return
|
|
189
|
+
return o > -1 ? P.current.splice(o, 1, { value: e, option: t }) : P.current.push({ value: e, option: t }), t;
|
|
190
190
|
}
|
|
191
|
-
const
|
|
192
|
-
return
|
|
191
|
+
const r = P.current.find((o) => o.value === e);
|
|
192
|
+
return r && r.option;
|
|
193
193
|
},
|
|
194
194
|
[p]
|
|
195
195
|
), we = (e) => {
|
|
196
|
-
if (!
|
|
196
|
+
if (!S.length)
|
|
197
197
|
return;
|
|
198
|
-
if (
|
|
199
|
-
return
|
|
200
|
-
const
|
|
201
|
-
return
|
|
202
|
-
}, G = (e, t =
|
|
203
|
-
let
|
|
204
|
-
const
|
|
198
|
+
if (h === void 0 || !p.has(h))
|
|
199
|
+
return w[S[0]];
|
|
200
|
+
const r = p.get(h)._index, o = S.indexOf(r), s = S.length;
|
|
201
|
+
return w[S[((e === "up" ? o - 1 : o + 1) + s) % s]];
|
|
202
|
+
}, G = (e, t = re(e, u)) => {
|
|
203
|
+
let r = e;
|
|
204
|
+
const o = e === void 0 ? void 0 : m(e) ? e.map(N) : N(e);
|
|
205
205
|
if (U && !t) {
|
|
206
206
|
const s = (i, l) => {
|
|
207
207
|
if (l)
|
|
208
208
|
return l.children;
|
|
209
|
-
const
|
|
210
|
-
if (
|
|
211
|
-
for (const
|
|
212
|
-
if (
|
|
213
|
-
return
|
|
214
|
-
} else if (C
|
|
215
|
-
return
|
|
209
|
+
const C = "value" in a ? a.value : "defaultValue" in a ? a.defaultValue : null;
|
|
210
|
+
if (m(C)) {
|
|
211
|
+
for (const x of C)
|
|
212
|
+
if (O(x) && x.value === i)
|
|
213
|
+
return x.label;
|
|
214
|
+
} else if (O(C) && C.value === i)
|
|
215
|
+
return C.label;
|
|
216
216
|
};
|
|
217
|
-
|
|
217
|
+
m(e) ? r = e.map((i, l) => ({
|
|
218
218
|
value: i,
|
|
219
|
-
label: s(i,
|
|
220
|
-
})) :
|
|
219
|
+
label: s(i, o[l])
|
|
220
|
+
})) : r = {
|
|
221
221
|
value: e,
|
|
222
|
-
label: s(e,
|
|
222
|
+
label: s(e, o)
|
|
223
223
|
};
|
|
224
224
|
}
|
|
225
|
-
return { option:
|
|
226
|
-
},
|
|
225
|
+
return { option: o, value: r };
|
|
226
|
+
}, _ = (e) => {
|
|
227
227
|
if (z(e), Ce) {
|
|
228
228
|
const t = G(e);
|
|
229
229
|
Ce(t.value, t.option);
|
|
230
230
|
}
|
|
231
231
|
}, ke = (e, t) => {
|
|
232
232
|
if (t === "remove" || t === "add" && p.get(e)) {
|
|
233
|
-
const
|
|
234
|
-
if (
|
|
233
|
+
const r = t === "add" ? n.concat(e) : n.filter((s, i, l) => s !== e), o = t === "add" ? Ke : je;
|
|
234
|
+
if (_(r), typeof o == "function") {
|
|
235
235
|
const s = G(
|
|
236
236
|
e,
|
|
237
237
|
!1
|
|
238
238
|
);
|
|
239
|
-
|
|
239
|
+
o(
|
|
240
240
|
s.value,
|
|
241
241
|
s.option
|
|
242
242
|
);
|
|
@@ -246,207 +246,207 @@ function Dt(Fe, Le) {
|
|
|
246
246
|
t || (u ? (ke(
|
|
247
247
|
e,
|
|
248
248
|
n.indexOf(e) === -1 ? "add" : "remove"
|
|
249
|
-
), (!
|
|
250
|
-
|
|
249
|
+
), (!O(pe) || !pe.retainInputValueWhileSelect) && I("", "optionChecked")) : (e !== n && _(e), setTimeout(() => {
|
|
250
|
+
A(!1);
|
|
251
251
|
})));
|
|
252
|
-
}, K =
|
|
252
|
+
}, K = Vt(
|
|
253
253
|
/* @__PURE__ */ new Map([
|
|
254
|
-
[
|
|
254
|
+
[yt.key, () => A(!1)],
|
|
255
255
|
[
|
|
256
|
-
|
|
256
|
+
_e.key,
|
|
257
257
|
() => {
|
|
258
|
-
if (
|
|
259
|
-
const e = p.get(
|
|
260
|
-
e && xe(
|
|
258
|
+
if (g) {
|
|
259
|
+
const e = p.get(h);
|
|
260
|
+
e && xe(h, e.disabled);
|
|
261
261
|
} else
|
|
262
|
-
|
|
262
|
+
A(!0);
|
|
263
263
|
}
|
|
264
264
|
],
|
|
265
265
|
[
|
|
266
|
-
|
|
266
|
+
Ee.key,
|
|
267
267
|
// 按tab键切换,关闭开启的弹出框
|
|
268
|
-
() =>
|
|
268
|
+
() => A(!1)
|
|
269
269
|
],
|
|
270
270
|
[
|
|
271
271
|
wt.key,
|
|
272
272
|
() => {
|
|
273
|
-
if (
|
|
274
|
-
return
|
|
273
|
+
if (g)
|
|
274
|
+
return k.current = "up", M(we("up")), !1;
|
|
275
275
|
}
|
|
276
276
|
],
|
|
277
277
|
[
|
|
278
278
|
kt.key,
|
|
279
279
|
() => {
|
|
280
|
-
if (
|
|
281
|
-
return
|
|
280
|
+
if (g)
|
|
281
|
+
return k.current = "down", M(we("down")), !1;
|
|
282
282
|
}
|
|
283
283
|
]
|
|
284
284
|
])
|
|
285
285
|
), at = () => {
|
|
286
|
-
const e = y?.autoAlignPopupWidth === !1 && (!y?.style?.width || y?.style?.width === "auto"), t = e && st,
|
|
287
|
-
|
|
286
|
+
const e = y?.autoAlignPopupWidth === !1 && (!y?.style?.width || y?.style?.width === "auto"), t = e && st, r = "notFoundContent" in a ? He : Te("Select"), o = J.length ? /* @__PURE__ */ E(
|
|
287
|
+
It,
|
|
288
288
|
{
|
|
289
|
-
id:
|
|
289
|
+
id: Ve,
|
|
290
290
|
role: "listbox",
|
|
291
291
|
style: me,
|
|
292
|
-
className:
|
|
292
|
+
className: oe(`${f}-popup-inner`, ge),
|
|
293
293
|
ref: Q,
|
|
294
294
|
data: J,
|
|
295
295
|
height: null,
|
|
296
296
|
isStaticItemHeight: !lt,
|
|
297
297
|
measureLongestItem: e,
|
|
298
298
|
itemKey: (l) => l.props._key,
|
|
299
|
-
onMouseDown:
|
|
299
|
+
onMouseDown: At,
|
|
300
300
|
onMouseMove: () => {
|
|
301
|
-
|
|
301
|
+
k.current = null;
|
|
302
302
|
},
|
|
303
303
|
onScroll: (l) => Je?.(l.target),
|
|
304
304
|
...he,
|
|
305
305
|
threshold: t ? null : he?.threshold,
|
|
306
306
|
children: (l) => {
|
|
307
307
|
if (Ft(l))
|
|
308
|
-
return /* @__PURE__ */
|
|
308
|
+
return /* @__PURE__ */ E(l.type, { ...l.props, prefixCls: f });
|
|
309
309
|
if (Lt(l)) {
|
|
310
|
-
const
|
|
311
|
-
(
|
|
310
|
+
const C = l.props?.value, x = O(F) ? F.value : F, te = L.map(
|
|
311
|
+
(T) => O(T) ? T.value : T
|
|
312
312
|
), pt = {
|
|
313
313
|
prefixCls: f,
|
|
314
314
|
rtl: le,
|
|
315
|
-
_valueActive:
|
|
315
|
+
_valueActive: h,
|
|
316
316
|
_valueSelect: n,
|
|
317
317
|
_isMultipleMode: u,
|
|
318
|
-
_isUserCreatingOption: c &&
|
|
319
|
-
_isUserCreatedOption: c && te.indexOf(
|
|
318
|
+
_isUserCreatingOption: c && x === C,
|
|
319
|
+
_isUserCreatedOption: c && te.indexOf(C) > -1,
|
|
320
320
|
_onClick: xe,
|
|
321
|
-
_onMouseEnter: (
|
|
322
|
-
|
|
321
|
+
_onMouseEnter: (T) => {
|
|
322
|
+
k.current === null && M(T);
|
|
323
323
|
},
|
|
324
324
|
_onMouseLeave: () => {
|
|
325
|
-
|
|
325
|
+
k.current === null && M(void 0);
|
|
326
326
|
}
|
|
327
327
|
};
|
|
328
|
-
return l && /* @__PURE__ */
|
|
328
|
+
return l && /* @__PURE__ */ E(l.type, { ...l.props, ...pt });
|
|
329
329
|
}
|
|
330
330
|
return l;
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
|
-
) : null, i =
|
|
333
|
+
) : null, i = r && !(c && d) ? /* @__PURE__ */ E(
|
|
334
334
|
"div",
|
|
335
335
|
{
|
|
336
336
|
style: me,
|
|
337
|
-
className:
|
|
338
|
-
children:
|
|
337
|
+
className: oe(`${f}-popup-inner`, ge),
|
|
338
|
+
children: r
|
|
339
339
|
}
|
|
340
340
|
) : null;
|
|
341
341
|
return /* @__PURE__ */ ct(
|
|
342
342
|
"div",
|
|
343
343
|
{
|
|
344
|
-
className:
|
|
345
|
-
[`${f}-popup-hidden`]:
|
|
344
|
+
className: oe(`${f}-popup`, {
|
|
345
|
+
[`${f}-popup-hidden`]: o === null && i === null,
|
|
346
346
|
[`${f}-popup-multiple`]: u
|
|
347
347
|
}),
|
|
348
348
|
tabIndex: -1,
|
|
349
349
|
onKeyDown: (l) => K(l),
|
|
350
350
|
children: [
|
|
351
|
-
!!u && !!
|
|
352
|
-
/* @__PURE__ */
|
|
351
|
+
!!u && !!o && !!Oe && // 潘启宝添加
|
|
352
|
+
/* @__PURE__ */ E(
|
|
353
353
|
ht,
|
|
354
354
|
{
|
|
355
355
|
"aria-hidden": "true",
|
|
356
356
|
className: `${f}-checkbox ${f}-checkbox-all`,
|
|
357
|
-
checked:
|
|
358
|
-
indeterminate:
|
|
357
|
+
checked: w.length === n.length,
|
|
358
|
+
indeterminate: w.length !== n.length && n.length !== 0,
|
|
359
359
|
onChange: (l) => {
|
|
360
|
-
|
|
360
|
+
_(l ? [...w] : []);
|
|
361
361
|
},
|
|
362
362
|
children: "全选"
|
|
363
363
|
}
|
|
364
364
|
),
|
|
365
|
-
typeof de == "function" ? de(
|
|
365
|
+
typeof de == "function" ? de(o || i) : o || i
|
|
366
366
|
]
|
|
367
367
|
}
|
|
368
368
|
);
|
|
369
369
|
}, Z = (e) => {
|
|
370
|
-
if (D.current = null, u &&
|
|
370
|
+
if (D.current = null, u && m(W) && W.length) {
|
|
371
371
|
const t = e.split(new RegExp(`[${W.join("")}]`));
|
|
372
372
|
if (t.length > 1) {
|
|
373
373
|
D.current = Date.now();
|
|
374
|
-
const
|
|
374
|
+
const r = t.filter(
|
|
375
375
|
(i, l) => i && t.indexOf(i) === l
|
|
376
|
-
),
|
|
376
|
+
), o = n.slice(0);
|
|
377
377
|
let s = !1;
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
}), s &&
|
|
378
|
+
r.forEach((i, l, C) => {
|
|
379
|
+
o.indexOf(i) === -1 && (c || p.get(i)) && (o.push(i), s = !0);
|
|
380
|
+
}), s && _(o);
|
|
381
381
|
}
|
|
382
382
|
}
|
|
383
383
|
return !!D.current;
|
|
384
384
|
}, ut = {
|
|
385
385
|
onFocus: qe,
|
|
386
386
|
onBlur: (e) => {
|
|
387
|
-
ze?.(e), !
|
|
387
|
+
ze?.(e), !g && !Y.current && I("", "optionListHide");
|
|
388
388
|
},
|
|
389
389
|
onKeyDown: (e) => {
|
|
390
390
|
if (e.target.tagName === "INPUT" && e.target.value) {
|
|
391
|
-
const t = e.key ===
|
|
392
|
-
if (
|
|
393
|
-
const
|
|
391
|
+
const t = e.key === Ee.key, r = e.key === _e.key;
|
|
392
|
+
if (r || t) {
|
|
393
|
+
const o = r ? `
|
|
394
394
|
` : t ? " " : "";
|
|
395
|
-
Z(e.target.value +
|
|
395
|
+
Z(e.target.value + o) && I("", "tokenSeparator");
|
|
396
396
|
}
|
|
397
397
|
}
|
|
398
398
|
K(e), Ze?.(e);
|
|
399
399
|
},
|
|
400
400
|
onChangeInputValue: (e, { nativeEvent: { inputType: t } }) => {
|
|
401
|
-
t !== "insertFromPaste" && Z(e), D.current ?
|
|
401
|
+
t !== "insertFromPaste" && Z(e), D.current ? I("", "tokenSeparator") : I(e, "manual"), !g && e && A(!0);
|
|
402
402
|
},
|
|
403
403
|
onPaste: (e) => {
|
|
404
404
|
Z(e.clipboardData.getData("text")), Ye?.(e);
|
|
405
405
|
},
|
|
406
406
|
// Option Items
|
|
407
|
-
onRemoveCheckedItem: (e, t,
|
|
408
|
-
|
|
407
|
+
onRemoveCheckedItem: (e, t, r) => {
|
|
408
|
+
r.stopPropagation(), ke(n[t], "remove");
|
|
409
409
|
},
|
|
410
410
|
onClear: (e) => {
|
|
411
411
|
if (e.stopPropagation(), u) {
|
|
412
|
-
const t = n.filter((
|
|
413
|
-
const i = p.get(
|
|
412
|
+
const t = n.filter((r, o, s) => {
|
|
413
|
+
const i = p.get(r);
|
|
414
414
|
return i && i.disabled;
|
|
415
415
|
});
|
|
416
|
-
|
|
416
|
+
_(t);
|
|
417
417
|
} else
|
|
418
|
-
|
|
419
|
-
|
|
418
|
+
_(void 0);
|
|
419
|
+
I("", "manual"), We?.(g);
|
|
420
420
|
}
|
|
421
421
|
};
|
|
422
422
|
gt(
|
|
423
423
|
Le,
|
|
424
424
|
() => ({
|
|
425
|
-
dom:
|
|
425
|
+
dom: v.current?.dom,
|
|
426
426
|
focus() {
|
|
427
|
-
|
|
427
|
+
v.current && v.current.focus();
|
|
428
428
|
},
|
|
429
429
|
blur() {
|
|
430
|
-
|
|
430
|
+
v.current && v.current.blur();
|
|
431
431
|
},
|
|
432
432
|
hotkeyHandler: K,
|
|
433
|
-
activeOptionValue:
|
|
434
|
-
getOptionInfoByValue:
|
|
433
|
+
activeOptionValue: h,
|
|
434
|
+
getOptionInfoByValue: N,
|
|
435
435
|
getOptionInfoList: () => [...p.values()].filter((e) => e._valid),
|
|
436
436
|
scrollIntoView: H,
|
|
437
437
|
getRootDOMNode() {
|
|
438
|
-
return
|
|
438
|
+
return v.current?.getRootDOMNode?.();
|
|
439
439
|
}
|
|
440
440
|
}),
|
|
441
441
|
[
|
|
442
442
|
K,
|
|
443
443
|
p,
|
|
444
|
-
|
|
445
|
-
|
|
444
|
+
h,
|
|
445
|
+
N,
|
|
446
446
|
H
|
|
447
447
|
]
|
|
448
448
|
);
|
|
449
|
-
const Se = (e) => /* @__PURE__ */
|
|
449
|
+
const Se = (e) => /* @__PURE__ */ E(
|
|
450
450
|
bt,
|
|
451
451
|
{
|
|
452
452
|
ref: ve,
|
|
@@ -457,66 +457,66 @@ function Dt(Fe, Le) {
|
|
|
457
457
|
classNames: "slideDynamicOrigin",
|
|
458
458
|
autoAlignPopupWidth: !0,
|
|
459
459
|
popupAlign: Ut,
|
|
460
|
-
popupVisible:
|
|
460
|
+
popupVisible: g,
|
|
461
461
|
unmountOnExit: Re,
|
|
462
|
-
onVisibleChange:
|
|
462
|
+
onVisibleChange: A,
|
|
463
463
|
__onExit: () => {
|
|
464
464
|
Y.current = !0;
|
|
465
465
|
},
|
|
466
466
|
__onExited: () => {
|
|
467
|
-
Y.current = !1,
|
|
467
|
+
Y.current = !1, I("", "optionListHide");
|
|
468
468
|
},
|
|
469
469
|
...xt(y, ["popupVisible", "onVisibleChange"]),
|
|
470
470
|
children: e
|
|
471
471
|
}
|
|
472
472
|
), ee = typeof B == "function" ? B(G(n)) : B;
|
|
473
|
-
return
|
|
474
|
-
const e = St([
|
|
473
|
+
return V(() => {
|
|
474
|
+
const e = St([v.current?.dom], () => {
|
|
475
475
|
ve.current?.updatePopupPosition?.();
|
|
476
476
|
});
|
|
477
477
|
return () => {
|
|
478
478
|
e();
|
|
479
479
|
};
|
|
480
|
-
}, [
|
|
480
|
+
}, [v.current?.dom]), ee != null ? Se(ee) : /* @__PURE__ */ E(
|
|
481
481
|
vt,
|
|
482
482
|
{
|
|
483
483
|
...a,
|
|
484
484
|
...ut,
|
|
485
|
-
ref:
|
|
485
|
+
ref: v,
|
|
486
486
|
value: n,
|
|
487
487
|
inputValue: d,
|
|
488
|
-
popupVisible:
|
|
488
|
+
popupVisible: g,
|
|
489
489
|
rtl: le,
|
|
490
490
|
prefixCls: f,
|
|
491
491
|
allowCreate: !!c,
|
|
492
|
-
ariaControls:
|
|
492
|
+
ariaControls: Ve,
|
|
493
493
|
isEmptyValue: R,
|
|
494
494
|
isMultiple: u,
|
|
495
|
-
onSort:
|
|
495
|
+
onSort: _,
|
|
496
496
|
renderText: (e) => {
|
|
497
|
-
const t =
|
|
498
|
-
let
|
|
497
|
+
const t = N(e);
|
|
498
|
+
let r = e;
|
|
499
499
|
if (ft(ae)) {
|
|
500
|
-
const
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
500
|
+
const o = G(e, !1);
|
|
501
|
+
r = ae(
|
|
502
|
+
o.option || null,
|
|
503
|
+
o.value
|
|
504
504
|
);
|
|
505
505
|
} else {
|
|
506
|
-
let
|
|
506
|
+
let o = !1;
|
|
507
507
|
if (U) {
|
|
508
508
|
const s = a.value || a.defaultValue;
|
|
509
|
-
if (
|
|
509
|
+
if (m(s)) {
|
|
510
510
|
const i = s.find(
|
|
511
|
-
(l) =>
|
|
511
|
+
(l) => O(l) && l.value === e
|
|
512
512
|
);
|
|
513
|
-
i && (
|
|
514
|
-
} else
|
|
513
|
+
i && (r = i.label, o = !0);
|
|
514
|
+
} else O(s) && (r = s.label, o = !0);
|
|
515
515
|
}
|
|
516
|
-
!
|
|
516
|
+
!o && t && "children" in t && (r = t.children);
|
|
517
517
|
}
|
|
518
518
|
return {
|
|
519
|
-
text:
|
|
519
|
+
text: r,
|
|
520
520
|
disabled: t && t.disabled
|
|
521
521
|
};
|
|
522
522
|
},
|
|
@@ -526,10 +526,10 @@ function Dt(Fe, Le) {
|
|
|
526
526
|
}
|
|
527
527
|
const Rt = dt.forwardRef(Dt), ie = Rt;
|
|
528
528
|
ie.displayName = "Select";
|
|
529
|
-
ie.Option =
|
|
530
|
-
ie.OptGroup =
|
|
529
|
+
ie.Option = Et;
|
|
530
|
+
ie.OptGroup = _t;
|
|
531
531
|
export {
|
|
532
|
-
|
|
533
|
-
|
|
532
|
+
Et as SelectOption,
|
|
533
|
+
_t as SelectOptionGroup,
|
|
534
534
|
ie as default
|
|
535
535
|
};
|