x-print-designer 0.4.13 → 0.4.14

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.
@@ -4600,12 +4600,24 @@ const createI18nInstance = (initialLocale) => {
4600
4600
  });
4601
4601
  };
4602
4602
  const i18n = createI18nInstance();
4603
- const sanitizeElement = (element) => {
4603
+ const normalizeIdentifier = (value, fallback) => {
4604
+ if (typeof value === "string") {
4605
+ const normalized = value.trim();
4606
+ return normalized || fallback;
4607
+ }
4608
+ if (typeof value === "number" && Number.isFinite(value)) {
4609
+ return String(value);
4610
+ }
4611
+ return fallback;
4612
+ };
4613
+ const sanitizeElement = (element, pageIndex, elementIndex) => {
4604
4614
  if (!element || typeof element !== "object") return null;
4605
- if (typeof element.id !== "string" || !element.id) return null;
4606
- if (typeof element.type !== "string" || !element.type) return null;
4615
+ const type = typeof element.type === "string" ? element.type.trim() : "";
4616
+ if (!type) return null;
4607
4617
  const next = {
4608
4618
  ...element,
4619
+ id: normalizeIdentifier(element.id, `element-${pageIndex + 1}-${elementIndex + 1}`),
4620
+ type,
4609
4621
  style: element.style && typeof element.style === "object" ? element.style : {}
4610
4622
  };
4611
4623
  if (next.type === "table") {
@@ -4619,8 +4631,8 @@ const sanitizePages = (pages) => {
4619
4631
  if (!Array.isArray(pages)) return [];
4620
4632
  return pages.filter((page) => page && typeof page === "object").map((page, index) => ({
4621
4633
  ...page,
4622
- id: typeof page.id === "string" && page.id ? page.id : `page-${index + 1}`,
4623
- elements: Array.isArray(page.elements) ? page.elements.map(sanitizeElement).filter(Boolean) : []
4634
+ id: normalizeIdentifier(page.id, `page-${index + 1}`),
4635
+ elements: Array.isArray(page.elements) ? page.elements.map((element, elementIndex) => sanitizeElement(element, index, elementIndex)).filter(Boolean) : []
4624
4636
  }));
4625
4637
  };
4626
4638
  const sanitizeTemplateData = (data) => {
@@ -5215,6 +5227,9 @@ const useTemplateStore = defineStore("templates", {
5215
5227
  }
5216
5228
  const t = detail;
5217
5229
  const designerStore = useDesignerStore();
5230
+ const isReportMode = designerStore.mode === "report";
5231
+ const injectedTestData = isReportMode && Object.keys(designerStore.testData || {}).length > 0 ? cloneDeep$1(designerStore.testData) : null;
5232
+ const injectedVariables = isReportMode && Object.keys(designerStore.variables || {}).length > 0 ? cloneDeep$1(designerStore.variables) : null;
5218
5233
  designerStore.resetCanvas();
5219
5234
  const data = t.data;
5220
5235
  if (data.pages && data.pages.length > 0) {
@@ -5240,12 +5255,16 @@ const useTemplateStore = defineStore("templates", {
5240
5255
  if (data.pageSpacingY !== void 0) designerStore.pageSpacingY = data.pageSpacingY;
5241
5256
  if (data.unit !== void 0) designerStore.unit = data.unit;
5242
5257
  if (data.watermark !== void 0) designerStore.watermark = cloneDeep$1(data.watermark);
5243
- if (designerStore.mode !== "report" || Object.keys(designerStore.testData || {}).length === 0) {
5258
+ if (injectedTestData) {
5259
+ designerStore.testData = injectedTestData;
5260
+ } else {
5244
5261
  designerStore.testData = cloneDeep$1(data.testData || {});
5245
5262
  }
5246
- if (data.variables !== void 0) {
5263
+ if (injectedVariables) {
5264
+ designerStore.variables = injectedVariables;
5265
+ } else if (data.variables !== void 0) {
5247
5266
  designerStore.variables = cloneDeep$1(data.variables || {});
5248
- } else if (designerStore.mode === "report" && data.testData && typeof data.testData === "object") {
5267
+ } else if (isReportMode && data.testData && typeof data.testData === "object") {
5249
5268
  const nestedVariables = data.testData.variables && typeof data.testData.variables === "object" ? data.testData.variables : data.testData;
5250
5269
  designerStore.variables = cloneDeep$1(nestedVariables || {});
5251
5270
  }
@@ -5291,6 +5310,9 @@ const useTemplateStore = defineStore("templates", {
5291
5310
  const t = this.templates.find((t2) => t2.id === id);
5292
5311
  if (t) {
5293
5312
  const designerStore = useDesignerStore();
5313
+ const isReportMode = designerStore.mode === "report";
5314
+ const injectedTestData = isReportMode && Object.keys(designerStore.testData || {}).length > 0 ? cloneDeep$1(designerStore.testData) : null;
5315
+ const injectedVariables = isReportMode && Object.keys(designerStore.variables || {}).length > 0 ? cloneDeep$1(designerStore.variables) : null;
5294
5316
  designerStore.resetCanvas();
5295
5317
  const data = sanitizeTemplateData(t.data);
5296
5318
  if (data.pages && data.pages.length > 0) {
@@ -5321,12 +5343,16 @@ const useTemplateStore = defineStore("templates", {
5321
5343
  if (data.pageSpacingY !== void 0) designerStore.pageSpacingY = data.pageSpacingY;
5322
5344
  if (data.unit !== void 0) designerStore.unit = data.unit;
5323
5345
  if (data.watermark !== void 0) designerStore.watermark = cloneDeep$1(data.watermark);
5324
- if (designerStore.mode !== "report" || Object.keys(designerStore.testData || {}).length === 0) {
5346
+ if (injectedTestData) {
5347
+ designerStore.testData = injectedTestData;
5348
+ } else {
5325
5349
  designerStore.testData = cloneDeep$1(data.testData || {});
5326
5350
  }
5327
- if (data.variables !== void 0) {
5351
+ if (injectedVariables) {
5352
+ designerStore.variables = injectedVariables;
5353
+ } else if (data.variables !== void 0) {
5328
5354
  designerStore.variables = cloneDeep$1(data.variables || {});
5329
- } else if (designerStore.mode === "report" && data.testData && typeof data.testData === "object") {
5355
+ } else if (isReportMode && data.testData && typeof data.testData === "object") {
5330
5356
  const nestedVariables = data.testData.variables && typeof data.testData.variables === "object" ? data.testData.variables : data.testData;
5331
5357
  designerStore.variables = cloneDeep$1(nestedVariables || {});
5332
5358
  }
@@ -6527,6 +6553,13 @@ const useDesignerStore = defineStore("designer", {
6527
6553
  * 用于派发对外 `templateloaded` 事件,解决调用方无法 await loadTemplate 的问题。
6528
6554
  */
6529
6555
  loadCompleteEmitter: null,
6556
+ /**
6557
+ * 原始模板页快照(materialize 之前的 pages)。
6558
+ * 报告模式下 materializeReportTables 会把 table 转成 customTable(分页后),
6559
+ * 导致后续数据变化时无法重新分页(table 元素已消失)。
6560
+ * 每次加载模板时保存快照,重新分页前从快照恢复原始 table。
6561
+ */
6562
+ originalTemplatePages: null,
6530
6563
  testData: {},
6531
6564
  variables: {},
6532
6565
  availableVariables: [],
@@ -6700,6 +6733,7 @@ const useDesignerStore = defineStore("designer", {
6700
6733
  this.watermark = { ...defaultWatermark };
6701
6734
  localStorage.setItem("print-designer-watermark", JSON.stringify(this.watermark));
6702
6735
  this.pages = [{ id: v4(), elements: [] }];
6736
+ this.originalTemplatePages = null;
6703
6737
  this.currentPageIndex = 0;
6704
6738
  this.testData = {};
6705
6739
  this.variables = {};
@@ -8260,8 +8294,15 @@ const useDesignerStore = defineStore("designer", {
8260
8294
  materializeReportTables() {
8261
8295
  if (this.mode !== "report") return false;
8262
8296
  if (!Array.isArray(this.pages) || this.pages.length === 0) return false;
8263
- const hasDataTable = this.pages.some((page) => Array.isArray(page == null ? void 0 : page.elements) && page.elements.some((element) => (element == null ? void 0 : element.type) === ElementType.TABLE));
8297
+ let hasDataTable = this.pages.some((page) => Array.isArray(page == null ? void 0 : page.elements) && page.elements.some((element) => (element == null ? void 0 : element.type) === ElementType.TABLE));
8298
+ if (!hasDataTable && this.originalTemplatePages) {
8299
+ this.pages = cloneDeep$1(this.originalTemplatePages);
8300
+ hasDataTable = this.pages.some((page) => Array.isArray(page == null ? void 0 : page.elements) && page.elements.some((element) => (element == null ? void 0 : element.type) === ElementType.TABLE));
8301
+ }
8264
8302
  if (!hasDataTable) return false;
8303
+ if (!this.originalTemplatePages) {
8304
+ this.originalTemplatePages = cloneDeep$1(this.pages);
8305
+ }
8265
8306
  const result = materializeReportDataTables({
8266
8307
  pages: this.pages,
8267
8308
  canvasHeight: this.canvasSize.height,
@@ -8723,11 +8764,11 @@ function expandLoopPages(pages, ctx) {
8723
8764
  for (let i = 0; i < data.length; i++) {
8724
8765
  const item = data[i];
8725
8766
  const newPage = {
8726
- id: i === 0 ? page.id : v4(),
8767
+ id: i === 0 ? page.id : `${page.id}-loop-${i}`,
8727
8768
  elements: page.elements.map((el) => {
8728
8769
  const cloned = cloneDeep$1(el);
8729
8770
  if (i !== 0) {
8730
- cloned.id = v4();
8771
+ cloned.id = `${el.id}-loop-${i}`;
8731
8772
  }
8732
8773
  if (el.type === ElementType.LOOP_RENDER) {
8733
8774
  return cloned;
@@ -8768,7 +8809,6 @@ function hasLoopPage(pages) {
8768
8809
  return !!pages && pages.some((p) => !!p.loopDataVariable);
8769
8810
  }
8770
8811
  function collapseLoopPages(currentPages, originalTemplatePages) {
8771
- var _a;
8772
8812
  if (!Array.isArray(currentPages) || !Array.isArray(originalTemplatePages)) {
8773
8813
  return currentPages;
8774
8814
  }
@@ -8777,41 +8817,40 @@ function collapseLoopPages(currentPages, originalTemplatePages) {
8777
8817
  return currentPages;
8778
8818
  }
8779
8819
  const result = [];
8780
- for (const originalLoopPage of originalLoopPages) {
8781
- const basePageId = originalLoopPage.id;
8782
- const loopVar = originalLoopPage.loopDataVariable;
8783
- const expandedGroupPages = currentPages.filter(
8784
- (p) => p.id === basePageId || typeof p.id === "string" && p.id.startsWith(`${basePageId}-`)
8820
+ const emittedLoopPageIds = /* @__PURE__ */ new Set();
8821
+ for (const page of currentPages) {
8822
+ const originalLoopPage = originalLoopPages.find(
8823
+ (orig) => page.id === orig.id || typeof page.id === "string" && page.id.startsWith(`${orig.id}-`)
8785
8824
  );
8786
- if (expandedGroupPages.length === 0) {
8787
- result.push(originalLoopPage);
8825
+ if (!originalLoopPage) {
8826
+ result.push(page);
8827
+ continue;
8828
+ }
8829
+ if (emittedLoopPageIds.has(originalLoopPage.id)) {
8788
8830
  continue;
8789
8831
  }
8790
- const mergedElements = cloneDeep$1(expandedGroupPages[0].elements || []);
8791
- const origElMap = new Map(((_a = originalLoopPage.elements) == null ? void 0 : _a.map((e) => [e.type, e])) || []);
8792
- for (const el of mergedElements) {
8793
- const orig = origElMap.get(el.type);
8794
- if (orig == null ? void 0 : orig.variable) {
8795
- el.variable = orig.variable;
8832
+ emittedLoopPageIds.add(originalLoopPage.id);
8833
+ const mergedElements = cloneDeep$1(page.elements || []);
8834
+ const originalElements = originalLoopPage.elements || [];
8835
+ const originalElementMap = new Map(originalElements.map((element) => [element.id, element]));
8836
+ mergedElements.forEach((element, index) => {
8837
+ const baseElementId = typeof element.id === "string" ? element.id.replace(/-loop-\d+$/, "") : element.id;
8838
+ const originalElement = originalElementMap.get(baseElementId) || originalElements[index];
8839
+ if (originalElement == null ? void 0 : originalElement.variable) {
8840
+ element.variable = originalElement.variable;
8796
8841
  }
8797
- if ((orig == null ? void 0 : orig.content) && /\{#/.test(orig.content)) {
8798
- el.content = orig.content;
8842
+ if ((originalElement == null ? void 0 : originalElement.content) && /\{#/.test(originalElement.content)) {
8843
+ element.content = originalElement.content;
8799
8844
  }
8800
- }
8845
+ });
8801
8846
  result.push({
8802
8847
  ...originalLoopPage,
8803
- elements: mergedElements,
8804
- loopDataVariable: loopVar,
8805
- loopFields: originalLoopPage.loopFields
8848
+ elements: mergedElements
8806
8849
  });
8807
8850
  }
8808
- new Set(originalLoopPages.map((p) => p.id));
8809
- for (const page of currentPages) {
8810
- const belongsToLoop = originalLoopPages.some(
8811
- (orig) => page.id === orig.id || typeof page.id === "string" && page.id.startsWith(`${orig.id}-`)
8812
- );
8813
- if (!belongsToLoop) {
8814
- result.push(page);
8851
+ for (const originalLoopPage of originalLoopPages) {
8852
+ if (!emittedLoopPageIds.has(originalLoopPage.id)) {
8853
+ result.push(cloneDeep$1(originalLoopPage));
8815
8854
  }
8816
8855
  }
8817
8856
  return result;
@@ -8834,7 +8873,7 @@ function useRenderContext() {
8834
8873
  }
8835
8874
  return computed(buildStoreRenderContext);
8836
8875
  }
8837
- const _hoisted_1$i = ["data-auto-height"];
8876
+ const _hoisted_1$h = ["data-auto-height"];
8838
8877
  const _sfc_main$j = /* @__PURE__ */ defineComponent({
8839
8878
  __name: "TextElement",
8840
8879
  props: {
@@ -9002,11 +9041,11 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
9002
9041
  ]) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
9003
9042
  createTextVNode(toDisplayString(resolvedText.value), 1)
9004
9043
  ], 64))
9005
- ], 44, _hoisted_1$i);
9044
+ ], 44, _hoisted_1$h);
9006
9045
  };
9007
9046
  }
9008
9047
  });
9009
- const _hoisted_1$h = ["src"];
9048
+ const _hoisted_1$g = ["src"];
9010
9049
  const _hoisted_2$8 = {
9011
9050
  key: 1,
9012
9051
  class: "text-gray-400 text-xs"
@@ -9093,7 +9132,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
9093
9132
  src: resolvedContent.value,
9094
9133
  class: normalizeClass(["w-full h-full pointer-events-none", imageFitClass.value]),
9095
9134
  alt: "Element"
9096
- }, null, 10, _hoisted_1$h)) : (openBlock(), createElementBlock("span", _hoisted_2$8, toDisplayString(placeholderText.value), 1)),
9135
+ }, null, 10, _hoisted_1$g)) : (openBlock(), createElementBlock("span", _hoisted_2$8, toDisplayString(placeholderText.value), 1)),
9097
9136
  createElementVNode("input", {
9098
9137
  ref_key: "fileInputRef",
9099
9138
  ref: fileInputRef,
@@ -9158,7 +9197,7 @@ function shouldPaginate(options) {
9158
9197
  const { totalPages } = calculatePagination(options);
9159
9198
  return totalPages > 1;
9160
9199
  }
9161
- const _hoisted_1$g = {
9200
+ const _hoisted_1$f = {
9162
9201
  key: 0,
9163
9202
  class: "absolute top-0 right-0 bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded-bl z-50"
9164
9203
  };
@@ -9860,7 +9899,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
9860
9899
  "data-table-container": "",
9861
9900
  style: normalizeStyle({ ...tableContainerStyle.value, backgroundColor: __props.element.style.backgroundColor || "transparent" })
9862
9901
  }, [
9863
- needsPagination.value && !unref(store).isExporting && !usesReportPaginatedLayout.value && unref(store).showVariableNames ? (openBlock(), createElementBlock("div", _hoisted_1$g, toDisplayString(paginationInfo.value.totalPages) + " 页 · 每页 " + toDisplayString(paginationInfo.value.rowsPerPage) + " 行 ", 1)) : createCommentVNode("", true),
9902
+ needsPagination.value && !unref(store).isExporting && !usesReportPaginatedLayout.value && unref(store).showVariableNames ? (openBlock(), createElementBlock("div", _hoisted_1$f, toDisplayString(paginationInfo.value.totalPages) + " 页 · 每页 " + toDisplayString(paginationInfo.value.rowsPerPage) + " 行 ", 1)) : createCommentVNode("", true),
9864
9903
  !unref(store).isExporting && !usesReportPaginatedLayout.value && !isHeaderLeft.value ? (openBlock(), createElementBlock("div", _hoisted_2$7, [
9865
9904
  createElementVNode("table", {
9866
9905
  class: "w-full border-collapse flex-shrink-0",
@@ -10623,13 +10662,13 @@ const buildFieldCatalog = ({
10623
10662
  mappedCount: items.filter((item) => item.mapped).length
10624
10663
  };
10625
10664
  };
10626
- const _hoisted_1$f = {
10665
+ const _hoisted_1$e = {
10627
10666
  viewBox: "0 0 24 24",
10628
10667
  width: "1.2em",
10629
10668
  height: "1.2em"
10630
10669
  };
10631
10670
  function render$1(_ctx, _cache) {
10632
- return openBlock(), createElementBlock("svg", _hoisted_1$f, [..._cache[0] || (_cache[0] = [
10671
+ return openBlock(), createElementBlock("svg", _hoisted_1$e, [..._cache[0] || (_cache[0] = [
10633
10672
  createElementVNode("path", {
10634
10673
  fill: "currentColor",
10635
10674
  d: "m19.6 21l-6.3-6.3q-.75.6-1.725.95T9.5 16q-2.725 0-4.612-1.888T3 9.5t1.888-4.612T9.5 3t4.613 1.888T16 9.5q0 1.1-.35 2.075T14.7 13.3l6.3 6.3zM9.5 14q1.875 0 3.188-1.312T14 9.5t-1.312-3.187T9.5 5T6.313 6.313T5 9.5t1.313 3.188T9.5 14"
@@ -10637,13 +10676,13 @@ function render$1(_ctx, _cache) {
10637
10676
  ])]);
10638
10677
  }
10639
10678
  const SearchIcon = markRaw({ name: "material-symbols-search", render: render$1 });
10640
- const _hoisted_1$e = {
10679
+ const _hoisted_1$d = {
10641
10680
  viewBox: "0 0 24 24",
10642
10681
  width: "1.2em",
10643
10682
  height: "1.2em"
10644
10683
  };
10645
10684
  function render(_ctx, _cache) {
10646
- return openBlock(), createElementBlock("svg", _hoisted_1$e, [..._cache[0] || (_cache[0] = [
10685
+ return openBlock(), createElementBlock("svg", _hoisted_1$d, [..._cache[0] || (_cache[0] = [
10647
10686
  createElementVNode("path", {
10648
10687
  fill: "currentColor",
10649
10688
  d: "M6.4 19L5 17.6l5.6-5.6L5 6.4L6.4 5l5.6 5.6L17.6 5L19 6.4L13.4 12l5.6 5.6l-1.4 1.4l-5.6-5.6z"
@@ -10651,7 +10690,7 @@ function render(_ctx, _cache) {
10651
10690
  ])]);
10652
10691
  }
10653
10692
  const CloseIcon = markRaw({ name: "material-symbols-close", render });
10654
- const _hoisted_1$d = {
10693
+ const _hoisted_1$c = {
10655
10694
  class: "field-picker-dialog",
10656
10695
  role: "dialog",
10657
10696
  "aria-modal": "true"
@@ -10825,7 +10864,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
10825
10864
  onClick: _cache[2] || (_cache[2] = withModifiers(($event) => emit("close"), ["self"])),
10826
10865
  onKeydown: handleKeydown
10827
10866
  }, [
10828
- createElementVNode("section", _hoisted_1$d, [
10867
+ createElementVNode("section", _hoisted_1$c, [
10829
10868
  createElementVNode("header", _hoisted_2$6, [
10830
10869
  createElementVNode("div", _hoisted_3$4, [
10831
10870
  _cache[3] || (_cache[3] = createElementVNode("div", { class: "field-picker-mark" }, "F", -1)),
@@ -10938,7 +10977,7 @@ const _export_sfc = (sfc, props) => {
10938
10977
  return target;
10939
10978
  };
10940
10979
  const FieldSelectModal = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-774c4c6c"]]);
10941
- const _hoisted_1$c = ["rowspan", "colspan", "onMousedown", "onMouseenter", "onDblclick"];
10980
+ const _hoisted_1$b = ["rowspan", "colspan", "onMousedown", "onMouseenter", "onDblclick"];
10942
10981
  const _hoisted_2$5 = ["src"];
10943
10982
  const _hoisted_3$3 = { key: 0 };
10944
10983
  const _hoisted_4$1 = {
@@ -11759,7 +11798,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
11759
11798
  }), 128)),
11760
11799
  getCellRichTextSegments(row - 1, col - 1).length === 0 ? (openBlock(), createElementBlock("span", _hoisted_3$3, " ")) : createCommentVNode("", true)
11761
11800
  ], 64))
11762
- ], 46, _hoisted_1$c)), [
11801
+ ], 46, _hoisted_1$b)), [
11763
11802
  [vShow, shouldRenderCell(row - 1, col - 1)]
11764
11803
  ]);
11765
11804
  }), 128))
@@ -12144,7 +12183,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
12144
12183
  }
12145
12184
  });
12146
12185
  const CustomTableElement = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-a367d5a2"]]);
12147
- const _hoisted_1$b = { class: "page-number-text" };
12186
+ const _hoisted_1$a = { class: "page-number-text" };
12148
12187
  const _sfc_main$e = /* @__PURE__ */ defineComponent({
12149
12188
  __name: "PageNumberElement",
12150
12189
  props: {
@@ -12199,7 +12238,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
12199
12238
  padding: "0 4px"
12200
12239
  })
12201
12240
  }, toDisplayString(__props.element.labelText), 5)) : createCommentVNode("", true),
12202
- createElementVNode("span", _hoisted_1$b, toDisplayString(pageText.value), 1),
12241
+ createElementVNode("span", _hoisted_1$a, toDisplayString(pageText.value), 1),
12203
12242
  __props.element.labelText && __props.element.labelPosition === "after" ? (openBlock(), createElementBlock("span", {
12204
12243
  key: 1,
12205
12244
  style: normalizeStyle({
@@ -12219,7 +12258,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
12219
12258
  };
12220
12259
  }
12221
12260
  });
12222
- const _hoisted_1$a = { class: "w-full h-full flex items-center justify-center overflow-hidden" };
12261
+ const _hoisted_1$9 = { class: "w-full h-full flex items-center justify-center overflow-hidden" };
12223
12262
  const _sfc_main$d = /* @__PURE__ */ defineComponent({
12224
12263
  __name: "BarcodeElement",
12225
12264
  props: {
@@ -12247,7 +12286,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
12247
12286
  const renderBarcode = async () => {
12248
12287
  if (!barcodeRef.value) return;
12249
12288
  try {
12250
- const jsBarcodeModule = await import("./JsBarcode-5g1FBqni.js").then((n) => n.JsBarcode);
12289
+ const jsBarcodeModule = await import("./JsBarcode-XYc3_qaJ.js").then((n) => n.JsBarcode);
12251
12290
  const JsBarcode = (jsBarcodeModule == null ? void 0 : jsBarcodeModule.default) || jsBarcodeModule;
12252
12291
  const content = resolvedContent.value;
12253
12292
  const style = props.element.style;
@@ -12279,7 +12318,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
12279
12318
  if (registerRenderTask) registerRenderTask(task);
12280
12319
  }, { deep: true });
12281
12320
  return (_ctx, _cache) => {
12282
- return openBlock(), createElementBlock("div", _hoisted_1$a, [
12321
+ return openBlock(), createElementBlock("div", _hoisted_1$9, [
12283
12322
  createElementVNode("img", {
12284
12323
  ref_key: "barcodeRef",
12285
12324
  ref: barcodeRef,
@@ -12289,7 +12328,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
12289
12328
  };
12290
12329
  }
12291
12330
  });
12292
- const _hoisted_1$9 = { class: "w-full h-full flex items-center justify-center overflow-hidden" };
12331
+ const _hoisted_1$8 = { class: "w-full h-full flex items-center justify-center overflow-hidden" };
12293
12332
  const _hoisted_2$4 = ["src"];
12294
12333
  const _sfc_main$c = /* @__PURE__ */ defineComponent({
12295
12334
  __name: "QRCodeElement",
@@ -12317,7 +12356,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
12317
12356
  });
12318
12357
  const renderQR = async () => {
12319
12358
  try {
12320
- const qrcodeModule = await import("./browser-CdoI5PCM.js").then((n) => n.browser);
12359
+ const qrcodeModule = await import("./browser-C2DOr3jW.js").then((n) => n.browser);
12321
12360
  const QRCode = (qrcodeModule == null ? void 0 : qrcodeModule.default) || qrcodeModule;
12322
12361
  const content = resolvedContent.value;
12323
12362
  qrSrc.value = await QRCode.toDataURL(content, {
@@ -12341,7 +12380,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
12341
12380
  if (registerRenderTask) registerRenderTask(task);
12342
12381
  }, { deep: true });
12343
12382
  return (_ctx, _cache) => {
12344
- return openBlock(), createElementBlock("div", _hoisted_1$9, [
12383
+ return openBlock(), createElementBlock("div", _hoisted_1$8, [
12345
12384
  qrSrc.value ? (openBlock(), createElementBlock("img", {
12346
12385
  key: 0,
12347
12386
  src: qrSrc.value,
@@ -12352,7 +12391,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
12352
12391
  };
12353
12392
  }
12354
12393
  });
12355
- const _hoisted_1$8 = { class: "w-full h-full flex items-center justify-center" };
12394
+ const _hoisted_1$7 = { class: "w-full h-full flex items-center justify-center" };
12356
12395
  const _sfc_main$b = /* @__PURE__ */ defineComponent({
12357
12396
  __name: "LineElement",
12358
12397
  props: {
@@ -12360,7 +12399,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
12360
12399
  },
12361
12400
  setup(__props) {
12362
12401
  return (_ctx, _cache) => {
12363
- return openBlock(), createElementBlock("div", _hoisted_1$8, [
12402
+ return openBlock(), createElementBlock("div", _hoisted_1$7, [
12364
12403
  createElementVNode("div", {
12365
12404
  class: "w-full",
12366
12405
  style: normalizeStyle({
@@ -12412,7 +12451,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
12412
12451
  };
12413
12452
  }
12414
12453
  });
12415
- const _hoisted_1$7 = { class: "w-full h-full relative" };
12454
+ const _hoisted_1$6 = { class: "w-full h-full relative" };
12416
12455
  const _sfc_main$8 = /* @__PURE__ */ defineComponent({
12417
12456
  __name: "ChartElement",
12418
12457
  props: {
@@ -12963,7 +13002,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
12963
13002
  }
12964
13003
  }, { deep: true });
12965
13004
  return (_ctx, _cache) => {
12966
- return openBlock(), createElementBlock("div", _hoisted_1$7, [
13005
+ return openBlock(), createElementBlock("div", _hoisted_1$6, [
12967
13006
  createElementVNode("div", {
12968
13007
  ref_key: "chartRef",
12969
13008
  ref: chartRef,
@@ -12978,7 +13017,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
12978
13017
  };
12979
13018
  }
12980
13019
  });
12981
- const _hoisted_1$6 = ["data-auto-height"];
13020
+ const _hoisted_1$5 = ["data-auto-height"];
12982
13021
  const _hoisted_2$3 = {
12983
13022
  key: 1,
12984
13023
  class: "whitespace-pre-wrap"
@@ -13199,11 +13238,11 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
13199
13238
  }, toDisplayString(seg.text), 5);
13200
13239
  }), 128))
13201
13240
  ])) : (openBlock(), createElementBlock("div", _hoisted_3$2, toDisplayString(unref(t)("properties.label.longTextPlaceholder").split("\n")[0]), 1))
13202
- ], 44, _hoisted_1$6);
13241
+ ], 44, _hoisted_1$5);
13203
13242
  };
13204
13243
  }
13205
13244
  });
13206
- const _hoisted_1$5 = ["innerHTML"];
13245
+ const _hoisted_1$4 = ["innerHTML"];
13207
13246
  const _sfc_main$6 = /* @__PURE__ */ defineComponent({
13208
13247
  __name: "RichTextElement",
13209
13248
  props: {
@@ -13233,12 +13272,12 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
13233
13272
  padding: `${((_e = __props.element.style) == null ? void 0 : _e.padding) || 4}px`
13234
13273
  }),
13235
13274
  innerHTML: displayContent.value
13236
- }, null, 12, _hoisted_1$5);
13275
+ }, null, 12, _hoisted_1$4);
13237
13276
  };
13238
13277
  }
13239
13278
  });
13240
13279
  const RichTextElement = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-4f64b16f"]]);
13241
- const _hoisted_1$4 = { key: 0 };
13280
+ const _hoisted_1$3 = { key: 0 };
13242
13281
  const _hoisted_2$2 = { key: 1 };
13243
13282
  const _sfc_main$5 = /* @__PURE__ */ defineComponent({
13244
13283
  __name: "DateElement",
@@ -13283,12 +13322,12 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
13283
13322
  padding: `${((_e = __props.element.style) == null ? void 0 : _e.padding) || 4}px`
13284
13323
  })
13285
13324
  }, [
13286
- unref(renderContext).showVariableNames && __props.element.variable ? (openBlock(), createElementBlock("span", _hoisted_1$4, "{#" + toDisplayString(__props.element.variable) + "}", 1)) : (openBlock(), createElementBlock("span", _hoisted_2$2, toDisplayString(currentDate.value), 1))
13325
+ unref(renderContext).showVariableNames && __props.element.variable ? (openBlock(), createElementBlock("span", _hoisted_1$3, "{#" + toDisplayString(__props.element.variable) + "}", 1)) : (openBlock(), createElementBlock("span", _hoisted_2$2, toDisplayString(currentDate.value), 1))
13287
13326
  ], 4);
13288
13327
  };
13289
13328
  }
13290
13329
  });
13291
- const _hoisted_1$3 = { class: "flex items-baseline gap-1" };
13330
+ const _hoisted_1$2 = { class: "flex items-baseline gap-1" };
13292
13331
  const _hoisted_2$1 = {
13293
13332
  key: 0,
13294
13333
  class: "text-gray-400 text-sm"
@@ -13376,7 +13415,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
13376
13415
  class: "text-gray-500 mb-2",
13377
13416
  style: normalizeStyle({ fontSize: `${__props.element.labelFontSize || 12}px` })
13378
13417
  }, toDisplayString(resolvedData.value.label), 5),
13379
- createElementVNode("div", _hoisted_1$3, [
13418
+ createElementVNode("div", _hoisted_1$2, [
13380
13419
  createElementVNode("span", {
13381
13420
  class: "font-bold text-gray-900",
13382
13421
  style: normalizeStyle({ fontSize: `${__props.element.valueFontSize || 32}px` })
@@ -13414,7 +13453,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
13414
13453
  };
13415
13454
  }
13416
13455
  });
13417
- const _hoisted_1$2 = {
13456
+ const _hoisted_1$1 = {
13418
13457
  key: 4,
13419
13458
  class: "text-xs text-gray-400"
13420
13459
  };
@@ -13497,7 +13536,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
13497
13536
  class: "text-sm font-medium text-gray-700",
13498
13537
  style: normalizeStyle({ minWidth: "40px", textAlign: __props.element.progressLabelPosition === "outside" ? "left" : "right" })
13499
13538
  }, toDisplayString(resolvedProgress.value.percent) + "% ", 5)) : createCommentVNode("", true),
13500
- unref(renderContext).showVariableNames && __props.element.variable ? (openBlock(), createElementBlock("div", _hoisted_1$2, " {#" + toDisplayString(__props.element.variable) + "} ", 1)) : createCommentVNode("", true)
13539
+ unref(renderContext).showVariableNames && __props.element.variable ? (openBlock(), createElementBlock("div", _hoisted_1$1, " {#" + toDisplayString(__props.element.variable) + "} ", 1)) : createCommentVNode("", true)
13501
13540
  ], 4);
13502
13541
  };
13503
13542
  }
@@ -13564,7 +13603,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
13564
13603
  };
13565
13604
  }
13566
13605
  });
13567
- const _hoisted_1$1 = ["src", "alt"];
13606
+ const _hoisted_1 = ["src", "alt"];
13568
13607
  const _hoisted_2 = {
13569
13608
  key: 0,
13570
13609
  class: "text-center text-xs text-gray-500 mt-1"
@@ -13602,7 +13641,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
13602
13641
  src: displayImage.value,
13603
13642
  alt: __props.element.label || "印章/签名",
13604
13643
  class: "max-w-full max-h-full object-contain"
13605
- }, null, 8, _hoisted_1$1),
13644
+ }, null, 8, _hoisted_1),
13606
13645
  __props.element.label ? (openBlock(), createElementBlock("div", _hoisted_2, toDisplayString(__props.element.label), 1)) : createCommentVNode("", true)
13607
13646
  ], 64)) : showPlaceholder.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
13608
13647
  _cache[0] || (_cache[0] = createElementVNode("svg", {
@@ -13624,7 +13663,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
13624
13663
  };
13625
13664
  }
13626
13665
  });
13627
- const _hoisted_1 = { class: "preview-page" };
13628
13666
  const _sfc_main = /* @__PURE__ */ defineComponent({
13629
13667
  __name: "PreviewPage",
13630
13668
  props: {
@@ -13791,6 +13829,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
13791
13829
  const elementWrapperStyle = (element) => {
13792
13830
  var _a, _b, _c, _d;
13793
13831
  const base = {
13832
+ position: "absolute",
13794
13833
  left: `${element.x}px`,
13795
13834
  top: `${element.y}px`,
13796
13835
  width: `${element.width}px`,
@@ -13863,6 +13902,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
13863
13902
  });
13864
13903
  };
13865
13904
  const totalPages = computed(() => pages.value.length);
13905
+ const containerStyle = {
13906
+ display: "flex",
13907
+ flexDirection: "column",
13908
+ alignItems: "center",
13909
+ gap: "20px",
13910
+ padding: "20px",
13911
+ backgroundColor: "#f3f4f6"
13912
+ };
13913
+ const printPageBaseStyle = {
13914
+ background: "white",
13915
+ flexShrink: 0
13916
+ };
13866
13917
  const triggerRender = async () => {
13867
13918
  if (!props.autoRender) return;
13868
13919
  store.setIsExporting(true);
@@ -13892,17 +13943,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
13892
13943
  isReady
13893
13944
  });
13894
13945
  return (_ctx, _cache) => {
13895
- return openBlock(), createElementBlock("div", _hoisted_1, [
13946
+ return openBlock(), createElementBlock("div", { style: containerStyle }, [
13896
13947
  (openBlock(true), createElementBlock(Fragment, null, renderList(pages.value, (page, index) => {
13897
13948
  return openBlock(), createElementBlock("div", {
13898
13949
  key: page.id,
13899
- class: "print-page relative shadow-lg overflow-hidden",
13900
- style: normalizeStyle([pageStyle.value, watermarkStyle.value ? watermarkStyle.value : {}])
13950
+ style: normalizeStyle([printPageBaseStyle, { position: "relative", boxShadow: "0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06)", overflow: "hidden" }, pageStyle.value, watermarkStyle.value ? watermarkStyle.value : {}])
13901
13951
  }, [
13902
13952
  index > 0 && pages.value.length > 0 ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(getGlobalElements(), (element) => {
13903
13953
  return openBlock(), createElementBlock("div", {
13904
13954
  key: `global-${element.id}`,
13905
- class: "absolute",
13906
13955
  style: normalizeStyle(elementWrapperStyle(element))
13907
13956
  }, [
13908
13957
  (openBlock(), createBlock(resolveDynamicComponent(getComponent(element.type)), {
@@ -13915,7 +13964,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
13915
13964
  (openBlock(true), createElementBlock(Fragment, null, renderList(getRenderableElements(page.elements), (element) => {
13916
13965
  return openBlock(), createElementBlock("div", {
13917
13966
  key: element.id,
13918
- class: "absolute",
13919
13967
  style: normalizeStyle(elementWrapperStyle(element))
13920
13968
  }, [
13921
13969
  (openBlock(), createBlock(resolveDynamicComponent(getComponent(element.type)), {
@@ -13931,10 +13979,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
13931
13979
  };
13932
13980
  }
13933
13981
  });
13934
- const PreviewPage = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-9fd7d897"]]);
13935
13982
  export {
13936
13983
  PREVIEW_RENDER_CONTEXT_KEY,
13937
- PreviewPage,
13984
+ _sfc_main,
13938
13985
  collapseLoopPages,
13939
13986
  expandLoopPages,
13940
13987
  getDefaultExportFromCjs,