brick-pdf 0.3.0 → 0.3.1
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/brick-pdf.js +196 -198
- package/dist/brick-pdf.umd.cjs +3 -3
- package/package.json +1 -1
package/dist/brick-pdf.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as _, openBlock as s, createElementBlock as
|
|
1
|
+
import { defineComponent as _, openBlock as s, createElementBlock as c, normalizeStyle as N, toDisplayString as w, renderSlot as Z, normalizeClass as ee, createElementVNode as m, Fragment as C, renderList as P, reactive as ze, provide as D, inject as L, toRaw as J, ref as E, computed as I, createTextVNode as ie, createCommentVNode as $, createBlock as M, resolveDynamicComponent as te, withCtx as j, onMounted as me, onBeforeUnmount as ye, unref as k, resolveComponent as Te, withDirectives as K, vModelSelect as se, createVNode as B, vModelText as De, watch as Le } from "vue";
|
|
2
2
|
import { useMagicKeys as Me, whenever as ae } from "@vueuse/core";
|
|
3
3
|
import ce from "sortablejs";
|
|
4
4
|
function ne() {
|
|
@@ -37,13 +37,13 @@ function Ve(e) {
|
|
|
37
37
|
const t = { text: e.props.text }, n = e.style;
|
|
38
38
|
return n.fontSize && (t.fontSize = n.fontSize), n.bold && (t.bold = n.bold), n.italics && (t.italics = n.italics), n.color && (t.color = n.color), n.alignment && (t.alignment = n.alignment), n.margin && (t.margin = n.margin), n.font && (t.font = n.font), n.lineHeight && (t.lineHeight = n.lineHeight), n.characterSpacing && (t.characterSpacing = n.characterSpacing), n.decoration && (t.decoration = n.decoration), n.decorationStyle && (t.decorationStyle = n.decorationStyle), n.decorationColor && (t.decorationColor = n.decorationColor), n.background && (t.background = n.background), n.link && (t.link = n.link), n.opacity !== void 0 && (t.opacity = n.opacity), t;
|
|
39
39
|
}
|
|
40
|
-
const
|
|
40
|
+
const Fe = /* @__PURE__ */ _({
|
|
41
41
|
__name: "TextRenderer",
|
|
42
42
|
props: {
|
|
43
43
|
node: {}
|
|
44
44
|
},
|
|
45
45
|
setup(e) {
|
|
46
|
-
return (t, n) => (s(),
|
|
46
|
+
return (t, n) => (s(), c("div", {
|
|
47
47
|
class: "brick-el-text",
|
|
48
48
|
style: N({
|
|
49
49
|
fontSize: (e.node.style.fontSize ?? 12) + "px",
|
|
@@ -63,13 +63,13 @@ const He = /* @__PURE__ */ _({
|
|
|
63
63
|
for (const [l, a] of t)
|
|
64
64
|
n[l] = a;
|
|
65
65
|
return n;
|
|
66
|
-
},
|
|
66
|
+
}, He = /* @__PURE__ */ x(Fe, [["__scopeId", "data-v-a7cd1565"]]), Je = { class: "brick-text-editor" }, Ue = /* @__PURE__ */ _({
|
|
67
67
|
__name: "TextPropertyEditor",
|
|
68
68
|
props: {
|
|
69
69
|
node: {}
|
|
70
70
|
},
|
|
71
71
|
setup(e) {
|
|
72
|
-
return (t, n) => (s(),
|
|
72
|
+
return (t, n) => (s(), c("div", Je));
|
|
73
73
|
}
|
|
74
74
|
}), We = {
|
|
75
75
|
type: "text",
|
|
@@ -78,7 +78,7 @@ const He = /* @__PURE__ */ _({
|
|
|
78
78
|
isContainer: !1,
|
|
79
79
|
defaultProps: Oe,
|
|
80
80
|
defaultStyle: Ae,
|
|
81
|
-
rendererComponent:
|
|
81
|
+
rendererComponent: He,
|
|
82
82
|
propertyEditorComponent: Ue,
|
|
83
83
|
propertyFields: [
|
|
84
84
|
{ key: "props.text", label: "Text Content", section: "content", type: "textarea", defaultValue: "New Text" },
|
|
@@ -125,7 +125,7 @@ const Ge = /* @__PURE__ */ _({
|
|
|
125
125
|
path: {}
|
|
126
126
|
},
|
|
127
127
|
setup(e) {
|
|
128
|
-
return (t, n) => (s(),
|
|
128
|
+
return (t, n) => (s(), c("div", {
|
|
129
129
|
class: "brick-el-stack",
|
|
130
130
|
style: N({ backgroundColor: e.node.style.fillColor })
|
|
131
131
|
}, [
|
|
@@ -138,7 +138,7 @@ const Ge = /* @__PURE__ */ _({
|
|
|
138
138
|
node: {}
|
|
139
139
|
},
|
|
140
140
|
setup(e) {
|
|
141
|
-
return (t, n) => (s(),
|
|
141
|
+
return (t, n) => (s(), c("div", Ke));
|
|
142
142
|
}
|
|
143
143
|
}), Ze = {
|
|
144
144
|
type: "stack",
|
|
@@ -176,7 +176,7 @@ const ot = /* @__PURE__ */ _({
|
|
|
176
176
|
path: {}
|
|
177
177
|
},
|
|
178
178
|
setup(e) {
|
|
179
|
-
return (t, n) => (s(),
|
|
179
|
+
return (t, n) => (s(), c("div", {
|
|
180
180
|
class: "brick-el-columns",
|
|
181
181
|
style: N({ "--column-gap": (e.node.props.columnGap ?? 10) + "px" })
|
|
182
182
|
}, [
|
|
@@ -189,7 +189,7 @@ const ot = /* @__PURE__ */ _({
|
|
|
189
189
|
node: {}
|
|
190
190
|
},
|
|
191
191
|
setup(e) {
|
|
192
|
-
return (t, n) => (s(),
|
|
192
|
+
return (t, n) => (s(), c("div", lt));
|
|
193
193
|
}
|
|
194
194
|
}), st = {
|
|
195
195
|
type: "columns",
|
|
@@ -239,23 +239,23 @@ const ut = /* @__PURE__ */ _({
|
|
|
239
239
|
node: {}
|
|
240
240
|
},
|
|
241
241
|
setup(e) {
|
|
242
|
-
return (t, n) => (s(),
|
|
242
|
+
return (t, n) => (s(), c("div", {
|
|
243
243
|
class: ee(["brick-el-table", "brick-el-table--" + (e.node.props.layout ?? "lightHorizontalLines")]),
|
|
244
244
|
style: N({ fontSize: (e.node.style.fontSize ?? 12) + "px", color: e.node.style.color })
|
|
245
245
|
}, [
|
|
246
246
|
m("table", null, [
|
|
247
247
|
m("thead", null, [
|
|
248
|
-
(s(!0),
|
|
248
|
+
(s(!0), c(C, null, P(e.node.props.body.slice(0, e.node.props.headerRows), (l, a) => (s(), c("tr", {
|
|
249
249
|
key: "h" + a
|
|
250
250
|
}, [
|
|
251
|
-
(s(!0),
|
|
251
|
+
(s(!0), c(C, null, P(l, (o, u) => (s(), c("th", { key: u }, w(o), 1))), 128))
|
|
252
252
|
]))), 128))
|
|
253
253
|
]),
|
|
254
254
|
m("tbody", null, [
|
|
255
|
-
(s(!0),
|
|
255
|
+
(s(!0), c(C, null, P(e.node.props.body.slice(e.node.props.headerRows), (l, a) => (s(), c("tr", {
|
|
256
256
|
key: "b" + a
|
|
257
257
|
}, [
|
|
258
|
-
(s(!0),
|
|
258
|
+
(s(!0), c(C, null, P(l, (o, u) => (s(), c("td", { key: u }, w(o), 1))), 128))
|
|
259
259
|
]))), 128))
|
|
260
260
|
])
|
|
261
261
|
])
|
|
@@ -280,31 +280,31 @@ function Q(e) {
|
|
|
280
280
|
}
|
|
281
281
|
function ft(e) {
|
|
282
282
|
const t = e ? de(e) : ne();
|
|
283
|
-
for (const
|
|
283
|
+
for (const d of t.content) Q(d);
|
|
284
284
|
const n = ze(t);
|
|
285
|
-
function l(
|
|
285
|
+
function l(d, r) {
|
|
286
286
|
const i = r ?? n.content;
|
|
287
287
|
for (let y = 0; y < i.length; y++) {
|
|
288
288
|
const g = i[y];
|
|
289
289
|
if (g) {
|
|
290
|
-
if (g.id ===
|
|
290
|
+
if (g.id === d)
|
|
291
291
|
return { node: g, parent: i, index: y };
|
|
292
292
|
if (g.children.length > 0) {
|
|
293
|
-
const f = l(
|
|
293
|
+
const f = l(d, g.children);
|
|
294
294
|
if (f) return f;
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
298
|
return null;
|
|
299
299
|
}
|
|
300
|
-
function a(
|
|
301
|
-
n.content.splice(0, n.content.length, ...
|
|
300
|
+
function a(d) {
|
|
301
|
+
n.content.splice(0, n.content.length, ...d);
|
|
302
302
|
}
|
|
303
303
|
function o() {
|
|
304
304
|
return JSON.parse(JSON.stringify(J(n.content)));
|
|
305
305
|
}
|
|
306
|
-
function u(
|
|
307
|
-
const r = de(
|
|
306
|
+
function u(d) {
|
|
307
|
+
const r = de(d);
|
|
308
308
|
for (const i of r.content) Q(i);
|
|
309
309
|
n.pageSize = r.pageSize, n.pageOrientation = r.pageOrientation, n.pageMargins = r.pageMargins, n.defaultStyle = r.defaultStyle, n.styles = r.styles, n.content.splice(0, n.content.length, ...r.content);
|
|
310
310
|
}
|
|
@@ -342,28 +342,28 @@ function W() {
|
|
|
342
342
|
throw new Error("useSelection() requires a BrickPdf ancestor component");
|
|
343
343
|
return e;
|
|
344
344
|
}
|
|
345
|
-
const
|
|
345
|
+
const he = /* @__PURE__ */ Symbol("brick-pdf-element-actions");
|
|
346
346
|
let bt = 0;
|
|
347
|
-
function
|
|
347
|
+
function ve() {
|
|
348
348
|
return `el-${Date.now()}-${++bt}`;
|
|
349
349
|
}
|
|
350
350
|
function _e(e) {
|
|
351
351
|
return {
|
|
352
352
|
...e,
|
|
353
|
-
id:
|
|
353
|
+
id: ve(),
|
|
354
354
|
props: structuredClone(e.props),
|
|
355
355
|
style: structuredClone(e.style),
|
|
356
356
|
children: e.children.map(_e)
|
|
357
357
|
};
|
|
358
358
|
}
|
|
359
|
-
function
|
|
360
|
-
function n(
|
|
361
|
-
const y = U(
|
|
359
|
+
function ht(e, t) {
|
|
360
|
+
function n(d, r, i) {
|
|
361
|
+
const y = U(d);
|
|
362
362
|
if (!y) return null;
|
|
363
363
|
t.record();
|
|
364
364
|
const g = {
|
|
365
|
-
id:
|
|
366
|
-
type:
|
|
365
|
+
id: ve(),
|
|
366
|
+
type: d,
|
|
367
367
|
props: y.defaultProps(),
|
|
368
368
|
style: y.defaultStyle(),
|
|
369
369
|
children: []
|
|
@@ -372,12 +372,12 @@ function vt(e, t) {
|
|
|
372
372
|
const b = i ?? f.length;
|
|
373
373
|
return f.splice(b, 0, g), g;
|
|
374
374
|
}
|
|
375
|
-
function l(
|
|
376
|
-
const r = e.findNodeById(
|
|
375
|
+
function l(d) {
|
|
376
|
+
const r = e.findNodeById(d);
|
|
377
377
|
r && (t.record(), r.parent.splice(r.index, 1));
|
|
378
378
|
}
|
|
379
|
-
function a(
|
|
380
|
-
const y = e.findNodeById(
|
|
379
|
+
function a(d, r, i) {
|
|
380
|
+
const y = e.findNodeById(d);
|
|
381
381
|
if (!y) return;
|
|
382
382
|
t.record();
|
|
383
383
|
const g = y.parent.splice(y.index, 1)[0];
|
|
@@ -385,28 +385,28 @@ function vt(e, t) {
|
|
|
385
385
|
const f = r ? e.findNodeById(r)?.node.children : e.document.content;
|
|
386
386
|
f && f.splice(i, 0, g);
|
|
387
387
|
}
|
|
388
|
-
function o(
|
|
389
|
-
const r = e.findNodeById(
|
|
388
|
+
function o(d) {
|
|
389
|
+
const r = e.findNodeById(d);
|
|
390
390
|
if (!r) return null;
|
|
391
391
|
t.record();
|
|
392
392
|
const i = _e(r.node);
|
|
393
393
|
return r.parent.splice(r.index + 1, 0, i), i;
|
|
394
394
|
}
|
|
395
|
-
function u(
|
|
396
|
-
const i = e.findNodeById(
|
|
395
|
+
function u(d, r) {
|
|
396
|
+
const i = e.findNodeById(d);
|
|
397
397
|
i && (t.record(), Object.assign(i.node.props, r));
|
|
398
398
|
}
|
|
399
|
-
function p(
|
|
400
|
-
const i = e.findNodeById(
|
|
399
|
+
function p(d, r) {
|
|
400
|
+
const i = e.findNodeById(d);
|
|
401
401
|
i && (t.record(), Object.assign(i.node.style, r));
|
|
402
402
|
}
|
|
403
403
|
return { addElement: n, removeElement: l, moveElement: a, duplicateElement: o, updateProps: u, updateStyle: p };
|
|
404
404
|
}
|
|
405
|
-
function
|
|
406
|
-
D(
|
|
405
|
+
function vt(e) {
|
|
406
|
+
D(he, e);
|
|
407
407
|
}
|
|
408
408
|
function q() {
|
|
409
|
-
const e = L(
|
|
409
|
+
const e = L(he);
|
|
410
410
|
if (!e)
|
|
411
411
|
throw new Error("useElementActions() requires a BrickPdf ancestor component");
|
|
412
412
|
return e;
|
|
@@ -427,11 +427,11 @@ function kt(e) {
|
|
|
427
427
|
const r = t.value.pop();
|
|
428
428
|
r && (n.value.push(e.snapshotContent()), e.replaceContent(r));
|
|
429
429
|
}
|
|
430
|
-
function
|
|
430
|
+
function d() {
|
|
431
431
|
const r = n.value.pop();
|
|
432
432
|
r && (t.value.push(e.snapshotContent()), e.replaceContent(r));
|
|
433
433
|
}
|
|
434
|
-
return { canUndo: a, canRedo: o, record: u, undo: p, redo:
|
|
434
|
+
return { canUndo: a, canRedo: o, record: u, undo: p, redo: d };
|
|
435
435
|
}
|
|
436
436
|
function St(e) {
|
|
437
437
|
D(ke, e);
|
|
@@ -470,7 +470,7 @@ function Ct(e, t) {
|
|
|
470
470
|
n.value = !0;
|
|
471
471
|
},
|
|
472
472
|
onAdd(p) {
|
|
473
|
-
const
|
|
473
|
+
const d = p.item, r = d.dataset.elementId, i = d.dataset.elementType, y = (g) => {
|
|
474
474
|
if (!u || !g) return !1;
|
|
475
475
|
const f = e.findNodeById(u);
|
|
476
476
|
if (!f) return !1;
|
|
@@ -478,18 +478,18 @@ function Ct(e, t) {
|
|
|
478
478
|
return !!(b?.acceptsChildTypes && !b.acceptsChildTypes.includes(g));
|
|
479
479
|
};
|
|
480
480
|
if (r) {
|
|
481
|
-
if (
|
|
481
|
+
if (d.parentNode?.removeChild(d), y(i)) return;
|
|
482
482
|
t.moveElement(r, u, p.newIndex ?? 0);
|
|
483
483
|
return;
|
|
484
484
|
}
|
|
485
|
-
i && (
|
|
485
|
+
i && (d.parentNode?.removeChild(d), !y(i) && t.addElement(i, u, p.newIndex));
|
|
486
486
|
},
|
|
487
487
|
onEnd(p) {
|
|
488
488
|
if (n.value = !1, p.from === p.to && p.oldIndex !== void 0 && p.newIndex !== void 0 && p.oldIndex !== p.newIndex && p.item.dataset.elementId) {
|
|
489
|
-
const
|
|
490
|
-
if (!
|
|
491
|
-
const r =
|
|
492
|
-
r &&
|
|
489
|
+
const d = u ? e.findNodeById(u)?.node.children : e.document.content;
|
|
490
|
+
if (!d) return;
|
|
491
|
+
const r = d.splice(p.oldIndex, 1)[0];
|
|
492
|
+
r && d.splice(p.newIndex, 0, r);
|
|
493
493
|
}
|
|
494
494
|
}
|
|
495
495
|
});
|
|
@@ -528,9 +528,9 @@ async function pe(e) {
|
|
|
528
528
|
const n = await t.arrayBuffer();
|
|
529
529
|
return Et(n);
|
|
530
530
|
}
|
|
531
|
-
let
|
|
531
|
+
let H = null;
|
|
532
532
|
function It() {
|
|
533
|
-
return
|
|
533
|
+
return H || (H = (async () => {
|
|
534
534
|
const [e, t] = await Promise.all([
|
|
535
535
|
pe(ue.regular),
|
|
536
536
|
pe(ue.bold)
|
|
@@ -550,8 +550,8 @@ function It() {
|
|
|
550
550
|
}
|
|
551
551
|
};
|
|
552
552
|
})().catch((e) => {
|
|
553
|
-
throw
|
|
554
|
-
}),
|
|
553
|
+
throw H = null, e;
|
|
554
|
+
}), H);
|
|
555
555
|
}
|
|
556
556
|
const Ce = /* @__PURE__ */ Symbol("brick-pdf-export");
|
|
557
557
|
function $t(e) {
|
|
@@ -574,10 +574,8 @@ function Rt(e) {
|
|
|
574
574
|
};
|
|
575
575
|
}
|
|
576
576
|
async function n() {
|
|
577
|
-
const o = await import("pdfmake/build/pdfmake"), u = await import("pdfmake/build/vfs_fonts"), p = o.default || o,
|
|
578
|
-
|
|
579
|
-
const r = await It();
|
|
580
|
-
return p.vfs = { ...p.vfs, ...r.vfs }, p.fonts = {
|
|
577
|
+
const o = await import("pdfmake/build/pdfmake"), u = await import("pdfmake/build/vfs_fonts"), p = o.default || o, d = u.pdfMake?.vfs ?? u.default ?? {}, r = await It();
|
|
578
|
+
return p.addVirtualFileSystem({ ...d, ...r.vfs }), p.setFonts({
|
|
581
579
|
Roboto: {
|
|
582
580
|
normal: "Roboto-Regular.ttf",
|
|
583
581
|
bold: "Roboto-Medium.ttf",
|
|
@@ -585,7 +583,7 @@ function Rt(e) {
|
|
|
585
583
|
bolditalics: "Roboto-MediumItalic.ttf"
|
|
586
584
|
},
|
|
587
585
|
...r.fonts
|
|
588
|
-
}, p;
|
|
586
|
+
}), p;
|
|
589
587
|
}
|
|
590
588
|
function l(o) {
|
|
591
589
|
const u = t();
|
|
@@ -634,13 +632,13 @@ function Lt(e, t) {
|
|
|
634
632
|
const i = e.findNodeById(r);
|
|
635
633
|
i && (n.value = structuredClone(i.node), l.value = !0, a.value = r, o.value = !0);
|
|
636
634
|
}
|
|
637
|
-
function
|
|
635
|
+
function d(r) {
|
|
638
636
|
if (!n.value) return;
|
|
639
637
|
l.value && a.value && (t.removeElement(a.value), l.value = !1, a.value = null);
|
|
640
638
|
const i = Ee(n.value), y = r ? e.findNodeById(r)?.node.children : e.document.content;
|
|
641
639
|
y && (y.push(i), l.value && (n.value = null, o.value = !1));
|
|
642
640
|
}
|
|
643
|
-
return { hasClipboard: o, copy: u, cut: p, paste:
|
|
641
|
+
return { hasClipboard: o, copy: u, cut: p, paste: d };
|
|
644
642
|
}
|
|
645
643
|
function Mt(e) {
|
|
646
644
|
D(Pe, e);
|
|
@@ -656,12 +654,12 @@ function Bt(e) {
|
|
|
656
654
|
const t = E(!1);
|
|
657
655
|
function n(l, a, o, u) {
|
|
658
656
|
t.value = !0;
|
|
659
|
-
const p = u.clientX,
|
|
657
|
+
const p = u.clientX, d = u.clientY, r = o.width, i = o.height;
|
|
660
658
|
function y(f) {
|
|
661
|
-
const b = f.clientX - p,
|
|
662
|
-
let
|
|
663
|
-
a.includes("e") && (
|
|
664
|
-
width: Math.round(
|
|
659
|
+
const b = f.clientX - p, h = f.clientY - d;
|
|
660
|
+
let v = r, S = i;
|
|
661
|
+
a.includes("e") && (v = r + b), a.includes("w") && (v = r - b), a.includes("s") && (S = i + h), a.includes("n") && (S = i - h), v = Math.max(20, v), S = Math.max(20, S), e.updateStyle(l, {
|
|
662
|
+
width: Math.round(v),
|
|
665
663
|
height: Math.round(S)
|
|
666
664
|
});
|
|
667
665
|
}
|
|
@@ -681,7 +679,7 @@ function ir() {
|
|
|
681
679
|
throw new Error("useResize() requires a BrickPdf ancestor component");
|
|
682
680
|
return e;
|
|
683
681
|
}
|
|
684
|
-
const At = { class: "brick-table-editor" }, Vt = { class: "brick-table-editor__grid" },
|
|
682
|
+
const At = { class: "brick-table-editor" }, Vt = { class: "brick-table-editor__grid" }, Ft = ["onClick"], Ht = { class: "brick-table-editor__row-header" }, Jt = ["onClick"], Ut = ["value", "onInput"], Wt = /* @__PURE__ */ _({
|
|
685
683
|
__name: "TablePropertyEditor",
|
|
686
684
|
props: {
|
|
687
685
|
node: {}
|
|
@@ -707,7 +705,7 @@ const At = { class: "brick-table-editor" }, Vt = { class: "brick-table-editor__g
|
|
|
707
705
|
if (y.length <= 1) return;
|
|
708
706
|
y.splice(i, 1), t.node.props.headerRows > y.length ? n.updateProps(t.node.id, { body: y, headerRows: y.length }) : n.updateProps(t.node.id, { body: y });
|
|
709
707
|
}
|
|
710
|
-
function
|
|
708
|
+
function d() {
|
|
711
709
|
const i = l().map((g) => [...g, ""]), y = [...a(), "*"];
|
|
712
710
|
n.updateProps(t.node.id, { body: i, widths: y });
|
|
713
711
|
}
|
|
@@ -720,7 +718,7 @@ const At = { class: "brick-table-editor" }, Vt = { class: "brick-table-editor__g
|
|
|
720
718
|
const g = [...a()];
|
|
721
719
|
g.splice(i, 1), n.updateProps(t.node.id, { body: y, widths: g });
|
|
722
720
|
}
|
|
723
|
-
return (i, y) => (s(),
|
|
721
|
+
return (i, y) => (s(), c("div", At, [
|
|
724
722
|
m("div", { class: "brick-table-editor__actions" }, [
|
|
725
723
|
m("button", {
|
|
726
724
|
class: "brick-table-editor__btn",
|
|
@@ -728,7 +726,7 @@ const At = { class: "brick-table-editor" }, Vt = { class: "brick-table-editor__g
|
|
|
728
726
|
}, "+ Row"),
|
|
729
727
|
m("button", {
|
|
730
728
|
class: "brick-table-editor__btn",
|
|
731
|
-
onClick:
|
|
729
|
+
onClick: d
|
|
732
730
|
}, "+ Column")
|
|
733
731
|
]),
|
|
734
732
|
m("div", Vt, [
|
|
@@ -736,37 +734,37 @@ const At = { class: "brick-table-editor" }, Vt = { class: "brick-table-editor__g
|
|
|
736
734
|
m("thead", null, [
|
|
737
735
|
m("tr", null, [
|
|
738
736
|
y[0] || (y[0] = m("th", { class: "brick-table-editor__corner" }, null, -1)),
|
|
739
|
-
(s(!0),
|
|
737
|
+
(s(!0), c(C, null, P(l()[0] ?? [], (g, f) => (s(), c("th", {
|
|
740
738
|
key: f,
|
|
741
739
|
class: "brick-table-editor__col-header"
|
|
742
740
|
}, [
|
|
743
741
|
ie(" Col " + w(f + 1) + " ", 1),
|
|
744
|
-
(l()[0]?.length ?? 0) > 1 ? (s(),
|
|
742
|
+
(l()[0]?.length ?? 0) > 1 ? (s(), c("button", {
|
|
745
743
|
key: 0,
|
|
746
744
|
class: "brick-table-editor__remove-btn",
|
|
747
745
|
title: "Remove column",
|
|
748
746
|
onClick: (b) => r(f)
|
|
749
|
-
}, "x", 8,
|
|
747
|
+
}, "x", 8, Ft)) : $("", !0)
|
|
750
748
|
]))), 128))
|
|
751
749
|
])
|
|
752
750
|
]),
|
|
753
751
|
m("tbody", null, [
|
|
754
|
-
(s(!0),
|
|
755
|
-
m("td",
|
|
752
|
+
(s(!0), c(C, null, P(l(), (g, f) => (s(), c("tr", { key: f }, [
|
|
753
|
+
m("td", Ht, [
|
|
756
754
|
ie(w(f + 1) + " ", 1),
|
|
757
|
-
l().length > 1 ? (s(),
|
|
755
|
+
l().length > 1 ? (s(), c("button", {
|
|
758
756
|
key: 0,
|
|
759
757
|
class: "brick-table-editor__remove-btn",
|
|
760
758
|
title: "Remove row",
|
|
761
759
|
onClick: (b) => p(f)
|
|
762
760
|
}, "x", 8, Jt)) : $("", !0)
|
|
763
761
|
]),
|
|
764
|
-
(s(!0),
|
|
762
|
+
(s(!0), c(C, null, P(g, (b, h) => (s(), c("td", { key: h }, [
|
|
765
763
|
m("input", {
|
|
766
764
|
class: "brick-table-editor__cell",
|
|
767
765
|
type: "text",
|
|
768
766
|
value: b,
|
|
769
|
-
onInput: (
|
|
767
|
+
onInput: (v) => o(f, h, v.target.value)
|
|
770
768
|
}, null, 40, Ut)
|
|
771
769
|
]))), 128))
|
|
772
770
|
]))), 128))
|
|
@@ -820,8 +818,8 @@ const Kt = { class: "brick-el-image" }, Qt = ["src"], Zt = {
|
|
|
820
818
|
node: {}
|
|
821
819
|
},
|
|
822
820
|
setup(e) {
|
|
823
|
-
return (t, n) => (s(),
|
|
824
|
-
e.node.props.src ? (s(),
|
|
821
|
+
return (t, n) => (s(), c("div", Kt, [
|
|
822
|
+
e.node.props.src ? (s(), c("img", {
|
|
825
823
|
key: 0,
|
|
826
824
|
src: e.node.props.src,
|
|
827
825
|
style: N({
|
|
@@ -830,7 +828,7 @@ const Kt = { class: "brick-el-image" }, Qt = ["src"], Zt = {
|
|
|
830
828
|
objectFit: "contain",
|
|
831
829
|
opacity: e.node.style.opacity
|
|
832
830
|
})
|
|
833
|
-
}, null, 12, Qt)) : (s(),
|
|
831
|
+
}, null, 12, Qt)) : (s(), c("div", Zt, " No image selected "))
|
|
834
832
|
]));
|
|
835
833
|
}
|
|
836
834
|
}), tn = /* @__PURE__ */ x(en, [["__scopeId", "data-v-38184258"]]), nn = { class: "brick-image-editor" }, on = /* @__PURE__ */ _({
|
|
@@ -839,7 +837,7 @@ const Kt = { class: "brick-el-image" }, Qt = ["src"], Zt = {
|
|
|
839
837
|
node: {}
|
|
840
838
|
},
|
|
841
839
|
setup(e) {
|
|
842
|
-
return (t, n) => (s(),
|
|
840
|
+
return (t, n) => (s(), c("div", nn));
|
|
843
841
|
}
|
|
844
842
|
}), rn = {
|
|
845
843
|
type: "image",
|
|
@@ -880,13 +878,13 @@ const cn = /* @__PURE__ */ _({
|
|
|
880
878
|
node: {}
|
|
881
879
|
},
|
|
882
880
|
setup(e) {
|
|
883
|
-
return (t, n) => (s(),
|
|
881
|
+
return (t, n) => (s(), c("div", {
|
|
884
882
|
class: "brick-el-list",
|
|
885
883
|
style: N({ fontSize: (e.node.style.fontSize ?? 12) + "px", color: e.node.style.color })
|
|
886
884
|
}, [
|
|
887
885
|
(s(), M(te(e.node.props.ordered ? "ol" : "ul"), null, {
|
|
888
886
|
default: j(() => [
|
|
889
|
-
(s(!0),
|
|
887
|
+
(s(!0), c(C, null, P(e.node.props.items, (l, a) => (s(), c("li", { key: a }, w(l), 1))), 128))
|
|
890
888
|
]),
|
|
891
889
|
_: 1
|
|
892
890
|
}))
|
|
@@ -898,7 +896,7 @@ const cn = /* @__PURE__ */ _({
|
|
|
898
896
|
node: {}
|
|
899
897
|
},
|
|
900
898
|
setup(e) {
|
|
901
|
-
return (t, n) => (s(),
|
|
899
|
+
return (t, n) => (s(), c("div", un));
|
|
902
900
|
}
|
|
903
901
|
}), fn = {
|
|
904
902
|
type: "list",
|
|
@@ -933,13 +931,13 @@ function gn(e) {
|
|
|
933
931
|
};
|
|
934
932
|
return e.style.alignment && (t.alignment = e.style.alignment), e.style.margin && (t.margin = e.style.margin), t;
|
|
935
933
|
}
|
|
936
|
-
const bn = { class: "brick-el-qr__preview" },
|
|
934
|
+
const bn = { class: "brick-el-qr__preview" }, hn = /* @__PURE__ */ _({
|
|
937
935
|
__name: "QrRenderer",
|
|
938
936
|
props: {
|
|
939
937
|
node: {}
|
|
940
938
|
},
|
|
941
939
|
setup(e) {
|
|
942
|
-
return (t, n) => (s(),
|
|
940
|
+
return (t, n) => (s(), c("div", {
|
|
943
941
|
class: "brick-el-qr",
|
|
944
942
|
style: N({
|
|
945
943
|
width: (e.node.props.fit ?? 100) + "px",
|
|
@@ -949,13 +947,13 @@ const bn = { class: "brick-el-qr__preview" }, vn = /* @__PURE__ */ _({
|
|
|
949
947
|
m("div", bn, "QR: " + w(e.node.props.data), 1)
|
|
950
948
|
], 4));
|
|
951
949
|
}
|
|
952
|
-
}),
|
|
950
|
+
}), vn = /* @__PURE__ */ x(hn, [["__scopeId", "data-v-f106ba48"]]), _n = { class: "brick-qr-editor" }, kn = /* @__PURE__ */ _({
|
|
953
951
|
__name: "QrPropertyEditor",
|
|
954
952
|
props: {
|
|
955
953
|
node: {}
|
|
956
954
|
},
|
|
957
955
|
setup(e) {
|
|
958
|
-
return (t, n) => (s(),
|
|
956
|
+
return (t, n) => (s(), c("div", _n));
|
|
959
957
|
}
|
|
960
958
|
}), Sn = {
|
|
961
959
|
type: "qr",
|
|
@@ -964,7 +962,7 @@ const bn = { class: "brick-el-qr__preview" }, vn = /* @__PURE__ */ _({
|
|
|
964
962
|
isContainer: !1,
|
|
965
963
|
defaultProps: mn,
|
|
966
964
|
defaultStyle: yn,
|
|
967
|
-
rendererComponent:
|
|
965
|
+
rendererComponent: vn,
|
|
968
966
|
propertyEditorComponent: kn,
|
|
969
967
|
propertyFields: [
|
|
970
968
|
{ key: "props.data", label: "QR Data", section: "content", type: "text", defaultValue: "https://example.com" },
|
|
@@ -1000,7 +998,7 @@ const Pn = ["innerHTML"], En = /* @__PURE__ */ _({
|
|
|
1000
998
|
node: {}
|
|
1001
999
|
},
|
|
1002
1000
|
setup(e) {
|
|
1003
|
-
return (t, n) => (s(),
|
|
1001
|
+
return (t, n) => (s(), c("div", {
|
|
1004
1002
|
class: "brick-el-svg",
|
|
1005
1003
|
style: N({
|
|
1006
1004
|
width: e.node.props.width + "px",
|
|
@@ -1015,7 +1013,7 @@ const Pn = ["innerHTML"], En = /* @__PURE__ */ _({
|
|
|
1015
1013
|
node: {}
|
|
1016
1014
|
},
|
|
1017
1015
|
setup(e) {
|
|
1018
|
-
return (t, n) => (s(),
|
|
1016
|
+
return (t, n) => (s(), c("div", $n));
|
|
1019
1017
|
}
|
|
1020
1018
|
}), Nn = {
|
|
1021
1019
|
type: "svg",
|
|
@@ -1054,7 +1052,7 @@ const Ln = { class: "brick-el-pagebreak" }, Mn = /* @__PURE__ */ _({
|
|
|
1054
1052
|
node: {}
|
|
1055
1053
|
},
|
|
1056
1054
|
setup(e) {
|
|
1057
|
-
return (t, n) => (s(),
|
|
1055
|
+
return (t, n) => (s(), c("div", Ln, [...n[0] || (n[0] = [
|
|
1058
1056
|
m("hr", null, null, -1),
|
|
1059
1057
|
m("span", null, "Page Break", -1),
|
|
1060
1058
|
m("hr", null, null, -1)
|
|
@@ -1066,7 +1064,7 @@ const Ln = { class: "brick-el-pagebreak" }, Mn = /* @__PURE__ */ _({
|
|
|
1066
1064
|
node: {}
|
|
1067
1065
|
},
|
|
1068
1066
|
setup(e) {
|
|
1069
|
-
return (t, n) => (s(),
|
|
1067
|
+
return (t, n) => (s(), c("div", On, [...n[0] || (n[0] = [
|
|
1070
1068
|
m("p", { style: { color: "#999", "font-size": "12px" } }, "No configurable properties.", -1)
|
|
1071
1069
|
])]));
|
|
1072
1070
|
}
|
|
@@ -1083,10 +1081,10 @@ const Ln = { class: "brick-el-pagebreak" }, Mn = /* @__PURE__ */ _({
|
|
|
1083
1081
|
toPdfmake: Dn
|
|
1084
1082
|
};
|
|
1085
1083
|
let fe = !1;
|
|
1086
|
-
function
|
|
1084
|
+
function Fn() {
|
|
1087
1085
|
fe || (fe = !0, z(We), z(Ze), z(st), z(Yt), z(rn), z(fn), z(Sn), z(Nn), z(Vn));
|
|
1088
1086
|
}
|
|
1089
|
-
const
|
|
1087
|
+
const Hn = {
|
|
1090
1088
|
key: 0,
|
|
1091
1089
|
class: "brick-dropzone__empty"
|
|
1092
1090
|
}, Jn = /* @__PURE__ */ _({
|
|
@@ -1103,13 +1101,13 @@ const Fn = {
|
|
|
1103
1101
|
n.value && (l = a.initContainer(n.value, t.parentId));
|
|
1104
1102
|
}), ye(() => {
|
|
1105
1103
|
l?.destroy();
|
|
1106
|
-
}), (u, p) => (s(),
|
|
1104
|
+
}), (u, p) => (s(), c("div", {
|
|
1107
1105
|
ref_key: "el",
|
|
1108
1106
|
ref: n,
|
|
1109
1107
|
class: ee(["brick-dropzone", { "brick-dropzone--horizontal": e.layout === "horizontal", "brick-dropzone--drag-active": k(o) && e.layout === "horizontal" }])
|
|
1110
1108
|
}, [
|
|
1111
1109
|
Z(u.$slots, "default", {}, void 0, !0),
|
|
1112
|
-
u.$slots.default ? $("", !0) : (s(),
|
|
1110
|
+
u.$slots.default ? $("", !0) : (s(), c("div", Hn, " Drop elements here "))
|
|
1113
1111
|
], 2));
|
|
1114
1112
|
}
|
|
1115
1113
|
}), $e = /* @__PURE__ */ x(Jn, [["__scopeId", "data-v-b9596dad"]]), Un = ["data-element-id", "data-element-type"], Wn = {
|
|
@@ -1122,39 +1120,39 @@ const Fn = {
|
|
|
1122
1120
|
path: {}
|
|
1123
1121
|
},
|
|
1124
1122
|
setup(e) {
|
|
1125
|
-
const t = e, n = W(), l = q(), a = E(null), o = I(() => U(t.node.type)), u = I(() => n.selectedId.value === t.node.id), p = I(() => o.value ? o.value.propertyFields.some((f) => f.key === "props.width" || f.key === "style.width") : !1),
|
|
1123
|
+
const t = e, n = W(), l = q(), a = E(null), o = I(() => U(t.node.type)), u = I(() => n.selectedId.value === t.node.id), p = I(() => o.value ? o.value.propertyFields.some((f) => f.key === "props.width" || f.key === "style.width") : !1), d = I(() => o.value ? o.value.propertyFields.some((f) => f.key === "props.height" || f.key === "style.height") : !1);
|
|
1126
1124
|
function r(f) {
|
|
1127
1125
|
f.stopPropagation(), n.select(t.node.id);
|
|
1128
1126
|
}
|
|
1129
1127
|
function i(f) {
|
|
1130
1128
|
f.stopPropagation(), f.preventDefault();
|
|
1131
|
-
const b = f.clientX,
|
|
1132
|
-
function
|
|
1133
|
-
const O = R.clientX - b, T = Math.max(20,
|
|
1134
|
-
o.value?.propertyFields.some((
|
|
1129
|
+
const b = f.clientX, h = a.value?.offsetWidth ?? 200;
|
|
1130
|
+
function v(R) {
|
|
1131
|
+
const O = R.clientX - b, T = Math.max(20, h + O);
|
|
1132
|
+
o.value?.propertyFields.some((F) => F.key === "props.width") ? l.updateProps(t.node.id, { width: Math.round(T) }) : l.updateStyle(t.node.id, { width: Math.round(T) });
|
|
1135
1133
|
}
|
|
1136
1134
|
function S() {
|
|
1137
|
-
document.removeEventListener("pointermove",
|
|
1135
|
+
document.removeEventListener("pointermove", v), document.removeEventListener("pointerup", S), document.body.style.cursor = "", document.body.style.userSelect = "";
|
|
1138
1136
|
}
|
|
1139
|
-
document.body.style.cursor = "ew-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove",
|
|
1137
|
+
document.body.style.cursor = "ew-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove", v), document.addEventListener("pointerup", S);
|
|
1140
1138
|
}
|
|
1141
1139
|
function y(f) {
|
|
1142
1140
|
f.stopPropagation(), f.preventDefault();
|
|
1143
|
-
const b = f.clientY,
|
|
1144
|
-
function
|
|
1145
|
-
const O = R.clientY - b, T = Math.max(20,
|
|
1146
|
-
o.value?.propertyFields.some((
|
|
1141
|
+
const b = f.clientY, h = a.value?.offsetHeight ?? 100;
|
|
1142
|
+
function v(R) {
|
|
1143
|
+
const O = R.clientY - b, T = Math.max(20, h + O);
|
|
1144
|
+
o.value?.propertyFields.some((F) => F.key === "props.height") ? l.updateProps(t.node.id, { height: Math.round(T) }) : l.updateStyle(t.node.id, { height: Math.round(T) });
|
|
1147
1145
|
}
|
|
1148
1146
|
function S() {
|
|
1149
|
-
document.removeEventListener("pointermove",
|
|
1147
|
+
document.removeEventListener("pointermove", v), document.removeEventListener("pointerup", S), document.body.style.cursor = "", document.body.style.userSelect = "";
|
|
1150
1148
|
}
|
|
1151
|
-
document.body.style.cursor = "ns-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove",
|
|
1149
|
+
document.body.style.cursor = "ns-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove", v), document.addEventListener("pointerup", S);
|
|
1152
1150
|
}
|
|
1153
1151
|
function g(f) {
|
|
1154
1152
|
f.stopPropagation(), f.preventDefault();
|
|
1155
|
-
const b = f.clientX,
|
|
1153
|
+
const b = f.clientX, h = f.clientY, v = a.value?.offsetWidth ?? 200, S = a.value?.offsetHeight ?? 100;
|
|
1156
1154
|
function R(T) {
|
|
1157
|
-
const G = T.clientX - b,
|
|
1155
|
+
const G = T.clientX - b, F = T.clientY - h, re = Math.max(20, v + G), le = Math.max(20, S + F), Re = o.value?.propertyFields.some((X) => X.key === "props.width"), Ne = o.value?.propertyFields.some((X) => X.key === "props.height");
|
|
1158
1156
|
Re ? l.updateProps(t.node.id, { width: Math.round(re) }) : l.updateStyle(t.node.id, { width: Math.round(re) }), Ne ? l.updateProps(t.node.id, { height: Math.round(le) }) : l.updateStyle(t.node.id, { height: Math.round(le) });
|
|
1159
1157
|
}
|
|
1160
1158
|
function O() {
|
|
@@ -1163,8 +1161,8 @@ const Fn = {
|
|
|
1163
1161
|
document.body.style.cursor = "nwse-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove", R), document.addEventListener("pointerup", O);
|
|
1164
1162
|
}
|
|
1165
1163
|
return (f, b) => {
|
|
1166
|
-
const
|
|
1167
|
-
return s(),
|
|
1164
|
+
const h = Te("CanvasElement", !0);
|
|
1165
|
+
return s(), c("div", {
|
|
1168
1166
|
ref_key: "elRef",
|
|
1169
1167
|
ref: a,
|
|
1170
1168
|
class: ee(["brick-canvas-element", { "brick-canvas-element--selected": u.value }]),
|
|
@@ -1193,9 +1191,9 @@ const Fn = {
|
|
|
1193
1191
|
layout: e.node.type === "columns" ? "horizontal" : "vertical"
|
|
1194
1192
|
}, {
|
|
1195
1193
|
default: j(() => [
|
|
1196
|
-
(s(!0),
|
|
1197
|
-
key:
|
|
1198
|
-
node:
|
|
1194
|
+
(s(!0), c(C, null, P(e.node.children, (v, S) => (s(), M(h, {
|
|
1195
|
+
key: v.id,
|
|
1196
|
+
node: v,
|
|
1199
1197
|
path: [...e.path, S]
|
|
1200
1198
|
}, null, 8, ["node", "path"]))), 128))
|
|
1201
1199
|
]),
|
|
@@ -1203,19 +1201,19 @@ const Fn = {
|
|
|
1203
1201
|
}, 8, ["parent-id", "layout"])) : $("", !0)
|
|
1204
1202
|
]),
|
|
1205
1203
|
_: 1
|
|
1206
|
-
}, 8, ["node", "path"])) : (s(),
|
|
1207
|
-
u.value ? (s(),
|
|
1208
|
-
p.value ? (s(),
|
|
1204
|
+
}, 8, ["node", "path"])) : (s(), c("div", Wn, " Unknown element: " + w(e.node.type), 1)),
|
|
1205
|
+
u.value ? (s(), c(C, { key: 2 }, [
|
|
1206
|
+
p.value ? (s(), c("div", {
|
|
1209
1207
|
key: 0,
|
|
1210
1208
|
class: "brick-resize-handle brick-resize-handle--e",
|
|
1211
1209
|
onPointerdown: i
|
|
1212
1210
|
}, null, 32)) : $("", !0),
|
|
1213
|
-
|
|
1211
|
+
d.value ? (s(), c("div", {
|
|
1214
1212
|
key: 1,
|
|
1215
1213
|
class: "brick-resize-handle brick-resize-handle--s",
|
|
1216
1214
|
onPointerdown: y
|
|
1217
1215
|
}, null, 32)) : $("", !0),
|
|
1218
|
-
p.value &&
|
|
1216
|
+
p.value && d.value ? (s(), c("div", {
|
|
1219
1217
|
key: 2,
|
|
1220
1218
|
class: "brick-resize-handle brick-resize-handle--se",
|
|
1221
1219
|
onPointerdown: g
|
|
@@ -1238,13 +1236,13 @@ const Fn = {
|
|
|
1238
1236
|
const u = [...t.document.pageMargins];
|
|
1239
1237
|
u[a] = o, t.document.pageMargins = u;
|
|
1240
1238
|
}
|
|
1241
|
-
return (a, o) => (s(),
|
|
1239
|
+
return (a, o) => (s(), c("div", qn, [
|
|
1242
1240
|
m("div", Gn, [
|
|
1243
1241
|
o[3] || (o[3] = m("label", null, "Size", -1)),
|
|
1244
1242
|
K(m("select", {
|
|
1245
1243
|
"onUpdate:modelValue": o[0] || (o[0] = (u) => k(t).document.pageSize = u)
|
|
1246
1244
|
}, [
|
|
1247
|
-
(s(),
|
|
1245
|
+
(s(), c(C, null, P(n, (u) => m("option", {
|
|
1248
1246
|
key: u.value,
|
|
1249
1247
|
value: u.value
|
|
1250
1248
|
}, w(u.label), 9, Xn)), 64))
|
|
@@ -1266,13 +1264,13 @@ const Fn = {
|
|
|
1266
1264
|
m("div", Qn, [
|
|
1267
1265
|
o[6] || (o[6] = m("label", null, "Margins", -1)),
|
|
1268
1266
|
m("div", Zn, [
|
|
1269
|
-
(s(),
|
|
1267
|
+
(s(), c(C, null, P(["L", "T", "R", "B"], (u, p) => m("input", {
|
|
1270
1268
|
key: p,
|
|
1271
1269
|
type: "number",
|
|
1272
1270
|
placeholder: u,
|
|
1273
1271
|
title: u,
|
|
1274
1272
|
value: k(t).document.pageMargins[p],
|
|
1275
|
-
onInput: (
|
|
1273
|
+
onInput: (d) => l(p, Number(d.target.value))
|
|
1276
1274
|
}, null, 40, eo)), 64))
|
|
1277
1275
|
])
|
|
1278
1276
|
]),
|
|
@@ -1298,16 +1296,16 @@ const Fn = {
|
|
|
1298
1296
|
LETTER: [612, 792],
|
|
1299
1297
|
LEGAL: [612, 1008]
|
|
1300
1298
|
}, a = I(() => {
|
|
1301
|
-
const [p,
|
|
1299
|
+
const [p, d] = l[t.document.pageSize] ?? l.A4, r = t.document.pageOrientation === "landscape" ? d : p;
|
|
1302
1300
|
return Math.round(r * V);
|
|
1303
1301
|
}), o = I(() => {
|
|
1304
|
-
const [p,
|
|
1302
|
+
const [p, d] = l[t.document.pageSize] ?? l.A4, r = t.document.pageOrientation === "landscape" ? p : d;
|
|
1305
1303
|
return Math.round(r * V);
|
|
1306
1304
|
});
|
|
1307
1305
|
function u(p) {
|
|
1308
1306
|
(p.target === p.currentTarget || p.target.classList.contains("brick-canvas__page")) && n.deselect();
|
|
1309
1307
|
}
|
|
1310
|
-
return (p,
|
|
1308
|
+
return (p, d) => (s(), c("div", lo, [
|
|
1311
1309
|
B(ro),
|
|
1312
1310
|
m("div", {
|
|
1313
1311
|
class: "brick-canvas__scroll",
|
|
@@ -1326,7 +1324,7 @@ const Fn = {
|
|
|
1326
1324
|
}, [
|
|
1327
1325
|
B($e, { "parent-id": null }, {
|
|
1328
1326
|
default: j(() => [
|
|
1329
|
-
(s(!0),
|
|
1327
|
+
(s(!0), c(C, null, P(k(t).document.content, (r, i) => (s(), M(Yn, {
|
|
1330
1328
|
key: r.id,
|
|
1331
1329
|
node: r,
|
|
1332
1330
|
path: [i]
|
|
@@ -1348,12 +1346,12 @@ const Fn = {
|
|
|
1348
1346
|
t.value && (n = l.initToolbar(t.value));
|
|
1349
1347
|
}), ye(() => {
|
|
1350
1348
|
n?.destroy();
|
|
1351
|
-
}), (o, u) => (s(),
|
|
1349
|
+
}), (o, u) => (s(), c("div", {
|
|
1352
1350
|
ref_key: "el",
|
|
1353
1351
|
ref: t,
|
|
1354
1352
|
class: "brick-element-list"
|
|
1355
1353
|
}, [
|
|
1356
|
-
(s(!0),
|
|
1354
|
+
(s(!0), c(C, null, P(k(a), (p) => (s(), c("div", {
|
|
1357
1355
|
key: p.type,
|
|
1358
1356
|
class: "brick-element-list__item",
|
|
1359
1357
|
"data-element-type": p.type
|
|
@@ -1363,7 +1361,7 @@ const Fn = {
|
|
|
1363
1361
|
], 8, ao))), 128))
|
|
1364
1362
|
], 512));
|
|
1365
1363
|
}
|
|
1366
|
-
}), fo = /* @__PURE__ */ x(po, [["__scopeId", "data-v-2d0b1dbf"]]), mo = { class: "brick-field" }, yo = { class: "brick-field__label" }, go = ["value"], bo = ["value"],
|
|
1364
|
+
}), fo = /* @__PURE__ */ x(po, [["__scopeId", "data-v-2d0b1dbf"]]), mo = { class: "brick-field" }, yo = { class: "brick-field__label" }, go = ["value"], bo = ["value"], ho = ["value", "min", "max", "step"], vo = ["value"], _o = ["value"], ko = ["value"], So = {
|
|
1367
1365
|
key: 5,
|
|
1368
1366
|
class: "brick-field__toggle"
|
|
1369
1367
|
}, xo = ["checked"], Co = {
|
|
@@ -1380,49 +1378,49 @@ const Fn = {
|
|
|
1380
1378
|
},
|
|
1381
1379
|
setup(e) {
|
|
1382
1380
|
const t = e, n = q(), l = I(() => {
|
|
1383
|
-
const
|
|
1381
|
+
const d = t.descriptor.key.split("."), r = d[0], i = d[1];
|
|
1384
1382
|
if (r === "props")
|
|
1385
1383
|
return t.node.props[i];
|
|
1386
1384
|
if (r === "style")
|
|
1387
1385
|
return t.node.style[i];
|
|
1388
1386
|
}), a = I(() => {
|
|
1389
|
-
const
|
|
1390
|
-
return t.descriptor.type === "textarea" && Array.isArray(
|
|
1391
|
-
`) :
|
|
1387
|
+
const d = l.value;
|
|
1388
|
+
return t.descriptor.type === "textarea" && Array.isArray(d) ? d.join(`
|
|
1389
|
+
`) : d;
|
|
1392
1390
|
});
|
|
1393
|
-
function o(
|
|
1391
|
+
function o(d) {
|
|
1394
1392
|
const r = t.descriptor.key.split("."), i = r[0], y = r[1];
|
|
1395
|
-
let g =
|
|
1396
|
-
t.descriptor.type === "textarea" && Array.isArray(l.value) && (g =
|
|
1393
|
+
let g = d;
|
|
1394
|
+
t.descriptor.type === "textarea" && Array.isArray(l.value) && (g = d.split(`
|
|
1397
1395
|
`)), i === "props" ? n.updateProps(t.node.id, { [y]: g }) : i === "style" && n.updateStyle(t.node.id, { [y]: g });
|
|
1398
1396
|
}
|
|
1399
|
-
function u(
|
|
1397
|
+
function u(d, r) {
|
|
1400
1398
|
const y = [...a.value ?? [0, 0, 0, 0]];
|
|
1401
|
-
y[
|
|
1399
|
+
y[d] = r, o(y);
|
|
1402
1400
|
}
|
|
1403
|
-
function p(
|
|
1404
|
-
const i =
|
|
1401
|
+
function p(d) {
|
|
1402
|
+
const i = d.target.files?.[0];
|
|
1405
1403
|
if (!i) return;
|
|
1406
1404
|
const y = new FileReader();
|
|
1407
1405
|
y.onload = () => {
|
|
1408
1406
|
o(y.result);
|
|
1409
1407
|
}, y.readAsDataURL(i);
|
|
1410
1408
|
}
|
|
1411
|
-
return (
|
|
1409
|
+
return (d, r) => (s(), c("div", mo, [
|
|
1412
1410
|
m("label", yo, w(e.descriptor.label), 1),
|
|
1413
|
-
e.descriptor.type === "text" ? (s(),
|
|
1411
|
+
e.descriptor.type === "text" ? (s(), c("input", {
|
|
1414
1412
|
key: 0,
|
|
1415
1413
|
type: "text",
|
|
1416
1414
|
class: "brick-field__input",
|
|
1417
1415
|
value: a.value,
|
|
1418
1416
|
onInput: r[0] || (r[0] = (i) => o(i.target.value))
|
|
1419
|
-
}, null, 40, go)) : e.descriptor.type === "textarea" ? (s(),
|
|
1417
|
+
}, null, 40, go)) : e.descriptor.type === "textarea" ? (s(), c("textarea", {
|
|
1420
1418
|
key: 1,
|
|
1421
1419
|
class: "brick-field__textarea",
|
|
1422
1420
|
value: a.value,
|
|
1423
1421
|
rows: "3",
|
|
1424
1422
|
onInput: r[1] || (r[1] = (i) => o(i.target.value))
|
|
1425
|
-
}, null, 40, bo)) : e.descriptor.type === "number" ? (s(),
|
|
1423
|
+
}, null, 40, bo)) : e.descriptor.type === "number" ? (s(), c("input", {
|
|
1426
1424
|
key: 2,
|
|
1427
1425
|
type: "number",
|
|
1428
1426
|
class: "brick-field__input",
|
|
@@ -1431,31 +1429,31 @@ const Fn = {
|
|
|
1431
1429
|
max: e.descriptor.max,
|
|
1432
1430
|
step: e.descriptor.step,
|
|
1433
1431
|
onInput: r[2] || (r[2] = (i) => o(Number(i.target.value)))
|
|
1434
|
-
}, null, 40,
|
|
1432
|
+
}, null, 40, ho)) : e.descriptor.type === "color" ? (s(), c("input", {
|
|
1435
1433
|
key: 3,
|
|
1436
1434
|
type: "color",
|
|
1437
1435
|
class: "brick-field__color",
|
|
1438
1436
|
value: a.value ?? "#000000",
|
|
1439
1437
|
onInput: r[3] || (r[3] = (i) => o(i.target.value))
|
|
1440
|
-
}, null, 40,
|
|
1438
|
+
}, null, 40, vo)) : e.descriptor.type === "select" ? (s(), c("select", {
|
|
1441
1439
|
key: 4,
|
|
1442
1440
|
class: "brick-field__select",
|
|
1443
1441
|
value: a.value,
|
|
1444
1442
|
onChange: r[4] || (r[4] = (i) => o(i.target.value || void 0))
|
|
1445
1443
|
}, [
|
|
1446
|
-
(s(!0),
|
|
1444
|
+
(s(!0), c(C, null, P(e.descriptor.options, (i) => (s(), c("option", {
|
|
1447
1445
|
key: String(i.value),
|
|
1448
1446
|
value: i.value
|
|
1449
1447
|
}, w(i.label), 9, ko))), 128))
|
|
1450
|
-
], 40, _o)) : e.descriptor.type === "toggle" ? (s(),
|
|
1448
|
+
], 40, _o)) : e.descriptor.type === "toggle" ? (s(), c("label", So, [
|
|
1451
1449
|
m("input", {
|
|
1452
1450
|
type: "checkbox",
|
|
1453
1451
|
checked: a.value,
|
|
1454
1452
|
onChange: r[5] || (r[5] = (i) => o(i.target.checked))
|
|
1455
1453
|
}, null, 40, xo),
|
|
1456
1454
|
m("span", null, w(a.value ? "On" : "Off"), 1)
|
|
1457
|
-
])) : e.descriptor.type === "margin" ? (s(),
|
|
1458
|
-
(s(),
|
|
1455
|
+
])) : e.descriptor.type === "margin" ? (s(), c("div", Co, [
|
|
1456
|
+
(s(), c(C, null, P(["L", "T", "R", "B"], (i, y) => m("input", {
|
|
1459
1457
|
key: i,
|
|
1460
1458
|
type: "number",
|
|
1461
1459
|
class: "brick-field__margin-input",
|
|
@@ -1463,7 +1461,7 @@ const Fn = {
|
|
|
1463
1461
|
value: (a.value ?? [0, 0, 0, 0])[y],
|
|
1464
1462
|
onInput: (g) => u(y, Number(g.target.value))
|
|
1465
1463
|
}, null, 40, wo)), 64))
|
|
1466
|
-
])) : e.descriptor.type === "slider" ? (s(),
|
|
1464
|
+
])) : e.descriptor.type === "slider" ? (s(), c("div", Po, [
|
|
1467
1465
|
m("input", {
|
|
1468
1466
|
type: "range",
|
|
1469
1467
|
value: a.value,
|
|
@@ -1473,7 +1471,7 @@ const Fn = {
|
|
|
1473
1471
|
onInput: r[6] || (r[6] = (i) => o(Number(i.target.value)))
|
|
1474
1472
|
}, null, 40, Eo),
|
|
1475
1473
|
m("span", Io, w(a.value), 1)
|
|
1476
|
-
])) : e.descriptor.type === "file" ? (s(),
|
|
1474
|
+
])) : e.descriptor.type === "file" ? (s(), c("input", {
|
|
1477
1475
|
key: 8,
|
|
1478
1476
|
type: "file",
|
|
1479
1477
|
accept: "image/*",
|
|
@@ -1506,12 +1504,12 @@ const Fn = {
|
|
|
1506
1504
|
layout: "Layout",
|
|
1507
1505
|
advanced: "Advanced"
|
|
1508
1506
|
}, o = ["content", "style", "layout", "advanced"];
|
|
1509
|
-
return (u, p) => k(t).selectedNode.value && n.value ? (s(),
|
|
1507
|
+
return (u, p) => k(t).selectedNode.value && n.value ? (s(), c("div", No, [
|
|
1510
1508
|
m("div", zo, w(n.value.icon) + " " + w(n.value.label), 1),
|
|
1511
|
-
(s(),
|
|
1512
|
-
l.value[
|
|
1513
|
-
m("div", Do, w(a[
|
|
1514
|
-
(s(!0),
|
|
1509
|
+
(s(), c(C, null, P(o, (d) => (s(), c(C, { key: d }, [
|
|
1510
|
+
l.value[d] ? (s(), c("div", To, [
|
|
1511
|
+
m("div", Do, w(a[d]), 1),
|
|
1512
|
+
(s(!0), c(C, null, P(l.value[d], (r) => (s(), M(Ro, {
|
|
1515
1513
|
key: r.key,
|
|
1516
1514
|
descriptor: r,
|
|
1517
1515
|
node: k(t).selectedNode.value
|
|
@@ -1530,22 +1528,22 @@ const Fn = {
|
|
|
1530
1528
|
__name: "Toolbar",
|
|
1531
1529
|
setup(e) {
|
|
1532
1530
|
const t = W();
|
|
1533
|
-
return (n, l) => (s(),
|
|
1531
|
+
return (n, l) => (s(), c("div", Bo, [
|
|
1534
1532
|
m("div", Oo, [
|
|
1535
1533
|
l[0] || (l[0] = m("h3", { class: "brick-toolbar__title" }, "Elements", -1)),
|
|
1536
1534
|
B(fo)
|
|
1537
1535
|
]),
|
|
1538
|
-
k(t).selectedNode.value ? (s(),
|
|
1536
|
+
k(t).selectedNode.value ? (s(), c("div", Ao, [
|
|
1539
1537
|
l[1] || (l[1] = m("h3", { class: "brick-toolbar__title" }, "Properties", -1)),
|
|
1540
1538
|
B(Mo)
|
|
1541
1539
|
])) : $("", !0)
|
|
1542
1540
|
]));
|
|
1543
1541
|
}
|
|
1544
|
-
}),
|
|
1542
|
+
}), Fo = /* @__PURE__ */ x(Vo, [["__scopeId", "data-v-0174c069"]]), Ho = { class: "brick-actionbar" }, Jo = { class: "brick-actionbar__group" }, Uo = { class: "brick-actionbar__group" }, Wo = ["disabled"], jo = ["disabled"], Yo = ["disabled"], qo = { class: "brick-actionbar__group" }, Go = /* @__PURE__ */ _({
|
|
1545
1543
|
__name: "ActionBar",
|
|
1546
1544
|
setup(e) {
|
|
1547
1545
|
const t = xt(), n = zt(), l = W(), a = q(), o = oe(), u = E("document"), p = E(null);
|
|
1548
|
-
function
|
|
1546
|
+
function d() {
|
|
1549
1547
|
const f = l.selectedId.value;
|
|
1550
1548
|
f && (l.deselect(), a.removeElement(f));
|
|
1551
1549
|
}
|
|
@@ -1554,19 +1552,19 @@ const Fn = {
|
|
|
1554
1552
|
n.exportPdf(b);
|
|
1555
1553
|
}
|
|
1556
1554
|
function i() {
|
|
1557
|
-
const f = o.exportDocument(), b = JSON.stringify(f, null, 2),
|
|
1558
|
-
S.href =
|
|
1555
|
+
const f = o.exportDocument(), b = JSON.stringify(f, null, 2), h = new Blob([b], { type: "application/json" }), v = URL.createObjectURL(h), S = document.createElement("a"), R = u.value.trim() || "document";
|
|
1556
|
+
S.href = v, S.download = R.endsWith(".json") ? R : R + ".json", S.click(), URL.revokeObjectURL(v);
|
|
1559
1557
|
}
|
|
1560
1558
|
function y() {
|
|
1561
1559
|
p.value?.click();
|
|
1562
1560
|
}
|
|
1563
1561
|
function g(f) {
|
|
1564
|
-
const b = f.target,
|
|
1565
|
-
if (!
|
|
1566
|
-
const
|
|
1567
|
-
|
|
1562
|
+
const b = f.target, h = b.files?.[0];
|
|
1563
|
+
if (!h) return;
|
|
1564
|
+
const v = new FileReader();
|
|
1565
|
+
v.onload = () => {
|
|
1568
1566
|
try {
|
|
1569
|
-
const S = JSON.parse(
|
|
1567
|
+
const S = JSON.parse(v.result);
|
|
1570
1568
|
if (!S.content || !S.pageSize) {
|
|
1571
1569
|
alert("Invalid brick-pdf JSON file.");
|
|
1572
1570
|
return;
|
|
@@ -1575,12 +1573,12 @@ const Fn = {
|
|
|
1575
1573
|
} catch {
|
|
1576
1574
|
alert("Failed to parse JSON file.");
|
|
1577
1575
|
}
|
|
1578
|
-
},
|
|
1576
|
+
}, v.readAsText(h), b.value = "";
|
|
1579
1577
|
}
|
|
1580
|
-
return (f, b) => (s(),
|
|
1578
|
+
return (f, b) => (s(), c("div", Ho, [
|
|
1581
1579
|
m("div", Jo, [
|
|
1582
1580
|
K(m("input", {
|
|
1583
|
-
"onUpdate:modelValue": b[0] || (b[0] = (
|
|
1581
|
+
"onUpdate:modelValue": b[0] || (b[0] = (h) => u.value = h),
|
|
1584
1582
|
class: "brick-actionbar__name",
|
|
1585
1583
|
type: "text",
|
|
1586
1584
|
placeholder: "Document name",
|
|
@@ -1594,19 +1592,19 @@ const Fn = {
|
|
|
1594
1592
|
class: "brick-actionbar__btn",
|
|
1595
1593
|
disabled: !k(t).canUndo.value,
|
|
1596
1594
|
title: "Undo",
|
|
1597
|
-
onClick: b[1] || (b[1] = (
|
|
1595
|
+
onClick: b[1] || (b[1] = (h) => k(t).undo())
|
|
1598
1596
|
}, " Undo ", 8, Wo),
|
|
1599
1597
|
m("button", {
|
|
1600
1598
|
class: "brick-actionbar__btn",
|
|
1601
1599
|
disabled: !k(t).canRedo.value,
|
|
1602
1600
|
title: "Redo",
|
|
1603
|
-
onClick: b[2] || (b[2] = (
|
|
1601
|
+
onClick: b[2] || (b[2] = (h) => k(t).redo())
|
|
1604
1602
|
}, " Redo ", 8, jo),
|
|
1605
1603
|
m("button", {
|
|
1606
1604
|
class: "brick-actionbar__btn brick-actionbar__btn--danger",
|
|
1607
1605
|
disabled: !k(l).selectedId.value,
|
|
1608
1606
|
title: "Delete selected element",
|
|
1609
|
-
onClick:
|
|
1607
|
+
onClick: d
|
|
1610
1608
|
}, " Delete ", 8, Yo)
|
|
1611
1609
|
]),
|
|
1612
1610
|
m("div", qo, [
|
|
@@ -1626,7 +1624,7 @@ const Fn = {
|
|
|
1626
1624
|
}, " Export PDF "),
|
|
1627
1625
|
m("button", {
|
|
1628
1626
|
class: "brick-actionbar__btn",
|
|
1629
|
-
onClick: b[3] || (b[3] = (
|
|
1627
|
+
onClick: b[3] || (b[3] = (h) => k(n).openPdf())
|
|
1630
1628
|
}, " Preview ")
|
|
1631
1629
|
]),
|
|
1632
1630
|
m("input", {
|
|
@@ -1647,17 +1645,17 @@ const Fn = {
|
|
|
1647
1645
|
emits: ["update:modelValue"],
|
|
1648
1646
|
setup(e, { emit: t }) {
|
|
1649
1647
|
const n = e, l = t;
|
|
1650
|
-
|
|
1648
|
+
Fn();
|
|
1651
1649
|
const a = ft(n.modelValue ?? ne());
|
|
1652
1650
|
mt(a);
|
|
1653
1651
|
const o = yt(a);
|
|
1654
1652
|
gt(o);
|
|
1655
1653
|
const u = kt(a);
|
|
1656
1654
|
St(u);
|
|
1657
|
-
const p =
|
|
1658
|
-
|
|
1659
|
-
const
|
|
1660
|
-
wt(
|
|
1655
|
+
const p = ht(a, u);
|
|
1656
|
+
vt(p);
|
|
1657
|
+
const d = Ct(a, p);
|
|
1658
|
+
wt(d);
|
|
1661
1659
|
const r = Rt(a);
|
|
1662
1660
|
Nt(r);
|
|
1663
1661
|
const i = Lt(a, p);
|
|
@@ -1667,27 +1665,27 @@ const Fn = {
|
|
|
1667
1665
|
const g = Me(), f = g.Delete, b = g.Backspace;
|
|
1668
1666
|
return ae(f, () => {
|
|
1669
1667
|
if (!o.selectedId.value) return;
|
|
1670
|
-
const
|
|
1671
|
-
if (
|
|
1672
|
-
const
|
|
1673
|
-
o.deselect(), p.removeElement(
|
|
1668
|
+
const h = document.activeElement;
|
|
1669
|
+
if (h && (h.tagName === "INPUT" || h.tagName === "TEXTAREA" || h.tagName === "SELECT")) return;
|
|
1670
|
+
const v = o.selectedId.value;
|
|
1671
|
+
o.deselect(), p.removeElement(v);
|
|
1674
1672
|
}), ae(b, () => {
|
|
1675
1673
|
if (!o.selectedId.value) return;
|
|
1676
|
-
const
|
|
1677
|
-
if (
|
|
1678
|
-
const
|
|
1679
|
-
o.deselect(), p.removeElement(
|
|
1674
|
+
const h = document.activeElement;
|
|
1675
|
+
if (h && (h.tagName === "INPUT" || h.tagName === "TEXTAREA" || h.tagName === "SELECT")) return;
|
|
1676
|
+
const v = o.selectedId.value;
|
|
1677
|
+
o.deselect(), p.removeElement(v);
|
|
1680
1678
|
}), Le(
|
|
1681
1679
|
() => a.document,
|
|
1682
1680
|
() => {
|
|
1683
1681
|
l("update:modelValue", JSON.parse(JSON.stringify(J(a.document))));
|
|
1684
1682
|
},
|
|
1685
1683
|
{ deep: !0 }
|
|
1686
|
-
), (
|
|
1684
|
+
), (h, v) => (s(), c("div", Ko, [
|
|
1687
1685
|
B(Xo),
|
|
1688
1686
|
m("div", Qo, [
|
|
1689
1687
|
B(so),
|
|
1690
|
-
B(
|
|
1688
|
+
B(Fo)
|
|
1691
1689
|
])
|
|
1692
1690
|
]));
|
|
1693
1691
|
}
|