@jecloud/ui
Version:
JECloud UI库,基于ant-design-vue封装
1 lines • 2.46 kB
JavaScript
var e=this&&this.__assign||function(){return e=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},e.apply(this,arguments)},t=this&&this.__spreadArrays||function(){for(var e=0,t=0,o=arguments.length;t<o;t++)e+=arguments[t].length;var r=Array(e),n=0;for(t=0;t<o;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,n++)r[n]=i[a];return r};import{withDirectives as o,createVNode as r,mergeProps as n,resolveDirective as i}from"vue";import{defineComponent as a,nextTick as s,watch as l,onBeforeMount as u}from"vue";import{tableEmits as c,tableProps as f,tableSlots as p,panelSlots as d,panelProps as v}from"../../grid/src/table";import{Table as m}from"vxe-table";import h from"../../panel";import{useTree as y}from"./hooks/use-tree";import{pick as b}from"@jecloud/utils";import{useListeners as g,useModelValue as j}from"../../hooks";export default a({name:"JeTree",components:{Table:m,Panel:h},inheritAttrs:!1,props:e(e(e({},f),v),{search:{type:[Boolean,Object,Function],default:!0},size:{type:String,default:"mini",validator:function(e){return["large","middle","small","mini"].includes(e)}},bodyBorder:Boolean,store:Object,autoLoad:Boolean,multiple:Boolean,showAction:{type:Function,default:function(){return!0}}}),emits:t(c,["update:size","search-select","action-click"]),slots:t(p,d),setup:function(a,c){var f=c.slots,p=c.attrs,z=g({props:a,context:c}).fireListener,B=y({props:a,context:c}),O=B.$table,k=B.$panel,x=B.$plugin,S=B.treeEvents,w=B.treeProps,A=B.treeSlots,L=B.searchSlot,P=B.loading;return O.size=j({props:a,context:c,key:"size"}),l((function(){return O.size.value}),(function(){k.value.refreshLayout()})),u((function(){s((function(){var e;(null===(e=a.store)||void 0===e?void 0:e.isStore)&&(a.store.setup(O),a.store.on("before-load",(function(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];return z.apply(void 0,t(["before-load"],e))})),a.store.on("load",(function(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];z.apply(void 0,t(["load"],e))})),a.store.autoLoad&&a.store.load())}))})),function(){return r(h,n({class:{"je-tree":!0,"is--loading":P.value,"is--bodyborder":a.bodyBorder},ref:k},b(p,["style","class"]),b(a,Object.keys(v))),e(e({default:function(){return[o(r(m,n({ref:x},S,w.value,{size:O.size.value,height:"100%",width:"100%",style:a.bodyStyle}),A),[[i("loading"),P.value]])]}},b(f,d)),{tbar:L}))}}});