@qy_better_lib/pc 0.1.16 → 0.1.17
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/@qy_better_lib/pc.min.js +1 -1
- package/lib/contextMenu/src/index.vue.d.ts +7 -7
- package/lib/tableExtend/props.d.ts +4 -0
- package/lib/tableExtend/props.js +5 -1
- package/lib/tableExtend/src/colVisible.vue.d.ts +2 -2
- package/lib/tableExtend/src/colVisible.vue.js +2 -2
- package/lib/tableExtend/src/index.vue.d.ts +14 -8
- package/lib/tableExtend/src/index.vue.js +87 -86
- package/lib/tableExtend/src/valueCol.vue.d.ts +5 -5
- package/lib/tableExtend/src/valueCol.vue.js +4 -4
- package/lib/tableExtend/type.d.ts +5 -0
- package/lib/tableExtend/useTable.js +35 -31
- package/lib/textButton/src/index.vue.d.ts +6 -6
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(g,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("vue-i18n"),require("@qy_better_lib/core"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","vue-i18n","@qy_better_lib/core","element-plus"],e):(g=typeof globalThis<"u"?globalThis:g||self,e(g["@qy_better_lib/pc"]={},g.Vue,g.vueI18n,g.core,g.elementPlus))})(this,function(g,e,A,O,S){"use strict";const V=e.defineComponent({name:"TextButton",__name:"index",props:{type:{type:String,default:"primary",validator:t=>["default","primary","success","warning","info","danger"].includes(t)},icon:String,disabled:Boolean},emits:["click"],setup(t,{emit:n}){const o=t,a=n;function c(p){o.disabled||a("click",p)}return(p,C)=>{const b=e.resolveComponent("el-icon");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["text-button",[`text-button-${t.type}`,t.disabled&&"is-disabled"]])},[o.icon?(e.openBlock(),e.createBlock(b,{key:0,class:"text-button-icon"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.icon)))]),_:1})):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"text-button-inner",onClick:e.withModifiers(c,["prevent","stop"])},[e.renderSlot(p.$slots,"default")])],2)}}});V.install=t=>{t.component("TextButton",V)};var P=(t=>(t[t.PICTURE=1]="PICTURE",t[t.PDF=2]="PDF",t[t.OTHER=3]="OTHER",t))(P||{});function I(t){var i,k;const n=e.getCurrentInstance(),o=n==null?void 0:n.props,a={rowKey:"Id","element-loading-text":"加载中…","element-loading-background":"rgba(0, 0, 0, 0.2)",highlightCurrentRow:!0,stripe:!0,border:!1},c={headerAlign:void 0,align:void 0,prop:void 0,label:void 0,init:!0,width:void 0,showOverflowTooltip:!1,sortable:void 0,fixed:void 0},p=e.computed(()=>({...a,...Object.keys(o.options).length>0?o.options:{}})),C=e.reactive({count:0,rows:[]}),b=e.reactive({pageIndex:(i=o==null?void 0:o.paging)!=null&&i.pageIndex?e.toRef(o.paging,"pageIndex"):1,pageSize:(k=o==null?void 0:o.paging)!=null&&k.pageSize?e.toRef(o.paging,"pageSize"):10}),m=e.computed(()=>{var s,d;return((s=o==null?void 0:o.paging)==null?void 0:s.pageIndex)>0&&((d=o==null?void 0:o.paging)==null?void 0:d.pageSize)>0}),h=e.reactive({show:!1,filePathList:[],index:0}),r=e.reactive({showColumn:[],hiddenColumn:[]}),_=e.computed(()=>!r.showColumn||r.showColumn.length===0?[{prop:"default-prop",init:!0,label:""}]:r.showColumn.map(d=>(t&&d.langue&&(d.label=t(d.langue)),{...c,...d}))),w=e.computed(()=>{var s,d,f,x,T,$;return(((f=(d=n==null?void 0:(s=n.slots)["tool-left"])==null?void 0:d.call(s))==null?void 0:f.length)||0)>0||((($=(T=n==null?void 0:(x=n.slots)["tool-right"])==null?void 0:T.call(x))==null?void 0:$.length)||0)>0}),y=e.computed(()=>_.value.some(s=>s.fileType&&s.fileType==P.PICTURE));return{defColSetting:c,selectionOptions:C,tableAttribute:p,pagination:b,hasPagination:m,imageViewer:h,columnConfig:r,colSettingList:_,showToolPanel:w,hasImageViewer:y}}function U(){return{options:{type:Object,default:()=>({})},tableData:{type:Array,default:[]},tableColums:{type:Array,default:()=>[]},tableLoading:Boolean,selectionCol:{type:Boolean,default:()=>!0},indexCol:{type:Boolean,default:()=>!0},isSetColumn:{type:Boolean,default:()=>!1},paging:{type:Object},total:Number,sizeList:{type:Array,default:()=>[15,20,30,50,100]}}}const j=e.defineComponent({__name:"valueCol",props:{row:{type:Object,default:()=>{}},colCfg:{type:Object,default:()=>{}}},setup(t){const n=t,o=e.computed(()=>{const{row:a,colCfg:c}=n;return a[c.prop]});return(a,c)=>(e.openBlock(),e.createElementBlock("span",null,e.toDisplayString(o.value!=null?o.value:"--"),1))}}),H={class:"set-column-list-wrap"},q={class:"fixed-wrap"},X=e.defineComponent({__name:"colVisible",setup(t){const n=e.inject("table-extend"),o=e.ref(!0),a=e.ref(!1),c=e.computed(()=>n&&n.columnConfig.showColumn.map(h=>h.prop)||[]),p=e.computed(()=>(n==null?void 0:n.tableColums.value)||[]);function C(h){h?n&&(n.columnConfig.showColumn=p.value):n&&(n.columnConfig.showColumn=[])}function b(h){if(n){n.columnConfig.showColumn=p.value.filter(_=>h.includes(_.prop));const r=h.length;o.value=r===p.value.length,a.value=r>0&&r<p.value.length}}function m(h,r){r.fixed===h?r.fixed=void 0:r.fixed=h}return(h,r)=>{const _=e.resolveComponent("Setting"),w=e.resolveComponent("el-icon"),y=e.resolveComponent("el-checkbox"),i=e.resolveComponent("Upload"),k=e.resolveComponent("el-divider"),s=e.resolveComponent("el-checkbox-group"),d=e.resolveComponent("el-popover");return e.openBlock(),e.createBlock(d,{placement:"bottom",title:"列显示设置",width:220},{reference:e.withCtx(()=>[e.createVNode(w,null,{default:e.withCtx(()=>[e.createVNode(_)]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",H,[e.createVNode(y,{indeterminate:a.value,modelValue:o.value,"onUpdate:modelValue":r[0]||(r[0]=f=>o.value=f),onChange:C},{default:e.withCtx(()=>[e.createTextVNode("全选 ")]),_:1},8,["indeterminate","modelValue"]),e.createVNode(s,{class:"set-column-check-group",modelValue:c.value,"onUpdate:modelValue":r[1]||(r[1]=f=>c.value=f),onChange:b},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,f=>(e.openBlock(),e.createElementBlock("div",{class:"group-item",key:f.prop},[e.createVNode(y,{class:"set-column-check",label:f.prop},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.label),1)]),_:2},1032,["label"]),e.createElementVNode("div",q,[e.createVNode(w,{class:e.normalizeClass(["fixed-icon",f.fixed==="left"&&"active"]),title:"固定到左边",onClick:x=>m("left",f)},{default:e.withCtx(()=>[e.createVNode(i)]),_:2},1032,["class","onClick"]),e.createVNode(k,{direction:"vertical"}),e.createVNode(w,{class:e.normalizeClass(["fixed-icon",f.fixed==="right"&&"active"]),title:"固定到右边",onClick:x=>m("right",f)},{default:e.withCtx(()=>[e.createVNode(i)]),_:2},1032,["class","onClick"])])]))),128))]),_:1},8,["modelValue"])])]),_:1})}}}),F={key:0,class:"tool-panel"},Y={class:"left-panel"},W={class:"right-panel"},K={class:"default-tool"},G=["innerHTML"],E=e.defineComponent({__name:"index",props:{...U()},emits:["tableSort","handleSelectionChange","currentChange","pageSizeChange","rowClick","rowDblClick"],setup(t,{expose:n,emit:o}){const a=t,c=o,{t:p}=A.useI18n(),{selectionOptions:C,tableAttribute:b,pagination:m,hasPagination:h,columnConfig:r,colSettingList:_,showToolPanel:w}=I(p);e.provide("table-extend",{tableProps:a,tableColums:e.toRef(a,"tableColums"),columnConfig:r});const y=e.ref(),i=e.ref(null),k=e.ref(!1),s=e.ref(),d=e.computed(()=>{const l=a.tableData.length>(a.total||0)?a.tableData.length:a.total||0;return h.value&&l>m.pageSize});e.watch(()=>a.tableColums,()=>{r.showColumn=a.tableColums}),e.watch(()=>m.pageIndex,l=>{if(l&&l>0){if(k.value){k.value=!1;return}c("currentChange",l),i.value.setScrollTop(0)}}),e.watch(()=>m.pageSize,l=>{l&&l>0&&(k.value=!0,m.pageIndex=1,c("pageSizeChange",l),i.value.setScrollTop(0))}),e.onMounted(()=>{e.nextTick(()=>{var B;const l=((B=y.value)==null?void 0:B.offsetHeight)||0;console.log("wrap_offset_height",l),s.value=l,a.tableColums&&a.tableColums.length>0&&(r.showColumn=a.tableColums)})}),n({clearSelection:ne,toggleRowSelection:le,table:i});function f(l){c("tableSort",{sortName:l.prop,sortType:l.order==="descending"?"desc":l.order==="ascending"?"asc":""})}function x(l){C.rows=l,C.count=l&&l.length,c("handleSelectionChange",l)}function T(l){c("rowClick",l)}function $(l){c("rowDblClick",l)}function ne(){var l;(l=i.value)==null||l.clearSelection()}function le(l){var B;(B=i.value)==null||B.toggleRowSelection(l)}return(l,B)=>{const z=e.resolveComponent("el-table-column"),ae=e.resolveComponent("el-empty"),ie=e.resolveComponent("el-table"),ce=e.resolveComponent("el-pagination"),re=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",{class:"table-extend",ref_key:"tableExtendRef",ref:y},[e.unref(w)?(e.openBlock(),e.createElementBlock("div",F,[e.createElementVNode("div",Y,[e.renderSlot(l.$slots,"tool-left")]),e.createElementVNode("div",W,[e.renderSlot(l.$slots,"tool-right"),e.createElementVNode("div",K,[l.isSetColumn?(e.openBlock(),e.createBlock(X,{key:0})):e.createCommentVNode("",!0)])])])):e.createCommentVNode("",!0),e.withDirectives((e.openBlock(),e.createBlock(ie,e.mergeProps({ref_key:"tableRef",ref:i},e.unref(b),{data:l.tableData,"max-height":s.value,onSortChange:f,onSelectionChange:x,onRowClick:T,onRowDblclick:$}),{empty:e.withCtx(()=>[e.createVNode(ae,{"image-size":60})]),default:e.withCtx(()=>[l.selectionCol?(e.openBlock(),e.createBlock(z,{key:0,type:"selection",width:"48",fixed:"left"})):e.createCommentVNode("",!0),l.indexCol?(e.openBlock(),e.createBlock(z,{key:1,type:"index",width:"58",fixed:"left"})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(_),u=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:u.prop},[u.isHtml?(e.openBlock(),e.createBlock(z,e.mergeProps({key:0,ref_for:!0},u),{default:e.withCtx(D=>[e.createElementVNode("div",{innerHTML:u.prop&&D.row[u.prop]},null,8,G)]),_:2},1040)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[u.init?(e.openBlock(),e.createBlock(z,e.mergeProps({key:0,ref_for:!0},u),{default:e.withCtx(D=>[e.renderSlot(l.$slots,`col_${u.prop}`,{data:D.row},()=>[e.createVNode(j,e.mergeProps({ref_for:!0},{row:D.row,colCfg:u}),null,16)])]),header:e.withCtx(()=>[e.renderSlot(l.$slots,`header_${u.prop}`,{data:u},()=>[e.createTextVNode(e.toDisplayString(u.label),1)])]),_:2},1040)):e.createCommentVNode("",!0)],64))],64))),128)),e.renderSlot(l.$slots,"operatColumn")]),_:3},16,["data","max-height"])),[[re,l.tableLoading]]),d.value?(e.openBlock(),e.createBlock(ce,{key:1,background:"","current-page":e.unref(m).pageIndex,"onUpdate:currentPage":B[0]||(B[0]=u=>e.unref(m).pageIndex=u),"page-size":e.unref(m).pageSize,"onUpdate:pageSize":B[1]||(B[1]=u=>e.unref(m).pageSize=u),"page-sizes":l.sizeList,layout:"total, sizes, prev, pager, next, jumper",total:l.total},null,8,["current-page","page-size","page-sizes","total"])):e.createCommentVNode("",!0)],512)}}});E.install=t=>{t.component("TableExtend",E)};const J={class:"contextmenu-wrap"},Q={class:"contextmenu-items"},Z=["onClick"],N=e.defineComponent({__name:"index",props:{visible:{type:Boolean,default:()=>!1},position:{type:Object,default:()=>{}},options:{type:Array,default:[],required:!0}},emits:["menuClick","update:visible"],setup(t,{expose:n,emit:o}){const a=t,c=o;n({hide:w,show:r});const p=e.ref(!1),C=e.ref(null),b=e.reactive({left:0,top:0});e.watch(()=>a.visible,i=>{i&&(p.value=!0,e.nextTick(()=>{_(a.position)}))},{immediate:!0}),e.onMounted(()=>{var i;(i=C.value)==null||i.addEventListener("contextmenu",r)}),e.onBeforeUnmount(()=>{m()});function m(){var i;(i=C.value)==null||i.removeEventListener("contextmenu",r)}function h(i){c("menuClick",i),w()}async function r(i){i.preventDefault(),p.value=!0,await e.nextTick();const{pageX:k,pageY:s}=i;_({x:k,y:s})}function _(i){const{clientWidth:k,clientHeight:s}=C.value;!k||!s||(b.top=`${y("Y",i.y||0,s)}px`,b.left=`${y("X",i.x||0,k)}px`)}function w(){m(),p.value=!1,e.nextTick(()=>{c("update:visible",!1)})}function y(i,k,s){const d=i==="X"?window.innerWidth:window.innerHeight,f=i==="X"?window.scrollX:window.scrollY;let x=k-f;return x+s>d&&(x=Math.max(0,x-s)),x+f}return(i,k)=>{const s=e.resolveComponent("el-divider");return e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[p.value?e.withDirectives((e.openBlock(),e.createElementBlock("div",{key:0,class:"contextmenu",style:e.normalizeStyle({top:b.top,left:b.left}),ref_key:"contextMenuRef",ref:C},[e.createElementVNode("div",J,[e.createElementVNode("ul",Q,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,d=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:d.key},[(d==null?void 0:d.type)=="divider"?(e.openBlock(),e.createBlock(s,{key:0})):(e.openBlock(),e.createElementBlock("li",{key:1,class:"contextmenu-item",onClick:f=>h(d)},[e.renderSlot(i.$slots,"items",{data:{item:d,options:t.options}},()=>[e.createTextVNode(e.toDisplayString(d.label),1)])],8,Z))],64))),128))])])],4)),[[e.unref(O.ClickOutside),w]]):e.createCommentVNode("",!0)])}}});N.install=t=>{t.component("ContextMenu",N)};function v(t,n,o=!0,a=""){switch(n){case"toast":L(o?"success":"error",t||(o?"执行成功":"执行失败"));break;case"dialog":R(t||(o?"执行成功":"执行失败"),()=>{},{title:a||"提示",type:o?"success":"error","show-cancel-button":!1});break;case"notif":M(o?"success":"error",a||"消息提示",t);break}}function ee(t,n,o){const a={beforeClose:(c,p,C)=>{c==="confirm"?setTimeout(()=>{C()},0):C()},...o};S.ElMessageBox.confirm(`此操作将${t}, 是否继续?`,"提示",a).then(async()=>{n&&n()}).catch(()=>{})}function R(t,n,o){return new Promise((a,c)=>{const p={beforeClose:(C,b,m)=>{C==="confirm"?setTimeout(()=>{m()},0):m()},...o};S.ElMessageBox.confirm(`${t}`,"Tip",p).then(()=>{a(n&&n())}).catch(()=>{a(!1)})})}function L(t,n="",o=!1,a=3e3){S.ElMessage({showClose:!0,message:n,type:t,duration:a,dangerouslyUseHTMLString:o})}function M(t,n="",o="",a=!0,c="bottom-right",p=3e3){S.ElNotification({title:n,message:o,type:t,dangerouslyUseHTMLString:a,duration:p,showClose:!0,position:c})}const te=[V,E,N];function oe(t){te.forEach(n=>{t.use(n)})}g.confirmBox=ee,g.confirmBoxAsync=R,g.contextMenu=N,g.install=oe,g.messageAlert=L,g.messageBox=v,g.notification=M,g.tableExtend=E,g.textButton=V,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(m,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("vue-i18n"),require("@qy_better_lib/core"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","vue-i18n","@qy_better_lib/core","element-plus"],e):(m=typeof globalThis<"u"?globalThis:m||self,e(m["@qy_better_lib/pc"]={},m.Vue,m.vueI18n,m.core,m.elementPlus))})(this,function(m,e,A,O,S){"use strict";const V=e.defineComponent({name:"TextButton",__name:"index",props:{type:{type:String,default:"primary",validator:o=>["default","primary","success","warning","info","danger"].includes(o)},icon:String,disabled:Boolean},emits:["click"],setup(o,{emit:n}){const t=o,a=n;function c(d){t.disabled||a("click",d)}return(d,C)=>{const b=e.resolveComponent("el-icon");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["text-button",[`text-button-${o.type}`,o.disabled&&"is-disabled"]])},[t.icon?(e.openBlock(),e.createBlock(b,{key:0,class:"text-button-icon"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.icon)))]),_:1})):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"text-button-inner",onClick:e.withModifiers(c,["prevent","stop"])},[e.renderSlot(d.$slots,"default")])],2)}}});V.install=o=>{o.component("TextButton",V)};var D=(o=>(o[o.PICTURE=1]="PICTURE",o[o.PDF=2]="PDF",o[o.OTHER=3]="OTHER",o))(D||{});function H(o){var i,u;const n=e.getCurrentInstance(),t=n==null?void 0:n.props,a={rowKey:"Id","element-loading-text":"加载中…","element-loading-background":"rgba(0, 0, 0, 0.2)",highlightCurrentRow:!0,stripe:!0,border:!1},c={headerAlign:void 0,align:void 0,prop:void 0,label:void 0,init:!0,width:void 0,showOverflowTooltip:!1,sortable:void 0,fixed:void 0},d=e.computed(()=>({...a,...Object.keys(t.options).length>0?t.options:{}})),C=e.reactive({count:0,rows:[]}),b=e.reactive({pageIndex:(i=t==null?void 0:t.paging)!=null&&i.pageIndex?e.toRef(t.paging,"pageIndex"):1,pageSize:(u=t==null?void 0:t.paging)!=null&&u.pageSize?e.toRef(t.paging,"pageSize"):10}),g=e.computed(()=>{var f,_;const s=((f=t==null?void 0:t.paging)==null?void 0:f.pageIndex)>0&&((_=t==null?void 0:t.paging)==null?void 0:_.pageSize)>0;if(!t.autoPagination)return s;const p=t.tableData.length>(t.total||0)?t.tableData.length:t.total||0;return s&&p>b.pageSize}),h=e.reactive({show:!1,filePathList:[],index:0}),r=e.reactive({showColumn:[],hiddenColumn:[]}),w=e.computed(()=>!r.showColumn||r.showColumn.length===0?[{prop:"default-prop",init:!0,label:""}]:r.showColumn.map(p=>(o&&p.langue&&(p.label=o(p.langue)),{...c,...p}))),x=e.computed(()=>{var s,p,f,_,T,$;return(((f=(p=n==null?void 0:(s=n.slots)["tool-left"])==null?void 0:p.call(s))==null?void 0:f.length)||0)>0||((($=(T=n==null?void 0:(_=n.slots)["tool-right"])==null?void 0:T.call(_))==null?void 0:$.length)||0)>0}),y=e.computed(()=>w.value.some(s=>s.fileType&&s.fileType==D.PICTURE));return{defColSetting:c,selectionOptions:C,tableAttribute:d,pagination:b,hasPagination:g,imageViewer:h,columnConfig:r,colSettingList:w,showToolPanel:x,hasImageViewer:y}}function I(){return{options:{type:Object,default:()=>({})},tableData:{type:Array,default:[]},tableColums:{type:Array,default:()=>[]},tableLoading:Boolean,selectionCol:{type:Boolean,default:()=>!0},indexCol:{type:Boolean,default:()=>!0},isSetColumn:{type:Boolean,default:()=>!1},paging:{type:Object},total:Number,sizeList:{type:Array,default:()=>[15,20,30,50,100]},autoHeight:Boolean,autoPagination:Boolean}}const U=e.defineComponent({__name:"valueCol",props:{row:{type:Object,default:()=>{}},colCfg:{type:Object,default:()=>{}}},setup(o){const n=o,t=e.computed(()=>{const{row:a,colCfg:c}=n;return a[c.prop]});return(a,c)=>(e.openBlock(),e.createElementBlock("span",null,e.toDisplayString(t.value!=null?t.value:"--"),1))}}),j={class:"set-column-list-wrap"},q={class:"fixed-wrap"},X=e.defineComponent({__name:"colVisible",setup(o){const n=e.inject("table-extend"),t=e.ref(!0),a=e.ref(!1),c=e.computed(()=>n&&n.columnConfig.showColumn.map(h=>h.prop)||[]),d=e.computed(()=>(n==null?void 0:n.tableColums.value)||[]);function C(h){h?n&&(n.columnConfig.showColumn=d.value):n&&(n.columnConfig.showColumn=[])}function b(h){if(n){n.columnConfig.showColumn=d.value.filter(w=>h.includes(w.prop));const r=h.length;t.value=r===d.value.length,a.value=r>0&&r<d.value.length}}function g(h,r){r.fixed===h?r.fixed=void 0:r.fixed=h}return(h,r)=>{const w=e.resolveComponent("Setting"),x=e.resolveComponent("el-icon"),y=e.resolveComponent("el-checkbox"),i=e.resolveComponent("Upload"),u=e.resolveComponent("el-divider"),s=e.resolveComponent("el-checkbox-group"),p=e.resolveComponent("el-popover");return e.openBlock(),e.createBlock(p,{placement:"bottom",title:"列显示设置",width:220},{reference:e.withCtx(()=>[e.createVNode(x,null,{default:e.withCtx(()=>[e.createVNode(w)]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",j,[e.createVNode(y,{indeterminate:a.value,modelValue:t.value,"onUpdate:modelValue":r[0]||(r[0]=f=>t.value=f),onChange:C},{default:e.withCtx(()=>r[2]||(r[2]=[e.createTextVNode("全选 ")])),_:1},8,["indeterminate","modelValue"]),e.createVNode(s,{class:"set-column-check-group",modelValue:c.value,"onUpdate:modelValue":r[1]||(r[1]=f=>c.value=f),onChange:b},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,f=>(e.openBlock(),e.createElementBlock("div",{class:"group-item",key:f.prop},[e.createVNode(y,{class:"set-column-check",label:f.prop},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.label),1)]),_:2},1032,["label"]),e.createElementVNode("div",q,[e.createVNode(x,{class:e.normalizeClass(["fixed-icon",f.fixed==="left"&&"active"]),title:"固定到左边",onClick:_=>g("left",f)},{default:e.withCtx(()=>[e.createVNode(i)]),_:2},1032,["class","onClick"]),e.createVNode(u,{direction:"vertical"}),e.createVNode(x,{class:e.normalizeClass(["fixed-icon",f.fixed==="right"&&"active"]),title:"固定到右边",onClick:_=>g("right",f)},{default:e.withCtx(()=>[e.createVNode(i)]),_:2},1032,["class","onClick"])])]))),128))]),_:1},8,["modelValue"])])]),_:1})}}}),F={key:0,class:"tool-panel"},Y={class:"left-panel"},W={class:"right-panel"},K={class:"default-tool"},G=["innerHTML"],E=e.defineComponent({__name:"index",props:{...I()},emits:["tableSort","handleSelectionChange","currentChange","pageSizeChange","rowClick","rowDblClick"],setup(o,{expose:n,emit:t}){const a=o,c=t,{t:d}=A.useI18n(),{selectionOptions:C,tableAttribute:b,pagination:g,hasPagination:h,columnConfig:r,colSettingList:w,showToolPanel:x}=H(d);e.provide("table-extend",{tableProps:a,tableColums:e.toRef(a,"tableColums"),columnConfig:r});const y=e.ref(),i=e.ref(null),u=e.ref(!1),s=e.ref();e.watch(()=>a.tableColums,()=>{r.showColumn=a.tableColums}),e.watch(()=>g.pageIndex,l=>{if(l&&l>0){if(u.value){u.value=!1;return}c("currentChange",l),i.value.setScrollTop(0)}}),e.watch(()=>g.pageSize,l=>{l&&l>0&&(u.value=!0,g.pageIndex=1,c("pageSizeChange",l),i.value.setScrollTop(0))}),e.onMounted(()=>{e.nextTick(()=>{a.tableColums&&a.tableColums.length>0&&(r.showColumn=a.tableColums)}).then(()=>{var l;if(a.autoHeight){const B=((l=y.value)==null?void 0:l.offsetHeight)||0;s.value=B}})}),n({clearSelection:$,toggleRowSelection:ne,table:i});function p(l){c("tableSort",{sortName:l.prop,sortType:l.order==="descending"?"desc":l.order==="ascending"?"asc":""})}function f(l){C.rows=l,C.count=l&&l.length,c("handleSelectionChange",l)}function _(l){c("rowClick",l)}function T(l){c("rowDblClick",l)}function $(){var l;(l=i.value)==null||l.clearSelection()}function ne(l){var B;(B=i.value)==null||B.toggleRowSelection(l)}return(l,B)=>{const z=e.resolveComponent("el-table-column"),le=e.resolveComponent("el-empty"),ae=e.resolveComponent("el-table"),ie=e.resolveComponent("el-pagination"),re=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",{class:"table-extend",ref_key:"tableExtendRef",ref:y},[e.unref(x)?(e.openBlock(),e.createElementBlock("div",F,[e.createElementVNode("div",Y,[e.renderSlot(l.$slots,"tool-left")]),e.createElementVNode("div",W,[e.renderSlot(l.$slots,"tool-right"),e.createElementVNode("div",K,[l.isSetColumn?(e.openBlock(),e.createBlock(X,{key:0})):e.createCommentVNode("",!0)])])])):e.createCommentVNode("",!0),e.withDirectives((e.openBlock(),e.createBlock(ae,e.mergeProps({ref_key:"tableRef",ref:i},e.unref(b),{data:l.tableData,"max-height":s.value,onSortChange:p,onSelectionChange:f,onRowClick:_,onRowDblclick:T}),{empty:e.withCtx(()=>[e.createVNode(le,{"image-size":60})]),default:e.withCtx(()=>[l.selectionCol?(e.openBlock(),e.createBlock(z,{key:0,type:"selection",width:"48",fixed:"left"})):e.createCommentVNode("",!0),l.indexCol?(e.openBlock(),e.createBlock(z,{key:1,type:"index",width:"58",fixed:"left"})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(w),k=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:k.prop},[k.isHtml?(e.openBlock(),e.createBlock(z,e.mergeProps({key:0,ref_for:!0},k),{default:e.withCtx(P=>[e.createElementVNode("div",{innerHTML:k.prop&&P.row[k.prop]},null,8,G)]),_:2},1040)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[k.init?(e.openBlock(),e.createBlock(z,e.mergeProps({key:0,ref_for:!0},k),{default:e.withCtx(P=>[e.renderSlot(l.$slots,`col_${k.prop}`,{data:P.row},()=>[e.createVNode(U,e.mergeProps({ref_for:!0},{row:P.row,colCfg:k}),null,16)])]),header:e.withCtx(()=>[e.renderSlot(l.$slots,`header_${k.prop}`,{data:k},()=>[e.createTextVNode(e.toDisplayString(k.label),1)])]),_:2},1040)):e.createCommentVNode("",!0)],64))],64))),128)),e.renderSlot(l.$slots,"operatColumn")]),_:3},16,["data","max-height"])),[[re,l.tableLoading]]),e.unref(h)?(e.openBlock(),e.createBlock(ie,{key:1,background:"","current-page":e.unref(g).pageIndex,"onUpdate:currentPage":B[0]||(B[0]=k=>e.unref(g).pageIndex=k),"page-size":e.unref(g).pageSize,"onUpdate:pageSize":B[1]||(B[1]=k=>e.unref(g).pageSize=k),"page-sizes":l.sizeList,layout:"total, sizes, prev, pager, next, jumper",total:l.total},null,8,["current-page","page-size","page-sizes","total"])):e.createCommentVNode("",!0)],512)}}});E.install=o=>{o.component("TableExtend",E)};const J={class:"contextmenu-wrap"},Q={class:"contextmenu-items"},Z=["onClick"],N=e.defineComponent({__name:"index",props:{visible:{type:Boolean,default:()=>!1},position:{type:Object,default:()=>{}},options:{type:Array,default:[],required:!0}},emits:["menuClick","update:visible"],setup(o,{expose:n,emit:t}){const a=o,c=t;n({hide:x,show:r});const d=e.ref(!1),C=e.ref(null),b=e.reactive({left:0,top:0});e.watch(()=>a.visible,i=>{i&&(d.value=!0,e.nextTick(()=>{w(a.position)}))},{immediate:!0}),e.onMounted(()=>{var i;(i=C.value)==null||i.addEventListener("contextmenu",r)}),e.onBeforeUnmount(()=>{g()});function g(){var i;(i=C.value)==null||i.removeEventListener("contextmenu",r)}function h(i){c("menuClick",i),x()}async function r(i){i.preventDefault(),d.value=!0,await e.nextTick();const{pageX:u,pageY:s}=i;w({x:u,y:s})}function w(i){const{clientWidth:u,clientHeight:s}=C.value;!u||!s||(b.top=`${y("Y",i.y||0,s)}px`,b.left=`${y("X",i.x||0,u)}px`)}function x(){g(),d.value=!1,e.nextTick(()=>{c("update:visible",!1)})}function y(i,u,s){const p=i==="X"?window.innerWidth:window.innerHeight,f=i==="X"?window.scrollX:window.scrollY;let _=u-f;return _+s>p&&(_=Math.max(0,_-s)),_+f}return(i,u)=>{const s=e.resolveComponent("el-divider");return e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[d.value?e.withDirectives((e.openBlock(),e.createElementBlock("div",{key:0,class:"contextmenu",style:e.normalizeStyle({top:b.top,left:b.left}),ref_key:"contextMenuRef",ref:C},[e.createElementVNode("div",J,[e.createElementVNode("ul",Q,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options,p=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:p.key},[(p==null?void 0:p.type)=="divider"?(e.openBlock(),e.createBlock(s,{key:0})):(e.openBlock(),e.createElementBlock("li",{key:1,class:"contextmenu-item",onClick:f=>h(p)},[e.renderSlot(i.$slots,"items",{data:{item:p,options:o.options}},()=>[e.createTextVNode(e.toDisplayString(p.label),1)])],8,Z))],64))),128))])])],4)),[[e.unref(O.ClickOutside),x]]):e.createCommentVNode("",!0)])}}});N.install=o=>{o.component("ContextMenu",N)};function v(o,n,t=!0,a=""){switch(n){case"toast":L(t?"success":"error",o||(t?"执行成功":"执行失败"));break;case"dialog":R(o||(t?"执行成功":"执行失败"),()=>{},{title:a||"提示",type:t?"success":"error","show-cancel-button":!1});break;case"notif":M(t?"success":"error",a||"消息提示",o);break}}function ee(o,n,t){const a={beforeClose:(c,d,C)=>{c==="confirm"?setTimeout(()=>{C()},0):C()},...t};S.ElMessageBox.confirm(`此操作将${o}, 是否继续?`,"提示",a).then(async()=>{n&&n()}).catch(()=>{})}function R(o,n,t){return new Promise((a,c)=>{const d={beforeClose:(C,b,g)=>{C==="confirm"?setTimeout(()=>{g()},0):g()},...t};S.ElMessageBox.confirm(`${o}`,"Tip",d).then(()=>{a(n&&n())}).catch(()=>{a(!1)})})}function L(o,n="",t=!1,a=3e3){S.ElMessage({showClose:!0,message:n,type:o,duration:a,dangerouslyUseHTMLString:t})}function M(o,n="",t="",a=!0,c="bottom-right",d=3e3){S.ElNotification({title:n,message:t,type:o,dangerouslyUseHTMLString:a,duration:d,showClose:!0,position:c})}const te=[V,E,N];function oe(o){te.forEach(n=>{o.use(n)})}m.confirmBox=ee,m.confirmBoxAsync=R,m.contextMenu=N,m.install=oe,m.messageAlert=L,m.messageBox=v,m.notification=M,m.tableExtend=E,m.textButton=V,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { PropType, DefineComponent, ComponentOptionsMixin, PublicProps,
|
|
1
|
+
import { PropType, DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* 右键菜单显示
|
|
5
5
|
*/
|
|
6
6
|
declare function show(e: any): Promise<void>;
|
|
7
7
|
declare function hide(): void;
|
|
8
|
-
declare const _default: __VLS_WithTemplateSlots< DefineComponent<{
|
|
8
|
+
declare const _default: __VLS_WithTemplateSlots< DefineComponent<ExtractPropTypes<{
|
|
9
9
|
visible: {
|
|
10
10
|
type: BooleanConstructor;
|
|
11
11
|
default: () => boolean;
|
|
@@ -22,10 +22,10 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<{
|
|
|
22
22
|
default: never[];
|
|
23
23
|
required: true;
|
|
24
24
|
};
|
|
25
|
-
}
|
|
25
|
+
}>, {
|
|
26
26
|
hide: typeof hide;
|
|
27
27
|
show: typeof show;
|
|
28
|
-
},
|
|
28
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
29
29
|
menuClick: (...args: any[]) => void;
|
|
30
30
|
"update:visible": (...args: any[]) => void;
|
|
31
31
|
}, string, PublicProps, Readonly< ExtractPropTypes<{
|
|
@@ -45,17 +45,17 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<{
|
|
|
45
45
|
default: never[];
|
|
46
46
|
required: true;
|
|
47
47
|
};
|
|
48
|
-
}>> & {
|
|
48
|
+
}>> & Readonly<{
|
|
49
49
|
onMenuClick?: ((...args: any[]) => any) | undefined;
|
|
50
50
|
"onUpdate:visible"?: ((...args: any[]) => any) | undefined;
|
|
51
|
-
}
|
|
51
|
+
}>, {
|
|
52
52
|
options: Record<string, any>;
|
|
53
53
|
visible: boolean;
|
|
54
54
|
position: {
|
|
55
55
|
x: number;
|
|
56
56
|
y: number;
|
|
57
57
|
};
|
|
58
|
-
}, {}>, {
|
|
58
|
+
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>, {
|
|
59
59
|
items?(_: {
|
|
60
60
|
data: {
|
|
61
61
|
item: any;
|
package/lib/tableExtend/props.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { DefineComponent, ComponentOptionsMixin, PublicProps,
|
|
2
|
-
declare const _default: DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<
|
|
1
|
+
import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
2
|
+
declare const _default: DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
3
3
|
export default _default;
|
|
@@ -39,9 +39,9 @@ const z = { class: "set-column-list-wrap" }, D = { class: "fixed-wrap" }, T = /*
|
|
|
39
39
|
"onUpdate:modelValue": e[0] || (e[0] = (o) => s.value = o),
|
|
40
40
|
onChange: V
|
|
41
41
|
}, {
|
|
42
|
-
default: c(() => [
|
|
42
|
+
default: c(() => e[2] || (e[2] = [
|
|
43
43
|
k("全选 ")
|
|
44
|
-
]),
|
|
44
|
+
])),
|
|
45
45
|
_: 1
|
|
46
46
|
}, 8, ["indeterminate", "modelValue"]),
|
|
47
47
|
t(B, {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { DefineComponent, PropType, Ref, ComponentOptionsMixin, PublicProps,
|
|
1
|
+
import { DefineComponent, ExtractPropTypes, PropType, Ref, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
2
2
|
import { TableAttr, TableColumn } from './../type';
|
|
3
3
|
declare function clearSelection(): void;
|
|
4
4
|
declare function toggleRowSelection(row: any): void;
|
|
5
|
-
declare const _default: __VLS_WithTemplateSlots< DefineComponent<{
|
|
5
|
+
declare const _default: __VLS_WithTemplateSlots< DefineComponent<ExtractPropTypes<{
|
|
6
6
|
options: {
|
|
7
7
|
type: PropType<TableAttr>;
|
|
8
8
|
default: () => {};
|
|
@@ -39,11 +39,13 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<{
|
|
|
39
39
|
type: PropType<number[]>;
|
|
40
40
|
default: () => number[];
|
|
41
41
|
};
|
|
42
|
-
|
|
42
|
+
autoHeight: BooleanConstructor;
|
|
43
|
+
autoPagination: BooleanConstructor;
|
|
44
|
+
}>, {
|
|
43
45
|
clearSelection: typeof clearSelection;
|
|
44
46
|
toggleRowSelection: typeof toggleRowSelection;
|
|
45
|
-
table: Ref<any>;
|
|
46
|
-
},
|
|
47
|
+
table: Ref<any, any>;
|
|
48
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
47
49
|
tableSort: (...args: any[]) => void;
|
|
48
50
|
handleSelectionChange: (...args: any[]) => void;
|
|
49
51
|
currentChange: (...args: any[]) => void;
|
|
@@ -87,14 +89,16 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<{
|
|
|
87
89
|
type: PropType<number[]>;
|
|
88
90
|
default: () => number[];
|
|
89
91
|
};
|
|
90
|
-
|
|
92
|
+
autoHeight: BooleanConstructor;
|
|
93
|
+
autoPagination: BooleanConstructor;
|
|
94
|
+
}>> & Readonly<{
|
|
91
95
|
onTableSort?: ((...args: any[]) => any) | undefined;
|
|
92
96
|
onHandleSelectionChange?: ((...args: any[]) => any) | undefined;
|
|
93
97
|
onCurrentChange?: ((...args: any[]) => any) | undefined;
|
|
94
98
|
onPageSizeChange?: ((...args: any[]) => any) | undefined;
|
|
95
99
|
onRowClick?: ((...args: any[]) => any) | undefined;
|
|
96
100
|
onRowDblClick?: ((...args: any[]) => any) | undefined;
|
|
97
|
-
}
|
|
101
|
+
}>, {
|
|
98
102
|
tableColums: TableColumn[];
|
|
99
103
|
options: TableAttr;
|
|
100
104
|
tableData: unknown[];
|
|
@@ -103,7 +107,9 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<{
|
|
|
103
107
|
indexCol: boolean;
|
|
104
108
|
isSetColumn: boolean;
|
|
105
109
|
sizeList: number[];
|
|
106
|
-
|
|
110
|
+
autoHeight: boolean;
|
|
111
|
+
autoPagination: boolean;
|
|
112
|
+
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>, Partial<Record<`col_${string}`, (_: {
|
|
107
113
|
data: any;
|
|
108
114
|
}) => any>> & Partial<Record<`header_${string}`, (_: {
|
|
109
115
|
data: TableColumn;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useI18n as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
const
|
|
1
|
+
import { defineComponent as G, provide as J, toRef as K, ref as h, watch as v, onMounted as Q, nextTick as W, resolveComponent as C, resolveDirective as X, openBlock as o, createElementBlock as u, unref as a, createElementVNode as b, renderSlot as d, createBlock as i, createCommentVNode as p, withDirectives as Y, mergeProps as _, withCtx as f, createVNode as R, Fragment as w, renderList as Z, createTextVNode as ee, toDisplayString as te } from "vue";
|
|
2
|
+
import { useI18n as oe } from "vue-i18n";
|
|
3
|
+
import le from "../useTable.js";
|
|
4
|
+
import ne from "../props.js";
|
|
5
|
+
import ae from "./valueCol.vue.js";
|
|
6
|
+
import re from "./colVisible.vue.js";
|
|
7
|
+
const ie = {
|
|
8
8
|
key: 0,
|
|
9
9
|
class: "tool-panel"
|
|
10
|
-
},
|
|
10
|
+
}, se = { class: "left-panel" }, ce = { class: "right-panel" }, pe = { class: "default-tool" }, ue = ["innerHTML"], be = /* @__PURE__ */ G({
|
|
11
11
|
__name: "index",
|
|
12
|
-
props: { ...
|
|
12
|
+
props: { ...ne() },
|
|
13
13
|
emits: [
|
|
14
14
|
"tableSort",
|
|
15
15
|
"handleSelectionChange",
|
|
@@ -18,153 +18,154 @@ const ce = {
|
|
|
18
18
|
"rowClick",
|
|
19
19
|
"rowDblClick"
|
|
20
20
|
],
|
|
21
|
-
setup(
|
|
22
|
-
const
|
|
21
|
+
setup(T, { expose: $, emit: D }) {
|
|
22
|
+
const n = T, s = D, { t: I } = oe(), {
|
|
23
23
|
selectionOptions: y,
|
|
24
24
|
tableAttribute: L,
|
|
25
|
-
pagination:
|
|
25
|
+
pagination: r,
|
|
26
26
|
hasPagination: P,
|
|
27
27
|
columnConfig: S,
|
|
28
|
-
colSettingList:
|
|
29
|
-
showToolPanel:
|
|
30
|
-
} =
|
|
31
|
-
|
|
32
|
-
tableProps:
|
|
33
|
-
tableColums:
|
|
28
|
+
colSettingList: H,
|
|
29
|
+
showToolPanel: N
|
|
30
|
+
} = le(I);
|
|
31
|
+
J("table-extend", {
|
|
32
|
+
tableProps: n,
|
|
33
|
+
tableColums: K(n, "tableColums"),
|
|
34
34
|
columnConfig: S
|
|
35
35
|
});
|
|
36
|
-
const z =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
});
|
|
40
|
-
k(
|
|
41
|
-
() => l.tableColums,
|
|
36
|
+
const z = h(), c = h(null), k = h(!1), x = h();
|
|
37
|
+
v(
|
|
38
|
+
() => n.tableColums,
|
|
42
39
|
() => {
|
|
43
|
-
S.showColumn =
|
|
40
|
+
S.showColumn = n.tableColums;
|
|
44
41
|
}
|
|
45
|
-
),
|
|
46
|
-
() =>
|
|
42
|
+
), v(
|
|
43
|
+
() => r.pageIndex,
|
|
47
44
|
(e) => {
|
|
48
45
|
if (e && e > 0) {
|
|
49
|
-
if (
|
|
50
|
-
|
|
46
|
+
if (k.value) {
|
|
47
|
+
k.value = !1;
|
|
51
48
|
return;
|
|
52
49
|
}
|
|
53
50
|
s("currentChange", e), c.value.setScrollTop(0);
|
|
54
51
|
}
|
|
55
52
|
}
|
|
56
|
-
),
|
|
57
|
-
() =>
|
|
53
|
+
), v(
|
|
54
|
+
() => r.pageSize,
|
|
58
55
|
(e) => {
|
|
59
|
-
e && e > 0 && (
|
|
56
|
+
e && e > 0 && (k.value = !0, r.pageIndex = 1, s("pageSizeChange", e), c.value.setScrollTop(0));
|
|
60
57
|
}
|
|
61
|
-
),
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
58
|
+
), Q(() => {
|
|
59
|
+
W(() => {
|
|
60
|
+
n.tableColums && n.tableColums.length > 0 && (S.showColumn = n.tableColums);
|
|
61
|
+
}).then(() => {
|
|
62
|
+
var e;
|
|
63
|
+
if (n.autoHeight) {
|
|
64
|
+
const l = ((e = z.value) == null ? void 0 : e.offsetHeight) || 0;
|
|
65
|
+
x.value = l;
|
|
66
|
+
}
|
|
66
67
|
});
|
|
67
|
-
}),
|
|
68
|
-
clearSelection:
|
|
69
|
-
toggleRowSelection:
|
|
68
|
+
}), $({
|
|
69
|
+
clearSelection: U,
|
|
70
|
+
toggleRowSelection: j,
|
|
70
71
|
table: c
|
|
71
72
|
});
|
|
72
|
-
function
|
|
73
|
+
function E(e) {
|
|
73
74
|
s("tableSort", {
|
|
74
75
|
sortName: e.prop,
|
|
75
76
|
sortType: e.order === "descending" ? "desc" : e.order === "ascending" ? "asc" : ""
|
|
76
77
|
});
|
|
77
78
|
}
|
|
78
|
-
function
|
|
79
|
+
function V(e) {
|
|
79
80
|
y.rows = e, y.count = e && e.length, s("handleSelectionChange", e);
|
|
80
81
|
}
|
|
81
|
-
function
|
|
82
|
+
function B(e) {
|
|
82
83
|
s("rowClick", e);
|
|
83
84
|
}
|
|
84
|
-
function
|
|
85
|
+
function M(e) {
|
|
85
86
|
s("rowDblClick", e);
|
|
86
87
|
}
|
|
87
|
-
function
|
|
88
|
+
function U() {
|
|
88
89
|
var e;
|
|
89
90
|
(e = c.value) == null || e.clearSelection();
|
|
90
91
|
}
|
|
91
|
-
function
|
|
92
|
-
var
|
|
93
|
-
(
|
|
92
|
+
function j(e) {
|
|
93
|
+
var l;
|
|
94
|
+
(l = c.value) == null || l.toggleRowSelection(e);
|
|
94
95
|
}
|
|
95
|
-
return (e,
|
|
96
|
-
const
|
|
96
|
+
return (e, l) => {
|
|
97
|
+
const g = C("el-table-column"), A = C("el-empty"), F = C("el-table"), O = C("el-pagination"), q = X("loading");
|
|
97
98
|
return o(), u("div", {
|
|
98
99
|
class: "table-extend",
|
|
99
100
|
ref_key: "tableExtendRef",
|
|
100
101
|
ref: z
|
|
101
102
|
}, [
|
|
102
|
-
|
|
103
|
-
|
|
103
|
+
a(N) ? (o(), u("div", ie, [
|
|
104
|
+
b("div", se, [
|
|
104
105
|
d(e.$slots, "tool-left")
|
|
105
106
|
]),
|
|
106
|
-
|
|
107
|
+
b("div", ce, [
|
|
107
108
|
d(e.$slots, "tool-right"),
|
|
108
|
-
|
|
109
|
-
e.isSetColumn ? (o(), i(
|
|
109
|
+
b("div", pe, [
|
|
110
|
+
e.isSetColumn ? (o(), i(re, { key: 0 })) : p("", !0)
|
|
110
111
|
])
|
|
111
112
|
])
|
|
112
113
|
])) : p("", !0),
|
|
113
|
-
|
|
114
|
+
Y((o(), i(F, _({
|
|
114
115
|
ref_key: "tableRef",
|
|
115
116
|
ref: c
|
|
116
|
-
},
|
|
117
|
+
}, a(L), {
|
|
117
118
|
data: e.tableData,
|
|
118
|
-
"max-height":
|
|
119
|
-
onSortChange:
|
|
120
|
-
onSelectionChange:
|
|
121
|
-
onRowClick:
|
|
122
|
-
onRowDblclick:
|
|
119
|
+
"max-height": x.value,
|
|
120
|
+
onSortChange: E,
|
|
121
|
+
onSelectionChange: V,
|
|
122
|
+
onRowClick: B,
|
|
123
|
+
onRowDblclick: M
|
|
123
124
|
}), {
|
|
124
|
-
empty:
|
|
125
|
-
|
|
125
|
+
empty: f(() => [
|
|
126
|
+
R(A, { "image-size": 60 })
|
|
126
127
|
]),
|
|
127
|
-
default:
|
|
128
|
-
e.selectionCol ? (o(), i(
|
|
128
|
+
default: f(() => [
|
|
129
|
+
e.selectionCol ? (o(), i(g, {
|
|
129
130
|
key: 0,
|
|
130
131
|
type: "selection",
|
|
131
132
|
width: "48",
|
|
132
133
|
fixed: "left"
|
|
133
134
|
})) : p("", !0),
|
|
134
|
-
e.indexCol ? (o(), i(
|
|
135
|
+
e.indexCol ? (o(), i(g, {
|
|
135
136
|
key: 1,
|
|
136
137
|
type: "index",
|
|
137
138
|
width: "58",
|
|
138
139
|
fixed: "left"
|
|
139
140
|
})) : p("", !0),
|
|
140
|
-
(o(!0), u(w, null,
|
|
141
|
+
(o(!0), u(w, null, Z(a(H), (t) => (o(), u(w, {
|
|
141
142
|
key: t.prop
|
|
142
143
|
}, [
|
|
143
|
-
t.isHtml ? (o(), i(
|
|
144
|
+
t.isHtml ? (o(), i(g, _({
|
|
144
145
|
key: 0,
|
|
145
146
|
ref_for: !0
|
|
146
147
|
}, t), {
|
|
147
|
-
default:
|
|
148
|
-
|
|
149
|
-
innerHTML: t.prop &&
|
|
150
|
-
}, null, 8,
|
|
148
|
+
default: f((m) => [
|
|
149
|
+
b("div", {
|
|
150
|
+
innerHTML: t.prop && m.row[t.prop]
|
|
151
|
+
}, null, 8, ue)
|
|
151
152
|
]),
|
|
152
153
|
_: 2
|
|
153
154
|
}, 1040)) : (o(), u(w, { key: 1 }, [
|
|
154
|
-
t.init ? (o(), i(
|
|
155
|
+
t.init ? (o(), i(g, _({
|
|
155
156
|
key: 0,
|
|
156
157
|
ref_for: !0
|
|
157
158
|
}, t), {
|
|
158
|
-
default:
|
|
159
|
+
default: f((m) => [
|
|
159
160
|
d(e.$slots, `col_${t.prop}`, {
|
|
160
|
-
data:
|
|
161
|
+
data: m.row
|
|
161
162
|
}, () => [
|
|
162
|
-
|
|
163
|
+
R(ae, _({ ref_for: !0 }, { row: m.row, colCfg: t }), null, 16)
|
|
163
164
|
])
|
|
164
165
|
]),
|
|
165
|
-
header:
|
|
166
|
+
header: f(() => [
|
|
166
167
|
d(e.$slots, `header_${t.prop}`, { data: t }, () => [
|
|
167
|
-
|
|
168
|
+
ee(te(t.label), 1)
|
|
168
169
|
])
|
|
169
170
|
]),
|
|
170
171
|
_: 2
|
|
@@ -175,15 +176,15 @@ const ce = {
|
|
|
175
176
|
]),
|
|
176
177
|
_: 3
|
|
177
178
|
}, 16, ["data", "max-height"])), [
|
|
178
|
-
[
|
|
179
|
+
[q, e.tableLoading]
|
|
179
180
|
]),
|
|
180
|
-
|
|
181
|
+
a(P) ? (o(), i(O, {
|
|
181
182
|
key: 1,
|
|
182
183
|
background: "",
|
|
183
|
-
"current-page": r
|
|
184
|
-
"onUpdate:currentPage":
|
|
185
|
-
"page-size": r
|
|
186
|
-
"onUpdate:pageSize":
|
|
184
|
+
"current-page": a(r).pageIndex,
|
|
185
|
+
"onUpdate:currentPage": l[0] || (l[0] = (t) => a(r).pageIndex = t),
|
|
186
|
+
"page-size": a(r).pageSize,
|
|
187
|
+
"onUpdate:pageSize": l[1] || (l[1] = (t) => a(r).pageSize = t),
|
|
187
188
|
"page-sizes": e.sizeList,
|
|
188
189
|
layout: "total, sizes, prev, pager, next, jumper",
|
|
189
190
|
total: e.total
|
|
@@ -193,5 +194,5 @@ const ce = {
|
|
|
193
194
|
}
|
|
194
195
|
});
|
|
195
196
|
export {
|
|
196
|
-
|
|
197
|
+
be as default
|
|
197
198
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DefineComponent, ComponentOptionsMixin, PublicProps,
|
|
2
|
-
declare const _default: DefineComponent<{
|
|
1
|
+
import { DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
2
|
+
declare const _default: DefineComponent<ExtractPropTypes<{
|
|
3
3
|
row: {
|
|
4
4
|
type: ObjectConstructor;
|
|
5
5
|
default: () => void;
|
|
@@ -8,7 +8,7 @@ declare const _default: DefineComponent<{
|
|
|
8
8
|
type: ObjectConstructor;
|
|
9
9
|
default: () => void;
|
|
10
10
|
};
|
|
11
|
-
}
|
|
11
|
+
}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<{
|
|
12
12
|
row: {
|
|
13
13
|
type: ObjectConstructor;
|
|
14
14
|
default: () => void;
|
|
@@ -17,8 +17,8 @@ declare const _default: DefineComponent<{
|
|
|
17
17
|
type: ObjectConstructor;
|
|
18
18
|
default: () => void;
|
|
19
19
|
};
|
|
20
|
-
}
|
|
20
|
+
}>> & Readonly<{}>, {
|
|
21
21
|
row: Record<string, any>;
|
|
22
22
|
colCfg: Record<string, any>;
|
|
23
|
-
}, {}>;
|
|
23
|
+
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
24
24
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as l, computed as p, openBlock as r, createElementBlock as
|
|
1
|
+
import { defineComponent as l, computed as p, openBlock as r, createElementBlock as u, toDisplayString as a } from "vue";
|
|
2
2
|
const f = /* @__PURE__ */ l({
|
|
3
3
|
__name: "valueCol",
|
|
4
4
|
props: {
|
|
@@ -15,10 +15,10 @@ const f = /* @__PURE__ */ l({
|
|
|
15
15
|
},
|
|
16
16
|
setup(n) {
|
|
17
17
|
const c = n, e = p(() => {
|
|
18
|
-
const { row:
|
|
19
|
-
return o
|
|
18
|
+
const { row: t, colCfg: o } = c;
|
|
19
|
+
return t[o.prop];
|
|
20
20
|
});
|
|
21
|
-
return (
|
|
21
|
+
return (t, o) => (r(), u("span", null, a(e.value != null ? e.value : "--"), 1));
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
export {
|
|
@@ -37,6 +37,7 @@ export type TableAttr = {
|
|
|
37
37
|
flexible?: boolean;
|
|
38
38
|
/**是否显示表头 */
|
|
39
39
|
showHeader?: boolean;
|
|
40
|
+
[key: string]: any;
|
|
40
41
|
};
|
|
41
42
|
/**分页 */
|
|
42
43
|
export type Pagination = {
|
|
@@ -100,6 +101,10 @@ export interface TableProp {
|
|
|
100
101
|
total?: number;
|
|
101
102
|
/**可选页面大小 */
|
|
102
103
|
sizeList?: Array<number>;
|
|
104
|
+
/**最大高度为父容器高度,实际高度由数据决定 */
|
|
105
|
+
autoHeight: boolean;
|
|
106
|
+
/**自动显示分页器,当数据量满足分页时显示,否则不显示 */
|
|
107
|
+
autoPagination: boolean;
|
|
103
108
|
}
|
|
104
109
|
export interface TableColumn {
|
|
105
110
|
/**
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { getCurrentInstance as
|
|
1
|
+
import { getCurrentInstance as P, computed as a, reactive as s, toRef as m } from "vue";
|
|
2
2
|
import { FileType as L } from "./type.js";
|
|
3
|
-
function O(
|
|
4
|
-
var
|
|
5
|
-
const t =
|
|
3
|
+
function O(u) {
|
|
4
|
+
var h, p;
|
|
5
|
+
const t = P(), e = t == null ? void 0 : t.props, w = {
|
|
6
6
|
rowKey: "Id",
|
|
7
7
|
"element-loading-text": "加载中…",
|
|
8
8
|
"element-loading-background": "rgba(0, 0, 0, 0.2)",
|
|
9
9
|
highlightCurrentRow: !0,
|
|
10
10
|
stripe: !0,
|
|
11
11
|
border: !1
|
|
12
|
-
},
|
|
12
|
+
}, d = {
|
|
13
13
|
headerAlign: void 0,
|
|
14
14
|
align: void 0,
|
|
15
15
|
prop: void 0,
|
|
@@ -19,51 +19,55 @@ function O(g) {
|
|
|
19
19
|
showOverflowTooltip: !1,
|
|
20
20
|
sortable: void 0,
|
|
21
21
|
fixed: void 0
|
|
22
|
-
},
|
|
22
|
+
}, C = a(() => ({
|
|
23
23
|
...w,
|
|
24
24
|
...Object.keys(e.options).length > 0 ? e.options : {}
|
|
25
|
-
})),
|
|
25
|
+
})), x = s({
|
|
26
26
|
count: 0,
|
|
27
27
|
rows: []
|
|
28
|
-
}),
|
|
29
|
-
pageIndex: (
|
|
30
|
-
pageSize: (
|
|
31
|
-
}),
|
|
32
|
-
var i,
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
}), r = s({
|
|
29
|
+
pageIndex: (h = e == null ? void 0 : e.paging) != null && h.pageIndex ? m(e.paging, "pageIndex") : 1,
|
|
30
|
+
pageSize: (p = e == null ? void 0 : e.paging) != null && p.pageSize ? m(e.paging, "pageSize") : 10
|
|
31
|
+
}), T = a(() => {
|
|
32
|
+
var i, l;
|
|
33
|
+
const n = ((i = e == null ? void 0 : e.paging) == null ? void 0 : i.pageIndex) > 0 && ((l = e == null ? void 0 : e.paging) == null ? void 0 : l.pageSize) > 0;
|
|
34
|
+
if (!e.autoPagination)
|
|
35
|
+
return n;
|
|
36
|
+
const o = e.tableData.length > (e.total || 0) ? e.tableData.length : e.total || 0;
|
|
37
|
+
return n && o > r.pageSize;
|
|
38
|
+
}), S = s({
|
|
35
39
|
/**是否显示 */
|
|
36
40
|
show: !1,
|
|
37
41
|
/**图片路径 */
|
|
38
42
|
filePathList: [],
|
|
39
43
|
/**显示图片的索引 */
|
|
40
44
|
index: 0
|
|
41
|
-
}),
|
|
45
|
+
}), g = s({
|
|
42
46
|
showColumn: [],
|
|
43
47
|
hiddenColumn: []
|
|
44
|
-
}),
|
|
48
|
+
}), f = a(() => !g.showColumn || g.showColumn.length === 0 ? [
|
|
45
49
|
{
|
|
46
50
|
prop: "default-prop",
|
|
47
51
|
init: !0,
|
|
48
52
|
label: ""
|
|
49
53
|
}
|
|
50
|
-
] :
|
|
51
|
-
var
|
|
52
|
-
return (((
|
|
53
|
-
}),
|
|
54
|
-
(
|
|
54
|
+
] : g.showColumn.map((o) => (u && o.langue && (o.label = u(o.langue)), { ...d, ...o }))), y = a(() => {
|
|
55
|
+
var n, o, i, l, c, b;
|
|
56
|
+
return (((i = (o = t == null ? void 0 : (n = t.slots)["tool-left"]) == null ? void 0 : o.call(n)) == null ? void 0 : i.length) || 0) > 0 || (((b = (c = t == null ? void 0 : (l = t.slots)["tool-right"]) == null ? void 0 : c.call(l)) == null ? void 0 : b.length) || 0) > 0;
|
|
57
|
+
}), z = a(() => f.value.some(
|
|
58
|
+
(n) => n.fileType && n.fileType == L.PICTURE
|
|
55
59
|
));
|
|
56
60
|
return {
|
|
57
|
-
defColSetting:
|
|
58
|
-
selectionOptions:
|
|
59
|
-
tableAttribute:
|
|
60
|
-
pagination:
|
|
61
|
-
hasPagination:
|
|
62
|
-
imageViewer:
|
|
63
|
-
columnConfig:
|
|
64
|
-
colSettingList:
|
|
65
|
-
showToolPanel:
|
|
66
|
-
hasImageViewer:
|
|
61
|
+
defColSetting: d,
|
|
62
|
+
selectionOptions: x,
|
|
63
|
+
tableAttribute: C,
|
|
64
|
+
pagination: r,
|
|
65
|
+
hasPagination: T,
|
|
66
|
+
imageViewer: S,
|
|
67
|
+
columnConfig: g,
|
|
68
|
+
colSettingList: f,
|
|
69
|
+
showToolPanel: y,
|
|
70
|
+
hasImageViewer: z
|
|
67
71
|
};
|
|
68
72
|
}
|
|
69
73
|
export {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DefineComponent, ComponentOptionsMixin, PublicProps,
|
|
2
|
-
declare const _default: __VLS_WithTemplateSlots< DefineComponent<{
|
|
1
|
+
import { DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
2
|
+
declare const _default: __VLS_WithTemplateSlots< DefineComponent<ExtractPropTypes<{
|
|
3
3
|
type: {
|
|
4
4
|
type: StringConstructor;
|
|
5
5
|
default: string;
|
|
@@ -7,7 +7,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<{
|
|
|
7
7
|
};
|
|
8
8
|
icon: StringConstructor;
|
|
9
9
|
disabled: BooleanConstructor;
|
|
10
|
-
}
|
|
10
|
+
}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
11
11
|
click: (...args: any[]) => void;
|
|
12
12
|
}, string, PublicProps, Readonly< ExtractPropTypes<{
|
|
13
13
|
type: {
|
|
@@ -17,12 +17,12 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<{
|
|
|
17
17
|
};
|
|
18
18
|
icon: StringConstructor;
|
|
19
19
|
disabled: BooleanConstructor;
|
|
20
|
-
}>> & {
|
|
20
|
+
}>> & Readonly<{
|
|
21
21
|
onClick?: ((...args: any[]) => any) | undefined;
|
|
22
|
-
}
|
|
22
|
+
}>, {
|
|
23
23
|
type: string;
|
|
24
24
|
disabled: boolean;
|
|
25
|
-
}, {}>, {
|
|
25
|
+
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>, {
|
|
26
26
|
default?(_: {}): any;
|
|
27
27
|
}>;
|
|
28
28
|
export default _default;
|