@qy_better_lib/pc 0.0.5 → 0.0.8

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}),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(s=>(t&&s.langue&&(s.label=t(s.langue)),{...c,...s}))),u=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:h,columnConfig:r,colSettingList:w,showToolPanel:u,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(h=>h.prop)||[]),p=e.computed(()=>(o==null?void 0:o.tableColums.value)||[]);function C(h){h?o&&(o.columnConfig.showColumn=p.value):o&&(o.columnConfig.showColumn=[])}function _(h){if(o){o.columnConfig.showColumn=p.value.filter(w=>h.includes(w.prop));const r=h.length;n.value=r===p.value.length,i.value=r>0&&r<p.value.length}}function g(h,r){r.fixed===h?r.fixed=void 0:r.fixed=h}return(h,r)=>{const w=e.resolveComponent("Setting"),u=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(u,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(()=>[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(u,{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(u,{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:h,columnConfig:r,colSettingList:w}=A(p);e.provide("table-extend",{tableProps:i,tableColums:e.toRef(i,"tableColums"),columnConfig:r});const u=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),u.value.setScrollTop(0)}}),e.watch(()=>g.pageSize,l=>{l&&l>0&&(x.value=!0,g.pageIndex=1,c("pageSizeChange",l),u.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=u.value)==null||l.clearSelection()}function y(l){var B;(B=u.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:u},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(h)?(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:u,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 h(a){c("menuClick",a),u()}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 u(){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=>h(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),u]]):e.createCommentVNode("",!0)])}}});N.install=t=>{t.component("ContextMenu",N)};function Z(t,o,n){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}),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(s=>(t&&s.langue&&(s.label=t(s.langue)),{...c,...s}))),u=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:h,columnConfig:r,colSettingList:w,showToolPanel:u,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(h=>h.prop)||[]),p=e.computed(()=>(o==null?void 0:o.tableColums.value)||[]);function C(h){h?o&&(o.columnConfig.showColumn=p.value):o&&(o.columnConfig.showColumn=[])}function _(h){if(o){o.columnConfig.showColumn=p.value.filter(w=>h.includes(w.prop));const r=h.length;n.value=r===p.value.length,i.value=r>0&&r<p.value.length}}function g(h,r){r.fixed===h?r.fixed=void 0:r.fixed=h}return(h,r)=>{const w=e.resolveComponent("Setting"),u=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(u,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(u,{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(u,{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:h,columnConfig:r,colSettingList:w}=A(p);e.provide("table-extend",{tableProps:i,tableColums:e.toRef(i,"tableColums"),columnConfig:r});const u=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),u.value.setScrollTop(0)}}),e.watch(()=>g.pageSize,l=>{l&&l>0&&(x.value=!0,g.pageIndex=1,c("pageSizeChange",l),u.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=u.value)==null||l.clearSelection()}function y(l){var B;(B=u.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:u},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(h)?(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:u,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 h(a){c("menuClick",a),u()}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 u(){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=>h(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),u]]):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,3 +1,2 @@
1
1
  import { default as contextMenu } from './src/index.vue';
2
-
3
2
  export default contextMenu;
package/lib/index.d.ts CHANGED
@@ -3,7 +3,6 @@ import { default as tableExtend } from './tableExtend';
3
3
  import { default as contextMenu } from './contextMenu';
4
4
  import { App } from 'vue';
5
5
  import { messageAlert, messageBox, confirmBox, confirmBoxAsync, notification } from './utils';
6
-
7
6
  declare function install(app: App): void;
8
7
  export type { TableProp, TableColumn } from './tableExtend';
9
8
  export { install, textButton, tableExtend, contextMenu, messageAlert, messageBox, confirmBox, confirmBoxAsync, notification, };
@@ -1,3 +1,3 @@
1
- @import './textButton.scss';
2
- @import './tableExtend.scss';
3
- @import './contextMenu.scss';
1
+ @use "./textButton.scss" as *;
2
+ @use "./tableExtend.scss" as *;
3
+ @use "./contextMenu.scss" as *;
@@ -1,4 +1,3 @@
1
1
  import { default as tableExtend } from './src/index.vue';
2
-
3
2
  export type { TableProp, TableColumn } from './type';
4
3
  export default tableExtend;
@@ -1,6 +1,5 @@
1
1
  import { PropType } from 'vue';
2
2
  import { TableAttr, TableColumn } from './type';
3
-
4
3
  /**表单组件属性 */
5
4
  export default function props(): {
6
5
  /**UI选项配置 */
@@ -1,5 +1,4 @@
1
1
  import { Ref } from 'vue';
2
-
3
2
  export type TableAttr = {
4
3
  /**rowKey */
5
4
  rowKey?: string;
@@ -1,6 +1,5 @@
1
1
  import { TableColumn, FileType } from './type';
2
2
  import { ComputedRef } from 'vue';
3
-
4
3
  /**
5
4
  * useTable
6
5
  */
@@ -1,3 +1,2 @@
1
1
  import { default as textButton } from './src/index.vue';
2
-
3
2
  export default textButton;
@@ -1,4 +1,5 @@
1
- export declare function messageBox(message: string, type: string, status: boolean): void;
1
+ type MessageBoxType = "toast" | "dialog" | "notif";
2
+ export declare function messageBox(message: string, type: MessageBoxType, status?: boolean): void;
2
3
  /**
3
4
  * 确认提示框
4
5
  * @param str 提示信息
@@ -31,3 +32,4 @@ export declare function messageAlert(type: "success" | "warning" | "error", mess
31
32
  * @param duration
32
33
  */
33
34
  export declare function notification(type: "success" | "warning" | "error" | "info", message?: string, html?: boolean, position?: "top-right" | "top-left" | "bottom-right" | "bottom-left", duration?: number): void;
35
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { ElMessageBox as f, ElMessage as a, ElNotification as l } from "element-plus";
2
- function p(t, e, o) {
2
+ function p(t, e, o = !0) {
3
3
  switch (e) {
4
4
  case "toast":
5
5
  m(
package/package.json CHANGED
@@ -1,59 +1,55 @@
1
- {
2
- "name": "@qy_better_lib/pc",
3
- "private": false,
4
- "version": "0.0.5",
5
- "description": "qy better lib pc compontens",
6
- "author": "luhuiming",
7
- "license": "ISC",
8
- "scripts": {
9
- "build:lib": "vite build --config vite.lib.config.ts",
10
- "build:dist-min": "vite build --config vite.dist.min.config.ts",
11
- "build": "yarn build:lib && yarn build:dist-min"
12
- },
13
- "main": "lib/index.js",
14
- "module": "lib/index.js",
15
- "types": "lib/index.d.ts",
16
- "typesVersions": {
17
- "*": {
18
- "lib/index.js": [
19
- "lib/index.d.ts"
20
- ],
21
- "@qy-better-lib/core": [
22
- "lib/index.d.ts"
23
- ],
24
- "*": [
25
- "*",
26
- "dist/*",
27
- "lib/*",
28
- "lib/*.scss",
29
- "lib/*.d.ts",
30
- "lib/*/index.d.ts"
31
- ]
32
- }
33
- },
34
- "exports": {
35
- ".": {
36
- "import": "./lib/index.js"
37
- },
38
- "./utils": "./lib/utils/index.js",
39
- "./utils/*": "./lib/utils/*.js",
40
- "./styles": "./lib/styles/index.scss",
41
- "./styles/*": "./lib/styles/*"
42
- },
43
- "publishConfig": {
44
- "access": "public",
45
- "registry": "https://registry.npmjs.org/"
46
- },
47
- "devDependencies": {
48
- "@qy_better_lib/core": "^0.0.2",
49
- "@types/node": "^20.14.9",
50
- "@vitejs/plugin-vue": "^5.0.5",
51
- "element-plus": "^2.7.6",
52
- "magic-string": "^0.30.10",
53
- "mkdirp": "^1.0.4",
54
- "vite": "^5.3.2",
55
- "vite-plugin-dts": "^3.9.1",
56
- "vue": "^3.4.31",
57
- "vue-i18n": "^9.13.1"
58
- }
59
- }
1
+ {
2
+ "name": "@qy_better_lib/pc",
3
+ "private": false,
4
+ "version": "0.0.8",
5
+ "description": "qy better lib pc compontens",
6
+ "author": "luhuiming",
7
+ "license": "ISC",
8
+ "scripts": {
9
+ "build:lib": "vite build --config vite.lib.config.ts",
10
+ "build:dist-min": "vite build --config vite.dist.min.config.ts",
11
+ "build": "yarn build:lib && yarn build:dist-min"
12
+ },
13
+ "main": "lib/index.js",
14
+ "module": "lib/index.js",
15
+ "types": "lib/index.d.ts",
16
+ "typesVersions": {
17
+ "*": {
18
+ "lib/index.js": [
19
+ "lib/index.d.ts"
20
+ ],
21
+ "@qy-better-lib/core": [
22
+ "lib/index.d.ts"
23
+ ],
24
+ "*": [
25
+ "*",
26
+ "dist/*",
27
+ "lib/*",
28
+ "lib/*.scss",
29
+ "lib/*.d.ts",
30
+ "lib/*/index.d.ts"
31
+ ]
32
+ }
33
+ },
34
+ "exports": {
35
+ ".": {
36
+ "import": "./lib/index.js"
37
+ },
38
+ "./utils": "./lib/utils/index.js",
39
+ "./utils/*": "./lib/utils/*.js",
40
+ "./styles": "./lib/styles/index.scss",
41
+ "./styles/*": "./lib/styles/*"
42
+ },
43
+ "devDependencies": {
44
+ "@qy_better_lib/core": "^0.0.3",
45
+ "@types/node": "^20.14.9",
46
+ "@vitejs/plugin-vue": "^5.0.5",
47
+ "element-plus": "^2.9.2",
48
+ "magic-string": "^0.30.10",
49
+ "mkdirp": "^1.0.4",
50
+ "vite": "^5.3.2",
51
+ "vite-plugin-dts": "^4.4.0",
52
+ "vue": "^3.5.13",
53
+ "vue-i18n": "^9.13.1"
54
+ }
55
+ }
@@ -1,71 +0,0 @@
1
- import { PropType, DefineComponent, ComponentOptionsMixin, PublicProps, ExtractPropTypes } 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<{
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
- }, unknown, {}, {}, 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
- }>> & {
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
- }, {}>, {
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
- };
@@ -1,108 +0,0 @@
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
- };
@@ -1,4 +0,0 @@
1
- import f from "./index.vue.js";
2
- export {
3
- f as default
4
- };
File without changes
@@ -1,3 +0,0 @@
1
- import { DefineComponent, ComponentOptionsMixin, PublicProps, ExtractPropTypes } from 'vue';
2
- declare const _default: DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<{}>>, {}, {}>;
3
- export default _default;
@@ -1,103 +0,0 @@
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(() => [
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
- };
@@ -1,4 +0,0 @@
1
- import f from "./colVisible.vue.js";
2
- export {
3
- f as default
4
- };
@@ -1,117 +0,0 @@
1
- import { DefineComponent, PropType, ComponentOptionsMixin, PublicProps, ExtractPropTypes } 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<{
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
- clearSelection: typeof clearSelection;
44
- toggleRowSelection: typeof toggleRowSelection;
45
- }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
46
- tableSort: (...args: any[]) => void;
47
- handleSelectionChange: (...args: any[]) => void;
48
- currentChange: (...args: any[]) => void;
49
- pageSizeChange: (...args: any[]) => void;
50
- rowClick: (...args: any[]) => void;
51
- rowDblClick: (...args: any[]) => void;
52
- }, string, PublicProps, Readonly< ExtractPropTypes<{
53
- options: {
54
- type: PropType<TableAttr>;
55
- default: () => {};
56
- };
57
- tableData: {
58
- type: ArrayConstructor;
59
- default: never[];
60
- };
61
- tableColums: {
62
- type: PropType< TableColumn[]>;
63
- default: () => never[];
64
- };
65
- tableLoading: BooleanConstructor;
66
- selectionCol: {
67
- type: BooleanConstructor;
68
- default: () => boolean;
69
- };
70
- indexCol: {
71
- type: BooleanConstructor;
72
- default: () => boolean;
73
- };
74
- isSetColumn: {
75
- type: BooleanConstructor;
76
- default: () => boolean;
77
- };
78
- paging: {
79
- type: PropType<{
80
- pageIndex: number;
81
- pageSize: number;
82
- }>;
83
- };
84
- total: NumberConstructor;
85
- sizeList: {
86
- type: PropType<number[]>;
87
- default: () => number[];
88
- };
89
- }>> & {
90
- onTableSort?: ((...args: any[]) => any) | undefined;
91
- onHandleSelectionChange?: ((...args: any[]) => any) | undefined;
92
- onCurrentChange?: ((...args: any[]) => any) | undefined;
93
- onPageSizeChange?: ((...args: any[]) => any) | undefined;
94
- onRowClick?: ((...args: any[]) => any) | undefined;
95
- onRowDblClick?: ((...args: any[]) => any) | undefined;
96
- }, {
97
- tableColums: TableColumn[];
98
- options: TableAttr;
99
- tableData: unknown[];
100
- tableLoading: boolean;
101
- selectionCol: boolean;
102
- indexCol: boolean;
103
- isSetColumn: boolean;
104
- sizeList: number[];
105
- }, {}>, Partial<Record<`col_${string}`, (_: {
106
- data: any;
107
- }) => any>> & {
108
- "tool-left"?(_: {}): any;
109
- "tool-right"?(_: {}): any;
110
- operatColumn?(_: {}): any;
111
- }>;
112
- export default _default;
113
- type __VLS_WithTemplateSlots<T, S> = T & {
114
- new (): {
115
- $slots: S;
116
- };
117
- };
@@ -1,177 +0,0 @@
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
- clearSelection: M,
60
- toggleRowSelection: V
61
- });
62
- function x(e) {
63
- s("tableSort", {
64
- sortName: e.prop,
65
- sortType: e.order === "descending" ? "desc" : e.order === "ascending" ? "asc" : ""
66
- });
67
- }
68
- function N(e) {
69
- w.rows = e, w.count = e && e.length, s("handleSelectionChange", e);
70
- }
71
- function B(e) {
72
- s("rowClick", e);
73
- }
74
- function H(e) {
75
- s("rowDblClick", e);
76
- }
77
- function M() {
78
- var e;
79
- (e = c.value) == null || e.clearSelection();
80
- }
81
- function V(e) {
82
- var a;
83
- (a = c.value) == null || a.toggleRowSelection(e);
84
- }
85
- return (e, a) => {
86
- const d = f("el-table-column"), E = f("el-empty"), U = f("el-table"), j = f("el-pagination"), A = K("loading");
87
- return o(), m("div", oe, [
88
- p("div", ne, [
89
- p("div", le, [
90
- C(e.$slots, "tool-left")
91
- ]),
92
- p("div", ae, [
93
- C(e.$slots, "tool-right"),
94
- p("div", re, [
95
- e.isSetColumn ? (o(), r(te, { key: 0 })) : u("", !0)
96
- ])
97
- ])
98
- ]),
99
- Q((o(), r(U, b({
100
- ref_key: "tableRef",
101
- ref: c
102
- }, i(I), {
103
- data: e.tableData,
104
- onSortChange: x,
105
- onSelectionChange: N,
106
- onRowClick: B,
107
- onRowDblclick: H
108
- }), {
109
- empty: h(() => [
110
- z(E, { "image-size": 60 })
111
- ]),
112
- default: h(() => [
113
- e.selectionCol ? (o(), r(d, {
114
- key: 0,
115
- type: "selection",
116
- width: "48",
117
- fixed: "left"
118
- })) : u("", !0),
119
- e.indexCol ? (o(), r(d, {
120
- key: 1,
121
- type: "index",
122
- width: "58",
123
- fixed: "left"
124
- })) : u("", !0),
125
- (o(!0), m(v, null, W(i(P), (t) => (o(), m(v, {
126
- key: t.prop
127
- }, [
128
- t.isHtml ? (o(), r(d, b({
129
- key: 0,
130
- ref_for: !0
131
- }, t), {
132
- default: h((g) => [
133
- p("div", {
134
- innerHTML: t.prop && g.row[t.prop]
135
- }, null, 8, ie)
136
- ]),
137
- _: 2
138
- }, 1040)) : (o(), m(v, { key: 1 }, [
139
- t.init ? (o(), r(d, b({
140
- key: 0,
141
- ref_for: !0
142
- }, t), {
143
- default: h((g) => [
144
- C(e.$slots, `col_${t.prop}`, {
145
- data: g.row
146
- }, () => [
147
- z(ee, b({ ref_for: !0 }, { row: g.row, colCfg: t }), null, 16)
148
- ])
149
- ]),
150
- _: 2
151
- }, 1040)) : u("", !0)
152
- ], 64))
153
- ], 64))), 128)),
154
- C(e.$slots, "operatColumn")
155
- ]),
156
- _: 3
157
- }, 16, ["data"])), [
158
- [A, e.tableLoading]
159
- ]),
160
- i(L) ? (o(), r(j, {
161
- key: 0,
162
- background: "",
163
- "current-page": i(l).pageIndex,
164
- "onUpdate:currentPage": a[0] || (a[0] = (t) => i(l).pageIndex = t),
165
- "page-size": i(l).pageSize,
166
- "onUpdate:pageSize": a[1] || (a[1] = (t) => i(l).pageSize = t),
167
- "page-sizes": e.sizeList,
168
- layout: "total, sizes, prev, pager, next, jumper",
169
- total: e.total
170
- }, null, 8, ["current-page", "page-size", "page-sizes", "total"])) : u("", !0)
171
- ]);
172
- };
173
- }
174
- });
175
- export {
176
- fe as default
177
- };
@@ -1,4 +0,0 @@
1
- import f from "./index.vue.js";
2
- export {
3
- f as default
4
- };
@@ -1,24 +0,0 @@
1
- import { DefineComponent, ComponentOptionsMixin, PublicProps, ExtractPropTypes } from 'vue';
2
- declare const _default: DefineComponent<{
3
- row: {
4
- type: ObjectConstructor;
5
- default: () => void;
6
- };
7
- colCfg: {
8
- type: ObjectConstructor;
9
- default: () => void;
10
- };
11
- }, {}, unknown, {}, {}, 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
- }>>, {
21
- row: Record<string, any>;
22
- colCfg: Record<string, any>;
23
- }, {}>;
24
- export default _default;
@@ -1,26 +0,0 @@
1
- import { defineComponent as l, computed as p, openBlock as r, createElementBlock as a, toDisplayString as u } 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: o, colCfg: t } = c;
19
- return o[t.prop];
20
- });
21
- return (o, t) => (r(), a("span", null, u(e.value != null ? e.value : "--"), 1));
22
- }
23
- });
24
- export {
25
- f as default
26
- };
@@ -1,4 +0,0 @@
1
- import f from "./valueCol.vue.js";
2
- export {
3
- f as default
4
- };
@@ -1,31 +0,0 @@
1
- import { DefineComponent, ComponentOptionsMixin, PublicProps, ExtractPropTypes } from 'vue';
2
- declare const _default: __VLS_WithTemplateSlots< DefineComponent<{
3
- type: {
4
- type: StringConstructor;
5
- default: string;
6
- validator: (val: string) => boolean;
7
- };
8
- disabled: BooleanConstructor;
9
- }, {}, unknown, {}, {}, 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
- }>> & {
19
- onClick?: ((...args: any[]) => any) | undefined;
20
- }, {
21
- type: string;
22
- disabled: boolean;
23
- }, {}>, {
24
- default?(_: {}): any;
25
- }>;
26
- export default _default;
27
- type __VLS_WithTemplateSlots<T, S> = T & {
28
- new (): {
29
- $slots: S;
30
- };
31
- };
@@ -1,39 +0,0 @@
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
- };
@@ -1,4 +0,0 @@
1
- import f from "./index.vue.js";
2
- export {
3
- f as default
4
- };