brick-pdf 0.2.0 → 0.2.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.css +1 -1
- package/dist/brick-pdf.js +529 -509
- package/dist/brick-pdf.umd.cjs +4 -4
- package/package.json +1 -1
package/dist/brick-pdf.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as _, openBlock as s, createElementBlock as d, normalizeStyle as
|
|
2
|
-
import { useMagicKeys as
|
|
3
|
-
import
|
|
4
|
-
function
|
|
1
|
+
import { defineComponent as _, openBlock as s, createElementBlock as d, normalizeStyle as R, toDisplayString as w, renderSlot as K, normalizeClass as Q, createElementVNode as m, Fragment as C, renderList as E, reactive as $e, provide as D, inject as L, toRaw as H, ref as P, computed as $, createTextVNode as re, createCommentVNode as I, createBlock as M, resolveDynamicComponent as Z, withCtx as W, onMounted as de, onBeforeUnmount as ue, unref as k, resolveComponent as Ie, withDirectives as G, vModelSelect as le, createVNode as B, vModelText as ze, watch as Re } from "vue";
|
|
2
|
+
import { useMagicKeys as Te, whenever as ie } from "@vueuse/core";
|
|
3
|
+
import se from "sortablejs";
|
|
4
|
+
function ee() {
|
|
5
5
|
return {
|
|
6
6
|
pageSize: "A4",
|
|
7
7
|
pageOrientation: "portrait",
|
|
@@ -20,23 +20,23 @@ function T(e) {
|
|
|
20
20
|
function F(e) {
|
|
21
21
|
return J.get(e);
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function Ne() {
|
|
24
24
|
return Array.from(J.values());
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function Ko(e) {
|
|
27
27
|
return J.delete(e);
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function De() {
|
|
30
30
|
return { text: "New Text" };
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function Le() {
|
|
33
33
|
return { fontSize: 12 };
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function Me(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
|
}
|
|
39
|
-
const
|
|
39
|
+
const Be = /* @__PURE__ */ _({
|
|
40
40
|
__name: "TextRenderer",
|
|
41
41
|
props: {
|
|
42
42
|
node: {}
|
|
@@ -44,7 +44,7 @@ const Le = /* @__PURE__ */ _({
|
|
|
44
44
|
setup(e) {
|
|
45
45
|
return (t, n) => (s(), d("div", {
|
|
46
46
|
class: "brick-el-text",
|
|
47
|
-
style:
|
|
47
|
+
style: R({
|
|
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",
|
|
@@ -57,28 +57,28 @@ const Le = /* @__PURE__ */ _({
|
|
|
57
57
|
})
|
|
58
58
|
}, w(e.node.props.text), 5));
|
|
59
59
|
}
|
|
60
|
-
}),
|
|
60
|
+
}), x = (e, t) => {
|
|
61
61
|
const n = e.__vccOpts || e;
|
|
62
62
|
for (const [i, c] of t)
|
|
63
63
|
n[i] = c;
|
|
64
64
|
return n;
|
|
65
|
-
},
|
|
65
|
+
}, Oe = /* @__PURE__ */ x(Be, [["__scopeId", "data-v-a7cd1565"]]), Ae = { class: "brick-text-editor" }, Ve = /* @__PURE__ */ _({
|
|
66
66
|
__name: "TextPropertyEditor",
|
|
67
67
|
props: {
|
|
68
68
|
node: {}
|
|
69
69
|
},
|
|
70
70
|
setup(e) {
|
|
71
|
-
return (t, n) => (s(), d("div",
|
|
71
|
+
return (t, n) => (s(), d("div", Ae));
|
|
72
72
|
}
|
|
73
|
-
}),
|
|
73
|
+
}), He = {
|
|
74
74
|
type: "text",
|
|
75
75
|
label: "Text",
|
|
76
76
|
icon: "T",
|
|
77
77
|
isContainer: !1,
|
|
78
|
-
defaultProps:
|
|
79
|
-
defaultStyle:
|
|
80
|
-
rendererComponent:
|
|
81
|
-
propertyEditorComponent:
|
|
78
|
+
defaultProps: De,
|
|
79
|
+
defaultStyle: Le,
|
|
80
|
+
rendererComponent: Oe,
|
|
81
|
+
propertyEditorComponent: Ve,
|
|
82
82
|
propertyFields: [
|
|
83
83
|
{ key: "props.text", label: "Text Content", section: "content", type: "textarea", defaultValue: "New Text" },
|
|
84
84
|
{ key: "style.fontSize", label: "Font Size", section: "style", type: "number", min: 6, max: 72, step: 1, defaultValue: 12 },
|
|
@@ -103,21 +103,21 @@ 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: Me
|
|
107
107
|
};
|
|
108
|
-
function
|
|
108
|
+
function Fe() {
|
|
109
109
|
return {};
|
|
110
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function Ue() {
|
|
112
112
|
return {};
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function We(e, t) {
|
|
115
115
|
const n = {
|
|
116
116
|
stack: t(e.children)
|
|
117
117
|
};
|
|
118
118
|
return e.style.margin && (n.margin = e.style.margin), e.style.fillColor && (n.fillColor = e.style.fillColor), n;
|
|
119
119
|
}
|
|
120
|
-
const
|
|
120
|
+
const Je = /* @__PURE__ */ _({
|
|
121
121
|
__name: "StackRenderer",
|
|
122
122
|
props: {
|
|
123
123
|
node: {},
|
|
@@ -126,49 +126,49 @@ const Ue = /* @__PURE__ */ _({
|
|
|
126
126
|
setup(e) {
|
|
127
127
|
return (t, n) => (s(), d("div", {
|
|
128
128
|
class: "brick-el-stack",
|
|
129
|
-
style:
|
|
129
|
+
style: R({ backgroundColor: e.node.style.fillColor })
|
|
130
130
|
}, [
|
|
131
|
-
|
|
131
|
+
K(t.$slots, "default", {}, void 0, !0)
|
|
132
132
|
], 4));
|
|
133
133
|
}
|
|
134
|
-
}),
|
|
134
|
+
}), Ye = /* @__PURE__ */ x(Je, [["__scopeId", "data-v-c59e7405"]]), je = { class: "brick-stack-editor" }, qe = /* @__PURE__ */ _({
|
|
135
135
|
__name: "StackPropertyEditor",
|
|
136
136
|
props: {
|
|
137
137
|
node: {}
|
|
138
138
|
},
|
|
139
139
|
setup(e) {
|
|
140
|
-
return (t, n) => (s(), d("div",
|
|
140
|
+
return (t, n) => (s(), d("div", je));
|
|
141
141
|
}
|
|
142
|
-
}),
|
|
142
|
+
}), Ge = {
|
|
143
143
|
type: "stack",
|
|
144
144
|
label: "Stack",
|
|
145
145
|
icon: "☰",
|
|
146
146
|
isContainer: !0,
|
|
147
147
|
acceptsChildTypes: null,
|
|
148
|
-
defaultProps:
|
|
149
|
-
defaultStyle:
|
|
150
|
-
rendererComponent:
|
|
151
|
-
propertyEditorComponent:
|
|
148
|
+
defaultProps: Fe,
|
|
149
|
+
defaultStyle: Ue,
|
|
150
|
+
rendererComponent: Ye,
|
|
151
|
+
propertyEditorComponent: qe,
|
|
152
152
|
propertyFields: [
|
|
153
153
|
{ key: "style.fillColor", label: "Fill Color", section: "style", type: "color" },
|
|
154
154
|
{ key: "style.margin", label: "Margin", section: "layout", type: "margin", defaultValue: [0, 0, 0, 0] }
|
|
155
155
|
],
|
|
156
|
-
toPdfmake:
|
|
156
|
+
toPdfmake: We
|
|
157
157
|
};
|
|
158
|
-
function
|
|
158
|
+
function Xe() {
|
|
159
159
|
return { columnGap: 10 };
|
|
160
160
|
}
|
|
161
|
-
function
|
|
161
|
+
function Ke() {
|
|
162
162
|
return {};
|
|
163
163
|
}
|
|
164
|
-
function
|
|
164
|
+
function Qe(e, t) {
|
|
165
165
|
const n = {
|
|
166
166
|
columns: t(e.children),
|
|
167
167
|
columnGap: e.props.columnGap ?? 10
|
|
168
168
|
};
|
|
169
169
|
return e.style.margin && (n.margin = e.style.margin), n;
|
|
170
170
|
}
|
|
171
|
-
const
|
|
171
|
+
const Ze = /* @__PURE__ */ _({
|
|
172
172
|
__name: "ColumnsRenderer",
|
|
173
173
|
props: {
|
|
174
174
|
node: {},
|
|
@@ -177,36 +177,36 @@ const Ke = /* @__PURE__ */ _({
|
|
|
177
177
|
setup(e) {
|
|
178
178
|
return (t, n) => (s(), d("div", {
|
|
179
179
|
class: "brick-el-columns",
|
|
180
|
-
style:
|
|
180
|
+
style: R({ "--column-gap": (e.node.props.columnGap ?? 10) + "px" })
|
|
181
181
|
}, [
|
|
182
|
-
|
|
182
|
+
K(t.$slots, "default", {}, void 0, !0)
|
|
183
183
|
], 4));
|
|
184
184
|
}
|
|
185
|
-
}),
|
|
185
|
+
}), et = /* @__PURE__ */ x(Ze, [["__scopeId", "data-v-217dd721"]]), tt = { class: "brick-columns-editor" }, nt = /* @__PURE__ */ _({
|
|
186
186
|
__name: "ColumnsPropertyEditor",
|
|
187
187
|
props: {
|
|
188
188
|
node: {}
|
|
189
189
|
},
|
|
190
190
|
setup(e) {
|
|
191
|
-
return (t, n) => (s(), d("div",
|
|
191
|
+
return (t, n) => (s(), d("div", tt));
|
|
192
192
|
}
|
|
193
|
-
}),
|
|
193
|
+
}), ot = {
|
|
194
194
|
type: "columns",
|
|
195
195
|
label: "Columns",
|
|
196
196
|
icon: "▥",
|
|
197
197
|
isContainer: !0,
|
|
198
198
|
acceptsChildTypes: null,
|
|
199
|
-
defaultProps:
|
|
200
|
-
defaultStyle:
|
|
201
|
-
rendererComponent:
|
|
202
|
-
propertyEditorComponent:
|
|
199
|
+
defaultProps: Xe,
|
|
200
|
+
defaultStyle: Ke,
|
|
201
|
+
rendererComponent: et,
|
|
202
|
+
propertyEditorComponent: nt,
|
|
203
203
|
propertyFields: [
|
|
204
204
|
{ key: "props.columnGap", label: "Column Gap", section: "layout", type: "number", min: 0, max: 50, step: 1, defaultValue: 10 },
|
|
205
205
|
{ key: "style.margin", label: "Margin", section: "layout", type: "margin", defaultValue: [0, 0, 0, 0] }
|
|
206
206
|
],
|
|
207
|
-
toPdfmake:
|
|
207
|
+
toPdfmake: Qe
|
|
208
208
|
};
|
|
209
|
-
function
|
|
209
|
+
function rt() {
|
|
210
210
|
return {
|
|
211
211
|
headerRows: 1,
|
|
212
212
|
widths: ["*", "*"],
|
|
@@ -217,10 +217,10 @@ function nt() {
|
|
|
217
217
|
layout: "lightHorizontalLines"
|
|
218
218
|
};
|
|
219
219
|
}
|
|
220
|
-
function
|
|
220
|
+
function lt() {
|
|
221
221
|
return { fontSize: 12 };
|
|
222
222
|
}
|
|
223
|
-
function
|
|
223
|
+
function it(e) {
|
|
224
224
|
const t = e.props.body, n = {
|
|
225
225
|
table: {
|
|
226
226
|
headerRows: e.props.headerRows,
|
|
@@ -232,15 +232,15 @@ function rt(e) {
|
|
|
232
232
|
}, i = e.props.layout;
|
|
233
233
|
return i && i !== "none" && (n.layout = i), e.style.fontSize && (n.fontSize = e.style.fontSize), e.style.color && (n.color = e.style.color), e.style.margin && (n.margin = e.style.margin), n;
|
|
234
234
|
}
|
|
235
|
-
const
|
|
235
|
+
const st = /* @__PURE__ */ _({
|
|
236
236
|
__name: "TableRenderer",
|
|
237
237
|
props: {
|
|
238
238
|
node: {}
|
|
239
239
|
},
|
|
240
240
|
setup(e) {
|
|
241
241
|
return (t, n) => (s(), d("div", {
|
|
242
|
-
class:
|
|
243
|
-
style:
|
|
242
|
+
class: Q(["brick-el-table", "brick-el-table--" + (e.node.props.layout ?? "lightHorizontalLines")]),
|
|
243
|
+
style: R({ fontSize: (e.node.style.fontSize ?? 12) + "px", color: e.node.style.color })
|
|
244
244
|
}, [
|
|
245
245
|
m("table", null, [
|
|
246
246
|
m("thead", null, [
|
|
@@ -260,49 +260,69 @@ const lt = /* @__PURE__ */ _({
|
|
|
260
260
|
])
|
|
261
261
|
], 6));
|
|
262
262
|
}
|
|
263
|
-
}),
|
|
264
|
-
function
|
|
265
|
-
const t =
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
263
|
+
}), at = /* @__PURE__ */ x(st, [["__scopeId", "data-v-b863b05d"]]), pe = /* @__PURE__ */ Symbol("brick-pdf-document-store");
|
|
264
|
+
function ae(e) {
|
|
265
|
+
const t = ee();
|
|
266
|
+
return {
|
|
267
|
+
pageSize: e.pageSize ?? t.pageSize,
|
|
268
|
+
pageOrientation: e.pageOrientation ?? t.pageOrientation,
|
|
269
|
+
pageMargins: e.pageMargins ?? t.pageMargins,
|
|
270
|
+
defaultStyle: e.defaultStyle ?? t.defaultStyle,
|
|
271
|
+
styles: e.styles ?? t.styles,
|
|
272
|
+
content: e.content ?? t.content
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
function X(e) {
|
|
276
|
+
e.props = e.props ?? {}, e.style = e.style ?? {}, e.children = e.children ?? [];
|
|
277
|
+
for (const t of e.children) X(t);
|
|
278
|
+
return e;
|
|
279
|
+
}
|
|
280
|
+
function ct(e) {
|
|
281
|
+
const t = e ? ae(e) : ee();
|
|
282
|
+
for (const a of t.content) X(a);
|
|
283
|
+
const n = $e(t);
|
|
284
|
+
function i(a, r) {
|
|
285
|
+
const l = r ?? n.content;
|
|
286
|
+
for (let y = 0; y < l.length; y++) {
|
|
287
|
+
const g = l[y];
|
|
288
|
+
if (g) {
|
|
289
|
+
if (g.id === a)
|
|
290
|
+
return { node: g, parent: l, index: y };
|
|
291
|
+
if (g.children.length > 0) {
|
|
292
|
+
const f = i(a, g.children);
|
|
293
|
+
if (f) return f;
|
|
276
294
|
}
|
|
277
295
|
}
|
|
278
296
|
}
|
|
279
297
|
return null;
|
|
280
298
|
}
|
|
281
|
-
function
|
|
282
|
-
|
|
299
|
+
function c(a) {
|
|
300
|
+
n.content.splice(0, n.content.length, ...a);
|
|
283
301
|
}
|
|
284
|
-
function
|
|
285
|
-
return JSON.parse(JSON.stringify(H(
|
|
302
|
+
function o() {
|
|
303
|
+
return JSON.parse(JSON.stringify(H(n.content)));
|
|
286
304
|
}
|
|
287
|
-
function
|
|
288
|
-
|
|
305
|
+
function u(a) {
|
|
306
|
+
const r = ae(a);
|
|
307
|
+
for (const l of r.content) X(l);
|
|
308
|
+
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);
|
|
289
309
|
}
|
|
290
|
-
function
|
|
291
|
-
return JSON.parse(JSON.stringify(H(
|
|
310
|
+
function p() {
|
|
311
|
+
return JSON.parse(JSON.stringify(H(n)));
|
|
292
312
|
}
|
|
293
|
-
return { document:
|
|
313
|
+
return { document: n, findNodeById: i, replaceContent: c, snapshotContent: o, loadDocument: u, exportDocument: p };
|
|
294
314
|
}
|
|
295
|
-
function
|
|
296
|
-
D(
|
|
315
|
+
function dt(e) {
|
|
316
|
+
D(pe, e);
|
|
297
317
|
}
|
|
298
|
-
function
|
|
299
|
-
const e = L(
|
|
318
|
+
function te() {
|
|
319
|
+
const e = L(pe);
|
|
300
320
|
if (!e)
|
|
301
321
|
throw new Error("useDocumentStore() requires a BrickPdf ancestor component");
|
|
302
322
|
return e;
|
|
303
323
|
}
|
|
304
|
-
const
|
|
305
|
-
function
|
|
324
|
+
const fe = /* @__PURE__ */ Symbol("brick-pdf-selection");
|
|
325
|
+
function ut(e) {
|
|
306
326
|
const t = P(null), n = $(() => t.value ? e.findNodeById(t.value)?.node ?? null : null);
|
|
307
327
|
function i(o) {
|
|
308
328
|
t.value = o;
|
|
@@ -312,86 +332,86 @@ function ct(e) {
|
|
|
312
332
|
}
|
|
313
333
|
return { selectedId: t, selectedNode: n, select: i, deselect: c };
|
|
314
334
|
}
|
|
315
|
-
function
|
|
316
|
-
D(
|
|
335
|
+
function pt(e) {
|
|
336
|
+
D(fe, e);
|
|
317
337
|
}
|
|
318
338
|
function U() {
|
|
319
|
-
const e = L(
|
|
339
|
+
const e = L(fe);
|
|
320
340
|
if (!e)
|
|
321
341
|
throw new Error("useSelection() requires a BrickPdf ancestor component");
|
|
322
342
|
return e;
|
|
323
343
|
}
|
|
324
|
-
const
|
|
325
|
-
let
|
|
326
|
-
function
|
|
327
|
-
return `el-${Date.now()}-${++
|
|
344
|
+
const me = /* @__PURE__ */ Symbol("brick-pdf-element-actions");
|
|
345
|
+
let ft = 0;
|
|
346
|
+
function ye() {
|
|
347
|
+
return `el-${Date.now()}-${++ft}`;
|
|
328
348
|
}
|
|
329
|
-
function
|
|
349
|
+
function ge(e) {
|
|
330
350
|
return {
|
|
331
351
|
...e,
|
|
332
|
-
id:
|
|
352
|
+
id: ye(),
|
|
333
353
|
props: structuredClone(e.props),
|
|
334
354
|
style: structuredClone(e.style),
|
|
335
|
-
children: e.children.map(
|
|
355
|
+
children: e.children.map(ge)
|
|
336
356
|
};
|
|
337
357
|
}
|
|
338
|
-
function
|
|
339
|
-
function n(
|
|
340
|
-
const y = F(
|
|
358
|
+
function mt(e, t) {
|
|
359
|
+
function n(a, r, l) {
|
|
360
|
+
const y = F(a);
|
|
341
361
|
if (!y) return null;
|
|
342
362
|
t.record();
|
|
343
|
-
const
|
|
344
|
-
id:
|
|
345
|
-
type:
|
|
363
|
+
const g = {
|
|
364
|
+
id: ye(),
|
|
365
|
+
type: a,
|
|
346
366
|
props: y.defaultProps(),
|
|
347
367
|
style: y.defaultStyle(),
|
|
348
368
|
children: []
|
|
349
369
|
}, f = r ? e.findNodeById(r)?.node.children : e.document.content;
|
|
350
370
|
if (!f) return null;
|
|
351
|
-
const
|
|
352
|
-
return f.splice(
|
|
371
|
+
const b = l ?? f.length;
|
|
372
|
+
return f.splice(b, 0, g), g;
|
|
353
373
|
}
|
|
354
|
-
function i(
|
|
355
|
-
const r = e.findNodeById(
|
|
374
|
+
function i(a) {
|
|
375
|
+
const r = e.findNodeById(a);
|
|
356
376
|
r && (t.record(), r.parent.splice(r.index, 1));
|
|
357
377
|
}
|
|
358
|
-
function c(
|
|
359
|
-
const y = e.findNodeById(
|
|
378
|
+
function c(a, r, l) {
|
|
379
|
+
const y = e.findNodeById(a);
|
|
360
380
|
if (!y) return;
|
|
361
381
|
t.record();
|
|
362
|
-
const
|
|
363
|
-
if (!
|
|
382
|
+
const g = y.parent.splice(y.index, 1)[0];
|
|
383
|
+
if (!g) return;
|
|
364
384
|
const f = r ? e.findNodeById(r)?.node.children : e.document.content;
|
|
365
|
-
f && f.splice(l, 0,
|
|
385
|
+
f && f.splice(l, 0, g);
|
|
366
386
|
}
|
|
367
|
-
function o(
|
|
368
|
-
const r = e.findNodeById(
|
|
387
|
+
function o(a) {
|
|
388
|
+
const r = e.findNodeById(a);
|
|
369
389
|
if (!r) return null;
|
|
370
390
|
t.record();
|
|
371
|
-
const l =
|
|
391
|
+
const l = ge(r.node);
|
|
372
392
|
return r.parent.splice(r.index + 1, 0, l), l;
|
|
373
393
|
}
|
|
374
|
-
function u(
|
|
375
|
-
const l = e.findNodeById(
|
|
394
|
+
function u(a, r) {
|
|
395
|
+
const l = e.findNodeById(a);
|
|
376
396
|
l && (t.record(), Object.assign(l.node.props, r));
|
|
377
397
|
}
|
|
378
|
-
function a
|
|
379
|
-
const l = e.findNodeById(
|
|
398
|
+
function p(a, r) {
|
|
399
|
+
const l = e.findNodeById(a);
|
|
380
400
|
l && (t.record(), Object.assign(l.node.style, r));
|
|
381
401
|
}
|
|
382
|
-
return { addElement: n, removeElement: i, moveElement: c, duplicateElement: o, updateProps: u, updateStyle:
|
|
402
|
+
return { addElement: n, removeElement: i, moveElement: c, duplicateElement: o, updateProps: u, updateStyle: p };
|
|
383
403
|
}
|
|
384
|
-
function
|
|
385
|
-
D(
|
|
404
|
+
function yt(e) {
|
|
405
|
+
D(me, e);
|
|
386
406
|
}
|
|
387
407
|
function Y() {
|
|
388
|
-
const e = L(
|
|
408
|
+
const e = L(me);
|
|
389
409
|
if (!e)
|
|
390
410
|
throw new Error("useElementActions() requires a BrickPdf ancestor component");
|
|
391
411
|
return e;
|
|
392
412
|
}
|
|
393
|
-
const
|
|
394
|
-
function
|
|
413
|
+
const be = /* @__PURE__ */ Symbol("brick-pdf-history"), gt = 50;
|
|
414
|
+
function bt(e) {
|
|
395
415
|
const t = P([]), n = P([]);
|
|
396
416
|
let i = 0;
|
|
397
417
|
const c = $(() => t.value.length > 0), o = $(() => n.value.length > 0);
|
|
@@ -400,32 +420,32 @@ function yt(e) {
|
|
|
400
420
|
if (r - i < 100) return;
|
|
401
421
|
i = r;
|
|
402
422
|
const l = e.snapshotContent();
|
|
403
|
-
t.value.push(l), t.value.length >
|
|
423
|
+
t.value.push(l), t.value.length > gt && t.value.shift(), n.value = [];
|
|
404
424
|
}
|
|
405
|
-
function
|
|
425
|
+
function p() {
|
|
406
426
|
const r = t.value.pop();
|
|
407
427
|
r && (n.value.push(e.snapshotContent()), e.replaceContent(r));
|
|
408
428
|
}
|
|
409
|
-
function
|
|
429
|
+
function a() {
|
|
410
430
|
const r = n.value.pop();
|
|
411
431
|
r && (t.value.push(e.snapshotContent()), e.replaceContent(r));
|
|
412
432
|
}
|
|
413
|
-
return { canUndo: c, canRedo: o, record: u, undo:
|
|
433
|
+
return { canUndo: c, canRedo: o, record: u, undo: p, redo: a };
|
|
414
434
|
}
|
|
415
|
-
function
|
|
416
|
-
D(
|
|
435
|
+
function vt(e) {
|
|
436
|
+
D(be, e);
|
|
417
437
|
}
|
|
418
|
-
function
|
|
419
|
-
const e = L(
|
|
438
|
+
function ht() {
|
|
439
|
+
const e = L(be);
|
|
420
440
|
if (!e)
|
|
421
441
|
throw new Error("useHistory() requires a BrickPdf ancestor component");
|
|
422
442
|
return e;
|
|
423
443
|
}
|
|
424
|
-
const
|
|
425
|
-
function
|
|
444
|
+
const ve = /* @__PURE__ */ Symbol("brick-pdf-drag-drop");
|
|
445
|
+
function _t(e, t) {
|
|
426
446
|
const n = P(!1);
|
|
427
447
|
function i(o) {
|
|
428
|
-
return
|
|
448
|
+
return se.create(o, {
|
|
429
449
|
group: { name: "brick-elements", pull: "clone", put: !1 },
|
|
430
450
|
sort: !1,
|
|
431
451
|
animation: 150,
|
|
@@ -438,7 +458,7 @@ function vt(e, t) {
|
|
|
438
458
|
});
|
|
439
459
|
}
|
|
440
460
|
function c(o, u) {
|
|
441
|
-
return
|
|
461
|
+
return se.create(o, {
|
|
442
462
|
group: { name: "brick-elements", put: !0 },
|
|
443
463
|
animation: 150,
|
|
444
464
|
fallbackOnBody: !0,
|
|
@@ -448,51 +468,51 @@ function vt(e, t) {
|
|
|
448
468
|
onStart() {
|
|
449
469
|
n.value = !0;
|
|
450
470
|
},
|
|
451
|
-
onAdd(
|
|
452
|
-
const
|
|
453
|
-
if (!u || !
|
|
471
|
+
onAdd(p) {
|
|
472
|
+
const a = p.item, r = a.dataset.elementId, l = a.dataset.elementType, y = (g) => {
|
|
473
|
+
if (!u || !g) return !1;
|
|
454
474
|
const f = e.findNodeById(u);
|
|
455
475
|
if (!f) return !1;
|
|
456
|
-
const
|
|
457
|
-
return !!(
|
|
476
|
+
const b = F(f.node.type);
|
|
477
|
+
return !!(b?.acceptsChildTypes && !b.acceptsChildTypes.includes(g));
|
|
458
478
|
};
|
|
459
479
|
if (r) {
|
|
460
|
-
if (
|
|
461
|
-
t.moveElement(r, u,
|
|
480
|
+
if (a.parentNode?.removeChild(a), y(l)) return;
|
|
481
|
+
t.moveElement(r, u, p.newIndex ?? 0);
|
|
462
482
|
return;
|
|
463
483
|
}
|
|
464
|
-
l && (
|
|
484
|
+
l && (a.parentNode?.removeChild(a), !y(l) && t.addElement(l, u, p.newIndex));
|
|
465
485
|
},
|
|
466
|
-
onEnd(
|
|
467
|
-
if (n.value = !1,
|
|
468
|
-
const
|
|
469
|
-
if (!
|
|
470
|
-
const r =
|
|
471
|
-
r &&
|
|
486
|
+
onEnd(p) {
|
|
487
|
+
if (n.value = !1, p.from === p.to && p.oldIndex !== void 0 && p.newIndex !== void 0 && p.oldIndex !== p.newIndex && p.item.dataset.elementId) {
|
|
488
|
+
const a = u ? e.findNodeById(u)?.node.children : e.document.content;
|
|
489
|
+
if (!a) return;
|
|
490
|
+
const r = a.splice(p.oldIndex, 1)[0];
|
|
491
|
+
r && a.splice(p.newIndex, 0, r);
|
|
472
492
|
}
|
|
473
493
|
}
|
|
474
494
|
});
|
|
475
495
|
}
|
|
476
496
|
return { initToolbar: i, initContainer: c, isDragging: n };
|
|
477
497
|
}
|
|
478
|
-
function
|
|
479
|
-
D(
|
|
498
|
+
function kt(e) {
|
|
499
|
+
D(ve, e);
|
|
480
500
|
}
|
|
481
|
-
function
|
|
482
|
-
const e = L(
|
|
501
|
+
function he() {
|
|
502
|
+
const e = L(ve);
|
|
483
503
|
if (!e)
|
|
484
504
|
throw new Error("useDragDrop() requires a BrickPdf ancestor component");
|
|
485
505
|
return e;
|
|
486
506
|
}
|
|
487
|
-
const
|
|
488
|
-
function
|
|
489
|
-
return e.map(
|
|
507
|
+
const _e = /* @__PURE__ */ Symbol("brick-pdf-export");
|
|
508
|
+
function St(e) {
|
|
509
|
+
return e.map(ke);
|
|
490
510
|
}
|
|
491
|
-
function
|
|
511
|
+
function ke(e) {
|
|
492
512
|
const t = F(e.type);
|
|
493
|
-
return t ? t.toPdfmake(e,
|
|
513
|
+
return t ? t.toPdfmake(e, St) : { text: `[Unknown: ${e.type}]` };
|
|
494
514
|
}
|
|
495
|
-
function
|
|
515
|
+
function xt(e) {
|
|
496
516
|
function t() {
|
|
497
517
|
const o = e.document;
|
|
498
518
|
return {
|
|
@@ -501,17 +521,17 @@ function kt(e) {
|
|
|
501
521
|
pageMargins: o.pageMargins,
|
|
502
522
|
defaultStyle: JSON.parse(JSON.stringify(H(o.defaultStyle))),
|
|
503
523
|
styles: JSON.parse(JSON.stringify(H(o.styles))),
|
|
504
|
-
content: o.content.map(
|
|
524
|
+
content: o.content.map(ke)
|
|
505
525
|
};
|
|
506
526
|
}
|
|
507
527
|
async function n() {
|
|
508
|
-
const o = await import("pdfmake/build/pdfmake"), u = await import("pdfmake/build/vfs_fonts"),
|
|
509
|
-
return
|
|
528
|
+
const o = await import("pdfmake/build/pdfmake"), u = await import("pdfmake/build/vfs_fonts"), p = o.default || o, a = u.pdfMake;
|
|
529
|
+
return a && a.vfs ? p.vfs = a.vfs : u.default && (p.vfs = u.default), p;
|
|
510
530
|
}
|
|
511
531
|
function i(o) {
|
|
512
532
|
const u = t();
|
|
513
|
-
n().then((
|
|
514
|
-
|
|
533
|
+
n().then((p) => {
|
|
534
|
+
p.createPdf(u).download(o ?? "document.pdf");
|
|
515
535
|
});
|
|
516
536
|
}
|
|
517
537
|
function c() {
|
|
@@ -522,87 +542,87 @@ function kt(e) {
|
|
|
522
542
|
}
|
|
523
543
|
return { toDocumentDefinition: t, exportPdf: i, openPdf: c };
|
|
524
544
|
}
|
|
525
|
-
function
|
|
526
|
-
D(
|
|
545
|
+
function Ct(e) {
|
|
546
|
+
D(_e, e);
|
|
527
547
|
}
|
|
528
|
-
function
|
|
529
|
-
const e = L(
|
|
548
|
+
function wt() {
|
|
549
|
+
const e = L(_e);
|
|
530
550
|
if (!e)
|
|
531
551
|
throw new Error("usePdfExport() requires a BrickPdf ancestor component");
|
|
532
552
|
return e;
|
|
533
553
|
}
|
|
534
|
-
const
|
|
535
|
-
let
|
|
536
|
-
function
|
|
537
|
-
return `el-${Date.now()}-${++
|
|
554
|
+
const Se = /* @__PURE__ */ Symbol("brick-pdf-clipboard");
|
|
555
|
+
let Et = 0;
|
|
556
|
+
function Pt() {
|
|
557
|
+
return `el-${Date.now()}-${++Et}`;
|
|
538
558
|
}
|
|
539
|
-
function
|
|
559
|
+
function xe(e) {
|
|
540
560
|
return {
|
|
541
561
|
...e,
|
|
542
|
-
id:
|
|
562
|
+
id: Pt(),
|
|
543
563
|
props: structuredClone(e.props),
|
|
544
564
|
style: structuredClone(e.style),
|
|
545
|
-
children: e.children.map(
|
|
565
|
+
children: e.children.map(xe)
|
|
546
566
|
};
|
|
547
567
|
}
|
|
548
|
-
function
|
|
568
|
+
function $t(e, t) {
|
|
549
569
|
const n = P(null), i = P(!1), c = P(null), o = P(!1);
|
|
550
570
|
function u(r) {
|
|
551
571
|
const l = e.findNodeById(r);
|
|
552
572
|
l && (n.value = structuredClone(l.node), i.value = !1, c.value = null, o.value = !0);
|
|
553
573
|
}
|
|
554
|
-
function
|
|
574
|
+
function p(r) {
|
|
555
575
|
const l = e.findNodeById(r);
|
|
556
576
|
l && (n.value = structuredClone(l.node), i.value = !0, c.value = r, o.value = !0);
|
|
557
577
|
}
|
|
558
|
-
function
|
|
578
|
+
function a(r) {
|
|
559
579
|
if (!n.value) return;
|
|
560
580
|
i.value && c.value && (t.removeElement(c.value), i.value = !1, c.value = null);
|
|
561
|
-
const l =
|
|
581
|
+
const l = xe(n.value), y = r ? e.findNodeById(r)?.node.children : e.document.content;
|
|
562
582
|
y && (y.push(l), i.value && (n.value = null, o.value = !1));
|
|
563
583
|
}
|
|
564
|
-
return { hasClipboard: o, copy: u, cut:
|
|
584
|
+
return { hasClipboard: o, copy: u, cut: p, paste: a };
|
|
565
585
|
}
|
|
566
|
-
function
|
|
567
|
-
D(
|
|
586
|
+
function It(e) {
|
|
587
|
+
D(Se, e);
|
|
568
588
|
}
|
|
569
|
-
function
|
|
570
|
-
const e = L(
|
|
589
|
+
function Qo() {
|
|
590
|
+
const e = L(Se);
|
|
571
591
|
if (!e)
|
|
572
592
|
throw new Error("useClipboard() requires a BrickPdf ancestor component");
|
|
573
593
|
return e;
|
|
574
594
|
}
|
|
575
|
-
const
|
|
576
|
-
function
|
|
595
|
+
const Ce = /* @__PURE__ */ Symbol("brick-pdf-resize");
|
|
596
|
+
function zt(e) {
|
|
577
597
|
const t = P(!1);
|
|
578
598
|
function n(i, c, o, u) {
|
|
579
599
|
t.value = !0;
|
|
580
|
-
const
|
|
600
|
+
const p = u.clientX, a = u.clientY, r = o.width, l = o.height;
|
|
581
601
|
function y(f) {
|
|
582
|
-
const
|
|
583
|
-
let h = r,
|
|
584
|
-
c.includes("e") && (h = r +
|
|
602
|
+
const b = f.clientX - p, v = f.clientY - a;
|
|
603
|
+
let h = r, S = l;
|
|
604
|
+
c.includes("e") && (h = r + b), c.includes("w") && (h = r - b), c.includes("s") && (S = l + v), c.includes("n") && (S = l - v), h = Math.max(20, h), S = Math.max(20, S), e.updateStyle(i, {
|
|
585
605
|
width: Math.round(h),
|
|
586
|
-
height: Math.round(
|
|
606
|
+
height: Math.round(S)
|
|
587
607
|
});
|
|
588
608
|
}
|
|
589
|
-
function
|
|
590
|
-
t.value = !1, document.removeEventListener("pointermove", y), document.removeEventListener("pointerup",
|
|
609
|
+
function g() {
|
|
610
|
+
t.value = !1, document.removeEventListener("pointermove", y), document.removeEventListener("pointerup", g);
|
|
591
611
|
}
|
|
592
|
-
document.addEventListener("pointermove", y), document.addEventListener("pointerup",
|
|
612
|
+
document.addEventListener("pointermove", y), document.addEventListener("pointerup", g);
|
|
593
613
|
}
|
|
594
614
|
return { isResizing: t, startResize: n };
|
|
595
615
|
}
|
|
596
|
-
function
|
|
597
|
-
D(
|
|
616
|
+
function Rt(e) {
|
|
617
|
+
D(Ce, e);
|
|
598
618
|
}
|
|
599
|
-
function
|
|
600
|
-
const e = L(
|
|
619
|
+
function Zo() {
|
|
620
|
+
const e = L(Ce);
|
|
601
621
|
if (!e)
|
|
602
622
|
throw new Error("useResize() requires a BrickPdf ancestor component");
|
|
603
623
|
return e;
|
|
604
624
|
}
|
|
605
|
-
const
|
|
625
|
+
const Tt = { class: "brick-table-editor" }, Nt = { class: "brick-table-editor__grid" }, Dt = ["onClick"], Lt = { class: "brick-table-editor__row-header" }, Mt = ["onClick"], Bt = ["value", "onInput"], Ot = /* @__PURE__ */ _({
|
|
606
626
|
__name: "TablePropertyEditor",
|
|
607
627
|
props: {
|
|
608
628
|
node: {}
|
|
@@ -615,33 +635,33 @@ const Rt = { class: "brick-table-editor" }, zt = { class: "brick-table-editor__g
|
|
|
615
635
|
function c() {
|
|
616
636
|
return t.node.props.widths ?? [];
|
|
617
637
|
}
|
|
618
|
-
function o(l, y,
|
|
619
|
-
const f = i().map((
|
|
620
|
-
f[l][y] =
|
|
638
|
+
function o(l, y, g) {
|
|
639
|
+
const f = i().map((b) => [...b]);
|
|
640
|
+
f[l][y] = g, n.updateProps(t.node.id, { body: f });
|
|
621
641
|
}
|
|
622
642
|
function u() {
|
|
623
|
-
const l = i().map((
|
|
643
|
+
const l = i().map((g) => [...g]), y = l[0]?.length ?? 2;
|
|
624
644
|
l.push(Array(y).fill("")), n.updateProps(t.node.id, { body: l });
|
|
625
645
|
}
|
|
626
|
-
function
|
|
646
|
+
function p(l) {
|
|
627
647
|
const y = i().map((f) => [...f]);
|
|
628
648
|
if (y.length <= 1) return;
|
|
629
649
|
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 });
|
|
630
650
|
}
|
|
631
|
-
function
|
|
632
|
-
const l = i().map((
|
|
651
|
+
function a() {
|
|
652
|
+
const l = i().map((g) => [...g, ""]), y = [...c(), "*"];
|
|
633
653
|
n.updateProps(t.node.id, { body: l, widths: y });
|
|
634
654
|
}
|
|
635
655
|
function r(l) {
|
|
636
656
|
const y = i().map((f) => {
|
|
637
|
-
const
|
|
638
|
-
return
|
|
657
|
+
const b = [...f];
|
|
658
|
+
return b.splice(l, 1), b;
|
|
639
659
|
});
|
|
640
660
|
if ((y[0]?.length ?? 0) < 1) return;
|
|
641
|
-
const
|
|
642
|
-
|
|
661
|
+
const g = [...c()];
|
|
662
|
+
g.splice(l, 1), n.updateProps(t.node.id, { body: y, widths: g });
|
|
643
663
|
}
|
|
644
|
-
return (l, y) => (s(), d("div",
|
|
664
|
+
return (l, y) => (s(), d("div", Tt, [
|
|
645
665
|
m("div", { class: "brick-table-editor__actions" }, [
|
|
646
666
|
m("button", {
|
|
647
667
|
class: "brick-table-editor__btn",
|
|
@@ -649,46 +669,46 @@ const Rt = { class: "brick-table-editor" }, zt = { class: "brick-table-editor__g
|
|
|
649
669
|
}, "+ Row"),
|
|
650
670
|
m("button", {
|
|
651
671
|
class: "brick-table-editor__btn",
|
|
652
|
-
onClick:
|
|
672
|
+
onClick: a
|
|
653
673
|
}, "+ Column")
|
|
654
674
|
]),
|
|
655
|
-
m("div",
|
|
675
|
+
m("div", Nt, [
|
|
656
676
|
m("table", null, [
|
|
657
677
|
m("thead", null, [
|
|
658
678
|
m("tr", null, [
|
|
659
679
|
y[0] || (y[0] = m("th", { class: "brick-table-editor__corner" }, null, -1)),
|
|
660
|
-
(s(!0), d(C, null, E(i()[0] ?? [], (
|
|
680
|
+
(s(!0), d(C, null, E(i()[0] ?? [], (g, f) => (s(), d("th", {
|
|
661
681
|
key: f,
|
|
662
682
|
class: "brick-table-editor__col-header"
|
|
663
683
|
}, [
|
|
664
|
-
|
|
684
|
+
re(" Col " + w(f + 1) + " ", 1),
|
|
665
685
|
(i()[0]?.length ?? 0) > 1 ? (s(), d("button", {
|
|
666
686
|
key: 0,
|
|
667
687
|
class: "brick-table-editor__remove-btn",
|
|
668
688
|
title: "Remove column",
|
|
669
|
-
onClick: (
|
|
670
|
-
}, "x", 8,
|
|
689
|
+
onClick: (b) => r(f)
|
|
690
|
+
}, "x", 8, Dt)) : I("", !0)
|
|
671
691
|
]))), 128))
|
|
672
692
|
])
|
|
673
693
|
]),
|
|
674
694
|
m("tbody", null, [
|
|
675
|
-
(s(!0), d(C, null, E(i(), (
|
|
676
|
-
m("td",
|
|
677
|
-
|
|
695
|
+
(s(!0), d(C, null, E(i(), (g, f) => (s(), d("tr", { key: f }, [
|
|
696
|
+
m("td", Lt, [
|
|
697
|
+
re(w(f + 1) + " ", 1),
|
|
678
698
|
i().length > 1 ? (s(), d("button", {
|
|
679
699
|
key: 0,
|
|
680
700
|
class: "brick-table-editor__remove-btn",
|
|
681
701
|
title: "Remove row",
|
|
682
|
-
onClick: (
|
|
683
|
-
}, "x", 8,
|
|
702
|
+
onClick: (b) => p(f)
|
|
703
|
+
}, "x", 8, Mt)) : I("", !0)
|
|
684
704
|
]),
|
|
685
|
-
(s(!0), d(C, null, E(
|
|
705
|
+
(s(!0), d(C, null, E(g, (b, v) => (s(), d("td", { key: v }, [
|
|
686
706
|
m("input", {
|
|
687
707
|
class: "brick-table-editor__cell",
|
|
688
708
|
type: "text",
|
|
689
|
-
value:
|
|
709
|
+
value: b,
|
|
690
710
|
onInput: (h) => o(f, v, h.target.value)
|
|
691
|
-
}, null, 40,
|
|
711
|
+
}, null, 40, Bt)
|
|
692
712
|
]))), 128))
|
|
693
713
|
]))), 128))
|
|
694
714
|
])
|
|
@@ -696,15 +716,15 @@ const Rt = { class: "brick-table-editor" }, zt = { class: "brick-table-editor__g
|
|
|
696
716
|
])
|
|
697
717
|
]));
|
|
698
718
|
}
|
|
699
|
-
}),
|
|
719
|
+
}), At = /* @__PURE__ */ x(Ot, [["__scopeId", "data-v-4895020c"]]), Vt = {
|
|
700
720
|
type: "table",
|
|
701
721
|
label: "Table",
|
|
702
722
|
icon: "▦",
|
|
703
723
|
isContainer: !1,
|
|
704
|
-
defaultProps:
|
|
705
|
-
defaultStyle:
|
|
706
|
-
rendererComponent:
|
|
707
|
-
propertyEditorComponent:
|
|
724
|
+
defaultProps: rt,
|
|
725
|
+
defaultStyle: lt,
|
|
726
|
+
rendererComponent: at,
|
|
727
|
+
propertyEditorComponent: At,
|
|
708
728
|
propertyFields: [
|
|
709
729
|
{ key: "props.headerRows", label: "Header Rows", section: "content", type: "number", min: 0, max: 10, step: 1, defaultValue: 1 },
|
|
710
730
|
{ key: "props.layout", label: "Border Style", section: "style", type: "select", options: [
|
|
@@ -718,59 +738,59 @@ const Rt = { class: "brick-table-editor" }, zt = { class: "brick-table-editor__g
|
|
|
718
738
|
{ key: "style.color", label: "Text Color", section: "style", type: "color", defaultValue: "#000000" },
|
|
719
739
|
{ key: "style.margin", label: "Margin", section: "layout", type: "margin", defaultValue: [0, 0, 0, 0] }
|
|
720
740
|
],
|
|
721
|
-
toPdfmake:
|
|
741
|
+
toPdfmake: it
|
|
722
742
|
};
|
|
723
|
-
function
|
|
743
|
+
function Ht() {
|
|
724
744
|
return { src: "", width: 200, height: 150, fit: null };
|
|
725
745
|
}
|
|
726
|
-
function
|
|
746
|
+
function Ft() {
|
|
727
747
|
return {};
|
|
728
748
|
}
|
|
729
|
-
function
|
|
749
|
+
function Ut(e) {
|
|
730
750
|
const t = {
|
|
731
751
|
image: e.props.src
|
|
732
752
|
};
|
|
733
753
|
return e.props.width && (t.width = e.props.width), e.props.height && (t.height = e.props.height), e.props.fit && (t.fit = e.props.fit), e.style.margin && (t.margin = e.style.margin), e.style.alignment && (t.alignment = e.style.alignment), e.style.opacity !== void 0 && (t.opacity = e.style.opacity), t;
|
|
734
754
|
}
|
|
735
|
-
const
|
|
755
|
+
const Wt = { class: "brick-el-image" }, Jt = ["src"], Yt = {
|
|
736
756
|
key: 1,
|
|
737
757
|
class: "brick-el-image__placeholder"
|
|
738
|
-
},
|
|
758
|
+
}, jt = /* @__PURE__ */ _({
|
|
739
759
|
__name: "ImageRenderer",
|
|
740
760
|
props: {
|
|
741
761
|
node: {}
|
|
742
762
|
},
|
|
743
763
|
setup(e) {
|
|
744
|
-
return (t, n) => (s(), d("div",
|
|
764
|
+
return (t, n) => (s(), d("div", Wt, [
|
|
745
765
|
e.node.props.src ? (s(), d("img", {
|
|
746
766
|
key: 0,
|
|
747
767
|
src: e.node.props.src,
|
|
748
|
-
style:
|
|
768
|
+
style: R({
|
|
749
769
|
width: e.node.props.width + "px",
|
|
750
770
|
height: e.node.props.height + "px",
|
|
751
771
|
objectFit: "contain",
|
|
752
772
|
opacity: e.node.style.opacity
|
|
753
773
|
})
|
|
754
|
-
}, null, 12,
|
|
774
|
+
}, null, 12, Jt)) : (s(), d("div", Yt, " No image selected "))
|
|
755
775
|
]));
|
|
756
776
|
}
|
|
757
|
-
}),
|
|
777
|
+
}), qt = /* @__PURE__ */ x(jt, [["__scopeId", "data-v-38184258"]]), Gt = { class: "brick-image-editor" }, Xt = /* @__PURE__ */ _({
|
|
758
778
|
__name: "ImagePropertyEditor",
|
|
759
779
|
props: {
|
|
760
780
|
node: {}
|
|
761
781
|
},
|
|
762
782
|
setup(e) {
|
|
763
|
-
return (t, n) => (s(), d("div",
|
|
783
|
+
return (t, n) => (s(), d("div", Gt));
|
|
764
784
|
}
|
|
765
|
-
}),
|
|
785
|
+
}), Kt = {
|
|
766
786
|
type: "image",
|
|
767
787
|
label: "Image",
|
|
768
788
|
icon: "🖼",
|
|
769
789
|
isContainer: !1,
|
|
770
|
-
defaultProps:
|
|
771
|
-
defaultStyle:
|
|
772
|
-
rendererComponent:
|
|
773
|
-
propertyEditorComponent:
|
|
790
|
+
defaultProps: Ht,
|
|
791
|
+
defaultStyle: Ft,
|
|
792
|
+
rendererComponent: qt,
|
|
793
|
+
propertyEditorComponent: Xt,
|
|
774
794
|
propertyFields: [
|
|
775
795
|
{ key: "props.src", label: "Image (Base64)", section: "content", type: "file" },
|
|
776
796
|
{ key: "props.width", label: "Width", section: "layout", type: "number", min: 10, max: 1e3, step: 10, defaultValue: 200 },
|
|
@@ -783,19 +803,19 @@ const Ft = { class: "brick-el-image" }, Ut = ["src"], Wt = {
|
|
|
783
803
|
{ key: "style.margin", label: "Margin", section: "layout", type: "margin", defaultValue: [0, 0, 0, 0] },
|
|
784
804
|
{ key: "style.opacity", label: "Opacity", section: "advanced", type: "slider", min: 0, max: 1, step: 0.1, defaultValue: 1 }
|
|
785
805
|
],
|
|
786
|
-
toPdfmake:
|
|
806
|
+
toPdfmake: Ut
|
|
787
807
|
};
|
|
788
|
-
function
|
|
808
|
+
function Qt() {
|
|
789
809
|
return { ordered: !1, items: ["Item 1", "Item 2", "Item 3"] };
|
|
790
810
|
}
|
|
791
|
-
function
|
|
811
|
+
function Zt() {
|
|
792
812
|
return { fontSize: 12 };
|
|
793
813
|
}
|
|
794
|
-
function
|
|
814
|
+
function en(e) {
|
|
795
815
|
const t = e.props.items, i = e.props.ordered ? { ol: t } : { ul: t };
|
|
796
816
|
return e.style.fontSize && (i.fontSize = e.style.fontSize), e.style.color && (i.color = e.style.color), e.style.margin && (i.margin = e.style.margin), i;
|
|
797
817
|
}
|
|
798
|
-
const
|
|
818
|
+
const tn = /* @__PURE__ */ _({
|
|
799
819
|
__name: "ListRenderer",
|
|
800
820
|
props: {
|
|
801
821
|
node: {}
|
|
@@ -803,9 +823,9 @@ const Zt = /* @__PURE__ */ _({
|
|
|
803
823
|
setup(e) {
|
|
804
824
|
return (t, n) => (s(), d("div", {
|
|
805
825
|
class: "brick-el-list",
|
|
806
|
-
style:
|
|
826
|
+
style: R({ fontSize: (e.node.style.fontSize ?? 12) + "px", color: e.node.style.color })
|
|
807
827
|
}, [
|
|
808
|
-
(s(), M(
|
|
828
|
+
(s(), M(Z(e.node.props.ordered ? "ol" : "ul"), null, {
|
|
809
829
|
default: W(() => [
|
|
810
830
|
(s(!0), d(C, null, E(e.node.props.items, (i, c) => (s(), d("li", { key: c }, w(i), 1))), 128))
|
|
811
831
|
]),
|
|
@@ -813,23 +833,23 @@ const Zt = /* @__PURE__ */ _({
|
|
|
813
833
|
}))
|
|
814
834
|
], 4));
|
|
815
835
|
}
|
|
816
|
-
}),
|
|
836
|
+
}), nn = /* @__PURE__ */ x(tn, [["__scopeId", "data-v-8107f859"]]), on = { class: "brick-list-editor" }, rn = /* @__PURE__ */ _({
|
|
817
837
|
__name: "ListPropertyEditor",
|
|
818
838
|
props: {
|
|
819
839
|
node: {}
|
|
820
840
|
},
|
|
821
841
|
setup(e) {
|
|
822
|
-
return (t, n) => (s(), d("div",
|
|
842
|
+
return (t, n) => (s(), d("div", on));
|
|
823
843
|
}
|
|
824
|
-
}),
|
|
844
|
+
}), ln = {
|
|
825
845
|
type: "list",
|
|
826
846
|
label: "List",
|
|
827
847
|
icon: "☰",
|
|
828
848
|
isContainer: !1,
|
|
829
|
-
defaultProps:
|
|
830
|
-
defaultStyle:
|
|
831
|
-
rendererComponent:
|
|
832
|
-
propertyEditorComponent:
|
|
849
|
+
defaultProps: Qt,
|
|
850
|
+
defaultStyle: Zt,
|
|
851
|
+
rendererComponent: nn,
|
|
852
|
+
propertyEditorComponent: rn,
|
|
833
853
|
propertyFields: [
|
|
834
854
|
{ key: "props.ordered", label: "Ordered", section: "content", type: "toggle", defaultValue: !1 },
|
|
835
855
|
{ key: "props.items", label: "Items", section: "content", type: "textarea", defaultValue: `Item 1
|
|
@@ -839,22 +859,22 @@ Item 3` },
|
|
|
839
859
|
{ key: "style.color", label: "Color", section: "style", type: "color", defaultValue: "#000000" },
|
|
840
860
|
{ key: "style.margin", label: "Margin", section: "layout", type: "margin", defaultValue: [0, 0, 0, 0] }
|
|
841
861
|
],
|
|
842
|
-
toPdfmake:
|
|
862
|
+
toPdfmake: en
|
|
843
863
|
};
|
|
844
|
-
function
|
|
864
|
+
function sn() {
|
|
845
865
|
return { data: "https://example.com", fit: 100 };
|
|
846
866
|
}
|
|
847
|
-
function
|
|
867
|
+
function an() {
|
|
848
868
|
return {};
|
|
849
869
|
}
|
|
850
|
-
function
|
|
870
|
+
function cn(e) {
|
|
851
871
|
const t = {
|
|
852
872
|
qr: e.props.data,
|
|
853
873
|
fit: e.props.fit ?? 100
|
|
854
874
|
};
|
|
855
875
|
return e.style.alignment && (t.alignment = e.style.alignment), e.style.margin && (t.margin = e.style.margin), t;
|
|
856
876
|
}
|
|
857
|
-
const
|
|
877
|
+
const dn = { class: "brick-el-qr__preview" }, un = /* @__PURE__ */ _({
|
|
858
878
|
__name: "QrRenderer",
|
|
859
879
|
props: {
|
|
860
880
|
node: {}
|
|
@@ -862,31 +882,31 @@ const an = { class: "brick-el-qr__preview" }, cn = /* @__PURE__ */ _({
|
|
|
862
882
|
setup(e) {
|
|
863
883
|
return (t, n) => (s(), d("div", {
|
|
864
884
|
class: "brick-el-qr",
|
|
865
|
-
style:
|
|
885
|
+
style: R({
|
|
866
886
|
width: (e.node.props.fit ?? 100) + "px",
|
|
867
887
|
height: (e.node.props.fit ?? 100) + "px"
|
|
868
888
|
})
|
|
869
889
|
}, [
|
|
870
|
-
m("div",
|
|
890
|
+
m("div", dn, "QR: " + w(e.node.props.data), 1)
|
|
871
891
|
], 4));
|
|
872
892
|
}
|
|
873
|
-
}),
|
|
893
|
+
}), pn = /* @__PURE__ */ x(un, [["__scopeId", "data-v-f106ba48"]]), fn = { class: "brick-qr-editor" }, mn = /* @__PURE__ */ _({
|
|
874
894
|
__name: "QrPropertyEditor",
|
|
875
895
|
props: {
|
|
876
896
|
node: {}
|
|
877
897
|
},
|
|
878
898
|
setup(e) {
|
|
879
|
-
return (t, n) => (s(), d("div",
|
|
899
|
+
return (t, n) => (s(), d("div", fn));
|
|
880
900
|
}
|
|
881
|
-
}),
|
|
901
|
+
}), yn = {
|
|
882
902
|
type: "qr",
|
|
883
903
|
label: "QR Code",
|
|
884
904
|
icon: "⊞",
|
|
885
905
|
isContainer: !1,
|
|
886
|
-
defaultProps:
|
|
887
|
-
defaultStyle:
|
|
888
|
-
rendererComponent:
|
|
889
|
-
propertyEditorComponent:
|
|
906
|
+
defaultProps: sn,
|
|
907
|
+
defaultStyle: an,
|
|
908
|
+
rendererComponent: pn,
|
|
909
|
+
propertyEditorComponent: mn,
|
|
890
910
|
propertyFields: [
|
|
891
911
|
{ key: "props.data", label: "QR Data", section: "content", type: "text", defaultValue: "https://example.com" },
|
|
892
912
|
{ key: "props.fit", label: "Size (px)", section: "layout", type: "number", min: 50, max: 500, step: 10, defaultValue: 100 },
|
|
@@ -897,25 +917,25 @@ const an = { class: "brick-el-qr__preview" }, cn = /* @__PURE__ */ _({
|
|
|
897
917
|
] },
|
|
898
918
|
{ key: "style.margin", label: "Margin", section: "layout", type: "margin", defaultValue: [0, 0, 0, 0] }
|
|
899
919
|
],
|
|
900
|
-
toPdfmake:
|
|
920
|
+
toPdfmake: cn
|
|
901
921
|
};
|
|
902
|
-
function
|
|
922
|
+
function gn() {
|
|
903
923
|
return {
|
|
904
924
|
svg: '<svg viewBox="0 0 100 100"><rect width="100" height="100" fill="#eee" /><text x="50" y="55" text-anchor="middle" font-size="12">SVG</text></svg>',
|
|
905
925
|
width: 200,
|
|
906
926
|
height: 200
|
|
907
927
|
};
|
|
908
928
|
}
|
|
909
|
-
function
|
|
929
|
+
function bn() {
|
|
910
930
|
return {};
|
|
911
931
|
}
|
|
912
|
-
function
|
|
932
|
+
function vn(e) {
|
|
913
933
|
const t = {
|
|
914
934
|
svg: e.props.svg
|
|
915
935
|
};
|
|
916
936
|
return e.props.width && (t.width = e.props.width), e.props.height && (t.height = e.props.height), e.style.margin && (t.margin = e.style.margin), e.style.alignment && (t.alignment = e.style.alignment), t;
|
|
917
937
|
}
|
|
918
|
-
const
|
|
938
|
+
const hn = ["innerHTML"], _n = /* @__PURE__ */ _({
|
|
919
939
|
__name: "SvgRenderer",
|
|
920
940
|
props: {
|
|
921
941
|
node: {}
|
|
@@ -923,30 +943,30 @@ const bn = ["innerHTML"], vn = /* @__PURE__ */ _({
|
|
|
923
943
|
setup(e) {
|
|
924
944
|
return (t, n) => (s(), d("div", {
|
|
925
945
|
class: "brick-el-svg",
|
|
926
|
-
style:
|
|
946
|
+
style: R({
|
|
927
947
|
width: e.node.props.width + "px",
|
|
928
948
|
height: e.node.props.height + "px"
|
|
929
949
|
}),
|
|
930
950
|
innerHTML: e.node.props.svg
|
|
931
|
-
}, null, 12,
|
|
951
|
+
}, null, 12, hn));
|
|
932
952
|
}
|
|
933
|
-
}),
|
|
953
|
+
}), kn = /* @__PURE__ */ x(_n, [["__scopeId", "data-v-5e9f3319"]]), Sn = { class: "brick-svg-editor" }, xn = /* @__PURE__ */ _({
|
|
934
954
|
__name: "SvgPropertyEditor",
|
|
935
955
|
props: {
|
|
936
956
|
node: {}
|
|
937
957
|
},
|
|
938
958
|
setup(e) {
|
|
939
|
-
return (t, n) => (s(), d("div",
|
|
959
|
+
return (t, n) => (s(), d("div", Sn));
|
|
940
960
|
}
|
|
941
|
-
}),
|
|
961
|
+
}), Cn = {
|
|
942
962
|
type: "svg",
|
|
943
963
|
label: "SVG",
|
|
944
964
|
icon: "◇",
|
|
945
965
|
isContainer: !1,
|
|
946
|
-
defaultProps:
|
|
947
|
-
defaultStyle:
|
|
948
|
-
rendererComponent:
|
|
949
|
-
propertyEditorComponent:
|
|
966
|
+
defaultProps: gn,
|
|
967
|
+
defaultStyle: bn,
|
|
968
|
+
rendererComponent: kn,
|
|
969
|
+
propertyEditorComponent: xn,
|
|
950
970
|
propertyFields: [
|
|
951
971
|
{ key: "props.svg", label: "SVG Markup", section: "content", type: "textarea" },
|
|
952
972
|
{ key: "props.width", label: "Width", section: "layout", type: "number", min: 10, max: 1e3, step: 10, defaultValue: 200 },
|
|
@@ -958,59 +978,59 @@ const bn = ["innerHTML"], vn = /* @__PURE__ */ _({
|
|
|
958
978
|
] },
|
|
959
979
|
{ key: "style.margin", label: "Margin", section: "layout", type: "margin", defaultValue: [0, 0, 0, 0] }
|
|
960
980
|
],
|
|
961
|
-
toPdfmake:
|
|
981
|
+
toPdfmake: vn
|
|
962
982
|
};
|
|
963
|
-
function
|
|
983
|
+
function wn() {
|
|
964
984
|
return {};
|
|
965
985
|
}
|
|
966
|
-
function
|
|
986
|
+
function En() {
|
|
967
987
|
return {};
|
|
968
988
|
}
|
|
969
|
-
function
|
|
989
|
+
function Pn(e) {
|
|
970
990
|
return { text: "", pageBreak: "after" };
|
|
971
991
|
}
|
|
972
|
-
const
|
|
992
|
+
const $n = { class: "brick-el-pagebreak" }, In = /* @__PURE__ */ _({
|
|
973
993
|
__name: "PageBreakRenderer",
|
|
974
994
|
props: {
|
|
975
995
|
node: {}
|
|
976
996
|
},
|
|
977
997
|
setup(e) {
|
|
978
|
-
return (t, n) => (s(), d("div",
|
|
998
|
+
return (t, n) => (s(), d("div", $n, [...n[0] || (n[0] = [
|
|
979
999
|
m("hr", null, null, -1),
|
|
980
1000
|
m("span", null, "Page Break", -1),
|
|
981
1001
|
m("hr", null, null, -1)
|
|
982
1002
|
])]));
|
|
983
1003
|
}
|
|
984
|
-
}),
|
|
1004
|
+
}), zn = /* @__PURE__ */ x(In, [["__scopeId", "data-v-60c05148"]]), Rn = { class: "brick-pagebreak-editor" }, Tn = /* @__PURE__ */ _({
|
|
985
1005
|
__name: "PageBreakPropertyEditor",
|
|
986
1006
|
props: {
|
|
987
1007
|
node: {}
|
|
988
1008
|
},
|
|
989
1009
|
setup(e) {
|
|
990
|
-
return (t, n) => (s(), d("div",
|
|
1010
|
+
return (t, n) => (s(), d("div", Rn, [...n[0] || (n[0] = [
|
|
991
1011
|
m("p", { style: { color: "#999", "font-size": "12px" } }, "No configurable properties.", -1)
|
|
992
1012
|
])]));
|
|
993
1013
|
}
|
|
994
|
-
}),
|
|
1014
|
+
}), Nn = {
|
|
995
1015
|
type: "pageBreak",
|
|
996
1016
|
label: "Page Break",
|
|
997
1017
|
icon: "⏎",
|
|
998
1018
|
isContainer: !1,
|
|
999
|
-
defaultProps:
|
|
1000
|
-
defaultStyle:
|
|
1001
|
-
rendererComponent:
|
|
1002
|
-
propertyEditorComponent:
|
|
1019
|
+
defaultProps: wn,
|
|
1020
|
+
defaultStyle: En,
|
|
1021
|
+
rendererComponent: zn,
|
|
1022
|
+
propertyEditorComponent: Tn,
|
|
1003
1023
|
propertyFields: [],
|
|
1004
|
-
toPdfmake:
|
|
1024
|
+
toPdfmake: Pn
|
|
1005
1025
|
};
|
|
1006
|
-
let
|
|
1007
|
-
function
|
|
1008
|
-
|
|
1026
|
+
let ce = !1;
|
|
1027
|
+
function Dn() {
|
|
1028
|
+
ce || (ce = !0, T(He), T(Ge), T(ot), T(Vt), T(Kt), T(ln), T(yn), T(Cn), T(Nn));
|
|
1009
1029
|
}
|
|
1010
|
-
const
|
|
1030
|
+
const Ln = {
|
|
1011
1031
|
key: 0,
|
|
1012
1032
|
class: "brick-dropzone__empty"
|
|
1013
|
-
},
|
|
1033
|
+
}, Mn = /* @__PURE__ */ _({
|
|
1014
1034
|
__name: "DropZone",
|
|
1015
1035
|
props: {
|
|
1016
1036
|
parentId: {},
|
|
@@ -1019,79 +1039,79 @@ const Nn = {
|
|
|
1019
1039
|
setup(e) {
|
|
1020
1040
|
const t = e, n = P(null);
|
|
1021
1041
|
let i = null;
|
|
1022
|
-
const c =
|
|
1023
|
-
return
|
|
1042
|
+
const c = he(), { isDragging: o } = c;
|
|
1043
|
+
return de(() => {
|
|
1024
1044
|
n.value && (i = c.initContainer(n.value, t.parentId));
|
|
1025
|
-
}),
|
|
1045
|
+
}), ue(() => {
|
|
1026
1046
|
i?.destroy();
|
|
1027
|
-
}), (u,
|
|
1047
|
+
}), (u, p) => (s(), d("div", {
|
|
1028
1048
|
ref_key: "el",
|
|
1029
1049
|
ref: n,
|
|
1030
|
-
class:
|
|
1050
|
+
class: Q(["brick-dropzone", { "brick-dropzone--horizontal": e.layout === "horizontal", "brick-dropzone--drag-active": k(o) && e.layout === "horizontal" }])
|
|
1031
1051
|
}, [
|
|
1032
|
-
|
|
1033
|
-
u.$slots.default ? I("", !0) : (s(), d("div",
|
|
1052
|
+
K(u.$slots, "default", {}, void 0, !0),
|
|
1053
|
+
u.$slots.default ? I("", !0) : (s(), d("div", Ln, " Drop elements here "))
|
|
1034
1054
|
], 2));
|
|
1035
1055
|
}
|
|
1036
|
-
}),
|
|
1056
|
+
}), we = /* @__PURE__ */ x(Mn, [["__scopeId", "data-v-b9596dad"]]), Bn = ["data-element-id", "data-element-type"], On = {
|
|
1037
1057
|
key: 1,
|
|
1038
1058
|
class: "brick-canvas-element__unknown"
|
|
1039
|
-
},
|
|
1059
|
+
}, An = /* @__PURE__ */ _({
|
|
1040
1060
|
__name: "CanvasElement",
|
|
1041
1061
|
props: {
|
|
1042
1062
|
node: {},
|
|
1043
1063
|
path: {}
|
|
1044
1064
|
},
|
|
1045
1065
|
setup(e) {
|
|
1046
|
-
const t = e, n = U(), i = Y(), c = P(null), o = $(() => F(t.node.type)), u = $(() => n.selectedId.value === t.node.id),
|
|
1066
|
+
const t = e, n = U(), i = Y(), c = P(null), o = $(() => F(t.node.type)), u = $(() => n.selectedId.value === t.node.id), p = $(() => o.value ? o.value.propertyFields.some((f) => f.key === "props.width" || f.key === "style.width") : !1), a = $(() => o.value ? o.value.propertyFields.some((f) => f.key === "props.height" || f.key === "style.height") : !1);
|
|
1047
1067
|
function r(f) {
|
|
1048
1068
|
f.stopPropagation(), n.select(t.node.id);
|
|
1049
1069
|
}
|
|
1050
1070
|
function l(f) {
|
|
1051
1071
|
f.stopPropagation(), f.preventDefault();
|
|
1052
|
-
const
|
|
1053
|
-
function h(
|
|
1054
|
-
const O =
|
|
1072
|
+
const b = f.clientX, v = c.value?.offsetWidth ?? 200;
|
|
1073
|
+
function h(z) {
|
|
1074
|
+
const O = z.clientX - b, N = Math.max(20, v + O);
|
|
1055
1075
|
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) });
|
|
1056
1076
|
}
|
|
1057
|
-
function
|
|
1058
|
-
document.removeEventListener("pointermove", h), document.removeEventListener("pointerup",
|
|
1077
|
+
function S() {
|
|
1078
|
+
document.removeEventListener("pointermove", h), document.removeEventListener("pointerup", S), document.body.style.cursor = "", document.body.style.userSelect = "";
|
|
1059
1079
|
}
|
|
1060
|
-
document.body.style.cursor = "ew-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove", h), document.addEventListener("pointerup",
|
|
1080
|
+
document.body.style.cursor = "ew-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove", h), document.addEventListener("pointerup", S);
|
|
1061
1081
|
}
|
|
1062
1082
|
function y(f) {
|
|
1063
1083
|
f.stopPropagation(), f.preventDefault();
|
|
1064
|
-
const
|
|
1065
|
-
function h(
|
|
1066
|
-
const O =
|
|
1084
|
+
const b = f.clientY, v = c.value?.offsetHeight ?? 100;
|
|
1085
|
+
function h(z) {
|
|
1086
|
+
const O = z.clientY - b, N = Math.max(20, v + O);
|
|
1067
1087
|
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) });
|
|
1068
1088
|
}
|
|
1069
|
-
function
|
|
1070
|
-
document.removeEventListener("pointermove", h), document.removeEventListener("pointerup",
|
|
1089
|
+
function S() {
|
|
1090
|
+
document.removeEventListener("pointermove", h), document.removeEventListener("pointerup", S), document.body.style.cursor = "", document.body.style.userSelect = "";
|
|
1071
1091
|
}
|
|
1072
|
-
document.body.style.cursor = "ns-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove", h), document.addEventListener("pointerup",
|
|
1092
|
+
document.body.style.cursor = "ns-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove", h), document.addEventListener("pointerup", S);
|
|
1073
1093
|
}
|
|
1074
|
-
function
|
|
1094
|
+
function g(f) {
|
|
1075
1095
|
f.stopPropagation(), f.preventDefault();
|
|
1076
|
-
const
|
|
1077
|
-
function
|
|
1078
|
-
const j = N.clientX -
|
|
1079
|
-
|
|
1096
|
+
const b = f.clientX, v = f.clientY, h = c.value?.offsetWidth ?? 200, S = c.value?.offsetHeight ?? 100;
|
|
1097
|
+
function z(N) {
|
|
1098
|
+
const j = N.clientX - b, V = N.clientY - v, ne = Math.max(20, h + j), oe = Math.max(20, S + V), Ee = o.value?.propertyFields.some((q) => q.key === "props.width"), Pe = o.value?.propertyFields.some((q) => q.key === "props.height");
|
|
1099
|
+
Ee ? i.updateProps(t.node.id, { width: Math.round(ne) }) : i.updateStyle(t.node.id, { width: Math.round(ne) }), Pe ? i.updateProps(t.node.id, { height: Math.round(oe) }) : i.updateStyle(t.node.id, { height: Math.round(oe) });
|
|
1080
1100
|
}
|
|
1081
1101
|
function O() {
|
|
1082
|
-
document.removeEventListener("pointermove",
|
|
1102
|
+
document.removeEventListener("pointermove", z), document.removeEventListener("pointerup", O), document.body.style.cursor = "", document.body.style.userSelect = "";
|
|
1083
1103
|
}
|
|
1084
|
-
document.body.style.cursor = "nwse-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove",
|
|
1104
|
+
document.body.style.cursor = "nwse-resize", document.body.style.userSelect = "none", document.addEventListener("pointermove", z), document.addEventListener("pointerup", O);
|
|
1085
1105
|
}
|
|
1086
|
-
return (f,
|
|
1087
|
-
const v =
|
|
1106
|
+
return (f, b) => {
|
|
1107
|
+
const v = Ie("CanvasElement", !0);
|
|
1088
1108
|
return s(), d("div", {
|
|
1089
1109
|
ref_key: "elRef",
|
|
1090
1110
|
ref: c,
|
|
1091
|
-
class:
|
|
1111
|
+
class: Q(["brick-canvas-element", { "brick-canvas-element--selected": u.value }]),
|
|
1092
1112
|
"data-element-id": e.node.id,
|
|
1093
1113
|
"data-element-type": e.node.type,
|
|
1094
|
-
style:
|
|
1114
|
+
style: R({
|
|
1095
1115
|
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,
|
|
1096
1116
|
height: e.node.style.height ? e.node.style.height + "px" : e.node.props.height ? e.node.props.height + "px" : void 0,
|
|
1097
1117
|
marginTop: e.node.style.margin?.[1] + "px",
|
|
@@ -1102,53 +1122,53 @@ const Nn = {
|
|
|
1102
1122
|
}),
|
|
1103
1123
|
onClick: r
|
|
1104
1124
|
}, [
|
|
1105
|
-
o.value ? (s(), M(
|
|
1125
|
+
o.value ? (s(), M(Z(o.value.rendererComponent), {
|
|
1106
1126
|
key: 0,
|
|
1107
1127
|
node: e.node,
|
|
1108
1128
|
path: e.path
|
|
1109
1129
|
}, {
|
|
1110
1130
|
default: W(() => [
|
|
1111
|
-
o.value.isContainer ? (s(), M(
|
|
1131
|
+
o.value.isContainer ? (s(), M(we, {
|
|
1112
1132
|
key: 0,
|
|
1113
1133
|
"parent-id": e.node.id,
|
|
1114
1134
|
layout: e.node.type === "columns" ? "horizontal" : "vertical"
|
|
1115
1135
|
}, {
|
|
1116
1136
|
default: W(() => [
|
|
1117
|
-
(s(!0), d(C, null, E(e.node.children, (h,
|
|
1137
|
+
(s(!0), d(C, null, E(e.node.children, (h, S) => (s(), M(v, {
|
|
1118
1138
|
key: h.id,
|
|
1119
1139
|
node: h,
|
|
1120
|
-
path: [...e.path,
|
|
1140
|
+
path: [...e.path, S]
|
|
1121
1141
|
}, null, 8, ["node", "path"]))), 128))
|
|
1122
1142
|
]),
|
|
1123
1143
|
_: 1
|
|
1124
1144
|
}, 8, ["parent-id", "layout"])) : I("", !0)
|
|
1125
1145
|
]),
|
|
1126
1146
|
_: 1
|
|
1127
|
-
}, 8, ["node", "path"])) : (s(), d("div",
|
|
1147
|
+
}, 8, ["node", "path"])) : (s(), d("div", On, " Unknown element: " + w(e.node.type), 1)),
|
|
1128
1148
|
u.value ? (s(), d(C, { key: 2 }, [
|
|
1129
|
-
|
|
1149
|
+
p.value ? (s(), d("div", {
|
|
1130
1150
|
key: 0,
|
|
1131
1151
|
class: "brick-resize-handle brick-resize-handle--e",
|
|
1132
1152
|
onPointerdown: l
|
|
1133
1153
|
}, null, 32)) : I("", !0),
|
|
1134
|
-
|
|
1154
|
+
a.value ? (s(), d("div", {
|
|
1135
1155
|
key: 1,
|
|
1136
1156
|
class: "brick-resize-handle brick-resize-handle--s",
|
|
1137
1157
|
onPointerdown: y
|
|
1138
1158
|
}, null, 32)) : I("", !0),
|
|
1139
|
-
|
|
1159
|
+
p.value && a.value ? (s(), d("div", {
|
|
1140
1160
|
key: 2,
|
|
1141
1161
|
class: "brick-resize-handle brick-resize-handle--se",
|
|
1142
|
-
onPointerdown:
|
|
1162
|
+
onPointerdown: g
|
|
1143
1163
|
}, null, 32)) : I("", !0)
|
|
1144
1164
|
], 64)) : I("", !0)
|
|
1145
|
-
], 14,
|
|
1165
|
+
], 14, Bn);
|
|
1146
1166
|
};
|
|
1147
1167
|
}
|
|
1148
|
-
}),
|
|
1168
|
+
}), Vn = /* @__PURE__ */ x(An, [["__scopeId", "data-v-6b9cadc1"]]), Hn = { class: "brick-doc-bar" }, Fn = { class: "brick-doc-bar__field" }, Un = ["value"], Wn = { class: "brick-doc-bar__field" }, Jn = { class: "brick-doc-bar__field brick-doc-bar__field--margins" }, Yn = { class: "brick-doc-bar__margins" }, jn = ["placeholder", "title", "value", "onInput"], qn = { class: "brick-doc-bar__field" }, Gn = ["value"], Xn = /* @__PURE__ */ _({
|
|
1149
1169
|
__name: "DocumentSettings",
|
|
1150
1170
|
setup(e) {
|
|
1151
|
-
const t =
|
|
1171
|
+
const t = te(), n = [
|
|
1152
1172
|
{ label: "A3", value: "A3" },
|
|
1153
1173
|
{ label: "A4", value: "A4" },
|
|
1154
1174
|
{ label: "A5", value: "A5" },
|
|
@@ -1159,8 +1179,8 @@ const Nn = {
|
|
|
1159
1179
|
const u = [...t.document.pageMargins];
|
|
1160
1180
|
u[c] = o, t.document.pageMargins = u;
|
|
1161
1181
|
}
|
|
1162
|
-
return (c, o) => (s(), d("div",
|
|
1163
|
-
m("div",
|
|
1182
|
+
return (c, o) => (s(), d("div", Hn, [
|
|
1183
|
+
m("div", Fn, [
|
|
1164
1184
|
o[3] || (o[3] = m("label", null, "Size", -1)),
|
|
1165
1185
|
G(m("select", {
|
|
1166
1186
|
"onUpdate:modelValue": o[0] || (o[0] = (u) => k(t).document.pageSize = u)
|
|
@@ -1168,12 +1188,12 @@ const Nn = {
|
|
|
1168
1188
|
(s(), d(C, null, E(n, (u) => m("option", {
|
|
1169
1189
|
key: u.value,
|
|
1170
1190
|
value: u.value
|
|
1171
|
-
}, w(u.label), 9,
|
|
1191
|
+
}, w(u.label), 9, Un)), 64))
|
|
1172
1192
|
], 512), [
|
|
1173
|
-
[
|
|
1193
|
+
[le, k(t).document.pageSize]
|
|
1174
1194
|
])
|
|
1175
1195
|
]),
|
|
1176
|
-
m("div",
|
|
1196
|
+
m("div", Wn, [
|
|
1177
1197
|
o[5] || (o[5] = m("label", null, "Orientation", -1)),
|
|
1178
1198
|
G(m("select", {
|
|
1179
1199
|
"onUpdate:modelValue": o[1] || (o[1] = (u) => k(t).document.pageOrientation = u)
|
|
@@ -1181,62 +1201,62 @@ const Nn = {
|
|
|
1181
1201
|
m("option", { value: "portrait" }, "Portrait", -1),
|
|
1182
1202
|
m("option", { value: "landscape" }, "Landscape", -1)
|
|
1183
1203
|
])], 512), [
|
|
1184
|
-
[
|
|
1204
|
+
[le, k(t).document.pageOrientation]
|
|
1185
1205
|
])
|
|
1186
1206
|
]),
|
|
1187
|
-
m("div",
|
|
1207
|
+
m("div", Jn, [
|
|
1188
1208
|
o[6] || (o[6] = m("label", null, "Margins", -1)),
|
|
1189
|
-
m("div",
|
|
1190
|
-
(s(), d(C, null, E(["L", "T", "R", "B"], (u,
|
|
1191
|
-
key:
|
|
1209
|
+
m("div", Yn, [
|
|
1210
|
+
(s(), d(C, null, E(["L", "T", "R", "B"], (u, p) => m("input", {
|
|
1211
|
+
key: p,
|
|
1192
1212
|
type: "number",
|
|
1193
1213
|
placeholder: u,
|
|
1194
1214
|
title: u,
|
|
1195
|
-
value: k(t).document.pageMargins[
|
|
1196
|
-
onInput: (
|
|
1197
|
-
}, null, 40,
|
|
1215
|
+
value: k(t).document.pageMargins[p],
|
|
1216
|
+
onInput: (a) => i(p, Number(a.target.value))
|
|
1217
|
+
}, null, 40, jn)), 64))
|
|
1198
1218
|
])
|
|
1199
1219
|
]),
|
|
1200
|
-
m("div",
|
|
1220
|
+
m("div", qn, [
|
|
1201
1221
|
o[7] || (o[7] = m("label", null, "Font Size", -1)),
|
|
1202
1222
|
m("input", {
|
|
1203
1223
|
type: "number",
|
|
1204
|
-
value: k(t).document.defaultStyle
|
|
1224
|
+
value: k(t).document.defaultStyle?.fontSize ?? 12,
|
|
1205
1225
|
min: "6",
|
|
1206
1226
|
max: "72",
|
|
1207
|
-
onInput: o[2] || (o[2] = (u) => k(t).document.defaultStyle.fontSize = Number(u.target.value))
|
|
1208
|
-
}, null, 40,
|
|
1227
|
+
onInput: o[2] || (o[2] = (u) => (k(t).document.defaultStyle ??= {}).fontSize = Number(u.target.value))
|
|
1228
|
+
}, null, 40, Gn)
|
|
1209
1229
|
])
|
|
1210
1230
|
]));
|
|
1211
1231
|
}
|
|
1212
|
-
}),
|
|
1232
|
+
}), Kn = /* @__PURE__ */ x(Xn, [["__scopeId", "data-v-39a2b54f"]]), Qn = { class: "brick-canvas" }, A = 0.75, Zn = /* @__PURE__ */ _({
|
|
1213
1233
|
__name: "DesignCanvas",
|
|
1214
1234
|
setup(e) {
|
|
1215
|
-
const t =
|
|
1235
|
+
const t = te(), n = U(), i = {
|
|
1216
1236
|
A3: [841.89, 1190.55],
|
|
1217
1237
|
A4: [595.28, 841.89],
|
|
1218
1238
|
A5: [419.53, 595.28],
|
|
1219
1239
|
LETTER: [612, 792],
|
|
1220
1240
|
LEGAL: [612, 1008]
|
|
1221
1241
|
}, c = $(() => {
|
|
1222
|
-
const [
|
|
1242
|
+
const [p, a] = i[t.document.pageSize] ?? i.A4, r = t.document.pageOrientation === "landscape" ? a : p;
|
|
1223
1243
|
return Math.round(r * A);
|
|
1224
1244
|
}), o = $(() => {
|
|
1225
|
-
const [
|
|
1245
|
+
const [p, a] = i[t.document.pageSize] ?? i.A4, r = t.document.pageOrientation === "landscape" ? p : a;
|
|
1226
1246
|
return Math.round(r * A);
|
|
1227
1247
|
});
|
|
1228
|
-
function u(
|
|
1229
|
-
(
|
|
1248
|
+
function u(p) {
|
|
1249
|
+
(p.target === p.currentTarget || p.target.classList.contains("brick-canvas__page")) && n.deselect();
|
|
1230
1250
|
}
|
|
1231
|
-
return (
|
|
1232
|
-
B(
|
|
1251
|
+
return (p, a) => (s(), d("div", Qn, [
|
|
1252
|
+
B(Kn),
|
|
1233
1253
|
m("div", {
|
|
1234
1254
|
class: "brick-canvas__scroll",
|
|
1235
1255
|
onClick: u
|
|
1236
1256
|
}, [
|
|
1237
1257
|
m("div", {
|
|
1238
1258
|
class: "brick-canvas__page",
|
|
1239
|
-
style:
|
|
1259
|
+
style: R({
|
|
1240
1260
|
width: c.value + "px",
|
|
1241
1261
|
minHeight: o.value + "px",
|
|
1242
1262
|
paddingTop: k(t).document.pageMargins[1] * A + "px",
|
|
@@ -1245,9 +1265,9 @@ const Nn = {
|
|
|
1245
1265
|
paddingLeft: k(t).document.pageMargins[0] * A + "px"
|
|
1246
1266
|
})
|
|
1247
1267
|
}, [
|
|
1248
|
-
B(
|
|
1268
|
+
B(we, { "parent-id": null }, {
|
|
1249
1269
|
default: W(() => [
|
|
1250
|
-
(s(!0), d(C, null, E(k(t).document.content, (r, l) => (s(), M(
|
|
1270
|
+
(s(!0), d(C, null, E(k(t).document.content, (r, l) => (s(), M(Vn, {
|
|
1251
1271
|
key: r.id,
|
|
1252
1272
|
node: r,
|
|
1253
1273
|
path: [l]
|
|
@@ -1259,41 +1279,41 @@ const Nn = {
|
|
|
1259
1279
|
])
|
|
1260
1280
|
]));
|
|
1261
1281
|
}
|
|
1262
|
-
}),
|
|
1282
|
+
}), eo = /* @__PURE__ */ x(Zn, [["__scopeId", "data-v-364329ec"]]), to = ["data-element-type"], no = { class: "brick-element-list__icon" }, oo = { class: "brick-element-list__label" }, ro = /* @__PURE__ */ _({
|
|
1263
1283
|
__name: "ToolbarElementList",
|
|
1264
1284
|
setup(e) {
|
|
1265
1285
|
const t = P(null);
|
|
1266
1286
|
let n = null;
|
|
1267
|
-
const i =
|
|
1268
|
-
return
|
|
1287
|
+
const i = he(), c = Ne();
|
|
1288
|
+
return de(() => {
|
|
1269
1289
|
t.value && (n = i.initToolbar(t.value));
|
|
1270
|
-
}),
|
|
1290
|
+
}), ue(() => {
|
|
1271
1291
|
n?.destroy();
|
|
1272
1292
|
}), (o, u) => (s(), d("div", {
|
|
1273
1293
|
ref_key: "el",
|
|
1274
1294
|
ref: t,
|
|
1275
1295
|
class: "brick-element-list"
|
|
1276
1296
|
}, [
|
|
1277
|
-
(s(!0), d(C, null, E(k(c), (
|
|
1278
|
-
key:
|
|
1297
|
+
(s(!0), d(C, null, E(k(c), (p) => (s(), d("div", {
|
|
1298
|
+
key: p.type,
|
|
1279
1299
|
class: "brick-element-list__item",
|
|
1280
|
-
"data-element-type":
|
|
1300
|
+
"data-element-type": p.type
|
|
1281
1301
|
}, [
|
|
1282
|
-
m("span",
|
|
1283
|
-
m("span",
|
|
1284
|
-
], 8,
|
|
1302
|
+
m("span", no, w(p.icon), 1),
|
|
1303
|
+
m("span", oo, w(p.label), 1)
|
|
1304
|
+
], 8, to))), 128))
|
|
1285
1305
|
], 512));
|
|
1286
1306
|
}
|
|
1287
|
-
}),
|
|
1307
|
+
}), lo = /* @__PURE__ */ x(ro, [["__scopeId", "data-v-2d0b1dbf"]]), io = { class: "brick-field" }, so = { class: "brick-field__label" }, ao = ["value"], co = ["value"], uo = ["value", "min", "max", "step"], po = ["value"], fo = ["value"], mo = ["value"], yo = {
|
|
1288
1308
|
key: 5,
|
|
1289
1309
|
class: "brick-field__toggle"
|
|
1290
|
-
},
|
|
1310
|
+
}, go = ["checked"], bo = {
|
|
1291
1311
|
key: 6,
|
|
1292
1312
|
class: "brick-field__margin"
|
|
1293
|
-
},
|
|
1313
|
+
}, vo = ["placeholder", "value", "onInput"], ho = {
|
|
1294
1314
|
key: 7,
|
|
1295
1315
|
class: "brick-field__slider"
|
|
1296
|
-
},
|
|
1316
|
+
}, _o = ["value", "min", "max", "step"], ko = { class: "brick-field__slider-value" }, So = /* @__PURE__ */ _({
|
|
1297
1317
|
__name: "PropertyField",
|
|
1298
1318
|
props: {
|
|
1299
1319
|
descriptor: {},
|
|
@@ -1301,49 +1321,49 @@ const Nn = {
|
|
|
1301
1321
|
},
|
|
1302
1322
|
setup(e) {
|
|
1303
1323
|
const t = e, n = Y(), i = $(() => {
|
|
1304
|
-
const
|
|
1324
|
+
const a = t.descriptor.key.split("."), r = a[0], l = a[1];
|
|
1305
1325
|
if (r === "props")
|
|
1306
1326
|
return t.node.props[l];
|
|
1307
1327
|
if (r === "style")
|
|
1308
1328
|
return t.node.style[l];
|
|
1309
1329
|
}), c = $(() => {
|
|
1310
|
-
const
|
|
1311
|
-
return t.descriptor.type === "textarea" && Array.isArray(
|
|
1312
|
-
`) :
|
|
1330
|
+
const a = i.value;
|
|
1331
|
+
return t.descriptor.type === "textarea" && Array.isArray(a) ? a.join(`
|
|
1332
|
+
`) : a;
|
|
1313
1333
|
});
|
|
1314
|
-
function o(
|
|
1334
|
+
function o(a) {
|
|
1315
1335
|
const r = t.descriptor.key.split("."), l = r[0], y = r[1];
|
|
1316
|
-
let
|
|
1317
|
-
t.descriptor.type === "textarea" && Array.isArray(i.value) && (
|
|
1318
|
-
`)), l === "props" ? n.updateProps(t.node.id, { [y]:
|
|
1336
|
+
let g = a;
|
|
1337
|
+
t.descriptor.type === "textarea" && Array.isArray(i.value) && (g = a.split(`
|
|
1338
|
+
`)), l === "props" ? n.updateProps(t.node.id, { [y]: g }) : l === "style" && n.updateStyle(t.node.id, { [y]: g });
|
|
1319
1339
|
}
|
|
1320
|
-
function u(
|
|
1340
|
+
function u(a, r) {
|
|
1321
1341
|
const y = [...c.value ?? [0, 0, 0, 0]];
|
|
1322
|
-
y[
|
|
1342
|
+
y[a] = r, o(y);
|
|
1323
1343
|
}
|
|
1324
|
-
function a
|
|
1325
|
-
const l =
|
|
1344
|
+
function p(a) {
|
|
1345
|
+
const l = a.target.files?.[0];
|
|
1326
1346
|
if (!l) return;
|
|
1327
1347
|
const y = new FileReader();
|
|
1328
1348
|
y.onload = () => {
|
|
1329
1349
|
o(y.result);
|
|
1330
1350
|
}, y.readAsDataURL(l);
|
|
1331
1351
|
}
|
|
1332
|
-
return (
|
|
1333
|
-
m("label",
|
|
1352
|
+
return (a, r) => (s(), d("div", io, [
|
|
1353
|
+
m("label", so, w(e.descriptor.label), 1),
|
|
1334
1354
|
e.descriptor.type === "text" ? (s(), d("input", {
|
|
1335
1355
|
key: 0,
|
|
1336
1356
|
type: "text",
|
|
1337
1357
|
class: "brick-field__input",
|
|
1338
1358
|
value: c.value,
|
|
1339
1359
|
onInput: r[0] || (r[0] = (l) => o(l.target.value))
|
|
1340
|
-
}, null, 40,
|
|
1360
|
+
}, null, 40, ao)) : e.descriptor.type === "textarea" ? (s(), d("textarea", {
|
|
1341
1361
|
key: 1,
|
|
1342
1362
|
class: "brick-field__textarea",
|
|
1343
1363
|
value: c.value,
|
|
1344
1364
|
rows: "3",
|
|
1345
1365
|
onInput: r[1] || (r[1] = (l) => o(l.target.value))
|
|
1346
|
-
}, null, 40,
|
|
1366
|
+
}, null, 40, co)) : e.descriptor.type === "number" ? (s(), d("input", {
|
|
1347
1367
|
key: 2,
|
|
1348
1368
|
type: "number",
|
|
1349
1369
|
class: "brick-field__input",
|
|
@@ -1352,13 +1372,13 @@ const Nn = {
|
|
|
1352
1372
|
max: e.descriptor.max,
|
|
1353
1373
|
step: e.descriptor.step,
|
|
1354
1374
|
onInput: r[2] || (r[2] = (l) => o(Number(l.target.value)))
|
|
1355
|
-
}, null, 40,
|
|
1375
|
+
}, null, 40, uo)) : e.descriptor.type === "color" ? (s(), d("input", {
|
|
1356
1376
|
key: 3,
|
|
1357
1377
|
type: "color",
|
|
1358
1378
|
class: "brick-field__color",
|
|
1359
1379
|
value: c.value ?? "#000000",
|
|
1360
1380
|
onInput: r[3] || (r[3] = (l) => o(l.target.value))
|
|
1361
|
-
}, null, 40,
|
|
1381
|
+
}, null, 40, po)) : e.descriptor.type === "select" ? (s(), d("select", {
|
|
1362
1382
|
key: 4,
|
|
1363
1383
|
class: "brick-field__select",
|
|
1364
1384
|
value: c.value,
|
|
@@ -1367,24 +1387,24 @@ const Nn = {
|
|
|
1367
1387
|
(s(!0), d(C, null, E(e.descriptor.options, (l) => (s(), d("option", {
|
|
1368
1388
|
key: String(l.value),
|
|
1369
1389
|
value: l.value
|
|
1370
|
-
}, w(l.label), 9,
|
|
1371
|
-
], 40,
|
|
1390
|
+
}, w(l.label), 9, mo))), 128))
|
|
1391
|
+
], 40, fo)) : e.descriptor.type === "toggle" ? (s(), d("label", yo, [
|
|
1372
1392
|
m("input", {
|
|
1373
1393
|
type: "checkbox",
|
|
1374
1394
|
checked: c.value,
|
|
1375
1395
|
onChange: r[5] || (r[5] = (l) => o(l.target.checked))
|
|
1376
|
-
}, null, 40,
|
|
1396
|
+
}, null, 40, go),
|
|
1377
1397
|
m("span", null, w(c.value ? "On" : "Off"), 1)
|
|
1378
|
-
])) : e.descriptor.type === "margin" ? (s(), d("div",
|
|
1398
|
+
])) : e.descriptor.type === "margin" ? (s(), d("div", bo, [
|
|
1379
1399
|
(s(), d(C, null, E(["L", "T", "R", "B"], (l, y) => m("input", {
|
|
1380
1400
|
key: l,
|
|
1381
1401
|
type: "number",
|
|
1382
1402
|
class: "brick-field__margin-input",
|
|
1383
1403
|
placeholder: l,
|
|
1384
1404
|
value: (c.value ?? [0, 0, 0, 0])[y],
|
|
1385
|
-
onInput: (
|
|
1386
|
-
}, null, 40,
|
|
1387
|
-
])) : e.descriptor.type === "slider" ? (s(), d("div",
|
|
1405
|
+
onInput: (g) => u(y, Number(g.target.value))
|
|
1406
|
+
}, null, 40, vo)), 64))
|
|
1407
|
+
])) : e.descriptor.type === "slider" ? (s(), d("div", ho, [
|
|
1388
1408
|
m("input", {
|
|
1389
1409
|
type: "range",
|
|
1390
1410
|
value: c.value,
|
|
@@ -1392,24 +1412,24 @@ const Nn = {
|
|
|
1392
1412
|
max: e.descriptor.max,
|
|
1393
1413
|
step: e.descriptor.step,
|
|
1394
1414
|
onInput: r[6] || (r[6] = (l) => o(Number(l.target.value)))
|
|
1395
|
-
}, null, 40,
|
|
1396
|
-
m("span",
|
|
1415
|
+
}, null, 40, _o),
|
|
1416
|
+
m("span", ko, w(c.value), 1)
|
|
1397
1417
|
])) : e.descriptor.type === "file" ? (s(), d("input", {
|
|
1398
1418
|
key: 8,
|
|
1399
1419
|
type: "file",
|
|
1400
1420
|
accept: "image/*",
|
|
1401
1421
|
class: "brick-field__file",
|
|
1402
|
-
onChange:
|
|
1422
|
+
onChange: p
|
|
1403
1423
|
}, null, 32)) : I("", !0)
|
|
1404
1424
|
]));
|
|
1405
1425
|
}
|
|
1406
|
-
}),
|
|
1426
|
+
}), xo = /* @__PURE__ */ x(So, [["__scopeId", "data-v-5a3bec1b"]]), Co = {
|
|
1407
1427
|
key: 0,
|
|
1408
1428
|
class: "brick-property-editor"
|
|
1409
|
-
},
|
|
1429
|
+
}, wo = { class: "brick-property-editor__type" }, Eo = {
|
|
1410
1430
|
key: 0,
|
|
1411
1431
|
class: "brick-property-editor__group"
|
|
1412
|
-
},
|
|
1432
|
+
}, Po = { class: "brick-property-editor__group-title" }, $o = /* @__PURE__ */ _({
|
|
1413
1433
|
__name: "PropertyEditor",
|
|
1414
1434
|
setup(e) {
|
|
1415
1435
|
const t = U(), n = $(() => {
|
|
@@ -1418,8 +1438,8 @@ const Nn = {
|
|
|
1418
1438
|
}), i = $(() => {
|
|
1419
1439
|
if (!n.value) return {};
|
|
1420
1440
|
const u = {};
|
|
1421
|
-
for (const
|
|
1422
|
-
u[
|
|
1441
|
+
for (const p of n.value.propertyFields)
|
|
1442
|
+
u[p.section] || (u[p.section] = []), u[p.section].push(p);
|
|
1423
1443
|
return u;
|
|
1424
1444
|
}), c = {
|
|
1425
1445
|
content: "Content",
|
|
@@ -1427,110 +1447,110 @@ const Nn = {
|
|
|
1427
1447
|
layout: "Layout",
|
|
1428
1448
|
advanced: "Advanced"
|
|
1429
1449
|
}, o = ["content", "style", "layout", "advanced"];
|
|
1430
|
-
return (u,
|
|
1431
|
-
m("div",
|
|
1432
|
-
(s(), d(C, null, E(o, (
|
|
1433
|
-
i.value[
|
|
1434
|
-
m("div",
|
|
1435
|
-
(s(!0), d(C, null, E(i.value[
|
|
1450
|
+
return (u, p) => k(t).selectedNode.value && n.value ? (s(), d("div", Co, [
|
|
1451
|
+
m("div", wo, w(n.value.icon) + " " + w(n.value.label), 1),
|
|
1452
|
+
(s(), d(C, null, E(o, (a) => (s(), d(C, { key: a }, [
|
|
1453
|
+
i.value[a] ? (s(), d("div", Eo, [
|
|
1454
|
+
m("div", Po, w(c[a]), 1),
|
|
1455
|
+
(s(!0), d(C, null, E(i.value[a], (r) => (s(), M(xo, {
|
|
1436
1456
|
key: r.key,
|
|
1437
1457
|
descriptor: r,
|
|
1438
1458
|
node: k(t).selectedNode.value
|
|
1439
1459
|
}, null, 8, ["descriptor", "node"]))), 128))
|
|
1440
1460
|
])) : I("", !0)
|
|
1441
1461
|
], 64))), 64)),
|
|
1442
|
-
(s(), M(
|
|
1462
|
+
(s(), M(Z(n.value.propertyEditorComponent), {
|
|
1443
1463
|
node: k(t).selectedNode.value
|
|
1444
1464
|
}, null, 8, ["node"]))
|
|
1445
1465
|
])) : I("", !0);
|
|
1446
1466
|
}
|
|
1447
|
-
}),
|
|
1467
|
+
}), Io = /* @__PURE__ */ x($o, [["__scopeId", "data-v-4d129dac"]]), zo = { class: "brick-toolbar" }, Ro = { class: "brick-toolbar__section" }, To = {
|
|
1448
1468
|
key: 0,
|
|
1449
1469
|
class: "brick-toolbar__section"
|
|
1450
|
-
},
|
|
1470
|
+
}, No = /* @__PURE__ */ _({
|
|
1451
1471
|
__name: "Toolbar",
|
|
1452
1472
|
setup(e) {
|
|
1453
1473
|
const t = U();
|
|
1454
|
-
return (n, i) => (s(), d("div",
|
|
1455
|
-
m("div",
|
|
1474
|
+
return (n, i) => (s(), d("div", zo, [
|
|
1475
|
+
m("div", Ro, [
|
|
1456
1476
|
i[0] || (i[0] = m("h3", { class: "brick-toolbar__title" }, "Elements", -1)),
|
|
1457
|
-
B(
|
|
1477
|
+
B(lo)
|
|
1458
1478
|
]),
|
|
1459
|
-
k(t).selectedNode.value ? (s(), d("div",
|
|
1479
|
+
k(t).selectedNode.value ? (s(), d("div", To, [
|
|
1460
1480
|
i[1] || (i[1] = m("h3", { class: "brick-toolbar__title" }, "Properties", -1)),
|
|
1461
|
-
B(
|
|
1481
|
+
B(Io)
|
|
1462
1482
|
])) : I("", !0)
|
|
1463
1483
|
]));
|
|
1464
1484
|
}
|
|
1465
|
-
}),
|
|
1485
|
+
}), Do = /* @__PURE__ */ x(No, [["__scopeId", "data-v-0174c069"]]), Lo = { class: "brick-actionbar" }, Mo = { class: "brick-actionbar__group" }, Bo = { class: "brick-actionbar__group" }, Oo = ["disabled"], Ao = ["disabled"], Vo = ["disabled"], Ho = { class: "brick-actionbar__group" }, Fo = /* @__PURE__ */ _({
|
|
1466
1486
|
__name: "ActionBar",
|
|
1467
1487
|
setup(e) {
|
|
1468
|
-
const t =
|
|
1469
|
-
function
|
|
1488
|
+
const t = ht(), n = wt(), i = U(), c = Y(), o = te(), u = P("document"), p = P(null);
|
|
1489
|
+
function a() {
|
|
1470
1490
|
const f = i.selectedId.value;
|
|
1471
1491
|
f && (i.deselect(), c.removeElement(f));
|
|
1472
1492
|
}
|
|
1473
1493
|
function r() {
|
|
1474
|
-
const f = u.value.trim() || "document",
|
|
1475
|
-
n.exportPdf(
|
|
1494
|
+
const f = u.value.trim() || "document", b = f.endsWith(".pdf") ? f : f + ".pdf";
|
|
1495
|
+
n.exportPdf(b);
|
|
1476
1496
|
}
|
|
1477
1497
|
function l() {
|
|
1478
|
-
const f = o.exportDocument(),
|
|
1479
|
-
|
|
1498
|
+
const f = o.exportDocument(), b = JSON.stringify(f, null, 2), v = new Blob([b], { type: "application/json" }), h = URL.createObjectURL(v), S = document.createElement("a"), z = u.value.trim() || "document";
|
|
1499
|
+
S.href = h, S.download = z.endsWith(".json") ? z : z + ".json", S.click(), URL.revokeObjectURL(h);
|
|
1480
1500
|
}
|
|
1481
1501
|
function y() {
|
|
1482
|
-
|
|
1502
|
+
p.value?.click();
|
|
1483
1503
|
}
|
|
1484
|
-
function
|
|
1485
|
-
const
|
|
1504
|
+
function g(f) {
|
|
1505
|
+
const b = f.target, v = b.files?.[0];
|
|
1486
1506
|
if (!v) return;
|
|
1487
1507
|
const h = new FileReader();
|
|
1488
1508
|
h.onload = () => {
|
|
1489
1509
|
try {
|
|
1490
|
-
const
|
|
1491
|
-
if (!
|
|
1510
|
+
const S = JSON.parse(h.result);
|
|
1511
|
+
if (!S.content || !S.pageSize) {
|
|
1492
1512
|
alert("Invalid brick-pdf JSON file.");
|
|
1493
1513
|
return;
|
|
1494
1514
|
}
|
|
1495
|
-
i.deselect(), o.loadDocument(
|
|
1515
|
+
i.deselect(), o.loadDocument(S);
|
|
1496
1516
|
} catch {
|
|
1497
1517
|
alert("Failed to parse JSON file.");
|
|
1498
1518
|
}
|
|
1499
|
-
}, h.readAsText(v),
|
|
1519
|
+
}, h.readAsText(v), b.value = "";
|
|
1500
1520
|
}
|
|
1501
|
-
return (f,
|
|
1502
|
-
m("div",
|
|
1521
|
+
return (f, b) => (s(), d("div", Lo, [
|
|
1522
|
+
m("div", Mo, [
|
|
1503
1523
|
G(m("input", {
|
|
1504
|
-
"onUpdate:modelValue":
|
|
1524
|
+
"onUpdate:modelValue": b[0] || (b[0] = (v) => u.value = v),
|
|
1505
1525
|
class: "brick-actionbar__name",
|
|
1506
1526
|
type: "text",
|
|
1507
1527
|
placeholder: "Document name",
|
|
1508
1528
|
title: "Document name (used for export filename)"
|
|
1509
1529
|
}, null, 512), [
|
|
1510
|
-
[
|
|
1530
|
+
[ze, u.value]
|
|
1511
1531
|
])
|
|
1512
1532
|
]),
|
|
1513
|
-
m("div",
|
|
1533
|
+
m("div", Bo, [
|
|
1514
1534
|
m("button", {
|
|
1515
1535
|
class: "brick-actionbar__btn",
|
|
1516
1536
|
disabled: !k(t).canUndo.value,
|
|
1517
1537
|
title: "Undo",
|
|
1518
|
-
onClick:
|
|
1519
|
-
}, " Undo ", 8,
|
|
1538
|
+
onClick: b[1] || (b[1] = (v) => k(t).undo())
|
|
1539
|
+
}, " Undo ", 8, Oo),
|
|
1520
1540
|
m("button", {
|
|
1521
1541
|
class: "brick-actionbar__btn",
|
|
1522
1542
|
disabled: !k(t).canRedo.value,
|
|
1523
1543
|
title: "Redo",
|
|
1524
|
-
onClick:
|
|
1525
|
-
}, " Redo ", 8,
|
|
1544
|
+
onClick: b[2] || (b[2] = (v) => k(t).redo())
|
|
1545
|
+
}, " Redo ", 8, Ao),
|
|
1526
1546
|
m("button", {
|
|
1527
1547
|
class: "brick-actionbar__btn brick-actionbar__btn--danger",
|
|
1528
1548
|
disabled: !k(i).selectedId.value,
|
|
1529
1549
|
title: "Delete selected element",
|
|
1530
|
-
onClick:
|
|
1531
|
-
}, " Delete ", 8,
|
|
1550
|
+
onClick: a
|
|
1551
|
+
}, " Delete ", 8, Vo)
|
|
1532
1552
|
]),
|
|
1533
|
-
m("div",
|
|
1553
|
+
m("div", Ho, [
|
|
1534
1554
|
m("button", {
|
|
1535
1555
|
class: "brick-actionbar__btn",
|
|
1536
1556
|
title: "Import JSON",
|
|
@@ -1547,20 +1567,20 @@ const Nn = {
|
|
|
1547
1567
|
}, " Export PDF "),
|
|
1548
1568
|
m("button", {
|
|
1549
1569
|
class: "brick-actionbar__btn",
|
|
1550
|
-
onClick:
|
|
1570
|
+
onClick: b[3] || (b[3] = (v) => k(n).openPdf())
|
|
1551
1571
|
}, " Preview ")
|
|
1552
1572
|
]),
|
|
1553
1573
|
m("input", {
|
|
1554
1574
|
ref_key: "fileInput",
|
|
1555
|
-
ref:
|
|
1575
|
+
ref: p,
|
|
1556
1576
|
type: "file",
|
|
1557
1577
|
accept: ".json",
|
|
1558
1578
|
style: { display: "none" },
|
|
1559
|
-
onChange:
|
|
1579
|
+
onChange: g
|
|
1560
1580
|
}, null, 544)
|
|
1561
1581
|
]));
|
|
1562
1582
|
}
|
|
1563
|
-
}),
|
|
1583
|
+
}), Uo = /* @__PURE__ */ x(Fo, [["__scopeId", "data-v-be915a0f"]]), Wo = { class: "brick-pdf" }, Jo = { class: "brick-pdf__workspace" }, Yo = /* @__PURE__ */ _({
|
|
1564
1584
|
__name: "BrickPdf",
|
|
1565
1585
|
props: {
|
|
1566
1586
|
modelValue: {}
|
|
@@ -1568,69 +1588,69 @@ const Nn = {
|
|
|
1568
1588
|
emits: ["update:modelValue"],
|
|
1569
1589
|
setup(e, { emit: t }) {
|
|
1570
1590
|
const n = e, i = t;
|
|
1571
|
-
|
|
1572
|
-
const c =
|
|
1573
|
-
|
|
1574
|
-
const o =
|
|
1575
|
-
|
|
1576
|
-
const u =
|
|
1577
|
-
|
|
1578
|
-
const
|
|
1579
|
-
|
|
1580
|
-
const
|
|
1581
|
-
|
|
1582
|
-
const r =
|
|
1583
|
-
|
|
1584
|
-
const l =
|
|
1585
|
-
|
|
1586
|
-
const y =
|
|
1587
|
-
|
|
1588
|
-
const
|
|
1589
|
-
return
|
|
1591
|
+
Dn();
|
|
1592
|
+
const c = ct(n.modelValue ?? ee());
|
|
1593
|
+
dt(c);
|
|
1594
|
+
const o = ut(c);
|
|
1595
|
+
pt(o);
|
|
1596
|
+
const u = bt(c);
|
|
1597
|
+
vt(u);
|
|
1598
|
+
const p = mt(c, u);
|
|
1599
|
+
yt(p);
|
|
1600
|
+
const a = _t(c, p);
|
|
1601
|
+
kt(a);
|
|
1602
|
+
const r = xt(c);
|
|
1603
|
+
Ct(r);
|
|
1604
|
+
const l = $t(c, p);
|
|
1605
|
+
It(l);
|
|
1606
|
+
const y = zt(p);
|
|
1607
|
+
Rt(y);
|
|
1608
|
+
const g = Te(), f = g.Delete, b = g.Backspace;
|
|
1609
|
+
return ie(f, () => {
|
|
1590
1610
|
if (!o.selectedId.value) return;
|
|
1591
1611
|
const v = document.activeElement;
|
|
1592
1612
|
if (v && (v.tagName === "INPUT" || v.tagName === "TEXTAREA" || v.tagName === "SELECT")) return;
|
|
1593
1613
|
const h = o.selectedId.value;
|
|
1594
|
-
o.deselect(),
|
|
1595
|
-
}),
|
|
1614
|
+
o.deselect(), p.removeElement(h);
|
|
1615
|
+
}), ie(b, () => {
|
|
1596
1616
|
if (!o.selectedId.value) return;
|
|
1597
1617
|
const v = document.activeElement;
|
|
1598
1618
|
if (v && (v.tagName === "INPUT" || v.tagName === "TEXTAREA" || v.tagName === "SELECT")) return;
|
|
1599
1619
|
const h = o.selectedId.value;
|
|
1600
|
-
o.deselect(),
|
|
1601
|
-
}),
|
|
1620
|
+
o.deselect(), p.removeElement(h);
|
|
1621
|
+
}), Re(
|
|
1602
1622
|
() => c.document,
|
|
1603
1623
|
() => {
|
|
1604
1624
|
i("update:modelValue", JSON.parse(JSON.stringify(H(c.document))));
|
|
1605
1625
|
},
|
|
1606
1626
|
{ deep: !0 }
|
|
1607
|
-
), (v, h) => (s(), d("div",
|
|
1608
|
-
B(
|
|
1609
|
-
m("div",
|
|
1610
|
-
B(
|
|
1611
|
-
B(
|
|
1627
|
+
), (v, h) => (s(), d("div", Wo, [
|
|
1628
|
+
B(Uo),
|
|
1629
|
+
m("div", Jo, [
|
|
1630
|
+
B(eo),
|
|
1631
|
+
B(Do)
|
|
1612
1632
|
])
|
|
1613
1633
|
]));
|
|
1614
1634
|
}
|
|
1615
|
-
}),
|
|
1635
|
+
}), jo = /* @__PURE__ */ x(Yo, [["__scopeId", "data-v-f9b95ad8"]]), er = {
|
|
1616
1636
|
install(e) {
|
|
1617
|
-
e.component("BrickPdf",
|
|
1637
|
+
e.component("BrickPdf", jo);
|
|
1618
1638
|
}
|
|
1619
1639
|
};
|
|
1620
1640
|
export {
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1641
|
+
jo as BrickPdf,
|
|
1642
|
+
ee as createDefaultDocument,
|
|
1643
|
+
er as default,
|
|
1644
|
+
Ne as getAllElementDefinitions,
|
|
1625
1645
|
F as getElementDefinition,
|
|
1626
1646
|
T as registerElement,
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1647
|
+
Ko as unregisterElement,
|
|
1648
|
+
Qo as useClipboard,
|
|
1649
|
+
te as useDocumentStore,
|
|
1650
|
+
he as useDragDrop,
|
|
1631
1651
|
Y as useElementActions,
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1652
|
+
ht as useHistory,
|
|
1653
|
+
wt as usePdfExport,
|
|
1654
|
+
Zo as useResize,
|
|
1635
1655
|
U as useSelection
|
|
1636
1656
|
};
|