@guodun/antdv 1.7.3 → 1.7.4

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.
Files changed (35) hide show
  1. package/dist/es/components/contract-signing-location/src/ContractSigningLocation.vue.mjs +313 -308
  2. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateSingleRenderer.mjs +5 -0
  3. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateSingleRenderer.vue.mjs +796 -0
  4. package/dist/es/components/pro-contract-template-designer/src/DesignerPage.vue.mjs +16 -5
  5. package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.mjs +3 -1
  6. package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.mjs +123 -710
  7. package/dist/es/components/pro-contract-template-designer/src/composables/use-renderer-files.mjs +80 -0
  8. package/dist/es/components/pro-contract-template-designer/src/composables/use-template-designer.mjs +172 -134
  9. package/dist/es/components/pro-contract-template-designer/src/composables/use-toolbar-overflow.mjs +11 -9
  10. package/dist/es/components/pro-contract-template-designer/src/utils/template-renderer.mjs +136 -76
  11. package/dist/es/components/pro-contract-template-designer/src/utils/toolbar-overflow.mjs +10 -9
  12. package/dist/es/components/pro-contract-template-designer/style/index.css +1 -1
  13. package/dist/lib/components/contract-signing-location/src/ContractSigningLocation.vue.cjs +1 -1
  14. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateSingleRenderer.cjs +1 -0
  15. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateSingleRenderer.vue.cjs +1 -0
  16. package/dist/lib/components/pro-contract-template-designer/src/DesignerPage.vue.cjs +2 -2
  17. package/dist/lib/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.cjs +1 -1
  18. package/dist/lib/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.cjs +1 -1
  19. package/dist/lib/components/pro-contract-template-designer/src/composables/use-renderer-files.cjs +1 -0
  20. package/dist/lib/components/pro-contract-template-designer/src/composables/use-template-designer.cjs +4 -4
  21. package/dist/lib/components/pro-contract-template-designer/src/composables/use-toolbar-overflow.cjs +1 -1
  22. package/dist/lib/components/pro-contract-template-designer/src/utils/template-renderer.cjs +3 -3
  23. package/dist/lib/components/pro-contract-template-designer/src/utils/toolbar-overflow.cjs +1 -1
  24. package/dist/lib/components/pro-contract-template-designer/style/index.css +1 -1
  25. package/dist/theme/icon.css +1 -1
  26. package/dist/theme/index.css +1 -1
  27. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateSingleRenderer.vue.d.ts +89 -0
  28. package/dist/types/components/pro-contract-template-designer/src/DesignerPage.vue.d.ts +2 -0
  29. package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.d.ts +388 -10
  30. package/dist/types/components/pro-contract-template-designer/src/composables/use-renderer-files.d.ts +14 -0
  31. package/dist/types/components/pro-contract-template-designer/src/composables/use-template-designer.d.ts +9 -2
  32. package/dist/types/components/pro-contract-template-designer/src/types.d.ts +16 -2
  33. package/dist/types/components/pro-contract-template-designer/src/utils/template-renderer.d.ts +3 -3
  34. package/dist/types/components/pro-contract-template-designer/src/utils/toolbar-overflow.d.ts +2 -0
  35. package/package.json +4 -4
