vg-print 1.0.232 → 1.0.302
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.
- package/LICENSE +1 -1
- package/README.md +85 -1
- package/dist/style.css +1 -1
- package/dist/vg-print.es.js +102 -26
- package/dist/vg-print.umd.js +96 -96
- package/package.json +1 -1
package/dist/vg-print.es.js
CHANGED
|
@@ -30624,7 +30624,7 @@ const defaultOption = {
|
|
|
30624
30624
|
id: "watermark",
|
|
30625
30625
|
// 水印id
|
|
30626
30626
|
watch: !1,
|
|
30627
|
-
content: "
|
|
30627
|
+
content: "vg-print",
|
|
30628
30628
|
// 水印内容
|
|
30629
30629
|
container: ".hiprint-printPaper",
|
|
30630
30630
|
// 水印容器
|
|
@@ -30644,7 +30644,7 @@ const defaultOption = {
|
|
|
30644
30644
|
// 水印文字颜色
|
|
30645
30645
|
rotate: 25,
|
|
30646
30646
|
// 水印文字旋转角度
|
|
30647
|
-
timestamp: !
|
|
30647
|
+
timestamp: !0,
|
|
30648
30648
|
// 是否显示时间戳
|
|
30649
30649
|
format: "YYYY-MM-DD HH:mm",
|
|
30650
30650
|
// 时间戳格式
|
|
@@ -55309,7 +55309,7 @@ var i18n$1 = {
|
|
|
55309
55309
|
}, gr.prototype.getValue = function() {
|
|
55310
55310
|
let ar = {
|
|
55311
55311
|
content: this.content.find("input").val(),
|
|
55312
|
-
fillStyle: this.fillStyle.find("input").val() || "rgba(
|
|
55312
|
+
fillStyle: this.fillStyle.find("input").val() || "rgba(87, 13, 248, 0.5)",
|
|
55313
55313
|
fontSize: parseInt(this.fontSize.find("input").val() || "14") + "px",
|
|
55314
55314
|
rotate: parseInt(this.rotate.find("input").val() || "25"),
|
|
55315
55315
|
width: parseInt(this.width.find("input").val() || "200"),
|
|
@@ -55319,7 +55319,7 @@ var i18n$1 = {
|
|
|
55319
55319
|
};
|
|
55320
55320
|
return Object.assign({}, this.options, ar);
|
|
55321
55321
|
}, gr.prototype.setValue = function(ar) {
|
|
55322
|
-
this.options = ar, this.content.find("input").val(ar.content || ""), this.fillStyle.find("input").val(ar.fillStyle || "rgba(
|
|
55322
|
+
this.options = ar, this.content.find("input").val(ar.content || ""), this.fillStyle.find("input").val(ar.fillStyle || "rgba(87, 13, 248, 0.5)"), this.fillStyle.find("input").minicolors({
|
|
55323
55323
|
format: "rgb",
|
|
55324
55324
|
opacity: !0,
|
|
55325
55325
|
theme: "bootstrap"
|
|
@@ -65480,7 +65480,7 @@ ${i18n$1.__("转大小写")}
|
|
|
65480
65480
|
}
|
|
65481
65481
|
};
|
|
65482
65482
|
})();
|
|
65483
|
-
const version = "1.0.
|
|
65483
|
+
const version = "1.0.302";
|
|
65484
65484
|
let autoConnect = function(Ie) {
|
|
65485
65485
|
console.log("autoConnect"), window.autoConnect = !0, window.hiwebSocket && window.hiwebSocket.hasIo() && window.hiwebSocket.start(Ie);
|
|
65486
65486
|
}, disAutoConnect = function() {
|
|
@@ -65491,28 +65491,95 @@ let autoConnect = function(Ie) {
|
|
|
65491
65491
|
je || disAutoConnect();
|
|
65492
65492
|
let Be = Ie.prototype || Ie.config.globalProperties;
|
|
65493
65493
|
Be[Ae] = hiprint, Be.$print = function(Ee = defaultElementTypeProvider, Se, ...Te) {
|
|
65494
|
-
hiprint.init({
|
|
65495
|
-
|
|
65496
|
-
});
|
|
65497
|
-
var Pe = new hiprint.PrintTemplate({
|
|
65498
|
-
template: Se
|
|
65499
|
-
});
|
|
65494
|
+
hiprint.init({ providers: [new Ee()] });
|
|
65495
|
+
const Pe = createTemplate(Se);
|
|
65500
65496
|
return Pe.print(...Te), Pe;
|
|
65501
65497
|
}, Be.$print2 = function(Ee = defaultElementTypeProvider, Se, ...Te) {
|
|
65502
|
-
hiprint.init({
|
|
65503
|
-
|
|
65504
|
-
});
|
|
65505
|
-
var Pe = new hiprint.PrintTemplate({
|
|
65506
|
-
template: Se
|
|
65507
|
-
});
|
|
65498
|
+
hiprint.init({ providers: [new Ee()] });
|
|
65499
|
+
const Pe = createTemplate(Se);
|
|
65508
65500
|
return Pe.print2(...Te), Pe;
|
|
65509
65501
|
};
|
|
65510
65502
|
}
|
|
65511
65503
|
};
|
|
65512
65504
|
hiprint.version = version;
|
|
65505
|
+
hiprint._authKey = "";
|
|
65506
|
+
function _b64ToBytes(Ie) {
|
|
65507
|
+
const Ae = String(Ie || ""), je = typeof atob == "function" ? atob(Ae) : Buffer.from(Ae, "base64").toString("binary"), Be = new Uint8Array(je.length);
|
|
65508
|
+
for (let Ee = 0; Ee < je.length; Ee++) Be[Ee] = je.charCodeAt(Ee);
|
|
65509
|
+
return Be;
|
|
65510
|
+
}
|
|
65511
|
+
function _strToBytes(Ie) {
|
|
65512
|
+
return new TextEncoder().encode(String(Ie || ""));
|
|
65513
|
+
}
|
|
65514
|
+
hiprint.decryptAuthKey = async function(Ie, Ae = {}, je = {}) {
|
|
65515
|
+
if (!(typeof window < "u" && window.crypto && window.crypto.subtle)) return null;
|
|
65516
|
+
try {
|
|
65517
|
+
const Be = Ae && Ae.b64 ? _b64ToBytes(Ae.b64) : _strToBytes(Ae.raw || ""), Ee = je && je.b64 ? _b64ToBytes(je.b64) : _strToBytes(je.raw || ""), Se = await window.crypto.subtle.importKey("raw", Be, { name: "AES-GCM" }, !1, ["decrypt"]), Te = _b64ToBytes(Ie), Pe = await window.crypto.subtle.decrypt({ name: "AES-GCM", iv: Ee }, Se, Te);
|
|
65518
|
+
return new TextDecoder().decode(Pe);
|
|
65519
|
+
} catch {
|
|
65520
|
+
return null;
|
|
65521
|
+
}
|
|
65522
|
+
};
|
|
65523
|
+
hiprint.register = async function(Ie = {}) {
|
|
65524
|
+
const Ae = Ie && Ie.authKey ? String(Ie.authKey) : "";
|
|
65525
|
+
let je = Ae;
|
|
65526
|
+
if (Ae)
|
|
65527
|
+
try {
|
|
65528
|
+
let Ee;
|
|
65529
|
+
try {
|
|
65530
|
+
const Se = _b64ToBytes(Ae);
|
|
65531
|
+
Ee = new TextDecoder().decode(Se);
|
|
65532
|
+
} catch {
|
|
65533
|
+
}
|
|
65534
|
+
if (Ee)
|
|
65535
|
+
try {
|
|
65536
|
+
const Se = JSON.parse(Ee);
|
|
65537
|
+
let Te = !0;
|
|
65538
|
+
if (Se && Se.exp && typeof Se.exp == "number" && Date.now() > Se.exp && (Te = !1), Se && Se.aud) {
|
|
65539
|
+
const Pe = String(Se.aud), De = typeof window < "u" && window.location && window.location.host ? window.location.host : "";
|
|
65540
|
+
Pe !== "*" && De && Pe && Pe !== De && (Te = !1);
|
|
65541
|
+
}
|
|
65542
|
+
je = Te ? Se.k ? String(Se.k) : "1" : "";
|
|
65543
|
+
} catch {
|
|
65544
|
+
je = Ee;
|
|
65545
|
+
}
|
|
65546
|
+
} catch {
|
|
65547
|
+
}
|
|
65548
|
+
if (hiprint._authKey = je, (Array.isArray(Ie.plugins) ? Ie.plugins : []).forEach(function(Ee) {
|
|
65549
|
+
try {
|
|
65550
|
+
if (!Ee) return;
|
|
65551
|
+
typeof Ee == "function" ? Ee(hiprint) : typeof Ee.install == "function" && Ee.install(hiprint);
|
|
65552
|
+
} catch {
|
|
65553
|
+
}
|
|
65554
|
+
}), Ie && Ie.authKeyEncrypted) {
|
|
65555
|
+
const Ee = Ie.aesKeyB64 ? { b64: Ie.aesKeyB64 } : { raw: Ie.aesKey || "" }, Se = Ie.aesIvB64 ? { b64: Ie.aesIvB64 } : { raw: Ie.aesIv || "" };
|
|
65556
|
+
let Te = await hiprint.decryptAuthKey(Ie.authKeyEncrypted, Ee, Se);
|
|
65557
|
+
if (!Te)
|
|
65558
|
+
try {
|
|
65559
|
+
const Pe = _b64ToBytes(Ie.authKeyEncrypted);
|
|
65560
|
+
Te = new TextDecoder().decode(Pe);
|
|
65561
|
+
} catch {
|
|
65562
|
+
}
|
|
65563
|
+
if (Te) {
|
|
65564
|
+
let Pe = !1;
|
|
65565
|
+
try {
|
|
65566
|
+
const De = JSON.parse(Te);
|
|
65567
|
+
if (De && De.exp && typeof De.exp == "number" && Date.now() <= De.exp && (Pe = !0), De && De.aud) {
|
|
65568
|
+
const Ue = String(De.aud), He = typeof window < "u" && window.location && window.location.host ? window.location.host : "";
|
|
65569
|
+
Ue !== "*" && He && Ue && Ue !== He && (Pe = !1);
|
|
65570
|
+
}
|
|
65571
|
+
Pe && (hiprint._authKey = De.k ? String(De.k) : "1");
|
|
65572
|
+
} catch {
|
|
65573
|
+
Te && Te.length && (hiprint._authKey = Te);
|
|
65574
|
+
}
|
|
65575
|
+
}
|
|
65576
|
+
}
|
|
65577
|
+
};
|
|
65513
65578
|
window.hiprint = hiprint;
|
|
65514
65579
|
function createTemplate(Ie, Ae = {}) {
|
|
65515
|
-
|
|
65580
|
+
hiprint.init({ providers: [new defaultElementTypeProvider()] });
|
|
65581
|
+
const je = hiprint._authKey ? void 0 : { content: "vg-print", timestamp: !0 }, Be = { ...Ae };
|
|
65582
|
+
return Be.watermarkOptions || (Be.watermarkOptions = je), new hiprint.PrintTemplate({ template: Ie, ...Be });
|
|
65516
65583
|
}
|
|
65517
65584
|
function getHtml(Ie, Ae) {
|
|
65518
65585
|
const Be = (Ie && typeof Ie.getHtml == "function" ? Ie : createTemplate(Ie)).getHtml(Ae);
|
|
@@ -86745,10 +86812,11 @@ const _sfc_main = {
|
|
|
86745
86812
|
},
|
|
86746
86813
|
mounted() {
|
|
86747
86814
|
try {
|
|
86748
|
-
|
|
86749
|
-
|
|
86750
|
-
|
|
86751
|
-
|
|
86815
|
+
const Ie = !(typeof window < "u" && window.autoConnect === !1);
|
|
86816
|
+
(this.hiAutoConnect === !1 ? !1 : Ie) ? autoConnect() : disAutoConnect();
|
|
86817
|
+
const je = this.hiHost || hiprint.hiwebSocket.host, Be = this.hiToken || hiprint.hiwebSocket.token;
|
|
86818
|
+
(this.hiHost || this.hiToken) && hiprint.hiwebSocket.setHost(je, Be);
|
|
86819
|
+
const Se = {
|
|
86752
86820
|
cn: "zh_CN",
|
|
86753
86821
|
cn_tw: "zh_TW",
|
|
86754
86822
|
en: "en_US",
|
|
@@ -86760,7 +86828,7 @@ const _sfc_main = {
|
|
|
86760
86828
|
ru: "ru_RU"
|
|
86761
86829
|
}[this.lang] || "zh_CN";
|
|
86762
86830
|
try {
|
|
86763
|
-
i18n && i18n.global && i18n.global.locale && (typeof i18n.global.locale == "object" && "value" in i18n.global.locale ? i18n.global.locale.value =
|
|
86831
|
+
i18n && i18n.global && i18n.global.locale && (typeof i18n.global.locale == "object" && "value" in i18n.global.locale ? i18n.global.locale.value = Se : i18n.global.locale = Se), api.set("language", Se);
|
|
86764
86832
|
} catch {
|
|
86765
86833
|
}
|
|
86766
86834
|
} catch {
|
|
@@ -86928,7 +86996,11 @@ const _sfc_main = {
|
|
|
86928
86996
|
paginationContainer: ".hiprint-printPagination",
|
|
86929
86997
|
//fields: [{"text":'姓名1',"field":'name'},{"text":'性别1',"field":'gender'}],
|
|
86930
86998
|
// fontList: [{"title":'微软雅黑',"value":'Microsoft YaHei'}], // 自定义字体
|
|
86931
|
-
defaultPanelName: i18n.global.t("hiprintMeta.defaultPanelName")
|
|
86999
|
+
defaultPanelName: i18n.global.t("hiprintMeta.defaultPanelName"),
|
|
87000
|
+
watermarkOptions: hiprint._authKey ? void 0 : {
|
|
87001
|
+
content: "vg-print",
|
|
87002
|
+
timestamp: !0
|
|
87003
|
+
}
|
|
86932
87004
|
/*onPanelAddClick: (panel, createPanel) => {
|
|
86933
87005
|
panel.name = '新面板' + (panel.index + 1);
|
|
86934
87006
|
that.$message.success('弹出个东西,让你们知道,在这里可以自定义面板名称');
|
|
@@ -87195,7 +87267,11 @@ const _sfc_main = {
|
|
|
87195
87267
|
});
|
|
87196
87268
|
Te._notifRegistry[je] = Pe;
|
|
87197
87269
|
let De = new hiprint.PrintTemplate({
|
|
87198
|
-
template
|
|
87270
|
+
template,
|
|
87271
|
+
watermarkOptions: hiprint._authKey ? void 0 : {
|
|
87272
|
+
content: "vg-print",
|
|
87273
|
+
timestamp: !0
|
|
87274
|
+
}
|
|
87199
87275
|
});
|
|
87200
87276
|
De.print2(Ee, {
|
|
87201
87277
|
printer: this.printerName,
|
|
@@ -87902,7 +87978,7 @@ function _sfc_render(Ie, Ae, je, Be, Ee, Se) {
|
|
|
87902
87978
|
}, null, 8, ["template", "onApply"])
|
|
87903
87979
|
], 64);
|
|
87904
87980
|
}
|
|
87905
|
-
const FullDesigner = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-
|
|
87981
|
+
const FullDesigner = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-9c8237ca"]]), index = {
|
|
87906
87982
|
install(Ie) {
|
|
87907
87983
|
Ie.component("FullDesigner", FullDesigner);
|
|
87908
87984
|
try {
|