From a3d0e53dee5efa6794e765e54d0c89fd2ed5e05f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E4=B9=A6=E6=9F=B1?= Date: Fri, 29 Apr 2022 03:48:34 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=97=8B=E8=BD=AC=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=8C=E7=BC=A9=E6=94=BE=E6=8B=96=E5=8A=A8?= =?UTF-8?q?=E6=95=88=E6=9E=9C=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hiprint/hiprint.bundle.js | 123 ++++++++++++++++++++++------------ 1 file changed, 79 insertions(+), 44 deletions(-) diff --git a/src/hiprint/hiprint.bundle.js b/src/hiprint/hiprint.bundle.js index 9da723c..5b7c3b1 100644 --- a/src/hiprint/hiprint.bundle.js +++ b/src/hiprint/hiprint.bundle.js @@ -1244,7 +1244,11 @@ var hiprint = function (t) { onBeforeDrag: function onBeforeDrag(t) { _HiPrintlib__WEBPACK_IMPORTED_MODULE_6__.a.instance.draging = !0, n.designTarget.focus(), n.createLineOfPosition(e); }, + getScale:function getScale (){ + return n.designPaper.scale||1 + }, onStopDrag: function onStopDrag(t) { + //普通元素拖动结束事件history _HiPrintlib__WEBPACK_IMPORTED_MODULE_6__.a.instance.draging = !1, n.removeLineOfPosition(); } }), this.designTarget.hireizeable({ @@ -1266,6 +1270,7 @@ var hiprint = function (t) { }, BasePrintElement.prototype.getPrintElementEntity = function (t) { return t ? new _entity_PrintElementEntity__WEBPACK_IMPORTED_MODULE_0__.a(void 0, this.options.getPrintElementOptionEntity(), this.printElementType.getPrintElementTypeEntity()) : new _entity_PrintElementEntity__WEBPACK_IMPORTED_MODULE_0__.a(this.printElementType.tid, this.options.getPrintElementOptionEntity()); }, BasePrintElement.prototype.submitOption = function () { + // 右侧选项修改模版数据触发history var t = this; this.getPrintElementOptionItems().forEach(function (e) { var n = e.getValue(); @@ -1279,7 +1284,8 @@ var hiprint = function (t) { this.options.setRotate(r), _assets_plugins_hinnn__WEBPACK_IMPORTED_MODULE_4__.a.event.trigger("hiprintTemplateDataChanged_" + this.templateId); }, BasePrintElement.prototype.onResize = function (t, e, n, i, o) { this.updateSizeAndPositionOptions(o, i, n, e); - }, BasePrintElement.prototype.getOrderIndex = function () { + }, + BasePrintElement.prototype.getOrderIndex = function () { return this.options.getTop(); }, BasePrintElement.prototype.getHtml = function (t, e, n) { var i = 0; @@ -1710,8 +1716,6 @@ var hiprint = function (t) { return this.title; }, t.prototype.beginEdit = function (t) { var e = this; - console.log(t) - console.log(e) if (e.tableOptions.options.fields && e.tableOptions.options.fields.length) { this.editor = r.Instance.createSelect("select"), t.getTarget().html(""), this.editor.init(e.tableOptions.options.fields, t), this.editor.setValue(this.field || ""), $(this.editor.target).keydown(function (n) { 13 == n.keyCode && e.endEdit(t); @@ -3820,7 +3824,8 @@ var hiprint = function (t) { return t.init(), t.printElementOptionItems[e]; }, t._printElementOptionItems = [new o(), 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 v(), new y(), new b(), new E(), new T(), new P(), new _(), new w(), new x(), new C(), new O(), new H(), new D(), new I(), new R(), 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 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 at(), new lt(), new ut(), new it(), new dt(), new ct(), new ht(), new ft(), new gt(), new mt(), new vt(), new yt(), new bt(), new Tt(), new Et(), new Pt(), new _t(), new wt(), new xt(),new tableColumnH(),new tableE(),new tablept()], t; }(); -}, function (t, e, n) { +}, +function (t, e, n) { "use strict"; n.d(e, "a", function () { @@ -3897,7 +3902,8 @@ var hiprint = function (t) { this.rowIndex = t, this.cell = e; }; }(); -}, function (t, e, n) { +}, +function (t, e, n) { "use strict"; n.d(e, "a", function () { @@ -3912,7 +3918,8 @@ var hiprint = function (t) { return this.id += 1, this.id; }, t.id = 1, t; }(); -}, function (t, e, n) { +}, +function (t, e, n) { "use strict"; n.d(e, "a", function () { @@ -3957,7 +3964,8 @@ var hiprint = function (t) { }), t; }, e; }(r.a); -}, function (t, e, n) { +}, +function (t, e, n) { "use strict"; n.d(e, "a", function () { @@ -4006,7 +4014,8 @@ var hiprint = function (t) { }), t; }, t; }(); -}, function (t, e, n) { +}, +function (t, e, n) { "use strict"; n.d(e, "a", function () { @@ -4036,7 +4045,8 @@ var hiprint = function (t) { }; }, t; }(); -}, function (module, __webpack_exports__, __webpack_require__) { +}, +function (module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.d(__webpack_exports__, "a", function () { @@ -4297,6 +4307,9 @@ var hiprint = function (t) { onBeforeDrag: function onBeforeDrag(t) { _HiPrintlib__WEBPACK_IMPORTED_MODULE_9__.a.instance.draging = !0, n.createLineOfPosition(e); }, + getScale:function getScale (){ + return n.designPaper.scale||1 + }, onStopDrag: function onStopDrag(t) { _HiPrintlib__WEBPACK_IMPORTED_MODULE_9__.a.instance.draging = !1, n.removeLineOfPosition(); } @@ -4392,7 +4405,8 @@ var hiprint = function (t) { return gridColumnsFooterFormatter; }, TablePrintElement; }(_BasePrintElement__WEBPACK_IMPORTED_MODULE_0__.a); -}, function (t, e, n) { +}, +function (t, e, n) { "use strict"; var i = function () { @@ -4990,7 +5004,8 @@ var hiprint = function (t) { this.resizer.updateRowGrips(); }, t; }(); -}, function (t, e, n) { +}, +function (t, e, n) { "use strict"; n.d(e, "a", function () { @@ -5002,7 +5017,8 @@ var hiprint = function (t) { this.tid = t, this.options = e, this.printElementType = n; }; }(); -}, function (t, e, n) { +}, +function (t, e, n) { "use strict"; var i = n(3), @@ -5079,7 +5095,8 @@ var hiprint = function (t) { })), e; }, e; }(i.a); -}, function (t, e, n) { +}, +function (t, e, n) { "use strict"; n.d(e, "a", function () { @@ -5091,7 +5108,8 @@ var hiprint = function (t) { this.rowColumns = []; }; }(); -}, function (t, e, n) { +}, +function (t, e, n) { "use strict"; n.d(e, "a", function () { @@ -5107,18 +5125,23 @@ var hiprint = function (t) { return this.target.find(".hi-grid-col:eq(" + t + ")"); }, t; }(); -}, function (t, e, n) { +}, +function (t, e, n) { t.exports = n(33); -}, function (t, e) { +}, +function (t, e) { !function (t) { function e(e) { + var n = t.data(e.data.target, "hidraggable"), i = n.options, o = n.proxy, r = e.data, - a = r.startLeft + e.pageX - r.startX, - p = r.startTop + e.pageY - r.startY; + a = r.startLeft + (e.pageX - r.startX) / n.options.getScale() , + p = r.startTop + (e.pageY - r.startY) / n.options.getScale() ; o && (o.parent()[0] == document.body ? (a = null != i.deltaX && null != i.deltaX ? e.pageX + i.deltaX : e.pageX - e.data.offsetWidth, p = null != i.deltaY && null != i.deltaY ? e.pageY + i.deltaY : e.pageY - e.data.offsetHeight) : (null != i.deltaX && null != i.deltaX && (a += e.data.offsetWidth + i.deltaX), null != i.deltaY && null != i.deltaY && (p += e.data.offsetHeight + i.deltaY))), e.data.parent != document.body && (a += t(e.data.parent).scrollLeft(), p += t(e.data.parent).scrollTop()), "h" == i.axis ? r.left = a : "v" == i.axis ? r.top = p : (r.left = a, r.top = p); + + } function n(e) { @@ -5149,6 +5172,7 @@ var hiprint = function (t) { } function o(i) { + // 移动开始动作 var o = t.data(i.data.target, "hidraggable"); e(i); if (i.data.target.className.startsWith('resize-panel') || i.data.target.className.startsWith('hiprint-printElement')) { @@ -5269,7 +5293,6 @@ var hiprint = function (t) { u = e.pageX - o.left; return Math.min(p, s, l, u) > n.options.edge; } - t.data(this, "hidraggable", { options: n, handle: p @@ -5287,6 +5310,7 @@ var hiprint = function (t) { }).bind("mousedown.hidraggable", { target: this }, function (e) { + var ops = t.data(e.data.target, "hidraggable") if (0 != s(e)) { t(this).css("cursor", ""); var n = t(e.data.target).position(), @@ -5304,22 +5328,23 @@ var hiprint = function (t) { target: e.data.target, parent: t(e.data.target).parent()[0] }; - var tr = p.target.style.transform && parseInt(p.target.style.transform.slice(7,-1)); - if (tr) { - var rad = tr * Math.PI / 180, - width = t(e.data.target).outerWidth(), - height = t(e.data.target).outerHeight(), - sin = Math.sin(rad), - cos = Math.cos(rad); - var w = Math.abs(width * cos) + Math.abs(height * sin), - h = Math.abs(width * sin) + Math.abs(height * cos); - var diffW = (w - width) / 2, diffH = (h - height) / 2; - p.left += diffW, p.top += diffH, p.startLeft += diffW, p.startTop += diffH; - } - var ptr = t('.hiprint-printPaper')[0].style.transform && parseFloat(t('.hiprint-printPaper')[0].style.transform.slice(6,-1)); - if (ptr) { - p.left /= ptr, p.top /= ptr, p.startLeft /= ptr, p.startTop /= ptr; - } + + var ptr = ops.options.getScale() + if (ptr) { + p.left /= ptr, p.top /= ptr, p.startLeft /= ptr, p.startTop /= ptr; + } + var tr = p.target.style.transform && parseInt(p.target.style.transform.slice(7,-1)); + if (tr) { + var rad = tr * Math.PI / 180, + width = t(e.data.target).outerWidth(), + height = t(e.data.target).outerHeight(), + sin = Math.sin(rad), + cos = Math.cos(rad); + var w = Math.abs(width * cos) + Math.abs(height * sin), + h = Math.abs(width * sin) + Math.abs(height * cos); + var diffW = (w - width) / 2, diffH = (h - height) / 2; + p.left += diffW, p.top += diffH, p.startLeft += diffW, p.startTop += diffH; + } t.extend(e.data, p); // 旋转时不允许移动 if ('r resizebtn' == e.target.className) { @@ -5370,6 +5395,7 @@ var hiprint = function (t) { disabled: !1, edge: 0, axis: null, + getScale:function getScale(t){}, onBeforeDrag: function onBeforeDrag(t) { }, onStartDrag: function onStartDrag(t) { @@ -5651,16 +5677,19 @@ var hiprint = function (t) { } else if (rt) { t.css({ height: "100%" }); var eo = e.pageX, er = e.pageY; - var AB = {}, AC = {}; - AB.X = o - s, AB.Y = r - l, AC.X = eo - s, AC.Y = er - l; - var direct = (AB.X * AC.Y) - (AB.Y * AC.X); - var lAB = Math.sqrt(Math.pow(s - o, 2) + Math.pow(l - r, 2)), - lAC = Math.sqrt(Math.pow(s - eo, 2) + Math.pow(l - er, 2)), - lBC = Math.sqrt(Math.pow(o - eo, 2) + Math.pow(r - er, 2)); - var cosA = (Math.pow(lAB, 2) + Math.pow(lAC, 2) - Math.pow(lBC, 2)) / (2 * lAB * lAC); - var angle = Math.round(Math.acos(cosA) * 180 / Math.PI); + var direct = (eo - o) * 360 / 100; + o = e.pageX + // var AB = {}, AC = {}; + // AB.X = o - s, AB.Y = r - l, AC.X = eo - s, AC.Y = er - l; + // var direct = (AB.X * AC.Y) - (AB.Y * AC.X); + // var lAB = Math.sqrt(Math.pow(s - o, 2) + Math.pow(l - r, 2)), + // lAC = Math.sqrt(Math.pow(s - eo, 2) + Math.pow(l - er, 2)), + // lBC = Math.sqrt(Math.pow(o - eo, 2) + Math.pow(r - er, 2)); + // var cosA = (Math.pow(lAB, 2) + Math.pow(lAC, 2) - Math.pow(lBC, 2)) / (2 * lAB * lAC); + // var angle = Math.round(Math.acos(cosA) * 180 / Math.PI); var lastAngle = (u[0].style.transform && parseInt(u[0].style.transform.slice(7,-1))) || 0; - var R = lastAngle + (direct > 0 ? angle : -angle); + // var R = lastAngle + (direct > 0 ? angle : -angle); + var R = lastAngle + direct ; if (Math.abs(R) > 360) { R = R % 360 } @@ -6484,6 +6513,9 @@ var hiprint = function (t) { onBeforeDrag: function onBeforeDrag(t) { s.a.instance.draging = !0; }, + getScale:function getScale (){ + return i.scale||1 + }, onStopDrag: function onStopDrag(t) { s.a.instance.draging = !1, i.footerLinetarget.removeClass("hidefooterLinetarget"), i.headerLinetarget.removeClass("hideheaderLinetarget"); } @@ -7872,6 +7904,9 @@ var hiprint = function (t) { onBeforeDrag: function onBeforeDrag(t) { e.mouseRect.target.focus(), s.a.instance.draging = !0, e.mouseRect.mouseRectSelectedElement || (e.mouseRect.mouseRectSelectedElement = e.getElementInRect(e.mouseRect)); }, + getScale:function getScale (){ + return e.designPaper.scale||1 + }, onStopDrag: function onStopDrag(t) { s.a.instance.draging = !1; } -- Gitee From 3374e98e7e6db859ebd5a90eec9b9ccadb0f9e83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E4=B9=A6=E6=9F=B1?= Date: Fri, 29 Apr 2022 12:01:21 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E7=BC=A9=E6=94=BE=E5=90=8E=E5=AE=BD?= =?UTF-8?q?=E9=AB=98=E6=8B=96=E5=8A=A8=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hiprint/hiprint.bundle.js | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/src/hiprint/hiprint.bundle.js b/src/hiprint/hiprint.bundle.js index 5b7c3b1..86925fc 100644 --- a/src/hiprint/hiprint.bundle.js +++ b/src/hiprint/hiprint.bundle.js @@ -1253,6 +1253,9 @@ var hiprint = function (t) { } }), this.designTarget.hireizeable({ showPoints: n.getReizeableShowPoints(), + getScale:function getScale (){ + return n.designPaper.scale||1 + }, onBeforeResize: function onBeforeResize() { _HiPrintlib__WEBPACK_IMPORTED_MODULE_6__.a.instance.draging = !0; }, @@ -4319,6 +4322,9 @@ function (module, __webpack_exports__, __webpack_require__) { onBeforeResize: function onBeforeResize() { _HiPrintlib__WEBPACK_IMPORTED_MODULE_9__.a.instance.draging = !0; }, + getScale:function getScale (){ + return n.designPaper.scale||1 + }, onResize: function onResize(t, i, o, r, a) { n.onResize(t, i, o, r, a), n.hitable && n.hitable.updateColumnGrips(), n.createLineOfPosition(e); }, @@ -4534,6 +4540,10 @@ function (t, e, n) { if (g.a.instance.draging = !0, !s.nextGrip) return !1; e.dragingGrip = s, e.dragingGrip.left = parseFloat(e.dragingGrip.target.css("left").replace("px", "")), s.target.addClass("columngripDraging"); }, + getScale:function getScale (){ + // 待群主大大修复 返回scale属性 + return 1 + }, onStopDrag: function onStopDrag(n) { g.a.instance.draging = !1; var i = parseFloat(e.dragingGrip.target.css("left").replace("px", "")), @@ -5660,15 +5670,16 @@ function (t, e) { t.on("mousedown", function (t) { i.options.onBeforeResize(), o = t.pageX, r = t.pageY, l = u.offset().top, s = u.offset().left, b = !1; }), n(i.options.stage).on("mousemove", function (e) { + console.log(i.options.getScale()) if (d) { - var n = e.pageX - o; + var n = (e.pageX - o) / i.options.getScale(); t.css({ width: "100%" }), u.css({ width: i.numHandlerText(a + n) }), i.options.onResize(e, void 0, i.numHandler(a + n), void 0, void 0); } else if (c) { - var E = e.pageY - r; + var E = (e.pageY - r) / i.options.getScale(); t.css({ height: "100%" }), u.css({ @@ -5695,24 +5706,24 @@ function (t, e) { } u.css({ transform: "rotate(" + R + "deg)" }); i.options.onResize(e, void 0, void 0, void 0, void 0, R); - } else h ? (n = e.pageX - o, t.css({ + } else h ? (n = (e.pageX - o) / i.options.getScale(), t.css({ width: "100%" }), u.css({ width: i.numHandlerText(a - n), left: i.numHandlerText(i.options.noDrag ? void 0 : i.numHandler(s + n)) - }), i.options.onResize(e, void 0, i.numHandler(a - n), void 0, i.options.noDrag ? void 0 : i.numHandler(s + n))) : f ? (E = e.pageY - r, t.css({ + }), i.options.onResize(e, void 0, i.numHandler(a - n), void 0, i.options.noDrag ? void 0 : i.numHandler(s + n))) : f ? (E = (e.pageY - r) / i.options.getScale(), t.css({ height: "100%" }), u.css({ height: i.numHandlerText(p - E), top: i.numHandlerText(i.options.noDrag ? void 0 : l + E) - }), i.options.onResize(e, i.numHandler(p - E), void 0, i.options.noDrag ? void 0 : i.numHandler(l + E), void 0)) : g ? (n = e.pageX - o, E = e.pageY - r, t.css({ + }), i.options.onResize(e, i.numHandler(p - E), void 0, i.options.noDrag ? void 0 : i.numHandler(l + E), void 0)) : g ? (n = (e.pageX - o) / i.options.getScale(), E = (e.pageY - r) / i.options.getScale(), t.css({ height: "100%", width: "100%" }), u.css({ height: i.numHandlerText(p - E), top: i.numHandlerText(i.options.noDrag ? void 0 : l + E), width: i.numHandlerText(a + n) - }), i.options.onResize(e, i.numHandler(p - E), i.numHandler(a + n), i.options.noDrag ? void 0 : i.numHandler(l + E), void 0)) : m ? (n = e.pageX - o, E = e.pageY - r, t.css({ + }), i.options.onResize(e, i.numHandler(p - E), i.numHandler(a + n), i.options.noDrag ? void 0 : i.numHandler(l + E), void 0)) : m ? (n = (e.pageX - o) / i.options.getScale(), E = (e.pageY - r) / i.options.getScale(), t.css({ height: "100%", width: "100%" }), u.css({ @@ -5720,20 +5731,20 @@ function (t, e) { top: i.numHandlerText(i.options.noDrag ? void 0 : l + E), width: i.numHandlerText(a - n), left: i.numHandlerText(i.options.noDrag ? void 0 : s + n) - }), i.options.onResize(e, i.numHandler(p - E), i.numHandler(a - n), i.options.noDrag ? void 0 : i.numHandler(l + E), i.options.noDrag ? void 0 : i.numHandler(s + n))) : v ? (n = e.pageX - o, E = e.pageY - r, t.css({ + }), i.options.onResize(e, i.numHandler(p - E), i.numHandler(a - n), i.options.noDrag ? void 0 : i.numHandler(l + E), i.options.noDrag ? void 0 : i.numHandler(s + n))) : v ? (n = (e.pageX - o) / i.options.getScale(), E = (e.pageY - r) / i.options.getScale(), t.css({ width: "100%", height: "100%" }), u.css({ width: i.numHandlerText(a + n), height: i.numHandlerText(p + E) - }), i.options.onResize(e, i.numHandler(p + E), i.numHandler(a + n), void 0, void 0)) : y ? (n = e.pageX - o, E = e.pageY - r, t.css({ + }), i.options.onResize(e, i.numHandler(p + E), i.numHandler(a + n), void 0, void 0)) : y ? (n = (e.pageX - o) / i.options.getScale(), E = (e.pageY - r) / i.options.getScale(), t.css({ width: "100%", height: "100%" }), u.css({ width: i.numHandlerText(a - n), left: i.numHandlerText(i.options.noDrag ? void 0 : s + n), height: i.numHandlerText(p + E) - }), i.options.onResize(e, i.numHandler(p + E), i.numHandler(a - n), i.numHandler(otundefinedop), i.options.noDrag ? void 0 : i.numHandler(s + n))) : b && (n = e.pageX - o, E = e.pageY - r, u.css({ + }), i.options.onResize(e, i.numHandler(p + E), i.numHandler(a - n), i.numHandler(otundefinedop), i.options.noDrag ? void 0 : i.numHandler(s + n))) : b && (n = (e.pageX - o) / i.options.getScale(), E = (e.pageY - r) / i.options.getScale(), u.css({ left: i.numHandlerText(i.options.noDrag ? void 0 : s + n), top: i.numHandlerText(i.options.noDrag ? void 0 : l + E) }), i.options.onResize(e, void 0, void 0, i.options.noDrag ? void 0 : i.numHandler(l + E), i.options.noDrag ? void 0 : i.numHandler(s + n))); @@ -7406,6 +7417,9 @@ function (t, e) { onBeforeResize: function onBeforeResize() { s.a.instance.draging = !0; }, + getScale:function getScale (){ + return n.designPaper.scale||1 + }, onResize: function onResize(t, i, o, r, a) { n.onResize(t, i, o, r, a), n.hitable.updateColumnGrips(), n.createLineOfPosition(e); }, -- Gitee From 95edec05f59e7e1856cc3237198f863d5615eb9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E4=B9=A6=E6=9F=B1?= Date: Thu, 12 May 2022 10:36:06 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E7=BC=A9=E6=94=BE=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hiprint/hiprint.bundle.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/hiprint/hiprint.bundle.js b/src/hiprint/hiprint.bundle.js index 86925fc..b66d9b2 100644 --- a/src/hiprint/hiprint.bundle.js +++ b/src/hiprint/hiprint.bundle.js @@ -4347,6 +4347,9 @@ function (module, __webpack_exports__, __webpack_require__) { columnDisplayIndexEditable: this.printElementType.columnDisplayIndexEditable, columnResizable: this.printElementType.columnResizable, columnAlignEditable: this.printElementType.columnAlignEditable, + getScale:function getScale (){ + return t.designPaper.scale||1 + }, isEnableEditText: this.printElementType.columnTitleEditable, isEnableEditField: this.printElementType.isEnableEditField, isEnableContextMenu: this.printElementType.isEnableContextMenu, @@ -4537,6 +4540,7 @@ function (t, e, n) { moveUnit: "pt", minMove: 1, onBeforeDrag: function onBeforeDrag(t) { + console.log(99) if (g.a.instance.draging = !0, !s.nextGrip) return !1; e.dragingGrip = s, e.dragingGrip.left = parseFloat(e.dragingGrip.target.css("left").replace("px", "")), s.target.addClass("columngripDraging"); }, @@ -5149,9 +5153,7 @@ function (t, e) { r = e.data, a = r.startLeft + (e.pageX - r.startX) / n.options.getScale() , p = r.startTop + (e.pageY - r.startY) / n.options.getScale() ; - o && (o.parent()[0] == document.body ? (a = null != i.deltaX && null != i.deltaX ? e.pageX + i.deltaX : e.pageX - e.data.offsetWidth, p = null != i.deltaY && null != i.deltaY ? e.pageY + i.deltaY : e.pageY - e.data.offsetHeight) : (null != i.deltaX && null != i.deltaX && (a += e.data.offsetWidth + i.deltaX), null != i.deltaY && null != i.deltaY && (p += e.data.offsetHeight + i.deltaY))), e.data.parent != document.body && (a += t(e.data.parent).scrollLeft(), p += t(e.data.parent).scrollTop()), "h" == i.axis ? r.left = a : "v" == i.axis ? r.top = p : (r.left = a, r.top = p); - - + o && (o.parent()[0] == document.body ? (a = null != i.deltaX && null != i.deltaX ? e.pageX + i.deltaX : e.pageX - e.data.offsetWidth, p = null != i.deltaY && null != i.deltaY ? e.pageY + i.deltaY : e.pageY - e.data.offsetHeight) : (null != i.deltaX && null != i.deltaX && (a += e.data.offsetWidth + i.deltaX), null != i.deltaY && null != i.deltaY && (p += e.data.offsetHeight + i.deltaY))), e.data.parent != document.body && (a += (t(e.data.parent).scrollLeft() / n.options.getScale()) , p += (t(e.data.parent).scrollTop() / n.options.getScale()) ), "h" == i.axis ? r.left = a : "v" == i.axis ? r.top = p : (r.left = a, r.top = p); } function n(e) { @@ -5670,7 +5672,6 @@ function (t, e) { t.on("mousedown", function (t) { i.options.onBeforeResize(), o = t.pageX, r = t.pageY, l = u.offset().top, s = u.offset().left, b = !1; }), n(i.options.stage).on("mousemove", function (e) { - console.log(i.options.getScale()) if (d) { var n = (e.pageX - o) / i.options.getScale(); t.css({ -- Gitee From 6e2e85c73088958e190607b0fd49b224367170d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E4=B9=A6=E6=9F=B1?= Date: Mon, 16 May 2022 16:30:44 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E8=A1=A8=E6=A0=BC=E8=A1=8C=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E5=88=97=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/demo/custom/print-data.js | 60 +++++++++++++++++------------------ src/demo/custom/providers.js | 10 ++++++ src/hiprint/hiprint.bundle.js | 51 ++++++++++++++++++++++++++--- src/hiprint/hiprint.config.js | 5 +++ 4 files changed, 91 insertions(+), 35 deletions(-) diff --git a/src/demo/custom/print-data.js b/src/demo/custom/print-data.js index b58b317..9d8760a 100644 --- a/src/demo/custom/print-data.js +++ b/src/demo/custom/print-data.js @@ -50,35 +50,35 @@ export default { ] }, table: [ - {NAME: '测试商品01', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, - {NAME: '测试商品02', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, - {NAME: '测试商品03', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, - {NAME: '测试商品04', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, - {NAME: '测试商品05', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, - {NAME: '测试商品06', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, - {NAME: '测试商品07', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, - {NAME: '测试商品08', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, - {NAME: '测试商品09', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, - {NAME: '测试商品10', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, - {NAME: '测试商品11', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, - {NAME: '测试商品12', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, - {NAME: '测试商品13', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, - {NAME: '测试商品14', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, - {NAME: '测试商品15', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, - {NAME: '测试商品16', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, - {NAME: '测试商品17', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, - {NAME: '测试商品18', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, - {NAME: '测试商品19', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, - {NAME: '测试商品20', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, - {NAME: '测试商品21', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, - {NAME: '测试商品22', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, - {NAME: '测试商品23', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, - {NAME: '测试商品24', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, - {NAME: '测试商品25', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, - {NAME: '测试商品26', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, - {NAME: '测试商品27', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, - {NAME: '测试商品28', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, - {NAME: '测试商品29', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, - {NAME: '测试商品30', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, + {INDEX: '1', NAME: '测试商品01', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, + {INDEX: '2', NAME: '测试商品02', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, + {INDEX: '3', NAME: '测试商品03', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, + {INDEX: '4', NAME: '测试商品04', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, + {INDEX: '5', NAME: '测试商品05', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, + {INDEX: '6', NAME: '测试商品06', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, + {INDEX: '7', NAME: '测试商品07', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, + {INDEX: '8', NAME: '测试商品08', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, + {INDEX: '9', NAME: '测试商品09', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, + {INDEX: '10', NAME: '测试商品10', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, + {INDEX: '11', NAME: '测试商品11', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, + {INDEX: '12', NAME: '测试商品12', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, + {INDEX: '13', NAME: '测试商品13', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, + {INDEX: '14', NAME: '测试商品14', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, + {INDEX: '15', NAME: '测试商品15', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, + {INDEX: '16', NAME: '测试商品16', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, + {INDEX: '17', NAME: '测试商品17', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, + {INDEX: '18', NAME: '测试商品18', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, + {INDEX: '19', NAME: '测试商品19', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, + {INDEX: '20', NAME: '测试商品20', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, + {INDEX: '21', NAME: '测试商品21', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, + {INDEX: '22', NAME: '测试商品22', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, + {INDEX: '23', NAME: '测试商品23', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, + {INDEX: '24', NAME: '测试商品24', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, + {INDEX: '25', NAME: '测试商品25', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, + {INDEX: '26', NAME: '测试商品26', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, + {INDEX: '27', NAME: '测试商品27', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, + {INDEX: '28', NAME: '测试商品28', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, + {INDEX: '29', NAME: '测试商品29', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, + {INDEX: '30', NAME: '测试商品30', SL: 2, GG: '1*24g', TM: '2O22010100110', DJ: '6.8', JE: '13.6'}, ] }; diff --git a/src/demo/custom/providers.js b/src/demo/custom/providers.js index 1894b2c..08bbdf4 100644 --- a/src/demo/custom/providers.js +++ b/src/demo/custom/providers.js @@ -171,6 +171,16 @@ export const aProvider = function (ops) { {title: '金额', align: 'center', field: 'JE', width: 100, checked: false}, ], ], + rowsColumnsMerge: function(data,row,index){ + 返回一个数组,参数一为列合并数,参数二为行合并数, 被合并的行或者列值设为0 + if(index==0){ + return [1,data.INDEX%2==1?2:1] + }else if(index>0&&index<2){ + return [data.INDEX%2==1?0:1,1] + }else{ + return [data.INDEX%2==1?2:0,1] + } + }, footerFormatter: function (options, rows, data, currentPageGridRowsData) { if (data && data['totalCap']) { return `${'应收金额大写: ' + data['totalCap']}` diff --git a/src/hiprint/hiprint.bundle.js b/src/hiprint/hiprint.bundle.js index 532f986..5bb4e89 100644 --- a/src/hiprint/hiprint.bundle.js +++ b/src/hiprint/hiprint.bundle.js @@ -652,6 +652,10 @@ var hiprint = function (t) { name: "footerFormatter", hidden: !1 }, { + name: "rowsColumnsMerge", + hidden: !1 + }, + { name: "gridColumnsFooterFormatter", hidden: !1 }], @@ -1931,11 +1935,33 @@ var hiprint = function (t) { }); return r; }, TableExcelHelper.createRowTarget = function (t, e, n, i) { + var o = $(""); + var columns = t.rowColumns o.data("rowData", e), t.rowColumns.forEach(function (t, i) { - var r = $(""); + var rowsColumnsMerge ='' + if(n.rowsColumnsMerge){ + eval('rowsColumnsMerge='+n.rowsColumnsMerge) + var rowsColumnsArr = rowsColumnsMerge(e,t,i)||[1,1] + var r = $(``); + }else{ + var r = $(""); + } if ("first" == n.tableHeaderRepeat || "none" == n.tableHeaderRepeat) { - t.field && r.attr("field", t.field), t.align && r.css("text-align", t.align), t.vAlign && r.css("vertical-align", t.vAlign), r.css("width", t.width + "pt"); + t.field && r.attr("field", t.field), t.align && r.css("text-align", t.align), t.vAlign && r.css("vertical-align", t.vAlign); + + //无表头时跨行无效,需根据所跨行数重新计算宽度 + if(n.rowsColumnsMerge){ + if(rowsColumnsArr[1]>1){ + var width = 0; + columns.forEach((item,index) => { + if(index>=i&&(index\n
\n 行/列合并函数\n
\n
\n \n
\n '), this.target; + }, t.prototype.getValue = function () { + var t = this.target.find("textarea").val(); + if (t) return t; + }, t.prototype.setValue = function (t) { + this.target.find("textarea").val(t?t.toString():null); + }, t.prototype.destroy = function () { + this.target.remove(); + }, t; + }(), mt = function () { function t() { this.name = "footerFormatter"; @@ -3833,7 +3875,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 o(), 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 v(), new y(), new b(), new E(), new T(), new P(), new _(), new w(), new x(), new C(), new O(), new H(), new D(), new I(), new R(), 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 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 at(), new lt(), new ut(), new it(), new dt(), new ct(), new ht(), new ft(), new gt(), new mt(), new vt(), new yt(), new bt(), new Tt(), new Et(), new Pt(), new _t(), new wt(), new xt(),new tableColumnH(),new tableE(),new tablept()], t; + }, t._printElementOptionItems = [new o(), 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 v(), new y(), new b(), new E(), new T(), new P(), new _(), new w(), new x(), new C(), new O(), new H(), new D(), new I(), new R(), 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 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 at(), new lt(), new ut(), new it(), new dt(), new ct(), new ht(), new ft(), new gt(), new mt(),new rowcolumns(), new vt(), new yt(), new bt(), new Tt(), new Et(), new Pt(), new _t(), new wt(), new xt(),new tableColumnH(),new tableE(),new tablept()], t; }(); }, function (t, e, n) { "use strict"; @@ -6282,7 +6324,7 @@ var hiprint = function (t) { var e = this; this.text = t.text, this.field = t.field, this.fields = t.fields, this.title = t.title, this.tid = t.tid, this.data = t.data, this.styler = t.styler, this.formatter = t.formatter, this.type = t.type, this.options = t.options, this.editable = t.editable, this.columnDisplayEditable = t.columnDisplayEditable, this.columnDisplayIndexEditable = t.columnDisplayIndexEditable, this.columnTitleEditable = t.columnTitleEditable, this.columnResizable = t.columnResizable, this.columnAlignEditable = t.columnAlignEditable, this.columns = [], (t.columns || []).forEach(function (t, n) { e.columns.push(e.createTableColumnArray(t)); - }), this.rowStyler = t.rowStyler, this.striped = t.striped, this.groupFields = t.groupFields || [], this.groupFormatter = t.groupFormatter, this.groupFooterFormatter = t.groupFooterFormatter, this.footerFormatter = t.footerFormatter, this.gridColumnsFooterFormatter = t.gridColumnsFooterFormatter, + }), this.rowStyler = t.rowStyler, this.striped = t.striped, this.groupFields = t.groupFields || [], this.groupFormatter = t.groupFormatter, this.groupFooterFormatter = t.groupFooterFormatter, this.footerFormatter = t.footerFormatter, this.rowsColumnsMerge = t.rowsColumnsMerge,this.gridColumnsFooterFormatter = t.gridColumnsFooterFormatter, this.isEnableEditField = t.isEnableEditField, this.isEnableContextMenu = t.isEnableContextMenu, this.isEnableInsertRow = t.isEnableInsertRow, this.isEnableDeleteRow = t.isEnableDeleteRow, this.isEnableInsertColumn = t.isEnableInsertColumn, this.isEnableDeleteColumn = t.isEnableDeleteColumn, this.isEnableMergeCell = t.isEnableMergeCell, this.columnObj = this.makeColumnObj(); } @@ -7791,7 +7833,6 @@ var hiprint = function (t) { a.updateSizeAndPositionOptions(e.mathroundToporleft(r.left - o.a.px.toPt(e.target.offset().left)), e.mathroundToporleft(r.top - o.a.px.toPt(e.target.offset().top))); a.setTemplateId(e.templateId), a.setPanel(e), e.appendDesignPrintElement(e.designPaper, a, !0); e.printElements.push(a), a.design(void 0, t); - debugger; o.a.event.trigger("hiprintTemplateDataChanged_" + e.templateId, "新增"); } }); diff --git a/src/hiprint/hiprint.config.js b/src/hiprint/hiprint.config.js index 0991068..098f5c0 100644 --- a/src/hiprint/hiprint.config.js +++ b/src/hiprint/hiprint.config.js @@ -451,6 +451,11 @@ name: 'footerFormatter', hidden: false }, + { + + name: 'rowsColumnsMerge', + hidden: false + }, { name: 'gridColumnsFooterFormatter', hidden: false -- Gitee From 34036be792bf936c49c7c448e2f8f01abc2f70b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E4=B9=A6=E6=9F=B1?= Date: Mon, 16 May 2022 16:37:32 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/demo/custom/providers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/demo/custom/providers.js b/src/demo/custom/providers.js index 08bbdf4..6319c3e 100644 --- a/src/demo/custom/providers.js +++ b/src/demo/custom/providers.js @@ -172,7 +172,7 @@ export const aProvider = function (ops) { ], ], rowsColumnsMerge: function(data,row,index){ - 返回一个数组,参数一为列合并数,参数二为行合并数, 被合并的行或者列值设为0 + // 返回一个数组,参数一为列合并数,参数二为行合并数, 被合并的行或者列值设为0 if(index==0){ return [1,data.INDEX%2==1?2:1] }else if(index>0&&index<2){ -- Gitee