@baishuyun/ui-base 2.3.2 → 2.3.4

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 (52) hide show
  1. package/dist/Card/{Card-BE6v4I-A.js → Card-CaKTq_1y.js} +17 -17
  2. package/dist/Card/index.js +2 -2
  3. package/dist/CheckBox/CheckBox-Cz6KW9Lw.js +33 -0
  4. package/dist/CheckBox/{CheckBox--rXaUgMO.js → CheckBox-l__wOnmH.js} +25 -25
  5. package/dist/CheckBox/index.js +3 -3
  6. package/dist/ColorPicker/ColorPicker-C1kG_eI-.js +168 -0
  7. package/dist/ColorPicker/index.js +4 -5
  8. package/dist/DropDown/DropDown-BAPBTglm.js +162 -0
  9. package/dist/DropDown/index.js +6 -6
  10. package/dist/Editor/{Buttons--dMLPuk2.js → Buttons-CsKKYGbV.js} +207 -204
  11. package/dist/Editor/ToolbarPlugin/Buttons/index.js +12 -13
  12. package/dist/Editor/index.js +207 -196
  13. package/dist/Icon/Icon-CTZCSuVg.js +19 -0
  14. package/dist/Icon/index.js +1 -1
  15. package/dist/InputTag/{InputTag-B6N5MZA2.js → InputTag-V4UnUnGJ.js} +33 -33
  16. package/dist/InputTag/index.js +2 -2
  17. package/dist/Loading/index.js +1 -1
  18. package/dist/Modal/{Modal-FVJpbEgw.js → Modal-DQ5bptu_.js} +1 -1
  19. package/dist/Modal/index.js +2 -2
  20. package/dist/NotFoundContent/index.js +1 -1
  21. package/dist/Radio/{Radio-dyoBNiKF.js → Radio-CZOrtNyn.js} +25 -25
  22. package/dist/Radio/index.js +1 -1
  23. package/dist/Segmented/{Segmented-Dd8glDXI.js → Segmented-DEGgLO-b.js} +15 -15
  24. package/dist/Segmented/index.js +1 -1
  25. package/dist/Select/Select-BoNqxIRo.js +729 -0
  26. package/dist/Select/{SelectInputSearch-CIXBNLFi.js → SelectInputSearch-DMY6Y9B6.js} +2 -2
  27. package/dist/Select/index.js +10 -10
  28. package/dist/Tabs/{Tabs-C79GTyGd.js → Tabs-BqT-_eVo.js} +138 -138
  29. package/dist/Tabs/index.js +4 -5
  30. package/dist/Tree/index.js +4 -4
  31. package/dist/Tree/utils/index.js +1 -1
  32. package/dist/index.js +19 -20
  33. package/dist/vendors/Tree-nIRgDY2s.js +231 -0
  34. package/dist/vendors/{color-BPWy9DvT.js → color-CyuNdAfc.js} +2 -2
  35. package/package.json +4 -2
  36. package/dist/CheckBox/CheckBox-Db8X-pw9.js +0 -33
  37. package/dist/ColorPicker/ColorPicker-BBP-4-so.js +0 -168
  38. package/dist/DropDown/DropDown-CKXi9mXN.js +0 -162
  39. package/dist/Icon/Icon-DppVOyPK.js +0 -19
  40. package/dist/Select/Select-Bd2ECrB0.js +0 -729
  41. package/dist/vendors/Tree-CQR9fvpA.js +0 -231
  42. package/dist/vendors/clsx-DNOE4Gl8.js +0 -16
  43. package/dist/vendors/fuse.js-BKtvbTjL.js +0 -877
  44. package/dist/vendors/lexical-hZliMgDv.js +0 -6439
  45. package/dist/vendors/lodash-es-Bu9xU1fK.js +0 -334
  46. package/dist/vendors/simplebar-react-CFlS-Nm9.js +0 -370
  47. package/dist/vendors/tinycolor2-DToeAEPD.js +0 -726
  48. /package/dist/Loading/{Loading-Bi5NO-Ky.js → Loading-Dy5A--HK.js} +0 -0
  49. /package/dist/NotFoundContent/{NotFoundContent-CTPpcZOt.js → NotFoundContent-1-41e1rN.js} +0 -0
  50. /package/dist/vendors/{animations-C5JKFkz4.js → animations-DvjIfVz9.js} +0 -0
  51. /package/dist/vendors/{useFloatingPortal-BA6P5GxV.js → useFloatingPortal-W4pliYWU.js} +0 -0
  52. /package/dist/vendors/{useLocale-BfT0V1j4.js → useLocale-BXnqO-Ju.js} +0 -0
