@baishuyun/ui-mobile 0.15.1 → 0.16.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/AMap/index.js +1 -1
- package/dist/ActionSheet/index.js +1 -1
- package/dist/AiRuntimeContainer/index.js +418 -0
- package/dist/Calendar/index.js +1 -1
- package/dist/ConfigProvider/index.js +1 -1
- package/dist/Editor/index.js +1 -1
- package/dist/FieldCard/index.js +1 -1
- package/dist/Gantt/index.js +1 -1
- package/dist/Icon/index.js +1 -1
- package/dist/Kanban/Kanban-CaeQxWJF.js +247 -0
- package/dist/Kanban/index.js +3 -3
- package/dist/Overlay/index.js +1 -1
- package/dist/Popup/index.js +1 -1
- package/dist/Segmented/index.js +1 -1
- package/dist/components/AiRuntimeContainer/index.d.ts +8 -0
- package/dist/components/Kanban/Kanban.d.ts +2 -5
- package/dist/components/Kanban/KanbanColumn.d.ts +1 -3
- package/dist/components/Kanban/hooks/useColumnWidth.d.ts +0 -8
- package/dist/components/Kanban/index.d.ts +1 -4
- package/dist/components/Kanban/interface.d.ts +4 -38
- package/dist/components/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/vendors/{version-DSN6E54e.js → version-B1sXyvK3.js} +1 -1
- package/package.json +6 -1
- package/dist/Kanban/Kanban-CrSGrZ-g.js +0 -281
- package/dist/components/Kanban/hooks/useKanbanZoom.d.ts +0 -16
package/dist/AMap/index.js
CHANGED
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
import "../vendors/version-B1sXyvK3.js";
|
|
2
|
+
import * as e from "react";
|
|
3
|
+
import { Component as t, useCallback as n, useEffect as r, useLayoutEffect as i, useMemo as a, useRef as o } from "react";
|
|
4
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
5
|
+
import { createRoot as ee } from "react-dom/client";
|
|
6
|
+
import * as c from "@babel/standalone";
|
|
7
|
+
import { parse as l, walk as u } from "css-tree";
|
|
8
|
+
import * as d from "lucide-react";
|
|
9
|
+
//#region ../shared/src/ai-runtime/moduleNames.ts
|
|
10
|
+
var f = ["react", "lucide-react"], p = new Set(f), m = f.join("、"), h = [
|
|
11
|
+
"value",
|
|
12
|
+
"onChange",
|
|
13
|
+
"disabled",
|
|
14
|
+
"formData",
|
|
15
|
+
"tableMode"
|
|
16
|
+
], g = new Set([
|
|
17
|
+
"fetch",
|
|
18
|
+
"XMLHttpRequest",
|
|
19
|
+
"WebSocket",
|
|
20
|
+
"EventSource",
|
|
21
|
+
"eval",
|
|
22
|
+
"Function",
|
|
23
|
+
"globalThis",
|
|
24
|
+
"self",
|
|
25
|
+
"window",
|
|
26
|
+
"localStorage",
|
|
27
|
+
"sessionStorage",
|
|
28
|
+
"indexedDB"
|
|
29
|
+
]), _ = new Set([
|
|
30
|
+
"script",
|
|
31
|
+
"iframe",
|
|
32
|
+
"object",
|
|
33
|
+
"embed",
|
|
34
|
+
"link"
|
|
35
|
+
]), v = new Set([
|
|
36
|
+
"loc",
|
|
37
|
+
"start",
|
|
38
|
+
"end",
|
|
39
|
+
"extra",
|
|
40
|
+
"range",
|
|
41
|
+
"leadingComments",
|
|
42
|
+
"trailingComments",
|
|
43
|
+
"innerComments"
|
|
44
|
+
]), y = /url\(\s*['"]?\s*(?:https?:)?\/\//i, b = (e) => e?.type === "FunctionDeclaration" || e?.type === "FunctionExpression" || e?.type === "ArrowFunctionExpression";
|
|
45
|
+
function x(e, t) {
|
|
46
|
+
if (!(!e || typeof e.type != "string") && t(e) !== !1) for (let n of Object.keys(e)) {
|
|
47
|
+
if (v.has(n)) continue;
|
|
48
|
+
let r = e[n];
|
|
49
|
+
Array.isArray(r) ? r.forEach((e) => x(e, t)) : r && typeof r == "object" && x(r, t);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function S(e) {
|
|
53
|
+
let t = e.body.find((e) => e.type === "ExportDefaultDeclaration")?.declaration;
|
|
54
|
+
if (!t) return null;
|
|
55
|
+
if (b(t)) return t;
|
|
56
|
+
if (t.type !== "Identifier") return null;
|
|
57
|
+
for (let n of e.body) {
|
|
58
|
+
if (n.type === "FunctionDeclaration" && n.id?.name === t.name) return n;
|
|
59
|
+
if (n.type === "VariableDeclaration") {
|
|
60
|
+
let e = n.declarations.find((e) => e.id?.name === t.name && b(e.init));
|
|
61
|
+
if (e) return e.init;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
var C = (e) => e.computed ? null : e.key.type === "Identifier" ? e.key.name : e.key.type === "StringLiteral" ? e.key.value : null, w = (e) => e ? e.type === "Identifier" ? e.name : e.type === "StringLiteral" ? e.value : e.type === "TemplateLiteral" && e.expressions.length === 0 ? e.quasis[0]?.value?.cooked ?? null : null : null;
|
|
67
|
+
function T(e, t, n) {
|
|
68
|
+
for (let r of e.properties) {
|
|
69
|
+
if (r.type === "RestElement") {
|
|
70
|
+
n.push(`组件不能用 ...rest 收集 props,请只解构 ${h.join("、")}。`);
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
let e = C(r);
|
|
74
|
+
e === null ? n.push("组件的 props 不能使用计算属性名。") : h.includes(e) || t.add(e);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function E(e) {
|
|
78
|
+
let t = [], n = /* @__PURE__ */ new Set(), [r] = e.params;
|
|
79
|
+
return e.params.length > 1 && t.push("组件只接收一个 props 参数,不能有第二个参数(如 ref)。"), r?.type === "AssignmentPattern" && (r = r.left), r?.type === "ObjectPattern" ? T(r, n, t) : r?.type === "Identifier" && x(e.body, (e) => {
|
|
80
|
+
if (e.type === "MemberExpression" && e.object?.name === r.name) {
|
|
81
|
+
let r = e.computed ? null : e.property.name;
|
|
82
|
+
return r === null ? t.push("组件不能用动态键读取 props。") : h.includes(r) || n.add(r), !1;
|
|
83
|
+
}
|
|
84
|
+
return e.type === "VariableDeclarator" && e.init?.name === r.name && e.id.type === "ObjectPattern" ? (T(e.id, n, t), !1) : !0;
|
|
85
|
+
}), n.size && t.unshift(`组件签名只能接收 ${h.join("、")},发现多余的 props:${[...n].join("、")}。平台不会传入它们,请删除,需要的文案或配置直接写在组件内部。`), t;
|
|
86
|
+
}
|
|
87
|
+
function D(e) {
|
|
88
|
+
let t = /* @__PURE__ */ new Set(), n = (e) => {
|
|
89
|
+
switch (e.type) {
|
|
90
|
+
case "Identifier": return g.has(e.name) && t.add(e.name), !0;
|
|
91
|
+
case "MemberExpression":
|
|
92
|
+
case "OptionalMemberExpression": return w(e.property) === "constructor" && t.add("constructor"), e.computed ? !0 : (x(e.object, n), !1);
|
|
93
|
+
case "ObjectProperty": return e.computed ? !0 : (x(e.value, n), !1);
|
|
94
|
+
case "ImportDeclaration": return p.has(e.source.value) || t.add(`import "${e.source.value}"(只能 import ${m})`), !1;
|
|
95
|
+
case "Import":
|
|
96
|
+
case "ImportExpression": return t.add("动态 import()"), !0;
|
|
97
|
+
case "JSXOpeningElement": {
|
|
98
|
+
let n = e.name?.name;
|
|
99
|
+
return n === "textarea" ? t.add("<textarea>(单行文本的值不能包含换行)") : _.has(n) && t.add(`<${n}>`), !0;
|
|
100
|
+
}
|
|
101
|
+
case "JSXAttribute": return e.name?.name === "dangerouslySetInnerHTML" && t.add("dangerouslySetInnerHTML"), !0;
|
|
102
|
+
default: return !0;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
return x(e, n), [...t];
|
|
106
|
+
}
|
|
107
|
+
function O(e) {
|
|
108
|
+
let t = [];
|
|
109
|
+
return /@import\b/i.test(e) && t.push("CSS 中不能使用 @import。"), y.test(e) && t.push("CSS 中不能引用外部地址,图片请用内联 svg 或 data: 地址。"), t;
|
|
110
|
+
}
|
|
111
|
+
function k(e, t = null) {
|
|
112
|
+
let n = [], r = null;
|
|
113
|
+
try {
|
|
114
|
+
r = c.packages.parser.parse(e, {
|
|
115
|
+
sourceType: "module",
|
|
116
|
+
plugins: ["jsx"]
|
|
117
|
+
}).program;
|
|
118
|
+
} catch (e) {
|
|
119
|
+
if (!(e instanceof SyntaxError)) throw e;
|
|
120
|
+
}
|
|
121
|
+
if (r) {
|
|
122
|
+
let e = S(r);
|
|
123
|
+
e && n.push(...E(e));
|
|
124
|
+
let t = D(r);
|
|
125
|
+
t.length && n.push(`不允许使用:${t.join("、")}。组件不能发起网络请求、使用 eval 或 Function,也不能读取 constructor 或注入脚本和原始 HTML。`);
|
|
126
|
+
}
|
|
127
|
+
return t != null && n.push(...O(t)), n;
|
|
128
|
+
}
|
|
129
|
+
function A(e, t = null) {
|
|
130
|
+
let n = k(e, t);
|
|
131
|
+
if (n.length) throw Error(`组件不符合运行时约束:\n${n.map((e) => `- ${e}`).join("\n")}`);
|
|
132
|
+
}
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region ../shared/src/ai-runtime/checkCssSyntax.ts
|
|
135
|
+
function j(e, t = "style.css") {
|
|
136
|
+
e?.trim() && u(l(e, {
|
|
137
|
+
filename: t,
|
|
138
|
+
positions: !0,
|
|
139
|
+
onParseError(e) {
|
|
140
|
+
throw Error(`/${t}: ${e.formattedMessage}`);
|
|
141
|
+
}
|
|
142
|
+
}), (e) => {
|
|
143
|
+
let n = e.value?.type === "Value" ? !e.value.children?.head : !e.value?.value?.trim();
|
|
144
|
+
if (e.type === "Declaration" && n) throw Error(`/${t}: 属性 "${e.property}" 未填写有效值 (${e.loc?.start?.line}:${e.loc?.start?.column})`);
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
//#endregion
|
|
148
|
+
//#region ../shared/src/ai-runtime/sourceText.ts
|
|
149
|
+
var M = /function\s+([A-Za-z_$][\w$]*)/, N = /export\s+default\b/;
|
|
150
|
+
function te(e) {
|
|
151
|
+
if (!e || N.test(e)) return e;
|
|
152
|
+
let t = e.match(M)?.[1];
|
|
153
|
+
return t ? `${e.trim()}\nexport default ${t};\n` : e;
|
|
154
|
+
}
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region ../shared/src/ai-runtime/parseSourceCode.ts
|
|
157
|
+
var ne = /<(jsx|css)>([\s\S]*?)<\/\1>/g, re = {
|
|
158
|
+
ast: !1,
|
|
159
|
+
sourceType: "module",
|
|
160
|
+
presets: [["react", {
|
|
161
|
+
runtime: "classic",
|
|
162
|
+
development: !1
|
|
163
|
+
}]],
|
|
164
|
+
plugins: ["transform-modules-commonjs"]
|
|
165
|
+
};
|
|
166
|
+
function P(e) {
|
|
167
|
+
if (typeof e != "string" || !e.trim()) return null;
|
|
168
|
+
let t = null, n = null;
|
|
169
|
+
for (let r of e.matchAll(ne)) {
|
|
170
|
+
let e = r[2].trim();
|
|
171
|
+
r[1] === "jsx" && (t = e), r[1] === "css" && (n = e);
|
|
172
|
+
}
|
|
173
|
+
return t === null && n === null ? null : {
|
|
174
|
+
jsx: t,
|
|
175
|
+
css: n
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
var ie = "export default function AiRuntimeField() {\n return null;\n}";
|
|
179
|
+
function F(e, t = "ai") {
|
|
180
|
+
let n = P(e);
|
|
181
|
+
if (!n) throw Error("code 里没有可用的 <jsx> 或 <css>。");
|
|
182
|
+
let r = te(n.jsx || ie), i = n.css ?? "";
|
|
183
|
+
i && j(i, `${t}.css`), A(r, i || null);
|
|
184
|
+
let a = c.transform(r, {
|
|
185
|
+
...re,
|
|
186
|
+
filename: `${t}.jsx`
|
|
187
|
+
});
|
|
188
|
+
if (!a?.code) throw Error("Babel 没有产出可执行的代码。");
|
|
189
|
+
return {
|
|
190
|
+
code: a.code,
|
|
191
|
+
css: i
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
//#endregion
|
|
195
|
+
//#region ../shared/src/ai-runtime/compileCache.ts
|
|
196
|
+
var ae = 200, I = /* @__PURE__ */ new Map(), L = Object.freeze({
|
|
197
|
+
ok: !1,
|
|
198
|
+
code: "",
|
|
199
|
+
css: "",
|
|
200
|
+
error: null
|
|
201
|
+
}), R = (e, t) => {
|
|
202
|
+
if (typeof e != "string" || !e.trim()) return L;
|
|
203
|
+
let n = I.get(e);
|
|
204
|
+
if (n) return I.delete(e), I.set(e, n), n;
|
|
205
|
+
let r;
|
|
206
|
+
try {
|
|
207
|
+
let n = F(e, t);
|
|
208
|
+
r = {
|
|
209
|
+
ok: !0,
|
|
210
|
+
code: n.code,
|
|
211
|
+
css: n.css || "",
|
|
212
|
+
error: null
|
|
213
|
+
};
|
|
214
|
+
} catch (e) {
|
|
215
|
+
r = {
|
|
216
|
+
ok: !1,
|
|
217
|
+
code: "",
|
|
218
|
+
css: "",
|
|
219
|
+
error: e
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
if (I.size >= ae) {
|
|
223
|
+
let e = I.keys().next().value;
|
|
224
|
+
e !== void 0 && I.delete(e);
|
|
225
|
+
}
|
|
226
|
+
return I.set(e, r), r;
|
|
227
|
+
}, oe = () => {
|
|
228
|
+
I.clear();
|
|
229
|
+
}, z = (e, t) => {
|
|
230
|
+
let n = {};
|
|
231
|
+
for (let t of Object.keys(e)) n[t] = e[t];
|
|
232
|
+
return (n.default === void 0 || n.default === null) && (n.default = t), Object.defineProperty(n, "__esModule", { value: !0 }), n;
|
|
233
|
+
}, B = e.default || e, se = {
|
|
234
|
+
react: z(e, B),
|
|
235
|
+
"lucide-react": z(d, d)
|
|
236
|
+
}, V = {};
|
|
237
|
+
for (let e of f) {
|
|
238
|
+
let t = se[e];
|
|
239
|
+
if (!t) throw Error(`模块 ${e} 在白名单里但没有实现。`);
|
|
240
|
+
V[e] = t;
|
|
241
|
+
}
|
|
242
|
+
var H = Object.keys(V), ce = (e) => {
|
|
243
|
+
let t = V[e];
|
|
244
|
+
if (t) return t;
|
|
245
|
+
throw Error(`Unknown module: ${e}(组件只能 require ${H.join("、")})`);
|
|
246
|
+
}, U = {
|
|
247
|
+
COMPILE: 4001,
|
|
248
|
+
EXECUTE: 4002,
|
|
249
|
+
RENDER: 5001,
|
|
250
|
+
RUNTIME: 5002
|
|
251
|
+
}, W = new Set(Object.values(U)), G = (e, t) => {
|
|
252
|
+
let n = e instanceof Error ? e : Error(String(e)), r = n.code;
|
|
253
|
+
return (typeof r != "number" || !W.has(r)) && (n.code = t), n;
|
|
254
|
+
}, K = 0, le = (e) => (K += 1, `ai-runtime-${e}-${K}.js`), ue = (e, t) => {
|
|
255
|
+
if (!e) throw Error("没有可执行的代码。");
|
|
256
|
+
let n = {}, r = `${e}\n//# sourceURL=${t}`;
|
|
257
|
+
if (Function("require", "exports", "React", r)(ce, n, B), typeof n.default != "function") throw Error("Missing default export:组件必须默认导出一个函数。");
|
|
258
|
+
return n.default;
|
|
259
|
+
}, q = /* @__PURE__ */ new Map(), J = !1, Y = /* @__PURE__ */ new WeakSet(), de = (e) => {
|
|
260
|
+
e && typeof e == "object" && Y.add(e);
|
|
261
|
+
}, X = (e) => {
|
|
262
|
+
if (e && typeof e == "object" && Y.has(e)) return;
|
|
263
|
+
let t = e instanceof Error ? e.stack : void 0;
|
|
264
|
+
if (typeof t == "string") {
|
|
265
|
+
for (let [n, r] of q) if (t.includes(n)) {
|
|
266
|
+
r(G(e, U.RUNTIME));
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}, fe = () => {
|
|
271
|
+
J || typeof window > "u" || (J = !0, window.addEventListener("error", (e) => {
|
|
272
|
+
let t = e.error || Error(e.message);
|
|
273
|
+
queueMicrotask(() => X(t));
|
|
274
|
+
}), window.addEventListener("unhandledrejection", (e) => {
|
|
275
|
+
let t = e.reason;
|
|
276
|
+
queueMicrotask(() => X(t));
|
|
277
|
+
}));
|
|
278
|
+
}, pe = (e, t) => {
|
|
279
|
+
fe(), q.set(e, t);
|
|
280
|
+
}, me = (e) => {
|
|
281
|
+
q.delete(e);
|
|
282
|
+
}, he = /(^|[\s,>+~(])(?::root\b|html\b|body\b)/gi, Z = (e) => typeof e != "string" || !e ? "" : e.replace(he, "$1:host"), ge = typeof window > "u" ? r : i, _e = class extends t {
|
|
283
|
+
state = { failed: !1 };
|
|
284
|
+
static getDerivedStateFromError() {
|
|
285
|
+
return { failed: !0 };
|
|
286
|
+
}
|
|
287
|
+
componentDidCatch(e) {
|
|
288
|
+
de(e), this.props.onError(G(e, U.RENDER));
|
|
289
|
+
}
|
|
290
|
+
render() {
|
|
291
|
+
return this.state.failed ? null : this.props.children;
|
|
292
|
+
}
|
|
293
|
+
}, Q = (e, t) => {
|
|
294
|
+
let n = e ?? {};
|
|
295
|
+
return {
|
|
296
|
+
value: n.value ?? "",
|
|
297
|
+
disabled: !!n.disabled,
|
|
298
|
+
formData: n.formData || {},
|
|
299
|
+
tableMode: !!n.tableMode,
|
|
300
|
+
onChange: t
|
|
301
|
+
};
|
|
302
|
+
}, ve = {
|
|
303
|
+
ok: !1,
|
|
304
|
+
error: null,
|
|
305
|
+
Component: null
|
|
306
|
+
};
|
|
307
|
+
function ye(e) {
|
|
308
|
+
let t = ({ code: t, value: i, disabled: c, formData: l, tableMode: u, runToken: d, height: f, minHeight: p, className: m, style: h, onChange: g, onError: _ }) => {
|
|
309
|
+
let v = o(null), y = o(null), b = o(null), x = o({});
|
|
310
|
+
x.current = {
|
|
311
|
+
onChange: g,
|
|
312
|
+
onError: _
|
|
313
|
+
};
|
|
314
|
+
let S = o(null);
|
|
315
|
+
S.current === null && (S.current = le(e));
|
|
316
|
+
let C = S.current, w = R(t), T = o({
|
|
317
|
+
source: void 0,
|
|
318
|
+
token: void 0,
|
|
319
|
+
result: ve
|
|
320
|
+
});
|
|
321
|
+
if (T.current.source !== t || T.current.token !== d) {
|
|
322
|
+
let e;
|
|
323
|
+
if (!w.ok) e = {
|
|
324
|
+
ok: !1,
|
|
325
|
+
error: w.error,
|
|
326
|
+
Component: null
|
|
327
|
+
};
|
|
328
|
+
else try {
|
|
329
|
+
e = {
|
|
330
|
+
ok: !0,
|
|
331
|
+
error: null,
|
|
332
|
+
Component: ue(w.code, C)
|
|
333
|
+
};
|
|
334
|
+
} catch (t) {
|
|
335
|
+
e = {
|
|
336
|
+
ok: !1,
|
|
337
|
+
error: t,
|
|
338
|
+
Component: null
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
T.current = {
|
|
342
|
+
source: t,
|
|
343
|
+
token: d,
|
|
344
|
+
result: e
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
let E = T.current.result, D = n((e) => x.current.onChange?.(e), []), O = n((e) => x.current.onError?.(e), []), k = n(() => {
|
|
348
|
+
if (y.current) return y.current;
|
|
349
|
+
let e = v.current;
|
|
350
|
+
if (!e) return null;
|
|
351
|
+
let t = e.shadowRoot || e.attachShadow({ mode: "open" }), n = document.createElement("style"), r = document.createElement("div");
|
|
352
|
+
return r.setAttribute("data-ai-runtime-mount", ""), r.style.height = "100%", t.append(n, r), y.current = {
|
|
353
|
+
root: ee(r, { onUncaughtError: (e) => x.current.onError?.(G(e, U.RUNTIME)) }),
|
|
354
|
+
styleEl: n,
|
|
355
|
+
mountEl: r
|
|
356
|
+
}, y.current;
|
|
357
|
+
}, []), A = a(() => Q({
|
|
358
|
+
value: i,
|
|
359
|
+
disabled: c,
|
|
360
|
+
formData: l,
|
|
361
|
+
tableMode: u
|
|
362
|
+
}, D), [
|
|
363
|
+
i,
|
|
364
|
+
c,
|
|
365
|
+
l,
|
|
366
|
+
u,
|
|
367
|
+
D
|
|
368
|
+
]);
|
|
369
|
+
ge(() => {
|
|
370
|
+
let e = k();
|
|
371
|
+
if (!e) return;
|
|
372
|
+
let { root: t, styleEl: n } = e;
|
|
373
|
+
if (!E.ok) {
|
|
374
|
+
if (b.current !== E && (b.current = E, n.textContent = "", t.render(null), E.error)) {
|
|
375
|
+
let e = w.ok ? U.EXECUTE : U.COMPILE;
|
|
376
|
+
x.current.onError?.(G(E.error, e));
|
|
377
|
+
}
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
b.current = null;
|
|
381
|
+
let r = Z(w.css);
|
|
382
|
+
n.textContent !== r && (n.textContent = r);
|
|
383
|
+
let i = E.Component;
|
|
384
|
+
t.render(/* @__PURE__ */ s(_e, {
|
|
385
|
+
onError: O,
|
|
386
|
+
children: /* @__PURE__ */ s(i, { ...A })
|
|
387
|
+
}));
|
|
388
|
+
}, [
|
|
389
|
+
w,
|
|
390
|
+
E,
|
|
391
|
+
A,
|
|
392
|
+
O,
|
|
393
|
+
k
|
|
394
|
+
]), r(() => () => {
|
|
395
|
+
let e = y.current;
|
|
396
|
+
y.current = null, e && (e.styleEl.remove(), e.mountEl.remove(), queueMicrotask(() => e.root.unmount()));
|
|
397
|
+
}, []), r(() => (pe(C, (e) => x.current.onError?.(e)), () => me(C)), [C]);
|
|
398
|
+
let j = {
|
|
399
|
+
height: f ?? "auto",
|
|
400
|
+
minHeight: p ?? 32,
|
|
401
|
+
overflow: "auto",
|
|
402
|
+
contain: "layout paint",
|
|
403
|
+
...h
|
|
404
|
+
};
|
|
405
|
+
return /* @__PURE__ */ s("div", {
|
|
406
|
+
ref: v,
|
|
407
|
+
"data-ai-runtime-host": "",
|
|
408
|
+
className: m,
|
|
409
|
+
style: j
|
|
410
|
+
});
|
|
411
|
+
};
|
|
412
|
+
return t.displayName = "BsyAiRuntimeContainer", t;
|
|
413
|
+
}
|
|
414
|
+
//#endregion
|
|
415
|
+
//#region src/components/AiRuntimeContainer/index.ts
|
|
416
|
+
var $ = ye("ui-mobile");
|
|
417
|
+
//#endregion
|
|
418
|
+
export { $ as AiRuntimeContainer, $ as default, U as ERROR_CODE, H as MODULE_NAMES, A as assertFieldSource, oe as clearCompileCache, F as compileAiCode, R as compileCached, Z as scopeCss, P as splitAiCode, Q as toPlainProps, k as validateFieldSource };
|
package/dist/Calendar/index.js
CHANGED
package/dist/Editor/index.js
CHANGED
package/dist/FieldCard/index.js
CHANGED
package/dist/Gantt/index.js
CHANGED
package/dist/Icon/index.js
CHANGED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { t as e } from "../Icon/Icon-C-WocsyI.js";
|
|
2
|
+
import { t } from "../FieldCard/FieldCard-D8z0UA88.js";
|
|
3
|
+
import n, { useCallback as r, useEffect as i, useLayoutEffect as a, useMemo as o, useRef as s, useState as c } from "react";
|
|
4
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
5
|
+
import { useVirtualizer as d } from "@tanstack/react-virtual";
|
|
6
|
+
//#region src/components/Kanban/constants.ts
|
|
7
|
+
var f = {
|
|
8
|
+
small: 180,
|
|
9
|
+
middle: 240,
|
|
10
|
+
large: 320
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/components/Kanban/hooks/useColumnWidth.ts
|
|
14
|
+
function p(e) {
|
|
15
|
+
let { columnSize: t = "middle", coverLayout: n, hasSideCover: r = !1 } = e ?? {};
|
|
16
|
+
return o(() => (f[t] ?? f.middle) + (r || n?.position === "left" || n?.position === "right" ? 80 : 0) + 20, [
|
|
17
|
+
t,
|
|
18
|
+
n?.position,
|
|
19
|
+
r
|
|
20
|
+
]);
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/components/Kanban/addButtonPlacement.ts
|
|
24
|
+
var m = 34, h = 40;
|
|
25
|
+
function g({ contentHeight: e, viewportHeight: t, hasPaging: n, hasFooter: r }) {
|
|
26
|
+
let i = n ? h : 0, a = e + (n ? i : 10), o = r && t > 0 && a + m > t;
|
|
27
|
+
return {
|
|
28
|
+
sticky: o,
|
|
29
|
+
buttonTop: a,
|
|
30
|
+
listHeight: o || !r ? e + i : a + m
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/components/Kanban/Kanban.module.scss
|
|
35
|
+
var _ = {
|
|
36
|
+
"bsy-mobile-kanban": "_bsy-mobile-kanban_ry73g_2",
|
|
37
|
+
"bsy-mobile-kanban__board": "_bsy-mobile-kanban__board_ry73g_13",
|
|
38
|
+
"bsy-mobile-kanban__board--zoomed": "_bsy-mobile-kanban__board--zoomed_ry73g_28",
|
|
39
|
+
"bsy-mobile-kanban__list": "_bsy-mobile-kanban__list_ry73g_35",
|
|
40
|
+
"bsy-mobile-kanban__column": "_bsy-mobile-kanban__column_ry73g_42",
|
|
41
|
+
"bsy-mobile-kanban__column-header": "_bsy-mobile-kanban__column-header_ry73g_51",
|
|
42
|
+
"bsy-mobile-kanban__column-title": "_bsy-mobile-kanban__column-title_ry73g_60",
|
|
43
|
+
"bsy-mobile-kanban__column-badge": "_bsy-mobile-kanban__column-badge_ry73g_70",
|
|
44
|
+
"bsy-mobile-kanban__column-body": "_bsy-mobile-kanban__column-body_ry73g_76",
|
|
45
|
+
"bsy-mobile-kanban__virtual-container": "_bsy-mobile-kanban__virtual-container_ry73g_94",
|
|
46
|
+
"bsy-mobile-kanban__card-wrapper": "_bsy-mobile-kanban__card-wrapper_ry73g_99",
|
|
47
|
+
"bsy-mobile-kanban__column-footer": "_bsy-mobile-kanban__column-footer_ry73g_109",
|
|
48
|
+
"bsy-mobile-kanban__add-anchor": "_bsy-mobile-kanban__add-anchor_ry73g_114",
|
|
49
|
+
"bsy-mobile-kanban__paging": "_bsy-mobile-kanban__paging_ry73g_119",
|
|
50
|
+
"bsy-mobile-kanban__paging--no-more": "_bsy-mobile-kanban__paging--no-more_ry73g_126",
|
|
51
|
+
"bsy-mobile-kanban__add-btn": "_bsy-mobile-kanban__add-btn_ry73g_129",
|
|
52
|
+
"bsy-mobile-kanban__empty": "_bsy-mobile-kanban__empty_ry73g_148"
|
|
53
|
+
};
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/components/Kanban/KanbanColumn.tsx
|
|
56
|
+
function v({ column: n, columnWidth: o, coverLayout: f, fieldLayout: p, renderColumnTitle: m, onAdd: h, onClick: v, onReachBottom: y }) {
|
|
57
|
+
let b = s(null), [x, S] = c(0), C = n.id, w = n.items || [], T = n.total, E = s(w);
|
|
58
|
+
E.current = w;
|
|
59
|
+
let D = n.paging, O = D?.loading === !0, k = D?.noMore === !0, A = s(!1);
|
|
60
|
+
i(() => {
|
|
61
|
+
O || (A.current = !1);
|
|
62
|
+
}, [O]);
|
|
63
|
+
let [j, M] = c(!1);
|
|
64
|
+
i(() => {
|
|
65
|
+
w.length === 0 && M(!1);
|
|
66
|
+
}, [w.length]);
|
|
67
|
+
let N = r((e) => {
|
|
68
|
+
let t = e.currentTarget, n = t.scrollHeight - t.scrollTop - t.clientHeight, r = t.scrollHeight > t.clientHeight + 10, i = n <= 50;
|
|
69
|
+
r && i && M(!0), i && !O && !k && !A.current && y && (A.current = !0, y(C));
|
|
70
|
+
}, [
|
|
71
|
+
C,
|
|
72
|
+
k,
|
|
73
|
+
O,
|
|
74
|
+
y
|
|
75
|
+
]), P = d({
|
|
76
|
+
count: w.length,
|
|
77
|
+
getScrollElement: () => b.current,
|
|
78
|
+
estimateSize: () => 160,
|
|
79
|
+
overscan: 6,
|
|
80
|
+
gap: 10,
|
|
81
|
+
getItemKey: (e) => E.current[e]?.id ?? String(e)
|
|
82
|
+
}), F = P.getVirtualItems();
|
|
83
|
+
a(() => {
|
|
84
|
+
let e = b.current;
|
|
85
|
+
if (!e) return;
|
|
86
|
+
let t = () => S(e.clientHeight);
|
|
87
|
+
if (t(), typeof ResizeObserver > "u") return;
|
|
88
|
+
let n = new ResizeObserver(t);
|
|
89
|
+
return n.observe(e), () => n.disconnect();
|
|
90
|
+
}, []);
|
|
91
|
+
let I = m ? m(n) : n.title, L = /* @__PURE__ */ u("div", {
|
|
92
|
+
className: _["bsy-mobile-kanban__column-header"],
|
|
93
|
+
children: [/* @__PURE__ */ l("div", {
|
|
94
|
+
className: _["bsy-mobile-kanban__column-title"],
|
|
95
|
+
children: I
|
|
96
|
+
}), typeof T == "number" && /* @__PURE__ */ l("span", {
|
|
97
|
+
className: _["bsy-mobile-kanban__column-badge"],
|
|
98
|
+
children: T
|
|
99
|
+
})]
|
|
100
|
+
}), R = n.addable ? /* @__PURE__ */ l("div", {
|
|
101
|
+
className: _["bsy-mobile-kanban__column-footer"],
|
|
102
|
+
children: /* @__PURE__ */ l("button", {
|
|
103
|
+
type: "button",
|
|
104
|
+
className: _["bsy-mobile-kanban__add-btn"],
|
|
105
|
+
onClick: () => h?.(C),
|
|
106
|
+
"aria-label": "快速添加卡片",
|
|
107
|
+
"data-testid": `kanban-add-${C}`,
|
|
108
|
+
children: /* @__PURE__ */ l(e, {
|
|
109
|
+
name: "add",
|
|
110
|
+
size: 16,
|
|
111
|
+
color: "#000"
|
|
112
|
+
})
|
|
113
|
+
})
|
|
114
|
+
}) : null, z = w.length > 0 ? P.getTotalSize() : 0, B = O || k && j && w.length > 0, V = g({
|
|
115
|
+
contentHeight: z,
|
|
116
|
+
viewportHeight: x,
|
|
117
|
+
hasPaging: B,
|
|
118
|
+
hasFooter: !!R
|
|
119
|
+
}), H = B ? /* @__PURE__ */ l("div", {
|
|
120
|
+
className: O ? _["bsy-mobile-kanban__paging"] : `${_["bsy-mobile-kanban__paging"]} ${_["bsy-mobile-kanban__paging--no-more"]}`,
|
|
121
|
+
style: {
|
|
122
|
+
position: "absolute",
|
|
123
|
+
top: z,
|
|
124
|
+
left: 0,
|
|
125
|
+
right: 0
|
|
126
|
+
},
|
|
127
|
+
children: O ? "正在加载更多..." : "- 没有更多数据了 -"
|
|
128
|
+
}) : null;
|
|
129
|
+
return /* @__PURE__ */ u("div", {
|
|
130
|
+
className: _["bsy-mobile-kanban__column"],
|
|
131
|
+
style: {
|
|
132
|
+
width: `${o}px`,
|
|
133
|
+
minWidth: `${o}px`
|
|
134
|
+
},
|
|
135
|
+
"data-testid": `kanban-column-${C}`,
|
|
136
|
+
children: [
|
|
137
|
+
L,
|
|
138
|
+
/* @__PURE__ */ l("div", {
|
|
139
|
+
ref: b,
|
|
140
|
+
className: _["bsy-mobile-kanban__column-body"],
|
|
141
|
+
onScroll: N,
|
|
142
|
+
"data-testid": `kanban-column-body-${C}`,
|
|
143
|
+
children: w.length > 0 || R && !V.sticky ? /* @__PURE__ */ u("div", {
|
|
144
|
+
className: _["bsy-mobile-kanban__virtual-container"],
|
|
145
|
+
style: { height: `${V.listHeight}px` },
|
|
146
|
+
children: [
|
|
147
|
+
F.map((e) => {
|
|
148
|
+
let n = w[e.index];
|
|
149
|
+
return n ? /* @__PURE__ */ l("div", {
|
|
150
|
+
ref: P.measureElement,
|
|
151
|
+
"data-index": e.index,
|
|
152
|
+
className: _["bsy-mobile-kanban__card-wrapper"],
|
|
153
|
+
style: {
|
|
154
|
+
position: "absolute",
|
|
155
|
+
top: 0,
|
|
156
|
+
left: 0,
|
|
157
|
+
width: "100%",
|
|
158
|
+
transform: `translateY(${e.start}px)`
|
|
159
|
+
},
|
|
160
|
+
"data-testid": `kanban-card-${n.id}`,
|
|
161
|
+
onClick: () => v?.(n, C),
|
|
162
|
+
children: /* @__PURE__ */ u(t, {
|
|
163
|
+
title: n.title,
|
|
164
|
+
cover: n.cover,
|
|
165
|
+
coverPlaceholder: f?.position === "left",
|
|
166
|
+
coverLayout: f,
|
|
167
|
+
layout: p,
|
|
168
|
+
children: [n.fields?.map((e, n) => /* @__PURE__ */ l(t.Meta, {
|
|
169
|
+
label: e.label,
|
|
170
|
+
icon: e.icon,
|
|
171
|
+
value: e.value
|
|
172
|
+
}, e.key ?? n)), n.footer ? /* @__PURE__ */ l(t.Footer, { children: n.footer }) : null]
|
|
173
|
+
})
|
|
174
|
+
}, e.key) : null;
|
|
175
|
+
}),
|
|
176
|
+
H,
|
|
177
|
+
R && !V.sticky ? /* @__PURE__ */ l("div", {
|
|
178
|
+
className: _["bsy-mobile-kanban__add-anchor"],
|
|
179
|
+
style: { top: V.buttonTop },
|
|
180
|
+
children: R
|
|
181
|
+
}) : null
|
|
182
|
+
]
|
|
183
|
+
}) : null
|
|
184
|
+
}),
|
|
185
|
+
V.sticky ? R : null
|
|
186
|
+
]
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
var y = n.memo(v);
|
|
190
|
+
//#endregion
|
|
191
|
+
//#region src/components/Kanban/Kanban.tsx
|
|
192
|
+
function b({ columns: e, columnSize: t = "middle", coverLayout: n, hasSideCover: r = !1, fieldLayout: a = "vertical", zoomed: o = !1, renderColumnTitle: c, onAdd: u, onClick: d, onReachBottom: f, empty: m, style: h }) {
|
|
193
|
+
let g = s(null), v = p({
|
|
194
|
+
columnSize: t,
|
|
195
|
+
coverLayout: n,
|
|
196
|
+
hasSideCover: r
|
|
197
|
+
});
|
|
198
|
+
i(() => {
|
|
199
|
+
let e = g.current;
|
|
200
|
+
if (!e) return;
|
|
201
|
+
let t = e.scrollWidth || 1, n = e.scrollHeight || 1, r = (e.scrollLeft + e.clientWidth / 2) / t, i = (e.scrollTop + e.clientHeight / 2) / n;
|
|
202
|
+
requestAnimationFrame(() => {
|
|
203
|
+
e.scrollLeft = r * e.scrollWidth - e.clientWidth / 2, e.scrollTop = i * e.scrollHeight - e.clientHeight / 2;
|
|
204
|
+
});
|
|
205
|
+
}, [o]);
|
|
206
|
+
let b = !e || e.length === 0, x = [_["bsy-mobile-kanban__board"], o ? _["bsy-mobile-kanban__board--zoomed"] : ""].filter(Boolean).join(" ");
|
|
207
|
+
return /* @__PURE__ */ l("div", {
|
|
208
|
+
className: _["bsy-mobile-kanban"],
|
|
209
|
+
style: h,
|
|
210
|
+
"data-testid": "kanban-root",
|
|
211
|
+
children: /* @__PURE__ */ l("div", {
|
|
212
|
+
ref: g,
|
|
213
|
+
className: x,
|
|
214
|
+
"data-testid": "kanban-board",
|
|
215
|
+
children: b && m ? /* @__PURE__ */ l("div", {
|
|
216
|
+
className: _["bsy-mobile-kanban__empty"],
|
|
217
|
+
children: m
|
|
218
|
+
}) : /* @__PURE__ */ l("div", {
|
|
219
|
+
className: _["bsy-mobile-kanban__list"],
|
|
220
|
+
"data-testid": "kanban-list",
|
|
221
|
+
children: e?.map((e) => /* @__PURE__ */ l(y, {
|
|
222
|
+
column: e,
|
|
223
|
+
columnWidth: v,
|
|
224
|
+
coverLayout: n,
|
|
225
|
+
fieldLayout: a,
|
|
226
|
+
renderColumnTitle: c,
|
|
227
|
+
onAdd: u,
|
|
228
|
+
onClick: d,
|
|
229
|
+
onReachBottom: f
|
|
230
|
+
}, e.id))
|
|
231
|
+
})
|
|
232
|
+
})
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
//#endregion
|
|
236
|
+
//#region src/components/Kanban/utils/columnPage.ts
|
|
237
|
+
function x(e, t, n) {
|
|
238
|
+
if (t.length === 0) return [...e];
|
|
239
|
+
let r = n ?? ((e) => e?.id), i = new Set(e.map(r).filter(Boolean)), a = [];
|
|
240
|
+
for (let e of t) {
|
|
241
|
+
let t = r(e);
|
|
242
|
+
t && i.has(t) || (t && i.add(t), a.push(e));
|
|
243
|
+
}
|
|
244
|
+
return e.concat(a);
|
|
245
|
+
}
|
|
246
|
+
//#endregion
|
|
247
|
+
export { b as n, x as t };
|
package/dist/Kanban/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../vendors/version-
|
|
1
|
+
import "../vendors/version-B1sXyvK3.js";
|
|
2
2
|
import "../Icon/Icon-C-WocsyI.js";
|
|
3
3
|
import "../FieldCard/FieldCard-D8z0UA88.js";
|
|
4
|
-
import {
|
|
5
|
-
export {
|
|
4
|
+
import { n as e, t } from "./Kanban-CaeQxWJF.js";
|
|
5
|
+
export { e as Kanban, e as default, t as appendKanbanCards };
|
package/dist/Overlay/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "../vendors/version-
|
|
1
|
+
import "../vendors/version-B1sXyvK3.js";
|
|
2
2
|
import { a as e, i as t, n, o as r, r as i, t as a } from "./Overlay-DFiZYsBs.js";
|
|
3
3
|
export { a as OVERLAY_Z_BASE, n as OVERLAY_Z_STEP, i as OverlayProvider, t as getNextImperativeOverlayZIndex, e as imperativeOverlayStyle, r as useOverlayZIndex };
|
package/dist/Popup/index.js
CHANGED
package/dist/Segmented/index.js
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare const AiRuntimeContainer: {
|
|
2
|
+
({ code, value, disabled, formData, tableMode, runToken, height, minHeight, className, style, onChange, onError, }: import('../../../../shared/src/ai-runtime/index.ts').AiRuntimeContainerProps): import("react").JSX.Element;
|
|
3
|
+
displayName: string;
|
|
4
|
+
};
|
|
5
|
+
export { AiRuntimeContainer };
|
|
6
|
+
export default AiRuntimeContainer;
|
|
7
|
+
export type { AiCodeParts, AiRuntimeContainerError, AiRuntimeContainerErrorCode, AiRuntimeContainerProps, CompiledAiCode, CompiledCacheEntry, } from '../../../../shared/src/ai-runtime/index.ts';
|
|
8
|
+
export { assertFieldSource, clearCompileCache, compileAiCode, compileCached, ERROR_CODE, MODULE_NAMES, scopeCss, splitAiCode, toPlainProps, validateFieldSource, } from '../../../../shared/src/ai-runtime/index.ts';
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const Kanban: <TMeta = unknown>(props: KanbanProps<TMeta> & {
|
|
4
|
-
ref?: React.Ref<KanbanRef>;
|
|
5
|
-
}) => React.ReactElement;
|
|
1
|
+
import { KanbanProps } from './interface';
|
|
2
|
+
declare function Kanban<TMeta = unknown>({ columns, columnSize, coverLayout, hasSideCover, fieldLayout, zoomed, renderColumnTitle, onAdd, onClick, onReachBottom, empty, style, }: KanbanProps<TMeta>): import("react").JSX.Element;
|
|
6
3
|
export default Kanban;
|
|
@@ -6,12 +6,10 @@ export interface KanbanColumnProps<TMeta> {
|
|
|
6
6
|
coverLayout?: KanbanCoverLayout;
|
|
7
7
|
fieldLayout: KanbanFieldLayout;
|
|
8
8
|
renderColumnTitle?: (column: KanbanColumnType<TMeta>) => React.ReactNode;
|
|
9
|
-
renderColumnHeader?: (column: KanbanColumnType<TMeta>) => React.ReactNode;
|
|
10
|
-
renderColumnFooter?: (column: KanbanColumnType<TMeta>) => React.ReactNode;
|
|
11
9
|
onAdd?: (columnId: string) => void;
|
|
12
10
|
onClick?: (card: KanbanCard<TMeta>, columnId: string) => void;
|
|
13
11
|
onReachBottom?: (columnId: string) => void;
|
|
14
12
|
}
|
|
15
|
-
export declare function KanbanColumn<TMeta>({ column, columnWidth, coverLayout, fieldLayout, renderColumnTitle,
|
|
13
|
+
export declare function KanbanColumn<TMeta>({ column, columnWidth, coverLayout, fieldLayout, renderColumnTitle, onAdd, onClick, onReachBottom, }: KanbanColumnProps<TMeta>): React.JSX.Element;
|
|
16
14
|
declare const _default: typeof KanbanColumn;
|
|
17
15
|
export default _default;
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
import { KanbanColumnSize, KanbanCoverLayout } from '../interface';
|
|
2
2
|
export interface UseColumnWidthOptions {
|
|
3
3
|
columnSize?: KanbanColumnSize;
|
|
4
|
-
columnWidth?: number;
|
|
5
4
|
coverLayout?: KanbanCoverLayout;
|
|
6
5
|
hasSideCover?: boolean;
|
|
7
6
|
}
|
|
8
|
-
/**
|
|
9
|
-
* 计算移动端看板单列宽度的 Hook。
|
|
10
|
-
* 命名与规则完全对齐 PC 端 (@baishuyun/ui-base/Kanban):
|
|
11
|
-
* - columnWidth(自定义数值)优先级最高,且传入 columnWidth 后不再加封面侧栏宽度;
|
|
12
|
-
* - 缺省 columnWidth 时使用 columnSize(默认 'middle');
|
|
13
|
-
* - 封面处于左右侧(coverLayout 为 left/right 或 hasSideCover=true)时,在 columnSize 档位基础上增加 80px 宽度。
|
|
14
|
-
*/
|
|
15
7
|
export declare function useColumnWidth(options?: UseColumnWidthOptions): number;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
export { default } from './Kanban';
|
|
2
2
|
export { default as Kanban } from './Kanban';
|
|
3
|
-
export {
|
|
4
|
-
export type { KanbanCard, KanbanCardField, KanbanColumn as KanbanColumnType, KanbanColumnPaging, KanbanColumnSize, KanbanCoverLayout, KanbanFieldLayout, KanbanProps, KanbanRef, } from './interface';
|
|
3
|
+
export type { KanbanCard, KanbanCardField, KanbanColumn as KanbanColumnType, KanbanColumnPaging, KanbanColumnSize, KanbanCoverLayout, KanbanFieldLayout, KanbanProps, } from './interface';
|
|
5
4
|
export { appendKanbanCards } from './utils/columnPage';
|
|
6
|
-
export { useKanbanZoom } from './hooks/useKanbanZoom';
|
|
7
|
-
export { useColumnWidth } from './hooks/useColumnWidth';
|
|
@@ -36,32 +36,14 @@ export interface KanbanColumn<TMeta = unknown> {
|
|
|
36
36
|
/** 允许挂载业务透传的自定义元数据 */
|
|
37
37
|
meta?: unknown;
|
|
38
38
|
}
|
|
39
|
-
export interface KanbanRef {
|
|
40
|
-
/** 当前是否处于 0.6x 鸟瞰缩放模式 */
|
|
41
|
-
isZoomedOut: boolean;
|
|
42
|
-
/** 切换缩放状态 */
|
|
43
|
-
toggleZoom: () => void;
|
|
44
|
-
/** 设置缩放状态 */
|
|
45
|
-
setZoom: (zoomed: boolean) => void;
|
|
46
|
-
}
|
|
47
39
|
export interface KanbanProps<TMeta = unknown> {
|
|
48
40
|
/** 各列数据与配置 */
|
|
49
41
|
columns: KanbanColumn<TMeta>[];
|
|
50
|
-
/**
|
|
51
|
-
* 三档栏宽。未传 `columnWidth` 时使用,缺省 'middle'
|
|
52
|
-
*/
|
|
42
|
+
/** 三档栏宽,缺省 middle。左右封面时再加 80 */
|
|
53
43
|
columnSize?: KanbanColumnSize;
|
|
54
|
-
/**
|
|
55
|
-
* 自定义栏宽像素数值。优先于 columnSize,且不再加封面侧栏宽度
|
|
56
|
-
*/
|
|
57
|
-
columnWidth?: number;
|
|
58
|
-
/**
|
|
59
|
-
* 整板封面布局。position 为 left 或 right 且未传 columnWidth 时,栏宽加 80
|
|
60
|
-
*/
|
|
44
|
+
/** 整板封面布局。position 为 left 或 right 时栏宽加 80 */
|
|
61
45
|
coverLayout?: KanbanCoverLayout;
|
|
62
|
-
/**
|
|
63
|
-
* 是否有侧边封面。为 true 且未传 columnWidth 时,栏宽加 80
|
|
64
|
-
*/
|
|
46
|
+
/** 为 true 时栏宽加 80 */
|
|
65
47
|
hasSideCover?: boolean;
|
|
66
48
|
/** 字段行排列。缺省 vertical */
|
|
67
49
|
fieldLayout?: KanbanFieldLayout;
|
|
@@ -69,14 +51,6 @@ export interface KanbanProps<TMeta = unknown> {
|
|
|
69
51
|
* 自定义列标题内容(保留外层标准 Header 布局与数量 Badge)
|
|
70
52
|
*/
|
|
71
53
|
renderColumnTitle?: (column: KanbanColumn<TMeta>) => React.ReactNode;
|
|
72
|
-
/**
|
|
73
|
-
* 完全接管列头整块区域渲染(若提供则完全覆盖默认 Header 与 Badge)
|
|
74
|
-
*/
|
|
75
|
-
renderColumnHeader?: (column: KanbanColumn<TMeta>) => React.ReactNode;
|
|
76
|
-
/**
|
|
77
|
-
* 自定义添加按钮区域。卡片未撑满列时跟在最后一张后面,撑满后固定在列视口底部。
|
|
78
|
-
*/
|
|
79
|
-
renderColumnFooter?: (column: KanbanColumn<TMeta>) => React.ReactNode;
|
|
80
54
|
/**
|
|
81
55
|
* 添加按钮点击。位置规则与默认按钮相同。
|
|
82
56
|
*/
|
|
@@ -93,15 +67,7 @@ export interface KanbanProps<TMeta = unknown> {
|
|
|
93
67
|
* 空状态呈现节点(当 columns 列表为空时渲染)
|
|
94
68
|
*/
|
|
95
69
|
empty?: React.ReactNode;
|
|
96
|
-
/**
|
|
97
|
-
* 是否处于 0.6x 鸟瞰缩放模式(受控属性)。
|
|
98
|
-
* 看板不内置悬浮缩放按钮,缩放按钮由宿主页面实现。
|
|
99
|
-
*/
|
|
70
|
+
/** 为 true 时整板缩放到 0.6 倍 */
|
|
100
71
|
zoomed?: boolean;
|
|
101
|
-
/**
|
|
102
|
-
* 缩放状态变更回调
|
|
103
|
-
*/
|
|
104
|
-
onZoomChange?: (zoomed: boolean) => void;
|
|
105
|
-
className?: string;
|
|
106
72
|
style?: React.CSSProperties;
|
|
107
73
|
}
|
|
@@ -21,5 +21,5 @@ export { default as Editor, EditorHtmlPreview } from './Editor';
|
|
|
21
21
|
export type { EditorAi, EditorAiMode, EditorAiPreset, EditorAiStatus, EditorProps, EditorToolbarConfigButton, EditorToolbarGroup, EditorToolbarProps, EditorUpload, EditorUploadContext, EditorUploadResult, } from './Editor';
|
|
22
22
|
export { default as FieldCard } from './FieldCard';
|
|
23
23
|
export type { FieldCardCoverLayout, FieldCardLayout, FieldCardProps, FieldCardTheme, } from './FieldCard';
|
|
24
|
-
export { default as Kanban,
|
|
25
|
-
export type { KanbanCard, KanbanCardField, KanbanColumnType, KanbanColumnPaging, KanbanColumnSize, KanbanCoverLayout, KanbanFieldLayout, KanbanProps,
|
|
24
|
+
export { default as Kanban, appendKanbanCards } from './Kanban';
|
|
25
|
+
export type { KanbanCard, KanbanCardField, KanbanColumnType, KanbanColumnPaging, KanbanColumnSize, KanbanCoverLayout, KanbanFieldLayout, KanbanProps, } from './Kanban';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./vendors/version-
|
|
1
|
+
import "./vendors/version-B1sXyvK3.js";
|
|
2
2
|
import { a as e, i as t, n, o as r, r as i, t as a } from "./Overlay/Overlay-DFiZYsBs.js";
|
|
3
3
|
import { t as o } from "./ConfigProvider/useLocale-DiKogqPs.js";
|
|
4
4
|
import { t as s } from "./Popup/Popup-Cg3t422z.js";
|
|
@@ -12,5 +12,5 @@ import { n as m, t as h } from "./AMap/AMap-B-A2jg1r.js";
|
|
|
12
12
|
import { t as g } from "./ConfigProvider/ConfigProvider-CNWefxiV.js";
|
|
13
13
|
import { n as _, t as v } from "./Editor/Editor-zj5lpqGC.js";
|
|
14
14
|
import { t as y } from "./FieldCard/FieldCard-D8z0UA88.js";
|
|
15
|
-
import {
|
|
16
|
-
export { u as ALL_ZOOM_LEVELS, h as AMap, l as ActionSheet, f as Calendar, g as ConfigProvider, v as Editor, _ as EditorHtmlPreview, y as FieldCard, d as Gantt, c as Icon,
|
|
15
|
+
import { n as b, t as x } from "./Kanban/Kanban-CaeQxWJF.js";
|
|
16
|
+
export { u as ALL_ZOOM_LEVELS, h as AMap, l as ActionSheet, f as Calendar, g as ConfigProvider, v as Editor, _ as EditorHtmlPreview, y as FieldCard, d as Gantt, c as Icon, b as Kanban, a as OVERLAY_Z_BASE, n as OVERLAY_Z_STEP, i as OverlayProvider, s as Popup, p as Segmented, x as appendKanbanCards, t as getNextImperativeOverlayZIndex, e as imperativeOverlayStyle, m as useAMap, o as useLocale, r as useOverlayZIndex };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baishuyun/ui-mobile",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "百数云 H5 / Mobile UI 组件库",
|
|
6
6
|
"author": "bsy-fe team",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"ahooks": ">=3.7.0",
|
|
44
44
|
"dayjs": ">=1.11.0",
|
|
45
|
+
"lucide-react": ">=1.60.0",
|
|
45
46
|
"react": ">=18.3.0",
|
|
46
47
|
"react-dom": ">=18.3.0"
|
|
47
48
|
},
|
|
@@ -61,10 +62,13 @@
|
|
|
61
62
|
"@shikijs/langs": "^4.0.2",
|
|
62
63
|
"@shikijs/themes": "^4.0.2",
|
|
63
64
|
"@tanstack/react-virtual": "^3.14.3",
|
|
65
|
+
"@babel/standalone": "7.29.7",
|
|
66
|
+
"css-tree": "^3.2.1",
|
|
64
67
|
"dompurify": "^3.4.14",
|
|
65
68
|
"lexical": "0.45.0"
|
|
66
69
|
},
|
|
67
70
|
"devDependencies": {
|
|
71
|
+
"@types/babel__standalone": "^7.1.9",
|
|
68
72
|
"@types/node": "^24.3.0",
|
|
69
73
|
"@types/react": "^18.3.1",
|
|
70
74
|
"@types/react-dom": "^18.3.0",
|
|
@@ -72,6 +76,7 @@
|
|
|
72
76
|
"ahooks": "^3.8.5",
|
|
73
77
|
"dayjs": "^1.11.13",
|
|
74
78
|
"glob": "^11.0.3",
|
|
79
|
+
"lucide-react": "1.60.0",
|
|
75
80
|
"react": "^18.3.1",
|
|
76
81
|
"react-dom": "^18.3.1",
|
|
77
82
|
"sass": "^1.89.2",
|
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
import { t as e } from "../Icon/Icon-C-WocsyI.js";
|
|
2
|
-
import { t } from "../FieldCard/FieldCard-D8z0UA88.js";
|
|
3
|
-
import n, { forwardRef as r, useCallback as i, useEffect as a, useImperativeHandle as o, useLayoutEffect as s, useMemo as c, useRef as l, useState as u } from "react";
|
|
4
|
-
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
5
|
-
import { useVirtualizer as p } from "@tanstack/react-virtual";
|
|
6
|
-
//#region src/components/Kanban/constants.ts
|
|
7
|
-
var m = {
|
|
8
|
-
small: 180,
|
|
9
|
-
middle: 240,
|
|
10
|
-
large: 320
|
|
11
|
-
};
|
|
12
|
-
//#endregion
|
|
13
|
-
//#region src/components/Kanban/hooks/useColumnWidth.ts
|
|
14
|
-
function h(e) {
|
|
15
|
-
let { columnSize: t = "middle", columnWidth: n, coverLayout: r, hasSideCover: i = !1 } = e ?? {};
|
|
16
|
-
return c(() => typeof n == "number" && n > 0 ? n : (m[t] ?? m.middle) + (i || r?.position === "left" || r?.position === "right" ? 80 : 0) + 20, [
|
|
17
|
-
t,
|
|
18
|
-
n,
|
|
19
|
-
r?.position,
|
|
20
|
-
i
|
|
21
|
-
]);
|
|
22
|
-
}
|
|
23
|
-
//#endregion
|
|
24
|
-
//#region src/components/Kanban/hooks/useKanbanZoom.ts
|
|
25
|
-
function g(e, t) {
|
|
26
|
-
let { zoomed: n, onZoomChange: r } = t ?? {}, o = n !== void 0, [s, c] = u(!1), l = o ? !!n : s;
|
|
27
|
-
return a(() => {
|
|
28
|
-
if (!e.current) return;
|
|
29
|
-
let t = e.current, n = t.scrollWidth || 1, r = t.scrollHeight || 1, i = (t.scrollLeft + t.clientWidth / 2) / n, a = (t.scrollTop + t.clientHeight / 2) / r;
|
|
30
|
-
requestAnimationFrame(() => {
|
|
31
|
-
t.scrollLeft = i * t.scrollWidth - t.clientWidth / 2, t.scrollTop = a * t.scrollHeight - t.clientHeight / 2;
|
|
32
|
-
});
|
|
33
|
-
}, [l, e]), {
|
|
34
|
-
isZoomedOut: l,
|
|
35
|
-
toggleZoom: i(() => {
|
|
36
|
-
let e = !l;
|
|
37
|
-
o || c(e), r?.(e);
|
|
38
|
-
}, [
|
|
39
|
-
o,
|
|
40
|
-
l,
|
|
41
|
-
r
|
|
42
|
-
]),
|
|
43
|
-
setZoom: i((e) => {
|
|
44
|
-
o || c(e), r?.(e);
|
|
45
|
-
}, [o, r])
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
//#endregion
|
|
49
|
-
//#region src/components/Kanban/addButtonPlacement.ts
|
|
50
|
-
var _ = 34, v = 40;
|
|
51
|
-
function y({ contentHeight: e, viewportHeight: t, hasPaging: n, hasFooter: r }) {
|
|
52
|
-
let i = n ? v : 0, a = e + (n ? i : 10), o = r && t > 0 && a + _ > t;
|
|
53
|
-
return {
|
|
54
|
-
sticky: o,
|
|
55
|
-
buttonTop: a,
|
|
56
|
-
listHeight: o || !r ? e + i : a + _
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
//#endregion
|
|
60
|
-
//#region src/components/Kanban/Kanban.module.scss
|
|
61
|
-
var b = {
|
|
62
|
-
"bsy-mobile-kanban": "_bsy-mobile-kanban_ry73g_2",
|
|
63
|
-
"bsy-mobile-kanban__board": "_bsy-mobile-kanban__board_ry73g_13",
|
|
64
|
-
"bsy-mobile-kanban__board--zoomed": "_bsy-mobile-kanban__board--zoomed_ry73g_28",
|
|
65
|
-
"bsy-mobile-kanban__list": "_bsy-mobile-kanban__list_ry73g_35",
|
|
66
|
-
"bsy-mobile-kanban__column": "_bsy-mobile-kanban__column_ry73g_42",
|
|
67
|
-
"bsy-mobile-kanban__column-header": "_bsy-mobile-kanban__column-header_ry73g_51",
|
|
68
|
-
"bsy-mobile-kanban__column-title": "_bsy-mobile-kanban__column-title_ry73g_60",
|
|
69
|
-
"bsy-mobile-kanban__column-badge": "_bsy-mobile-kanban__column-badge_ry73g_70",
|
|
70
|
-
"bsy-mobile-kanban__column-body": "_bsy-mobile-kanban__column-body_ry73g_76",
|
|
71
|
-
"bsy-mobile-kanban__virtual-container": "_bsy-mobile-kanban__virtual-container_ry73g_94",
|
|
72
|
-
"bsy-mobile-kanban__card-wrapper": "_bsy-mobile-kanban__card-wrapper_ry73g_99",
|
|
73
|
-
"bsy-mobile-kanban__column-footer": "_bsy-mobile-kanban__column-footer_ry73g_109",
|
|
74
|
-
"bsy-mobile-kanban__add-anchor": "_bsy-mobile-kanban__add-anchor_ry73g_114",
|
|
75
|
-
"bsy-mobile-kanban__paging": "_bsy-mobile-kanban__paging_ry73g_119",
|
|
76
|
-
"bsy-mobile-kanban__paging--no-more": "_bsy-mobile-kanban__paging--no-more_ry73g_126",
|
|
77
|
-
"bsy-mobile-kanban__add-btn": "_bsy-mobile-kanban__add-btn_ry73g_129",
|
|
78
|
-
"bsy-mobile-kanban__empty": "_bsy-mobile-kanban__empty_ry73g_148"
|
|
79
|
-
};
|
|
80
|
-
//#endregion
|
|
81
|
-
//#region src/components/Kanban/KanbanColumn.tsx
|
|
82
|
-
function x({ column: n, columnWidth: r, coverLayout: o, fieldLayout: c, renderColumnTitle: m, renderColumnHeader: h, renderColumnFooter: g, onAdd: _, onClick: v, onReachBottom: x }) {
|
|
83
|
-
let S = l(null), [C, w] = u(0), T = n.id, E = n.items || [], D = n.total, O = l(E);
|
|
84
|
-
O.current = E;
|
|
85
|
-
let k = n.paging, A = k?.loading === !0, j = k?.noMore === !0, M = l(!1);
|
|
86
|
-
a(() => {
|
|
87
|
-
A || (M.current = !1);
|
|
88
|
-
}, [A]);
|
|
89
|
-
let [N, P] = u(!1);
|
|
90
|
-
a(() => {
|
|
91
|
-
E.length === 0 && P(!1);
|
|
92
|
-
}, [E.length]);
|
|
93
|
-
let F = i((e) => {
|
|
94
|
-
let t = e.currentTarget, n = t.scrollHeight - t.scrollTop - t.clientHeight, r = t.scrollHeight > t.clientHeight + 10, i = n <= 50;
|
|
95
|
-
r && i && P(!0), i && !A && !j && !M.current && x && (M.current = !0, x(T));
|
|
96
|
-
}, [
|
|
97
|
-
T,
|
|
98
|
-
j,
|
|
99
|
-
A,
|
|
100
|
-
x
|
|
101
|
-
]), I = p({
|
|
102
|
-
count: E.length,
|
|
103
|
-
getScrollElement: () => S.current,
|
|
104
|
-
estimateSize: () => 160,
|
|
105
|
-
overscan: 6,
|
|
106
|
-
gap: 10,
|
|
107
|
-
getItemKey: (e) => O.current[e]?.id ?? String(e)
|
|
108
|
-
}), L = I.getVirtualItems();
|
|
109
|
-
s(() => {
|
|
110
|
-
let e = S.current;
|
|
111
|
-
if (!e) return;
|
|
112
|
-
let t = () => w(e.clientHeight);
|
|
113
|
-
if (t(), typeof ResizeObserver > "u") return;
|
|
114
|
-
let n = new ResizeObserver(t);
|
|
115
|
-
return n.observe(e), () => n.disconnect();
|
|
116
|
-
}, []);
|
|
117
|
-
let R = m ? m(n) : n.title, z = h ? h(n) : /* @__PURE__ */ f("div", {
|
|
118
|
-
className: b["bsy-mobile-kanban__column-header"],
|
|
119
|
-
children: [/* @__PURE__ */ d("div", {
|
|
120
|
-
className: b["bsy-mobile-kanban__column-title"],
|
|
121
|
-
children: R
|
|
122
|
-
}), typeof D == "number" && /* @__PURE__ */ d("span", {
|
|
123
|
-
className: b["bsy-mobile-kanban__column-badge"],
|
|
124
|
-
children: D
|
|
125
|
-
})]
|
|
126
|
-
}), B = g ? g(n) : n.addable ? /* @__PURE__ */ d("div", {
|
|
127
|
-
className: b["bsy-mobile-kanban__column-footer"],
|
|
128
|
-
children: /* @__PURE__ */ d("button", {
|
|
129
|
-
type: "button",
|
|
130
|
-
className: b["bsy-mobile-kanban__add-btn"],
|
|
131
|
-
onClick: () => _?.(T),
|
|
132
|
-
"aria-label": "快速添加卡片",
|
|
133
|
-
"data-testid": `kanban-add-${T}`,
|
|
134
|
-
children: /* @__PURE__ */ d(e, {
|
|
135
|
-
name: "add",
|
|
136
|
-
size: 16,
|
|
137
|
-
color: "#000"
|
|
138
|
-
})
|
|
139
|
-
})
|
|
140
|
-
}) : null, V = E.length > 0 ? I.getTotalSize() : 0, H = A || j && N && E.length > 0, U = y({
|
|
141
|
-
contentHeight: V,
|
|
142
|
-
viewportHeight: C,
|
|
143
|
-
hasPaging: H,
|
|
144
|
-
hasFooter: !!B
|
|
145
|
-
}), W = H ? /* @__PURE__ */ d("div", {
|
|
146
|
-
className: A ? b["bsy-mobile-kanban__paging"] : `${b["bsy-mobile-kanban__paging"]} ${b["bsy-mobile-kanban__paging--no-more"]}`,
|
|
147
|
-
style: {
|
|
148
|
-
position: "absolute",
|
|
149
|
-
top: V,
|
|
150
|
-
left: 0,
|
|
151
|
-
right: 0
|
|
152
|
-
},
|
|
153
|
-
children: A ? "正在加载更多..." : "- 没有更多数据了 -"
|
|
154
|
-
}) : null;
|
|
155
|
-
return /* @__PURE__ */ f("div", {
|
|
156
|
-
className: b["bsy-mobile-kanban__column"],
|
|
157
|
-
style: {
|
|
158
|
-
width: `${r}px`,
|
|
159
|
-
minWidth: `${r}px`
|
|
160
|
-
},
|
|
161
|
-
"data-testid": `kanban-column-${T}`,
|
|
162
|
-
children: [
|
|
163
|
-
z,
|
|
164
|
-
/* @__PURE__ */ d("div", {
|
|
165
|
-
ref: S,
|
|
166
|
-
className: b["bsy-mobile-kanban__column-body"],
|
|
167
|
-
onScroll: F,
|
|
168
|
-
"data-testid": `kanban-column-body-${T}`,
|
|
169
|
-
children: E.length > 0 || B && !U.sticky ? /* @__PURE__ */ f("div", {
|
|
170
|
-
className: b["bsy-mobile-kanban__virtual-container"],
|
|
171
|
-
style: { height: `${U.listHeight}px` },
|
|
172
|
-
children: [
|
|
173
|
-
L.map((e) => {
|
|
174
|
-
let n = E[e.index];
|
|
175
|
-
return n ? /* @__PURE__ */ d("div", {
|
|
176
|
-
ref: I.measureElement,
|
|
177
|
-
"data-index": e.index,
|
|
178
|
-
className: b["bsy-mobile-kanban__card-wrapper"],
|
|
179
|
-
style: {
|
|
180
|
-
position: "absolute",
|
|
181
|
-
top: 0,
|
|
182
|
-
left: 0,
|
|
183
|
-
width: "100%",
|
|
184
|
-
transform: `translateY(${e.start}px)`
|
|
185
|
-
},
|
|
186
|
-
"data-testid": `kanban-card-${n.id}`,
|
|
187
|
-
onClick: () => v?.(n, T),
|
|
188
|
-
children: /* @__PURE__ */ f(t, {
|
|
189
|
-
title: n.title,
|
|
190
|
-
cover: n.cover,
|
|
191
|
-
coverPlaceholder: o?.position === "left",
|
|
192
|
-
coverLayout: o,
|
|
193
|
-
layout: c,
|
|
194
|
-
children: [n.fields?.map((e, n) => /* @__PURE__ */ d(t.Meta, {
|
|
195
|
-
label: e.label,
|
|
196
|
-
icon: e.icon,
|
|
197
|
-
value: e.value
|
|
198
|
-
}, e.key ?? n)), n.footer ? /* @__PURE__ */ d(t.Footer, { children: n.footer }) : null]
|
|
199
|
-
})
|
|
200
|
-
}, e.key) : null;
|
|
201
|
-
}),
|
|
202
|
-
W,
|
|
203
|
-
B && !U.sticky ? /* @__PURE__ */ d("div", {
|
|
204
|
-
className: b["bsy-mobile-kanban__add-anchor"],
|
|
205
|
-
style: { top: U.buttonTop },
|
|
206
|
-
children: B
|
|
207
|
-
}) : null
|
|
208
|
-
]
|
|
209
|
-
}) : null
|
|
210
|
-
}),
|
|
211
|
-
U.sticky ? B : null
|
|
212
|
-
]
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
var S = n.memo(x);
|
|
216
|
-
//#endregion
|
|
217
|
-
//#region src/components/Kanban/Kanban.tsx
|
|
218
|
-
function C({ columns: e, columnSize: t = "middle", columnWidth: n, coverLayout: r, hasSideCover: i = !1, fieldLayout: a = "vertical", zoomed: s, onZoomChange: c, renderColumnTitle: u, renderColumnHeader: f, renderColumnFooter: p, onAdd: m, onClick: _, onReachBottom: v, empty: y, className: x, style: C }, w) {
|
|
219
|
-
let T = l(null), E = h({
|
|
220
|
-
columnSize: t,
|
|
221
|
-
columnWidth: n,
|
|
222
|
-
coverLayout: r,
|
|
223
|
-
hasSideCover: i
|
|
224
|
-
}), { isZoomedOut: D, toggleZoom: O, setZoom: k } = g(T, {
|
|
225
|
-
zoomed: s,
|
|
226
|
-
onZoomChange: c
|
|
227
|
-
});
|
|
228
|
-
o(w, () => ({
|
|
229
|
-
isZoomedOut: D,
|
|
230
|
-
toggleZoom: O,
|
|
231
|
-
setZoom: k
|
|
232
|
-
}), [
|
|
233
|
-
D,
|
|
234
|
-
O,
|
|
235
|
-
k
|
|
236
|
-
]);
|
|
237
|
-
let A = !e || e.length === 0, j = [b["bsy-mobile-kanban__board"], D ? b["bsy-mobile-kanban__board--zoomed"] : ""].filter(Boolean).join(" ");
|
|
238
|
-
return /* @__PURE__ */ d("div", {
|
|
239
|
-
className: [b["bsy-mobile-kanban"], x].filter(Boolean).join(" "),
|
|
240
|
-
style: C,
|
|
241
|
-
"data-testid": "kanban-root",
|
|
242
|
-
children: /* @__PURE__ */ d("div", {
|
|
243
|
-
ref: T,
|
|
244
|
-
className: j,
|
|
245
|
-
"data-testid": "kanban-board",
|
|
246
|
-
children: A && y ? /* @__PURE__ */ d("div", {
|
|
247
|
-
className: b["bsy-mobile-kanban__empty"],
|
|
248
|
-
children: y
|
|
249
|
-
}) : /* @__PURE__ */ d("div", {
|
|
250
|
-
className: b["bsy-mobile-kanban__list"],
|
|
251
|
-
"data-testid": "kanban-list",
|
|
252
|
-
children: e?.map((e) => /* @__PURE__ */ d(S, {
|
|
253
|
-
column: e,
|
|
254
|
-
columnWidth: E,
|
|
255
|
-
coverLayout: r,
|
|
256
|
-
fieldLayout: a,
|
|
257
|
-
renderColumnTitle: u,
|
|
258
|
-
renderColumnHeader: f,
|
|
259
|
-
renderColumnFooter: p,
|
|
260
|
-
onAdd: m,
|
|
261
|
-
onClick: _,
|
|
262
|
-
onReachBottom: v
|
|
263
|
-
}, e.id))
|
|
264
|
-
})
|
|
265
|
-
})
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
var w = r(C);
|
|
269
|
-
//#endregion
|
|
270
|
-
//#region src/components/Kanban/utils/columnPage.ts
|
|
271
|
-
function T(e, t, n) {
|
|
272
|
-
if (t.length === 0) return [...e];
|
|
273
|
-
let r = n ?? ((e) => e?.id), i = new Set(e.map(r).filter(Boolean)), a = [];
|
|
274
|
-
for (let e of t) {
|
|
275
|
-
let t = r(e);
|
|
276
|
-
t && i.has(t) || (t && i.add(t), a.push(e));
|
|
277
|
-
}
|
|
278
|
-
return e.concat(a);
|
|
279
|
-
}
|
|
280
|
-
//#endregion
|
|
281
|
-
export { h as a, g as i, w as n, S as r, T as t };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
2
|
-
export interface UseKanbanZoomOptions {
|
|
3
|
-
/** 受控的缩放状态 */
|
|
4
|
-
zoomed?: boolean;
|
|
5
|
-
/** 缩放状态变更回调 */
|
|
6
|
-
onZoomChange?: (zoomed: boolean) => void;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* 管理移动端看板视图的 0.6x 鸟瞰缩放状态,并在缩放前后通过 requestAnimationFrame
|
|
10
|
-
* 精确维持当前视口中心点的相对滚动比例,杜绝画面位置跳变。
|
|
11
|
-
*/
|
|
12
|
-
export declare function useKanbanZoom(containerRef: RefObject<HTMLDivElement | null>, options?: UseKanbanZoomOptions): {
|
|
13
|
-
isZoomedOut: boolean;
|
|
14
|
-
toggleZoom: () => void;
|
|
15
|
-
setZoom: (zoomed: boolean) => void;
|
|
16
|
-
};
|