@gopowerteam/table-render 0.0.153 → 0.0.155
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.
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/table-columns/index.d.ts +1 -0
- package/dist/cjs/table-columns/progress/index.d.ts +11 -0
- package/dist/es/index.mjs +155 -138
- package/dist/es/table-columns/index.d.ts +1 -0
- package/dist/es/table-columns/progress/index.d.ts +11 -0
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ge=Object.defineProperty;var we=(e,t,r)=>t in e?ge(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var T=(e,t,r)=>(we(e,typeof t!="symbol"?t+"":t,r),r);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("vue"),w=require("@arco-design/web-vue"),R=require("@gopowerteam/modal-render"),ve=require("exceljs"),L=require("dayjs"),ee=require("@gopowerteam/form-render"),Ce=require("./resolver.cjs");function xe(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const c=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,c.get?c:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const ke=xe(ve);function Se(e,t,r){const[c,...a]=t.index?t.index.split(".").reverse():[t.key],n=a.reverse().reduce((l,d)=>l==null?void 0:l[d],e);n[c]=r}function Ve(e){const t=u.ref([]),r=a=>{const n=e.filter(l=>l.formatter);return n.length>0?a.map(l=>(n.forEach(d=>{d.formatter&&Se(l,d,d.formatter(l))}),l)):a};return[t,a=>{t.value=r(a)}]}function Ne(e){return e.filter(t=>t.form).map(t=>({key:t.key,title:t.title,...typeof t.form=="boolean"?{}:t.form}))}function Te(e){const t=u.getCurrentInstance(),r=u.ref();function c(){var n,l;const a=(l=(n=t==null?void 0:t.proxy)==null?void 0:n.$refs)==null?void 0:l[e];a&&(r.value=a)}return u.onMounted(c),u.onUpdated(c),r}function te(e){return(t,r)=>e[t](r)}class P{constructor(t=1,r=10){T(this,"data",u.reactive({index:1,size:10,total:0}));T(this,"pageSizeOpts",[10,20,30,40,50]);T(this,"pageLayouts",["PrevJump","PrevPage","JumpNumber","NextPage","NextJump","Sizes","FullJump","Total"]);this.pageIndex=t,this.pageSize=r}get pageIndex(){return this.data.index}set pageIndex(t){this.data.index=t}get pageSize(){return this.data.size}set pageSize(t){this.data.size=t}get total(){return this.data.total}set total(t){this.data.total=t}reset(){this.pageIndex=1}before(t){t.paramsQuery={...t.paramsQuery,page:this.pageIndex-1,size:this.pageSize}}after(t){var r;this.total=(r=t.data)==null?void 0:r.totalElements}}const Me=Symbol.for("RenderColumnType");function k(e,t,r){return t.$type=e,t.$disableColumnMode=r==null?void 0:r.disableColumnMode,t.$disableViewMode=r==null?void 0:r.disableViewMode,t}function S(e,t){return t.index?t.index.split(".").reduce((r,c)=>r==null?void 0:r[c],e):[t.key].reduce((r,c)=>r==null?void 0:r[c],e)}function $(e){return!!e&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function _e(e){return k("button",(r,c,a)=>{const n=R.useModal(),l=Array.isArray(e)?e:"buttons"in e?e.buttons:[e],d=(f,o)=>typeof f=="function"?f(r):f===void 0?o:f;async function m(f){if(await(f.confirm===!0?new Promise(s=>{n.confirm({title:"提示信息",content:f.confirmText??"您确定要执行该操作?",onOk:()=>s(!0),onCancel:()=>s(!1)})}):Promise.resolve(!0))&&(f!=null&&f.onClick)){const s=f.onClick(r);$(s)&&f.autoReload!==!1&&s.then(()=>{a!=null&&a.emits&&(a==null||a.emits("reload"))}),!$(s)&&f.autoReload===!0&&a!=null&&a.emits&&(a==null||a.emits("reload"))}}return u.createVNode(u.Fragment,null,[l.filter(f=>d(f.visiable,!0)).map(f=>u.createVNode(w.Button,{onClick:()=>m(f),type:f.type||"text",shape:f.shape,size:"mini",disabled:d(f.disabled,!1)},{icon:f.icon,default:()=>(typeof f.content=="function"?f.content(r):f.content)||""}))])},{disableViewMode:!0})}const Oe={thousands:!0,inputUnit:"元",outputUnit:"元"},J={分:10**0,元:10**2,万:10**6};function Re(e){e={...Oe,...e||{}};const t=n=>{if(n==null)return;if((e==null?void 0:e.inputUnit)===(e==null?void 0:e.outputUnit))return n;const l=J[e.inputUnit]/J[e.outputUnit],d=parseFloat((n*l).toFixed(10));return(e==null?void 0:e.precision)===void 0?d:d.toFixed(e==null?void 0:e.precision)},r=n=>{if(n==null)return;const l=n.toString().split(".");return l[0]=l[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),l.join(".")},c=n=>{if((e==null?void 0:e.zeroString)!==void 0&&Number(n)===0)return e==null?void 0:e.zeroString;if((e==null?void 0:e.nullString)!==void 0&&isNaN(Number(n)))return e==null?void 0:e.nullString;const l=t(Number(n));return e!=null&&e.thousands?r(l):l};return k("dict",(n,l)=>{const d=S(n,l);return u.createVNode("div",null,[typeof(e==null?void 0:e.prefix)=="string"?u.createVNode("span",null,[e.prefix]):typeof(e==null?void 0:e.prefix)=="function"?u.createVNode("span",null,[e.prefix()]):void 0,u.createVNode("span",{class:"currency_value"},[c(d)]),typeof(e==null?void 0:e.suffix)=="string"?u.createVNode("span",null,[e.suffix]):typeof(e==null?void 0:e.suffix)=="function"?u.createVNode("span",null,[e.suffix()]):void 0])})}var je=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ee={exports:{}};(function(e,t){(function(r,c){e.exports=c(L)})(je,function(r){function c(l){return l&&typeof l=="object"&&"default"in l?l:{default:l}}var a=c(r),n={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(l,d){return d==="W"?l+"周":l+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(l,d){var m=100*l+d;return m<600?"凌晨":m<900?"早上":m<1100?"上午":m<1300?"中午":m<1800?"下午":"晚上"}};return a.default.locale(n,null,!0),n})})(Ee);L.locale("zh-cn");const qe={date:"YYYY-MM-DD",datetime:"YYYY-MM-DD HH:mm:ss",time:"HH:mm:ss",week:"ddd"};function $e(e){return k("date",(r,c)=>{const a=S(r,c),n=typeof(e==null?void 0:e.format)=="function"?e==null?void 0:e.format():qe[(e==null?void 0:e.format)||"datetime"],l=L(a);return u.createVNode("span",null,[l.isValid()&&l.format(n)])})}const Le={success:"arcoblue",warning:"orange",error:"red"};function Pe(e){return e instanceof Map?e:e.dict}function ze(e){const t=e instanceof Map?!1:e.tag;return typeof t=="string"?Le[t]:t}function Ye(e){const t=Pe(e),r=ze(e);return k("dict",(a,n)=>{const l=S(a,n);return r?u.createVNode(w.Tag,{color:r===!0?void 0:r},{default:()=>[t.get(l)||l]}):u.createVNode("span",null,[t.get(l)||l])})}function Ae(e){const t=R.useModal();async function r(a,n){a.confirm&&!await new Promise((d,m)=>{t.open("confirm",{title:"确认",content:a.confirmText||"是否确认执行该操作?",onOk:()=>d(!0),onCancel:()=>d(!1)})})||a.onClick(n)}return k("dropdown",(a,n)=>{const l=e.options.filter(d=>typeof d.visiable=="function"?d.visiable(a):d.visiable!==!1);return u.createVNode(w.Dropdown,{trigger:(e==null?void 0:e.trigger)||"click"},{default:()=>u.createVNode(w.Button,{disabled:l.length===0,type:"text"},{default:()=>[(e==null?void 0:e.content)||"操作"]}),content:()=>l.map(d=>u.createVNode(w.Dropdown.Option,{onClick:()=>r(d,a)},{default:()=>[typeof d.content=="function"?d.content(a):d.content]}))})})}const Be={size:30};function De(e){e={...Be,...e||{}};function t(a,n){var d;const l=(d=document.getElementById(a))==null?void 0:d.getBoundingClientRect();if(l){const m=new Image(100,100);m.id=`IMAGE_${a}_PREVIEW`,m.src=n,m.setAttribute("style",["position:fixed;",`top:${l.top}px;`,`left:${l.left+l.width}px;`,"min-width:400px;","height:auto;","z-index:100;"].join("")),document.body.appendChild(m)}}function r(a){const n=document.getElementById(`IMAGE_${a}_PREVIEW`);n==null||n.remove()}return k("image",(a,n,l)=>{const d=S(a,n),m=Math.random().toString(32).slice(2).toUpperCase(),f={maxWidth:"100%",maxHeight:"100%",borderRadius:e==null?void 0:e.radius,objectFit:"contain",transform:`rotate(${(e==null?void 0:e.rotate)||0}deg)`,cursor:e!=null&&e.preview?"pointer":"unset"},o=`${n.index||n.key}_parsed`;if(e!=null&&e.parse){const s=e==null?void 0:e.parse(d,a);$(s)?s.then(y=>a[o]=y??""):a[o]=s??""}if(e!=null&&e.parse&&!a[o]===void 0)return u.createVNode("div",null,[u.createTextVNode("Loading...")]);{const s=a[o]||d;return s?u.createVNode("div",{id:m,onMouseenter:()=>(e==null?void 0:e.preview)&&!(l!=null&&l.previewing)&&t(m,s),onMouseleave:()=>(e==null?void 0:e.preview)&&!(l!=null&&l.previewing)&&r(m),style:{display:"flex",justifyContent:"center",alignItems:"center",height:`${e==null?void 0:e.size}px`}},[u.createVNode("img",{alt:"image",style:f,src:s},null)]):u.createVNode(u.Fragment,null,null)}})}function z(e){return u.getCurrentScope()?(u.onScopeDispose(e),!0):!1}function M(e){return typeof e=="function"?e():u.unref(e)}const Y=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Ie=Object.prototype.toString,Fe=e=>Ie.call(e)==="[object Object]",Ke=()=>{};function We(e){let t;function r(){return t||(t=e()),t}return r.reset=async()=>{const c=t;t=void 0,c&&await c},r}function He(e,t){var r;if(typeof e=="number")return e+t;const c=((r=e.match(/^-?\d+\.?\d*/))==null?void 0:r[0])||"",a=e.slice(c.length),n=Number.parseFloat(c)+t;return Number.isNaN(n)?e:n+a}function Ue(e,t,r={}){const{immediate:c=!0}=r,a=u.ref(!1);let n=null;function l(){n&&(clearTimeout(n),n=null)}function d(){a.value=!1,l()}function m(...f){l(),a.value=!0,n=setTimeout(()=>{a.value=!1,n=null,e(...f)},M(t))}return c&&(a.value=!0,Y&&m()),z(d),{isPending:u.readonly(a),start:m,stop:d}}function Ge(e){var t;const r=M(e);return(t=r==null?void 0:r.$el)!=null?t:r}const A=Y?window:void 0,re=Y?window.navigator:void 0;function ne(...e){let t,r,c,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([r,c,a]=e,t=A):[t,r,c,a]=e,!t)return Ke;Array.isArray(r)||(r=[r]),Array.isArray(c)||(c=[c]);const n=[],l=()=>{n.forEach(o=>o()),n.length=0},d=(o,s,y,h)=>(o.addEventListener(s,y,h),()=>o.removeEventListener(s,y,h)),m=u.watch(()=>[Ge(t),M(a)],([o,s])=>{if(l(),!o)return;const y=Fe(s)?{...s}:s;n.push(...r.flatMap(h=>c.map(v=>d(o,h,v,y))))},{immediate:!0,flush:"post"}),f=()=>{m(),l()};return z(f),f}function Je(){const e=u.ref(!1),t=u.getCurrentInstance();return t&&u.onMounted(()=>{e.value=!0},t),e}function B(e){const t=Je();return u.computed(()=>(t.value,!!e()))}function E(e,t={}){const{window:r=A}=t,c=B(()=>r&&"matchMedia"in r&&typeof r.matchMedia=="function");let a;const n=u.ref(!1),l=f=>{n.value=f.matches},d=()=>{a&&("removeEventListener"in a?a.removeEventListener("change",l):a.removeListener(l))},m=u.watchEffect(()=>{c.value&&(d(),a=r.matchMedia(M(e)),"addEventListener"in a?a.addEventListener("change",l):a.addListener(l),n.value=a.matches)});return z(()=>{m(),d(),a=void 0}),n}function Qe(e,t={}){function r(o,s){let y=M(e[M(o)]);return s!=null&&(y=He(y,s)),typeof y=="number"&&(y=`${y}px`),y}const{window:c=A,strategy:a="min-width"}=t;function n(o){return c?c.matchMedia(o).matches:!1}const l=o=>E(()=>`(min-width: ${r(o)})`,t),d=o=>E(()=>`(max-width: ${r(o)})`,t),m=Object.keys(e).reduce((o,s)=>(Object.defineProperty(o,s,{get:()=>a==="min-width"?l(s):d(s),enumerable:!0,configurable:!0}),o),{});function f(){const o=Object.keys(e).map(s=>[s,l(s)]);return u.computed(()=>o.filter(([,s])=>s.value).map(([s])=>s))}return Object.assign(m,{greaterOrEqual:l,smallerOrEqual:d,greater(o){return E(()=>`(min-width: ${r(o,.1)})`,t)},smaller(o){return E(()=>`(max-width: ${r(o,-.1)})`,t)},between(o,s){return E(()=>`(min-width: ${r(o)}) and (max-width: ${r(s,-.1)})`,t)},isGreater(o){return n(`(min-width: ${r(o,.1)})`)},isGreaterOrEqual(o){return n(`(min-width: ${r(o)})`)},isSmaller(o){return n(`(max-width: ${r(o,-.1)})`)},isSmallerOrEqual(o){return n(`(max-width: ${r(o)})`)},isInBetween(o,s){return n(`(min-width: ${r(o)}) and (max-width: ${r(s,-.1)})`)},current:f,active(){const o=f();return u.computed(()=>o.value.length===0?"":o.value.at(-1))}})}function Q(e,t={}){const{controls:r=!1,navigator:c=re}=t,a=B(()=>c&&"permissions"in c);let n;const l=typeof e=="string"?{name:e}:e,d=u.ref(),m=()=>{n&&(d.value=n.state)},f=We(async()=>{if(a.value){if(!n)try{n=await c.permissions.query(l),ne(n,"change",m),m()}catch{d.value="prompt"}return n}});return f(),r?{state:d,isSupported:a,query:f}:d}function Xe(e={}){const{navigator:t=re,read:r=!1,source:c,copiedDuring:a=1500,legacy:n=!1}=e,l=B(()=>t&&"clipboard"in t),d=Q("clipboard-read"),m=Q("clipboard-write"),f=u.computed(()=>l.value||n),o=u.ref(""),s=u.ref(!1),y=Ue(()=>s.value=!1,a);function h(){l.value&&V(d.value)?t.clipboard.readText().then(g=>{o.value=g}):o.value=_()}f.value&&r&&ne(["copy","cut"],h);async function v(g=M(c)){f.value&&g!=null&&(l.value&&V(m.value)?await t.clipboard.writeText(g):C(g),o.value=g,s.value=!0,y.start())}function C(g){const x=document.createElement("textarea");x.value=g??"",x.style.position="absolute",x.style.opacity="0",document.body.appendChild(x),x.select(),document.execCommand("copy"),x.remove()}function _(){var g,x,O;return(O=(x=(g=document==null?void 0:document.getSelection)==null?void 0:g.call(document))==null?void 0:x.toString())!=null?O:""}function V(g){return g==="granted"||g==="prompt"}return{isSupported:f,text:o,copied:s,copy:v}}const Ze=" ";function pe(e){return e==null?void 0:e.replace(/(\d{3})\d*(\d{4})/g,"$1****$2")}function X(e,t){return e==null?void 0:e.replace(/\*/g,"M").replace(/\B(?=(?:\S{4})+$)/g,t??Ze).replace(/M/g,"*")}function et(e){const t=Xe();return k("phone",(c,a)=>{const n=Math.random().toString(36).slice(2),l="__table__column_phone__",d=S(c,a),m=X(pe(d),e==null?void 0:e.separator),f=X(d,e==null?void 0:e.separator);function o(){window.focus(),t.copy(d).then(()=>{w.Message.success({content:"复制成功",duration:1e3})})}function s(){const C=document.getElementById(n),_=document.querySelectorAll(`.${l}`);_.length>0&&_.forEach(V=>{V.innerHTML=m}),C&&(C.innerHTML=f)}function y(){window.open(`tel:${d}`,"_blank")}const h=16,v=`cursor:pointer;width:${h}px;height:${h}px;`;return u.createVNode("div",{style:"display:flex;align-items:center;gap:4px;"},[u.createVNode("div",{class:l,id:n,style:"use-select:none;font-family: monospace;cursor:pointer;font-variant-numeric: tabular-nums;padding-right: 2px;"},[e!=null&&e.safe?m:f]),(e==null?void 0:e.safe)&&(e==null?void 0:e.allowPreview)&&u.createVNode("i",{title:"显示完整号码",style:v,onClick:s},[u.createVNode("svg",{width:h,height:h,viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u.createVNode("path",{d:"M24 36C35.0457 36 44 24 44 24C44 24 35.0457 12 24 12C12.9543 12 4 24 4 24C4 24 12.9543 36 24 36Z",fill:"none",stroke:"#333","stroke-width":"2","stroke-linejoin":"round"},null),u.createVNode("path",{d:"M24 29C26.7614 29 29 26.7614 29 24C29 21.2386 26.7614 19 24 19C21.2386 19 19 21.2386 19 24C19 26.7614 21.2386 29 24 29Z",fill:"none",stroke:"#333","stroke-width":"4","stroke-linejoin":"round"},null)])]),(e==null?void 0:e.allowDial)&&u.createVNode("i",{style:v,title:"拨出号码",onClick:y},[u.createVNode("svg",{width:h,height:h,viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u.createVNode("path",{d:"M41.7796 20.6066C42.0324 18.9108 41.9495 17.1747 41.5309 15.5054C40.978 13.3002 39.8392 11.2118 38.1147 9.4873C36.3902 7.76281 34.3018 6.62409 32.0967 6.07115C30.4274 5.65257 28.6912 5.56967 26.9954 5.82245",stroke:"#333","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null),u.createVNode("path",{d:"M34.1896 19.8035C34.4604 17.9869 33.8966 16.0699 32.4982 14.6715C31.0997 13.2731 29.1827 12.7092 27.3662 12.98",stroke:"#333","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round"},null),u.createVNode("path",{d:"M14.3755 8.79423C15.1021 8.79423 15.7715 9.18825 16.1241 9.82349L18.5706 14.2303C18.8909 14.8073 18.9059 15.5052 18.6108 16.0955L16.254 20.8091C16.254 20.8091 16.937 24.3206 19.7954 27.179C22.6538 30.0374 26.1535 30.7086 26.1535 30.7086L30.8664 28.3522C31.4571 28.0568 32.1555 28.0721 32.7327 28.393L37.152 30.85C37.7866 31.2028 38.1802 31.8719 38.1802 32.598L38.1802 37.6715C38.1802 40.2552 35.7803 42.1213 33.3322 41.2952C28.3043 39.5987 20.4996 36.3685 15.5528 31.4216C10.6059 26.4748 7.3757 18.6701 5.67916 13.6422C4.85314 11.1941 6.71923 8.79423 9.30288 8.79423L14.3755 8.79423Z",fill:"none",stroke:"#333","stroke-width":"4","stroke-linejoin":"round"},null)])]),(e==null?void 0:e.allowCopy)&&u.createVNode("i",{style:v,title:"复制号码",onClick:o},[u.createVNode("svg",{width:h,height:h,viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u.createVNode("path",{d:"M13 12.4316V7.8125C13 6.2592 14.2592 5 15.8125 5H40.1875C41.7408 5 43 6.2592 43 7.8125V32.1875C43 33.7408 41.7408 35 40.1875 35H35.5163",stroke:"#333","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null),u.createVNode("path",{d:"M32.1875 13H7.8125C6.2592 13 5 14.2592 5 15.8125V40.1875C5 41.7408 6.2592 43 7.8125 43H32.1875C33.7408 43 35 41.7408 35 40.1875V15.8125C35 14.2592 33.7408 13 32.1875 13Z",fill:"none",stroke:"#333","stroke-width":"4","stroke-linejoin":"round"},null)])])])})}function tt(e){return k("render",r=>e(r))}function rt(e){return k("tag",(r,c)=>{const a=(e==null?void 0:e.maxCount)||5,n=e!=null&&e.formatter?e.formatter(r):S(r,c),l=(e==null?void 0:e.textColors)||["#F87335"],d=(e==null?void 0:e.backgroundColors)||["#FFF4E8"],m=n.length>a,f=e==null?void 0:e.minWidth;return u.createVNode("div",{style:{display:"flex",flexWrap:"wrap"}},[n.slice(0,a).map((o,s)=>{const y=typeof l=="function"?l(o,s):l[s%l.length],h=typeof d=="function"?d(o,s):d[s%d.length];return u.createVNode("span",{style:{minWidth:f?`${f}px`:"unset",textAlign:"center",margin:"2px",padding:"2px 5px",border:`solid 2px ${e!=null&&e.border?y:"transparent"}`,borderRadius:`${(e==null?void 0:e.radius)||0}px`,color:y,backgroundColor:h}},[o])}),m&&"..."])})}function Z(e){if(typeof e=="string")return e;if(typeof e=="number")return`${e}px`}function nt(e,t,r){var c,a;return typeof e=="function"?(c=e(r))==null?void 0:c.toString():typeof(e==null?void 0:e.content)=="function"?(a=e==null?void 0:e.content(r))==null?void 0:a.toString():typeof(e==null?void 0:e.content)=="string"?e==null?void 0:e.content:S(r,t)}function at(e,t){if(typeof e!="function"){if(typeof(e==null?void 0:e.color)=="function")return e==null?void 0:e.color(t);if(typeof(e==null?void 0:e.color)=="string")return e==null?void 0:e.color}}function lt(e,t){if(typeof e!="function")return typeof(e==null?void 0:e.size)=="function"?Z(e==null?void 0:e.size(t)):Z(e==null?void 0:e.size)}function ut(e,t){let r="";const c=at(e,t),a=lt(e,t);return c&&(r+=`color:${c};`),a&&(r+=`font-size:${a};`),r}function ct(e){return k("text",(r,c)=>{const a=nt(e||{},c,r),n=ut(e||{},r);return u.createVNode("span",{style:n},[a])})}function dt(){return{dropdown:Ae,text:ct,dict:Ye,tag:rt,render:tt,phone:et,image:De,currency:Re,date:$e,button:_e}}function D(e,t){if(!(e!=null&&e.render))return;const r=e.render({...dt()});return{render:({record:c})=>r(c,e,t),[Me]:r.$type,disableColumnMode:r.$disableColumnMode,disableViewMode:r.$disableViewMode,isRender:r.$type==="render",type:r.$type}}function p({columns:e,columnsOptions:t,columnsGroups:r,pageMode:c,collapsedColumns:a,events:n}){const l=e.map(d=>({...t||{},...d})).map(d=>ft(d,c,a,n)).filter(Boolean);return ot(l,r)}function it(e,t){const r=[],c=n=>{if("children"in n&&(n.children=n.children.map(c)),"key"in n){const l=t.find(d=>{var m;return((m=Object.getOwnPropertyDescriptor(d,"key"))==null?void 0:m.value)===n.key});if(l)return r.push(l),l}return n},a=c(e);if(r!=null&&r.length&&a){const n=Math.min(...r.map(l=>t.indexOf(l)));r.forEach(l=>{const d=t.indexOf(l);t.splice(d,1)}),t.splice(n,0,a)}}function ot(e,t=[]){return t.forEach(r=>{it(r,e)}),e}function ft(e,t,r,c){const{render:a,disableColumnMode:n}=D(e,{previewing:!1,emits:c})||{};if(!(n||e.visiable===!1)&&!(typeof e.visiable=="function"&&e.visiable()===!1)&&!r.value.find(l=>l.key===e.key&&l.collapsed===!0))return{dataIndex:e.index||e.key,title:e.title,width:e.width==="auto"?void 0:e.width,align:e.align??"center",fixed:e.fixed,ellipsis:e.ellipsis??!0,sortable:e.sortable?{sorter:t==="server",sortDirections:["ascend","descend"],defaultSortOrder:e.sortable==="asc"?"ascend":"descend"}:void 0,tooltip:!0,...e.extraProps,key:e.key,render:a}}function st(){return new ke.Workbook}function mt(e,t="Sheet1"){return e.addWorksheet(t,{headerFooter:{firstHeader:"",firstFooter:""}})}function yt(e,t){e.columns=t}function bt(e,t){e.addRows(t)}async function ht({columns:e,rows:t,filename:r}){const c=st(),a=mt(c);yt(a,e),bt(a,t);const n=await c.xlsx.writeBuffer(),l=new Blob([n]);gt(l,r||`${L().format("YYYY-MM-DD HH:mm:ss")}.xlsx`)}function gt(e,t){const r=document.createElement("a");r.download=t||"download",r.href=URL.createObjectURL(e),r.click(),setTimeout(()=>{URL.revokeObjectURL(r.href)},1e3)}function wt(e,t){const r={};return e.filter(a=>a.exportable!==!1).map(a=>({options:a,render:D(a),content:typeof a.exportable=="object"?a.exportable.content:void 0})).forEach(a=>{var d;const n=(d=a.render)==null?void 0:d.render,l=()=>{var m;switch(!0){case!!a.content:return a.content&&a.content(t);case!!n:{const f=document.createElement("div"),o=u.h(()=>n&&n({record:t}));return u.render(o,f),(m=o.el)==null?void 0:m.innerText}default:return S(t,a.options)}};r[a.options.key]=l()}),r}function vt(e){switch(!0){case typeof e=="number":return e/6;case(typeof e=="string"&&e.endsWith("px")):return parseInt(e.replace("px",""))/6;default:return 30}}function Ct(e,t,r){const c=e.filter(n=>n.exportable!==!1).map(n=>{var l,d;return{key:n.key,header:((l=n.exportable)==null?void 0:l.header)||n.title,width:((d=n.exportable)==null?void 0:d.width)||vt(n.width)}}),a=t.map(n=>wt(e,n));ht({columns:c,rows:a,filename:r})}function xt(){return{exportExcel:Ct}}class I{constructor(t){T(this,"sort",{});T(this,"defaultSort",{});T(this,"before",t=>{t.paramsQuery={...t.paramsQuery||{},sort:this.stringify(this.sort)}});t&&(this.sort=t,this.defaultSort=t)}update(t,r){t&&r&&(this.sort[t]=r)}remove(t){const r=Object.entries(this.sort).filter(([c])=>c!==t);this.sort={},r&&r.forEach(([c,a])=>{this.sort[c]=a})}reset(){this.sort=this.defaultSort||{}}stringify(t){return typeof t!="object"?[]:(t instanceof I&&(t=t.sort),Object.entries(t).map(([r,c])=>`${r},${c}`))}}const kt=300;function St(e){const t=e,r=t==null?void 0:t.querySelector(".arco-scrollbar-container.arco-table-body");if(!r)return;let c,a=!1,n;r.addEventListener("mousedown",()=>{console.log("mousedown"),c=setTimeout(()=>{c&&(r.style.cursor="grab",r.style.userSelect="none",a=!0)},kt)}),r.addEventListener("mouseup",()=>{clearTimeout(c),c&&(c=void 0,a=!1,r.style.cursor="",r.style.userSelect="",n=void 0)}),r.addEventListener("mousemove",l=>{if(a)if(n===void 0)n=l.clientX;else{const d=n-l.clientX;n=l.clientX,r.scrollLeft+=d}})}function Vt(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!u.isVNode(e)}const Nt=u.defineComponent({props:{record:{type:Object,required:!0},columns:{type:Array,required:!0},minWidth:{type:Number,required:!1,default:320},border:{type:Boolean,default:!0},exclude:{type:Array,default:()=>[]},layout:{type:String,required:!1,default:"horizontal"},buttons:{type:Array,default:()=>[]}},setup(e){const t=u.getCurrentInstance(),r=u.ref(0),c=e.columns.filter(n=>typeof n.visiable=="boolean"?n.visiable:typeof n.visiable=="function"?n.visiable():!0).map(n=>({options:n,renderer:D(n,{previewing:!0})})).filter(({options:n})=>{var l;return!((l=e.exclude)!=null&&l.includes(n.key))}).filter(({renderer:n})=>!(n!=null&&n.disableViewMode));function a(){var n;if(t){const l=(n=t.proxy)==null?void 0:n.$el;r.value=Math.floor(l.offsetWidth/e.minWidth)}}return u.onMounted(()=>{a()}),()=>{let n;return u.createVNode("div",{class:"preview-container"},[u.createVNode(w.Descriptions,{column:r.value,bordered:!0,align:"left",layout:e.layout},Vt(n=c.map(l=>u.createVNode(w.DescriptionsItem,{label:l.options.title},{default:()=>{var d,m;return[(d=l.renderer)!=null&&d.render?(m=l.renderer)==null?void 0:m.render({record:e.record}):S(e.record,l.options)]}})))?n:{default:()=>[n]})])}}});function Tt(e,t,{tableForm:r,tableEvents:c}){const a=e.refreshable||e.exportable||t.slots.actions,n=!!(r!=null&&r.length)&&a;return a||n?()=>u.createVNode(u.Fragment,null,[n&&u.createVNode(w.Divider,{margin:0},null),a&&u.createVNode("div",{class:"table-actions",style:{display:"flex",justifyContent:"space-between",margin:"20px 0",flexDirection:e.actionsPosition==="right"?"row":"row-reverse",alignItems:"center"}},[u.createVNode("div",{class:"built-in"},[u.createVNode(w.Space,null,{default:()=>[e.refreshable&&u.createVNode(w.Button,{type:"primary",onClick:()=>c("reload")},{default:()=>[u.createTextVNode("刷新")]}),e.exportable&&u.createVNode(w.Button,{type:"primary",onClick:()=>c("export")},{default:()=>[u.createTextVNode("导出")]}),e.collapsable&&u.createVNode(w.Button,{type:"primary",onClick:()=>c("collapse")},{default:()=>[u.createTextVNode("显示")]})]})]),u.createVNode("div",{class:"customs"},[u.createVNode(w.Space,null,{default:()=>[t.slots.actions&&t.slots.actions()]})])])]):()=>{}}function Mt(e,t,{tableForm:r,tableEvents:c,formInstance:a}){return r!=null&&r.length?()=>u.createVNode("div",{class:"table-form"},[u.createVNode(ee.FormRender,u.mergeProps({form:r,ref:n=>a&&(a.value=n),searchable:!0,onSubmit:()=>c("reload",{reset:!0})},e.formOptions),null)]):()=>{}}function _t(e,t,{tableSource:r}){const c=u.ref([]);function a(){c.value=[],t.emit("update:radio-key",null),t.emit("update:radio-row",null),t.emit("update:checkbox-keys",[]),t.emit("update:checkbox-rows",[])}function n(){u.nextTick(()=>{e.checkboxRows!==void 0&&(c.value=[...e.checkboxRows.map(f=>f[e.rowKey])]),e.checkboxKeys!==void 0&&(c.value=[...e.checkboxKeys]),e.radioKey&&(c.value=[e.radioKey]),e.radioRow&&(c.value=[e.radioRow[e.rowKey]])})}function l(){const f=typeof e.selection=="string"?{type:e.selection}:e.selection;switch(f==null?void 0:f.type){case"radio":return{title:"选择",...f,selectedRowKeys:c.value};case"checkbox":return{showCheckedAll:!0,selectedRowKeys:c.value,...f}}}function d(f,o,s){const{type:y}=l()||{};switch(y){case"radio":t.emit("update:radio-key",o),t.emit("update:radio-row",s);break;case"checkbox":t.emit("update:checkbox-keys",f),t.emit("update:checkbox-rows",f.map(h=>{var v;return r.value.find(C=>C[e.rowKey]===h)||((v=e.checkboxRows)==null?void 0:v.find(C=>C[e.rowKey]===h))}));break}}function m(){u.nextTick(()=>{t.emit("update:checkbox-keys",c.value),t.emit("update:checkbox-rows",c.value.map(f=>{var o;return r.value.find(s=>s[e.rowKey]===f)||((o=e.checkboxRows)==null?void 0:o.find(s=>s[e.rowKey]===f))}))})}return n(),{selectedRowKeys:c,rowSelection:l(),onSelect:d,onSelectAll:m,resetSelection:a,reloadSelection:n}}function Ot(e,t,{pageService:r,tableEvents:c}){function a(d){r&&(r.pageIndex=d,c("reload"))}function n(d){r&&(r.pageSize=d,c("reload"))}const l=Qe({mobile:0,tablet:640,desktop:1024});return r?()=>u.createVNode("div",{class:"table-pagination",style:{padding:"10px 0"}},[u.createVNode(w.Pagination,{current:r.pageIndex,"onUpdate:current":d=>r.pageIndex=d,"page-size":r.pageSize,"onUpdate:page-size":d=>r.pageSize=d,total:r.total,"page-size-options":r.pageSizeOpts,"hide-on-single-page":!e.alwayShowPagination,"show-total":!0,"show-page-size":!0,simple:l.smaller("desktop").value,onChange:d=>a(d),onPageSizeChange:d=>n(d),style:{justifyContent:"flex-end"}},null)]):()=>{}}const Rt=u.defineComponent({props:{collapsedColumns:{type:Array,required:!0}},setup(e){const t=R.useModal(),r=u.ref(e.collapsedColumns.map(a=>({label:a.title,value:a.key,disabled:!1}))),c=u.ref(e.collapsedColumns.filter(a=>a.collapsed).map(a=>a.key));return R.onSubmit(()=>{const a=e.collapsedColumns.map(n=>({key:n.key,title:n.title,collapsed:c.value.includes(n.key)}));t.close(a)}),()=>u.createVNode("div",{class:"table-collapsed-render"},[u.createVNode(w.Transfer,{data:r.value,"default-value":c.value,onChange:a=>c.value=[...a],title:["显示列","隐藏列"],style:{justifyContent:"center"}},{default:()=>[u.withDirectives(u.createVNode("template",null,null),[[u.resolveDirective("slot"),"source"]])]})])}}),jt=u.defineComponent({props:{value:{type:Object,required:!0},form:{type:Array,required:!0},onSubmit:{type:Function,required:!1}},setup(e){const t=R.useModal();function r(c){e.onSubmit&&e.onSubmit(c),t.close(c)}return console.log(e.value),()=>u.createVNode("div",{class:"edit-form-container"},[u.createVNode(ee.FormRender,{name:"form",value:e.value,form:e.form,onSubmit:r},null)])}}),ae=u.defineComponent({props:{rowKey:{type:String,required:!0},form:{type:Object,required:!1},formOptions:{type:Object,required:!1},columns:{type:Object,required:!0},autoLoad:{type:Boolean,required:!1,default:!0},dataLoad:{type:Function,required:!1},height:{type:Number,required:!1},size:{type:String,required:!1,default:"large"},columnsOptions:{type:Object,required:!1},collapsable:{type:Boolean,required:!1,default:!1},selection:{type:[String,Object],required:!1},radioKey:{type:[String,Number],required:!1},checkboxKeys:{type:Array,required:!1},radioRow:{type:Object,required:!1},checkboxRows:{type:Array,required:!1},exportable:{type:[Boolean,Object],required:!1,default:!1},refreshable:{type:Boolean,required:!1},actionsPosition:{type:String,required:!1,default:"right"},pageable:{type:[Object,Boolean,String],required:!1,default:void 0},sortable:{type:[Object],required:!1},draggable:{type:Boolean,required:!1},hoverable:{type:Boolean,required:!1,default:!1},bordered:{type:Boolean,required:!1,default:!1},stripe:{type:Boolean,required:!1,default:!0},columnsGroups:{type:Array,required:!1,default:()=>[]},rowClass:{type:Function,required:!1},expandable:{type:Object,required:!1},grabbable:{type:Boolean,default:!0,required:!1},autoFill:{type:Boolean,default:!1,required:!1},alwayShowPagination:{type:Boolean,default:!1,required:!1}},expose:["preview","export","edit","reload","tableSource","formSource","update:radio-key","update:radio-row","update:checkbox-keys","update:checkbox-rows","formInstance","resetSelection","reloadSelection","reloadColumns","change"],setup(e,t){const r=Math.random().toString(32).slice(2).toUpperCase(),c=u.ref(),a=u.ref(),n=u.ref(),l=u.ref(),[d,m]=Ve(e.columns),f=u.ref(!1),o=e.form??Ne(e.columns),s=v(),y=_(),h=u.ref(e.columns.map(i=>({key:i.key,title:i.title,collapsed:!!i.collapsed})));function v(){switch(!0){case(typeof e.pageable=="string"&&e.pageable==="server"):return new P;case(typeof e.pageable=="boolean"&&e.pageable===!0):return new P;case(typeof e.pageable=="object"&&!!e.pageable.reset):return e.pageable;case(typeof e.pageable=="object"&&(!!e.pageable.index||!!e.pageable.size)):return new P(e.pageable.index,e.pageable.size)}}const C=(()=>{switch(!0){case typeof e.pageable=="string":return e.pageable;case(e.pageable===void 0||e.pageable===!1):return"client";default:return"server"}})();function _(){const i=e.columns.find(b=>!!b.sortable);if(i||e.sortable)return new I({...e.sortable||{},...i?{[i.key]:i.sortable}:{}})}function V(i){const{exportExcel:b}=xt();b((i==null?void 0:i.columns)||e.columns,(i==null?void 0:i.source)||d.value,(i==null?void 0:i.filename)||(typeof e.exportable=="object"?e.exportable.filename:void 0))}function g(i){let b;switch(!0){case!!(i!=null&&i.key):b=d.value.find(N=>N[e.rowKey]===(i==null?void 0:i.key));break;case!!(i!=null&&i.record):b=i==null?void 0:i.record;break}if(!b)throw new Error("未找到需要预览的数据");return n.value.open(Nt,{record:b,columns:e.columns},{title:(i==null?void 0:i.title)||"详情",mode:(i==null?void 0:i.mode)||"dialog"})}function x(i){let b;switch(!0){case!!(i!=null&&i.key):b=d.value.find(N=>N[e.rowKey]===(i==null?void 0:i.key));break;case!!(i!=null&&i.record):b=i==null?void 0:i.record;break}if(!b)throw new Error("未找到需要编辑的数据");return n.value.open(jt,{value:b,form:i==null?void 0:i.form,onSubmit:i.onSubmit},{title:(i==null?void 0:i.title)||"编辑",mode:(i==null?void 0:i.mode)||"dialog",footer:!0,form:"form"})}function O(i){var H,U;if(!e.dataLoad)return Promise.reject();i!=null&&i.reset&&(s&&s.reset(),y&&y.reset(),(H=c.value)==null||H.resetSorters());const b={...((U=a.value)==null?void 0:U.formSource)||{}};Object.keys(b).forEach(G=>{[null,void 0,""].includes(b[G])&&delete b[G]});const N=e.dataLoad({form:b,page:s,sort:y,update:m});return $(N)?(f.value=!0,Promise.resolve(N).finally(()=>{f.value=!1}),N):Promise.resolve()}function le(){n.value.open(Rt,{collapsedColumns:h.value},{title:"显示列",size:"small",footer:!0}).then(i=>{h.value=i})}const ue=(i,{type:b})=>{switch(b){case"drag":{m(i),t.emit("change",i);break}}},j=te({reload:O,preview:g,export:V,edit:x,collapse:le});function ce(i,b){!y||C==="client"||(b?y.update(i,b==="descend"?"desc":"asc"):y.remove(i),j("reload"))}const F=u.ref(p({columns:e.columns,columnsOptions:e.columnsOptions,columnsGroups:e.columnsGroups,pageMode:C,collapsedColumns:h,events:j})),q={tableEvents:j,tableForm:o,tableSource:d,formInstance:a,pageService:s,formOptions:e.formOptions},de=Mt(e,t,q),ie=Tt(e,t,q),oe=Ot(e,t,q),{selectedRowKeys:K,rowSelection:W,onSelect:fe,onSelectAll:se,reloadSelection:me,resetSelection:ye}=_t(e,t,q),be=u.computed(()=>({rowKey:e.rowKey,size:e.size,bordered:e.bordered,hoverable:e.hoverable,stripe:e.stripe,scroll:{x:e.columns.reduce((i,b)=>i+=typeof b.width!="number"?Math.max(b.title.length*16,80):b.width,0),y:e.height??"100%"},rowSelection:W,draggable:e.draggable?{type:"handle",width:40}:void 0,pagination:e.pageable===void 0||e.pageable==="client",selectedKeys:K.value,expandable:e.expandable}));function he(){F.value=p({columns:e.columns,columnsOptions:e.columnsOptions,columnsGroups:e.columnsGroups,pageMode:C,collapsedColumns:h,events:j})}return u.onMounted(()=>{l.value&&(l.value.id=`table-${r}`),e.autoLoad&&O(),e.grabbable&&l.value&&St(l.value)}),{tableId:r,tableInstance:c,tableSource:d,tableOptions:be,tableColumns:F,tableEvents:j,tableForm:o,tableLoading:f,modalInstance:n,tableRenderElement:l,formSource:u.readonly(u.computed(()=>{var i;return(i=a==null?void 0:a.value)==null?void 0:i.formSource})),formInstance:a,reload:O,preview:g,edit:x,export:V,onSorterChange:ce,onTableChange:ue,renders:{renderTableForm:de,renderTableActions:ie,renderTablePagination:oe},tableSelection:{selectedRowKeys:K,rowSelection:W,onSelect:fe,onSelectAll:se},resetSelection:ye,reloadSelection:me,reloadColumns:he}},render(){this.reloadColumns();const e=()=>u.createVNode("div",{class:"table-body"},[u.createVNode("div",{class:"table-body-wrapper"},[u.createVNode(w.Table,u.mergeProps({loading:this.tableLoading,data:this.tableSource,columns:this.tableColumns,ref:t=>this.tableInstance=t,onSelect:this.tableSelection.onSelect,onSelectAll:this.tableSelection.onSelectAll,onChange:this.onTableChange,rowClass:this.rowClass,onSorterChange:this.onSorterChange,selectedKeys:this.tableSelection.selectedRowKeys.value,"onUpdate:selectedKeys":t=>this.tableSelection.selectedRowKeys.value=t},this.tableOptions),null)])]);return u.createVNode("div",{class:{"table-render":!0,"auto-fill":this.autoFill},ref:t=>this.tableRenderElement=t},[u.createVNode(R.ModalProvider,{ref:t=>this.modalInstance=t},{default:()=>[u.createVNode("div",{class:"table-render-content"},[this.renders.renderTableForm(),this.renders.renderTableActions(),this.$slots.header&&this.$slots.header(),e(),this.renders.renderTablePagination()])]})])}});function Et(e){return e}function qt(e){return e}const $t={install(e,t){e.component("TableRender",ae)}};exports.TableRenderResolver=Ce.TableRenderResolver;exports.TableRender=ae;exports.default=$t;exports.defineColumns=Et;exports.defineTableLoad=qt;exports.useEvents=te;exports.useTable=Te;
|
|
1
|
+
"use strict";var ge=Object.defineProperty;var we=(e,t,r)=>t in e?ge(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var T=(e,t,r)=>(we(e,typeof t!="symbol"?t+"":t,r),r);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("vue"),w=require("@arco-design/web-vue"),R=require("@gopowerteam/modal-render"),ve=require("exceljs"),P=require("dayjs"),ee=require("@gopowerteam/form-render"),Ce=require("./resolver.cjs");function xe(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const c=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,c.get?c:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const ke=xe(ve);function Se(e,t,r){const[c,...a]=t.index?t.index.split(".").reverse():[t.key],n=a.reverse().reduce((l,d)=>l==null?void 0:l[d],e);n[c]=r}function Ve(e){const t=u.ref([]),r=a=>{const n=e.filter(l=>l.formatter);return n.length>0?a.map(l=>(n.forEach(d=>{d.formatter&&Se(l,d,d.formatter(l))}),l)):a};return[t,a=>{t.value=r(a)}]}function Ne(e){return e.filter(t=>t.form).map(t=>({key:t.key,title:t.title,...typeof t.form=="boolean"?{}:t.form}))}function Te(e){const t=u.getCurrentInstance(),r=u.ref();function c(){var n,l;const a=(l=(n=t==null?void 0:t.proxy)==null?void 0:n.$refs)==null?void 0:l[e];a&&(r.value=a)}return u.onMounted(c),u.onUpdated(c),r}function te(e){return(t,r)=>e[t](r)}class L{constructor(t=1,r=10){T(this,"data",u.reactive({index:1,size:10,total:0}));T(this,"pageSizeOpts",[10,20,30,40,50]);T(this,"pageLayouts",["PrevJump","PrevPage","JumpNumber","NextPage","NextJump","Sizes","FullJump","Total"]);this.pageIndex=t,this.pageSize=r}get pageIndex(){return this.data.index}set pageIndex(t){this.data.index=t}get pageSize(){return this.data.size}set pageSize(t){this.data.size=t}get total(){return this.data.total}set total(t){this.data.total=t}reset(){this.pageIndex=1}before(t){t.paramsQuery={...t.paramsQuery,page:this.pageIndex-1,size:this.pageSize}}after(t){var r;this.total=(r=t.data)==null?void 0:r.totalElements}}const Me=Symbol.for("RenderColumnType");function k(e,t,r){return t.$type=e,t.$disableColumnMode=r==null?void 0:r.disableColumnMode,t.$disableViewMode=r==null?void 0:r.disableViewMode,t}function S(e,t){return t.index?t.index.split(".").reduce((r,c)=>r==null?void 0:r[c],e):[t.key].reduce((r,c)=>r==null?void 0:r[c],e)}function q(e){return!!e&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function _e(e){return k("button",(r,c,a)=>{const n=R.useModal(),l=Array.isArray(e)?e:"buttons"in e?e.buttons:[e],d=(o,f)=>typeof o=="function"?o(r):o===void 0?f:o;async function m(o){if(await(o.confirm===!0?new Promise(s=>{n.confirm({title:"提示信息",content:o.confirmText??"您确定要执行该操作?",onOk:()=>s(!0),onCancel:()=>s(!1)})}):Promise.resolve(!0))&&(o!=null&&o.onClick)){const s=o.onClick(r);q(s)&&o.autoReload!==!1&&s.then(()=>{a!=null&&a.emits&&(a==null||a.emits("reload"))}),!q(s)&&o.autoReload===!0&&a!=null&&a.emits&&(a==null||a.emits("reload"))}}return u.createVNode(u.Fragment,null,[l.filter(o=>d(o.visiable,!0)).map(o=>u.createVNode(w.Button,{onClick:()=>m(o),type:o.type||"text",shape:o.shape,size:"mini",disabled:d(o.disabled,!1)},{icon:o.icon,default:()=>(typeof o.content=="function"?o.content(r):o.content)||""}))])},{disableViewMode:!0})}const Oe={thousands:!0,inputUnit:"元",outputUnit:"元"},J={分:10**0,元:10**2,万:10**6};function Re(e){e={...Oe,...e||{}};const t=n=>{if(n==null)return;if((e==null?void 0:e.inputUnit)===(e==null?void 0:e.outputUnit))return n;const l=J[e.inputUnit]/J[e.outputUnit],d=parseFloat((n*l).toFixed(10));return(e==null?void 0:e.precision)===void 0?d:d.toFixed(e==null?void 0:e.precision)},r=n=>{if(n==null)return;const l=n.toString().split(".");return l[0]=l[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),l.join(".")},c=n=>{if((e==null?void 0:e.zeroString)!==void 0&&Number(n)===0)return e==null?void 0:e.zeroString;if((e==null?void 0:e.nullString)!==void 0&&isNaN(Number(n)))return e==null?void 0:e.nullString;const l=t(Number(n));return e!=null&&e.thousands?r(l):l};return k("dict",(n,l)=>{const d=S(n,l);return u.createVNode("div",null,[typeof(e==null?void 0:e.prefix)=="string"?u.createVNode("span",null,[e.prefix]):typeof(e==null?void 0:e.prefix)=="function"?u.createVNode("span",null,[e.prefix()]):void 0,u.createVNode("span",{class:"currency_value"},[c(d)]),typeof(e==null?void 0:e.suffix)=="string"?u.createVNode("span",null,[e.suffix]):typeof(e==null?void 0:e.suffix)=="function"?u.createVNode("span",null,[e.suffix()]):void 0])})}var je=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},$e={exports:{}};(function(e,t){(function(r,c){e.exports=c(P)})(je,function(r){function c(l){return l&&typeof l=="object"&&"default"in l?l:{default:l}}var a=c(r),n={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(l,d){return d==="W"?l+"周":l+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(l,d){var m=100*l+d;return m<600?"凌晨":m<900?"早上":m<1100?"上午":m<1300?"中午":m<1800?"下午":"晚上"}};return a.default.locale(n,null,!0),n})})($e);P.locale("zh-cn");const Ee={date:"YYYY-MM-DD",datetime:"YYYY-MM-DD HH:mm:ss",time:"HH:mm:ss",week:"ddd"};function qe(e){return k("date",(r,c)=>{const a=S(r,c),n=typeof(e==null?void 0:e.format)=="function"?e==null?void 0:e.format():Ee[(e==null?void 0:e.format)||"datetime"],l=P(a);return u.createVNode("span",null,[l.isValid()&&l.format(n)])})}const Pe={success:"arcoblue",warning:"orange",error:"red"};function Le(e){return e instanceof Map?e:e.dict}function ze(e){const t=e instanceof Map?!1:e.tag;return typeof t=="string"?Pe[t]:t}function Ye(e){const t=Le(e),r=ze(e);return k("dict",(a,n)=>{const l=S(a,n);return r?u.createVNode(w.Tag,{color:r===!0?void 0:r},{default:()=>[t.get(l)||l]}):u.createVNode("span",null,[t.get(l)||l])})}function Ae(e){const t=R.useModal();async function r(a,n){a.confirm&&!await new Promise((d,m)=>{t.open("confirm",{title:"确认",content:a.confirmText||"是否确认执行该操作?",onOk:()=>d(!0),onCancel:()=>d(!1)})})||a.onClick(n)}return k("dropdown",(a,n)=>{const l=e.options.filter(d=>typeof d.visiable=="function"?d.visiable(a):d.visiable!==!1);return u.createVNode(w.Dropdown,{trigger:(e==null?void 0:e.trigger)||"click"},{default:()=>u.createVNode(w.Button,{disabled:l.length===0,type:"text"},{default:()=>[(e==null?void 0:e.content)||"操作"]}),content:()=>l.map(d=>u.createVNode(w.Dropdown.Option,{onClick:()=>r(d,a)},{default:()=>[typeof d.content=="function"?d.content(a):d.content]}))})})}const Be={size:30};function De(e){e={...Be,...e||{}};function t(a,n){var d;const l=(d=document.getElementById(a))==null?void 0:d.getBoundingClientRect();if(l){const m=new Image(100,100);m.id=`IMAGE_${a}_PREVIEW`,m.src=n,m.setAttribute("style",["position:fixed;",`top:${l.top}px;`,`left:${l.left+l.width}px;`,"min-width:400px;","height:auto;","z-index:100;"].join("")),document.body.appendChild(m)}}function r(a){const n=document.getElementById(`IMAGE_${a}_PREVIEW`);n==null||n.remove()}return k("image",(a,n,l)=>{const d=S(a,n),m=Math.random().toString(32).slice(2).toUpperCase(),o={maxWidth:"100%",maxHeight:"100%",borderRadius:e==null?void 0:e.radius,objectFit:"contain",transform:`rotate(${(e==null?void 0:e.rotate)||0}deg)`,cursor:e!=null&&e.preview?"pointer":"unset"},f=`${n.index||n.key}_parsed`;if(e!=null&&e.parse){const s=e==null?void 0:e.parse(d,a);q(s)?s.then(y=>a[f]=y??""):a[f]=s??""}if(e!=null&&e.parse&&!a[f]===void 0)return u.createVNode("div",null,[u.createTextVNode("Loading...")]);{const s=a[f]||d;return s?u.createVNode("div",{id:m,onMouseenter:()=>(e==null?void 0:e.preview)&&!(l!=null&&l.previewing)&&t(m,s),onMouseleave:()=>(e==null?void 0:e.preview)&&!(l!=null&&l.previewing)&&r(m),style:{display:"flex",justifyContent:"center",alignItems:"center",height:`${e==null?void 0:e.size}px`}},[u.createVNode("img",{alt:"image",style:o,src:s},null)]):u.createVNode(u.Fragment,null,null)}})}function z(e){return u.getCurrentScope()?(u.onScopeDispose(e),!0):!1}function M(e){return typeof e=="function"?e():u.unref(e)}const Y=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Ie=Object.prototype.toString,Fe=e=>Ie.call(e)==="[object Object]",Ke=()=>{};function We(e){let t;function r(){return t||(t=e()),t}return r.reset=async()=>{const c=t;t=void 0,c&&await c},r}function He(e,t){var r;if(typeof e=="number")return e+t;const c=((r=e.match(/^-?\d+\.?\d*/))==null?void 0:r[0])||"",a=e.slice(c.length),n=Number.parseFloat(c)+t;return Number.isNaN(n)?e:n+a}function Ue(e,t,r={}){const{immediate:c=!0}=r,a=u.ref(!1);let n=null;function l(){n&&(clearTimeout(n),n=null)}function d(){a.value=!1,l()}function m(...o){l(),a.value=!0,n=setTimeout(()=>{a.value=!1,n=null,e(...o)},M(t))}return c&&(a.value=!0,Y&&m()),z(d),{isPending:u.readonly(a),start:m,stop:d}}function Ge(e){var t;const r=M(e);return(t=r==null?void 0:r.$el)!=null?t:r}const A=Y?window:void 0,re=Y?window.navigator:void 0;function ne(...e){let t,r,c,a;if(typeof e[0]=="string"||Array.isArray(e[0])?([r,c,a]=e,t=A):[t,r,c,a]=e,!t)return Ke;Array.isArray(r)||(r=[r]),Array.isArray(c)||(c=[c]);const n=[],l=()=>{n.forEach(f=>f()),n.length=0},d=(f,s,y,h)=>(f.addEventListener(s,y,h),()=>f.removeEventListener(s,y,h)),m=u.watch(()=>[Ge(t),M(a)],([f,s])=>{if(l(),!f)return;const y=Fe(s)?{...s}:s;n.push(...r.flatMap(h=>c.map(v=>d(f,h,v,y))))},{immediate:!0,flush:"post"}),o=()=>{m(),l()};return z(o),o}function Je(){const e=u.ref(!1),t=u.getCurrentInstance();return t&&u.onMounted(()=>{e.value=!0},t),e}function B(e){const t=Je();return u.computed(()=>(t.value,!!e()))}function $(e,t={}){const{window:r=A}=t,c=B(()=>r&&"matchMedia"in r&&typeof r.matchMedia=="function");let a;const n=u.ref(!1),l=o=>{n.value=o.matches},d=()=>{a&&("removeEventListener"in a?a.removeEventListener("change",l):a.removeListener(l))},m=u.watchEffect(()=>{c.value&&(d(),a=r.matchMedia(M(e)),"addEventListener"in a?a.addEventListener("change",l):a.addListener(l),n.value=a.matches)});return z(()=>{m(),d(),a=void 0}),n}function Qe(e,t={}){function r(f,s){let y=M(e[M(f)]);return s!=null&&(y=He(y,s)),typeof y=="number"&&(y=`${y}px`),y}const{window:c=A,strategy:a="min-width"}=t;function n(f){return c?c.matchMedia(f).matches:!1}const l=f=>$(()=>`(min-width: ${r(f)})`,t),d=f=>$(()=>`(max-width: ${r(f)})`,t),m=Object.keys(e).reduce((f,s)=>(Object.defineProperty(f,s,{get:()=>a==="min-width"?l(s):d(s),enumerable:!0,configurable:!0}),f),{});function o(){const f=Object.keys(e).map(s=>[s,l(s)]);return u.computed(()=>f.filter(([,s])=>s.value).map(([s])=>s))}return Object.assign(m,{greaterOrEqual:l,smallerOrEqual:d,greater(f){return $(()=>`(min-width: ${r(f,.1)})`,t)},smaller(f){return $(()=>`(max-width: ${r(f,-.1)})`,t)},between(f,s){return $(()=>`(min-width: ${r(f)}) and (max-width: ${r(s,-.1)})`,t)},isGreater(f){return n(`(min-width: ${r(f,.1)})`)},isGreaterOrEqual(f){return n(`(min-width: ${r(f)})`)},isSmaller(f){return n(`(max-width: ${r(f,-.1)})`)},isSmallerOrEqual(f){return n(`(max-width: ${r(f)})`)},isInBetween(f,s){return n(`(min-width: ${r(f)}) and (max-width: ${r(s,-.1)})`)},current:o,active(){const f=o();return u.computed(()=>f.value.length===0?"":f.value.at(-1))}})}function Q(e,t={}){const{controls:r=!1,navigator:c=re}=t,a=B(()=>c&&"permissions"in c);let n;const l=typeof e=="string"?{name:e}:e,d=u.ref(),m=()=>{n&&(d.value=n.state)},o=We(async()=>{if(a.value){if(!n)try{n=await c.permissions.query(l),ne(n,"change",m),m()}catch{d.value="prompt"}return n}});return o(),r?{state:d,isSupported:a,query:o}:d}function Xe(e={}){const{navigator:t=re,read:r=!1,source:c,copiedDuring:a=1500,legacy:n=!1}=e,l=B(()=>t&&"clipboard"in t),d=Q("clipboard-read"),m=Q("clipboard-write"),o=u.computed(()=>l.value||n),f=u.ref(""),s=u.ref(!1),y=Ue(()=>s.value=!1,a);function h(){l.value&&V(d.value)?t.clipboard.readText().then(g=>{f.value=g}):f.value=_()}o.value&&r&&ne(["copy","cut"],h);async function v(g=M(c)){o.value&&g!=null&&(l.value&&V(m.value)?await t.clipboard.writeText(g):C(g),f.value=g,s.value=!0,y.start())}function C(g){const x=document.createElement("textarea");x.value=g??"",x.style.position="absolute",x.style.opacity="0",document.body.appendChild(x),x.select(),document.execCommand("copy"),x.remove()}function _(){var g,x,O;return(O=(x=(g=document==null?void 0:document.getSelection)==null?void 0:g.call(document))==null?void 0:x.toString())!=null?O:""}function V(g){return g==="granted"||g==="prompt"}return{isSupported:o,text:f,copied:s,copy:v}}const Ze=" ";function pe(e){return e==null?void 0:e.replace(/(\d{3})\d*(\d{4})/g,"$1****$2")}function X(e,t){return e==null?void 0:e.replace(/\*/g,"M").replace(/\B(?=(?:\S{4})+$)/g,t??Ze).replace(/M/g,"*")}function et(e){const t=Xe();return k("phone",(c,a)=>{const n=Math.random().toString(36).slice(2),l="__table__column_phone__",d=S(c,a),m=X(pe(d),e==null?void 0:e.separator),o=X(d,e==null?void 0:e.separator);function f(){window.focus(),t.copy(d).then(()=>{w.Message.success({content:"复制成功",duration:1e3})})}function s(){const C=document.getElementById(n),_=document.querySelectorAll(`.${l}`);_.length>0&&_.forEach(V=>{const g=V;g.innerHTML=g.dataset.encrypt}),C&&(C.innerHTML=o)}function y(){window.open(`tel:${d}`,"_blank")}const h=16,v=`cursor:pointer;width:${h}px;height:${h}px;`;return u.createVNode("div",{style:"display:flex;align-items:center;gap:4px;"},[u.createVNode("div",{"data-encrypt":m,class:l,id:n,style:"use-select:none;font-family: monospace;cursor:pointer;font-variant-numeric: tabular-nums;padding-right: 2px;"},[e!=null&&e.safe?m:o]),(e==null?void 0:e.safe)&&(e==null?void 0:e.allowPreview)&&u.createVNode("i",{title:"显示完整号码",style:v,onClick:s},[u.createVNode("svg",{width:h,height:h,viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u.createVNode("path",{d:"M24 36C35.0457 36 44 24 44 24C44 24 35.0457 12 24 12C12.9543 12 4 24 4 24C4 24 12.9543 36 24 36Z",fill:"none",stroke:"#333","stroke-width":"2","stroke-linejoin":"round"},null),u.createVNode("path",{d:"M24 29C26.7614 29 29 26.7614 29 24C29 21.2386 26.7614 19 24 19C21.2386 19 19 21.2386 19 24C19 26.7614 21.2386 29 24 29Z",fill:"none",stroke:"#333","stroke-width":"4","stroke-linejoin":"round"},null)])]),(e==null?void 0:e.allowDial)&&u.createVNode("i",{style:v,title:"拨出号码",onClick:y},[u.createVNode("svg",{width:h,height:h,viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u.createVNode("path",{d:"M41.7796 20.6066C42.0324 18.9108 41.9495 17.1747 41.5309 15.5054C40.978 13.3002 39.8392 11.2118 38.1147 9.4873C36.3902 7.76281 34.3018 6.62409 32.0967 6.07115C30.4274 5.65257 28.6912 5.56967 26.9954 5.82245",stroke:"#333","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null),u.createVNode("path",{d:"M34.1896 19.8035C34.4604 17.9869 33.8966 16.0699 32.4982 14.6715C31.0997 13.2731 29.1827 12.7092 27.3662 12.98",stroke:"#333","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round"},null),u.createVNode("path",{d:"M14.3755 8.79423C15.1021 8.79423 15.7715 9.18825 16.1241 9.82349L18.5706 14.2303C18.8909 14.8073 18.9059 15.5052 18.6108 16.0955L16.254 20.8091C16.254 20.8091 16.937 24.3206 19.7954 27.179C22.6538 30.0374 26.1535 30.7086 26.1535 30.7086L30.8664 28.3522C31.4571 28.0568 32.1555 28.0721 32.7327 28.393L37.152 30.85C37.7866 31.2028 38.1802 31.8719 38.1802 32.598L38.1802 37.6715C38.1802 40.2552 35.7803 42.1213 33.3322 41.2952C28.3043 39.5987 20.4996 36.3685 15.5528 31.4216C10.6059 26.4748 7.3757 18.6701 5.67916 13.6422C4.85314 11.1941 6.71923 8.79423 9.30288 8.79423L14.3755 8.79423Z",fill:"none",stroke:"#333","stroke-width":"4","stroke-linejoin":"round"},null)])]),(e==null?void 0:e.allowCopy)&&u.createVNode("i",{style:v,title:"复制号码",onClick:f},[u.createVNode("svg",{width:h,height:h,viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[u.createVNode("path",{d:"M13 12.4316V7.8125C13 6.2592 14.2592 5 15.8125 5H40.1875C41.7408 5 43 6.2592 43 7.8125V32.1875C43 33.7408 41.7408 35 40.1875 35H35.5163",stroke:"#333","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null),u.createVNode("path",{d:"M32.1875 13H7.8125C6.2592 13 5 14.2592 5 15.8125V40.1875C5 41.7408 6.2592 43 7.8125 43H32.1875C33.7408 43 35 41.7408 35 40.1875V15.8125C35 14.2592 33.7408 13 32.1875 13Z",fill:"none",stroke:"#333","stroke-width":"4","stroke-linejoin":"round"},null)])])])})}function tt(e){return k("render",r=>e(r))}function rt(e){return k("tag",(r,c)=>{const a=(e==null?void 0:e.maxCount)||5,n=e!=null&&e.formatter?e.formatter(r):S(r,c),l=(e==null?void 0:e.textColors)||["#F87335"],d=(e==null?void 0:e.backgroundColors)||["#FFF4E8"],m=n.length>a,o=e==null?void 0:e.minWidth;return u.createVNode("div",{style:{display:"flex",flexWrap:"wrap"}},[n.slice(0,a).map((f,s)=>{const y=typeof l=="function"?l(f,s):l[s%l.length],h=typeof d=="function"?d(f,s):d[s%d.length];return u.createVNode("span",{style:{minWidth:o?`${o}px`:"unset",textAlign:"center",margin:"2px",padding:"2px 5px",border:`solid 2px ${e!=null&&e.border?y:"transparent"}`,borderRadius:`${(e==null?void 0:e.radius)||0}px`,color:y,backgroundColor:h}},[f])}),m&&"..."])})}function Z(e){if(typeof e=="string")return e;if(typeof e=="number")return`${e}px`}function nt(e,t,r){var c,a;return typeof e=="function"?(c=e(r))==null?void 0:c.toString():typeof(e==null?void 0:e.content)=="function"?(a=e==null?void 0:e.content(r))==null?void 0:a.toString():typeof(e==null?void 0:e.content)=="string"?e==null?void 0:e.content:S(r,t)}function at(e,t){if(typeof e!="function"){if(typeof(e==null?void 0:e.color)=="function")return e==null?void 0:e.color(t);if(typeof(e==null?void 0:e.color)=="string")return e==null?void 0:e.color}}function lt(e,t){if(typeof e!="function")return typeof(e==null?void 0:e.size)=="function"?Z(e==null?void 0:e.size(t)):Z(e==null?void 0:e.size)}function ut(e,t){let r="";const c=at(e,t),a=lt(e,t);return c&&(r+=`color:${c};`),a&&(r+=`font-size:${a};`),r}function ct(e){return k("text",(r,c)=>{const a=nt(e||{},c,r),n=ut(e||{},r);return u.createVNode("span",{style:n},[a])})}function dt(e){const t=(e==null?void 0:e.backgroundColor)??"#f5f5f5",r=(e==null?void 0:e.foregroundColor)??"#1677ff",c=(e==null?void 0:e.showText)??!0,a=(e==null?void 0:e.textColor)??"#000";return k("progress",(l,d)=>{var y;const m=S(l,d),o=(e==null?void 0:e.precision)??0,f=Math.min(Math.max(((y=e==null?void 0:e.format)==null?void 0:y.call(e,m))??m,0),1),s=c?`${(f*100).toFixed(o)}%`:"";return u.createVNode("div",{style:`background-color:${t};position:relative;min-height: 20px;text-align: center;border-radius: 2px;overflow:hidden;`},[u.createVNode("div",{style:`background-color: ${r};position:absolute;left:0;top:0;right;0;width: ${s};height: 100%;`},null),c&&u.createVNode("div",{style:`position:absolute;inset:0;display:flex;justify-content:center;align-items:center;color:${a}`},[s])])})}function it(){return{dropdown:Ae,text:ct,dict:Ye,tag:rt,render:tt,phone:et,image:De,currency:Re,date:qe,button:_e,progress:dt}}function D(e,t){if(!(e!=null&&e.render))return;const r=e.render({...it()});return{render:({record:c})=>r(c,e,t),[Me]:r.$type,disableColumnMode:r.$disableColumnMode,disableViewMode:r.$disableViewMode,isRender:r.$type==="render",type:r.$type}}function p({columns:e,columnsOptions:t,columnsGroups:r,pageMode:c,collapsedColumns:a,events:n}){const l=e.map(d=>({...t||{},...d})).map(d=>st(d,c,a,n)).filter(Boolean);return ot(l,r)}function ft(e,t){const r=[],c=n=>{if("children"in n&&(n.children=n.children.map(c)),"key"in n){const l=t.find(d=>{var m;return((m=Object.getOwnPropertyDescriptor(d,"key"))==null?void 0:m.value)===n.key});if(l)return r.push(l),l}return n},a=c(e);if(r!=null&&r.length&&a){const n=Math.min(...r.map(l=>t.indexOf(l)));r.forEach(l=>{const d=t.indexOf(l);t.splice(d,1)}),t.splice(n,0,a)}}function ot(e,t=[]){return t.forEach(r=>{ft(r,e)}),e}function st(e,t,r,c){const{render:a,disableColumnMode:n}=D(e,{previewing:!1,emits:c})||{};if(!(n||e.visiable===!1)&&!(typeof e.visiable=="function"&&e.visiable()===!1)&&!r.value.find(l=>l.key===e.key&&l.collapsed===!0))return{dataIndex:e.index||e.key,title:e.title,width:e.width==="auto"?void 0:e.width,align:e.align??"center",fixed:e.fixed,ellipsis:e.ellipsis??!0,sortable:e.sortable?{sorter:t==="server",sortDirections:["ascend","descend"],defaultSortOrder:e.sortable==="asc"?"ascend":"descend"}:void 0,tooltip:!0,...e.extraProps,key:e.key,render:a}}function mt(){return new ke.Workbook}function yt(e,t="Sheet1"){return e.addWorksheet(t,{headerFooter:{firstHeader:"",firstFooter:""}})}function bt(e,t){e.columns=t}function ht(e,t){e.addRows(t)}async function gt({columns:e,rows:t,filename:r}){const c=mt(),a=yt(c);bt(a,e),ht(a,t);const n=await c.xlsx.writeBuffer(),l=new Blob([n]);wt(l,r||`${P().format("YYYY-MM-DD HH:mm:ss")}.xlsx`)}function wt(e,t){const r=document.createElement("a");r.download=t||"download",r.href=URL.createObjectURL(e),r.click(),setTimeout(()=>{URL.revokeObjectURL(r.href)},1e3)}function vt(e,t){const r={};return e.filter(a=>a.exportable!==!1).map(a=>({options:a,render:D(a),content:typeof a.exportable=="object"?a.exportable.content:void 0})).forEach(a=>{var d;const n=(d=a.render)==null?void 0:d.render,l=()=>{var m;switch(!0){case!!a.content:return a.content&&a.content(t);case!!n:{const o=document.createElement("div"),f=u.h(()=>n&&n({record:t}));return u.render(f,o),(m=f.el)==null?void 0:m.innerText}default:return S(t,a.options)}};r[a.options.key]=l()}),r}function Ct(e){switch(!0){case typeof e=="number":return e/6;case(typeof e=="string"&&e.endsWith("px")):return parseInt(e.replace("px",""))/6;default:return 30}}function xt(e,t,r){const c=e.filter(n=>n.exportable!==!1).map(n=>{var l,d;return{key:n.key,header:((l=n.exportable)==null?void 0:l.header)||n.title,width:((d=n.exportable)==null?void 0:d.width)||Ct(n.width)}}),a=t.map(n=>vt(e,n));gt({columns:c,rows:a,filename:r})}function kt(){return{exportExcel:xt}}class I{constructor(t){T(this,"sort",{});T(this,"defaultSort",{});T(this,"before",t=>{t.paramsQuery={...t.paramsQuery||{},sort:this.stringify(this.sort)}});t&&(this.sort=t,this.defaultSort=t)}update(t,r){t&&r&&(this.sort[t]=r)}remove(t){const r=Object.entries(this.sort).filter(([c])=>c!==t);this.sort={},r&&r.forEach(([c,a])=>{this.sort[c]=a})}reset(){this.sort=this.defaultSort||{}}stringify(t){return typeof t!="object"?[]:(t instanceof I&&(t=t.sort),Object.entries(t).map(([r,c])=>`${r},${c}`))}}const St=300;function Vt(e){const t=e,r=t==null?void 0:t.querySelector(".arco-scrollbar-container.arco-table-body");if(!r)return;let c,a=!1,n;r.addEventListener("mousedown",()=>{console.log("mousedown"),c=setTimeout(()=>{c&&(r.style.cursor="grab",r.style.userSelect="none",a=!0)},St)}),r.addEventListener("mouseup",()=>{clearTimeout(c),c&&(c=void 0,a=!1,r.style.cursor="",r.style.userSelect="",n=void 0)}),r.addEventListener("mousemove",l=>{if(a)if(n===void 0)n=l.clientX;else{const d=n-l.clientX;n=l.clientX,r.scrollLeft+=d}})}function Nt(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!u.isVNode(e)}const Tt=u.defineComponent({props:{record:{type:Object,required:!0},columns:{type:Array,required:!0},minWidth:{type:Number,required:!1,default:320},border:{type:Boolean,default:!0},exclude:{type:Array,default:()=>[]},layout:{type:String,required:!1,default:"horizontal"},buttons:{type:Array,default:()=>[]}},setup(e){const t=u.getCurrentInstance(),r=u.ref(0),c=e.columns.filter(n=>typeof n.visiable=="boolean"?n.visiable:typeof n.visiable=="function"?n.visiable():!0).map(n=>({options:n,renderer:D(n,{previewing:!0})})).filter(({options:n})=>{var l;return!((l=e.exclude)!=null&&l.includes(n.key))}).filter(({renderer:n})=>!(n!=null&&n.disableViewMode));function a(){var n;if(t){const l=(n=t.proxy)==null?void 0:n.$el;r.value=Math.floor(l.offsetWidth/e.minWidth)}}return u.onMounted(()=>{a()}),()=>{let n;return u.createVNode("div",{class:"preview-container"},[u.createVNode(w.Descriptions,{column:r.value,bordered:!0,align:"left",layout:e.layout},Nt(n=c.map(l=>u.createVNode(w.DescriptionsItem,{label:l.options.title},{default:()=>{var d,m;return[(d=l.renderer)!=null&&d.render?(m=l.renderer)==null?void 0:m.render({record:e.record}):S(e.record,l.options)]}})))?n:{default:()=>[n]})])}}});function Mt(e,t,{tableForm:r,tableEvents:c}){const a=e.refreshable||e.exportable||t.slots.actions,n=!!(r!=null&&r.length)&&a;return a||n?()=>u.createVNode(u.Fragment,null,[n&&u.createVNode(w.Divider,{margin:0},null),a&&u.createVNode("div",{class:"table-actions",style:{display:"flex",justifyContent:"space-between",margin:"20px 0",flexDirection:e.actionsPosition==="right"?"row":"row-reverse",alignItems:"center"}},[u.createVNode("div",{class:"built-in"},[u.createVNode(w.Space,null,{default:()=>[e.refreshable&&u.createVNode(w.Button,{type:"primary",onClick:()=>c("reload")},{default:()=>[u.createTextVNode("刷新")]}),e.exportable&&u.createVNode(w.Button,{type:"primary",onClick:()=>c("export")},{default:()=>[u.createTextVNode("导出")]}),e.collapsable&&u.createVNode(w.Button,{type:"primary",onClick:()=>c("collapse")},{default:()=>[u.createTextVNode("显示")]})]})]),u.createVNode("div",{class:"customs"},[u.createVNode(w.Space,null,{default:()=>[t.slots.actions&&t.slots.actions()]})])])]):()=>{}}function _t(e,t,{tableForm:r,tableEvents:c,formInstance:a}){return r!=null&&r.length?()=>u.createVNode("div",{class:"table-form"},[u.createVNode(ee.FormRender,u.mergeProps({form:r,ref:n=>a&&(a.value=n),searchable:!0,onSubmit:()=>c("reload",{reset:!0})},e.formOptions),null)]):()=>{}}function Ot(e,t,{tableSource:r}){const c=u.ref([]);function a(){c.value=[],t.emit("update:radio-key",null),t.emit("update:radio-row",null),t.emit("update:checkbox-keys",[]),t.emit("update:checkbox-rows",[])}function n(){u.nextTick(()=>{e.checkboxRows!==void 0&&(c.value=[...e.checkboxRows.map(o=>o[e.rowKey])]),e.checkboxKeys!==void 0&&(c.value=[...e.checkboxKeys]),e.radioKey&&(c.value=[e.radioKey]),e.radioRow&&(c.value=[e.radioRow[e.rowKey]])})}function l(){const o=typeof e.selection=="string"?{type:e.selection}:e.selection;switch(o==null?void 0:o.type){case"radio":return{title:"选择",...o,selectedRowKeys:c.value};case"checkbox":return{showCheckedAll:!0,selectedRowKeys:c.value,...o}}}function d(o,f,s){const{type:y}=l()||{};switch(y){case"radio":t.emit("update:radio-key",f),t.emit("update:radio-row",s);break;case"checkbox":t.emit("update:checkbox-keys",o),t.emit("update:checkbox-rows",o.map(h=>{var v;return r.value.find(C=>C[e.rowKey]===h)||((v=e.checkboxRows)==null?void 0:v.find(C=>C[e.rowKey]===h))}));break}}function m(){u.nextTick(()=>{t.emit("update:checkbox-keys",c.value),t.emit("update:checkbox-rows",c.value.map(o=>{var f;return r.value.find(s=>s[e.rowKey]===o)||((f=e.checkboxRows)==null?void 0:f.find(s=>s[e.rowKey]===o))}))})}return n(),{selectedRowKeys:c,rowSelection:l(),onSelect:d,onSelectAll:m,resetSelection:a,reloadSelection:n}}function Rt(e,t,{pageService:r,tableEvents:c}){function a(d){r&&(r.pageIndex=d,c("reload"))}function n(d){r&&(r.pageSize=d,c("reload"))}const l=Qe({mobile:0,tablet:640,desktop:1024});return r?()=>u.createVNode("div",{class:"table-pagination",style:{padding:"10px 0"}},[u.createVNode(w.Pagination,{current:r.pageIndex,"onUpdate:current":d=>r.pageIndex=d,"page-size":r.pageSize,"onUpdate:page-size":d=>r.pageSize=d,total:r.total,"page-size-options":r.pageSizeOpts,"hide-on-single-page":!e.alwayShowPagination,"show-total":!0,"show-page-size":!0,simple:l.smaller("desktop").value,onChange:d=>a(d),onPageSizeChange:d=>n(d),style:{justifyContent:"flex-end"}},null)]):()=>{}}const jt=u.defineComponent({props:{collapsedColumns:{type:Array,required:!0}},setup(e){const t=R.useModal(),r=u.ref(e.collapsedColumns.map(a=>({label:a.title,value:a.key,disabled:!1}))),c=u.ref(e.collapsedColumns.filter(a=>a.collapsed).map(a=>a.key));return R.onSubmit(()=>{const a=e.collapsedColumns.map(n=>({key:n.key,title:n.title,collapsed:c.value.includes(n.key)}));t.close(a)}),()=>u.createVNode("div",{class:"table-collapsed-render"},[u.createVNode(w.Transfer,{data:r.value,"default-value":c.value,onChange:a=>c.value=[...a],title:["显示列","隐藏列"],style:{justifyContent:"center"}},{default:()=>[u.withDirectives(u.createVNode("template",null,null),[[u.resolveDirective("slot"),"source"]])]})])}}),$t=u.defineComponent({props:{value:{type:Object,required:!0},form:{type:Array,required:!0},onSubmit:{type:Function,required:!1}},setup(e){const t=R.useModal();function r(c){e.onSubmit&&e.onSubmit(c),t.close(c)}return console.log(e.value),()=>u.createVNode("div",{class:"edit-form-container"},[u.createVNode(ee.FormRender,{name:"form",value:e.value,form:e.form,onSubmit:r},null)])}}),ae=u.defineComponent({props:{rowKey:{type:String,required:!0},form:{type:Object,required:!1},formOptions:{type:Object,required:!1},columns:{type:Object,required:!0},autoLoad:{type:Boolean,required:!1,default:!0},dataLoad:{type:Function,required:!1},height:{type:Number,required:!1},size:{type:String,required:!1,default:"large"},columnsOptions:{type:Object,required:!1},collapsable:{type:Boolean,required:!1,default:!1},selection:{type:[String,Object],required:!1},radioKey:{type:[String,Number],required:!1},checkboxKeys:{type:Array,required:!1},radioRow:{type:Object,required:!1},checkboxRows:{type:Array,required:!1},exportable:{type:[Boolean,Object],required:!1,default:!1},refreshable:{type:Boolean,required:!1},actionsPosition:{type:String,required:!1,default:"right"},pageable:{type:[Object,Boolean,String],required:!1,default:void 0},sortable:{type:[Object],required:!1},draggable:{type:Boolean,required:!1},hoverable:{type:Boolean,required:!1,default:!1},bordered:{type:Boolean,required:!1,default:!1},stripe:{type:Boolean,required:!1,default:!0},columnsGroups:{type:Array,required:!1,default:()=>[]},rowClass:{type:Function,required:!1},expandable:{type:Object,required:!1},grabbable:{type:Boolean,default:!0,required:!1},autoFill:{type:Boolean,default:!1,required:!1},alwayShowPagination:{type:Boolean,default:!1,required:!1}},expose:["preview","export","edit","reload","tableSource","formSource","update:radio-key","update:radio-row","update:checkbox-keys","update:checkbox-rows","formInstance","resetSelection","reloadSelection","reloadColumns","change"],setup(e,t){const r=Math.random().toString(32).slice(2).toUpperCase(),c=u.ref(),a=u.ref(),n=u.ref(),l=u.ref(),[d,m]=Ve(e.columns),o=u.ref(!1),f=e.form??Ne(e.columns),s=v(),y=_(),h=u.ref(e.columns.map(i=>({key:i.key,title:i.title,collapsed:!!i.collapsed})));function v(){switch(!0){case(typeof e.pageable=="string"&&e.pageable==="server"):return new L;case(typeof e.pageable=="boolean"&&e.pageable===!0):return new L;case(typeof e.pageable=="object"&&!!e.pageable.reset):return e.pageable;case(typeof e.pageable=="object"&&(!!e.pageable.index||!!e.pageable.size)):return new L(e.pageable.index,e.pageable.size)}}const C=(()=>{switch(!0){case typeof e.pageable=="string":return e.pageable;case(e.pageable===void 0||e.pageable===!1):return"client";default:return"server"}})();function _(){const i=e.columns.find(b=>!!b.sortable);if(i||e.sortable)return new I({...e.sortable||{},...i?{[i.key]:i.sortable}:{}})}function V(i){const{exportExcel:b}=kt();b((i==null?void 0:i.columns)||e.columns,(i==null?void 0:i.source)||d.value,(i==null?void 0:i.filename)||(typeof e.exportable=="object"?e.exportable.filename:void 0))}function g(i){let b;switch(!0){case!!(i!=null&&i.key):b=d.value.find(N=>N[e.rowKey]===(i==null?void 0:i.key));break;case!!(i!=null&&i.record):b=i==null?void 0:i.record;break}if(!b)throw new Error("未找到需要预览的数据");return n.value.open(Tt,{record:b,columns:e.columns},{title:(i==null?void 0:i.title)||"详情",mode:(i==null?void 0:i.mode)||"dialog"})}function x(i){let b;switch(!0){case!!(i!=null&&i.key):b=d.value.find(N=>N[e.rowKey]===(i==null?void 0:i.key));break;case!!(i!=null&&i.record):b=i==null?void 0:i.record;break}if(!b)throw new Error("未找到需要编辑的数据");return n.value.open($t,{value:b,form:i==null?void 0:i.form,onSubmit:i.onSubmit},{title:(i==null?void 0:i.title)||"编辑",mode:(i==null?void 0:i.mode)||"dialog",footer:!0,form:"form"})}function O(i){var H,U;if(!e.dataLoad)return Promise.reject();i!=null&&i.reset&&(s&&s.reset(),y&&y.reset(),(H=c.value)==null||H.resetSorters());const b={...((U=a.value)==null?void 0:U.formSource)||{}};Object.keys(b).forEach(G=>{[null,void 0,""].includes(b[G])&&delete b[G]});const N=e.dataLoad({form:b,page:s,sort:y,update:m});return q(N)?(o.value=!0,Promise.resolve(N).finally(()=>{o.value=!1}),N):Promise.resolve()}function le(){n.value.open(jt,{collapsedColumns:h.value},{title:"显示列",size:"small",footer:!0}).then(i=>{h.value=i})}const ue=(i,{type:b})=>{switch(b){case"drag":{m(i),t.emit("change",i);break}}},j=te({reload:O,preview:g,export:V,edit:x,collapse:le});function ce(i,b){!y||C==="client"||(b?y.update(i,b==="descend"?"desc":"asc"):y.remove(i),j("reload"))}const F=u.ref(p({columns:e.columns,columnsOptions:e.columnsOptions,columnsGroups:e.columnsGroups,pageMode:C,collapsedColumns:h,events:j})),E={tableEvents:j,tableForm:f,tableSource:d,formInstance:a,pageService:s,formOptions:e.formOptions},de=_t(e,t,E),ie=Mt(e,t,E),fe=Rt(e,t,E),{selectedRowKeys:K,rowSelection:W,onSelect:oe,onSelectAll:se,reloadSelection:me,resetSelection:ye}=Ot(e,t,E),be=u.computed(()=>({rowKey:e.rowKey,size:e.size,bordered:e.bordered,hoverable:e.hoverable,stripe:e.stripe,scroll:{x:e.columns.reduce((i,b)=>i+=typeof b.width!="number"?Math.max(b.title.length*16,80):b.width,0),y:e.height??"100%"},rowSelection:W,draggable:e.draggable?{type:"handle",width:40}:void 0,pagination:e.pageable===void 0||e.pageable==="client",selectedKeys:K.value,expandable:e.expandable}));function he(){F.value=p({columns:e.columns,columnsOptions:e.columnsOptions,columnsGroups:e.columnsGroups,pageMode:C,collapsedColumns:h,events:j})}return u.onMounted(()=>{l.value&&(l.value.id=`table-${r}`),e.autoLoad&&O(),e.grabbable&&l.value&&Vt(l.value)}),{tableId:r,tableInstance:c,tableSource:d,tableOptions:be,tableColumns:F,tableEvents:j,tableForm:f,tableLoading:o,modalInstance:n,tableRenderElement:l,formSource:u.readonly(u.computed(()=>{var i;return(i=a==null?void 0:a.value)==null?void 0:i.formSource})),formInstance:a,reload:O,preview:g,edit:x,export:V,onSorterChange:ce,onTableChange:ue,renders:{renderTableForm:de,renderTableActions:ie,renderTablePagination:fe},tableSelection:{selectedRowKeys:K,rowSelection:W,onSelect:oe,onSelectAll:se},resetSelection:ye,reloadSelection:me,reloadColumns:he}},render(){this.reloadColumns();const e=()=>u.createVNode("div",{class:"table-body"},[u.createVNode("div",{class:"table-body-wrapper"},[u.createVNode(w.Table,u.mergeProps({loading:this.tableLoading,data:this.tableSource,columns:this.tableColumns,ref:t=>this.tableInstance=t,onSelect:this.tableSelection.onSelect,onSelectAll:this.tableSelection.onSelectAll,onChange:this.onTableChange,rowClass:this.rowClass,onSorterChange:this.onSorterChange,selectedKeys:this.tableSelection.selectedRowKeys.value,"onUpdate:selectedKeys":t=>this.tableSelection.selectedRowKeys.value=t},this.tableOptions),null)])]);return u.createVNode("div",{class:{"table-render":!0,"auto-fill":this.autoFill},ref:t=>this.tableRenderElement=t},[u.createVNode(R.ModalProvider,{ref:t=>this.modalInstance=t},{default:()=>[u.createVNode("div",{class:"table-render-content"},[this.renders.renderTableForm(),this.renders.renderTableActions(),this.$slots.header&&this.$slots.header(),e(),this.renders.renderTablePagination()])]})])}});function Et(e){return e}function qt(e){return e}const Pt={install(e,t){e.component("TableRender",ae)}};exports.TableRenderResolver=Ce.TableRenderResolver;exports.TableRender=ae;exports.default=Pt;exports.defineColumns=Et;exports.defineTableLoad=qt;exports.useEvents=te;exports.useTable=Te;
|
|
@@ -9,4 +9,5 @@ export declare function TableColumnRenders<T>(): {
|
|
|
9
9
|
currency: (options?: import('./currency').CurrencyColumnOptions) => import('..').TableColumnRenderResult<T>;
|
|
10
10
|
date: (options?: import('./date').DateColumnOptions) => import('..').TableColumnRenderResult<T>;
|
|
11
11
|
button: (options: import('./button').RenderButtonColumnOptions<T>) => import('..').TableColumnRenderResult<T>;
|
|
12
|
+
progress: (options?: import('./progress').ProgressColumnOptions) => import('..').TableColumnRenderResult<T>;
|
|
12
13
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DataRecord } from '../../interfaces';
|
|
2
|
+
|
|
3
|
+
export interface ProgressColumnOptions {
|
|
4
|
+
showText?: boolean;
|
|
5
|
+
backgroundColor?: string;
|
|
6
|
+
foregroundColor?: string;
|
|
7
|
+
textColor?: string;
|
|
8
|
+
precision?: number;
|
|
9
|
+
format?: (value: DataRecord) => number;
|
|
10
|
+
}
|
|
11
|
+
export declare function renderProgressColumn<T = DataRecord>(options?: ProgressColumnOptions): import('../..').TableColumnRenderResult<T>;
|
package/dist/es/index.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
var Oe = Object.defineProperty;
|
|
2
2
|
var Re = (e, t, r) => t in e ? Oe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
-
var
|
|
4
|
-
import { ref as
|
|
5
|
-
import { Button as
|
|
3
|
+
var _ = (e, t, r) => (Re(e, typeof t != "symbol" ? t + "" : t, r), r);
|
|
4
|
+
import { ref as w, getCurrentInstance as F, onMounted as A, onUpdated as $e, reactive as Ee, createVNode as s, Fragment as K, createTextVNode as Y, getCurrentScope as je, onScopeDispose as Le, unref as Pe, readonly as fe, computed as E, watchEffect as qe, watch as Ye, h as ze, render as Ae, defineComponent as B, isVNode as Be, mergeProps as se, nextTick as re, withDirectives as De, resolveDirective as Ie } from "vue";
|
|
5
|
+
import { Button as P, Tag as Ve, Dropdown as ne, Message as Fe, Descriptions as Ke, DescriptionsItem as We, Divider as He, Space as ae, Pagination as Ne, Transfer as Ue, Table as Ge } from "@arco-design/web-vue";
|
|
6
6
|
import { useModal as D, onSubmit as Je, ModalProvider as Qe } from "@gopowerteam/modal-render";
|
|
7
7
|
import * as Xe from "exceljs";
|
|
8
8
|
import I from "dayjs";
|
|
9
9
|
import { FormRender as oe } from "@gopowerteam/form-render";
|
|
10
|
-
import { TableRenderResolver as
|
|
10
|
+
import { TableRenderResolver as xr } from "./resolver.mjs";
|
|
11
11
|
function Ze(e, t, r) {
|
|
12
12
|
const [u, ...a] = t.index ? t.index.split(".").reverse() : [t.key], n = a.reverse().reduce((l, c) => l == null ? void 0 : l[c], e);
|
|
13
13
|
n[u] = r;
|
|
14
14
|
}
|
|
15
15
|
function pe(e) {
|
|
16
|
-
const t =
|
|
16
|
+
const t = w([]), r = (a) => {
|
|
17
17
|
const n = e.filter((l) => l.formatter);
|
|
18
18
|
return n.length > 0 ? a.map((l) => (n.forEach((c) => {
|
|
19
19
|
c.formatter && Ze(l, c, c.formatter(l));
|
|
@@ -30,14 +30,14 @@ function et(e) {
|
|
|
30
30
|
...typeof t.form == "boolean" ? {} : t.form
|
|
31
31
|
}));
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
const t = F(), r =
|
|
33
|
+
function hr(e) {
|
|
34
|
+
const t = F(), r = w();
|
|
35
35
|
function u() {
|
|
36
36
|
var n, l;
|
|
37
37
|
const a = (l = (n = t == null ? void 0 : t.proxy) == null ? void 0 : n.$refs) == null ? void 0 : l[e];
|
|
38
38
|
a && (r.value = a);
|
|
39
39
|
}
|
|
40
|
-
return A(u),
|
|
40
|
+
return A(u), $e(u), r;
|
|
41
41
|
}
|
|
42
42
|
function tt(e) {
|
|
43
43
|
return (t, r) => e[t](r);
|
|
@@ -49,13 +49,13 @@ class V {
|
|
|
49
49
|
* @param size
|
|
50
50
|
*/
|
|
51
51
|
constructor(t = 1, r = 10) {
|
|
52
|
-
|
|
52
|
+
_(this, "data", Ee({
|
|
53
53
|
index: 1,
|
|
54
54
|
size: 10,
|
|
55
55
|
total: 0
|
|
56
56
|
}));
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
_(this, "pageSizeOpts", [10, 20, 30, 40, 50]);
|
|
58
|
+
_(this, "pageLayouts", ["PrevJump", "PrevPage", "JumpNumber", "NextPage", "NextJump", "Sizes", "FullJump", "Total"]);
|
|
59
59
|
this.pageIndex = t, this.pageSize = r;
|
|
60
60
|
}
|
|
61
61
|
get pageIndex() {
|
|
@@ -130,7 +130,7 @@ function nt(e) {
|
|
|
130
130
|
}), !z(o) && f.autoReload === !0 && a != null && a.emits && (a == null || a.emits("reload"));
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
-
return s(K, null, [l.filter((f) => c(f.visiable, !0)).map((f) => s(
|
|
133
|
+
return s(K, null, [l.filter((f) => c(f.visiable, !0)).map((f) => s(P, {
|
|
134
134
|
onClick: () => m(f),
|
|
135
135
|
type: f.type || "text",
|
|
136
136
|
shape: f.shape,
|
|
@@ -295,7 +295,7 @@ function yt(e) {
|
|
|
295
295
|
return s(ne, {
|
|
296
296
|
trigger: (e == null ? void 0 : e.trigger) || "click"
|
|
297
297
|
}, {
|
|
298
|
-
default: () => s(
|
|
298
|
+
default: () => s(P, {
|
|
299
299
|
disabled: l.length === 0,
|
|
300
300
|
type: "text"
|
|
301
301
|
}, {
|
|
@@ -365,10 +365,10 @@ function bt(e) {
|
|
|
365
365
|
});
|
|
366
366
|
}
|
|
367
367
|
function W(e) {
|
|
368
|
-
return
|
|
368
|
+
return je() ? (Le(e), !0) : !1;
|
|
369
369
|
}
|
|
370
370
|
function O(e) {
|
|
371
|
-
return typeof e == "function" ? e() :
|
|
371
|
+
return typeof e == "function" ? e() : Pe(e);
|
|
372
372
|
}
|
|
373
373
|
const H = typeof window < "u" && typeof document < "u";
|
|
374
374
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
@@ -394,7 +394,7 @@ function xt(e, t) {
|
|
|
394
394
|
function kt(e, t, r = {}) {
|
|
395
395
|
const {
|
|
396
396
|
immediate: u = !0
|
|
397
|
-
} = r, a =
|
|
397
|
+
} = r, a = w(!1);
|
|
398
398
|
let n = null;
|
|
399
399
|
function l() {
|
|
400
400
|
n && (clearTimeout(n), n = null);
|
|
@@ -443,30 +443,30 @@ function ye(...e) {
|
|
|
443
443
|
return W(f), f;
|
|
444
444
|
}
|
|
445
445
|
function Tt() {
|
|
446
|
-
const e =
|
|
446
|
+
const e = w(!1), t = F();
|
|
447
447
|
return t && A(() => {
|
|
448
448
|
e.value = !0;
|
|
449
449
|
}, t), e;
|
|
450
450
|
}
|
|
451
451
|
function U(e) {
|
|
452
452
|
const t = Tt();
|
|
453
|
-
return
|
|
453
|
+
return E(() => (t.value, !!e()));
|
|
454
454
|
}
|
|
455
455
|
function L(e, t = {}) {
|
|
456
456
|
const { window: r = N } = t, u = U(() => r && "matchMedia" in r && typeof r.matchMedia == "function");
|
|
457
457
|
let a;
|
|
458
|
-
const n =
|
|
458
|
+
const n = w(!1), l = (f) => {
|
|
459
459
|
n.value = f.matches;
|
|
460
460
|
}, c = () => {
|
|
461
461
|
a && ("removeEventListener" in a ? a.removeEventListener("change", l) : a.removeListener(l));
|
|
462
|
-
}, m =
|
|
462
|
+
}, m = qe(() => {
|
|
463
463
|
u.value && (c(), a = r.matchMedia(O(e)), "addEventListener" in a ? a.addEventListener("change", l) : a.addListener(l), n.value = a.matches);
|
|
464
464
|
});
|
|
465
465
|
return W(() => {
|
|
466
466
|
m(), c(), a = void 0;
|
|
467
467
|
}), n;
|
|
468
468
|
}
|
|
469
|
-
function
|
|
469
|
+
function Mt(e, t = {}) {
|
|
470
470
|
function r(d, o) {
|
|
471
471
|
let y = O(e[O(d)]);
|
|
472
472
|
return o != null && (y = xt(y, o)), typeof y == "number" && (y = `${y}px`), y;
|
|
@@ -482,7 +482,7 @@ function _t(e, t = {}) {
|
|
|
482
482
|
}), d), {});
|
|
483
483
|
function f() {
|
|
484
484
|
const d = Object.keys(e).map((o) => [o, l(o)]);
|
|
485
|
-
return
|
|
485
|
+
return E(() => d.filter(([, o]) => o.value).map(([o]) => o));
|
|
486
486
|
}
|
|
487
487
|
return Object.assign(m, {
|
|
488
488
|
greaterOrEqual: l,
|
|
@@ -514,7 +514,7 @@ function _t(e, t = {}) {
|
|
|
514
514
|
current: f,
|
|
515
515
|
active() {
|
|
516
516
|
const d = f();
|
|
517
|
-
return
|
|
517
|
+
return E(() => d.value.length === 0 ? "" : d.value.at(-1));
|
|
518
518
|
}
|
|
519
519
|
});
|
|
520
520
|
}
|
|
@@ -524,7 +524,7 @@ function ue(e, t = {}) {
|
|
|
524
524
|
navigator: u = me
|
|
525
525
|
} = t, a = U(() => u && "permissions" in u);
|
|
526
526
|
let n;
|
|
527
|
-
const l = typeof e == "string" ? { name: e } : e, c =
|
|
527
|
+
const l = typeof e == "string" ? { name: e } : e, c = w(), m = () => {
|
|
528
528
|
n && (c.value = n.state);
|
|
529
529
|
}, f = Ct(async () => {
|
|
530
530
|
if (a.value) {
|
|
@@ -543,33 +543,33 @@ function ue(e, t = {}) {
|
|
|
543
543
|
query: f
|
|
544
544
|
} : c;
|
|
545
545
|
}
|
|
546
|
-
function
|
|
546
|
+
function _t(e = {}) {
|
|
547
547
|
const {
|
|
548
548
|
navigator: t = me,
|
|
549
549
|
read: r = !1,
|
|
550
550
|
source: u,
|
|
551
551
|
copiedDuring: a = 1500,
|
|
552
552
|
legacy: n = !1
|
|
553
|
-
} = e, l = U(() => t && "clipboard" in t), c = ue("clipboard-read"), m = ue("clipboard-write"), f =
|
|
553
|
+
} = e, l = U(() => t && "clipboard" in t), c = ue("clipboard-read"), m = ue("clipboard-write"), f = E(() => l.value || n), d = w(""), o = w(!1), y = kt(() => o.value = !1, a);
|
|
554
554
|
function b() {
|
|
555
|
-
l.value && T(c.value) ? t.clipboard.readText().then((
|
|
556
|
-
d.value =
|
|
555
|
+
l.value && T(c.value) ? t.clipboard.readText().then((g) => {
|
|
556
|
+
d.value = g;
|
|
557
557
|
}) : d.value = R();
|
|
558
558
|
}
|
|
559
559
|
f.value && r && ye(["copy", "cut"], b);
|
|
560
|
-
async function v(
|
|
561
|
-
f.value &&
|
|
560
|
+
async function v(g = O(u)) {
|
|
561
|
+
f.value && g != null && (l.value && T(m.value) ? await t.clipboard.writeText(g) : C(g), d.value = g, o.value = !0, y.start());
|
|
562
562
|
}
|
|
563
|
-
function C(
|
|
563
|
+
function C(g) {
|
|
564
564
|
const x = document.createElement("textarea");
|
|
565
|
-
x.value =
|
|
565
|
+
x.value = g ?? "", x.style.position = "absolute", x.style.opacity = "0", document.body.appendChild(x), x.select(), document.execCommand("copy"), x.remove();
|
|
566
566
|
}
|
|
567
567
|
function R() {
|
|
568
|
-
var
|
|
569
|
-
return (
|
|
568
|
+
var g, x, $;
|
|
569
|
+
return ($ = (x = (g = document == null ? void 0 : document.getSelection) == null ? void 0 : g.call(document)) == null ? void 0 : x.toString()) != null ? $ : "";
|
|
570
570
|
}
|
|
571
|
-
function T(
|
|
572
|
-
return
|
|
571
|
+
function T(g) {
|
|
572
|
+
return g === "granted" || g === "prompt";
|
|
573
573
|
}
|
|
574
574
|
return {
|
|
575
575
|
isSupported: f,
|
|
@@ -585,8 +585,8 @@ function Rt(e) {
|
|
|
585
585
|
function ce(e, t) {
|
|
586
586
|
return e == null ? void 0 : e.replace(/\*/g, "M").replace(/\B(?=(?:\S{4})+$)/g, t ?? Ot).replace(/M/g, "*");
|
|
587
587
|
}
|
|
588
|
-
function
|
|
589
|
-
const t =
|
|
588
|
+
function $t(e) {
|
|
589
|
+
const t = _t();
|
|
590
590
|
return k("phone", (u, a) => {
|
|
591
591
|
const n = Math.random().toString(36).slice(2), l = "__table__column_phone__", c = S(u, a), m = ce(Rt(c), e == null ? void 0 : e.separator), f = ce(c, e == null ? void 0 : e.separator);
|
|
592
592
|
function d() {
|
|
@@ -600,7 +600,8 @@ function Et(e) {
|
|
|
600
600
|
function o() {
|
|
601
601
|
const C = document.getElementById(n), R = document.querySelectorAll(`.${l}`);
|
|
602
602
|
R.length > 0 && R.forEach((T) => {
|
|
603
|
-
|
|
603
|
+
const g = T;
|
|
604
|
+
g.innerHTML = g.dataset.encrypt;
|
|
604
605
|
}), C && (C.innerHTML = f);
|
|
605
606
|
}
|
|
606
607
|
function y() {
|
|
@@ -610,6 +611,7 @@ function Et(e) {
|
|
|
610
611
|
return s("div", {
|
|
611
612
|
style: "display:flex;align-items:center;gap:4px;"
|
|
612
613
|
}, [s("div", {
|
|
614
|
+
"data-encrypt": m,
|
|
613
615
|
class: l,
|
|
614
616
|
id: n,
|
|
615
617
|
style: "use-select:none;font-family: monospace;cursor:pointer;font-variant-numeric: tabular-nums;padding-right: 2px;"
|
|
@@ -688,10 +690,10 @@ function Et(e) {
|
|
|
688
690
|
}, null)])])]);
|
|
689
691
|
});
|
|
690
692
|
}
|
|
691
|
-
function
|
|
693
|
+
function Et(e) {
|
|
692
694
|
return k("render", (r) => e(r));
|
|
693
695
|
}
|
|
694
|
-
function
|
|
696
|
+
function jt(e) {
|
|
695
697
|
return k("tag", (r, u) => {
|
|
696
698
|
const a = (e == null ? void 0 : e.maxCount) || 5, n = e != null && e.formatter ? e.formatter(r) : S(r, u), l = (e == null ? void 0 : e.textColors) || ["#F87335"], c = (e == null ? void 0 : e.backgroundColors) || ["#FFF4E8"], m = n.length > a, f = e == null ? void 0 : e.minWidth;
|
|
697
699
|
return s("div", {
|
|
@@ -726,7 +728,7 @@ function Lt(e, t, r) {
|
|
|
726
728
|
var u, a;
|
|
727
729
|
return typeof e == "function" ? (u = e(r)) == null ? void 0 : u.toString() : typeof (e == null ? void 0 : e.content) == "function" ? (a = e == null ? void 0 : e.content(r)) == null ? void 0 : a.toString() : typeof (e == null ? void 0 : e.content) == "string" ? e == null ? void 0 : e.content : S(r, t);
|
|
728
730
|
}
|
|
729
|
-
function
|
|
731
|
+
function Pt(e, t) {
|
|
730
732
|
if (typeof e != "function") {
|
|
731
733
|
if (typeof (e == null ? void 0 : e.color) == "function")
|
|
732
734
|
return e == null ? void 0 : e.color(t);
|
|
@@ -734,13 +736,13 @@ function qt(e, t) {
|
|
|
734
736
|
return e == null ? void 0 : e.color;
|
|
735
737
|
}
|
|
736
738
|
}
|
|
737
|
-
function
|
|
739
|
+
function qt(e, t) {
|
|
738
740
|
if (typeof e != "function")
|
|
739
741
|
return typeof (e == null ? void 0 : e.size) == "function" ? ie(e == null ? void 0 : e.size(t)) : ie(e == null ? void 0 : e.size);
|
|
740
742
|
}
|
|
741
743
|
function Yt(e, t) {
|
|
742
744
|
let r = "";
|
|
743
|
-
const u =
|
|
745
|
+
const u = Pt(e, t), a = qt(e, t);
|
|
744
746
|
return u && (r += `color:${u};`), a && (r += `font-size:${a};`), r;
|
|
745
747
|
}
|
|
746
748
|
function zt(e) {
|
|
@@ -751,25 +753,40 @@ function zt(e) {
|
|
|
751
753
|
}, [a]);
|
|
752
754
|
});
|
|
753
755
|
}
|
|
754
|
-
function At() {
|
|
756
|
+
function At(e) {
|
|
757
|
+
const t = (e == null ? void 0 : e.backgroundColor) ?? "#f5f5f5", r = (e == null ? void 0 : e.foregroundColor) ?? "#1677ff", u = (e == null ? void 0 : e.showText) ?? !0, a = (e == null ? void 0 : e.textColor) ?? "#000";
|
|
758
|
+
return k("progress", (l, c) => {
|
|
759
|
+
var y;
|
|
760
|
+
const m = S(l, c), f = (e == null ? void 0 : e.precision) ?? 0, d = Math.min(Math.max(((y = e == null ? void 0 : e.format) == null ? void 0 : y.call(e, m)) ?? m, 0), 1), o = u ? `${(d * 100).toFixed(f)}%` : "";
|
|
761
|
+
return s("div", {
|
|
762
|
+
style: `background-color:${t};position:relative;min-height: 20px;text-align: center;border-radius: 2px;overflow:hidden;`
|
|
763
|
+
}, [s("div", {
|
|
764
|
+
style: `background-color: ${r};position:absolute;left:0;top:0;right;0;width: ${o};height: 100%;`
|
|
765
|
+
}, null), u && s("div", {
|
|
766
|
+
style: `position:absolute;inset:0;display:flex;justify-content:center;align-items:center;color:${a}`
|
|
767
|
+
}, [o])]);
|
|
768
|
+
});
|
|
769
|
+
}
|
|
770
|
+
function Bt() {
|
|
755
771
|
return {
|
|
756
772
|
dropdown: yt,
|
|
757
773
|
text: zt,
|
|
758
774
|
dict: mt,
|
|
759
|
-
tag:
|
|
760
|
-
render:
|
|
761
|
-
phone:
|
|
775
|
+
tag: jt,
|
|
776
|
+
render: Et,
|
|
777
|
+
phone: $t,
|
|
762
778
|
image: bt,
|
|
763
779
|
currency: lt,
|
|
764
780
|
date: dt,
|
|
765
|
-
button: nt
|
|
781
|
+
button: nt,
|
|
782
|
+
progress: At
|
|
766
783
|
};
|
|
767
784
|
}
|
|
768
785
|
function G(e, t) {
|
|
769
786
|
if (!(e != null && e.render))
|
|
770
787
|
return;
|
|
771
788
|
const r = e.render({
|
|
772
|
-
...
|
|
789
|
+
...Bt()
|
|
773
790
|
// ...(Table?.$override?.table || {}),
|
|
774
791
|
});
|
|
775
792
|
return {
|
|
@@ -794,10 +811,10 @@ function de({
|
|
|
794
811
|
const l = e.map((c) => ({
|
|
795
812
|
...t || {},
|
|
796
813
|
...c
|
|
797
|
-
})).map((c) =>
|
|
798
|
-
return
|
|
814
|
+
})).map((c) => Vt(c, u, a, n)).filter(Boolean);
|
|
815
|
+
return It(l, r);
|
|
799
816
|
}
|
|
800
|
-
function
|
|
817
|
+
function Dt(e, t) {
|
|
801
818
|
const r = [], u = (n) => {
|
|
802
819
|
if ("children" in n && (n.children = n.children.map(u)), "key" in n) {
|
|
803
820
|
const l = t.find((c) => {
|
|
@@ -817,12 +834,12 @@ function Bt(e, t) {
|
|
|
817
834
|
}), t.splice(n, 0, a);
|
|
818
835
|
}
|
|
819
836
|
}
|
|
820
|
-
function
|
|
837
|
+
function It(e, t = []) {
|
|
821
838
|
return t.forEach((r) => {
|
|
822
|
-
|
|
839
|
+
Dt(r, e);
|
|
823
840
|
}), e;
|
|
824
841
|
}
|
|
825
|
-
function
|
|
842
|
+
function Vt(e, t, r, u) {
|
|
826
843
|
const {
|
|
827
844
|
render: a,
|
|
828
845
|
disableColumnMode: n
|
|
@@ -849,10 +866,10 @@ function It(e, t, r, u) {
|
|
|
849
866
|
render: a
|
|
850
867
|
};
|
|
851
868
|
}
|
|
852
|
-
function
|
|
869
|
+
function Ft() {
|
|
853
870
|
return new Xe.Workbook();
|
|
854
871
|
}
|
|
855
|
-
function
|
|
872
|
+
function Kt(e, t = "Sheet1") {
|
|
856
873
|
return e.addWorksheet(t, {
|
|
857
874
|
headerFooter: {
|
|
858
875
|
firstHeader: "",
|
|
@@ -860,29 +877,29 @@ function Ft(e, t = "Sheet1") {
|
|
|
860
877
|
}
|
|
861
878
|
});
|
|
862
879
|
}
|
|
863
|
-
function
|
|
880
|
+
function Wt(e, t) {
|
|
864
881
|
e.columns = t;
|
|
865
882
|
}
|
|
866
|
-
function
|
|
883
|
+
function Ht(e, t) {
|
|
867
884
|
e.addRows(t);
|
|
868
885
|
}
|
|
869
|
-
async function
|
|
886
|
+
async function Nt({
|
|
870
887
|
columns: e,
|
|
871
888
|
rows: t,
|
|
872
889
|
filename: r
|
|
873
890
|
}) {
|
|
874
|
-
const u =
|
|
875
|
-
|
|
891
|
+
const u = Ft(), a = Kt(u);
|
|
892
|
+
Wt(a, e), Ht(a, t);
|
|
876
893
|
const n = await u.xlsx.writeBuffer(), l = new Blob([n]);
|
|
877
|
-
|
|
894
|
+
Ut(l, r || `${I().format("YYYY-MM-DD HH:mm:ss")}.xlsx`);
|
|
878
895
|
}
|
|
879
|
-
function
|
|
896
|
+
function Ut(e, t) {
|
|
880
897
|
const r = document.createElement("a");
|
|
881
898
|
r.download = t || "download", r.href = URL.createObjectURL(e), r.click(), setTimeout(() => {
|
|
882
899
|
URL.revokeObjectURL(r.href);
|
|
883
900
|
}, 1e3);
|
|
884
901
|
}
|
|
885
|
-
function
|
|
902
|
+
function Gt(e, t) {
|
|
886
903
|
const r = {};
|
|
887
904
|
return e.filter((a) => a.exportable !== !1).map((a) => ({
|
|
888
905
|
options: a,
|
|
@@ -908,7 +925,7 @@ function Ut(e, t) {
|
|
|
908
925
|
r[a.options.key] = l();
|
|
909
926
|
}), r;
|
|
910
927
|
}
|
|
911
|
-
function
|
|
928
|
+
function Jt(e) {
|
|
912
929
|
switch (!0) {
|
|
913
930
|
case typeof e == "number":
|
|
914
931
|
return e / 6;
|
|
@@ -918,31 +935,31 @@ function Gt(e) {
|
|
|
918
935
|
return 30;
|
|
919
936
|
}
|
|
920
937
|
}
|
|
921
|
-
function
|
|
938
|
+
function Qt(e, t, r) {
|
|
922
939
|
const u = e.filter((n) => n.exportable !== !1).map((n) => {
|
|
923
940
|
var l, c;
|
|
924
941
|
return {
|
|
925
942
|
key: n.key,
|
|
926
943
|
header: ((l = n.exportable) == null ? void 0 : l.header) || n.title,
|
|
927
|
-
width: ((c = n.exportable) == null ? void 0 : c.width) ||
|
|
944
|
+
width: ((c = n.exportable) == null ? void 0 : c.width) || Jt(n.width)
|
|
928
945
|
};
|
|
929
|
-
}), a = t.map((n) =>
|
|
930
|
-
|
|
946
|
+
}), a = t.map((n) => Gt(e, n));
|
|
947
|
+
Nt({
|
|
931
948
|
columns: u,
|
|
932
949
|
rows: a,
|
|
933
950
|
filename: r
|
|
934
951
|
});
|
|
935
952
|
}
|
|
936
|
-
function
|
|
953
|
+
function Xt() {
|
|
937
954
|
return {
|
|
938
|
-
exportExcel:
|
|
955
|
+
exportExcel: Qt
|
|
939
956
|
};
|
|
940
957
|
}
|
|
941
958
|
class J {
|
|
942
959
|
constructor(t) {
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
960
|
+
_(this, "sort", {});
|
|
961
|
+
_(this, "defaultSort", {});
|
|
962
|
+
_(this, "before", (t) => {
|
|
946
963
|
t.paramsQuery = {
|
|
947
964
|
...t.paramsQuery || {},
|
|
948
965
|
sort: this.stringify(this.sort)
|
|
@@ -981,8 +998,8 @@ class J {
|
|
|
981
998
|
return typeof t != "object" ? [] : (t instanceof J && (t = t.sort), Object.entries(t).map(([r, u]) => `${r},${u}`));
|
|
982
999
|
}
|
|
983
1000
|
}
|
|
984
|
-
const
|
|
985
|
-
function
|
|
1001
|
+
const Zt = 300;
|
|
1002
|
+
function pt(e) {
|
|
986
1003
|
const t = e, r = t == null ? void 0 : t.querySelector(".arco-scrollbar-container.arco-table-body");
|
|
987
1004
|
if (!r)
|
|
988
1005
|
return;
|
|
@@ -990,7 +1007,7 @@ function Zt(e) {
|
|
|
990
1007
|
r.addEventListener("mousedown", () => {
|
|
991
1008
|
console.log("mousedown"), u = setTimeout(() => {
|
|
992
1009
|
u && (r.style.cursor = "grab", r.style.userSelect = "none", a = !0);
|
|
993
|
-
},
|
|
1010
|
+
}, Zt);
|
|
994
1011
|
}), r.addEventListener("mouseup", () => {
|
|
995
1012
|
clearTimeout(u), u && (u = void 0, a = !1, r.style.cursor = "", r.style.userSelect = "", n = void 0);
|
|
996
1013
|
}), r.addEventListener("mousemove", (l) => {
|
|
@@ -1003,10 +1020,10 @@ function Zt(e) {
|
|
|
1003
1020
|
}
|
|
1004
1021
|
});
|
|
1005
1022
|
}
|
|
1006
|
-
function
|
|
1023
|
+
function er(e) {
|
|
1007
1024
|
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !Be(e);
|
|
1008
1025
|
}
|
|
1009
|
-
const
|
|
1026
|
+
const tr = /* @__PURE__ */ B({
|
|
1010
1027
|
props: {
|
|
1011
1028
|
record: {
|
|
1012
1029
|
type: Object,
|
|
@@ -1040,7 +1057,7 @@ const er = /* @__PURE__ */ B({
|
|
|
1040
1057
|
}
|
|
1041
1058
|
},
|
|
1042
1059
|
setup(e) {
|
|
1043
|
-
const t = F(), r =
|
|
1060
|
+
const t = F(), r = w(0), u = e.columns.filter((n) => typeof n.visiable == "boolean" ? n.visiable : typeof n.visiable == "function" ? n.visiable() : !0).map((n) => ({
|
|
1044
1061
|
options: n,
|
|
1045
1062
|
renderer: G(n, {
|
|
1046
1063
|
previewing: !0
|
|
@@ -1071,7 +1088,7 @@ const er = /* @__PURE__ */ B({
|
|
|
1071
1088
|
bordered: !0,
|
|
1072
1089
|
align: "left",
|
|
1073
1090
|
layout: e.layout
|
|
1074
|
-
},
|
|
1091
|
+
}, er(n = u.map((l) => s(We, {
|
|
1075
1092
|
label: l.options.title
|
|
1076
1093
|
}, {
|
|
1077
1094
|
default: () => {
|
|
@@ -1086,7 +1103,7 @@ const er = /* @__PURE__ */ B({
|
|
|
1086
1103
|
};
|
|
1087
1104
|
}
|
|
1088
1105
|
});
|
|
1089
|
-
function
|
|
1106
|
+
function rr(e, t, {
|
|
1090
1107
|
tableForm: r,
|
|
1091
1108
|
tableEvents: u
|
|
1092
1109
|
}) {
|
|
@@ -1105,17 +1122,17 @@ function tr(e, t, {
|
|
|
1105
1122
|
}, [s("div", {
|
|
1106
1123
|
class: "built-in"
|
|
1107
1124
|
}, [s(ae, null, {
|
|
1108
|
-
default: () => [e.refreshable && s(
|
|
1125
|
+
default: () => [e.refreshable && s(P, {
|
|
1109
1126
|
type: "primary",
|
|
1110
1127
|
onClick: () => u("reload")
|
|
1111
1128
|
}, {
|
|
1112
1129
|
default: () => [Y("刷新")]
|
|
1113
|
-
}), e.exportable && s(
|
|
1130
|
+
}), e.exportable && s(P, {
|
|
1114
1131
|
type: "primary",
|
|
1115
1132
|
onClick: () => u("export")
|
|
1116
1133
|
}, {
|
|
1117
1134
|
default: () => [Y("导出")]
|
|
1118
|
-
}), e.collapsable && s(
|
|
1135
|
+
}), e.collapsable && s(P, {
|
|
1119
1136
|
type: "primary",
|
|
1120
1137
|
onClick: () => u("collapse")
|
|
1121
1138
|
}, {
|
|
@@ -1128,7 +1145,7 @@ function tr(e, t, {
|
|
|
1128
1145
|
})])])]) : () => {
|
|
1129
1146
|
};
|
|
1130
1147
|
}
|
|
1131
|
-
function
|
|
1148
|
+
function nr(e, t, {
|
|
1132
1149
|
tableForm: r,
|
|
1133
1150
|
tableEvents: u,
|
|
1134
1151
|
formInstance: a
|
|
@@ -1145,10 +1162,10 @@ function rr(e, t, {
|
|
|
1145
1162
|
}, e.formOptions), null)]) : () => {
|
|
1146
1163
|
};
|
|
1147
1164
|
}
|
|
1148
|
-
function
|
|
1165
|
+
function ar(e, t, {
|
|
1149
1166
|
tableSource: r
|
|
1150
1167
|
}) {
|
|
1151
|
-
const u =
|
|
1168
|
+
const u = w([]);
|
|
1152
1169
|
function a() {
|
|
1153
1170
|
u.value = [], t.emit("update:radio-key", null), t.emit("update:radio-row", null), t.emit("update:checkbox-keys", []), t.emit("update:checkbox-rows", []);
|
|
1154
1171
|
}
|
|
@@ -1209,7 +1226,7 @@ function nr(e, t, {
|
|
|
1209
1226
|
reloadSelection: n
|
|
1210
1227
|
};
|
|
1211
1228
|
}
|
|
1212
|
-
function
|
|
1229
|
+
function lr(e, t, {
|
|
1213
1230
|
pageService: r,
|
|
1214
1231
|
tableEvents: u
|
|
1215
1232
|
}) {
|
|
@@ -1219,7 +1236,7 @@ function ar(e, t, {
|
|
|
1219
1236
|
function n(c) {
|
|
1220
1237
|
r && (r.pageSize = c, u("reload"));
|
|
1221
1238
|
}
|
|
1222
|
-
const l =
|
|
1239
|
+
const l = Mt({
|
|
1223
1240
|
mobile: 0,
|
|
1224
1241
|
tablet: 640,
|
|
1225
1242
|
desktop: 1024
|
|
@@ -1248,7 +1265,7 @@ function ar(e, t, {
|
|
|
1248
1265
|
}, null)]) : () => {
|
|
1249
1266
|
};
|
|
1250
1267
|
}
|
|
1251
|
-
const
|
|
1268
|
+
const ur = /* @__PURE__ */ B({
|
|
1252
1269
|
props: {
|
|
1253
1270
|
collapsedColumns: {
|
|
1254
1271
|
type: Array,
|
|
@@ -1256,11 +1273,11 @@ const lr = /* @__PURE__ */ B({
|
|
|
1256
1273
|
}
|
|
1257
1274
|
},
|
|
1258
1275
|
setup(e) {
|
|
1259
|
-
const t = D(), r =
|
|
1276
|
+
const t = D(), r = w(e.collapsedColumns.map((a) => ({
|
|
1260
1277
|
label: a.title,
|
|
1261
1278
|
value: a.key,
|
|
1262
1279
|
disabled: !1
|
|
1263
|
-
}))), u =
|
|
1280
|
+
}))), u = w(e.collapsedColumns.filter((a) => a.collapsed).map((a) => a.key));
|
|
1264
1281
|
return Je(() => {
|
|
1265
1282
|
const a = e.collapsedColumns.map((n) => ({
|
|
1266
1283
|
key: n.key,
|
|
@@ -1282,7 +1299,7 @@ const lr = /* @__PURE__ */ B({
|
|
|
1282
1299
|
default: () => [De(s("template", null, null), [[Ie("slot"), "source"]])]
|
|
1283
1300
|
})]);
|
|
1284
1301
|
}
|
|
1285
|
-
}),
|
|
1302
|
+
}), cr = /* @__PURE__ */ B({
|
|
1286
1303
|
props: {
|
|
1287
1304
|
value: {
|
|
1288
1305
|
type: Object,
|
|
@@ -1311,7 +1328,7 @@ const lr = /* @__PURE__ */ B({
|
|
|
1311
1328
|
onSubmit: r
|
|
1312
1329
|
}, null)]);
|
|
1313
1330
|
}
|
|
1314
|
-
}),
|
|
1331
|
+
}), ir = /* @__PURE__ */ B({
|
|
1315
1332
|
props: {
|
|
1316
1333
|
// 数据主键
|
|
1317
1334
|
rowKey: {
|
|
@@ -1450,7 +1467,7 @@ const lr = /* @__PURE__ */ B({
|
|
|
1450
1467
|
},
|
|
1451
1468
|
expose: ["preview", "export", "edit", "reload", "tableSource", "formSource", "update:radio-key", "update:radio-row", "update:checkbox-keys", "update:checkbox-rows", "formInstance", "resetSelection", "reloadSelection", "reloadColumns", "change"],
|
|
1452
1469
|
setup(e, t) {
|
|
1453
|
-
const r = Math.random().toString(32).slice(2).toUpperCase(), u =
|
|
1470
|
+
const r = Math.random().toString(32).slice(2).toUpperCase(), u = w(), a = w(), n = w(), l = w(), [c, m] = pe(e.columns), f = w(!1), d = e.form ?? et(e.columns), o = v(), y = R(), b = w(e.columns.map((i) => ({
|
|
1454
1471
|
key: i.key,
|
|
1455
1472
|
title: i.title,
|
|
1456
1473
|
collapsed: !!i.collapsed
|
|
@@ -1490,14 +1507,14 @@ const lr = /* @__PURE__ */ B({
|
|
|
1490
1507
|
function T(i) {
|
|
1491
1508
|
const {
|
|
1492
1509
|
exportExcel: h
|
|
1493
|
-
} =
|
|
1510
|
+
} = Xt();
|
|
1494
1511
|
h((i == null ? void 0 : i.columns) || e.columns, (i == null ? void 0 : i.source) || c.value, (i == null ? void 0 : i.filename) || (typeof e.exportable == "object" ? e.exportable.filename : void 0));
|
|
1495
1512
|
}
|
|
1496
|
-
function
|
|
1513
|
+
function g(i) {
|
|
1497
1514
|
let h;
|
|
1498
1515
|
switch (!0) {
|
|
1499
1516
|
case !!(i != null && i.key):
|
|
1500
|
-
h = c.value.find((
|
|
1517
|
+
h = c.value.find((M) => M[e.rowKey] === (i == null ? void 0 : i.key));
|
|
1501
1518
|
break;
|
|
1502
1519
|
case !!(i != null && i.record):
|
|
1503
1520
|
h = i == null ? void 0 : i.record;
|
|
@@ -1505,7 +1522,7 @@ const lr = /* @__PURE__ */ B({
|
|
|
1505
1522
|
}
|
|
1506
1523
|
if (!h)
|
|
1507
1524
|
throw new Error("未找到需要预览的数据");
|
|
1508
|
-
return n.value.open(
|
|
1525
|
+
return n.value.open(tr, {
|
|
1509
1526
|
record: h,
|
|
1510
1527
|
columns: e.columns
|
|
1511
1528
|
}, {
|
|
@@ -1517,7 +1534,7 @@ const lr = /* @__PURE__ */ B({
|
|
|
1517
1534
|
let h;
|
|
1518
1535
|
switch (!0) {
|
|
1519
1536
|
case !!(i != null && i.key):
|
|
1520
|
-
h = c.value.find((
|
|
1537
|
+
h = c.value.find((M) => M[e.rowKey] === (i == null ? void 0 : i.key));
|
|
1521
1538
|
break;
|
|
1522
1539
|
case !!(i != null && i.record):
|
|
1523
1540
|
h = i == null ? void 0 : i.record;
|
|
@@ -1525,7 +1542,7 @@ const lr = /* @__PURE__ */ B({
|
|
|
1525
1542
|
}
|
|
1526
1543
|
if (!h)
|
|
1527
1544
|
throw new Error("未找到需要编辑的数据");
|
|
1528
|
-
return n.value.open(
|
|
1545
|
+
return n.value.open(cr, {
|
|
1529
1546
|
value: h,
|
|
1530
1547
|
form: i == null ? void 0 : i.form,
|
|
1531
1548
|
onSubmit: i.onSubmit
|
|
@@ -1536,7 +1553,7 @@ const lr = /* @__PURE__ */ B({
|
|
|
1536
1553
|
form: "form"
|
|
1537
1554
|
});
|
|
1538
1555
|
}
|
|
1539
|
-
function
|
|
1556
|
+
function $(i) {
|
|
1540
1557
|
var p, ee;
|
|
1541
1558
|
if (!e.dataLoad)
|
|
1542
1559
|
return Promise.reject();
|
|
@@ -1547,18 +1564,18 @@ const lr = /* @__PURE__ */ B({
|
|
|
1547
1564
|
Object.keys(h).forEach((te) => {
|
|
1548
1565
|
[null, void 0, ""].includes(h[te]) && delete h[te];
|
|
1549
1566
|
});
|
|
1550
|
-
const
|
|
1567
|
+
const M = e.dataLoad({
|
|
1551
1568
|
form: h,
|
|
1552
1569
|
page: o,
|
|
1553
1570
|
sort: y,
|
|
1554
1571
|
update: m
|
|
1555
1572
|
});
|
|
1556
|
-
return z(
|
|
1573
|
+
return z(M) ? (f.value = !0, Promise.resolve(M).finally(() => {
|
|
1557
1574
|
f.value = !1;
|
|
1558
|
-
}),
|
|
1575
|
+
}), M) : Promise.resolve();
|
|
1559
1576
|
}
|
|
1560
1577
|
function he() {
|
|
1561
|
-
n.value.open(
|
|
1578
|
+
n.value.open(ur, {
|
|
1562
1579
|
collapsedColumns: b.value
|
|
1563
1580
|
}, {
|
|
1564
1581
|
title: "显示列",
|
|
@@ -1577,38 +1594,38 @@ const lr = /* @__PURE__ */ B({
|
|
|
1577
1594
|
break;
|
|
1578
1595
|
}
|
|
1579
1596
|
}
|
|
1580
|
-
},
|
|
1581
|
-
reload:
|
|
1582
|
-
preview:
|
|
1597
|
+
}, j = tt({
|
|
1598
|
+
reload: $,
|
|
1599
|
+
preview: g,
|
|
1583
1600
|
export: T,
|
|
1584
1601
|
edit: x,
|
|
1585
1602
|
collapse: he
|
|
1586
1603
|
});
|
|
1587
1604
|
function ge(i, h) {
|
|
1588
|
-
!y || C === "client" || (h ? y.update(i, h === "descend" ? "desc" : "asc") : y.remove(i),
|
|
1605
|
+
!y || C === "client" || (h ? y.update(i, h === "descend" ? "desc" : "asc") : y.remove(i), j("reload"));
|
|
1589
1606
|
}
|
|
1590
|
-
const Q =
|
|
1607
|
+
const Q = w(de({
|
|
1591
1608
|
columns: e.columns,
|
|
1592
1609
|
columnsOptions: e.columnsOptions,
|
|
1593
1610
|
columnsGroups: e.columnsGroups,
|
|
1594
1611
|
pageMode: C,
|
|
1595
1612
|
collapsedColumns: b,
|
|
1596
|
-
events:
|
|
1597
|
-
})),
|
|
1598
|
-
tableEvents:
|
|
1613
|
+
events: j
|
|
1614
|
+
})), q = {
|
|
1615
|
+
tableEvents: j,
|
|
1599
1616
|
tableForm: d,
|
|
1600
1617
|
tableSource: c,
|
|
1601
1618
|
formInstance: a,
|
|
1602
1619
|
pageService: o,
|
|
1603
1620
|
formOptions: e.formOptions
|
|
1604
|
-
}, we =
|
|
1621
|
+
}, we = nr(e, t, q), ve = rr(e, t, q), Ce = lr(e, t, q), {
|
|
1605
1622
|
selectedRowKeys: X,
|
|
1606
1623
|
rowSelection: Z,
|
|
1607
1624
|
onSelect: xe,
|
|
1608
1625
|
onSelectAll: ke,
|
|
1609
1626
|
reloadSelection: Se,
|
|
1610
1627
|
resetSelection: Te
|
|
1611
|
-
} =
|
|
1628
|
+
} = ar(e, t, q), Me = E(() => ({
|
|
1612
1629
|
rowKey: e.rowKey,
|
|
1613
1630
|
size: e.size,
|
|
1614
1631
|
bordered: e.bordered,
|
|
@@ -1627,36 +1644,36 @@ const lr = /* @__PURE__ */ B({
|
|
|
1627
1644
|
selectedKeys: X.value,
|
|
1628
1645
|
expandable: e.expandable
|
|
1629
1646
|
}));
|
|
1630
|
-
function
|
|
1647
|
+
function _e() {
|
|
1631
1648
|
Q.value = de({
|
|
1632
1649
|
columns: e.columns,
|
|
1633
1650
|
columnsOptions: e.columnsOptions,
|
|
1634
1651
|
columnsGroups: e.columnsGroups,
|
|
1635
1652
|
pageMode: C,
|
|
1636
1653
|
collapsedColumns: b,
|
|
1637
|
-
events:
|
|
1654
|
+
events: j
|
|
1638
1655
|
});
|
|
1639
1656
|
}
|
|
1640
1657
|
return A(() => {
|
|
1641
|
-
l.value && (l.value.id = `table-${r}`), e.autoLoad &&
|
|
1658
|
+
l.value && (l.value.id = `table-${r}`), e.autoLoad && $(), e.grabbable && l.value && pt(l.value);
|
|
1642
1659
|
}), {
|
|
1643
1660
|
tableId: r,
|
|
1644
1661
|
tableInstance: u,
|
|
1645
1662
|
tableSource: c,
|
|
1646
|
-
tableOptions:
|
|
1663
|
+
tableOptions: Me,
|
|
1647
1664
|
tableColumns: Q,
|
|
1648
|
-
tableEvents:
|
|
1665
|
+
tableEvents: j,
|
|
1649
1666
|
tableForm: d,
|
|
1650
1667
|
tableLoading: f,
|
|
1651
1668
|
modalInstance: n,
|
|
1652
1669
|
tableRenderElement: l,
|
|
1653
|
-
formSource: fe(
|
|
1670
|
+
formSource: fe(E(() => {
|
|
1654
1671
|
var i;
|
|
1655
1672
|
return (i = a == null ? void 0 : a.value) == null ? void 0 : i.formSource;
|
|
1656
1673
|
})),
|
|
1657
1674
|
formInstance: a,
|
|
1658
|
-
reload:
|
|
1659
|
-
preview:
|
|
1675
|
+
reload: $,
|
|
1676
|
+
preview: g,
|
|
1660
1677
|
edit: x,
|
|
1661
1678
|
export: T,
|
|
1662
1679
|
onSorterChange: ge,
|
|
@@ -1674,7 +1691,7 @@ const lr = /* @__PURE__ */ B({
|
|
|
1674
1691
|
},
|
|
1675
1692
|
resetSelection: Te,
|
|
1676
1693
|
reloadSelection: Se,
|
|
1677
|
-
reloadColumns:
|
|
1694
|
+
reloadColumns: _e
|
|
1678
1695
|
};
|
|
1679
1696
|
},
|
|
1680
1697
|
render() {
|
|
@@ -1711,23 +1728,23 @@ const lr = /* @__PURE__ */ B({
|
|
|
1711
1728
|
})]);
|
|
1712
1729
|
}
|
|
1713
1730
|
});
|
|
1714
|
-
function
|
|
1731
|
+
function br(e) {
|
|
1715
1732
|
return e;
|
|
1716
1733
|
}
|
|
1717
|
-
function
|
|
1734
|
+
function gr(e) {
|
|
1718
1735
|
return e;
|
|
1719
1736
|
}
|
|
1720
|
-
const
|
|
1737
|
+
const wr = {
|
|
1721
1738
|
install(e, t) {
|
|
1722
|
-
e.component("TableRender",
|
|
1739
|
+
e.component("TableRender", ir);
|
|
1723
1740
|
}
|
|
1724
1741
|
};
|
|
1725
1742
|
export {
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1743
|
+
ir as TableRender,
|
|
1744
|
+
xr as TableRenderResolver,
|
|
1745
|
+
wr as default,
|
|
1746
|
+
br as defineColumns,
|
|
1747
|
+
gr as defineTableLoad,
|
|
1731
1748
|
tt as useEvents,
|
|
1732
|
-
|
|
1749
|
+
hr as useTable
|
|
1733
1750
|
};
|
|
@@ -9,4 +9,5 @@ export declare function TableColumnRenders<T>(): {
|
|
|
9
9
|
currency: (options?: import('./currency').CurrencyColumnOptions) => import('..').TableColumnRenderResult<T>;
|
|
10
10
|
date: (options?: import('./date').DateColumnOptions) => import('..').TableColumnRenderResult<T>;
|
|
11
11
|
button: (options: import('./button').RenderButtonColumnOptions<T>) => import('..').TableColumnRenderResult<T>;
|
|
12
|
+
progress: (options?: import('./progress').ProgressColumnOptions) => import('..').TableColumnRenderResult<T>;
|
|
12
13
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DataRecord } from '../../interfaces';
|
|
2
|
+
|
|
3
|
+
export interface ProgressColumnOptions {
|
|
4
|
+
showText?: boolean;
|
|
5
|
+
backgroundColor?: string;
|
|
6
|
+
foregroundColor?: string;
|
|
7
|
+
textColor?: string;
|
|
8
|
+
precision?: number;
|
|
9
|
+
format?: (value: DataRecord) => number;
|
|
10
|
+
}
|
|
11
|
+
export declare function renderProgressColumn<T = DataRecord>(options?: ProgressColumnOptions): import('../..').TableColumnRenderResult<T>;
|