@baishuyun/ui-base 6.6.0 → 6.7.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 (97) hide show
  1. package/dist/Calendar/{AllDaySection-M-b9tRHh.js → AllDaySection-DOMayJvh.js} +3 -3
  2. package/dist/Calendar/{Calendar-C9PhASp0.js → Calendar-DSqL58yh.js} +11 -11
  3. package/dist/Calendar/{CurrentTimeIndicator-Dpi36eVJ.js → CurrentTimeIndicator-CgDrVXin.js} +1 -1
  4. package/dist/Calendar/{EventCard-BIfRqCk5.js → EventCard-BGDwQ-c7.js} +3 -3
  5. package/dist/Calendar/{TimeGrid-Dk3soSo4.js → TimeGrid-KeZ4RsDq.js} +1 -1
  6. package/dist/Calendar/context/index.js +1 -1
  7. package/dist/Calendar/index.js +16 -15
  8. package/dist/Calendar/subcomponents/AllDaySection/index.js +6 -6
  9. package/dist/Calendar/subcomponents/CurrentTimeIndicator/index.js +4 -4
  10. package/dist/Calendar/subcomponents/EventCard/index.js +5 -5
  11. package/dist/Calendar/subcomponents/TimeAxis/index.js +3 -3
  12. package/dist/Calendar/subcomponents/TimeGrid/index.js +2 -2
  13. package/dist/Calendar/{theme-Cgn0zQoC.js → theme-qcYESlpU.js} +2 -2
  14. package/dist/Calendar/utils/index.js +3 -3
  15. package/dist/Calendar/utils/layout/index.js +2 -2
  16. package/dist/Calendar/utils/theme/index.js +1 -1
  17. package/dist/CheckBox/{CheckBox-81R8QKHb.js → CheckBox-GtT43IQ8.js} +1 -1
  18. package/dist/CheckBox/index.js +2 -2
  19. package/dist/ColorPicker/{ColorPicker-aj57lMA5.js → ColorPicker-Hjs4Vp5a.js} +37 -35
  20. package/dist/ColorPicker/index.js +2 -1
  21. package/dist/DatePicker/DatePicker-DnH3zblC.js +96 -0
  22. package/dist/DatePicker/{DatePickerPanel-BjnLfncu.js → DatePickerPanel-CQGrY4wT.js} +2 -2
  23. package/dist/DatePicker/index.js +5 -4
  24. package/dist/DatePicker/style/index.js +1 -1
  25. package/dist/DatePicker/{style-BxWyBhZ3.js → style-BlAisgTN.js} +1 -1
  26. package/dist/DropDown/DropDown-D_Zh6fGX.js +171 -0
  27. package/dist/DropDown/index.js +6 -5
  28. package/dist/DropDown/style/index.js +1 -1
  29. package/dist/DropDown/{style-4LK6rNHe.js → style-WiojFVQn.js} +1 -1
  30. package/dist/Editor/{Buttons-Ds6bLmnl.js → Buttons-De6NyZQs.js} +3 -3
  31. package/dist/Editor/ToolbarPlugin/Buttons/index.js +10 -9
  32. package/dist/Editor/index.js +10 -9
  33. package/dist/Gantt/GanttChart/index.js +13 -12
  34. package/dist/Gantt/{GanttChart-DbI1fvxe.js → GanttChart-MwVs4NFd.js} +7 -7
  35. package/dist/Gantt/GanttTable/index.js +7 -7
  36. package/dist/Gantt/{GanttTable-C3PLGmKr.js → GanttTable-DoDMELyN.js} +5 -5
  37. package/dist/Gantt/GanttToolBar/index.js +9 -8
  38. package/dist/Gantt/{GanttToolBar-8jPQ9BAG.js → GanttToolBar-BAAQMT0x.js} +2 -2
  39. package/dist/Gantt/{collapseKeys-1N9ci2oJ.js → collapseKeys-VeqoqKwC.js} +2 -2
  40. package/dist/Gantt/index.js +20 -19
  41. package/dist/Gantt/{theme-C197Dtjy.js → theme-DLS8mdri.js} +1 -1
  42. package/dist/Gantt/{timelineViewConfig-Dl3AXO45.js → timelineViewConfig-C1T1exJd.js} +1 -1
  43. package/dist/Gantt/utils/index.js +5 -5
  44. package/dist/Gantt/utils/theme/index.js +1 -1
  45. package/dist/InputTag/{InputTag-CGQ5dXyf.js → InputTag-C4iRY5Mw.js} +1 -1
  46. package/dist/InputTag/index.js +2 -2
  47. package/dist/Loading/index.js +1 -1
  48. package/dist/NotFoundContent/index.js +1 -1
  49. package/dist/Radio/index.js +1 -1
  50. package/dist/ScrollBar/{ScrollBar-CSGBOE3e.js → ScrollBar-C4-PtPBc.js} +1 -1
  51. package/dist/ScrollBar/index.js +1 -1
  52. package/dist/Segmented/{Segmented-CzVKrL6o.js → Segmented-Ck2ZmfF7.js} +13 -12
  53. package/dist/Segmented/index.js +1 -1
  54. package/dist/Select/Select-CAoozrW7.js +743 -0
  55. package/dist/Select/index.js +10 -9
  56. package/dist/Table/{Table-BtH9Oa14.js → Table-BZspRsYV.js} +4 -4
  57. package/dist/Table/hooks/index.js +1 -1
  58. package/dist/Table/{hooks-DK8Pf7iH.js → hooks-5ETrGbzY.js} +1 -1
  59. package/dist/Table/index.js +5 -5
  60. package/dist/Table/{processRowspan-D4uv6zLk.js → processRowspan-CSW5J9Rs.js} +1 -1
  61. package/dist/Table/style/index.js +1 -1
  62. package/dist/Table/{style-BwcnT2ee.js → style-qi0sTT0x.js} +1 -1
  63. package/dist/Table/utils/index.js +1 -1
  64. package/dist/Tabs/{Tabs-7wEcxUv6.js → Tabs-sag2ofoG.js} +1 -1
  65. package/dist/Tabs/index.js +2 -2
  66. package/dist/Tooltip/{Tooltip-B_SZOy6k.js → Tooltip-DWWWYn1a.js} +1 -1
  67. package/dist/Tooltip/index.js +1 -1
  68. package/dist/Tree/index.js +3 -3
  69. package/dist/components/Select/__tests__/Select.optionDisabled.test.d.ts +1 -0
  70. package/dist/components/Select/interface.d.ts +0 -1
  71. package/dist/index.js +33 -32
  72. package/dist/style.css +1 -1
  73. package/dist/vendors/{Tree-DqnOGJtB.js → Tree-DMC_MSw1.js} +2 -2
  74. package/dist/vendors/{useFloatingPortal-B2SDNV5C.js → useFloatingPortal-CsNiNirJ.js} +1 -0
  75. package/dist/vendors/useLatchedPopupPortalRoot-hwf14FJ5.js +24 -0
  76. package/package.json +1 -1
  77. package/dist/DatePicker/DatePicker-EIFyC9zF.js +0 -115
  78. package/dist/DropDown/DropDown-B34vfoOs.js +0 -172
  79. package/dist/Select/Select-DTximYG6.js +0 -734
  80. /package/dist/Calendar/{TimeAxis-Chwxo6Yj.js → TimeAxis-f40447Et.js} +0 -0
  81. /package/dist/Calendar/{colorUtils-FNbm3zBQ.js → colorUtils-Be9RqvDV.js} +0 -0
  82. /package/dist/Calendar/{context-CzS6P3nk.js → context-BrzVkPeC.js} +0 -0
  83. /package/dist/Calendar/{layout-Cb39seCc.js → layout-rnPhDP7c.js} +0 -0
  84. /package/dist/CheckBox/{CheckBox-ejvbDr-a.js → CheckBox-D7bCjlkU.js} +0 -0
  85. /package/dist/DatePicker/{ensureDayjsPlugins-DxqbKqon.js → ensureDayjsPlugins-Bz70Nzmi.js} +0 -0
  86. /package/dist/DatePicker/{pickerLocale-CtDOOxxD.js → pickerLocale-g90uglxB.js} +0 -0
  87. /package/dist/Gantt/{GanttHighlightContext-CtT98ZnK.js → GanttHighlightContext-CMXYFPyz.js} +0 -0
  88. /package/dist/Gantt/{columnResize-DFe7F98O.js → columnResize-1nSds2g5.js} +0 -0
  89. /package/dist/Gantt/{constants-CrBb5i5p.js → constants-BSCH_s3S.js} +0 -0
  90. /package/dist/Gantt/{highlightTarget-DtCe7zto.js → highlightTarget-EEsL61Qd.js} +0 -0
  91. /package/dist/Loading/{Loading-ho-6d72M.js → Loading-CV5GuhWQ.js} +0 -0
  92. /package/dist/NotFoundContent/{NotFoundContent-CV9fTylQ.js → NotFoundContent-J-TEnljc.js} +0 -0
  93. /package/dist/Radio/{Radio-C2zJzZc3.js → Radio-CMAwZdP7.js} +0 -0
  94. /package/dist/Select/{SelectInputSearch-BDwg-Noi.js → SelectInputSearch-dfBUnTCY.js} +0 -0
  95. /package/dist/Table/{constants-CuBlYZLO.js → constants-BZfNf-UU.js} +0 -0
  96. /package/dist/vendors/{cssVars-DoQgQ2CM.js → cssVars-B8o94Yao.js} +0 -0
  97. /package/dist/vendors/{mergeRefs-TiJ0xjUN.js → mergeRefs-Bai1cIzv.js} +0 -0
