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