brick-pdf 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/brick-pdf.css +1 -1
- package/dist/brick-pdf.js +366 -423
- package/dist/brick-pdf.umd.cjs +3 -3
- package/package.json +1 -1
- package/dist/elements/canvas/CanvasDrawPropertyEditor.vue.d.ts +0 -6
- package/dist/elements/canvas/CanvasDrawRenderer.vue.d.ts +0 -6
- package/dist/elements/canvas/canvasDrawConverter.d.ts +0 -2
- package/dist/elements/canvas/canvasDrawDefaults.d.ts +0 -23
- package/dist/elements/canvas/index.d.ts +0 -2
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 d, normalizeStyle as z, toDisplayString as w, renderSlot as X, normalizeClass as K, createElementVNode as m, Fragment as C, renderList as E, reactive as Ee, provide as D, inject as L, toRaw as H, ref as P, computed as $, createTextVNode as ne, createCommentVNode as I, createBlock as M, resolveDynamicComponent as Q, withCtx as W, onMounted as se, onBeforeUnmount as ae, unref as k, resolveComponent as Pe, withDirectives as G, vModelSelect as oe, createVNode as B, vModelText as $e, watch as Ie } from "vue";
|
|
2
2
|
import { useMagicKeys as Re, whenever as re } from "@vueuse/core";
|
|
3
3
|
import le from "sortablejs";
|
|
4
4
|
function ce() {
|
|
@@ -14,25 +14,25 @@ function ce() {
|
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
const J = /* @__PURE__ */ new Map();
|
|
17
|
-
function
|
|
17
|
+
function T(e) {
|
|
18
18
|
J.set(e.type, e);
|
|
19
19
|
}
|
|
20
20
|
function F(e) {
|
|
21
21
|
return J.get(e);
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function ze() {
|
|
24
24
|
return Array.from(J.values());
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function Go(e) {
|
|
27
27
|
return J.delete(e);
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function Te() {
|
|
30
30
|
return { text: "New Text" };
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function Ne() {
|
|
33
33
|
return { fontSize: 12 };
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function De(e) {
|
|
36
36
|
const t = { text: e.props.text }, n = e.style;
|
|
37
37
|
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;
|
|
38
38
|
}
|
|
@@ -42,9 +42,9 @@ const Le = /* @__PURE__ */ _({
|
|
|
42
42
|
node: {}
|
|
43
43
|
},
|
|
44
44
|
setup(e) {
|
|
45
|
-
return (t, n) => (s(),
|
|
45
|
+
return (t, n) => (s(), d("div", {
|
|
46
46
|
class: "brick-el-text",
|
|
47
|
-
style:
|
|
47
|
+
style: z({
|
|
48
48
|
fontSize: (e.node.style.fontSize ?? 12) + "px",
|
|
49
49
|
fontWeight: e.node.style.bold ? "bold" : "normal",
|
|
50
50
|
fontStyle: e.node.style.italics ? "italic" : "normal",
|
|
@@ -59,8 +59,8 @@ const Le = /* @__PURE__ */ _({
|
|
|
59
59
|
}
|
|
60
60
|
}), S = (e, t) => {
|
|
61
61
|
const n = e.__vccOpts || e;
|
|
62
|
-
for (const [i,
|
|
63
|
-
n[i] =
|
|
62
|
+
for (const [i, c] of t)
|
|
63
|
+
n[i] = c;
|
|
64
64
|
return n;
|
|
65
65
|
}, Me = /* @__PURE__ */ S(Le, [["__scopeId", "data-v-a7cd1565"]]), Be = { class: "brick-text-editor" }, Oe = /* @__PURE__ */ _({
|
|
66
66
|
__name: "TextPropertyEditor",
|
|
@@ -68,15 +68,15 @@ const Le = /* @__PURE__ */ _({
|
|
|
68
68
|
node: {}
|
|
69
69
|
},
|
|
70
70
|
setup(e) {
|
|
71
|
-
return (t, n) => (s(),
|
|
71
|
+
return (t, n) => (s(), d("div", Be));
|
|
72
72
|
}
|
|
73
|
-
}),
|
|
73
|
+
}), Ae = {
|
|
74
74
|
type: "text",
|
|
75
75
|
label: "Text",
|
|
76
76
|
icon: "T",
|
|
77
77
|
isContainer: !1,
|
|
78
|
-
defaultProps:
|
|
79
|
-
defaultStyle:
|
|
78
|
+
defaultProps: Te,
|
|
79
|
+
defaultStyle: Ne,
|
|
80
80
|
rendererComponent: Me,
|
|
81
81
|
propertyEditorComponent: Oe,
|
|
82
82
|
propertyFields: [
|
|
@@ -103,9 +103,9 @@ const Le = /* @__PURE__ */ _({
|
|
|
103
103
|
{ key: "style.link", label: "Link URL", section: "advanced", type: "text" },
|
|
104
104
|
{ key: "style.opacity", label: "Opacity", section: "advanced", type: "slider", min: 0, max: 1, step: 0.1, defaultValue: 1 }
|
|
105
105
|
],
|
|
106
|
-
toPdfmake:
|
|
106
|
+
toPdfmake: De
|
|
107
107
|
};
|
|
108
|
-
function
|
|
108
|
+
function Ve() {
|
|
109
109
|
return {};
|
|
110
110
|
}
|
|
111
111
|
function He() {
|
|
@@ -124,9 +124,9 @@ const Ue = /* @__PURE__ */ _({
|
|
|
124
124
|
path: {}
|
|
125
125
|
},
|
|
126
126
|
setup(e) {
|
|
127
|
-
return (t, n) => (s(),
|
|
127
|
+
return (t, n) => (s(), d("div", {
|
|
128
128
|
class: "brick-el-stack",
|
|
129
|
-
style:
|
|
129
|
+
style: z({ backgroundColor: e.node.style.fillColor })
|
|
130
130
|
}, [
|
|
131
131
|
X(t.$slots, "default", {}, void 0, !0)
|
|
132
132
|
], 4));
|
|
@@ -137,15 +137,15 @@ const Ue = /* @__PURE__ */ _({
|
|
|
137
137
|
node: {}
|
|
138
138
|
},
|
|
139
139
|
setup(e) {
|
|
140
|
-
return (t, n) => (s(),
|
|
140
|
+
return (t, n) => (s(), d("div", Je));
|
|
141
141
|
}
|
|
142
|
-
}),
|
|
142
|
+
}), je = {
|
|
143
143
|
type: "stack",
|
|
144
144
|
label: "Stack",
|
|
145
145
|
icon: "☰",
|
|
146
146
|
isContainer: !0,
|
|
147
147
|
acceptsChildTypes: null,
|
|
148
|
-
defaultProps:
|
|
148
|
+
defaultProps: Ve,
|
|
149
149
|
defaultStyle: He,
|
|
150
150
|
rendererComponent: We,
|
|
151
151
|
propertyEditorComponent: Ye,
|
|
@@ -155,7 +155,7 @@ const Ue = /* @__PURE__ */ _({
|
|
|
155
155
|
],
|
|
156
156
|
toPdfmake: Fe
|
|
157
157
|
};
|
|
158
|
-
function
|
|
158
|
+
function qe() {
|
|
159
159
|
return { columnGap: 10 };
|
|
160
160
|
}
|
|
161
161
|
function Ge() {
|
|
@@ -175,9 +175,9 @@ const Ke = /* @__PURE__ */ _({
|
|
|
175
175
|
path: {}
|
|
176
176
|
},
|
|
177
177
|
setup(e) {
|
|
178
|
-
return (t, n) => (s(),
|
|
178
|
+
return (t, n) => (s(), d("div", {
|
|
179
179
|
class: "brick-el-columns",
|
|
180
|
-
style:
|
|
180
|
+
style: z({ "--column-gap": (e.node.props.columnGap ?? 10) + "px" })
|
|
181
181
|
}, [
|
|
182
182
|
X(t.$slots, "default", {}, void 0, !0)
|
|
183
183
|
], 4));
|
|
@@ -188,7 +188,7 @@ const Ke = /* @__PURE__ */ _({
|
|
|
188
188
|
node: {}
|
|
189
189
|
},
|
|
190
190
|
setup(e) {
|
|
191
|
-
return (t, n) => (s(),
|
|
191
|
+
return (t, n) => (s(), d("div", Ze));
|
|
192
192
|
}
|
|
193
193
|
}), tt = {
|
|
194
194
|
type: "columns",
|
|
@@ -196,7 +196,7 @@ const Ke = /* @__PURE__ */ _({
|
|
|
196
196
|
icon: "▥",
|
|
197
197
|
isContainer: !0,
|
|
198
198
|
acceptsChildTypes: null,
|
|
199
|
-
defaultProps:
|
|
199
|
+
defaultProps: qe,
|
|
200
200
|
defaultStyle: Ge,
|
|
201
201
|
rendererComponent: Qe,
|
|
202
202
|
propertyEditorComponent: et,
|
|
@@ -226,7 +226,7 @@ function rt(e) {
|
|
|
226
226
|
headerRows: e.props.headerRows,
|
|
227
227
|
widths: e.props.widths,
|
|
228
228
|
body: t.map(
|
|
229
|
-
(
|
|
229
|
+
(c) => c.map((o) => ({ text: o }))
|
|
230
230
|
)
|
|
231
231
|
}
|
|
232
232
|
}, i = e.props.layout;
|
|
@@ -238,23 +238,23 @@ const lt = /* @__PURE__ */ _({
|
|
|
238
238
|
node: {}
|
|
239
239
|
},
|
|
240
240
|
setup(e) {
|
|
241
|
-
return (t, n) => (s(),
|
|
241
|
+
return (t, n) => (s(), d("div", {
|
|
242
242
|
class: K(["brick-el-table", "brick-el-table--" + (e.node.props.layout ?? "lightHorizontalLines")]),
|
|
243
|
-
style:
|
|
243
|
+
style: z({ fontSize: (e.node.style.fontSize ?? 12) + "px", color: e.node.style.color })
|
|
244
244
|
}, [
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
(s(!0),
|
|
248
|
-
key: "h" +
|
|
245
|
+
m("table", null, [
|
|
246
|
+
m("thead", null, [
|
|
247
|
+
(s(!0), d(C, null, E(e.node.props.body.slice(0, e.node.props.headerRows), (i, c) => (s(), d("tr", {
|
|
248
|
+
key: "h" + c
|
|
249
249
|
}, [
|
|
250
|
-
(s(!0),
|
|
250
|
+
(s(!0), d(C, null, E(i, (o, u) => (s(), d("th", { key: u }, w(o), 1))), 128))
|
|
251
251
|
]))), 128))
|
|
252
252
|
]),
|
|
253
|
-
|
|
254
|
-
(s(!0),
|
|
255
|
-
key: "b" +
|
|
253
|
+
m("tbody", null, [
|
|
254
|
+
(s(!0), d(C, null, E(e.node.props.body.slice(e.node.props.headerRows), (i, c) => (s(), d("tr", {
|
|
255
|
+
key: "b" + c
|
|
256
256
|
}, [
|
|
257
|
-
(s(!0),
|
|
257
|
+
(s(!0), d(C, null, E(i, (o, u) => (s(), d("td", { key: u }, w(o), 1))), 128))
|
|
258
258
|
]))), 128))
|
|
259
259
|
])
|
|
260
260
|
])
|
|
@@ -262,7 +262,7 @@ const lt = /* @__PURE__ */ _({
|
|
|
262
262
|
}
|
|
263
263
|
}), it = /* @__PURE__ */ S(lt, [["__scopeId", "data-v-b863b05d"]]), de = /* @__PURE__ */ Symbol("brick-pdf-document-store");
|
|
264
264
|
function st(e) {
|
|
265
|
-
const t =
|
|
265
|
+
const t = Ee(e ?? ce());
|
|
266
266
|
function n(a, p) {
|
|
267
267
|
const r = p ?? t.content;
|
|
268
268
|
for (let l = 0; l < r.length; l++) {
|
|
@@ -281,7 +281,7 @@ function st(e) {
|
|
|
281
281
|
function i(a) {
|
|
282
282
|
t.content.splice(0, t.content.length, ...a);
|
|
283
283
|
}
|
|
284
|
-
function
|
|
284
|
+
function c() {
|
|
285
285
|
return JSON.parse(JSON.stringify(H(t.content)));
|
|
286
286
|
}
|
|
287
287
|
function o(a) {
|
|
@@ -290,10 +290,10 @@ function st(e) {
|
|
|
290
290
|
function u() {
|
|
291
291
|
return JSON.parse(JSON.stringify(H(t)));
|
|
292
292
|
}
|
|
293
|
-
return { document: t, findNodeById: n, replaceContent: i, snapshotContent:
|
|
293
|
+
return { document: t, findNodeById: n, replaceContent: i, snapshotContent: c, loadDocument: o, exportDocument: u };
|
|
294
294
|
}
|
|
295
295
|
function at(e) {
|
|
296
|
-
|
|
296
|
+
D(de, e);
|
|
297
297
|
}
|
|
298
298
|
function Z() {
|
|
299
299
|
const e = L(de);
|
|
@@ -303,17 +303,17 @@ function Z() {
|
|
|
303
303
|
}
|
|
304
304
|
const ue = /* @__PURE__ */ Symbol("brick-pdf-selection");
|
|
305
305
|
function ct(e) {
|
|
306
|
-
const t =
|
|
306
|
+
const t = P(null), n = $(() => t.value ? e.findNodeById(t.value)?.node ?? null : null);
|
|
307
307
|
function i(o) {
|
|
308
308
|
t.value = o;
|
|
309
309
|
}
|
|
310
|
-
function
|
|
310
|
+
function c() {
|
|
311
311
|
t.value = null;
|
|
312
312
|
}
|
|
313
|
-
return { selectedId: t, selectedNode: n, select: i, deselect:
|
|
313
|
+
return { selectedId: t, selectedNode: n, select: i, deselect: c };
|
|
314
314
|
}
|
|
315
315
|
function dt(e) {
|
|
316
|
-
|
|
316
|
+
D(ue, e);
|
|
317
317
|
}
|
|
318
318
|
function U() {
|
|
319
319
|
const e = L(ue);
|
|
@@ -346,23 +346,23 @@ function pt(e, t) {
|
|
|
346
346
|
props: y.defaultProps(),
|
|
347
347
|
style: y.defaultStyle(),
|
|
348
348
|
children: []
|
|
349
|
-
},
|
|
350
|
-
if (!
|
|
351
|
-
const g = l ??
|
|
352
|
-
return
|
|
349
|
+
}, f = r ? e.findNodeById(r)?.node.children : e.document.content;
|
|
350
|
+
if (!f) return null;
|
|
351
|
+
const g = l ?? f.length;
|
|
352
|
+
return f.splice(g, 0, b), b;
|
|
353
353
|
}
|
|
354
354
|
function i(p) {
|
|
355
355
|
const r = e.findNodeById(p);
|
|
356
356
|
r && (t.record(), r.parent.splice(r.index, 1));
|
|
357
357
|
}
|
|
358
|
-
function
|
|
358
|
+
function c(p, r, l) {
|
|
359
359
|
const y = e.findNodeById(p);
|
|
360
360
|
if (!y) return;
|
|
361
361
|
t.record();
|
|
362
362
|
const b = y.parent.splice(y.index, 1)[0];
|
|
363
363
|
if (!b) return;
|
|
364
|
-
const
|
|
365
|
-
|
|
364
|
+
const f = r ? e.findNodeById(r)?.node.children : e.document.content;
|
|
365
|
+
f && f.splice(l, 0, b);
|
|
366
366
|
}
|
|
367
367
|
function o(p) {
|
|
368
368
|
const r = e.findNodeById(p);
|
|
@@ -379,10 +379,10 @@ function pt(e, t) {
|
|
|
379
379
|
const l = e.findNodeById(p);
|
|
380
380
|
l && (t.record(), Object.assign(l.node.style, r));
|
|
381
381
|
}
|
|
382
|
-
return { addElement: n, removeElement: i, moveElement:
|
|
382
|
+
return { addElement: n, removeElement: i, moveElement: c, duplicateElement: o, updateProps: u, updateStyle: a };
|
|
383
383
|
}
|
|
384
384
|
function ft(e) {
|
|
385
|
-
|
|
385
|
+
D(pe, e);
|
|
386
386
|
}
|
|
387
387
|
function Y() {
|
|
388
388
|
const e = L(pe);
|
|
@@ -392,9 +392,9 @@ function Y() {
|
|
|
392
392
|
}
|
|
393
393
|
const ye = /* @__PURE__ */ Symbol("brick-pdf-history"), mt = 50;
|
|
394
394
|
function yt(e) {
|
|
395
|
-
const t =
|
|
395
|
+
const t = P([]), n = P([]);
|
|
396
396
|
let i = 0;
|
|
397
|
-
const
|
|
397
|
+
const c = $(() => t.value.length > 0), o = $(() => n.value.length > 0);
|
|
398
398
|
function u() {
|
|
399
399
|
const r = Date.now();
|
|
400
400
|
if (r - i < 100) return;
|
|
@@ -410,10 +410,10 @@ function yt(e) {
|
|
|
410
410
|
const r = n.value.pop();
|
|
411
411
|
r && (t.value.push(e.snapshotContent()), e.replaceContent(r));
|
|
412
412
|
}
|
|
413
|
-
return { canUndo:
|
|
413
|
+
return { canUndo: c, canRedo: o, record: u, undo: a, redo: p };
|
|
414
414
|
}
|
|
415
415
|
function gt(e) {
|
|
416
|
-
|
|
416
|
+
D(ye, e);
|
|
417
417
|
}
|
|
418
418
|
function bt() {
|
|
419
419
|
const e = L(ye);
|
|
@@ -423,7 +423,7 @@ function bt() {
|
|
|
423
423
|
}
|
|
424
424
|
const ge = /* @__PURE__ */ Symbol("brick-pdf-drag-drop");
|
|
425
425
|
function vt(e, t) {
|
|
426
|
-
const n =
|
|
426
|
+
const n = P(!1);
|
|
427
427
|
function i(o) {
|
|
428
428
|
return le.create(o, {
|
|
429
429
|
group: { name: "brick-elements", pull: "clone", put: !1 },
|
|
@@ -437,7 +437,7 @@ function vt(e, t) {
|
|
|
437
437
|
}
|
|
438
438
|
});
|
|
439
439
|
}
|
|
440
|
-
function
|
|
440
|
+
function c(o, u) {
|
|
441
441
|
return le.create(o, {
|
|
442
442
|
group: { name: "brick-elements", put: !0 },
|
|
443
443
|
animation: 150,
|
|
@@ -449,33 +449,34 @@ function vt(e, t) {
|
|
|
449
449
|
n.value = !0;
|
|
450
450
|
},
|
|
451
451
|
onAdd(a) {
|
|
452
|
-
const p = a.item, r = p.dataset.elementType
|
|
452
|
+
const p = a.item, r = p.dataset.elementId, l = p.dataset.elementType, y = (b) => {
|
|
453
|
+
if (!u || !b) return !1;
|
|
454
|
+
const f = e.findNodeById(u);
|
|
455
|
+
if (!f) return !1;
|
|
456
|
+
const g = F(f.node.type);
|
|
457
|
+
return !!(g?.acceptsChildTypes && !g.acceptsChildTypes.includes(b));
|
|
458
|
+
};
|
|
453
459
|
if (r) {
|
|
454
|
-
if (p.parentNode?.removeChild(p),
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
const y = F(l.node.type);
|
|
458
|
-
if (y?.acceptsChildTypes && !y.acceptsChildTypes.includes(r))
|
|
459
|
-
return;
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
t.addElement(r, u, a.newIndex);
|
|
460
|
+
if (p.parentNode?.removeChild(p), y(l)) return;
|
|
461
|
+
t.moveElement(r, u, a.newIndex ?? 0);
|
|
462
|
+
return;
|
|
463
463
|
}
|
|
464
|
+
l && (p.parentNode?.removeChild(p), !y(l) && t.addElement(l, u, a.newIndex));
|
|
464
465
|
},
|
|
465
466
|
onEnd(a) {
|
|
466
|
-
if (n.value = !1, a.from === a.to && a.oldIndex !== void 0 && a.newIndex !== void 0) {
|
|
467
|
+
if (n.value = !1, a.from === a.to && a.oldIndex !== void 0 && a.newIndex !== void 0 && a.oldIndex !== a.newIndex && a.item.dataset.elementId) {
|
|
467
468
|
const p = u ? e.findNodeById(u)?.node.children : e.document.content;
|
|
468
|
-
if (!p
|
|
469
|
+
if (!p) return;
|
|
469
470
|
const r = p.splice(a.oldIndex, 1)[0];
|
|
470
471
|
r && p.splice(a.newIndex, 0, r);
|
|
471
472
|
}
|
|
472
473
|
}
|
|
473
474
|
});
|
|
474
475
|
}
|
|
475
|
-
return { initToolbar: i, initContainer:
|
|
476
|
+
return { initToolbar: i, initContainer: c, isDragging: n };
|
|
476
477
|
}
|
|
477
478
|
function ht(e) {
|
|
478
|
-
|
|
479
|
+
D(ge, e);
|
|
479
480
|
}
|
|
480
481
|
function be() {
|
|
481
482
|
const e = L(ge);
|
|
@@ -513,16 +514,16 @@ function kt(e) {
|
|
|
513
514
|
a.createPdf(u).download(o ?? "document.pdf");
|
|
514
515
|
});
|
|
515
516
|
}
|
|
516
|
-
function
|
|
517
|
+
function c() {
|
|
517
518
|
const o = t();
|
|
518
519
|
n().then((u) => {
|
|
519
520
|
u.createPdf(o).open();
|
|
520
521
|
});
|
|
521
522
|
}
|
|
522
|
-
return { toDocumentDefinition: t, exportPdf: i, openPdf:
|
|
523
|
+
return { toDocumentDefinition: t, exportPdf: i, openPdf: c };
|
|
523
524
|
}
|
|
524
525
|
function xt(e) {
|
|
525
|
-
|
|
526
|
+
D(ve, e);
|
|
526
527
|
}
|
|
527
528
|
function St() {
|
|
528
529
|
const e = L(ve);
|
|
@@ -544,28 +545,28 @@ function ke(e) {
|
|
|
544
545
|
children: e.children.map(ke)
|
|
545
546
|
};
|
|
546
547
|
}
|
|
547
|
-
function
|
|
548
|
-
const n =
|
|
548
|
+
function Et(e, t) {
|
|
549
|
+
const n = P(null), i = P(!1), c = P(null), o = P(!1);
|
|
549
550
|
function u(r) {
|
|
550
551
|
const l = e.findNodeById(r);
|
|
551
|
-
l && (n.value = structuredClone(l.node), i.value = !1,
|
|
552
|
+
l && (n.value = structuredClone(l.node), i.value = !1, c.value = null, o.value = !0);
|
|
552
553
|
}
|
|
553
554
|
function a(r) {
|
|
554
555
|
const l = e.findNodeById(r);
|
|
555
|
-
l && (n.value = structuredClone(l.node), i.value = !0,
|
|
556
|
+
l && (n.value = structuredClone(l.node), i.value = !0, c.value = r, o.value = !0);
|
|
556
557
|
}
|
|
557
558
|
function p(r) {
|
|
558
559
|
if (!n.value) return;
|
|
559
|
-
i.value &&
|
|
560
|
+
i.value && c.value && (t.removeElement(c.value), i.value = !1, c.value = null);
|
|
560
561
|
const l = ke(n.value), y = r ? e.findNodeById(r)?.node.children : e.document.content;
|
|
561
562
|
y && (y.push(l), i.value && (n.value = null, o.value = !1));
|
|
562
563
|
}
|
|
563
564
|
return { hasClipboard: o, copy: u, cut: a, paste: p };
|
|
564
565
|
}
|
|
565
|
-
function
|
|
566
|
-
|
|
566
|
+
function Pt(e) {
|
|
567
|
+
D(_e, e);
|
|
567
568
|
}
|
|
568
|
-
function
|
|
569
|
+
function Xo() {
|
|
569
570
|
const e = L(_e);
|
|
570
571
|
if (!e)
|
|
571
572
|
throw new Error("useClipboard() requires a BrickPdf ancestor component");
|
|
@@ -573,14 +574,14 @@ function rr() {
|
|
|
573
574
|
}
|
|
574
575
|
const xe = /* @__PURE__ */ Symbol("brick-pdf-resize");
|
|
575
576
|
function $t(e) {
|
|
576
|
-
const t =
|
|
577
|
-
function n(i,
|
|
577
|
+
const t = P(!1);
|
|
578
|
+
function n(i, c, o, u) {
|
|
578
579
|
t.value = !0;
|
|
579
580
|
const a = u.clientX, p = u.clientY, r = o.width, l = o.height;
|
|
580
|
-
function y(
|
|
581
|
-
const g =
|
|
581
|
+
function y(f) {
|
|
582
|
+
const g = f.clientX - a, v = f.clientY - p;
|
|
582
583
|
let h = r, x = l;
|
|
583
|
-
|
|
584
|
+
c.includes("e") && (h = r + g), c.includes("w") && (h = r - g), c.includes("s") && (x = l + v), c.includes("n") && (x = l - v), h = Math.max(20, h), x = Math.max(20, x), e.updateStyle(i, {
|
|
584
585
|
width: Math.round(h),
|
|
585
586
|
height: Math.round(x)
|
|
586
587
|
});
|
|
@@ -593,15 +594,15 @@ function $t(e) {
|
|
|
593
594
|
return { isResizing: t, startResize: n };
|
|
594
595
|
}
|
|
595
596
|
function It(e) {
|
|
596
|
-
|
|
597
|
+
D(xe, e);
|
|
597
598
|
}
|
|
598
|
-
function
|
|
599
|
+
function Ko() {
|
|
599
600
|
const e = L(xe);
|
|
600
601
|
if (!e)
|
|
601
602
|
throw new Error("useResize() requires a BrickPdf ancestor component");
|
|
602
603
|
return e;
|
|
603
604
|
}
|
|
604
|
-
const Rt = { class: "brick-table-editor" },
|
|
605
|
+
const Rt = { class: "brick-table-editor" }, zt = { class: "brick-table-editor__grid" }, Tt = ["onClick"], Nt = { class: "brick-table-editor__row-header" }, Dt = ["onClick"], Lt = ["value", "onInput"], Mt = /* @__PURE__ */ _({
|
|
605
606
|
__name: "TablePropertyEditor",
|
|
606
607
|
props: {
|
|
607
608
|
node: {}
|
|
@@ -611,82 +612,82 @@ const Rt = { class: "brick-table-editor" }, Dt = { class: "brick-table-editor__g
|
|
|
611
612
|
function i() {
|
|
612
613
|
return t.node.props.body ?? [];
|
|
613
614
|
}
|
|
614
|
-
function
|
|
615
|
+
function c() {
|
|
615
616
|
return t.node.props.widths ?? [];
|
|
616
617
|
}
|
|
617
618
|
function o(l, y, b) {
|
|
618
|
-
const
|
|
619
|
-
|
|
619
|
+
const f = i().map((g) => [...g]);
|
|
620
|
+
f[l][y] = b, n.updateProps(t.node.id, { body: f });
|
|
620
621
|
}
|
|
621
622
|
function u() {
|
|
622
623
|
const l = i().map((b) => [...b]), y = l[0]?.length ?? 2;
|
|
623
624
|
l.push(Array(y).fill("")), n.updateProps(t.node.id, { body: l });
|
|
624
625
|
}
|
|
625
626
|
function a(l) {
|
|
626
|
-
const y = i().map((
|
|
627
|
+
const y = i().map((f) => [...f]);
|
|
627
628
|
if (y.length <= 1) return;
|
|
628
629
|
y.splice(l, 1), t.node.props.headerRows > y.length ? n.updateProps(t.node.id, { body: y, headerRows: y.length }) : n.updateProps(t.node.id, { body: y });
|
|
629
630
|
}
|
|
630
631
|
function p() {
|
|
631
|
-
const l = i().map((b) => [...b, ""]), y = [...
|
|
632
|
+
const l = i().map((b) => [...b, ""]), y = [...c(), "*"];
|
|
632
633
|
n.updateProps(t.node.id, { body: l, widths: y });
|
|
633
634
|
}
|
|
634
635
|
function r(l) {
|
|
635
|
-
const y = i().map((
|
|
636
|
-
const g = [...
|
|
636
|
+
const y = i().map((f) => {
|
|
637
|
+
const g = [...f];
|
|
637
638
|
return g.splice(l, 1), g;
|
|
638
639
|
});
|
|
639
640
|
if ((y[0]?.length ?? 0) < 1) return;
|
|
640
|
-
const b = [...
|
|
641
|
+
const b = [...c()];
|
|
641
642
|
b.splice(l, 1), n.updateProps(t.node.id, { body: y, widths: b });
|
|
642
643
|
}
|
|
643
|
-
return (l, y) => (s(),
|
|
644
|
-
|
|
645
|
-
|
|
644
|
+
return (l, y) => (s(), d("div", Rt, [
|
|
645
|
+
m("div", { class: "brick-table-editor__actions" }, [
|
|
646
|
+
m("button", {
|
|
646
647
|
class: "brick-table-editor__btn",
|
|
647
648
|
onClick: u
|
|
648
649
|
}, "+ Row"),
|
|
649
|
-
|
|
650
|
+
m("button", {
|
|
650
651
|
class: "brick-table-editor__btn",
|
|
651
652
|
onClick: p
|
|
652
653
|
}, "+ Column")
|
|
653
654
|
]),
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
y[0] || (y[0] =
|
|
659
|
-
(s(!0),
|
|
660
|
-
key:
|
|
655
|
+
m("div", zt, [
|
|
656
|
+
m("table", null, [
|
|
657
|
+
m("thead", null, [
|
|
658
|
+
m("tr", null, [
|
|
659
|
+
y[0] || (y[0] = m("th", { class: "brick-table-editor__corner" }, null, -1)),
|
|
660
|
+
(s(!0), d(C, null, E(i()[0] ?? [], (b, f) => (s(), d("th", {
|
|
661
|
+
key: f,
|
|
661
662
|
class: "brick-table-editor__col-header"
|
|
662
663
|
}, [
|
|
663
|
-
ne(" Col " + w(
|
|
664
|
-
(i()[0]?.length ?? 0) > 1 ? (s(),
|
|
664
|
+
ne(" Col " + w(f + 1) + " ", 1),
|
|
665
|
+
(i()[0]?.length ?? 0) > 1 ? (s(), d("button", {
|
|
665
666
|
key: 0,
|
|
666
667
|
class: "brick-table-editor__remove-btn",
|
|
667
668
|
title: "Remove column",
|
|
668
|
-
onClick: (g) => r(
|
|
669
|
-
}, "x", 8,
|
|
669
|
+
onClick: (g) => r(f)
|
|
670
|
+
}, "x", 8, Tt)) : I("", !0)
|
|
670
671
|
]))), 128))
|
|
671
672
|
])
|
|
672
673
|
]),
|
|
673
|
-
|
|
674
|
-
(s(!0),
|
|
675
|
-
|
|
676
|
-
ne(w(
|
|
677
|
-
i().length > 1 ? (s(),
|
|
674
|
+
m("tbody", null, [
|
|
675
|
+
(s(!0), d(C, null, E(i(), (b, f) => (s(), d("tr", { key: f }, [
|
|
676
|
+
m("td", Nt, [
|
|
677
|
+
ne(w(f + 1) + " ", 1),
|
|
678
|
+
i().length > 1 ? (s(), d("button", {
|
|
678
679
|
key: 0,
|
|
679
680
|
class: "brick-table-editor__remove-btn",
|
|
680
681
|
title: "Remove row",
|
|
681
|
-
onClick: (g) => a(
|
|
682
|
-
}, "x", 8,
|
|
682
|
+
onClick: (g) => a(f)
|
|
683
|
+
}, "x", 8, Dt)) : I("", !0)
|
|
683
684
|
]),
|
|
684
|
-
(s(!0),
|
|
685
|
-
|
|
685
|
+
(s(!0), d(C, null, E(b, (g, v) => (s(), d("td", { key: v }, [
|
|
686
|
+
m("input", {
|
|
686
687
|
class: "brick-table-editor__cell",
|
|
687
688
|
type: "text",
|
|
688
689
|
value: g,
|
|
689
|
-
onInput: (h) => o(
|
|
690
|
+
onInput: (h) => o(f, v, h.target.value)
|
|
690
691
|
}, null, 40, Lt)
|
|
691
692
|
]))), 128))
|
|
692
693
|
]))), 128))
|
|
@@ -719,10 +720,10 @@ const Rt = { class: "brick-table-editor" }, Dt = { class: "brick-table-editor__g
|
|
|
719
720
|
],
|
|
720
721
|
toPdfmake: rt
|
|
721
722
|
};
|
|
722
|
-
function
|
|
723
|
+
function At() {
|
|
723
724
|
return { src: "", width: 200, height: 150, fit: null };
|
|
724
725
|
}
|
|
725
|
-
function
|
|
726
|
+
function Vt() {
|
|
726
727
|
return {};
|
|
727
728
|
}
|
|
728
729
|
function Ht(e) {
|
|
@@ -740,36 +741,36 @@ const Ft = { class: "brick-el-image" }, Ut = ["src"], Wt = {
|
|
|
740
741
|
node: {}
|
|
741
742
|
},
|
|
742
743
|
setup(e) {
|
|
743
|
-
return (t, n) => (s(),
|
|
744
|
-
e.node.props.src ? (s(),
|
|
744
|
+
return (t, n) => (s(), d("div", Ft, [
|
|
745
|
+
e.node.props.src ? (s(), d("img", {
|
|
745
746
|
key: 0,
|
|
746
747
|
src: e.node.props.src,
|
|
747
|
-
style:
|
|
748
|
+
style: z({
|
|
748
749
|
width: e.node.props.width + "px",
|
|
749
750
|
height: e.node.props.height + "px",
|
|
750
751
|
objectFit: "contain",
|
|
751
752
|
opacity: e.node.style.opacity
|
|
752
753
|
})
|
|
753
|
-
}, null, 12, Ut)) : (s(),
|
|
754
|
+
}, null, 12, Ut)) : (s(), d("div", Wt, " No image selected "))
|
|
754
755
|
]));
|
|
755
756
|
}
|
|
756
|
-
}), Yt = /* @__PURE__ */ S(Jt, [["__scopeId", "data-v-38184258"]]),
|
|
757
|
+
}), Yt = /* @__PURE__ */ S(Jt, [["__scopeId", "data-v-38184258"]]), jt = { class: "brick-image-editor" }, qt = /* @__PURE__ */ _({
|
|
757
758
|
__name: "ImagePropertyEditor",
|
|
758
759
|
props: {
|
|
759
760
|
node: {}
|
|
760
761
|
},
|
|
761
762
|
setup(e) {
|
|
762
|
-
return (t, n) => (s(),
|
|
763
|
+
return (t, n) => (s(), d("div", jt));
|
|
763
764
|
}
|
|
764
765
|
}), Gt = {
|
|
765
766
|
type: "image",
|
|
766
767
|
label: "Image",
|
|
767
768
|
icon: "🖼",
|
|
768
769
|
isContainer: !1,
|
|
769
|
-
defaultProps:
|
|
770
|
-
defaultStyle:
|
|
770
|
+
defaultProps: At,
|
|
771
|
+
defaultStyle: Vt,
|
|
771
772
|
rendererComponent: Yt,
|
|
772
|
-
propertyEditorComponent:
|
|
773
|
+
propertyEditorComponent: qt,
|
|
773
774
|
propertyFields: [
|
|
774
775
|
{ key: "props.src", label: "Image (Base64)", section: "content", type: "file" },
|
|
775
776
|
{ key: "props.width", label: "Width", section: "layout", type: "number", min: 10, max: 1e3, step: 10, defaultValue: 200 },
|
|
@@ -800,13 +801,13 @@ const Zt = /* @__PURE__ */ _({
|
|
|
800
801
|
node: {}
|
|
801
802
|
},
|
|
802
803
|
setup(e) {
|
|
803
|
-
return (t, n) => (s(),
|
|
804
|
+
return (t, n) => (s(), d("div", {
|
|
804
805
|
class: "brick-el-list",
|
|
805
|
-
style:
|
|
806
|
+
style: z({ fontSize: (e.node.style.fontSize ?? 12) + "px", color: e.node.style.color })
|
|
806
807
|
}, [
|
|
807
808
|
(s(), M(Q(e.node.props.ordered ? "ol" : "ul"), null, {
|
|
808
809
|
default: W(() => [
|
|
809
|
-
(s(!0),
|
|
810
|
+
(s(!0), d(C, null, E(e.node.props.items, (i, c) => (s(), d("li", { key: c }, w(i), 1))), 128))
|
|
810
811
|
]),
|
|
811
812
|
_: 1
|
|
812
813
|
}))
|
|
@@ -818,7 +819,7 @@ const Zt = /* @__PURE__ */ _({
|
|
|
818
819
|
node: {}
|
|
819
820
|
},
|
|
820
821
|
setup(e) {
|
|
821
|
-
return (t, n) => (s(),
|
|
822
|
+
return (t, n) => (s(), d("div", tn));
|
|
822
823
|
}
|
|
823
824
|
}), on = {
|
|
824
825
|
type: "list",
|
|
@@ -859,14 +860,14 @@ const an = { class: "brick-el-qr__preview" }, cn = /* @__PURE__ */ _({
|
|
|
859
860
|
node: {}
|
|
860
861
|
},
|
|
861
862
|
setup(e) {
|
|
862
|
-
return (t, n) => (s(),
|
|
863
|
+
return (t, n) => (s(), d("div", {
|
|
863
864
|
class: "brick-el-qr",
|
|
864
|
-
style:
|
|
865
|
+
style: z({
|
|
865
866
|
width: (e.node.props.fit ?? 100) + "px",
|
|
866
867
|
height: (e.node.props.fit ?? 100) + "px"
|
|
867
868
|
})
|
|
868
869
|
}, [
|
|
869
|
-
|
|
870
|
+
m("div", an, "QR: " + w(e.node.props.data), 1)
|
|
870
871
|
], 4));
|
|
871
872
|
}
|
|
872
873
|
}), dn = /* @__PURE__ */ S(cn, [["__scopeId", "data-v-f106ba48"]]), un = { class: "brick-qr-editor" }, pn = /* @__PURE__ */ _({
|
|
@@ -875,7 +876,7 @@ const an = { class: "brick-el-qr__preview" }, cn = /* @__PURE__ */ _({
|
|
|
875
876
|
node: {}
|
|
876
877
|
},
|
|
877
878
|
setup(e) {
|
|
878
|
-
return (t, n) => (s(),
|
|
879
|
+
return (t, n) => (s(), d("div", un));
|
|
879
880
|
}
|
|
880
881
|
}), fn = {
|
|
881
882
|
type: "qr",
|
|
@@ -920,9 +921,9 @@ const bn = ["innerHTML"], vn = /* @__PURE__ */ _({
|
|
|
920
921
|
node: {}
|
|
921
922
|
},
|
|
922
923
|
setup(e) {
|
|
923
|
-
return (t, n) => (s(),
|
|
924
|
+
return (t, n) => (s(), d("div", {
|
|
924
925
|
class: "brick-el-svg",
|
|
925
|
-
style:
|
|
926
|
+
style: z({
|
|
926
927
|
width: e.node.props.width + "px",
|
|
927
928
|
height: e.node.props.height + "px"
|
|
928
929
|
}),
|
|
@@ -935,7 +936,7 @@ const bn = ["innerHTML"], vn = /* @__PURE__ */ _({
|
|
|
935
936
|
node: {}
|
|
936
937
|
},
|
|
937
938
|
setup(e) {
|
|
938
|
-
return (t, n) => (s(),
|
|
939
|
+
return (t, n) => (s(), d("div", _n));
|
|
939
940
|
}
|
|
940
941
|
}), xn = {
|
|
941
942
|
type: "svg",
|
|
@@ -960,195 +961,137 @@ const bn = ["innerHTML"], vn = /* @__PURE__ */ _({
|
|
|
960
961
|
toPdfmake: gn
|
|
961
962
|
};
|
|
962
963
|
function Sn() {
|
|
963
|
-
return {
|
|
964
|
-
commands: [
|
|
965
|
-
{ type: "rect", x: 0, y: 0, w: 200, h: 100, color: "#eeeeee" }
|
|
966
|
-
],
|
|
967
|
-
width: 200,
|
|
968
|
-
height: 100
|
|
969
|
-
};
|
|
964
|
+
return {};
|
|
970
965
|
}
|
|
971
966
|
function Cn() {
|
|
972
967
|
return {};
|
|
973
968
|
}
|
|
974
969
|
function wn(e) {
|
|
975
|
-
const t = {
|
|
976
|
-
canvas: e.props.commands
|
|
977
|
-
};
|
|
978
|
-
return e.style.margin && (t.margin = e.style.margin), t;
|
|
979
|
-
}
|
|
980
|
-
const Pn = /* @__PURE__ */ _({
|
|
981
|
-
__name: "CanvasDrawRenderer",
|
|
982
|
-
props: {
|
|
983
|
-
node: {}
|
|
984
|
-
},
|
|
985
|
-
setup(e) {
|
|
986
|
-
return (t, n) => (s(), c("div", {
|
|
987
|
-
class: "brick-el-canvas",
|
|
988
|
-
style: R({
|
|
989
|
-
width: (e.node.props.width ?? 200) + "px",
|
|
990
|
-
height: (e.node.props.height ?? 100) + "px"
|
|
991
|
-
})
|
|
992
|
-
}, [...n[0] || (n[0] = [
|
|
993
|
-
f("div", { class: "brick-el-canvas__label" }, "Canvas Drawing", -1)
|
|
994
|
-
])], 4));
|
|
995
|
-
}
|
|
996
|
-
}), En = /* @__PURE__ */ S(Pn, [["__scopeId", "data-v-1b986707"]]), $n = { class: "brick-canvas-editor" }, In = /* @__PURE__ */ _({
|
|
997
|
-
__name: "CanvasDrawPropertyEditor",
|
|
998
|
-
props: {
|
|
999
|
-
node: {}
|
|
1000
|
-
},
|
|
1001
|
-
setup(e) {
|
|
1002
|
-
return (t, n) => (s(), c("div", $n));
|
|
1003
|
-
}
|
|
1004
|
-
}), Rn = {
|
|
1005
|
-
type: "canvas",
|
|
1006
|
-
label: "Canvas",
|
|
1007
|
-
icon: "△",
|
|
1008
|
-
isContainer: !1,
|
|
1009
|
-
defaultProps: Sn,
|
|
1010
|
-
defaultStyle: Cn,
|
|
1011
|
-
rendererComponent: En,
|
|
1012
|
-
propertyEditorComponent: In,
|
|
1013
|
-
propertyFields: [
|
|
1014
|
-
{ key: "props.width", label: "Width", section: "layout", type: "number", min: 10, max: 1e3, step: 10, defaultValue: 200 },
|
|
1015
|
-
{ key: "props.height", label: "Height", section: "layout", type: "number", min: 10, max: 1e3, step: 10, defaultValue: 100 },
|
|
1016
|
-
{ key: "style.margin", label: "Margin", section: "layout", type: "margin", defaultValue: [0, 0, 0, 0] }
|
|
1017
|
-
],
|
|
1018
|
-
toPdfmake: wn
|
|
1019
|
-
};
|
|
1020
|
-
function Dn() {
|
|
1021
|
-
return {};
|
|
1022
|
-
}
|
|
1023
|
-
function zn() {
|
|
1024
|
-
return {};
|
|
1025
|
-
}
|
|
1026
|
-
function Tn(e) {
|
|
1027
970
|
return { text: "", pageBreak: "after" };
|
|
1028
971
|
}
|
|
1029
|
-
const
|
|
972
|
+
const En = { class: "brick-el-pagebreak" }, Pn = /* @__PURE__ */ _({
|
|
1030
973
|
__name: "PageBreakRenderer",
|
|
1031
974
|
props: {
|
|
1032
975
|
node: {}
|
|
1033
976
|
},
|
|
1034
977
|
setup(e) {
|
|
1035
|
-
return (t, n) => (s(),
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
978
|
+
return (t, n) => (s(), d("div", En, [...n[0] || (n[0] = [
|
|
979
|
+
m("hr", null, null, -1),
|
|
980
|
+
m("span", null, "Page Break", -1),
|
|
981
|
+
m("hr", null, null, -1)
|
|
1039
982
|
])]));
|
|
1040
983
|
}
|
|
1041
|
-
}),
|
|
984
|
+
}), $n = /* @__PURE__ */ S(Pn, [["__scopeId", "data-v-60c05148"]]), In = { class: "brick-pagebreak-editor" }, Rn = /* @__PURE__ */ _({
|
|
1042
985
|
__name: "PageBreakPropertyEditor",
|
|
1043
986
|
props: {
|
|
1044
987
|
node: {}
|
|
1045
988
|
},
|
|
1046
989
|
setup(e) {
|
|
1047
|
-
return (t, n) => (s(),
|
|
1048
|
-
|
|
990
|
+
return (t, n) => (s(), d("div", In, [...n[0] || (n[0] = [
|
|
991
|
+
m("p", { style: { color: "#999", "font-size": "12px" } }, "No configurable properties.", -1)
|
|
1049
992
|
])]));
|
|
1050
993
|
}
|
|
1051
|
-
}),
|
|
994
|
+
}), zn = {
|
|
1052
995
|
type: "pageBreak",
|
|
1053
996
|
label: "Page Break",
|
|
1054
997
|
icon: "⏎",
|
|
1055
998
|
isContainer: !1,
|
|
1056
|
-
defaultProps:
|
|
1057
|
-
defaultStyle:
|
|
1058
|
-
rendererComponent:
|
|
1059
|
-
propertyEditorComponent:
|
|
999
|
+
defaultProps: Sn,
|
|
1000
|
+
defaultStyle: Cn,
|
|
1001
|
+
rendererComponent: $n,
|
|
1002
|
+
propertyEditorComponent: Rn,
|
|
1060
1003
|
propertyFields: [],
|
|
1061
|
-
toPdfmake:
|
|
1004
|
+
toPdfmake: wn
|
|
1062
1005
|
};
|
|
1063
1006
|
let ie = !1;
|
|
1064
|
-
function
|
|
1065
|
-
ie || (ie = !0,
|
|
1007
|
+
function Tn() {
|
|
1008
|
+
ie || (ie = !0, T(Ae), T(je), T(tt), T(Ot), T(Gt), T(on), T(fn), T(xn), T(zn));
|
|
1066
1009
|
}
|
|
1067
|
-
const
|
|
1010
|
+
const Nn = {
|
|
1068
1011
|
key: 0,
|
|
1069
1012
|
class: "brick-dropzone__empty"
|
|
1070
|
-
},
|
|
1013
|
+
}, Dn = /* @__PURE__ */ _({
|
|
1071
1014
|
__name: "DropZone",
|
|
1072
1015
|
props: {
|
|
1073
1016
|
parentId: {},
|
|
1074
1017
|
layout: {}
|
|
1075
1018
|
},
|
|
1076
1019
|
setup(e) {
|
|
1077
|
-
const t = e, n =
|
|
1020
|
+
const t = e, n = P(null);
|
|
1078
1021
|
let i = null;
|
|
1079
|
-
const
|
|
1022
|
+
const c = be(), { isDragging: o } = c;
|
|
1080
1023
|
return se(() => {
|
|
1081
|
-
n.value && (i =
|
|
1024
|
+
n.value && (i = c.initContainer(n.value, t.parentId));
|
|
1082
1025
|
}), ae(() => {
|
|
1083
1026
|
i?.destroy();
|
|
1084
|
-
}), (u, a) => (s(),
|
|
1027
|
+
}), (u, a) => (s(), d("div", {
|
|
1085
1028
|
ref_key: "el",
|
|
1086
1029
|
ref: n,
|
|
1087
|
-
class: K(["brick-dropzone", { "brick-dropzone--horizontal": e.layout === "horizontal", "brick-dropzone--drag-active": k(o) }])
|
|
1030
|
+
class: K(["brick-dropzone", { "brick-dropzone--horizontal": e.layout === "horizontal", "brick-dropzone--drag-active": k(o) && e.layout === "horizontal" }])
|
|
1088
1031
|
}, [
|
|
1089
1032
|
X(u.$slots, "default", {}, void 0, !0),
|
|
1090
|
-
u.$slots.default ? I("", !0) : (s(),
|
|
1033
|
+
u.$slots.default ? I("", !0) : (s(), d("div", Nn, " Drop elements here "))
|
|
1091
1034
|
], 2));
|
|
1092
1035
|
}
|
|
1093
|
-
}), Se = /* @__PURE__ */ S(
|
|
1036
|
+
}), Se = /* @__PURE__ */ S(Dn, [["__scopeId", "data-v-b9596dad"]]), Ln = ["data-element-id", "data-element-type"], Mn = {
|
|
1094
1037
|
key: 1,
|
|
1095
1038
|
class: "brick-canvas-element__unknown"
|
|
1096
|
-
},
|
|
1039
|
+
}, Bn = /* @__PURE__ */ _({
|
|
1097
1040
|
__name: "CanvasElement",
|
|
1098
1041
|
props: {
|
|
1099
1042
|
node: {},
|
|
1100
1043
|
path: {}
|
|
1101
1044
|
},
|
|
1102
1045
|
setup(e) {
|
|
1103
|
-
const t = e, n = U(), i = Y(),
|
|
1104
|
-
function r(
|
|
1105
|
-
|
|
1046
|
+
const t = e, n = U(), i = Y(), c = P(null), o = $(() => F(t.node.type)), u = $(() => n.selectedId.value === t.node.id), a = $(() => o.value ? o.value.propertyFields.some((f) => f.key === "props.width" || f.key === "style.width") : !1), p = $(() => o.value ? o.value.propertyFields.some((f) => f.key === "props.height" || f.key === "style.height") : !1);
|
|
1047
|
+
function r(f) {
|
|
1048
|
+
f.stopPropagation(), n.select(t.node.id);
|
|
1106
1049
|
}
|
|
1107
|
-
function l(
|
|
1108
|
-
|
|
1109
|
-
const g =
|
|
1110
|
-
function h(
|
|
1111
|
-
const O =
|
|
1112
|
-
o.value?.propertyFields.some((
|
|
1050
|
+
function l(f) {
|
|
1051
|
+
f.stopPropagation(), f.preventDefault();
|
|
1052
|
+
const g = f.clientX, v = c.value?.offsetWidth ?? 200;
|
|
1053
|
+
function h(R) {
|
|
1054
|
+
const O = R.clientX - g, N = Math.max(20, v + O);
|
|
1055
|
+
o.value?.propertyFields.some((V) => V.key === "props.width") ? i.updateProps(t.node.id, { width: Math.round(N) }) : i.updateStyle(t.node.id, { width: Math.round(N) });
|
|
1113
1056
|
}
|
|
1114
1057
|
function x() {
|
|
1115
1058
|
document.removeEventListener("pointermove", h), document.removeEventListener("pointerup", x), document.body.style.cursor = "", document.body.style.userSelect = "";
|
|
1116
1059
|
}
|
|
1117
1060
|
document.body.style.cursor = "ew-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove", h), document.addEventListener("pointerup", x);
|
|
1118
1061
|
}
|
|
1119
|
-
function y(
|
|
1120
|
-
|
|
1121
|
-
const g =
|
|
1122
|
-
function h(
|
|
1123
|
-
const O =
|
|
1124
|
-
o.value?.propertyFields.some((
|
|
1062
|
+
function y(f) {
|
|
1063
|
+
f.stopPropagation(), f.preventDefault();
|
|
1064
|
+
const g = f.clientY, v = c.value?.offsetHeight ?? 100;
|
|
1065
|
+
function h(R) {
|
|
1066
|
+
const O = R.clientY - g, N = Math.max(20, v + O);
|
|
1067
|
+
o.value?.propertyFields.some((V) => V.key === "props.height") ? i.updateProps(t.node.id, { height: Math.round(N) }) : i.updateStyle(t.node.id, { height: Math.round(N) });
|
|
1125
1068
|
}
|
|
1126
1069
|
function x() {
|
|
1127
1070
|
document.removeEventListener("pointermove", h), document.removeEventListener("pointerup", x), document.body.style.cursor = "", document.body.style.userSelect = "";
|
|
1128
1071
|
}
|
|
1129
1072
|
document.body.style.cursor = "ns-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove", h), document.addEventListener("pointerup", x);
|
|
1130
1073
|
}
|
|
1131
|
-
function b(
|
|
1132
|
-
|
|
1133
|
-
const g =
|
|
1134
|
-
function
|
|
1135
|
-
const
|
|
1074
|
+
function b(f) {
|
|
1075
|
+
f.stopPropagation(), f.preventDefault();
|
|
1076
|
+
const g = f.clientX, v = f.clientY, h = c.value?.offsetWidth ?? 200, x = c.value?.offsetHeight ?? 100;
|
|
1077
|
+
function R(N) {
|
|
1078
|
+
const j = N.clientX - g, V = N.clientY - v, ee = Math.max(20, h + j), te = Math.max(20, x + V), Ce = o.value?.propertyFields.some((q) => q.key === "props.width"), we = o.value?.propertyFields.some((q) => q.key === "props.height");
|
|
1136
1079
|
Ce ? i.updateProps(t.node.id, { width: Math.round(ee) }) : i.updateStyle(t.node.id, { width: Math.round(ee) }), we ? i.updateProps(t.node.id, { height: Math.round(te) }) : i.updateStyle(t.node.id, { height: Math.round(te) });
|
|
1137
1080
|
}
|
|
1138
1081
|
function O() {
|
|
1139
|
-
document.removeEventListener("pointermove",
|
|
1082
|
+
document.removeEventListener("pointermove", R), document.removeEventListener("pointerup", O), document.body.style.cursor = "", document.body.style.userSelect = "";
|
|
1140
1083
|
}
|
|
1141
|
-
document.body.style.cursor = "nwse-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove",
|
|
1084
|
+
document.body.style.cursor = "nwse-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove", R), document.addEventListener("pointerup", O);
|
|
1142
1085
|
}
|
|
1143
|
-
return (
|
|
1144
|
-
const v =
|
|
1145
|
-
return s(),
|
|
1086
|
+
return (f, g) => {
|
|
1087
|
+
const v = Pe("CanvasElement", !0);
|
|
1088
|
+
return s(), d("div", {
|
|
1146
1089
|
ref_key: "elRef",
|
|
1147
|
-
ref:
|
|
1090
|
+
ref: c,
|
|
1148
1091
|
class: K(["brick-canvas-element", { "brick-canvas-element--selected": u.value }]),
|
|
1149
1092
|
"data-element-id": e.node.id,
|
|
1150
1093
|
"data-element-type": e.node.type,
|
|
1151
|
-
style:
|
|
1094
|
+
style: z({
|
|
1152
1095
|
width: typeof e.node.style.width == "number" ? e.node.style.width + "px" : e.node.props.width ? e.node.props.width + "px" : e.node.style.width,
|
|
1153
1096
|
height: e.node.style.height ? e.node.style.height + "px" : e.node.props.height ? e.node.props.height + "px" : void 0,
|
|
1154
1097
|
marginTop: e.node.style.margin?.[1] + "px",
|
|
@@ -1171,7 +1114,7 @@ const Hn = {
|
|
|
1171
1114
|
layout: e.node.type === "columns" ? "horizontal" : "vertical"
|
|
1172
1115
|
}, {
|
|
1173
1116
|
default: W(() => [
|
|
1174
|
-
(s(!0),
|
|
1117
|
+
(s(!0), d(C, null, E(e.node.children, (h, x) => (s(), M(v, {
|
|
1175
1118
|
key: h.id,
|
|
1176
1119
|
node: h,
|
|
1177
1120
|
path: [...e.path, x]
|
|
@@ -1181,28 +1124,28 @@ const Hn = {
|
|
|
1181
1124
|
}, 8, ["parent-id", "layout"])) : I("", !0)
|
|
1182
1125
|
]),
|
|
1183
1126
|
_: 1
|
|
1184
|
-
}, 8, ["node", "path"])) : (s(),
|
|
1185
|
-
u.value ? (s(),
|
|
1186
|
-
a.value ? (s(),
|
|
1127
|
+
}, 8, ["node", "path"])) : (s(), d("div", Mn, " Unknown element: " + w(e.node.type), 1)),
|
|
1128
|
+
u.value ? (s(), d(C, { key: 2 }, [
|
|
1129
|
+
a.value ? (s(), d("div", {
|
|
1187
1130
|
key: 0,
|
|
1188
1131
|
class: "brick-resize-handle brick-resize-handle--e",
|
|
1189
1132
|
onPointerdown: l
|
|
1190
1133
|
}, null, 32)) : I("", !0),
|
|
1191
|
-
p.value ? (s(),
|
|
1134
|
+
p.value ? (s(), d("div", {
|
|
1192
1135
|
key: 1,
|
|
1193
1136
|
class: "brick-resize-handle brick-resize-handle--s",
|
|
1194
1137
|
onPointerdown: y
|
|
1195
1138
|
}, null, 32)) : I("", !0),
|
|
1196
|
-
a.value && p.value ? (s(),
|
|
1139
|
+
a.value && p.value ? (s(), d("div", {
|
|
1197
1140
|
key: 2,
|
|
1198
1141
|
class: "brick-resize-handle brick-resize-handle--se",
|
|
1199
1142
|
onPointerdown: b
|
|
1200
1143
|
}, null, 32)) : I("", !0)
|
|
1201
1144
|
], 64)) : I("", !0)
|
|
1202
|
-
], 14,
|
|
1145
|
+
], 14, Ln);
|
|
1203
1146
|
};
|
|
1204
1147
|
}
|
|
1205
|
-
}),
|
|
1148
|
+
}), On = /* @__PURE__ */ S(Bn, [["__scopeId", "data-v-6b9cadc1"]]), An = { class: "brick-doc-bar" }, Vn = { class: "brick-doc-bar__field" }, Hn = ["value"], Fn = { class: "brick-doc-bar__field" }, Un = { class: "brick-doc-bar__field brick-doc-bar__field--margins" }, Wn = { class: "brick-doc-bar__margins" }, Jn = ["placeholder", "title", "value", "onInput"], Yn = { class: "brick-doc-bar__field" }, jn = ["value"], qn = /* @__PURE__ */ _({
|
|
1206
1149
|
__name: "DocumentSettings",
|
|
1207
1150
|
setup(e) {
|
|
1208
1151
|
const t = Z(), n = [
|
|
@@ -1212,61 +1155,61 @@ const Hn = {
|
|
|
1212
1155
|
{ label: "Letter", value: "LETTER" },
|
|
1213
1156
|
{ label: "Legal", value: "LEGAL" }
|
|
1214
1157
|
];
|
|
1215
|
-
function i(
|
|
1158
|
+
function i(c, o) {
|
|
1216
1159
|
const u = [...t.document.pageMargins];
|
|
1217
|
-
u[
|
|
1160
|
+
u[c] = o, t.document.pageMargins = u;
|
|
1218
1161
|
}
|
|
1219
|
-
return (
|
|
1220
|
-
|
|
1221
|
-
o[3] || (o[3] =
|
|
1222
|
-
G(
|
|
1162
|
+
return (c, o) => (s(), d("div", An, [
|
|
1163
|
+
m("div", Vn, [
|
|
1164
|
+
o[3] || (o[3] = m("label", null, "Size", -1)),
|
|
1165
|
+
G(m("select", {
|
|
1223
1166
|
"onUpdate:modelValue": o[0] || (o[0] = (u) => k(t).document.pageSize = u)
|
|
1224
1167
|
}, [
|
|
1225
|
-
(s(),
|
|
1168
|
+
(s(), d(C, null, E(n, (u) => m("option", {
|
|
1226
1169
|
key: u.value,
|
|
1227
1170
|
value: u.value
|
|
1228
|
-
}, w(u.label), 9,
|
|
1171
|
+
}, w(u.label), 9, Hn)), 64))
|
|
1229
1172
|
], 512), [
|
|
1230
1173
|
[oe, k(t).document.pageSize]
|
|
1231
1174
|
])
|
|
1232
1175
|
]),
|
|
1233
|
-
|
|
1234
|
-
o[5] || (o[5] =
|
|
1235
|
-
G(
|
|
1176
|
+
m("div", Fn, [
|
|
1177
|
+
o[5] || (o[5] = m("label", null, "Orientation", -1)),
|
|
1178
|
+
G(m("select", {
|
|
1236
1179
|
"onUpdate:modelValue": o[1] || (o[1] = (u) => k(t).document.pageOrientation = u)
|
|
1237
1180
|
}, [...o[4] || (o[4] = [
|
|
1238
|
-
|
|
1239
|
-
|
|
1181
|
+
m("option", { value: "portrait" }, "Portrait", -1),
|
|
1182
|
+
m("option", { value: "landscape" }, "Landscape", -1)
|
|
1240
1183
|
])], 512), [
|
|
1241
1184
|
[oe, k(t).document.pageOrientation]
|
|
1242
1185
|
])
|
|
1243
1186
|
]),
|
|
1244
|
-
|
|
1245
|
-
o[6] || (o[6] =
|
|
1246
|
-
|
|
1247
|
-
(s(),
|
|
1187
|
+
m("div", Un, [
|
|
1188
|
+
o[6] || (o[6] = m("label", null, "Margins", -1)),
|
|
1189
|
+
m("div", Wn, [
|
|
1190
|
+
(s(), d(C, null, E(["L", "T", "R", "B"], (u, a) => m("input", {
|
|
1248
1191
|
key: a,
|
|
1249
1192
|
type: "number",
|
|
1250
1193
|
placeholder: u,
|
|
1251
1194
|
title: u,
|
|
1252
1195
|
value: k(t).document.pageMargins[a],
|
|
1253
1196
|
onInput: (p) => i(a, Number(p.target.value))
|
|
1254
|
-
}, null, 40,
|
|
1197
|
+
}, null, 40, Jn)), 64))
|
|
1255
1198
|
])
|
|
1256
1199
|
]),
|
|
1257
|
-
|
|
1258
|
-
o[7] || (o[7] =
|
|
1259
|
-
|
|
1200
|
+
m("div", Yn, [
|
|
1201
|
+
o[7] || (o[7] = m("label", null, "Font Size", -1)),
|
|
1202
|
+
m("input", {
|
|
1260
1203
|
type: "number",
|
|
1261
1204
|
value: k(t).document.defaultStyle.fontSize ?? 12,
|
|
1262
1205
|
min: "6",
|
|
1263
1206
|
max: "72",
|
|
1264
1207
|
onInput: o[2] || (o[2] = (u) => k(t).document.defaultStyle.fontSize = Number(u.target.value))
|
|
1265
|
-
}, null, 40,
|
|
1208
|
+
}, null, 40, jn)
|
|
1266
1209
|
])
|
|
1267
1210
|
]));
|
|
1268
1211
|
}
|
|
1269
|
-
}),
|
|
1212
|
+
}), Gn = /* @__PURE__ */ S(qn, [["__scopeId", "data-v-f05c1083"]]), Xn = { class: "brick-canvas" }, A = 0.75, Kn = /* @__PURE__ */ _({
|
|
1270
1213
|
__name: "DesignCanvas",
|
|
1271
1214
|
setup(e) {
|
|
1272
1215
|
const t = Z(), n = U(), i = {
|
|
@@ -1275,36 +1218,36 @@ const Hn = {
|
|
|
1275
1218
|
A5: [419.53, 595.28],
|
|
1276
1219
|
LETTER: [612, 792],
|
|
1277
1220
|
LEGAL: [612, 1008]
|
|
1278
|
-
},
|
|
1221
|
+
}, c = $(() => {
|
|
1279
1222
|
const [a, p] = i[t.document.pageSize] ?? i.A4, r = t.document.pageOrientation === "landscape" ? p : a;
|
|
1280
|
-
return Math.round(r *
|
|
1223
|
+
return Math.round(r * A);
|
|
1281
1224
|
}), o = $(() => {
|
|
1282
1225
|
const [a, p] = i[t.document.pageSize] ?? i.A4, r = t.document.pageOrientation === "landscape" ? a : p;
|
|
1283
|
-
return Math.round(r *
|
|
1226
|
+
return Math.round(r * A);
|
|
1284
1227
|
});
|
|
1285
1228
|
function u(a) {
|
|
1286
1229
|
(a.target === a.currentTarget || a.target.classList.contains("brick-canvas__page")) && n.deselect();
|
|
1287
1230
|
}
|
|
1288
|
-
return (a, p) => (s(),
|
|
1289
|
-
B(
|
|
1290
|
-
|
|
1231
|
+
return (a, p) => (s(), d("div", Xn, [
|
|
1232
|
+
B(Gn),
|
|
1233
|
+
m("div", {
|
|
1291
1234
|
class: "brick-canvas__scroll",
|
|
1292
1235
|
onClick: u
|
|
1293
1236
|
}, [
|
|
1294
|
-
|
|
1237
|
+
m("div", {
|
|
1295
1238
|
class: "brick-canvas__page",
|
|
1296
|
-
style:
|
|
1297
|
-
width:
|
|
1239
|
+
style: z({
|
|
1240
|
+
width: c.value + "px",
|
|
1298
1241
|
minHeight: o.value + "px",
|
|
1299
|
-
paddingTop: k(t).document.pageMargins[1] *
|
|
1300
|
-
paddingRight: k(t).document.pageMargins[2] *
|
|
1301
|
-
paddingBottom: k(t).document.pageMargins[3] *
|
|
1302
|
-
paddingLeft: k(t).document.pageMargins[0] *
|
|
1242
|
+
paddingTop: k(t).document.pageMargins[1] * A + "px",
|
|
1243
|
+
paddingRight: k(t).document.pageMargins[2] * A + "px",
|
|
1244
|
+
paddingBottom: k(t).document.pageMargins[3] * A + "px",
|
|
1245
|
+
paddingLeft: k(t).document.pageMargins[0] * A + "px"
|
|
1303
1246
|
})
|
|
1304
1247
|
}, [
|
|
1305
1248
|
B(Se, { "parent-id": null }, {
|
|
1306
1249
|
default: W(() => [
|
|
1307
|
-
(s(!0),
|
|
1250
|
+
(s(!0), d(C, null, E(k(t).document.content, (r, l) => (s(), M(On, {
|
|
1308
1251
|
key: r.id,
|
|
1309
1252
|
node: r,
|
|
1310
1253
|
path: [l]
|
|
@@ -1316,41 +1259,41 @@ const Hn = {
|
|
|
1316
1259
|
])
|
|
1317
1260
|
]));
|
|
1318
1261
|
}
|
|
1319
|
-
}),
|
|
1262
|
+
}), Qn = /* @__PURE__ */ S(Kn, [["__scopeId", "data-v-364329ec"]]), Zn = ["data-element-type"], eo = { class: "brick-element-list__icon" }, to = { class: "brick-element-list__label" }, no = /* @__PURE__ */ _({
|
|
1320
1263
|
__name: "ToolbarElementList",
|
|
1321
1264
|
setup(e) {
|
|
1322
|
-
const t =
|
|
1265
|
+
const t = P(null);
|
|
1323
1266
|
let n = null;
|
|
1324
|
-
const i = be(),
|
|
1267
|
+
const i = be(), c = ze();
|
|
1325
1268
|
return se(() => {
|
|
1326
1269
|
t.value && (n = i.initToolbar(t.value));
|
|
1327
1270
|
}), ae(() => {
|
|
1328
1271
|
n?.destroy();
|
|
1329
|
-
}), (o, u) => (s(),
|
|
1272
|
+
}), (o, u) => (s(), d("div", {
|
|
1330
1273
|
ref_key: "el",
|
|
1331
1274
|
ref: t,
|
|
1332
1275
|
class: "brick-element-list"
|
|
1333
1276
|
}, [
|
|
1334
|
-
(s(!0),
|
|
1277
|
+
(s(!0), d(C, null, E(k(c), (a) => (s(), d("div", {
|
|
1335
1278
|
key: a.type,
|
|
1336
1279
|
class: "brick-element-list__item",
|
|
1337
1280
|
"data-element-type": a.type
|
|
1338
1281
|
}, [
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
], 8,
|
|
1282
|
+
m("span", eo, w(a.icon), 1),
|
|
1283
|
+
m("span", to, w(a.label), 1)
|
|
1284
|
+
], 8, Zn))), 128))
|
|
1342
1285
|
], 512));
|
|
1343
1286
|
}
|
|
1344
|
-
}),
|
|
1287
|
+
}), oo = /* @__PURE__ */ S(no, [["__scopeId", "data-v-2d0b1dbf"]]), ro = { class: "brick-field" }, lo = { class: "brick-field__label" }, io = ["value"], so = ["value"], ao = ["value", "min", "max", "step"], co = ["value"], uo = ["value"], po = ["value"], fo = {
|
|
1345
1288
|
key: 5,
|
|
1346
1289
|
class: "brick-field__toggle"
|
|
1347
|
-
},
|
|
1290
|
+
}, mo = ["checked"], yo = {
|
|
1348
1291
|
key: 6,
|
|
1349
1292
|
class: "brick-field__margin"
|
|
1350
|
-
},
|
|
1293
|
+
}, go = ["placeholder", "value", "onInput"], bo = {
|
|
1351
1294
|
key: 7,
|
|
1352
1295
|
class: "brick-field__slider"
|
|
1353
|
-
},
|
|
1296
|
+
}, vo = ["value", "min", "max", "step"], ho = { class: "brick-field__slider-value" }, _o = /* @__PURE__ */ _({
|
|
1354
1297
|
__name: "PropertyField",
|
|
1355
1298
|
props: {
|
|
1356
1299
|
descriptor: {},
|
|
@@ -1363,7 +1306,7 @@ const Hn = {
|
|
|
1363
1306
|
return t.node.props[l];
|
|
1364
1307
|
if (r === "style")
|
|
1365
1308
|
return t.node.style[l];
|
|
1366
|
-
}),
|
|
1309
|
+
}), c = $(() => {
|
|
1367
1310
|
const p = i.value;
|
|
1368
1311
|
return t.descriptor.type === "textarea" && Array.isArray(p) ? p.join(`
|
|
1369
1312
|
`) : p;
|
|
@@ -1375,7 +1318,7 @@ const Hn = {
|
|
|
1375
1318
|
`)), l === "props" ? n.updateProps(t.node.id, { [y]: b }) : l === "style" && n.updateStyle(t.node.id, { [y]: b });
|
|
1376
1319
|
}
|
|
1377
1320
|
function u(p, r) {
|
|
1378
|
-
const y = [...
|
|
1321
|
+
const y = [...c.value ?? [0, 0, 0, 0]];
|
|
1379
1322
|
y[p] = r, o(y);
|
|
1380
1323
|
}
|
|
1381
1324
|
function a(p) {
|
|
@@ -1386,72 +1329,72 @@ const Hn = {
|
|
|
1386
1329
|
o(y.result);
|
|
1387
1330
|
}, y.readAsDataURL(l);
|
|
1388
1331
|
}
|
|
1389
|
-
return (p, r) => (s(),
|
|
1390
|
-
|
|
1391
|
-
e.descriptor.type === "text" ? (s(),
|
|
1332
|
+
return (p, r) => (s(), d("div", ro, [
|
|
1333
|
+
m("label", lo, w(e.descriptor.label), 1),
|
|
1334
|
+
e.descriptor.type === "text" ? (s(), d("input", {
|
|
1392
1335
|
key: 0,
|
|
1393
1336
|
type: "text",
|
|
1394
1337
|
class: "brick-field__input",
|
|
1395
|
-
value:
|
|
1338
|
+
value: c.value,
|
|
1396
1339
|
onInput: r[0] || (r[0] = (l) => o(l.target.value))
|
|
1397
|
-
}, null, 40,
|
|
1340
|
+
}, null, 40, io)) : e.descriptor.type === "textarea" ? (s(), d("textarea", {
|
|
1398
1341
|
key: 1,
|
|
1399
1342
|
class: "brick-field__textarea",
|
|
1400
|
-
value:
|
|
1343
|
+
value: c.value,
|
|
1401
1344
|
rows: "3",
|
|
1402
1345
|
onInput: r[1] || (r[1] = (l) => o(l.target.value))
|
|
1403
|
-
}, null, 40,
|
|
1346
|
+
}, null, 40, so)) : e.descriptor.type === "number" ? (s(), d("input", {
|
|
1404
1347
|
key: 2,
|
|
1405
1348
|
type: "number",
|
|
1406
1349
|
class: "brick-field__input",
|
|
1407
|
-
value:
|
|
1350
|
+
value: c.value,
|
|
1408
1351
|
min: e.descriptor.min,
|
|
1409
1352
|
max: e.descriptor.max,
|
|
1410
1353
|
step: e.descriptor.step,
|
|
1411
1354
|
onInput: r[2] || (r[2] = (l) => o(Number(l.target.value)))
|
|
1412
|
-
}, null, 40,
|
|
1355
|
+
}, null, 40, ao)) : e.descriptor.type === "color" ? (s(), d("input", {
|
|
1413
1356
|
key: 3,
|
|
1414
1357
|
type: "color",
|
|
1415
1358
|
class: "brick-field__color",
|
|
1416
|
-
value:
|
|
1359
|
+
value: c.value ?? "#000000",
|
|
1417
1360
|
onInput: r[3] || (r[3] = (l) => o(l.target.value))
|
|
1418
|
-
}, null, 40,
|
|
1361
|
+
}, null, 40, co)) : e.descriptor.type === "select" ? (s(), d("select", {
|
|
1419
1362
|
key: 4,
|
|
1420
1363
|
class: "brick-field__select",
|
|
1421
|
-
value:
|
|
1364
|
+
value: c.value,
|
|
1422
1365
|
onChange: r[4] || (r[4] = (l) => o(l.target.value || void 0))
|
|
1423
1366
|
}, [
|
|
1424
|
-
(s(!0),
|
|
1367
|
+
(s(!0), d(C, null, E(e.descriptor.options, (l) => (s(), d("option", {
|
|
1425
1368
|
key: String(l.value),
|
|
1426
1369
|
value: l.value
|
|
1427
|
-
}, w(l.label), 9,
|
|
1428
|
-
], 40,
|
|
1429
|
-
|
|
1370
|
+
}, w(l.label), 9, po))), 128))
|
|
1371
|
+
], 40, uo)) : e.descriptor.type === "toggle" ? (s(), d("label", fo, [
|
|
1372
|
+
m("input", {
|
|
1430
1373
|
type: "checkbox",
|
|
1431
|
-
checked:
|
|
1374
|
+
checked: c.value,
|
|
1432
1375
|
onChange: r[5] || (r[5] = (l) => o(l.target.checked))
|
|
1433
|
-
}, null, 40,
|
|
1434
|
-
|
|
1435
|
-
])) : e.descriptor.type === "margin" ? (s(),
|
|
1436
|
-
(s(),
|
|
1376
|
+
}, null, 40, mo),
|
|
1377
|
+
m("span", null, w(c.value ? "On" : "Off"), 1)
|
|
1378
|
+
])) : e.descriptor.type === "margin" ? (s(), d("div", yo, [
|
|
1379
|
+
(s(), d(C, null, E(["L", "T", "R", "B"], (l, y) => m("input", {
|
|
1437
1380
|
key: l,
|
|
1438
1381
|
type: "number",
|
|
1439
1382
|
class: "brick-field__margin-input",
|
|
1440
1383
|
placeholder: l,
|
|
1441
|
-
value: (
|
|
1384
|
+
value: (c.value ?? [0, 0, 0, 0])[y],
|
|
1442
1385
|
onInput: (b) => u(y, Number(b.target.value))
|
|
1443
|
-
}, null, 40,
|
|
1444
|
-
])) : e.descriptor.type === "slider" ? (s(),
|
|
1445
|
-
|
|
1386
|
+
}, null, 40, go)), 64))
|
|
1387
|
+
])) : e.descriptor.type === "slider" ? (s(), d("div", bo, [
|
|
1388
|
+
m("input", {
|
|
1446
1389
|
type: "range",
|
|
1447
|
-
value:
|
|
1390
|
+
value: c.value,
|
|
1448
1391
|
min: e.descriptor.min,
|
|
1449
1392
|
max: e.descriptor.max,
|
|
1450
1393
|
step: e.descriptor.step,
|
|
1451
1394
|
onInput: r[6] || (r[6] = (l) => o(Number(l.target.value)))
|
|
1452
|
-
}, null, 40,
|
|
1453
|
-
|
|
1454
|
-
])) : e.descriptor.type === "file" ? (s(),
|
|
1395
|
+
}, null, 40, vo),
|
|
1396
|
+
m("span", ho, w(c.value), 1)
|
|
1397
|
+
])) : e.descriptor.type === "file" ? (s(), d("input", {
|
|
1455
1398
|
key: 8,
|
|
1456
1399
|
type: "file",
|
|
1457
1400
|
accept: "image/*",
|
|
@@ -1460,13 +1403,13 @@ const Hn = {
|
|
|
1460
1403
|
}, null, 32)) : I("", !0)
|
|
1461
1404
|
]));
|
|
1462
1405
|
}
|
|
1463
|
-
}),
|
|
1406
|
+
}), ko = /* @__PURE__ */ S(_o, [["__scopeId", "data-v-5a3bec1b"]]), xo = {
|
|
1464
1407
|
key: 0,
|
|
1465
1408
|
class: "brick-property-editor"
|
|
1466
|
-
},
|
|
1409
|
+
}, So = { class: "brick-property-editor__type" }, Co = {
|
|
1467
1410
|
key: 0,
|
|
1468
1411
|
class: "brick-property-editor__group"
|
|
1469
|
-
},
|
|
1412
|
+
}, wo = { class: "brick-property-editor__group-title" }, Eo = /* @__PURE__ */ _({
|
|
1470
1413
|
__name: "PropertyEditor",
|
|
1471
1414
|
setup(e) {
|
|
1472
1415
|
const t = U(), n = $(() => {
|
|
@@ -1478,18 +1421,18 @@ const Hn = {
|
|
|
1478
1421
|
for (const a of n.value.propertyFields)
|
|
1479
1422
|
u[a.section] || (u[a.section] = []), u[a.section].push(a);
|
|
1480
1423
|
return u;
|
|
1481
|
-
}),
|
|
1424
|
+
}), c = {
|
|
1482
1425
|
content: "Content",
|
|
1483
1426
|
style: "Style",
|
|
1484
1427
|
layout: "Layout",
|
|
1485
1428
|
advanced: "Advanced"
|
|
1486
1429
|
}, o = ["content", "style", "layout", "advanced"];
|
|
1487
|
-
return (u, a) => k(t).selectedNode.value && n.value ? (s(),
|
|
1488
|
-
|
|
1489
|
-
(s(),
|
|
1490
|
-
i.value[p] ? (s(),
|
|
1491
|
-
|
|
1492
|
-
(s(!0),
|
|
1430
|
+
return (u, a) => k(t).selectedNode.value && n.value ? (s(), d("div", xo, [
|
|
1431
|
+
m("div", So, w(n.value.icon) + " " + w(n.value.label), 1),
|
|
1432
|
+
(s(), d(C, null, E(o, (p) => (s(), d(C, { key: p }, [
|
|
1433
|
+
i.value[p] ? (s(), d("div", Co, [
|
|
1434
|
+
m("div", wo, w(c[p]), 1),
|
|
1435
|
+
(s(!0), d(C, null, E(i.value[p], (r) => (s(), M(ko, {
|
|
1493
1436
|
key: r.key,
|
|
1494
1437
|
descriptor: r,
|
|
1495
1438
|
node: k(t).selectedNode.value
|
|
@@ -1501,45 +1444,45 @@ const Hn = {
|
|
|
1501
1444
|
}, null, 8, ["node"]))
|
|
1502
1445
|
])) : I("", !0);
|
|
1503
1446
|
}
|
|
1504
|
-
}),
|
|
1447
|
+
}), Po = /* @__PURE__ */ S(Eo, [["__scopeId", "data-v-4d129dac"]]), $o = { class: "brick-toolbar" }, Io = { class: "brick-toolbar__section" }, Ro = {
|
|
1505
1448
|
key: 0,
|
|
1506
1449
|
class: "brick-toolbar__section"
|
|
1507
|
-
},
|
|
1450
|
+
}, zo = /* @__PURE__ */ _({
|
|
1508
1451
|
__name: "Toolbar",
|
|
1509
1452
|
setup(e) {
|
|
1510
1453
|
const t = U();
|
|
1511
|
-
return (n, i) => (s(),
|
|
1512
|
-
|
|
1513
|
-
i[0] || (i[0] =
|
|
1514
|
-
B(
|
|
1454
|
+
return (n, i) => (s(), d("div", $o, [
|
|
1455
|
+
m("div", Io, [
|
|
1456
|
+
i[0] || (i[0] = m("h3", { class: "brick-toolbar__title" }, "Elements", -1)),
|
|
1457
|
+
B(oo)
|
|
1515
1458
|
]),
|
|
1516
|
-
k(t).selectedNode.value ? (s(),
|
|
1517
|
-
i[1] || (i[1] =
|
|
1518
|
-
B(
|
|
1459
|
+
k(t).selectedNode.value ? (s(), d("div", Ro, [
|
|
1460
|
+
i[1] || (i[1] = m("h3", { class: "brick-toolbar__title" }, "Properties", -1)),
|
|
1461
|
+
B(Po)
|
|
1519
1462
|
])) : I("", !0)
|
|
1520
1463
|
]));
|
|
1521
1464
|
}
|
|
1522
|
-
}),
|
|
1465
|
+
}), To = /* @__PURE__ */ S(zo, [["__scopeId", "data-v-0174c069"]]), No = { class: "brick-actionbar" }, Do = { class: "brick-actionbar__group" }, Lo = { class: "brick-actionbar__group" }, Mo = ["disabled"], Bo = ["disabled"], Oo = ["disabled"], Ao = { class: "brick-actionbar__group" }, Vo = /* @__PURE__ */ _({
|
|
1523
1466
|
__name: "ActionBar",
|
|
1524
1467
|
setup(e) {
|
|
1525
|
-
const t = bt(), n = St(), i = U(),
|
|
1468
|
+
const t = bt(), n = St(), i = U(), c = Y(), o = Z(), u = P("document"), a = P(null);
|
|
1526
1469
|
function p() {
|
|
1527
|
-
const
|
|
1528
|
-
|
|
1470
|
+
const f = i.selectedId.value;
|
|
1471
|
+
f && (i.deselect(), c.removeElement(f));
|
|
1529
1472
|
}
|
|
1530
1473
|
function r() {
|
|
1531
|
-
const
|
|
1474
|
+
const f = u.value.trim() || "document", g = f.endsWith(".pdf") ? f : f + ".pdf";
|
|
1532
1475
|
n.exportPdf(g);
|
|
1533
1476
|
}
|
|
1534
1477
|
function l() {
|
|
1535
|
-
const
|
|
1536
|
-
x.href = h, x.download =
|
|
1478
|
+
const f = o.exportDocument(), g = JSON.stringify(f, null, 2), v = new Blob([g], { type: "application/json" }), h = URL.createObjectURL(v), x = document.createElement("a"), R = u.value.trim() || "document";
|
|
1479
|
+
x.href = h, x.download = R.endsWith(".json") ? R : R + ".json", x.click(), URL.revokeObjectURL(h);
|
|
1537
1480
|
}
|
|
1538
1481
|
function y() {
|
|
1539
1482
|
a.value?.click();
|
|
1540
1483
|
}
|
|
1541
|
-
function b(
|
|
1542
|
-
const g =
|
|
1484
|
+
function b(f) {
|
|
1485
|
+
const g = f.target, v = g.files?.[0];
|
|
1543
1486
|
if (!v) return;
|
|
1544
1487
|
const h = new FileReader();
|
|
1545
1488
|
h.onload = () => {
|
|
@@ -1555,9 +1498,9 @@ const Hn = {
|
|
|
1555
1498
|
}
|
|
1556
1499
|
}, h.readAsText(v), g.value = "";
|
|
1557
1500
|
}
|
|
1558
|
-
return (
|
|
1559
|
-
|
|
1560
|
-
G(
|
|
1501
|
+
return (f, g) => (s(), d("div", No, [
|
|
1502
|
+
m("div", Do, [
|
|
1503
|
+
G(m("input", {
|
|
1561
1504
|
"onUpdate:modelValue": g[0] || (g[0] = (v) => u.value = v),
|
|
1562
1505
|
class: "brick-actionbar__name",
|
|
1563
1506
|
type: "text",
|
|
@@ -1567,47 +1510,47 @@ const Hn = {
|
|
|
1567
1510
|
[$e, u.value]
|
|
1568
1511
|
])
|
|
1569
1512
|
]),
|
|
1570
|
-
|
|
1571
|
-
|
|
1513
|
+
m("div", Lo, [
|
|
1514
|
+
m("button", {
|
|
1572
1515
|
class: "brick-actionbar__btn",
|
|
1573
1516
|
disabled: !k(t).canUndo.value,
|
|
1574
1517
|
title: "Undo",
|
|
1575
1518
|
onClick: g[1] || (g[1] = (v) => k(t).undo())
|
|
1576
|
-
}, " Undo ", 8,
|
|
1577
|
-
|
|
1519
|
+
}, " Undo ", 8, Mo),
|
|
1520
|
+
m("button", {
|
|
1578
1521
|
class: "brick-actionbar__btn",
|
|
1579
1522
|
disabled: !k(t).canRedo.value,
|
|
1580
1523
|
title: "Redo",
|
|
1581
1524
|
onClick: g[2] || (g[2] = (v) => k(t).redo())
|
|
1582
|
-
}, " Redo ", 8,
|
|
1583
|
-
|
|
1525
|
+
}, " Redo ", 8, Bo),
|
|
1526
|
+
m("button", {
|
|
1584
1527
|
class: "brick-actionbar__btn brick-actionbar__btn--danger",
|
|
1585
1528
|
disabled: !k(i).selectedId.value,
|
|
1586
1529
|
title: "Delete selected element",
|
|
1587
1530
|
onClick: p
|
|
1588
|
-
}, " Delete ", 8,
|
|
1531
|
+
}, " Delete ", 8, Oo)
|
|
1589
1532
|
]),
|
|
1590
|
-
|
|
1591
|
-
|
|
1533
|
+
m("div", Ao, [
|
|
1534
|
+
m("button", {
|
|
1592
1535
|
class: "brick-actionbar__btn",
|
|
1593
1536
|
title: "Import JSON",
|
|
1594
1537
|
onClick: y
|
|
1595
1538
|
}, " Import JSON "),
|
|
1596
|
-
|
|
1539
|
+
m("button", {
|
|
1597
1540
|
class: "brick-actionbar__btn",
|
|
1598
1541
|
title: "Export JSON",
|
|
1599
1542
|
onClick: l
|
|
1600
1543
|
}, " Export JSON "),
|
|
1601
|
-
|
|
1544
|
+
m("button", {
|
|
1602
1545
|
class: "brick-actionbar__btn brick-actionbar__btn--primary",
|
|
1603
1546
|
onClick: r
|
|
1604
1547
|
}, " Export PDF "),
|
|
1605
|
-
|
|
1548
|
+
m("button", {
|
|
1606
1549
|
class: "brick-actionbar__btn",
|
|
1607
1550
|
onClick: g[3] || (g[3] = (v) => k(n).openPdf())
|
|
1608
1551
|
}, " Preview ")
|
|
1609
1552
|
]),
|
|
1610
|
-
|
|
1553
|
+
m("input", {
|
|
1611
1554
|
ref_key: "fileInput",
|
|
1612
1555
|
ref: a,
|
|
1613
1556
|
type: "file",
|
|
@@ -1617,7 +1560,7 @@ const Hn = {
|
|
|
1617
1560
|
}, null, 544)
|
|
1618
1561
|
]));
|
|
1619
1562
|
}
|
|
1620
|
-
}),
|
|
1563
|
+
}), Ho = /* @__PURE__ */ S(Vo, [["__scopeId", "data-v-be915a0f"]]), Fo = { class: "brick-pdf" }, Uo = { class: "brick-pdf__workspace" }, Wo = /* @__PURE__ */ _({
|
|
1621
1564
|
__name: "BrickPdf",
|
|
1622
1565
|
props: {
|
|
1623
1566
|
modelValue: {}
|
|
@@ -1625,25 +1568,25 @@ const Hn = {
|
|
|
1625
1568
|
emits: ["update:modelValue"],
|
|
1626
1569
|
setup(e, { emit: t }) {
|
|
1627
1570
|
const n = e, i = t;
|
|
1628
|
-
|
|
1629
|
-
const
|
|
1630
|
-
at(
|
|
1631
|
-
const o = ct(
|
|
1571
|
+
Tn();
|
|
1572
|
+
const c = st(n.modelValue ?? ce());
|
|
1573
|
+
at(c);
|
|
1574
|
+
const o = ct(c);
|
|
1632
1575
|
dt(o);
|
|
1633
|
-
const u = yt(
|
|
1576
|
+
const u = yt(c);
|
|
1634
1577
|
gt(u);
|
|
1635
|
-
const a = pt(
|
|
1578
|
+
const a = pt(c, u);
|
|
1636
1579
|
ft(a);
|
|
1637
|
-
const p = vt(
|
|
1580
|
+
const p = vt(c, a);
|
|
1638
1581
|
ht(p);
|
|
1639
|
-
const r = kt(
|
|
1582
|
+
const r = kt(c);
|
|
1640
1583
|
xt(r);
|
|
1641
|
-
const l =
|
|
1642
|
-
|
|
1584
|
+
const l = Et(c, a);
|
|
1585
|
+
Pt(l);
|
|
1643
1586
|
const y = $t(a);
|
|
1644
1587
|
It(y);
|
|
1645
|
-
const b = Re(),
|
|
1646
|
-
return re(
|
|
1588
|
+
const b = Re(), f = b.Delete, g = b.Backspace;
|
|
1589
|
+
return re(f, () => {
|
|
1647
1590
|
if (!o.selectedId.value) return;
|
|
1648
1591
|
const v = document.activeElement;
|
|
1649
1592
|
if (v && (v.tagName === "INPUT" || v.tagName === "TEXTAREA" || v.tagName === "SELECT")) return;
|
|
@@ -1656,38 +1599,38 @@ const Hn = {
|
|
|
1656
1599
|
const h = o.selectedId.value;
|
|
1657
1600
|
o.deselect(), a.removeElement(h);
|
|
1658
1601
|
}), Ie(
|
|
1659
|
-
() =>
|
|
1602
|
+
() => c.document,
|
|
1660
1603
|
() => {
|
|
1661
|
-
i("update:modelValue", JSON.parse(JSON.stringify(H(
|
|
1604
|
+
i("update:modelValue", JSON.parse(JSON.stringify(H(c.document))));
|
|
1662
1605
|
},
|
|
1663
1606
|
{ deep: !0 }
|
|
1664
|
-
), (v, h) => (s(),
|
|
1665
|
-
B(
|
|
1666
|
-
|
|
1667
|
-
B(
|
|
1668
|
-
B(
|
|
1607
|
+
), (v, h) => (s(), d("div", Fo, [
|
|
1608
|
+
B(Ho),
|
|
1609
|
+
m("div", Uo, [
|
|
1610
|
+
B(Qn),
|
|
1611
|
+
B(To)
|
|
1669
1612
|
])
|
|
1670
1613
|
]));
|
|
1671
1614
|
}
|
|
1672
|
-
}),
|
|
1615
|
+
}), Jo = /* @__PURE__ */ S(Wo, [["__scopeId", "data-v-f9b95ad8"]]), Qo = {
|
|
1673
1616
|
install(e) {
|
|
1674
|
-
e.component("BrickPdf",
|
|
1617
|
+
e.component("BrickPdf", Jo);
|
|
1675
1618
|
}
|
|
1676
1619
|
};
|
|
1677
1620
|
export {
|
|
1678
|
-
|
|
1621
|
+
Jo as BrickPdf,
|
|
1679
1622
|
ce as createDefaultDocument,
|
|
1680
|
-
|
|
1681
|
-
|
|
1623
|
+
Qo as default,
|
|
1624
|
+
ze as getAllElementDefinitions,
|
|
1682
1625
|
F as getElementDefinition,
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1626
|
+
T as registerElement,
|
|
1627
|
+
Go as unregisterElement,
|
|
1628
|
+
Xo as useClipboard,
|
|
1686
1629
|
Z as useDocumentStore,
|
|
1687
1630
|
be as useDragDrop,
|
|
1688
1631
|
Y as useElementActions,
|
|
1689
1632
|
bt as useHistory,
|
|
1690
1633
|
St as usePdfExport,
|
|
1691
|
-
|
|
1634
|
+
Ko as useResize,
|
|
1692
1635
|
U as useSelection
|
|
1693
1636
|
};
|