wtsk-comps 1.3.2 → 1.3.4
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/README.md +45 -2
- package/dist/wtsk-comps.cjs.js +1 -1
- package/dist/wtsk-comps.es.js +50 -54
- package/dist/wtsk-comps.umd.js +1 -1
- package/package.json +3 -3
- /package/dist/{wtsk-comps.css → index.css} +0 -0
package/README.md
CHANGED
|
@@ -1,3 +1,46 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 一款基于Vue3+Element Plus的后台管理类基础组件库,包含表格、表单、按钮、树组件
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## 注意事项
|
|
4
|
+
- 项目需基于Vue3开发
|
|
5
|
+
- Node.js版本需≥ 20.0.0
|
|
6
|
+
|
|
7
|
+
## 使用方法
|
|
8
|
+
### 第一步:安装项目所需依赖(已有可忽略)
|
|
9
|
+
```bash
|
|
10
|
+
npm install sass -D
|
|
11
|
+
```
|
|
12
|
+
```bash
|
|
13
|
+
npm install element-plus --save
|
|
14
|
+
```
|
|
15
|
+
注意:element-plus版本需 ≥ 2.11.3
|
|
16
|
+
```bash
|
|
17
|
+
npm install @element-plus/icons-vue --save
|
|
18
|
+
```
|
|
19
|
+
```bash
|
|
20
|
+
npm install wtsk-comps --save
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### 第二步:全局引入组件及依赖
|
|
24
|
+
在main.js中引入wtsk-comps组件及相关依赖。
|
|
25
|
+
```javascript
|
|
26
|
+
import { createApp } from 'vue'
|
|
27
|
+
import App from './App.vue'
|
|
28
|
+
import ElementPlus from 'element-plus'
|
|
29
|
+
import 'element-plus/dist/index.css'
|
|
30
|
+
import WtskComps from 'wtsk-comps'
|
|
31
|
+
import 'wtsk-comps/dist/index.css'
|
|
32
|
+
|
|
33
|
+
const app = createApp(App)
|
|
34
|
+
app.use(ElementPlus).use(WtskComps).mount('#app')
|
|
35
|
+
```
|
|
36
|
+
注意:因组件是基于Element Plus已有组件进行的封装,所以使用时需全局引入element-plus。
|
|
37
|
+
|
|
38
|
+
### 第三步:项目中直接使用组件
|
|
39
|
+
在项目中直接使用wtsk-comps组件即可,目前支持(wtsk-btn/form/table/tree),使用方式见组件文档。
|
|
40
|
+
```vue
|
|
41
|
+
<template>
|
|
42
|
+
<div>
|
|
43
|
+
<wtsk-btn>默认按钮</wtsk-btn>
|
|
44
|
+
</div>
|
|
45
|
+
</template>
|
|
46
|
+
```
|
package/dist/wtsk-comps.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),V=require("element-plus"),x={name:"WtskBtn"},N=Object.assign(x,{name:"WtskBtn",inheritAttrs:!1},{setup(r){const m=e.useAttrs(),f=e.ref(!1);function h(p,k){const a={};for(const g in p)g!==k&&(a[g]=p[g]);return a}async function i(){var p;f.value=!0;try{await((p=m.onClick)==null?void 0:p.call(m))}finally{f.value=!1}}return(p,k)=>{const a=e.resolveComponent("el-button");return e.openBlock(),e.createBlock(a,e.mergeProps(h(p.$attrs,"onClick"),{loading:f.value,onClick:i}),{default:e.withCtx(()=>[e.renderSlot(p.$slots,"default")]),_:3},16,["loading"])}}});/*! Element Plus Icons Vue v2.3.2 */var E=e.defineComponent({name:"Delete",__name:"delete",setup(r){return(m,f)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32"})]))}}),S=E,P=e.defineComponent({name:"Edit",__name:"edit",setup(r){return(m,f)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M832 512a32 32 0 1 1 64 0v352a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h352a32 32 0 0 1 0 64H192v640h640z"}),e.createElementVNode("path",{fill:"currentColor",d:"m469.952 554.24 52.8-7.552L847.104 222.4a32 32 0 1 0-45.248-45.248L477.44 501.44l-7.552 52.8zm422.4-422.4a96 96 0 0 1 0 135.808l-331.84 331.84a32 32 0 0 1-18.112 9.088L436.8 623.68a32 32 0 0 1-36.224-36.224l15.104-105.6a32 32 0 0 1 9.024-18.112l331.904-331.84a96 96 0 0 1 135.744 0z"})]))}}),b=P,T=e.defineComponent({name:"Plus",__name:"plus",setup(r){return(m,f)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64z"})]))}}),_=T;const F={class:"wtsk-tree-box"},z={key:0,class:"wtsk-tree-box-title"},$={key:1,class:"wtsk-tree-box-filter wtsk-form"},H={style:{display:"flex","align-items":"center"},class:"wtsk-form"},M={class:"wtsk-tree-box-tree-custom"},O={style:{display:"flex","align-items":"center"},class:"wtsk-form"},U={style:{display:"flex","align-items":"center"},class:"wtsk-form"},A={name:"WtskTree"},R=Object.assign(A,{name:"WtskTree",inheritAttrs:!1},{props:{treeTitle:{type:String,default:""},treeHasFilter:{type:Boolean,default:!1},treeFilterType:{type:String,default:"default"},treeHasOperate:{type:Boolean,default:!1},treeCustomizeOperate:{type:Boolean,default:!1},treeAddParentText:{type:String,default:"新增一级"}},emits:["treeOperate"],setup(r,{expose:m,emit:f}){const h=e.useAttrs(),i=r,p=e.ref();let k=e.ref(""),a=e.ref("");const g=f;e.watch(k,o=>{var l;(l=p.value)==null||l.filter(o)});function s(o,l,u){var y;if(!o)return!0;const n=l.label?l.label:(y=h.props)==null?void 0:y.label;if(i.treeFilterType==="default")return l[n].includes(o);{let w=[];v(u,w,o,n);let B=!1;return w.forEach(t=>{B=B||t}),B}}function v(o,l,u,n){let y=o.data&&o.data[n]&&o.data[n].includes(u);y&&l.push(y),!y&&o.level!==1&&o.parent&&v(o.parent,l,u,n)}function d(o,l,u){i.treeCustomizeOperate||o==="delete"?g("treeOperate",o,l,u):a.value.trim()!==""?(document.documentElement.click(),g("treeOperate",o,l,u,a.value)):V.ElMessage.error("名称不能为空!")}return m({wtskTreeRef:p}),(o,l)=>{const u=e.resolveComponent("el-input"),n=e.resolveComponent("el-button"),y=e.resolveComponent("el-popover"),w=e.resolveComponent("el-popconfirm"),B=e.resolveComponent("el-tree");return e.openBlock(),e.createElementBlock("div",F,[r.treeTitle!==""?(e.openBlock(),e.createElementBlock("div",z,e.toDisplayString(r.treeTitle),1)):e.createCommentVNode("",!0),r.treeHasFilter||r.treeHasOperate?(e.openBlock(),e.createElementBlock("div",$,[r.treeHasFilter?(e.openBlock(),e.createBlock(u,{key:0,modelValue:e.unref(k),"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(k)?k.value=t:k=t),placeholder:"输入名称进行筛选……",clearable:""},null,8,["modelValue"])):e.createCommentVNode("",!0),r.treeCustomizeOperate?(e.openBlock(),e.createBlock(n,{key:2,type:"primary",onClick:l[4]||(l[4]=t=>d("addParent"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.treeAddParentText),1)]),_:1})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[r.treeHasOperate?(e.openBlock(),e.createBlock(y,{key:0,placement:"bottom",width:280,trigger:"click"},{reference:e.withCtx(()=>[e.createVNode(n,{type:"primary",onClick:l[1]||(l[1]=t=>e.isRef(a)?a.value="":a="")},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.treeAddParentText),1)]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",H,[e.createVNode(u,{modelValue:e.unref(a),"onUpdate:modelValue":l[2]||(l[2]=t=>e.isRef(a)?a.value=t:a=t),placeholder:"请输入名称",clearable:""},null,8,["modelValue"]),e.createVNode(n,{type:"primary",style:{"margin-left":"10px"},onClick:l[3]||(l[3]=e.withModifiers(t=>d("addParent"),["stop"]))},{default:e.withCtx(()=>[...l[9]||(l[9]=[e.createTextVNode("新增",-1)])]),_:1})])]),_:1})):e.createCommentVNode("",!0)],64))])):e.createCommentVNode("",!0),e.createVNode(B,e.mergeProps({ref_key:"wtskTreeRef",ref:p,class:"wtsk-tree wtsk-tree-box-tree"},{"node-key":"id","highlight-current":!0,"default-expand-all":!0,"expand-on-click-node":!1,"check-on-click-leaf":!1,...o.$attrs},{"filter-node-method":s}),e.createSlots({_:2},[r.treeHasOperate?{name:"default",fn:e.withCtx(({node:t,data:c})=>[e.createElementVNode("div",M,[e.createElementVNode("div",null,e.toDisplayString(t.label),1),e.createElementVNode("div",null,[r.treeCustomizeOperate?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(n,{type:"success",link:"",icon:e.unref(_),onClick:e.withModifiers(C=>d("add",c,t),["stop"])},null,8,["icon","onClick"]),e.createVNode(n,{type:"primary",link:"",icon:e.unref(b),onClick:e.withModifiers(C=>d("edit",c,t),["stop"])},null,8,["icon","onClick"])],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(y,{placement:"bottom",width:280,trigger:"click"},{reference:e.withCtx(()=>[e.createVNode(n,{type:"success",link:"",icon:e.unref(_),onClick:l[5]||(l[5]=e.withModifiers(C=>e.isRef(a)?a.value="":a="",["stop"]))},null,8,["icon"])]),default:e.withCtx(()=>[e.createElementVNode("div",O,[e.createVNode(u,{modelValue:e.unref(a),"onUpdate:modelValue":l[6]||(l[6]=C=>e.isRef(a)?a.value=C:a=C),placeholder:"请输入名称",clearable:""},null,8,["modelValue"]),e.createVNode(n,{type:"primary",style:{"margin-left":"10px"},onClick:e.withModifiers(C=>d("add",c,t),["stop"])},{default:e.withCtx(()=>[...l[10]||(l[10]=[e.createTextVNode("新增",-1)])]),_:1},8,["onClick"])])]),_:2},1024),e.createVNode(y,{placement:"bottom",width:280,trigger:"click"},{reference:e.withCtx(()=>[e.createVNode(n,{type:"primary",link:"",icon:e.unref(b),onClick:e.withModifiers(C=>e.isRef(a)?a.value=t.label:a=t.label,["stop"])},null,8,["icon","onClick"])]),default:e.withCtx(()=>[e.createElementVNode("div",U,[e.createVNode(u,{modelValue:e.unref(a),"onUpdate:modelValue":l[7]||(l[7]=C=>e.isRef(a)?a.value=C:a=C),placeholder:"请输入名称",clearable:""},null,8,["modelValue"]),e.createVNode(n,{type:"primary",style:{"margin-left":"10px"},onClick:e.withModifiers(C=>d("edit",c,t),["stop"])},{default:e.withCtx(()=>[...l[11]||(l[11]=[e.createTextVNode("修改",-1)])]),_:1},8,["onClick"])])]),_:2},1024)],64)),e.createVNode(w,{title:"确定删除这条数据吗?","hide-icon":"",width:"170",onConfirm:C=>d("delete",c,t)},{reference:e.withCtx(()=>[e.createVNode(n,{type:"danger",link:"",icon:e.unref(S),onClick:l[8]||(l[8]=e.withModifiers(()=>{},["stop"]))},null,8,["icon"])]),_:1},8,["onConfirm"])])])]),key:"0"}:void 0]),1040)])}}}),W={name:"WtskForm"},D=Object.assign(W,{name:"WtskForm",inheritAttrs:!1},{props:e.mergeModels({formIsSearch:{type:Boolean,default:!1},formItems:{type:Array,default:()=>[]}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(r,{expose:m}){const f=r,h=e.computed(()=>f.formItems.filter(s=>!s.hidden)),i=e.useModel(r,"modelValue"),p={input:V.ElInput,number:V.ElInputNumber,select:V.ElSelect,date:V.ElDatePicker,switch:V.ElSwitch,treeSelect:V.ElTreeSelect};function k(s,v){if(!s||typeof s!="object"||!v)return;const d=v.split(".");let o=s;for(const l of d){if(o===null||!(l in o))return;o=o[l]}return o}function a(s,v,d){if(!s||typeof s!="object"||!v)return;const o=v.split(".");let l=s;for(let u=0;u<o.length-1;u++){const n=o[u];if((l[n]===null||typeof l[n]!="object"&&l[n]!==void 0)&&(l[n]={}),!(n in l))return;l=l[n]}l[o[o.length-1]]=d}const g=e.ref();return m({wtskFormRef:g}),(s,v)=>{const d=e.resolveComponent("el-radio"),o=e.resolveComponent("el-radio-group"),l=e.resolveComponent("el-checkbox"),u=e.resolveComponent("el-checkbox-group"),n=e.resolveComponent("el-form-item"),y=e.resolveComponent("el-col"),w=e.resolveComponent("el-row"),B=e.resolveComponent("el-form");return e.openBlock(),e.createBlock(B,e.mergeProps({ref_key:"wtskFormRef",ref:g,class:["wtsk-form",r.formIsSearch?"wtsk-form-search":""]},{"label-width":r.formIsSearch?"auto":"100px",...s.$attrs},{model:i.value}),{default:e.withCtx(()=>[r.formIsSearch?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,t=>(e.openBlock(),e.createBlock(n,{key:t.prop,label:t.label,prop:t.prop},{default:e.withCtx(()=>[e.renderSlot(s.$slots,t.prop,{},()=>[t.type==="radio"||t.type==="checkbox"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.type==="radio"?(e.openBlock(),e.createBlock(o,{key:0,modelValue:i.value[t.prop],"onUpdate:modelValue":c=>i.value[t.prop]=c},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data,c=>(e.openBlock(),e.createBlock(d,{value:c.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.label),1)]),_:2},1032,["value"]))),256))]),_:2},1032,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0),t.type==="checkbox"?(e.openBlock(),e.createBlock(u,{key:1,modelValue:i.value[t.prop],"onUpdate:modelValue":c=>i.value[t.prop]=c},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data,c=>(e.openBlock(),e.createBlock(l,{label:c.label,value:c.value},null,8,["label","value"]))),256))]),_:2},1032,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(p[t.type]),e.mergeProps({key:1,ref_for:!0},t.props,{"model-value":k(i.value,t.prop),"onUpdate:modelValue":c=>a(i.value,t.prop,c)}),null,16,["model-value","onUpdate:modelValue"]))])]),_:2},1032,["label","prop"]))),128)),e.createVNode(n,null,{default:e.withCtx(()=>[e.renderSlot(s.$slots,"formSearchBtn")]),_:3})],64)):(e.openBlock(),e.createBlock(w,{key:1,gutter:16},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,t=>(e.openBlock(),e.createBlock(y,{key:t.prop,span:t.span||24},{default:e.withCtx(()=>[e.createVNode(n,{label:t.label,prop:t.prop},{default:e.withCtx(()=>[e.renderSlot(s.$slots,t.prop,{},()=>[t.type==="radio"||t.type==="checkbox"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.type==="radio"?(e.openBlock(),e.createBlock(o,{key:0,modelValue:i.value[t.prop],"onUpdate:modelValue":c=>i.value[t.prop]=c},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data,c=>(e.openBlock(),e.createBlock(d,{value:c.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.label),1)]),_:2},1032,["value"]))),256))]),_:2},1032,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0),t.type==="checkbox"?(e.openBlock(),e.createBlock(u,{key:1,modelValue:i.value[t.prop],"onUpdate:modelValue":c=>i.value[t.prop]=c},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data,c=>(e.openBlock(),e.createBlock(l,{label:c.label,value:c.value},null,8,["label","value"]))),256))]),_:2},1032,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(p[t.type]),e.mergeProps({key:1,ref_for:!0},t.props,{modelValue:i.value[t.prop],"onUpdate:modelValue":c=>i.value[t.prop]=c}),null,16,["modelValue","onUpdate:modelValue"]))])]),_:2},1032,["label","prop"])]),_:2},1032,["span"]))),128))]),_:3}))]),_:3},16,["class","model"])}}}),L={key:0},I={name:"WtskTable"},j=Object.assign(I,{name:"WtskTable",inheritAttrs:!1},{props:{tableData:{type:Array,default:()=>[]},tableHeight:{type:String,default:"550px"},tableColumns:{type:Array,default:()=>[]},tableHasPage:{type:Boolean,default:!0},tableTotal:{type:Number,default:0},tablePageNum:{type:Number,default:1},tablePageSize:{type:Number,default:10},tablePageProp:{type:Object,default:()=>{}}},emits:["tablePageChange"],setup(r,{expose:m,emit:f}){const h=r,i=e.ref(),p=e.ref({pageNum:h.tablePageNum,pageSize:h.tablePageSize});e.watch([()=>h.tablePageNum,()=>h.tablePageSize],([s,v])=>{p.value.pageNum=s,p.value.pageSize=v},{immediate:!0});const k=f;function a(s){p.value.pageNum=s,k("tablePageChange",{...p.value})}function g(s){p.value.pageSize=s,k("tablePageChange",{...p.value})}return m({wtskTableRef:i}),(s,v)=>{const d=e.resolveComponent("el-table-column"),o=e.resolveComponent("el-table"),l=e.resolveComponent("el-pagination");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(o,e.mergeProps({ref_key:"wtskTableRef",ref:i,class:"wtsk-table"},{"row-key":"id","default-expand-all":!0,...s.$attrs},{data:r.tableData,height:r.tableHasPage?r.tableHeight:"auto",stripe:""}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.tableColumns,u=>(e.openBlock(),e.createBlock(d,e.mergeProps({key:u.prop},{ref_for:!0},{align:"center","reserve-selection":!0,"show-overflow-tooltip":!0,...u}),e.createSlots({_:2},[u.slot?{name:"default",fn:e.withCtx(n=>[e.renderSlot(s.$slots,u.slot,e.mergeProps({ref_for:!0},n))]),key:"0"}:void 0,u.type==="operate"?{name:"default",fn:e.withCtx(n=>[e.renderSlot(s.$slots,"tableBtn",e.mergeProps({ref_for:!0},n))]),key:"1"}:void 0]),1040))),128))]),_:3},16,["data","height"]),r.tableHasPage?(e.openBlock(),e.createElementBlock("div",L,[e.createVNode(l,e.mergeProps({class:"wtsk-pagination"},{layout:"total, prev, pager, next, sizes","page-sizes":[5,10,20,50,100],background:!0,...r.tablePageProp},{total:r.tableTotal,"current-page":p.value.pageNum,"page-size":p.value.pageSize,onSizeChange:g,onCurrentChange:a}),null,16,["total","current-page","page-size"])])):e.createCommentVNode("",!0)],64)}}}),q=[{name:"WtskBtn",component:N},{name:"WtskTree",component:R},{name:"WtskForm",component:D},{name:"WtskTable",component:j}],G={install(r){q.forEach(({name:m,component:f})=>{r.component(m,f)})}};module.exports=G;
|
|
1
|
+
"use strict";const e=require("vue"),V=require("element-plus"),x=Object.assign({name:"WtskBtn",inheritAttrs:!1},{__name:"WtskBtn",setup(r){const m=e.useAttrs(),f=e.ref(!1);function h(p,k){const a={};for(const g in p)g!==k&&(a[g]=p[g]);return a}async function i(){var p;f.value=!0;try{await((p=m.onClick)==null?void 0:p.call(m))}finally{f.value=!1}}return(p,k)=>{const a=e.resolveComponent("el-button");return e.openBlock(),e.createBlock(a,e.mergeProps(h(p.$attrs,"onClick"),{loading:f.value,onClick:i}),{default:e.withCtx(()=>[e.renderSlot(p.$slots,"default")]),_:3},16,["loading"])}}});/*! Element Plus Icons Vue v2.3.2 */var N=e.defineComponent({name:"Delete",__name:"delete",setup(r){return(m,f)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32"})]))}}),E=N,S=e.defineComponent({name:"Edit",__name:"edit",setup(r){return(m,f)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M832 512a32 32 0 1 1 64 0v352a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h352a32 32 0 0 1 0 64H192v640h640z"}),e.createElementVNode("path",{fill:"currentColor",d:"m469.952 554.24 52.8-7.552L847.104 222.4a32 32 0 1 0-45.248-45.248L477.44 501.44l-7.552 52.8zm422.4-422.4a96 96 0 0 1 0 135.808l-331.84 331.84a32 32 0 0 1-18.112 9.088L436.8 623.68a32 32 0 0 1-36.224-36.224l15.104-105.6a32 32 0 0 1 9.024-18.112l331.904-331.84a96 96 0 0 1 135.744 0z"})]))}}),b=S,P=e.defineComponent({name:"Plus",__name:"plus",setup(r){return(m,f)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64z"})]))}}),_=P;const T={class:"wtsk-tree-box"},F={key:0,class:"wtsk-tree-box-title"},z={key:1,class:"wtsk-tree-box-filter wtsk-form"},H={style:{display:"flex","align-items":"center"},class:"wtsk-form"},$={class:"wtsk-tree-box-tree-custom"},M={style:{display:"flex","align-items":"center"},class:"wtsk-form"},O={style:{display:"flex","align-items":"center"},class:"wtsk-form"},U=Object.assign({name:"WtskTree",inheritAttrs:!1},{__name:"WtskTree",props:{treeTitle:{type:String,default:""},treeHasFilter:{type:Boolean,default:!1},treeFilterType:{type:String,default:"default"},treeHasOperate:{type:Boolean,default:!1},treeCustomizeOperate:{type:Boolean,default:!1},treeAddParentText:{type:String,default:"新增一级"}},emits:["treeOperate"],setup(r,{expose:m,emit:f}){const h=e.useAttrs(),i=r,p=e.ref();let k=e.ref(""),a=e.ref("");const g=f;e.watch(k,o=>{var l;(l=p.value)==null||l.filter(o)});function s(o,l,u){var y;if(!o)return!0;const n=l.label?l.label:(y=h.props)==null?void 0:y.label;if(i.treeFilterType==="default")return l[n].includes(o);{let w=[];v(u,w,o,n);let B=!1;return w.forEach(t=>{B=B||t}),B}}function v(o,l,u,n){let y=o.data&&o.data[n]&&o.data[n].includes(u);y&&l.push(y),!y&&o.level!==1&&o.parent&&v(o.parent,l,u,n)}function d(o,l,u){i.treeCustomizeOperate||o==="delete"?g("treeOperate",o,l,u):a.value.trim()!==""?(document.documentElement.click(),g("treeOperate",o,l,u,a.value)):V.ElMessage.error("名称不能为空!")}return m({wtskTreeRef:p}),(o,l)=>{const u=e.resolveComponent("el-input"),n=e.resolveComponent("el-button"),y=e.resolveComponent("el-popover"),w=e.resolveComponent("el-popconfirm"),B=e.resolveComponent("el-tree");return e.openBlock(),e.createElementBlock("div",T,[r.treeTitle!==""?(e.openBlock(),e.createElementBlock("div",F,e.toDisplayString(r.treeTitle),1)):e.createCommentVNode("",!0),r.treeHasFilter||r.treeHasOperate?(e.openBlock(),e.createElementBlock("div",z,[r.treeHasFilter?(e.openBlock(),e.createBlock(u,{key:0,modelValue:e.unref(k),"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(k)?k.value=t:k=t),placeholder:"输入名称进行筛选……",clearable:""},null,8,["modelValue"])):e.createCommentVNode("",!0),r.treeCustomizeOperate?(e.openBlock(),e.createBlock(n,{key:2,type:"primary",onClick:l[4]||(l[4]=t=>d("addParent"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.treeAddParentText),1)]),_:1})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[r.treeHasOperate?(e.openBlock(),e.createBlock(y,{key:0,placement:"bottom",width:280,trigger:"click"},{reference:e.withCtx(()=>[e.createVNode(n,{type:"primary",onClick:l[1]||(l[1]=t=>e.isRef(a)?a.value="":a="")},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.treeAddParentText),1)]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",H,[e.createVNode(u,{modelValue:e.unref(a),"onUpdate:modelValue":l[2]||(l[2]=t=>e.isRef(a)?a.value=t:a=t),placeholder:"请输入名称",clearable:""},null,8,["modelValue"]),e.createVNode(n,{type:"primary",style:{"margin-left":"10px"},onClick:l[3]||(l[3]=e.withModifiers(t=>d("addParent"),["stop"]))},{default:e.withCtx(()=>[...l[9]||(l[9]=[e.createTextVNode("新增",-1)])]),_:1})])]),_:1})):e.createCommentVNode("",!0)],64))])):e.createCommentVNode("",!0),e.createVNode(B,e.mergeProps({ref_key:"wtskTreeRef",ref:p,class:"wtsk-tree wtsk-tree-box-tree"},{"node-key":"id","highlight-current":!0,"default-expand-all":!0,"expand-on-click-node":!1,"check-on-click-leaf":!1,...o.$attrs},{"filter-node-method":s}),e.createSlots({_:2},[r.treeHasOperate?{name:"default",fn:e.withCtx(({node:t,data:c})=>[e.createElementVNode("div",$,[e.createElementVNode("div",null,e.toDisplayString(t.label),1),e.createElementVNode("div",null,[r.treeCustomizeOperate?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(n,{type:"success",link:"",icon:e.unref(_),onClick:e.withModifiers(C=>d("add",c,t),["stop"])},null,8,["icon","onClick"]),e.createVNode(n,{type:"primary",link:"",icon:e.unref(b),onClick:e.withModifiers(C=>d("edit",c,t),["stop"])},null,8,["icon","onClick"])],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(y,{placement:"bottom",width:280,trigger:"click"},{reference:e.withCtx(()=>[e.createVNode(n,{type:"success",link:"",icon:e.unref(_),onClick:l[5]||(l[5]=e.withModifiers(C=>e.isRef(a)?a.value="":a="",["stop"]))},null,8,["icon"])]),default:e.withCtx(()=>[e.createElementVNode("div",M,[e.createVNode(u,{modelValue:e.unref(a),"onUpdate:modelValue":l[6]||(l[6]=C=>e.isRef(a)?a.value=C:a=C),placeholder:"请输入名称",clearable:""},null,8,["modelValue"]),e.createVNode(n,{type:"primary",style:{"margin-left":"10px"},onClick:e.withModifiers(C=>d("add",c,t),["stop"])},{default:e.withCtx(()=>[...l[10]||(l[10]=[e.createTextVNode("新增",-1)])]),_:1},8,["onClick"])])]),_:2},1024),e.createVNode(y,{placement:"bottom",width:280,trigger:"click"},{reference:e.withCtx(()=>[e.createVNode(n,{type:"primary",link:"",icon:e.unref(b),onClick:e.withModifiers(C=>e.isRef(a)?a.value=t.label:a=t.label,["stop"])},null,8,["icon","onClick"])]),default:e.withCtx(()=>[e.createElementVNode("div",O,[e.createVNode(u,{modelValue:e.unref(a),"onUpdate:modelValue":l[7]||(l[7]=C=>e.isRef(a)?a.value=C:a=C),placeholder:"请输入名称",clearable:""},null,8,["modelValue"]),e.createVNode(n,{type:"primary",style:{"margin-left":"10px"},onClick:e.withModifiers(C=>d("edit",c,t),["stop"])},{default:e.withCtx(()=>[...l[11]||(l[11]=[e.createTextVNode("修改",-1)])]),_:1},8,["onClick"])])]),_:2},1024)],64)),e.createVNode(w,{title:"确定删除这条数据吗?","hide-icon":"",width:"170",onConfirm:C=>d("delete",c,t)},{reference:e.withCtx(()=>[e.createVNode(n,{type:"danger",link:"",icon:e.unref(E),onClick:l[8]||(l[8]=e.withModifiers(()=>{},["stop"]))},null,8,["icon"])]),_:1},8,["onConfirm"])])])]),key:"0"}:void 0]),1040)])}}}),A=Object.assign({name:"WtskForm",inheritAttrs:!1},{__name:"WtskForm",props:e.mergeModels({formIsSearch:{type:Boolean,default:!1},formItems:{type:Array,default:()=>[]}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(r,{expose:m}){const f=r,h=e.computed(()=>f.formItems.filter(s=>!s.hidden)),i=e.useModel(r,"modelValue"),p={input:V.ElInput,number:V.ElInputNumber,select:V.ElSelect,date:V.ElDatePicker,switch:V.ElSwitch,treeSelect:V.ElTreeSelect};function k(s,v){if(!s||typeof s!="object"||!v)return;const d=v.split(".");let o=s;for(const l of d){if(o===null||!(l in o))return;o=o[l]}return o}function a(s,v,d){if(!s||typeof s!="object"||!v)return;const o=v.split(".");let l=s;for(let u=0;u<o.length-1;u++){const n=o[u];if((l[n]===null||typeof l[n]!="object"&&l[n]!==void 0)&&(l[n]={}),!(n in l))return;l=l[n]}l[o[o.length-1]]=d}const g=e.ref();return m({wtskFormRef:g}),(s,v)=>{const d=e.resolveComponent("el-radio"),o=e.resolveComponent("el-radio-group"),l=e.resolveComponent("el-checkbox"),u=e.resolveComponent("el-checkbox-group"),n=e.resolveComponent("el-form-item"),y=e.resolveComponent("el-col"),w=e.resolveComponent("el-row"),B=e.resolveComponent("el-form");return e.openBlock(),e.createBlock(B,e.mergeProps({ref_key:"wtskFormRef",ref:g,class:["wtsk-form",r.formIsSearch?"wtsk-form-search":""]},{"label-width":r.formIsSearch?"auto":"100px",...s.$attrs},{model:i.value}),{default:e.withCtx(()=>[r.formIsSearch?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,t=>(e.openBlock(),e.createBlock(n,{key:t.prop,label:t.label,prop:t.prop},{default:e.withCtx(()=>[e.renderSlot(s.$slots,t.prop,{},()=>[t.type==="radio"||t.type==="checkbox"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.type==="radio"?(e.openBlock(),e.createBlock(o,{key:0,modelValue:i.value[t.prop],"onUpdate:modelValue":c=>i.value[t.prop]=c},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data,c=>(e.openBlock(),e.createBlock(d,{value:c.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.label),1)]),_:2},1032,["value"]))),256))]),_:2},1032,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0),t.type==="checkbox"?(e.openBlock(),e.createBlock(u,{key:1,modelValue:i.value[t.prop],"onUpdate:modelValue":c=>i.value[t.prop]=c},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data,c=>(e.openBlock(),e.createBlock(l,{label:c.label,value:c.value},null,8,["label","value"]))),256))]),_:2},1032,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(p[t.type]),e.mergeProps({key:1,ref_for:!0},t.props,{"model-value":k(i.value,t.prop),"onUpdate:modelValue":c=>a(i.value,t.prop,c)}),null,16,["model-value","onUpdate:modelValue"]))])]),_:2},1032,["label","prop"]))),128)),e.createVNode(n,null,{default:e.withCtx(()=>[e.renderSlot(s.$slots,"formSearchBtn")]),_:3})],64)):(e.openBlock(),e.createBlock(w,{key:1,gutter:16},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,t=>(e.openBlock(),e.createBlock(y,{key:t.prop,span:t.span||24},{default:e.withCtx(()=>[e.createVNode(n,{label:t.label,prop:t.prop},{default:e.withCtx(()=>[e.renderSlot(s.$slots,t.prop,{},()=>[t.type==="radio"||t.type==="checkbox"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.type==="radio"?(e.openBlock(),e.createBlock(o,{key:0,modelValue:i.value[t.prop],"onUpdate:modelValue":c=>i.value[t.prop]=c},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data,c=>(e.openBlock(),e.createBlock(d,{value:c.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.label),1)]),_:2},1032,["value"]))),256))]),_:2},1032,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0),t.type==="checkbox"?(e.openBlock(),e.createBlock(u,{key:1,modelValue:i.value[t.prop],"onUpdate:modelValue":c=>i.value[t.prop]=c},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data,c=>(e.openBlock(),e.createBlock(l,{label:c.label,value:c.value},null,8,["label","value"]))),256))]),_:2},1032,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(p[t.type]),e.mergeProps({key:1,ref_for:!0},t.props,{modelValue:i.value[t.prop],"onUpdate:modelValue":c=>i.value[t.prop]=c}),null,16,["modelValue","onUpdate:modelValue"]))])]),_:2},1032,["label","prop"])]),_:2},1032,["span"]))),128))]),_:3}))]),_:3},16,["class","model"])}}}),R={key:0},W=Object.assign({name:"WtskTable",inheritAttrs:!1},{__name:"WtskTable",props:{tableData:{type:Array,default:()=>[]},tableHeight:{type:String,default:"550px"},tableColumns:{type:Array,default:()=>[]},tableHasPage:{type:Boolean,default:!0},tableTotal:{type:Number,default:0},tablePageNum:{type:Number,default:1},tablePageSize:{type:Number,default:10},tablePageProp:{type:Object,default:()=>{}}},emits:["tablePageChange"],setup(r,{expose:m,emit:f}){const h=r,i=e.ref(),p=e.ref({pageNum:h.tablePageNum,pageSize:h.tablePageSize});e.watch([()=>h.tablePageNum,()=>h.tablePageSize],([s,v])=>{p.value.pageNum=s,p.value.pageSize=v},{immediate:!0});const k=f;function a(s){p.value.pageNum=s,k("tablePageChange",{...p.value})}function g(s){p.value.pageSize=s,k("tablePageChange",{...p.value})}return m({wtskTableRef:i}),(s,v)=>{const d=e.resolveComponent("el-table-column"),o=e.resolveComponent("el-table"),l=e.resolveComponent("el-pagination");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(o,e.mergeProps({ref_key:"wtskTableRef",ref:i,class:"wtsk-table"},{"row-key":"id","default-expand-all":!0,...s.$attrs},{data:r.tableData,height:r.tableHasPage?r.tableHeight:"auto",stripe:""}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.tableColumns,u=>(e.openBlock(),e.createBlock(d,e.mergeProps({key:u.prop},{ref_for:!0},{align:"center","reserve-selection":!0,"show-overflow-tooltip":!0,...u}),e.createSlots({_:2},[u.slot?{name:"default",fn:e.withCtx(n=>[e.renderSlot(s.$slots,u.slot,e.mergeProps({ref_for:!0},n))]),key:"0"}:void 0,u.type==="operate"?{name:"default",fn:e.withCtx(n=>[e.renderSlot(s.$slots,"tableBtn",e.mergeProps({ref_for:!0},n))]),key:"1"}:void 0]),1040))),128))]),_:3},16,["data","height"]),r.tableHasPage?(e.openBlock(),e.createElementBlock("div",R,[e.createVNode(l,e.mergeProps({class:"wtsk-pagination"},{layout:"total, prev, pager, next, sizes","page-sizes":[5,10,20,50,100],background:!0,...r.tablePageProp},{total:r.tableTotal,"current-page":p.value.pageNum,"page-size":p.value.pageSize,onSizeChange:g,onCurrentChange:a}),null,16,["total","current-page","page-size"])])):e.createCommentVNode("",!0)],64)}}}),D=[{name:"WtskBtn",component:x},{name:"WtskTree",component:U},{name:"WtskForm",component:A},{name:"WtskTable",component:W}],L={install(r){D.forEach(({name:m,component:f})=>{r.component(m,f)})}};module.exports=L;
|
package/dist/wtsk-comps.es.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { useAttrs as L, ref as E, resolveComponent as y, openBlock as l, createBlock as k, mergeProps as z, withCtx as s, renderSlot as A, defineComponent as M, createElementBlock as f, createElementVNode as S, watch as j, toDisplayString as W, createCommentVNode as T, isRef as O, unref as N, Fragment as _, createVNode as m, withModifiers as
|
|
1
|
+
import { useAttrs as L, ref as E, resolveComponent as y, openBlock as l, createBlock as k, mergeProps as z, withCtx as s, renderSlot as A, defineComponent as M, createElementBlock as f, createElementVNode as S, watch as j, toDisplayString as W, createCommentVNode as T, isRef as O, unref as N, Fragment as _, createVNode as m, withModifiers as H, createTextVNode as U, createSlots as q, computed as G, useModel as J, renderList as B, resolveDynamicComponent as I, mergeModels as Q } from "vue";
|
|
2
2
|
import { ElMessage as X, ElTreeSelect as Y, ElSwitch as Z, ElDatePicker as K, ElSelect as ee, ElInputNumber as te, ElInput as le } from "element-plus";
|
|
3
|
-
const ae = {
|
|
4
|
-
name: "WtskBtn"
|
|
5
|
-
}, oe = /* @__PURE__ */ Object.assign(ae, {
|
|
3
|
+
const ae = /* @__PURE__ */ Object.assign({
|
|
6
4
|
name: "WtskBtn",
|
|
7
5
|
inheritAttrs: !1
|
|
8
6
|
}, {
|
|
7
|
+
__name: "WtskBtn",
|
|
9
8
|
setup(o) {
|
|
10
9
|
const v = L(), b = E(!1);
|
|
11
10
|
function P(d, h) {
|
|
@@ -38,7 +37,7 @@ const ae = {
|
|
|
38
37
|
}
|
|
39
38
|
});
|
|
40
39
|
/*! Element Plus Icons Vue v2.3.2 */
|
|
41
|
-
var
|
|
40
|
+
var oe = /* @__PURE__ */ M({
|
|
42
41
|
name: "Delete",
|
|
43
42
|
__name: "delete",
|
|
44
43
|
setup(o) {
|
|
@@ -52,7 +51,7 @@ var ne = /* @__PURE__ */ M({
|
|
|
52
51
|
})
|
|
53
52
|
]));
|
|
54
53
|
}
|
|
55
|
-
}),
|
|
54
|
+
}), ne = oe, re = /* @__PURE__ */ M({
|
|
56
55
|
name: "Edit",
|
|
57
56
|
__name: "edit",
|
|
58
57
|
setup(o) {
|
|
@@ -70,7 +69,7 @@ var ne = /* @__PURE__ */ M({
|
|
|
70
69
|
})
|
|
71
70
|
]));
|
|
72
71
|
}
|
|
73
|
-
}), R =
|
|
72
|
+
}), R = re, ue = /* @__PURE__ */ M({
|
|
74
73
|
name: "Plus",
|
|
75
74
|
__name: "plus",
|
|
76
75
|
setup(o) {
|
|
@@ -84,28 +83,27 @@ var ne = /* @__PURE__ */ M({
|
|
|
84
83
|
})
|
|
85
84
|
]));
|
|
86
85
|
}
|
|
87
|
-
}), D =
|
|
88
|
-
const
|
|
86
|
+
}), D = ue;
|
|
87
|
+
const se = { class: "wtsk-tree-box" }, pe = {
|
|
89
88
|
key: 0,
|
|
90
89
|
class: "wtsk-tree-box-title"
|
|
91
|
-
},
|
|
90
|
+
}, ie = {
|
|
92
91
|
key: 1,
|
|
93
92
|
class: "wtsk-tree-box-filter wtsk-form"
|
|
94
|
-
},
|
|
93
|
+
}, de = {
|
|
95
94
|
style: { display: "flex", "align-items": "center" },
|
|
96
95
|
class: "wtsk-form"
|
|
97
|
-
},
|
|
96
|
+
}, ce = { class: "wtsk-tree-box-tree-custom" }, fe = {
|
|
98
97
|
style: { display: "flex", "align-items": "center" },
|
|
99
98
|
class: "wtsk-form"
|
|
100
|
-
},
|
|
99
|
+
}, me = {
|
|
101
100
|
style: { display: "flex", "align-items": "center" },
|
|
102
101
|
class: "wtsk-form"
|
|
103
|
-
},
|
|
104
|
-
name: "WtskTree"
|
|
105
|
-
}, ge = /* @__PURE__ */ Object.assign(ye, {
|
|
102
|
+
}, ke = /* @__PURE__ */ Object.assign({
|
|
106
103
|
name: "WtskTree",
|
|
107
104
|
inheritAttrs: !1
|
|
108
105
|
}, {
|
|
106
|
+
__name: "WtskTree",
|
|
109
107
|
props: {
|
|
110
108
|
// 树标题
|
|
111
109
|
treeTitle: {
|
|
@@ -155,10 +153,10 @@ const pe = { class: "wtsk-tree-box" }, ie = {
|
|
|
155
153
|
{
|
|
156
154
|
let F = [];
|
|
157
155
|
V(i, F, a, r);
|
|
158
|
-
let
|
|
156
|
+
let $ = !1;
|
|
159
157
|
return F.forEach((e) => {
|
|
160
|
-
|
|
161
|
-
}),
|
|
158
|
+
$ = $ || e;
|
|
159
|
+
}), $;
|
|
162
160
|
}
|
|
163
161
|
}
|
|
164
162
|
function V(a, t, i, r) {
|
|
@@ -169,10 +167,10 @@ const pe = { class: "wtsk-tree-box" }, ie = {
|
|
|
169
167
|
c.treeCustomizeOperate || a === "delete" ? w("treeOperate", a, t, i) : n.value.trim() !== "" ? (document.documentElement.click(), w("treeOperate", a, t, i, n.value)) : X.error("名称不能为空!");
|
|
170
168
|
}
|
|
171
169
|
return v({ wtskTreeRef: d }), (a, t) => {
|
|
172
|
-
const i = y("el-input"), r = y("el-button"), C = y("el-popover"), F = y("el-popconfirm"),
|
|
173
|
-
return l(), f("div",
|
|
174
|
-
o.treeTitle !== "" ? (l(), f("div",
|
|
175
|
-
o.treeHasFilter || o.treeHasOperate ? (l(), f("div",
|
|
170
|
+
const i = y("el-input"), r = y("el-button"), C = y("el-popover"), F = y("el-popconfirm"), $ = y("el-tree");
|
|
171
|
+
return l(), f("div", se, [
|
|
172
|
+
o.treeTitle !== "" ? (l(), f("div", pe, W(o.treeTitle), 1)) : T("", !0),
|
|
173
|
+
o.treeHasFilter || o.treeHasOperate ? (l(), f("div", ie, [
|
|
176
174
|
o.treeHasFilter ? (l(), k(i, {
|
|
177
175
|
key: 0,
|
|
178
176
|
modelValue: N(h),
|
|
@@ -208,7 +206,7 @@ const pe = { class: "wtsk-tree-box" }, ie = {
|
|
|
208
206
|
})
|
|
209
207
|
]),
|
|
210
208
|
default: s(() => [
|
|
211
|
-
S("div",
|
|
209
|
+
S("div", de, [
|
|
212
210
|
m(i, {
|
|
213
211
|
modelValue: N(n),
|
|
214
212
|
"onUpdate:modelValue": t[2] || (t[2] = (e) => O(n) ? n.value = e : n = e),
|
|
@@ -218,7 +216,7 @@ const pe = { class: "wtsk-tree-box" }, ie = {
|
|
|
218
216
|
m(r, {
|
|
219
217
|
type: "primary",
|
|
220
218
|
style: { "margin-left": "10px" },
|
|
221
|
-
onClick: t[3] || (t[3] =
|
|
219
|
+
onClick: t[3] || (t[3] = H((e) => g("addParent"), ["stop"]))
|
|
222
220
|
}, {
|
|
223
221
|
default: s(() => [...t[9] || (t[9] = [
|
|
224
222
|
U("新增", -1)
|
|
@@ -231,7 +229,7 @@ const pe = { class: "wtsk-tree-box" }, ie = {
|
|
|
231
229
|
})) : T("", !0)
|
|
232
230
|
], 64))
|
|
233
231
|
])) : T("", !0),
|
|
234
|
-
m(
|
|
232
|
+
m($, z({
|
|
235
233
|
ref_key: "wtskTreeRef",
|
|
236
234
|
ref: d,
|
|
237
235
|
class: "wtsk-tree wtsk-tree-box-tree"
|
|
@@ -246,7 +244,7 @@ const pe = { class: "wtsk-tree-box" }, ie = {
|
|
|
246
244
|
o.treeHasOperate ? {
|
|
247
245
|
name: "default",
|
|
248
246
|
fn: s(({ node: e, data: u }) => [
|
|
249
|
-
S("div",
|
|
247
|
+
S("div", ce, [
|
|
250
248
|
S("div", null, W(e.label), 1),
|
|
251
249
|
S("div", null, [
|
|
252
250
|
o.treeCustomizeOperate ? (l(), f(_, { key: 0 }, [
|
|
@@ -254,13 +252,13 @@ const pe = { class: "wtsk-tree-box" }, ie = {
|
|
|
254
252
|
type: "success",
|
|
255
253
|
link: "",
|
|
256
254
|
icon: N(D),
|
|
257
|
-
onClick:
|
|
255
|
+
onClick: H((x) => g("add", u, e), ["stop"])
|
|
258
256
|
}, null, 8, ["icon", "onClick"]),
|
|
259
257
|
m(r, {
|
|
260
258
|
type: "primary",
|
|
261
259
|
link: "",
|
|
262
260
|
icon: N(R),
|
|
263
|
-
onClick:
|
|
261
|
+
onClick: H((x) => g("edit", u, e), ["stop"])
|
|
264
262
|
}, null, 8, ["icon", "onClick"])
|
|
265
263
|
], 64)) : (l(), f(_, { key: 1 }, [
|
|
266
264
|
m(C, {
|
|
@@ -273,11 +271,11 @@ const pe = { class: "wtsk-tree-box" }, ie = {
|
|
|
273
271
|
type: "success",
|
|
274
272
|
link: "",
|
|
275
273
|
icon: N(D),
|
|
276
|
-
onClick: t[5] || (t[5] =
|
|
274
|
+
onClick: t[5] || (t[5] = H((x) => O(n) ? n.value = "" : n = "", ["stop"]))
|
|
277
275
|
}, null, 8, ["icon"])
|
|
278
276
|
]),
|
|
279
277
|
default: s(() => [
|
|
280
|
-
S("div",
|
|
278
|
+
S("div", fe, [
|
|
281
279
|
m(i, {
|
|
282
280
|
modelValue: N(n),
|
|
283
281
|
"onUpdate:modelValue": t[6] || (t[6] = (x) => O(n) ? n.value = x : n = x),
|
|
@@ -287,7 +285,7 @@ const pe = { class: "wtsk-tree-box" }, ie = {
|
|
|
287
285
|
m(r, {
|
|
288
286
|
type: "primary",
|
|
289
287
|
style: { "margin-left": "10px" },
|
|
290
|
-
onClick:
|
|
288
|
+
onClick: H((x) => g("add", u, e), ["stop"])
|
|
291
289
|
}, {
|
|
292
290
|
default: s(() => [...t[10] || (t[10] = [
|
|
293
291
|
U("新增", -1)
|
|
@@ -308,11 +306,11 @@ const pe = { class: "wtsk-tree-box" }, ie = {
|
|
|
308
306
|
type: "primary",
|
|
309
307
|
link: "",
|
|
310
308
|
icon: N(R),
|
|
311
|
-
onClick:
|
|
309
|
+
onClick: H((x) => O(n) ? n.value = e.label : n = e.label, ["stop"])
|
|
312
310
|
}, null, 8, ["icon", "onClick"])
|
|
313
311
|
]),
|
|
314
312
|
default: s(() => [
|
|
315
|
-
S("div",
|
|
313
|
+
S("div", me, [
|
|
316
314
|
m(i, {
|
|
317
315
|
modelValue: N(n),
|
|
318
316
|
"onUpdate:modelValue": t[7] || (t[7] = (x) => O(n) ? n.value = x : n = x),
|
|
@@ -322,7 +320,7 @@ const pe = { class: "wtsk-tree-box" }, ie = {
|
|
|
322
320
|
m(r, {
|
|
323
321
|
type: "primary",
|
|
324
322
|
style: { "margin-left": "10px" },
|
|
325
|
-
onClick:
|
|
323
|
+
onClick: H((x) => g("edit", u, e), ["stop"])
|
|
326
324
|
}, {
|
|
327
325
|
default: s(() => [...t[11] || (t[11] = [
|
|
328
326
|
U("修改", -1)
|
|
@@ -344,8 +342,8 @@ const pe = { class: "wtsk-tree-box" }, ie = {
|
|
|
344
342
|
m(r, {
|
|
345
343
|
type: "danger",
|
|
346
344
|
link: "",
|
|
347
|
-
icon: N(
|
|
348
|
-
onClick: t[8] || (t[8] =
|
|
345
|
+
icon: N(ne),
|
|
346
|
+
onClick: t[8] || (t[8] = H(() => {
|
|
349
347
|
}, ["stop"]))
|
|
350
348
|
}, null, 8, ["icon"])
|
|
351
349
|
]),
|
|
@@ -360,12 +358,11 @@ const pe = { class: "wtsk-tree-box" }, ie = {
|
|
|
360
358
|
]);
|
|
361
359
|
};
|
|
362
360
|
}
|
|
363
|
-
}),
|
|
364
|
-
name: "WtskForm"
|
|
365
|
-
}, be = /* @__PURE__ */ Object.assign(ve, {
|
|
361
|
+
}), ye = /* @__PURE__ */ Object.assign({
|
|
366
362
|
name: "WtskForm",
|
|
367
363
|
inheritAttrs: !1
|
|
368
364
|
}, {
|
|
365
|
+
__name: "WtskForm",
|
|
369
366
|
props: /* @__PURE__ */ Q({
|
|
370
367
|
// 表单是否是搜索类型
|
|
371
368
|
formIsSearch: {
|
|
@@ -414,8 +411,8 @@ const pe = { class: "wtsk-tree-box" }, ie = {
|
|
|
414
411
|
}
|
|
415
412
|
const w = E();
|
|
416
413
|
return v({ wtskFormRef: w }), (p, V) => {
|
|
417
|
-
const g = y("el-radio"), a = y("el-radio-group"), t = y("el-checkbox"), i = y("el-checkbox-group"), r = y("el-form-item"), C = y("el-col"), F = y("el-row"),
|
|
418
|
-
return l(), k(
|
|
414
|
+
const g = y("el-radio"), a = y("el-radio-group"), t = y("el-checkbox"), i = y("el-checkbox-group"), r = y("el-form-item"), C = y("el-col"), F = y("el-row"), $ = y("el-form");
|
|
415
|
+
return l(), k($, z({
|
|
419
416
|
ref_key: "wtskFormRef",
|
|
420
417
|
ref: w,
|
|
421
418
|
class: ["wtsk-form", o.formIsSearch ? "wtsk-form-search" : ""]
|
|
@@ -546,12 +543,11 @@ const pe = { class: "wtsk-tree-box" }, ie = {
|
|
|
546
543
|
}, 16, ["class", "model"]);
|
|
547
544
|
};
|
|
548
545
|
}
|
|
549
|
-
}),
|
|
550
|
-
name: "WtskTable"
|
|
551
|
-
}, we = /* @__PURE__ */ Object.assign(he, {
|
|
546
|
+
}), ge = { key: 0 }, ve = /* @__PURE__ */ Object.assign({
|
|
552
547
|
name: "WtskTable",
|
|
553
548
|
inheritAttrs: !1
|
|
554
549
|
}, {
|
|
550
|
+
__name: "WtskTable",
|
|
555
551
|
props: {
|
|
556
552
|
// 表格数据
|
|
557
553
|
tableData: {
|
|
@@ -650,7 +646,7 @@ const pe = { class: "wtsk-tree-box" }, ie = {
|
|
|
650
646
|
]),
|
|
651
647
|
_: 3
|
|
652
648
|
}, 16, ["data", "height"]),
|
|
653
|
-
o.tableHasPage ? (l(), f("div",
|
|
649
|
+
o.tableHasPage ? (l(), f("div", ge, [
|
|
654
650
|
m(t, z({ class: "wtsk-pagination" }, {
|
|
655
651
|
layout: "total, prev, pager, next, sizes",
|
|
656
652
|
"page-sizes": [5, 10, 20, 50, 100],
|
|
@@ -667,18 +663,18 @@ const pe = { class: "wtsk-tree-box" }, ie = {
|
|
|
667
663
|
], 64);
|
|
668
664
|
};
|
|
669
665
|
}
|
|
670
|
-
}),
|
|
671
|
-
{ name: "WtskBtn", component:
|
|
672
|
-
{ name: "WtskTree", component:
|
|
673
|
-
{ name: "WtskForm", component:
|
|
674
|
-
{ name: "WtskTable", component:
|
|
675
|
-
],
|
|
666
|
+
}), be = [
|
|
667
|
+
{ name: "WtskBtn", component: ae },
|
|
668
|
+
{ name: "WtskTree", component: ke },
|
|
669
|
+
{ name: "WtskForm", component: ye },
|
|
670
|
+
{ name: "WtskTable", component: ve }
|
|
671
|
+
], we = {
|
|
676
672
|
install(o) {
|
|
677
|
-
|
|
673
|
+
be.forEach(({ name: v, component: b }) => {
|
|
678
674
|
o.component(v, b);
|
|
679
675
|
});
|
|
680
676
|
}
|
|
681
677
|
};
|
|
682
678
|
export {
|
|
683
|
-
|
|
679
|
+
we as default
|
|
684
680
|
};
|
package/dist/wtsk-comps.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,B){typeof exports=="object"&&typeof module<"u"?module.exports=B(require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["vue","element-plus"],B):(e=typeof globalThis<"u"?globalThis:e||self,e.WtskComps=B(e.Vue,e.ElementPlus))})(this,function(e,B){"use strict";const N=Object.assign({name:"WtskBtn"},{name:"WtskBtn",inheritAttrs:!1},{setup(a){const f=e.useAttrs(),k=e.ref(!1);function V(i,g){const r={};for(const y in i)y!==g&&(r[y]=i[y]);return r}async function d(){var i;k.value=!0;try{await((i=f.onClick)==null?void 0:i.call(f))}finally{k.value=!1}}return(i,g)=>{const r=e.resolveComponent("el-button");return e.openBlock(),e.createBlock(r,e.mergeProps(V(i.$attrs,"onClick"),{loading:k.value,onClick:d}),{default:e.withCtx(()=>[e.renderSlot(i.$slots,"default")]),_:3},16,["loading"])}}});/*! Element Plus Icons Vue v2.3.2 */var E=e.defineComponent({name:"Delete",__name:"delete",setup(a){return(f,k)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32"})]))}}),S=E,T=e.defineComponent({name:"Edit",__name:"edit",setup(a){return(f,k)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M832 512a32 32 0 1 1 64 0v352a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h352a32 32 0 0 1 0 64H192v640h640z"}),e.createElementVNode("path",{fill:"currentColor",d:"m469.952 554.24 52.8-7.552L847.104 222.4a32 32 0 1 0-45.248-45.248L477.44 501.44l-7.552 52.8zm422.4-422.4a96 96 0 0 1 0 135.808l-331.84 331.84a32 32 0 0 1-18.112 9.088L436.8 623.68a32 32 0 0 1-36.224-36.224l15.104-105.6a32 32 0 0 1 9.024-18.112l331.904-331.84a96 96 0 0 1 135.744 0z"})]))}}),u=T,P=e.defineComponent({name:"Plus",__name:"plus",setup(a){return(f,k)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64z"})]))}}),x=P;const F={class:"wtsk-tree-box"},$={key:0,class:"wtsk-tree-box-title"},z={key:1,class:"wtsk-tree-box-filter wtsk-form"},H={style:{display:"flex","align-items":"center"},class:"wtsk-form"},M={class:"wtsk-tree-box-tree-custom"},O={style:{display:"flex","align-items":"center"},class:"wtsk-form"},U={style:{display:"flex","align-items":"center"},class:"wtsk-form"},W=Object.assign({name:"WtskTree"},{name:"WtskTree",inheritAttrs:!1},{props:{treeTitle:{type:String,default:""},treeHasFilter:{type:Boolean,default:!1},treeFilterType:{type:String,default:"default"},treeHasOperate:{type:Boolean,default:!1},treeCustomizeOperate:{type:Boolean,default:!1},treeAddParentText:{type:String,default:"新增一级"}},emits:["treeOperate"],setup(a,{expose:f,emit:k}){const V=e.useAttrs(),d=a,i=e.ref();let g=e.ref(""),r=e.ref("");const y=k;e.watch(g,o=>{var l;(l=i.value)==null||l.filter(o)});function s(o,l,p){var h;if(!o)return!0;const n=l.label?l.label:(h=V.props)==null?void 0:h.label;if(d.treeFilterType==="default")return l[n].includes(o);{let b=[];_(p,b,o,n);let w=!1;return b.forEach(t=>{w=w||t}),w}}function _(o,l,p,n){let h=o.data&&o.data[n]&&o.data[n].includes(p);h&&l.push(h),!h&&o.level!==1&&o.parent&&_(o.parent,l,p,n)}function m(o,l,p){d.treeCustomizeOperate||o==="delete"?y("treeOperate",o,l,p):r.value.trim()!==""?(document.documentElement.click(),y("treeOperate",o,l,p,r.value)):B.ElMessage.error("名称不能为空!")}return f({wtskTreeRef:i}),(o,l)=>{const p=e.resolveComponent("el-input"),n=e.resolveComponent("el-button"),h=e.resolveComponent("el-popover"),b=e.resolveComponent("el-popconfirm"),w=e.resolveComponent("el-tree");return e.openBlock(),e.createElementBlock("div",F,[a.treeTitle!==""?(e.openBlock(),e.createElementBlock("div",$,e.toDisplayString(a.treeTitle),1)):e.createCommentVNode("",!0),a.treeHasFilter||a.treeHasOperate?(e.openBlock(),e.createElementBlock("div",z,[a.treeHasFilter?(e.openBlock(),e.createBlock(p,{key:0,modelValue:e.unref(g),"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(g)?g.value=t:g=t),placeholder:"输入名称进行筛选……",clearable:""},null,8,["modelValue"])):e.createCommentVNode("",!0),a.treeCustomizeOperate?(e.openBlock(),e.createBlock(n,{key:2,type:"primary",onClick:l[4]||(l[4]=t=>m("addParent"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.treeAddParentText),1)]),_:1})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[a.treeHasOperate?(e.openBlock(),e.createBlock(h,{key:0,placement:"bottom",width:280,trigger:"click"},{reference:e.withCtx(()=>[e.createVNode(n,{type:"primary",onClick:l[1]||(l[1]=t=>e.isRef(r)?r.value="":r="")},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.treeAddParentText),1)]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",H,[e.createVNode(p,{modelValue:e.unref(r),"onUpdate:modelValue":l[2]||(l[2]=t=>e.isRef(r)?r.value=t:r=t),placeholder:"请输入名称",clearable:""},null,8,["modelValue"]),e.createVNode(n,{type:"primary",style:{"margin-left":"10px"},onClick:l[3]||(l[3]=e.withModifiers(t=>m("addParent"),["stop"]))},{default:e.withCtx(()=>[...l[9]||(l[9]=[e.createTextVNode("新增",-1)])]),_:1})])]),_:1})):e.createCommentVNode("",!0)],64))])):e.createCommentVNode("",!0),e.createVNode(w,e.mergeProps({ref_key:"wtskTreeRef",ref:i,class:"wtsk-tree wtsk-tree-box-tree"},{"node-key":"id","highlight-current":!0,"default-expand-all":!0,"expand-on-click-node":!1,"check-on-click-leaf":!1,...o.$attrs},{"filter-node-method":s}),e.createSlots({_:2},[a.treeHasOperate?{name:"default",fn:e.withCtx(({node:t,data:c})=>[e.createElementVNode("div",M,[e.createElementVNode("div",null,e.toDisplayString(t.label),1),e.createElementVNode("div",null,[a.treeCustomizeOperate?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(n,{type:"success",link:"",icon:e.unref(x),onClick:e.withModifiers(C=>m("add",c,t),["stop"])},null,8,["icon","onClick"]),e.createVNode(n,{type:"primary",link:"",icon:e.unref(u),onClick:e.withModifiers(C=>m("edit",c,t),["stop"])},null,8,["icon","onClick"])],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(h,{placement:"bottom",width:280,trigger:"click"},{reference:e.withCtx(()=>[e.createVNode(n,{type:"success",link:"",icon:e.unref(x),onClick:l[5]||(l[5]=e.withModifiers(C=>e.isRef(r)?r.value="":r="",["stop"]))},null,8,["icon"])]),default:e.withCtx(()=>[e.createElementVNode("div",O,[e.createVNode(p,{modelValue:e.unref(r),"onUpdate:modelValue":l[6]||(l[6]=C=>e.isRef(r)?r.value=C:r=C),placeholder:"请输入名称",clearable:""},null,8,["modelValue"]),e.createVNode(n,{type:"primary",style:{"margin-left":"10px"},onClick:e.withModifiers(C=>m("add",c,t),["stop"])},{default:e.withCtx(()=>[...l[10]||(l[10]=[e.createTextVNode("新增",-1)])]),_:1},8,["onClick"])])]),_:2},1024),e.createVNode(h,{placement:"bottom",width:280,trigger:"click"},{reference:e.withCtx(()=>[e.createVNode(n,{type:"primary",link:"",icon:e.unref(u),onClick:e.withModifiers(C=>e.isRef(r)?r.value=t.label:r=t.label,["stop"])},null,8,["icon","onClick"])]),default:e.withCtx(()=>[e.createElementVNode("div",U,[e.createVNode(p,{modelValue:e.unref(r),"onUpdate:modelValue":l[7]||(l[7]=C=>e.isRef(r)?r.value=C:r=C),placeholder:"请输入名称",clearable:""},null,8,["modelValue"]),e.createVNode(n,{type:"primary",style:{"margin-left":"10px"},onClick:e.withModifiers(C=>m("edit",c,t),["stop"])},{default:e.withCtx(()=>[...l[11]||(l[11]=[e.createTextVNode("修改",-1)])]),_:1},8,["onClick"])])]),_:2},1024)],64)),e.createVNode(b,{title:"确定删除这条数据吗?","hide-icon":"",width:"170",onConfirm:C=>m("delete",c,t)},{reference:e.withCtx(()=>[e.createVNode(n,{type:"danger",link:"",icon:e.unref(S),onClick:l[8]||(l[8]=e.withModifiers(()=>{},["stop"]))},null,8,["icon"])]),_:1},8,["onConfirm"])])])]),key:"0"}:void 0]),1040)])}}}),A=Object.assign({name:"WtskForm"},{name:"WtskForm",inheritAttrs:!1},{props:e.mergeModels({formIsSearch:{type:Boolean,default:!1},formItems:{type:Array,default:()=>[]}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(a,{expose:f}){const k=a,V=e.computed(()=>k.formItems.filter(s=>!s.hidden)),d=e.useModel(a,"modelValue"),i={input:B.ElInput,number:B.ElInputNumber,select:B.ElSelect,date:B.ElDatePicker,switch:B.ElSwitch,treeSelect:B.ElTreeSelect};function g(s,_){if(!s||typeof s!="object"||!_)return;const m=_.split(".");let o=s;for(const l of m){if(o===null||!(l in o))return;o=o[l]}return o}function r(s,_,m){if(!s||typeof s!="object"||!_)return;const o=_.split(".");let l=s;for(let p=0;p<o.length-1;p++){const n=o[p];if((l[n]===null||typeof l[n]!="object"&&l[n]!==void 0)&&(l[n]={}),!(n in l))return;l=l[n]}l[o[o.length-1]]=m}const y=e.ref();return f({wtskFormRef:y}),(s,_)=>{const m=e.resolveComponent("el-radio"),o=e.resolveComponent("el-radio-group"),l=e.resolveComponent("el-checkbox"),p=e.resolveComponent("el-checkbox-group"),n=e.resolveComponent("el-form-item"),h=e.resolveComponent("el-col"),b=e.resolveComponent("el-row"),w=e.resolveComponent("el-form");return e.openBlock(),e.createBlock(w,e.mergeProps({ref_key:"wtskFormRef",ref:y,class:["wtsk-form",a.formIsSearch?"wtsk-form-search":""]},{"label-width":a.formIsSearch?"auto":"100px",...s.$attrs},{model:d.value}),{default:e.withCtx(()=>[a.formIsSearch?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(V.value,t=>(e.openBlock(),e.createBlock(n,{key:t.prop,label:t.label,prop:t.prop},{default:e.withCtx(()=>[e.renderSlot(s.$slots,t.prop,{},()=>[t.type==="radio"||t.type==="checkbox"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.type==="radio"?(e.openBlock(),e.createBlock(o,{key:0,modelValue:d.value[t.prop],"onUpdate:modelValue":c=>d.value[t.prop]=c},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data,c=>(e.openBlock(),e.createBlock(m,{value:c.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.label),1)]),_:2},1032,["value"]))),256))]),_:2},1032,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0),t.type==="checkbox"?(e.openBlock(),e.createBlock(p,{key:1,modelValue:d.value[t.prop],"onUpdate:modelValue":c=>d.value[t.prop]=c},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data,c=>(e.openBlock(),e.createBlock(l,{label:c.label,value:c.value},null,8,["label","value"]))),256))]),_:2},1032,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i[t.type]),e.mergeProps({key:1,ref_for:!0},t.props,{"model-value":g(d.value,t.prop),"onUpdate:modelValue":c=>r(d.value,t.prop,c)}),null,16,["model-value","onUpdate:modelValue"]))])]),_:2},1032,["label","prop"]))),128)),e.createVNode(n,null,{default:e.withCtx(()=>[e.renderSlot(s.$slots,"formSearchBtn")]),_:3})],64)):(e.openBlock(),e.createBlock(b,{key:1,gutter:16},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(V.value,t=>(e.openBlock(),e.createBlock(h,{key:t.prop,span:t.span||24},{default:e.withCtx(()=>[e.createVNode(n,{label:t.label,prop:t.prop},{default:e.withCtx(()=>[e.renderSlot(s.$slots,t.prop,{},()=>[t.type==="radio"||t.type==="checkbox"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.type==="radio"?(e.openBlock(),e.createBlock(o,{key:0,modelValue:d.value[t.prop],"onUpdate:modelValue":c=>d.value[t.prop]=c},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data,c=>(e.openBlock(),e.createBlock(m,{value:c.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.label),1)]),_:2},1032,["value"]))),256))]),_:2},1032,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0),t.type==="checkbox"?(e.openBlock(),e.createBlock(p,{key:1,modelValue:d.value[t.prop],"onUpdate:modelValue":c=>d.value[t.prop]=c},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data,c=>(e.openBlock(),e.createBlock(l,{label:c.label,value:c.value},null,8,["label","value"]))),256))]),_:2},1032,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i[t.type]),e.mergeProps({key:1,ref_for:!0},t.props,{modelValue:d.value[t.prop],"onUpdate:modelValue":c=>d.value[t.prop]=c}),null,16,["modelValue","onUpdate:modelValue"]))])]),_:2},1032,["label","prop"])]),_:2},1032,["span"]))),128))]),_:3}))]),_:3},16,["class","model"])}}}),R={key:0},D=[{name:"WtskBtn",component:N},{name:"WtskTree",component:W},{name:"WtskForm",component:A},{name:"WtskTable",component:Object.assign({name:"WtskTable"},{name:"WtskTable",inheritAttrs:!1},{props:{tableData:{type:Array,default:()=>[]},tableHeight:{type:String,default:"550px"},tableColumns:{type:Array,default:()=>[]},tableHasPage:{type:Boolean,default:!0},tableTotal:{type:Number,default:0},tablePageNum:{type:Number,default:1},tablePageSize:{type:Number,default:10},tablePageProp:{type:Object,default:()=>{}}},emits:["tablePageChange"],setup(a,{expose:f,emit:k}){const V=a,d=e.ref(),i=e.ref({pageNum:V.tablePageNum,pageSize:V.tablePageSize});e.watch([()=>V.tablePageNum,()=>V.tablePageSize],([s,_])=>{i.value.pageNum=s,i.value.pageSize=_},{immediate:!0});const g=k;function r(s){i.value.pageNum=s,g("tablePageChange",{...i.value})}function y(s){i.value.pageSize=s,g("tablePageChange",{...i.value})}return f({wtskTableRef:d}),(s,_)=>{const m=e.resolveComponent("el-table-column"),o=e.resolveComponent("el-table"),l=e.resolveComponent("el-pagination");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(o,e.mergeProps({ref_key:"wtskTableRef",ref:d,class:"wtsk-table"},{"row-key":"id","default-expand-all":!0,...s.$attrs},{data:a.tableData,height:a.tableHasPage?a.tableHeight:"auto",stripe:""}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tableColumns,p=>(e.openBlock(),e.createBlock(m,e.mergeProps({key:p.prop},{ref_for:!0},{align:"center","reserve-selection":!0,"show-overflow-tooltip":!0,...p}),e.createSlots({_:2},[p.slot?{name:"default",fn:e.withCtx(n=>[e.renderSlot(s.$slots,p.slot,e.mergeProps({ref_for:!0},n))]),key:"0"}:void 0,p.type==="operate"?{name:"default",fn:e.withCtx(n=>[e.renderSlot(s.$slots,"tableBtn",e.mergeProps({ref_for:!0},n))]),key:"1"}:void 0]),1040))),128))]),_:3},16,["data","height"]),a.tableHasPage?(e.openBlock(),e.createElementBlock("div",R,[e.createVNode(l,e.mergeProps({class:"wtsk-pagination"},{layout:"total, prev, pager, next, sizes","page-sizes":[5,10,20,50,100],background:!0,...a.tablePageProp},{total:a.tableTotal,"current-page":i.value.pageNum,"page-size":i.value.pageSize,onSizeChange:y,onCurrentChange:r}),null,16,["total","current-page","page-size"])])):e.createCommentVNode("",!0)],64)}}})}];return{install(a){D.forEach(({name:f,component:k})=>{a.component(f,k)})}}});
|
|
1
|
+
(function(e,V){typeof exports=="object"&&typeof module<"u"?module.exports=V(require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["vue","element-plus"],V):(e=typeof globalThis<"u"?globalThis:e||self,e.WtskComps=V(e.Vue,e.ElementPlus))})(this,function(e,V){"use strict";const N=Object.assign({name:"WtskBtn",inheritAttrs:!1},{__name:"WtskBtn",setup(r){const f=e.useAttrs(),k=e.ref(!1);function w(i,g){const a={};for(const y in i)y!==g&&(a[y]=i[y]);return a}async function d(){var i;k.value=!0;try{await((i=f.onClick)==null?void 0:i.call(f))}finally{k.value=!1}}return(i,g)=>{const a=e.resolveComponent("el-button");return e.openBlock(),e.createBlock(a,e.mergeProps(w(i.$attrs,"onClick"),{loading:k.value,onClick:d}),{default:e.withCtx(()=>[e.renderSlot(i.$slots,"default")]),_:3},16,["loading"])}}});/*! Element Plus Icons Vue v2.3.2 */var E=e.defineComponent({name:"Delete",__name:"delete",setup(r){return(f,k)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32"})]))}}),S=E,T=e.defineComponent({name:"Edit",__name:"edit",setup(r){return(f,k)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M832 512a32 32 0 1 1 64 0v352a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h352a32 32 0 0 1 0 64H192v640h640z"}),e.createElementVNode("path",{fill:"currentColor",d:"m469.952 554.24 52.8-7.552L847.104 222.4a32 32 0 1 0-45.248-45.248L477.44 501.44l-7.552 52.8zm422.4-422.4a96 96 0 0 1 0 135.808l-331.84 331.84a32 32 0 0 1-18.112 9.088L436.8 623.68a32 32 0 0 1-36.224-36.224l15.104-105.6a32 32 0 0 1 9.024-18.112l331.904-331.84a96 96 0 0 1 135.744 0z"})]))}}),x=T,P=e.defineComponent({name:"Plus",__name:"plus",setup(r){return(f,k)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64z"})]))}}),u=P;const F={class:"wtsk-tree-box"},z={key:0,class:"wtsk-tree-box-title"},H={key:1,class:"wtsk-tree-box-filter wtsk-form"},$={style:{display:"flex","align-items":"center"},class:"wtsk-form"},M={class:"wtsk-tree-box-tree-custom"},O={style:{display:"flex","align-items":"center"},class:"wtsk-form"},U={style:{display:"flex","align-items":"center"},class:"wtsk-form"},W=Object.assign({name:"WtskTree",inheritAttrs:!1},{__name:"WtskTree",props:{treeTitle:{type:String,default:""},treeHasFilter:{type:Boolean,default:!1},treeFilterType:{type:String,default:"default"},treeHasOperate:{type:Boolean,default:!1},treeCustomizeOperate:{type:Boolean,default:!1},treeAddParentText:{type:String,default:"新增一级"}},emits:["treeOperate"],setup(r,{expose:f,emit:k}){const w=e.useAttrs(),d=r,i=e.ref();let g=e.ref(""),a=e.ref("");const y=k;e.watch(g,o=>{var l;(l=i.value)==null||l.filter(o)});function s(o,l,p){var C;if(!o)return!0;const n=l.label?l.label:(C=w.props)==null?void 0:C.label;if(d.treeFilterType==="default")return l[n].includes(o);{let _=[];h(p,_,o,n);let b=!1;return _.forEach(t=>{b=b||t}),b}}function h(o,l,p,n){let C=o.data&&o.data[n]&&o.data[n].includes(p);C&&l.push(C),!C&&o.level!==1&&o.parent&&h(o.parent,l,p,n)}function m(o,l,p){d.treeCustomizeOperate||o==="delete"?y("treeOperate",o,l,p):a.value.trim()!==""?(document.documentElement.click(),y("treeOperate",o,l,p,a.value)):V.ElMessage.error("名称不能为空!")}return f({wtskTreeRef:i}),(o,l)=>{const p=e.resolveComponent("el-input"),n=e.resolveComponent("el-button"),C=e.resolveComponent("el-popover"),_=e.resolveComponent("el-popconfirm"),b=e.resolveComponent("el-tree");return e.openBlock(),e.createElementBlock("div",F,[r.treeTitle!==""?(e.openBlock(),e.createElementBlock("div",z,e.toDisplayString(r.treeTitle),1)):e.createCommentVNode("",!0),r.treeHasFilter||r.treeHasOperate?(e.openBlock(),e.createElementBlock("div",H,[r.treeHasFilter?(e.openBlock(),e.createBlock(p,{key:0,modelValue:e.unref(g),"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(g)?g.value=t:g=t),placeholder:"输入名称进行筛选……",clearable:""},null,8,["modelValue"])):e.createCommentVNode("",!0),r.treeCustomizeOperate?(e.openBlock(),e.createBlock(n,{key:2,type:"primary",onClick:l[4]||(l[4]=t=>m("addParent"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.treeAddParentText),1)]),_:1})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[r.treeHasOperate?(e.openBlock(),e.createBlock(C,{key:0,placement:"bottom",width:280,trigger:"click"},{reference:e.withCtx(()=>[e.createVNode(n,{type:"primary",onClick:l[1]||(l[1]=t=>e.isRef(a)?a.value="":a="")},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.treeAddParentText),1)]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",$,[e.createVNode(p,{modelValue:e.unref(a),"onUpdate:modelValue":l[2]||(l[2]=t=>e.isRef(a)?a.value=t:a=t),placeholder:"请输入名称",clearable:""},null,8,["modelValue"]),e.createVNode(n,{type:"primary",style:{"margin-left":"10px"},onClick:l[3]||(l[3]=e.withModifiers(t=>m("addParent"),["stop"]))},{default:e.withCtx(()=>[...l[9]||(l[9]=[e.createTextVNode("新增",-1)])]),_:1})])]),_:1})):e.createCommentVNode("",!0)],64))])):e.createCommentVNode("",!0),e.createVNode(b,e.mergeProps({ref_key:"wtskTreeRef",ref:i,class:"wtsk-tree wtsk-tree-box-tree"},{"node-key":"id","highlight-current":!0,"default-expand-all":!0,"expand-on-click-node":!1,"check-on-click-leaf":!1,...o.$attrs},{"filter-node-method":s}),e.createSlots({_:2},[r.treeHasOperate?{name:"default",fn:e.withCtx(({node:t,data:c})=>[e.createElementVNode("div",M,[e.createElementVNode("div",null,e.toDisplayString(t.label),1),e.createElementVNode("div",null,[r.treeCustomizeOperate?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(n,{type:"success",link:"",icon:e.unref(u),onClick:e.withModifiers(B=>m("add",c,t),["stop"])},null,8,["icon","onClick"]),e.createVNode(n,{type:"primary",link:"",icon:e.unref(x),onClick:e.withModifiers(B=>m("edit",c,t),["stop"])},null,8,["icon","onClick"])],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(C,{placement:"bottom",width:280,trigger:"click"},{reference:e.withCtx(()=>[e.createVNode(n,{type:"success",link:"",icon:e.unref(u),onClick:l[5]||(l[5]=e.withModifiers(B=>e.isRef(a)?a.value="":a="",["stop"]))},null,8,["icon"])]),default:e.withCtx(()=>[e.createElementVNode("div",O,[e.createVNode(p,{modelValue:e.unref(a),"onUpdate:modelValue":l[6]||(l[6]=B=>e.isRef(a)?a.value=B:a=B),placeholder:"请输入名称",clearable:""},null,8,["modelValue"]),e.createVNode(n,{type:"primary",style:{"margin-left":"10px"},onClick:e.withModifiers(B=>m("add",c,t),["stop"])},{default:e.withCtx(()=>[...l[10]||(l[10]=[e.createTextVNode("新增",-1)])]),_:1},8,["onClick"])])]),_:2},1024),e.createVNode(C,{placement:"bottom",width:280,trigger:"click"},{reference:e.withCtx(()=>[e.createVNode(n,{type:"primary",link:"",icon:e.unref(x),onClick:e.withModifiers(B=>e.isRef(a)?a.value=t.label:a=t.label,["stop"])},null,8,["icon","onClick"])]),default:e.withCtx(()=>[e.createElementVNode("div",U,[e.createVNode(p,{modelValue:e.unref(a),"onUpdate:modelValue":l[7]||(l[7]=B=>e.isRef(a)?a.value=B:a=B),placeholder:"请输入名称",clearable:""},null,8,["modelValue"]),e.createVNode(n,{type:"primary",style:{"margin-left":"10px"},onClick:e.withModifiers(B=>m("edit",c,t),["stop"])},{default:e.withCtx(()=>[...l[11]||(l[11]=[e.createTextVNode("修改",-1)])]),_:1},8,["onClick"])])]),_:2},1024)],64)),e.createVNode(_,{title:"确定删除这条数据吗?","hide-icon":"",width:"170",onConfirm:B=>m("delete",c,t)},{reference:e.withCtx(()=>[e.createVNode(n,{type:"danger",link:"",icon:e.unref(S),onClick:l[8]||(l[8]=e.withModifiers(()=>{},["stop"]))},null,8,["icon"])]),_:1},8,["onConfirm"])])])]),key:"0"}:void 0]),1040)])}}}),A=Object.assign({name:"WtskForm",inheritAttrs:!1},{__name:"WtskForm",props:e.mergeModels({formIsSearch:{type:Boolean,default:!1},formItems:{type:Array,default:()=>[]}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(r,{expose:f}){const k=r,w=e.computed(()=>k.formItems.filter(s=>!s.hidden)),d=e.useModel(r,"modelValue"),i={input:V.ElInput,number:V.ElInputNumber,select:V.ElSelect,date:V.ElDatePicker,switch:V.ElSwitch,treeSelect:V.ElTreeSelect};function g(s,h){if(!s||typeof s!="object"||!h)return;const m=h.split(".");let o=s;for(const l of m){if(o===null||!(l in o))return;o=o[l]}return o}function a(s,h,m){if(!s||typeof s!="object"||!h)return;const o=h.split(".");let l=s;for(let p=0;p<o.length-1;p++){const n=o[p];if((l[n]===null||typeof l[n]!="object"&&l[n]!==void 0)&&(l[n]={}),!(n in l))return;l=l[n]}l[o[o.length-1]]=m}const y=e.ref();return f({wtskFormRef:y}),(s,h)=>{const m=e.resolveComponent("el-radio"),o=e.resolveComponent("el-radio-group"),l=e.resolveComponent("el-checkbox"),p=e.resolveComponent("el-checkbox-group"),n=e.resolveComponent("el-form-item"),C=e.resolveComponent("el-col"),_=e.resolveComponent("el-row"),b=e.resolveComponent("el-form");return e.openBlock(),e.createBlock(b,e.mergeProps({ref_key:"wtskFormRef",ref:y,class:["wtsk-form",r.formIsSearch?"wtsk-form-search":""]},{"label-width":r.formIsSearch?"auto":"100px",...s.$attrs},{model:d.value}),{default:e.withCtx(()=>[r.formIsSearch?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.value,t=>(e.openBlock(),e.createBlock(n,{key:t.prop,label:t.label,prop:t.prop},{default:e.withCtx(()=>[e.renderSlot(s.$slots,t.prop,{},()=>[t.type==="radio"||t.type==="checkbox"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.type==="radio"?(e.openBlock(),e.createBlock(o,{key:0,modelValue:d.value[t.prop],"onUpdate:modelValue":c=>d.value[t.prop]=c},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data,c=>(e.openBlock(),e.createBlock(m,{value:c.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.label),1)]),_:2},1032,["value"]))),256))]),_:2},1032,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0),t.type==="checkbox"?(e.openBlock(),e.createBlock(p,{key:1,modelValue:d.value[t.prop],"onUpdate:modelValue":c=>d.value[t.prop]=c},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data,c=>(e.openBlock(),e.createBlock(l,{label:c.label,value:c.value},null,8,["label","value"]))),256))]),_:2},1032,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i[t.type]),e.mergeProps({key:1,ref_for:!0},t.props,{"model-value":g(d.value,t.prop),"onUpdate:modelValue":c=>a(d.value,t.prop,c)}),null,16,["model-value","onUpdate:modelValue"]))])]),_:2},1032,["label","prop"]))),128)),e.createVNode(n,null,{default:e.withCtx(()=>[e.renderSlot(s.$slots,"formSearchBtn")]),_:3})],64)):(e.openBlock(),e.createBlock(_,{key:1,gutter:16},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.value,t=>(e.openBlock(),e.createBlock(C,{key:t.prop,span:t.span||24},{default:e.withCtx(()=>[e.createVNode(n,{label:t.label,prop:t.prop},{default:e.withCtx(()=>[e.renderSlot(s.$slots,t.prop,{},()=>[t.type==="radio"||t.type==="checkbox"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.type==="radio"?(e.openBlock(),e.createBlock(o,{key:0,modelValue:d.value[t.prop],"onUpdate:modelValue":c=>d.value[t.prop]=c},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data,c=>(e.openBlock(),e.createBlock(m,{value:c.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.label),1)]),_:2},1032,["value"]))),256))]),_:2},1032,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0),t.type==="checkbox"?(e.openBlock(),e.createBlock(p,{key:1,modelValue:d.value[t.prop],"onUpdate:modelValue":c=>d.value[t.prop]=c},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data,c=>(e.openBlock(),e.createBlock(l,{label:c.label,value:c.value},null,8,["label","value"]))),256))]),_:2},1032,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i[t.type]),e.mergeProps({key:1,ref_for:!0},t.props,{modelValue:d.value[t.prop],"onUpdate:modelValue":c=>d.value[t.prop]=c}),null,16,["modelValue","onUpdate:modelValue"]))])]),_:2},1032,["label","prop"])]),_:2},1032,["span"]))),128))]),_:3}))]),_:3},16,["class","model"])}}}),R={key:0},D=[{name:"WtskBtn",component:N},{name:"WtskTree",component:W},{name:"WtskForm",component:A},{name:"WtskTable",component:Object.assign({name:"WtskTable",inheritAttrs:!1},{__name:"WtskTable",props:{tableData:{type:Array,default:()=>[]},tableHeight:{type:String,default:"550px"},tableColumns:{type:Array,default:()=>[]},tableHasPage:{type:Boolean,default:!0},tableTotal:{type:Number,default:0},tablePageNum:{type:Number,default:1},tablePageSize:{type:Number,default:10},tablePageProp:{type:Object,default:()=>{}}},emits:["tablePageChange"],setup(r,{expose:f,emit:k}){const w=r,d=e.ref(),i=e.ref({pageNum:w.tablePageNum,pageSize:w.tablePageSize});e.watch([()=>w.tablePageNum,()=>w.tablePageSize],([s,h])=>{i.value.pageNum=s,i.value.pageSize=h},{immediate:!0});const g=k;function a(s){i.value.pageNum=s,g("tablePageChange",{...i.value})}function y(s){i.value.pageSize=s,g("tablePageChange",{...i.value})}return f({wtskTableRef:d}),(s,h)=>{const m=e.resolveComponent("el-table-column"),o=e.resolveComponent("el-table"),l=e.resolveComponent("el-pagination");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(o,e.mergeProps({ref_key:"wtskTableRef",ref:d,class:"wtsk-table"},{"row-key":"id","default-expand-all":!0,...s.$attrs},{data:r.tableData,height:r.tableHasPage?r.tableHeight:"auto",stripe:""}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.tableColumns,p=>(e.openBlock(),e.createBlock(m,e.mergeProps({key:p.prop},{ref_for:!0},{align:"center","reserve-selection":!0,"show-overflow-tooltip":!0,...p}),e.createSlots({_:2},[p.slot?{name:"default",fn:e.withCtx(n=>[e.renderSlot(s.$slots,p.slot,e.mergeProps({ref_for:!0},n))]),key:"0"}:void 0,p.type==="operate"?{name:"default",fn:e.withCtx(n=>[e.renderSlot(s.$slots,"tableBtn",e.mergeProps({ref_for:!0},n))]),key:"1"}:void 0]),1040))),128))]),_:3},16,["data","height"]),r.tableHasPage?(e.openBlock(),e.createElementBlock("div",R,[e.createVNode(l,e.mergeProps({class:"wtsk-pagination"},{layout:"total, prev, pager, next, sizes","page-sizes":[5,10,20,50,100],background:!0,...r.tablePageProp},{total:r.tableTotal,"current-page":i.value.pageNum,"page-size":i.value.pageSize,onSizeChange:y,onCurrentChange:a}),null,16,["total","current-page","page-size"])])):e.createCommentVNode("",!0)],64)}}})}];return{install(r){D.forEach(({name:f,component:k})=>{r.component(f,k)})}}});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wtsk-comps",
|
|
3
|
-
"version": "1.3.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.3.4",
|
|
4
|
+
"description": "一款基于Vue3+Element Plus的基础组件库(wtsk-btn/form/table/tree)",
|
|
5
5
|
"author": "lujh",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"keywords": ["wtsk-comps"],
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"main": "dist/wtsk-comps.cjs.js",
|
|
10
10
|
"module": "dist/wtsk-comps.es.js",
|
|
11
11
|
"unpkg": "dist/wtsk-comps.umd.js",
|
|
12
|
-
"style": "dist/
|
|
12
|
+
"style": "dist/index.css",
|
|
13
13
|
"exports": {
|
|
14
14
|
".": {
|
|
15
15
|
"import": "./dist/wtsk-comps.es.js",
|
|
File without changes
|