@baishuyun/ui-base 2.2.2 → 2.2.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 (35) hide show
  1. package/dist/Card/{Card-DHOMkrEE.js → Card-hi1s-MYD.js} +1 -1
  2. package/dist/Card/index.js +1 -1
  3. package/dist/CheckBox/{CheckBox-VlP6u_-s.js → CheckBox-C9sXWSA5.js} +1 -1
  4. package/dist/CheckBox/index.js +1 -1
  5. package/dist/ColorPicker/{ColorPicker-049kyJn6.js → ColorPicker-B8U3ubrp.js} +1 -1
  6. package/dist/ColorPicker/index.js +1 -1
  7. package/dist/DropDown/{DropDown-BkTY-3y0.js → DropDown-DGkSeXQT.js} +1 -1
  8. package/dist/DropDown/index.js +1 -1
  9. package/dist/Editor/ToolbarPlugin/Buttons/index.js +6 -2
  10. package/dist/Editor/{index-C0MY9j94.js → index-cVFSiCP9.js} +426 -412
  11. package/dist/Editor/index.js +115 -108
  12. package/dist/Icon/Icon-CBlIwtp2.js +24 -0
  13. package/dist/Icon/index.js +1 -1
  14. package/dist/InputTag/{InputTag-S9hHXsyQ.js → InputTag-C6MbuO-e.js} +1 -1
  15. package/dist/InputTag/index.js +1 -1
  16. package/dist/Modal/{Modal-oRJ-Almn.js → Modal-z3TvEXwN.js} +1 -1
  17. package/dist/Modal/index.js +1 -1
  18. package/dist/Select/{Select-7KGHOKs6.js → Select-hwXXDuLU.js} +3 -3
  19. package/dist/Select/{SelectInputSearch-DigfTvpo.js → SelectInputSearch-ChUpUgxa.js} +1 -1
  20. package/dist/Select/index.js +1 -1
  21. package/dist/Tabs/{TabSelect-bKB0Qe9F.js → TabSelect-DL8Bhehc.js} +1 -1
  22. package/dist/Tabs/index.js +1 -1
  23. package/dist/Tree/index.js +1 -1
  24. package/dist/components/Editor/ToolbarPlugin/Buttons/index.d.ts +6 -3
  25. package/dist/components/Editor/ToolbarPlugin/Buttons/registry.d.ts +6 -0
  26. package/dist/components/Editor/ToolbarPlugin/interface.d.ts +4 -3
  27. package/dist/components/Editor/index.d.ts +5 -0
  28. package/dist/components/Select/HighlightText/HighlightText.d.ts +1 -0
  29. package/dist/index.js +9 -9
  30. package/dist/style.css +1 -1
  31. package/dist/vendors/Tree-CLEy-xqz.js +235 -0
  32. package/dist/vendors/{lexical-DdSmj_Kv.js → lexical-DO7eMeC2.js} +7 -7
  33. package/package.json +4 -7
  34. package/dist/Icon/Icon-CkHAU1fA.js +0 -24
  35. package/dist/vendors/Tree-C-8x1jXV.js +0 -225
