vue-print-designer 1.2.21 → 1.2.23

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.
@@ -34633,7 +34633,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
34633
34633
  const renderBarcode = async () => {
34634
34634
  if (!barcodeRef.value) return;
34635
34635
  try {
34636
- const jsBarcodeModule = await import("./JsBarcode-vgX9_Af1.js").then((n) => n.JsBarcode);
34636
+ const jsBarcodeModule = await import("./JsBarcode-iIIrJQPM.js").then((n) => n.JsBarcode);
34637
34637
  const JsBarcode = (jsBarcodeModule == null ? void 0 : jsBarcodeModule.default) || jsBarcodeModule;
34638
34638
  const content = resolvedContent.value;
34639
34639
  const style = props.element.style;
@@ -34779,7 +34779,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
34779
34779
  });
34780
34780
  const renderQR = async () => {
34781
34781
  try {
34782
- const qrcodeModule = await import("./browser-DGNDbP3U.js").then((n) => n.browser);
34782
+ const qrcodeModule = await import("./browser-2bHKo2Ab.js").then((n) => n.browser);
34783
34783
  const QRCode = (qrcodeModule == null ? void 0 : qrcodeModule.default) || qrcodeModule;
34784
34784
  const content = resolvedContent.value;
34785
34785
  qrSrc.value = await QRCode.toDataURL(content, {
@@ -37469,6 +37469,16 @@ const createPagination = ({ store }) => {
37469
37469
  const value = parseFloat(el.getAttribute(attr) || "");
37470
37470
  return Number.isFinite(value) ? value : fallback;
37471
37471
  };
37472
+ const getPageScaleY = (pageRect) => {
37473
+ if (pageHeight <= 0 || pageRect.height <= 0) return 1;
37474
+ return pageRect.height / pageHeight;
37475
+ };
37476
+ const pageYToViewportY = (pageRect, pageY) => {
37477
+ return pageRect.top + pageY * getPageScaleY(pageRect);
37478
+ };
37479
+ const viewportYToPageY = (pageRect, viewportY) => {
37480
+ return (viewportY - pageRect.top) / getPageScaleY(pageRect);
37481
+ };
37472
37482
  const getFlowKind = (wrapper) => wrapper.getAttribute("data-flow-kind") || "";
37473
37483
  const resolveAutoHeightContentEl = (wrapper) => {
37474
37484
  return wrapper.querySelector('[data-auto-height="true"]') || wrapper.querySelector(
@@ -37592,7 +37602,10 @@ const createPagination = ({ store }) => {
37592
37602
  );
37593
37603
  const originalBottom = originalTop + originalHeight;
37594
37604
  const contentRect = (table || autoHeightEl).getBoundingClientRect();
37595
- const finalBottomInPage = contentRect.bottom - pageRect.top;
37605
+ const finalBottomInPage = viewportYToPageY(
37606
+ pageRect,
37607
+ contentRect.bottom
37608
+ );
37596
37609
  const finalGlobalBottom = pageIndex * pageHeight + finalBottomInPage;
37597
37610
  const list = tableEntriesByOrigin.get(originPage) || [];
37598
37611
  const existing = list.find(
@@ -37652,8 +37665,8 @@ const createPagination = ({ store }) => {
37652
37665
  wrapper.getBoundingClientRect().height
37653
37666
  );
37654
37667
  const originalBottom = originalTop + originalHeight;
37655
- const isHeader = copyHeader && originalTop < headerHeight + marginTop2;
37656
- const isFooter = copyFooter && originalTop >= pageHeight - footerHeight - marginBottom2;
37668
+ const isHeader = headerHeight > 0 && originalTop < headerHeight + marginTop2;
37669
+ const isFooter = footerHeight > 0 && originalTop >= pageHeight - footerHeight - marginBottom2;
37657
37670
  if (isHeader || isFooter) return;
37658
37671
  const currentTop = parseFloat(wrapper.style.top || "") || 0;
37659
37672
  const currentParent = wrapper.parentElement;
@@ -37687,8 +37700,10 @@ const createPagination = ({ store }) => {
37687
37700
  let targetPageIndex = Math.floor(targetGlobalTop / pageHeight);
37688
37701
  if (targetPageIndex < 0) targetPageIndex = 0;
37689
37702
  let targetTop = targetGlobalTop - targetPageIndex * pageHeight;
37690
- const minContentTop = copyHeader && headerHeight > 0 ? headerHeight + marginTop2 : marginTop2;
37691
- const maxContentBottom = pageHeight - (copyFooter ? footerHeight : 0) - marginBottom2;
37703
+ const effectiveHeaderHeight = headerHeight > 0 ? headerHeight : 0;
37704
+ const minContentTop = marginTop2 + effectiveHeaderHeight;
37705
+ const effectiveFooterHeight = footerHeight > 0 ? footerHeight : 0;
37706
+ const maxContentBottom = pageHeight - effectiveFooterHeight - marginBottom2;
37692
37707
  const availableContentHeight = maxContentBottom - minContentTop;
37693
37708
  const isFlowWrapper = wrapper.hasAttribute("data-flow-id");
37694
37709
  const wrapperRectHeight = wrapper.getBoundingClientRect().height;
@@ -37776,7 +37791,8 @@ const createPagination = ({ store }) => {
37776
37791
  );
37777
37792
  const resolveFlowChunkStartY = (wrapper) => {
37778
37793
  const marginTop2 = store.pageSpacingY || 0;
37779
- const minTop = copyHeader && headerHeight > 0 ? headerHeight + marginTop2 : marginTop2;
37794
+ const effectiveHeaderHeight = headerHeight > 0 ? headerHeight : 0;
37795
+ const minTop = marginTop2 + effectiveHeaderHeight;
37780
37796
  let startY = minTop;
37781
37797
  const originalTopVal = parseAttrNumber(
37782
37798
  wrapper,
@@ -37875,8 +37891,11 @@ const createPagination = ({ store }) => {
37875
37891
  pages.forEach((page) => {
37876
37892
  const pageRect = page.getBoundingClientRect();
37877
37893
  const marginBottom2 = store.pageSpacingY || 0;
37878
- const effectiveFooterHeight = copyFooter ? footerHeight : 0;
37879
- const limitBottom = pageRect.top + pageHeight - effectiveFooterHeight - marginBottom2;
37894
+ const effectiveFooterHeight = footerHeight > 0 ? footerHeight : 0;
37895
+ const limitBottom = pageYToViewportY(
37896
+ pageRect,
37897
+ pageHeight - effectiveFooterHeight - marginBottom2
37898
+ );
37880
37899
  const wrappers = Array.from(
37881
37900
  page.querySelectorAll(
37882
37901
  "[data-print-wrapper][data-flow-id][data-flow-paginated]"
@@ -38025,10 +38044,13 @@ const createPagination = ({ store }) => {
38025
38044
  }
38026
38045
  const pageRect = page.getBoundingClientRect();
38027
38046
  const marginBottom2 = store.pageSpacingY || 0;
38028
- const effectiveFooterHeight = copyFooter ? footerHeight : 0;
38029
- const limitBottom = pageRect.top + pageHeight - effectiveFooterHeight - marginBottom2;
38047
+ const effectiveFooterHeight = footerHeight > 0 ? footerHeight : 0;
38048
+ const limitBottom = pageYToViewportY(
38049
+ pageRect,
38050
+ pageHeight - effectiveFooterHeight - marginBottom2
38051
+ );
38030
38052
  const wrapperRect = wrapper.getBoundingClientRect();
38031
- const wrapperTopInPage = wrapperRect.top - pageRect.top;
38053
+ const wrapperTopInPage = viewportYToPageY(pageRect, wrapperRect.top);
38032
38054
  if (isAutoHeight) {
38033
38055
  if (!autoHeightEl) return;
38034
38056
  const contentRect = autoHeightEl.getBoundingClientRect();
@@ -38132,7 +38154,8 @@ const createPagination = ({ store }) => {
38132
38154
  }
38133
38155
  }
38134
38156
  resolveFlowChunkStartY(wrapper);
38135
- const minTop = copyHeader && headerHeight > 0 ? headerHeight + (store.pageSpacingY || 0) : store.pageSpacingY || 0;
38157
+ const effectiveHeaderHeight = headerHeight > 0 ? headerHeight : 0;
38158
+ const minTop = (store.pageSpacingY || 0) + effectiveHeaderHeight;
38136
38159
  if (splitIndex === 0) {
38137
38160
  if (wrapperTopInPage <= minTop + 5) {
38138
38161
  splitIndex = 1;
@@ -38225,8 +38248,8 @@ const createPagination = ({ store }) => {
38225
38248
  const isRepeatPerPage = w.getAttribute("data-repeat-per-page") === "true";
38226
38249
  if (isRepeatPerPage) return false;
38227
38250
  const top = parseFloat(w.style.top) || 0;
38228
- const isHeader = copyHeader && top < headerHeight + marginTop;
38229
- const isFooter = copyFooter && top >= pageHeight - footerHeight - marginBottom;
38251
+ const isHeader = headerHeight > 0 && top < headerHeight + marginTop;
38252
+ const isFooter = footerHeight > 0 && top >= pageHeight - footerHeight - marginBottom;
38230
38253
  if (isHeader || isFooter) return false;
38231
38254
  return true;
38232
38255
  });
@@ -38310,7 +38333,7 @@ const createImageRenderer = (deps) => {
38310
38333
  const svgToCanvas = async (root) => {
38311
38334
  const svgs = root.querySelectorAll("svg");
38312
38335
  if (svgs.length === 0) return;
38313
- const { Canvg } = await import("./index.es-C4KWgcHt.js");
38336
+ const { Canvg } = await import("./index.es-Bf1e4H7i.js");
38314
38337
  svgs.forEach((svg) => {
38315
38338
  const parent = svg.parentElement;
38316
38339
  if (!parent) return;
@@ -38636,7 +38659,7 @@ const createImageRenderer = (deps) => {
38636
38659
  }
38637
38660
  try {
38638
38661
  const generatePageImage = async (page) => {
38639
- const domToImageModule = await import("./dom-to-image-more.min-BZ9FRhxR.js").then((n) => n.domToImageMore_min);
38662
+ const domToImageModule = await import("./dom-to-image-more.min-BZqnh4IZ.js").then((n) => n.domToImageMore_min);
38640
38663
  const domtoimage = (domToImageModule == null ? void 0 : domToImageModule.default) || domToImageModule;
38641
38664
  const canvas = await domtoimage.toCanvas(page, {
38642
38665
  filter: (node) => {
@@ -38705,7 +38728,7 @@ const createImageRenderer = (deps) => {
38705
38728
  source.getComputedStyleFn
38706
38729
  );
38707
38730
  tempWrapper = wrapper;
38708
- const jsPdfModule = await import("./jspdf.es.min-ChNFtJOU.js");
38731
+ const jsPdfModule = await import("./jspdf.es.min-T3zgWBJA.js");
38709
38732
  const jsPDF = (jsPdfModule == null ? void 0 : jsPdfModule.default) || (jsPdfModule == null ? void 0 : jsPdfModule.jsPDF) || jsPdfModule;
38710
38733
  const pdf = new jsPDF({
38711
38734
  orientation: width > height ? "l" : "p",
@@ -39087,7 +39110,7 @@ const usePrint = () => {
39087
39110
  link.click();
39088
39111
  document.body.removeChild(link);
39089
39112
  } else {
39090
- const jsZipModule = await import("./jszip.min-BV1cV44d.js").then((n) => n.jszip_min);
39113
+ const jsZipModule = await import("./jszip.min-C69aQvfj.js").then((n) => n.jszip_min);
39091
39114
  const JSZip = (jsZipModule == null ? void 0 : jsZipModule.default) || jsZipModule;
39092
39115
  const zip = new JSZip();
39093
39116
  await Promise.all(
@@ -39388,7 +39411,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
39388
39411
  emits: ["update:visible", "update:value", "close", "save"],
39389
39412
  setup(__props, { emit: __emit }) {
39390
39413
  const Editor = /* @__PURE__ */ defineAsyncComponent(
39391
- () => import("./index-eOImZGkP.js").then((m) => m.Editor)
39414
+ () => import("./index-DsteMaFh.js").then((m) => m.Editor)
39392
39415
  );
39393
39416
  const { t } = useI18n();
39394
39417
  const { isDark: isDark2 } = useTheme();
@@ -45495,7 +45518,7 @@ function render$d(_ctx, _cache) {
45495
45518
  }
45496
45519
  const InfoIcon = markRaw({ name: "material-symbols-info", render: render$d });
45497
45520
  const name = "vue-print-designer";
45498
- const version = "1.2.21";
45521
+ const version = "1.2.23";
45499
45522
  const dependencies = { "@guolao/vue-monaco-editor": "^1.6.0", "canvg": "^3.0.11", "dom-to-image-more": "^3.7.2", "jsbarcode": "^3.12.3", "jspdf": "4.2", "jszip": "^3.10.1", "lodash": "^4.17.21", "pinia": "^2.3.0", "qrcode": "^1.5.4", "uuid": "^11.0.3", "vue": "^3.5.13", "vue-i18n": "^11.2.8" };
45500
45523
  const devDependencies = { "@iconify-json/material-symbols": "^1.2.53", "@types/jsbarcode": "^3.11.4", "@types/lodash": "^4.17.13", "@types/node": "^22.10.2", "@types/qrcode": "^1.5.6", "@types/uuid": "^10.0.0", "@vitejs/plugin-vue": "^5.2.1", "@vue/tsconfig": "^0.7.0", "autoprefixer": "^10.4.20", "postcss": "^8.4.49", "rollup-plugin-visualizer": "^7.0.1", "sharp": "^0.34.5", "tailwindcss": "^3.4.17", "terser": "^5.46.1", "typescript": "~5.6.2", "unplugin-icons": "^23.0.1", "vite": "^6.0.1", "vue-tsc": "^2.1.10" };
45501
45524
  const pkg = {
@@ -48349,7 +48372,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
48349
48372
  emits: ["update:value"],
48350
48373
  setup(__props, { emit: __emit }) {
48351
48374
  const Editor = /* @__PURE__ */ defineAsyncComponent(
48352
- () => import("./index-eOImZGkP.js").then((m) => m.Editor)
48375
+ () => import("./index-DsteMaFh.js").then((m) => m.Editor)
48353
48376
  );
48354
48377
  const emit2 = __emit;
48355
48378
  useDesignerStore();
@@ -50904,7 +50927,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
50904
50927
  };
50905
50928
  const renderBarcodeDataUrl = async (element) => {
50906
50929
  try {
50907
- const jsBarcodeModule = await import("./JsBarcode-vgX9_Af1.js").then((n) => n.JsBarcode);
50930
+ const jsBarcodeModule = await import("./JsBarcode-iIIrJQPM.js").then((n) => n.JsBarcode);
50908
50931
  const JsBarcode = (jsBarcodeModule == null ? void 0 : jsBarcodeModule.default) || jsBarcodeModule;
50909
50932
  const canvas = document.createElement("canvas");
50910
50933
  const style = element.style || {};
@@ -50931,7 +50954,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
50931
50954
  const renderQrDataUrl = async (element) => {
50932
50955
  var _a2, _b;
50933
50956
  try {
50934
- const qrcodeModule = await import("./browser-DGNDbP3U.js").then((n) => n.browser);
50957
+ const qrcodeModule = await import("./browser-2bHKo2Ab.js").then((n) => n.browser);
50935
50958
  const QRCode = (qrcodeModule == null ? void 0 : qrcodeModule.default) || qrcodeModule;
50936
50959
  return await QRCode.toDataURL(getResolvedContent(element), {
50937
50960
  margin: 0,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vue-print-designer",
3
3
  "private": false,
4
- "version": "1.2.21",
4
+ "version": "1.2.23",
5
5
  "license": "AGPL-3.0-only",
6
6
  "type": "module",
7
7
  "main": "dist/print-designer.umd.js",