@@ -0,0 +1,231 @@
1
+ import { t as e } from "../Icon/Icon-CTZCSuVg.js";
2
+ import { t } from "../CheckBox/CheckBox-l__wOnmH.js";
3
+ import { t as n } from "../Radio/Radio-CZOrtNyn.js";
4
+ import { getMatchingNodesPaths as r, getNodePath as i } from "../Tree/utils/index.js";
5
+ import { noop as a } from "lodash-es";
6
+ import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
7
+ import l, { createContext as u, useCallback as d, useContext as f, useEffect as p, useMemo as m } from "react";
8
+ import h from "clsx";
9
+ import { useControllableValue as g } from "ahooks";
10
+ import { AnimatePresence as _, motion as v } from "motion/react";
11
+ //#region src/components/Select/HighlightText/HighlightText.tsx
12
+ var y = ({ text: e, highlight: t, truncate: n = !0 }) => {
13
+ let [r, i] = m(() => e && t ? [e.toLowerCase(), t.toLowerCase()] : [], [e, t]), a = d(() => {
14
+ if (!t.trim()) return [{
15
+ text: e,
16
+ isMatch: !1
17
+ }];
18
+ let n = i ? r?.indexOf(i) : -1;
19
+ return n === -1 || n === void 0 ? [{
20
+ text: e,
21
+ isMatch: !1
22
+ }] : [
23
+ {
24
+ text: e.slice(0, n),
25
+ isMatch: !1
26
+ },
27
+ {
28
+ text: e.slice(n, n + t.length),
29
+ isMatch: !0
30
+ },
31
+ {
32
+ text: e.slice(n + t.length),
33
+ isMatch: !1
34
+ }
35
+ ].filter((e) => e.text);
36
+ }, [
37
+ e,
38
+ t,
39
+ r,
40
+ i
41
+ ])(), o = {
42
+ color: "#0265ff",
43
+ fontWeight: 500
44
+ };
45
+ return /* @__PURE__ */ s("div", {
46
+ className: n ? "select-none text-ellipsis overflow-hidden whitespace-nowrap truncate w-full" : "select-none whitespace-nowrap w-full",
47
+ children: a.map((e, t) => e.isMatch ? /* @__PURE__ */ s("span", {
48
+ style: o,
49
+ children: e.text
50
+ }, t) : /* @__PURE__ */ s("span", { children: e.text }, t))
51
+ });
52
+ };
53
+ y.displayName = "HighlightText";
54
+ var b = l.memo(y), x = u({
55
+ searchValue: "",
56
+ selectedKeys: [],
57
+ expandedKeys: [],
58
+ parentCheckable: !1,
59
+ onSelect: a,
60
+ onExpand: a,
61
+ icon: void 0,
62
+ switcherIcon: void 0,
63
+ checkType: "default",
64
+ showSwitcher: !0
65
+ }), S = 22, C = ({ node: r, level: i = 0, fieldNames: a }) => {
66
+ let u = f(x), { searchValue: d, selectedKeys: p, expandedKeys: m, onSelect: g, onExpand: y, onDeSelect: w, parentCheckable: T, checkType: E, showSwitcher: D } = f(x), O = r[a.children] && r[a.children].length > 0, k = p.includes(r[a.value]), A = O ? m.includes(r[a.value]) : !1, j = () => {
67
+ if (r.checkable === !1) {
68
+ O && y?.(r[a.value], !A);
69
+ return;
70
+ }
71
+ if (O) {
72
+ T ? M() : y?.(r[a.value], !A);
73
+ return;
74
+ }
75
+ M();
76
+ }, M = () => {
77
+ k ? w?.(r[a.value]) : g?.(r[a.value], r);
78
+ }, N = (e) => {
79
+ e.stopPropagation(), O && y?.(r[a.value], !A);
80
+ }, P = (e = !1) => {
81
+ let t = r.icon || u.icon;
82
+ if (!t) return null;
83
+ let n = typeof t == "function" ? t(r) : t;
84
+ return l.isValidElement(n) ? /* @__PURE__ */ s("span", {
85
+ className: h({
86
+ "text-[#0265ff]": e,
87
+ "text-[#73819c]": !e
88
+ }),
89
+ children: n
90
+ }) : null;
91
+ }, F = (t) => O ? u.switcherIcon ? u.switcherIcon(t) : /* @__PURE__ */ s(e, {
92
+ name: "arrow-right",
93
+ className: h("transition-transform duration-300 ease-in-out text-[#666]", { "rotate-90": t })
94
+ }) : null, I = () => O && !T || E === "default" || r.checkable === !1 ? null : /* @__PURE__ */ c("div", {
95
+ className: "ml-auto shrink-0",
96
+ children: [E === "radio" && /* @__PURE__ */ s(n, { checked: k }), E === "checkbox" && /* @__PURE__ */ s(t, { checked: k })]
97
+ });
98
+ return /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s("div", {
99
+ className: h("rounded-[4px] cursor-pointer", {
100
+ "text-[#0265ff] bg-[#f0f6ff]": k && E === "default",
101
+ "hover:bg-[#f3f3f3]": !k || E !== "default"
102
+ }),
103
+ onClick: j,
104
+ children: /* @__PURE__ */ c("div", {
105
+ className: "flex items-center px-[10px] py-[7px] gap-x-[6px]",
106
+ style: { marginLeft: `${i * S}px` },
107
+ children: [
108
+ /* @__PURE__ */ s("div", {
109
+ className: h("w-4 h-4 flex items-center justify-center flex-shrink-0", { hidden: !D }),
110
+ onClick: N,
111
+ children: F(A)
112
+ }),
113
+ P(k),
114
+ l.isValidElement(r[a.title]) ? r[a.title] : /* @__PURE__ */ s(b, {
115
+ text: r[a.title],
116
+ highlight: d,
117
+ truncate: !1
118
+ }),
119
+ I()
120
+ ]
121
+ })
122
+ }), O && /* @__PURE__ */ s(_, {
123
+ initial: !1,
124
+ children: A ? /* @__PURE__ */ s(v.div, {
125
+ initial: {
126
+ height: 0,
127
+ opacity: 0
128
+ },
129
+ animate: {
130
+ height: "auto",
131
+ opacity: 1
132
+ },
133
+ exit: {
134
+ height: 0,
135
+ opacity: 0
136
+ },
137
+ transition: {
138
+ duration: .2,
139
+ ease: [
140
+ .4,
141
+ 0,
142
+ .2,
143
+ 1
144
+ ]
145
+ },
146
+ children: /* @__PURE__ */ s("div", {
147
+ className: "min-w-max",
148
+ children: r[a.children]?.map((e) => /* @__PURE__ */ s(C, {
149
+ node: e,
150
+ level: i + 1,
151
+ fieldNames: a
152
+ }, e[a.value]))
153
+ })
154
+ }, "children") : null
155
+ })] });
156
+ }, w = (e) => {
157
+ let { data: t, searchValue: n = "", fieldNames: a = {
158
+ title: "title",
159
+ value: "value",
160
+ children: "children"
161
+ }, icon: o, switcherIcon: c, onSelect: l, parentCheckable: u = !1, checkType: f = "default", defaultExpandedKeys: m, showSwitcher: h = !0, onDeSelect: _ } = e, [v, y] = g(e, {
162
+ defaultValuePropName: "defaultSelectedKeys",
163
+ valuePropName: "selectedKeys",
164
+ defaultValue: [],
165
+ trigger: "__DO_NOT_CALLED__"
166
+ }), [b, S] = g(e, {
167
+ valuePropName: "expandedKeys",
168
+ defaultValuePropName: "defaultExpandedKeys",
169
+ defaultValue: (() => {
170
+ let n = /* @__PURE__ */ new Set();
171
+ return e.selectedKeys?.length ? (e.selectedKeys.forEach((e) => {
172
+ let r = i(t, e, a);
173
+ r && r.length > 1 && r.slice(0, -1).forEach((e) => n.add(e));
174
+ }), [...n]) : [];
175
+ })(),
176
+ trigger: "onExpand"
177
+ });
178
+ p(() => {
179
+ if (!n) {
180
+ if (v.length || m?.length) return;
181
+ S([]);
182
+ return;
183
+ }
184
+ let e = /* @__PURE__ */ new Set(), i = r(t, n, a);
185
+ if (i.length === 0) {
186
+ S([]);
187
+ return;
188
+ }
189
+ i.forEach((t) => t.slice(0, -1).forEach((t) => e.add(t))), e.size !== 0 && S([...e]);
190
+ }, [n]);
191
+ let w = d((e, t) => {
192
+ y((t) => f === "checkbox" ? [...new Set([...t, e])] : [e]), l && l?.(e, t);
193
+ }, [
194
+ l,
195
+ y,
196
+ f
197
+ ]), T = (e, t) => {
198
+ w(e, t);
199
+ }, E = d((e) => {
200
+ y((t) => t.filter((t) => t !== e)), _?.(e);
201
+ }, [y, _]), D = (e, t) => {
202
+ S(t ? [...b, e] : b.filter((t) => t !== e));
203
+ };
204
+ if (!t?.length) return null;
205
+ let O = {
206
+ searchValue: n,
207
+ selectedKeys: v,
208
+ expandedKeys: b,
209
+ onSelect: T,
210
+ onDeSelect: E,
211
+ onExpand: D,
212
+ icon: o,
213
+ switcherIcon: c,
214
+ checkType: f,
215
+ parentCheckable: u,
216
+ showSwitcher: h
217
+ };
218
+ return /* @__PURE__ */ s(x.Provider, {
219
+ value: O,
220
+ children: /* @__PURE__ */ s("div", {
221
+ className: "bsy-tree text-sm",
222
+ children: t.map((e) => /* @__PURE__ */ s(C, {
223
+ node: e,
224
+ fieldNames: a
225
+ }, e[a.value]))
226
+ })
227
+ });
228
+ };
229
+ w.displayName = "BsyTree";
230
+ //#endregion
231
+ export { b as n, w as t };
@@ -1,5 +1,5 @@
1
- import { a as e } from "./lodash-es-Bu9xU1fK.js";
2
- import { t } from "./tinycolor2-DToeAEPD.js";
1
+ import { isEmpty as e } from "lodash-es";
2
+ import t from "tinycolor2";
3
3
  //#region src/utils/color.ts
