@baishuyun/ui-base 6.9.1 → 6.10.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 (145) hide show
  1. package/dist/Amap/{Amap-BNnmSPnl.js → Amap-BLSziesG.js} +1 -1
  2. package/dist/Amap/AmapCircle/index.js +4 -4
  3. package/dist/Amap/{AmapCircle-BDW6pnNR.js → AmapCircle-2qupysHe.js} +1 -1
  4. package/dist/Amap/AmapMarker/index.js +5 -5
  5. package/dist/Amap/{AmapMarker-CdoPWdff.js → AmapMarker-xEqoVnFR.js} +2 -2
  6. package/dist/Amap/AmapMarkerCluster/index.js +5 -5
  7. package/dist/Amap/{AmapMarkerCluster-CSIxiVC5.js → AmapMarkerCluster-CvEQa3o9.js} +2 -2
  8. package/dist/Amap/AmapProvider/index.js +6 -5
  9. package/dist/Amap/{AmapProvider-Cwi6WOe0.js → AmapProvider-DqFp3DZ5.js} +2 -2
  10. package/dist/Amap/hooks/index.js +3 -3
  11. package/dist/Amap/{hooks-DAN31s_-.js → hooks-BTcFpdd0.js} +1 -1
  12. package/dist/Amap/index.js +12 -11
  13. package/dist/Calendar/{AllDaySection-a96dIzs3.js → AllDaySection-BqbcPQls.js} +1 -1
  14. package/dist/Calendar/{Calendar-Bcs9mxET.js → Calendar-gEtuBW7Y.js} +9 -10
  15. package/dist/Calendar/{CurrentTimeIndicator-CNKsVEXH.js → CurrentTimeIndicator-dRYot1Rk.js} +24 -18
  16. package/dist/Calendar/{EventCard-B1LoBxth.js → EventCard-Di5UX4pB.js} +1 -2
  17. package/dist/Calendar/{TimeGrid-DIw8oCqY.js → TimeGrid-CBpDFAM4.js} +1 -1
  18. package/dist/Calendar/context/index.js +1 -1
  19. package/dist/Calendar/index.js +15 -14
  20. package/dist/Calendar/subcomponents/AllDaySection/index.js +5 -4
  21. package/dist/Calendar/subcomponents/CurrentTimeIndicator/index.js +4 -3
  22. package/dist/Calendar/subcomponents/EventCard/index.js +4 -3
  23. package/dist/Calendar/subcomponents/TimeAxis/index.js +1 -1
  24. package/dist/Calendar/subcomponents/TimeGrid/index.js +4 -3
  25. package/dist/Calendar/{theme-xnrMsnkg.js → theme-i60ueO92.js} +1 -1
  26. package/dist/Calendar/utils/index.js +1 -1
  27. package/dist/Calendar/utils/layout/index.js +1 -1
  28. package/dist/Calendar/utils/theme/index.js +2 -2
  29. package/dist/Card/index.js +2 -2
  30. package/dist/CheckBox/index.js +1 -1
  31. package/dist/ColorPicker/ColorPicker-CYlrnMwM.js +174 -0
  32. package/dist/ColorPicker/index.js +6 -6
  33. package/dist/ConfigProvider/index.js +4 -3
  34. package/dist/DatePicker/DatePicker-CagGt_f0.js +101 -0
  35. package/dist/DatePicker/{DatePickerPanel-C_TDG3HH.js → DatePickerPanel-CaDZzxMD.js} +3 -3
  36. package/dist/DatePicker/index.js +7 -6
  37. package/dist/DatePicker/style/index.js +2 -2
  38. package/dist/DatePicker/{style-CNtPPsZp.js → style-UKXn1N_p.js} +1 -1
  39. package/dist/DropDown/DropDown-CLuQf970.js +178 -0
  40. package/dist/DropDown/index.js +8 -7
  41. package/dist/DropDown/style/index.js +2 -2
  42. package/dist/DropDown/{style-Fdp-U4md.js → style-LLDVPpPa.js} +1 -1
  43. package/dist/Editor/Buttons-ByO5rS19.js +937 -0
  44. package/dist/Editor/ToolbarPlugin/Buttons/index.js +12 -12
  45. package/dist/Editor/constants/index.js +3 -3
  46. package/dist/Editor/index.js +667 -298
  47. package/dist/Gantt/GanttChart/index.js +11 -10
  48. package/dist/Gantt/{GanttChart-DjwZsxEj.js → GanttChart-DvCAp8Dk.js} +3 -5
  49. package/dist/Gantt/GanttTable/index.js +6 -6
  50. package/dist/Gantt/{GanttTable-xbXD_PWI.js → GanttTable-DyVJOVo3.js} +1 -1
  51. package/dist/Gantt/GanttToolBar/index.js +9 -8
  52. package/dist/Gantt/{GanttToolBar-BTeTsR6Z.js → GanttToolBar-CxT68kmT.js} +2 -3
  53. package/dist/Gantt/index.js +15 -14
  54. package/dist/Gantt/{theme-DLNvgM9X.js → theme-2LyXJRDe.js} +1 -1
  55. package/dist/Gantt/utils/index.js +1 -1
  56. package/dist/Gantt/utils/theme/index.js +2 -2
  57. package/dist/Icon/index.js +1 -1
  58. package/dist/InputTag/{InputTag-hzCCJQ1z.js → InputTag-yRPO90Ku.js} +2 -2
  59. package/dist/InputTag/index.js +5 -5
  60. package/dist/Loading/{Loading-DiywS7ex.js → Loading-BF_dtuLc.js} +1 -1
  61. package/dist/Loading/index.js +4 -4
  62. package/dist/Modal/Modal-Cb7Msq26.js +96 -0
  63. package/dist/Modal/index.js +3 -2
  64. package/dist/NotFoundContent/index.js +1 -1
  65. package/dist/Overlay/OverlayContext-CVSFoyqN.js +23 -0
  66. package/dist/Overlay/index.js +3 -0
  67. package/dist/Radio/index.js +1 -1
  68. package/dist/ScrollBar/{ScrollBar-QhXVe8zd.js → ScrollBar-N2pOLv-8.js} +1 -1
  69. package/dist/ScrollBar/index.js +2 -2
  70. package/dist/Segmented/{Segmented-BDz1hMDT.js → Segmented-BCQRrc65.js} +1 -1
  71. package/dist/Segmented/index.js +2 -2
  72. package/dist/Select/Select-iwzfNy9d.js +753 -0
  73. package/dist/Select/{SelectInputSearch-COUzreau.js → SelectInputSearch-Bc_aPNbG.js} +1 -1
  74. package/dist/Select/index.js +8 -7
  75. package/dist/Table/{Table-yQXQEk6d.js → Table-Cm8zFl2G.js} +2 -2
  76. package/dist/Table/hooks/index.js +1 -1
  77. package/dist/Table/index.js +5 -5
  78. package/dist/Table/style/index.js +2 -2
  79. package/dist/Table/{style-DgiPEsSp.js → style-C4wp0IOM.js} +1 -1
  80. package/dist/Table/utils/index.js +1 -1
  81. package/dist/Tabs/{Tabs-BiKW70CL.js → Tabs-BPWRIwtD.js} +118 -103
  82. package/dist/Tabs/index.js +5 -5
  83. package/dist/Tooltip/Tooltip-Bb3Jx-If.js +172 -0
  84. package/dist/Tooltip/index.js +3 -2
  85. package/dist/Tree/index.js +2 -2
  86. package/dist/Tree/utils/index.js +1 -1
  87. package/dist/components/ColorPicker/ColorPalettes.d.ts +3 -8
  88. package/dist/components/ColorPicker/ColorPicker.type.d.ts +6 -9
  89. package/dist/components/ColorPicker/constants.d.ts +3 -1
  90. package/dist/components/ColorPicker/index.d.ts +1 -1
  91. package/dist/components/ConfigProvider/ConfigProvider.type.d.ts +2 -0
  92. package/dist/components/DatePicker/interface.d.ts +2 -0
  93. package/dist/components/Editor/ToolbarPlugin/Buttons/BulletListButton.d.ts +2 -0
  94. package/dist/components/Editor/ToolbarPlugin/Buttons/CodeButton.d.ts +2 -0
  95. package/dist/components/Editor/ToolbarPlugin/Buttons/CodeLanguageButton.d.ts +2 -0
  96. package/dist/components/Editor/ToolbarPlugin/Buttons/IndentButton.d.ts +2 -0
  97. package/dist/components/Editor/ToolbarPlugin/Buttons/NumberListButton.d.ts +2 -0
  98. package/dist/components/Editor/ToolbarPlugin/Buttons/OutdentButton.d.ts +2 -0
  99. package/dist/components/Editor/ToolbarPlugin/Buttons/PictureButton/UploadImage.d.ts +5 -4
  100. package/dist/components/Editor/ToolbarPlugin/Buttons/RedoButton.d.ts +2 -0
  101. package/dist/components/Editor/ToolbarPlugin/Buttons/StrikeThroughButton.d.ts +2 -0
  102. package/dist/components/Editor/ToolbarPlugin/Buttons/SubscriptButton.d.ts +2 -0
  103. package/dist/components/Editor/ToolbarPlugin/Buttons/SuperscriptButton.d.ts +2 -0
  104. package/dist/components/Editor/ToolbarPlugin/Buttons/UndoButton.d.ts +2 -0
  105. package/dist/components/Editor/ToolbarPlugin/Buttons/index.d.ts +10 -0
  106. package/dist/components/Editor/ToolbarPlugin/context/HistoryStateProvider.d.ts +8 -0
  107. package/dist/components/Editor/ToolbarPlugin/context/TextFormatsContext.d.ts +8 -1
  108. package/dist/components/Editor/ToolbarPlugin/icons/ToolbarIcon.d.ts +13 -0
  109. package/dist/components/Editor/constants/codeLanguages.d.ts +69 -0
  110. package/dist/components/Editor/constants/index.d.ts +2 -0
  111. package/dist/components/Editor/plugins/CodeHighlightPlugin.d.ts +1 -0
  112. package/dist/components/Editor/plugins/LinkColorPlugin.d.ts +2 -0
  113. package/dist/components/Editor/plugins/PasteStripImagePlugin.d.ts +1 -0
  114. package/dist/components/Editor/utils/codeHighlighter.d.ts +12 -0
  115. package/dist/components/Editor/utils/formatTruncatedFilename.d.ts +4 -0
  116. package/dist/components/Editor/utils/stripImagesFromHtml.d.ts +1 -0
  117. package/dist/components/Overlay/OverlayContext.d.ts +16 -0
  118. package/dist/components/Overlay/index.d.ts +2 -0
  119. package/dist/components/Tooltip/Tooltip.type.d.ts +1 -1
  120. package/dist/components/index.d.ts +2 -0
  121. package/dist/index.js +45 -44
  122. package/dist/locale/lang/en-US.json.d.ts +14 -2
  123. package/dist/locale/lang/zh-CN.json.d.ts +14 -2
  124. package/dist/locale/lang/zh-TW.json.d.ts +14 -2
  125. package/dist/style.css +1 -1
  126. package/dist/vendors/{ConfigProvider-DxrZpdIb.js → ConfigProvider-vPuwReNX.js} +70 -36
  127. package/dist/vendors/{LocaleContext-Dcw6C1LX.js → LocaleContext-CN9doEXT.js} +14 -2
  128. package/dist/vendors/{Tree-DXmVRDn0.js → Tree-B09frqQX.js} +1 -0
  129. package/dist/vendors/{useLocale-BKZX2_zw.js → useLocale-sawv8CEL.js} +1 -1
  130. package/dist/vendors/{version-DiV_Cnd8.js → version-DdQLttdL.js} +1 -1
  131. package/package.json +7 -1
  132. package/dist/ColorPicker/ColorPicker-t1uBeATW.js +0 -155
  133. package/dist/DatePicker/DatePicker--kMNwM9Q.js +0 -96
  134. package/dist/DropDown/DropDown-yDH9V_9Y.js +0 -171
  135. package/dist/Editor/Buttons-BhStZyIa.js +0 -620
  136. package/dist/Modal/Modal-LiztSF7x.js +0 -92
  137. package/dist/Select/Select-D6EK7whJ.js +0 -744
  138. package/dist/Tooltip/Tooltip-Ch9lti_7.js +0 -168
  139. package/dist/vendors/color-D6XBXROa.js +0 -12
  140. /package/dist/Amap/{AmapContext-D7Njjm5a.js → AmapContext-CJBe6lld.js} +0 -0
  141. /package/dist/Amap/{useMarkerInfoWindowController-BQmhR0N7.js → useMarkerInfoWindowController-Cjx0xQXw.js} +0 -0
  142. /package/dist/Card/{Card-CtKLNh3n.js → Card-Ds5Rpq--.js} +0 -0
  143. /package/dist/vendors/{cssVars-BYg1matG.js → cssVars-l4-kP_14.js} +0 -0
  144. /package/dist/vendors/{mergeRefs-Bsywq1Vo.js → mergeRefs-TiJ0xjUN.js} +0 -0
  145. /package/dist/vendors/{useFloatingOverlay-BApqkHSu.js → useFloatingOverlay-B3M9k8nj.js} +0 -0
