@gopowerteam/table-render 0.0.152 → 0.0.153
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/es/index.mjs +181 -178
- 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 N=(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"),_=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){N(this,"data",u.reactive({index:1,size:10,total:0}));N(this,"pageSizeOpts",[10,20,30,40,50]);N(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 x(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 x("button",(r,c,a)=>{const n=_.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);q(s)&&f.autoReload!==!1&&s.then(()=>{a!=null&&a.emits&&(a==null||a.emits("reload"))}),!q(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 x("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(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})})(Ee);P.locale("zh-cn");const qe={date:"YYYY-MM-DD",datetime:"YYYY-MM-DD HH:mm:ss",time:"HH:mm:ss",week:"ddd"};function Pe(e){return x("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=P(a);return u.createVNode("span",null,[l.isValid()&&l.format(n)])})}const $e={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"?$e[t]:t}function Ye(e){const t=Le(e),r=ze(e);return x("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=_.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 x("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 x("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);q(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 T(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)},T(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=T(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),T(a)],([o,s])=>{if(l(),!o)return;const y=Fe(s)?{...s}:s;n.push(...r.flatMap(h=>c.map(C=>d(o,h,C,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 j(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(T(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=T(e[T(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=>j(()=>`(min-width: ${r(o)})`,t),d=o=>j(()=>`(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 j(()=>`(min-width: ${r(o,.1)})`,t)},smaller(o){return j(()=>`(max-width: ${r(o,-.1)})`,t)},between(o,s){return j(()=>`(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&&O(d.value)?t.clipboard.readText().then(g=>{o.value=g}):o.value=$()}f.value&&r&&ne(["copy","cut"],h);async function C(g=T(c)){f.value&&g!=null&&(l.value&&O(m.value)?await t.clipboard.writeText(g):k(g),o.value=g,s.value=!0,y.start())}function k(g){const v=document.createElement("textarea");v.value=g??"",v.style.position="absolute",v.style.opacity="0",document.body.appendChild(v),v.select(),document.execCommand("copy"),v.remove()}function $(){var g,v,M;return(M=(v=(g=document==null?void 0:document.getSelection)==null?void 0:g.call(document))==null?void 0:v.toString())!=null?M:""}function O(g){return g==="granted"||g==="prompt"}return{isSupported:f,text:o,copied:s,copy:C}}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 x("phone",(c,a)=>{const n=Math.random().toString(36).slice(2),l=S(c,a),d=X(pe(l),e==null?void 0:e.separator),m=X(l,e==null?void 0:e.separator);function f(){window.focus(),t.copy(l).then(()=>{w.Message.success({content:"复制成功",duration:1e3})})}function o(){const C=document.getElementById(n);C&&(C.innerHTML=m)}function s(){window.open(`tel:${l}`,"_blank")}const y=16,h=`cursor:pointer;width:${y}px;height:${y}px;`;return u.createVNode("div",{style:"display:flex;align-items:center;gap:4px;"},[u.createVNode("div",{id:n,style:"use-select:none;font-family: monospace;cursor:pointer;font-variant-numeric: tabular-nums;padding-right: 2px;"},[e!=null&&e.safe?d:m]),(e==null?void 0:e.safe)&&(e==null?void 0:e.allowPreview)&&u.createVNode("i",{title:"显示完整号码",style:h,onClick:o},[u.createVNode("svg",{width:y,height:y,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:h,title:"拨出号码",onClick:s},[u.createVNode("svg",{width:y,height:y,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:h,title:"复制号码",onClick:f},[u.createVNode("svg",{width:y,height:y,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 x("render",r=>e(r))}function rt(e){return x("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 x("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:Pe,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||`${P().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){N(this,"sort",{});N(this,"defaultSort",{});N(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 C;return r.value.find(k=>k[e.rowKey]===h)||((C=e.checkboxRows)==null?void 0:C.find(k=>k[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=_.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 _.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=_.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=C(),y=$(),h=u.ref(e.columns.map(i=>({key:i.key,title:i.title,collapsed:!!i.collapsed})));function C(){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 k=(()=>{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 O(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(V=>V[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 v(i){let b;switch(!0){case!!(i!=null&&i.key):b=d.value.find(V=>V[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 M(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 V=e.dataLoad({form:b,page:s,sort:y,update:m});return q(V)?(f.value=!0,Promise.resolve(V).finally(()=>{f.value=!1}),V):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}}},R=te({reload:M,preview:g,export:O,edit:v,collapse:le});function ce(i,b){!y||k==="client"||(b?y.update(i,b==="descend"?"desc":"asc"):y.remove(i),R("reload"))}const F=u.ref(p({columns:e.columns,columnsOptions:e.columnsOptions,columnsGroups:e.columnsGroups,pageMode:k,collapsedColumns:h,events:R})),E={tableEvents:R,tableForm:o,tableSource:d,formInstance:a,pageService:s,formOptions:e.formOptions},de=Mt(e,t,E),ie=Tt(e,t,E),oe=Ot(e,t,E),{selectedRowKeys:K,rowSelection:W,onSelect:fe,onSelectAll:se,reloadSelection:me,resetSelection:ye}=_t(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:k,collapsedColumns:h,events:R})}return u.onMounted(()=>{l.value&&(l.value.id=`table-${r}`),e.autoLoad&&M(),e.grabbable&&l.value&&St(l.value)}),{tableId:r,tableInstance:c,tableSource:d,tableOptions:be,tableColumns:F,tableEvents:R,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:M,preview:g,edit:v,export:O,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(_.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;
|
|
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;
|
package/dist/es/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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
3
|
var M = (e, t, r) => (Re(e, typeof t != "symbol" ? t + "" : t, r), r);
|
|
4
|
-
import { ref as g, getCurrentInstance as F, onMounted as
|
|
5
|
-
import { Button as
|
|
6
|
-
import { useModal as
|
|
4
|
+
import { ref as g, getCurrentInstance as F, onMounted as A, onUpdated as Ee, reactive as je, createVNode as s, Fragment as K, createTextVNode as Y, getCurrentScope as $e, onScopeDispose as Le, unref as qe, readonly as fe, computed as j, watchEffect as Pe, 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 q, 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
|
+
import { useModal as D, onSubmit as Je, ModalProvider as Qe } from "@gopowerteam/modal-render";
|
|
7
7
|
import * as Xe from "exceljs";
|
|
8
|
-
import
|
|
8
|
+
import I from "dayjs";
|
|
9
9
|
import { FormRender as oe } from "@gopowerteam/form-render";
|
|
10
10
|
import { TableRenderResolver as Cr } from "./resolver.mjs";
|
|
11
11
|
function Ze(e, t, r) {
|
|
@@ -37,7 +37,7 @@ function yr(e) {
|
|
|
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
|
|
40
|
+
return A(u), Ee(u), r;
|
|
41
41
|
}
|
|
42
42
|
function tt(e) {
|
|
43
43
|
return (t, r) => e[t](r);
|
|
@@ -103,18 +103,18 @@ class V {
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
const rt = Symbol.for("RenderColumnType");
|
|
106
|
-
function
|
|
106
|
+
function k(e, t, r) {
|
|
107
107
|
return t.$type = e, t.$disableColumnMode = r == null ? void 0 : r.disableColumnMode, t.$disableViewMode = r == null ? void 0 : r.disableViewMode, t;
|
|
108
108
|
}
|
|
109
109
|
function S(e, t) {
|
|
110
110
|
return t.index ? t.index.split(".").reduce((r, u) => r == null ? void 0 : r[u], e) : [t.key].reduce((r, u) => r == null ? void 0 : r[u], e);
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function z(e) {
|
|
113
113
|
return !!e && (typeof e == "object" || typeof e == "function") && typeof e.then == "function";
|
|
114
114
|
}
|
|
115
115
|
function nt(e) {
|
|
116
|
-
return
|
|
117
|
-
const n =
|
|
116
|
+
return k("button", (r, u, a) => {
|
|
117
|
+
const n = D(), l = Array.isArray(e) ? e : "buttons" in e ? e.buttons : [e], c = (f, d) => typeof f == "function" ? f(r) : f === void 0 ? d : f;
|
|
118
118
|
async function m(f) {
|
|
119
119
|
if (await (f.confirm === !0 ? new Promise((o) => {
|
|
120
120
|
n.confirm({
|
|
@@ -125,12 +125,12 @@ function nt(e) {
|
|
|
125
125
|
});
|
|
126
126
|
}) : Promise.resolve(!0)) && (f != null && f.onClick)) {
|
|
127
127
|
const o = f.onClick(r);
|
|
128
|
-
|
|
128
|
+
z(o) && f.autoReload !== !1 && o.then(() => {
|
|
129
129
|
a != null && a.emits && (a == null || a.emits("reload"));
|
|
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(q, {
|
|
134
134
|
onClick: () => m(f),
|
|
135
135
|
type: f.type || "text",
|
|
136
136
|
shape: f.shape,
|
|
@@ -178,7 +178,7 @@ function lt(e) {
|
|
|
178
178
|
const l = t(Number(n));
|
|
179
179
|
return e != null && e.thousands ? r(l) : l;
|
|
180
180
|
};
|
|
181
|
-
return
|
|
181
|
+
return k("dict", (n, l) => {
|
|
182
182
|
const c = S(n, l);
|
|
183
183
|
return s("div", null, [typeof (e == null ? void 0 : e.prefix) == "string" ? s("span", null, [e.prefix]) : typeof (e == null ? void 0 : e.prefix) == "function" ? s("span", null, [e.prefix()]) : void 0, s("span", {
|
|
184
184
|
class: "currency_value"
|
|
@@ -188,7 +188,7 @@ function lt(e) {
|
|
|
188
188
|
var ut = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, ct = { exports: {} };
|
|
189
189
|
(function(e, t) {
|
|
190
190
|
(function(r, u) {
|
|
191
|
-
e.exports = u(
|
|
191
|
+
e.exports = u(I);
|
|
192
192
|
})(ut, function(r) {
|
|
193
193
|
function u(l) {
|
|
194
194
|
return l && typeof l == "object" && "default" in l ? l : {
|
|
@@ -242,7 +242,7 @@ var ut = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
242
242
|
return a.default.locale(n, null, !0), n;
|
|
243
243
|
});
|
|
244
244
|
})(ct);
|
|
245
|
-
|
|
245
|
+
I.locale("zh-cn");
|
|
246
246
|
const it = {
|
|
247
247
|
date: "YYYY-MM-DD",
|
|
248
248
|
datetime: "YYYY-MM-DD HH:mm:ss",
|
|
@@ -250,8 +250,8 @@ const it = {
|
|
|
250
250
|
week: "ddd"
|
|
251
251
|
};
|
|
252
252
|
function dt(e) {
|
|
253
|
-
return
|
|
254
|
-
const a = S(r, u), n = typeof (e == null ? void 0 : e.format) == "function" ? e == null ? void 0 : e.format() : it[(e == null ? void 0 : e.format) || "datetime"], l =
|
|
253
|
+
return k("date", (r, u) => {
|
|
254
|
+
const a = S(r, u), n = typeof (e == null ? void 0 : e.format) == "function" ? e == null ? void 0 : e.format() : it[(e == null ? void 0 : e.format) || "datetime"], l = I(a);
|
|
255
255
|
return s("span", null, [l.isValid() && l.format(n)]);
|
|
256
256
|
});
|
|
257
257
|
}
|
|
@@ -269,7 +269,7 @@ function ot(e) {
|
|
|
269
269
|
}
|
|
270
270
|
function mt(e) {
|
|
271
271
|
const t = st(e), r = ot(e);
|
|
272
|
-
return
|
|
272
|
+
return k("dict", (a, n) => {
|
|
273
273
|
const l = S(a, n);
|
|
274
274
|
return r ? s(Ve, {
|
|
275
275
|
color: r === !0 ? void 0 : r
|
|
@@ -279,7 +279,7 @@ function mt(e) {
|
|
|
279
279
|
});
|
|
280
280
|
}
|
|
281
281
|
function yt(e) {
|
|
282
|
-
const t =
|
|
282
|
+
const t = D();
|
|
283
283
|
async function r(a, n) {
|
|
284
284
|
a.confirm && !await new Promise((c, m) => {
|
|
285
285
|
t.open("confirm", {
|
|
@@ -290,12 +290,12 @@ function yt(e) {
|
|
|
290
290
|
});
|
|
291
291
|
}) || a.onClick(n);
|
|
292
292
|
}
|
|
293
|
-
return
|
|
293
|
+
return k("dropdown", (a, n) => {
|
|
294
294
|
const l = e.options.filter((c) => typeof c.visiable == "function" ? c.visiable(a) : c.visiable !== !1);
|
|
295
295
|
return s(ne, {
|
|
296
296
|
trigger: (e == null ? void 0 : e.trigger) || "click"
|
|
297
297
|
}, {
|
|
298
|
-
default: () => s(
|
|
298
|
+
default: () => s(q, {
|
|
299
299
|
disabled: l.length === 0,
|
|
300
300
|
type: "text"
|
|
301
301
|
}, {
|
|
@@ -309,12 +309,12 @@ function yt(e) {
|
|
|
309
309
|
});
|
|
310
310
|
});
|
|
311
311
|
}
|
|
312
|
-
const
|
|
312
|
+
const ht = {
|
|
313
313
|
size: 30
|
|
314
314
|
};
|
|
315
|
-
function
|
|
315
|
+
function bt(e) {
|
|
316
316
|
e = {
|
|
317
|
-
...
|
|
317
|
+
...ht,
|
|
318
318
|
...e || {}
|
|
319
319
|
};
|
|
320
320
|
function t(a, n) {
|
|
@@ -329,7 +329,7 @@ function ht(e) {
|
|
|
329
329
|
const n = document.getElementById(`IMAGE_${a}_PREVIEW`);
|
|
330
330
|
n == null || n.remove();
|
|
331
331
|
}
|
|
332
|
-
return
|
|
332
|
+
return k("image", (a, n, l) => {
|
|
333
333
|
const c = S(a, n), m = Math.random().toString(32).slice(2).toUpperCase(), f = {
|
|
334
334
|
maxWidth: "100%",
|
|
335
335
|
maxHeight: "100%",
|
|
@@ -340,10 +340,10 @@ function ht(e) {
|
|
|
340
340
|
}, d = `${n.index || n.key}_parsed`;
|
|
341
341
|
if (e != null && e.parse) {
|
|
342
342
|
const o = e == null ? void 0 : e.parse(c, a);
|
|
343
|
-
|
|
343
|
+
z(o) ? o.then((y) => a[d] = y ?? "") : a[d] = o ?? "";
|
|
344
344
|
}
|
|
345
345
|
if (e != null && e.parse && !a[d] === void 0)
|
|
346
|
-
return s("div", null, [
|
|
346
|
+
return s("div", null, [Y("Loading...")]);
|
|
347
347
|
{
|
|
348
348
|
const o = a[d] || c;
|
|
349
349
|
return o ? s("div", {
|
|
@@ -367,8 +367,8 @@ function ht(e) {
|
|
|
367
367
|
function W(e) {
|
|
368
368
|
return $e() ? (Le(e), !0) : !1;
|
|
369
369
|
}
|
|
370
|
-
function
|
|
371
|
-
return typeof e == "function" ? e() :
|
|
370
|
+
function O(e) {
|
|
371
|
+
return typeof e == "function" ? e() : qe(e);
|
|
372
372
|
}
|
|
373
373
|
const H = typeof window < "u" && typeof document < "u";
|
|
374
374
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
@@ -405,7 +405,7 @@ function kt(e, t, r = {}) {
|
|
|
405
405
|
function m(...f) {
|
|
406
406
|
l(), a.value = !0, n = setTimeout(() => {
|
|
407
407
|
a.value = !1, n = null, e(...f);
|
|
408
|
-
},
|
|
408
|
+
}, O(t));
|
|
409
409
|
}
|
|
410
410
|
return u && (a.value = !0, H && m()), W(c), {
|
|
411
411
|
isPending: fe(a),
|
|
@@ -415,7 +415,7 @@ function kt(e, t, r = {}) {
|
|
|
415
415
|
}
|
|
416
416
|
function St(e) {
|
|
417
417
|
var t;
|
|
418
|
-
const r =
|
|
418
|
+
const r = O(e);
|
|
419
419
|
return (t = r == null ? void 0 : r.$el) != null ? t : r;
|
|
420
420
|
}
|
|
421
421
|
const N = H ? window : void 0, me = H ? window.navigator : void 0;
|
|
@@ -426,14 +426,14 @@ function ye(...e) {
|
|
|
426
426
|
Array.isArray(r) || (r = [r]), Array.isArray(u) || (u = [u]);
|
|
427
427
|
const n = [], l = () => {
|
|
428
428
|
n.forEach((d) => d()), n.length = 0;
|
|
429
|
-
}, c = (d, o, y,
|
|
430
|
-
() => [St(t),
|
|
429
|
+
}, c = (d, o, y, b) => (d.addEventListener(o, y, b), () => d.removeEventListener(o, y, b)), m = Ye(
|
|
430
|
+
() => [St(t), O(a)],
|
|
431
431
|
([d, o]) => {
|
|
432
432
|
if (l(), !d)
|
|
433
433
|
return;
|
|
434
434
|
const y = wt(o) ? { ...o } : o;
|
|
435
435
|
n.push(
|
|
436
|
-
...r.flatMap((
|
|
436
|
+
...r.flatMap((b) => u.map((v) => c(d, b, v, y)))
|
|
437
437
|
);
|
|
438
438
|
},
|
|
439
439
|
{ immediate: !0, flush: "post" }
|
|
@@ -444,57 +444,57 @@ function ye(...e) {
|
|
|
444
444
|
}
|
|
445
445
|
function Tt() {
|
|
446
446
|
const e = g(!1), t = F();
|
|
447
|
-
return t &&
|
|
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 j(() => (t.value, !!e()));
|
|
454
454
|
}
|
|
455
|
-
function
|
|
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
458
|
const n = g(!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 =
|
|
463
|
-
u.value && (c(), a = r.matchMedia(
|
|
462
|
+
}, m = Pe(() => {
|
|
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 _t(e, t = {}) {
|
|
470
470
|
function r(d, o) {
|
|
471
|
-
let y =
|
|
471
|
+
let y = O(e[O(d)]);
|
|
472
472
|
return o != null && (y = xt(y, o)), typeof y == "number" && (y = `${y}px`), y;
|
|
473
473
|
}
|
|
474
474
|
const { window: u = N, strategy: a = "min-width" } = t;
|
|
475
475
|
function n(d) {
|
|
476
476
|
return u ? u.matchMedia(d).matches : !1;
|
|
477
477
|
}
|
|
478
|
-
const l = (d) =>
|
|
478
|
+
const l = (d) => L(() => `(min-width: ${r(d)})`, t), c = (d) => L(() => `(max-width: ${r(d)})`, t), m = Object.keys(e).reduce((d, o) => (Object.defineProperty(d, o, {
|
|
479
479
|
get: () => a === "min-width" ? l(o) : c(o),
|
|
480
480
|
enumerable: !0,
|
|
481
481
|
configurable: !0
|
|
482
482
|
}), d), {});
|
|
483
483
|
function f() {
|
|
484
484
|
const d = Object.keys(e).map((o) => [o, l(o)]);
|
|
485
|
-
return
|
|
485
|
+
return j(() => d.filter(([, o]) => o.value).map(([o]) => o));
|
|
486
486
|
}
|
|
487
487
|
return Object.assign(m, {
|
|
488
488
|
greaterOrEqual: l,
|
|
489
489
|
smallerOrEqual: c,
|
|
490
490
|
greater(d) {
|
|
491
|
-
return
|
|
491
|
+
return L(() => `(min-width: ${r(d, 0.1)})`, t);
|
|
492
492
|
},
|
|
493
493
|
smaller(d) {
|
|
494
|
-
return
|
|
494
|
+
return L(() => `(max-width: ${r(d, -0.1)})`, t);
|
|
495
495
|
},
|
|
496
496
|
between(d, o) {
|
|
497
|
-
return
|
|
497
|
+
return L(() => `(min-width: ${r(d)}) and (max-width: ${r(o, -0.1)})`, t);
|
|
498
498
|
},
|
|
499
499
|
isGreater(d) {
|
|
500
500
|
return n(`(min-width: ${r(d, 0.1)})`);
|
|
@@ -514,7 +514,7 @@ function Mt(e, t = {}) {
|
|
|
514
514
|
current: f,
|
|
515
515
|
active() {
|
|
516
516
|
const d = f();
|
|
517
|
-
return
|
|
517
|
+
return j(() => d.value.length === 0 ? "" : d.value.at(-1));
|
|
518
518
|
}
|
|
519
519
|
});
|
|
520
520
|
}
|
|
@@ -543,39 +543,39 @@ function ue(e, t = {}) {
|
|
|
543
543
|
query: f
|
|
544
544
|
} : c;
|
|
545
545
|
}
|
|
546
|
-
function
|
|
546
|
+
function Mt(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 =
|
|
554
|
-
function
|
|
555
|
-
l.value &&
|
|
553
|
+
} = e, l = U(() => t && "clipboard" in t), c = ue("clipboard-read"), m = ue("clipboard-write"), f = j(() => l.value || n), d = g(""), o = g(!1), y = kt(() => o.value = !1, a);
|
|
554
|
+
function b() {
|
|
555
|
+
l.value && T(c.value) ? t.clipboard.readText().then((w) => {
|
|
556
556
|
d.value = w;
|
|
557
|
-
}) : d.value =
|
|
557
|
+
}) : d.value = R();
|
|
558
558
|
}
|
|
559
|
-
f.value && r && ye(["copy", "cut"],
|
|
560
|
-
async function
|
|
561
|
-
f.value && w != null && (l.value &&
|
|
559
|
+
f.value && r && ye(["copy", "cut"], b);
|
|
560
|
+
async function v(w = O(u)) {
|
|
561
|
+
f.value && w != null && (l.value && T(m.value) ? await t.clipboard.writeText(w) : C(w), d.value = w, o.value = !0, y.start());
|
|
562
562
|
}
|
|
563
|
-
function
|
|
564
|
-
const
|
|
565
|
-
|
|
563
|
+
function C(w) {
|
|
564
|
+
const x = document.createElement("textarea");
|
|
565
|
+
x.value = w ?? "", x.style.position = "absolute", x.style.opacity = "0", document.body.appendChild(x), x.select(), document.execCommand("copy"), x.remove();
|
|
566
566
|
}
|
|
567
|
-
function
|
|
568
|
-
var w,
|
|
569
|
-
return (
|
|
567
|
+
function R() {
|
|
568
|
+
var w, x, E;
|
|
569
|
+
return (E = (x = (w = document == null ? void 0 : document.getSelection) == null ? void 0 : w.call(document)) == null ? void 0 : x.toString()) != null ? E : "";
|
|
570
570
|
}
|
|
571
|
-
function
|
|
571
|
+
function T(w) {
|
|
572
572
|
return w === "granted" || w === "prompt";
|
|
573
573
|
}
|
|
574
574
|
return {
|
|
575
575
|
isSupported: f,
|
|
576
576
|
text: d,
|
|
577
577
|
copied: o,
|
|
578
|
-
copy:
|
|
578
|
+
copy: v
|
|
579
579
|
};
|
|
580
580
|
}
|
|
581
581
|
const Ot = " ";
|
|
@@ -586,37 +586,40 @@ 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
588
|
function Et(e) {
|
|
589
|
-
const t =
|
|
590
|
-
return
|
|
591
|
-
const n = Math.random().toString(36).slice(2), l = S(u, a),
|
|
592
|
-
function
|
|
593
|
-
window.focus(), t.copy(
|
|
589
|
+
const t = Mt();
|
|
590
|
+
return k("phone", (u, a) => {
|
|
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
|
+
function d() {
|
|
593
|
+
window.focus(), t.copy(c).then(() => {
|
|
594
594
|
Fe.success({
|
|
595
595
|
content: "复制成功",
|
|
596
596
|
duration: 1e3
|
|
597
597
|
});
|
|
598
598
|
});
|
|
599
599
|
}
|
|
600
|
-
function d() {
|
|
601
|
-
const C = document.getElementById(n);
|
|
602
|
-
C && (C.innerHTML = m);
|
|
603
|
-
}
|
|
604
600
|
function o() {
|
|
605
|
-
|
|
601
|
+
const C = document.getElementById(n), R = document.querySelectorAll(`.${l}`);
|
|
602
|
+
R.length > 0 && R.forEach((T) => {
|
|
603
|
+
T.innerHTML = m;
|
|
604
|
+
}), C && (C.innerHTML = f);
|
|
606
605
|
}
|
|
607
|
-
|
|
606
|
+
function y() {
|
|
607
|
+
window.open(`tel:${c}`, "_blank");
|
|
608
|
+
}
|
|
609
|
+
const b = 16, v = `cursor:pointer;width:${b}px;height:${b}px;`;
|
|
608
610
|
return s("div", {
|
|
609
611
|
style: "display:flex;align-items:center;gap:4px;"
|
|
610
612
|
}, [s("div", {
|
|
613
|
+
class: l,
|
|
611
614
|
id: n,
|
|
612
615
|
style: "use-select:none;font-family: monospace;cursor:pointer;font-variant-numeric: tabular-nums;padding-right: 2px;"
|
|
613
|
-
}, [e != null && e.safe ?
|
|
616
|
+
}, [e != null && e.safe ? m : f]), (e == null ? void 0 : e.safe) && (e == null ? void 0 : e.allowPreview) && s("i", {
|
|
614
617
|
title: "显示完整号码",
|
|
615
|
-
style:
|
|
616
|
-
onClick:
|
|
618
|
+
style: v,
|
|
619
|
+
onClick: o
|
|
617
620
|
}, [s("svg", {
|
|
618
|
-
width:
|
|
619
|
-
height:
|
|
621
|
+
width: b,
|
|
622
|
+
height: b,
|
|
620
623
|
viewBox: "0 0 48 48",
|
|
621
624
|
fill: "none",
|
|
622
625
|
xmlns: "http://www.w3.org/2000/svg"
|
|
@@ -633,12 +636,12 @@ function Et(e) {
|
|
|
633
636
|
"stroke-width": "4",
|
|
634
637
|
"stroke-linejoin": "round"
|
|
635
638
|
}, null)])]), (e == null ? void 0 : e.allowDial) && s("i", {
|
|
636
|
-
style:
|
|
639
|
+
style: v,
|
|
637
640
|
title: "拨出号码",
|
|
638
|
-
onClick:
|
|
641
|
+
onClick: y
|
|
639
642
|
}, [s("svg", {
|
|
640
|
-
width:
|
|
641
|
-
height:
|
|
643
|
+
width: b,
|
|
644
|
+
height: b,
|
|
642
645
|
viewBox: "0 0 48 48",
|
|
643
646
|
fill: "none",
|
|
644
647
|
xmlns: "http://www.w3.org/2000/svg"
|
|
@@ -661,12 +664,12 @@ function Et(e) {
|
|
|
661
664
|
"stroke-width": "4",
|
|
662
665
|
"stroke-linejoin": "round"
|
|
663
666
|
}, null)])]), (e == null ? void 0 : e.allowCopy) && s("i", {
|
|
664
|
-
style:
|
|
667
|
+
style: v,
|
|
665
668
|
title: "复制号码",
|
|
666
|
-
onClick:
|
|
669
|
+
onClick: d
|
|
667
670
|
}, [s("svg", {
|
|
668
|
-
width:
|
|
669
|
-
height:
|
|
671
|
+
width: b,
|
|
672
|
+
height: b,
|
|
670
673
|
viewBox: "0 0 48 48",
|
|
671
674
|
fill: "none",
|
|
672
675
|
xmlns: "http://www.w3.org/2000/svg"
|
|
@@ -686,10 +689,10 @@ function Et(e) {
|
|
|
686
689
|
});
|
|
687
690
|
}
|
|
688
691
|
function jt(e) {
|
|
689
|
-
return
|
|
692
|
+
return k("render", (r) => e(r));
|
|
690
693
|
}
|
|
691
694
|
function $t(e) {
|
|
692
|
-
return
|
|
695
|
+
return k("tag", (r, u) => {
|
|
693
696
|
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;
|
|
694
697
|
return s("div", {
|
|
695
698
|
style: {
|
|
@@ -697,7 +700,7 @@ function $t(e) {
|
|
|
697
700
|
flexWrap: "wrap"
|
|
698
701
|
}
|
|
699
702
|
}, [n.slice(0, a).map((d, o) => {
|
|
700
|
-
const y = typeof l == "function" ? l(d, o) : l[o % l.length],
|
|
703
|
+
const y = typeof l == "function" ? l(d, o) : l[o % l.length], b = typeof c == "function" ? c(d, o) : c[o % c.length];
|
|
701
704
|
return s("span", {
|
|
702
705
|
style: {
|
|
703
706
|
minWidth: f ? `${f}px` : "unset",
|
|
@@ -707,7 +710,7 @@ function $t(e) {
|
|
|
707
710
|
border: `solid 2px ${e != null && e.border ? y : "transparent"}`,
|
|
708
711
|
borderRadius: `${(e == null ? void 0 : e.radius) || 0}px`,
|
|
709
712
|
color: y,
|
|
710
|
-
backgroundColor:
|
|
713
|
+
backgroundColor: b
|
|
711
714
|
}
|
|
712
715
|
}, [d]);
|
|
713
716
|
}), m && "..."]);
|
|
@@ -723,7 +726,7 @@ function Lt(e, t, r) {
|
|
|
723
726
|
var u, a;
|
|
724
727
|
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);
|
|
725
728
|
}
|
|
726
|
-
function
|
|
729
|
+
function qt(e, t) {
|
|
727
730
|
if (typeof e != "function") {
|
|
728
731
|
if (typeof (e == null ? void 0 : e.color) == "function")
|
|
729
732
|
return e == null ? void 0 : e.color(t);
|
|
@@ -731,17 +734,17 @@ function Pt(e, t) {
|
|
|
731
734
|
return e == null ? void 0 : e.color;
|
|
732
735
|
}
|
|
733
736
|
}
|
|
734
|
-
function
|
|
737
|
+
function Pt(e, t) {
|
|
735
738
|
if (typeof e != "function")
|
|
736
739
|
return typeof (e == null ? void 0 : e.size) == "function" ? ie(e == null ? void 0 : e.size(t)) : ie(e == null ? void 0 : e.size);
|
|
737
740
|
}
|
|
738
741
|
function Yt(e, t) {
|
|
739
742
|
let r = "";
|
|
740
|
-
const u =
|
|
743
|
+
const u = qt(e, t), a = Pt(e, t);
|
|
741
744
|
return u && (r += `color:${u};`), a && (r += `font-size:${a};`), r;
|
|
742
745
|
}
|
|
743
746
|
function zt(e) {
|
|
744
|
-
return
|
|
747
|
+
return k("text", (r, u) => {
|
|
745
748
|
const a = Lt(e || {}, u, r), n = Yt(e || {}, r);
|
|
746
749
|
return s("span", {
|
|
747
750
|
style: n
|
|
@@ -756,7 +759,7 @@ function At() {
|
|
|
756
759
|
tag: $t,
|
|
757
760
|
render: jt,
|
|
758
761
|
phone: Et,
|
|
759
|
-
image:
|
|
762
|
+
image: bt,
|
|
760
763
|
currency: lt,
|
|
761
764
|
date: dt,
|
|
762
765
|
button: nt
|
|
@@ -871,7 +874,7 @@ async function Ht({
|
|
|
871
874
|
const u = Vt(), a = Ft(u);
|
|
872
875
|
Kt(a, e), Wt(a, t);
|
|
873
876
|
const n = await u.xlsx.writeBuffer(), l = new Blob([n]);
|
|
874
|
-
Nt(l, r || `${
|
|
877
|
+
Nt(l, r || `${I().format("YYYY-MM-DD HH:mm:ss")}.xlsx`);
|
|
875
878
|
}
|
|
876
879
|
function Nt(e, t) {
|
|
877
880
|
const r = document.createElement("a");
|
|
@@ -1003,7 +1006,7 @@ function Zt(e) {
|
|
|
1003
1006
|
function pt(e) {
|
|
1004
1007
|
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !Be(e);
|
|
1005
1008
|
}
|
|
1006
|
-
const er = /* @__PURE__ */
|
|
1009
|
+
const er = /* @__PURE__ */ B({
|
|
1007
1010
|
props: {
|
|
1008
1011
|
record: {
|
|
1009
1012
|
type: Object,
|
|
@@ -1057,7 +1060,7 @@ const er = /* @__PURE__ */ A({
|
|
|
1057
1060
|
r.value = Math.floor(l.offsetWidth / e.minWidth);
|
|
1058
1061
|
}
|
|
1059
1062
|
}
|
|
1060
|
-
return
|
|
1063
|
+
return A(() => {
|
|
1061
1064
|
a();
|
|
1062
1065
|
}), () => {
|
|
1063
1066
|
let n;
|
|
@@ -1102,21 +1105,21 @@ function tr(e, t, {
|
|
|
1102
1105
|
}, [s("div", {
|
|
1103
1106
|
class: "built-in"
|
|
1104
1107
|
}, [s(ae, null, {
|
|
1105
|
-
default: () => [e.refreshable && s(
|
|
1108
|
+
default: () => [e.refreshable && s(q, {
|
|
1106
1109
|
type: "primary",
|
|
1107
1110
|
onClick: () => u("reload")
|
|
1108
1111
|
}, {
|
|
1109
|
-
default: () => [
|
|
1110
|
-
}), e.exportable && s(
|
|
1112
|
+
default: () => [Y("刷新")]
|
|
1113
|
+
}), e.exportable && s(q, {
|
|
1111
1114
|
type: "primary",
|
|
1112
1115
|
onClick: () => u("export")
|
|
1113
1116
|
}, {
|
|
1114
|
-
default: () => [
|
|
1115
|
-
}), e.collapsable && s(
|
|
1117
|
+
default: () => [Y("导出")]
|
|
1118
|
+
}), e.collapsable && s(q, {
|
|
1116
1119
|
type: "primary",
|
|
1117
1120
|
onClick: () => u("collapse")
|
|
1118
1121
|
}, {
|
|
1119
|
-
default: () => [
|
|
1122
|
+
default: () => [Y("显示")]
|
|
1120
1123
|
})]
|
|
1121
1124
|
})]), s("div", {
|
|
1122
1125
|
class: "customs"
|
|
@@ -1182,9 +1185,9 @@ function nr(e, t, {
|
|
|
1182
1185
|
t.emit("update:radio-key", d), t.emit("update:radio-row", o);
|
|
1183
1186
|
break;
|
|
1184
1187
|
case "checkbox":
|
|
1185
|
-
t.emit("update:checkbox-keys", f), t.emit("update:checkbox-rows", f.map((
|
|
1186
|
-
var
|
|
1187
|
-
return r.value.find((
|
|
1188
|
+
t.emit("update:checkbox-keys", f), t.emit("update:checkbox-rows", f.map((b) => {
|
|
1189
|
+
var v;
|
|
1190
|
+
return r.value.find((C) => C[e.rowKey] === b) || ((v = e.checkboxRows) == null ? void 0 : v.find((C) => C[e.rowKey] === b));
|
|
1188
1191
|
}));
|
|
1189
1192
|
break;
|
|
1190
1193
|
}
|
|
@@ -1216,7 +1219,7 @@ function ar(e, t, {
|
|
|
1216
1219
|
function n(c) {
|
|
1217
1220
|
r && (r.pageSize = c, u("reload"));
|
|
1218
1221
|
}
|
|
1219
|
-
const l =
|
|
1222
|
+
const l = _t({
|
|
1220
1223
|
mobile: 0,
|
|
1221
1224
|
tablet: 640,
|
|
1222
1225
|
desktop: 1024
|
|
@@ -1245,7 +1248,7 @@ function ar(e, t, {
|
|
|
1245
1248
|
}, null)]) : () => {
|
|
1246
1249
|
};
|
|
1247
1250
|
}
|
|
1248
|
-
const lr = /* @__PURE__ */
|
|
1251
|
+
const lr = /* @__PURE__ */ B({
|
|
1249
1252
|
props: {
|
|
1250
1253
|
collapsedColumns: {
|
|
1251
1254
|
type: Array,
|
|
@@ -1253,7 +1256,7 @@ const lr = /* @__PURE__ */ A({
|
|
|
1253
1256
|
}
|
|
1254
1257
|
},
|
|
1255
1258
|
setup(e) {
|
|
1256
|
-
const t =
|
|
1259
|
+
const t = D(), r = g(e.collapsedColumns.map((a) => ({
|
|
1257
1260
|
label: a.title,
|
|
1258
1261
|
value: a.key,
|
|
1259
1262
|
disabled: !1
|
|
@@ -1279,7 +1282,7 @@ const lr = /* @__PURE__ */ A({
|
|
|
1279
1282
|
default: () => [De(s("template", null, null), [[Ie("slot"), "source"]])]
|
|
1280
1283
|
})]);
|
|
1281
1284
|
}
|
|
1282
|
-
}), ur = /* @__PURE__ */
|
|
1285
|
+
}), ur = /* @__PURE__ */ B({
|
|
1283
1286
|
props: {
|
|
1284
1287
|
value: {
|
|
1285
1288
|
type: Object,
|
|
@@ -1295,7 +1298,7 @@ const lr = /* @__PURE__ */ A({
|
|
|
1295
1298
|
}
|
|
1296
1299
|
},
|
|
1297
1300
|
setup(e) {
|
|
1298
|
-
const t =
|
|
1301
|
+
const t = D();
|
|
1299
1302
|
function r(u) {
|
|
1300
1303
|
e.onSubmit && e.onSubmit(u), t.close(u);
|
|
1301
1304
|
}
|
|
@@ -1308,7 +1311,7 @@ const lr = /* @__PURE__ */ A({
|
|
|
1308
1311
|
onSubmit: r
|
|
1309
1312
|
}, null)]);
|
|
1310
1313
|
}
|
|
1311
|
-
}), cr = /* @__PURE__ */
|
|
1314
|
+
}), cr = /* @__PURE__ */ B({
|
|
1312
1315
|
props: {
|
|
1313
1316
|
// 数据主键
|
|
1314
1317
|
rowKey: {
|
|
@@ -1447,12 +1450,12 @@ const lr = /* @__PURE__ */ A({
|
|
|
1447
1450
|
},
|
|
1448
1451
|
expose: ["preview", "export", "edit", "reload", "tableSource", "formSource", "update:radio-key", "update:radio-row", "update:checkbox-keys", "update:checkbox-rows", "formInstance", "resetSelection", "reloadSelection", "reloadColumns", "change"],
|
|
1449
1452
|
setup(e, t) {
|
|
1450
|
-
const r = Math.random().toString(32).slice(2).toUpperCase(), u = g(), a = g(), n = g(), l = g(), [c, m] = pe(e.columns), f = g(!1), d = e.form ?? et(e.columns), o =
|
|
1453
|
+
const r = Math.random().toString(32).slice(2).toUpperCase(), u = g(), a = g(), n = g(), l = g(), [c, m] = pe(e.columns), f = g(!1), d = e.form ?? et(e.columns), o = v(), y = R(), b = g(e.columns.map((i) => ({
|
|
1451
1454
|
key: i.key,
|
|
1452
1455
|
title: i.title,
|
|
1453
1456
|
collapsed: !!i.collapsed
|
|
1454
1457
|
})));
|
|
1455
|
-
function
|
|
1458
|
+
function v() {
|
|
1456
1459
|
switch (!0) {
|
|
1457
1460
|
case (typeof e.pageable == "string" && e.pageable === "server"):
|
|
1458
1461
|
return new V();
|
|
@@ -1464,7 +1467,7 @@ const lr = /* @__PURE__ */ A({
|
|
|
1464
1467
|
return new V(e.pageable.index, e.pageable.size);
|
|
1465
1468
|
}
|
|
1466
1469
|
}
|
|
1467
|
-
const
|
|
1470
|
+
const C = (() => {
|
|
1468
1471
|
switch (!0) {
|
|
1469
1472
|
case typeof e.pageable == "string":
|
|
1470
1473
|
return e.pageable;
|
|
@@ -1474,8 +1477,8 @@ const lr = /* @__PURE__ */ A({
|
|
|
1474
1477
|
return "server";
|
|
1475
1478
|
}
|
|
1476
1479
|
})();
|
|
1477
|
-
function
|
|
1478
|
-
const i = e.columns.find((
|
|
1480
|
+
function R() {
|
|
1481
|
+
const i = e.columns.find((h) => !!h.sortable);
|
|
1479
1482
|
if (i || e.sortable)
|
|
1480
1483
|
return new J({
|
|
1481
1484
|
...e.sortable || {},
|
|
@@ -1484,46 +1487,46 @@ const lr = /* @__PURE__ */ A({
|
|
|
1484
1487
|
} : {}
|
|
1485
1488
|
});
|
|
1486
1489
|
}
|
|
1487
|
-
function
|
|
1490
|
+
function T(i) {
|
|
1488
1491
|
const {
|
|
1489
|
-
exportExcel:
|
|
1492
|
+
exportExcel: h
|
|
1490
1493
|
} = Qt();
|
|
1491
|
-
|
|
1494
|
+
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));
|
|
1492
1495
|
}
|
|
1493
1496
|
function w(i) {
|
|
1494
|
-
let
|
|
1497
|
+
let h;
|
|
1495
1498
|
switch (!0) {
|
|
1496
1499
|
case !!(i != null && i.key):
|
|
1497
|
-
|
|
1500
|
+
h = c.value.find((_) => _[e.rowKey] === (i == null ? void 0 : i.key));
|
|
1498
1501
|
break;
|
|
1499
1502
|
case !!(i != null && i.record):
|
|
1500
|
-
|
|
1503
|
+
h = i == null ? void 0 : i.record;
|
|
1501
1504
|
break;
|
|
1502
1505
|
}
|
|
1503
|
-
if (!
|
|
1506
|
+
if (!h)
|
|
1504
1507
|
throw new Error("未找到需要预览的数据");
|
|
1505
1508
|
return n.value.open(er, {
|
|
1506
|
-
record:
|
|
1509
|
+
record: h,
|
|
1507
1510
|
columns: e.columns
|
|
1508
1511
|
}, {
|
|
1509
1512
|
title: (i == null ? void 0 : i.title) || "详情",
|
|
1510
1513
|
mode: (i == null ? void 0 : i.mode) || "dialog"
|
|
1511
1514
|
});
|
|
1512
1515
|
}
|
|
1513
|
-
function
|
|
1514
|
-
let
|
|
1516
|
+
function x(i) {
|
|
1517
|
+
let h;
|
|
1515
1518
|
switch (!0) {
|
|
1516
1519
|
case !!(i != null && i.key):
|
|
1517
|
-
|
|
1520
|
+
h = c.value.find((_) => _[e.rowKey] === (i == null ? void 0 : i.key));
|
|
1518
1521
|
break;
|
|
1519
1522
|
case !!(i != null && i.record):
|
|
1520
|
-
|
|
1523
|
+
h = i == null ? void 0 : i.record;
|
|
1521
1524
|
break;
|
|
1522
1525
|
}
|
|
1523
|
-
if (!
|
|
1526
|
+
if (!h)
|
|
1524
1527
|
throw new Error("未找到需要编辑的数据");
|
|
1525
1528
|
return n.value.open(ur, {
|
|
1526
|
-
value:
|
|
1529
|
+
value: h,
|
|
1527
1530
|
form: i == null ? void 0 : i.form,
|
|
1528
1531
|
onSubmit: i.onSubmit
|
|
1529
1532
|
}, {
|
|
@@ -1533,66 +1536,66 @@ const lr = /* @__PURE__ */ A({
|
|
|
1533
1536
|
form: "form"
|
|
1534
1537
|
});
|
|
1535
1538
|
}
|
|
1536
|
-
function
|
|
1539
|
+
function E(i) {
|
|
1537
1540
|
var p, ee;
|
|
1538
1541
|
if (!e.dataLoad)
|
|
1539
1542
|
return Promise.reject();
|
|
1540
1543
|
i != null && i.reset && (o && o.reset(), y && y.reset(), (p = u.value) == null || p.resetSorters());
|
|
1541
|
-
const
|
|
1544
|
+
const h = {
|
|
1542
1545
|
...((ee = a.value) == null ? void 0 : ee.formSource) || {}
|
|
1543
1546
|
};
|
|
1544
|
-
Object.keys(
|
|
1545
|
-
[null, void 0, ""].includes(
|
|
1547
|
+
Object.keys(h).forEach((te) => {
|
|
1548
|
+
[null, void 0, ""].includes(h[te]) && delete h[te];
|
|
1546
1549
|
});
|
|
1547
|
-
const
|
|
1548
|
-
form:
|
|
1550
|
+
const _ = e.dataLoad({
|
|
1551
|
+
form: h,
|
|
1549
1552
|
page: o,
|
|
1550
1553
|
sort: y,
|
|
1551
1554
|
update: m
|
|
1552
1555
|
});
|
|
1553
|
-
return
|
|
1556
|
+
return z(_) ? (f.value = !0, Promise.resolve(_).finally(() => {
|
|
1554
1557
|
f.value = !1;
|
|
1555
|
-
}),
|
|
1558
|
+
}), _) : Promise.resolve();
|
|
1556
1559
|
}
|
|
1557
|
-
function
|
|
1560
|
+
function he() {
|
|
1558
1561
|
n.value.open(lr, {
|
|
1559
|
-
collapsedColumns:
|
|
1562
|
+
collapsedColumns: b.value
|
|
1560
1563
|
}, {
|
|
1561
1564
|
title: "显示列",
|
|
1562
1565
|
size: "small",
|
|
1563
1566
|
footer: !0
|
|
1564
1567
|
}).then((i) => {
|
|
1565
|
-
|
|
1568
|
+
b.value = i;
|
|
1566
1569
|
});
|
|
1567
1570
|
}
|
|
1568
|
-
const
|
|
1569
|
-
type:
|
|
1571
|
+
const be = (i, {
|
|
1572
|
+
type: h
|
|
1570
1573
|
}) => {
|
|
1571
|
-
switch (
|
|
1574
|
+
switch (h) {
|
|
1572
1575
|
case "drag": {
|
|
1573
1576
|
m(i), t.emit("change", i);
|
|
1574
1577
|
break;
|
|
1575
1578
|
}
|
|
1576
1579
|
}
|
|
1577
|
-
},
|
|
1578
|
-
reload:
|
|
1580
|
+
}, $ = tt({
|
|
1581
|
+
reload: E,
|
|
1579
1582
|
preview: w,
|
|
1580
|
-
export:
|
|
1581
|
-
edit:
|
|
1582
|
-
collapse:
|
|
1583
|
+
export: T,
|
|
1584
|
+
edit: x,
|
|
1585
|
+
collapse: he
|
|
1583
1586
|
});
|
|
1584
|
-
function ge(i,
|
|
1585
|
-
!y ||
|
|
1587
|
+
function ge(i, h) {
|
|
1588
|
+
!y || C === "client" || (h ? y.update(i, h === "descend" ? "desc" : "asc") : y.remove(i), $("reload"));
|
|
1586
1589
|
}
|
|
1587
1590
|
const Q = g(de({
|
|
1588
1591
|
columns: e.columns,
|
|
1589
1592
|
columnsOptions: e.columnsOptions,
|
|
1590
1593
|
columnsGroups: e.columnsGroups,
|
|
1591
|
-
pageMode:
|
|
1592
|
-
collapsedColumns:
|
|
1593
|
-
events:
|
|
1594
|
+
pageMode: C,
|
|
1595
|
+
collapsedColumns: b,
|
|
1596
|
+
events: $
|
|
1594
1597
|
})), P = {
|
|
1595
|
-
tableEvents:
|
|
1598
|
+
tableEvents: $,
|
|
1596
1599
|
tableForm: d,
|
|
1597
1600
|
tableSource: c,
|
|
1598
1601
|
formInstance: a,
|
|
@@ -1605,14 +1608,14 @@ const lr = /* @__PURE__ */ A({
|
|
|
1605
1608
|
onSelectAll: ke,
|
|
1606
1609
|
reloadSelection: Se,
|
|
1607
1610
|
resetSelection: Te
|
|
1608
|
-
} = nr(e, t, P),
|
|
1611
|
+
} = nr(e, t, P), _e = j(() => ({
|
|
1609
1612
|
rowKey: e.rowKey,
|
|
1610
1613
|
size: e.size,
|
|
1611
1614
|
bordered: e.bordered,
|
|
1612
1615
|
hoverable: e.hoverable,
|
|
1613
1616
|
stripe: e.stripe,
|
|
1614
1617
|
scroll: {
|
|
1615
|
-
x: e.columns.reduce((i,
|
|
1618
|
+
x: e.columns.reduce((i, h) => i += typeof h.width != "number" ? Math.max(h.title.length * 16, 80) : h.width, 0),
|
|
1616
1619
|
y: e.height ?? "100%"
|
|
1617
1620
|
},
|
|
1618
1621
|
rowSelection: Z,
|
|
@@ -1624,40 +1627,40 @@ const lr = /* @__PURE__ */ A({
|
|
|
1624
1627
|
selectedKeys: X.value,
|
|
1625
1628
|
expandable: e.expandable
|
|
1626
1629
|
}));
|
|
1627
|
-
function
|
|
1630
|
+
function Me() {
|
|
1628
1631
|
Q.value = de({
|
|
1629
1632
|
columns: e.columns,
|
|
1630
1633
|
columnsOptions: e.columnsOptions,
|
|
1631
1634
|
columnsGroups: e.columnsGroups,
|
|
1632
|
-
pageMode:
|
|
1633
|
-
collapsedColumns:
|
|
1634
|
-
events:
|
|
1635
|
+
pageMode: C,
|
|
1636
|
+
collapsedColumns: b,
|
|
1637
|
+
events: $
|
|
1635
1638
|
});
|
|
1636
1639
|
}
|
|
1637
|
-
return
|
|
1638
|
-
l.value && (l.value.id = `table-${r}`), e.autoLoad &&
|
|
1640
|
+
return A(() => {
|
|
1641
|
+
l.value && (l.value.id = `table-${r}`), e.autoLoad && E(), e.grabbable && l.value && Zt(l.value);
|
|
1639
1642
|
}), {
|
|
1640
1643
|
tableId: r,
|
|
1641
1644
|
tableInstance: u,
|
|
1642
1645
|
tableSource: c,
|
|
1643
|
-
tableOptions:
|
|
1646
|
+
tableOptions: _e,
|
|
1644
1647
|
tableColumns: Q,
|
|
1645
|
-
tableEvents:
|
|
1648
|
+
tableEvents: $,
|
|
1646
1649
|
tableForm: d,
|
|
1647
1650
|
tableLoading: f,
|
|
1648
1651
|
modalInstance: n,
|
|
1649
1652
|
tableRenderElement: l,
|
|
1650
|
-
formSource: fe(
|
|
1653
|
+
formSource: fe(j(() => {
|
|
1651
1654
|
var i;
|
|
1652
1655
|
return (i = a == null ? void 0 : a.value) == null ? void 0 : i.formSource;
|
|
1653
1656
|
})),
|
|
1654
1657
|
formInstance: a,
|
|
1655
|
-
reload:
|
|
1658
|
+
reload: E,
|
|
1656
1659
|
preview: w,
|
|
1657
|
-
edit:
|
|
1658
|
-
export:
|
|
1660
|
+
edit: x,
|
|
1661
|
+
export: T,
|
|
1659
1662
|
onSorterChange: ge,
|
|
1660
|
-
onTableChange:
|
|
1663
|
+
onTableChange: be,
|
|
1661
1664
|
renders: {
|
|
1662
1665
|
renderTableForm: we,
|
|
1663
1666
|
renderTableActions: ve,
|
|
@@ -1671,7 +1674,7 @@ const lr = /* @__PURE__ */ A({
|
|
|
1671
1674
|
},
|
|
1672
1675
|
resetSelection: Te,
|
|
1673
1676
|
reloadSelection: Se,
|
|
1674
|
-
reloadColumns:
|
|
1677
|
+
reloadColumns: Me
|
|
1675
1678
|
};
|
|
1676
1679
|
},
|
|
1677
1680
|
render() {
|
|
@@ -1708,10 +1711,10 @@ const lr = /* @__PURE__ */ A({
|
|
|
1708
1711
|
})]);
|
|
1709
1712
|
}
|
|
1710
1713
|
});
|
|
1711
|
-
function
|
|
1714
|
+
function hr(e) {
|
|
1712
1715
|
return e;
|
|
1713
1716
|
}
|
|
1714
|
-
function
|
|
1717
|
+
function br(e) {
|
|
1715
1718
|
return e;
|
|
1716
1719
|
}
|
|
1717
1720
|
const gr = {
|
|
@@ -1723,8 +1726,8 @@ export {
|
|
|
1723
1726
|
cr as TableRender,
|
|
1724
1727
|
Cr as TableRenderResolver,
|
|
1725
1728
|
gr as default,
|
|
1726
|
-
|
|
1727
|
-
|
|
1729
|
+
hr as defineColumns,
|
|
1730
|
+
br as defineTableLoad,
|
|
1728
1731
|
tt as useEvents,
|
|
1729
1732
|
yr as useTable
|
|
1730
1733
|
};
|