vg-print-vue2 1.0.509 → 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.
- package/dist/vg-print-vue2.es.js +264 -136
- package/package.json +1 -1
package/dist/vg-print-vue2.es.js
CHANGED
|
@@ -48768,6 +48768,225 @@ function defaultTypeProvider(hiprint2) {
|
|
|
48768
48768
|
};
|
|
48769
48769
|
}
|
|
48770
48770
|
;
|
|
48771
|
+
const MIME_ALIASES = {
|
|
48772
|
+
jpg: "image/jpeg",
|
|
48773
|
+
jpeg: "image/jpeg",
|
|
48774
|
+
png: "image/png",
|
|
48775
|
+
gif: "image/gif",
|
|
48776
|
+
webp: "image/webp",
|
|
48777
|
+
bmp: "image/bmp",
|
|
48778
|
+
svg: "image/svg+xml",
|
|
48779
|
+
tif: "image/tiff",
|
|
48780
|
+
tiff: "image/tiff",
|
|
48781
|
+
ico: "image/x-icon",
|
|
48782
|
+
avif: "image/avif",
|
|
48783
|
+
heic: "image/heic",
|
|
48784
|
+
heif: "image/heif"
|
|
48785
|
+
};
|
|
48786
|
+
function normalizeMime(mime) {
|
|
48787
|
+
if (!mime)
|
|
48788
|
+
return "";
|
|
48789
|
+
const value = String(mime).trim().toLowerCase().replace(/^\./, "").split(";")[0];
|
|
48790
|
+
if (MIME_ALIASES[value])
|
|
48791
|
+
return MIME_ALIASES[value];
|
|
48792
|
+
if (value === "image/jpg" || value === "image/pjpeg")
|
|
48793
|
+
return "image/jpeg";
|
|
48794
|
+
return /^image\/[a-z0-9.+-]+$/.test(value) ? value : "";
|
|
48795
|
+
}
|
|
48796
|
+
function decodeBase64Prefix(value) {
|
|
48797
|
+
try {
|
|
48798
|
+
const sample = value.slice(0, 512);
|
|
48799
|
+
const padded = sample + "=".repeat((4 - sample.length % 4) % 4);
|
|
48800
|
+
let binary;
|
|
48801
|
+
if (typeof atob === "function") {
|
|
48802
|
+
binary = atob(padded);
|
|
48803
|
+
} else if (typeof Buffer !== "undefined") {
|
|
48804
|
+
binary = Buffer.from(padded, "base64").toString("binary");
|
|
48805
|
+
} else {
|
|
48806
|
+
return null;
|
|
48807
|
+
}
|
|
48808
|
+
const bytes = new Uint8Array(binary.length);
|
|
48809
|
+
for (let i3 = 0; i3 < binary.length; i3++)
|
|
48810
|
+
bytes[i3] = binary.charCodeAt(i3);
|
|
48811
|
+
return bytes;
|
|
48812
|
+
} catch (_2) {
|
|
48813
|
+
return null;
|
|
48814
|
+
}
|
|
48815
|
+
}
|
|
48816
|
+
function sniffImageMime(base642) {
|
|
48817
|
+
if (/^iVBORw0KGgo/.test(base642))
|
|
48818
|
+
return "image/png";
|
|
48819
|
+
if (/^\/9j\//.test(base642))
|
|
48820
|
+
return "image/jpeg";
|
|
48821
|
+
if (/^R0lGOD/.test(base642))
|
|
48822
|
+
return "image/gif";
|
|
48823
|
+
if (/^UklGR/.test(base642))
|
|
48824
|
+
return "image/webp";
|
|
48825
|
+
if (/^Qk/.test(base642))
|
|
48826
|
+
return "image/bmp";
|
|
48827
|
+
if (/^(?:PHN2Zy|PD94bWwg|PCEtLS)/.test(base642))
|
|
48828
|
+
return "image/svg+xml";
|
|
48829
|
+
const bytes = decodeBase64Prefix(base642);
|
|
48830
|
+
if (!bytes || bytes.length < 12)
|
|
48831
|
+
return "";
|
|
48832
|
+
const ascii = Array.from(bytes, (byte) => String.fromCharCode(byte)).join("");
|
|
48833
|
+
if (bytes[0] === 137 && ascii.slice(1, 4) === "PNG")
|
|
48834
|
+
return "image/png";
|
|
48835
|
+
if (bytes[0] === 255 && bytes[1] === 216 && bytes[2] === 255)
|
|
48836
|
+
return "image/jpeg";
|
|
48837
|
+
if (ascii.slice(0, 6) === "GIF87a" || ascii.slice(0, 6) === "GIF89a")
|
|
48838
|
+
return "image/gif";
|
|
48839
|
+
if (ascii.slice(0, 4) === "RIFF" && ascii.slice(8, 12) === "WEBP")
|
|
48840
|
+
return "image/webp";
|
|
48841
|
+
if (ascii.slice(0, 2) === "BM")
|
|
48842
|
+
return "image/bmp";
|
|
48843
|
+
if (ascii.slice(0, 4) === "II*\0" || ascii.slice(0, 4) === "MM\0*")
|
|
48844
|
+
return "image/tiff";
|
|
48845
|
+
if (bytes[0] === 0 && bytes[1] === 0 && bytes[2] === 1 && bytes[3] === 0)
|
|
48846
|
+
return "image/x-icon";
|
|
48847
|
+
if (ascii.slice(4, 8) === "ftyp") {
|
|
48848
|
+
const brand = ascii.slice(8, 12).toLowerCase();
|
|
48849
|
+
if (brand === "avif" || brand === "avis")
|
|
48850
|
+
return "image/avif";
|
|
48851
|
+
if (/^(heic|heix|hevc|hevx)$/.test(brand))
|
|
48852
|
+
return "image/heic";
|
|
48853
|
+
if (brand === "mif1" || brand === "msf1")
|
|
48854
|
+
return "image/heif";
|
|
48855
|
+
}
|
|
48856
|
+
const svgText = ascii.replace(/^\u00ef\u00bb\u00bf/, "").trimStart();
|
|
48857
|
+
if (/^(?:<\?xml[\s\S]*?\?>\s*)?(?:<!--[^]*?-->\s*)*<svg\b/i.test(svgText))
|
|
48858
|
+
return "image/svg+xml";
|
|
48859
|
+
return "";
|
|
48860
|
+
}
|
|
48861
|
+
function cleanBase64(value) {
|
|
48862
|
+
const cleaned = String(value).replace(/\\r\\n|\\n|\\r/g, "").replace(/\\\//g, "/").replace(/\s+/g, "").replace(/-/g, "+").replace(/_/g, "/");
|
|
48863
|
+
if (!cleaned || !/^[A-Za-z0-9+/]*={0,2}$/.test(cleaned))
|
|
48864
|
+
return "";
|
|
48865
|
+
const unpadded = cleaned.replace(/=+$/, "");
|
|
48866
|
+
if (unpadded.length % 4 === 1)
|
|
48867
|
+
return "";
|
|
48868
|
+
return unpadded + "=".repeat((4 - unpadded.length % 4) % 4);
|
|
48869
|
+
}
|
|
48870
|
+
function extractImageMarkupSource(value) {
|
|
48871
|
+
const imgMatch = value.match(/^<img\b[^>]*\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))[^>]*>$/i);
|
|
48872
|
+
if (imgMatch)
|
|
48873
|
+
return imgMatch[1] || imgMatch[2] || imgMatch[3] || value;
|
|
48874
|
+
const cssMatch = value.match(/^url\(\s*(?:"([^"]*)"|'([^']*)'|([^)]*))\s*\)$/i);
|
|
48875
|
+
if (cssMatch)
|
|
48876
|
+
return (cssMatch[1] || cssMatch[2] || cssMatch[3] || "").trim();
|
|
48877
|
+
return value;
|
|
48878
|
+
}
|
|
48879
|
+
function normalizeImageSrc(input, mimeHint) {
|
|
48880
|
+
if (input == null)
|
|
48881
|
+
return "";
|
|
48882
|
+
let src2 = String(input).trim();
|
|
48883
|
+
if (!src2)
|
|
48884
|
+
return "";
|
|
48885
|
+
if (src2[0] === '"' && src2[src2.length - 1] === '"' || src2[0] === "'" && src2[src2.length - 1] === "'") {
|
|
48886
|
+
src2 = src2.slice(1, -1).trim();
|
|
48887
|
+
}
|
|
48888
|
+
src2 = extractImageMarkupSource(src2);
|
|
48889
|
+
const dataUrlMatch = src2.match(/^data:([^,]*),(.*)$/is);
|
|
48890
|
+
if (dataUrlMatch) {
|
|
48891
|
+
const metadata = dataUrlMatch[1];
|
|
48892
|
+
if (!/;base64(?:;|$)/i.test(metadata))
|
|
48893
|
+
return src2;
|
|
48894
|
+
const payload2 = cleanBase64(dataUrlMatch[2]);
|
|
48895
|
+
if (!payload2)
|
|
48896
|
+
return src2;
|
|
48897
|
+
const parts = metadata.split(";");
|
|
48898
|
+
const declaredMime = normalizeMime(parts[0]);
|
|
48899
|
+
const detectedMime = sniffImageMime(payload2);
|
|
48900
|
+
const mime = !declaredMime || declaredMime === "image/octet-stream" ? detectedMime || normalizeMime(mimeHint) || "image/png" : declaredMime;
|
|
48901
|
+
const suffix2 = parts.slice(1).filter((part) => part.toLowerCase() !== "base64");
|
|
48902
|
+
return "data:" + mime + (suffix2.length ? ";" + suffix2.join(";") : "") + ";base64," + payload2;
|
|
48903
|
+
}
|
|
48904
|
+
if (/^(?:https?:)?\/\//i.test(src2) || /^(?:blob|file):/i.test(src2) || src2.indexOf("./") === 0 || src2.indexOf("../") === 0) {
|
|
48905
|
+
return src2;
|
|
48906
|
+
}
|
|
48907
|
+
let explicitMime = normalizeMime(mimeHint);
|
|
48908
|
+
const prefixedBase64 = src2.match(/^(?:([a-z0-9.+-]+\/[a-z0-9.+-]+);)?base64\s*,/i);
|
|
48909
|
+
if (prefixedBase64) {
|
|
48910
|
+
explicitMime = normalizeMime(prefixedBase64[1]) || explicitMime;
|
|
48911
|
+
src2 = src2.slice(prefixedBase64[0].length);
|
|
48912
|
+
}
|
|
48913
|
+
const payload = cleanBase64(src2);
|
|
48914
|
+
if (payload && payload.length >= 20) {
|
|
48915
|
+
const detectedMime = sniffImageMime(payload);
|
|
48916
|
+
if (detectedMime || explicitMime || src2[0] !== "/") {
|
|
48917
|
+
const mime = detectedMime || explicitMime || "image/png";
|
|
48918
|
+
return "data:" + mime + ";base64," + payload;
|
|
48919
|
+
}
|
|
48920
|
+
}
|
|
48921
|
+
if (src2[0] === "/")
|
|
48922
|
+
return src2;
|
|
48923
|
+
return src2;
|
|
48924
|
+
}
|
|
48925
|
+
function waitForImage(image2, timeoutMs) {
|
|
48926
|
+
const timeout = Number.isFinite(Number(timeoutMs)) ? Math.max(0, Number(timeoutMs)) : 1e4;
|
|
48927
|
+
return new Promise((resolve2) => {
|
|
48928
|
+
if (!image2) {
|
|
48929
|
+
resolve2(false);
|
|
48930
|
+
return;
|
|
48931
|
+
}
|
|
48932
|
+
let settled = false;
|
|
48933
|
+
let timer;
|
|
48934
|
+
const cleanup = () => {
|
|
48935
|
+
if (timer)
|
|
48936
|
+
clearTimeout(timer);
|
|
48937
|
+
image2.removeEventListener && image2.removeEventListener("load", onLoad);
|
|
48938
|
+
image2.removeEventListener && image2.removeEventListener("error", onError);
|
|
48939
|
+
};
|
|
48940
|
+
const finish = (loaded) => {
|
|
48941
|
+
if (settled)
|
|
48942
|
+
return;
|
|
48943
|
+
settled = true;
|
|
48944
|
+
cleanup();
|
|
48945
|
+
resolve2(!!loaded);
|
|
48946
|
+
};
|
|
48947
|
+
const hasPixels = () => typeof image2.naturalWidth !== "number" || image2.naturalWidth > 0;
|
|
48948
|
+
const onLoad = () => {
|
|
48949
|
+
if (typeof image2.decode === "function") {
|
|
48950
|
+
try {
|
|
48951
|
+
Promise.resolve(image2.decode()).then(() => finish(true)).catch(() => finish(hasPixels()));
|
|
48952
|
+
} catch (_2) {
|
|
48953
|
+
finish(hasPixels());
|
|
48954
|
+
}
|
|
48955
|
+
} else {
|
|
48956
|
+
finish(hasPixels());
|
|
48957
|
+
}
|
|
48958
|
+
};
|
|
48959
|
+
const onError = () => finish(false);
|
|
48960
|
+
if (image2.complete) {
|
|
48961
|
+
finish(hasPixels());
|
|
48962
|
+
return;
|
|
48963
|
+
}
|
|
48964
|
+
image2.addEventListener && image2.addEventListener("load", onLoad);
|
|
48965
|
+
image2.addEventListener && image2.addEventListener("error", onError);
|
|
48966
|
+
timer = setTimeout(() => finish(false), timeout);
|
|
48967
|
+
if (image2.complete)
|
|
48968
|
+
hasPixels() ? onLoad() : onError();
|
|
48969
|
+
});
|
|
48970
|
+
}
|
|
48971
|
+
function waitForImages(root2, timeoutMs) {
|
|
48972
|
+
const element2 = root2 && root2.jquery ? root2[0] : root2;
|
|
48973
|
+
if (!element2)
|
|
48974
|
+
return Promise.resolve([]);
|
|
48975
|
+
const images = [];
|
|
48976
|
+
if (element2.tagName && String(element2.tagName).toLowerCase() === "img")
|
|
48977
|
+
images.push(element2);
|
|
48978
|
+
if (element2.querySelectorAll)
|
|
48979
|
+
images.push(...Array.from(element2.querySelectorAll("img")));
|
|
48980
|
+
return Promise.all(images.map((image2) => {
|
|
48981
|
+
const rawSrc = image2.getAttribute("src") || "";
|
|
48982
|
+
const normalized = normalizeImageSrc(rawSrc, image2.getAttribute("data-hiprint-mime") || image2.getAttribute("data-mime"));
|
|
48983
|
+
if (normalized && normalized !== rawSrc)
|
|
48984
|
+
image2.setAttribute("src", normalized);
|
|
48985
|
+
if (!normalized || image2.src === window.location.href)
|
|
48986
|
+
return Promise.resolve(false);
|
|
48987
|
+
return waitForImage(image2, timeoutMs);
|
|
48988
|
+
}));
|
|
48989
|
+
}
|
|
48771
48990
|
const printLockCss = `@media print {
|
|
48772
48991
|
/* App.vue fixes the designer viewport with overflow:hidden. The browser
|
|
48773
48992
|
print iframe copies that rule, so explicitly restore printable overflow. */
|
|
@@ -51206,7 +51425,7 @@ var hiprint$3 = function(t4) {
|
|
|
51206
51425
|
designTarget: n3,
|
|
51207
51426
|
onDrag: function onDrag(t5, i3, o2) {
|
|
51208
51427
|
var els = n3.panel.printElements.filter(function(t6) {
|
|
51209
|
-
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");
|
|
51210
51429
|
});
|
|
51211
51430
|
var isMultiple = els.length > 1;
|
|
51212
51431
|
var notSelected = !n3.designTarget.children().last().hasClass("selected");
|
|
@@ -51246,7 +51465,7 @@ var hiprint$3 = function(t4) {
|
|
|
51246
51465
|
hinnn.event.trigger("hiprintTemplateDataChanged_" + n3.templateId, "移动");
|
|
51247
51466
|
_HiPrintlib__WEBPACK_IMPORTED_MODULE_6__.a.instance.draging = false, _HiPrintlib__WEBPACK_IMPORTED_MODULE_6__.a.instance.changed = false;
|
|
51248
51467
|
var els = n3.panel.printElements.filter(function(t6) {
|
|
51249
|
-
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");
|
|
51250
51469
|
});
|
|
51251
51470
|
if (els.length > 1) {
|
|
51252
51471
|
els.forEach(function(t6) {
|
|
@@ -51617,7 +51836,7 @@ var hiprint$3 = function(t4) {
|
|
|
51617
51836
|
v2 = "";
|
|
51618
51837
|
var formatter2 = this.getFormatter();
|
|
51619
51838
|
if (formatter2 && v2 !== "") {
|
|
51620
|
-
v2 = formatter2
|
|
51839
|
+
v2 = this._callFormatterSafely(formatter2, [v2, this.options, t4, paperNo], v2);
|
|
51621
51840
|
}
|
|
51622
51841
|
return v2;
|
|
51623
51842
|
}, BasePrintElement.prototype.copyFromType = function() {
|
|
@@ -51899,6 +52118,21 @@ var hiprint$3 = function(t4) {
|
|
|
51899
52118
|
console.log(t4);
|
|
51900
52119
|
}
|
|
51901
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
|
+
}
|
|
51902
52136
|
}, BasePrintElement.prototype.getStyler = function() {
|
|
51903
52137
|
var fnstyler = void 0;
|
|
51904
52138
|
if (this.printElementType.styler && (fnstyler = this.printElementType.styler), this.options.styler)
|
|
@@ -51932,7 +52166,7 @@ var hiprint$3 = function(t4) {
|
|
|
51932
52166
|
return;
|
|
51933
52167
|
}
|
|
51934
52168
|
var els = n3.panel.printElements.filter(function(t5) {
|
|
51935
|
-
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");
|
|
51936
52170
|
});
|
|
51937
52171
|
var isMultiple = els.length > 1;
|
|
51938
52172
|
var movingDistance = _HiPrintConfig__WEBPACK_IMPORTED_MODULE_1__.a.instance.movingDistance;
|
|
@@ -52677,41 +52911,6 @@ var hiprint$3 = function(t4) {
|
|
|
52677
52911
|
if ("image" == t.tableTextType) {
|
|
52678
52912
|
r.html("");
|
|
52679
52913
|
if (p) {
|
|
52680
|
-
var normalizeImageSrc = function(src2) {
|
|
52681
|
-
if (src2 == null)
|
|
52682
|
-
return "";
|
|
52683
|
-
src2 = String(src2).trim();
|
|
52684
|
-
if (!src2)
|
|
52685
|
-
return "";
|
|
52686
|
-
if (/^data:/i.test(src2))
|
|
52687
|
-
return src2;
|
|
52688
|
-
if (/^(https?:)?\/\//i.test(src2))
|
|
52689
|
-
return src2;
|
|
52690
|
-
if (/^blob:/i.test(src2) || /^file:/i.test(src2))
|
|
52691
|
-
return src2;
|
|
52692
|
-
if (src2[0] === "/" || src2.indexOf("./") === 0 || src2.indexOf("../") === 0)
|
|
52693
|
-
return src2;
|
|
52694
|
-
if (/^[A-Za-z0-9+/=_-]+$/.test(src2) && src2.length > 80) {
|
|
52695
|
-
var head = src2.slice(0, 10);
|
|
52696
|
-
var m2;
|
|
52697
|
-
if (head.indexOf("iVBORw0") === 0)
|
|
52698
|
-
m2 = "image/png";
|
|
52699
|
-
else if (head.indexOf("/9j/") === 0)
|
|
52700
|
-
m2 = "image/jpeg";
|
|
52701
|
-
else if (head.indexOf("R0lGOD") === 0)
|
|
52702
|
-
m2 = "image/gif";
|
|
52703
|
-
else if (head.indexOf("UklGR") === 0)
|
|
52704
|
-
m2 = "image/webp";
|
|
52705
|
-
else if (head.indexOf("Qk") === 0)
|
|
52706
|
-
m2 = "image/bmp";
|
|
52707
|
-
else if (head.indexOf("PHN2Zy") === 0)
|
|
52708
|
-
m2 = "image/svg+xml";
|
|
52709
|
-
else
|
|
52710
|
-
m2 = "image/png";
|
|
52711
|
-
return "data:" + m2 + ";base64," + src2;
|
|
52712
|
-
}
|
|
52713
|
-
return src2;
|
|
52714
|
-
};
|
|
52715
52914
|
p = normalizeImageSrc(p);
|
|
52716
52915
|
var imagebox = $$i('<div><img style = "max-width:100%;max-height:100%"/></div>');
|
|
52717
52916
|
imagebox.find("img").attr("src", p);
|
|
@@ -55069,7 +55268,7 @@ var hiprint$3 = function(t4) {
|
|
|
55069
55268
|
var it3 = this.list && this.list[idx2] || {};
|
|
55070
55269
|
var overlay = $$i('<div class="hiprint-dialog-mask" style="position:fixed;left:0;top:0;width:100%;height:100%;background:rgba(0,0,0,.4);z-index:9999;"></div>');
|
|
55071
55270
|
var dlg = $$i('<div style="position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);background:#fff;padding:12px;min-width:280px;z-index:10000;box-shadow:0 2px 10px rgba(0,0,0,.2)"></div>');
|
|
55072
|
-
dlg.append('<div style="text-align:center;margin-bottom:8px;"><img src="' + (it3.src || it3.url || "") + '" style="max-width:240px;max-height:160px"/></div>');
|
|
55271
|
+
dlg.append('<div style="text-align:center;margin-bottom:8px;"><img src="' + normalizeImageSrc(it3.src || it3.url || "") + '" style="max-width:240px;max-height:160px"/></div>');
|
|
55073
55272
|
dlg.append('<div style="margin:6px 0;"><input type="text" class="name-input" style="width:100%" readonly="readonly" placeholder="' + i18n.__("名称") + '" value="' + (it3.name || it3.fileName || (it3.src || it3.url || "").split("?")[0].split("/").pop()) + '"/></div>');
|
|
55074
55273
|
dlg.append('<div style="margin:6px 0;"><textarea class="desc-input" style="width:100%;height:60px" placeholder="' + i18n.__("描述") + '">' + (it3.desc || it3.description || "") + "</textarea></div>");
|
|
55075
55274
|
var btns = $$i('<div style="text-align:right"><button class="hiprint-option-item-settingBtn save-btn" type="button">' + i18n.__("保存") + '</button><button class="hiprint-option-item-settingBtn cancel-btn" type="button" style="margin-left:6px">' + i18n.__("取消") + "</button></div>");
|
|
@@ -62415,7 +62614,7 @@ ${i18n.__("转大小写")}
|
|
|
62415
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"))) {
|
|
62416
62615
|
var data2 = i4.data;
|
|
62417
62616
|
if (t5(".mouseRect").length == 0 && o3.options.designTarget && o3.options.designTarget.panel.printElements.filter(function(el2) {
|
|
62418
|
-
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");
|
|
62419
62618
|
}).length <= 1) {
|
|
62420
62619
|
let left = window.hinnn.px.toPt(data2.left);
|
|
62421
62620
|
let top = window.hinnn.px.toPt(data2.top);
|
|
@@ -63937,7 +64136,7 @@ ${i18n.__("转大小写")}
|
|
|
63937
64136
|
if (e3 == null)
|
|
63938
64137
|
e3 = "";
|
|
63939
64138
|
var n3 = this.getFormatter();
|
|
63940
|
-
return n3 && (e3 = n3
|
|
64139
|
+
return n3 && (e3 = this._callFormatterSafely(n3, [e3, this.options, this._currenttemplateData], e3)), e3 == null ? "" : e3;
|
|
63941
64140
|
}, e2.prototype.createTarget = function(t5, e3) {
|
|
63942
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>');
|
|
63943
64142
|
return this.updateTargetImage(n3, t5, e3), n3;
|
|
@@ -63951,44 +64150,7 @@ ${i18n.__("转大小写")}
|
|
|
63951
64150
|
}, e2.prototype.updateDesignViewFromOptions = function() {
|
|
63952
64151
|
this.designTarget && (this.css(this.designTarget, this.getData()), this.updateTargetImage(this.designTarget, this.getTitle(), this.getData()));
|
|
63953
64152
|
}, e2.prototype.updateTargetImage = function(t5, e3, n3) {
|
|
63954
|
-
|
|
63955
|
-
if (src2 == null)
|
|
63956
|
-
return "";
|
|
63957
|
-
src2 = String(src2).trim();
|
|
63958
|
-
if (!src2)
|
|
63959
|
-
return "";
|
|
63960
|
-
if (/^data:/i.test(src2))
|
|
63961
|
-
return src2;
|
|
63962
|
-
if (/^(https?:)?\/\//i.test(src2))
|
|
63963
|
-
return src2;
|
|
63964
|
-
if (/^blob:/i.test(src2) || /^file:/i.test(src2))
|
|
63965
|
-
return src2;
|
|
63966
|
-
if (src2[0] === "/" || src2.indexOf("./") === 0 || src2.indexOf("../") === 0)
|
|
63967
|
-
return src2;
|
|
63968
|
-
if (/^[A-Za-z0-9+/=_-]+$/.test(src2) && src2.length > 80) {
|
|
63969
|
-
var head = src2.slice(0, 10);
|
|
63970
|
-
var m2 = mime;
|
|
63971
|
-
if (!m2) {
|
|
63972
|
-
if (head.indexOf("iVBORw0") === 0)
|
|
63973
|
-
m2 = "image/png";
|
|
63974
|
-
else if (head.indexOf("/9j/") === 0)
|
|
63975
|
-
m2 = "image/jpeg";
|
|
63976
|
-
else if (head.indexOf("R0lGOD") === 0)
|
|
63977
|
-
m2 = "image/gif";
|
|
63978
|
-
else if (head.indexOf("UklGR") === 0)
|
|
63979
|
-
m2 = "image/webp";
|
|
63980
|
-
else if (head.indexOf("Qk") === 0)
|
|
63981
|
-
m2 = "image/bmp";
|
|
63982
|
-
else if (head.indexOf("PHN2Zy") === 0)
|
|
63983
|
-
m2 = "image/svg+xml";
|
|
63984
|
-
else
|
|
63985
|
-
m2 = "image/png";
|
|
63986
|
-
}
|
|
63987
|
-
return "data:" + m2 + ";base64," + src2;
|
|
63988
|
-
}
|
|
63989
|
-
return src2;
|
|
63990
|
-
};
|
|
63991
|
-
n3 = normalizeImageSrc2(n3, this.options && (this.options.imageMime || this.options.mime));
|
|
64153
|
+
n3 = normalizeImageSrc(n3, this.options && (this.options.imageMime || this.options.mime));
|
|
63992
64154
|
var title = t5.find(".hiprint-printElement-image-title");
|
|
63993
64155
|
var hideTitle = this.options.hideTitle;
|
|
63994
64156
|
if (hideTitle === "true")
|
|
@@ -64400,10 +64562,10 @@ ${i18n.__("转大小写")}
|
|
|
64400
64562
|
if (this.getField()) {
|
|
64401
64563
|
return {
|
|
64402
64564
|
title: this.options.getHideTitle() ? "" : t5 ? t5 + ":" : "",
|
|
64403
|
-
body: n3 ? n3
|
|
64565
|
+
body: n3 ? this._callFormatterSafely(n3, [t5, v2, this.options, this._currenttemplateData], v2) : v2
|
|
64404
64566
|
};
|
|
64405
64567
|
}
|
|
64406
|
-
return { title: "", body: n3 ? n3
|
|
64568
|
+
return { title: "", body: n3 ? this._callFormatterSafely(n3, [t5, t5, this.options, this._currenttemplateData], t5) : v2 || t5 || "" };
|
|
64407
64569
|
}, e2.prototype.getStructuredContentParts = function(t5, e3) {
|
|
64408
64570
|
var parts = this.getContentParts(t5, e3);
|
|
64409
64571
|
if (this.getContentIndent() === 0 && !this.getField())
|
|
@@ -64466,7 +64628,7 @@ ${i18n.__("转大小写")}
|
|
|
64466
64628
|
}, e2.prototype.getText = function(t5, e3) {
|
|
64467
64629
|
var n3 = this.getFormatter();
|
|
64468
64630
|
e3 && (e3 = 0 != this.options.leftSpaceRemoved ? e3.toString().replace(/^\s*/, "") : e3);
|
|
64469
|
-
return (this.getField() ? (this.options.getHideTitle() ? "" : t5 ? t5 + ":" : "") + (n3 ? n3
|
|
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 || "") || "";
|
|
64470
64632
|
}, e2.prototype.getHtml = function(t5, e3) {
|
|
64471
64633
|
this.setCurrenttemplateData(e3), this.createTempContainer();
|
|
64472
64634
|
var n3 = this.getPaperHtmlResult(t5, e3);
|
|
@@ -64714,11 +64876,11 @@ ${i18n.__("转大小写")}
|
|
|
64714
64876
|
var bodyText;
|
|
64715
64877
|
var useSeparateTitle = false;
|
|
64716
64878
|
if (this.getField()) {
|
|
64717
|
-
bodyText = hinnn.toUpperCase(this.options.upperCase, r2 ? r2
|
|
64879
|
+
bodyText = hinnn.toUpperCase(this.options.upperCase, r2 ? this._callFormatterSafely(r2, [e3, n3, this.options, this._currenttemplateData, t5, i3], n3) : n3);
|
|
64718
64880
|
p2 = titleText + bodyText;
|
|
64719
64881
|
useSeparateTitle = "text" == s3 && this.hasCustomTitleStyle() && !!titleText;
|
|
64720
64882
|
} else {
|
|
64721
|
-
n3 = hinnn.toUpperCase(this.options.upperCase, r2 ? r2
|
|
64883
|
+
n3 = hinnn.toUpperCase(this.options.upperCase, r2 ? this._callFormatterSafely(r2, [e3, e3, this.options, this._currenttemplateData, t5, i3], e3) : e3);
|
|
64722
64884
|
p2 = n3;
|
|
64723
64885
|
}
|
|
64724
64886
|
if (!this.getField() && hideTitle && s3 == "text") {
|
|
@@ -65012,7 +65174,7 @@ ${i18n.__("转大小写")}
|
|
|
65012
65174
|
var html2 = '<div style="display:grid;grid-template-columns:repeat(' + columns2 + ",minmax(0,1fr));gap:" + gap + 'pt;">';
|
|
65013
65175
|
for (var i3 = 0; i3 < safeList.length; i3++) {
|
|
65014
65176
|
var item = safeList[i3] || {};
|
|
65015
|
-
var src2 = item.src || item.url || "";
|
|
65177
|
+
var src2 = normalizeImageSrc(item.src || item.url || "");
|
|
65016
65178
|
var desc = item.desc || item.description || item.name || "";
|
|
65017
65179
|
html2 += '<div style="display:flex;flex-direction:column;align-items:center;"><div style="width:100%;height:' + itemHeight + 'pt;border:1px dashed #8aa4cc;background:#f4f8ff;display:flex;align-items:center;justify-content:center;">' + (src2 ? '<img src="' + src2 + '" style="width:100%;height:100%;object-fit:contain;display:block;" />' : '<span style="color:#6b7fa3;font-size:10pt;">' + i18n.__("图片占位") + "</span>") + '</div><div style="margin-top:4pt;text-align:center;">' + (desc || "") + "</div></div>";
|
|
65018
65180
|
}
|
|
@@ -72269,46 +72431,9 @@ ${i18n.__("转大小写")}
|
|
|
72269
72431
|
const mode = this && this._imgMode ? String(this._imgMode) : "base64";
|
|
72270
72432
|
const imgs = root2 && root2.querySelectorAll ? root2.querySelectorAll("img") : [];
|
|
72271
72433
|
const tasks = [];
|
|
72272
|
-
const normalizeImageSrc2 = function(src2, mime) {
|
|
72273
|
-
if (src2 == null)
|
|
72274
|
-
return "";
|
|
72275
|
-
src2 = String(src2).trim();
|
|
72276
|
-
if (!src2)
|
|
72277
|
-
return "";
|
|
72278
|
-
if (/^data:/i.test(src2))
|
|
72279
|
-
return src2;
|
|
72280
|
-
if (/^(https?:)?\/\//i.test(src2))
|
|
72281
|
-
return src2;
|
|
72282
|
-
if (/^blob:/i.test(src2) || /^file:/i.test(src2))
|
|
72283
|
-
return src2;
|
|
72284
|
-
if (src2[0] === "/" || src2.indexOf("./") === 0 || src2.indexOf("../") === 0)
|
|
72285
|
-
return src2;
|
|
72286
|
-
if (/^[A-Za-z0-9+/=_-]+$/.test(src2) && src2.length > 80) {
|
|
72287
|
-
var head = src2.slice(0, 10);
|
|
72288
|
-
var m2 = mime;
|
|
72289
|
-
if (!m2) {
|
|
72290
|
-
if (head.indexOf("iVBORw0") === 0)
|
|
72291
|
-
m2 = "image/png";
|
|
72292
|
-
else if (head.indexOf("/9j/") === 0)
|
|
72293
|
-
m2 = "image/jpeg";
|
|
72294
|
-
else if (head.indexOf("R0lGOD") === 0)
|
|
72295
|
-
m2 = "image/gif";
|
|
72296
|
-
else if (head.indexOf("UklGR") === 0)
|
|
72297
|
-
m2 = "image/webp";
|
|
72298
|
-
else if (head.indexOf("Qk") === 0)
|
|
72299
|
-
m2 = "image/bmp";
|
|
72300
|
-
else if (head.indexOf("PHN2Zy") === 0)
|
|
72301
|
-
m2 = "image/svg+xml";
|
|
72302
|
-
else
|
|
72303
|
-
m2 = "image/png";
|
|
72304
|
-
}
|
|
72305
|
-
return "data:" + m2 + ";base64," + src2;
|
|
72306
|
-
}
|
|
72307
|
-
return src2;
|
|
72308
|
-
};
|
|
72309
72434
|
imgs.forEach((img) => {
|
|
72310
72435
|
let src2 = img.getAttribute("src") || "";
|
|
72311
|
-
var normalized =
|
|
72436
|
+
var normalized = normalizeImageSrc(src2, img.getAttribute("data-hiprint-mime") || img.getAttribute("data-mime"));
|
|
72312
72437
|
if (normalized && normalized !== src2) {
|
|
72313
72438
|
try {
|
|
72314
72439
|
img.setAttribute("src", normalized);
|
|
@@ -72316,8 +72441,12 @@ ${i18n.__("转大小写")}
|
|
|
72316
72441
|
}
|
|
72317
72442
|
src2 = normalized;
|
|
72318
72443
|
}
|
|
72319
|
-
if (!src2 || src2
|
|
72444
|
+
if (!src2 || src2 === window.location.href)
|
|
72445
|
+
return;
|
|
72446
|
+
if (/^data:/i.test(src2)) {
|
|
72447
|
+
tasks.push(waitForImage(img, 1e4));
|
|
72320
72448
|
return;
|
|
72449
|
+
}
|
|
72321
72450
|
tasks.push(async function() {
|
|
72322
72451
|
if (mode === "absolute") {
|
|
72323
72452
|
try {
|
|
@@ -72326,6 +72455,7 @@ ${i18n.__("转大小写")}
|
|
|
72326
72455
|
img.setAttribute("src", a2.href);
|
|
72327
72456
|
} catch (_2) {
|
|
72328
72457
|
}
|
|
72458
|
+
await waitForImage(img, 1e4);
|
|
72329
72459
|
return;
|
|
72330
72460
|
}
|
|
72331
72461
|
try {
|
|
@@ -72366,6 +72496,7 @@ ${i18n.__("转大小写")}
|
|
|
72366
72496
|
});
|
|
72367
72497
|
} catch (_2) {
|
|
72368
72498
|
}
|
|
72499
|
+
await waitForImage(img, 1e4);
|
|
72369
72500
|
return;
|
|
72370
72501
|
}
|
|
72371
72502
|
} catch (_2) {
|
|
@@ -72399,6 +72530,7 @@ ${i18n.__("转大小写")}
|
|
|
72399
72530
|
};
|
|
72400
72531
|
image2.src = src2;
|
|
72401
72532
|
});
|
|
72533
|
+
await waitForImage(img, 1e4);
|
|
72402
72534
|
return;
|
|
72403
72535
|
} catch (_2) {
|
|
72404
72536
|
}
|
|
@@ -73432,16 +73564,12 @@ ${i18n.__("转大小写")}
|
|
|
73432
73564
|
return null == e2 && (e2 = 0), this.printPanels[e2].getElementByName(t5);
|
|
73433
73565
|
}, t4.prototype.getPanel = function(t5) {
|
|
73434
73566
|
return null == t5 && (t5 = 0), this.printPanels[t5];
|
|
73435
|
-
}, t4.prototype.loadAllImages = function(t5, e2
|
|
73436
|
-
|
|
73437
|
-
|
|
73438
|
-
|
|
73439
|
-
|
|
73440
|
-
|
|
73441
|
-
}
|
|
73442
|
-
n3++, !r2 && n3 < 10 ? setTimeout(function() {
|
|
73443
|
-
i3.loadAllImages(t5, e2, n3);
|
|
73444
|
-
}, 500) : e2();
|
|
73567
|
+
}, t4.prototype.loadAllImages = function(t5, e2) {
|
|
73568
|
+
waitForImages(t5 && t5[0], 1e4).then(function() {
|
|
73569
|
+
e2();
|
|
73570
|
+
}, function() {
|
|
73571
|
+
e2();
|
|
73572
|
+
});
|
|
73445
73573
|
}, t4.prototype.setFontList = function(t5) {
|
|
73446
73574
|
this.fontList = t5;
|
|
73447
73575
|
}, t4.prototype.getFontList = function() {
|
|
@@ -77759,7 +77887,7 @@ async function ensureHttpClient() {
|
|
|
77759
77887
|
}
|
|
77760
77888
|
const name = "vg-print-vue2";
|
|
77761
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";
|
|
77762
|
-
const version = "1.0.
|
|
77890
|
+
const version = "1.0.511";
|
|
77763
77891
|
const author = "gmcSimple";
|
|
77764
77892
|
const license = "MIT";
|
|
77765
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.
|
|
4
|
+
"version": "1.0.511",
|
|
5
5
|
"author": "gmcSimple",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "dist/vg-print-vue2.cjs.js",
|