4
4
  function n(e, t) {
5
5
  if (t < 0 || t > 1) return console.error("Alpha value must be between 0 and 1."), null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baishuyun/ui-base",
3
- "version": "2.3.2",
3
+ "version": "2.3.4",
4
4
  "type": "module",
5
5
  "description": "百数云低代码平台通用组件库",
6
6
  "author": "bsy-fe team",
@@ -85,7 +85,7 @@
85
85
  },
86
86
  "project": {
87
87
  "iconfont": {
88
- "scriptUrl": "https://at.alicdn.com/t/c/font_4786625_djm4gsgobsp.js"
88
+ "scriptUrl": "https://at.alicdn.com/t/c/font_4786625_ofg0ibxfhle.js"
89
89
  }
90
90
  },
91
91
  "scripts": {
@@ -93,6 +93,8 @@
93
93
  "build:debug": "vite build --mode debug",
94
94
  "build:watch": "vite build --watch --mode debug",
95
95
  "dev": "vite build --watch --mode debug",
96
+ "test": "vitest run --passWithNoTests",
97
+ "test:watch": "vitest --passWithNoTests",
96
98
  "type-check": "tsc --noEmit",
97
99
  "lint": "eslint . --ext .ts,.tsx",
98
100
  "lint:fix": "eslint . --ext .ts,.tsx --fix",
@@ -1,33 +0,0 @@
1
- import { t as e } from "../vendors/clsx-DNOE4Gl8.js";
2
- import { n as t, r as n, t as r } from "./CheckBox--rXaUgMO.js";
3
- import { jsx as i } from "react/jsx-runtime";
4
- import { useControllableValue as a } from "ahooks";
5
- //#region src/components/CheckBox/Group.tsx
6
- var o = ({ disabled: r, layout: o = t.NONE, children: s, className: c, ...l }) => {
7
- let [u, d] = a(l, {
8
- defaultValue: [],
9
- valuePropName: "value",
10
- defaultValuePropName: "defaultValue",
11
- trigger: "onChange"
12
- }), f = e("flex", {
13
- "flex-col": o === t.NONE,
14
- "flex-col gap-[10px]": o === t.VERTICAL,
15
- "flex-row gap-y-[10px] gap-x-[20px] flex-wrap": o === t.HORIZONTAL,
16
- [c || ""]: !!c
17
- });
18
- return /* @__PURE__ */ i(n.Provider, {
19
- value: {
20
- value: u,
21
- onChange: d,
22
- disabled: r,
23
- layout: o
24
- },
25
- children: /* @__PURE__ */ i("div", {
26
- className: f,
27
- children: s
28
- })
29
- });
30
- }, s = r;
31
- s.Group = o;
32
- //#endregion
33
- export { s as t };
@@ -1,168 +0,0 @@
1
- import { u as e } from "../vendors/lodash-es-Bu9xU1fK.js";
2
- import { t } from "../Icon/Icon-DppVOyPK.js";
3
- import { t as n } from "../vendors/useLocale-BfT0V1j4.js";
4
- import { t as r } from "../vendors/clsx-DNOE4Gl8.js";
5
- import { t as i } from "../vendors/tinycolor2-DToeAEPD.js";
6
- import { t as a } from "../vendors/color-BPWy9DvT.js";
7
- import { n as o } from "../vendors/animations-C5JKFkz4.js";
8
- import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
9
- import { cloneElement as u, isValidElement as d, useMemo as f, useRef as p, useState as m } from "react";
10
- import { useControllableValue as h } from "ahooks";
11
- import { ColorPicker as g } from "antd";
12
- import { AnimatePresence as _, motion as v } from "motion/react";
13
- import { FloatingPortal as y, flip as b, offset as x, shift as S, useClick as C, useDismiss as w, useFloating as T, useInteractions as E } from "@floating-ui/react";
14
- //#region src/components/ColorPicker/constants.ts
15
- var D = [
16
- "rgba(240, 102, 72, 1)",
17
- "rgba(255, 197, 2, 1)",
18
- "rgba(74, 204, 140, 1)",
19
- "rgba(74, 192, 236, 1)",
20
- "rgba(255, 153, 33, 1)",
21
- "rgba(101, 101, 101, 1)",
22
- "rgba(255, 156, 136, 1)",
23
- "rgba(98, 98, 206, 1)",
24
- "rgba(241, 104, 182, 1)",
25
- "rgba(55, 103, 241, 1)",
26
- "rgba(162, 206, 30, 1)",
27
- "rgba(179, 179, 179, 1)",
28
- "rgba(0, 0, 0, 1)",
29
- "rgba(102, 102, 102, 1)",
30
- "rgba(153, 153, 153, 1)",
31
- "rgba(194, 194, 194, 1)",
32
- "rgba(224, 224, 224, 1)",
33
- "rgba(77, 96, 159, 1)"
34
- ], O = (e = "bottom-start") => {
35
- let [t, n] = m(!1), { refs: r, floatingStyles: i, context: a } = T({
36
- open: t,
37
- onOpenChange: n,
38
- placement: e,
39
- middleware: [
40
- x(4),
41
- b(),
42
- S({ padding: 8 })
43
- ]
44
- }), { getReferenceProps: o, getFloatingProps: s } = E([C(a), w(a)]);
45
- return {
46
- isOpen: t,
47
- refs: r,
48
- floatingStyles: i,
49
- getReferenceProps: o,
50
- getFloatingProps: s,
51
- setIsOpen: n
52
- };
53
- }, k = "_preview_11t7y_62", A = {
54
- "bsy-color-picker__floating": "_bsy-color-picker__floating_11t7y_1",
55
- "bsy-color-picker__content": "_bsy-color-picker__content_11t7y_4",
56
- "bsy-color-picker__grid": "_bsy-color-picker__grid_11t7y_11",
57
- "bsy-color-picker__preset-colors-title": "_bsy-color-picker__preset-colors-title_11t7y_15",
58
- "bsy-color-picker__preset-colors-grid": "_bsy-color-picker__preset-colors-grid_11t7y_19",
59
- "bsy-color-picker__preset-colors-item": "_bsy-color-picker__preset-colors-item_11t7y_24",
60
- "bsy-color-picker__custom-color-title": "_bsy-color-picker__custom-color-title_11t7y_48",
61
- "bsy-color-picker__custom-color-btn": "_bsy-color-picker__custom-color-btn_11t7y_52",
62
- preview: k,
63
- "bsy-color-picker__custom-color-btn--active": "_bsy-color-picker__custom-color-btn--active_11t7y_62",
64
- "bsy-color-picker__custom-color-btn--preview": "_bsy-color-picker__custom-color-btn--preview_11t7y_66",
65
- "bsy-color-picker__custom-color-content": "_bsy-color-picker__custom-color-content_11t7y_69",
66
- "bsy-color-picker__check-icon": "_bsy-color-picker__check-icon_11t7y_73"
67
- }, j = ({ currentColor: e, onColorSelect: n, options: r, style: o }) => /* @__PURE__ */ c("div", {
68
- className: A["bsy-color-picker__preset-colors-grid"],
69
- style: o,
70
- children: r.map((r) => /* @__PURE__ */ c("div", {
71
- className: A["bsy-color-picker__preset-colors-item"],
72
- style: {
73
- backgroundColor: r,
74
- "--hover-color": i(r).setAlpha(.5).toRgbString()
75
- },
76
- onClick: () => n(r),
77
- children: a(e, r) && /* @__PURE__ */ c(t, {
78
- name: "checkthebox",
79
- className: A["bsy-color-picker__check-icon"]
80
- })
81
- }, r))
82
- }), M = (t) => {
83
- let { children: r, placement: i = "bottom-start", disabled: m = !1, presetColors: g, getPopupContainer: b } = t, { t: x } = n(), [S, C] = h(t, { defaultValue: t.value }), { isOpen: w, refs: T, floatingStyles: E, getReferenceProps: k, getFloatingProps: M } = O(i), P = d(r) ? u(r, {
84
- ...k(),
85
- ref: T.setReference,
86
- disabled: m
87
- }) : r, F = e(g) && g.length ? g : D, I = p(F.some((e) => a(e, S)) ? [] : [S]);
88
- return /* @__PURE__ */ l(s, { children: [P, /* @__PURE__ */ c(y, {
89
- root: f(() => w ? b?.() : void 0, [w, b]),
90
- children: /* @__PURE__ */ c(_, { children: w && /* @__PURE__ */ c("div", {
91
- ref: T.setFloating,
92
- style: E,
93
- ...M(),
94
- className: A["bsy-color-picker__floating"],
95
- children: /* @__PURE__ */ c(v.div, {
96
- ...o,
97
- children: /* @__PURE__ */ c("div", {
98
- className: A["bsy-color-picker__content"],
99
- children: /* @__PURE__ */ l("div", {
100
- className: A["bsy-color-picker__grid"],
101
- children: [/* @__PURE__ */ l("div", {
102
- className: A["bsy-color-picker__preset-colors"],
103
- children: [/* @__PURE__ */ c("div", {
104
- className: A["bsy-color-picker__preset-colors-title"],
105
- children: x("presetColors")
106
- }), /* @__PURE__ */ c(j, {
107
- currentColor: S,
108
- onColorSelect: C,
109
- options: F
110
- })]
111
- }), /* @__PURE__ */ c(N, {
112
- value: S,
113
- onChange: C,
114
- onColorInput: t.onColorInput,
115
- options: F,
116
- list: I.current
117
- })]
118
- })
119
- })
120
- })
121
- }) })
122
- })] });
123
- }, N = (e) => {
124
- let { list: i } = e, [a, o] = m(), [s, u] = m(!1), { t: d } = n();
125
- return /* @__PURE__ */ l("div", {
126
- className: A["bsy-color-picker__custom-color"],
127
- children: [/* @__PURE__ */ c("div", {
128
- className: A["bsy-color-picker__custom-color-title"],
129
- children: d("customColor")
130
- }), /* @__PURE__ */ l("div", {
131
- className: A["bsy-color-picker__custom-color-content"],
132
- children: [/* @__PURE__ */ c(g, {
133
- value: a,
134
- onChange: (t) => {
135
- let n = t.toRgbString();
136
- o(n), e.onColorInput?.(n);
137
- },
138
- open: s,
139
- onOpenChange: (t) => {
140
- u(t), !t && a && (i.includes(a) || i.unshift(a), e.onChange(a), o(void 0));
141
- },
142
- children: /* @__PURE__ */ c("div", {
143
- className: r(A["bsy-color-picker__custom-color-btn"], {
144
- [A["bsy-color-picker__custom-color-btn--active"]]: s && !a,
145
- [A["bsy-color-picker__custom-color-btn--preview"]]: !!a
146
- }),
147
- role: "button",
148
- style: { backgroundColor: a || void 0 },
149
- onClick: () => {
150
- u(!0);
151
- },
152
- children: /* @__PURE__ */ c(t, {
153
- name: "add",
154
- style: { visibility: a ? "hidden" : "visible" }
155
- })
156
- })
157
- }), /* @__PURE__ */ c(j, {
158
- currentColor: e.value,
159
- onColorSelect: e.onChange,
160
- options: i.slice(0, 5),
161
- style: { gridTemplateColumns: "repeat(5, 1fr)" }
162
- })]
163
- })]
164
- });
165
- };
166
- M.displayName = "BsyColorPicker";
167
- //#endregion
168
- export { D as n, M as t };
@@ -1,162 +0,0 @@
1
- import { a as e, i as t } from "../vendors/lodash-es-Bu9xU1fK.js";
2
- import { t as n } from "../vendors/useLocale-BfT0V1j4.js";
3
- import { t as r } from "../vendors/clsx-DNOE4Gl8.js";
4
- import { n as i } from "../vendors/animations-C5JKFkz4.js";
5
- import { t as a } from "../Select/SelectInputSearch-CIXBNLFi.js";
6
- import { t as o } from "../NotFoundContent/NotFoundContent-CTPpcZOt.js";
7
- import { t as s } from "../vendors/fuse.js-BKtvbTjL.js";
8
- import { t as c } from "../vendors/simplebar-react-CFlS-Nm9.js";
9
- import { t as l } from "../vendors/useFloatingPortal-BA6P5GxV.js";
10
- import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
11
- import { cloneElement as p, isValidElement as m, memo as h, useMemo as g, useState as _ } from "react";
12
- import { useControllableValue as v } from "ahooks";
13
- import { AnimatePresence as y, motion as b } from "motion/react";
14
- import { FloatingPortal as x } from "@floating-ui/react";
15
- //#region src/hooks/useDropdownSearch.ts
16
- var S = ({ menus: t, searchValue: n, enableInternalFilter: r, searchKey: i }) => {
17
- let a = g(() => new s(t, {
18
- keys: [i],
19
- ignoreLocation: !0,
20
- threshold: .3,
21
- getFn: (e, t) => {
22
- let n = e[t];
23
- return t === "label" && typeof n != "string" ? "" : String(n || "");
24
- }
25
- }), [t, i]), o = g(() => !r || e(n) ? t : a.search(n).map((e) => e.item), [
26
- t,
27
- n,
28
- r,
29
- a
30
- ]);
31
- return {
32
- filteredMenus: o,
33
- hasNoResults: g(() => r && !e(n) && o.length === 0, [
34
- r,
35
- n,
36
- o.length
37
- ])
38
- };
39
- }, C = "_dropdown__trigger_11n5z_1", w = "_dropdown__panel_11n5z_7", T = "_dropdown__search_11n5z_15", E = "_dropdown__menu_11n5z_19", D = {
40
- dropdown__trigger: C,
41
- "dropdown__trigger--disabled": "_dropdown__trigger--disabled_11n5z_4",
42
- dropdown__panel: w,
43
- dropdown__search: T,
44
- dropdown__menu: E,
45
- "dropdown__menu-item": "_dropdown__menu-item_11n5z_22",
46
- "dropdown__menu-item--disabled": "_dropdown__menu-item--disabled_11n5z_34",
47
- "dropdown__menu-item--active": "_dropdown__menu-item--active_11n5z_34",
48
- "dropdown__menu-item-icon": "_dropdown__menu-item-icon_11n5z_41",
49
- "system-field": "_system-field_11n5z_52",
50
- "dropdown__menu-item-label": "_dropdown__menu-item-label_11n5z_63"
51
- }, O = h(({ item: e, onClick: t, isActive: n = !1 }) => {
52
- let i = () => {
53
- e.disabled || t(e);
54
- }, a = e.systemField || !1;
55
- return /* @__PURE__ */ f("div", {
56
- className: r(D["dropdown__menu-item"], {
57
- [D["dropdown__menu-item--disabled"]]: e.disabled,
58
- [D["dropdown__menu-item--active"]]: n && !e.disabled,
59
- "text-[#4d609f]": a && !e.disabled && !n
60
- }),
61
- onClick: i,
62
- children: [e.icon && /* @__PURE__ */ d("div", {
63
- className: r(D["dropdown__menu-item-icon"], { [D["system-field"]]: a }),
64
- children: e.icon
65
- }), /* @__PURE__ */ d("div", {
66
- className: r(D["dropdown__menu-item-label"], "truncate"),
67
- children: e.label
68
- })]
69
- });
70
- });
71
- O.displayName = "BsyDropDownMenuItem";
72
- //#endregion
73
- //#region src/components/DropDown/MenuList/MenuList.tsx
74
- var k = ({ menus: e, onClick: t, hasNoResults: r, activeKey: i = [] }) => {
75
- let { t: a } = n();
76
- return e.length === 0 ? /* @__PURE__ */ d(o, {
77
- text: a("noData"),
78
- className: "px-3 py-6"
79
- }) : r ? /* @__PURE__ */ d(o, {
80
- text: a("noDataFound"),
81
- className: "px-3 py-6"
82
- }) : /* @__PURE__ */ d("div", {
83
- className: D.dropdown__menu,
84
- children: e.map((e) => /* @__PURE__ */ d(O, {
85
- item: e,
86
- onClick: t,
87
- isActive: i.includes(e.key)
88
- }, e.key))
89
- });
90
- };
91
- k.displayName = "BsyDropDownMenuList";
92
- //#endregion
93
- //#region src/components/DropDown/DropDown.tsx
94
- var A = (e) => {
95
- let { t: r } = n(), { children: o, menus: s, onClick: h, onSearch: g, searchKey: C = "label", showSearch: w = !0, closeOnSelect: T = !0, searchPlaceholder: E = r("search"), offset: O = {
96
- x: 0,
97
- y: 0
98
- }, zIndex: A = 1101, style: j, activeKey: M = [] } = e, [N, P] = v(e, {
99
- valuePropName: "visible",
100
- defaultValue: !1,
101
- trigger: "onOpenChange"
102
- }), [F, I] = _(""), L = () => {
103
- P(!N);
104
- }, R = () => {
105
- P(!1);
106
- }, z = (e) => {
107
- e.disabled || (h?.(e), T && R());
108
- }, B = (e) => {
109
- I(e), g?.(e);
110
- }, { filteredMenus: V, hasNoResults: H } = S({
111
- menus: s,
112
- searchValue: F,
113
- enableInternalFilter: !g,
114
- searchKey: C
115
- }), { refs: U, floatingStyles: W, getReferenceProps: G, getFloatingProps: K } = l({
116
- isOpen: N,
117
- close: R,
118
- showMask: !1,
119
- zIndex: A,
120
- offset: {
121
- x: t(O.x) ? O.x : 0,
122
- y: t(O.y) ? O.y : 0
123
- }
124
- });
125
- return /* @__PURE__ */ f(u, { children: [m(o) ? p(o, {
126
- ...G(),
127
- ref: U.setReference,
128
- onClick: (e) => {
129
- L(), o.props.onClick?.(e);
130
- }
131
- }) : o, /* @__PURE__ */ d(x, { children: /* @__PURE__ */ d(y, { children: N && /* @__PURE__ */ d("div", {
132
- ref: U.setFloating,
133
- ...K(),
134
- style: W,
135
- children: /* @__PURE__ */ d(b.div, {
136
- ...i,
137
- children: /* @__PURE__ */ f("div", {
138
- className: D.dropdown__panel,
139
- style: j,
140
- children: [w && /* @__PURE__ */ d("div", {
141
- className: D.dropdown__search,
142
- children: /* @__PURE__ */ d(a, {
143
- value: F,
144
- onChange: B,
145
- searchPlaceholder: E
146
- })
147
- }), /* @__PURE__ */ d(c, {
148
- style: { maxHeight: 300 },
149
- children: /* @__PURE__ */ d(k, {
150
- menus: V,
151
- onClick: z,
152
- hasNoResults: H,
153
- activeKey: M
154
- })
155
- })]
156
- })
157
- })
158
- }) }) })] });
159
- };
160
- A.displayName = "BsyDropDown";
161
- //#endregion
162
- export { A as t };
@@ -1,19 +0,0 @@
1
- import { i as e } from "../vendors/lodash-es-Bu9xU1fK.js";
2
- import { createFromIconfontCN as t } from "@ant-design/icons";
3
- import { jsx as n } from "react/jsx-runtime";
4
- //#region src/components/Icon/Icon.tsx
5
- var r = t({ scriptUrl: "https://at.alicdn.com/t/c/font_4786625_djm4gsgobsp.js" }), i = ({ name: t, style: i, className: a, onClick: o, color: s, size: c = 16 }) => {
6
- let l = {
7
- color: s,
8
- fontSize: e(c) ? `${c}px` : c,
9
- ...i
10
- };
11
- return /* @__PURE__ */ n(r, {
12
- onClick: o,
13
- type: `icon-${t}`,
14
- style: l,
15
- className: `${a || ""}`
16
- });
17
- };
18
- //#endregion
19
- export { i as t };