@superdoc-dev/template-builder 0.4.0 → 1.0.0-next.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/LICENSE +661 -0
- package/README.md +24 -26
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +338 -324
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { jsxs as o, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { useState as I, useEffect as oe, useMemo as
|
|
3
|
-
const
|
|
2
|
+
import { useState as I, useEffect as oe, useMemo as pe, forwardRef as Be, useRef as J, useCallback as T, useImperativeHandle as We } from "react";
|
|
3
|
+
const He = ({
|
|
4
4
|
isVisible: n,
|
|
5
|
-
position:
|
|
6
|
-
availableFields:
|
|
7
|
-
filteredFields:
|
|
8
|
-
filterQuery:
|
|
9
|
-
allowCreate:
|
|
10
|
-
onSelect:
|
|
5
|
+
position: l,
|
|
6
|
+
availableFields: f,
|
|
7
|
+
filteredFields: s,
|
|
8
|
+
filterQuery: c,
|
|
9
|
+
allowCreate: d,
|
|
10
|
+
onSelect: z,
|
|
11
11
|
onClose: P,
|
|
12
|
-
onCreateField:
|
|
13
|
-
existingFields:
|
|
14
|
-
onSelectExisting:
|
|
12
|
+
onCreateField: O,
|
|
13
|
+
existingFields: p = [],
|
|
14
|
+
onSelectExisting: E
|
|
15
15
|
}) => {
|
|
16
|
-
const [m, y] = I(!1), [w, R] = I(""), [
|
|
16
|
+
const [m, y] = I(!1), [w, R] = I(""), [U, A] = I("inline"), [X, ie] = I(!0), [u, B] = I(!0);
|
|
17
17
|
oe(() => {
|
|
18
18
|
n || (y(!1), R(""), A("inline"));
|
|
19
19
|
}, [n]);
|
|
20
|
-
const V =
|
|
20
|
+
const V = pe(() => ({
|
|
21
21
|
position: "absolute",
|
|
22
|
-
left:
|
|
23
|
-
top:
|
|
22
|
+
left: l?.left,
|
|
23
|
+
top: l?.top,
|
|
24
24
|
zIndex: 1e3,
|
|
25
25
|
background: "white",
|
|
26
26
|
border: "1px solid #ddd",
|
|
@@ -28,24 +28,24 @@ const We = ({
|
|
|
28
28
|
boxShadow: "0 2px 8px rgba(0,0,0,0.1)",
|
|
29
29
|
padding: "8px 0",
|
|
30
30
|
width: "280px"
|
|
31
|
-
}), [
|
|
31
|
+
}), [l]), _ = s ?? f, j = !!c;
|
|
32
32
|
if (oe(() => {
|
|
33
|
-
j &&
|
|
33
|
+
j && B(!0);
|
|
34
34
|
}, [j]), !n) return null;
|
|
35
35
|
const D = async () => {
|
|
36
|
-
const
|
|
37
|
-
if (!
|
|
38
|
-
const
|
|
36
|
+
const h = w.trim();
|
|
37
|
+
if (!h) return;
|
|
38
|
+
const W = {
|
|
39
39
|
id: `custom_${Date.now()}`,
|
|
40
|
-
label:
|
|
41
|
-
|
|
40
|
+
label: h,
|
|
41
|
+
mode: U
|
|
42
42
|
};
|
|
43
43
|
try {
|
|
44
|
-
if (
|
|
45
|
-
const
|
|
46
|
-
|
|
44
|
+
if (O) {
|
|
45
|
+
const b = await O(W);
|
|
46
|
+
z(b || W);
|
|
47
47
|
} else
|
|
48
|
-
|
|
48
|
+
z(W);
|
|
49
49
|
} finally {
|
|
50
50
|
y(!1), R(""), A("inline");
|
|
51
51
|
}
|
|
@@ -61,11 +61,11 @@ const We = ({
|
|
|
61
61
|
},
|
|
62
62
|
children: /* @__PURE__ */ o("div", { style: { fontSize: "12px", color: "#6b7280" }, children: [
|
|
63
63
|
"Filtering results for",
|
|
64
|
-
/* @__PURE__ */ r("span", { style: { fontWeight: 600, color: "#111827", marginLeft: "4px" }, children:
|
|
64
|
+
/* @__PURE__ */ r("span", { style: { fontWeight: 600, color: "#111827", marginLeft: "4px" }, children: c })
|
|
65
65
|
] })
|
|
66
66
|
}
|
|
67
67
|
),
|
|
68
|
-
|
|
68
|
+
d && !m && /* @__PURE__ */ r(
|
|
69
69
|
"div",
|
|
70
70
|
{
|
|
71
71
|
className: "field-menu-item",
|
|
@@ -79,16 +79,16 @@ const We = ({
|
|
|
79
79
|
children: "+ Create New Field"
|
|
80
80
|
}
|
|
81
81
|
),
|
|
82
|
-
|
|
82
|
+
d && m && /* @__PURE__ */ o("div", { style: { padding: "8px 16px" }, children: [
|
|
83
83
|
/* @__PURE__ */ r(
|
|
84
84
|
"input",
|
|
85
85
|
{
|
|
86
86
|
type: "text",
|
|
87
87
|
value: w,
|
|
88
88
|
placeholder: "Field name...",
|
|
89
|
-
onChange: (
|
|
90
|
-
onKeyDown: (
|
|
91
|
-
|
|
89
|
+
onChange: (h) => R(h.target.value),
|
|
90
|
+
onKeyDown: (h) => {
|
|
91
|
+
h.key === "Enter" && D(), h.key === "Escape" && (y(!1), R(""), A("inline"));
|
|
92
92
|
},
|
|
93
93
|
autoFocus: !0,
|
|
94
94
|
style: {
|
|
@@ -124,7 +124,7 @@ const We = ({
|
|
|
124
124
|
{
|
|
125
125
|
type: "radio",
|
|
126
126
|
value: "inline",
|
|
127
|
-
checked:
|
|
127
|
+
checked: U === "inline",
|
|
128
128
|
onChange: () => A("inline")
|
|
129
129
|
}
|
|
130
130
|
),
|
|
@@ -147,7 +147,7 @@ const We = ({
|
|
|
147
147
|
{
|
|
148
148
|
type: "radio",
|
|
149
149
|
value: "block",
|
|
150
|
-
checked:
|
|
150
|
+
checked: U === "block",
|
|
151
151
|
onChange: () => A("block")
|
|
152
152
|
}
|
|
153
153
|
),
|
|
@@ -203,7 +203,7 @@ const We = ({
|
|
|
203
203
|
}
|
|
204
204
|
)
|
|
205
205
|
] }),
|
|
206
|
-
|
|
206
|
+
d && f.length > 0 && /* @__PURE__ */ r(
|
|
207
207
|
"div",
|
|
208
208
|
{
|
|
209
209
|
style: {
|
|
@@ -212,15 +212,15 @@ const We = ({
|
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
),
|
|
215
|
-
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
const Y =
|
|
219
|
-
ee.push(
|
|
215
|
+
p.length > 0 && (() => {
|
|
216
|
+
const h = /* @__PURE__ */ new Map();
|
|
217
|
+
p.forEach((b) => {
|
|
218
|
+
const Y = b.group || `individual-${b.id}`, ee = h.get(Y) || [];
|
|
219
|
+
ee.push(b), h.set(Y, ee);
|
|
220
220
|
});
|
|
221
|
-
const
|
|
222
|
-
...
|
|
223
|
-
count:
|
|
221
|
+
const W = Array.from(h.values()).map((b) => ({
|
|
222
|
+
...b[0],
|
|
223
|
+
count: b.length
|
|
224
224
|
}));
|
|
225
225
|
return /* @__PURE__ */ o("div", { style: { borderBottom: "1px solid #f0f0f0" }, children: [
|
|
226
226
|
/* @__PURE__ */ o(
|
|
@@ -245,7 +245,7 @@ const We = ({
|
|
|
245
245
|
children: [
|
|
246
246
|
/* @__PURE__ */ o("span", { children: [
|
|
247
247
|
"Existing Fields (",
|
|
248
|
-
|
|
248
|
+
W.length,
|
|
249
249
|
")"
|
|
250
250
|
] }),
|
|
251
251
|
/* @__PURE__ */ r(
|
|
@@ -266,11 +266,11 @@ const We = ({
|
|
|
266
266
|
]
|
|
267
267
|
}
|
|
268
268
|
),
|
|
269
|
-
X && /* @__PURE__ */ r("div", { style: { maxHeight: "300px", overflowY: "auto" }, children:
|
|
269
|
+
X && /* @__PURE__ */ r("div", { style: { maxHeight: "300px", overflowY: "auto" }, children: W.map((b) => /* @__PURE__ */ o(
|
|
270
270
|
"div",
|
|
271
271
|
{
|
|
272
272
|
className: "field-menu-item",
|
|
273
|
-
onClick: () =>
|
|
273
|
+
onClick: () => E?.(b),
|
|
274
274
|
style: {
|
|
275
275
|
padding: "8px 16px",
|
|
276
276
|
cursor: "pointer",
|
|
@@ -281,7 +281,7 @@ const We = ({
|
|
|
281
281
|
},
|
|
282
282
|
children: [
|
|
283
283
|
/* @__PURE__ */ o("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
284
|
-
/* @__PURE__ */ r("div", { style: { fontWeight: 500, fontSize: "13px" }, children:
|
|
284
|
+
/* @__PURE__ */ r("div", { style: { fontWeight: 500, fontSize: "13px" }, children: b.alias || b.id }),
|
|
285
285
|
/* @__PURE__ */ r(
|
|
286
286
|
"div",
|
|
287
287
|
{
|
|
@@ -290,7 +290,7 @@ const We = ({
|
|
|
290
290
|
color: "#9ca3af",
|
|
291
291
|
marginTop: "2px"
|
|
292
292
|
},
|
|
293
|
-
children:
|
|
293
|
+
children: b.group ? `group (${b.count} fields)` : `ID: ${b.id}`
|
|
294
294
|
}
|
|
295
295
|
)
|
|
296
296
|
] }),
|
|
@@ -306,16 +306,16 @@ const We = ({
|
|
|
306
306
|
textTransform: "capitalize",
|
|
307
307
|
flexShrink: 0
|
|
308
308
|
},
|
|
309
|
-
children:
|
|
309
|
+
children: b.mode || "inline"
|
|
310
310
|
}
|
|
311
311
|
)
|
|
312
312
|
]
|
|
313
313
|
},
|
|
314
|
-
|
|
314
|
+
b.group || b.id
|
|
315
315
|
)) })
|
|
316
316
|
] });
|
|
317
317
|
})(),
|
|
318
|
-
|
|
318
|
+
_.length === 0 ? /* @__PURE__ */ r(
|
|
319
319
|
"div",
|
|
320
320
|
{
|
|
321
321
|
style: {
|
|
@@ -331,7 +331,7 @@ const We = ({
|
|
|
331
331
|
"button",
|
|
332
332
|
{
|
|
333
333
|
type: "button",
|
|
334
|
-
onClick: () =>
|
|
334
|
+
onClick: () => B(!u),
|
|
335
335
|
style: {
|
|
336
336
|
width: "100%",
|
|
337
337
|
display: "flex",
|
|
@@ -349,7 +349,7 @@ const We = ({
|
|
|
349
349
|
children: [
|
|
350
350
|
/* @__PURE__ */ o("span", { children: [
|
|
351
351
|
"Available Fields (",
|
|
352
|
-
|
|
352
|
+
_.length,
|
|
353
353
|
")"
|
|
354
354
|
] }),
|
|
355
355
|
/* @__PURE__ */ r(
|
|
@@ -362,7 +362,7 @@ const We = ({
|
|
|
362
362
|
height: "8px",
|
|
363
363
|
borderRight: "2px solid #666",
|
|
364
364
|
borderBottom: "2px solid #666",
|
|
365
|
-
transform:
|
|
365
|
+
transform: u ? "rotate(45deg)" : "rotate(-45deg)",
|
|
366
366
|
transition: "transform 0.2s ease"
|
|
367
367
|
}
|
|
368
368
|
}
|
|
@@ -370,11 +370,11 @@ const We = ({
|
|
|
370
370
|
]
|
|
371
371
|
}
|
|
372
372
|
),
|
|
373
|
-
|
|
373
|
+
u && /* @__PURE__ */ r("div", { style: { maxHeight: "300px", overflowY: "auto" }, children: _.map((h) => /* @__PURE__ */ o(
|
|
374
374
|
"div",
|
|
375
375
|
{
|
|
376
376
|
className: "field-menu-item",
|
|
377
|
-
onClick: () =>
|
|
377
|
+
onClick: () => z(h),
|
|
378
378
|
style: {
|
|
379
379
|
padding: "8px 16px",
|
|
380
380
|
cursor: "pointer",
|
|
@@ -385,7 +385,7 @@ const We = ({
|
|
|
385
385
|
},
|
|
386
386
|
children: [
|
|
387
387
|
/* @__PURE__ */ o("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
388
|
-
/* @__PURE__ */ r("div", { style: { fontWeight: 500, fontSize: "13px" }, children:
|
|
388
|
+
/* @__PURE__ */ r("div", { style: { fontWeight: 500, fontSize: "13px" }, children: h.label || h.id }),
|
|
389
389
|
/* @__PURE__ */ o(
|
|
390
390
|
"div",
|
|
391
391
|
{
|
|
@@ -396,7 +396,7 @@ const We = ({
|
|
|
396
396
|
},
|
|
397
397
|
children: [
|
|
398
398
|
"ID: ",
|
|
399
|
-
|
|
399
|
+
h.id
|
|
400
400
|
]
|
|
401
401
|
}
|
|
402
402
|
)
|
|
@@ -413,12 +413,12 @@ const We = ({
|
|
|
413
413
|
textTransform: "capitalize",
|
|
414
414
|
flexShrink: 0
|
|
415
415
|
},
|
|
416
|
-
children:
|
|
416
|
+
children: h.mode || "inline"
|
|
417
417
|
}
|
|
418
418
|
)
|
|
419
419
|
]
|
|
420
420
|
},
|
|
421
|
-
|
|
421
|
+
h.id
|
|
422
422
|
)) })
|
|
423
423
|
] }),
|
|
424
424
|
/* @__PURE__ */ r(
|
|
@@ -446,36 +446,36 @@ const We = ({
|
|
|
446
446
|
}
|
|
447
447
|
)
|
|
448
448
|
] });
|
|
449
|
-
},
|
|
450
|
-
const
|
|
451
|
-
return
|
|
452
|
-
},
|
|
449
|
+
}, Le = (n) => {
|
|
450
|
+
const l = n.split("-");
|
|
451
|
+
return l.length > 2 ? l[l.length - 1].substring(0, 6) : n.substring(0, 6);
|
|
452
|
+
}, ve = ({ field: n, onSelect: l, onDelete: f, isSelected: s, isGrouped: c = !1 }) => /* @__PURE__ */ o(
|
|
453
453
|
"div",
|
|
454
454
|
{
|
|
455
|
-
onClick: () =>
|
|
455
|
+
onClick: () => l(n),
|
|
456
456
|
style: {
|
|
457
457
|
position: "relative",
|
|
458
458
|
padding: "10px 12px",
|
|
459
|
-
background:
|
|
460
|
-
border:
|
|
459
|
+
background: s ? "#eff6ff" : "#f9fafb",
|
|
460
|
+
border: s ? "1px solid #3b82f6" : "1px solid #e5e7eb",
|
|
461
461
|
borderRadius: "6px",
|
|
462
462
|
cursor: "pointer",
|
|
463
463
|
transition: "all 0.2s",
|
|
464
|
-
fontSize:
|
|
464
|
+
fontSize: c ? "13px" : "14px"
|
|
465
465
|
},
|
|
466
|
-
onMouseEnter: (
|
|
467
|
-
|
|
466
|
+
onMouseEnter: (d) => {
|
|
467
|
+
s || (d.currentTarget.style.background = "#f3f4f6");
|
|
468
468
|
},
|
|
469
|
-
onMouseLeave: (
|
|
470
|
-
|
|
469
|
+
onMouseLeave: (d) => {
|
|
470
|
+
s || (d.currentTarget.style.background = "#f9fafb");
|
|
471
471
|
},
|
|
472
472
|
title: n.alias,
|
|
473
473
|
children: [
|
|
474
474
|
/* @__PURE__ */ r(
|
|
475
475
|
"button",
|
|
476
476
|
{
|
|
477
|
-
onClick: (
|
|
478
|
-
|
|
477
|
+
onClick: (d) => {
|
|
478
|
+
d.stopPropagation(), f(n.id);
|
|
479
479
|
},
|
|
480
480
|
style: {
|
|
481
481
|
position: "absolute",
|
|
@@ -491,11 +491,11 @@ const We = ({
|
|
|
491
491
|
alignItems: "center",
|
|
492
492
|
justifyContent: "center"
|
|
493
493
|
},
|
|
494
|
-
onMouseEnter: (
|
|
495
|
-
|
|
494
|
+
onMouseEnter: (d) => {
|
|
495
|
+
d.currentTarget.style.color = "#ef4444";
|
|
496
496
|
},
|
|
497
|
-
onMouseLeave: (
|
|
498
|
-
|
|
497
|
+
onMouseLeave: (d) => {
|
|
498
|
+
d.currentTarget.style.color = "#9ca3af";
|
|
499
499
|
},
|
|
500
500
|
title: "Delete field",
|
|
501
501
|
children: /* @__PURE__ */ r(
|
|
@@ -526,8 +526,8 @@ const We = ({
|
|
|
526
526
|
{
|
|
527
527
|
style: {
|
|
528
528
|
fontWeight: "500",
|
|
529
|
-
fontSize:
|
|
530
|
-
color:
|
|
529
|
+
fontSize: c ? "12px" : "14px",
|
|
530
|
+
color: c ? "#6b7280" : "#111827"
|
|
531
531
|
},
|
|
532
532
|
children: n.alias || n.id
|
|
533
533
|
}
|
|
@@ -568,21 +568,21 @@ const We = ({
|
|
|
568
568
|
] })
|
|
569
569
|
]
|
|
570
570
|
}
|
|
571
|
-
),
|
|
571
|
+
), Pe = ({
|
|
572
572
|
fields: n,
|
|
573
|
-
onSelect:
|
|
574
|
-
onDelete:
|
|
575
|
-
selectedFieldId:
|
|
573
|
+
onSelect: l,
|
|
574
|
+
onDelete: f,
|
|
575
|
+
selectedFieldId: s
|
|
576
576
|
}) => {
|
|
577
|
-
const [
|
|
578
|
-
const
|
|
577
|
+
const [c, d] = I(/* @__PURE__ */ new Set()), { groupedFields: z, ungroupedFields: P } = pe(() => {
|
|
578
|
+
const p = {}, E = [];
|
|
579
579
|
return n.forEach((m) => {
|
|
580
|
-
m.group ? (
|
|
581
|
-
}), { groupedFields:
|
|
582
|
-
}, [n]),
|
|
583
|
-
|
|
584
|
-
const m = new Set(
|
|
585
|
-
return m.has(
|
|
580
|
+
m.group ? (p[m.group] || (p[m.group] = []), p[m.group].push(m)) : E.push(m);
|
|
581
|
+
}), { groupedFields: p, ungroupedFields: E };
|
|
582
|
+
}, [n]), O = (p) => {
|
|
583
|
+
d((E) => {
|
|
584
|
+
const m = new Set(E);
|
|
585
|
+
return m.has(p) ? m.delete(p) : m.add(p), m;
|
|
586
586
|
});
|
|
587
587
|
};
|
|
588
588
|
return /* @__PURE__ */ o(
|
|
@@ -618,18 +618,18 @@ const We = ({
|
|
|
618
618
|
]
|
|
619
619
|
}
|
|
620
620
|
) : /* @__PURE__ */ o("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
|
|
621
|
-
P.map((
|
|
622
|
-
|
|
621
|
+
P.map((p) => /* @__PURE__ */ r(
|
|
622
|
+
ve,
|
|
623
623
|
{
|
|
624
|
-
field:
|
|
625
|
-
onSelect:
|
|
626
|
-
onDelete:
|
|
627
|
-
isSelected:
|
|
624
|
+
field: p,
|
|
625
|
+
onSelect: l,
|
|
626
|
+
onDelete: f,
|
|
627
|
+
isSelected: s === p.id
|
|
628
628
|
},
|
|
629
|
-
|
|
629
|
+
p.id
|
|
630
630
|
)),
|
|
631
|
-
Object.entries(
|
|
632
|
-
const m =
|
|
631
|
+
Object.entries(z).map(([p, E]) => {
|
|
632
|
+
const m = c.has(p), y = E[0];
|
|
633
633
|
return /* @__PURE__ */ o("div", { children: [
|
|
634
634
|
/* @__PURE__ */ r(
|
|
635
635
|
"div",
|
|
@@ -643,7 +643,7 @@ const We = ({
|
|
|
643
643
|
cursor: "pointer",
|
|
644
644
|
transition: "all 0.2s"
|
|
645
645
|
},
|
|
646
|
-
onClick: () =>
|
|
646
|
+
onClick: () => O(p),
|
|
647
647
|
onMouseEnter: (w) => {
|
|
648
648
|
w.currentTarget.style.background = "#f3f4f6";
|
|
649
649
|
},
|
|
@@ -664,9 +664,9 @@ const We = ({
|
|
|
664
664
|
},
|
|
665
665
|
children: [
|
|
666
666
|
"group: ",
|
|
667
|
-
|
|
667
|
+
Le(p),
|
|
668
668
|
" (",
|
|
669
|
-
|
|
669
|
+
E.length,
|
|
670
670
|
" fields)"
|
|
671
671
|
]
|
|
672
672
|
}
|
|
@@ -685,47 +685,47 @@ const We = ({
|
|
|
685
685
|
flexDirection: "column",
|
|
686
686
|
gap: "4px"
|
|
687
687
|
},
|
|
688
|
-
children:
|
|
689
|
-
|
|
688
|
+
children: E.map((w) => /* @__PURE__ */ r(
|
|
689
|
+
ve,
|
|
690
690
|
{
|
|
691
691
|
field: w,
|
|
692
|
-
onSelect:
|
|
693
|
-
onDelete:
|
|
694
|
-
isSelected:
|
|
692
|
+
onSelect: l,
|
|
693
|
+
onDelete: f,
|
|
694
|
+
isSelected: s === w.id,
|
|
695
695
|
isGrouped: !0
|
|
696
696
|
},
|
|
697
697
|
w.id
|
|
698
698
|
))
|
|
699
699
|
}
|
|
700
700
|
)
|
|
701
|
-
] },
|
|
701
|
+
] }, p);
|
|
702
702
|
})
|
|
703
703
|
] })
|
|
704
704
|
]
|
|
705
705
|
}
|
|
706
706
|
);
|
|
707
707
|
}, Q = (n) => {
|
|
708
|
-
const
|
|
709
|
-
return
|
|
710
|
-
const
|
|
708
|
+
const l = n.helpers?.structuredContentCommands;
|
|
709
|
+
return l?.getStructuredContentTags ? (l.getStructuredContentTags(n.state) || []).map((s) => {
|
|
710
|
+
const c = s?.node ?? s, d = c?.attrs ?? {}, P = (c?.type?.name || "").includes("Block") ? "block" : "inline";
|
|
711
711
|
return {
|
|
712
|
-
id:
|
|
713
|
-
alias:
|
|
714
|
-
tag:
|
|
712
|
+
id: d.id,
|
|
713
|
+
alias: d.alias || d.label || "",
|
|
714
|
+
tag: d.tag,
|
|
715
715
|
mode: P,
|
|
716
|
-
group:
|
|
716
|
+
group: l.getGroup?.(d.tag) ?? void 0
|
|
717
717
|
};
|
|
718
718
|
}) : [];
|
|
719
|
-
},
|
|
720
|
-
if (n ===
|
|
721
|
-
if (n.length !==
|
|
722
|
-
for (let
|
|
723
|
-
const
|
|
724
|
-
if (!
|
|
719
|
+
}, Ce = (n, l) => {
|
|
720
|
+
if (n === l) return !0;
|
|
721
|
+
if (n.length !== l.length) return !1;
|
|
722
|
+
for (let f = 0; f < n.length; f += 1) {
|
|
723
|
+
const s = n[f], c = l[f];
|
|
724
|
+
if (!c || s.id !== c.id || s.alias !== c.alias || s.tag !== c.tag || s.position !== c.position || s.mode !== c.mode || s.group !== c.group)
|
|
725
725
|
return !1;
|
|
726
726
|
}
|
|
727
727
|
return !0;
|
|
728
|
-
},
|
|
728
|
+
}, Ae = (n) => {
|
|
729
729
|
if (!n) return null;
|
|
730
730
|
if (n === !0)
|
|
731
731
|
return {
|
|
@@ -739,64 +739,64 @@ const We = ({
|
|
|
739
739
|
config: {},
|
|
740
740
|
renderDefaultContainer: !1
|
|
741
741
|
};
|
|
742
|
-
const { selector:
|
|
742
|
+
const { selector: l, ...f } = n;
|
|
743
743
|
return {
|
|
744
|
-
selector:
|
|
745
|
-
config:
|
|
746
|
-
renderDefaultContainer:
|
|
744
|
+
selector: l || "#superdoc-toolbar",
|
|
745
|
+
config: f,
|
|
746
|
+
renderDefaultContainer: l === void 0
|
|
747
747
|
};
|
|
748
|
-
}, re = 10,
|
|
749
|
-
const
|
|
748
|
+
}, re = 10, Ve = 250, je = 300, Fe = (n) => {
|
|
749
|
+
const l = window.innerWidth - Ve - re, f = window.innerHeight - je - re, s = Math.min(n.left, l), c = Math.min(n.top, f);
|
|
750
750
|
return new DOMRect(
|
|
751
|
-
Math.max(
|
|
752
|
-
Math.max(
|
|
751
|
+
Math.max(s, re),
|
|
752
|
+
Math.max(c, re),
|
|
753
753
|
n.width,
|
|
754
754
|
n.height
|
|
755
755
|
);
|
|
756
|
-
},
|
|
756
|
+
}, Ge = Be((n, l) => {
|
|
757
757
|
const {
|
|
758
|
-
document:
|
|
759
|
-
fields:
|
|
760
|
-
menu:
|
|
761
|
-
list:
|
|
762
|
-
toolbar:
|
|
758
|
+
document: f,
|
|
759
|
+
fields: s = {},
|
|
760
|
+
menu: c = {},
|
|
761
|
+
list: d = {},
|
|
762
|
+
toolbar: z,
|
|
763
763
|
onReady: P,
|
|
764
|
-
onTrigger:
|
|
765
|
-
onFieldInsert:
|
|
766
|
-
onFieldUpdate:
|
|
764
|
+
onTrigger: O,
|
|
765
|
+
onFieldInsert: p,
|
|
766
|
+
onFieldUpdate: E,
|
|
767
767
|
onFieldDelete: m,
|
|
768
768
|
onFieldsChange: y,
|
|
769
769
|
onFieldSelect: w,
|
|
770
770
|
onFieldCreate: R,
|
|
771
|
-
onExport:
|
|
771
|
+
onExport: U,
|
|
772
772
|
className: A,
|
|
773
773
|
style: X,
|
|
774
774
|
documentHeight: ie = "600px"
|
|
775
|
-
} = n, [
|
|
776
|
-
() =>
|
|
777
|
-
), se = J(null),
|
|
778
|
-
|
|
779
|
-
const
|
|
775
|
+
} = n, [u, B] = I(s.initial || []), [V, _] = I(null), [j, D] = I(!1), [h, W] = I(), [b, Y] = I(""), [ee, we] = I(
|
|
776
|
+
() => s.available || []
|
|
777
|
+
), se = J(null), k = J(null), M = J(null), fe = J(s);
|
|
778
|
+
fe.current = s;
|
|
779
|
+
const H = J(null), ge = J(j);
|
|
780
780
|
oe(() => {
|
|
781
|
-
|
|
781
|
+
ge.current = j;
|
|
782
782
|
}, [j]);
|
|
783
|
-
const te =
|
|
783
|
+
const te = c.trigger || "{{", le = fe.current.available || [], G = pe(() => Ae(z), [z]), xe = T(
|
|
784
784
|
(e) => {
|
|
785
785
|
const t = e.trim().toLowerCase();
|
|
786
786
|
return t ? le.filter((i) => i.label.toLowerCase().includes(t)) : le;
|
|
787
787
|
},
|
|
788
788
|
[le]
|
|
789
|
-
), de =
|
|
789
|
+
), de = T(
|
|
790
790
|
(e) => {
|
|
791
|
-
Y(e), we(
|
|
791
|
+
Y(e), we(xe(e));
|
|
792
792
|
},
|
|
793
|
-
[
|
|
794
|
-
),
|
|
793
|
+
[xe]
|
|
794
|
+
), L = T(() => {
|
|
795
795
|
de("");
|
|
796
|
-
}, [de]), K =
|
|
796
|
+
}, [de]), K = T(
|
|
797
797
|
(e, t) => {
|
|
798
|
-
if (!
|
|
799
|
-
const i =
|
|
798
|
+
if (!k.current?.activeEditor) return !1;
|
|
799
|
+
const i = k.current.activeEditor, v = u, F = e === "inline" ? i.commands.insertStructuredContentInline?.({
|
|
800
800
|
attrs: {
|
|
801
801
|
alias: t.alias,
|
|
802
802
|
tag: t.metadata ? JSON.stringify(t.metadata) : void 0
|
|
@@ -809,159 +809,173 @@ const We = ({
|
|
|
809
809
|
},
|
|
810
810
|
text: t.defaultValue || t.alias
|
|
811
811
|
});
|
|
812
|
-
if (
|
|
813
|
-
const
|
|
814
|
-
|
|
815
|
-
const
|
|
816
|
-
(C) => !v.some((
|
|
812
|
+
if (F) {
|
|
813
|
+
const g = Q(i);
|
|
814
|
+
B(g), y?.(g);
|
|
815
|
+
const S = g.find(
|
|
816
|
+
(C) => !v.some((a) => a.id === C.id)
|
|
817
817
|
);
|
|
818
|
-
|
|
818
|
+
S && p?.(S);
|
|
819
819
|
}
|
|
820
|
-
return
|
|
820
|
+
return F ?? !1;
|
|
821
821
|
},
|
|
822
|
-
[
|
|
823
|
-
), Z =
|
|
822
|
+
[p, y, u]
|
|
823
|
+
), Z = T(
|
|
824
824
|
(e, t) => {
|
|
825
|
-
if (!
|
|
826
|
-
const v =
|
|
825
|
+
if (!k.current?.activeEditor) return !1;
|
|
826
|
+
const v = k.current.activeEditor.commands.updateStructuredContentById?.(e, {
|
|
827
827
|
attrs: t
|
|
828
828
|
});
|
|
829
|
-
return v &&
|
|
830
|
-
const
|
|
831
|
-
y?.(
|
|
832
|
-
const
|
|
833
|
-
return
|
|
834
|
-
}), v;
|
|
829
|
+
return v && B((F) => {
|
|
830
|
+
const g = F.map((C) => C.id === e ? { ...C, ...t } : C);
|
|
831
|
+
y?.(g);
|
|
832
|
+
const S = g.find((C) => C.id === e);
|
|
833
|
+
return S && E?.(S), g;
|
|
834
|
+
}), v ?? !1;
|
|
835
835
|
},
|
|
836
|
-
[
|
|
837
|
-
), ae =
|
|
836
|
+
[E, y]
|
|
837
|
+
), ae = T(
|
|
838
838
|
(e) => {
|
|
839
|
-
const t =
|
|
839
|
+
const t = k.current?.activeEditor;
|
|
840
840
|
if (!t) {
|
|
841
|
-
let
|
|
842
|
-
return
|
|
843
|
-
if (!
|
|
844
|
-
const
|
|
845
|
-
return
|
|
846
|
-
}),
|
|
841
|
+
let a = !1;
|
|
842
|
+
return B((x) => {
|
|
843
|
+
if (!x.some((N) => N.id === e)) return x;
|
|
844
|
+
const q = x.filter((N) => N.id !== e);
|
|
845
|
+
return a = !0, y?.(q), m?.(e), q;
|
|
846
|
+
}), a && _((x) => x === e ? null : x), a;
|
|
847
847
|
}
|
|
848
|
-
const v =
|
|
849
|
-
let
|
|
848
|
+
const v = u.find((a) => a.id === e)?.group;
|
|
849
|
+
let F = !1;
|
|
850
850
|
try {
|
|
851
|
-
|
|
851
|
+
F = t.commands.deleteStructuredContentById?.(e) ?? !1;
|
|
852
852
|
} catch {
|
|
853
|
-
|
|
853
|
+
F = !1;
|
|
854
854
|
}
|
|
855
|
-
let
|
|
856
|
-
const
|
|
857
|
-
if (!
|
|
858
|
-
const
|
|
859
|
-
if (
|
|
860
|
-
const
|
|
861
|
-
t.commands.updateStructuredContentById?.(
|
|
855
|
+
let g = Q(t);
|
|
856
|
+
const S = g.some((a) => a.id === e);
|
|
857
|
+
if (!F && S && (g = g.filter((a) => a.id !== e)), v) {
|
|
858
|
+
const a = g.filter((x) => x.group === v);
|
|
859
|
+
if (a.length === 1) {
|
|
860
|
+
const x = a[0];
|
|
861
|
+
t.commands.updateStructuredContentById?.(x.id, {
|
|
862
862
|
attrs: { tag: void 0 }
|
|
863
|
-
}),
|
|
863
|
+
}), g = Q(t);
|
|
864
864
|
}
|
|
865
865
|
}
|
|
866
866
|
let C = !1;
|
|
867
|
-
return
|
|
868
|
-
if (
|
|
869
|
-
return
|
|
870
|
-
const
|
|
871
|
-
return
|
|
872
|
-
}), C && (
|
|
867
|
+
return B((a) => {
|
|
868
|
+
if (Ce(a, g))
|
|
869
|
+
return a;
|
|
870
|
+
const x = a.some((N) => N.id === e), q = g.some((N) => N.id === e);
|
|
871
|
+
return x && !q && (C = !0), y?.(g), C && m?.(e), g;
|
|
872
|
+
}), C && _((a) => a === e ? null : a), F || C;
|
|
873
873
|
},
|
|
874
|
-
[m, y,
|
|
875
|
-
),
|
|
874
|
+
[m, y, u]
|
|
875
|
+
), $ = T(
|
|
876
876
|
(e) => {
|
|
877
|
-
if (!
|
|
878
|
-
|
|
879
|
-
const i =
|
|
877
|
+
if (!k.current?.activeEditor) return;
|
|
878
|
+
k.current.activeEditor.commands.selectStructuredContentById?.(e), _(e);
|
|
879
|
+
const i = u.find((v) => v.id === e);
|
|
880
880
|
i && w?.(i);
|
|
881
881
|
},
|
|
882
|
-
[
|
|
883
|
-
), ce =
|
|
882
|
+
[u, w]
|
|
883
|
+
), ce = T(
|
|
884
884
|
(e) => {
|
|
885
885
|
if (!e) return;
|
|
886
886
|
const t = Q(e);
|
|
887
|
-
|
|
887
|
+
B((i) => Ce(i, t) ? i : (y?.(t), t));
|
|
888
888
|
},
|
|
889
889
|
[y]
|
|
890
890
|
);
|
|
891
|
-
oe(() =>
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
c.on("update", ({ editor: E }) => {
|
|
906
|
-
const { state: C } = E, { from: s } = C.selection;
|
|
907
|
-
if (s >= te.length) {
|
|
908
|
-
const ue = s - te.length;
|
|
909
|
-
if (C.doc.textBetween(ue, s) === te) {
|
|
910
|
-
const xe = E.view.coordsAtPos(s), he = Ce(new DOMRect(xe.left, xe.top, 0, 0)), be = () => {
|
|
911
|
-
const ne = F.current?.activeEditor;
|
|
912
|
-
if (!ne) return;
|
|
913
|
-
const De = ne.state.selection.from, Ne = ne.state.tr.delete(ue, De);
|
|
914
|
-
ne.view.dispatch(Ne);
|
|
915
|
-
};
|
|
916
|
-
M.current = be, W.current = s, B(he), D(!0), H(), G?.({
|
|
917
|
-
position: { from: ue, to: s },
|
|
918
|
-
bounds: he,
|
|
919
|
-
cleanup: be
|
|
920
|
-
});
|
|
921
|
-
return;
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
if (!fe.current)
|
|
925
|
-
return;
|
|
926
|
-
if (W.current == null) {
|
|
927
|
-
D(!1), H();
|
|
928
|
-
return;
|
|
891
|
+
oe(() => {
|
|
892
|
+
if (!se.current) return;
|
|
893
|
+
let e = !1, t = null;
|
|
894
|
+
return (async () => {
|
|
895
|
+
const { SuperDoc: v } = await import("superdoc");
|
|
896
|
+
if (e) return;
|
|
897
|
+
const F = {
|
|
898
|
+
comments: !1,
|
|
899
|
+
...G && {
|
|
900
|
+
toolbar: {
|
|
901
|
+
selector: G.selector,
|
|
902
|
+
toolbarGroups: G.config.toolbarGroups || ["center"],
|
|
903
|
+
excludeItems: G.config.excludeItems || [],
|
|
904
|
+
...G.config
|
|
929
905
|
}
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
906
|
+
}
|
|
907
|
+
}, g = () => {
|
|
908
|
+
if (!e) {
|
|
909
|
+
if (t?.activeEditor) {
|
|
910
|
+
const S = t.activeEditor;
|
|
911
|
+
S.on("update", ({ editor: C }) => {
|
|
912
|
+
const { state: a } = C, { from: x } = a.selection;
|
|
913
|
+
if (x >= te.length) {
|
|
914
|
+
const ue = x - te.length;
|
|
915
|
+
if (a.doc.textBetween(ue, x) === te) {
|
|
916
|
+
const he = C.view.coordsAtPos(x), be = Fe(new DOMRect(he.left, he.top, 0, 0)), ye = () => {
|
|
917
|
+
const ne = k.current?.activeEditor;
|
|
918
|
+
if (!ne) return;
|
|
919
|
+
const Ne = ne.state.selection.from, ze = ne.state.tr.delete(ue, Ne);
|
|
920
|
+
ne.view.dispatch(ze);
|
|
921
|
+
};
|
|
922
|
+
M.current = ye, H.current = x, W(be), D(!0), L(), O?.({
|
|
923
|
+
position: { from: ue, to: x },
|
|
924
|
+
bounds: be,
|
|
925
|
+
cleanup: ye
|
|
926
|
+
});
|
|
927
|
+
return;
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
if (!ge.current)
|
|
931
|
+
return;
|
|
932
|
+
if (H.current == null) {
|
|
933
|
+
D(!1), L();
|
|
934
|
+
return;
|
|
935
|
+
}
|
|
936
|
+
if (x < H.current) {
|
|
937
|
+
D(!1), H.current = null, L();
|
|
938
|
+
return;
|
|
939
|
+
}
|
|
940
|
+
const q = a.doc.textBetween(H.current, x);
|
|
941
|
+
de(q);
|
|
942
|
+
const N = C.view.coordsAtPos(x), De = Fe(new DOMRect(N.left, N.top, 0, 0));
|
|
943
|
+
W(De);
|
|
944
|
+
}), S.on("update", () => {
|
|
945
|
+
ce(S);
|
|
946
|
+
}), ce(S);
|
|
933
947
|
}
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
const ke =
|
|
948
|
+
P?.();
|
|
949
|
+
}
|
|
950
|
+
};
|
|
951
|
+
t = new v({
|
|
952
|
+
selector: se.current,
|
|
953
|
+
document: f?.source,
|
|
954
|
+
documentMode: f?.mode || "editing",
|
|
955
|
+
modules: F,
|
|
956
|
+
toolbar: G?.selector,
|
|
957
|
+
onReady: g
|
|
958
|
+
}), k.current = t;
|
|
959
|
+
})(), () => {
|
|
960
|
+
e = !0, M.current = null, H.current = null, t && typeof t.destroy == "function" && t.destroy(), k.current = null;
|
|
961
|
+
};
|
|
962
|
+
}, [
|
|
963
|
+
f?.source,
|
|
964
|
+
f?.mode,
|
|
965
|
+
te,
|
|
966
|
+
ce,
|
|
967
|
+
P,
|
|
968
|
+
O,
|
|
969
|
+
G
|
|
970
|
+
]);
|
|
971
|
+
const ke = T(
|
|
958
972
|
async (e) => {
|
|
959
|
-
M.current && (M.current(), M.current = null),
|
|
960
|
-
const t = e.
|
|
973
|
+
M.current && (M.current(), M.current = null), H.current = null, L();
|
|
974
|
+
const t = e.mode || "inline";
|
|
961
975
|
if (e.id.startsWith("custom_") && R) {
|
|
962
976
|
const i = await R(e);
|
|
963
977
|
if (i) {
|
|
964
|
-
const v = i.
|
|
978
|
+
const v = i.mode || t;
|
|
965
979
|
K(v, {
|
|
966
980
|
alias: i.label,
|
|
967
981
|
metadata: i.metadata,
|
|
@@ -976,88 +990,88 @@ const We = ({
|
|
|
976
990
|
defaultValue: e.defaultValue
|
|
977
991
|
}), D(!1);
|
|
978
992
|
},
|
|
979
|
-
[K, R,
|
|
980
|
-
), Se =
|
|
993
|
+
[K, R, L]
|
|
994
|
+
), Se = T(
|
|
981
995
|
(e) => {
|
|
982
|
-
M.current && (M.current(), M.current = null),
|
|
983
|
-
const t =
|
|
996
|
+
M.current && (M.current(), M.current = null), H.current = null, L();
|
|
997
|
+
const t = k.current?.activeEditor;
|
|
984
998
|
if (!t) return;
|
|
985
999
|
const i = t.helpers?.structuredContentCommands;
|
|
986
1000
|
if (!i) return;
|
|
987
|
-
const v = e.group || `group-${Date.now()}-${Math.random().toString(36).substring(2, 11)}`,
|
|
1001
|
+
const v = e.group || `group-${Date.now()}-${Math.random().toString(36).substring(2, 11)}`, F = i.createTagObject?.({
|
|
988
1002
|
group: v
|
|
989
1003
|
});
|
|
990
1004
|
if ((e.mode || "inline") === "inline" ? t.commands.insertStructuredContentInline?.({
|
|
991
1005
|
attrs: {
|
|
992
1006
|
alias: e.alias,
|
|
993
|
-
tag:
|
|
1007
|
+
tag: F
|
|
994
1008
|
},
|
|
995
1009
|
text: e.alias
|
|
996
1010
|
}) : t.commands.insertStructuredContentBlock?.({
|
|
997
1011
|
attrs: {
|
|
998
1012
|
alias: e.alias,
|
|
999
|
-
tag:
|
|
1013
|
+
tag: F
|
|
1000
1014
|
},
|
|
1001
1015
|
text: e.alias
|
|
1002
1016
|
})) {
|
|
1003
|
-
e.group || Z(e.id, { tag:
|
|
1017
|
+
e.group || Z(e.id, { tag: F }), D(!1);
|
|
1004
1018
|
const C = Q(t);
|
|
1005
|
-
|
|
1019
|
+
B(C), y?.(C);
|
|
1006
1020
|
}
|
|
1007
1021
|
},
|
|
1008
|
-
[Z,
|
|
1009
|
-
), Te =
|
|
1010
|
-
D(!1),
|
|
1011
|
-
}, [
|
|
1012
|
-
if (!
|
|
1013
|
-
const e =
|
|
1014
|
-
|
|
1015
|
-
}, [
|
|
1016
|
-
if (!
|
|
1017
|
-
const e =
|
|
1018
|
-
|
|
1019
|
-
}, [
|
|
1022
|
+
[Z, L, y]
|
|
1023
|
+
), Te = T(() => {
|
|
1024
|
+
D(!1), H.current = null, L(), M.current && (M.current(), M.current = null);
|
|
1025
|
+
}, [L]), Ee = T(() => {
|
|
1026
|
+
if (!k.current?.activeEditor || u.length === 0) return;
|
|
1027
|
+
const e = u.findIndex((i) => i.id === V), t = e >= 0 ? (e + 1) % u.length : 0;
|
|
1028
|
+
$(u[t].id);
|
|
1029
|
+
}, [u, V, $]), Ie = T(() => {
|
|
1030
|
+
if (!k.current?.activeEditor || u.length === 0) return;
|
|
1031
|
+
const e = u.findIndex((i) => i.id === V), t = e > 0 ? e - 1 : u.length - 1;
|
|
1032
|
+
$(u[t].id);
|
|
1033
|
+
}, [u, V, $]), Me = T(
|
|
1020
1034
|
async (e) => {
|
|
1021
|
-
const { fileName: t = "document", triggerDownload: i = !0 } = e || {}, v = await
|
|
1035
|
+
const { fileName: t = "document", triggerDownload: i = !0 } = e || {}, v = await k.current?.export({
|
|
1022
1036
|
exportType: ["docx"],
|
|
1023
1037
|
exportedName: t,
|
|
1024
1038
|
triggerDownload: i
|
|
1025
|
-
}),
|
|
1026
|
-
if (
|
|
1027
|
-
const
|
|
1028
|
-
|
|
1039
|
+
}), F = k.current?.activeEditor;
|
|
1040
|
+
if (F) {
|
|
1041
|
+
const g = Q(F);
|
|
1042
|
+
U?.({ fields: g, blob: i ? void 0 : v, fileName: t });
|
|
1029
1043
|
}
|
|
1030
1044
|
return v;
|
|
1031
1045
|
},
|
|
1032
|
-
[
|
|
1046
|
+
[U]
|
|
1033
1047
|
);
|
|
1034
|
-
|
|
1048
|
+
We(l, () => ({
|
|
1035
1049
|
insertField: (e) => K("inline", e),
|
|
1036
1050
|
insertBlockField: (e) => K("block", e),
|
|
1037
1051
|
updateField: Z,
|
|
1038
1052
|
deleteField: ae,
|
|
1039
|
-
selectField:
|
|
1053
|
+
selectField: $,
|
|
1040
1054
|
nextField: Ee,
|
|
1041
1055
|
previousField: Ie,
|
|
1042
|
-
getFields: () =>
|
|
1056
|
+
getFields: () => u,
|
|
1043
1057
|
exportTemplate: Me,
|
|
1044
|
-
getSuperDoc: () =>
|
|
1058
|
+
getSuperDoc: () => k.current
|
|
1045
1059
|
}));
|
|
1046
|
-
const Re =
|
|
1060
|
+
const Re = c.component || He, me = d.component || Pe;
|
|
1047
1061
|
return /* @__PURE__ */ o("div", { className: `superdoc-template-builder ${A || ""}`, style: X, children: [
|
|
1048
1062
|
/* @__PURE__ */ o("div", { style: { display: "flex", gap: "20px" }, children: [
|
|
1049
|
-
|
|
1063
|
+
d.position === "left" && /* @__PURE__ */ r("div", { className: "superdoc-template-builder-sidebar", children: /* @__PURE__ */ r(
|
|
1050
1064
|
me,
|
|
1051
1065
|
{
|
|
1052
|
-
fields:
|
|
1053
|
-
onSelect: (e) =>
|
|
1066
|
+
fields: u,
|
|
1067
|
+
onSelect: (e) => $(e.id),
|
|
1054
1068
|
onDelete: ae,
|
|
1055
1069
|
onUpdate: (e) => Z(e.id, e),
|
|
1056
1070
|
selectedFieldId: V || void 0
|
|
1057
1071
|
}
|
|
1058
1072
|
) }),
|
|
1059
1073
|
/* @__PURE__ */ o("div", { className: "superdoc-template-builder-document", style: { flex: 1 }, children: [
|
|
1060
|
-
|
|
1074
|
+
G?.renderDefaultContainer && /* @__PURE__ */ r(
|
|
1061
1075
|
"div",
|
|
1062
1076
|
{
|
|
1063
1077
|
id: "superdoc-toolbar",
|
|
@@ -1075,11 +1089,11 @@ const We = ({
|
|
|
1075
1089
|
}
|
|
1076
1090
|
)
|
|
1077
1091
|
] }),
|
|
1078
|
-
|
|
1092
|
+
d.position === "right" && /* @__PURE__ */ r("div", { className: "superdoc-template-builder-sidebar", children: /* @__PURE__ */ r(
|
|
1079
1093
|
me,
|
|
1080
1094
|
{
|
|
1081
|
-
fields:
|
|
1082
|
-
onSelect: (e) =>
|
|
1095
|
+
fields: u,
|
|
1096
|
+
onSelect: (e) => $(e.id),
|
|
1083
1097
|
onDelete: ae,
|
|
1084
1098
|
onUpdate: (e) => Z(e.id, e),
|
|
1085
1099
|
selectedFieldId: V || void 0
|
|
@@ -1090,23 +1104,23 @@ const We = ({
|
|
|
1090
1104
|
Re,
|
|
1091
1105
|
{
|
|
1092
1106
|
isVisible: j,
|
|
1093
|
-
position:
|
|
1094
|
-
availableFields:
|
|
1107
|
+
position: h,
|
|
1108
|
+
availableFields: s.available || [],
|
|
1095
1109
|
filteredFields: ee,
|
|
1096
|
-
filterQuery:
|
|
1097
|
-
allowCreate:
|
|
1110
|
+
filterQuery: b,
|
|
1111
|
+
allowCreate: s.allowCreate || !1,
|
|
1098
1112
|
onSelect: ke,
|
|
1099
1113
|
onClose: Te,
|
|
1100
1114
|
onCreateField: R,
|
|
1101
|
-
existingFields:
|
|
1115
|
+
existingFields: u,
|
|
1102
1116
|
onSelectExisting: Se
|
|
1103
1117
|
}
|
|
1104
1118
|
)
|
|
1105
1119
|
] });
|
|
1106
1120
|
});
|
|
1107
|
-
|
|
1121
|
+
Ge.displayName = "SuperDocTemplateBuilder";
|
|
1108
1122
|
export {
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1123
|
+
Pe as FieldList,
|
|
1124
|
+
He as FieldMenu,
|
|
1125
|
+
Ge as default
|
|
1112
1126
|
};
|