tm-table 1.0.82 → 1.0.84

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(p,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("sortablejs")):typeof define=="function"&&define.amd?define(["exports","vue","sortablejs"],e):(p=typeof globalThis<"u"?globalThis:p||self,e(p.TmTable={},p.Vue,p.Sortable))})(this,function(p,e,k){"use strict";const Q={mini:"small",small:"small",default:"default",large:"large"},T=t=>Q[t]||Q.default,y=()=>"default",q={"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:"取消置顶"},"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"}};let B={value:"zh-CN"};B=e.ref("zh-CN");const G=t=>{var l;return((l=q[B.value])==null?void 0:l[t])||t},D=t=>{B.value=t},_=()=>({t:G,setLang:D,currentLang:B}),b=(t,l)=>{const n=t.__vccOpts||t;for(const[s,o]of l)n[s]=o;return n},v=!1,Y=!0,O="modelValue",X="update:modelValue",Z={name:"TmSelectFilter",props:{[O]:{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:""}},data(){return{t:_().t,isVue2:v,isVue3:Y,getDefaultSize:y,optionsList:[],loading:!1,indeterminate:!1,checkAll:!1,activedSelect:""}},computed:{computedValue:{get(){return this[O]},set(t){this.$emit(X,t),this.$emit("change",t)}},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:{[O](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 l=[];t&&(l=this.optionsList.map(n=>n[this.propMap.value])),this.computedValue=l},setActivedSelect(t){this.activedSelect=t}}},$={key:0,class:"check-all-option"};function ee(t,l,n,s,o,i){const r=e.resolveComponent("el-option"),m=e.resolveComponent("el-select"),d=e.resolveComponent("el-checkbox");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["advanced-select",{hasField:n.labelOptions&&n.labelOptions.length>0}])},[n.labelOptions&&n.labelOptions.length>0?(e.openBlock(),e.createBlock(m,{key:0,size:o.getDefaultSize(),class:e.normalizeClass(["field-select",`field-select--${o.isVue2?"v2":"v3"}`]),modelValue:i.fieldValue,"onUpdate:modelValue":l[0]||(l[0]=h=>i.fieldValue=h),onFocus:l[1]||(l[1]=h=>i.setActivedSelect("left")),style:e.normalizeStyle(`z-index:${o.activedSelect==="left"?2:0}`)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.labelOptions,h=>(e.openBlock(),e.createBlock(r,{key:h.value,label:h.label,value:h.value},null,8,["label","value"]))),128))]),_:1},8,["size","class","modelValue","style"])):e.createCommentVNode("",!0),e.createVNode(m,e.mergeProps({ref:"select",class:["select",`select--${o.isVue3?"v3":"v2"}`],onFocus:l[4]||(l[4]=h=>i.setActivedSelect("right")),style:`z-index:${o.activedSelect==="right"?2:0}`,modelValue:i.computedValue,"onUpdate:modelValue":l[5]||(l[5]=h=>i.computedValue=h)},{...t.$attrs,size:o.getDefaultSize(),filterable:n.filterable,clearable:n.clearable,collapseTags:n.collapseTags,multiple:n.multiple,placeholder:n.placeholder,loading:o.loading},e.toHandlers(o.isVue2?t.$listeners:{}),{loading:o.loading}),e.createSlots({default:e.withCtx(()=>[o.isVue2&&n.multiple&&n.showCheckAll?(e.openBlock(),e.createElementBlock("div",$,[e.createVNode(d,{style:{width:"100%"},modelValue:o.checkAll,"onUpdate:modelValue":l[2]||(l[2]=h=>o.checkAll=h),indeterminate:o.indeterminate,size:o.getDefaultSize(),onChange:i.handleCheckAll},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.t("all")),1)]),_:1},8,["modelValue","indeterminate","size","onChange"])])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"default",{},()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.optionsList,h=>(e.openBlock(),e.createBlock(r,{key:h[i.propMap.value],label:h[i.propMap.label],value:h[i.propMap.value],disabled:h.disabled},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"option",{item:h},()=>[e.createTextVNode(e.toDisplayString(h[i.propMap.label]),1)],!0)]),_:2},1032,["label","value","disabled"]))),128))],!0)]),_:2},[o.isVue3&&n.multiple&&n.showCheckAll?{name:"header",fn:e.withCtx(()=>[e.createVNode(d,{modelValue:o.checkAll,"onUpdate:modelValue":l[3]||(l[3]=h=>o.checkAll=h),indeterminate:o.indeterminate,size:o.getDefaultSize(),onChange:i.handleCheckAll,style:{width:"100%",height:"20px","padding-left":"10px"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.t("all")),1)]),_:1},8,["modelValue","indeterminate","size","onChange"])]),key:"0"}:void 0]),1040,["class","style","modelValue","loading"])],2)}const E=b(Z,[["render",ee],["__scopeId","data-v-062139ab"]]),te={name:"BaseIcon",props:{path:{type:String},size:{type:[String,Number]},color:{type:String}},methods:{handleClick(){}}},le=["width","height"],oe=["d"];function ne(t,l,n,s,o,i){return e.openBlock(),e.createElementBlock("i",{class:"tm-icon",onClick:l[0]||(l[0]=(...r)=>i.handleClick&&i.handleClick(...r))},[(e.openBlock(),e.createElementBlock("svg",{width:n.size,height:n.size,style:e.normalizeStyle({color:n.color}),viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},[e.createElementVNode("path",{d:n.path},null,8,oe)],12,le))])}const ie=b(te,[["render",ne],["__scopeId","data-v-1c30ca93"]]),C=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,[l,n])=>{const s=`${l}Icon`,o={name:s,props:{path:{type:String,default:n},size:{type:[String,Number]},color:{type:String}},render(i){return e.h(ie,this.$props)}};return o.install=i=>{i.component(s,o)},t[l]=o,t},{}),se=C.menu,ae=C.refresh,re=C.move;C["column-setting"];const ce=C.more,de=C["fixed-left"],he=C["fixed-right"],me=C.upload,pe=C.download,ue=C.delete,fe=C.copy,ge=!1,be=!0,Ce={name:"TmEllipsisText",components:{CopyIcon:fe},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:ge,isVue3:be,isOverflow:!1,currentLines:1}},computed:{tooltipDisabled(){return!this.showTooltip||!this.isOverflow},textStyle(){const t=typeof this.width=="number"?`${this.width}px`:this.width,l=typeof this.maxWidth=="number"?`${this.maxWidth}px`:this.maxWidth;return{width:t,maxWidth:l,lineHeight:this.lineHeight,display:"-webkit-inline-box",overflow:"hidden",WebkitBoxOrient:"vertical",WebkitLineClamp:this.lines}}},mounted(){this.checkOverflow()},watch:{text(){this.$nextTick(this.checkOverflow)}},methods:{checkOverflow(){const t=this.$refs.textEl;if(!t)return;const l=document.createElement("div"),n=getComputedStyle(t);l.style.position="absolute",l.style.visibility="hidden",l.style.left="-9999px",l.style.width=n.width,l.style.fontSize=n.fontSize,l.style.fontFamily=n.fontFamily,l.style.lineHeight=n.lineHeight,l.style.wordBreak="break-word",l.textContent=this.text,document.body.appendChild(l);const o=parseFloat(n.lineHeight)*this.lines;this.isOverflow=l.offsetHeight>o,document.body.removeChild(l),this.currentLines=n.height.slice(0,-2)/n.lineHeight.slice(0,-2)},handleCopy(){navigator.clipboard&&window.isSecureContext?navigator.clipboard.writeText(this.text).then(()=>{this.$message.success("复制成功")}).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("复制成功")}catch{this.$message.error("复制失败")}document.body.removeChild(t)}}},ye={class:"ellipsis-text-container"};function Ve(t,l,n,s,o,i){const r=e.resolveComponent("CopyIcon"),m=e.resolveComponent("el-tooltip");return e.openBlock(),e.createBlock(m,e.mergeProps({disabled:i.tooltipDisabled,content:n.text,effect:"dark",placement:"top"},{[o.isVue2?"open-delay":"show-after"]:300}),{default:e.withCtx(()=>[e.createElementVNode("div",ye,[e.createElementVNode("div",{ref:"textEl",class:"ellipsis-text",style:e.normalizeStyle(i.textStyle)},e.toDisplayString(n.text),5),e.createElementVNode("div",{class:e.normalizeClass(["toolbar",{multiline:o.currentLines>1&&n.lines>1}])},[n.copyable?(e.openBlock(),e.createBlock(r,{key:0,class:"icon-item",onClick:i.handleCopy},null,8,["onClick"])):e.createCommentVNode("",!0)],2)])]),_:1},16,["disabled","content"])}const N=b(Ce,[["render",Ve],["__scopeId","data-v-560ac879"]]),ke=!1,_e=!0,Se={name:"TmAdvancedInputFilter",components:{MoreIcon:ce,EllipsisText:N},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:_().t,isVue3:_e,isVue2:ke,getDefaultSize:y,getCompatSize:T,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:{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()}},xe={key:1,class:"input-label"},ze={class:"popover-content"},Fe={class:"popover-subtitle"},Te={class:"popover-footer"};function we(t,l,n,s,o,i){const r=e.resolveComponent("el-option"),m=e.resolveComponent("el-select"),d=e.resolveComponent("EllipsisText"),h=e.resolveComponent("el-input"),f=e.resolveComponent("el-button"),u=e.resolveComponent("MoreIcon"),x=e.resolveComponent("el-popover");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["tm-advanced-input",`tm-advanced-input--${o.isVue3?"v3":"v2"}`]),style:e.normalizeStyle({width:i.width})},[n.labelOptions&&n.labelOptions.length?(e.openBlock(),e.createBlock(m,{key:0,modelValue:i.fieldValue,"onUpdate:modelValue":l[0]||(l[0]=g=>i.fieldValue=g),placeholder:o.t("selectPlaceholder"),style:{width:"100px","flex-shrink":"0"},size:o.getDefaultSize(),class:"left-select",onChange:i.handlefieldChange},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.labelOptions,g=>(e.openBlock(),e.createBlock(r,{key:g.value,label:g.label,value:g.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","size","onChange"])):n.label?(e.openBlock(),e.createElementBlock("div",xe,[e.createVNode(d,{text:n.label,lines:2},null,8,["text"])])):e.createCommentVNode("",!0),e.createVNode(h,{modelValue:o.inputValue,"onUpdate:modelValue":l[3]||(l[3]=g=>o.inputValue=g),size:o.getDefaultSize(),placeholder:n.placeholder,onKeyup:e.withKeys(i.handleEnter,["enter","native"]),clearable:"",class:e.normalizeClass(["right-input",{"has-label":n.labelOptions&&n.labelOptions.length}])},e.createSlots({_:2},[i.shouldShowMultiple?{name:"append",fn:e.withCtx(()=>[e.createVNode(x,e.mergeProps({[o.isVue3?"visible":"value"]:o.isExactMode,placement:"bottom-end",width:240,trigger:"click"},e.toHandlers({[o.isVue3?"update:visible":"input"]:i.handleVisibleChange})),{reference:e.withCtx(()=>[e.createVNode(u,{style:{cursor:"pointer"}})]),default:e.withCtx(()=>[e.createElementVNode("div",ze,[e.createElementVNode("p",Fe,e.toDisplayString(o.t("accurateSearchTips")),1),e.createVNode(h,{size:o.getDefaultSize(),type:"textarea",rows:8,modelValue:o.exactValue,"onUpdate:modelValue":l[1]||(l[1]=g=>o.exactValue=g),placeholder:o.t("accurateSearchPlaceholder"),style:{"font-size":"12px"}},null,8,["size","modelValue","placeholder"]),e.createElementVNode("div",Te,[e.createVNode(f,{style:{float:"left"},size:o.getCompatSize("mini"),onClick:i.handleClear},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.t("clear")),1)]),_:1},8,["size","onClick"]),e.createVNode(f,{size:o.getCompatSize("mini"),onClick:l[2]||(l[2]=g=>o.isExactMode=!1)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.t("cancel")),1)]),_:1},8,["size"]),e.createVNode(f,{type:"primary",size:o.getCompatSize("mini"),onClick:i.handleExactSearch},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.t("search")),1)]),_:1},8,["size","onClick"])])])]),_:1},16)]),key:"0"}:void 0]),1032,["modelValue","size","placeholder","onKeyup","class"])],6)}const M=b(Se,[["render",we],["__scopeId","data-v-96a2075d"]]),{t:S}=_(),Be=!1,Ne=!0,Le={name:"TmAdvancedDateFilter",props:{value:{type:Array,default:()=>[]},field:{type:[String,Number],default:""},start:{type:[String,Number],default:""},end:{type:[String,Number],default:""},size:{type:String,default:"mini"},labelOptions:{type:Array,default:()=>[]},type:{type:String,default:"daterange"},format:{type:String,default:""},startPlaceholder:{type:String,default:void 0},endPlaceholder:{type:String,default:void 0},disabledDate:{type:Function,default:t=>t.getTime()>Date.now()}},computed:{computedFormat(){const t="YYYY",l="DD";return this.format?this.format:this.type==="year"?t:this.type==="month"?`${t}-MM`:this.type==="date"?`${t}-MM-${l}`:this.type==="dates"?`${t}-MM-${l}`:this.type==="months"?`${t}-MM`:this.type==="years"?t:this.type==="week"?`${t}-MM-WW`:this.type==="datetime"?`${t}-MM-${l} HH:mm:ss`:this.type==="datetimerange"?`${t}-MM-${l} HH:mm:ss`:this.type==="daterange"?`${t}-MM-${l}`:this.type==="monthrange"?`${t}-MM`:""},computedPickerOptions(){return{shortcuts:[{text:S("today"),onClick(t){const l=new Date,n=new Date;t.$emit("pick",[n,l])}},{text:S("yesterday"),onClick(t){const l=new Date,n=new Date;n.setTime(n.getTime()-3600*1e3*24),l.setTime(l.getTime()-3600*1e3*24),t.$emit("pick",[n,l])}},{text:S("last7days"),onClick(t){const l=new Date,n=new Date;n.setTime(n.getTime()-3600*1e3*24*7),t.$emit("pick",[n,l])}},{text:S("last30days"),onClick(t){const l=new Date,n=new Date;n.setTime(n.getTime()-3600*1e3*24*30),t.$emit("pick",[n,l])}},{text:S("thisMonth"),onClick(t){const l=new Date,n=new Date;n.setDate(1),t.$emit("pick",[n,l])}},{text:S("lastMonth"),onClick(t){const l=new Date,n=new Date;n.setMonth(n.getMonth()-1),n.setDate(1),l.setDate(0),t.$emit("pick",[n,l])}}]}},dateValue:{get(){return this.start||this.end?[this.start,this.end]:this.value},set(t){this.$emit("value-change",t),this.$emit("start-change",t),this.$emit("end-change",t)}},fieldValue:{get(){return this.field},set(t){this.$emit("field-change",t)}}},data(){return{t:S,isVue2:Be,isVue3:Ne,getDefaultSize:y}},watch:{labelOptions:{handler(t){t.length>0&&!this.field&&this.$emit("field-change",t[0].value)},deep:!0,immediate:!0}}};function De(t,l,n,s,o,i){const r=e.resolveComponent("el-option"),m=e.resolveComponent("el-select"),d=e.resolveComponent("el-date-picker");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["tm-date-picker",`tm-date-picker--${o.isVue3?"v3":"v2"}`])},[e.createVNode(m,{modelValue:i.fieldValue,"onUpdate:modelValue":l[0]||(l[0]=h=>i.fieldValue=h),size:o.getDefaultSize(),style:{width:"100px"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.labelOptions,h=>(e.openBlock(),e.createBlock(r,{key:h.value,label:h.label,value:h.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","size"]),e.createVNode(d,{modelValue:i.dateValue,"onUpdate:modelValue":l[1]||(l[1]=h=>i.dateValue=h),type:"daterange",size:o.getDefaultSize(),"range-separator":"-","start-placeholder":n.startPlaceholder===void 0?o.t("startDate"):n.startPlaceholder,"end-placeholder":n.endPlaceholder===void 0?o.t("endDate"):n.endPlaceholder,"picker-options":i.computedPickerOptions,style:{width:"206px"},format:i.computedFormat,"value-format":i.computedFormat},null,8,["modelValue","size","start-placeholder","end-placeholder","picker-options","format","value-format"])],2)}const A=b(Le,[["render",De],["__scopeId","data-v-3cd3ede3"]]),Oe=!1,Ee={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:Oe,getDefaultSize:y,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{...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 l=await t();Array.isArray(l)&&(this.optionsList=l)}catch(l){console.error(l)}finally{this.loading=!1}else Array.isArray(t)&&(this.optionsList=t)}}};function Me(t,l,n,s,o,i){const r=e.resolveComponent("el-cascader");return e.openBlock(),e.createBlock(r,e.mergeProps({ref:"cascader",class:["tm-cascader",`tm-cascader--${o.isVue2?"v2":"v3"}`],modelValue:o.selectedValue,"onUpdate:modelValue":l[0]||(l[0]=m=>o.selectedValue=m),style:{width:"200px"}},{...t.$attrs,size:o.getDefaultSize(),filterable:n.filterable,clearable:n.clearable,collapseTags:n.collapseTags,collapseTagsTooltip:n.collapseTagsTooltip,props:i.cascaderProps,placeholder:n.placeholder,options:o.optionsList,loading:o.loading},e.toHandlers(o.isVue2?t.$listeners:{})),{default:e.withCtx(({node:m,data:d})=>[e.renderSlot(t.$slots,"default",{node:m,data:d},()=>[e.createElementVNode("span",null,e.toDisplayString(d[i.propMap.label]),1)])]),_:3},16,["class","modelValue"])}const I=b(Ee,[["render",Me]]),Ae=!1,Ie=!0,Pe={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:Ae,isVue3:Ie,getDefaultSize:y,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 l=`${(this.hasWideOptions?305:200)/this.optionsList.length}px`;return{width:l,flex:`0 0 ${l}`}}},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 l=await t();Array.isArray(l)&&(this.optionsList=l)}catch(l){console.error(l)}finally{this.loading=!1}else Array.isArray(t)&&(this.optionsList=t)}}};function He(t,l,n,s,o,i){const r=e.resolveComponent("el-radio-button"),m=e.resolveComponent("el-radio-group");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["tm-radio",{"wide-mode":i.hasWideOptions,"tm-radio--v3":o.isVue3,"tm-radio--v2":o.isVue2}])},[e.createVNode(m,e.mergeProps({ref:"radioGroup",modelValue:o.selectedValue,"onUpdate:modelValue":l[0]||(l[0]=d=>o.selectedValue=d)},{...t.$attrs,size:o.getDefaultSize()},e.toHandlers(o.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(o.optionsList,d=>(e.openBlock(),e.createBlock(r,e.mergeProps({ref_for:!0},{[o.isVue3?"value":"label"]:d[i.propMap.value],disabled:d.disabled,style:i.calculateItemWidth},{key:d[i.propMap.value]}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"option",{item:d},()=>[e.createTextVNode(e.toDisplayString(d[i.propMap.label]),1)],!0)]),_:2},1040))),128))]),_:3},16,["modelValue"])],2)}const P=b(Pe,[["render",He],["__scopeId","data-v-61fed13d"]]),Re=!1,Ue=!0,We={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:Re,isVue3:Ue,getDefaultSize:y,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)),l=Math.ceil(this.optionsList.length/t),s=`${(this.hasWideOptions?305:200)/l}px`;return{width:s,flex:`0 0 ${s}`}}},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 l=await t();Array.isArray(l)&&(this.optionsList=l)}catch(l){console.error(l)}finally{this.loading=!1}else Array.isArray(t)&&(this.optionsList=t)}}};function je(t,l,n,s,o,i){const r=e.resolveComponent("el-checkbox-button"),m=e.resolveComponent("el-checkbox-group");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["tm-checkbox",{"wide-mode":i.hasWideOptions,"tm-checkbox--v3":o.isVue3,"tm-checkbox--v2":o.isVue2}])},[e.createVNode(m,e.mergeProps({ref:"checkboxGroup",modelValue:o.selectedValue,"onUpdate:modelValue":l[0]||(l[0]=d=>o.selectedValue=d)},{...t.$attrs,size:o.getDefaultSize()},e.toHandlers(o.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(o.optionsList,d=>(e.openBlock(),e.createBlock(r,e.mergeProps({key:d[i.propMap.value]},{ref_for:!0},{[o.isVue3?"value":"label"]:d[i.propMap.value],disabled:d.disabled,style:i.calculateItemWidth}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"option",{item:d},()=>[e.createTextVNode(e.toDisplayString(d[i.propMap.label]),1)],!0)]),_:2},1040))),128))]),_:3},16,["modelValue"])],2)}const H=b(We,[["render",je],["__scopeId","data-v-b44866b1"]]),Je=!1,Ke={name:"TmSwitchFilter",props:{value:{type:Boolean,default:!1},label:{type:String,default:""}},data(){return{isVue2:Je,getDefaultSize:y,switchValue:this.value}},computed:{containerWidthClass(){const t=i=>{if(!i)return 0;let r=0;for(let m=0;m<i.length;m++){const d=i.charAt(m);r+=/[\u4e00-\u9fa5]/.test(d)?2:1}return r},l=t(this.$attrs["active-text"]),n=t(this.$attrs["inactive-text"]),s=t(this.$attrs.label),o=l+n+s;return o>20?"wide-container":o>6?"medium-container":"narrow-container"}},watch:{value:{immediate:!0,handler(t){this.switchValue=t}},switchValue(t){this.$emit("input",t),this.$emit("change",t)}}},Qe={key:0,class:"switch-label"};function qe(t,l,n,s,o,i){const r=e.resolveComponent("el-switch");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["tm-switch",i.containerWidthClass])},[n.label?(e.openBlock(),e.createElementBlock("span",Qe,e.toDisplayString(n.label),1)):e.createCommentVNode("",!0),e.createVNode(r,e.mergeProps({ref:"switch",modelValue:o.switchValue,"onUpdate:modelValue":l[0]||(l[0]=m=>o.switchValue=m)},t.$attrs,e.toHandlers(o.isVue2?t.$listeners:{}),{size:o.getDefaultSize()}),null,16,["modelValue","size"])],2)}const R=b(Ke,[["render",qe],["__scopeId","data-v-9e7a342f"]]),Ge={name:"DynamicSlot",functional:!0,props:{name:{type:String,required:!0},slotProps:{type:Object,default:()=>({})}},render(t,l){const{props:n,parent:s}=l;let o=s.$scopedSlots[n.name];if(!o){let i=s.$parent;for(;i&&!o;){if(i.$options.name==="TmTable"){o=i.$scopedSlots[n.name];break}i=i.$parent}}return o?o(n.slotProps):t()}},{t:ve}=_(),Ye=!1,Xe=!0,Ze={name:"TmTableSearch",components:{TmSelect:E,TmAdvancedInput:M,TmAdvancedDate:A,TmCascader:I,TmRadio:P,TmCheckbox:H,TmSwitch:R,DynamicSlot:Ge},props:{disabled:{type:Boolean,default:!1},searchColumns:{type:Array,default:null},searchForm:{type:Object,default:()=>({})}},data(){return{t:ve,isVue2:Ye,isVue3:Xe,getCompatSize:T,getDefaultSize:y,defaultValues:{}}},computed:{computedSearchForm:{get(){return this.searchForm},set(t){this.$emit("update:search-form",t)}}},mounted(){this.initDefaultValues()},methods:{hasDefaultSlot(){const t=this.$slots.default;return this.isVue2?!!t:t()[0].children.length>0},handleUpdate(t,l,n){const s=this.getFieldValue(t,n);s&&this.$emit("update:search-form",{...this.computedSearchForm,[s]:l})},handleUpdateDate(t,l){const n=l||[],s=this.getFieldValue(t,"start"),o=this.getFieldValue(t,"end"),i=this.getFieldValue(t,"value"),r={};s&&(r[s]=n[0]),o&&(r[o]=n[1]),i&&(r[i]=n),this.$emit("update:search-form",{...this.computedSearchForm,...r})},getFieldValue(t,l){if(typeof t=="string")return t;if(t.fields&&l in t.fields){const n=t.fields[l];if(typeof n=="string")return n;if(Array.isArray(n))return n[0];if(n&&typeof n=="object")return n.name}},getFieldDefault(t,l){if(t.fields&&l in t.fields){const n=t.fields[l];if(Array.isArray(n)&&n.length>1)return n[1];if(n&&typeof n=="object"&&"default"in n)return n.default}},hasSearchSlot(t){const l="$slots";if(this[l][t])return!0;let s=this.$parent;const o=s[l];for(;s;){if(s.$options.name==="TmTable"&&o[t])return!0;s=s.$parent}return!1},initDefaultValues(){if(!this.searchColumns||!this.searchColumns.length)return;const t={};this.searchColumns.forEach(l=>{if(typeof l=="string"||!l.fields)return;const n=this.getFieldValue(l,"value"),s=this.getFieldValue(l,"label");if(l.type==="input"&&l.labelOptions&&l.labelOptions.length>0){const i=l.labelOptions[0];if(s)if(s in this.computedSearchForm)t[s]=this.computedSearchForm[s];else{const r=this.getFieldDefault(l,"label");r!==void 0?t[s]=r:i&&i.value!==void 0&&(t[s]=i.value)}n&&!(n in this.computedSearchForm)&&(t[n]="")}else if(l.type==="date"&&l.labelOptions&&l.labelOptions.length>0){const i=l.labelOptions[0];if(n&&!(n in this.computedSearchForm)&&(t[n]=[]),s)if(s in this.computedSearchForm)t[s]=this.computedSearchForm[s];else{const r=this.getFieldDefault(l,"label");r!==void 0?t[s]=r:i&&i.value!==void 0&&(t[s]=i.value)}}else if(l.type==="select"&&l.labelOptions&&l.labelOptions.length>0){const i=l.labelOptions[0];if(n&&!(n in this.computedSearchForm)&&(t[n]=l.multiple?[]:""),s)if(s in this.computedSearchForm)t[s]=this.computedSearchForm[s];else{const r=this.getFieldDefault(l,"label");r!==void 0?t[s]=r:i&&i.value!==void 0&&(t[s]=i.value)}}const o=this.getFieldDefault(l,"value");if(n&&o!==void 0&&!(n in this.computedSearchForm)?l.type==="date"&&!Array.isArray(o)?t[n]=[]:l.type==="checkbox"&&!Array.isArray(o)?t[n]=o?[o]:[]:l.type==="switch"&&typeof o!="boolean"?t[n]=!!o:t[n]=o:n&&!(n in this.computedSearchForm)&&(l.type==="checkbox"?t[n]=[]:l.type==="switch"&&(t[n]=!1)),l.type==="date"){const i=this.getFieldValue(l,"start"),r=this.getFieldValue(l,"end"),m=this.getFieldDefault(l,"start"),d=this.getFieldDefault(l,"end");i&&m!==void 0&&!(i in this.computedSearchForm)&&(t[i]=m),r&&d!==void 0&&!(r in this.computedSearchForm)&&(t[r]=d)}}),this.defaultValues=t,this.$emit("update:search-form",{...t,...this.computedSearchForm})},getSearchForm(){return this.computedSearchForm},handleSearch(){setTimeout(()=>{this.$emit("search",this.computedSearchForm)})},handleReset(){this.$emit("update:search-form",{...this.defaultValues}),this.$emit("reset")}}},$e={class:"search-content"},et={class:"search-actions"};function tt(t,l,n,s,o,i){const r=e.resolveComponent("dynamic-slot"),m=e.resolveComponent("tm-advanced-input"),d=e.resolveComponent("tm-advanced-date"),h=e.resolveComponent("tm-select"),f=e.resolveComponent("tm-cascader"),u=e.resolveComponent("tm-radio"),x=e.resolveComponent("tm-checkbox"),g=e.resolveComponent("tm-switch"),z=e.resolveComponent("el-button");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["table-search",`table-search--${o.isVue2?"v2":"v3"}`])},[e.createElementVNode("div",$e,[i.hasDefaultSlot()?e.renderSlot(t.$slots,"default",{key:0},void 0,!0):n.searchColumns&&n.searchColumns.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(n.searchColumns,(a,V)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[typeof a=="string"?(e.openBlock(),e.createElementBlock("div",{key:`str-${a}-${V}`,class:"search-item"},[(e.openBlock(),e.createBlock(r,{name:`search-${a}`,"slot-props":{searchForm:n.searchForm},key:a},null,8,["name","slot-props"]))])):(e.openBlock(),e.createElementBlock("div",{key:`obj-${V}`,class:"search-item"},[a.fields?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[i.hasSearchSlot(`search-${i.getFieldValue(a,"value")}`)?(e.openBlock(),e.createBlock(r,{name:`search-${i.getFieldValue(a,"value")}`,"slot-props":{searchForm:n.searchForm,col:a},key:i.getFieldValue(a,"value")},null,8,["name","slot-props"])):(e.openBlock(),e.createElementBlock("div",{style:{display:"flex"},key:i.getFieldValue(a,"value")||`col-${V}`},[a.type==="input"?(e.openBlock(),e.createBlock(m,{key:0,label:a.label,value:i.computedSearchForm[i.getFieldValue(a,"value")],field:i.computedSearchForm[i.getFieldValue(a,"label")],onValueChange:c=>i.handleUpdate(a,c,"value"),onFieldChange:c=>i.handleUpdate(a,c,"label"),multiple:a.multiple,labelOptions:a.labelOptions,placeholder:a.placeholder,onSearch:i.handleSearch},null,8,["label","value","field","onValueChange","onFieldChange","multiple","labelOptions","placeholder","onSearch"])):e.createCommentVNode("",!0),a.type==="date"?(e.openBlock(),e.createBlock(d,{key:1,label:a.label,value:i.computedSearchForm[i.getFieldValue(a,"value")],field:i.computedSearchForm[i.getFieldValue(a,"label")],start:i.computedSearchForm[i.getFieldValue(a,"start")],end:i.computedSearchForm[i.getFieldValue(a,"end")],onFieldChange:c=>i.handleUpdate(a,c,"label"),onValueChange:c=>i.handleUpdateDate(a,c),onStartChange:c=>i.handleUpdateDate(a,c),onEndChange:c=>i.handleUpdateDate(a,c),labelOptions:a.labelOptions,"start-placeholder":a.startPlaceholder,"end-placeholder":a.endPlaceholder},null,8,["label","value","field","start","end","onFieldChange","onValueChange","onStartChange","onEndChange","labelOptions","start-placeholder","end-placeholder"])):e.createCommentVNode("",!0),a.type==="select"?(e.openBlock(),e.createBlock(h,{key:2,label:a.label,modelValue:i.computedSearchForm[i.getFieldValue(a,"value")],"onUpdate:modelValue":c=>i.computedSearchForm[i.getFieldValue(a,"value")]=c,field:i.computedSearchForm[i.getFieldValue(a,"label")],options:a.options,labelOptions:a.labelOptions,placeholder:a.placeholder,multiple:a.multiple,"show-check-all":a.checkAll,onFieldChange:c=>i.handleUpdate(a,c,"label")},null,8,["label","modelValue","onUpdate:modelValue","field","options","labelOptions","placeholder","multiple","show-check-all","onFieldChange"])):e.createCommentVNode("",!0),a.type==="cascader"?(e.openBlock(),e.createBlock(f,{key:3,modelValue:i.computedSearchForm[i.getFieldValue(a,"value")],"onUpdate:modelValue":c=>i.computedSearchForm[i.getFieldValue(a,"value")]=c,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(u,{key:4,modelValue:i.computedSearchForm[i.getFieldValue(a,"value")],"onUpdate:modelValue":c=>i.computedSearchForm[i.getFieldValue(a,"value")]=c,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:i.computedSearchForm[i.getFieldValue(a,"value")],"onUpdate:modelValue":c=>i.computedSearchForm[i.getFieldValue(a,"value")]=c,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(g,{key:6,modelValue:i.computedSearchForm[i.getFieldValue(a,"value")],"onUpdate:modelValue":c=>i.computedSearchForm[i.getFieldValue(a,"value")]=c,"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-${V}`,class:"search-error-message"}," 缺少 fields 配置,无法渲染此组件 "))]))],64))),256)):e.createCommentVNode("",!0),e.createElementVNode("div",et,[e.createVNode(z,{type:"primary",size:o.getDefaultSize(),onClick:i.handleSearch},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.t("query")),1)]),_:1},8,["size","onClick"]),e.createVNode(z,{size:o.getDefaultSize(),onClick:i.handleReset},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.t("reset")),1)]),_:1},8,["size","onClick"])])])],2)}const U=b(Ze,[["render",tt],["__scopeId","data-v-572f884b"]]),lt=!1,ot={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:lt,getCompatSize:T}},methods:{handleSizeChange(t){this.$emit("size-change",t)},handleCurrentChange(t){this.$emit("current-change",t)}}},nt={class:"tm-pagination"};function it(t,l,n,s,o,i){const r=e.resolveComponent("el-pagination");return e.openBlock(),e.createElementBlock("div",nt,[e.createVNode(r,e.mergeProps(t.$attrs,e.toHandlers(o.isVue2?t.$listeners:{}),{style:{"text-align":"right"},"current-page":n.current,"page-size":n.pageSize,total:n.total,"page-sizes":[10,20,50,100,300,500,1e3,2e3],size:o.getCompatSize("mini"),layout:"total, sizes, prev, pager, next, jumper",onSizeChange:i.handleSizeChange,"onUpdate:currentPage":l[0]||(l[0]=m=>t.$emit("update:current",m)),"onUpdate:pageSize":l[1]||(l[1]=m=>t.$emit("update:pageSize",m)),onCurrentChange:i.handleCurrentChange}),null,16,["current-page","page-size","total","size","onSizeChange","onCurrentChange"])])}const st=b(ot,[["render",it],["__scopeId","data-v-4dbdf6e7"]]),at={name:"TmTableMenu",props:{size:{type:String,default:"mini"}}},rt={size:"small",class:"tm-table-menu",inline:""},ct={class:"left"},dt={class:"right"};function ht(t,l,n,s,o,i){return e.openBlock(),e.createElementBlock("div",rt,[e.createElementVNode("div",ct,[e.renderSlot(t.$slots,"left",{},void 0,!0)]),e.createElementVNode("div",dt,[e.renderSlot(t.$slots,"right",{},void 0,!0)])])}const mt=b(at,[["render",ht],["__scopeId","data-v-579dd2c3"]]),W=t=>t?t.props||{}:{},j=(t,l)=>{t&&(t.props||(t.props={}),typeof l=="object"&&Object.assign(t.props,l))},L={getTableConfig(t){try{const l=localStorage.getItem(`tm-table-config-${t}`);return Promise.resolve({data:{code:200,data:l}})}catch(l){return Promise.reject(l)}},setTableConfig(t){try{return localStorage.setItem(`tm-table-config-${t.key}`,t.info),Promise.resolve({data:{code:200,message:"success"}})}catch(l){return Promise.reject(l)}}},pt=t=>L.getTableConfig(t.key),ut=t=>L.setTableConfig(t),ft=t=>{t&&(typeof t.getTableConfig=="function"&&(L.getTableConfig=t.getTableConfig),typeof t.setTableConfig=="function"&&(L.setTableConfig=t.setTableConfig))},{t:gt}=_(),bt=!1,Ct=!0,yt={formatter:(t,l,n,s)=>[void 0,null,""].includes(n)?"-":n},Vt={name:"TmColumnConfig",components:{MoveIcon:re,FixedLeftIcon:de,FixedRightIcon:he,UploadIcon:me,DownloadIcon:pe,DeleteIcon:ue,MenuIcon:se},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:gt,isVue2:bt,isVue3:Ct,getDefaultSize:y,getCompatSize:T,buttonType:{link:!0,type:"primary"},afterOpenDelay:{"show-after":300},popoverVisible:!1,keyWord:"",sortedTableColumns:[],tableColumns:[],defaultColumnsConfig:[],columnMap:{},processedColumns:[],placement:"bottom",searchTimer:null,isDraggingFrozen:!1,isDraggingFrozenRight:!1,sortable:null,isConfigLoaded:!1,columnsCopy:[]}},computed:{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(){return this.tableKey?this.tableKey:this.$route.path.slice(1).replace(/\//g,"-")}},watch:{keyWord:{handler(){this.handleSearch()},immediate:!0},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,l){for(let n=t.length-1;n>=0;n--)if(l(t[n],n,t))return n;return-1},initializeColumnConfig(){this.defaultColumns&&this.defaultColumns.length>0?this.defaultColumnsConfig=this.defaultColumns:this.processOriginalColumns(),this.loadColumnConfig()},processOriginalColumns(){const t=this.columns||[];let l={};this.defaultColumnsConfig=t.filter(n=>{const s=W(n);return!(!s.prop||this.ignoredColumnConfigTypes.includes(s.type))}).map((n,s)=>{const o=W(n),i={...yt,...o};j(n,i),o.prop&&(l[o.prop]=n);const r=o.prop==="operation"||o.label&&o.label.includes("操作"),m=o.hasOwnProperty("visible")?o.visible!==!1:!0;return{prop:o.prop,label:o.label,fixed:o.fixed||"",isOperation:r,sort:s,cancellable:o.hasOwnProperty("cancellable")?o.cancellable:!0,visible:m}}),this.columnMap=l},loadColumnConfig(){pt({key:this.computedTableKey}).then(t=>{var n;if(t.data.code!==200)return;let l=JSON.parse(((n=t.data)==null?void 0:n.data)||null)||{};l.columnsConfig&&JSON.stringify(this.defaultColumnsConfig)===JSON.stringify(l.defaultColumnsConfig)?this.tableColumns=l.columnsConfig.map(s=>({...s})):this.tableColumns=this.defaultColumnsConfig.map(s=>({...s})),this.processedColumns=this.applyColumnConfig(this.tableColumns),this.isConfigLoaded=!0,this.$emit("complete",{columns:this.processedColumns,isInitialLoad:!0})}).catch(()=>{this.tableColumns=this.defaultColumnsConfig.map(t=>({...t})),this.processedColumns=this.applyColumnConfig(this.tableColumns),this.isConfigLoaded=!0,this.$emit("complete",{columns:this.processedColumns,isInitialLoad:!0})})},applyColumnConfig(t,l=!1){let n=this.columns.filter(o=>{const i=W(o);return this.ignoredColumnConfigTypes.includes(i.type)}),s=[];return[...t].sort((o,i)=>{const r=o.sort!==void 0?o.sort:1/0,m=i.sort!==void 0?i.sort:1/0;return r-m}).forEach(o=>{if(o.prop){let i=this.columnMap[o.prop];i&&(j(i,{fixed:o.fixed||void 0,visible:o.visible}),(!l&&o.visible||l)&&s.push(i))}}),n.forEach(o=>{j(o,{visible:!0})}),[...n,...s]},crateSortable(){const t=this.$refs.sortListRef;if(!t)return;this.sortable&&(this.sortable.destroy(),this.sortable=null);const l=new k(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:n})=>{const s=n.getAttribute("data-prop"),o=this.sortedTableColumns.find(i=>i.prop===s);this.isDraggingFrozen=o&&o.fixed==="left",this.isDraggingFrozenRight=o&&o.fixed==="right",this.draggedItemIndex=Array.from(t.children).indexOf(n),n.classList.add("sortable-drag")},onMove:n=>{const{target:s,related:o}=n;if(!s||!o)return!1;const i=o?o.getAttribute("data-prop"):null,r=i?this.sortedTableColumns.find(u=>u.prop===i):null,m=s.getAttribute("data-prop"),d=m?this.sortedTableColumns.find(u=>u.prop===m):null;if(d&&d.isOperation&&r&&r.fixed==="left")return s.classList.add("no-drop-zone"),!1;const h=r&&r.fixed==="left",f=r&&r.fixed==="right";return this.isDraggingFrozen&&!h||this.isDraggingFrozenRight&&!f||!this.isDraggingFrozen&&!this.isDraggingFrozenRight&&(h||f)?(s.classList.add("no-drop-zone"),!1):(document.querySelectorAll(".no-drop-zone").forEach(u=>{u.classList.remove("no-drop-zone")}),!0)},onEnd:({item:n,newIndex:s,oldIndex:o})=>{if(s===void 0||o===void 0||s<0||o<0||s>=this.sortedTableColumns.length||o>=this.sortedTableColumns.length)return;document.querySelectorAll(".no-drop-zone").forEach(u=>{u.classList.remove("no-drop-zone")}),n.classList.remove("sortable-drag");const i=this.sortedTableColumns[o],r=i.fixed==="left",m=i.fixed==="right",d=s>0?this.sortedTableColumns[s-1]:null,h=s<this.sortedTableColumns.length-1?this.sortedTableColumns[s+1]:null;let f=!1;if(r?(d&&d.fixed!=="left"||h&&h.fixed==="right")&&(f=!0):m?(d&&d.fixed!=="right"||h&&h.fixed!=="right")&&(f=!0):(d&&d.fixed==="right"||h&&h.fixed==="left")&&(f=!0),f){this.rollbackSort();return}this.updateSortAfterDrag()}});this.sortable=l},rollbackSort(){this.sortedTableColumns=JSON.parse(JSON.stringify(this.columnsCopy))},updateSortAfterDrag(){const t=this.$refs.sortListRef;if(!t)return;Array.from(t.children||[]).filter(n=>n&&n.dataset&&n.dataset.prop).map(n=>n.dataset.prop).forEach((n,s)=>{this.sortedTableColumns.some(o=>o.prop===n?(o.sort=s,!0):!1)}),this.columnsCopy=JSON.parse(JSON.stringify(this.sortedTableColumns)),this.$emit("on-sort-change",this.sortedTableColumns)},handleSearch(){clearTimeout(this.searchTimer),this.searchTimer=setTimeout(()=>{const t=this.keyWord;this.sortedTableColumns.forEach(l=>{l.searchShow=l.label.includes(t)})},500)},init(){this.tableColumns=Array.isArray(this.tableColumns)?[...this.tableColumns]:Array.isArray(this.defaultColumnsConfig)?[...this.defaultColumnsConfig]:[],this.initSortedTableColumns()},initSortedTableColumns(){this.tableColumns.forEach((t,l)=>{t.sort===void 0&&(t.sort=l)}),this.sortedTableColumns=[...this.tableColumns].sort((t,l)=>t.fixed==="left"&&l.fixed!=="left"?-1:t.fixed!=="left"&&l.fixed==="left"||t.fixed==="right"&&l.fixed!=="right"?1:t.fixed!=="right"&&l.fixed==="right"?-1:t.sort-l.sort)},setPlacement(){const l=this.$refs.operationRef.$el.getBoundingClientRect();(window.innerHeight||document.documentElement.clientHeight)-(l.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{}})(),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 k<"u"&&k.utils&&(document.removeEventListener("mousemove",k.utils.throttleCall),document.removeEventListener("mouseup",k.utils.throttleCall))}catch{}},handleSelectAll(){const t=this.tableColumns.some(l=>!l.visible);this.tableColumns.forEach(l=>{l.cancellable&&(l.visible=t)})},handleRestoreDefault(){this.tableColumns=JSON.parse(JSON.stringify(this.defaultColumnsConfig)),this.sortedTableColumns=[...this.tableColumns].sort((t,l)=>t.sort-l.sort)},canMoveTop(t,l){if(l===0)return!1;if(t.fixed==="left"){const n=this.sortedTableColumns[l-1];return n&&n.fixed==="left"}if(!t.fixed){const n=this.sortedTableColumns[l-1];return n&&n.fixed==="left"?!1:n&&!n.fixed}return t.fixed==="right"},moveTop(t,l){const n=this.sortedTableColumns,s=t.prop;if(t.fixed==="right"&&(t.fixed=""),t.fixed==="left")n.unshift(n.splice(l,1)[0]);else{const o=this.findLastIndex(this.sortedTableColumns,i=>i.fixed==="left");n.splice(o+1,0,n.splice(l,1)[0])}this.updateSortValues(),this.columnsCopy=JSON.parse(JSON.stringify(this.sortedTableColumns)),this.$emit("on-sort-change",this.sortedTableColumns),this.$nextTick(()=>{const o=this.$refs.sortListRef;if(o){const i=Array.from(o.children).find(r=>r.dataset&&r.dataset.prop===s);i&&i.scrollIntoView({behavior:"smooth",block:"nearest"})}})},frozenLeftHandle(t){const l=this.sortedTableColumns,n=l.splice(t,1)[0];if(n.fixed=n.fixed==="left"?"":"left",n.fixed==="left"){const s=this.findLastIndex(this.sortedTableColumns,o=>o.fixed==="left");l.splice(s+1,0,n)}else{const s=this.findLastIndex(this.sortedTableColumns,o=>o.fixed==="left");l.splice(s+1,0,n)}this.updateSortValues(),this.columnsCopy=JSON.parse(JSON.stringify(this.sortedTableColumns)),this.$emit("on-sort-change",this.sortedTableColumns)},frozenRightHandle(t){const l=this.sortedTableColumns,n=l.splice(t,1)[0];if(n.fixed=n.fixed==="right"?"":"right",n.fixed==="right"){const s=l.findIndex(o=>o.fixed==="right");s===-1?l.push(n):l.splice(s,0,n)}else{const s=l.findIndex(o=>o.fixed==="right");s===-1?l.push(n):l.splice(s,0,n)}this.updateSortValues(),this.columnsCopy=JSON.parse(JSON.stringify(this.sortedTableColumns)),this.$emit("on-sort-change",this.sortedTableColumns)},onSave(){var l;this.updateSortValues();const t=(l=this.tableColumns)==null?void 0:l.map(n=>{n.searchShow=!0;const s=this.sortedTableColumns.find(o=>o.prop===n.prop);return s&&(n.sort=s.sort,n.fixed=s.fixed,n.visible=s.visible),n});ut({key:this.computedTableKey,info:JSON.stringify({columnsConfig:t,defaultColumnsConfig:this.defaultColumnsConfig})}).then(n=>{n.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,l)=>{t.sort=l})}},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 k<"u"&&k.utils&&(document.removeEventListener("mousemove",k.utils.throttleCall),document.removeEventListener("mouseup",k.utils.throttleCall))}catch{}}},kt={key:0,class:"container"},_t={class:"main-container"},St={class:"left-content"},xt={class:"title"},zt={class:"option-list"},Ft={style:{height:"100%","overflow-y":"auto"}},Tt={class:"right-content"},wt={class:"search-box"},Bt={key:0,class:"tips"},Nt={class:"sort-list",ref:"sortListRef"},Lt=["data-prop"],Dt={key:0,class:"sort-item"},Ot={class:"row-title"},Et={class:"operation-btns"},Mt={class:"footer"},At={class:"footer-left"},It={class:"footer-right"},Pt={style:{display:"inline-block","margin-left":"10px"}};function Ht(t,l,n,s,o,i){const r=e.resolveComponent("el-button"),m=e.resolveComponent("el-checkbox"),d=e.resolveComponent("el-input"),h=e.resolveComponent("MoveIcon"),f=e.resolveComponent("DeleteIcon"),u=e.resolveComponent("el-tooltip"),x=e.resolveComponent("UploadIcon"),g=e.resolveComponent("FixedLeftIcon"),z=e.resolveComponent("FixedRightIcon"),a=e.resolveComponent("MenuIcon"),V=e.resolveComponent("el-popover");return e.openBlock(),e.createBlock(V,e.mergeProps({"popper-class":"column-config-popover"},{[o.isVue3?"visible":"value"]:o.popoverVisible},e.toHandlers({[o.isVue3?"update:visible":"input"]:i.handleVisibleChange}),{width:680,"show-arrow":!1,placement:o.placement,trigger:"click",onShow:i.handlePopoverShow,onHide:i.handlePopoverHide}),{reference:e.withCtx(()=>[e.createElementVNode("div",Pt,[e.createVNode(u,e.mergeProps({content:o.t("columnSetting")},o.afterOpenDelay,{placement:"top"}),{default:e.withCtx(()=>[e.createVNode(r,{size:o.getDefaultSize(),ref:"operationRef",circle:""},{default:e.withCtx(()=>[e.createVNode(a)]),_:1},8,["size"])]),_:1},16,["content"])])]),default:e.withCtx(()=>[o.popoverVisible?(e.openBlock(),e.createElementBlock("div",kt,[e.createElementVNode("div",_t,[e.createElementVNode("div",St,[e.createElementVNode("div",xt,[e.createElementVNode("span",null,e.toDisplayString(o.t("SelectableFields"))+"("+e.toDisplayString(o.tableColumns.length)+")",1),e.createVNode(r,e.mergeProps({style:{"margin-left":"10px"}},o.buttonType,{onClick:i.handleSelectAll}),{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.t("all")),1)]),_:1},16,["onClick"])]),e.createElementVNode("div",zt,[e.createElementVNode("div",Ft,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.tableColumns,(c,F)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[c.prop?(e.openBlock(),e.createElementBlock("div",{style:{width:"110px",display:"inline-block"},key:F+c.prop},[e.createVNode(m,{disabled:!c.cancellable,class:"el-checkbox",modelValue:c.visible,"onUpdate:modelValue":w=>c.visible=w,label:c.prop,value:c.prop},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.label),1)]),_:2},1032,["disabled","modelValue","onUpdate:modelValue","label","value"])])):e.createCommentVNode("",!0)],64))),256))])])]),e.createElementVNode("div",Tt,[e.createElementVNode("div",wt,[e.createVNode(d,{size:o.getCompatSize("small"),class:"search-input",clearable:"",placeholder:o.t("search"),modelValue:o.keyWord,"onUpdate:modelValue":l[0]||(l[0]=c=>o.keyWord=c)},null,8,["size","placeholder","modelValue"])]),i.showFixedLimitTips?(e.openBlock(),e.createElementBlock("div",Bt)):e.createCommentVNode("",!0),e.createElementVNode("div",Nt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.sortedTableColumns,(c,F)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["sort-item-wrapper",[c.fixed==="left"?"frozen":"",c.fixed==="right"?"frozenRight":"",c.fixed?"":"noFrozen"]]),"data-prop":c.prop,key:c.prop},[c.visible&&c.searchShow!==!1?(e.openBlock(),e.createElementBlock("div",Dt,[e.createElementVNode("div",Ot,[e.createVNode(h),e.createTextVNode(" "+e.toDisplayString(c.label),1)]),e.createElementVNode("div",Et,[c.cancellable?(e.openBlock(),e.createBlock(u,e.mergeProps({key:0,content:o.t("cancel"),placement:"top"},{ref_for:!0},o.afterOpenDelay),{default:e.withCtx(()=>[e.createVNode(r,e.mergeProps({ref_for:!0},o.buttonType,{size:o.getCompatSize("mini"),class:"iconfont-button delete-button",onClick:w=>c.visible=!1}),{default:e.withCtx(()=>[e.createVNode(f)]),_:2},1040,["size","onClick"])]),_:2},1040,["content"])):e.createCommentVNode("",!0),i.canMoveTop(c,F)?(e.openBlock(),e.createBlock(u,e.mergeProps({key:1,content:o.t("top"),placement:"top"},{ref_for:!0},o.afterOpenDelay),{default:e.withCtx(()=>[e.createVNode(r,e.mergeProps({ref_for:!0},o.buttonType,{size:o.getCompatSize("mini"),class:"iconfont-button top-button",onClick:w=>i.moveTop(c,F)}),{default:e.withCtx(()=>[e.createVNode(x)]),_:2},1040,["size","onClick"])]),_:2},1040,["content"])):e.createCommentVNode("",!0),c.fixed!=="right"?(e.openBlock(),e.createBlock(u,e.mergeProps({key:2,content:c.fixed==="left"?o.t("cancelLeftFixed"):o.t("leftFixed"),placement:"top"},{ref_for:!0},o.afterOpenDelay),{default:e.withCtx(()=>[e.createVNode(r,e.mergeProps({ref_for:!0},o.buttonType,{size:o.getCompatSize("mini"),class:["iconfont-button left-fixed-btn",{"active-fixed":c.fixed==="left"}],onClick:w=>i.frozenLeftHandle(F),disabled:c.fixed!=="left"&&i.isThanMaxFrozen}),{default:e.withCtx(()=>[e.createVNode(g)]),_:2},1040,["size","class","onClick","disabled"])]),_:2},1040,["content"])):e.createCommentVNode("",!0),c.fixed!=="left"?(e.openBlock(),e.createBlock(u,e.mergeProps({key:3,content:c.fixed==="right"?o.t("cancelRightFixed"):o.t("rightFixed"),placement:"top"},{ref_for:!0},o.afterOpenDelay),{default:e.withCtx(()=>[e.createVNode(r,e.mergeProps({ref_for:!0},o.buttonType,{size:o.getCompatSize("mini"),class:["iconfont-button right-fixed-btn",{"active-fixed":c.fixed==="right"}],onClick:w=>i.frozenRightHandle(F),disabled:c.fixed!=="right"&&i.isThanMaxRightFrozen}),{default:e.withCtx(()=>[e.createVNode(z)]),_:2},1040,["size","class","onClick","disabled"])]),_:2},1040,["content"])):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0)],10,Lt))),128))],512)])]),e.createElementVNode("div",Mt,[e.createElementVNode("div",At,[e.createVNode(r,{size:o.getCompatSize("mini"),onClick:i.handleRestoreDefault},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.t("restoreDefault")),1)]),_:1},8,["size","onClick"])]),e.createElementVNode("div",It,[e.createVNode(r,{size:o.getCompatSize("mini"),onClick:l[1]||(l[1]=c=>o.popoverVisible=!1)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.t("cancel")),1)]),_:1},8,["size"]),e.createVNode(r,{size:o.getCompatSize("mini"),type:"primary",onClick:i.onSave},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.t("saveAndApply")),1)]),_:1},8,["size","onClick"])])])])):e.createCommentVNode("",!0)]),_:1},16,["placement","onShow","onHide"])}const Rt=b(Vt,[["render",Ht],["__scopeId","data-v-fbd319a5"]]),Ut=!1,Wt=!0,jt={name:"TmTable",components:{TableSearch:U,TablePagination:st,TableMenu:mt,ColumnConfig:Rt,RefreshIcon:ae,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:y,getCompatSize:T,isVue3:Wt,isVue2:Ut,t:_().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(){return this.tableKey?this.tableKey:this.$route.path.slice(1).replace(/\//g,"-")}},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(){this.originalColumns=this.$slots.default(),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"){this.tableLoading=!0;try{const t=await this.data({paginationInfo:{pageSize:this.paginationInfo.pageSize,current:this.paginationInfo.current},params:this.searchForm}),{list:l,total:n,pageSize:s,current:o}=t;this.tableData=l,n!==void 0&&(this.paginationInfo.total=n),o!==void 0&&(this.paginationInfo.current=o),s!==void 0&&(this.paginationInfo.pageSize=s)}catch{}finally{this.tableLoading=!1}}},getTableHeight(){this.isAutoHeight()?this.$nextTick(()=>{const t=this.$refs.table,l=this.$refs.tmPagination;if(!t)return;const n=t.$el,s=l&&l.$el&&l.$el.offsetHeight||0;this.tableHeight=document.documentElement.clientHeight-n.offsetTop-s-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++}}},Jt={class:"tm-table",ref:"tablePage"};function Kt(t,l,n,s,o,i){const r=e.resolveComponent("table-search"),m=e.resolveComponent("RefreshIcon"),d=e.resolveComponent("el-button"),h=e.resolveComponent("el-tooltip"),f=e.resolveComponent("ColumnConfig"),u=e.resolveComponent("table-menu"),x=e.resolveComponent("columnRenderer"),g=e.resolveComponent("el-table"),z=e.resolveComponent("table-pagination"),a=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",Jt,[n.searchColumns&&n.searchColumns.length>0?(e.openBlock(),e.createBlock(r,{key:0,ref:"search",onSearch:i.search,onReset:i.reset,"onUpdate:searchForm":i.handleUpdateSearchForm,disabled:i.pageLoading,"search-columns":n.searchColumns,"search-form":n.searchForm},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"search")]),_:3},8,["onSearch","onReset","onUpdate:searchForm","disabled","search-columns","search-form"])):e.createCommentVNode("",!0),n.showMenu?(e.openBlock(),e.createBlock(u,{key:1},{left:e.withCtx(()=>[e.renderSlot(t.$slots,"menu-left")]),right:e.withCtx(()=>[e.renderSlot(t.$slots,"menu-right"),n.refreshButton?(e.openBlock(),e.createBlock(h,e.mergeProps({key:0,content:o.t("refresh"),placement:"top"},o.afterOpenDelay),{default:e.withCtx(()=>[e.createVNode(d,{onClick:i.handleRefresh,circle:"",size:o.getDefaultSize()},{default:e.withCtx(()=>[e.createVNode(m)]),_:1},8,["onClick","size"])]),_:1},16,["content"])):e.createCommentVNode("",!0),n.columnSettingButton?(e.openBlock(),e.createBlock(f,{key:1,maxFixedLeftQuantity:n.maxFixedLeftQuantity,maxFixedRightQuantity:n.maxFixedRightQuantity,tableKey:i.computedTableKey,columns:o.originalColumns,onComplete:i.handleColumnConfigComplete},null,8,["maxFixedLeftQuantity","maxFixedRightQuantity","tableKey","columns","onComplete"])):e.createCommentVNode("",!0)]),_:3})):e.createCommentVNode("",!0),e.withDirectives((e.openBlock(),e.createBlock(g,e.mergeProps({ref:"table"},{...t.$attrs,border:n.border},e.toHandlers(o.isVue2?t.$listeners:{}),{data:o.tableData,height:o.tableHeight,size:o.getCompatSize("mini"),onSelectionChange:i.handleSelectionChange,key:o.tableReload}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.displayColumns,V=>(e.openBlock(),e.createBlock(x,{vnode:V,key:o.isVue3?V.id:V.data.attrs.prop},null,8,["vnode"]))),128))]),_:1},16,["data","height","size","onSelectionChange"])),[[a,i.pageLoading]]),n.showPagination?(e.openBlock(),e.createBlock(z,{key:2,ref:"tmPagination","page-size":o.paginationInfo.pageSize,"current-page":o.paginationInfo.current,total:o.paginationInfo.total,disabled:o.tableLoading,onSizeChange:i.handleSizeChange,onCurrentChange:i.handleCurrentChange},null,8,["page-size","current-page","total","disabled","onSizeChange","onCurrentChange"])):e.createCommentVNode("",!0)],512)}const J=b(jt,[["render",Kt]]),Qt=!1,qt=!0,Gt={name:"TmTableColumn",inheritAttrs:!1,computed:{isVisible(){return this.$attrs.visible!==!1},slots(){return this.$slots}},data(){return{isVue2:Qt,isVue3:qt}},created(){this.$parent&&this.$parent.$emit&&this.$parent.$emit("column-initialized",{prop:this.$attrs.prop,visible:this.$attrs.visible!==!1})}};function vt(t,l,n,s,o,i){const r=e.resolveComponent("el-table-column");return i.isVisible?(e.openBlock(),e.createBlock(r,e.mergeProps({key:0},t.$attrs,e.toHandlers(o.isVue2?t.$listeners:{})),e.createSlots({_:2},[e.renderList(i.slots,(m,d)=>({name:d,fn:e.withCtx(h=>[e.renderSlot(t.$slots,d,e.normalizeProps(e.guardReactiveProps(h)))])}))]),1040)):e.createCommentVNode("",!0)}const K=b(Gt,[["render",vt]]),Yt={install:{install(t,l={}){[J,K,N].forEach(n=>t.component(n.name,n)),l.tableConfigProvider&&ft(l.tableConfigProvider)}}.install,Table:J,Column:K,Search:U,Select:E,AdvancedInput:M,AdvancedDate:A,Cascader:I,Radio:P,Checkbox:H,Switch:R,EllipsisText:N,setLang:D,useLocale:_};p.AdvancedDate=A,p.AdvancedInput=M,p.Cascader=I,p.Checkbox=H,p.Column=K,p.EllipsisText=N,p.Radio=P,p.Search=U,p.Select=E,p.Switch=R,p.Table=J,p.default=Yt,p.setLang=D,p.useLocale=_,Object.defineProperties(p,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(m,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("sortablejs")):typeof define=="function"&&define.amd?define(["exports","vue","sortablejs"],e):(m=typeof globalThis<"u"?globalThis:m||self,e(m.TmTable={},m.Vue,m.Sortable))})(this,function(m,e,x){"use strict";const $={mini:"small",small:"small",default:"default",large:"large"},z=t=>$[t]||$.default,C=()=>"default",Y={"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 L={value:"zh-CN"};L=e.ref("zh-CN");const X=t=>{var i;return((i=Y[L.value])==null?void 0:i[t])||t},N=t=>{L.value=t},V=()=>({t:X,setLang:N,currentLang:L}),g=(t,i)=>{const l=t.__vccOpts||t;for(const[s,o]of i)l[s]=o;return l},Z=!1,ee=!0,O="modelValue",te="update:modelValue",le={name:"TmSelectFilter",props:{[O]:{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:""}},data(){return{t:V().t,isVue2:Z,isVue3:ee,getDefaultSize:C,optionsList:[],loading:!1,indeterminate:!1,checkAll:!1,activedSelect:""}},computed:{computedValue:{get(){return this[O]},set(t){this.$emit(te,t),this.$emit("change",t)}},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:{[O](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}}},ie={key:0,class:"check-all-option"};function oe(t,i,l,s,o,n){const a=e.resolveComponent("el-option"),p=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(p,{key:0,size:o.getDefaultSize(),class:e.normalizeClass(["field-select",`field-select--${o.isVue2?"v2":"v3"}`]),modelValue:n.fieldValue,"onUpdate:modelValue":i[0]||(i[0]=h=>n.fieldValue=h),onFocus:i[1]||(i[1]=h=>n.setActivedSelect("left")),style:e.normalizeStyle(`z-index:${o.activedSelect==="left"?2:0}`)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.labelOptions,h=>(e.openBlock(),e.createBlock(a,{key:h.value,label:h.label,value:h.value},null,8,["label","value"]))),128))]),_:1},8,["size","class","modelValue","style"])):e.createCommentVNode("",!0),e.createVNode(p,e.mergeProps({ref:"select",class:["select",`select--${o.isVue3?"v3":"v2"}`],onFocus:i[4]||(i[4]=h=>n.setActivedSelect("right")),style:`z-index:${o.activedSelect==="right"?2:0}`,modelValue:n.computedValue,"onUpdate:modelValue":i[5]||(i[5]=h=>n.computedValue=h)},{...t.$attrs,size:o.getDefaultSize(),filterable:l.filterable,clearable:l.clearable,collapseTags:l.collapseTags,multiple:l.multiple,placeholder:l.placeholder,loading:o.loading},e.toHandlers(o.isVue2?t.$listeners:{}),{loading:o.loading}),e.createSlots({default:e.withCtx(()=>[o.isVue2&&l.multiple&&l.showCheckAll?(e.openBlock(),e.createElementBlock("div",ie,[e.createVNode(c,{style:{width:"100%"},modelValue:o.checkAll,"onUpdate:modelValue":i[2]||(i[2]=h=>o.checkAll=h),indeterminate:o.indeterminate,size:o.getDefaultSize(),onChange:n.handleCheckAll},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.t("all")),1)]),_:1},8,["modelValue","indeterminate","size","onChange"])])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"default",{},()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.optionsList,h=>(e.openBlock(),e.createBlock(a,{key:h[n.propMap.value],label:h[n.propMap.label],value:h[n.propMap.value],disabled:h.disabled},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"option",{item:h},()=>[e.createTextVNode(e.toDisplayString(h[n.propMap.label]),1)],!0)]),_:2},1032,["label","value","disabled"]))),128))],!0)]),_:2},[o.isVue3&&l.multiple&&l.showCheckAll?{name:"header",fn:e.withCtx(()=>[e.createVNode(c,{modelValue:o.checkAll,"onUpdate:modelValue":i[3]||(i[3]=h=>o.checkAll=h),indeterminate:o.indeterminate,size:o.getDefaultSize(),onChange:n.handleCheckAll,style:{width:"100%",height:"20px","padding-left":"10px"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.t("all")),1)]),_:1},8,["modelValue","indeterminate","size","onChange"])]),key:"0"}:void 0]),1040,["class","style","modelValue","loading"])],2)}const M=g(le,[["render",oe],["__scopeId","data-v-062139ab"]]),ne={name:"BaseIcon",props:{path:{type:String},size:{type:[String,Number]},color:{type:String}},methods:{handleClick(){}}},se=["width","height"],ae=["d"];function re(t,i,l,s,o,n){return e.openBlock(),e.createElementBlock("i",{class:"tm-icon",onClick:i[0]||(i[0]=(...a)=>n.handleClick&&n.handleClick(...a))},[(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,ae)],12,se))])}const ce=g(ne,[["render",re],["__scopeId","data-v-1c30ca93"]]),y=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 s=`${i}Icon`,o={name:s,props:{path:{type:String,default:l},size:{type:[String,Number]},color:{type:String}},render(n){return e.h(ce,this.$props)}};return o.install=n=>{n.component(s,o)},t[i]=o,t},{}),de=y.menu,he=y.refresh,pe=y.move;y["column-setting"];const me=y.more,ue=y["fixed-left"],fe=y["fixed-right"],ge=y.upload,be=y.download,ye=y.delete,G=y.copy,{t:D}=V(),Ce=!1,Ve=!0,ke={name:"TmEllipsisText",components:{CopyIcon:G},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:Ce,isVue3:Ve,isOverflow:!1,currentLines:1}},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()},watch:{text(){this.$nextTick(this.checkOverflow)}},methods:{checkOverflow(){const t=this.$refs.textEl;if(!t)return;const i=document.createElement("div"),l=getComputedStyle(t);i.style.position="absolute",i.style.visibility="hidden",i.style.left="-9999px",i.style.width=l.width,i.style.fontSize=l.fontSize,i.style.fontFamily=l.fontFamily,i.style.lineHeight=l.lineHeight,i.style.wordBreak="break-word",i.textContent=this.text,document.body.appendChild(i);const o=parseFloat(l.lineHeight)*this.lines;this.isOverflow=i.offsetHeight>o,document.body.removeChild(i),this.currentLines=l.height.slice(0,-2)/l.lineHeight.slice(0,-2)},handleCopy(){navigator.clipboard&&window.isSecureContext?navigator.clipboard.writeText(this.text).then(()=>{this.$message.success(D("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(D("copySuccess"))}catch{this.$message.error(D("copyFailed"))}document.body.removeChild(t)}}},xe={class:"ellipsis-text-container"};function Se(t,i,l,s,o,n){const a=e.resolveComponent("CopyIcon"),p=e.resolveComponent("el-tooltip");return e.openBlock(),e.createBlock(p,e.mergeProps({disabled:n.tooltipDisabled,content:l.text,effect:"dark",placement:"top"},{[o.isVue2?"open-delay":"show-after"]:300}),{default:e.withCtx(()=>[e.createElementVNode("div",xe,[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:o.currentLines>1&&l.lines>1}])},[l.copyable?(e.openBlock(),e.createBlock(a,{key:0,class:"icon-item",onClick:n.handleCopy},null,8,["onClick"])):e.createCommentVNode("",!0)],2)])]),_:1},16,["disabled","content"])}const B=g(ke,[["render",Se],["__scopeId","data-v-b0e14655"]]),_e=!1,Te=!0,we={name:"TmAdvancedInputFilter",components:{MoreIcon:me,EllipsisText:B},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:V().t,isVue3:Te,isVue2:_e,getDefaultSize:C,getCompatSize:z,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:{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()}},ze={key:1,class:"input-label"},Fe={class:"popover-content"},Le={class:"popover-subtitle"},Be={class:"popover-footer"};function Ee(t,i,l,s,o,n){const a=e.resolveComponent("el-option"),p=e.resolveComponent("el-select"),c=e.resolveComponent("EllipsisText"),h=e.resolveComponent("el-input"),f=e.resolveComponent("el-button"),u=e.resolveComponent("MoreIcon"),_=e.resolveComponent("el-popover");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["tm-advanced-input",`tm-advanced-input--${o.isVue3?"v3":"v2"}`]),style:e.normalizeStyle({width:n.width})},[l.labelOptions&&l.labelOptions.length?(e.openBlock(),e.createBlock(p,{key:0,modelValue:n.fieldValue,"onUpdate:modelValue":i[0]||(i[0]=b=>n.fieldValue=b),placeholder:o.t("selectPlaceholder"),style:{width:"100px","flex-shrink":"0"},size:o.getDefaultSize(),class:"left-select",onChange:n.handlefieldChange},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.labelOptions,b=>(e.openBlock(),e.createBlock(a,{key:b.value,label:b.label,value:b.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","size","onChange"])):l.label?(e.openBlock(),e.createElementBlock("div",ze,[e.createVNode(c,{text:l.label,lines:2},null,8,["text"])])):e.createCommentVNode("",!0),e.createVNode(h,{modelValue:o.inputValue,"onUpdate:modelValue":i[3]||(i[3]=b=>o.inputValue=b),size:o.getDefaultSize(),placeholder:l.placeholder,onKeyup:e.withKeys(n.handleEnter,["enter","native"]),clearable:"",class:e.normalizeClass(["right-input",{"has-label":l.labelOptions&&l.labelOptions.length}])},e.createSlots({_:2},[n.shouldShowMultiple?{name:"append",fn:e.withCtx(()=>[e.createVNode(_,e.mergeProps({[o.isVue3?"visible":"value"]:o.isExactMode,placement:"bottom-end",width:240,trigger:"click"},e.toHandlers({[o.isVue3?"update:visible":"input"]:n.handleVisibleChange})),{reference:e.withCtx(()=>[e.createVNode(u,{style:{cursor:"pointer"}})]),default:e.withCtx(()=>[e.createElementVNode("div",Fe,[e.createElementVNode("p",Le,e.toDisplayString(o.t("accurateSearchTips")),1),e.createVNode(h,{size:o.getDefaultSize(),type:"textarea",rows:8,modelValue:o.exactValue,"onUpdate:modelValue":i[1]||(i[1]=b=>o.exactValue=b),placeholder:o.t("accurateSearchPlaceholder"),style:{"font-size":"12px"}},null,8,["size","modelValue","placeholder"]),e.createElementVNode("div",Be,[e.createVNode(f,{style:{float:"left"},size:o.getCompatSize("mini"),onClick:n.handleClear},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.t("clear")),1)]),_:1},8,["size","onClick"]),e.createVNode(f,{size:o.getCompatSize("mini"),onClick:i[2]||(i[2]=b=>o.isExactMode=!1)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.t("cancel")),1)]),_:1},8,["size"]),e.createVNode(f,{type:"primary",size:o.getCompatSize("mini"),onClick:n.handleExactSearch},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.t("search")),1)]),_:1},8,["size","onClick"])])])]),_:1},16)]),key:"0"}:void 0]),1032,["modelValue","size","placeholder","onKeyup","class"])],6)}const A=g(we,[["render",Ee],["__scopeId","data-v-96a2075d"]]),{t:S}=V(),Ne=!1,Oe=!0,Me={name:"TmAdvancedDateFilter",props:{value:{type:Array,default:()=>[]},field:{type:[String,Number],default:""},start:{type:[String,Number],default:""},end:{type:[String,Number],default:""},size:{type:String,default:"mini"},labelOptions:{type:Array,default:()=>[]},type:{type:String,default:"daterange"},format:{type:String,default:""},startPlaceholder:{type:String,default:void 0},endPlaceholder:{type:String,default:void 0},disabledDate:{type:Function,default:t=>t.getTime()>Date.now()}},computed:{computedFormat(){const t="YYYY",i="DD";return this.format?this.format:this.type==="year"?t:this.type==="month"?`${t}-MM`:this.type==="date"?`${t}-MM-${i}`:this.type==="dates"?`${t}-MM-${i}`:this.type==="months"?`${t}-MM`:this.type==="years"?t:this.type==="week"?`${t}-MM-WW`:this.type==="datetime"?`${t}-MM-${i} HH:mm:ss`:this.type==="datetimerange"?`${t}-MM-${i} HH:mm:ss`:this.type==="daterange"?`${t}-MM-${i}`:this.type==="monthrange"?`${t}-MM`:""},computedPickerOptions(){return{shortcuts:[{text:S("today"),onClick(t){const i=new Date,l=new Date;t.$emit("pick",[l,i])}},{text:S("yesterday"),onClick(t){const i=new Date,l=new Date;l.setTime(l.getTime()-3600*1e3*24),i.setTime(i.getTime()-3600*1e3*24),t.$emit("pick",[l,i])}},{text:S("last7days"),onClick(t){const i=new Date,l=new Date;l.setTime(l.getTime()-3600*1e3*24*7),t.$emit("pick",[l,i])}},{text:S("last30days"),onClick(t){const i=new Date,l=new Date;l.setTime(l.getTime()-3600*1e3*24*30),t.$emit("pick",[l,i])}},{text:S("thisMonth"),onClick(t){const i=new Date,l=new Date;l.setDate(1),t.$emit("pick",[l,i])}},{text:S("lastMonth"),onClick(t){const i=new Date,l=new Date;l.setMonth(l.getMonth()-1),l.setDate(1),i.setDate(0),t.$emit("pick",[l,i])}}]}},dateValue:{get(){return this.start||this.end?[this.start,this.end]:this.value},set(t){this.$emit("value-change",t),this.$emit("start-change",t),this.$emit("end-change",t)}},fieldValue:{get(){return this.field},set(t){this.$emit("field-change",t)}}},data(){return{t:S,isVue2:Ne,isVue3:Oe,getDefaultSize:C}},watch:{labelOptions:{handler(t){t.length>0&&!this.field&&this.$emit("field-change",t[0].value)},deep:!0,immediate:!0}}};function De(t,i,l,s,o,n){const a=e.resolveComponent("el-option"),p=e.resolveComponent("el-select"),c=e.resolveComponent("el-date-picker");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["tm-date-picker",`tm-date-picker--${o.isVue3?"v3":"v2"}`])},[e.createVNode(p,{modelValue:n.fieldValue,"onUpdate:modelValue":i[0]||(i[0]=h=>n.fieldValue=h),size:o.getDefaultSize(),style:{width:"100px"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.labelOptions,h=>(e.openBlock(),e.createBlock(a,{key:h.value,label:h.label,value:h.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","size"]),e.createVNode(c,{modelValue:n.dateValue,"onUpdate:modelValue":i[1]||(i[1]=h=>n.dateValue=h),type:"daterange",size:o.getDefaultSize(),"range-separator":"-","start-placeholder":l.startPlaceholder===void 0?o.t("startDate"):l.startPlaceholder,"end-placeholder":l.endPlaceholder===void 0?o.t("endDate"):l.endPlaceholder,"picker-options":n.computedPickerOptions,style:{width:"206px"},format:n.computedFormat,"value-format":n.computedFormat},null,8,["modelValue","size","start-placeholder","end-placeholder","picker-options","format","value-format"])],2)}const H=g(Me,[["render",De],["__scopeId","data-v-3cd3ede3"]]),Ae=!1,He={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:Ae,getDefaultSize:C,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{...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 Re(t,i,l,s,o,n){const a=e.resolveComponent("el-cascader");return e.openBlock(),e.createBlock(a,e.mergeProps({ref:"cascader",class:["tm-cascader",`tm-cascader--${o.isVue2?"v2":"v3"}`],modelValue:o.selectedValue,"onUpdate:modelValue":i[0]||(i[0]=p=>o.selectedValue=p),style:{width:"200px"}},{...t.$attrs,size:o.getDefaultSize(),filterable:l.filterable,clearable:l.clearable,collapseTags:l.collapseTags,collapseTagsTooltip:l.collapseTagsTooltip,props:n.cascaderProps,placeholder:l.placeholder,options:o.optionsList,loading:o.loading},e.toHandlers(o.isVue2?t.$listeners:{})),{default:e.withCtx(({node:p,data:c})=>[e.renderSlot(t.$slots,"default",{node:p,data:c},()=>[e.createElementVNode("span",null,e.toDisplayString(c[n.propMap.label]),1)])]),_:3},16,["class","modelValue"])}const R=g(He,[["render",Re]]),Ie=!1,Pe=!0,We={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:Ie,isVue3:Pe,getDefaultSize:C,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 Ue(t,i,l,s,o,n){const a=e.resolveComponent("el-radio-button"),p=e.resolveComponent("el-radio-group");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["tm-radio",{"wide-mode":n.hasWideOptions,"tm-radio--v3":o.isVue3,"tm-radio--v2":o.isVue2}])},[e.createVNode(p,e.mergeProps({ref:"radioGroup",modelValue:o.selectedValue,"onUpdate:modelValue":i[0]||(i[0]=c=>o.selectedValue=c)},{...t.$attrs,size:o.getDefaultSize()},e.toHandlers(o.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(o.optionsList,c=>(e.openBlock(),e.createBlock(a,e.mergeProps({ref_for:!0},{[o.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 I=g(We,[["render",Ue],["__scopeId","data-v-61fed13d"]]),ve=!1,je=!0,Je={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:ve,isVue3:je,getDefaultSize:C,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),s=`${(this.hasWideOptions?305:200)/i}px`;return{width:s,flex:`0 0 ${s}`}}},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 Ke(t,i,l,s,o,n){const a=e.resolveComponent("el-checkbox-button"),p=e.resolveComponent("el-checkbox-group");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["tm-checkbox",{"wide-mode":n.hasWideOptions,"tm-checkbox--v3":o.isVue3,"tm-checkbox--v2":o.isVue2}])},[e.createVNode(p,e.mergeProps({ref:"checkboxGroup",modelValue:o.selectedValue,"onUpdate:modelValue":i[0]||(i[0]=c=>o.selectedValue=c)},{...t.$attrs,size:o.getDefaultSize()},e.toHandlers(o.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(o.optionsList,c=>(e.openBlock(),e.createBlock(a,e.mergeProps({key:c[n.propMap.value]},{ref_for:!0},{[o.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 P=g(Je,[["render",Ke],["__scopeId","data-v-b44866b1"]]),Qe=!1,qe={name:"TmSwitchFilter",props:{value:{type:Boolean,default:!1},label:{type:String,default:""}},data(){return{isVue2:Qe,getDefaultSize:C,switchValue:this.value}},computed:{containerWidthClass(){const t=n=>{if(!n)return 0;let a=0;for(let p=0;p<n.length;p++){const c=n.charAt(p);a+=/[\u4e00-\u9fa5]/.test(c)?2:1}return a},i=t(this.$attrs["active-text"]),l=t(this.$attrs["inactive-text"]),s=t(this.$attrs.label),o=i+l+s;return o>20?"wide-container":o>6?"medium-container":"narrow-container"}},watch:{value:{immediate:!0,handler(t){this.switchValue=t}},switchValue(t){this.$emit("input",t),this.$emit("change",t)}}},$e={key:0,class:"switch-label"};function Ge(t,i,l,s,o,n){const a=e.resolveComponent("el-switch");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["tm-switch",n.containerWidthClass])},[l.label?(e.openBlock(),e.createElementBlock("span",$e,e.toDisplayString(l.label),1)):e.createCommentVNode("",!0),e.createVNode(a,e.mergeProps({ref:"switch",modelValue:o.switchValue,"onUpdate:modelValue":i[0]||(i[0]=p=>o.switchValue=p)},t.$attrs,e.toHandlers(o.isVue2?t.$listeners:{}),{size:o.getDefaultSize()}),null,16,["modelValue","size"])],2)}const W=g(qe,[["render",Ge],["__scopeId","data-v-9e7a342f"]]),Ye={name:"DynamicSlot",functional:!0,props:{name:{type:String,required:!0},slotProps:{type:Object,default:()=>({})}},render(t,i){const{props:l,parent:s}=i;let o=s.$scopedSlots[l.name];if(!o){let n=s.$parent;for(;n&&!o;){if(n.$options.name==="TmTable"){o=n.$scopedSlots[l.name];break}n=n.$parent}}return o?o(l.slotProps):t()}},{t:Xe}=V(),Ze=!1,et=!0,tt={name:"TmTableSearch",components:{TmSelect:M,TmAdvancedInput:A,TmAdvancedDate:H,TmCascader:R,TmRadio:I,TmCheckbox:P,TmSwitch:W,DynamicSlot:Ye},props:{disabled:{type:Boolean,default:!1},searchColumns:{type:Array,default:null},searchForm:{type:Object,default:()=>({})}},data(){return{t:Xe,isVue2:Ze,isVue3:et,getCompatSize:z,getDefaultSize:C,defaultValues:{}}},computed:{computedSearchForm:{get(){return this.searchForm},set(t){this.$emit("update:search-form",t)}}},mounted(){this.initDefaultValues()},methods:{hasDefaultSlot(){const t=this.$slots.default;return this.isVue2?!!t:t()[0].children.length>0},handleUpdate(t,i,l){const s=this.getFieldValue(t,l);s&&this.$emit("update:search-form",{...this.computedSearchForm,[s]:i})},handleUpdateDate(t,i){const l=i||[],s=this.getFieldValue(t,"start"),o=this.getFieldValue(t,"end"),n=this.getFieldValue(t,"value"),a={};s&&(a[s]=l[0]),o&&(a[o]=l[1]),n&&(a[n]=l),this.$emit("update:search-form",{...this.computedSearchForm,...a})},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 s=this.$parent;const o=s[i];for(;s;){if(s.$options.name==="TmTable"&&o[t])return!0;s=s.$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"),s=this.getFieldValue(i,"label");if(i.type==="input"&&i.labelOptions&&i.labelOptions.length>0){const n=i.labelOptions[0];if(s)if(s in this.computedSearchForm)t[s]=this.computedSearchForm[s];else{const a=this.getFieldDefault(i,"label");a!==void 0?t[s]=a:n&&n.value!==void 0&&(t[s]=n.value)}l&&!(l in this.computedSearchForm)&&(t[l]="")}else if(i.type==="date"&&i.labelOptions&&i.labelOptions.length>0){const n=i.labelOptions[0];if(l&&!(l in this.computedSearchForm)&&(t[l]=[]),s)if(s in this.computedSearchForm)t[s]=this.computedSearchForm[s];else{const a=this.getFieldDefault(i,"label");a!==void 0?t[s]=a:n&&n.value!==void 0&&(t[s]=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?[]:""),s)if(s in this.computedSearchForm)t[s]=this.computedSearchForm[s];else{const a=this.getFieldDefault(i,"label");a!==void 0?t[s]=a:n&&n.value!==void 0&&(t[s]=n.value)}}const o=this.getFieldDefault(i,"value");if(l&&o!==void 0&&!(l in this.computedSearchForm)?i.type==="date"&&!Array.isArray(o)?t[l]=[]:i.type==="checkbox"&&!Array.isArray(o)?t[l]=o?[o]:[]:i.type==="switch"&&typeof o!="boolean"?t[l]=!!o:t[l]=o:l&&!(l in this.computedSearchForm)&&(i.type==="checkbox"?t[l]=[]:i.type==="switch"&&(t[l]=!1)),i.type==="date"){const n=this.getFieldValue(i,"start"),a=this.getFieldValue(i,"end"),p=this.getFieldDefault(i,"start"),c=this.getFieldDefault(i,"end");n&&p!==void 0&&!(n in this.computedSearchForm)&&(t[n]=p),a&&c!==void 0&&!(a in this.computedSearchForm)&&(t[a]=c)}}),this.defaultValues=t,this.$emit("update:search-form",{...t,...this.computedSearchForm})},getSearchForm(){return this.computedSearchForm},handleSearch(){setTimeout(()=>{this.$emit("search",this.computedSearchForm)})},handleReset(){this.$emit("update:search-form",{...this.defaultValues}),this.$emit("reset")}}},lt={class:"search-content"},it={class:"search-actions"};function ot(t,i,l,s,o,n){const a=e.resolveComponent("dynamic-slot"),p=e.resolveComponent("tm-advanced-input"),c=e.resolveComponent("tm-advanced-date"),h=e.resolveComponent("tm-select"),f=e.resolveComponent("tm-cascader"),u=e.resolveComponent("tm-radio"),_=e.resolveComponent("tm-checkbox"),b=e.resolveComponent("tm-switch"),T=e.resolveComponent("el-button");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["table-search",`table-search--${o.isVue2?"v2":"v3"}`])},[e.createElementVNode("div",lt,[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,(r,k)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[typeof r=="string"?(e.openBlock(),e.createElementBlock("div",{key:`str-${r}-${k}`,class:"search-item"},[(e.openBlock(),e.createBlock(a,{name:`search-${r}`,"slot-props":{searchForm:l.searchForm},key:r},null,8,["name","slot-props"]))])):(e.openBlock(),e.createElementBlock("div",{key:`obj-${k}`,class:"search-item"},[r.fields?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[n.hasSearchSlot(`search-${n.getFieldValue(r,"value")}`)?(e.openBlock(),e.createBlock(a,{name:`search-${n.getFieldValue(r,"value")}`,"slot-props":{searchForm:l.searchForm,col:r},key:n.getFieldValue(r,"value")},null,8,["name","slot-props"])):(e.openBlock(),e.createElementBlock("div",{style:{display:"flex"},key:n.getFieldValue(r,"value")||`col-${k}`},[r.type==="input"?(e.openBlock(),e.createBlock(p,{key:0,label:r.label,value:n.computedSearchForm[n.getFieldValue(r,"value")],field:n.computedSearchForm[n.getFieldValue(r,"label")],onValueChange:d=>n.handleUpdate(r,d,"value"),onFieldChange:d=>n.handleUpdate(r,d,"label"),multiple:r.multiple,labelOptions:r.labelOptions,placeholder:r.placeholder,onSearch:n.handleSearch},null,8,["label","value","field","onValueChange","onFieldChange","multiple","labelOptions","placeholder","onSearch"])):e.createCommentVNode("",!0),r.type==="date"?(e.openBlock(),e.createBlock(c,{key:1,label:r.label,value:n.computedSearchForm[n.getFieldValue(r,"value")],field:n.computedSearchForm[n.getFieldValue(r,"label")],start:n.computedSearchForm[n.getFieldValue(r,"start")],end:n.computedSearchForm[n.getFieldValue(r,"end")],onFieldChange:d=>n.handleUpdate(r,d,"label"),onValueChange:d=>n.handleUpdateDate(r,d),onStartChange:d=>n.handleUpdateDate(r,d),onEndChange:d=>n.handleUpdateDate(r,d),labelOptions:r.labelOptions,"start-placeholder":r.startPlaceholder,"end-placeholder":r.endPlaceholder},null,8,["label","value","field","start","end","onFieldChange","onValueChange","onStartChange","onEndChange","labelOptions","start-placeholder","end-placeholder"])):e.createCommentVNode("",!0),r.type==="select"?(e.openBlock(),e.createBlock(h,{key:2,label:r.label,modelValue:n.computedSearchForm[n.getFieldValue(r,"value")],"onUpdate:modelValue":d=>n.computedSearchForm[n.getFieldValue(r,"value")]=d,field:n.computedSearchForm[n.getFieldValue(r,"label")],options:r.options,labelOptions:r.labelOptions,placeholder:r.placeholder,multiple:r.multiple,"show-check-all":r.checkAll,onFieldChange:d=>n.handleUpdate(r,d,"label")},null,8,["label","modelValue","onUpdate:modelValue","field","options","labelOptions","placeholder","multiple","show-check-all","onFieldChange"])):e.createCommentVNode("",!0),r.type==="cascader"?(e.openBlock(),e.createBlock(f,{key:3,modelValue:n.computedSearchForm[n.getFieldValue(r,"value")],"onUpdate:modelValue":d=>n.computedSearchForm[n.getFieldValue(r,"value")]=d,label:r.label,options:r.options,labelOptions:r.labelOptions,props:r.props,placeholder:r.placeholder,"show-check-all":r.checkAll},null,8,["modelValue","onUpdate:modelValue","label","options","labelOptions","props","placeholder","show-check-all"])):e.createCommentVNode("",!0),r.type==="radio"?(e.openBlock(),e.createBlock(u,{key:4,modelValue:n.computedSearchForm[n.getFieldValue(r,"value")],"onUpdate:modelValue":d=>n.computedSearchForm[n.getFieldValue(r,"value")]=d,label:r.label,options:r.options,props:r.props},null,8,["modelValue","onUpdate:modelValue","label","options","props"])):e.createCommentVNode("",!0),r.type==="checkbox"?(e.openBlock(),e.createBlock(_,{key:5,modelValue:n.computedSearchForm[n.getFieldValue(r,"value")],"onUpdate:modelValue":d=>n.computedSearchForm[n.getFieldValue(r,"value")]=d,label:r.label,options:r.options,props:r.props},null,8,["modelValue","onUpdate:modelValue","label","options","props"])):e.createCommentVNode("",!0),r.type==="switch"?(e.openBlock(),e.createBlock(b,{key:6,modelValue:n.computedSearchForm[n.getFieldValue(r,"value")],"onUpdate:modelValue":d=>n.computedSearchForm[n.getFieldValue(r,"value")]=d,"active-text":r.activeText,"inactive-text":r.inactiveText,label:r.label,"active-color":r.activeColor,"inactive-color":r.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-${k}`,class:"search-error-message"}," 缺少 fields 配置,无法渲染此组件 "))]))],64))),256)):e.createCommentVNode("",!0),e.createElementVNode("div",it,[e.createVNode(T,{type:"primary",size:o.getDefaultSize(),onClick:n.handleSearch},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.t("query")),1)]),_:1},8,["size","onClick"]),e.createVNode(T,{size:o.getDefaultSize(),onClick:n.handleReset},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.t("reset")),1)]),_:1},8,["size","onClick"])])])],2)}const U=g(tt,[["render",ot],["__scopeId","data-v-572f884b"]]),nt=!1,st={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:nt,getCompatSize:z}},methods:{handleSizeChange(t){this.$emit("size-change",t)},handleCurrentChange(t){this.$emit("current-change",t)}}},at={class:"tm-pagination"};function rt(t,i,l,s,o,n){const a=e.resolveComponent("el-pagination");return e.openBlock(),e.createElementBlock("div",at,[e.createVNode(a,e.mergeProps(t.$attrs,e.toHandlers(o.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:o.getCompatSize("mini"),layout:"total, sizes, prev, pager, next, jumper",onSizeChange:n.handleSizeChange,"onUpdate:currentPage":i[0]||(i[0]=p=>t.$emit("update:current",p)),"onUpdate:pageSize":i[1]||(i[1]=p=>t.$emit("update:pageSize",p)),onCurrentChange:n.handleCurrentChange}),null,16,["current-page","page-size","total","size","onSizeChange","onCurrentChange"])])}const ct=g(st,[["render",rt],["__scopeId","data-v-4dbdf6e7"]]),dt={name:"TmTableMenu",props:{size:{type:String,default:"mini"}}},ht={size:"small",class:"tm-table-menu",inline:""},pt={class:"left"},mt={class:"right"};function ut(t,i,l,s,o,n){return e.openBlock(),e.createElementBlock("div",ht,[e.createElementVNode("div",pt,[e.renderSlot(t.$slots,"left",{},void 0,!0)]),e.createElementVNode("div",mt,[e.renderSlot(t.$slots,"right",{},void 0,!0)])])}const ft=g(dt,[["render",ut],["__scopeId","data-v-579dd2c3"]]),v=t=>t?t.props||{}:{},j=(t,i)=>{t&&(t.props||(t.props={}),typeof i=="object"&&Object.assign(t.props,i))},E={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)}}},gt=t=>E.getTableConfig(t.key),bt=t=>E.setTableConfig(t),yt=t=>{t&&(typeof t.getTableConfig=="function"&&(E.getTableConfig=t.getTableConfig),typeof t.setTableConfig=="function"&&(E.setTableConfig=t.setTableConfig))},{t:Ct}=V(),Vt=!1,kt=!0,xt={formatter:(t,i,l,s)=>[void 0,null,""].includes(l)?"-":l},St={name:"TmColumnConfig",components:{MoveIcon:pe,FixedLeftIcon:ue,FixedRightIcon:fe,UploadIcon:ge,DownloadIcon:be,DeleteIcon:ye,MenuIcon:de},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:Ct,isVue2:Vt,isVue3:kt,getDefaultSize:C,getCompatSize:z,buttonType:{link:!0,type:"primary"},afterOpenDelay:{"show-after":300},popoverVisible:!1,keyWord:"",sortedTableColumns:[],tableColumns:[],defaultColumnsConfig:[],columnMap:{},processedColumns:[],placement:"bottom",searchTimer:null,isDraggingFrozen:!1,isDraggingFrozenRight:!1,sortable:null,isConfigLoaded:!1,columnsCopy:[]}},computed:{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(){return this.tableKey?this.tableKey:this.$route.path.slice(1).replace(/\//g,"-")}},watch:{keyWord:{handler(){this.handleSearch()},immediate:!0},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},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 s=v(l);return!(!s.prop||this.ignoredColumnConfigTypes.includes(s.type))}).map((l,s)=>{const o=v(l),n={...xt,...o};j(l,n),o.prop&&(i[o.prop]=l);const a=o.prop==="operation"||o.label&&o.label.includes("操作"),p=o.hasOwnProperty("visible")?o.visible!==!1:!0;return{prop:o.prop,label:o.label,fixed:o.fixed||"",isOperation:a,sort:s,cancellable:o.hasOwnProperty("cancellable")?o.cancellable:!0,visible:p}}),this.columnMap=i},loadColumnConfig(){gt({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(s=>({...s})):this.tableColumns=this.defaultColumnsConfig.map(s=>({...s})),this.processedColumns=this.applyColumnConfig(this.tableColumns),this.isConfigLoaded=!0,this.$emit("complete",{columns:this.processedColumns,isInitialLoad:!0})}).catch(()=>{this.tableColumns=this.defaultColumnsConfig.map(t=>({...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(o=>{const n=v(o);return this.ignoredColumnConfigTypes.includes(n.type)}),s=[];return[...t].sort((o,n)=>{const a=o.sort!==void 0?o.sort:1/0,p=n.sort!==void 0?n.sort:1/0;return a-p}).forEach(o=>{if(o.prop){let n=this.columnMap[o.prop];n&&(j(n,{fixed:o.fixed||void 0,visible:o.visible}),(!i&&o.visible||i)&&s.push(n))}}),l.forEach(o=>{j(o,{visible:!0})}),[...l,...s]},crateSortable(){const t=this.$refs.sortListRef;if(!t)return;this.sortable&&(this.sortable.destroy(),this.sortable=null);const i=new x(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 s=l.getAttribute("data-prop"),o=this.sortedTableColumns.find(n=>n.prop===s);this.isDraggingFrozen=o&&o.fixed==="left",this.isDraggingFrozenRight=o&&o.fixed==="right",this.draggedItemIndex=Array.from(t.children).indexOf(l),l.classList.add("sortable-drag")},onMove:l=>{const{target:s,related:o}=l;if(!s||!o)return!1;const n=o?o.getAttribute("data-prop"):null,a=n?this.sortedTableColumns.find(u=>u.prop===n):null,p=s.getAttribute("data-prop"),c=p?this.sortedTableColumns.find(u=>u.prop===p):null;if(c&&c.isOperation&&a&&a.fixed==="left")return s.classList.add("no-drop-zone"),!1;const h=a&&a.fixed==="left",f=a&&a.fixed==="right";return this.isDraggingFrozen&&!h||this.isDraggingFrozenRight&&!f||!this.isDraggingFrozen&&!this.isDraggingFrozenRight&&(h||f)?(s.classList.add("no-drop-zone"),!1):(document.querySelectorAll(".no-drop-zone").forEach(u=>{u.classList.remove("no-drop-zone")}),!0)},onEnd:({item:l,newIndex:s,oldIndex:o})=>{if(s===void 0||o===void 0||s<0||o<0||s>=this.sortedTableColumns.length||o>=this.sortedTableColumns.length)return;document.querySelectorAll(".no-drop-zone").forEach(u=>{u.classList.remove("no-drop-zone")}),l.classList.remove("sortable-drag");const n=this.sortedTableColumns[o],a=n.fixed==="left",p=n.fixed==="right",c=s>0?this.sortedTableColumns[s-1]:null,h=s<this.sortedTableColumns.length-1?this.sortedTableColumns[s+1]:null;let f=!1;if(a?(c&&c.fixed!=="left"||h&&h.fixed==="right")&&(f=!0):p?(c&&c.fixed!=="right"||h&&h.fixed!=="right")&&(f=!0):(c&&c.fixed==="right"||h&&h.fixed==="left")&&(f=!0),f){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,s)=>{this.sortedTableColumns.some(o=>o.prop===l?(o.sort=s,!0):!1)}),this.columnsCopy=JSON.parse(JSON.stringify(this.sortedTableColumns)),this.$emit("on-sort-change",this.sortedTableColumns)},handleSearch(){clearTimeout(this.searchTimer),this.searchTimer=setTimeout(()=>{const t=this.keyWord;this.sortedTableColumns.forEach(i=>{i.searchShow=i.label.includes(t)})},500)},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{}})(),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 x<"u"&&x.utils&&(document.removeEventListener("mousemove",x.utils.throttleCall),document.removeEventListener("mouseup",x.utils.throttleCall))}catch{}},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,s=t.prop;if(t.fixed==="right"&&(t.fixed=""),t.fixed==="left")l.unshift(l.splice(i,1)[0]);else{const o=this.findLastIndex(this.sortedTableColumns,n=>n.fixed==="left");l.splice(o+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 o=this.$refs.sortListRef;if(o){const n=Array.from(o.children).find(a=>a.dataset&&a.dataset.prop===s);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 s=this.findLastIndex(this.sortedTableColumns,o=>o.fixed==="left");i.splice(s+1,0,l)}else{const s=this.findLastIndex(this.sortedTableColumns,o=>o.fixed==="left");i.splice(s+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 s=i.findIndex(o=>o.fixed==="right");s===-1?i.push(l):i.splice(s,0,l)}else{const s=i.findIndex(o=>o.fixed==="right");s===-1?i.push(l):i.splice(s,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=>{l.searchShow=!0;const s=this.sortedTableColumns.find(o=>o.prop===l.prop);return s&&(l.sort=s.sort,l.fixed=s.fixed,l.visible=s.visible),l});bt({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 x<"u"&&x.utils&&(document.removeEventListener("mousemove",x.utils.throttleCall),document.removeEventListener("mouseup",x.utils.throttleCall))}catch{}}},_t={key:0,class:"container"},Tt={class:"main-container"},wt={class:"left-content"},zt={class:"title"},Ft={class:"option-list"},Lt={style:{height:"100%","overflow-y":"auto"}},Bt={class:"right-content"},Et={class:"search-box"},Nt={key:0,class:"tips"},Ot={class:"sort-list",ref:"sortListRef"},Mt=["data-prop"],Dt={key:0,class:"sort-item"},At={class:"row-title"},Ht={class:"operation-btns"},Rt={class:"footer"},It={class:"footer-left"},Pt={class:"footer-right"},Wt={style:{display:"inline-block","margin-left":"10px"}};function Ut(t,i,l,s,o,n){const a=e.resolveComponent("el-button"),p=e.resolveComponent("el-checkbox"),c=e.resolveComponent("el-input"),h=e.resolveComponent("MoveIcon"),f=e.resolveComponent("DeleteIcon"),u=e.resolveComponent("el-tooltip"),_=e.resolveComponent("UploadIcon"),b=e.resolveComponent("FixedLeftIcon"),T=e.resolveComponent("FixedRightIcon"),r=e.resolveComponent("MenuIcon"),k=e.resolveComponent("el-popover");return e.openBlock(),e.createBlock(k,e.mergeProps({"popper-class":"column-config-popover"},{[o.isVue3?"visible":"value"]:o.popoverVisible},e.toHandlers({[o.isVue3?"update:visible":"input"]:n.handleVisibleChange}),{width:680,"show-arrow":!1,placement:o.placement,trigger:"click",onShow:n.handlePopoverShow,onHide:n.handlePopoverHide}),{reference:e.withCtx(()=>[e.createElementVNode("div",Wt,[e.createVNode(u,e.mergeProps({content:o.t("columnSetting")},o.afterOpenDelay,{placement:"top"}),{default:e.withCtx(()=>[e.createVNode(a,{size:o.getDefaultSize(),ref:"operationRef",circle:""},{default:e.withCtx(()=>[e.createVNode(r)]),_:1},8,["size"])]),_:1},16,["content"])])]),default:e.withCtx(()=>[o.popoverVisible?(e.openBlock(),e.createElementBlock("div",_t,[e.createElementVNode("div",Tt,[e.createElementVNode("div",wt,[e.createElementVNode("div",zt,[e.createElementVNode("span",null,e.toDisplayString(o.t("SelectableFields"))+"("+e.toDisplayString(o.tableColumns.length)+")",1),e.createVNode(a,e.mergeProps({style:{"margin-left":"10px"}},o.buttonType,{onClick:n.handleSelectAll}),{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.t("all")),1)]),_:1},16,["onClick"])]),e.createElementVNode("div",Ft,[e.createElementVNode("div",Lt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.tableColumns,(d,w)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[d.prop?(e.openBlock(),e.createElementBlock("div",{style:{width:"110px",display:"inline-block"},key:w+d.prop},[e.createVNode(p,{disabled:!d.cancellable,class:"el-checkbox",modelValue:d.visible,"onUpdate:modelValue":F=>d.visible=F,label:d.prop,value:d.prop},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.label),1)]),_:2},1032,["disabled","modelValue","onUpdate:modelValue","label","value"])])):e.createCommentVNode("",!0)],64))),256))])])]),e.createElementVNode("div",Bt,[e.createElementVNode("div",Et,[e.createVNode(c,{size:o.getCompatSize("small"),class:"search-input",clearable:"",placeholder:o.t("search"),modelValue:o.keyWord,"onUpdate:modelValue":i[0]||(i[0]=d=>o.keyWord=d)},null,8,["size","placeholder","modelValue"])]),n.showFixedLimitTips?(e.openBlock(),e.createElementBlock("div",Nt)):e.createCommentVNode("",!0),e.createElementVNode("div",Ot,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.sortedTableColumns,(d,w)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["sort-item-wrapper",[d.fixed==="left"?"frozen":"",d.fixed==="right"?"frozenRight":"",d.fixed?"":"noFrozen"]]),"data-prop":d.prop,key:d.prop},[d.visible&&d.searchShow!==!1?(e.openBlock(),e.createElementBlock("div",Dt,[e.createElementVNode("div",At,[e.createVNode(h),e.createTextVNode(" "+e.toDisplayString(d.label),1)]),e.createElementVNode("div",Ht,[d.cancellable?(e.openBlock(),e.createBlock(u,e.mergeProps({key:0,content:o.t("cancel"),placement:"top"},{ref_for:!0},o.afterOpenDelay),{default:e.withCtx(()=>[e.createVNode(a,e.mergeProps({ref_for:!0},o.buttonType,{size:o.getCompatSize("mini"),class:"iconfont-button delete-button",onClick:F=>d.visible=!1}),{default:e.withCtx(()=>[e.createVNode(f)]),_:2},1040,["size","onClick"])]),_:2},1040,["content"])):e.createCommentVNode("",!0),n.canMoveTop(d,w)?(e.openBlock(),e.createBlock(u,e.mergeProps({key:1,content:o.t("top"),placement:"top"},{ref_for:!0},o.afterOpenDelay),{default:e.withCtx(()=>[e.createVNode(a,e.mergeProps({ref_for:!0},o.buttonType,{size:o.getCompatSize("mini"),class:"iconfont-button top-button",onClick:F=>n.moveTop(d,w)}),{default:e.withCtx(()=>[e.createVNode(_)]),_:2},1040,["size","onClick"])]),_:2},1040,["content"])):e.createCommentVNode("",!0),d.fixed!=="right"?(e.openBlock(),e.createBlock(u,e.mergeProps({key:2,content:d.fixed==="left"?o.t("cancelLeftFixed"):o.t("leftFixed"),placement:"top"},{ref_for:!0},o.afterOpenDelay),{default:e.withCtx(()=>[e.createVNode(a,e.mergeProps({ref_for:!0},o.buttonType,{size:o.getCompatSize("mini"),class:["iconfont-button left-fixed-btn",{"active-fixed":d.fixed==="left"}],onClick:F=>n.frozenLeftHandle(w),disabled:d.fixed!=="left"&&n.isThanMaxFrozen}),{default:e.withCtx(()=>[e.createVNode(b)]),_:2},1040,["size","class","onClick","disabled"])]),_:2},1040,["content"])):e.createCommentVNode("",!0),d.fixed!=="left"?(e.openBlock(),e.createBlock(u,e.mergeProps({key:3,content:d.fixed==="right"?o.t("cancelRightFixed"):o.t("rightFixed"),placement:"top"},{ref_for:!0},o.afterOpenDelay),{default:e.withCtx(()=>[e.createVNode(a,e.mergeProps({ref_for:!0},o.buttonType,{size:o.getCompatSize("mini"),class:["iconfont-button right-fixed-btn",{"active-fixed":d.fixed==="right"}],onClick:F=>n.frozenRightHandle(w),disabled:d.fixed!=="right"&&n.isThanMaxRightFrozen}),{default:e.withCtx(()=>[e.createVNode(T)]),_:2},1040,["size","class","onClick","disabled"])]),_:2},1040,["content"])):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0)],10,Mt))),128))],512)])]),e.createElementVNode("div",Rt,[e.createElementVNode("div",It,[e.createVNode(a,{size:o.getCompatSize("mini"),onClick:n.handleRestoreDefault},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.t("restoreDefault")),1)]),_:1},8,["size","onClick"])]),e.createElementVNode("div",Pt,[e.createVNode(a,{size:o.getCompatSize("mini"),onClick:i[1]||(i[1]=d=>o.popoverVisible=!1)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.t("cancel")),1)]),_:1},8,["size"]),e.createVNode(a,{size:o.getCompatSize("mini"),type:"primary",onClick:n.onSave},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.t("saveAndApply")),1)]),_:1},8,["size","onClick"])])])])):e.createCommentVNode("",!0)]),_:1},16,["placement","onShow","onHide"])}const vt=g(St,[["render",Ut],["__scopeId","data-v-f3445124"]]),jt=!1,Jt=!0,Kt={name:"TmTable",components:{TableSearch:U,TablePagination:ct,TableMenu:ft,ColumnConfig:vt,RefreshIcon:he,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:C,getCompatSize:z,isVue3:Jt,isVue2:jt,t:V().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(){return this.tableKey?this.tableKey:this.$route.path.slice(1).replace(/\//g,"-")},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(){this.originalColumns=this.$slots.default(),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:s,current:o}=t;this.tableData=i,l!==void 0&&(this.paginationInfo.total=l),o!==void 0&&(this.paginationInfo.current=o),s!==void 0&&(this.paginationInfo.pageSize=s)}catch{}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,s=i&&i.$el&&i.$el.offsetHeight||0;this.tableHeight=document.documentElement.clientHeight-l.offsetTop-s-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++}}},Qt={class:"tm-table",ref:"tablePage"};function qt(t,i,l,s,o,n){const a=e.resolveComponent("table-search"),p=e.resolveComponent("RefreshIcon"),c=e.resolveComponent("el-button"),h=e.resolveComponent("el-tooltip"),f=e.resolveComponent("ColumnConfig"),u=e.resolveComponent("table-menu"),_=e.resolveComponent("columnRenderer"),b=e.resolveComponent("el-table"),T=e.resolveComponent("table-pagination"),r=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",Qt,[l.searchColumns&&l.searchColumns.length>0?(e.openBlock(),e.createBlock(a,{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")]),_:3},8,["onSearch","onReset","onUpdate:searchForm","disabled","search-columns","search-form"])):e.createCommentVNode("",!0),l.showMenu?(e.openBlock(),e.createBlock(u,{key:1},{left:e.withCtx(()=>[e.renderSlot(t.$slots,"menu-left")]),right:e.withCtx(()=>[e.renderSlot(t.$slots,"menu-right"),l.refreshButton&&typeof l.data=="function"?(e.openBlock(),e.createBlock(h,e.mergeProps({key:0,content:o.t("refresh"),placement:"top"},o.afterOpenDelay),{default:e.withCtx(()=>[e.createVNode(c,{onClick:n.handleRefresh,circle:"",size:o.getDefaultSize()},{default:e.withCtx(()=>[e.createVNode(p)]),_:1},8,["onClick","size"])]),_:1},16,["content"])):e.createCommentVNode("",!0),l.columnSettingButton?(e.openBlock(),e.createBlock(f,{key:1,maxFixedLeftQuantity:l.maxFixedLeftQuantity,maxFixedRightQuantity:l.maxFixedRightQuantity,tableKey:n.computedTableKey,columns:o.originalColumns,onComplete:n.handleColumnConfigComplete},null,8,["maxFixedLeftQuantity","maxFixedRightQuantity","tableKey","columns","onComplete"])):e.createCommentVNode("",!0)]),_:3})):e.createCommentVNode("",!0),e.withDirectives((e.openBlock(),e.createBlock(b,e.mergeProps({ref:"table"},{...t.$attrs,border:l.border},e.toHandlers(o.isVue2?t.$listeners:{}),{data:o.tableData,height:o.tableHeight,size:o.getCompatSize("mini"),onSelectionChange:n.handleSelectionChange,key:o.tableReload}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.displayColumns,k=>(e.openBlock(),e.createBlock(_,{vnode:k,key:o.isVue3?k.id:k.data.attrs.prop},null,8,["vnode"]))),128))]),_:1},16,["data","height","size","onSelectionChange"])),[[r,n.pageLoading]]),n.computedShowPagination?(e.openBlock(),e.createBlock(T,{key:2,ref:"tmPagination","page-size":o.paginationInfo.pageSize,"current-page":o.paginationInfo.current,total:o.paginationInfo.total,disabled:o.tableLoading,onSizeChange:n.handleSizeChange,onCurrentChange:n.handleCurrentChange},null,8,["page-size","current-page","total","disabled","onSizeChange","onCurrentChange"])):e.createCommentVNode("",!0)],512)}const J=g(Kt,[["render",qt]]),$t=!1,Gt=!0,Yt={name:"TmTableColumn",inheritAttrs:!1,computed:{isVisible(){return this.$attrs.visible!==!1},slots(){return this.$slots}},data(){return{isVue2:$t,isVue3:Gt}},created(){this.$parent&&this.$parent.$emit&&this.$parent.$emit("column-initialized",{prop:this.$attrs.prop,visible:this.$attrs.visible!==!1})}};function Xt(t,i,l,s,o,n){const a=e.resolveComponent("el-table-column");return n.isVisible?(e.openBlock(),e.createBlock(a,e.mergeProps({key:0},t.$attrs,e.toHandlers(o.isVue2?t.$listeners:{})),e.createSlots({_:2},[e.renderList(n.slots,(p,c)=>({name:c,fn:e.withCtx(h=>[e.renderSlot(t.$slots,c,e.normalizeProps(e.guardReactiveProps(h)))])}))]),1040)):e.createCommentVNode("",!0)}const K=g(Yt,[["render",Xt]]),{t:Q}=V(),Zt={name:"TmAdvancedEllipsisText",components:{CopyIcon:G},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(Q("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(Q("copySuccess"))}catch{this.$message.error(Q("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 s=l.offsetHeight;l.innerHTML="",this.lineHeight=s}else{const s=i.lineHeight;if(s&&s!=="normal")this.lineHeight=parseInt(s);else{const o=parseInt(i.fontSize);this.lineHeight=o*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 s=this.lineHeight*(this.rows-1),o=this.findTextForHeight(t,s);this.frontLines=this.splitTextToLines(o);const n=t.substring(o.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,s=t.length,o="";for(;l<=s;){const n=Math.floor((l+s)/2),a=t.substring(0,n);this.getTextHeight(a)<=i?(o=a,l=n+1):s=n-1}return o},splitTextToLines(t){if(!t)return[];const i=[];let l=t;for(;l.length>0;){const s=this.findTextForHeight(l,this.lineHeight);if(s.length===0)break;i.push(s),l=l.substring(s.length)}return i},checkIfTextOverflows(t){if(!t)return!1;const i=this.getTextWidth(t),l=this.shouldShowToolbar&&this.hasToolbarContent?this.getToolbarWidth():0,s=this.containerWidth-l-5;return i>s},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,s=l.style.cssText;this.setMeasureElementStyle(l,i),l.textContent=t,l.offsetHeight;const o=i.whiteSpace==="nowrap"?l.offsetWidth:l.offsetHeight;return l.style.cssText=s,l.innerHTML="",o},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(([s,o])=>{t.style[s]=o})},handleMouseEnter(){this.isHovered=!0},handleMouseLeave(){this.isHovered=!1},setupResizeObserver(){typeof ResizeObserver<"u"&&(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)}}},el={class:"tm-ellipsis-text-wrapper"},tl=["innerHTML"],ll={class:"tm-ellipsis-last-line"},il=["innerHTML"],ol={key:0,class:"tm-ellipsis-toolbar-part"},nl={key:1,class:"tm-ellipsis-text-wrapper"},sl=["innerHTML"],al={class:"tm-ellipsis-last-line"},rl=["innerHTML"],cl={key:0,class:"tm-ellipsis-toolbar-part"},dl={ref:"measureRef",class:"tm-ellipsis-measure"};function hl(t,i,l,s,o,n){const a=e.resolveComponent("CopyIcon"),p=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&&o.isLastLineEllipsis?(e.openBlock(),e.createBlock(p,e.mergeProps({key:0,content:o.originalText,disabled:!l.showTooltip||!o.isLastLineEllipsis},{[o.isVue2?"open-delay":"show-after"]:300},{placement:"top"}),{default:e.withCtx(()=>[e.createElementVNode("div",el,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.frontLines,(c,h)=>(e.openBlock(),e.createElementBlock("div",{key:"front-"+h,class:"tm-ellipsis-line",innerHTML:c},null,8,tl))),128)),e.createElementVNode("div",ll,[e.createElementVNode("div",{class:"tm-ellipsis-text-part",innerHTML:o.lastLineText},null,8,il),n.shouldShowToolbar&&n.hasToolbarContent?(e.openBlock(),e.createElementBlock("div",ol,[l.copyable?(e.openBlock(),e.createBlock(a,{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",nl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.frontLines,(c,h)=>(e.openBlock(),e.createElementBlock("div",{key:"front-"+h,class:"tm-ellipsis-line",innerHTML:c},null,8,sl))),128)),e.createElementVNode("div",al,[e.createElementVNode("div",{class:"tm-ellipsis-text-part",innerHTML:o.lastLineText},null,8,rl),n.shouldShowToolbar&&n.hasToolbarContent?(e.openBlock(),e.createElementBlock("div",cl,[l.copyable?(e.openBlock(),e.createBlock(a,{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",dl,null,512)],36)}const q=g(Zt,[["render",hl],["__scopeId","data-v-16643222"]]),pl={install:{install(t,i={}){[J,K,B,q].forEach(l=>t.component(l.name,l)),i.tableConfigProvider&&yt(i.tableConfigProvider)}}.install,Table:J,Column:K,Search:U,Select:M,AdvancedInput:A,AdvancedDate:H,Cascader:R,Radio:I,Checkbox:P,Switch:W,EllipsisText:B,AdvancedEllipsisText:q,setLang:N,useLocale:V};m.AdvancedDate=H,m.AdvancedEllipsisText=q,m.AdvancedInput=A,m.Cascader=R,m.Checkbox=P,m.Column=K,m.EllipsisText=B,m.Radio=I,m.Search=U,m.Select=M,m.Switch=W,m.Table=J,m.default=pl,m.setLang=N,m.useLocale=V,Object.defineProperties(m,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tm-table",
3
- "version": "1.0.82",
3
+ "version": "1.0.84",
4
4
  "description": "A table component for Vue",
5
5
  "main": "dist/vue2/tm-table.umd.js",
6
6
  "module": "dist/vue2/tm-table.es.js",