From 2781ed4b696eb4688457df84d1ff0f0b9418f1d8 Mon Sep 17 00:00:00 2001 From: Arcadian Date: Thu, 7 Dec 2023 14:22:14 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E6=B7=BB=E5=8A=A0=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E6=8E=92=E5=88=97=E5=8A=9F=E8=83=BD=EF=BC=88=E6=A8=AA=E5=90=91?= =?UTF-8?q?=E3=80=81=E7=BA=B5=E5=90=91=EF=BC=89=EF=BC=8C=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E9=97=B4=E8=B7=9D=E8=AE=BE=E7=BD=AE=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hiprint/hiprint.bundle.js | 62 ++++++++++++++++++++++++++++++----- src/hiprint/hiprint.config.js | 6 +++- 2 files changed, 59 insertions(+), 9 deletions(-) diff --git a/src/hiprint/hiprint.bundle.js b/src/hiprint/hiprint.bundle.js index ef0b56ac..ad7a6d9c 100644 --- a/src/hiprint/hiprint.bundle.js +++ b/src/hiprint/hiprint.bundle.js @@ -4635,6 +4635,36 @@ var hiprint = function (t) { this.target.remove(); }, t; }(), + panelLayoutOptions = function(){ + function t() { + this.name = "panelLayoutOptions"; + } + return t.prototype.createTarget = function () { + this.target = $(`
${i18n.__('面板排列')}
`); + this.layoutType = $(`
${i18n.__('排列方式')}:
`) + this.layoutRowGap = $(`
${i18n.__('垂直间距')}:
`); + this.layoutColumnGap = $(`
${i18n.__('水平间距')}:
`); + this.target.append(this.layoutType) + this.target.append(this.layoutRowGap) + this.target.append(this.layoutColumnGap) + return this.target; + }, t.prototype.getValue = function () { + let opt = { + layoutType: this.layoutType.find("select").val() || 'column', + layoutRowGap:parseInt(this.layoutRowGap.find('input').val() || 0), + layoutColumnGap:parseInt(this.layoutColumnGap.find('input').val() || 0), + } + let options = Object.assign({}, this.options, opt); + return options; + }, t.prototype.setValue = function (t) { + this.options = t; + this.layoutType.find("select").val(t.layoutType || 'column'); + this.layoutRowGap.find("input").val(t.layoutRowGap); + this.layoutColumnGap.find("input").val(t.layoutColumnGap); + }, t.prototype.destroy = function () { + this.target.remove(); + }, t; + }(), lt = function () { function t() { this.name = "gridColumns"; @@ -5119,7 +5149,7 @@ var hiprint = function (t) { t.init(), t.printElementOptionItems[e.name] = e; }, t.getItem = function (e) { return t.init(), t.printElementOptionItems[e]; - }, t._printElementOptionItems = [new fontFamily(), new r(), new a(), new p(), new i(), new s(), new l(), new pt(), new u(), new d(), new c(), new h(), new f(), new g(), new m(), new d2(), new c2(), new v(), new y(), new b(), new E(), new qrCodeLevel(), new T(), new P(), new _(), new w(), new x(), new coordinate(), new widthHeight(), new C(), new imageFit(), new O(), new H(), new D(), new paperNumberContinue(), new watermarkOptions(), new I(), new R(), new pageBreak(), new M(), new M2(), new S(), new B(), new F(), new L(), new A(), new z(), new k(), new st(), new N(), new V(), new W(), new j(), new U(), new zIndex(), new K(), new G(), new q(), new X(), new Y(), new Q(), new J(), new Z(), new tt(), new et(), new nt(), new it(), new ot(),new textWrap(), new at(), new lt(), new ut(), new ith(), new dt(), new ct(), new ht(), new ft(), new gt(), new mt(), new rowcolumns(), new rowsColumnsMergeClean(), new groupFieldsFormatter(), new groupFormatter(), new groupFooterFormatter(), new vt(), new yt(), new bt(), new Tt(), new Et(), new Pt(), new stylerHeader(), new renderFormatter(), new _t(), new wt(), new maxRows(), new xt(), new tableColumnH(), new tableE(), new tableQRCodeLevel(), new tablept(), new tableSummaryTitle(), new tableSummaryText(), new tableSummaryColspan(), new tableSummary(), new tableSummaryAlign(), new tableSummaryNumFormat(), new tableSummaryFormatter(), new upperCase(), new barcodeType(), new qrcodeType()], t; + }, t._printElementOptionItems = [new fontFamily(), new r(), new a(), new p(), new i(), new s(), new l(), new pt(), new u(), new d(), new c(), new h(), new f(), new g(), new m(), new d2(), new c2(), new v(), new y(), new b(), new E(), new qrCodeLevel(), new T(), new P(), new _(), new w(), new x(), new coordinate(), new widthHeight(), new C(), new imageFit(), new O(), new H(), new D(), new paperNumberContinue(), new watermarkOptions(), new I(), new R(), new pageBreak(), new M(), new M2(), new S(), new B(), new F(), new L(), new A(), new z(), new k(), new st(), new N(), new V(), new W(), new j(), new U(), new zIndex(), new K(), new G(), new q(), new X(), new Y(), new Q(), new J(), new Z(), new tt(), new et(), new nt(), new it(), new ot(),new textWrap(), new at(), new lt(), new panelLayoutOptions(), new ut(), new ith(), new dt(), new ct(), new ht(), new ft(), new gt(), new mt(), new rowcolumns(), new rowsColumnsMergeClean(), new groupFieldsFormatter(), new groupFormatter(), new groupFooterFormatter(), new vt(), new yt(), new bt(), new Tt(), new Et(), new Pt(), new stylerHeader(), new renderFormatter(), new _t(), new wt(), new maxRows(), new xt(), new tableColumnH(), new tableE(), new tableQRCodeLevel(), new tablept(), new tableSummaryTitle(), new tableSummaryText(), new tableSummaryColspan(), new tableSummary(), new tableSummaryAlign(), new tableSummaryNumFormat(), new tableSummaryFormatter(), new upperCase(), new barcodeType(), new qrcodeType()], t; }(); }, function (t, e, n) { "use strict"; @@ -9276,7 +9306,7 @@ var hiprint = function (t) { t.height ? (this.height = t.height, this.width = t.width) : (this.height = e.height, this.width = e.width); } else this.height = t.height, this.width = t.width; - this.paperHeader = t.paperHeader || 0, this.paperFooter = t.paperFooter || o.a.mm.toPt(this.height), this.printElements = t.printElements || [], this.paperNumberLeft = t.paperNumberLeft, this.paperNumberTop = t.paperNumberTop, this.paperNumberDisabled = t.paperNumberDisabled, this.paperNumberContinue = t.paperNumberContinue, this.paperNumberFormat = t.paperNumberFormat, this.panelPaperRule = t.panelPaperRule, this.panelPageRule = t.panelPageRule, this.rotate = t.rotate || void 0, this.firstPaperFooter = t.firstPaperFooter, this.evenPaperFooter = t.evenPaperFooter, this.oddPaperFooter = t.oddPaperFooter, this.lastPaperFooter = t.lastPaperFooter, this.topOffset = t.topOffset, this.fontFamily = t.fontFamily, this.leftOffset = t.leftOffset, this.orient = t.orient, this.scale = t.scale, this.watermarkOptions= t.watermarkOptions; + this.paperHeader = t.paperHeader || 0, this.paperFooter = t.paperFooter || o.a.mm.toPt(this.height), this.printElements = t.printElements || [], this.paperNumberLeft = t.paperNumberLeft, this.paperNumberTop = t.paperNumberTop, this.paperNumberDisabled = t.paperNumberDisabled, this.paperNumberContinue = t.paperNumberContinue, this.paperNumberFormat = t.paperNumberFormat, this.panelPaperRule = t.panelPaperRule, this.panelPageRule = t.panelPageRule, this.rotate = t.rotate || void 0, this.firstPaperFooter = t.firstPaperFooter, this.evenPaperFooter = t.evenPaperFooter, this.oddPaperFooter = t.oddPaperFooter, this.lastPaperFooter = t.lastPaperFooter, this.topOffset = t.topOffset, this.fontFamily = t.fontFamily, this.leftOffset = t.leftOffset, this.orient = t.orient, this.scale = t.scale, this.watermarkOptions= t.watermarkOptions, this.panelLayoutOptions = t.panelLayoutOptions; }; }(), at = function () { @@ -9295,7 +9325,7 @@ var hiprint = function (t) { }(), pt = function () { function t(t, e) { - this.templateId = e, this.index = t.index, this.name = t.name, this.width = t.width, this.height = t.height, this.paperType = t.paperType, this.paperHeader = t.paperHeader, this.paperFooter = t.paperFooter, this.initPrintElements(t.printElements), this.paperNumberLeft = t.paperNumberLeft, this.paperNumberTop = t.paperNumberTop, this.paperNumberDisabled = t.paperNumberDisabled, this.paperNumberContinue = t.paperNumberContinue == void 0 ? true : t.paperNumberContinue, this.paperNumberFormat = t.paperNumberFormat, this.panelPaperRule = t.panelPaperRule, this.panelPageRule = t.panelPageRule, this.firstPaperFooter = t.firstPaperFooter, this.evenPaperFooter = t.evenPaperFooter, this.oddPaperFooter = t.oddPaperFooter, this.lastPaperFooter = t.lastPaperFooter, this.topOffset = t.topOffset, this.leftOffset = t.leftOffset, this.fontFamily = t.fontFamily, this.orient = t.orient, this.target = this.createTarget(), this.rotate = t.rotate, this.scale = t.scale, this.watermarkOptions = t.watermarkOptions || {}; + this.templateId = e, this.index = t.index, this.name = t.name, this.width = t.width, this.height = t.height, this.paperType = t.paperType, this.paperHeader = t.paperHeader, this.paperFooter = t.paperFooter, this.initPrintElements(t.printElements), this.paperNumberLeft = t.paperNumberLeft, this.paperNumberTop = t.paperNumberTop, this.paperNumberDisabled = t.paperNumberDisabled, this.paperNumberContinue = t.paperNumberContinue == void 0 ? true : t.paperNumberContinue, this.paperNumberFormat = t.paperNumberFormat, this.panelPaperRule = t.panelPaperRule, this.panelPageRule = t.panelPageRule, this.firstPaperFooter = t.firstPaperFooter, this.evenPaperFooter = t.evenPaperFooter, this.oddPaperFooter = t.oddPaperFooter, this.lastPaperFooter = t.lastPaperFooter, this.topOffset = t.topOffset, this.leftOffset = t.leftOffset, this.fontFamily = t.fontFamily, this.orient = t.orient, this.target = this.createTarget(), this.rotate = t.rotate, this.scale = t.scale, this.watermarkOptions = t.watermarkOptions || {}, this.panelLayoutOptions = t.panelLayoutOptions || {}; } return t.prototype.design = function (t) { @@ -9314,12 +9344,13 @@ var hiprint = function (t) { lastPaperFooter: e.lastPaperFooter, leftOffset: e.leftOffset, topOffset: e.topOffset, + panelLayoutOptions:e.panelLayoutOptions || {}, fontFamily: e.fontFamily, orient: e.orient, paperNumberDisabled: e.paperNumberDisabled, paperNumberContinue: e.paperNumberContinue, paperNumberFormat: e.paperNumberFormat, - watermarkOptions: e.watermarkOptions || {} + watermarkOptions: e.watermarkOptions || {}, }; if (!p.a.instance.paperNumberContinue) { delete panelOptions['paperNumberContinue']; @@ -9327,7 +9358,7 @@ var hiprint = function (t) { o.a.event.trigger("BuildCustomOptionSettingEventKey_" + e.templateId, { options: panelOptions, callback: function callback(t) { - e.watermarkOptions = t.watermarkOptions || void 0, (t.watermarkOptions && e.designPaper.createWaterMark(true, 1, t.watermarkOptions)) + e.panelLayoutOptions = t.panelLayoutOptions || {},e.watermarkOptions = t.watermarkOptions || void 0, (t.watermarkOptions && e.designPaper.createWaterMark(true, 1, t.watermarkOptions)) e.panelPaperRule = t.panelPaperRule, e.panelPageRule = t.panelPageRule, e.firstPaperFooter = t.firstPaperFooter, e.evenPaperFooter = t.evenPaperFooter, e.oddPaperFooter = t.oddPaperFooter, e.lastPaperFooter = t.lastPaperFooter, e.leftOffset = t.leftOffset, e.topOffset = t.topOffset, e.fontFamily = t.fontFamily, e.orient = t.orient, e.paperNumberDisabled = e.designPaper.paperNumberDisabled = !!t.paperNumberDisabled || void 0, e.paperNumberContinue = e.designPaper.paperNumberContinue = t.paperNumberContinue, e.paperNumberFormat = t.paperNumberFormat, e.designPaper.paperNumberFormat = t.paperNumberFormat, (t.paperNumberFormat && (e.designPaper.paperNumberTarget = e.designPaper.createPaperNumber(e.designPaper.formatPaperNumber(1, 1), true))), e.designPaper.setOffset(e.leftOffset, e.topOffset), e.css(e.target), e.designPaper.resetPaperNumber(e.designPaper.paperNumberTarget), e.designPaper.triggerOnPaperBaseInfoChanged(); } }); @@ -9361,7 +9392,7 @@ var hiprint = function (t) { this.fontFamily = t.fontFamily, this.orient = t.orient, this.rotate = t.rotate, this.scale = t.scale; this.designPaper.fontFamily = this.fontFamily, this.designPaper.orient = this.orient, this.designPaper.scale = e.designPaper.scale || this.scale; // 面板参数 - this.panelPaperRule = t.panelPaperRule, this.panelPageRule = t.panelPageRule, this.firstPaperFooter = t.firstPaperFooter, this.evenPaperFooter = t.evenPaperFooter, + this.panelLayoutOptions = t.panelLayoutOptions, this.panelPaperRule = t.panelPaperRule, this.panelPageRule = t.panelPageRule, this.firstPaperFooter = t.firstPaperFooter, this.evenPaperFooter = t.evenPaperFooter, this.oddPaperFooter = t.oddPaperFooter, this.lastPaperFooter = t.lastPaperFooter, this.topOffset = t.topOffset, this.leftOffset = t.leftOffset; this.designPaper.setFooter(this.firstPaperFooter, this.evenPaperFooter, this.oddPaperFooter, this.lastPaperFooter), this.designPaper.setOffset(this.leftOffset, this.topOffset); @@ -9584,7 +9615,8 @@ var hiprint = function (t) { orient: this.orient, scale: this.scale, watermarkOptions: this.watermarkOptions ? this.watermarkOptions : void 0, - leftOffset: this.leftOffset + leftOffset: this.leftOffset, + panelLayoutOptions: this.panelLayoutOptions || {} }); }, t.prototype.createTarget = function () { var t = $('
'); @@ -9679,7 +9711,21 @@ var hiprint = function (t) { var e; return (e = t.tid ? a.instance.getElementType(t.tid) : nt.createPrintElementType(t.printElementType)) || console.log("miss " + JSON.stringify(t)), e; }, t.prototype.getPrintStyle = function () { - return " \n"; + let layoutStyle = '' + if(this.panelLayoutOptions['layoutType'] === 'row'){ + layoutStyle = ` + + ` + } + return layoutStyle + " \n"; }, t.prototype.getPrintSizeStyle = function () { return this.paperType ? "size:" + this.paperType + " " + (this.height > this.width ? "portrait" : "landscape") + ";" : "size: " + this.width + "mm " + this.height + "mm " + (this.orient ? 1 == this.orient ? "portrait" : "landscape" : "") + ";"; }, t.prototype.deletePrintElement = function (t) { diff --git a/src/hiprint/hiprint.config.js b/src/hiprint/hiprint.config.js index 9e907d3a..7dd851c8 100644 --- a/src/hiprint/hiprint.config.js +++ b/src/hiprint/hiprint.config.js @@ -68,7 +68,11 @@ { name: 'watermarkOptions', hidden: false - } + }, + { + name: 'panelLayoutOptions', + hidden: false + }, ], default: {} },