@@ -0,0 +1,753 @@
1
+ import { t as e } from "../Icon/Icon-BBDcb-yw.js";
2
+ import { a as t, i as n } from "../Overlay/OverlayContext-CVSFoyqN.js";
3
+ import { t as r } from "../vendors/useLocale-sawv8CEL.js";
4
+ import { n as i, t as a } from "../vendors/animations-rwUbyoT0.js";
5
+ import { t as o } from "../vendors/useLatchedPopupPortalRoot-4fVhqVT4.js";
6
+ import { t as s } from "./SelectInputSearch-Bc_aPNbG.js";
7
+ import { n as c, t as l } from "../vendors/Tree-B09frqQX.js";
8
+ import { t as u } from "../CheckBox/CheckBox-nBm0u6zX.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-CmVJbuRm.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 re } from "react";
15
+ import { Input as ie } from "antd";
16
+ import j from "clsx";
17
+ import { useControllableValue as ae, useHover as M, useToggle as oe } from "ahooks";
18
+ import { AnimatePresence as se, motion as N } 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: j("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: j({
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: j(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", G = "_select_multiple_input__close_btn_8pd2n_14", K = "_select_multiple_input__tag_content_8pd2n_24", q = {
115
+ select_multiple_input__container: W,
116
+ select_multiple_input__measurement_layer: me,
117
+ select_multiple_input__close_btn: G,
118
+ "select_multiple_input__close_btn--disabled": "_select_multiple_input__close_btn--disabled_8pd2n_21",
119
+ select_multiple_input__tag_content: K
120
+ }, J = 4, Y = 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] = re(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 + J, 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: `${q.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: j(H["bsy-input-tag__item-icon"], "cursor-pointer"),
152
+ children: /* @__PURE__ */ b(e, {
153
+ name: "close",
154
+ style: { fontSize: 12 },
155
+ className: q.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: q.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: j("bsy-select-input-container__input-value", q.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: j(H["bsy-input-tag__item-icon"], {
184
+ [q.select_multiple_input__close_btn]: !s,
185
+ [q.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: q.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
+ Y.displayName = "BsySelectMultipleInput";
219
+ //#endregion
220
+ //#region src/components/Select/utils/tree.ts
221
+ var he = (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: i, 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 = M(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 = he(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: j("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: j("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(Y, {
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: j("bsy-select-input-container__icon"),
274
+ children: /* @__PURE__ */ b(se, {
275
+ mode: "wait",
276
+ children: E?.length && r && v ? /* @__PURE__ */ b(N.div, {
277
+ className: "bsy-select-input-container__icon-motion",
278
+ ...a,
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(), i?.();
286
+ }
287
+ })
288
+ }, "cancel") : /* @__PURE__ */ b(N.div, {
289
+ className: "bsy-select-input-container__icon-motion",
290
+ ...a,
291
+ children: d ? d(S, o) : /* @__PURE__ */ b(e, {
292
+ name: "arrow-down",
293
+ className: j("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: j("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(ie, {
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: j("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: j("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 _e = (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
+ }, Q = (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
+ }, ve = (e, t, n) => e.reduce((e, r) => {
446
+ let i = r[n.children] ? ve(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
+ }, []), ye = (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 ? Q(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 ? ve(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(_e, {
498
+ ...e,
499
+ value: u,
500
+ fieldNames: m,
501
+ onSelect: S
502
+ });
503
+ default: return null;
504
+ }
505
+ })() });
506
+ }, be = (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(ye, {
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: j({ "pt-[4px]": o }),
528
+ children: /* @__PURE__ */ b(f, {
529
+ style: { maxHeight: 300 },
530
+ onScroll: y,
531
+ children: v()
532
+ })
533
+ })] })
534
+ });
535
+ };
536
+ be.displayName = "BsySelectPanel";
537
+ //#endregion
538
+ //#region src/components/Select/Select.tsx
539
+ var $ = w((e, a) => {
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", popupMinWidth: ne, getPopupContainer: ie } = e, M = le[c], P = t(T), L = D ?? P - 1, { t: R } = r(), z = ee(), { onChange: B } = e, V = l || ue, [H, U] = ae(e, {
541
+ defaultValue: M === F.SINGLE ? void 0 : [],
542
+ defaultValuePropName: "defaultValue",
543
+ valuePropName: "value",
544
+ trigger: "__NO_CUSTOM_CHANGE__"
545
+ }), [W, me] = re(""), G = A(/* @__PURE__ */ new Map()), [K, q] = re(() => {
546
+ if (M === F.SINGLE) {
547
+ let e = s.every((e) => e[V.value] !== H), t = s.find((e) => e.isOther === !0);
548
+ return e && t ? H : void 0;
549
+ }
550
+ }), J = E((e, t) => {
551
+ if (U(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?.[V.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
+ B && B(e, t);
563
+ }, [
564
+ B,
565
+ U,
566
+ V
567
+ ]), [Y, { set: he }] = oe(!1), X = E((e) => {
568
+ e !== Y && (he(e), g?.(e));
569
+ }, [
570
+ he,
571
+ g,
572
+ Y
573
+ ]), { isSelectedOtherOption: Z, shouldShowOtherInput: _e } = k(() => {
574
+ if (M === F.MULTIPLE) return {
575
+ isSelectedOtherOption: !1,
576
+ shouldShowOtherInput: !1
577
+ };
578
+ let e = s.find((e) => e[V.value] === H);
579
+ return e ? {
580
+ isSelectedOtherOption: e.isOther === !0,
581
+ shouldShowOtherInput: e.isOther === !0
582
+ } : s.find((e) => e.isOther === !0) && H ? {
583
+ isSelectedOtherOption: !0,
584
+ shouldShowOtherInput: !0
585
+ } : {
586
+ isSelectedOtherOption: !1,
587
+ shouldShowOtherInput: !1
588
+ };
589
+ }, [
590
+ H,
591
+ s,
592
+ V,
593
+ M
594
+ ]), Q = E(() => {
595
+ if (H) {
596
+ if (M === F.SINGLE) {
597
+ let e = s.every((e) => e[V.value] !== H), t = s.find((e) => e.isOther === !0);
598
+ if (e && t) return t[V.value];
599
+ }
600
+ return H;
601
+ } else return H;
602
+ }, [
603
+ H,
604
+ s,
605
+ V,
606
+ M
607
+ ]), ve = k(() => ({
608
+ value: Q(),
609
+ setValue: J,
610
+ isOpen: Y,
611
+ setIsOpen: X,
612
+ getCachedOptionByValue: (e) => G.current.get(e),
613
+ searchValue: W,
614
+ setSearchValue: me
615
+ }), [
616
+ Q,
617
+ J,
618
+ Y,
619
+ X,
620
+ W
621
+ ]), ye = k(() => ({
622
+ fieldNames: l || ue,
623
+ disabled: d,
624
+ otherInputPosition: O
625
+ }), [
626
+ l,
627
+ d,
628
+ O
629
+ ]), $ = k(() => ({
630
+ isSelectedOtherOption: Z,
631
+ otherOptionValue: K,
632
+ setOtherOptionValue: q,
633
+ onOtherInputChange: h
634
+ }), [
635
+ Z,
636
+ K,
637
+ q,
638
+ h
639
+ ]), { refs: xe, floatingStyles: Se, getReferenceProps: Ce, getFloatingProps: we, referenceStyle: Te } = p({
640
+ isOpen: Y,
641
+ close: () => {
642
+ X(!1);
643
+ },
644
+ showMask: e.showMask,
645
+ zIndex: P,
646
+ zIndexMask: L,
647
+ popupMinWidth: ne,
648
+ offset: {
649
+ x: 0,
650
+ y: 4
651
+ }
652
+ }), { portalRoot: Ee, portalMountKey: De, handleExitComplete: Oe } = o(Y, ie), ke = E(() => {
653
+ Z && (q(""), h?.("")), X(!1), G.current.clear(), J(M === F.SINGLE ? void 0 : []);
654
+ }, [
655
+ Z,
656
+ h,
657
+ J,
658
+ M,
659
+ X
660
+ ]);
661
+ return te(a, () => ({
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: ye,
670
+ children: /* @__PURE__ */ b(pe.Provider, {
671
+ value: $,
672
+ children: /* @__PURE__ */ x("div", {
673
+ className: j("bsy-select-container text-sm", e.className),
674
+ style: e.style,
675
+ children: [
676
+ /* @__PURE__ */ b("div", {
677
+ ref: xe.setReference,
678
+ className: j("bsy-select-input-event", e.inputClassName),
679
+ ...Ce(),
680
+ style: Te,
681
+ onClick: () => {
682
+ e.disabled || X(!Y);
683
+ },
684
+ role: "combobox",
685
+ "aria-expanded": Y,
686
+ "aria-haspopup": "listbox",
687
+ "aria-controls": z,
688
+ "aria-disabled": d,
689
+ children: /* @__PURE__ */ b(ge, {
690
+ mode: M,
691
+ clearable: u,
692
+ disabled: d,
693
+ placeholder: f || R("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: ke
703
+ })
704
+ }),
705
+ /* @__PURE__ */ x(ce, {
706
+ root: Ee,
707
+ children: [Y && e.showMask ? /* @__PURE__ */ b("div", {
708
+ className: "bsy-select-mask",
709
+ style: { zIndex: L }
710
+ }) : null, /* @__PURE__ */ b(se, {
711
+ onExitComplete: Oe,
712
+ children: Y ? /* @__PURE__ */ b(n, {
713
+ zIndex: P,
714
+ children: /* @__PURE__ */ b(N.div, {
715
+ ref: xe.setFloating,
716
+ style: {
717
+ ...Se,
718
+ zIndex: P
719
+ },
720
+ ...we(),
721
+ id: z,
722
+ ...i,
723
+ children: /* @__PURE__ */ b(be, {
724
+ ...e,
725
+ options: s,
726
+ onPopupScroll: _
727
+ })
728
+ }, "bsy-select-panel")
729
+ }) : null
730
+ })]
731
+ }, De),
732
+ _e && O === "bottom" ? e.otherOptionRender ? e.otherOptionRender(K, s) : /* @__PURE__ */ b("div", {
733
+ className: j("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: R("context"),
741
+ "aria-label": R("otherOptionInput"),
742
+ role: "textbox"
743
+ })
744
+ }) : null
745
+ ]
746
+ })
747
+ })
748
+ })
749
+ });
750
+ });
751
+ $.displayName = "BsySelect";
752
+ //#endregion
753
+ export { F as n, I as r, $ as t };