@baishuyun/ui-base 2.2.5 → 2.3.0
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.
- package/dist/ColorPicker/{ColorPicker-DNIXPakN.js → ColorPicker-D0D5azon.js} +70 -65
- package/dist/ColorPicker/index.js +1 -1
- package/dist/Editor/ToolbarPlugin/Buttons/index.js +1 -1
- package/dist/Editor/{index-CCq3AgcW.js → index-C0Rjz8DK.js} +1 -1
- package/dist/Editor/index.js +2 -2
- package/dist/InputTag/InputTag-C-rQUJnF.js +155 -0
- package/dist/InputTag/index.js +1 -1
- package/dist/components/ColorPicker/ColorPicker.type.d.ts +6 -0
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/dist/InputTag/InputTag-C6MbuO-e.js +0 -137
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { ColorPicker as
|
|
3
|
-
import { AnimatePresence as
|
|
1
|
+
import { jsx as e, jsxs as b, Fragment as O } from "react/jsx-runtime";
|
|
2
|
+
import { ColorPicker as R } from "antd";
|
|
3
|
+
import { AnimatePresence as A, motion as F } from "motion/react";
|
|
4
4
|
import { useFloating as x, offset as L, flip as E, shift as T, useClick as V, useDismiss as j, useInteractions as B, FloatingPortal as M } from "@floating-ui/react";
|
|
5
5
|
import { useState as k, isValidElement as D, cloneElement as G, useRef as $, useMemo as q } from "react";
|
|
6
6
|
import { useControllableValue as z } from "ahooks";
|
|
7
|
-
import { I as
|
|
8
|
-
import { u } from "../vendors/useLocale-DgqW9M3h.js";
|
|
7
|
+
import { I as u } from "../Icon/Icon-CBlIwtp2.js";
|
|
8
|
+
import { u as g } from "../vendors/useLocale-DgqW9M3h.js";
|
|
9
9
|
import { c as H } from "../vendors/clsx-OuTLNxxd.js";
|
|
10
10
|
import { a as y } from "../vendors/color-VzwvCPhF.js";
|
|
11
11
|
import { t as J } from "../vendors/tinycolor2-Begv3Jc8.js";
|
|
@@ -48,11 +48,11 @@ const U = [
|
|
|
48
48
|
// #e0e0e0
|
|
49
49
|
"rgba(77, 96, 159, 1)"
|
|
50
50
|
// #4d609f
|
|
51
|
-
], W = (
|
|
52
|
-
const [t,
|
|
51
|
+
], W = (o = "bottom-start") => {
|
|
52
|
+
const [t, r] = k(!1), { refs: n, floatingStyles: c, context: i } = x({
|
|
53
53
|
open: t,
|
|
54
|
-
onOpenChange:
|
|
55
|
-
placement:
|
|
54
|
+
onOpenChange: r,
|
|
55
|
+
placement: o,
|
|
56
56
|
middleware: [
|
|
57
57
|
L(4),
|
|
58
58
|
// 浮层与触发器间距
|
|
@@ -61,16 +61,16 @@ const U = [
|
|
|
61
61
|
T({ padding: 8 })
|
|
62
62
|
// 自动避开边界
|
|
63
63
|
]
|
|
64
|
-
}),
|
|
64
|
+
}), m = V(i), l = j(i), { getReferenceProps: _, getFloatingProps: a } = B([m, l]);
|
|
65
65
|
return {
|
|
66
66
|
isOpen: t,
|
|
67
67
|
refs: n,
|
|
68
|
-
floatingStyles:
|
|
69
|
-
getReferenceProps:
|
|
70
|
-
getFloatingProps:
|
|
71
|
-
setIsOpen:
|
|
68
|
+
floatingStyles: c,
|
|
69
|
+
getReferenceProps: _,
|
|
70
|
+
getFloatingProps: a,
|
|
71
|
+
setIsOpen: r
|
|
72
72
|
};
|
|
73
|
-
},
|
|
73
|
+
}, s = {
|
|
74
74
|
"bsy-color-picker__floating": "_bsy-color-picker__floating_1kfi6_1",
|
|
75
75
|
"bsy-color-picker__content": "_bsy-color-picker__content_1kfi6_4",
|
|
76
76
|
"bsy-color-picker__grid": "_bsy-color-picker__grid_1kfi6_11",
|
|
@@ -84,64 +84,65 @@ const U = [
|
|
|
84
84
|
"bsy-color-picker__custom-color-content": "_bsy-color-picker__custom-color-content_1kfi6_68",
|
|
85
85
|
"bsy-color-picker__check-icon": "_bsy-color-picker__check-icon_1kfi6_72"
|
|
86
86
|
}, f = ({
|
|
87
|
-
currentColor:
|
|
87
|
+
currentColor: o,
|
|
88
88
|
onColorSelect: t,
|
|
89
|
-
options:
|
|
89
|
+
options: r,
|
|
90
90
|
style: n
|
|
91
|
-
}) => /* @__PURE__ */
|
|
91
|
+
}) => /* @__PURE__ */ e("div", { className: s["bsy-color-picker__preset-colors-grid"], style: n, children: r.map((c) => /* @__PURE__ */ e(
|
|
92
92
|
"div",
|
|
93
93
|
{
|
|
94
|
-
className:
|
|
94
|
+
className: s["bsy-color-picker__preset-colors-item"],
|
|
95
95
|
style: {
|
|
96
|
-
backgroundColor:
|
|
97
|
-
"--hover-color": J(
|
|
96
|
+
backgroundColor: c,
|
|
97
|
+
"--hover-color": J(c).setAlpha(0.5).toRgbString()
|
|
98
98
|
},
|
|
99
|
-
onClick: () => t(
|
|
100
|
-
children: y(
|
|
99
|
+
onClick: () => t(c),
|
|
100
|
+
children: y(o, c) && /* @__PURE__ */ e(u, { name: "checkthebox", className: s["bsy-color-picker__check-icon"] })
|
|
101
101
|
},
|
|
102
|
-
|
|
103
|
-
)) }), X = (
|
|
102
|
+
c
|
|
103
|
+
)) }), X = (o) => {
|
|
104
104
|
const {
|
|
105
105
|
children: t,
|
|
106
|
-
placement:
|
|
106
|
+
placement: r = "bottom-start",
|
|
107
107
|
disabled: n = !1,
|
|
108
|
-
presetColors:
|
|
108
|
+
presetColors: c,
|
|
109
109
|
getPopupContainer: i
|
|
110
|
-
} =
|
|
111
|
-
defaultValue:
|
|
112
|
-
}), { isOpen:
|
|
110
|
+
} = o, { t: m } = g(), [l, _] = z(o, {
|
|
111
|
+
defaultValue: o.value
|
|
112
|
+
}), { isOpen: a, refs: d, floatingStyles: C, getReferenceProps: h, getFloatingProps: v } = W(r), P = D(t) ? G(t, {
|
|
113
113
|
...h(),
|
|
114
114
|
// @ts-ignore
|
|
115
115
|
ref: d.setReference,
|
|
116
116
|
disabled: n
|
|
117
|
-
}) : t,
|
|
118
|
-
return /* @__PURE__ */
|
|
117
|
+
}) : t, p = Q(c) && c.length ? c : U, N = p.some((I) => y(I, l)), S = $(N ? [] : [l]), w = q(() => a ? i == null ? void 0 : i() : void 0, [a, i]);
|
|
118
|
+
return /* @__PURE__ */ b(O, { children: [
|
|
119
119
|
P,
|
|
120
|
-
/* @__PURE__ */
|
|
120
|
+
/* @__PURE__ */ e(M, { root: w, children: /* @__PURE__ */ e(A, { children: a && /* @__PURE__ */ e(
|
|
121
121
|
"div",
|
|
122
122
|
{
|
|
123
123
|
ref: d.setFloating,
|
|
124
124
|
style: C,
|
|
125
125
|
...v(),
|
|
126
|
-
className:
|
|
127
|
-
children: /* @__PURE__ */
|
|
128
|
-
/* @__PURE__ */
|
|
129
|
-
/* @__PURE__ */
|
|
130
|
-
/* @__PURE__ */
|
|
126
|
+
className: s["bsy-color-picker__floating"],
|
|
127
|
+
children: /* @__PURE__ */ e(F.div, { ...K, children: /* @__PURE__ */ e("div", { className: s["bsy-color-picker__content"], children: /* @__PURE__ */ b("div", { className: s["bsy-color-picker__grid"], children: [
|
|
128
|
+
/* @__PURE__ */ b("div", { className: s["bsy-color-picker__preset-colors"], children: [
|
|
129
|
+
/* @__PURE__ */ e("div", { className: s["bsy-color-picker__preset-colors-title"], children: m("presetColors") }),
|
|
130
|
+
/* @__PURE__ */ e(
|
|
131
131
|
f,
|
|
132
132
|
{
|
|
133
133
|
currentColor: l,
|
|
134
|
-
onColorSelect:
|
|
135
|
-
options:
|
|
134
|
+
onColorSelect: _,
|
|
135
|
+
options: p
|
|
136
136
|
}
|
|
137
137
|
)
|
|
138
138
|
] }),
|
|
139
|
-
/* @__PURE__ */
|
|
139
|
+
/* @__PURE__ */ e(
|
|
140
140
|
Y,
|
|
141
141
|
{
|
|
142
142
|
value: l,
|
|
143
|
-
onChange:
|
|
144
|
-
|
|
143
|
+
onChange: _,
|
|
144
|
+
onColorInput: o.onColorInput,
|
|
145
|
+
options: p,
|
|
145
146
|
list: S.current
|
|
146
147
|
}
|
|
147
148
|
)
|
|
@@ -149,40 +150,44 @@ const U = [
|
|
|
149
150
|
}
|
|
150
151
|
) }) })
|
|
151
152
|
] });
|
|
152
|
-
}, Y = (
|
|
153
|
-
const { list: t } =
|
|
154
|
-
return /* @__PURE__ */
|
|
155
|
-
/* @__PURE__ */
|
|
156
|
-
/* @__PURE__ */
|
|
157
|
-
/* @__PURE__ */
|
|
158
|
-
|
|
153
|
+
}, Y = (o) => {
|
|
154
|
+
const { list: t } = o, [r, n] = k(), [c, i] = k(!1), { t: m } = g();
|
|
155
|
+
return /* @__PURE__ */ b("div", { className: s["bsy-color-picker__custom-color"], children: [
|
|
156
|
+
/* @__PURE__ */ e("div", { className: s["bsy-color-picker__custom-color-title"], children: m("customColor") }),
|
|
157
|
+
/* @__PURE__ */ b("div", { className: s["bsy-color-picker__custom-color-content"], children: [
|
|
158
|
+
/* @__PURE__ */ e(
|
|
159
|
+
R,
|
|
159
160
|
{
|
|
160
|
-
value:
|
|
161
|
-
onChange: (l) =>
|
|
162
|
-
|
|
161
|
+
value: r,
|
|
162
|
+
onChange: (l) => {
|
|
163
|
+
var a;
|
|
164
|
+
const _ = l.toRgbString();
|
|
165
|
+
n(_), (a = o.onColorInput) == null || a.call(o, _);
|
|
166
|
+
},
|
|
167
|
+
open: c,
|
|
163
168
|
onOpenChange: (l) => {
|
|
164
|
-
i(l), !l &&
|
|
169
|
+
i(l), !l && r && (t.includes(r) || t.unshift(r), o.onChange(r), n(void 0));
|
|
165
170
|
},
|
|
166
|
-
children: /* @__PURE__ */
|
|
171
|
+
children: /* @__PURE__ */ e(
|
|
167
172
|
"div",
|
|
168
173
|
{
|
|
169
|
-
className: H(
|
|
170
|
-
[
|
|
171
|
-
[
|
|
174
|
+
className: H(s["bsy-color-picker__custom-color-btn"], {
|
|
175
|
+
[s["bsy-color-picker__custom-color-btn--active"]]: c && !r,
|
|
176
|
+
[s["bsy-color-picker__custom-color-btn--preview"]]: !!r
|
|
172
177
|
}),
|
|
173
178
|
role: "button",
|
|
174
179
|
style: {
|
|
175
|
-
backgroundColor:
|
|
180
|
+
backgroundColor: r || void 0
|
|
176
181
|
},
|
|
177
182
|
onClick: () => {
|
|
178
183
|
i(!0);
|
|
179
184
|
},
|
|
180
|
-
children: /* @__PURE__ */
|
|
181
|
-
|
|
185
|
+
children: /* @__PURE__ */ e(
|
|
186
|
+
u,
|
|
182
187
|
{
|
|
183
188
|
name: "add",
|
|
184
189
|
style: {
|
|
185
|
-
visibility:
|
|
190
|
+
visibility: r ? "hidden" : "visible"
|
|
186
191
|
}
|
|
187
192
|
}
|
|
188
193
|
)
|
|
@@ -190,11 +195,11 @@ const U = [
|
|
|
190
195
|
)
|
|
191
196
|
}
|
|
192
197
|
),
|
|
193
|
-
/* @__PURE__ */
|
|
198
|
+
/* @__PURE__ */ e(
|
|
194
199
|
f,
|
|
195
200
|
{
|
|
196
|
-
currentColor:
|
|
197
|
-
onColorSelect:
|
|
201
|
+
currentColor: o.value,
|
|
202
|
+
onColorSelect: o.onChange,
|
|
198
203
|
options: t.slice(0, 5),
|
|
199
204
|
style: {
|
|
200
205
|
gridTemplateColumns: "repeat(5, 1fr)"
|
|
@@ -6,7 +6,7 @@ import { l as ce, i as de, P as T, _ as O, y as X, w as $, E as ee, p as we, x a
|
|
|
6
6
|
import { u as w } from "../vendors/useLocale-DgqW9M3h.js";
|
|
7
7
|
import { D as pe } from "../DropDown/DropDown-DGkSeXQT.js";
|
|
8
8
|
import { FONT_SIZES as Se } from "./constants/index.js";
|
|
9
|
-
import { C as me } from "../ColorPicker/ColorPicker-
|
|
9
|
+
import { C as me } from "../ColorPicker/ColorPicker-D0D5azon.js";
|
|
10
10
|
import { AlignLeftOutlined as te, AlignCenterOutlined as Le, AlignRightOutlined as Te } from "@ant-design/icons";
|
|
11
11
|
import { M as _e } from "../Modal/Modal-z3TvEXwN.js";
|
|
12
12
|
import { message as Z, Input as V, Button as j, Form as J } from "antd";
|
package/dist/Editor/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as u, jsxs as W, Fragment as et } from "react/jsx-runtime";
|
|
2
2
|
import { o as N, P as F, _ as $, Y as M, w as U, f as nt, x as G, j as it, C as ot, L as rt, $ as B, S as st, a as at, W as V, J as lt, F as ct, B as ut, M as dt, b as J, g as ht, m as gt, h as mt, c as ft, d as _t, e as bt, n as pt, q as z, s as xt, i as yt, k as vt } from "../vendors/lexical-DO7eMeC2.js";
|
|
3
3
|
import wt, { useState as S, useEffect as y, useRef as O, useCallback as E, useMemo as Tt } from "react";
|
|
4
|
-
import { p as Ct, T as Et, g as Lt, a as Z, k as X, v as H, I as Nt, m as kt } from "./index-
|
|
5
|
-
import { B as ie, l as oe, r as re, u as se } from "./index-
|
|
4
|
+
import { p as Ct, T as Et, g as Lt, a as Z, k as X, v as H, I as Nt, m as kt } from "./index-C0Rjz8DK.js";
|
|
5
|
+
import { B as ie, l as oe, r as re, u as se } from "./index-C0Rjz8DK.js";
|
|
6
6
|
import { DEFAULT_BACKGROUND_COLOR as j, DEFAULT_FONT_COLOR as K, DEFAULT_FONT_SIZE as Y } from "./constants/index.js";
|
|
7
7
|
import { c as R } from "../vendors/clsx-OuTLNxxd.js";
|
|
8
8
|
const I = {
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { jsxs as S, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useControllableValue as W } from "ahooks";
|
|
3
|
+
import { useState as N, useLayoutEffect as A, useRef as m, useEffect as z, useCallback as D } from "react";
|
|
4
|
+
import { c as T } from "../vendors/clsx-OuTLNxxd.js";
|
|
5
|
+
import { I as V } from "../Icon/Icon-CBlIwtp2.js";
|
|
6
|
+
import { motion as B } from "motion/react";
|
|
7
|
+
import { S as F } from "../vendors/simplebar-react-D68KzE44.js";
|
|
8
|
+
const _ = {
|
|
9
|
+
"bsy-inputTag": "_bsy-inputTag_46spj_11",
|
|
10
|
+
"bsy-inputTag__container": "_bsy-inputTag__container_46spj_22",
|
|
11
|
+
"bsy-inputTag__inputContainer": "_bsy-inputTag__inputContainer_46spj_27",
|
|
12
|
+
"bsy-inputTag__inputContainer--zeroMargin": "_bsy-inputTag__inputContainer--zeroMargin_46spj_37",
|
|
13
|
+
"bsy-inputTag__input": "_bsy-inputTag__input_46spj_27"
|
|
14
|
+
}, b = {
|
|
15
|
+
GAP: 4,
|
|
16
|
+
OFFSET: 3,
|
|
17
|
+
CONTAINER_PADDING: 10,
|
|
18
|
+
INPUT_MARGIN: 4
|
|
19
|
+
}, L = (l, x) => {
|
|
20
|
+
const [c, y] = N(0);
|
|
21
|
+
return A(() => {
|
|
22
|
+
const i = l.current;
|
|
23
|
+
if (!i) return;
|
|
24
|
+
const n = () => {
|
|
25
|
+
const a = i.children;
|
|
26
|
+
let f = 0;
|
|
27
|
+
for (let r = 0; r < a.length; r++)
|
|
28
|
+
f += a[r].clientWidth;
|
|
29
|
+
const h = Math.max(0, a.length - 1) * b.GAP, d = Math.max(0, f + h + b.OFFSET);
|
|
30
|
+
y((r) => r === d ? r : d);
|
|
31
|
+
};
|
|
32
|
+
n();
|
|
33
|
+
const u = new ResizeObserver(n);
|
|
34
|
+
return u.observe(i), () => {
|
|
35
|
+
u.disconnect();
|
|
36
|
+
};
|
|
37
|
+
}, [x, l]), c;
|
|
38
|
+
}, K = (l) => {
|
|
39
|
+
const { defaultValue: x, enableActive: c = !1, defaultActiveIndex: y, onActiveIndexChange: i } = l, [n, u] = W(l, {
|
|
40
|
+
defaultValue: x || []
|
|
41
|
+
}), [a, f] = W(
|
|
42
|
+
l,
|
|
43
|
+
{
|
|
44
|
+
valuePropName: "activeIndex",
|
|
45
|
+
trigger: "onActiveIndexChange",
|
|
46
|
+
defaultValue: y
|
|
47
|
+
}
|
|
48
|
+
), [h, d] = N(""), r = m(null), p = m(null), g = m(null), v = m(!1), w = () => {
|
|
49
|
+
if (p.current && p.current.children.length > 0) {
|
|
50
|
+
const t = p.current.children.length - 1;
|
|
51
|
+
p.current.children[t].scrollIntoView({
|
|
52
|
+
behavior: "smooth",
|
|
53
|
+
block: "nearest",
|
|
54
|
+
inline: "end"
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
z(() => {
|
|
59
|
+
v.current && n.length > 0 && (w(), v.current = !1);
|
|
60
|
+
}, [n.length]);
|
|
61
|
+
const k = (t) => {
|
|
62
|
+
d(t.currentTarget.value);
|
|
63
|
+
}, C = () => {
|
|
64
|
+
const t = h.trim();
|
|
65
|
+
if (t !== "") {
|
|
66
|
+
const e = t;
|
|
67
|
+
v.current = !0, u([...n, e]), d("");
|
|
68
|
+
}
|
|
69
|
+
}, M = (t, e) => {
|
|
70
|
+
if (!c) return;
|
|
71
|
+
const s = a === t ? void 0 : t;
|
|
72
|
+
f(s), i == null || i(s ?? -1, e);
|
|
73
|
+
}, E = (t) => {
|
|
74
|
+
t.key === "Enter" || t.key === "NumpadEnter" ? C() : t.key === "Backspace" && h === "" && n.length > 0 && u(n.slice(0, -1));
|
|
75
|
+
}, R = (t) => {
|
|
76
|
+
u(n.filter((e, s) => s !== t));
|
|
77
|
+
}, [G, P] = N(0), j = L(p, n.length), I = D(() => {
|
|
78
|
+
if (!r.current || !g.current) return;
|
|
79
|
+
const t = r.current.clientWidth - g.current.clientWidth - b.INPUT_MARGIN - b.CONTAINER_PADDING, e = Math.max(0, t);
|
|
80
|
+
P((s) => s === e ? s : e);
|
|
81
|
+
}, []);
|
|
82
|
+
A(() => {
|
|
83
|
+
if (!r.current || !g.current) return;
|
|
84
|
+
I();
|
|
85
|
+
const t = new ResizeObserver(() => {
|
|
86
|
+
I();
|
|
87
|
+
});
|
|
88
|
+
return t.observe(r.current), t.observe(g.current), () => {
|
|
89
|
+
t.disconnect();
|
|
90
|
+
};
|
|
91
|
+
}, [I]);
|
|
92
|
+
const O = Math.min(j, G);
|
|
93
|
+
return /* @__PURE__ */ S("div", { className: _["bsy-inputTag"], ref: r, children: [
|
|
94
|
+
/* @__PURE__ */ o("div", { className: _["bsy-inputTag__container"], children: n.length ? /* @__PURE__ */ o(F, { style: { width: O + "px" }, children: /* @__PURE__ */ o("div", { className: "flex gap-1 py-[3px]", ref: p, children: n.map((t, e) => /* @__PURE__ */ S(
|
|
95
|
+
B.div,
|
|
96
|
+
{
|
|
97
|
+
className: T(
|
|
98
|
+
"rounded-[2px] gap-1 px-[6px] h-[26px] flex items-center flex-shrink-0",
|
|
99
|
+
{
|
|
100
|
+
"cursor-pointer": c,
|
|
101
|
+
"hover:bg-[#e0e0e0]": c && a !== e,
|
|
102
|
+
"bg-[#0265ff] text-white": c && a === e,
|
|
103
|
+
"bg-[#eee] text-black": !c || a !== e
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
onClick: () => M(e, t),
|
|
107
|
+
children: [
|
|
108
|
+
/* @__PURE__ */ o("span", { children: t }),
|
|
109
|
+
/* @__PURE__ */ o(
|
|
110
|
+
"div",
|
|
111
|
+
{
|
|
112
|
+
className: T(
|
|
113
|
+
"cursor-pointer",
|
|
114
|
+
c && a === e ? "text-white hover:text-gray-200" : "text-[#666] hover:text-[#0265ff]"
|
|
115
|
+
),
|
|
116
|
+
onClick: (s) => {
|
|
117
|
+
s.stopPropagation(), R(e);
|
|
118
|
+
},
|
|
119
|
+
children: /* @__PURE__ */ o(V, { name: "close", size: 12 })
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
e
|
|
125
|
+
)) }) }) : null }),
|
|
126
|
+
/* @__PURE__ */ o(
|
|
127
|
+
"div",
|
|
128
|
+
{
|
|
129
|
+
ref: g,
|
|
130
|
+
className: T(
|
|
131
|
+
_["bsy-inputTag__inputContainer"],
|
|
132
|
+
{
|
|
133
|
+
[_["bsy-inputTag__inputContainer--zeroMargin"]]: n.length === 0
|
|
134
|
+
},
|
|
135
|
+
"py-[3px]"
|
|
136
|
+
),
|
|
137
|
+
children: /* @__PURE__ */ o(
|
|
138
|
+
"input",
|
|
139
|
+
{
|
|
140
|
+
value: h,
|
|
141
|
+
onChange: k,
|
|
142
|
+
onKeyDown: E,
|
|
143
|
+
onBlur: C,
|
|
144
|
+
className: T(_["bsy-inputTag__input"], "placeholder:text-[#999]"),
|
|
145
|
+
placeholder: "输入标签"
|
|
146
|
+
}
|
|
147
|
+
)
|
|
148
|
+
}
|
|
149
|
+
)
|
|
150
|
+
] });
|
|
151
|
+
};
|
|
152
|
+
K.displayName = "BsyInputTag";
|
|
153
|
+
export {
|
|
154
|
+
K as I
|
|
155
|
+
};
|
package/dist/InputTag/index.js
CHANGED
|
@@ -12,6 +12,12 @@ export interface ColorPickerProps {
|
|
|
12
12
|
defaultValue?: string;
|
|
13
13
|
/** 颜色变化时的回调函数 */
|
|
14
14
|
onChange?: (color: string) => void;
|
|
15
|
+
/**
|
|
16
|
+
* 颜色输入过程中的回调函数
|
|
17
|
+
* @description 在用户拖动/选择颜色时实时触发,用于实时预览
|
|
18
|
+
* @param color - 当前正在输入的颜色值(RGB/RGBA 格式字符串)
|
|
19
|
+
*/
|
|
20
|
+
onColorInput?: (color: string) => void;
|
|
15
21
|
/** 浮层的放置位置 */
|
|
16
22
|
/** @default 'bottom-start' */
|
|
17
23
|
placement?: 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'bottom-start';
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { useMemo as a, useCallback as u } from "react";
|
|
|
4
4
|
import { z as i, L as f } from "./vendors/useLocale-DgqW9M3h.js";
|
|
5
5
|
import { C as Y } from "./Card/Card-Y1ISqAp9.js";
|
|
6
6
|
import { M as _ } from "./Modal/Modal-z3TvEXwN.js";
|
|
7
|
-
import { C as oe } from "./ColorPicker/ColorPicker-
|
|
7
|
+
import { C as oe } from "./ColorPicker/ColorPicker-D0D5azon.js";
|
|
8
8
|
import { S as ae } from "./Segmented/Segmented-UgzW78Ey.js";
|
|
9
9
|
import { S as re } from "./Select/Select-hwXXDuLU.js";
|
|
10
10
|
import { T as se } from "./vendors/Tree-CLEy-xqz.js";
|
|
@@ -14,7 +14,7 @@ import { a as pe, T as ue } from "./Tabs/TabSelect-DL8Bhehc.js";
|
|
|
14
14
|
import { D as Ce } from "./DropDown/DropDown-DGkSeXQT.js";
|
|
15
15
|
import { L as Ie } from "./Loading/Loading-CEB4PLUE.js";
|
|
16
16
|
import { N as Le } from "./NotFoundContent/NotFoundContent-h0-oIXlk.js";
|
|
17
|
-
import { I as ke } from "./InputTag/InputTag-
|
|
17
|
+
import { I as ke } from "./InputTag/InputTag-C-rQUJnF.js";
|
|
18
18
|
const C = "Please select", U = "search", I = "No search data", x = "Select All", L = "Please enter the content", S = "No Data", k = "No Data Found", h = "Data Searching...", A = "Select All by Search", P = "Left Align", y = "Center Align", N = "Right Align", R = "Underline", F = "Link", T = "Hyper Link", D = "Show Content", b = "Link Address", v = "Open in New Tab", z = "Confirm", w = "Cancel", M = "Cancel Link", E = "preset color", O = { linkTip: "Support https://link or @form alias", bold: "Bold", italic: "Italic", fontSize: "Font Size", fontColor: "Font Color", fill: "fill", alignment: "Alignment", centerAlign: "Center Align", rightAlign: "Right Align", uploadImage: "Upload Image", imageUrl: "Image URL", imageUrlPlaceholder: "Please enter image URL", imageUrlRequired: "Please enter image URL", imageUrlInvalid: "Please enter a valid image URL", imageUrlNote: "Note: Enter image URL to insert image", inputImageUrl: "Enter Image URL", uploadImageNote: "Note: Single image size cannot exceed 1MB", uploadImageText: "Click or drag to upload image", previewImage: "Preview Image", underline: "Underline", imageFormatOnly: "Only image formats are supported", uploadImageFirst: "Please upload image first", imageAddSuccess: "Image added successfully", operationFailed: "Operation failed", onlyImageFormatsSupported: "Only image formats are supported", pleaseUploadImageFirst: "Please upload image first", imageSizeNote: "Image size cannot exceed 1MB", clickOrDragToUpload: "Click or drag to upload image", enterImageUrl: "Enter image URL", pleaseEnterImageUrl: "Please enter image URL", pleaseEnterValidImageUrl: "Please enter a valid image URL", linkAddressEmpty: "Link address cannot be empty" }, B = "Picture", V = "Custom Color", j = "Add Picture", q = {
|
|
19
19
|
select: C,
|
|
20
20
|
search: U,
|
package/package.json
CHANGED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { jsxs as C, jsx as l } from "react/jsx-runtime";
|
|
2
|
-
import { useControllableValue as A } from "ahooks";
|
|
3
|
-
import { useState as S, useLayoutEffect as k, useRef as p, useEffect as D } from "react";
|
|
4
|
-
import { c as h } from "../vendors/clsx-OuTLNxxd.js";
|
|
5
|
-
import { I as M } from "../Icon/Icon-CBlIwtp2.js";
|
|
6
|
-
import { motion as O } from "motion/react";
|
|
7
|
-
import { S as V } from "../vendors/simplebar-react-D68KzE44.js";
|
|
8
|
-
const g = {
|
|
9
|
-
"bsy-inputTag": "_bsy-inputTag_46spj_11",
|
|
10
|
-
"bsy-inputTag__container": "_bsy-inputTag__container_46spj_22",
|
|
11
|
-
"bsy-inputTag__inputContainer": "_bsy-inputTag__inputContainer_46spj_27",
|
|
12
|
-
"bsy-inputTag__inputContainer--zeroMargin": "_bsy-inputTag__inputContainer--zeroMargin_46spj_37",
|
|
13
|
-
"bsy-inputTag__input": "_bsy-inputTag__input_46spj_27"
|
|
14
|
-
}, d = {
|
|
15
|
-
GAP: 4,
|
|
16
|
-
OFFSET: 3,
|
|
17
|
-
CONTAINER_PADDING: 10,
|
|
18
|
-
INPUT_MARGIN: 4
|
|
19
|
-
}, z = (s, _) => {
|
|
20
|
-
const [a, f] = S(0);
|
|
21
|
-
return k(() => {
|
|
22
|
-
if (s.current) {
|
|
23
|
-
const i = s.current.children;
|
|
24
|
-
let e = 0;
|
|
25
|
-
for (let r = 0; r < i.length; r++)
|
|
26
|
-
e += i[r].clientWidth;
|
|
27
|
-
const u = (i.length - 1) * d.GAP;
|
|
28
|
-
f(e + u + d.OFFSET);
|
|
29
|
-
}
|
|
30
|
-
}, [_, s]), a;
|
|
31
|
-
}, B = (s) => {
|
|
32
|
-
const { defaultValue: _, enableActive: a = !1, defaultActiveIndex: f, onActiveIndexChange: i } = s, [e, u] = A(s, {
|
|
33
|
-
defaultValue: _ || []
|
|
34
|
-
}), [r, w] = A(
|
|
35
|
-
s,
|
|
36
|
-
{
|
|
37
|
-
valuePropName: "activeIndex",
|
|
38
|
-
trigger: "onActiveIndexChange",
|
|
39
|
-
defaultValue: f
|
|
40
|
-
}
|
|
41
|
-
), [T, x] = S(""), m = p(null), c = p(null), y = p(null), b = p(!1), E = () => {
|
|
42
|
-
if (c.current && c.current.children.length > 0) {
|
|
43
|
-
const t = c.current.children.length - 1;
|
|
44
|
-
c.current.children[t].scrollIntoView({
|
|
45
|
-
behavior: "smooth",
|
|
46
|
-
block: "nearest",
|
|
47
|
-
inline: "end"
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
D(() => {
|
|
52
|
-
b.current && e.length > 0 && (E(), b.current = !1);
|
|
53
|
-
}, [e.length]);
|
|
54
|
-
const W = (t) => {
|
|
55
|
-
x(t.currentTarget.value);
|
|
56
|
-
}, N = () => {
|
|
57
|
-
const t = T.trim();
|
|
58
|
-
if (t !== "") {
|
|
59
|
-
const n = t;
|
|
60
|
-
b.current = !0, u([...e, n]), x("");
|
|
61
|
-
}
|
|
62
|
-
}, G = (t, n) => {
|
|
63
|
-
if (!a) return;
|
|
64
|
-
const o = r === t ? void 0 : t;
|
|
65
|
-
w(o), i == null || i(o ?? -1, n);
|
|
66
|
-
}, P = (t) => {
|
|
67
|
-
t.key === "Enter" || t.key === "NumpadEnter" ? N() : t.key === "Backspace" && T === "" && e.length > 0 && u(e.slice(0, -1));
|
|
68
|
-
}, j = (t) => {
|
|
69
|
-
u(e.filter((n, o) => o !== t));
|
|
70
|
-
}, I = p(0), v = z(c, e.length);
|
|
71
|
-
k(() => {
|
|
72
|
-
m.current && y.current && (I.current = m.current.clientWidth - y.current.clientWidth - d.INPUT_MARGIN - d.CONTAINER_PADDING);
|
|
73
|
-
}, []);
|
|
74
|
-
const R = v > I.current ? I.current : v;
|
|
75
|
-
return /* @__PURE__ */ C("div", { className: g["bsy-inputTag"], ref: m, children: [
|
|
76
|
-
/* @__PURE__ */ l("div", { className: g["bsy-inputTag__container"], children: e.length ? /* @__PURE__ */ l(V, { style: { width: R + "px" }, children: /* @__PURE__ */ l("div", { className: "flex gap-1 py-[3px]", ref: c, children: e.map((t, n) => /* @__PURE__ */ C(
|
|
77
|
-
O.div,
|
|
78
|
-
{
|
|
79
|
-
className: h(
|
|
80
|
-
"rounded-[2px] gap-1 px-[6px] h-[26px] flex items-center flex-shrink-0",
|
|
81
|
-
{
|
|
82
|
-
"cursor-pointer": a,
|
|
83
|
-
"hover:bg-[#e0e0e0]": a && r !== n,
|
|
84
|
-
"bg-[#0265ff] text-white": a && r === n,
|
|
85
|
-
"bg-[#eee] text-black": !a || r !== n
|
|
86
|
-
}
|
|
87
|
-
),
|
|
88
|
-
onClick: () => G(n, t),
|
|
89
|
-
children: [
|
|
90
|
-
/* @__PURE__ */ l("span", { children: t }),
|
|
91
|
-
/* @__PURE__ */ l(
|
|
92
|
-
"div",
|
|
93
|
-
{
|
|
94
|
-
className: h(
|
|
95
|
-
"cursor-pointer",
|
|
96
|
-
a && r === n ? "text-white hover:text-gray-200" : "text-[#666] hover:text-[#0265ff]"
|
|
97
|
-
),
|
|
98
|
-
onClick: (o) => {
|
|
99
|
-
o.stopPropagation(), j(n);
|
|
100
|
-
},
|
|
101
|
-
children: /* @__PURE__ */ l(M, { name: "close", size: 12 })
|
|
102
|
-
}
|
|
103
|
-
)
|
|
104
|
-
]
|
|
105
|
-
},
|
|
106
|
-
n
|
|
107
|
-
)) }) }) : null }),
|
|
108
|
-
/* @__PURE__ */ l(
|
|
109
|
-
"div",
|
|
110
|
-
{
|
|
111
|
-
ref: y,
|
|
112
|
-
className: h(
|
|
113
|
-
g["bsy-inputTag__inputContainer"],
|
|
114
|
-
{
|
|
115
|
-
[g["bsy-inputTag__inputContainer--zeroMargin"]]: e.length === 0
|
|
116
|
-
},
|
|
117
|
-
"py-[3px]"
|
|
118
|
-
),
|
|
119
|
-
children: /* @__PURE__ */ l(
|
|
120
|
-
"input",
|
|
121
|
-
{
|
|
122
|
-
value: T,
|
|
123
|
-
onChange: W,
|
|
124
|
-
onKeyDown: P,
|
|
125
|
-
onBlur: N,
|
|
126
|
-
className: h(g["bsy-inputTag__input"], "placeholder:text-[#999]"),
|
|
127
|
-
placeholder: "输入标签"
|
|
128
|
-
}
|
|
129
|
-
)
|
|
130
|
-
}
|
|
131
|
-
)
|
|
132
|
-
] });
|
|
133
|
-
};
|
|
134
|
-
B.displayName = "BsyInputTag";
|
|
135
|
-
export {
|
|
136
|
-
B as I
|
|
137
|
-
};
|