fytable
Version:
A Vue 2.x table component library with tree table and virtual scrolling support
14 lines • 187 kB
JavaScript
(function($,Ct){typeof exports=="object"&&typeof module<"u"?Ct(exports):typeof define=="function"&&define.amd?define(["exports"],Ct):($=typeof globalThis<"u"?globalThis:$||self,Ct($.FyTable={}))})(this,function($){"use strict";const Mt={name:"fytable",version:"1.1.7",description:"A Vue 2.x table component library with tree table and virtual scrolling support",main:"dist/index.cjs.js",module:"dist/index.es.js",browser:"dist/index.umd.js",types:"dist/lib/index.d.ts",files:["dist","src"],type:"module",private:!1,scripts:{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"},keywords:["vue","table","component","tree-table","virtual-scroll","ant-design-vue"],author:"",license:"ISC",repository:{type:"git",url:"git+https://github.com/yourusername/fytable.git"},bugs:{url:"https://github.com/yourusername/fytable/issues"},homepage:"https://github.com/yourusername/fytable#readme",publishConfig:{access:"public"},peerDependencies:{vue:"^2.6.10","ant-design-vue":"^1.7.2"},dependencies:{"antdesignvue-172":"^0.0.6","fy-virt-table":"^1.0.1"},devDependencies:{"@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"},exports:{".":{import:"./dist/index.es.js",require:"./dist/index.cjs.js",default:"./dist/index.umd.js"}}}.version,ie=Object.prototype.toString,q=(o,t)=>ie.call(o)===`[object ${t}]`,se=o=>typeof o<"u",Ht=o=>!se(o),kt=o=>o!==null&&ie.call(o)==="[object Object]",ct=o=>{if(oe(o)||it(o))return o.length===0;if(o instanceof Map||o instanceof Set)return o.size===0;if(kt(o))return Object.keys(o).length===0},qe=o=>q(o,"Date"),Kt=o=>o===null,Ue=o=>Ht(o)&&Kt(o),Q=o=>Ht(o)||Kt(o),dt=o=>q(o,"Number"),Ze=o=>q(o,"Promise"),it=o=>q(o,"String"),Je=o=>typeof o=="function",Qe=o=>q(o,"Boolean"),ti=o=>q(o,"RegExp"),oe=o=>o&&Array.isArray(o),F={is:q,isDef:se,isUnDef:Ht,isObject:kt,isEmpty:ct,isDate:qe,isNull:Kt,isNullAndUnDef:Ue,isNullOrUnDef:Q,isNumber:dt,isPromise:Ze,isString:it,isRegExp:ti,isFunction:Je,isBoolean:Qe,isArray:oe,isWindow:o=>typeof window<"u"&&q(o,"Window")};function ei(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}const mo="";function re(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||this.$vnode&&this.$vnode.ssrContext||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 ii={name:"FYTable",components:{},props:{columns:{type:Array,default:()=>[]},tableData:{type:Array},rowKey:{type:String,default:"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},indentSize:{type:Number,default:20},getCheckboxDisabled:{type:Function},setCheckboxDefaultValues:{type:Array}},data(){return{boxStyle:{width:"100%",height:"100%"},config_:{isTree:!1,isCheck:!1},checkAll:!1,indeterminate:!1,checkedList:[],checkedObj:{},tableData_:[],columns_:[],colgroupList_:[],bodyCustomData:{},flattenData_:[],flattenDataObj_:{},tempKeyList_:{},tableDataKey:""}},computed:{},watch:{columns:{handler(o){!Q(o)&&!ct(o)&&this.setColumns(o)},deep:!0,immediate:!0},tableData:{handler(o){let t=[];!Q(o)&&!ct(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="";dt(o)&&(t=`${o}px`),it(o)&&(t=o),this.boxStyle.width=t},deep:!0,immediate:!0},height:{handler(o){let t="";dt(o)&&(t=`${o}px`),it(o)&&(t=o),this.boxStyle.height=t},deep:!0,immediate:!0},setCheckboxDefaultValues:{handler(o){!Q(o)&&!ct(o)&&this.setCheckBoxDefaultVal(o)},deep:!0,immediate:!0}},created(){},mounted(){},methods:{setCheckBoxDefaultVal(o){const t={};o.forEach(e=>{it(e)&&(t[e]=!0),dt(e)&&(t[e]=!0),kt(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];Q(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 Q(t)||(t==!0?e="":e="none"),e},getRowDefaultClass(o){const{expand:t}=this.tempKeyList_[o]||{};let e="ht-table-row-expand-icon";return Q(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},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="";it(u)&&(f=u),dt(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=ei(o),e=JSON.parse(JSON.stringify(t));this.tableData_=o,this.flattenDataObj_=e,ct(this.setCheckboxDefaultValues)||this.$nextTick(()=>{this.setCheckVal()})}}};var si=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)])])},oi=[],ri=re(ii,si,oi,!1,null,"20434c46",null,null);const ut=ri.exports;ut.install=o=>{o.component(ut.name,ut)},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 ni=Object.defineProperty,hi=Object.defineProperties,li=Object.getOwnPropertyDescriptors,vt=Object.getOwnPropertySymbols,ne=Object.prototype.hasOwnProperty,he=Object.prototype.propertyIsEnumerable,Ft=(o,t,e)=>t in o?ni(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,S=(o,t)=>{for(var e in t||(t={}))ne.call(t,e)&&Ft(o,e,t[e]);if(vt)for(var e of vt(t))he.call(t,e)&&Ft(o,e,t[e]);return o},N=(o,t)=>hi(o,li(t)),le=(o,t)=>{var e={};for(var i in o)ne.call(o,i)&&t.indexOf(i)<0&&(e[i]=o[i]);if(o!=null&&vt)for(var i of vt(o))t.indexOf(i)<0&&he.call(o,i)&&(e[i]=o[i]);return e},l=(o,t,e)=>Ft(o,typeof t!="symbol"?t+"":t,e),D=(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 tt(){return tt=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},tt.apply(this,arguments)}function ai(o,t){o.prototype=Object.create(t.prototype),o.prototype.constructor=o,ft(o,t)}function Nt(o){return Nt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Nt(o)}function ft(o,t){return ft=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,i){return e.__proto__=i,e},ft(o,t)}function ci(){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 _t(o,t,e){return ci()?_t=Reflect.construct.bind():_t=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},_t.apply(null,arguments)}function di(o){return Function.toString.call(o).indexOf("[native code]")!==-1}function Bt(o){var t=typeof Map=="function"?new Map:void 0;return Bt=function(e){if(e===null||!di(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 _t(e,arguments,Nt(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),ft(i,e)},Bt(o)}var ui=/%[sdj%]/g,ae=function(){};typeof process<"u"&&process.env&&process.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof document<"u"&&(ae=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 Xt(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 B(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(ui,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 fi(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||fi(t)&&typeof o=="string"&&!o)}function xi(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 ce(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 gi(o){var t=[];return Object.keys(o).forEach(function(e){t.push.apply(t,o[e]||[])}),t}var de=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}(Bt(Error));function pi(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 de(y,Xt(y))):f(s)},p=gi(o);ce(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 de(c,Xt(c))):f(s)};h.length||(i(c),f(s)),h.forEach(function(p){var y=o[p];n.indexOf(p)!==-1?ce(y,e,g):xi(y,e,g)})});return u.catch(function(f){return f}),u}function yi(o){return!!(o&&o.message!==void 0)}function wi(o,t){for(var e=o,i=0;i<t.length;i++){if(e==null)return e;e=e[t[i]]}return e}function ue(o,t){return function(e){var i;return o.fullFields?i=wi(t,o.fullFields):i=t[e.field||o.fullField],yi(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 fe(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]=tt({},o[e],i):o[e]=i}}return o}var xe=function(o,t,e,i,s,r){o.required&&(!e.hasOwnProperty(o.field)||A(t,r||o.type))&&i.push(B(s.messages.required,o.fullField))},mi=function(o,t,e,i,s){(/^\s+$/.test(t)||t==="")&&i.push(B(s.messages.whitespace,o.fullField))},Rt,Ei=function(){if(Rt)return Rt;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 Rt=new RegExp("(?:^"+m+"$)","i"),Rt},ge={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,}))$/,hex:/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i},xt={integer:function(o){return xt.number(o)&&parseInt(o,10)===o},float:function(o){return xt.number(o)&&!xt.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"&&!xt.array(o)},method:function(o){return typeof o=="function"},email:function(o){return typeof o=="string"&&o.length<=320&&!!o.match(ge.email)},url:function(o){return typeof o=="string"&&o.length<=2048&&!!o.match(Ei())},hex:function(o){return typeof o=="string"&&!!o.match(ge.hex)}},bi=function(o,t,e,i,s){if(o.required&&t===void 0){xe(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?xt[n](t)||i.push(B(s.messages.types[n],o.fullField,o.type)):n&&typeof t!==o.type&&i.push(B(s.messages.types[n],o.fullField,o.type))},Ci=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(B(s.messages[c].len,o.fullField,o.len)):n&&!h&&d<o.min?i.push(B(s.messages[c].min,o.fullField,o.min)):h&&!n&&d>o.max?i.push(B(s.messages[c].max,o.fullField,o.max)):n&&h&&(d<o.min||d>o.max)&&i.push(B(s.messages[c].range,o.fullField,o.min,o.max))},st="enum",vi=function(o,t,e,i,s){o[st]=Array.isArray(o[st])?o[st]:[],o[st].indexOf(t)===-1&&i.push(B(s.messages[st],o.fullField,o[st].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(B(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(B(s.messages.pattern.mismatch,o.fullField,t,o.pattern))}}},R={required:xe,whitespace:mi,type:bi,range:Ci,enum:vi,pattern:_i},Ri=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();R.required(o,t,i,r,s,"string"),A(t,"string")||(R.type(o,t,i,r,s),R.range(o,t,i,r,s),R.pattern(o,t,i,r,s),o.whitespace===!0&&R.whitespace(o,t,i,r,s))}e(r)},Ii=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();R.required(o,t,i,r,s),t!==void 0&&R.type(o,t,i,r,s)}e(r)},Oi=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();R.required(o,t,i,r,s),t!==void 0&&(R.type(o,t,i,r,s),R.range(o,t,i,r,s))}e(r)},Li=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();R.required(o,t,i,r,s),t!==void 0&&R.type(o,t,i,r,s)}e(r)},Ti=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();R.required(o,t,i,r,s),A(t)||R.type(o,t,i,r,s)}e(r)},Si=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();R.required(o,t,i,r,s),t!==void 0&&(R.type(o,t,i,r,s),R.range(o,t,i,r,s))}e(r)},Ai=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();R.required(o,t,i,r,s),t!==void 0&&(R.type(o,t,i,r,s),R.range(o,t,i,r,s))}e(r)},Di=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();R.required(o,t,i,r,s,"array"),t!=null&&(R.type(o,t,i,r,s),R.range(o,t,i,r,s))}e(r)},Mi=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();R.required(o,t,i,r,s),t!==void 0&&R.type(o,t,i,r,s)}e(r)},Hi="enum",ki=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();R.required(o,t,i,r,s),t!==void 0&&R[Hi](o,t,i,r,s)}e(r)},Ki=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();R.required(o,t,i,r,s),A(t,"string")||R.pattern(o,t,i,r,s)}e(r)},Fi=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(R.required(o,t,i,r,s),!A(t,"date")){var h;t instanceof Date?h=t:h=new Date(t),R.type(o,h,i,r,s),h&&R.range(o,h.getTime(),i,r,s)}}e(r)},Ni=function(o,t,e,i,s){var r=[],n=Array.isArray(t)?"array":typeof t;R.required(o,t,i,r,s,n),e(r)},Yt=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();R.required(o,t,i,n,s,r),A(t,r)||R.type(o,t,i,n,s)}e(n)},Bi=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();R.required(o,t,i,r,s)}e(r)},gt={string:Ri,method:Ii,number:Oi,boolean:Li,regexp:Ti,integer:Si,float:Ai,array:Di,object:Mi,enum:ki,pattern:Ki,date:Fi,url:Yt,hex:Yt,email:Yt,required:Ni,any:Bi};function Vt(){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 Pt=Vt(),pt=function(){function o(e){this.rules=null,this._messages=Pt,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=fe(Vt(),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=Xt(p),a(p,y)):a(null,n)}if(h.messages){var c=this.messages();c===Pt&&(c=Vt()),fe(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=tt({},n)),y=n[g]=m.transform(y)),typeof m=="function"?m={validator:m}:m=tt({},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 pi(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,I){return tt({},I,{fullField:y.fullField+"."+v,fullFields:y.fullFields?[].concat(y.fullFields,[v]):[v]})}function w(v){v===void 0&&(v=[]);var I=Array.isArray(v)?v:[v];!h.suppressWarning&&I.length&&o.warning("async-validator:",I),I.length&&y.message!==void 0&&(I=[].concat(y.message));var T=I.map(ue(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(ue(y,n)):h.error&&(T=[h.error(y,B(h.messages.required,y.field))]),p(T);var H={};y.defaultField&&Object.keys(g.value).map(function(_){H[_]=y.defaultField}),H=tt({},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&&!gt.hasOwnProperty(e.type))throw new Error(B("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"?gt.required:gt[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");gt[o]=t},pt.warning=ae,pt.messages=Pt,pt.validators=gt;function pe(){return"xxxxxxxxxxxxxxxxxx".replace(/[x]/g,function(o){const t=Math.random()*16|0;return(o==="x"?t:t&3|8).toString(16)})}function ye(o,t){let e=0,i;return function(...s){const r=new Date().getTime(),n=r-e;!e||n>=t?(o.apply(this,s),e=r):i||(i=setTimeout(()=>{o.apply(this,s),e=new Date().getTime(),i=void 0},t-n))}}function we(o=[]){return o.length?o.map(t=>we(t.children)+1).sort((t,e)=>e-t)[0]:0}function Xi(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 me(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=me(i.children,t-1,e+1);return n&&n.forEach(h=>{var a;s+=(a=h.colspan)!=null?a:0}),N(S({},i),{width:i.width,level:e,rowspan:1,colspan:s,children:n})}return N(S({},i),{level:e,rowspan:t,colspan:1})})}function zt(o=[]){let t=[];return o.forEach(e=>{e.children?t=t.concat(zt(e.children)):t.push(e)}),t}const Ee=/^(\r\n|\n\r|\r|\n)/,Yi=/^[^\t\r\n]+/,be=/^\t/;function Vi(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(be))o=o.replace(be,""),e+=1,t[i][e]="";else if(o.match(Ee))o=o.replace(Ee,""),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(Yi);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 Pi(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 Ce(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 ve(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 zi(o,t,e=[]){const{visibleRows:i,rowIndex:s,headIndex:r}=o,n=Ce(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 Wi(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=ve(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 _e{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}getRightFixedX(){}}class Wt extends _e{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.renderFooter,this.hoverIconName=a.hoverIconName,this.formatter=a.formatter,this.formatterFooter=a.formatterFooter,this.update()}setWidthHeight(t,e){this.width=t,this.height=e}getValidationMessage(){const t=this.ctx.database.getValidationError(this.rowKey,this.key);if(Array.isArray(t)&&t.length){const[e]=t;this.message=e.message||""}return this.message}update(){this.drawX=this.getDrawX(),this.drawY=this.getDrawY(),this.drawTextX=this.drawX,this.drawTextY=this.drawY,this.isHasChanged=this.ctx.database.isHasChangedData(this.rowKey,this.key),this.updateSpan(),this.updateStyle(),this.updateType(),this.updateHoverIcon(),this.updateSelection(),this.updateTree(),this.updateEditor(),this.updateRender(),this.getValidationMessage(),this.updateContainer(),this.text=this.getText(),this.displayText=this.getDisplayText()}updateSpan(){if(this.cellType==="footer")return;const{SPAN_METHOD:t}=this.ctx.config;if(typeof t=="function"){const e=t,{colspan:i=1,rowspan:s=1,relationRowKeys:r,relationColKeys:n,mergeRow:h=!1,mergeCol:a=!1}=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue(),headIndex:this.ctx.body.headIndex,headPosition:this.ctx.database.getPositionForRowIndex(this.ctx.body.headIndex),visibleRows:this.ctx.body.visibleRows,visibleLeafColumns:this.ctx.header.visibleLeafColumns,rows:this.ctx.body.data})||{};Array.isArray(r)&&r.length>0?this.relationRowKeys=r:this.relationRowKeys=[this.key],Array.isArray(n)&&n.length>0?this.relationColKeys=n:this.relationColKeys=[this.key],this.mergeCol=a,this.mergeRow=h,this.colspan=i,this.rowspan=s,this.visibleWidth=this.getWidthByColIndexColSpan(this.colIndex,this.colspan),this.visibleHeight=this.ctx.database.getHeightByRowIndexRowSpan(this.rowIndex,this.rowspan)}}updateSpanInfo(){if(this.mergeRow||this.mergeCol){const t=this.getSpanInfo();this.height=t.height,this.width=t.width,this.drawX=this.getDrawX(),this.drawY=this.getDrawY(),this.drawY-=t.offsetTop,this.drawX-=t.offsetLeft}}updateType(){const{BODY_CELL_TYPE_METHOD:t}=this.ctx.config;if(typeof t=="function"){const e=t({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});e!==void 0&&(this.type=e)}}updateEditor(){const{BODY_CELL_EDITOR_METHOD:t}=this.ctx.config;if(typeof t=="function"){const e=t({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});if(e!==void 0){const{type:i,props:s={}}=e;this.editorType=i,this.editorProps=s}}}updateRender(){const{BODY_CELL_RENDER_METHOD:t}=this.ctx.config;if(typeof t=="function"){const e=t({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});e!==void 0&&(this.render=e)}}validate(){this.ctx.database.getValidator(this.rowKey,this.key).then(()=>{this.ctx.database.setValidationError(this.rowKey,this.key,[]),this.message=""}).catch(t=>{if(Array.isArray(t)&&t.length){const[e]=t;this.message=e.message,this.ctx.database.setValidationError(this.rowKey,this.key,t)}}).finally(()=>{this.ctx.emit("draw")})}updateStyle(){this.style=this.getOverlayerViewsStyle()}updateTree(){const{CELL_PADDING:t=0}=this.ctx.config,{rowKey:e,cellType:i}=this;let s,r=0,n="";if(this.type==="tree"&&i==="body"){const h=this.ctx.database.getRowForRowKey(e),{expand:a=!1,hasChildren:d=!1,expandLoading:c=!1,level:u=0}=h||{};if(this.rowExpand=a,this.rowHasChildren=d,c){const g=this.ctx.icons.get("loading");n="loading",s=g,r=u*8}else if(d){const g=this.ctx.icons.get("expand"),p=this.ctx.icons.get("shrink");s=a?p:g,n=a?"shrink":"expand",r=u*8}else r=u*8;let f=20,x=20;if(s){let g=this.drawX+r+t,p=this.drawY+(this.visibleHeight-x)/2;this.ctx.paint.drawImage(s,g,p,f,x),this.drawImageX=g,this.drawImageY=p,this.drawImageWidth=f,this.drawImageHeight=x,this.drawImageName=n,this.drawImageSource=s}this.align="left",this.drawTextX=r+this.drawX+f-.5}}updateContainer(){const{BODY_BG_COLOR:t,EDIT_BG_COLOR:e,BODY_CELL_STYLE_METHOD:i,FOOTER_CELL_STYLE_METHOD:s,READONLY_TEXT_COLOR:r,FOOTER_BG_COLOR:n,HIGHLIGHT_SELECTED_ROW:h,HIGHLIGHT_SELECTED_ROW_COLOR:a,HIGHLIGHT_HOVER_ROW:d,HIGHLIGHT_HOVER_ROW_COLOR:c}=this.ctx.config;if(this.cellType==="footer"){let y=n,E=r;if(typeof s=="function"){const m=s,{backgroundColor:w,color:b}=m({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()})||{};w&&(y=w),b&&(E=b)}this.drawCellSkyBgColor="transparent",this.drawCellBgColor=y,this.drawTextColor=E;return}let u="transparent";const f=this.ctx.focusCell,x=this.ctx.hoverCell;d&&(x==null?void 0:x.rowKey)===this.rowKey&&(u=c),h&&(f==null?void 0:f.rowKey)===this.rowKey&&(u=a),this.drawCellSkyBgColor=u;let g=t,p=r;if(["index","index-selection","selection"].includes(this.type)){this.drawCellBgColor=t,this.drawTextColor=r;return}if(this.ctx.database.getReadonly(this.rowKey,this.key)||(g=e,p=r),typeof i=="function"){const y=i,{backgroundColor:E,color:m}=y({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,isHasChanged:this.isHasChanged,value:this.getValue()})||{};E&&(g=E),m&&(p=m)}this.drawCellBgColor=g,this.drawTextColor=p}updateSelection(){const{visibleWidth:t,visibleHeight:e,rowspan:i,colspan:s,cellType:r,type:n,rowIndex:h,rowKey:a}=this;if(!(i===0||s===0)&&r!=="footer"&&["index-selection","selection"].includes(n)){const d=this.ctx.database.getRowSelection(a),c=this.ctx.database.getRowSelectable(a),{CHECKBOX_SIZE:u=0}=this.ctx.config,f=this.drawX+(t-u)/2,x=this.drawY+(e-u)/2;let g=this.ctx.icons.get("checkbox-uncheck"),p="checkbox-uncheck";d&&c?(g=this.ctx.icons.get("checkbox-check"),p="checkbox-check"):d&&c?(g=this.ctx.icons.get("checkbox-check-disabled"),p="checkbox-check-disabled"):!d&&c?(g=this.ctx.icons.get("checkbox-uncheck"),p="checkbox-uncheck"):(g=this.ctx.icons.get("checkbox-disabled"),p="checkbox-disabled"),g&&n=="index-selection"?(this.ctx.hoverCell&&this.ctx.hoverCell.rowIndex===h||["checkbox-disabled","checkbox-check"].includes(p))&&(this.drawImageX=f,this.drawImageY=x,this.drawImageWidth=u,this.drawImageHeight=u,this.drawImageName=p,this.drawImageSource=g):g&&n==="selection"&&(this.drawImageX=f,this.drawImageY=x,this.drawImageWidth=u,this.drawImageHeight=u,this.drawImageName=p,this.drawImageSource=g)}}updateHoverIcon(){const{BODY_CELL_HOVER_ICON_METHOD:t,CELL_HOVER_ICON_SIZE:e,CELL_PADDING:i}=this.ctx.config;if(typeof t=="function"){const n=t({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});n!==void 0&&(this.hoverIconName=n)}const s=this.drawX+this.width-e-i,r=this.drawY+(this.height-e)/2;if(this.hoverIconName&&this.ctx.hoverCell&&this.ctx.hoverCell.rowIndex===this.rowIndex){const n=this.ctx.icons.get(this.hoverIconName);this.drawImageX=s,this.drawImageY=r,this.drawImageWidth=e,this.drawImageHeight=e,this.drawImageName=this.hoverIconName,this.drawImageSource=n}}getSpanInfo(){return this.ctx.database.getSpanInfo(this)}getDisplayText(){return this.cellType==="footer"?this.renderFooter||this.text===null||this.text===void 0?"":this.text:this.rowspan===0||this.colspan===0||this.render||this.type==="index-selection"&&(this.ctx.hoverCell&&this.ctx.hoverCell.rowIndex===this.rowIndex||["checkbox-disabled","checkbox-check"].includes(this.drawImageName))||this.text===null||this.text===void 0?"":`${this.text}`}getText(){if(this.cellType==="footer")return typeof this.formatterFooter=="function"?this.formatterFooter({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.row[this.key]}):this.row[this.key];if(typeof this.formatter=="function")return this.formatter({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});const{BODY_CELL_FORMATTER_METHOD:t}=this.ctx.config;return typeof t=="function"?t({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()}):["index-selection","index"].includes(this.type)?`${this.rowIndex+1}`:(this.value=this.ctx.database.getItemValue(this.rowKey,this.key),this.value)}getValue(){return this.ctx.database.getItemValue(this.rowKey,this.key)}setValue(t){this.ctx.setItemValueByEditor(this.rowKey,this.key,t)}getOverlayerViewsStyle(){let t=`${this.drawX-this.ctx.fixedLeftWidth}px`,e=`${this.drawY-this.ctx.body.y}px`;return this.fixed==="left"?t=`${this.drawX}px`:this.fixed==="right"&&(t=`${this.drawX-(this.ctx.stageWidth-this.ctx.fixedRightWidth)}px`),this.cellType==="footer"&&this.ctx.config.FOOTER_FIXED&&(e=`${this.drawY-this.ctx.footer.y}px`),{position:"absolute",overflow:"hidden",left:t,top:e,width:`${this.visibleWidth}px`,height:`${this.visibleHeight}px`,pointerEvents:"initial",userSelect:"none"}}draw(){const{paint:t,config:{BORDER_COLOR:e}}=this.ctx,{drawX:i,drawY:s}=this;t.drawRect(i,s,this.visibleWidth,this.visibleHeight,{borderColor:e,fillColor:this.drawCellBgColor}),t.drawRect(i,s,this.width,this.height,{borderColor:"transparent",borderWidth:1,fillColor:this.drawCellSkyBgColor}),this.drawText(),this.drawImage(),this.drawSelector(),this.drawAutofillPiont(),this.drawErrorTip()}getWidthByColIndexColSpan(t,e){if(e===0)return 0;let i=0;for(let s=t;s<t+e;s++){const r=this.ctx.header.leafCellHeaders[s];i+=r.width}return i}drawText(){const{CELL_PADDING:t,BODY_FONT:e}=this.ctx.config,{ellipsis:i}=this.ctx.paint.handleEllipsis(this.text,this.width,t,e);return this.ellipsis=i,this.ctx.paint.drawText(this.displayText,this.drawTextX,this.drawTextY,this.visibleWidth,this.visibleHeight,{font:e,padding:t,align:this.align,verticalAlign:this.verticalAlign,color:this.drawTextColor})}drawImage(){this.drawImageSource&&this.ctx.paint.drawImage(this.drawImageSource,this.drawImageX,this.drawImageY,this.drawImageWidth,this.drawImageHeight)}drawAutofillPiont(){if(this.cellType==="footer")return;const{SELECT_BORDER_COLOR:t,ENABLE_AUTOFILL:e,ENABLE_SELECTOR:i,AUTOFILL_POINT_BORDER_COLOR:s}=this.ctx.config;if(!i||!e)return;const{xArr:r,yArr:n}=this.ctx.selector,h=r[1],a=n[1],{colIndex:d,rowIndex:c,drawX:u,drawY:f}=this;d===h&&c===a&&this.ctx.paint.drawRect(u+this.width-6,f+this.height-6,6,6,{borderColor:s,fillColor:t})}drawSelector(){if(this.cellType==="footer")return;const{ENABLE_SELECTOR:t}=this.ctx.config;if(!t)return;const{xArr:e,yArr:i,xArrCopy:s,yArrCopy:r}=this.ctx.selector;this.drawBorder({xArr:s,yArr:r,borderColor:this.ctx.config.SELECT_BORDER_COLOR||"rgb(82,146,247)",fillColor:this.ctx.config.SELECT_AREA_COLOR||"rgba(82,146,247,0.1)",borderWidth:1,lineDash:[4,4]}),this.drawBorder({xArr:this.ctx.autofill.xArr,yArr:this.ctx.autofill.yArr,borderColor:this.ctx.config.SELECT_BORDER_COLOR||"rgb(82,146,247)",fillColor:this.ctx.config.SELECT_AREA_COLOR||"rgba(82,146,247,0.1)",borderWidth:1,lineDash:[4,4]}),this.drawBorder({xArr:e,yArr:i,borderColor:this.ctx.config.SELECT_BORDER_COLOR||"rgb(82,146,247)",fillColor:this.ctx.config.SELECT_AREA_COLOR||"rgba(82,146,247,0.1)",borderWidth:1})}drawErrorTip(){if(this.cellType==="footer"||!this.message||this.rowspan===0||this.colspan===0)return;const{ERROR_TIP_ICON_SIZE:t,ERROR_TIP_COLOR:e}=this.ctx.config,{width:i}=this,s=this.drawX,r=this.drawY,n=[s+i-t-.5,r,s+i-.5,r,s+i-.5,r+t];this.ctx.paint.drawLine(n,{borderColor:e,fillColor:e,borderWidth:1,lineCap:"round",lineJoin:"round"})}drawBorder(t){const{drawX:e,drawY:i,width:s,rowIndex:r,colIndex:n}=this;let h=e+.5,a=i+.5,d=this.height;r===0&&(a=this.y+1,d=d-1),n===this.ctx.maxColIndex&&(h=h-1);const{xArr:c,yArr:u,lineDash:f=[],borderWidth:x=1,borderColor:g,fillColor:p}=t,y=c[0],E=c[1],m=u[0],w=u[1];n>=y&&n<=E&&r===m&&this.ctx.paint.drawLine([h,a,h+s-2,a],{borderColor:g,fillColor:p,borderWidth:x,lineCap:"round",lineJoin:"round",lineDash:f}),n>=y&&n<=E&&r===w&&this.ctx.paint.drawLine([h,a+d-1.5,h+s,a+d-1.5],{borderColor:g,fillColor:p,borderWidth:x,lineCap:"round",lineJoin:"round",lineDash:f}),n===y&&r>=m&&r<=w&&this.ctx.paint.drawLine([h,a,h,a+d-1],{borderColor:g,fillColor:p,borderWidth:x,lineCap:"round",lineJoin:"round",lineDash:f}),n===E&&r>=m&&r<=w&&this.ctx.paint.drawLine([h+s-1.5,a,h+s-1.5,a+d-1.5],{borderColor:g,fillColor:p,borderWidth:x,lineCap:"round",lineJoin:"round",lineDash:f})}}class $i{constructor(t,e){l(this,"loading",!1),l(this,"ctx"),l(this,"data"),l(this,"columns"),l(this,"footerData",[]),l(this,"rowKeyMap",new Map),l(this,"colIndexKeyMap",new Map),l(this,"headerMap",new Map),l(this,"rowIndexRowKeyMap",new Map),l(this,"checkboxKeyMap",new Map),l(this,"originalDataMap",new Map),l(this,"changedDataMap",new Map),l(this,"validationErrorMap",new Map),l(this,"itemRowKeyMap",new WeakMap),l(this,"bufferData",[]),l(this,"sumHeight",0),l(this,"filterMethod"),l(this,"positions",[]),this.ctx=t;const{data:i=[],columns:s=[],footerData:r=[]}=e;this.data=i,this.footerData=r,this.columns=s,this.setLoading(!0),this.init()}init(){this.clearBufferData(),this.rowKeyMap.clear(),this.checkboxKeyMap.clear(),this.colIndexKeyMap.cle