`)
}), i.append(e);
}, a = 0; a < n.totalLayer; a++) {
r(a);
}
return TableExcelHelper.syncTargetWidthToOption(t), [i, colgroup];
}, TableExcelHelper.createTableFooter = function (t, e, n, i, o, r, pageIndex) {
// n=>options e=>表格所有数据 o=>所有打印数据 r=>表格每页数据
var a = $(""), p = this.getFooterFormatter(n, i);
var tst = this.tableSummaryTitle;
let tSumData = n.tableFooterRepeat == "last" ? e : r;
let idx = n.columns.length - 1;
var rowColumns = this.rowColumns || n.columns[idx].columns;
if (n.tableFooterRepeat != 'no' && rowColumns.some(function (column) {return column.tableSummary})) {
var tableFooter = $("
");
rowColumns.filter(function (t) {
return t.checked;
}).forEach(function (column) {
var fieldData = tSumData.filter(function (row) {
return row && row[column.field];
}).map(function (row) {
return new RegExp("^-?(0|[1-9]\\d*)(\\.\\d+)?").test(row[column.field]) ? Number(row[column.field]) : 0;
});
var text = column.tableSummaryText;
var numF = column.tableSummaryNumFormat || 2;
var style = `text-align: ${column.tableSummaryAlign || "center"}`;
var colspan = column.tableSummaryColspan == void 0 ? 1 : column.tableSummaryColspan;
var upperCaseType = column.upperCase;
let {toUpperCase, numFormat} = _assets_plugins_hinnn__WEBPACK_IMPORTED_MODULE_1__.a;
var tableSummaryFormatter = TableExcelHelper.getColumnTableSummaryFormatter(column);
var formatterResult = tableSummaryFormatter ? tableSummaryFormatter(column, fieldData, e, n) : '';
if (formatterResult) {
tableFooter.append(formatterResult);
return;
}
switch (column.tableSummary) {
case "count":
var title = tst(column, text || `${i18n.__('计数')}:`, o);
var count = toUpperCase(upperCaseType,tSumData.filter(i => i).length || 0);
tableFooter.append(`
${title}${count}
`);
break;
case "sum":
var sum = parseFloat(Number(fieldData.reduce(function (prev, cur) {
return prev + cur;
}, 0)));
sum = toUpperCase(upperCaseType,numFormat(sum, numF));
var title = tst(column, text || `${i18n.__('合计')}:`, o);
tableFooter.append(`
${title}${sum}
`)
break;
case "avg":
var sum = parseFloat(Number(fieldData.reduce(function (prev, cur) {
return prev + cur;
}, 0)));
var avg = parseFloat(Number(sum / (fieldData.length || 1)));
avg = toUpperCase(upperCaseType,numFormat(avg, numF));
var title = tst(column, text || `${i18n.__('平均值')}:`, o);
tableFooter.append(`
${title}${avg}
`)
break;
case "min":
var min = Math.min(...fieldData) || 0;
min == Infinity && (min = 0);
min = toUpperCase(upperCaseType,numFormat(min, numF));
var title = tst(column, text || `${i18n.__('最小值')}:`, o);
tableFooter.append(`
${title}${min || 0}
`)
break;
case "max":
var max = Math.max(...fieldData);
max == -Infinity && (max = 0);
max = toUpperCase(upperCaseType,numFormat(max, numF));
var title = tst(column, text || `${i18n.__('最大值')}:`, o);
tableFooter.append(`
${title}${max || 0}
`);
break;
case "text":
tableFooter.append(`
${text || ""}
`);
break;
default:
if (colspan >= 1) {
tableFooter.append(`
${text || ""}
`)
}
break;
}
})
a.append(tableFooter);
}
if (p) {
// pageIndex: 当前页码(0开始) 如果表格脚最后页显示,则中间回调 undefined
a.append(p(n, e, o, r, pageIndex));
}
return a;
}, TableExcelHelper.tableSummaryTitle = function (column, title, data) {
var s = column.tableSummaryTitle == undefined || column.tableSummaryTitle == true;
return s ? `${title}` : data ? `` : `${title}`;
}, TableExcelHelper.createTableRow = function (t, e, printData, n, i) {
var h = this;
var o = TableExcelHelper.reconsitutionTableColumnTree(t),
r = $("");
var gff = h.getGroupFieldsFormatter(n, i);
var groupRowIndex = 0;
var groupFields = gff ? (n.groupFields = gff(i, n, e)) : i.groupFields ? i.groupFields : [];
e = Array.isArray(e) ? e : [];
groupFields.length ? _assets_plugins_hinnn__WEBPACK_IMPORTED_MODULE_1__.a.groupBy(e, groupFields, function (t) {
var e = {};
return groupFields.forEach(function (n) {
return e[n] = t[n];
}), e;
}).forEach(function (t) {
var groupFormatter = h.getGroupFormatter(n, i);
if (groupFormatter) {
let result = groupFormatter(o.colspan, e, printData, t, n)
if ($(result).is("tr")) {
r.append(result)
} else if ($(result).is("td")) {
r.append(`
${result}
`)
} else {
r.append(`
${result}
`)
}
}
var groupFooterFormatter = h.getGroupFooterFormatter(n, i);
var groupData = t;
if (groupData.rows.forEach(function (t, rowIndex) {
let sequenceIndex = n.groupSequenceContinue ? groupRowIndex : rowIndex;
var e = TableExcelHelper.createRowTarget(o, t, n, i, sequenceIndex, groupData.rows, printData);
r.append(e);
groupRowIndex += 1;
}), groupFooterFormatter) {
let result = groupFooterFormatter(o.colspan, e, printData, t, n)
if ($(result).is("tr")) {
r.append(result)
} else if ($(result).is("td")) {
r.append(`
${result}
`)
} else {
r.append(`
${result}
`)
}
}
}) : e.forEach(function (t, rowIndex) {
var row = TableExcelHelper.createRowTarget(o, t, n, i, rowIndex, e, printData);
r.append(row);
});
return r;
}, TableExcelHelper.createRowTarget = function (t, e, n, i, rowIndex, tableData, printData) {
var o = $("
");
var columns = t.rowColumns.filter(function (t) {
return t.checked;
});
o.data("rowData", e), t.rowColumns.filter(function (t) {
return t.checked;
}).forEach(function (t, i) {
if (!t.checked) return;
var rowsColumnsMerge = ''
if (n.rowsColumnsMerge) {
eval('rowsColumnsMerge=' + n.rowsColumnsMerge)
var rowsColumnsArr = rowsColumnsMerge(e, t, i, rowIndex, tableData, printData) || [1, 1]
var r = $(`
`);
} else {
var r = $("
");
}
// 设计时不去计算宽度
if (e && Object.keys(e).length > 0 && ("first" == n.tableHeaderRepeat || "none" == n.tableHeaderRepeat)) {
t.field && r.attr("field", t.field), t.align && r.css("text-align", t.align), t.vAlign && r.css("vertical-align", t.vAlign);
// 无表头时跨行无效,需根据所跨行数重新计算宽度
if (n.rowsColumnsMerge) {
if (rowsColumnsArr[1] > 1) {
var width = 0;
columns.forEach((item, index) => {
if (index >= i && (index < i + rowsColumnsArr[1])) {
width += item.width
}
})
}
}
r.css("width", (width || t.width) + "pt");
} else {
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 = TableExcelHelper.getColumnFormatter(t),
p = a ? a(e[t.field], e, i, n) : e[t.field];
var rf = TableExcelHelper.getColumnRenderFormatter(t);
if (rf) {
r.html(rf(e[t.field], e, i, n, rowIndex))
//表格内容插入二维码等
} else if ("text" == t.tableTextType || t.tableTextType == void 0) r.html(p);
else {
if ("barcode" == t.tableTextType) {
r.html(
''
);
try {
p ? (JsBarcode(r.find(".hibarcode_imgcode")[0], p, {
format: t.tableBarcodeMode || "CODE128A",
width: 1,
textMargin: -1,
lineColor: "#000000",
margin: 0,
height: parseInt(10),
displayValue: !1
}), r.find(".hibarcode_imgcode").attr("height", t.tableColumnHeight || 30 + 'pt'), r.find(".hibarcode_imgcode").css("margin", '5pt 10pt'), r.find(".hibarcode_imgcode").attr("width", "calc(100% - 20pt)")) : r.html("");
// this.options.hideTitle || r.find(".hibarcode_displayValue").html(n)
if (t.showCodeTitle) {
r.find('.hibarcode_displayValue').html(p)
}
} catch (t) {
console.log(t), r.html(`${i18n.__('此格式不支持该文本')}`);
}
}
if ("image" == t.tableTextType) {
r.html('')
if (p) {
var imagebox = $('
')
imagebox.find('img').attr('src', p)
imagebox.find('img').attr("height", t.tableColumnHeight || 50 + 'pt')
console.log(imagebox.find('img').css('width'))
r.html(imagebox)
}
}
if ("qrcode" == t.tableTextType) {
r.html("");
try {
var qrcodebox = $('')
if (p) {
var l = parseInt(t.width || t.targetWidth || 20),
u = parseInt(t.tableColumnHeight || 20);
qrcodebox.css('height', (l > u ? u : l) + 'pt')
new QRCode(qrcodebox[0], {
width: l > u ? u : l,
height: l > u ? u : l,
colorDark: "#000000",
useSVG: !0,
correctLevel: t.tableQRCodeLevel || 0,
}).makeCode(p);
// r.find(".hiqrcode_imgcode").css("margin", '5pt 0pt'),
r.html(qrcodebox)
if(t.showCodeTitle) {
r.append(
''
)
r.find('.hiqrcode_displayValue').html(p)
}
}
} catch (t) {
console.log(t), r.html(`${i18n.__('二维码生成失败')}`);
}
}
if ('sequence' === t.tableTextType) {
r.html(rowIndex + 1);
}
}
var s = TableExcelHelper.getColumnStyler(t);
if (s) {
var l = s(e[t.field], e, i, n);
if (l) Object.keys(l).forEach(function (t) {
r.css(t, l[t]);
});
}
o.append(r);
});
var r = TableExcelHelper.getRowStyler(n, i);
if (r) {
var a = r(e, n);
if (a) Object.keys(a).forEach(function (t) {
o.css(t, a[t]);
});
}
return o;
}, TableExcelHelper.createEmptyRowTarget = function (t, tableElement) {
var e = TableExcelHelper.reconsitutionTableColumnTree(t),
n = $("
");
e.rowColumns.filter(function (t) {
return t.checked;
}).forEach(function (t, e) {
var i = $("
");
t.field && i.attr("field", t.field), t.align && i.css("text-align", t.align), t.vAlign && i.css("vertical-align", t.vAlign), n.append(i);
});
if (tableElement && tableElement.options.tableBodyRowHeight) {
n.find('td:not([rowspan])').css('height', tableElement.options.tableBodyRowHeight + 'pt');
}
return n;
}, TableExcelHelper.getColumnsWidth = function (t, e) {
var n = {},
i = TableExcelHelper.allAutoWidth(t),
o = TableExcelHelper.allFixedWidth(t);
return t.rowColumns.filter(function (t) {
return t.checked;
}).forEach(function (t) {
if (t.fixed) n[t.id] = t.width; else {
var r = e - o,
a = t.width / i * (r > 0 ? r : 0);
n[t.id] = a;
}
}), n;
}, TableExcelHelper.resizeTableCellWidth = function (t, e, n) {
var i = TableExcelHelper.reconsitutionTableColumnTree(e),
o = TableExcelHelper.getColumnsWidth(i, n);
t.find("thead tr td[haswidth]").map(function (t, e) {
var n = $(e).attr("id"),
i = o[n];
$(e).css("width", i + "pt");
});
}, TableExcelHelper.allAutoWidth = function (t) {
var e = 0, n = {};
return t.rowColumns.filter(function (t) {
return t.checked;
}).forEach(function (t) {
n[t.id] ? n[t.id] = 0 : n[t.id] = t.width;
e += t.fixed ? 0 : n[t.id];
}), e;
}, TableExcelHelper.allFixedWidth = function (t) {
var e = 0, n = {};;
return t.rowColumns.filter(function (t) {
return t.checked;
}).forEach(function (t) {
n[t.id] ? n[t.id] = 0 : n[t.id] = t.width;
e += t.fixed ? n[t.id] : 0;
}), e;
}, TableExcelHelper.reconsitutionTableColumnTree = function (t, e, n) {
var i = e || new _ReconsitutionTableColumns__WEBPACK_IMPORTED_MODULE_0__.a();
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) {
0 == e && (i.colspan += t.colspan);
});
}, r = 0; r < t.length; r++) {
o(r);
}
return i.rowColumns = TableExcelHelper.getOrderdColumns(i), i;
}, TableExcelHelper.syncTargetWidthToOption = function (t) {
t.forEach(function (t) {
t.columns.forEach(function (t) {
t.hasWidth && (t.width = t.targetWidth);
});
});
}, TableExcelHelper.getGroupFieldsFormatter = function (options, tablePrintElementType) {
var groupFieldsFormatter = void 0;
if (tablePrintElementType.groupFields && tablePrintElementType.groupFields.length) {
var arr = typeof tablePrintElementType.groupFields == "string" ? tablePrintElementType.groupFields : JSON.stringify(tablePrintElementType.groupFields);
options.groupFieldsFormatter = "function(type,options,data){ return " + arr + " }";
}
if (tablePrintElementType.groupFieldsFormatter && (groupFieldsFormatter = tablePrintElementType.groupFieldsFormatter), options.groupFieldsFormatter) try {
var s = "groupFieldsFormatter=" + options.groupFieldsFormatter;
eval(s);
} catch (t) {
console.log(t);
}
return groupFieldsFormatter;
}, TableExcelHelper.getGroupFormatter = function (options, tablePrintElementType) {
var groupFormatter = void 0;
if (tablePrintElementType.groupFormatter && (groupFormatter = tablePrintElementType.groupFormatter), options.groupFormatter) try {
var s = "groupFormatter=" + options.groupFormatter;
eval(s);
} catch (t) {
console.log(t);
}
return groupFormatter;
}, TableExcelHelper.getGroupFooterFormatter = function (options, tablePrintElementType) {
var groupFooterFormatter = void 0;
if (tablePrintElementType.groupFooterFormatter && (groupFooterFormatter = tablePrintElementType.groupFooterFormatter), options.groupFooterFormatter) try {
var s = "groupFooterFormatter=" + options.groupFooterFormatter;
eval(s);
} catch (t) {
console.log(t);
}
return groupFooterFormatter;
}, TableExcelHelper.getFooterFormatter = function (options, tablePrintElementType) {
var footerFormatter = void 0;
if (tablePrintElementType.footerFormatter && (footerFormatter = tablePrintElementType.footerFormatter), options.footerFormatter) try {
var s = "footerFormatter=" + options.footerFormatter;
eval(s);
} catch (t) {
console.log(t);
}
return footerFormatter;
}, TableExcelHelper.getRowStyler = function (options, tablePrintElementType) {
var rowStyler = void 0;
if (tablePrintElementType.rowStyler && (rowStyler = tablePrintElementType.rowStyler), options.rowStyler) try {
var s = "rowStyler=" + options.rowStyler;
eval(s);
} catch (t) {
console.log(t);
}
return rowStyler;
}, TableExcelHelper.getColumnTableSummaryFormatter = function (column) {
var tableSummaryFormatter = void 0;
if (column.tableSummaryFormatter && (tableSummaryFormatter = column.tableSummaryFormatter), column.tableSummaryFormatter) try {
var s = "tableSummaryFormatter=" + column.tableSummaryFormatter;
eval(s);
} catch (t) {
console.log(t);
}
return tableSummaryFormatter;
}, TableExcelHelper.getColumnStyler = function (column) {
var styler = void 0;
if (column.styler && (styler = column.styler), column.styler2) try {
var s = "styler=" + column.styler2;
eval(s);
} catch (t) {
console.log(t);
}
return styler;
}, TableExcelHelper.getHeaderStyler = function (column) {
var stylerHeader = void 0;
if (column.stylerHeader && (stylerHeader = column.stylerHeader), column.stylerHeader) try {
var s = "stylerHeader=" + column.stylerHeader;
eval(s);
} catch (t) {
console.log(t);
}
return stylerHeader;
}, TableExcelHelper.getColumnRenderFormatter = function (column) {
var renderFormatter = void 0;
if (column.renderFormatter && (renderFormatter = column.renderFormatter), column.renderFormatter) try {
var s = "renderFormatter=" + column.renderFormatter;
eval(s);
} catch (t) {
console.log(t);
}
return renderFormatter;
}, TableExcelHelper.getColumnFormatter = function (column) {
var formatter = void 0;
if (column.formatter && (formatter = column.formatter), column.formatter2) try {
var s = "formatter=" + column.formatter2;
eval(s);
} catch (t) {
console.log(t);
}
return formatter;
}, TableExcelHelper.getOrderdColumns = function (t) {
// 新数据
let newColumns = {};
// 遍历所有 rawData columns,先处理 colspan 防止后面 rowspan 插入取下标错误
for (let i = 0; i < t.totalLayer; i++) {
newColumns[i] = []; // 新数据中添加对应 columns
t[i].forEach((column, columnIdx) => {
newColumns[i].push(...new Array(column.colspan).fill({ ...column, colspan: 1 })); // 创建 colspan 个
});
}
// 再次遍历 rawData columns,处理 rowspan 给后面 columns 插入相同 column
for (let i = 0; i < t.totalLayer; i++) {
newColumns[i].forEach((column, columnIdx) => {
for (let n = 1; n < column.rowspan; n++) {
newColumns[i + n].splice(columnIdx, 0, { ...column, rowspan: 1 });
}
});
}
// 把上层/其他层的 field 赋值给最下层
let lastColumns = [];
for (let i = 0; i < t.totalLayer; i++) {
if (i >= t.totalLayer - 1) {
newColumns[i].forEach((column, columnIdx) => {
if (!column.field) {
column.field = lastColumns[columnIdx];
}
})
} else {
newColumns[i].forEach((column, columnIdx) => {
if (i == 0) {
lastColumns.push(column.field || "");
} else {
column.field && (lastColumns[columnIdx] = column.field);
}
})
}
}
this.rowColumns = newColumns[t.totalLayer - 1];
return newColumns[t.totalLayer - 1];
}, TableExcelHelper;
}();
}, function (t, e, n) {
"use strict";
n.d(e, "a", function () {
return i;
});
var i = 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;
}();
}, function (t, e, n) {
"use strict";
var i = function () {
function t() {
this.name = "lineHeight";
}
return t.prototype.css = function (t, e) {
if (t && t.length) {
if (e) return t.css("line-height", e + "pt"), "line-height:" + e + "pt";
t[0].style.lineHeight = "";
}
return null;
}, t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('字体行高')}\n
\n
\n \n
\n
`), this.target;
}, t.prototype.getValue = function () {
var t = this.target.find("select").val();
if (t) return parseFloat(t.toString());
}, t.prototype.setValue = function (t) {
t && (this.target.find('option[value="' + t + '"]').length || this.target.find("select").prepend('"));
this.target.find("select").val(t);
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
fontFamily = function () {
function t() {
this.name = "fontFamily";
}
return t.prototype.createTarget = function (t) {
var e = void 0;
if (t && (e = t.getFontList()), e) {
var n = `
\n
\n ${i18n.__('字体')}\n
\n
\n \n
\n
", this.target = $(n);
} else {
this.target = $(`
\n
\n ${i18n.__('字体')}\n
\n
\n \n
\n
`);
}
return this.target;
}, t.prototype.css = function (t, e) {
if (t && t.length) {
if (e) return t.css("font-family", e), "font-family:" + e;
t[0].style.fontFamily = "inherit"; // 从父元素继承字体, 否则模板字体无效
}
return null;
}, t.prototype.getValue = function () {
var t = this.target.find("select").val();
if (t) return t.toString();
}, t.prototype.setValue = function (t) {
t && (this.target.find('option[value="' + t + '"]').length || this.target.find("select").prepend('"));
this.target.find("select").val(t);
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
r = function () {
function t() {
this.name = "fontSize";
}
return t.prototype.css = function (t, e) {
if (t && t.length) {
if (e) return t.css("font-size", e + "pt"), "font-size:" + e + "pt";
t[0].style.fontSize = "";
}
return null;
}, t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('字体大小')}\n
\n
\n \n
\n
`), this.target;
}, t.prototype.getValue = function () {
var t = this.target.find("select").val();
if (t) return parseFloat(t.toString());
}, t.prototype.setValue = function (t) {
t && (this.target.find('option[value="' + t + '"]').length || this.target.find("select").prepend('"));
this.target.find("select").val(t);
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
a = function () {
function t() {
this.name = "fontWeight";
}
return t.prototype.css = function (t, e) {
if (t && t.length) {
if (e) return t.css("font-weight", e), "font-weight:" + e;
t[0].style.fontWeight = "";
}
return null;
}, t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('字体粗细')}\n
\n
\n \n
\n
`), this.target;
}, t.prototype.getValue = function () {
var t = this.target.find("select").val();
if (t) return t.toString();
}, t.prototype.setValue = function (t) {
t && (this.target.find('option[value="' + t + '"]').length || this.target.find("select").prepend('"));
this.target.find("select").val(t);
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
p = function () {
function t() {
this.name = "letterSpacing";
}
return t.prototype.css = function (t, e) {
if (t && t.length) {
if (e) return t.css("letter-spacing", e + "pt"), "letter-spacing:" + e + "pt";
t[0].style.letterSpacing = "";
}
return null;
}, t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('字间距')}\n
\n
\n \n
\n
`), this.target;
}, t.prototype.getValue = function () {
var t = this.target.find("select").val();
if (t) return parseFloat(t.toString());
}, t.prototype.setValue = function (t) {
t && (this.target.find('option[value="' + t + '"]').length || this.target.find("select").prepend('"));
this.target.find("select").val(t);
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
s = function () {
function t() {
this.name = "textAlign";
}
return t.prototype.css = function (t, e) {
if (t && t.length) {
if (e) return t.css("text-align", e), "justify" == e ? (t.css("text-align-last", "justify"), t.css("text-justify", "distribute-all-lines")) : (t[0].style.textAlignLast = "", t[0].style.textJustify = ""), "text-align:" + e;
t[0].style.textAlign = "", t[0].style.textAlignLast = "", t[0].style.textJustify = "";
}
return null;
}, t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('左右对齐')}\n
\n
\n \n
\n
`), 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;
}(),
l = function () {
function t() {
this.name = "hideTitle";
}
return t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('标题显示隐藏')}\n
\n
\n \n
\n
`), this.target;
}, t.prototype.getValue = function () {
if ("true" == this.target.find("select").val()) return !0;
}, t.prototype.setValue = function (t) {
this.target.find("select").val((null == t ? "" : t).toString());
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
u = function () {
function t() {
this.name = "tableBorder";
}
return t.prototype.css = function (t, e) {
if (t.find("table").length) {
if ("border" == e || void 0 == e) return t.find("table").css("border", "1px solid"), "border:1px solid";
"noBorder" == e ? t.find("table").css("border", "0px solid") : t.find("table")[0].style.border = "";
}
return null;
}, t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('表格边框')}\n
\n
\n \n
\n
`), 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;
}(),
d = function () {
function t() {
this.name = "tableHeaderBorder";
}
return t.prototype.css = function (t, e) {
if (t.find("thead tr").length) {
if ("border" == e || void 0 == e) return t.find("thead tr").addClass("hiprint-printElement-tableTarget-border-all");
"noBorder" == e ? t.find("thead tr").addClass("hiprint-printElement-tableTarget-border-none") : "leftBorder" == e ? t.find("thead tr").addClass("hiprint-printElement-tableTarget-border-left") : "rightBorder" == e ? t.find("thead tr").addClass("hiprint-printElement-tableTarget-border-right") : "leftRightBorder" == e ? t.find("thead tr").addClass("hiprint-printElement-tableTarget-border-lr") : "topBorder" == e ? t.find("thead tr").addClass("hiprint-printElement-tableTarget-border-top") : "bottomBorder" == e ? t.find("thead tr").addClass("hiprint-printElement-tableTarget-border-bottom") : "topBottomBorder" == e ? t.find("thead tr").addClass("hiprint-printElement-tableTarget-border-tb") : t.find("thead tr").removeClass();
}
return null;
}, t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('表头边框')}\n
\n
\n \n
\n
`), 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;
}(),
c = function () {
function t() {
this.name = "tableHeaderCellBorder";
}
return t.prototype.css = function (t, e) {
if (t.find("thead tr").length) {
if ("border" == e || void 0 == e) return t.find("thead tr").addClass("hiprint-printElement-tableTarget-border-td-all");
"noBorder" == e ? t.find("thead tr").addClass("hiprint-printElement-tableTarget-border-td-none") : t.find("thead tr").removeClass();
}
return null;
}, t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('表头单元格边框')}\n
\n
\n \n
\n
`), 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;
}(),
d2 = function () {
function t() {
this.name = "tableFooterBorder";
}
return t.prototype.css = function (t, e) {
if (t.find("tfoot tr").length) {
if ("border" == e || void 0 == e) return t.find("tfoot tr").addClass("hiprint-printElement-tableTarget-border-all");
"noBorder" == e ? t.find("tfoot tr").addClass("hiprint-printElement-tableTarget-border-none") : "leftBorder" == e ? t.find("tfoot tr").addClass("hiprint-printElement-tableTarget-border-left") : "rightBorder" == e ? t.find("tfoot tr").addClass("hiprint-printElement-tableTarget-border-right") : "leftRightBorder" == e ? t.find("tfoot tr").addClass("hiprint-printElement-tableTarget-border-lr") : "topBorder" == e ? t.find("tfoot tr").addClass("hiprint-printElement-tableTarget-border-top") : "bottomBorder" == e ? t.find("tfoot tr").addClass("hiprint-printElement-tableTarget-border-bottom") : "topBottomBorder" == e ? t.find("tfoot tr").addClass("hiprint-printElement-tableTarget-border-tb") : t.find("tfoot tr").removeClass();
}
return null;
}, t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('表尾边框')}\n
\n
\n \n
\n
`), 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;
}(),
c2 = function () {
function t() {
this.name = "tableFooterCellBorder";
}
return t.prototype.css = function (t, e) {
if (t.find("tfoot tr").length) {
if ("border" == e || void 0 == e) return t.find("tfoot tr").addClass("hiprint-printElement-tableTarget-border-td-all");
"noBorder" == e ? t.find("tfoot tr").addClass("hiprint-printElement-tableTarget-border-td-none") : t.find("tfoot tr").removeClass();
}
return null;
}, t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('表尾单元格边框')}\n
\n
\n \n
\n
`), 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;
}(),
h = function () {
function t() {
this.name = "tableHeaderRowHeight";
}
return t.prototype.css = function (t, e) {
if (t.find("thead tr td").length) {
if (e) return t.find("thead tr td:not([rowspan])").css("height", e + "pt"), "height:" + e + "pt";
t.find("thead tr td").map(function (t, e) {
e.style.height = "";
});
}
return null;
}, t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('表头行高')}\n
\n
\n \n
\n
`), this.target;
}, t.prototype.getValue = function () {
var t = this.target.find("select").val();
if (t) return parseFloat(t.toString());
}, t.prototype.setValue = function (t) {
t && (this.target.find('option[value="' + t + '"]').length || this.target.find("select").prepend('"));
this.target.find("select").val(t);
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
f = function () {
function t() {
this.name = "tableHeaderFontSize";
}
return t.prototype.css = function (t, e) {
if (t.find("thead").length) {
if (e) return t.find("thead").css("font-size", e + "pt"), "font-size:" + e + "pt";
t.find("thead").map(function (t, e) {
e.style.fontSize = "";
});
}
return null;
}, t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('表头字体大小')}\n
\n
\n \n
\n
`), this.target;
}, t.prototype.getValue = function () {
var t = this.target.find("select").val();
if (t) return parseFloat(t.toString());
}, t.prototype.setValue = function (t) {
t && (this.target.find('option[value="' + t + '"]').length || this.target.find("select").prepend('"));
this.target.find("select").val(t);
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
g = function () {
function t() {
this.name = "tableHeaderFontWeight";
}
return t.prototype.css = function (t, e) {
if (t.find("thead").length) {
if (e) return t.find("thead tr td").css("font-weight", e), "font-weight:" + e;
t.find("thead tr td").map(function (t, e) {
e.style.fontWeight = "";
});
}
return null;
}, t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('表头字体粗细')}\n
\n
\n \n
\n
`), this.target;
}, t.prototype.getValue = function () {
var t = this.target.find("select").val();
if (t) return t;
}, t.prototype.setValue = function (t) {
t && (this.target.find('option[value="' + t + '"]').length || this.target.find("select").prepend('"));
this.target.find("select").val(t);
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
m = function () {
function t() {
this.name = "tableBodyCellBorder";
}
return t.prototype.css = function (t, e) {
if (t.find("tbody tr").length) {
if ("border" == e || void 0 == e) return t.find("tbody tr").addClass("hiprint-printElement-tableTarget-border-td-all");
"noBorder" == e ? t.find("tbody tr").addClass("hiprint-printElement-tableTarget-border-td-none") : t.find("tbody tr").removeClass();
}
return null;
}, t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('表体单元格边框')}\n
\n
\n \n
\n
`), 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;
}(),
v = function () {
function t() {
this.name = "tableBodyRowHeight";
}
return t.prototype.css = function (t, e) {
if (t.find("tbody tr td").length) {
if (e) return t.find("tbody tr td").css("height", e + "pt"), "height:" + e + "pt";
t.find("tbody tr td").map(function (t, e) {
e.style.height = "";
});
}
return null;
}, t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('表体行高')}\n
\n
\n \n
\n
`), this.target;
}, t.prototype.getValue = function () {
var t = this.target.find("select").val();
if (t) return parseFloat(t.toString());
}, t.prototype.setValue = function (t) {
t && (this.target.find('option[value="' + t + '"]').length || this.target.find("select").prepend('"));
this.target.find("select").val(t);
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
y = function () {
function t() {
this.name = "tableHeaderBackground";
}
return t.prototype.css = function (t, e) {
if (t.find("thead").length) {
if (e) return t.find("thead").css("background", e), "background:" + e;
t.find("thead").map(function (t, e) {
e.style.background = "";
});
}
return null;
}, t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('表头背景')}\n
\n
\n \n
\n
`), this.target;
}, t.prototype.getValue = function () {
var t = this.target.find("input").val();
if (t) return t.toString();
}, t.prototype.setValue = function (t) {
this.target.find("input").minicolors({
defaultValue: t || "",
theme: "bootstrap"
}), this.target.find("input").val(t);
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
b = function () {
function t() {
this.name = "borderWidth";
}
return t.prototype.createTarget = function (t) {
var name = ['hline', 'vline', 'rect', 'oval'].includes(t.printElementType.type) ? `${i18n.__('线宽')}` : `${i18n.__('边框大小')}`;
return this.target = $(`
\n
\n ${name}\n
\n
\n \n
\n
`), this.target;
}, t.prototype.css = function (t, e) {
if (t && t.length) {
if (e) return t.css("border-width", e + "pt"), "border-width:" + e + "pt";
t[0].style.borderWidth = "";
}
return null;
}, t.prototype.getValue = function () {
var t = this.target.find("select").val();
if (t) return t.toString();
}, t.prototype.setValue = function (t) {
t && (this.target.find('option[value="' + t + '"]').length || this.target.find("select").prepend('"));
this.target.find("select").val(t);
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
E = function () {
function t() {
this.name = "barcodeMode";
}
return t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('条形码格式')}\n
\n
\n \n
\n
`), this.target;
}, t.prototype.getValue = function () {
var t = this.target.find("select").val();
return t || void 0;
}, t.prototype.setValue = function (t) {
this.target.find("select").val(t);
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
barTextMode = function () {
function t() {
this.name = "barTextMode";
}
return t.prototype.createTarget = function() {
this.target = $(`
`), this.target;
}, t.prototype.getValue = function () {
var t = this.target.find("select").val();
if (t) return parseFloat(t.toString());
}, t.prototype.setValue = function (t) {
t && (this.target.find('option[value="' + t + '"]').length || this.target.find("select").prepend('"));
this.target.find("select").val(t);
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
ut = function () {
function t() {
this.name = "gridColumnsGutter";
}
return t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('一行多组间隔')}\n
\n
\n \n
\n
`), this.target;
}, t.prototype.getValue = function () {
var t = this.target.find("select").val();
if (t) return parseFloat(t.toString());
}, t.prototype.css = function (t, e) {
if (t && t.length) {
if (e) return t.find(".table-grid-row").css("margin-left", "-" + e + "pt").css("margin-right", "-" + e + "pt"), t.find(".tableGridColumnsGutterRow").css("padding-left", e + "pt").css("padding-right", e + "pt"), null;
t.find(".table-grid-row").map(function (t, e) {
e.style.marginLeft = "", e.style.marginRight = "";
}), t.find(".tableGridColumnsGutterRow").map(function (t, e) {
e.style.paddingLeft = "", e.style.paddingRight = "";
});
}
return null;
}, t.prototype.setValue = function (t) {
t && (this.target.find('option[value="' + t + '"]').length || this.target.find("select").prepend('"));
this.target.find("select").val(t);
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
ith = function () {
function t() {
this.name = "tableHeaderRepeat";
}
return t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('表格头显示')}\n
\n
\n \n
\n
`), 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;
}(),
dt = function () {
function t() {
this.name = "paddingLeft";
}
return t.prototype.css = function (t, e) {
var n = t;
if (n && n.length) {
if (e) return n.css("padding-left", e + "pt"), "padding-left";
n[0].style.paddingLeft = "";
}
return null;
}, t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('左内边距')}\n
\n
\n \n
\n
`), this.target;
}, t.prototype.getValue = function () {
var t = this.target.find("select").val();
if (t) return parseFloat(t.toString());
}, t.prototype.setValue = function (t) {
t && (this.target.find('option[value="' + t + '"]').length || this.target.find("select").prepend('"));
this.target.find("select").val(t);
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
ct = function () {
function t() {
this.name = "paddingRight";
}
return t.prototype.css = function (t, e) {
var n = t;
if (n && n.length) {
if (e) return n.css("padding-right", e + "pt"), "padding-right";
n[0].style.paddingRight = "";
}
return null;
}, t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('右内边距')}\n
\n
\n \n
\n
`), this.target;
}, t.prototype.getValue = function () {
var t = this.target.find("select").val();
if (t) return parseFloat(t.toString());
}, t.prototype.setValue = function (t) {
t && (this.target.find('option[value="' + t + '"]').length || this.target.find("select").prepend('"));
this.target.find("select").val(t);
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
ht = function () {
function t() {
this.name = "dataType";
}
return t.prototype.createTarget = function () {
var t = this;
return this.target = $(`\n
\n
\n
\n ${i18n.__('数据类型')}\n
\n
\n \n
\n
\n
\n
\n ${i18n.__('格式')}\n
\n
\n \n \n
\n
\n
\n`), $(this.target.find(".hiprint-option-item-datatype")).change(function () {
var e = $(t.target.find(".hiprint-option-item-datatype")).val();
t.loadFormatSelectByDataType(e), t.submit(t.getValue());
}), this.target;
}, t.prototype.getValue = function () {
var t = this.target.find(".hiprint-option-item-datatype").val();
if (t) {
var e = this.target.find(".hiprint-option-item-datatype-format").val();
return {
dataType: t,
format: e || void 0
};
}
return {
dataType: void 0,
format: void 0
};
}, t.prototype.setValue = function (t, e) {
this.target.find(".hiprint-option-item-datatype").val(e.dataType || ""), this.loadFormatSelectByDataType(e.dataType), this.target.find(".hiprint-option-item-datatype-format").val(e.format || "");
}, t.prototype.destroy = function () {
this.target.remove();
}, t.prototype.loadFormatSelectByDataType = function (t) {
"boolean" === t ? (this.target.find(".hiprint-option-item-datatype-select-format").removeClass("hiprint-option-item-datatype-format").hide().val(""), this.target.find(".hiprint-option-item-datatype-input-format").addClass("hiprint-option-item-datatype-format").show()) : "datetime" === t ? (this.target.find(".hiprint-option-item-datatype-select-format").addClass("hiprint-option-item-datatype-format").show(), this.target.find(".hiprint-option-item-datatype-input-format").removeClass("hiprint-option-item-datatype-format").hide().val(""), this.target.find(".hiprint-option-item-datatype-select-format").html(`\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n`)) : (this.target.find(".hiprint-option-item-datatype-select-format").show(), this.target.find(".hiprint-option-item-datatype-input-format").hide().val(""), this.target.find(".hiprint-option-item-datatype-format").html(`\n \n`));
}, t;
}(),
ft = function () {
function t() {
this.name = "formatter";
}
return t.prototype.createTarget = function () {
var t = `
\n
\n ${i18n.__('格式化函数')}\n
\n
\n \n
\n
`;
return this.target = $(t), this.target;
}, t.prototype.getValue = function () {
var t = this.target.find("textarea").val();
if (t) return t;
}, t.prototype.setValue = function (t) {
this.target.find("textarea").val(t ? t.toString() : null);
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
gt = function () {
function t() {
this.name = "styler";
}
return t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('样式函数')}\n
\n
\n \n
\n
`), this.target;
}, t.prototype.getValue = function () {
var t = this.target.find("textarea").val();
if (t) return t;
}, t.prototype.setValue = function (t) {
this.target.find("textarea").val(t ? t.toString() : null);
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
rowcolumns = function () {
function t() {
this.name = "rowsColumnsMerge";
}
return t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('行/列合并函数')}\n
\n
\n \n
\n
`), this.target;
}, t.prototype.getValue = function () {
var t = this.target.find("textarea").val();
if (t) return t;
}, t.prototype.setValue = function (t) {
this.target.find("textarea").val(t ? t.toString() : null);
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
rowsColumnsMergeClean = function () {
function t() {
this.name = "rowsColumnsMergeClean";
}
return t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('跨页合并是否清除')}\n
\n
\n \n
\n
`), this.target;
}, t.prototype.getValue = function () {
if ("true" == this.target.find("select").val()) return !0;
}, t.prototype.setValue = function (t) {
this.target.find("select").val((null == t ? "" : t).toString());
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
mt = function () {
function t() {
this.name = "footerFormatter";
}
return t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('表格脚函数')}\n
\n
\n \n
\n
`), this.target;
}, t.prototype.getValue = function () {
var t = this.target.find("textarea").val();
if (t) return t;
}, t.prototype.setValue = function (t) {
this.target.find("textarea").val(t ? t.toString() : null);
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
groupSequenceContinue = function () {
function t() {
this.name = "groupSequenceContinue";
}
return t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('分组序号续编')}\n
\n
\n \n
\n
`), this.target;
}, t.prototype.getValue = function () {
if ("true" == this.target.find("select").val()) return !0;
}, t.prototype.setValue = function (t) {
this.target.find("select").val((null == t ? "" : t).toString());
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
groupFieldsFormatter = function () {
function t() {
this.name = "groupFieldsFormatter";
}
return t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('分组字段函数')}\n
\n
\n \n
\n
`), this.target;
}, t.prototype.getValue = function () {
var t = this.target.find("textarea").val();
if (t) return t;
}, t.prototype.setValue = function (t) {
this.target.find("textarea").val(t ? t.toString() : null);
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
groupFormatter = function () {
function t() {
this.name = "groupFormatter";
}
return t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('分组头格式化函数')}\n
\n
\n \n
\n
`), this.target;
}, t.prototype.getValue = function () {
var t = this.target.find("textarea").val();
if (t) return t;
}, t.prototype.setValue = function (t) {
this.target.find("textarea").val(t ? t.toString() : null);
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
groupFooterFormatter = function () {
function t() {
this.name = "groupFooterFormatter";
}
return t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('分组脚格式化函数')}\n
\n
\n \n
\n
`), this.target;
}, t.prototype.getValue = function () {
var t = this.target.find("textarea").val();
if (t) return t;
}, t.prototype.setValue = function (t) {
this.target.find("textarea").val(t ? t.toString() : null);
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
vt = function () {
function t() {
this.name = "gridColumnsFooterFormatter";
}
return t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('多组表格脚函数')}\n
\n
\n \n
\n
`), this.target;
}, t.prototype.getValue = function () {
var t = this.target.find("textarea").val();
if (t) return t;
}, t.prototype.setValue = function (t) {
this.target.find("textarea").val(t ? t.toString() : null);
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
yt = function () {
function t() {
this.name = "rowStyler";
}
return t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('行样式函数')}\n
\n
\n \n
\n
`), this.target;
}, t.prototype.getValue = function () {
var t = this.target.find("textarea").val();
if (t) return t;
}, t.prototype.setValue = function (t) {
this.target.find("textarea").val(t ? t.toString() : null);
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
bt = function () {
function t() {
this.name = "align";
}
return t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('单元格左右对齐')}\n
\n
\n \n
\n
`), 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;
}(),
Et = function () {
function t() {
this.name = "vAlign";
}
return t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('单元格上下对齐')}\n
\n
\n \n
\n
`), 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;
}(),
Tt = function () {
function t() {
this.name = "halign";
}
return t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('表格头单元格左右对齐')}\n
\n
\n \n
\n
`), 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;
}(),
Pt = function () {
function t() {
this.name = "styler2";
}
return t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('单元格样式函数')}\n
\n
\n \n
\n
`), this.target;
}, t.prototype.getValue = function () {
var t = this.target.find("textarea").val();
if (t) return t;
}, t.prototype.setValue = function (t) {
this.target.find("textarea").val(t ? t.toString() : null);
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
stylerHeader = function () {
function t() {
this.name = "stylerHeader";
}
return t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('表格头样式函数')}\n
\n
\n \n
\n
`), this.target;
}, t.prototype.getValue = function () {
var t = this.target.find("textarea").val();
if (t) return t;
}, t.prototype.setValue = function (t) {
this.target.find("textarea").val(t ? t.toString() : null);
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
_t = function () {
function t() {
this.name = "formatter2";
}
return t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('单元格格式化函数')}\n
\n
\n \n
\n
`), this.target;
}, t.prototype.getValue = function () {
var t = this.target.find("textarea").val();
if (t) return t;
}, t.prototype.setValue = function (t) {
this.target.find("textarea").val(t ? t.toString() : null);
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
renderFormatter = function () {
function t() {
this.name = "renderFormatter";
}
return t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('单元格渲染函数')}\n
\n
\n \n
\n
`), this.target;
}, t.prototype.getValue = function () {
var t = this.target.find("textarea").val();
if (t) return t;
}, t.prototype.setValue = function (t) {
this.target.find("textarea").val(t ? t.toString() : null);
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
wt = function () {
function t() {
this.name = "autoCompletion";
}
return t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('自动补全')}\n
\n
\n \n
\n
`), this.target;
}, t.prototype.getValue = function () {
if ("true" == this.target.find("select").val()) return !0;
}, t.prototype.setValue = function (t) {
this.target.find("select").val((null == t ? "" : t).toString());
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
maxRows = function () {
function t() {
this.name = "maxRows";
}
return t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('每页最大行数')}\n
\n
\n \n
\n
`), this.target;
}, t.prototype.getValue = function () {
var t = this.target.find("input").val();
if (t) return parseInt(t.toString());
}, t.prototype.setValue = function (t) {
this.target.find("input").val(t);
}, t.prototype.destroy = function () {
this.target.remove();
}, t;
}(),
xt = function () {
function t() {
this.name = "tableFooterRepeat";
}
return t.prototype.createTarget = function () {
return this.target = $(`
\n
\n ${i18n.__('表格脚显示')}\n
\n
\n \n
\n
`), 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;
}();
n.d(e, "a", function () {
return Ct;
});
var Ct = function () {
function t() {
}
return t.init = function () {
t.printElementOptionItems || (t.printElementOptionItems = {}, t._printElementOptionItems.forEach(function (e) {
t.printElementOptionItems[e.name] = e;
}));
}, t.registerItem = function (e) {
if (!e.name) throw new Error("styleItem must have name");
t.init(), t.printElementOptionItems[e.name] = e;
}, t.getItem = function (e) {
return t.init(), t.printElementOptionItems[e];
}, t._printElementOptionItems = [new fontFamily(), new r(), new a(), new p(), new i(), new s(), new l(), new pt(), new u(), new d(), new c(), new h(), new f(), new g(), new m(), new d2(), new c2(), new v(), new y(), new b(), new E(), new qrCodeLevel(), new T(), new P(), new _(), new w(), new x(), new coordinate(), new widthHeight(), new C(), new imageFit(), new O(), new H(), new D(), new paperNumberContinue(), new watermarkOptions(), new I(), new R(), new pageBreak(), new M(), new M2(), new S(), new B(), new F(), new L(), new A(), new z(), new k(), new st(), new N(), new V(), new W(), new j(), new U(), new borderRadius(), new zIndex(), new K(), new G(), new q(), new X(), new Y(), new Q(), new J(), new Z(), new tt(), new et(), new nt(), new it(), new ot(),new textWrap(), new at(), new lt(), new panelLayoutOptions(), new ut(), new ith(), new dt(), new ct(), new ht(), new ft(), new gt(), new mt(), new rowcolumns(), new rowsColumnsMergeClean(), new groupSequenceContinue(), new groupFieldsFormatter(), new groupFormatter(), new groupFooterFormatter(), new vt(), new yt(), new bt(), new Tt(), new Et(), new Pt(), new stylerHeader(), new renderFormatter(), new _t(), new wt(), new maxRows(), new xt(), new tableColumnH(), new tableE(), new tableQRCodeLevel(), new tablept(), new tableSummaryTitle(), new tableSummaryText(), new tableSummaryColspan(), new tableSummary(), new tableSummaryAlign(), new tableSummaryNumFormat(), new tableSummaryFormatter(),new showCodeTitle(), new upperCase(), new barcodeType(), new qrcodeType(), new barColor(), new barTextMode(), new barWidth(), new barAutoWidth()], t;
}();
}, function (t, e, n) {
"use strict";
n.d(e, "a", function () {
return o;
}), n.d(e, "b", function () {
return r;
});
var i = n(14),
o = function () {
function t(t, e) {
this.selectedCells = [], this.rows = t, this.tableTatget = e;
}
return t.prototype.clear = function () {
this.tableTatget.find("td").removeClass("selected");
}, t.prototype.setSingleSelect = function (t) {
this.startCell = t, this.selectedCells = [];
}, t.prototype.getSingleSelect = function () {
if (this.selectedCells.length) {
if (1 == this.selectedCells.length) return 1 == this.selectedCells[0].length ? this.selectedCells[0][0] : void 0;
if (this.selectedCells.length > 1) return;
}
return this.startCell;
}, t.prototype.singleSelectByXY = function (t, e) {
var n = this.getCellByXY(t, e);
n && (this.clear(), n && (n.cell.select(), this.startCell = n, this.selectedCells = []));
}, t.prototype.multipleSelectByXY = function (t, e) {
this.clear();
var n = [];
if (this.startCell) {
var o = this.getCellByXY(t, e);
if (o) {
var r = i.a.mergeRect(this.startCell.cell.getTableRect(), o.cell.getTableRect());
this.selectByRect(new a(r), n);
}
}
this.selectedCells = n;
}, t.prototype.selectByRect = function (t, e) {
this.rows.forEach(function (n, i) {
var o = [];
n.columns.forEach(function (e) {
e.isInRect(t) && (o.push(new p(i, e)), e.select());
}), o.length && e.push(o);
}), t.changed && (t.changed = !1, e.splice(0, e.length), this.selectByRect(t, e));
}, t.prototype.getSelectedCells = function () {
return this.selectedCells;
}, t.prototype.getCellByXY = function (t, e) {
var n;
return this.rows.forEach(function (i, o) {
var r = (i.columns || []).filter(function (column) {return column.checked}).filter(function (n) {
return n.isXYinCell(t, e);
});
r.length && (n = new p(o, r[0]));
}), n;
}, t;
}(),
r = function () {
return function (t) {
this.x = t.x, this.y = t.y, this.height = t.height, this.width = t.width;
};
}(),
a = function () {
return function (t) {
this.rect = t;
};
}(),
p = function () {
return function (t, e) {
this.rowIndex = t, this.cell = e;
};
}();
}, function (t, e, n) {
"use strict";
n.d(e, "a", function () {
return i;
});
var i = function () {
function t() {
}
return t.createId = function () {
return this.id += 1, this.id;
}, t.id = 1, t;
}();
}, function (t, e, n) {
"use strict";
n.d(e, "a", function () {
return p;
});
var _i,
o = n(5),
r = n(13),
a = (_i = function i(t, e) {
return (_i = 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]);
}
})(t, e);
}, function (t, e) {
function n() {
this.constructor = t;
}
_i(t, e), t.prototype = null === e ? Object.create(e) : (n.prototype = e.prototype, new n());
}),
p = 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 o.a(t));
}) : e.columns && (e.columns || []).forEach(function (t) {
n.columns.push(new o.a(t));
});
return n;
}
return a(e, t), e.prototype.getPrintElementOptionEntity = function () {
var t = [];
var all = this.allColumns ? this.allColumns.filter(function (c) {return !c.checked}) : [];
return [...this.columns, ...all].forEach(function (e) {
t.push(e.getEntity());
}), t;
}, e;
}(r.a);
}, function (t, e, n) {
"use strict";
n.d(e, "a", function () {
return r;
});
var i = n(11),
o = n(5),
r = function () {
function t() {
this.id = i.a.createId();
}
return t.prototype.init = function (t, e, n) {
this.isHead = n, this.target = e || $("
"), this.tableOptions = t,
this.allColumns = (this.columns || []),
this.initCells((this.columns || []).filter(function (column) {return column.checked}));
}, t.prototype.getTarget = function () {
return this.target;
}, t.prototype.initCells = function (t) {
var e = this;
t ? (this.columns = t, t.forEach(function (t, n) {
t.init(e.target.find("td:eq(" + n + ")"), e.tableOptions, e.id, e.isHead);
})) : (this.columns = [], this.target.find("td").map(function (t, n) {
var i = new o.a();
i.init($(n), e.tableOptions, e.id, e.isHead), 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 o.a();
return n.init($("
"), this.tableOptions, this.id, this.isHead), 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.prototype.getPrintElementOptionEntity = function () {
var t = [];
return [...this.columns, ...this.allColumns.filter(function (c) {return !c.checked})].forEach(function (e) {
t.push(e.getEntity());
}), t;
}, t;
}();
}, function (t, e, n) {
"use strict";
n.d(e, "a", function () {
return o;
});
var i = n(10),
o = function () {
function t() {
}
return t.mergeRect = function (t, e) {
var n = Math.min(t.x, e.x),
o = Math.min(t.y, e.y);
return new i.b({
x: n,
y: o,
height: Math.max(t.y + t.height, e.y + e.height) - o,
width: Math.max(t.x + t.width, e.x + e.width) - n
});
}, t.Rect = function (t, e, n, i) {
return {
minX: t < n ? t : n,
minY: e < i ? e : i,
maxX: t < n ? n : t,
maxY: e < i ? i : e
};
}, t;
}();
}, function (module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.d(__webpack_exports__, "a", function () {
return TablePrintElement;
});
var _BasePrintElement__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4),
_HiPrintConfig__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1),
_dto_PaperHtmlResult__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6),
_assets_plugins_hinnn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(0),
_PrintReferenceElement__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8),
_option_TablePrintElementOption__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(18),
_table_TableExcelHelper__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(7),
_hitable_HiTale__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(16),
_table_GridColumnsStructure__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(20),
_HiPrintlib__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(2),
__extends = (_extendStatics = function extendStatics(t, e) {
return (_extendStatics = 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]);
}
})(t, e);
}, function (t, e) {
function n() {
this.constructor = t;
}
_extendStatics(t, e), t.prototype = null === e ? Object.create(e) : (n.prototype = e.prototype, new n());
}),
_extendStatics,
TablePrintElement = function (_super) {
function TablePrintElement(t, e) {
var n = _super.call(this, t) || this;
return n.gridColumnsFooterCss = "hiprint-gridColumnsFooter", n.tableGridRowCss = "table-grid-row", n.options = new _option_TablePrintElementOption__WEBPACK_IMPORTED_MODULE_5__.a(e, n.printElementType), n.options.setDefault(new _option_TablePrintElementOption__WEBPACK_IMPORTED_MODULE_5__.a(_HiPrintConfig__WEBPACK_IMPORTED_MODULE_1__.a.instance.table.default).getPrintElementOptionEntity()), n;
}
return __extends(TablePrintElement, _super), TablePrintElement.prototype.getColumns = function () {
return this.options.columns;
}, TablePrintElement.prototype.getColumnByColumnId = function (t) {
return this.options.getColumnByColumnId(t);
}, TablePrintElement.prototype.updateDesignViewFromOptions = function () {
if (this.designTarget) {
var t = this.designTarget.find(".hiprint-printElement-table-content"),
e = this.getHtml(this.designPaper);
t.html(""), t.append(e[0].target.find(".table-grid-row")), this.printElementType.editable && this.setHitable(), this.setColumnsOptions();
// 渲染完再处理样式 ==> fix 表脚边框参数设置问题
this.css(this.designTarget, this.getData());
}
}, TablePrintElement.prototype.css = function (t, e) {
if ((this.getField() || !this.options.content) && !this.printElementType.formatter) return _super.prototype.css.call(this, t, e);
}, TablePrintElement.prototype.getDesignTarget = function (t) {
return this.designTarget = this.getHtml(t)[0].target, this.css(this.designTarget, this.getData()), this.designPaper = t, 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;
}, TablePrintElement.prototype.getConfigOptions = function () {
return _HiPrintConfig__WEBPACK_IMPORTED_MODULE_1__.a.instance.table;
}, TablePrintElement.prototype.createTarget = function (t, e, n) {
for (var i = $('
'), o = this.createGridColumnsStructure(n), r = 0; r < o.gridColumns; r++) {
o.getByIndex(r).append(this.getTableHtml(e, n));
}
return i.find(".hiprint-printElement-table-content").append(o.target), i;
}, TablePrintElement.prototype.createGridColumnsStructure = function (t) {
for (var e = $(''), n = 0; n < this.options.getGridColumns(); n++) {
var i = $('');
e.append(i);
}
var o = this.getGridColumnsFooterFormatter();
if (o) {
var r = $('');
r.append(o(this.options, this.getData(t), t, [])), e.append(r);
}
return new _table_GridColumnsStructure__WEBPACK_IMPORTED_MODULE_8__.a(this.options.getGridColumns(), e);
}, TablePrintElement.prototype.createtempEmptyRowsTargetStructure = function (t) {
if (this.getField()) return this.createTarget(this.printElementType.title, []);
var e = this.createTarget(this.printElementType.title, []).clone();
return e.find(".hiprint-printElement-tableTarget tbody tr").remove(), e;
}, TablePrintElement.prototype.getTableHtml = function (t, e) {
var n, i;
if (!this.getField() && this.options.content) return (n = $("")).append(this.options.content), (i = n.find("table")).addClass("hiprint-printElement-tableTarget"), i;
if (this.printElementType.formatter) return (n = $("")).append(this.printElementType.formatter(t)), (i = n.find("table")).addClass("hiprint-printElement-tableTarget"), i;
var o = $('
');
let headerList = _table_TableExcelHelper__WEBPACK_IMPORTED_MODULE_6__.a.createTableHead(this.getColumns(), this.options.getWidth() / this.options.getGridColumns());
return (this.isNotDesign && ['first', 'none'].includes(this.options.tableHeaderRepeat)) ? o.append(headerList) : o.append(headerList[0]), o.append(_table_TableExcelHelper__WEBPACK_IMPORTED_MODULE_6__.a.createTableRow(this.getColumns(), t, e, this.options, this.printElementType)), "no" == this.options.tableFooterRepeat || _table_TableExcelHelper__WEBPACK_IMPORTED_MODULE_6__.a.createTableFooter(this.printElementType.columns, t, this.options, this.printElementType, e, t).insertBefore(o.find("tbody")), o;
}, TablePrintElement.prototype.getEmptyRowTarget = function () {
return _table_TableExcelHelper__WEBPACK_IMPORTED_MODULE_6__.a.createEmptyRowTarget(this.getColumns(), this);
}, TablePrintElement.prototype.getHtml = function (t, e) {
this.createTempContainer();
this.isNotDesign = e != void 0;
var n = this.getPaperHtmlResult(t, e);
return this.removeTempContainer(), n;
}, TablePrintElement.prototype.getPaperHtmlResult = function (t, e) {
var n = [],
i = this.getData(e),
o = this.getTableHtml(i, e),
r = this.createtempEmptyRowsTargetStructure(e);
e ? this.updateTargetWidth(r) : this.updateTargetSize(r), this.css(r, i), this.css(o, i), this.getTempContainer().html(""), this.getTempContainer().append(r);
// 页脚导致 分页高度的问题, -> 获取到表格脚高度后移除避免重复
var tfh = r.find('tfoot').outerHeight() || 0;
r.find('tfoot').remove();
for (var a, p = this.getBeginPrintTopInPaperByReferenceElement(t), s = 0, l = !1; !l;) {
var u = 0,
d = t.getPaperFooter(s);
0 == s && p > d && "none" != t.panelPageRule && (p = p - d + t.paperHeader, n.push(new _dto_PaperHtmlResult__WEBPACK_IMPORTED_MODULE_2__.a({
target: void 0,
printLine: void 0
})), u = t.getContentHeight(s) - (p - t.paperHeader), s++ , d = t.getPaperFooter(s));
var c = n.length > 0 ? n[n.length - 1].target : void 0,
h = this.getRowsInSpecificHeight(e, u > 0 ? u : 0 == s ? d - p : t.getContentHeight(s), r, o, s, c, tfh);
l = h.isEnd;
if (u < 0) {
n[0].target = $(`
${i18n.__('没有足够空间进行表格分页,请调整页眉/页脚线')}
`)
n[0].printLine = p;
n[0].referenceElement = new _PrintReferenceElement__WEBPACK_IMPORTED_MODULE_4__.a({
top: this.options.getTop(),
left: this.options.getLeft(),
height: this.options.getHeight(),
width: this.options.getWidth(),
beginPrintPaperIndex: t.index,
bottomInLastPaper: p + this.options.lHeight,
printTopInPaper: p
});
n[0].target.css("top", p + "pt");
n[0].target.css("left", this.options.displayLeft())
break;
}
var f = void 0;
h.target && (h.target.css("left", this.options.displayLeft()), h.target[0].height = "");
if (0 == s || u > 0) {
(h.target && (a = p, h.target.css("top", p + "pt")),
f = l && null != this.options.lHeight ? p + (h.height > this.options.lHeight ? h.height : this.options.lHeight) : p + h.height)
} else {
(h.target && (a = t.paperHeader, h.target.css("top", t.paperHeader + "pt")), f = t.paperHeader + h.height)
}
n.push(new _dto_PaperHtmlResult__WEBPACK_IMPORTED_MODULE_2__.a({
target: h.target,
printLine: f,
referenceElement: new _PrintReferenceElement__WEBPACK_IMPORTED_MODULE_4__.a({
top: this.options.getTop(),
left: this.options.getLeft(),
height: this.options.getHeight(),
width: this.options.getWidth(),
beginPrintPaperIndex: t.index,
bottomInLastPaper: f,
printTopInPaper: a
})
})), s++;
e && this.updatePanelHeight(f + this.options.getHeight(), t);
}
return n;
}, TablePrintElement.prototype.getRowsInSpecificHeight = function (t, e, n, i, o, r, tfh) {
var that = this;
var a = i.find("tbody"),
p = _assets_plugins_hinnn__WEBPACK_IMPORTED_MODULE_3__.a.pt.toPx(e);
n.find(".hiprint-printElement-tableTarget tbody").html("");
// 不是最后显示页脚
if ("last" != this.options.tableFooterRepeat) {
n.find(".hiprint-printElement-tableTarget tfoot").remove();
}
// 仅首页显示表头
if ("first" == this.options.tableHeaderRepeat && o > 0) {
n.find(".hiprint-printElement-tableTarget thead").remove();
} else if ("none" == this.options.tableHeaderRepeat) {
// 有数据(不是design)
if (t) {
n.find(".hiprint-printElement-tableTarget thead").remove();
} else {
n.find(".hiprint-printElement-tableTarget thead").css("background", "firebrick");
n.find(".hiprint-printElement-tableTarget thead tr").css("background", "firebrick");
}
}
var noPaging = "none" == this.panel.panelPageRule;
// 不分页, 且不是设计时, 移除 thead
var headTr;
if (t && noPaging) {
var headStyle = n.find(".hiprint-printElement-tableTarget thead").attr("style");
headTr = n.find(".hiprint-printElement-tableTarget thead tr").clone();
if (headStyle) {
headTr.attr("style", headStyle);
} else {
headTr.css({"background": "#e8e8e8"});
}
n.find(".hiprint-printElement-tableTarget thead").remove();
}
var s = n.outerHeight();
if (!noPaging && s > p) return {
target: void 0,
length: 0,
height: 0,
isEnd: !1
};
var getGridColumns = this.options.getGridColumns();
for (var l = [], u = 0; u < getGridColumns; u++) {
for (var d = n.find(".hiprint-printElement-tableTarget:eq(" + u + ")"), c = void 0, h = []; ;) {
// 不分页处理
if (noPaging) {
var trLen = a.find("tr").length;
if (0 == trLen) c = {
height: _assets_plugins_hinnn__WEBPACK_IMPORTED_MODULE_3__.a.px.toPt(s),
isEnd: !0
}, t && this.options.autoCompletion && (this.autoCompletion(p, d, tfh), s = n.outerHeight()); else {
var f = a.find("tr:lt(1)");
if (h.length == 0 && headTr) {
d.find("tbody").append(headTr);
}
d.find("tbody").append(f);
var g = f.data("rowData");
l.push(g), h.push(g), s = n.outerHeight();
0 == trLen && (a.prepend(f), l.pop(), h.pop(), c = {
height: _assets_plugins_hinnn__WEBPACK_IMPORTED_MODULE_3__.a.px.toPt(s),
isEnd: !1
})
}
} else {
if (s <= p) if (0 == a.find("tr").length) c = {
height: _assets_plugins_hinnn__WEBPACK_IMPORTED_MODULE_3__.a.px.toPt(s),
isEnd: !0
}, t && this.options.autoCompletion && (this.autoCompletion(p, d, tfh), s = d.outerHeight()); else {
var f = a.find("tr:lt(1)");
if (that.options.rowsColumnsMerge && (o > 0 || u > 0) && h.length == 0) {
f = that.fixMergeSpan(f, a);
}
d.find("tbody").append(f);
var g = f.data("rowData");
l.push(g), h.push(g), (((s = d.outerHeight(), "last" == this.options.tableFooterRepeat ? s : s += tfh) > p) || (this.options.maxRows && h.length > +this.options.maxRows)) && (a.prepend(f), l.pop(), h.pop(), s = d.outerHeight(), c = {
height: _assets_plugins_hinnn__WEBPACK_IMPORTED_MODULE_3__.a.px.toPt(s),
isEnd: !1
});
}
}
if (c) {
// 这里是table 没有tfoot, 后面再看什么原因...
if ("last" == this.options.tableFooterRepeat && !c.isEnd) break;
if ("no" !== this.options.tableFooterRepeat) {
if (noPaging) {
d.find("tbody").append(_table_TableExcelHelper__WEBPACK_IMPORTED_MODULE_6__.a.createTableFooter(this.printElementType.columns, this.getData(t), this.options, this.printElementType, t, h, o).children())
} else {
_table_TableExcelHelper__WEBPACK_IMPORTED_MODULE_6__.a.createTableFooter(this.printElementType.columns, this.getData(t), this.options, this.printElementType, t, h, o).insertBefore(d.find("tbody"));
}
that.css(d, t);
}
break;
}
}
}
var m = n.find(".hiprint-printElement-tableTarget tbody tr").length,
v = this.getGridColumnsFooterFormatter();
v && n.find(this.gridColumnsFooterCss).html(v(this.options, this.getData(t), t, l));
s = n.outerHeight();
// 当每一页数据,都无法容纳表格行内容时:
let curRow = a.find("tr:lt(1)");
if (m == 0 && curRow.length && g == curRow.data("rowData")) {
d.find("tbody").append(curRow);
let height = d.find("tbody tr").outerHeight();
a.prepend(curRow);
return {
target: $(`
${i18n.__('没有足够空间,显示下方内容, 可分页高度')}: `+ p +`px < ${i18n.__('当前需要高度')}: `+ height +'px
').append(curRow.css("background", "blue")),
length: m,
height: _assets_plugins_hinnn__WEBPACK_IMPORTED_MODULE_3__.a.px.toPt(s),
isEnd: !1
}
}
// 方便调试看 值...
var zz = 0 == a.find("tr").length ? 0 == m && r ? {
target: void 0,
length: 0,
height: 0,
isEnd: !0
} : {
target: n.clone(),
length: m,
height: _assets_plugins_hinnn__WEBPACK_IMPORTED_MODULE_3__.a.px.toPt(s),
isEnd: !0
} : {
target: n.clone(),
length: m,
height: _assets_plugins_hinnn__WEBPACK_IMPORTED_MODULE_3__.a.px.toPt(s),
isEnd: !1
};
return zz;
}, TablePrintElement.prototype.fixMergeSpan = function (tr, tbody) {
const nextRowMap = new Map();
tr.children().each((_, td) => {
var field = $(td).attr('field');
nextRowMap.set(field, {
rowSpan: 1,
rowEnd: false
})
tr.nextAll().each((_, nextTr) => {
if ($(nextTr).has(`td[field=${field}][rowspan=0]`).length && !nextRowMap.get(field).rowEnd) {
nextRowMap.set(field, { rowSpan: ++nextRowMap.get(field).rowSpan, rowEnd: false })
} else {
nextRowMap.set(field, { ...nextRowMap.get(field), rowEnd: true })
}
})
if ($(td).attr("rowspan") < 1) {
$(td).attr("rowspan", nextRowMap.get(field).rowSpan);
$(td).css("display", "");
if (this.options.rowsColumnsMergeClean) {
$(td).text("")
}
}
})
return tr;
}, TablePrintElement.prototype.autoCompletion = function (t, e, tfh) {
var that = this;
for (var n, i = this.getEmptyRowTarget(), o = e.outerHeight() + tfh; t > o;) {
n = i.clone(), e.find("tbody").append(n), o = e.outerHeight() + tfh;
if (that.options.maxRows && e.find("tbody").children().length > that.options.maxRows) {
break;
}
}
n && n.remove();
}, TablePrintElement.prototype.getData = function (t) {
if (!t) {
// 设计时表格 测试数据
try {
let testData = this.options.testData || '[{}]';
return JSON.parse(testData);
} catch (e) {
console.log('table testData parse error', e);
return [{}];
}
};
var f = this.getField();
var e = f ? f.split('.').reduce((a, c) => a ? a[c] : t ? t[c] : "", !1) || "" : "";
return e ? JSON.parse(JSON.stringify(e)) : [];
}, TablePrintElement.prototype.onResize = function (t, e, n, i, o) {
_super.prototype.updateSizeAndPositionOptions.call(this, o, i, n, e), _table_TableExcelHelper__WEBPACK_IMPORTED_MODULE_6__.a.resizeTableCellWidth(this.designTarget, this.getColumns(), this.options.getWidth());
}, TablePrintElement.prototype.getReizeableShowPoints = function () {
return ["s", "e"];
}, TablePrintElement.prototype.design = function (t, e) {
var n = this;
this.designTarget.hidraggable({
handle: this.designTarget.find(".hiprint-printElement-table-handle"),
axis: n.options.axis ? n.options.axis : void 0,
designTarget: n,
onDrag: function onDrag(t, i, o) {
n.updateSizeAndPositionOptions(i, o), n.createLineOfPosition(e);
_HiPrintlib__WEBPACK_IMPORTED_MODULE_9__.a.instance.changed = !0;
},
moveUnit: "pt",
minMove: _HiPrintConfig__WEBPACK_IMPORTED_MODULE_1__.a.instance.movingDistance,
onBeforeDrag: function onBeforeDrag(t) {
_HiPrintlib__WEBPACK_IMPORTED_MODULE_9__.a.instance.draging = !0, n.createLineOfPosition(e);
},
getScale: function getScale() {
return n.designPaper.scale || 1;
},
onStopDrag: function onStopDrag(t) {
if (_HiPrintlib__WEBPACK_IMPORTED_MODULE_9__.a.instance.changed) _assets_plugins_hinnn__WEBPACK_IMPORTED_MODULE_3__.a.event.trigger("hiprintTemplateDataChanged_" + n.templateId, "移动");
_HiPrintlib__WEBPACK_IMPORTED_MODULE_9__.a.instance.draging = !1,
_HiPrintlib__WEBPACK_IMPORTED_MODULE_9__.a.instance.changed = !1,
n.removeLineOfPosition();
}
}), this.printElementType.editable && this.setHitable(), this.setColumnsOptions(), this.designTarget.hireizeable({
showPoints: n.getReizeableShowPoints(),
// 是否显示宽高box
showSizeBox: _HiPrintConfig__WEBPACK_IMPORTED_MODULE_1__.a.instance.showSizeBox,
noContainer: !0,
onBeforeResize: function onBeforeResize() {
_HiPrintlib__WEBPACK_IMPORTED_MODULE_9__.a.instance.draging = !0;
},
getScale: function getScale() {
return n.designPaper.scale || 1
},
onResize: function onResize(t, i, o, r, a) {
n.onResize(t, i, o, r, a), n.hitable && n.hitable.updateColumnGrips(), n.createLineOfPosition(e);
},
onStopResize: function onStopResize(r) {
_assets_plugins_hinnn__WEBPACK_IMPORTED_MODULE_3__.a.event.trigger("hiprintTemplateDataChanged_" + n.templateId, r ? "旋转" : "大小");
_HiPrintlib__WEBPACK_IMPORTED_MODULE_9__.a.instance.draging = !1, n.removeLineOfPosition();
}
}), this.bingKeyboardMoveEvent(this.designTarget, e);
}, TablePrintElement.prototype.setHitable = function () {
var t = this;
this.hitable = new _hitable_HiTale__WEBPACK_IMPORTED_MODULE_7__.a({
templateId: t.templateId,
table: this.designTarget.find(".hiprint-printElement-tableTarget:eq(0)"),
rows: this.getColumns(),
resizeRow: !1,
resizeColumn: !0,
fields: this.options.fields,
trs: this.designTarget.find(".hiprint-printElement-tableTarget:eq(0)").find("tbody tr"),
handle: this.designTarget.find(".hiprint-printElement-tableTarget:eq(0)").find("thead"),
isEnableEdit: this.printElementType.editable ? this.printElementType.editable : !0,
columnDisplayEditable: this.printElementType.columnDisplayEditable != undefined ? this.printElementType.columnDisplayEditable : !0,
columnDisplayIndexEditable: this.printElementType.columnDisplayIndexEditable != undefined ? this.printElementType.columnDisplayIndexEditable : !0,
columnResizable: this.printElementType.columnResizable != undefined ? this.printElementType.columnResizable : !0,
columnAlignEditable: this.printElementType.columnAlignEditable != undefined ? this.printElementType.columnAlignEditable : !0,
isEnableEditText: this.printElementType.columnTitleEditable != undefined ? this.printElementType.columnTitleEditable : !0,
isEnableEditField: this.printElementType.isEnableEditField != undefined ? this.printElementType.isEnableEditField : !0,
isEnableContextMenu: this.printElementType.isEnableContextMenu != undefined ? this.printElementType.isEnableContextMenu : !0,
isEnableInsertRow: this.printElementType.isEnableInsertRow != undefined ? this.printElementType.isEnableInsertRow : !0,
isEnableDeleteRow: this.printElementType.isEnableDeleteRow != undefined ? this.printElementType.isEnableDeleteRow : !0,
isEnableInsertColumn: this.printElementType.isEnableInsertColumn != undefined ? this.printElementType.isEnableInsertColumn : !0,
isEnableDeleteColumn: this.printElementType.isEnableDeleteColumn != undefined ? this.printElementType.isEnableDeleteColumn : !0,
isEnableMergeCell: this.printElementType.isEnableMergeCell != undefined ? this.printElementType.isEnableMergeCell : !0
}), _assets_plugins_hinnn__WEBPACK_IMPORTED_MODULE_3__.a.event.on("updateTable" + this.hitable.id, function () {
t.updateDesignViewFromOptions();
_assets_plugins_hinnn__WEBPACK_IMPORTED_MODULE_3__.a.event.trigger("hiprintTemplateDataChanged_" + t.templateId, "调整表头");
});
}, TablePrintElement.prototype.setColumnsOptions = function () {
var t = this;
this.designTarget.find(".hiprint-printElement-tableTarget:eq(0)").find("thead td").bind("click.hiprint", function (e) {
var n = $(e.target).attr("id") || $(e.target).attr("column-id"),
i = t.getColumnByColumnId(n);
if (i) {
var o = t.getPrintElementOptionItemsByName("tableColumn");
_assets_plugins_hinnn__WEBPACK_IMPORTED_MODULE_3__.a.event.trigger(t.getPrintElementSelectEventKey(), {
printElement: t,
customOptionsInput: [{
title: (i.title || `${i.id}(id)`) + `-${i18n.__('列属性')}`,
optionItems: o,
options: i,
callback: function callback(t) {
o.forEach(function (t) {
var e = t.getValue();
if ("title" == t.name && e && !e.trim().endsWith("#") && !e.trim().startsWith("#")) {
var n = e ? e.split("#") : "";
i.title = n[0], n.length > 1 && (i.columnId = i.field = n[1]);
i.columnId && i.target.attr("column-id", i.columnId);
t.target.find("textarea").val(n[0]);
return;
}
i[t.name] = e;
});
}
}]
});
} else _assets_plugins_hinnn__WEBPACK_IMPORTED_MODULE_3__.a.event.trigger(t.getPrintElementSelectEventKey(), {
printElement: t
});
});
}, TablePrintElement.prototype.filterOptionItems = function (t) {
var e = _super.prototype.filterOptionItems.call(this, t);
return this.printElementType.editable && 1 == this.options.columns.length ? e : t.filter(function (t) {
return "columns" != t.name;
});
}, TablePrintElement.prototype.getFooterFormatter = function () {
var footerFormatter = void 0;
if (this.printElementType.footerFormatter && (footerFormatter = this.printElementType.footerFormatter), this.options.footerFormatter) try {
var s = "footerFormatter=" + this.options.footerFormatter;
eval(s);
} catch (t) {
console.log(t);
}
return footerFormatter;
}, TablePrintElement.prototype.getGridColumnsFooterFormatter = function () {
var gridColumnsFooterFormatter = void 0;
if (this.printElementType.gridColumnsFooterFormatter && (gridColumnsFooterFormatter = this.printElementType.gridColumnsFooterFormatter), this.options.gridColumnsFooterFormatter) try {
var s = "gridColumnsFooterFormatter=" + this.options.gridColumnsFooterFormatter;
eval(s);
} catch (t) {
console.log(t);
}
return gridColumnsFooterFormatter;
}, TablePrintElement;
}(_BasePrintElement__WEBPACK_IMPORTED_MODULE_0__.a);
}, function (t, e, n) {
"use strict";
var i = function () {
return function (t) {
this.table = t.table, this.templateId = t.templateId, this.fields = t.fields, this.isEnableEdit = t.isEnableEdit, this.trs = t.trs, this.resizeRow = t.resizeRow, this.resizeColumn = t.resizeColumn, this.isEnableEditField = t.isEnableEditField, this.isEnableContextMenu = t.isEnableContextMenu, this.isEnableEditField = t.isEnableEditField, this.isEnableInsertRow = t.isEnableInsertRow, this.isEnableDeleteRow = t.isEnableDeleteRow, this.isEnableInsertColumn = t.isEnableInsertColumn, this.isEnableDeleteColumn = t.isEnableDeleteColumn, this.isEnableMergeCell = t.isEnableMergeCell, this.columnResizable = t.columnResizable, this.columnAlignEditable = t.columnAlignEditable;
};
}(),
o = function () {
function t(t) {
this.options = new i(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;
}(),
r = n(0),
a = 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;
};
}(),
p = n(10),
s = 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;
}(),
l = n(13),
u = n(11),
d = function () {
return function (t, e) {
this.target = t, this.grips = e;
};
}(),
c = function () {
return function (t) {
this.target = t;
};
}(),
h = function () {
return function () {
this.rowColumns = [];
};
}(),
f = 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 h(), 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;
}(),
g = n(2),
m = 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 () {
f.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 || []).filter(function (column) {return column.checked}).forEach(function (o, a) {
if (o.getTarget().attr("haswidth")) {
var p = $('
');
i.append(p);
var s = new c(p);
n.length > 0 && (n[n.length - 1].nextGrip = s), n.push(s), t.syncGrips(o, s), $(p).hidraggable({
axis: "h",
onDrag: function onDrag(t, e, n) {
},
moveUnit: "pt",
minMove: 1,
getScale: function getScale() {
return ($('.hiprint-printPaper')[0].style.transform && parseFloat($('.hiprint-printPaper')[0].style.transform.slice(6, -1))) || 1;
},
onBeforeDrag: function onBeforeDrag(t) {
if (g.a.instance.draging = !0, !s.nextGrip) return !1;
e.dragingGrip = s, e.dragingGrip.left = parseFloat(e.dragingGrip.target.css("left").replace("px", "")), s.target.addClass("columngripDraging");
},
onStopDrag: function onStopDrag(n) {
g.a.instance.draging = !1;
var i = parseFloat(e.dragingGrip.target.css("left").replace("px", "")),
o = r.a.px.toPt(i - e.dragingGrip.left);
// 表格列宽限制 最小宽度为10pt
if (s.cell.width + o < 10) {
o = 10 - s.cell.width
} else if (s.nextGrip.cell.width - o < 10) {
o = s.nextGrip.cell.width - 10
}
s.cell.width = s.cell.width + o, s.nextGrip.cell.width = s.nextGrip.cell.width - o, t.resizeTableCellWidth(), s.target.removeClass("columngripDraging"), e.updateColumnGrips();
}
});
}
});
}), this.target.before(i), this.cgripContariner = new d(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, a) {
var p = $('
');
i.append(p);
var s = new c(p);
n.push(s), a > 0 && a < t.rows.length && $(p).hidraggable({
axis: "v",
onDrag: function onDrag(t, e, n) {
},
moveUnit: "pt",
minMove: 1,
onBeforeDrag: function onBeforeDrag(t) {
e.dragingGrip = s, e.dragingGrip.top = parseFloat(e.dragingGrip.target.css("top").replace("px", "")), s.target.addClass("rowgripDraging");
},
onStopDrag: function onStopDrag(t) {
var n = parseFloat(e.dragingGrip.target.css("top").replace("px", "")),
i = r.a.px.toPt(n - e.dragingGrip.top + e.rows[a].columns[0].getTarget().height());
e.rows[a].columns[0].getTarget().css("height", i + "pt"), e.syncRowGrips(), s.target.removeClass("rowgripDraging");
}
});
}), this.target.before(i), this.rgripContariner = new d(i, n), this.syncRowGrips();
}, t.prototype.syncGrips = function (t, e) {
var n = t.getTarget();
var scale = ($('.hiprint-printPaper')[0].style.transform && parseFloat($('.hiprint-printPaper')[0].style.transform.slice(6, -1))) || 1;
e.cell = t, e.target.css({
left: (n.offset().left / scale) - (this.target.offset().left / scale) + 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;
}(),
v = function () {
function t() {
}
return t.prototype.init = function () {
}, t.prototype.updateRowGrips = function () {
}, t.prototype.updateColumnGrips = function () {
}, t;
}();
n.d(e, "a", function () {
return y;
});
var y = function () {
function t(t) {
this.id = u.a.createId(), this.optionsCoat = new o(t), this.handle = t.handle, this.target = t.table, this.initRows(t.rows), this.init(t), this.tableCellSelector = new p.a(this.rows, this.target), this.resizer = this.optionsCoat.options.columnResizable ? new m(this) : new v(), this.resizer.init();
}
return t.prototype.insertRow = function (t, e, n) {
var i = e || this.tableCellSelector.getSingleSelect(),
o = i.cell,
a = this.rows[i.rowIndex],
p = i.rowIndex,
s = this.getCellGrid(),
u = new l.a();
if (u.init(this.optionsCoat, void 0, a.isHead), n && u.getTarget().addClass(n), "above" == t) s[p].forEach(function (t) {
var e = t.link ? t.link : t.cell,
n = e.width / e.colspan;
if (0 == t.columnLevel) {
var i = u.createTableCell();
i.width = n, u.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(p, 0, u), a.getTarget().before(u.getTarget()), r.a.event.trigger("newRow" + this.id, u); else {
var d = p + o.rowspan - 1;
s[d].forEach(function (t) {
var e = t.link ? t.link : t.cell,
n = e.width / e.colspan;
if (t.bottom) {
var i = u.createTableCell();
i.width = n, u.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(d + 1, 0, u), this.rows[d].getTarget().after(u.getTarget()), r.a.event.trigger("newRow" + this.id, u);
}
}, t.prototype.insertColumn = function (t, e, n, i) {
var o = this,
a = this.rows.concat(this.trRows),
p = e || this.tableCellSelector.getSingleSelect(),
s = p.cell,
l = p.rowIndex,
u = this.getCellGrid(a),
d = u[l].filter(function (t) {
return t.cell && t.cell.id == s.id || t.link && t.link.id == s.id;
});
if ("left" == t) {
var c = d[0].indexInTableGridRow;
u.forEach(function (t, e) {
var p = t[c],
s = t.filter(function (t, e) {
return e >= c && t.cell;
});
if (0 == p.rowLevel) {
var l = a[e],
u = a[e].createTableCell();
n && u.getTarget().addClass(n), null != i && (u.width = i), s.length ? l.insertToTargetCellLeft(s[0].cell, u) : l.insertCellToLast(u), r.a.event.trigger("newCell" + o.id, u);
} else if ("row" == p.linkType) {
var d = p.link.getTarget();
p.link.colspan += 1, d.attr("colspan", p.link.colspan);
}
});
} else {
var h = d[d.length - 1].indexInTableGridRow;
u.forEach(function (t, e) {
var p = t[h],
s = t.filter(function (t, e) {
return e <= h && t.cell;
});
if (p.rightMost) {
var l = a[e],
u = l.createTableCell();
n && u.getTarget().addClass(n), null != i && (u.width = i), s.length ? l.insertToTargetCellRight(s[s.length - 1].cell, u) : l.insertCellToFirst(u), r.a.event.trigger("newCell" + o.id, u);
} else {
var d = p.link || p.cell;
if ("row" == p.linkType) {
var c = d.getTarget();
d.colspan += 1, c.attr("colspan", d.colspan);
}
if (p.cell) {
c = d.getTarget();
d.colspan += 1, c.attr("colspan", d.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 = s.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 : s.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 + ")"), !0);
});
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 l.a();
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 p = 0, s = !1; p < n && !s;) {
if (i[e] = i[e] || [], i[e][p]) ; else {
i[e][p] = new a({
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: p,
indexInTableGridColumn: e
});
for (var l = e + 1, u = 1; u < t.rowspan; u++) {
i[l] = i[l] || [], i[l][p] = new a({
cell: void 0,
link: t,
linkType: r > 0 ? "rowColumn" : "column",
rightMost: r == t.colspan - 1 || void 0,
bottom: u == t.rowspan - 1,
rowLevel: r,
columnLevel: u,
indexInTableGridRow: p,
indexInTableGridColumn: l
}), l += 1;
}
s = !0;
}
p++;
}
}
});
}), i;
}, t.prototype.setAlign = function (t) {
var e = this.tableCellSelector.getSingleSelect();
e && e.cell.setAlign(t);
}, t.prototype.setVAlign = function (t) {
var e = this.tableCellSelector.getSingleSelect();
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;
if (!this.optionsCoat.options.isEnableContextMenu) return !1;
$(this.handle).hicontextMenu({
menus: [{
text: `${i18n.__('在上方插入行')}`,
enabled: this.optionsCoat.options.isEnableInsertRow,
disable: function disable() {
return !t.tableCellSelector.getSingleSelect();
},
callback: function callback() {
t.insertRow("above"), t.resizer.updateRowGrips(), r.a.event.trigger("updateTable" + t.id);
}
}, {
text: `${i18n.__('在下方插入行')}`,
borderBottom: !0,
enabled: this.optionsCoat.options.isEnableInsertRow,
disable: function disable() {
return !t.tableCellSelector.getSingleSelect();
},
callback: function callback() {
t.insertRow("below"), t.resizer.updateRowGrips(), r.a.event.trigger("updateTable" + t.id);
}
}, {
text: `${i18n.__('向左方插入列')}`,
enabled: this.optionsCoat.options.isEnableInsertColumn,
disable: function disable() {
return !t.tableCellSelector.getSingleSelect();
},
callback: function callback() {
t.insertColumn("left"), t.resizer.updateColumnGrips(), r.a.event.trigger("updateTable" + t.id);
}
}, {
text: `${i18n.__('向右方插入列')}`,
enabled: this.optionsCoat.options.isEnableInsertColumn,
disable: function disable() {
return !t.tableCellSelector.getSingleSelect();
},
borderBottom: !0,
callback: function callback() {
t.insertColumn("right"), t.resizer.updateColumnGrips(), r.a.event.trigger("updateTable" + t.id);
}
}, {
text: `${i18n.__('删除行')}`,
enabled: this.optionsCoat.options.isEnableDeleteRow,
disable: function disable() {
return !t.tableCellSelector.getSingleSelect() || t.rows.length <= 1;
},
callback: function callback() {
t.deleteRow(), t.resizer.updateRowGrips(), r.a.event.trigger("updateTable" + t.id);
}
}, {
text: `${i18n.__('删除列')}`,
borderBottom: !0,
enabled: this.optionsCoat.options.isEnableDeleteColumn,
disable: function disable() {
return !t.tableCellSelector.getSingleSelect() || (t.rows.length > 0 && t.rows[0].columns.length <= 1);
},
callback: function callback() {
t.deleteColums(), t.resizer.updateColumnGrips(), r.a.event.trigger("updateTable" + t.id);
}
}, {
text: `${i18n.__('对齐')}`,
borderBottom: !0,
enabled: this.optionsCoat.options.columnAlignEditable,
menus: [{
text: `${i18n.__('左')}`,
callback: function callback() {
t.setAlign("left");
}
}, {
text: `${i18n.__('左右居中')}`,
callback: function callback() {
t.setAlign("center");
}
}, {
text: `${i18n.__('右')}`,
callback: function callback() {
t.setAlign("right");
}
}, {
text: `${i18n.__('默认')}`,
borderBottom: !0,
callback: function callback() {
t.setAlign("");
}
}, {
text: `${i18n.__('上')}`,
callback: function callback() {
t.setVAlign("top");
}
}, {
text: `${i18n.__('垂直居中')}`,
callback: function callback() {
t.setVAlign("middle");
}
}, {
text: `${i18n.__('下')}`,
callback: function callback() {
t.setVAlign("bottom");
}
}, {
text: `${i18n.__('默认')}`,
callback: function callback() {
t.setVAlign("");
}
}]
}, {
text: `${i18n.__('合并单元格')}`,
enabled: this.optionsCoat.options.isEnableMergeCell,
disable: function disable() {
return t.tableCellSelector.getSingleSelect();
},
callback: function callback() {
t.mergeCell(), r.a.event.trigger("updateTable" + t.id);
}
}, {
text: `${i18n.__('解开单元格')}`,
enabled: this.optionsCoat.options.isEnableMergeCell,
disable: function disable() {
var e = t.tableCellSelector.getSingleSelect();
return !e || 1 == e.cell.rowspan && 1 == e.cell.colspan;
},
callback: function callback() {
t.splitCell(), r.a.event.trigger("updateTable" + t.id);
}
}].filter(function (t) {
return t.enabled;
})
});
}, t.prototype.getTableWidth = function () {
return r.a.px.toPt(this.target.outerWidth(!1));
}, t.prototype.updateColumnGrips = function () {
this.resizer.updateColumnGrips();
}, t.prototype.updateRowGrips = function () {
this.resizer.updateRowGrips();
}, t;
}();
}, function (t, e, n) {
"use strict";
n.d(e, "a", function () {
return i;
});
var i = function () {
return function (t, e, n) {
this.tid = t, this.options = e, this.printElementType = n;
};
}();
}, function (t, e, n) {
"use strict";
var i = n(3),
o = n(12),
r = (function () {
}(), function () {
return function (t) {
this.width = t.width, this.title = t.title, this.field = t.field, this.checked = t.checked, this.columnId = t.columnId, this.fixed = !1, this.rowspan = t.rowspan || 1, this.colspan = t.colspan || 1, this.align = t.align, this.halign = t.halign, this.vAlign = t.vAlign, this.renderFormatter = t.renderFormatter, this.formatter2 = t.formatter2, this.styler2 = t.styler2, this.stylerHeader = t.stylerHeader, this.tableColumnHeight = t.tableColumnHeight, this.tableTextType = t.tableTextType, this.tableBarcodeMode = t.tableBarcodeMode, this.tableQRCodeLevel = t.tableQRCodeLevel, this.tableSummaryTitle = t.tableSummaryTitle, this.tableSummaryText = t.tableSummaryText, this.tableSummaryColspan = t.tableSummaryColspan, this.tableSummary = t.tableSummary, this.tableSummaryAlign = t.tableSummaryAlign, this.tableSummaryNumFormat = t.tableSummaryNumFormat, this.tableSummaryFormatter = t.tableSummaryFormatter, this.showCodeTitle = t.showCodeTitle, this.upperCase = t.upperCase;
};
}()),
a = n(5);
n.d(e, "a", function () {
return l;
});
var _p,
s = (_p = function p(t, e) {
return (_p = 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]);
}
})(t, e);
}, function (t, e) {
function n() {
this.constructor = t;
}
_p(t, e), t.prototype = null === e ? Object.create(e) : (n.prototype = e.prototype, new n());
}),
l = function (t) {
function e(e, n) {
var i = this;
(e = e || {}, (i = t.call(this, e) || this).lHeight = e.lHeight, i.autoCompletion = e.autoCompletion, i.tableFooterRepeat = e.tableFooterRepeat, n) && (i.columns = [], n.editable && e.columns && e.columns.length ? e.columns.forEach(function (t) {
var e = [];
t.forEach(function (t) {
var i = new r(t),
o = n.getColumnByColumnId(i.columnId),
p = o ? $.extend(o, i) : new a.a(i);
e.push(p);
}), i.columns.push(new o.a(e));
}) : n.columns.forEach(function (t) {
i.columns.push(new o.a(t));
}));
return i;
}
return s(e, t), e.prototype.getColumnByColumnId = function (t) {
return this.makeColumnObj()[t];
}, e.prototype.makeColumnObj = function () {
var t = {};
return this.columns && this.columns.forEach(function (e) {
e.columns.forEach(function (e) {
(e.id || e.columnId) && (t[e.id || e.columnId] = e);
});
}), t;
}, e.prototype.getGridColumns = function () {
return this.gridColumns || 1;
}, e.prototype.getPrintElementOptionEntity = function () {
var e = t.prototype.getPrintElementOptionEntity.call(this);
e.fields = this.fields;
return this.columns && (e.columns = [], this.columns.forEach(function (t) {
var n = t.getPrintElementOptionEntity().map(function (t) {
return new r(t);
});
e.columns.push(n);
})), e;
}, e;
}(i.a);
}, function (t, e, n) {
"use strict";
n.d(e, "a", function () {
return i;
});
var i = function () {
return function () {
this.rowColumns = [];
};
}();
}, function (t, e, n) {
"use strict";
n.d(e, "a", function () {
return i;
});
var i = function () {
function t(t, e) {
this.gridColumns = t, this.target = e;
}
return t.prototype.getByIndex = function (t) {
return this.target.find(".hi-grid-col:eq(" + t + ")");
}, t;
}();
}, function (t, e, n) {
t.exports = n(33);
}, function (t, e) {
!function (t) {
function e(e) {
var n = t.data(e.data.target, "hidraggable"),
i = n.options,
o = n.proxy,
r = e.data,
a = r.startLeft + (e.pageX - r.startX) / (n.options.getScale() || 1),
p = r.startTop + (e.pageY - r.startY) / (n.options.getScale() || 1);
o && (o.parent()[0] == document.body ? (a = null != i.deltaX && null != i.deltaX ? e.pageX + i.deltaX : e.pageX - e.data.offsetWidth, p = null != i.deltaY && null != i.deltaY ? e.pageY + i.deltaY : e.pageY - e.data.offsetHeight) : (null != i.deltaX && null != i.deltaX && (a += e.data.offsetWidth + i.deltaX), null != i.deltaY && null != i.deltaY && (p += e.data.offsetHeight + i.deltaY))),
e.data.parent != document.body && (a += t(e.data.parent).scrollLeft(), p += t(e.data.parent).scrollTop()),
"h" == i.axis ? r.left = a : "v" == i.axis ? r.top = p : (e.shiftKey && e.altKey ? r.top = p : e.shiftKey ? r.left = a : (r.left = a, r.top = p));
}
function n(e) {
var n = t.data(e.data.target, "hidraggable"),
i = n.options,
o = n.proxy;
o || (o = t(e.data.target)), o.css({
left: t.fn.dragLengthC(e.data.left, i),
top: t.fn.dragLengthC(e.data.top, i)
}), t("body").css("cursor", i.cursor);
}
function i(i) {
t.fn.hidraggable.isDragging = !0;
var o = t.data(i.data.target, "hidraggable"),
r = o.options,
a = t(".hidroppable").filter(function () {
return i.data.target != this;
}).filter(function () {
var e = t.data(this, "hidroppable").options.accept;
return !e || t(e).filter(function () {
return this == i.data.target;
}).length > 0;
});
o.hidroppables = a;
var p = o.proxy;
return p || (r.proxy ? (p = "clone" == r.proxy ? t(i.data.target).clone().insertAfter(i.data.target) : r.proxy.call(i.data.target, i.data.target), o.proxy = p) : p = t(i.data.target)), p.css("position", "absolute"), e(i), n(i), r.onStartDrag.call(i.data.target, i), !1;
}
function createVerLine(op, cp, t, tt, h, pc) {
if (Math.abs(op[t] - cp[tt]) <= HIPRINT_CONFIG.adsorbLineMin) {
if (op.v.length) {
op.v.css("left", op[t] + "pt");
} else {
op.v = $("")
op.v.css("height", h + "pt");
op.v.css("left", op[t] + "pt");
pc.append(op.v);
}
} else {
op.v && op.v.remove();
}
}
function removeVerLine(op) {
if (op) op.v && op.v.remove();
$(".verLine").remove();
}
function createHorLine(op, cp, t, tt, w, pc) {
if (Math.abs(op[t] - cp[tt]) <= HIPRINT_CONFIG.adsorbLineMin) {
if (op.h.length) {
op.h.css("top", op[t] + "pt");
} else {
op.h = $("")
op.h.css("width", w + "pt");
op.h.css("top", op[t] + "pt");
pc.append(op.h);
}
} else {
op.h && op.h.remove();
}
}
function removeHorLine(op) {
if (op) op.h && op.h.remove();
$(".horLine").remove();
}
function o(i) {
// 移动开始动作
var o = t.data(i.data.target, "hidraggable");
e(i);
if (!(i.ctrlKey || i.metaKey) && (i.data.target.className.startsWith('resize-panel') || "2" == i.data.target.style.zIndex || i.data.target.className.startsWith('hiprint-printElement'))) {
var data = i.data
if (t(".mouseRect").length == 0 && o.options.designTarget && o.options.designTarget.panel.printElements.filter(function (el) {
return "block" == el.designTarget.children().last().css("display") && !el.printElementType.type.includes("table");
}).length <= 1) {
let left = window.hinnn.px.toPt(data.left);
let top = window.hinnn.px.toPt(data.top);
let cPosition = o.options.designTarget.options;
cPosition.left = left;
cPosition.top = top;
cPosition.right = left + cPosition.width;
cPosition.bottom = top + cPosition.height;
cPosition.vCenter = left + cPosition.width / 2;
cPosition.hCenter = top + cPosition.height / 2;
(() => {
let oPositions = o.options.designTarget.panel.printElements.filter(el => el.id != o.options.designTarget.id).map(el => {
let {left, top, width, height} = el.options;
let right = left + width, vCenter = left + width / 2, hCenter = top + height / 2;
let cVCenter = cPosition.left + cPosition.width / 2, cHCenter = cPosition.top + cPosition.height / 2,
cRight = cPosition.left + cPosition.width;
let distance, d1, d2, d3;
d1 = Math.sqrt(Math.pow(left - cPosition.left, 2) + Math.pow(hCenter - cHCenter, 2));
d2 = Math.sqrt(Math.pow(vCenter - cVCenter, 2) + Math.pow(hCenter - cHCenter, 2));
d3 = Math.sqrt(Math.pow(right - cRight, 2) + Math.pow(hCenter - cHCenter, 2));
distance = Math.min(d1, d2, d3);
return {
...el.options,
distance,
h: $(".horLine.id-" + el.id),
v: $(".verLine.id-" + el.id),
bottom: top + height,
right: left + width,
vCenter,
hCenter
}
}).sort((a, b) => a.distance - b.distance).slice(0,1)
let paper = o.options.designTarget.designPaper;
let paperContent = paper.target.find(".hiprint-printPaper-content");
let paperW = paper.width, paperH = paper.height;
let showAline = HIPRINT_CONFIG.showAdsorbLine, aMin = HIPRINT_CONFIG.adsorbMin, aLMin = HIPRINT_CONFIG.adsorbLineMin;
oPositions.forEach((item,idx) => {
// 元素左边线
if (Math.abs(oPositions[idx].left - cPosition.left) <= aMin) {
cPosition.left = oPositions[idx].left;
removeVerLine(oPositions[idx]);
} else if (Math.abs(oPositions[idx].vCenter - cPosition.left) <= aMin) {
cPosition.left = oPositions[idx].vCenter;
removeVerLine(oPositions[idx]);
} else if (Math.abs(oPositions[idx].right - cPosition.left) <= aMin) {
cPosition.left = oPositions[idx].right;
removeVerLine(oPositions[idx]);
}
// 元素垂直中线
if (Math.abs(oPositions[idx].left - cPosition.vCenter) <= aMin) {
cPosition.left = oPositions[idx].left - cPosition.width / 2;
removeVerLine(oPositions[idx]);
} else if (Math.abs(oPositions[idx].vCenter - cPosition.vCenter) <= aMin) {
cPosition.left = oPositions[idx].vCenter - cPosition.width / 2;
removeVerLine(oPositions[idx]);
} else if (Math.abs(oPositions[idx].right - cPosition.vCenter) <= aMin) {
cPosition.left = oPositions[idx].right - cPosition.width / 2;
removeVerLine(oPositions[idx]);
}
// 元素右边线
if (Math.abs(oPositions[idx].left - cPosition.right) <= aMin) {
cPosition.left = oPositions[idx].left - cPosition.width;
removeVerLine(oPositions[idx]);
} else if (Math.abs(oPositions[idx].vCenter - cPosition.right) <= aMin) {
cPosition.left = oPositions[idx].vCenter - cPosition.width;
removeVerLine(oPositions[idx]);
} else if (Math.abs(oPositions[idx].right - cPosition.right) <= aMin) {
cPosition.left = oPositions[idx].right - cPosition.width;
removeVerLine(oPositions[idx]);
}
// 元素顶边线
if (Math.abs(oPositions[idx].top - cPosition.top) <= aMin) {
cPosition.top = oPositions[idx].top;
removeHorLine(oPositions[idx]);
} else if (Math.abs(oPositions[idx].hCenter - cPosition.top) <= aMin) {
cPosition.top = oPositions[idx].hCenter;
removeHorLine(oPositions[idx]);
} else if (Math.abs(oPositions[idx].bottom - cPosition.top) <= aMin) {
cPosition.top = oPositions[idx].bottom;
removeHorLine(oPositions[idx]);
}
// 元素水平中线
if (Math.abs(oPositions[idx].top - cPosition.hCenter) <= aMin) {
cPosition.top = oPositions[idx].top - cPosition.height / 2;
removeHorLine(oPositions[idx]);
} else if (Math.abs(oPositions[idx].hCenter - cPosition.hCenter) <= aMin) {
cPosition.top = oPositions[idx].hCenter - cPosition.height / 2;
removeHorLine(oPositions[idx]);
} else if (Math.abs(oPositions[idx].bottom - cPosition.hCenter) <= aMin) {
cPosition.top = oPositions[idx].bottom - cPosition.height / 2;
removeHorLine(oPositions[idx]);
}
// 元素底边线
if (Math.abs(oPositions[idx].top - cPosition.bottom) <= aMin) {
cPosition.top = oPositions[idx].top - cPosition.height;
removeHorLine(oPositions[idx]);
} else if (Math.abs(oPositions[idx].hCenter - cPosition.bottom) <= aMin) {
cPosition.top = oPositions[idx].hCenter - cPosition.height;
removeHorLine(oPositions[idx]);
} else if (Math.abs(oPositions[idx].bottom - cPosition.bottom) <= aMin) {
cPosition.top = oPositions[idx].bottom - cPosition.height;
removeHorLine(oPositions[idx]);
}
if (showAline) {
if (Math.abs(oPositions[idx].left - cPosition.left) > aMin && Math.abs(oPositions[idx].left - cPosition.left) <= aLMin) { // 左
createVerLine(oPositions[idx], cPosition, "left", "left", paperH, paperContent);
} else if (Math.abs(oPositions[idx].vCenter - cPosition.left) > aMin && Math.abs(oPositions[idx].vCenter - cPosition.left) <= aLMin) {
createVerLine(oPositions[idx], cPosition, "vCenter", "left", paperH, paperContent);
} else if (Math.abs(oPositions[idx].right - cPosition.left) > aMin && Math.abs(oPositions[idx].right - cPosition.left) <= aLMin) {
createVerLine(oPositions[idx], cPosition, "right", "left", paperH, paperContent);
} else if (Math.abs(oPositions[idx].left - cPosition.vCenter) > aMin && Math.abs(oPositions[idx].left - cPosition.vCenter) <= aLMin) { // 中
createVerLine(oPositions[idx], cPosition, "left", "vCenter", paperH, paperContent);
} else if (Math.abs(oPositions[idx].vCenter - cPosition.vCenter) > aMin && Math.abs(oPositions[idx].vCenter - cPosition.vCenter) <= aLMin) {
createVerLine(oPositions[idx], cPosition, "vCenter", "vCenter", paperH, paperContent);
} else if (Math.abs(oPositions[idx].right - cPosition.vCenter) > aMin && Math.abs(oPositions[idx].right - cPosition.vCenter) <= aLMin) {
createVerLine(oPositions[idx], cPosition, "right", "vCenter", paperH, paperContent);
} else if (Math.abs(oPositions[idx].left - cPosition.right) > aMin && Math.abs(oPositions[idx].left - cPosition.right) <= aLMin) { // 右
createVerLine(oPositions[idx], cPosition, "left", "right", paperH, paperContent);
} else if (Math.abs(oPositions[idx].vCenter - cPosition.right) > aMin && Math.abs(oPositions[idx].vCenter - cPosition.right) <= aLMin) {
createVerLine(oPositions[idx], cPosition, "vCenter", "right", paperH, paperContent);
} else if (Math.abs(oPositions[idx].right - cPosition.right) > aMin && Math.abs(oPositions[idx].right - cPosition.right) <= aLMin) {
createVerLine(oPositions[idx], cPosition, "right", "right", paperH, paperContent);
} else if (Math.abs(oPositions[idx].top - cPosition.top) > aMin && Math.abs(oPositions[idx].top - cPosition.top) <= aLMin) { // 上
createHorLine(oPositions[idx], cPosition, "top", "top", paperW, paperContent);
} else if (Math.abs(oPositions[idx].hCenter - cPosition.top) > aMin && Math.abs(oPositions[idx].hCenter - cPosition.top) <= aLMin) {
createHorLine(oPositions[idx], cPosition, "hCenter", "top", paperW, paperContent);
} else if (Math.abs(oPositions[idx].bottom - cPosition.top) > aMin && Math.abs(oPositions[idx].bottom - cPosition.top) <= aLMin) {
createHorLine(oPositions[idx], cPosition, "bottom", "top", paperW, paperContent);
} else if (Math.abs(oPositions[idx].top - cPosition.hCenter) > aMin && Math.abs(oPositions[idx].top - cPosition.hCenter) <= aLMin) { // 中
createHorLine(oPositions[idx], cPosition, "top", "hCenter", paperW, paperContent);
} else if (Math.abs(oPositions[idx].hCenter - cPosition.hCenter) > aMin && Math.abs(oPositions[idx].hCenter - cPosition.hCenter) <= aLMin) {
createHorLine(oPositions[idx], cPosition, "hCenter", "hCenter", paperW, paperContent);
} else if (Math.abs(oPositions[idx].bottom - cPosition.hCenter) > aMin && Math.abs(oPositions[idx].bottom - cPosition.hCenter) <= aLMin) {
createHorLine(oPositions[idx], cPosition, "bottom", "hCenter", paperW, paperContent);
} else if (Math.abs(oPositions[idx].top - cPosition.bottom) > aMin && Math.abs(oPositions[idx].top - cPosition.bottom) <= aLMin) { // 下
createHorLine(oPositions[idx], cPosition, "top", "bottom", paperW, paperContent);
} else if (Math.abs(oPositions[idx].hCenter - cPosition.bottom) > aMin && Math.abs(oPositions[idx].hCenter - cPosition.bottom) <= aLMin) {
createHorLine(oPositions[idx], cPosition, "hCenter", "bottom", paperW, paperContent);
} else if (Math.abs(oPositions[idx].bottom - cPosition.bottom) > aMin && Math.abs(oPositions[idx].bottom - cPosition.bottom) <= aLMin) {
createHorLine(oPositions[idx], cPosition, "bottom", "bottom", paperW, paperContent);
} else {
removeVerLine(oPositions[idx]);
removeHorLine(oPositions[idx]);
}
}
})
})()
i.data.left = window.hinnn.pt.toPx(cPosition.left);
i.data.top = window.hinnn.pt.toPx(cPosition.top);
}
// 当前纸张宽高
var parent = data.parent.className.endsWith('design') ? data.parent : data.parent.offsetParent;
var paperW = parent.clientWidth, paperH = parent.clientHeight;
// 当前元素宽高
var elementW = data.target.clientWidth, elementH = data.target.clientHeight,
diffLeft = 0, diffTop = 0;
if (o.options.designTarget && o.options.designTarget.options.transform) {
var info = o.options.designTarget.options.getRectInfo();
diffLeft = window.hinnn.pt.toPx(info.diffW), diffTop = window.hinnn.pt.toPx(info.diffH);
}
// 左右
if (data.left < 0 - diffLeft) {
data.left = 0 - diffLeft
} else if (data.left >= paperW - elementW + diffLeft) {
data.left = paperW - elementW + diffLeft
}
// 上下
if (data.top < 0 - diffTop) {
data.top = 0 - diffTop
} else if (data.top >= paperH - elementH + diffTop) {
data.top = paperH - elementH + diffTop
}
i.data = data
}
0 != o.options.onDrag.call(i.data.target, i, t.fn.dragLengthCNum(i.data.left, o.options), t.fn.dragLengthCNum(i.data.top, o.options)) && n(i);
var r = i.data.target;
return o.hidroppables.each(function () {
var e = t(this);
if (!e.hidroppable("options").disabled) {
var n = e.offset();
i.pageX > n.left && i.pageX < n.left + e.outerWidth() && i.pageY > n.top && i.pageY < n.top + e.outerHeight() ? (this.entered || (t(this).trigger("_dragenter", [r]), this.entered = !0), t(this).trigger("_dragover", [r])) : this.entered && (t(this).trigger("_dragleave", [r]), this.entered = !1);
}
}), !1;
}
function r(e) {
// 这里原 mouseup时, 回调了 o(e) ==> onDrag
t.fn.hidraggable.isDragging = !1;
removeVerLine(), removeHorLine();
var n,
i,
r = t.data(e.data.target, "hidraggable"),
a = r.proxy,
p = r.options;
p.revert ? 1 == l() ? t(e.data.target).css({
position: e.data.startPosition,
left: e.data.startLeft,
top: e.data.startTop
}) : a ? (a.parent()[0] == document.body ? (n = e.data.startX - e.data.offsetWidth, i = e.data.startY - e.data.offsetHeight) : (n = e.data.startLeft, i = e.data.startTop), a.animate({
left: n,
top: i
}, function () {
s();
})) : t(e.data.target).animate({
left: e.data.startLeft,
top: e.data.startTop
}, function () {
t(e.data.target).css("position", e.data.startPosition);
}) : (t(e.data.target).css({
position: "absolute",
left: t.fn.dragLengthC(e.data.left, p),
top: t.fn.dragLengthC(e.data.top, p)
}), l());
function s() {
a && a.remove(), r.proxy = null;
}
function l() {
var n = !1;
return r.hidroppables.each(function () {
var i = t(this);
if (!i.hidroppable("options").disabled) {
var o = i.offset();
var ptr = (this.style.transform && parseFloat(this.style.transform.slice(6, -1))) || 1;
return e.pageX > o.left && e.pageX < o.left + (i.outerWidth() * ptr) && e.pageY > o.top && e.pageY < o.top + (i.outerHeight() * ptr) ? (p.revert && t(e.data.target).css({
position: e.data.startPosition,
left: e.data.startLeft,
top: e.data.startTop
}), t(this).trigger("_drop", [e.data.target]), s(), n = !0, this.entered = !1, !1) : void 0;
}
}), n || p.revert || s(), n;
}
return p.onStopDrag.call(e.data.target, e), t(document).unbind(".hidraggable"), setTimeout(function () {
t("body").css("cursor", "");
}, 100), !1;
}
t.fn.hidraggable = function (e, n) {
return "string" == typeof e ? t.fn.hidraggable.methods[e](this, n) : this.each(function () {
var n,
a = t.data(this, "hidraggable");
a ? (a.handle.unbind(".hidraggable"), n = t.extend(a.options, e)) : n = t.extend({}, t.fn.hidraggable.defaults, t.fn.hidraggable.parseOptions(this), e || {});
var p = n.handle ? "string" == typeof n.handle ? t(n.handle, this) : n.handle : t(this);
function s(e) {
var n = t.data(e.data.target, "hidraggable"),
i = n.handle,
o = t(i).offset(),
tr = t(i)[0].style.transform && parseInt(t(i)[0].style.transform.slice(7, -1)),
ptr = n.options.getScale(),
r = t(i).outerWidth();
var a = t(i).outerHeight();
if (tr) {
var rad = tr * Math.PI / 180,
width = t(i).outerWidth(),
height = t(i).outerHeight(),
sin = Math.sin(rad),
cos = Math.cos(rad);
r = Math.abs(width * cos) + Math.abs(height * sin),
a = Math.abs(width * sin) + Math.abs(height * cos)
}
if (ptr) {
r *= ptr, a *= ptr;
}
var p = e.pageY - o.top,
s = o.left + r - e.pageX,
l = o.top + a - e.pageY,
u = e.pageX - o.left;
return Math.min(p, s, l, u) > n.options.edge;
}
t.data(this, "hidraggable", {
options: n,
handle: p
}), n.disabled ? t(this).css("cursor", "") : p.unbind(".hidraggable").bind("mousemove.hidraggable", {
target: this
}, function (e) {
if (!t.fn.hidraggable.isDragging) {
var n = t.data(e.data.target, "hidraggable").options;
s(e) ? t(this).css("cursor", n.cursor) : t(this).css("cursor", "");
}
}).bind("mouseleave.hidraggable", {
target: this
}, function (e) {
t(this).css("cursor", "");
}).bind("mousedown.hidraggable", {
target: this
}, function (e) {
if (0 != s(e)) {
t(this).css("cursor", "");
var n = t(e.data.target).position(),
a = t(e.data.target).offset(),
p = {
startPosition: t(e.data.target).css("position"),
startLeft: n.left,
startTop: n.top,
left: n.left,
top: n.top,
startX: e.pageX,
startY: e.pageY,
offsetWidth: e.pageX - a.left,
offsetHeight: e.pageY - a.top,
target: e.data.target,
parent: t(e.data.target).parent()[0]
};
var ops = t.data(e.data.target, "hidraggable");
// item禁止移动
if (ops.options.draggable === false) {
return;
}
// 旋转时不允许移动
if ('r resizebtn' == e.target.className) {
return;
}
var ptr = ops.options.getScale()
if (ptr) {
p.left /= ptr, p.top /= ptr, p.startLeft /= ptr, p.startTop /= ptr;
}
var tr = p.target.style.transform && parseInt(p.target.style.transform.slice(7, -1));
if (tr) {
var rad = tr * Math.PI / 180,
width = t(e.data.target).outerWidth(),
height = t(e.data.target).outerHeight(),
sin = Math.sin(rad),
cos = Math.cos(rad);
var w = Math.abs(width * cos) + Math.abs(height * sin),
h = Math.abs(width * sin) + Math.abs(height * cos);
var diffW = (w - width) / 2, diffH = (h - height) / 2;
p.left += diffW, p.top += diffH, p.startLeft += diffW, p.startTop += diffH;
}
t.extend(e.data, p);
0 != t.data(e.data.target, "hidraggable").options.onBeforeDrag.call(e.data.target, e) && (t(document).bind("mousedown.hidraggable", e.data, i), t(document).bind("mousemove.hidraggable", e.data, o), t(document).bind("mouseup.hidraggable", e.data, r));
}
});
});
}, t.fn.hidraggable.methods = {
options: function options(e) {
return t.data(e[0], "hidraggable").options;
},
update: function update(e, n) {
if (n && "object" == typeof n) {
t.data(e[0], "hidraggable") && Object.keys(n).forEach(function (k) {
t.data(e[0], "hidraggable").options[k] = n[k]
})
}
},
proxy: function proxy(e) {
return t.data(e[0], "hidraggable").proxy;
},
enable: function enable(e) {
return e.each(function () {
t(this).hidraggable({
disabled: !1
});
});
},
disable: function disable(e) {
return e.each(function () {
t(this).hidraggable({
disabled: !0
});
});
}
}, t.fn.hidraggable.parseOptions = function (e) {
var n = t(e);
return t.extend({}, t.hiprintparser.parseOptions(e, ["cursor", "handle", "axis", {
revert: "boolean",
deltaX: "number",
deltaY: "number",
edge: "number"
}]), {
disabled: !!n.attr("disabled") || void 0
});
}, t.fn.hidraggable.defaults = {
proxy: null,
revert: !1,
cursor: "move",
deltaX: null,
deltaY: null,
handle: null,
disabled: !1,
edge: 0,
axis: null,
getScale: function getScale(t) {},
onBeforeDrag: function onBeforeDrag(t) {
},
onStartDrag: function onStartDrag(t) {
},
onDrag: function onDrag(t) {
},
onStopDrag: function onStopDrag(t) {
}
}, t.fn.hidraggable.isDragging = !1;
}(jQuery);
}, function (t, e) {
!function (t) {
t.fn.hidroppable = function (e, n) {
return "string" == typeof e ? t.fn.hidroppable.methods[e](this, n) : (e = e || {}, this.each(function () {
var n,
i = t.data(this, "hidroppable");
i ? t.extend(i.options, e) : (t(n = this).addClass("hidroppable"), t(n).bind("_dragenter", function (e, i) {
t.data(n, "hidroppable").options.onDragEnter.apply(n, [e, i]);
}), t(n).bind("_dragleave", function (e, i) {
t.data(n, "hidroppable").options.onDragLeave.apply(n, [e, i]);
}), t(n).bind("_dragover", function (e, i) {
t.data(n, "hidroppable").options.onDragOver.apply(n, [e, i]);
}), t(n).bind("_drop", function (e, i) {
t.data(n, "hidroppable").options.onDrop.apply(n, [e, i]);
}), t.data(this, "hidroppable", {
options: t.extend({}, t.fn.hidroppable.defaults, t.fn.hidroppable.parseOptions(this), e)
}));
}));
}, t.fn.hidroppable.methods = {
options: function options(e) {
return t.data(e[0], "hidroppable").options;
},
enable: function enable(e) {
return e.each(function () {
t(this).hidroppable({
disabled: !1
});
});
},
disable: function disable(e) {
return e.each(function () {
t(this).hidroppable({
disabled: !0
});
});
}
}, t.fn.hidroppable.parseOptions = function (e) {
var n = t(e);
return t.extend({}, t.hiprintparser.parseOptions(e, ["accept"]), {
disabled: !!n.attr("disabled") || void 0
});
}, t.fn.hidroppable.defaults = {
accept: null,
disabled: !1,
onDragEnter: function onDragEnter(t, e) {
},
onDragOver: function onDragOver(t, e) {
},
onDragLeave: function onDragLeave(t, e) {
},
onDrop: function onDrop(t, e) {
}
};
}(jQuery);
}, function (t, e) {
var n;
(n = jQuery).hiprintparser = {
parseOptions: function parseOptions(t, e) {
var i = n(t),
o = {},
r = n.trim(i.attr("data-options"));
if (r && ("{" != r.substring(0, 1) && (r = "{" + r + "}"), o = new Function("return " + r)()), e) {
for (var a = {}, p = 0; p < e.length; p++) {
var s = e[p];
if ("string" == typeof s) a[s] = "width" == s || "height" == s || "left" == s || "top" == s ? parseInt(t.style[s]) || void 0 : i.attr(s); else for (var l in s) {
var u = s[l];
"boolean" == u ? a[l] = i.attr(l) ? "true" == i.attr(l) : void 0 : "number" == u && (a[l] = "0" == i.attr(l) ? 0 : parseFloat(i.attr(l)) || void 0);
}
}
n.extend(o, a);
}
return o;
}
}, n.fn.dragLengthC = function (t, e) {
return "pt" == e.moveUnit ? n.fn.dragLengthCNum(t, e) + "pt" : n.fn.dragLengthCNum(t, e);
}, n.fn.dragLengthCNum = function (t, e) {
var n = 3;
if ("pt" == e.moveUnit) {
var i = .75 * t;
return e.minMove && (n = e.minMove), Math.round(i / n) * n;
}
return Math.round(i / n) * n;
};
}, function (t, e) {
var n, i, o;
n = jQuery, i = {
maxPanelIndex: 0
}, (o = function o(t) {
this.options = n.data(t.target, "hireizeable").options, this.init(t.target);
}).prototype = {
numHandlerText: function numHandlerText(t) {
return this.numHandler(t) + "pt";
},
numHandler: function numHandler(t) {
var e = 1.5,
n = .75 * t;
return this.options.minResize && (e = this.options.minResize), Math.round(n / e) * e;
},
init: function init(t) {
this.initResizeBox(t);
},
initResizeBox: function initResizeBox(t) {
var e = this;
n(t).each(function () {
var o;
i.maxPanelIndex += 1, e.options.noContainer ? o = n(t) : (o = n("')).css({
width: "100%",
height: "100%",
top: 0,
left: 0,
position: "absolute",
"background-color": "rgba(0,0,0,0.5)",
cursor: "move",
display: "none"
}), e.appendHandler(o, n(this));
var r = {
name: "n",
target: n('')
},
a = {
name: "s",
target: n('')
},
p = {
name: "w",
target: n('')
},
s = {
name: "e",
target: n('')
},
l = {
name: "ne",
target: n('')
},
u = {
name: "nw",
target: n('')
},
d = {
name: "se",
target: n('')
},
c = {
name: "sw",
target: n('')
},
r = {
name: "r",
target: n('')
},
sizeBox = n(''),
deleteBtn = n('
✕
'),
h = function h() {
var t = [],
i = e.options.showPoints;
return n.each([r, a, p, s, l, u, d, c], function (e, o) {
n.inArray(o.name, i) > -1 && t.push(o.target);
}), t;
};
e.refreshSizeBox(void 0, sizeBox, o);
// draggable 为 false 时不显示 resizebox 右上角删除按钮
if (e.options.draggable != false) {
o.append(deleteBtn);
o.on("mousedown", ".del-btn", () => {
var keyboardEvent = new KeyboardEvent("keydown", { bubbles: true, keyCode: 46 });
t.dispatchEvent(keyboardEvent);
});
}
e.addHandlerCss(h()), e.appendHandler(h(), o), e.bindResizeEvent(o, n(this));
var f = n(this);
n(o).on("mousedown", ".resizebtn", function () {
f.addClass("resizeing");
}), n(".easyui-droppable").on("mouseup", function () {
f.removeClass("resizeing");
}), e.bindTrigger(n(this));
}), e.bindHidePanel();
},
addHandlerCss: function addHandlerCss(t) {
for (var e = 0; e < t.length; e++) {
t[e].css({
position: "absolute",
width: "8px",
height: "8px",
background: "#ff6600",
"border-radius": "50%"
});
}
},
appendHandler: function appendHandler(t, e) {
e.find(".resize-panel").remove()
for (var n = 0; n < t.length; n++) {
e.append(t[n]);
}
},
refreshSizeBox: function refreshSizeBox(t, box, o) {
if (!this.options.showSizeBox) return;
if (box) {
o.append(box);
}
var style, sizeBox;
if (t && t.length) {
style = t[0].style;
sizeBox = t.children("div[panelindex]").find(".size-box");
} else if (o && o.parent()) {
var t = o.parent();
if (t.hasClass("hiprint-printPaper-content")) return;
style = t[0].style;
if (!style.width) {
style.width = hinnn.px.toPt(t[0].offsetWidth) + "pt";
}
if (!style.height) {
style.height = hinnn.px.toPt(t[0].offsetHeight) + "pt";
}
sizeBox = t.children("div[panelindex]").find(".size-box");
}
if (sizeBox) {
sizeBox.text(style.width + ' x ' + style.height);
sizeBox.css('top', -(sizeBox.outerHeight() || 20));
}
},
triggerResize: function triggerResize(t, n) {
// 处理按住 ctrl / command 点击元素 多选
if (!(n.ctrlKey || n.metaKey)) {
t.siblings().children("div[panelindex]").removeClass('selected')
t.siblings().children("div[panelindex]").css({
display: "none"
})
}
t.children("div[panelindex]").addClass('selected')
t.children("div[panelindex]").css({
display: "block"
});
this.refreshSizeBox(t)
},
bindResizeEvent: function bindResizeEvent(t, e) {
var i = this,
o = 0,
r = 0,
a = t.width(),
p = t.height(),
s = t.offset().left,
l = t.offset().top,
u = i.options.noContainer ? n(e) : t.parent(),
d = !1; // 右
t.on("mousedown", ".e", function (e) {
o = e.pageX, a = t.width(), d = !0;
});
var c = !1; // 下
t.on("mousedown", ".s", function (e) {
r = e.pageY, p = t.height(), c = !0;
});
var h = !1; // 左
t.on("mousedown", ".w", function (e) {
o = e.pageX, a = t.width(), h = !0, s = u.offset().left;
});
var f = !1; // 上
t.on("mousedown", ".n", function (e) {
r = e.pageY, p = t.height(), f = !0, l = u.offset().top;
});
var g = !1; // 右上
t.on("mousedown", ".ne", function (e) {
o = e.pageX, r = e.pageY, a = t.width(), p = t.height(), g = !0, l = u.offset().top;
});
var m = !1; // 左上
t.on("mousedown", ".nw", function (e) {
o = e.pageX, r = e.pageY, a = t.width(), p = t.height(), l = u.offset().top, s = u.offset().left, m = !0;
});
var v = !1; // 右下
t.on("mousedown", ".se", function (e) {
o = e.pageX, r = e.pageY, a = t.width(), p = t.height(), v = !0;
});
var y = !1; // 左下
t.on("mousedown", ".sw", function (e) {
o = e.pageX, r = e.pageY, a = t.width(), p = t.height(), y = !0, s = u.offset().left;
});
var rt = !1; // 旋转
t.on("mousedown", ".r", function (e) {
o = e.pageX, r = e.pageY, a = t.width(), p = t.height(), rt = !0, s = a / 2 + u.offset().left, l = p / 2 + u.offset().top;
});
t.on("dblclick", ".r", function (e) {
u.css({transform: "rotate(" + 0 + "deg)"});
i.options.onResize(e, void 0, void 0, void 0, void 0, 0);
});
var b = !1;
t.on("mousedown", function (t) {
i.options.onBeforeResize(), o = t.pageX, r = t.pageY, l = u.offset().top, s = u.offset().left, b = !1;
}), n(i.options.stage).on("mousemove", function (e) {
if (d) { // 右
var n = (e.pageX - o) / i.options.getScale();
t.css({
width: "100%"
}), u.css({
width: i.numHandlerText(a + n)
}), i.options.onResize(e, void 0, i.numHandler(a + n), void 0, void 0);
} else if (c) { // 下
var E = (e.pageY - r) / i.options.getScale();
t.css({
height: "100%"
}), u.css({
height: i.numHandlerText(p + E)
}), i.options.onResize(e, i.numHandler(p + E), void 0, void 0, void 0);
} else if (rt) { // 旋转
t.css({height: "100%"});
var eo = e.pageX, er = e.pageY;
var direct = (eo - o) * 360 / 100;
o = e.pageX
var lastAngle = (u[0].style.transform && parseInt(u[0].style.transform.slice(7, -1))) || 0;
var R = lastAngle + direct;
if (Math.abs(R) > 360) {
R = R % 360
}
u.css({transform: "rotate(" + R + "deg)"});
i.options.onResize(e, void 0, void 0, void 0, void 0, R);
} else if (h) { // 左
(n = (e.pageX - o) / i.options.getScale(), t.css({
width: "100%"
}), u.css({
width: i.numHandlerText(a - n),
left: i.numHandlerText(i.options.noDrag ? void 0 : i.numHandler(s + n))
}), i.options.onResize(e, void 0, i.numHandler(a - n), void 0, i.options.noDrag ? void 0 : i.numHandler(s + n)))
} else if (f) { // 上
(E = (e.pageY - r) / i.options.getScale(), t.css({
height: "100%"
}), u.css({
height: i.numHandlerText(p - E),
top: i.numHandlerText(i.options.noDrag ? void 0 : l + E)
}), i.options.onResize(e, i.numHandler(p - E), void 0, i.options.noDrag ? void 0 : i.numHandler(l + E), void 0))
} else if (g) { // 右上
(n = (e.pageX - o) / i.options.getScale(), E = (e.pageY - r) / i.options.getScale(), t.css({
height: "100%",
width: "100%"
}), u.css({
height: i.numHandlerText(p - E),
top: i.numHandlerText(i.options.noDrag ? void 0 : l + E),
width: i.numHandlerText(a + n)
}), i.options.onResize(e, i.numHandler(p - E), i.numHandler(a + n), i.options.noDrag ? void 0 : i.numHandler(l + E), void 0))
} else if (m) { // 左上
(n = (e.pageX - o) / i.options.getScale(), E = (e.pageY - r) / i.options.getScale(), t.css({
height: "100%",
width: "100%"
}), u.css({
height: i.numHandlerText(p - E),
top: i.numHandlerText(i.options.noDrag ? void 0 : l + E),
width: i.numHandlerText(a - n),
left: i.numHandlerText(i.options.noDrag ? void 0 : s + n)
}), i.options.onResize(e, i.numHandler(p - E), i.numHandler(a - n), i.options.noDrag ? void 0 : i.numHandler(l + E), i.options.noDrag ? void 0 : i.numHandler(s + n)))
} else if (v) { // 右下
(n = (e.pageX - o) / i.options.getScale(), E = (e.pageY - r) / i.options.getScale()),
t.css({width: "100%", height: "100%"});
if (e.shiftKey) {
u.css({width: i.numHandlerText(a + n), height: i.numHandlerText(p + E)});
i.options.onResize(e, i.numHandler(p + E), i.numHandler(a + n), void 0, void 0);
} else {
// 宽高比
var ratio = p / a;
var width = a + n, height = p + E;
height = width * ratio;
u.css({width: i.numHandlerText(width), height: i.numHandlerText(height)});
i.options.onResize(e, i.numHandler(height), i.numHandler(width), void 0, void 0);
}
} else if (y) { // 左下
(n = (e.pageX - o) / i.options.getScale(), E = (e.pageY - r) / i.options.getScale(), t.css({
width: "100%",
height: "100%"
}), u.css({
width: i.numHandlerText(a - n),
left: i.numHandlerText(i.options.noDrag ? void 0 : s + n),
height: i.numHandlerText(p + E)
}), i.options.onResize(e, i.numHandler(p + E), i.numHandler(a - n), i.numHandler(otundefinedop), i.options.noDrag ? void 0 : i.numHandler(s + n)))
} else { // 按下
b && (n = (e.pageX - o) / i.options.getScale(), E = (e.pageY - r) / i.options.getScale(), u.css({
left: i.numHandlerText(i.options.noDrag ? void 0 : s + n),
top: i.numHandlerText(i.options.noDrag ? void 0 : l + E)
}), i.options.onResize(e, void 0, void 0, i.options.noDrag ? void 0 : i.numHandler(l + E), i.options.noDrag ? void 0 : i.numHandler(s + n)))
}
;
}).on("mouseup", function (t) {
// i.options.onStopResize(rt);
// 当某个 '控制点' 按下时 (每个'控制点'按下状态是独立的)
if ((d || c || h || f || g || m || y || v || b || rt)) {
i.options.onStopResize(rt);
}
d = !1, c = !1, h = !1, f = !1, g = !1, m = !1, y = !1, v = !1, b = !1, rt = !1;
});
},
bindTrigger: function bindTrigger(t) {
var e = this;
t.on("click", function (_n) {
_n.stopPropagation(), e.triggerResize(t, _n), n(".mouseRect").remove();
});
},
bindHidePanel: function bindHidePanel(t) {
if (i.maxPanelIndex < 2) {
var e = this.options.stage;
n(e).bind("click", function (t) {
// 仅点击设计面板时清除多选元素
if (t.target.className && _typeof(t.target.className) == "string" && t.target.className.includes("design")) {
t.stopPropagation(), n("div[panelindex]").css({
display: "none"
});
n("div[panelindex]").removeClass("selected");
}
});
}
}
}, n.fn.extend({
hireizeable: function hireizeable(t) {
return this.each(function () {
var e,
i = n.data(this, "hireizeable");
e = i ? n.extend({}, i.options, t || {}) : n.extend({}, n.fn.hireizeable.defaults, t || {});
n.data(this, "hireizeable", {
options: e
}), new o({
target: this,
onResize: function onResize(t, e, n, i, o) {
},
onStopResize: function onStopResize(t, e, n, i, o) {
}
});
});
}
}), n.fn.hireizeable.defaults = {
stage: document,
reizeUnit: "pt",
minResize: 1.5,
showSizeBox: !0,
showPoints: ["s", "e"],
noContainer: !1,
onBeforeResize: function onBeforeResize(t, e, n, i, o) {
},
onResize: function onResize(t, e, n, i, o) {
},
onStopResize: function onStopResize(t, e, n, i, o) {
},
noDrag: !1
};
}, function (t, e) {
var n, i;
jQuery, n = "connected", i = "reconnecting", window.hiwebSocket = {
opened: !1,
name: "webSockets",
host: "http://localhost:17521",
token: 'vue-plugin-hiprint',
reconnectTimeout: 6e4,
reconnectWindowSetTimeout: null,
reconnectDelay: 2e3,
supportsKeepAlive: function supportsKeepAlive() {
return !0;
},
hasIo: function hasIo(t) {
return window.io;
},
send: function send(t) {
try {
this.socket.emit("news", t);
} catch (e) {
console.log("send data error:" + (t || "") + JSON.stringify(e));
}
},
sendByFragments: function(content) {
try {
const {
fragmentSize = 50000, // 单片字符长度
sendInterval = 10, // 分批传输间隔
html,
generateHTMLInterval, // 不需要传给client,取出字段
printByFragments, // 不需要传给client,取出字段
...otherFields
} = content
const contentToSplit = content.html
// 字符总数
const charsCount = contentToSplit.length
// 片段总数
const fragmentsCount = Math.ceil(charsCount / fragmentSize)
Array.apply(undefined, { length: fragmentsCount }).forEach((item, index) => {
const startIndex = index * fragmentSize
// 字符结束索引
const endIndex = index + 1 === fragmentSize ? charsCount : (index + 1) * fragmentSize
// socket分段发送内容
setTimeout(() => {
this.socket.emit('printByFragments', {
...otherFields,
index,
total: fragmentsCount,
htmlFragment: html.slice(startIndex, endIndex)
});
}, sendInterval * index);
})
} catch (e) {
console.log("send data fragment error:" + (content || "") + JSON.stringify(e));
}
},
getPrinterList: function getPrinterList() {
return this.printerList;
},
refreshPrinterList: function refreshPrinterList() {
try {
this.socket.emit("refreshPrinterList");
} catch (e) {
console.log("refreshPrinterList error:" + JSON.stringify(e));
}
},
getPaperSizeInfo: function getPaperSizeInfo(printer) {
try {
console.warn("getPaperSizeInfo 是一个测试功能,仅win客户端支持该api!")
this.socket.emit("getPaperSizeInfo", printer);
} catch (e) {
console.log("getPaperSizeInfo error:" + JSON.stringify(e))
}
},
getClients: function getClients() {
try {
this.socket.emit("getClients");
} catch (e) {
console.log("getClients error:" + JSON.stringify(e));
}
},
getClientInfo: function getClientInfo() {
try {
this.socket.emit("getClientInfo");
} catch (e) {
console.log("getClientInfo error:" + JSON.stringify(e))
}
},
getAddress: function getAddress(type, ...args) {
try {
this.socket.emit("address", type, ...args);
} catch (e) {
console.log("getAddress error:" + JSON.stringify(e));
}
},
ippPrint: function ippPrint(options) {
try {
this.socket.emit("ippPrint", options);
} catch (e) {
console.log("ippPrint error:" + JSON.stringify(e));
}
},
ippRequest: function ippRequest(options) {
try {
this.socket.emit("ippRequest", options);
} catch (e) {
console.log("ippRequest error:" + JSON.stringify(e));
}
},
setHost: function (host, token, cb) {
if (typeof token === "function") {
cb = token
token = undefined
}
this.host = host
this.token = token
this.stop()
this.start(cb)
},
start: function start(cb) {
var _this = this;
var t = this;
window.WebSocket ? this.socket || (this.socket = window.io(this.host, {
transports: ['websocket'],
reconnectionAttempts: 5,
auth: {
token: this.token
}
}), this.socket.on("connect", function (e) {
t.opened = !0, console.log("Websocket opened."),
_this.socket.on("success", function (t) {
hinnn.event.trigger("printSuccess_" + t.templateId, t);
}), _this.socket.on("error", function (t) {
hinnn.event.trigger("printError_" + t.templateId, t);
}), _this.socket.on("clients", function(clients) {
t.clients = clients;
hinnn.event.trigger("clients", clients)
}), _this.socket.on("clientInfo", function(clientInfo) {
t.clientInfo = clientInfo
hinnn.event.trigger("clientInfo", clientInfo)
}), _this.socket.on("printerList", function (e) {
t.printerList = e;
hinnn.event.trigger("printerList", e);
}), _this.socket.on("paperSizeInfo", function(e) {
t.paperSize = Array.isArray(e)?e:[e]
hinnn.event.trigger("paperSizeInfo", t.paperSize);
}), _this.socket.on("address", function (type, addr, e) {
hinnn.event.trigger("address_" + type, {'addr': addr, 'e': e});
}), _this.socket.on("ippPrinterConnected", function (printer) {
hinnn.event.trigger("ippPrinterConnected", printer);
}), _this.socket.on("ippPrinterCallback", function (err, res) {
hinnn.event.trigger("ippPrinterCallback", {'err': err, 'res': res});
}), _this.socket.on("ippRequestCallback", function (err, res) {
hinnn.event.trigger("ippRequestCallback", {'err': err, 'res': res});
}), t.state = n;
cb && cb(true, e);
}), this.socket.on("connect_error", function (e) {
console.error(e)
hinnn.event.trigger("connect_error", e)
}), this.socket.on("disconnect", function () {
t.opened = !1;
cb && cb(false);
})) : console.log("WebSocket start fail"), cb && cb(false);
},
reconnect: function reconnect() {
this.state !== n && this.state !== i || (this.stop(), this.ensureReconnectingState() && (console.log("Websocket reconnecting."), this.start()));
},
stop: function stop() {
this.socket && (console.log("Closing the Websocket."), this.socket.close(), this.socket = null, this.printerList = []);
},
ensureReconnectingState: function ensureReconnectingState() {
return this.state = i, this.state === i;
}
};
}, function (t, e, n) {
var i = n(28);
"string" == typeof i && (i = [[t.i, i, ""]]);
var o = {
hmr: !0,
transform: void 0,
insertInto: void 0
};
n(30)(i, o);
i.locals && (t.exports = i.locals);
}, function (t, e, n) {
(t.exports = n(29)(!1)).push([t.i, ".hicontextmenu {\r\n\tposition: absolute;\r\n\tdisplay: inline-block;\r\n\twidth: 215px;\r\n\tpadding: 0 0;\r\n\tmargin: 0;\r\n\tfont-family: inherit;\r\n\tfont-size: inherit;\r\n\tlist-style-type: none;\r\n\tlist-style: none;\r\n\tbackground: #fff;\r\n\tborder: 1px solid #bebebe;\r\n\tborder-radius: 2px;\r\n\tfont-size: 13px;\r\n}\r\n\r\n.hicontextmenuroot .hicontextmenuitem {\r\n\tposition: relative;\r\n\t-webkit-box-sizing: content-box;\r\n\t-moz-box-sizing: content-box;\r\n\tbox-sizing: content-box;\r\n\tpadding: .2em 12px;\r\n\tcolor: #2f2f2f;\r\n\t-webkit-user-select: none;\r\n\t-moz-user-select: none;\r\n\t-ms-user-select: none;\r\n\ttext-decoration: none;\r\n\r\n\tuser-select: none;\r\n\tbackground-color: #fff;\r\n\r\n}\r\n\r\n.hicontextmenuroot>.hicontextmenuitem:hover,\r\n.hicontextmenuroot .hicontextmenuitem > a:hover {\r\n\tbackground-color: #f3f3f3;\r\n}\r\n\r\n.hicontextmenuroot .hicontextmenuitem>a {\r\n\ttext-decoration: none;\r\n\tcolor: #363636;\r\n\tline-height: 22px;\r\n\r\n}\r\n\r\n.hicontextmenuroot .hicontextsubmenu>ul {\r\n\tdisplay: none;\r\n\tposition: absolute;\r\n\r\n}\r\n\r\n.hicontextmenuroot .hicontextsubmenu:hover>ul {\r\n\tdisplay: block;\r\n\tleft: 100%;\r\n\ttop: -1px;\r\n\tmargin-left: 0px;\r\n}\r\n\r\n.hicontextmenuroot .borderBottom {\r\n\tborder-bottom: 1px solid #efe6e6;\r\n}\r\n\r\n.hicontextmenuroot .disable> a {\r\n \r\n color: #ccc;\r\n \r\n}\r\n.hicontextmenuroot>.disable:hover,\r\n.hicontextmenuroot .disable> a:hover {\r\n\tbackground-color:#fff;\r\n}", ""]);
}, function (t, e, n) {
"use strict";
t.exports = function (t) {
var e = [];
return e.toString = function () {
return this.map(function (e) {
var n = function (t, e) {
var n = t[1] || "",
i = t[3];
if (!i) return n;
if (e && "function" == typeof btoa) {
var o = (a = i, "/*# sourceMappingURL=data:application/json;charset=utf-8;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(a)))) + " */"),
r = i.sources.map(function (t) {
return "/*# sourceURL=" + i.sourceRoot + t + " */";
});
return [n].concat(r).concat([o]).join("\n");
}
var a;
return [n].join("\n");
}(e, t);
return e[2] ? "@media " + e[2] + "{" + n + "}" : n;
}).join("");
}, e.i = function (t, n) {
"string" == typeof t && (t = [[null, t, ""]]);
for (var i = {}, o = 0; o < this.length; o++) {
var r = this[o][0];
null != r && (i[r] = !0);
}
for (o = 0; o < t.length; o++) {
var a = t[o];
null != a[0] && i[a[0]] || (n && !a[2] ? a[2] = n : n && (a[2] = "(" + a[2] + ") and (" + n + ")"), e.push(a));
}
}, e;
};
}, function (t, e, n) {
var i,
o,
r = {},
a = (i = function i() {
return window && document && document.all && !window.atob;
}, function () {
return void 0 === o && (o = i.apply(this, arguments)), o;
}),
p = function (t) {
var e = {};
return function (t, n) {
if ("function" == typeof t) return t();
if (void 0 === e[t]) {
var i = function (t, e) {
return e ? e.querySelector(t) : document.querySelector(t);
}.call(this, t, n);
if (window.HTMLIFrameElement && _instanceof(i, window.HTMLIFrameElement)) try {
i = i.contentDocument.head;
} catch (t) {
i = null;
}
e[t] = i;
}
return e[t];
};
}(),
s = null,
l = 0,
u = [],
d = n(31);
function c(t, e) {
for (var n = 0; n < t.length; n++) {
var i = t[n],
o = r[i.id];
if (o) {
o.refs++;
for (var a = 0; a < o.parts.length; a++) {
o.parts[a](i.parts[a]);
}
for (; a < i.parts.length; a++) {
o.parts.push(y(i.parts[a], e));
}
} else {
var p = [];
for (a = 0; a < i.parts.length; a++) {
p.push(y(i.parts[a], e));
}
r[i.id] = {
id: i.id,
refs: 1,
parts: p
};
}
}
}
function h(t, e) {
for (var n = [], i = {}, o = 0; o < t.length; o++) {
var r = t[o],
a = e.base ? r[0] + e.base : r[0],
p = {
css: r[1],
media: r[2],
sourceMap: r[3]
};
i[a] ? i[a].parts.push(p) : n.push(i[a] = {
id: a,
parts: [p]
});
}
return n;
}
function f(t, e) {
var n = p(t.insertInto);
if (!n) throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");
var i = u[u.length - 1];
if ("top" === t.insertAt) i ? i.nextSibling ? n.insertBefore(e, i.nextSibling) : n.appendChild(e) : n.insertBefore(e, n.firstChild), u.push(e); else if ("bottom" === t.insertAt) n.appendChild(e); else {
if ("object" != _typeof(t.insertAt) || !t.insertAt.before) throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");
var o = p(t.insertAt.before, n);
n.insertBefore(e, o);
}
}
function g(t) {
if (null === t.parentNode) return !1;
t.parentNode.removeChild(t);
var e = u.indexOf(t);
e >= 0 && u.splice(e, 1);
}
function m(t) {
var e = document.createElement("style");
if (void 0 === t.attrs.type && (t.attrs.type = "text/css"), void 0 === t.attrs.nonce) {
var i = function () {
0;
return n.nc;
}();
i && (t.attrs.nonce = i);
}
return v(e, t.attrs), f(t, e), e;
}
function v(t, e) {
Object.keys(e).forEach(function (n) {
t.setAttribute(n, e[n]);
});
}
function y(t, e) {
var n, i, o, r;
if (e.transform && t.css) {
if (!(r = "function" == typeof e.transform ? e.transform(t.css) : e.transform.default(t.css))) return function () {
};
t.css = r;
}
if (e.singleton) {
var a = l++;
n = s || (s = m(e)), i = T.bind(null, n, a, !1), o = T.bind(null, n, a, !0);
} else t.sourceMap && "function" == typeof URL && "function" == typeof URL.createObjectURL && "function" == typeof URL.revokeObjectURL && "function" == typeof Blob && "function" == typeof btoa ? (n = function (t) {
var e = document.createElement("link");
return void 0 === t.attrs.type && (t.attrs.type = "text/css"), t.attrs.rel = "stylesheet", v(e, t.attrs), f(t, e), e;
}(e), i = function (t, e, n) {
var i = n.css,
o = n.sourceMap,
r = void 0 === e.convertToAbsoluteUrls && o;
(e.convertToAbsoluteUrls || r) && (i = d(i));
o && (i += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(o)))) + " */");
var a = new Blob([i], {
type: "text/css"
}),
p = t.href;
t.href = URL.createObjectURL(a), p && URL.revokeObjectURL(p);
}.bind(null, n, e), o = function o() {
g(n), n.href && URL.revokeObjectURL(n.href);
}) : (n = m(e), i = function (t, e) {
var n = e.css,
i = e.media;
i && t.setAttribute("media", i);
if (t.styleSheet) t.styleSheet.cssText = n; else {
for (; t.firstChild;) {
t.removeChild(t.firstChild);
}
t.appendChild(document.createTextNode(n));
}
}.bind(null, n), o = function o() {
g(n);
});
return i(t), function (e) {
if (e) {
if (e.css === t.css && e.media === t.media && e.sourceMap === t.sourceMap) return;
i(t = e);
} else o();
};
}
t.exports = function (t, e) {
if ("undefined" != typeof DEBUG && DEBUG && "object" != (typeof document === "undefined" ? "undefined" : _typeof(document))) throw new Error("The style-loader cannot be used in a non-browser environment");
(e = e || {}).attrs = "object" == _typeof(e.attrs) ? e.attrs : {}, e.singleton || "boolean" == typeof e.singleton || (e.singleton = a()), e.insertInto || (e.insertInto = "head"), e.insertAt || (e.insertAt = "bottom");
var n = h(t, e);
return c(n, e), function (t) {
for (var i = [], o = 0; o < n.length; o++) {
var a = n[o];
(p = r[a.id]).refs-- , i.push(p);
}
t && c(h(t, e), e);
for (o = 0; o < i.length; o++) {
var p;
if (0 === (p = i[o]).refs) {
for (var s = 0; s < p.parts.length; s++) {
p.parts[s]();
}
delete r[p.id];
}
}
};
};
var b,
E = (b = [], function (t, e) {
return b[t] = e, b.filter(Boolean).join("\n");
});
function T(t, e, n, i) {
var o = n ? "" : i.css;
if (t.styleSheet) t.styleSheet.cssText = E(e, o); else {
var r = document.createTextNode(o),
a = t.childNodes;
a[e] && t.removeChild(a[e]), a.length ? t.insertBefore(r, a[e]) : t.appendChild(r);
}
}
}, function (t, e) {
t.exports = function (t) {
var e = "undefined" != typeof window && window.location;
if (!e) throw new Error("fixUrls requires window.location");
if (!t || "string" != typeof t) return t;
var n = e.protocol + "//" + e.host,
i = n + e.pathname.replace(/\/[^\/]*$/, "/");
return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function (t, e) {
var o,
r = e.trim().replace(/^"(.*)"$/, function (t, e) {
return e;
}).replace(/^'(.*)'$/, function (t, e) {
return e;
});
return /^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r) ? t : (o = 0 === r.indexOf("//") ? r : 0 === r.indexOf("/") ? n + r : i + r.replace(/^\.\//, ""), "url(" + JSON.stringify(o) + ")");
});
};
}, function (t, e) {
var n, i;
window, document, n = jQuery, (i = function i(t, e) {
this.init(t, e);
}).prototype = {
init: function init(t, e) {
this.ele = t, this.defaults = {
menu: [{
text: "text",
menus: [{}, {}],
callback: function callback() {
}
}],
target: function target(t) {
},
width: 100,
itemHeight: 28,
bgColor: "#fff",
color: "#333",
fontSize: 14,
hoverBgColor: "#f5f5f5"
}, this.opts = n.extend(!0, {}, this.defaults, e), this.random = new Date().getTime() + parseInt(1e3 * Math.random()), this.eventBind();
},
renderMenu: function renderMenu(t, e) {
var n = this,
i = e;
if (t && t.length) {
var o = $('
');
i || (i = o).addClass("hicontextmenuroot"), $.each(t, function (t, e) {
var i = !!e.disable && e.disable(),
r = $('
`);
}
} catch (t) {
console.log(t), a.html(`${i18n.__('二维码生成失败')}`);
}
}
}
}, 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;
}(f.a),
I = 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());
};
}(),
R = function (t) {
function e(e) {
return t.call(this, e) || this;
}
return I(e, t), e;
}(g.a),
M = 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());
};
}(),
S = function (t) {
function e(e, n) {
var i = t.call(this, e) || this;
return i.options = new R(n), i.options.setDefault(new R(p.a.instance.html.default).getPrintElementOptionEntity()), i;
}
return M(e, t), e.prototype.updateDesignViewFromOptions = function () {
if (this.designTarget) {
var t = this.getData();
this.css(this.designTarget, t), this.updateTargetHtml();
}
}, e.prototype.updateTargetHtml = function () {
var t = this.getFormatter();
if (t) {
var e = t(this.getData(), this.options, this._currenttemplateData);
this.designTarget.find(".hiprint-printElement-html-content").html(e);
}
}, e.prototype.getConfigOptions = function () {
return p.a.instance.html;
}, e.prototype.createTarget = function (t, e) {
var n = $('
'),
i = this.getFormatter();
if (i) {
var o = i(this.getData(), this.options, this._currenttemplateData);
n.find(".hiprint-printElement-html-content").append(o);
} else this.options.content && n.find(".hiprint-printElement-html-content").append(this.options.content);
return n;
}, e.prototype.getHtml = function (t, e, n) {
return this.getHtml2(t, e, n);
}, e;
}(f.a),
B = 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());
};
}(),
F = function (t) {
function e(e, n) {
var i = t.call(this, e) || this;
return i.options = new g.a(n), i.options.setDefault(new g.a(p.a.instance.vline.default).getPrintElementOptionEntity()), i;
}
return B(e, t), e.prototype.updateDesignViewFromOptions = function () {
if (this.designTarget) {
var t = this.getData();
this.css(this.designTarget, t);
}
}, e.prototype.getConfigOptions = function () {
return p.a.instance.vline;
}, e.prototype.createTarget = function (t, e) {
return $('');
}, e.prototype.getReizeableShowPoints = function () {
return ["s", "r"];
}, e.prototype.getHtml = function (t, e, n) {
return this.getHtml2(t, e, n);
}, e;
}(f.a),
L = 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());
};
}(),
A = function (t) {
function e(e, n) {
var i = t.call(this, e) || this;
return i.options = new g.a(n), i.options.setDefault(new g.a(p.a.instance.hline.default).getPrintElementOptionEntity()), i;
}
return L(e, t), e.prototype.updateDesignViewFromOptions = function () {
if (this.designTarget) {
var t = this.getData();
this.css(this.designTarget, t);
}
}, e.prototype.getConfigOptions = function () {
return p.a.instance.hline;
}, e.prototype.createTarget = function (t, e) {
return $('');
}, e.prototype.getReizeableShowPoints = function () {
return ["e", "r"];
}, e;
}(f.a),
z = 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());
};
}(),
k = function (t) {
function e(e, n) {
var i = t.call(this, e) || this;
return i.options = new g.a(n), i.options.setDefault(new g.a(p.a.instance.rect.default).getPrintElementOptionEntity()), i;
}
return z(e, t), e.prototype.updateDesignViewFromOptions = function () {
if (this.designTarget) {
var t = this.getData();
this.css(this.designTarget, t);
}
}, e.prototype.getConfigOptions = function () {
return p.a.instance.rect;
}, e.prototype.createTarget = function (t, e) {
return $('');
}, e.prototype.getHtml = function (t, e, n) {
return this.getHtml2(t, e, n);
}, e;
}(f.a),
N = 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());
};
}(),
V = function (t) {
function e(e, n) {
var i = t.call(this, e) || this;
return i.options = new g.a(n), i.options.setDefault(new g.a(p.a.instance.oval.default).getPrintElementOptionEntity()), i;
}
return N(e, t), e.prototype.updateDesignViewFromOptions = function () {
if (this.designTarget) {
var t = this.getData();
this.css(this.designTarget, t);
}
}, e.prototype.getConfigOptions = function () {
return p.a.instance.oval;
}, e.prototype.createTarget = function (t, e) {
return $('');
}, e.prototype.getHtml = function (t, e, n) {
return this.getHtml2(t, e, n);
}, e;
}(f.a),
barcode = function(t) {
function e(e, n) {
var i = t.call(this, e) || this;
return i.options = new g.a(n), i.options.setDefault(new g.a(p.a.instance.barcode.default).getPrintElementOptionEntity()), i;
}
return N(e, t), e.prototype.updateDesignViewFromOptions = function () {
if (this.designTarget) {
var t = this.getData();
this.css(this.designTarget, t), this.initBarcode(this.designTarget, this.getTitle(), this.getData());
}
}, e.prototype.getConfigOptions = function () {
return p.a.instance.barcode;
}, e.prototype.getBarAutoWidth = function () {
return (null == this.options.barAutoWidth ? this.options.defaultOptions.barAutoWidth === "true" : this.options.barAutoWidth === "true") ?? true;
}, e.prototype.onResize = function (e, n, i, o, r) {
t.prototype.onResize.call(this, e, n, i, o, r);
this.initBarcode(this.designTarget, this.getTitle(), this.getData())
}, e.prototype.getTitle = function () {
return this.options.title || this.printElementType.title;
}, e.prototype.getData = function (t) {
var e = void 0;
var f = this.getField();
e = t ? f ? f.split('.').reduce((a, c) => a ? a[c] : t ? t[c] : "", !1) || "" : "" : this.options.testData || this.printElementType.getData() || ""
return e;
}, e.prototype.initBarcode = function (designTarget, title, text) {
designTarget = designTarget || this.designTarget
var content = designTarget.find('.hiprint-printElement-barcode-content')
try {
// 计算 barcode 的高度,判断是否需要减去 title,使 title 包含在元素内部
const height = o.a.pt.toMm(this.options.height - (!this.options.hideTitle ? this.options.lineHeight ?? (this.options.fontSize ?? 10.5) * 1.5 :0));
var barcode = bwipjs.toSVG({
bcid: this.options.barcodeType || 'code128',
text: text || this.options.testData || this.options.title,
scale: this.options.barWidth || 1,
width: !this.getBarAutoWidth() ? parseInt(o.a.pt.toMm(this.options.getWidth())) : '',
height: parseInt(height),
includetext: !this.options.hideTitle,
barcolor: this.options.barColor || "#000",
})
// pub-beta 0.0.57-beta22 优化了条码自动调整宽度的逻辑,title 文本改为使用 bwipjs 文本内部实现
barcode = $(barcode)
// pub-beta 0.0.57-beta22 svg 元素需要添加 preserveAspectRatio 属性,使其横向可以自适应缩放
barcode.attr("preserveAspectRatio", "none slice")
let svgWidth = barcode[0].attributes.viewBox.value.split(" ")[2]; // 通过 viewBox 属性获取 bwipjs 内部生成的 svg 宽度
svgWidth = Math.ceil(hinnn.px.toPt(svgWidth * 1.05));
if (this.getBarAutoWidth() && svgWidth > this.options.width) {
content.parent().css("width", svgWidth + 'pt')
barcode.css("height", "100%");
this.options.width = svgWidth;
}
content.html(barcode)
// if (!this.options.hideTitle) {
// const titleText = title ? title + ( text ? ':' : '' ) : '';
// const textAlign = this.options.textAlign || 'center';
// // 支持type为barcode的textAlign属性
// const textStyle = textAlign === 'justify' ? 'text-align-last: justify;text-justify: distribute-all-lines;' : `text-align: ${ textAlign };`
// content.append($(`