@qy_better_lib/pc 0.1.26 → 0.1.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@qy_better_lib/pc.min.js +1 -1
- package/lib/describeView/index.d.ts +3 -0
- package/lib/describeView/index.js +7 -0
- package/lib/describeView/src/index.vue.d.ts +57 -0
- package/lib/describeView/src/index.vue.js +80 -0
- package/lib/describeView/src/index.vue2.js +4 -0
- package/lib/describeView/src/type.d.ts +10 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.js +14 -11
- package/lib/styles/describeView.scss +25 -0
- package/lib/tableExtend/src/index.vue.js +42 -42
- package/lib/tableExtend/type.d.ts +6 -17
- package/lib/tableExtend/useTable.d.ts +3 -10
- package/lib/tableExtend/useTable.js +50 -37
- package/package.json +1 -1
|
@@ -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,O,U,V){"use strict";const E=e.defineComponent({name:"TextButton",__name:"index",props:{type:{type:String,default:"primary",validator:n=>["default","primary","success","warning","info","danger"].includes(n)},icon:String,disabled:Boolean},emits:["click"],setup(n,{emit:o}){const t=n,a=o;function d(p){t.disabled||a("click",p)}return(p,h)=>{const _=e.resolveComponent("el-icon");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["text-button",[`text-button-${n.type}`,n.disabled&&"is-disabled"]])},[t.icon?(e.openBlock(),e.createBlock(_,{key:0,class:"text-button-icon"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.icon)))]),_:1})):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"text-button-inner",onClick:e.withModifiers(d,["prevent"])},[e.renderSlot(p.$slots,"default")])],2)}}});E.install=n=>{n.component("TextButton",E)};var R=(n=>(n[n.PICTURE=1]="PICTURE",n[n.PDF=2]="PDF",n[n.OTHER=3]="OTHER",n))(R||{});function j(n){var f,C;const o=e.getCurrentInstance(),t=o==null?void 0:o.props,a={rowKey:"id","element-loading-text":"加载中…","element-loading-background":"rgba(0, 0, 0, 0.2)",highlightCurrentRow:!0,stripe:!0,border:!1},d={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(t.options).length>0?t.options:{}})),h=e.reactive({count:0,rows:[]}),_=e.reactive({pageIndex:(f=t==null?void 0:t.paging)!=null&&f.pageIndex?e.toRef(t.paging,"pageIndex"):1,pageSize:(C=t==null?void 0:t.paging)!=null&&C.pageSize?e.toRef(t.paging,"pageSize"):10}),g=e.computed(()=>{var u,B;const s=((u=t==null?void 0:t.paging)==null?void 0:u.pageIndex)>0&&((B=t==null?void 0:t.paging)==null?void 0:B.pageSize)>0;if(!t.autoPagination)return s;const i=t.tableData.length>(t.total||0)?t.tableData.length:t.total||0;return s&&i>_.pageSize}),k=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(i=>(n&&i.langue&&(i.label=n(i.langue)),{...d,...i}))),x=e.computed(()=>{var s,i,u,B,$,P;return(((u=(i=o==null?void 0:(s=o.slots)["tool-left"])==null?void 0:i.call(s))==null?void 0:u.length)||0)>0||(((P=($=o==null?void 0:(B=o.slots)["tool-right"])==null?void 0:$.call(B))==null?void 0:P.length)||0)>0}),y=e.computed(()=>{var s,i,u;return(((u=(i=o==null?void 0:(s=o.slots)["tool-left"])==null?void 0:i.call(s))==null?void 0:u.length)||0)>0}),c=e.computed(()=>w.value.some(s=>s.fileType&&s.fileType==R.PICTURE));return{defColSetting:d,selectionOptions:h,tableAttribute:p,pagination:_,hasPagination:g,imageViewer:k,columnConfig:r,colSettingList:w,showToolPanel:x,showBottomPanel:y,hasImageViewer:c}}function H(){return{options:{type:Object,default:()=>({})},tableData:{type:Array,default:[]},tableColums:{type:Array,default:()=>[]},tableLoading:Boolean,selectionCol:{type:Boolean,default:()=>!0},indexCol:{type:Boolean,default:()=>!0},isSetColumn:{type:Boolean,default:()=>!1},paging:{type:Object},total:Number,sizeList:{type:Array,default:()=>[15,20,30,50,100]},autoHeight:{type:Boolean,default:()=>!1},autoPagination:{type:Boolean,default:()=>!1}}}const I=e.defineComponent({__name:"valueCol",props:{row:{type:Object,default:()=>{}},colCfg:{type:Object,default:()=>{}}},setup(n){const o=n,t=e.computed(()=>{const{row:a,colCfg:d}=o;return a[d.prop]});return(a,d)=>(e.openBlock(),e.createElementBlock("span",null,e.toDisplayString(t.value!=null?t.value:"--"),1))}}),q={class:"set-column-list-wrap"},X={class:"fixed-wrap"},F=e.defineComponent({__name:"colVisible",setup(n){const o=e.inject("table-extend"),t=e.ref(!0),a=e.ref(!1),d=e.computed(()=>o&&o.columnConfig.showColumn.map(k=>k.prop)||[]),p=e.computed(()=>(o==null?void 0:o.tableColums.value)||[]);function h(k){k?o&&(o.columnConfig.showColumn=p.value):o&&(o.columnConfig.showColumn=[])}function _(k){if(o){o.columnConfig.showColumn=p.value.filter(w=>k.includes(w.prop));const r=k.length;t.value=r===p.value.length,a.value=r>0&&r<p.value.length}}function g(k,r){r.fixed===k?r.fixed=void 0:r.fixed=k}return(k,r)=>{const w=e.resolveComponent("Setting"),x=e.resolveComponent("el-icon"),y=e.resolveComponent("el-checkbox"),c=e.resolveComponent("Upload"),f=e.resolveComponent("el-divider"),C=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(x,null,{default:e.withCtx(()=>[e.createVNode(w)]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",q,[e.createVNode(y,{indeterminate:a.value,modelValue:t.value,"onUpdate:modelValue":r[0]||(r[0]=i=>t.value=i),onChange:h},{default:e.withCtx(()=>r[2]||(r[2]=[e.createTextVNode("全选 ")])),_:1},8,["indeterminate","modelValue"]),e.createVNode(C,{class:"set-column-check-group",modelValue:d.value,"onUpdate:modelValue":r[1]||(r[1]=i=>d.value=i),onChange:_},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,i=>(e.openBlock(),e.createElementBlock("div",{class:"group-item",key:i.prop},[e.createVNode(y,{class:"set-column-check",label:i.prop},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.label),1)]),_:2},1032,["label"]),e.createElementVNode("div",X,[e.createVNode(x,{class:e.normalizeClass(["fixed-icon",i.fixed==="left"&&"active"]),title:"固定到左边",onClick:u=>g("left",i)},{default:e.withCtx(()=>[e.createVNode(c)]),_:2},1032,["class","onClick"]),e.createVNode(f,{direction:"vertical"}),e.createVNode(x,{class:e.normalizeClass(["fixed-icon",i.fixed==="right"&&"active"]),title:"固定到右边",onClick:u=>g("right",i)},{default:e.withCtx(()=>[e.createVNode(c)]),_:2},1032,["class","onClick"])])]))),128))]),_:1},8,["modelValue"])])]),_:1})}}}),Y={key:0,class:"tool-panel"},W={class:"left-panel"},K={class:"right-panel"},G={class:"default-tool"},J=["innerHTML"],Q={key:1,class:"table-bottom"},Z={class:"left"},N=e.defineComponent({__name:"index",props:{...H()},emits:["tableSort","handleSelectionChange","currentChange","pageSizeChange","rowClick","rowDblClick"],setup(n,{expose:o,emit:t}){const a=n,d=t,{t:p}=O.useI18n(),{selectionOptions:h,tableAttribute:_,pagination:g,hasPagination:k,columnConfig:r,colSettingList:w,showToolPanel:x,showBottomPanel:y}=j(p);e.provide("table-extend",{tableProps:a,tableColums:e.toRef(a,"tableColums"),columnConfig:r});const c=e.ref(),f=e.ref(null),C=e.ref(!1),s=e.ref();e.watch(()=>a.tableColums,()=>{r.showColumn=a.tableColums}),e.watch(()=>g.pageIndex,l=>{if(l&&l>0){if(C.value){C.value=!1;return}d("currentChange",l),f.value.setScrollTop(0)}}),e.watch(()=>g.pageSize,l=>{l&&l>0&&(C.value=!0,g.pageIndex=1,d("pageSizeChange",l),f.value.setScrollTop(0))}),e.onMounted(()=>{e.nextTick(()=>{a.tableColums&&a.tableColums.length>0&&(r.showColumn=a.tableColums)}).then(()=>{})}),o({clearSelection:P,toggleRowSelection:ie,table:f});function i(l){d("tableSort",{sortName:l.prop,sortType:l.order==="descending"?"desc":l.order==="ascending"?"asc":""})}function u(l){h.rows=l,h.count=l&&l.length,d("handleSelectionChange",l)}function B(l){d("rowClick",l)}function $(l){d("rowDblClick",l)}function P(){var l;(l=f.value)==null||l.clearSelection()}function ie(l){var S;(S=f.value)==null||S.toggleRowSelection(l)}return(l,S)=>{const z=e.resolveComponent("el-table-column"),re=e.resolveComponent("el-empty"),ce=e.resolveComponent("el-table"),se=e.resolveComponent("el-pagination"),de=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",{class:"table-extend",ref_key:"tableExtendRef",ref:c},[e.unref(x)?(e.openBlock(),e.createElementBlock("div",Y,[e.createElementVNode("div",W,[e.renderSlot(l.$slots,"tool-left")]),e.createElementVNode("div",K,[e.renderSlot(l.$slots,"tool-right"),e.createElementVNode("div",G,[l.isSetColumn?(e.openBlock(),e.createBlock(F,{key:0})):e.createCommentVNode("",!0)])])])):e.createCommentVNode("",!0),e.withDirectives((e.openBlock(),e.createBlock(ce,e.mergeProps({ref_key:"tableRef",ref:f},e.unref(_),{data:l.tableData,"max-height":s.value,onSortChange:i,onSelectionChange:u,onRowClick:B,onRowDblclick:$}),{empty:e.withCtx(()=>[e.renderSlot(l.$slots,"empty",{},()=>[e.createVNode(re,{"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",label:"序号",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(z,e.mergeProps({key:0,ref_for:!0},b),{default:e.withCtx(D=>[e.createElementVNode("div",{innerHTML:b.prop&&D.row[b.prop]},null,8,J)]),_:2},1040)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[b.init?(e.openBlock(),e.createBlock(z,e.mergeProps({key:0,ref_for:!0},b),{default:e.withCtx(D=>[e.renderSlot(l.$slots,`col_${b.prop}`,{data:D.row},()=>[e.createVNode(I,e.mergeProps({ref_for:!0},{row:D.row,colCfg:b}),null,16)])]),header:e.withCtx(()=>[e.renderSlot(l.$slots,`header_${b.prop}`,{data:b},()=>[e.createTextVNode(e.toDisplayString(b.label),1)])]),_:2},1040)):e.createCommentVNode("",!0)],64))],64))),128)),e.renderSlot(l.$slots,"operatColumn")]),_:3},16,["data","max-height"])),[[de,l.tableLoading]]),e.unref(y)||e.unref(k)?(e.openBlock(),e.createElementBlock("div",Q,[e.createElementVNode("div",Z,[e.renderSlot(l.$slots,"bottom-left")]),e.unref(k)?(e.openBlock(),e.createBlock(se,{key:0,"current-page":e.unref(g).pageIndex,"onUpdate:currentPage":S[0]||(S[0]=b=>e.unref(g).pageIndex=b),"page-size":e.unref(g).pageSize,"onUpdate:pageSize":S[1]||(S[1]=b=>e.unref(g).pageSize=b),"page-sizes":l.sizeList,layout:"total,prev,pager,next,sizes,jumper",total:l.total,background:""},null,8,["current-page","page-size","page-sizes","total"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],512)}}});N.install=n=>{n.component("TableExtend",N)};const v={class:"contextmenu-wrap"},ee={class:"contextmenu-items"},te=["onClick"],T=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(n,{expose:o,emit:t}){const a=n,d=t;o({hide:x,show:r});const p=e.ref(!1),h=e.ref(null),_=e.reactive({left:0,top:0});e.watch(()=>a.visible,c=>{c&&(p.value=!0,e.nextTick(()=>{w(a.position)}))},{immediate:!0}),e.onMounted(()=>{var c;(c=h.value)==null||c.addEventListener("contextmenu",r)}),e.onBeforeUnmount(()=>{g()});function g(){var c;(c=h.value)==null||c.removeEventListener("contextmenu",r)}function k(c){d("menuClick",c),x()}async function r(c){c.preventDefault(),p.value=!0,await e.nextTick();const{pageX:f,pageY:C}=c;w({x:f,y:C})}function w(c){const{clientWidth:f,clientHeight:C}=h.value;!f||!C||(_.top=`${y("Y",c.y||0,C)}px`,_.left=`${y("X",c.x||0,f)}px`)}function x(){g(),p.value=!1,e.nextTick(()=>{d("update:visible",!1)})}function y(c,f,C){const s=c==="X"?window.innerWidth:window.innerHeight,i=c==="X"?window.scrollX:window.scrollY;let u=f-i;return u+C>s&&(u=Math.max(0,u-C)),u+i}return(c,f)=>{const C=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:h},[e.createElementVNode("div",v,[e.createElementVNode("ul",ee,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.options,s=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:s.key},[(s==null?void 0:s.type)=="divider"?(e.openBlock(),e.createBlock(C,{key:0})):(e.openBlock(),e.createElementBlock("li",{key:1,class:"contextmenu-item",onClick:i=>k(s)},[e.renderSlot(c.$slots,"items",{data:{item:s,options:n.options}},()=>[e.createTextVNode(e.toDisplayString(s.label),1)])],8,te))],64))),128))])])],4)),[[e.unref(U.ClickOutside),x]]):e.createCommentVNode("",!0)])}}});T.install=n=>{n.component("ContextMenu",T)};function oe(n,o,t=!0,a=""){switch(o){case"toast":M(t?"success":"error",n||(t?"执行成功":"执行失败"));break;case"dialog":L(n||(t?"执行成功":"执行失败"),()=>{},{title:a||"提示",type:t?"success":"error","show-cancel-button":!1});break;case"notif":A(t?"success":"error",a||"消息提示",n);break}}function ne(n,o,t){const a={beforeClose:(d,p,h)=>{d==="confirm"?setTimeout(()=>{h()},0):h()},...t};V.ElMessageBox.confirm(`此操作将${n}, 是否继续?`,"提示",a).then(async()=>{o&&o()}).catch(()=>{})}function L(n,o,t){return new Promise((a,d)=>{const p={beforeClose:(h,_,g)=>{h==="confirm"?setTimeout(()=>{g()},0):g()},...t};V.ElMessageBox.confirm(`${n}`,"Tip",p).then(()=>{a(o&&o())}).catch(()=>{a(!1)})})}function M(n,o="",t=!1,a=3e3){V.ElMessage({showClose:!0,message:o,type:n,duration:a,dangerouslyUseHTMLString:t})}function A(n,o="",t="",a=!0,d="bottom-right",p=3e3){V.ElNotification({title:o,message:t,type:n,dangerouslyUseHTMLString:a,duration:p,showClose:!0,position:d})}const le=[E,N,T];function ae(n){le.forEach(o=>{n.use(o)})}m.confirmBox=ne,m.confirmBoxAsync=L,m.contextMenu=T,m.install=ae,m.messageAlert=M,m.messageBox=oe,m.notification=A,m.tableExtend=N,m.textButton=E,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(C,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):(C=typeof globalThis<"u"?globalThis:C||self,e(C["@qy_better_lib/pc"]={},C.Vue,C.vueI18n,C.core,C.elementPlus))})(this,function(C,e,U,M,E){"use strict";const N=e.defineComponent({name:"TextButton",__name:"index",props:{type:{type:String,default:"primary",validator:o=>["default","primary","success","warning","info","danger"].includes(o)},icon:String,disabled:Boolean},emits:["click"],setup(o,{emit:t}){const n=o,i=t;function d(a){n.disabled||i("click",a)}return(a,p)=>{const f=e.resolveComponent("el-icon");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["text-button",[`text-button-${o.type}`,o.disabled&&"is-disabled"]])},[n.icon?(e.openBlock(),e.createBlock(f,{key:0,class:"text-button-icon"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.icon)))]),_:1})):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"text-button-inner",onClick:e.withModifiers(d,["prevent"])},[e.renderSlot(a.$slots,"default")])],2)}}});N.install=o=>{o.component("TextButton",N)};var W=(o=>(o[o.PICTURE=1]="PICTURE",o[o.PDF=2]="PDF",o[o.OTHER=3]="OTHER",o))(W||{});function H(o){var h,u;const t=e.getCurrentInstance(),n=t==null?void 0:t.props,i={rowKey:"id","element-loading-text":"加载中…","element-loading-background":"rgba(0, 0, 0, 0.2)",highlightCurrentRow:!0,stripe:!0,border:!1},d={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},a=e.computed(()=>({...i,...Object.keys(n.options).length>0?n.options:{}})),p=e.reactive({count:0,rows:[]}),f=e.reactive({pageIndex:(h=n==null?void 0:n.paging)!=null&&h.pageIndex?e.toRef(n.paging,"pageIndex"):1,pageSize:(u=n==null?void 0:n.paging)!=null&&u.pageSize?e.toRef(n.paging,"pageSize"):10}),g=e.computed(()=>{var b,S;const r=((b=n==null?void 0:n.paging)==null?void 0:b.pageIndex)>0&&((S=n==null?void 0:n.paging)==null?void 0:S.pageSize)>0;if(!n.autoPagination)return r;const c=n.tableData.length>(n.total||0)?n.tableData.length:n.total||0;return r&&c>f.pageSize}),k=e.reactive({show:!1,filePathList:[],index:0}),m=e.reactive({showColumn:[],hiddenColumn:[]}),y=e.computed(()=>!m.showColumn||m.showColumn.length===0?[{prop:"default-prop",init:!0,label:""}]:m.showColumn.map(c=>{if(o&&c.langue&&(c.label=o(c.langue)),c.autoW){const{baseW:b=1920}=c;c.width?c.width=_(c.width||0,b):c.minWidth&&(c.minWidth=_(c.minWidth||0,b))}return{...d,...c}})),B=e.computed(()=>{var r,c,b,S,P,D;return(((b=(c=t==null?void 0:(r=t.slots)["tool-left"])==null?void 0:c.call(r))==null?void 0:b.length)||0)>0||(((D=(P=t==null?void 0:(S=t.slots)["tool-right"])==null?void 0:P.call(S))==null?void 0:D.length)||0)>0}),x=e.computed(()=>{var r,c,b;return(((b=(c=t==null?void 0:(r=t.slots)["tool-left"])==null?void 0:c.call(r))==null?void 0:b.length)||0)>0}),s=e.computed(()=>y.value.some(r=>r.fileType&&r.fileType==W.PICTURE));function _(r,c=1920){let b=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;if(!b)return r;let S=b/c;return Number((r*S).toFixed(3))}return{defColSetting:d,selectionOptions:p,tableAttribute:a,pagination:f,hasPagination:g,imageViewer:k,columnConfig:m,colSettingList:y,showToolPanel:B,showBottomPanel:x,hasImageViewer:s,auto_size:_}}function I(){return{options:{type:Object,default:()=>({})},tableData:{type:Array,default:[]},tableColums:{type:Array,default:()=>[]},tableLoading:Boolean,selectionCol:{type:Boolean,default:()=>!0},indexCol:{type:Boolean,default:()=>!0},isSetColumn:{type:Boolean,default:()=>!1},paging:{type:Object},total:Number,sizeList:{type:Array,default:()=>[15,20,30,50,100]},autoHeight:{type:Boolean,default:()=>!1},autoPagination:{type:Boolean,default:()=>!1}}}const q=e.defineComponent({__name:"valueCol",props:{row:{type:Object,default:()=>{}},colCfg:{type:Object,default:()=>{}}},setup(o){const t=o,n=e.computed(()=>{const{row:i,colCfg:d}=t;return i[d.prop]});return(i,d)=>(e.openBlock(),e.createElementBlock("span",null,e.toDisplayString(n.value!=null?n.value:"--"),1))}}),F={class:"set-column-list-wrap"},X={class:"fixed-wrap"},Y=e.defineComponent({__name:"colVisible",setup(o){const t=e.inject("table-extend"),n=e.ref(!0),i=e.ref(!1),d=e.computed(()=>t&&t.columnConfig.showColumn.map(k=>k.prop)||[]),a=e.computed(()=>(t==null?void 0:t.tableColums.value)||[]);function p(k){k?t&&(t.columnConfig.showColumn=a.value):t&&(t.columnConfig.showColumn=[])}function f(k){if(t){t.columnConfig.showColumn=a.value.filter(y=>k.includes(y.prop));const m=k.length;n.value=m===a.value.length,i.value=m>0&&m<a.value.length}}function g(k,m){m.fixed===k?m.fixed=void 0:m.fixed=k}return(k,m)=>{const y=e.resolveComponent("Setting"),B=e.resolveComponent("el-icon"),x=e.resolveComponent("el-checkbox"),s=e.resolveComponent("Upload"),_=e.resolveComponent("el-divider"),h=e.resolveComponent("el-checkbox-group"),u=e.resolveComponent("el-popover");return e.openBlock(),e.createBlock(u,{placement:"bottom",title:"列显示设置",width:220},{reference:e.withCtx(()=>[e.createVNode(B,null,{default:e.withCtx(()=>[e.createVNode(y)]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",F,[e.createVNode(x,{indeterminate:i.value,modelValue:n.value,"onUpdate:modelValue":m[0]||(m[0]=r=>n.value=r),onChange:p},{default:e.withCtx(()=>m[2]||(m[2]=[e.createTextVNode("全选 ")])),_:1},8,["indeterminate","modelValue"]),e.createVNode(h,{class:"set-column-check-group",modelValue:d.value,"onUpdate:modelValue":m[1]||(m[1]=r=>d.value=r),onChange:f},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,r=>(e.openBlock(),e.createElementBlock("div",{class:"group-item",key:r.prop},[e.createVNode(x,{class:"set-column-check",label:r.prop},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.label),1)]),_:2},1032,["label"]),e.createElementVNode("div",X,[e.createVNode(B,{class:e.normalizeClass(["fixed-icon",r.fixed==="left"&&"active"]),title:"固定到左边",onClick:c=>g("left",r)},{default:e.withCtx(()=>[e.createVNode(s)]),_:2},1032,["class","onClick"]),e.createVNode(_,{direction:"vertical"}),e.createVNode(B,{class:e.normalizeClass(["fixed-icon",r.fixed==="right"&&"active"]),title:"固定到右边",onClick:c=>g("right",r)},{default:e.withCtx(()=>[e.createVNode(s)]),_:2},1032,["class","onClick"])])]))),128))]),_:1},8,["modelValue"])])]),_:1})}}}),K={key:0,class:"tool-panel"},G={class:"left-panel"},J={class:"right-panel"},Q={class:"default-tool"},Z=["innerHTML"],v={key:1,class:"table-bottom"},ee={class:"left"},$=e.defineComponent({__name:"index",props:{...I()},emits:["tableSort","handleSelectionChange","currentChange","pageSizeChange","rowClick","rowDblClick"],setup(o,{expose:t,emit:n}){const i=o,d=n,{t:a}=U.useI18n(),{selectionOptions:p,tableAttribute:f,pagination:g,hasPagination:k,columnConfig:m,colSettingList:y,showToolPanel:B,showBottomPanel:x,auto_size:s}=H(a);e.provide("table-extend",{tableProps:i,tableColums:e.toRef(i,"tableColums"),columnConfig:m});const _=e.ref(),h=e.ref(null),u=e.ref(!1);e.watch(()=>i.tableColums,()=>{m.showColumn=i.tableColums}),e.watch(()=>g.pageIndex,l=>{if(l&&l>0){if(u.value){u.value=!1;return}d("currentChange",l),h.value.setScrollTop(0)}}),e.watch(()=>g.pageSize,l=>{l&&l>0&&(u.value=!0,g.pageIndex=1,d("pageSizeChange",l),h.value.setScrollTop(0))}),e.onMounted(()=>{e.nextTick(()=>{i.tableColums&&i.tableColums.length>0&&(m.showColumn=i.tableColums)}).then(()=>{})}),t({clearSelection:P,toggleRowSelection:D,table:h});function r(l){d("tableSort",{sortName:l.prop,sortType:l.order==="descending"?"desc":l.order==="ascending"?"asc":""})}function c(l){p.rows=l,p.count=l&&l.length,d("handleSelectionChange",l)}function b(l){d("rowClick",l)}function S(l){d("rowDblClick",l)}function P(){var l;(l=h.value)==null||l.clearSelection()}function D(l){var V;(V=h.value)==null||V.toggleRowSelection(l)}return(l,V)=>{const R=e.resolveComponent("el-table-column"),de=e.resolveComponent("el-empty"),pe=e.resolveComponent("el-table"),fe=e.resolveComponent("el-pagination"),me=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",{class:"table-extend",ref_key:"tableExtendRef",ref:_},[e.unref(B)?(e.openBlock(),e.createElementBlock("div",K,[e.createElementVNode("div",G,[e.renderSlot(l.$slots,"tool-left")]),e.createElementVNode("div",J,[e.renderSlot(l.$slots,"tool-right"),e.createElementVNode("div",Q,[l.isSetColumn?(e.openBlock(),e.createBlock(Y,{key:0})):e.createCommentVNode("",!0)])])])):e.createCommentVNode("",!0),e.withDirectives((e.openBlock(),e.createBlock(pe,e.mergeProps({ref_key:"tableRef",ref:h},e.unref(f),{data:l.tableData,onSortChange:r,onSelectionChange:c,onRowClick:b,onRowDblclick:S}),{empty:e.withCtx(()=>[e.renderSlot(l.$slots,"empty",{},()=>[e.createVNode(de,{"image-size":60})])]),default:e.withCtx(()=>[l.selectionCol?(e.openBlock(),e.createBlock(R,{key:0,type:"selection",width:e.unref(s)(48),fixed:"left"},null,8,["width"])):e.createCommentVNode("",!0),l.indexCol?(e.openBlock(),e.createBlock(R,{key:1,type:"index",label:"序号",width:e.unref(s)(58),fixed:"left"},null,8,["width"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(y),w=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:w.prop},[w.isHtml?(e.openBlock(),e.createBlock(R,e.mergeProps({key:0,ref_for:!0},w),{default:e.withCtx(L=>[e.createElementVNode("div",{innerHTML:w.prop&&L.row[w.prop]},null,8,Z)]),_:2},1040)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[w.init?(e.openBlock(),e.createBlock(R,e.mergeProps({key:0,ref_for:!0},w),{default:e.withCtx(L=>[e.renderSlot(l.$slots,`col_${w.prop}`,{data:L.row},()=>[e.createVNode(q,e.mergeProps({ref_for:!0},{row:L.row,colCfg:w}),null,16)])]),header:e.withCtx(()=>[e.renderSlot(l.$slots,`header_${w.prop}`,{data:w},()=>[e.createTextVNode(e.toDisplayString(w.label),1)])]),_:2},1040)):e.createCommentVNode("",!0)],64))],64))),128)),e.renderSlot(l.$slots,"operatColumn")]),_:3},16,["data"])),[[me,l.tableLoading]]),e.unref(x)||e.unref(k)?(e.openBlock(),e.createElementBlock("div",v,[e.createElementVNode("div",ee,[e.renderSlot(l.$slots,"bottom-left")]),e.unref(k)?(e.openBlock(),e.createBlock(fe,{key:0,"current-page":e.unref(g).pageIndex,"onUpdate:currentPage":V[0]||(V[0]=w=>e.unref(g).pageIndex=w),"page-size":e.unref(g).pageSize,"onUpdate:pageSize":V[1]||(V[1]=w=>e.unref(g).pageSize=w),"page-sizes":l.sizeList,layout:"total,prev,pager,next,sizes,jumper",total:l.total,background:""},null,8,["current-page","page-size","page-sizes","total"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],512)}}});$.install=o=>{o.component("TableExtend",$)};const te={class:"contextmenu-wrap"},oe={class:"contextmenu-items"},ne=["onClick"],T=e.defineComponent({__name:"index",props:{visible:{type:Boolean,default:()=>!1},position:{type:Object,default:()=>{}},options:{type:Array,default:[],required:!0}},emits:["menuClick","update:visible"],setup(o,{expose:t,emit:n}){const i=o,d=n;t({hide:B,show:m});const a=e.ref(!1),p=e.ref(null),f=e.reactive({left:0,top:0});e.watch(()=>i.visible,s=>{s&&(a.value=!0,e.nextTick(()=>{y(i.position)}))},{immediate:!0}),e.onMounted(()=>{var s;(s=p.value)==null||s.addEventListener("contextmenu",m)}),e.onBeforeUnmount(()=>{g()});function g(){var s;(s=p.value)==null||s.removeEventListener("contextmenu",m)}function k(s){d("menuClick",s),B()}async function m(s){s.preventDefault(),a.value=!0,await e.nextTick();const{pageX:_,pageY:h}=s;y({x:_,y:h})}function y(s){const{clientWidth:_,clientHeight:h}=p.value;!_||!h||(f.top=`${x("Y",s.y||0,h)}px`,f.left=`${x("X",s.x||0,_)}px`)}function B(){g(),a.value=!1,e.nextTick(()=>{d("update:visible",!1)})}function x(s,_,h){const u=s==="X"?window.innerWidth:window.innerHeight,r=s==="X"?window.scrollX:window.scrollY;let c=_-r;return c+h>u&&(c=Math.max(0,c-h)),c+r}return(s,_)=>{const h=e.resolveComponent("el-divider");return e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[a.value?e.withDirectives((e.openBlock(),e.createElementBlock("div",{key:0,class:"contextmenu",style:e.normalizeStyle({top:f.top,left:f.left}),ref_key:"contextMenuRef",ref:p},[e.createElementVNode("div",te,[e.createElementVNode("ul",oe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options,u=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:u.key},[(u==null?void 0:u.type)=="divider"?(e.openBlock(),e.createBlock(h,{key:0})):(e.openBlock(),e.createElementBlock("li",{key:1,class:"contextmenu-item",onClick:r=>k(u)},[e.renderSlot(s.$slots,"items",{data:{item:u,options:o.options}},()=>[e.createTextVNode(e.toDisplayString(u.label),1)])],8,ne))],64))),128))])])],4)),[[e.unref(M.ClickOutside),B]]):e.createCommentVNode("",!0)])}}});T.install=o=>{o.component("ContextMenu",T)};const le={class:"describe-view-container"},ae={class:"value"},z=e.defineComponent({__name:"index",props:{config:{type:Object},data:{type:Object,default:{}},column:{type:Number,default:3},labelWidth:{type:[Number,String],default:85}},setup(o){const t=o,n=computed(()=>({"grid-template-columns":`repeat(${t.column}, minmax(1px, 1fr))`}));function i(a){const p={};return a.col_span&&(p.gridColumnStart=`span ${a.col_span}`),a.row_span&&(p.gridRowStart=`span ${a.row_span}`),p}function d(a){let p=(a+1)%t.column;p=p===0?t.column:p;let f=0;if(M.isNumber(t.labelWidth))f=t.labelWidth;else{const g=t.labelWidth.split(",");g.length===1?f=t.labelWidth:f=g[p-1]}return{width:`${f}px`}}return(a,p)=>(e.openBlock(),e.createElementBlock("div",le,[e.renderSlot(a.$slots,"header"),e.createElementVNode("div",{class:"view-content",style:e.normalizeStyle(e.unref(n))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.config,(f,g)=>(e.openBlock(),e.createElementBlock("div",{class:"view-item",key:f.prop,style:e.normalizeStyle(i(f))},[e.createElementVNode("div",{class:"label",style:e.normalizeStyle(d(g))},[e.renderSlot(a.$slots,`label_${f.prop}`,{},()=>[e.createTextVNode(e.toDisplayString(`${f.label}:`),1)])],4),e.createElementVNode("div",ae,[e.renderSlot(a.$slots,`value_${f.prop}`,{data:o.data},()=>[e.createTextVNode(e.toDisplayString(o.data[f.prop]!=null?o.data[f.prop]:"--"),1)])])],4))),128))],4),e.renderSlot(a.$slots,"footer")]))}});z.install=o=>{o.component("DescribeView",z)};function ie(o,t,n=!0,i=""){switch(t){case"toast":A(n?"success":"error",o||(n?"执行成功":"执行失败"));break;case"dialog":O(o||(n?"执行成功":"执行失败"),()=>{},{title:i||"提示",type:n?"success":"error","show-cancel-button":!1});break;case"notif":j(n?"success":"error",i||"消息提示",o);break}}function re(o,t,n){const i={beforeClose:(d,a,p)=>{d==="confirm"?setTimeout(()=>{p()},0):p()},...n};E.ElMessageBox.confirm(`此操作将${o}, 是否继续?`,"提示",i).then(async()=>{t&&t()}).catch(()=>{})}function O(o,t,n){return new Promise((i,d)=>{const a={beforeClose:(p,f,g)=>{p==="confirm"?setTimeout(()=>{g()},0):g()},...n};E.ElMessageBox.confirm(`${o}`,"Tip",a).then(()=>{i(t&&t())}).catch(()=>{i(!1)})})}function A(o,t="",n=!1,i=3e3){E.ElMessage({showClose:!0,message:t,type:o,duration:i,dangerouslyUseHTMLString:n})}function j(o,t="",n="",i=!0,d="bottom-right",a=3e3){E.ElNotification({title:t,message:n,type:o,dangerouslyUseHTMLString:i,duration:a,showClose:!0,position:d})}const ce=[N,$,T,z];function se(o){ce.forEach(t=>{o.use(t)})}C.confirmBox=re,C.confirmBoxAsync=O,C.contextMenu=T,C.describeView=z,C.install=se,C.messageAlert=A,C.messageBox=ie,C.notification=j,C.tableExtend=$,C.textButton=N,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { PropType, DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
2
|
+
import { ViewConfig } from './type';
|
|
3
|
+
|
|
4
|
+
declare const _default: __VLS_WithTemplateSlots< DefineComponent<ExtractPropTypes<{
|
|
5
|
+
/**配置 */
|
|
6
|
+
config: {
|
|
7
|
+
type: PropType<ViewConfig[]>;
|
|
8
|
+
};
|
|
9
|
+
/**数据 */
|
|
10
|
+
data: {
|
|
11
|
+
type: PropType<Record<string, any>>;
|
|
12
|
+
default: {};
|
|
13
|
+
};
|
|
14
|
+
column: {
|
|
15
|
+
type: NumberConstructor;
|
|
16
|
+
default: number;
|
|
17
|
+
};
|
|
18
|
+
/**label宽度:数字或字符串;如果定义多列宽度,使用字符串格式'20,30,50' */
|
|
19
|
+
labelWidth: {
|
|
20
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
21
|
+
default: number;
|
|
22
|
+
};
|
|
23
|
+
}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<{
|
|
24
|
+
/**配置 */
|
|
25
|
+
config: {
|
|
26
|
+
type: PropType<ViewConfig[]>;
|
|
27
|
+
};
|
|
28
|
+
/**数据 */
|
|
29
|
+
data: {
|
|
30
|
+
type: PropType<Record<string, any>>;
|
|
31
|
+
default: {};
|
|
32
|
+
};
|
|
33
|
+
column: {
|
|
34
|
+
type: NumberConstructor;
|
|
35
|
+
default: number;
|
|
36
|
+
};
|
|
37
|
+
/**label宽度:数字或字符串;如果定义多列宽度,使用字符串格式'20,30,50' */
|
|
38
|
+
labelWidth: {
|
|
39
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
40
|
+
default: number;
|
|
41
|
+
};
|
|
42
|
+
}>> & Readonly<{}>, {
|
|
43
|
+
data: Record<string, any>;
|
|
44
|
+
column: number;
|
|
45
|
+
labelWidth: string | number;
|
|
46
|
+
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>, Partial<Record<`label_${string}`, (_: {}) => any>> & Partial<Record<`value_${string}`, (_: {
|
|
47
|
+
data: Record<string, any>;
|
|
48
|
+
}) => any>> & {
|
|
49
|
+
header?(_: {}): any;
|
|
50
|
+
footer?(_: {}): any;
|
|
51
|
+
}>;
|
|
52
|
+
export default _default;
|
|
53
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
54
|
+
new (): {
|
|
55
|
+
$slots: S;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { defineComponent as y, openBlock as r, createElementBlock as i, renderSlot as s, createElementVNode as d, normalizeStyle as c, unref as h, Fragment as $, renderList as v, createTextVNode as u, toDisplayString as p } from "vue";
|
|
2
|
+
import { isNumber as g } from "@qy_better_lib/core";
|
|
3
|
+
const w = { class: "describe-view-container" }, _ = { class: "value" }, W = /* @__PURE__ */ y({
|
|
4
|
+
__name: "index",
|
|
5
|
+
props: {
|
|
6
|
+
/**配置 */
|
|
7
|
+
config: {
|
|
8
|
+
type: Object
|
|
9
|
+
},
|
|
10
|
+
/**数据 */
|
|
11
|
+
data: {
|
|
12
|
+
type: Object,
|
|
13
|
+
default: {}
|
|
14
|
+
},
|
|
15
|
+
// 展示列数
|
|
16
|
+
column: {
|
|
17
|
+
type: Number,
|
|
18
|
+
default: 3
|
|
19
|
+
},
|
|
20
|
+
/**label宽度:数字或字符串;如果定义多列宽度,使用字符串格式'20,30,50' */
|
|
21
|
+
labelWidth: {
|
|
22
|
+
type: [Number, String],
|
|
23
|
+
default: 85
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
setup(a) {
|
|
27
|
+
const n = a, f = computed(() => ({
|
|
28
|
+
"grid-template-columns": `repeat(${n.column}, minmax(1px, 1fr))`
|
|
29
|
+
}));
|
|
30
|
+
function m(t) {
|
|
31
|
+
const l = {};
|
|
32
|
+
return t.col_span && (l.gridColumnStart = `span ${t.col_span}`), t.row_span && (l.gridRowStart = `span ${t.row_span}`), l;
|
|
33
|
+
}
|
|
34
|
+
function b(t) {
|
|
35
|
+
let l = (t + 1) % n.column;
|
|
36
|
+
l = l === 0 ? n.column : l;
|
|
37
|
+
let e = 0;
|
|
38
|
+
if (g(n.labelWidth))
|
|
39
|
+
e = n.labelWidth;
|
|
40
|
+
else {
|
|
41
|
+
const o = n.labelWidth.split(",");
|
|
42
|
+
o.length === 1 ? e = n.labelWidth : e = o[l - 1];
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
width: `${e}px`
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
return (t, l) => (r(), i("div", w, [
|
|
49
|
+
s(t.$slots, "header"),
|
|
50
|
+
d("div", {
|
|
51
|
+
class: "view-content",
|
|
52
|
+
style: c(h(f))
|
|
53
|
+
}, [
|
|
54
|
+
(r(!0), i($, null, v(a.config, (e, o) => (r(), i("div", {
|
|
55
|
+
class: "view-item",
|
|
56
|
+
key: e.prop,
|
|
57
|
+
style: c(m(e))
|
|
58
|
+
}, [
|
|
59
|
+
d("div", {
|
|
60
|
+
class: "label",
|
|
61
|
+
style: c(b(o))
|
|
62
|
+
}, [
|
|
63
|
+
s(t.$slots, `label_${e.prop}`, {}, () => [
|
|
64
|
+
u(p(`${e.label}:`), 1)
|
|
65
|
+
])
|
|
66
|
+
], 4),
|
|
67
|
+
d("div", _, [
|
|
68
|
+
s(t.$slots, `value_${e.prop}`, { data: a.data }, () => [
|
|
69
|
+
u(p(a.data[e.prop] != null ? a.data[e.prop] : "--"), 1)
|
|
70
|
+
])
|
|
71
|
+
])
|
|
72
|
+
], 4))), 128))
|
|
73
|
+
], 4),
|
|
74
|
+
s(t.$slots, "footer")
|
|
75
|
+
]));
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
export {
|
|
79
|
+
W as default
|
|
80
|
+
};
|
package/lib/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { default as textButton } from './textButton';
|
|
2
2
|
import { default as tableExtend } from './tableExtend';
|
|
3
3
|
import { default as contextMenu } from './contextMenu';
|
|
4
|
+
import { default as describeView } from './describeView';
|
|
4
5
|
import { App } from 'vue';
|
|
5
6
|
import { messageAlert, messageBox, confirmBox, confirmBoxAsync, notification } from './utils';
|
|
6
7
|
|
|
7
8
|
declare function install(app: App): void;
|
|
8
9
|
export type { TableProp, TableColumn } from './tableExtend';
|
|
9
|
-
export { install, textButton, tableExtend, contextMenu, messageAlert, messageBox, confirmBox, confirmBoxAsync, notification, };
|
|
10
|
+
export { install, textButton, tableExtend, contextMenu, describeView, messageAlert, messageBox, confirmBox, confirmBoxAsync, notification, };
|
package/lib/index.js
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
import "./textButton/index.js";
|
|
2
2
|
import "./tableExtend/index.js";
|
|
3
3
|
import "./contextMenu/index.js";
|
|
4
|
-
import
|
|
4
|
+
import "./describeView/index.js";
|
|
5
|
+
import { confirmBox as b, confirmBoxAsync as d, messageAlert as g, messageBox as A, notification as E } from "./utils/index.js";
|
|
5
6
|
import m from "./textButton/src/index.vue.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
import i from "./tableExtend/src/index.vue.js";
|
|
8
|
+
import r from "./contextMenu/src/index.vue.js";
|
|
9
|
+
import n from "./describeView/src/index.vue.js";
|
|
10
|
+
const s = [m, i, r, n];
|
|
11
|
+
function u(o) {
|
|
12
|
+
s.forEach((t) => {
|
|
11
13
|
o.use(t);
|
|
12
14
|
});
|
|
13
15
|
}
|
|
14
16
|
export {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
b as confirmBox,
|
|
18
|
+
d as confirmBoxAsync,
|
|
19
|
+
r as contextMenu,
|
|
20
|
+
n as describeView,
|
|
21
|
+
u as install,
|
|
19
22
|
g as messageAlert,
|
|
20
23
|
A as messageBox,
|
|
21
24
|
E as notification,
|
|
22
|
-
|
|
25
|
+
i as tableExtend,
|
|
23
26
|
m as textButton
|
|
24
27
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
.describe-view-container {
|
|
2
|
+
padding: 0 var(--spacing04) var(--spacing04);
|
|
3
|
+
|
|
4
|
+
.view-content {
|
|
5
|
+
display: grid;
|
|
6
|
+
gap: var(--spacing04);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.view-item {
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
|
|
13
|
+
.label {
|
|
14
|
+
flex-shrink: 0;
|
|
15
|
+
color: var(--text-color02);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.value {
|
|
19
|
+
display: flex;
|
|
20
|
+
overflow: hidden;
|
|
21
|
+
text-overflow: ellipsis;
|
|
22
|
+
white-space: nowrap;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as J, provide as K, toRef as Q, ref as
|
|
1
|
+
import { defineComponent as J, provide as K, toRef as Q, ref as S, watch as w, onMounted as W, nextTick as X, resolveComponent as h, resolveDirective as Y, openBlock as o, createElementBlock as d, unref as l, createElementVNode as f, renderSlot as s, createBlock as i, createCommentVNode as c, withDirectives as Z, mergeProps as C, withCtx as g, createVNode as R, Fragment as v, renderList as ee, createTextVNode as te, toDisplayString as oe } from "vue";
|
|
2
2
|
import { useI18n as le } from "vue-i18n";
|
|
3
3
|
import ne from "../useTable.js";
|
|
4
4
|
import ae from "../props.js";
|
|
@@ -21,50 +21,51 @@ const ie = {
|
|
|
21
21
|
"rowClick",
|
|
22
22
|
"rowDblClick"
|
|
23
23
|
],
|
|
24
|
-
setup(
|
|
25
|
-
const n =
|
|
24
|
+
setup(T, { expose: D, emit: P }) {
|
|
25
|
+
const n = T, p = P, { t: I } = le(), {
|
|
26
26
|
selectionOptions: y,
|
|
27
|
-
tableAttribute:
|
|
27
|
+
tableAttribute: L,
|
|
28
28
|
pagination: a,
|
|
29
29
|
hasPagination: z,
|
|
30
|
-
columnConfig:
|
|
31
|
-
colSettingList:
|
|
32
|
-
showToolPanel:
|
|
33
|
-
showBottomPanel:
|
|
34
|
-
|
|
30
|
+
columnConfig: _,
|
|
31
|
+
colSettingList: N,
|
|
32
|
+
showToolPanel: x,
|
|
33
|
+
showBottomPanel: B,
|
|
34
|
+
auto_size: $
|
|
35
|
+
} = ne(I);
|
|
35
36
|
K("table-extend", {
|
|
36
37
|
tableProps: n,
|
|
37
38
|
tableColums: Q(n, "tableColums"),
|
|
38
|
-
columnConfig:
|
|
39
|
+
columnConfig: _
|
|
39
40
|
});
|
|
40
|
-
const
|
|
41
|
-
|
|
41
|
+
const E = S(), u = S(null), k = S(!1);
|
|
42
|
+
w(
|
|
42
43
|
() => n.tableColums,
|
|
43
44
|
() => {
|
|
44
|
-
|
|
45
|
+
_.showColumn = n.tableColums;
|
|
45
46
|
}
|
|
46
|
-
),
|
|
47
|
+
), w(
|
|
47
48
|
() => a.pageIndex,
|
|
48
49
|
(e) => {
|
|
49
50
|
if (e && e > 0) {
|
|
50
|
-
if (
|
|
51
|
-
|
|
51
|
+
if (k.value) {
|
|
52
|
+
k.value = !1;
|
|
52
53
|
return;
|
|
53
54
|
}
|
|
54
55
|
p("currentChange", e), u.value.setScrollTop(0);
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
|
-
),
|
|
58
|
+
), w(
|
|
58
59
|
() => a.pageSize,
|
|
59
60
|
(e) => {
|
|
60
|
-
e && e > 0 && (
|
|
61
|
+
e && e > 0 && (k.value = !0, a.pageIndex = 1, p("pageSizeChange", e), u.value.setScrollTop(0));
|
|
61
62
|
}
|
|
62
63
|
), W(() => {
|
|
63
64
|
X(() => {
|
|
64
|
-
n.tableColums && n.tableColums.length > 0 && (
|
|
65
|
+
n.tableColums && n.tableColums.length > 0 && (_.showColumn = n.tableColums);
|
|
65
66
|
}).then(() => {
|
|
66
67
|
});
|
|
67
|
-
}),
|
|
68
|
+
}), D({
|
|
68
69
|
clearSelection: j,
|
|
69
70
|
toggleRowSelection: A,
|
|
70
71
|
table: u
|
|
@@ -93,13 +94,13 @@ const ie = {
|
|
|
93
94
|
(r = u.value) == null || r.toggleRowSelection(e);
|
|
94
95
|
}
|
|
95
96
|
return (e, r) => {
|
|
96
|
-
const m =
|
|
97
|
+
const m = h("el-table-column"), F = h("el-empty"), O = h("el-table"), q = h("el-pagination"), G = Y("loading");
|
|
97
98
|
return o(), d("div", {
|
|
98
99
|
class: "table-extend",
|
|
99
100
|
ref_key: "tableExtendRef",
|
|
100
|
-
ref:
|
|
101
|
+
ref: E
|
|
101
102
|
}, [
|
|
102
|
-
l(
|
|
103
|
+
l(x) ? (o(), d("div", ie, [
|
|
103
104
|
f("div", ce, [
|
|
104
105
|
s(e.$slots, "tool-left")
|
|
105
106
|
]),
|
|
@@ -110,12 +111,11 @@ const ie = {
|
|
|
110
111
|
])
|
|
111
112
|
])
|
|
112
113
|
])) : c("", !0),
|
|
113
|
-
Z((o(), i(O,
|
|
114
|
+
Z((o(), i(O, C({
|
|
114
115
|
ref_key: "tableRef",
|
|
115
116
|
ref: u
|
|
116
|
-
}, l(
|
|
117
|
+
}, l(L), {
|
|
117
118
|
data: e.tableData,
|
|
118
|
-
"max-height": E.value,
|
|
119
119
|
onSortChange: V,
|
|
120
120
|
onSelectionChange: H,
|
|
121
121
|
onRowClick: M,
|
|
@@ -123,46 +123,46 @@ const ie = {
|
|
|
123
123
|
}), {
|
|
124
124
|
empty: g(() => [
|
|
125
125
|
s(e.$slots, "empty", {}, () => [
|
|
126
|
-
|
|
126
|
+
R(F, { "image-size": 60 })
|
|
127
127
|
])
|
|
128
128
|
]),
|
|
129
129
|
default: g(() => [
|
|
130
130
|
e.selectionCol ? (o(), i(m, {
|
|
131
131
|
key: 0,
|
|
132
132
|
type: "selection",
|
|
133
|
-
width:
|
|
133
|
+
width: l($)(48),
|
|
134
134
|
fixed: "left"
|
|
135
|
-
})) : c("", !0),
|
|
135
|
+
}, null, 8, ["width"])) : c("", !0),
|
|
136
136
|
e.indexCol ? (o(), i(m, {
|
|
137
137
|
key: 1,
|
|
138
138
|
type: "index",
|
|
139
139
|
label: "序号",
|
|
140
|
-
width:
|
|
140
|
+
width: l($)(58),
|
|
141
141
|
fixed: "left"
|
|
142
|
-
})) : c("", !0),
|
|
143
|
-
(o(!0), d(
|
|
142
|
+
}, null, 8, ["width"])) : c("", !0),
|
|
143
|
+
(o(!0), d(v, null, ee(l(N), (t) => (o(), d(v, {
|
|
144
144
|
key: t.prop
|
|
145
145
|
}, [
|
|
146
|
-
t.isHtml ? (o(), i(m,
|
|
146
|
+
t.isHtml ? (o(), i(m, C({
|
|
147
147
|
key: 0,
|
|
148
148
|
ref_for: !0
|
|
149
149
|
}, t), {
|
|
150
|
-
default: g((
|
|
150
|
+
default: g((b) => [
|
|
151
151
|
f("div", {
|
|
152
|
-
innerHTML: t.prop &&
|
|
152
|
+
innerHTML: t.prop && b.row[t.prop]
|
|
153
153
|
}, null, 8, de)
|
|
154
154
|
]),
|
|
155
155
|
_: 2
|
|
156
|
-
}, 1040)) : (o(), d(
|
|
157
|
-
t.init ? (o(), i(m,
|
|
156
|
+
}, 1040)) : (o(), d(v, { key: 1 }, [
|
|
157
|
+
t.init ? (o(), i(m, C({
|
|
158
158
|
key: 0,
|
|
159
159
|
ref_for: !0
|
|
160
160
|
}, t), {
|
|
161
|
-
default: g((
|
|
161
|
+
default: g((b) => [
|
|
162
162
|
s(e.$slots, `col_${t.prop}`, {
|
|
163
|
-
data:
|
|
163
|
+
data: b.row
|
|
164
164
|
}, () => [
|
|
165
|
-
|
|
165
|
+
R(re, C({ ref_for: !0 }, { row: b.row, colCfg: t }), null, 16)
|
|
166
166
|
])
|
|
167
167
|
]),
|
|
168
168
|
header: g(() => [
|
|
@@ -177,10 +177,10 @@ const ie = {
|
|
|
177
177
|
s(e.$slots, "operatColumn")
|
|
178
178
|
]),
|
|
179
179
|
_: 3
|
|
180
|
-
}, 16, ["data"
|
|
180
|
+
}, 16, ["data"])), [
|
|
181
181
|
[G, e.tableLoading]
|
|
182
182
|
]),
|
|
183
|
-
l(
|
|
183
|
+
l(B) || l(z) ? (o(), d("div", fe, [
|
|
184
184
|
f("div", ge, [
|
|
185
185
|
s(e.$slots, "bottom-left")
|
|
186
186
|
]),
|
|
@@ -140,16 +140,17 @@ export interface TableColumn {
|
|
|
140
140
|
minWidth?: number;
|
|
141
141
|
/**
|
|
142
142
|
* 是否显示单元格内容tooltip
|
|
143
|
+
* boolean或tooltip属性对象
|
|
143
144
|
*/
|
|
144
|
-
showOverflowTooltip?: boolean
|
|
145
|
+
showOverflowTooltip?: boolean | Record<string, any>;
|
|
145
146
|
/**
|
|
146
147
|
* 是否能排序
|
|
147
148
|
*/
|
|
148
149
|
sortable?: boolean;
|
|
149
|
-
/**
|
|
150
|
+
/**
|
|
151
|
+
* 是否固定
|
|
152
|
+
*/
|
|
150
153
|
fixed?: "left" | "right";
|
|
151
|
-
/** 是否为文件 */
|
|
152
|
-
isFile?: boolean;
|
|
153
154
|
/**
|
|
154
155
|
* 图片类型
|
|
155
156
|
*/
|
|
@@ -158,21 +159,9 @@ export interface TableColumn {
|
|
|
158
159
|
* 数据是否为HTML
|
|
159
160
|
*/
|
|
160
161
|
isHtml?: boolean;
|
|
161
|
-
/**
|
|
162
|
-
* 是否为进度条
|
|
163
|
-
*/
|
|
164
|
-
isProgress?: boolean;
|
|
165
|
-
/**
|
|
166
|
-
* 是否为工序进度
|
|
167
|
-
*/
|
|
168
|
-
isProcess?: boolean;
|
|
169
|
-
/**
|
|
170
|
-
* 组件配置列表
|
|
171
|
-
*/
|
|
172
|
-
componentOption?: any;
|
|
173
|
-
/**页面Id*/
|
|
174
162
|
/**多语言配置 */
|
|
175
163
|
langue?: string;
|
|
164
|
+
/**其他配置 */
|
|
176
165
|
[key: string]: any;
|
|
177
166
|
}
|
|
178
167
|
export {};
|
|
@@ -28,15 +28,11 @@ export default function useTable(i18nInstance?: (key: string) => string): {
|
|
|
28
28
|
init?: boolean | undefined;
|
|
29
29
|
width?: number | undefined;
|
|
30
30
|
minWidth?: number | undefined;
|
|
31
|
-
showOverflowTooltip?: boolean | undefined;
|
|
31
|
+
showOverflowTooltip?: boolean | Record<string, any> | undefined;
|
|
32
32
|
sortable?: boolean | undefined;
|
|
33
33
|
fixed?: "left" | "right" | undefined;
|
|
34
|
-
isFile?: boolean | undefined;
|
|
35
34
|
fileType?: FileType | undefined;
|
|
36
35
|
isHtml?: boolean | undefined;
|
|
37
|
-
isProgress?: boolean | undefined;
|
|
38
|
-
isProcess?: boolean | undefined;
|
|
39
|
-
componentOption?: any;
|
|
40
36
|
langue?: string | undefined;
|
|
41
37
|
}[];
|
|
42
38
|
hiddenColumn: {
|
|
@@ -48,15 +44,11 @@ export default function useTable(i18nInstance?: (key: string) => string): {
|
|
|
48
44
|
init?: boolean | undefined;
|
|
49
45
|
width?: number | undefined;
|
|
50
46
|
minWidth?: number | undefined;
|
|
51
|
-
showOverflowTooltip?: boolean | undefined;
|
|
47
|
+
showOverflowTooltip?: boolean | Record<string, any> | undefined;
|
|
52
48
|
sortable?: boolean | undefined;
|
|
53
49
|
fixed?: "left" | "right" | undefined;
|
|
54
|
-
isFile?: boolean | undefined;
|
|
55
50
|
fileType?: FileType | undefined;
|
|
56
51
|
isHtml?: boolean | undefined;
|
|
57
|
-
isProgress?: boolean | undefined;
|
|
58
|
-
isProcess?: boolean | undefined;
|
|
59
|
-
componentOption?: any;
|
|
60
52
|
langue?: string | undefined;
|
|
61
53
|
}[];
|
|
62
54
|
};
|
|
@@ -64,4 +56,5 @@ export default function useTable(i18nInstance?: (key: string) => string): {
|
|
|
64
56
|
showToolPanel: ComputedRef<boolean>;
|
|
65
57
|
showBottomPanel: ComputedRef<boolean>;
|
|
66
58
|
hasImageViewer: ComputedRef<boolean>;
|
|
59
|
+
auto_size: (size: number, defalteWidth?: number) => number;
|
|
67
60
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { getCurrentInstance as L, computed as
|
|
1
|
+
import { getCurrentInstance as L, computed as a, reactive as g, toRef as m } from "vue";
|
|
2
2
|
import { FileType as v } from "./type.js";
|
|
3
|
-
function R(
|
|
4
|
-
var
|
|
5
|
-
const
|
|
3
|
+
function R(u) {
|
|
4
|
+
var c, p;
|
|
5
|
+
const i = L(), t = i == null ? void 0 : i.props, C = {
|
|
6
6
|
rowKey: "id",
|
|
7
7
|
"element-loading-text": "加载中…",
|
|
8
8
|
"element-loading-background": "rgba(0, 0, 0, 0.2)",
|
|
9
9
|
highlightCurrentRow: !0,
|
|
10
10
|
stripe: !0,
|
|
11
11
|
border: !1
|
|
12
|
-
},
|
|
12
|
+
}, h = {
|
|
13
13
|
headerAlign: void 0,
|
|
14
14
|
align: void 0,
|
|
15
15
|
prop: void 0,
|
|
@@ -19,59 +19,72 @@ function R(d) {
|
|
|
19
19
|
showOverflowTooltip: !1,
|
|
20
20
|
sortable: void 0,
|
|
21
21
|
fixed: void 0
|
|
22
|
-
},
|
|
23
|
-
...
|
|
24
|
-
...Object.keys(
|
|
25
|
-
})),
|
|
22
|
+
}, x = a(() => ({
|
|
23
|
+
...C,
|
|
24
|
+
...Object.keys(t.options).length > 0 ? t.options : {}
|
|
25
|
+
})), W = g({
|
|
26
26
|
count: 0,
|
|
27
27
|
rows: []
|
|
28
|
-
}), r =
|
|
29
|
-
pageIndex: (
|
|
30
|
-
pageSize: (p =
|
|
31
|
-
}), T =
|
|
32
|
-
var
|
|
33
|
-
const
|
|
34
|
-
if (!
|
|
35
|
-
return
|
|
36
|
-
const
|
|
37
|
-
return
|
|
38
|
-
}), S =
|
|
28
|
+
}), r = g({
|
|
29
|
+
pageIndex: (c = t == null ? void 0 : t.paging) != null && c.pageIndex ? m(t.paging, "pageIndex") : 1,
|
|
30
|
+
pageSize: (p = t == null ? void 0 : t.paging) != null && p.pageSize ? m(t.paging, "pageSize") : 10
|
|
31
|
+
}), T = a(() => {
|
|
32
|
+
var o, l;
|
|
33
|
+
const n = ((o = t == null ? void 0 : t.paging) == null ? void 0 : o.pageIndex) > 0 && ((l = t == null ? void 0 : t.paging) == null ? void 0 : l.pageSize) > 0;
|
|
34
|
+
if (!t.autoPagination)
|
|
35
|
+
return n;
|
|
36
|
+
const e = t.tableData.length > (t.total || 0) ? t.tableData.length : t.total || 0;
|
|
37
|
+
return n && e > r.pageSize;
|
|
38
|
+
}), S = g({
|
|
39
39
|
/**是否显示 */
|
|
40
40
|
show: !1,
|
|
41
41
|
/**图片路径 */
|
|
42
42
|
filePathList: [],
|
|
43
43
|
/**显示图片的索引 */
|
|
44
44
|
index: 0
|
|
45
|
-
}),
|
|
45
|
+
}), d = g({
|
|
46
46
|
showColumn: [],
|
|
47
47
|
hiddenColumn: []
|
|
48
|
-
}), f =
|
|
48
|
+
}), f = a(() => !d.showColumn || d.showColumn.length === 0 ? [
|
|
49
49
|
{
|
|
50
50
|
prop: "default-prop",
|
|
51
51
|
init: !0,
|
|
52
52
|
label: ""
|
|
53
53
|
}
|
|
54
|
-
] :
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return
|
|
60
|
-
}),
|
|
61
|
-
|
|
54
|
+
] : d.showColumn.map((e) => {
|
|
55
|
+
if (u && e.langue && (e.label = u(e.langue)), e.autoW) {
|
|
56
|
+
const { baseW: o = 1920 } = e;
|
|
57
|
+
e.width ? e.width = s(e.width || 0, o) : e.minWidth && (e.minWidth = s(e.minWidth || 0, o));
|
|
58
|
+
}
|
|
59
|
+
return { ...h, ...e };
|
|
60
|
+
})), y = a(() => {
|
|
61
|
+
var n, e, o, l, w, b;
|
|
62
|
+
return (((o = (e = i == null ? void 0 : (n = i.slots)["tool-left"]) == null ? void 0 : e.call(n)) == null ? void 0 : o.length) || 0) > 0 || (((b = (w = i == null ? void 0 : (l = i.slots)["tool-right"]) == null ? void 0 : w.call(l)) == null ? void 0 : b.length) || 0) > 0;
|
|
63
|
+
}), P = a(() => {
|
|
64
|
+
var n, e, o;
|
|
65
|
+
return (((o = (e = i == null ? void 0 : (n = i.slots)["tool-left"]) == null ? void 0 : e.call(n)) == null ? void 0 : o.length) || 0) > 0;
|
|
66
|
+
}), z = a(() => f.value.some(
|
|
67
|
+
(n) => n.fileType && n.fileType == v.PICTURE
|
|
62
68
|
));
|
|
69
|
+
function s(n, e = 1920) {
|
|
70
|
+
let o = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
|
|
71
|
+
if (!o) return n;
|
|
72
|
+
let l = o / e;
|
|
73
|
+
return Number((n * l).toFixed(3));
|
|
74
|
+
}
|
|
63
75
|
return {
|
|
64
|
-
defColSetting:
|
|
65
|
-
selectionOptions:
|
|
66
|
-
tableAttribute:
|
|
76
|
+
defColSetting: h,
|
|
77
|
+
selectionOptions: W,
|
|
78
|
+
tableAttribute: x,
|
|
67
79
|
pagination: r,
|
|
68
80
|
hasPagination: T,
|
|
69
81
|
imageViewer: S,
|
|
70
|
-
columnConfig:
|
|
82
|
+
columnConfig: d,
|
|
71
83
|
colSettingList: f,
|
|
72
|
-
showToolPanel:
|
|
73
|
-
showBottomPanel:
|
|
74
|
-
hasImageViewer: z
|
|
84
|
+
showToolPanel: y,
|
|
85
|
+
showBottomPanel: P,
|
|
86
|
+
hasImageViewer: z,
|
|
87
|
+
auto_size: s
|
|
75
88
|
};
|
|
76
89
|
}
|
|
77
90
|
export {
|