vg-print 1.0.216 → 1.0.218

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.
@@ -65477,7 +65477,7 @@ ${i18n$1.__("转大小写")}
65477
65477
  }
65478
65478
  };
65479
65479
  })();
65480
- const version = "1.0.216";
65480
+ const version = "1.0.218";
65481
65481
  let autoConnect = function(Ie) {
65482
65482
  console.log("autoConnect"), window.autoConnect = !0, window.hiwebSocket && window.hiwebSocket.hasIo() && window.hiwebSocket.start(Ie);
65483
65483
  }, disAutoConnect = function() {
@@ -86534,15 +86534,30 @@ const _sfc_main = {
86534
86534
  hiAutoConnect: {
86535
86535
  type: Boolean,
86536
86536
  default: !0
86537
+ },
86538
+ initialTemplate: {
86539
+ type: Object,
86540
+ default: () => ({})
86541
+ },
86542
+ initialPrintData: {
86543
+ type: [Object, Array],
86544
+ default: () => ({})
86545
+ },
86546
+ defaultLang: {
86547
+ type: String,
86548
+ default: "cn"
86537
86549
  }
86538
86550
  },
86551
+ emits: ["save"],
86539
86552
  data() {
86540
86553
  return {
86541
86554
  template: "",
86542
86555
  // 仅使用一个模板缓存,不区分多个键
86543
86556
  // (页面关闭或离开时会清空该缓存)
86544
86557
  // 组件内维护的可编辑打印数据变量(避免直接依赖模块常量)
86545
- printDataVar: Array.isArray(rawPrintData) ? [...rawPrintData] : {
86558
+ printDataVar: Array.isArray(this.initialPrintData) ? [...this.initialPrintData] : this.initialPrintData && typeof this.initialPrintData == "object" ? {
86559
+ ...this.initialPrintData
86560
+ } : Array.isArray(rawPrintData) ? [...rawPrintData] : {
86546
86561
  ...rawPrintData
86547
86562
  },
86548
86563
  // 打印数量
@@ -86592,7 +86607,7 @@ const _sfc_main = {
86592
86607
  printerList: [],
86593
86608
  printerName: "",
86594
86609
  waitShowPrinter: !1,
86595
- lang: "cn",
86610
+ lang: this.defaultLang || "cn",
86596
86611
  languages: [{
86597
86612
  label: "简体中文-cn",
86598
86613
  value: "cn"
@@ -86688,6 +86703,21 @@ const _sfc_main = {
86688
86703
  this.hiAutoConnect === !1 ? disAutoConnect() : autoConnect();
86689
86704
  const Ie = this.hiHost || hiprint.hiwebSocket.host, Ae = this.hiToken || hiprint.hiwebSocket.token;
86690
86705
  (this.hiHost || this.hiToken) && hiprint.hiwebSocket.setHost(Ie, Ae);
86706
+ const Be = {
86707
+ cn: "zh_CN",
86708
+ cn_tw: "zh_TW",
86709
+ en: "en_US",
86710
+ de: "de_DE",
86711
+ es: "es_ES",
86712
+ fr: "fr_FR",
86713
+ it: "it_IT",
86714
+ ja: "ja_JP",
86715
+ ru: "ru_RU"
86716
+ }[this.lang] || "zh_CN";
86717
+ try {
86718
+ i18n && i18n.global && i18n.global.locale && (typeof i18n.global.locale == "object" && "value" in i18n.global.locale ? i18n.global.locale.value = Be : i18n.global.locale = Be), api.set("language", Be);
86719
+ } catch {
86720
+ }
86691
86721
  } catch {
86692
86722
  }
86693
86723
  this.init(), window.addEventListener("keydown", this.onKeydown), this.scale = this.getScale();
@@ -86710,6 +86740,12 @@ const _sfc_main = {
86710
86740
  Ie === !1 ? disAutoConnect() : autoConnect();
86711
86741
  } catch {
86712
86742
  }
86743
+ },
86744
+ defaultLang(Ie) {
86745
+ try {
86746
+ this.handleLangChange(Ie);
86747
+ } catch {
86748
+ }
86713
86749
  }
86714
86750
  },
86715
86751
  unmounted() {
@@ -86831,9 +86867,10 @@ const _sfc_main = {
86831
86867
  },
86832
86868
  init() {
86833
86869
  hiprint.init({
86870
+ lang: this.lang || "cn",
86834
86871
  providers: [provider]
86835
86872
  }), $(".hiprintEpContainer").empty(), hiprint.PrintElementTypeManager.build(".hiprintEpContainer", "taskProviderModule"), $("#hiprint-printTemplate").empty(), this.template = hiprintTemplate = new hiprint.PrintTemplate({
86836
- template,
86873
+ template: this.initialTemplate && Object.keys(this.initialTemplate).length ? this.initialTemplate : template,
86837
86874
  settingContainer: "#PrintElementOptionSetting",
86838
86875
  paginationContainer: ".hiprint-printPagination",
86839
86876
  //fields: [{"text":'姓名1',"field":'name'},{"text":'性别1',"field":'gender'}],
@@ -87150,6 +87187,14 @@ const _sfc_main = {
87150
87187
  } catch {
87151
87188
  }
87152
87189
  this.savePrintData(this.printDataVar), this.$message.info("保存成功");
87190
+ try {
87191
+ this.$emit("save", {
87192
+ template: Ie,
87193
+ data: this.printDataVar,
87194
+ templateId: hiprintTemplate && (hiprintTemplate.templateId || hiprintTemplate.id)
87195
+ });
87196
+ } catch {
87197
+ }
87153
87198
  },
87154
87199
  // 可选:手动加载当前模板键对应的缓存模板
87155
87200
  loadCachedTemplate() {
@@ -87803,11 +87848,11 @@ function _sfc_render(Ie, Ae, je, Be, Ee, Se) {
87803
87848
  }, null, 8, ["template", "onApply"])
87804
87849
  ], 64);
87805
87850
  }
87806
- const FullDesigner = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-897c6660"]]), index = {
87851
+ const FullDesigner = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-9ded9610"]]), index = {
87807
87852
  install(Ie) {
87808
87853
  Ie.component("FullDesigner", FullDesigner);
87809
87854
  try {
87810
- typeof window < "u" && hiPrintPlugin.install(Ie);
87855
+ typeof window < "u" && (i18n && Ie.use(i18n), hiPrintPlugin.install(Ie));
87811
87856
  } catch {
87812
87857
  }
87813
87858
  }