@ohayojp.com/components
Version:
Common business components of ohayojp.
21 lines (19 loc) • 62.3 kB
JavaScript
/**
* @license ohayojp(cipchk@qq.com) v1.0.0
* (c) 2020 cipchk https://ohayojp.com/
* License: MIT
*/
!function (t, e) { "object" == typeof exports && "undefined" != typeof module ? e(exports, require("@angular/core"), require("@angular/platform-browser"), require("@ohayojp.com/acl"), require("@ohayojp.com/theme"), require("@ohayojp.com/util"), require("@angular/common"), require("@angular/common/http"), require("rxjs"), require("rxjs/operators"), require("@ohayojp.com/components/xlsx"), require("@angular/router"), require("@angular/forms"), require("ng-zorro-antd/badge"), require("ng-zorro-antd/checkbox"), require("ng-zorro-antd/divider"), require("ng-zorro-antd/dropdown"), require("ng-zorro-antd/icon"), require("ng-zorro-antd/input"), require("ng-zorro-antd/menu"), require("ng-zorro-antd/popconfirm"), require("ng-zorro-antd/radio"), require("ng-zorro-antd/resizable"), require("ng-zorro-antd/table"), require("ng-zorro-antd/tag"), require("ng-zorro-antd/tooltip")) : "function" == typeof define && define.amd ? define("@ohayojp.com/components/st", ["exports", "@angular/core", "@angular/platform-browser", "@ohayojp.com/acl", "@ohayojp.com/theme", "@ohayojp.com/util", "@angular/common", "@angular/common/http", "rxjs", "rxjs/operators", "@ohayojp.com/components/xlsx", "@angular/router", "@angular/forms", "ng-zorro-antd/badge", "ng-zorro-antd/checkbox", "ng-zorro-antd/divider", "ng-zorro-antd/dropdown", "ng-zorro-antd/icon", "ng-zorro-antd/input", "ng-zorro-antd/menu", "ng-zorro-antd/popconfirm", "ng-zorro-antd/radio", "ng-zorro-antd/resizable", "ng-zorro-antd/table", "ng-zorro-antd/tag", "ng-zorro-antd/tooltip"], e) : e(((t = "undefined" != typeof globalThis ? globalThis : t || self).ohayo = t.ohayo || {}, t.ohayo.components = t.ohayo.components || {}, t.ohayo.components.st = {}), t.ng.core, t.ng.platformBrowser, t.ohayo.acl, t.ohayo.theme, t.ohayo.util, t.ng.common, t.ng.common.http, t.rxjs, t.rxjs.operators, t.ohayo.components.xlsx, t.ng.router, t.ng.forms, t["ng-zorro-antd/badge"], t["ng-zorro-antd/checkbox"], t["ng-zorro-antd/divider"], t["ng-zorro-antd/dropdown"], t["ng-zorro-antd/icon"], t["ng-zorro-antd/input"], t["ng-zorro-antd/menu"], t["ng-zorro-antd/popconfirm"], t["ng-zorro-antd/radio"], t.resizable, t["ng-zorro-antd/table"], t["ng-zorro-antd/tag"], t["ng-zorro-antd/tooltip"]) }(this, (function (t, e, n, r, o, i, a, l, s, c, p, u, d, h, f, g, m, y, b, v, x, _, w, z, C, S) {
"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */function T(t, e, n, r) { var o, i = arguments.length, a = i < 3 ? e : null === r ? r = Object.getOwnPropertyDescriptor(e, n) : r; if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) a = Reflect.decorate(t, e, n, r); else for (var l = t.length - 1; l >= 0; l--)(o = t[l]) && (a = (i < 3 ? o(a) : i > 3 ? o(e, n, a) : o(e, n)) || a); return i > 3 && a && Object.defineProperty(e, n, a), a } function k(t, e) { if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(t, e) } function O(t, e, n, r) { return new (n || (n = Promise))((function (o, i) { function a(t) { try { s(r.next(t)) } catch (t) { i(t) } } function l(t) { try { s(r.throw(t)) } catch (t) { i(t) } } function s(t) { var e; t.done ? o(t.value) : (e = t.value, e instanceof n ? e : new n((function (t) { t(e) }))).then(a, l) } s((r = r.apply(t, e || [])).next()) })) } function I(t, e) { var n, r, o, i, a = { label: 0, sent: function () { if (1 & o[0]) throw o[1]; return o[1] }, trys: [], ops: [] }; return i = { next: l(0), throw: l(1), return: l(2) }, "function" == typeof Symbol && (i[Symbol.iterator] = function () { return this }), i; function l(i) { return function (l) { return function (i) { if (n) throw new TypeError("Generator is already executing."); for (; a;)try { if (n = 1, r && (o = 2 & i[0] ? r.return : i[0] ? r.throw || ((o = r.return) && o.call(r), 0) : r.next) && !(o = o.call(r, i[1])).done) return o; switch (r = 0, o && (i = [2 & i[0], o.value]), i[0]) { case 0: case 1: o = i; break; case 4: return a.label++, { value: i[1], done: !1 }; case 5: a.label++, r = i[1], i = [0]; continue; case 7: i = a.ops.pop(), a.trys.pop(); continue; default: if (!(o = a.trys, (o = o.length > 0 && o[o.length - 1]) || 6 !== i[0] && 2 !== i[0])) { a = 0; continue } if (3 === i[0] && (!o || i[1] > o[0] && i[1] < o[3])) { a.label = i[1]; break } if (6 === i[0] && a.label < o[1]) { a.label = o[1], o = i; break } if (o && a.label < o[2]) { a.label = o[2], a.ops.push(i); break } o[2] && a.ops.pop(), a.trys.pop(); continue }i = e.call(t, a) } catch (t) { i = [6, t], r = 0 } finally { n = o = 0 } if (5 & i[0]) throw i[1]; return { value: i[0] ? i[1] : void 0, done: !0 } }([i, l]) } } } Object.create; function j(t) { var e = "function" == typeof Symbol && Symbol.iterator, n = e && t[e], r = 0; if (n) return n.call(t); if (t && "number" == typeof t.length) return { next: function () { return t && r >= t.length && (t = void 0), { value: t && t[r++], done: !t } } }; throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined.") } function M(t, e) { var n = "function" == typeof Symbol && t[Symbol.iterator]; if (!n) return t; var r, o, i = n.call(t), a = []; try { for (; (void 0 === e || e-- > 0) && !(r = i.next()).done;)a.push(r.value) } catch (t) { o = { error: t } } finally { try { r && !r.done && (n = i.return) && n.call(i) } finally { if (o) throw o.error } } return a } function P() { for (var t = [], e = 0; e < arguments.length; e++)t = t.concat(M(arguments[e])); return t } Object.create; var N = function () { function t() { this.titles = {}, this.rows = {} } return t.prototype.add = function (t, e, n) { this["title" === t ? "titles" : "rows"][e] = n }, t.prototype.getTitle = function (t) { return this.titles[t] }, t.prototype.getRow = function (t) { return this.rows[t] }, t }(); N.decorators = [{ type: e.Injectable }]; var D = function () { function t(t, e) { this.ref = t, this.source = e } return t.prototype.ngOnInit = function () { this.source.add(this.type, this.id, this.ref) }, t }(); D.decorators = [{ type: e.Directive, args: [{ selector: "[st-row]" }] }], D.ctorParameters = function () { return [{ type: e.TemplateRef }, { type: N, decorators: [{ type: e.Host }] }] }, D.propDecorators = { id: [{ type: e.Input, args: ["st-row"] }], type: [{ type: e.Input }] }; var R = function () { function t() { this._widgets = {} } return Object.defineProperty(t.prototype, "widgets", { get: function () { return this._widgets }, enumerable: !1, configurable: !0 }), t.prototype.register = function (t, e) { this._widgets[t] = e }, t.prototype.has = function (t) { return this._widgets.hasOwnProperty(t) }, t.prototype.get = function (t) { return this._widgets[t] }, t }(); R.decorators = [{ type: e.Injectable, args: [{ providedIn: "root" }] }], R.ɵprov = e.ɵɵdefineInjectable({ factory: function () { return new R }, token: R, providedIn: "root" }); var E = function () { function t(t, e, n, r, o) { this.dom = t, this.rowSource = e, this.acl = n, this.i18nSrv = r, this.stWidgetRegistry = o } return t.prototype.setCog = function (t) { this.cog = t }, t.prototype.fixPop = function (t, e) { if (null != t.pop && !1 !== t.pop) { var n = Object.assign({}, e); "string" == typeof t.pop ? n.title = t.pop : "object" == typeof t.pop && (n = Object.assign(Object.assign({}, n), t.pop)), "function" != typeof n.condition && (n.condition = function () { return !1 }), t.pop = n } else t.pop = !1 }, t.prototype.btnCoerce = function (t) { var e, n; if (!t) return []; var r = [], o = this.cog, i = o.modal, a = o.drawer, l = o.pop, s = o.btnIcon; try { for (var c = j(t), p = c.next(); !p.done; p = c.next()) { var u = p.value; this.acl && u.acl && !this.acl.can(u.acl) || ("modal" !== u.type && "static" !== u.type || (null == u.modal || null == u.modal.component ? (console.warn("[st] Should specify modal parameter"), u.type = "none") : u.modal = Object.assign(Object.assign({ paramsName: "record", size: "lg" }, i), u.modal)), "drawer" === u.type && (null == u.drawer || null == u.drawer.component ? (console.warn("[st] Should specify drawer parameter"), u.type = "none") : u.drawer = Object.assign(Object.assign({ paramsName: "record", size: "lg" }, a), u.drawer)), "del" === u.type && void 0 === u.pop && (u.pop = !0), this.fixPop(u, l), u.icon && (u.icon = Object.assign(Object.assign({}, s), "string" == typeof u.icon ? { type: u.icon } : u.icon)), u.children = u.children && u.children.length > 0 ? this.btnCoerce(u.children) : [], u.i18n && this.i18nSrv && (u.text = this.i18nSrv.fanyi(u.i18n)), r.push(u)) } } catch (t) { e = { error: t } } finally { try { p && !p.done && (n = c.return) && n.call(c) } finally { if (e) throw e.error } } return this.btnCoerceIf(r), r }, t.prototype.btnCoerceIf = function (t) { var e, n; try { for (var r = j(t), o = r.next(); !o.done; o = r.next()) { var i = o.value; i.iif || (i.iif = function () { return !0 }), i.iifBehavior = i.iifBehavior || this.cog.iifBehavior, i.children && i.children.length > 0 ? this.btnCoerceIf(i.children) : i.children = [] } } catch (t) { e = { error: t } } finally { try { o && !o.done && (n = r.return) && n.call(r) } finally { if (e) throw e.error } } }, t.prototype.fixedCoerce = function (t) { var e = function (t, e) { return t + +e.width.toString().replace("px", "") }; t.filter((function (t) { return t.fixed && "left" === t.fixed && t.width })).forEach((function (n, r) { return n._left = t.slice(0, r).reduce(e, 0) + "px" })), t.filter((function (t) { return t.fixed && "right" === t.fixed && t.width })).reverse().forEach((function (n, r) { return n._right = (r > 0 ? t.slice(-r).reduce(e, 0) : 0) + "px" })) }, t.prototype.sortCoerce = function (t) { var e = this.fixSortCoerce(t); return e.reName = Object.assign(Object.assign({}, this.cog.sortReName), e.reName), e }, t.prototype.fixSortCoerce = function (t) { if (void 0 === t.sort) return { enabled: !1 }; var e = {}; return "string" == typeof t.sort ? e.key = t.sort : "boolean" != typeof t.sort ? e = t.sort : "boolean" == typeof t.sort && (e.compare = function (e, n) { return e[t.indexKey] - n[t.indexKey] }), e.key || (e.key = t.indexKey), e.enabled = !0, e }, t.prototype.filterCoerce = function (t) { var e = this; if (null == t.filter) return null; var n = t.filter; n.type = n.type || "default"; var r = "filter", o = "fill"; if ("keyword" === n.type && (null != n.menus && 0 !== n.menus.length || (n.menus = [{ value: "" }]), r = "search", o = "outline"), 0 === n.menus.length) return null; void 0 === n.multiple && (n.multiple = !0), n.confirmText = n.confirmText || this.cog.filterConfirmText, n.clearText = n.clearText || this.cog.filterClearText, n.key = n.key || t.indexKey, n.icon = n.icon || r; var i = { type: r, theme: o }; return "string" == typeof n.icon ? n.icon = Object.assign(Object.assign({}, i), { type: n.icon }) : n.icon = Object.assign(Object.assign({}, i), n.icon), this.updateDefault(n), this.acl && (n.menus = n.menus.filter((function (t) { return e.acl.can(t.acl) }))), n.menus.length <= 0 && (n = null), n }, t.prototype.restoreRender = function (t) { t.renderTitle && (t.__renderTitle = "string" == typeof t.renderTitle ? this.rowSource.getTitle(t.renderTitle) : t.renderTitle), t.render && (t.__render = "string" == typeof t.render ? this.rowSource.getRow(t.render) : t.render) }, t.prototype.widgetCoerce = function (t) { var e; "widget" === t.type && (null != t.widget && this.stWidgetRegistry.has(t.widget.type) || (delete t.type, i.warn('st: No widget for type "' + (null === (e = t.widget) || void 0 === e ? void 0 : e.type) + '"'))) }, t.prototype.genHeaders = function (t) { var e = [], n = [], r = function (t, o, i) { void 0 === i && (i = 0), e[i] = e[i] || []; var a = o; return t.map((function (t) { var o = { column: t, colStart: a, hasSubColumns: !1 }, l = 1, s = t.children; return Array.isArray(s) && s.length > 0 ? (l = r(s, a, i + 1).reduce((function (t, e) { return t + e }), 0), o.hasSubColumns = !0) : n.push(o.column.width || ""), "colSpan" in t && (l = t.colSpan), "rowSpan" in t && (o.rowSpan = t.rowSpan), o.colSpan = l, o.colEnd = o.colStart + l - 1, e[i].push(o), a += l, l })) }; r(t, 0); for (var o = e.length, i = function (t) { e[t].forEach((function (e) { "rowSpan" in e || e.hasSubColumns || (e.rowSpan = o - t) })) }, a = 0; a < o; a += 1)i(a); return { headers: e, headerWidths: o > 1 ? n : null } }, t.prototype.cleanCond = function (t) { var e, n, r = [], o = i.deepCopy(t); try { for (var a = j(o), l = a.next(); !l.done; l = a.next()) { var s = l.value; s.iif && !s.iif(s) || (this.acl && s.acl && !this.acl.can(s.acl) || r.push(s)) } } catch (t) { e = { error: t } } finally { try { l && !l.done && (n = a.return) && n.call(a) } finally { if (e) throw e.error } } return r }, t.prototype.process = function (t, e) { var n = this; if (!t || 0 === t.length) throw new Error("[st]: the columns property muse be define!"); var r = this.cog.noIndex, o = 0, i = 0, a = 0, l = [], s = function (t) { t.index && (Array.isArray(t.index) || (t.index = t.index.split(".")), t.indexKey = t.index.join(".")); var l = ("string" == typeof t.title ? { text: t.title } : t.title) || {}; return l.i18n && n.i18nSrv && (l.text = n.i18nSrv.fanyi(l.i18n)), l.text && (l._text = n.dom.bypassSecurityTrustHtml(l.text)), t.title = l, "no" === t.type && (t.noIndex = null == t.noIndex ? r : t.noIndex), null == t.selections && (t.selections = []), "checkbox" === t.type && (++o, t.width || (t.width = (t.selections.length > 0 ? 62 : 50) + "px")), n.acl && (t.selections = t.selections.filter((function (t) { return n.acl.can(t.acl) }))), "radio" === t.type && (++i, t.selections = [], t.width || (t.width = "50px")), "yn" === t.type && (t.yn = Object.assign({ truth: !0 }, t.yn)), ("link" === t.type && "function" != typeof t.click || "badge" === t.type && null == t.badge || "tag" === t.type && null == t.tag || "enum" === t.type && null == t.enum) && (t.type = ""), t._isTruncate = !!t.width && "truncate" === e.widthMode.strictBehavior && "img" !== t.type, t.className || (t.className = { number: "text-right", currency: "text-right", date: "text-center" }[t.type]), t._className = t.className || (t._isTruncate ? "text-truncate" : null), "number" == typeof t.width && (t.width = t.width + "px"), t._sort = n.sortCoerce(t), t.filter = n.filterCoerce(t), t.buttons = n.btnCoerce(t.buttons), n.widgetCoerce(t), n.restoreRender(t), t.resizable = Object.assign(Object.assign({ disabled: !0, bounds: "window", minWidth: 60, maxWidth: 360, preview: !0 }, e.resizable), "boolean" == typeof t.resizable ? { disabled: !t.resizable } : t.resizable), t.__point = a++, t }, c = function (t) { var e, n; try { for (var r = j(t), o = r.next(); !o.done; o = r.next()) { var i = o.value; l.push(s(i)), Array.isArray(i.children) && c(i.children) } } catch (t) { e = { error: t } } finally { try { o && !o.done && (n = r.return) && n.call(r) } finally { if (e) throw e.error } } }, p = this.cleanCond(t); if (c(p), o > 1) throw new Error("[st]: just only one column checkbox"); if (i > 1) throw new Error("[st]: just only one column radio"); return this.fixedCoerce(l), Object.assign({ columns: l.filter((function (t) { return !Array.isArray(t.children) || 0 === t.children.length })) }, this.genHeaders(p)) }, t.prototype.restoreAllRender = function (t) { var e = this; t.forEach((function (t) { return e.restoreRender(t) })) }, t.prototype.updateDefault = function (t) { return "default" === t.type ? t.default = -1 !== t.menus.findIndex((function (t) { return t.checked })) : t.default = !!t.menus[0].value, this }, t.prototype.cleanFilter = function (t) { var e = t.filter; return e.default = !1, "default" === e.type ? e.menus.forEach((function (t) { return t.checked = !1 })) : e.menus[0].value = void 0, this }, t }(); E.decorators = [{ type: e.Injectable }], E.ctorParameters = function () { return [{ type: n.DomSanitizer }, { type: N, decorators: [{ type: e.Host }] }, { type: r.ACLService, decorators: [{ type: e.Optional }] }, { type: void 0, decorators: [{ type: e.Optional }, { type: e.Inject, args: [o.OHAYO_I18N_TOKEN] }] }, { type: R }] }; var B = function () { function t(t, e, n, r, o, i) { this.http = t, this.currentyPipe = e, this.datePipe = n, this.ynPipe = r, this.numberPipe = o, this.dom = i, this.sortTick = 0 } return t.prototype.process = function (t) { var e, n, r, o, a, l, p = this, u = !1, d = t.data, h = t.res, f = t.total, g = t.page, m = t.pi, y = t.ps, b = t.paginator, v = t.columns, x = g.show; return "string" == typeof d ? (u = !0, e = this.getByHttp(d, t).pipe(c.map((function (t) { var e; if (l = t, Array.isArray(t)) n = (e = t).length, r = n, x = !1; else { null != (e = i.deepGet(t, h.reName.list, [])) && Array.isArray(e) || (e = []); var o = h.reName.total && i.deepGet(t, h.reName.total, null); n = null == o ? f || 0 : +o } return i.deepCopy(e) })))) : e = Array.isArray(d) ? s.of(d) : d, u || (e = e.pipe(c.map((function (t) { l = t; var e = i.deepCopy(t), n = p.getSorterFn(v); return n && (e = e.sort(n)), e })), c.map((function (t) { return v.filter((function (t) { return t.filter })).forEach((function (e) { var n = e.filter, r = p.getFilteredData(n); if (0 !== r.length) { var o = n.fn; "function" == typeof o ? t = t.filter((function (t) { return r.some((function (e) { return o(e, t) })) })) : console.warn("[st] Muse provide the fn function in filter") } })), t })), c.map((function (t) { if (b && g.front) { var e = Math.ceil(t.length / y); if (a = Math.max(1, m > e ? e : m), n = t.length, !0 === g.show) return t.slice((a - 1) * y, a * y) } return t })))), "function" == typeof h.process && (e = e.pipe(c.map((function (t) { return h.process(t, l) })))), (e = e.pipe(c.map((function (e) { return p.optimizeData({ result: e, columns: v, rowClassName: t.rowClassName }) })))).pipe(c.map((function (t) { var e = n || f, i = r || y; return { pi: a, ps: r, total: n, list: o = t, statistical: p.genStatistical(v, o, l), pageShow: void 0 === x ? e > i : x } }))) }, t.prototype.get = function (t, e, n) { if (e.format) { var r = e.format(t, e, n) || ""; return r && ~r.indexOf("</") ? { text: r, _text: this.dom.bypassSecurityTrustHtml(r), org: r } : { text: r, _text: r, org: r } } var o, a = i.deepGet(t, e.index, e.default), l = a; switch (e.type) { case "no": l = this.getNoIndex(t, e, n); break; case "img": l = a ? '<img src="' + a + '" class="img">' : ""; break; case "number": l = this.numberPipe.transform(a, e.numberDigits); break; case "currency": l = this.currentyPipe.transform(a); break; case "date": l = a === e.default ? e.default : this.datePipe.transform(a, e.dateFormat); break; case "yn": l = this.ynPipe.transform(a === e.yn.truth, e.yn.yes, e.yn.no, e.yn.mode, !1); break; case "enum": l = e.enum[a]; break; case "tag": case "badge": var s = "tag" === e.type ? e.tag : e.badge; if (s && s[l]) { var c = s[l]; l = c.text, o = c.color } else l = "" }return null == l && (l = ""), { text: l, _text: this.dom.bypassSecurityTrustHtml(l), org: a, color: o } }, t.prototype.getByHttp = function (t, e) { var n, r, o = e.req, i = e.page, a = e.paginator, s = e.pi, c = e.ps, p = e.singleSort, u = e.multiSort, d = e.columns, h = (o.method || "GET").toUpperCase(), f = {}, g = o.reName; a && ("page" === o.type ? ((n = {})[g.pi] = i.zeroIndexed ? s - 1 : s, n[g.ps] = c, f = n) : ((r = {})[g.skip] = (s - 1) * c, r[g.limit] = c, f = r)); var m = { params: f = Object.assign(Object.assign(Object.assign(Object.assign({}, f), o.params), this.getReqSortMap(p, u, d)), this.getReqFilterMap(d)), body: o.body, headers: o.headers }; return "POST" === h && !0 === o.allInBody && (m = { body: Object.assign(Object.assign({}, o.body), f), headers: o.headers }), "function" == typeof o.process && (m = o.process(m)), m.params instanceof l.HttpParams || (m.params = new l.HttpParams({ fromObject: m.params })), this.http.request(h, t, m) }, t.prototype.optimizeData = function (t) { for (var e = this, n = t.result, r = t.columns, o = t.rowClassName, i = function (t, i) { n[t]._values = r.map((function (r) { return e.get(n[t], r, t) })), o && (n[t]._rowClassName = o(n[t], t)) }, a = 0, l = n.length; a < l; a++)i(a); return n }, t.prototype.getNoIndex = function (t, e, n) { return "function" == typeof e.noIndex ? e.noIndex(t, e, n) : e.noIndex + n }, t.prototype.getValidSort = function (t) { return t.filter((function (t) { return t._sort && t._sort.enabled && t._sort.default })).map((function (t) { return t._sort })) }, t.prototype.getSorterFn = function (t) { var e = this.getValidSort(t); if (0 !== e.length) { var n = e[0]; if (null !== n.compare) { if ("function" == typeof n.compare) return function (t, e) { var r = n.compare(t, e); return 0 !== r ? "descend" === n.default ? -r : r : 0 }; console.warn("[st] Muse provide the compare function in sort") } } }, Object.defineProperty(t.prototype, "nextSortTick", { get: function () { return ++this.sortTick }, enumerable: !1, configurable: !0 }), t.prototype.getReqSortMap = function (t, e, n) { var r, o = {}, i = this.getValidSort(n); if (e) { var a = Object.assign({ key: "sort", separator: "-", nameSeparator: ".", keepEmptyKey: !0, arrayParam: !1 }, e), l = i.sort((function (t, e) { return t.tick - e.tick })).map((function (t) { return t.key + a.nameSeparator + ((t.reName || {})[t.default] || t.default) })); return (r = {})[a.key] = a.arrayParam ? l : l.join(a.separator), o = r, 0 === l.length && !1 === a.keepEmptyKey ? {} : o } if (0 === i.length) return o; var s = i[0], c = s.key, p = (i[0].reName || {})[s.default] || s.default; return t && (p = c + (t.nameSeparator || ".") + p, c = t.key || "sort"), o[c] = p, o }, t.prototype.getFilteredData = function (t) { return "default" === t.type ? t.menus.filter((function (t) { return !0 === t.checked })) : t.menus.slice(0, 1) }, t.prototype.getReqFilterMap = function (t) { var e = this, n = {}; return t.filter((function (t) { return t.filter && !0 === t.filter.default })).forEach((function (t) { var r = t.filter, o = e.getFilteredData(r), i = {}; r.reName ? i = r.reName(r.menus, t) : i[r.key] = o.map((function (t) { return t.value })).join(","), n = Object.assign(Object.assign({}, n), i) })), n }, t.prototype.genStatistical = function (t, e, n) { var r = this, o = {}; return t.forEach((function (t, i) { o[t.key || t.indexKey || i] = null == t.statistical ? {} : r.getStatistical(t, i, e, n) })), o }, t.prototype.getStatistical = function (t, e, n, r) { var o = t.statistical, i = Object.assign({ digits: 2, currency: void 0 }, "string" == typeof o ? { type: o } : o), a = { value: 0 }, l = !1; if ("function" == typeof i.type) a = i.type(this.getValues(e, n), t, n, r), l = !0; else switch (i.type) { case "count": a.value = n.length; break; case "distinctCount": a.value = this.getValues(e, n).filter((function (t, e, n) { return n.indexOf(t) === e })).length; break; case "sum": a.value = this.toFixed(this.getSum(e, n), i.digits), l = !0; break; case "average": a.value = this.toFixed(this.getSum(e, n) / n.length, i.digits), l = !0; break; case "max": a.value = Math.max.apply(Math, P(this.getValues(e, n))), l = !0; break; case "min": a.value = Math.min.apply(Math, P(this.getValues(e, n))), l = !0 }return !0 === i.currency || null == i.currency && !0 === l ? a.text = this.currentyPipe.transform(a.value) : a.text = String(a.value), a }, t.prototype.toFixed = function (t, e) { return isNaN(t) || !isFinite(t) ? 0 : parseFloat(t.toFixed(e)) }, t.prototype.getValues = function (t, e) { return e.map((function (e) { return e._values[t].org })).map((function (t) { return "" === t || null == t ? 0 : t })) }, t.prototype.getSum = function (t, e) { return this.getValues(t, e).reduce((function (t, e) { return t + parseFloat(String(e)) }), 0) }, t }(); B.decorators = [{ type: e.Injectable }], B.ctorParameters = function () { return [{ type: o._HttpClient }, { type: o.CNCurrencyPipe, decorators: [{ type: e.Host }] }, { type: o.DatePipe, decorators: [{ type: e.Host }] }, { type: o.YNPipe, decorators: [{ type: e.Host }] }, { type: a.DecimalPipe, decorators: [{ type: e.Host }] }, { type: n.DomSanitizer }] }; var F = function () { function t(t) { this.xlsxSrv = t } return t.prototype._stGet = function (t, e, n) { var r = { t: "s", v: "" }; if (e.format) r.v = e.format(t, e, n); else { var o = i.deepGet(t, e.index, ""); if (r.v = o, null != o) switch (e.type) { case "currency": r.t = "n"; break; case "date": r.t = "d"; break; case "yn": var a = e.yn; r.v = r.v === a.truth ? a.yes || "是" : a.no || "否" } } return r.v = r.v || "", r }, t.prototype.genSheet = function (t) { for (var e = {}, n = e[t.sheetname || "Sheet1"] = {}, r = t.columens.filter((function (t) { return !1 !== t.exported && t.index && (!t.buttons || 0 === t.buttons.length) })), o = r.length, i = t.data.length, a = 0; a < o; a++) { var l = r[a].title; n[this.xlsxSrv.numberToSchema(a + 1) + "1"] = { t: "s", v: "object" == typeof l ? l.text : l } } for (a = 0; a < i; a++)for (var s = 0; s < o; s++)n["" + this.xlsxSrv.numberToSchema(s + 1) + (a + 2)] = this._stGet(t.data[a], r[s], a); return o > 0 && i > 0 && (n["!ref"] = "A1:" + this.xlsxSrv.numberToSchema(o) + (i + 1)), e }, t.prototype.export = function (t) { return O(this, void 0, void 0, (function () { var e; return I(this, (function (n) { return e = this.genSheet(t), [2, this.xlsxSrv.export({ sheets: e, filename: t.filename, callback: t.callback })] })) })) }, t }(); F.decorators = [{ type: e.Injectable }], F.ctorParameters = function () { return [{ type: p.XlsxService, decorators: [{ type: e.Optional }] }] }; var q = { pi: 1, ps: 10, size: "default", responsive: !0, responsiveHideHeaderFooter: !1, req: { type: "page", method: "GET", allInBody: !1, lazyLoad: !1, reName: { pi: "pi", ps: "ps", skip: "skip", limit: "limit" } }, res: { reName: { list: ["list"], total: ["total"] } }, page: { front: !0, zeroIndexed: !1, position: "bottom", placement: "right", show: !0, showSize: !1, pageSizes: [10, 20, 30, 40, 50], showQuickJumper: !1, total: !0, toTop: !0, toTopOffset: 100, itemRender: null, simple: !1 }, modal: { paramsName: "record", size: "lg", exact: !0 }, drawer: { paramsName: "record", size: "md", footer: !0, footerHeight: 55 }, pop: { title: "确认删除吗?", trigger: "click", placement: "top" }, rowClickTime: 200, btnIcon: { theme: "outline", spin: !1 }, noIndex: 1, expandRowByClick: !1, expandAccordion: !1, widthMode: { type: "default", strictBehavior: "truncate" }, virtualItemSize: 54, virtualMaxBufferPx: 200, virtualMinBufferPx: 100, iifBehavior: "hide", loadingDelay: 0 }, H = function () { function t(t, n, r, o, i, a, l, p, u, d, h, f) { var g = this; this.cdr = n, this.router = r, this.el = o, this.exportSrv = i, this.modalHelper = a, this.drawerHelper = l, this.doc = p, this.columnSource = u, this.dataSource = d, this.ohayoI18n = h, this.unsubscribe$ = new s.Subject, this.totalTpl = "", this.rowClickCount = 0, this.customWidthConfig = !1, this._widthConfig = [], this.locale = {}, this._loading = !1, this._data = [], this._statistical = {}, this._isPagination = !0, this._allChecked = !1, this._allCheckedDisabled = !1, this._indeterminate = !1, this._headers = [], this._columns = [], this.columns = [], this.ps = 10, this.pi = 1, this.total = 0, this.loading = null, this.loadingDelay = 0, this.bordered = !1, this.expandRowByClick = !1, this.expandAccordion = !1, this.rowClickTime = 200, this.responsive = !0, this.error = new e.EventEmitter, this.change = new e.EventEmitter, this.virtualScroll = !1, this.virtualItemSize = 54, this.virtualMaxBufferPx = 200, this.virtualMinBufferPx = 100, this.virtualForTrackBy = function (t) { return t }, this.setCog(f.merge("st", q)), this.ohayoI18n.change.pipe(c.takeUntil(this.unsubscribe$)).subscribe((function () { g.locale = g.ohayoI18n.getData("st"), g._columns.length > 0 && (g.updateTotalTpl(), g.cd()) })), t.change.pipe(c.takeUntil(this.unsubscribe$), c.filter((function () { return g._columns.length > 0 }))).subscribe((function () { return g.refreshColumns() })) } return Object.defineProperty(t.prototype, "req", { get: function () { return this._req }, set: function (t) { this._req = i.deepMergeKey({}, !0, this.cog.req, t) }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "res", { get: function () { return this._res }, set: function (t) { var e = this._res = i.deepMergeKey({}, !0, this.cog.res, t), n = e.reName; Array.isArray(n.list) || (n.list = n.list.split(".")), Array.isArray(n.total) || (n.total = n.total.split(".")), this._res = e }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "page", { get: function () { return this._page }, set: function (t) { this._page = Object.assign(Object.assign({}, this.cog.page), t), this.updateTotalTpl() }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "multiSort", { get: function () { return this._multiSort }, set: function (t) { "boolean" == typeof t && !i.toBoolean(t) || "object" == typeof t && 0 === Object.keys(t).length ? this._multiSort = void 0 : this._multiSort = Object.assign({}, "object" == typeof t ? t : {}) }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "widthMode", { get: function () { return this._widthMode }, set: function (t) { this._widthMode = Object.assign(Object.assign({}, this.cog.widthMode), t) }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "widthConfig", { set: function (t) { this._widthConfig = t, this.customWidthConfig = t && t.length > 0 }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "resizable", { set: function (t) { this._resizable = "object" == typeof t ? t : { disabled: !i.toBoolean(t) } }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "count", { get: function () { return this._data.length }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "list", { get: function () { return this._data }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "routerState", { get: function () { var t = this; return { pi: t.pi, ps: t.ps, total: t.total } }, enumerable: !1, configurable: !0 }), t.prototype.setCog = function (t) { var e = Object.assign({}, t.multiSort); delete t.multiSort, this.cog = t, Object.assign(this, t), !1 !== e.global && (this.multiSort = e), this.columnSource.setCog(t) }, t.prototype.cd = function () { return this.cdr.detectChanges(), this }, t.prototype.renderTotal = function (t, e) { return this.totalTpl ? this.totalTpl.replace("{{total}}", t).replace("{{range[0]}}", e[0]).replace("{{range[1]}}", e[1]) : "" }, t.prototype.changeEmit = function (t, e) { var n = { type: t, pi: this.pi, ps: this.ps, total: this.total }; null != e && (n[t] = e), this.change.emit(n) }, Object.defineProperty(t.prototype, "filteredData", { get: function () { return this.loadData({ paginator: !1 }).then((function (t) { return t.list })) }, enumerable: !1, configurable: !0 }), t.prototype.updateTotalTpl = function () { var t = this.page.total; "string" == typeof t && t.length ? this.totalTpl = t : i.toBoolean(t) ? this.totalTpl = this.locale.total : this.totalTpl = "" }, t.prototype.setLoading = function (t) { null == this.loading && (this._loading = t, this.cdr.detectChanges()) }, t.prototype.loadData = function (t) { var e = this, n = this, r = n.pi, o = n.ps, i = n.data, a = n.req, l = n.res, s = n.page, p = n.total, u = n.singleSort, d = n.multiSort, h = n.rowClassName; return new Promise((function (n, f) { e.data$ && e.data$.unsubscribe(), e.data$ = e.dataSource.process(Object.assign({ pi: r, ps: o, total: p, data: i, req: a, res: l, page: s, columns: e._columns, singleSort: u, multiSort: d, rowClassName: h, paginator: !0 }, t)).pipe(c.takeUntil(e.unsubscribe$)).subscribe((function (t) { return n(t) }), (function (t) { console.warn("st.loadDate", t), f(t) })) })) }, t.prototype.loadPageData = function () { return O(this, void 0, void 0, (function () { var t, e, n = this; return I(this, (function (r) { switch (r.label) { case 0: this.setLoading(!0), r.label = 1; case 1: return r.trys.push([1, 3, , 4]), [4, this.loadData()]; case 2: return t = r.sent(), this.setLoading(!1), void 0 !== t.pi && (this.pi = t.pi), void 0 !== t.ps && (this.ps = t.ps), void 0 !== t.total && (this.total = t.total), void 0 !== t.pageShow && (this._isPagination = t.pageShow), this._data = t.list, this._statistical = t.statistical, this.changeEmit("loaded", t.list), this.cdkVirtualScrollViewport && Promise.resolve().then((function () { return n.cdkVirtualScrollViewport.checkViewportSize() })), [2, this._refCheck()]; case 3: return e = r.sent(), this.setLoading(!1), this.unsubscribe$.isStopped || (this.cdr.detectChanges(), this.error.emit({ type: "req", error: e })), [2, this]; case 4: return [2] } })) })) }, t.prototype.clear = function (t) { return void 0 === t && (t = !0), t && this.clearStatus(), this._data = [], this.cd() }, t.prototype.clearStatus = function () { return this.clearCheck().clearRadio().clearFilter().clearSort() }, t.prototype.load = function (t, e, n) { return void 0 === t && (t = 1), -1 !== t && (this.pi = t), void 0 !== e && (this.req.params = n && n.merge ? Object.assign(Object.assign({}, this.req.params), e) : e), this._change("pi", n), this }, t.prototype.reload = function (t, e) { return this.load(-1, t, e) }, t.prototype.reset = function (t, e) { return this.clearStatus().load(1, t, e), this }, t.prototype._toTop = function (t) { if (null == t ? this.page.toTop : t) { var e = this.el.nativeElement; this.scroll ? this.cdkVirtualScrollViewport ? this.cdkVirtualScrollViewport.scrollTo({ top: 0, left: 0 }) : e.querySelector(".ant-table-body").scrollTo(0, 0) : (e.scrollIntoView(), this.doc.documentElement.scrollTop -= this.page.toTopOffset) } }, t.prototype._change = function (t, e) { var n = this; ("pi" === t || "ps" === t && this.pi <= Math.ceil(this.total / this.ps)) && this.loadPageData().then((function () { return n._toTop(null == e ? void 0 : e.toTop) })), this.changeEmit(t) }, t.prototype._click = function (t, e, n) { t.preventDefault(), t.stopPropagation(); var r = n.click(e, this); return "string" == typeof r && this.router.navigateByUrl(r, { state: this.routerState }), !1 }, t.prototype.closeOtherExpand = function (t) { !1 !== this.expandAccordion && this._data.filter((function (e) { return e !== t })).forEach((function (t) { return t.expand = !1 })) }, t.prototype._rowClick = function (t, e, n) { var r = this; if ("INPUT" !== t.target.nodeName) { var o = this, i = o.expand, a = o.expandRowByClick, l = o.rowClickTime; if (i && !1 !== e.showExpand && a) return e.expand = !e.expand, this.closeOtherExpand(e), void this.changeEmit("expand", e); ++this.rowClickCount, 1 === this.rowClickCount && setTimeout((function () { var o = { e: t, item: e, index: n }; 1 === r.rowClickCount ? r.changeEmit("click", o) : r.changeEmit("dblClick", o), r.rowClickCount = 0 }), l) } }, t.prototype._expandChange = function (t, e) { this.expandRowByClick || (t.expand = e, this.closeOtherExpand(t), this.changeEmit("expand", t)) }, t.prototype.removeRow = function (t) { var e = this; return "number" == typeof t ? this._data.splice(t, 1) : (Array.isArray(t) || (t = [t]), t.map((function (t) { return e._data.indexOf(t) })).filter((function (t) { return -1 !== t })).forEach((function (t) { return e._data.splice(t, 1) }))), this._columns.filter((function (t) { return "no" === t.type })).forEach((function (t) { return e._data.forEach((function (n, r) { return n._values[t.__point] = { _text: e.dataSource.getNoIndex(n, t, r), org: r } })) })), this.cd() }, t.prototype.setRow = function (t, e, n) { return n = Object.assign({ refreshSchema: !1, emitReload: !1 }, n), this._data[t] = i.deepMergeKey(this._data[t], !1, e), this.optimizeData(), n.refreshSchema ? (this.resetColumns({ emitReload: n.emitReload }), this) : (this.cdr.detectChanges(), this) }, t.prototype.sort = function (t, e, n) { this.multiSort ? (t._sort.default = n, t._sort.tick = this.dataSource.nextSortTick) : this._columns.forEach((function (t, r) { return t._sort.default = r === e ? n : null })), this.cdr.detectChanges(), this.loadPageData(); var r = { value: n, map: this.dataSource.getReqSortMap(this.singleSort, this.multiSort, this._columns), column: t }; this.changeEmit("sort", r) }, t.prototype.clearSort = function () { return this._columns.forEach((function (t) { return t._sort.default = null })), this }, t.prototype.handleFilter = function (t) { this.pi = 1, this.columnSource.updateDefault(t.filter), this.loadPageData(), this.changeEmit("filter", t) }, t.prototype._filterConfirm = function (t) { this.handleFilter(t) }, t.prototype._filterRadio = function (t, e, n) { t.filter.menus.forEach((function (t) { return t.checked = !1 })), e.checked = n }, t.prototype._filterClear = function (t) { this.columnSource.cleanFilter(t), this.handleFilter(t) }, t.prototype.clearFilter = function () { var t = this; return this._columns.filter((function (t) { return t.filter && !0 === t.filter.default })).forEach((function (e) { return t.columnSource.cleanFilter(e) })), this }, t.prototype._filterClick = function (t) { t.stopPropagation() }, t.prototype.clearCheck = function () { return this._checkAll(!1) }, t.prototype._refCheck = function () { var t = this._data.filter((function (t) { return !t.disabled })), e = t.filter((function (t) { return !0 === t.checked })); this._allChecked = e.length > 0 && e.length === t.length; var n = t.every((function (t) { return !t.checked })); return this._indeterminate = !this._allChecked && !n, this._allCheckedDisabled = this._data.length === this._data.filter((function (t) { return t.disabled })).length, this.cd() }, t.prototype._checkAll = function (t) { return t = void 0 === t ? this._allChecked : t, this._data.filter((function (t) { return !t.disabled })).forEach((function (e) { return e.checked = t })), this._refCheck()._checkNotify() }, t.prototype._checkSelection = function (t, e) { return t.checked = e, this._refCheck()._checkNotify() }, t.prototype._rowSelection = function (t) { return t.select(this._data), this._refCheck()._checkNotify() }, t.prototype._checkNotify = function () { var t = this._data.filter((function (t) { return !t.disabled && !0 === t.checked })); return this.changeEmit("checkbox", t), this }, t.prototype.clearRadio = function () { return this._data.filter((function (t) { return t.checked })).forEach((function (t) { return t.checked = !1 })), this.changeEmit("radio", null), this }, t.prototype._refRadio = function (t, e) { return this._data.filter((function (t) { return !t.disabled })).forEach((function (t) { return t.checked = !1 })), e.checked = t, this.changeEmit("radio", e), this }, t.prototype._btnClick = function (t, e, n) { var r, o, a = this; if (n && !0 === this.expandRowByClick && n.stopPropagation(), "modal" !== e.type && "static" !== e.type) if ("drawer" !== e.type) if ("link" !== e.type) this.btnCallback(t, e); else { var l = this.btnCallback(t, e); "string" == typeof l && this.router.navigateByUrl(l, { state: this.routerState }) } else { var s = e.drawer; u = ((o = {})[s.paramsName] = t, o); this.drawerHelper.create(s.title, s.component, Object.assign(Object.assign({}, u), s.params && s.params(t)), i.deepMergeKey({}, !0, this.cog.drawer, s)).pipe(c.filter((function (t) { return void 0 !== t }))).subscribe((function (n) { return a.btnCallback(t, e, n) })) } else { var p = e.modal, u = ((r = {})[p.paramsName] = t, r); this.modalHelper["modal" === e.type ? "create" : "createStatic"](p.component, Object.assign(Object.assign({}, u), p.params && p.params(t)), i.deepMergeKey({}, !0, this.cog.modal, p)).pipe(c.filter((function (t) { return void 0 !== t }))).subscribe((function (n) { return a.btnCallback(t, e, n) })) } }, t.prototype.btnCallback = function (t, e, n) { if (e.click) { if ("string" != typeof e.click) return e.click(t, n, this); switch (e.click) { case "load": this.load(); break; case "reload": this.reload() } } }, t.prototype._btnText = function (t, e) { return "function" == typeof e.text ? e.text(t, e) : e.text || "" }, t.prototype._validBtns = function (t, e, n) { return t.filter((function (t) { var r = t.iif(e, t, n), o = "disabled" === t.iifBehavior; return t._result = r, t._disabled = !r && o, r || o })) }, t.prototype.export = function (t, e) { var n = this; (!0 === t ? s.from(this.filteredData) : s.of(t || this._data)).subscribe((function (t) { return n.exportSrv.export(Object.assign(Object.assign({}, e), { data: t, columens: n._columns })) })) }, t.prototype.colResize = function (t, e) { var n = t.width; e.width = n + "px", this.changeEmit("resize", e) }, Object.defineProperty(t.prototype, "cdkVirtualScrollViewport", { get: function () { return this.orgTable.cdkVirtualScrollViewport }, enumerable: !1, configurable: !0 }), t.prototype.resetColumns = function (t) { return void 0 !== (t = Object.assign({ emitReload: !0, preClearData: !1 }, t)).columns && (this.columns = t.columns), void 0 !== t.pi && (this.pi = t.pi), void 0 !== t.ps && (this.ps = t.ps), t.emitReload && (t.preClearData = !0), t.preClearData && (this._data = []), this.refreshColumns(), t.emitReload ? this.loadPageData() : (this.cd(), Promise.resolve(this)) }, t.prototype.refreshColumns = function () { var t = this.columnSource.process(this.columns, { widthMode: this.widthMode, resizable: this._resizable }); return this._columns = t.columns, this._headers = t.headers, !1 === this.customWidthConfig && null != t.headerWidths && (this._widthConfig = t.headerWidths), this }, t.prototype.optimizeData = function () { this._data = this.dataSource.optimizeData({ columns: this._columns, result: this._data, rowClassName: this.rowClassName }) }, t.prototype.ngAfterViewInit = function () { this.columnSource.restoreAllRender(this._columns) }, t.prototype.ngOnChanges = function (t) { t.columns && this.refreshColumns().optimizeData(); var e = t.data; !e || !e.currentValue || this.req.lazyLoad && e.firstChange || this.loadPageData(), t.loading && (this._loading = t.loading.currentValue) }, t.prototype.ngOnDestroy = function () { var t = this.unsubscribe$; t.next(), t.complete() }, t }(); H.decorators = [{ type: e.Component, args: [{ selector: "st", exportAs: "st", template: '<ng-template #btnTpl let-i let-btn="btn">\n <ng-container *ngIf="!btn.tooltip">\n <ng-template [ngTemplateOutlet]="btnItemTpl" [ngTemplateOutletContext]="{ $implicit: i, btn: btn }"></ng-template>\n </ng-container>\n <span *ngIf="btn.tooltip" nz-tooltip [nzTooltipTitle]="btn.tooltip">\n <ng-template [ngTemplateOutlet]="btnItemTpl" [ngTemplateOutletContext]="{ $implicit: i, btn: btn }"></ng-template>\n </span>\n</ng-template>\n<ng-template #btnItemTpl let-i let-btn="btn">\n <a\n *ngIf="btn.pop"\n nz-popconfirm\n [nzPopconfirmTitle]="btn.pop.title"\n [nzIcon]="btn.pop.icon"\n [nzCondition]="btn.pop.condition(i)"\n [nzCancelText]="btn.pop.cancelText"\n [nzOkText]="btn.pop.okText"\n [nzOkType]="btn.pop.okType"\n (nzOnConfirm)="_btnClick(i, btn, $event)"\n class="st__btn-text"\n [ngClass]="btn.className"\n >\n <ng-template [ngTemplateOutlet]="btnTextTpl" [ngTemplateOutletContext]="{ $implicit: i, btn: btn }"></ng-template>\n </a>\n <a *ngIf="!btn.pop" (click)="_btnClick(i, btn, $event)" class="st__btn-text" [ngClass]="btn.className">\n <ng-template [ngTemplateOutlet]="btnTextTpl" [ngTemplateOutletContext]="{ $implicit: i, btn: btn }"></ng-template>\n </a>\n</ng-template>\n<ng-template #btnTextTpl let-i let-btn="btn">\n <ng-container *ngIf="btn.icon">\n <i\n *ngIf="!btn.icon.iconfont"\n nz-icon\n [nzType]="btn.icon.type"\n [nzTheme]="btn.icon.theme"\n [nzSpin]="btn.icon.spin"\n [nzTwotoneColor]="btn.icon.twoToneColor"\n ></i>\n <i *ngIf="btn.icon.iconfont" nz-icon [nzIconfont]="btn.icon.iconfont"></i>\n </ng-container>\n <span [innerHTML]="_btnText(i, btn)" [ngClass]="{ \'pl-xs\': btn.icon }"></span>\n</ng-template>\n<ng-template #titleTpl let-i>\n <span [innerHTML]="i._text"></span>\n <small *ngIf="i.optional" class="st__head-optional" [innerHTML]="i.optional"></small>\n <i *ngIf="i.optionalHelp" class="st__head-tip" nz-tooltip [nzTooltipTitle]="i.optionalHelp" nz-icon nzType="question-circle"></i>\n</ng-template>\n<ng-template #chkAllTpl let-custom>\n <label\n nz-checkbox\n class="st__checkall"\n [nzDisabled]="_allCheckedDisabled"\n [(ngModel)]="_allChecked"\n [nzIndeterminate]="_indeterminate"\n (ngModelChange)="_checkAll()"\n [class.ant-table-selection-select-all-custom]="custom"\n ></label>\n</ng-template>\n<nz-table\n #table\n [nzData]="_data"\n [(nzPageIndex)]="pi"\n (nzPageIndexChange)="_change(\'pi\')"\n [(nzPageSize)]="ps"\n (nzPageSizeChange)="_change(\'ps\')"\n [nzTotal]="total"\n [nzShowPagination]="_isPagination"\n [nzFrontPagination]="false"\n [nzBordered]="bordered"\n [nzSize]="size"\n [nzLoading]="_loading"\n [nzLoadingDelay]="loadingDelay"\n [nzLoadingIndicator]="loadingIndicator"\n [nzTitle]="header"\n [nzFooter]="footer"\n [nzScroll]="scroll"\n [nzVirtualItemSize]="virtualItemSize"\n [nzVirtualMaxBufferPx]="virtualMaxBufferPx"\n [nzVirtualMinBufferPx]="virtualMinBufferPx"\n [nzVirtualForTrackBy]="virtualForTrackBy"\n [nzNoResult]="noResult"\n [nzPageSizeOptions]="page.pageSizes"\n [nzShowQuickJumper]="page.showQuickJumper"\n [nzShowSizeChanger]="page.showSize"\n [nzPaginationPosition]="page.position"\n [nzItemRender]="page.itemRender"\n [nzSimple]="page.simple"\n [nzShowTotal]="totalTpl"\n [nzWidthConfig]="_widthConfig"\n>\n <thead class="st__head">\n <tr *ngFor="let row of _headers; let rowFirst = first">\n <th *ngIf="rowFirst && expand" nzWidth="50px" [rowSpan]="_headers.length"></th>\n <th\n *ngFor="let h of row; let index = index; let last = last"\n [colSpan]="h.colSpan"\n [rowSpan]="h.rowSpan"\n [nzWidth]="h.column.width"\n [nzLeft]="!!h.column._left"\n [nzRight]="!!h.column._right"\n [ngClass]="h.column.className"\n [attr.data-col]="h.column.indexKey"\n [nzShowSort]="h.column._sort.enabled"\n [nzSortOrder]="h.column._sort.default"\n (nzSortOrderChange)="sort(h.column, index, $event)"\n [nzCustomFilter]="h.column.filter"\n nz-resizable\n [nzDisabled]="last || h.column.resizable.disabled"\n [nzMaxWidth]="h.column.resizable.maxWidth"\n [nzMinWidth]="h.column.resizable.minWidth"\n [nzBounds]="h.column.resizable.bounds"\n [nzPreview]="h.column.resizable.preview"\n (nzResizeEnd)="colResize($event, h.column)"\n >\n <nz-resize-handle *ngIf="!last && !h.column.resizable.disabled" nzDirection="right"><i></i></nz-resize-handle>\n <ng-template #renderTitle [ngTemplateOutlet]="h.column.__renderTitle" [ngTemplateOutletContext]="{ $implicit: h.column, index: index }"></ng-template>\n <ng-container *ngIf="!h.column.__renderTitle; else renderTitle">\n <ng-container [ngSwitch]="h.column.type">\n <ng-container *ngSwitchCase="\'checkbox\'">\n <ng-container *ngIf="h.column.selections.length === 0">\n <ng-template [ngTemplateOutlet]="chkAllTpl" [ngTemplateOutletContext]="{ $implicit: false }"> </ng-template>\n </ng-container>\n <div *ngIf="h.column.selections.length > 0" class="ant-table-selection">\n <ng-template [ngTemplateOutlet]="chkAllTpl" [ngTemplateOutletContext]="{ $implicit: true }"> </ng-template>\n <div\n *ngIf="h.column.selections.length"\n nz-dropdown\n nzPlacement="bottomLeft"\n [nzDropdownMenu]="selectionMenu"\n class="ant-table-selection-down st__checkall-selection"\n >\n <i nz-icon nzType="down"></i>\n </div>\n <nz-dropdown-menu #selectionMenu="nzDropdownMenu">\n <ul nz-menu class="ant-table-selection-menu">\n <li nz-menu-item *ngFor="let rw of h.column.selections" (click)="_rowSelection(rw)" [innerHTML]="rw.text"></li>\n </ul>\n </nz-dropdown-menu>\n </div>\n </ng-container>\n <ng-container *ngSwitchDefault>\n <ng-template [ngTemplateOutlet]="titleTpl" [ngTemplateOutletContext]="{ $implicit: h.column.title }"></ng-template>\n </ng-container>\n </ng-container>\n </ng-container>\n <div\n nz-th-extra\n *ngIf="h.column.filter"\n class="ant-table-filter-trigger-container st__filter"\n [class.ant-table-filter-trigger-container-open]="h.column.filter.visible"\n >\n <span\n class="ant-table-filter-trigger"\n [class.active]="h.column.filter.visible || h.column.filter.default"\n nz-dropdown\n [nzDropdownMenu]="filterMenu"\n nzTrigger="click"\n [nzClickHide]="false"\n [(nzVisible)]="h.column.filter.visible"\n nzOverlayClassName="st__filter-wrap"\n (click)="_filterClick($event)"\n >\n <i nz-icon [nzType]="h.column.f