@baishuyun/ui-base 6.23.5 → 6.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/Amap/index.js +1 -1
  2. package/dist/Calendar/{Calendar--C1SpjBO.js → Calendar-Iyzwzp_2.js} +1 -1
  3. package/dist/Calendar/index.js +3 -3
  4. package/dist/Card/index.js +1 -1
  5. package/dist/CheckBox/{CheckBox-BErX3YWP.js → CheckBox-BzEWkFYf.js} +15 -15
  6. package/dist/CheckBox/{CheckBox-Dp7hxT2F.js → CheckBox-DwM2Jof2.js} +1 -1
  7. package/dist/CheckBox/index.js +3 -3
  8. package/dist/ColorPicker/index.js +1 -1
  9. package/dist/ConfigProvider/index.js +1 -1
  10. package/dist/DatePicker/{DatePicker-CT4nehTz.js → DatePicker-B3AcIGVB.js} +1 -1
  11. package/dist/DatePicker/{DatePickerPanel-D-S4mNV5.js → DatePickerPanel-WIC4IcER.js} +1 -1
  12. package/dist/DatePicker/index.js +2 -2
  13. package/dist/DropDown/index.js +1 -1
  14. package/dist/Editor/index.js +3 -3
  15. package/dist/Gantt/index.js +1 -1
  16. package/dist/Icon/index.js +1 -1
  17. package/dist/InputTag/index.js +1 -1
  18. package/dist/Loading/index.js +1 -1
  19. package/dist/Modal/index.js +1 -1
  20. package/dist/NotFoundContent/index.js +1 -1
  21. package/dist/Overlay/index.js +1 -1
  22. package/dist/Radio/index.js +1 -1
  23. package/dist/ScrollBar/index.js +1 -1
  24. package/dist/Segmented/index.js +1 -1
  25. package/dist/Select/Select-BdTsElGr.js +776 -0
  26. package/dist/Select/index.js +5 -5
  27. package/dist/Table/index.js +1 -1
  28. package/dist/Tabs/index.js +1 -1
  29. package/dist/Tooltip/index.js +1 -1
  30. package/dist/Tree/index.js +3 -3
  31. package/dist/components/Select/HighlightText/HighlightText.d.ts +1 -0
  32. package/dist/components/Select/interface.d.ts +8 -1
  33. package/dist/index.js +7 -7
  34. package/dist/style.css +1 -1
  35. package/dist/vendors/{Tree-DWK-JPnJ.js → Tree-BX1wWVS4.js} +10 -10
  36. package/dist/vendors/{version-CCPvyOYw.js → version-BoH6YX7g.js} +1 -1
  37. package/package.json +1 -1
  38. package/dist/Select/Select-ByqucfXU.js +0 -770
