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