邹方成 2a89a1ab9d
Some checks failed
Build docker and publish / linux (1.24.5) (push) Failing after 39s
feat(admin): 更新前端资源文件及修复相关功能
refactor(service): 修改banner和guild删除逻辑为软删除
fix(service): 修复删除操作使用软删除而非物理删除

build: 添加SQLite测试仓库实现
docs: 新增奖励管理字段拆分和批量抽奖UI改造文档

ci: 更新CI忽略文件
style: 清理无用资源文件
2025-11-19 01:35:55 +08:00

2 lines
28 KiB
JavaScript

var e=Object.defineProperty,t=Object.defineProperties,n=Object.getOwnPropertyDescriptors,d=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,r=(t,n,d)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:d}):t[n]=d;import{a2 as s,bu as i,_ as l,d as c,a as h,X as u,c as p,a6 as f,o as v,bw as y,y as g,f as N,z as k,j as C,g as x,i as b,u as m,au as E,bW as D,ap as K,ct as w,bt as S,af as A,ai as O,r as B,bv as L,aa as T,bZ as I,ag as _,an as $,n as z,a3 as j,a9 as M,a7 as q,a1 as P,$ as F,D as H,J as R,ac as U,e as W,h as G,p as V,k as Y,aG as X,F as J,G as Z,c1 as Q,ab as ee,w as te,dn as ne,a8 as de,c4 as oe,V as ae,W as re,m as se,ae as ie,ak as le,bG as ce,bF as he}from"./index-CZ0Lvzl5.js";import{s as ue}from"./token-DWNpOE8r.js";import{E as pe}from"./index-C5-SmfXa.js";import{E as fe}from"./index-BZS0BBj4.js";import{u as ve,a as ye}from"./use-form-common-props-U6f9D53_.js";const ge=s({type:{type:String,values:["primary","success","info","warning","danger",""],default:""},size:{type:String,values:i,default:""},truncated:Boolean,lineClamp:{type:[String,Number]},tag:{type:String,default:"span"}}),Ne=c({name:"ElText"}),ke=c((Ce=((e,t)=>{for(var n in t||(t={}))o.call(t,n)&&r(e,n,t[n]);if(d)for(var n of d(t))a.call(t,n)&&r(e,n,t[n]);return e})({},Ne),t(Ce,n({props:ge,setup(e){const t=e,n=h(),d=ve(),o=u("text"),a=p(()=>[o.b(),o.m(t.type),o.m(d.value),o.is("truncated",t.truncated),o.is("line-clamp",!f(t.lineClamp))]),r=()=>{var e,d,o,a,r,s,i;if(D().title)return;let l=!1;const c=(null==(e=n.value)?void 0:e.textContent)||"";if(t.truncated){const e=null==(d=n.value)?void 0:d.offsetWidth,t=null==(o=n.value)?void 0:o.scrollWidth;e&&t&&t>e&&(l=!0)}else if(!f(t.lineClamp)){const e=null==(a=n.value)?void 0:a.offsetHeight,t=null==(r=n.value)?void 0:r.scrollHeight;e&&t&&t>e&&(l=!0)}l?null==(s=n.value)||s.setAttribute("title",c):null==(i=n.value)||i.removeAttribute("title")};return v(r),y(r),(e,t)=>(N(),g(E(e.tag),{ref_key:"textRef",ref:n,class:b(m(a)),style:x({"-webkit-line-clamp":e.lineClamp})},{default:k(()=>[C(e.$slots,"default")]),_:3},8,["class","style"]))}}))));var Ce;const xe=K(l(ke,[["__file","text.vue"]])),be="$treeNodeId",me=function(e,t){t&&!t[be]&&Object.defineProperty(t,be,{value:e.id,enumerable:!1,configurable:!1,writable:!1})},Ee=(e,t)=>null==t?void 0:t[e||be],De=(e,t,n)=>{const d=e.value.currentNode;n();const o=e.value.currentNode;d!==o&&t("current-change",o?o.data:null,o)},Ke=e=>{let t=!0,n=!0,d=!0;for(let o=0,a=e.length;o<a;o++){const a=e[o];(!0!==a.checked||a.indeterminate)&&(t=!1,a.disabled||(d=!1)),(!1!==a.checked||a.indeterminate)&&(n=!1)}return{all:t,none:n,allWithoutDisable:d,half:!t&&!n}},we=function(e){if(0===e.childNodes.length||e.loading)return;const{all:t,none:n,half:d}=Ke(e.childNodes);t?(e.checked=!0,e.indeterminate=!1):d?(e.checked=!1,e.indeterminate=!0):n&&(e.checked=!1,e.indeterminate=!1);const o=e.parent;o&&0!==o.level&&(e.store.checkStrictly||we(o))},Se=function(e,t){const n=e.store.props,d=e.data||{},o=n[t];if(L(o))return o(d,e);if(T(o))return d[o];if(f(o)){const e=d[t];return f(e)?"":e}},Ae=function(e,t){e.forEach(e=>{e.canFocus=t,Ae(e.childNodes,t)})};let Oe=0;class Be{constructor(e){this.isLeafByUser=void 0,this.isLeaf=void 0,this.id=Oe++,this.text=null,this.checked=!1,this.indeterminate=!1,this.data=null,this.expanded=!1,this.parent=null,this.visible=!0,this.isCurrent=!1,this.canFocus=!1;for(const t in e)w(e,t)&&(this[t]=e[t]);this.level=0,this.loaded=!1,this.childNodes=[],this.loading=!1,this.parent&&(this.level=this.parent.level+1)}initialize(){var e;const t=this.store;if(!t)throw new Error("[Node]store is required!");t.registerNode(this);const n=t.props;if(n&&void 0!==n.isLeaf){const e=Se(this,"isLeaf");S(e)&&(this.isLeafByUser=e)}if(!0!==t.lazy&&this.data?(this.setData(this.data),t.defaultExpandAll&&(this.expanded=!0,this.canFocus=!0)):this.level>0&&t.lazy&&t.defaultExpandAll&&!this.isLeafByUser&&this.expand(),A(this.data)||me(this,this.data),!this.data)return;const d=t.defaultExpandedKeys,o=t.key;o&&!O(this.key)&&d&&d.includes(this.key)&&this.expand(null,t.autoExpandParent),o&&void 0!==t.currentNodeKey&&this.key===t.currentNodeKey&&(t.currentNode=this,t.currentNode.isCurrent=!0),t.lazy&&t._initDefaultCheckedNode(this),this.updateLeafState(),1!==this.level&&!0!==(null==(e=this.parent)?void 0:e.expanded)||(this.canFocus=!0)}setData(e){let t;A(e)||me(this,e),this.data=e,this.childNodes=[],t=0===this.level&&A(this.data)?this.data:Se(this,"children")||[];for(let n=0,d=t.length;n<d;n++)this.insertChild({data:t[n]})}get label(){return Se(this,"label")}get key(){const e=this.store.key;return this.data?this.data[e]:null}get disabled(){return Se(this,"disabled")}get nextSibling(){const e=this.parent;if(e){const t=e.childNodes.indexOf(this);if(t>-1)return e.childNodes[t+1]}return null}get previousSibling(){const e=this.parent;if(e){const t=e.childNodes.indexOf(this);if(t>-1)return t>0?e.childNodes[t-1]:null}return null}contains(e,t=!0){return(this.childNodes||[]).some(n=>n===e||t&&n.contains(e))}remove(){const e=this.parent;e&&e.removeChild(this)}insertChild(e,t,n){if(!e)throw new Error("InsertChild error: child is required.");if(!(e instanceof Be)){if(!n){const n=this.getChildren(!0);(null==n?void 0:n.includes(e.data))||(f(t)||t<0?null==n||n.push(e.data):null==n||n.splice(t,0,e.data))}Object.assign(e,{parent:this,store:this.store}),(e=B(new Be(e)))instanceof Be&&e.initialize()}e.level=this.level+1,f(t)||t<0?this.childNodes.push(e):this.childNodes.splice(t,0,e),this.updateLeafState()}insertBefore(e,t){let n;t&&(n=this.childNodes.indexOf(t)),this.insertChild(e,n)}insertAfter(e,t){let n;t&&(n=this.childNodes.indexOf(t),-1!==n&&(n+=1)),this.insertChild(e,n)}removeChild(e){const t=this.getChildren()||[],n=t.indexOf(e.data);n>-1&&t.splice(n,1);const d=this.childNodes.indexOf(e);d>-1&&(this.store&&this.store.deregisterNode(e),e.parent=null,this.childNodes.splice(d,1)),this.updateLeafState()}removeChildByData(e){let t=null;for(let n=0;n<this.childNodes.length;n++)if(this.childNodes[n].data===e){t=this.childNodes[n];break}t&&this.removeChild(t)}expand(e,t){const n=()=>{if(t){let e=this.parent;for(;e&&e.level>0;)e.expanded=!0,e=e.parent}this.expanded=!0,e&&e(),Ae(this.childNodes,!0)};this.shouldLoadData()?this.loadData(e=>{A(e)&&(this.checked?this.setChecked(!0,!0):this.store.checkStrictly||we(this),n())}):n()}doCreateChildren(e,t={}){e.forEach(e=>{this.insertChild(Object.assign({data:e},t),void 0,!0)})}collapse(){this.expanded=!1,Ae(this.childNodes,!1)}shouldLoadData(){return Boolean(!0===this.store.lazy&&this.store.load&&!this.loaded)}updateLeafState(){if(!0===this.store.lazy&&!0!==this.loaded&&void 0!==this.isLeafByUser)return void(this.isLeaf=this.isLeafByUser);const e=this.childNodes;!this.store.lazy||!0===this.store.lazy&&!0===this.loaded?this.isLeaf=!e||0===e.length:this.isLeaf=!1}setChecked(e,t,n,d){if(this.indeterminate="half"===e,this.checked=!0===e,this.store.checkStrictly)return;if(!this.shouldLoadData()||this.store.checkDescendants){const{all:n,allWithoutDisable:o}=Ke(this.childNodes);this.isLeaf||n||!o||(this.checked=!1,e=!1);const a=()=>{if(t){const n=this.childNodes;for(let r=0,s=n.length;r<s;r++){const o=n[r];d=d||!1!==e;const a=o.disabled?o.checked:d;o.setChecked(a,t,!0,d)}const{half:o,all:a}=Ke(n);a||(this.checked=a,this.indeterminate=o)}};if(this.shouldLoadData())return void this.loadData(()=>{a(),we(this)},{checked:!1!==e});a()}const o=this.parent;o&&0!==o.level&&(n||we(o))}getChildren(e=!1){if(0===this.level)return this.data;const t=this.data;if(!t)return null;const n=this.store.props;let d="children";return n&&(d=n.children||"children"),f(t[d])&&(t[d]=null),e&&!t[d]&&(t[d]=[]),t[d]}updateChildren(){const e=this.getChildren()||[],t=this.childNodes.map(e=>e.data),n={},d=[];e.forEach((e,o)=>{const a=e[be];!!a&&t.findIndex(e=>(null==e?void 0:e[be])===a)>=0?n[a]={index:o,data:e}:d.push({index:o,data:e})}),this.store.lazy||t.forEach(e=>{n[null==e?void 0:e[be]]||this.removeChildByData(e)}),d.forEach(({index:e,data:t})=>{this.insertChild({data:t},e)}),this.updateLeafState()}loadData(e,t={}){if(!0!==this.store.lazy||!this.store.load||this.loaded||this.loading&&!Object.keys(t).length)e&&e.call(this);else{this.loading=!0;const n=n=>{this.childNodes=[],this.doCreateChildren(n,t),this.loaded=!0,this.loading=!1,this.updateLeafState(),e&&e.call(this,n)},d=()=>{this.loading=!1};this.store.load(this,n,d)}}eachNode(e){const t=[this];for(;t.length;){const n=t.shift();t.unshift(...n.childNodes),e(n)}}reInitChecked(){this.store.checkStrictly||we(this)}}class Le{constructor(e){this.lazy=!1,this.checkStrictly=!1,this.autoExpandParent=!1,this.defaultExpandAll=!1,this.checkDescendants=!1,this.currentNode=null,this.currentNodeKey=null;for(const t in e)w(e,t)&&(this[t]=e[t]);this.nodesMap={}}initialize(){if(this.root=new Be({data:this.data,store:this}),this.root.initialize(),this.lazy&&this.load){(0,this.load)(this.root,e=>{this.root.doCreateChildren(e),this._initDefaultCheckedNodes()},I)}else this._initDefaultCheckedNodes()}filter(e){const t=this.filterNodeMethod,n=this.lazy,d=function(o){return a=this,r=null,s=function*(){const a=o.root?o.root.childNodes:o.childNodes;for(const[n,o]of a.entries())o.visible=!!(null==t?void 0:t.call(o,e,o.data,o)),n%80==0&&n>0&&(yield z()),yield d(o);if(!o.visible&&a.length){let e=!0;e=!a.some(e=>e.visible),o.root?o.root.visible=!1===e:o.visible=!1===e}e&&o.visible&&!o.isLeaf&&(n&&!o.loaded||o.expand())},new Promise((e,t)=>{var n=e=>{try{o(s.next(e))}catch(n){t(n)}},d=e=>{try{o(s.throw(e))}catch(n){t(n)}},o=t=>t.done?e(t.value):Promise.resolve(t.value).then(n,d);o((s=s.apply(a,r)).next())});var a,r,s};d(this)}setData(e){e!==this.root.data?(this.nodesMap={},this.root.setData(e),this._initDefaultCheckedNodes(),this.setCurrentNodeKey(this.currentNodeKey)):this.root.updateChildren()}getNode(e){if(e instanceof Be)return e;const t=_(e)?Ee(this.key,e):e;return this.nodesMap[t]||null}insertBefore(e,t){var n;const d=this.getNode(t);null==(n=d.parent)||n.insertBefore({data:e},d)}insertAfter(e,t){var n;const d=this.getNode(t);null==(n=d.parent)||n.insertAfter({data:e},d)}remove(e){const t=this.getNode(e);t&&t.parent&&(t===this.currentNode&&(this.currentNode=null),t.parent.removeChild(t))}append(e,t){const n=$(t)?this.root:this.getNode(t);n&&n.insertChild({data:e})}_initDefaultCheckedNodes(){const e=this.defaultCheckedKeys||[],t=this.nodesMap;e.forEach(e=>{const n=t[e];n&&n.setChecked(!0,!this.checkStrictly)})}_initDefaultCheckedNode(e){const t=this.defaultCheckedKeys||[];!O(e.key)&&t.includes(e.key)&&e.setChecked(!0,!this.checkStrictly)}setDefaultCheckedKey(e){e!==this.defaultCheckedKeys&&(this.defaultCheckedKeys=e,this._initDefaultCheckedNodes())}registerNode(e){const t=this.key;if(e&&e.data)if(t){const t=e.key;O(t)||(this.nodesMap[t]=e)}else this.nodesMap[e.id]=e}deregisterNode(e){this.key&&e&&e.data&&(e.childNodes.forEach(e=>{this.deregisterNode(e)}),delete this.nodesMap[e.key])}getCheckedNodes(e=!1,t=!1){const n=[],d=function(o){(o.root?o.root.childNodes:o.childNodes).forEach(o=>{(o.checked||t&&o.indeterminate)&&(!e||e&&o.isLeaf)&&n.push(o.data),d(o)})};return d(this),n}getCheckedKeys(e=!1){return this.getCheckedNodes(e).map(e=>(e||{})[this.key])}getHalfCheckedNodes(){const e=[],t=function(n){(n.root?n.root.childNodes:n.childNodes).forEach(n=>{n.indeterminate&&e.push(n.data),t(n)})};return t(this),e}getHalfCheckedKeys(){return this.getHalfCheckedNodes().map(e=>(e||{})[this.key])}_getAllNodes(){const e=[],t=this.nodesMap;for(const n in t)w(t,n)&&e.push(t[n]);return e}updateChildren(e,t){const n=this.nodesMap[e];if(!n)return;const d=n.childNodes;for(let o=d.length-1;o>=0;o--){const e=d[o];this.remove(e.data)}for(let o=0,a=t.length;o<a;o++){const e=t[o];this.append(e,n.data)}}_setCheckedKeys(e,t=!1,n){const d=this._getAllNodes().sort((e,t)=>e.level-t.level),o=Object.create(null),a=Object.keys(n);d.forEach(e=>e.setChecked(!1,!1));const r=t=>{t.childNodes.forEach(t=>{var n;o[t.data[e]]=!0,(null==(n=t.childNodes)?void 0:n.length)&&r(t)})};for(let s=0,i=d.length;s<i;s++){const n=d[s],i=n.data[e].toString();if(a.includes(i)){if(n.childNodes.length&&r(n),n.isLeaf||this.checkStrictly)n.setChecked(!0,!1);else if(n.setChecked(!0,!0),t){n.setChecked(!1,!1);const e=function(t){t.childNodes.forEach(t=>{t.isLeaf||t.setChecked(!1,!1),e(t)})};e(n)}}else n.checked&&!o[i]&&n.setChecked(!1,!1)}}setCheckedNodes(e,t=!1){const n=this.key,d={};e.forEach(e=>{d[(e||{})[n]]=!0}),this._setCheckedKeys(n,t,d)}setCheckedKeys(e,t=!1){this.defaultCheckedKeys=e;const n=this.key,d={};e.forEach(e=>{d[e]=!0}),this._setCheckedKeys(n,t,d)}setDefaultExpandedKeys(e){e=e||[],this.defaultExpandedKeys=e,e.forEach(e=>{const t=this.getNode(e);t&&t.expand(null,this.autoExpandParent)})}setChecked(e,t,n){const d=this.getNode(e);d&&d.setChecked(!!t,n)}getCurrentNode(){return this.currentNode}setCurrentNode(e){const t=this.currentNode;t&&(t.isCurrent=!1),this.currentNode=e,this.currentNode.isCurrent=!0}setUserCurrentNode(e,t=!0){var n;const d=e[this.key],o=this.nodesMap[d];this.setCurrentNode(o),t&&this.currentNode&&this.currentNode.level>1&&(null==(n=this.currentNode.parent)||n.expand(null,!0))}setCurrentNodeKey(e,t=!0){var n;if(this.currentNodeKey=e,$(e))return this.currentNode&&(this.currentNode.isCurrent=!1),void(this.currentNode=null);const d=this.getNode(e);d&&(this.setCurrentNode(d),t&&this.currentNode&&this.currentNode.level>1&&(null==(n=this.currentNode.parent)||n.expand(null,!0)))}}const Te="RootTree",Ie="NodeInstance",_e="TreeNodeMap";var $e=l(c({name:"ElTreeNodeContent",props:{node:{type:Object,required:!0},renderContent:Function},setup(e){const t=u("tree"),n=j(Ie),d=j(Te);return()=>{const o=e.node,{data:a,store:r}=o;return e.renderContent?e.renderContent(M,{_self:n,node:o,data:a,store:r}):C(d.ctx.slots,"default",{node:o,data:a},()=>[M(xe,{tag:"span",truncated:!0,class:t.be("node","label")},()=>[o.label])])}}}),[["__file","tree-node-content.vue"]]);function ze(e){const t=j(_e,null),n={treeNodeExpand:t=>{var n;e.node!==t&&(null==(n=e.node)||n.collapse())},children:[]};return t&&t.children.push(n),q(_e,n),{broadcastExpanded:t=>{if(e.accordion)for(const e of n.children)e.treeNodeExpand(t)}}}const je=Symbol("dragEvents");const Me=c({name:"ElTreeNode",components:{ElCollapseTransition:pe,ElCheckbox:fe,NodeContent:$e,ElIcon:ee,Loading:Q},props:{node:{type:Be,default:()=>({})},props:{type:Object,default:()=>({})},accordion:Boolean,renderContent:Function,renderAfterExpand:Boolean,showCheckbox:Boolean},emits:["node-expand"],setup(e,t){const n=u("tree"),{broadcastExpanded:d}=ze(e),o=j(Te),a=h(!1),r=h(!1),s=h(),i=h(),l=h(),c=j(je),p=de();q(Ie,p),e.node.expanded&&(a.value=!0,r.value=!0);const f=o.props.props.children||"children";te(()=>{var t;const n=null==(t=e.node.data)?void 0:t[f];return n&&[...n]},()=>{e.node.updateChildren()}),te(()=>e.node.indeterminate,t=>{y(e.node.checked,t)}),te(()=>e.node.checked,t=>{y(t,e.node.indeterminate)}),te(()=>e.node.childNodes.length,()=>e.node.reInitChecked()),te(()=>e.node.expanded,e=>{z(()=>a.value=e),e&&(r.value=!0)});const v=e=>Ee(o.props.nodeKey,e.data),y=(t,n)=>{s.value===t&&i.value===n||o.ctx.emit("check-change",e.node.data,t,n),s.value=t,i.value=n},g=()=>{e.node.isLeaf||(a.value?(o.ctx.emit("node-collapse",e.node.data,e.node,p),e.node.collapse()):e.node.expand(()=>{t.emit("node-expand",e.node.data,e.node,p)}))},N=t=>{e.node.setChecked(t,!(null==o?void 0:o.props.checkStrictly)),z(()=>{const t=o.store.value;o.ctx.emit("check",e.node.data,{checkedNodes:t.getCheckedNodes(),checkedKeys:t.getCheckedKeys(),halfCheckedNodes:t.getHalfCheckedNodes(),halfCheckedKeys:t.getHalfCheckedKeys()})})};return{ns:n,node$:l,tree:o,expanded:a,childNodeRendered:r,oldChecked:s,oldIndeterminate:i,getNodeKey:v,getNodeClass:t=>{const n=e.props.class;if(!n)return{};let d;if(L(n)){const{data:e}=t;d=n(e,t)}else d=n;return T(d)?{[d]:!0}:d},handleSelectChange:y,handleClick:t=>{De(o.store,o.ctx.emit,()=>{var t;if(null==(t=null==o?void 0:o.props)?void 0:t.nodeKey){const t=v(e.node);o.store.value.setCurrentNodeKey(t)}else o.store.value.setCurrentNode(e.node)}),o.currentNode.value=e.node,o.props.expandOnClickNode&&g(),(o.props.checkOnClickNode||e.node.isLeaf&&o.props.checkOnClickLeaf&&e.showCheckbox)&&!e.node.disabled&&N(!e.node.checked),o.ctx.emit("node-click",e.node.data,e.node,p,t)},handleContextMenu:t=>{var n;(null==(n=o.instance.vnode.props)?void 0:n.onNodeContextmenu)&&(t.stopPropagation(),t.preventDefault()),o.ctx.emit("node-contextmenu",t,e.node.data,e.node,p)},handleExpandIconClick:g,handleCheckChange:N,handleChildNodeExpand:(e,t,n)=>{d(t),o.ctx.emit("node-expand",e,t,n)},handleDragStart:t=>{o.props.draggable&&c.treeNodeDragStart({event:t,treeNode:e})},handleDragOver:t=>{t.preventDefault(),o.props.draggable&&c.treeNodeDragOver({event:t,treeNode:{$el:l.value,node:e.node}})},handleDrop:e=>{e.preventDefault()},handleDragEnd:e=>{o.props.draggable&&c.treeNodeDragEnd(e)},CaretRight:ne}}});const qe=K(l(c({name:"ElTree",components:{ElTreeNode:l(Me,[["render",function(e,t,n,d,o,a){const r=H("el-icon"),s=H("el-checkbox"),i=H("loading"),l=H("node-content"),c=H("el-tree-node"),h=H("el-collapse-transition");return R((N(),W("div",{ref:"node$",class:b([e.ns.b("node"),e.ns.is("expanded",e.expanded),e.ns.is("current",e.node.isCurrent),e.ns.is("hidden",!e.node.visible),e.ns.is("focusable",!e.node.disabled),e.ns.is("checked",!e.node.disabled&&e.node.checked),e.getNodeClass(e.node)]),role:"treeitem",tabindex:"-1","aria-expanded":e.expanded,"aria-disabled":e.node.disabled,"aria-checked":e.node.checked,draggable:e.tree.props.draggable,"data-key":e.getNodeKey(e.node),onClick:X(e.handleClick,["stop"]),onContextmenu:e.handleContextMenu,onDragstart:X(e.handleDragStart,["stop"]),onDragover:X(e.handleDragOver,["stop"]),onDragend:X(e.handleDragEnd,["stop"]),onDrop:X(e.handleDrop,["stop"])},[G("div",{class:b(e.ns.be("node","content")),style:x({paddingLeft:(e.node.level-1)*e.tree.props.indent+"px"})},[e.tree.props.icon||e.CaretRight?(N(),g(r,{key:0,class:b([e.ns.be("node","expand-icon"),e.ns.is("leaf",e.node.isLeaf),{expanded:!e.node.isLeaf&&e.expanded}]),onClick:X(e.handleExpandIconClick,["stop"])},{default:k(()=>[(N(),g(E(e.tree.props.icon||e.CaretRight)))]),_:1},8,["class","onClick"])):Y("v-if",!0),e.showCheckbox?(N(),g(s,{key:1,"model-value":e.node.checked,indeterminate:e.node.indeterminate,disabled:!!e.node.disabled,onClick:X(()=>{},["stop"]),onChange:e.handleCheckChange},null,8,["model-value","indeterminate","disabled","onClick","onChange"])):Y("v-if",!0),e.node.loading?(N(),g(r,{key:2,class:b([e.ns.be("node","loading-icon"),e.ns.is("loading")])},{default:k(()=>[V(i)]),_:1},8,["class"])):Y("v-if",!0),V(l,{node:e.node,"render-content":e.renderContent},null,8,["node","render-content"])],6),V(h,null,{default:k(()=>[!e.renderAfterExpand||e.childNodeRendered?R((N(),W("div",{key:0,class:b(e.ns.be("node","children")),role:"group","aria-expanded":e.expanded,onClick:X(()=>{},["stop"])},[(N(!0),W(J,null,Z(e.node.childNodes,t=>(N(),g(c,{key:e.getNodeKey(t),"render-content":e.renderContent,"render-after-expand":e.renderAfterExpand,"show-checkbox":e.showCheckbox,node:t,accordion:e.accordion,props:e.props,onNodeExpand:e.handleChildNodeExpand},null,8,["render-content","render-after-expand","show-checkbox","node","accordion","props","onNodeExpand"]))),128))],10,["aria-expanded","onClick"])),[[U,e.expanded]]):Y("v-if",!0)]),_:1})],42,["aria-expanded","aria-disabled","aria-checked","draggable","data-key","onClick","onContextmenu","onDragstart","onDragover","onDragend","onDrop"])),[[U,e.node.visible]])}],["__file","tree-node.vue"]])},props:{data:{type:le(Array),default:()=>[]},emptyText:{type:String},renderAfterExpand:{type:Boolean,default:!0},nodeKey:String,checkStrictly:Boolean,defaultExpandAll:Boolean,expandOnClickNode:{type:Boolean,default:!0},checkOnClickNode:Boolean,checkOnClickLeaf:{type:Boolean,default:!0},checkDescendants:Boolean,autoExpandParent:{type:Boolean,default:!0},defaultCheckedKeys:Array,defaultExpandedKeys:Array,currentNodeKey:[String,Number],renderContent:{type:le(Function)},showCheckbox:Boolean,draggable:Boolean,allowDrag:{type:le(Function)},allowDrop:{type:le(Function)},props:{type:Object,default:()=>({children:"children",label:"label",disabled:"disabled"})},lazy:Boolean,highlightCurrent:Boolean,load:Function,filterNodeMethod:Function,accordion:Boolean,indent:{type:Number,default:18},icon:{type:ie}},emits:["check-change","current-change","node-click","node-contextmenu","node-collapse","node-expand","check","node-drag-start","node-drag-end","node-drop","node-drag-leave","node-drag-enter","node-drag-over"],setup(e,t){const{t:n}=ce(),d=u("tree"),o=j(ue,null),a=h(new Le({key:e.nodeKey,data:e.data,lazy:e.lazy,props:e.props,load:e.load,currentNodeKey:e.currentNodeKey,checkStrictly:e.checkStrictly,checkDescendants:e.checkDescendants,defaultCheckedKeys:e.defaultCheckedKeys,defaultExpandedKeys:e.defaultExpandedKeys,autoExpandParent:e.autoExpandParent,defaultExpandAll:e.defaultExpandAll,filterNodeMethod:e.filterNodeMethod}));a.value.initialize();const r=h(a.value.root),s=h(null),i=h(null),l=h(null),{broadcastExpanded:c}=ze(e),{dragState:f}=function({props:e,ctx:t,el$:n,dropIndicator$:d,store:o}){const a=u("tree"),r=h({showDropIndicator:!1,draggingNode:null,dropNode:null,allowDrop:!0,dropType:null});return q(je,{treeNodeDragStart:({event:n,treeNode:d})=>{if(n.dataTransfer){if(L(e.allowDrag)&&!e.allowDrag(d.node))return n.preventDefault(),!1;n.dataTransfer.effectAllowed="move";try{n.dataTransfer.setData("text/plain","")}catch(o){}r.value.draggingNode=d,t.emit("node-drag-start",d.node,n)}},treeNodeDragOver:({event:o,treeNode:s})=>{if(!o.dataTransfer)return;const i=s,l=r.value.dropNode;l&&l.node.id!==i.node.id&&P(l.$el,a.is("drop-inner"));const c=r.value.draggingNode;if(!c||!i)return;let h=!0,u=!0,p=!0,f=!0;L(e.allowDrop)&&(h=e.allowDrop(c.node,i.node,"prev"),f=u=e.allowDrop(c.node,i.node,"inner"),p=e.allowDrop(c.node,i.node,"next")),o.dataTransfer.dropEffect=u||h||p?"move":"none",(h||u||p)&&(null==l?void 0:l.node.id)!==i.node.id&&(l&&t.emit("node-drag-leave",c.node,l.node,o),t.emit("node-drag-enter",c.node,i.node,o)),r.value.dropNode=h||u||p?i:null,i.node.nextSibling===c.node&&(p=!1),i.node.previousSibling===c.node&&(h=!1),i.node.contains(c.node,!1)&&(u=!1),(c.node===i.node||c.node.contains(i.node))&&(h=!1,u=!1,p=!1);const v=i.$el,y=v.querySelector(`.${a.be("node","content")}`).getBoundingClientRect(),g=n.value.getBoundingClientRect();let N;const k=h?u?.25:p?.45:1:Number.NEGATIVE_INFINITY,C=p?u?.75:h?.55:0:Number.POSITIVE_INFINITY;let x=-9999;const b=o.clientY-y.top;N=b<y.height*k?"before":b>y.height*C?"after":u?"inner":"none";const m=v.querySelector(`.${a.be("node","expand-icon")}`).getBoundingClientRect(),E=d.value;"before"===N?x=m.top-g.top:"after"===N&&(x=m.bottom-g.top),E.style.top=`${x}px`,E.style.left=m.right-g.left+"px","inner"===N?F(v,a.is("drop-inner")):P(v,a.is("drop-inner")),r.value.showDropIndicator="before"===N||"after"===N,r.value.allowDrop=r.value.showDropIndicator||f,r.value.dropType=N,t.emit("node-drag-over",c.node,i.node,o)},treeNodeDragEnd:e=>{var n,d;const{draggingNode:s,dropType:i,dropNode:l}=r.value;if(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="move"),(null==s?void 0:s.node.data)&&l){const r={data:s.node.data};"none"!==i&&s.node.remove(),"before"===i?null==(n=l.node.parent)||n.insertBefore(r,l.node):"after"===i?null==(d=l.node.parent)||d.insertAfter(r,l.node):"inner"===i&&l.node.insertChild(r),"none"!==i&&(o.value.registerNode(r),o.value.key&&s.node.eachNode(e=>{var t;null==(t=o.value.nodesMap[e.data[o.value.key]])||t.setChecked(e.checked,!o.value.checkStrictly)})),P(l.$el,a.is("drop-inner")),t.emit("node-drag-end",s.node,l.node,i,e),"none"!==i&&t.emit("node-drop",s.node,l.node,i,e)}s&&!l&&t.emit("node-drag-end",s.node,null,i,e),r.value.showDropIndicator=!1,r.value.draggingNode=null,r.value.dropNode=null,r.value.allowDrop=!0}}),{dragState:r}}({props:e,ctx:t,el$:i,dropIndicator$:l,store:a});!function({el$:e},t){const n=u("tree");function d(e,n){var d,o;const a=t.value.getNode(e[n].dataset.key);return a.canFocus&&a.visible&&((null==(d=a.parent)?void 0:d.expanded)||0===(null==(o=a.parent)?void 0:o.level))}v(()=>{o()}),y(()=>{Array.from(e.value.querySelectorAll("input[type=checkbox]")).forEach(e=>{e.setAttribute("tabindex","-1")})}),oe(e,"keydown",t=>{const o=t.target;if(!o.className.includes(n.b("node")))return;const a=ae(t),r=Array.from(e.value.querySelectorAll(`.${n.is("focusable")}[role=treeitem]`)),s=r.indexOf(o);let i;if([re.up,re.down].includes(a)){if(t.preventDefault(),a===re.up){i=-1===s?0:0!==s?s-1:r.length-1;const e=i;for(;!d(r,i);){if(i--,i===e){i=-1;break}i<0&&(i=r.length-1)}}else{i=-1===s?0:s<r.length-1?s+1:0;const e=i;for(;!d(r,i);){if(i++,i===e){i=-1;break}i>=r.length&&(i=0)}}-1!==i&&r[i].focus()}[re.left,re.right].includes(a)&&(t.preventDefault(),o.click());const l=o.querySelector('[type="checkbox"]');[re.enter,re.numpadEnter,re.space].includes(a)&&l&&(t.preventDefault(),l.click())});const o=()=>{var t;if(!e.value)return;const d=Array.from(e.value.querySelectorAll(`.${n.is("focusable")}[role=treeitem]`));Array.from(e.value.querySelectorAll("input[type=checkbox]")).forEach(e=>{e.setAttribute("tabindex","-1")});const o=e.value.querySelectorAll(`.${n.is("checked")}[role=treeitem]`);o.length?o[0].setAttribute("tabindex","0"):null==(t=d[0])||t.setAttribute("tabindex","0")}}({el$:i},a);const g=p(()=>{const{childNodes:e}=r.value,t=!!o&&0!==o.hasFilteredOptions;return(!e||0===e.length||e.every(({visible:e})=>!e))&&!t});te(()=>e.currentNodeKey,e=>{a.value.setCurrentNodeKey(null!=e?e:null)}),te(()=>e.defaultCheckedKeys,(e,t)=>{he(e,t)||a.value.setDefaultCheckedKey(null!=e?e:[])}),te(()=>e.defaultExpandedKeys,e=>{a.value.setDefaultExpandedKeys(null!=e?e:[])}),te(()=>e.data,e=>{a.value.setData(e)},{deep:!0}),te(()=>e.checkStrictly,e=>{a.value.checkStrictly=e});const N=()=>{const e=a.value.getCurrentNode();return e?e.data:null};return q(Te,{ctx:t,props:e,store:a,root:r,currentNode:s,instance:de()}),q(ye,void 0),{ns:d,store:a,root:r,currentNode:s,dragState:f,el$:i,dropIndicator$:l,isEmpty:g,filter:t=>{if(!e.filterNodeMethod)throw new Error("[Tree] filterNodeMethod is required when filter");a.value.filter(t)},getNodeKey:t=>Ee(e.nodeKey,t.data),getNodePath:t=>{if(!e.nodeKey)throw new Error("[Tree] nodeKey is required in getNodePath");const n=a.value.getNode(t);if(!n)return[];const d=[n.data];let o=n.parent;for(;o&&o!==r.value;)d.push(o.data),o=o.parent;return d.reverse()},getCheckedNodes:(e,t)=>a.value.getCheckedNodes(e,t),getCheckedKeys:e=>a.value.getCheckedKeys(e),getCurrentNode:N,getCurrentKey:()=>{if(!e.nodeKey)throw new Error("[Tree] nodeKey is required in getCurrentKey");const t=N();return t?t[e.nodeKey]:null},setCheckedNodes:(t,n)=>{if(!e.nodeKey)throw new Error("[Tree] nodeKey is required in setCheckedNodes");a.value.setCheckedNodes(t,n)},setCheckedKeys:(t,n)=>{if(!e.nodeKey)throw new Error("[Tree] nodeKey is required in setCheckedKeys");a.value.setCheckedKeys(t,n)},setChecked:(e,t,n)=>{a.value.setChecked(e,t,n)},getHalfCheckedNodes:()=>a.value.getHalfCheckedNodes(),getHalfCheckedKeys:()=>a.value.getHalfCheckedKeys(),setCurrentNode:(n,d=!0)=>{if(!e.nodeKey)throw new Error("[Tree] nodeKey is required in setCurrentNode");De(a,t.emit,()=>{c(n),a.value.setUserCurrentNode(n,d)})},setCurrentKey:(n,d=!0)=>{if(!e.nodeKey)throw new Error("[Tree] nodeKey is required in setCurrentKey");De(a,t.emit,()=>{c(),a.value.setCurrentNodeKey(null!=n?n:null,d)})},t:n,getNode:e=>a.value.getNode(e),remove:e=>{a.value.remove(e)},append:(e,t)=>{a.value.append(e,t)},insertBefore:(e,t)=>{a.value.insertBefore(e,t)},insertAfter:(e,t)=>{a.value.insertAfter(e,t)},handleNodeExpand:(e,n,d)=>{c(n),t.emit("node-expand",e,n,d)},updateKeyChildren:(t,n)=>{if(!e.nodeKey)throw new Error("[Tree] nodeKey is required in updateKeyChild");a.value.updateChildren(t,n)}}}}),[["render",function(e,t,n,d,o,a){const r=H("el-tree-node");return N(),W("div",{ref:"el$",class:b([e.ns.b(),e.ns.is("dragging",!!e.dragState.draggingNode),e.ns.is("drop-not-allow",!e.dragState.allowDrop),e.ns.is("drop-inner","inner"===e.dragState.dropType),{[e.ns.m("highlight-current")]:e.highlightCurrent}]),role:"tree"},[(N(!0),W(J,null,Z(e.root.childNodes,t=>(N(),g(r,{key:e.getNodeKey(t),node:t,props:e.props,accordion:e.accordion,"render-after-expand":e.renderAfterExpand,"show-checkbox":e.showCheckbox,"render-content":e.renderContent,onNodeExpand:e.handleNodeExpand},null,8,["node","props","accordion","render-after-expand","show-checkbox","render-content","onNodeExpand"]))),128)),e.isEmpty?(N(),W("div",{key:0,class:b(e.ns.e("empty-block"))},[C(e.$slots,"empty",{},()=>{var t;return[G("span",{class:b(e.ns.e("empty-text"))},se(null!=(t=e.emptyText)?t:e.t("el.tree.emptyText")),3)]})],2)):Y("v-if",!0),R(G("div",{ref:"dropIndicator$",class:b(e.ns.e("drop-indicator"))},null,2),[[U,e.dragState.showDropIndicator]])],2)}],["__file","tree.vue"]]));export{qe as E};