@qy_better_lib/pc 0.1.15 → 0.1.16
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(g,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("vue-i18n"),require("@qy_better_lib/core"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","vue-i18n","@qy_better_lib/core","element-plus"],e):(g=typeof globalThis<"u"?globalThis:g||self,e(g["@qy_better_lib/pc"]={},g.Vue,g.vueI18n,g.core,g.elementPlus))})(this,function(g,e,A,O,S){"use strict";const V=e.defineComponent({name:"TextButton",__name:"index",props:{type:{type:String,default:"primary",validator:t=>["default","primary","success","warning","info","danger"].includes(t)},icon:String,disabled:Boolean},emits:["click"],setup(t,{emit:n}){const o=t,a=n;function c(p){o.disabled||a("click",p)}return(p,h)=>{const b=e.resolveComponent("el-icon");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["text-button",[`text-button-${t.type}`,t.disabled&&"is-disabled"]])},[o.icon?(e.openBlock(),e.createBlock(b,{key:0,class:"text-button-icon"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.icon)))]),_:1})):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"text-button-inner",onClick:e.withModifiers(c,["prevent","stop"])},[e.renderSlot(p.$slots,"default")])],2)}}});V.install=t=>{t.component("TextButton",V)};var P=(t=>(t[t.PICTURE=1]="PICTURE",t[t.PDF=2]="PDF",t[t.OTHER=3]="OTHER",t))(P||{});function I(t){var i,k;const n=e.getCurrentInstance(),o=n==null?void 0:n.props,a={rowKey:"Id","element-loading-text":"加载中…","element-loading-background":"rgba(0, 0, 0, 0.2)",highlightCurrentRow:!0,stripe:!0,border:!1,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(()=>({...a,...Object.keys(o.options).length>0?o.options:{}})),h=e.reactive({count:0,rows:[]}),b=e.reactive({pageIndex:(i=o==null?void 0:o.paging)!=null&&i.pageIndex?e.toRef(o.paging,"pageIndex"):1,pageSize:(k=o==null?void 0:o.paging)!=null&&k.pageSize?e.toRef(o.paging,"pageSize"):10}),m=e.computed(()=>{var s,d;return((s=o==null?void 0:o.paging)==null?void 0:s.pageIndex)>0&&((d=o==null?void 0:o.paging)==null?void 0:d.pageSize)>0}),C=e.reactive({show:!1,filePathList:[],index:0}),r=e.reactive({showColumn:[],hiddenColumn:[]}),_=e.computed(()=>!r.showColumn||r.showColumn.length===0?[{prop:"default-prop",init:!0,label:""}]:r.showColumn.map(d=>(t&&d.langue&&(d.label=t(d.langue)),{...c,...d}))),w=e.computed(()=>{var s,d,f,x,T,$;return(((f=(d=n==null?void 0:(s=n.slots)["tool-left"])==null?void 0:d.call(s))==null?void 0:f.length)||0)>0||((($=(T=n==null?void 0:(x=n.slots)["tool-right"])==null?void 0:T.call(x))==null?void 0:$.length)||0)>0}),y=e.computed(()=>_.value.some(s=>s.fileType&&s.fileType==P.PICTURE));return{defColSetting:c,selectionOptions:h,tableAttribute:p,pagination:b,hasPagination:m,imageViewer:C,columnConfig:r,colSettingList:_,showToolPanel:w,hasImageViewer:y}}function U(){return{options:{type:Object,default:()=>({})},tableData:{type:Array,default:[]},tableColums:{type:Array,default:()=>[]},tableLoading:Boolean,selectionCol:{type:Boolean,default:()=>!0},indexCol:{type:Boolean,default:()=>!0},isSetColumn:{type:Boolean,default:()=>!1},paging:{type:Object},total:Number,sizeList:{type:Array,default:()=>[15,20,30,50,100]}}}const j=e.defineComponent({__name:"valueCol",props:{row:{type:Object,default:()=>{}},colCfg:{type:Object,default:()=>{}}},setup(t){const n=t,o=e.computed(()=>{const{row:a,colCfg:c}=n;return a[c.prop]});return(a,c)=>(e.openBlock(),e.createElementBlock("span",null,e.toDisplayString(o.value!=null?o.value:"--"),1))}}),H={class:"set-column-list-wrap"},q={class:"fixed-wrap"},X=e.defineComponent({__name:"colVisible",setup(t){const n=e.inject("table-extend"),o=e.ref(!0),a=e.ref(!1),c=e.computed(()=>n&&n.columnConfig.showColumn.map(C=>C.prop)||[]),p=e.computed(()=>(n==null?void 0:n.tableColums.value)||[]);function h(C){C?n&&(n.columnConfig.showColumn=p.value):n&&(n.columnConfig.showColumn=[])}function b(C){if(n){n.columnConfig.showColumn=p.value.filter(_=>C.includes(_.prop));const r=C.length;o.value=r===p.value.length,a.value=r>0&&r<p.value.length}}function m(C,r){r.fixed===C?r.fixed=void 0:r.fixed=C}return(C,r)=>{const _=e.resolveComponent("Setting"),w=e.resolveComponent("el-icon"),y=e.resolveComponent("el-checkbox"),i=e.resolveComponent("Upload"),k=e.resolveComponent("el-divider"),s=e.resolveComponent("el-checkbox-group"),d=e.resolveComponent("el-popover");return e.openBlock(),e.createBlock(d,{placement:"bottom",title:"列显示设置",width:220},{reference:e.withCtx(()=>[e.createVNode(w,null,{default:e.withCtx(()=>[e.createVNode(_)]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",H,[e.createVNode(y,{indeterminate:a.value,modelValue:o.value,"onUpdate:modelValue":r[0]||(r[0]=f=>o.value=f),onChange:h},{default:e.withCtx(()=>[e.createTextVNode("全选 ")]),_:1},8,["indeterminate","modelValue"]),e.createVNode(s,{class:"set-column-check-group",modelValue:c.value,"onUpdate:modelValue":r[1]||(r[1]=f=>c.value=f),onChange:b},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,f=>(e.openBlock(),e.createElementBlock("div",{class:"group-item",key:f.prop},[e.createVNode(y,{class:"set-column-check",label:f.prop},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.label),1)]),_:2},1032,["label"]),e.createElementVNode("div",q,[e.createVNode(w,{class:e.normalizeClass(["fixed-icon",f.fixed==="left"&&"active"]),title:"固定到左边",onClick:x=>m("left",f)},{default:e.withCtx(()=>[e.createVNode(i)]),_:2},1032,["class","onClick"]),e.createVNode(k,{direction:"vertical"}),e.createVNode(w,{class:e.normalizeClass(["fixed-icon",f.fixed==="right"&&"active"]),title:"固定到右边",onClick:x=>m("right",f)},{default:e.withCtx(()=>[e.createVNode(i)]),_:2},1032,["class","onClick"])])]))),128))]),_:1},8,["modelValue"])])]),_:1})}}}),F={key:0,class:"tool-panel"},Y={class:"left-panel"},W={class:"right-panel"},K={class:"default-tool"},G=["innerHTML"],E=e.defineComponent({__name:"index",props:{...U()},emits:["tableSort","handleSelectionChange","currentChange","pageSizeChange","rowClick","rowDblClick"],setup(t,{expose:n,emit:o}){const a=t,c=o,{t:p}=A.useI18n(),{selectionOptions:h,tableAttribute:b,pagination:m,hasPagination:C,columnConfig:r,colSettingList:_,showToolPanel:w}=I(p);e.provide("table-extend",{tableProps:a,tableColums:e.toRef(a,"tableColums"),columnConfig:r});const y=e.ref(),i=e.ref(null),k=e.ref(!1),s=e.ref(),d=e.computed(()=>{const l=a.tableData.length>(a.total||0)?a.tableData.length:a.total||0;return C.value&&l>m.pageSize});e.watch(()=>a.tableColums,()=>{r.showColumn=a.tableColums}),e.watch(()=>m.pageIndex,l=>{if(l&&l>0){if(k.value){k.value=!1;return}c("currentChange",l),i.value.setScrollTop(0)}}),e.watch(()=>m.pageSize,l=>{l&&l>0&&(k.value=!0,m.pageIndex=1,c("pageSizeChange",l),i.value.setScrollTop(0))}),e.onMounted(()=>{e.nextTick(()=>{var B;const l=((B=y.value)==null?void 0:B.offsetHeight)||0;console.log("wrap_offset_height",l),s.value=l,a.tableColums&&a.tableColums.length>0&&(r.showColumn=a.tableColums)})}),n({clearSelection:ne,toggleRowSelection:le,table:i});function f(l){c("tableSort",{sortName:l.prop,sortType:l.order==="descending"?"desc":l.order==="ascending"?"asc":""})}function x(l){h.rows=l,h.count=l&&l.length,c("handleSelectionChange",l)}function T(l){c("rowClick",l)}function $(l){c("rowDblClick",l)}function ne(){var l;(l=i.value)==null||l.clearSelection()}function le(l){var B;(B=i.value)==null||B.toggleRowSelection(l)}return(l,B)=>{const z=e.resolveComponent("el-table-column"),ae=e.resolveComponent("el-empty"),ie=e.resolveComponent("el-table"),ce=e.resolveComponent("el-pagination"),re=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",{class:"table-extend",ref_key:"tableExtendRef",ref:y},[e.unref(w)?(e.openBlock(),e.createElementBlock("div",F,[e.createElementVNode("div",Y,[e.renderSlot(l.$slots,"tool-left")]),e.createElementVNode("div",W,[e.renderSlot(l.$slots,"tool-right"),e.createElementVNode("div",K,[l.isSetColumn?(e.openBlock(),e.createBlock(X,{key:0})):e.createCommentVNode("",!0)])])])):e.createCommentVNode("",!0),e.withDirectives((e.openBlock(),e.createBlock(ie,e.mergeProps({ref_key:"tableRef",ref:i},e.unref(b),{data:l.tableData,"max-height":s.value,onSortChange:f,onSelectionChange:x,onRowClick:T,onRowDblclick:$}),{empty:e.withCtx(()=>[e.createVNode(ae,{"image-size":60})]),default:e.withCtx(()=>[l.selectionCol?(e.openBlock(),e.createBlock(z,{key:0,type:"selection",width:"48",fixed:"left"})):e.createCommentVNode("",!0),l.indexCol?(e.openBlock(),e.createBlock(z,{key:1,type:"index",width:"58",fixed:"left"})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(_),u=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:u.prop},[u.isHtml?(e.openBlock(),e.createBlock(z,e.mergeProps({key:0,ref_for:!0},u),{default:e.withCtx(D=>[e.createElementVNode("div",{innerHTML:u.prop&&D.row[u.prop]},null,8,G)]),_:2},1040)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[u.init?(e.openBlock(),e.createBlock(z,e.mergeProps({key:0,ref_for:!0},u),{default:e.withCtx(D=>[e.renderSlot(l.$slots,`col_${u.prop}`,{data:D.row},()=>[e.createVNode(j,e.mergeProps({ref_for:!0},{row:D.row,colCfg:u}),null,16)])]),header:e.withCtx(()=>[e.renderSlot(l.$slots,`header_${u.prop}`,{data:u},()=>[e.createTextVNode(e.toDisplayString(u.label),1)])]),_:2},1040)):e.createCommentVNode("",!0)],64))],64))),128)),e.renderSlot(l.$slots,"operatColumn")]),_:3},16,["data","max-height"])),[[re,l.tableLoading]]),d.value?(e.openBlock(),e.createBlock(ce,{key:1,background:"","current-page":e.unref(m).pageIndex,"onUpdate:currentPage":B[0]||(B[0]=u=>e.unref(m).pageIndex=u),"page-size":e.unref(m).pageSize,"onUpdate:pageSize":B[1]||(B[1]=u=>e.unref(m).pageSize=u),"page-sizes":l.sizeList,layout:"total, sizes, prev, pager, next, jumper",total:l.total},null,8,["current-page","page-size","page-sizes","total"])):e.createCommentVNode("",!0)],512)}}});E.install=t=>{t.component("TableExtend",E)};const J={class:"contextmenu-wrap"},Q={class:"contextmenu-items"},Z=["onClick"],N=e.defineComponent({__name:"index",props:{visible:{type:Boolean,default:()=>!1},position:{type:Object,default:()=>{}},options:{type:Array,default:[],required:!0}},emits:["menuClick","update:visible"],setup(t,{expose:n,emit:o}){const a=t,c=o;n({hide:w,show:r});const p=e.ref(!1),h=e.ref(null),b=e.reactive({left:0,top:0});e.watch(()=>a.visible,i=>{i&&(p.value=!0,e.nextTick(()=>{_(a.position)}))},{immediate:!0}),e.onMounted(()=>{var i;(i=h.value)==null||i.addEventListener("contextmenu",r)}),e.onBeforeUnmount(()=>{m()});function m(){var i;(i=h.value)==null||i.removeEventListener("contextmenu",r)}function C(i){c("menuClick",i),w()}async function r(i){i.preventDefault(),p.value=!0,await e.nextTick();const{pageX:k,pageY:s}=i;_({x:k,y:s})}function _(i){const{clientWidth:k,clientHeight:s}=h.value;!k||!s||(b.top=`${y("Y",i.y||0,s)}px`,b.left=`${y("X",i.x||0,k)}px`)}function w(){m(),p.value=!1,e.nextTick(()=>{c("update:visible",!1)})}function y(i,k,s){const d=i==="X"?window.innerWidth:window.innerHeight,f=i==="X"?window.scrollX:window.scrollY;let x=k-f;return x+s>d&&(x=Math.max(0,x-s)),x+f}return(i,k)=>{const s=e.resolveComponent("el-divider");return e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[p.value?e.withDirectives((e.openBlock(),e.createElementBlock("div",{key:0,class:"contextmenu",style:e.normalizeStyle({top:b.top,left:b.left}),ref_key:"contextMenuRef",ref:h},[e.createElementVNode("div",J,[e.createElementVNode("ul",Q,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,d=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:d.key},[(d==null?void 0:d.type)=="divider"?(e.openBlock(),e.createBlock(s,{key:0})):(e.openBlock(),e.createElementBlock("li",{key:1,class:"contextmenu-item",onClick:f=>C(d)},[e.renderSlot(i.$slots,"items",{data:{item:d,options:t.options}},()=>[e.createTextVNode(e.toDisplayString(d.label),1)])],8,Z))],64))),128))])])],4)),[[e.unref(O.ClickOutside),w]]):e.createCommentVNode("",!0)])}}});N.install=t=>{t.component("ContextMenu",N)};function v(t,n,o=!0,a=""){switch(n){case"toast":L(o?"success":"error",t||(o?"执行成功":"执行失败"));break;case"dialog":R(t||(o?"执行成功":"执行失败"),()=>{},{title:a||"提示",type:o?"success":"error","show-cancel-button":!1});break;case"notif":M(o?"success":"error",a||"消息提示",t);break}}function ee(t,n,o){const a={beforeClose:(c,p,h)=>{c==="confirm"?setTimeout(()=>{h()},0):h()},...o};S.ElMessageBox.confirm(`此操作将${t}, 是否继续?`,"提示",a).then(async()=>{n&&n()}).catch(()=>{})}function R(t,n,o){return new Promise((a,c)=>{const p={beforeClose:(h,b,m)=>{h==="confirm"?setTimeout(()=>{m()},0):m()},...o};S.ElMessageBox.confirm(`${t}`,"Tip",p).then(()=>{a(n&&n())}).catch(()=>{a(!1)})})}function L(t,n="",o=!1,a=3e3){S.ElMessage({showClose:!0,message:n,type:t,duration:a,dangerouslyUseHTMLString:o})}function M(t,n="",o="",a=!0,c="bottom-right",p=3e3){S.ElNotification({title:n,message:o,type:t,dangerouslyUseHTMLString:a,duration:p,showClose:!0,position:c})}const te=[V,E,N];function oe(t){te.forEach(n=>{t.use(n)})}g.confirmBox=ee,g.confirmBoxAsync=R,g.contextMenu=N,g.install=oe,g.messageAlert=L,g.messageBox=v,g.notification=M,g.tableExtend=E,g.textButton=V,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(g,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("vue-i18n"),require("@qy_better_lib/core"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","vue-i18n","@qy_better_lib/core","element-plus"],e):(g=typeof globalThis<"u"?globalThis:g||self,e(g["@qy_better_lib/pc"]={},g.Vue,g.vueI18n,g.core,g.elementPlus))})(this,function(g,e,A,O,S){"use strict";const V=e.defineComponent({name:"TextButton",__name:"index",props:{type:{type:String,default:"primary",validator:t=>["default","primary","success","warning","info","danger"].includes(t)},icon:String,disabled:Boolean},emits:["click"],setup(t,{emit:n}){const o=t,a=n;function c(p){o.disabled||a("click",p)}return(p,C)=>{const b=e.resolveComponent("el-icon");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["text-button",[`text-button-${t.type}`,t.disabled&&"is-disabled"]])},[o.icon?(e.openBlock(),e.createBlock(b,{key:0,class:"text-button-icon"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.icon)))]),_:1})):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"text-button-inner",onClick:e.withModifiers(c,["prevent","stop"])},[e.renderSlot(p.$slots,"default")])],2)}}});V.install=t=>{t.component("TextButton",V)};var P=(t=>(t[t.PICTURE=1]="PICTURE",t[t.PDF=2]="PDF",t[t.OTHER=3]="OTHER",t))(P||{});function I(t){var i,k;const n=e.getCurrentInstance(),o=n==null?void 0:n.props,a={rowKey:"Id","element-loading-text":"加载中…","element-loading-background":"rgba(0, 0, 0, 0.2)",highlightCurrentRow:!0,stripe:!0,border:!1},c={headerAlign:void 0,align:void 0,prop:void 0,label:void 0,init:!0,width:void 0,showOverflowTooltip:!1,sortable:void 0,fixed:void 0},p=e.computed(()=>({...a,...Object.keys(o.options).length>0?o.options:{}})),C=e.reactive({count:0,rows:[]}),b=e.reactive({pageIndex:(i=o==null?void 0:o.paging)!=null&&i.pageIndex?e.toRef(o.paging,"pageIndex"):1,pageSize:(k=o==null?void 0:o.paging)!=null&&k.pageSize?e.toRef(o.paging,"pageSize"):10}),m=e.computed(()=>{var s,d;return((s=o==null?void 0:o.paging)==null?void 0:s.pageIndex)>0&&((d=o==null?void 0:o.paging)==null?void 0:d.pageSize)>0}),h=e.reactive({show:!1,filePathList:[],index:0}),r=e.reactive({showColumn:[],hiddenColumn:[]}),_=e.computed(()=>!r.showColumn||r.showColumn.length===0?[{prop:"default-prop",init:!0,label:""}]:r.showColumn.map(d=>(t&&d.langue&&(d.label=t(d.langue)),{...c,...d}))),w=e.computed(()=>{var s,d,f,x,T,$;return(((f=(d=n==null?void 0:(s=n.slots)["tool-left"])==null?void 0:d.call(s))==null?void 0:f.length)||0)>0||((($=(T=n==null?void 0:(x=n.slots)["tool-right"])==null?void 0:T.call(x))==null?void 0:$.length)||0)>0}),y=e.computed(()=>_.value.some(s=>s.fileType&&s.fileType==P.PICTURE));return{defColSetting:c,selectionOptions:C,tableAttribute:p,pagination:b,hasPagination:m,imageViewer:h,columnConfig:r,colSettingList:_,showToolPanel:w,hasImageViewer:y}}function U(){return{options:{type:Object,default:()=>({})},tableData:{type:Array,default:[]},tableColums:{type:Array,default:()=>[]},tableLoading:Boolean,selectionCol:{type:Boolean,default:()=>!0},indexCol:{type:Boolean,default:()=>!0},isSetColumn:{type:Boolean,default:()=>!1},paging:{type:Object},total:Number,sizeList:{type:Array,default:()=>[15,20,30,50,100]}}}const j=e.defineComponent({__name:"valueCol",props:{row:{type:Object,default:()=>{}},colCfg:{type:Object,default:()=>{}}},setup(t){const n=t,o=e.computed(()=>{const{row:a,colCfg:c}=n;return a[c.prop]});return(a,c)=>(e.openBlock(),e.createElementBlock("span",null,e.toDisplayString(o.value!=null?o.value:"--"),1))}}),H={class:"set-column-list-wrap"},q={class:"fixed-wrap"},X=e.defineComponent({__name:"colVisible",setup(t){const n=e.inject("table-extend"),o=e.ref(!0),a=e.ref(!1),c=e.computed(()=>n&&n.columnConfig.showColumn.map(h=>h.prop)||[]),p=e.computed(()=>(n==null?void 0:n.tableColums.value)||[]);function C(h){h?n&&(n.columnConfig.showColumn=p.value):n&&(n.columnConfig.showColumn=[])}function b(h){if(n){n.columnConfig.showColumn=p.value.filter(_=>h.includes(_.prop));const r=h.length;o.value=r===p.value.length,a.value=r>0&&r<p.value.length}}function m(h,r){r.fixed===h?r.fixed=void 0:r.fixed=h}return(h,r)=>{const _=e.resolveComponent("Setting"),w=e.resolveComponent("el-icon"),y=e.resolveComponent("el-checkbox"),i=e.resolveComponent("Upload"),k=e.resolveComponent("el-divider"),s=e.resolveComponent("el-checkbox-group"),d=e.resolveComponent("el-popover");return e.openBlock(),e.createBlock(d,{placement:"bottom",title:"列显示设置",width:220},{reference:e.withCtx(()=>[e.createVNode(w,null,{default:e.withCtx(()=>[e.createVNode(_)]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",H,[e.createVNode(y,{indeterminate:a.value,modelValue:o.value,"onUpdate:modelValue":r[0]||(r[0]=f=>o.value=f),onChange:C},{default:e.withCtx(()=>[e.createTextVNode("全选 ")]),_:1},8,["indeterminate","modelValue"]),e.createVNode(s,{class:"set-column-check-group",modelValue:c.value,"onUpdate:modelValue":r[1]||(r[1]=f=>c.value=f),onChange:b},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,f=>(e.openBlock(),e.createElementBlock("div",{class:"group-item",key:f.prop},[e.createVNode(y,{class:"set-column-check",label:f.prop},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.label),1)]),_:2},1032,["label"]),e.createElementVNode("div",q,[e.createVNode(w,{class:e.normalizeClass(["fixed-icon",f.fixed==="left"&&"active"]),title:"固定到左边",onClick:x=>m("left",f)},{default:e.withCtx(()=>[e.createVNode(i)]),_:2},1032,["class","onClick"]),e.createVNode(k,{direction:"vertical"}),e.createVNode(w,{class:e.normalizeClass(["fixed-icon",f.fixed==="right"&&"active"]),title:"固定到右边",onClick:x=>m("right",f)},{default:e.withCtx(()=>[e.createVNode(i)]),_:2},1032,["class","onClick"])])]))),128))]),_:1},8,["modelValue"])])]),_:1})}}}),F={key:0,class:"tool-panel"},Y={class:"left-panel"},W={class:"right-panel"},K={class:"default-tool"},G=["innerHTML"],E=e.defineComponent({__name:"index",props:{...U()},emits:["tableSort","handleSelectionChange","currentChange","pageSizeChange","rowClick","rowDblClick"],setup(t,{expose:n,emit:o}){const a=t,c=o,{t:p}=A.useI18n(),{selectionOptions:C,tableAttribute:b,pagination:m,hasPagination:h,columnConfig:r,colSettingList:_,showToolPanel:w}=I(p);e.provide("table-extend",{tableProps:a,tableColums:e.toRef(a,"tableColums"),columnConfig:r});const y=e.ref(),i=e.ref(null),k=e.ref(!1),s=e.ref(),d=e.computed(()=>{const l=a.tableData.length>(a.total||0)?a.tableData.length:a.total||0;return h.value&&l>m.pageSize});e.watch(()=>a.tableColums,()=>{r.showColumn=a.tableColums}),e.watch(()=>m.pageIndex,l=>{if(l&&l>0){if(k.value){k.value=!1;return}c("currentChange",l),i.value.setScrollTop(0)}}),e.watch(()=>m.pageSize,l=>{l&&l>0&&(k.value=!0,m.pageIndex=1,c("pageSizeChange",l),i.value.setScrollTop(0))}),e.onMounted(()=>{e.nextTick(()=>{var B;const l=((B=y.value)==null?void 0:B.offsetHeight)||0;console.log("wrap_offset_height",l),s.value=l,a.tableColums&&a.tableColums.length>0&&(r.showColumn=a.tableColums)})}),n({clearSelection:ne,toggleRowSelection:le,table:i});function f(l){c("tableSort",{sortName:l.prop,sortType:l.order==="descending"?"desc":l.order==="ascending"?"asc":""})}function x(l){C.rows=l,C.count=l&&l.length,c("handleSelectionChange",l)}function T(l){c("rowClick",l)}function $(l){c("rowDblClick",l)}function ne(){var l;(l=i.value)==null||l.clearSelection()}function le(l){var B;(B=i.value)==null||B.toggleRowSelection(l)}return(l,B)=>{const z=e.resolveComponent("el-table-column"),ae=e.resolveComponent("el-empty"),ie=e.resolveComponent("el-table"),ce=e.resolveComponent("el-pagination"),re=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",{class:"table-extend",ref_key:"tableExtendRef",ref:y},[e.unref(w)?(e.openBlock(),e.createElementBlock("div",F,[e.createElementVNode("div",Y,[e.renderSlot(l.$slots,"tool-left")]),e.createElementVNode("div",W,[e.renderSlot(l.$slots,"tool-right"),e.createElementVNode("div",K,[l.isSetColumn?(e.openBlock(),e.createBlock(X,{key:0})):e.createCommentVNode("",!0)])])])):e.createCommentVNode("",!0),e.withDirectives((e.openBlock(),e.createBlock(ie,e.mergeProps({ref_key:"tableRef",ref:i},e.unref(b),{data:l.tableData,"max-height":s.value,onSortChange:f,onSelectionChange:x,onRowClick:T,onRowDblclick:$}),{empty:e.withCtx(()=>[e.createVNode(ae,{"image-size":60})]),default:e.withCtx(()=>[l.selectionCol?(e.openBlock(),e.createBlock(z,{key:0,type:"selection",width:"48",fixed:"left"})):e.createCommentVNode("",!0),l.indexCol?(e.openBlock(),e.createBlock(z,{key:1,type:"index",width:"58",fixed:"left"})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(_),u=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:u.prop},[u.isHtml?(e.openBlock(),e.createBlock(z,e.mergeProps({key:0,ref_for:!0},u),{default:e.withCtx(D=>[e.createElementVNode("div",{innerHTML:u.prop&&D.row[u.prop]},null,8,G)]),_:2},1040)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[u.init?(e.openBlock(),e.createBlock(z,e.mergeProps({key:0,ref_for:!0},u),{default:e.withCtx(D=>[e.renderSlot(l.$slots,`col_${u.prop}`,{data:D.row},()=>[e.createVNode(j,e.mergeProps({ref_for:!0},{row:D.row,colCfg:u}),null,16)])]),header:e.withCtx(()=>[e.renderSlot(l.$slots,`header_${u.prop}`,{data:u},()=>[e.createTextVNode(e.toDisplayString(u.label),1)])]),_:2},1040)):e.createCommentVNode("",!0)],64))],64))),128)),e.renderSlot(l.$slots,"operatColumn")]),_:3},16,["data","max-height"])),[[re,l.tableLoading]]),d.value?(e.openBlock(),e.createBlock(ce,{key:1,background:"","current-page":e.unref(m).pageIndex,"onUpdate:currentPage":B[0]||(B[0]=u=>e.unref(m).pageIndex=u),"page-size":e.unref(m).pageSize,"onUpdate:pageSize":B[1]||(B[1]=u=>e.unref(m).pageSize=u),"page-sizes":l.sizeList,layout:"total, sizes, prev, pager, next, jumper",total:l.total},null,8,["current-page","page-size","page-sizes","total"])):e.createCommentVNode("",!0)],512)}}});E.install=t=>{t.component("TableExtend",E)};const J={class:"contextmenu-wrap"},Q={class:"contextmenu-items"},Z=["onClick"],N=e.defineComponent({__name:"index",props:{visible:{type:Boolean,default:()=>!1},position:{type:Object,default:()=>{}},options:{type:Array,default:[],required:!0}},emits:["menuClick","update:visible"],setup(t,{expose:n,emit:o}){const a=t,c=o;n({hide:w,show:r});const p=e.ref(!1),C=e.ref(null),b=e.reactive({left:0,top:0});e.watch(()=>a.visible,i=>{i&&(p.value=!0,e.nextTick(()=>{_(a.position)}))},{immediate:!0}),e.onMounted(()=>{var i;(i=C.value)==null||i.addEventListener("contextmenu",r)}),e.onBeforeUnmount(()=>{m()});function m(){var i;(i=C.value)==null||i.removeEventListener("contextmenu",r)}function h(i){c("menuClick",i),w()}async function r(i){i.preventDefault(),p.value=!0,await e.nextTick();const{pageX:k,pageY:s}=i;_({x:k,y:s})}function _(i){const{clientWidth:k,clientHeight:s}=C.value;!k||!s||(b.top=`${y("Y",i.y||0,s)}px`,b.left=`${y("X",i.x||0,k)}px`)}function w(){m(),p.value=!1,e.nextTick(()=>{c("update:visible",!1)})}function y(i,k,s){const d=i==="X"?window.innerWidth:window.innerHeight,f=i==="X"?window.scrollX:window.scrollY;let x=k-f;return x+s>d&&(x=Math.max(0,x-s)),x+f}return(i,k)=>{const s=e.resolveComponent("el-divider");return e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[p.value?e.withDirectives((e.openBlock(),e.createElementBlock("div",{key:0,class:"contextmenu",style:e.normalizeStyle({top:b.top,left:b.left}),ref_key:"contextMenuRef",ref:C},[e.createElementVNode("div",J,[e.createElementVNode("ul",Q,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,d=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:d.key},[(d==null?void 0:d.type)=="divider"?(e.openBlock(),e.createBlock(s,{key:0})):(e.openBlock(),e.createElementBlock("li",{key:1,class:"contextmenu-item",onClick:f=>h(d)},[e.renderSlot(i.$slots,"items",{data:{item:d,options:t.options}},()=>[e.createTextVNode(e.toDisplayString(d.label),1)])],8,Z))],64))),128))])])],4)),[[e.unref(O.ClickOutside),w]]):e.createCommentVNode("",!0)])}}});N.install=t=>{t.component("ContextMenu",N)};function v(t,n,o=!0,a=""){switch(n){case"toast":L(o?"success":"error",t||(o?"执行成功":"执行失败"));break;case"dialog":R(t||(o?"执行成功":"执行失败"),()=>{},{title:a||"提示",type:o?"success":"error","show-cancel-button":!1});break;case"notif":M(o?"success":"error",a||"消息提示",t);break}}function ee(t,n,o){const a={beforeClose:(c,p,C)=>{c==="confirm"?setTimeout(()=>{C()},0):C()},...o};S.ElMessageBox.confirm(`此操作将${t}, 是否继续?`,"提示",a).then(async()=>{n&&n()}).catch(()=>{})}function R(t,n,o){return new Promise((a,c)=>{const p={beforeClose:(C,b,m)=>{C==="confirm"?setTimeout(()=>{m()},0):m()},...o};S.ElMessageBox.confirm(`${t}`,"Tip",p).then(()=>{a(n&&n())}).catch(()=>{a(!1)})})}function L(t,n="",o=!1,a=3e3){S.ElMessage({showClose:!0,message:n,type:t,duration:a,dangerouslyUseHTMLString:o})}function M(t,n="",o="",a=!0,c="bottom-right",p=3e3){S.ElNotification({title:n,message:o,type:t,dangerouslyUseHTMLString:a,duration:p,showClose:!0,position:c})}const te=[V,E,N];function oe(t){te.forEach(n=>{t.use(n)})}g.confirmBox=ee,g.confirmBoxAsync=R,g.contextMenu=N,g.install=oe,g.messageAlert=L,g.messageBox=v,g.notification=M,g.tableExtend=E,g.textButton=V,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -8,8 +8,7 @@ function O(g) {
|
|
|
8
8
|
"element-loading-background": "rgba(0, 0, 0, 0.2)",
|
|
9
9
|
highlightCurrentRow: !0,
|
|
10
10
|
stripe: !0,
|
|
11
|
-
border: !1
|
|
12
|
-
height: "100%"
|
|
11
|
+
border: !1
|
|
13
12
|
}, s = {
|
|
14
13
|
headerAlign: void 0,
|
|
15
14
|
align: void 0,
|
|
@@ -49,8 +48,8 @@ function O(g) {
|
|
|
49
48
|
label: ""
|
|
50
49
|
}
|
|
51
50
|
] : l.showColumn.map((o) => (g && o.langue && (o.label = g(o.langue)), { ...s, ...o }))), S = n(() => {
|
|
52
|
-
var i, o,
|
|
53
|
-
return (((
|
|
51
|
+
var i, o, p, h, f, c;
|
|
52
|
+
return (((p = (o = t == null ? void 0 : (i = t.slots)["tool-left"]) == null ? void 0 : o.call(i)) == null ? void 0 : p.length) || 0) > 0 || (((c = (f = t == null ? void 0 : (h = t.slots)["tool-right"]) == null ? void 0 : f.call(h)) == null ? void 0 : c.length) || 0) > 0;
|
|
54
53
|
}), y = n(() => r.value.some(
|
|
55
54
|
(i) => i.fileType && i.fileType == L.PICTURE
|
|
56
55
|
));
|