vg-print 1.1.510 → 1.1.512

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 (2) hide show
  1. package/dist/vg-print.es.js +55 -27
  2. package/package.json +1 -1
@@ -37564,7 +37564,7 @@ var i18n = {
37564
37564
  designTarget: We,
37565
37565
  onDrag: function(En, Mn, Fn) {
37566
37566
  var Rn = We.panel.printElements.filter(function(Ca) {
37567
- return Ca.designTarget.children().last().css("display") == "block" && Ca.designTarget.children().last().hasClass("selected") && !Ca.printElementType.type.includes("table");
37567
+ return !!(Ca && Ca.designTarget && Ca.designTarget.length && Ca.designTarget.children && Ca.printElementType) && Ca.designTarget.children().last().css("display") == "block" && Ca.designTarget.children().last().hasClass("selected") && !(Ca.printElementType.type || "").includes("table");
37568
37568
  }), kn = Rn.length > 1, Aa = !We.designTarget.children().last().hasClass("selected");
37569
37569
  if (kn) {
37570
37570
  var ia = Mn - We.options.left, $n = Fn - We.options.top;
@@ -37595,7 +37595,7 @@ var i18n = {
37595
37595
  onStopDrag: function(En) {
37596
37596
  _HiPrintlib__WEBPACK_IMPORTED_MODULE_6__.a.instance.changed && hinnn.event.trigger("hiprintTemplateDataChanged_" + We.templateId, "移动"), _HiPrintlib__WEBPACK_IMPORTED_MODULE_6__.a.instance.draging = !1, _HiPrintlib__WEBPACK_IMPORTED_MODULE_6__.a.instance.changed = !1;
37597
37597
  var Mn = We.panel.printElements.filter(function(Fn) {
37598
- return Fn.designTarget.children().last().css("display") == "block" && !Fn.printElementType.type.includes("table");
37598
+ return !!(Fn && Fn.designTarget && Fn.designTarget.length && Fn.designTarget.children && Fn.printElementType) && Fn.designTarget.children().last().css("display") == "block" && !(Fn.printElementType.type || "").includes("table");
37599
37599
  });
37600
37600
  Mn.length > 1 ? Mn.forEach(function(Fn) {
37601
37601
  Fn.removeLineOfPosition();
@@ -37851,7 +37851,7 @@ var i18n = {
37851
37851
  var We = this.getField(), St = De ? We ? getValueByPath(De, We) : "" : this.printElementType.getData();
37852
37852
  St == null && (St = "");
37853
37853
  var An = this.getFormatter();
37854
- return An && St !== "" && (St = An(St, this.options, De, _e)), St;
37854
+ return An && St !== "" && (St = this._callFormatterSafely(An, [St, this.options, De, _e], St)), St;
37855
37855
  }, BasePrintElement.prototype.copyFromType = function() {
37856
37856
  var De = this.options, _e = this.printElementType, We = this.getConfigOptions(), St = [];
37857
37857
  return We && We.tabs && We.tabs.length ? We.tabs.forEach(function(An) {
@@ -38038,6 +38038,20 @@ var i18n = {
38038
38038
  console.log(De);
38039
38039
  }
38040
38040
  return formatter;
38041
+ }, BasePrintElement.prototype._callFormatterSafely = function(De, _e, We) {
38042
+ try {
38043
+ return De.apply(null, _e || []);
38044
+ } catch (An) {
38045
+ var St = An && An.message ? An.message : String(An);
38046
+ if (this._formatterErrorsLogged = this._formatterErrorsLogged || {}, !this._formatterErrorsLogged[St]) {
38047
+ this._formatterErrorsLogged[St] = !0;
38048
+ try {
38049
+ console.warn("[vg-print] formatter 执行失败,已回退为原始字段值:", An);
38050
+ } catch {
38051
+ }
38052
+ }
38053
+ return We;
38054
+ }
38041
38055
  }, BasePrintElement.prototype.getStyler = function() {
38042
38056
  var fnstyler = void 0;
38043
38057
  if (this.printElementType.styler && (fnstyler = this.printElementType.styler), this.options.styler) try {
@@ -38061,7 +38075,7 @@ var i18n = {
38061
38075
  }
38062
38076
  if (!(We._editing && !Cn.altKey) && We.options.draggable !== !1) {
38063
38077
  var Mn = We.panel.printElements.filter(function(Aa) {
38064
- return Aa.designTarget.children().last().css("display") == "block" && !Aa.printElementType.type.includes("table");
38078
+ return !!(Aa && Aa.designTarget && Aa.designTarget.length && Aa.designTarget.children && Aa.printElementType) && Aa.designTarget.children().last().css("display") == "block" && !(Aa.printElementType.type || "").includes("table");
38065
38079
  }), Fn = Mn.length > 1, Rn = _HiPrintConfig__WEBPACK_IMPORTED_MODULE_1__.a.instance.movingDistance;
38066
38080
  switch (Cn.keyCode) {
38067
38081
  case 8:
@@ -46822,7 +46836,7 @@ ${i18n.__("转大小写")}
46822
46836
  if (St(ia), !(ia.ctrlKey || ia.metaKey) && (ia.data.target.className.startsWith("resize-panel") || ia.data.target.style.zIndex == "2" || ia.data.target.className.startsWith("hiprint-printElement"))) {
46823
46837
  var Ca = ia.data;
46824
46838
  if (We(".mouseRect").length == 0 && $n.options.designTarget && $n.options.designTarget.panel.printElements.filter(function(ka) {
46825
- return ka.designTarget.children().last().css("display") == "block" && !ka.printElementType.type.includes("table");
46839
+ return !!(ka && ka.designTarget && ka.designTarget.length && ka.designTarget.children && ka.printElementType) && ka.designTarget.children().last().css("display") == "block" && !(ka.printElementType.type || "").includes("table");
46826
46840
  }).length <= 1) {
46827
46841
  let ka = window.hinnn.px.toPt(Ca.left), za = window.hinnn.px.toPt(Ca.top), Ha = $n.options.designTarget.options;
46828
46842
  Ha.left = ka, Ha.top = za, Ha.right = ka + Ha.width, Ha.bottom = za + Ha.height, Ha.vCenter = ka + Ha.width / 2, Ha.hCenter = za + Ha.height / 2, (() => {
@@ -48070,7 +48084,7 @@ ${i18n.__("转大小写")}
48070
48084
  var St = "", An = this.getField();
48071
48085
  We ? St = An ? getValueByPath(We, An) : this.options.src || this.printElementType.getData() : St = this.options.src || this.printElementType.getData(), St == null && (St = "");
48072
48086
  var Cn = this.getFormatter();
48073
- return Cn && (St = Cn(St, this.options, this._currenttemplateData)), St ?? "";
48087
+ return Cn && (St = this._callFormatterSafely(Cn, [St, this.options, this._currenttemplateData], St)), St ?? "";
48074
48088
  }, _e.prototype.createTarget = function(We, St) {
48075
48089
  var An = $$h('<div class="hiprint-printElement hiprint-printElement-image" style="position: absolute;display:flex;flex-direction:column;"><div class="hiprint-printElement-image-title" style="text-align:left;flex:0 0 auto;display:none;"></div><div class="hiprint-printElement-image-content" style="flex:1 1 auto;min-height:0;width:100%"></div></div>');
48076
48090
  return this.updateTargetImage(An, We, St), An;
@@ -48382,8 +48396,8 @@ ${i18n.__("转大小写")}
48382
48396
  var An = this.getFormatter(), Cn = St ?? "";
48383
48397
  return Cn = this.options.leftSpaceRemoved != 0 ? Cn.toString().replace(/^\s*/, "") : Cn, this.getField() ? {
48384
48398
  title: this.options.getHideTitle() ? "" : We ? We + ":" : "",
48385
- body: An ? An(We, Cn, this.options, this._currenttemplateData) : Cn
48386
- } : { title: "", body: An ? An(We, We, this.options, this._currenttemplateData) : Cn || We || "" };
48399
+ body: An ? this._callFormatterSafely(An, [We, Cn, this.options, this._currenttemplateData], Cn) : Cn
48400
+ } : { title: "", body: An ? this._callFormatterSafely(An, [We, We, this.options, this._currenttemplateData], We) : Cn || We || "" };
48387
48401
  }, _e.prototype.getStructuredContentParts = function(We, St) {
48388
48402
  var An = this.getContentParts(We, St);
48389
48403
  return this.getContentIndent() === 0 && !this.getField() && (An.body = this.getText(We, St)), An;
@@ -48418,7 +48432,7 @@ ${i18n.__("转大小写")}
48418
48432
  return this.updateTargetText(An, We, St), An;
48419
48433
  }, _e.prototype.getText = function(We, St) {
48420
48434
  var An = this.getFormatter();
48421
- return St && (St = this.options.leftSpaceRemoved != 0 ? St.toString().replace(/^\s*/, "") : St), (this.getField() ? (this.options.getHideTitle() ? "" : We ? We + ":" : "") + (An ? An(We, St, this.options, this._currenttemplateData) : St) : An ? An(We, We, this.options, this._currenttemplateData) : We || "") || "";
48435
+ return St && (St = this.options.leftSpaceRemoved != 0 ? St.toString().replace(/^\s*/, "") : St), (this.getField() ? (this.options.getHideTitle() ? "" : We ? We + ":" : "") + (An ? this._callFormatterSafely(An, [We, St, this.options, this._currenttemplateData], St) : St) : An ? this._callFormatterSafely(An, [We, We, this.options, this._currenttemplateData], We) : We || "") || "";
48422
48436
  }, _e.prototype.getHtml = function(We, St) {
48423
48437
  this.setCurrenttemplateData(St), this.createTempContainer();
48424
48438
  var An = this.getPaperHtmlResult(We, St);
@@ -48638,7 +48652,7 @@ ${i18n.__("转大小写")}
48638
48652
  var Mn = this.getFormatter(), Fn = We.find(".hiprint-printElement-text-content"), Rn = "", kn = this.options.getTextType(), Aa = this.options.getHideTitle();
48639
48653
  Aa === "true" && (Aa = !0), Aa === "false" && (Aa = !1);
48640
48654
  var ia = this.getField() && !Aa && St ? St + ":" : "", $n, Ca = !1;
48641
- if (this.getField() ? ($n = hinnn.toUpperCase(this.options.upperCase, Mn ? Mn(St, An, this.options, this._currenttemplateData, We, Cn) : An), Rn = ia + $n, Ca = kn == "text" && this.hasCustomTitleStyle() && !!ia) : (An = hinnn.toUpperCase(this.options.upperCase, Mn ? Mn(St, St, this.options, this._currenttemplateData, We, Cn) : St), Rn = An), !this.getField() && Aa && kn == "text" && (Rn = ""), kn == "text")
48655
+ if (this.getField() ? ($n = hinnn.toUpperCase(this.options.upperCase, Mn ? this._callFormatterSafely(Mn, [St, An, this.options, this._currenttemplateData, We, Cn], An) : An), Rn = ia + $n, Ca = kn == "text" && this.hasCustomTitleStyle() && !!ia) : (An = hinnn.toUpperCase(this.options.upperCase, Mn ? this._callFormatterSafely(Mn, [St, St, this.options, this._currenttemplateData, We, Cn], St) : St), Rn = An), !this.getField() && Aa && kn == "text" && (Rn = ""), kn == "text")
48642
48656
  if (Ca) {
48643
48657
  Fn.empty();
48644
48658
  var Ma = $$h('<span class="hiprint-printElement-text-title"></span>').text(ia), Na = $$h('<span class="hiprint-printElement-text-body"></span>').html($n ?? String($n));
@@ -52511,7 +52525,7 @@ ${i18n.__("转大小写")}
52511
52525
  var _e = Date.now();
52512
52526
  console.log("start", _e);
52513
52527
  var We = this;
52514
- this.index = De.index, this.name = De.name, this.nameField = De.nameField, this.width = De.width, this.height = De.height, this.paperType = De.paperType, this.paperHeader = De.paperHeader, this.paperFooter = De.paperFooter, this.designPaper.width = o.a.mm.toPt(De.width), this.designPaper.height = o.a.mm.toPt(this.height), this.designPaper.paperType = this.paperType, this.designPaper.paperHeader = this.paperHeader, this.designPaper.paperFooter = this.paperFooter, this.designPaper.mmheight = De.height, this.designPaper.mmwidth = De.width, this.designPaper.headerLinetarget.css("top", (this.paperHeader || -1) + "pt"), this.paperHeader == 0 ? this.designPaper.headerLinetarget.addClass("hideheaderLinetarget") : this.designPaper.headerLinetarget.removeClass("hideheaderLinetarget"), this.designPaper.footerLinetarget.css("top", parseInt(this.paperFooter.toString()) + "pt"), this.paperFooter >= this.designPaper.height ? (this.designPaper.footerLinetarget.css("top", De.height - p.a.instance.paperHeightTrim + "mm"), this.designPaper.footerLinetarget.addClass("hidefooterLinetarget")) : this.designPaper.footerLinetarget.removeClass("hidefooterLinetarget"), this.watermarkOptions = De.watermarkOptions || {}, this.designPaper.createWaterMark(!0, this.index, this.watermarkOptions), this.paperNumberLeft = De.paperNumberLeft, this.paperNumberTop = De.paperNumberTop, this.paperNumberDisabled = De.paperNumberDisabled, this.paperNumberContinue = De.paperNumberContinue, this.paperNumberFormat = De.paperNumberFormat, this.designPaper.paperNumberLeft = this.paperNumberLeft, this.designPaper.paperNumberTop = this.paperNumberTop, this.designPaper.paperNumberDisabled = this.paperNumberDisabled, this.designPaper.paperNumberContinue = this.paperNumberContinue, this.designPaper.paperNumberFormat = this.paperNumberFormat, this.designPaper.paperNumberTarget.css("top", this.paperNumberTop + "pt").css("left", this.paperNumberLeft + "pt"), this.designPaper.resetPaperNumber(this.designPaper.paperNumberTarget), this.fontFamily = De.fontFamily, this.orient = De.orient, this.rotate = De.rotate, this.scale = De.scale, this.designPaper.fontFamily = this.fontFamily, this.designPaper.orient = this.orient, this.designPaper.scale = We.designPaper.scale || this.scale, this.panelLayoutOptions = De.panelLayoutOptions, this.panelPaperRule = De.panelPaperRule, this.panelPageRule = De.panelPageRule, this.firstPaperFooter = De.firstPaperFooter, this.evenPaperFooter = De.evenPaperFooter, this.oddPaperFooter = De.oddPaperFooter, this.lastPaperFooter = De.lastPaperFooter, this.topOffset = De.topOffset, this.leftOffset = De.leftOffset, this.expandCss = (De.expandCss != null ? De.expandCss : De.extCss) || this.expandCss || "", this.designPaper.setFooter(this.firstPaperFooter, this.evenPaperFooter, this.oddPaperFooter, this.lastPaperFooter), this.designPaper.setOffset(this.leftOffset, this.topOffset);
52528
+ this.index = De.index, this.name = De.name, this.nameField = De.nameField, this.width = De.width, this.height = De.height, this.paperType = De.paperType, this.paperHeader = De.paperHeader, this.paperFooter = De.paperFooter, this.designPaper.width = o.a.mm.toPt(De.width), this.designPaper.height = o.a.mm.toPt(this.height), this.designPaper.paperType = this.paperType, this.designPaper.paperHeader = this.paperHeader, this.designPaper.paperFooter = this.paperFooter, this.designPaper.mmheight = De.height, this.designPaper.mmwidth = De.width, this.designPaper.target && this.designPaper.target.length && (this.designPaper.target.css("width", De.width + "mm"), this.designPaper.target.css("height", De.height - p.a.instance.paperHeightTrim + "mm"), this.designPaper.target.attr("original-height", De.height)), this.designPaper.contentHeight = this.designPaper.paperFooter - this.designPaper.paperHeader, this.designPaper.headerLinetarget.css("top", (this.paperHeader || -1) + "pt"), this.paperHeader == 0 ? this.designPaper.headerLinetarget.addClass("hideheaderLinetarget") : this.designPaper.headerLinetarget.removeClass("hideheaderLinetarget"), this.designPaper.footerLinetarget.css("top", parseInt(this.paperFooter.toString()) + "pt"), this.paperFooter >= this.designPaper.height ? (this.designPaper.footerLinetarget.css("top", De.height - p.a.instance.paperHeightTrim + "mm"), this.designPaper.footerLinetarget.addClass("hidefooterLinetarget")) : this.designPaper.footerLinetarget.removeClass("hidefooterLinetarget"), this.watermarkOptions = De.watermarkOptions || {}, this.designPaper.createWaterMark(!0, this.index, this.watermarkOptions), this.paperNumberLeft = De.paperNumberLeft, this.paperNumberTop = De.paperNumberTop, this.paperNumberDisabled = De.paperNumberDisabled, this.paperNumberContinue = De.paperNumberContinue, this.paperNumberFormat = De.paperNumberFormat, this.designPaper.paperNumberLeft = this.paperNumberLeft, this.designPaper.paperNumberTop = this.paperNumberTop, this.designPaper.paperNumberDisabled = this.paperNumberDisabled, this.designPaper.paperNumberContinue = this.paperNumberContinue, this.designPaper.paperNumberFormat = this.paperNumberFormat, this.designPaper.paperNumberTarget.css("top", this.paperNumberTop + "pt").css("left", this.paperNumberLeft + "pt"), this.designPaper.resetPaperNumber(this.designPaper.paperNumberTarget), this.fontFamily = De.fontFamily, this.orient = De.orient, this.rotate = De.rotate, this.scale = De.scale, this.designPaper.fontFamily = this.fontFamily, this.designPaper.orient = this.orient, this.designPaper.scale = We.designPaper.scale || this.scale, this.panelLayoutOptions = De.panelLayoutOptions, this.panelPaperRule = De.panelPaperRule, this.panelPageRule = De.panelPageRule, this.firstPaperFooter = De.firstPaperFooter, this.evenPaperFooter = De.evenPaperFooter, this.oddPaperFooter = De.oddPaperFooter, this.lastPaperFooter = De.lastPaperFooter, this.topOffset = De.topOffset, this.leftOffset = De.leftOffset, this.expandCss = (De.expandCss != null ? De.expandCss : De.extCss) || this.expandCss || "", this.designPaper.setFooter(this.firstPaperFooter, this.evenPaperFooter, this.oddPaperFooter, this.lastPaperFooter), this.designPaper.setOffset(this.leftOffset, this.topOffset);
52515
52529
  var St = Date.now();
52516
52530
  this.printElements.forEach(function(An) {
52517
52531
  An.designTarget && An.designTarget.length && An.designTarget.remove();
@@ -52679,23 +52693,27 @@ ${i18n.__("转大小写")}
52679
52693
  Da || (Da = va === "eachPageFooter" ? "contentBottomLeft" : "contentTopLeft");
52680
52694
  var ka = Number(Sa.options && Sa.options.followOffsetX || 0);
52681
52695
  Number.isFinite(ka) || (ka = 0);
52682
- var za = La + ka, Ha = Sa.getData(St) || "", $a = Sa.createTarget(Sa.getTitle(), Ha, _e.index);
52683
- Sa.updateTargetSize($a), Sa.css($a, Ha);
52684
- var Wa = 0;
52696
+ var za = La + ka;
52697
+ typeof Sa.setCurrenttemplateData == "function" && Sa.setCurrenttemplateData(St);
52698
+ var Ha = Sa.getData(St) || "", $a = typeof Sa.getEmptyDataDisplayMode == "function" ? Sa.getEmptyDataDisplayMode(Ha) : "";
52699
+ if ($a === "collapse") return;
52700
+ var Wa = Sa.createTarget(Sa.getTitle(), Ha, _e.index);
52701
+ Sa.updateTargetSize(Wa), Sa.css(Wa, Ha), $a === "placeholder" && Wa.css("visibility", "hidden");
52702
+ var Za = 0;
52685
52703
  try {
52686
- Wa = Number(Sa.options.getHeight ? Sa.options.getHeight() : Sa.options.height) || 0;
52704
+ Za = Number(Sa.options.getHeight ? Sa.options.getHeight() : Sa.options.height) || 0;
52687
52705
  } catch {
52688
52706
  }
52689
- (!Number.isFinite(Wa) || Wa < 0) && (Wa = 0);
52690
- var Za = Fa;
52707
+ (!Number.isFinite(Za) || Za < 0) && (Za = 0);
52708
+ var Po = Fa;
52691
52709
  if (Da === "contentBottomLeft") {
52692
- var Po = Number(Sa.options && Sa.options.followOffsetYFromBottom || 0);
52693
- Number.isFinite(Po) || (Po = 0), Za = Ua - Wa + Po;
52710
+ var Ro = Number(Sa.options && Sa.options.followOffsetYFromBottom || 0);
52711
+ Number.isFinite(Ro) || (Ro = 0), Po = Ua - Za + Ro;
52694
52712
  } else {
52695
- var Ro = Number(Sa.options && Sa.options.followOffsetY || 0);
52696
- Number.isFinite(Ro) || (Ro = 0), Za = Fa + Ro;
52713
+ var rl = Number(Sa.options && Sa.options.followOffsetY || 0);
52714
+ Number.isFinite(rl) || (rl = 0), Po = Fa + rl;
52697
52715
  }
52698
- $a.css("position", "absolute"), $a.css("left", za + "pt"), $a.css("top", Za + "pt"), _e.append($a);
52716
+ Wa.css("position", "absolute"), Wa.css("left", za + "pt"), Wa.css("top", Po + "pt"), _e.append(Wa);
52699
52717
  } catch {
52700
52718
  }
52701
52719
  });
@@ -58162,7 +58180,7 @@ async function ensureHttpClient() {
58162
58180
  }
58163
58181
  return null;
58164
58182
  }
58165
- const version = "1.1.510";
58183
+ const version = "1.1.512";
58166
58184
  typeof window < "u" && window.hinnn && (window.hinnn.queue || (window.hinnn.queue = {
58167
58185
  list: [],
58168
58186
  running: !1,
@@ -61060,6 +61078,7 @@ const _hoisted_1$a = { class: "preview-header vg-dialog-header" }, _hoisted_2$9
61060
61078
  {
61061
61079
  index: 0,
61062
61080
  name: "销售单",
61081
+ nameField: "",
61063
61082
  height: 210,
61064
61083
  width: 297,
61065
61084
  paperHeader: 70.5,
@@ -61351,6 +61370,7 @@ const _hoisted_1$a = { class: "preview-header vg-dialog-header" }, _hoisted_2$9
61351
61370
  tableHeaderBackground: "",
61352
61371
  tableBodyRowHeight: 15.75,
61353
61372
  tablePaginationTolerancePx: 16,
61373
+ gridFillDirection: "",
61354
61374
  columns: [
61355
61375
  [
61356
61376
  {
@@ -61657,17 +61677,25 @@ const _hoisted_1$a = { class: "preview-header vg-dialog-header" }, _hoisted_2$9
61657
61677
  }
61658
61678
  }
61659
61679
  ],
61660
- paperNumberLeft: 750,
61661
- paperNumberTop: 570,
61680
+ paperNumberLeft: -30,
61681
+ paperNumberTop: 37,
61662
61682
  paperNumberContinue: !0,
61663
61683
  orient: 2,
61664
- watermarkOptions: {},
61684
+ watermarkOptions: {
61685
+ content: "",
61686
+ fillStyle: "rgba(184, 184, 184, 0.3)",
61687
+ fontSize: "14px",
61688
+ rotate: 25,
61689
+ width: 200,
61690
+ height: 200,
61691
+ timestamp: !1,
61692
+ format: "YYYY-MM-DD HH:mm"
61693
+ },
61665
61694
  panelLayoutOptions: {
61666
61695
  layoutType: "column",
61667
61696
  layoutRowGap: 0,
61668
61697
  layoutColumnGap: 0
61669
61698
  },
61670
- backgroundColor: "#fff",
61671
61699
  expandCss: `.products {
61672
61700
  display: flex;
61673
61701
  flex-wrap: wrap;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vg-print",
3
3
  "description": "vg-print supports visual drag and drop design templates, with functions such as previewing and exporting PDFs/images. Silent printing can be achieved in conjunction with a dedicated client",
4
- "version": "1.1.510",
4
+ "version": "1.1.512",
5
5
  "author": "gmcSimple",
6
6
  "license": "MIT",
7
7
  "main": "dist/vg-print.es.js",