@baishuyun/ui-base 6.5.1 → 6.6.1

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