vg-print-vue2 1.0.510 → 1.0.511

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.
@@ -51425,7 +51425,7 @@ var hiprint$3 = function(t4) {
51425
51425
  designTarget: n3,
51426
51426
  onDrag: function onDrag(t5, i3, o2) {
51427
51427
  var els = n3.panel.printElements.filter(function(t6) {
51428
- return "block" == t6.designTarget.children().last().css("display") && t6.designTarget.children().last().hasClass("selected") && !t6.printElementType.type.includes("table");
51428
+ return !!(t6 && t6.designTarget && t6.designTarget.length && t6.designTarget.children && t6.printElementType) && ("block" == t6.designTarget.children().last().css("display") && t6.designTarget.children().last().hasClass("selected")) && !(t6.printElementType.type || "").includes("table");
51429
51429
  });
51430
51430
  var isMultiple = els.length > 1;
51431
51431
  var notSelected = !n3.designTarget.children().last().hasClass("selected");
@@ -51465,7 +51465,7 @@ var hiprint$3 = function(t4) {
51465
51465
  hinnn.event.trigger("hiprintTemplateDataChanged_" + n3.templateId, "移动");
51466
51466
  _HiPrintlib__WEBPACK_IMPORTED_MODULE_6__.a.instance.draging = false, _HiPrintlib__WEBPACK_IMPORTED_MODULE_6__.a.instance.changed = false;
51467
51467
  var els = n3.panel.printElements.filter(function(t6) {
51468
- return "block" == t6.designTarget.children().last().css("display") && !t6.printElementType.type.includes("table");
51468
+ return !!(t6 && t6.designTarget && t6.designTarget.length && t6.designTarget.children && t6.printElementType) && "block" == t6.designTarget.children().last().css("display") && !(t6.printElementType.type || "").includes("table");
51469
51469
  });
51470
51470
  if (els.length > 1) {
51471
51471
  els.forEach(function(t6) {
@@ -51836,7 +51836,7 @@ var hiprint$3 = function(t4) {
51836
51836
  v2 = "";
51837
51837
  var formatter2 = this.getFormatter();
51838
51838
  if (formatter2 && v2 !== "") {
51839
- v2 = formatter2(v2, this.options, t4, paperNo);
51839
+ v2 = this._callFormatterSafely(formatter2, [v2, this.options, t4, paperNo], v2);
51840
51840
  }
51841
51841
  return v2;
51842
51842
  }, BasePrintElement.prototype.copyFromType = function() {
@@ -52118,6 +52118,21 @@ var hiprint$3 = function(t4) {
52118
52118
  console.log(t4);
52119
52119
  }
52120
52120
  return formatter;
52121
+ }, BasePrintElement.prototype._callFormatterSafely = function(formatter2, args, fallbackValue) {
52122
+ try {
52123
+ return formatter2.apply(null, args || []);
52124
+ } catch (err2) {
52125
+ var message = err2 && err2.message ? err2.message : String(err2);
52126
+ this._formatterErrorsLogged = this._formatterErrorsLogged || {};
52127
+ if (!this._formatterErrorsLogged[message]) {
52128
+ this._formatterErrorsLogged[message] = true;
52129
+ try {
52130
+ console.warn("[vg-print] formatter 执行失败,已回退为原始字段值:", err2);
52131
+ } catch (_2) {
52132
+ }
52133
+ }
52134
+ return fallbackValue;
52135
+ }
52121
52136
  }, BasePrintElement.prototype.getStyler = function() {
52122
52137
  var fnstyler = void 0;
52123
52138
  if (this.printElementType.styler && (fnstyler = this.printElementType.styler), this.options.styler)
@@ -52151,7 +52166,7 @@ var hiprint$3 = function(t4) {
52151
52166
  return;
52152
52167
  }
52153
52168
  var els = n3.panel.printElements.filter(function(t5) {
52154
- return "block" == t5.designTarget.children().last().css("display") && !t5.printElementType.type.includes("table");
52169
+ return !!(t5 && t5.designTarget && t5.designTarget.length && t5.designTarget.children && t5.printElementType) && "block" == t5.designTarget.children().last().css("display") && !(t5.printElementType.type || "").includes("table");
52155
52170
  });
52156
52171
  var isMultiple = els.length > 1;
52157
52172
  var movingDistance = _HiPrintConfig__WEBPACK_IMPORTED_MODULE_1__.a.instance.movingDistance;
@@ -62599,7 +62614,7 @@ ${i18n.__("转大小写")}
62599
62614
  if (!(i4.ctrlKey || i4.metaKey) && (i4.data.target.className.startsWith("resize-panel") || "2" == i4.data.target.style.zIndex || i4.data.target.className.startsWith("hiprint-printElement"))) {
62600
62615
  var data2 = i4.data;
62601
62616
  if (t5(".mouseRect").length == 0 && o3.options.designTarget && o3.options.designTarget.panel.printElements.filter(function(el2) {
62602
- return "block" == el2.designTarget.children().last().css("display") && !el2.printElementType.type.includes("table");
62617
+ return !!(el2 && el2.designTarget && el2.designTarget.length && el2.designTarget.children && el2.printElementType) && "block" == el2.designTarget.children().last().css("display") && !(el2.printElementType.type || "").includes("table");
62603
62618
  }).length <= 1) {
62604
62619
  let left = window.hinnn.px.toPt(data2.left);
62605
62620
  let top = window.hinnn.px.toPt(data2.top);
@@ -64121,7 +64136,7 @@ ${i18n.__("转大小写")}
64121
64136
  if (e3 == null)
64122
64137
  e3 = "";
64123
64138
  var n3 = this.getFormatter();
64124
- return n3 && (e3 = n3(e3, this.options, this._currenttemplateData)), e3 == null ? "" : e3;
64139
+ return n3 && (e3 = this._callFormatterSafely(n3, [e3, this.options, this._currenttemplateData], e3)), e3 == null ? "" : e3;
64125
64140
  }, e2.prototype.createTarget = function(t5, e3) {
64126
64141
  var n3 = $$i('<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>');
64127
64142
  return this.updateTargetImage(n3, t5, e3), n3;
@@ -64547,10 +64562,10 @@ ${i18n.__("转大小写")}
64547
64562
  if (this.getField()) {
64548
64563
  return {
64549
64564
  title: this.options.getHideTitle() ? "" : t5 ? t5 + ":" : "",
64550
- body: n3 ? n3(t5, v2, this.options, this._currenttemplateData) : v2
64565
+ body: n3 ? this._callFormatterSafely(n3, [t5, v2, this.options, this._currenttemplateData], v2) : v2
64551
64566
  };
64552
64567
  }
64553
- return { title: "", body: n3 ? n3(t5, t5, this.options, this._currenttemplateData) : v2 || t5 || "" };
64568
+ return { title: "", body: n3 ? this._callFormatterSafely(n3, [t5, t5, this.options, this._currenttemplateData], t5) : v2 || t5 || "" };
64554
64569
  }, e2.prototype.getStructuredContentParts = function(t5, e3) {
64555
64570
  var parts = this.getContentParts(t5, e3);
64556
64571
  if (this.getContentIndent() === 0 && !this.getField())
@@ -64613,7 +64628,7 @@ ${i18n.__("转大小写")}
64613
64628
  }, e2.prototype.getText = function(t5, e3) {
64614
64629
  var n3 = this.getFormatter();
64615
64630
  e3 && (e3 = 0 != this.options.leftSpaceRemoved ? e3.toString().replace(/^\s*/, "") : e3);
64616
- return (this.getField() ? (this.options.getHideTitle() ? "" : t5 ? t5 + ":" : "") + (n3 ? n3(t5, e3, this.options, this._currenttemplateData) : e3) : n3 ? n3(t5, t5, this.options, this._currenttemplateData) : t5 || "") || "";
64631
+ return (this.getField() ? (this.options.getHideTitle() ? "" : t5 ? t5 + ":" : "") + (n3 ? this._callFormatterSafely(n3, [t5, e3, this.options, this._currenttemplateData], e3) : e3) : n3 ? this._callFormatterSafely(n3, [t5, t5, this.options, this._currenttemplateData], t5) : t5 || "") || "";
64617
64632
  }, e2.prototype.getHtml = function(t5, e3) {
64618
64633
  this.setCurrenttemplateData(e3), this.createTempContainer();
64619
64634
  var n3 = this.getPaperHtmlResult(t5, e3);
@@ -64861,11 +64876,11 @@ ${i18n.__("转大小写")}
64861
64876
  var bodyText;
64862
64877
  var useSeparateTitle = false;
64863
64878
  if (this.getField()) {
64864
- bodyText = hinnn.toUpperCase(this.options.upperCase, r2 ? r2(e3, n3, this.options, this._currenttemplateData, t5, i3) : n3);
64879
+ bodyText = hinnn.toUpperCase(this.options.upperCase, r2 ? this._callFormatterSafely(r2, [e3, n3, this.options, this._currenttemplateData, t5, i3], n3) : n3);
64865
64880
  p2 = titleText + bodyText;
64866
64881
  useSeparateTitle = "text" == s3 && this.hasCustomTitleStyle() && !!titleText;
64867
64882
  } else {
64868
- n3 = hinnn.toUpperCase(this.options.upperCase, r2 ? r2(e3, e3, this.options, this._currenttemplateData, t5, i3) : e3);
64883
+ n3 = hinnn.toUpperCase(this.options.upperCase, r2 ? this._callFormatterSafely(r2, [e3, e3, this.options, this._currenttemplateData, t5, i3], e3) : e3);
64869
64884
  p2 = n3;
64870
64885
  }
64871
64886
  if (!this.getField() && hideTitle && s3 == "text") {
@@ -77872,7 +77887,7 @@ async function ensureHttpClient() {
77872
77887
  }
77873
77888
  const name = "vg-print-vue2";
77874
77889
  const 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";
77875
- const version = "1.0.510";
77890
+ const version = "1.0.511";
77876
77891
  const author = "gmcSimple";
77877
77892
  const license = "MIT";
77878
77893
  const main = "dist/vg-print-vue2.cjs.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vg-print-vue2",
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.0.510",
4
+ "version": "1.0.511",
5
5
  "author": "gmcSimple",
6
6
  "license": "MIT",
7
7
  "main": "dist/vg-print-vue2.cjs.js",