@hankchen/canvas-editor-vue 2.1.0 → 2.2.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/README.md +43 -2
- package/dist/{ExpressionPathPicker-DchGsK70.js → Tooltip-9lQOwB7r.js} +260 -195
- package/dist/_plugin-vue_export-helper-CBNdHDnS.js +98 -0
- package/dist/canvas/EditOverlayToolbar.d.ts +1 -1
- package/dist/{canvas-DuvO27sj.js → canvas-DIcS64ZV.js} +614 -554
- package/dist/canvas.js +1 -1
- package/dist/index.js +14 -14
- package/dist/{layer-panel-BouAYiDq.js → layer-panel-DPhB8OJp.js} +246 -240
- package/dist/layer-panel.js +1 -1
- package/dist/panel-theme.css +6 -276
- package/dist/{property-panel-CwdTufiP.js → property-panel-BzpaxWLB.js} +214 -213
- package/dist/property-panel.js +2 -2
- package/dist/{resourceTemplate-D-DKEo7Z.js → resourceTemplate-DLEZMwZl.js} +1 -1
- package/dist/shared/Tooltip.d.ts +24 -0
- package/dist/shared/index.d.ts +8 -1
- package/dist/shared/useCnTheme.d.ts +12 -0
- package/dist/shared/useDropdownMenu.d.ts +13 -1
- package/dist/{shared-CRDKDSpa.js → shared-5EY0LNSa.js} +76 -31
- package/dist/shared.js +9 -9
- package/dist/{status-bar-DBf5kIXY.js → status-bar-CJJSr9Ua.js} +9 -10
- package/dist/status-bar.js +1 -1
- package/dist/style.css +1 -1
- package/dist/theme.css +428 -0
- package/dist/{uploadFile-mXJVPEzm.js → uploadFile-DnW3L-8J.js} +33 -33
- package/dist/useTransientFeedback-CI3j6r7y.js +956 -0
- package/package.json +4 -3
- package/dist/DropdownMenu-CeUNKMDQ.js +0 -450
- package/dist/layerPath-uy2ywyld.js +0 -76
- package/dist/useTransientFeedback-BN_O7V2w.js +0 -498
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { t as e } from "./createLucideIcon-SCvtEGVf.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { Fragment as ne, computed as p, createBlock as re, createCommentVNode as m, createElementBlock as h, createElementVNode as g, createVNode as _, defineComponent as v, nextTick as ie, normalizeClass as y, normalizeStyle as ae, onScopeDispose as b, openBlock as x, ref as S, renderList as oe, shallowRef as C, toDisplayString as w, unref as T, vModelText as se, watch as ce, withCtx as E, withDirectives as le, withKeys as D, withModifiers as O } from "vue";
|
|
2
|
+
import { a as t, n, o as r, r as i } from "./_plugin-vue_export-helper-CBNdHDnS.js";
|
|
3
|
+
import { n as a, p as o, s, t as c } from "./Tooltip-9lQOwB7r.js";
|
|
4
|
+
import { f as l, l as u, n as ee, o as te, p as d, s as f, t as p } from "./useTransientFeedback-CI3j6r7y.js";
|
|
5
|
+
import { Fragment as ne, computed as m, createBlock as h, createCommentVNode as g, createElementBlock as _, createElementVNode as v, createVNode as y, defineComponent as b, nextTick as re, normalizeClass as x, normalizeStyle as ie, onScopeDispose as S, openBlock as C, ref as w, renderList as ae, shallowRef as T, toDisplayString as E, unref as D, vModelText as oe, watch as se, withCtx as O, withDirectives as ce, withKeys as le, withModifiers as k } from "vue";
|
|
7
6
|
var ue = e({
|
|
8
7
|
name: "eye-off",
|
|
9
8
|
size: 24,
|
|
@@ -122,7 +121,7 @@ var ue = e({
|
|
|
122
121
|
});
|
|
123
122
|
//#endregion
|
|
124
123
|
//#region ../canvas-editor/src/editing/layerPanel.ts
|
|
125
|
-
function
|
|
124
|
+
function A(e) {
|
|
126
125
|
switch (e.type) {
|
|
127
126
|
case "TableLayer": return e.template === null ? [{
|
|
128
127
|
key: "rows",
|
|
@@ -148,7 +147,7 @@ function k(e) {
|
|
|
148
147
|
}];
|
|
149
148
|
}
|
|
150
149
|
}
|
|
151
|
-
function
|
|
150
|
+
function j(e) {
|
|
152
151
|
switch (e.type) {
|
|
153
152
|
case "TextLayer":
|
|
154
153
|
case "ImageLayer":
|
|
@@ -156,22 +155,22 @@ function A(e) {
|
|
|
156
155
|
default: return null;
|
|
157
156
|
}
|
|
158
157
|
}
|
|
159
|
-
var
|
|
160
|
-
function
|
|
161
|
-
let t =
|
|
158
|
+
var M = "{{…}}";
|
|
159
|
+
function N(e) {
|
|
160
|
+
let t = j(e);
|
|
162
161
|
if (t === null) return "";
|
|
163
162
|
let n = o(t).parts.flatMap((e) => e.kind === "fragment" && e.expr !== "" ? [e.expr] : []);
|
|
164
|
-
return n.length === 0 ?
|
|
163
|
+
return n.length === 0 ? M : n.map((e) => `{{${e}}}`).join(" ");
|
|
165
164
|
}
|
|
166
|
-
function
|
|
165
|
+
function P(e, t, n, r) {
|
|
167
166
|
let a = [];
|
|
168
|
-
for (let { key: n, layers:
|
|
167
|
+
for (let { key: n, layers: i } of A(e)) for (let e = 0; e < i.length; e += 1) {
|
|
169
168
|
let o = n === "rows" ? "row" : n === "cells" ? "cell" : n === "template" ? "templateRow" : "content", s = n === "content" ? [...t, "content"] : n === "template" ? [...t, "template"] : [
|
|
170
169
|
...t,
|
|
171
170
|
n,
|
|
172
171
|
e
|
|
173
172
|
];
|
|
174
|
-
a.push(
|
|
173
|
+
a.push(P(i[e], s, o, r));
|
|
175
174
|
}
|
|
176
175
|
return {
|
|
177
176
|
type: e.type,
|
|
@@ -179,18 +178,18 @@ function N(e, t, n, i) {
|
|
|
179
178
|
role: n,
|
|
180
179
|
name: e.name,
|
|
181
180
|
visible: e.visible,
|
|
182
|
-
locked:
|
|
183
|
-
expressionPrefix:
|
|
181
|
+
locked: i(t, r),
|
|
182
|
+
expressionPrefix: N(e),
|
|
184
183
|
...e.type === "TableLayer" ? { templated: e.template !== null } : null,
|
|
185
184
|
children: a
|
|
186
185
|
};
|
|
187
186
|
}
|
|
188
|
-
function
|
|
187
|
+
function F(e, t = []) {
|
|
189
188
|
let n = [];
|
|
190
|
-
for (let r = e.layers.length - 1; r >= 0; --r) n.push(
|
|
189
|
+
for (let r = e.layers.length - 1; r >= 0; --r) n.push(P(e.layers[r], ["layers", r], "root", t));
|
|
191
190
|
return n;
|
|
192
191
|
}
|
|
193
|
-
var
|
|
192
|
+
var I = [
|
|
194
193
|
{
|
|
195
194
|
id: "heading",
|
|
196
195
|
fontSize: 40
|
|
@@ -203,7 +202,7 @@ var F = [
|
|
|
203
202
|
id: "body",
|
|
204
203
|
fontSize: 16
|
|
205
204
|
}
|
|
206
|
-
],
|
|
205
|
+
], L = [
|
|
207
206
|
{
|
|
208
207
|
id: "free",
|
|
209
208
|
ratio: null
|
|
@@ -243,7 +242,7 @@ var F = [
|
|
|
243
242
|
h: 16
|
|
244
243
|
}
|
|
245
244
|
}
|
|
246
|
-
],
|
|
245
|
+
], R = [
|
|
247
246
|
{
|
|
248
247
|
kind: "layer",
|
|
249
248
|
type: "TextLayer",
|
|
@@ -273,66 +272,66 @@ var F = [
|
|
|
273
272
|
label: "模板表",
|
|
274
273
|
title: "新增模板表(行模板 + 数据行展开)"
|
|
275
274
|
}
|
|
276
|
-
],
|
|
275
|
+
], z = {
|
|
277
276
|
heading: "标题",
|
|
278
277
|
subheading: "副标题",
|
|
279
278
|
body: "正文"
|
|
280
|
-
},
|
|
279
|
+
}, B = I.map(({ id: e, fontSize: t }) => ({
|
|
281
280
|
kind: "text-preset",
|
|
282
281
|
preset: e,
|
|
283
|
-
label:
|
|
282
|
+
label: z[e],
|
|
284
283
|
shortcut: `${t}号`,
|
|
285
|
-
title: `画拉建${
|
|
284
|
+
title: `画拉建${z[e]}文本层(字号 ${t},点击后在画布拖拽定落位与尺寸,Esc 取消)`
|
|
286
285
|
}));
|
|
287
|
-
function
|
|
286
|
+
function V(e) {
|
|
288
287
|
return e === null ? "任意宽高" : e.w === e.h ? "正方形" : e.w > e.h ? "横向" : "纵向";
|
|
289
288
|
}
|
|
290
|
-
var
|
|
289
|
+
var H = L.flatMap(({ id: e, ratio: t }) => e === "free" ? [] : [{
|
|
291
290
|
kind: "ratio-preset",
|
|
292
291
|
preset: e,
|
|
293
292
|
label: e,
|
|
294
|
-
shortcut:
|
|
295
|
-
title: `画拉建 ${e} 图片层(${
|
|
296
|
-
}]),
|
|
293
|
+
shortcut: V(t),
|
|
294
|
+
title: `画拉建 ${e} 图片层(${V(t)},画拉中按住 Shift 临时自由;点击后在画布拖拽定落位与尺寸,Esc 取消)`
|
|
295
|
+
}]), U = R.map((e) => e.kind === "layer" ? e.type === "TextLayer" ? {
|
|
297
296
|
...e,
|
|
298
|
-
children:
|
|
297
|
+
children: B
|
|
299
298
|
} : e.type === "ImageLayer" ? {
|
|
300
299
|
...e,
|
|
301
|
-
children:
|
|
302
|
-
} : e : e),
|
|
300
|
+
children: H
|
|
301
|
+
} : e : e), W = R;
|
|
303
302
|
function ge(e, t) {
|
|
304
303
|
return `画拉建${e}(${t}),${u}`;
|
|
305
304
|
}
|
|
306
305
|
//#endregion
|
|
307
306
|
//#region src/layer-panel/TemplateTableForm.vue?vue&type=script&setup=true&lang.ts
|
|
308
|
-
var
|
|
307
|
+
var G = { class: "mx-1 my-1" }, K = { class: "flex gap-1 p-1" }, q = ["disabled"], J = /* @__PURE__ */ b({
|
|
309
308
|
__name: "TemplateTableForm",
|
|
310
309
|
props: { editor: {} },
|
|
311
310
|
emits: ["confirm", "cancel"],
|
|
312
311
|
setup(e, { emit: t }) {
|
|
313
|
-
let n = e, r = t, i =
|
|
312
|
+
let n = e, r = t, i = w("");
|
|
314
313
|
function o() {
|
|
315
314
|
i.value !== "" && r("confirm", i.value);
|
|
316
315
|
}
|
|
317
|
-
let
|
|
318
|
-
return (e, t) => (
|
|
319
|
-
t[2] ||=
|
|
320
|
-
|
|
316
|
+
let c = f(n.editor), l = m(() => s(c.value));
|
|
317
|
+
return (e, t) => (C(), _("div", null, [
|
|
318
|
+
t[2] ||= v("p", { class: "px-2 pt-1 text-[11px] leading-4 text-cn-muted" }, "模板行按取行路径展开成表", -1),
|
|
319
|
+
v("div", G, [y(a, {
|
|
321
320
|
modelValue: i.value,
|
|
322
321
|
"onUpdate:modelValue": t[0] ||= (e) => i.value = e,
|
|
323
322
|
"data-template-rows-path": "",
|
|
324
323
|
mode: "rowsPath",
|
|
325
|
-
source:
|
|
324
|
+
source: l.value,
|
|
326
325
|
"aria-label": "取行路径",
|
|
327
326
|
placeholder: "未选择行路径"
|
|
328
327
|
}, null, 8, ["modelValue", "source"])]),
|
|
329
|
-
|
|
328
|
+
v("div", K, [v("button", {
|
|
330
329
|
type: "button",
|
|
331
330
|
"data-template-confirm": "",
|
|
332
331
|
disabled: i.value === "",
|
|
333
332
|
class: "flex-1 rounded bg-cn-accent/20 px-2 py-1 text-[12px] text-cn-accent hover:bg-cn-accent/30 disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-cn-accent/20",
|
|
334
333
|
onClick: o
|
|
335
|
-
}, " 创建 ", 8,
|
|
334
|
+
}, " 创建 ", 8, q), v("button", {
|
|
336
335
|
type: "button",
|
|
337
336
|
"data-template-cancel": "",
|
|
338
337
|
class: "flex-1 rounded px-2 py-1 text-[12px] text-cn-muted hover:text-cn-fg",
|
|
@@ -343,30 +342,30 @@ var W = { class: "mx-1 my-1" }, G = { class: "flex gap-1 p-1" }, K = ["disabled"
|
|
|
343
342
|
});
|
|
344
343
|
//#endregion
|
|
345
344
|
//#region src/layer-panel/useLayerPanel.ts
|
|
346
|
-
function
|
|
347
|
-
let t =
|
|
345
|
+
function _e(e) {
|
|
346
|
+
let t = T(e.store.doc), n = T(e.store.ui.selection), r = T(e.store.ui.hovered), i = T(e.store.ui.renaming), a = T(e.store.ui.lockedPaths), o = e.subscribe((o) => {
|
|
348
347
|
o.scope === "doc" ? (t.value = e.store.doc, n.value = e.store.ui.selection, r.value = e.store.ui.hovered, i.value = e.store.ui.renaming, a.value = e.store.ui.lockedPaths) : o.branch === "selection" ? n.value = e.store.ui.selection : o.branch === "hovered" ? r.value = e.store.ui.hovered : o.branch === "renaming" ? i.value = e.store.ui.renaming : o.branch === "lockedPaths" && (a.value = e.store.ui.lockedPaths);
|
|
349
348
|
});
|
|
350
|
-
return
|
|
351
|
-
outline:
|
|
352
|
-
selection:
|
|
353
|
-
hovered:
|
|
354
|
-
renaming:
|
|
349
|
+
return S(o, !0), {
|
|
350
|
+
outline: m(() => t.value ? F(t.value, a.value) : []),
|
|
351
|
+
selection: m(() => n.value),
|
|
352
|
+
hovered: m(() => r.value),
|
|
353
|
+
renaming: m(() => i.value)
|
|
355
354
|
};
|
|
356
355
|
}
|
|
357
|
-
function
|
|
356
|
+
function ve(e, t) {
|
|
358
357
|
return t > 0 && e < t / 2;
|
|
359
358
|
}
|
|
360
359
|
//#endregion
|
|
361
360
|
//#region src/layer-panel/LayerPanel.vue?vue&type=script&setup=true&lang.ts
|
|
362
|
-
var
|
|
361
|
+
var ye = { class: "cn-props flex w-[232px] shrink-0 flex-col overflow-y-auto rounded-xl border border-cn-line bg-cn-bg text-cn-fg shadow-(--cn-shadow-md)" }, be = { class: "sticky top-0 z-10 flex items-center justify-between border-b border-cn-line bg-cn-bg-elevated/95 px-3.5 py-2.5" }, xe = { class: "flex items-center gap-1" }, Se = [
|
|
363
362
|
"aria-expanded",
|
|
364
363
|
"onClick",
|
|
365
364
|
"onKeydown"
|
|
366
|
-
],
|
|
365
|
+
], Ce = {
|
|
367
366
|
key: 0,
|
|
368
367
|
class: "mx-3.5 my-4 rounded-lg border border-dashed border-cn-line px-3 py-6 text-center text-[11px] leading-5 text-cn-muted"
|
|
369
|
-
},
|
|
368
|
+
}, we = [
|
|
370
369
|
"data-key",
|
|
371
370
|
"draggable",
|
|
372
371
|
"onClick",
|
|
@@ -374,42 +373,34 @@ var _e = { class: "cn-props flex w-[232px] shrink-0 flex-col overflow-y-auto rou
|
|
|
374
373
|
"onDragstart",
|
|
375
374
|
"onDragover",
|
|
376
375
|
"onDrop"
|
|
377
|
-
],
|
|
378
|
-
"title",
|
|
379
|
-
"aria-pressed",
|
|
380
|
-
"onClick"
|
|
381
|
-
], De = [
|
|
382
|
-
"title",
|
|
383
|
-
"aria-pressed",
|
|
384
|
-
"onClick"
|
|
385
|
-
], Oe = ["onClick"], ke = [
|
|
376
|
+
], Te = ["onDragstart"], Ee = ["title"], De = ["onDblclick"], Oe = ["aria-pressed", "onClick"], ke = ["aria-pressed", "onClick"], Ae = ["onClick"], je = [
|
|
386
377
|
"disabled",
|
|
387
378
|
"title",
|
|
388
379
|
"onClick"
|
|
389
|
-
],
|
|
380
|
+
], Me = ["onClick"], Ne = ["onClick"], Pe = [
|
|
390
381
|
"disabled",
|
|
391
382
|
"title",
|
|
392
383
|
"onClick"
|
|
393
|
-
],
|
|
384
|
+
], Y = /* @__PURE__ */ b({
|
|
394
385
|
__name: "LayerPanel",
|
|
395
386
|
props: { editor: {} },
|
|
396
387
|
setup(e) {
|
|
397
|
-
let
|
|
388
|
+
let i = e, a = `解锁图层(${d("toggleLayerLock", l())})`, o = `图层已锁定(${d("toggleLayerLock", l())} 解锁后可删除)`, s = _e(i.editor), b = f(i.editor), S = w(!1), T = m(() => S.value ? [] : U.map((e) => {
|
|
398
389
|
if (e.kind === "template-table") {
|
|
399
|
-
let t =
|
|
390
|
+
let t = b.value === null;
|
|
400
391
|
return {
|
|
401
392
|
label: e.label,
|
|
402
|
-
title: t ?
|
|
393
|
+
title: t ? te : e.title,
|
|
403
394
|
disabled: t,
|
|
404
395
|
dataAttrs: { "data-add-layer": "template-table" },
|
|
405
396
|
keepsOpen: !0,
|
|
406
397
|
run: () => {
|
|
407
|
-
|
|
398
|
+
S.value = !0;
|
|
408
399
|
}
|
|
409
400
|
};
|
|
410
401
|
}
|
|
411
402
|
let t = { "data-add-layer": e.type }, n = () => {
|
|
412
|
-
|
|
403
|
+
i.editor.armLayerCreate(e.type), p().show(u);
|
|
413
404
|
};
|
|
414
405
|
return e.children === void 0 ? {
|
|
415
406
|
label: e.label,
|
|
@@ -431,21 +422,21 @@ var _e = { class: "cn-props flex w-[232px] shrink-0 flex-col overflow-y-auto rou
|
|
|
431
422
|
...t.kind === "text-preset" ? { "data-text-preset": t.preset } : { "data-ratio-preset": t.preset }
|
|
432
423
|
},
|
|
433
424
|
run: () => {
|
|
434
|
-
|
|
425
|
+
i.editor.armLayerCreate(e.type, t.preset), p().show(ge(e.label, t.label));
|
|
435
426
|
}
|
|
436
427
|
}))
|
|
437
428
|
};
|
|
438
429
|
}));
|
|
439
|
-
function
|
|
440
|
-
|
|
430
|
+
function A(e, t) {
|
|
431
|
+
i.editor.armTemplateTableCreate(e), p().show(u), t();
|
|
441
432
|
}
|
|
442
|
-
function
|
|
443
|
-
|
|
433
|
+
function j(e) {
|
|
434
|
+
S.value = !1, e();
|
|
444
435
|
}
|
|
445
|
-
function
|
|
446
|
-
|
|
436
|
+
function M() {
|
|
437
|
+
S.value = !1;
|
|
447
438
|
}
|
|
448
|
-
function
|
|
439
|
+
function N(e, t) {
|
|
449
440
|
switch (e.role) {
|
|
450
441
|
case "root": return e.name === "" ? `${e.type} ${t}` : e.name;
|
|
451
442
|
case "row": return `行 ${Number(e.path[e.path.length - 1]) + 1}`;
|
|
@@ -454,62 +445,62 @@ var _e = { class: "cn-props flex w-[232px] shrink-0 flex-col overflow-y-auto rou
|
|
|
454
445
|
case "content": return e.type;
|
|
455
446
|
}
|
|
456
447
|
}
|
|
457
|
-
let
|
|
458
|
-
let e = [],
|
|
448
|
+
let P = m(() => {
|
|
449
|
+
let e = [], n = /* @__PURE__ */ new Map();
|
|
459
450
|
function r(i, a, o, s) {
|
|
460
451
|
let c = i.role === "row" ? i.path.slice(0, -2) : i.role === "templateRow" ? i.path.slice(0, -1) : s, l = 0;
|
|
461
|
-
i.role === "root" && (l = (
|
|
452
|
+
i.role === "root" && (l = (n.get(i.type) ?? 0) + 1, n.set(i.type, l)), e.push({
|
|
462
453
|
key: i.path.join("."),
|
|
463
454
|
node: i,
|
|
464
455
|
indentLevel: a,
|
|
465
|
-
label:
|
|
456
|
+
label: N(i, l),
|
|
466
457
|
indexInGroup: o,
|
|
467
458
|
tablePath: c,
|
|
468
|
-
inTemplate:
|
|
459
|
+
inTemplate: t(i.path),
|
|
469
460
|
draggable: i.role === "root" || i.role === "row" || i.role === "cell"
|
|
470
461
|
}), i.children.forEach((e, t) => r(e, a + 1, t, c));
|
|
471
462
|
}
|
|
472
463
|
return s.outline.value.forEach((e, t) => r(e, 0, t, null)), e;
|
|
473
|
-
}),
|
|
474
|
-
function F(e) {
|
|
475
|
-
r.editor.setSelection(e.node.path);
|
|
476
|
-
}
|
|
464
|
+
}), F = m(() => P.value.length > 0);
|
|
477
465
|
function I(e) {
|
|
478
|
-
|
|
466
|
+
i.editor.setSelection(e.node.path);
|
|
479
467
|
}
|
|
480
468
|
function L(e) {
|
|
481
|
-
|
|
469
|
+
i.editor.setHovered(e === null ? null : e.node.path);
|
|
482
470
|
}
|
|
483
471
|
function R(e) {
|
|
484
|
-
|
|
472
|
+
i.editor.addTableRow(e.node.path);
|
|
485
473
|
}
|
|
486
474
|
function z(e) {
|
|
487
|
-
|
|
475
|
+
i.editor.addTableCell(e.node.path);
|
|
488
476
|
}
|
|
489
477
|
function B(e) {
|
|
490
|
-
|
|
478
|
+
i.editor.addTemplateCell(e.node.path.slice(0, -1));
|
|
491
479
|
}
|
|
492
480
|
function V(e) {
|
|
493
|
-
|
|
481
|
+
i.editor.deleteLayer(e.node.path);
|
|
494
482
|
}
|
|
495
|
-
function
|
|
496
|
-
|
|
483
|
+
function H(e) {
|
|
484
|
+
i.editor.toggleLayerVisibility(e.node.path);
|
|
497
485
|
}
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
486
|
+
function W(e) {
|
|
487
|
+
i.editor.toggleLayerLock(e.node.path);
|
|
488
|
+
}
|
|
489
|
+
let G = w(null), K = w(null);
|
|
490
|
+
function q(e) {
|
|
491
|
+
let n = G.value;
|
|
492
|
+
if (!n) return !1;
|
|
493
|
+
if (n.kind === "root") return e.node.role === "root";
|
|
494
|
+
if (n.kind === "row") return e.node.role === "row";
|
|
504
495
|
if (e.node.role !== "cell") return !1;
|
|
505
|
-
let i = n
|
|
506
|
-
return i === e.inTemplate ? !i ||
|
|
496
|
+
let i = t(n.cellPath);
|
|
497
|
+
return i === e.inTemplate ? !i || r(n.cellPath.slice(0, -2), e.node.path.slice(0, -2)) : !1;
|
|
507
498
|
}
|
|
508
|
-
function
|
|
499
|
+
function Y(e) {
|
|
509
500
|
return e.node.role === "root";
|
|
510
501
|
}
|
|
511
|
-
function
|
|
512
|
-
e.draggable && (
|
|
502
|
+
function Fe(e, t) {
|
|
503
|
+
e.draggable && (G.value = e.node.role === "root" ? {
|
|
513
504
|
kind: "root",
|
|
514
505
|
from: e.indexInGroup
|
|
515
506
|
} : e.node.role === "row" ? {
|
|
@@ -523,74 +514,74 @@ var _e = { class: "cn-props flex w-[232px] shrink-0 flex-col overflow-y-auto rou
|
|
|
523
514
|
cellPath: e.node.path
|
|
524
515
|
}, t.dataTransfer?.setData("text/plain", e.key), t.dataTransfer && (t.dataTransfer.effectAllowed = "move"));
|
|
525
516
|
}
|
|
526
|
-
function
|
|
527
|
-
|
|
517
|
+
function Ie(e, t) {
|
|
518
|
+
Y(e) || Fe(e, t);
|
|
528
519
|
}
|
|
529
|
-
function
|
|
530
|
-
if (!
|
|
520
|
+
function Le(e) {
|
|
521
|
+
if (!Y(e)) return e.draggable || void 0;
|
|
531
522
|
}
|
|
532
|
-
function
|
|
533
|
-
if (!
|
|
534
|
-
let n = t.currentTarget.getBoundingClientRect(), r =
|
|
535
|
-
t.preventDefault(),
|
|
523
|
+
function Re(e, t) {
|
|
524
|
+
if (!q(e)) return;
|
|
525
|
+
let n = t.currentTarget.getBoundingClientRect(), r = ve(t.clientY - n.top, n.height);
|
|
526
|
+
t.preventDefault(), K.value = {
|
|
536
527
|
key: e.key,
|
|
537
528
|
edge: r ? "before" : "after"
|
|
538
529
|
};
|
|
539
530
|
}
|
|
540
|
-
function
|
|
541
|
-
if (!
|
|
542
|
-
let n =
|
|
543
|
-
if (!
|
|
531
|
+
function ze(e, t) {
|
|
532
|
+
if (!q(e)) return;
|
|
533
|
+
let n = K.value, r = G.value;
|
|
534
|
+
if (!r || !n || n.key !== e.key) return;
|
|
544
535
|
t.preventDefault();
|
|
545
536
|
let a = n.edge === "before" ? e.indexInGroup : e.indexInGroup + 1;
|
|
546
|
-
|
|
537
|
+
r.kind === "root" ? i.editor.moveRootLayer(r.from, a) : r.kind === "row" ? e.tablePath !== null && e.tablePath.join(".") === r.tablePath.join(".") ? i.editor.moveTableRow(r.tablePath, r.from, a) : i.editor.moveTableRowToTable(r.rowPath, e.tablePath, a) : i.editor.moveTableCellToRow(r.cellPath, e.node.path.slice(0, -2), a), G.value = null, K.value = null;
|
|
547
538
|
}
|
|
548
|
-
function
|
|
549
|
-
|
|
539
|
+
function Be() {
|
|
540
|
+
G.value = null, K.value = null;
|
|
550
541
|
}
|
|
551
|
-
function
|
|
552
|
-
return
|
|
553
|
-
}
|
|
554
|
-
function ze(e) {
|
|
555
|
-
return t(s.hovered.value, e.node.path);
|
|
542
|
+
function X(e) {
|
|
543
|
+
return r(s.selection.value, e.node.path);
|
|
556
544
|
}
|
|
557
|
-
let Q = S(""), $ = null, Be = null;
|
|
558
545
|
function Ve(e) {
|
|
559
|
-
|
|
560
|
-
}
|
|
561
|
-
function He(e) {
|
|
562
|
-
return t(s.renaming.value, e.node.path);
|
|
546
|
+
return r(s.hovered.value, e.node.path);
|
|
563
547
|
}
|
|
548
|
+
let Z = w(""), Q = null, He = null;
|
|
564
549
|
function Ue(e) {
|
|
565
|
-
|
|
550
|
+
He = e instanceof HTMLInputElement ? e : null;
|
|
566
551
|
}
|
|
567
|
-
function We() {
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
552
|
+
function We(e) {
|
|
553
|
+
return r(s.renaming.value, e.node.path);
|
|
554
|
+
}
|
|
555
|
+
function Ge(e) {
|
|
556
|
+
Y(e) && i.editor.beginRename(e.node.path);
|
|
557
|
+
}
|
|
558
|
+
function $() {
|
|
559
|
+
let e = Z.value.trim();
|
|
560
|
+
if (Q !== null && e === Q.trim()) {
|
|
561
|
+
i.editor.cancelRename();
|
|
571
562
|
return;
|
|
572
563
|
}
|
|
573
|
-
|
|
564
|
+
i.editor.commitRename(e);
|
|
574
565
|
}
|
|
575
|
-
function
|
|
576
|
-
|
|
566
|
+
function Ke() {
|
|
567
|
+
i.editor.cancelRename();
|
|
577
568
|
}
|
|
578
|
-
return
|
|
569
|
+
return se(s.renaming, async (e) => {
|
|
579
570
|
if (e === null) {
|
|
580
|
-
|
|
571
|
+
Q = null;
|
|
581
572
|
return;
|
|
582
573
|
}
|
|
583
|
-
let
|
|
584
|
-
|
|
585
|
-
let
|
|
586
|
-
|
|
587
|
-
}), (e, t) => (
|
|
588
|
-
|
|
574
|
+
let t = P.value.find((t) => r(t.node.path, e));
|
|
575
|
+
Z.value = t?.label ?? "", Q = Z.value, await re();
|
|
576
|
+
let n = He;
|
|
577
|
+
n && (n.focus({ preventScroll: !0 }), n.select());
|
|
578
|
+
}), (e, t) => (C(), _("aside", ye, [
|
|
579
|
+
v("header", be, [t[7] ||= v("span", { class: "text-[12px] font-medium tracking-wide text-cn-fg/90" }, "图层", -1), v("div", xe, [y(ee, {
|
|
589
580
|
label: "新增图层",
|
|
590
|
-
items:
|
|
591
|
-
onClosed:
|
|
581
|
+
items: T.value,
|
|
582
|
+
onClosed: M
|
|
592
583
|
}, {
|
|
593
|
-
trigger:
|
|
584
|
+
trigger: O(({ open: e, toggle: t, triggerRef: n, onKeydown: r }) => [v("button", {
|
|
594
585
|
ref: n,
|
|
595
586
|
type: "button",
|
|
596
587
|
"data-add-menu": "",
|
|
@@ -600,151 +591,166 @@ var _e = { class: "cn-props flex w-[232px] shrink-0 flex-col overflow-y-auto rou
|
|
|
600
591
|
class: "flex size-6 items-center justify-center rounded border border-cn-field-line bg-cn-field text-[13px] leading-none text-cn-fg/80 hover:border-cn-accent/40 hover:text-cn-accent",
|
|
601
592
|
onClick: t,
|
|
602
593
|
onKeydown: r
|
|
603
|
-
}, " + ", 40,
|
|
604
|
-
body:
|
|
594
|
+
}, " + ", 40, Se)]),
|
|
595
|
+
body: O(({ closeMenu: e }) => [S.value ? (C(), h(J, {
|
|
605
596
|
key: 0,
|
|
606
|
-
editor:
|
|
607
|
-
onConfirm: (t) =>
|
|
608
|
-
onCancel: (t) =>
|
|
597
|
+
editor: i.editor,
|
|
598
|
+
onConfirm: (t) => A(t, e),
|
|
599
|
+
onCancel: (t) => j(e)
|
|
609
600
|
}, null, 8, [
|
|
610
601
|
"editor",
|
|
611
602
|
"onConfirm",
|
|
612
603
|
"onCancel"
|
|
613
|
-
])) :
|
|
604
|
+
])) : g("", !0)]),
|
|
614
605
|
_: 1
|
|
615
606
|
}, 8, ["items"])])]),
|
|
616
|
-
|
|
617
|
-
|
|
607
|
+
F.value ? g("", !0) : (C(), _("p", Ce, " 画布还没有图层,用上方按钮新增 ")),
|
|
608
|
+
v("ul", {
|
|
618
609
|
class: "cn-layers__tree flex flex-col gap-0.5 px-1.5 py-1",
|
|
619
|
-
onDragend:
|
|
620
|
-
}, [(
|
|
610
|
+
onDragend: Be
|
|
611
|
+
}, [(C(!0), _(ne, null, ae(P.value, (e) => (C(), _("li", {
|
|
621
612
|
key: e.key,
|
|
622
613
|
"data-key": e.key,
|
|
623
|
-
draggable:
|
|
624
|
-
class:
|
|
625
|
-
"cn-layers__row--selected":
|
|
626
|
-
"cn-layers__row--hovered":
|
|
627
|
-
"cn-layers__row--hidden":
|
|
614
|
+
draggable: Le(e),
|
|
615
|
+
class: x(["cn-layers__row group flex cursor-default select-none items-center gap-1 py-1 pr-1 text-[12px]", {
|
|
616
|
+
"cn-layers__row--selected": X(e),
|
|
617
|
+
"cn-layers__row--hovered": Ve(e) && !X(e),
|
|
618
|
+
"cn-layers__row--hidden": Y(e) && !e.node.visible,
|
|
628
619
|
"cn-layers__row--template": e.inTemplate,
|
|
629
|
-
"cursor-grab": e.draggable && !
|
|
630
|
-
"cn-layers__row--drop-before":
|
|
631
|
-
"cn-layers__row--drop-after":
|
|
620
|
+
"cursor-grab": e.draggable && !Y(e),
|
|
621
|
+
"cn-layers__row--drop-before": K.value?.key === e.key && K.value?.edge === "before",
|
|
622
|
+
"cn-layers__row--drop-after": K.value?.key === e.key && K.value?.edge === "after"
|
|
632
623
|
}]),
|
|
633
|
-
style:
|
|
634
|
-
onClick: (t) =>
|
|
635
|
-
onMouseenter: (t) =>
|
|
636
|
-
onMouseleave: t[6] ||= (e) =>
|
|
637
|
-
onDragstart: (t) =>
|
|
638
|
-
onDragover: (t) =>
|
|
639
|
-
onDrop: (t) =>
|
|
624
|
+
style: ie({ paddingLeft: `${4 + e.indentLevel * 14}px` }),
|
|
625
|
+
onClick: (t) => I(e),
|
|
626
|
+
onMouseenter: (t) => L(e),
|
|
627
|
+
onMouseleave: t[6] ||= (e) => L(null),
|
|
628
|
+
onDragstart: (t) => Ie(e, t),
|
|
629
|
+
onDragover: (t) => Re(e, t),
|
|
630
|
+
onDrop: (t) => ze(e, t)
|
|
640
631
|
}, [
|
|
641
|
-
|
|
632
|
+
Y(e) ? (C(), _("span", {
|
|
642
633
|
key: 0,
|
|
643
634
|
"data-drag-handle": "",
|
|
644
635
|
draggable: "true",
|
|
645
636
|
title: "拖动排序",
|
|
646
637
|
class: "cn-layers__handle shrink-0",
|
|
647
|
-
onDragstart: (t) =>
|
|
648
|
-
}, [
|
|
649
|
-
icon:
|
|
638
|
+
onDragstart: (t) => Fe(e, t)
|
|
639
|
+
}, [y(n, {
|
|
640
|
+
icon: D(fe),
|
|
650
641
|
size: 12,
|
|
651
642
|
"stroke-width": 2.5
|
|
652
|
-
}, null, 8, ["icon"])], 40,
|
|
653
|
-
e.node.expressionPrefix === "" ?
|
|
643
|
+
}, null, 8, ["icon"])], 40, Te)) : g("", !0),
|
|
644
|
+
e.node.expressionPrefix === "" ? g("", !0) : (C(), _("span", {
|
|
654
645
|
key: 1,
|
|
655
646
|
class: "cn-layers__prefix",
|
|
656
647
|
title: e.node.expressionPrefix
|
|
657
|
-
},
|
|
658
|
-
|
|
648
|
+
}, E(e.node.expressionPrefix), 9, Ee)),
|
|
649
|
+
We(e) ? ce((C(), _("input", {
|
|
659
650
|
key: 2,
|
|
660
651
|
ref_for: !0,
|
|
661
|
-
ref:
|
|
662
|
-
"onUpdate:modelValue": t[0] ||= (e) =>
|
|
652
|
+
ref: Ue,
|
|
653
|
+
"onUpdate:modelValue": t[0] ||= (e) => Z.value = e,
|
|
663
654
|
"data-rename-input": "",
|
|
664
655
|
"aria-label": "图层重命名",
|
|
665
656
|
class: "cn-layers__rename-input min-w-0 flex-1",
|
|
666
|
-
onClick: t[1] ||=
|
|
667
|
-
onDblclick: t[2] ||=
|
|
668
|
-
onKeydown: [t[3] ||=
|
|
669
|
-
onBlur: t[5] ||= (e) =>
|
|
670
|
-
}, null, 544)), [[
|
|
657
|
+
onClick: t[1] ||= k(() => {}, ["stop"]),
|
|
658
|
+
onDblclick: t[2] ||= k(() => {}, ["stop"]),
|
|
659
|
+
onKeydown: [t[3] ||= le(k((e) => $(), ["prevent"]), ["enter"]), t[4] ||= le(k((e) => Ke(), ["prevent"]), ["esc"])],
|
|
660
|
+
onBlur: t[5] ||= (e) => $()
|
|
661
|
+
}, null, 544)), [[oe, Z.value]]) : (C(), _("span", {
|
|
671
662
|
key: 3,
|
|
672
663
|
class: "cn-layers__label min-w-0 flex-1 truncate font-mono text-[11px] leading-4",
|
|
673
|
-
onDblclick: (t) =>
|
|
674
|
-
},
|
|
675
|
-
|
|
664
|
+
onDblclick: (t) => Ge(e)
|
|
665
|
+
}, E(e.label), 41, De)),
|
|
666
|
+
Y(e) ? (C(), h(c, {
|
|
676
667
|
key: 4,
|
|
677
|
-
|
|
678
|
-
"
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
668
|
+
label: e.node.visible ? "隐藏图层(最终输出不含该层)" : "显示图层",
|
|
669
|
+
class: x(["shrink-0", e.node.visible ? "hidden! group-hover:flex!" : "flex!"])
|
|
670
|
+
}, {
|
|
671
|
+
default: O(() => [v("button", {
|
|
672
|
+
type: "button",
|
|
673
|
+
"data-visibility": "",
|
|
674
|
+
class: x(["cn-layers__eye size-5 shrink-0 items-center justify-center rounded text-cn-muted hover:bg-cn-accent/15 hover:text-cn-accent", e.node.visible ? "hidden group-hover:flex" : "flex"]),
|
|
675
|
+
"aria-pressed": !e.node.visible,
|
|
676
|
+
onClick: k((t) => H(e), ["stop"])
|
|
677
|
+
}, [y(n, {
|
|
678
|
+
icon: e.node.visible ? D(de) : D(ue),
|
|
679
|
+
size: 11,
|
|
680
|
+
"stroke-width": 2
|
|
681
|
+
}, null, 8, ["icon"])], 10, Oe)]),
|
|
682
|
+
_: 2
|
|
683
|
+
}, 1032, ["label", "class"])) : g("", !0),
|
|
684
|
+
Y(e) ? (C(), h(c, {
|
|
689
685
|
key: 5,
|
|
690
|
-
|
|
691
|
-
"
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
686
|
+
label: e.node.locked ? a : "锁定图层(画布不可点选/拖动/删除,渲染照常)",
|
|
687
|
+
class: x(["shrink-0", e.node.locked ? "flex!" : "hidden! group-hover:flex!"])
|
|
688
|
+
}, {
|
|
689
|
+
default: O(() => [v("button", {
|
|
690
|
+
type: "button",
|
|
691
|
+
"data-lock": "",
|
|
692
|
+
class: x(["cn-layers__lock size-5 shrink-0 items-center justify-center rounded text-cn-muted hover:bg-cn-accent/15 hover:text-cn-accent", e.node.locked ? "flex" : "hidden group-hover:flex"]),
|
|
693
|
+
"aria-pressed": e.node.locked,
|
|
694
|
+
onClick: k((t) => W(e), ["stop"])
|
|
695
|
+
}, [y(n, {
|
|
696
|
+
icon: e.node.locked ? D(me) : D(pe),
|
|
697
|
+
size: 11,
|
|
698
|
+
"stroke-width": 2
|
|
699
|
+
}, null, 8, ["icon"])], 10, ke)]),
|
|
700
|
+
_: 2
|
|
701
|
+
}, 1032, ["label", "class"])) : g("", !0),
|
|
702
|
+
Y(e) ? (C(), h(c, {
|
|
702
703
|
key: 6,
|
|
703
|
-
|
|
704
|
-
"
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
704
|
+
label: "重命名(双击名称或 F2)",
|
|
705
|
+
class: "hidden! group-hover:flex! shrink-0"
|
|
706
|
+
}, {
|
|
707
|
+
default: O(() => [v("button", {
|
|
708
|
+
type: "button",
|
|
709
|
+
"data-rename": "",
|
|
710
|
+
class: "cn-layers__delete hidden size-5 shrink-0 items-center justify-center rounded text-cn-muted hover:bg-cn-accent/15 hover:text-cn-accent group-hover:flex",
|
|
711
|
+
onClick: k((t) => Ge(e), ["stop"])
|
|
712
|
+
}, [y(n, {
|
|
713
|
+
icon: D(he),
|
|
714
|
+
size: 11,
|
|
715
|
+
"stroke-width": 2
|
|
716
|
+
}, null, 8, ["icon"])], 8, Ae)]),
|
|
717
|
+
_: 2
|
|
718
|
+
}, 1024)) : g("", !0),
|
|
719
|
+
e.node.role === "root" && e.node.type === "TableLayer" ? (C(), _("button", {
|
|
714
720
|
key: 7,
|
|
715
721
|
type: "button",
|
|
716
722
|
"data-add-row": "",
|
|
717
723
|
class: "cn-layers__delete hidden size-5 shrink-0 items-center justify-center rounded text-[10px] leading-none text-cn-muted hover:bg-cn-accent/15 hover:text-cn-accent group-hover:flex disabled:cursor-not-allowed disabled:text-cn-muted/50 disabled:hover:bg-transparent",
|
|
718
724
|
disabled: e.node.templated === !0,
|
|
719
725
|
title: e.node.templated === !0 ? "模板态不可加行——行由数据展开" : "加行(缺省行 + 缺省格与文本,行宽=表宽)",
|
|
720
|
-
onClick:
|
|
721
|
-
}, " +行 ", 8,
|
|
722
|
-
e.node.role === "row" ? (
|
|
726
|
+
onClick: k((t) => R(e), ["stop"])
|
|
727
|
+
}, " +行 ", 8, je)) : g("", !0),
|
|
728
|
+
e.node.role === "row" ? (C(), _("button", {
|
|
723
729
|
key: 8,
|
|
724
730
|
type: "button",
|
|
725
731
|
"data-add-cell": "",
|
|
726
732
|
class: "cn-layers__delete hidden size-5 shrink-0 items-center justify-center rounded text-[10px] leading-none text-cn-muted hover:bg-cn-accent/15 hover:text-cn-accent group-hover:flex",
|
|
727
733
|
title: "加格(缺省格 + 文本内容,行高取最高格)",
|
|
728
|
-
onClick:
|
|
729
|
-
}, " +格 ", 8,
|
|
730
|
-
e.node.role === "templateRow" ? (
|
|
734
|
+
onClick: k((t) => z(e), ["stop"])
|
|
735
|
+
}, " +格 ", 8, Me)) : g("", !0),
|
|
736
|
+
e.node.role === "templateRow" ? (C(), _("button", {
|
|
731
737
|
key: 9,
|
|
732
738
|
type: "button",
|
|
733
739
|
"data-add-template-cell": "",
|
|
734
740
|
class: "cn-layers__delete hidden size-5 shrink-0 items-center justify-center rounded text-[10px] leading-none text-cn-muted hover:bg-cn-accent/15 hover:text-cn-accent group-hover:flex",
|
|
735
741
|
title: "加格(缺省格 + 文本内容,零高度耦合——行高由数据展开定稿)",
|
|
736
|
-
onClick:
|
|
737
|
-
}, " +格 ", 8,
|
|
738
|
-
|
|
742
|
+
onClick: k((t) => B(e), ["stop"])
|
|
743
|
+
}, " +格 ", 8, Ne)) : g("", !0),
|
|
744
|
+
v("button", {
|
|
739
745
|
type: "button",
|
|
740
746
|
class: "cn-layers__delete hidden size-5 shrink-0 items-center justify-center rounded text-[10px] leading-none text-cn-muted hover:bg-cn-danger/15 hover:text-cn-danger group-hover:flex disabled:cursor-not-allowed disabled:text-cn-muted/50 disabled:hover:bg-transparent disabled:hover:text-cn-muted/50",
|
|
741
747
|
disabled: e.node.role === "templateRow" || e.node.locked,
|
|
742
748
|
title: e.node.role === "templateRow" ? "行模板由表持有——转换回普通表请用 V2 转换入口" : e.node.locked ? o : "删除(含子层)",
|
|
743
|
-
onClick:
|
|
744
|
-
}, " ✕ ", 8,
|
|
745
|
-
], 46,
|
|
749
|
+
onClick: k((t) => V(e), ["stop"])
|
|
750
|
+
}, " ✕ ", 8, Pe)
|
|
751
|
+
], 46, we))), 128))], 32)
|
|
746
752
|
]));
|
|
747
753
|
}
|
|
748
754
|
});
|
|
749
755
|
//#endregion
|
|
750
|
-
export {
|
|
756
|
+
export { W as a, B as c, J as i, U as l, ve as n, R as o, _e as r, H as s, Y as t };
|