@qy_better_lib/pc 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- (function(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,R,D,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)},disabled:Boolean},emits:["click"],setup(t,{emit:o}){const n=t,i=o;function c(p){n.disabled||i("click",p)}return(p,C)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["text-button",[`text-button-${t.type}`,t.disabled&&"is-disabled"]]),onClick:e.withModifiers(c,["prevent","stop"])},[e.renderSlot(p.$slots,"default")],2))}});V.install=t=>{t.component("TextButton",V)};var z=(t=>(t[t.PICTURE=1]="PICTURE",t[t.PDF=2]="PDF",t[t.OTHER=3]="OTHER",t))(z||{});function A(t){var a,k;const o=e.getCurrentInstance(),n=o==null?void 0:o.props,i={rowKey:"Id","element-loading-text":"加载中…","element-loading-background":"rgba(0, 0, 0, 0.2)",highlightCurrentRow:!0,stripe:!0,border:!1,height:"100%"},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(()=>({...i,...Object.keys(n.options).length>0?n.options:{}})),C=e.reactive({count:0,rows:[]}),_=e.reactive({pageIndex:(a=n==null?void 0:n.paging)!=null&&a.pageIndex?e.toRef(n.paging,"pageIndex"):1,pageSize:(k=n==null?void 0:n.paging)!=null&&k.pageSize?e.toRef(n.paging,"pageSize"):10}),g=e.computed(()=>{var d,s;return((d=n==null?void 0:n.paging)==null?void 0:d.pageIndex)>0&&((s=n==null?void 0:n.paging)==null?void 0:s.pageSize)>0}),u=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(s=>(t&&s.langue&&(s.label=t(s.langue)),{...c,...s}))),h=e.computed(()=>{var d,s,f,y,l,B;return(((f=(s=o==null?void 0:(d=o.slots)["tool-left"])==null?void 0:s.call(d))==null?void 0:f.length)||0)>0||(((B=(l=o==null?void 0:(y=o.slots)["tool-right"])==null?void 0:l.call(y))==null?void 0:B.length)||0)>0}),x=e.computed(()=>w.value.some(d=>d.fileType&&d.fileType==z.PICTURE));return{defColSetting:c,selectionOptions:C,tableAttribute:p,pagination:_,hasPagination:g,imageViewer:u,columnConfig:r,colSettingList:w,showToolPanel:h,hasImageViewer:x}}function O(){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 I=e.defineComponent({__name:"valueCol",props:{row:{type:Object,default:()=>{}},colCfg:{type:Object,default:()=>{}}},setup(t){const o=t,n=e.computed(()=>{const{row:i,colCfg:c}=o;return i[c.prop]});return(i,c)=>(e.openBlock(),e.createElementBlock("span",null,e.toDisplayString(n.value!=null?n.value:"--"),1))}}),U={class:"set-column-list-wrap"},j={class:"fixed-wrap"},H=e.defineComponent({__name:"colVisible",setup(t){const o=e.inject("table-extend"),n=e.ref(!0),i=e.ref(!1),c=e.computed(()=>o&&o.columnConfig.showColumn.map(u=>u.prop)||[]),p=e.computed(()=>(o==null?void 0:o.tableColums.value)||[]);function C(u){u?o&&(o.columnConfig.showColumn=p.value):o&&(o.columnConfig.showColumn=[])}function _(u){if(o){o.columnConfig.showColumn=p.value.filter(w=>u.includes(w.prop));const r=u.length;n.value=r===p.value.length,i.value=r>0&&r<p.value.length}}function g(u,r){r.fixed===u?r.fixed=void 0:r.fixed=u}return(u,r)=>{const w=e.resolveComponent("Setting"),h=e.resolveComponent("el-icon"),x=e.resolveComponent("el-checkbox"),a=e.resolveComponent("Upload"),k=e.resolveComponent("el-divider"),d=e.resolveComponent("el-checkbox-group"),s=e.resolveComponent("el-popover");return e.openBlock(),e.createBlock(s,{placement:"bottom",title:"列显示设置",width:220},{reference:e.withCtx(()=>[e.createVNode(h,null,{default:e.withCtx(()=>[e.createVNode(w)]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",U,[e.createVNode(x,{indeterminate:i.value,modelValue:n.value,"onUpdate:modelValue":r[0]||(r[0]=f=>n.value=f),onChange:C},{default:e.withCtx(()=>r[2]||(r[2]=[e.createTextVNode("全选 ")])),_:1},8,["indeterminate","modelValue"]),e.createVNode(d,{class:"set-column-check-group",modelValue:c.value,"onUpdate:modelValue":r[1]||(r[1]=f=>c.value=f),onChange:_},{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(x,{class:"set-column-check",label:f.prop},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.label),1)]),_:2},1032,["label"]),e.createElementVNode("div",j,[e.createVNode(h,{class:e.normalizeClass(["fixed-icon",f.fixed==="left"&&"active"]),title:"固定到左边",onClick:y=>g("left",f)},{default:e.withCtx(()=>[e.createVNode(a)]),_:2},1032,["class","onClick"]),e.createVNode(k,{direction:"vertical"}),e.createVNode(h,{class:e.normalizeClass(["fixed-icon",f.fixed==="right"&&"active"]),title:"固定到右边",onClick:y=>g("right",f)},{default:e.withCtx(()=>[e.createVNode(a)]),_:2},1032,["class","onClick"])])]))),128))]),_:1},8,["modelValue"])])]),_:1})}}}),q={class:"table-extend"},X={class:"tool-panel"},F={class:"left-panel"},Y={class:"right-panel"},W={class:"default-tool"},K=["innerHTML"],E=e.defineComponent({__name:"index",props:{...O()},emits:["tableSort","handleSelectionChange","currentChange","pageSizeChange","rowClick","rowDblClick"],setup(t,{expose:o,emit:n}){const i=t,c=n,{t:p}=R.useI18n(),{selectionOptions:C,tableAttribute:_,pagination:g,hasPagination:u,columnConfig:r,colSettingList:w}=A(p);e.provide("table-extend",{tableProps:i,tableColums:e.toRef(i,"tableColums"),columnConfig:r});const h=e.ref(null),x=e.ref(!1);e.watch(()=>i.tableColums,()=>{r.showColumn=i.tableColums}),e.watch(()=>g.pageIndex,l=>{if(l&&l>0){if(x.value){x.value=!1;return}c("currentChange",l),h.value.setScrollTop(0)}}),e.watch(()=>g.pageSize,l=>{l&&l>0&&(x.value=!0,g.pageIndex=1,c("pageSizeChange",l),h.value.setScrollTop(0))}),e.onMounted(()=>{e.nextTick(()=>{i.tableColums&&i.tableColums.length>0&&(r.showColumn=i.tableColums)})}),o({clearSelection:f,toggleRowSelection:y});function a(l){c("tableSort",{sortName:l.prop,sortType:l.order==="descending"?"desc":l.order==="ascending"?"asc":""})}function k(l){C.rows=l,C.count=l&&l.length,c("handleSelectionChange",l)}function d(l){c("rowClick",l)}function s(l){c("rowDblClick",l)}function f(){var l;(l=h.value)==null||l.clearSelection()}function y(l){var B;(B=h.value)==null||B.toggleRowSelection(l)}return(l,B)=>{const T=e.resolveComponent("el-table-column"),oe=e.resolveComponent("el-empty"),ne=e.resolveComponent("el-table"),le=e.resolveComponent("el-pagination"),ie=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",q,[e.createElementVNode("div",X,[e.createElementVNode("div",F,[e.renderSlot(l.$slots,"tool-left")]),e.createElementVNode("div",Y,[e.renderSlot(l.$slots,"tool-right"),e.createElementVNode("div",W,[l.isSetColumn?(e.openBlock(),e.createBlock(H,{key:0})):e.createCommentVNode("",!0)])])]),e.withDirectives((e.openBlock(),e.createBlock(ne,e.mergeProps({ref_key:"tableRef",ref:h},e.unref(_),{data:l.tableData,onSortChange:a,onSelectionChange:k,onRowClick:d,onRowDblclick:s}),{empty:e.withCtx(()=>[e.createVNode(oe,{"image-size":60})]),default:e.withCtx(()=>[l.selectionCol?(e.openBlock(),e.createBlock(T,{key:0,type:"selection",width:"48",fixed:"left"})):e.createCommentVNode("",!0),l.indexCol?(e.openBlock(),e.createBlock(T,{key:1,type:"index",width:"58",fixed:"left"})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(w),b=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:b.prop},[b.isHtml?(e.openBlock(),e.createBlock(T,e.mergeProps({key:0,ref_for:!0},b),{default:e.withCtx($=>[e.createElementVNode("div",{innerHTML:b.prop&&$.row[b.prop]},null,8,K)]),_:2},1040)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[b.init?(e.openBlock(),e.createBlock(T,e.mergeProps({key:0,ref_for:!0},b),{default:e.withCtx($=>[e.renderSlot(l.$slots,`col_${b.prop}`,{data:$.row},()=>[e.createVNode(I,e.mergeProps({ref_for:!0},{row:$.row,colCfg:b}),null,16)])]),_:2},1040)):e.createCommentVNode("",!0)],64))],64))),128)),e.renderSlot(l.$slots,"operatColumn")]),_:3},16,["data"])),[[ie,l.tableLoading]]),e.unref(u)?(e.openBlock(),e.createBlock(le,{key:0,background:"","current-page":e.unref(g).pageIndex,"onUpdate:currentPage":B[0]||(B[0]=b=>e.unref(g).pageIndex=b),"page-size":e.unref(g).pageSize,"onUpdate:pageSize":B[1]||(B[1]=b=>e.unref(g).pageSize=b),"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)])}}});E.install=t=>{t.component("TableExtend",E)};const G={class:"contextmenu-wrap"},J={class:"contextmenu-items"},Q=["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:o,emit:n}){const i=t,c=n;o({hide:h,show:r});const p=e.ref(!1),C=e.ref(null),_=e.reactive({left:0,top:0});e.watch(()=>i.visible,a=>{a&&(p.value=!0,e.nextTick(()=>{w(i.position)}))},{immediate:!0}),e.onMounted(()=>{var a;(a=C.value)==null||a.addEventListener("contextmenu",r)}),e.onBeforeUnmount(()=>{g()});function g(){var a;(a=C.value)==null||a.removeEventListener("contextmenu",r)}function u(a){c("menuClick",a),h()}async function r(a){a.preventDefault(),p.value=!0,await e.nextTick();const{pageX:k,pageY:d}=a;w({x:k,y:d})}function w(a){const{clientWidth:k,clientHeight:d}=C.value;!k||!d||(_.top=`${x("Y",a.y||0,d)}px`,_.left=`${x("X",a.x||0,k)}px`)}function h(){g(),p.value=!1,e.nextTick(()=>{c("update:visible",!1)})}function x(a,k,d){const s=a==="X"?window.innerWidth:window.innerHeight,f=a==="X"?window.scrollX:window.scrollY;let y=k-f;return y+d>s&&(y=Math.max(0,y-d)),y+f}return(a,k)=>{const d=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:_.top,left:_.left}),ref_key:"contextMenuRef",ref:C},[e.createElementVNode("div",G,[e.createElementVNode("ul",J,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,s=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:s.key},[(s==null?void 0:s.type)=="divider"?(e.openBlock(),e.createBlock(d,{key:0})):(e.openBlock(),e.createElementBlock("li",{key:1,class:"contextmenu-item",onClick:f=>u(s)},[e.renderSlot(a.$slots,"items",{data:{item:s,options:t.options}},()=>[e.createTextVNode(e.toDisplayString(s.label),1)])],8,Q))],64))),128))])])],4)),[[e.unref(D.ClickOutside),h]]):e.createCommentVNode("",!0)])}}});N.install=t=>{t.component("ContextMenu",N)};function Z(t,o,n=!0){switch(o){case"toast":P(n?"success":"error",t||(n?"执行成功":"执行失败"));break;case"dialog":L(t||(n?"执行成功":"执行失败"),()=>{},{title:"提示",type:n?"success":"error","show-cancel-button":!1});break;case"notif":M(o,t);break}}function v(t,o,n){const i={beforeClose:(c,p,C)=>{c==="confirm"?setTimeout(()=>{C()},0):C()},...n};S.ElMessageBox.confirm(`此操作将${t}, 是否继续?`,"提示",i).then(async()=>{o&&o()}).catch(()=>{})}function L(t,o,n){return new Promise((i,c)=>{const p={beforeClose:(C,_,g)=>{C==="confirm"?setTimeout(()=>{g()},0):g()},...n};S.ElMessageBox.confirm(`${t}`,"Tip",p).then(()=>{i(o&&o())}).catch(()=>{})})}function P(t,o="",n=!1,i=3e3){S.ElMessage({showClose:!0,message:o,type:t,duration:i,dangerouslyUseHTMLString:n})}function M(t,o="",n=!0,i="bottom-right",c=0){S.ElNotification({title:"消息通知",message:o,type:t,dangerouslyUseHTMLString:n,duration:c,showClose:!0,position:i})}const ee=[V,E,N];function te(t){ee.forEach(o=>{t.use(o)})}m.confirmBox=v,m.confirmBoxAsync=L,m.contextMenu=N,m.install=te,m.messageAlert=P,m.messageBox=Z,m.notification=M,m.tableExtend=E,m.textButton=V,Object.defineProperty(m,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,R,D,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)},disabled:Boolean},emits:["click"],setup(t,{emit:o}){const n=t,i=o;function c(p){n.disabled||i("click",p)}return(p,C)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["text-button",[`text-button-${t.type}`,t.disabled&&"is-disabled"]]),onClick:e.withModifiers(c,["prevent","stop"])},[e.renderSlot(p.$slots,"default")],2))}});V.install=t=>{t.component("TextButton",V)};var z=(t=>(t[t.PICTURE=1]="PICTURE",t[t.PDF=2]="PDF",t[t.OTHER=3]="OTHER",t))(z||{});function A(t){var a,k;const o=e.getCurrentInstance(),n=o==null?void 0:o.props,i={rowKey:"Id","element-loading-text":"加载中…","element-loading-background":"rgba(0, 0, 0, 0.2)",highlightCurrentRow:!0,stripe:!0,border:!1,height:"100%"},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(()=>({...i,...Object.keys(n.options).length>0?n.options:{}})),C=e.reactive({count:0,rows:[]}),_=e.reactive({pageIndex:(a=n==null?void 0:n.paging)!=null&&a.pageIndex?e.toRef(n.paging,"pageIndex"):1,pageSize:(k=n==null?void 0:n.paging)!=null&&k.pageSize?e.toRef(n.paging,"pageSize"):10}),g=e.computed(()=>{var d,s;return((d=n==null?void 0:n.paging)==null?void 0:d.pageIndex)>0&&((s=n==null?void 0:n.paging)==null?void 0:s.pageSize)>0}),u=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(s=>(t&&s.langue&&(s.label=t(s.langue)),{...c,...s}))),h=e.computed(()=>{var d,s,f,y,l,B;return(((f=(s=o==null?void 0:(d=o.slots)["tool-left"])==null?void 0:s.call(d))==null?void 0:f.length)||0)>0||(((B=(l=o==null?void 0:(y=o.slots)["tool-right"])==null?void 0:l.call(y))==null?void 0:B.length)||0)>0}),x=e.computed(()=>w.value.some(d=>d.fileType&&d.fileType==z.PICTURE));return{defColSetting:c,selectionOptions:C,tableAttribute:p,pagination:_,hasPagination:g,imageViewer:u,columnConfig:r,colSettingList:w,showToolPanel:h,hasImageViewer:x}}function O(){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 I=e.defineComponent({__name:"valueCol",props:{row:{type:Object,default:()=>{}},colCfg:{type:Object,default:()=>{}}},setup(t){const o=t,n=e.computed(()=>{const{row:i,colCfg:c}=o;return i[c.prop]});return(i,c)=>(e.openBlock(),e.createElementBlock("span",null,e.toDisplayString(n.value!=null?n.value:"--"),1))}}),U={class:"set-column-list-wrap"},j={class:"fixed-wrap"},H=e.defineComponent({__name:"colVisible",setup(t){const o=e.inject("table-extend"),n=e.ref(!0),i=e.ref(!1),c=e.computed(()=>o&&o.columnConfig.showColumn.map(u=>u.prop)||[]),p=e.computed(()=>(o==null?void 0:o.tableColums.value)||[]);function C(u){u?o&&(o.columnConfig.showColumn=p.value):o&&(o.columnConfig.showColumn=[])}function _(u){if(o){o.columnConfig.showColumn=p.value.filter(w=>u.includes(w.prop));const r=u.length;n.value=r===p.value.length,i.value=r>0&&r<p.value.length}}function g(u,r){r.fixed===u?r.fixed=void 0:r.fixed=u}return(u,r)=>{const w=e.resolveComponent("Setting"),h=e.resolveComponent("el-icon"),x=e.resolveComponent("el-checkbox"),a=e.resolveComponent("Upload"),k=e.resolveComponent("el-divider"),d=e.resolveComponent("el-checkbox-group"),s=e.resolveComponent("el-popover");return e.openBlock(),e.createBlock(s,{placement:"bottom",title:"列显示设置",width:220},{reference:e.withCtx(()=>[e.createVNode(h,null,{default:e.withCtx(()=>[e.createVNode(w)]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",U,[e.createVNode(x,{indeterminate:i.value,modelValue:n.value,"onUpdate:modelValue":r[0]||(r[0]=f=>n.value=f),onChange:C},{default:e.withCtx(()=>r[2]||(r[2]=[e.createTextVNode("全选 ")])),_:1},8,["indeterminate","modelValue"]),e.createVNode(d,{class:"set-column-check-group",modelValue:c.value,"onUpdate:modelValue":r[1]||(r[1]=f=>c.value=f),onChange:_},{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(x,{class:"set-column-check",label:f.prop},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.label),1)]),_:2},1032,["label"]),e.createElementVNode("div",j,[e.createVNode(h,{class:e.normalizeClass(["fixed-icon",f.fixed==="left"&&"active"]),title:"固定到左边",onClick:y=>g("left",f)},{default:e.withCtx(()=>[e.createVNode(a)]),_:2},1032,["class","onClick"]),e.createVNode(k,{direction:"vertical"}),e.createVNode(h,{class:e.normalizeClass(["fixed-icon",f.fixed==="right"&&"active"]),title:"固定到右边",onClick:y=>g("right",f)},{default:e.withCtx(()=>[e.createVNode(a)]),_:2},1032,["class","onClick"])])]))),128))]),_:1},8,["modelValue"])])]),_:1})}}}),q={class:"table-extend"},X={class:"tool-panel"},F={class:"left-panel"},Y={class:"right-panel"},W={class:"default-tool"},K=["innerHTML"],E=e.defineComponent({__name:"index",props:{...O()},emits:["tableSort","handleSelectionChange","currentChange","pageSizeChange","rowClick","rowDblClick"],setup(t,{expose:o,emit:n}){const i=t,c=n,{t:p}=R.useI18n(),{selectionOptions:C,tableAttribute:_,pagination:g,hasPagination:u,columnConfig:r,colSettingList:w}=A(p);e.provide("table-extend",{tableProps:i,tableColums:e.toRef(i,"tableColums"),columnConfig:r});const h=e.ref(null),x=e.ref(!1);e.watch(()=>i.tableColums,()=>{r.showColumn=i.tableColums}),e.watch(()=>g.pageIndex,l=>{if(l&&l>0){if(x.value){x.value=!1;return}c("currentChange",l),h.value.setScrollTop(0)}}),e.watch(()=>g.pageSize,l=>{l&&l>0&&(x.value=!0,g.pageIndex=1,c("pageSizeChange",l),h.value.setScrollTop(0))}),e.onMounted(()=>{e.nextTick(()=>{i.tableColums&&i.tableColums.length>0&&(r.showColumn=i.tableColums)})}),o({instance:h,clearSelection:f,toggleRowSelection:y});function a(l){c("tableSort",{sortName:l.prop,sortType:l.order==="descending"?"desc":l.order==="ascending"?"asc":""})}function k(l){C.rows=l,C.count=l&&l.length,c("handleSelectionChange",l)}function d(l){c("rowClick",l)}function s(l){c("rowDblClick",l)}function f(){var l;(l=h.value)==null||l.clearSelection()}function y(l){var B;(B=h.value)==null||B.toggleRowSelection(l)}return(l,B)=>{const T=e.resolveComponent("el-table-column"),oe=e.resolveComponent("el-empty"),ne=e.resolveComponent("el-table"),le=e.resolveComponent("el-pagination"),ie=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",q,[e.createElementVNode("div",X,[e.createElementVNode("div",F,[e.renderSlot(l.$slots,"tool-left")]),e.createElementVNode("div",Y,[e.renderSlot(l.$slots,"tool-right"),e.createElementVNode("div",W,[l.isSetColumn?(e.openBlock(),e.createBlock(H,{key:0})):e.createCommentVNode("",!0)])])]),e.withDirectives((e.openBlock(),e.createBlock(ne,e.mergeProps({ref_key:"tableRef",ref:h},e.unref(_),{data:l.tableData,onSortChange:a,onSelectionChange:k,onRowClick:d,onRowDblclick:s}),{empty:e.withCtx(()=>[e.createVNode(oe,{"image-size":60})]),default:e.withCtx(()=>[l.selectionCol?(e.openBlock(),e.createBlock(T,{key:0,type:"selection",width:"48",fixed:"left"})):e.createCommentVNode("",!0),l.indexCol?(e.openBlock(),e.createBlock(T,{key:1,type:"index",width:"58",fixed:"left"})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(w),b=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:b.prop},[b.isHtml?(e.openBlock(),e.createBlock(T,e.mergeProps({key:0,ref_for:!0},b),{default:e.withCtx($=>[e.createElementVNode("div",{innerHTML:b.prop&&$.row[b.prop]},null,8,K)]),_:2},1040)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[b.init?(e.openBlock(),e.createBlock(T,e.mergeProps({key:0,ref_for:!0},b),{default:e.withCtx($=>[e.renderSlot(l.$slots,`col_${b.prop}`,{data:$.row},()=>[e.createVNode(I,e.mergeProps({ref_for:!0},{row:$.row,colCfg:b}),null,16)])]),_:2},1040)):e.createCommentVNode("",!0)],64))],64))),128)),e.renderSlot(l.$slots,"operatColumn")]),_:3},16,["data"])),[[ie,l.tableLoading]]),e.unref(u)?(e.openBlock(),e.createBlock(le,{key:0,background:"","current-page":e.unref(g).pageIndex,"onUpdate:currentPage":B[0]||(B[0]=b=>e.unref(g).pageIndex=b),"page-size":e.unref(g).pageSize,"onUpdate:pageSize":B[1]||(B[1]=b=>e.unref(g).pageSize=b),"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)])}}});E.install=t=>{t.component("TableExtend",E)};const G={class:"contextmenu-wrap"},J={class:"contextmenu-items"},Q=["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:o,emit:n}){const i=t,c=n;o({hide:h,show:r});const p=e.ref(!1),C=e.ref(null),_=e.reactive({left:0,top:0});e.watch(()=>i.visible,a=>{a&&(p.value=!0,e.nextTick(()=>{w(i.position)}))},{immediate:!0}),e.onMounted(()=>{var a;(a=C.value)==null||a.addEventListener("contextmenu",r)}),e.onBeforeUnmount(()=>{g()});function g(){var a;(a=C.value)==null||a.removeEventListener("contextmenu",r)}function u(a){c("menuClick",a),h()}async function r(a){a.preventDefault(),p.value=!0,await e.nextTick();const{pageX:k,pageY:d}=a;w({x:k,y:d})}function w(a){const{clientWidth:k,clientHeight:d}=C.value;!k||!d||(_.top=`${x("Y",a.y||0,d)}px`,_.left=`${x("X",a.x||0,k)}px`)}function h(){g(),p.value=!1,e.nextTick(()=>{c("update:visible",!1)})}function x(a,k,d){const s=a==="X"?window.innerWidth:window.innerHeight,f=a==="X"?window.scrollX:window.scrollY;let y=k-f;return y+d>s&&(y=Math.max(0,y-d)),y+f}return(a,k)=>{const d=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:_.top,left:_.left}),ref_key:"contextMenuRef",ref:C},[e.createElementVNode("div",G,[e.createElementVNode("ul",J,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,s=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:s.key},[(s==null?void 0:s.type)=="divider"?(e.openBlock(),e.createBlock(d,{key:0})):(e.openBlock(),e.createElementBlock("li",{key:1,class:"contextmenu-item",onClick:f=>u(s)},[e.renderSlot(a.$slots,"items",{data:{item:s,options:t.options}},()=>[e.createTextVNode(e.toDisplayString(s.label),1)])],8,Q))],64))),128))])])],4)),[[e.unref(D.ClickOutside),h]]):e.createCommentVNode("",!0)])}}});N.install=t=>{t.component("ContextMenu",N)};function Z(t,o,n=!0){switch(o){case"toast":P(n?"success":"error",t||(n?"执行成功":"执行失败"));break;case"dialog":L(t||(n?"执行成功":"执行失败"),()=>{},{title:"提示",type:n?"success":"error","show-cancel-button":!1});break;case"notif":M(o,t);break}}function v(t,o,n){const i={beforeClose:(c,p,C)=>{c==="confirm"?setTimeout(()=>{C()},0):C()},...n};S.ElMessageBox.confirm(`此操作将${t}, 是否继续?`,"提示",i).then(async()=>{o&&o()}).catch(()=>{})}function L(t,o,n){return new Promise((i,c)=>{const p={beforeClose:(C,_,g)=>{C==="confirm"?setTimeout(()=>{g()},0):g()},...n};S.ElMessageBox.confirm(`${t}`,"Tip",p).then(()=>{i(o&&o())}).catch(()=>{})})}function P(t,o="",n=!1,i=3e3){S.ElMessage({showClose:!0,message:o,type:t,duration:i,dangerouslyUseHTMLString:n})}function M(t,o="",n=!0,i="bottom-right",c=0){S.ElNotification({title:"消息通知",message:o,type:t,dangerouslyUseHTMLString:n,duration:c,showClose:!0,position:i})}const ee=[V,E,N];function te(t){ee.forEach(o=>{t.use(o)})}m.confirmBox=v,m.confirmBoxAsync=L,m.contextMenu=N,m.install=te,m.messageAlert=P,m.messageBox=Z,m.notification=M,m.tableExtend=E,m.textButton=V,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
@@ -0,0 +1,71 @@
1
+ import { PropType, DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
2
+
3
+ /**
4
+ * 右键菜单显示
5
+ */
6
+ declare function show(e: any): Promise<void>;
7
+ declare function hide(): void;
8
+ declare const _default: __VLS_WithTemplateSlots< DefineComponent<ExtractPropTypes<{
9
+ visible: {
10
+ type: BooleanConstructor;
11
+ default: () => boolean;
12
+ };
13
+ position: {
14
+ type: PropType<{
15
+ x: number;
16
+ y: number;
17
+ }>;
18
+ default: () => void;
19
+ };
20
+ options: {
21
+ type: PropType<Record<string, any>>;
22
+ default: never[];
23
+ required: true;
24
+ };
25
+ }>, {
26
+ hide: typeof hide;
27
+ show: typeof show;
28
+ }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
29
+ menuClick: (...args: any[]) => void;
30
+ "update:visible": (...args: any[]) => void;
31
+ }, string, PublicProps, Readonly< ExtractPropTypes<{
32
+ visible: {
33
+ type: BooleanConstructor;
34
+ default: () => boolean;
35
+ };
36
+ position: {
37
+ type: PropType<{
38
+ x: number;
39
+ y: number;
40
+ }>;
41
+ default: () => void;
42
+ };
43
+ options: {
44
+ type: PropType<Record<string, any>>;
45
+ default: never[];
46
+ required: true;
47
+ };
48
+ }>> & Readonly<{
49
+ onMenuClick?: ((...args: any[]) => any) | undefined;
50
+ "onUpdate:visible"?: ((...args: any[]) => any) | undefined;
51
+ }>, {
52
+ options: Record<string, any>;
53
+ visible: boolean;
54
+ position: {
55
+ x: number;
56
+ y: number;
57
+ };
58
+ }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>, {
59
+ items?(_: {
60
+ data: {
61
+ item: any;
62
+ options: Record<string, any>;
63
+ };
64
+ }): any;
65
+ }>;
66
+ export default _default;
67
+ type __VLS_WithTemplateSlots<T, S> = T & {
68
+ new (): {
69
+ $slots: S;
70
+ };
71
+ };
@@ -0,0 +1,108 @@
1
+ import { defineComponent as M, ref as h, reactive as X, watch as $, nextTick as m, onMounted as D, onBeforeUnmount as L, resolveComponent as N, openBlock as i, createBlock as _, Teleport as P, withDirectives as S, createElementBlock as a, normalizeStyle as T, createElementVNode as C, Fragment as b, renderList as V, renderSlot as Y, createTextVNode as H, toDisplayString as O, unref as R, createCommentVNode as W } from "vue";
2
+ import { ClickOutside as j } from "@qy_better_lib/core";
3
+ const q = { class: "contextmenu-wrap" }, z = { class: "contextmenu-items" }, A = ["onClick"], G = /* @__PURE__ */ M({
4
+ __name: "index",
5
+ props: {
6
+ visible: {
7
+ type: Boolean,
8
+ default: () => !1
9
+ },
10
+ position: {
11
+ type: Object,
12
+ default: () => {
13
+ }
14
+ },
15
+ options: {
16
+ type: Array,
17
+ default: [],
18
+ required: !0
19
+ }
20
+ },
21
+ emits: ["menuClick", "update:visible"],
22
+ setup(u, { expose: g, emit: B }) {
23
+ const v = u, y = B;
24
+ g({
25
+ hide: p,
26
+ show: d
27
+ });
28
+ const l = h(!1), s = h(null), c = X({
29
+ left: 0,
30
+ top: 0
31
+ });
32
+ $(() => v.visible, (e) => {
33
+ e && (l.value = !0, m(() => {
34
+ k(v.position);
35
+ }));
36
+ }, {
37
+ immediate: !0
38
+ }), D(() => {
39
+ var e;
40
+ (e = s.value) == null || e.addEventListener("contextmenu", d);
41
+ }), L(() => {
42
+ x();
43
+ });
44
+ function x() {
45
+ var e;
46
+ (e = s.value) == null || e.removeEventListener("contextmenu", d);
47
+ }
48
+ function E(e) {
49
+ y("menuClick", e), p();
50
+ }
51
+ async function d(e) {
52
+ e.preventDefault(), l.value = !0, await m();
53
+ const { pageX: o, pageY: t } = e;
54
+ k({ x: o, y: t });
55
+ }
56
+ function k(e) {
57
+ const { clientWidth: o, clientHeight: t } = s.value;
58
+ !o || !t || (c.top = `${w("Y", e.y || 0, t)}px`, c.left = `${w("X", e.x || 0, o)}px`);
59
+ }
60
+ function p() {
61
+ x(), l.value = !1, m(() => {
62
+ y("update:visible", !1);
63
+ });
64
+ }
65
+ function w(e, o, t) {
66
+ const n = e === "X" ? window.innerWidth : window.innerHeight, f = e === "X" ? window.scrollX : window.scrollY;
67
+ let r = o - f;
68
+ return r + t > n && (r = Math.max(0, r - t)), r + f;
69
+ }
70
+ return (e, o) => {
71
+ const t = N("el-divider");
72
+ return i(), _(P, { to: "body" }, [
73
+ l.value ? S((i(), a("div", {
74
+ key: 0,
75
+ class: "contextmenu",
76
+ style: T({ top: c.top, left: c.left }),
77
+ ref_key: "contextMenuRef",
78
+ ref: s
79
+ }, [
80
+ C("div", q, [
81
+ C("ul", z, [
82
+ (i(!0), a(b, null, V(u.options, (n) => (i(), a(b, {
83
+ key: n.key
84
+ }, [
85
+ (n == null ? void 0 : n.type) == "divider" ? (i(), _(t, { key: 0 })) : (i(), a("li", {
86
+ key: 1,
87
+ class: "contextmenu-item",
88
+ onClick: (f) => E(n)
89
+ }, [
90
+ Y(e.$slots, "items", {
91
+ data: { item: n, options: u.options }
92
+ }, () => [
93
+ H(O(n.label), 1)
94
+ ])
95
+ ], 8, A))
96
+ ], 64))), 128))
97
+ ])
98
+ ])
99
+ ], 4)), [
100
+ [R(j), p]
101
+ ]) : W("", !0)
102
+ ]);
103
+ };
104
+ }
105
+ });
106
+ export {
107
+ G as default
108
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./index.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,3 @@
1
+ import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
2
+ declare const _default: DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
3
+ export default _default;
@@ -0,0 +1,103 @@
1
+ import { defineComponent as A, inject as E, ref as v, computed as h, resolveComponent as i, openBlock as r, createBlock as F, withCtx as c, createVNode as t, createElementVNode as g, createTextVNode as k, createElementBlock as x, Fragment as $, renderList as j, toDisplayString as y, normalizeClass as b } from "vue";
2
+ const z = { class: "set-column-list-wrap" }, D = { class: "fixed-wrap" }, T = /* @__PURE__ */ A({
3
+ __name: "colVisible",
4
+ setup(I) {
5
+ const n = E("table-extend"), s = v(!0), m = v(!1), f = h(() => n && n.columnConfig.showColumn.map((l) => l.prop) || []), a = h(() => (n == null ? void 0 : n.tableColums.value) || []);
6
+ function V(l) {
7
+ l ? n && (n.columnConfig.showColumn = a.value) : n && (n.columnConfig.showColumn = []);
8
+ }
9
+ function w(l) {
10
+ if (n) {
11
+ n.columnConfig.showColumn = a.value.filter((u) => l.includes(u.prop));
12
+ const e = l.length;
13
+ s.value = e === a.value.length, m.value = e > 0 && e < a.value.length;
14
+ }
15
+ }
16
+ function p(l, e) {
17
+ e.fixed === l ? e.fixed = void 0 : e.fixed = l;
18
+ }
19
+ return (l, e) => {
20
+ const u = i("Setting"), d = i("el-icon"), _ = i("el-checkbox"), C = i("Upload"), U = i("el-divider"), B = i("el-checkbox-group"), N = i("el-popover");
21
+ return r(), F(N, {
22
+ placement: "bottom",
23
+ title: "列显示设置",
24
+ width: 220
25
+ }, {
26
+ reference: c(() => [
27
+ t(d, null, {
28
+ default: c(() => [
29
+ t(u)
30
+ ]),
31
+ _: 1
32
+ })
33
+ ]),
34
+ default: c(() => [
35
+ g("div", z, [
36
+ t(_, {
37
+ indeterminate: m.value,
38
+ modelValue: s.value,
39
+ "onUpdate:modelValue": e[0] || (e[0] = (o) => s.value = o),
40
+ onChange: V
41
+ }, {
42
+ default: c(() => e[2] || (e[2] = [
43
+ k("全选 ")
44
+ ])),
45
+ _: 1
46
+ }, 8, ["indeterminate", "modelValue"]),
47
+ t(B, {
48
+ class: "set-column-check-group",
49
+ modelValue: f.value,
50
+ "onUpdate:modelValue": e[1] || (e[1] = (o) => f.value = o),
51
+ onChange: w
52
+ }, {
53
+ default: c(() => [
54
+ (r(!0), x($, null, j(a.value, (o) => (r(), x("div", {
55
+ class: "group-item",
56
+ key: o.prop
57
+ }, [
58
+ t(_, {
59
+ class: "set-column-check",
60
+ label: o.prop
61
+ }, {
62
+ default: c(() => [
63
+ k(y(o.label), 1)
64
+ ]),
65
+ _: 2
66
+ }, 1032, ["label"]),
67
+ g("div", D, [
68
+ t(d, {
69
+ class: b(["fixed-icon", o.fixed === "left" && "active"]),
70
+ title: "固定到左边",
71
+ onClick: (S) => p("left", o)
72
+ }, {
73
+ default: c(() => [
74
+ t(C)
75
+ ]),
76
+ _: 2
77
+ }, 1032, ["class", "onClick"]),
78
+ t(U, { direction: "vertical" }),
79
+ t(d, {
80
+ class: b(["fixed-icon", o.fixed === "right" && "active"]),
81
+ title: "固定到右边",
82
+ onClick: (S) => p("right", o)
83
+ }, {
84
+ default: c(() => [
85
+ t(C)
86
+ ]),
87
+ _: 2
88
+ }, 1032, ["class", "onClick"])
89
+ ])
90
+ ]))), 128))
91
+ ]),
92
+ _: 1
93
+ }, 8, ["modelValue"])
94
+ ])
95
+ ]),
96
+ _: 1
97
+ });
98
+ };
99
+ }
100
+ });
101
+ export {
102
+ T as default
103
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./colVisible.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,118 @@
1
+ import { DefineComponent, ExtractPropTypes, PropType, Ref, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
2
+ import { TableAttr, TableColumn } from './../type';
3
+ declare function clearSelection(): void;
4
+ declare function toggleRowSelection(row: any): void;
5
+ declare const _default: __VLS_WithTemplateSlots< DefineComponent<ExtractPropTypes<{
6
+ options: {
7
+ type: PropType<TableAttr>;
8
+ default: () => {};
9
+ };
10
+ tableData: {
11
+ type: ArrayConstructor;
12
+ default: never[];
13
+ };
14
+ tableColums: {
15
+ type: PropType< TableColumn[]>;
16
+ default: () => never[];
17
+ };
18
+ tableLoading: BooleanConstructor;
19
+ selectionCol: {
20
+ type: BooleanConstructor;
21
+ default: () => boolean;
22
+ };
23
+ indexCol: {
24
+ type: BooleanConstructor;
25
+ default: () => boolean;
26
+ };
27
+ isSetColumn: {
28
+ type: BooleanConstructor;
29
+ default: () => boolean;
30
+ };
31
+ paging: {
32
+ type: PropType<{
33
+ pageIndex: number;
34
+ pageSize: number;
35
+ }>;
36
+ };
37
+ total: NumberConstructor;
38
+ sizeList: {
39
+ type: PropType<number[]>;
40
+ default: () => number[];
41
+ };
42
+ }>, {
43
+ instance: Ref<any, any>;
44
+ clearSelection: typeof clearSelection;
45
+ toggleRowSelection: typeof toggleRowSelection;
46
+ }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
47
+ tableSort: (...args: any[]) => void;
48
+ handleSelectionChange: (...args: any[]) => void;
49
+ currentChange: (...args: any[]) => void;
50
+ pageSizeChange: (...args: any[]) => void;
51
+ rowClick: (...args: any[]) => void;
52
+ rowDblClick: (...args: any[]) => void;
53
+ }, string, PublicProps, Readonly< ExtractPropTypes<{
54
+ options: {
55
+ type: PropType<TableAttr>;
56
+ default: () => {};
57
+ };
58
+ tableData: {
59
+ type: ArrayConstructor;
60
+ default: never[];
61
+ };
62
+ tableColums: {
63
+ type: PropType< TableColumn[]>;
64
+ default: () => never[];
65
+ };
66
+ tableLoading: BooleanConstructor;
67
+ selectionCol: {
68
+ type: BooleanConstructor;
69
+ default: () => boolean;
70
+ };
71
+ indexCol: {
72
+ type: BooleanConstructor;
73
+ default: () => boolean;
74
+ };
75
+ isSetColumn: {
76
+ type: BooleanConstructor;
77
+ default: () => boolean;
78
+ };
79
+ paging: {
80
+ type: PropType<{
81
+ pageIndex: number;
82
+ pageSize: number;
83
+ }>;
84
+ };
85
+ total: NumberConstructor;
86
+ sizeList: {
87
+ type: PropType<number[]>;
88
+ default: () => number[];
89
+ };
90
+ }>> & Readonly<{
91
+ onTableSort?: ((...args: any[]) => any) | undefined;
92
+ onHandleSelectionChange?: ((...args: any[]) => any) | undefined;
93
+ onCurrentChange?: ((...args: any[]) => any) | undefined;
94
+ onPageSizeChange?: ((...args: any[]) => any) | undefined;
95
+ onRowClick?: ((...args: any[]) => any) | undefined;
96
+ onRowDblClick?: ((...args: any[]) => any) | undefined;
97
+ }>, {
98
+ tableColums: TableColumn[];
99
+ options: TableAttr;
100
+ tableData: unknown[];
101
+ tableLoading: boolean;
102
+ selectionCol: boolean;
103
+ indexCol: boolean;
104
+ isSetColumn: boolean;
105
+ sizeList: number[];
106
+ }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>, Partial<Record<`col_${string}`, (_: {
107
+ data: any;
108
+ }) => any>> & {
109
+ "tool-left"?(_: {}): any;
110
+ "tool-right"?(_: {}): any;
111
+ operatColumn?(_: {}): any;
112
+ }>;
113
+ export default _default;
114
+ type __VLS_WithTemplateSlots<T, S> = T & {
115
+ new (): {
116
+ $slots: S;
117
+ };
118
+ };
@@ -0,0 +1,178 @@
1
+ import { defineComponent as F, provide as O, toRef as q, ref as y, watch as k, onMounted as G, nextTick as J, resolveComponent as f, resolveDirective as K, openBlock as o, createElementBlock as m, createElementVNode as p, renderSlot as C, createBlock as r, createCommentVNode as u, withDirectives as Q, mergeProps as b, unref as i, withCtx as h, createVNode as z, Fragment as v, renderList as W } from "vue";
2
+ import { useI18n as X } from "vue-i18n";
3
+ import Y from "../useTable.js";
4
+ import Z from "../props.js";
5
+ import ee from "./valueCol.vue.js";
6
+ import te from "./colVisible.vue.js";
7
+ const oe = { class: "table-extend" }, ne = { class: "tool-panel" }, le = { class: "left-panel" }, ae = { class: "right-panel" }, re = { class: "default-tool" }, ie = ["innerHTML"], fe = /* @__PURE__ */ F({
8
+ __name: "index",
9
+ props: { ...Z() },
10
+ emits: [
11
+ "tableSort",
12
+ "handleSelectionChange",
13
+ "currentChange",
14
+ "pageSizeChange",
15
+ "rowClick",
16
+ "rowDblClick"
17
+ ],
18
+ setup(D, { expose: R, emit: T }) {
19
+ const n = D, s = T, { t: $ } = X(), {
20
+ selectionOptions: w,
21
+ tableAttribute: I,
22
+ pagination: l,
23
+ hasPagination: L,
24
+ columnConfig: _,
25
+ colSettingList: P
26
+ } = Y($);
27
+ O("table-extend", {
28
+ tableProps: n,
29
+ tableColums: q(n, "tableColums"),
30
+ columnConfig: _
31
+ });
32
+ const c = y(null), S = y(!1);
33
+ k(
34
+ () => n.tableColums,
35
+ () => {
36
+ _.showColumn = n.tableColums;
37
+ }
38
+ ), k(
39
+ () => l.pageIndex,
40
+ (e) => {
41
+ if (e && e > 0) {
42
+ if (S.value) {
43
+ S.value = !1;
44
+ return;
45
+ }
46
+ s("currentChange", e), c.value.setScrollTop(0);
47
+ }
48
+ }
49
+ ), k(
50
+ () => l.pageSize,
51
+ (e) => {
52
+ e && e > 0 && (S.value = !0, l.pageIndex = 1, s("pageSizeChange", e), c.value.setScrollTop(0));
53
+ }
54
+ ), G(() => {
55
+ J(() => {
56
+ n.tableColums && n.tableColums.length > 0 && (_.showColumn = n.tableColums);
57
+ });
58
+ }), R({
59
+ instance: c,
60
+ clearSelection: M,
61
+ toggleRowSelection: V
62
+ });
63
+ function x(e) {
64
+ s("tableSort", {
65
+ sortName: e.prop,
66
+ sortType: e.order === "descending" ? "desc" : e.order === "ascending" ? "asc" : ""
67
+ });
68
+ }
69
+ function N(e) {
70
+ w.rows = e, w.count = e && e.length, s("handleSelectionChange", e);
71
+ }
72
+ function B(e) {
73
+ s("rowClick", e);
74
+ }
75
+ function H(e) {
76
+ s("rowDblClick", e);
77
+ }
78
+ function M() {
79
+ var e;
80
+ (e = c.value) == null || e.clearSelection();
81
+ }
82
+ function V(e) {
83
+ var a;
84
+ (a = c.value) == null || a.toggleRowSelection(e);
85
+ }
86
+ return (e, a) => {
87
+ const d = f("el-table-column"), E = f("el-empty"), U = f("el-table"), j = f("el-pagination"), A = K("loading");
88
+ return o(), m("div", oe, [
89
+ p("div", ne, [
90
+ p("div", le, [
91
+ C(e.$slots, "tool-left")
92
+ ]),
93
+ p("div", ae, [
94
+ C(e.$slots, "tool-right"),
95
+ p("div", re, [
96
+ e.isSetColumn ? (o(), r(te, { key: 0 })) : u("", !0)
97
+ ])
98
+ ])
99
+ ]),
100
+ Q((o(), r(U, b({
101
+ ref_key: "tableRef",
102
+ ref: c
103
+ }, i(I), {
104
+ data: e.tableData,
105
+ onSortChange: x,
106
+ onSelectionChange: N,
107
+ onRowClick: B,
108
+ onRowDblclick: H
109
+ }), {
110
+ empty: h(() => [
111
+ z(E, { "image-size": 60 })
112
+ ]),
113
+ default: h(() => [
114
+ e.selectionCol ? (o(), r(d, {
115
+ key: 0,
116
+ type: "selection",
117
+ width: "48",
118
+ fixed: "left"
119
+ })) : u("", !0),
120
+ e.indexCol ? (o(), r(d, {
121
+ key: 1,
122
+ type: "index",
123
+ width: "58",
124
+ fixed: "left"
125
+ })) : u("", !0),
126
+ (o(!0), m(v, null, W(i(P), (t) => (o(), m(v, {
127
+ key: t.prop
128
+ }, [
129
+ t.isHtml ? (o(), r(d, b({
130
+ key: 0,
131
+ ref_for: !0
132
+ }, t), {
133
+ default: h((g) => [
134
+ p("div", {
135
+ innerHTML: t.prop && g.row[t.prop]
136
+ }, null, 8, ie)
137
+ ]),
138
+ _: 2
139
+ }, 1040)) : (o(), m(v, { key: 1 }, [
140
+ t.init ? (o(), r(d, b({
141
+ key: 0,
142
+ ref_for: !0
143
+ }, t), {
144
+ default: h((g) => [
145
+ C(e.$slots, `col_${t.prop}`, {
146
+ data: g.row
147
+ }, () => [
148
+ z(ee, b({ ref_for: !0 }, { row: g.row, colCfg: t }), null, 16)
149
+ ])
150
+ ]),
151
+ _: 2
152
+ }, 1040)) : u("", !0)
153
+ ], 64))
154
+ ], 64))), 128)),
155
+ C(e.$slots, "operatColumn")
156
+ ]),
157
+ _: 3
158
+ }, 16, ["data"])), [
159
+ [A, e.tableLoading]
160
+ ]),
161
+ i(L) ? (o(), r(j, {
162
+ key: 0,
163
+ background: "",
164
+ "current-page": i(l).pageIndex,
165
+ "onUpdate:currentPage": a[0] || (a[0] = (t) => i(l).pageIndex = t),
166
+ "page-size": i(l).pageSize,
167
+ "onUpdate:pageSize": a[1] || (a[1] = (t) => i(l).pageSize = t),
168
+ "page-sizes": e.sizeList,
169
+ layout: "total, sizes, prev, pager, next, jumper",
170
+ total: e.total
171
+ }, null, 8, ["current-page", "page-size", "page-sizes", "total"])) : u("", !0)
172
+ ]);
173
+ };
174
+ }
175
+ });
176
+ export {
177
+ fe as default
178
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./index.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,24 @@
1
+ import { DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
2
+ declare const _default: DefineComponent<ExtractPropTypes<{
3
+ row: {
4
+ type: ObjectConstructor;
5
+ default: () => void;
6
+ };
7
+ colCfg: {
8
+ type: ObjectConstructor;
9
+ default: () => void;
10
+ };
11
+ }>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<{
12
+ row: {
13
+ type: ObjectConstructor;
14
+ default: () => void;
15
+ };
16
+ colCfg: {
17
+ type: ObjectConstructor;
18
+ default: () => void;
19
+ };
20
+ }>> & Readonly<{}>, {
21
+ row: Record<string, any>;
22
+ colCfg: Record<string, any>;
23
+ }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
24
+ export default _default;
@@ -0,0 +1,26 @@
1
+ import { defineComponent as l, computed as p, openBlock as r, createElementBlock as u, toDisplayString as a } from "vue";
2
+ const f = /* @__PURE__ */ l({
3
+ __name: "valueCol",
4
+ props: {
5
+ row: {
6
+ type: Object,
7
+ default: () => {
8
+ }
9
+ },
10
+ colCfg: {
11
+ type: Object,
12
+ default: () => {
13
+ }
14
+ }
15
+ },
16
+ setup(n) {
17
+ const c = n, e = p(() => {
18
+ const { row: t, colCfg: o } = c;
19
+ return t[o.prop];
20
+ });
21
+ return (t, o) => (r(), u("span", null, a(e.value != null ? e.value : "--"), 1));
22
+ }
23
+ });
24
+ export {
25
+ f as default
26
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./valueCol.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,31 @@
1
+ import { DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
2
+ declare const _default: __VLS_WithTemplateSlots< DefineComponent<ExtractPropTypes<{
3
+ type: {
4
+ type: StringConstructor;
5
+ default: string;
6
+ validator: (val: string) => boolean;
7
+ };
8
+ disabled: BooleanConstructor;
9
+ }>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
10
+ click: (...args: any[]) => void;
11
+ }, string, PublicProps, Readonly< ExtractPropTypes<{
12
+ type: {
13
+ type: StringConstructor;
14
+ default: string;
15
+ validator: (val: string) => boolean;
16
+ };
17
+ disabled: BooleanConstructor;
18
+ }>> & Readonly<{
19
+ onClick?: ((...args: any[]) => any) | undefined;
20
+ }>, {
21
+ type: string;
22
+ disabled: boolean;
23
+ }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>, {
24
+ default?(_: {}): any;
25
+ }>;
26
+ export default _default;
27
+ type __VLS_WithTemplateSlots<T, S> = T & {
28
+ new (): {
29
+ $slots: S;
30
+ };
31
+ };
@@ -0,0 +1,39 @@
1
+ import { defineComponent as a, openBlock as s, createElementBlock as l, normalizeClass as c, withModifiers as d, renderSlot as u } from "vue";
2
+ const f = /* @__PURE__ */ a({
3
+ name: "TextButton",
4
+ __name: "index",
5
+ props: {
6
+ type: {
7
+ type: String,
8
+ default: "primary",
9
+ validator: (e) => [
10
+ "default",
11
+ "primary",
12
+ "success",
13
+ "warning",
14
+ "info",
15
+ "danger"
16
+ ].includes(e)
17
+ },
18
+ disabled: Boolean
19
+ },
20
+ emits: ["click"],
21
+ setup(e, { emit: n }) {
22
+ const i = e, o = n;
23
+ function r(t) {
24
+ i.disabled || o("click", t);
25
+ }
26
+ return (t, m) => (s(), l("div", {
27
+ class: c(["text-button", [
28
+ `text-button-${e.type}`,
29
+ e.disabled && "is-disabled"
30
+ ]]),
31
+ onClick: d(r, ["prevent", "stop"])
32
+ }, [
33
+ u(t.$slots, "default")
34
+ ], 2));
35
+ }
36
+ });
37
+ export {
38
+ f as default
39
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./index.vue.js";
2
+ export {
3
+ f as default
4
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qy_better_lib/pc",
3
3
  "private": false,
4
- "version": "0.1.3",
4
+ "version": "0.1.5",
5
5
  "description": "qy better lib pc compontens",
6
6
  "author": "luhuiming",
7
7
  "license": "ISC",
@@ -42,9 +42,9 @@
42
42
  },
43
43
  "devDependencies": {
44
44
  "@qy_better_lib/core": "^0.0.3",
45
- "@types/node": "^20.14.9",
45
+ "@types/node": "^22.10.6",
46
46
  "@vitejs/plugin-vue": "^5.0.5",
47
- "element-plus": "^2.7.6",
47
+ "element-plus": "^2.9.3",
48
48
  "magic-string": "^0.30.10",
49
49
  "mkdirp": "^1.0.4",
50
50
  "vite": "^5.3.2",