fytable
Version:
A Vue 2.x table component library with tree table and virtual scrolling support
1,295 lines • 255 kB
JavaScript
const Ge = "fytable", qe = "1.1.7", Ue = "A Vue 2.x table component library with tree table and virtual scrolling support", Ze = "dist/index.cjs.js", Je = "dist/index.es.js", Qe = "dist/index.umd.js", ti = "dist/lib/index.d.ts", ei = [
"dist",
"src"
], ii = "module", si = {
dev: "vite",
build: "vite build",
"build:types": "vue-tsc --emitDeclarationOnly",
prepublishOnly: "npm run build",
test: 'echo "Error: no test specified" && exit 1',
"build:doc": "jsdoc -c ./jsdoc.json"
}, oi = [
"vue",
"table",
"component",
"tree-table",
"virtual-scroll",
"ant-design-vue"
], ri = "", ni = "ISC", hi = {
type: "git",
url: "git+https://github.com/yourusername/fytable.git"
}, li = {
url: "https://github.com/yourusername/fytable/issues"
}, ai = "https://github.com/yourusername/fytable#readme", ci = {
access: "public"
}, di = {
vue: "^2.6.10",
"ant-design-vue": "^1.7.2"
}, ui = {
"antdesignvue-172": "^0.0.6",
"fy-virt-table": "^1.0.1"
}, fi = {
"@babel/core": "^7.22.0",
"@babel/preset-env": "^7.22.0",
"@babel/preset-typescript": "^7.22.0",
"@types/node": "^20.0.0",
"@vitejs/plugin-vue2": "^2.2.0",
"@vue/cli-plugin-babel": "^3.3.0",
"@vue/cli-plugin-eslint": "^3.3.0",
"@vue/cli-service": "^3.3.0",
"@vue/eslint-config-standard": "^4.0.0",
"babel-eslint": "7.2.3",
"babel-loader": "^9.1.2",
"compression-webpack-plugin": "^3.1.0",
eslint: "^5.16.0",
"eslint-plugin-vue": "^5.1.0",
"html-webpack-plugin": "^4.2.0",
less: "^3.9.0",
"less-loader": "^4.1.0",
"lib-flexible": "^0.3.2",
typescript: "^5.0.0",
vite: "^4.3.0",
vue: "^2.6.10",
"vue-template-compiler": "^2.6.10",
"vue-tsc": "^1.8.0"
}, xi = {
".": {
import: "./dist/index.es.js",
require: "./dist/index.cjs.js",
default: "./dist/index.umd.js"
}
}, gi = {
name: Ge,
version: qe,
description: Ue,
main: Ze,
module: Je,
browser: Qe,
types: ti,
files: ei,
type: ii,
private: !1,
scripts: si,
keywords: oi,
author: ri,
license: ni,
repository: hi,
bugs: li,
homepage: ai,
publishConfig: ci,
peerDependencies: di,
dependencies: ui,
devDependencies: fi,
exports: xi
}, de = gi.version, ue = Object.prototype.toString, Z = (o, t) => ue.call(o) === `[object ${t}]`, fe = (o) => typeof o < "u", zt = (o) => !fe(o), Pt = (o) => o !== null && ue.call(o) === "[object Object]", at = (o) => {
if (xe(o) || st(o))
return o.length === 0;
if (o instanceof Map || o instanceof Set)
return o.size === 0;
if (Pt(o))
return Object.keys(o).length === 0;
}, pi = (o) => Z(o, "Date"), Wt = (o) => o === null, yi = (o) => zt(o) && Wt(o), J = (o) => zt(o) || Wt(o), ct = (o) => Z(o, "Number"), wi = (o) => Z(o, "Promise"), st = (o) => Z(o, "String"), mi = (o) => typeof o == "function", Ei = (o) => Z(o, "Boolean"), bi = (o) => Z(o, "RegExp"), xe = (o) => o && Array.isArray(o), Ci = (o) => typeof window < "u" && Z(o, "Window"), F = { is: Z, isDef: fe, isUnDef: zt, isObject: Pt, isEmpty: at, isDate: pi, isNull: Wt, isNullAndUnDef: yi, isNullOrUnDef: J, isNumber: ct, isPromise: wi, isString: st, isRegExp: bi, isFunction: mi, isBoolean: Ei, isArray: xe, isWindow: Ci };
function vi(o, t = 0) {
const e = {};
function i(s, r) {
s.forEach((n) => {
e[n.id] = { ...n, depth: r }, n.children && n.children.length > 0 && i(n.children, r + 1);
});
}
return i(o, t), e;
}
function ge(o, t, e, i, s, r, n, h) {
var a = typeof o == "function" ? o.options : o;
t && (a.render = t, a.staticRenderFns = e, a._compiled = !0), i && (a.functional = !0), r && (a._scopeId = "data-v-" + r);
var d;
if (n ? (d = function(f) {
f = f || // cached call
this.$vnode && this.$vnode.ssrContext || // stateful
this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !f && typeof __VUE_SSR_CONTEXT__ < "u" && (f = __VUE_SSR_CONTEXT__), s && s.call(this, f), f && f._registeredComponents && f._registeredComponents.add(n);
}, a._ssrRegister = d) : s && (d = h ? function() {
s.call(
this,
(a.functional ? this.parent : this).$root.$options.shadowRoot
);
} : s), d)
if (a.functional) {
a._injectStyles = d;
var c = a.render;
a.render = function(x, g) {
return d.call(g), c(x, g);
};
} else {
var u = a.beforeCreate;
a.beforeCreate = u ? [].concat(u, d) : [d];
}
return {
exports: o,
options: a
};
}
const _i = {
name: "FYTable",
components: {},
props: {
// [{title,dataIndex,key,customRender,width,scopedSlots,align}]
columns: { type: Array, default: () => [] },
tableData: { type: Array },
// 表格数据每一行的数据主键字段名称
rowKey: { type: String, default: "id" },
// 如果有父级结构时可以需要设置 父级id对应的字段名称
rowParentKey: { type: String, default: "parentId" },
isTree: { type: Boolean, default: !1 },
isCheck: { type: Boolean, default: !1 },
event: { type: Function },
width: { type: [Number, String] },
height: { type: [Number, String] },
loading: { type: Boolean, default: !1 },
// 展示树形数据时,每层缩进的宽度,以 px 为单位
indentSize: { type: Number, default: 20 },
// ()=> Boolean 返回值为true时,checkbox不可选 返回值为false时,checkbox可选
getCheckboxDisabled: { type: Function },
// 设置默认选中值 ids 可以是 主键id 也可以是当前行的数据对象 如果是动态设置的话需要再当前值变化之后更新一下tableData中的数据使table重新渲染
setCheckboxDefaultValues: { type: Array }
},
data() {
return {
boxStyle: {
width: "100%",
height: "100%"
},
config_: {
isTree: !1,
isCheck: !1
},
checkAll: !1,
indeterminate: !1,
checkedList: [],
checkedObj: {},
// defaultCheckedObj: {},
// isSetDefaultVal: false,
tableData_: [],
columns_: [],
colgroupList_: [],
bodyCustomData: {},
flattenData_: [],
flattenDataObj_: {},
tempKeyList_: {},
tableDataKey: ""
};
},
computed: {},
watch: {
columns: {
handler(o) {
!J(o) && !at(o) && this.setColumns(o);
},
deep: !0,
immediate: !0
},
tableData: {
handler(o) {
let t = [];
!J(o) && !at(o) && (t = o), this.setTableData(t);
},
deep: !0,
immediate: !0
},
isTree: {
handler(o) {
this.config_.isTree = o;
},
deep: !0,
immediate: !0
},
isCheck: {
handler(o) {
this.config_.isCheck = o;
},
deep: !0,
immediate: !0
},
width: {
handler(o) {
let t = "";
ct(o) && (t = `${o}px`), st(o) && (t = o), this.boxStyle.width = t;
},
deep: !0,
immediate: !0
},
height: {
handler(o) {
let t = "";
ct(o) && (t = `${o}px`), st(o) && (t = o), this.boxStyle.height = t;
},
deep: !0,
immediate: !0
},
setCheckboxDefaultValues: {
handler(o) {
!J(o) && !at(o) && this.setCheckBoxDefaultVal(o);
},
deep: !0,
immediate: !0
}
},
created() {
},
mounted() {
},
methods: {
setCheckBoxDefaultVal(o) {
const t = {};
o.forEach((e) => {
st(e) && (t[e] = !0), ct(e) && (t[e] = !0), Pt(e) && (t[e[this.rowKey]] = !0);
}), this.checkedObj = t;
},
onChange(o, t, e) {
this.checkedObj[t[this.rowKey]] = o.target.checked, this.setSelected(t[this.rowKey], o.target.checked), o.target.checked == !0 && (this.indeterminate = !0), this.setCheckVal();
},
setCheckVal(o = "1") {
const t = [], e = [];
let i = !1;
Object.keys(this.checkedObj).forEach((s) => {
if (this.checkedObj[s] == !0) {
t.push(s);
const n = this.flattenDataObj_[s];
J(n) || (e.push(this.flattenDataObj_[s]), i = !0);
}
}), o == "1" && i == !1 && (this.indeterminate = !1), this.event && this.event(t, e);
},
setSelected(o, t) {
const e = document.querySelector(`[user-data-s="${o}"]`);
t == !0 ? e.classList.add("ht-table-row-selected") : e.classList.remove("ht-table-row-selected");
},
onCheckAllChange(o) {
const t = o.target.checked, e = {};
this.tableData_.forEach((i) => {
const s = i[this.rowKey];
e[s] = t, this.setSelected(s, t);
}), this.checkedObj = e, this.indeterminate = !1, this.checkAll = t, this.setCheckVal("2");
},
getdepth(o) {
const t = this.flattenDataObj_[o];
return t && t.depth || 0;
},
getDeepNum(o, t, e) {
let i = "0px";
if (t == 0) {
const { children: s, id: r } = o;
s && s.length > 0 && (i = `${this.getdepth(r) * 20}px`);
}
return i;
},
getExpand(o) {
if (this.config_.isTree == !1)
return !1;
const { expand: t } = this.tempKeyList_[o] || {};
let e = "";
return J(t) || (t == !0 ? e = "" : e = "none"), e;
},
getRowDefaultClass(o) {
const { expand: t } = this.tempKeyList_[o] || {};
let e = "ht-table-row-expand-icon";
return J(t) || (t == !0 ? e = "ht-table-row-expand-icon-n" : e = "ht-table-row-expand-icon"), e;
},
getRowChilds(o, t, e) {
const { children: i } = o, s = o[this.rowKey], r = this.tempKeyList_[s];
r && r ? (this.upDataNodeAndChildNode(s, r.expand), this.setChildNode(s, r.expand), this.tempKeyList_[s].expand = !r.expand) : (this.tableData_.splice(e + 1, 0, ...i), this.tempKeyList_[s] = { children: i, expand: !0 });
},
upDataNodeAndChildNode(o, t) {
const e = document.querySelector(`[user-data-icon="${o}"]`);
t && t == !0 ? e && (e.className = "ht-table-row-expand-icon") : e && (e.className = "ht-table-row-expand-icon-n");
},
setChildNode(o, t) {
const e = document.querySelectorAll(`[user-data-p="${o}"]`);
if (t && t == !0) {
e.forEach((s) => {
s.style.display = "none";
});
const { children: i } = this.tempKeyList_[o] || {};
i && i.length > 0 && i.forEach((s) => {
const r = s[this.rowKey];
this.setChildNode(r, t), this.upDataNodeAndChildNode(r, t);
});
} else
e.forEach((i) => {
i.style.display = "";
});
},
hasChild(o, t, e) {
let i = !1;
if (t == 0) {
const { children: s } = o;
s && s.length > 0 && (i = !0);
}
return i;
},
getCellVal(o, t, e, i, s) {
const { dataIndex: r } = o, { customRender: n } = e[r], h = t[r];
let a = h;
return n && (a = n(h)), a;
},
getScopedSlots(o, t) {
const { dataIndex: e } = o, { scopedSlots: i } = t[e];
let s = null;
return i && i.customRender && (s = i.customRender), s;
},
getCheckboxDisabled_(o, t) {
let e = !1;
return this.getCheckboxDisabled && (e = this.getCheckboxDisabled(o)), e;
},
// setCheckboxValue_(row,rowIndex){
// let res = false
// this.setCheckboxValue && (res = this.setCheckboxValue(row))
// if(res == true){
// this.defaultCheckedObj[row[this.rowKey]] = res
// }
// },
setColumns(o) {
const t = [], e = [], i = {};
o.forEach((s) => {
const { key: r, title: n, align: h, dataIndex: a, scopedSlots: d, customRender: c, width: u } = s;
if (u) {
let f = "";
st(u) && (f = u), ct(u) && (f = `${u}px`), e.push({ width: f, "min-width": f });
} else
e.push({});
t.push({ title: n, dataIndex: a, key: r, align: h }), i[a] = { scopedSlots: d, customRender: c };
}), this.colgroupList_ = e, this.columns_ = t, this.bodyCustomData = i;
},
setTableData(o) {
const t = vi(o), e = JSON.parse(JSON.stringify(t));
this.tableData_ = o, this.flattenDataObj_ = e, at(this.setCheckboxDefaultValues) || this.$nextTick(() => {
this.setCheckVal();
});
}
}
};
var Ri = function() {
var t = this, e = t._self._c;
return e("div", { staticClass: "hyper-table-box", style: t.boxStyle }, [e("table", { staticClass: "ht-table" }, [e("colgroup", [t.config_.isCheck == !0 ? e("col", { staticStyle: { width: "50px", "min-width": "50px" } }) : t._e(), t._l(t.colgroupList_, function(i, s) {
return e("col", { key: "colgroup-col-" + s, style: i });
})], 2), e("thead", { staticClass: "ht-table-thead" }, [e("tr", [t.config_.isCheck == !0 ? e("th", [e("a-checkbox", { attrs: { indeterminate: t.indeterminate, checked: t.checkAll }, on: { change: t.onCheckAllChange } })], 1) : t._e(), t._l(t.columns_, function(i, s) {
return e("th", { key: "thead-tr-th-" + s, style: { "text-align": i.align && i.align || "left" } }, [t._v(" " + t._s(i.title) + " ")]);
})], 2)]), e("tbody", { staticClass: "ht-table-tbody" }, [t.loading ? e("tr", { staticClass: "example", style: { height: "200px" } }, [e("td", { attrs: { colspan: t.columns_.length + (t.config_.isCheck ? 1 : 0) } }, [e("a-spin", { attrs: { tip: "正在加载数据,请稍后..." } })], 1)]) : t._e(), t.tableData_.length == 0 && !t.loading ? e("tr", { staticClass: "empty", style: { height: "200px" } }, [e("td", { attrs: { colspan: t.columns_.length + (t.config_.isCheck ? 1 : 0) } }, [e("a-empty", { attrs: { description: "暂无数据" } })], 1)]) : t._e(), t._l(t.tableData_, function(i, s) {
return e("tr", { key: "ht-table-row-" + s, staticClass: "ht-table-row", style: { display: t.getExpand(i[t.rowParentKey]) }, attrs: { "user-data-s": i[t.rowKey], "user-data-p": i[t.rowParentKey], deep: t.getdepth(i[t.rowKey]) } }, [t.config_.isCheck == !0 ? e("td", { staticClass: "ht-table-row-cell" }, [e("a-checkbox", { attrs: { disabled: t.getCheckboxDisabled_(i, s) }, on: { change: (r) => {
t.onChange(r, i, s);
} }, model: { value: t.checkedObj[i[t.rowKey]], callback: function(r) {
t.$set(t.checkedObj, i[t.rowKey], r);
}, expression: "checkedObj[row[rowKey]]" } })], 1) : t._e(), t._l(t.columns_, function(r, n) {
return e("td", { key: `row-cell-${s}-${n}`, staticClass: "ht-table-row-cell", style: { "text-align": r.align && r.align || "left" } }, [t.config_.isTree == !0 && n == 0 ? e("span", { style: { "padding-left": `${t.getdepth(i[t.rowKey]) * t.indentSize}px` } }) : t._e(), t.config_.isTree == !0 && t.hasChild(i, n, s) ? e("div", { class: t.getRowDefaultClass(i[t.rowKey]), attrs: { "user-data-icon": i[t.rowKey] }, on: { click: function(h) {
return t.getRowChilds(i, n, s);
} } }) : t._e(), t.getScopedSlots(r, t.bodyCustomData) ? [t.$scopedSlots[t.getScopedSlots(r, t.bodyCustomData)] ? t._t(t.getScopedSlots(r, t.bodyCustomData), null, { row: i, text: i[r.dataIndex], rowIndex: s, cellIndex: n }) : [t._v(" " + t._s(t.getCellVal(r, i, t.bodyCustomData, n, s)) + " ")]] : [t._v(" " + t._s(t.getCellVal(r, i, t.bodyCustomData, n, s)) + " ")]], 2);
})], 2);
})], 2)])]);
}, Ii = [], Oi = /* @__PURE__ */ ge(
_i,
Ri,
Ii,
!1,
null,
"20434c46",
null,
null
);
const bt = Oi.exports;
bt.install = (o) => {
o.component(bt.name, bt);
};
(function() {
try {
if (typeof document < "u") {
var o = document.createElement("style");
o.appendChild(document.createTextNode(":root{--e-virt-table-color-white: #fff;--e-virt-table-color-black: #000000;--e-virt-table-color-primary: rgb(82, 146, 247);--e-virt-table-text-color-primary: #333;--e-virt-table-text-color-regular: #666;--e-virt-table-text-color-secondary: #999;--e-virt-table-box-shadow: 0 2px 12px 0 #0000001a;--e-virt-table-editor-bg-color: #fff;--e-virt-table-border-color: #e1e6eb}.e-virt-table-container{position:relative;outline:none}.e-virt-table-stage{position:relative;overflow:hidden;outline:none;box-sizing:border-box;z-index:10;border-radius:8px;border:1px solid var(--e-virt-table-border-color)}.e-virt-table-canvas{position:absolute;left:0;top:0;box-sizing:border-box;border:none;outline:none;z-index:10}.e-virt-table-editor{position:absolute;top:-10000px;left:-10000px;text-align:left;height:auto;line-height:0;z-index:100;overflow:hidden;background-color:var(--e-virt-table-editor-bg-color);border:2px solid var(--e-virt-table-color-primary);box-sizing:border-box;box-shadow:var(--e-virt-table-box-shadow);display:flex;align-items:center}.e-virt-table-overlayer{position:absolute;left:0;top:0;overflow:hidden;z-index:100;pointer-events:none}.e-virt-table-editor-textarea{width:100%;box-sizing:border-box;outline:none;font-weight:400;padding:8px;font-size:12px;color:inherit;white-space:pre-wrap;word-wrap:break-word;word-break:break-all;line-height:1.5;margin:0;border:none;vertical-align:middle;background:var(--e-virt-table-color-white);overflow-y:auto;resize:none}.e-virt-table-context-menu{position:absolute;font-size:14px;color:var(--e-virt-table-text-color-regular);background-color:var(--e-virt-table-color-white);border-radius:4px;border:1px solid #e4e7ed;box-shadow:var(--e-virt-table-box-shadow);width:fit-content;padding:6px 0;z-index:9999;left:-99999px;top:-99999px}.e-virt-table-context-menu-item{cursor:pointer;padding:8px 24px;color:var(--e-virt-table-text-color-regular)}.e-virt-table-context-menu-item:hover{color:var(--e-virt-table-color-primary);background-color:#f5f7fa}")), document.head.appendChild(o);
}
} catch (t) {
console.error("vite-plugin-css-injected-by-js", t);
}
})();
var Li = Object.defineProperty, Ti = Object.defineProperties, Si = Object.getOwnPropertyDescriptors, _t = Object.getOwnPropertySymbols, pe = Object.prototype.hasOwnProperty, ye = Object.prototype.propertyIsEnumerable, Mt = (o, t, e) => t in o ? Li(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e, S = (o, t) => {
for (var e in t || (t = {}))
pe.call(t, e) && Mt(o, e, t[e]);
if (_t)
for (var e of _t(t))
ye.call(t, e) && Mt(o, e, t[e]);
return o;
}, B = (o, t) => Ti(o, Si(t)), we = (o, t) => {
var e = {};
for (var i in o)
pe.call(o, i) && t.indexOf(i) < 0 && (e[i] = o[i]);
if (o != null && _t)
for (var i of _t(o))
t.indexOf(i) < 0 && ye.call(o, i) && (e[i] = o[i]);
return e;
}, l = (o, t, e) => Mt(o, typeof t != "symbol" ? t + "" : t, e), M = (o, t, e) => new Promise((i, s) => {
var r = (a) => {
try {
h(e.next(a));
} catch (d) {
s(d);
}
}, n = (a) => {
try {
h(e.throw(a));
} catch (d) {
s(d);
}
}, h = (a) => a.done ? i(a.value) : Promise.resolve(a.value).then(r, n);
h((e = e.apply(o, t)).next());
});
function Q() {
return Q = Object.assign ? Object.assign.bind() : function(o) {
for (var t = 1; t < arguments.length; t++) {
var e = arguments[t];
for (var i in e)
Object.prototype.hasOwnProperty.call(e, i) && (o[i] = e[i]);
}
return o;
}, Q.apply(this, arguments);
}
function Ai(o, t) {
o.prototype = Object.create(t.prototype), o.prototype.constructor = o, ft(o, t);
}
function Ht(o) {
return Ht = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
return t.__proto__ || Object.getPrototypeOf(t);
}, Ht(o);
}
function ft(o, t) {
return ft = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, i) {
return e.__proto__ = i, e;
}, ft(o, t);
}
function Di() {
if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
return !1;
if (typeof Proxy == "function")
return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
})), !0;
} catch {
return !1;
}
}
function Ct(o, t, e) {
return Di() ? Ct = Reflect.construct.bind() : Ct = function(i, s, r) {
var n = [null];
n.push.apply(n, s);
var h = Function.bind.apply(i, n), a = new h();
return r && ft(a, r.prototype), a;
}, Ct.apply(null, arguments);
}
function Mi(o) {
return Function.toString.call(o).indexOf("[native code]") !== -1;
}
function kt(o) {
var t = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
return kt = function(e) {
if (e === null || !Mi(e))
return e;
if (typeof e != "function")
throw new TypeError("Super expression must either be null or a function");
if (typeof t < "u") {
if (t.has(e))
return t.get(e);
t.set(e, i);
}
function i() {
return Ct(e, arguments, Ht(this).constructor);
}
return i.prototype = Object.create(e.prototype, {
constructor: {
value: i,
enumerable: !1,
writable: !0,
configurable: !0
}
}), ft(i, e);
}, kt(o);
}
var Hi = /%[sdj%]/g, me = function() {
};
typeof process < "u" && process.env && process.env.NODE_ENV !== "production" && typeof window < "u" && typeof document < "u" && (me = function(o, t) {
typeof console < "u" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING > "u" && t.every(function(e) {
return typeof e == "string";
}) && console.warn(o, t);
});
function Kt(o) {
if (!o || !o.length)
return null;
var t = {};
return o.forEach(function(e) {
var i = e.field;
t[i] = t[i] || [], t[i].push(e);
}), t;
}
function N(o) {
for (var t = arguments.length, e = new Array(t > 1 ? t - 1 : 0), i = 1; i < t; i++)
e[i - 1] = arguments[i];
var s = 0, r = e.length;
if (typeof o == "function")
return o.apply(null, e);
if (typeof o == "string") {
var n = o.replace(Hi, function(h) {
if (h === "%%")
return "%";
if (s >= r)
return h;
switch (h) {
case "%s":
return String(e[s++]);
case "%d":
return Number(e[s++]);
case "%j":
try {
return JSON.stringify(e[s++]);
} catch {
return "[Circular]";
}
break;
default:
return h;
}
});
return n;
}
return o;
}
function ki(o) {
return o === "string" || o === "url" || o === "hex" || o === "email" || o === "date" || o === "pattern";
}
function A(o, t) {
return !!(o == null || t === "array" && Array.isArray(o) && !o.length || ki(t) && typeof o == "string" && !o);
}
function Ki(o, t, e) {
var i = [], s = 0, r = o.length;
function n(h) {
i.push.apply(i, h || []), s++, s === r && e(i);
}
o.forEach(function(h) {
t(h, n);
});
}
function Jt(o, t, e) {
var i = 0, s = o.length;
function r(n) {
if (n && n.length) {
e(n);
return;
}
var h = i;
i = i + 1, h < s ? t(o[h], r) : e([]);
}
r([]);
}
function Fi(o) {
var t = [];
return Object.keys(o).forEach(function(e) {
t.push.apply(t, o[e] || []);
}), t;
}
var Qt = /* @__PURE__ */ function(o) {
Ai(t, o);
function t(e, i) {
var s;
return s = o.call(this, "Async Validation Error") || this, s.errors = e, s.fields = i, s;
}
return t;
}(/* @__PURE__ */ kt(Error));
function Ni(o, t, e, i, s) {
if (t.first) {
var r = new Promise(function(f, x) {
var g = function(y) {
return i(y), y.length ? x(new Qt(y, Kt(y))) : f(s);
}, p = Fi(o);
Jt(p, e, g);
});
return r.catch(function(f) {
return f;
}), r;
}
var n = t.firstFields === !0 ? Object.keys(o) : t.firstFields || [], h = Object.keys(o), a = h.length, d = 0, c = [], u = new Promise(function(f, x) {
var g = function(p) {
if (c.push.apply(c, p), d++, d === a)
return i(c), c.length ? x(new Qt(c, Kt(c))) : f(s);
};
h.length || (i(c), f(s)), h.forEach(function(p) {
var y = o[p];
n.indexOf(p) !== -1 ? Jt(y, e, g) : Ki(y, e, g);
});
});
return u.catch(function(f) {
return f;
}), u;
}
function Bi(o) {
return !!(o && o.message !== void 0);
}
function Xi(o, t) {
for (var e = o, i = 0; i < t.length; i++) {
if (e == null)
return e;
e = e[t[i]];
}
return e;
}
function te(o, t) {
return function(e) {
var i;
return o.fullFields ? i = Xi(t, o.fullFields) : i = t[e.field || o.fullField], Bi(e) ? (e.field = e.field || o.fullField, e.fieldValue = i, e) : {
message: typeof e == "function" ? e() : e,
fieldValue: i,
field: e.field || o.fullField
};
};
}
function ee(o, t) {
if (t) {
for (var e in t)
if (t.hasOwnProperty(e)) {
var i = t[e];
typeof i == "object" && typeof o[e] == "object" ? o[e] = Q({}, o[e], i) : o[e] = i;
}
}
return o;
}
var Ee = function(o, t, e, i, s, r) {
o.required && (!e.hasOwnProperty(o.field) || A(t, r || o.type)) && i.push(N(s.messages.required, o.fullField));
}, Yi = function(o, t, e, i, s) {
(/^\s+$/.test(t) || t === "") && i.push(N(s.messages.whitespace, o.fullField));
}, Et, Vi = function() {
if (Et)
return Et;
var o = "[a-fA-F\\d:]", t = function(w) {
return w && w.includeBoundaries ? "(?:(?<=\\s|^)(?=" + o + ")|(?<=" + o + ")(?=\\s|$))" : "";
}, e = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}", i = "[a-fA-F\\d]{1,4}", s = (`
(?:
(?:` + i + ":){7}(?:" + i + `|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
(?:` + i + ":){6}(?:" + e + "|:" + i + `|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4
(?:` + i + ":){5}(?::" + e + "|(?::" + i + `){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4
(?:` + i + ":){4}(?:(?::" + i + "){0,1}:" + e + "|(?::" + i + `){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4
(?:` + i + ":){3}(?:(?::" + i + "){0,2}:" + e + "|(?::" + i + `){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4
(?:` + i + ":){2}(?:(?::" + i + "){0,3}:" + e + "|(?::" + i + `){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4
(?:` + i + ":){1}(?:(?::" + i + "){0,4}:" + e + "|(?::" + i + `){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4
(?::(?:(?::` + i + "){0,5}:" + e + "|(?::" + i + `){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4
)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1
`).replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim(), r = new RegExp("(?:^" + e + "$)|(?:^" + s + "$)"), n = new RegExp("^" + e + "$"), h = new RegExp("^" + s + "$"), a = function(w) {
return w && w.exact ? r : new RegExp("(?:" + t(w) + e + t(w) + ")|(?:" + t(w) + s + t(w) + ")", "g");
};
a.v4 = function(w) {
return w && w.exact ? n : new RegExp("" + t(w) + e + t(w), "g");
}, a.v6 = function(w) {
return w && w.exact ? h : new RegExp("" + t(w) + s + t(w), "g");
};
var d = "(?:(?:[a-z]+:)?//)", c = "(?:\\S+(?::\\S*)?@)?", u = a.v4().source, f = a.v6().source, x = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)", g = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*", p = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))", y = "(?::\\d{2,5})?", E = '(?:[/?#][^\\s"]*)?', m = "(?:" + d + "|www\\.)" + c + "(?:localhost|" + u + "|" + f + "|" + x + g + p + ")" + y + E;
return Et = new RegExp("(?:^" + m + "$)", "i"), Et;
}, ie = {
// http://emailregex.com/
email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,
// url: new RegExp(
// '^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$',
// 'i',
// ),
hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
}, dt = {
integer: function(o) {
return dt.number(o) && parseInt(o, 10) === o;
},
float: function(o) {
return dt.number(o) && !dt.integer(o);
},
array: function(o) {
return Array.isArray(o);
},
regexp: function(o) {
if (o instanceof RegExp)
return !0;
try {
return !!new RegExp(o);
} catch {
return !1;
}
},
date: function(o) {
return typeof o.getTime == "function" && typeof o.getMonth == "function" && typeof o.getYear == "function" && !isNaN(o.getTime());
},
number: function(o) {
return isNaN(o) ? !1 : typeof o == "number";
},
object: function(o) {
return typeof o == "object" && !dt.array(o);
},
method: function(o) {
return typeof o == "function";
},
email: function(o) {
return typeof o == "string" && o.length <= 320 && !!o.match(ie.email);
},
url: function(o) {
return typeof o == "string" && o.length <= 2048 && !!o.match(Vi());
},
hex: function(o) {
return typeof o == "string" && !!o.match(ie.hex);
}
}, zi = function(o, t, e, i, s) {
if (o.required && t === void 0) {
Ee(o, t, e, i, s);
return;
}
var r = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"], n = o.type;
r.indexOf(n) > -1 ? dt[n](t) || i.push(N(s.messages.types[n], o.fullField, o.type)) : n && typeof t !== o.type && i.push(N(s.messages.types[n], o.fullField, o.type));
}, Pi = function(o, t, e, i, s) {
var r = typeof o.len == "number", n = typeof o.min == "number", h = typeof o.max == "number", a = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, d = t, c = null, u = typeof t == "number", f = typeof t == "string", x = Array.isArray(t);
if (u ? c = "number" : f ? c = "string" : x && (c = "array"), !c)
return !1;
x && (d = t.length), f && (d = t.replace(a, "_").length), r ? d !== o.len && i.push(N(s.messages[c].len, o.fullField, o.len)) : n && !h && d < o.min ? i.push(N(s.messages[c].min, o.fullField, o.min)) : h && !n && d > o.max ? i.push(N(s.messages[c].max, o.fullField, o.max)) : n && h && (d < o.min || d > o.max) && i.push(N(s.messages[c].range, o.fullField, o.min, o.max));
}, it = "enum", Wi = function(o, t, e, i, s) {
o[it] = Array.isArray(o[it]) ? o[it] : [], o[it].indexOf(t) === -1 && i.push(N(s.messages[it], o.fullField, o[it].join(", ")));
}, $i = function(o, t, e, i, s) {
if (o.pattern) {
if (o.pattern instanceof RegExp)
o.pattern.lastIndex = 0, o.pattern.test(t) || i.push(N(s.messages.pattern.mismatch, o.fullField, t, o.pattern));
else if (typeof o.pattern == "string") {
var r = new RegExp(o.pattern);
r.test(t) || i.push(N(s.messages.pattern.mismatch, o.fullField, t, o.pattern));
}
}
}, I = {
required: Ee,
whitespace: Yi,
type: zi,
range: Pi,
enum: Wi,
pattern: $i
}, ji = function(o, t, e, i, s) {
var r = [], n = o.required || !o.required && i.hasOwnProperty(o.field);
if (n) {
if (A(t, "string") && !o.required)
return e();
I.required(o, t, i, r, s, "string"), A(t, "string") || (I.type(o, t, i, r, s), I.range(o, t, i, r, s), I.pattern(o, t, i, r, s), o.whitespace === !0 && I.whitespace(o, t, i, r, s));
}
e(r);
}, Gi = function(o, t, e, i, s) {
var r = [], n = o.required || !o.required && i.hasOwnProperty(o.field);
if (n) {
if (A(t) && !o.required)
return e();
I.required(o, t, i, r, s), t !== void 0 && I.type(o, t, i, r, s);
}
e(r);
}, qi = function(o, t, e, i, s) {
var r = [], n = o.required || !o.required && i.hasOwnProperty(o.field);
if (n) {
if (t === "" && (t = void 0), A(t) && !o.required)
return e();
I.required(o, t, i, r, s), t !== void 0 && (I.type(o, t, i, r, s), I.range(o, t, i, r, s));
}
e(r);
}, Ui = function(o, t, e, i, s) {
var r = [], n = o.required || !o.required && i.hasOwnProperty(o.field);
if (n) {
if (A(t) && !o.required)
return e();
I.required(o, t, i, r, s), t !== void 0 && I.type(o, t, i, r, s);
}
e(r);
}, Zi = function(o, t, e, i, s) {
var r = [], n = o.required || !o.required && i.hasOwnProperty(o.field);
if (n) {
if (A(t) && !o.required)
return e();
I.required(o, t, i, r, s), A(t) || I.type(o, t, i, r, s);
}
e(r);
}, Ji = function(o, t, e, i, s) {
var r = [], n = o.required || !o.required && i.hasOwnProperty(o.field);
if (n) {
if (A(t) && !o.required)
return e();
I.required(o, t, i, r, s), t !== void 0 && (I.type(o, t, i, r, s), I.range(o, t, i, r, s));
}
e(r);
}, Qi = function(o, t, e, i, s) {
var r = [], n = o.required || !o.required && i.hasOwnProperty(o.field);
if (n) {
if (A(t) && !o.required)
return e();
I.required(o, t, i, r, s), t !== void 0 && (I.type(o, t, i, r, s), I.range(o, t, i, r, s));
}
e(r);
}, ts = function(o, t, e, i, s) {
var r = [], n = o.required || !o.required && i.hasOwnProperty(o.field);
if (n) {
if (t == null && !o.required)
return e();
I.required(o, t, i, r, s, "array"), t != null && (I.type(o, t, i, r, s), I.range(o, t, i, r, s));
}
e(r);
}, es = function(o, t, e, i, s) {
var r = [], n = o.required || !o.required && i.hasOwnProperty(o.field);
if (n) {
if (A(t) && !o.required)
return e();
I.required(o, t, i, r, s), t !== void 0 && I.type(o, t, i, r, s);
}
e(r);
}, is = "enum", ss = function(o, t, e, i, s) {
var r = [], n = o.required || !o.required && i.hasOwnProperty(o.field);
if (n) {
if (A(t) && !o.required)
return e();
I.required(o, t, i, r, s), t !== void 0 && I[is](o, t, i, r, s);
}
e(r);
}, os = function(o, t, e, i, s) {
var r = [], n = o.required || !o.required && i.hasOwnProperty(o.field);
if (n) {
if (A(t, "string") && !o.required)
return e();
I.required(o, t, i, r, s), A(t, "string") || I.pattern(o, t, i, r, s);
}
e(r);
}, rs = function(o, t, e, i, s) {
var r = [], n = o.required || !o.required && i.hasOwnProperty(o.field);
if (n) {
if (A(t, "date") && !o.required)
return e();
if (I.required(o, t, i, r, s), !A(t, "date")) {
var h;
t instanceof Date ? h = t : h = new Date(t), I.type(o, h, i, r, s), h && I.range(o, h.getTime(), i, r, s);
}
}
e(r);
}, ns = function(o, t, e, i, s) {
var r = [], n = Array.isArray(t) ? "array" : typeof t;
I.required(o, t, i, r, s, n), e(r);
}, At = function(o, t, e, i, s) {
var r = o.type, n = [], h = o.required || !o.required && i.hasOwnProperty(o.field);
if (h) {
if (A(t, r) && !o.required)
return e();
I.required(o, t, i, n, s, r), A(t, r) || I.type(o, t, i, n, s);
}
e(n);
}, hs = function(o, t, e, i, s) {
var r = [], n = o.required || !o.required && i.hasOwnProperty(o.field);
if (n) {
if (A(t) && !o.required)
return e();
I.required(o, t, i, r, s);
}
e(r);
}, ut = {
string: ji,
method: Gi,
number: qi,
boolean: Ui,
regexp: Zi,
integer: Ji,
float: Qi,
array: ts,
object: es,
enum: ss,
pattern: os,
date: rs,
url: At,
hex: At,
email: At,
required: ns,
any: hs
};
function Ft() {
return {
default: "Validation error on field %s",
required: "%s is required",
enum: "%s must be one of %s",
whitespace: "%s cannot be empty",
date: {
format: "%s date %s is invalid for format %s",
parse: "%s date could not be parsed, %s is invalid ",
invalid: "%s date %s is invalid"
},
types: {
string: "%s is not a %s",
method: "%s is not a %s (function)",
array: "%s is not an %s",
object: "%s is not an %s",
number: "%s is not a %s",
date: "%s is not a %s",
boolean: "%s is not a %s",
integer: "%s is not an %s",
float: "%s is not a %s",
regexp: "%s is not a valid %s",
email: "%s is not a valid %s",
url: "%s is not a valid %s",
hex: "%s is not a valid %s"
},
string: {
len: "%s must be exactly %s characters",
min: "%s must be at least %s characters",
max: "%s cannot be longer than %s characters",
range: "%s must be between %s and %s characters"
},
number: {
len: "%s must equal %s",
min: "%s cannot be less than %s",
max: "%s cannot be greater than %s",
range: "%s must be between %s and %s"
},
array: {
len: "%s must be exactly %s in length",
min: "%s cannot be less than %s in length",
max: "%s cannot be greater than %s in length",
range: "%s must be between %s and %s in length"
},
pattern: {
mismatch: "%s value %s does not match pattern %s"
},
clone: function() {
var o = JSON.parse(JSON.stringify(this));
return o.clone = this.clone, o;
}
};
}
var Nt = Ft(), pt = /* @__PURE__ */ function() {
function o(e) {
this.rules = null, this._messages = Nt, this.define(e);
}
var t = o.prototype;
return t.define = function(e) {
var i = this;
if (!e)
throw new Error("Cannot configure a schema with no rules");
if (typeof e != "object" || Array.isArray(e))
throw new Error("Rules must be an object");
this.rules = {}, Object.keys(e).forEach(function(s) {
var r = e[s];
i.rules[s] = Array.isArray(r) ? r : [r];
});
}, t.messages = function(e) {
return e && (this._messages = ee(Ft(), e)), this._messages;
}, t.validate = function(e, i, s) {
var r = this;
i === void 0 && (i = {}), s === void 0 && (s = function() {
});
var n = e, h = i, a = s;
if (typeof h == "function" && (a = h, h = {}), !this.rules || Object.keys(this.rules).length === 0)
return a && a(null, n), Promise.resolve(n);
function d(g) {
var p = [], y = {};
function E(w) {
if (Array.isArray(w)) {
var b;
p = (b = p).concat.apply(b, w);
} else
p.push(w);
}
for (var m = 0; m < g.length; m++)
E(g[m]);
p.length ? (y = Kt(p), a(p, y)) : a(null, n);
}
if (h.messages) {
var c = this.messages();
c === Nt && (c = Ft()), ee(c, h.messages), h.messages = c;
} else
h.messages = this.messages();
var u = {}, f = h.keys || Object.keys(this.rules);
f.forEach(function(g) {
var p = r.rules[g], y = n[g];
p.forEach(function(E) {
var m = E;
typeof m.transform == "function" && (n === e && (n = Q({}, n)), y = n[g] = m.transform(y)), typeof m == "function" ? m = {
validator: m
} : m = Q({}, m), m.validator = r.getValidationMethod(m), m.validator && (m.field = g, m.fullField = m.fullField || g, m.type = r.getType(m), u[g] = u[g] || [], u[g].push({
rule: m,
value: y,
source: n,
field: g
}));
});
});
var x = {};
return Ni(u, h, function(g, p) {
var y = g.rule, E = (y.type === "object" || y.type === "array") && (typeof y.fields == "object" || typeof y.defaultField == "object");
E = E && (y.required || !y.required && g.value), y.field = g.field;
function m(v, R) {
return Q({}, R, {
fullField: y.fullField + "." + v,
fullFields: y.fullFields ? [].concat(y.fullFields, [v]) : [v]
});
}
function w(v) {
v === void 0 && (v = []);
var R = Array.isArray(v) ? v : [v];
!h.suppressWarning && R.length && o.warning("async-validator:", R), R.length && y.message !== void 0 && (R = [].concat(y.message));
var T = R.map(te(y, n));
if (h.first && T.length)
return x[y.field] = 1, p(T);
if (!E)
p(T);
else {
if (y.required && !g.value)
return y.message !== void 0 ? T = [].concat(y.message).map(te(y, n)) : h.error && (T = [h.error(y, N(h.messages.required, y.field))]), p(T);
var H = {};
y.defaultField && Object.keys(g.value).map(function(_) {
H[_] = y.defaultField;
}), H = Q({}, H, g.rule.fields);
var O = {};
Object.keys(H).forEach(function(_) {
var L = H[_], K = Array.isArray(L) ? L : [L];
O[_] = K.map(m.bind(null, _));
});
var C = new o(O);
C.messages(h.messages), g.rule.options && (g.rule.options.messages = h.messages, g.rule.options.error = h.error), C.validate(g.value, g.rule.options || h, function(_) {
var L = [];
T && T.length && L.push.apply(L, T), _ && _.length && L.push.apply(L, _), p(L.length ? L : null);
});
}
}
var b;
if (y.asyncValidator)
b = y.asyncValidator(y, g.value, w, g.source, h);
else if (y.validator) {
try {
b = y.validator(y, g.value, w, g.source, h);
} catch (v) {
console.error == null || console.error(v), h.suppressValidatorError || setTimeout(function() {
throw v;
}, 0), w(v.message);
}
b === !0 ? w() : b === !1 ? w(typeof y.message == "function" ? y.message(y.fullField || y.field) : y.message || (y.fullField || y.field) + " fails") : b instanceof Array ? w(b) : b instanceof Error && w(b.message);
}
b && b.then && b.then(function() {
return w();
}, function(v) {
return w(v);
});
}, function(g) {
d(g);
}, n);
}, t.getType = function(e) {
if (e.type === void 0 && e.pattern instanceof RegExp && (e.type = "pattern"), typeof e.validator != "function" && e.type && !ut.hasOwnProperty(e.type))
throw new Error(N("Unknown rule type %s", e.type));
return e.type || "string";
}, t.getValidationMethod = function(e) {
if (typeof e.validator == "function")
return e.validator;
var i = Object.keys(e), s = i.indexOf("message");
return s !== -1 && i.splice(s, 1), i.length === 1 && i[0] === "required" ? ut.required : ut[this.getType(e)] || void 0;
}, o;
}();
pt.register = function(o, t) {
if (typeof t != "function")
throw new Error("Cannot register a validator by type, validator is not a function");
ut[o] = t;
};
pt.warning = me;
pt.messages = Nt;
pt.validators = ut;
function be() {
return "xxxxxxxxxxxxxxxxxx".replace(/[x]/g, function(o) {
const t = Math.random() * 16 | 0;
return (o === "x" ? t : t & 3 | 8).toString(16);
});
}
function Ce(o, t) {
let e = 0, i;
return function(...s) {
const r = (/* @__PURE__ */ new Date()).getTime(), n = r - e;
!e || n >= t ? (o.apply(this, s), e = r) : i || (i = setTimeout(() => {
o.apply(this, s), e = (/* @__PURE__ */ new Date()).getTime(), i = void 0;
}, t - n));
};
}
function ve(o = []) {
return o.length ? o.map((t) => ve(t.children) + 1).sort((t, e) => e - t)[0] : 0;
}
function ls(o = []) {
let t = [], e = [], i = [];
return o.forEach((s) => {
s.fixed === "left" ? t.push(s) : s.fixed === "right" ? i.push(s) : e.push(s);
}), [
...t.sort((s, r) => {
var n, h;
return ((n = s.sort) != null ? n : 0) - ((h = r.sort) != null ? h : 0);
}),
...e.sort((s, r) => {
var n, h;
return ((n = s.sort) != null ? n : 0) - ((h = r.sort) != null ? h : 0);
}),
...i.sort((s, r) => {
var n, h;
return ((n = s.sort) != null ? n : 0) - ((h = r.sort) != null ? h : 0);
})
];
}
function _e(o = [], t = 1, e = 0) {
return o.map((i) => {
if (i.children) {
let s = 0, r = i.fixed;
i.children.forEach((h) => {
h.fixed = r;
});
const n = _e(i.children, t - 1, e + 1);
return n && n.forEach((h) => {
var a;
s += (a = h.colspan) != null ? a : 0;
}), B(S({}, i), {
width: i.width,
level: e,
rowspan: 1,
colspan: s,
children: n
});
}
return B(S({}, i), {
level: e,
rowspan: t,
colspan: 1
});
});
}
function Bt(o = []) {
let t = [];
return o.forEach((e) => {
e.children ? t = t.concat(Bt(e.children)) : t.push(e);
}), t;
}
const se = /^(\r\n|\n\r|\r|\n)/, as = /^[^\t\r\n]+/, oe = /^\t/;
function cs(o) {
let t = [[""]];
if (o.length === 0)
return t;
let e = 0, i = 0, s;
for (; o.length > 0 && s !== o.length; )
if (s = o.length, o.match(oe))
o = o.replace(oe, ""), e += 1, t[i][e] = "";
else if (o.match(se))
o = o.replace(se, ""), e = 0, i += 1, t[i] = [""];
else {
let r = "";
if (o.startsWith('"')) {
let n = 0, h = !0;
for (; h; ) {
const a = o.slice(0, 1);
a === '"' && (n += 1), r += a, o = o.slice(1), (o.length === 0 || o.match(/^[\t\r\n]/) && n % 2 === 0) && (h = !1);
}
r = r.replace(/^"/, "").replace(/"$/, "").replace(/["]*/g, (a) => new Array(Math.floor(a.length / 2)).fill('"').join(""));
} else {
const n = o.match(as);
r = n ? n[0] : "", o = o.slice(r.length);
}
t[i][e] = r;
}
return Array.isArray(t) && t.length > 1 && t[t.length - 1].length === 1 && t[t.length - 1][0] === "" && (t = t.slice(0, t.length - 1)), t;
}
function ds(o) {
let t, e, i, s, r = "", n;
for (t = 0, e = o.length; t < e; t += 1) {
for (s = o[t].length, i = 0; i < s; i += 1)
i > 0 && (r += " "), n = o[t][i], typeof n == "string" ? n.indexOf(`
`) > -1 ? r += `"${n.replace(/"/g, '""')}"` : r += n : n == null ? r += "" : r += n;
t !== e - 1 && (r += `
`);
}
return r;
}
function Re(o, t, e = []) {
let i = 0;
const s = [];
return o.forEach((r, n) => {
if (n === 0)
s.push(1);
else {
const h = e.reduce((d, c) => {
var u;
return `${d}${(u = r[c]) != null ? u : ""}`;
}, "") || r[t], a = e.reduce((d, c) => {
var u;
return `${d}${(u = o[n - 1][c]) != null ? u : ""}`;
}, "") || o[n - 1][t];
h === a ? (s[i] += 1, s.push(0)) : (s.push(1), i = n);
}
}), s;
}
function Ie(o, t) {
let e = "", i = "";
const s = {};
return t.forEach((r, n) => {
n === 0 ? (e = r.key, i = r.key, s[r.key] = 1) : o[r.key] === o[e] ? (s[r.key] = 0, s[i] += 1) : (s[r.key] = 1, e = r.key, i = r.key);
}), s;
}
function us(o, t, e = []) {
const { visibleRows: i, rowIndex: s, headIndex: r } = o, n = Re(i, t, e);
return n[s - r] === 0 ? {
rowspan: 0,
colspan: 0,
relationRowKeys: e,
mergeRow: !0
} : {
rowspan: n[s - r],
colspan: 1,
relationRowKeys: e,
mergeRow: !0
};
}
function fs(o, t = []) {
const { column: e, row: i, visibleLeafColumns: s } = o, r = s.filter((n) => t.includes(n.key));
if (t.includes(e.key)) {
const n = Ie(i, r);
return n[e.key] === 0 ? {
rowspan: 0,
colspan: 0,
relationColKeys: t,
mergeCol: !0
} : {
rowspan: 1,
colspan: n[e.key],
relationColKeys: t,
mergeCol: !0
};
}
}
class Oe {
constructor(t, e, i, s, r, n, h) {
l(this, "ctx"), l(this, "x", 0), l(this, "y", 0), l(this, "width", 0), l(this, "height", 0), l(this, "fixed"), l(this, "cellType"), this.ctx = t, this.x = e, this.y = i, this.width = s, this.height = r, this.fixed = h, this.cellType = n;
}
isHorizontalVisible() {
if (this.fixed)
return !0;
const { stageWidth: t, fixedLeftWidth: e, scrollX: i, fixedRightWidth: s } = this.ctx, r = t;
return !(this.x + this.width - e - i <= 0 || this.x - i >= r - s);
}
isVerticalVisible() {
const { stageHeight: t, scrollY: e } = this.ctx, i = t;
return !(this.y + this.height - e <= 0 || this.y - e >= i);
}
getDrawX() {
if (this.fixed === "left")
return this.x;
if (this.fixed === "right") {
const {
stageWidth: t,
config: { SCROLLER_TRACK_SIZE: e }
} = this.ctx;
return t - (this.ctx.header.width - this.x) - e + 1;
}
return this.x - this.ctx.scrollX;
}
getDrawY() {
return this.cellType === "header" ? this.y : this.cellType === "footer" && this.ctx.config.FOOTER_FIXED ? this.y : this.y - this.ctx.scrollY;
}
getLeftFixedX() {
return this.x - this.ctx.scrollX;
}
/**
* RightFixed时相对StageX
* @returns
*/
getRightFixedX() {
}
}
class $t extends Oe {
constructor(t, e, i, s, r, n, h, a, d, c = "body") {
super(t, s, r, n, h, c, a.fixed), l(this, "formatter"), l(this, "formatterFooter"), l(this, "hoverIconName", ""), l(this, "operation", !1), l(this, "align"), l(this, "verticalAlign"), l(this, "fixed"), l(this, "type"), l(this, "editorType"), l(this, "editorProps"), l(this, "cellType"), l(this, "level"), l(this, "colspan", 1), l(this, "rowspan", 1), l(this, "mergeRow", !1), l(this, "mergeCol", !1), l(this, "relationRowKeys", []), l(this, "relationColKeys", []), l(this, "key"), l(this, "column"), l(this, "rowIndex"), l(this, "colIndex"), l(this, "rowKey"), l(this, "row"), l(this, "value"), l(this, "render"), l(this, "renderFooter"), l(this, "style", {}), l(this, "rules", []), l(this, "message", ""), l(this, "text", ""), l(this, "displayText", ""), l(this, "visibleWidth", 0), l(this, "visibleHeight", 0), l(this, "isHasChanged", !1), l(this, "drawX", 0), l(this, "drawY", 0), l(this, "drawCellBgColor", ""), l(this, "drawCellSkyBgColor", ""), l(this, "drawTextColor", ""), l(this, "drawTextX", 0), l(this, "drawTextY", 0), l(this, "drawImageX", 0), l(this, "drawImageY", 0), l(this, "drawImageWidth", 0), l(this, "drawImageHeight", 0), l(this, "drawImageName", ""), l(this, "drawImageSource"), l(this, "ellipsis", !1), l(this, "rowExpand", !1), l(this, "rowHasChildren", !1), l(this, "overflowTooltipShow", !0), l(this, "overflowTooltipMaxWidth", 500), l(this, "overflowTooltipPlacement", "top"), this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = i, this.rowIndex = e, this.key = a.key, this.type = a.type || "", this.editorType = a.editorType || "text", this.editorProps = a.editorProps || {}, this.cellType = c, this.align = a.align || "center", this.verticalAlign = a.verticalAlign || "middle", this.fixed = a.fixed, this.level = a.level || 0, this.operation = a.operation || !1, this.column = a, this.rules = a.rules || [], this.row = d, this.rowKey = this.cellType === "body" ? this.ctx.database.getRowKeyForRowIndex(e) : `${this.cellType}_${this.rowIndex}`, this.value = this.getValue(), this.render = a.render, this.overflowTooltipShow = a.overflowTooltipShow !== !1, this.overflowTooltipMaxWidth = a.overflowTooltipMaxWidth || 500, this.overflowTooltipPlacement = a.overflowTooltipPlacement || "top", this.renderFooter = a.r