vg-print 1.0.231 → 1.0.301
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 +100 -3
- package/dist/style.css +1 -1
- package/dist/vg-print.es.js +103 -27
- package/dist/vg-print.umd.js +6 -6
- 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"
|
|
@@ -59565,7 +59565,7 @@ ${i18n$1.__("转大小写")}
|
|
|
59565
59565
|
jQuery, je = "connected", Be = "reconnecting", window.hiwebSocket = {
|
|
59566
59566
|
opened: !1,
|
|
59567
59567
|
name: "webSockets",
|
|
59568
|
-
host: "http://
|
|
59568
|
+
host: "http://127.0.0.1:17521",
|
|
59569
59569
|
token: null,
|
|
59570
59570
|
reconnectTimeout: 6e4,
|
|
59571
59571
|
reconnectWindowSetTimeout: null,
|
|
@@ -65480,7 +65480,7 @@ ${i18n$1.__("转大小写")}
|
|
|
65480
65480
|
}
|
|
65481
65481
|
};
|
|
65482
65482
|
})();
|
|
65483
|
-
const version = "1.0.
|
|
65483
|
+
const version = "1.0.301";
|
|
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);
|
|
@@ -86748,10 +86815,11 @@ const _sfc_main = {
|
|
|
86748
86815
|
},
|
|
86749
86816
|
mounted() {
|
|
86750
86817
|
try {
|
|
86751
|
-
|
|
86752
|
-
|
|
86753
|
-
|
|
86754
|
-
|
|
86818
|
+
const Ie = !(typeof window < "u" && window.autoConnect === !1);
|
|
86819
|
+
(this.hiAutoConnect === !1 ? !1 : Ie) ? autoConnect() : disAutoConnect();
|
|
86820
|
+
const je = this.hiHost || hiprint.hiwebSocket.host, Be = this.hiToken || hiprint.hiwebSocket.token;
|
|
86821
|
+
(this.hiHost || this.hiToken) && hiprint.hiwebSocket.setHost(je, Be);
|
|
86822
|
+
const Se = {
|
|
86755
86823
|
cn: "zh_CN",
|
|
86756
86824
|
cn_tw: "zh_TW",
|
|
86757
86825
|
en: "en_US",
|
|
@@ -86763,7 +86831,7 @@ const _sfc_main = {
|
|
|
86763
86831
|
ru: "ru_RU"
|
|
86764
86832
|
}[this.lang] || "zh_CN";
|
|
86765
86833
|
try {
|
|
86766
|
-
i18n && i18n.global && i18n.global.locale && (typeof i18n.global.locale == "object" && "value" in i18n.global.locale ? i18n.global.locale.value =
|
|
86834
|
+
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);
|
|
86767
86835
|
} catch {
|
|
86768
86836
|
}
|
|
86769
86837
|
} catch {
|
|
@@ -86931,7 +86999,11 @@ const _sfc_main = {
|
|
|
86931
86999
|
paginationContainer: ".hiprint-printPagination",
|
|
86932
87000
|
//fields: [{"text":'姓名1',"field":'name'},{"text":'性别1',"field":'gender'}],
|
|
86933
87001
|
// fontList: [{"title":'微软雅黑',"value":'Microsoft YaHei'}], // 自定义字体
|
|
86934
|
-
defaultPanelName: i18n.global.t("hiprintMeta.defaultPanelName")
|
|
87002
|
+
defaultPanelName: i18n.global.t("hiprintMeta.defaultPanelName"),
|
|
87003
|
+
watermarkOptions: hiprint._authKey ? void 0 : {
|
|
87004
|
+
content: "vg-print",
|
|
87005
|
+
timestamp: !0
|
|
87006
|
+
}
|
|
86935
87007
|
/*onPanelAddClick: (panel, createPanel) => {
|
|
86936
87008
|
panel.name = '新面板' + (panel.index + 1);
|
|
86937
87009
|
that.$message.success('弹出个东西,让你们知道,在这里可以自定义面板名称');
|
|
@@ -87198,7 +87270,11 @@ const _sfc_main = {
|
|
|
87198
87270
|
});
|
|
87199
87271
|
Te._notifRegistry[je] = Pe;
|
|
87200
87272
|
let De = new hiprint.PrintTemplate({
|
|
87201
|
-
template
|
|
87273
|
+
template,
|
|
87274
|
+
watermarkOptions: hiprint._authKey ? void 0 : {
|
|
87275
|
+
content: "vg-print",
|
|
87276
|
+
timestamp: !0
|
|
87277
|
+
}
|
|
87202
87278
|
});
|
|
87203
87279
|
De.print2(Ee, {
|
|
87204
87280
|
printer: this.printerName,
|
|
@@ -87905,7 +87981,7 @@ function _sfc_render(Ie, Ae, je, Be, Ee, Se) {
|
|
|
87905
87981
|
}, null, 8, ["template", "onApply"])
|
|
87906
87982
|
], 64);
|
|
87907
87983
|
}
|
|
87908
|
-
const FullDesigner = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-
|
|
87984
|
+
const FullDesigner = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-9c8237ca"]]), index = {
|
|
87909
87985
|
install(Ie) {
|
|
87910
87986
|
Ie.component("FullDesigner", FullDesigner);
|
|
87911
87987
|
try {
|