@baishuyun/ui-base 6.6.0 → 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 (94) 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/index.js +33 -32
  70. package/dist/vendors/{Tree-DqnOGJtB.js → Tree-DMC_MSw1.js} +2 -2
  71. package/dist/vendors/{useFloatingPortal-B2SDNV5C.js → useFloatingPortal-CsNiNirJ.js} +1 -0
  72. package/dist/vendors/useLatchedPopupPortalRoot-hwf14FJ5.js +24 -0
  73. package/package.json +1 -1
  74. package/dist/DatePicker/DatePicker-EIFyC9zF.js +0 -115
  75. package/dist/DropDown/DropDown-B34vfoOs.js +0 -172
  76. package/dist/Select/Select-DTximYG6.js +0 -734
  77. /package/dist/Calendar/{TimeAxis-Chwxo6Yj.js → TimeAxis-f40447Et.js} +0 -0
  78. /package/dist/Calendar/{colorUtils-FNbm3zBQ.js → colorUtils-Be9RqvDV.js} +0 -0
  79. /package/dist/Calendar/{context-CzS6P3nk.js → context-BrzVkPeC.js} +0 -0
  80. /package/dist/Calendar/{layout-Cb39seCc.js → layout-rnPhDP7c.js} +0 -0
  81. /package/dist/CheckBox/{CheckBox-ejvbDr-a.js → CheckBox-D7bCjlkU.js} +0 -0
  82. /package/dist/DatePicker/{ensureDayjsPlugins-DxqbKqon.js → ensureDayjsPlugins-Bz70Nzmi.js} +0 -0
  83. /package/dist/DatePicker/{pickerLocale-CtDOOxxD.js → pickerLocale-g90uglxB.js} +0 -0
  84. /package/dist/Gantt/{GanttHighlightContext-CtT98ZnK.js → GanttHighlightContext-CMXYFPyz.js} +0 -0
  85. /package/dist/Gantt/{columnResize-DFe7F98O.js → columnResize-1nSds2g5.js} +0 -0
  86. /package/dist/Gantt/{constants-CrBb5i5p.js → constants-BSCH_s3S.js} +0 -0
  87. /package/dist/Gantt/{highlightTarget-DtCe7zto.js → highlightTarget-EEsL61Qd.js} +0 -0
  88. /package/dist/Loading/{Loading-ho-6d72M.js → Loading-CV5GuhWQ.js} +0 -0
  89. /package/dist/NotFoundContent/{NotFoundContent-CV9fTylQ.js → NotFoundContent-J-TEnljc.js} +0 -0
  90. /package/dist/Radio/{Radio-C2zJzZc3.js → Radio-CMAwZdP7.js} +0 -0
  91. /package/dist/Select/{SelectInputSearch-BDwg-Noi.js → SelectInputSearch-dfBUnTCY.js} +0 -0
  92. /package/dist/Table/{constants-CuBlYZLO.js → constants-BZfNf-UU.js} +0 -0
  93. /package/dist/vendors/{cssVars-DoQgQ2CM.js → cssVars-B8o94Yao.js} +0 -0
  94. /package/dist/vendors/{mergeRefs-TiJ0xjUN.js → mergeRefs-Bai1cIzv.js} +0 -0