@@ -0,0 +1,776 @@
1
+ import { t as e } from "../Icon/Icon-DrdQOEJE.js";
2
+ import { a as t, i as n } from "../Overlay/OverlayContext-CVSFoyqN.js";
3
+ import { t as r } from "../vendors/useLocale-Be4e7Xfn.js";
4
+ import { n as i, r as a } from "../vendors/animations-ISccYUE3.js";
5
+ import { t as o } from "../vendors/useLatchedPopupPortalRoot-CC6af8t-.js";
6
+ import { t as s } from "../vendors/cssVars-UpriQzph.js";
7
+ import { t as c } from "./SelectInputSearch-MApQHnU9.js";
8
+ import { n as l, t as u } from "../vendors/Tree-BX1wWVS4.js";
9
+ import { n as d } from "../CheckBox/CheckBox-BzEWkFYf.js";
10
+ import { t as f } from "../CheckBox/CheckBox-DwM2Jof2.js";
11
+ import { t as p } from "../NotFoundContent/NotFoundContent-DJUQ0_2D.js";
12
+ import { t as m } from "../ScrollBar/ScrollBar-IMTuAOF5.js";
13
+ import { t as h } from "../vendors/useFloatingPortal-DJ1iKmW-.js";
14
+ import { first as g, isArray as _, isEmpty as v, isEqual as y, isNil as b, noop as x } from "lodash-es";
15
+ import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
16
+ import { Suspense as T, createContext as E, forwardRef as ee, memo as D, useCallback as O, useContext as k, useDeferredValue as A, useId as te, useImperativeHandle as ne, useLayoutEffect as re, useMemo as j, useRef as M, useState as ie } from "react";
17
+ import { Input as ae } from "antd";
18
+ import N from "clsx";
19
+ import { useControllableValue as oe, useHover as P, useToggle as se } from "ahooks";
20
+ import { AnimatePresence as ce, motion as le } from "motion/react";
21
+ import { FloatingPortal as ue } from "@floating-ui/react";
22
+ import F from "fuse.js";
23
+ //#region src/components/Select/constants.ts
24
+ var I = /* @__PURE__ */ function(e) {
25
+ return e.SINGLE = "single", e.MULTIPLE = "multiple", e;
26
+ }({}), L = /* @__PURE__ */ function(e) {
27
+ return e[e.SINGLE = 0] = "SINGLE", e[e.MULTIPLE = 1] = "MULTIPLE", e[e.TREE = 2] = "TREE", e[e.TREE_TAGS = 3] = "TREE_TAGS", e[e.MEMBER = 4] = "MEMBER", e[e.DEPARTEMENT = 5] = "DEPARTEMENT", e;
28
+ }({}), de = {
29
+ [L.SINGLE]: I.SINGLE,
30
+ [L.TREE]: I.SINGLE,
31
+ [L.MULTIPLE]: I.MULTIPLE,
32
+ [L.TREE_TAGS]: I.MULTIPLE,
33
+ [L.MEMBER]: I.MULTIPLE,
34
+ [L.DEPARTEMENT]: I.MULTIPLE
35
+ }, fe = {
36
+ label: "label",
37
+ value: "value",
38
+ children: "children"
39
+ }, pe = E({
40
+ value: void 0,
41
+ setValue: x,
42
+ isOpen: !1,
43
+ setIsOpen: x
44
+ }), me = E({
45
+ fieldNames: {
46
+ label: "label",
47
+ value: "value",
48
+ children: "children"
49
+ },
50
+ disabled: !1
51
+ }), he = E({}), R = () => {
52
+ let e = k(pe);
53
+ if (!e) throw Error("Select.* components must be used within a SelectStateContext provider");
54
+ return e;
55
+ }, z = () => {
56
+ let e = k(me);
57
+ if (!e) throw Error("Select.* components must be used within a SelectConfigContext provider");
58
+ return e;
59
+ }, B = () => k(he);
60
+ //#endregion
61
+ //#region src/components/Select/utils/fieldAccessor.ts
62
+ function V(e) {
63
+ let t = e;
64
+ return {
65
+ getLabel: (e) => e[t.label],
66
+ getValue: (e) => e[t.value],
67
+ getChildren: (e) => {
68
+ if (t.children) return e[t.children];
69
+ },
70
+ normalizeOption: (e) => ({
71
+ ...e,
72
+ label: e[t.label],
73
+ value: e[t.value],
74
+ children: t.children ? e[t.children] : void 0
75
+ }),
76
+ getFieldNames: () => t
77
+ };
78
+ }
79
+ //#endregion
80
+ //#region src/components/Select/SelectInput/SelectSingleInput/SelectSingleInput.tsx
81
+ var H = D((e) => {
82
+ let { value: t, inputValueStyle: n } = e, { fieldNames: r, otherInputPosition: i } = z(), { isSelectedOtherOption: a, otherOptionValue: o } = B(), s = V(r), c = g(t), l;
83
+ return l = a && o && i === "inline" ? o : e.labelRender && c ? e.labelRender(c) : c ? s.getLabel(c) : "", /* @__PURE__ */ C("div", {
84
+ className: N("bsy-select-input-container__input-value overflow-hidden"),
85
+ style: n,
86
+ children: /* @__PURE__ */ C("div", {
87
+ className: "bsy-select-input-container__input-value-text",
88
+ children: l
89
+ })
90
+ });
91
+ });
92
+ H.displayName = "BsySelectSingleInput";
93
+ //#endregion
94
+ //#region src/components/Select/SelectInput/SelectMultipleInput/OptionTag/option-tag.module.scss
95
+ var U = {
96
+ "bsy-input-tag__container": "_bsy-input-tag__container_1bb6m_1",
97
+ "bsy-input-tag__item": "_bsy-input-tag__item_1bb6m_7",
98
+ "bsy-input-tag__item--disabled": "_bsy-input-tag__item--disabled_1bb6m_20",
99
+ "bsy-input-tag__item-icon": "_bsy-input-tag__item-icon_1bb6m_24"
100
+ }, W = ee(({ children: e, style: t, disabled: n }, r) => /* @__PURE__ */ C("div", {
101
+ "data-bsy-input-tag": "true",
102
+ className: N({
103
+ [U["bsy-input-tag__item"]]: !0,
104
+ [U["bsy-input-tag__item--disabled"]]: n
105
+ }),
106
+ ref: r,
107
+ style: t,
108
+ children: e
109
+ }));
110
+ W.Container = (e) => /* @__PURE__ */ C("div", {
111
+ className: N(U["bsy-input-tag__container"]),
112
+ children: e.children
113
+ }), W.displayName = "BsyOptionTag";
114
+ //#endregion
115
+ //#region src/components/Select/SelectInput/SelectMultipleInput/select-multiple-input.module.scss
116
+ var ge = "_select_multiple_input__container_15izh_1", _e = "_select_multiple_input__measurement_layer_15izh_6", G = "_select_multiple_input__close_btn_15izh_14", K = "_select_multiple_input__ellipsis_15izh_24", q = "_select_multiple_input__tag_content_15izh_27", J = {
117
+ select_multiple_input__container: ge,
118
+ select_multiple_input__measurement_layer: _e,
119
+ select_multiple_input__close_btn: G,
120
+ "select_multiple_input__close_btn--disabled": "_select_multiple_input__close_btn--disabled_15izh_21",
121
+ select_multiple_input__ellipsis: K,
122
+ select_multiple_input__tag_content: q
123
+ }, Y = 4, X = D((t) => {
124
+ let { value: n, labelRender: r, tagStyle: i } = t, { setValue: a } = R(), { fieldNames: o, disabled: s } = z(), c = V(o), l = n?.length ?? 0, [u, d] = ie(0), f = M(null), p = M(null);
125
+ re(() => {
126
+ if (!f.current) return;
127
+ let e = new ResizeObserver((e) => {
128
+ let t = e[0];
129
+ if (!t) return;
130
+ let r = t.contentRect.width, i = t.target.querySelectorAll(".measure-list [data-bsy-input-tag=\"true\"]");
131
+ if (i.length === 0) {
132
+ d(n?.length ?? 0);
133
+ return;
134
+ }
135
+ let a = p.current?.offsetWidth || 65, o = 0, s = 0;
136
+ for (let e = 0; e < i.length; e++) {
137
+ let t = i[e].clientWidth + Y, n = e < l - 1 ? a : 0;
138
+ if (o + t + n <= r) o += t, s = e + 1;
139
+ else break;
140
+ }
141
+ s === 0 && l === 1 && (s = 1), u !== s && d(s);
142
+ });
143
+ return e.observe(f.current), () => e.disconnect();
144
+ }, [
145
+ l,
146
+ u,
147
+ n.length
148
+ ]);
149
+ let m = l - u, h = A(m), g = /* @__PURE__ */ C("div", {
150
+ className: `${J.select_multiple_input__measurement_layer} measure-list`,
151
+ children: /* @__PURE__ */ w(W.Container, { children: [n?.map((t, n) => {
152
+ let a = (t) => /* @__PURE__ */ C("div", {
153
+ style: t,
154
+ className: N(U["bsy-input-tag__item-icon"], "cursor-pointer"),
155
+ children: /* @__PURE__ */ C(e, {
156
+ name: "close",
157
+ style: { fontSize: 12 },
158
+ className: J.select_multiple_input__close_btn
159
+ })
160
+ });
161
+ return /* @__PURE__ */ w(W, {
162
+ style: i,
163
+ children: [r && r(t, a), !r && /* @__PURE__ */ w("div", {
164
+ className: J.select_multiple_input__tag_content,
165
+ children: [/* @__PURE__ */ C("span", { children: c.getLabel(t) }), /* @__PURE__ */ C(a, {})]
166
+ })]
167
+ }, n);
168
+ }), u < l && h > 0 && /* @__PURE__ */ w(W, {
169
+ ref: p,
170
+ children: [`+ ${m}`, /* @__PURE__ */ C("span", {
171
+ className: J.select_multiple_input__ellipsis,
172
+ children: "..."
173
+ })]
174
+ })] })
175
+ }), _ = (e) => {
176
+ if (s) return;
177
+ let t = n.filter((t) => c.getValue(t) !== c.getValue(e));
178
+ a(t.map((e) => c.getValue(e)), t);
179
+ };
180
+ return /* @__PURE__ */ w("div", {
181
+ ref: f,
182
+ className: N("bsy-select-input-container__input-value", J.select_multiple_input__container, "multiple"),
183
+ children: [g, /* @__PURE__ */ w(W.Container, { children: [n?.slice(0, u).map((t, n) => {
184
+ let a = (n) => /* @__PURE__ */ C("div", {
185
+ style: n,
186
+ className: N(U["bsy-input-tag__item-icon"], {
187
+ [J.select_multiple_input__close_btn]: !s,
188
+ [J.select_multiple_input__close_btn + "--disabled"]: s
189
+ }),
190
+ onClick: (e) => {
191
+ e.stopPropagation(), _(t);
192
+ },
193
+ children: /* @__PURE__ */ C(e, {
194
+ name: "close",
195
+ style: { fontSize: 12 }
196
+ })
197
+ });
198
+ return /* @__PURE__ */ w(W, {
199
+ style: {
200
+ ...i,
201
+ flexShrink: u === 1 ? 1 : 0
202
+ },
203
+ disabled: s,
204
+ children: [r && r(t, a), !r && /* @__PURE__ */ w("div", {
205
+ className: J.select_multiple_input__tag_content,
206
+ children: [/* @__PURE__ */ C("span", {
207
+ className: "truncate",
208
+ children: c.getLabel(t)
209
+ }), /* @__PURE__ */ C(a, {})]
210
+ })]
211
+ }, n);
212
+ }), u < l && h > 0 && /* @__PURE__ */ w(W, {
213
+ ref: p,
214
+ children: [`+ ${m} `, /* @__PURE__ */ C("span", {
215
+ className: J.select_multiple_input__ellipsis,
216
+ children: "..."
217
+ })]
218
+ })] })]
219
+ });
220
+ });
221
+ X.displayName = "BsySelectMultipleInput";
222
+ //#endregion
223
+ //#region src/components/Select/utils/tree.ts
224
+ var Z = (e, t) => {
225
+ let n = [], r = (e) => {
226
+ e.forEach((e) => {
227
+ let { [t.children]: i, ...a } = e;
228
+ n.push(a), i && r(i);
229
+ });
230
+ };
231
+ return r(e), n;
232
+ }, ve = ({ placeholder: t, mode: n, clearable: r, onClear: a, disabled: o = !1, labelRender: s, options: c = [], type: l, prefix: u, suffixIcon: d, ghost: f, inputValueStyle: p, tagStyle: m }) => {
233
+ let h = M(null), g = P(o ? null : h), { isOpen: v, value: y, getCachedOptionByValue: x } = R(), { fieldNames: T } = z(), E = j(() => {
234
+ if (b(y)) return [];
235
+ let e = _(y) ? y : [y];
236
+ if (l === L.TREE) {
237
+ let t = V(T), n = Z(c, T);
238
+ return e.map((e) => n.find((n) => t.getValue(n) === e) || x?.(e)).filter((e) => !!e);
239
+ }
240
+ return e.map((e) => c.find((t) => t[T.value] === e) || x?.(e)).filter((e) => !!e);
241
+ }, [
242
+ y,
243
+ c,
244
+ l,
245
+ T,
246
+ x
247
+ ]);
248
+ return /* @__PURE__ */ C("div", {
249
+ className: N("bsy-select-input-container", {
250
+ disabled: o,
251
+ multiple: n === I.MULTIPLE,
252
+ active: v,
253
+ "ghost-style": f
254
+ }),
255
+ ref: h,
256
+ children: /* @__PURE__ */ w("div", {
257
+ className: N("bsy-select-input-container-input"),
258
+ children: [
259
+ u && /* @__PURE__ */ C("div", {
260
+ className: "bsy-select-input-container-input-prefix",
261
+ children: u
262
+ }),
263
+ E?.length ? /* @__PURE__ */ w(S, { children: [n === I.SINGLE && /* @__PURE__ */ C(H, {
264
+ value: E,
265
+ labelRender: s,
266
+ inputValueStyle: p
267
+ }), n === I.MULTIPLE && /* @__PURE__ */ C(X, {
268
+ value: E,
269
+ labelRender: s,
270
+ tagStyle: m
271
+ })] }) : /* @__PURE__ */ C("div", {
272
+ className: "bsy-select-input-container__input-value-placeholder truncate",
273
+ children: t
274
+ }),
275
+ /* @__PURE__ */ C("div", {
276
+ className: N("bsy-select-input-container__icon"),
277
+ children: /* @__PURE__ */ C(ce, {
278
+ mode: "wait",
279
+ children: E?.length && r && g ? /* @__PURE__ */ C(le.div, {
280
+ className: "bsy-select-input-container__icon-motion",
281
+ ...i,
282
+ children: /* @__PURE__ */ C(e, {
283
+ name: "cancel",
284
+ className: "icon bsy-select-input-clear",
285
+ role: "button",
286
+ "aria-label": "clear",
287
+ onClick: (e) => {
288
+ e.stopPropagation(), a?.();
289
+ }
290
+ })
291
+ }, "cancel") : /* @__PURE__ */ C(le.div, {
292
+ className: "bsy-select-input-container__icon-motion",
293
+ ...i,
294
+ children: d ? d(v, o) : /* @__PURE__ */ C(e, {
295
+ name: "arrow-down",
296
+ className: N("icon", { active: v })
297
+ })
298
+ }, "arrow")
299
+ })
300
+ })
301
+ ]
302
+ })
303
+ });
304
+ };
305
+ ve.displayName = "BsySelectInput";
306
+ //#endregion
307
+ //#region src/components/Select/OptionList/SingleOptionList/SingleOptionList.tsx
308
+ var Q = D((e) => {
309
+ let { options: t, value: n, onSelect: i, searchValue: a = "", fieldNames: o, optionRender: s, optionStyle: c } = e, { t: u } = r(), { otherInputPosition: d } = z(), { otherOptionValue: f, setOtherOptionValue: p, onOtherInputChange: m, isSelectedOtherOption: h = !1 } = B(), g = M(null), _ = V(o);
310
+ return /* @__PURE__ */ C("ul", {
311
+ role: "listbox",
312
+ children: t.map((e, t) => {
313
+ let r = _.getValue(e), o = _.getLabel(e), v = e.systemField === !0, y = e.isOther === !0, b = e.disabled === !0, x = y && d === "inline" && o.length > 6 ? o.slice(0, 6) + "..." : o, S = y ? h : r === n;
314
+ return /* @__PURE__ */ w("li", {
315
+ role: "option",
316
+ "aria-selected": S,
317
+ "aria-disabled": b,
318
+ className: N("rounded-[4px] py-[7px] px-[10px] min-h-[34px]", {
319
+ "cursor-pointer": !b,
320
+ "cursor-not-allowed bg-transparent": b,
321
+ "bsy-select-option--disabled": b,
322
+ "bsy-select-option--hoverable": !b && !S,
323
+ "bsy-select-option--system": !b && v && !S && !e.emphasized,
324
+ "bsy-select-option--selected": !b && S,
325
+ "flex items-center": y && d === "inline"
326
+ }),
327
+ style: c,
328
+ onClick: () => {
329
+ b || i(r, e);
330
+ },
331
+ children: [/* @__PURE__ */ C("div", {
332
+ title: o,
333
+ children: s ? s(e, { index: t }, S) : /* @__PURE__ */ C(l, {
334
+ text: x,
335
+ highlight: a,
336
+ className: !b && e.emphasized ? "font-bold bsy-select-option--all" : void 0
337
+ })
338
+ }), y && d === "inline" && /* @__PURE__ */ C("div", {
339
+ className: "ml-2 flex-1",
340
+ onClick: (e) => e.stopPropagation(),
341
+ style: { minWidth: "146px" },
342
+ children: /* @__PURE__ */ C(ae, {
343
+ ref: g,
344
+ value: f,
345
+ disabled: b,
346
+ onChange: (e) => {
347
+ let t = e.target.value;
348
+ p?.(t), m?.(t);
349
+ },
350
+ onPressEnter: () => {
351
+ !b && f && i(r, e);
352
+ },
353
+ onBlur: () => {
354
+ !b && f && i(r, e);
355
+ },
356
+ placeholder: u("context"),
357
+ "aria-label": u("otherOptionInput")
358
+ })
359
+ })]
360
+ }, `${r}-${t}`);
361
+ })
362
+ });
363
+ });
364
+ Q.displayName = "BsySingleSelect";
365
+ //#endregion
366
+ //#region src/components/Select/OptionList/MultOptionList/MultOptionList.tsx
367
+ var ye = (e) => {
368
+ let { t } = r(), { options: n, searchValue: i = "", value: a, onSelect: o, fieldNames: s, optionRender: c } = e, u = V(s), d = a || [], p = n.filter((e) => !e.isOther), m = p.filter((e) => !e.disabled), h = m.map((e) => u.getValue(e)), g = m.length > 0 && m.every((e) => d.includes(u.getValue(e)));
369
+ return /* @__PURE__ */ C("div", {
370
+ className: "bsy-multiple-select",
371
+ children: /* @__PURE__ */ w("ul", {
372
+ className: "bsy-multiple-select-list",
373
+ children: [/* @__PURE__ */ C("li", {
374
+ className: N("flex items-center gap-[8px]", "cursor-pointer rounded-[4px] min-h-[34px]", "bsy-select-option--hoverable", "bsy-multiple-select-item"),
375
+ children: /* @__PURE__ */ C(f, {
376
+ checked: g,
377
+ disabled: m.length === 0,
378
+ onChange: () => {
379
+ let e = g ? d.filter((e) => !h.includes(e)) : [...d, ...h.filter((e) => !d.includes(e))];
380
+ o(e, p.filter((t) => e.includes(u.getValue(t))));
381
+ },
382
+ indeterminate: m.some((e) => d.includes(u.getValue(e))) && !g,
383
+ style: { padding: "7px 10px" },
384
+ children: /* @__PURE__ */ C("span", {
385
+ className: "font-bold bsy-select-option--all",
386
+ children: t(i ? "allSelectedBySearch" : "allSelect")
387
+ })
388
+ })
389
+ }), /* @__PURE__ */ C(f.Group, {
390
+ value: d,
391
+ onChange: (e) => {
392
+ o(e, p.filter((t) => e.includes(u.getValue(t))));
393
+ },
394
+ children: p.map((e, t) => {
395
+ let n = u.getValue(e), r = u.getLabel(e), a = d.includes(n), o = e.systemField === !0, s = e.disabled === !0;
396
+ return /* @__PURE__ */ C("li", {
397
+ "aria-disabled": s,
398
+ className: N("flex items-center gap-[8px] min-h-[34px]", "rounded-[4px]", "bsy-multiple-select-item", {
399
+ "cursor-pointer": !s,
400
+ "cursor-not-allowed bg-transparent": s,
401
+ "bsy-select-option--disabled": s,
402
+ "bsy-select-option--hoverable": !s,
403
+ "bsy-select-option--system": !s && o && !a && !e.emphasized
404
+ }),
405
+ children: /* @__PURE__ */ C(f, {
406
+ value: n,
407
+ disabled: s,
408
+ style: { padding: "7px 10px" },
409
+ children: c ? c(e, { index: t }, a) : /* @__PURE__ */ C(l, {
410
+ text: r,
411
+ highlight: i,
412
+ className: !s && e.emphasized ? "font-bold bsy-select-option--all" : void 0
413
+ })
414
+ })
415
+ }, `${n}-${t}`);
416
+ })
417
+ })]
418
+ })
419
+ });
420
+ };
421
+ ye.displayName = "BsyMultipleSelect";
422
+ //#endregion
423
+ //#region src/components/Select/OptionList/TreeOptionList/TreeOptionList.tsx
424
+ var be = (e) => {
425
+ let { options: t, searchValue: n, value: r, onSelect: i, fieldNames: a } = e;
426
+ return /* @__PURE__ */ C("div", {
427
+ className: "bsy-tree-select",
428
+ children: /* @__PURE__ */ C("div", {
429
+ className: "bsy-tree-select-nodes",
430
+ children: /* @__PURE__ */ C(u, {
431
+ data: t,
432
+ searchValue: n,
433
+ fieldNames: a ? {
434
+ title: a.label,
435
+ value: a.value,
436
+ children: a.children
437
+ } : void 0,
438
+ selectedKeys: r ? [r] : [],
439
+ onSelect: i
440
+ })
441
+ })
442
+ });
443
+ }, xe = (e, t) => {
444
+ let n = [], r = (e) => {
445
+ if (e) for (let i of e) n.push(i), r(i[t.children]);
446
+ };
447
+ return r(e), n;
448
+ }, $ = (e, t, n) => e.reduce((e, r) => {
449
+ let i = r[n.children] ? $(r[n.children], t, n) : void 0;
450
+ if (t.has(r[n.value]) || i && i.length > 0) {
451
+ let a = t.has(r[n.value]) ? r[n.children] : i;
452
+ e.push({
453
+ ...r,
454
+ children: a
455
+ });
456
+ }
457
+ return e;
458
+ }, []), Se = (e) => {
459
+ let { options: t = [], searchValue: n = "", type: i, filterOption: a, optionRender: o, optionStyle: s, notFoundContent: c } = e, { t: l } = r(), { value: u, setIsOpen: d, setValue: f } = R(), { fieldNames: m } = z(), h = j(() => i === L.TREE ? xe(t, m) : t, [
460
+ t,
461
+ m,
462
+ i
463
+ ]), g = j(() => new F(h, {
464
+ keys: [m.label],
465
+ ignoreLocation: !0,
466
+ threshold: .3
467
+ }), [h, m]), _ = O((e, t) => {
468
+ d?.(!1), f(e, t);
469
+ }, [d, f]), y = O((e, t) => {
470
+ f(e, t);
471
+ }, [f]), b = O((e, t) => {
472
+ d?.(!1), f(e, t);
473
+ }, [d, f]), x = () => {
474
+ if (!a || v(n)) return t;
475
+ let e = g.search(n), r = new Set(e.map((e) => e.item[m.value]));
476
+ return i === L.TREE ? $(t, r, m) : t.filter((e) => r.has(e[m.value]));
477
+ };
478
+ return /* @__PURE__ */ C(S, { children: (() => {
479
+ let e = {
480
+ options: x(),
481
+ searchValue: n,
482
+ optionStyle: s
483
+ };
484
+ if (!v(n) && e.options.length === 0) return c === void 0 ? /* @__PURE__ */ C(p, {
485
+ className: "bsy-select-empty",
486
+ text: l("noDataFound")
487
+ }) : c;
488
+ switch (i) {
489
+ case L.SINGLE: return /* @__PURE__ */ C(Q, {
490
+ ...e,
491
+ value: u,
492
+ fieldNames: m,
493
+ onSelect: _,
494
+ optionRender: o
495
+ });
496
+ case L.MULTIPLE: return /* @__PURE__ */ C(ye, {
497
+ ...e,
498
+ value: u,
499
+ fieldNames: m,
500
+ onSelect: y,
501
+ optionRender: o
502
+ });
503
+ case L.TREE: return /* @__PURE__ */ C(be, {
504
+ ...e,
505
+ value: u,
506
+ fieldNames: m,
507
+ onSelect: b
508
+ });
509
+ default: return null;
510
+ }
511
+ })() });
512
+ }, Ce = (e) => {
513
+ let { options: t = [], type: n = L.SINGLE, filterOption: i = !0, onSearch: a, showSearch: o, searchPlaceholder: s, onPopupScroll: l, notFoundContent: u, themeStyle: d } = e, { t: f } = r(), { searchValue: h = "", setSearchValue: g } = R(), _ = A(h), v = () => e.fetching ? /* @__PURE__ */ C(p, {
514
+ className: "bsy-select-empty",
515
+ text: f("dataSearching")
516
+ }) : t.length === 0 && !h ? u === void 0 ? /* @__PURE__ */ C(p, {
517
+ className: "bsy-select-empty",
518
+ text: f("noData")
519
+ }) : u : /* @__PURE__ */ C(Se, {
520
+ searchValue: _,
521
+ options: t,
522
+ type: n,
523
+ filterOption: i,
524
+ optionRender: e.optionRender,
525
+ optionStyle: e.optionStyle,
526
+ notFoundContent: u
527
+ }), y = O((e) => {
528
+ l?.(e);
529
+ }, [l]);
530
+ return /* @__PURE__ */ C("div", {
531
+ className: "bsy-select-panel",
532
+ style: d,
533
+ children: /* @__PURE__ */ w(T, { children: [o && /* @__PURE__ */ C(c, {
534
+ value: h,
535
+ onChange: (e) => g?.(e),
536
+ onSearch: a,
537
+ searchPlaceholder: s
538
+ }), /* @__PURE__ */ C("div", {
539
+ className: N({ "pt-[4px]": o }),
540
+ children: /* @__PURE__ */ C(m, {
541
+ style: { maxHeight: 300 },
542
+ onScroll: y,
543
+ children: v()
544
+ })
545
+ })] })
546
+ });
547
+ };
548
+ Ce.displayName = "BsySelectPanel";
549
+ //#endregion
550
+ //#region src/components/Select/style/resolveSelectThemeVars.ts
551
+ var we = (e) => {
552
+ if (!e) return {};
553
+ let t = {}, n = e.colorPrimary;
554
+ return s(t, "--bsy-select-color-bg", e.colorBgContainer), s(t, "--bsy-select-color-bg-elevated", e.colorBgElevated ?? e.colorBgContainer), s(t, "--bsy-select-color-text", e.colorText), s(t, "--bsy-select-color-input-value", e.colorInputValue), s(t, "--bsy-select-color-text-placeholder", e.colorTextPlaceholder), s(t, "--bsy-select-color-icon", e.colorIcon), s(t, "--bsy-select-color-icon-hover", e.colorIconHover ?? n), s(t, "--bsy-select-color-border", e.colorBorder), s(t, "--bsy-select-color-border-hover", e.colorBorderHover ?? n), s(t, "--bsy-select-color-bg-disabled", e.colorBgDisabled), s(t, "--bsy-select-color-text-disabled", e.colorTextDisabled), s(t, "--bsy-select-color-border-disabled", e.colorBorderDisabled), s(t, "--bsy-select-item-hover-bg", e.itemHoverBg), s(t, "--bsy-select-item-active-bg", e.itemActiveBg), s(t, "--bsy-select-item-active-color", e.itemActiveColor ?? n), s(t, "--bsy-select-item-color-disabled", e.itemColorDisabled), s(t, "--bsy-select-item-system-color", e.itemSystemColor), s(t, "--bsy-select-color-highlight", e.colorHighlight ?? n), s(t, "--bsy-select-tag-bg", e.tagBg), s(t, "--bsy-select-tag-color", e.tagColor), s(t, "--bsy-select-tag-bg-disabled", e.tagBgDisabled), s(t, "--bsy-select-tag-color-disabled", e.tagColorDisabled), Object.assign(t, d(e.checkbox)), t;
555
+ }, Te = ee((e, i) => {
556
+ let { options: s = [], type: c = L.SINGLE, fieldNames: l, clearable: u = !0, disabled: d = !1, placeholder: f, labelRender: p, onOtherInputChange: m, onOpenChange: g, onPopupScroll: _, prefix: v, suffixIcon: b, ghost: x, inputValueStyle: S, tagStyle: T, zIndex: E, zIndexMask: ee, otherInputPosition: D = "bottom", getPopupContainer: k, theme: A } = e, re = Number.parseFloat(e.popupMinWidth ?? ""), ae = e.popupMatchSelectWidth ?? (Number.isFinite(re) ? re : !0), P = de[c], F = t(E), R = ee ?? F - 1, { t: z } = r(), B = te(), { onChange: V } = e, H = l || fe, [U, W] = oe(e, {
557
+ defaultValue: P === I.SINGLE ? void 0 : [],
558
+ defaultValuePropName: "defaultValue",
559
+ valuePropName: "value",
560
+ trigger: "__NO_CUSTOM_CHANGE__"
561
+ }), [ge, _e] = ie(""), G = M(/* @__PURE__ */ new Map()), [K, q] = ie(() => {
562
+ if (P === I.SINGLE) {
563
+ let e = s.every((e) => e[H.value] !== U), t = s.find((e) => e.isOther === !0);
564
+ return e && t ? U : void 0;
565
+ }
566
+ }), J = O((e, t) => {
567
+ if (!y(e, U)) {
568
+ if (W(e), t) {
569
+ let n = /* @__PURE__ */ new Map();
570
+ if (Array.isArray(e)) {
571
+ let r = Array.isArray(t) ? t : [];
572
+ e.forEach((e) => {
573
+ let t = r.find((t) => t?.[H.value] === e);
574
+ e !== null && t && n.set(e, t);
575
+ });
576
+ } else e !== null && !Array.isArray(t) && n.set(e, t);
577
+ G.current = n;
578
+ }
579
+ V && V(e, t);
580
+ }
581
+ }, [
582
+ V,
583
+ W,
584
+ H,
585
+ U
586
+ ]), [Y, { set: X }] = se(!1), Z = O((e) => {
587
+ e !== Y && (X(e), g?.(e));
588
+ }, [
589
+ X,
590
+ g,
591
+ Y
592
+ ]), { isSelectedOtherOption: Q, shouldShowOtherInput: ye } = j(() => {
593
+ if (P === I.MULTIPLE) return {
594
+ isSelectedOtherOption: !1,
595
+ shouldShowOtherInput: !1
596
+ };
597
+ let e = s.find((e) => e[H.value] === U);
598
+ return e ? {
599
+ isSelectedOtherOption: e.isOther === !0,
600
+ shouldShowOtherInput: e.isOther === !0
601
+ } : s.find((e) => e.isOther === !0) && U ? {
602
+ isSelectedOtherOption: !0,
603
+ shouldShowOtherInput: !0
604
+ } : {
605
+ isSelectedOtherOption: !1,
606
+ shouldShowOtherInput: !1
607
+ };
608
+ }, [
609
+ U,
610
+ s,
611
+ H,
612
+ P
613
+ ]), be = O(() => {
614
+ if (U) {
615
+ if (P === I.SINGLE) {
616
+ let e = s.every((e) => e[H.value] !== U), t = s.find((e) => e.isOther === !0);
617
+ if (e && t) return t[H.value];
618
+ }
619
+ return U;
620
+ } else return U;
621
+ }, [
622
+ U,
623
+ s,
624
+ H,
625
+ P
626
+ ]), xe = j(() => ({
627
+ value: be(),
628
+ setValue: J,
629
+ isOpen: Y,
630
+ setIsOpen: Z,
631
+ getCachedOptionByValue: (e) => G.current.get(e),
632
+ searchValue: ge,
633
+ setSearchValue: _e
634
+ }), [
635
+ be,
636
+ J,
637
+ Y,
638
+ Z,
639
+ ge
640
+ ]), $ = j(() => we(A), [A]), Se = j(() => ({
641
+ fieldNames: l || fe,
642
+ disabled: d,
643
+ otherInputPosition: D
644
+ }), [
645
+ l,
646
+ d,
647
+ D
648
+ ]), Te = j(() => ({
649
+ isSelectedOtherOption: Q,
650
+ otherOptionValue: K,
651
+ setOtherOptionValue: q,
652
+ onOtherInputChange: m
653
+ }), [
654
+ Q,
655
+ K,
656
+ q,
657
+ m
658
+ ]), { refs: Ee, floatingStyles: De, getReferenceProps: Oe, getFloatingProps: ke, referenceStyle: Ae } = h({
659
+ isOpen: Y,
660
+ close: () => {
661
+ Z(!1);
662
+ },
663
+ showMask: e.showMask,
664
+ zIndex: F,
665
+ zIndexMask: R,
666
+ popupMatchSelectWidth: ae,
667
+ offset: {
668
+ x: 0,
669
+ y: 4
670
+ }
671
+ }), { portalRoot: je, portalMountKey: Me, handleExitComplete: Ne } = o(Y, k), Pe = O(() => {
672
+ Q && (q(""), m?.("")), Z(!1), G.current.clear(), J(P === I.SINGLE ? void 0 : []);
673
+ }, [
674
+ Q,
675
+ m,
676
+ J,
677
+ P,
678
+ Z
679
+ ]);
680
+ return ne(i, () => ({
681
+ getOtherOptionValue: () => K,
682
+ setOtherOptionValue: (e) => {
683
+ q(e), m?.(e);
684
+ }
685
+ }), [K, m]), /* @__PURE__ */ C(pe.Provider, {
686
+ value: xe,
687
+ children: /* @__PURE__ */ C(me.Provider, {
688
+ value: Se,
689
+ children: /* @__PURE__ */ C(he.Provider, {
690
+ value: Te,
691
+ children: /* @__PURE__ */ w("div", {
692
+ className: N("bsy-select-container text-sm", e.className),
693
+ style: {
694
+ ...$,
695
+ ...e.style
696
+ },
697
+ children: [
698
+ /* @__PURE__ */ C("div", {
699
+ ref: Ee.setReference,
700
+ className: N("bsy-select-input-event", e.inputClassName),
701
+ ...Oe(),
702
+ style: Ae,
703
+ onClick: () => {
704
+ e.disabled || Z(!Y);
705
+ },
706
+ role: "combobox",
707
+ "aria-expanded": Y,
708
+ "aria-haspopup": "listbox",
709
+ "aria-controls": B,
710
+ "aria-disabled": d,
711
+ children: /* @__PURE__ */ C(ve, {
712
+ mode: P,
713
+ clearable: u,
714
+ disabled: d,
715
+ placeholder: f || z("select"),
716
+ labelRender: p,
717
+ options: s,
718
+ type: c,
719
+ prefix: v,
720
+ suffixIcon: b,
721
+ ghost: x,
722
+ inputValueStyle: S,
723
+ tagStyle: T,
724
+ onClear: Pe
725
+ })
726
+ }),
727
+ /* @__PURE__ */ w(ue, {
728
+ root: je,
729
+ children: [Y && e.showMask ? /* @__PURE__ */ C("div", {
730
+ className: "bsy-select-mask",
731
+ style: { zIndex: R }
732
+ }) : null, /* @__PURE__ */ C(n, {
733
+ zIndex: F,
734
+ children: /* @__PURE__ */ C(ce, {
735
+ onExitComplete: Ne,
736
+ children: Y ? /* @__PURE__ */ C(le.div, {
737
+ ref: Ee.setFloating,
738
+ style: {
739
+ ...De,
740
+ zIndex: F
741
+ },
742
+ ...ke(),
743
+ id: B,
744
+ ...a,
745
+ children: /* @__PURE__ */ C(Ce, {
746
+ ...e,
747
+ options: s,
748
+ onPopupScroll: _,
749
+ themeStyle: $
750
+ })
751
+ }, "bsy-select-panel") : null
752
+ })
753
+ })]
754
+ }, Me),
755
+ ye && D === "bottom" ? e.otherOptionRender ? e.otherOptionRender(K, s) : /* @__PURE__ */ C("div", {
756
+ className: "bsy-select-other-input",
757
+ children: /* @__PURE__ */ C("input", {
758
+ value: K || "",
759
+ onChange: (e) => {
760
+ q(e.target.value), m?.(e.target.value);
761
+ },
762
+ className: "w-full outline-none border-none",
763
+ placeholder: z("context"),
764
+ "aria-label": z("otherOptionInput"),
765
+ role: "textbox"
766
+ })
767
+ }) : null
768
+ ]
769
+ })
770
+ })
771
+ })
772
+ });
773
+ });
774
+ Te.displayName = "BsySelect";
775
+ //#endregion
776
+ export { I as n, L as r, Te as t };