'), this.target;
}, t.prototype.getValue = function () {
var t = this.target.find("select").val();
if (t) return t.toString();
}, t.prototype.setValue = function (t) {
this.target.find("select").val(t);
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
mt = function () {
function t() {
this.name = "transform";
}
return t.prototype.css = function (t, e) {
if (t && t.length) {
if (e) return t.css("transform", "rotate(" + e + "deg)"), t.css("-ms-transform", "rotate(" + e + "deg)"), t.css("-moz-transform", "rotate(" + e + "deg)"), t.css("-webkit-transform", "rotate(" + e + "deg)"), t.css("-o-transform", "rotate(" + e + "deg)"), "transform:rotate(" + e + "deg)";
t[0].style.transform = "";
}
return null;
}, t.prototype.createTarget = function () {
return this.target = $('
\n
\n 旋转角度\n
\n
\n \n
\n
'), this.target;
}, t.prototype.getValue = function () {
var t = this.target.find("input").val();
if (t) return parseFloat(t.toString());
}, t.prototype.setValue = function (t) {
this.target.find("input").val(t);
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
vt = function () {
function t() { }
return t.registerItem = function (e) {
if (e.name) throw new Error("styleItem must have name");
if (t.printElementOptionItems.filter(function (t) {
return t.name == e.name;
}).length) throw new Error("Duplicate registration item [" + e.name + "] item name must be unique " + e.name);
t.printElementOptionItems.push(e);
}, t.getItem = function (e) {
var n = t.printElementOptionItems.filter(function (t) {
return t.name == e;
});
return n.length ? n[0] : null;
}, t.printElementOptionItems = [new O(), new S(), new H(), new F(), new C(), new I(), new D(), new B(), new R(), new L(), new z(), new N(), new k(), new A(), new V(), new W(), new j(), new M(), new G(), new X(), new Y(), new U(), new J(), new K(), new q(), new Q(), new Z(), new tt(), new et(), new nt(), new it(), new ot(), new rt(), new at(), new pt(), new st(), new lt(), new ht(), new ut(), new ct(), new dt(), new ft(), new gt(), new mt()], t;
}(),
yt = function () {
return function (t) {
this.printLine = t.printLine, this.target = t.target, this.referenceElement = t.referenceElement;
};
}(),
bt = function () {
function t(t) {
this.top = t.top, this.left = t.left, this.height = t.height, this.width = t.width, this.bottomInLastPaper = t.bottomInLastPaper, this.beginPrintPaperIndex = t.beginPrintPaperIndex, this.printTopInPaper = t.printTopInPaper, this.endPrintPaperIndex = t.endPrintPaperIndex;
}
return t.prototype.isPositionLeftOrRight = function (t) {
return this.top <= t && this.top + this.height > t;
}, t;
}(),
Tt = function () {
function t(t) {
this.printElementType = t, this.id = s.instance.guid();
}
return t.prototype.getProxyTarget = function () {
var t = this.getData(),
e = this.createTarget(this.getTitle(), t);
return this.updateTargetSize(e), this.css(e, t), e;
}, t.prototype.showInPage = function (t, e) {
var n = this.options.showInPage,
i = this.options.unShowInPage;
if (n) {
if ("first" == n) return 0 == t;
if (t == e - 1 && "last" == i) return !1;
if ("odd" == n) return (0 != t || "first" != i) && t % 2 == 0;
if ("even" == n) return t % 2 == 1;
if ("last" == n) return t == e - 1;
}
return (0 != t || "first" != i) && (t != e - 1 || "last" != i);
}, t.prototype.setTemplateId = function (t) {
this.templateId = t;
}, t.prototype.getField = function () {
return this.options.field || this.printElementType.field;
}, t.prototype.getTitle = function () {
return this.printElementType.title;
}, t.prototype.updateSizeAndPositionOptions = function (t, e, n, i) {
this.options.setLeft(t), this.options.setTop(e), this.options.copyDesignTopFromTop(), this.options.setWidth(n), this.options.setHeight(i);
}, t.prototype.initSizeByHtml = function (t) {
if (t && t.length) {
this.createTempContainer();
var e = t.clone();
this.getTempContainer().append(e), this.options.initSizeByHtml(parseInt(hinnn.px.toPt(e.width()).toString()), parseInt(hinnn.px.toPt(e.height()).toString())), this.removeTempContainer();
}
}, t.prototype.updateTargetSize = function (t) {
t.css("width", this.options.displayWidth()), t.css("height", this.options.displayHeight());
}, t.prototype.updateTargetWidth = function (t) {
t.css("width", this.options.displayWidth());
}, t.prototype.getDesignTarget = function (t) {
var e = this;
return this.designTarget = this.getHtml(t)[0].target, this.designPaper = t, this.designTarget.click(function () {
hinnn.event.trigger(e.getPrintElementSelectEventKey(), e);
}), this.designTarget;
}, t.prototype.getPrintElementSelectEventKey = function () {
return "PrintElementSelectEventKey_" + this.templateId;
}, t.prototype.design = function (t) {
var e = this;
this.designTarget.hidraggable({
axis: e.options.axis && t && t.axisEnabled ? e.options.axis : void 0,
onDrag: function onDrag(t, n, i) {
e.updateSizeAndPositionOptions(n, i);
},
moveUnit: "pt",
minMove: a.instance.movingDistance,
onBeforeDrag: function onBeforeDrag(t) { },
onStopDrag: function onStopDrag(t) { }
}), this.designTarget.hireizeable({
showPoints: e.getReizeableShowPoints(),
onResize: function onResize(t, n, i, o, r) {
e.onResize(t, n, i, o, r);
}
});
}, t.prototype.getPrintElementEntity = function (t) {
return t ? new P(void 0, this.options.getPrintElementOptionEntity(), this.printElementType.getPrintElementTypeEntity()) : new P(this.printElementType.tid, this.options.getPrintElementOptionEntity());
}, t.prototype.submitOption = function () {
var t = this;
this.getPrintElementOptionItems().forEach(function (e) {
var n = e.getValue();
t.options[e.name] = n || void 0;
}), this.updateDesignViewFromOptions();
}, t.prototype.getReizeableShowPoints = function () {
return ["s", "e"];
}, t.prototype.onResize = function (t, e, n, i, o) {
this.updateSizeAndPositionOptions(o, i, n, e);
}, t.prototype.getOrderIndex = function () {
return this.options.getTop();
}, t.prototype.getHtml = function (t, e, n) {
var i = 0;
this.setCurrenttemplateData(e);
var o = [],
r = this.getBeginPrintTopInPaperByReferenceElement(t),
a = t.getPaperFooter(i);
this.isHeaderOrFooter(t) || r > a && (o.push(new yt({
target: void 0,
printLine: void 0
})), r = r - a + t.paperHeader, i++ , a = t.getPaperFooter(i));
var p = this.getData(e),
s = this.createTarget(this.getTitle(), p, n);
return this.updateTargetSize(s), this.css(s, p), s.css("position", "absolute"), s.css("left", this.options.displayLeft()), s.css("top", r + "pt"), o.push(new yt({
target: s,
printLine: r + this.options.getHeight()
})), o;
}, t.prototype.getHtml2 = function (t, e, n) {
var i = 0;
this.setCurrenttemplateData(e);
var o = [],
r = this.getBeginPrintTopInPaperByReferenceElement(t),
a = t.getPaperFooter(i);
this.isHeaderOrFooter(t) || (r > a && (o.push(new yt({
target: void 0,
printLine: void 0
})), r = r - a + t.paperHeader, i++ , a = t.getPaperFooter(i)), r <= a && r + this.options.getHeight() > a && (o.push(new yt({
target: void 0,
printLine: void 0
})), r = t.paperHeader, i++ , a = t.getPaperFooter(i)));
var p = this.getData(e),
s = this.createTarget(this.getTitle(), p);
return this.updateTargetSize(s), this.css(s, p), s.css("position", "absolute"), s.css("left", this.options.displayLeft()), s.css("top", r + "pt"), o.push(new yt({
target: s,
printLine: r + this.options.getHeight(),
referenceElement: new bt({
top: this.options.getTop(),
left: this.options.getLeft(),
height: this.options.getHeight(),
width: this.options.getWidth(),
beginPrintPaperIndex: t.index,
bottomInLastPaper: r + this.options.getHeight(),
printTopInPaper: r
})
})), o;
}, t.prototype.getBeginPrintTopInPaperByReferenceElement = function (t) {
var e = this.options.getTop();
return this.isHeaderOrFooter(t) || this.isFixed() ? e : t.referenceElement.isPositionLeftOrRight(e) ? t.referenceElement.printTopInPaper + (e - t.referenceElement.top) : t.referenceElement.bottomInLastPaper + (e - (t.referenceElement.top + t.referenceElement.height));
}, t.prototype.css = function (t, e) {
var n = this,
i = [],
o = this.getConfigOptions();
if (o) {
var r = o.supportOptions;
r && r.forEach(function (e) {
var o = vt.getItem(e.name);
if (o && o.css) {
var r = o.css(t, n.options.getValueFromOptionsOrDefault(e.name));
r && i.push(r);
}
});
}
this.stylerCss(t, e);
}, t.prototype.stylerCss = function (t, e) {
if (this.printElementType.styler) {
var n = this.printElementType.styler(e[this.getField()], this.options, t, this._currenttemplateData);
if (n) Object.keys(n).forEach(function (e) {
t.css(e, n[e]);
});
}
}, t.prototype.getData = function (t) {
return t ? t[this.getField()] || "" : this.printElementType.getData();
}, t.prototype.getPrintElementOptionItems = function () {
if (this._printElementOptionItems) return this._printElementOptionItems;
var t = [],
e = this.getConfigOptions();
if (e) {
var n = e.supportOptions;
n && n.filter(function (t) {
return !t.hidden;
}).forEach(function (e) {
var n = vt.getItem(e.name);
t.push(n);
});
}
return this._printElementOptionItems = this.filterOptionItems(t.concat()), this._printElementOptionItems;
}, t.prototype.filterOptionItems = function (t) {
return this.printElementType.field ? t.filter(function (t) {
return "field" != t.name;
}) : t;
}, t.prototype.createTempContainer = function () {
this.removeTempContainer(), $("body").append($(''));
}, t.prototype.removeTempContainer = function () {
$(".hiprint_temp_Container").remove();
}, t.prototype.getTempContainer = function () {
return $(".hiprint_temp_Container");
}, t.prototype.isHeaderOrFooter = function (t) {
return this.options.getTopInDesign() < t.paperHeader || this.options.getTopInDesign() >= t.paperFooter;
}, t.prototype.delete = function () {
this.designTarget && this.designTarget.remove();
}, t.prototype.setCurrenttemplateData = function (t) {
this._currenttemplateData = t;
}, t.prototype.isFixed = function () {
return this.options.fixed;
}, t.prototype.onRendered = function (t, e) {
this.printElementType && this.printElementType.onRendered && this.printElementType.onRendered(e, this.options, t.getTarget());
}, t;
}(),
wt = function () {
return function () {
this.rowColumns = [];
};
}(),
Et = function () {
function t() { }
return t.createTableHead = function (e, n) {
for (var i = t.reconsitutionTableColumnTree(e), o = $(""), r = t.getColumnsWidth(i, n), a = function a(t) {
var e = $("
");
i[t].forEach(function (t) {
var n = $("
");
t.field && n.attr("field", t.field), t.align && n.css("text-align", t.halign || t.align), t.vAlign && n.css("vertical-align", t.vAlign), t.colspan > 1 && n.attr("colspan", t.colspan), t.rowspan > 1 && n.attr("rowspan", t.rowspan), n.html(t.title), r[t.field] ? (n.attr("haswidth", "haswidth"), t.hasWidth = !0, n.css("width", r[t.field] + "pt")) : t.hasWidth = !1, e.append(n);
}), o.append(e);
}, p = 0; p < i.totalLayer; p++) {
a(p);
}
return o;
}, t.createTableFooter = function (t, e, n, i) {
var o = $("");
return o.append(i.footerFormatter(n)), o;
}, t.createTableRow = function (e, n, i, o) {
var r = t.reconsitutionTableColumnTree(e),
a = $("");
(n || (n = []), o.groupFields.length) ? hinnn.groupBy(n, o.groupFields, function (t) {
var e = {};
return o.groupFields.forEach(function (n) {
return e[n] = t[n];
}), e;
}).forEach(function (e) {
if (o.groupFormatter) {
var n = $("
");
n.find("td").append(o.groupFormatter(e, i)), a.append(n);
}
if (e.rows.forEach(function (e) {
var n = t.createRowTarget(r, e, o, i);
a.append(n);
}), o.groupFooterFormatter) {
var p = $("
");
p.find("td").append(o.groupFooterFormatter(e, i)), a.append(p);
}
}) : n.forEach(function (e) {
var n = t.createRowTarget(r, e, o, i);
a.append(n);
});
return a;
}, t.createRowTarget = function (t, e, n, i) {
var o = $("
");
if (t.rowColumns.forEach(function (t, i) {
var r = $("
");
t.field && r.attr("field", t.field), t.align && r.css("text-align", t.align), t.vAlign && r.css("vertical-align", t.vAlign);
var a = t.formatter ? t.formatter(e[t.field], e, i, n) : e[t.field];
if (r.html(a), t.styler) {
var p = t.styler(e[t.field], e, i, n);
if (p) Object.keys(p).forEach(function (t) {
r.css(t, p[t]);
});
}
o.append(r);
}), i.rowStyler) {
var r = i.rowStyler(e, n);
if (r) Object.keys(r).forEach(function (t) {
o.css(t, r[t]);
});
}
return o;
}, t.getColumnsWidth = function (e, n) {
var i = {},
o = t.allAutoWidth(e),
r = t.allFixedWidth(e);
return e.rowColumns.forEach(function (t) {
if (t.fixed) i[t.field] = t.width; else {
var e = n - r,
a = t.width / o * (e > 0 ? e : 0);
i[t.field] = a;
}
}), i;
}, t.resizeTableCellWeight = function (e, n, i) {
var o = t.reconsitutionTableColumnTree(n),
r = t.getColumnsWidth(o, i);
e.find("thead tr td[haswidth]").map(function (t, e) {
var n = $(e).attr("field"),
i = r[n];
$(e).css("width", i + "pt");
});
}, t.allAutoWidth = function (t) {
var e = 0;
return t.rowColumns.forEach(function (t) {
e += t.fixed ? 0 : t.width;
}), e;
}, t.allFixedWidth = function (t) {
var e = 0;
return t.rowColumns.forEach(function (t) {
e += t.fixed ? t.width : 0;
}), e;
}, t.reconsitutionTableColumnTree = function (t, e, n) {
var i = e || new wt();
i.colspan = 0;
for (var o = function o(e) {
i.totalLayer = e + 1, i[e] = t[e], 0 == e && t[e].forEach(function (t) {
i.colspan += t.colspan;
}), i.rowColumns = i.rowColumns.concat(i[e].filter(function (n) {
return n.rowspan == t.length - e;
}));
}, r = 0; r < t.length; r++) {
o(r);
}
return i;
}, t;
}(),
xt = function () {
return function () { };
}(),
Pt = function () {
function t(t) {
t = t || {}, this.left = t.left, this.top = t.top, this.topInDesign = this.top, this.height = t.height, this.width = t.width, this.init(t);
}
return t.prototype.setDefault = function (t) {
this.defaultOptions = t, this.initSize();
}, t.prototype.initSize = function () {
this.width || this.setWidth(this.defaultOptions.width), this.height || this.setHeight(this.defaultOptions.height);
}, t.prototype.initSizeByHtml = function (t, e) {
this.width || this.setWidth(t), this.height || this.setHeight(e);
}, t.prototype.getLeft = function () {
return this.left;
}, t.prototype.displayLeft = function () {
return this.left + "pt";
}, t.prototype.setLeft = function (t) {
null != t && (this.left = t);
}, t.prototype.getTop = function () {
return this.top;
}, t.prototype.getTopInDesign = function () {
return this.topInDesign;
}, t.prototype.displayTop = function () {
return this.top + "pt";
}, t.prototype.setTop = function (t) {
null != t && (this.top = t);
}, t.prototype.copyDesignTopFromTop = function () {
this.topInDesign = this.top;
}, t.prototype.getHeight = function () {
return this.height;
}, t.prototype.displayHeight = function () {
return this.height + "pt";
}, t.prototype.setHeight = function (t) {
null != t && (this.height = t);
}, t.prototype.getWidth = function () {
return this.width;
}, t.prototype.displayWidth = function () {
return this.width + "pt";
}, t.prototype.setWidth = function (t) {
null != t && (this.width = t);
}, t.prototype.getValueFromOptionsOrDefault = function (t) {
return null == this[t] ? this.defaultOptions[t] : this[t];
}, t.prototype.getPrintElementOptionEntity = function () {
var t = new xt(),
e = this;
return Object.keys(this).filter(function (t) {
return "topInDesign" != t;
}).forEach(function (n) {
if ("number" != typeof e[n] && "string" != typeof e[n] && _typeof(e[n]) != _typeof(!0) || (t[n] = e[n]), "style" == n) {
t.style = {};
var i = e[n];
if (i) Object.keys(i).forEach(function (e) {
"number" != typeof i[e] && "string" != typeof i[e] || (t.style[e] = i[e]);
});
}
}), t;
}, t.prototype.init = function (t) {
var e = this;
t && Object.keys(t).forEach(function (n) {
e[n] = t[n];
});
}, t;
}(),
Ct = function () {
var _t4 = function t(e, n) {
return (_t4 = Object.setPrototypeOf || _instanceof({
__proto__: []
}, Array) && function (t, e) {
t.__proto__ = e;
} || function (t, e) {
for (var n in e) {
e.hasOwnProperty(n) && (t[n] = e[n]);
}
})(e, n);
};
return function (e, n) {
function i() {
this.constructor = e;
}
_t4(e, n), e.prototype = null === n ? Object.create(n) : (i.prototype = n.prototype, new i());
};
}(),
Ot = function (t) {
function e(e) {
return t.call(this, e) || this;
}
return Ct(e, t), e;
}(Pt),
St = function () {
var _t5 = function t(e, n) {
return (_t5 = Object.setPrototypeOf || _instanceof({
__proto__: []
}, Array) && function (t, e) {
t.__proto__ = e;
} || function (t, e) {
for (var n in e) {
e.hasOwnProperty(n) && (t[n] = e[n]);
}
})(e, n);
};
return function (e, n) {
function i() {
this.constructor = e;
}
_t5(e, n), e.prototype = null === n ? Object.create(n) : (i.prototype = n.prototype, new i());
};
}(),
Ht = function (t) {
function e(e, n) {
var i = t.call(this, e) || this;
return i.options = new Ot(n), i.options.setDefault(new Ot(a.instance.table.default).getPrintElementOptionEntity()), i;
}
return St(e, t), e.prototype.updateDesignViewFromOptions = function () {
if (this.designTarget) {
this.css(this.designTarget, this.getData());
var t = this.designTarget.find(".hiprint-printElement-table-content"),
e = this.getHtml(this.designPaper);
t.html(""), t.append(e[0].target.find(".hiprint-printElement-tableTarget"));
}
}, e.prototype.css = function (e, n) {
if ((this.getField() || !this.options.content) && !this.printElementType.formatter) return t.prototype.css.call(this, e, n);
}, e.prototype.getDesignTarget = function (t) {
var e = this;
return this.designTarget = this.getHtml(t)[0].target, this.designPaper = t, this.designTarget.click(function () {
hinnn.event.trigger(e.getPrintElementSelectEventKey(), e);
}), this.designTarget.find("td").hidroppable({
accept: ".rn-draggable-item",
onDrop: function onDrop(t, e) { },
onDragEnter: function onDragEnter(t, e) {
$(e).removeClass("rn-draggable-item");
},
onDragLeave: function onDragLeave(t, e) {
$(e).addClass("rn-draggable-item");
}
}), this.designTarget;
}, e.prototype.getConfigOptions = function () {
return a.instance.table;
}, e.prototype.createTarget = function (t, e) {
var n = $('
');
return n.find(".hiprint-printElement-table-content").append(this.getTableHtml(e)), n;
}, e.prototype.createtempEmptyRowsTargetStructure = function () {
if (this.getField()) return this.createTarget(this.printElementType.title, []);
var t = this.createTarget(this.printElementType.title, []).clone();
return t.find("tbody tr").remove(), t;
}, e.prototype.getTableHtml = function (t) {
var e, n;
if (!this.getField() && this.options.content) return (e = $("")).append(this.options.content), (n = e.find("table")).addClass("hiprint-printElement-tableTarget"), n;
if (this.printElementType.formatter) return (e = $("")).append(this.printElementType.formatter(t)), (n = e.find("table")).addClass("hiprint-printElement-tableTarget"), n;
var i = $('
');
return i.append(Et.createTableHead(this.printElementType.columns, this.options.getWidth())), i.append(Et.createTableRow(this.printElementType.columns, t, this.options, this.printElementType)), this.printElementType.footerFormatter && i.append(Et.createTableFooter(this.printElementType.columns, t, this.options, this.printElementType)), i;
}, e.prototype.getHtml = function (t, e) {
this.createTempContainer();
var n = this.getPaperHtmlResult(t, e);
return this.removeTempContainer(), n;
}, e.prototype.getPaperHtmlResult = function (t, e) {
var n = [],
i = this.getData(e),
o = this.getTableHtml(i),
r = this.createtempEmptyRowsTargetStructure();
e ? this.updateTargetWidth(r) : this.updateTargetSize(r), this.css(r, i), this.css(o, i), this.getTempContainer().html(""), this.getTempContainer().append(r);
for (var a, p = this.getBeginPrintTopInPaperByReferenceElement(t), s = 0, l = !1; !l;) {
var h = 0,
u = t.getPaperFooter(s);
0 == s && p > u && (p = p - u + t.paperHeader, n.push(new yt({
target: void 0,
printLine: void 0
})), h = t.getContentHeight(s) - (p - t.paperHeader), s++ , u = t.getPaperFooter(s));
var c = n.length > 0 ? n[n.length - 1].target : void 0,
d = this.getRowsInSpecificHeight(h > 0 ? h : 0 == s ? u - p : t.getContentHeight(s), r, o, s, c);
l = d.isEnd;
var f = void 0;
d.target && (d.target.css("left", this.options.displayLeft()), d.target[0].height = ""), 0 == s || h > 0 ? (d.target && (a = p, d.target.css("top", p + "pt")), f = l && null != this.options.lHeight ? p + (d.height > this.options.lHeight ? d.height : this.options.lHeight) : p + d.height) : (d.target && (a = t.paperHeader, d.target.css("top", t.paperHeader + "pt")), f = t.paperHeader + d.height), n.push(new yt({
target: d.target,
printLine: f,
referenceElement: new bt({
top: this.options.getTop(),
left: this.options.getLeft(),
height: this.options.getHeight(),
width: this.options.getWidth(),
beginPrintPaperIndex: t.index,
bottomInLastPaper: f,
printTopInPaper: a
})
})), s++;
}
return n;
}, e.prototype.getRowsInSpecificHeight = function (t, e, n, i, o) {
var r = void 0,
a = n.find("tbody"),
p = hinnn.pt.toPx(t);
e.find("tbody").html("");
for (var s = e.outerHeight(); ;) {
if (s <= p) {
if (0 == a.find("tr").length) {
r = {
target: e.clone(),
length: e.find("tbody tr").length,
height: hinnn.px.toPt(s),
isEnd: !0
}, 0 == e.find("tbody tr").length && o && (r = {
target: void 0,
length: 0,
height: 0,
isEnd: !0
});
} else {
var l = a.find("tr:lt(1)");
e.find("tbody").append(l), (s = e.outerHeight()) > p && (a.prepend(l), s = e.outerHeight(), r = {
target: e.clone(),
length: e.find("tbody tr").length,
height: hinnn.px.toPt(s),
isEnd: !1
});
}
} else r = {
target: void 0,
length: 0,
height: 0,
isEnd: !1
};
if (r) break;
}
return r;
}, e.prototype.getData = function (t) {
if (!t) return [{}];
var e = t[this.getField()];
return e ? JSON.parse(JSON.stringify(e)) : [];
}, e.prototype.onResize = function (e, n, i, o, r) {
t.prototype.updateSizeAndPositionOptions.call(this, r, o, i, n), Et.resizeTableCellWeight(this.designTarget, this.printElementType.columns, this.options.getWidth());
}, e.prototype.getReizeableShowPoints = function () {
return ["s", "e"];
}, e;
}(Tt),
Ft = function () {
return function (t) {
this.field = t.field, this.title = t.title, this.type = t.type, this.columns = t.columns;
};
}(),
It = function () {
function t(t) {
var e = this;
this.text = t.text, this.field = t.field, 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.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;
}
return t.prototype.getText = function () {
return this.text || this.title || "";
}, t.prototype.createPrintElement = function (t) {
var e = this;
return this.columns && 0 == this.columns.length && (t.columns || []).forEach(function (t, n) {
e.columns.push(e.createTableColumnArray(t));
}), new Ht(this, t);
}, t.prototype.getData = function () {
return [{}];
}, t.prototype.createTableColumnArray = function (t) {
var e = [];
return t.forEach(function (t, n) {
e.push(new x(t));
}), e;
}, t.prototype.getPrintElementTypeEntity = function () {
return new Ft({
title: this.title,
type: this.type
});
}, t;
}(),
Dt = function () {
var _t6 = function t(e, n) {
return (_t6 = Object.setPrototypeOf || _instanceof({
__proto__: []
}, Array) && function (t, e) {
t.__proto__ = e;
} || function (t, e) {
for (var n in e) {
e.hasOwnProperty(n) && (t[n] = e[n]);
}
})(e, n);
};
return function (e, n) {
function i() {
this.constructor = e;
}
_t6(e, n), e.prototype = null === n ? Object.create(n) : (i.prototype = n.prototype, new i());
};
}(),
_t = function (t) {
function e(e, n) {
var i = t.call(this, e) || this;
return i.options = new Pt(n), i.options.setDefault(new Pt(a.instance.image.default).getPrintElementOptionEntity()), console.log(i.options), i;
}
return Dt(e, t), e.prototype.getReizeableShowPoints = function () {
return ["se"];
}, e.prototype.getData = function (t) {
var e = "";
t ? e = this.getField() ? t[this.getField()] || "" : this.options.src || this.printElementType.getData() : e = this.options.src || this.printElementType.getData();
return this.printElementType.formatter && (e = this.printElementType.formatter(e, this.options, this._currenttemplateData)), e || "";
}, e.prototype.createTarget = function (t, e) {
var n = $('
');
return this.updateTargetImage(n, t, e), n;
}, e.prototype.initSizeByHtml = function (e) {
t.prototype.initSizeByHtml.call(this, e), this.css(e, this.getData());
}, e.prototype.getConfigOptions = function () {
return a.instance.image;
}, e.prototype.updateDesignViewFromOptions = function () {
this.designTarget && (this.css(this.designTarget, this.getData()), this.updateTargetImage(this.designTarget, this.getTitle(), this.getData()));
}, e.prototype.updateTargetImage = function (t, e, n) {
var i = t.find(".hiprint-printElement-image-content");
i.find("img").length ? i.find("img").attr("src", n) : i.html('');
}, e.prototype.getHtml = function (t, e, n) {
return this.getHtml2(t, e, n);
}, e;
}(Tt),
Bt = function () {
var _t7 = function t(e, n) {
return (_t7 = Object.setPrototypeOf || _instanceof({
__proto__: []
}, Array) && function (t, e) {
t.__proto__ = e;
} || function (t, e) {
for (var n in e) {
e.hasOwnProperty(n) && (t[n] = e[n]);
}
})(e, n);
};
return function (e, n) {
function i() {
this.constructor = e;
}
_t7(e, n), e.prototype = null === n ? Object.create(n) : (i.prototype = n.prototype, new i());
};
}(),
Rt = function (t) {
function e() {
return null !== t && t.apply(this, arguments) || this;
}
return Bt(e, t), e.prototype.getHideTitle = function () {
return null == this.hideTitle ? this.defaultOptions.hideTitle : this.hideTitle;
}, e;
}(Pt),
Lt = function () {
function t(t, e, n, i, o, r, a, p, s, l, h) {
this.defaultPaperNumberFormat = "paperNo-paperCount", this.printLine = 0, this.templateId = t, this.width = hinnn.mm.toPt(e), this.height = hinnn.mm.toPt(n), this.mmwidth = e, this.mmheight = n, this.paperHeader = i, this.paperFooter = o, this.contentHeight = o - i, this.createTarget(), this.index = l, this.paperNumberLeft = r || parseInt((this.width - 30).toString()), this.paperNumberTop = a || parseInt((this.height - 22).toString()), this.paperNumberDisabled = p, this.paperNumberFormat = s, this.referenceElement = h ? $.extend({}, h) : new bt({
top: 0,
left: 0,
height: 0,
width: 0,
bottomInLastPaper: 0,
beginPrintPaperIndex: 0,
printTopInPaper: 0,
endPrintPaperIndex: 0
});
}
return t.prototype.subscribePaperBaseInfoChanged = function (t) {
this.onPaperBaseInfoChanged = t;
}, t.prototype.triggerOnPaperBaseInfoChanged = function () {
this.onPaperBaseInfoChanged && this.onPaperBaseInfoChanged({
paperHeader: this.paperHeader,
paperFooter: this.paperFooter,
paperNumberLeft: this.paperNumberLeft,
paperNumberTop: this.paperNumberTop,
paperNumberDisabled: this.paperNumberDisabled,
paperNumberFormat: this.paperNumberFormat
});
}, t.prototype.setFooter = function (t, e, n, i) {
this.firstPaperFooter = t, this.evenPaperFooter = e, this.oddPaperFooter = n, this.lastPaperFooter = i;
}, t.prototype.setOffset = function (t, e) {
this.setLeftOffset(t), this.setTopOffset(e);
}, t.prototype.setLeftOffset = function (t) {
t ? this.paperContentTarget.css("left", t + "pt") : this.paperContentTarget[0].style.left = "";
}, t.prototype.setTopOffset = function (t) {
t ? this.paperContentTarget.css("top", t + "pt") : this.paperContentTarget[0].style.top = "";
}, t.prototype.createTarget = function () {
this.target = $('
'), this.paperContentTarget = this.target.find(".hiprint-printPaper-content"), this.target.css("width", this.mmwidth + "mm"), this.target.css("height", this.mmheight - .4 + "mm"), this.target.attr("original-height", this.mmheight);
}, t.prototype.createHeaderLine = function () {
var t = this;
this.headerLinetarget = $(''), this.headerLinetarget.css("top", (this.paperHeader || -1) + "pt"), 0 == this.paperHeader && this.headerLinetarget.addClass("hideheaderLinetarget"), this.paperContentTarget.append(this.headerLinetarget), this.dragHeadLineOrFootLine(this.headerLinetarget, function (e, n) {
t.paperHeader = n, t.triggerOnPaperBaseInfoChanged();
});
}, t.prototype.createFooterLine = function () {
var t = this;
this.footerLinetarget = $(''), this.footerLinetarget.css("top", parseInt(this.paperFooter.toString()) + "pt"), this.paperFooter == this.height && (this.footerLinetarget.css("top", this.mmheight - .4 + "mm"), this.footerLinetarget.addClass("hidefooterLinetarget")), this.paperContentTarget.append(this.footerLinetarget), this.dragHeadLineOrFootLine(this.footerLinetarget, function (e, n) {
t.paperFooter = n, t.triggerOnPaperBaseInfoChanged();
});
}, t.prototype.createPaperNumber = function (t) {
var e = this,
n = this.target.find(".hiprint-paperNumber");
if (n.length) return n.html(t), n;
var i = $('' + t + "");
return i.css("top", this.paperNumberTop + "pt"), i.css("left", this.paperNumberLeft + "pt"), this.paperContentTarget.append(i), this.dragHeadLineOrFootLine(i, function (t, n) {
e.paperNumberTop = n, e.paperNumberLeft = t, e.triggerOnPaperBaseInfoChanged();
}, !0), i;
}, t.prototype.getTarget = function () {
return this.target;
}, t.prototype.append = function (t) {
this.paperContentTarget.append(t);
}, t.prototype.updateReferenceElement = function (t) {
t && (this.referenceElement = t);
}, t.prototype.updatePrintLine = function (t) {
t >= this.printLine && (this.printLine = t);
}, t.prototype.design = function (t) {
var e = this;
this.createHeaderLine(), this.createFooterLine(), this.target.addClass("design"), this.paperNumberTarget = this.createPaperNumber(this.formatPaperNumber(1, 1)), this.resetPaperNumber(this.paperNumberTarget), $(this.paperNumberTarget).bind("dblclick.hiprint", function () {
null == e.paperNumberDisabled && (e.paperNumberDisabled = !1), e.paperNumberDisabled = !e.paperNumberDisabled, e.resetPaperNumber(e.paperNumberTarget), e.triggerOnPaperBaseInfoChanged();
}), $(this.paperNumberTarget).bind("click.hiprint", function () {
hinnn.event.trigger("BuildCustomOptionSettingEventKey_" + e.templateId, {
options: {
paperNumberFormat: e.paperNumberFormat,
paperNumberDisabled: e.paperNumberDisabled
},
callback: function callback(t) {
e.paperNumberDisabled = !!t.paperNumberDisabled || void 0, e.paperNumberFormat = t.paperNumberFormat ? t.paperNumberFormat : void 0, e.createPaperNumber(e.formatPaperNumber(1, 1)), e.resetPaperNumber(e.paperNumberTarget), e.triggerOnPaperBaseInfoChanged();
}
});
});
}, t.prototype.resetPaperNumber = function (t) {
this.paperNumberDisabled ? t.addClass("hiprint-paperNumber-disabled") : t.removeClass("hiprint-paperNumber-disabled");
}, t.prototype.updatePaperNumber = function (t, e, n) {
var i = this.createPaperNumber(this.formatPaperNumber(t, e));
this.paperNumberDisabled ? i.hide() : n && this.index % 2 == 1 && (i[0].style.left = "", i.css("right", this.paperNumberLeft + "pt"));
}, t.prototype.formatPaperNumber = function (t, e) {
return (this.paperNumberFormat ? this.paperNumberFormat : this.defaultPaperNumberFormat).replace("paperNo", t.toString()).replace("paperCount", e.toString());
}, t.prototype.dragHeadLineOrFootLine = function (t, e, n) {
var i = this;
t.hidraggable({
axis: n ? void 0 : "v",
onDrag: function onDrag(t, n, i) {
e(n, i);
},
moveUnit: "pt",
minMove: a.instance.movingDistance,
onBeforeDrag: function onBeforeDrag(t) { },
onStopDrag: function onStopDrag(t) {
i.footerLinetarget.removeClass("hidefooterLinetarget"), i.headerLinetarget.removeClass("hideheaderLinetarget");
}
});
}, t.prototype.resize = function (t, e) {
this.width = hinnn.mm.toPt(t), this.height = hinnn.mm.toPt(e), this.mmwidth = t, this.mmheight = e, this.target.css("width", t + "mm"), this.target.css("height", e - .4 + "mm"), this.target.attr("original-height", this.mmheight), this.paperFooter = this.height, this.footerLinetarget.css("top", this.height + "pt"), this.contentHeight = this.paperFooter - this.paperHeader, this.paperNumberLeft = parseInt((this.width - 30).toString()), this.paperNumberTop = parseInt((this.height - 22).toString()), this.paperNumberTarget.css("top", this.paperNumberTop + "pt"), this.paperNumberTarget.css("left", this.paperNumberLeft + "pt"), this.triggerOnPaperBaseInfoChanged();
}, t.prototype.getPaperFooter = function (t) {
var e = this.index + t;
return 0 == e ? this.firstPaperFooter ? this.firstPaperFooter : this.oddPaperFooter ? this.oddPaperFooter : this.paperFooter : e % 2 == 0 ? this.oddPaperFooter ? this.oddPaperFooter : this.paperFooter : e % 2 == 1 ? this.evenPaperFooter ? this.evenPaperFooter : this.paperFooter : void 0;
}, t.prototype.getContentHeight = function (t) {
return this.getPaperFooter(t) - this.paperHeader;
}, t;
}(),
zt = function () {
var _t8 = function t(e, n) {
return (_t8 = Object.setPrototypeOf || _instanceof({
__proto__: []
}, Array) && function (t, e) {
t.__proto__ = e;
} || function (t, e) {
for (var n in e) {
e.hasOwnProperty(n) && (t[n] = e[n]);
}
})(e, n);
};
return function (e, n) {
function i() {
this.constructor = e;
}
_t8(e, n), e.prototype = null === n ? Object.create(n) : (i.prototype = n.prototype, new i());
};
}(),
$t = function (t) {
function e(e, n) {
var i = t.call(this, e) || this;
return i.options = new Rt(n), i.options.setDefault(new Rt(a.instance.longText.default).getPrintElementOptionEntity()), i;
}
return zt(e, t), e.prototype.getDesignTarget = function (e) {
var n = t.prototype.getDesignTarget.call(this, e);
return n.find(".hiprint-printElement-longText-content").css("border", "1px dashed #cebcbc"), n;
}, e.prototype.getProxyTarget = function () {
var t = this.getData(),
e = this.createTarget(this.printElementType.getText(!0), t);
return this.updateTargetSize(e), this.css(e, t), e;
}, e.prototype.updateDesignViewFromOptions = function () {
if (this.designTarget) {
var t = this.getData(),
e = this.getHtml(this.designPaper)[0].target;
this.designTarget.find(".hiprint-printElement-longText-content").html(e.find(".hiprint-printElement-longText-content").html()), this.css(this.designTarget, t);
}
}, e.prototype.getConfigOptions = function () {
return a.instance.longText;
}, e.prototype.getTitle = function () {
return this.options.title || this.printElementType.title;
}, e.prototype.getData = function (t) {
return t ? t[this.getField()] || "" : this.options.testData || this.printElementType.getData() || "";
}, e.prototype.updateTargetText = function (t, e, n) {
var i = t.find(".hiprint-printElement-longText-content"),
o = this.getText(e, n);
i.html(o);
}, e.prototype.createTarget = function (t, e) {
var n = $('
');
return this.updateTargetText(n, t, e), n;
}, e.prototype.getText = function (t, e) {
e && (e = 0 != this.options.leftSpaceRemoved ? e.toString().replace(/^\s*/, "") : e);
return (this.getField() ? (this.options.getHideTitle() ? "" : t ? t + ":" : "") + (this.printElementType.formatter ? this.printElementType.formatter(t, e, this.options, this._currenttemplateData) : e) : this.printElementType.formatter ? this.printElementType.formatter(t, t, this.options, this._currenttemplateData) : t || "") || "";
}, e.prototype.getHtml = function (t, e) {
this.setCurrenttemplateData(e), this.createTempContainer();
var n = this.getPaperHtmlResult(t, e);
return this.removeTempContainer(), n;
}, e.prototype.getHeightByData = function (t) {
this.createTempContainer();
var e = this.getPaperHtmlResult(new Lt("", 1e3, 1e3, 0, 25e3, 0, 0, !0, void 0, 0, void 0), {}, t);
return this.removeTempContainer(), e[0].referenceElement.bottomInLastPaper - e[0].referenceElement.printTopInPaper;
}, e.prototype.getLongTextIndent = function () {
return this.options.longTextIndent ? '' : '';
}, e.prototype.getPaperHtmlResult = function (t, e, n) {
var i = this,
o = [],
r = 0,
a = n || this.getData(e),
p = this.getText(this.getTitle(), a),
s = this.createTarget(this.getTitle(), this.options.testData || "");
this.css(s, a), e ? this.updateTargetWidth(s) : this.updateTargetSize(s), this.getTempContainer().html(""), this.getTempContainer().append(s);
var l = [this.getLongTextIndent()],
h = p.split(new RegExp("\r|\n", "g"));
if (h.forEach(function (t, e) {
var n = 0 != i.options.leftSpaceRemoved ? (t || "").toString().replace(/^\s*/, "") : t;
l = l.concat(n.split("")), e < h.length - 1 && l.push(" " + i.getLongTextIndent());
}), 0 == l.length && (l = [""]), this.isHeaderOrFooter(t) || this.isFixed() || !e) return (f = this.getStringBySpecificHeight(l, 25e3, s)).target.css("left", this.options.displayLeft()), f.target.css("top", this.options.displayTop()), f.target[0].height = "", o.push(new yt({
target: f.target,
printLine: this.options.displayTop() + f.height,
referenceElement: new bt({
top: this.options.getTop(),
left: this.options.getLeft(),
height: this.options.getHeight(),
width: this.options.getWidth(),
beginPrintPaperIndex: t.index,
bottomInLastPaper: this.options.getTop() + f.height,
printTopInPaper: this.options.getTop()
})
})), o;
for (var u = this.getBeginPrintTopInPaperByReferenceElement(t); l.length > 0;) {
var c = 0,
d = t.getPaperFooter(r);
0 == r && u > d && (u = u - d + t.paperHeader, o.push(new yt({
target: void 0,
printLine: void 0
})), r++ , c = t.getContentHeight(r) - (u - t.paperHeader), d = t.getPaperFooter(r));
var f = this.getStringBySpecificHeight(l, c > 0 ? c : 0 == r ? d - u : t.getContentHeight(r), s);
l.splice(0, f.length);
var g = void 0,
m = void 0;
f.target.css("left", this.options.displayLeft()), f.target[0].height = "", 0 == r || c > 0 ? (m = u, f.target.css("top", m + "pt"), g = l.length > 0 ? u + f.height : null != this.options.lHeight ? u + (f.height > this.options.lHeight ? f.height : this.options.lHeight) : u + f.height) : (m = t.paperHeader, f.target.css("top", m + "pt"), g = m + f.height), o.push(new yt({
target: f.target,
printLine: g,
referenceElement: new bt({
top: this.options.getTop(),
left: this.options.getLeft(),
height: this.options.getHeight(),
width: this.options.getWidth(),
beginPrintPaperIndex: t.index,
bottomInLastPaper: g,
printTopInPaper: m
})
})), r++;
}
return o;
}, e.prototype.getStringBySpecificHeight = function (t, e, n) {
var i = hinnn.pt.toPx(e),
o = this.IsPaginationIndex(t, t.length - 1, i, n);
return o.IsPagination ? o : this.BinarySearch(t, 0, t.length - 1, i, n);
}, e.prototype.BinarySearch = function (t, e, n, i, o) {
var r = Math.floor((e + n) / 2);
if (e > n) return o.find(".hiprint-printElement-longText-content").html(""), {
IsPagination: !0,
height: 0,
length: 0,
target: o.clone()
};
var a = this.IsPaginationIndex(t, r, i, o);
return a.IsPagination ? a : "l" == a.move ? this.BinarySearch(t, e, r - 1, i, o) : this.BinarySearch(t, r + 1, n, i, o);
}, e.prototype.IsPaginationIndex = function (t, e, n, i) {
i.find(".hiprint-printElement-longText-content").html(t.slice(0, e + 2).join(""));
var o = i.height();
i.find(".hiprint-printElement-longText-content").html(t.slice(0, e + 1).join(""));
var r = i.height();
return e >= t.length - 1 && r < n ? {
IsPagination: !0,
height: hinnn.px.toPt(r),
length: t.length,
target: i.clone()
} : r <= n && o >= n ? {
IsPagination: !0,
height: r,
length: e + 1,
target: i.clone()
} : r >= n ? {
IsPagination: !1,
move: "l"
} : o <= n ? {
IsPagination: !1,
move: "r"
} : {
IsPagination: !0,
result: 1
};
}, e;
}(Tt),
Nt = function () {
function t() { }
return t.replaceEnterAndNewline = function (t, e) {
return t.replace(new RegExp("\r|\n|/g", "g"), e);
}, t.replaceTab = function (t, e) {
return t.replace(new RegExp("\t/g", "g"), e);
}, t.replaceEnterAndNewlineAndTab = function (t, e) {
return t.replace(new RegExp("\r|\n|\t|/g", "g"), e);
}, t;
}(),
kt = function () {
var _t9 = function t(e, n) {
return (_t9 = Object.setPrototypeOf || _instanceof({
__proto__: []
}, Array) && function (t, e) {
t.__proto__ = e;
} || function (t, e) {
for (var n in e) {
e.hasOwnProperty(n) && (t[n] = e[n]);
}
})(e, n);
};
return function (e, n) {
function i() {
this.constructor = e;
}
_t9(e, n), e.prototype = null === n ? Object.create(n) : (i.prototype = n.prototype, new i());
};
}(),
At = function (t) {
function e(e) {
var n = t.call(this, e) || this;
return n.title && (n.title = Nt.replaceEnterAndNewlineAndTab(n.title, "")), n;
}
return kt(e, t), e.prototype.getHideTitle = function () {
return null == this.hideTitle ? this.defaultOptions.hideTitle : this.hideTitle;
}, e.prototype.getTextType = function () {
return (null == this.textType ? this.defaultOptions.textType : this.textType) || "text";
}, e.prototype.getFontSize = function () {
return (null == this.fontSize ? this.defaultOptions.fontSize : this.fontSize) || 9;
}, e.prototype.getbarcodeMode = function () {
return (null == this.barcodeMode ? this.defaultOptions.barcodeMode : this.barcodeMode) || "CODE128";
}, e;
}(Pt),
Vt = function () {
var _t10 = function t(e, n) {
return (_t10 = Object.setPrototypeOf || _instanceof({
__proto__: []
}, Array) && function (t, e) {
t.__proto__ = e;
} || function (t, e) {
for (var n in e) {
e.hasOwnProperty(n) && (t[n] = e[n]);
}
})(e, n);
};
return function (e, n) {
function i() {
this.constructor = e;
}
_t10(e, n), e.prototype = null === n ? Object.create(n) : (i.prototype = n.prototype, new i());
};
}(),
Wt = function (t) {
function e(e, n) {
var i = t.call(this, e) || this;
return i.options = new At(n), i.options.setDefault(new At(a.instance.text.default).getPrintElementOptionEntity()), i;
}
return Vt(e, t), e.prototype.getDesignTarget = function (e) {
return t.prototype.getDesignTarget.call(this, e);
}, e.prototype.getProxyTarget = function () {
var t = this.getData(),
e = this.createTarget(this.printElementType.getText(!0), t);
return this.updateTargetSize(e), this.css(e, t), e;
}, e.prototype.updateDesignViewFromOptions = function () {
if (this.designTarget) {
var t = this.getData();
this.css(this.designTarget, t), this.updateTargetText(this.designTarget, this.getTitle(), t);
}
}, e.prototype.getConfigOptions = function () {
return a.instance.text;
}, e.prototype.getTitle = function () {
var t = this.options.title || this.printElementType.title || "";
return t && (t = Nt.replaceEnterAndNewlineAndTab(t, "")), t;
}, e.prototype.getData = function (t) {
return t ? t[this.getField()] || "" : this.options.testData || this.printElementType.getData() || "";
}, e.prototype.updateTargetText = function (t, e, n, i) {
var o = t.find(".hiprint-printElement-text-content"),
r = "";
r = this.getField() ? (this.options.getHideTitle() ? "" : e ? e + ":" : "") + (this.printElementType.formatter ? this.printElementType.formatter(e, n, this.options, this._currenttemplateData, t) : n) : n = this.printElementType.formatter ? this.printElementType.formatter(e, e, this.options, this._currenttemplateData, t) : e;
var a = this.options.getTextType();
if ("text" == a) o.html(r); else {
if ("barcode" == a) {
o.html('');
try {
n ? (JsBarcode(o.find(".hibarcode_imgcode")[0], n, {
format: this.options.getbarcodeMode(),
width: 1,
textMargin: -1,
lineColor: this.options.color || "#000000",
margin: 0,
height: parseInt(hinnn.pt.toPx(this.options.getHeight() || 10).toString()),
displayValue: !1
}), o.find(".hibarcode_imgcode").attr("height", "100%"), o.find(".hibarcode_imgcode").attr("width", "100%"), o.find(".hibarcode_displayValue").html(n)) : o.html("");
} catch (t) {
console.log(t), o.html("此格式不支持该文本");
}
}
if ("qrcode" == a) {
o.html("");
try {
if (n) {
var p = parseInt(hinnn.pt.toPx(this.options.getWidth() || 20)),
s = parseInt(hinnn.pt.toPx(this.options.getHeight() || 20));
new QRCode(o[0], {
width: p,
height: s,
colorDark: this.options.color || "#000000",
useSVG: !0
}).makeCode(n);
}
} catch (t) {
console.log(t), o.html("二维码生成失败");
}
}
}
}, e.prototype.onResize = function (e, n, i, o, r) {
t.prototype.onResize.call(this, e, n, i, o, r);
"barcode" != this.options.getTextType() && "qrcode" != this.options.getTextType() || this.updateTargetText(this.designTarget, this.getTitle(), this.getData());
}, e.prototype.createTarget = function (t, e, n) {
var i = $('
');
return this.updateTargetText(i, t, e, n), i;
}, e.prototype.getHtml = function (t, e, n) {
return this.getHtml2(t, e, n);
}, e;
}(Tt),
jt = function () {
var _t11 = function t(e, n) {
return (_t11 = Object.setPrototypeOf || _instanceof({
__proto__: []
}, Array) && function (t, e) {
t.__proto__ = e;
} || function (t, e) {
for (var n in e) {
e.hasOwnProperty(n) && (t[n] = e[n]);
}
})(e, n);
};
return function (e, n) {
function i() {
this.constructor = e;
}
_t11(e, n), e.prototype = null === n ? Object.create(n) : (i.prototype = n.prototype, new i());
};
}(),
Mt = function (t) {
function e(e) {
return t.call(this, e) || this;
}
return jt(e, t), e;
}(Pt),
Gt = function () {
var _t12 = function t(e, n) {
return (_t12 = Object.setPrototypeOf || _instanceof({
__proto__: []
}, Array) && function (t, e) {
t.__proto__ = e;
} || function (t, e) {
for (var n in e) {
e.hasOwnProperty(n) && (t[n] = e[n]);
}
})(e, n);
};
return function (e, n) {
function i() {
this.constructor = e;
}
_t12(e, n), e.prototype = null === n ? Object.create(n) : (i.prototype = n.prototype, new i());
};
}(),
Xt = function (t) {
function e(e, n) {
var i = t.call(this, e) || this;
return i.options = new Mt(n), i.options.setDefault(new Mt(a.instance.html.default).getPrintElementOptionEntity()), i;
}
return Gt(e, t), e.prototype.updateDesignViewFromOptions = function () {
if (this.designTarget) {
var t = this.getData();
this.css(this.designTarget, t);
}
}, e.prototype.getConfigOptions = function () {
return {};
}, e.prototype.createTarget = function (t, e) {
var n = $('
');
if (this.options.content) n.find(".hiprint-printElement-html-content").append(this.options.content); else if (this.printElementType.formatter) {
var i = this.printElementType.formatter(this.getData(), this.options, this._currenttemplateData);
n.find(".hiprint-printElement-html-content").append(i);
}
return n;
}, e.prototype.getHtml = function (t, e, n) {
return this.getHtml2(t, e, n);
}, e;
}(Tt),
Yt = function () {
var _t13 = function t(e, n) {
return (_t13 = Object.setPrototypeOf || _instanceof({
__proto__: []
}, Array) && function (t, e) {
t.__proto__ = e;
} || function (t, e) {
for (var n in e) {
e.hasOwnProperty(n) && (t[n] = e[n]);
}
})(e, n);
};
return function (e, n) {
function i() {
this.constructor = e;
}
_t13(e, n), e.prototype = null === n ? Object.create(n) : (i.prototype = n.prototype, new i());
};
}(),
Ut = function (t) {
function e(e, n) {
var i = t.call(this, e) || this;
return i.options = new Pt(n), i.options.setDefault(new Pt(a.instance.vline.default).getPrintElementOptionEntity()), i;
}
return Yt(e, t), e.prototype.updateDesignViewFromOptions = function () {
if (this.designTarget) {
var t = this.getData();
this.css(this.designTarget, t);
}
}, e.prototype.getConfigOptions = function () {
return a.instance.hline;
}, e.prototype.createTarget = function (t, e) {
return $('');
}, e.prototype.getReizeableShowPoints = function () {
return ["s"];
}, e.prototype.getHtml = function (t, e, n) {
return this.getHtml2(t, e, n);
}, e;
}(Tt),
Jt = function () {
var _t14 = function t(e, n) {
return (_t14 = Object.setPrototypeOf || _instanceof({
__proto__: []
}, Array) && function (t, e) {
t.__proto__ = e;
} || function (t, e) {
for (var n in e) {
e.hasOwnProperty(n) && (t[n] = e[n]);
}
})(e, n);
};
return function (e, n) {
function i() {
this.constructor = e;
}
_t14(e, n), e.prototype = null === n ? Object.create(n) : (i.prototype = n.prototype, new i());
};
}(),
Kt = function (t) {
function e(e, n) {
var i = t.call(this, e) || this;
return i.options = new Pt(n), i.options.setDefault(new Pt(a.instance.hline.default).getPrintElementOptionEntity()), i;
}
return Jt(e, t), e.prototype.updateDesignViewFromOptions = function () {
if (this.designTarget) {
var t = this.getData();
this.css(this.designTarget, t);
}
}, e.prototype.getConfigOptions = function () {
return a.instance.hline;
}, e.prototype.createTarget = function (t, e) {
return $('');
}, e.prototype.getReizeableShowPoints = function () {
return ["e"];
}, e;
}(Tt),
qt = function () {
var _t15 = function t(e, n) {
return (_t15 = Object.setPrototypeOf || _instanceof({
__proto__: []
}, Array) && function (t, e) {
t.__proto__ = e;
} || function (t, e) {
for (var n in e) {
e.hasOwnProperty(n) && (t[n] = e[n]);
}
})(e, n);
};
return function (e, n) {
function i() {
this.constructor = e;
}
_t15(e, n), e.prototype = null === n ? Object.create(n) : (i.prototype = n.prototype, new i());
};
}(),
Qt = function (t) {
function e(e, n) {
var i = t.call(this, e) || this;
return i.options = new Pt(n), i.options.setDefault(new Pt(a.instance.rect.default).getPrintElementOptionEntity()), i;
}
return qt(e, t), e.prototype.updateDesignViewFromOptions = function () {
if (this.designTarget) {
var t = this.getData();
this.css(this.designTarget, t);
}
}, e.prototype.getConfigOptions = function () {
return a.instance.hline;
}, e.prototype.createTarget = function (t, e) {
return $('');
}, e.prototype.getHtml = function (t, e, n) {
return this.getHtml2(t, e, n);
}, e;
}(Tt),
Zt = function () {
var _t16 = function t(e, n) {
return (_t16 = Object.setPrototypeOf || _instanceof({
__proto__: []
}, Array) && function (t, e) {
t.__proto__ = e;
} || function (t, e) {
for (var n in e) {
e.hasOwnProperty(n) && (t[n] = e[n]);
}
})(e, n);
};
return function (e, n) {
function i() {
this.constructor = e;
}
_t16(e, n), e.prototype = null === n ? Object.create(n) : (i.prototype = n.prototype, new i());
};
}(),
te = function (t) {
function e(e, n) {
var i = t.call(this, e) || this;
return i.options = new Pt(n), i.options.setDefault(new Pt(a.instance.oval.default).getPrintElementOptionEntity()), i;
}
return Zt(e, t), e.prototype.updateDesignViewFromOptions = function () {
if (this.designTarget) {
var t = this.getData();
this.css(this.designTarget, t);
}
}, e.prototype.getConfigOptions = function () {
return a.instance.hline;
}, e.prototype.createTarget = function (t, e) {
return $('');
}, e.prototype.getHtml = function (t, e, n) {
return this.getHtml2(t, e, n);
}, e;
}(Tt),
ee = function () {
function t() { }
return t.createPrintElement = function (t, e) {
return "text" == t.type ? new Wt(t, e) : "image" == t.type ? new _t(t, e) : "longText" == t.type ? new $t(t, e) : "table" == t.type ? new Ht(t, e) : "html" == t.type ? new Xt(t, e) : "vline" == t.type ? new Ut(t, e) : "hline" == t.type ? new Kt(t, e) : "rect" == t.type ? new Qt(t, e) : "oval" == t.type ? new te(t, e) : void 0;
}, t;
}(),
ne = function () {
function t(t) {
this.field = t.field, this.title = t.title, this.text = t.text, this.tid = t.tid, this.data = t.data, this.styler = t.styler, this.formatter = t.formatter, this.type = t.type, this.onRendered = t.onRendered, this.options = t.options;
}
return t.prototype.getText = function (t) {
return t ? this.title || this.text || "" : this.text || this.title || "";
}, t.prototype.getData = function () {
return this.data;
}, t.prototype.createPrintElement = function (t) {
var e = {};
return $.extend(e, t || {}), ee.createPrintElement(this, e);
}, t.prototype.getPrintElementTypeEntity = function () {
return new Ft({
title: this.title,
type: this.type
});
}, t;
}(),
ie = function () {
return function (t) {
this.table = t.table, this.isEnableEdit = t.isEnableEdit, this.trs = t.trs, this.resizeRow = t.resizeRow, this.resizeColumn = t.resizeColumn;
};
}(),
oe = function () {
function t(t) {
this.options = new ie(t);
}
return t.prototype.enableEidt = function () {
this.options.isEnableEdit;
}, t.prototype.disableEdit = function () {
this.options.isEnableEdit;
}, t.prototype.isEnableEdit = function () {
return this.options.isEnableEdit;
}, t;
}(),
re = function () {
return function (t) {
this.cell = t.cell, this.link = t.link, this.linkType = t.linkType, this.bottom = t.bottom, this.rightMost = t.rightMost, this.rowLevel = t.rowLevel, this.columnLevel = t.columnLevel, this.indexInTableGridRow = t.indexInTableGridRow, this.indexInTableGridColumn = t.indexInTableGridColumn;
};
}(),
ae = function () {
function t() { }
return t.getLeftTableCell = function (t, e) {
var n;
return t.forEach(function (t, i) {
t.cell && i < e && (n = t.cell);
}), n;
}, t.getIndex = function (t, e) {
var n;
return t.forEach(function (t, i) {
t.cell && t.cell.id == e && (n = i);
}), n;
}, t;
}(),
pe = function () {
return function (t, e) {
this.target = t, this.grips = e;
};
}(),
se = function () {
return function (t) {
this.target = t;
};
}(),
le = function () {
return function () {
this.rowColumns = [];
};
}(),
he = function () {
function t() { }
return t.getColumnsWidth = function (e, n) {
var i = {},
o = t.allAutoWidth(e);
return e.rowColumns.forEach(function (t) {
var e = n - 0,
r = t.width / o * (e > 0 ? e : 0);
i[t.id] = r;
}), i;
}, t.resizeTableCellWeight = function (t) {
t.forEach(function (t) {
t.columns.forEach(function (t) {
t.hasWidth && $(t.getTarget()).css("width", t.width + "pt");
});
});
}, t.allAutoWidth = function (t) {
var e = 0;
return t.rowColumns.forEach(function (t) {
e += t.width;
}), e;
}, t.reconsitutionTableColumnTree = function (t, e, n) {
for (var i = e || new le(), o = function o(e) {
i.totalLayer = e + 1, i[e] = t[e].columns, i.rowColumns = i.rowColumns.concat(i[e].filter(function (n) {
return n.rowspan == t.length - e;
}));
}, r = 0; r < t.length; r++) {
o(r);
}
return i;
}, t;
}(),
ue = function () {
function t(t) {
this.signature = "HiTresizer", this.hitable = t, this.rows = t.rows, this.target = t.target;
}
return t.prototype.init = function () {
this.addResizeRowAndColumn(), this.hitable.optionsCoat.options.resizeColumn && this.createColumnGrips(), this.hitable.optionsCoat.options.resizeRow && this.createRowGrips();
}, t.prototype.resizeTableCellWidth = function () {
he.resizeTableCellWeight(this.rows);
}, t.prototype.addResizeRowAndColumn = function () { }, t.prototype.createColumnGrips = function () {
var t = this,
e = this,
n = [],
i = $('');
i.width(this.target.width()), this.rows.forEach(function (o) {
o.columns.forEach(function (o, r) {
if (o.getTarget().attr("haswidth")) {
var a = $('
');
i.append(a);
var p = new se(a);
n.length > 0 && (n[n.length - 1].nextGrip = p), n.push(p), t.syncGrips(o, p), $(a).hidraggable({
axis: "h",
onDrag: function onDrag(t, e, n) { },
moveUnit: "pt",
minMove: 1,
onBeforeDrag: function onBeforeDrag(t) {
if (!p.nextGrip) return !1;
e.dragingGrip = p, e.dragingGrip.left = parseFloat(e.dragingGrip.target.css("left").replace("px", "")), p.target.addClass("columngripDraging");
},
onStopDrag: function onStopDrag(n) {
var i = parseFloat(e.dragingGrip.target.css("left").replace("px", "")),
o = hinnn.px.toPt(i - e.dragingGrip.left);
p.cell.width = p.cell.width + o, p.nextGrip.cell.width = p.nextGrip.cell.width - o, t.resizeTableCellWidth(), p.target.removeClass("columngripDraging"), e.updateColumnGrips();
}
});
}
});
}), this.target.before(i), this.cgripContariner = new pe(i, n);
}, t.prototype.updateColumnGrips = function () {
this.cgripContariner && (this.cgripContariner.target.remove(), this.createColumnGrips());
}, t.prototype.updateRowGrips = function () {
this.rgripContariner && (this.rgripContariner.target.remove(), this.createRowGrips());
}, t.prototype.createRowGrips = function () {
var t = this,
e = this,
n = [],
i = $('');
this.rows.forEach(function (o, r) {
var a = $('
');
i.append(a);
var p = new se(a);
n.push(p), r > 0 && r < t.rows.length && $(a).hidraggable({
axis: "v",
onDrag: function onDrag(t, e, n) { },
moveUnit: "pt",
minMove: 1,
onBeforeDrag: function onBeforeDrag(t) {
e.dragingGrip = p, e.dragingGrip.top = parseFloat(e.dragingGrip.target.css("top").replace("px", "")), p.target.addClass("rowgripDraging");
},
onStopDrag: function onStopDrag(t) {
var n = parseFloat(e.dragingGrip.target.css("top").replace("px", "")),
i = hinnn.px.toPt(n - e.dragingGrip.top + e.rows[r].columns[0].getTarget().height());
e.rows[r].columns[0].getTarget().css("height", i + "pt"), e.syncRowGrips(), p.target.removeClass("rowgripDraging");
}
});
}), this.target.before(i), this.rgripContariner = new pe(i, n), this.syncRowGrips();
}, t.prototype.syncGrips = function (t, e) {
var n = t.getTarget();
e.cell = t, e.target.css({
left: n.offset().left - this.target.offset().left + n.outerWidth(!1),
height: 30
});
}, t.prototype.syncRowGrips = function () {
var t = this;
this.rgripContariner.target.height(this.target.height()), this.rows.forEach(function (e, n) {
var i = e.columns[0].getTarget();
t.rgripContariner.grips[n].target.css({
top: i.offset().top - t.target.offset().top + i.outerHeight(!1),
width: 30
});
});
}, t.prototype.addResizerHeadRow = function () {
this.target.find("thead").prepend();
}, t;
}(),
ce = function () {
function t() {
this.id = y.createId();
}
return t.prototype.init = function (t, e) {
this.target = e || $("
"), this.tableOptions = t, this.initCells(this.columns);
}, t.prototype.getTarget = function () {
return this.target;
}, t.prototype.initCells = function (t) {
var e = this;
t ? t.forEach(function (t, n) {
t.init(e.target.find("td:eq(" + n + ")"), e.tableOptions, e.id);
}) : (this.columns = [], this.target.find("td").map(function (t, n) {
var i = new x();
i.init($(n), e.tableOptions, e.id), e.columns.push(i);
}));
}, t.prototype.removeCell = function (t) {
var e = this.columns.indexOf(t);
this.columns[e].getTarget().remove(), this.columns.splice(e, 1);
}, t.prototype.createTableCell = function (t, e) {
var n = new x();
return n.init($("
"), this.tableOptions, this.id), t > 1 && (n.getTarget().attr("rowspan", t), n.rowspan = t), e > 1 && (n.getTarget().attr("colspan", e), n.colspan = e), n;
}, t.prototype.insertToTargetCellLeft = function (t, e) {
var n = this.columns.indexOf(t);
t.getTarget().before(e.getTarget()), this.columns.splice(n, 0, e);
}, t.prototype.insertToTargetCellRight = function (t, e) {
var n = this.columns.indexOf(t);
this.columns[n].getTarget().after(e.getTarget()), this.columns.splice(n + 1, 0, e);
}, t.prototype.insertCellToFirst = function (t) {
this.target.prepend(t.getTarget()), this.columns.splice(0, 0, t);
}, t.prototype.insertCellToLast = function (t) {
this.columns.push(t), this.target.append(t.getTarget());
}, t;
}(),
de = function () {
function t(t) {
this.id = y.createId(), this.optionsCoat = new oe(t), this.handle = t.handle, this.target = t.table, this.initRows(t.rows), this.init(t), this.tableCellSelector = new f(this.rows, this.target), this.resizer = new ue(this), this.resizer.init();
}
return t.prototype.insertRow = function (t, e, n) {
var i = e || this.tableCellSelector.getSingleSelect(),
o = i.cell,
r = this.rows[i.rowIndex],
a = i.rowIndex,
p = this.getCellGrid(),
s = new ce();
if (s.init(this.optionsCoat), n && s.getTarget().addClass(n), "above" == t) p[a].forEach(function (t) {
var e = t.link ? t.link : t.cell,
n = e.width / e.colspan;
if (0 == t.columnLevel) {
var i = s.createTableCell();
i.width = n, s.insertCellToLast(i);
} else {
if ("column" == t.linkType) {
var o = t.link.getTarget();
t.link.rowspan += 1, o.attr("rowspan", t.link.rowspan);
}
t.linkType;
}
}), this.rows.splice(a, 0, s), r.getTarget().before(s.getTarget()), hinnn.event.trigger("newRow" + this.id, s); else {
var l = a + o.rowspan - 1;
p[l].forEach(function (t) {
var e = t.link ? t.link : t.cell,
n = e.width / e.colspan;
if (t.bottom) {
var i = s.createTableCell();
i.width = n, s.insertCellToLast(i);
} else {
if (t.cell) {
var o = t.cell.getTarget();
t.cell.rowspan += 1, o.attr("rowspan", t.cell.rowspan);
}
if ("column" == t.linkType) {
o = t.link.getTarget();
t.link.rowspan += 1, o.attr("rowspan", t.link.rowspan);
}
}
}), this.rows.splice(l + 1, 0, s), this.rows[l].getTarget().after(s.getTarget()), hinnn.event.trigger("newRow" + this.id, s);
}
}, t.prototype.insertColumn = function (t, e, n, i) {
var o = this,
r = this.rows.concat(this.trRows),
a = e || this.tableCellSelector.getSingleSelect(),
p = a.cell,
s = a.rowIndex,
l = this.getCellGrid(r),
h = l[s].filter(function (t) {
return t.cell && t.cell.id == p.id || t.link && t.link.id == p.id;
});
if ("left" == t) {
var u = h[0].indexInTableGridRow;
l.forEach(function (t, e) {
var a = t[u],
p = t.filter(function (t, e) {
return e >= u && t.cell;
});
if (0 == a.rowLevel) {
var s = r[e],
l = r[e].createTableCell();
n && l.getTarget().addClass(n), null != i && (l.width = i), p.length ? s.insertToTargetCellLeft(p[0].cell, l) : s.insertCellToLast(l), hinnn.event.trigger("newCell" + o.id, l);
} else if ("row" == a.linkType) {
var h = a.link.getTarget();
a.link.colspan += 1, h.attr("colspan", a.link.colspan);
}
});
} else {
var c = h[h.length - 1].indexInTableGridRow;
l.forEach(function (t, e) {
var a = t[c],
p = t.filter(function (t, e) {
return e <= c && t.cell;
});
if (a.rightMost) {
var s = r[e],
l = s.createTableCell();
n && l.getTarget().addClass(n), null != i && (l.width = i), p.length ? s.insertToTargetCellRight(p[p.length - 1].cell, l) : s.insertCellToFirst(l), hinnn.event.trigger("newCell" + o.id, l);
} else {
var h = a.link || a.cell;
if ("row" == a.linkType) {
var u = h.getTarget();
h.colspan += 1, u.attr("colspan", h.colspan);
}
if (a.cell) {
u = h.getTarget();
h.colspan += 1, u.attr("colspan", h.colspan);
}
}
});
}
}, t.prototype.deleteRow = function () {
var t = this,
e = this.tableCellSelector.getSingleSelect(),
n = (e.cell, this.rows[e.rowIndex], e.rowIndex),
i = this.getCellGrid(),
o = this.rows[n];
i[n].forEach(function (e, r) {
if (e.cell) {
if (1 == e.cell.rowspan) o.removeCell(e.cell); else {
o.removeCell(e.cell);
var a = i[n + 1].filter(function (t, e) {
return t.cell && e > r;
}),
p = t.rows[n + 1],
s = p.createTableCell(e.cell.rowspan - 1, e.cell.colspan);
a.length ? p.insertToTargetCellLeft(a[0].cell, s) : p.insertCellToLast(s);
}
} else if ("column" == e.linkType) {
var l = e.link;
l.rowspan -= 1, l.getTarget().attr("rowspan", l.rowspan);
}
}), o.getTarget().remove(), this.rows.splice(n, 1);
}, t.prototype.deleteColums = function () {
var t = this.rows.concat(this.trRows),
e = this.tableCellSelector.getSingleSelect(),
n = e.cell,
i = e.rowIndex,
o = this.getCellGrid(t),
r = o[i].filter(function (t) {
return t.cell && t.cell.id == n.id || t.link && t.link.id == n.id;
})[0].indexInTableGridRow;
o.forEach(function (e, n) {
var i = e[r];
i.cell ? 1 == i.cell.colspan ? t[n].removeCell(i.cell) : (i.cell.colspan -= 1, i.cell.getTarget().attr("colspan", i.cell.colspan)) : "row" == i.linkType && (i.link.colspan -= 1, i.link.getTarget().attr("colspan", i.link.colspan));
});
}, t.prototype.mergeCell = function () {
var t = this,
e = this.tableCellSelector.getSelectedCells();
if (0 != e.length) {
var n = e[0][0].cell;
e.forEach(function (i, o) {
i.forEach(function (i, r) {
0 == o ? 0 != r && (n.colspan += i.cell.colspan, t.rows[i.rowIndex].removeCell(i.cell)) : t.rows[i.rowIndex].removeCell(i.cell), 0 == r && e[0][0].rowIndex + n.rowspan - 1 < i.rowIndex && (n.rowspan += i.cell.rowspan);
});
}), n.getTarget().attr("colspan", n.colspan), n.getTarget().attr("rowspan", n.rowspan), this.tableCellSelector.setSingleSelect(e[0][0]);
}
}, t.prototype.splitCell = function () {
var t = this.tableCellSelector.getSingleSelect(),
e = this.getCellGrid(),
n = ae.getIndex(e[t.rowIndex], t.cell.id);
if (t) {
for (var i = t.rowIndex; i < t.rowIndex + t.cell.rowspan; i++) {
for (var o = this.rows[i], r = i == t.rowIndex ? t.cell : ae.getLeftTableCell(e[i], n), a = 0; a < t.cell.colspan; a++) {
i == t.rowIndex && 0 == a || (r ? o.insertToTargetCellRight(r, o.createTableCell()) : o.insertCellToFirst(o.createTableCell()));
}
}
t.cell.rowspan = 1, t.cell.colspan = 1, t.cell.getTarget().attr("colspan", t.cell.colspan), t.cell.getTarget().attr("rowspan", t.cell.rowspan);
}
}, t.prototype.init = function (t) {
var e = this;
$(this.target).addClass("hitable"), this.optionsCoat.onBeforEdit = function (n) {
if (e.optionsCoat.options.onBeforEdit && !1 === t.onBeforEdit(n)) return !1;
return e.optionsCoat.editingCell && e.optionsCoat.editingCell.endEdit(), !0;
}, $(this.target).mousedown(function (t) {
e.optionsCoat.isLeftMouseButtonDown = !0;
}), $(this.target).mouseup(function (t) {
e.optionsCoat.isLeftMouseButtonDown = !1;
}), this.initContext(), this.target.on("mousemove", function (t) {
1 === t.buttons && e.tableCellSelector.multipleSelectByXY(t.pageX, t.pageY);
}).on("mousedown", function (t) {
1 === t.buttons && e.tableCellSelector.singleSelectByXY(t.pageX, t.pageY);
});
}, t.prototype.initRows = function (t) {
var e = this;
if (this.trRows = [], t) {
this.rows = t, t.forEach(function (t, n) {
t.init(e.optionsCoat, e.target.find("tr:eq(" + n + ")"));
});
var n = this.optionsCoat.options.trs;
n && this.initRowsByTrs(n).forEach(function (t) {
e.trRows.push(t);
});
} else this.rows = this.initRowsByTrs(this.target.find("tr"));
}, t.prototype.initRowsByTrs = function (t) {
var e = this;
return t.map(function (t, n) {
var i = new ce();
return i.init(e.optionsCoat, $(n)), i;
}).get();
}, t.prototype.enableEidt = function () {
this.optionsCoat.enableEidt();
}, t.prototype.disableEdit = function () {
this.optionsCoat.disableEdit();
}, t.prototype.getCellGrid = function (t) {
var e = t || this.rows,
n = this.getColumnStep(),
i = new Array();
return e.forEach(function (t, e) {
t.columns.forEach(function (t, o) {
for (var r = 0; r < t.colspan; r++) {
for (var a = 0, p = !1; a < n && !p;) {
if (i[e] = i[e] || [], i[e][a]); else {
i[e][a] = new re({
cell: 0 == r ? t : void 0,
link: 0 != r ? t : void 0,
linkType: r > 0 ? "row" : void 0,
rightMost: r == t.colspan - 1 || void 0,
bottom: 0 == t.rowspan - 1,
rowLevel: r,
columnLevel: 0,
indexInTableGridRow: a,
indexInTableGridColumn: e
});
for (var s = e + 1, l = 1; l < t.rowspan; l++) {
i[s] = i[s] || [], i[s][a] = new re({
cell: void 0,
link: t,
linkType: r > 0 ? "rowColumn" : "column",
rightMost: r == t.colspan - 1 || void 0,
bottom: l == t.rowspan - 1,
rowLevel: r,
columnLevel: l,
indexInTableGridRow: a,
indexInTableGridColumn: s
}), s += 1;
}
p = !0;
}
a++;
}
}
});
}), i;
}, t.prototype.setAlign = function (t) {
var e = this.tableCellSelector.getSelectedCells();
e && e.forEach(function (e) {
e.forEach(function (e) {
e.cell.setAlign(t);
});
});
}, t.prototype.setVAlign = function (t) {
var e = this.tableCellSelector.getSelectedCells();
e && e.forEach(function (e) {
e.forEach(function (e) {
e.cell.setVAlign(t);
});
});
}, t.prototype.getColumnStep = function (t) {
var e = 0;
return this.rows.length && this.rows[t || 0].columns.forEach(function (t) {
e += t.colspan;
}), e;
}, t.prototype.initContext = function () {
var t = this;
$(this.handle).hicontextMenu({
menus: [{
text: "在上方插入行",
disable: function disable() {
return !t.tableCellSelector.getSingleSelect();
},
callback: function callback() {
t.insertRow("above"), t.resizer.updateRowGrips(), hinnn.event.trigger("updateTable" + t.id);
}
}, {
text: "在下方插入行",
borderBottom: !0,
disable: function disable() {
return !t.tableCellSelector.getSingleSelect();
},
callback: function callback() {
t.insertRow("below"), t.resizer.updateRowGrips(), hinnn.event.trigger("updateTable" + t.id);
}
}, {
text: "向左方插入列",
disable: function disable() {
return !t.tableCellSelector.getSingleSelect();
},
callback: function callback() {
t.insertColumn("left"), t.resizer.updateColumnGrips(), hinnn.event.trigger("updateTable" + t.id);
}
}, {
text: "向右方插入列",
disable: function disable() {
return !t.tableCellSelector.getSingleSelect();
},
borderBottom: !0,
callback: function callback() {
t.insertColumn("right"), t.resizer.updateColumnGrips(), hinnn.event.trigger("updateTable" + t.id);
}
}, {
text: "删除行",
disable: function disable() {
return !t.tableCellSelector.getSingleSelect();
},
callback: function callback() {
t.deleteRow(), t.resizer.updateRowGrips(), hinnn.event.trigger("updateTable" + t.id);
}
}, {
text: "删除列",
borderBottom: !0,
disable: function disable() {
return !t.tableCellSelector.getSingleSelect();
},
callback: function callback() {
t.deleteColums(), t.resizer.updateColumnGrips(), hinnn.event.trigger("updateTable" + t.id);
}
}, {
text: "对齐",
borderBottom: !0,
menus: [{
text: "左",
callback: function callback() {
t.setAlign("left");
}
}, {
text: "左右居中",
callback: function callback() {
t.setAlign("center");
}
}, {
text: "右",
callback: function callback() {
t.setAlign("right");
}
}, {
text: "默认",
borderBottom: !0,
callback: function callback() {
t.setAlign("");
}
}, {
text: "上",
callback: function callback() {
t.setVAlign("top");
}
}, {
text: "垂直居中",
callback: function callback() {
t.setVAlign("middle");
}
}, {
text: "下",
callback: function callback() {
t.setVAlign("bottom");
}
}, {
text: "默认",
callback: function callback() {
t.setVAlign("");
}
}]
}, {
text: "合并单元格",
disable: function disable() {
return t.tableCellSelector.getSingleSelect();
},
callback: function callback() {
t.mergeCell(), hinnn.event.trigger("updateTable" + t.id);
}
}, {
text: "解开单元格",
disable: function disable() {
var e = t.tableCellSelector.getSingleSelect();
return !e || 1 == e.cell.rowspan && 1 == e.cell.colspan;
},
callback: function callback() {
t.splitCell(), hinnn.event.trigger("updateTable" + t.id);
}
}]
});
}, t.prototype.getTableWidth = function () {
return hinnn.px.toPt(this.target.outerWidth(!1));
}, t.prototype.updateColumnGrips = function () {
this.resizer.updateColumnGrips();
}, t.prototype.updateRowGrips = function () {
this.resizer.updateRowGrips();
}, t;
}(),
fe = function () {
var _t17 = function t(e, n) {
return (_t17 = Object.setPrototypeOf || _instanceof({
__proto__: []
}, Array) && function (t, e) {
t.__proto__ = e;
} || function (t, e) {
for (var n in e) {
e.hasOwnProperty(n) && (t[n] = e[n]);
}
})(e, n);
};
return function (e, n) {
function i() {
this.constructor = e;
}
_t17(e, n), e.prototype = null === n ? Object.create(n) : (i.prototype = n.prototype, new i());
};
}(),
ge = function (t) {
function e(e) {
var n = t.call(this) || this;
(n.columns = [], e && e.constructor === Array) ? (e || []).forEach(function (t) {
n.columns.push(new x(t));
}) : e.columns && (e.columns || []).forEach(function (t) {
n.columns.push(new x(t));
});
return n;
}
return fe(e, t), e.prototype.getPrintElementOptionEntity = function () {
var t = [];
return this.columns.forEach(function (e) {
t.push(e.getEntity());
}), t;
}, e;
}(ce),
me = function () {
var _t18 = function t(e, n) {
return (_t18 = Object.setPrototypeOf || _instanceof({
__proto__: []
}, Array) && function (t, e) {
t.__proto__ = e;
} || function (t, e) {
for (var n in e) {
e.hasOwnProperty(n) && (t[n] = e[n]);
}
})(e, n);
};
return function (e, n) {
function i() {
this.constructor = e;
}
_t18(e, n), e.prototype = null === n ? Object.create(n) : (i.prototype = n.prototype, new i());
};
}(),
ve = function (t) {
function e(e) {
var n = t.call(this, e) || this;
(e = e || {}).columns ? (n.columns = [], e.columns.forEach(function (t) {
n.columns.push(new ge(t));
})) : n.columns = [new ge({
columns: [new x({
width: 100
}), new x({
width: 100
})]
})];
return n;
}
return me(e, t), e.prototype.getPrintElementOptionEntity = function () {
var e = t.prototype.getPrintElementOptionEntity.call(this);
return e.columns = [], this.columns.forEach(function (t) {
e.columns.push(t.getPrintElementOptionEntity());
}), e;
}, e;
}(Pt),
ye = function () {
function t() { }
return t.createTableHead = function (e, n) {
for (var i = t.reconsitutionTableColumnTree(e), o = $(""), r = t.getColumnsWidth(i, n), a = function a(t) {
var e = $("
");
i[t].forEach(function (t) {
var n = $("
");
t.id && n.attr("id", t.id), t.align && n.css("text-align", t.halign || t.align), t.vAlign && n.css("vertical-align", t.vAlign), t.colspan > 1 && n.attr("colspan", t.colspan), t.rowspan > 1 && n.attr("rowspan", t.rowspan), n.html(t.title), r[t.id] ? (t.hasWidth = !0, t.targetWidth = r[t.id], n.attr("haswidth", "haswidth"), n.css("width", r[t.id] + "pt")) : t.hasWidth = !1, e.append(n);
}), o.append(e);
}, p = 0; p < i.totalLayer; p++) {
a(p);
}
return t.syncTargetWidthToOption(e), o;
}, t.createTableFooter = function (t, e, n, i) {
var o = $("");
return o.append(i.footerFormatter(n)), o;
}, t.createTableRow = function (e, n, i, o) {
var r = t.reconsitutionTableColumnTree(e),
a = $("");
(n || (n = []), o.groupFields.length) ? hinnn.groupBy(n, o.groupFields, function (t) {
var e = {};
return o.groupFields.forEach(function (n) {
return e[n] = t[n];
}), e;
}).forEach(function (e) {
if (o.groupFormatter) {
var n = $("
");
n.find("td").append(o.groupFormatter(e, i)), a.append(n);
}
if (e.rows.forEach(function (e) {
var n = t.createRowTarget(r, e, o, i);
a.append(n);
}), o.groupFooterFormatter) {
var p = $("
");
p.find("td").append(o.groupFooterFormatter(e, i)), a.append(p);
}
}) : n.forEach(function (e) {
var n = t.createRowTarget(r, e, o, i);
a.append(n);
});
return a;
}, t.createRowTarget = function (t, e, n, i) {
var o = $("
");
if (t.rowColumns.forEach(function (t, i) {
var r = $("
");
t.field && r.attr("field", t.field), t.align && r.css("text-align", t.align), t.vAlign && r.css("vertical-align", t.vAlign);
var a = t.formatter ? t.formatter(e[t.field], e, i, n) : e[t.field];
if (r.html(a), t.styler) {
var p = t.styler(e[t.field], e, i, n);
if (p) Object.keys(p).forEach(function (t) {
r.css(t, p[t]);
});
}
o.append(r);
}), i.rowStyler) {
var r = i.rowStyler(e, n);
if (r) Object.keys(r).forEach(function (t) {
o.css(t, r[t]);
});
}
return o;
}, t.getColumnsWidth = function (e, n) {
var i = {},
o = t.allAutoWidth(e),
r = t.allFixedWidth(e);
return e.rowColumns.forEach(function (t) {
if (t.fixed) i[t.id] = t.width; else {
var e = n - r,
a = t.width / o * (e > 0 ? e : 0);
i[t.id] = a;
}
}), i;
}, t.resizeTableCellWidth = function (e, n, i) {
var o = t.reconsitutionTableColumnTree(n),
r = t.getColumnsWidth(o, i);
e.find("thead tr td[haswidth]").map(function (t, e) {
var n = $(e).attr("id"),
i = r[n];
$(e).css("width", i + "pt");
});
}, t.allAutoWidth = function (t) {
var e = 0;
return t.rowColumns.forEach(function (t) {
e += t.fixed ? 0 : t.width;
}), e;
}, t.allFixedWidth = function (t) {
var e = 0;
return t.rowColumns.forEach(function (t) {
e += t.fixed ? t.width : 0;
}), e;
}, t.reconsitutionTableColumnTree = function (t, e, n) {
var i = e || new wt();
i.colspan = 0;
for (var o = function o(e) {
i.totalLayer = e + 1, i[e] = t[e].columns, 0 == e && t[e].columns.forEach(function (t) {
i.colspan += t.colspan;
}), i.rowColumns = i.rowColumns.concat(i[e].filter(function (n) {
return n.rowspan == t.length - e;
}));
}, r = 0; r < t.length; r++) {
o(r);
}
return i;
}, t.syncTargetWidthToOption = function (t) {
t.forEach(function (t) {
t.columns.forEach(function (t) {
t.hasWidth && (t.width = t.targetWidth);
});
});
}, t;
}(),
be = function () {
var _t19 = function t(e, n) {
return (_t19 = Object.setPrototypeOf || _instanceof({
__proto__: []
}, Array) && function (t, e) {
t.__proto__ = e;
} || function (t, e) {
for (var n in e) {
e.hasOwnProperty(n) && (t[n] = e[n]);
}
})(e, n);
};
return function (e, n) {
function i() {
this.constructor = e;
}
_t19(e, n), e.prototype = null === n ? Object.create(n) : (i.prototype = n.prototype, new i());
};
}(),
Te = function (t) {
function e(e, n) {
var i = t.call(this, e) || this;
return i.options = new ve(n), i.options.setDefault(new ve(a.instance.tableCustom.default).getPrintElementOptionEntity()), i.columns = i.options.columns, i;
}
return be(e, t), e.prototype.updateDesignViewFromOptions = function () {
if (this.designTarget) {
this.css(this.designTarget, this.getData());
var t = this.designTarget.find(".hiprint-printElement-table-content"),
e = this.getHtml(this.designPaper);
t.html(""), t.append(e[0].target.find(".hiprint-printElement-tableTarget")), this.setHireizeable();
}
}, e.prototype.getDesignTarget = function (t) {
var e = this;
return this.designTarget = this.getHtml(t)[0].target, this.designPaper = t, this.designTarget.click(function () {
hinnn.event.trigger(e.getPrintElementSelectEventKey(), e);
}), this.designTarget.find("td").hidroppable({
accept: ".rn-draggable-item",
onDrop: function onDrop(t, e) { },
onDragEnter: function onDragEnter(t, e) {
$(e).removeClass("rn-draggable-item");
},
onDragLeave: function onDragLeave(t, e) {
$(e).addClass("rn-draggable-item");
}
}), this.designTarget;
}, e.prototype.getConfigOptions = function () {
return a.instance.table;
}, e.prototype.createTarget = function (t, e) {
var n = $('
');
return n.find(".hiprint-printElement-table-content").append(this.getTableHtml(e)), n;
}, e.prototype.getTableHtml = function (t) {
var e = $('
');
return e.append(ye.createTableHead(this.columns, this.options.getWidth())), e.append(ye.createTableRow(this.columns, t, this.options, this.printElementType)), this.printElementType.footerFormatter && e.append(ye.createTableFooter(this.printElementType.columns, t, this.options, this.printElementType)), e;
}, e.prototype.getHtml = function (t, e) {
this.setCurrenttemplateData(e), this.createTempContainer();
var n = this.getPaperHtmlResult(t, e);
return this.removeTempContainer(), n;
}, e.prototype.getPaperHtmlResult = function (t, e) {
var n = [],
i = this.getData(e),
o = this.getTableHtml(i),
r = this.createTarget(this.printElementType.title, []);
e ? this.updateTargetWidth(r) : this.updateTargetSize(r), this.css(r, i), this.css(o, i), this.getTempContainer().html(""), this.getTempContainer().append(r);
for (var a, p = this.getBeginPrintTopInPaperByReferenceElement(t), s = 0, l = !1; !l;) {
var h = 0,
u = t.getPaperFooter(s);
0 == s && p > u && (p = p - u + t.paperHeader, n.push(new yt({
target: void 0,
printLine: void 0
})), s++ , h = t.getContentHeight(s) - (p - t.paperHeader), u = t.getPaperFooter(s));
var c = n.length > 0 ? n[n.length - 1].target : void 0,
d = this.getRowsInSpecificHeight(h > 0 ? h : 0 == s ? u - p : t.getContentHeight(s), r, o, s, c);
l = d.isEnd;
var f = void 0;
d.target && (d.target.css("left", this.options.displayLeft()), d.target[0].height = ""), 0 == s || h > 0 ? (d.target && (a = p, d.target.css("top", p + "pt")), f = l && null != this.options.lHeight ? p + (d.height > this.options.lHeight ? d.height : this.options.lHeight) : p + d.height) : (d.target && (a = t.paperHeader, d.target.css("top", t.paperHeader + "pt")), f = t.paperHeader + d.height), n.push(new yt({
target: d.target,
printLine: f,
referenceElement: new bt({
top: this.options.getTop(),
left: this.options.getLeft(),
height: this.options.getHeight(),
width: this.options.getWidth(),
beginPrintPaperIndex: t.index,
bottomInLastPaper: f,
printTopInPaper: a
})
})), s++;
}
return n;
}, e.prototype.getRowsInSpecificHeight = function (t, e, n, i, o) {
var r = void 0,
a = n.find("tbody"),
p = hinnn.pt.toPx(t);
e.find("tbody").html("");
for (var s = e.outerHeight(); ;) {
if (s <= p) {
if (0 == a.find("tr").length) {
r = {
target: e.clone(),
length: e.find("tbody tr").length,
height: hinnn.px.toPt(s),
isEnd: !0
}, 0 == e.find("tbody tr").length && o && (r = {
target: void 0,
length: 0,
height: 0,
isEnd: !0
});
} else {
var l = a.find("tr:lt(1)");
e.find("tbody").append(l), (s = e.outerHeight()) > p && (a.prepend(l), s = e.outerHeight(), r = {
target: e.clone(),
length: e.find("tbody tr").length,
height: hinnn.px.toPt(s),
isEnd: !1
});
}
} else r = {
target: void 0,
length: 0,
height: 0,
isEnd: !1
};
if (r) break;
}
return r;
}, e.prototype.getData = function (t) {
if (!t) return [{}];
var e = t[this.getField()];
return e ? JSON.parse(JSON.stringify(e)) : [];
}, e.prototype.onResize = function (e, n, i, o, r) {
t.prototype.updateSizeAndPositionOptions.call(this, r, o, i, n), ye.resizeTableCellWidth(this.designTarget, this.columns, this.options.getWidth());
}, e.prototype.getReizeableShowPoints = function () {
return ["s", "e"];
}, e.prototype.design = function (t) {
var e = this;
this.designTarget.hidraggable({
handle: this.designTarget.find(".hiprint-printElement-table-handle"),
axis: e.options.axis && t && t.axisEnabled ? e.options.axis : void 0,
onDrag: function onDrag(t, n, i) {
e.updateSizeAndPositionOptions(n, i);
},
moveUnit: "pt",
minMove: a.instance.movingDistance,
onBeforeDrag: function onBeforeDrag(t) { },
onStopDrag: function onStopDrag(t) { }
}), this.setHireizeable(), this.designTarget.hireizeable({
showPoints: e.getReizeableShowPoints(),
noContainer: !0,
onResize: function onResize(t, n, i, o, r) {
e.onResize(t, n, i, o, r), e.hitable.updateColumnGrips();
}
});
}, e.prototype.setHireizeable = function () {
var t = this;
this.hitable = new de({
table: this.designTarget.find("table"),
rows: this.columns,
resizeRow: !1,
resizeColumn: !0,
trs: $(this.designTarget).find("tbody tr"),
handle: this.designTarget.find("table thead"),
isEnableEdit: !0
}), hinnn.event.on("updateTable" + this.hitable.id, function () {
t.updateDesignViewFromOptions();
});
}, e;
}(Tt),
we = function () {
var _t20 = function t(e, n) {
return (_t20 = Object.setPrototypeOf || _instanceof({
__proto__: []
}, Array) && function (t, e) {
t.__proto__ = e;
} || function (t, e) {
for (var n in e) {
e.hasOwnProperty(n) && (t[n] = e[n]);
}
})(e, n);
};
return function (e, n) {
function i() {
this.constructor = e;
}
_t20(e, n), e.prototype = null === n ? Object.create(n) : (i.prototype = n.prototype, new i());
};
}(),
Ee = function (t) {
function e(e) {
return t.call(this, e) || this;
}
return we(e, t), e.prototype.createPrintElement = function (t) {
return new Te(this, t);
}, e;
}(It),
xe = function () {
var _t21 = function t(e, n) {
return (_t21 = Object.setPrototypeOf || _instanceof({
__proto__: []
}, Array) && function (t, e) {
t.__proto__ = e;
} || function (t, e) {
for (var n in e) {
e.hasOwnProperty(n) && (t[n] = e[n]);
}
})(e, n);
};
return function (e, n) {
function i() {
this.constructor = e;
}
_t21(e, n), e.prototype = null === n ? Object.create(n) : (i.prototype = n.prototype, new i());
};
}(),
Pe = function (t) {
function e(e) {
return t.call(this, e) || this;
}
return xe(e, t), e.prototype.createPrintElement = function (t) {
var e = {};
return $.extend(e, t || {}), ee.createPrintElement(this, e);
}, e.prototype.getPrintElementTypeEntity = function () {
return new Ft({
title: this.title,
type: this.type
});
}, e;
}(ne),
Ce = function () {
function t() { }
return t.createPrintElementType = function (t) {
return t.type = t.type || "text", "text" == t.type ? new Pe(t) : "table" == t.type ? new It(t) : "tableCustom" == t.type ? new Ee(t) : new ne(t);
}, t;
}(),
Oe = function () {
function t() { }
return t.getElementTypeGroups = function (e) {
var n = t.formatterModule(e);
return r.instance[n] || [];
}, t.getElementType = function (t, e) {
if (t) return r.instance.getElementType(t);
Ce.createPrintElementType({
type: e
});
}, t.build = function (e, n) {
var i = t.formatterModule(n),
o = new l().createPrintElementTypeHtml(e, this.getElementTypeGroups(i));
this.enableDrag(o);
}, t.buildByHtml = function (t) {
this.enableDrag(t);
}, t.enableDrag = function (e) {
e.hidraggable({
revert: !0,
proxy: function proxy(t) {
var e = s.instance.getDragingPrintElement().printElement.getProxyTarget();
return e.appendTo("body"), e;
},
moveUnit: "pt",
minMove: 4,
onBeforeDrag: function onBeforeDrag(e) {
var n = t.getElementType($(e.data.target).attr("tid"), $(e.data.target).attr("ptype"));
return s.instance.setDragingPrintElement(n.createPrintElement()), !0;
},
onDrag: function onDrag(t, e, n) {
s.instance.getDragingPrintElement().updatePosition(e, n);
},
onStopDrag: function onStopDrag(t) { console.log('onStopDrag') }
});
}, t.formatterModule = function (t) {
return t || "_default";
}, t;
}(),
Se = function () {
return function (t, e) {
var n = this;
this.name = t, this.printElementTypes = [], e.forEach(function (t) {
n.printElementTypes.push(Ce.createPrintElementType(t));
});
};
}(),
He = function () {
return function (t) {
if (this.index = t.index, this.paperType = t.paperType, this.paperType) {
var e = s.instance[this.paperType];
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 || hinnn.mm.toPt(this.height), this.printElements = t.printElements || [], this.paperNumberLeft = t.paperNumberLeft, this.paperNumberTop = t.paperNumberTop, this.paperNumberDisabled = t.paperNumberDisabled, this.paperNumberFormat = t.paperNumberFormat, this.panelPaperRule = t.panelPaperRule, 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.leftOffset = t.leftOffset;
};
}(),
Fe = function () {
function t(t, e) {
this.templateId = e, this.index = t.index, 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.paperNumberFormat = t.paperNumberFormat, this.panelPaperRule = t.panelPaperRule, 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.target = this.createTarget(), this.rotate = t.rotate;
}
return t.prototype.design = function (t) {
var e = this;
this.orderPrintElements(), this.designPaper = this.createNewPage(0), this.target.append(this.designPaper.getTarget()), this.droppablePaper(this.designPaper), this.designPaper.design(t), this.designPaper.subscribePaperBaseInfoChanged(function (t) {
e.paperHeader = t.paperHeader, e.paperFooter = t.paperFooter, e.paperNumberLeft = t.paperNumberLeft, e.paperNumberTop = t.paperNumberTop, e.paperNumberDisabled = t.paperNumberDisabled, e.paperNumberFormat = t.paperNumberFormat;
}), this.printElements.forEach(function (n) {
e.appendDesignPrintElement(e.designPaper, n), n.design(t);
}), this.target.bind("click.hiprint", function (t) {
hinnn.event.trigger("BuildCustomOptionSettingEventKey_" + e.templateId, {
options: {
panelPaperRule: e.panelPaperRule,
firstPaperFooter: e.firstPaperFooter,
evenPaperFooter: e.evenPaperFooter,
oddPaperFooter: e.oddPaperFooter,
lastPaperFooter: e.lastPaperFooter,
leftOffset: e.leftOffset,
topOffset: e.topOffset
},
callback: function callback(t) {
e.panelPaperRule = t.panelPaperRule, 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.designPaper.setOffset(e.leftOffset, e.topOffset);
}
});
});
}, t.prototype.getHtml = function (t, e, n) {
var i = this;
this.orderPrintElements();
var o = [],
r = this.createTarget(),
a = this.createNewPage(o.length);
(o.push(a), r.append(a.getTarget()), this.printElements.filter(function (t) {
return !t.isFixed() && t.options.getTop() > a.paperHeader && t.options.getTop() < i.paperFooter;
}).forEach(function (e) {
var n = [],
p = o[o.length - 1];
p.referenceElement.isPositionLeftOrRight(e.options.getTop()) ? (a = o[p.referenceElement.beginPrintPaperIndex], n = e.getHtml(a, t)) : (a = o[p.referenceElement.endPrintPaperIndex], n = e.getHtml(a, t)), n.forEach(function (t, p) {
t.referenceElement && (t.referenceElement.endPrintPaperIndex = t.referenceElement.beginPrintPaperIndex + n.length - 1), p > 0 && (a.index < o.length - 1 ? a = o[a.index + 1] : (a = i.createNewPage(o.length, a.referenceElement), o.push(a)), r.append(a.getTarget())), t.target && (a.append(t.target), a.updatePrintLine(t.printLine), e.onRendered(a, t.target)), p == n.length - 1 && t.referenceElement && a.updateReferenceElement(t.referenceElement);
});
}), this.lastPaperFooter) && o[o.length - 1].printLine > this.lastPaperFooter && (a = this.createNewPage(o.length, a.referenceElement), o.push(a), r.append(a.getTarget()));
return this.panelPaperRule && ("odd" == this.panelPaperRule && o.length % 2 == 0 && (a = this.createNewPage(o.length, a.referenceElement), o.push(a), r.append(a.getTarget())), "even" == this.panelPaperRule && o.length % 2 == 1 && (a = this.createNewPage(o.length, a.referenceElement), o.push(a), r.append(a.getTarget()))), o.forEach(function (n) {
n.updatePaperNumber(n.index + 1, o.length, e.paperNumberToggleInEven), i.fillPaperHeaderAndFooter(n, t, o.length), e && (null != e.leftOffset && n.setLeftOffset(e.leftOffset), null != e.topOffset && n.setTopOffset(e.topOffset));
}), r.prepend(this.getPrintStyle()), r;
}, t.prototype.resize = function (t, e, n, i) {
this.width = e, this.height = n, this.paperType = t, this.rotate = i, this.designPaper.resize(e, n);
}, t.prototype.rotatePaper = function () {
null == this.rotate && (this.rotate = !1), this.rotate = !this.rotate, this.resize(this.paperType, this.height, this.width, this.rotate);
}, t.prototype.getTarget = function () {
return this.target;
}, t.prototype.enable = function () {
this.target.removeClass("hipanel-disable");
}, t.prototype.disable = function () {
this.target.addClass("hipanel-disable");
}, t.prototype.getPanelEntity = function (t) {
var e = [];
return this.printElements.forEach(function (n) {
e.push(n.getPrintElementEntity(t));
}), new He({
index: this.index,
width: this.width,
height: this.height,
paperType: this.paperType,
paperHeader: this.paperHeader,
paperFooter: this.paperFooter,
paperNumberDisabled: !!this.paperNumberDisabled || void 0,
paperNumberFormat: this.paperNumberFormat ? this.paperNumberFormat : void 0,
panelPaperRule: this.panelPaperRule ? this.panelPaperRule : void 0,
paperNumberLeft: this.paperNumberLeft,
paperNumberTop: this.paperNumberTop,
printElements: e,
rotate: this.rotate,
firstPaperFooter: this.firstPaperFooter,
evenPaperFooter: this.evenPaperFooter,
oddPaperFooter: this.oddPaperFooter,
lastPaperFooter: this.lastPaperFooter,
topOffset: this.topOffset,
leftOffset: this.leftOffset
});
}, t.prototype.createTarget = function () {
return $('');
}, t.prototype.droppablePaper = function (t) {
var e = this;
t.getTarget().hidroppable({
accept: ".ep-draggable-item",
onDrop: function onDrop(t, n) {
var i = s.instance.getDragingPrintElement(),
o = i.printElement;
o.updateSizeAndPositionOptions(e.mathroundToporleft(i.left - hinnn.px.toPt(e.target.offset().left)), e.mathroundToporleft(i.top - hinnn.px.toPt(e.target.offset().top))), e.appendDesignPrintElement(e.designPaper, o, !0), o.setTemplateId(e.templateId), e.printElements.push(o), o.design();
}
});
}, t.prototype.initPrintElements = function (t) {
var e = this;
this.printElements = [], t && t.forEach(function (n) {
var i;
if (i = n.printElementType ? Ce.createPrintElementType(n.printElementType) : r.instance.getElementType(n.tid)) {
var o = i.createPrintElement(n.options);
o.setTemplateId(e.templateId), e.printElements.push(o);
} else console.log("miss " + JSON.stringify(t));
});
}, t.prototype.mathroundToporleft = function (t) {
var e = a.instance.movingDistance;
return Math.round(t / e) * e;
}, t.prototype.appendDesignPrintElement = function (t, e, n) {
e.setCurrenttemplateData(void 0);
var i = e.getDesignTarget(t);
i.addClass("design"), n && e.initSizeByHtml(i), t.append(i);
}, t.prototype.createNewPage = function (t, e) {
var n = new Lt(this.templateId, this.width, this.height, this.paperHeader, this.paperFooter, this.paperNumberLeft, this.paperNumberTop, this.paperNumberDisabled, this.paperNumberFormat, t, e);
return n.setFooter(this.firstPaperFooter, this.evenPaperFooter, this.oddPaperFooter, this.lastPaperFooter), n.setOffset(this.leftOffset, this.topOffset), n;
}, t.prototype.orderPrintElements = function () {
this.printElements = hinnn.orderBy(this.printElements, function (t) {
return t.options.getLeft();
}), this.printElements = hinnn.orderBy(this.printElements, function (t) {
return t.options.getTop();
});
}, t.prototype.fillPaperHeaderAndFooter = function (t, e, n) {
var i = this;
this.printElements.filter(function (e) {
return e.isFixed() || e.options.getTop() < t.paperHeader || e.options.getTop() >= i.paperFooter;
}).forEach(function (i) {
if (i.isFixed(), i.showInPage(t.index, n)) {
var o = i.getHtml(t, e);
o.length && t.append(o[0].target);
}
});
}, t.prototype.clear = function () {
this.printElements.forEach(function (t) {
t.designTarget && t.designTarget.length && t.designTarget.remove();
}), this.printElements = [];
}, t.prototype.insertPrintElementToPanel = function (t) {
var e = this.getPrintElementTypeByEntity(t);
if (e) {
var n = e.createPrintElement(t.options);
n.setTemplateId(this.templateId), this.printElements.push(n);
}
}, t.prototype.addPrintText = function (t) {
t.printElementType = t.printElementType || {}, t.printElementType.type = "text", this.insertPrintElementToPanel(t);
}, t.prototype.addPrintHtml = function (t) {
t.printElementType = t.printElementType || {}, t.printElementType.type = "html", this.insertPrintElementToPanel(t);
}, t.prototype.addPrintTable = function (t) {
t.printElementType = t.printElementType || {}, t.printElementType.type = "table", t.options && t.options.columns && (t.printElementType.columns = t.options.columns), this.insertPrintElementToPanel(t);
}, t.prototype.addPrintImage = function (t) {
t.printElementType = t.printElementType || {}, t.printElementType.type = "image", this.insertPrintElementToPanel(t);
}, t.prototype.addPrintLongText = function (t) {
t.printElementType = t.printElementType || {}, t.printElementType.type = "longText", this.insertPrintElementToPanel(t);
}, t.prototype.addPrintVline = function (t) {
t.printElementType = t.printElementType || {}, t.printElementType.type = "vline", this.insertPrintElementToPanel(t);
}, t.prototype.addPrintHline = function (t) {
t.printElementType = t.printElementType || {}, t.printElementType.type = "hline", this.insertPrintElementToPanel(t);
}, t.prototype.addPrintRect = function (t) {
t.printElementType = t.printElementType || {}, t.printElementType.type = "rect", this.insertPrintElementToPanel(t);
}, t.prototype.addPrintOval = function (t) {
t.printElementType = t.printElementType || {}, t.printElementType.type = "oval", this.insertPrintElementToPanel(t);
}, t.prototype.getPrintElementTypeByEntity = function (t) {
var e;
return (e = t.tid ? r.instance.getElementType(t.tid) : Ce.createPrintElementType(t.printElementType)) || console.log("miss " + JSON.stringify(t)), e;
}, t.prototype.getPrintStyle = function () {
return " \n ";
}, t.prototype.getPrintSizeStyle = function () {
return this.paperType ? "size:" + this.paperType + " " + (this.height > this.width ? "portrait" : "landscape") + ";" : "size:" + this.width + "mm " + this.height + "mm;";
}, t.prototype.deletePrintElement = function (t) {
var e = this;
this.printElements.filter(function (n, i) {
n.id == t.id && (t.delete(), e.printElements.splice(i, 1));
});
}, t.prototype.getElementByTid = function (t) {
return this.printElements.filter(function (e) {
return e.printElementType.tid === t;
}).map(function (t, e) {
return t;
});
}, t.prototype.getElementByName = function (t) {
return this.printElements.filter(function (e) {
return e.options.name === t;
}).map(function (t, e) {
return t;
});
}, t;
}(),
Ie = function () {
return function (t) {
if (t) if (t.panels) {
this.panels = [];
for (var e = 0; e < t.panels.length; e++) {
this.panels.push(new He(t.panels[e]));
}
} else this.panels = [];
};
}(),
De = function () {
function t(t, e) {
var n = this;
//组件选中方法,配置参数
this.printTemplate = t, this.settingContainer = $(e), hinnn.event.on(t.getPrintElementSelectEventKey(), function (t) {
n.buildSetting(t);
}), hinnn.event.on(t.getBuildCustomOptionSettingEventKey(), function (t) {
n.buildSettingByCustomOptions(t);
});
}
return t.prototype.init = function () { }, t.prototype.buildSetting = function (t) {
var e = this;
this.lastPrintElement && this.lastPrintElement.getPrintElementOptionItems().forEach(function (t) {
t.destroy();
});
this.lastPrintElement = t, this.settingContainer.html("");
var n = $('');
t.getPrintElementOptionItems().forEach(function (e) {
n.append(e.createTarget()), e.setValue(t.options[e.name]);
});
var i = $(''),
o = $('');
n.append(i), n.append(o), i.bind("click.submitOption", function () {
t.submitOption();
}), o.bind("click.deleteBtn", function () {
e.printTemplate.deletePrintElement(t);
}), n.find(".hiprint-option-item .hiprint-option-item-field select").change(function (e) {
t.submitOption();
}), n.find(".hiprint-option-item .hiprint-option-item-field input").bind("keydown.submitOption", function (e) {
13 == e.keyCode && t.submitOption();
}), this.settingContainer.append(n);
}, t.prototype.buildSettingByCustomOptions = function (t) {
var e = this;
this.lastPrintElement && this.lastPrintElement.getPrintElementOptionItems().forEach(function (t) {
t.destroy();
});
this.lastPrintElement = void 0, this.settingContainer.html("");
var n = [],
i = Object.keys(t.options);
i.forEach(function (t) {
var e = vt.getItem(t);
e && n.push(e);
}), i = i.concat();
var o = $('');
n.forEach(function (e) {
o.append(e.createTarget()), e.setValue(t.options[e.name]);
});
var r = $('');
o.append(r), r.bind("click.submitOption", function () {
t.callback(e.getValueByOptionItems(n));
}), o.find(".hiprint-option-item .hiprint-option-item-field select").change(function (i) {
t.callback(e.getValueByOptionItems(n));
}), o.find(".hiprint-option-item .hiprint-option-item-field input").bind("keydown.submitOption", function (i) {
13 == i.keyCode && t.callback(e.getValueByOptionItems(n));
}), this.settingContainer.append(o);
}, t.prototype.getValueByOptionItems = function (t) {
var e = {};
return t.forEach(function (t) {
e[t.name] = t.getValue();
}), e;
}, t;
}(),
_e = function () {
function t(t, e) {
this.paginationContainer = t, this.jqPaginationContainer = $(this.paginationContainer), this.template = e;
}
return t.prototype.buildPagination = function () {
var t = this.template.getPaneltotal(),
e = this;
this.jqPaginationContainer.html("");
for (var n = $('