@hankchen/canvas-editor-vue 0.6.0 → 0.7.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/{useDataSourceSchema-YV8g-lo0.js → DropdownMenu-CeUNKMDQ.js} +70 -78
- package/dist/ExpressionPathPicker-DchGsK70.js +739 -0
- package/dist/{canvas-CX1RdlFC.js → canvas-D3fFnBqG.js} +526 -527
- package/dist/canvas.js +1 -1
- package/dist/index.js +14 -15
- package/dist/layer-panel/TemplateTableForm.d.ts +1 -27
- package/dist/{layer-panel-Cd1e8xNB.js → layer-panel-BouAYiDq.js} +231 -257
- package/dist/layer-panel.js +1 -1
- package/dist/property-panel/PropertyField.d.ts +9 -2
- package/dist/property-panel/fieldSchema.d.ts +16 -10
- package/dist/property-panel/fields/RowsPathField.d.ts +17 -0
- package/dist/property-panel/fields/index.d.ts +1 -0
- package/dist/property-panel/usePropertyPanel.d.ts +11 -2
- package/dist/{property-panel-B32ZBQdf.js → property-panel-DJQJzioT.js} +403 -341
- package/dist/property-panel.js +2 -2
- package/dist/resourceTemplate-D-DKEo7Z.js +33 -0
- package/dist/shared/ExpressionPathPicker.d.ts +9 -2
- package/dist/shared/index.d.ts +13 -10
- package/dist/shared/pathPickerModel.d.ts +16 -3
- package/dist/shared/popupPosition.d.ts +2 -2
- package/dist/shared/rowsPathPickerSource.d.ts +15 -0
- package/dist/shared/useDataSourceSchema.d.ts +9 -1
- package/dist/shared/useExpressionDiagnostics.d.ts +11 -0
- package/dist/{shared-wuupBoZg.js → shared-CRDKDSpa.js} +22 -22
- package/dist/shared.js +9 -10
- package/dist/{status-bar-XMVbRLY9.js → status-bar-DBf5kIXY.js} +69 -67
- package/dist/status-bar.js +1 -1
- package/dist/style.css +1 -1
- package/dist/uploadFile-mXJVPEzm.js +653 -0
- package/dist/{useTransientFeedback-CTjmMmFF.js → useTransientFeedback-BN_O7V2w.js} +43 -28
- package/package.json +2 -2
- package/dist/popupPosition-Ck5Gsvjy.js +0 -526
- package/dist/resourceTemplate-cdcQtp9a.js +0 -246
- package/dist/shared/rowsPathCompletionSource.d.ts +0 -3
- package/dist/shared/usePathCompletion.d.ts +0 -18
- package/dist/uploadFile-D1RY-ji0.js +0 -516
- package/dist/usePathCompletion-Do17CQ6l.js +0 -220
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { t as e } from "./createLucideIcon-SCvtEGVf.js";
|
|
2
2
|
import { a as t, c as n, d as r, f as i, i as a, l as o, n as s, p as c, r as l, s as u, t as d, u as f } from "./dist-DGtNmLwo.js";
|
|
3
3
|
import { a as p, i as m, r as h } from "./layerPath-uy2ywyld.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { a as te,
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
var ve = e({
|
|
4
|
+
import { c as g, l as _, o as ee, s as v, t as y } from "./ExpressionPathPicker-DchGsK70.js";
|
|
5
|
+
import { n as b, r as x, t as S } from "./resourceTemplate-D-DKEo7Z.js";
|
|
6
|
+
import { a as C, f as te, h as ne, i as re, l as ie, m as ae, n as oe, o as se, p as ce, s as le, t as ue } from "./uploadFile-mXJVPEzm.js";
|
|
7
|
+
import { Fragment as w, computed as T, createBlock as E, createCommentVNode as D, createElementBlock as O, createElementVNode as k, createTextVNode as de, createVNode as A, defineComponent as j, inject as fe, markRaw as M, nextTick as pe, normalizeClass as N, onScopeDispose as me, openBlock as P, provide as he, ref as F, renderList as I, resolveDynamicComponent as ge, shallowRef as L, toDisplayString as R, unref as z, vModelText as _e, watch as B, watchEffect as ve, withCtx as ye, withDirectives as be, withModifiers as V } from "vue";
|
|
8
|
+
var xe = e({
|
|
10
9
|
name: "grid-2x2",
|
|
11
10
|
size: 24,
|
|
12
11
|
node: [
|
|
@@ -28,7 +27,7 @@ var ve = e({
|
|
|
28
27
|
}]
|
|
29
28
|
],
|
|
30
29
|
aliases: ["grid-2-x-2"]
|
|
31
|
-
}),
|
|
30
|
+
}), Se = e({
|
|
32
31
|
name: "square-split-vertical",
|
|
33
32
|
size: 24,
|
|
34
33
|
node: [
|
|
@@ -46,7 +45,7 @@ var ve = e({
|
|
|
46
45
|
}]
|
|
47
46
|
],
|
|
48
47
|
aliases: ["split-square-vertical"]
|
|
49
|
-
}),
|
|
48
|
+
}), Ce = e({
|
|
50
49
|
name: "square",
|
|
51
50
|
size: 24,
|
|
52
51
|
node: [["rect", {
|
|
@@ -60,7 +59,7 @@ var ve = e({
|
|
|
60
59
|
});
|
|
61
60
|
//#endregion
|
|
62
61
|
//#region ../canvas-editor/src/shared/resourceStatus.ts
|
|
63
|
-
function
|
|
62
|
+
function we(e, n) {
|
|
64
63
|
if (e.type !== "ImageLayer") return !1;
|
|
65
64
|
if (e.expression !== null || e.src === null || t(e) <= 0 || a(e) <= 0) return !0;
|
|
66
65
|
if (n !== void 0) {
|
|
@@ -71,7 +70,7 @@ function xe(e, n) {
|
|
|
71
70
|
}
|
|
72
71
|
//#endregion
|
|
73
72
|
//#region src/property-panel/fieldSchema.ts
|
|
74
|
-
var
|
|
73
|
+
var Te = "当前层内容未绘制,padding 不影响预览", H = {
|
|
75
74
|
title: "位置与尺寸",
|
|
76
75
|
fields: [
|
|
77
76
|
{
|
|
@@ -126,7 +125,7 @@ var Se = "当前层内容未绘制,padding 不影响预览", U = {
|
|
|
126
125
|
control: "anchor"
|
|
127
126
|
}
|
|
128
127
|
]
|
|
129
|
-
},
|
|
128
|
+
}, U = {
|
|
130
129
|
title: "对齐",
|
|
131
130
|
fields: [{
|
|
132
131
|
key: ["align", "horizontal"],
|
|
@@ -139,7 +138,7 @@ var Se = "当前层内容未绘制,padding 不影响预览", U = {
|
|
|
139
138
|
control: "align",
|
|
140
139
|
domain: l
|
|
141
140
|
}]
|
|
142
|
-
},
|
|
141
|
+
}, W = {
|
|
143
142
|
title: "形状",
|
|
144
143
|
fields: [
|
|
145
144
|
{
|
|
@@ -161,7 +160,7 @@ var Se = "当前层内容未绘制,padding 不影响预览", U = {
|
|
|
161
160
|
label: "内边距",
|
|
162
161
|
control: "padding",
|
|
163
162
|
title: "内边距作用于内容盒,不改变图层尺寸",
|
|
164
|
-
hint: (e, t) =>
|
|
163
|
+
hint: (e, t) => we(e, t) ? Te : null
|
|
165
164
|
},
|
|
166
165
|
{
|
|
167
166
|
key: ["shape", "border"],
|
|
@@ -169,11 +168,11 @@ var Se = "当前层内容未绘制,padding 不影响预览", U = {
|
|
|
169
168
|
control: "border"
|
|
170
169
|
}
|
|
171
170
|
]
|
|
172
|
-
},
|
|
171
|
+
}, Ee = {
|
|
173
172
|
ImageLayer: [
|
|
173
|
+
H,
|
|
174
174
|
U,
|
|
175
175
|
W,
|
|
176
|
-
G,
|
|
177
176
|
{
|
|
178
177
|
title: "图片",
|
|
179
178
|
fields: [{
|
|
@@ -186,9 +185,9 @@ var Se = "当前层内容未绘制,padding 不影响预览", U = {
|
|
|
186
185
|
}
|
|
187
186
|
],
|
|
188
187
|
TextLayer: [
|
|
188
|
+
H,
|
|
189
189
|
U,
|
|
190
190
|
W,
|
|
191
|
-
G,
|
|
192
191
|
{
|
|
193
192
|
title: "文本",
|
|
194
193
|
fields: [
|
|
@@ -224,9 +223,9 @@ var Se = "当前层内容未绘制,padding 不影响预览", U = {
|
|
|
224
223
|
}
|
|
225
224
|
],
|
|
226
225
|
QrCodeLayer: [
|
|
226
|
+
H,
|
|
227
227
|
U,
|
|
228
228
|
W,
|
|
229
|
-
G,
|
|
230
229
|
{
|
|
231
230
|
title: "二维码",
|
|
232
231
|
fields: [{
|
|
@@ -239,31 +238,28 @@ var Se = "当前层内容未绘制,padding 不影响预览", U = {
|
|
|
239
238
|
}
|
|
240
239
|
],
|
|
241
240
|
TableLayer: [
|
|
241
|
+
H,
|
|
242
242
|
U,
|
|
243
243
|
W,
|
|
244
|
-
G,
|
|
245
244
|
{
|
|
246
245
|
title: "数据",
|
|
247
246
|
fields: [{
|
|
248
247
|
key: ["rowsPath"],
|
|
249
|
-
label: "
|
|
250
|
-
control: "
|
|
251
|
-
placeholder: "如 order.items",
|
|
252
|
-
nonEmpty: !0,
|
|
253
|
-
completion: "rowsPath",
|
|
248
|
+
label: "取行路径",
|
|
249
|
+
control: "rowsPath",
|
|
254
250
|
visibleWhen: (e) => e.type === "TableLayer" && e.template !== null
|
|
255
251
|
}]
|
|
256
252
|
}
|
|
257
253
|
],
|
|
258
254
|
TableRowLayer: [
|
|
255
|
+
H,
|
|
259
256
|
U,
|
|
260
|
-
W
|
|
261
|
-
G
|
|
257
|
+
W
|
|
262
258
|
],
|
|
263
259
|
TableCellLayer: [
|
|
260
|
+
H,
|
|
264
261
|
U,
|
|
265
|
-
W
|
|
266
|
-
G
|
|
262
|
+
W
|
|
267
263
|
],
|
|
268
264
|
TableRowTemplate: [{
|
|
269
265
|
title: "行模板(行宽由表宽同步)",
|
|
@@ -280,15 +276,15 @@ var Se = "当前层内容未绘制,padding 不影响预览", U = {
|
|
|
280
276
|
}]
|
|
281
277
|
}]
|
|
282
278
|
};
|
|
283
|
-
function
|
|
284
|
-
return
|
|
279
|
+
function De(e) {
|
|
280
|
+
return Ee[e] ?? [];
|
|
285
281
|
}
|
|
286
|
-
function
|
|
282
|
+
function Oe(e) {
|
|
287
283
|
if (e[e.length - 1] === "content") return h(e) ? "templateContent" : "content";
|
|
288
284
|
let t = e[e.length - 2];
|
|
289
285
|
return t === "rows" ? "row" : t === "cells" ? "cell" : "root";
|
|
290
286
|
}
|
|
291
|
-
var
|
|
287
|
+
var ke = {
|
|
292
288
|
root: [],
|
|
293
289
|
cell: [],
|
|
294
290
|
row: ["shape.width", "shape.autoWidth"],
|
|
@@ -300,16 +296,16 @@ var Ee = {
|
|
|
300
296
|
],
|
|
301
297
|
templateContent: ["shape.width", "shape.autoWidth"]
|
|
302
298
|
};
|
|
303
|
-
function
|
|
299
|
+
function G(e, t) {
|
|
304
300
|
return [...e.key, ...t.key];
|
|
305
301
|
}
|
|
306
|
-
function
|
|
307
|
-
let n = new Set(
|
|
308
|
-
for (let e of
|
|
302
|
+
function Ae(e, t) {
|
|
303
|
+
let n = new Set(ke[Oe(e)]), r = [];
|
|
304
|
+
for (let e of De(t.type)) {
|
|
309
305
|
let i = [];
|
|
310
306
|
for (let r of e.fields) {
|
|
311
307
|
if (r.items) {
|
|
312
|
-
let e = r.items.filter((e) => !n.has(
|
|
308
|
+
let e = r.items.filter((e) => !n.has(G(r, e).join(".")) && (!e.visibleWhen || e.visibleWhen(t)));
|
|
313
309
|
e.length > 0 && i.push({
|
|
314
310
|
...r,
|
|
315
311
|
items: e
|
|
@@ -325,7 +321,7 @@ function De(e, t) {
|
|
|
325
321
|
}
|
|
326
322
|
return r;
|
|
327
323
|
}
|
|
328
|
-
var
|
|
324
|
+
var je = [{
|
|
329
325
|
title: "画布",
|
|
330
326
|
fields: [{
|
|
331
327
|
key: ["width"],
|
|
@@ -340,7 +336,29 @@ var Oe = [{
|
|
|
340
336
|
integer: !0,
|
|
341
337
|
min: 1
|
|
342
338
|
}]
|
|
339
|
+
}, {
|
|
340
|
+
title: "背景",
|
|
341
|
+
fields: [{
|
|
342
|
+
key: ["background", "color"],
|
|
343
|
+
label: "背景色",
|
|
344
|
+
control: "color",
|
|
345
|
+
nullable: !0
|
|
346
|
+
}, {
|
|
347
|
+
key: ["background", "image"],
|
|
348
|
+
label: "背景图",
|
|
349
|
+
control: "imageSrc"
|
|
350
|
+
}]
|
|
343
351
|
}];
|
|
352
|
+
function Me(e) {
|
|
353
|
+
return e === null ? null : e.background === null ? {
|
|
354
|
+
...e,
|
|
355
|
+
background: K
|
|
356
|
+
} : e;
|
|
357
|
+
}
|
|
358
|
+
var K = {
|
|
359
|
+
color: null,
|
|
360
|
+
image: null
|
|
361
|
+
};
|
|
344
362
|
function q(e, t) {
|
|
345
363
|
let n = e;
|
|
346
364
|
for (let e = 0; e < t.length; e += 1) {
|
|
@@ -354,14 +372,14 @@ function q(e, t) {
|
|
|
354
372
|
}
|
|
355
373
|
//#endregion
|
|
356
374
|
//#region src/property-panel/fields/AlignField.vue?vue&type=script&setup=true&lang.ts
|
|
357
|
-
var
|
|
375
|
+
var Ne = ["aria-label"], Pe = [
|
|
358
376
|
"aria-pressed",
|
|
359
377
|
"title",
|
|
360
378
|
"onClick"
|
|
361
|
-
],
|
|
379
|
+
], Fe = {
|
|
362
380
|
key: 1,
|
|
363
381
|
class: "truncate px-1 text-[10px] leading-none"
|
|
364
|
-
},
|
|
382
|
+
}, Ie = /* @__PURE__ */ j({
|
|
365
383
|
__name: "AlignField",
|
|
366
384
|
props: {
|
|
367
385
|
field: {},
|
|
@@ -398,7 +416,7 @@ var ke = ["aria-label"], Ae = [
|
|
|
398
416
|
title: "底对齐"
|
|
399
417
|
}
|
|
400
418
|
}
|
|
401
|
-
}, p =
|
|
419
|
+
}, p = T(() => {
|
|
402
420
|
let e = a.field.domain ?? [], t = d[e.join(".")];
|
|
403
421
|
return e.map((e) => ({
|
|
404
422
|
value: e,
|
|
@@ -409,42 +427,42 @@ var ke = ["aria-label"], Ae = [
|
|
|
409
427
|
function m(e) {
|
|
410
428
|
e !== a.modelValue && u("change", e);
|
|
411
429
|
}
|
|
412
|
-
return (t, n) => (
|
|
430
|
+
return (t, n) => (P(), O("span", {
|
|
413
431
|
class: "cn-align flex h-7 min-w-0 flex-1 overflow-hidden rounded-md border border-cn-field-line bg-cn-field",
|
|
414
432
|
role: "group",
|
|
415
433
|
"aria-label": e.field.label
|
|
416
|
-
}, [(
|
|
434
|
+
}, [(P(!0), O(w, null, I(p.value, (t, n) => (P(), O("button", {
|
|
417
435
|
key: t.value,
|
|
418
436
|
type: "button",
|
|
419
|
-
class:
|
|
437
|
+
class: N(["cn-align__option flex min-w-0 flex-1 items-center justify-center p-0 transition-colors duration-100 focus-visible:z-10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cn-accent/40", [n > 0 ? "border-l border-cn-field-line" : "", t.value === e.modelValue ? "cn-align__option--active bg-cn-accent-soft text-cn-accent" : "text-cn-muted hover:text-cn-fg"]]),
|
|
420
438
|
"aria-pressed": t.value === e.modelValue,
|
|
421
439
|
title: t.title,
|
|
422
|
-
onClick:
|
|
423
|
-
}, [t.icon ? (
|
|
440
|
+
onClick: V((e) => m(t.value), ["prevent"])
|
|
441
|
+
}, [t.icon ? (P(), E(g, {
|
|
424
442
|
key: 0,
|
|
425
443
|
icon: t.icon
|
|
426
|
-
}, null, 8, ["icon"])) : (
|
|
444
|
+
}, null, 8, ["icon"])) : (P(), O("span", Fe, R(t.value), 1))], 10, Pe))), 128))], 8, Ne));
|
|
427
445
|
}
|
|
428
|
-
}),
|
|
446
|
+
}), Le = { class: "block" }, Re = ["aria-expanded", "title"], ze = { class: "cn-prop-field__label shrink-0 select-none truncate text-[11px] leading-none text-cn-muted" }, Be = { class: "flex shrink-0 items-center gap-1.5" }, Ve = {
|
|
429
447
|
viewBox: "0 0 24 24",
|
|
430
448
|
class: "size-3.5",
|
|
431
449
|
"aria-hidden": "true"
|
|
432
|
-
},
|
|
450
|
+
}, He = [
|
|
433
451
|
"cx",
|
|
434
452
|
"cy",
|
|
435
453
|
"r"
|
|
436
|
-
],
|
|
454
|
+
], Ue = {
|
|
437
455
|
key: 0,
|
|
438
456
|
class: "mt-2 flex justify-end"
|
|
439
|
-
},
|
|
457
|
+
}, We = {
|
|
440
458
|
class: "cn-anchor grid w-[66px] shrink-0 grid-cols-3 gap-[3px]",
|
|
441
459
|
role: "group",
|
|
442
460
|
"aria-label": "九宫锚点"
|
|
443
|
-
},
|
|
461
|
+
}, Ge = [
|
|
444
462
|
"aria-pressed",
|
|
445
463
|
"title",
|
|
446
464
|
"onClick"
|
|
447
|
-
],
|
|
465
|
+
], Ke = /* @__PURE__ */ j({
|
|
448
466
|
__name: "AnchorDisclosureField",
|
|
449
467
|
props: {
|
|
450
468
|
field: {},
|
|
@@ -453,42 +471,42 @@ var ke = ["aria-label"], Ae = [
|
|
|
453
471
|
},
|
|
454
472
|
emits: ["change", "toggle"],
|
|
455
473
|
setup(e, { emit: t }) {
|
|
456
|
-
let n = e, r = t, i =
|
|
474
|
+
let n = e, r = t, i = M(d), a = Array.from({ length: 9 }, (e, t) => ({
|
|
457
475
|
index: t,
|
|
458
476
|
cx: 4 + t % 3 * 8,
|
|
459
477
|
cy: 4 + Math.floor(t / 3) * 8
|
|
460
|
-
})), o =
|
|
478
|
+
})), o = T(() => {
|
|
461
479
|
let e = n.modelValue.includes("top") ? 0 : n.modelValue.includes("bottom") ? 2 : 1, t = n.modelValue.includes("left") ? 0 : n.modelValue.includes("right") ? 2 : 1;
|
|
462
480
|
return e * 3 + t;
|
|
463
481
|
});
|
|
464
482
|
function s(e) {
|
|
465
483
|
r("change", e);
|
|
466
484
|
}
|
|
467
|
-
return (t, n) => (
|
|
485
|
+
return (t, n) => (P(), O("span", Le, [k("button", {
|
|
468
486
|
type: "button",
|
|
469
487
|
class: "cn-anchor-disclosure__header flex w-full items-center justify-between gap-2",
|
|
470
488
|
"aria-expanded": e.expanded,
|
|
471
489
|
title: e.expanded ? "收起锚点" : `锚点:${e.modelValue}(点击展开调整)`,
|
|
472
490
|
onClick: n[0] ||= (e) => r("toggle")
|
|
473
|
-
}, [
|
|
491
|
+
}, [k("span", ze, R(e.field.label), 1), k("span", Be, [(P(), O("svg", Ve, [(P(!0), O(w, null, I(z(a), (e) => (P(), O("circle", {
|
|
474
492
|
key: e.index,
|
|
475
493
|
cx: e.cx,
|
|
476
494
|
cy: e.cy,
|
|
477
495
|
r: e.index === o.value ? 3.2 : 2.2,
|
|
478
|
-
class:
|
|
479
|
-
}, null, 10,
|
|
480
|
-
icon:
|
|
481
|
-
class:
|
|
482
|
-
}, null, 8, ["icon", "class"])])], 8,
|
|
496
|
+
class: N(e.index === o.value ? "fill-cn-accent" : "fill-cn-muted/35")
|
|
497
|
+
}, null, 10, He))), 128))])), A(g, {
|
|
498
|
+
icon: z(u),
|
|
499
|
+
class: N(["text-cn-muted transition-transform duration-150", { "rotate-180": e.expanded }])
|
|
500
|
+
}, null, 8, ["icon", "class"])])], 8, Re), e.expanded ? (P(), O("span", Ue, [k("span", We, [(P(!0), O(w, null, I(z(i), (t) => (P(), O("button", {
|
|
483
501
|
key: t,
|
|
484
502
|
type: "button",
|
|
485
|
-
class:
|
|
503
|
+
class: N(["cn-anchor__cell relative aspect-square min-w-0 rounded-[4px] border p-0 transition-colors duration-100", t === e.modelValue ? "cn-anchor__cell--active border-cn-accent bg-cn-accent shadow-[0_0_8px_rgba(56,189,248,0.35)]" : "border-cn-field-line bg-cn-field hover:border-cn-muted/50"]),
|
|
486
504
|
"aria-pressed": t === e.modelValue,
|
|
487
505
|
title: t,
|
|
488
506
|
onClick: (e) => s(t)
|
|
489
|
-
}, null, 10,
|
|
507
|
+
}, null, 10, Ge))), 128))])])) : D("", !0)]));
|
|
490
508
|
}
|
|
491
|
-
}),
|
|
509
|
+
}), qe = { class: "cn-bool relative inline-flex h-4 w-7 shrink-0 cursor-pointer items-center" }, Je = ["checked"], Ye = /* @__PURE__ */ j({
|
|
492
510
|
__name: "BooleanField",
|
|
493
511
|
props: {
|
|
494
512
|
field: {},
|
|
@@ -496,26 +514,26 @@ var ke = ["aria-label"], Ae = [
|
|
|
496
514
|
},
|
|
497
515
|
emits: ["input", "change"],
|
|
498
516
|
setup(e, { emit: t }) {
|
|
499
|
-
let n = e, r = t, i =
|
|
517
|
+
let n = e, r = t, i = F(null);
|
|
500
518
|
async function a(e) {
|
|
501
|
-
r("change", e.target.checked), await
|
|
519
|
+
r("change", e.target.checked), await pe(), i.value && (i.value.checked = n.modelValue);
|
|
502
520
|
}
|
|
503
|
-
return
|
|
521
|
+
return ve(() => {
|
|
504
522
|
i.value && (i.value.checked = n.modelValue);
|
|
505
|
-
}), (t, n) => (
|
|
506
|
-
|
|
523
|
+
}), (t, n) => (P(), O("label", qe, [
|
|
524
|
+
k("input", {
|
|
507
525
|
ref_key: "inputRef",
|
|
508
526
|
ref: i,
|
|
509
527
|
class: "cn-bool__input peer sr-only",
|
|
510
528
|
type: "checkbox",
|
|
511
529
|
checked: e.modelValue,
|
|
512
530
|
onChange: a
|
|
513
|
-
}, null, 40,
|
|
514
|
-
n[0] ||=
|
|
515
|
-
n[1] ||=
|
|
531
|
+
}, null, 40, Je),
|
|
532
|
+
n[0] ||= k("span", { class: "absolute inset-0 rounded-full border border-cn-field-line bg-cn-field transition-colors duration-150 peer-checked:border-cn-accent/60 peer-checked:bg-cn-accent/30 peer-focus-visible:ring-[3px] peer-focus-visible:ring-cn-accent/20" }, null, -1),
|
|
533
|
+
n[1] ||= k("span", { class: "relative mx-0.5 size-3 rounded-full bg-cn-muted shadow-sm transition-transform duration-150 peer-checked:translate-x-3 peer-checked:bg-cn-accent" }, null, -1)
|
|
516
534
|
]));
|
|
517
535
|
}
|
|
518
|
-
}),
|
|
536
|
+
}), Xe = {
|
|
519
537
|
1: [{
|
|
520
538
|
label: "四边",
|
|
521
539
|
rep: "top",
|
|
@@ -558,13 +576,13 @@ var ke = ["aria-label"], Ae = [
|
|
|
558
576
|
}
|
|
559
577
|
]
|
|
560
578
|
};
|
|
561
|
-
function
|
|
579
|
+
function Ze(e) {
|
|
562
580
|
return e === 1 ? 2 : e === 2 ? 4 : 1;
|
|
563
581
|
}
|
|
564
|
-
function
|
|
582
|
+
function Qe(e) {
|
|
565
583
|
return e.top === e.bottom && e.bottom === e.left && e.left === e.right ? 1 : e.top === e.bottom && e.left === e.right ? 2 : 4;
|
|
566
584
|
}
|
|
567
|
-
function
|
|
585
|
+
function $e(e, t) {
|
|
568
586
|
if (t === 1) {
|
|
569
587
|
let { top: t } = e;
|
|
570
588
|
return {
|
|
@@ -585,17 +603,17 @@ function Ye(e, t) {
|
|
|
585
603
|
}
|
|
586
604
|
return e;
|
|
587
605
|
}
|
|
588
|
-
function
|
|
606
|
+
function et(e, t) {
|
|
589
607
|
return e.top === t.top && e.bottom === t.bottom && e.left === t.left && e.right === t.right;
|
|
590
608
|
}
|
|
591
609
|
function J(e, t) {
|
|
592
610
|
return e === null || t === null ? e === t : e.width === t.width && e.color === t.color;
|
|
593
611
|
}
|
|
594
|
-
function
|
|
612
|
+
function tt(e) {
|
|
595
613
|
let { top: t, bottom: n, left: r, right: i } = e;
|
|
596
614
|
return t === null && n === null && r === null && i === null || t !== null && J(t, n) && J(t, r) && J(t, i) ? 1 : J(t, n) && J(r, i) ? 2 : 4;
|
|
597
615
|
}
|
|
598
|
-
function
|
|
616
|
+
function nt(e, t) {
|
|
599
617
|
let n = (e) => e === null ? null : { ...e };
|
|
600
618
|
if (t === 1) {
|
|
601
619
|
let t = n(e.top);
|
|
@@ -617,18 +635,18 @@ function Qe(e, t) {
|
|
|
617
635
|
}
|
|
618
636
|
return e;
|
|
619
637
|
}
|
|
620
|
-
function
|
|
638
|
+
function rt(e, t) {
|
|
621
639
|
return J(e.top, t.top) && J(e.bottom, t.bottom) && J(e.left, t.left) && J(e.right, t.right);
|
|
622
640
|
}
|
|
623
641
|
//#endregion
|
|
624
642
|
//#region src/property-panel/useShorthandMode.ts
|
|
625
|
-
function
|
|
626
|
-
let n =
|
|
627
|
-
|
|
643
|
+
function it(e, t) {
|
|
644
|
+
let n = T(() => t(e())), r = F(null), i = T(() => r.value ?? n.value);
|
|
645
|
+
B(e, () => {
|
|
628
646
|
r.value = null;
|
|
629
647
|
});
|
|
630
648
|
function a() {
|
|
631
|
-
let e = i.value, t =
|
|
649
|
+
let e = i.value, t = Ze(e);
|
|
632
650
|
return r.value = t, {
|
|
633
651
|
from: e,
|
|
634
652
|
to: t
|
|
@@ -641,7 +659,7 @@ function et(e, t) {
|
|
|
641
659
|
}
|
|
642
660
|
//#endregion
|
|
643
661
|
//#region src/property-panel/controlStyles.ts
|
|
644
|
-
var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-field text-[11.5px] leading-none text-cn-fg outline-none transition-[border-color,box-shadow,background-color] duration-100 placeholder:text-cn-muted/60 hover:border-cn-muted/40 focus:border-cn-accent/70 focus:ring-[3px] focus:ring-cn-accent/15 disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:border-cn-field-line", X = `${Y} text-right font-mono tabular-nums`,
|
|
662
|
+
var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-field text-[11.5px] leading-none text-cn-fg outline-none transition-[border-color,box-shadow,background-color] duration-100 placeholder:text-cn-muted/60 hover:border-cn-muted/40 focus:border-cn-accent/70 focus:ring-[3px] focus:ring-cn-accent/15 disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:border-cn-field-line", X = `${Y} text-right font-mono tabular-nums`, at = Y, ot = "w-full flex-1 min-w-0 resize-y rounded-md border border-cn-field-line bg-cn-field px-2 py-1.5 text-[11.5px] leading-5 text-cn-fg outline-none transition-[border-color,box-shadow] duration-100 placeholder:text-cn-muted/60 hover:border-cn-muted/40 focus:border-cn-accent/70 focus:ring-[3px] focus:ring-cn-accent/15 disabled:cursor-not-allowed disabled:opacity-40", st = "size-7 shrink-0 cursor-pointer self-center rounded-md border border-cn-field-line bg-cn-field p-0.5 transition-colors hover:border-cn-muted/40 disabled:cursor-not-allowed disabled:opacity-40", ct = ["aria-label"], lt = /* @__PURE__ */ j({
|
|
645
663
|
__name: "BorderWidthInput",
|
|
646
664
|
props: {
|
|
647
665
|
value: {},
|
|
@@ -649,8 +667,8 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
649
667
|
},
|
|
650
668
|
emits: ["input", "change"],
|
|
651
669
|
setup(e, { emit: t }) {
|
|
652
|
-
let n = e, r = t, i =
|
|
653
|
-
|
|
670
|
+
let n = e, r = t, i = F(n.value === null ? "" : String(n.value)), a = F(!1);
|
|
671
|
+
B(() => n.value, (e) => {
|
|
654
672
|
a.value || (i.value = e === null ? "" : String(e));
|
|
655
673
|
});
|
|
656
674
|
function o(e) {
|
|
@@ -679,9 +697,9 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
679
697
|
let a = o(t);
|
|
680
698
|
i.value = a === 0 ? "" : String(a), r("change", a);
|
|
681
699
|
}
|
|
682
|
-
return (t, n) =>
|
|
700
|
+
return (t, n) => be((P(), O("input", {
|
|
683
701
|
"onUpdate:modelValue": n[0] ||= (e) => i.value = e,
|
|
684
|
-
class:
|
|
702
|
+
class: N(["cn-field cn-field--number min-w-0 flex-1", z(X)]),
|
|
685
703
|
type: "number",
|
|
686
704
|
"aria-label": e.label,
|
|
687
705
|
min: 0,
|
|
@@ -692,9 +710,9 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
692
710
|
onFocus: n[1] ||= (e) => a.value = !0,
|
|
693
711
|
onBlur: u,
|
|
694
712
|
onChange: u
|
|
695
|
-
}, null, 42,
|
|
713
|
+
}, null, 42, ct)), [[_e, i.value]]);
|
|
696
714
|
}
|
|
697
|
-
}),
|
|
715
|
+
}), ut = ["aria-label", "title"], dt = /* @__PURE__ */ j({
|
|
698
716
|
__name: "ShorthandModeButton",
|
|
699
717
|
props: {
|
|
700
718
|
mode: {},
|
|
@@ -704,35 +722,35 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
704
722
|
setup(e, { emit: t }) {
|
|
705
723
|
let n = e, r = t, i = {
|
|
706
724
|
1: {
|
|
707
|
-
icon:
|
|
725
|
+
icon: Ce,
|
|
708
726
|
title: "统一值"
|
|
709
727
|
},
|
|
710
728
|
2: {
|
|
711
|
-
icon:
|
|
729
|
+
icon: Se,
|
|
712
730
|
title: "上下/左右"
|
|
713
731
|
},
|
|
714
732
|
4: {
|
|
715
|
-
icon:
|
|
733
|
+
icon: xe,
|
|
716
734
|
title: "四边独立"
|
|
717
735
|
}
|
|
718
|
-
}, a =
|
|
719
|
-
return (e, t) => (
|
|
736
|
+
}, a = T(() => i[n.mode]), o = T(() => `${n.label}:${a.value.title}(点击切换值模式)`);
|
|
737
|
+
return (e, t) => (P(), O("button", {
|
|
720
738
|
type: "button",
|
|
721
739
|
class: "cn-props__mode-toggle shrink-0",
|
|
722
740
|
"aria-label": o.value,
|
|
723
741
|
title: o.value,
|
|
724
|
-
onClick: t[0] ||=
|
|
725
|
-
}, [
|
|
742
|
+
onClick: t[0] ||= V((e) => r("cycle"), ["prevent"])
|
|
743
|
+
}, [A(g, {
|
|
726
744
|
icon: a.value.icon,
|
|
727
745
|
size: 12
|
|
728
|
-
}, null, 8, ["icon"])], 8,
|
|
746
|
+
}, null, 8, ["icon"])], 8, ut));
|
|
729
747
|
}
|
|
730
|
-
}),
|
|
748
|
+
}), ft = { class: "cn-border flex w-full min-w-0 items-center gap-1" }, pt = { class: "grid min-w-0 flex-1 gap-1 grid-cols-1" }, mt = { class: "w-5 shrink-0 select-none text-[10px] leading-none text-cn-muted" }, ht = [
|
|
731
749
|
"value",
|
|
732
750
|
"disabled",
|
|
733
751
|
"onInput",
|
|
734
752
|
"onChange"
|
|
735
|
-
],
|
|
753
|
+
], gt = "#000000", _t = /* @__PURE__ */ j({
|
|
736
754
|
__name: "BorderField",
|
|
737
755
|
props: {
|
|
738
756
|
field: {},
|
|
@@ -740,12 +758,12 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
740
758
|
},
|
|
741
759
|
emits: ["input", "change"],
|
|
742
760
|
setup(e, { emit: t }) {
|
|
743
|
-
let n = e, r = t, { mode: i, cycle: a } =
|
|
761
|
+
let n = e, r = t, { mode: i, cycle: a } = it(() => n.modelValue, tt), o = T(() => Xe[i.value]);
|
|
744
762
|
function s(e) {
|
|
745
763
|
return n.modelValue[e.rep]?.width ?? null;
|
|
746
764
|
}
|
|
747
765
|
function c(e) {
|
|
748
|
-
return n.modelValue[e.rep]?.color ??
|
|
766
|
+
return n.modelValue[e.rep]?.color ?? gt;
|
|
749
767
|
}
|
|
750
768
|
function l(e, t, i) {
|
|
751
769
|
let a = { ...n.modelValue };
|
|
@@ -753,7 +771,7 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
753
771
|
r(i ? "change" : "input", a);
|
|
754
772
|
}
|
|
755
773
|
function u(e, t, r) {
|
|
756
|
-
let i = n.modelValue[e.rep]?.color ??
|
|
774
|
+
let i = n.modelValue[e.rep]?.color ?? gt;
|
|
757
775
|
l(e, t <= 0 ? null : {
|
|
758
776
|
width: t,
|
|
759
777
|
color: i
|
|
@@ -771,20 +789,20 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
771
789
|
function f() {
|
|
772
790
|
let { from: e, to: t } = a();
|
|
773
791
|
if (t < e) {
|
|
774
|
-
let e =
|
|
775
|
-
|
|
792
|
+
let e = nt(n.modelValue, t);
|
|
793
|
+
rt(e, n.modelValue) || r("change", e);
|
|
776
794
|
}
|
|
777
795
|
}
|
|
778
|
-
return (t, n) => (
|
|
779
|
-
mode:
|
|
796
|
+
return (t, n) => (P(), O("span", ft, [A(dt, {
|
|
797
|
+
mode: z(i),
|
|
780
798
|
label: "边框",
|
|
781
799
|
onCycle: f
|
|
782
|
-
}, null, 8, ["mode"]),
|
|
800
|
+
}, null, 8, ["mode"]), k("span", pt, [(P(!0), O(w, null, I(o.value, (t) => (P(), O("label", {
|
|
783
801
|
key: t.rep,
|
|
784
802
|
class: "flex items-center gap-1.5"
|
|
785
803
|
}, [
|
|
786
|
-
|
|
787
|
-
|
|
804
|
+
k("span", mt, R(t.label), 1),
|
|
805
|
+
A(lt, {
|
|
788
806
|
class: "cn-border__width",
|
|
789
807
|
value: s(t),
|
|
790
808
|
label: t.label,
|
|
@@ -796,7 +814,7 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
796
814
|
"onInput",
|
|
797
815
|
"onChange"
|
|
798
816
|
]),
|
|
799
|
-
|
|
817
|
+
k("input", {
|
|
800
818
|
class: "cn-border__color size-6 shrink-0 cursor-pointer self-center rounded-md border border-cn-field-line bg-cn-field p-0.5 transition-colors hover:border-cn-muted/40 disabled:cursor-not-allowed disabled:opacity-40",
|
|
801
819
|
type: "color",
|
|
802
820
|
title: "边框颜色",
|
|
@@ -804,17 +822,17 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
804
822
|
disabled: e.modelValue[t.rep] === null,
|
|
805
823
|
onInput: (e) => d(t, e, !1),
|
|
806
824
|
onChange: (e) => d(t, e, !0)
|
|
807
|
-
}, null, 40,
|
|
825
|
+
}, null, 40, ht)
|
|
808
826
|
]))), 128))])]));
|
|
809
827
|
}
|
|
810
|
-
}),
|
|
828
|
+
}), vt = ["value"], yt = {
|
|
811
829
|
key: 1,
|
|
812
830
|
class: "flex flex-1 items-center gap-1.5"
|
|
813
|
-
},
|
|
831
|
+
}, bt = ["value"], xt = ["value"], St = [
|
|
814
832
|
"disabled",
|
|
815
833
|
"title",
|
|
816
834
|
"data-upload-error"
|
|
817
|
-
],
|
|
835
|
+
], Ct = /* @__PURE__ */ j({
|
|
818
836
|
__name: "FontField",
|
|
819
837
|
props: {
|
|
820
838
|
field: {},
|
|
@@ -822,7 +840,7 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
822
840
|
},
|
|
823
841
|
emits: ["input", "change"],
|
|
824
842
|
setup(e, { emit: t }) {
|
|
825
|
-
let n = e, r = t, i =
|
|
843
|
+
let n = e, r = t, i = re(), a = T(() => {
|
|
826
844
|
if (i === null) return [];
|
|
827
845
|
let e = [{
|
|
828
846
|
label: "内置默认字体",
|
|
@@ -857,7 +875,7 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
857
875
|
function f(e) {
|
|
858
876
|
c = !1, r("change", e.target.value);
|
|
859
877
|
}
|
|
860
|
-
let p =
|
|
878
|
+
let p = F(!1), m = F(null), h = F(null);
|
|
861
879
|
function g() {
|
|
862
880
|
m.value = null, h.value?.click();
|
|
863
881
|
}
|
|
@@ -866,7 +884,7 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
866
884
|
if (t.value = "", i !== null && n && !p.value) {
|
|
867
885
|
p.value = !0;
|
|
868
886
|
try {
|
|
869
|
-
let e = await i.uploadFont(await
|
|
887
|
+
let e = await i.uploadFont(await ue(n));
|
|
870
888
|
r("change", e);
|
|
871
889
|
} catch (e) {
|
|
872
890
|
m.value = e instanceof Error ? e.message : String(e);
|
|
@@ -875,25 +893,25 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
875
893
|
}
|
|
876
894
|
}
|
|
877
895
|
}
|
|
878
|
-
return (t, n) =>
|
|
896
|
+
return (t, n) => z(i) === null ? (P(), O("input", {
|
|
879
897
|
key: 0,
|
|
880
|
-
class:
|
|
898
|
+
class: N(["cn-field", z(at)]),
|
|
881
899
|
type: "text",
|
|
882
900
|
value: e.modelValue,
|
|
883
901
|
onInput: l,
|
|
884
902
|
onCompositionstart: u,
|
|
885
903
|
onCompositionend: d,
|
|
886
904
|
onChange: f
|
|
887
|
-
}, null, 42,
|
|
888
|
-
|
|
889
|
-
class:
|
|
905
|
+
}, null, 42, vt)) : (P(), O("div", yt, [
|
|
906
|
+
k("select", {
|
|
907
|
+
class: N(["cn-field cn-select", z(Y)]),
|
|
890
908
|
value: e.modelValue,
|
|
891
909
|
onChange: s
|
|
892
|
-
}, [(
|
|
910
|
+
}, [(P(!0), O(w, null, I(a.value, (e) => (P(), O("option", {
|
|
893
911
|
key: e.value,
|
|
894
912
|
value: e.value
|
|
895
|
-
},
|
|
896
|
-
|
|
913
|
+
}, R(e.label), 9, xt))), 128))], 42, bt),
|
|
914
|
+
k("input", {
|
|
897
915
|
ref_key: "fileInput",
|
|
898
916
|
ref: h,
|
|
899
917
|
type: "file",
|
|
@@ -901,7 +919,7 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
901
919
|
accept: ".ttf,.otf,.woff,.woff2,font/ttf,font/otf,font/woff,font/woff2",
|
|
902
920
|
onChange: _
|
|
903
921
|
}, null, 544),
|
|
904
|
-
|
|
922
|
+
z(i).canUpload ? (P(), O("button", {
|
|
905
923
|
key: 0,
|
|
906
924
|
type: "button",
|
|
907
925
|
class: "h-7 shrink-0 rounded-md border border-cn-field-line bg-cn-field px-2 text-[11px] leading-none text-cn-fg transition-colors duration-100 hover:border-cn-muted/40 disabled:cursor-not-allowed disabled:opacity-40",
|
|
@@ -909,10 +927,10 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
909
927
|
title: m.value ?? "上传本机字体(加入清单后可选)",
|
|
910
928
|
"data-upload-error": m.value ?? void 0,
|
|
911
929
|
onClick: g
|
|
912
|
-
},
|
|
930
|
+
}, R(p.value ? "…" : m.value ? "!" : "上传"), 9, St)) : D("", !0)
|
|
913
931
|
]));
|
|
914
932
|
}
|
|
915
|
-
}),
|
|
933
|
+
}), wt = { class: "cn-color flex min-w-0 flex-1 items-center gap-1.5" }, Tt = ["checked"], Et = ["value", "disabled"], Dt = ["value", "disabled"], Ot = "#000000", kt = /* @__PURE__ */ j({
|
|
916
934
|
__name: "ColorField",
|
|
917
935
|
props: {
|
|
918
936
|
field: {},
|
|
@@ -920,12 +938,12 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
920
938
|
},
|
|
921
939
|
emits: ["input", "change"],
|
|
922
940
|
setup(e, { emit: t }) {
|
|
923
|
-
let n = e, r = t, i =
|
|
924
|
-
|
|
941
|
+
let n = e, r = t, i = F(n.modelValue !== null), a = F(o(n.modelValue));
|
|
942
|
+
B(() => n.modelValue, (e) => {
|
|
925
943
|
i.value = e !== null, i.value && (a.value = o(e));
|
|
926
944
|
});
|
|
927
945
|
function o(e) {
|
|
928
|
-
return e !== null && /^#[0-9a-fA-F]{6}$/.test(e) ? e :
|
|
946
|
+
return e !== null && /^#[0-9a-fA-F]{6}$/.test(e) ? e : Ot;
|
|
929
947
|
}
|
|
930
948
|
function s(e) {
|
|
931
949
|
let t = e.target.checked;
|
|
@@ -952,40 +970,40 @@ var Y = "h-7 flex-1 w-full min-w-0 rounded-md border border-cn-field-line bg-cn-
|
|
|
952
970
|
}
|
|
953
971
|
a.value = o(t), r("change", t);
|
|
954
972
|
}
|
|
955
|
-
return (t, n) => (
|
|
956
|
-
e.field.nullable ? (
|
|
973
|
+
return (t, n) => (P(), O("span", wt, [
|
|
974
|
+
e.field.nullable ? (P(), O("input", {
|
|
957
975
|
key: 0,
|
|
958
976
|
class: "cn-color__toggle size-3.5 shrink-0 cursor-pointer accent-cn-accent",
|
|
959
977
|
type: "checkbox",
|
|
960
978
|
title: "启用颜色",
|
|
961
979
|
checked: i.value,
|
|
962
980
|
onChange: s
|
|
963
|
-
}, null, 40,
|
|
964
|
-
|
|
965
|
-
class:
|
|
981
|
+
}, null, 40, Tt)) : D("", !0),
|
|
982
|
+
k("input", {
|
|
983
|
+
class: N(["cn-color__swatch", z(st)]),
|
|
966
984
|
type: "color",
|
|
967
985
|
value: a.value,
|
|
968
986
|
disabled: !i.value,
|
|
969
987
|
onInput: c,
|
|
970
988
|
onChange: l
|
|
971
|
-
}, null, 42,
|
|
972
|
-
|
|
973
|
-
class:
|
|
989
|
+
}, null, 42, Et),
|
|
990
|
+
k("input", {
|
|
991
|
+
class: N(["cn-color__text min-w-0 flex-1", z(Y)]),
|
|
974
992
|
type: "text",
|
|
975
993
|
value: e.modelValue ?? "",
|
|
976
994
|
disabled: !i.value,
|
|
977
995
|
placeholder: "无",
|
|
978
996
|
onChange: u
|
|
979
|
-
}, null, 42,
|
|
997
|
+
}, null, 42, Dt)
|
|
980
998
|
]));
|
|
981
999
|
}
|
|
982
1000
|
}), Z = Symbol("canvas-image-upload");
|
|
983
|
-
function
|
|
984
|
-
return
|
|
1001
|
+
function At() {
|
|
1002
|
+
return fe(Z, null);
|
|
985
1003
|
}
|
|
986
1004
|
//#endregion
|
|
987
1005
|
//#region src/property-panel/fields/TextField.vue?vue&type=script&setup=true&lang.ts
|
|
988
|
-
var
|
|
1006
|
+
var jt = ["value", "placeholder"], Q = /* @__PURE__ */ j({
|
|
989
1007
|
__name: "TextField",
|
|
990
1008
|
props: {
|
|
991
1009
|
field: {},
|
|
@@ -993,7 +1011,7 @@ var Dt = ["value", "placeholder"], Q = /* @__PURE__ */ M({
|
|
|
993
1011
|
},
|
|
994
1012
|
emits: ["input", "change"],
|
|
995
1013
|
setup(e, { emit: t }) {
|
|
996
|
-
let n = e, r = t, i = !1, a =
|
|
1014
|
+
let n = e, r = t, i = !1, a = F(!1);
|
|
997
1015
|
function o(e) {
|
|
998
1016
|
return n.field.nonEmpty === !0 ? e.trim() === "" ? (a.value = !0, !0) : (a.value = !1, !1) : !1;
|
|
999
1017
|
}
|
|
@@ -1014,8 +1032,8 @@ var Dt = ["value", "placeholder"], Q = /* @__PURE__ */ M({
|
|
|
1014
1032
|
let t = e.target.value;
|
|
1015
1033
|
o(t) || r("change", t);
|
|
1016
1034
|
}
|
|
1017
|
-
return (t, n) => (
|
|
1018
|
-
class:
|
|
1035
|
+
return (t, n) => (P(), O("input", {
|
|
1036
|
+
class: N(["cn-field", [z(at), a.value ? "cn-field--invalid" : ""]]),
|
|
1019
1037
|
type: "text",
|
|
1020
1038
|
value: e.modelValue,
|
|
1021
1039
|
placeholder: e.field.placeholder,
|
|
@@ -1023,9 +1041,9 @@ var Dt = ["value", "placeholder"], Q = /* @__PURE__ */ M({
|
|
|
1023
1041
|
onCompositionstart: c,
|
|
1024
1042
|
onCompositionend: l,
|
|
1025
1043
|
onChange: u
|
|
1026
|
-
}, null, 42,
|
|
1044
|
+
}, null, 42, jt));
|
|
1027
1045
|
}
|
|
1028
|
-
}),
|
|
1046
|
+
}), Mt = /* @__PURE__ */ j({
|
|
1029
1047
|
__name: "ResourceValueField",
|
|
1030
1048
|
props: {
|
|
1031
1049
|
field: {},
|
|
@@ -1036,15 +1054,15 @@ var Dt = ["value", "placeholder"], Q = /* @__PURE__ */ M({
|
|
|
1036
1054
|
},
|
|
1037
1055
|
emits: ["input", "change"],
|
|
1038
1056
|
setup(e, { emit: t }) {
|
|
1039
|
-
let n = e, r = t, i =
|
|
1057
|
+
let n = e, r = t, i = T(() => n.dataMode === "expression"), a = T(() => {
|
|
1040
1058
|
let e = n.modelValue ?? "";
|
|
1041
|
-
return i.value ?
|
|
1059
|
+
return i.value ? b(e) ?? e : "";
|
|
1042
1060
|
});
|
|
1043
1061
|
function o(e) {
|
|
1044
|
-
let t =
|
|
1062
|
+
let t = S(e);
|
|
1045
1063
|
r("input", t), r("change", t);
|
|
1046
1064
|
}
|
|
1047
|
-
return (t, n) => i.value ? (
|
|
1065
|
+
return (t, n) => i.value ? (P(), E(y, {
|
|
1048
1066
|
key: 0,
|
|
1049
1067
|
"model-value": a.value,
|
|
1050
1068
|
source: e.source ?? null,
|
|
@@ -1057,7 +1075,7 @@ var Dt = ["value", "placeholder"], Q = /* @__PURE__ */ M({
|
|
|
1057
1075
|
"source",
|
|
1058
1076
|
"disabled",
|
|
1059
1077
|
"aria-label"
|
|
1060
|
-
])) : (
|
|
1078
|
+
])) : (P(), E(Q, {
|
|
1061
1079
|
key: 1,
|
|
1062
1080
|
field: e.field,
|
|
1063
1081
|
"model-value": e.modelValue ?? "",
|
|
@@ -1072,17 +1090,17 @@ var Dt = ["value", "placeholder"], Q = /* @__PURE__ */ M({
|
|
|
1072
1090
|
"disabled"
|
|
1073
1091
|
]));
|
|
1074
1092
|
}
|
|
1075
|
-
}),
|
|
1093
|
+
}), Nt = {
|
|
1076
1094
|
key: 0,
|
|
1077
1095
|
class: "flex flex-col gap-1.5"
|
|
1078
|
-
},
|
|
1096
|
+
}, Pt = [
|
|
1079
1097
|
"disabled",
|
|
1080
1098
|
"title",
|
|
1081
1099
|
"data-upload-error"
|
|
1082
|
-
],
|
|
1100
|
+
], Ft = ["src"], It = {
|
|
1083
1101
|
key: 2,
|
|
1084
1102
|
class: "relative"
|
|
1085
|
-
},
|
|
1103
|
+
}, Lt = { class: "flex items-center gap-1.5" }, Rt = /* @__PURE__ */ j({
|
|
1086
1104
|
__name: "ImageSrcField",
|
|
1087
1105
|
props: {
|
|
1088
1106
|
field: {},
|
|
@@ -1094,7 +1112,7 @@ var Dt = ["value", "placeholder"], Q = /* @__PURE__ */ M({
|
|
|
1094
1112
|
},
|
|
1095
1113
|
emits: ["input", "change"],
|
|
1096
1114
|
setup(e, { emit: t }) {
|
|
1097
|
-
let n = e, r = t, i =
|
|
1115
|
+
let n = e, r = t, i = At(), a = T(() => i !== null && i.canUpload && n.dataMode !== "expression"), o = T(() => typeof n.modelValue == "string" && n.modelValue !== ""), s = T(() => n.resourceStatus === "pending" ? "装载中" : n.resourceStatus === "failed" ? "失败" : null), c = F(!1), l = F(null), u = F(null);
|
|
1098
1116
|
function d() {
|
|
1099
1117
|
l.value = null, u.value?.click();
|
|
1100
1118
|
}
|
|
@@ -1103,7 +1121,7 @@ var Dt = ["value", "placeholder"], Q = /* @__PURE__ */ M({
|
|
|
1103
1121
|
if (t.value = "", i !== null && n && !c.value) {
|
|
1104
1122
|
c.value = !0;
|
|
1105
1123
|
try {
|
|
1106
|
-
let e = await i.uploadImage(await
|
|
1124
|
+
let e = await i.uploadImage(await ue(n));
|
|
1107
1125
|
e !== null && r("change", e);
|
|
1108
1126
|
} catch (e) {
|
|
1109
1127
|
l.value = e instanceof Error ? e.message : String(e);
|
|
@@ -1112,8 +1130,8 @@ var Dt = ["value", "placeholder"], Q = /* @__PURE__ */ M({
|
|
|
1112
1130
|
}
|
|
1113
1131
|
}
|
|
1114
1132
|
}
|
|
1115
|
-
return (t, n) => a.value ? (
|
|
1116
|
-
|
|
1133
|
+
return (t, n) => a.value ? (P(), O("div", Nt, [
|
|
1134
|
+
k("button", {
|
|
1117
1135
|
type: "button",
|
|
1118
1136
|
class: "cn-imagesrc__thumb relative flex h-16 w-full items-center justify-center overflow-hidden rounded-md border border-dashed border-cn-field-line bg-cn-field/40 text-[11px] leading-none text-cn-muted transition-colors duration-100 hover:border-cn-muted/40 disabled:cursor-not-allowed disabled:opacity-40",
|
|
1119
1137
|
disabled: c.value,
|
|
@@ -1121,19 +1139,19 @@ var Dt = ["value", "placeholder"], Q = /* @__PURE__ */ M({
|
|
|
1121
1139
|
"data-upload-error": l.value ?? void 0,
|
|
1122
1140
|
onClick: d
|
|
1123
1141
|
}, [
|
|
1124
|
-
o.value ? (
|
|
1142
|
+
o.value ? (P(), O("img", {
|
|
1125
1143
|
key: 0,
|
|
1126
1144
|
src: e.modelValue ?? void 0,
|
|
1127
1145
|
class: "absolute inset-0 size-full object-cover",
|
|
1128
1146
|
alt: ""
|
|
1129
|
-
}, null, 8,
|
|
1130
|
-
s.value ? (
|
|
1147
|
+
}, null, 8, Ft)) : D("", !0),
|
|
1148
|
+
s.value ? (P(), O("span", {
|
|
1131
1149
|
key: 1,
|
|
1132
|
-
class:
|
|
1133
|
-
},
|
|
1134
|
-
o.value ?
|
|
1135
|
-
], 8,
|
|
1136
|
-
|
|
1150
|
+
class: N(["cn-imagesrc__status absolute right-1 top-1 rounded bg-cn-bg-elevated/90 px-1 py-0.5 text-[10px] leading-none", e.resourceStatus === "failed" ? "text-red-400" : "text-cn-muted"])
|
|
1151
|
+
}, R(s.value), 3)) : D("", !0),
|
|
1152
|
+
o.value ? D("", !0) : (P(), O("span", It, R(c.value ? "…" : l.value ? "!" : "点击上传图片"), 1))
|
|
1153
|
+
], 8, Pt),
|
|
1154
|
+
k("input", {
|
|
1137
1155
|
ref_key: "fileInput",
|
|
1138
1156
|
ref: u,
|
|
1139
1157
|
type: "file",
|
|
@@ -1141,7 +1159,7 @@ var Dt = ["value", "placeholder"], Q = /* @__PURE__ */ M({
|
|
|
1141
1159
|
accept: "image/*",
|
|
1142
1160
|
onChange: f
|
|
1143
1161
|
}, null, 544),
|
|
1144
|
-
|
|
1162
|
+
k("div", Lt, [A(Q, {
|
|
1145
1163
|
class: "flex-1",
|
|
1146
1164
|
field: e.field,
|
|
1147
1165
|
"model-value": e.modelValue ?? "",
|
|
@@ -1152,14 +1170,14 @@ var Dt = ["value", "placeholder"], Q = /* @__PURE__ */ M({
|
|
|
1152
1170
|
"field",
|
|
1153
1171
|
"model-value",
|
|
1154
1172
|
"aria-label"
|
|
1155
|
-
]), o.value ? (
|
|
1173
|
+
]), o.value ? (P(), O("button", {
|
|
1156
1174
|
key: 0,
|
|
1157
1175
|
type: "button",
|
|
1158
1176
|
class: "cn-imagesrc__clear h-7 shrink-0 rounded-md border border-cn-field-line bg-cn-field px-2 text-[11px] leading-none text-cn-fg transition-colors duration-100 hover:border-cn-muted/40",
|
|
1159
1177
|
title: "清除图片(资源地址置空)",
|
|
1160
1178
|
onClick: n[2] ||= (e) => r("change", "")
|
|
1161
|
-
}, "清除")) :
|
|
1162
|
-
])) : e.dataMode === "expression" ? (
|
|
1179
|
+
}, "清除")) : D("", !0)])
|
|
1180
|
+
])) : e.dataMode === "expression" ? (P(), E(Mt, {
|
|
1163
1181
|
key: 1,
|
|
1164
1182
|
field: e.field,
|
|
1165
1183
|
"model-value": e.modelValue,
|
|
@@ -1173,7 +1191,7 @@ var Dt = ["value", "placeholder"], Q = /* @__PURE__ */ M({
|
|
|
1173
1191
|
"model-value",
|
|
1174
1192
|
"source",
|
|
1175
1193
|
"disabled"
|
|
1176
|
-
])) : (
|
|
1194
|
+
])) : (P(), E(Q, {
|
|
1177
1195
|
key: 2,
|
|
1178
1196
|
field: e.field,
|
|
1179
1197
|
"model-value": e.modelValue ?? "",
|
|
@@ -1186,12 +1204,12 @@ var Dt = ["value", "placeholder"], Q = /* @__PURE__ */ M({
|
|
|
1186
1204
|
"aria-label"
|
|
1187
1205
|
]));
|
|
1188
1206
|
}
|
|
1189
|
-
}),
|
|
1207
|
+
}), zt = [
|
|
1190
1208
|
"aria-label",
|
|
1191
1209
|
"min",
|
|
1192
1210
|
"max",
|
|
1193
1211
|
"step"
|
|
1194
|
-
], $ = /* @__PURE__ */
|
|
1212
|
+
], $ = /* @__PURE__ */ j({
|
|
1195
1213
|
__name: "NumberField",
|
|
1196
1214
|
props: {
|
|
1197
1215
|
field: {},
|
|
@@ -1199,8 +1217,8 @@ var Dt = ["value", "placeholder"], Q = /* @__PURE__ */ M({
|
|
|
1199
1217
|
},
|
|
1200
1218
|
emits: ["input", "change"],
|
|
1201
1219
|
setup(e, { emit: t }) {
|
|
1202
|
-
let n = e, r = t, i =
|
|
1203
|
-
|
|
1220
|
+
let n = e, r = t, i = F(String(n.modelValue)), a = F(!1);
|
|
1221
|
+
B(() => n.modelValue, (e) => {
|
|
1204
1222
|
a.value || (i.value = String(e));
|
|
1205
1223
|
});
|
|
1206
1224
|
function o(e) {
|
|
@@ -1227,9 +1245,9 @@ var Dt = ["value", "placeholder"], Q = /* @__PURE__ */ M({
|
|
|
1227
1245
|
let a = o(t);
|
|
1228
1246
|
i.value = String(a), r("change", a);
|
|
1229
1247
|
}
|
|
1230
|
-
return (t, n) =>
|
|
1248
|
+
return (t, n) => be((P(), O("input", {
|
|
1231
1249
|
"onUpdate:modelValue": n[0] ||= (e) => i.value = e,
|
|
1232
|
-
class:
|
|
1250
|
+
class: N(["cn-field cn-field--number", z(X)]),
|
|
1233
1251
|
type: "number",
|
|
1234
1252
|
"aria-label": e.field.label,
|
|
1235
1253
|
min: e.field.min,
|
|
@@ -1239,9 +1257,9 @@ var Dt = ["value", "placeholder"], Q = /* @__PURE__ */ M({
|
|
|
1239
1257
|
onFocus: n[1] ||= (e) => a.value = !0,
|
|
1240
1258
|
onBlur: l,
|
|
1241
1259
|
onChange: l
|
|
1242
|
-
}, null, 42,
|
|
1260
|
+
}, null, 42, zt)), [[_e, i.value]]);
|
|
1243
1261
|
}
|
|
1244
|
-
}),
|
|
1262
|
+
}), Bt = { class: "cn-padding flex w-full min-w-0 items-center gap-1.5" }, Vt = { class: "w-5 shrink-0 select-none text-[10px] leading-none text-cn-muted" }, Ht = /* @__PURE__ */ j({
|
|
1245
1263
|
__name: "PaddingField",
|
|
1246
1264
|
props: {
|
|
1247
1265
|
field: {},
|
|
@@ -1249,7 +1267,7 @@ var Dt = ["value", "placeholder"], Q = /* @__PURE__ */ M({
|
|
|
1249
1267
|
},
|
|
1250
1268
|
emits: ["input", "change"],
|
|
1251
1269
|
setup(e, { emit: t }) {
|
|
1252
|
-
let n = e, r = t, { mode: i, cycle: a } =
|
|
1270
|
+
let n = e, r = t, { mode: i, cycle: a } = it(() => n.modelValue, Qe), o = T(() => Xe[i.value]);
|
|
1253
1271
|
function s(e) {
|
|
1254
1272
|
return {
|
|
1255
1273
|
key: ["padding", e.rep],
|
|
@@ -1265,18 +1283,18 @@ var Dt = ["value", "placeholder"], Q = /* @__PURE__ */ M({
|
|
|
1265
1283
|
function l() {
|
|
1266
1284
|
let { from: e, to: t } = a();
|
|
1267
1285
|
if (t < e) {
|
|
1268
|
-
let e =
|
|
1269
|
-
|
|
1286
|
+
let e = $e(n.modelValue, t);
|
|
1287
|
+
et(e, n.modelValue) || r("change", e);
|
|
1270
1288
|
}
|
|
1271
1289
|
}
|
|
1272
|
-
return (t, n) => (
|
|
1273
|
-
mode:
|
|
1290
|
+
return (t, n) => (P(), O("span", Bt, [A(dt, {
|
|
1291
|
+
mode: z(i),
|
|
1274
1292
|
label: "内边距",
|
|
1275
1293
|
onCycle: l
|
|
1276
|
-
}, null, 8, ["mode"]),
|
|
1294
|
+
}, null, 8, ["mode"]), k("span", { class: N(["grid min-w-0 flex-1 gap-1.5", z(i) === 1 ? "grid-cols-1" : "grid-cols-2"]) }, [(P(!0), O(w, null, I(o.value, (t) => (P(), O("label", {
|
|
1277
1295
|
key: t.rep,
|
|
1278
1296
|
class: "flex min-w-0 items-center gap-1.5"
|
|
1279
|
-
}, [
|
|
1297
|
+
}, [k("span", Vt, R(t.label), 1), A($, {
|
|
1280
1298
|
class: "min-w-0 flex-1",
|
|
1281
1299
|
field: s(t),
|
|
1282
1300
|
"model-value": e.modelValue[t.rep],
|
|
@@ -1289,16 +1307,16 @@ var Dt = ["value", "placeholder"], Q = /* @__PURE__ */ M({
|
|
|
1289
1307
|
"onChange"
|
|
1290
1308
|
])]))), 128))], 2)]));
|
|
1291
1309
|
}
|
|
1292
|
-
}),
|
|
1310
|
+
}), Ut = { class: "grid w-full min-w-0 grid-cols-2 gap-1" }, Wt = ["title"], Gt = { class: "w-3.5 shrink-0 select-none text-[10px] leading-none text-cn-muted" }, Kt = [
|
|
1293
1311
|
"aria-pressed",
|
|
1294
1312
|
"title",
|
|
1295
1313
|
"onClick"
|
|
1296
|
-
],
|
|
1314
|
+
], qt = [
|
|
1297
1315
|
"aria-label",
|
|
1298
1316
|
"value",
|
|
1299
1317
|
"placeholder",
|
|
1300
1318
|
"title"
|
|
1301
|
-
],
|
|
1319
|
+
], Jt = /* @__PURE__ */ j({
|
|
1302
1320
|
__name: "PairField",
|
|
1303
1321
|
props: {
|
|
1304
1322
|
field: {},
|
|
@@ -1311,7 +1329,7 @@ var Dt = ["value", "placeholder"], Q = /* @__PURE__ */ M({
|
|
|
1311
1329
|
"sub-commit"
|
|
1312
1330
|
],
|
|
1313
1331
|
setup(e, { emit: t }) {
|
|
1314
|
-
let n = e, r = t, i =
|
|
1332
|
+
let n = e, r = t, i = T(() => n.field.items ?? []);
|
|
1315
1333
|
function a(e) {
|
|
1316
1334
|
if (!e.auto) return !1;
|
|
1317
1335
|
let t = q(n.modelValue, e.auto.key);
|
|
@@ -1320,7 +1338,7 @@ var Dt = ["value", "placeholder"], Q = /* @__PURE__ */ M({
|
|
|
1320
1338
|
function o(e) {
|
|
1321
1339
|
return {
|
|
1322
1340
|
...e,
|
|
1323
|
-
key:
|
|
1341
|
+
key: G(n.field, e)
|
|
1324
1342
|
};
|
|
1325
1343
|
}
|
|
1326
1344
|
function s(e) {
|
|
@@ -1341,7 +1359,7 @@ var Dt = ["value", "placeholder"], Q = /* @__PURE__ */ M({
|
|
|
1341
1359
|
return t.ok && typeof t.value == "number" ? t.value : 0;
|
|
1342
1360
|
}
|
|
1343
1361
|
function d(e) {
|
|
1344
|
-
return n.displays?.[
|
|
1362
|
+
return n.displays?.[G(n.field, e).join(".")];
|
|
1345
1363
|
}
|
|
1346
1364
|
function f(e) {
|
|
1347
1365
|
let t = d(e);
|
|
@@ -1354,30 +1372,30 @@ var Dt = ["value", "placeholder"], Q = /* @__PURE__ */ M({
|
|
|
1354
1372
|
let t = d(e);
|
|
1355
1373
|
return t?.preview ? "模板子树:预览盒尺寸(随行实例变化,非文档声明值)" : t === void 0 ? `${e.label}自适应:已开启` : `${e.label}自适应:布局解析值(与画布选择框同源)`;
|
|
1356
1374
|
}
|
|
1357
|
-
return (e, t) => (
|
|
1375
|
+
return (e, t) => (P(), O("span", Ut, [(P(!0), O(w, null, I(i.value, (e) => (P(), O("label", {
|
|
1358
1376
|
key: e.key.join("."),
|
|
1359
1377
|
class: "flex min-w-0 items-center gap-1",
|
|
1360
1378
|
title: e.auto ? void 0 : e.label
|
|
1361
1379
|
}, [
|
|
1362
|
-
|
|
1363
|
-
e.auto ? (
|
|
1380
|
+
k("span", Gt, R(e.label), 1),
|
|
1381
|
+
e.auto ? (P(), O("button", {
|
|
1364
1382
|
key: 0,
|
|
1365
1383
|
type: "button",
|
|
1366
|
-
class:
|
|
1384
|
+
class: N(["cn-props__auto-toggle shrink-0", { "cn-props__auto-toggle--active": a(e) }]),
|
|
1367
1385
|
"aria-pressed": a(e),
|
|
1368
1386
|
title: p(e),
|
|
1369
|
-
onClick:
|
|
1370
|
-
}, "自", 10,
|
|
1371
|
-
a(e) ? (
|
|
1387
|
+
onClick: V((t) => l(e), ["prevent"])
|
|
1388
|
+
}, "自", 10, Kt)) : D("", !0),
|
|
1389
|
+
a(e) ? (P(), O("input", {
|
|
1372
1390
|
key: 2,
|
|
1373
|
-
class:
|
|
1391
|
+
class: N(["cn-field cn-field--number min-w-0 flex-1", [z(X), d(e)?.preview ? "cn-field--preview" : ""]]),
|
|
1374
1392
|
type: "number",
|
|
1375
1393
|
disabled: "",
|
|
1376
1394
|
"aria-label": e.label,
|
|
1377
1395
|
value: f(e),
|
|
1378
1396
|
placeholder: e.auto?.placeholder ?? "",
|
|
1379
1397
|
title: m(e)
|
|
1380
|
-
}, null, 10,
|
|
1398
|
+
}, null, 10, qt)) : (P(), E($, {
|
|
1381
1399
|
key: 1,
|
|
1382
1400
|
class: "min-w-0 flex-1",
|
|
1383
1401
|
field: e,
|
|
@@ -1390,9 +1408,38 @@ var Dt = ["value", "placeholder"], Q = /* @__PURE__ */ M({
|
|
|
1390
1408
|
"onInput",
|
|
1391
1409
|
"onChange"
|
|
1392
1410
|
]))
|
|
1393
|
-
], 8,
|
|
1411
|
+
], 8, Wt))), 128))]));
|
|
1394
1412
|
}
|
|
1395
|
-
}),
|
|
1413
|
+
}), Yt = /* @__PURE__ */ j({
|
|
1414
|
+
__name: "RowsPathField",
|
|
1415
|
+
props: {
|
|
1416
|
+
field: {},
|
|
1417
|
+
modelValue: {},
|
|
1418
|
+
source: { type: [Function, null] },
|
|
1419
|
+
disabled: { type: Boolean }
|
|
1420
|
+
},
|
|
1421
|
+
emits: ["input", "change"],
|
|
1422
|
+
setup(e, { emit: t }) {
|
|
1423
|
+
let n = t;
|
|
1424
|
+
function r(e) {
|
|
1425
|
+
n("input", e), n("change", e);
|
|
1426
|
+
}
|
|
1427
|
+
return (t, n) => (P(), E(y, {
|
|
1428
|
+
mode: "rowsPath",
|
|
1429
|
+
"model-value": e.modelValue,
|
|
1430
|
+
source: e.source ?? null,
|
|
1431
|
+
disabled: e.disabled,
|
|
1432
|
+
"aria-label": e.field.label,
|
|
1433
|
+
placeholder: "未选择行路径",
|
|
1434
|
+
"onUpdate:modelValue": r
|
|
1435
|
+
}, null, 8, [
|
|
1436
|
+
"model-value",
|
|
1437
|
+
"source",
|
|
1438
|
+
"disabled",
|
|
1439
|
+
"aria-label"
|
|
1440
|
+
]));
|
|
1441
|
+
}
|
|
1442
|
+
}), Xt = ["value"], Zt = ["value"], Qt = /* @__PURE__ */ j({
|
|
1396
1443
|
__name: "SelectField",
|
|
1397
1444
|
props: {
|
|
1398
1445
|
field: {},
|
|
@@ -1404,16 +1451,16 @@ var Dt = ["value", "placeholder"], Q = /* @__PURE__ */ M({
|
|
|
1404
1451
|
function r(e) {
|
|
1405
1452
|
n("change", e.target.value);
|
|
1406
1453
|
}
|
|
1407
|
-
return (t, n) => (
|
|
1454
|
+
return (t, n) => (P(), O("select", {
|
|
1408
1455
|
class: "cn-select h-7 w-full min-w-0 flex-1 cursor-pointer appearance-none rounded-md border border-cn-field-line bg-cn-field py-0 pl-2 pr-6 text-[11px] leading-none text-cn-fg outline-none transition-[border-color,box-shadow] duration-100 hover:border-cn-muted/40 focus:border-cn-accent/70 focus:ring-[3px] focus:ring-cn-accent/15 disabled:cursor-not-allowed disabled:opacity-40",
|
|
1409
1456
|
value: e.modelValue,
|
|
1410
1457
|
onChange: r
|
|
1411
|
-
}, [(
|
|
1458
|
+
}, [(P(!0), O(w, null, I(e.field.domain ?? [], (e) => (P(), O("option", {
|
|
1412
1459
|
key: e,
|
|
1413
1460
|
value: e
|
|
1414
|
-
},
|
|
1461
|
+
}, R(e), 9, Zt))), 128))], 40, Xt));
|
|
1415
1462
|
}
|
|
1416
|
-
}),
|
|
1463
|
+
}), $t = ["value", "disabled"], en = /* @__PURE__ */ j({
|
|
1417
1464
|
__name: "TextareaField",
|
|
1418
1465
|
props: {
|
|
1419
1466
|
field: {},
|
|
@@ -1436,8 +1483,8 @@ var Dt = ["value", "placeholder"], Q = /* @__PURE__ */ M({
|
|
|
1436
1483
|
function s(e) {
|
|
1437
1484
|
r = !1, n("change", e.target.value);
|
|
1438
1485
|
}
|
|
1439
|
-
return (t, n) => (
|
|
1440
|
-
class:
|
|
1486
|
+
return (t, n) => (P(), O("textarea", {
|
|
1487
|
+
class: N(["cn-field", z(ot)]),
|
|
1441
1488
|
rows: "3",
|
|
1442
1489
|
value: e.modelValue,
|
|
1443
1490
|
disabled: e.disabled,
|
|
@@ -1445,67 +1492,71 @@ var Dt = ["value", "placeholder"], Q = /* @__PURE__ */ M({
|
|
|
1445
1492
|
onCompositionstart: a,
|
|
1446
1493
|
onCompositionend: o,
|
|
1447
1494
|
onChange: s
|
|
1448
|
-
}, null, 42,
|
|
1495
|
+
}, null, 42, $t));
|
|
1449
1496
|
}
|
|
1450
|
-
}),
|
|
1451
|
-
number:
|
|
1452
|
-
text:
|
|
1453
|
-
textarea:
|
|
1454
|
-
color:
|
|
1455
|
-
select:
|
|
1456
|
-
boolean:
|
|
1457
|
-
pair:
|
|
1458
|
-
anchor:
|
|
1459
|
-
align:
|
|
1460
|
-
padding:
|
|
1461
|
-
border:
|
|
1462
|
-
font:
|
|
1463
|
-
imageSrc:
|
|
1464
|
-
resourceValue:
|
|
1497
|
+
}), tn = {
|
|
1498
|
+
number: M($),
|
|
1499
|
+
text: M(Q),
|
|
1500
|
+
textarea: M(en),
|
|
1501
|
+
color: M(kt),
|
|
1502
|
+
select: M(Qt),
|
|
1503
|
+
boolean: M(Ye),
|
|
1504
|
+
pair: M(Jt),
|
|
1505
|
+
anchor: M(Ke),
|
|
1506
|
+
align: M(Ie),
|
|
1507
|
+
padding: M(Ht),
|
|
1508
|
+
border: M(_t),
|
|
1509
|
+
font: M(Ct),
|
|
1510
|
+
imageSrc: M(Rt),
|
|
1511
|
+
resourceValue: M(Mt),
|
|
1512
|
+
rowsPath: M(Yt)
|
|
1465
1513
|
};
|
|
1466
1514
|
//#endregion
|
|
1467
1515
|
//#region src/property-panel/usePropertyPanel.ts
|
|
1468
|
-
function
|
|
1469
|
-
let t =
|
|
1516
|
+
function nn(e) {
|
|
1517
|
+
let t = L(e.store.doc), n = L(e.store.ui.selection), r = L(e.store.ui.anchorExpanded), i = L(e.store.ui.dataSourceSchema), a = L(e.store.ui.resourceStatuses), o = L(e.store.ui.editing), s = e.subscribe((s) => {
|
|
1470
1518
|
s.scope === "doc" ? (t.value = e.store.doc, n.value = e.store.ui.selection, a.value = e.store.ui.resourceStatuses, o.value = e.store.ui.editing) : s.scope === "ui" && (s.branch === "selection" ? (n.value = e.store.ui.selection, e.store.closeMerge()) : s.branch === "anchorExpanded" ? r.value = e.store.ui.anchorExpanded : s.branch === "dataSourceSchema" ? i.value = e.store.ui.dataSourceSchema : s.branch === "resourceStatuses" ? a.value = e.store.ui.resourceStatuses : s.branch === "editing" && (o.value = e.store.ui.editing));
|
|
1471
1519
|
});
|
|
1472
|
-
|
|
1473
|
-
let c =
|
|
1520
|
+
me(s, !0);
|
|
1521
|
+
let c = T(() => {
|
|
1474
1522
|
let e = t.value, r = n.value;
|
|
1475
1523
|
return e && r ? p(e, r) : null;
|
|
1476
|
-
}), l =
|
|
1524
|
+
}), l = T(() => t.value), u = T(() => {
|
|
1477
1525
|
let e = c.value, r = n.value;
|
|
1478
|
-
return e && r ?
|
|
1479
|
-
}), d =
|
|
1526
|
+
return e && r ? Ae(r, e) : t.value ? je : [];
|
|
1527
|
+
}), d = T(() => {
|
|
1480
1528
|
let r = n.value;
|
|
1481
1529
|
return r && t.value ? e.layerBoxAt(r) : null;
|
|
1482
|
-
}), f =
|
|
1530
|
+
}), f = T(() => {
|
|
1483
1531
|
let e = i.value;
|
|
1484
|
-
return e === null ? null :
|
|
1485
|
-
}), h =
|
|
1532
|
+
return e === null ? null : te(e, ce(e, t.value, n.value));
|
|
1533
|
+
}), h = T(() => _(t.value, n.value, i.value)), g = T(() => ee(h.value)), y = T(() => {
|
|
1534
|
+
let e = c.value;
|
|
1535
|
+
return e === null || e.type !== "TableLayer" || e.template === null ? !1 : v(h.value, e.rowsPath);
|
|
1536
|
+
}), b = T(() => n.value?.includes("template") ?? !1), x = T(() => {
|
|
1486
1537
|
let e = o.value, t = n.value;
|
|
1487
1538
|
return e !== null && t !== null && m(e.path, t);
|
|
1488
1539
|
});
|
|
1489
|
-
function
|
|
1540
|
+
function S(t) {
|
|
1490
1541
|
e.store.setAnchorExpanded(t);
|
|
1491
1542
|
}
|
|
1492
|
-
function
|
|
1543
|
+
function C(e) {
|
|
1493
1544
|
if (!e.data) return !1;
|
|
1494
|
-
if (
|
|
1545
|
+
if (x.value) return o.value?.expression === !0;
|
|
1495
1546
|
let t = c.value;
|
|
1496
1547
|
return t !== null && "expression" in t && t.expression !== null;
|
|
1497
1548
|
}
|
|
1498
|
-
function
|
|
1549
|
+
function ne(r, i, a) {
|
|
1499
1550
|
if (!t.value) return;
|
|
1500
1551
|
let o = n.value;
|
|
1501
1552
|
if (!o) {
|
|
1502
|
-
|
|
1553
|
+
ie(r, i, a);
|
|
1503
1554
|
return;
|
|
1504
1555
|
}
|
|
1505
|
-
let s =
|
|
1556
|
+
let s = oe(o, r.key);
|
|
1506
1557
|
if (r.data) {
|
|
1507
|
-
if (
|
|
1508
|
-
let t =
|
|
1558
|
+
if (C(r)) {
|
|
1559
|
+
let t = oe(o, ["data", "expression"]);
|
|
1509
1560
|
e.updateDataExpression(o, i, { mergeKey: t }), a && e.store.closeMerge(t);
|
|
1510
1561
|
return;
|
|
1511
1562
|
}
|
|
@@ -1514,45 +1565,59 @@ function Zt(e) {
|
|
|
1514
1565
|
}
|
|
1515
1566
|
e.updateSpec(o, r.key, i, { mergeKey: s }), a && e.store.closeMerge(s);
|
|
1516
1567
|
}
|
|
1517
|
-
function
|
|
1568
|
+
function re(t) {
|
|
1518
1569
|
let r = n.value;
|
|
1519
1570
|
r && t.data && e.toggleDataMode(r);
|
|
1520
1571
|
}
|
|
1521
|
-
function
|
|
1572
|
+
function ie(t, n, r) {
|
|
1522
1573
|
let i = t.key[0];
|
|
1574
|
+
if (i === "background") {
|
|
1575
|
+
ae(t, n, r);
|
|
1576
|
+
return;
|
|
1577
|
+
}
|
|
1523
1578
|
if (i !== "width" && i !== "height" || typeof n != "number") return;
|
|
1524
1579
|
let a = `canvas:${i}`;
|
|
1525
1580
|
e.updateCanvasProp(i, n, { mergeKey: a }), r && e.store.closeMerge(a);
|
|
1526
1581
|
}
|
|
1582
|
+
function ae(t, n, r) {
|
|
1583
|
+
let i = t.key[1];
|
|
1584
|
+
if (i !== "color" && i !== "image") return;
|
|
1585
|
+
let a = l.value?.background ?? K, o = typeof n == "string" && n !== "" ? n : null, s = {
|
|
1586
|
+
...a,
|
|
1587
|
+
[i]: o
|
|
1588
|
+
}, c = `canvas:background.${i}`;
|
|
1589
|
+
e.updateCanvasProp("background", s, { mergeKey: c }), r && e.store.closeMerge(c);
|
|
1590
|
+
}
|
|
1527
1591
|
return {
|
|
1528
|
-
selection:
|
|
1592
|
+
selection: T(() => n.value),
|
|
1529
1593
|
layer: c,
|
|
1530
1594
|
canvas: l,
|
|
1531
1595
|
sections: u,
|
|
1532
1596
|
layerBox: d,
|
|
1533
|
-
isPreviewBox:
|
|
1597
|
+
isPreviewBox: b,
|
|
1534
1598
|
completionSource: f,
|
|
1535
|
-
rowsPathSource:
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1599
|
+
rowsPathSource: g,
|
|
1600
|
+
rowsPathDrifted: y,
|
|
1601
|
+
resourceStatuses: T(() => a.value),
|
|
1602
|
+
anchorExpanded: T(() => r.value),
|
|
1603
|
+
contentLocked: x,
|
|
1604
|
+
editingSession: T(() => o.value),
|
|
1605
|
+
isDataMarked: C,
|
|
1606
|
+
commit: ne,
|
|
1607
|
+
toggleDataMode: re,
|
|
1608
|
+
setAnchorExpanded: S
|
|
1544
1609
|
};
|
|
1545
1610
|
}
|
|
1546
1611
|
//#endregion
|
|
1547
1612
|
//#region src/property-panel/fields/ValueTypeSegmented.vue?vue&type=script&setup=true&lang.ts
|
|
1548
|
-
var
|
|
1613
|
+
var rn = ["aria-disabled"], an = [
|
|
1549
1614
|
"aria-pressed",
|
|
1550
1615
|
"title",
|
|
1551
1616
|
"data-mode-static",
|
|
1552
1617
|
"data-mode-expression",
|
|
1553
1618
|
"disabled",
|
|
1554
1619
|
"onClick"
|
|
1555
|
-
],
|
|
1620
|
+
], on = /* @__PURE__ */ j({
|
|
1556
1621
|
__name: "ValueTypeSegmented",
|
|
1557
1622
|
props: {
|
|
1558
1623
|
mode: {},
|
|
@@ -1572,27 +1637,30 @@ var Qt = ["aria-disabled"], $t = [
|
|
|
1572
1637
|
function a(e) {
|
|
1573
1638
|
n.disabled || e !== n.mode && r("change", e);
|
|
1574
1639
|
}
|
|
1575
|
-
return (t, n) => (
|
|
1576
|
-
class:
|
|
1640
|
+
return (t, n) => (P(), O("span", {
|
|
1641
|
+
class: N(["cn-valuetype flex h-7 shrink-0 items-stretch overflow-hidden rounded-md border border-cn-field-line bg-cn-field", { "opacity-60": e.disabled }]),
|
|
1577
1642
|
role: "group",
|
|
1578
1643
|
"aria-label": "取值方式",
|
|
1579
1644
|
"aria-disabled": e.disabled ? "true" : void 0
|
|
1580
|
-
}, [(
|
|
1645
|
+
}, [(P(), O(w, null, I(i, (t, n) => k("button", {
|
|
1581
1646
|
key: t.value,
|
|
1582
1647
|
type: "button",
|
|
1583
|
-
class:
|
|
1648
|
+
class: N(["cn-valuetype__option flex items-center justify-center p-0 px-1.5 text-[10px] leading-none transition-colors duration-100 focus-visible:z-10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cn-accent/40", [n > 0 ? "border-l border-cn-field-line" : "", t.value === e.mode ? "cn-valuetype__option--active bg-cn-accent-soft text-cn-accent" : "text-cn-muted hover:text-cn-fg"]]),
|
|
1584
1649
|
"aria-pressed": t.value === e.mode,
|
|
1585
1650
|
title: t.value === e.mode ? t.title : `${t.title};点击切换`,
|
|
1586
1651
|
"data-mode-static": t.value === "static" || void 0,
|
|
1587
1652
|
"data-mode-expression": t.value === "expression" || void 0,
|
|
1588
1653
|
disabled: e.disabled,
|
|
1589
|
-
onClick:
|
|
1590
|
-
},
|
|
1654
|
+
onClick: V((e) => a(t.value), ["prevent"])
|
|
1655
|
+
}, R(t.label), 11, an)), 64))], 10, rn));
|
|
1591
1656
|
}
|
|
1592
|
-
}),
|
|
1657
|
+
}), sn = ["title"], cn = {
|
|
1593
1658
|
key: 2,
|
|
1594
1659
|
class: "cn-prop-field__hint col-span-2 block text-[11px] leading-4 text-cn-muted"
|
|
1595
|
-
},
|
|
1660
|
+
}, ln = ["title"], un = {
|
|
1661
|
+
key: 4,
|
|
1662
|
+
class: "cn-prop-field__hint col-span-2 block text-[11px] leading-4 text-cn-muted"
|
|
1663
|
+
}, dn = /* @__PURE__ */ j({
|
|
1596
1664
|
__name: "PropertyField",
|
|
1597
1665
|
props: {
|
|
1598
1666
|
field: {},
|
|
@@ -1602,7 +1670,8 @@ var Qt = ["aria-disabled"], $t = [
|
|
|
1602
1670
|
completion: { type: [Function, null] },
|
|
1603
1671
|
displays: {},
|
|
1604
1672
|
hint: {},
|
|
1605
|
-
resourceStatus: {}
|
|
1673
|
+
resourceStatus: {},
|
|
1674
|
+
drifted: { type: Boolean }
|
|
1606
1675
|
},
|
|
1607
1676
|
emits: [
|
|
1608
1677
|
"input",
|
|
@@ -1611,61 +1680,56 @@ var Qt = ["aria-disabled"], $t = [
|
|
|
1611
1680
|
"sub-commit"
|
|
1612
1681
|
],
|
|
1613
1682
|
setup(e, { emit: t }) {
|
|
1614
|
-
let n = e, r = t, i =
|
|
1683
|
+
let n = e, r = t, i = T(() => tn[n.field.control]), a = T(() => n.dataMode === "expression"), o = T(() => n.field.control === "pair" ? "cn-prop-field block" : "cn-prop-field grid grid-cols-[60px_minmax(0,1fr)] items-center gap-x-2 gap-y-1.5"), s = T(() => n.field.data === !0 ? "col-span-2" : ""), c = T(() => n.field.data === !0 && n.field.control === "textarea"), l = T(() => n.field.control === "rowsPath"), u = T(() => n.field.resource === !0 || l.value), d = F(null), f = T(() => n.field.data === !0 && a.value && typeof n.value == "string" ? n.field.resource === !0 ? n.value === "" ? [] : x(n.value) : c.value ? ne(n.value) : [] : []), p = T(() => f.value.length === 0 ? "" : n.field.resource === !0 ? le(n.completion != null) : se(f.value)), m = T(() => (n.field.resource === !0 ? a.value : l.value) && n.completion == null && f.value.length === 0 ? C : ""), h = T(() => f.value.length > 0 || l.value && n.drifted === !0), g = T(() => n.field.control === "textarea");
|
|
1615
1684
|
function _() {
|
|
1616
|
-
let e =
|
|
1685
|
+
let e = f.value[0], t = d.value?.$el;
|
|
1617
1686
|
e !== void 0 && (t instanceof HTMLTextAreaElement || t instanceof HTMLInputElement) && (t.focus(), t.setSelectionRange(e.at.start, e.at.end));
|
|
1618
1687
|
}
|
|
1619
|
-
let
|
|
1620
|
-
if (!
|
|
1621
|
-
let e =
|
|
1688
|
+
let ee = T(() => {
|
|
1689
|
+
if (!c.value) return null;
|
|
1690
|
+
let e = d.value?.$el;
|
|
1622
1691
|
return e instanceof HTMLTextAreaElement || e instanceof HTMLInputElement ? e : null;
|
|
1623
|
-
}),
|
|
1624
|
-
target:
|
|
1692
|
+
}), v = F(null), y = T(() => v.value?.rootEl ?? null), { popup: b, accept: S } = ie({
|
|
1693
|
+
target: ee,
|
|
1625
1694
|
enabled: () => c.value && a.value && n.completion != null,
|
|
1626
1695
|
pairing: () => c.value && a.value,
|
|
1627
1696
|
resolve: (e) => n.completion?.(e) ?? null,
|
|
1628
|
-
popupEl:
|
|
1629
|
-
}), { popup: ne, accept: re } = se({
|
|
1630
|
-
target: v,
|
|
1631
|
-
enabled: () => l.value && n.completion != null,
|
|
1632
|
-
resolve: (e) => n.completion?.(e) ?? null,
|
|
1633
|
-
popupEl: b
|
|
1697
|
+
popupEl: y
|
|
1634
1698
|
});
|
|
1635
|
-
function
|
|
1699
|
+
function te(e, t, n) {
|
|
1636
1700
|
r("sub-commit", e, t, n);
|
|
1637
1701
|
}
|
|
1638
|
-
return (t, n) => (
|
|
1639
|
-
default:
|
|
1640
|
-
e.field.control === "pair" ?
|
|
1702
|
+
return (t, n) => (P(), O(w, null, [(P(), E(ge(e.field.control === "pair" || e.field.control === "imageSrc" ? "div" : "label"), { class: N(o.value) }, {
|
|
1703
|
+
default: ye(() => [
|
|
1704
|
+
e.field.control === "pair" ? D("", !0) : (P(), O("span", {
|
|
1641
1705
|
key: 0,
|
|
1642
1706
|
class: "cn-prop-field__label shrink-0 select-none truncate text-[11px] leading-none text-cn-muted",
|
|
1643
1707
|
title: e.field.title
|
|
1644
|
-
},
|
|
1645
|
-
e.field.data ? (
|
|
1708
|
+
}, R(e.field.label), 9, sn)),
|
|
1709
|
+
e.field.data ? (P(), E(on, {
|
|
1646
1710
|
key: 1,
|
|
1647
1711
|
class: "justify-self-end",
|
|
1648
1712
|
mode: e.dataMode ?? "static",
|
|
1649
1713
|
disabled: e.locked,
|
|
1650
1714
|
onChange: n[0] ||= (e) => r("toggle-mode")
|
|
1651
|
-
}, null, 8, ["mode", "disabled"])) :
|
|
1652
|
-
(
|
|
1715
|
+
}, null, 8, ["mode", "disabled"])) : D("", !0),
|
|
1716
|
+
(P(), E(ge(i.value), {
|
|
1653
1717
|
ref_key: "controlRef",
|
|
1654
|
-
ref:
|
|
1655
|
-
class:
|
|
1718
|
+
ref: d,
|
|
1719
|
+
class: N(["cn-prop-field__control", [s.value, {
|
|
1656
1720
|
"cn-field--expression": a.value,
|
|
1657
|
-
"cn-field--invalid":
|
|
1721
|
+
"cn-field--invalid": h.value
|
|
1658
1722
|
}]]),
|
|
1659
1723
|
field: e.field,
|
|
1660
1724
|
"model-value": e.value,
|
|
1661
1725
|
disabled: e.locked,
|
|
1662
1726
|
displays: e.field.control === "pair" ? e.displays : void 0,
|
|
1663
1727
|
"data-mode": e.field.control === "imageSrc" || e.field.control === "resourceValue" ? e.dataMode : void 0,
|
|
1664
|
-
source:
|
|
1728
|
+
source: u.value ? e.completion : void 0,
|
|
1665
1729
|
"resource-status": e.field.control === "imageSrc" ? e.resourceStatus : void 0,
|
|
1666
1730
|
onInput: n[1] ||= (e) => r("input", e),
|
|
1667
1731
|
onChange: n[2] ||= (e) => r("change", e),
|
|
1668
|
-
onSubCommit:
|
|
1732
|
+
onSubCommit: te
|
|
1669
1733
|
}, null, 40, [
|
|
1670
1734
|
"class",
|
|
1671
1735
|
"field",
|
|
@@ -1676,49 +1740,44 @@ var Qt = ["aria-disabled"], $t = [
|
|
|
1676
1740
|
"source",
|
|
1677
1741
|
"resource-status"
|
|
1678
1742
|
])),
|
|
1679
|
-
e.hint ? (
|
|
1680
|
-
|
|
1743
|
+
e.hint ? (P(), O("span", cn, R(e.hint), 1)) : D("", !0),
|
|
1744
|
+
p.value ? (P(), O("span", {
|
|
1681
1745
|
key: 3,
|
|
1682
|
-
class:
|
|
1683
|
-
title:
|
|
1746
|
+
class: N(["cn-prop-field__hint cn-prop-field__hint--error col-span-2 block text-[11px] leading-4 text-cn-danger", { "cursor-pointer": g.value }]),
|
|
1747
|
+
title: g.value ? "点击选中出错片段" : void 0,
|
|
1684
1748
|
onClick: _
|
|
1685
|
-
},
|
|
1749
|
+
}, R(p.value), 11, ln)) : D("", !0),
|
|
1750
|
+
m.value ? (P(), O("span", un, R(m.value), 1)) : D("", !0)
|
|
1686
1751
|
]),
|
|
1687
1752
|
_: 1
|
|
1688
|
-
}, 8, ["class"])), c.value ? (
|
|
1753
|
+
}, 8, ["class"])), c.value ? (P(), E(ae, {
|
|
1689
1754
|
key: 0,
|
|
1690
1755
|
ref_key: "popupRef",
|
|
1691
|
-
ref:
|
|
1692
|
-
state:
|
|
1693
|
-
onSelect:
|
|
1694
|
-
}, null, 8, ["state", "onSelect"])) :
|
|
1695
|
-
key: 1,
|
|
1696
|
-
ref_key: "popupRef",
|
|
1697
|
-
ref: y,
|
|
1698
|
-
state: B(ne),
|
|
1699
|
-
onSelect: B(re)
|
|
1700
|
-
}, null, 8, ["state", "onSelect"])) : O("", !0)], 64));
|
|
1756
|
+
ref: v,
|
|
1757
|
+
state: z(b),
|
|
1758
|
+
onSelect: z(S)
|
|
1759
|
+
}, null, 8, ["state", "onSelect"])) : D("", !0)], 64));
|
|
1701
1760
|
}
|
|
1702
|
-
}),
|
|
1761
|
+
}), fn = { class: "cn-props flex w-[288px] shrink-0 flex-col overflow-y-auto rounded-xl border border-cn-line bg-cn-bg text-cn-fg shadow-[0_16px_40px_-12px_rgba(2,6,23,0.55)]" }, pn = { class: "sticky top-0 z-10 border-b border-cn-line bg-cn-bg-elevated/95 px-3.5 py-2.5 backdrop-blur-sm" }, mn = { class: "flex items-center gap-2" }, hn = { class: "inline-flex items-center gap-1.5 rounded border border-cn-accent/25 bg-cn-accent-soft px-1.5 py-0.5 font-mono text-[10px] leading-4 text-cn-accent" }, gn = { class: "text-[12px] font-medium tracking-wide text-cn-fg/90" }, _n = {
|
|
1703
1762
|
key: 0,
|
|
1704
1763
|
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"
|
|
1705
|
-
},
|
|
1764
|
+
}, vn = { class: "cn-props__section-title mb-2 text-[10px] font-semibold uppercase tracking-[0.16em] text-cn-muted" }, yn = { class: "flex flex-col gap-2" }, bn = "内容编辑中:请在画布编辑框内修改,退出后此处更新", xn = /* @__PURE__ */ j({
|
|
1706
1765
|
__name: "PropertyPanel",
|
|
1707
1766
|
props: { editor: {} },
|
|
1708
1767
|
setup(e) {
|
|
1709
|
-
let t = e, n =
|
|
1710
|
-
|
|
1768
|
+
let t = e, n = nn(t.editor);
|
|
1769
|
+
he(Z, {
|
|
1711
1770
|
canUpload: t.editor.canUpload,
|
|
1712
1771
|
uploadImage: (e) => t.editor.uploadImage(e)
|
|
1713
1772
|
});
|
|
1714
1773
|
function r(e) {
|
|
1715
|
-
return e.
|
|
1774
|
+
return e.control === "rowsPath" ? n.rowsPathSource.value : n.completionSource.value;
|
|
1716
1775
|
}
|
|
1717
|
-
let i =
|
|
1776
|
+
let i = T(() => n.layer.value !== null), a = T(() => {
|
|
1718
1777
|
let e = n.layer.value;
|
|
1719
1778
|
return e ? e.type : n.canvas.value ? "Canvas" : "—";
|
|
1720
|
-
}), o =
|
|
1721
|
-
let e = n.layer.value ?? (n.selection.value ? null : n.canvas.value);
|
|
1779
|
+
}), o = T(() => {
|
|
1780
|
+
let e = n.layer.value ?? (n.selection.value ? null : Me(n.canvas.value));
|
|
1722
1781
|
if (!e) return [];
|
|
1723
1782
|
let t = n.selection.value?.join(".") ?? "canvas", r = n.layer.value, i = n.resourceStatuses.value, a = [];
|
|
1724
1783
|
for (let o of n.sections.value) {
|
|
@@ -1733,8 +1792,9 @@ var Qt = ["aria-disabled"], $t = [
|
|
|
1733
1792
|
value: o.value,
|
|
1734
1793
|
dataMode: a.data ? n.isDataMarked(a) ? "expression" : "static" : void 0,
|
|
1735
1794
|
locked: c,
|
|
1736
|
-
hint: c ?
|
|
1737
|
-
resourceStatus: a.control === "imageSrc" && typeof o.value == "string" && o.value !== "" ? i[o.value] : void 0
|
|
1795
|
+
hint: c ? bn : a.hint && r ? a.hint(r, i) ?? void 0 : void 0,
|
|
1796
|
+
resourceStatus: a.control === "imageSrc" && typeof o.value == "string" && o.value !== "" ? i[o.value] : void 0,
|
|
1797
|
+
drifted: a.control === "rowsPath" ? n.rowsPathDrifted.value : void 0
|
|
1738
1798
|
});
|
|
1739
1799
|
}
|
|
1740
1800
|
s.length > 0 && a.push({
|
|
@@ -1743,14 +1803,14 @@ var Qt = ["aria-disabled"], $t = [
|
|
|
1743
1803
|
});
|
|
1744
1804
|
}
|
|
1745
1805
|
return a;
|
|
1746
|
-
}), s =
|
|
1806
|
+
}), s = T(() => {
|
|
1747
1807
|
let e = {}, t = n.layerBox.value, r = n.layer.value;
|
|
1748
1808
|
if (!t || !r) return e;
|
|
1749
1809
|
let i = /* @__PURE__ */ new Map();
|
|
1750
1810
|
if (r.shape.autoWidth && i.set("autoWidth", Math.round(t.width * 100) / 100), r.shape.autoHeight && i.set("autoHeight", Math.round(t.height * 100) / 100), i.size === 0) return e;
|
|
1751
1811
|
for (let t of n.sections.value) for (let r of t.fields) for (let t of r.items ?? []) {
|
|
1752
1812
|
let a = t.auto ? i.get(t.auto.key.join(".")) : void 0;
|
|
1753
|
-
a !== void 0 && (e[
|
|
1813
|
+
a !== void 0 && (e[G(r, t).join(".")] = {
|
|
1754
1814
|
value: a,
|
|
1755
1815
|
preview: n.isPreviewBox.value
|
|
1756
1816
|
});
|
|
@@ -1760,28 +1820,28 @@ var Qt = ["aria-disabled"], $t = [
|
|
|
1760
1820
|
function c() {
|
|
1761
1821
|
n.setAnchorExpanded(!n.anchorExpanded.value);
|
|
1762
1822
|
}
|
|
1763
|
-
return (e, t) => (
|
|
1764
|
-
|
|
1823
|
+
return (e, t) => (P(), O("aside", fn, [
|
|
1824
|
+
k("header", pn, [k("div", mn, [k("span", hn, [t[0] ||= k("i", {
|
|
1765
1825
|
class: "size-1.5 rounded-full bg-cn-accent",
|
|
1766
1826
|
"aria-hidden": "true"
|
|
1767
|
-
}, null, -1),
|
|
1768
|
-
o.value.length === 0 ? (
|
|
1769
|
-
(
|
|
1827
|
+
}, null, -1), de(" " + R(a.value), 1)]), k("span", gn, R(i.value ? "图层属性" : "画布属性"), 1)])]),
|
|
1828
|
+
o.value.length === 0 ? (P(), O("p", _n, " 打开文档后可编辑属性 ")) : D("", !0),
|
|
1829
|
+
(P(!0), O(w, null, I(o.value, (e) => (P(), O("section", {
|
|
1770
1830
|
key: e.title,
|
|
1771
1831
|
class: "cn-props__section border-b border-cn-line/70 px-3.5 py-3 last:border-b-0"
|
|
1772
|
-
}, [
|
|
1832
|
+
}, [k("h3", vn, R(e.title), 1), k("div", yn, [(P(!0), O(w, null, I(e.fields, (e) => (P(), O(w, { key: e.key }, [e.field.control === "anchor" ? (P(), E(Ke, {
|
|
1773
1833
|
key: 0,
|
|
1774
1834
|
field: e.field,
|
|
1775
1835
|
"model-value": e.value,
|
|
1776
|
-
expanded:
|
|
1777
|
-
onChange: (t) =>
|
|
1836
|
+
expanded: z(n).anchorExpanded.value,
|
|
1837
|
+
onChange: (t) => z(n).commit(e.field, t, !0),
|
|
1778
1838
|
onToggle: c
|
|
1779
1839
|
}, null, 8, [
|
|
1780
1840
|
"field",
|
|
1781
1841
|
"model-value",
|
|
1782
1842
|
"expanded",
|
|
1783
1843
|
"onChange"
|
|
1784
|
-
])) : (
|
|
1844
|
+
])) : (P(), E(dn, {
|
|
1785
1845
|
key: 1,
|
|
1786
1846
|
field: e.field,
|
|
1787
1847
|
value: e.value,
|
|
@@ -1791,10 +1851,11 @@ var Qt = ["aria-disabled"], $t = [
|
|
|
1791
1851
|
completion: r(e.field),
|
|
1792
1852
|
displays: s.value,
|
|
1793
1853
|
"resource-status": e.resourceStatus,
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1854
|
+
drifted: e.drifted,
|
|
1855
|
+
onInput: (t) => z(n).commit(e.field, t, !1),
|
|
1856
|
+
onChange: (t) => z(n).commit(e.field, t, !0),
|
|
1857
|
+
onToggleMode: (t) => z(n).toggleDataMode(e.field),
|
|
1858
|
+
onSubCommit: z(n).commit
|
|
1798
1859
|
}, null, 8, [
|
|
1799
1860
|
"field",
|
|
1800
1861
|
"value",
|
|
@@ -1804,6 +1865,7 @@ var Qt = ["aria-disabled"], $t = [
|
|
|
1804
1865
|
"completion",
|
|
1805
1866
|
"displays",
|
|
1806
1867
|
"resource-status",
|
|
1868
|
+
"drifted",
|
|
1807
1869
|
"onInput",
|
|
1808
1870
|
"onChange",
|
|
1809
1871
|
"onToggleMode",
|
|
@@ -1813,4 +1875,4 @@ var Qt = ["aria-disabled"], $t = [
|
|
|
1813
1875
|
}
|
|
1814
1876
|
});
|
|
1815
1877
|
//#endregion
|
|
1816
|
-
export { Z as a,
|
|
1878
|
+
export { Z as a, Ee as c, Oe as d, q as f, tn as i, Ae as l, dn as n, At as o, nn as r, je as s, xn as t, De as u };
|