@@ -1,734 +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, notFoundContent: c } = e, { t: u } = n(), { value: d, setIsOpen: f, setValue: m } = L(), { fieldNames: h } = R(), v = D(() => i === I.TREE ? me(t, h) : t, [
442
- t,
443
- h,
444
- i
445
- ]), y = D(() => new P(v, {
446
- keys: [h.label],
447
- ignoreLocation: !0,
448
- threshold: .3
449
- }), [v, h]), b = C((e, t) => {
450
- f?.(!1), m(e, t);
451
- }, [f, m]), x = C((e, t) => {
452
- m(e, t);
453
- }, [m]), S = C((e, t) => {
454
- f?.(!1), m(e, t);
455
- }, [f, m]), w = () => {
456
- if (!a || p(r)) return t;
457
- let e = y.search(r), n = new Set(e.map((e) => e.item[h.value]));
458
- return i === I.TREE ? $(t, n, h) : t.filter((e) => n.has(e[h.value]));
459
- };
460
- return /* @__PURE__ */ _(g, { children: (() => {
461
- let e = {
462
- options: w(),
463
- searchValue: r,
464
- optionStyle: s
465
- };
466
- if (!p(r) && e.options.length === 0) return c === void 0 ? /* @__PURE__ */ _(l, { text: u("noDataFound") }) : c;
467
- switch (i) {
468
- case I.SINGLE: return /* @__PURE__ */ _(Z, {
469
- ...e,
470
- value: d,
471
- fieldNames: h,
472
- onSelect: b,
473
- optionRender: o
474
- });
475
- case I.MULTIPLE: return /* @__PURE__ */ _(Q, {
476
- ...e,
477
- value: d,
478
- fieldNames: h,
479
- onSelect: x,
480
- optionRender: o
481
- });
482
- case I.TREE: return /* @__PURE__ */ _(pe, {
483
- ...e,
484
- value: d,
485
- fieldNames: h,
486
- onSelect: S
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, notFoundContent: p } = t, { t: m } = n(), { searchValue: h = "", setSearchValue: g } = L(), b = T(h), x = (e) => {
493
- g?.(e), c?.(e);
494
- }, S = () => t.fetching ? /* @__PURE__ */ _(l, { text: m("dataSearching") }) : i.length === 0 && !h ? p === void 0 ? /* @__PURE__ */ _(l, { text: m("noData") }) : p : /* @__PURE__ */ _(he, {
495
- searchValue: b,
496
- options: i,
497
- type: o,
498
- filterOption: s,
499
- optionRender: t.optionRender,
500
- optionStyle: t.optionStyle,
501
- notFoundContent: p
502
- }), w = C((e) => {
503
- f?.(e);
504
- }, [f]);
505
- return /* @__PURE__ */ _(N.div, {
506
- ...r,
507
- children: /* @__PURE__ */ _("div", {
508
- className: "bsy-select-panel",
509
- children: /* @__PURE__ */ v(y, { children: [u && /* @__PURE__ */ _(a, {
510
- value: h,
511
- onChange: x,
512
- searchPlaceholder: d
513
- }), /* @__PURE__ */ _("div", {
514
- className: j({ "pt-[4px]": u }),
515
- children: /* @__PURE__ */ _(e, {
516
- style: { maxHeight: 300 },
517
- onScroll: w,
518
- children: S()
519
- })
520
- })] })
521
- })
522
- });
523
- };
524
- ge.displayName = "BsySelectPanel";
525
- //#endregion
526
- //#region src/components/Select/Select.tsx
527
- var _e = x((e, t) => {
528
- 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, {
529
- defaultValue: M === F.SINGLE ? void 0 : [],
530
- defaultValuePropName: "defaultValue",
531
- valuePropName: "value",
532
- trigger: "__NO_CUSTOM_CHANGE__"
533
- }), [V, H] = k(""), U = O(/* @__PURE__ */ new Map()), [W, G] = k(() => {
534
- if (M === F.SINGLE) {
535
- let e = r.every((e) => e[R.value] !== z), t = r.find((e) => e.isOther === !0);
536
- return e && t ? z : void 0;
537
- }
538
- }), K = C((e, t) => {
539
- if (B(e), t) {
540
- let n = /* @__PURE__ */ new Map();
541
- if (Array.isArray(e)) {
542
- let r = Array.isArray(t) ? t : [];
543
- e.forEach((e) => {
544
- let t = r.find((t) => t?.[R.value] === e);
545
- e !== null && t && n.set(e, t);
546
- });
547
- } else e !== null && !Array.isArray(t) && n.set(e, t);
548
- U.current = n;
549
- }
550
- L && L(e, t);
551
- }, [
552
- L,
553
- B,
554
- R
555
- ]), [q, { set: J }] = re(!1), Y = C((e) => {
556
- e !== q && (J(e), f?.(e));
557
- }, [
558
- J,
559
- f,
560
- q
561
- ]), { isSelectedOtherOption: X, shouldShowOtherInput: de } = D(() => {
562
- if (M === F.MULTIPLE) return {
563
- isSelectedOtherOption: !1,
564
- shouldShowOtherInput: !1
565
- };
566
- let e = r.find((e) => e[R.value] === z);
567
- return e ? {
568
- isSelectedOtherOption: e.isOther === !0,
569
- shouldShowOtherInput: e.isOther === !0
570
- } : r.find((e) => e.isOther === !0) && z ? {
571
- isSelectedOtherOption: !0,
572
- shouldShowOtherInput: !0
573
- } : {
574
- isSelectedOtherOption: !1,
575
- shouldShowOtherInput: !1
576
- };
577
- }, [
578
- z,
579
- r,
580
- R,
581
- M
582
- ]), Z = C(() => {
583
- if (z) {
584
- if (M === F.SINGLE) {
585
- let e = r.every((e) => e[R.value] !== z), t = r.find((e) => e.isOther === !0);
586
- if (e && t) return t[R.value];
587
- }
588
- return z;
589
- } else return z;
590
- }, [
591
- z,
592
- r,
593
- R,
594
- M
595
- ]), Q = D(() => ({
596
- value: Z(),
597
- setValue: K,
598
- isOpen: q,
599
- setIsOpen: Y,
600
- getCachedOptionByValue: (e) => U.current.get(e),
601
- searchValue: V,
602
- setSearchValue: H
603
- }), [
604
- Z,
605
- K,
606
- q,
607
- Y,
608
- V
609
- ]), pe = D(() => ({
610
- fieldNames: a || se,
611
- disabled: s,
612
- otherInputPosition: T
613
- }), [
614
- a,
615
- s,
616
- T
617
- ]), me = D(() => ({
618
- isSelectedOtherOption: X,
619
- otherOptionValue: W,
620
- setOtherOptionValue: G,
621
- onOtherInputChange: d
622
- }), [
623
- X,
624
- W,
625
- G,
626
- d
627
- ]), { refs: $, floatingStyles: he, getReferenceProps: _e, getFloatingProps: ve, referenceStyle: ye } = u({
628
- isOpen: q,
629
- close: () => {
630
- Y(!1);
631
- },
632
- showMask: e.showMask,
633
- zIndex: S,
634
- zIndexMask: w,
635
- popupMinWidth: te,
636
- offset: {
637
- x: 0,
638
- y: 4
639
- }
640
- }), be = D(() => {
641
- let e = q ? A?.() : void 0;
642
- return e?.nodeType === 1 ? e : void 0;
643
- }, [q, A]), xe = be ? "custom-popup-container" : "default-popup-container", Se = C(() => {
644
- X && (G(""), d?.("")), Y(!1), U.current.clear(), K(M === F.SINGLE ? void 0 : []);
645
- }, [
646
- X,
647
- d,
648
- K,
649
- M,
650
- Y
651
- ]);
652
- return ee(t, () => ({
653
- getOtherOptionValue: () => W,
654
- setOtherOptionValue: (e) => {
655
- G(e), d?.(e);
656
- }
657
- }), [W, d]), /* @__PURE__ */ _(ce.Provider, {
658
- value: Q,
659
- children: /* @__PURE__ */ _(le.Provider, {
660
- value: pe,
661
- children: /* @__PURE__ */ _(ue.Provider, {
662
- value: me,
663
- children: /* @__PURE__ */ v("div", {
664
- className: j("bsy-select-container text-sm", e.className),
665
- style: e.style,
666
- children: [
667
- /* @__PURE__ */ _("div", {
668
- ref: $.setReference,
669
- className: j("bsy-select-input-event", e.inputClassName),
670
- ..._e(),
671
- style: ye,
672
- onClick: () => {
673
- e.disabled || Y(!0);
674
- },
675
- role: "combobox",
676
- "aria-expanded": q,
677
- "aria-haspopup": "listbox",
678
- "aria-controls": P,
679
- "aria-disabled": s,
680
- children: /* @__PURE__ */ _(fe, {
681
- mode: M,
682
- clearable: o,
683
- disabled: s,
684
- placeholder: c || N("select"),
685
- labelRender: l,
686
- options: r,
687
- type: i,
688
- prefix: m,
689
- suffixIcon: h,
690
- ghost: y,
691
- inputValueStyle: b,
692
- tagStyle: x,
693
- onClear: Se
694
- })
695
- }),
696
- /* @__PURE__ */ _(ae, {
697
- root: be,
698
- children: /* @__PURE__ */ _(ie, { children: q && /* @__PURE__ */ v(g, { children: [e.showMask && /* @__PURE__ */ _("div", {
699
- className: "bsy-select-mask",
700
- style: { zIndex: w }
701
- }), /* @__PURE__ */ _("div", {
702
- ref: $.setFloating,
703
- style: he,
704
- ...ve(),
705
- id: P,
706
- children: /* @__PURE__ */ _(ge, {
707
- ...e,
708
- options: r,
709
- onPopupScroll: p
710
- })
711
- })] }) })
712
- }, xe),
713
- de && T === "bottom" ? e.otherOptionRender ? e.otherOptionRender(W, r) : /* @__PURE__ */ _("div", {
714
- className: j("mt-[6px] w-full px-[10px] py-[7px] bg-white rounded-[4px]", "border border-[#e0e0e0]"),
715
- children: /* @__PURE__ */ _("input", {
716
- value: W || "",
717
- onChange: (e) => {
718
- G(e.target.value), d?.(e.target.value);
719
- },
720
- className: "w-full outline-none border-none placeholder:text-[#999]",
721
- placeholder: N("context"),
722
- "aria-label": "其他选项输入框",
723
- role: "textbox"
724
- })
725
- }) : null
726
- ]
727
- })
728
- })
729
- })
730
- });
731
- });
732
- _e.displayName = "BsySelect";
733
- //#endregion
734
- export { F as n, I as r, _e as t };