tm-table 1.1.14 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- (function(u,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue"),require("sortablejs")):typeof define=="function"&&define.amd?define(["exports","vue","sortablejs"],e):(u=typeof globalThis!="undefined"?globalThis:u||self,e(u.TmTable={},u.Vue,u.Sortable))})(this,function(u,e,g){"use strict";var Tl=Object.defineProperty,wl=Object.defineProperties;var zl=Object.getOwnPropertyDescriptors;var P=Object.getOwnPropertySymbols;var se=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable;var ie=(u,e,g)=>e in u?Tl(u,e,{enumerable:!0,configurable:!0,writable:!0,value:g}):u[e]=g,b=(u,e)=>{for(var g in e||(e={}))se.call(e,g)&&ie(u,g,e[g]);if(P)for(var g of P(e))ne.call(e,g)&&ie(u,g,e[g]);return u},B=(u,e)=>wl(u,zl(e));var oe=(u,e)=>{var g={};for(var _ in u)se.call(u,_)&&e.indexOf(_)<0&&(g[_]=u[_]);if(u!=null&&P)for(var _ of P(u))e.indexOf(_)<0&&ne.call(u,_)&&(g[_]=u[_]);return g};const _={mini:"small",small:"small",default:"default",large:"large"},E=t=>_[t]||_.default,T=()=>"default",ae={"zh-CN":{today:"今天",yesterday:"昨天",last7days:"最近7天",last30days:"最近30天",thisMonth:"本月",lastMonth:"上月",checkAll:"全选",search:"搜索",query:"查询",reset:"重置",columnSetting:"列设置",refresh:"刷新",cancel:"取消",fixedLeft:"固定在左侧",fixedRight:"固定在右侧",top:"置顶",restoreDefault:"恢复默认",saveAndApply:"保存并应用",startDate:"开始日期",endDate:"结束日期",all:"全选",SelectableFields:"可选择字段",fixedColumns:"固定列",leftmost:"左侧最多",rightmost:"右侧最多",items:"项",accurateSearchTips:"每行一个,支持多个值",accurateSearchPlaceholder:"精确搜索,一行一项",selectPlaceholder:"请选择",clear:"清空",saveSuccess:"保存成功",cancelRightFixed:"取消右侧固定",rightFixed:"固定到右侧",cancelLeftFixed:"取消左侧固定",leftFixed:"固定到左侧",cancelTop:"取消置顶",copySuccess:"复制成功",copyFailed:"复制失败"},"en-US":{today:"Today",yesterday:"Yesterday",last7days:"Last 7 days",last30days:"Last 30 days",thisMonth:"This month",lastMonth:"Last month",checkAll:"Check all",search:"Search",query:"Search",reset:"Reset",columnSetting:"Column Setting",refresh:"Refresh",cancel:"Cancel",fixedLeft:"Fixed left",fixedRight:"Fixed right",top:"Top",restoreDefault:"Restore default",saveAndApply:"Save and apply",startDate:"Start date",endDate:"End date",all:"All",SelectableFields:"Fields",fixedColumns:"Fixed columns",leftmost:"Leftmost",rightmost:"Rightmost",items:"item(s)",accurateSearchTips:"One per line, supporting multiple values",accurateSearchPlaceholder:"Accurate search, one per line",selectPlaceholder:"Please select",clear:"Clear",saveSuccess:"Successfully saved",cancelRightFixed:"Cancel right fixed",rightFixed:"Fixed to right",cancelLeftFixed:"Cancel left fixed",leftFixed:"Fixed to left",cancelTop:"Cancel top",copySuccess:"Copy successfully",copyFailed:"Copy failed"}};let N={value:"zh-CN"};N=e.ref("zh-CN");const re=t=>{var i;return((i=ae[N.value])==null?void 0:i[t])||t},M=t=>{N.value=t},w=()=>({t:re,setLang:M,currentLang:N}),y=(t,i)=>{const l=t.__vccOpts||t;for(const[o,s]of i)l[o]=s;return l},ce=!1,de=!0,A="modelValue",he="update:modelValue",ue={name:"TmSelectFilter",props:{[A]:{type:[String,Number,Array],default:""},field:{type:[String,Number],default:""},options:{type:[Array,Function],default:()=>[]},labelOptions:{type:Array,default:()=>[]},props:{type:Object,default:()=>({label:"label",value:"value"})},filterable:{type:Boolean,default:!0},clearable:{type:Boolean,default:!0},collapseTags:{type:Boolean,default:!0},multiple:{type:Boolean,default:!1},showCheckAll:{type:Boolean,default:!0},placeholder:{type:String,default:""},valueOnClear:{type:[String,Number,Boolean,Array,Function],default:void 0}},data(){return{t:w().t,isVue2:ce,isVue3:de,getDefaultSize:T,optionsList:[],loading:!1,indeterminate:!1,checkAll:!1,activedSelect:""}},computed:{computedValue:{get(){return this[A]},set(t){let i=t;if(this.multiple&&Array.isArray(t)&&t.length===0&&this.valueOnClear!==void 0){const l=this[A];Array.isArray(l)&&l.length>0&&(i=typeof this.valueOnClear=="function"?this.valueOnClear():this.valueOnClear)}this.$emit(he,i),this.$emit("change",i)}},fieldValue:{get(){return this.field},set(t){this.$emit("field-change",t)}},propMap(){return{label:this.props.label||"label",value:this.props.value||"value"}}},watch:{[A](t){!this.multiple||!this.showCheckAll||(t.length===0?(this.checkAll=!1,this.indeterminate=!1):t.length===this.optionsList.length?(this.checkAll=!0,this.indeterminate=!1):this.indeterminate=!0)}},created(){this.initOptions()},methods:{async initOptions(){if(Array.isArray(this.options))this.optionsList=this.options;else if(typeof this.options=="function")try{this.loading=!0;const t=await this.options();Array.isArray(t)&&(this.optionsList=t)}catch(t){console.error(t)}finally{this.loading=!1}},handleCheckAll(t){this.indeterminate=!1;let i=[];t&&(i=this.optionsList.map(l=>l[this.propMap.value])),this.computedValue=i},setActivedSelect(t){this.activedSelect=t},handleClear(){if(this.valueOnClear!==void 0){const t=typeof this.valueOnClear=="function"?this.valueOnClear():this.valueOnClear;this.$nextTick(()=>{this.computedValue=t})}}}},me={key:0,class:"check-all-option"};function pe(t,i,l,o,s,n){const r=e.resolveComponent("el-option"),h=e.resolveComponent("el-select"),c=e.resolveComponent("el-checkbox");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["advanced-select",{hasField:l.labelOptions&&l.labelOptions.length>0}])},[l.labelOptions&&l.labelOptions.length>0?(e.openBlock(),e.createBlock(h,{key:0,size:s.getDefaultSize(),class:e.normalizeClass(["field-select",`field-select--${s.isVue2?"v2":"v3"}`]),modelValue:n.fieldValue,"onUpdate:modelValue":i[0]||(i[0]=d=>n.fieldValue=d),onFocus:i[1]||(i[1]=d=>n.setActivedSelect("left")),style:e.normalizeStyle(`z-index:${s.activedSelect==="left"?2:0}`)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.labelOptions,d=>(e.openBlock(),e.createBlock(r,{key:d.value,label:d.label,value:d.value},null,8,["label","value"]))),128))]),_:1},8,["size","class","modelValue","style"])):e.createCommentVNode("",!0),e.createVNode(h,e.mergeProps({ref:"select",class:["select",`select--${s.isVue3?"v3":"v2"}`],onFocus:i[4]||(i[4]=d=>n.setActivedSelect("right")),onClear:n.handleClear,style:`z-index:${s.activedSelect==="right"?2:0}`,modelValue:n.computedValue,"onUpdate:modelValue":i[5]||(i[5]=d=>n.computedValue=d)},B(b({},t.$attrs),{size:s.getDefaultSize(),filterable:l.filterable,clearable:l.clearable,collapseTags:l.collapseTags,multiple:l.multiple,placeholder:l.placeholder,loading:s.loading}),e.toHandlers(s.isVue2?t.$listeners:{}),{loading:s.loading}),{header:e.withCtx(()=>[s.isVue3&&l.multiple&&l.showCheckAll?(e.openBlock(),e.createBlock(c,{key:0,modelValue:s.checkAll,"onUpdate:modelValue":i[3]||(i[3]=d=>s.checkAll=d),indeterminate:s.indeterminate,size:s.getDefaultSize(),onChange:n.handleCheckAll,style:{width:"100%",height:"20px","padding-left":"10px"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(s.t("all")),1)]),_:1},8,["modelValue","indeterminate","size","onChange"])):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[s.isVue2&&l.multiple&&l.showCheckAll?(e.openBlock(),e.createElementBlock("div",me,[e.createVNode(c,{style:{width:"100%"},modelValue:s.checkAll,"onUpdate:modelValue":i[2]||(i[2]=d=>s.checkAll=d),indeterminate:s.indeterminate,size:s.getDefaultSize(),onChange:n.handleCheckAll},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(s.t("all")),1)]),_:1},8,["modelValue","indeterminate","size","onChange"])])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.optionsList,d=>(e.openBlock(),e.createBlock(r,{key:d[n.propMap.value],label:d[n.propMap.label],value:d[n.propMap.value],disabled:d.disabled},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"option",{item:d},()=>[e.createTextVNode(e.toDisplayString(d[n.propMap.label]),1)],!0)]),_:2},1032,["label","value","disabled"]))),128))]),_:3},16,["class","onClear","style","modelValue","loading"])],2)}const I=y(ue,[["render",pe],["__scopeId","data-v-ba62140c"]]),fe={name:"BaseIcon",props:{path:{type:String},size:{type:[String,Number]},color:{type:String}},methods:{handleClick(){}}},ge=["width","height"],be=["d"];function ye(t,i,l,o,s,n){return e.openBlock(),e.createElementBlock("i",{class:"tm-icon",onClick:i[0]||(i[0]=(...r)=>n.handleClick&&n.handleClick(...r))},[(e.openBlock(),e.createElementBlock("svg",{width:l.size,height:l.size,style:e.normalizeStyle({color:l.color}),viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},[e.createElementVNode("path",{d:l.path},null,8,be)],12,ge))])}const Ce=y(fe,[["render",ye],["__scopeId","data-v-1c30ca93"]]),S=Object.entries({menu:"M160 448a32 32 0 0 1-32-32V160.064a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V416a32 32 0 0 1-32 32zm448 0a32 32 0 0 1-32-32V160.064a32 32 0 0 1 32-32h255.936a32 32 0 0 1 32 32V416a32 32 0 0 1-32 32zM160 896a32 32 0 0 1-32-32V608a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32v256a32 32 0 0 1-32 32zm448 0a32 32 0 0 1-32-32V608a32 32 0 0 1 32-32h255.936a32 32 0 0 1 32 32v256a32 32 0 0 1-32 32z",more:"M76.92892277 192.94787572h864.34120754c23.20379058 0 46.40758118-17.40284367 46.40758118-46.40758118s-23.20379058-46.40758118-46.40758118-46.40758116H76.92892277c-29.00473897 0-46.40758264 17.40284367-46.40758264 46.40758116s23.20379058 46.40758118 46.40758264 46.40758118zM941.27013031 465.59241882H76.92892277c-29.00473897 0-46.40758264 17.40284367-46.40758264 46.40758118s23.20379058 46.40758118 46.40758264 46.40758118h864.34120754c23.20379058 0 46.40758118-17.40284367 46.40758118-46.40758118s-23.20379058-46.40758118-46.40758118-46.40758118zM941.27013031 825.25117589H76.92892277c-29.00473897 0-46.40758264 17.40284367-46.40758264 46.40758118s23.20379058 46.40758118 46.40758264 46.40758264h864.34120754c23.20379058 0 46.40758118-17.40284367 46.40758118-46.40758264s-23.20379058-46.40758118-46.40758118-46.40758118z",refresh:"M771.776 794.88A384 384 0 0 1 128 512h64a320 320 0 0 0 555.712 216.448H654.72a32 32 0 1 1 0-64h149.056a32 32 0 0 1 32 32v148.928a32 32 0 1 1-64 0v-50.56zM276.288 295.616h92.992a32 32 0 0 1 0 64H220.16a32 32 0 0 1-32-32V178.56a32 32 0 0 1 64 0v50.56A384 384 0 0 1 896.128 512h-64a320 320 0 0 0-555.776-216.384z",move:"M238.93333333 102.4a68.26666667 68.26666667 0 1 1 136.53333334 0 68.26666667 68.26666667 0 0 1-136.53333334 0z m409.6 0a68.26666667 68.26666667 0 1 1 136.53333334 0 68.26666667 68.26666667 0 0 1-136.53333334 0zM238.93333333 375.46666667a68.26666667 68.26666667 0 1 1 136.53333334 0 68.26666667 68.26666667 0 0 1-136.53333334 0z m409.6 0a68.26666667 68.26666667 0 1 1 136.53333334 0 68.26666667 68.26666667 0 0 1-136.53333334 0z m-409.6 273.06666666a68.26666667 68.26666667 0 1 1 136.53333334 0 68.26666667 68.26666667 0 0 1-136.53333334 0z m409.6 0a68.26666667 68.26666667 0 1 1 136.53333334 0 68.26666667 68.26666667 0 0 1-136.53333334 0z m-341.33333333 204.8a68.26666667 68.26666667 0 1 0 0 136.53333334 68.26666667 68.26666667 0 0 0 0-136.53333334z m341.33333333 68.26666667a68.26666667 68.26666667 0 1 1 136.53333334 0 68.26666667 68.26666667 0 0 1-136.53333334 0z","column-setting":"M436.05333334 18.36373333a109.22666667 109.22666667 0 0 1 109.22666666 0l345.56586667 199.54346667c33.792 19.52426667 54.61333333 55.56906667 54.61333333 94.54933333V580.26666667h-81.92V312.45653333a27.30666667 27.30666667 0 0 0-13.65333333-23.62026666L504.32 89.2928a27.30666667 27.30666667 0 0 0-27.30666666 0L131.44746667 288.83626667a27.30666667 27.30666667 0 0 0-13.65333333 23.62026666v399.08693334a27.30666667 27.30666667 0 0 0 13.65333333 23.62026666L477.01333334 934.7072a27.30666667 27.30666667 0 0 0 27.30666666 0l54.61333334-31.5392v94.54933333l-13.65333334 7.91893334a109.22666667 109.22666667 0 0 1-109.22666666 0l-345.56586667-199.54346667a109.22666667 109.22666667 0 0 1-54.61333333-94.54933333V312.45653333c0-38.98026667 20.82133333-75.09333333 54.61333333-94.54933333L436.05333334 18.36373333z","fixed-left":"M843.36363653 311.54545478l-53.18181827 1e-8-20.45454521 28.63636347-163.63636435 204.54545479-24.54545391 28.63636347 12.27272695 36.81818175c8.18181826 28.63636347 12.27272695 57.27272695 12.27272696 85.90909042 0 32.72727305-4.09090869 61.36363652-16.36363565 90-4.09090869 16.36363653-12.27272695 32.72727306-24.54545479 49.09090957l-163.63636347-163.63636347-40.90909131-40.90909132-12.27272695-12.27272695-163.63636348-163.63636347c28.63636347-16.36363653 61.36363652-28.63636347 94.09090869-32.72727305 45-8.18181826 90-4.09090869 134.99999999 8.18181826l36.81818175 12.27272695 28.63636347-24.54545391 204.54545479-163.63636435 28.63636347-16.36363564 0-32.72727305L712.45454521 184.72727305l130.90909132 126.81818173zM941.54545479 327.90909131c0-8.18181826-4.09090869-16.36363653-8.18181826-24.54545478L720.63636348 94.72727305c-12.27272695-16.36363653-36.81818174-12.27272695-49.09090869 4.0909087-20.45454521 28.63636347-28.63636347 65.45454521-28.63636348 98.18181825l0 4.09090869-204.54545478 163.63636436c-110.45454521-36.81818174-233.18181826-16.36363653-327.27272784 61.36363564-8.18181826 8.18181826-12.27272695 16.36363653-12.27272694 24.54545478 0 8.18181826 4.09090869 16.36363653 8.18181825 24.5454548l196.36363653 196.36363652-212.72727305 212.72727216c-4.09090869 4.09090869-8.18181826 12.27272695-8.18181826 20.4545461s4.09090869 16.36363653 8.18181826 20.4545452c12.27272695 12.27272695 32.72727306 12.27272695 45 1e-8L352.45454522 716.54545479l196.36363652 196.36363652c12.27272695 12.27272695 36.81818174 12.27272695 49.09090957-4.09090957C651.09090869 847.45454521 675.63636347 773.81818174 675.63636346 696.09090869c0-36.81818173-4.09090869-73.63636348-16.36363651-106.36363564l163.63636436-204.54545479c36.81818173 0 73.63636348-8.18181826 106.36363564-28.63636347C937.45454519 348.36363653 941.54545478 336.09090869 941.54545479 327.90909131z","fixed-right":"M311.54545479 180.63636347v53.18181827l28.63636347 20.45454521 204.54545479 163.63636436 28.63636347 24.5454539 36.81818174-12.27272695c28.63636347-8.18181826 57.27272695-12.27272695 85.90909043-12.27272695 32.72727305 0 61.36363652 4.09090869 90 16.36363564 16.36363653 4.09090869 32.72727305 12.27272695 49.09090957 24.54545479l-163.63636347 163.63636347-40.90909132 40.90909131-12.27272695 12.27272695-163.63636347 163.63636348c-16.36363653-28.63636347-28.63636347-61.36363652-32.72727305-94.09090869-8.18181826-45-4.09090869-90 8.18181826-135l12.27272695-36.81818174-24.5454539-28.63636347-163.63636436-204.54545479-16.36363564-28.63636347h-32.72727305H184.72727305l126.81818174-130.90909132zM327.90909131 82.45454521c-8.18181826 0-16.36363653 4.09090869-24.54545478 8.18181826L94.72727305 303.36363652c-16.36363653 12.27272695-12.27272695 36.81818174 4.09090869 49.09090869 28.63636347 20.45454521 65.45454521 28.63636347 98.18181826 28.63636348h4.09090869l163.63636436 204.54545478c-36.81818174 110.45454521-16.36363653 233.18181826 61.36363564 327.27272784 8.18181826 8.18181826 16.36363653 12.27272695 24.54545478 12.27272695 8.18181826 0 16.36363653-4.09090869 24.54545479-8.18181826l196.36363653-196.36363653 212.72727216 212.72727305c4.09090869 4.09090869 12.27272695 8.18181826 20.4545461 8.18181827s16.36363653-4.09090869 20.45454521-8.18181827c12.27272695-12.27272695 12.27272695-32.72727305 0-45L716.54545479 671.54545479l196.36363652-196.36363653c12.27272695-12.27272695 12.27272695-36.81818174-4.09090957-49.09090957C847.45454521 372.90909131 773.81818174 348.36363653 696.09090869 348.36363653c-36.81818174 0-73.63636348 4.09090869-106.36363564 16.36363652l-204.54545479-163.63636436c0-36.81818174-8.18181826-73.63636348-28.63636347-106.36363564C348.36363653 86.54545479 336.09090869 82.45454521 327.90909131 82.45454521z",upload:"M160 832h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64m384-578.304V704h-64V247.296L237.248 490.048 192 444.8 508.8 128l316.8 316.8-45.312 45.248z",download:"M160 832h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64m384-253.696 236.288-236.352 45.248 45.248L508.8 704 192 387.2l45.248-45.248L480 584.704V128h64z",delete:"M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32",copy:"M128 320v576h576V320zm-32-64h640a32 32 0 0 1 32 32v640a32 32 0 0 1-32 32H96a32 32 0 0 1-32-32V288a32 32 0 0 1 32-32M960 96v704a32 32 0 0 1-32 32h-96v-64h64V128H384v64h-64V96a32 32 0 0 1 32-32h576a32 32 0 0 1 32 32M256 672h320v64H256zm0-192h320v64H256z"}).reduce((t,[i,l])=>{const o=`${i}Icon`,s={name:o,props:{path:{type:String,default:l},size:{type:[String,Number]},color:{type:String}},render(n){return e.h(Ce,this.$props)}};return s.install=n=>{n.component(o,s)},t[i]=s,t},{}),ke=S.menu,Ve=S.refresh,xe=S.move;S["column-setting"];const _e=S.more,Se=S["fixed-left"],Te=S["fixed-right"],we=S.upload,ze=S.download,Be=S.delete,te=S.copy,{t:v}=w(),Fe=!1,Le=!0,Oe={name:"TmEllipsisText",components:{CopyIcon:te},props:{text:{type:String,required:!0},width:{type:[String,Number],default:"auto"},maxWidth:{type:[String,Number],default:"100%"},lines:{type:Number,default:1},showTooltip:{type:Boolean,default:!0},lineHeight:{type:[String,Number]},copyable:{type:Boolean,default:!1}},data(){return{isVue2:Fe,isVue3:Le,isOverflow:!1,currentLines:1,resizeObserver:null}},computed:{tooltipDisabled(){return!this.showTooltip||!this.isOverflow},textStyle(){const t=typeof this.width=="number"?`${this.width}px`:this.width,i=typeof this.maxWidth=="number"?`${this.maxWidth}px`:this.maxWidth;return{width:t,maxWidth:i,lineHeight:this.lineHeight,display:"-webkit-inline-box",overflow:"hidden",WebkitBoxOrient:"vertical",WebkitLineClamp:this.lines}}},mounted(){this.checkOverflow(),this.setupResizeObserver()},beforeDestroy(){this.cleanupResizeObserver()},beforeUnmount(){this.cleanupResizeObserver()},watch:{text(){this.$nextTick(this.checkOverflow)}},methods:{checkOverflow(){this.$refs.textEl&&this.$nextTick(()=>{this.$nextTick(()=>{this.performOverflowCheck()})})},performOverflowCheck(){var d;const t=this.$refs.textEl;if(!t)return;const i=getComputedStyle(t);if(!i.width||i.width==="0px"){this.$nextTick(()=>{this.performOverflowCheck()});return}const l=t.scrollHeight,o=t.scrollWidth,s=t.clientHeight,n=t.clientWidth,r=1,h=l>s+r,c=o>n+r;if(h||c){this.isOverflow=!0;const p=parseFloat(i.lineHeight)||16;this.currentLines=Math.ceil(l/p)}else{const p=t.getBoundingClientRect(),V=(d=t.parentElement)==null?void 0:d.getBoundingClientRect();if(V){const x=p.height>V.height||p.width>V.width;this.isOverflow=x}else this.isOverflow=!1;this.currentLines=1}},setupResizeObserver(){window.ResizeObserver&&this.$nextTick(()=>{try{this.resizeObserver=new ResizeObserver(()=>{this.checkOverflow()});const t=this.$el;t&&t instanceof Element&&this.resizeObserver.observe(t)}catch(t){console.warn("Failed to setup ResizeObserver:",t)}})},cleanupResizeObserver(){if(this.resizeObserver)try{this.resizeObserver.disconnect()}catch(t){console.warn("Failed to disconnect ResizeObserver:",t)}finally{this.resizeObserver=null}},handleCopy(){navigator.clipboard&&window.isSecureContext?navigator.clipboard.writeText(this.text).then(()=>{this.$message.success(v("copySuccess"))}).catch(()=>{this.fallbackCopy()}):this.fallbackCopy()},fallbackCopy(){const t=document.createElement("textarea");t.value=this.text,t.style.position="fixed",t.style.left="-999999px",t.style.top="-999999px",document.body.appendChild(t),t.focus(),t.select();try{document.execCommand("copy"),this.$message.success(v("copySuccess"))}catch(i){this.$message.error(v("copyFailed"))}document.body.removeChild(t)}}},Ee={class:"ellipsis-text-container"};function De(t,i,l,o,s,n){const r=e.resolveComponent("CopyIcon"),h=e.resolveComponent("el-tooltip");return e.openBlock(),e.createBlock(h,e.mergeProps({disabled:n.tooltipDisabled,content:l.text,effect:"dark",placement:"top"},{[s.isVue2?"open-delay":"show-after"]:300}),{default:e.withCtx(()=>[e.createElementVNode("div",Ee,[e.createElementVNode("div",{ref:"textEl",class:"ellipsis-text",style:e.normalizeStyle(n.textStyle)},e.toDisplayString(l.text),5),e.createElementVNode("div",{class:e.normalizeClass(["toolbar",{multiline:s.currentLines>1&&l.lines>1}])},[l.copyable?(e.openBlock(),e.createBlock(r,{key:0,class:"icon-item",onClick:n.handleCopy},null,8,["onClick"])):e.createCommentVNode("",!0)],2)])]),_:1},16,["disabled","content"])}const F=y(Oe,[["render",De],["__scopeId","data-v-0979131f"]]),Ne=!1,Me=!0,Ae={name:"TmAdvancedInputFilter",components:{MoreIcon:_e,EllipsisText:F},props:{label:{type:String,default:""},value:{type:String,default:""},field:{type:[String,Number],default:""},placeholder:{type:String,default:""},multiple:{type:Boolean,default:!1},labelOptions:{type:Array,default:()=>[]}},data(){return{t:w().t,isVue3:Me,isVue2:Ne,getDefaultSize:T,getCompatSize:E,exactValue:"",inputValue:"",isExactMode:!1,currentOptionMultiple:!1}},computed:{width(){return this.labelOptions&&this.labelOptions.length||this.label?"305px":"200px"},fieldValue:{get(){return this.field},set(t){this.$emit("field-change",t)}},shouldShowMultiple(){return this.currentOptionMultiple!==null?this.currentOptionMultiple:this.multiple},selectedOption(){return!this.labelOptions||!this.labelOptions.length||!this.field?null:this.labelOptions.find(t=>t.value===this.field)}},watch:{labelOptions:{handler(t){t&&t.length>0&&(this.field||this.$emit("field-change",t[0].value),this.updateCurrentOptionMultiple())},deep:!0,immediate:!0},field:{handler(){this.updateCurrentOptionMultiple()},immediate:!0},isExactMode(t){t?this.$emit("value-change",this.exactValue):this.$emit("value-change",this.inputValue)},exactValue(t){this.$emit("value-change",t)},inputValue(t){this.$emit("value-change",t)},value:{handler(t){this.isExactMode?this.exactValue=t:this.inputValue=t},immediate:!0}},methods:{handlePopoverClose(){document.activeElement&&document.activeElement.blur(),this.isExactMode=!1},handleVisibleChange(t){this.isExactMode=t},handlefieldChange(t){this.$emit("field-change",t),this.updateCurrentOptionMultiple()},updateCurrentOptionMultiple(){const t=this.selectedOption;t&&"multiple"in t?this.currentOptionMultiple=t.multiple:this.currentOptionMultiple=this.multiple},handleExactSearch(){this.$emit("value-change",this.exactValue),this.$emit("search",this.exactValue)},handleClear(){this.exactValue="",this.$emit("value-change","")},handleEnter(){this.$emit("search")}},created(){this.updateCurrentOptionMultiple()}},He={key:1,class:"input-label"},Re={class:"popover-content"},Pe={class:"popover-subtitle"},Ie={class:"popover-footer"};function ve(t,i,l,o,s,n){const r=e.resolveComponent("el-option"),h=e.resolveComponent("el-select"),c=e.resolveComponent("EllipsisText"),d=e.resolveComponent("el-input"),p=e.resolveComponent("el-button"),V=e.resolveComponent("MoreIcon"),x=e.resolveComponent("el-popover");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["tm-advanced-input",`tm-advanced-input--${s.isVue3?"v3":"v2"}`]),style:e.normalizeStyle({width:n.width})},[l.labelOptions&&l.labelOptions.length?(e.openBlock(),e.createBlock(h,{key:0,modelValue:n.fieldValue,"onUpdate:modelValue":i[0]||(i[0]=k=>n.fieldValue=k),placeholder:s.t("selectPlaceholder"),style:{width:"100px","flex-shrink":"0"},size:s.getDefaultSize(),class:"left-select",onChange:n.handlefieldChange},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.labelOptions,k=>(e.openBlock(),e.createBlock(r,{key:k.value,label:k.label,value:k.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","size","onChange"])):l.label?(e.openBlock(),e.createElementBlock("div",He,[e.createVNode(c,{text:l.label,lines:2},null,8,["text"])])):e.createCommentVNode("",!0),e.createVNode(d,{modelValue:s.inputValue,"onUpdate:modelValue":i[2]||(i[2]=k=>s.inputValue=k),size:s.getDefaultSize(),placeholder:l.placeholder,onKeyup:e.withKeys(n.handleEnter,["enter","native"]),clearable:"",class:e.normalizeClass(["right-input",{"has-label":l.labelOptions&&l.labelOptions.length}])},{default:e.withCtx(()=>[n.shouldShowMultiple?(e.openBlock(),e.createBlock(x,e.mergeProps({key:0,slot:"append"},{[s.isVue3?"visible":"value"]:s.isExactMode,placement:"bottom-end",width:260,trigger:"click"},e.toHandlers({[s.isVue3?"update:visible":"input"]:n.handleVisibleChange})),{reference:e.withCtx(()=>[e.createVNode(V,{style:{cursor:"pointer"}})]),default:e.withCtx(()=>[e.createElementVNode("div",Re,[e.createElementVNode("p",Pe,e.toDisplayString(s.t("accurateSearchTips")),1),e.createVNode(d,{size:s.getDefaultSize(),type:"textarea",rows:8,modelValue:s.exactValue,"onUpdate:modelValue":i[1]||(i[1]=k=>s.exactValue=k),placeholder:s.t("accurateSearchPlaceholder"),style:{"font-size":"12px"}},null,8,["size","modelValue","placeholder"]),e.createElementVNode("div",Ie,[e.createVNode(p,{style:{float:"left"},size:s.getCompatSize("mini"),onClick:n.handleClear},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(s.t("clear")),1)]),_:1},8,["size","onClick"]),e.createVNode(p,{size:s.getCompatSize("mini"),onClick:n.handlePopoverClose},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(s.t("cancel")),1)]),_:1},8,["size","onClick"]),e.createVNode(p,{type:"primary",size:s.getCompatSize("mini"),onClick:n.handleExactSearch},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(s.t("search")),1)]),_:1},8,["size","onClick"])])])]),_:1},16)):e.createCommentVNode("",!0)]),_:1},8,["modelValue","size","placeholder","onKeyup","class"])],6)}const W=y(Ae,[["render",ve],["__scopeId","data-v-6b474dac"]]),{t:C}=w(),We=!1,Ue=!0,je="modelValue",Je={name:"TmAdvancedDateFilter",components:{EllipsisText:F},props:{value:{type:[Array,String,Date],default:()=>null},field:{type:[String,Number],default:""},start:{type:[String,Number],default:""},end:{type:[String,Number],default:""},size:{type:String,default:"mini"},labelOptions:{type:Array,default:()=>[]},label:{type:String,default:""},type:{type:String,default:"daterange",validator:t=>["date","daterange","datetime","datetimerange","year","month","dates","months","years","week","monthrange"].includes(t)},format:{type:String,default:""},startPlaceholder:{type:String,default:void 0},endPlaceholder:{type:String,default:void 0},placeholder:{type:String,default:void 0},rangeSeparator:{type:String,default:"-"},disabled:{type:Boolean,default:!1},clearable:{type:Boolean,default:!0},readonly:{type:Boolean,default:!1},editable:{type:Boolean,default:!0},align:{type:String,default:"left"},popperClass:{type:String,default:""},defaultValue:{type:[Date,Array],default:null},defaultTime:{type:[Date,String,Array],default:null},shortcuts:{type:Array,default:()=>[]},pastOnly:{type:Boolean,default:!1}},computed:{isRangeType(){return["daterange","datetimerange","monthrange"].includes(this.type)},computedStartPlaceholder(){if(this.isRangeType)return this.startPlaceholder!==void 0?this.startPlaceholder:C("startDate")},computedEndPlaceholder(){if(this.isRangeType)return this.endPlaceholder!==void 0?this.endPlaceholder:C("endDate")},computedDatePickerStyle(){const t=this.labelOptions&&this.labelOptions.length>0,i=this.label&&!this.isRangeType&&(!this.labelOptions||this.labelOptions.length===0);return t?"width: 206px":i?"width: 200px":"width: 306px"},computedFormat(){const t="YYYY";return this.format?this.format:this.type==="year"?t:this.type==="month"?`${t}-MM`:this.type==="date"?`${t}-MM-DD`:this.type==="dates"?`${t}-MM-DD`:this.type==="months"?`${t}-MM`:this.type==="years"?t:this.type==="week"?`${t}-MM-WW`:this.type==="datetime"?`${t}-MM-DD HH:mm:ss`:this.type==="datetimerange"?`${t}-MM-DD HH:mm:ss`:this.type==="daterange"?`${t}-MM-DD`:this.type==="monthrange"?`${t}-MM`:""},computedPickerOptions(){const t={};if(this.pastOnly&&(t.disabledDate=i=>i.getTime()>Date.now()),["daterange","datetimerange"].includes(this.type)){const i=this.type==="datetimerange";t.shortcuts=this.shortcuts.length>0?this.shortcuts:[{text:C("today"),onClick(l){const o=new Date,s=new Date;i&&(s.setHours(0,0,0,0),o.setHours(23,59,59,999)),l.$emit("pick",[s,o])}},{text:C("yesterday"),onClick(l){const o=new Date,s=new Date;s.setTime(s.getTime()-3600*1e3*24),o.setTime(o.getTime()-3600*1e3*24),i&&(s.setHours(0,0,0,0),o.setHours(23,59,59,999)),l.$emit("pick",[s,o])}},{text:C("last7days"),onClick(l){const o=new Date,s=new Date;s.setTime(s.getTime()-3600*1e3*24*7),i&&(s.setHours(0,0,0,0),o.setHours(23,59,59,999)),l.$emit("pick",[s,o])}},{text:C("last30days"),onClick(l){const o=new Date,s=new Date;s.setTime(s.getTime()-3600*1e3*24*30),i&&(s.setHours(0,0,0,0),o.setHours(23,59,59,999)),l.$emit("pick",[s,o])}},{text:C("thisMonth"),onClick(l){const o=new Date,s=new Date;s.setDate(1),i&&(s.setHours(0,0,0,0),o.setHours(23,59,59,999)),l.$emit("pick",[s,o])}},{text:C("lastMonth"),onClick(l){const o=new Date,s=new Date;s.setMonth(s.getMonth()-1),s.setDate(1),o.setDate(0),i&&(s.setHours(0,0,0,0),o.setHours(23,59,59,999)),l.$emit("pick",[s,o])}}]}return t},computedShortcuts(){if(!["daterange","datetimerange"].includes(this.type))return[];if(this.shortcuts&&this.shortcuts.length>0)return this.shortcuts;const t=this.type==="datetimerange";return[{text:C("today"),value:()=>{const i=new Date,l=new Date;return t&&(l.setHours(0,0,0,0),i.setHours(23,59,59,999)),[l,i]}},{text:C("yesterday"),value:()=>{const i=new Date,l=new Date;return l.setTime(l.getTime()-3600*1e3*24),i.setTime(i.getTime()-3600*1e3*24),t&&(l.setHours(0,0,0,0),i.setHours(23,59,59,999)),[l,i]}},{text:C("last7days"),value:()=>{const i=new Date,l=new Date;return l.setTime(l.getTime()-3600*1e3*24*7),t&&(l.setHours(0,0,0,0),i.setHours(23,59,59,999)),[l,i]}},{text:C("last30days"),value:()=>{const i=new Date,l=new Date;return l.setTime(l.getTime()-3600*1e3*24*30),t&&(l.setHours(0,0,0,0),i.setHours(23,59,59,999)),[l,i]}},{text:C("thisMonth"),value:()=>{const i=new Date,l=new Date;return l.setDate(1),t&&(l.setHours(0,0,0,0),i.setHours(23,59,59,999)),[l,i]}},{text:C("lastMonth"),value:()=>{const i=new Date,l=new Date;return l.setMonth(l.getMonth()-1),l.setDate(1),i.setDate(0),t&&(l.setHours(0,0,0,0),i.setHours(23,59,59,999)),[l,i]}}]},computedDisabledDate(){return this.pastOnly?t=>t.getTime()>Date.now():null},computedDefaultTime(){let t=this.defaultTime;if(this.type==="datetimerange"&&!this.defaultTime&&(t=["00:00:00","23:59:59"]),this.isVue2)return t;if(t){if(this.type==="datetimerange"&&Array.isArray(t))return t.map(i=>{if(typeof i=="string"){const l=new Date,[o,s,n]=i.split(":").map(Number);return new Date(l.getFullYear(),l.getMonth(),l.getDate(),o,s,n||0)}return i});if(this.type==="datetime"&&typeof t=="string"){const i=new Date,[l,o,s]=t.split(":").map(Number);return new Date(i.getFullYear(),i.getMonth(),i.getDate(),l,o,s||0)}return t}},dateValue(){return this.isRangeType?this.start||this.end?[this.start,this.end]:this.value:this.value},fieldValue:{get(){return this.field},set(t){this.$emit("field-change",t)}}},data(){return{t:C,isVue2:We,isVue3:Ue,getDefaultSize:T,valueField:je}},methods:{handleDateChange(t){this.isRangeType?(this.$emit("value-change",t),t&&Array.isArray(t)&&t.length===2?(this.$emit("start-change",t),this.$emit("end-change",t)):(this.$emit("start-change",[]),this.$emit("end-change",[]))):this.$emit("value-change",t)},handleBlur(t){this.$emit("blur",t)},handleFocus(t){this.$emit("focus",t)}},watch:{labelOptions:{handler(t){t&&t.length>0&&!this.field&&this.$emit("field-change",t[0].value)},deep:!0,immediate:!0}}},Ke={key:1,class:"date-label"};function Qe(t,i,l,o,s,n){const r=e.resolveComponent("el-option"),h=e.resolveComponent("el-select"),c=e.resolveComponent("EllipsisText"),d=e.resolveComponent("el-date-picker");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["tm-date-picker",[`tm-date-picker--${s.isVue3?"v3":"v2"}`,{"has-select":l.labelOptions&&l.labelOptions.length>0,"has-label":l.label&&!n.isRangeType&&(!l.labelOptions||l.labelOptions.length===0)}]])},[l.labelOptions&&l.labelOptions.length>0?(e.openBlock(),e.createBlock(h,{key:0,modelValue:n.fieldValue,"onUpdate:modelValue":i[0]||(i[0]=p=>n.fieldValue=p),size:s.getDefaultSize(),style:{width:"100px"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.labelOptions,p=>(e.openBlock(),e.createBlock(r,{key:p.value,label:p.label,value:p.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","size"])):l.label?(e.openBlock(),e.createElementBlock("div",Ke,[e.createVNode(c,{text:l.label,lines:2},null,8,["text"])])):e.createCommentVNode("",!0),s.isVue2?(e.openBlock(),e.createBlock(d,{key:2,value:n.dateValue,type:l.type,size:s.getDefaultSize(),"range-separator":l.rangeSeparator,"start-placeholder":n.computedStartPlaceholder,"end-placeholder":n.computedEndPlaceholder,placeholder:l.placeholder,"picker-options":n.computedPickerOptions,style:e.normalizeStyle(n.computedDatePickerStyle),format:n.computedFormat,"value-format":n.computedFormat,disabled:l.disabled,clearable:l.clearable,readonly:l.readonly,editable:l.editable,align:l.align,"popper-class":l.popperClass,"default-value":l.defaultValue,"default-time":n.computedDefaultTime,onInput:n.handleDateChange,onChange:n.handleDateChange,onBlur:n.handleBlur,onFocus:n.handleFocus},null,8,["value","type","size","range-separator","start-placeholder","end-placeholder","placeholder","picker-options","style","format","value-format","disabled","clearable","readonly","editable","align","popper-class","default-value","default-time","onInput","onChange","onBlur","onFocus"])):(e.openBlock(),e.createBlock(d,{key:3,"model-value":n.dateValue,type:l.type,size:s.getDefaultSize(),"range-separator":l.rangeSeparator,"start-placeholder":n.computedStartPlaceholder,"end-placeholder":n.computedEndPlaceholder,placeholder:l.placeholder,shortcuts:n.computedShortcuts,"disabled-date":n.computedDisabledDate,style:e.normalizeStyle(n.computedDatePickerStyle),format:n.computedFormat,"value-format":n.computedFormat,disabled:l.disabled,clearable:l.clearable,readonly:l.readonly,editable:l.editable,teleported:!1,"popper-class":l.popperClass,"default-value":l.defaultValue,"default-time":n.computedDefaultTime,"onUpdate:modelValue":n.handleDateChange,onChange:n.handleDateChange,onBlur:n.handleBlur,onFocus:n.handleFocus},null,8,["model-value","type","size","range-separator","start-placeholder","end-placeholder","placeholder","shortcuts","disabled-date","style","format","value-format","disabled","clearable","readonly","editable","popper-class","default-value","default-time","onUpdate:modelValue","onChange","onBlur","onFocus"]))],2)}const U=y(Je,[["render",Qe],["__scopeId","data-v-7d46d46b"]]),qe=!1,Ye={name:"TmCascaderFilter",props:{value:{type:[String,Number,Array],default:""},options:{type:[Array,Function],default:()=>[]},props:{type:Object,default:()=>({label:"label",value:"value",children:"children",expandTrigger:"hover"})},filterable:{type:Boolean,default:!0},clearable:{type:Boolean,default:!0},collapseTags:{type:Boolean,default:!0},collapseTagsTooltip:{type:Boolean,default:!0},placeholder:{type:String,default:""}},data(){return{isVue2:qe,getDefaultSize:T,selectedValue:this.value,optionsList:[],loading:!1}},computed:{propMap(){return{label:this.props.label||"label",value:this.props.value||"value",children:this.props.children||"children"}},cascaderProps(){return B(b({},this.props),{expandTrigger:this.props.expandTrigger||"hover"})}},watch:{value:{immediate:!0,handler(t){this.selectedValue=t}},options:{immediate:!0,handler(t){this.initOptions(t)}},selectedValue(t){this.$emit("input",t),this.$emit("change",t)}},methods:{async initOptions(t){if(typeof t=="function")try{this.loading=!0;const i=await t();Array.isArray(i)&&(this.optionsList=i)}catch(i){console.error(i)}finally{this.loading=!1}else Array.isArray(t)&&(this.optionsList=t)}}};function Ge(t,i,l,o,s,n){const r=e.resolveComponent("el-cascader");return e.openBlock(),e.createBlock(r,e.mergeProps({ref:"cascader",class:["tm-cascader",`tm-cascader--${s.isVue2?"v2":"v3"}`],modelValue:s.selectedValue,"onUpdate:modelValue":i[0]||(i[0]=h=>s.selectedValue=h),style:{width:"200px"}},B(b({},t.$attrs),{size:s.getDefaultSize(),filterable:l.filterable,clearable:l.clearable,collapseTags:l.collapseTags,collapseTagsTooltip:l.collapseTagsTooltip,props:n.cascaderProps,placeholder:l.placeholder,options:s.optionsList,loading:s.loading}),e.toHandlers(s.isVue2?t.$listeners:{})),{default:e.withCtx(({node:h,data:c})=>[e.renderSlot(t.$slots,"default",{node:h,data:c},()=>[e.createElementVNode("span",null,e.toDisplayString(c[n.propMap.label]),1)])]),_:3},16,["class","modelValue"])}const j=y(Ye,[["render",Ge]]),Xe=!1,Ze=!0,$e={name:"TmRadioFilter",props:{value:{type:[String,Number],default:""},options:{type:[Array,Function],default:()=>[]},props:{type:Object,default:()=>({label:"label",value:"value"})},size:{type:String,default:"mini"},width:{type:[String,Number],default:200}},data(){return{isVue2:Xe,isVue3:Ze,getDefaultSize:T,selectedValue:this.value,optionsList:[],loading:!1}},computed:{propMap(){return{label:this.props.label||"label",value:this.props.value||"value"}},hasWideOptions(){return this.optionsList.length>4},calculateItemWidth(){if(!this.optionsList.length)return{};const i=`${(this.hasWideOptions?305:200)/this.optionsList.length}px`;return{width:i,flex:`0 0 ${i}`}}},watch:{value:{immediate:!0,handler(t){this.selectedValue=t}},options:{immediate:!0,handler(t){this.$slots.default||this.initOptions(t)}},selectedValue(t){this.$emit("input",t),this.$emit("change",t)}},methods:{async initOptions(t){if(typeof t=="function")try{this.loading=!0;const i=await t();Array.isArray(i)&&(this.optionsList=i)}catch(i){console.error(i)}finally{this.loading=!1}else Array.isArray(t)&&(this.optionsList=t)}}};function et(t,i,l,o,s,n){const r=e.resolveComponent("el-radio-button"),h=e.resolveComponent("el-radio-group");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["tm-radio",{"wide-mode":n.hasWideOptions,"tm-radio--v3":s.isVue3,"tm-radio--v2":s.isVue2}])},[e.createVNode(h,e.mergeProps({ref:"radioGroup",modelValue:s.selectedValue,"onUpdate:modelValue":i[0]||(i[0]=c=>s.selectedValue=c)},B(b({},t.$attrs),{size:s.getDefaultSize()}),e.toHandlers(s.isVue2?t.$listeners:{})),{default:e.withCtx(()=>[t.$slots.default?e.renderSlot(t.$slots,"default",{key:0},void 0,!0):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(s.optionsList,c=>(e.openBlock(),e.createBlock(r,e.mergeProps({ref_for:!0},{[s.isVue3?"value":"label"]:c[n.propMap.value],disabled:c.disabled,style:n.calculateItemWidth},{key:c[n.propMap.value]}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"option",{item:c},()=>[e.createTextVNode(e.toDisplayString(c[n.propMap.label]),1)],!0)]),_:2},1040))),128))]),_:3},16,["modelValue"])],2)}const J=y($e,[["render",et],["__scopeId","data-v-61fed13d"]]),tt=!1,lt=!0,it={name:"TmCheckboxFilter",props:{value:{type:Array,default:()=>[]},options:{type:[Array,Function],default:()=>[]},props:{type:Object,default:()=>({label:"label",value:"value"})},size:{type:String,default:"mini"},width:{type:[String,Number],default:200}},data(){return{isVue2:tt,isVue3:lt,getDefaultSize:T,selectedValue:this.value||[],optionsList:[],loading:!1}},computed:{propMap(){return{label:this.props.label||"label",value:this.props.value||"value"}},hasWideOptions(){return this.optionsList.length>4},calculateItemWidth(){if(!this.optionsList.length)return{};const t=Math.ceil(this.optionsList.length/(this.hasWideOptions?6:4)),i=Math.ceil(this.optionsList.length/t),o=`${(this.hasWideOptions?305:200)/i}px`;return{width:o,flex:`0 0 ${o}`}}},watch:{value:{immediate:!0,handler(t){this.selectedValue=t||[]}},options:{immediate:!0,handler(t){this.$slots.default||this.initOptions(t)}},selectedValue(t){this.$emit("input",t),this.$emit("change",t)}},methods:{async initOptions(t){if(typeof t=="function")try{this.loading=!0;const i=await t();Array.isArray(i)&&(this.optionsList=i)}catch(i){console.error(i)}finally{this.loading=!1}else Array.isArray(t)&&(this.optionsList=t)}}};function st(t,i,l,o,s,n){const r=e.resolveComponent("el-checkbox-button"),h=e.resolveComponent("el-checkbox-group");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["tm-checkbox",{"wide-mode":n.hasWideOptions,"tm-checkbox--v3":s.isVue3,"tm-checkbox--v2":s.isVue2}])},[e.createVNode(h,e.mergeProps({ref:"checkboxGroup",modelValue:s.selectedValue,"onUpdate:modelValue":i[0]||(i[0]=c=>s.selectedValue=c)},B(b({},t.$attrs),{size:s.getDefaultSize()}),e.toHandlers(s.isVue2?t.$listeners:{})),{default:e.withCtx(()=>[t.$slots.default?e.renderSlot(t.$slots,"default",{key:0},void 0,!0):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(s.optionsList,c=>(e.openBlock(),e.createBlock(r,e.mergeProps({key:c[n.propMap.value]},{ref_for:!0},{[s.isVue3?"value":"label"]:c[n.propMap.value],disabled:c.disabled,style:n.calculateItemWidth}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"option",{item:c},()=>[e.createTextVNode(e.toDisplayString(c[n.propMap.label]),1)],!0)]),_:2},1040))),128))]),_:3},16,["modelValue"])],2)}const K=y(it,[["render",st],["__scopeId","data-v-b44866b1"]]),nt=!1,ot={name:"TmSwitchFilter",props:{value:{type:Boolean,default:!1},label:{type:String,default:""}},data(){return{isVue2:nt,getDefaultSize:T,switchValue:this.value}},computed:{containerWidthClass(){const t=n=>{if(!n)return 0;let r=0;for(let h=0;h<n.length;h++){const c=n.charAt(h);r+=/[\u4e00-\u9fa5]/.test(c)?2:1}return r},i=t(this.$attrs["active-text"]),l=t(this.$attrs["inactive-text"]),o=t(this.$attrs.label),s=i+l+o;return s>20?"wide-container":s>6?"medium-container":"narrow-container"}},watch:{value:{immediate:!0,handler(t){this.switchValue=t}},switchValue(t){this.$emit("input",t),this.$emit("change",t)}}},at={key:0,class:"switch-label"};function rt(t,i,l,o,s,n){const r=e.resolveComponent("el-switch");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["tm-switch",n.containerWidthClass])},[l.label?(e.openBlock(),e.createElementBlock("span",at,e.toDisplayString(l.label),1)):e.createCommentVNode("",!0),e.createVNode(r,e.mergeProps({ref:"switch",modelValue:s.switchValue,"onUpdate:modelValue":i[0]||(i[0]=h=>s.switchValue=h)},t.$attrs,e.toHandlers(s.isVue2?t.$listeners:{}),{size:s.getDefaultSize()}),null,16,["modelValue","size"])],2)}const Q=y(ot,[["render",rt],["__scopeId","data-v-9e7a342f"]]),ct={name:"DynamicSlot",props:{name:{type:String,required:!0},slotProps:{type:Object,default:()=>({})}},render(t){var s;const i=n=>{var r;return n?(r=n.$slots)==null?void 0:r[this.name]:null},l=n=>{var r,h,c,d;return n?((h=(r=n.$)==null?void 0:r.type)==null?void 0:h.name)==="TmTable"||((d=(c=n.$)==null?void 0:c.type)==null?void 0:d.__name)==="TmTable":!1};let o=i(this.$parent);if(!o){let n=(s=this.$parent)==null?void 0:s.$parent;for(;n&&!o;){if(l(n)){o=i(n);break}n=n.$parent}}return o?typeof o=="function"?o(this.slotProps):o:null}},{t:dt}=w(),ht=!1,ut=!0,mt=["date","daterange","datetime","datetimerange","year","month","dates","months","years","week","monthrange"],pt={name:"TmTableSearch",components:{TmSelect:I,TmAdvancedInput:W,TmAdvancedDate:U,TmCascader:j,TmRadio:J,TmCheckbox:K,TmSwitch:Q,DynamicSlot:ct},props:{disabled:{type:Boolean,default:!1},searchColumns:{type:Array,default:null},searchForm:{type:Object,default:()=>({})}},data(){return{t:dt,isVue2:ht,isVue3:ut,getCompatSize:E,getDefaultSize:T,DATE_TYPES:mt,defaultValues:{}}},computed:{computedSearchForm:{get(){return this.searchForm},set(t){this.$emit("update:search-form",t)}}},mounted(){this.initDefaultValues()},methods:{isDateType(t){return this.DATE_TYPES.includes(t)},hasDefaultSlot(){const t=this.$slots.default;return t?this.isVue2?!!t:t()[0].children.length>0:!1},handleUpdate(t,i,l){const o=this.getFieldValue(t,l);o&&this.$emit("update:search-form",B(b({},this.computedSearchForm),{[o]:i}))},handleUpdateDate(t,i){const l=i||[],o=this.getFieldValue(t,"start"),s=this.getFieldValue(t,"end"),n=this.getFieldValue(t,"value"),r={};o&&(r[o]=l[0]),s&&(r[s]=l[1]),n&&(r[n]=l),this.$emit("update:search-form",b(b({},this.computedSearchForm),r))},getFieldValue(t,i){if(typeof t=="string")return t;if(t.fields&&i in t.fields){const l=t.fields[i];if(typeof l=="string")return l;if(Array.isArray(l))return l[0];if(l&&typeof l=="object")return l.name}},getFieldDefault(t,i){if(t.fields&&i in t.fields){const l=t.fields[i];if(Array.isArray(l)&&l.length>1)return l[1];if(l&&typeof l=="object"&&"default"in l)return l.default}},hasSearchSlot(t){const i="$slots";if(this[i][t])return!0;let o=this.$parent;for(;o;){const s=o[i];if(o.$options.name==="TmTable"&&(s!=null&&s[t]))return!0;o=o.$parent}return!1},initDefaultValues(){if(!this.searchColumns||!this.searchColumns.length)return;const t={};this.searchColumns.forEach(i=>{if(typeof i=="string"||!i.fields)return;const l=this.getFieldValue(i,"value"),o=this.getFieldValue(i,"label");if(i.type==="input"&&i.labelOptions&&i.labelOptions.length>0){const n=i.labelOptions[0];if(o)if(o in this.computedSearchForm)t[o]=this.computedSearchForm[o];else{const r=this.getFieldDefault(i,"label");r!==void 0?t[o]=r:n&&n.value!==void 0&&(t[o]=n.value)}l&&!(l in this.computedSearchForm)&&(t[l]="")}else if(this.isDateType(i.type)&&i.labelOptions&&i.labelOptions.length>0){const n=i.labelOptions[0];if(l&&!(l in this.computedSearchForm)&&(t[l]=[]),o)if(o in this.computedSearchForm)t[o]=this.computedSearchForm[o];else{const r=this.getFieldDefault(i,"label");r!==void 0?t[o]=r:n&&n.value!==void 0&&(t[o]=n.value)}}else if(i.type==="select"&&i.labelOptions&&i.labelOptions.length>0){const n=i.labelOptions[0];if(l&&!(l in this.computedSearchForm)&&(t[l]=i.multiple?[]:""),o)if(o in this.computedSearchForm)t[o]=this.computedSearchForm[o];else{const r=this.getFieldDefault(i,"label");r!==void 0?t[o]=r:n&&n.value!==void 0&&(t[o]=n.value)}}const s=this.getFieldDefault(i,"value");if(l&&s!==void 0&&!(l in this.computedSearchForm)?this.isDateType(i.type)&&!Array.isArray(s)?t[l]=[]:i.type==="checkbox"&&!Array.isArray(s)?t[l]=s?[s]:[]:i.type==="switch"&&typeof s!="boolean"?t[l]=!!s:t[l]=s:l&&!(l in this.computedSearchForm)&&(i.type==="checkbox"?t[l]=[]:i.type==="switch"&&(t[l]=!1)),this.isDateType(i.type)){const n=this.getFieldValue(i,"start"),r=this.getFieldValue(i,"end"),h=this.getFieldDefault(i,"start"),c=this.getFieldDefault(i,"end");n&&h!==void 0&&!(n in this.computedSearchForm)&&(t[n]=h),r&&c!==void 0&&!(r in this.computedSearchForm)&&(t[r]=c)}}),this.defaultValues=t,this.$emit("update:search-form",b(b({},t),this.computedSearchForm))},getSearchForm(){return this.computedSearchForm},handleSearch(){setTimeout(()=>{this.$emit("search",this.computedSearchForm)})},handleReset(){this.$emit("update:search-form",b({},this.defaultValues)),this.$emit("reset")}}},ft={class:"search-content"},gt={class:"search-actions"};function bt(t,i,l,o,s,n){const r=e.resolveComponent("dynamic-slot"),h=e.resolveComponent("tm-advanced-input"),c=e.resolveComponent("tm-advanced-date"),d=e.resolveComponent("tm-select"),p=e.resolveComponent("tm-cascader"),V=e.resolveComponent("tm-radio"),x=e.resolveComponent("tm-checkbox"),k=e.resolveComponent("tm-switch"),L=e.resolveComponent("el-button");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["table-search",`table-search--${s.isVue2?"v2":"v3"}`])},[e.createElementVNode("div",ft,[n.hasDefaultSlot()?e.renderSlot(t.$slots,"default",{key:0},void 0,!0):l.searchColumns&&l.searchColumns.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(l.searchColumns,(a,z)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[typeof a=="string"?(e.openBlock(),e.createElementBlock("div",{key:`str-${a}-${z}`,class:"search-item"},[(e.openBlock(),e.createBlock(r,{name:`search-${a}`,"slot-props":{searchForm:l.searchForm},key:a},null,8,["name","slot-props"]))])):(e.openBlock(),e.createElementBlock("div",{key:`obj-${z}`,class:"search-item"},[a.fields?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[n.hasSearchSlot(`search-${n.getFieldValue(a,"value")}`)?(e.openBlock(),e.createBlock(r,{name:`search-${n.getFieldValue(a,"value")}`,"slot-props":{searchForm:l.searchForm,col:a},key:n.getFieldValue(a,"value")},null,8,["name","slot-props"])):(e.openBlock(),e.createElementBlock("div",{style:{display:"flex"},key:n.getFieldValue(a,"value")||`col-${z}`},[a.type==="input"?(e.openBlock(),e.createBlock(h,{key:0,label:a.label,value:n.computedSearchForm[n.getFieldValue(a,"value")],field:n.computedSearchForm[n.getFieldValue(a,"label")],onValueChange:f=>n.handleUpdate(a,f,"value"),onFieldChange:f=>n.handleUpdate(a,f,"label"),multiple:a.multiple,labelOptions:a.labelOptions,placeholder:a.placeholder,onSearch:n.handleSearch},null,8,["label","value","field","onValueChange","onFieldChange","multiple","labelOptions","placeholder","onSearch"])):e.createCommentVNode("",!0),n.isDateType(a.type)?(e.openBlock(),e.createBlock(c,{key:1,type:a.type,label:a.label,value:n.computedSearchForm[n.getFieldValue(a,"value")],field:n.computedSearchForm[n.getFieldValue(a,"label")],start:n.computedSearchForm[n.getFieldValue(a,"start")],end:n.computedSearchForm[n.getFieldValue(a,"end")],onFieldChange:f=>n.handleUpdate(a,f,"label"),onValueChange:f=>n.handleUpdateDate(a,f),onStartChange:f=>n.handleUpdateDate(a,f),onEndChange:f=>n.handleUpdateDate(a,f),labelOptions:a.labelOptions,"start-placeholder":a.startPlaceholder,"end-placeholder":a.endPlaceholder,placeholder:a.placeholder,"range-separator":a.rangeSeparator,disabled:a.disabled,clearable:a.clearable,readonly:a.readonly,editable:a.editable,align:a.align,"popper-class":a.popperClass,"default-value":a.defaultValue,"default-time":a.defaultTime,shortcuts:a.shortcuts,"past-only":a.pastOnly,format:a.format},null,8,["type","label","value","field","start","end","onFieldChange","onValueChange","onStartChange","onEndChange","labelOptions","start-placeholder","end-placeholder","placeholder","range-separator","disabled","clearable","readonly","editable","align","popper-class","default-value","default-time","shortcuts","past-only","format"])):e.createCommentVNode("",!0),a.type==="select"?(e.openBlock(),e.createBlock(d,{key:2,label:a.label,modelValue:n.computedSearchForm[n.getFieldValue(a,"value")],"onUpdate:modelValue":f=>n.computedSearchForm[n.getFieldValue(a,"value")]=f,field:n.computedSearchForm[n.getFieldValue(a,"label")],options:a.options,labelOptions:a.labelOptions,placeholder:a.placeholder,multiple:a.multiple,"show-check-all":a.checkAll,"value-on-clear":a.valueOnClear,clearable:a.clearable,onFieldChange:f=>n.handleUpdate(a,f,"label")},null,8,["label","modelValue","onUpdate:modelValue","field","options","labelOptions","placeholder","multiple","show-check-all","value-on-clear","clearable","onFieldChange"])):e.createCommentVNode("",!0),a.type==="cascader"?(e.openBlock(),e.createBlock(p,{key:3,modelValue:n.computedSearchForm[n.getFieldValue(a,"value")],"onUpdate:modelValue":f=>n.computedSearchForm[n.getFieldValue(a,"value")]=f,label:a.label,options:a.options,labelOptions:a.labelOptions,props:a.props,placeholder:a.placeholder,"show-check-all":a.checkAll},null,8,["modelValue","onUpdate:modelValue","label","options","labelOptions","props","placeholder","show-check-all"])):e.createCommentVNode("",!0),a.type==="radio"?(e.openBlock(),e.createBlock(V,{key:4,modelValue:n.computedSearchForm[n.getFieldValue(a,"value")],"onUpdate:modelValue":f=>n.computedSearchForm[n.getFieldValue(a,"value")]=f,label:a.label,options:a.options,props:a.props},null,8,["modelValue","onUpdate:modelValue","label","options","props"])):e.createCommentVNode("",!0),a.type==="checkbox"?(e.openBlock(),e.createBlock(x,{key:5,modelValue:n.computedSearchForm[n.getFieldValue(a,"value")],"onUpdate:modelValue":f=>n.computedSearchForm[n.getFieldValue(a,"value")]=f,label:a.label,options:a.options,props:a.props},null,8,["modelValue","onUpdate:modelValue","label","options","props"])):e.createCommentVNode("",!0),a.type==="switch"?(e.openBlock(),e.createBlock(k,{key:6,modelValue:n.computedSearchForm[n.getFieldValue(a,"value")],"onUpdate:modelValue":f=>n.computedSearchForm[n.getFieldValue(a,"value")]=f,"active-text":a.activeText,"inactive-text":a.inactiveText,label:a.label,"active-color":a.activeColor,"inactive-color":a.inactiveColor},null,8,["modelValue","onUpdate:modelValue","active-text","inactive-text","label","active-color","inactive-color"])):e.createCommentVNode("",!0)]))],64)):(e.openBlock(),e.createElementBlock("div",{key:`error-${z}`,class:"search-error-message"}," 缺少 fields 配置,无法渲染此组件 "))]))],64))),256)):e.createCommentVNode("",!0),e.createElementVNode("div",gt,[e.createVNode(L,{type:"primary",size:s.getDefaultSize(),onClick:n.handleSearch},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(s.t("query")),1)]),_:1},8,["size","onClick"]),e.createVNode(L,{size:s.getDefaultSize(),onClick:n.handleReset},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(s.t("reset")),1)]),_:1},8,["size","onClick"])])])],2)}const q=y(pt,[["render",bt],["__scopeId","data-v-41139f7b"]]),yt=!1,Ct={name:"TablePagination",props:{current:{type:Number,default:1},small:{type:Boolean,default:!0},pageSize:{type:Number,default:20},total:{type:Number,default:0}},data(){return{isVue2:yt,getCompatSize:E}},methods:{handleSizeChange(t){this.$emit("size-change",t)},handleCurrentChange(t){this.$emit("current-change",t)}}},kt={class:"tm-pagination"};function Vt(t,i,l,o,s,n){const r=e.resolveComponent("el-pagination");return e.openBlock(),e.createElementBlock("div",kt,[e.createVNode(r,e.mergeProps(t.$attrs,e.toHandlers(s.isVue2?t.$listeners:{}),{style:{"text-align":"right"},"current-page":l.current,"page-size":l.pageSize,total:l.total,"page-sizes":[10,20,50,100,300,500,1e3,2e3],size:s.getCompatSize("mini"),layout:"total, sizes, prev, pager, next, jumper",onSizeChange:n.handleSizeChange,"onUpdate:currentPage":i[0]||(i[0]=h=>t.$emit("update:current",h)),"onUpdate:pageSize":i[1]||(i[1]=h=>t.$emit("update:pageSize",h)),onCurrentChange:n.handleCurrentChange}),null,16,["current-page","page-size","total","size","onSizeChange","onCurrentChange"])])}const xt=y(Ct,[["render",Vt],["__scopeId","data-v-4dbdf6e7"]]),_t={name:"TmTableMenu",props:{size:{type:String,default:"mini"}}},St={size:"small",class:"tm-table-menu",inline:""},Tt={class:"left"},wt={class:"right"};function zt(t,i,l,o,s,n){return e.openBlock(),e.createElementBlock("div",St,[e.createElementVNode("div",Tt,[e.renderSlot(t.$slots,"left",{},void 0,!0)]),e.createElementVNode("div",wt,[e.renderSlot(t.$slots,"right",{},void 0,!0)])])}const Bt=y(_t,[["render",zt],["__scopeId","data-v-579dd2c3"]]),H=t=>t?t.props||{}:{},Y=(t,i)=>{t&&(t.props||(t.props={}),typeof i=="object"&&Object.assign(t.props,i))},R={getTableConfig(t){try{const i=localStorage.getItem(`tm-table-config-${t}`);return Promise.resolve({data:{code:200,data:i}})}catch(i){return Promise.reject(i)}},setTableConfig(t){try{return localStorage.setItem(`tm-table-config-${t.key}`,t.info),Promise.resolve({data:{code:200,message:"success"}})}catch(i){return Promise.reject(i)}}},Ft=t=>R.getTableConfig(t.key),Lt=t=>R.setTableConfig(t),Ot=t=>{t&&(typeof t.getTableConfig=="function"&&(R.getTableConfig=t.getTableConfig),typeof t.setTableConfig=="function"&&(R.setTableConfig=t.setTableConfig))},{t:Et}=w(),Dt=!1,Nt=!0,Mt={formatter:(t,i,l,o)=>[void 0,null,""].includes(l)?"-":l},At={name:"TmColumnConfig",components:{MoveIcon:xe,FixedLeftIcon:Se,FixedRightIcon:Te,UploadIcon:we,DownloadIcon:ze,DeleteIcon:Be,MenuIcon:ke,tmEllipsisText:F},props:{columns:{type:Array,default:()=>[]},tableKey:{type:String,default:"",required:!0},defaultColumns:{type:Array,default:()=>[]},maxFixedLeftQuantity:{type:[Number,String],default:void 0},maxFixedRightQuantity:{type:[Number,String],default:void 0},ignoredColumnConfigTypes:{type:Array,default:()=>["selection"]}},data(){return{t:Et,isVue2:Dt,isVue3:Nt,getDefaultSize:T,getCompatSize:E,buttonType:{link:!0,type:"primary"},afterOpenDelay:{"show-after":300},popoverVisible:!1,keyWord:"",sortedTableColumns:[],tableColumns:[],defaultColumnsConfig:[],columnMap:{},processedColumns:[],placement:"bottom",isDraggingFrozen:!1,isDraggingFrozenRight:!1,sortable:null,isConfigLoaded:!1,columnsCopy:[]}},computed:{filteredSortedTableColumns(){return this.keyWord?this.sortedTableColumns.filter(t=>this.getColumnLabel(t.prop).includes(this.keyWord)):this.sortedTableColumns},showFixedLimitTips(){return this.maxFixedLeftQuantity!==void 0||this.maxFixedRightQuantity!==void 0},isThanMaxFrozen(){return this.maxFixedLeftQuantity===void 0?!1:this.sortedTableColumns.filter(t=>t.fixed==="left").length>=this.maxFixedLeftQuantity},isThanMaxRightFrozen(){return this.maxFixedRightQuantity===void 0?!1:this.sortedTableColumns.filter(t=>t.fixed==="right").length>=this.maxFixedRightQuantity},computedTableKey(){if(this.tableKey)return this.tableKey;if(this.$route&&this.$route.path)return this.$route.path.slice(1).replace(/\//g,"-");throw new Error("tableKey is required")}},watch:{popoverVisible(t){t||this.handlePopoverHide()},columns:{handler(t){t&&t.length>0&&!this.isConfigLoaded&&this.initializeColumnConfig()},immediate:!0},tableColumns:{handler(t){t!=null&&t.length&&(this.initSortedTableColumns(),this.crateSortable(),this.columnsCopy=JSON.parse(JSON.stringify(this.sortedTableColumns)))},deep:!0}},methods:{findLastIndex(t,i){for(let l=t.length-1;l>=0;l--)if(i(t[l],l,t))return l;return-1},getColumnLabel(t){return!t||!this.columnMap[t]?t||"":H(this.columnMap[t]).label||t},initializeColumnConfig(){this.defaultColumns&&this.defaultColumns.length>0?this.defaultColumnsConfig=this.defaultColumns:this.processOriginalColumns(),this.loadColumnConfig()},processOriginalColumns(){const t=this.columns||[];let i={};this.defaultColumnsConfig=t.filter(l=>{const o=H(l);return!(!o.prop||this.ignoredColumnConfigTypes.includes(o.type))}).map((l,o)=>{const s=H(l),n=b(b({},Mt),s);Y(l,n),s.prop&&(i[s.prop]=l);const r=s.hasOwnProperty("visible")?s.visible!==!1:!0;return{prop:s.prop,fixed:s.fixed||"",sort:o,cancellable:s.hasOwnProperty("cancellable")?s.cancellable:!0,visible:r}}),this.columnMap=i},loadColumnConfig(){Ft({key:this.computedTableKey}).then(t=>{var l;if(t.data.code!==200)return;let i=JSON.parse(((l=t.data)==null?void 0:l.data)||null)||{};i.columnsConfig&&JSON.stringify(this.defaultColumnsConfig)===JSON.stringify(i.defaultColumnsConfig)?this.tableColumns=i.columnsConfig.map(o=>b({},o)):this.tableColumns=this.defaultColumnsConfig.map(o=>b({},o)),this.processedColumns=this.applyColumnConfig(this.tableColumns),this.isConfigLoaded=!0,this.$emit("complete",{columns:this.processedColumns,isInitialLoad:!0})}).catch(()=>{this.tableColumns=this.defaultColumnsConfig.map(t=>b({},t)),this.processedColumns=this.applyColumnConfig(this.tableColumns),this.isConfigLoaded=!0,this.$emit("complete",{columns:this.processedColumns,isInitialLoad:!0})})},applyColumnConfig(t,i=!1){let l=this.columns.filter(s=>{const n=H(s);return this.ignoredColumnConfigTypes.includes(n.type)}),o=[];return[...t].sort((s,n)=>{const r=s.sort!==void 0?s.sort:1/0,h=n.sort!==void 0?n.sort:1/0;return r-h}).forEach(s=>{if(s.prop){let n=this.columnMap[s.prop];n&&(Y(n,{fixed:s.fixed||void 0,visible:s.visible}),(!i&&s.visible||i)&&o.push(n))}}),l.forEach(s=>{Y(s,{visible:!0})}),[...l,...o]},crateSortable(){const t=this.$refs.sortListRef;if(!t)return;this.sortable&&(this.sortable.destroy(),this.sortable=null);const i=new g(t,{ghostClass:"blue-background-class",animation:150,easing:"cubic-bezier(1, 0, 0, 1)",handle:".row-title",draggable:".sort-item-wrapper",fallbackOnBody:!1,preventOnFilter:!0,removeCloneOnHide:!0,group:"columns",dragClass:"sortable-drag",onStart:({item:l})=>{const o=l.getAttribute("data-prop"),s=this.sortedTableColumns.find(n=>n.prop===o);this.isDraggingFrozen=s&&s.fixed==="left",this.isDraggingFrozenRight=s&&s.fixed==="right",this.draggedItemIndex=Array.from(t.children).indexOf(l),l.classList.add("sortable-drag")},onMove:l=>{const{target:o,related:s}=l;if(!o||!s)return!1;const n=s?s.getAttribute("data-prop"):null,r=n?this.sortedTableColumns.find(d=>d.prop===n):null,h=r&&r.fixed==="left",c=r&&r.fixed==="right";return this.isDraggingFrozen&&!h||this.isDraggingFrozenRight&&!c||!this.isDraggingFrozen&&!this.isDraggingFrozenRight&&(h||c)?(o.classList.add("no-drop-zone"),!1):(document.querySelectorAll(".no-drop-zone").forEach(d=>{d.classList.remove("no-drop-zone")}),!0)},onEnd:({item:l,newIndex:o,oldIndex:s})=>{if(o===void 0||s===void 0||o<0||s<0||o>=this.sortedTableColumns.length||s>=this.sortedTableColumns.length)return;document.querySelectorAll(".no-drop-zone").forEach(V=>{V.classList.remove("no-drop-zone")}),l.classList.remove("sortable-drag");const n=this.sortedTableColumns[s],r=n.fixed==="left",h=n.fixed==="right",c=o>0?this.sortedTableColumns[o-1]:null,d=o<this.sortedTableColumns.length-1?this.sortedTableColumns[o+1]:null;let p=!1;if(r?(c&&c.fixed!=="left"||d&&d.fixed==="right")&&(p=!0):h?(c&&c.fixed!=="right"||d&&d.fixed!=="right")&&(p=!0):(c&&c.fixed==="right"||d&&d.fixed==="left")&&(p=!0),p){this.rollbackSort();return}this.updateSortAfterDrag()}});this.sortable=i},rollbackSort(){this.sortedTableColumns=JSON.parse(JSON.stringify(this.columnsCopy))},updateSortAfterDrag(){const t=this.$refs.sortListRef;if(!t)return;Array.from(t.children||[]).filter(l=>l&&l.dataset&&l.dataset.prop).map(l=>l.dataset.prop).forEach((l,o)=>{this.sortedTableColumns.some(s=>s.prop===l?(s.sort=o,!0):!1)}),this.columnsCopy=JSON.parse(JSON.stringify(this.sortedTableColumns)),this.$emit("on-sort-change",this.sortedTableColumns)},init(){this.tableColumns=Array.isArray(this.tableColumns)?[...this.tableColumns]:Array.isArray(this.defaultColumnsConfig)?[...this.defaultColumnsConfig]:[],this.initSortedTableColumns()},initSortedTableColumns(){this.tableColumns.forEach((t,i)=>{t.sort===void 0&&(t.sort=i)}),this.sortedTableColumns=[...this.tableColumns].sort((t,i)=>t.fixed==="left"&&i.fixed!=="left"?-1:t.fixed!=="left"&&i.fixed==="left"||t.fixed==="right"&&i.fixed!=="right"?1:t.fixed!=="right"&&i.fixed==="right"?-1:t.sort-i.sort)},setPlacement(){const i=this.$refs.operationRef.$el.getBoundingClientRect();(window.innerHeight||document.documentElement.clientHeight)-(i.bottom-window.scrollY)>512?this.placement="bottom":this.placement="left"},handleVisibleChange(t){this.popoverVisible=t},handlePopoverShow(){this.setPlacement(),this.init(),(()=>{try{document.removeEventListener("mouseup",window.sortableGlobalMouseUp),document.removeEventListener("mousemove",window.sortableGlobalMouseMove)}catch(i){}})(),this.$nextTick(()=>{this.crateSortable()})},handlePopoverHide(){this.sortable&&(this.sortable.destroy(),this.sortable=null);try{document.removeEventListener("mouseup",window.sortableGlobalMouseUp),document.removeEventListener("mousemove",window.sortableGlobalMouseMove),typeof g!="undefined"&&g.utils&&(document.removeEventListener("mousemove",g.utils.throttleCall),document.removeEventListener("mouseup",g.utils.throttleCall))}catch(t){}},handleSelectAll(){const t=this.tableColumns.some(i=>!i.visible);this.tableColumns.forEach(i=>{i.cancellable&&(i.visible=t)})},handleRestoreDefault(){this.tableColumns=JSON.parse(JSON.stringify(this.defaultColumnsConfig)),this.sortedTableColumns=[...this.tableColumns].sort((t,i)=>t.sort-i.sort)},canMoveTop(t,i){if(i===0)return!1;if(t.fixed==="left"){const l=this.sortedTableColumns[i-1];return l&&l.fixed==="left"}if(!t.fixed){const l=this.sortedTableColumns[i-1];return l&&l.fixed==="left"?!1:l&&!l.fixed}return t.fixed==="right"},moveTop(t,i){const l=this.sortedTableColumns,o=t.prop;if(t.fixed==="right"&&(t.fixed=""),t.fixed==="left")l.unshift(l.splice(i,1)[0]);else{const s=this.findLastIndex(this.sortedTableColumns,n=>n.fixed==="left");l.splice(s+1,0,l.splice(i,1)[0])}this.updateSortValues(),this.columnsCopy=JSON.parse(JSON.stringify(this.sortedTableColumns)),this.$emit("on-sort-change",this.sortedTableColumns),this.$nextTick(()=>{const s=this.$refs.sortListRef;if(s){const n=Array.from(s.children).find(r=>r.dataset&&r.dataset.prop===o);n&&n.scrollIntoView({behavior:"smooth",block:"nearest"})}})},frozenLeftHandle(t){const i=this.sortedTableColumns,l=i.splice(t,1)[0];if(l.fixed=l.fixed==="left"?"":"left",l.fixed==="left"){const o=this.findLastIndex(this.sortedTableColumns,s=>s.fixed==="left");i.splice(o+1,0,l)}else{const o=this.findLastIndex(this.sortedTableColumns,s=>s.fixed==="left");i.splice(o+1,0,l)}this.updateSortValues(),this.columnsCopy=JSON.parse(JSON.stringify(this.sortedTableColumns)),this.$emit("on-sort-change",this.sortedTableColumns)},frozenRightHandle(t){const i=this.sortedTableColumns,l=i.splice(t,1)[0];if(l.fixed=l.fixed==="right"?"":"right",l.fixed==="right"){const o=i.findIndex(s=>s.fixed==="right");o===-1?i.push(l):i.splice(o,0,l)}else{const o=i.findIndex(s=>s.fixed==="right");o===-1?i.push(l):i.splice(o,0,l)}this.updateSortValues(),this.columnsCopy=JSON.parse(JSON.stringify(this.sortedTableColumns)),this.$emit("on-sort-change",this.sortedTableColumns)},onSave(){var i;this.updateSortValues();const t=(i=this.tableColumns)==null?void 0:i.map(l=>{const o=this.sortedTableColumns.find(h=>h.prop===l.prop);o&&(l.sort=o.sort,l.fixed=o.fixed,l.visible=o.visible);const r=l,{label:s}=r;return oe(r,["label"])});Lt({key:this.computedTableKey,info:JSON.stringify({columnsConfig:t,defaultColumnsConfig:this.defaultColumnsConfig})}).then(l=>{l.data.code===200&&(this.processedColumns=this.applyColumnConfig(t,!0),this.$emit("complete",{columns:this.processedColumns,isInitialLoad:!1}),this.$message.success(this.t("saveSuccess")),this.popoverVisible=!1)})},updateSortValues(){this.sortedTableColumns.forEach((t,i)=>{t.sort=i})}},mounted(){var t;(t=this.tableColumns)!=null&&t.length&&(this.initSortedTableColumns(),this.crateSortable(),this.columnsCopy=JSON.parse(JSON.stringify(this.sortedTableColumns)))},beforeDestroy(){this.sortable&&(this.sortable.destroy(),this.sortable=null);try{document.removeEventListener("mouseup",window.sortableGlobalMouseUp),document.removeEventListener("mousemove",window.sortableGlobalMouseMove),typeof g!="undefined"&&g.utils&&(document.removeEventListener("mousemove",g.utils.throttleCall),document.removeEventListener("mouseup",g.utils.throttleCall))}catch(t){}}},Ht={key:0,class:"container"},Rt={class:"main-container"},Pt={class:"left-content"},It={class:"title"},vt={class:"option-list"},Wt={style:{height:"100%","overflow-y":"auto"}},Ut={class:"right-content"},jt={class:"search-box"},Jt={key:0,class:"tips"},Kt={class:"sort-list",ref:"sortListRef"},Qt=["data-prop"],qt={key:0,class:"sort-item"},Yt={class:"row-title"},Gt={class:"operation-btns"},Xt={class:"footer"},Zt={class:"footer-left"},$t={class:"footer-right"},el={style:{display:"inline-block","margin-left":"10px"}};function tl(t,i,l,o,s,n){const r=e.resolveComponent("el-button"),h=e.resolveComponent("TmEllipsisText"),c=e.resolveComponent("el-checkbox"),d=e.resolveComponent("el-input"),p=e.resolveComponent("MoveIcon"),V=e.resolveComponent("DeleteIcon"),x=e.resolveComponent("el-tooltip"),k=e.resolveComponent("UploadIcon"),L=e.resolveComponent("FixedLeftIcon"),a=e.resolveComponent("FixedRightIcon"),z=e.resolveComponent("MenuIcon"),f=e.resolveComponent("el-popover");return e.openBlock(),e.createBlock(f,e.mergeProps({"popper-class":"column-config-popover"},{[s.isVue3?"visible":"value"]:s.popoverVisible},e.toHandlers({[s.isVue3?"update:visible":"input"]:n.handleVisibleChange}),{width:680,"show-arrow":!1,placement:s.placement,trigger:"click",onShow:n.handlePopoverShow,onHide:n.handlePopoverHide}),{reference:e.withCtx(()=>[e.createElementVNode("div",el,[e.createVNode(x,e.mergeProps({content:s.t("columnSetting")},s.afterOpenDelay,{placement:"top"}),{default:e.withCtx(()=>[e.createVNode(r,{size:s.getDefaultSize(),ref:"operationRef",circle:""},{default:e.withCtx(()=>[e.createVNode(z)]),_:1},8,["size"])]),_:1},16,["content"])])]),default:e.withCtx(()=>[s.popoverVisible?(e.openBlock(),e.createElementBlock("div",Ht,[e.createElementVNode("div",Rt,[e.createElementVNode("div",Pt,[e.createElementVNode("div",It,[e.createElementVNode("span",null,e.toDisplayString(s.t("SelectableFields"))+"("+e.toDisplayString(s.tableColumns.length)+")",1),e.createVNode(r,e.mergeProps({style:{"margin-left":"10px"}},s.buttonType,{onClick:n.handleSelectAll}),{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(s.t("all")),1)]),_:1},16,["onClick"])]),e.createElementVNode("div",vt,[e.createElementVNode("div",Wt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.tableColumns,(m,O)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[m.prop?(e.openBlock(),e.createElementBlock("div",{style:{width:"110px",display:"inline-block"},key:O+m.prop},[e.createVNode(c,{disabled:!m.cancellable,class:"el-checkbox",modelValue:m.visible,"onUpdate:modelValue":D=>m.visible=D,label:m.prop,value:m.prop},{default:e.withCtx(()=>[e.createVNode(h,{width:"80px",text:n.getColumnLabel(m.prop)},null,8,["text"])]),_:2},1032,["disabled","modelValue","onUpdate:modelValue","label","value"])])):e.createCommentVNode("",!0)],64))),256))])])]),e.createElementVNode("div",Ut,[e.createElementVNode("div",jt,[e.createVNode(d,{size:s.getCompatSize("small"),class:"search-input",clearable:"",placeholder:s.t("search"),modelValue:s.keyWord,"onUpdate:modelValue":i[0]||(i[0]=m=>s.keyWord=m)},null,8,["size","placeholder","modelValue"])]),n.showFixedLimitTips?(e.openBlock(),e.createElementBlock("div",Jt)):e.createCommentVNode("",!0),e.createElementVNode("div",Kt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.filteredSortedTableColumns,(m,O)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["sort-item-wrapper",[m.fixed==="left"?"frozen":"",m.fixed==="right"?"frozenRight":"",m.fixed?"":"noFrozen"]]),"data-prop":m.prop,key:m.prop},[m.visible?(e.openBlock(),e.createElementBlock("div",qt,[e.createElementVNode("div",Yt,[e.createVNode(p,{style:{"flex-shrink":"0"}}),e.createVNode(h,{text:n.getColumnLabel(m.prop)},null,8,["text"])]),e.createElementVNode("div",Gt,[m.cancellable?(e.openBlock(),e.createBlock(x,e.mergeProps({key:0,content:s.t("cancel"),placement:"top"},{ref_for:!0},s.afterOpenDelay),{default:e.withCtx(()=>[e.createVNode(r,e.mergeProps({ref_for:!0},s.buttonType,{size:s.getCompatSize("mini"),class:"iconfont-button delete-button",onClick:D=>m.visible=!1}),{default:e.withCtx(()=>[e.createVNode(V)]),_:2},1040,["size","onClick"])]),_:2},1040,["content"])):e.createCommentVNode("",!0),n.canMoveTop(m,O)?(e.openBlock(),e.createBlock(x,e.mergeProps({key:1,content:s.t("top"),placement:"top"},{ref_for:!0},s.afterOpenDelay),{default:e.withCtx(()=>[e.createVNode(r,e.mergeProps({ref_for:!0},s.buttonType,{size:s.getCompatSize("mini"),class:"iconfont-button top-button",onClick:D=>n.moveTop(m,O)}),{default:e.withCtx(()=>[e.createVNode(k)]),_:2},1040,["size","onClick"])]),_:2},1040,["content"])):e.createCommentVNode("",!0),m.fixed!=="right"?(e.openBlock(),e.createBlock(x,e.mergeProps({key:2,content:m.fixed==="left"?s.t("cancelLeftFixed"):s.t("leftFixed"),placement:"top"},{ref_for:!0},s.afterOpenDelay),{default:e.withCtx(()=>[e.createVNode(r,e.mergeProps({ref_for:!0},s.buttonType,{size:s.getCompatSize("mini"),class:["iconfont-button left-fixed-btn",{"active-fixed":m.fixed==="left"}],onClick:D=>n.frozenLeftHandle(O),disabled:m.fixed!=="left"&&n.isThanMaxFrozen}),{default:e.withCtx(()=>[e.createVNode(L)]),_:2},1040,["size","class","onClick","disabled"])]),_:2},1040,["content"])):e.createCommentVNode("",!0),m.fixed!=="left"?(e.openBlock(),e.createBlock(x,e.mergeProps({key:3,content:m.fixed==="right"?s.t("cancelRightFixed"):s.t("rightFixed"),placement:"top"},{ref_for:!0},s.afterOpenDelay),{default:e.withCtx(()=>[e.createVNode(r,e.mergeProps({ref_for:!0},s.buttonType,{size:s.getCompatSize("mini"),class:["iconfont-button right-fixed-btn",{"active-fixed":m.fixed==="right"}],onClick:D=>n.frozenRightHandle(O),disabled:m.fixed!=="right"&&n.isThanMaxRightFrozen}),{default:e.withCtx(()=>[e.createVNode(a)]),_:2},1040,["size","class","onClick","disabled"])]),_:2},1040,["content"])):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0)],10,Qt))),128))],512)])]),e.createElementVNode("div",Xt,[e.createElementVNode("div",Zt,[e.createVNode(r,{size:s.getCompatSize("mini"),onClick:n.handleRestoreDefault},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(s.t("restoreDefault")),1)]),_:1},8,["size","onClick"])]),e.createElementVNode("div",$t,[e.createVNode(r,{size:s.getCompatSize("mini"),onClick:i[1]||(i[1]=m=>s.popoverVisible=!1)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(s.t("cancel")),1)]),_:1},8,["size"]),e.createVNode(r,{size:s.getCompatSize("mini"),type:"primary",onClick:n.onSave},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(s.t("saveAndApply")),1)]),_:1},8,["size","onClick"])])])])):e.createCommentVNode("",!0)]),_:1},16,["placement","onShow","onHide"])}const ll=y(At,[["render",tl],["__scopeId","data-v-127cbd33"]]),il=!1,sl=!0;function G(t){if(!Array.isArray(t))return t;const i=[];for(const l of t)if(l)if(typeof l.type=="symbol"&&l.children){let o=l.children;if(typeof o=="function")continue;if(Array.isArray(o)){const s=G(o);i.push(...s)}else{const s=G([o]);i.push(...s)}}else i.push(l);return i}const nl={name:"TmTable",components:{TableSearch:q,TablePagination:xt,TableMenu:Bt,ColumnConfig:ll,RefreshIcon:Ve,ColumnRenderer:{props:["vnode"],render(){return this.vnode}}},inheritAttrs:!1,props:{data:{type:[Array,Function],default:()=>[]},showSearch:{type:Boolean,default:!0},showMenu:{type:Boolean,default:!0},showPagination:{type:Boolean,default:!0},pagination:{type:Object,default:()=>({})},height:{type:[String,Number]},calcHeight:{type:Number,default:0},dataAdapter:{type:Function,default:null},columnSettingButton:{type:Boolean,default:!0},refreshButton:{type:Boolean,default:!0},tableKey:{type:String,default:""},firstLoad:{type:Boolean,default:!0},maxFixedLeftQuantity:{type:Number},maxFixedRightQuantity:{type:Number},border:{type:Boolean,default:!0},searchColumns:{type:Array,default:null},searchForm:{type:Object,default:()=>({})}},data(){return{getDefaultSize:T,getCompatSize:E,isVue3:sl,isVue2:il,t:w().t,tableData:[],tableLoading:!1,columnsLoading:!1,tableReload:1,tableHeight:null,selectedRows:[],paginationInfo:{current:1,pageSize:20,total:void 0},originalColumns:[],displayColumns:[],isColumnConfigLoaded:!1,afterOpenDelay:{"show-after":300}}},computed:{pageLoading(){return this.tableLoading||this.columnsLoading},computedTableKey(){if(this.tableKey)return this.tableKey;if(this.$route&&this.$route.path)return this.$route.path.slice(1).replace(/\//g,"-");throw new Error("tableKey is required")},computedShowPagination(){return this.showPagination&&typeof this.data=="function"}},watch:{data:{immediate:!0,handler(t){typeof t=="function"?!this.columnSettingButton||this.isColumnConfigLoaded&&!this.firstLoad?this.loadData():Array.isArray(t)&&(this.tableData=t):this.tableData=t}},height:{immediate:!0,handler(){this.getTableHeight()}}},created(){{const t=this.$slots.default();this.originalColumns=G(t)}this.columnSettingButton?this.columnsLoading=!0:(this.displayColumns=this.originalColumns,this.isColumnConfigLoaded=!0)},mounted(){this.getTableHeight(),window.addEventListener("resize",this.getTableHeight)},beforeDestroy(){window.removeEventListener("resize",this.getTableHeight)},methods:{handleUpdateSearchForm(t){this.$emit("update:search-form",t)},handleColumnConfigComplete(t){Array.isArray(t.columns)?this.displayColumns=[...t.columns]:this.displayColumns=[...this.originalColumns],t.isInitialLoad?(this.isColumnConfigLoaded=!0,this.columnsLoading=!1,this.firstLoad&&typeof this.data=="function"&&this.loadData()):this.reloadTable()},isAutoHeight(){return this.height==="auto"},handleRefresh(){this.loadData()},async loadData(){if(Array.isArray(this.data))this.tableData=this.data;else if(typeof this.data=="function"){if(this.tableLoading)return;this.tableLoading=!0;try{const t=await this.data({paginationInfo:{pageSize:this.paginationInfo.pageSize,current:this.paginationInfo.current},params:this.searchForm}),{list:i,total:l,pageSize:o,current:s}=t;this.tableData=i;let n=b({},this.paginationInfo);l!==void 0&&(n.total=l),s!==void 0&&(n.current=s),o!==void 0&&(n.pageSize=o),this.paginationInfo=n}catch(t){}finally{this.tableLoading=!1}}},getTableHeight(){this.isAutoHeight()?this.$nextTick(()=>{const t=this.$refs.table,i=this.$refs.tmPagination;if(!t)return;const l=t.$el,o=i&&i.$el&&i.$el.offsetHeight||0;this.tableHeight=document.documentElement.clientHeight-l.offsetTop-o-this.calcHeight}):this.tableHeight=this.height,this.refreshTable()},search(){this.paginationInfo.current=1,this.loadData()},reset(){this.paginationInfo.current=1,this.$nextTick(()=>{this.loadData()})},handleSelectionChange(t){this.selectedRows=t,this.$emit("selection-change",t)},handleSizeChange(t){this.paginationInfo.pageSize=t,this.loadData(),this.$emit("size-change",t)},handleCurrentChange(t){this.paginationInfo.current=t,this.loadData(),this.$emit("current-change",t)},refreshTable(){this.$refs.table&&this.$refs.table.doLayout()},reloadTable(){this.tableReload++}}},ol={class:"tm-table",ref:"tablePage"};function al(t,i,l,o,s,n){const r=e.resolveComponent("table-search"),h=e.resolveComponent("RefreshIcon"),c=e.resolveComponent("el-button"),d=e.resolveComponent("el-tooltip"),p=e.resolveComponent("ColumnConfig"),V=e.resolveComponent("table-menu"),x=e.resolveComponent("columnRenderer"),k=e.resolveComponent("el-table"),L=e.resolveComponent("table-pagination"),a=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",ol,[l.searchColumns&&l.searchColumns.length>0?(e.openBlock(),e.createBlock(r,{key:0,ref:"search",onSearch:n.search,onReset:n.reset,"onUpdate:searchForm":n.handleUpdateSearchForm,disabled:n.pageLoading,"search-columns":l.searchColumns,"search-form":l.searchForm},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"search",{},void 0,!0)]),_:3},8,["onSearch","onReset","onUpdate:searchForm","disabled","search-columns","search-form"])):e.createCommentVNode("",!0),l.showMenu?(e.openBlock(),e.createBlock(V,{key:1},{left:e.withCtx(()=>[e.renderSlot(t.$slots,"menu-left",{},void 0,!0)]),right:e.withCtx(()=>[e.renderSlot(t.$slots,"menu-right",{},void 0,!0),l.refreshButton&&typeof l.data=="function"?(e.openBlock(),e.createBlock(d,e.mergeProps({key:0,content:s.t("refresh"),placement:"top"},s.afterOpenDelay),{default:e.withCtx(()=>[e.createVNode(c,{onClick:n.handleRefresh,circle:"",size:s.getDefaultSize()},{default:e.withCtx(()=>[e.createVNode(h)]),_:1},8,["onClick","size"])]),_:1},16,["content"])):e.createCommentVNode("",!0),l.columnSettingButton?(e.openBlock(),e.createBlock(p,{key:1,maxFixedLeftQuantity:l.maxFixedLeftQuantity,maxFixedRightQuantity:l.maxFixedRightQuantity,tableKey:n.computedTableKey,columns:s.originalColumns,onComplete:n.handleColumnConfigComplete},null,8,["maxFixedLeftQuantity","maxFixedRightQuantity","tableKey","columns","onComplete"])):e.createCommentVNode("",!0)]),_:3})):e.createCommentVNode("",!0),e.withDirectives((e.openBlock(),e.createBlock(k,e.mergeProps({ref:"table"},B(b({},t.$attrs),{border:l.border}),e.toHandlers(s.isVue2?t.$listeners:{}),{data:s.tableData,height:s.tableHeight,size:s.getCompatSize("mini"),onSelectionChange:n.handleSelectionChange,key:s.tableReload}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.displayColumns,z=>(e.openBlock(),e.createBlock(x,{vnode:z,key:s.isVue3?z.id:z.data.attrs.prop},null,8,["vnode"]))),128))]),_:1},16,["data","height","size","onSelectionChange"])),[[a,n.pageLoading]]),n.computedShowPagination?(e.openBlock(),e.createBlock(L,{key:2,ref:"tmPagination","page-size":s.paginationInfo.pageSize,current:s.paginationInfo.current,total:s.paginationInfo.total,disabled:s.tableLoading,onSizeChange:n.handleSizeChange,onCurrentChange:n.handleCurrentChange},null,8,["page-size","current","total","disabled","onSizeChange","onCurrentChange"])):e.createCommentVNode("",!0)],512)}const X=y(nl,[["render",al],["__scopeId","data-v-8db1f265"]]),rl=!1,cl=!0,dl={name:"TmTableColumn",inheritAttrs:!1,computed:{isVisible(){return this.$attrs.visible!==!1},slots(){return this.$slots}},data(){return{isVue2:rl,isVue3:cl}},created(){this.$parent&&this.$parent.$emit&&this.$parent.$emit("column-initialized",{prop:this.$attrs.prop,visible:this.$attrs.visible!==!1})}};function hl(t,i,l,o,s,n){const r=e.resolveComponent("el-table-column");return n.isVisible?(e.openBlock(),e.createBlock(r,e.mergeProps({key:0},t.$attrs,e.toHandlers(s.isVue2?t.$listeners:{})),e.createSlots({_:2},[e.renderList(n.slots,(h,c)=>({name:c,fn:e.withCtx(d=>[e.renderSlot(t.$slots,c,e.normalizeProps(e.guardReactiveProps(d)))])}))]),1040)):e.createCommentVNode("",!0)}const Z=y(dl,[["render",hl]]),{t:$}=w(),ul={name:"TmAdvancedEllipsisText",components:{CopyIcon:te},props:{rows:{type:Number,default:1},width:{type:String,default:"100%"},maxWidth:{type:String,default:""},showToolbar:{type:Boolean,default:!1},text:{type:String,default:""},showTooltip:{type:Boolean,default:!0},copyable:{type:Boolean,default:!1}},data(){return{isVue2:!1,originalText:"",isHovered:!1,lineHeight:0,containerWidth:0,resizeObserver:null,isCalculating:!1,frontLines:[],lastLineText:"",isLastLineEllipsis:!1,tableRowElement:null}},computed:{containerStyle(){const t={};return this.maxWidth?(t.maxWidth=this.maxWidth,t.width=this.width):t.width=this.width,t},hasToolbarSlot(){return this.$slots.toolbar?this.$slots.toolbar&&this.$slots.toolbar().length>0:!1},hasToolbarContent(){return this.copyable||this.hasToolbarSlot},shouldShowToolbar(){return this.showToolbar||this.isHovered&&this.hasToolbarContent}},mounted(){this.initComponent(),this.setupResizeObserver(),this.setupTableRowHover()},updated(){const t=this.getTextContent();t!==this.originalText&&(this.originalText=t,this.$nextTick(()=>{this.calculateLayout()}))},beforeDestroy(){this.cleanupResizeObserver(),this.cleanupTableRowHover()},beforeUnmount(){this.cleanupResizeObserver(),this.cleanupTableRowHover()},watch:{text:{handler(){this.$nextTick(()=>{this.originalText=this.getTextContent(),this.calculateLayout()})},immediate:!0},rows(){this.$nextTick(()=>{this.calculateLayout()})},shouldShowToolbar(){this.$nextTick(()=>{this.calculateLayout()})},"$slots.default":{handler(){this.$nextTick(()=>{this.originalText=this.getTextContent(),this.calculateLayout()})},deep:!0}},methods:{initComponent(){this.$nextTick(()=>{this.originalText=this.getTextContent(),this.calculateLineHeight(),this.$nextTick(()=>{this.calculateLayout()})})},handleCopy(){navigator.clipboard&&window.isSecureContext?navigator.clipboard.writeText(this.originalText).then(()=>{this.$message.success($("copySuccess"))}).catch(()=>{this.fallbackCopy()}):this.fallbackCopy()},fallbackCopy(){const t=document.createElement("textarea");t.value=this.originalText,t.style.position="fixed",t.style.left="-999999px",t.style.top="-999999px",document.body.appendChild(t),t.focus(),t.select();try{document.execCommand("copy"),this.$message.success($("copySuccess"))}catch(i){this.$message.error($("copyFailed"))}document.body.removeChild(t)},getTextContent(){if(this.$slots.default){const t=this.$slots.default;return t().map(i=>typeof i.children=="string"?i.children:Array.isArray(i.children)?i.children.map(l=>l.children||"").join(""):"").join("")}return this.text||""},calculateLineHeight(){const t=this.$refs.containerRef;if(!t)return;const i=window.getComputedStyle(t);this.containerWidth=t.offsetWidth;const l=this.$refs.measureRef;if(l){this.setMeasureElementStyle(l,{width:this.containerWidth+"px",wordBreak:"break-all",whiteSpace:"normal"}),l.textContent="测",l.offsetHeight;const o=l.offsetHeight;l.innerHTML="",this.lineHeight=o}else{const o=i.lineHeight;if(o&&o!=="normal")this.lineHeight=parseInt(o);else{const s=parseInt(i.fontSize);this.lineHeight=s*1.2}}},calculateLayout(){if(!this.isCalculating){if(!this.originalText||this.rows<=0){this.frontLines=[],this.lastLineText=this.originalText||"",this.isLastLineEllipsis=!1;return}this.isCalculating=!0,this.$nextTick(()=>{requestAnimationFrame(()=>{this.performLayoutCalculation()})})}},performLayoutCalculation(){const t=this.originalText;if(this.rows===1)this.frontLines=[],this.lastLineText=t,this.isLastLineEllipsis=this.checkIfTextOverflows(t);else{const i=this.lineHeight;if(this.getTextHeight(t)<=i)this.frontLines=[],this.lastLineText=t,this.isLastLineEllipsis=this.checkIfTextOverflows(t);else{const o=this.lineHeight*(this.rows-1),s=this.findTextForHeight(t,o);this.frontLines=this.splitTextToLines(s);const n=t.substring(s.length);this.lastLineText=n,this.isLastLineEllipsis=n.length>0&&this.checkIfTextOverflows(n)}}this.isCalculating=!1},findTextForHeight(t,i){if(this.getTextHeight(t)<=i)return t;let l=0,o=t.length,s="";for(;l<=o;){const n=Math.floor((l+o)/2),r=t.substring(0,n);this.getTextHeight(r)<=i?(s=r,l=n+1):o=n-1}return s},splitTextToLines(t){if(!t)return[];const i=[];let l=t;for(;l.length>0;){const o=this.findTextForHeight(l,this.lineHeight);if(o.length===0)break;i.push(o),l=l.substring(o.length)}return i},checkIfTextOverflows(t){if(!t)return!1;const i=this.getTextWidth(t),l=this.shouldShowToolbar&&this.hasToolbarContent?this.getToolbarWidth():0,o=this.containerWidth-l-5;return i>o},getToolbarWidth(){let t=0;return this.copyable&&(t+=20),this.hasToolbarSlot&&(t+=40),t},getTextHeight(t){return this.measureText(t,{width:this.containerWidth+"px",wordBreak:"break-all",whiteSpace:"normal"})},getTextWidth(t){return this.measureText(t,{whiteSpace:"nowrap"})},measureText(t,i={}){if(!this.$refs.containerRef||!this.$refs.measureRef)return 0;const l=this.$refs.measureRef,o=l.style.cssText;this.setMeasureElementStyle(l,i),l.textContent=t,l.offsetHeight;const s=i.whiteSpace==="nowrap"?l.offsetWidth:l.offsetHeight;return l.style.cssText=o,l.innerHTML="",s},setMeasureElementStyle(t,i={}){const l=window.getComputedStyle(this.$refs.containerRef);t.style.cssText="",t.style.position="absolute",t.style.left="-9999px",t.style.top="-9999px",t.style.visibility="hidden",t.style.pointerEvents="none",t.style.zIndex="-1",t.style.fontSize=l.fontSize,t.style.fontFamily=l.fontFamily,t.style.fontWeight=l.fontWeight,t.style.lineHeight=l.lineHeight,t.style.letterSpacing=l.letterSpacing,t.style.wordSpacing=l.wordSpacing,t.style.padding="0",t.style.margin="0",t.style.border="none",t.style.boxSizing="border-box",Object.entries(i).forEach(([o,s])=>{t.style[o]=s})},handleMouseEnter(){this.isHovered=!0},handleMouseLeave(){this.isHovered=!1},setupResizeObserver(){typeof ResizeObserver!="undefined"&&(this.resizeObserver=new ResizeObserver(t=>{const i=t[0];if(i){const l=i.contentRect.width;Math.abs(l-this.containerWidth)>1&&requestAnimationFrame(()=>{this.calculateLineHeight(),this.calculateLayout()})}}),this.$refs.containerRef&&this.resizeObserver.observe(this.$refs.containerRef))},cleanupResizeObserver(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)},setupTableRowHover(){let t=this.$el;for(;t&&t!==document.body;){if(t.classList&&t.classList.contains("el-table__row")){this.tableRowElement=t;break}t=t.parentElement}this.tableRowElement&&(this.tableRowElement.addEventListener("mouseenter",this.handleMouseEnter),this.tableRowElement.addEventListener("mouseleave",this.handleMouseLeave))},cleanupTableRowHover(){this.tableRowElement&&(this.tableRowElement.removeEventListener("mouseenter",this.handleMouseEnter),this.tableRowElement.removeEventListener("mouseleave",this.handleMouseLeave),this.tableRowElement=null)}}},ml={class:"tm-ellipsis-text-wrapper"},pl=["innerHTML"],fl={class:"tm-ellipsis-last-line"},gl=["innerHTML"],bl={key:0,class:"tm-ellipsis-toolbar-part"},yl={key:1,class:"tm-ellipsis-text-wrapper"},Cl=["innerHTML"],kl={class:"tm-ellipsis-last-line"},Vl=["innerHTML"],xl={key:0,class:"tm-ellipsis-toolbar-part"},_l={ref:"measureRef",class:"tm-ellipsis-measure"};function Sl(t,i,l,o,s,n){const r=e.resolveComponent("CopyIcon"),h=e.resolveComponent("el-tooltip");return e.openBlock(),e.createElementBlock("div",{ref:"containerRef",style:e.normalizeStyle(n.containerStyle),class:"tm-ellipsis-text",onMouseenter:i[0]||(i[0]=(...c)=>n.handleMouseEnter&&n.handleMouseEnter(...c)),onMouseleave:i[1]||(i[1]=(...c)=>n.handleMouseLeave&&n.handleMouseLeave(...c))},[l.showTooltip&&s.isLastLineEllipsis?(e.openBlock(),e.createBlock(h,e.mergeProps({key:0,content:s.originalText,disabled:!l.showTooltip||!s.isLastLineEllipsis},{[s.isVue2?"open-delay":"show-after"]:300},{placement:"top"}),{default:e.withCtx(()=>[e.createElementVNode("div",ml,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.frontLines,(c,d)=>(e.openBlock(),e.createElementBlock("div",{key:"front-"+d,class:"tm-ellipsis-line",innerHTML:c},null,8,pl))),128)),e.createElementVNode("div",fl,[e.createElementVNode("div",{class:"tm-ellipsis-text-part",innerHTML:s.lastLineText},null,8,gl),n.shouldShowToolbar&&n.hasToolbarContent?(e.openBlock(),e.createElementBlock("div",bl,[l.copyable?(e.openBlock(),e.createBlock(r,{key:0,class:"icon-item",onClick:n.handleCopy},null,8,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"toolbar",{},void 0,!0)])):e.createCommentVNode("",!0)])])]),_:3},16,["content","disabled"])):(e.openBlock(),e.createElementBlock("div",yl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.frontLines,(c,d)=>(e.openBlock(),e.createElementBlock("div",{key:"front-"+d,class:"tm-ellipsis-line",innerHTML:c},null,8,Cl))),128)),e.createElementVNode("div",kl,[e.createElementVNode("div",{class:"tm-ellipsis-text-part",innerHTML:s.lastLineText},null,8,Vl),n.shouldShowToolbar&&n.hasToolbarContent?(e.openBlock(),e.createElementBlock("div",xl,[l.copyable?(e.openBlock(),e.createBlock(r,{key:0,class:"icon-item",onClick:n.handleCopy},null,8,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"toolbar",{},void 0,!0)])):e.createCommentVNode("",!0)])])),e.createElementVNode("div",_l,null,512)],36)}const ee=y(ul,[["render",Sl],["__scopeId","data-v-16643222"]]),le={install:{install(t,i={}){[X,Z,F,ee].forEach(l=>t.component(l.name,l)),i.tableConfigProvider&&Ot(i.tableConfigProvider),i.lang&&M(i.lang||"zh-CN")}}.install,Table:X,Column:Z,Search:q,Select:I,AdvancedInput:W,AdvancedDate:U,Cascader:j,Radio:J,Checkbox:K,Switch:Q,EllipsisText:F,AdvancedEllipsisText:ee,setLang:M,useLocale:w};typeof window!="undefined"&&window.Vue&&le.install(window.Vue),u.AdvancedDate=U,u.AdvancedEllipsisText=ee,u.AdvancedInput=W,u.Cascader=j,u.Checkbox=K,u.Column=Z,u.EllipsisText=F,u.Radio=J,u.Search=q,u.Select=I,u.Switch=Q,u.Table=X,u.default=le,u.setLang=M,u.useLocale=w,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(m,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue"),require("@element-plus/icons-vue"),require("sortablejs")):typeof define=="function"&&define.amd?define(["exports","vue","@element-plus/icons-vue","sortablejs"],t):(m=typeof globalThis!="undefined"?globalThis:m||self,t(m.TmTable={},m.Vue,m.ElementPlusIconsVue,m.Sortable))})(this,function(m,t,y,f){"use strict";var Gl=Object.defineProperty,Xl=Object.defineProperties;var Zl=Object.getOwnPropertyDescriptors;var P=Object.getOwnPropertySymbols;var ue=Object.prototype.hasOwnProperty,me=Object.prototype.propertyIsEnumerable;var he=(m,t,y)=>t in m?Gl(m,t,{enumerable:!0,configurable:!0,writable:!0,value:y}):m[t]=y,g=(m,t)=>{for(var y in t||(t={}))ue.call(t,y)&&he(m,y,t[y]);if(P)for(var y of P(t))me.call(t,y)&&he(m,y,t[y]);return m},T=(m,t)=>Xl(m,Zl(t));var pe=(m,t)=>{var y={};for(var f in m)ue.call(m,f)&&t.indexOf(f)<0&&(y[f]=m[f]);if(m!=null&&P)for(var f of P(m))t.indexOf(f)<0&&me.call(m,f)&&(y[f]=m[f]);return y};const ie={mini:"small",small:"small",default:"default",large:"large"},B=e=>ie[e]||ie.default,V=()=>"default",fe={"zh-CN":{today:"今天",yesterday:"昨天",last7days:"最近7天",last30days:"最近30天",thisMonth:"本月",lastMonth:"上月",checkAll:"全选",search:"搜索",query:"查询",reset:"重置",columnSetting:"列设置",refresh:"刷新",cancel:"取消",fixedLeft:"固定在左侧",fixedRight:"固定在右侧",top:"置顶",restoreDefault:"恢复默认",saveAndApply:"保存并应用",startDate:"开始日期",endDate:"结束日期",all:"全选",SelectableFields:"可选择字段",fixedColumns:"固定列",leftmost:"左侧最多",rightmost:"右侧最多",items:"项",accurateSearchTips:"每行一个,支持多个值",accurateSearchPlaceholder:"精确搜索,一行一项",selectPlaceholder:"请选择",clear:"清空",saveSuccess:"保存成功",cancelRightFixed:"取消右侧固定",rightFixed:"固定到右侧",cancelLeftFixed:"取消左侧固定",leftFixed:"固定到左侧",cancelTop:"取消置顶",copySuccess:"复制成功",copyFailed:"复制失败"},"en-US":{today:"Today",yesterday:"Yesterday",last7days:"Last 7 days",last30days:"Last 30 days",thisMonth:"This month",lastMonth:"Last month",checkAll:"Check all",search:"Search",query:"Search",reset:"Reset",columnSetting:"Column Setting",refresh:"Refresh",cancel:"Cancel",fixedLeft:"Fixed left",fixedRight:"Fixed right",top:"Top",restoreDefault:"Restore default",saveAndApply:"Save and apply",startDate:"Start date",endDate:"End date",all:"All",SelectableFields:"Fields",fixedColumns:"Fixed columns",leftmost:"Leftmost",rightmost:"Rightmost",items:"item(s)",accurateSearchTips:"One per line, supporting multiple values",accurateSearchPlaceholder:"Accurate search, one per line",selectPlaceholder:"Please select",clear:"Clear",saveSuccess:"Successfully saved",cancelRightFixed:"Cancel right fixed",rightFixed:"Fixed to right",cancelLeftFixed:"Cancel left fixed",leftFixed:"Fixed to left",cancelTop:"Cancel top",copySuccess:"Copy successfully",copyFailed:"Copy failed"}};let A={value:"zh-CN"};A=t.ref("zh-CN");const ge=e=>{var i;return((i=fe[A.value])==null?void 0:i[e])||e},M=e=>{A.value=e},S=()=>({t:ge,setLang:M,currentLang:A}),b=(e,i)=>{const l=e.__vccOpts||e;for(const[a,n]of i)l[a]=n;return l},be={name:"BaseIcon",props:{path:{type:String},size:{type:[String,Number]},color:{type:String}},methods:{handleClick(){}}},ye=["width","height"],Ce=["d"];function _e(e,i,l,a,n,o){return t.openBlock(),t.createElementBlock("i",{class:"tm-icon",onClick:i[0]||(i[0]=(...r)=>o.handleClick&&o.handleClick(...r))},[(t.openBlock(),t.createElementBlock("svg",{width:l.size,height:l.size,style:t.normalizeStyle({color:l.color}),viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},[t.createElementVNode("path",{d:l.path},null,8,Ce)],12,ye))])}const Ve=b(be,[["render",_e],["__scopeId","data-v-1c30ca93"]]),x=Object.entries({menu:"M160 448a32 32 0 0 1-32-32V160.064a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V416a32 32 0 0 1-32 32zm448 0a32 32 0 0 1-32-32V160.064a32 32 0 0 1 32-32h255.936a32 32 0 0 1 32 32V416a32 32 0 0 1-32 32zM160 896a32 32 0 0 1-32-32V608a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32v256a32 32 0 0 1-32 32zm448 0a32 32 0 0 1-32-32V608a32 32 0 0 1 32-32h255.936a32 32 0 0 1 32 32v256a32 32 0 0 1-32 32z",more:"M76.92892277 192.94787572h864.34120754c23.20379058 0 46.40758118-17.40284367 46.40758118-46.40758118s-23.20379058-46.40758118-46.40758118-46.40758116H76.92892277c-29.00473897 0-46.40758264 17.40284367-46.40758264 46.40758116s23.20379058 46.40758118 46.40758264 46.40758118zM941.27013031 465.59241882H76.92892277c-29.00473897 0-46.40758264 17.40284367-46.40758264 46.40758118s23.20379058 46.40758118 46.40758264 46.40758118h864.34120754c23.20379058 0 46.40758118-17.40284367 46.40758118-46.40758118s-23.20379058-46.40758118-46.40758118-46.40758118zM941.27013031 825.25117589H76.92892277c-29.00473897 0-46.40758264 17.40284367-46.40758264 46.40758118s23.20379058 46.40758118 46.40758264 46.40758264h864.34120754c23.20379058 0 46.40758118-17.40284367 46.40758118-46.40758264s-23.20379058-46.40758118-46.40758118-46.40758118z",refresh:"M771.776 794.88A384 384 0 0 1 128 512h64a320 320 0 0 0 555.712 216.448H654.72a32 32 0 1 1 0-64h149.056a32 32 0 0 1 32 32v148.928a32 32 0 1 1-64 0v-50.56zM276.288 295.616h92.992a32 32 0 0 1 0 64H220.16a32 32 0 0 1-32-32V178.56a32 32 0 0 1 64 0v50.56A384 384 0 0 1 896.128 512h-64a320 320 0 0 0-555.776-216.384z",move:"M238.93333333 102.4a68.26666667 68.26666667 0 1 1 136.53333334 0 68.26666667 68.26666667 0 0 1-136.53333334 0z m409.6 0a68.26666667 68.26666667 0 1 1 136.53333334 0 68.26666667 68.26666667 0 0 1-136.53333334 0zM238.93333333 375.46666667a68.26666667 68.26666667 0 1 1 136.53333334 0 68.26666667 68.26666667 0 0 1-136.53333334 0z m409.6 0a68.26666667 68.26666667 0 1 1 136.53333334 0 68.26666667 68.26666667 0 0 1-136.53333334 0z m-409.6 273.06666666a68.26666667 68.26666667 0 1 1 136.53333334 0 68.26666667 68.26666667 0 0 1-136.53333334 0z m409.6 0a68.26666667 68.26666667 0 1 1 136.53333334 0 68.26666667 68.26666667 0 0 1-136.53333334 0z m-341.33333333 204.8a68.26666667 68.26666667 0 1 0 0 136.53333334 68.26666667 68.26666667 0 0 0 0-136.53333334z m341.33333333 68.26666667a68.26666667 68.26666667 0 1 1 136.53333334 0 68.26666667 68.26666667 0 0 1-136.53333334 0z","column-setting":"M436.05333334 18.36373333a109.22666667 109.22666667 0 0 1 109.22666666 0l345.56586667 199.54346667c33.792 19.52426667 54.61333333 55.56906667 54.61333333 94.54933333V580.26666667h-81.92V312.45653333a27.30666667 27.30666667 0 0 0-13.65333333-23.62026666L504.32 89.2928a27.30666667 27.30666667 0 0 0-27.30666666 0L131.44746667 288.83626667a27.30666667 27.30666667 0 0 0-13.65333333 23.62026666v399.08693334a27.30666667 27.30666667 0 0 0 13.65333333 23.62026666L477.01333334 934.7072a27.30666667 27.30666667 0 0 0 27.30666666 0l54.61333334-31.5392v94.54933333l-13.65333334 7.91893334a109.22666667 109.22666667 0 0 1-109.22666666 0l-345.56586667-199.54346667a109.22666667 109.22666667 0 0 1-54.61333333-94.54933333V312.45653333c0-38.98026667 20.82133333-75.09333333 54.61333333-94.54933333L436.05333334 18.36373333z","fixed-left":"M843.36363653 311.54545478l-53.18181827 1e-8-20.45454521 28.63636347-163.63636435 204.54545479-24.54545391 28.63636347 12.27272695 36.81818175c8.18181826 28.63636347 12.27272695 57.27272695 12.27272696 85.90909042 0 32.72727305-4.09090869 61.36363652-16.36363565 90-4.09090869 16.36363653-12.27272695 32.72727306-24.54545479 49.09090957l-163.63636347-163.63636347-40.90909131-40.90909132-12.27272695-12.27272695-163.63636348-163.63636347c28.63636347-16.36363653 61.36363652-28.63636347 94.09090869-32.72727305 45-8.18181826 90-4.09090869 134.99999999 8.18181826l36.81818175 12.27272695 28.63636347-24.54545391 204.54545479-163.63636435 28.63636347-16.36363564 0-32.72727305L712.45454521 184.72727305l130.90909132 126.81818173zM941.54545479 327.90909131c0-8.18181826-4.09090869-16.36363653-8.18181826-24.54545478L720.63636348 94.72727305c-12.27272695-16.36363653-36.81818174-12.27272695-49.09090869 4.0909087-20.45454521 28.63636347-28.63636347 65.45454521-28.63636348 98.18181825l0 4.09090869-204.54545478 163.63636436c-110.45454521-36.81818174-233.18181826-16.36363653-327.27272784 61.36363564-8.18181826 8.18181826-12.27272695 16.36363653-12.27272694 24.54545478 0 8.18181826 4.09090869 16.36363653 8.18181825 24.5454548l196.36363653 196.36363652-212.72727305 212.72727216c-4.09090869 4.09090869-8.18181826 12.27272695-8.18181826 20.4545461s4.09090869 16.36363653 8.18181826 20.4545452c12.27272695 12.27272695 32.72727306 12.27272695 45 1e-8L352.45454522 716.54545479l196.36363652 196.36363652c12.27272695 12.27272695 36.81818174 12.27272695 49.09090957-4.09090957C651.09090869 847.45454521 675.63636347 773.81818174 675.63636346 696.09090869c0-36.81818173-4.09090869-73.63636348-16.36363651-106.36363564l163.63636436-204.54545479c36.81818173 0 73.63636348-8.18181826 106.36363564-28.63636347C937.45454519 348.36363653 941.54545478 336.09090869 941.54545479 327.90909131z","fixed-right":"M311.54545479 180.63636347v53.18181827l28.63636347 20.45454521 204.54545479 163.63636436 28.63636347 24.5454539 36.81818174-12.27272695c28.63636347-8.18181826 57.27272695-12.27272695 85.90909043-12.27272695 32.72727305 0 61.36363652 4.09090869 90 16.36363564 16.36363653 4.09090869 32.72727305 12.27272695 49.09090957 24.54545479l-163.63636347 163.63636347-40.90909132 40.90909131-12.27272695 12.27272695-163.63636347 163.63636348c-16.36363653-28.63636347-28.63636347-61.36363652-32.72727305-94.09090869-8.18181826-45-4.09090869-90 8.18181826-135l12.27272695-36.81818174-24.5454539-28.63636347-163.63636436-204.54545479-16.36363564-28.63636347h-32.72727305H184.72727305l126.81818174-130.90909132zM327.90909131 82.45454521c-8.18181826 0-16.36363653 4.09090869-24.54545478 8.18181826L94.72727305 303.36363652c-16.36363653 12.27272695-12.27272695 36.81818174 4.09090869 49.09090869 28.63636347 20.45454521 65.45454521 28.63636347 98.18181826 28.63636348h4.09090869l163.63636436 204.54545478c-36.81818174 110.45454521-16.36363653 233.18181826 61.36363564 327.27272784 8.18181826 8.18181826 16.36363653 12.27272695 24.54545478 12.27272695 8.18181826 0 16.36363653-4.09090869 24.54545479-8.18181826l196.36363653-196.36363653 212.72727216 212.72727305c4.09090869 4.09090869 12.27272695 8.18181826 20.4545461 8.18181827s16.36363653-4.09090869 20.45454521-8.18181827c12.27272695-12.27272695 12.27272695-32.72727305 0-45L716.54545479 671.54545479l196.36363652-196.36363653c12.27272695-12.27272695 12.27272695-36.81818174-4.09090957-49.09090957C847.45454521 372.90909131 773.81818174 348.36363653 696.09090869 348.36363653c-36.81818174 0-73.63636348 4.09090869-106.36363564 16.36363652l-204.54545479-163.63636436c0-36.81818174-8.18181826-73.63636348-28.63636347-106.36363564C348.36363653 86.54545479 336.09090869 82.45454521 327.90909131 82.45454521z",upload:"M160 832h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64m384-578.304V704h-64V247.296L237.248 490.048 192 444.8 508.8 128l316.8 316.8-45.312 45.248z",download:"M160 832h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64m384-253.696 236.288-236.352 45.248 45.248L508.8 704 192 387.2l45.248-45.248L480 584.704V128h64z",delete:"M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32",copy:"M128 320v576h576V320zm-32-64h640a32 32 0 0 1 32 32v640a32 32 0 0 1-32 32H96a32 32 0 0 1-32-32V288a32 32 0 0 1 32-32M960 96v704a32 32 0 0 1-32 32h-96v-64h64V128H384v64h-64V96a32 32 0 0 1 32-32h576a32 32 0 0 1 32 32M256 672h320v64H256zm0-192h320v64H256z"}).reduce((e,[i,l])=>{const a=`${i}Icon`,n={name:a,props:{path:{type:String,default:l},size:{type:[String,Number]},color:{type:String}},render(o){return t.h(Ve,this.$props)}};return n.install=o=>{o.component(a,n)},e[i]=n,e},{}),Se=x.menu,xe=x.refresh,ke=x.move;x["column-setting"];const we=x.more,Te=x["fixed-left"],Fe=x["fixed-right"],ze=x.upload,Le=x.download,Be=x.delete,ne=x.copy,{t:W}=S(),Ne=!1,Oe=!0,Ee={name:"TmEllipsisText",components:{CopyIcon:ne},props:{text:{type:String,required:!0},width:{type:[String,Number],default:"auto"},maxWidth:{type:[String,Number],default:"100%"},lines:{type:Number,default:1},showTooltip:{type:Boolean,default:!0},lineHeight:{type:[String,Number]},copyable:{type:Boolean,default:!1}},data(){return{isVue2:Ne,isVue3:Oe,isOverflow:!1,currentLines:1,resizeObserver:null}},computed:{tooltipDisabled(){return!this.showTooltip||!this.isOverflow},textStyle(){const e=typeof this.width=="number"?`${this.width}px`:this.width,i=typeof this.maxWidth=="number"?`${this.maxWidth}px`:this.maxWidth;return{width:e,maxWidth:i,lineHeight:this.lineHeight,display:"-webkit-inline-box",overflow:"hidden",WebkitBoxOrient:"vertical",WebkitLineClamp:this.lines}}},mounted(){this.checkOverflow(),this.setupResizeObserver()},beforeDestroy(){this.cleanupResizeObserver()},beforeUnmount(){this.cleanupResizeObserver()},watch:{text(){this.$nextTick(this.checkOverflow)}},methods:{checkOverflow(){this.$refs.textEl&&this.$nextTick(()=>{this.$nextTick(()=>{this.performOverflowCheck()})})},performOverflowCheck(){var u;const e=this.$refs.textEl;if(!e)return;const i=getComputedStyle(e);if(!i.width||i.width==="0px"){this.$nextTick(()=>{this.performOverflowCheck()});return}const l=e.scrollHeight,a=e.scrollWidth,n=e.clientHeight,o=e.clientWidth,r=1,h=l>n+r,c=a>o+r;if(h||c){this.isOverflow=!0;const p=parseFloat(i.lineHeight)||16;this.currentLines=Math.ceil(l/p)}else{const p=e.getBoundingClientRect(),_=(u=e.parentElement)==null?void 0:u.getBoundingClientRect();if(_){const k=p.height>_.height||p.width>_.width;this.isOverflow=k}else this.isOverflow=!1;this.currentLines=1}},setupResizeObserver(){window.ResizeObserver&&this.$nextTick(()=>{try{this.resizeObserver=new ResizeObserver(()=>{this.checkOverflow()});const e=this.$el;e&&e instanceof Element&&this.resizeObserver.observe(e)}catch(e){console.warn("Failed to setup ResizeObserver:",e)}})},cleanupResizeObserver(){if(this.resizeObserver)try{this.resizeObserver.disconnect()}catch(e){console.warn("Failed to disconnect ResizeObserver:",e)}finally{this.resizeObserver=null}},handleCopy(){navigator.clipboard&&window.isSecureContext?navigator.clipboard.writeText(this.text).then(()=>{this.$message.success(W("copySuccess"))}).catch(()=>{this.fallbackCopy()}):this.fallbackCopy()},fallbackCopy(){const e=document.createElement("textarea");e.value=this.text,e.style.position="fixed",e.style.left="-999999px",e.style.top="-999999px",document.body.appendChild(e),e.focus(),e.select();try{document.execCommand("copy"),this.$message.success(W("copySuccess"))}catch(i){this.$message.error(W("copyFailed"))}document.body.removeChild(e)}}},De={class:"ellipsis-text-container"};function Ae(e,i,l,a,n,o){const r=t.resolveComponent("CopyIcon"),h=t.resolveComponent("el-tooltip");return t.openBlock(),t.createBlock(h,t.mergeProps({disabled:o.tooltipDisabled,content:l.text,effect:"dark",placement:"top"},{[n.isVue2?"open-delay":"show-after"]:300}),{default:t.withCtx(()=>[t.createElementVNode("div",De,[t.createElementVNode("div",{ref:"textEl",class:"ellipsis-text",style:t.normalizeStyle(o.textStyle)},t.toDisplayString(l.text),5),t.createElementVNode("div",{class:t.normalizeClass(["toolbar",{multiline:n.currentLines>1&&l.lines>1}])},[l.copyable?(t.openBlock(),t.createBlock(r,{key:0,class:"icon-item",onClick:o.handleCopy},null,8,["onClick"])):t.createCommentVNode("",!0)],2)])]),_:1},16,["disabled","content"])}const N=b(Ee,[["render",Ae],["__scopeId","data-v-a51a2011"]]);var Me=Object.defineProperty,He=Object.defineProperties,Re=Object.getOwnPropertyDescriptors,oe=Object.getOwnPropertySymbols,Ie=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,ae=(e,i,l)=>i in e?Me(e,i,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[i]=l,se=(e,i)=>{for(var l in i||(i={}))Ie.call(i,l)&&ae(e,l,i[l]);if(oe)for(var l of oe(i))Pe.call(i,l)&&ae(e,l,i[l]);return e},re=(e,i)=>He(e,Re(i));const We={name:"RenderVue3",inheritAttrs:!1},ve=t.defineComponent(re(se({},We),{props:{renderFn:{type:Function},data:{}},setup(e){const i=e,l=t.useAttrs(),a=t.useSlots(),n=t.computed(()=>re(se({},i.data||{}),{$attrs:l,$slots:a})),o=t.computed(()=>{try{if(!i.renderFn||typeof i.renderFn!="function")return console.warn("[RenderComponent] renderFn must be a function"),null;const r=i.renderFn.toString(),h=/\(\s*h\s*[,)]/.test(r)||i.renderFn.length>=1;let c;return h?c=i.renderFn(t.h,n.value):c=i.renderFn(n.value),c}catch(r){return console.error("[RenderComponent] Error in render function:",r),null}});return(r,h)=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(o.value)))}})),Ue=!1,je=!0,Je={name:"FormItemLayout",components:{EllipsisText:N,RenderComponent:ve},props:{direction:{type:String,default:"horizontal",validator:e=>["horizontal","vertical"].includes(e)},labelWidth:{type:[String,Number],default:120},inputWidth:{type:[String,Number],default:240},label:{type:[String,Function,Object,Array],default:""},labelOptions:{type:Array,default:()=>[]},field:{type:[String,Number],default:""}},data(){return{t:S().t,isVue2:Ue,isVue3:je,getDefaultSize:V}},computed:{hasLabel(){return this.labelOptions&&this.labelOptions.length||this.label},containerStyle(){const e={};if(this.direction==="horizontal"){const i=this.hasLabel?this.parsedLabelWidth+this.parsedInputWidth:this.parsedInputWidth;e.width=`${i}px`}else e.width=`${this.parsedInputWidth}px`;return e},labelStyle(){const e={};return this.direction==="horizontal"?e.width=`${this.parsedLabelWidth}px`:e.width=`${this.parsedInputWidth}px`,e},inputStyle(){return{width:`${this.parsedInputWidth}px`}},parsedLabelWidth(){return typeof this.labelWidth=="string"?parseInt(this.labelWidth):this.labelWidth},parsedInputWidth(){return typeof this.inputWidth=="string"?parseInt(this.inputWidth):this.inputWidth},fieldValue:{get(){return this.field},set(e){this.$emit("field-change",e)}}},watch:{labelOptions:{handler(e){e&&e.length>0&&!this.field&&this.$emit("field-change",e[0].value)},deep:!0,immediate:!0}},methods:{handleFieldChange(e){this.$emit("field-change",e)}}},Ke={key:0,class:"label-text"},Qe={key:1,class:"label-render"};function qe(e,i,l,a,n,o){const r=t.resolveComponent("el-option"),h=t.resolveComponent("el-select"),c=t.resolveComponent("EllipsisText"),u=t.resolveComponent("RenderComponent");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["form-item-layout",{"form-item-layout--horizontal":l.direction==="horizontal","form-item-layout--vertical":l.direction==="vertical"}]),style:t.normalizeStyle(o.containerStyle)},[o.hasLabel?(t.openBlock(),t.createElementBlock("div",{key:0,class:"form-item-label",style:t.normalizeStyle(o.labelStyle)},[l.labelOptions&&l.labelOptions.length?(t.openBlock(),t.createBlock(h,{key:0,modelValue:o.fieldValue,"onUpdate:modelValue":i[0]||(i[0]=p=>o.fieldValue=p),placeholder:n.t("selectPlaceholder"),size:n.getDefaultSize(),class:"label-select",onChange:o.handleFieldChange},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.labelOptions,p=>(t.openBlock(),t.createBlock(r,{key:p.value,label:p.label,value:p.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","size","onChange"])):l.label?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[typeof l.label=="string"?(t.openBlock(),t.createElementBlock("div",Ke,[t.createVNode(c,{text:l.label,lines:2},null,8,["text"])])):typeof l.label=="function"?(t.openBlock(),t.createElementBlock("div",Qe,[t.createVNode(u,{"render-fn":l.label},null,8,["render-fn"])])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0)],4)):t.createCommentVNode("",!0),t.createElementVNode("div",{class:"form-item-input",style:t.normalizeStyle(o.inputStyle)},[t.renderSlot(e.$slots,"default",{},void 0,!0)],4)],6)}const w=b(Je,[["render",qe],["__scopeId","data-v-e75cd736"]]),Ye=!1,Ge=!0,H="modelValue",Xe="update:modelValue",Ze={name:"TmSelectFilter",components:{FormItemLayout:w},props:{[H]:{type:[String,Number,Array],default:""},field:{type:[String,Number],default:""},options:{type:[Array,Function],default:()=>[]},labelOptions:{type:Array,default:()=>[]},label:{type:[String,Function,Object,Array],default:null},props:{type:Object,default:()=>({label:"label",value:"value"})},filterable:{type:Boolean,default:!0},clearable:{type:Boolean,default:!0},collapseTags:{type:Boolean,default:!0},multiple:{type:Boolean,default:!1},showCheckAll:{type:Boolean,default:!0},placeholder:{type:String,default:""},valueOnClear:{type:[String,Number,Boolean,Array,Function],default:void 0},labelWidth:{type:[String,Number],default:void 0},inputWidth:{type:[String,Number],default:void 0},direction:{type:String,default:void 0,validator:e=>!e||["horizontal","vertical"].includes(e)}},data(){return{t:S().t,isVue2:Ye,isVue3:Ge,getDefaultSize:V,optionsList:[],loading:!1,indeterminate:!1,checkAll:!1}},computed:{computedValue:{get(){return this[H]},set(e){let i=e;if(this.multiple&&Array.isArray(e)&&e.length===0&&this.valueOnClear!==void 0){const l=this[H];Array.isArray(l)&&l.length>0&&(i=typeof this.valueOnClear=="function"?this.valueOnClear():this.valueOnClear)}this.$emit(Xe,i),this.$emit("change",i)}},propMap(){return{label:this.props.label||"label",value:this.props.value||"value"}}},watch:{[H](e){!this.multiple||!this.showCheckAll||(e.length===0?(this.checkAll=!1,this.indeterminate=!1):e.length===this.optionsList.length?(this.checkAll=!0,this.indeterminate=!1):this.indeterminate=!0)}},created(){this.initOptions()},methods:{handleFieldChange(e){this.$emit("field-change",e)},async initOptions(){if(Array.isArray(this.options))this.optionsList=this.options;else if(typeof this.options=="function")try{this.loading=!0;const e=await this.options();Array.isArray(e)&&(this.optionsList=e)}catch(e){console.error(e)}finally{this.loading=!1}},handleCheckAll(e){this.indeterminate=!1;let i=[];e&&(i=this.optionsList.map(l=>l[this.propMap.value])),this.computedValue=i},handleClear(){if(this.valueOnClear!==void 0){const e=typeof this.valueOnClear=="function"?this.valueOnClear():this.valueOnClear;this.$nextTick(()=>{this.computedValue=e})}}}},$e={key:0,class:"check-all-option"};function et(e,i,l,a,n,o){const r=t.resolveComponent("el-checkbox"),h=t.resolveComponent("el-option"),c=t.resolveComponent("el-select"),u=t.resolveComponent("FormItemLayout");return t.openBlock(),t.createBlock(u,{label:l.label,"label-options":l.labelOptions,field:l.field,onFieldChange:o.handleFieldChange,"label-width":l.labelWidth,"input-width":l.inputWidth,direction:l.direction},{default:t.withCtx(()=>[t.createVNode(c,t.mergeProps({ref:"select",class:"select",onClear:o.handleClear,modelValue:o.computedValue,"onUpdate:modelValue":i[2]||(i[2]=p=>o.computedValue=p)},T(g({},e.$attrs),{size:n.getDefaultSize(),filterable:l.filterable,clearable:l.clearable,collapseTags:l.collapseTags,multiple:l.multiple,placeholder:l.placeholder,loading:n.loading}),t.toHandlers(n.isVue2?e.$listeners:{}),{loading:n.loading}),{header:t.withCtx(()=>[n.isVue3&&l.multiple&&l.showCheckAll?(t.openBlock(),t.createBlock(r,{key:0,modelValue:n.checkAll,"onUpdate:modelValue":i[1]||(i[1]=p=>n.checkAll=p),indeterminate:n.indeterminate,size:n.getDefaultSize(),onChange:o.handleCheckAll,style:{width:"100%",height:"20px","padding-left":"10px"}},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.t("all")),1)]),_:1},8,["modelValue","indeterminate","size","onChange"])):t.createCommentVNode("",!0)]),default:t.withCtx(()=>[n.isVue2&&l.multiple&&l.showCheckAll?(t.openBlock(),t.createElementBlock("div",$e,[t.createVNode(r,{style:{width:"100%"},modelValue:n.checkAll,"onUpdate:modelValue":i[0]||(i[0]=p=>n.checkAll=p),indeterminate:n.indeterminate,size:n.getDefaultSize(),onChange:o.handleCheckAll},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.t("all")),1)]),_:1},8,["modelValue","indeterminate","size","onChange"])])):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.optionsList,p=>(t.openBlock(),t.createBlock(h,{key:p[o.propMap.value],label:p[o.propMap.label],value:p[o.propMap.value],disabled:p.disabled},{default:t.withCtx(()=>[t.renderSlot(e.$slots,"option",{item:p},()=>[t.createTextVNode(t.toDisplayString(p[o.propMap.label]),1)],!0)]),_:2},1032,["label","value","disabled"]))),128))]),_:3},16,["onClear","modelValue","loading"])]),_:3},8,["label","label-options","field","onFieldChange","label-width","input-width","direction"])}const v=b(Ze,[["render",et],["__scopeId","data-v-b85e9ccb"]]),tt={name:"TmAdvancedInputFilter",components:{MoreIcon:we,FormItemLayout:w},props:{label:{type:[String,Function,Object,Array],default:""},value:{type:String,default:""},field:{type:[String,Number],default:""},placeholder:{type:String,default:""},multiple:{type:Boolean,default:!1},labelOptions:{type:Array,default:()=>[]},labelWidth:{type:[String,Number],default:void 0},inputWidth:{type:[String,Number],default:void 0},direction:{type:String,default:void 0,validator:e=>!e||["horizontal","vertical"].includes(e)}},data(){return{t:S().t,getDefaultSize:V,getCompatSize:B,exactValue:"",inputValue:"",isExactMode:!1,currentOptionMultiple:!1}},computed:{shouldShowMultiple(){return this.currentOptionMultiple!==null?this.currentOptionMultiple:this.multiple},selectedOption(){return!this.labelOptions||!this.labelOptions.length||!this.field?null:this.labelOptions.find(e=>e.value===this.field)}},watch:{isExactMode(e){e?this.$emit("value-change",this.exactValue):this.$emit("value-change",this.inputValue)},exactValue(e){this.$emit("value-change",e)},inputValue(e){this.$emit("value-change",e)},value:{handler(e){this.isExactMode?this.exactValue=e:this.inputValue=e},immediate:!0}},methods:{handlePopoverClose(){document.activeElement&&document.activeElement.blur(),this.isExactMode=!1},handleVisibleChange(e){this.isExactMode=e},handlefieldChange(e){this.$emit("field-change",e),this.updateCurrentOptionMultiple()},updateCurrentOptionMultiple(){const e=this.selectedOption;e&&"multiple"in e?this.currentOptionMultiple=e.multiple:this.currentOptionMultiple=this.multiple},handleExactSearch(){this.$emit("value-change",this.exactValue),this.$emit("search",this.exactValue)},handleClear(){this.exactValue="",this.$emit("value-change","")},handleEnter(){this.$emit("search")}},created(){this.updateCurrentOptionMultiple()}},lt={class:"popover-content"},it={class:"popover-subtitle"},nt={class:"popover-footer"};function ot(e,i,l,a,n,o){const r=t.resolveComponent("el-input"),h=t.resolveComponent("el-button"),c=t.resolveComponent("MoreIcon"),u=t.resolveComponent("el-popover"),p=t.resolveComponent("FormItemLayout");return t.openBlock(),t.createBlock(p,{label:l.label,"label-options":l.labelOptions,field:l.field,onFieldChange:o.handlefieldChange,"label-width":l.labelWidth,"input-width":l.inputWidth,direction:l.direction},{default:t.withCtx(()=>[t.createVNode(r,{modelValue:n.inputValue,"onUpdate:modelValue":i[1]||(i[1]=_=>n.inputValue=_),size:n.getDefaultSize(),placeholder:l.placeholder,onKeyup:t.withKeys(o.handleEnter,["enter","native"]),clearable:"",class:"advanced-input"},t.createSlots({_:2},[o.shouldShowMultiple?{name:"append",fn:t.withCtx(()=>[t.createVNode(u,{visible:n.isExactMode,placement:"bottom-end",width:260,trigger:"click","onUpdate:visible":o.handleVisibleChange},{reference:t.withCtx(()=>[t.createVNode(c,{style:{cursor:"pointer"}})]),default:t.withCtx(()=>[t.createElementVNode("div",lt,[t.createElementVNode("p",it,t.toDisplayString(n.t("accurateSearchTips")),1),t.createVNode(r,{size:n.getDefaultSize(),type:"textarea",rows:8,modelValue:n.exactValue,"onUpdate:modelValue":i[0]||(i[0]=_=>n.exactValue=_),placeholder:n.t("accurateSearchPlaceholder"),style:{"font-size":"12px"}},null,8,["size","modelValue","placeholder"]),t.createElementVNode("div",nt,[t.createVNode(h,{style:{float:"left"},size:n.getCompatSize("mini"),onClick:o.handleClear},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.t("clear")),1)]),_:1},8,["size","onClick"]),t.createVNode(h,{size:n.getCompatSize("mini"),onClick:o.handlePopoverClose},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.t("cancel")),1)]),_:1},8,["size","onClick"]),t.createVNode(h,{type:"primary",size:n.getCompatSize("mini"),onClick:o.handleExactSearch},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.t("search")),1)]),_:1},8,["size","onClick"])])])]),_:1},8,["visible","onUpdate:visible"])]),key:"0"}:void 0]),1032,["modelValue","size","placeholder","onKeyup"])]),_:1},8,["label","label-options","field","onFieldChange","label-width","input-width","direction"])}const U=b(tt,[["render",ot],["__scopeId","data-v-1a69f415"]]),{t:C}=S(),at=!1,st=!0,rt="modelValue",dt={name:"TmAdvancedDateFilter",components:{FormItemLayout:w},props:{value:{type:[Array,String,Date],default:()=>null},field:{type:[String,Number],default:""},start:{type:[String,Number],default:""},end:{type:[String,Number],default:""},size:{type:String,default:"mini"},labelOptions:{type:Array,default:()=>[]},label:{type:[String,Function,Object,Array],default:""},type:{type:String,default:"daterange",validator:e=>["date","daterange","datetime","datetimerange","year","month","dates","months","years","week","monthrange"].includes(e)},format:{type:String,default:""},startPlaceholder:{type:String,default:void 0},endPlaceholder:{type:String,default:void 0},placeholder:{type:String,default:void 0},rangeSeparator:{type:String,default:"-"},disabled:{type:Boolean,default:!1},clearable:{type:Boolean,default:!0},readonly:{type:Boolean,default:!1},editable:{type:Boolean,default:!0},align:{type:String,default:"left"},popperClass:{type:String,default:""},defaultValue:{type:[Date,Array],default:null},defaultTime:{type:[Date,String,Array],default:null},shortcuts:{type:Array,default:()=>[]},pastOnly:{type:Boolean,default:!1},labelWidth:{type:[String,Number],default:void 0},inputWidth:{type:[String,Number],default:void 0},direction:{type:String,default:void 0,validator:e=>!e||["horizontal","vertical"].includes(e)}},computed:{isRangeType(){return["daterange","datetimerange","monthrange"].includes(this.type)},computedStartPlaceholder(){if(this.isRangeType)return this.startPlaceholder!==void 0?this.startPlaceholder:C("startDate")},computedEndPlaceholder(){if(this.isRangeType)return this.endPlaceholder!==void 0?this.endPlaceholder:C("endDate")},computedFormat(){const e="YYYY";return this.format?this.format:this.type==="year"?e:this.type==="month"?`${e}-MM`:this.type==="date"?`${e}-MM-DD`:this.type==="dates"?`${e}-MM-DD`:this.type==="months"?`${e}-MM`:this.type==="years"?e:this.type==="week"?`${e}-MM-WW`:this.type==="datetime"?`${e}-MM-DD HH:mm:ss`:this.type==="datetimerange"?`${e}-MM-DD HH:mm:ss`:this.type==="daterange"?`${e}-MM-DD`:this.type==="monthrange"?`${e}-MM`:""},computedPickerOptions(){const e={};if(this.pastOnly&&(e.disabledDate=i=>i.getTime()>Date.now()),["daterange","datetimerange"].includes(this.type)){const i=this.type==="datetimerange";e.shortcuts=this.shortcuts.length>0?this.shortcuts:[{text:C("today"),onClick(l){const a=new Date,n=new Date;i&&(n.setHours(0,0,0,0),a.setHours(23,59,59,999)),l.$emit("pick",[n,a])}},{text:C("yesterday"),onClick(l){const a=new Date,n=new Date;n.setTime(n.getTime()-3600*1e3*24),a.setTime(a.getTime()-3600*1e3*24),i&&(n.setHours(0,0,0,0),a.setHours(23,59,59,999)),l.$emit("pick",[n,a])}},{text:C("last7days"),onClick(l){const a=new Date,n=new Date;n.setTime(n.getTime()-3600*1e3*24*7),i&&(n.setHours(0,0,0,0),a.setHours(23,59,59,999)),l.$emit("pick",[n,a])}},{text:C("last30days"),onClick(l){const a=new Date,n=new Date;n.setTime(n.getTime()-3600*1e3*24*30),i&&(n.setHours(0,0,0,0),a.setHours(23,59,59,999)),l.$emit("pick",[n,a])}},{text:C("thisMonth"),onClick(l){const a=new Date,n=new Date;n.setDate(1),i&&(n.setHours(0,0,0,0),a.setHours(23,59,59,999)),l.$emit("pick",[n,a])}},{text:C("lastMonth"),onClick(l){const a=new Date,n=new Date;n.setMonth(n.getMonth()-1),n.setDate(1),a.setDate(0),i&&(n.setHours(0,0,0,0),a.setHours(23,59,59,999)),l.$emit("pick",[n,a])}}]}return e},computedShortcuts(){if(!["daterange","datetimerange"].includes(this.type))return[];if(this.shortcuts&&this.shortcuts.length>0)return this.shortcuts;const e=this.type==="datetimerange";return[{text:C("today"),value:()=>{const i=new Date,l=new Date;return e&&(l.setHours(0,0,0,0),i.setHours(23,59,59,999)),[l,i]}},{text:C("yesterday"),value:()=>{const i=new Date,l=new Date;return l.setTime(l.getTime()-3600*1e3*24),i.setTime(i.getTime()-3600*1e3*24),e&&(l.setHours(0,0,0,0),i.setHours(23,59,59,999)),[l,i]}},{text:C("last7days"),value:()=>{const i=new Date,l=new Date;return l.setTime(l.getTime()-3600*1e3*24*7),e&&(l.setHours(0,0,0,0),i.setHours(23,59,59,999)),[l,i]}},{text:C("last30days"),value:()=>{const i=new Date,l=new Date;return l.setTime(l.getTime()-3600*1e3*24*30),e&&(l.setHours(0,0,0,0),i.setHours(23,59,59,999)),[l,i]}},{text:C("thisMonth"),value:()=>{const i=new Date,l=new Date;return l.setDate(1),e&&(l.setHours(0,0,0,0),i.setHours(23,59,59,999)),[l,i]}},{text:C("lastMonth"),value:()=>{const i=new Date,l=new Date;return l.setMonth(l.getMonth()-1),l.setDate(1),i.setDate(0),e&&(l.setHours(0,0,0,0),i.setHours(23,59,59,999)),[l,i]}}]},computedDisabledDate(){return this.pastOnly?e=>e.getTime()>Date.now():null},computedDefaultTime(){let e=this.defaultTime;if(this.type==="datetimerange"&&!this.defaultTime&&(e=["00:00:00","23:59:59"]),this.isVue2)return e;if(e){if(this.type==="datetimerange"&&Array.isArray(e))return e.map(i=>{if(typeof i=="string"){const l=new Date,[a,n,o]=i.split(":").map(Number);return new Date(l.getFullYear(),l.getMonth(),l.getDate(),a,n,o||0)}return i});if(this.type==="datetime"&&typeof e=="string"){const i=new Date,[l,a,n]=e.split(":").map(Number);return new Date(i.getFullYear(),i.getMonth(),i.getDate(),l,a,n||0)}return e}},dateValue(){return this.isRangeType?this.start||this.end?[this.start,this.end]:this.value:this.value}},data(){return{t:C,isVue2:at,isVue3:st,getDefaultSize:V,valueField:rt}},methods:{handleFieldChange(e){this.$emit("field-change",e)},handleDateChange(e){this.isRangeType?(this.$emit("value-change",e),e&&Array.isArray(e)&&e.length===2?(this.$emit("start-change",e),this.$emit("end-change",e)):(this.$emit("start-change",[]),this.$emit("end-change",[]))):this.$emit("value-change",e)},handleBlur(e){this.$emit("blur",e)},handleFocus(e){this.$emit("focus",e)}}};function ct(e,i,l,a,n,o){const r=t.resolveComponent("el-date-picker"),h=t.resolveComponent("FormItemLayout");return t.openBlock(),t.createBlock(h,{label:l.label,"label-options":l.labelOptions,field:l.field,onFieldChange:o.handleFieldChange,"label-width":l.labelWidth,"input-width":l.inputWidth,direction:l.direction},{default:t.withCtx(()=>[t.createVNode(r,{"model-value":o.dateValue,type:l.type,size:n.getDefaultSize(),"range-separator":l.rangeSeparator,"start-placeholder":o.computedStartPlaceholder,"end-placeholder":o.computedEndPlaceholder,placeholder:l.placeholder,shortcuts:o.computedShortcuts,"disabled-date":o.computedDisabledDate,class:"date-picker",format:o.computedFormat,"value-format":o.computedFormat,disabled:l.disabled,clearable:l.clearable,readonly:l.readonly,editable:l.editable,teleported:!1,"popper-class":l.popperClass,"default-value":l.defaultValue,"default-time":o.computedDefaultTime,"onUpdate:modelValue":o.handleDateChange,onChange:o.handleDateChange,onBlur:o.handleBlur,onFocus:o.handleFocus},null,8,["model-value","type","size","range-separator","start-placeholder","end-placeholder","placeholder","shortcuts","disabled-date","format","value-format","disabled","clearable","readonly","editable","popper-class","default-value","default-time","onUpdate:modelValue","onChange","onBlur","onFocus"])]),_:1},8,["label","label-options","field","onFieldChange","label-width","input-width","direction"])}const j=b(dt,[["render",ct],["__scopeId","data-v-6d9d8fa1"]]),ht=!1,ut={name:"TmCascaderFilter",components:{FormItemLayout:w},props:{value:{type:[String,Number,Array],default:""},options:{type:[Array,Function],default:()=>[]},label:{type:[String,Function,Object,Array],default:null},props:{type:Object,default:()=>({label:"label",value:"value",children:"children",expandTrigger:"hover"})},filterable:{type:Boolean,default:!0},clearable:{type:Boolean,default:!0},collapseTags:{type:Boolean,default:!0},collapseTagsTooltip:{type:Boolean,default:!0},placeholder:{type:String,default:""},labelWidth:{type:[String,Number],default:void 0},inputWidth:{type:[String,Number],default:void 0},direction:{type:String,default:void 0,validator:e=>!e||["horizontal","vertical"].includes(e)}},data(){return{isVue2:ht,getDefaultSize:V,selectedValue:this.value,optionsList:[],loading:!1}},computed:{propMap(){return{label:this.props.label||"label",value:this.props.value||"value",children:this.props.children||"children"}},cascaderProps(){return T(g({},this.props),{expandTrigger:this.props.expandTrigger||"hover"})}},watch:{value:{immediate:!0,handler(e){this.selectedValue=e}},options:{immediate:!0,handler(e){this.initOptions(e)}},selectedValue(e){this.$emit("input",e),this.$emit("change",e)}},methods:{async initOptions(e){if(typeof e=="function")try{this.loading=!0;const i=await e();Array.isArray(i)&&(this.optionsList=i)}catch(i){console.error(i)}finally{this.loading=!1}else Array.isArray(e)&&(this.optionsList=e)}}},mt={class:"cascader"};function pt(e,i,l,a,n,o){const r=t.resolveComponent("el-cascader"),h=t.resolveComponent("FormItemLayout");return t.openBlock(),t.createBlock(h,{label:l.label,"label-width":l.labelWidth,"input-width":l.inputWidth,direction:l.direction},{default:t.withCtx(()=>[t.createElementVNode("div",mt,[t.createVNode(r,t.mergeProps({ref:"cascader",modelValue:n.selectedValue,"onUpdate:modelValue":i[0]||(i[0]=c=>n.selectedValue=c)},T(g({},e.$attrs),{size:n.getDefaultSize(),filterable:l.filterable,clearable:l.clearable,collapseTags:l.collapseTags,collapseTagsTooltip:l.collapseTagsTooltip,props:o.cascaderProps,placeholder:l.placeholder,options:n.optionsList,loading:n.loading}),t.toHandlers(n.isVue2?e.$listeners:{})),{default:t.withCtx(({node:c,data:u})=>[t.renderSlot(e.$slots,"default",{node:c,data:u},()=>[t.createElementVNode("span",null,t.toDisplayString(u[o.propMap.label]),1)],!0)]),_:3},16,["modelValue"])])]),_:3},8,["label","label-width","input-width","direction"])}const J=b(ut,[["render",pt],["__scopeId","data-v-7cde104c"]]),ft=!1,gt=!0,bt={name:"TmRadioFilter",components:{FormItemLayout:w},props:{value:{type:[String,Number],default:""},options:{type:[Array,Function],default:()=>[]},props:{type:Object,default:()=>({label:"label",value:"value"})},size:{type:String,default:"mini"},width:{type:[String,Number],default:200},label:{type:[String,Function,Object,Array],default:null},labelWidth:{type:[String,Number],default:void 0},inputWidth:{type:[String,Number],default:void 0},direction:{type:String,default:void 0,validator:e=>!e||["horizontal","vertical"].includes(e)}},data(){return{isVue2:ft,isVue3:gt,getDefaultSize:V,selectedValue:this.value,optionsList:[],loading:!1}},computed:{propMap(){return{label:this.props.label||"label",value:this.props.value||"value"}}},watch:{value:{immediate:!0,handler(e){this.selectedValue=e}},options:{immediate:!0,handler(e){this.$slots.default||this.initOptions(e)}},selectedValue(e){this.$emit("input",e),this.$emit("change",e)}},methods:{async initOptions(e){if(typeof e=="function")try{this.loading=!0;const i=await e();Array.isArray(i)&&(this.optionsList=i)}catch(i){console.error(i)}finally{this.loading=!1}else Array.isArray(e)&&(this.optionsList=e)}}};function yt(e,i,l,a,n,o){const r=t.resolveComponent("el-radio-button"),h=t.resolveComponent("el-radio-group"),c=t.resolveComponent("FormItemLayout");return t.openBlock(),t.createBlock(c,{label:l.label,"label-width":l.labelWidth,"input-width":l.inputWidth,direction:l.direction},{default:t.withCtx(()=>[t.createVNode(h,t.mergeProps({ref:"radioGroup",modelValue:n.selectedValue,"onUpdate:modelValue":i[0]||(i[0]=u=>n.selectedValue=u)},T(g({},e.$attrs),{size:n.getDefaultSize()}),{class:"radio-group"},t.toHandlers(n.isVue2?e.$listeners:{})),{default:t.withCtx(()=>[e.$slots.default?t.renderSlot(e.$slots,"default",{key:0},void 0,!0):(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(n.optionsList,u=>(t.openBlock(),t.createBlock(r,t.mergeProps({ref_for:!0},{[n.isVue3?"value":"label"]:u[o.propMap.value],disabled:u.disabled},{style:{flex:"1"},key:u[o.propMap.value]}),{default:t.withCtx(()=>[t.renderSlot(e.$slots,"option",{item:u},()=>[t.createTextVNode(t.toDisplayString(u[o.propMap.label]),1)],!0)]),_:2},1040))),128))]),_:3},16,["modelValue"])]),_:3},8,["label","label-width","input-width","direction"])}const K=b(bt,[["render",yt],["__scopeId","data-v-44b00fff"]]),Ct=!1,_t=!0,Vt={name:"TmCheckboxFilter",components:{FormItemLayout:w},props:{value:{type:Array,default:()=>[]},options:{type:[Array,Function],default:()=>[]},props:{type:Object,default:()=>({label:"label",value:"value"})},size:{type:String,default:"mini"},label:{type:[String,Function,Object,Array],default:null},labelWidth:{type:[String,Number],default:void 0},inputWidth:{type:[String,Number],default:void 0},direction:{type:String,default:void 0,validator:e=>!e||["horizontal","vertical"].includes(e)}},data(){return{isVue2:Ct,isVue3:_t,getDefaultSize:V,selectedValue:this.value||[],optionsList:[],loading:!1}},computed:{propMap(){return{label:this.props.label||"label",value:this.props.value||"value"}}},watch:{value:{immediate:!0,handler(e){this.selectedValue=e||[]}},options:{immediate:!0,handler(e){this.$slots.default||this.initOptions(e)}},selectedValue(e){this.$emit("input",e),this.$emit("change",e)}},methods:{async initOptions(e){if(typeof e=="function")try{this.loading=!0;const i=await e();Array.isArray(i)&&(this.optionsList=i)}catch(i){console.error(i)}finally{this.loading=!1}else Array.isArray(e)&&(this.optionsList=e)}}},St={class:"checkbox-content"};function xt(e,i,l,a,n,o){const r=t.resolveComponent("el-checkbox-button"),h=t.resolveComponent("el-checkbox-group"),c=t.resolveComponent("FormItemLayout");return t.openBlock(),t.createBlock(c,{label:l.label,"label-width":l.labelWidth,"input-width":l.inputWidth,direction:l.direction},{default:t.withCtx(()=>[t.createElementVNode("div",St,[t.createVNode(h,t.mergeProps({ref:"checkboxGroup",modelValue:n.selectedValue,"onUpdate:modelValue":i[0]||(i[0]=u=>n.selectedValue=u)},T(g({},e.$attrs),{size:n.getDefaultSize()}),t.toHandlers(n.isVue2?e.$listeners:{})),{default:t.withCtx(()=>[e.$slots.default?t.renderSlot(e.$slots,"default",{key:0},void 0,!0):(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(n.optionsList,u=>(t.openBlock(),t.createBlock(r,t.mergeProps({key:u[o.propMap.value]},{ref_for:!0},{[n.isVue3?"value":"label"]:u[o.propMap.value],disabled:u.disabled},{style:{flex:"1"}}),{default:t.withCtx(()=>[t.renderSlot(e.$slots,"option",{item:u},()=>[t.createTextVNode(t.toDisplayString(u[o.propMap.label]),1)],!0)]),_:2},1040))),128))]),_:3},16,["modelValue"])])]),_:3},8,["label","label-width","input-width","direction"])}const Q=b(Vt,[["render",xt],["__scopeId","data-v-d9e8a314"]]),kt=!1,wt={name:"TmSwitchFilter",components:{FormItemLayout:w},props:{value:{type:Boolean,default:!1},label:{type:[String,Function,Object,Array],default:""},labelWidth:{type:[String,Number],default:void 0},inputWidth:{type:[String,Number],default:void 0},direction:{type:String,default:void 0,validator:e=>!e||["horizontal","vertical"].includes(e)}},data(){return{isVue2:kt,getDefaultSize:V,switchValue:this.value}},watch:{value:{immediate:!0,handler(e){this.switchValue=e}},switchValue(e){this.$emit("input",e),this.$emit("change",e)}}},Tt={class:"switch-content"};function Ft(e,i,l,a,n,o){const r=t.resolveComponent("el-switch"),h=t.resolveComponent("FormItemLayout");return t.openBlock(),t.createBlock(h,{label:l.label,"label-width":l.labelWidth,"input-width":l.inputWidth,direction:l.direction},{default:t.withCtx(()=>[t.createElementVNode("div",Tt,[t.createVNode(r,t.mergeProps({ref:"switch",modelValue:n.switchValue,"onUpdate:modelValue":i[0]||(i[0]=c=>n.switchValue=c)},e.$attrs,t.toHandlers(n.isVue2?e.$listeners:{}),{size:n.getDefaultSize()}),null,16,["modelValue","size"])])]),_:1},8,["label","label-width","input-width","direction"])}const q=b(wt,[["render",Ft],["__scopeId","data-v-9f2a4d09"]]),zt=!1,Lt=!0,de="modelValue",Y="update:modelValue",Bt={name:"TmTextareaFilter",components:{FormItemLayout:w,CircleClose:y.CircleClose},props:{label:{type:[String,Function,Object,Array],default:""},[de]:{type:String,default:""},field:{type:[String,Number],default:""},placeholder:{type:String,default:""},labelOptions:{type:Array,default:()=>[]},rows:{type:Number,default:2},autosize:{type:[Boolean,Object],default:()=>({minRows:1,maxRows:10})},maxlength:{type:[String,Number],default:""},minlength:{type:[String,Number],default:""},showWordLimit:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},resize:{type:String,default:"vertical",validator:e=>["none","both","horizontal","vertical"].includes(e)},tabindex:{type:[String,Number],default:""},validateEvent:{type:Boolean,default:!0},clearable:{type:Boolean,default:!0},labelWidth:{type:[String,Number],default:void 0},inputWidth:{type:[String,Number],default:void 0},direction:{type:String,default:void 0,validator:e=>!e||["horizontal","vertical"].includes(e)}},data(){return{isVue2:zt,isVue3:Lt,getDefaultSize:V,inputValue:this.value}},computed:{selectedOption(){return!this.labelOptions||!this.labelOptions.length||!this.field?null:this.labelOptions.find(e=>e.value===this.field)}},watch:{[de]:{immediate:!0,handler(e){this.inputValue=e}},inputValue(e){this.$emit(Y,e)}},methods:{handleInput(e){this.inputValue=e,this.$emit(Y,e)},handleChange(e){this.$emit("change",e)},handleFocus(e){this.$emit("focus",e)},handleBlur(e){this.$emit("blur",e)},handleClear(){this.inputValue="",this.$emit(Y,""),this.$emit("clear")},handleFieldChange(e){this.$emit("field-change",e)},focus(){this.$refs.textarea.focus()},blur(){this.$refs.textarea.blur()},select(){this.$refs.textarea.select()}}},Nt={class:"textarea"};function Ot(e,i,l,a,n,o){const r=t.resolveComponent("el-input"),h=t.resolveComponent("CircleClose"),c=t.resolveComponent("el-icon"),u=t.resolveComponent("FormItemLayout");return t.openBlock(),t.createBlock(u,{label:l.label,"label-options":l.labelOptions,field:l.field,onFieldChange:o.handleFieldChange,"label-width":l.labelWidth,"input-width":l.inputWidth,direction:l.direction},{default:t.withCtx(()=>[t.createElementVNode("div",Nt,[t.createVNode(r,t.mergeProps({ref:"textarea",modelValue:n.inputValue,"onUpdate:modelValue":i[0]||(i[0]=p=>n.inputValue=p),size:n.getDefaultSize(),placeholder:l.placeholder,type:"textarea",rows:l.rows,autosize:l.autosize,maxlength:l.maxlength,minlength:l.minlength,"show-word-limit":l.showWordLimit,readonly:l.readonly,disabled:l.disabled,resize:l.resize,tabindex:l.tabindex,"validate-event":l.validateEvent},e.$attrs,t.toHandlers(n.isVue2?e.$listeners:{}),{onInput:o.handleInput,onChange:o.handleChange,onFocus:o.handleFocus,onBlur:o.handleBlur,onClear:o.handleClear,class:"textarea-input"}),null,16,["modelValue","size","placeholder","rows","autosize","maxlength","minlength","show-word-limit","readonly","disabled","resize","tabindex","validate-event","onInput","onChange","onFocus","onBlur","onClear"]),l.clearable&&n.inputValue?(t.openBlock(),t.createBlock(c,{key:0,class:"textarea-clear-icon",onClick:o.handleClear},{default:t.withCtx(()=>[t.createVNode(h)]),_:1},8,["onClick"])):t.createCommentVNode("",!0)])]),_:1},8,["label","label-options","field","onFieldChange","label-width","input-width","direction"])}const Et=b(Bt,[["render",Ot],["__scopeId","data-v-dc5026ed"]]),Dt={name:"DynamicSlot",props:{name:{type:String,required:!0},slotProps:{type:Object,default:()=>({})}},render(e){var n;const i=o=>{var r;return o?(r=o.$slots)==null?void 0:r[this.name]:null},l=o=>{var r,h,c,u;return o?((h=(r=o.$)==null?void 0:r.type)==null?void 0:h.name)==="TmTable"||((u=(c=o.$)==null?void 0:c.type)==null?void 0:u.__name)==="TmTable":!1};let a=i(this.$parent);if(!a){let o=(n=this.$parent)==null?void 0:n.$parent;for(;o&&!a;){if(l(o)){a=i(o);break}o=o.$parent}}return a?typeof a=="function"?a(this.slotProps):a:null}},{t:At}=S(),Mt=!1,Ht=!0,Rt=["date","daterange","datetime","datetimerange","year","month","dates","months","years","week","monthrange"],It={name:"TmTableSearch",components:{TmSelect:v,TmAdvancedInput:U,TmAdvancedDate:j,TmCascader:J,TmRadio:K,TmCheckbox:Q,TmSwitch:q,TmTextarea:Et,DynamicSlot:Dt},props:{disabled:{type:Boolean,default:!1},searchColumns:{type:Array,default:null},searchForm:{type:Object,default:()=>({})},labelWidth:{type:[String,Number],default:void 0},inputWidth:{type:[String,Number],default:void 0},direction:{type:String,default:void 0,validator:e=>!e||["horizontal","vertical"].includes(e)}},data(){return{t:At,isVue2:Mt,isVue3:Ht,getCompatSize:B,getDefaultSize:V,DATE_TYPES:Rt,defaultValues:{}}},computed:{computedSearchForm:{get(){return this.searchForm},set(e){this.$emit("update:search-form",e)}},getLayoutProps(){return e=>{const i={};return e.labelWidth!==void 0?i.labelWidth=e.labelWidth:this.labelWidth!==void 0&&(i.labelWidth=this.labelWidth),e.inputWidth!==void 0?i.inputWidth=e.inputWidth:this.inputWidth!==void 0&&(i.inputWidth=this.inputWidth),e.direction!==void 0?i.direction=e.direction:this.direction!==void 0&&(i.direction=this.direction),i}}},mounted(){this.initDefaultValues()},methods:{isDateType(e){return this.DATE_TYPES.includes(e)},hasDefaultSlot(){const e=this.$slots.default;return e?this.isVue2?!!e:e()[0].children.length>0:!1},handleUpdate(e,i,l){const a=this.getFieldValue(e,l);a&&this.$emit("update:search-form",T(g({},this.computedSearchForm),{[a]:i}))},handleUpdateDate(e,i){const l=i||[],a=this.getFieldValue(e,"start"),n=this.getFieldValue(e,"end"),o=this.getFieldValue(e,"value"),r={};a&&(r[a]=l[0]),n&&(r[n]=l[1]),o&&(r[o]=l),this.$emit("update:search-form",g(g({},this.computedSearchForm),r))},getFieldValue(e,i){if(typeof e=="string")return e;if(e.fields&&i in e.fields){const l=e.fields[i];if(typeof l=="string")return l;if(Array.isArray(l))return l[0];if(l&&typeof l=="object")return l.name}},getFieldDefault(e,i){if(e.fields&&i in e.fields){const l=e.fields[i];if(Array.isArray(l)&&l.length>1)return l[1];if(l&&typeof l=="object"&&"default"in l)return l.default}},hasSearchSlot(e){const i="$slots";if(this[i][e])return!0;let a=this.$parent;for(;a;){const n=a[i];if(a.$options.name==="TmTable"&&(n!=null&&n[e]))return!0;a=a.$parent}return!1},initDefaultValues(){if(!this.searchColumns||!this.searchColumns.length)return;const e={};this.searchColumns.forEach(i=>{if(typeof i=="string"||!i.fields)return;const l=this.getFieldValue(i,"value"),a=this.getFieldValue(i,"label");if(i.type==="input"&&i.labelOptions&&i.labelOptions.length>0){const o=i.labelOptions[0];if(a)if(a in this.computedSearchForm)e[a]=this.computedSearchForm[a];else{const r=this.getFieldDefault(i,"label");r!==void 0?e[a]=r:o&&o.value!==void 0&&(e[a]=o.value)}l&&!(l in this.computedSearchForm)&&(e[l]="")}else if(this.isDateType(i.type)&&i.labelOptions&&i.labelOptions.length>0){const o=i.labelOptions[0];if(l&&!(l in this.computedSearchForm)&&(e[l]=[]),a)if(a in this.computedSearchForm)e[a]=this.computedSearchForm[a];else{const r=this.getFieldDefault(i,"label");r!==void 0?e[a]=r:o&&o.value!==void 0&&(e[a]=o.value)}}else if(i.type==="select"&&i.labelOptions&&i.labelOptions.length>0){const o=i.labelOptions[0];if(l&&!(l in this.computedSearchForm)&&(e[l]=i.multiple?[]:""),a)if(a in this.computedSearchForm)e[a]=this.computedSearchForm[a];else{const r=this.getFieldDefault(i,"label");r!==void 0?e[a]=r:o&&o.value!==void 0&&(e[a]=o.value)}}const n=this.getFieldDefault(i,"value");if(l&&n!==void 0&&!(l in this.computedSearchForm)?this.isDateType(i.type)&&!Array.isArray(n)?e[l]=[]:i.type==="checkbox"&&!Array.isArray(n)?e[l]=n?[n]:[]:i.type==="switch"&&typeof n!="boolean"?e[l]=!!n:e[l]=n:l&&!(l in this.computedSearchForm)&&(i.type==="checkbox"?e[l]=[]:i.type==="switch"&&(e[l]=!1)),this.isDateType(i.type)){const o=this.getFieldValue(i,"start"),r=this.getFieldValue(i,"end"),h=this.getFieldDefault(i,"start"),c=this.getFieldDefault(i,"end");o&&h!==void 0&&!(o in this.computedSearchForm)&&(e[o]=h),r&&c!==void 0&&!(r in this.computedSearchForm)&&(e[r]=c)}}),this.defaultValues=e,this.$emit("update:search-form",g(g({},e),this.computedSearchForm))},getSearchForm(){return this.computedSearchForm},handleSearch(){setTimeout(()=>{this.$emit("search",this.computedSearchForm)})},handleReset(){this.$emit("update:search-form",g({},this.defaultValues)),this.$emit("reset")}}},Pt={class:"search-content"},Wt={class:"search-actions"};function vt(e,i,l,a,n,o){const r=t.resolveComponent("dynamic-slot"),h=t.resolveComponent("tm-advanced-input"),c=t.resolveComponent("tm-advanced-date"),u=t.resolveComponent("tm-select"),p=t.resolveComponent("tm-cascader"),_=t.resolveComponent("tm-radio"),k=t.resolveComponent("tm-checkbox"),O=t.resolveComponent("tm-switch"),E=t.resolveComponent("tm-textarea"),F=t.resolveComponent("el-button");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["table-search",`table-search--${n.isVue2?"v2":"v3"}`])},[t.createElementVNode("div",Pt,[o.hasDefaultSlot()?t.renderSlot(e.$slots,"default",{key:0},void 0,!0):l.searchColumns&&l.searchColumns.length?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(l.searchColumns,(s,z)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[typeof s=="string"?(t.openBlock(),t.createElementBlock("div",{key:`str-${s}-${z}`,class:"search-item"},[(t.openBlock(),t.createBlock(r,{name:`search-${s}`,"slot-props":{searchForm:l.searchForm},key:s},null,8,["name","slot-props"]))])):(t.openBlock(),t.createElementBlock("div",{key:`obj-${z}`,class:"search-item"},[s.fields?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[o.hasSearchSlot(`search-${o.getFieldValue(s,"value")}`)?(t.openBlock(),t.createBlock(r,{name:`search-${o.getFieldValue(s,"value")}`,"slot-props":{searchForm:l.searchForm,col:s},key:o.getFieldValue(s,"value")},null,8,["name","slot-props"])):(t.openBlock(),t.createElementBlock("div",{style:{display:"flex"},key:o.getFieldValue(s,"value")||`col-${z}`},[s.type==="input"?(t.openBlock(),t.createBlock(h,t.mergeProps({key:0,label:s.label,value:o.computedSearchForm[o.getFieldValue(s,"value")],field:o.computedSearchForm[o.getFieldValue(s,"label")],onValueChange:d=>o.handleUpdate(s,d,"value"),onFieldChange:d=>o.handleUpdate(s,d,"label"),multiple:s.multiple,labelOptions:s.labelOptions,placeholder:s.placeholder,onSearch:o.handleSearch},{ref_for:!0},o.getLayoutProps(s)),null,16,["label","value","field","onValueChange","onFieldChange","multiple","labelOptions","placeholder","onSearch"])):t.createCommentVNode("",!0),o.isDateType(s.type)?(t.openBlock(),t.createBlock(c,t.mergeProps({key:1,type:s.type,label:s.label,value:o.computedSearchForm[o.getFieldValue(s,"value")],field:o.computedSearchForm[o.getFieldValue(s,"label")],start:o.computedSearchForm[o.getFieldValue(s,"start")],end:o.computedSearchForm[o.getFieldValue(s,"end")],onFieldChange:d=>o.handleUpdate(s,d,"label"),onValueChange:d=>o.handleUpdateDate(s,d),onStartChange:d=>o.handleUpdateDate(s,d),onEndChange:d=>o.handleUpdateDate(s,d),labelOptions:s.labelOptions,"start-placeholder":s.startPlaceholder,"end-placeholder":s.endPlaceholder,placeholder:s.placeholder,"range-separator":s.rangeSeparator,disabled:s.disabled,clearable:s.clearable,readonly:s.readonly,editable:s.editable,align:s.align,"popper-class":s.popperClass,"default-value":s.defaultValue,"default-time":s.defaultTime,shortcuts:s.shortcuts,"past-only":s.pastOnly,format:s.format},{ref_for:!0},o.getLayoutProps(s)),null,16,["type","label","value","field","start","end","onFieldChange","onValueChange","onStartChange","onEndChange","labelOptions","start-placeholder","end-placeholder","placeholder","range-separator","disabled","clearable","readonly","editable","align","popper-class","default-value","default-time","shortcuts","past-only","format"])):t.createCommentVNode("",!0),s.type==="select"?(t.openBlock(),t.createBlock(u,t.mergeProps({key:2,label:s.label,modelValue:o.computedSearchForm[o.getFieldValue(s,"value")],"onUpdate:modelValue":d=>o.computedSearchForm[o.getFieldValue(s,"value")]=d,field:o.computedSearchForm[o.getFieldValue(s,"label")],options:s.options,labelOptions:s.labelOptions,placeholder:s.placeholder,multiple:s.multiple,"show-check-all":s.checkAll,"value-on-clear":s.valueOnClear,clearable:s.clearable,onFieldChange:d=>o.handleUpdate(s,d,"label")},{ref_for:!0},o.getLayoutProps(s)),null,16,["label","modelValue","onUpdate:modelValue","field","options","labelOptions","placeholder","multiple","show-check-all","value-on-clear","clearable","onFieldChange"])):t.createCommentVNode("",!0),s.type==="cascader"?(t.openBlock(),t.createBlock(p,t.mergeProps({key:3,modelValue:o.computedSearchForm[o.getFieldValue(s,"value")],"onUpdate:modelValue":d=>o.computedSearchForm[o.getFieldValue(s,"value")]=d,label:s.label,options:s.options,labelOptions:s.labelOptions,props:s.props,placeholder:s.placeholder,"show-check-all":s.checkAll},{ref_for:!0},o.getLayoutProps(s)),null,16,["modelValue","onUpdate:modelValue","label","options","labelOptions","props","placeholder","show-check-all"])):t.createCommentVNode("",!0),s.type==="radio"?(t.openBlock(),t.createBlock(_,t.mergeProps({key:4,modelValue:o.computedSearchForm[o.getFieldValue(s,"value")],"onUpdate:modelValue":d=>o.computedSearchForm[o.getFieldValue(s,"value")]=d,label:s.label,options:s.options,props:s.props},{ref_for:!0},o.getLayoutProps(s)),null,16,["modelValue","onUpdate:modelValue","label","options","props"])):t.createCommentVNode("",!0),s.type==="checkbox"?(t.openBlock(),t.createBlock(k,t.mergeProps({key:5,modelValue:o.computedSearchForm[o.getFieldValue(s,"value")],"onUpdate:modelValue":d=>o.computedSearchForm[o.getFieldValue(s,"value")]=d,label:s.label,options:s.options,props:s.props},{ref_for:!0},o.getLayoutProps(s)),null,16,["modelValue","onUpdate:modelValue","label","options","props"])):t.createCommentVNode("",!0),s.type==="switch"?(t.openBlock(),t.createBlock(O,t.mergeProps({key:6,modelValue:o.computedSearchForm[o.getFieldValue(s,"value")],"onUpdate:modelValue":d=>o.computedSearchForm[o.getFieldValue(s,"value")]=d,"active-text":s.activeText,"inactive-text":s.inactiveText,label:s.label,"active-color":s.activeColor,"inactive-color":s.inactiveColor},{ref_for:!0},o.getLayoutProps(s)),null,16,["modelValue","onUpdate:modelValue","active-text","inactive-text","label","active-color","inactive-color"])):t.createCommentVNode("",!0),s.type==="textarea"?(t.openBlock(),t.createBlock(E,t.mergeProps({key:7,modelValue:o.computedSearchForm[o.getFieldValue(s,"value")],"onUpdate:modelValue":d=>o.computedSearchForm[o.getFieldValue(s,"value")]=d,field:o.computedSearchForm[o.getFieldValue(s,"label")],label:s.label,labelOptions:s.labelOptions,placeholder:s.placeholder,rows:s.rows,autosize:s.autosize,maxlength:s.maxlength,minlength:s.minlength,"show-word-limit":s.showWordLimit,readonly:s.readonly,disabled:s.disabled,resize:s.resize,clearable:s.clearable,onFieldChange:d=>o.handleUpdate(s,d,"label")},{ref_for:!0},o.getLayoutProps(s)),null,16,["modelValue","onUpdate:modelValue","field","label","labelOptions","placeholder","rows","autosize","maxlength","minlength","show-word-limit","readonly","disabled","resize","clearable","onFieldChange"])):t.createCommentVNode("",!0)]))],64)):(t.openBlock(),t.createElementBlock("div",{key:`error-${z}`,class:"search-error-message"}," 缺少 fields 配置,无法渲染此组件 "))]))],64))),256)):t.createCommentVNode("",!0),t.createElementVNode("div",Wt,[t.createVNode(F,{type:"primary",size:n.getDefaultSize(),onClick:o.handleSearch},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.t("query")),1)]),_:1},8,["size","onClick"]),t.createVNode(F,{size:n.getDefaultSize(),onClick:o.handleReset},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.t("reset")),1)]),_:1},8,["size","onClick"])])])],2)}const G=b(It,[["render",vt],["__scopeId","data-v-4de92fdd"]]),Ut=!1,jt={name:"TablePagination",props:{current:{type:Number,default:1},small:{type:Boolean,default:!0},pageSize:{type:Number,default:20},total:{type:Number,default:0}},data(){return{isVue2:Ut,getCompatSize:B}},methods:{handleSizeChange(e){this.$emit("size-change",e)},handleCurrentChange(e){this.$emit("current-change",e)}}},Jt={class:"tm-pagination"};function Kt(e,i,l,a,n,o){const r=t.resolveComponent("el-pagination");return t.openBlock(),t.createElementBlock("div",Jt,[t.createVNode(r,t.mergeProps(e.$attrs,t.toHandlers(n.isVue2?e.$listeners:{}),{style:{"text-align":"right"},"current-page":l.current,"page-size":l.pageSize,total:l.total,"page-sizes":[10,20,50,100,300,500,1e3,2e3],size:n.getCompatSize("mini"),layout:"total, sizes, prev, pager, next, jumper",onSizeChange:o.handleSizeChange,"onUpdate:currentPage":i[0]||(i[0]=h=>e.$emit("update:current",h)),"onUpdate:pageSize":i[1]||(i[1]=h=>e.$emit("update:pageSize",h)),onCurrentChange:o.handleCurrentChange}),null,16,["current-page","page-size","total","size","onSizeChange","onCurrentChange"])])}const Qt=b(jt,[["render",Kt],["__scopeId","data-v-4dbdf6e7"]]),qt={name:"TmTableMenu",props:{size:{type:String,default:"mini"}}},Yt={size:"small",class:"tm-table-menu",inline:""},Gt={class:"left"},Xt={class:"right"};function Zt(e,i,l,a,n,o){return t.openBlock(),t.createElementBlock("div",Yt,[t.createElementVNode("div",Gt,[t.renderSlot(e.$slots,"left",{},void 0,!0)]),t.createElementVNode("div",Xt,[t.renderSlot(e.$slots,"right",{},void 0,!0)])])}const $t=b(qt,[["render",Zt],["__scopeId","data-v-579dd2c3"]]),R=e=>e?e.props||{}:{},X=(e,i)=>{e&&(e.props||(e.props={}),typeof i=="object"&&Object.assign(e.props,i))},I={getTableConfig(e){try{const i=localStorage.getItem(`tm-table-config-${e}`);return Promise.resolve({data:{code:200,data:i}})}catch(i){return Promise.reject(i)}},setTableConfig(e){try{return localStorage.setItem(`tm-table-config-${e.key}`,e.info),Promise.resolve({data:{code:200,message:"success"}})}catch(i){return Promise.reject(i)}}},el=e=>I.getTableConfig(e.key),tl=e=>I.setTableConfig(e),ll=e=>{e&&(typeof e.getTableConfig=="function"&&(I.getTableConfig=e.getTableConfig),typeof e.setTableConfig=="function"&&(I.setTableConfig=e.setTableConfig))},{t:il}=S(),nl=!1,ol=!0,al={formatter:(e,i,l,a)=>[void 0,null,""].includes(l)?"-":l},sl={name:"TmColumnConfig",components:{MoveIcon:ke,FixedLeftIcon:Te,FixedRightIcon:Fe,UploadIcon:ze,DownloadIcon:Le,DeleteIcon:Be,MenuIcon:Se,tmEllipsisText:N},props:{columns:{type:Array,default:()=>[]},tableKey:{type:String,default:"",required:!0},defaultColumns:{type:Array,default:()=>[]},maxFixedLeftQuantity:{type:[Number,String],default:void 0},maxFixedRightQuantity:{type:[Number,String],default:void 0},ignoredColumnConfigTypes:{type:Array,default:()=>["selection"]}},data(){return{t:il,isVue2:nl,isVue3:ol,getDefaultSize:V,getCompatSize:B,buttonType:{link:!0,type:"primary"},afterOpenDelay:{"show-after":300},popoverVisible:!1,keyWord:"",sortedTableColumns:[],tableColumns:[],defaultColumnsConfig:[],columnMap:{},processedColumns:[],placement:"bottom",isDraggingFrozen:!1,isDraggingFrozenRight:!1,sortable:null,isConfigLoaded:!1,columnsCopy:[]}},computed:{filteredSortedTableColumns(){return this.keyWord?this.sortedTableColumns.filter(e=>this.getColumnLabel(e.prop).includes(this.keyWord)):this.sortedTableColumns},showFixedLimitTips(){return this.maxFixedLeftQuantity!==void 0||this.maxFixedRightQuantity!==void 0},isThanMaxFrozen(){return this.maxFixedLeftQuantity===void 0?!1:this.sortedTableColumns.filter(e=>e.fixed==="left").length>=this.maxFixedLeftQuantity},isThanMaxRightFrozen(){return this.maxFixedRightQuantity===void 0?!1:this.sortedTableColumns.filter(e=>e.fixed==="right").length>=this.maxFixedRightQuantity},computedTableKey(){if(this.tableKey)return this.tableKey;if(this.$route&&this.$route.path)return this.$route.path.slice(1).replace(/\//g,"-");throw new Error("tableKey is required")}},watch:{popoverVisible(e){e||this.handlePopoverHide()},columns:{handler(e){e&&e.length>0&&!this.isConfigLoaded&&this.initializeColumnConfig()},immediate:!0},tableColumns:{handler(e){e!=null&&e.length&&(this.initSortedTableColumns(),this.crateSortable(),this.columnsCopy=JSON.parse(JSON.stringify(this.sortedTableColumns)))},deep:!0}},methods:{findLastIndex(e,i){for(let l=e.length-1;l>=0;l--)if(i(e[l],l,e))return l;return-1},getColumnLabel(e){return!e||!this.columnMap[e]?e||"":R(this.columnMap[e]).label||e},initializeColumnConfig(){this.defaultColumns&&this.defaultColumns.length>0?this.defaultColumnsConfig=this.defaultColumns:this.processOriginalColumns(),this.loadColumnConfig()},processOriginalColumns(){const e=this.columns||[];let i={};this.defaultColumnsConfig=e.filter(l=>{const a=R(l);return!(!a.prop||this.ignoredColumnConfigTypes.includes(a.type))}).map((l,a)=>{const n=R(l),o=g(g({},al),n);X(l,o),n.prop&&(i[n.prop]=l);const r=n.hasOwnProperty("visible")?n.visible!==!1:!0;return{prop:n.prop,fixed:n.fixed||"",sort:a,cancellable:n.hasOwnProperty("cancellable")?n.cancellable:!0,visible:r}}),this.columnMap=i},loadColumnConfig(){el({key:this.computedTableKey}).then(e=>{var l;if(e.data.code!==200)return;let i=JSON.parse(((l=e.data)==null?void 0:l.data)||null)||{};i.columnsConfig&&JSON.stringify(this.defaultColumnsConfig)===JSON.stringify(i.defaultColumnsConfig)?this.tableColumns=i.columnsConfig.map(a=>g({},a)):this.tableColumns=this.defaultColumnsConfig.map(a=>g({},a)),this.processedColumns=this.applyColumnConfig(this.tableColumns),this.isConfigLoaded=!0,this.$emit("complete",{columns:this.processedColumns,isInitialLoad:!0})}).catch(()=>{this.tableColumns=this.defaultColumnsConfig.map(e=>g({},e)),this.processedColumns=this.applyColumnConfig(this.tableColumns),this.isConfigLoaded=!0,this.$emit("complete",{columns:this.processedColumns,isInitialLoad:!0})})},applyColumnConfig(e,i=!1){let l=this.columns.filter(n=>{const o=R(n);return this.ignoredColumnConfigTypes.includes(o.type)}),a=[];return[...e].sort((n,o)=>{const r=n.sort!==void 0?n.sort:1/0,h=o.sort!==void 0?o.sort:1/0;return r-h}).forEach(n=>{if(n.prop){let o=this.columnMap[n.prop];o&&(X(o,{fixed:n.fixed||void 0,visible:n.visible}),(!i&&n.visible||i)&&a.push(o))}}),l.forEach(n=>{X(n,{visible:!0})}),[...l,...a]},crateSortable(){const e=this.$refs.sortListRef;if(!e)return;this.sortable&&(this.sortable.destroy(),this.sortable=null);const i=new f(e,{ghostClass:"blue-background-class",animation:150,easing:"cubic-bezier(1, 0, 0, 1)",handle:".row-title",draggable:".sort-item-wrapper",fallbackOnBody:!1,preventOnFilter:!0,removeCloneOnHide:!0,group:"columns",dragClass:"sortable-drag",onStart:({item:l})=>{const a=l.getAttribute("data-prop"),n=this.sortedTableColumns.find(o=>o.prop===a);this.isDraggingFrozen=n&&n.fixed==="left",this.isDraggingFrozenRight=n&&n.fixed==="right",this.draggedItemIndex=Array.from(e.children).indexOf(l),l.classList.add("sortable-drag")},onMove:l=>{const{target:a,related:n}=l;if(!a||!n)return!1;const o=n?n.getAttribute("data-prop"):null,r=o?this.sortedTableColumns.find(u=>u.prop===o):null,h=r&&r.fixed==="left",c=r&&r.fixed==="right";return this.isDraggingFrozen&&!h||this.isDraggingFrozenRight&&!c||!this.isDraggingFrozen&&!this.isDraggingFrozenRight&&(h||c)?(a.classList.add("no-drop-zone"),!1):(document.querySelectorAll(".no-drop-zone").forEach(u=>{u.classList.remove("no-drop-zone")}),!0)},onEnd:({item:l,newIndex:a,oldIndex:n})=>{if(a===void 0||n===void 0||a<0||n<0||a>=this.sortedTableColumns.length||n>=this.sortedTableColumns.length)return;document.querySelectorAll(".no-drop-zone").forEach(_=>{_.classList.remove("no-drop-zone")}),l.classList.remove("sortable-drag");const o=this.sortedTableColumns[n],r=o.fixed==="left",h=o.fixed==="right",c=a>0?this.sortedTableColumns[a-1]:null,u=a<this.sortedTableColumns.length-1?this.sortedTableColumns[a+1]:null;let p=!1;if(r?(c&&c.fixed!=="left"||u&&u.fixed==="right")&&(p=!0):h?(c&&c.fixed!=="right"||u&&u.fixed!=="right")&&(p=!0):(c&&c.fixed==="right"||u&&u.fixed==="left")&&(p=!0),p){this.rollbackSort();return}this.updateSortAfterDrag()}});this.sortable=i},rollbackSort(){this.sortedTableColumns=JSON.parse(JSON.stringify(this.columnsCopy))},updateSortAfterDrag(){const e=this.$refs.sortListRef;if(!e)return;Array.from(e.children||[]).filter(l=>l&&l.dataset&&l.dataset.prop).map(l=>l.dataset.prop).forEach((l,a)=>{this.sortedTableColumns.some(n=>n.prop===l?(n.sort=a,!0):!1)}),this.columnsCopy=JSON.parse(JSON.stringify(this.sortedTableColumns)),this.$emit("on-sort-change",this.sortedTableColumns)},init(){this.tableColumns=Array.isArray(this.tableColumns)?[...this.tableColumns]:Array.isArray(this.defaultColumnsConfig)?[...this.defaultColumnsConfig]:[],this.initSortedTableColumns()},initSortedTableColumns(){this.tableColumns.forEach((e,i)=>{e.sort===void 0&&(e.sort=i)}),this.sortedTableColumns=[...this.tableColumns].sort((e,i)=>e.fixed==="left"&&i.fixed!=="left"?-1:e.fixed!=="left"&&i.fixed==="left"||e.fixed==="right"&&i.fixed!=="right"?1:e.fixed!=="right"&&i.fixed==="right"?-1:e.sort-i.sort)},setPlacement(){const i=this.$refs.operationRef.$el.getBoundingClientRect();(window.innerHeight||document.documentElement.clientHeight)-(i.bottom-window.scrollY)>512?this.placement="bottom":this.placement="left"},handleVisibleChange(e){this.popoverVisible=e},handlePopoverShow(){this.setPlacement(),this.init(),(()=>{try{document.removeEventListener("mouseup",window.sortableGlobalMouseUp),document.removeEventListener("mousemove",window.sortableGlobalMouseMove)}catch(i){}})(),this.$nextTick(()=>{this.crateSortable()})},handlePopoverHide(){this.sortable&&(this.sortable.destroy(),this.sortable=null);try{document.removeEventListener("mouseup",window.sortableGlobalMouseUp),document.removeEventListener("mousemove",window.sortableGlobalMouseMove),typeof f!="undefined"&&f.utils&&(document.removeEventListener("mousemove",f.utils.throttleCall),document.removeEventListener("mouseup",f.utils.throttleCall))}catch(e){}},handleSelectAll(){const e=this.tableColumns.some(i=>!i.visible);this.tableColumns.forEach(i=>{i.cancellable&&(i.visible=e)})},handleRestoreDefault(){this.tableColumns=JSON.parse(JSON.stringify(this.defaultColumnsConfig)),this.sortedTableColumns=[...this.tableColumns].sort((e,i)=>e.sort-i.sort)},canMoveTop(e,i){if(i===0)return!1;if(e.fixed==="left"){const l=this.sortedTableColumns[i-1];return l&&l.fixed==="left"}if(!e.fixed){const l=this.sortedTableColumns[i-1];return l&&l.fixed==="left"?!1:l&&!l.fixed}return e.fixed==="right"},moveTop(e,i){const l=this.sortedTableColumns,a=e.prop;if(e.fixed==="right"&&(e.fixed=""),e.fixed==="left")l.unshift(l.splice(i,1)[0]);else{const n=this.findLastIndex(this.sortedTableColumns,o=>o.fixed==="left");l.splice(n+1,0,l.splice(i,1)[0])}this.updateSortValues(),this.columnsCopy=JSON.parse(JSON.stringify(this.sortedTableColumns)),this.$emit("on-sort-change",this.sortedTableColumns),this.$nextTick(()=>{const n=this.$refs.sortListRef;if(n){const o=Array.from(n.children).find(r=>r.dataset&&r.dataset.prop===a);o&&o.scrollIntoView({behavior:"smooth",block:"nearest"})}})},frozenLeftHandle(e){const i=this.sortedTableColumns,l=i.splice(e,1)[0];if(l.fixed=l.fixed==="left"?"":"left",l.fixed==="left"){const a=this.findLastIndex(this.sortedTableColumns,n=>n.fixed==="left");i.splice(a+1,0,l)}else{const a=this.findLastIndex(this.sortedTableColumns,n=>n.fixed==="left");i.splice(a+1,0,l)}this.updateSortValues(),this.columnsCopy=JSON.parse(JSON.stringify(this.sortedTableColumns)),this.$emit("on-sort-change",this.sortedTableColumns)},frozenRightHandle(e){const i=this.sortedTableColumns,l=i.splice(e,1)[0];if(l.fixed=l.fixed==="right"?"":"right",l.fixed==="right"){const a=i.findIndex(n=>n.fixed==="right");a===-1?i.push(l):i.splice(a,0,l)}else{const a=i.findIndex(n=>n.fixed==="right");a===-1?i.push(l):i.splice(a,0,l)}this.updateSortValues(),this.columnsCopy=JSON.parse(JSON.stringify(this.sortedTableColumns)),this.$emit("on-sort-change",this.sortedTableColumns)},onSave(){var i;this.updateSortValues();const e=(i=this.tableColumns)==null?void 0:i.map(l=>{const a=this.sortedTableColumns.find(h=>h.prop===l.prop);a&&(l.sort=a.sort,l.fixed=a.fixed,l.visible=a.visible);const r=l,{label:n}=r;return pe(r,["label"])});tl({key:this.computedTableKey,info:JSON.stringify({columnsConfig:e,defaultColumnsConfig:this.defaultColumnsConfig})}).then(l=>{l.data.code===200&&(this.processedColumns=this.applyColumnConfig(e,!0),this.$emit("complete",{columns:this.processedColumns,isInitialLoad:!1}),this.$message.success(this.t("saveSuccess")),this.popoverVisible=!1)})},updateSortValues(){this.sortedTableColumns.forEach((e,i)=>{e.sort=i})}},mounted(){var e;(e=this.tableColumns)!=null&&e.length&&(this.initSortedTableColumns(),this.crateSortable(),this.columnsCopy=JSON.parse(JSON.stringify(this.sortedTableColumns)))},beforeDestroy(){this.sortable&&(this.sortable.destroy(),this.sortable=null);try{document.removeEventListener("mouseup",window.sortableGlobalMouseUp),document.removeEventListener("mousemove",window.sortableGlobalMouseMove),typeof f!="undefined"&&f.utils&&(document.removeEventListener("mousemove",f.utils.throttleCall),document.removeEventListener("mouseup",f.utils.throttleCall))}catch(e){}}},rl={key:0,class:"container"},dl={class:"main-container"},cl={class:"left-content"},hl={class:"title"},ul={class:"option-list"},ml={style:{height:"100%","overflow-y":"auto"}},pl={class:"right-content"},fl={class:"search-box"},gl={key:0,class:"tips"},bl={class:"sort-list",ref:"sortListRef"},yl=["data-prop"],Cl={key:0,class:"sort-item"},_l={class:"row-title"},Vl={class:"operation-btns"},Sl={class:"footer"},xl={class:"footer-left"},kl={class:"footer-right"},wl={style:{display:"inline-block","margin-left":"10px"}};function Tl(e,i,l,a,n,o){const r=t.resolveComponent("el-button"),h=t.resolveComponent("TmEllipsisText"),c=t.resolveComponent("el-checkbox"),u=t.resolveComponent("el-input"),p=t.resolveComponent("MoveIcon"),_=t.resolveComponent("DeleteIcon"),k=t.resolveComponent("el-tooltip"),O=t.resolveComponent("UploadIcon"),E=t.resolveComponent("FixedLeftIcon"),F=t.resolveComponent("FixedRightIcon"),s=t.resolveComponent("MenuIcon"),z=t.resolveComponent("el-popover");return t.openBlock(),t.createBlock(z,t.mergeProps({"popper-class":"column-config-popover"},{[n.isVue3?"visible":"value"]:n.popoverVisible},t.toHandlers({[n.isVue3?"update:visible":"input"]:o.handleVisibleChange}),{width:680,"show-arrow":!1,placement:n.placement,trigger:"click",onShow:o.handlePopoverShow,onHide:o.handlePopoverHide}),{reference:t.withCtx(()=>[t.createElementVNode("div",wl,[t.createVNode(k,t.mergeProps({content:n.t("columnSetting")},n.afterOpenDelay,{placement:"top"}),{default:t.withCtx(()=>[t.createVNode(r,{size:n.getDefaultSize(),ref:"operationRef",circle:""},{default:t.withCtx(()=>[t.createVNode(s)]),_:1},8,["size"])]),_:1},16,["content"])])]),default:t.withCtx(()=>[n.popoverVisible?(t.openBlock(),t.createElementBlock("div",rl,[t.createElementVNode("div",dl,[t.createElementVNode("div",cl,[t.createElementVNode("div",hl,[t.createElementVNode("span",null,t.toDisplayString(n.t("SelectableFields"))+"("+t.toDisplayString(n.tableColumns.length)+")",1),t.createVNode(r,t.mergeProps({style:{"margin-left":"10px"}},n.buttonType,{onClick:o.handleSelectAll}),{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.t("all")),1)]),_:1},16,["onClick"])]),t.createElementVNode("div",ul,[t.createElementVNode("div",ml,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.tableColumns,(d,L)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[d.prop?(t.openBlock(),t.createElementBlock("div",{style:{width:"110px",display:"inline-block"},key:L+d.prop},[t.createVNode(c,{disabled:!d.cancellable,class:"el-checkbox",modelValue:d.visible,"onUpdate:modelValue":D=>d.visible=D,label:d.prop,value:d.prop},{default:t.withCtx(()=>[t.createVNode(h,{width:"80px",text:o.getColumnLabel(d.prop)},null,8,["text"])]),_:2},1032,["disabled","modelValue","onUpdate:modelValue","label","value"])])):t.createCommentVNode("",!0)],64))),256))])])]),t.createElementVNode("div",pl,[t.createElementVNode("div",fl,[t.createVNode(u,{size:n.getCompatSize("small"),class:"search-input",clearable:"",placeholder:n.t("search"),modelValue:n.keyWord,"onUpdate:modelValue":i[0]||(i[0]=d=>n.keyWord=d)},null,8,["size","placeholder","modelValue"])]),o.showFixedLimitTips?(t.openBlock(),t.createElementBlock("div",gl)):t.createCommentVNode("",!0),t.createElementVNode("div",bl,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.filteredSortedTableColumns,(d,L)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["sort-item-wrapper",[d.fixed==="left"?"frozen":"",d.fixed==="right"?"frozenRight":"",d.fixed?"":"noFrozen"]]),"data-prop":d.prop,key:d.prop},[d.visible?(t.openBlock(),t.createElementBlock("div",Cl,[t.createElementVNode("div",_l,[t.createVNode(p,{style:{"flex-shrink":"0"}}),t.createVNode(h,{text:o.getColumnLabel(d.prop)},null,8,["text"])]),t.createElementVNode("div",Vl,[d.cancellable?(t.openBlock(),t.createBlock(k,t.mergeProps({key:0,content:n.t("cancel"),placement:"top"},{ref_for:!0},n.afterOpenDelay),{default:t.withCtx(()=>[t.createVNode(r,t.mergeProps({ref_for:!0},n.buttonType,{size:n.getCompatSize("mini"),class:"iconfont-button delete-button",onClick:D=>d.visible=!1}),{default:t.withCtx(()=>[t.createVNode(_)]),_:2},1040,["size","onClick"])]),_:2},1040,["content"])):t.createCommentVNode("",!0),o.canMoveTop(d,L)?(t.openBlock(),t.createBlock(k,t.mergeProps({key:1,content:n.t("top"),placement:"top"},{ref_for:!0},n.afterOpenDelay),{default:t.withCtx(()=>[t.createVNode(r,t.mergeProps({ref_for:!0},n.buttonType,{size:n.getCompatSize("mini"),class:"iconfont-button top-button",onClick:D=>o.moveTop(d,L)}),{default:t.withCtx(()=>[t.createVNode(O)]),_:2},1040,["size","onClick"])]),_:2},1040,["content"])):t.createCommentVNode("",!0),d.fixed!=="right"?(t.openBlock(),t.createBlock(k,t.mergeProps({key:2,content:d.fixed==="left"?n.t("cancelLeftFixed"):n.t("leftFixed"),placement:"top"},{ref_for:!0},n.afterOpenDelay),{default:t.withCtx(()=>[t.createVNode(r,t.mergeProps({ref_for:!0},n.buttonType,{size:n.getCompatSize("mini"),class:["iconfont-button left-fixed-btn",{"active-fixed":d.fixed==="left"}],onClick:D=>o.frozenLeftHandle(L),disabled:d.fixed!=="left"&&o.isThanMaxFrozen}),{default:t.withCtx(()=>[t.createVNode(E)]),_:2},1040,["size","class","onClick","disabled"])]),_:2},1040,["content"])):t.createCommentVNode("",!0),d.fixed!=="left"?(t.openBlock(),t.createBlock(k,t.mergeProps({key:3,content:d.fixed==="right"?n.t("cancelRightFixed"):n.t("rightFixed"),placement:"top"},{ref_for:!0},n.afterOpenDelay),{default:t.withCtx(()=>[t.createVNode(r,t.mergeProps({ref_for:!0},n.buttonType,{size:n.getCompatSize("mini"),class:["iconfont-button right-fixed-btn",{"active-fixed":d.fixed==="right"}],onClick:D=>o.frozenRightHandle(L),disabled:d.fixed!=="right"&&o.isThanMaxRightFrozen}),{default:t.withCtx(()=>[t.createVNode(F)]),_:2},1040,["size","class","onClick","disabled"])]),_:2},1040,["content"])):t.createCommentVNode("",!0)])])):t.createCommentVNode("",!0)],10,yl))),128))],512)])]),t.createElementVNode("div",Sl,[t.createElementVNode("div",xl,[t.createVNode(r,{size:n.getCompatSize("mini"),onClick:o.handleRestoreDefault},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.t("restoreDefault")),1)]),_:1},8,["size","onClick"])]),t.createElementVNode("div",kl,[t.createVNode(r,{size:n.getCompatSize("mini"),onClick:i[1]||(i[1]=d=>n.popoverVisible=!1)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.t("cancel")),1)]),_:1},8,["size"]),t.createVNode(r,{size:n.getCompatSize("mini"),type:"primary",onClick:o.onSave},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.t("saveAndApply")),1)]),_:1},8,["size","onClick"])])])])):t.createCommentVNode("",!0)]),_:1},16,["placement","onShow","onHide"])}const Fl=b(sl,[["render",Tl],["__scopeId","data-v-127cbd33"]]),zl=!1,Ll=!0;function Z(e){if(!Array.isArray(e))return e;const i=[];for(const l of e)if(l)if(typeof l.type=="symbol"&&l.children){let a=l.children;if(typeof a=="function")continue;if(Array.isArray(a)){const n=Z(a);i.push(...n)}else{const n=Z([a]);i.push(...n)}}else i.push(l);return i}const Bl={name:"TmTable",components:{TableSearch:G,TablePagination:Qt,TableMenu:$t,ColumnConfig:Fl,RefreshIcon:xe,ColumnRenderer:{props:["vnode"],render(){return this.vnode}}},inheritAttrs:!1,props:{data:{type:[Array,Function],default:()=>[]},showSearch:{type:Boolean,default:!0},showMenu:{type:Boolean,default:!0},showPagination:{type:Boolean,default:!0},pagination:{type:Object,default:()=>({})},height:{type:[String,Number]},calcHeight:{type:Number,default:0},dataAdapter:{type:Function,default:null},columnSettingButton:{type:Boolean,default:!0},refreshButton:{type:Boolean,default:!0},tableKey:{type:String,default:""},firstLoad:{type:Boolean,default:!0},maxFixedLeftQuantity:{type:Number},maxFixedRightQuantity:{type:Number},border:{type:Boolean,default:!0},searchColumns:{type:Array,default:null},searchForm:{type:Object,default:()=>({})},labelWidth:{type:[String,Number],default:void 0},inputWidth:{type:[String,Number],default:void 0},direction:{type:String,default:void 0,validator:e=>!e||["horizontal","vertical"].includes(e)}},data(){return{getDefaultSize:V,getCompatSize:B,isVue3:Ll,isVue2:zl,t:S().t,tableData:[],tableLoading:!1,columnsLoading:!1,tableReload:1,tableHeight:null,selectedRows:[],paginationInfo:{current:1,pageSize:20,total:void 0},originalColumns:[],displayColumns:[],isColumnConfigLoaded:!1,afterOpenDelay:{"show-after":300}}},computed:{pageLoading(){return this.tableLoading||this.columnsLoading},computedTableKey(){if(this.tableKey)return this.tableKey;if(this.$route&&this.$route.path)return this.$route.path.slice(1).replace(/\//g,"-");throw new Error("tableKey is required")},computedShowPagination(){return this.showPagination&&typeof this.data=="function"}},watch:{data:{immediate:!0,handler(e){typeof e=="function"?!this.columnSettingButton||this.isColumnConfigLoaded&&!this.firstLoad?this.loadData():Array.isArray(e)&&(this.tableData=e):this.tableData=e}},height:{immediate:!0,handler(){this.getTableHeight()}}},created(){{const e=this.$slots.default();this.originalColumns=Z(e)}this.columnSettingButton?this.columnsLoading=!0:(this.displayColumns=this.originalColumns,this.isColumnConfigLoaded=!0)},mounted(){this.getTableHeight(),window.addEventListener("resize",this.getTableHeight)},beforeDestroy(){window.removeEventListener("resize",this.getTableHeight)},methods:{handleUpdateSearchForm(e){this.$emit("update:search-form",e)},handleColumnConfigComplete(e){Array.isArray(e.columns)?this.displayColumns=[...e.columns]:this.displayColumns=[...this.originalColumns],e.isInitialLoad?(this.isColumnConfigLoaded=!0,this.columnsLoading=!1,this.firstLoad&&typeof this.data=="function"&&this.loadData()):this.reloadTable()},isAutoHeight(){return this.height==="auto"},handleRefresh(){this.loadData()},async loadData(){if(Array.isArray(this.data))this.tableData=this.data;else if(typeof this.data=="function"){if(this.tableLoading)return;this.tableLoading=!0;try{const e=await this.data({paginationInfo:{pageSize:this.paginationInfo.pageSize,current:this.paginationInfo.current},params:this.searchForm}),{list:i,total:l,pageSize:a,current:n}=e;this.tableData=i;let o=g({},this.paginationInfo);l!==void 0&&(o.total=l),n!==void 0&&(o.current=n),a!==void 0&&(o.pageSize=a),this.paginationInfo=o}catch(e){}finally{this.tableLoading=!1}}},getTableHeight(){this.isAutoHeight()?this.$nextTick(()=>{const e=this.$refs.table,i=this.$refs.tmPagination;if(!e)return;const l=e.$el,a=i&&i.$el&&i.$el.offsetHeight||0;this.tableHeight=document.documentElement.clientHeight-l.offsetTop-a-this.calcHeight}):this.tableHeight=this.height,this.refreshTable()},search(){this.paginationInfo.current=1,this.loadData()},reset(){this.paginationInfo.current=1,this.$nextTick(()=>{this.loadData()})},handleSelectionChange(e){this.selectedRows=e,this.$emit("selection-change",e)},handleSizeChange(e){this.paginationInfo.pageSize=e,this.loadData(),this.$emit("size-change",e)},handleCurrentChange(e){this.paginationInfo.current=e,this.loadData(),this.$emit("current-change",e)},refreshTable(){this.$refs.table&&this.$refs.table.doLayout()},reloadTable(){this.tableReload++}}},Nl={class:"tm-table",ref:"tablePage"};function Ol(e,i,l,a,n,o){const r=t.resolveComponent("table-search"),h=t.resolveComponent("RefreshIcon"),c=t.resolveComponent("el-button"),u=t.resolveComponent("el-tooltip"),p=t.resolveComponent("ColumnConfig"),_=t.resolveComponent("table-menu"),k=t.resolveComponent("columnRenderer"),O=t.resolveComponent("el-table"),E=t.resolveComponent("table-pagination"),F=t.resolveDirective("loading");return t.openBlock(),t.createElementBlock("div",Nl,[l.searchColumns&&l.searchColumns.length>0?(t.openBlock(),t.createBlock(r,{key:0,ref:"search",onSearch:o.search,onReset:o.reset,"onUpdate:searchForm":o.handleUpdateSearchForm,disabled:o.pageLoading,"search-columns":l.searchColumns,"search-form":l.searchForm,"label-width":l.labelWidth,"input-width":l.inputWidth,direction:l.direction},{default:t.withCtx(()=>[t.renderSlot(e.$slots,"search",{},void 0,!0)]),_:3},8,["onSearch","onReset","onUpdate:searchForm","disabled","search-columns","search-form","label-width","input-width","direction"])):t.createCommentVNode("",!0),t.renderSlot(e.$slots,"between-search-menu",{},void 0,!0),l.showMenu?(t.openBlock(),t.createBlock(_,{key:1},{left:t.withCtx(()=>[t.renderSlot(e.$slots,"menu-left",{},void 0,!0)]),right:t.withCtx(()=>[t.renderSlot(e.$slots,"menu-right",{},void 0,!0),l.refreshButton&&typeof l.data=="function"?(t.openBlock(),t.createBlock(u,t.mergeProps({key:0,content:n.t("refresh"),placement:"top"},n.afterOpenDelay),{default:t.withCtx(()=>[t.createVNode(c,{onClick:o.handleRefresh,circle:"",size:n.getDefaultSize()},{default:t.withCtx(()=>[t.createVNode(h)]),_:1},8,["onClick","size"])]),_:1},16,["content"])):t.createCommentVNode("",!0),l.columnSettingButton?(t.openBlock(),t.createBlock(p,{key:1,maxFixedLeftQuantity:l.maxFixedLeftQuantity,maxFixedRightQuantity:l.maxFixedRightQuantity,tableKey:o.computedTableKey,columns:n.originalColumns,onComplete:o.handleColumnConfigComplete},null,8,["maxFixedLeftQuantity","maxFixedRightQuantity","tableKey","columns","onComplete"])):t.createCommentVNode("",!0)]),_:3})):t.createCommentVNode("",!0),t.renderSlot(e.$slots,"between-menu-table",{},void 0,!0),t.withDirectives((t.openBlock(),t.createBlock(O,t.mergeProps({ref:"table"},T(g({},e.$attrs),{border:l.border}),t.toHandlers(n.isVue2?e.$listeners:{}),{data:n.tableData,height:n.tableHeight,size:n.getCompatSize("mini"),onSelectionChange:o.handleSelectionChange,key:n.tableReload}),{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.displayColumns,s=>(t.openBlock(),t.createBlock(k,{vnode:s,key:n.isVue3?s.id:s.data.attrs.prop},null,8,["vnode"]))),128))]),_:1},16,["data","height","size","onSelectionChange"])),[[F,o.pageLoading]]),t.renderSlot(e.$slots,"between-table-pagination",{},void 0,!0),o.computedShowPagination?(t.openBlock(),t.createBlock(E,{key:2,ref:"tmPagination","page-size":n.paginationInfo.pageSize,current:n.paginationInfo.current,total:n.paginationInfo.total,disabled:n.tableLoading,onSizeChange:o.handleSizeChange,onCurrentChange:o.handleCurrentChange},null,8,["page-size","current","total","disabled","onSizeChange","onCurrentChange"])):t.createCommentVNode("",!0),t.renderSlot(e.$slots,"after-pagination",{},void 0,!0)],512)}const $=b(Bl,[["render",Ol],["__scopeId","data-v-5c3f3820"]]),El=!1,Dl=!0,Al={name:"TmTableColumn",inheritAttrs:!1,computed:{isVisible(){return this.$attrs.visible!==!1},slots(){return this.$slots}},data(){return{isVue2:El,isVue3:Dl}},created(){this.$parent&&this.$parent.$emit&&this.$parent.$emit("column-initialized",{prop:this.$attrs.prop,visible:this.$attrs.visible!==!1})}};function Ml(e,i,l,a,n,o){const r=t.resolveComponent("el-table-column");return o.isVisible?(t.openBlock(),t.createBlock(r,t.mergeProps({key:0},e.$attrs,t.toHandlers(n.isVue2?e.$listeners:{})),t.createSlots({_:2},[t.renderList(o.slots,(h,c)=>({name:c,fn:t.withCtx(u=>[t.renderSlot(e.$slots,c,t.normalizeProps(t.guardReactiveProps(u)))])}))]),1040)):t.createCommentVNode("",!0)}const ee=b(Al,[["render",Ml]]),{t:te}=S(),Hl={name:"TmAdvancedEllipsisText",components:{CopyIcon:ne},props:{rows:{type:Number,default:1},width:{type:String,default:"100%"},maxWidth:{type:String,default:""},showToolbar:{type:Boolean,default:!1},text:{type:String,default:""},showTooltip:{type:Boolean,default:!0},copyable:{type:Boolean,default:!1}},data(){return{isVue2:!1,originalText:"",isHovered:!1,lineHeight:0,containerWidth:0,resizeObserver:null,isCalculating:!1,frontLines:[],lastLineText:"",isLastLineEllipsis:!1,tableRowElement:null}},computed:{containerStyle(){const e={};return this.maxWidth?(e.maxWidth=this.maxWidth,e.width=this.width):e.width=this.width,e},hasToolbarSlot(){return this.$slots.toolbar?this.$slots.toolbar&&this.$slots.toolbar().length>0:!1},hasToolbarContent(){return this.copyable||this.hasToolbarSlot},shouldShowToolbar(){return this.showToolbar||this.isHovered&&this.hasToolbarContent}},mounted(){this.initComponent(),this.setupResizeObserver(),this.setupTableRowHover()},updated(){const e=this.getTextContent();e!==this.originalText&&(this.originalText=e,this.$nextTick(()=>{this.calculateLayout()}))},beforeDestroy(){this.cleanupResizeObserver(),this.cleanupTableRowHover()},beforeUnmount(){this.cleanupResizeObserver(),this.cleanupTableRowHover()},watch:{text:{handler(){this.$nextTick(()=>{this.originalText=this.getTextContent(),this.calculateLayout()})},immediate:!0},rows(){this.$nextTick(()=>{this.calculateLayout()})},shouldShowToolbar(){this.$nextTick(()=>{this.calculateLayout()})},"$slots.default":{handler(){this.$nextTick(()=>{this.originalText=this.getTextContent(),this.calculateLayout()})},deep:!0}},methods:{initComponent(){this.$nextTick(()=>{this.originalText=this.getTextContent(),this.calculateLineHeight(),this.$nextTick(()=>{this.calculateLayout()})})},handleCopy(){navigator.clipboard&&window.isSecureContext?navigator.clipboard.writeText(this.originalText).then(()=>{this.$message.success(te("copySuccess"))}).catch(()=>{this.fallbackCopy()}):this.fallbackCopy()},fallbackCopy(){const e=document.createElement("textarea");e.value=this.originalText,e.style.position="fixed",e.style.left="-999999px",e.style.top="-999999px",document.body.appendChild(e),e.focus(),e.select();try{document.execCommand("copy"),this.$message.success(te("copySuccess"))}catch(i){this.$message.error(te("copyFailed"))}document.body.removeChild(e)},getTextContent(){if(this.$slots.default){const e=this.$slots.default;return e().map(i=>typeof i.children=="string"?i.children:Array.isArray(i.children)?i.children.map(l=>l.children||"").join(""):"").join("")}return this.text||""},calculateLineHeight(){const e=this.$refs.containerRef;if(!e)return;const i=window.getComputedStyle(e);this.containerWidth=e.offsetWidth;const l=this.$refs.measureRef;if(l){this.setMeasureElementStyle(l,{width:this.containerWidth+"px",wordBreak:"break-all",whiteSpace:"normal"}),l.textContent="测",l.offsetHeight;const a=l.offsetHeight;l.innerHTML="",this.lineHeight=a}else{const a=i.lineHeight;if(a&&a!=="normal")this.lineHeight=parseInt(a);else{const n=parseInt(i.fontSize);this.lineHeight=n*1.2}}},calculateLayout(){if(!this.isCalculating){if(!this.originalText||this.rows<=0){this.frontLines=[],this.lastLineText=this.originalText||"",this.isLastLineEllipsis=!1;return}this.isCalculating=!0,this.$nextTick(()=>{requestAnimationFrame(()=>{this.performLayoutCalculation()})})}},performLayoutCalculation(){const e=this.originalText;if(this.rows===1)this.frontLines=[],this.lastLineText=e,this.isLastLineEllipsis=this.checkIfTextOverflows(e);else{const i=this.lineHeight;if(this.getTextHeight(e)<=i)this.frontLines=[],this.lastLineText=e,this.isLastLineEllipsis=this.checkIfTextOverflows(e);else{const a=this.lineHeight*(this.rows-1),n=this.findTextForHeight(e,a);this.frontLines=this.splitTextToLines(n);const o=e.substring(n.length);this.lastLineText=o,this.isLastLineEllipsis=o.length>0&&this.checkIfTextOverflows(o)}}this.isCalculating=!1},findTextForHeight(e,i){if(this.getTextHeight(e)<=i)return e;let l=0,a=e.length,n="";for(;l<=a;){const o=Math.floor((l+a)/2),r=e.substring(0,o);this.getTextHeight(r)<=i?(n=r,l=o+1):a=o-1}return n},splitTextToLines(e){if(!e)return[];const i=[];let l=e;for(;l.length>0;){const a=this.findTextForHeight(l,this.lineHeight);if(a.length===0)break;i.push(a),l=l.substring(a.length)}return i},checkIfTextOverflows(e){if(!e)return!1;const i=this.getTextWidth(e),l=this.shouldShowToolbar&&this.hasToolbarContent?this.getToolbarWidth():0,a=this.containerWidth-l-5;return i>a},getToolbarWidth(){let e=0;return this.copyable&&(e+=20),this.hasToolbarSlot&&(e+=40),e},getTextHeight(e){return this.measureText(e,{width:this.containerWidth+"px",wordBreak:"break-all",whiteSpace:"normal"})},getTextWidth(e){return this.measureText(e,{whiteSpace:"nowrap"})},measureText(e,i={}){if(!this.$refs.containerRef||!this.$refs.measureRef)return 0;const l=this.$refs.measureRef,a=l.style.cssText;this.setMeasureElementStyle(l,i),l.textContent=e,l.offsetHeight;const n=i.whiteSpace==="nowrap"?l.offsetWidth:l.offsetHeight;return l.style.cssText=a,l.innerHTML="",n},setMeasureElementStyle(e,i={}){const l=window.getComputedStyle(this.$refs.containerRef);e.style.cssText="",e.style.position="absolute",e.style.left="-9999px",e.style.top="-9999px",e.style.visibility="hidden",e.style.pointerEvents="none",e.style.zIndex="-1",e.style.fontSize=l.fontSize,e.style.fontFamily=l.fontFamily,e.style.fontWeight=l.fontWeight,e.style.lineHeight=l.lineHeight,e.style.letterSpacing=l.letterSpacing,e.style.wordSpacing=l.wordSpacing,e.style.padding="0",e.style.margin="0",e.style.border="none",e.style.boxSizing="border-box",Object.entries(i).forEach(([a,n])=>{e.style[a]=n})},handleMouseEnter(){this.isHovered=!0},handleMouseLeave(){this.isHovered=!1},setupResizeObserver(){typeof ResizeObserver!="undefined"&&(this.resizeObserver=new ResizeObserver(e=>{const i=e[0];if(i){const l=i.contentRect.width;Math.abs(l-this.containerWidth)>1&&requestAnimationFrame(()=>{this.calculateLineHeight(),this.calculateLayout()})}}),this.$refs.containerRef&&this.resizeObserver.observe(this.$refs.containerRef))},cleanupResizeObserver(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)},setupTableRowHover(){let e=this.$el;for(;e&&e!==document.body;){if(e.classList&&e.classList.contains("el-table__row")){this.tableRowElement=e;break}e=e.parentElement}this.tableRowElement&&(this.tableRowElement.addEventListener("mouseenter",this.handleMouseEnter),this.tableRowElement.addEventListener("mouseleave",this.handleMouseLeave))},cleanupTableRowHover(){this.tableRowElement&&(this.tableRowElement.removeEventListener("mouseenter",this.handleMouseEnter),this.tableRowElement.removeEventListener("mouseleave",this.handleMouseLeave),this.tableRowElement=null)}}},Rl={class:"tm-ellipsis-text-wrapper"},Il=["innerHTML"],Pl={class:"tm-ellipsis-last-line"},Wl=["innerHTML"],vl={key:0,class:"tm-ellipsis-toolbar-part"},Ul={key:1,class:"tm-ellipsis-text-wrapper"},jl=["innerHTML"],Jl={class:"tm-ellipsis-last-line"},Kl=["innerHTML"],Ql={key:0,class:"tm-ellipsis-toolbar-part"},ql={ref:"measureRef",class:"tm-ellipsis-measure"};function Yl(e,i,l,a,n,o){const r=t.resolveComponent("CopyIcon"),h=t.resolveComponent("el-tooltip");return t.openBlock(),t.createElementBlock("div",{ref:"containerRef",style:t.normalizeStyle(o.containerStyle),class:"tm-ellipsis-text",onMouseenter:i[0]||(i[0]=(...c)=>o.handleMouseEnter&&o.handleMouseEnter(...c)),onMouseleave:i[1]||(i[1]=(...c)=>o.handleMouseLeave&&o.handleMouseLeave(...c))},[l.showTooltip&&n.isLastLineEllipsis?(t.openBlock(),t.createBlock(h,t.mergeProps({key:0,content:n.originalText,disabled:!l.showTooltip||!n.isLastLineEllipsis},{[n.isVue2?"open-delay":"show-after"]:300},{placement:"top"}),{default:t.withCtx(()=>[t.createElementVNode("div",Rl,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.frontLines,(c,u)=>(t.openBlock(),t.createElementBlock("div",{key:"front-"+u,class:"tm-ellipsis-line",innerHTML:c},null,8,Il))),128)),t.createElementVNode("div",Pl,[t.createElementVNode("div",{class:"tm-ellipsis-text-part",innerHTML:n.lastLineText},null,8,Wl),o.shouldShowToolbar&&o.hasToolbarContent?(t.openBlock(),t.createElementBlock("div",vl,[l.copyable?(t.openBlock(),t.createBlock(r,{key:0,class:"icon-item",onClick:o.handleCopy},null,8,["onClick"])):t.createCommentVNode("",!0),t.renderSlot(e.$slots,"toolbar",{},void 0,!0)])):t.createCommentVNode("",!0)])])]),_:3},16,["content","disabled"])):(t.openBlock(),t.createElementBlock("div",Ul,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.frontLines,(c,u)=>(t.openBlock(),t.createElementBlock("div",{key:"front-"+u,class:"tm-ellipsis-line",innerHTML:c},null,8,jl))),128)),t.createElementVNode("div",Jl,[t.createElementVNode("div",{class:"tm-ellipsis-text-part",innerHTML:n.lastLineText},null,8,Kl),o.shouldShowToolbar&&o.hasToolbarContent?(t.openBlock(),t.createElementBlock("div",Ql,[l.copyable?(t.openBlock(),t.createBlock(r,{key:0,class:"icon-item",onClick:o.handleCopy},null,8,["onClick"])):t.createCommentVNode("",!0),t.renderSlot(e.$slots,"toolbar",{},void 0,!0)])):t.createCommentVNode("",!0)])])),t.createElementVNode("div",ql,null,512)],36)}const le=b(Hl,[["render",Yl],["__scopeId","data-v-14f27c2e"]]),ce={install:{install(e,i={}){[$,ee,N,le].forEach(l=>e.component(l.name,l)),i.tableConfigProvider&&ll(i.tableConfigProvider),i.lang&&M(i.lang||"zh-CN")}}.install,Table:$,Column:ee,Search:G,Select:v,AdvancedInput:U,AdvancedDate:j,Cascader:J,Radio:K,Checkbox:Q,Switch:q,EllipsisText:N,AdvancedEllipsisText:le,setLang:M,useLocale:S};typeof window!="undefined"&&window.Vue&&ce.install(window.Vue),m.AdvancedDate=j,m.AdvancedEllipsisText=le,m.AdvancedInput=U,m.Cascader=J,m.Checkbox=Q,m.Column=ee,m.EllipsisText=N,m.Radio=K,m.Search=G,m.Select=v,m.Switch=q,m.Table=$,m.default=ce,m.setLang=M,m.useLocale=S,Object.defineProperties(m,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,45 +1,45 @@
1
- {
2
- "name": "tm-table",
3
- "version": "1.1.14",
4
- "description": "A table component for Vue",
5
- "main": "dist/vue2/tm-table.umd.js",
6
- "module": "dist/vue2/tm-table.es.js",
7
- "types": "types/index.ts",
8
- "files": [
9
- "dist",
10
- "types"
11
- ],
12
- "scripts": {
13
- "build:vue2": "cd build/vue2 && vite build --config build.ts",
14
- "build:vue3": "cd build/vue3 && vite build --config build.ts",
15
- "build": "pnpm build:vue2 && pnpm build:vue3"
16
- },
17
- "exports": {
18
- ".": {
19
- "types": "./types/index.ts",
20
- "import": "./dist/vue2/tm-table.es.js",
21
- "require": "./dist/vue2/tm-table.umd.js",
22
- "default": "./dist/vue2/tm-table.umd.js"
23
- },
24
- "./v3": {
25
- "types": "./types/index.ts",
26
- "import": "./dist/vue3/tm-table.es.js",
27
- "require": "./dist/vue3/tm-table.umd.js",
28
- "default": "./dist/vue3/tm-table.umd.js"
29
- },
30
- "./style": "./dist/vue2/tm-table.css"
31
- },
32
- "dependencies": {
33
- "sortablejs": "^1.15.6"
34
- },
35
- "peerDependencies": {
36
- "vue": "^2.0.0 || >=3.0.0"
37
- },
38
- "publishConfig": {
39
- "access": "public"
40
- },
41
- "devDependencies": {
42
- "@types/node": "^22.17.0",
43
- "vite": "^7.0.6"
44
- }
1
+ {
2
+ "name": "tm-table",
3
+ "version": "1.2.1",
4
+ "description": "A table component for Vue",
5
+ "main": "dist/vue2/tm-table.umd.js",
6
+ "module": "dist/vue2/tm-table.es.js",
7
+ "types": "types/index.ts",
8
+ "files": [
9
+ "dist",
10
+ "types"
11
+ ],
12
+ "scripts": {
13
+ "build:vue2": "cd build/vue2 && npx cross-env VUE2=true VUE3=false vite build --config build.ts",
14
+ "build:vue3": "cd build/vue3 && npx cross-env VUE2=false VUE3=true vite build --config build.ts",
15
+ "build": "pnpm build:vue2 && pnpm build:vue3"
16
+ },
17
+ "exports": {
18
+ ".": {
19
+ "types": "./types/index.ts",
20
+ "import": "./dist/vue2/tm-table.es.js",
21
+ "require": "./dist/vue2/tm-table.umd.js",
22
+ "default": "./dist/vue2/tm-table.umd.js"
23
+ },
24
+ "./v3": {
25
+ "types": "./types/index.ts",
26
+ "import": "./dist/vue3/tm-table.es.js",
27
+ "require": "./dist/vue3/tm-table.umd.js",
28
+ "default": "./dist/vue3/tm-table.umd.js"
29
+ },
30
+ "./style": "./dist/vue2/tm-table.css"
31
+ },
32
+ "dependencies": {
33
+ "sortablejs": "^1.15.6"
34
+ },
35
+ "peerDependencies": {
36
+ "vue": "^2.0.0 || >=3.0.0"
37
+ },
38
+ "publishConfig": {
39
+ "access": "public"
40
+ },
41
+ "devDependencies": {
42
+ "@types/node": "^22.17.0",
43
+ "vite": "^7.0.6"
44
+ }
45
45
  }