report-studio 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{designer-Dj330bWd.js → designer-_sWqzOj8.js} +1361 -999
- package/dist/designer.js +1 -1
- package/dist/index.js +1 -1
- package/dist/react-designer.js +1 -1
- package/dist/react.js +1 -1
- package/dist/{viewer-BewnkhfP.js → viewer-4I7C1Rnd.js} +1053 -998
- package/package.json +1 -1
- package/src/designer/choice.js +368 -0
- package/src/designer/designer.js +30 -1
- package/src/designer/dialog.js +49 -25
- package/src/designer/fields.js +219 -27
- package/src/designer/icons.js +13 -0
- package/src/designer/panel.js +419 -56
- package/src/designer/select.js +21 -1
- package/src/designer/styles.css +1196 -545
- package/src/engine/validate.js +39 -0
- package/src/preview/chrome.css +302 -84
- package/src/preview/chrome.js +70 -58
- package/src/preview/viewer.js +137 -85
- package/src/shared/dropdown.css +78 -45
- package/src/shared/dropdown.js +105 -5
- package/src/shared/modal.css +78 -13
- package/types/index.d.ts +8 -1
- package/types/layout.d.ts +8 -0
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { A as e, B as t, E as n, H as r, J as i, K as a, M as o, N as s, O as c, P as l, Q as u, T as d, V as f, W as p, X as m, Z as h, _ as g, a as ee, at as _, c as v, et as y, ft as b, g as x, h as S, k as C, l as w, lt as T, mt as E, n as te, nt as D, o as O, pt as k, q as ne, r as re, rt as ie, s as ae, t as oe, tt as se, u as ce, ut as le } from "./viewer-
|
|
1
|
+
import { A as e, B as t, E as n, H as r, J as i, K as a, M as o, N as s, O as c, P as l, Q as u, T as d, V as f, W as p, X as m, Z as h, _ as g, a as ee, at as _, c as v, et as y, ft as b, g as x, h as S, k as C, l as w, lt as T, mt as E, n as te, nt as D, o as O, pt as k, q as ne, r as re, rt as ie, s as ae, t as oe, tt as se, u as ce, ut as le } from "./viewer-4I7C1Rnd.js";
|
|
2
2
|
//#region src/designer/grouping.js
|
|
3
|
-
var A = D,
|
|
3
|
+
var A = D, ue = ":", de = "@", j = {
|
|
4
4
|
groupHeader: "header",
|
|
5
5
|
groupFooter: "footer"
|
|
6
6
|
};
|
|
7
|
-
function
|
|
8
|
-
return `${e}${n > 0 ? `${
|
|
7
|
+
function fe(e, t, n = 0) {
|
|
8
|
+
return `${e}${n > 0 ? `${de}${n}` : ""}${ue}${t}`;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function M(e) {
|
|
11
11
|
if (typeof e != "string") return null;
|
|
12
|
-
let t = e.indexOf(
|
|
12
|
+
let t = e.indexOf(ue);
|
|
13
13
|
if (t === -1) return null;
|
|
14
|
-
let [n, r, ...i] = e.slice(0, t).split(
|
|
14
|
+
let [n, r, ...i] = e.slice(0, t).split(de);
|
|
15
15
|
if (!A.includes(n) || i.length) return null;
|
|
16
16
|
let a = 0;
|
|
17
17
|
if (r !== void 0) {
|
|
@@ -24,32 +24,32 @@ function P(e) {
|
|
|
24
24
|
level: a
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
return
|
|
27
|
+
function N(e) {
|
|
28
|
+
return M(e)?.kind ?? e;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
return A.includes(
|
|
30
|
+
function P(e) {
|
|
31
|
+
return A.includes(N(e));
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
let t =
|
|
33
|
+
function F(e) {
|
|
34
|
+
let t = M(e);
|
|
35
35
|
if (!t) return String(e ?? "");
|
|
36
36
|
let n = t.level > 0 ? ` ${t.level + 1}` : "";
|
|
37
37
|
return `${t.kind}${n} · ${t.table}`;
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function I(e, t) {
|
|
40
40
|
return E(e).find((e) => e.id === t) ?? null;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function L(e, t) {
|
|
43
43
|
let n = b(e)[t];
|
|
44
44
|
return n && typeof n == "object" ? n : null;
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
let n =
|
|
46
|
+
function pe(e, t) {
|
|
47
|
+
let n = M(t);
|
|
48
48
|
if (!n) return null;
|
|
49
|
-
let r =
|
|
49
|
+
let r = L(I(e, n.table), n.level)?.[j[n.kind]];
|
|
50
50
|
return r && typeof r == "object" ? r : null;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function me(e) {
|
|
53
53
|
let t = b(e).length, n = Array.from({ length: t }, (e, t) => t);
|
|
54
54
|
return [...n.map((e) => ({
|
|
55
55
|
kind: "groupHeader",
|
|
@@ -58,15 +58,15 @@ function pe(e) {
|
|
|
58
58
|
kind: "groupFooter",
|
|
59
59
|
level: e
|
|
60
60
|
}))].map(({ kind: t, level: n }) => ({
|
|
61
|
-
key:
|
|
61
|
+
key: fe(t, e.id, n),
|
|
62
62
|
kind: t,
|
|
63
63
|
level: n
|
|
64
64
|
}));
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function he(e) {
|
|
67
67
|
let t = [];
|
|
68
|
-
for (let n of E(e)) for (let { key: e, kind: r, level: i } of
|
|
69
|
-
let a =
|
|
68
|
+
for (let n of E(e)) for (let { key: e, kind: r, level: i } of me(n)) {
|
|
69
|
+
let a = L(n, i)?.[j[r]];
|
|
70
70
|
a && typeof a == "object" && t.push({
|
|
71
71
|
key: e,
|
|
72
72
|
kind: r,
|
|
@@ -77,11 +77,11 @@ function me(e) {
|
|
|
77
77
|
}
|
|
78
78
|
return t;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function ge(e) {
|
|
81
81
|
return E(e).filter((e) => b(e).length > 0).map((e) => {
|
|
82
82
|
let t = b(e).map((t, n) => ({
|
|
83
83
|
by: t?.by ?? "",
|
|
84
|
-
keys: A.map((t) =>
|
|
84
|
+
keys: A.map((t) => fe(t, e.id, n))
|
|
85
85
|
}));
|
|
86
86
|
return {
|
|
87
87
|
table: e.id,
|
|
@@ -91,42 +91,42 @@ function he(e) {
|
|
|
91
91
|
};
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
|
-
function
|
|
95
|
-
let r =
|
|
94
|
+
function _e(e, t, n) {
|
|
95
|
+
let r = M(t);
|
|
96
96
|
if (!r) return !1;
|
|
97
|
-
let i =
|
|
97
|
+
let i = L(I(e, r.table), r.level);
|
|
98
98
|
if (!i) return !1;
|
|
99
|
-
let a =
|
|
99
|
+
let a = j[r.kind];
|
|
100
100
|
return n ? i[a] ? !1 : (i[a] = {
|
|
101
101
|
type: r.kind,
|
|
102
102
|
height: 36,
|
|
103
103
|
items: []
|
|
104
104
|
}, i[a]) : i[a] ? (i[a] = null, !0) : !1;
|
|
105
105
|
}
|
|
106
|
-
var
|
|
107
|
-
function
|
|
108
|
-
if (n > 0) return
|
|
109
|
-
let r =
|
|
110
|
-
if (t == null || t === "") return !r && !le(e) ? !1 : (r &&
|
|
111
|
-
if (r) return
|
|
106
|
+
var ve = /* @__PURE__ */ new WeakMap();
|
|
107
|
+
function ye(e, t, n = 0) {
|
|
108
|
+
if (n > 0) return R(e, n, t ?? "");
|
|
109
|
+
let r = L(e, 0);
|
|
110
|
+
if (t == null || t === "") return !r && !le(e) ? !1 : (r && ve.set(e, b(e)), delete e.grouping, delete e.groupBy, !0);
|
|
111
|
+
if (r) return R(e, 0, t);
|
|
112
112
|
delete e.groupBy;
|
|
113
|
-
let i =
|
|
113
|
+
let i = ve.get(e);
|
|
114
114
|
if (i?.length) {
|
|
115
|
-
|
|
115
|
+
ve.delete(e);
|
|
116
116
|
let [n, ...r] = i;
|
|
117
|
-
return
|
|
117
|
+
return Te([n.header, n.footer], n.by, t), e.grouping = [{
|
|
118
118
|
...n,
|
|
119
119
|
by: t
|
|
120
120
|
}, ...r], !0;
|
|
121
121
|
}
|
|
122
|
-
return e.grouping = [
|
|
122
|
+
return e.grouping = [Ee(t)], !0;
|
|
123
123
|
}
|
|
124
|
-
function
|
|
125
|
-
let r =
|
|
126
|
-
return !r || r.by === n ? !1 : (!r.by && n && r.header && !(r.header.items ?? []).length && (r.header.items = [
|
|
124
|
+
function R(e, t, n) {
|
|
125
|
+
let r = L(e, t);
|
|
126
|
+
return !r || r.by === n ? !1 : (!r.by && n && r.header && !(r.header.items ?? []).length && (r.header.items = [De(n)]), Te([r.header, r.footer], r.by, n), r.by = n, !0);
|
|
127
127
|
}
|
|
128
|
-
function
|
|
129
|
-
return !Array.isArray(e?.grouping) || e.grouping.length === 0 || e.grouping.length >= 8 ? -1 : (e.grouping.push(t ?
|
|
128
|
+
function be(e, t = "") {
|
|
129
|
+
return !Array.isArray(e?.grouping) || e.grouping.length === 0 || e.grouping.length >= 8 ? -1 : (e.grouping.push(t ? Ee(t) : {
|
|
130
130
|
by: "",
|
|
131
131
|
header: {
|
|
132
132
|
type: "groupHeader",
|
|
@@ -136,8 +136,8 @@ function _e(e, t = "") {
|
|
|
136
136
|
footer: null
|
|
137
137
|
}), e.grouping.length - 1);
|
|
138
138
|
}
|
|
139
|
-
function
|
|
140
|
-
let i =
|
|
139
|
+
function z(e, t, n, r) {
|
|
140
|
+
let i = L(e, t);
|
|
141
141
|
if (!i) return !1;
|
|
142
142
|
let a;
|
|
143
143
|
if (n === "sort") a = ie.includes(r) ? r : void 0;
|
|
@@ -145,43 +145,43 @@ function ve(e, t, n, r) {
|
|
|
145
145
|
else return !1;
|
|
146
146
|
return i[n] === a ? !1 : (a === void 0 ? delete i[n] : i[n] = a, !0);
|
|
147
147
|
}
|
|
148
|
-
function
|
|
149
|
-
return
|
|
148
|
+
function xe(e, t) {
|
|
149
|
+
return L(e, t) ? b(e).length === 1 ? ye(e, null) : (e.grouping.splice(t, 1), !0) : !1;
|
|
150
150
|
}
|
|
151
|
-
function
|
|
152
|
-
if (t < 1 || !
|
|
151
|
+
function Se(e, t) {
|
|
152
|
+
if (t < 1 || !L(e, t) || !L(e, t - 1)) return !1;
|
|
153
153
|
let [n] = e.grouping.splice(t, 1);
|
|
154
154
|
return e.grouping.splice(t - 1, 0, n), !0;
|
|
155
155
|
}
|
|
156
|
-
function
|
|
156
|
+
function Ce(e, t, n) {
|
|
157
157
|
if (t === n) return !1;
|
|
158
|
-
let r = b(
|
|
158
|
+
let r = b(I(e, t)), i = b(I(e, n)), a = !1;
|
|
159
159
|
return r.forEach((e, t) => {
|
|
160
160
|
let n = i[t];
|
|
161
|
-
!e || typeof e != "object" || !n || typeof n != "object" || (e.header = n.header ? structuredClone(n.header) : null, e.footer = n.footer ? structuredClone(n.footer) : null,
|
|
161
|
+
!e || typeof e != "object" || !n || typeof n != "object" || (e.header = n.header ? structuredClone(n.header) : null, e.footer = n.footer ? structuredClone(n.footer) : null, Te([e.header, e.footer], n.by, e.by), a = !0);
|
|
162
162
|
}), a;
|
|
163
163
|
}
|
|
164
|
-
function
|
|
164
|
+
function B(e) {
|
|
165
165
|
return typeof e != "object" || !e ? !1 : e.groupBy != null || E(e).some(le);
|
|
166
166
|
}
|
|
167
|
-
function
|
|
168
|
-
return
|
|
167
|
+
function we(e) {
|
|
168
|
+
return B(e) ? k(e) : e;
|
|
169
169
|
}
|
|
170
|
-
function
|
|
170
|
+
function Te(e, t, n) {
|
|
171
171
|
if (!(!t || !n || t === n)) for (let r of e) for (let e of r?.items ?? []) e?.type === "text" && typeof e.value == "string" && (e.value = e.value.split(`{${t}}`).join(`{${n}}`));
|
|
172
172
|
}
|
|
173
|
-
function
|
|
173
|
+
function Ee(e) {
|
|
174
174
|
return {
|
|
175
175
|
by: e,
|
|
176
176
|
header: {
|
|
177
177
|
type: "groupHeader",
|
|
178
178
|
height: 36,
|
|
179
|
-
items: [
|
|
179
|
+
items: [De(e)]
|
|
180
180
|
},
|
|
181
181
|
footer: null
|
|
182
182
|
};
|
|
183
183
|
}
|
|
184
|
-
function
|
|
184
|
+
function De(e) {
|
|
185
185
|
return {
|
|
186
186
|
id: "group-label",
|
|
187
187
|
type: "text",
|
|
@@ -205,7 +205,7 @@ function Ee(e) {
|
|
|
205
205
|
}
|
|
206
206
|
//#endregion
|
|
207
207
|
//#region src/designer/fields.js
|
|
208
|
-
var
|
|
208
|
+
var Oe = [
|
|
209
209
|
{
|
|
210
210
|
label: "Helvetica",
|
|
211
211
|
value: "Helvetica, Arial, sans-serif"
|
|
@@ -234,32 +234,35 @@ var De = [
|
|
|
234
234
|
label: "Courier",
|
|
235
235
|
value: "\"Courier New\", Courier, monospace"
|
|
236
236
|
}
|
|
237
|
-
],
|
|
237
|
+
], ke = [{
|
|
238
238
|
label: "Regular",
|
|
239
239
|
value: "normal"
|
|
240
240
|
}, {
|
|
241
241
|
label: "Bold",
|
|
242
242
|
value: "bold"
|
|
243
|
-
}],
|
|
243
|
+
}], Ae = [{
|
|
244
244
|
label: "Upright",
|
|
245
245
|
value: "normal"
|
|
246
246
|
}, {
|
|
247
247
|
label: "Italic",
|
|
248
248
|
value: "italic"
|
|
249
|
-
}],
|
|
249
|
+
}], je = [
|
|
250
250
|
{
|
|
251
251
|
label: "Left",
|
|
252
|
-
value: "left"
|
|
252
|
+
value: "left",
|
|
253
|
+
icon: "alignLeft"
|
|
253
254
|
},
|
|
254
255
|
{
|
|
255
256
|
label: "Centre",
|
|
256
|
-
value: "center"
|
|
257
|
+
value: "center",
|
|
258
|
+
icon: "alignCenter"
|
|
257
259
|
},
|
|
258
260
|
{
|
|
259
261
|
label: "Right",
|
|
260
|
-
value: "right"
|
|
262
|
+
value: "right",
|
|
263
|
+
icon: "alignRight"
|
|
261
264
|
}
|
|
262
|
-
],
|
|
265
|
+
], Me = [
|
|
263
266
|
{
|
|
264
267
|
label: "Fit inside",
|
|
265
268
|
value: "contain"
|
|
@@ -272,13 +275,15 @@ var De = [
|
|
|
272
275
|
label: "Stretch",
|
|
273
276
|
value: "fill"
|
|
274
277
|
}
|
|
275
|
-
],
|
|
278
|
+
], Ne = [{
|
|
276
279
|
label: "Horizontal",
|
|
277
|
-
value: "horizontal"
|
|
280
|
+
value: "horizontal",
|
|
281
|
+
icon: "horizontal"
|
|
278
282
|
}, {
|
|
279
283
|
label: "Vertical",
|
|
280
|
-
value: "vertical"
|
|
281
|
-
|
|
284
|
+
value: "vertical",
|
|
285
|
+
icon: "vertical"
|
|
286
|
+
}], V = [
|
|
282
287
|
{
|
|
283
288
|
label: "Solid",
|
|
284
289
|
value: "solid"
|
|
@@ -295,29 +300,31 @@ var De = [
|
|
|
295
300
|
label: "Double",
|
|
296
301
|
value: "double"
|
|
297
302
|
}
|
|
298
|
-
],
|
|
303
|
+
], Pe = [...V, {
|
|
299
304
|
label: "None",
|
|
300
305
|
value: "none"
|
|
301
|
-
}],
|
|
306
|
+
}], H = (e, t, n = {}) => ({
|
|
302
307
|
key: e,
|
|
303
308
|
label: t,
|
|
304
309
|
type: "number",
|
|
305
310
|
...n
|
|
306
311
|
});
|
|
307
|
-
function
|
|
312
|
+
function Fe(e) {
|
|
308
313
|
let t = e.rowHeight ?? 0, n = e.showHeader ? e.headerHeight ?? t : t, r = Math.min(t || Infinity, n || Infinity);
|
|
309
314
|
return Number.isFinite(r) ? Math.max(1, Math.floor(r / 2)) : 1;
|
|
310
315
|
}
|
|
311
|
-
var
|
|
316
|
+
var Ie = [
|
|
312
317
|
{
|
|
313
318
|
key: "field",
|
|
314
319
|
label: "Field",
|
|
315
|
-
type: "text"
|
|
320
|
+
type: "text",
|
|
321
|
+
half: !0
|
|
316
322
|
},
|
|
317
323
|
{
|
|
318
324
|
key: "label",
|
|
319
325
|
label: "Label",
|
|
320
|
-
type: "text"
|
|
326
|
+
type: "text",
|
|
327
|
+
half: !0
|
|
321
328
|
},
|
|
322
329
|
{
|
|
323
330
|
key: "width",
|
|
@@ -329,7 +336,9 @@ var Fe = [
|
|
|
329
336
|
key: "align",
|
|
330
337
|
label: "Align",
|
|
331
338
|
type: "choice",
|
|
332
|
-
options:
|
|
339
|
+
options: je,
|
|
340
|
+
half: !0,
|
|
341
|
+
segmented: !0
|
|
333
342
|
},
|
|
334
343
|
{
|
|
335
344
|
key: "expression",
|
|
@@ -338,15 +347,21 @@ var Fe = [
|
|
|
338
347
|
hint: "Blank shows the field as it is. A calculation - {qty} * {price}, round({amount} * 0.18, 2), percentage({amount}) - is worked out for each row and saved under this column's field"
|
|
339
348
|
}
|
|
340
349
|
];
|
|
341
|
-
function
|
|
350
|
+
function Le(e) {
|
|
342
351
|
if (!e) return [];
|
|
343
352
|
let t = {
|
|
344
353
|
title: "Position and size",
|
|
345
354
|
fields: [
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
355
|
+
H("x", "X", { short: "X" }),
|
|
356
|
+
H("y", "Y", { short: "Y" }),
|
|
357
|
+
H("w", "Width", {
|
|
358
|
+
min: 1,
|
|
359
|
+
short: "W"
|
|
360
|
+
}),
|
|
361
|
+
...e.type === "table" ? [] : [H("h", "Height", {
|
|
362
|
+
min: 1,
|
|
363
|
+
short: "H"
|
|
364
|
+
})]
|
|
350
365
|
]
|
|
351
366
|
};
|
|
352
367
|
return e.type === "box" ? [
|
|
@@ -358,15 +373,16 @@ function Ie(e) {
|
|
|
358
373
|
key: "style.borderStyle",
|
|
359
374
|
label: "Style",
|
|
360
375
|
type: "choice",
|
|
361
|
-
options:
|
|
376
|
+
options: Pe,
|
|
377
|
+
half: !0
|
|
362
378
|
},
|
|
363
|
-
|
|
379
|
+
H("style.borderWidth", "Width", { min: 1 }),
|
|
364
380
|
{
|
|
365
381
|
key: "style.borderColor",
|
|
366
382
|
label: "Colour",
|
|
367
383
|
type: "color"
|
|
368
384
|
},
|
|
369
|
-
|
|
385
|
+
H("style.radius", "Corner", { min: 0 })
|
|
370
386
|
]
|
|
371
387
|
},
|
|
372
388
|
{
|
|
@@ -398,7 +414,7 @@ function Ie(e) {
|
|
|
398
414
|
key: "fit",
|
|
399
415
|
label: "Fit",
|
|
400
416
|
type: "choice",
|
|
401
|
-
options:
|
|
417
|
+
options: Me
|
|
402
418
|
},
|
|
403
419
|
{
|
|
404
420
|
key: "alt",
|
|
@@ -414,14 +430,17 @@ function Ie(e) {
|
|
|
414
430
|
key: "orientation",
|
|
415
431
|
label: "Runs",
|
|
416
432
|
type: "choice",
|
|
417
|
-
options:
|
|
433
|
+
options: Ne,
|
|
434
|
+
half: !0,
|
|
435
|
+
segmented: !0
|
|
418
436
|
},
|
|
419
|
-
|
|
437
|
+
H("style.thickness", "Thickness", { min: 1 }),
|
|
420
438
|
{
|
|
421
439
|
key: "style.lineStyle",
|
|
422
440
|
label: "Style",
|
|
423
441
|
type: "choice",
|
|
424
|
-
options:
|
|
442
|
+
options: V,
|
|
443
|
+
half: !0
|
|
425
444
|
},
|
|
426
445
|
{
|
|
427
446
|
key: "style.color",
|
|
@@ -439,11 +458,11 @@ function Ie(e) {
|
|
|
439
458
|
type: "text",
|
|
440
459
|
nullable: !0,
|
|
441
460
|
hint: "The key in the data object whose rows this table draws. Blank reads the report's dataset"
|
|
442
|
-
},
|
|
461
|
+
}, et]
|
|
443
462
|
},
|
|
444
463
|
{
|
|
445
464
|
title: "Rows",
|
|
446
|
-
fields: [
|
|
465
|
+
fields: [H("rowHeight", "Row height", { min: 1 })]
|
|
447
466
|
},
|
|
448
467
|
{
|
|
449
468
|
title: "Header",
|
|
@@ -453,7 +472,7 @@ function Ie(e) {
|
|
|
453
472
|
label: "Show header",
|
|
454
473
|
type: "toggle"
|
|
455
474
|
},
|
|
456
|
-
|
|
475
|
+
H("headerHeight", "Height", { min: 1 }),
|
|
457
476
|
{
|
|
458
477
|
key: "style.headerBackground",
|
|
459
478
|
label: "Fill",
|
|
@@ -474,9 +493,9 @@ function Ie(e) {
|
|
|
474
493
|
key: "style.fontFamily",
|
|
475
494
|
label: "Font",
|
|
476
495
|
type: "choice",
|
|
477
|
-
options:
|
|
496
|
+
options: Oe
|
|
478
497
|
},
|
|
479
|
-
|
|
498
|
+
H("style.fontSize", "Font size", { min: 1 }),
|
|
480
499
|
{
|
|
481
500
|
key: "style.color",
|
|
482
501
|
label: "Text",
|
|
@@ -492,11 +511,12 @@ function Ie(e) {
|
|
|
492
511
|
key: "style.borderStyle",
|
|
493
512
|
label: "Borders",
|
|
494
513
|
type: "choice",
|
|
495
|
-
options:
|
|
514
|
+
options: Pe,
|
|
515
|
+
half: !0
|
|
496
516
|
},
|
|
497
|
-
|
|
517
|
+
H("style.borderWidth", "Border width", {
|
|
498
518
|
min: 1,
|
|
499
|
-
max:
|
|
519
|
+
max: Fe(e)
|
|
500
520
|
}),
|
|
501
521
|
{
|
|
502
522
|
key: "style.borderColor",
|
|
@@ -523,26 +543,30 @@ function Ie(e) {
|
|
|
523
543
|
key: "style.fontFamily",
|
|
524
544
|
label: "Font",
|
|
525
545
|
type: "choice",
|
|
526
|
-
options:
|
|
546
|
+
options: Oe
|
|
527
547
|
},
|
|
528
|
-
|
|
548
|
+
H("style.fontSize", "Size", { min: 1 }),
|
|
529
549
|
{
|
|
530
550
|
key: "style.fontWeight",
|
|
531
551
|
label: "Weight",
|
|
532
552
|
type: "choice",
|
|
533
|
-
options:
|
|
553
|
+
options: ke,
|
|
554
|
+
half: !0
|
|
534
555
|
},
|
|
535
556
|
{
|
|
536
557
|
key: "style.fontStyle",
|
|
537
558
|
label: "Style",
|
|
538
559
|
type: "choice",
|
|
539
|
-
options:
|
|
560
|
+
options: Ae,
|
|
561
|
+
half: !0
|
|
540
562
|
},
|
|
541
563
|
{
|
|
542
564
|
key: "style.align",
|
|
543
565
|
label: "Align",
|
|
544
566
|
type: "choice",
|
|
545
|
-
options:
|
|
567
|
+
options: je,
|
|
568
|
+
half: !0,
|
|
569
|
+
segmented: !0
|
|
546
570
|
},
|
|
547
571
|
{
|
|
548
572
|
key: "style.color",
|
|
@@ -553,7 +577,7 @@ function Ie(e) {
|
|
|
553
577
|
}
|
|
554
578
|
];
|
|
555
579
|
}
|
|
556
|
-
var
|
|
580
|
+
var Re = [
|
|
557
581
|
{
|
|
558
582
|
label: "A2",
|
|
559
583
|
width: 1587,
|
|
@@ -594,63 +618,150 @@ var W = [
|
|
|
594
618
|
width: 1056,
|
|
595
619
|
height: 1632
|
|
596
620
|
}
|
|
597
|
-
],
|
|
598
|
-
function
|
|
599
|
-
if (e?.paper === "custom") return
|
|
600
|
-
let t = e?.width, n = e?.height, r =
|
|
601
|
-
return r ? r.label :
|
|
621
|
+
], U = "custom";
|
|
622
|
+
function W(e) {
|
|
623
|
+
if (e?.paper === "custom") return U;
|
|
624
|
+
let t = e?.width, n = e?.height, r = Re.find((e) => e.width === t && e.height === n || e.height === t && e.width === n);
|
|
625
|
+
return r ? r.label : U;
|
|
602
626
|
}
|
|
603
|
-
function
|
|
627
|
+
function ze(e) {
|
|
604
628
|
return (e?.width ?? 0) > (e?.height ?? 0) ? "landscape" : "portrait";
|
|
605
629
|
}
|
|
606
|
-
function
|
|
607
|
-
let n =
|
|
608
|
-
if (!n) return e.page.paper === "custom" ? !1 : (e.page.paper =
|
|
609
|
-
let r =
|
|
630
|
+
function Be(e, t) {
|
|
631
|
+
let n = Re.find((e) => e.label === t);
|
|
632
|
+
if (!n) return e.page.paper === "custom" ? !1 : (e.page.paper = U, !0);
|
|
633
|
+
let r = ze(e.page) === "landscape", i = r ? n.height : n.width, a = r ? n.width : n.height, o = e.page.paper === U;
|
|
610
634
|
return delete e.page.paper, e.page.width === i && e.page.height === a ? o : (e.page.width = i, e.page.height = a, !0);
|
|
611
635
|
}
|
|
612
|
-
function
|
|
613
|
-
if (t === "landscape" == (
|
|
636
|
+
function G(e, t) {
|
|
637
|
+
if (t === "landscape" == (ze(e.page) === "landscape")) return !1;
|
|
614
638
|
let { width: n, height: r } = e.page;
|
|
615
639
|
return e.page.width = r, e.page.height = n, !0;
|
|
616
640
|
}
|
|
617
|
-
function
|
|
618
|
-
let t =
|
|
641
|
+
function Ve(e) {
|
|
642
|
+
let t = W(e.page) === U, n = {
|
|
619
643
|
key: "paper",
|
|
620
644
|
label: "Paper",
|
|
621
645
|
type: "choice",
|
|
622
646
|
rebuilds: !0,
|
|
623
|
-
options: [...
|
|
647
|
+
options: [...Re.map((e) => ({
|
|
624
648
|
value: e.label,
|
|
625
649
|
label: `${e.label} ${e.width} x ${e.height}`
|
|
626
650
|
})), {
|
|
627
|
-
value:
|
|
651
|
+
value: U,
|
|
628
652
|
label: "Custom"
|
|
629
653
|
}],
|
|
630
|
-
read: (e) =>
|
|
631
|
-
write: (e, t) =>
|
|
654
|
+
read: (e) => W(e.page),
|
|
655
|
+
write: (e, t) => Be(e, t)
|
|
632
656
|
};
|
|
633
657
|
return t ? [
|
|
634
658
|
n,
|
|
635
|
-
|
|
636
|
-
|
|
659
|
+
H("page.width", "Width", { min: 1 }),
|
|
660
|
+
H("page.height", "Height", { min: 1 })
|
|
637
661
|
] : [n, {
|
|
638
662
|
key: "orientation",
|
|
639
663
|
label: "Orientation",
|
|
640
664
|
type: "choice",
|
|
641
665
|
rebuilds: !0,
|
|
666
|
+
half: !0,
|
|
667
|
+
segmented: !0,
|
|
642
668
|
options: [{
|
|
643
669
|
value: "portrait",
|
|
644
|
-
label: "Portrait"
|
|
670
|
+
label: "Portrait",
|
|
671
|
+
icon: "portrait"
|
|
645
672
|
}, {
|
|
646
673
|
value: "landscape",
|
|
647
|
-
label: "Landscape"
|
|
674
|
+
label: "Landscape",
|
|
675
|
+
icon: "landscape"
|
|
648
676
|
}],
|
|
649
|
-
read: (e) =>
|
|
650
|
-
write: (e, t) =>
|
|
677
|
+
read: (e) => ze(e.page),
|
|
678
|
+
write: (e, t) => G(e, t)
|
|
651
679
|
}];
|
|
652
680
|
}
|
|
653
|
-
|
|
681
|
+
var He = [
|
|
682
|
+
"top",
|
|
683
|
+
"right",
|
|
684
|
+
"bottom",
|
|
685
|
+
"left"
|
|
686
|
+
], K = {
|
|
687
|
+
top: "Top",
|
|
688
|
+
right: "Right",
|
|
689
|
+
bottom: "Bottom",
|
|
690
|
+
left: "Left"
|
|
691
|
+
};
|
|
692
|
+
function q(e, t) {
|
|
693
|
+
return !(e?.marginOff && t in e.marginOff);
|
|
694
|
+
}
|
|
695
|
+
function Ue(e, t) {
|
|
696
|
+
return q(e, t) ? e?.margin?.[t] : e.marginOff[t];
|
|
697
|
+
}
|
|
698
|
+
function We(e) {
|
|
699
|
+
e.marginOff && !Object.keys(e.marginOff).length && delete e.marginOff;
|
|
700
|
+
}
|
|
701
|
+
function Ge(e, t, n) {
|
|
702
|
+
return q(e, t) === n ? !1 : (n ? (e.margin[t] = e.marginOff[t], delete e.marginOff[t], We(e)) : (e.marginOff = {
|
|
703
|
+
...e.marginOff,
|
|
704
|
+
[t]: e.margin[t]
|
|
705
|
+
}, e.margin[t] = 0), !0);
|
|
706
|
+
}
|
|
707
|
+
function Ke(e, t) {
|
|
708
|
+
let n = !1;
|
|
709
|
+
for (let r of He) n = Ge(e, r, t) || n;
|
|
710
|
+
return n;
|
|
711
|
+
}
|
|
712
|
+
function qe(e, t, n) {
|
|
713
|
+
let r = e.marginLinked ? He : [t], i = !1;
|
|
714
|
+
for (let t of r) {
|
|
715
|
+
let r = q(e, t) ? e.margin : e.marginOff;
|
|
716
|
+
r[t] !== n && (r[t] = n, i = !0);
|
|
717
|
+
}
|
|
718
|
+
return i;
|
|
719
|
+
}
|
|
720
|
+
function Je(e, t) {
|
|
721
|
+
if (!!e.marginLinked === t) return !1;
|
|
722
|
+
if (!t) return delete e.marginLinked, !0;
|
|
723
|
+
e.marginLinked = !0;
|
|
724
|
+
let n = He.find((t) => q(e, t)) ?? "top";
|
|
725
|
+
return qe(e, n, Ue(e, n)), !0;
|
|
726
|
+
}
|
|
727
|
+
function Ye(e) {
|
|
728
|
+
return [
|
|
729
|
+
{
|
|
730
|
+
key: "page.marginsOn",
|
|
731
|
+
label: "All sides",
|
|
732
|
+
type: "toggle",
|
|
733
|
+
half: !0,
|
|
734
|
+
rebuilds: !0,
|
|
735
|
+
read: (e) => He.some((t) => q(e.page, t)),
|
|
736
|
+
write: (e, t) => Ke(e.page, t)
|
|
737
|
+
},
|
|
738
|
+
{
|
|
739
|
+
key: "page.marginLinked",
|
|
740
|
+
label: "Same value",
|
|
741
|
+
type: "toggle",
|
|
742
|
+
half: !0,
|
|
743
|
+
rebuilds: !0,
|
|
744
|
+
read: (e) => !!e.page?.marginLinked,
|
|
745
|
+
write: (e, t) => Je(e.page, t)
|
|
746
|
+
},
|
|
747
|
+
...He.flatMap((t) => [{
|
|
748
|
+
key: `page.marginOn.${t}`,
|
|
749
|
+
label: K[t],
|
|
750
|
+
type: "toggle",
|
|
751
|
+
half: !0,
|
|
752
|
+
rebuilds: !0,
|
|
753
|
+
read: (e) => q(e.page, t),
|
|
754
|
+
write: (e, n) => Ge(e.page, t, n)
|
|
755
|
+
}, H(`page.margin.${t}`, `${K[t]} margin`, {
|
|
756
|
+
min: 0,
|
|
757
|
+
short: K[t][0],
|
|
758
|
+
disabled: !q(e.page, t),
|
|
759
|
+
read: (e) => Ue(e.page, t),
|
|
760
|
+
write: (e, n) => qe(e.page, t, n)
|
|
761
|
+
})])
|
|
762
|
+
];
|
|
763
|
+
}
|
|
764
|
+
function Xe(e) {
|
|
654
765
|
return e ? [
|
|
655
766
|
{
|
|
656
767
|
title: "Report",
|
|
@@ -668,16 +779,11 @@ function Be(e) {
|
|
|
668
779
|
},
|
|
669
780
|
{
|
|
670
781
|
title: "Page",
|
|
671
|
-
fields:
|
|
782
|
+
fields: Ve(e)
|
|
672
783
|
},
|
|
673
784
|
{
|
|
674
785
|
title: "Margins",
|
|
675
|
-
fields:
|
|
676
|
-
U("page.margin.top", "Top", { min: 0 }),
|
|
677
|
-
U("page.margin.right", "Right", { min: 0 }),
|
|
678
|
-
U("page.margin.bottom", "Bottom", { min: 0 }),
|
|
679
|
-
U("page.margin.left", "Left", { min: 0 })
|
|
680
|
-
]
|
|
786
|
+
fields: Ye(e)
|
|
681
787
|
},
|
|
682
788
|
{
|
|
683
789
|
title: "Numbers and dates",
|
|
@@ -725,7 +831,7 @@ function Be(e) {
|
|
|
725
831
|
key: "format.pattern",
|
|
726
832
|
label: "Dates",
|
|
727
833
|
type: "choice",
|
|
728
|
-
options:
|
|
834
|
+
options: J(e.format?.pattern),
|
|
729
835
|
hint: "How a date prints unless its own format says otherwise"
|
|
730
836
|
}
|
|
731
837
|
],
|
|
@@ -737,63 +843,63 @@ function Be(e) {
|
|
|
737
843
|
}
|
|
738
844
|
] : [];
|
|
739
845
|
}
|
|
740
|
-
function
|
|
846
|
+
function J(e) {
|
|
741
847
|
let t = ["yyyy-MM-dd", ...i.filter((e) => e !== "yyyy-MM-dd")];
|
|
742
848
|
return typeof e == "string" && e && !t.includes(e) && t.push(e), t.map((e) => ({
|
|
743
849
|
value: e,
|
|
744
|
-
label: y(
|
|
850
|
+
label: y(Ze, {
|
|
745
851
|
type: "date",
|
|
746
852
|
pattern: e
|
|
747
853
|
})
|
|
748
854
|
}));
|
|
749
855
|
}
|
|
750
|
-
var
|
|
751
|
-
function
|
|
752
|
-
return
|
|
856
|
+
var Ze = "2026-06-17";
|
|
857
|
+
function Qe(e) {
|
|
858
|
+
return Xe(e).flatMap((e) => e.fields);
|
|
753
859
|
}
|
|
754
|
-
function
|
|
755
|
-
return
|
|
860
|
+
function $e(e) {
|
|
861
|
+
return Le(e).flatMap((e) => e.fields);
|
|
756
862
|
}
|
|
757
|
-
var
|
|
863
|
+
var et = {
|
|
758
864
|
key: "groupBy",
|
|
759
865
|
label: "Group by",
|
|
760
866
|
type: "text",
|
|
761
867
|
nullable: !0,
|
|
762
868
|
hint: "A field to group these rows by, or blank. Each grouped table has its own group header and footer",
|
|
763
869
|
read: (e) => b(e)[0]?.by ?? e.groupBy ?? null,
|
|
764
|
-
write: (e, t) =>
|
|
870
|
+
write: (e, t) => ye(e, t),
|
|
765
871
|
rebuilds: (e) => b(e).length > 0
|
|
766
872
|
};
|
|
767
|
-
function
|
|
873
|
+
function tt(e) {
|
|
768
874
|
return e.split(".");
|
|
769
875
|
}
|
|
770
|
-
function
|
|
876
|
+
function nt(e, t) {
|
|
771
877
|
if (t.read) return t.read(e);
|
|
772
878
|
let n = e;
|
|
773
|
-
for (let e of
|
|
879
|
+
for (let e of tt(t.key)) {
|
|
774
880
|
if (n == null) return;
|
|
775
881
|
n = n[e];
|
|
776
882
|
}
|
|
777
883
|
return n;
|
|
778
884
|
}
|
|
779
|
-
function
|
|
885
|
+
function rt(e, t) {
|
|
780
886
|
if (t.read || t.write) return !1;
|
|
781
|
-
let n =
|
|
887
|
+
let n = tt(t.key), r = n.pop(), i = e;
|
|
782
888
|
for (let e of n) {
|
|
783
889
|
if (i?.[e] == null || typeof i[e] != "object") return !1;
|
|
784
890
|
i = i[e];
|
|
785
891
|
}
|
|
786
892
|
return i[r] == null ? !1 : (delete i[r], !0);
|
|
787
893
|
}
|
|
788
|
-
function
|
|
789
|
-
let r =
|
|
894
|
+
function it(e, t, n) {
|
|
895
|
+
let r = at(t, n);
|
|
790
896
|
if (r === void 0) return !1;
|
|
791
897
|
if (t.write) return t.write(e, r);
|
|
792
|
-
let i =
|
|
898
|
+
let i = tt(t.key), a = i.pop(), o = e;
|
|
793
899
|
for (let e of i) (o[e] == null || typeof o[e] != "object") && (o[e] = {}), o = o[e];
|
|
794
900
|
return o[a] === r ? !1 : (o[a] = r, !0);
|
|
795
901
|
}
|
|
796
|
-
function
|
|
902
|
+
function at(e, t) {
|
|
797
903
|
if (e.type === "toggle") return !!t;
|
|
798
904
|
if (e.type === "number") {
|
|
799
905
|
if (t === "" || t == null) return;
|
|
@@ -806,7 +912,7 @@ function Xe(e, t) {
|
|
|
806
912
|
}
|
|
807
913
|
//#endregion
|
|
808
914
|
//#region src/designer/blank.js
|
|
809
|
-
function
|
|
915
|
+
function ot() {
|
|
810
916
|
return {
|
|
811
917
|
version: 1,
|
|
812
918
|
name: "Untitled report",
|
|
@@ -839,10 +945,10 @@ function Ze() {
|
|
|
839
945
|
]
|
|
840
946
|
};
|
|
841
947
|
}
|
|
842
|
-
function
|
|
948
|
+
function st(e) {
|
|
843
949
|
return e == null ? !0 : typeof e != "object" || Array.isArray(e) ? !1 : Object.keys(e).length === 0;
|
|
844
950
|
}
|
|
845
|
-
var
|
|
951
|
+
var ct = 3, lt = [
|
|
846
952
|
"nw",
|
|
847
953
|
"n",
|
|
848
954
|
"ne",
|
|
@@ -851,18 +957,18 @@ var J = 3, $e = [
|
|
|
851
957
|
"s",
|
|
852
958
|
"sw",
|
|
853
959
|
"w"
|
|
854
|
-
],
|
|
855
|
-
function
|
|
960
|
+
], ut = ["e", "w"];
|
|
961
|
+
function dt(e) {
|
|
856
962
|
return Math.round(e / 10) * 10;
|
|
857
963
|
}
|
|
858
|
-
function
|
|
964
|
+
function ft(e) {
|
|
859
965
|
let t = l(e);
|
|
860
|
-
return e?.type === "table" ? t + b(e).reduce((e, t) => e +
|
|
966
|
+
return e?.type === "table" ? t + b(e).reduce((e, t) => e + mt(t?.header) + mt(t?.footer), 0) : t;
|
|
861
967
|
}
|
|
862
|
-
function
|
|
968
|
+
function pt(e) {
|
|
863
969
|
let t = b(e), n = e?.rowHeight ?? 0, r = e?.showHeader ? e.headerHeight ?? n : 0, i = [], a = (e, t, n) => {
|
|
864
970
|
if (!n) return;
|
|
865
|
-
let a =
|
|
971
|
+
let a = mt(n);
|
|
866
972
|
i.push({
|
|
867
973
|
kind: e,
|
|
868
974
|
level: t,
|
|
@@ -875,31 +981,31 @@ function rt(e) {
|
|
|
875
981
|
for (let e = t.length - 1; e >= 0; e--) a("groupFooter", e, t[e]?.footer);
|
|
876
982
|
return i;
|
|
877
983
|
}
|
|
878
|
-
function
|
|
984
|
+
function mt(e) {
|
|
879
985
|
let t = Number(e?.height);
|
|
880
986
|
return e && Number.isFinite(t) && t > 0 ? t : 0;
|
|
881
987
|
}
|
|
882
|
-
function
|
|
988
|
+
function ht(e) {
|
|
883
989
|
return {
|
|
884
990
|
x: e.x ?? 0,
|
|
885
991
|
y: e.y ?? 0,
|
|
886
992
|
w: e.w ?? 0,
|
|
887
|
-
h:
|
|
993
|
+
h: ft(e)
|
|
888
994
|
};
|
|
889
995
|
}
|
|
890
|
-
function
|
|
996
|
+
function gt(e) {
|
|
891
997
|
return e.type === "table" ? "x" : "xy";
|
|
892
998
|
}
|
|
893
|
-
function
|
|
894
|
-
return e === "x" ? [...
|
|
999
|
+
function _t(e) {
|
|
1000
|
+
return e === "x" ? [...ut] : [...lt];
|
|
895
1001
|
}
|
|
896
|
-
function
|
|
1002
|
+
function vt(e, t, n) {
|
|
897
1003
|
return {
|
|
898
|
-
x:
|
|
899
|
-
y:
|
|
1004
|
+
x: dt(e.x + t),
|
|
1005
|
+
y: dt(e.y + n)
|
|
900
1006
|
};
|
|
901
1007
|
}
|
|
902
|
-
function
|
|
1008
|
+
function yt(e, t, n, r, i = "xy") {
|
|
903
1009
|
let { x: a, y: o, w: s, h: c } = t;
|
|
904
1010
|
return e.includes("w") ? (s = Math.max(t.w - n, 20), a = t.x + t.w - s) : e.includes("e") && (s = Math.max(t.w + n, 20)), i === "xy" && (e.includes("n") ? (c = Math.max(t.h - r, 12), o = t.y + t.h - c) : e.includes("s") && (c = Math.max(t.h + r, 12))), {
|
|
905
1011
|
x: a,
|
|
@@ -908,10 +1014,10 @@ function lt(e, t, n, r, i = "xy") {
|
|
|
908
1014
|
h: c
|
|
909
1015
|
};
|
|
910
1016
|
}
|
|
911
|
-
function
|
|
1017
|
+
function bt(e, t) {
|
|
912
1018
|
e.x = t.x, e.y = t.y, t.w != null && (e.w = t.w), t.h != null && e.type !== "table" && (e.h = t.h);
|
|
913
1019
|
}
|
|
914
|
-
function
|
|
1020
|
+
function xt(e, { minor: t = 10, major: n = 50 } = {}) {
|
|
915
1021
|
let r = [];
|
|
916
1022
|
if (!(e > 0) || !(t > 0)) return r;
|
|
917
1023
|
for (let i = 0; i <= e; i += t) r.push({
|
|
@@ -924,17 +1030,17 @@ function dt(e, { minor: t = 10, major: n = 50 } = {}) {
|
|
|
924
1030
|
major: !0
|
|
925
1031
|
}), r;
|
|
926
1032
|
}
|
|
927
|
-
function
|
|
928
|
-
let t = e?.guides, n = (e) => (Array.isArray(e) ? e : []).filter(
|
|
1033
|
+
function St(e) {
|
|
1034
|
+
let t = e?.guides, n = (e) => (Array.isArray(e) ? e : []).filter(Ct).map(Number).filter(Number.isFinite).sort((e, t) => e - t);
|
|
929
1035
|
return {
|
|
930
1036
|
x: n(t?.x),
|
|
931
1037
|
y: n(t?.y)
|
|
932
1038
|
};
|
|
933
1039
|
}
|
|
934
|
-
function
|
|
1040
|
+
function Ct(e) {
|
|
935
1041
|
return typeof e == "number" || typeof e == "string" && e.trim() !== "";
|
|
936
1042
|
}
|
|
937
|
-
function
|
|
1043
|
+
function wt(e) {
|
|
938
1044
|
(!e.guides || typeof e.guides != "object") && (e.guides = {
|
|
939
1045
|
x: [],
|
|
940
1046
|
y: []
|
|
@@ -942,30 +1048,30 @@ function mt(e) {
|
|
|
942
1048
|
for (let t of ["x", "y"]) Array.isArray(e.guides[t]) || (e.guides[t] = []);
|
|
943
1049
|
return e.guides;
|
|
944
1050
|
}
|
|
945
|
-
function
|
|
946
|
-
if (!
|
|
1051
|
+
function Tt(e, t, n) {
|
|
1052
|
+
if (!Ct(n)) return null;
|
|
947
1053
|
let r = Math.round(Number(n));
|
|
948
1054
|
if (!Number.isFinite(r)) return null;
|
|
949
|
-
let i =
|
|
1055
|
+
let i = wt(e);
|
|
950
1056
|
return i[t].includes(r) || (i[t].push(r), i[t].sort((e, t) => e - t)), r;
|
|
951
1057
|
}
|
|
952
|
-
function
|
|
953
|
-
let r =
|
|
1058
|
+
function Et(e, t, n) {
|
|
1059
|
+
let r = wt(e), i = r[t].indexOf(Math.round(Number(n)));
|
|
954
1060
|
return i === -1 ? !1 : (r[t].splice(i, 1), !0);
|
|
955
1061
|
}
|
|
956
|
-
function
|
|
957
|
-
return
|
|
1062
|
+
function Dt(e, t, n, r) {
|
|
1063
|
+
return Et(e, t, n), Tt(e, t, r);
|
|
958
1064
|
}
|
|
959
|
-
function
|
|
1065
|
+
function Ot(e, t, n, r = 4) {
|
|
960
1066
|
let i = null;
|
|
961
|
-
for (let a of
|
|
1067
|
+
for (let a of St(e)[t]) {
|
|
962
1068
|
let e = Math.abs(a - n);
|
|
963
1069
|
e <= r && (i === null || e < Math.abs(i - n)) && (i = a);
|
|
964
1070
|
}
|
|
965
1071
|
return i;
|
|
966
1072
|
}
|
|
967
|
-
function
|
|
968
|
-
let n =
|
|
1073
|
+
function kt(e, t) {
|
|
1074
|
+
let n = St(e);
|
|
969
1075
|
if (!t) return {
|
|
970
1076
|
x: n.x,
|
|
971
1077
|
y: []
|
|
@@ -978,26 +1084,26 @@ function yt(e, t) {
|
|
|
978
1084
|
}
|
|
979
1085
|
//#endregion
|
|
980
1086
|
//#region src/designer/canvas.js
|
|
981
|
-
var
|
|
1087
|
+
var At = [
|
|
982
1088
|
"pageHeader",
|
|
983
1089
|
"reportHeader",
|
|
984
1090
|
"reportFooter",
|
|
985
1091
|
"pageFooter"
|
|
986
1092
|
];
|
|
987
|
-
function
|
|
988
|
-
return Array.from({ length:
|
|
1093
|
+
function jt(e) {
|
|
1094
|
+
return Array.from({ length: ct }, () => Object.fromEntries((e || []).map((e) => [e.field, e.field])));
|
|
989
1095
|
}
|
|
990
|
-
function
|
|
1096
|
+
function Mt(e) {
|
|
991
1097
|
if (e.type === "text") return {
|
|
992
1098
|
...e,
|
|
993
1099
|
text: e.value
|
|
994
1100
|
};
|
|
995
1101
|
if (e.type === "table") {
|
|
996
|
-
let t =
|
|
1102
|
+
let t = pt(e);
|
|
997
1103
|
if (!t.length) return {
|
|
998
1104
|
...e,
|
|
999
|
-
row:
|
|
1000
|
-
measuredHeight:
|
|
1105
|
+
row: jt(e.columns),
|
|
1106
|
+
measuredHeight: ft(e)
|
|
1001
1107
|
};
|
|
1002
1108
|
let n = (e) => ({
|
|
1003
1109
|
height: e.h,
|
|
@@ -1012,14 +1118,14 @@ function St(e) {
|
|
|
1012
1118
|
showFooter: !0,
|
|
1013
1119
|
headerBands: r("groupHeader"),
|
|
1014
1120
|
footerBands: r("groupFooter"),
|
|
1015
|
-
rows:
|
|
1121
|
+
rows: jt(e.columns)
|
|
1016
1122
|
}],
|
|
1017
|
-
measuredHeight:
|
|
1123
|
+
measuredHeight: ft(e)
|
|
1018
1124
|
};
|
|
1019
1125
|
}
|
|
1020
1126
|
return e;
|
|
1021
1127
|
}
|
|
1022
|
-
function
|
|
1128
|
+
function Nt(e) {
|
|
1023
1129
|
let { page: t } = e, r = t.height - t.margin.top - t.margin.bottom, i = t.width - t.margin.left - t.margin.right, a = Object.fromEntries((e.bands || []).map((e) => [e.type, e])), o = n({
|
|
1024
1130
|
bands: a,
|
|
1025
1131
|
contentHeight: r,
|
|
@@ -1033,24 +1139,24 @@ function Ct(e) {
|
|
|
1033
1139
|
width: i,
|
|
1034
1140
|
band: r
|
|
1035
1141
|
});
|
|
1036
|
-
for (let e of
|
|
1142
|
+
for (let e of At) {
|
|
1037
1143
|
let t = o[e];
|
|
1038
1144
|
t && a[e] && s.push(c(e, t.top, t.height, a[e]));
|
|
1039
1145
|
}
|
|
1040
1146
|
let l = o.detail, u = (e) => a[e] ? d(a[e], r) : 0, f = u("groupHeader"), p = u("groupFooter");
|
|
1041
1147
|
a.groupHeader && s.push(c("groupHeader", l.top, f, a.groupHeader)), a.detail && s.push(c("detail", l.top + f, Math.max(l.height - f - p, 0), a.detail)), a.groupFooter && s.push(c("groupFooter", l.top + l.height - p, p, a.groupFooter));
|
|
1042
|
-
for (let e of [...s]) for (let t of e.band.items || []) t?.type === "table" && s.push(...
|
|
1148
|
+
for (let e of [...s]) for (let t of e.band.items || []) t?.type === "table" && s.push(...Pt(t, e));
|
|
1043
1149
|
return s;
|
|
1044
1150
|
}
|
|
1045
|
-
function
|
|
1046
|
-
return
|
|
1047
|
-
let s =
|
|
1151
|
+
function Pt(e, t) {
|
|
1152
|
+
return pt(e).map(({ kind: n, level: r, band: i, y: a, h: o }) => {
|
|
1153
|
+
let s = fe(n, e.id, r);
|
|
1048
1154
|
return {
|
|
1049
1155
|
type: s,
|
|
1050
1156
|
kind: n,
|
|
1051
1157
|
level: r,
|
|
1052
1158
|
table: e.id,
|
|
1053
|
-
label:
|
|
1159
|
+
label: F(s),
|
|
1054
1160
|
top: t.top + (e.y ?? 0) + a,
|
|
1055
1161
|
left: t.left + (e.x ?? 0),
|
|
1056
1162
|
height: o,
|
|
@@ -1059,22 +1165,22 @@ function wt(e, t) {
|
|
|
1059
1165
|
};
|
|
1060
1166
|
});
|
|
1061
1167
|
}
|
|
1062
|
-
function
|
|
1063
|
-
let n = [...e.band.items || []].sort((e, t) => (e.y ?? 0) - (t.y ?? 0)).map(
|
|
1168
|
+
function Ft(e, t) {
|
|
1169
|
+
let n = [...e.band.items || []].sort((e, t) => (e.y ?? 0) - (t.y ?? 0)).map(Mt);
|
|
1064
1170
|
return `
|
|
1065
1171
|
<div class="band dz-zone" data-band-type="${S(e.type)}"
|
|
1066
|
-
style="${
|
|
1172
|
+
style="${zt(e, t)}">
|
|
1067
1173
|
${g(n)}
|
|
1068
1174
|
</div>`;
|
|
1069
1175
|
}
|
|
1070
|
-
function
|
|
1071
|
-
|
|
1072
|
-
let n = (e, t) =>
|
|
1176
|
+
function It(e, t) {
|
|
1177
|
+
St(e);
|
|
1178
|
+
let n = (e, t) => xt(e).map((e) => `
|
|
1073
1179
|
<span class="dz-tick${e.major ? " is-major" : ""}"
|
|
1074
1180
|
style="${t === "x" ? "left" : "top"}:${e.at}px"
|
|
1075
1181
|
>${e.major ? `<i>${e.at}</i>` : ""}</span>`).join(""), r = (t) => `
|
|
1076
1182
|
<span class="dz-ruler-guides" data-role="ruler-guides"
|
|
1077
|
-
data-axis="${t}">${
|
|
1183
|
+
data-axis="${t}">${Lt(e, t)}</span>`;
|
|
1078
1184
|
return `
|
|
1079
1185
|
<div class="dz-ruler-corner" data-role="ruler-corner"></div>
|
|
1080
1186
|
|
|
@@ -1088,33 +1194,33 @@ function Et(e, t) {
|
|
|
1088
1194
|
${n(t.h, "y")}${r("y")}
|
|
1089
1195
|
</div>`;
|
|
1090
1196
|
}
|
|
1091
|
-
function
|
|
1092
|
-
return
|
|
1197
|
+
function Lt(e, t) {
|
|
1198
|
+
return St(e)[t].map((e) => `
|
|
1093
1199
|
<span class="dz-ruler-guide"
|
|
1094
1200
|
style="${t === "x" ? "left" : "top"}:${e}px"></span>`).join("");
|
|
1095
1201
|
}
|
|
1096
|
-
function
|
|
1097
|
-
let t = e.page.margin, n =
|
|
1202
|
+
function Rt(e) {
|
|
1203
|
+
let t = e.page.margin, n = St(e), r = n.x.map((e) => `
|
|
1098
1204
|
<span class="dz-rule dz-rule-v" data-role="guide" data-axis="x"
|
|
1099
1205
|
data-at="${e}" style="left:${e + t.left}px"></span>`), i = n.y.map((e) => `
|
|
1100
1206
|
<span class="dz-rule dz-rule-h" data-role="guide" data-axis="y"
|
|
1101
1207
|
data-at="${e}" style="top:${e + t.top}px"></span>`);
|
|
1102
1208
|
return [...r, ...i].join("");
|
|
1103
1209
|
}
|
|
1104
|
-
function
|
|
1210
|
+
function zt(e, t) {
|
|
1105
1211
|
return `position:absolute;top:${e.top + t.top}px;left:${e.left + t.left}px;width:${e.width}px;height:${e.height}px`;
|
|
1106
1212
|
}
|
|
1107
|
-
function
|
|
1213
|
+
function Bt(e, t) {
|
|
1108
1214
|
return `<span class="dz-tag" data-band-tag="${S(e.type)}"
|
|
1109
1215
|
style="top:${e.top + t.top}px">${S(e.label ?? e.type)}</span>`;
|
|
1110
1216
|
}
|
|
1111
|
-
function
|
|
1217
|
+
function Vt(e, t) {
|
|
1112
1218
|
if (!t) return null;
|
|
1113
|
-
let n = e.page.margin, r =
|
|
1219
|
+
let n = e.page.margin, r = Nt(e).find((e) => e.type === t.band);
|
|
1114
1220
|
if (!r) return null;
|
|
1115
1221
|
let i = (r.band.items || []).find((e) => e.id === t.id);
|
|
1116
1222
|
if (!i) return null;
|
|
1117
|
-
let a =
|
|
1223
|
+
let a = ht(i);
|
|
1118
1224
|
return {
|
|
1119
1225
|
item: i,
|
|
1120
1226
|
box: {
|
|
@@ -1124,8 +1230,8 @@ function jt(e, t) {
|
|
|
1124
1230
|
}
|
|
1125
1231
|
};
|
|
1126
1232
|
}
|
|
1127
|
-
function
|
|
1128
|
-
let { box: r, item: i } = e, a = t ?
|
|
1233
|
+
function Ht(e, { withHandles: t = !0, primary: n = !0 } = {}) {
|
|
1234
|
+
let { box: r, item: i } = e, a = t ? _t(gt(i)).map((e) => `<span class="dz-handle dz-handle-${e}" data-handle="${e}"></span>`).join("") : "";
|
|
1129
1235
|
return `
|
|
1130
1236
|
<div class="dz-select${n ? "" : " is-secondary"}" data-role="select"
|
|
1131
1237
|
data-select-id="${S(i.id)}"
|
|
@@ -1133,11 +1239,11 @@ function Mt(e, { withHandles: t = !0, primary: n = !0 } = {}) {
|
|
|
1133
1239
|
${a}
|
|
1134
1240
|
</div>`;
|
|
1135
1241
|
}
|
|
1136
|
-
function
|
|
1137
|
-
return (t || []).map((t) =>
|
|
1242
|
+
function Ut(e, t) {
|
|
1243
|
+
return (t || []).map((t) => Vt(e, t)).filter(Boolean);
|
|
1138
1244
|
}
|
|
1139
|
-
function
|
|
1140
|
-
let { page: r } = e, i = r.margin, a =
|
|
1245
|
+
function Wt(e, t = null, { rulers: n = !1 } = {}) {
|
|
1246
|
+
let { page: r } = e, i = r.margin, a = Nt(e), o = Ut(e, t == null ? [] : [].concat(t)), s = `width:${r.width}px;height:${r.height}px;padding-top:${i.top}px;padding-right:${i.right}px;padding-bottom:${i.bottom}px;padding-left:${i.left}px;`, c = {
|
|
1141
1247
|
w: r.width - i.left - i.right,
|
|
1142
1248
|
h: r.height - i.top - i.bottom
|
|
1143
1249
|
};
|
|
@@ -1145,15 +1251,15 @@ function Pt(e, t = null, { rulers: n = !1 } = {}) {
|
|
|
1145
1251
|
<div class="dz-sheet${n ? " has-rulers" : ""}"
|
|
1146
1252
|
style="--page-height:${r.height}px;--dz-margin-left:${i.left}px;
|
|
1147
1253
|
--dz-margin-top:${i.top}px">
|
|
1148
|
-
${n ?
|
|
1254
|
+
${n ? It(e, c) : ""}
|
|
1149
1255
|
<div class="dz-gutter">
|
|
1150
|
-
${a.map((e) =>
|
|
1256
|
+
${a.map((e) => Bt(e, i)).join("")}
|
|
1151
1257
|
</div>
|
|
1152
1258
|
<div class="page dz-page" style="${s}">
|
|
1153
1259
|
<div class="dz-rules" data-role="rules"
|
|
1154
|
-
>${n ?
|
|
1155
|
-
${a.map((e) =>
|
|
1156
|
-
${o.map((e, t) =>
|
|
1260
|
+
>${n ? Rt(e) : ""}</div>
|
|
1261
|
+
${a.map((e) => Ft(e, i)).join("")}
|
|
1262
|
+
${o.map((e, t) => Ht(e, {
|
|
1157
1263
|
withHandles: o.length === 1,
|
|
1158
1264
|
primary: t === o.length - 1
|
|
1159
1265
|
})).join("")}
|
|
@@ -1161,8 +1267,8 @@ function Pt(e, t = null, { rulers: n = !1 } = {}) {
|
|
|
1161
1267
|
</div>
|
|
1162
1268
|
</div>`;
|
|
1163
1269
|
}
|
|
1164
|
-
function
|
|
1165
|
-
let n =
|
|
1270
|
+
function Gt(e, t) {
|
|
1271
|
+
let n = Nt(e).find((e) => e.type === t);
|
|
1166
1272
|
if (!n) return null;
|
|
1167
1273
|
let r = e.page.margin;
|
|
1168
1274
|
return {
|
|
@@ -1174,7 +1280,7 @@ function Ft(e, t) {
|
|
|
1174
1280
|
originY: n.top
|
|
1175
1281
|
};
|
|
1176
1282
|
}
|
|
1177
|
-
function
|
|
1283
|
+
function Kt(e, t = [], n = []) {
|
|
1178
1284
|
if (!e) return "";
|
|
1179
1285
|
let r = (t) => t + e.left, i = (t) => t + e.top, a = t.map((e) => e.axis === "x" ? `<span class="dz-guide dz-guide-v${e.centre ? " is-centre" : ""}"
|
|
1180
1286
|
style="left:${r(e.at)}px;top:${i(e.from)}px;
|
|
@@ -1190,15 +1296,15 @@ function It(e, t = [], n = []) {
|
|
|
1190
1296
|
});
|
|
1191
1297
|
return [...a, ...o].join("");
|
|
1192
1298
|
}
|
|
1193
|
-
function
|
|
1194
|
-
let i =
|
|
1299
|
+
function qt(e, t, n, r) {
|
|
1300
|
+
let i = Nt(e).find((e) => e.type === t);
|
|
1195
1301
|
return i ? {
|
|
1196
1302
|
x: i.left + n,
|
|
1197
1303
|
y: i.top + r
|
|
1198
1304
|
} : null;
|
|
1199
1305
|
}
|
|
1200
|
-
function
|
|
1201
|
-
let i =
|
|
1306
|
+
function Jt(e, t, n = null, { groupZones: r = !0 } = {}) {
|
|
1307
|
+
let i = Nt(e);
|
|
1202
1308
|
if (!i.length) return null;
|
|
1203
1309
|
let a = i.filter((e) => !e.table), o = (r ? i : a).filter((e) => t >= e.top && t < e.top + e.height && (!e.table || n != null && n >= e.left && n < e.left + e.width));
|
|
1204
1310
|
if (o.length) return o.at(-1).type;
|
|
@@ -1206,13 +1312,13 @@ function Rt(e, t, n = null, { groupZones: r = !0 } = {}) {
|
|
|
1206
1312
|
let s = [...a].sort((e, t) => e.top - t.top);
|
|
1207
1313
|
return t < s[0].top ? s[0].type : s.at(-1).type;
|
|
1208
1314
|
}
|
|
1209
|
-
function
|
|
1210
|
-
let r =
|
|
1211
|
-
return r ?
|
|
1315
|
+
function Yt(e, t, n) {
|
|
1316
|
+
let r = qt(e, t, n?.x ?? 0, n?.y ?? 0);
|
|
1317
|
+
return r ? Jt(e, r.y, r.x, { groupZones: n?.type !== "table" }) : null;
|
|
1212
1318
|
}
|
|
1213
1319
|
//#endregion
|
|
1214
1320
|
//#region src/designer/structure.js
|
|
1215
|
-
var
|
|
1321
|
+
var Xt = [
|
|
1216
1322
|
"pageHeader",
|
|
1217
1323
|
"reportHeader",
|
|
1218
1324
|
"groupHeader",
|
|
@@ -1220,14 +1326,14 @@ var Bt = [
|
|
|
1220
1326
|
"groupFooter",
|
|
1221
1327
|
"reportFooter",
|
|
1222
1328
|
"pageFooter"
|
|
1223
|
-
],
|
|
1329
|
+
], Zt = {
|
|
1224
1330
|
pageHeader: 40,
|
|
1225
1331
|
reportHeader: 80,
|
|
1226
1332
|
groupHeader: 36,
|
|
1227
1333
|
groupFooter: 36,
|
|
1228
1334
|
reportFooter: 60,
|
|
1229
1335
|
pageFooter: 40
|
|
1230
|
-
},
|
|
1336
|
+
}, Qt = {
|
|
1231
1337
|
reportHeader: "First page only",
|
|
1232
1338
|
pageHeader: "Every page",
|
|
1233
1339
|
groupHeader: "Before each group",
|
|
@@ -1236,35 +1342,35 @@ var Bt = [
|
|
|
1236
1342
|
reportFooter: "Last page only",
|
|
1237
1343
|
pageFooter: "Every page"
|
|
1238
1344
|
};
|
|
1239
|
-
function
|
|
1345
|
+
function $t(e) {
|
|
1240
1346
|
return Array.isArray(e?.bands) ? e.bands : [];
|
|
1241
1347
|
}
|
|
1242
|
-
function
|
|
1243
|
-
return
|
|
1348
|
+
function en(e) {
|
|
1349
|
+
return $t(e).flatMap((e) => e.items || []).filter((e) => e?.type === "table").length;
|
|
1244
1350
|
}
|
|
1245
|
-
function
|
|
1351
|
+
function tn(e) {
|
|
1246
1352
|
return Array.isArray(e?.bands);
|
|
1247
1353
|
}
|
|
1248
|
-
function
|
|
1249
|
-
let t =
|
|
1354
|
+
function nn(e) {
|
|
1355
|
+
let t = en(e);
|
|
1250
1356
|
if (t === 0) return e.dataset ?? null;
|
|
1251
|
-
let n = e.dataset || "rows", r = new Set(
|
|
1357
|
+
let n = e.dataset || "rows", r = new Set($t(e).flatMap((e) => e.items || []).filter((e) => e?.type === "table").map((t) => t.dataset ?? e.dataset));
|
|
1252
1358
|
for (let e = t + 1;; e++) if (!r.has(`${n}${e}`)) return `${n}${e}`;
|
|
1253
1359
|
}
|
|
1254
|
-
function
|
|
1255
|
-
e.y =
|
|
1360
|
+
function rn(e, t) {
|
|
1361
|
+
e.y = pn(t), delete e.groupBy;
|
|
1256
1362
|
}
|
|
1257
1363
|
function Y(e, t) {
|
|
1258
|
-
return
|
|
1364
|
+
return M(t) ? pe(e, t) : $t(e).find((e) => e.type === t) ?? null;
|
|
1259
1365
|
}
|
|
1260
|
-
function
|
|
1261
|
-
let t =
|
|
1262
|
-
for (let r of
|
|
1366
|
+
function an(e) {
|
|
1367
|
+
let t = he(e), n = [];
|
|
1368
|
+
for (let r of Xt) sn(e, r) && n.push(r), A.includes(r) && n.push(...t.filter((e) => e.kind === r).map((e) => e.key));
|
|
1263
1369
|
return n;
|
|
1264
1370
|
}
|
|
1265
|
-
function
|
|
1266
|
-
let t =
|
|
1267
|
-
for (let i of
|
|
1371
|
+
function on(e) {
|
|
1372
|
+
let t = ge(e), n = B(e), r = [];
|
|
1373
|
+
for (let i of Xt) if ((!A.includes(i) || sn(e, i) || n) && r.push(i), A.includes(i)) {
|
|
1268
1374
|
let e = A.indexOf(i);
|
|
1269
1375
|
for (let n of t) {
|
|
1270
1376
|
let t = i === "groupFooter" ? [...n.levels].reverse() : n.levels;
|
|
@@ -1273,62 +1379,62 @@ function Yt(e) {
|
|
|
1273
1379
|
}
|
|
1274
1380
|
return r;
|
|
1275
1381
|
}
|
|
1276
|
-
function
|
|
1382
|
+
function sn(e, t) {
|
|
1277
1383
|
return Y(e, t) != null;
|
|
1278
1384
|
}
|
|
1279
|
-
function
|
|
1280
|
-
if (
|
|
1281
|
-
let n =
|
|
1385
|
+
function cn(e, t) {
|
|
1386
|
+
if (M(t)) {
|
|
1387
|
+
let n = _e(e, t, !0);
|
|
1282
1388
|
return n && typeof n == "object" ? n : null;
|
|
1283
1389
|
}
|
|
1284
|
-
if (!
|
|
1390
|
+
if (!Xt.includes(t) || sn(e, t)) return null;
|
|
1285
1391
|
let n = {
|
|
1286
1392
|
type: t,
|
|
1287
1393
|
items: []
|
|
1288
1394
|
};
|
|
1289
|
-
|
|
1290
|
-
let r = (e) =>
|
|
1395
|
+
Zt[t] != null && (n.height = Zt[t]), Array.isArray(e.bands) || (e.bands = []);
|
|
1396
|
+
let r = (e) => Xt.indexOf(e), i = e.bands.findIndex((e) => r(e.type) > r(t));
|
|
1291
1397
|
return i === -1 ? e.bands.push(n) : e.bands.splice(i, 0, n), n;
|
|
1292
1398
|
}
|
|
1293
|
-
function
|
|
1294
|
-
if (
|
|
1295
|
-
let n =
|
|
1399
|
+
function ln(e, t) {
|
|
1400
|
+
if (M(t)) return _e(e, t, !1) === !0;
|
|
1401
|
+
let n = $t(e).findIndex((e) => e.type === t);
|
|
1296
1402
|
return n === -1 ? !1 : (e.bands.splice(n, 1), !0);
|
|
1297
1403
|
}
|
|
1298
|
-
function
|
|
1299
|
-
return new Set([
|
|
1404
|
+
function un(e) {
|
|
1405
|
+
return new Set([...$t(e), ...he(e).map((e) => e.band)].flatMap((e) => (e.items || []).map((e) => e.id)));
|
|
1300
1406
|
}
|
|
1301
|
-
function
|
|
1302
|
-
return !(t?.type === "table" &&
|
|
1407
|
+
function dn(e, t) {
|
|
1408
|
+
return !(t?.type === "table" && P(e));
|
|
1303
1409
|
}
|
|
1304
|
-
function
|
|
1305
|
-
let n =
|
|
1410
|
+
function fn(e, t) {
|
|
1411
|
+
let n = un(e);
|
|
1306
1412
|
for (let e = 1;; e++) {
|
|
1307
1413
|
let r = `${t}-${e}`;
|
|
1308
1414
|
if (!n.has(r)) return r;
|
|
1309
1415
|
}
|
|
1310
1416
|
}
|
|
1311
|
-
function
|
|
1417
|
+
function pn(e) {
|
|
1312
1418
|
let t = e.items || [];
|
|
1313
1419
|
if (!t.length) return 0;
|
|
1314
|
-
let n = Math.max(...t.map((e) => (e.y ?? 0) +
|
|
1420
|
+
let n = Math.max(...t.map((e) => (e.y ?? 0) + ft(e)));
|
|
1315
1421
|
return Math.ceil(n / 10) * 10;
|
|
1316
1422
|
}
|
|
1317
|
-
function
|
|
1423
|
+
function mn(e) {
|
|
1318
1424
|
let { page: t } = e;
|
|
1319
1425
|
return t.width - t.margin.left - t.margin.right;
|
|
1320
1426
|
}
|
|
1321
|
-
function
|
|
1427
|
+
function hn(e, t) {
|
|
1322
1428
|
return {
|
|
1323
|
-
id:
|
|
1429
|
+
id: fn(e, "text"),
|
|
1324
1430
|
type: "text",
|
|
1325
1431
|
x: 0,
|
|
1326
|
-
y:
|
|
1432
|
+
y: pn(t),
|
|
1327
1433
|
w: 200,
|
|
1328
1434
|
h: 20,
|
|
1329
1435
|
value: "Text",
|
|
1330
1436
|
style: {
|
|
1331
|
-
fontFamily:
|
|
1437
|
+
fontFamily: Oe[0].value,
|
|
1332
1438
|
fontSize: 12,
|
|
1333
1439
|
fontWeight: "normal",
|
|
1334
1440
|
fontStyle: "normal",
|
|
@@ -1340,14 +1446,14 @@ function an(e, t) {
|
|
|
1340
1446
|
}
|
|
1341
1447
|
};
|
|
1342
1448
|
}
|
|
1343
|
-
function
|
|
1449
|
+
function gn(e, t, n = "horizontal") {
|
|
1344
1450
|
let r = n === "vertical";
|
|
1345
1451
|
return {
|
|
1346
|
-
id:
|
|
1452
|
+
id: fn(e, "line"),
|
|
1347
1453
|
type: "line",
|
|
1348
1454
|
x: 0,
|
|
1349
|
-
y:
|
|
1350
|
-
w: r ? 12 :
|
|
1455
|
+
y: pn(t),
|
|
1456
|
+
w: r ? 12 : mn(e),
|
|
1351
1457
|
h: r ? 80 : 12,
|
|
1352
1458
|
orientation: r ? "vertical" : "horizontal",
|
|
1353
1459
|
style: {
|
|
@@ -1357,13 +1463,13 @@ function on(e, t, n = "horizontal") {
|
|
|
1357
1463
|
}
|
|
1358
1464
|
};
|
|
1359
1465
|
}
|
|
1360
|
-
function
|
|
1466
|
+
function _n(e, t) {
|
|
1361
1467
|
return {
|
|
1362
|
-
id:
|
|
1468
|
+
id: fn(e, "box"),
|
|
1363
1469
|
type: "box",
|
|
1364
1470
|
x: 0,
|
|
1365
|
-
y:
|
|
1366
|
-
w:
|
|
1471
|
+
y: pn(t),
|
|
1472
|
+
w: mn(e),
|
|
1367
1473
|
h: 80,
|
|
1368
1474
|
style: {
|
|
1369
1475
|
borderStyle: "solid",
|
|
@@ -1374,12 +1480,12 @@ function sn(e, t) {
|
|
|
1374
1480
|
}
|
|
1375
1481
|
};
|
|
1376
1482
|
}
|
|
1377
|
-
function
|
|
1483
|
+
function vn(e, t) {
|
|
1378
1484
|
return {
|
|
1379
|
-
id:
|
|
1485
|
+
id: fn(e, "image"),
|
|
1380
1486
|
type: "image",
|
|
1381
1487
|
x: 0,
|
|
1382
|
-
y:
|
|
1488
|
+
y: pn(t),
|
|
1383
1489
|
w: 160,
|
|
1384
1490
|
h: 80,
|
|
1385
1491
|
src: null,
|
|
@@ -1388,7 +1494,7 @@ function cn(e, t) {
|
|
|
1388
1494
|
alt: ""
|
|
1389
1495
|
};
|
|
1390
1496
|
}
|
|
1391
|
-
function
|
|
1497
|
+
function yn(e) {
|
|
1392
1498
|
return {
|
|
1393
1499
|
field: `field${e}`,
|
|
1394
1500
|
label: `Column ${e}`,
|
|
@@ -1396,20 +1502,20 @@ function ln(e) {
|
|
|
1396
1502
|
align: "left"
|
|
1397
1503
|
};
|
|
1398
1504
|
}
|
|
1399
|
-
function
|
|
1505
|
+
function bn(e, t, n = 3) {
|
|
1400
1506
|
let r = Math.max(1, Math.floor(Number(n) || 3));
|
|
1401
1507
|
return {
|
|
1402
|
-
id:
|
|
1508
|
+
id: fn(e, "table"),
|
|
1403
1509
|
type: "table",
|
|
1404
1510
|
x: 0,
|
|
1405
|
-
y:
|
|
1406
|
-
w:
|
|
1407
|
-
dataset:
|
|
1511
|
+
y: pn(t),
|
|
1512
|
+
w: mn(e),
|
|
1513
|
+
dataset: nn(e),
|
|
1408
1514
|
rowHeight: 24,
|
|
1409
1515
|
headerHeight: 28,
|
|
1410
1516
|
showHeader: !0,
|
|
1411
1517
|
wrap: !0,
|
|
1412
|
-
columns: Array.from({ length: r }, (e, t) =>
|
|
1518
|
+
columns: Array.from({ length: r }, (e, t) => yn(t + 1)),
|
|
1413
1519
|
style: {
|
|
1414
1520
|
fontFamily: "Helvetica, Arial, sans-serif",
|
|
1415
1521
|
fontSize: 12,
|
|
@@ -1420,78 +1526,78 @@ function un(e, t, n = 3) {
|
|
|
1420
1526
|
}
|
|
1421
1527
|
};
|
|
1422
1528
|
}
|
|
1423
|
-
function
|
|
1529
|
+
function xn(e, t, n) {
|
|
1424
1530
|
let r = Y(e, t);
|
|
1425
|
-
return !r || !
|
|
1531
|
+
return !r || !dn(t, n) ? null : (r.items ??= [], r.items.push(n), n);
|
|
1426
1532
|
}
|
|
1427
|
-
var
|
|
1428
|
-
function
|
|
1533
|
+
var Sn = 10;
|
|
1534
|
+
function Cn(e) {
|
|
1429
1535
|
return String(e.id ?? "").replace(/-\d+$/, "") || e.type || "item";
|
|
1430
1536
|
}
|
|
1431
|
-
function
|
|
1537
|
+
function wn(e, t, n) {
|
|
1432
1538
|
if (!Number.isFinite(e?.page?.width)) return Math.max(0, t);
|
|
1433
|
-
let r = Math.max(0,
|
|
1539
|
+
let r = Math.max(0, mn(e) - (n ?? 0));
|
|
1434
1540
|
return Math.min(Math.max(0, t), r);
|
|
1435
1541
|
}
|
|
1436
|
-
function
|
|
1542
|
+
function Tn(e, t, n) {
|
|
1437
1543
|
let r = Y(e, t);
|
|
1438
1544
|
if (!r) return null;
|
|
1439
1545
|
let i = (r.items || []).find((e) => e.id === n);
|
|
1440
|
-
if (!i || i.type === "table" && !
|
|
1546
|
+
if (!i || i.type === "table" && !tn(e)) return null;
|
|
1441
1547
|
let a = structuredClone(i);
|
|
1442
|
-
return a.id =
|
|
1548
|
+
return a.id = fn(e, Cn(i)), a.x = wn(e, (i.x ?? 0) + Sn, a.w), a.y = Math.max(0, (i.y ?? 0) + Sn), a.type === "table" && rn(a, r), r.items ??= [], r.items.push(a), a;
|
|
1443
1549
|
}
|
|
1444
|
-
function
|
|
1445
|
-
return Number.isFinite(e?.page?.height) ?
|
|
1550
|
+
function En(e, t) {
|
|
1551
|
+
return Number.isFinite(e?.page?.height) ? Nt(e).find((e) => e.type === t)?.height ?? null : null;
|
|
1446
1552
|
}
|
|
1447
|
-
function
|
|
1448
|
-
let i =
|
|
1553
|
+
function Dn(e, t, n, r) {
|
|
1554
|
+
let i = En(e, t);
|
|
1449
1555
|
if (i == null) return Math.max(0, n);
|
|
1450
|
-
let a = Math.max(0, i -
|
|
1556
|
+
let a = Math.max(0, i - ft(r));
|
|
1451
1557
|
return Math.min(Math.max(0, n), a);
|
|
1452
1558
|
}
|
|
1453
|
-
function
|
|
1559
|
+
function On(e, t, n) {
|
|
1454
1560
|
let r = Y(e, t);
|
|
1455
1561
|
if (!r) return [];
|
|
1456
1562
|
r.items ??= [];
|
|
1457
1563
|
let i = [];
|
|
1458
1564
|
for (let { band: a, item: o } of n || []) {
|
|
1459
|
-
if (!o || o.type === "table" && !
|
|
1460
|
-
let n = structuredClone(o), s = Math.max(0, (o.y ?? 0) +
|
|
1461
|
-
n.id =
|
|
1565
|
+
if (!o || o.type === "table" && !tn(e) || !dn(t, o)) continue;
|
|
1566
|
+
let n = structuredClone(o), s = Math.max(0, (o.y ?? 0) + Sn);
|
|
1567
|
+
n.id = fn(e, Cn(o)), n.x = wn(e, (o.x ?? 0) + Sn, n.w), n.y = a === t ? s : Dn(e, t, s, n), n.type === "table" && rn(n, r), r.items.push(n), i.push(n);
|
|
1462
1568
|
}
|
|
1463
1569
|
return i;
|
|
1464
1570
|
}
|
|
1465
|
-
function
|
|
1571
|
+
function kn(e, t, n) {
|
|
1466
1572
|
let r = Y(e, t);
|
|
1467
1573
|
if (!r) return !1;
|
|
1468
1574
|
let i = (r.items || []).findIndex((e) => e.id === n);
|
|
1469
1575
|
return i === -1 ? !1 : (r.items.splice(i, 1), !0);
|
|
1470
1576
|
}
|
|
1471
|
-
function
|
|
1577
|
+
function An(e, t, n, r) {
|
|
1472
1578
|
if (t === n) return !1;
|
|
1473
1579
|
let i = Y(e, t), a = Y(e, n);
|
|
1474
1580
|
if (!i || !a) return !1;
|
|
1475
1581
|
let o = (i.items || []).find((e) => e.id === r);
|
|
1476
|
-
if (!o || !
|
|
1477
|
-
let s =
|
|
1478
|
-
|
|
1479
|
-
let c =
|
|
1582
|
+
if (!o || !dn(n, o)) return !1;
|
|
1583
|
+
let s = qt(e, t, o.x ?? 0, o.y ?? 0);
|
|
1584
|
+
kn(e, t, r), xn(e, n, o);
|
|
1585
|
+
let c = qt(e, n, 0, 0);
|
|
1480
1586
|
return s && c && (o.x = Math.round(s.x - c.x), o.y = Math.round(s.y - c.y)), !0;
|
|
1481
1587
|
}
|
|
1482
|
-
function
|
|
1588
|
+
function jn(e) {
|
|
1483
1589
|
e.columns ??= [];
|
|
1484
|
-
let t =
|
|
1590
|
+
let t = yn(e.columns.length + 1);
|
|
1485
1591
|
return e.columns.push(t), t;
|
|
1486
1592
|
}
|
|
1487
|
-
function
|
|
1593
|
+
function Mn(e, t) {
|
|
1488
1594
|
return !Array.isArray(e.columns) || e.columns.length <= 1 || t < 0 || t >= e.columns.length ? !1 : (e.columns.splice(t, 1), !0);
|
|
1489
1595
|
}
|
|
1490
|
-
function
|
|
1491
|
-
return t &&
|
|
1596
|
+
function Nn(e, t, { table: n = !1 } = {}) {
|
|
1597
|
+
return t && sn(e, t.band) && !(n && P(t.band)) ? t.band : sn(e, "detail") ? "detail" : $t(e)[0]?.type ?? null;
|
|
1492
1598
|
}
|
|
1493
|
-
var
|
|
1494
|
-
function
|
|
1599
|
+
var Pn = .01;
|
|
1600
|
+
function Fn(e) {
|
|
1495
1601
|
return [
|
|
1496
1602
|
{
|
|
1497
1603
|
at: e.x,
|
|
@@ -1507,7 +1613,7 @@ function Tn(e) {
|
|
|
1507
1613
|
}
|
|
1508
1614
|
];
|
|
1509
1615
|
}
|
|
1510
|
-
function
|
|
1616
|
+
function In(e) {
|
|
1511
1617
|
return [
|
|
1512
1618
|
{
|
|
1513
1619
|
at: e.y,
|
|
@@ -1523,7 +1629,7 @@ function En(e) {
|
|
|
1523
1629
|
}
|
|
1524
1630
|
];
|
|
1525
1631
|
}
|
|
1526
|
-
function
|
|
1632
|
+
function Ln(e) {
|
|
1527
1633
|
if (!e?.length) return null;
|
|
1528
1634
|
let t = Math.min(...e.map((e) => e.x)), n = Math.min(...e.map((e) => e.y)), r = Math.max(...e.map((e) => e.x + (e.w ?? 0))), i = Math.max(...e.map((e) => e.y + (e.h ?? 0)));
|
|
1529
1635
|
return {
|
|
@@ -1533,8 +1639,8 @@ function Dn(e) {
|
|
|
1533
1639
|
h: i - n
|
|
1534
1640
|
};
|
|
1535
1641
|
}
|
|
1536
|
-
function
|
|
1537
|
-
let i = n === "x" ?
|
|
1642
|
+
function Rn(e, t, n, r = []) {
|
|
1643
|
+
let i = n === "x" ? Fn : In, a = (r || []).filter(Number.isFinite).map((e) => ({
|
|
1538
1644
|
at: e,
|
|
1539
1645
|
centre: !1,
|
|
1540
1646
|
box: null
|
|
@@ -1556,19 +1662,19 @@ function On(e, t, n, r = []) {
|
|
|
1556
1662
|
...c
|
|
1557
1663
|
];
|
|
1558
1664
|
}
|
|
1559
|
-
function
|
|
1665
|
+
function zn(e, t, n = 6) {
|
|
1560
1666
|
let r = null;
|
|
1561
1667
|
for (let i of e) for (let e of t) {
|
|
1562
1668
|
let t = e.at - i.at;
|
|
1563
|
-
Math.abs(t) > n || (!r || Math.abs(t) < Math.abs(r.delta) -
|
|
1669
|
+
Math.abs(t) > n || (!r || Math.abs(t) < Math.abs(r.delta) - Pn) && (r = {
|
|
1564
1670
|
delta: t,
|
|
1565
1671
|
at: e.at
|
|
1566
1672
|
});
|
|
1567
1673
|
}
|
|
1568
1674
|
return r;
|
|
1569
1675
|
}
|
|
1570
|
-
function
|
|
1571
|
-
let a = t.filter((e) => Math.abs(e.at - n) <
|
|
1676
|
+
function Bn(e, t, n, r, i) {
|
|
1677
|
+
let a = t.filter((e) => Math.abs(e.at - n) < Pn);
|
|
1572
1678
|
if (!a.length) return [];
|
|
1573
1679
|
let o = a.some((e) => e.box === null), s = a.map((e) => e.box).filter(Boolean), c = r === "x" ? (e) => [e.y, e.y + (e.h ?? 0)] : (e) => [e.x, e.x + (e.w ?? 0)], l = r === "x" ? i?.h ?? 0 : i?.w ?? 0, u = [...c(e), ...s.flatMap(c)];
|
|
1574
1680
|
return [{
|
|
@@ -1579,13 +1685,13 @@ function An(e, t, n, r, i) {
|
|
|
1579
1685
|
centre: a.every((e) => e.centre)
|
|
1580
1686
|
}];
|
|
1581
1687
|
}
|
|
1582
|
-
function
|
|
1688
|
+
function Vn(e, t, n, { snap: r = 6, guides: i } = {}) {
|
|
1583
1689
|
if (!e) return {
|
|
1584
1690
|
dx: 0,
|
|
1585
1691
|
dy: 0,
|
|
1586
1692
|
lines: []
|
|
1587
1693
|
};
|
|
1588
|
-
let a =
|
|
1694
|
+
let a = Rn(t, n, "x", i?.x), o = Rn(t, n, "y", i?.y), s = zn(Fn(e), a, r), c = zn(In(e), o, r), l = s?.delta ?? 0, u = c?.delta ?? 0, d = {
|
|
1589
1695
|
...e,
|
|
1590
1696
|
x: e.x + l,
|
|
1591
1697
|
y: e.y + u
|
|
@@ -1593,17 +1699,17 @@ function jn(e, t, n, { snap: r = 6, guides: i } = {}) {
|
|
|
1593
1699
|
return {
|
|
1594
1700
|
dx: l,
|
|
1595
1701
|
dy: u,
|
|
1596
|
-
lines: [...s ?
|
|
1702
|
+
lines: [...s ? Bn(d, a, s.at, "x", n) : [], ...c ? Bn(d, o, c.at, "y", n) : []]
|
|
1597
1703
|
};
|
|
1598
1704
|
}
|
|
1599
|
-
function
|
|
1705
|
+
function Hn(e, t, n) {
|
|
1600
1706
|
let [r, i] = n === "x" ? ["x", "w"] : ["y", "h"];
|
|
1601
1707
|
return e[r] < t[r] + (t[i] ?? 0) && e[r] + (e[i] ?? 0) > t[r];
|
|
1602
1708
|
}
|
|
1603
|
-
function
|
|
1604
|
-
let i = r === "up" || r === "down", a = i ? "y" : "x", o = i ? "x" : "y", [s, c] = i ? ["y", "h"] : ["x", "w"], l = e[s], u = e[s] + (e[c] ?? 0), d = r === "up" || r === "left", f = (t || []).filter((t) =>
|
|
1709
|
+
function Un(e, t, n, r) {
|
|
1710
|
+
let i = r === "up" || r === "down", a = i ? "y" : "x", o = i ? "x" : "y", [s, c] = i ? ["y", "h"] : ["x", "w"], l = e[s], u = e[s] + (e[c] ?? 0), d = r === "up" || r === "left", f = (t || []).filter((t) => Hn(e, t, o) ? d ? t[s] + (t[c] ?? 0) <= l : t[s] >= u : !1), p = i ? n?.h ?? 0 : n?.w ?? 0, m = f.length ? d ? Math.max(...f.map((e) => e[s] + (e[c] ?? 0))) : Math.min(...f.map((e) => e[s])) : d ? 0 : p, h = d ? l - m : m - u;
|
|
1605
1711
|
if (!(h >= 0)) return null;
|
|
1606
|
-
let g = f.find((e) => Math.abs((d ? e[s] + (e[c] ?? 0) : e[s]) - m) <
|
|
1712
|
+
let g = f.find((e) => Math.abs((d ? e[s] + (e[c] ?? 0) : e[s]) - m) < Pn), ee = g ? [Math.max(e[o], g[o]), Math.min(e[o] + (e[i ? "w" : "h"] ?? 0), g[o] + (g[i ? "w" : "h"] ?? 0))] : [e[o], e[o] + (e[i ? "w" : "h"] ?? 0)];
|
|
1607
1713
|
return {
|
|
1608
1714
|
side: r,
|
|
1609
1715
|
axis: a,
|
|
@@ -1614,37 +1720,35 @@ function Nn(e, t, n, r) {
|
|
|
1614
1720
|
toBand: f.length === 0
|
|
1615
1721
|
};
|
|
1616
1722
|
}
|
|
1617
|
-
function
|
|
1723
|
+
function Wn(e, t, n) {
|
|
1618
1724
|
return e ? [
|
|
1619
1725
|
"up",
|
|
1620
1726
|
"down",
|
|
1621
1727
|
"left",
|
|
1622
1728
|
"right"
|
|
1623
|
-
].map((r) =>
|
|
1729
|
+
].map((r) => Un(e, t, n, r)).filter(Boolean) : [];
|
|
1624
1730
|
}
|
|
1625
|
-
function
|
|
1626
|
-
let i =
|
|
1731
|
+
function Gn(e, t, n, r = {}) {
|
|
1732
|
+
let i = Ln(e);
|
|
1627
1733
|
if (!i) return {
|
|
1628
1734
|
dx: 0,
|
|
1629
1735
|
dy: 0,
|
|
1630
1736
|
lines: [],
|
|
1631
1737
|
gaps: []
|
|
1632
1738
|
};
|
|
1633
|
-
let { dx: a, dy: o, lines: s } =
|
|
1739
|
+
let { dx: a, dy: o, lines: s } = Vn(i, t, n, r);
|
|
1634
1740
|
return {
|
|
1635
1741
|
dx: a,
|
|
1636
1742
|
dy: o,
|
|
1637
1743
|
lines: s,
|
|
1638
|
-
gaps:
|
|
1744
|
+
gaps: Wn({
|
|
1639
1745
|
...i,
|
|
1640
1746
|
x: i.x + a,
|
|
1641
1747
|
y: i.y + o
|
|
1642
1748
|
}, t, n)
|
|
1643
1749
|
};
|
|
1644
1750
|
}
|
|
1645
|
-
|
|
1646
|
-
//#region src/designer/select.js
|
|
1647
|
-
function In({ canvas: e, getLayout: t, getSelection: n, select: r, commit: i, remove: a = () => {}, duplicate: o = () => !1, getZoom: s = () => 1, enabled: c = () => !0, onTarget: l = () => {}, onGuides: u = () => {}, rulers: d = () => !1 }) {
|
|
1751
|
+
function Kn({ canvas: e, getLayout: t, getSelection: n, select: r, commit: i, remove: a = () => {}, duplicate: o = () => !1, getZoom: s = () => 1, enabled: c = () => !0, onTarget: l = () => {}, onGuides: u = () => {}, rulers: d = () => !1 }) {
|
|
1648
1752
|
let f = null, p = 0, m = !1, h = e.ownerDocument;
|
|
1649
1753
|
function g(t) {
|
|
1650
1754
|
let n = e.querySelector(".dz-page");
|
|
@@ -1673,7 +1777,7 @@ function In({ canvas: e, getLayout: t, getSelection: n, select: r, commit: i, re
|
|
|
1673
1777
|
}
|
|
1674
1778
|
function y(e, n) {
|
|
1675
1779
|
let r = Y(t(), e), i = new Set(n.map((e) => e.where.id));
|
|
1676
|
-
return (r?.items || []).filter((e) => !i.has(e.id)).map(
|
|
1780
|
+
return (r?.items || []).filter((e) => !i.has(e.id)).map(ht);
|
|
1677
1781
|
}
|
|
1678
1782
|
function b() {
|
|
1679
1783
|
return (n() || []).map((e) => ({
|
|
@@ -1726,7 +1830,7 @@ function In({ canvas: e, getLayout: t, getSelection: n, select: r, commit: i, re
|
|
|
1726
1830
|
let n = e.target.closest?.("[data-role=\"ruler\"]"), r = g(e);
|
|
1727
1831
|
if (!r) return !1;
|
|
1728
1832
|
if (n) {
|
|
1729
|
-
let a = n.dataset.axis, o =
|
|
1833
|
+
let a = n.dataset.axis, o = Tt(t(), a, r[a]);
|
|
1730
1834
|
return o === null ? !1 : (f = {
|
|
1731
1835
|
mode: "guide",
|
|
1732
1836
|
axis: a,
|
|
@@ -1741,7 +1845,7 @@ function In({ canvas: e, getLayout: t, getSelection: n, select: r, commit: i, re
|
|
|
1741
1845
|
}
|
|
1742
1846
|
if (!e.target.closest?.(".dz-page")) return !1;
|
|
1743
1847
|
for (let n of ["x", "y"]) {
|
|
1744
|
-
let i =
|
|
1848
|
+
let i = Ot(t(), n, r[n]);
|
|
1745
1849
|
if (i !== null) return f = {
|
|
1746
1850
|
mode: "guide",
|
|
1747
1851
|
axis: n,
|
|
@@ -1759,7 +1863,7 @@ function In({ canvas: e, getLayout: t, getSelection: n, select: r, commit: i, re
|
|
|
1759
1863
|
function T(e, t) {
|
|
1760
1864
|
let n = t.mode === "move" ? b().map((e) => ({
|
|
1761
1865
|
...e,
|
|
1762
|
-
box:
|
|
1866
|
+
box: ht(e.item)
|
|
1763
1867
|
})) : [];
|
|
1764
1868
|
f = {
|
|
1765
1869
|
...t,
|
|
@@ -1768,7 +1872,7 @@ function In({ canvas: e, getLayout: t, getSelection: n, select: r, commit: i, re
|
|
|
1768
1872
|
target: null,
|
|
1769
1873
|
startX: e.clientX,
|
|
1770
1874
|
startY: e.clientY,
|
|
1771
|
-
box: t.item ?
|
|
1875
|
+
box: t.item ? ht(t.item) : null,
|
|
1772
1876
|
moved: !1
|
|
1773
1877
|
}, w(e);
|
|
1774
1878
|
}
|
|
@@ -1777,39 +1881,39 @@ function In({ canvas: e, getLayout: t, getSelection: n, select: r, commit: i, re
|
|
|
1777
1881
|
if (f.mode === "guide") {
|
|
1778
1882
|
let n = g(e);
|
|
1779
1883
|
if (!n) return;
|
|
1780
|
-
f.moved = !0, f.at =
|
|
1884
|
+
f.moved = !0, f.at = Dt(t(), f.axis, f.at, n[f.axis]), i({
|
|
1781
1885
|
live: !0,
|
|
1782
1886
|
key: f.key
|
|
1783
1887
|
});
|
|
1784
1888
|
return;
|
|
1785
1889
|
}
|
|
1786
1890
|
let n = s() || 1, r = (e.clientX - f.startX) / n, a = (e.clientY - f.startY) / n;
|
|
1787
|
-
if (k(e.altKey), !f.moved && Math.abs(
|
|
1891
|
+
if (k(e.altKey), !f.moved && Math.abs(e.clientX - f.startX) < 3 && Math.abs(e.clientY - f.startY) < 3) return;
|
|
1788
1892
|
if (f.moved = !0, f.mode === "resize") {
|
|
1789
|
-
|
|
1893
|
+
bt(f.item, yt(f.handle, f.box, r, a, gt(f.item))), i({ live: !0 });
|
|
1790
1894
|
return;
|
|
1791
1895
|
}
|
|
1792
|
-
for (let e of f.group)
|
|
1896
|
+
for (let e of f.group) bt(e.item, {
|
|
1793
1897
|
...e.box,
|
|
1794
|
-
...
|
|
1898
|
+
...vt(e.box, r, a)
|
|
1795
1899
|
});
|
|
1796
1900
|
te(f.group);
|
|
1797
1901
|
let o = t(), c = /* @__PURE__ */ new Set();
|
|
1798
1902
|
for (let e of f.group) {
|
|
1799
|
-
let t =
|
|
1903
|
+
let t = Yt(o, e.where.band, e.item);
|
|
1800
1904
|
t && t !== e.where.band && c.add(t);
|
|
1801
1905
|
}
|
|
1802
1906
|
f.target = c.size ? [...c] : null, l(f.target), i({ live: !0 });
|
|
1803
1907
|
}
|
|
1804
1908
|
function te(e) {
|
|
1805
|
-
let n = f?.band ?
|
|
1909
|
+
let n = f?.band ? Gt(t(), f.band) : null;
|
|
1806
1910
|
if (!n || !e.length) {
|
|
1807
1911
|
u(null);
|
|
1808
1912
|
return;
|
|
1809
1913
|
}
|
|
1810
|
-
let r = y(f.band, e), i =
|
|
1811
|
-
if (i.dx || i.dy) for (let t of e)
|
|
1812
|
-
...
|
|
1914
|
+
let r = y(f.band, e), i = Gn(e.map((e) => ht(e.item)), r, n, { guides: d() ? kt(t(), n) : void 0 });
|
|
1915
|
+
if (i.dx || i.dy) for (let t of e) bt(t.item, {
|
|
1916
|
+
...ht(t.item),
|
|
1813
1917
|
x: (t.item.x ?? 0) + i.dx,
|
|
1814
1918
|
y: (t.item.y ?? 0) + i.dy
|
|
1815
1919
|
});
|
|
@@ -1820,16 +1924,16 @@ function In({ canvas: e, getLayout: t, getSelection: n, select: r, commit: i, re
|
|
|
1820
1924
|
});
|
|
1821
1925
|
}
|
|
1822
1926
|
function D() {
|
|
1823
|
-
let e = b(), n = e.at(-1)?.where ?? null, r = n ?
|
|
1927
|
+
let e = b(), n = e.at(-1)?.where ?? null, r = n ? Gt(t(), n.band) : null;
|
|
1824
1928
|
if (!r || !e.length) {
|
|
1825
1929
|
u(null);
|
|
1826
1930
|
return;
|
|
1827
1931
|
}
|
|
1828
|
-
let i = e.map((e) =>
|
|
1932
|
+
let i = e.map((e) => ht(e.item));
|
|
1829
1933
|
u({
|
|
1830
1934
|
band: n.band,
|
|
1831
1935
|
lines: [],
|
|
1832
|
-
gaps:
|
|
1936
|
+
gaps: Wn(Ln(i), y(n.band, e), r)
|
|
1833
1937
|
});
|
|
1834
1938
|
}
|
|
1835
1939
|
function O() {
|
|
@@ -1852,7 +1956,7 @@ function In({ canvas: e, getLayout: t, getSelection: n, select: r, commit: i, re
|
|
|
1852
1956
|
let { axis: e, at: n, key: r } = f;
|
|
1853
1957
|
f = null;
|
|
1854
1958
|
let a = re(e);
|
|
1855
|
-
(n === null || n < 0 || a !== null && n > a) &&
|
|
1959
|
+
(n === null || n < 0 || a !== null && n > a) && Et(t(), e, n), i({
|
|
1856
1960
|
live: !1,
|
|
1857
1961
|
key: r
|
|
1858
1962
|
});
|
|
@@ -1907,48 +2011,226 @@ function In({ canvas: e, getLayout: t, getSelection: n, select: r, commit: i, re
|
|
|
1907
2011
|
};
|
|
1908
2012
|
}
|
|
1909
2013
|
//#endregion
|
|
2014
|
+
//#region src/designer/icons.js
|
|
2015
|
+
var X = (e) => `<svg viewBox="0 0 16 16" width="16" height="16"
|
|
2016
|
+
fill="none" stroke="currentColor" stroke-width="1.5"
|
|
2017
|
+
stroke-linecap="round" stroke-linejoin="round"
|
|
2018
|
+
aria-hidden="true" focusable="false">${e}</svg>`, qn = {
|
|
2019
|
+
text: X("<path d=\"M3 3.75h10M8 3.75v8.5M6.25 12.25h3.5\"/>"),
|
|
2020
|
+
table: X("<rect x=\"2.25\" y=\"3.25\" width=\"11.5\" height=\"9.5\" rx=\"1.25\"/>\n <path d=\"M2.25 6.5h11.5M6.5 6.5v6.25M10 6.5v6.25\"/>"),
|
|
2021
|
+
image: X("<rect x=\"2.25\" y=\"3.25\" width=\"11.5\" height=\"9.5\" rx=\"1.25\"/>\n <path d=\"m2.75 11.5 3.5-3.5 2.5 2.5 1.5-1.5 3 3\"/>\n <circle cx=\"10.25\" cy=\"6.25\" r=\"1\"/>"),
|
|
2022
|
+
box: X("<rect x=\"2.5\" y=\"3.75\" width=\"11\" height=\"8.5\" rx=\"1.25\"/>"),
|
|
2023
|
+
line: X("<path d=\"M2 8h3.5M7.25 8h1.5M10.5 8H14\"/>"),
|
|
2024
|
+
ruler: X("<rect x=\"1.75\" y=\"5.25\" width=\"12.5\" height=\"5.5\" rx=\"1\"/>\n <path d=\"M4.5 5.25v2M7 5.25v3M9.5 5.25v2M12 5.25v3\"/>"),
|
|
2025
|
+
undo: X("<path d=\"M6 4.5 2.75 7.75 6 11\"/>\n <path d=\"M2.75 7.75h6.75a3.75 3.75 0 0 1 0 7.5H7\"/>"),
|
|
2026
|
+
redo: X("<path d=\"M10 4.5l3.25 3.25L10 11\"/>\n <path d=\"M13.25 7.75H6.5a3.75 3.75 0 0 0 0 7.5H9\"/>"),
|
|
2027
|
+
open: X("<path d=\"M1.75 12.5V4a.75.75 0 0 1 .75-.75h3.4l1.5 1.75h5.35\n a.75.75 0 0 1 .75.75v1.5\"/>\n <path d=\"M1.75 12.5 3.6 7.5h11.15l-1.85 5z\"/>"),
|
|
2028
|
+
field: X("<path d=\"M6.25 2.75c-1.5 0-2 .8-2 2v1.4c0 .9-.55 1.5-1.5 1.85\n .95.35 1.5.95 1.5 1.85v1.4c0 1.2.5 2 2 2\"/>\n <path d=\"M9.75 2.75c1.5 0 2 .8 2 2v1.4c0 .9.55 1.5 1.5 1.85\n -.95.35-1.5.95-1.5 1.85v1.4c0 1.2-.5 2-2 2\"/>"),
|
|
2029
|
+
external: X("<path d=\"M9.5 2.75h3.75V6.5\"/>\n <path d=\"M13.25 2.75 7.5 8.5\"/>\n <path d=\"M11.5 9.25v3a1 1 0 0 1-1 1h-7a1 1 0 0 1-1-1v-7\n a1 1 0 0 1 1-1h3\"/>"),
|
|
2030
|
+
preview: X("<path d=\"M1 8s2.6-4.25 7-4.25S15 8 15 8s-2.6 4.25-7 4.25S1 8 1 8z\"/>\n <circle cx=\"8\" cy=\"8\" r=\"1.9\"/>"),
|
|
2031
|
+
design: X("<path d=\"M11.4 2.85 13.15 4.6 5.3 12.45l-2.4.65.65-2.4z\"/>\n <path d=\"M10.15 4.1l1.75 1.75\"/>"),
|
|
2032
|
+
data: X("<ellipse cx=\"8\" cy=\"4\" rx=\"5.25\" ry=\"2\"/>\n <path d=\"M2.75 4v8c0 1.1 2.35 2 5.25 2s5.25-.9 5.25-2V4\"/>\n <path d=\"M2.75 8c0 1.1 2.35 2 5.25 2s5.25-.9 5.25-2\"/>"),
|
|
2033
|
+
duplicate: X("<rect x=\"2.5\" y=\"2.5\" width=\"8\" height=\"8\" rx=\"1.25\"/>\n <rect x=\"5.5\" y=\"5.5\" width=\"8\" height=\"8\" rx=\"1.25\"/>"),
|
|
2034
|
+
copy: X("<path d=\"M6 2.25h3.6L12.25 4.9v5.85a.75.75 0 0 1-.75.75H6\n a.75.75 0 0 1-.75-.75V3a.75.75 0 0 1 .75-.75z\"/>\n <path d=\"M9.35 2.4v2.65h2.75\"/>\n <path d=\"M3.9 5.5H3a.75.75 0 0 0-.75.75V13a.75.75 0 0 0 .75.75h5.4\n a.75.75 0 0 0 .75-.75v-.75\"/>"),
|
|
2035
|
+
delete: X("<path d=\"M2.75 4.5h10.5\"/>\n <path d=\"M6.25 4.5V3.25a.75.75 0 0 1 .75-.75h2a.75.75 0 0 1 .75.75V4.5\"/>\n <path d=\"M4.4 4.5l.55 8.15a.85.85 0 0 0 .85.8h4.4a.85.85 0 0 0 .85-.8L11.6 4.5\"/>\n <path d=\"M6.85 7v3.75M9.15 7v3.75\"/>"),
|
|
2036
|
+
paste: X("<path d=\"M6.25 3.25H4.5a.75.75 0 0 0-.75.75v8.75\n a.75.75 0 0 0 .75.75h7a.75.75 0 0 0 .75-.75V4\n a.75.75 0 0 0-.75-.75H9.75\"/>\n <rect x=\"6.25\" y=\"1.75\" width=\"3.5\" height=\"2.75\" rx=\".85\"/>"),
|
|
2037
|
+
format: X("<path d=\"M12.25 3.75 3.75 12.25\"/>\n <circle cx=\"4.75\" cy=\"4.75\" r=\"1.75\"/>\n <circle cx=\"11.25\" cy=\"11.25\" r=\"1.75\"/>"),
|
|
2038
|
+
highlight: X("<path d=\"M9.75 2.75 13.25 6.25 8 11.5H4.5V8z\"/>\n <path d=\"M2.25 13.75h11.5\"/>"),
|
|
2039
|
+
alignLeft: X("<path d=\"M2.75 4h10.5M2.75 8h6.5M2.75 12h8.5\"/>"),
|
|
2040
|
+
alignCenter: X("<path d=\"M2.75 4h10.5M4.75 8h6.5M3.75 12h8.5\"/>"),
|
|
2041
|
+
alignRight: X("<path d=\"M2.75 4h10.5M6.75 8h6.5M4.75 12h8.5\"/>"),
|
|
2042
|
+
horizontal: X("<path d=\"M2.5 8h11\"/>"),
|
|
2043
|
+
vertical: X("<path d=\"M8 2.5v11\"/>"),
|
|
2044
|
+
portrait: X("<rect x=\"4.25\" y=\"2.25\" width=\"7.5\" height=\"11.5\" rx=\"1\"/>"),
|
|
2045
|
+
landscape: X("<rect x=\"2.25\" y=\"4.25\" width=\"11.5\" height=\"7.5\" rx=\"1\"/>"),
|
|
2046
|
+
save: X("<path d=\"M2.75 3.25h8.5l2.5 2.5v7a.5.5 0 0 1-.5.5h-11\n a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5z\"/>\n <path d=\"M5 3.25v3.5h5.5v-3.5M5 13.25V9.5h6v3.75\"/>")
|
|
2047
|
+
};
|
|
2048
|
+
function Z(e) {
|
|
2049
|
+
return qn[e] ?? "";
|
|
2050
|
+
}
|
|
2051
|
+
//#endregion
|
|
2052
|
+
//#region src/designer/choice.js
|
|
2053
|
+
function Jn(e, t, n, r, { label: i = "" } = {}) {
|
|
2054
|
+
let a = n.find((e) => String(e.value) === String(r ?? "")) ?? n[0], o = e ? `${e}-value` : "", s = e && !i ? `aria-labelledby="${e}-label ${o}"` : `aria-label="${S(i)}"`;
|
|
2055
|
+
return `
|
|
2056
|
+
<span class="dz-choice">
|
|
2057
|
+
<select class="dz-choice-native" ${t} tabindex="-1" aria-hidden="true">${n.map((e) => `<option value="${S(e.value)}"${e === a ? " selected" : ""}
|
|
2058
|
+
>${S(e.label)}</option>`).join("")}</select>
|
|
2059
|
+
<button type="button" class="dz-choice-trigger"${e ? ` id="${e}"` : ""}
|
|
2060
|
+
aria-haspopup="listbox" aria-expanded="false" ${s}>
|
|
2061
|
+
<span class="dz-choice-value"${o ? ` id="${o}"` : ""}
|
|
2062
|
+
>${S(a?.label ?? "")}</span>
|
|
2063
|
+
</button>
|
|
2064
|
+
</span>`;
|
|
2065
|
+
}
|
|
2066
|
+
function Yn(e) {
|
|
2067
|
+
let t = e.closest?.(".dz-choice")?.querySelector(".dz-choice-value");
|
|
2068
|
+
t && (t.textContent = e.selectedOptions?.[0]?.textContent.trim() ?? "");
|
|
2069
|
+
}
|
|
2070
|
+
function Xn(e) {
|
|
2071
|
+
for (let t of e.querySelectorAll(".dz-choice select")) Yn(t);
|
|
2072
|
+
}
|
|
2073
|
+
function Zn(e) {
|
|
2074
|
+
let t = e.ownerDocument, n = t.defaultView, r = e.closest(".report-designer") ?? e.parentElement ?? t.body, i = t.createElement("ul");
|
|
2075
|
+
i.className = "dropdown-menu dz-listbox", e.classList.contains("modal") && i.classList.add("is-roomy"), i.setAttribute("role", "listbox"), i.hidden = !0, r.appendChild(i);
|
|
2076
|
+
let a = null, o = 0, s = () => [...i.children];
|
|
2077
|
+
function c() {
|
|
2078
|
+
s().forEach((e, t) => e.classList.toggle("is-active", t === o));
|
|
2079
|
+
let e = s()[o];
|
|
2080
|
+
e && (e.focus({ preventScroll: !0 }), e.scrollIntoView?.({ block: "nearest" }));
|
|
2081
|
+
}
|
|
2082
|
+
function l(r) {
|
|
2083
|
+
let s = r.closest(".dz-choice")?.querySelector("select");
|
|
2084
|
+
s && (a && d(!1), a = r, o = Math.max(s.selectedIndex, 0), i.innerHTML = [...s.options].map((e, t) => `
|
|
2085
|
+
<li class="dropdown-item" role="option" tabindex="-1" data-index="${t}"
|
|
2086
|
+
aria-selected="${t === s.selectedIndex}">${S(e.textContent.trim())}</li>`).join(""), r.id ? i.setAttribute("aria-labelledby", `${r.id}-label`) : i.removeAttribute("aria-labelledby"), i.hidden = !1, r.setAttribute("aria-expanded", "true"), u(r), c(), n.setTimeout(() => {
|
|
2087
|
+
a === r && t.addEventListener("pointerdown", p, !0);
|
|
2088
|
+
}, 0), e.addEventListener("scroll", m, !0), n.addEventListener("resize", m));
|
|
2089
|
+
}
|
|
2090
|
+
function u(e) {
|
|
2091
|
+
let t = e.getBoundingClientRect(), r = s()[o];
|
|
2092
|
+
i.style.minWidth = `${Math.round(t.width) + 8}px`, i.style.left = "0px", i.style.top = "0px";
|
|
2093
|
+
let a = i.offsetHeight, c = i.offsetWidth, l = r ? t.top - r.offsetTop + (t.height - r.offsetHeight) / 2 : t.bottom + 4;
|
|
2094
|
+
l = Math.min(Math.max(l, 8), Math.max(8, n.innerHeight - a - 8));
|
|
2095
|
+
let u = t.left - 4;
|
|
2096
|
+
u = Math.min(Math.max(u, 8), Math.max(8, n.innerWidth - c - 8)), i.style.top = `${Math.round(l)}px`, i.style.left = `${Math.round(u)}px`;
|
|
2097
|
+
}
|
|
2098
|
+
function d(r = !0) {
|
|
2099
|
+
if (!a) return;
|
|
2100
|
+
let o = a;
|
|
2101
|
+
a = null, i.hidden = !0, i.innerHTML = "", o.setAttribute("aria-expanded", "false"), t.removeEventListener("pointerdown", p, !0), e.removeEventListener("scroll", m, !0), n.removeEventListener("resize", m), r && o.isConnected && o.focus();
|
|
2102
|
+
}
|
|
2103
|
+
function f(n) {
|
|
2104
|
+
let r = a, i = r?.closest(".dz-choice")?.querySelector("select");
|
|
2105
|
+
if (d(!1), !i) return;
|
|
2106
|
+
let o = r.id;
|
|
2107
|
+
i.selectedIndex !== n && (i.selectedIndex = n, Yn(i), i.dispatchEvent(new Event("input", { bubbles: !0 })), i.dispatchEvent(new Event("change", { bubbles: !0 })));
|
|
2108
|
+
let s = t.activeElement;
|
|
2109
|
+
if (s && s !== t.body && e.contains(s)) return;
|
|
2110
|
+
let c = o ? t.getElementById(o) : null;
|
|
2111
|
+
c && e.contains(c) ? c.focus() : r.isConnected && r.focus();
|
|
2112
|
+
}
|
|
2113
|
+
function p(e) {
|
|
2114
|
+
i.contains(e.target) || a?.contains(e.target) || d(!1);
|
|
2115
|
+
}
|
|
2116
|
+
function m() {
|
|
2117
|
+
d(!1);
|
|
2118
|
+
}
|
|
2119
|
+
function h(e) {
|
|
2120
|
+
let t = e.target.closest?.(".dropdown-item");
|
|
2121
|
+
t && f(Number(t.dataset.index));
|
|
2122
|
+
}
|
|
2123
|
+
function g(e) {
|
|
2124
|
+
let t = e.target.closest?.(".dropdown-item");
|
|
2125
|
+
t && (o = Number(t.dataset.index), s().forEach((e, t) => e.classList.toggle("is-active", t === o)));
|
|
2126
|
+
}
|
|
2127
|
+
function ee(e) {
|
|
2128
|
+
let t = s().length, n = (e) => () => {
|
|
2129
|
+
o = Math.min(Math.max(e, 0), t - 1), c();
|
|
2130
|
+
}, r = {
|
|
2131
|
+
ArrowDown: n(o + 1),
|
|
2132
|
+
ArrowUp: n(o - 1),
|
|
2133
|
+
Home: n(0),
|
|
2134
|
+
End: n(t - 1),
|
|
2135
|
+
PageDown: n(o + 8),
|
|
2136
|
+
PageUp: n(o - 8),
|
|
2137
|
+
Enter: () => f(o),
|
|
2138
|
+
" ": () => f(o),
|
|
2139
|
+
Escape: () => d(!0),
|
|
2140
|
+
Tab: () => d(!0)
|
|
2141
|
+
}[e.key];
|
|
2142
|
+
if (r) {
|
|
2143
|
+
e.preventDefault(), e.stopPropagation(), r();
|
|
2144
|
+
return;
|
|
2145
|
+
}
|
|
2146
|
+
if (e.key.length !== 1 || e.ctrlKey || e.metaKey || e.altKey) return;
|
|
2147
|
+
e.preventDefault(), e.stopPropagation();
|
|
2148
|
+
let i = e.key.toLowerCase(), a = s();
|
|
2149
|
+
for (let e = 1; e <= a.length; e++) {
|
|
2150
|
+
let t = (o + e) % a.length;
|
|
2151
|
+
if (a[t].textContent.trim().toLowerCase().startsWith(i)) {
|
|
2152
|
+
o = t, c();
|
|
2153
|
+
return;
|
|
2154
|
+
}
|
|
2155
|
+
}
|
|
2156
|
+
}
|
|
2157
|
+
function _(t) {
|
|
2158
|
+
let n = t.target.closest?.(".dz-choice-trigger");
|
|
2159
|
+
!n || !e.contains(n) || (t.preventDefault(), a === n ? d(!0) : l(n));
|
|
2160
|
+
}
|
|
2161
|
+
function v(e) {
|
|
2162
|
+
let t = e.target.closest?.(".dz-choice-trigger");
|
|
2163
|
+
t && (e.key === "Tab" || e.ctrlKey || e.metaKey || (e.stopPropagation(), [
|
|
2164
|
+
"ArrowDown",
|
|
2165
|
+
"ArrowUp",
|
|
2166
|
+
"Enter",
|
|
2167
|
+
" "
|
|
2168
|
+
].includes(e.key) && (e.preventDefault(), l(t))));
|
|
2169
|
+
}
|
|
2170
|
+
function y(e) {
|
|
2171
|
+
let t = e.target;
|
|
2172
|
+
t.classList?.contains("dz-choice-native") && t.closest(".dz-choice")?.querySelector(".dz-choice-trigger")?.focus();
|
|
2173
|
+
}
|
|
2174
|
+
return i.addEventListener("click", h), i.addEventListener("pointermove", g), i.addEventListener("keydown", ee), e.addEventListener("click", _), e.addEventListener("keydown", v), e.addEventListener("focusin", y), function() {
|
|
2175
|
+
d(!1), i.remove(), e.removeEventListener("click", _), e.removeEventListener("keydown", v), e.removeEventListener("focusin", y);
|
|
2176
|
+
};
|
|
2177
|
+
}
|
|
2178
|
+
//#endregion
|
|
1910
2179
|
//#region src/designer/panel.js
|
|
1911
|
-
function
|
|
2180
|
+
function Qn(e, t, n = "") {
|
|
1912
2181
|
return `
|
|
1913
2182
|
<div class="dz-panel-head">
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
2183
|
+
${n ? `<span class="dz-panel-icon">${n}</span>` : ""}
|
|
2184
|
+
${t == null ? "" : `<span class="dz-panel-id">${S(t)}</span>`}
|
|
2185
|
+
<span class="dz-panel-type">${S(e)}</span>
|
|
2186
|
+
</div>`;
|
|
2187
|
+
}
|
|
2188
|
+
function $n(e, t = "") {
|
|
2189
|
+
return `
|
|
2190
|
+
<div class="dz-section-head">
|
|
2191
|
+
<h3>${S(e)}</h3>
|
|
2192
|
+
${t ? `<span class="dz-section-tools">${t}</span>` : ""}
|
|
2193
|
+
</div>`;
|
|
2194
|
+
}
|
|
2195
|
+
var er = "<svg viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" fill=\"none\"\n stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\"\n aria-hidden=\"true\" focusable=\"false\"><path d=\"M8 3.5v9M3.5 8h9\"/></svg>";
|
|
2196
|
+
function tr(e, t = null) {
|
|
2197
|
+
return `
|
|
2198
|
+
${Qn(e.type, e.id, Z(e.type))}
|
|
2199
|
+
${lr(e, Le(e))}
|
|
1918
2200
|
${e.type === "text" ? `
|
|
1919
2201
|
<section class="dz-section">
|
|
1920
|
-
|
|
2202
|
+
${$n("Format")}
|
|
1921
2203
|
<div class="dz-field dz-field-format">
|
|
1922
|
-
<label>Values</label>
|
|
1923
|
-
${
|
|
2204
|
+
<label class="dz-label">Values</label>
|
|
2205
|
+
${ur(e, t)}
|
|
1924
2206
|
</div>
|
|
1925
2207
|
<div class="dz-field dz-field-format">
|
|
1926
|
-
<label>Highlight</label>
|
|
1927
|
-
${
|
|
2208
|
+
<label class="dz-label">Highlight</label>
|
|
2209
|
+
${dr(e.highlight, "edit-highlight")}
|
|
1928
2210
|
</div>
|
|
1929
2211
|
</section>` : ""}
|
|
1930
2212
|
${e.type === "table" ? `
|
|
1931
2213
|
<section class="dz-section">
|
|
1932
|
-
|
|
2214
|
+
${$n("Row highlight")}
|
|
1933
2215
|
<div class="dz-field dz-field-format">
|
|
1934
|
-
<label>Rows</label>
|
|
1935
|
-
${
|
|
2216
|
+
<label class="dz-label">Rows</label>
|
|
2217
|
+
${dr(e.rowHighlight, "edit-row-highlight")}
|
|
1936
2218
|
</div>
|
|
1937
2219
|
</section>` : ""}
|
|
1938
|
-
${e.type === "table" ?
|
|
1939
|
-
${e.type === "table" ?
|
|
2220
|
+
${e.type === "table" ? nr(e, t) : ""}
|
|
2221
|
+
${e.type === "table" ? Dr(e, t) : ""}`;
|
|
1940
2222
|
}
|
|
1941
|
-
function
|
|
2223
|
+
function nr(e, t) {
|
|
1942
2224
|
let n = b(e);
|
|
1943
2225
|
if (!n.length) return "";
|
|
1944
2226
|
let r = t ?? { bands: [{
|
|
1945
2227
|
type: "detail",
|
|
1946
2228
|
items: [e]
|
|
1947
|
-
}] }, i = t ?
|
|
2229
|
+
}] }, i = t ? ge(t).filter((t) => t.table !== e.id) : [];
|
|
1948
2230
|
return `
|
|
1949
2231
|
<section class="dz-section dz-bands dz-grouping">
|
|
1950
|
-
|
|
1951
|
-
${n.map((t, i) =>
|
|
2232
|
+
${$n("Grouping")}
|
|
2233
|
+
${n.map((t, i) => rr(r, e, t, i, n.length)).join("")}
|
|
1952
2234
|
${n.length < 8 ? "\n <button type=\"button\" class=\"dz-add-row\" data-action=\"add-group-level\"\n title=\"Split each group of this table again, by another field\">\n Group within each group</button>" : ""}
|
|
1953
2235
|
${i.map((e) => `
|
|
1954
2236
|
<button type="button" class="dz-add-row" data-action="copy-grouping"
|
|
@@ -1957,9 +2239,9 @@ function Rn(e, t) {
|
|
|
1957
2239
|
Copy group design from ${S(e.table)}</button>`).join("")}
|
|
1958
2240
|
</section>`;
|
|
1959
2241
|
}
|
|
1960
|
-
function
|
|
1961
|
-
let a = typeof n?.by == "string" ? n.by : "", o =
|
|
1962
|
-
if (i === 1) return `${
|
|
2242
|
+
function rr(e, t, n, r, i) {
|
|
2243
|
+
let a = typeof n?.by == "string" ? n.by : "", o = ir(e, t, a, r);
|
|
2244
|
+
if (i === 1) return `${or(n, r)}${o}`;
|
|
1963
2245
|
let s = `dz-f-group-level-${r}`;
|
|
1964
2246
|
return `
|
|
1965
2247
|
<div class="dz-group-level" data-level="${r}">
|
|
@@ -1979,18 +2261,18 @@ function zn(e, t, n, r, i) {
|
|
|
1979
2261
|
</div>
|
|
1980
2262
|
${r > 0 ? `
|
|
1981
2263
|
<div class="dz-field dz-field-text">
|
|
1982
|
-
<label for="${s}">Then group by</label>
|
|
2264
|
+
<label class="dz-label" for="${s}">Then group by</label>
|
|
1983
2265
|
<input type="text" id="${s}" data-group-level="${r}"
|
|
1984
2266
|
value="${S(a)}" spellcheck="false">
|
|
1985
2267
|
<p class="dz-hint">A field to group each group above by</p>
|
|
1986
2268
|
</div>` : ""}
|
|
1987
|
-
${
|
|
2269
|
+
${or(n, r)}
|
|
1988
2270
|
${o}
|
|
1989
2271
|
</div>`;
|
|
1990
2272
|
}
|
|
1991
|
-
function
|
|
2273
|
+
function ir(e, t, n, r) {
|
|
1992
2274
|
let i = n || "group";
|
|
1993
|
-
return A.map((n) =>
|
|
2275
|
+
return A.map((n) => Ar(e, fe(n, t.id, r), n === "groupHeader" ? {
|
|
1994
2276
|
label: "Group header",
|
|
1995
2277
|
note: `Before each ${i}`
|
|
1996
2278
|
} : {
|
|
@@ -1998,7 +2280,7 @@ function Bn(e, t, n, r) {
|
|
|
1998
2280
|
note: `After each ${i}`
|
|
1999
2281
|
})).join("");
|
|
2000
2282
|
}
|
|
2001
|
-
var
|
|
2283
|
+
var ar = [
|
|
2002
2284
|
{
|
|
2003
2285
|
value: "",
|
|
2004
2286
|
label: "As they come"
|
|
@@ -2012,15 +2294,12 @@ var Vn = [
|
|
|
2012
2294
|
label: "Z to A, 9 to 0"
|
|
2013
2295
|
}
|
|
2014
2296
|
];
|
|
2015
|
-
function
|
|
2297
|
+
function or(e, t) {
|
|
2016
2298
|
let n = typeof e?.sort == "string" ? e.sort : "", r = `dz-f-group-${t}`;
|
|
2017
2299
|
return `
|
|
2018
2300
|
<div class="dz-field dz-field-choice">
|
|
2019
|
-
<label for="${r}-sort">Order groups</label>
|
|
2020
|
-
|
|
2021
|
-
${Vn.map((e) => `<option value="${e.value}"${e.value === n ? " selected" : ""}
|
|
2022
|
-
>${S(e.label)}</option>`).join("")}
|
|
2023
|
-
</select>
|
|
2301
|
+
<label class="dz-label" id="${r}-sort-label" for="${r}-sort">Order groups</label>
|
|
2302
|
+
${Jn(`${r}-sort`, `data-group-option="sort" data-level="${t}"`, ar, n)}
|
|
2024
2303
|
</div>
|
|
2025
2304
|
<div class="dz-field dz-field-toggle">
|
|
2026
2305
|
<label for="${r}-page">New page for each group</label>
|
|
@@ -2029,11 +2308,9 @@ function Hn(e, t) {
|
|
|
2029
2308
|
<p class="dz-hint">Every group but the first starts at the top of a page</p>
|
|
2030
2309
|
</div>`;
|
|
2031
2310
|
}
|
|
2032
|
-
function
|
|
2311
|
+
function sr(e) {
|
|
2033
2312
|
return `
|
|
2034
|
-
|
|
2035
|
-
<span class="dz-panel-type">${e.length} items</span>
|
|
2036
|
-
</div>
|
|
2313
|
+
${Qn(`${e.length} items`)}
|
|
2037
2314
|
|
|
2038
2315
|
<section class="dz-section">
|
|
2039
2316
|
<ul class="dz-selected">
|
|
@@ -2050,27 +2327,24 @@ function Un(e) {
|
|
|
2050
2327
|
</p>
|
|
2051
2328
|
</section>`;
|
|
2052
2329
|
}
|
|
2053
|
-
function
|
|
2330
|
+
function cr(e) {
|
|
2054
2331
|
return `
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
</div>
|
|
2059
|
-
${Gn(e, Be(e))}
|
|
2060
|
-
${nr(e)}`;
|
|
2332
|
+
${Qn("report", e.name ?? "Untitled", Z("open"))}
|
|
2333
|
+
${lr(e, Xe(e))}
|
|
2334
|
+
${Or(e)}`;
|
|
2061
2335
|
}
|
|
2062
|
-
function
|
|
2336
|
+
function lr(e, t) {
|
|
2063
2337
|
return t.map((t) => `
|
|
2064
2338
|
<section class="dz-section">
|
|
2065
|
-
|
|
2066
|
-
${t.fields.map((t) =>
|
|
2339
|
+
${$n(t.title)}
|
|
2340
|
+
${t.fields.map((t) => fr(e, t)).join("")}
|
|
2067
2341
|
${(t.actions ?? []).map((e) => `
|
|
2068
2342
|
<button type="button" class="dz-add-row dz-section-action"
|
|
2069
2343
|
data-action="${S(e.action)}" title="${S(e.title ?? "")}">
|
|
2070
2344
|
${S(e.label)}</button>`).join("")}
|
|
2071
2345
|
</section>`).join("");
|
|
2072
2346
|
}
|
|
2073
|
-
function
|
|
2347
|
+
function ur(e, t, n) {
|
|
2074
2348
|
let r = h(e?.format, t?.format);
|
|
2075
2349
|
return `
|
|
2076
2350
|
<button type="button" class="dz-format" data-action="edit-format"
|
|
@@ -2080,7 +2354,7 @@ function Kn(e, t, n) {
|
|
|
2080
2354
|
<span class="dz-format-edit">Edit</span>
|
|
2081
2355
|
</button>`;
|
|
2082
2356
|
}
|
|
2083
|
-
function
|
|
2357
|
+
function dr(e, t, n) {
|
|
2084
2358
|
let r = p(e);
|
|
2085
2359
|
return `
|
|
2086
2360
|
<button type="button" class="dz-format" data-action="${S(t)}"
|
|
@@ -2090,33 +2364,37 @@ function qn(e, t, n) {
|
|
|
2090
2364
|
<span class="dz-format-edit">Edit</span>
|
|
2091
2365
|
</button>`;
|
|
2092
2366
|
}
|
|
2093
|
-
function
|
|
2094
|
-
let r =
|
|
2095
|
-
<label for="${i}">${S(t.label)}</label>
|
|
2367
|
+
function fr(e, t, n = "") {
|
|
2368
|
+
let r = nt(e, t), i = `dz-f-${t.key.replace(/\./g, "-")}${n ? `-${n}` : ""}`, a = n ? `data-field="${S(t.key)}" data-column="${S(n)}"` : `data-field="${S(t.key)}"`, o = t.type === "number" && t.short, s = t.type === "number" ? " dz-scrub" : "", c = t.type === "textarea" ? `<span class="dz-field-top">
|
|
2369
|
+
<label class="dz-label" for="${i}">${S(t.label)}</label>
|
|
2096
2370
|
<button type="button" class="dz-brace" data-action="insert-brace"
|
|
2097
2371
|
data-for="${S(t.key)}"
|
|
2098
2372
|
title="Wrap the selected text in braces, or insert a pair"
|
|
2099
2373
|
aria-label="Insert a placeholder">{ }</button>
|
|
2100
|
-
</span>` : `<label
|
|
2374
|
+
</span>` : `<label class="dz-label${o ? " dz-sr" : s}" id="${i}-label"${t.segmented ? "" : ` for="${i}"`}
|
|
2375
|
+
${s ? "title=\"Drag sideways to change\"" : ""}>${S(t.label)}</label>`, l = t.half || t.type === "number" || t.type === "color", u = o ? `<span class="dz-input">
|
|
2376
|
+
<span class="dz-input-prefix dz-scrub" aria-hidden="true"
|
|
2377
|
+
title="${S(t.label)} - drag sideways to change">${S(t.short)}</span>
|
|
2378
|
+
${pr(i, a, t, r)}
|
|
2379
|
+
</span>` : pr(i, a, t, r);
|
|
2101
2380
|
return `
|
|
2102
|
-
<div class="dz-field dz-field-${t.type}">
|
|
2103
|
-
${
|
|
2104
|
-
${
|
|
2381
|
+
<div class="dz-field dz-field-${t.type}${l ? " is-half" : ""}">
|
|
2382
|
+
${c}
|
|
2383
|
+
${u}
|
|
2105
2384
|
${t.hint ? `<p class="dz-hint">${S(t.hint)}</p>` : ""}
|
|
2106
2385
|
</div>`;
|
|
2107
2386
|
}
|
|
2108
|
-
function
|
|
2387
|
+
function pr(e, t, n, r) {
|
|
2109
2388
|
switch (n.type) {
|
|
2110
2389
|
case "textarea": return `
|
|
2111
2390
|
<div class="dz-value">
|
|
2112
2391
|
<div class="dz-value-marks" data-role="marks" aria-hidden="true"
|
|
2113
|
-
>${
|
|
2392
|
+
>${Nr(r ?? "")}</div>
|
|
2114
2393
|
<textarea id="${e}" ${t} rows="2"
|
|
2115
2394
|
spellcheck="false">${S(r ?? "")}</textarea>
|
|
2116
2395
|
</div>`;
|
|
2117
|
-
case "choice": return n.
|
|
2118
|
-
|
|
2119
|
-
case "color": return $n(e, t, n, r);
|
|
2396
|
+
case "choice": return n.segmented ? _r(e, t, n, r) : n.custom ? gr(e, t, n, r) : Jn(e, t, n.options, r);
|
|
2397
|
+
case "color": return vr(e, t, n, r);
|
|
2120
2398
|
case "toggle": return `<input type="checkbox" id="${e}" ${t}
|
|
2121
2399
|
${r ? "checked" : ""}>`;
|
|
2122
2400
|
case "image": return `
|
|
@@ -2133,10 +2411,11 @@ function Yn(e, t, n, r) {
|
|
|
2133
2411
|
default: return `<input type="number" id="${e}" ${t}
|
|
2134
2412
|
value="${S(r ?? "")}"
|
|
2135
2413
|
${n.min == null ? "" : `min="${n.min}"`}
|
|
2136
|
-
${n.max == null ? "" : `max="${n.max}"`} step="1"
|
|
2414
|
+
${n.max == null ? "" : `max="${n.max}"`} step="1"
|
|
2415
|
+
${n.disabled ? "disabled" : ""}>`;
|
|
2137
2416
|
}
|
|
2138
2417
|
}
|
|
2139
|
-
function
|
|
2418
|
+
function mr(e, t, n) {
|
|
2140
2419
|
let r = typeof t?.background == "string" && t.background ? t.background : null;
|
|
2141
2420
|
return `
|
|
2142
2421
|
<span class="dz-swatch dz-band-fill${r ? "" : " is-none"}"
|
|
@@ -2150,88 +2429,131 @@ function Xn(e, t, n) {
|
|
|
2150
2429
|
aria-label="Remove ${S(n)} background">×</button>
|
|
2151
2430
|
</span>`;
|
|
2152
2431
|
}
|
|
2153
|
-
var
|
|
2154
|
-
function
|
|
2155
|
-
let i = n.options.some((e) => e.value === (r ?? "")), a = i ? r ?? "" :
|
|
2432
|
+
var hr = "__custom__";
|
|
2433
|
+
function gr(e, t, n, r) {
|
|
2434
|
+
let i = n.options.some((e) => e.value === (r ?? "")), a = i ? r ?? "" : hr;
|
|
2156
2435
|
return `
|
|
2157
2436
|
<span class="dz-choice-custom">
|
|
2158
|
-
|
|
2159
|
-
value:
|
|
2437
|
+
${Jn(e, t, [...n.options, {
|
|
2438
|
+
value: hr,
|
|
2160
2439
|
label: "Custom…"
|
|
2161
|
-
}]
|
|
2162
|
-
>${S(e.label)}</option>`).join("")}</select>
|
|
2440
|
+
}], a)}
|
|
2163
2441
|
<input type="text" ${t} data-custom="true" value="${S(i ? "" : r ?? "")}"
|
|
2164
2442
|
spellcheck="false" maxlength="6" aria-label="${S(n.label)}, custom"
|
|
2165
2443
|
placeholder="such as CHF"${i ? " hidden" : ""}>
|
|
2166
2444
|
</span>`;
|
|
2167
2445
|
}
|
|
2168
|
-
function
|
|
2446
|
+
function _r(e, t, n, r) {
|
|
2447
|
+
let i = e;
|
|
2448
|
+
return `
|
|
2449
|
+
<span class="dz-segmented" role="radiogroup" aria-label="${S(n.label)}">
|
|
2450
|
+
${n.options.map((n, a) => `
|
|
2451
|
+
<label class="dz-seg" title="${S(n.label)}">
|
|
2452
|
+
<input type="radio" ${a === 0 ? `id="${e}"` : ""} name="${S(i)}" ${t}
|
|
2453
|
+
value="${S(n.value)}"${n.value === r ? " checked" : ""}
|
|
2454
|
+
aria-label="${S(n.label)}">
|
|
2455
|
+
<span class="dz-seg-glyph">${Z(n.icon) || S(n.label)}</span>
|
|
2456
|
+
</label>`).join("")}
|
|
2457
|
+
</span>`;
|
|
2458
|
+
}
|
|
2459
|
+
function vr(e, t, n, r) {
|
|
2169
2460
|
let i = r == null || r === "";
|
|
2170
2461
|
return `
|
|
2171
|
-
<span class="dz-swatch${i ? " is-none" : ""}">
|
|
2462
|
+
<span class="dz-swatch dz-input${i ? " is-none" : ""}">
|
|
2172
2463
|
<span class="dz-swatch-well">
|
|
2173
2464
|
<input type="color" id="${e}" ${t} value="${S(i ? "#000000" : r)}">
|
|
2174
2465
|
</span>
|
|
2175
|
-
<
|
|
2466
|
+
<input type="text" class="dz-hex" data-hex="${S(n.key)}"
|
|
2467
|
+
value="${S(i ? "" : yr(r))}" placeholder="None"
|
|
2468
|
+
maxlength="7" spellcheck="false" autocomplete="off"
|
|
2469
|
+
aria-label="${S(n.label)}, as hex">
|
|
2176
2470
|
<button type="button" class="dz-icon dz-swatch-clear" data-action="clear-color"
|
|
2177
2471
|
data-for="${S(n.key)}"
|
|
2178
2472
|
title="No colour" aria-label="Remove ${S(n.label)} colour">×</button>
|
|
2179
2473
|
</span>`;
|
|
2180
2474
|
}
|
|
2181
|
-
function
|
|
2475
|
+
function yr(e) {
|
|
2476
|
+
let t = String(e ?? "");
|
|
2477
|
+
return t.startsWith("#") ? t.slice(1).toUpperCase() : t;
|
|
2478
|
+
}
|
|
2479
|
+
function br(e, t = !1) {
|
|
2480
|
+
let n = String(e ?? "").trim().replace(/^#/, "").toLowerCase();
|
|
2481
|
+
return /^[0-9a-f]{6}$/.test(n) ? `#${n}` : t && /^[0-9a-f]{3}$/.test(n) ? `#${[...n].map((e) => e + e).join("")}` : null;
|
|
2482
|
+
}
|
|
2483
|
+
function xr(e, t) {
|
|
2484
|
+
if (!e) return;
|
|
2485
|
+
let n = e.querySelector(".dz-column-name"), r = e.querySelector(".dz-column-width");
|
|
2486
|
+
n && (n.textContent = t.label || t.field || ""), r && (r.textContent = String(t.width ?? ""));
|
|
2487
|
+
}
|
|
2488
|
+
function Sr(e, t) {
|
|
2182
2489
|
e.closest?.(".dz-swatch")?.classList.toggle("is-none", t);
|
|
2183
2490
|
}
|
|
2184
|
-
function
|
|
2185
|
-
let n = e.
|
|
2186
|
-
|
|
2491
|
+
function Cr(e, t) {
|
|
2492
|
+
let n = e.closest?.(".dz-swatch")?.querySelector(".dz-hex");
|
|
2493
|
+
!n || n === n.ownerDocument.activeElement || (n.value = t == null || t === "" ? "" : yr(t));
|
|
2494
|
+
}
|
|
2495
|
+
var wr = /* @__PURE__ */ new WeakMap(), Tr = /* @__PURE__ */ new WeakSet();
|
|
2496
|
+
function Er(e, t) {
|
|
2497
|
+
if (wr.has(t)) return wr.get(t);
|
|
2498
|
+
let n = Tr.has(e);
|
|
2499
|
+
return wr.set(t, n), n;
|
|
2500
|
+
}
|
|
2501
|
+
function Dr(e, t) {
|
|
2502
|
+
let n = e.columns || [], r = `
|
|
2187
2503
|
<section class="dz-section dz-columns">
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2504
|
+
${$n("Columns", `
|
|
2505
|
+
<button type="button" class="dz-icon" data-action="add-column"
|
|
2506
|
+
title="Add column" aria-label="Add column">${er}</button>`)}
|
|
2507
|
+
${n.map((r, i) => `
|
|
2508
|
+
<details class="dz-column" data-index="${i}"${Er(e, r) ? " open" : ""}>
|
|
2509
|
+
<summary class="dz-column-head">
|
|
2510
|
+
<span class="dz-column-caret" aria-hidden="true"></span>
|
|
2511
|
+
<span class="dz-column-number">${i + 1}</span>
|
|
2512
|
+
<span class="dz-column-name">${S(r.label || r.field || "")}</span>
|
|
2513
|
+
<span class="dz-column-width">${S(r.width ?? "")}</span>
|
|
2193
2514
|
${n.length > 1 ? `
|
|
2194
2515
|
<button type="button" class="dz-icon"
|
|
2195
|
-
data-action="remove-column" data-index="${
|
|
2516
|
+
data-action="remove-column" data-index="${i}"
|
|
2196
2517
|
title="Remove this column"
|
|
2197
|
-
aria-label="Remove column ${
|
|
2518
|
+
aria-label="Remove column ${i + 1}">×</button>` : ""}
|
|
2519
|
+
</summary>
|
|
2520
|
+
<div class="dz-column-body">
|
|
2521
|
+
${Ie.map((e) => fr(r, e, String(i))).join("")}
|
|
2522
|
+
<div class="dz-field dz-field-format is-half">
|
|
2523
|
+
<label class="dz-label">Format</label>
|
|
2524
|
+
${ur(r, t, String(i))}
|
|
2198
2525
|
</div>
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
${Kn(e, t, String(r))}
|
|
2526
|
+
<div class="dz-field dz-field-format is-half">
|
|
2527
|
+
<label class="dz-label">Highlight</label>
|
|
2528
|
+
${dr(r.highlight, "edit-highlight", String(i))}
|
|
2203
2529
|
</div>
|
|
2204
|
-
<div class="dz-field dz-field-format">
|
|
2205
|
-
<label>Highlight</label>
|
|
2206
|
-
${qn(e.highlight, "edit-highlight", String(r))}
|
|
2207
2530
|
</div>
|
|
2208
|
-
</
|
|
2209
|
-
<button type="button" class="dz-add-row" data-action="add-column">
|
|
2210
|
-
Add column</button>
|
|
2531
|
+
</details>`).join("")}
|
|
2211
2532
|
</section>`;
|
|
2533
|
+
return Tr.add(e), r;
|
|
2212
2534
|
}
|
|
2213
|
-
function
|
|
2535
|
+
function Or(e) {
|
|
2214
2536
|
return `
|
|
2215
2537
|
<section class="dz-section dz-bands">
|
|
2216
|
-
|
|
2217
|
-
${
|
|
2538
|
+
${$n("Bands")}
|
|
2539
|
+
${on(e).map((t) => Ar(e, t)).join("")}
|
|
2218
2540
|
</section>`;
|
|
2219
2541
|
}
|
|
2220
|
-
function
|
|
2221
|
-
let t =
|
|
2222
|
-
if (!t) return
|
|
2542
|
+
function kr(e) {
|
|
2543
|
+
let t = M(e);
|
|
2544
|
+
if (!t) return Qt[e] ?? "";
|
|
2223
2545
|
let n = t.level > 0 ? `level ${t.level + 1} group of ${t.table}` : `group of ${t.table}`;
|
|
2224
2546
|
return t.kind === "groupHeader" ? `Before each ${n}` : `After each ${n}`;
|
|
2225
2547
|
}
|
|
2226
|
-
function
|
|
2227
|
-
let r = Y(e, t), i =
|
|
2548
|
+
function Ar(e, t, n = {}) {
|
|
2549
|
+
let r = Y(e, t), i = sn(e, t), a = n.label ?? F(t), o = n.note ?? kr(t), s = i && M(t) != null;
|
|
2228
2550
|
return `
|
|
2229
2551
|
<div class="dz-band-row${i ? " is-on" : ""}${s ? " has-fill" : ""}">
|
|
2230
2552
|
<label class="dz-band-name">
|
|
2231
2553
|
<input type="checkbox" data-band="${S(t)}" ${i ? "checked" : ""}>
|
|
2232
2554
|
<span>${S(a)}</span>
|
|
2233
2555
|
</label>
|
|
2234
|
-
${s ?
|
|
2556
|
+
${s ? mr(t, r, a) : ""}
|
|
2235
2557
|
${i && t !== "detail" ? `<input type="text" class="dz-band-height"
|
|
2236
2558
|
data-band-height="${S(t)}"
|
|
2237
2559
|
value="${S(r.height ?? "")}"
|
|
@@ -2240,22 +2562,34 @@ function ir(e, t, n = {}) {
|
|
|
2240
2562
|
${o ? `<p class="dz-hint">${S(o)}</p>` : ""}
|
|
2241
2563
|
</div>`;
|
|
2242
2564
|
}
|
|
2243
|
-
function
|
|
2565
|
+
function jr({ panel: e, getTarget: t, getItem: n, changed: r, act: i, toggleBand: a, setBandHeight: o, setBandFill: s = () => {} }) {
|
|
2244
2566
|
function c(e) {
|
|
2245
2567
|
let t = (e.closest?.(".dz-value"))?.querySelector("[data-role=\"marks\"]");
|
|
2246
|
-
t && (t.innerHTML =
|
|
2568
|
+
t && (t.innerHTML = Nr(e.value));
|
|
2247
2569
|
}
|
|
2248
|
-
function l(e) {
|
|
2570
|
+
function l(e, t) {
|
|
2571
|
+
let n = br(e.value, t);
|
|
2572
|
+
if (!n) return;
|
|
2573
|
+
let r = e.closest(".dz-swatch")?.querySelector("input[type=\"color\"]");
|
|
2574
|
+
if (!r) return;
|
|
2575
|
+
let i = e.closest(".dz-swatch").classList.contains("is-none");
|
|
2576
|
+
r.value === n && !i || (r.value = n, r.dispatchEvent(new Event("input", { bubbles: !0 })));
|
|
2577
|
+
}
|
|
2578
|
+
function u(e) {
|
|
2579
|
+
if (e.target.dataset?.hex != null) {
|
|
2580
|
+
l(e.target, e.type === "change");
|
|
2581
|
+
return;
|
|
2582
|
+
}
|
|
2249
2583
|
let i = e.target.closest?.("[data-field], [data-band], [data-band-height], [data-band-fill], [data-group-level], [data-group-option]");
|
|
2250
2584
|
if (!i) return;
|
|
2251
|
-
if (i.tagName === "TEXTAREA" && c(i), i.dataset.groupOption != null) {
|
|
2585
|
+
if (i.tagName === "TEXTAREA" && c(i), i.tagName === "SELECT" && Yn(i), i.dataset.groupOption != null) {
|
|
2252
2586
|
let e = n(), t = Number(i.dataset.level), a = i.dataset.groupOption, o = i.type === "checkbox" ? i.checked : i.value;
|
|
2253
|
-
e?.type === "table" &&
|
|
2587
|
+
e?.type === "table" && z(e, t, a, o) && r(`group-option:${t}:${a}`);
|
|
2254
2588
|
return;
|
|
2255
2589
|
}
|
|
2256
2590
|
if (i.dataset.groupLevel != null) {
|
|
2257
2591
|
let e = n(), t = Number(i.dataset.groupLevel);
|
|
2258
|
-
e?.type === "table" &&
|
|
2592
|
+
e?.type === "table" && ye(e, i.value.trim(), t) && r(`group-level:${t}`);
|
|
2259
2593
|
return;
|
|
2260
2594
|
}
|
|
2261
2595
|
if (i.dataset.band != null) {
|
|
@@ -2267,127 +2601,149 @@ function ar({ panel: e, getTarget: t, getItem: n, changed: r, act: i, toggleBand
|
|
|
2267
2601
|
return;
|
|
2268
2602
|
}
|
|
2269
2603
|
if (i.dataset.bandFill != null) {
|
|
2270
|
-
|
|
2604
|
+
Sr(i, !1), s(i.dataset.bandFill, i.value);
|
|
2271
2605
|
return;
|
|
2272
2606
|
}
|
|
2273
2607
|
if (i.dataset.column != null) {
|
|
2274
2608
|
let e = n()?.columns?.[Number(i.dataset.column)];
|
|
2275
2609
|
if (!e) return;
|
|
2276
|
-
let t =
|
|
2277
|
-
t &&
|
|
2610
|
+
let t = Ie.find((e) => e.key === i.dataset.field);
|
|
2611
|
+
t && it(e, t, i.value) && (xr(i.closest(".dz-column"), e), r(`column:${i.dataset.column}:${t.key}`));
|
|
2278
2612
|
return;
|
|
2279
2613
|
}
|
|
2280
|
-
let
|
|
2281
|
-
if (!l) return;
|
|
2282
|
-
let u = l.fields.find((e) => e.key === i.dataset.field);
|
|
2614
|
+
let u = t();
|
|
2283
2615
|
if (!u) return;
|
|
2284
|
-
|
|
2285
|
-
|
|
2616
|
+
let d = u.fields.find((e) => e.key === i.dataset.field);
|
|
2617
|
+
if (!d) return;
|
|
2618
|
+
if (i.tagName === "SELECT" && i.value === hr) {
|
|
2619
|
+
let e = i.closest(".dz-choice-custom")?.querySelector("[data-custom]");
|
|
2286
2620
|
e && (e.hidden = !1, e.focus());
|
|
2287
2621
|
return;
|
|
2288
2622
|
}
|
|
2289
|
-
let
|
|
2290
|
-
|
|
2291
|
-
let
|
|
2292
|
-
if (
|
|
2293
|
-
let e =
|
|
2294
|
-
r(`field:${
|
|
2623
|
+
let f = d.type === "toggle" ? i.checked : i.value;
|
|
2624
|
+
d.type === "color" && (Sr(i, !1), Cr(i, i.value));
|
|
2625
|
+
let p = typeof d.rebuilds == "function" ? d.rebuilds : null, m = p ? p(u.target) : null;
|
|
2626
|
+
if (it(u.target, d, f)) {
|
|
2627
|
+
let e = p ? p(u.target) !== m : !!d.rebuilds;
|
|
2628
|
+
r(`field:${d.key}`, { rebuild: e });
|
|
2295
2629
|
}
|
|
2296
2630
|
}
|
|
2297
|
-
function
|
|
2631
|
+
function d(e) {
|
|
2298
2632
|
let n = e.target.closest?.("[data-action]");
|
|
2299
2633
|
if (n) {
|
|
2300
2634
|
if (e.preventDefault(), n.dataset.action === "insert-brace") {
|
|
2301
2635
|
let e = n.closest(".dz-field")?.querySelector("textarea");
|
|
2302
|
-
e &&
|
|
2636
|
+
e && Pr(e);
|
|
2303
2637
|
return;
|
|
2304
2638
|
}
|
|
2305
2639
|
if (n.dataset.action === "clear-band-fill") {
|
|
2306
|
-
|
|
2640
|
+
Sr(n, !0), s(n.dataset.fillFor, null);
|
|
2307
2641
|
return;
|
|
2308
2642
|
}
|
|
2309
2643
|
if (n.dataset.action === "clear-color") {
|
|
2310
2644
|
let e = t(), i = e?.fields.find((e) => e.key === n.dataset.for);
|
|
2311
|
-
i &&
|
|
2645
|
+
i && rt(e.target, i) && (Sr(n, !0), Cr(n, null), r(`field:${i.key}`));
|
|
2312
2646
|
return;
|
|
2313
2647
|
}
|
|
2314
2648
|
i(n.dataset.action, n.dataset);
|
|
2315
2649
|
}
|
|
2316
2650
|
}
|
|
2317
|
-
function
|
|
2651
|
+
function f(e) {
|
|
2652
|
+
let t = e.target;
|
|
2653
|
+
if (!t.classList?.contains("dz-column")) return;
|
|
2654
|
+
let r = n()?.columns?.[Number(t.dataset.index)];
|
|
2655
|
+
r && wr.set(r, t.open);
|
|
2656
|
+
}
|
|
2657
|
+
function p(e) {
|
|
2658
|
+
let t = e.target;
|
|
2659
|
+
if (t.dataset?.hex == null) return;
|
|
2660
|
+
let n = t.closest(".dz-swatch"), r = n?.querySelector("input[type=\"color\"]");
|
|
2661
|
+
r && (t.value = n.classList.contains("is-none") ? "" : yr(r.value));
|
|
2662
|
+
}
|
|
2663
|
+
function m(e) {
|
|
2664
|
+
e.key !== "Enter" || e.target.dataset?.hex == null || (e.preventDefault(), l(e.target, !0), e.target.blur());
|
|
2665
|
+
}
|
|
2666
|
+
function h(t) {
|
|
2667
|
+
let n = t.target.closest?.(".dz-scrub");
|
|
2668
|
+
if (!n || t.button !== 0) return;
|
|
2669
|
+
let r = n.closest(".dz-field")?.querySelector("input[type=\"number\"]");
|
|
2670
|
+
if (!r || r.disabled) return;
|
|
2671
|
+
t.preventDefault();
|
|
2672
|
+
let i = t.clientX, a = Number(r.value) || 0, o = r.min === "" ? -Infinity : Number(r.min), s = r.max === "" ? Infinity : Number(r.max), c = !1;
|
|
2673
|
+
n.setPointerCapture?.(t.pointerId);
|
|
2674
|
+
function l(t) {
|
|
2675
|
+
let n = t.clientX - i;
|
|
2676
|
+
if (!c && Math.abs(n) < 3) return;
|
|
2677
|
+
c || (c = !0, e.classList.add("is-scrubbing"));
|
|
2678
|
+
let l = t.shiftKey ? 10 : 1, u = Math.min(s, Math.max(o, a + Math.round(n / 2) * l));
|
|
2679
|
+
String(u) !== r.value && (r.value = String(u), r.dispatchEvent(new Event("input", { bubbles: !0 })));
|
|
2680
|
+
}
|
|
2681
|
+
function u() {
|
|
2682
|
+
if (n.removeEventListener("pointermove", l), n.removeEventListener("pointerup", u), n.removeEventListener("pointercancel", u), e.classList.remove("is-scrubbing"), !c) {
|
|
2683
|
+
r.focus(), r.select?.();
|
|
2684
|
+
return;
|
|
2685
|
+
}
|
|
2686
|
+
n.addEventListener("click", (e) => e.preventDefault(), {
|
|
2687
|
+
once: !0,
|
|
2688
|
+
capture: !0
|
|
2689
|
+
});
|
|
2690
|
+
}
|
|
2691
|
+
n.addEventListener("pointermove", l), n.addEventListener("pointerup", u), n.addEventListener("pointercancel", u);
|
|
2692
|
+
}
|
|
2693
|
+
function g(e) {
|
|
2318
2694
|
let t = e.target;
|
|
2319
2695
|
if (t.tagName !== "TEXTAREA") return;
|
|
2320
2696
|
let n = t.closest(".dz-value")?.querySelector("[data-role=\"marks\"]");
|
|
2321
2697
|
n && (n.scrollTop = t.scrollTop);
|
|
2322
2698
|
}
|
|
2323
|
-
|
|
2324
|
-
|
|
2699
|
+
e.addEventListener("scroll", g, !0), e.addEventListener("input", u), e.addEventListener("change", u), e.addEventListener("click", d), e.addEventListener("focusout", p), e.addEventListener("keydown", m), e.addEventListener("pointerdown", h), e.addEventListener("toggle", f, !0);
|
|
2700
|
+
let ee = Zn(e);
|
|
2701
|
+
return function() {
|
|
2702
|
+
ee(), e.removeEventListener("toggle", f, !0), e.removeEventListener("scroll", g, !0), e.removeEventListener("input", u), e.removeEventListener("change", u), e.removeEventListener("click", d), e.removeEventListener("focusout", p), e.removeEventListener("keydown", m), e.removeEventListener("pointerdown", h);
|
|
2325
2703
|
};
|
|
2326
2704
|
}
|
|
2327
|
-
function
|
|
2705
|
+
function Mr(e, t, n) {
|
|
2328
2706
|
let r = t ?? n;
|
|
2329
2707
|
if (!r) return;
|
|
2330
|
-
let
|
|
2708
|
+
for (let n of e.querySelectorAll(".dz-column")) {
|
|
2709
|
+
let e = t?.columns?.[Number(n.dataset.index)];
|
|
2710
|
+
e && xr(n, e);
|
|
2711
|
+
}
|
|
2712
|
+
let i = t ? $e(t) : Qe(n);
|
|
2331
2713
|
for (let n of e.querySelectorAll("[data-field]")) {
|
|
2332
2714
|
if (n === n.ownerDocument.activeElement) continue;
|
|
2333
2715
|
let e = n.dataset.column != null, a = e ? t?.columns?.[Number(n.dataset.column)] : r;
|
|
2334
2716
|
if (!a) continue;
|
|
2335
|
-
let o = (e ?
|
|
2717
|
+
let o = (e ? Ie : i).find((e) => e.key === n.dataset.field);
|
|
2336
2718
|
if (!o) continue;
|
|
2337
|
-
let s =
|
|
2338
|
-
if (o.type === "color" &&
|
|
2719
|
+
let s = nt(a, o);
|
|
2720
|
+
if (o.type === "color" && (Sr(n, s == null || s === ""), Cr(n, s)), n.type === "radio") {
|
|
2721
|
+
n.checked = n.value === String(s ?? "");
|
|
2722
|
+
continue;
|
|
2723
|
+
}
|
|
2724
|
+
if (o.custom) {
|
|
2339
2725
|
let e = o.options.some((e) => e.value === (s ?? ""));
|
|
2340
|
-
n.dataset.custom ? (n.value = e ? "" : String(s ?? ""), n.hidden = e) : n.value = e ? String(s ?? "") :
|
|
2726
|
+
n.dataset.custom ? (n.value = e ? "" : String(s ?? ""), n.hidden = e) : n.value = e ? String(s ?? "") : hr;
|
|
2341
2727
|
continue;
|
|
2342
2728
|
}
|
|
2343
2729
|
if (o.type === "toggle") n.checked = !!s;
|
|
2344
2730
|
else if (s != null && (n.value = String(s), n.tagName === "TEXTAREA")) {
|
|
2345
2731
|
let e = n.closest(".dz-value")?.querySelector("[data-role=\"marks\"]");
|
|
2346
|
-
e && (e.innerHTML =
|
|
2732
|
+
e && (e.innerHTML = Nr(n.value));
|
|
2347
2733
|
}
|
|
2348
2734
|
}
|
|
2735
|
+
Xn(e);
|
|
2349
2736
|
}
|
|
2350
|
-
function
|
|
2737
|
+
function Nr(e) {
|
|
2351
2738
|
return `${S(String(e ?? "")).replace(/\{[^{}]*\}/g, (e) => `<mark class="dz-mark">${e}</mark>`)}\n`;
|
|
2352
2739
|
}
|
|
2353
|
-
function
|
|
2740
|
+
function Pr(e) {
|
|
2354
2741
|
let t = e.selectionStart ?? e.value.length, n = e.selectionEnd ?? t, r = e.value.slice(t, n);
|
|
2355
2742
|
e.value = `${e.value.slice(0, t)}{${r}}${e.value.slice(n)}`;
|
|
2356
2743
|
let i = t + 1 + r.length;
|
|
2357
2744
|
e.focus(), e.setSelectionRange(i, i), e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
2358
2745
|
}
|
|
2359
|
-
|
|
2360
|
-
//#region src/designer/icons.js
|
|
2361
|
-
var X = (e) => `<svg viewBox="0 0 16 16" width="16" height="16"
|
|
2362
|
-
fill="none" stroke="currentColor" stroke-width="1.5"
|
|
2363
|
-
stroke-linecap="round" stroke-linejoin="round"
|
|
2364
|
-
aria-hidden="true" focusable="false">${e}</svg>`, lr = {
|
|
2365
|
-
text: X("<path d=\"M3 3.75h10M8 3.75v8.5M6.25 12.25h3.5\"/>"),
|
|
2366
|
-
table: X("<rect x=\"2.25\" y=\"3.25\" width=\"11.5\" height=\"9.5\" rx=\"1.25\"/>\n <path d=\"M2.25 6.5h11.5M6.5 6.5v6.25M10 6.5v6.25\"/>"),
|
|
2367
|
-
image: X("<rect x=\"2.25\" y=\"3.25\" width=\"11.5\" height=\"9.5\" rx=\"1.25\"/>\n <path d=\"m2.75 11.5 3.5-3.5 2.5 2.5 1.5-1.5 3 3\"/>\n <circle cx=\"10.25\" cy=\"6.25\" r=\"1\"/>"),
|
|
2368
|
-
box: X("<rect x=\"2.5\" y=\"3.75\" width=\"11\" height=\"8.5\" rx=\"1.25\"/>"),
|
|
2369
|
-
line: X("<path d=\"M2 8h3.5M7.25 8h1.5M10.5 8H14\"/>"),
|
|
2370
|
-
ruler: X("<rect x=\"1.75\" y=\"5.25\" width=\"12.5\" height=\"5.5\" rx=\"1\"/>\n <path d=\"M4.5 5.25v2M7 5.25v3M9.5 5.25v2M12 5.25v3\"/>"),
|
|
2371
|
-
undo: X("<path d=\"M6 4.5 2.75 7.75 6 11\"/>\n <path d=\"M2.75 7.75h6.75a3.75 3.75 0 0 1 0 7.5H7\"/>"),
|
|
2372
|
-
redo: X("<path d=\"M10 4.5l3.25 3.25L10 11\"/>\n <path d=\"M13.25 7.75H6.5a3.75 3.75 0 0 0 0 7.5H9\"/>"),
|
|
2373
|
-
open: X("<path d=\"M1.75 12.5V4a.75.75 0 0 1 .75-.75h3.4l1.5 1.75h5.35\n a.75.75 0 0 1 .75.75v1.5\"/>\n <path d=\"M1.75 12.5 3.6 7.5h11.15l-1.85 5z\"/>"),
|
|
2374
|
-
field: X("<path d=\"M6.25 2.75c-1.5 0-2 .8-2 2v1.4c0 .9-.55 1.5-1.5 1.85\n .95.35 1.5.95 1.5 1.85v1.4c0 1.2.5 2 2 2\"/>\n <path d=\"M9.75 2.75c1.5 0 2 .8 2 2v1.4c0 .9.55 1.5 1.5 1.85\n -.95.35-1.5.95-1.5 1.85v1.4c0 1.2-.5 2-2 2\"/>"),
|
|
2375
|
-
external: X("<path d=\"M9.5 2.75h3.75V6.5\"/>\n <path d=\"M13.25 2.75 7.5 8.5\"/>\n <path d=\"M11.5 9.25v3a1 1 0 0 1-1 1h-7a1 1 0 0 1-1-1v-7\n a1 1 0 0 1 1-1h3\"/>"),
|
|
2376
|
-
preview: X("<path d=\"M1 8s2.6-4.25 7-4.25S15 8 15 8s-2.6 4.25-7 4.25S1 8 1 8z\"/>\n <circle cx=\"8\" cy=\"8\" r=\"1.9\"/>"),
|
|
2377
|
-
design: X("<path d=\"M11.4 2.85 13.15 4.6 5.3 12.45l-2.4.65.65-2.4z\"/>\n <path d=\"M10.15 4.1l1.75 1.75\"/>"),
|
|
2378
|
-
data: X("<ellipse cx=\"8\" cy=\"4\" rx=\"5.25\" ry=\"2\"/>\n <path d=\"M2.75 4v8c0 1.1 2.35 2 5.25 2s5.25-.9 5.25-2V4\"/>\n <path d=\"M2.75 8c0 1.1 2.35 2 5.25 2s5.25-.9 5.25-2\"/>"),
|
|
2379
|
-
duplicate: X("<rect x=\"2.5\" y=\"2.5\" width=\"8\" height=\"8\" rx=\"1.25\"/>\n <rect x=\"5.5\" y=\"5.5\" width=\"8\" height=\"8\" rx=\"1.25\"/>"),
|
|
2380
|
-
copy: X("<path d=\"M6 2.25h3.6L12.25 4.9v5.85a.75.75 0 0 1-.75.75H6\n a.75.75 0 0 1-.75-.75V3a.75.75 0 0 1 .75-.75z\"/>\n <path d=\"M9.35 2.4v2.65h2.75\"/>\n <path d=\"M3.9 5.5H3a.75.75 0 0 0-.75.75V13a.75.75 0 0 0 .75.75h5.4\n a.75.75 0 0 0 .75-.75v-.75\"/>"),
|
|
2381
|
-
delete: X("<path d=\"M2.75 4.5h10.5\"/>\n <path d=\"M6.25 4.5V3.25a.75.75 0 0 1 .75-.75h2a.75.75 0 0 1 .75.75V4.5\"/>\n <path d=\"M4.4 4.5l.55 8.15a.85.85 0 0 0 .85.8h4.4a.85.85 0 0 0 .85-.8L11.6 4.5\"/>\n <path d=\"M6.85 7v3.75M9.15 7v3.75\"/>"),
|
|
2382
|
-
paste: X("<path d=\"M6.25 3.25H4.5a.75.75 0 0 0-.75.75v8.75\n a.75.75 0 0 0 .75.75h7a.75.75 0 0 0 .75-.75V4\n a.75.75 0 0 0-.75-.75H9.75\"/>\n <rect x=\"6.25\" y=\"1.75\" width=\"3.5\" height=\"2.75\" rx=\".85\"/>"),
|
|
2383
|
-
format: X("<path d=\"M12.25 3.75 3.75 12.25\"/>\n <circle cx=\"4.75\" cy=\"4.75\" r=\"1.75\"/>\n <circle cx=\"11.25\" cy=\"11.25\" r=\"1.75\"/>"),
|
|
2384
|
-
highlight: X("<path d=\"M9.75 2.75 13.25 6.25 8 11.5H4.5V8z\"/>\n <path d=\"M2.25 13.75h11.5\"/>"),
|
|
2385
|
-
save: X("<path d=\"M2.75 3.25h8.5l2.5 2.5v7a.5.5 0 0 1-.5.5h-11\n a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5z\"/>\n <path d=\"M5 3.25v3.5h5.5v-3.5M5 13.25V9.5h6v3.75\"/>")
|
|
2386
|
-
};
|
|
2387
|
-
function Z(e) {
|
|
2388
|
-
return lr[e] ?? "";
|
|
2389
|
-
}
|
|
2390
|
-
function ur({ count: e = 0, canPaste: t = !1, canDuplicate: n = !0, format: r = null, highlight: i = null, rows: a = !1 } = {}) {
|
|
2746
|
+
function Fr({ count: e = 0, canPaste: t = !1, canDuplicate: n = !0, format: r = null, highlight: i = null, rows: a = !1 } = {}) {
|
|
2391
2747
|
let o = e > 1 ? ` ${e} items` : "", s = {
|
|
2392
2748
|
action: "paste-items",
|
|
2393
2749
|
glyph: "paste",
|
|
@@ -2448,7 +2804,7 @@ function ur({ count: e = 0, canPaste: t = !1, canDuplicate: n = !0, format: r =
|
|
|
2448
2804
|
}
|
|
2449
2805
|
];
|
|
2450
2806
|
}
|
|
2451
|
-
function
|
|
2807
|
+
function Ir(e) {
|
|
2452
2808
|
return `<div class="dz-menu" data-role="menu" role="menu"
|
|
2453
2809
|
aria-label="Item actions">${e.map((e) => e.separator ? "<span class=\"dz-menu-sep\" aria-hidden=\"true\"></span>" : `<button type="button" role="menuitem"
|
|
2454
2810
|
class="dz-menu-item${e.tone ? ` is-${S(e.tone)}` : ""}"
|
|
@@ -2463,7 +2819,7 @@ function dr(e) {
|
|
|
2463
2819
|
e.keys ? `<kbd class="dz-menu-keys">${S(e.keys)}</kbd>` : ""
|
|
2464
2820
|
].join("")}</button>`).join("")}</div>`;
|
|
2465
2821
|
}
|
|
2466
|
-
function
|
|
2822
|
+
function Lr(e, t, n, r = 8) {
|
|
2467
2823
|
let i = (e, t, n) => Math.min(Math.max(r, e), Math.max(r, n - t - r));
|
|
2468
2824
|
return {
|
|
2469
2825
|
left: i(e.x, t.width, n.width),
|
|
@@ -2472,10 +2828,10 @@ function fr(e, t, n, r = 8) {
|
|
|
2472
2828
|
}
|
|
2473
2829
|
//#endregion
|
|
2474
2830
|
//#region src/designer/toast.js
|
|
2475
|
-
function
|
|
2831
|
+
function Rr(e, t) {
|
|
2476
2832
|
return !Array.isArray(e) || !Array.isArray(t) || e.length !== t.length ? !1 : e.every((e, n) => e === t[n]);
|
|
2477
2833
|
}
|
|
2478
|
-
function
|
|
2834
|
+
function zr(e) {
|
|
2479
2835
|
let t = e.length > 1;
|
|
2480
2836
|
return `
|
|
2481
2837
|
<div class="dz-toast dz-problems" role="alert" data-role="problems">
|
|
@@ -2492,22 +2848,22 @@ function mr(e) {
|
|
|
2492
2848
|
}
|
|
2493
2849
|
//#endregion
|
|
2494
2850
|
//#region src/shared/prefix.js
|
|
2495
|
-
var
|
|
2851
|
+
var Br = "/__reports";
|
|
2496
2852
|
//#endregion
|
|
2497
2853
|
//#region src/shared/store.js
|
|
2498
|
-
function
|
|
2854
|
+
function Vr({ prefix: e = Br, fetch: t = (...e) => globalThis.fetch(...e) } = {}) {
|
|
2499
2855
|
async function n(n, r) {
|
|
2500
2856
|
let i;
|
|
2501
2857
|
try {
|
|
2502
2858
|
i = await t(`${e}${n}`, r);
|
|
2503
2859
|
} catch (e) {
|
|
2504
|
-
throw new
|
|
2860
|
+
throw new Hr("Cannot reach the report server. Start it with `npx report-studio design`.", {
|
|
2505
2861
|
cause: e,
|
|
2506
2862
|
offline: !0
|
|
2507
2863
|
});
|
|
2508
2864
|
}
|
|
2509
2865
|
let a = await i.json().catch(() => null);
|
|
2510
|
-
if (!i.ok) throw new
|
|
2866
|
+
if (!i.ok) throw new Hr(a?.error ?? `the server answered ${i.status}`, { status: i.status });
|
|
2511
2867
|
return a;
|
|
2512
2868
|
}
|
|
2513
2869
|
return {
|
|
@@ -2545,34 +2901,34 @@ function gr({ prefix: e = hr, fetch: t = (...e) => globalThis.fetch(...e) } = {}
|
|
|
2545
2901
|
}
|
|
2546
2902
|
};
|
|
2547
2903
|
}
|
|
2548
|
-
var
|
|
2904
|
+
var Hr = class extends Error {
|
|
2549
2905
|
constructor(e, { cause: t, status: n = null, offline: r = !1 } = {}) {
|
|
2550
2906
|
super(e, { cause: t }), this.name = "StoreError", this.status = n, this.offline = r;
|
|
2551
2907
|
}
|
|
2552
2908
|
};
|
|
2553
|
-
function
|
|
2909
|
+
function Ur(e) {
|
|
2554
2910
|
let t = String(e ?? "").trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 64).replace(/-+$/, "");
|
|
2555
2911
|
return /^[a-z0-9]/.test(t) ? t : "";
|
|
2556
2912
|
}
|
|
2557
2913
|
//#endregion
|
|
2558
2914
|
//#region src/designer/sample-data.js
|
|
2559
|
-
var
|
|
2560
|
-
function
|
|
2561
|
-
return
|
|
2915
|
+
var Wr = 6, Gr = ["North", "South"], Kr = /(amount|amt|price|qty|quantity|total|subtotal|cost|rate|balance|discount|tax)$/i, qr = /\b(count|sum|avg|min|max)\(([^()]*)\)/g, Jr = /(date|day|when)$/i, Yr = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAABCAAAAADRSSBWAAAAC0lEQVR4nGO4eRcAApIBt+wBgUAAAAAASUVORK5CYII=";
|
|
2916
|
+
function Xr(e) {
|
|
2917
|
+
return $r(Zr(e));
|
|
2562
2918
|
}
|
|
2563
|
-
function
|
|
2919
|
+
function Zr(t) {
|
|
2564
2920
|
return [...(Array.isArray(t?.bands) ? t.bands : []).map((t) => ({
|
|
2565
2921
|
band: t,
|
|
2566
2922
|
rowScoped: e(t?.type)
|
|
2567
|
-
})), ...
|
|
2923
|
+
})), ...Qr(E(t)).map((e) => ({
|
|
2568
2924
|
band: e,
|
|
2569
2925
|
rowScoped: !0
|
|
2570
2926
|
}))];
|
|
2571
2927
|
}
|
|
2572
|
-
function
|
|
2928
|
+
function Qr(e) {
|
|
2573
2929
|
return e.flatMap((e) => b(e)).flatMap((e) => [e?.header, e?.footer]).filter((e) => e && typeof e == "object" && Array.isArray(e.items));
|
|
2574
2930
|
}
|
|
2575
|
-
function
|
|
2931
|
+
function $r(e) {
|
|
2576
2932
|
let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
2577
2933
|
for (let { band: r, rowScoped: i } of e) for (let e of r?.items || []) if (!(e.type !== "text" || typeof e.value != "string")) for (let [, r] of e.value.matchAll(c)) {
|
|
2578
2934
|
let e = r.trim();
|
|
@@ -2583,16 +2939,16 @@ function Or(e) {
|
|
|
2583
2939
|
row: [...n]
|
|
2584
2940
|
};
|
|
2585
2941
|
}
|
|
2586
|
-
function
|
|
2942
|
+
function ei(e) {
|
|
2587
2943
|
let t = /* @__PURE__ */ new Set();
|
|
2588
|
-
for (let { band: n } of
|
|
2944
|
+
for (let { band: n } of Zr(e)) for (let e of n.items || []) {
|
|
2589
2945
|
if (e.type !== "image" || typeof e.field != "string") continue;
|
|
2590
2946
|
let n = e.field.trim();
|
|
2591
2947
|
n && t.add(n);
|
|
2592
2948
|
}
|
|
2593
2949
|
return [...t];
|
|
2594
2950
|
}
|
|
2595
|
-
function
|
|
2951
|
+
function ti(e) {
|
|
2596
2952
|
let n = /* @__PURE__ */ new Map(), r = e?.dataset || "rows", i = (e) => (n.has(e) || n.set(e, /* @__PURE__ */ new Set()), n.get(e));
|
|
2597
2953
|
for (let n of Array.isArray(e?.bands) ? e.bands : []) for (let e of n.items || []) {
|
|
2598
2954
|
if (e.type !== "table") continue;
|
|
@@ -2605,30 +2961,30 @@ function Ar(e) {
|
|
|
2605
2961
|
let n = i(_(t.table, e) || r), a = t.levels.flatMap((e) => [e.header, e.footer]).filter((e) => e && typeof e == "object");
|
|
2606
2962
|
for (let e of t.levels) e.by && n.add(e.by);
|
|
2607
2963
|
for (let e of a) o.add(e);
|
|
2608
|
-
for (let e of
|
|
2964
|
+
for (let e of $r(a.map((e) => ({
|
|
2609
2965
|
band: e,
|
|
2610
2966
|
rowScoped: !0
|
|
2611
2967
|
}))).row) n.add(e);
|
|
2612
2968
|
}
|
|
2613
|
-
let s =
|
|
2969
|
+
let s = $r(Zr(e).filter(({ band: e }) => !o.has(e))).row, c = a.length ? null : e?.groupBy ?? null;
|
|
2614
2970
|
if (s.length || c) {
|
|
2615
2971
|
let e = i(r);
|
|
2616
2972
|
for (let t of s) e.add(t);
|
|
2617
2973
|
c && e.add(c);
|
|
2618
2974
|
}
|
|
2619
|
-
for (let t of
|
|
2975
|
+
for (let t of ci(e)) i(t.dataset).add(t.field);
|
|
2620
2976
|
return n;
|
|
2621
2977
|
}
|
|
2622
|
-
function
|
|
2623
|
-
let t = {}, { root: n } =
|
|
2624
|
-
for (let n of
|
|
2625
|
-
for (let e of n)
|
|
2626
|
-
let i =
|
|
2627
|
-
for (let [n, a] of
|
|
2978
|
+
function ni(e) {
|
|
2979
|
+
let t = {}, { root: n } = Xr(e), r = oi(e);
|
|
2980
|
+
for (let n of ei(e)) li(t, n, Yr);
|
|
2981
|
+
for (let e of n) li(t, e);
|
|
2982
|
+
let i = si(e);
|
|
2983
|
+
for (let [n, a] of ti(e)) t[n] = ui([...a], i.get(n) ?? [], r);
|
|
2628
2984
|
return t;
|
|
2629
2985
|
}
|
|
2630
|
-
function
|
|
2631
|
-
let n =
|
|
2986
|
+
function ri(e, t) {
|
|
2987
|
+
let n = ni(t);
|
|
2632
2988
|
if (typeof e != "object" || !e || Array.isArray(e)) return {
|
|
2633
2989
|
data: n,
|
|
2634
2990
|
added: !0
|
|
@@ -2636,10 +2992,10 @@ function Mr(e, t) {
|
|
|
2636
2992
|
let r = structuredClone(e);
|
|
2637
2993
|
return {
|
|
2638
2994
|
data: r,
|
|
2639
|
-
added:
|
|
2995
|
+
added: ii(r, n)
|
|
2640
2996
|
};
|
|
2641
2997
|
}
|
|
2642
|
-
function
|
|
2998
|
+
function ii(e, t) {
|
|
2643
2999
|
let n = !1;
|
|
2644
3000
|
for (let [r, i] of Object.entries(t)) {
|
|
2645
3001
|
let t = e[r];
|
|
@@ -2647,22 +3003,22 @@ function Nr(e, t) {
|
|
|
2647
3003
|
e[r] = structuredClone(i), n = !0;
|
|
2648
3004
|
continue;
|
|
2649
3005
|
}
|
|
2650
|
-
|
|
3006
|
+
ai(t) && ai(i) && ii(t, i) && (n = !0);
|
|
2651
3007
|
}
|
|
2652
3008
|
return n;
|
|
2653
3009
|
}
|
|
2654
|
-
function
|
|
3010
|
+
function ai(e) {
|
|
2655
3011
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
2656
3012
|
}
|
|
2657
|
-
function
|
|
3013
|
+
function oi(e) {
|
|
2658
3014
|
let t = /* @__PURE__ */ new Set();
|
|
2659
|
-
for (let { band: n } of
|
|
3015
|
+
for (let { band: n } of Zr(e)) for (let e of n.items || []) if (e.type === "text") for (let [, , n] of String(e.value ?? "").matchAll(qr)) {
|
|
2660
3016
|
let e = n.trim();
|
|
2661
3017
|
e && (t.add(e), e.includes(".") && t.add(e.slice(e.indexOf(".") + 1)));
|
|
2662
3018
|
}
|
|
2663
3019
|
return t;
|
|
2664
3020
|
}
|
|
2665
|
-
function
|
|
3021
|
+
function si(e) {
|
|
2666
3022
|
let t = /* @__PURE__ */ new Map();
|
|
2667
3023
|
for (let n of T(e)) {
|
|
2668
3024
|
let r = _(n.table, e) || e?.dataset || "rows";
|
|
@@ -2670,9 +3026,9 @@ function Ir(e) {
|
|
|
2670
3026
|
}
|
|
2671
3027
|
return t;
|
|
2672
3028
|
}
|
|
2673
|
-
function
|
|
3029
|
+
function ci(e) {
|
|
2674
3030
|
let t = [];
|
|
2675
|
-
for (let { band: n } of
|
|
3031
|
+
for (let { band: n } of Zr(e)) for (let e of n.items || []) if (e.type === "text") for (let [, , n] of String(e.value ?? "").matchAll(qr)) {
|
|
2676
3032
|
let [e, ...r] = n.trim().split("."), i = r.join(".");
|
|
2677
3033
|
e && i && t.push({
|
|
2678
3034
|
dataset: e,
|
|
@@ -2681,33 +3037,33 @@ function Lr(e) {
|
|
|
2681
3037
|
}
|
|
2682
3038
|
return t;
|
|
2683
3039
|
}
|
|
2684
|
-
function
|
|
3040
|
+
function li(e, t, n) {
|
|
2685
3041
|
let r = t.split(".").filter(Boolean);
|
|
2686
3042
|
if (!r.length) return;
|
|
2687
3043
|
let i = r.pop(), a = e;
|
|
2688
3044
|
for (let e of r) (a[e] == null || typeof a[e] != "object") && (a[e] = {}), a = a[e];
|
|
2689
|
-
a[i] === void 0 && (a[i] = n ??
|
|
3045
|
+
a[i] === void 0 && (a[i] = n ?? di(i, 0));
|
|
2690
3046
|
}
|
|
2691
|
-
function
|
|
2692
|
-
return e.length ? Array.from({ length:
|
|
3047
|
+
function ui(e, t, n = /* @__PURE__ */ new Set()) {
|
|
3048
|
+
return e.length ? Array.from({ length: Wr }, (r, i) => {
|
|
2693
3049
|
let a = {};
|
|
2694
3050
|
for (let r of e) {
|
|
2695
3051
|
let e = t.indexOf(r);
|
|
2696
|
-
a[r] = e === -1 ?
|
|
3052
|
+
a[r] = e === -1 ? di(r, i, n.has(r)) : e === 0 ? Gr[i % Gr.length] : `${fi(r)} ${Math.floor(i / 2 ** e) % 2 + 1}`;
|
|
2697
3053
|
}
|
|
2698
3054
|
return a;
|
|
2699
3055
|
}) : [];
|
|
2700
3056
|
}
|
|
2701
|
-
function
|
|
2702
|
-
return n ||
|
|
3057
|
+
function di(e, t, n = !1) {
|
|
3058
|
+
return n || Kr.test(e) ? (t + 1) * 250 : Jr.test(e) ? `2026-06-${String(t % 28 + 1).padStart(2, "0")}` : `${fi(e)} ${t + 1}`;
|
|
2703
3059
|
}
|
|
2704
|
-
function
|
|
3060
|
+
function fi(e) {
|
|
2705
3061
|
let t = String(e).replace(/[_-]+/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").trim().toLowerCase();
|
|
2706
3062
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
2707
3063
|
}
|
|
2708
3064
|
//#endregion
|
|
2709
3065
|
//#region src/designer/tokens.js
|
|
2710
|
-
var
|
|
3066
|
+
var pi = "field", mi = [
|
|
2711
3067
|
{
|
|
2712
3068
|
id: "page",
|
|
2713
3069
|
prefer: [
|
|
@@ -2764,7 +3120,7 @@ var Hr = "field", Ur = [
|
|
|
2764
3120
|
id: "sum",
|
|
2765
3121
|
prefer: ["groupFooter", "reportFooter"],
|
|
2766
3122
|
label: "Sum",
|
|
2767
|
-
value: `{sum(${
|
|
3123
|
+
value: `{sum(${pi})}`,
|
|
2768
3124
|
note: "Added up over the rows in scope",
|
|
2769
3125
|
field: !0,
|
|
2770
3126
|
aggregate: !0
|
|
@@ -2773,7 +3129,7 @@ var Hr = "field", Ur = [
|
|
|
2773
3129
|
id: "avg",
|
|
2774
3130
|
prefer: ["groupFooter", "reportFooter"],
|
|
2775
3131
|
label: "Average",
|
|
2776
|
-
value: `{avg(${
|
|
3132
|
+
value: `{avg(${pi})}`,
|
|
2777
3133
|
note: "The mean of the rows in scope",
|
|
2778
3134
|
field: !0,
|
|
2779
3135
|
aggregate: !0
|
|
@@ -2782,7 +3138,7 @@ var Hr = "field", Ur = [
|
|
|
2782
3138
|
id: "min",
|
|
2783
3139
|
prefer: ["groupFooter", "reportFooter"],
|
|
2784
3140
|
label: "Smallest",
|
|
2785
|
-
value: `{min(${
|
|
3141
|
+
value: `{min(${pi})}`,
|
|
2786
3142
|
field: !0,
|
|
2787
3143
|
aggregate: !0
|
|
2788
3144
|
},
|
|
@@ -2790,7 +3146,7 @@ var Hr = "field", Ur = [
|
|
|
2790
3146
|
id: "max",
|
|
2791
3147
|
prefer: ["groupFooter", "reportFooter"],
|
|
2792
3148
|
label: "Largest",
|
|
2793
|
-
value: `{max(${
|
|
3149
|
+
value: `{max(${pi})}`,
|
|
2794
3150
|
field: !0,
|
|
2795
3151
|
aggregate: !0
|
|
2796
3152
|
},
|
|
@@ -2802,31 +3158,31 @@ var Hr = "field", Ur = [
|
|
|
2802
3158
|
"reportFooter"
|
|
2803
3159
|
],
|
|
2804
3160
|
label: "Percentage of total",
|
|
2805
|
-
value: `{percentage(sum(${
|
|
3161
|
+
value: `{percentage(sum(${pi}))}`,
|
|
2806
3162
|
note: "This group's sum as a share of the whole table's - add , parent for a share of the group outside, or , 50000 for a share of a target",
|
|
2807
3163
|
field: !0,
|
|
2808
3164
|
aggregate: !0
|
|
2809
3165
|
}
|
|
2810
3166
|
];
|
|
2811
|
-
function
|
|
2812
|
-
return
|
|
3167
|
+
function hi(e) {
|
|
3168
|
+
return mi.find((t) => t.id === e) ?? null;
|
|
2813
3169
|
}
|
|
2814
|
-
function
|
|
3170
|
+
function gi(e) {
|
|
2815
3171
|
return !!e?.field;
|
|
2816
3172
|
}
|
|
2817
|
-
var
|
|
2818
|
-
function
|
|
2819
|
-
return e?.aggregate ?
|
|
3173
|
+
var _i = ["groupHeader", "groupFooter"];
|
|
3174
|
+
function vi(e, t) {
|
|
3175
|
+
return e?.aggregate ? _i.includes(N(t)) ? "group" : "report" : null;
|
|
2820
3176
|
}
|
|
2821
|
-
function
|
|
2822
|
-
return e ? !e.bands?.length || e.bands.includes(
|
|
3177
|
+
function yi(e, t) {
|
|
3178
|
+
return e ? !e.bands?.length || e.bands.includes(N(t)) : !1;
|
|
2823
3179
|
}
|
|
2824
|
-
function
|
|
2825
|
-
return e ?
|
|
3180
|
+
function bi(e, t) {
|
|
3181
|
+
return e ? gi(e) ? e.value.replace(pi, String(t || pi)) : e.value : "";
|
|
2826
3182
|
}
|
|
2827
|
-
function
|
|
3183
|
+
function xi(e) {
|
|
2828
3184
|
let t = /* @__PURE__ */ new Set();
|
|
2829
|
-
for (let [, n] of
|
|
3185
|
+
for (let [, n] of ti(e)) for (let e of n) t.add(e);
|
|
2830
3186
|
e?.groupBy && t.add(e.groupBy);
|
|
2831
3187
|
for (let n of Array.isArray(e?.bands) ? e.bands : []) for (let e of n.items || []) if (e?.type === "table") {
|
|
2832
3188
|
typeof e.groupBy == "string" && e.groupBy && t.add(e.groupBy);
|
|
@@ -2834,46 +3190,46 @@ function Xr(e) {
|
|
|
2834
3190
|
}
|
|
2835
3191
|
return [...t].sort();
|
|
2836
3192
|
}
|
|
2837
|
-
function
|
|
2838
|
-
let n =
|
|
3193
|
+
function Si(e, t) {
|
|
3194
|
+
let n = an(e);
|
|
2839
3195
|
if (!t?.bands?.length) return n;
|
|
2840
|
-
let r = n.filter((e) => t.bands.includes(
|
|
3196
|
+
let r = n.filter((e) => t.bands.includes(N(e)));
|
|
2841
3197
|
return r.length ? r : n;
|
|
2842
3198
|
}
|
|
2843
|
-
function
|
|
2844
|
-
let r =
|
|
3199
|
+
function Ci(e, t, n = null) {
|
|
3200
|
+
let r = Si(e, t);
|
|
2845
3201
|
if (!r.length) return null;
|
|
2846
3202
|
for (let e of t?.prefer ?? []) {
|
|
2847
|
-
if (n &&
|
|
2848
|
-
let t = r.find((t) =>
|
|
3203
|
+
if (n && N(n) === e && r.includes(n)) return n;
|
|
3204
|
+
let t = r.find((t) => N(t) === e);
|
|
2849
3205
|
if (t) return t;
|
|
2850
3206
|
}
|
|
2851
|
-
return n && r.includes(n) &&
|
|
3207
|
+
return n && r.includes(n) && yi(t, n) ? n : r[0];
|
|
2852
3208
|
}
|
|
2853
|
-
function
|
|
2854
|
-
let n =
|
|
3209
|
+
function wi(e, t) {
|
|
3210
|
+
let n = gi(e) || e?.id === "count" || e?.id === "page" || e?.id === "total-pages";
|
|
2855
3211
|
return {
|
|
2856
|
-
value:
|
|
3212
|
+
value: bi(e, t),
|
|
2857
3213
|
w: e?.id === "page-of" ? 200 : 120,
|
|
2858
3214
|
align: n ? "right" : "left"
|
|
2859
3215
|
};
|
|
2860
3216
|
}
|
|
2861
3217
|
//#endregion
|
|
2862
3218
|
//#region src/designer/dialog.js
|
|
2863
|
-
var
|
|
2864
|
-
function
|
|
2865
|
-
return Q(e, "column-dialog",
|
|
3219
|
+
var Ti = 20;
|
|
3220
|
+
function Ei(e) {
|
|
3221
|
+
return Q(e, "column-dialog", ji(), (e, t) => {
|
|
2866
3222
|
let n = e.querySelector("[data-role=\"count\"]");
|
|
2867
3223
|
n.focus(), n.select(), e.querySelector("form").addEventListener("submit", (e) => {
|
|
2868
3224
|
e.preventDefault();
|
|
2869
3225
|
let r = Math.round(Number(n.value));
|
|
2870
|
-
t(Number.isFinite(r) && r > 0 ? Math.min(r,
|
|
3226
|
+
t(Number.isFinite(r) && r > 0 ? Math.min(r, Ti) : 3);
|
|
2871
3227
|
});
|
|
2872
3228
|
});
|
|
2873
3229
|
}
|
|
2874
|
-
function
|
|
3230
|
+
function Di(e, t) {
|
|
2875
3231
|
let n = t || [];
|
|
2876
|
-
return Q(e, "open-dialog",
|
|
3232
|
+
return Q(e, "open-dialog", Mi(n), (e, t) => {
|
|
2877
3233
|
e.querySelector("[data-role=\"new\"]")?.addEventListener("click", () => t({ blank: !0 }));
|
|
2878
3234
|
let r = e.querySelector("[data-role=\"report-dropdown\"]"), i = e.querySelector("[data-role=\"confirm\"]");
|
|
2879
3235
|
if (!r || !n.length) {
|
|
@@ -2882,20 +3238,20 @@ function ni(e, t) {
|
|
|
2882
3238
|
}
|
|
2883
3239
|
let a = O(r), o = e.querySelector("[data-role=\"report-meta\"]"), s = () => {
|
|
2884
3240
|
let e = n.find((e) => e.id === a.value) ?? n[0];
|
|
2885
|
-
e && (o.textContent = `${e.id}.json${e.readable === !1 ? " - will not parse" : ""}${
|
|
3241
|
+
e && (o.textContent = `${e.id}.json${e.readable === !1 ? " - will not parse" : ""}${Ni(e.updatedAt)}`, o.toggleAttribute("data-unreadable", e.readable === !1));
|
|
2886
3242
|
};
|
|
2887
3243
|
a.addEventListener("change", s), s(), i.addEventListener("click", () => t({ id: a.value })), i.focus(), e.addEventListener("dz-closing", () => a.destroy());
|
|
2888
3244
|
});
|
|
2889
3245
|
}
|
|
2890
|
-
function
|
|
2891
|
-
return Q(e, "save-dialog",
|
|
3246
|
+
function Oi(e, t = "") {
|
|
3247
|
+
return Q(e, "save-dialog", Pi(t), (e, t) => {
|
|
2892
3248
|
let n = e.querySelector("[data-role=\"report-name\"]"), r = e.querySelector("[data-role=\"filename\"]"), i = e.querySelector("[data-role=\"confirm\"]"), a = () => {
|
|
2893
|
-
let e =
|
|
3249
|
+
let e = Ur(n.value);
|
|
2894
3250
|
r.textContent = e ? `${e}.json` : "needs a letter or a digit", i.disabled = !e;
|
|
2895
3251
|
};
|
|
2896
3252
|
n.addEventListener("input", a), a(), n.focus(), n.select(), e.querySelector("form").addEventListener("submit", (e) => {
|
|
2897
3253
|
e.preventDefault();
|
|
2898
|
-
let r =
|
|
3254
|
+
let r = Ur(n.value);
|
|
2899
3255
|
r && t({
|
|
2900
3256
|
id: r,
|
|
2901
3257
|
name: n.value.trim() || r
|
|
@@ -2903,27 +3259,30 @@ function ri(e, t = "") {
|
|
|
2903
3259
|
});
|
|
2904
3260
|
});
|
|
2905
3261
|
}
|
|
2906
|
-
function
|
|
2907
|
-
return Q(e, "discard-dialog",
|
|
3262
|
+
function ki(e, t = "") {
|
|
3263
|
+
return Q(e, "discard-dialog", Fi(t), (e, t) => {
|
|
2908
3264
|
e.querySelector("[data-role=\"discard\"]").addEventListener("click", () => t(!0)), e.querySelector("[data-role=\"cancel\"]").focus();
|
|
2909
3265
|
}).then((e) => e === !0);
|
|
2910
3266
|
}
|
|
3267
|
+
var Ai = "<svg viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" fill=\"none\"\n stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\"\n aria-hidden=\"true\" focusable=\"false\"><path d=\"M4 4l8 8M12 4l-8 8\"/></svg>";
|
|
2911
3268
|
function Q(e, t, n, r) {
|
|
2912
3269
|
return new Promise((i) => {
|
|
2913
3270
|
let a = e.ownerDocument.createElement("div");
|
|
2914
|
-
a.className = "modal", a.dataset.role = t, a.innerHTML = n,
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
}
|
|
3271
|
+
a.className = "modal", a.dataset.role = t, a.innerHTML = n, a.querySelector(".modal-card")?.insertAdjacentHTML("afterbegin", `
|
|
3272
|
+
<button type="button" class="modal-close" data-role="close"
|
|
3273
|
+
title="Close" aria-label="Close">${Ai}</button>`), e.appendChild(a);
|
|
3274
|
+
let o = Zn(a), s = !1;
|
|
2919
3275
|
function c(e) {
|
|
2920
|
-
|
|
3276
|
+
s || (s = !0, o(), a.dispatchEvent(new CustomEvent("dz-closing")), a.remove(), i(e));
|
|
3277
|
+
}
|
|
3278
|
+
function l(e) {
|
|
3279
|
+
e.key === "Escape" && (e.stopPropagation(), e.preventDefault(), c(null));
|
|
2921
3280
|
}
|
|
2922
|
-
for (let e of a.querySelectorAll("[data-role=\"cancel\"], [data-role=\"backdrop\"]")) e.addEventListener("click", () =>
|
|
2923
|
-
a.addEventListener("keydown",
|
|
3281
|
+
for (let e of a.querySelectorAll("[data-role=\"cancel\"], [data-role=\"backdrop\"], [data-role=\"close\"]")) e.addEventListener("click", () => c(null));
|
|
3282
|
+
a.addEventListener("keydown", l, !0), r(a, c);
|
|
2924
3283
|
});
|
|
2925
3284
|
}
|
|
2926
|
-
function
|
|
3285
|
+
function ji() {
|
|
2927
3286
|
return `
|
|
2928
3287
|
<div class="modal-backdrop" data-role="backdrop"></div>
|
|
2929
3288
|
|
|
@@ -2935,7 +3294,7 @@ function ai() {
|
|
|
2935
3294
|
<div class="dz-field dz-field-count">
|
|
2936
3295
|
<label for="dz-columns">Columns</label>
|
|
2937
3296
|
<input type="number" id="dz-columns" data-role="count"
|
|
2938
|
-
value="3" min="1" max="${
|
|
3297
|
+
value="3" min="1" max="${Ti}"
|
|
2939
3298
|
step="1" required>
|
|
2940
3299
|
</div>
|
|
2941
3300
|
|
|
@@ -2951,7 +3310,7 @@ function ai() {
|
|
|
2951
3310
|
</form>
|
|
2952
3311
|
</div>`;
|
|
2953
3312
|
}
|
|
2954
|
-
function
|
|
3313
|
+
function Mi(e) {
|
|
2955
3314
|
let t = e || [], n = `
|
|
2956
3315
|
<div class="dz-field dz-field-picker">
|
|
2957
3316
|
<label id="dz-open-label">Report</label>
|
|
@@ -2990,7 +3349,7 @@ function oi(e) {
|
|
|
2990
3349
|
</div>
|
|
2991
3350
|
</div>`;
|
|
2992
3351
|
}
|
|
2993
|
-
function
|
|
3352
|
+
function Ni(e) {
|
|
2994
3353
|
if (!e) return "";
|
|
2995
3354
|
let t = new Date(e);
|
|
2996
3355
|
return Number.isNaN(t.getTime()) ? "" : ` - ${t.toLocaleDateString(void 0, {
|
|
@@ -2999,7 +3358,7 @@ function si(e) {
|
|
|
2999
3358
|
year: "numeric"
|
|
3000
3359
|
})}`;
|
|
3001
3360
|
}
|
|
3002
|
-
function
|
|
3361
|
+
function Pi(e) {
|
|
3003
3362
|
return `
|
|
3004
3363
|
<div class="modal-backdrop" data-role="backdrop"></div>
|
|
3005
3364
|
|
|
@@ -3025,7 +3384,7 @@ function ci(e) {
|
|
|
3025
3384
|
</form>
|
|
3026
3385
|
</div>`;
|
|
3027
3386
|
}
|
|
3028
|
-
function
|
|
3387
|
+
function Fi(e) {
|
|
3029
3388
|
return `
|
|
3030
3389
|
<div class="modal-backdrop" data-role="backdrop"></div>
|
|
3031
3390
|
|
|
@@ -3044,8 +3403,8 @@ function li(e) {
|
|
|
3044
3403
|
</div>
|
|
3045
3404
|
</div>`;
|
|
3046
3405
|
}
|
|
3047
|
-
function
|
|
3048
|
-
return Q(e, "data-dialog",
|
|
3406
|
+
function Ii(e, t, { id: n = null, generated: r = !1 } = {}) {
|
|
3407
|
+
return Q(e, "data-dialog", Li(t, n, r), (e, t) => {
|
|
3049
3408
|
let n = e.querySelector("[data-role=\"payload\"]"), r = e.querySelector("[data-role=\"parse-error\"]"), i = e.querySelector("[data-role=\"confirm\"]"), a = () => {
|
|
3050
3409
|
try {
|
|
3051
3410
|
let e = JSON.parse(n.value), t = typeof e == "object" && !!e && !Array.isArray(e);
|
|
@@ -3061,7 +3420,7 @@ function ui(e, t, { id: n = null, generated: r = !1 } = {}) {
|
|
|
3061
3420
|
});
|
|
3062
3421
|
});
|
|
3063
3422
|
}
|
|
3064
|
-
function
|
|
3423
|
+
function Li(e, t, n) {
|
|
3065
3424
|
let r = t ? `${t}.data.json` : "a .data.json beside the report";
|
|
3066
3425
|
return `
|
|
3067
3426
|
<div class="modal-backdrop" data-role="backdrop"></div>
|
|
@@ -3087,30 +3446,30 @@ function di(e, t, n) {
|
|
|
3087
3446
|
</div>
|
|
3088
3447
|
</div>`;
|
|
3089
3448
|
}
|
|
3090
|
-
function
|
|
3091
|
-
let r =
|
|
3092
|
-
return Q(e, "token-dialog",
|
|
3093
|
-
let a = e.querySelector("[data-role=\"field-row\"]"), o = e.querySelector("[data-role=\"token-warning\"]"), s = e.querySelector("[data-role=\"confirm\"]"), c = r.length ? O(e.querySelector("[data-role=\"field-dropdown\"]")) : null, l = e.querySelector("[data-role=\"band-dropdown\"]"), u = null, d = () =>
|
|
3449
|
+
function Ri(e, t, n = null) {
|
|
3450
|
+
let r = xi(t);
|
|
3451
|
+
return Q(e, "token-dialog", Vi(t, r, n), (e, i) => {
|
|
3452
|
+
let a = e.querySelector("[data-role=\"field-row\"]"), o = e.querySelector("[data-role=\"token-warning\"]"), s = e.querySelector("[data-role=\"confirm\"]"), c = r.length ? O(e.querySelector("[data-role=\"field-dropdown\"]")) : null, l = e.querySelector("[data-role=\"band-dropdown\"]"), u = null, d = () => hi(e.querySelector("[name=\"dz-token\"]:checked")?.value);
|
|
3094
3453
|
function f(e) {
|
|
3095
3454
|
u?.destroy();
|
|
3096
|
-
let r =
|
|
3097
|
-
l.innerHTML =
|
|
3455
|
+
let r = Si(t, e), i = Ci(t, e, n);
|
|
3456
|
+
l.innerHTML = Ui("band", r.map((e) => ({
|
|
3098
3457
|
value: e,
|
|
3099
|
-
label:
|
|
3458
|
+
label: F(e)
|
|
3100
3459
|
})), i), u = O(l), u.addEventListener("change", () => p());
|
|
3101
3460
|
}
|
|
3102
3461
|
function p({ retarget: e = !1 } = {}) {
|
|
3103
3462
|
let t = d();
|
|
3104
3463
|
if (!t) return;
|
|
3105
|
-
a.hidden = !
|
|
3106
|
-
let n = u.value, r =
|
|
3464
|
+
a.hidden = !gi(t), e && f(t);
|
|
3465
|
+
let n = u.value, r = yi(t, n), i = r ? Bi(t, n) : zi(t, n);
|
|
3107
3466
|
o.textContent = i, o.hidden = !i, o.classList.toggle("is-note", r), s.textContent = r ? "Insert" : "Insert anyway";
|
|
3108
3467
|
}
|
|
3109
3468
|
for (let t of e.querySelectorAll("[name=\"dz-token\"]")) t.addEventListener("change", () => p({ retarget: !0 }));
|
|
3110
3469
|
p({ retarget: !0 }), s.addEventListener("click", () => {
|
|
3111
3470
|
let e = d();
|
|
3112
3471
|
e && i({
|
|
3113
|
-
|
|
3472
|
+
...wi(e, gi(e) ? c?.value || "field" : void 0),
|
|
3114
3473
|
band: u.value
|
|
3115
3474
|
});
|
|
3116
3475
|
}), e.querySelector("[name=\"dz-token\"]")?.focus(), e.addEventListener("dz-closing", () => {
|
|
@@ -3118,15 +3477,15 @@ function fi(e, t, n = null) {
|
|
|
3118
3477
|
});
|
|
3119
3478
|
});
|
|
3120
3479
|
}
|
|
3121
|
-
function
|
|
3122
|
-
return `${e.label} prints nothing in a ${
|
|
3480
|
+
function zi(e, t) {
|
|
3481
|
+
return `${e.label} prints nothing in a ${F(t)}.`;
|
|
3123
3482
|
}
|
|
3124
|
-
function
|
|
3125
|
-
let n =
|
|
3126
|
-
return n === "group" ? `In a ${
|
|
3483
|
+
function Bi(e, t) {
|
|
3484
|
+
let n = vi(e, t);
|
|
3485
|
+
return n === "group" ? `In a ${F(t)}, ${e.label.toLowerCase()} is worked out over each group's own rows, once per group.` : n === "report" ? `In a ${F(t)}, ${e.label.toLowerCase()} is worked out over every row in the report.` : "";
|
|
3127
3486
|
}
|
|
3128
|
-
function
|
|
3129
|
-
let r =
|
|
3487
|
+
function Vi(e, t, n) {
|
|
3488
|
+
let r = mi[0];
|
|
3130
3489
|
return `
|
|
3131
3490
|
<div class="modal-backdrop" data-role="backdrop"></div>
|
|
3132
3491
|
|
|
@@ -3135,7 +3494,7 @@ function hi(e, t, n) {
|
|
|
3135
3494
|
<h2 id="dz-token-title">Insert field</h2>
|
|
3136
3495
|
|
|
3137
3496
|
<div class="dz-tokens" role="radiogroup" aria-labelledby="dz-token-title">
|
|
3138
|
-
${
|
|
3497
|
+
${mi.map((e, t) => `
|
|
3139
3498
|
<label class="dz-token">
|
|
3140
3499
|
<input type="radio" name="dz-token" value="${S(e.id)}"
|
|
3141
3500
|
${t === 0 ? "checked" : ""}>
|
|
@@ -3147,18 +3506,18 @@ function hi(e, t, n) {
|
|
|
3147
3506
|
</label>`).join("")}
|
|
3148
3507
|
</div>
|
|
3149
3508
|
|
|
3150
|
-
${
|
|
3509
|
+
${Hi("field", "Field", t.map((e) => ({
|
|
3151
3510
|
value: e,
|
|
3152
3511
|
label: e
|
|
3153
3512
|
})), t[0], {
|
|
3154
|
-
hidden: !
|
|
3513
|
+
hidden: !gi(r),
|
|
3155
3514
|
empty: "No fields yet - add a table first"
|
|
3156
3515
|
})}
|
|
3157
3516
|
|
|
3158
|
-
${
|
|
3517
|
+
${Hi("band", "Band", Si(e, r).map((e) => ({
|
|
3159
3518
|
value: e,
|
|
3160
|
-
label:
|
|
3161
|
-
})),
|
|
3519
|
+
label: F(e)
|
|
3520
|
+
})), Ci(e, r, n))}
|
|
3162
3521
|
|
|
3163
3522
|
<p class="dz-token-warning" data-role="token-warning" aria-live="polite" hidden></p>
|
|
3164
3523
|
|
|
@@ -3168,17 +3527,17 @@ function hi(e, t, n) {
|
|
|
3168
3527
|
</div>
|
|
3169
3528
|
</div>`;
|
|
3170
3529
|
}
|
|
3171
|
-
function
|
|
3530
|
+
function Hi(e, t, n, r, { hidden: i = !1, empty: a = "" } = {}) {
|
|
3172
3531
|
return n.length ? `
|
|
3173
3532
|
<div class="dz-field dz-field-picker" data-role="${e}-row"${i ? " hidden" : ""}>
|
|
3174
3533
|
<label id="dz-${e}-label">${S(t)}</label>
|
|
3175
3534
|
|
|
3176
3535
|
<div class="dropdown" data-role="${e}-dropdown">
|
|
3177
|
-
${
|
|
3536
|
+
${Ui(e, n, r)}
|
|
3178
3537
|
</div>
|
|
3179
3538
|
</div>` : `<p class="modal-summary">${S(a)}</p>`;
|
|
3180
3539
|
}
|
|
3181
|
-
function
|
|
3540
|
+
function Ui(e, t, n) {
|
|
3182
3541
|
return `
|
|
3183
3542
|
<button type="button" class="dropdown-trigger"
|
|
3184
3543
|
aria-haspopup="listbox" aria-expanded="false"
|
|
@@ -3196,7 +3555,7 @@ function _i(e, t, n) {
|
|
|
3196
3555
|
>${S(e.label)}</li>`).join("")}
|
|
3197
3556
|
</ul>`;
|
|
3198
3557
|
}
|
|
3199
|
-
var
|
|
3558
|
+
var Wi = [
|
|
3200
3559
|
{
|
|
3201
3560
|
value: "text",
|
|
3202
3561
|
label: "As it comes"
|
|
@@ -3221,7 +3580,7 @@ var vi = [
|
|
|
3221
3580
|
value: "datetime",
|
|
3222
3581
|
label: "Date & time"
|
|
3223
3582
|
}
|
|
3224
|
-
],
|
|
3583
|
+
], Gi = {
|
|
3225
3584
|
number: [
|
|
3226
3585
|
1234567.891,
|
|
3227
3586
|
-1500,
|
|
@@ -3240,17 +3599,17 @@ var vi = [
|
|
|
3240
3599
|
date: ["2026-06-17"],
|
|
3241
3600
|
datetime: ["2026-06-17T15:04:00"]
|
|
3242
3601
|
}, $ = "__custom__";
|
|
3243
|
-
function
|
|
3602
|
+
function Ki(e, t, n, { title: r = "Format" } = {}) {
|
|
3244
3603
|
let i = u(t, n) ?? {
|
|
3245
3604
|
...u({ type: "number" }, n),
|
|
3246
3605
|
type: "text"
|
|
3247
3606
|
};
|
|
3248
|
-
return Q(e, "format-dialog",
|
|
3607
|
+
return Q(e, "format-dialog", $i(i, r), (e, t) => {
|
|
3249
3608
|
let r = e.querySelector("form"), a = (t) => e.querySelector(`[data-role="${t}"]`)?.value, o = () => {
|
|
3250
3609
|
let t = e.querySelector("[name=\"format-type\"]:checked")?.value ?? "text", n = a("pattern");
|
|
3251
3610
|
return {
|
|
3252
3611
|
type: t,
|
|
3253
|
-
decimals:
|
|
3612
|
+
decimals: qi(a("decimals"), i.decimals),
|
|
3254
3613
|
grouping: a("grouping"),
|
|
3255
3614
|
negative: a("negative"),
|
|
3256
3615
|
zero: a("zero"),
|
|
@@ -3264,28 +3623,28 @@ function bi(e, t, n, { title: r = "Format" } = {}) {
|
|
|
3264
3623
|
"currency",
|
|
3265
3624
|
"percent"
|
|
3266
3625
|
].includes(t.type), r = t.type === "date" || t.type === "datetime";
|
|
3267
|
-
r &&
|
|
3626
|
+
r && Xi(e, t.type, t.pattern), e.querySelector("[data-role=\"number-options\"]").hidden = !n, e.querySelector("[data-role=\"currency-options\"]").hidden = t.type !== "currency", e.querySelector("[data-role=\"date-options\"]").hidden = !r, e.querySelector("[data-role=\"custom-row\"]").hidden = a("pattern") !== $, e.querySelector("[data-role=\"symbol-row\"]").hidden = a("symbolChoice") !== $;
|
|
3268
3627
|
let i = o(), s = e.querySelector("[data-role=\"decimals\"]");
|
|
3269
3628
|
s.value !== "" && Number(s.value) !== i.decimals && (s.value = String(i.decimals));
|
|
3270
3629
|
let c = e.querySelector("[data-role=\"zero\"] option[value=\"zero\"]");
|
|
3271
|
-
c && (c.textContent =
|
|
3630
|
+
c && (c.textContent = Ji(i.decimals)), Xn(e), e.querySelector("[data-role=\"sample\"]").innerHTML = i.type === "text" ? "<span>Printed as the data has it</span>" : (Gi[i.type] ?? []).map((e) => `<span>${S(y(e, i) || "(blank)")}</span>`).join("");
|
|
3272
3631
|
};
|
|
3273
3632
|
r.addEventListener("input", s), r.addEventListener("change", s), e.querySelector("[data-role=\"reset\"]").addEventListener("click", () => {
|
|
3274
3633
|
let e = o().type;
|
|
3275
3634
|
t({ format: e === "text" ? null : { type: e } });
|
|
3276
3635
|
}), r.addEventListener("submit", (e) => {
|
|
3277
|
-
e.preventDefault(), t({ format:
|
|
3636
|
+
e.preventDefault(), t({ format: Yi(o(), n) });
|
|
3278
3637
|
}), s(), e.querySelector("[name=\"format-type\"]:checked")?.focus();
|
|
3279
3638
|
});
|
|
3280
3639
|
}
|
|
3281
|
-
function
|
|
3640
|
+
function qi(e, t) {
|
|
3282
3641
|
let n = Math.round(Number(e));
|
|
3283
3642
|
return e === "" || e == null || !Number.isFinite(n) ? t : Math.min(6, Math.max(0, n));
|
|
3284
3643
|
}
|
|
3285
|
-
function
|
|
3644
|
+
function Ji(e) {
|
|
3286
3645
|
return 0 .toFixed(e);
|
|
3287
3646
|
}
|
|
3288
|
-
function
|
|
3647
|
+
function Yi(e, t) {
|
|
3289
3648
|
if (e.type === "text") return null;
|
|
3290
3649
|
let n = u({ type: e.type }, t), r = e.type === "date" || e.type === "datetime" ? ["pattern"] : [
|
|
3291
3650
|
"decimals",
|
|
@@ -3297,29 +3656,36 @@ function Ci(e, t) {
|
|
|
3297
3656
|
for (let t of r) e[t] !== n[t] && (i[t] = e[t]);
|
|
3298
3657
|
return i;
|
|
3299
3658
|
}
|
|
3300
|
-
function
|
|
3659
|
+
function Xi(e, t, n) {
|
|
3301
3660
|
let r = e.querySelector("[data-role=\"pattern\"]");
|
|
3302
3661
|
if (r.dataset.for === t) return;
|
|
3303
3662
|
let a = t === "datetime" ? ne : i;
|
|
3304
|
-
r.innerHTML =
|
|
3663
|
+
r.innerHTML = Qi(a, t, a.includes(n) ? n : a[0]), r.dataset.for = t;
|
|
3305
3664
|
}
|
|
3306
|
-
function
|
|
3307
|
-
let
|
|
3308
|
-
return [...e.map((e) =>
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3665
|
+
function Zi(e, t) {
|
|
3666
|
+
let n = Gi[t][0];
|
|
3667
|
+
return [...e.map((e) => ({
|
|
3668
|
+
value: e,
|
|
3669
|
+
label: `${y(n, {
|
|
3670
|
+
type: t,
|
|
3671
|
+
pattern: e
|
|
3672
|
+
})} (${e})`
|
|
3673
|
+
})), {
|
|
3674
|
+
value: $,
|
|
3675
|
+
label: "Custom…"
|
|
3676
|
+
}];
|
|
3677
|
+
}
|
|
3678
|
+
function Qi(e, t, n) {
|
|
3679
|
+
let r = e.includes(n) ? n : $;
|
|
3680
|
+
return Zi(e, t).map((e) => `<option value="${S(e.value)}"
|
|
3681
|
+
${e.value === r ? " selected" : ""}>${S(e.label)}</option>`).join("");
|
|
3313
3682
|
}
|
|
3314
|
-
function
|
|
3315
|
-
let n = (e
|
|
3316
|
-
${t.value === e ? "selected" : ""}>${S(t.label)}</option>`, r = (e, t, r, i) => `
|
|
3683
|
+
function $i(e, t) {
|
|
3684
|
+
let n = (e, t, n, r) => `
|
|
3317
3685
|
<div class="dz-field">
|
|
3318
|
-
<label for="dz-format-${e}">${S(t)}</label>
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
</select>
|
|
3322
|
-
</div>`, o = e.type === "datetime" ? "datetime" : "date", s = o === "datetime" ? ne : i, c = !s.includes(e.pattern), l = a.some((t) => t.value === e.symbol);
|
|
3686
|
+
<label for="dz-format-${e}" id="dz-format-${e}-label">${S(t)}</label>
|
|
3687
|
+
${Jn(`dz-format-${e}`, `data-role="${e}"`, n, r)}
|
|
3688
|
+
</div>`, r = e.type === "datetime" ? "datetime" : "date", o = r === "datetime" ? ne : i, s = !o.includes(e.pattern), c = a.some((t) => t.value === e.symbol);
|
|
3323
3689
|
return `
|
|
3324
3690
|
<div class="modal-backdrop" data-role="backdrop"></div>
|
|
3325
3691
|
|
|
@@ -3330,12 +3696,14 @@ function Ei(e, t) {
|
|
|
3330
3696
|
<form>
|
|
3331
3697
|
<fieldset class="dz-format-types">
|
|
3332
3698
|
<legend>Type</legend>
|
|
3333
|
-
|
|
3699
|
+
<div class="dz-format-track">
|
|
3700
|
+
${Wi.map((t) => `
|
|
3334
3701
|
<label class="dz-format-type">
|
|
3335
3702
|
<input type="radio" name="format-type" value="${t.value}"
|
|
3336
3703
|
${t.value === e.type ? "checked" : ""}>
|
|
3337
3704
|
<span>${S(t.label)}</span>
|
|
3338
3705
|
</label>`).join("")}
|
|
3706
|
+
</div>
|
|
3339
3707
|
</fieldset>
|
|
3340
3708
|
|
|
3341
3709
|
<div class="dz-format-group" data-role="number-options">
|
|
@@ -3344,7 +3712,7 @@ function Ei(e, t) {
|
|
|
3344
3712
|
<input type="number" id="dz-format-decimals" data-role="decimals"
|
|
3345
3713
|
value="${e.decimals}" min="0" max="6" step="1">
|
|
3346
3714
|
</div>
|
|
3347
|
-
${
|
|
3715
|
+
${n("grouping", "Digit groups", [
|
|
3348
3716
|
{
|
|
3349
3717
|
value: "international",
|
|
3350
3718
|
label: "1,234,567"
|
|
@@ -3358,7 +3726,7 @@ function Ei(e, t) {
|
|
|
3358
3726
|
label: "1234567"
|
|
3359
3727
|
}
|
|
3360
3728
|
], e.grouping)}
|
|
3361
|
-
${
|
|
3729
|
+
${n("negative", "Negative", [
|
|
3362
3730
|
{
|
|
3363
3731
|
value: "minus",
|
|
3364
3732
|
label: "-1,234"
|
|
@@ -3372,10 +3740,10 @@ function Ei(e, t) {
|
|
|
3372
3740
|
label: "1,234-"
|
|
3373
3741
|
}
|
|
3374
3742
|
], e.negative)}
|
|
3375
|
-
${
|
|
3743
|
+
${n("zero", "Zero shows as", [
|
|
3376
3744
|
{
|
|
3377
3745
|
value: "zero",
|
|
3378
|
-
label:
|
|
3746
|
+
label: Ji(e.decimals)
|
|
3379
3747
|
},
|
|
3380
3748
|
{
|
|
3381
3749
|
value: "dash",
|
|
@@ -3389,36 +3757,34 @@ function Ei(e, t) {
|
|
|
3389
3757
|
</div>
|
|
3390
3758
|
|
|
3391
3759
|
<div class="dz-format-group" data-role="currency-options">
|
|
3392
|
-
${
|
|
3760
|
+
${n("symbolChoice", "Symbol", [...a, {
|
|
3393
3761
|
value: $,
|
|
3394
3762
|
label: "Custom…"
|
|
3395
|
-
}],
|
|
3396
|
-
${
|
|
3763
|
+
}], c ? e.symbol : $)}
|
|
3764
|
+
${n("symbolPosition", "Symbol goes", [{
|
|
3397
3765
|
value: "before",
|
|
3398
3766
|
label: "Before ₹100"
|
|
3399
3767
|
}, {
|
|
3400
3768
|
value: "after",
|
|
3401
3769
|
label: "After 100 ₹"
|
|
3402
3770
|
}], e.symbolPosition)}
|
|
3403
|
-
<div class="dz-field" data-role="symbol-row"${
|
|
3771
|
+
<div class="dz-field" data-role="symbol-row"${c ? " hidden" : ""}>
|
|
3404
3772
|
<label for="dz-format-symbol">Custom symbol</label>
|
|
3405
3773
|
<input type="text" id="dz-format-symbol" data-role="symbol"
|
|
3406
|
-
value="${S(
|
|
3774
|
+
value="${S(c ? "" : e.symbol)}" maxlength="6"
|
|
3407
3775
|
spellcheck="false" placeholder="such as CHF">
|
|
3408
3776
|
</div>
|
|
3409
3777
|
</div>
|
|
3410
3778
|
|
|
3411
3779
|
<div class="dz-format-group" data-role="date-options">
|
|
3412
3780
|
<div class="dz-field">
|
|
3413
|
-
<label for="dz-format-pattern">Layout</label>
|
|
3414
|
-
|
|
3415
|
-
${Ti(s, o, c ? $ : e.pattern)}
|
|
3416
|
-
</select>
|
|
3781
|
+
<label for="dz-format-pattern" id="dz-format-pattern-label">Layout</label>
|
|
3782
|
+
${Jn("dz-format-pattern", `data-role="pattern" data-for="${r}"`, Zi(o, r), s ? $ : e.pattern)}
|
|
3417
3783
|
</div>
|
|
3418
|
-
<div class="dz-field" data-role="custom-row"${
|
|
3784
|
+
<div class="dz-field" data-role="custom-row"${s ? "" : " hidden"}>
|
|
3419
3785
|
<label for="dz-format-custom">Pattern</label>
|
|
3420
3786
|
<input type="text" id="dz-format-custom" data-role="customPattern"
|
|
3421
|
-
value="${S(
|
|
3787
|
+
value="${S(s ? e.pattern : "")}" spellcheck="false"
|
|
3422
3788
|
placeholder="dd/MM/yyyy">
|
|
3423
3789
|
</div>
|
|
3424
3790
|
<p class="modal-summary">
|
|
@@ -3442,7 +3808,7 @@ function Ei(e, t) {
|
|
|
3442
3808
|
</form>
|
|
3443
3809
|
</div>`;
|
|
3444
3810
|
}
|
|
3445
|
-
var
|
|
3811
|
+
var ea = [
|
|
3446
3812
|
{
|
|
3447
3813
|
value: "=",
|
|
3448
3814
|
label: "equals"
|
|
@@ -3487,8 +3853,8 @@ var Di = [
|
|
|
3487
3853
|
value: "notEmpty",
|
|
3488
3854
|
label: "is not empty"
|
|
3489
3855
|
}
|
|
3490
|
-
],
|
|
3491
|
-
function
|
|
3856
|
+
], ta = "", na = "#b3261e";
|
|
3857
|
+
function ra(e, t, { title: n = "Highlight", fields: i = [], rows: a = !1, format: o = null } = {}) {
|
|
3492
3858
|
let s = structuredClone(Array.isArray(t) ? t : []), c = [.../* @__PURE__ */ new Set([...i, ...s.map((e) => e.when?.field).filter(Boolean)])], l = () => ({
|
|
3493
3859
|
when: a ? {
|
|
3494
3860
|
field: c[0] ?? "",
|
|
@@ -3498,11 +3864,11 @@ function Ai(e, t, { title: n = "Highlight", fields: i = [], rows: a = !1, format
|
|
|
3498
3864
|
op: "<",
|
|
3499
3865
|
value: 0
|
|
3500
3866
|
},
|
|
3501
|
-
style: { color:
|
|
3867
|
+
style: { color: na }
|
|
3502
3868
|
});
|
|
3503
|
-
return s.length === 0 && s.push(l()), Q(e, "highlight-dialog",
|
|
3869
|
+
return s.length === 0 && s.push(l()), Q(e, "highlight-dialog", la(n), (e, t) => {
|
|
3504
3870
|
let n = e.querySelector("[data-role=\"rules\"]"), i = () => {
|
|
3505
|
-
n.innerHTML = s.map((e, t) =>
|
|
3871
|
+
n.innerHTML = s.map((e, t) => ca(e, t, s.length, c, a, o)).join("");
|
|
3506
3872
|
}, u = (e) => {
|
|
3507
3873
|
let t = se(e);
|
|
3508
3874
|
return t === null ? e : t;
|
|
@@ -3511,12 +3877,12 @@ function Ai(e, t, { title: n = "Highlight", fields: i = [], rows: a = !1, format
|
|
|
3511
3877
|
let t = e.target.closest("[data-key]"), a = Number(t?.closest("[data-n]")?.dataset.n), c = s[a];
|
|
3512
3878
|
if (!c) return;
|
|
3513
3879
|
let l = t.dataset.key;
|
|
3514
|
-
if (l === "field") t.value ===
|
|
3880
|
+
if (l === "field") t.value === ta ? delete c.when.field : c.when.field = t.value;
|
|
3515
3881
|
else if (l === "op") {
|
|
3516
3882
|
c.when.op = t.value, r.includes(t.value) && (delete c.when.value, delete c.when.to), i(), n.querySelector(`[data-n="${a}"] [data-key="op"]`)?.focus();
|
|
3517
3883
|
return;
|
|
3518
3884
|
} else l === "value" || l === "to" ? c.when[l] = u(t.value) : (l === "color" || l === "background") && (c.style[l] = t.value, t.closest(".dz-swatch")?.classList.remove("is-none"));
|
|
3519
|
-
|
|
3885
|
+
sa(n, a, c, o);
|
|
3520
3886
|
}), e.addEventListener("change", (e) => {
|
|
3521
3887
|
e.target.tagName === "SELECT" && e.target.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
3522
3888
|
}), e.addEventListener("click", (e) => {
|
|
@@ -3529,25 +3895,25 @@ function Ai(e, t, { title: n = "Highlight", fields: i = [], rows: a = !1, format
|
|
|
3529
3895
|
return;
|
|
3530
3896
|
}
|
|
3531
3897
|
let o = s[r];
|
|
3532
|
-
o && (a === "remove" && s.splice(r, 1), a === "up" && r > 0 && s.splice(r - 1, 0, ...s.splice(r, 1)), a === "clear" && delete o.style[t.dataset.key], a === "bold" &&
|
|
3898
|
+
o && (a === "remove" && s.splice(r, 1), a === "up" && r > 0 && s.splice(r - 1, 0, ...s.splice(r, 1)), a === "clear" && delete o.style[t.dataset.key], a === "bold" && ia(o.style, "fontWeight", "bold"), a === "italic" && ia(o.style, "fontStyle", "italic"), i());
|
|
3533
3899
|
}), e.querySelector("form").addEventListener("submit", (e) => {
|
|
3534
3900
|
e.preventDefault();
|
|
3535
|
-
let n = s.filter(
|
|
3901
|
+
let n = s.filter(aa);
|
|
3536
3902
|
t({ rules: n.length ? n : null });
|
|
3537
3903
|
}), i(), n.querySelector("select, input")?.focus();
|
|
3538
3904
|
});
|
|
3539
3905
|
}
|
|
3540
|
-
function
|
|
3906
|
+
function ia(e, t, n) {
|
|
3541
3907
|
e[t] === n ? delete e[t] : e[t] = n;
|
|
3542
3908
|
}
|
|
3543
|
-
function
|
|
3909
|
+
function aa(e) {
|
|
3544
3910
|
let { when: t } = e;
|
|
3545
|
-
if (!t || !
|
|
3911
|
+
if (!t || !ea.some((e) => e.value === t.op)) return !1;
|
|
3546
3912
|
if (r.includes(t.op)) return !0;
|
|
3547
3913
|
let n = (e) => e != null && String(e).trim() !== "";
|
|
3548
3914
|
return t.op === "between" ? n(t.value) && n(t.to) : n(t.value);
|
|
3549
3915
|
}
|
|
3550
|
-
function
|
|
3916
|
+
function oa(e, t) {
|
|
3551
3917
|
let n = e.when?.value, r = n === void 0 || n === "" ? "Sample" : y(n, t) || "Sample", i = e.style ?? {};
|
|
3552
3918
|
return `<span class="dz-hl-preview" data-role="preview" style="${S([
|
|
3553
3919
|
i.color ? `color:${i.color}` : "",
|
|
@@ -3556,19 +3922,18 @@ function Ni(e, t) {
|
|
|
3556
3922
|
i.fontStyle ? `font-style:${i.fontStyle}` : ""
|
|
3557
3923
|
].filter(Boolean).join(";"))}">${S(r)}</span>`;
|
|
3558
3924
|
}
|
|
3559
|
-
function
|
|
3925
|
+
function sa(e, t, n, r) {
|
|
3560
3926
|
let i = e.querySelector(`[data-n="${t}"] [data-role="preview"]`);
|
|
3561
|
-
i && (i.outerHTML =
|
|
3927
|
+
i && (i.outerHTML = oa(n, r));
|
|
3562
3928
|
}
|
|
3563
|
-
function
|
|
3564
|
-
let s = e.when ?? {}, c = e.style ?? {}, l = r.includes(s.op), u =
|
|
3565
|
-
|
|
3566
|
-
value: Oi,
|
|
3929
|
+
function ca(e, t, n, i, a, o) {
|
|
3930
|
+
let s = e.when ?? {}, c = e.style ?? {}, l = r.includes(s.op), u = [...a ? [] : [{
|
|
3931
|
+
value: ta,
|
|
3567
3932
|
label: "this value"
|
|
3568
3933
|
}], ...i.map((e) => ({
|
|
3569
3934
|
value: e,
|
|
3570
3935
|
label: e
|
|
3571
|
-
}))],
|
|
3936
|
+
}))], d = (e, t) => {
|
|
3572
3937
|
let n = !c[e];
|
|
3573
3938
|
return `
|
|
3574
3939
|
<span class="dz-hl-color">
|
|
@@ -3588,12 +3953,8 @@ function Fi(e, t, n, i, a, o) {
|
|
|
3588
3953
|
<div class="dz-hl-rule" data-n="${t}">
|
|
3589
3954
|
<span class="dz-hl-label">${t === 0 ? "When" : "Else when"}</span>
|
|
3590
3955
|
<div class="dz-hl-when">
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
</select>
|
|
3594
|
-
<select data-key="op" aria-label="Test">
|
|
3595
|
-
${Di.map(u(s.op)).join("")}
|
|
3596
|
-
</select>
|
|
3956
|
+
${Jn(null, "data-key=\"field\"", u, s.field ?? ta, { label: "What to test" })}
|
|
3957
|
+
${Jn(null, "data-key=\"op\"", ea, s.op, { label: "Test" })}
|
|
3597
3958
|
<span class="dz-hl-values">
|
|
3598
3959
|
${l ? "<span class=\"dz-hl-novalue\">no value needed</span>" : `
|
|
3599
3960
|
<input type="text" data-key="value" value="${S(s.value ?? "")}"
|
|
@@ -3614,8 +3975,8 @@ function Fi(e, t, n, i, a, o) {
|
|
|
3614
3975
|
|
|
3615
3976
|
<span class="dz-hl-label">Style</span>
|
|
3616
3977
|
<div class="dz-hl-style">
|
|
3617
|
-
${
|
|
3618
|
-
${
|
|
3978
|
+
${d("color", "Text")}
|
|
3979
|
+
${d("background", "Fill")}
|
|
3619
3980
|
<span class="dz-hl-toggles">
|
|
3620
3981
|
<button type="button" class="dz-hl-toggle" data-rule-action="bold"
|
|
3621
3982
|
aria-pressed="${c.fontWeight === "bold"}" title="Bold"
|
|
@@ -3624,11 +3985,11 @@ function Fi(e, t, n, i, a, o) {
|
|
|
3624
3985
|
aria-pressed="${c.fontStyle === "italic"}" title="Italic"
|
|
3625
3986
|
aria-label="Italic"><i>I</i></button>
|
|
3626
3987
|
</span>
|
|
3627
|
-
${
|
|
3988
|
+
${oa(e, o)}
|
|
3628
3989
|
</div>
|
|
3629
3990
|
</div>`;
|
|
3630
3991
|
}
|
|
3631
|
-
function
|
|
3992
|
+
function la(e) {
|
|
3632
3993
|
return `
|
|
3633
3994
|
<div class="modal-backdrop" data-role="backdrop"></div>
|
|
3634
3995
|
|
|
@@ -3652,13 +4013,13 @@ function Ii(e) {
|
|
|
3652
4013
|
</form>
|
|
3653
4014
|
</div>`;
|
|
3654
4015
|
}
|
|
3655
|
-
function
|
|
4016
|
+
function ua(e, t, { limit: n = 12 } = {}) {
|
|
3656
4017
|
let r;
|
|
3657
4018
|
try {
|
|
3658
4019
|
r = ce(e, t ?? {});
|
|
3659
4020
|
} catch (e) {
|
|
3660
4021
|
return {
|
|
3661
|
-
markup:
|
|
4022
|
+
markup: da(e),
|
|
3662
4023
|
pageCount: 0,
|
|
3663
4024
|
error: e?.message ?? String(e)
|
|
3664
4025
|
};
|
|
@@ -3670,19 +4031,19 @@ function Li(e, t, { limit: n = 12 } = {}) {
|
|
|
3670
4031
|
...r,
|
|
3671
4032
|
pages: r.pages.slice(0, n)
|
|
3672
4033
|
} : r)}
|
|
3673
|
-
${i > n ?
|
|
4034
|
+
${i > n ? fa(i, n) : ""}`,
|
|
3674
4035
|
pageCount: i,
|
|
3675
4036
|
error: null
|
|
3676
4037
|
};
|
|
3677
4038
|
}
|
|
3678
|
-
function
|
|
4039
|
+
function da(e) {
|
|
3679
4040
|
return `
|
|
3680
4041
|
<div class="dz-problems" role="alert">
|
|
3681
4042
|
<h2>This report will not run yet</h2>
|
|
3682
4043
|
<ul>${(e instanceof o && e.issues?.length ? e.issues : [e?.message ?? String(e)]).map((e) => `<li>${S(e)}</li>`).join("")}</ul>
|
|
3683
4044
|
</div>`;
|
|
3684
4045
|
}
|
|
3685
|
-
function
|
|
4046
|
+
function fa(e, t) {
|
|
3686
4047
|
return `
|
|
3687
4048
|
<p class="dz-truncated">
|
|
3688
4049
|
Showing the first ${t} of ${S(e)} pages.
|
|
@@ -3691,18 +4052,18 @@ function zi(e, t) {
|
|
|
3691
4052
|
}
|
|
3692
4053
|
//#endregion
|
|
3693
4054
|
//#region src/designer/history.js
|
|
3694
|
-
var
|
|
3695
|
-
function
|
|
3696
|
-
let n = [
|
|
4055
|
+
var pa = 100, ma = (e) => structuredClone(e), ha = (e, t) => JSON.stringify(e) === JSON.stringify(t);
|
|
4056
|
+
function ga(e, { limit: t = pa } = {}) {
|
|
4057
|
+
let n = [ma(e)], r = 0, i = null;
|
|
3697
4058
|
return {
|
|
3698
4059
|
push(e, a = null) {
|
|
3699
|
-
return
|
|
4060
|
+
return ha(e, n[r]) ? !1 : (r < n.length - 1 && (n = n.slice(0, r + 1), i = null), a != null && a === i ? (n[r] = ma(e), !0) : (n.push(ma(e)), r++, i = a, n.length > t && (n.shift(), r--), !0));
|
|
3700
4061
|
},
|
|
3701
4062
|
undo() {
|
|
3702
|
-
return r === 0 ? null : (r--, i = null,
|
|
4063
|
+
return r === 0 ? null : (r--, i = null, ma(n[r]));
|
|
3703
4064
|
},
|
|
3704
4065
|
redo() {
|
|
3705
|
-
return r >= n.length - 1 ? null : (r++, i = null,
|
|
4066
|
+
return r >= n.length - 1 ? null : (r++, i = null, ma(n[r]));
|
|
3706
4067
|
},
|
|
3707
4068
|
get canUndo() {
|
|
3708
4069
|
return r > 0;
|
|
@@ -3714,29 +4075,29 @@ function Ui(e, { limit: t = Bi } = {}) {
|
|
|
3714
4075
|
return n.length;
|
|
3715
4076
|
},
|
|
3716
4077
|
reset(e) {
|
|
3717
|
-
n = [
|
|
4078
|
+
n = [ma(e)], r = 0, i = null;
|
|
3718
4079
|
}
|
|
3719
4080
|
};
|
|
3720
4081
|
}
|
|
3721
4082
|
//#endregion
|
|
3722
4083
|
//#region src/designer/designer.js
|
|
3723
|
-
var
|
|
4084
|
+
var _a = [
|
|
3724
4085
|
"image/png",
|
|
3725
4086
|
"image/jpeg",
|
|
3726
4087
|
"image/gif",
|
|
3727
4088
|
"image/webp"
|
|
3728
|
-
],
|
|
4089
|
+
], va = 1024 * 1024, ya = 200 * 1024, ba = (e) => `${Math.round(e / 1024)} KB`, xa = [
|
|
3729
4090
|
"list",
|
|
3730
4091
|
"load",
|
|
3731
4092
|
"save"
|
|
3732
4093
|
];
|
|
3733
|
-
function
|
|
4094
|
+
function Sa(e) {
|
|
3734
4095
|
if (e == null) return;
|
|
3735
4096
|
if (typeof e == "string") throw TypeError(`createDesigner: store must be an object with list, load and save functions, not a path ("${e}"). To keep reports in a folder, leave store out and serve the folder: \`npx report-studio design --dir ${e}\`, or reportStudio({ dir: '${e}' }) from 'report-studio/vite' in your vite.config.`);
|
|
3736
|
-
let t =
|
|
4097
|
+
let t = xa.filter((t) => typeof e?.[t] != "function");
|
|
3737
4098
|
if (t.length > 0) throw TypeError(`createDesigner: store is missing ${t.join(", ")} - it must be an object with list, load and save functions (see the store contract), or left out to use the dev server's routes.`);
|
|
3738
4099
|
}
|
|
3739
|
-
function
|
|
4100
|
+
function Ca({ width: e, height: t, features: n, ...r } = {}) {
|
|
3740
4101
|
let i = v({
|
|
3741
4102
|
title: r.layout?.name ? `${r.layout.name} - Designer` : "Report designer",
|
|
3742
4103
|
width: e,
|
|
@@ -3744,7 +4105,7 @@ function Xi({ width: e, height: t, features: n, ...r } = {}) {
|
|
|
3744
4105
|
features: n
|
|
3745
4106
|
});
|
|
3746
4107
|
if (!i) return null;
|
|
3747
|
-
let a =
|
|
4108
|
+
let a = wa({
|
|
3748
4109
|
...r,
|
|
3749
4110
|
mount: i.mount
|
|
3750
4111
|
}), o = ae(globalThis, i.window, a.destroy);
|
|
@@ -3756,24 +4117,24 @@ function Xi({ width: e, height: t, features: n, ...r } = {}) {
|
|
|
3756
4117
|
}
|
|
3757
4118
|
};
|
|
3758
4119
|
}
|
|
3759
|
-
function
|
|
4120
|
+
function wa({ mount: e, layout: t, id: n = null, store: r, guardUnload: i = !0, onChange: a = null } = {}) {
|
|
3760
4121
|
let o = typeof e == "string" ? document.querySelector(e) : e;
|
|
3761
4122
|
if (!o) throw Error(`createDesigner: no element for mount ${JSON.stringify(e)}. Add <div id="report-designer"></div> to the page first.`);
|
|
3762
4123
|
let c = o.ownerDocument;
|
|
3763
|
-
|
|
3764
|
-
let l = r ??
|
|
4124
|
+
Sa(r);
|
|
4125
|
+
let l = r ?? Vr(), d = {
|
|
3765
4126
|
zoom: 1,
|
|
3766
4127
|
fitWidth: !1,
|
|
3767
4128
|
rulers: !1,
|
|
3768
|
-
layout:
|
|
4129
|
+
layout: st(t) ? ot() : we(t),
|
|
3769
4130
|
selection: [],
|
|
3770
4131
|
id: n,
|
|
3771
4132
|
dirty: !1,
|
|
3772
4133
|
clipboard: [],
|
|
3773
4134
|
mode: "design",
|
|
3774
4135
|
dismissed: null
|
|
3775
|
-
}, f =
|
|
3776
|
-
o.classList.add("report-designer"), o.tabIndex = -1, o.innerHTML =
|
|
4136
|
+
}, f = ga(d.layout);
|
|
4137
|
+
o.classList.add("report-designer"), o.tabIndex = -1, o.innerHTML = Ta(d.layout);
|
|
3777
4138
|
let p = o.querySelector("[data-role=\"canvas\"]"), h = o.querySelector("[data-role=\"stage\"]"), g = o.querySelector("[data-role=\"zoom-layer\"]"), _ = o.querySelector("[data-role=\"panel\"]"), v = o.querySelector("[data-role=\"bar\"]"), y = o.querySelector("[data-role=\"foot\"]"), b = o.querySelector(".dz-main"), x = o.querySelector("[data-role=\"toasts\"]"), S = o.querySelector("[data-role=\"pages\"]");
|
|
3778
4139
|
function C() {
|
|
3779
4140
|
return d.selection.at(-1) ?? null;
|
|
@@ -3790,34 +4151,34 @@ function Zi({ mount: e, layout: t, id: n = null, store: r, guardUnload: i = !0,
|
|
|
3790
4151
|
function D() {
|
|
3791
4152
|
let e = s(d.layout);
|
|
3792
4153
|
if (d.mode === "preview") {
|
|
3793
|
-
let t =
|
|
3794
|
-
return g.innerHTML = t.markup, S.textContent = t.error ? "" : `${t.pageCount} page${t.pageCount === 1 ? "" : "s"}`, k(e),
|
|
4154
|
+
let t = ua(d.layout, d.data);
|
|
4155
|
+
return g.innerHTML = t.markup, S.textContent = t.error ? "" : `${t.pageCount} page${t.pageCount === 1 ? "" : "s"}`, k(e), me(), e;
|
|
3795
4156
|
}
|
|
3796
4157
|
S.textContent = "";
|
|
3797
4158
|
let t = "";
|
|
3798
4159
|
try {
|
|
3799
|
-
t =
|
|
4160
|
+
t = Wt(d.layout, d.selection, { rulers: d.rulers });
|
|
3800
4161
|
} catch {
|
|
3801
4162
|
t = "";
|
|
3802
4163
|
}
|
|
3803
|
-
return g.innerHTML = t, k(e),
|
|
4164
|
+
return g.innerHTML = t, k(e), me(), e;
|
|
3804
4165
|
}
|
|
3805
4166
|
function k(e) {
|
|
3806
|
-
let t = d.mode !== "design" || e.length === 0 ||
|
|
3807
|
-
x.innerHTML = t ? "" :
|
|
4167
|
+
let t = d.mode !== "design" || e.length === 0 || Rr(e, d.dismissed);
|
|
4168
|
+
x.innerHTML = t ? "" : zr(e), e.length === 0 && (d.dismissed = null);
|
|
3808
4169
|
}
|
|
3809
4170
|
function ne() {
|
|
3810
4171
|
ae();
|
|
3811
|
-
let e =
|
|
4172
|
+
let e = Ut(d.layout, d.selection);
|
|
3812
4173
|
for (let [t, { item: n, box: r }] of e.entries()) {
|
|
3813
|
-
let e = d.selection[t], i = p.querySelector(`[data-role="select"][data-select-id="${
|
|
4174
|
+
let e = d.selection[t], i = p.querySelector(`[data-role="select"][data-select-id="${Ea(n.id)}"]`);
|
|
3814
4175
|
i && Object.assign(i.style, {
|
|
3815
4176
|
top: `${r.y}px`,
|
|
3816
4177
|
left: `${r.x}px`,
|
|
3817
4178
|
width: `${r.w}px`,
|
|
3818
4179
|
height: `${r.h}px`
|
|
3819
4180
|
});
|
|
3820
|
-
let a = p.querySelector(`[data-band-type="${
|
|
4181
|
+
let a = p.querySelector(`[data-band-type="${Ea(e.band)}"] [data-item-id="${Ea(n.id)}"]`);
|
|
3821
4182
|
a && (Object.assign(a.style, {
|
|
3822
4183
|
top: `${n.y}px`,
|
|
3823
4184
|
left: `${n.x}px`,
|
|
@@ -3828,118 +4189,119 @@ function Zi({ mount: e, layout: t, id: n = null, store: r, guardUnload: i = !0,
|
|
|
3828
4189
|
}
|
|
3829
4190
|
function ie() {
|
|
3830
4191
|
let e = d.layout.page.margin;
|
|
3831
|
-
for (let t of
|
|
4192
|
+
for (let t of Nt(d.layout)) {
|
|
3832
4193
|
if (!t.table) continue;
|
|
3833
|
-
let n =
|
|
3834
|
-
r && r.setAttribute("style",
|
|
4194
|
+
let n = Ea(t.type), r = p.querySelector(`.dz-zone[data-band-type="${n}"]`);
|
|
4195
|
+
r && r.setAttribute("style", zt(t, e));
|
|
3835
4196
|
let i = p.querySelector(`[data-band-tag="${n}"]`);
|
|
3836
4197
|
i && (i.style.top = `${t.top + e.top}px`);
|
|
3837
4198
|
}
|
|
3838
4199
|
}
|
|
3839
4200
|
function ae() {
|
|
3840
4201
|
let e = p.querySelector("[data-role=\"rules\"]");
|
|
3841
|
-
e && (e.innerHTML = d.rulers ?
|
|
3842
|
-
for (let e of p.querySelectorAll("[data-role=\"ruler-guides\"]")) e.innerHTML =
|
|
4202
|
+
e && (e.innerHTML = d.rulers ? Rt(d.layout) : "");
|
|
4203
|
+
for (let e of p.querySelectorAll("[data-role=\"ruler-guides\"]")) e.innerHTML = Lt(d.layout, e.dataset.axis);
|
|
3843
4204
|
}
|
|
3844
|
-
|
|
4205
|
+
let se = /* @__PURE__ */ new Map(), le = null;
|
|
4206
|
+
function A() {
|
|
3845
4207
|
if (d.mode === "preview") return;
|
|
3846
|
-
let e = d.selection.length;
|
|
3847
|
-
_.innerHTML = e > 1 ?
|
|
4208
|
+
let e = d.selection.length, t = T(), n = e > 1 ? "many" : t ? `item:${t.type}` : "report";
|
|
4209
|
+
le && se.set(le, _.scrollTop), _.innerHTML = e > 1 ? sr(E()) : t ? tr(t, d.layout) : cr(d.layout), _.scrollTop = se.get(n) ?? 0, le = n;
|
|
3848
4210
|
}
|
|
3849
|
-
let
|
|
3850
|
-
function
|
|
4211
|
+
let ue = (e, t) => e?.band === t?.band && e?.id === t?.id;
|
|
4212
|
+
function de(e, { add: t = !1 } = {}) {
|
|
3851
4213
|
let n = e == null ? [] : [].concat(e), r;
|
|
3852
4214
|
if (!t) r = n;
|
|
3853
4215
|
else {
|
|
3854
4216
|
r = [...d.selection];
|
|
3855
4217
|
for (let e of n) {
|
|
3856
|
-
let t = r.findIndex((t) =>
|
|
4218
|
+
let t = r.findIndex((t) => ue(t, e));
|
|
3857
4219
|
t === -1 ? r.push(e) : r.splice(t, 1);
|
|
3858
4220
|
}
|
|
3859
4221
|
}
|
|
3860
|
-
r.length === d.selection.length && r.every((e, t) =>
|
|
4222
|
+
r.length === d.selection.length && r.every((e, t) => ue(e, d.selection[t])) || (d.selection = r, D(), A());
|
|
3861
4223
|
}
|
|
3862
4224
|
function j(e = null) {
|
|
3863
|
-
f.push(d.layout, e) && (d.dirty = !0,
|
|
4225
|
+
f.push(d.layout, e) && (d.dirty = !0, P(), fe());
|
|
3864
4226
|
}
|
|
3865
|
-
function
|
|
4227
|
+
function fe() {
|
|
3866
4228
|
if (typeof a == "function") try {
|
|
3867
4229
|
a(d.layout);
|
|
3868
4230
|
} catch (e) {
|
|
3869
4231
|
console.error("createDesigner: onChange threw", e);
|
|
3870
4232
|
}
|
|
3871
4233
|
}
|
|
3872
|
-
function
|
|
3873
|
-
D(),
|
|
4234
|
+
function N(e = null) {
|
|
4235
|
+
D(), A(), j(e);
|
|
3874
4236
|
}
|
|
3875
|
-
function
|
|
4237
|
+
function P() {
|
|
3876
4238
|
v.querySelector("[data-role=\"name\"]").textContent = d.layout.name ?? "", v.querySelector("[data-role=\"undo\"]").disabled = !f.canUndo, v.querySelector("[data-role=\"redo\"]").disabled = !f.canRedo;
|
|
3877
4239
|
let e = v.querySelector("[data-role=\"size\"]");
|
|
3878
4240
|
e && d.layout.page && (e.innerHTML = `${d.layout.page.width} × ${d.layout.page.height}`);
|
|
3879
4241
|
let t = v.querySelector("[data-role=\"rulers\"]");
|
|
3880
4242
|
t.setAttribute("aria-pressed", String(d.rulers)), t.classList.toggle("is-on", d.rulers);
|
|
3881
4243
|
let n = y.querySelector("[data-role=\"add-table\"]");
|
|
3882
|
-
n.disabled = !
|
|
4244
|
+
n.disabled = !tn(d.layout), v.dataset.dirty = String(d.dirty);
|
|
3883
4245
|
let r = v.querySelector("[data-role=\"status\"]");
|
|
3884
4246
|
r.textContent = d.dirty ? "Unsaved changes" : d.id ? `Saved as ${d.id}.json` : "Not saved yet";
|
|
3885
4247
|
}
|
|
3886
4248
|
function F(e, { id: t, dirty: n }) {
|
|
3887
|
-
d.layout =
|
|
4249
|
+
d.layout = we(e), d.selection = [], d.mode = "design", d.data = null, t !== void 0 && (d.id = t), n !== void 0 && (d.dirty = n), Be(), fe();
|
|
3888
4250
|
}
|
|
3889
4251
|
function I(e, t) {
|
|
3890
|
-
|
|
4252
|
+
xn(d.layout, e, t), d.selection = [{
|
|
3891
4253
|
band: e,
|
|
3892
4254
|
id: t.id
|
|
3893
|
-
}],
|
|
4255
|
+
}], N(`add:${t.id}`), R(e);
|
|
3894
4256
|
}
|
|
3895
4257
|
function L(e) {
|
|
3896
4258
|
let t = new Set(e == null ? [] : [].concat(e));
|
|
3897
4259
|
for (let e of p.querySelectorAll("[data-band-type]")) e.classList.toggle("is-target", t.has(e.dataset.bandType));
|
|
3898
4260
|
for (let e of p.querySelectorAll("[data-band-tag]")) e.classList.toggle("is-target", t.has(e.dataset.bandTag));
|
|
3899
4261
|
}
|
|
3900
|
-
function
|
|
4262
|
+
function pe(e) {
|
|
3901
4263
|
let t = p.querySelector("[data-role=\"guides\"]");
|
|
3902
|
-
t && (t.innerHTML = e ?
|
|
4264
|
+
t && (t.innerHTML = e ? Kt(Gt(d.layout, e.band), e.lines, e.gaps) : "");
|
|
3903
4265
|
}
|
|
3904
|
-
function
|
|
4266
|
+
function me() {
|
|
3905
4267
|
g.style.transformOrigin = "top left", g.style.transform = `scale(${d.zoom})`;
|
|
3906
4268
|
let e = g.offsetWidth, t = g.offsetHeight;
|
|
3907
|
-
e && t && (h.style.width = `${e * d.zoom}px`, h.style.height = `${t * d.zoom}px`),
|
|
4269
|
+
e && t && (h.style.width = `${e * d.zoom}px`, h.style.height = `${t * d.zoom}px`), ge();
|
|
3908
4270
|
}
|
|
3909
|
-
function
|
|
4271
|
+
function ge() {
|
|
3910
4272
|
if (W && !d.fitWidth) {
|
|
3911
4273
|
let e = re.find((e) => Math.abs(e - d.zoom) < 1e-9);
|
|
3912
4274
|
W.value = e === void 0 ? "fit" : String(e);
|
|
3913
4275
|
}
|
|
3914
4276
|
v.querySelector("[data-role=\"zoom-out\"]").disabled = !d.fitWidth && d.zoom <= te, v.querySelector("[data-role=\"zoom-in\"]").disabled = !d.fitWidth && d.zoom >= oe;
|
|
3915
4277
|
}
|
|
3916
|
-
function
|
|
3917
|
-
d.fitWidth = !1, d.zoom = Math.min(Math.max(e, te), oe),
|
|
4278
|
+
function _e(e) {
|
|
4279
|
+
d.fitWidth = !1, d.zoom = Math.min(Math.max(e, te), oe), me();
|
|
3918
4280
|
}
|
|
3919
|
-
function
|
|
4281
|
+
function ve() {
|
|
3920
4282
|
d.fitWidth = !0, W && (W.value = "fit");
|
|
3921
4283
|
let e = p.clientWidth - 48, t = g.offsetWidth;
|
|
3922
|
-
e > 0 && t > 0 && (d.zoom = Math.min(Math.max(e / t, te), oe)),
|
|
4284
|
+
e > 0 && t > 0 && (d.zoom = Math.min(Math.max(e / t, te), oe)), me();
|
|
3923
4285
|
}
|
|
3924
|
-
function
|
|
4286
|
+
function ye(e) {
|
|
3925
4287
|
let t = d.zoom;
|
|
3926
|
-
|
|
4288
|
+
_e((e > 0 ? re.find((e) => e > t + 1e-9) : [...re].reverse().find((e) => e < t - 1e-9)) ?? t);
|
|
3927
4289
|
}
|
|
3928
|
-
function
|
|
3929
|
-
clearTimeout(
|
|
4290
|
+
function R(e) {
|
|
4291
|
+
clearTimeout(R.timer), L(e), R.timer = setTimeout(() => L(null), 1200);
|
|
3930
4292
|
}
|
|
3931
|
-
let
|
|
3932
|
-
function
|
|
3933
|
-
|
|
4293
|
+
let z = null;
|
|
4294
|
+
function B() {
|
|
4295
|
+
z?.remove(), z = null;
|
|
3934
4296
|
}
|
|
3935
|
-
function
|
|
3936
|
-
|
|
4297
|
+
function Te(e, t, n = null) {
|
|
4298
|
+
B(), b.insertAdjacentHTML("beforeend", Ir(Fr({
|
|
3937
4299
|
count: d.selection.length,
|
|
3938
4300
|
canPaste: d.clipboard.length > 0,
|
|
3939
|
-
canDuplicate:
|
|
3940
|
-
...
|
|
3941
|
-
}))),
|
|
3942
|
-
let r = b.getBoundingClientRect(), i =
|
|
4301
|
+
canDuplicate: tn(d.layout) || !E().some((e) => e.type === "table"),
|
|
4302
|
+
...Ae(n)
|
|
4303
|
+
}))), z = b.querySelector("[data-role=\"menu\"]"), z.addEventListener("keydown", je), z.addEventListener("click", De);
|
|
4304
|
+
let r = b.getBoundingClientRect(), i = z.getBoundingClientRect(), a = Lr({
|
|
3943
4305
|
x: e - r.left,
|
|
3944
4306
|
y: t - r.top
|
|
3945
4307
|
}, {
|
|
@@ -3949,9 +4311,9 @@ function Zi({ mount: e, layout: t, id: n = null, store: r, guardUnload: i = !0,
|
|
|
3949
4311
|
width: r.width,
|
|
3950
4312
|
height: r.height
|
|
3951
4313
|
});
|
|
3952
|
-
|
|
4314
|
+
z.style.left = `${a.left}px`, z.style.top = `${a.top}px`, z.querySelector("button:not([disabled])")?.focus();
|
|
3953
4315
|
}
|
|
3954
|
-
function
|
|
4316
|
+
function Ee(e) {
|
|
3955
4317
|
if (d.mode !== "design") return;
|
|
3956
4318
|
e.preventDefault();
|
|
3957
4319
|
let t = e.target.closest?.("[data-item-id]"), n = t?.closest("[data-band-type]")?.dataset.bandType ?? null;
|
|
@@ -3960,20 +4322,20 @@ function Zi({ mount: e, layout: t, id: n = null, store: r, guardUnload: i = !0,
|
|
|
3960
4322
|
band: n,
|
|
3961
4323
|
id: t.dataset.itemId
|
|
3962
4324
|
};
|
|
3963
|
-
d.selection.some((t) => t.band === e.band && t.id === e.id) ||
|
|
3964
|
-
} else
|
|
3965
|
-
|
|
4325
|
+
d.selection.some((t) => t.band === e.band && t.id === e.id) || de(e);
|
|
4326
|
+
} else de(null);
|
|
4327
|
+
Te(e.clientX, e.clientY, e.target);
|
|
3966
4328
|
}
|
|
3967
|
-
function
|
|
4329
|
+
function De(e) {
|
|
3968
4330
|
let t = e.target.closest?.("[data-action]");
|
|
3969
|
-
!t || t.disabled || (e.preventDefault(),
|
|
4331
|
+
!t || t.disabled || (e.preventDefault(), B(), V(t.dataset.action, t.dataset));
|
|
3970
4332
|
}
|
|
3971
|
-
function
|
|
4333
|
+
function Oe(e) {
|
|
3972
4334
|
if (d.selection.length !== 1) return null;
|
|
3973
4335
|
let t = T();
|
|
3974
4336
|
if (t?.type === "text") return { label: "Format…" };
|
|
3975
4337
|
if (t?.type !== "table") return null;
|
|
3976
|
-
let n =
|
|
4338
|
+
let n = ke(e);
|
|
3977
4339
|
if (n === null) return null;
|
|
3978
4340
|
let r = t.columns[n];
|
|
3979
4341
|
return {
|
|
@@ -3981,12 +4343,12 @@ function Zi({ mount: e, layout: t, id: n = null, store: r, guardUnload: i = !0,
|
|
|
3981
4343
|
index: n
|
|
3982
4344
|
};
|
|
3983
4345
|
}
|
|
3984
|
-
function
|
|
4346
|
+
function ke(e) {
|
|
3985
4347
|
let t = e?.closest?.("td, th");
|
|
3986
4348
|
return !t || t.classList.contains("group-band-cell") ? null : T()?.columns?.[t.cellIndex] ? t.cellIndex : null;
|
|
3987
4349
|
}
|
|
3988
|
-
function
|
|
3989
|
-
let t =
|
|
4350
|
+
function Ae(e) {
|
|
4351
|
+
let t = Oe(e), n = d.selection.length === 1 ? T() : null, r = null;
|
|
3990
4352
|
if (n?.type === "text" && (r = { label: "Highlight…" }), t && n?.type === "table") {
|
|
3991
4353
|
let e = n.columns[t.index];
|
|
3992
4354
|
r = {
|
|
@@ -4000,7 +4362,7 @@ function Zi({ mount: e, layout: t, id: n = null, store: r, guardUnload: i = !0,
|
|
|
4000
4362
|
rows: n?.type === "table"
|
|
4001
4363
|
};
|
|
4002
4364
|
}
|
|
4003
|
-
function
|
|
4365
|
+
function je(e) {
|
|
4004
4366
|
if (![
|
|
4005
4367
|
"ArrowDown",
|
|
4006
4368
|
"ArrowUp",
|
|
@@ -4008,9 +4370,9 @@ function Zi({ mount: e, layout: t, id: n = null, store: r, guardUnload: i = !0,
|
|
|
4008
4370
|
"End"
|
|
4009
4371
|
].includes(e.key)) return;
|
|
4010
4372
|
e.preventDefault(), e.stopPropagation();
|
|
4011
|
-
let t = [...
|
|
4373
|
+
let t = [...z.querySelectorAll("button:not([disabled])")];
|
|
4012
4374
|
if (!t.length) return;
|
|
4013
|
-
let n = t.indexOf(
|
|
4375
|
+
let n = t.indexOf(z.ownerDocument.activeElement);
|
|
4014
4376
|
t[{
|
|
4015
4377
|
ArrowDown: (n + 1) % t.length,
|
|
4016
4378
|
ArrowUp: (n - 1 + t.length) % t.length,
|
|
@@ -4018,61 +4380,61 @@ function Zi({ mount: e, layout: t, id: n = null, store: r, guardUnload: i = !0,
|
|
|
4018
4380
|
End: t.length - 1
|
|
4019
4381
|
}[e.key]].focus();
|
|
4020
4382
|
}
|
|
4021
|
-
function
|
|
4022
|
-
|
|
4383
|
+
function Me(e) {
|
|
4384
|
+
z && !z.contains(e.target) && B();
|
|
4023
4385
|
}
|
|
4024
|
-
function
|
|
4025
|
-
|
|
4386
|
+
function Ne(e) {
|
|
4387
|
+
z && e.key === "Escape" && B();
|
|
4026
4388
|
}
|
|
4027
|
-
function
|
|
4389
|
+
function V(e, t) {
|
|
4028
4390
|
let n = T();
|
|
4029
4391
|
switch (e) {
|
|
4030
4392
|
case "add-text": {
|
|
4031
|
-
let e =
|
|
4393
|
+
let e = Nn(d.layout, C());
|
|
4032
4394
|
if (!e) return;
|
|
4033
|
-
I(e,
|
|
4395
|
+
I(e, hn(d.layout, Y(d.layout, e)));
|
|
4034
4396
|
return;
|
|
4035
4397
|
}
|
|
4036
4398
|
case "add-box": {
|
|
4037
|
-
let e =
|
|
4399
|
+
let e = Nn(d.layout, C());
|
|
4038
4400
|
if (!e) return;
|
|
4039
|
-
I(e,
|
|
4401
|
+
I(e, _n(d.layout, Y(d.layout, e)));
|
|
4040
4402
|
return;
|
|
4041
4403
|
}
|
|
4042
4404
|
case "add-image": {
|
|
4043
|
-
let e =
|
|
4405
|
+
let e = Nn(d.layout, C());
|
|
4044
4406
|
if (!e) return;
|
|
4045
|
-
I(e,
|
|
4407
|
+
I(e, vn(d.layout, Y(d.layout, e)));
|
|
4046
4408
|
return;
|
|
4047
4409
|
}
|
|
4048
4410
|
case "upload-image":
|
|
4049
4411
|
if (n?.type !== "image") return;
|
|
4050
|
-
|
|
4412
|
+
Ve(n);
|
|
4051
4413
|
return;
|
|
4052
4414
|
case "clear-image":
|
|
4053
4415
|
if (n?.type !== "image" || !n.src) return;
|
|
4054
|
-
n.src = null,
|
|
4416
|
+
n.src = null, N(`image:${n.id}`);
|
|
4055
4417
|
return;
|
|
4056
4418
|
case "add-line": {
|
|
4057
|
-
let e =
|
|
4419
|
+
let e = Nn(d.layout, C());
|
|
4058
4420
|
if (!e) return;
|
|
4059
|
-
I(e,
|
|
4421
|
+
I(e, gn(d.layout, Y(d.layout, e), t?.orientation));
|
|
4060
4422
|
return;
|
|
4061
4423
|
}
|
|
4062
4424
|
case "add-field":
|
|
4063
|
-
|
|
4425
|
+
Ri(o, d.layout, C()?.band ?? null).then((e) => {
|
|
4064
4426
|
if (!e) return;
|
|
4065
4427
|
let t = Y(d.layout, e.band);
|
|
4066
4428
|
if (!t) return;
|
|
4067
|
-
let n =
|
|
4429
|
+
let n = hn(d.layout, t);
|
|
4068
4430
|
n.value = e.value, n.w = e.w, n.style.align = e.align, I(e.band, n);
|
|
4069
4431
|
});
|
|
4070
4432
|
return;
|
|
4071
4433
|
case "add-table": {
|
|
4072
|
-
let e =
|
|
4073
|
-
if (!e || !
|
|
4074
|
-
|
|
4075
|
-
t != null && I(e,
|
|
4434
|
+
let e = Nn(d.layout, C(), { table: !0 });
|
|
4435
|
+
if (!e || !tn(d.layout)) return;
|
|
4436
|
+
Ei(o).then((t) => {
|
|
4437
|
+
t != null && I(e, bn(d.layout, Y(d.layout, e), t));
|
|
4076
4438
|
});
|
|
4077
4439
|
return;
|
|
4078
4440
|
}
|
|
@@ -4080,14 +4442,14 @@ function Zi({ mount: e, layout: t, id: n = null, store: r, guardUnload: i = !0,
|
|
|
4080
4442
|
if (!d.selection.length) return;
|
|
4081
4443
|
let e = [...d.selection], t = [];
|
|
4082
4444
|
for (let n of e) {
|
|
4083
|
-
let e =
|
|
4445
|
+
let e = Tn(d.layout, n.band, n.id);
|
|
4084
4446
|
e && t.push({
|
|
4085
4447
|
band: n.band,
|
|
4086
4448
|
id: e.id
|
|
4087
4449
|
});
|
|
4088
4450
|
}
|
|
4089
4451
|
if (!t.length) return;
|
|
4090
|
-
d.selection = t,
|
|
4452
|
+
d.selection = t, N(`duplicate:${t.map((e) => e.id).join(",")}`), R([...new Set(t.map((e) => e.band))]);
|
|
4091
4453
|
return;
|
|
4092
4454
|
}
|
|
4093
4455
|
case "dismiss-problems":
|
|
@@ -4103,14 +4465,14 @@ function Zi({ mount: e, layout: t, id: n = null, store: r, guardUnload: i = !0,
|
|
|
4103
4465
|
item: structuredClone(e.item)
|
|
4104
4466
|
}));
|
|
4105
4467
|
if (!e.length) return;
|
|
4106
|
-
d.clipboard = e,
|
|
4468
|
+
d.clipboard = e, G(e.length > 1 ? `Copied ${e.length} items` : "Copied", { ms: 2e3 });
|
|
4107
4469
|
return;
|
|
4108
4470
|
}
|
|
4109
4471
|
case "paste-items": {
|
|
4110
4472
|
if (!d.clipboard.length) return;
|
|
4111
|
-
let e =
|
|
4473
|
+
let e = Nn(d.layout, C());
|
|
4112
4474
|
if (!e) return;
|
|
4113
|
-
let t =
|
|
4475
|
+
let t = On(d.layout, e, d.clipboard);
|
|
4114
4476
|
if (!t.length) return;
|
|
4115
4477
|
d.clipboard = t.map((t) => ({
|
|
4116
4478
|
band: e,
|
|
@@ -4118,26 +4480,26 @@ function Zi({ mount: e, layout: t, id: n = null, store: r, guardUnload: i = !0,
|
|
|
4118
4480
|
})), d.selection = t.map((t) => ({
|
|
4119
4481
|
band: e,
|
|
4120
4482
|
id: t.id
|
|
4121
|
-
})),
|
|
4483
|
+
})), N(`paste:${t.map((e) => e.id).join(",")}`), R(e);
|
|
4122
4484
|
return;
|
|
4123
4485
|
}
|
|
4124
4486
|
case "delete-item": {
|
|
4125
4487
|
if (!d.selection.length) return;
|
|
4126
4488
|
let e = d.selection.map((e) => e.id).join(",");
|
|
4127
|
-
for (let e of d.selection)
|
|
4128
|
-
d.selection = [],
|
|
4489
|
+
for (let e of d.selection) kn(d.layout, e.band, e.id);
|
|
4490
|
+
d.selection = [], N(`delete:${e}`);
|
|
4129
4491
|
return;
|
|
4130
4492
|
}
|
|
4131
4493
|
case "copy-grouping":
|
|
4132
4494
|
if (n?.type !== "table" || !t?.from) return;
|
|
4133
|
-
|
|
4495
|
+
Ce(d.layout, n.id, t.from) && (d.selection = d.selection.filter((e) => w(e)), N(`grouping:copy:${n.id}`));
|
|
4134
4496
|
return;
|
|
4135
4497
|
case "edit-format": {
|
|
4136
4498
|
let e = t?.index != null && n?.type === "table", r = e ? n.columns?.[Number(t.index)] : n;
|
|
4137
4499
|
if (!r || !e && n?.type !== "text") return;
|
|
4138
4500
|
let i = e ? r.label || r.field || "column" : n.id, a = C();
|
|
4139
|
-
|
|
4140
|
-
i && w(a) === n && (e && !n.columns?.includes(r) || (i.format ? r.format = i.format : delete r.format,
|
|
4501
|
+
Ki(o, r.format, d.layout.format, { title: `Format: ${i}` }).then((i) => {
|
|
4502
|
+
i && w(a) === n && (e && !n.columns?.includes(r) || (i.format ? r.format = i.format : delete r.format, N(`format:${n.id}${e ? `:${t.index}` : ""}`)));
|
|
4141
4503
|
});
|
|
4142
4504
|
return;
|
|
4143
4505
|
}
|
|
@@ -4145,14 +4507,14 @@ function Zi({ mount: e, layout: t, id: n = null, store: r, guardUnload: i = !0,
|
|
|
4145
4507
|
case "edit-row-highlight": {
|
|
4146
4508
|
let r = e === "edit-row-highlight", i = !r && t?.index != null && n?.type === "table", a = i ? n.columns?.[Number(t.index)] : n;
|
|
4147
4509
|
if (!a || (r ? n.type !== "table" : !i && n.type !== "text")) return;
|
|
4148
|
-
let s = r ? "rowHighlight" : "highlight", c = r ? `${n.id} rows` : i ? a.label || a.field || "column" : n.id, l = n.type === "table" ? (n.columns ?? []).map((e) => e.field).filter(Boolean) :
|
|
4149
|
-
|
|
4510
|
+
let s = r ? "rowHighlight" : "highlight", c = r ? `${n.id} rows` : i ? a.label || a.field || "column" : n.id, l = n.type === "table" ? (n.columns ?? []).map((e) => e.field).filter(Boolean) : xi(d.layout), f = C();
|
|
4511
|
+
ra(o, a[s], {
|
|
4150
4512
|
title: `Highlight: ${c}`,
|
|
4151
4513
|
fields: i ? l.filter((e) => e !== a.field) : l,
|
|
4152
4514
|
rows: r,
|
|
4153
4515
|
format: i || n.type === "text" ? u(a.format, d.layout.format) : null
|
|
4154
4516
|
}).then((e) => {
|
|
4155
|
-
e && w(f) === n && (i && !n.columns?.includes(a) || (e.rules ? a[s] = e.rules : delete a[s],
|
|
4517
|
+
e && w(f) === n && (i && !n.columns?.includes(a) || (e.rules ? a[s] = e.rules : delete a[s], N(`highlight:${n.id}${i ? `:${t.index}` : r ? ":rows" : ""}`)));
|
|
4156
4518
|
});
|
|
4157
4519
|
return;
|
|
4158
4520
|
}
|
|
@@ -4160,26 +4522,26 @@ function Zi({ mount: e, layout: t, id: n = null, store: r, guardUnload: i = !0,
|
|
|
4160
4522
|
d.layout.format = {
|
|
4161
4523
|
...d.layout.format ?? {},
|
|
4162
4524
|
...m
|
|
4163
|
-
},
|
|
4525
|
+
}, N("format:report:india");
|
|
4164
4526
|
return;
|
|
4165
4527
|
case "add-group-level":
|
|
4166
4528
|
if (n?.type !== "table") return;
|
|
4167
|
-
|
|
4529
|
+
be(n) !== -1 && N(`grouping:add-level:${n.id}`);
|
|
4168
4530
|
return;
|
|
4169
4531
|
case "remove-group-level":
|
|
4170
4532
|
case "move-group-level-out": {
|
|
4171
4533
|
if (n?.type !== "table") return;
|
|
4172
4534
|
let r = Number(t?.level);
|
|
4173
|
-
(e === "remove-group-level" ?
|
|
4535
|
+
(e === "remove-group-level" ? xe(n, r) : Se(n, r)) && (d.selection = d.selection.filter((e) => M(e.band)?.table !== n.id), N(`grouping:${e}:${n.id}:${r}`));
|
|
4174
4536
|
return;
|
|
4175
4537
|
}
|
|
4176
4538
|
case "add-column":
|
|
4177
4539
|
if (n?.type !== "table") return;
|
|
4178
|
-
|
|
4540
|
+
jn(n), N(`column:add:${n.id}`);
|
|
4179
4541
|
return;
|
|
4180
4542
|
case "remove-column":
|
|
4181
4543
|
if (n?.type !== "table") return;
|
|
4182
|
-
|
|
4544
|
+
Mn(n, Number(t.index)) && N(`column:remove:${n.id}`);
|
|
4183
4545
|
return;
|
|
4184
4546
|
case "undo": {
|
|
4185
4547
|
let e = f.undo();
|
|
@@ -4191,93 +4553,93 @@ function Zi({ mount: e, layout: t, id: n = null, store: r, guardUnload: i = !0,
|
|
|
4191
4553
|
e && F(e, { dirty: !0 });
|
|
4192
4554
|
return;
|
|
4193
4555
|
}
|
|
4194
|
-
case "open": return
|
|
4195
|
-
case "save": return
|
|
4196
|
-
case "data": return
|
|
4197
|
-
case "open-window": return
|
|
4198
|
-
case "zoom-in": return
|
|
4199
|
-
case "zoom-out": return
|
|
4556
|
+
case "open": return H();
|
|
4557
|
+
case "save": return Fe();
|
|
4558
|
+
case "data": return Le();
|
|
4559
|
+
case "open-window": return Re();
|
|
4560
|
+
case "zoom-in": return ye(1);
|
|
4561
|
+
case "zoom-out": return ye(-1);
|
|
4200
4562
|
case "toggle-rulers":
|
|
4201
|
-
d.rulers = !d.rulers, D(),
|
|
4563
|
+
d.rulers = !d.rulers, D(), P();
|
|
4202
4564
|
return;
|
|
4203
|
-
case "toggle-preview": return
|
|
4565
|
+
case "toggle-preview": return ze();
|
|
4204
4566
|
}
|
|
4205
4567
|
}
|
|
4206
|
-
async function
|
|
4207
|
-
return !d.dirty ||
|
|
4568
|
+
async function Pe() {
|
|
4569
|
+
return !d.dirty || ki(o, d.layout?.name ?? "");
|
|
4208
4570
|
}
|
|
4209
|
-
async function
|
|
4210
|
-
if (!await
|
|
4571
|
+
async function H() {
|
|
4572
|
+
if (!await Pe()) return;
|
|
4211
4573
|
let e;
|
|
4212
4574
|
try {
|
|
4213
4575
|
e = await l.list();
|
|
4214
4576
|
} catch (e) {
|
|
4215
|
-
return
|
|
4577
|
+
return K(e);
|
|
4216
4578
|
}
|
|
4217
|
-
let t = await
|
|
4579
|
+
let t = await Di(o, e);
|
|
4218
4580
|
if (t) {
|
|
4219
4581
|
if (t.blank) {
|
|
4220
|
-
F(
|
|
4582
|
+
F(ot(), {
|
|
4221
4583
|
id: null,
|
|
4222
4584
|
dirty: !1
|
|
4223
|
-
}), f.reset(d.layout),
|
|
4585
|
+
}), f.reset(d.layout), P();
|
|
4224
4586
|
return;
|
|
4225
4587
|
}
|
|
4226
4588
|
try {
|
|
4227
4589
|
F(await l.load(t.id), {
|
|
4228
4590
|
id: t.id,
|
|
4229
4591
|
dirty: !1
|
|
4230
|
-
}), f.reset(d.layout),
|
|
4592
|
+
}), f.reset(d.layout), P();
|
|
4231
4593
|
} catch (e) {
|
|
4232
|
-
|
|
4594
|
+
K(e);
|
|
4233
4595
|
}
|
|
4234
4596
|
}
|
|
4235
4597
|
}
|
|
4236
|
-
async function
|
|
4598
|
+
async function Fe() {
|
|
4237
4599
|
let e = d.id;
|
|
4238
4600
|
if (!e) {
|
|
4239
|
-
let t = await
|
|
4601
|
+
let t = await Oi(o, d.layout.name ?? "");
|
|
4240
4602
|
if (!t) return;
|
|
4241
4603
|
e = t.id, d.layout.name = t.name;
|
|
4242
4604
|
}
|
|
4243
4605
|
try {
|
|
4244
|
-
await l.save(e, d.layout), d.id = e, d.dirty = !1,
|
|
4606
|
+
await l.save(e, d.layout), d.id = e, d.dirty = !1, P(), await Ie(e);
|
|
4245
4607
|
} catch (e) {
|
|
4246
|
-
|
|
4608
|
+
K(e);
|
|
4247
4609
|
}
|
|
4248
4610
|
}
|
|
4249
|
-
async function
|
|
4611
|
+
async function Ie(e) {
|
|
4250
4612
|
if (!(!l.loadData || !l.saveData)) try {
|
|
4251
|
-
let { data: t, added: n } =
|
|
4613
|
+
let { data: t, added: n } = ri(await l.loadData(e), d.layout);
|
|
4252
4614
|
n && await l.saveData(e, t);
|
|
4253
4615
|
} catch {}
|
|
4254
4616
|
}
|
|
4255
|
-
async function
|
|
4617
|
+
async function Le() {
|
|
4256
4618
|
let e = null;
|
|
4257
4619
|
if (d.id && l.loadData) try {
|
|
4258
4620
|
e = await l.loadData(d.id);
|
|
4259
4621
|
} catch (e) {
|
|
4260
|
-
return
|
|
4622
|
+
return K(e);
|
|
4261
4623
|
}
|
|
4262
|
-
let t = e == null, n = await
|
|
4624
|
+
let t = e == null, n = await Ii(o, ri(e, d.layout).data, {
|
|
4263
4625
|
id: d.id,
|
|
4264
4626
|
generated: t
|
|
4265
4627
|
});
|
|
4266
4628
|
if (n) {
|
|
4267
|
-
if (!d.id) return
|
|
4629
|
+
if (!d.id) return K(/* @__PURE__ */ Error("Save the report first - its data file is named after it."));
|
|
4268
4630
|
try {
|
|
4269
4631
|
await l.saveData(d.id, n);
|
|
4270
4632
|
} catch (e) {
|
|
4271
|
-
|
|
4633
|
+
K(e);
|
|
4272
4634
|
}
|
|
4273
4635
|
}
|
|
4274
4636
|
}
|
|
4275
|
-
function
|
|
4637
|
+
function Re() {
|
|
4276
4638
|
let e;
|
|
4277
4639
|
try {
|
|
4278
|
-
e = ce(d.layout, d.data ??
|
|
4640
|
+
e = ce(d.layout, d.data ?? ni(d.layout));
|
|
4279
4641
|
} catch (e) {
|
|
4280
|
-
|
|
4642
|
+
K(e);
|
|
4281
4643
|
return;
|
|
4282
4644
|
}
|
|
4283
4645
|
let t = ee({
|
|
@@ -4285,70 +4647,70 @@ function Zi({ mount: e, layout: t, id: n = null, store: r, guardUnload: i = !0,
|
|
|
4285
4647
|
title: d.layout?.name || "Report"
|
|
4286
4648
|
});
|
|
4287
4649
|
if (!t) {
|
|
4288
|
-
|
|
4650
|
+
G("The browser blocked the report window - allow pop-ups for this page", {
|
|
4289
4651
|
problem: !0,
|
|
4290
4652
|
ms: 6e3
|
|
4291
4653
|
});
|
|
4292
4654
|
return;
|
|
4293
4655
|
}
|
|
4294
|
-
|
|
4656
|
+
U.add(t);
|
|
4295
4657
|
}
|
|
4296
|
-
let
|
|
4297
|
-
async function
|
|
4658
|
+
let U = /* @__PURE__ */ new Set(), W = null;
|
|
4659
|
+
async function ze() {
|
|
4298
4660
|
if (d.mode === "preview") {
|
|
4299
|
-
d.mode = "design", d.data = null,
|
|
4661
|
+
d.mode = "design", d.data = null, Be();
|
|
4300
4662
|
return;
|
|
4301
4663
|
}
|
|
4302
4664
|
let e = null;
|
|
4303
4665
|
if (d.id && l.loadData) try {
|
|
4304
4666
|
e = await l.loadData(d.id);
|
|
4305
4667
|
} catch {}
|
|
4306
|
-
d.data =
|
|
4668
|
+
d.data = ri(e, d.layout).data, d.mode = "preview", d.selection = [], Be();
|
|
4307
4669
|
}
|
|
4308
|
-
function
|
|
4670
|
+
function Be() {
|
|
4309
4671
|
o.dataset.mode = d.mode;
|
|
4310
4672
|
let e = v.querySelector("[data-action=\"toggle-preview\"]"), t = d.mode === "preview";
|
|
4311
|
-
e.innerHTML = Z(t ? "design" : "preview"), e.title = t ? "Back to the design (ctrl+E)" : "Run the report (ctrl+E)", e.setAttribute("aria-label", e.title), e.setAttribute("aria-pressed", String(t)), D(),
|
|
4673
|
+
e.innerHTML = Z(t ? "design" : "preview"), e.title = t ? "Back to the design (ctrl+E)" : "Run the report (ctrl+E)", e.setAttribute("aria-label", e.title), e.setAttribute("aria-pressed", String(t)), D(), A(), P();
|
|
4312
4674
|
}
|
|
4313
|
-
function
|
|
4675
|
+
function G(e, { problem: t = !1, ms: n = 6e3 } = {}) {
|
|
4314
4676
|
let r = v.querySelector("[data-role=\"status\"]");
|
|
4315
|
-
r.textContent = e, t ? r.dataset.problem = "true" : delete r.dataset.problem, clearTimeout(
|
|
4316
|
-
delete r.dataset.problem,
|
|
4677
|
+
r.textContent = e, t ? r.dataset.problem = "true" : delete r.dataset.problem, clearTimeout(K.timer), K.timer = setTimeout(() => {
|
|
4678
|
+
delete r.dataset.problem, P();
|
|
4317
4679
|
}, n);
|
|
4318
4680
|
}
|
|
4319
|
-
function
|
|
4681
|
+
function Ve(e) {
|
|
4320
4682
|
let t = c.createElement("input");
|
|
4321
|
-
t.type = "file", t.accept =
|
|
4683
|
+
t.type = "file", t.accept = _a.join(","), t.addEventListener("change", () => {
|
|
4322
4684
|
let n = t.files?.[0];
|
|
4323
4685
|
if (!n) return;
|
|
4324
|
-
if (!
|
|
4325
|
-
|
|
4686
|
+
if (!_a.includes(n.type)) {
|
|
4687
|
+
G(`${n.name} is not a PNG, JPEG, GIF or WebP image`, { problem: !0 });
|
|
4326
4688
|
return;
|
|
4327
4689
|
}
|
|
4328
|
-
if (n.size >
|
|
4329
|
-
|
|
4690
|
+
if (n.size > va) {
|
|
4691
|
+
G(`${n.name} is ${ba(n.size)} - too large to store in a layout. Bind the image to a data field and supply its URL instead`, { problem: !0 });
|
|
4330
4692
|
return;
|
|
4331
4693
|
}
|
|
4332
4694
|
let r = new (c.defaultView ?? globalThis).FileReader();
|
|
4333
4695
|
r.addEventListener("load", () => {
|
|
4334
|
-
|
|
4335
|
-
}), r.addEventListener("error", () =>
|
|
4696
|
+
He(e) && (e.src = String(r.result), N(`image:${e.id}`), n.size > ya && G(`Stored ${n.name} (${ba(n.size)}) in the layout - every copy of the report carries it`));
|
|
4697
|
+
}), r.addEventListener("error", () => K(r.error)), r.readAsDataURL(n);
|
|
4336
4698
|
}), t.click();
|
|
4337
4699
|
}
|
|
4338
|
-
function
|
|
4339
|
-
return [...d.layout.bands ?? [], ...
|
|
4700
|
+
function He(e) {
|
|
4701
|
+
return [...d.layout.bands ?? [], ...he(d.layout).map((e) => e.band)].some((t) => (t.items ?? []).includes(e));
|
|
4340
4702
|
}
|
|
4341
|
-
function
|
|
4342
|
-
|
|
4703
|
+
function K(e) {
|
|
4704
|
+
G(e instanceof Hr ? e.message : `Something went wrong: ${e?.message ?? e}`, { problem: !0 });
|
|
4343
4705
|
}
|
|
4344
|
-
function
|
|
4345
|
-
t ?
|
|
4706
|
+
function q(e, t) {
|
|
4707
|
+
t ? cn(d.layout, e) : (ln(d.layout, e), d.selection = d.selection.filter((t) => t.band !== e)), N(`band:${e}`);
|
|
4346
4708
|
}
|
|
4347
|
-
function
|
|
4709
|
+
function Ue(e, t) {
|
|
4348
4710
|
let n = Y(d.layout, e);
|
|
4349
4711
|
if (!n) return;
|
|
4350
4712
|
let r = String(t).trim();
|
|
4351
|
-
if (!(
|
|
4713
|
+
if (!(M(e) && /%$/.test(r))) {
|
|
4352
4714
|
if (r === "") delete n.height;
|
|
4353
4715
|
else if (/^-?[\d.]+\s*%$/.test(r)) n.height = r;
|
|
4354
4716
|
else if (Number.isFinite(Number(r))) n.height = Number(r);
|
|
@@ -4356,8 +4718,8 @@ function Zi({ mount: e, layout: t, id: n = null, store: r, guardUnload: i = !0,
|
|
|
4356
4718
|
D(), j(`band-height:${e}`);
|
|
4357
4719
|
}
|
|
4358
4720
|
}
|
|
4359
|
-
function
|
|
4360
|
-
if (!
|
|
4721
|
+
function We(e, t) {
|
|
4722
|
+
if (!M(e)) return;
|
|
4361
4723
|
let n = Y(d.layout, e);
|
|
4362
4724
|
if (n) {
|
|
4363
4725
|
if (t) {
|
|
@@ -4371,78 +4733,78 @@ function Zi({ mount: e, layout: t, id: n = null, store: r, guardUnload: i = !0,
|
|
|
4371
4733
|
}
|
|
4372
4734
|
}
|
|
4373
4735
|
o.dataset.mode = d.mode, W = O(v.querySelector("[data-role=\"zoom-dropdown\"]")), W.addEventListener("change", () => {
|
|
4374
|
-
W.value === "fit" ?
|
|
4736
|
+
W.value === "fit" ? ve() : _e(Number(W.value));
|
|
4375
4737
|
});
|
|
4376
4738
|
let Ge = () => {
|
|
4377
|
-
d.fitWidth &&
|
|
4739
|
+
d.fitWidth && ve();
|
|
4378
4740
|
}, Ke = c.defaultView ?? globalThis;
|
|
4379
4741
|
Ke.addEventListener("resize", Ge);
|
|
4380
4742
|
let qe = (e) => {
|
|
4381
4743
|
d.dirty && (e.preventDefault(), e.returnValue = "");
|
|
4382
4744
|
};
|
|
4383
|
-
i && Ke.addEventListener("beforeunload", qe), D(),
|
|
4384
|
-
let Je =
|
|
4745
|
+
i && Ke.addEventListener("beforeunload", qe), D(), A(), P();
|
|
4746
|
+
let Je = Kn({
|
|
4385
4747
|
canvas: p,
|
|
4386
4748
|
getLayout: () => d.layout,
|
|
4387
4749
|
getSelection: () => d.selection,
|
|
4388
|
-
select:
|
|
4389
|
-
remove: () =>
|
|
4750
|
+
select: de,
|
|
4751
|
+
remove: () => V("delete-item"),
|
|
4390
4752
|
duplicate: () => {
|
|
4391
4753
|
let e = d.selection.map((e) => e.id).join(",");
|
|
4392
|
-
return
|
|
4754
|
+
return V("duplicate-item"), d.selection.map((e) => e.id).join(",") !== e;
|
|
4393
4755
|
},
|
|
4394
4756
|
enabled: () => d.mode === "design",
|
|
4395
4757
|
getZoom: () => d.zoom,
|
|
4396
4758
|
rulers: () => d.rulers,
|
|
4397
4759
|
onTarget: L,
|
|
4398
|
-
onGuides:
|
|
4760
|
+
onGuides: pe,
|
|
4399
4761
|
commit: ({ live: e, band: t, key: n = null }) => {
|
|
4400
4762
|
if (!e && t?.length) {
|
|
4401
4763
|
let e = !1;
|
|
4402
4764
|
d.selection = d.selection.map((t) => {
|
|
4403
|
-
let n = w(t), r = n ?
|
|
4404
|
-
return r && r !== t.band &&
|
|
4765
|
+
let n = w(t), r = n ? Yt(d.layout, t.band, n) : null;
|
|
4766
|
+
return r && r !== t.band && An(d.layout, t.band, r, t.id) ? (e = !0, {
|
|
4405
4767
|
band: r,
|
|
4406
4768
|
id: t.id
|
|
4407
4769
|
}) : t;
|
|
4408
|
-
}), e &&
|
|
4770
|
+
}), e && A();
|
|
4409
4771
|
}
|
|
4410
|
-
e ? ne() : D(),
|
|
4772
|
+
e ? ne() : D(), Mr(_, T(), d.layout), e || j(n ?? `move:${d.selection.map((e) => e.id).join(",")}`);
|
|
4411
4773
|
}
|
|
4412
|
-
}), Ye =
|
|
4774
|
+
}), Ye = jr({
|
|
4413
4775
|
panel: _,
|
|
4414
4776
|
getTarget: () => {
|
|
4415
4777
|
let e = T();
|
|
4416
4778
|
return e ? {
|
|
4417
4779
|
target: e,
|
|
4418
|
-
fields:
|
|
4780
|
+
fields: $e(e)
|
|
4419
4781
|
} : {
|
|
4420
4782
|
target: d.layout,
|
|
4421
|
-
fields:
|
|
4783
|
+
fields: Qe(d.layout)
|
|
4422
4784
|
};
|
|
4423
4785
|
},
|
|
4424
4786
|
getItem: T,
|
|
4425
4787
|
changed: (e, { rebuild: t = !1 } = {}) => {
|
|
4426
|
-
D(), t
|
|
4788
|
+
D(), t ? Xe() : Mr(_, T(), d.layout), j(e);
|
|
4427
4789
|
},
|
|
4428
|
-
act:
|
|
4429
|
-
toggleBand:
|
|
4430
|
-
setBandHeight:
|
|
4431
|
-
setBandFill:
|
|
4790
|
+
act: V,
|
|
4791
|
+
toggleBand: q,
|
|
4792
|
+
setBandHeight: Ue,
|
|
4793
|
+
setBandFill: We
|
|
4432
4794
|
});
|
|
4433
4795
|
function Xe() {
|
|
4434
4796
|
let e = c.activeElement, t = _.contains(e) ? e?.dataset?.field : null, n = t && typeof e.selectionStart == "number" ? [e.selectionStart, e.selectionEnd] : null;
|
|
4435
|
-
if (
|
|
4436
|
-
let r = _.querySelector(`[data-field="${
|
|
4797
|
+
if (A(), !t) return;
|
|
4798
|
+
let r = _.querySelector(`[data-field="${Ea(t)}"]:not([data-column])`);
|
|
4437
4799
|
if (r && (r.focus(), n && typeof r.setSelectionRange == "function")) try {
|
|
4438
4800
|
r.setSelectionRange(...n);
|
|
4439
4801
|
} catch {}
|
|
4440
4802
|
}
|
|
4441
4803
|
function J(e) {
|
|
4442
4804
|
let t = e.target.closest?.("[data-action]");
|
|
4443
|
-
t && (e.preventDefault(),
|
|
4805
|
+
t && (e.preventDefault(), V(t.dataset.action, t.dataset));
|
|
4444
4806
|
}
|
|
4445
|
-
function
|
|
4807
|
+
function Ze(e) {
|
|
4446
4808
|
return o.contains(e.target) ? !0 : e.target === c.body || e.target === c.documentElement;
|
|
4447
4809
|
}
|
|
4448
4810
|
function et(e) {
|
|
@@ -4450,56 +4812,56 @@ function Zi({ mount: e, layout: t, id: n = null, store: r, guardUnload: i = !0,
|
|
|
4450
4812
|
t && t !== o || o.focus({ preventScroll: !0 });
|
|
4451
4813
|
}
|
|
4452
4814
|
function tt(e) {
|
|
4453
|
-
if (
|
|
4815
|
+
if (!Ze(e)) return;
|
|
4454
4816
|
let t = e.key.toLowerCase();
|
|
4455
4817
|
if (t === "z" && !e.ctrlKey && !e.metaKey) {
|
|
4456
4818
|
if (e.target.closest?.("input, textarea, select")) return;
|
|
4457
|
-
e.preventDefault(),
|
|
4819
|
+
e.preventDefault(), ye(e.altKey ? -1 : 1);
|
|
4458
4820
|
return;
|
|
4459
4821
|
}
|
|
4460
4822
|
if (e.ctrlKey || e.metaKey) {
|
|
4461
4823
|
if (t === "c" || t === "v") {
|
|
4462
4824
|
if (e.target.closest?.("input, textarea, select") || t === "c" && String(globalThis.getSelection?.() ?? "")) return;
|
|
4463
|
-
e.preventDefault(),
|
|
4825
|
+
e.preventDefault(), V(t === "c" ? "copy-items" : "paste-items");
|
|
4464
4826
|
return;
|
|
4465
4827
|
}
|
|
4466
4828
|
if (t === "s") {
|
|
4467
|
-
e.preventDefault(),
|
|
4829
|
+
e.preventDefault(), V("save");
|
|
4468
4830
|
return;
|
|
4469
4831
|
}
|
|
4470
4832
|
if (t === "o") {
|
|
4471
|
-
e.preventDefault(),
|
|
4833
|
+
e.preventDefault(), V("open");
|
|
4472
4834
|
return;
|
|
4473
4835
|
}
|
|
4474
4836
|
if (t === "e") {
|
|
4475
|
-
e.preventDefault(),
|
|
4837
|
+
e.preventDefault(), V("toggle-preview");
|
|
4476
4838
|
return;
|
|
4477
4839
|
}
|
|
4478
4840
|
if (t === "0") {
|
|
4479
|
-
e.preventDefault(),
|
|
4841
|
+
e.preventDefault(), _e(1);
|
|
4480
4842
|
return;
|
|
4481
4843
|
}
|
|
4482
4844
|
if (t === "z") {
|
|
4483
|
-
e.preventDefault(),
|
|
4845
|
+
e.preventDefault(), V(e.shiftKey || e.altKey ? "redo" : "undo");
|
|
4484
4846
|
return;
|
|
4485
4847
|
}
|
|
4486
4848
|
if (t === "y") {
|
|
4487
|
-
e.preventDefault(),
|
|
4849
|
+
e.preventDefault(), V("redo");
|
|
4488
4850
|
return;
|
|
4489
4851
|
}
|
|
4490
|
-
t === "d" && (e.preventDefault(),
|
|
4852
|
+
t === "d" && (e.preventDefault(), V("duplicate-item"));
|
|
4491
4853
|
}
|
|
4492
4854
|
}
|
|
4493
|
-
return v.addEventListener("click", J), y.addEventListener("click", J), x.addEventListener("click", J), o.addEventListener("pointerdown", et), c.addEventListener("keydown", tt), p.addEventListener("contextmenu",
|
|
4855
|
+
return v.addEventListener("click", J), y.addEventListener("click", J), x.addEventListener("click", J), o.addEventListener("pointerdown", et), c.addEventListener("keydown", tt), p.addEventListener("contextmenu", Ee), p.addEventListener("scroll", B), c.addEventListener("pointerdown", Me), c.addEventListener("keydown", Ne), {
|
|
4494
4856
|
get layout() {
|
|
4495
4857
|
return d.layout;
|
|
4496
4858
|
},
|
|
4497
4859
|
get mode() {
|
|
4498
4860
|
return d.mode;
|
|
4499
4861
|
},
|
|
4500
|
-
togglePreview:
|
|
4862
|
+
togglePreview: ze,
|
|
4501
4863
|
get sampleData() {
|
|
4502
|
-
return
|
|
4864
|
+
return ni(d.layout);
|
|
4503
4865
|
},
|
|
4504
4866
|
get selection() {
|
|
4505
4867
|
return C();
|
|
@@ -4507,7 +4869,7 @@ function Zi({ mount: e, layout: t, id: n = null, store: r, guardUnload: i = !0,
|
|
|
4507
4869
|
get selections() {
|
|
4508
4870
|
return [...d.selection];
|
|
4509
4871
|
},
|
|
4510
|
-
select:
|
|
4872
|
+
select: de,
|
|
4511
4873
|
get id() {
|
|
4512
4874
|
return d.id;
|
|
4513
4875
|
},
|
|
@@ -4515,28 +4877,28 @@ function Zi({ mount: e, layout: t, id: n = null, store: r, guardUnload: i = !0,
|
|
|
4515
4877
|
return d.dirty;
|
|
4516
4878
|
},
|
|
4517
4879
|
open(e, t = null) {
|
|
4518
|
-
return F(
|
|
4880
|
+
return F(st(e) ? ot() : e, {
|
|
4519
4881
|
id: t,
|
|
4520
4882
|
dirty: !1
|
|
4521
|
-
}), f.reset(d.layout),
|
|
4883
|
+
}), f.reset(d.layout), P(), s(d.layout);
|
|
4522
4884
|
},
|
|
4523
|
-
save:
|
|
4885
|
+
save: Fe,
|
|
4524
4886
|
redraw: D,
|
|
4525
4887
|
destroy() {
|
|
4526
|
-
Je(), Ye(), v.removeEventListener("click", J), y.removeEventListener("click", J), x.removeEventListener("click", J), o.removeEventListener("pointerdown", et), c.removeEventListener("keydown", tt), p.removeEventListener("contextmenu",
|
|
4527
|
-
for (let e of
|
|
4528
|
-
|
|
4888
|
+
Je(), Ye(), v.removeEventListener("click", J), y.removeEventListener("click", J), x.removeEventListener("click", J), o.removeEventListener("pointerdown", et), c.removeEventListener("keydown", tt), p.removeEventListener("contextmenu", Ee), p.removeEventListener("scroll", B), c.removeEventListener("pointerdown", Me), c.removeEventListener("keydown", Ne), (c.defaultView ?? globalThis).removeEventListener("resize", Ge), Ke.removeEventListener("beforeunload", qe), W?.destroy(), B(), clearTimeout(K.timer), clearTimeout(R.timer);
|
|
4889
|
+
for (let e of U) e.destroy();
|
|
4890
|
+
U.clear(), o.innerHTML = "", o.classList.remove("report-designer");
|
|
4529
4891
|
}
|
|
4530
4892
|
};
|
|
4531
4893
|
}
|
|
4532
|
-
function
|
|
4894
|
+
function Ta(e) {
|
|
4533
4895
|
let t = e.page ? `${e.page.width} × ${e.page.height}` : "";
|
|
4534
4896
|
return `
|
|
4535
4897
|
<header class="dz-bar" data-role="bar">
|
|
4536
4898
|
<span class="dz-brand">Report Studio</span>
|
|
4537
4899
|
|
|
4538
4900
|
<span class="dz-title">
|
|
4539
|
-
<span class="dz-name" data-role="name">${
|
|
4901
|
+
<span class="dz-name" data-role="name">${Da(e.name ?? "")}</span>
|
|
4540
4902
|
<span class="dz-status" data-role="status">Not saved yet</span>
|
|
4541
4903
|
</span>
|
|
4542
4904
|
|
|
@@ -4679,12 +5041,12 @@ function Qi(e) {
|
|
|
4679
5041
|
<aside class="dz-panel" data-role="panel" aria-label="Properties"></aside>
|
|
4680
5042
|
</div>`;
|
|
4681
5043
|
}
|
|
4682
|
-
function
|
|
5044
|
+
function Ea(e) {
|
|
4683
5045
|
let t = String(e);
|
|
4684
5046
|
return globalThis.CSS?.escape ? CSS.escape(t) : JSON.stringify(t).slice(1, -1);
|
|
4685
5047
|
}
|
|
4686
|
-
function
|
|
5048
|
+
function Da(e) {
|
|
4687
5049
|
return e == null ? "" : String(e).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
4688
5050
|
}
|
|
4689
5051
|
//#endregion
|
|
4690
|
-
export {
|
|
5052
|
+
export { Ca as n, wa as t };
|