@para-ui/core 5.0.0-beta.13 → 5.0.0-beta.14
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/codemods/modal-onCancel-to-onDismiss.js +69 -0
- package/es/Cascader/Cascader.js +188 -180
- package/es/Collapse/index.js +45 -38
- package/es/ComboSelect/index.js +297 -290
- package/es/ComboSelect/interface.d.ts +4 -1
- package/es/DatePicker/generatePicker/generateRangePicker.d.ts +0 -8
- package/es/DatePicker/generatePicker/generateRangePicker.js +76 -68
- package/es/DatePicker/generatePicker/index.d.ts +11 -4
- package/es/Modal/Confirm/index.js +81 -75
- package/es/Modal/index.d.ts +12 -1
- package/es/Modal/index.js +156 -141
- package/es/Tooltip/index.js +67 -61
- package/lib/Cascader/Cascader.js +1 -1
- package/lib/Collapse/index.js +1 -1
- package/lib/ComboSelect/index.js +1 -1
- package/lib/ComboSelect/interface.d.ts +4 -1
- package/lib/DatePicker/generatePicker/generateRangePicker.d.ts +0 -8
- package/lib/DatePicker/generatePicker/generateRangePicker.js +1 -1
- package/lib/DatePicker/generatePicker/index.d.ts +11 -4
- package/lib/Modal/Confirm/index.js +1 -1
- package/lib/Modal/index.d.ts +12 -1
- package/lib/Modal/index.js +1 -1
- package/lib/Tooltip/index.js +1 -1
- package/package.json +3 -2
package/es/ComboSelect/index.js
CHANGED
|
@@ -1,123 +1,130 @@
|
|
|
1
1
|
import { j as t } from "../_virtual/jsx-runtime.js";
|
|
2
|
-
import
|
|
3
|
-
import { Down as
|
|
4
|
-
import { Search as
|
|
5
|
-
import { Close as
|
|
6
|
-
import { CloseCircleF as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
2
|
+
import Qt, { useRef as v, useEffect as N, useState as x, useMemo as T, useImperativeHandle as Xt } from "react";
|
|
3
|
+
import { Down as Yt } from "../node_modules/@para-ui/icons/Down/index.js";
|
|
4
|
+
import { Search as Zt } from "../node_modules/@para-ui/icons/Search/index.js";
|
|
5
|
+
import { Close as st } from "../node_modules/@para-ui/icons/Close/index.js";
|
|
6
|
+
import { CloseCircleF as eo } from "../node_modules/@para-ui/icons/CloseCircleF/index.js";
|
|
7
|
+
import to from "../Table/index.js";
|
|
8
|
+
import oo from "../Tree/Tree.js";
|
|
9
9
|
import './index.css';import '../Tree/style/index.css';/* empty css */
|
|
10
|
-
import { Button as
|
|
11
|
-
import { Dropdown as
|
|
12
|
-
import { Popover as
|
|
13
|
-
import
|
|
14
|
-
import { Tooltip as
|
|
15
|
-
import
|
|
16
|
-
import { getReplaceField as
|
|
17
|
-
import { DeepClone as
|
|
18
|
-
import { ArrayToObject as
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
10
|
+
import { Button as lt } from "../Button/index.js";
|
|
11
|
+
import { Dropdown as ro } from "../Dropdown/index.js";
|
|
12
|
+
import { Popover as nt } from "../Popover/index.js";
|
|
13
|
+
import ge from "../AutoTips/index.js";
|
|
14
|
+
import { Tooltip as so } from "../Tooltip/index.js";
|
|
15
|
+
import A from "clsx";
|
|
16
|
+
import { getReplaceField as lo, isRemoteLoad as no, debounce as co, toArray as ct, closest as ao, getOverlaySize as io } from "./utils.js";
|
|
17
|
+
import { DeepClone as mo } from "@snack-kit/lib";
|
|
18
|
+
import { ArrayToObject as uo } from "../Utils/snack-kit-shims.js";
|
|
19
|
+
import fo from "../GlobalContext/index.js";
|
|
20
|
+
import po from "../Hooks/useGlobalProps.js";
|
|
21
|
+
import ho from "../GlobalContext/useFormatMessage.js";
|
|
22
|
+
import bo from "./lang/index.js";
|
|
23
|
+
import vo from "../Label/index.js";
|
|
24
|
+
import xo from "../HelperText/index.js";
|
|
25
25
|
import { $prefixCls as m } from "../GlobalContext/constant.js";
|
|
26
|
-
import { Search as
|
|
27
|
-
import { LoadingF as
|
|
26
|
+
import { Search as go } from "../Search/index.js";
|
|
27
|
+
import { LoadingF as jo } from "../node_modules/@para-ui/icons/LoadingF/index.js";
|
|
28
28
|
/* empty css */
|
|
29
|
-
const
|
|
29
|
+
const Uo = (at) => {
|
|
30
30
|
const {
|
|
31
|
-
mode:
|
|
31
|
+
mode: u = "table",
|
|
32
32
|
placeholder: je,
|
|
33
|
-
searchPlaceholder:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
33
|
+
searchPlaceholder: it,
|
|
34
|
+
maxCount: Ce,
|
|
35
|
+
overLine: I = !1,
|
|
36
|
+
disabled: ye = !1,
|
|
37
|
+
allowClear: mt = !1,
|
|
38
|
+
className: ut,
|
|
39
|
+
style: dt,
|
|
40
|
+
maxHeight: ft,
|
|
41
|
+
height: pt,
|
|
42
|
+
placement: ht = "bottomLeft",
|
|
43
|
+
popoverClassName: bt,
|
|
44
|
+
size: vt = "large",
|
|
45
|
+
popoverActions: we = null,
|
|
46
|
+
showPopoverActions: Ne = !1,
|
|
46
47
|
defaultOpen: te = !1,
|
|
47
|
-
defaultValue:
|
|
48
|
-
replaceFields:
|
|
49
|
-
outputFields:
|
|
48
|
+
defaultValue: Te,
|
|
49
|
+
replaceFields: xt = { key: "key", title: "title", children: "children" },
|
|
50
|
+
outputFields: gt = { outputKey: "key", outputTitle: "label" },
|
|
50
51
|
value: oe,
|
|
51
52
|
onClear: re,
|
|
52
|
-
onCancel:
|
|
53
|
-
onOk:
|
|
54
|
-
onClose:
|
|
55
|
-
onChange:
|
|
53
|
+
onCancel: jt,
|
|
54
|
+
onOk: Ct,
|
|
55
|
+
onClose: yt,
|
|
56
|
+
onChange: k,
|
|
56
57
|
onSearch: se,
|
|
57
|
-
refresh:
|
|
58
|
+
refresh: P,
|
|
58
59
|
TableProps: le,
|
|
59
60
|
TreeProps: M,
|
|
60
|
-
checkable:
|
|
61
|
-
url:
|
|
62
|
-
ctx:
|
|
61
|
+
checkable: a = !0,
|
|
62
|
+
url: ke,
|
|
63
|
+
ctx: Pe,
|
|
63
64
|
params: R,
|
|
64
|
-
method:
|
|
65
|
+
method: Se = "Get",
|
|
65
66
|
showSearch: H = !1,
|
|
66
|
-
realTimeSearch:
|
|
67
|
-
error:
|
|
68
|
-
hideErrorDom:
|
|
67
|
+
realTimeSearch: wt = !1,
|
|
68
|
+
error: Re = !1,
|
|
69
|
+
hideErrorDom: Nt,
|
|
69
70
|
helperText: ne,
|
|
70
|
-
paramsCallback:
|
|
71
|
-
fullPathKey:
|
|
72
|
-
fullPathRender:
|
|
71
|
+
paramsCallback: Tt,
|
|
72
|
+
fullPathKey: kt,
|
|
73
|
+
fullPathRender: $e,
|
|
73
74
|
disablePopup: f = !1,
|
|
74
75
|
tagRender: ce,
|
|
75
|
-
onTagRemove:
|
|
76
|
-
action:
|
|
77
|
-
label:
|
|
78
|
-
labelTooltip:
|
|
79
|
-
required:
|
|
80
|
-
emptyProps:
|
|
81
|
-
toggleSelectedOnSingle:
|
|
82
|
-
optionRender:
|
|
76
|
+
onTagRemove: Le,
|
|
77
|
+
action: Pt,
|
|
78
|
+
label: Me = "",
|
|
79
|
+
labelTooltip: St,
|
|
80
|
+
required: Oe = !1,
|
|
81
|
+
emptyProps: De,
|
|
82
|
+
toggleSelectedOnSingle: Rt = !1,
|
|
83
|
+
optionRender: Ee,
|
|
83
84
|
getOptionLabel: ze,
|
|
84
|
-
dropdownMatchSelectWidth:
|
|
85
|
-
getPopupContainer:
|
|
85
|
+
dropdownMatchSelectWidth: ae = !0,
|
|
86
|
+
getPopupContainer: $t,
|
|
86
87
|
maxTagTextLength: W,
|
|
87
88
|
renderInputContent: q,
|
|
88
|
-
renderTagLabel:
|
|
89
|
-
renderMoreTagLabel:
|
|
90
|
-
} =
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
renderTagLabel: ie,
|
|
90
|
+
renderMoreTagLabel: Fe
|
|
91
|
+
} = po(at, "ComboSelect"), { language: Ke, locale: Ve } = Qt.useContext(fo), $ = v(null), Ae = v(!1);
|
|
92
|
+
N(() => {
|
|
93
|
+
process.env.NODE_ENV !== "production" && Ce !== void 0 && !Ae.current && (Ae.current = !0, console.warn(
|
|
94
|
+
"[ComboSelect] maxCount 已在 v5.x 标记为 @deprecated 且自当前版本起 runtime 完全不生效(原代码 dead field)。请从 props 中移除 maxCount;tag 显示数量由 overLine 控制是否换行。v6.0 将移除该字段。"
|
|
95
|
+
));
|
|
96
|
+
}, [Ce]);
|
|
97
|
+
const [p, me] = x(!1), [g, _] = x([]), B = v(/* @__PURE__ */ new Map()), [i, G] = x([]), [J, Ie] = x(""), U = v(void 0), [O, He] = x(null), [D, Lt] = x(!1), [L, Mt] = x(0), [E, z] = x(!1), ue = v([]), F = v(!1), Q = v(null), We = v({}), qe = lo(
|
|
98
|
+
u,
|
|
99
|
+
xt,
|
|
93
100
|
le,
|
|
94
101
|
M
|
|
95
|
-
), { key:
|
|
96
|
-
h.current.openMore =
|
|
97
|
-
const
|
|
98
|
-
h.current.openMore &&
|
|
99
|
-
},
|
|
102
|
+
), { key: Ot, title: Dt } = qe, K = Ot || "", _e = Dt || "", { outputKey: j = "key", outputTitle: y = "label" } = gt || {}, S = ho("ComboSelect", bo), Be = v(no(u, u === "table" ? le : M)), [de, Et] = x(), h = v({ list: [] }), [w, fe] = x(null), pe = v(null);
|
|
103
|
+
h.current.openMore = E, h.current.list = [...i];
|
|
104
|
+
const zt = () => {
|
|
105
|
+
h.current.openMore && z(!1);
|
|
106
|
+
}, Ge = (e) => {
|
|
100
107
|
if (e === null || e === 0 || (e === void 0 && (e = h.current.list.length), !pe.current)) return;
|
|
101
108
|
const o = pe.current.querySelector(".comboselect-overflow-list");
|
|
102
109
|
if (o)
|
|
103
110
|
if (o.scrollHeight > o.clientHeight) {
|
|
104
111
|
const r = Number(e) - 1;
|
|
105
|
-
fe(r),
|
|
112
|
+
fe(r), Ge(r);
|
|
106
113
|
} else
|
|
107
|
-
h.current.list.length <= e &&
|
|
114
|
+
h.current.list.length <= e && zt();
|
|
108
115
|
}, X = () => {
|
|
109
116
|
if (h.current.list.length === 0) return fe(null);
|
|
110
117
|
clearTimeout(h.current.resizeTimer), h.current.resizeTimer = setTimeout(() => {
|
|
111
|
-
fe(h.current.list.length),
|
|
118
|
+
fe(h.current.list.length), Ge();
|
|
112
119
|
}, 50);
|
|
113
120
|
};
|
|
114
|
-
|
|
121
|
+
N(() => (X(), () => {
|
|
115
122
|
clearTimeout(h.current.resizeTimer);
|
|
116
|
-
}), [
|
|
123
|
+
}), [i]), N(() => (!I && a ? window.addEventListener("resize", X) : window.removeEventListener("resize", X), () => {
|
|
117
124
|
window.removeEventListener("resize", X);
|
|
118
|
-
}), [
|
|
119
|
-
const
|
|
120
|
-
if (!f && !
|
|
125
|
+
}), [I, a]);
|
|
126
|
+
const Ft = (e) => {
|
|
127
|
+
if (!f && !ye) {
|
|
121
128
|
if (F.current) {
|
|
122
129
|
C();
|
|
123
130
|
return;
|
|
@@ -125,77 +132,77 @@ const _o = (nt) => {
|
|
|
125
132
|
F.current = !0, me(!0);
|
|
126
133
|
}
|
|
127
134
|
}, C = (e, o) => {
|
|
128
|
-
F.current = !1, U.current = void 0,
|
|
129
|
-
},
|
|
130
|
-
|
|
135
|
+
F.current = !1, U.current = void 0, We.current = {}, me(!1), He(null), Ie(""), yt?.(), o === "cancel" && Je();
|
|
136
|
+
}, Je = () => {
|
|
137
|
+
_([]), G([]);
|
|
131
138
|
}, he = (e, o) => {
|
|
132
|
-
|
|
133
|
-
},
|
|
134
|
-
|
|
139
|
+
_(e), Ht(o, e);
|
|
140
|
+
}, Kt = (e) => {
|
|
141
|
+
_((o) => {
|
|
135
142
|
const r = o.findIndex((l) => l === e[j]);
|
|
136
143
|
return r > -1 && o.splice(r, 1), [...o];
|
|
137
144
|
});
|
|
138
|
-
},
|
|
139
|
-
if (e.stopPropagation(), o.closable === !1 ||
|
|
140
|
-
const r = [...
|
|
141
|
-
l > -1 && r.splice(l, 1),
|
|
142
|
-
},
|
|
143
|
-
() =>
|
|
145
|
+
}, Ue = (e, o) => {
|
|
146
|
+
if (e.stopPropagation(), o.closable === !1 || Le?.(o) === !1) return;
|
|
147
|
+
const r = [...i], l = r.findIndex((s) => s[j] === o[j]);
|
|
148
|
+
l > -1 && r.splice(l, 1), G(r), Kt(o), k?.(r);
|
|
149
|
+
}, Vt = T(
|
|
150
|
+
() => co(async (e) => {
|
|
144
151
|
Y(e);
|
|
145
152
|
}, 400),
|
|
146
153
|
[]
|
|
147
|
-
),
|
|
148
|
-
|
|
154
|
+
), At = (e) => {
|
|
155
|
+
Ie(e), wt && Vt(e);
|
|
149
156
|
}, Y = (e) => {
|
|
150
157
|
const o = e ?? J;
|
|
151
|
-
se ? se(o) : (U.current = o?.trim(),
|
|
152
|
-
},
|
|
153
|
-
o ? (
|
|
154
|
-
},
|
|
158
|
+
se ? se(o) : (U.current = o?.trim(), Mt(Math.random())), Be.current && Et([]);
|
|
159
|
+
}, Qe = (e, o) => {
|
|
160
|
+
o ? (Ct?.(i), C(null, "ok")) : (jt?.(), C(null, "cancel"));
|
|
161
|
+
}, Xe = () => {
|
|
155
162
|
let e = "auto";
|
|
156
163
|
$.current && (e = `${$.current.offsetWidth}px`);
|
|
157
|
-
const o =
|
|
158
|
-
return typeof
|
|
164
|
+
const o = io(u, Be.current, ft, pt), r = { minWidth: e, maxWidth: 960 };
|
|
165
|
+
return typeof ae == "number" ? r.width = ae : ae && (r.width = e), {
|
|
159
166
|
overflow: "auto",
|
|
160
167
|
...r,
|
|
161
168
|
...o
|
|
162
169
|
};
|
|
163
|
-
},
|
|
170
|
+
}, It = () => A(
|
|
164
171
|
`${m}-comboselect`,
|
|
165
|
-
|
|
172
|
+
ut,
|
|
166
173
|
{
|
|
167
174
|
[`${m}-comboselect-focused`]: p && !f,
|
|
168
|
-
[`${m}-comboselect-disabled`]:
|
|
169
|
-
[`${m}-comboselect-radioable`]: !
|
|
170
|
-
[`${m}-comboselect-error`]:
|
|
175
|
+
[`${m}-comboselect-disabled`]: ye,
|
|
176
|
+
[`${m}-comboselect-radioable`]: !a,
|
|
177
|
+
[`${m}-comboselect-error`]: Re,
|
|
171
178
|
[`${m}-comboselect-clear`]: D,
|
|
172
179
|
[`${m}-comboselect-non-popup`]: f,
|
|
173
|
-
[`${m}-comboselect-overLine`]:
|
|
180
|
+
[`${m}-comboselect-overLine`]: I
|
|
174
181
|
},
|
|
175
|
-
`${m}-comboselect-${
|
|
176
|
-
),
|
|
182
|
+
`${m}-comboselect-${vt}`
|
|
183
|
+
), Ht = (e, o) => {
|
|
177
184
|
let r = [];
|
|
178
185
|
if (e?.length && (r = e.map((s) => {
|
|
179
186
|
const c = {};
|
|
180
|
-
c[j] = s[K] || "", ze ? c[y] = ze(s) || "" : c[y] = s[
|
|
181
|
-
const n =
|
|
187
|
+
c[j] = s[K] || "", ze ? c[y] = ze(s) || "" : c[y] = s[_e] || "";
|
|
188
|
+
const n = ue.current?.find((d) => d[j] === c[j]);
|
|
182
189
|
return n && (n.disabled !== void 0 && (c.disabled = n.disabled), n.closable !== void 0 && (c.closable = n.closable)), c;
|
|
183
190
|
})), o?.length && e) {
|
|
184
|
-
const s = o.filter((n) => e.findIndex((
|
|
191
|
+
const s = o.filter((n) => e.findIndex((d) => d[K] === n) === -1), c = ue.current?.filter((n) => s?.includes(n[j]));
|
|
185
192
|
c && r.push(...c);
|
|
186
193
|
}
|
|
187
|
-
|
|
188
|
-
const l =
|
|
189
|
-
|
|
190
|
-
},
|
|
194
|
+
G(r);
|
|
195
|
+
const l = mo(e || []);
|
|
196
|
+
a ? k?.(r, l) : k?.(r[0], l[0]);
|
|
197
|
+
}, Ye = (e) => {
|
|
191
198
|
const o = e.map((r) => r[j]);
|
|
192
|
-
|
|
193
|
-
},
|
|
194
|
-
|
|
195
|
-
},
|
|
199
|
+
G(e), _(o), ue.current = e;
|
|
200
|
+
}, Wt = (e, o) => {
|
|
201
|
+
He(o.node);
|
|
202
|
+
}, Ze = () => {
|
|
196
203
|
let e = {};
|
|
197
204
|
if (!f) {
|
|
198
|
-
const { width: o, minWidth: r, maxWidth: l } =
|
|
205
|
+
const { width: o, minWidth: r, maxWidth: l } = Xe();
|
|
199
206
|
e = { width: o, minWidth: r, maxWidth: l };
|
|
200
207
|
}
|
|
201
208
|
return /* @__PURE__ */ t.jsx(
|
|
@@ -204,16 +211,16 @@ const _o = (nt) => {
|
|
|
204
211
|
className: "comboselect-search",
|
|
205
212
|
style: e,
|
|
206
213
|
children: /* @__PURE__ */ t.jsx(
|
|
207
|
-
|
|
214
|
+
go,
|
|
208
215
|
{
|
|
209
216
|
className: "comboselect-search-input",
|
|
210
217
|
rightIconExist: !0,
|
|
211
218
|
showBtn: !1,
|
|
212
|
-
rightIcon: /* @__PURE__ */ t.jsx(
|
|
219
|
+
rightIcon: /* @__PURE__ */ t.jsx(Zt, {}),
|
|
213
220
|
btnType: "inside",
|
|
214
221
|
value: J,
|
|
215
|
-
onChange:
|
|
216
|
-
placeholder:
|
|
222
|
+
onChange: At,
|
|
223
|
+
placeholder: it ?? S({ id: "searchPlaceholder" }),
|
|
217
224
|
onClickBtn: () => {
|
|
218
225
|
Y();
|
|
219
226
|
},
|
|
@@ -227,49 +234,49 @@ const _o = (nt) => {
|
|
|
227
234
|
)
|
|
228
235
|
}
|
|
229
236
|
);
|
|
230
|
-
},
|
|
237
|
+
}, et = () => we ? /* @__PURE__ */ t.jsx("div", { className: "comboselect-actions", children: we }) : /* @__PURE__ */ t.jsxs("div", { className: "comboselect-actions", children: [
|
|
231
238
|
/* @__PURE__ */ t.jsx(
|
|
232
|
-
|
|
239
|
+
lt,
|
|
233
240
|
{
|
|
234
|
-
onClick: (e) =>
|
|
241
|
+
onClick: (e) => Qe(e, !1),
|
|
235
242
|
variant: "outlined",
|
|
236
243
|
size: "small",
|
|
237
|
-
children:
|
|
244
|
+
children: S({ id: "cancel" })
|
|
238
245
|
}
|
|
239
246
|
),
|
|
240
247
|
/* @__PURE__ */ t.jsx(
|
|
241
|
-
|
|
248
|
+
lt,
|
|
242
249
|
{
|
|
243
250
|
variant: "outlined",
|
|
244
|
-
onClick: (e) =>
|
|
251
|
+
onClick: (e) => Qe(e, !0),
|
|
245
252
|
size: "small",
|
|
246
|
-
children:
|
|
253
|
+
children: S({ id: "ok" })
|
|
247
254
|
}
|
|
248
255
|
)
|
|
249
|
-
] }),
|
|
250
|
-
/* @__PURE__ */ t.jsx("span", { children:
|
|
251
|
-
O?.[
|
|
252
|
-
] }),
|
|
253
|
-
e.stopPropagation(),
|
|
254
|
-
},
|
|
255
|
-
e.stopPropagation(),
|
|
256
|
+
] }), tt = () => u !== "tree" || !O ? null : $e ? /* @__PURE__ */ t.jsx("div", { className: "comboselect-fullPath", children: $e(O ?? {}) }) : /* @__PURE__ */ t.jsxs("div", { className: "comboselect-fullPath", children: [
|
|
257
|
+
/* @__PURE__ */ t.jsx("span", { children: S({ id: "fullPath" }) }),
|
|
258
|
+
O?.[kt] ?? ""
|
|
259
|
+
] }), qt = (e) => {
|
|
260
|
+
e.stopPropagation(), Je(), C(), z(!1), re?.(), k?.(a ? [] : {});
|
|
261
|
+
}, _t = (e) => {
|
|
262
|
+
e.stopPropagation(), z(!0), C();
|
|
256
263
|
};
|
|
257
|
-
|
|
264
|
+
Xt(Pt, () => ({
|
|
258
265
|
closePopup: () => C()
|
|
259
|
-
})),
|
|
266
|
+
})), N(() => {
|
|
260
267
|
!f && te && (F.current = !0, me(te));
|
|
261
|
-
}, [te]),
|
|
262
|
-
|
|
263
|
-
}, []),
|
|
264
|
-
oe &&
|
|
265
|
-
}, [oe]),
|
|
266
|
-
|
|
267
|
-
}, [
|
|
268
|
+
}, [te]), N(() => {
|
|
269
|
+
Te && Ye(ct(Te));
|
|
270
|
+
}, []), N(() => {
|
|
271
|
+
oe && Ye(ct(oe));
|
|
272
|
+
}, [oe]), N(() => {
|
|
273
|
+
mt && Lt(!!i?.length);
|
|
274
|
+
}, [i]), N(() => {
|
|
268
275
|
const e = (r) => r && r.ownerDocument || document, o = (r) => {
|
|
269
276
|
const l = e($.current), s = r.target, c = !l.documentElement.contains(s) || Q.current?.contains(s) || $.current?.contains(s) || !1;
|
|
270
|
-
if (
|
|
271
|
-
const n = `.${m}-select-popover`,
|
|
272
|
-
if (
|
|
277
|
+
if (u === "table") {
|
|
278
|
+
const n = `.${m}-select-popover`, d = `.${m}-table-show-colums-popover`, b = `.${m}-filter-popover`;
|
|
279
|
+
if (ao(s, `${n}, ${d}, ${b}`)) return;
|
|
273
280
|
}
|
|
274
281
|
F.current && !c && C();
|
|
275
282
|
};
|
|
@@ -284,47 +291,47 @@ const _o = (nt) => {
|
|
|
284
291
|
};
|
|
285
292
|
}
|
|
286
293
|
}, [p]);
|
|
287
|
-
const
|
|
288
|
-
if (!
|
|
294
|
+
const ot = T(() => {
|
|
295
|
+
if (!i?.length) return null;
|
|
289
296
|
if (q)
|
|
290
|
-
return q(
|
|
291
|
-
if (!
|
|
292
|
-
return /* @__PURE__ */ t.jsx("span", { className: "comboselect-single-content", children: /* @__PURE__ */ t.jsx(
|
|
293
|
-
if (!
|
|
297
|
+
return q(a ? i : i[0]);
|
|
298
|
+
if (!a)
|
|
299
|
+
return /* @__PURE__ */ t.jsx("span", { className: "comboselect-single-content", children: /* @__PURE__ */ t.jsx(ge, { children: i[0]?.[y] }) });
|
|
300
|
+
if (!i.length) return;
|
|
294
301
|
const e = (l) => {
|
|
295
302
|
if (ce) return ce(l);
|
|
296
303
|
const { disabled: s, closable: c = !0 } = l ?? {};
|
|
297
304
|
let n = l[y];
|
|
298
|
-
|
|
299
|
-
let
|
|
305
|
+
ie && (n = ie(l));
|
|
306
|
+
let d = !1;
|
|
300
307
|
if (typeof W == "number" && (typeof n == "string" || typeof n == "number")) {
|
|
301
308
|
const b = String(n);
|
|
302
|
-
b.length > W && (n = `${b.slice(0, W)}...`,
|
|
309
|
+
b.length > W && (n = `${b.slice(0, W)}...`, d = !0);
|
|
303
310
|
}
|
|
304
311
|
return /* @__PURE__ */ t.jsxs(
|
|
305
312
|
"span",
|
|
306
313
|
{
|
|
307
|
-
className:
|
|
314
|
+
className: A("comboselect-item", {
|
|
308
315
|
"comboselect-item--disabled": s,
|
|
309
316
|
"comboselect-item--unclosable": !c
|
|
310
317
|
}),
|
|
311
318
|
children: [
|
|
312
|
-
|
|
313
|
-
|
|
319
|
+
d ? /* @__PURE__ */ t.jsx(
|
|
320
|
+
so,
|
|
314
321
|
{
|
|
315
322
|
title: /* @__PURE__ */ t.jsx("div", { onClick: (b) => b.stopPropagation(), children: l[y] }),
|
|
316
323
|
arrow: !1,
|
|
317
324
|
placement: "bottomLeft",
|
|
318
325
|
children: /* @__PURE__ */ t.jsx("span", { className: "comboselect-item-content", children: n })
|
|
319
326
|
}
|
|
320
|
-
) : /* @__PURE__ */ t.jsx("span", { className: "comboselect-item-content", children: /* @__PURE__ */ t.jsx(
|
|
327
|
+
) : /* @__PURE__ */ t.jsx("span", { className: "comboselect-item-content", children: /* @__PURE__ */ t.jsx(ge, { children: n }) }),
|
|
321
328
|
c === !0 && /* @__PURE__ */ t.jsx(
|
|
322
329
|
"span",
|
|
323
330
|
{
|
|
324
331
|
className: "comboselect-item-remove",
|
|
325
|
-
onClick: (b) =>
|
|
332
|
+
onClick: (b) => Ue(b, l),
|
|
326
333
|
onMouseDown: (b) => b.stopPropagation(),
|
|
327
|
-
children: /* @__PURE__ */ t.jsx(
|
|
334
|
+
children: /* @__PURE__ */ t.jsx(st, {})
|
|
328
335
|
}
|
|
329
336
|
)
|
|
330
337
|
]
|
|
@@ -334,13 +341,13 @@ const _o = (nt) => {
|
|
|
334
341
|
"span",
|
|
335
342
|
{
|
|
336
343
|
className: "comboselect-item",
|
|
337
|
-
onClick:
|
|
344
|
+
onClick: _t,
|
|
338
345
|
children: /* @__PURE__ */ t.jsxs("span", { className: "comboselect-item-content", children: [
|
|
339
346
|
"+",
|
|
340
347
|
h.current.list.length - w
|
|
341
348
|
] })
|
|
342
349
|
}
|
|
343
|
-
) }) : null, r =
|
|
350
|
+
) }) : null, r = i.map((l, s) => w !== null && w <= s ? null : /* @__PURE__ */ t.jsx(
|
|
344
351
|
"div",
|
|
345
352
|
{
|
|
346
353
|
className: "comboselect-overflow-item",
|
|
@@ -353,166 +360,166 @@ const _o = (nt) => {
|
|
|
353
360
|
o()
|
|
354
361
|
] });
|
|
355
362
|
}, [
|
|
356
|
-
a,
|
|
357
|
-
T,
|
|
358
363
|
i,
|
|
364
|
+
k,
|
|
365
|
+
a,
|
|
359
366
|
w,
|
|
360
367
|
W,
|
|
361
368
|
y,
|
|
362
369
|
ce,
|
|
363
370
|
q,
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
]), Z =
|
|
367
|
-
let e = R ||
|
|
368
|
-
return H && !se && U.current !== void 0 && (e = { ...e, searchKey: U.current }),
|
|
369
|
-
}, [R, L,
|
|
370
|
-
if (!f && !p ||
|
|
371
|
+
ie,
|
|
372
|
+
I
|
|
373
|
+
]), Z = T(() => {
|
|
374
|
+
let e = R || We.current;
|
|
375
|
+
return H && !se && U.current !== void 0 && (e = { ...e, searchKey: U.current }), Tt?.(e) || e;
|
|
376
|
+
}, [R, L, P, p]), be = T(() => {
|
|
377
|
+
if (!f && !p || u !== "table") return null;
|
|
371
378
|
const e = {
|
|
372
|
-
url:
|
|
373
|
-
ctx:
|
|
379
|
+
url: ke,
|
|
380
|
+
ctx: Pe,
|
|
374
381
|
search: Z,
|
|
375
|
-
method:
|
|
382
|
+
method: Se
|
|
376
383
|
}, o = (r, l) => {
|
|
377
|
-
!
|
|
384
|
+
!a && (C(), g.includes(r)) || he([r], [l]);
|
|
378
385
|
};
|
|
379
386
|
return /* @__PURE__ */ t.jsx("div", { className: "comboselect-table", children: /* @__PURE__ */ t.jsx(
|
|
380
|
-
|
|
387
|
+
to,
|
|
381
388
|
{
|
|
382
389
|
...e,
|
|
383
390
|
...le,
|
|
384
|
-
emptyProps:
|
|
385
|
-
check:
|
|
386
|
-
radio: !
|
|
391
|
+
emptyProps: De,
|
|
392
|
+
check: a,
|
|
393
|
+
radio: !a,
|
|
387
394
|
rowKey: K,
|
|
388
395
|
setCheck: he,
|
|
389
396
|
setRadio: o,
|
|
390
|
-
checkDefaultValue:
|
|
391
|
-
radioDefaultValue:
|
|
392
|
-
refresh:
|
|
397
|
+
checkDefaultValue: g,
|
|
398
|
+
radioDefaultValue: g[0],
|
|
399
|
+
refresh: P ?? L,
|
|
393
400
|
autoSize: !1,
|
|
394
401
|
refreshInside: !1,
|
|
395
402
|
checkCount: !1,
|
|
396
403
|
paginationType: "simple"
|
|
397
404
|
}
|
|
398
405
|
) });
|
|
399
|
-
}, [
|
|
400
|
-
if (!f && !p || !["tree", "list"].includes(
|
|
406
|
+
}, [g, P, R, L, f, p, Z, K, a]), ve = T(() => {
|
|
407
|
+
if (!f && !p || !["tree", "list"].includes(u)) return null;
|
|
401
408
|
const e = {
|
|
402
|
-
url:
|
|
403
|
-
ctx:
|
|
409
|
+
url: ke,
|
|
410
|
+
ctx: Pe,
|
|
404
411
|
params: Z,
|
|
405
|
-
method:
|
|
412
|
+
method: Se
|
|
406
413
|
}, o = (s, c) => {
|
|
407
414
|
if (!c.checked) {
|
|
408
|
-
const
|
|
409
|
-
if (
|
|
415
|
+
const d = {};
|
|
416
|
+
if (d[j] = c.node[K] || "", d[y] = c.node[_e] || "", Le?.(d) === !1)
|
|
410
417
|
return;
|
|
411
418
|
}
|
|
412
|
-
if (!
|
|
419
|
+
if (!a && (C(), !Rt && g.includes(c.node?.key)))
|
|
413
420
|
return;
|
|
414
421
|
let n = c.checkedNodes;
|
|
415
|
-
if (
|
|
416
|
-
const
|
|
417
|
-
Array.from(
|
|
418
|
-
s.includes(
|
|
419
|
-
}), s.forEach((
|
|
420
|
-
const
|
|
421
|
-
|
|
422
|
-
}), n = Array.from(
|
|
422
|
+
if (a || s?.length && (n = [c.node]), a) {
|
|
423
|
+
const d = uo("key", n);
|
|
424
|
+
Array.from(B.current.keys()).forEach((V) => {
|
|
425
|
+
s.includes(V) || B.current.delete(V);
|
|
426
|
+
}), s.forEach((V) => {
|
|
427
|
+
const xe = String(V);
|
|
428
|
+
d[xe] && B.current.set(xe, d[xe]);
|
|
429
|
+
}), n = Array.from(B.current.values());
|
|
423
430
|
}
|
|
424
431
|
he(s, n);
|
|
425
|
-
}, r = (s) => M?.titleRender ? M.titleRender(s) :
|
|
426
|
-
"comboselect-list":
|
|
427
|
-
"comboselect-list-single":
|
|
432
|
+
}, r = (s) => M?.titleRender ? M.titleRender(s) : Ee ? Ee(s) : s.title, l = A("comboselect-tree", {
|
|
433
|
+
"comboselect-list": u === "list",
|
|
434
|
+
"comboselect-list-single": u === "list" && !a
|
|
428
435
|
});
|
|
429
436
|
return /* @__PURE__ */ t.jsx("div", { className: l, children: /* @__PURE__ */ t.jsx(
|
|
430
|
-
|
|
437
|
+
oo,
|
|
431
438
|
{
|
|
432
439
|
blockNode: !0,
|
|
433
440
|
...e,
|
|
434
441
|
...M,
|
|
435
442
|
wrapperStyle: { position: "static" },
|
|
436
|
-
emptyProps: { size: "small", ...
|
|
437
|
-
replaceFields:
|
|
438
|
-
checkable:
|
|
439
|
-
radioable: !
|
|
443
|
+
emptyProps: { size: "small", ...De },
|
|
444
|
+
replaceFields: qe,
|
|
445
|
+
checkable: a,
|
|
446
|
+
radioable: !a,
|
|
440
447
|
showRadio: !1,
|
|
441
|
-
selectable:
|
|
442
|
-
loadedKeys:
|
|
443
|
-
checkedKeys:
|
|
448
|
+
selectable: u !== "list",
|
|
449
|
+
loadedKeys: de,
|
|
450
|
+
checkedKeys: g,
|
|
444
451
|
onCheck: o,
|
|
445
|
-
onSelect:
|
|
452
|
+
onSelect: Wt,
|
|
446
453
|
titleRender: r,
|
|
447
|
-
refresh:
|
|
454
|
+
refresh: P ?? L,
|
|
448
455
|
loadingNode: /* @__PURE__ */ t.jsxs("div", { className: "loading-node-content", children: [
|
|
449
|
-
/* @__PURE__ */ t.jsx("div", { className: "loading-icon", children: /* @__PURE__ */ t.jsx(
|
|
450
|
-
|
|
456
|
+
/* @__PURE__ */ t.jsx("div", { className: "loading-icon", children: /* @__PURE__ */ t.jsx(jo, {}) }),
|
|
457
|
+
S({ id: "searching" })
|
|
451
458
|
] })
|
|
452
459
|
}
|
|
453
460
|
) });
|
|
454
|
-
}, [
|
|
461
|
+
}, [g, P, R, L, f, p, de, u, Z, a]), ee = T(() => /* @__PURE__ */ t.jsxs(
|
|
455
462
|
"div",
|
|
456
463
|
{
|
|
457
464
|
className: "comboselect-wrapper",
|
|
458
465
|
ref: $,
|
|
459
|
-
onClick:
|
|
466
|
+
onClick: Ft,
|
|
460
467
|
children: [
|
|
461
|
-
/* @__PURE__ */ t.jsx("div", { className:
|
|
462
|
-
!f && /* @__PURE__ */ t.jsx("span", { className: "comboselect-arrow", children: /* @__PURE__ */ t.jsx(
|
|
468
|
+
/* @__PURE__ */ t.jsx("div", { className: A("comboselect-overflow", !a && "comboselect-overflow-single"), children: ot }),
|
|
469
|
+
!f && /* @__PURE__ */ t.jsx("span", { className: "comboselect-arrow", children: /* @__PURE__ */ t.jsx(Yt, {}) }),
|
|
463
470
|
D && /* @__PURE__ */ t.jsx(
|
|
464
471
|
"span",
|
|
465
472
|
{
|
|
466
473
|
className: "comboselect-clear",
|
|
467
|
-
onClick:
|
|
468
|
-
children: /* @__PURE__ */ t.jsx(
|
|
474
|
+
onClick: qt,
|
|
475
|
+
children: /* @__PURE__ */ t.jsx(eo, {})
|
|
469
476
|
}
|
|
470
477
|
),
|
|
471
|
-
!
|
|
478
|
+
!i?.length && /* @__PURE__ */ t.jsx("span", { className: "comboselect-placeholder", children: je ?? S({ id: "pleaseSelect" }) })
|
|
472
479
|
]
|
|
473
480
|
}
|
|
474
|
-
), [
|
|
475
|
-
|
|
481
|
+
), [i, ot, a, D, f, je]), Bt = () => Me || Oe ? /* @__PURE__ */ t.jsx(
|
|
482
|
+
vo,
|
|
476
483
|
{
|
|
477
|
-
label:
|
|
478
|
-
required:
|
|
479
|
-
...
|
|
484
|
+
label: Me,
|
|
485
|
+
required: Oe,
|
|
486
|
+
...St
|
|
480
487
|
}
|
|
481
|
-
) : null,
|
|
488
|
+
) : null, Gt = () => /* @__PURE__ */ t.jsx(
|
|
482
489
|
"div",
|
|
483
490
|
{
|
|
484
491
|
ref: Q,
|
|
485
|
-
className: `comboselect-dropdown-wrapper ${H ? "show-search" : ""} mode-${
|
|
492
|
+
className: `comboselect-dropdown-wrapper ${H ? "show-search" : ""} mode-${u}`,
|
|
486
493
|
children: /* @__PURE__ */ t.jsxs(
|
|
487
494
|
"div",
|
|
488
495
|
{
|
|
489
|
-
style:
|
|
496
|
+
style: Xe(),
|
|
490
497
|
className: `${m}-scrollbar-small dropdown-content`,
|
|
491
498
|
children: [
|
|
492
|
-
H &&
|
|
493
|
-
|
|
494
|
-
p &&
|
|
495
|
-
|
|
499
|
+
H && Ze(),
|
|
500
|
+
u === "table" ? be : ve,
|
|
501
|
+
p && tt(),
|
|
502
|
+
Ne && et()
|
|
496
503
|
]
|
|
497
504
|
}
|
|
498
505
|
)
|
|
499
506
|
}
|
|
500
|
-
),
|
|
501
|
-
const e = () =>
|
|
507
|
+
), rt = () => {
|
|
508
|
+
const e = () => i.map((o, r) => {
|
|
502
509
|
if (w !== null && w > r) return null;
|
|
503
510
|
let l = o[y];
|
|
504
|
-
return
|
|
511
|
+
return Fe && (l = Fe(o)), /* @__PURE__ */ t.jsxs(
|
|
505
512
|
"div",
|
|
506
513
|
{
|
|
507
514
|
className: "comboselect-more-item",
|
|
508
515
|
children: [
|
|
509
|
-
/* @__PURE__ */ t.jsx("span", { className: "comboselect-more-item-text", children: /* @__PURE__ */ t.jsx(
|
|
516
|
+
/* @__PURE__ */ t.jsx("span", { className: "comboselect-more-item-text", children: /* @__PURE__ */ t.jsx(ge, { children: l }) }),
|
|
510
517
|
/* @__PURE__ */ t.jsx(
|
|
511
518
|
"span",
|
|
512
519
|
{
|
|
513
520
|
className: "comboselect-more-item-remove",
|
|
514
|
-
onClick: (s) =>
|
|
515
|
-
children: /* @__PURE__ */ t.jsx(
|
|
521
|
+
onClick: (s) => Ue(s, o),
|
|
522
|
+
children: /* @__PURE__ */ t.jsx(st, {})
|
|
516
523
|
}
|
|
517
524
|
)
|
|
518
525
|
]
|
|
@@ -521,26 +528,26 @@ const _o = (nt) => {
|
|
|
521
528
|
);
|
|
522
529
|
});
|
|
523
530
|
return /* @__PURE__ */ t.jsxs("div", { className: "comboselect-more-wrapper", children: [
|
|
524
|
-
/* @__PURE__ */ t.jsx("span", { className: "comboselect-more-title", children: /* @__PURE__ */ t.jsx("span", { children:
|
|
531
|
+
/* @__PURE__ */ t.jsx("span", { className: "comboselect-more-title", children: /* @__PURE__ */ t.jsx("span", { children: S({ id: "more" }) }) }),
|
|
525
532
|
/* @__PURE__ */ t.jsx("div", { className: "comboselect-more-content", children: e() })
|
|
526
533
|
] });
|
|
527
|
-
},
|
|
528
|
-
|
|
534
|
+
}, Jt = T(() => /* @__PURE__ */ t.jsx(
|
|
535
|
+
ro,
|
|
529
536
|
{
|
|
530
|
-
overlay:
|
|
537
|
+
overlay: Gt(),
|
|
531
538
|
visible: p,
|
|
532
|
-
placement:
|
|
539
|
+
placement: ht,
|
|
533
540
|
trigger: ["click"],
|
|
534
|
-
overlayClassName:
|
|
535
|
-
getPopupContainer:
|
|
541
|
+
overlayClassName: A(`${m}-comboselect-dropdown`, bt),
|
|
542
|
+
getPopupContainer: $t,
|
|
536
543
|
children: /* @__PURE__ */ t.jsx(
|
|
537
|
-
|
|
544
|
+
nt,
|
|
538
545
|
{
|
|
539
|
-
visible:
|
|
546
|
+
visible: E,
|
|
540
547
|
destroyTooltipOnHide: !0,
|
|
541
548
|
placement: "rightTop",
|
|
542
|
-
content:
|
|
543
|
-
onVisibleChange: () =>
|
|
549
|
+
content: rt(),
|
|
550
|
+
onVisibleChange: () => z(!1),
|
|
544
551
|
overlayClassName: `${m}-comboselect-more-popover`,
|
|
545
552
|
children: ee
|
|
546
553
|
}
|
|
@@ -548,74 +555,74 @@ const _o = (nt) => {
|
|
|
548
555
|
}
|
|
549
556
|
), [
|
|
550
557
|
p,
|
|
551
|
-
|
|
558
|
+
g,
|
|
552
559
|
J,
|
|
553
|
-
|
|
560
|
+
P,
|
|
554
561
|
R,
|
|
555
562
|
O,
|
|
556
563
|
L,
|
|
557
564
|
D,
|
|
558
565
|
ne,
|
|
559
|
-
Fe,
|
|
560
566
|
Ke,
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
567
|
+
Ve,
|
|
568
|
+
E,
|
|
569
|
+
de,
|
|
570
|
+
k,
|
|
564
571
|
re,
|
|
565
572
|
ee,
|
|
566
|
-
|
|
567
|
-
]),
|
|
573
|
+
i
|
|
574
|
+
]), Ut = T(() => /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
568
575
|
/* @__PURE__ */ t.jsx(
|
|
569
|
-
|
|
576
|
+
nt,
|
|
570
577
|
{
|
|
571
|
-
visible:
|
|
578
|
+
visible: E,
|
|
572
579
|
destroyTooltipOnHide: !0,
|
|
573
580
|
placement: "rightTop",
|
|
574
|
-
content:
|
|
575
|
-
onVisibleChange: () =>
|
|
581
|
+
content: rt(),
|
|
582
|
+
onVisibleChange: () => z(!1),
|
|
576
583
|
overlayClassName: `${m}-comboselect-more-popover`,
|
|
577
584
|
children: ee
|
|
578
585
|
}
|
|
579
586
|
),
|
|
580
587
|
/* @__PURE__ */ t.jsxs("div", { className: "comboselect-non-popup-content", children: [
|
|
581
|
-
H &&
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
588
|
+
H && Ze(),
|
|
589
|
+
u === "table" ? be : ve,
|
|
590
|
+
tt(),
|
|
591
|
+
Ne && et()
|
|
585
592
|
] })
|
|
586
593
|
] }), [
|
|
587
|
-
|
|
594
|
+
g,
|
|
588
595
|
J,
|
|
589
|
-
|
|
596
|
+
P,
|
|
590
597
|
R,
|
|
591
598
|
O,
|
|
592
599
|
D,
|
|
593
600
|
ne,
|
|
594
|
-
Fe,
|
|
595
601
|
Ke,
|
|
596
|
-
|
|
602
|
+
Ve,
|
|
603
|
+
k,
|
|
597
604
|
re,
|
|
598
605
|
be,
|
|
599
606
|
ve,
|
|
600
607
|
ee,
|
|
601
|
-
|
|
602
|
-
|
|
608
|
+
E,
|
|
609
|
+
i
|
|
603
610
|
]);
|
|
604
611
|
return /* @__PURE__ */ t.jsxs(
|
|
605
612
|
"div",
|
|
606
613
|
{
|
|
607
|
-
className:
|
|
608
|
-
style:
|
|
614
|
+
className: It(),
|
|
615
|
+
style: dt,
|
|
609
616
|
ref: pe,
|
|
610
617
|
children: [
|
|
611
|
-
|
|
612
|
-
f ?
|
|
618
|
+
Bt(),
|
|
619
|
+
f ? Ut : Jt,
|
|
613
620
|
f ? null : /* @__PURE__ */ t.jsx(
|
|
614
|
-
|
|
621
|
+
xo,
|
|
615
622
|
{
|
|
616
|
-
error:
|
|
623
|
+
error: Re,
|
|
617
624
|
helperText: ne,
|
|
618
|
-
hideErrorDom:
|
|
625
|
+
hideErrorDom: Nt
|
|
619
626
|
}
|
|
620
627
|
)
|
|
621
628
|
]
|
|
@@ -623,7 +630,7 @@ const _o = (nt) => {
|
|
|
623
630
|
);
|
|
624
631
|
};
|
|
625
632
|
export {
|
|
626
|
-
|
|
627
|
-
|
|
633
|
+
Uo as ComboSelect,
|
|
634
|
+
Uo as default
|
|
628
635
|
};
|
|
629
636
|
//# sourceMappingURL=index.js.map
|