@@ -0,0 +1,743 @@
1
+ import { t as e } from "../ScrollBar/ScrollBar-C4-PtPBc.js";
2
+ import { t } from "../Icon/Icon-SQ5tu-yG.js";
3
+ import { t as n } from "../vendors/useLocale-DZ8XW2VL.js";
4
+ import { n as r, t as i } from "../vendors/animations-Mlw78WYo.js";
5
+ import { t as a } from "../vendors/useLatchedPopupPortalRoot-hwf14FJ5.js";
6
+ import { t as o } from "./SelectInputSearch-dfBUnTCY.js";
7
+ import { n as s, t as c } from "../vendors/Tree-DMC_MSw1.js";
8
+ import { t as l } from "../CheckBox/CheckBox-GtT43IQ8.js";
9
+ import { t as u } from "../NotFoundContent/NotFoundContent-J-TEnljc.js";
10
+ import { t as d } from "../vendors/useFloatingPortal-CsNiNirJ.js";
11
+ import { first as f, isArray as p, isEmpty as m, isNil as h, noop as g } from "lodash-es";
12
+ import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
13
+ import { Suspense as b, createContext as x, forwardRef as S, memo as C, useCallback as w, useContext as T, useDeferredValue as E, useId as ee, useImperativeHandle as te, useLayoutEffect as ne, useMemo as D, useRef as O, useState as k } from "react";
14
+ import { Input as re } from "antd";
15
+ import A from "clsx";
16
+ import { useControllableValue as ie, useHover as j, useToggle as ae } from "ahooks";
17
+ import { AnimatePresence as oe, motion as M } from "motion/react";
18
+ import { FloatingPortal as se } from "@floating-ui/react";
19
+ import ce from "fuse.js";
20
+ //#region src/components/Select/constants.ts
21
+ var N = /* @__PURE__ */ function(e) {
22
+ return e.SINGLE = "single", e.MULTIPLE = "multiple", e;
23
+ }({}), P = /* @__PURE__ */ function(e) {
24
+ 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;
25
+ }({}), le = {
26
+ [P.SINGLE]: N.SINGLE,
27
+ [P.TREE]: N.SINGLE,
28
+ [P.MULTIPLE]: N.MULTIPLE,
29
+ [P.TREE_TAGS]: N.MULTIPLE,
30
+ [P.MEMBER]: N.MULTIPLE,
31
+ [P.DEPARTEMENT]: N.MULTIPLE
32
+ }, ue = {
33
+ label: "label",
34
+ value: "value",
35
+ children: "children"
36
+ }, de = x({
37
+ value: void 0,
38
+ setValue: g,
39
+ isOpen: !1,
40
+ setIsOpen: g
41
+ }), fe = x({
42
+ fieldNames: {
43
+ label: "label",
44
+ value: "value",
45
+ children: "children"
46
+ },
47
+ disabled: !1
48
+ }), pe = x({}), F = () => {
49
+ let e = T(de);
50
+ if (!e) throw Error("Select.* components must be used within a SelectStateContext provider");
51
+ return e;
52
+ }, I = () => {
53
+ let e = T(fe);
54
+ if (!e) throw Error("Select.* components must be used within a SelectConfigContext provider");
55
+ return e;
56
+ }, L = () => T(pe);
57
+ //#endregion
58
+ //#region src/components/Select/utils/fieldAccessor.ts
59
+ function R(e) {
60
+ let t = e;
61
+ return {
62
+ getLabel: (e) => e[t.label],
63
+ getValue: (e) => e[t.value],
64
+ getChildren: (e) => {
65
+ if (t.children) return e[t.children];
66
+ },
67
+ normalizeOption: (e) => ({
68
+ ...e,
69
+ label: e[t.label],
70
+ value: e[t.value],
71
+ children: t.children ? e[t.children] : void 0
72
+ }),
73
+ getFieldNames: () => t
74
+ };
75
+ }
76
+ //#endregion
77
+ //#region src/components/Select/SelectInput/SelectSingleInput/SelectSingleInput.tsx
78
+ var z = C((e) => {
79
+ let { value: t, inputValueStyle: n } = e, { fieldNames: r, otherInputPosition: i } = I(), { isSelectedOtherOption: a, otherOptionValue: o } = L(), s = R(r), c = f(t), l;
80
+ return l = a && o && i === "inline" ? o : e.labelRender && c ? e.labelRender(c) : c ? s.getLabel(c) : "", /* @__PURE__ */ v("div", {
81
+ className: A("bsy-select-input-container__input-value overflow-hidden"),
82
+ style: n,
83
+ children: /* @__PURE__ */ v("div", {
84
+ className: "bsy-select-input-container__input-value-text",
85
+ children: l
86
+ })
87
+ });
88
+ });
89
+ z.displayName = "BsySelectSingleInput";
90
+ //#endregion
91
+ //#region src/components/Select/SelectInput/SelectMultipleInput/OptionTag/option-tag.module.scss
92
+ var B = {
93
+ "bsy-input-tag__container": "_bsy-input-tag__container_znvs6_1",
94
+ "bsy-input-tag__item": "_bsy-input-tag__item_znvs6_7",
95
+ "bsy-input-tag__item--disabled": "_bsy-input-tag__item--disabled_znvs6_20",
96
+ "bsy-input-tag__item-icon": "_bsy-input-tag__item-icon_znvs6_24"
97
+ }, V = S(({ children: e, style: t, disabled: n }, r) => /* @__PURE__ */ v("div", {
98
+ "data-bsy-input-tag": "true",
99
+ className: A({
100
+ [B["bsy-input-tag__item"]]: !0,
101
+ [B["bsy-input-tag__item--disabled"]]: n
102
+ }),
103
+ ref: r,
104
+ style: t,
105
+ children: e
106
+ }));
107
+ V.Container = (e) => /* @__PURE__ */ v("div", {
108
+ className: A(B["bsy-input-tag__container"]),
109
+ children: e.children
110
+ }), V.displayName = "BsyOptionTag";
111
+ //#endregion
112
+ //#region src/components/Select/SelectInput/SelectMultipleInput/select-multiple-input.module.scss
113
+ var H = "_select_multiple_input__container_8pd2n_1", U = "_select_multiple_input__measurement_layer_8pd2n_6", W = "_select_multiple_input__close_btn_8pd2n_14", G = "_select_multiple_input__tag_content_8pd2n_24", K = {
114
+ select_multiple_input__container: H,
115
+ select_multiple_input__measurement_layer: U,
116
+ select_multiple_input__close_btn: W,
117
+ "select_multiple_input__close_btn--disabled": "_select_multiple_input__close_btn--disabled_8pd2n_21",
118
+ select_multiple_input__tag_content: G
119
+ }, q = 4, J = C((e) => {
120
+ let { value: n, labelRender: r, tagStyle: i } = e, { setValue: a } = F(), { fieldNames: o, disabled: s } = I(), c = R(o), l = n?.length ?? 0, [u, d] = k(0), f = O(null), p = O(null);
121
+ ne(() => {
122
+ if (!f.current) return;
123
+ let e = new ResizeObserver((e) => {
124
+ let t = e[0];
125
+ if (!t) return;
126
+ let r = t.contentRect.width, i = t.target.querySelectorAll(".measure-list [data-bsy-input-tag=\"true\"]");
127
+ if (i.length === 0) {
128
+ d(n?.length ?? 0);
129
+ return;
130
+ }
131
+ let a = p.current?.offsetWidth || 65, o = 0, s = 0;
132
+ for (let e = 0; e < i.length; e++) {
133
+ let t = i[e].clientWidth + q, n = e < l - 1 ? a : 0;
134
+ if (o + t + n <= r) o += t, s = e + 1;
135
+ else break;
136
+ }
137
+ s === 0 && l === 1 && (s = 1), u !== s && d(s);
138
+ });
139
+ return e.observe(f.current), () => e.disconnect();
140
+ }, [
141
+ l,
142
+ u,
143
+ n.length
144
+ ]);
145
+ let m = l - u, h = E(m), g = /* @__PURE__ */ v("div", {
146
+ className: `${K.select_multiple_input__measurement_layer} measure-list`,
147
+ children: /* @__PURE__ */ y(V.Container, { children: [n?.map((e, n) => {
148
+ let a = (e) => /* @__PURE__ */ v("div", {
149
+ style: e,
150
+ className: A(B["bsy-input-tag__item-icon"], "cursor-pointer"),
151
+ children: /* @__PURE__ */ v(t, {
152
+ name: "close",
153
+ style: { fontSize: 12 },
154
+ className: K.select_multiple_input__close_btn
155
+ })
156
+ });
157
+ return /* @__PURE__ */ y(V, {
158
+ style: i,
159
+ children: [r && r(e, a), !r && /* @__PURE__ */ y("div", {
160
+ className: K.select_multiple_input__tag_content,
161
+ children: [/* @__PURE__ */ v("span", { children: c.getLabel(e) }), /* @__PURE__ */ v(a, {})]
162
+ })]
163
+ }, n);
164
+ }), u < l && h > 0 && /* @__PURE__ */ y(V, {
165
+ ref: p,
166
+ children: [`+ ${m}`, /* @__PURE__ */ v("span", {
167
+ className: "text-[#666]",
168
+ children: "..."
169
+ })]
170
+ })] })
171
+ }), _ = (e) => {
172
+ if (s) return;
173
+ let t = n.filter((t) => c.getValue(t) !== c.getValue(e));
174
+ a(t.map((e) => c.getValue(e)), t);
175
+ };
176
+ return /* @__PURE__ */ y("div", {
177
+ ref: f,
178
+ className: A("bsy-select-input-container__input-value", K.select_multiple_input__container, "multiple"),
179
+ children: [g, /* @__PURE__ */ y(V.Container, { children: [n?.slice(0, u).map((e, n) => {
180
+ let a = (n) => /* @__PURE__ */ v("div", {
181
+ style: n,
182
+ className: A(B["bsy-input-tag__item-icon"], {
183
+ [K.select_multiple_input__close_btn]: !s,
184
+ [K.select_multiple_input__close_btn + "--disabled"]: s
185
+ }),
186
+ onClick: (t) => {
187
+ t.stopPropagation(), _(e);
188
+ },
189
+ children: /* @__PURE__ */ v(t, {
190
+ name: "close",
191
+ style: { fontSize: 12 }
192
+ })
193
+ });
194
+ return /* @__PURE__ */ y(V, {
195
+ style: {
196
+ ...i,
197
+ flexShrink: u === 1 ? 1 : 0
198
+ },
199
+ disabled: s,
200
+ children: [r && r(e, a), !r && /* @__PURE__ */ y("div", {
201
+ className: K.select_multiple_input__tag_content,
202
+ children: [/* @__PURE__ */ v("span", {
203
+ className: "truncate",
204
+ children: c.getLabel(e)
205
+ }), /* @__PURE__ */ v(a, {})]
206
+ })]
207
+ }, n);
208
+ }), u < l && h > 0 && /* @__PURE__ */ y(V, {
209
+ ref: p,
210
+ children: [`+ ${m} `, /* @__PURE__ */ v("span", {
211
+ className: "text-[#666]",
212
+ children: "..."
213
+ })]
214
+ })] })]
215
+ });
216
+ });
217
+ J.displayName = "BsySelectMultipleInput";
218
+ //#endregion
219
+ //#region src/components/Select/utils/tree.ts
220
+ var Y = (e, t) => {
221
+ let n = [], r = (e) => {
222
+ e.forEach((e) => {
223
+ let { [t.children]: i, ...a } = e;
224
+ n.push(a), i && r(i);
225
+ });
226
+ };
227
+ return r(e), n;
228
+ }, me = ({ placeholder: e, mode: n, clearable: r, onClear: a, disabled: o = !1, labelRender: s, options: c = [], type: l, prefix: u, suffixIcon: d, ghost: f, inputValueStyle: m, tagStyle: g }) => {
229
+ let b = O(null), x = j(o ? null : b), { isOpen: S, value: C, getCachedOptionByValue: w } = F(), { fieldNames: T } = I(), E = D(() => {
230
+ if (h(C)) return [];
231
+ let e = p(C) ? C : [C];
232
+ if (l === P.TREE) {
233
+ let t = R(T), n = Y(c, T);
234
+ return e.map((e) => n.find((n) => t.getValue(n) === e) || w?.(e)).filter((e) => !!e);
235
+ }
236
+ return e.map((e) => c.find((t) => t[T.value] === e) || w?.(e)).filter((e) => !!e);
237
+ }, [
238
+ C,
239
+ c,
240
+ l,
241
+ T,
242
+ w
243
+ ]);
244
+ return /* @__PURE__ */ v("div", {
245
+ className: A("bsy-select-input-container", {
246
+ disabled: o,
247
+ multiple: n === N.MULTIPLE,
248
+ active: S,
249
+ "ghost-style": f
250
+ }),
251
+ ref: b,
252
+ children: /* @__PURE__ */ y("div", {
253
+ className: A("bsy-select-input-container-input"),
254
+ children: [
255
+ u && /* @__PURE__ */ v("div", {
256
+ className: "bsy-select-input-container-input-prefix",
257
+ children: u
258
+ }),
259
+ E?.length ? /* @__PURE__ */ y(_, { children: [n === N.SINGLE && /* @__PURE__ */ v(z, {
260
+ value: E,
261
+ labelRender: s,
262
+ inputValueStyle: m
263
+ }), n === N.MULTIPLE && /* @__PURE__ */ v(J, {
264
+ value: E,
265
+ labelRender: s,
266
+ tagStyle: g
267
+ })] }) : /* @__PURE__ */ v("div", {
268
+ className: "bsy-select-input-container__input-value-placeholder truncate",
269
+ children: e
270
+ }),
271
+ /* @__PURE__ */ v("div", {
272
+ className: A("bsy-select-input-container__icon"),
273
+ children: /* @__PURE__ */ v(oe, {
274
+ mode: "wait",
275
+ children: E?.length && r && x ? /* @__PURE__ */ v(M.div, {
276
+ ...i,
277
+ children: /* @__PURE__ */ v(t, {
278
+ name: "cancel",
279
+ className: "icon hover:text-[#0265ff] text-[#666]",
280
+ role: "button",
281
+ "aria-label": "clear",
282
+ onClick: (e) => {
283
+ e.stopPropagation(), a?.();
284
+ }
285
+ })
286
+ }, "cancel") : /* @__PURE__ */ v(M.div, {
287
+ ...i,
288
+ children: d ? d(S, o) : /* @__PURE__ */ v(t, {
289
+ name: "arrow-down",
290
+ className: A("icon", {
291
+ active: S,
292
+ "text-[#c2c2c2]": o,
293
+ "text-[#666]": !o
294
+ })
295
+ })
296
+ }, "arrow")
297
+ })
298
+ })
299
+ ]
300
+ })
301
+ });
302
+ };
303
+ me.displayName = "BsySelectInput";
304
+ //#endregion
305
+ //#region src/components/Select/OptionList/SingleOptionList/SingleOptionList.tsx
306
+ var X = C((e) => {
307
+ let { options: t, value: n, onSelect: r, searchValue: i = "", fieldNames: a, optionRender: o, optionStyle: c } = e, { otherInputPosition: l } = I(), { otherOptionValue: u, setOtherOptionValue: d, onOtherInputChange: f, isSelectedOtherOption: p = !1 } = L(), m = O(null), h = R(a);
308
+ return /* @__PURE__ */ v("ul", {
309
+ role: "listbox",
310
+ children: t.map((e, t) => {
311
+ let a = h.getValue(e), g = h.getLabel(e), _ = e.systemField || !1, b = e.isOther === !0, x = e.disabled === !0, S = b && l === "inline" && g.length > 6 ? g.slice(0, 6) + "..." : g, C = b ? p : a === n;
312
+ return /* @__PURE__ */ y("li", {
313
+ role: "option",
314
+ "aria-selected": C,
315
+ "aria-disabled": x,
316
+ className: A("rounded-[4px] py-[7px] px-[10px] min-h-[34px]", {
317
+ "cursor-pointer": !x,
318
+ "cursor-not-allowed text-[#999] bg-transparent": x,
319
+ "hover:bg-[#eff0f6]": !x && !C,
320
+ "text-[#4d609f]": !x && _ && !C,
321
+ "text-[#0265ff] bg-[#f0f6ff]": !x && C,
322
+ "flex items-center": b && l === "inline"
323
+ }),
324
+ style: c,
325
+ onClick: () => {
326
+ x || r(a, e);
327
+ },
328
+ children: [/* @__PURE__ */ v("div", {
329
+ title: g,
330
+ children: o ? o(e, { index: t }, C) : /* @__PURE__ */ v(s, {
331
+ text: S,
332
+ highlight: i
333
+ })
334
+ }), b && l === "inline" && /* @__PURE__ */ v("div", {
335
+ className: "ml-2 flex-1",
336
+ onClick: (e) => e.stopPropagation(),
337
+ style: { minWidth: "146px" },
338
+ children: /* @__PURE__ */ v(re, {
339
+ ref: m,
340
+ value: u,
341
+ disabled: x,
342
+ onChange: (e) => {
343
+ let t = e.target.value;
344
+ d?.(t), f?.(t);
345
+ },
346
+ onPressEnter: () => {
347
+ !x && u && r(a, e);
348
+ },
349
+ onBlur: () => {
350
+ !x && u && r(a, e);
351
+ },
352
+ placeholder: "请输入内容"
353
+ })
354
+ })]
355
+ }, `${a}-${t}`);
356
+ })
357
+ });
358
+ });
359
+ X.displayName = "BsySingleSelect";
360
+ //#endregion
361
+ //#region src/components/Select/OptionList/MultOptionList/MultOptionList.tsx
362
+ var Z = (e) => {
363
+ let { t } = n(), { options: r, searchValue: i = "", value: a, onSelect: o, fieldNames: c, optionRender: u } = e, d = R(c), f = a || [], p = r.filter((e) => !e.isOther), m = p.filter((e) => !e.disabled), h = m.map((e) => d.getValue(e)), g = m.length > 0 && m.every((e) => f.includes(d.getValue(e)));
364
+ return /* @__PURE__ */ v("div", {
365
+ className: "bsy-multiple-select",
366
+ children: /* @__PURE__ */ y("ul", {
367
+ className: "bsy-multiple-select-list",
368
+ children: [/* @__PURE__ */ v("li", {
369
+ className: A("flex items-center gap-[8px]", "cursor-pointer hover:bg-[#eff0f6] rounded-[4px] min-h-[34px]", "bsy-multiple-select-item"),
370
+ children: /* @__PURE__ */ v(l, {
371
+ checked: g,
372
+ disabled: m.length === 0,
373
+ onChange: () => {
374
+ let e = g ? f.filter((e) => !h.includes(e)) : [...f, ...h.filter((e) => !f.includes(e))];
375
+ o(e, p.filter((t) => e.includes(d.getValue(t))));
376
+ },
377
+ indeterminate: m.some((e) => f.includes(d.getValue(e))) && !g,
378
+ style: { padding: "7px 10px" },
379
+ children: /* @__PURE__ */ v("span", {
380
+ className: "font-bold text-[#0265ff]",
381
+ children: t(i ? "allSelectedBySearch" : "allSelect")
382
+ })
383
+ })
384
+ }), /* @__PURE__ */ v(l.Group, {
385
+ value: f,
386
+ onChange: (e) => {
387
+ o(e, p.filter((t) => e.includes(d.getValue(t))));
388
+ },
389
+ children: p.map((e, t) => {
390
+ let n = d.getValue(e), r = d.getLabel(e), a = f.includes(n), o = e.systemField || !1, c = e.disabled === !0;
391
+ return /* @__PURE__ */ v("li", {
392
+ "aria-disabled": c,
393
+ className: A("flex items-center gap-[8px] min-h-[34px]", "rounded-[4px]", "bsy-multiple-select-item", {
394
+ "cursor-pointer": !c,
395
+ "cursor-not-allowed text-[#999] bg-transparent": c,
396
+ "hover:bg-[#eff0f6]": !c,
397
+ "text-[#4d609f]": !c && o && !a
398
+ }),
399
+ children: /* @__PURE__ */ v(l, {
400
+ value: n,
401
+ disabled: c,
402
+ style: { padding: "7px 10px" },
403
+ children: u ? u(e, { index: t }, a) : /* @__PURE__ */ v(s, {
404
+ text: r,
405
+ highlight: i
406
+ })
407
+ })
408
+ }, `${n}-${t}`);
409
+ })
410
+ })]
411
+ })
412
+ });
413
+ };
414
+ Z.displayName = "BsyMultipleSelect";
415
+ //#endregion
416
+ //#region src/components/Select/OptionList/TreeOptionList/TreeOptionList.tsx
417
+ var he = (e) => {
418
+ let { options: t, searchValue: n, value: r, onSelect: i, fieldNames: a } = e;
419
+ return /* @__PURE__ */ v("div", {
420
+ className: "bsy-tree-select",
421
+ children: /* @__PURE__ */ v("div", {
422
+ className: "bsy-tree-select-nodes",
423
+ children: /* @__PURE__ */ v(c, {
424
+ data: t,
425
+ searchValue: n,
426
+ fieldNames: a ? {
427
+ title: a.label,
428
+ value: a.value,
429
+ children: a.children
430
+ } : void 0,
431
+ selectedKeys: r ? [r] : [],
432
+ onSelect: i
433
+ })
434
+ })
435
+ });
436
+ }, ge = (e, t) => {
437
+ let n = [], r = (e) => {
438
+ if (e) for (let i of e) n.push(i), r(i[t.children]);
439
+ };
440
+ return r(e), n;
441
+ }, Q = (e, t, n) => e.reduce((e, r) => {
442
+ let i = r[n.children] ? Q(r[n.children], t, n) : void 0;
443
+ if (t.has(r[n.value]) || i && i.length > 0) {
444
+ let a = t.has(r[n.value]) ? r[n.children] : i;
445
+ e.push({
446
+ ...r,
447
+ children: a
448
+ });
449
+ }
450
+ return e;
451
+ }, []), $ = (e) => {
452
+ let { options: t = [], searchValue: r = "", type: i, filterOption: a, optionRender: o, optionStyle: s, notFoundContent: c } = e, { t: l } = n(), { value: d, setIsOpen: f, setValue: p } = F(), { fieldNames: h } = I(), g = D(() => i === P.TREE ? ge(t, h) : t, [
453
+ t,
454
+ h,
455
+ i
456
+ ]), y = D(() => new ce(g, {
457
+ keys: [h.label],
458
+ ignoreLocation: !0,
459
+ threshold: .3
460
+ }), [g, h]), b = w((e, t) => {
461
+ f?.(!1), p(e, t);
462
+ }, [f, p]), x = w((e, t) => {
463
+ p(e, t);
464
+ }, [p]), S = w((e, t) => {
465
+ f?.(!1), p(e, t);
466
+ }, [f, p]), C = () => {
467
+ if (!a || m(r)) return t;
468
+ let e = y.search(r), n = new Set(e.map((e) => e.item[h.value]));
469
+ return i === P.TREE ? Q(t, n, h) : t.filter((e) => n.has(e[h.value]));
470
+ };
471
+ return /* @__PURE__ */ v(_, { children: (() => {
472
+ let e = {
473
+ options: C(),
474
+ searchValue: r,
475
+ optionStyle: s
476
+ };
477
+ if (!m(r) && e.options.length === 0) return c === void 0 ? /* @__PURE__ */ v(u, { text: l("noDataFound") }) : c;
478
+ switch (i) {
479
+ case P.SINGLE: return /* @__PURE__ */ v(X, {
480
+ ...e,
481
+ value: d,
482
+ fieldNames: h,
483
+ onSelect: b,
484
+ optionRender: o
485
+ });
486
+ case P.MULTIPLE: return /* @__PURE__ */ v(Z, {
487
+ ...e,
488
+ value: d,
489
+ fieldNames: h,
490
+ onSelect: x,
491
+ optionRender: o
492
+ });
493
+ case P.TREE: return /* @__PURE__ */ v(he, {
494
+ ...e,
495
+ value: d,
496
+ fieldNames: h,
497
+ onSelect: S
498
+ });
499
+ default: return null;
500
+ }
501
+ })() });
502
+ }, _e = (t) => {
503
+ let { options: r = [], type: i = P.SINGLE, filterOption: a = !0, onSearch: s, showSearch: c, searchPlaceholder: l, onPopupScroll: d, notFoundContent: f } = t, { t: p } = n(), { searchValue: m = "", setSearchValue: h } = F(), g = E(m), _ = (e) => {
504
+ h?.(e), s?.(e);
505
+ }, x = () => t.fetching ? /* @__PURE__ */ v(u, { text: p("dataSearching") }) : r.length === 0 && !m ? f === void 0 ? /* @__PURE__ */ v(u, { text: p("noData") }) : f : /* @__PURE__ */ v($, {
506
+ searchValue: g,
507
+ options: r,
508
+ type: i,
509
+ filterOption: a,
510
+ optionRender: t.optionRender,
511
+ optionStyle: t.optionStyle,
512
+ notFoundContent: f
513
+ }), S = w((e) => {
514
+ d?.(e);
515
+ }, [d]);
516
+ return /* @__PURE__ */ v("div", {
517
+ className: "bsy-select-panel",
518
+ children: /* @__PURE__ */ y(b, { children: [c && /* @__PURE__ */ v(o, {
519
+ value: m,
520
+ onChange: _,
521
+ searchPlaceholder: l
522
+ }), /* @__PURE__ */ v("div", {
523
+ className: A({ "pt-[4px]": c }),
524
+ children: /* @__PURE__ */ v(e, {
525
+ style: { maxHeight: 300 },
526
+ onScroll: S,
527
+ children: x()
528
+ })
529
+ })] })
530
+ });
531
+ };
532
+ _e.displayName = "BsySelectPanel";
533
+ //#endregion
534
+ //#region src/components/Select/Select.tsx
535
+ var ve = S((e, t) => {
536
+ let { options: i = [], type: o = P.SINGLE, fieldNames: s, clearable: c = !0, disabled: l = !1, placeholder: u, labelRender: f, onOtherInputChange: p, onOpenChange: m, onPopupScroll: h, prefix: g, suffixIcon: _, ghost: b, inputValueStyle: x, tagStyle: S, zIndex: C = 1101, zIndexMask: T = 1100, otherInputPosition: E = "bottom", popupMinWidth: ne, getPopupContainer: re } = e, j = le[o], { t: ce } = n(), F = ee(), { onChange: I } = e, L = s || ue, [R, z] = ie(e, {
537
+ defaultValue: j === N.SINGLE ? void 0 : [],
538
+ defaultValuePropName: "defaultValue",
539
+ valuePropName: "value",
540
+ trigger: "__NO_CUSTOM_CHANGE__"
541
+ }), [B, V] = k(""), H = O(/* @__PURE__ */ new Map()), [U, W] = k(() => {
542
+ if (j === N.SINGLE) {
543
+ let e = i.every((e) => e[L.value] !== R), t = i.find((e) => e.isOther === !0);
544
+ return e && t ? R : void 0;
545
+ }
546
+ }), G = w((e, t) => {
547
+ if (z(e), t) {
548
+ let n = /* @__PURE__ */ new Map();
549
+ if (Array.isArray(e)) {
550
+ let r = Array.isArray(t) ? t : [];
551
+ e.forEach((e) => {
552
+ let t = r.find((t) => t?.[L.value] === e);
553
+ e !== null && t && n.set(e, t);
554
+ });
555
+ } else e !== null && !Array.isArray(t) && n.set(e, t);
556
+ H.current = n;
557
+ }
558
+ I && I(e, t);
559
+ }, [
560
+ I,
561
+ z,
562
+ L
563
+ ]), [K, { set: q }] = ae(!1), J = w((e) => {
564
+ e !== K && (q(e), m?.(e));
565
+ }, [
566
+ q,
567
+ m,
568
+ K
569
+ ]), { isSelectedOtherOption: Y, shouldShowOtherInput: X } = D(() => {
570
+ if (j === N.MULTIPLE) return {
571
+ isSelectedOtherOption: !1,
572
+ shouldShowOtherInput: !1
573
+ };
574
+ let e = i.find((e) => e[L.value] === R);
575
+ return e ? {
576
+ isSelectedOtherOption: e.isOther === !0,
577
+ shouldShowOtherInput: e.isOther === !0
578
+ } : i.find((e) => e.isOther === !0) && R ? {
579
+ isSelectedOtherOption: !0,
580
+ shouldShowOtherInput: !0
581
+ } : {
582
+ isSelectedOtherOption: !1,
583
+ shouldShowOtherInput: !1
584
+ };
585
+ }, [
586
+ R,
587
+ i,
588
+ L,
589
+ j
590
+ ]), Z = w(() => {
591
+ if (R) {
592
+ if (j === N.SINGLE) {
593
+ let e = i.every((e) => e[L.value] !== R), t = i.find((e) => e.isOther === !0);
594
+ if (e && t) return t[L.value];
595
+ }
596
+ return R;
597
+ } else return R;
598
+ }, [
599
+ R,
600
+ i,
601
+ L,
602
+ j
603
+ ]), he = D(() => ({
604
+ value: Z(),
605
+ setValue: G,
606
+ isOpen: K,
607
+ setIsOpen: J,
608
+ getCachedOptionByValue: (e) => H.current.get(e),
609
+ searchValue: B,
610
+ setSearchValue: V
611
+ }), [
612
+ Z,
613
+ G,
614
+ K,
615
+ J,
616
+ B
617
+ ]), ge = D(() => ({
618
+ fieldNames: s || ue,
619
+ disabled: l,
620
+ otherInputPosition: E
621
+ }), [
622
+ s,
623
+ l,
624
+ E
625
+ ]), Q = D(() => ({
626
+ isSelectedOtherOption: Y,
627
+ otherOptionValue: U,
628
+ setOtherOptionValue: W,
629
+ onOtherInputChange: p
630
+ }), [
631
+ Y,
632
+ U,
633
+ W,
634
+ p
635
+ ]), { refs: $, floatingStyles: ve, getReferenceProps: ye, getFloatingProps: be, referenceStyle: xe } = d({
636
+ isOpen: K,
637
+ close: () => {
638
+ J(!1);
639
+ },
640
+ showMask: e.showMask,
641
+ zIndex: C,
642
+ zIndexMask: T,
643
+ popupMinWidth: ne,
644
+ offset: {
645
+ x: 0,
646
+ y: 4
647
+ }
648
+ }), { portalRoot: Se, portalMountKey: Ce, handleExitComplete: we } = a(K, re), Te = w(() => {
649
+ Y && (W(""), p?.("")), J(!1), H.current.clear(), G(j === N.SINGLE ? void 0 : []);
650
+ }, [
651
+ Y,
652
+ p,
653
+ G,
654
+ j,
655
+ J
656
+ ]);
657
+ return te(t, () => ({
658
+ getOtherOptionValue: () => U,
659
+ setOtherOptionValue: (e) => {
660
+ W(e), p?.(e);
661
+ }
662
+ }), [U, p]), /* @__PURE__ */ v(de.Provider, {
663
+ value: he,
664
+ children: /* @__PURE__ */ v(fe.Provider, {
665
+ value: ge,
666
+ children: /* @__PURE__ */ v(pe.Provider, {
667
+ value: Q,
668
+ children: /* @__PURE__ */ y("div", {
669
+ className: A("bsy-select-container text-sm", e.className),
670
+ style: e.style,
671
+ children: [
672
+ /* @__PURE__ */ v("div", {
673
+ ref: $.setReference,
674
+ className: A("bsy-select-input-event", e.inputClassName),
675
+ ...ye(),
676
+ style: xe,
677
+ onClick: () => {
678
+ e.disabled || J(!0);
679
+ },
680
+ role: "combobox",
681
+ "aria-expanded": K,
682
+ "aria-haspopup": "listbox",
683
+ "aria-controls": F,
684
+ "aria-disabled": l,
685
+ children: /* @__PURE__ */ v(me, {
686
+ mode: j,
687
+ clearable: c,
688
+ disabled: l,
689
+ placeholder: u || ce("select"),
690
+ labelRender: f,
691
+ options: i,
692
+ type: o,
693
+ prefix: g,
694
+ suffixIcon: _,
695
+ ghost: b,
696
+ inputValueStyle: x,
697
+ tagStyle: S,
698
+ onClear: Te
699
+ })
700
+ }),
701
+ /* @__PURE__ */ y(se, {
702
+ root: Se,
703
+ children: [K && e.showMask ? /* @__PURE__ */ v("div", {
704
+ className: "bsy-select-mask",
705
+ style: { zIndex: T }
706
+ }) : null, /* @__PURE__ */ v(oe, {
707
+ onExitComplete: we,
708
+ children: K ? /* @__PURE__ */ v(M.div, {
709
+ ref: $.setFloating,
710
+ style: ve,
711
+ ...be(),
712
+ id: F,
713
+ ...r,
714
+ children: /* @__PURE__ */ v(_e, {
715
+ ...e,
716
+ options: i,
717
+ onPopupScroll: h
718
+ })
719
+ }, "bsy-select-panel") : null
720
+ })]
721
+ }, Ce),
722
+ X && E === "bottom" ? e.otherOptionRender ? e.otherOptionRender(U, i) : /* @__PURE__ */ v("div", {
723
+ className: A("mt-[6px] w-full px-[10px] py-[7px] bg-white rounded-[4px]", "border border-[#e0e0e0]"),
724
+ children: /* @__PURE__ */ v("input", {
725
+ value: U || "",
726
+ onChange: (e) => {
727
+ W(e.target.value), p?.(e.target.value);
728
+ },
729
+ className: "w-full outline-none border-none placeholder:text-[#999]",
730
+ placeholder: ce("context"),
731
+ "aria-label": "其他选项输入框",
732
+ role: "textbox"
733
+ })
734
+ }) : null
735
+ ]
736
+ })
737
+ })
738
+ })
739
+ });
740
+ });
741
+ ve.displayName = "BsySelect";
742
+ //#endregion
743
+ export { N as n, P as r, ve as t };