@@ -1,225 +0,0 @@
1
- import { jsx as a, jsxs as N, Fragment as O } from "react/jsx-runtime";
2
- import M, { useMemo as j, useCallback as I, createContext as R, useContext as V, useEffect as $ } from "react";
3
- import { I as z } from "../Icon/Icon-CkHAU1fA.js";
4
- import { c as E } from "./clsx-OuTLNxxd.js";
5
- import { n as _ } from "./lodash-es-DFpaJB4Y.js";
6
- import { B as A } from "../CheckBox/CheckBox-VlP6u_-s.js";
7
- import F from "../Radio/index.js";
8
- import { useControllableValue as B } from "ahooks";
9
- import { getMatchingNodesPaths as W, getNodePath as q } from "../Tree/utils/index.js";
10
- const L = ({ text: e, highlight: s }) => {
11
- const [t, o] = j(
12
- () => e && s ? [e.toLowerCase(), s.toLowerCase()] : [],
13
- [e, s]
14
- ), g = I(() => {
15
- if (!s.trim())
16
- return [{ text: e, isMatch: !1 }];
17
- const l = o ? t == null ? void 0 : t.indexOf(o) : -1;
18
- return l === -1 || l === void 0 ? [{ text: e, isMatch: !1 }] : [
19
- { text: e.slice(0, l), isMatch: !1 },
20
- { text: e.slice(l, l + s.length), isMatch: !0 },
21
- { text: e.slice(l + s.length), isMatch: !1 }
22
- ].filter((c) => c.text);
23
- }, [e, s, t, o])(), f = {
24
- color: "#0265ff",
25
- fontWeight: 500
26
- };
27
- return /* @__PURE__ */ a("div", { className: "select-none text-ellipsis overflow-hidden whitespace-nowrap truncate w-full", children: g.map(
28
- (l, c) => l.isMatch ? /* @__PURE__ */ a("span", { style: f, children: l.text }, c) : /* @__PURE__ */ a("span", { children: l.text }, c)
29
- ) });
30
- };
31
- L.displayName = "HighlightText";
32
- const G = M.memo(L), P = R({
33
- searchValue: "",
34
- selectedKeys: [],
35
- expandedKeys: [],
36
- parentCheckable: !1,
37
- onSelect: _,
38
- onExpand: _,
39
- icon: void 0,
40
- switcherIcon: void 0,
41
- checkType: "default",
42
- showSwitcher: !0
43
- }), J = 22, H = ({ node: e, level: s = 0, fieldNames: t }) => {
44
- var r;
45
- const o = V(P), {
46
- searchValue: v,
47
- selectedKeys: g,
48
- expandedKeys: f,
49
- onSelect: l,
50
- onExpand: c,
51
- onDeSelect: x,
52
- parentCheckable: w,
53
- checkType: d,
54
- showSwitcher: k
55
- } = V(P), h = e[t.children] && e[t.children].length > 0, m = g.includes(e[t.value]), p = h ? f.includes(e[t.value]) : !1, y = () => {
56
- if (e.checkable === !1) {
57
- h && (c == null || c(e[t.value], !p));
58
- return;
59
- }
60
- if (h) {
61
- w ? C() : c == null || c(e[t.value], !p);
62
- return;
63
- }
64
- C();
65
- }, C = () => {
66
- m ? x == null || x(e[t.value]) : l == null || l(e[t.value], e);
67
- }, K = (n) => {
68
- n.stopPropagation(), h && (c == null || c(e[t.value], !p));
69
- }, S = (n = !1) => {
70
- const i = e.icon || o.icon;
71
- if (!i) return null;
72
- const u = typeof i == "function" ? i(e) : i;
73
- return M.isValidElement(u) ? /* @__PURE__ */ a(
74
- "span",
75
- {
76
- className: E({
77
- "text-[#0265ff]": n,
78
- "text-[#73819c]": !n
79
- }),
80
- children: u
81
- }
82
- ) : null;
83
- }, T = (n) => h ? o.switcherIcon ? o.switcherIcon(n) : /* @__PURE__ */ a(
84
- z,
85
- {
86
- name: "arrow-right",
87
- className: E("transition-transform duration-300 ease-in-out text-[#666]", {
88
- "rotate-90": n
89
- })
90
- }
91
- ) : null, b = () => h && !w || d === "default" || e.checkable === !1 ? null : /* @__PURE__ */ N("div", { className: "ml-auto shrink-0", children: [
92
- d === "radio" && /* @__PURE__ */ a(F, { checked: m }),
93
- d === "checkbox" && /* @__PURE__ */ a(A, { checked: m })
94
- ] });
95
- return /* @__PURE__ */ N(O, { children: [
96
- /* @__PURE__ */ a(
97
- "div",
98
- {
99
- className: E("rounded-[4px] cursor-pointer", {
100
- "text-[#0265ff] bg-[#f0f6ff]": m && d === "default",
101
- "hover:bg-[#f3f3f3]": !m || d !== "default"
102
- }),
103
- onClick: y,
104
- children: /* @__PURE__ */ N(
105
- "div",
106
- {
107
- className: "flex items-center px-[10px] py-[7px] gap-x-[6px]",
108
- style: { marginLeft: `${s * J}px` },
109
- children: [
110
- /* @__PURE__ */ a(
111
- "div",
112
- {
113
- className: E("w-4 h-4 flex items-center justify-center flex-shrink-0", {
114
- hidden: !k
115
- }),
116
- onClick: K,
117
- children: T(p)
118
- }
119
- ),
120
- S(m),
121
- M.isValidElement(e[t.title]) ? e[t.title] : /* @__PURE__ */ a(G, { text: e[t.title], highlight: v }),
122
- b()
123
- ]
124
- }
125
- )
126
- }
127
- ),
128
- h && /* @__PURE__ */ a(
129
- "div",
130
- {
131
- className: "grid transition-[grid-template-rows] duration-300 ease-in-out",
132
- style: { gridTemplateRows: p ? "1fr" : "0fr" },
133
- children: /* @__PURE__ */ a("div", { className: "overflow-hidden", children: (r = e[t.children]) == null ? void 0 : r.map((n) => /* @__PURE__ */ a(
134
- H,
135
- {
136
- node: n,
137
- level: s + 1,
138
- fieldNames: t
139
- },
140
- n[t.value]
141
- )) })
142
- }
143
- )
144
- ] });
145
- }, Q = (e) => {
146
- const {
147
- data: s,
148
- searchValue: t = "",
149
- fieldNames: o = { title: "title", value: "value", children: "children" },
150
- icon: v,
151
- switcherIcon: g,
152
- onSelect: f,
153
- parentCheckable: l = !1,
154
- checkType: c = "default",
155
- defaultExpandedKeys: x,
156
- showSwitcher: w = !0,
157
- onDeSelect: d
158
- } = e, [k, h] = B(e, {
159
- defaultValuePropName: "defaultSelectedKeys",
160
- valuePropName: "selectedKeys",
161
- defaultValue: [],
162
- trigger: "__DO_NOT_CALLED__"
163
- }), m = () => {
164
- var n;
165
- const r = /* @__PURE__ */ new Set();
166
- return (n = e.selectedKeys) != null && n.length ? (e.selectedKeys.forEach((i) => {
167
- const u = q(s, i, o);
168
- u && u.length > 1 && u.slice(0, -1).forEach((D) => r.add(D));
169
- }), [...r]) : [];
170
- }, [p, y] = B(e, {
171
- valuePropName: "expandedKeys",
172
- defaultValuePropName: "defaultExpandedKeys",
173
- defaultValue: m(),
174
- trigger: "onExpand"
175
- });
176
- $(() => {
177
- if (!t) {
178
- if (k.length || x != null && x.length) return;
179
- y([]);
180
- return;
181
- }
182
- const r = /* @__PURE__ */ new Set(), n = W(s, t, o);
183
- if (n.length === 0) {
184
- y([]);
185
- return;
186
- }
187
- n.forEach((i) => i.slice(0, -1).forEach((u) => r.add(u))), r.size !== 0 && y([...r]);
188
- }, [t]);
189
- const C = I(
190
- (r, n) => {
191
- h((i) => c === "checkbox" ? [.../* @__PURE__ */ new Set([...i, r])] : [r]), f && (f == null || f(r, n));
192
- },
193
- [f, h, c]
194
- ), K = (r, n) => {
195
- C(r, n);
196
- }, S = I(
197
- (r) => {
198
- h((n) => n.filter((i) => i !== r)), d == null || d(r);
199
- },
200
- [h, d]
201
- ), T = (r, n) => {
202
- const i = n ? [...p, r] : p.filter((u) => u !== r);
203
- y(i);
204
- };
205
- if (!(s != null && s.length)) return null;
206
- const b = {
207
- searchValue: t,
208
- selectedKeys: k,
209
- expandedKeys: p,
210
- onSelect: K,
211
- onDeSelect: S,
212
- onExpand: T,
213
- icon: v,
214
- switcherIcon: g,
215
- checkType: c,
216
- parentCheckable: l,
217
- showSwitcher: w
218
- };
219
- return /* @__PURE__ */ a(P.Provider, { value: b, children: /* @__PURE__ */ a("div", { className: "bsy-tree text-sm overflow-x-auto", children: s.map((r) => /* @__PURE__ */ a(H, { node: r, fieldNames: o }, r[o.value])) }) });
220
- };
221
- Q.displayName = "BsyTree";
222
- export {
223
- G as H,
224
- Q as T
225
- };