@@ -64,20 +64,20 @@ var g = [
64
64
  textAlign: "left",
65
65
  borderStyle: "solid",
66
66
  objectFit: "contain"
67
- }, re = 3, ie = 28, y = "contract-template-renderer-1.0.0", ae = "contract-render-css-1.0.0", oe = /^[A-Za-z][A-Za-z0-9_]{1,63}$/, se = new Set([
67
+ }, re = 3, ie = 28, ae = "contract-template-renderer-1.0.0", oe = "contract-render-css-1.0.0", se = /^[A-Za-z][A-Za-z0-9_]{1,63}$/, ce = new Set([
68
68
  "pageNumber",
69
69
  "totalPages",
70
70
  "rendererVersion"
71
71
  ]);
72
- function b(e, t, n) {
72
+ function y(e, t, n) {
73
73
  let r = typeof e == "string" ? e.trim() : "";
74
- return r ? oe.test(r) ? se.has(r) ? `${r} 是系统保留标识` : t.some((e) => e.id !== n && e.key.trim() === r) ? `变量标识 ${r} 已存在` : "" : "变量标识需以字母开头,仅包含字母、数字和下划线,长度为 2~64 位" : "请输入变量标识";
74
+ return r ? se.test(r) ? ce.has(r) ? `${r} 是系统保留标识` : t.some((e) => e.id !== n && e.key.trim() === r) ? `变量标识 ${r} 已存在` : "" : "变量标识需以字母开头,仅包含字母、数字和下划线,长度为 2~64 位" : "请输入变量标识";
75
75
  }
76
- function ce(e) {
76
+ function le(e) {
77
77
  let t = Number(e);
78
78
  return Number.isFinite(t) && t >= 1 ? Math.max(1, Math.floor(t)) : 20;
79
79
  }
80
- var x = [
80
+ var b = [
81
81
  {
82
82
  type: "text",
83
83
  label: "输入框",
@@ -108,7 +108,7 @@ var x = [
108
108
  defaultWidth: 96,
109
109
  defaultHeight: 28
110
110
  }
111
- ], S = [{
111
+ ], x = [{
112
112
  type: "select",
113
113
  label: "下拉框",
114
114
  defaultWidth: 180,
@@ -118,7 +118,7 @@ var x = [
118
118
  label: "单选框",
119
119
  defaultWidth: 220,
120
120
  defaultHeight: 32
121
- }], C = [
121
+ }], S = [
122
122
  {
123
123
  type: "user-selector",
124
124
  label: "用户选择器",
@@ -143,31 +143,31 @@ var x = [
143
143
  defaultWidth: 240,
144
144
  defaultHeight: 36
145
145
  }
146
- ], w = [{
146
+ ], C = [{
147
147
  type: "custom",
148
148
  label: "自定义控件",
149
149
  defaultWidth: 200,
150
150
  defaultHeight: 36
151
- }], T = [
151
+ }], w = [
152
+ ...b,
152
153
  ...x,
153
154
  ...S,
154
- ...C,
155
- ...w
156
- ], E = 0;
157
- function D(e) {
158
- return E += 1, `${e}-${Date.now().toString(36)}-${E.toString(36)}`;
155
+ ...C
156
+ ], T = 0;
157
+ function E(e) {
158
+ return T += 1, `${e}-${Date.now().toString(36)}-${T.toString(36)}`;
159
159
  }
160
- function O(e) {
160
+ function D(e) {
161
161
  return JSON.parse(JSON.stringify(e));
162
162
  }
163
- function k(e) {
163
+ function O(e) {
164
164
  return g.find((t) => t.format === e);
165
165
  }
166
- function A(e) {
166
+ function k(e) {
167
167
  if (e) return e.format && e.format !== "Custom" ? e.format : g.find((t) => t.width === e.width && t.height === e.height)?.format;
168
168
  }
169
- function j(e, t = _) {
170
- let n = A(t) ?? t.format, r = e?.format ?? A(e) ?? n ?? "Custom", i = r === "Custom" ? void 0 : k(r), a = F(i?.width ?? e?.width, t.width), o = F(i?.height ?? e?.height, t.height);
169
+ function A(e, t = _) {
170
+ let n = k(t) ?? t.format, r = e?.format ?? k(e) ?? n ?? "Custom", i = r === "Custom" ? void 0 : O(r), a = P(i?.width ?? e?.width, t.width), o = P(i?.height ?? e?.height, t.height);
171
171
  return {
172
172
  format: i?.format ?? r,
173
173
  width: a,
@@ -175,22 +175,22 @@ function j(e, t = _) {
175
175
  label: e?.label ?? i?.label ?? t.label ?? r
176
176
  };
177
177
  }
178
- function M(e) {
178
+ function j(e) {
179
179
  return `${e.format ?? "Custom"}:${e.width}:${e.height}`;
180
180
  }
181
- function N(e) {
181
+ function M(e) {
182
182
  let t = (Array.isArray(e) ? e : g).map((e) => {
183
183
  let t = Number(e?.width), n = Number(e?.height);
184
184
  if (!Number.isFinite(t) || t <= 0 || !Number.isFinite(n) || n <= 0) return;
185
185
  let r = e?.format;
186
186
  if (r && r !== "Custom") {
187
- let t = k(r);
187
+ let t = O(r);
188
188
  return t ? {
189
189
  ...t,
190
190
  label: e.label ?? t.label
191
191
  } : void 0;
192
192
  }
193
- let i = r ? void 0 : A(e), a = i ? k(i) : void 0;
193
+ let i = r ? void 0 : k(e), a = i ? O(i) : void 0;
194
194
  if (a) return {
195
195
  ...a,
196
196
  label: e.label ?? a.label
@@ -204,19 +204,19 @@ function N(e) {
204
204
  label: e.label ?? "Custom"
205
205
  };
206
206
  }).filter(Boolean), n = /* @__PURE__ */ new Set(), r = t.filter((e) => {
207
- let t = M(e);
207
+ let t = j(e);
208
208
  return n.has(t) ? !1 : (n.add(t), !0);
209
209
  });
210
210
  return (r.length ? r : g).map((e) => ({ ...e }));
211
211
  }
212
- function P(e, t) {
213
- let n = M(e);
214
- return t.find((e) => M(e) === n);
212
+ function N(e, t) {
213
+ let n = j(e);
214
+ return t.find((e) => j(e) === n);
215
215
  }
216
- function le(e, t) {
217
- let n = N(t), r = n[0], i = j(e.pageSize, r), a = P(i, n) ?? r, o = /* @__PURE__ */ new Map(), s = e.pages.map((e) => {
218
- let t = j(e.pageSize, i), a = P(t, n) ?? r;
219
- return M(t) !== M(a) && o.set(e.id, {
216
+ function ue(e, t) {
217
+ let n = M(t), r = n[0], i = A(e.pageSize, r), a = N(i, n) ?? r, o = /* @__PURE__ */ new Map(), s = e.pages.map((e) => {
218
+ let t = A(e.pageSize, i), a = N(t, n) ?? r;
219
+ return j(t) !== j(a) && o.set(e.id, {
220
220
  source: t,
221
221
  target: a
222
222
  }), {
@@ -230,50 +230,50 @@ function le(e, t) {
230
230
  pages: s
231
231
  };
232
232
  }
233
- function F(e, t) {
233
+ function P(e, t) {
234
234
  let n = Number(e);
235
235
  return !Number.isFinite(n) || n <= 0 ? t : Math.round(n);
236
236
  }
237
- function I(e = 1, t) {
237
+ function F(e = 1, t) {
238
238
  return {
239
- id: D("page"),
239
+ id: E("page"),
240
240
  title: `第 ${e} 页`,
241
- pageSize: t ? j(t) : void 0,
241
+ pageSize: t ? A(t) : void 0,
242
242
  contentHtml: "<p>请输入合同正文。</p>"
243
243
  };
244
244
  }
245
- function L(e = 1, t, n = "<p></p>", r) {
245
+ function I(e = 1, t, n = "<p></p>", r) {
246
246
  return {
247
- id: D("page"),
247
+ id: E("page"),
248
248
  title: `第 ${e} 页`,
249
- pageSize: t ? j(t) : void 0,
249
+ pageSize: t ? A(t) : void 0,
250
250
  contentHtml: n,
251
251
  contentJson: r
252
252
  };
253
253
  }
254
- function R(e = _) {
255
- let t = j(e);
254
+ function L(e = _) {
255
+ let t = A(e);
256
256
  return {
257
- pages: [I(1, t)],
257
+ pages: [F(1, t)],
258
258
  variables: [],
259
259
  pageSize: t
260
260
  };
261
261
  }
262
- function ue(e = _) {
263
- let t = j(e);
262
+ function de(e = _) {
263
+ let t = A(e);
264
264
  return {
265
- pages: [L(1, t, "<p></p>")],
265
+ pages: [I(1, t, "<p></p>")],
266
266
  variables: [],
267
267
  pageSize: t
268
268
  };
269
269
  }
270
- function z(e, t = x) {
271
- return t.find((t) => t.type === e) ?? T.find((t) => t.type === e) ?? x[0];
270
+ function R(e, t = b) {
271
+ return t.find((t) => t.type === e) ?? w.find((t) => t.type === e) ?? b[0];
272
272
  }
273
- function B(e, t = x, n = {}) {
274
- let r = e.type === void 0 ? "text" : e.type, i = z(r, t), a = de(r);
273
+ function z(e, t = b, n = {}) {
274
+ let r = e.type === void 0 ? "text" : e.type, i = R(r, t), a = fe(r);
275
275
  return {
276
- id: e.id ?? D("variable"),
276
+ id: e.id ?? E("variable"),
277
277
  key: e.key,
278
278
  label: e.label ?? i.label ?? e.key,
279
279
  type: r,
@@ -303,7 +303,7 @@ function B(e, t = x, n = {}) {
303
303
  }
304
304
  };
305
305
  }
306
- function de(e) {
306
+ function fe(e) {
307
307
  return e === "date" ? {
308
308
  placeholder: "年 月 日",
309
309
  format: "YYYY年MM月DD日",
@@ -359,35 +359,35 @@ function de(e) {
359
359
  underline: !0
360
360
  } };
361
361
  }
362
- function V(e) {
362
+ function B(e) {
363
363
  return e !== void 0 && !ne(e);
364
364
  }
365
- function fe(e, t = _) {
366
- if (!e) return R(t);
367
- let n = j(e.pageSize, t), r = (e.pages?.length ? e.pages : [I(1, n)]).map((e, t) => ({
368
- id: e.id || D("page"),
365
+ function pe(e, t = _) {
366
+ if (!e) return L(t);
367
+ let n = A(e.pageSize, t), r = (e.pages?.length ? e.pages : [F(1, n)]).map((e, t) => ({
368
+ id: e.id || E("page"),
369
369
  title: e.title || `第 ${t + 1} 页`,
370
- pageSize: j(e.pageSize, n),
370
+ pageSize: A(e.pageSize, n),
371
371
  contentHtml: e.contentHtml || "<p></p>",
372
372
  contentJson: e.contentJson
373
373
  })), i = [], a = /* @__PURE__ */ new Map();
374
- return Object.fromEntries(r.map((e) => [e.id, j(e.pageSize, n)])), (e.variables ?? []).forEach((e) => {
375
- let t = B({
374
+ return Object.fromEntries(r.map((e) => [e.id, A(e.pageSize, n)])), (e.variables ?? []).forEach((e) => {
375
+ let t = z({
376
376
  ...e,
377
- id: e.id || D("variable")
377
+ id: e.id || E("variable")
378
378
  });
379
379
  i.push(t), t.key && a.set(t.key, t);
380
380
  }), r.forEach((e) => {
381
- xe(e).forEach((e) => {
381
+ we(e).forEach((e) => {
382
382
  if (!e.key) return;
383
383
  let t = a.get(e.key);
384
384
  if (!t) {
385
- let t = B(e);
385
+ let t = z(e);
386
386
  i.push(t), a.set(e.key, t);
387
387
  return;
388
388
  }
389
- if (V(e.type)) {
390
- let n = B({
389
+ if (B(e.type)) {
390
+ let n = z({
391
391
  ...t,
392
392
  type: e.type
393
393
  });
@@ -403,45 +403,45 @@ function fe(e, t = _) {
403
403
  ...e.pageDecorations ? { pageDecorations: p(e.pageDecorations) } : {}
404
404
  };
405
405
  }
406
- function pe(e) {
407
- return e.pages.map((t, n) => q(e, t, n, t.contentHtml, {})).join("\n");
406
+ function me(e) {
407
+ return e.pages.map((t, n) => K(e, t, n, t.contentHtml, {})).join("\n");
408
408
  }
409
- function H(e) {
410
- return e.pages.map((t, n) => q(e, t, n, Me(t.contentHtml))).join("\n");
409
+ function V(e) {
410
+ return e.pages.map((t, n) => K(e, t, n, Pe(t.contentHtml))).join("\n");
411
411
  }
412
- function me(e) {
413
- return U(e).map(({ page: t, contentHtml: n }, r) => {
414
- let i = j(t.pageSize, e.pageSize), a = d(e.pageDecorations, r + 1, e.pages.length, e.variables, {});
415
- return `<section ${J(t, e.pageSize, e.pageDecorations, r + 1)} style="width:${i.width}px;min-height:${i.height}px">${a}<div class="gd-contract-template-page__content">${n}</div></section>`;
412
+ function he(e) {
413
+ return H(e).map(({ page: t, contentHtml: n }, r) => {
414
+ let i = A(t.pageSize, e.pageSize), a = d(e.pageDecorations, r + 1, e.pages.length, e.variables, {});
415
+ return `<section ${q(t, e.pageSize, e.pageDecorations, r + 1)} style="width:${i.width}px;min-height:${i.height}px">${a}<div class="gd-contract-template-page__content">${n}</div></section>`;
416
416
  }).join("\n");
417
417
  }
418
- function U(e) {
418
+ function H(e) {
419
419
  let t = new Map(e.variables.map((e) => [e.key, e]));
420
420
  return e.pages.map((e) => ({
421
421
  page: {
422
422
  ...e,
423
423
  ...e.pageSize ? { pageSize: { ...e.pageSize } } : {}
424
424
  },
425
- contentHtml: Ce(e.contentHtml, t)
425
+ contentHtml: Ee(e.contentHtml, t)
426
426
  }));
427
427
  }
428
- var W = class extends Error {
428
+ var U = class extends Error {
429
429
  constructor(e) {
430
430
  super(e[0]?.message || "页面装饰配置无效"), this.errors = e, this.name = "ContractTemplatePageDecorationValidationError";
431
431
  }
432
432
  };
433
- function he(e) {
433
+ function ge(e) {
434
434
  let t = m(e.pageDecorations, e.variables);
435
- if (t.length) throw new W(t);
436
- let n = O(e);
435
+ if (t.length) throw new U(t);
436
+ let n = D(e);
437
437
  return n.pageDecorations &&= p(n.pageDecorations), {
438
438
  ...n,
439
- rendererVersion: y,
440
- styleVersion: ae,
441
- html: H(n)
439
+ rendererVersion: ae,
440
+ styleVersion: oe,
441
+ html: V(n)
442
442
  };
443
443
  }
444
- function ge(e, t = {}) {
444
+ function _e(e, t = {}) {
445
445
  let n = [], r = /* @__PURE__ */ new Set();
446
446
  typeof t.maxPages == "number" && e.pages.length > t.maxPages && n.push({
447
447
  type: "page",
@@ -450,7 +450,7 @@ function ge(e, t = {}) {
450
450
  code: "PAGE_LIMIT_EXCEEDED",
451
451
  message: `合同共 ${e.pages.length} 页,超过最多 ${t.maxPages} 页限制`
452
452
  }), e.variables.forEach((t) => {
453
- let i = b(t.key, e.variables, t.id), a = !!t.key?.trim() && e.variables.some((e) => e.id !== t.id && e.key.trim() === t.key.trim());
453
+ let i = y(t.key, e.variables, t.id), a = !!t.key?.trim() && e.variables.some((e) => e.id !== t.id && e.key.trim() === t.key.trim());
454
454
  i && (!a || t.key !== t.key.trim()) && n.push({
455
455
  type: "variable",
456
456
  id: t.id,
@@ -463,7 +463,7 @@ function ge(e, t = {}) {
463
463
  variableKey: t.key,
464
464
  message: `变量标识 ${t.key} 重复`,
465
465
  code: "VARIABLE_KEY_DUPLICATED"
466
- }), r.add(t.key)), V(t.type) && n.push({
466
+ }), r.add(t.key)), B(t.type) && n.push({
467
467
  type: "variable",
468
468
  id: t.id,
469
469
  variableKey: t.key,
@@ -473,7 +473,7 @@ function ge(e, t = {}) {
473
473
  });
474
474
  let i = new Set(e.variables.map((e) => e.key).filter(Boolean)), a = /* @__PURE__ */ new Set(), o = f(e.pageDecorations);
475
475
  return e.pages.forEach((e) => {
476
- G(e).forEach((t) => {
476
+ W(e).forEach((t) => {
477
477
  a.add(t), i.has(t) || n.push({
478
478
  type: "variable",
479
479
  id: e.id,
@@ -488,12 +488,12 @@ function ge(e, t = {}) {
488
488
  });
489
489
  }), n.push(...m(e.pageDecorations, e.variables)), n;
490
490
  }
491
- function G(e) {
491
+ function W(e) {
492
492
  let t = /* @__PURE__ */ new Set();
493
493
  function n(e) {
494
494
  if (!e || typeof e != "object") return;
495
495
  let r = e;
496
- _e(r.type) && r.attrs?.key && t.add(r.attrs.key), r.content?.forEach(n);
496
+ ve(r.type) && r.attrs?.key && t.add(r.attrs.key), r.content?.forEach(n);
497
497
  }
498
498
  n(e.contentJson);
499
499
  let r = e.contentHtml || "", i = /data-template-variable=["']true["'][^>]*data-key=["']([^"']+)["']|data-key=["']([^"']+)["'][^>]*data-template-variable=["']true["']/g, a = i.exec(r);
@@ -503,25 +503,56 @@ function G(e) {
503
503
  }
504
504
  return t;
505
505
  }
506
- function _e(e) {
506
+ function ve(e) {
507
507
  return e === "templateVariable" || e === "templateField";
508
508
  }
509
- function K(e) {
509
+ function G(e) {
510
510
  let t = /* @__PURE__ */ new Set();
511
511
  return e.pages.forEach((e) => {
512
- G(e).forEach((e) => t.add(e));
512
+ W(e).forEach((e) => t.add(e));
513
513
  }), t;
514
514
  }
515
- function ve(e) {
516
- let t = K(e), n = f(e.pageDecorations);
515
+ function ye(e) {
516
+ let t = G(e), n = f(e.pageDecorations);
517
517
  return {
518
518
  ...e,
519
- variables: e.variables.filter((r) => b(r.key, e.variables, r.id) ? !0 : t.has(r.key) || n.has(r.key))
519
+ variables: e.variables.filter((r) => y(r.key, e.variables, r.id) ? !0 : t.has(r.key) || n.has(r.key))
520
520
  };
521
521
  }
522
- function ye(e, t, n) {
522
+ function be(e, t) {
523
+ for (let n = 0; n < t; n += 1) {
524
+ let r = e[n]?.content ?? [];
525
+ for (let e of r) {
526
+ let r = Math.max(1, Number(e.attrs?.rowspan) || 1);
527
+ if (n + r > t) return !1;
528
+ }
529
+ }
530
+ return !0;
531
+ }
532
+ function xe(e, t, n) {
533
+ let r = e.content ?? [], i = t.tableRows ?? [], a = Math.min(r.length, i.length), o = n - Math.max(0, t.trailingTextBlockHeight ?? 0), s = 0;
534
+ for (let e = 0; e < a; e += 1) {
535
+ let t = i[e];
536
+ if (t.top + t.height > o + 1) break;
537
+ s = e + 1;
538
+ }
539
+ if (s <= 0 || s >= r.length) return;
540
+ let c = s;
541
+ for (; c > 0 && !be(r, c);) --c;
542
+ if (!(c <= 0 || c >= r.length)) return {
543
+ currentTable: {
544
+ ...e,
545
+ content: r.slice(0, c)
546
+ },
547
+ overflowTable: {
548
+ ...e,
549
+ content: r.slice(c)
550
+ }
551
+ };
552
+ }
553
+ function Se(e, t, n) {
523
554
  let r = e ?? [];
524
- if (r.length <= 1 || n <= 0) return;
555
+ if (!r.length || n <= 0) return;
525
556
  let i = Math.min(r.length, t.length), a = -1;
526
557
  for (let e = 0; e < i; e += 1) {
527
558
  let r = t[e];
@@ -530,18 +561,25 @@ function ye(e, t, n) {
530
561
  break;
531
562
  }
532
563
  }
564
+ if (a < 0) return;
565
+ let o = r[a], s = o?.type === "table" ? xe(o, t[a], n) : void 0;
566
+ if (s) return {
567
+ splitIndex: a,
568
+ currentContent: [...r.slice(0, a), s.currentTable],
569
+ overflowContent: [s.overflowTable, ...r.slice(a + 1)]
570
+ };
533
571
  if (!(a <= 0)) return {
534
572
  splitIndex: a,
535
573
  currentContent: r.slice(0, a),
536
574
  overflowContent: r.slice(a)
537
575
  };
538
576
  }
539
- function q(e, t, n, r, i) {
577
+ function K(e, t, n, r, i) {
540
578
  let a = d(e.pageDecorations, n + 1, e.pages.length, e.variables, i);
541
- return `<section ${J(t, e.pageSize, e.pageDecorations, n + 1)}>${a}<div class="gd-contract-template-page__content">${r}</div></section>`;
579
+ return `<section ${q(t, e.pageSize, e.pageDecorations, n + 1)}>${a}<div class="gd-contract-template-page__content">${r}</div></section>`;
542
580
  }
543
- function J(e, t, n, r = 1) {
544
- let a = j(e.pageSize, t);
581
+ function q(e, t, n, r = 1) {
582
+ let a = A(e.pageSize, t);
545
583
  return [
546
584
  `class="${te(n, r)}"`,
547
585
  `data-page-id="${i(e.id)}"`,
@@ -551,28 +589,28 @@ function J(e, t, n, r = 1) {
551
589
  `data-page-height="${a.height}"`
552
590
  ].join(" ");
553
591
  }
554
- var be = /<span\b[^>]*data-template-variable=["']true["'][^>]*>/g;
555
- function xe(e) {
592
+ var Ce = /<span\b[^>]*data-template-variable=["']true["'][^>]*>/g;
593
+ function we(e) {
556
594
  let i = /* @__PURE__ */ new Map();
557
595
  function a(e) {
558
596
  if (!e.key) return;
559
597
  let t = i.get(e.key);
560
- (!t || V(e.type) && !V(t.type)) && i.set(e.key, e);
598
+ (!t || B(e.type) && !B(t.type)) && i.set(e.key, e);
561
599
  }
562
600
  function s(e) {
563
601
  if (!e || typeof e != "object") return;
564
602
  let t = e;
565
- t.type === "templateVariable" && typeof t.attrs?.key == "string" && a(Se(t.attrs, t.attrs.key)), t.content?.forEach(s);
603
+ t.type === "templateVariable" && typeof t.attrs?.key == "string" && a(Te(t.attrs, t.attrs.key)), t.content?.forEach(s);
566
604
  }
567
605
  s(e.contentJson);
568
606
  let c = e.contentHtml || "";
569
607
  return t() ? new DOMParser().parseFromString(c, "text/html").querySelectorAll("[data-template-variable]").forEach((e) => {
570
- a(Y(n(e)));
571
- }) : o(c, be, (e) => {
572
- a(Y(r(e)));
608
+ a(J(n(e)));
609
+ }) : o(c, Ce, (e) => {
610
+ a(J(r(e)));
573
611
  }), Array.from(i.values());
574
612
  }
575
- function Y(e) {
613
+ function J(e) {
576
614
  let t = e("data-key") ?? "", n = e("data-variable-type"), r = e("data-precision"), i = e("data-use-grouping");
577
615
  return {
578
616
  key: t,
@@ -611,7 +649,7 @@ function Y(e) {
611
649
  }
612
650
  };
613
651
  }
614
- function Se(e, t) {
652
+ function Te(e, t) {
615
653
  let n = (t) => typeof e[t] == "string" ? e[t] : void 0;
616
654
  return {
617
655
  key: t,
@@ -650,20 +688,20 @@ function Se(e, t) {
650
688
  }
651
689
  };
652
690
  }
653
- function Ce(e, n) {
691
+ function Ee(e, n) {
654
692
  if (!e) return e;
655
693
  if (t()) {
656
694
  let t = new DOMParser().parseFromString(e, "text/html");
657
- return we(t), t.querySelectorAll("[data-template-variable]").forEach((e) => {
658
- Ee(e, n);
695
+ return De(t), t.querySelectorAll("[data-template-variable]").forEach((e) => {
696
+ Oe(e, n);
659
697
  }), t.body.innerHTML;
660
698
  }
661
- return u(Oe(e), (e, t) => {
699
+ return u(Ae(e), (e, t) => {
662
700
  let i = r(t);
663
- return i("data-key") ? De(i, n) : e;
701
+ return i("data-key") ? ke(i, n) : e;
664
702
  });
665
703
  }
666
- function we(e) {
704
+ function De(e) {
667
705
  e.querySelectorAll("script,style,meta,link").forEach((e) => e.remove()), e.querySelectorAll("*").forEach((e) => {
668
706
  Array.from(e.attributes).forEach((t) => {
669
707
  let n = t.name.toLowerCase(), r = t.value;
@@ -675,12 +713,12 @@ function we(e) {
675
713
  e.removeAttribute(t.name);
676
714
  return;
677
715
  }
678
- n === "style" && je(r) && e.removeAttribute(t.name);
716
+ n === "style" && Ne(r) && e.removeAttribute(t.name);
679
717
  });
680
718
  });
681
719
  }
682
- function Te(e, t) {
683
- let n = e("data-key") ?? "", r = t.get(n), i = r?.type ?? e("data-variable-type") ?? "text", a = Ae(i, r?.defaultValue ?? e("data-default-value") ?? ""), o = ee({
720
+ function Y(e, t) {
721
+ let n = e("data-key") ?? "", r = t.get(n), i = r?.type ?? e("data-variable-type") ?? "text", a = Me(i, r?.defaultValue ?? e("data-default-value") ?? ""), o = ee({
684
722
  type: i,
685
723
  width: r?.width ?? e("data-width"),
686
724
  height: r?.height ?? e("data-height"),
@@ -694,7 +732,7 @@ function Te(e, t) {
694
732
  multiline: r?.multiline ?? c(e("data-multiline")) ?? !1,
695
733
  rows: r?.rows ?? e("data-rows"),
696
734
  lineHeight: r?.lineHeight ?? e("data-line-height"),
697
- style: ke(r, e)
735
+ style: je(r, e)
698
736
  });
699
737
  return {
700
738
  key: n,
@@ -703,18 +741,18 @@ function Te(e, t) {
703
741
  text: o.type === "image" && o.hasDefaultValue ? " " : o.displayText || " "
704
742
  };
705
743
  }
706
- function Ee(e, t) {
707
- let { key: r, label: i, presentation: a, text: o } = Te(n(e), t);
744
+ function Oe(e, t) {
745
+ let { key: r, label: i, presentation: a, text: o } = Y(n(e), t);
708
746
  e.setAttribute("data-template-variable", "true"), e.setAttribute("data-key", r), e.setAttribute("data-label", i), e.setAttribute("data-variable-type", a.type), e.setAttribute("data-width", String(a.width)), e.setAttribute("data-height", String(a.height)), e.setAttribute("data-border", String(a.border)), e.setAttribute("data-underline", String(a.underline)), e.setAttribute("data-color", a.color), e.setAttribute("data-background", a.background), e.setAttribute("data-font-size", String(a.fontSize)), e.setAttribute("data-font-family", a.fontFamily), e.setAttribute("data-placeholder-color", a.placeholderColor), e.setAttribute("data-line-color", a.lineColor), e.setAttribute("data-text-align", a.textAlign), e.setAttribute("data-border-style", a.borderStyle), e.setAttribute("data-object-fit", a.objectFit), e.className = a.classes.join(" "), e.setAttribute("style", a.styleText), e.textContent = o;
709
747
  }
710
- function De(e, t) {
711
- let { key: n, label: r, presentation: o, text: s } = Te(e, t);
748
+ function ke(e, t) {
749
+ let { key: n, label: r, presentation: o, text: s } = Y(e, t);
712
750
  return `<span data-template-variable="true" data-key="${i(n)}" data-label="${i(r)}" data-variable-type="${i(o.type)}" data-width="${o.width}" data-height="${o.height}" data-border="${o.border}" data-underline="${o.underline}" data-font-family="${i(o.fontFamily)}" class="${i(o.classes.join(" "))}" style="${i(o.styleText)}">${a(s)}</span>`;
713
751
  }
714
- function Oe(e) {
715
- return e.replace(/<\s*(script|style|meta|link)\b[\s\S]*?<\s*\/\s*\1\s*>/gi, "").replace(/<\s*(meta|link)\b[^>]*>/gi, "").replace(/\s+on[a-z]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi, "").replace(/\s+srcdoc\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi, "").replace(/\s+(href|src)\s*=\s*(["'])(.*?)\2/gi, (e, t, n, r) => X(r) ? "" : ` ${t}=${n}${r}${n}`).replace(/\s+style\s*=\s*(["'])(.*?)\1/gi, (e, t, n) => je(n) ? "" : ` style=${t}${n}${t}`);
752
+ function Ae(e) {
753
+ return e.replace(/<\s*(script|style|meta|link)\b[\s\S]*?<\s*\/\s*\1\s*>/gi, "").replace(/<\s*(meta|link)\b[^>]*>/gi, "").replace(/\s+on[a-z]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi, "").replace(/\s+srcdoc\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi, "").replace(/\s+(href|src)\s*=\s*(["'])(.*?)\2/gi, (e, t, n, r) => X(r) ? "" : ` ${t}=${n}${r}${n}`).replace(/\s+style\s*=\s*(["'])(.*?)\1/gi, (e, t, n) => Ne(n) ? "" : ` style=${t}${n}${t}`);
716
754
  }
717
- function ke(e, t) {
755
+ function je(e, t) {
718
756
  return {
719
757
  border: e?.style?.border ?? c(t("data-border")),
720
758
  underline: e?.style?.underline ?? c(t("data-underline")),
@@ -729,17 +767,17 @@ function ke(e, t) {
729
767
  objectFit: e?.style?.objectFit ?? $(t("data-object-fit"))
730
768
  };
731
769
  }
732
- function Ae(e, t) {
770
+ function Me(e, t) {
733
771
  return e === "image" && X(t) ? "" : t;
734
772
  }
735
773
  function X(e) {
736
774
  let t = e.trim().replace(/[\u0000-\u001F\s]+/g, "").toLowerCase();
737
775
  return t.startsWith("javascript:") || t.startsWith("vbscript:") || t.startsWith("data:") && !t.startsWith("data:image/");
738
776
  }
739
- function je(e) {
777
+ function Ne(e) {
740
778
  return /expression\s*\(|javascript:|vbscript:/i.test(e);
741
779
  }
742
- function Me(e) {
780
+ function Pe(e) {
743
781
  if (!e) return e;
744
782
  if (t()) {
745
783
  let t = new DOMParser().parseFromString(e, "text/html");
@@ -753,23 +791,23 @@ function Me(e) {
753
791
  return n ? `<span${t}>\${{${n}}}</span>` : e;
754
792
  });
755
793
  }
756
- function Ne(e) {
794
+ function Fe(e) {
757
795
  return e === "left" || e === "center" || e === "right";
758
796
  }
759
- function Pe(e) {
797
+ function Ie(e) {
760
798
  return e === "solid" || e === "dashed";
761
799
  }
762
- function Fe(e) {
800
+ function Le(e) {
763
801
  return e === "contain" || e === "cover" || e === "fill";
764
802
  }
765
803
  function Z(e) {
766
- return Ne(e) ? e : void 0;
804
+ return Fe(e) ? e : void 0;
767
805
  }
768
806
  function Q(e) {
769
- return Pe(e) ? e : void 0;
807
+ return Ie(e) ? e : void 0;
770
808
  }
771
809
  function $(e) {
772
- return Fe(e) ? e : void 0;
810
+ return Le(e) ? e : void 0;
773
811
  }
774
812
  //#endregion
775
- export { T as ALL_DEFAULT_FIELD_TYPES, y as CONTRACT_TEMPLATE_RENDERER_VERSION, se as CONTRACT_TEMPLATE_RESERVED_VARIABLE_KEYS, ae as CONTRACT_TEMPLATE_STYLE_VERSION, oe as CONTRACT_TEMPLATE_VARIABLE_KEY_PATTERN, W as ContractTemplatePageDecorationValidationError, S as DEFAULT_ADVANCED_CHOICE_FIELD_TYPES, C as DEFAULT_BUILTIN_SELECTOR_FIELD_TYPES, w as DEFAULT_CUSTOM_FIELD_TYPES, v as DEFAULT_FIELD_STYLE, x as DEFAULT_FIELD_TYPES, ie as DEFAULT_MULTILINE_LINE_HEIGHT, re as DEFAULT_MULTILINE_ROWS, _ as DEFAULT_PAGE_SIZE, g as PAGE_SIZE_OPTIONS, H as buildTemplateExpressionHtml, pe as buildTemplateHtml, me as buildTemplatePreviewHtml, U as buildTemplatePreviewPages, O as cloneTemplateValue, K as collectTemplateValueVariableKeys, G as collectTemplateVariableKeys, le as constrainTemplatePageSizes, L as createBlankPage, ue as createBlankTemplate, I as createDefaultPage, R as createDefaultTemplate, D as createDesignerId, B as createTemplateVariable, he as exportTemplateValue, P as findPageSizeOption, z as getFieldOption, M as getPageSizeKey, k as getPageSizeOption, A as inferPageFormat, ce as normalizeContractTemplateMaxPages, N as normalizePageSizeOptions, fe as normalizeTemplateValue, j as resolvePageSize, ye as splitPageContentByMeasurements, ve as syncTemplateVariablesWithPages, b as validateContractTemplateVariableKey, ge as validateTemplateValue };
813
+ export { w as ALL_DEFAULT_FIELD_TYPES, ae as CONTRACT_TEMPLATE_RENDERER_VERSION, ce as CONTRACT_TEMPLATE_RESERVED_VARIABLE_KEYS, oe as CONTRACT_TEMPLATE_STYLE_VERSION, se as CONTRACT_TEMPLATE_VARIABLE_KEY_PATTERN, U as ContractTemplatePageDecorationValidationError, x as DEFAULT_ADVANCED_CHOICE_FIELD_TYPES, S as DEFAULT_BUILTIN_SELECTOR_FIELD_TYPES, C as DEFAULT_CUSTOM_FIELD_TYPES, v as DEFAULT_FIELD_STYLE, b as DEFAULT_FIELD_TYPES, ie as DEFAULT_MULTILINE_LINE_HEIGHT, re as DEFAULT_MULTILINE_ROWS, _ as DEFAULT_PAGE_SIZE, g as PAGE_SIZE_OPTIONS, V as buildTemplateExpressionHtml, me as buildTemplateHtml, he as buildTemplatePreviewHtml, H as buildTemplatePreviewPages, D as cloneTemplateValue, G as collectTemplateValueVariableKeys, W as collectTemplateVariableKeys, ue as constrainTemplatePageSizes, I as createBlankPage, de as createBlankTemplate, F as createDefaultPage, L as createDefaultTemplate, E as createDesignerId, z as createTemplateVariable, ge as exportTemplateValue, N as findPageSizeOption, R as getFieldOption, j as getPageSizeKey, O as getPageSizeOption, k as inferPageFormat, le as normalizeContractTemplateMaxPages, M as normalizePageSizeOptions, pe as normalizeTemplateValue, A as resolvePageSize, Se as splitPageContentByMeasurements, ye as syncTemplateVariablesWithPages, y as validateContractTemplateVariableKey, _e as validateTemplateValue };