Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@dragv/react-draggable-tree

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dragv/react-draggable-tree - npm Package Compare versions

Comparing version
1.0.22
to
1.0.23
+1
-1
lib/index.js
/*! For license information please see index.js.LICENSE.txt */
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("react"));else if("function"==typeof define&&define.amd)define(["react"],t);else{var s="object"==typeof exports?t(require("react")):t(e.React);for(var n in s)("object"==typeof exports?exports:e)[n]=s[n]}}(self,(function(e){return t={42:(e,t)=>{var s;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var s=arguments[t];if(s){var r=typeof s;if("string"===r||"number"===r)e.push(s);else if(Array.isArray(s)){if(s.length){var i=o.apply(null,s);i&&e.push(i)}}else if("object"===r)if(s.toString===Object.prototype.toString)for(var a in s)n.call(s,a)&&s[a]&&e.push(a);else e.push(s.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(s=function(){return o}.apply(t,[]))||(e.exports=s)}()},848:(e,t,s)=>{(e.exports=s(506)(!1)).push([e.id,'\r\n.react-dragv-tree-wrap {\r\n display: flex;\r\n flex-direction: column;\r\n position: relative;\r\n}\r\n.react-dragv-tree_row {\r\n display: flex;\r\n align-items: center;\r\n}\r\n.react-dragv-tree_row-selected {\r\n background-color: #e0e0e0;\r\n}\r\n.react-dragv-tree_toggler {\r\n width: 10px;\r\n height: 10px;\r\n margin: 0px;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n}\r\n.react-dragv-tree_toggler:before {\r\n content: "";\r\n display: block;\r\n width: 5px;\r\n height: 5px;\r\n box-sizing: border-box;\r\n border-right: 1px solid gray;\r\n border-bottom: 1px solid gray;\r\n transform: rotate(45deg);\r\n transition: all linear 0.2s;\r\n visibility: hidden;\r\n}\r\n.react-dragv-tree_toggler-visible{\r\n margin-left: 10px;\r\n margin-right: 5px;\r\n}\r\n.react-dragv-tree_toggler-visible:before {\r\n visibility: visible;\r\n}\r\n.react-dragv-tree_toggler-collapsed:before {\r\n transform: rotate(-45deg);\r\n}\r\n.react-dragv-tree_dropOver {\r\n position: absolute;\r\n box-sizing: border-box;\r\n pointer-events: none;\r\n border: 2px solid #2196F3;\r\n}\r\n.react-dragv-tree_dropBetween {\r\n position: absolute;\r\n pointer-events: none;\r\n border: 1px solid #2196F3;\r\n}',""])},506:e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var s=function(e,t){var s,n=e[1]||"",o=e[3];if(!o)return n;if(t&&"function"==typeof btoa){var r=(s=o,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(s))))+" */"),i=o.sources.map((function(e){return"/*# sourceURL="+o.sourceRoot+e+" */"}));return[n].concat(i).concat([r]).join("\n")}return[n].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+s+"}":s})).join("")},t.i=function(e,s){"string"==typeof e&&(e=[[null,e,""]]);for(var n={},o=0;o<this.length;o++){var r=this[o][0];"number"==typeof r&&(n[r]=!0)}for(o=0;o<e.length;o++){var i=e[o];"number"==typeof i[0]&&n[i[0]]||(s&&!i[2]?i[2]=s:s&&(i[2]="("+i[2]+") and ("+s+")"),t.push(i))}},t}},944:(e,t,s)=>{var n=s(848);"string"==typeof n&&(n=[[e.id,n,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};s(688)(n,o),n.locals&&(e.exports=n.locals)},688:(e,t,s)=>{var n,o,r={},i=(n=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===o&&(o=n.apply(this,arguments)),o}),a=function(e){return document.querySelector(e)},l=function(e){var t={};return function(e){if("function"==typeof e)return e();if(void 0===t[e]){var s=a.call(this,e);if(window.HTMLIFrameElement&&s instanceof window.HTMLIFrameElement)try{s=s.contentDocument.head}catch(e){s=null}t[e]=s}return t[e]}}(),c=null,h=0,d=[],p=s(408);function f(e,t){for(var s=0;s<e.length;s++){var n=e[s],o=r[n.id];if(o){o.refs++;for(var i=0;i<o.parts.length;i++)o.parts[i](n.parts[i]);for(;i<n.parts.length;i++)o.parts.push(b(n.parts[i],t))}else{var a=[];for(i=0;i<n.parts.length;i++)a.push(b(n.parts[i],t));r[n.id]={id:n.id,refs:1,parts:a}}}}function u(e,t){for(var s=[],n={},o=0;o<e.length;o++){var r=e[o],i=t.base?r[0]+t.base:r[0],a={css:r[1],media:r[2],sourceMap:r[3]};n[i]?n[i].parts.push(a):s.push(n[i]={id:i,parts:[a]})}return s}function g(e,t){var s=l(e.insertInto);if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var n=d[d.length-1];if("top"===e.insertAt)n?n.nextSibling?s.insertBefore(t,n.nextSibling):s.appendChild(t):s.insertBefore(t,s.firstChild),d.push(t);else if("bottom"===e.insertAt)s.appendChild(t);else{if("object"!=typeof e.insertAt||!e.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var o=l(e.insertInto+" "+e.insertAt.before);s.insertBefore(t,o)}}function y(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e);var t=d.indexOf(e);t>=0&&d.splice(t,1)}function m(e){var t=document.createElement("style");return e.attrs.type="text/css",v(t,e.attrs),g(e,t),t}function v(e,t){Object.keys(t).forEach((function(s){e.setAttribute(s,t[s])}))}function b(e,t){var s,n,o,r;if(t.transform&&e.css){if(!(r=t.transform(e.css)))return function(){};e.css=r}if(t.singleton){var i=h++;s=c||(c=m(t)),n=x.bind(null,s,i,!1),o=x.bind(null,s,i,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(s=function(e){var t=document.createElement("link");return e.attrs.type="text/css",e.attrs.rel="stylesheet",v(t,e.attrs),g(e,t),t}(t),n=C.bind(null,s,t),o=function(){y(s),s.href&&URL.revokeObjectURL(s.href)}):(s=m(t),n=I.bind(null,s),o=function(){y(s)});return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else o()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=i()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var s=u(e,t);return f(s,t),function(e){for(var n=[],o=0;o<s.length;o++){var i=s[o];(a=r[i.id]).refs--,n.push(a)}for(e&&f(u(e,t),t),o=0;o<n.length;o++){var a;if(0===(a=n[o]).refs){for(var l=0;l<a.parts.length;l++)a.parts[l]();delete r[a.id]}}}};var w,S=(w=[],function(e,t){return w[e]=t,w.filter(Boolean).join("\n")});function x(e,t,s,n){var o=s?"":n.css;if(e.styleSheet)e.styleSheet.cssText=S(t,o);else{var r=document.createTextNode(o),i=e.childNodes;i[t]&&e.removeChild(i[t]),i.length?e.insertBefore(r,i[t]):e.appendChild(r)}}function I(e,t){var s=t.css,n=t.media;if(n&&e.setAttribute("media",n),e.styleSheet)e.styleSheet.cssText=s;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(s))}}function C(e,t,s){var n=s.css,o=s.sourceMap,r=void 0===t.convertToAbsoluteUrls&&o;(t.convertToAbsoluteUrls||r)&&(n=p(n)),o&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var i=new Blob([n],{type:"text/css"}),a=e.href;e.href=URL.createObjectURL(i),a&&URL.revokeObjectURL(a)}},408:e=>{e.exports=function(e){var t="undefined"!=typeof window&&window.location;if(!t)throw new Error("fixUrls requires window.location");if(!e||"string"!=typeof e)return e;var s=t.protocol+"//"+t.host,n=s+t.pathname.replace(/\/[^\/]*$/,"/");return e.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(e,t){var o,r=t.trim().replace(/^"(.*)"$/,(function(e,t){return t})).replace(/^'(.*)'$/,(function(e,t){return t}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r)?e:(o=0===r.indexOf("//")?r:0===r.indexOf("/")?s+r:n+r.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")}))}},766:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DropIndicator=void 0;const n=s(359),o=s(42);class r extends n.Component{constructor(){super(...arguments),this.state={type:"none",index:0,depth:0}}render(){const{type:e,index:t,depth:s}=this.state,{rowHeight:r,indent:i}=this.props,a=t*r,l={left:"0",top:`${a}px`,width:"100%",height:`${r}px`},c={top:a-1+"px",height:"0",left:(s+1)*i+"px",width:`calc(100% - ${(s+1)*i}px)`};return n.createElement("div",null,n.createElement("div",{className:(0,o.default)("react-dragv-tree_dropOver",this.props.dropOverClassName),hidden:"over"!==e,style:l}),n.createElement("div",{className:(0,o.default)("react-dragv-tree_dropBetween",this.props.dropBetweenClassName),hidden:"between"!==e,style:c}))}}t.DropIndicator=r},695:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Toggler=void 0;const n=s(359),o=s(42);t.Toggler=function(e){const t=(0,o.default)("react-dragv-tree_toggler",{"react-dragv-tree_toggler-visible":e.visible,"react-dragv-tree_toggler-collapsed":e.collapsed});return n.createElement("div",{className:t,onClick:e.onClick})}},691:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Tree=t.guid=void 0;const n=s(359),o=s(42),r=s(916);s(944),t.guid=(e=32,t=!0,s=null)=>{const n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),o=[];if(s=s||n.length,e)for(let t=0;t<e;t++)o[t]=n[0|Math.random()*s];else{let e;o[8]=o[13]=o[18]=o[23]="-",o[14]="4";for(let t=0;t<36;t++)o[t]||(e=0|16*Math.random(),o[t]=n[19==t?3&e|8:e])}return t?(o.shift(),"u"+o.join("")):o.join("")};class i{constructor(e,t,s=!1,n,o,r,i,a,l,c,h){this.title=e,this.children=t,this.collapsed=s,this.key=n,this.id=o,this.img=r,this._package=i,this.show=a,this.pid=l,this.lock=c,this.config=h}getDescendant(e){return 0==e.length?this:this.children?this.children[e[0]].getDescendant(e.slice(1)):void 0}clone(){return new i(this.title,this.children?this.children.map((e=>e.clone())):void 0,this.collapsed,this.key,this.id,this.img,this._package,this.show,this.pid,this.lock,this.config)}static setParamVal(e,t,s,n){if(t&&(e[t]=s),n&&"function"==typeof n&&n(e),e.children&&e.children.length>0)for(let o=0,r=e.children.length;o<r;o++){const r=e.children[o];t&&(r[t]=s);const a=r.children||void 0;a&&a.length>0?i.setParamVal(r,t,s,n):n&&"function"==typeof n&&n(r)}}static generate(e){let t=e.children||void 0;if(t&&t.length>0){t=[];for(let s=0,n=e.children.length;s<n;s++)t.push(i.generate(e.children[s]))}const s=e.title,n=e.collapsed,o=e.key,r=e.id,a=e.img,l=e.package||e._package,c=e.show,h=e.pid,d=e.lock,p=e.config;return new i(s,t,n,o,r,a,l,c,h,d,p)}}const a=(e,t)=>{t&&t.size>0&&((null==t?void 0:t.has(e.key))?e.collapsed=!1:e.collapsed=!0);const s={children:(null==e?void 0:e.children)&&(null==e?void 0:e.children.map((e=>a(e,t)))),key:e.key,collapsed:e.collapsed,img:e.img,package:e._package,show:e.show,pid:e.pid,title:e.title,lock:e.lock,id:e.id,config:e.config};return Object.keys(s).filter((e=>null!=s[e]&&"{}"!==JSON.stringify(s[e]))).reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:s[t]})),{})};class l extends n.Component{constructor(e){super(e),this.treeViewRef=n.createRef(),this.clearSelectedKeys=()=>{var e;(this.state.selectedKeys.size>0||(null===(e=this.state.selectedNode)||void 0===e?void 0:e.length)>0)&&this.setState({selectedKeys:new Set([]),selectedNode:[]})},this.renderRow=e=>{const t=this.state.root.getDescendant(e.path),{selected:s}=e;return this.props.renderRow?this.props.renderRow(e.node,s,e,this.delItem,this.copyItem,this.setItemParams,this.groupTree):n.createElement("div",{className:(0,o.default)("example-cell",{selected:s})},t.title)},this.onContextMenu=(e,t)=>{this.props.onChange&&this.props.onChange("onContextMenu",{info:e,ev:t})},this.onSelectedKeysChange=(e,t)=>{this.setState({selectedKeys:e,selectedNode:t},(()=>{this.props.onChange&&this.props.onChange("onSelectedKeysChange",{selectedKeys:Array.from(e),selectedNode:t})}))},this.delItem=e=>{const{root:t,selectedKeys:s,selectedNode:n}=this.state;let o=[],r=[],i=[];if(e){const{path:s}=e,n=s[s.length-1];o.unshift(n);const a=t.getDescendant(s.slice(0,-1));r.unshift(a);const[l]=a.children.splice(n,1);i.unshift(l)}else if(s.size>0)for(let e=n.length-1;e>=0;e--){const{path:s}=n[e],a=s[s.length-1];o.unshift(a);const l=t.getDescendant(s.slice(0,-1));r.unshift(l);const[c]=l.children.splice(a,1);i.unshift(c)}this.setState({root:t,selectedNode:[],selectedKeys:new Set("")},(()=>{this.props.onChange&&this.props.onChange("onDelItem",{treeData:a(t).children,indexs:o,selectedNode:n,selectedKeys:Array.from(s),destItems:r.map((e=>a(e))),items:i.map((e=>a(e)))})}))},this.groupTree=(e,s)=>{const{root:n,selectedKeys:o,selectedNode:r}=this.state,l=[],c=[];let h;if(s){const{path:o,node:r}=s;if(!e&&!r.children)return;const a=o[o.length-1],d=n.getDescendant(o.slice(0,-1)),[p]=d.children.splice(a,1);if(c.unshift(p),l.unshift(n.getDescendant(o.slice(0,-1))),e){const e=(0,t.guid)(10);h=i.generate({title:"分组",children:c,id:e,key:e,collapsed:!1}),"function"==typeof this.props.groupItemFormatFunc&&this.props.groupItemFormatFunc&&this.props.groupItemFormatFunc(h),l[0].children.splice(o[o.length-1],0,h),l[0].collapsed=!1}else{const e=p;e.children&&e.children.length>0&&(l[0].children.splice(o[o.length-1],0,...e.children),l[0].collapsed=!1)}}else if(o.size>0){for(let t=r.length-1;t>=0;--t){const{path:s,node:o}=r[t];if(!e&&(!o.children||o.children<=0))break;const i=s[s.length-1],a=n.getDescendant(s.slice(0,-1)),[h]=a.children.splice(i,1);c.unshift(h),l.unshift(n.getDescendant(s.slice(0,-1)))}if(l.length<=0||c.length<=0)return;if(e){const e=(0,t.guid)(10);h=i.generate({title:"分组",children:c,id:e,key:e,collapsed:!1}),"function"==typeof this.props.groupItemFormatFunc&&this.props.groupItemFormatFunc&&this.props.groupItemFormatFunc(h);const s=r[0].path;l[0].children.splice(s[s.length-1],0,h),l[0].collapsed=!1}else l.forEach(((e,t)=>{const s=r[t],n=c[t];n.children&&n.children.length>0&&(e.children.splice(s.path[s.path.length-1],0,...n.children),e.collapsed=!1)}))}this.setState({root:n,selectedNode:r},(()=>{const t=new Set(c.map((e=>e.key))),s=this.getNodeArr(t);this.setState({selectedKeys:t,selectedNode:s},(()=>{this.props.onChange&&this.props.onChange(e?"onGroupTree":"onGroupTreeDel",{treeData:a(n).children,selectedNode:s,selectedKeys:Array.from(t),destItems:l.map((e=>a(e))),items:c.map((e=>a(e))),groupInfo:h&&a(h)||""})}))}))},this.pasteItem=(e,t,s,n=[])=>{var o;const{root:r}=this.state,l=[],c=[],h={};for(let s=t.length-1;s>=0;--s){const o=i.generate(t[s].node?t[s].node:t[s]).clone();(null==n?void 0:n.length)<=0&&"function"==typeof this.props.copyItemFormatFunc&&i.setParamVal(o,"","",(e=>{const t=e.id,s=this.props.copyItemFormatFunc&&this.props.copyItemFormatFunc(e);s&&(h[t]=s.id)})),c.unshift(o),l.unshift(r.getDescendant(e))}(null===(o=l[l.length-1].children)||void 0===o?void 0:o.length)?l[l.length-1].children.splice(e[e.length-1]+1,0,...c):l[l.length-1].children=c,l[l.length-1].collapsed=!1,this.setState({root:r},(()=>{const e=new Set(c.map((e=>e.key))),t=this.getNodeArr(e);this.setState({selectedKeys:e,selectedNode:t},(()=>{const o={treeData:a(r).children,selectedNode:t,selectedKeys:Array.from(e),mapping:h,diyData:s};(null==n?void 0:n.length)>0&&(o.trashIds=n),this.props.onChange&&this.props.onChange("onPaste",o)}))}))},this.copyItem=(e,t=!0)=>{const{root:s,selectedKeys:n,selectedNode:o}=this.state,r=[],l=[],c={};if(e){const{path:t}=e,n=t[t.length-1],o=s.getDescendant(t.slice(0,-1)).children[n].clone();"function"==typeof this.props.copyItemFormatFunc&&i.setParamVal(o,"","",(e=>{const t=e.id,s=this.props.copyItemFormatFunc&&this.props.copyItemFormatFunc(e);s&&(c[t]=s.id)})),l.unshift(o),r.unshift(s.getDescendant(t.slice(0,-1))),r[0].children.splice(n+1,0,o),r[0].collapsed=!1}else if(n.size>0){let e=null;for(let t=o.length-1;t>=0;--t){const{path:n}=o[t],a=n[n.length-1],h=s.getDescendant(n.slice(0,-1)).children[a].clone();"function"==typeof this.props.copyItemFormatFunc&&i.setParamVal(h,"","",(e=>{const t=e.id,s=this.props.copyItemFormatFunc&&this.props.copyItemFormatFunc(e);s&&(c[t]=s.id)})),l.unshift(h),r.unshift(s.getDescendant(n.slice(0,-1))),t===o.length-1&&(e=a)}t&&(r[r.length-1].children.splice(e+1,0,...l),r[r.length-1].collapsed=!1)}t?this.setState({root:s},(()=>{const e=new Set(l.map((e=>e.key))),t=this.getNodeArr(e);this.setState({selectedKeys:e,selectedNode:t},(()=>{this.props.onChange&&this.props.onChange("onCopyItem",{treeData:a(s).children,selectedNode:t,selectedKeys:Array.from(e),mapping:c})}))})):this.props.onChange&&this.props.onChange("onCopyItemNoPaste",{treeData:a(s).children,selectedNode:o,selectedKeys:Array.from(n),mapping:c})},this.getNodeArr=e=>this.treeViewRef.current.keysToInfos(e),this.setItemParams=(e,t,s)=>{const{root:n,selectedKeys:o,selectedNode:r}=this.state;let i=[],l=[],c=[];if(s){const{path:o,node:r}=s,a=o[o.length-1];i.unshift(a);const h=n.getDescendant(o.slice(0,-1));l.unshift(h);const d=h.children[a];c.unshift(d),d[e]="__toggle"===t&&"boolean"==typeof d[e]?!d[e]:t,r[e]=d[e]}else if(o.size>0)for(let s=r.length-1;s>=0;s--){const{path:o,node:a}=r[s],h=o[o.length-1];i.unshift(h);const d=n.getDescendant(o.slice(0,-1));l.unshift(d);const p=d.children[h];c.unshift(p),p[e]="__toggle"===t&&"boolean"==typeof p[e]?!p[e]:t,a[e]=p[e]}this.setState({root:n},(()=>{const s=this.getNodeArr(this.state.selectedKeys);this.setState({selectedNode:s},(()=>{this.props.onChange&&this.props.onChange("onSetItemParams",{indexs:i,params:e,value:t,treeData:a(n).children,selectedNode:s,selectedKeys:Array.from(this.state.selectedKeys),parents:l.map((e=>a(e))),items:c.map((e=>a(e)))})}))}))},this.expandTree=(e="single",t=!0)=>{const{root:s,selectedKeys:n,selectedNode:o}=this.state;if("single"===e){if(!n.size)return;for(let e=o.length-1;e>=0;e--){const{path:n,node:r}=o[e],i=n[n.length-1],a=s.getDescendant(n.slice(0,-1)).children[i];a.collapsed="__toggle"===t&&"boolean"==typeof a.collapsed?!a.collapsed:t,r.collapsed=a.collapsed}}else"all"===e&&i.setParamVal(s,"collapsed",t);this.setState({root:s,expandedKeys:new Set([])},(()=>{const n=this.getNodeArr(this.state.selectedKeys);this.setState({selectedNode:n},(()=>{this.props.onChange&&this.props.onChange("onExpandTree",{type:e,treeData:a(s).children,selectedNode:n,selectedKeys:Array.from(this.state.selectedKeys),collapsed:t})}))}))},this.setLayer=e=>{const{root:t,selectedKeys:s,selectedNode:n}=this.state;if(s.size)switch(e){case"upper":case"next":{const s=[],o=[];for(let r=n.length-1;r>=0;r--){const{path:i}=n[r],a=i[i.length-1],l=t.getDescendant(i.slice(0,-1)),[c]=l.children.splice(a,1);o.unshift(c),"next"===e?i[i.length-1]=parseInt(i)+1<l.children.length?parseInt(i)+1:l.children.length:"upper"===e&&(i[i.length-1]=i-1>0?i-1:0),s.unshift(t.getDescendant(i.slice(0,-1)))}s.forEach(((e,t)=>{const s=n[t];e.children.splice(s.path[s.path.length-1],0,o[t]),e.collapsed=!1})),this.setState({root:t,selectedNode:n},(()=>{const s=new Set(o.map((e=>e.key))),n=this.getNodeArr(s);this.setState({selectedKeys:s,selectedNode:n},(()=>{this.props.onChange&&this.props.onChange("onSetLayer",{type:e,treeData:a(t).children,selectedNode:n,selectedKeys:Array.from(s)})}))}));break}case"top":case"bottom":{const s=[],o=[];for(let r=n.length-1;r>=0;r--){const{path:i}=n[r],a=i[i.length-1],l=t.getDescendant(i.slice(0,-1)),[c]=l.children.splice(a,1);o.unshift(c),"top"===e?i[i.length-1]=0:"bottom"===e&&(i[i.length-1]=l.children.length),s.unshift(t.getDescendant(i.slice(0,-1)))}s.forEach(((t,s)=>{"top"===e?t.children.unshift(o[s]):"bottom"===e&&t.children.push(o[s]),t.collapsed=!1})),this.setState({root:t},(()=>{const s=new Set(o.map((e=>e.key))),n=this.getNodeArr(s);this.setState({selectedKeys:s,selectedNode:n},(()=>{this.props.onChange&&this.props.onChange("onSetLayer",{type:e,treeData:a(t).children,selectedNode:n,selectedKeys:Array.from(s)})}))}));break}}},this.onCollapsedChange=(e,t)=>{this.state.root.getDescendant(e.path).collapsed=t,this.setState({root:this.state.root,expandedKeys:new Set([])},(()=>{this.props.onChange&&this.props.onChange("onCollapsedChange",{treeData:a(this.state.root).children,info:e,collapsed:t})}))},this.onMove=(e,t,s,n)=>{const{root:o}=this.state,r=[];for(let t=e.length-1;t>=0;--t){const{path:s}=e[t],i=s[s.length-1],a=o.getDescendant(s.slice(0,-1)),[l]=a.children.splice(i,1);r.unshift(l),e[t].path=n}const i=o.getDescendant(n.slice(0,-1));i.children.splice(n[n.length-1],0,...r),i.collapsed=!1,this.setState({root:o},(()=>{const e=new Set(r.map((e=>e.key))),i=this.getNodeArr(e);this.setState({selectedKeys:e,selectedNode:i},(()=>{this.props.onChange&&this.props.onChange("onMove",{treeData:a(o).children,selectedNode:i,selectedKeys:Array.from(e),dest:t,destIndex:s,destPathAfterMove:n})}))}))},this.onCopy=(e,t,s)=>{const{root:n}=this.state,o=[],r={};for(let t=e.length-1;t>=0;--t){const{path:s}=e[t],a=s[s.length-1],l=n.getDescendant(s.slice(0,-1)).children[a].clone();"function"==typeof this.props.copyItemFormatFunc&&i.setParamVal(l,"","",(e=>{const t=e.id,s=this.props.copyItemFormatFunc&&this.props.copyItemFormatFunc(e);s&&(r[t]=s.id)})),o.unshift(l)}const l=n.getDescendant(t.path);l.children.splice(s,0,...o),l.collapsed=!1,this.setState({root:n},(()=>{const i=new Set(o.map((e=>e.key))),l=this.getNodeArr(i);this.setState({selectedKeys:i,selectedNode:l},(()=>{this.props.onChange&&this.props.onChange("onCopy",{treeData:a(n).children,selectedNode:l,selectedKeys:Array.from(i),src:e,dest:t,destIndex:s,mapping:r})}))}))};const s=i.generate({collapsed:!1,key:"root",title:"root",children:e.data});this.state={root:s,selectedKeys:new Set(e.selectedKeys||[]),selectedNode:[],expandedKeys:new Set([])}}componentDidUpdate(e,t){if(JSON.stringify(this.props.data)!==JSON.stringify(e.data)){const e=i.generate({collapsed:!1,key:"root",title:"root",children:this.props.data});this.setState({root:e})}JSON.stringify(this.props.selectedKeys)!==JSON.stringify(e.selectedKeys)&&this.setSelectedData(this.props.selectedKeys)}setSelectedData(e){const t=this.getNodeArr(new Set(e));this.setState({selectedKeys:new Set(e),selectedNode:t})}componentWillUnmount(){this.setState=(e,t)=>{}}render(){const{root:e,selectedKeys:t,expandedKeys:s}=this.state;return n.createElement(r.TreeView,{ref:this.treeViewRef,root:a(e,s),selectedKeys:t,expandedKeys:s,hoverBackground:this.props.hoverBackground||"#2C2F38",activeBackground:this.props.activeBackground||"#177ddc",searchVal:this.props.searchVal||"",rowHeight:this.props.rowHeight||40,indent:this.props.indent||20,className:this.props.className||"example-tree",rowContent:this.renderRow,onContextMenu:this.onContextMenu,onSelectedKeysChange:this.onSelectedKeysChange,onCollapsedChange:this.onCollapsedChange,onHover:this.props.onHover&&this.props.onHover,onMove:this.onMove,onCopy:this.onCopy,onSearchScroll:(e,t,s)=>{this.props.onChange&&this.props.onChange("onSearchScroll",{searchOffsetNum:e,offsetTop:t,id:s})},onSearch:(e,t,s,n,o)=>{this.setState({expandedKeys:new Set(o)},(()=>{this.props.onChange&&this.props.onChange("onSearch",{searchPathList:e,searchOffsetNum:t,offsetTop:s,id:n,expandedKeys:o})}))},onInit:(e,t)=>{this.setState({selectedKeys:e,selectedNode:t},(()=>{this.props.onChange&&this.props.onChange("onInit",{selectedKeys:e,selectedNode:t})}))}})}}t.Tree=l},874:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TreeView=void 0;const n=s(359),o=s(42),r=s(695),i=s(766),a=s(482),l="x-react-draggable-tree-drag";class c extends n.Component{constructor(e){super(e),this.infoToPath=new Map,this.pathToInfo=new Map,this.visibleInfos=[],this.keyToInfo=new Map,this.searchScroll=e=>{if(!this.state.searchPathList||this.state.searchPathList.length<=0)return;let t=this.state.searchOffsetNum;if("top"===e&&t>0)t--;else{if(!("bottom"===e&&t<this.state.searchPathList.length-1))return;t++}const s=document.querySelector(`.${this.props.className} [data-id="${this.state.searchPathList[t]}"]`),n=s&&t>=0&&t<=this.state.searchPathList.length?s.offsetTop:0;this.setState({searchOffsetNum:t},(()=>{this.props.onSearchScroll&&this.props.onSearchScroll(t+1,n,s?s.getAttribute("data-id"):"")}))},this.getParentElement=e=>!e||e.className.indexOf("react-dragv-tree-wrap")>-1?null:e.className.indexOf("react-dragv-tree_children")>-1?e:this.getParentElement(e.parentElement),this.searchEnv=e=>{if(""===e)return!1;requestAnimationFrame((()=>{var t;const s=document.querySelectorAll(`.${this.props.className} [data-id]`),n=[],o=[];for(let r=0,i=s.length;r<i;r++){const i=s[r].getAttribute("data-title");if(i&&i.indexOf(e)>-1){const e=s[r].getAttribute("data-id");n.includes(e)||n.push(e);const i=this.getParentElement(s[r]);i&&o.push(null===(t=i.previousSibling)||void 0===t?void 0:t.getAttribute("data-id"))}}const r=document.querySelector(`.${this.props.className} [data-id="${n[0]}"]`),i=(null==r?void 0:r.offsetTop)||0;this.setState({searchPathList:n,searchOffsetNum:0},(()=>{this.props.onSearch&&this.props.onSearch(n,r?1:0,i,r?r.getAttribute("data-id"):"",o)}))}))},this.onMouseOver=(e,t)=>{this.props.onHover&&this.props.onHover("mouseover",e,t)},this.onMouseLeave=(e,t)=>{this.props.onHover&&this.props.onHover("mouseleave",e,t)},this.onClickRow=(e,t)=>{var s;t.preventDefault(),t.stopPropagation();const n=new Map;for(const e of this.visibleInfos)if(null===(s=e.node)||void 0===s?void 0:s.children)for(const t of e.node.children)n.set(t.key,e);const{selectedKeys:o}=this.props,{key:r}=e.node;let i;if(t.ctrlKey||t.metaKey){let e=new Set,t=n.get(r);for(;t&&!e.has(t.node.key);)e.add(t.node.key),t=n.get(t.node.key);if(i=new Set(o),[...i].some((t=>e.has(t))))return;i.has(r)?i.delete(r):i.add(r)}else if(t.shiftKey&&o.size>0){const e=this.visibleInfos.map((e=>e.node.key)),t=this.keysToInfos(o).map((e=>e.visibleOffset)),s=e.indexOf(r),a=Math.min(s,...t),l=Math.max(s,...t),c=e.slice(a,l+1);i=new Set(o);for(const e of c){let t=new Set,s=n.get(e);for(;s&&!t.has(s.node.key);)t.add(s.node.key),s=n.get(s.node.key);[...i].some((e=>t.has(e)))||i.add(e)}}else i=new Set([r]);i=this.removeAncestorsFromSelection(i),this.props.onSelectedKeysChange(i,this.keysToInfos(i))},this.onContextMenu=e=>{const{rowHeight:t,selectedKeys:s}=this.props,{visibleInfos:n}=this,o=this.element.getBoundingClientRect(),r=e.clientY-o.top+this.element.scrollTop,i=Math.floor(r/t),a=0<=i&&i<n.length?n[i]:void 0;a&&!s.has(a.node.key)&&this.onClickRow(a,e),this.props.onContextMenu&&this.props.onContextMenu(a,e)},this.onDragOver=e=>{e.preventDefault();const t=e.altKey||e.ctrlKey;e.dataTransfer.dropEffect=t?"copy":"move";const s=this.getDropTarget(e);this.canDrop(s.dest,s.destIndex)?this.updateDropIndicator(s):this.updateDropIndicator(void 0)},this.onDrop=e=>{if(this.updateDropIndicator(void 0),!e.dataTransfer.getData(l))return;let{clientX:t,clientY:s}=e;const n=this.getDropTarget({clientX:t,clientY:s}),{dest:o,destIndex:r}=n;if(!this.canDrop(o,r))return;const i=this.keysToInfos(this.props.selectedKeys);if(e.altKey||e.ctrlKey)this.props.onCopy(i,o,r);else{const e=[...o.path,r],t=[...e];for(const s of i){const n=s.path.slice(0,-1),o=s.path[s.path.length-1];for(let s=0;s<e.length;++s){const r=e.slice(0,s),i=e[s];(0,a.isPathEqual)(n,r)&&o<i&&--t[s]}}this.props.onMove(i,o,r,t)}e.preventDefault()},this.state={searchPathList:[],searchOffsetNum:0}}componentWillUnmount(){this.setState=(e,t)=>{}}componentDidMount(){this.props.onInit&&this.props.onInit(this.props.selectedKeys,this.keysToInfos(this.props.selectedKeys))}render(){const{root:e,rowHeight:t,indent:s}=this.propsWithDefaults(),r=e.children||[];this.clearRows();const a={node:e,selected:!1,current:!1,path:[],visible:!1,visibleOffset:0};this.addRowInfo(a),this.rootInfo=a;const l=(0,o.default)("react-dragv-tree-wrap",this.props.className);return n.createElement("div",{ref:e=>this.element=e,className:l,onDragOver:this.onDragOver,onDrop:this.onDrop,onContextMenu:this.onContextMenu},r.map(((e,t)=>this.renderNode(e,[t],!0))),n.createElement(i.DropIndicator,{ref:e=>this.dropIndicator=e,rowHeight:t,indent:s,dropOverClassName:this.props.dropOverIndicatorClassName,dropBetweenClassName:this.props.dropBetweenIndicatorClassName}))}removeAncestorsFromSelection(e){const t=new Set(e);for(const{path:s}of this.keysToInfos(e))for(let e=1;e<s.length;++e){const n=s.slice(0,e),o=this.pathToInfo.get(n.join());o&&t.delete(o.node.key)}return t}propsWithDefaults(){return Object.assign({},{indent:20},this.props)}clearRows(){this.visibleInfos=[],this.pathToInfo.clear(),this.infoToPath.clear(),this.keyToInfo.clear()}addRowInfo(e){this.infoToPath.set(e,e.path),this.pathToInfo.set(e.path.join(),e),e.visible&&this.visibleInfos.push(e),this.keyToInfo.set(e.node.key,e)}renderNode(e,t,s){const{indent:i,rowHeight:a,selectedKeys:c}=this.propsWithDefaults(),{key:h}=e,d=c.has(h),p={node:e,selected:d,path:t,visible:s,visibleOffset:this.visibleInfos.length};this.addRowInfo(p);const f={paddingLeft:(t.length-1)*i+"px",height:a+"px"},u=(0,o.default)("react-dragv-tree_row",this.props.rowClassName,d&&this.props.rowSelectedClassName,{"react-dragv-tree_row-selected":d}),{children:g,collapsed:y}=e,m=this.props.toggler||r.Toggler,v=this.props.rowContent;let b=n.createElement("div",{key:`row-${h}`,className:u,style:f,onClick:e=>this.onClickRow(p,e),onMouseOver:e=>this.onMouseOver(p,e),onMouseLeave:e=>this.onMouseLeave(p,e),"data-title":e.title,"data-id":e.id,draggable:!0,onDragStart:e=>{if(e.dataTransfer.effectAllowed="copyMove",e.dataTransfer.setData(l,"drag"),!c.has(h)){const e=new Set([h]);this.props.onSelectedKeysChange(e,this.keysToInfos(e))}},onDragEnd:()=>{this.updateDropIndicator(void 0)}},n.createElement(m,{visible:!!g,collapsed:y,onClick:t=>{t.preventDefault(),t.stopPropagation(),e.children&&(this.props.onCollapsedChange(p,!y),t.stopPropagation())}}),n.createElement(v,Object.assign({},p)));if(g){const e=s&&!y,r=(0,o.default)("react-dragv-tree_children",this.props.childrenClassName);return[b,n.createElement("div",{key:`children-${h}`,className:r,hidden:y},g.map(((s,n)=>this.renderNode(s,[...t,n],e))))]}return[b]}keysToInfos(e){const t=[];return e.forEach((e=>{const s=this.keyToInfo.get(e);s&&t.push(s)})),t.sort(((e,t)=>(0,a.comparePaths)(e.path,t.path))),t}updateDropIndicator(e){if(e){const{type:t,index:s,depth:n}=e;this.dropIndicator.setState({type:t,index:s,depth:n})}else this.dropIndicator.setState({type:"none",index:0,depth:0})}getDropTarget(e){const{rowHeight:t,indent:s}=this.propsWithDefaults(),n=this.element.getBoundingClientRect(),o=e.clientX-n.left+this.element.scrollLeft,r=e.clientY-n.top+this.element.scrollTop,i=(0,a.clamp)(Math.floor(r/t),0,this.visibleInfos.length),l=r-i*t;if(i<this.visibleInfos.length&&.25*t<l&&l<.75*t){const e=this.visibleInfos[i];if(e.node.children)return{type:"over",index:i,dest:e,destIndex:0,depth:0}}const c=(0,a.clamp)(l<t/2?i:i+1,0,this.visibleInfos.length);let h=c===this.visibleInfos.length?[this.rootInfo.node.children.length]:this.visibleInfos[c].path;if(0<c){const e=this.visibleInfos[c-1];let t=e.path;const n=e.node.children,r=e.node.collapsed;if(n&&0===n.length&&!r&&(t=[...t,-1]),h.length<t.length){const e=(0,a.clamp)(Math.floor(o/s)-1,h.length,t.length);h=[...t.slice(0,e-1),t[e-1]+1]}}const d=h.slice(0,-1);return{type:"between",index:c,dest:this.pathToInfo.get(d.join()),destIndex:h[h.length-1],depth:h.length-1}}canDrop(e,t){const{selectedKeys:s}=this.props,{path:n}=e;for(let e=0;e<n.length;++e){const t=n.slice(0,n.length-e),o=this.pathToInfo.get(t.join());if(o){const e=o.node.key;if(s.has(e))return!1}}return!0}}t.TreeView=c},916:function(e,t,s){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,s,n){void 0===n&&(n=s),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[s]}})}:function(e,t,s,n){void 0===n&&(n=s),e[n]=t[s]}),o=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||n(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),o(s(502),t),o(s(874),t),o(s(691),t),o(s(695),t),o(s(766),t)},502:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},482:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isPathEqual=t.comparePaths=t.clamp=void 0,t.clamp=function(e,t,s){return Math.max(t,Math.min(e,s))},t.comparePaths=function(e,t){for(let s=0;;++s){if(e.length===s&&t.length===s)return 0;if(e.length===s||e[s]<t[s])return-1;if(t.length===s||t[s]<e[s])return 1}},t.isPathEqual=function(e,t){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(e[s]!==t[s])return!1;return!0}},359:t=>{"use strict";t.exports=e}},s={},n=function e(n){var o=s[n];if(void 0!==o)return o.exports;var r=s[n]={id:n,exports:{}};return t[n].call(r.exports,r,r.exports,e),r.exports}(916),n;var t,s,n}));
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("react"));else if("function"==typeof define&&define.amd)define(["react"],t);else{var s="object"==typeof exports?t(require("react")):t(e.React);for(var n in s)("object"==typeof exports?exports:e)[n]=s[n]}}(self,(function(e){return t={42:(e,t)=>{var s;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var s=arguments[t];if(s){var r=typeof s;if("string"===r||"number"===r)e.push(s);else if(Array.isArray(s)){if(s.length){var i=o.apply(null,s);i&&e.push(i)}}else if("object"===r)if(s.toString===Object.prototype.toString)for(var a in s)n.call(s,a)&&s[a]&&e.push(a);else e.push(s.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(s=function(){return o}.apply(t,[]))||(e.exports=s)}()},848:(e,t,s)=>{(e.exports=s(506)(!1)).push([e.id,'\r\n.react-dragv-tree-wrap {\r\n display: flex;\r\n flex-direction: column;\r\n position: relative;\r\n}\r\n.react-dragv-tree_row {\r\n display: flex;\r\n align-items: center;\r\n}\r\n.react-dragv-tree_row-selected {\r\n background-color: #e0e0e0;\r\n}\r\n.react-dragv-tree_toggler {\r\n width: 10px;\r\n height: 10px;\r\n margin: 0px;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n}\r\n.react-dragv-tree_toggler:before {\r\n content: "";\r\n display: block;\r\n width: 5px;\r\n height: 5px;\r\n box-sizing: border-box;\r\n border-right: 1px solid gray;\r\n border-bottom: 1px solid gray;\r\n transform: rotate(45deg);\r\n transition: all linear 0.2s;\r\n visibility: hidden;\r\n}\r\n.react-dragv-tree_toggler-visible{\r\n margin-left: 10px;\r\n margin-right: 5px;\r\n}\r\n.react-dragv-tree_toggler-visible:before {\r\n visibility: visible;\r\n}\r\n.react-dragv-tree_toggler-collapsed:before {\r\n transform: rotate(-45deg);\r\n}\r\n.react-dragv-tree_dropOver {\r\n position: absolute;\r\n box-sizing: border-box;\r\n pointer-events: none;\r\n border: 2px solid #2196F3;\r\n}\r\n.react-dragv-tree_dropBetween {\r\n position: absolute;\r\n pointer-events: none;\r\n border: 1px solid #2196F3;\r\n}',""])},506:e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var s=function(e,t){var s,n=e[1]||"",o=e[3];if(!o)return n;if(t&&"function"==typeof btoa){var r=(s=o,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(s))))+" */"),i=o.sources.map((function(e){return"/*# sourceURL="+o.sourceRoot+e+" */"}));return[n].concat(i).concat([r]).join("\n")}return[n].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+s+"}":s})).join("")},t.i=function(e,s){"string"==typeof e&&(e=[[null,e,""]]);for(var n={},o=0;o<this.length;o++){var r=this[o][0];"number"==typeof r&&(n[r]=!0)}for(o=0;o<e.length;o++){var i=e[o];"number"==typeof i[0]&&n[i[0]]||(s&&!i[2]?i[2]=s:s&&(i[2]="("+i[2]+") and ("+s+")"),t.push(i))}},t}},944:(e,t,s)=>{var n=s(848);"string"==typeof n&&(n=[[e.id,n,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};s(688)(n,o),n.locals&&(e.exports=n.locals)},688:(e,t,s)=>{var n,o,r={},i=(n=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===o&&(o=n.apply(this,arguments)),o}),a=function(e){return document.querySelector(e)},l=function(e){var t={};return function(e){if("function"==typeof e)return e();if(void 0===t[e]){var s=a.call(this,e);if(window.HTMLIFrameElement&&s instanceof window.HTMLIFrameElement)try{s=s.contentDocument.head}catch(e){s=null}t[e]=s}return t[e]}}(),c=null,h=0,d=[],p=s(408);function f(e,t){for(var s=0;s<e.length;s++){var n=e[s],o=r[n.id];if(o){o.refs++;for(var i=0;i<o.parts.length;i++)o.parts[i](n.parts[i]);for(;i<n.parts.length;i++)o.parts.push(b(n.parts[i],t))}else{var a=[];for(i=0;i<n.parts.length;i++)a.push(b(n.parts[i],t));r[n.id]={id:n.id,refs:1,parts:a}}}}function u(e,t){for(var s=[],n={},o=0;o<e.length;o++){var r=e[o],i=t.base?r[0]+t.base:r[0],a={css:r[1],media:r[2],sourceMap:r[3]};n[i]?n[i].parts.push(a):s.push(n[i]={id:i,parts:[a]})}return s}function g(e,t){var s=l(e.insertInto);if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var n=d[d.length-1];if("top"===e.insertAt)n?n.nextSibling?s.insertBefore(t,n.nextSibling):s.appendChild(t):s.insertBefore(t,s.firstChild),d.push(t);else if("bottom"===e.insertAt)s.appendChild(t);else{if("object"!=typeof e.insertAt||!e.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var o=l(e.insertInto+" "+e.insertAt.before);s.insertBefore(t,o)}}function y(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e);var t=d.indexOf(e);t>=0&&d.splice(t,1)}function m(e){var t=document.createElement("style");return e.attrs.type="text/css",v(t,e.attrs),g(e,t),t}function v(e,t){Object.keys(t).forEach((function(s){e.setAttribute(s,t[s])}))}function b(e,t){var s,n,o,r;if(t.transform&&e.css){if(!(r=t.transform(e.css)))return function(){};e.css=r}if(t.singleton){var i=h++;s=c||(c=m(t)),n=x.bind(null,s,i,!1),o=x.bind(null,s,i,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(s=function(e){var t=document.createElement("link");return e.attrs.type="text/css",e.attrs.rel="stylesheet",v(t,e.attrs),g(e,t),t}(t),n=C.bind(null,s,t),o=function(){y(s),s.href&&URL.revokeObjectURL(s.href)}):(s=m(t),n=I.bind(null,s),o=function(){y(s)});return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else o()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=i()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var s=u(e,t);return f(s,t),function(e){for(var n=[],o=0;o<s.length;o++){var i=s[o];(a=r[i.id]).refs--,n.push(a)}for(e&&f(u(e,t),t),o=0;o<n.length;o++){var a;if(0===(a=n[o]).refs){for(var l=0;l<a.parts.length;l++)a.parts[l]();delete r[a.id]}}}};var w,S=(w=[],function(e,t){return w[e]=t,w.filter(Boolean).join("\n")});function x(e,t,s,n){var o=s?"":n.css;if(e.styleSheet)e.styleSheet.cssText=S(t,o);else{var r=document.createTextNode(o),i=e.childNodes;i[t]&&e.removeChild(i[t]),i.length?e.insertBefore(r,i[t]):e.appendChild(r)}}function I(e,t){var s=t.css,n=t.media;if(n&&e.setAttribute("media",n),e.styleSheet)e.styleSheet.cssText=s;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(s))}}function C(e,t,s){var n=s.css,o=s.sourceMap,r=void 0===t.convertToAbsoluteUrls&&o;(t.convertToAbsoluteUrls||r)&&(n=p(n)),o&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var i=new Blob([n],{type:"text/css"}),a=e.href;e.href=URL.createObjectURL(i),a&&URL.revokeObjectURL(a)}},408:e=>{e.exports=function(e){var t="undefined"!=typeof window&&window.location;if(!t)throw new Error("fixUrls requires window.location");if(!e||"string"!=typeof e)return e;var s=t.protocol+"//"+t.host,n=s+t.pathname.replace(/\/[^\/]*$/,"/");return e.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(e,t){var o,r=t.trim().replace(/^"(.*)"$/,(function(e,t){return t})).replace(/^'(.*)'$/,(function(e,t){return t}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r)?e:(o=0===r.indexOf("//")?r:0===r.indexOf("/")?s+r:n+r.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")}))}},766:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DropIndicator=void 0;const n=s(359),o=s(42);class r extends n.Component{constructor(){super(...arguments),this.state={type:"none",index:0,depth:0}}render(){const{type:e,index:t,depth:s}=this.state,{rowHeight:r,indent:i}=this.props,a=t*r,l={left:"0",top:`${a}px`,width:"100%",height:`${r}px`},c={top:a-1+"px",height:"0",left:(s+1)*i+"px",width:`calc(100% - ${(s+1)*i}px)`};return n.createElement("div",null,n.createElement("div",{className:(0,o.default)("react-dragv-tree_dropOver",this.props.dropOverClassName),hidden:"over"!==e,style:l}),n.createElement("div",{className:(0,o.default)("react-dragv-tree_dropBetween",this.props.dropBetweenClassName),hidden:"between"!==e,style:c}))}}t.DropIndicator=r},695:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Toggler=void 0;const n=s(359),o=s(42);t.Toggler=function(e){const t=(0,o.default)("react-dragv-tree_toggler",{"react-dragv-tree_toggler-visible":e.visible,"react-dragv-tree_toggler-collapsed":e.collapsed});return n.createElement("div",{className:t,onClick:e.onClick})}},691:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Tree=t.guid=void 0;const n=s(359),o=s(42),r=s(916);s(944),t.guid=(e=32,t=!0,s=null)=>{const n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),o=[];if(s=s||n.length,e)for(let t=0;t<e;t++)o[t]=n[0|Math.random()*s];else{let e;o[8]=o[13]=o[18]=o[23]="-",o[14]="4";for(let t=0;t<36;t++)o[t]||(e=0|16*Math.random(),o[t]=n[19==t?3&e|8:e])}return t?(o.shift(),"u"+o.join("")):o.join("")};class i{constructor(e,t,s=!1,n,o,r,i,a,l,c,h){this.title=e,this.children=t,this.collapsed=s,this.key=n,this.id=o,this.img=r,this._package=i,this.show=a,this.pid=l,this.lock=c,this.config=h}getDescendant(e){return 0==e.length?this:this.children?this.children[e[0]].getDescendant(e.slice(1)):void 0}clone(){return new i(this.title,this.children?this.children.map((e=>e.clone())):void 0,this.collapsed,this.key,this.id,this.img,this._package,this.show,this.pid,this.lock,this.config)}static setParamVal(e,t,s,n){if(t&&(e[t]=s),n&&"function"==typeof n&&n(e),e.children&&e.children.length>0)for(let o=0,r=e.children.length;o<r;o++){const r=e.children[o];t&&(r[t]=s);const a=r.children||void 0;a&&a.length>0?i.setParamVal(r,t,s,n):n&&"function"==typeof n&&n(r)}}static generate(e,t){let s=e.children||void 0;if(s&&s.length>0){s=[];for(let t=0,n=e.children.length;t<n;t++)s.push(i.generate(e.children[t],e.id))}const n=e.title,o=e.collapsed,r=e.key,a=e.id,l=e.img,c=e.package||e._package,h=e.show,d=t,p=e.lock,f=e.config;return new i(n,s,o,r,a,l,c,h,d,p,f)}}const a=(e,t)=>{t&&t.size>0&&((null==t?void 0:t.has(e.key))?e.collapsed=!1:e.collapsed=!0);const s={children:(null==e?void 0:e.children)&&(null==e?void 0:e.children.map((e=>a(e,t)))),key:e.key,collapsed:e.collapsed,img:e.img,package:e._package,show:e.show,pid:e.pid,title:e.title,lock:e.lock,id:e.id,config:e.config};return Object.keys(s).filter((e=>null!=s[e]&&"{}"!==JSON.stringify(s[e]))).reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:s[t]})),{})};class l extends n.Component{constructor(e){super(e),this.treeViewRef=n.createRef(),this.clearSelectedKeys=()=>{var e;(this.state.selectedKeys.size>0||(null===(e=this.state.selectedNode)||void 0===e?void 0:e.length)>0)&&this.setState({selectedKeys:new Set([]),selectedNode:[]})},this.renderRow=e=>{const t=this.state.root.getDescendant(e.path),{selected:s}=e;return this.props.renderRow?this.props.renderRow(e.node,s,e,this.delItem,this.copyItem,this.setItemParams,this.groupTree):n.createElement("div",{className:(0,o.default)("example-cell",{selected:s})},t.title)},this.onContextMenu=(e,t)=>{this.props.onChange&&this.props.onChange("onContextMenu",{info:e,ev:t})},this.onSelectedKeysChange=(e,t)=>{this.setState({selectedKeys:e,selectedNode:t},(()=>{this.props.onChange&&this.props.onChange("onSelectedKeysChange",{selectedKeys:Array.from(e),selectedNode:t})}))},this.delItem=e=>{const{root:t,selectedKeys:s,selectedNode:n}=this.state;let o=[],r=[],i=[];if(e){const{path:s}=e,n=s[s.length-1];o.unshift(n);const a=t.getDescendant(s.slice(0,-1));r.unshift(a);const[l]=a.children.splice(n,1);i.unshift(l)}else if(s.size>0)for(let e=n.length-1;e>=0;e--){const{path:s}=n[e],a=s[s.length-1];o.unshift(a);const l=t.getDescendant(s.slice(0,-1));r.unshift(l);const[c]=l.children.splice(a,1);i.unshift(c)}this.setState({root:t,selectedNode:[],selectedKeys:new Set("")},(()=>{this.props.onChange&&this.props.onChange("onDelItem",{treeData:a(t).children,indexs:o,selectedNode:n,selectedKeys:Array.from(s),destItems:r.map((e=>a(e))),items:i.map((e=>a(e)))})}))},this.groupTree=(e,s)=>{const{root:n,selectedKeys:o,selectedNode:r}=this.state,l=[],c=[];let h;if(s){const{path:o,node:r}=s;if(!e&&!r.children)return;const a=o[o.length-1],d=n.getDescendant(o.slice(0,-1)),[p]=d.children.splice(a,1);if(c.unshift(p),l.unshift(n.getDescendant(o.slice(0,-1))),e){const e=`group-${(0,t.guid)(10)}`;h=i.generate({title:"分组",children:c,id:e,key:e,collapsed:!1}),"function"==typeof this.props.groupItemFormatFunc&&this.props.groupItemFormatFunc&&this.props.groupItemFormatFunc(h),l[0].children.splice(o[o.length-1],0,h),l[0].collapsed=!1}else{const e=p;e.children&&e.children.length>0&&(l[0].children.splice(o[o.length-1],0,...e.children),l[0].collapsed=!1)}}else if(o.size>0){for(let t=r.length-1;t>=0;--t){const{path:s,node:o}=r[t];if(!e&&(!o.children||o.children<=0))break;const i=s[s.length-1],a=n.getDescendant(s.slice(0,-1)),[h]=a.children.splice(i,1);h.pid=a.id,c.unshift(h),l.unshift(n.getDescendant(s.slice(0,-1)))}if(l.length<=0||c.length<=0)return;if(e){const e=`group-${(0,t.guid)(10)}`;h=i.generate({title:"分组",children:c,id:e,key:e,collapsed:!1}),"function"==typeof this.props.groupItemFormatFunc&&this.props.groupItemFormatFunc&&this.props.groupItemFormatFunc(h);const s=r[0].path;l[0].children.splice(s[s.length-1],0,h),l[0].collapsed=!1}else l.forEach(((e,t)=>{const s=r[t],n=c[t];n.children&&n.children.length>0&&(e.children.splice(s.path[s.path.length-1],0,...n.children),e.collapsed=!1)}))}this.setState({root:n,selectedNode:r},(()=>{const t=new Set(c.map((e=>e.key))),s=this.getNodeArr(t);this.setState({selectedKeys:t,selectedNode:s},(()=>{this.props.onChange&&this.props.onChange(e?"onGroupTree":"onGroupTreeDel",{treeData:a(n).children,selectedNode:s,selectedKeys:Array.from(t),destItems:l.map((e=>a(e))),items:c.map((e=>a(e))),groupInfo:h&&a(h)||""})}))}))},this.pasteItem=(e,t,s,n=[])=>{var o;const{root:r}=this.state,l=[],c=[],h={};for(let s=t.length-1;s>=0;--s){const o=i.generate(t[s].node?t[s].node:t[s]).clone();(null==n?void 0:n.length)<=0&&"function"==typeof this.props.copyItemFormatFunc&&i.setParamVal(o,"","",(e=>{const t=e.id,s=this.props.copyItemFormatFunc&&this.props.copyItemFormatFunc(e);s&&(h[t]=s.id)})),c.unshift(o),l.unshift(r.getDescendant(e))}(null===(o=l[l.length-1].children)||void 0===o?void 0:o.length)?l[l.length-1].children.splice(e[e.length-1]+1,0,...c):l[l.length-1].children=c,l[l.length-1].collapsed=!1,this.setState({root:r},(()=>{const e=new Set(c.map((e=>e.key))),t=this.getNodeArr(e);this.setState({selectedKeys:e,selectedNode:t},(()=>{const o={treeData:a(r).children,selectedNode:t,selectedKeys:Array.from(e),mapping:h,diyData:s};(null==n?void 0:n.length)>0&&(o.trashIds=n),this.props.onChange&&this.props.onChange("onPaste",o)}))}))},this.copyItem=(e,t=!0)=>{const{root:s,selectedKeys:n,selectedNode:o}=this.state,r=[],l=[],c={};if(e){const{path:t}=e,n=t[t.length-1],o=s.getDescendant(t.slice(0,-1)).children[n].clone();"function"==typeof this.props.copyItemFormatFunc&&i.setParamVal(o,"","",(e=>{const t=e.id,s=this.props.copyItemFormatFunc&&this.props.copyItemFormatFunc(e);s&&(c[t]=s.id)})),l.unshift(o),r.unshift(s.getDescendant(t.slice(0,-1))),r[0].children.splice(n+1,0,o),r[0].collapsed=!1}else if(n.size>0){let e=null;for(let t=o.length-1;t>=0;--t){const{path:n}=o[t],a=n[n.length-1],h=s.getDescendant(n.slice(0,-1)).children[a].clone();"function"==typeof this.props.copyItemFormatFunc&&i.setParamVal(h,"","",(e=>{const t=e.id,s=this.props.copyItemFormatFunc&&this.props.copyItemFormatFunc(e);s&&(c[t]=s.id)})),l.unshift(h),r.unshift(s.getDescendant(n.slice(0,-1))),t===o.length-1&&(e=a)}t&&(r[r.length-1].children.splice(e+1,0,...l),r[r.length-1].collapsed=!1)}t?this.setState({root:s},(()=>{const e=new Set(l.map((e=>e.key))),t=this.getNodeArr(e);this.setState({selectedKeys:e,selectedNode:t},(()=>{this.props.onChange&&this.props.onChange("onCopyItem",{treeData:a(s).children,selectedNode:t,selectedKeys:Array.from(e),mapping:c})}))})):this.props.onChange&&this.props.onChange("onCopyItemNoPaste",{treeData:a(s).children,selectedNode:o,selectedKeys:Array.from(n),mapping:c})},this.getNodeArr=e=>this.treeViewRef.current.keysToInfos(e),this.setItemParams=(e,t,s)=>{const{root:n,selectedKeys:o,selectedNode:r}=this.state;let i=[],l=[],c=[];if(s){const{path:o,node:r}=s,a=o[o.length-1];i.unshift(a);const h=n.getDescendant(o.slice(0,-1));l.unshift(h);const d=h.children[a];c.unshift(d),d[e]="__toggle"===t&&"boolean"==typeof d[e]?!d[e]:t,r[e]=d[e]}else if(o.size>0)for(let s=r.length-1;s>=0;s--){const{path:o,node:a}=r[s],h=o[o.length-1];i.unshift(h);const d=n.getDescendant(o.slice(0,-1));l.unshift(d);const p=d.children[h];c.unshift(p),p[e]="__toggle"===t&&"boolean"==typeof p[e]?!p[e]:t,a[e]=p[e]}this.setState({root:n},(()=>{const s=this.getNodeArr(this.state.selectedKeys);this.setState({selectedNode:s},(()=>{this.props.onChange&&this.props.onChange("onSetItemParams",{indexs:i,params:e,value:t,treeData:a(n).children,selectedNode:s,selectedKeys:Array.from(this.state.selectedKeys),parents:l.map((e=>a(e))),items:c.map((e=>a(e)))})}))}))},this.expandTree=(e="single",t=!0)=>{const{root:s,selectedKeys:n,selectedNode:o}=this.state;if("single"===e){if(!n.size)return;for(let e=o.length-1;e>=0;e--){const{path:n,node:r}=o[e],i=n[n.length-1],a=s.getDescendant(n.slice(0,-1)).children[i];a.collapsed="__toggle"===t&&"boolean"==typeof a.collapsed?!a.collapsed:t,r.collapsed=a.collapsed}}else"all"===e&&i.setParamVal(s,"collapsed",t);this.setState({root:s,expandedKeys:new Set([])},(()=>{const n=this.getNodeArr(this.state.selectedKeys);this.setState({selectedNode:n},(()=>{this.props.onChange&&this.props.onChange("onExpandTree",{type:e,treeData:a(s).children,selectedNode:n,selectedKeys:Array.from(this.state.selectedKeys),collapsed:t})}))}))},this.setLayer=e=>{const{root:t,selectedKeys:s,selectedNode:n}=this.state;if(s.size)switch(e){case"upper":case"next":{const s=[],o=[];for(let r=n.length-1;r>=0;r--){const{path:i}=n[r],a=i[i.length-1],l=t.getDescendant(i.slice(0,-1)),[c]=l.children.splice(a,1);o.unshift(c),"next"===e?i[i.length-1]=parseInt(i)+1<l.children.length?parseInt(i)+1:l.children.length:"upper"===e&&(i[i.length-1]=i-1>0?i-1:0),s.unshift(t.getDescendant(i.slice(0,-1)))}s.forEach(((e,t)=>{const s=n[t];e.children.splice(s.path[s.path.length-1],0,o[t]),e.collapsed=!1})),this.setState({root:t,selectedNode:n},(()=>{const s=new Set(o.map((e=>e.key))),n=this.getNodeArr(s);this.setState({selectedKeys:s,selectedNode:n},(()=>{this.props.onChange&&this.props.onChange("onSetLayer",{type:e,treeData:a(t).children,selectedNode:n,selectedKeys:Array.from(s)})}))}));break}case"top":case"bottom":{const s=[],o=[];for(let r=n.length-1;r>=0;r--){const{path:i}=n[r],a=i[i.length-1],l=t.getDescendant(i.slice(0,-1)),[c]=l.children.splice(a,1);o.unshift(c),"top"===e?i[i.length-1]=0:"bottom"===e&&(i[i.length-1]=l.children.length),s.unshift(t.getDescendant(i.slice(0,-1)))}s.forEach(((t,s)=>{"top"===e?t.children.unshift(o[s]):"bottom"===e&&t.children.push(o[s]),t.collapsed=!1})),this.setState({root:t},(()=>{const s=new Set(o.map((e=>e.key))),n=this.getNodeArr(s);this.setState({selectedKeys:s,selectedNode:n},(()=>{this.props.onChange&&this.props.onChange("onSetLayer",{type:e,treeData:a(t).children,selectedNode:n,selectedKeys:Array.from(s)})}))}));break}}},this.onCollapsedChange=(e,t)=>{this.state.root.getDescendant(e.path).collapsed=t,this.setState({root:this.state.root,expandedKeys:new Set([])},(()=>{this.props.onChange&&this.props.onChange("onCollapsedChange",{treeData:a(this.state.root).children,info:e,collapsed:t})}))},this.onMove=(e,t,s,n)=>{const{root:o}=this.state,r=[];for(let t=e.length-1;t>=0;--t){const{path:s}=e[t],i=s[s.length-1],a=o.getDescendant(s.slice(0,-1)),[l]=a.children.splice(i,1);r.unshift(l),e[t].path=n}const i=o.getDescendant(n.slice(0,-1));i.children.splice(n[n.length-1],0,...r),i.collapsed=!1,this.setState({root:o},(()=>{const e=new Set(r.map((e=>e.key))),i=this.getNodeArr(e);this.setState({selectedKeys:e,selectedNode:i},(()=>{this.props.onChange&&this.props.onChange("onMove",{treeData:a(o).children,selectedNode:i,selectedKeys:Array.from(e),dest:t,destIndex:s,destPathAfterMove:n})}))}))},this.onCopy=(e,t,s)=>{const{root:n}=this.state,o=[],r={};for(let t=e.length-1;t>=0;--t){const{path:s}=e[t],a=s[s.length-1],l=n.getDescendant(s.slice(0,-1)).children[a].clone();"function"==typeof this.props.copyItemFormatFunc&&i.setParamVal(l,"","",(e=>{const t=e.id,s=this.props.copyItemFormatFunc&&this.props.copyItemFormatFunc(e);s&&(r[t]=s.id)})),o.unshift(l)}const l=n.getDescendant(t.path);l.children.splice(s,0,...o),l.collapsed=!1,this.setState({root:n},(()=>{const i=new Set(o.map((e=>e.key))),l=this.getNodeArr(i);this.setState({selectedKeys:i,selectedNode:l},(()=>{this.props.onChange&&this.props.onChange("onCopy",{treeData:a(n).children,selectedNode:l,selectedKeys:Array.from(i),src:e,dest:t,destIndex:s,mapping:r})}))}))};const s=i.generate({collapsed:!1,key:"root",title:"root",children:e.data});this.state={root:s,selectedKeys:new Set(e.selectedKeys||[]),selectedNode:[],expandedKeys:new Set([])}}componentDidUpdate(e,t){if(JSON.stringify(this.props.data)!==JSON.stringify(e.data)){const e=i.generate({collapsed:!1,key:"root",title:"root",children:this.props.data});this.setState({root:e})}JSON.stringify(this.props.selectedKeys)!==JSON.stringify(e.selectedKeys)&&this.setSelectedData(this.props.selectedKeys)}setSelectedData(e){const t=this.getNodeArr(new Set(e));this.setState({selectedKeys:new Set(e),selectedNode:t})}componentWillUnmount(){this.setState=(e,t)=>{}}render(){const{root:e,selectedKeys:t,expandedKeys:s}=this.state;return n.createElement(r.TreeView,{ref:this.treeViewRef,root:a(e,s),selectedKeys:t,expandedKeys:s,hoverBackground:this.props.hoverBackground||"#2C2F38",activeBackground:this.props.activeBackground||"#177ddc",searchVal:this.props.searchVal||"",rowHeight:this.props.rowHeight||40,indent:this.props.indent||20,className:this.props.className||"example-tree",rowContent:this.renderRow,onContextMenu:this.onContextMenu,onSelectedKeysChange:this.onSelectedKeysChange,onCollapsedChange:this.onCollapsedChange,onHover:this.props.onHover&&this.props.onHover,onMove:this.onMove,onCopy:this.onCopy,onSearchScroll:(e,t,s)=>{this.props.onChange&&this.props.onChange("onSearchScroll",{searchOffsetNum:e,offsetTop:t,id:s})},onSearch:(e,t,s,n,o)=>{this.setState({expandedKeys:new Set(o)},(()=>{this.props.onChange&&this.props.onChange("onSearch",{searchPathList:e,searchOffsetNum:t,offsetTop:s,id:n,expandedKeys:o})}))},onInit:(e,t)=>{this.setState({selectedKeys:e,selectedNode:t},(()=>{this.props.onChange&&this.props.onChange("onInit",{selectedKeys:e,selectedNode:t})}))}})}}t.Tree=l},874:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TreeView=void 0;const n=s(359),o=s(42),r=s(695),i=s(766),a=s(482),l="x-react-draggable-tree-drag";class c extends n.Component{constructor(e){super(e),this.infoToPath=new Map,this.pathToInfo=new Map,this.visibleInfos=[],this.keyToInfo=new Map,this.searchScroll=e=>{if(!this.state.searchPathList||this.state.searchPathList.length<=0)return;let t=this.state.searchOffsetNum;if("top"===e&&t>0)t--;else{if(!("bottom"===e&&t<this.state.searchPathList.length-1))return;t++}const s=document.querySelector(`.${this.props.className} [data-id="${this.state.searchPathList[t]}"]`),n=s&&t>=0&&t<=this.state.searchPathList.length?s.offsetTop:0;this.setState({searchOffsetNum:t},(()=>{this.props.onSearchScroll&&this.props.onSearchScroll(t+1,n,s?s.getAttribute("data-id"):"")}))},this.getParentElement=e=>!e||e.className.indexOf("react-dragv-tree-wrap")>-1?null:e.className.indexOf("react-dragv-tree_children")>-1?e:this.getParentElement(e.parentElement),this.searchEnv=e=>{if(""===e)return!1;requestAnimationFrame((()=>{var t;const s=document.querySelectorAll(`.${this.props.className} [data-id]`),n=[],o=[];for(let r=0,i=s.length;r<i;r++){const i=s[r].getAttribute("data-title");if(i&&i.indexOf(e)>-1){const e=s[r].getAttribute("data-id");n.includes(e)||n.push(e);const i=this.getParentElement(s[r]);i&&o.push(null===(t=i.previousSibling)||void 0===t?void 0:t.getAttribute("data-id"))}}const r=document.querySelector(`.${this.props.className} [data-id="${n[0]}"]`),i=(null==r?void 0:r.offsetTop)||0;this.setState({searchPathList:n,searchOffsetNum:0},(()=>{this.props.onSearch&&this.props.onSearch(n,r?1:0,i,r?r.getAttribute("data-id"):"",o)}))}))},this.onMouseOver=(e,t)=>{this.props.onHover&&this.props.onHover("mouseover",e,t)},this.onMouseLeave=(e,t)=>{this.props.onHover&&this.props.onHover("mouseleave",e,t)},this.onClickRow=(e,t)=>{var s;t.preventDefault(),t.stopPropagation();const n=new Map;for(const e of this.visibleInfos)if(null===(s=e.node)||void 0===s?void 0:s.children)for(const t of e.node.children)n.set(t.key,e);const{selectedKeys:o}=this.props,{key:r}=e.node;let i;if(t.ctrlKey||t.metaKey){let e=new Set,t=n.get(r);for(;t&&!e.has(t.node.key);)e.add(t.node.key),t=n.get(t.node.key);if(i=new Set(o),[...i].some((t=>e.has(t))))return;i.has(r)?i.delete(r):i.add(r)}else if(t.shiftKey&&o.size>0){const e=this.visibleInfos.map((e=>e.node.key)),t=this.keysToInfos(o).map((e=>e.visibleOffset)),s=e.indexOf(r),a=Math.min(s,...t),l=Math.max(s,...t),c=e.slice(a,l+1);i=new Set(o);for(const e of c){let t=new Set,s=n.get(e);for(;s&&!t.has(s.node.key);)t.add(s.node.key),s=n.get(s.node.key);[...i].some((e=>t.has(e)))||i.add(e)}}else i=new Set([r]);i=this.removeAncestorsFromSelection(i),this.props.onSelectedKeysChange(i,this.keysToInfos(i))},this.onContextMenu=e=>{const{rowHeight:t,selectedKeys:s}=this.props,{visibleInfos:n}=this,o=this.element.getBoundingClientRect(),r=e.clientY-o.top+this.element.scrollTop,i=Math.floor(r/t),a=0<=i&&i<n.length?n[i]:void 0;a&&!s.has(a.node.key)&&this.onClickRow(a,e),this.props.onContextMenu&&this.props.onContextMenu(a,e)},this.onDragOver=e=>{e.preventDefault();const t=e.altKey||e.ctrlKey;e.dataTransfer.dropEffect=t?"copy":"move";const s=this.getDropTarget(e);this.canDrop(s.dest,s.destIndex)?this.updateDropIndicator(s):this.updateDropIndicator(void 0)},this.onDrop=e=>{if(this.updateDropIndicator(void 0),!e.dataTransfer.getData(l))return;let{clientX:t,clientY:s}=e;const n=this.getDropTarget({clientX:t,clientY:s}),{dest:o,destIndex:r}=n;if(!this.canDrop(o,r))return;const i=this.keysToInfos(this.props.selectedKeys);if(e.altKey||e.ctrlKey)this.props.onCopy(i,o,r);else{const e=[...o.path,r],t=[...e];for(const s of i){const n=s.path.slice(0,-1),o=s.path[s.path.length-1];for(let s=0;s<e.length;++s){const r=e.slice(0,s),i=e[s];(0,a.isPathEqual)(n,r)&&o<i&&--t[s]}}this.props.onMove(i,o,r,t)}e.preventDefault()},this.state={searchPathList:[],searchOffsetNum:0}}componentWillUnmount(){this.setState=(e,t)=>{}}componentDidMount(){this.props.onInit&&this.props.onInit(this.props.selectedKeys,this.keysToInfos(this.props.selectedKeys))}render(){const{root:e,rowHeight:t,indent:s}=this.propsWithDefaults(),r=e.children||[];this.clearRows();const a={node:e,selected:!1,current:!1,path:[],visible:!1,visibleOffset:0};this.addRowInfo(a),this.rootInfo=a;const l=(0,o.default)("react-dragv-tree-wrap",this.props.className);return n.createElement("div",{ref:e=>this.element=e,className:l,onDragOver:this.onDragOver,onDrop:this.onDrop,onContextMenu:this.onContextMenu},r.map(((e,t)=>this.renderNode(e,[t],!0))),n.createElement(i.DropIndicator,{ref:e=>this.dropIndicator=e,rowHeight:t,indent:s,dropOverClassName:this.props.dropOverIndicatorClassName,dropBetweenClassName:this.props.dropBetweenIndicatorClassName}))}removeAncestorsFromSelection(e){const t=new Set(e);for(const{path:s}of this.keysToInfos(e))for(let e=1;e<s.length;++e){const n=s.slice(0,e),o=this.pathToInfo.get(n.join());o&&t.delete(o.node.key)}return t}propsWithDefaults(){return Object.assign({},{indent:20},this.props)}clearRows(){this.visibleInfos=[],this.pathToInfo.clear(),this.infoToPath.clear(),this.keyToInfo.clear()}addRowInfo(e){this.infoToPath.set(e,e.path),this.pathToInfo.set(e.path.join(),e),e.visible&&this.visibleInfos.push(e),this.keyToInfo.set(e.node.key,e)}renderNode(e,t,s){const{indent:i,rowHeight:a,selectedKeys:c}=this.propsWithDefaults(),{key:h}=e,d=c.has(h),p={node:e,selected:d,path:t,visible:s,visibleOffset:this.visibleInfos.length};this.addRowInfo(p);const f={paddingLeft:(t.length-1)*i+"px",height:a+"px"},u=(0,o.default)("react-dragv-tree_row",this.props.rowClassName,d&&this.props.rowSelectedClassName,{"react-dragv-tree_row-selected":d}),{children:g,collapsed:y}=e,m=this.props.toggler||r.Toggler,v=this.props.rowContent;let b=n.createElement("div",{key:`row-${h}`,className:u,style:f,onClick:e=>this.onClickRow(p,e),onMouseOver:e=>this.onMouseOver(p,e),onMouseLeave:e=>this.onMouseLeave(p,e),"data-title":e.title,"data-id":e.id,draggable:!0,onDragStart:e=>{if(e.dataTransfer.effectAllowed="copyMove",e.dataTransfer.setData(l,"drag"),!c.has(h)){const e=new Set([h]);this.props.onSelectedKeysChange(e,this.keysToInfos(e))}},onDragEnd:()=>{this.updateDropIndicator(void 0)}},n.createElement(m,{visible:!!g,collapsed:y,onClick:t=>{t.preventDefault(),t.stopPropagation(),e.children&&(this.props.onCollapsedChange(p,!y),t.stopPropagation())}}),n.createElement(v,Object.assign({},p)));if(g){const e=s&&!y,r=(0,o.default)("react-dragv-tree_children",this.props.childrenClassName);return[b,n.createElement("div",{key:`children-${h}`,className:r,hidden:y},g.map(((s,n)=>this.renderNode(s,[...t,n],e))))]}return[b]}keysToInfos(e){const t=[];return e.forEach((e=>{const s=this.keyToInfo.get(e);s&&t.push(s)})),t.sort(((e,t)=>(0,a.comparePaths)(e.path,t.path))),t}updateDropIndicator(e){if(e){const{type:t,index:s,depth:n}=e;this.dropIndicator.setState({type:t,index:s,depth:n})}else this.dropIndicator.setState({type:"none",index:0,depth:0})}getDropTarget(e){const{rowHeight:t,indent:s}=this.propsWithDefaults(),n=this.element.getBoundingClientRect(),o=e.clientX-n.left+this.element.scrollLeft,r=e.clientY-n.top+this.element.scrollTop,i=(0,a.clamp)(Math.floor(r/t),0,this.visibleInfos.length),l=r-i*t;if(i<this.visibleInfos.length&&.25*t<l&&l<.75*t){const e=this.visibleInfos[i];if(e.node.children)return{type:"over",index:i,dest:e,destIndex:0,depth:0}}const c=(0,a.clamp)(l<t/2?i:i+1,0,this.visibleInfos.length);let h=c===this.visibleInfos.length?[this.rootInfo.node.children.length]:this.visibleInfos[c].path;if(0<c){const e=this.visibleInfos[c-1];let t=e.path;const n=e.node.children,r=e.node.collapsed;if(n&&0===n.length&&!r&&(t=[...t,-1]),h.length<t.length){const e=(0,a.clamp)(Math.floor(o/s)-1,h.length,t.length);h=[...t.slice(0,e-1),t[e-1]+1]}}const d=h.slice(0,-1);return{type:"between",index:c,dest:this.pathToInfo.get(d.join()),destIndex:h[h.length-1],depth:h.length-1}}canDrop(e,t){const{selectedKeys:s}=this.props,{path:n}=e;for(let e=0;e<n.length;++e){const t=n.slice(0,n.length-e),o=this.pathToInfo.get(t.join());if(o){const e=o.node.key;if(s.has(e))return!1}}return!0}}t.TreeView=c},916:function(e,t,s){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,s,n){void 0===n&&(n=s),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[s]}})}:function(e,t,s,n){void 0===n&&(n=s),e[n]=t[s]}),o=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||n(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),o(s(502),t),o(s(874),t),o(s(691),t),o(s(695),t),o(s(766),t)},502:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},482:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isPathEqual=t.comparePaths=t.clamp=void 0,t.clamp=function(e,t,s){return Math.max(t,Math.min(e,s))},t.comparePaths=function(e,t){for(let s=0;;++s){if(e.length===s&&t.length===s)return 0;if(e.length===s||e[s]<t[s])return-1;if(t.length===s||t[s]<e[s])return 1}},t.isPathEqual=function(e,t){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(e[s]!==t[s])return!1;return!0}},359:t=>{"use strict";t.exports=e}},s={},n=function e(n){var o=s[n];if(void 0!==o)return o.exports;var r=s[n]={id:n,exports:{}};return t[n].call(r.exports,r,r.exports,e),r.exports}(916),n;var t,s,n}));

@@ -31,3 +31,3 @@ import * as React from "react";

static setParamVal(item: any, params: string, value: any, callback?: any): void;
static generate(item: any): ExampleItem;
static generate(item: any, parentId?: string): ExampleItem;
}

@@ -34,0 +34,0 @@ interface ExampleTreeState {

/*! For license information please see Tree.js.LICENSE.txt */
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("react"));else if("function"==typeof define&&define.amd)define(["react"],t);else{var s="object"==typeof exports?t(require("react")):t(e.React);for(var n in s)("object"==typeof exports?exports:e)[n]=s[n]}}(self,(function(e){return t={42:(e,t)=>{var s;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var s=arguments[t];if(s){var r=typeof s;if("string"===r||"number"===r)e.push(s);else if(Array.isArray(s)){if(s.length){var i=o.apply(null,s);i&&e.push(i)}}else if("object"===r)if(s.toString===Object.prototype.toString)for(var a in s)n.call(s,a)&&s[a]&&e.push(a);else e.push(s.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(s=function(){return o}.apply(t,[]))||(e.exports=s)}()},848:(e,t,s)=>{(e.exports=s(506)(!1)).push([e.id,'\r\n.react-dragv-tree-wrap {\r\n display: flex;\r\n flex-direction: column;\r\n position: relative;\r\n}\r\n.react-dragv-tree_row {\r\n display: flex;\r\n align-items: center;\r\n}\r\n.react-dragv-tree_row-selected {\r\n background-color: #e0e0e0;\r\n}\r\n.react-dragv-tree_toggler {\r\n width: 10px;\r\n height: 10px;\r\n margin: 0px;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n}\r\n.react-dragv-tree_toggler:before {\r\n content: "";\r\n display: block;\r\n width: 5px;\r\n height: 5px;\r\n box-sizing: border-box;\r\n border-right: 1px solid gray;\r\n border-bottom: 1px solid gray;\r\n transform: rotate(45deg);\r\n transition: all linear 0.2s;\r\n visibility: hidden;\r\n}\r\n.react-dragv-tree_toggler-visible{\r\n margin-left: 10px;\r\n margin-right: 5px;\r\n}\r\n.react-dragv-tree_toggler-visible:before {\r\n visibility: visible;\r\n}\r\n.react-dragv-tree_toggler-collapsed:before {\r\n transform: rotate(-45deg);\r\n}\r\n.react-dragv-tree_dropOver {\r\n position: absolute;\r\n box-sizing: border-box;\r\n pointer-events: none;\r\n border: 2px solid #2196F3;\r\n}\r\n.react-dragv-tree_dropBetween {\r\n position: absolute;\r\n pointer-events: none;\r\n border: 1px solid #2196F3;\r\n}',""])},506:e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var s=function(e,t){var s,n=e[1]||"",o=e[3];if(!o)return n;if(t&&"function"==typeof btoa){var r=(s=o,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(s))))+" */"),i=o.sources.map((function(e){return"/*# sourceURL="+o.sourceRoot+e+" */"}));return[n].concat(i).concat([r]).join("\n")}return[n].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+s+"}":s})).join("")},t.i=function(e,s){"string"==typeof e&&(e=[[null,e,""]]);for(var n={},o=0;o<this.length;o++){var r=this[o][0];"number"==typeof r&&(n[r]=!0)}for(o=0;o<e.length;o++){var i=e[o];"number"==typeof i[0]&&n[i[0]]||(s&&!i[2]?i[2]=s:s&&(i[2]="("+i[2]+") and ("+s+")"),t.push(i))}},t}},944:(e,t,s)=>{var n=s(848);"string"==typeof n&&(n=[[e.id,n,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};s(688)(n,o),n.locals&&(e.exports=n.locals)},688:(e,t,s)=>{var n,o,r={},i=(n=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===o&&(o=n.apply(this,arguments)),o}),a=function(e){return document.querySelector(e)},l=function(e){var t={};return function(e){if("function"==typeof e)return e();if(void 0===t[e]){var s=a.call(this,e);if(window.HTMLIFrameElement&&s instanceof window.HTMLIFrameElement)try{s=s.contentDocument.head}catch(e){s=null}t[e]=s}return t[e]}}(),c=null,h=0,d=[],p=s(408);function f(e,t){for(var s=0;s<e.length;s++){var n=e[s],o=r[n.id];if(o){o.refs++;for(var i=0;i<o.parts.length;i++)o.parts[i](n.parts[i]);for(;i<n.parts.length;i++)o.parts.push(b(n.parts[i],t))}else{var a=[];for(i=0;i<n.parts.length;i++)a.push(b(n.parts[i],t));r[n.id]={id:n.id,refs:1,parts:a}}}}function u(e,t){for(var s=[],n={},o=0;o<e.length;o++){var r=e[o],i=t.base?r[0]+t.base:r[0],a={css:r[1],media:r[2],sourceMap:r[3]};n[i]?n[i].parts.push(a):s.push(n[i]={id:i,parts:[a]})}return s}function g(e,t){var s=l(e.insertInto);if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var n=d[d.length-1];if("top"===e.insertAt)n?n.nextSibling?s.insertBefore(t,n.nextSibling):s.appendChild(t):s.insertBefore(t,s.firstChild),d.push(t);else if("bottom"===e.insertAt)s.appendChild(t);else{if("object"!=typeof e.insertAt||!e.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var o=l(e.insertInto+" "+e.insertAt.before);s.insertBefore(t,o)}}function y(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e);var t=d.indexOf(e);t>=0&&d.splice(t,1)}function m(e){var t=document.createElement("style");return e.attrs.type="text/css",v(t,e.attrs),g(e,t),t}function v(e,t){Object.keys(t).forEach((function(s){e.setAttribute(s,t[s])}))}function b(e,t){var s,n,o,r;if(t.transform&&e.css){if(!(r=t.transform(e.css)))return function(){};e.css=r}if(t.singleton){var i=h++;s=c||(c=m(t)),n=x.bind(null,s,i,!1),o=x.bind(null,s,i,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(s=function(e){var t=document.createElement("link");return e.attrs.type="text/css",e.attrs.rel="stylesheet",v(t,e.attrs),g(e,t),t}(t),n=C.bind(null,s,t),o=function(){y(s),s.href&&URL.revokeObjectURL(s.href)}):(s=m(t),n=I.bind(null,s),o=function(){y(s)});return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else o()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=i()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var s=u(e,t);return f(s,t),function(e){for(var n=[],o=0;o<s.length;o++){var i=s[o];(a=r[i.id]).refs--,n.push(a)}for(e&&f(u(e,t),t),o=0;o<n.length;o++){var a;if(0===(a=n[o]).refs){for(var l=0;l<a.parts.length;l++)a.parts[l]();delete r[a.id]}}}};var w,S=(w=[],function(e,t){return w[e]=t,w.filter(Boolean).join("\n")});function x(e,t,s,n){var o=s?"":n.css;if(e.styleSheet)e.styleSheet.cssText=S(t,o);else{var r=document.createTextNode(o),i=e.childNodes;i[t]&&e.removeChild(i[t]),i.length?e.insertBefore(r,i[t]):e.appendChild(r)}}function I(e,t){var s=t.css,n=t.media;if(n&&e.setAttribute("media",n),e.styleSheet)e.styleSheet.cssText=s;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(s))}}function C(e,t,s){var n=s.css,o=s.sourceMap,r=void 0===t.convertToAbsoluteUrls&&o;(t.convertToAbsoluteUrls||r)&&(n=p(n)),o&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var i=new Blob([n],{type:"text/css"}),a=e.href;e.href=URL.createObjectURL(i),a&&URL.revokeObjectURL(a)}},408:e=>{e.exports=function(e){var t="undefined"!=typeof window&&window.location;if(!t)throw new Error("fixUrls requires window.location");if(!e||"string"!=typeof e)return e;var s=t.protocol+"//"+t.host,n=s+t.pathname.replace(/\/[^\/]*$/,"/");return e.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(e,t){var o,r=t.trim().replace(/^"(.*)"$/,(function(e,t){return t})).replace(/^'(.*)'$/,(function(e,t){return t}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r)?e:(o=0===r.indexOf("//")?r:0===r.indexOf("/")?s+r:n+r.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")}))}},766:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DropIndicator=void 0;const n=s(359),o=s(42);class r extends n.Component{constructor(){super(...arguments),this.state={type:"none",index:0,depth:0}}render(){const{type:e,index:t,depth:s}=this.state,{rowHeight:r,indent:i}=this.props,a=t*r,l={left:"0",top:`${a}px`,width:"100%",height:`${r}px`},c={top:a-1+"px",height:"0",left:(s+1)*i+"px",width:`calc(100% - ${(s+1)*i}px)`};return n.createElement("div",null,n.createElement("div",{className:(0,o.default)("react-dragv-tree_dropOver",this.props.dropOverClassName),hidden:"over"!==e,style:l}),n.createElement("div",{className:(0,o.default)("react-dragv-tree_dropBetween",this.props.dropBetweenClassName),hidden:"between"!==e,style:c}))}}t.DropIndicator=r},695:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Toggler=void 0;const n=s(359),o=s(42);t.Toggler=function(e){const t=(0,o.default)("react-dragv-tree_toggler",{"react-dragv-tree_toggler-visible":e.visible,"react-dragv-tree_toggler-collapsed":e.collapsed});return n.createElement("div",{className:t,onClick:e.onClick})}},691:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Tree=t.guid=void 0;const n=s(359),o=s(42),r=s(916);s(944),t.guid=(e=32,t=!0,s=null)=>{const n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),o=[];if(s=s||n.length,e)for(let t=0;t<e;t++)o[t]=n[0|Math.random()*s];else{let e;o[8]=o[13]=o[18]=o[23]="-",o[14]="4";for(let t=0;t<36;t++)o[t]||(e=0|16*Math.random(),o[t]=n[19==t?3&e|8:e])}return t?(o.shift(),"u"+o.join("")):o.join("")};class i{constructor(e,t,s=!1,n,o,r,i,a,l,c,h){this.title=e,this.children=t,this.collapsed=s,this.key=n,this.id=o,this.img=r,this._package=i,this.show=a,this.pid=l,this.lock=c,this.config=h}getDescendant(e){return 0==e.length?this:this.children?this.children[e[0]].getDescendant(e.slice(1)):void 0}clone(){return new i(this.title,this.children?this.children.map((e=>e.clone())):void 0,this.collapsed,this.key,this.id,this.img,this._package,this.show,this.pid,this.lock,this.config)}static setParamVal(e,t,s,n){if(t&&(e[t]=s),n&&"function"==typeof n&&n(e),e.children&&e.children.length>0)for(let o=0,r=e.children.length;o<r;o++){const r=e.children[o];t&&(r[t]=s);const a=r.children||void 0;a&&a.length>0?i.setParamVal(r,t,s,n):n&&"function"==typeof n&&n(r)}}static generate(e){let t=e.children||void 0;if(t&&t.length>0){t=[];for(let s=0,n=e.children.length;s<n;s++)t.push(i.generate(e.children[s]))}const s=e.title,n=e.collapsed,o=e.key,r=e.id,a=e.img,l=e.package||e._package,c=e.show,h=e.pid,d=e.lock,p=e.config;return new i(s,t,n,o,r,a,l,c,h,d,p)}}const a=(e,t)=>{t&&t.size>0&&((null==t?void 0:t.has(e.key))?e.collapsed=!1:e.collapsed=!0);const s={children:(null==e?void 0:e.children)&&(null==e?void 0:e.children.map((e=>a(e,t)))),key:e.key,collapsed:e.collapsed,img:e.img,package:e._package,show:e.show,pid:e.pid,title:e.title,lock:e.lock,id:e.id,config:e.config};return Object.keys(s).filter((e=>null!=s[e]&&"{}"!==JSON.stringify(s[e]))).reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:s[t]})),{})};class l extends n.Component{constructor(e){super(e),this.treeViewRef=n.createRef(),this.clearSelectedKeys=()=>{var e;(this.state.selectedKeys.size>0||(null===(e=this.state.selectedNode)||void 0===e?void 0:e.length)>0)&&this.setState({selectedKeys:new Set([]),selectedNode:[]})},this.renderRow=e=>{const t=this.state.root.getDescendant(e.path),{selected:s}=e;return this.props.renderRow?this.props.renderRow(e.node,s,e,this.delItem,this.copyItem,this.setItemParams,this.groupTree):n.createElement("div",{className:(0,o.default)("example-cell",{selected:s})},t.title)},this.onContextMenu=(e,t)=>{this.props.onChange&&this.props.onChange("onContextMenu",{info:e,ev:t})},this.onSelectedKeysChange=(e,t)=>{this.setState({selectedKeys:e,selectedNode:t},(()=>{this.props.onChange&&this.props.onChange("onSelectedKeysChange",{selectedKeys:Array.from(e),selectedNode:t})}))},this.delItem=e=>{const{root:t,selectedKeys:s,selectedNode:n}=this.state;let o=[],r=[],i=[];if(e){const{path:s}=e,n=s[s.length-1];o.unshift(n);const a=t.getDescendant(s.slice(0,-1));r.unshift(a);const[l]=a.children.splice(n,1);i.unshift(l)}else if(s.size>0)for(let e=n.length-1;e>=0;e--){const{path:s}=n[e],a=s[s.length-1];o.unshift(a);const l=t.getDescendant(s.slice(0,-1));r.unshift(l);const[c]=l.children.splice(a,1);i.unshift(c)}this.setState({root:t,selectedNode:[],selectedKeys:new Set("")},(()=>{this.props.onChange&&this.props.onChange("onDelItem",{treeData:a(t).children,indexs:o,selectedNode:n,selectedKeys:Array.from(s),destItems:r.map((e=>a(e))),items:i.map((e=>a(e)))})}))},this.groupTree=(e,s)=>{const{root:n,selectedKeys:o,selectedNode:r}=this.state,l=[],c=[];let h;if(s){const{path:o,node:r}=s;if(!e&&!r.children)return;const a=o[o.length-1],d=n.getDescendant(o.slice(0,-1)),[p]=d.children.splice(a,1);if(c.unshift(p),l.unshift(n.getDescendant(o.slice(0,-1))),e){const e=(0,t.guid)(10);h=i.generate({title:"分组",children:c,id:e,key:e,collapsed:!1}),"function"==typeof this.props.groupItemFormatFunc&&this.props.groupItemFormatFunc&&this.props.groupItemFormatFunc(h),l[0].children.splice(o[o.length-1],0,h),l[0].collapsed=!1}else{const e=p;e.children&&e.children.length>0&&(l[0].children.splice(o[o.length-1],0,...e.children),l[0].collapsed=!1)}}else if(o.size>0){for(let t=r.length-1;t>=0;--t){const{path:s,node:o}=r[t];if(!e&&(!o.children||o.children<=0))break;const i=s[s.length-1],a=n.getDescendant(s.slice(0,-1)),[h]=a.children.splice(i,1);c.unshift(h),l.unshift(n.getDescendant(s.slice(0,-1)))}if(l.length<=0||c.length<=0)return;if(e){const e=(0,t.guid)(10);h=i.generate({title:"分组",children:c,id:e,key:e,collapsed:!1}),"function"==typeof this.props.groupItemFormatFunc&&this.props.groupItemFormatFunc&&this.props.groupItemFormatFunc(h);const s=r[0].path;l[0].children.splice(s[s.length-1],0,h),l[0].collapsed=!1}else l.forEach(((e,t)=>{const s=r[t],n=c[t];n.children&&n.children.length>0&&(e.children.splice(s.path[s.path.length-1],0,...n.children),e.collapsed=!1)}))}this.setState({root:n,selectedNode:r},(()=>{const t=new Set(c.map((e=>e.key))),s=this.getNodeArr(t);this.setState({selectedKeys:t,selectedNode:s},(()=>{this.props.onChange&&this.props.onChange(e?"onGroupTree":"onGroupTreeDel",{treeData:a(n).children,selectedNode:s,selectedKeys:Array.from(t),destItems:l.map((e=>a(e))),items:c.map((e=>a(e))),groupInfo:h&&a(h)||""})}))}))},this.pasteItem=(e,t,s,n=[])=>{var o;const{root:r}=this.state,l=[],c=[],h={};for(let s=t.length-1;s>=0;--s){const o=i.generate(t[s].node?t[s].node:t[s]).clone();(null==n?void 0:n.length)<=0&&"function"==typeof this.props.copyItemFormatFunc&&i.setParamVal(o,"","",(e=>{const t=e.id,s=this.props.copyItemFormatFunc&&this.props.copyItemFormatFunc(e);s&&(h[t]=s.id)})),c.unshift(o),l.unshift(r.getDescendant(e))}(null===(o=l[l.length-1].children)||void 0===o?void 0:o.length)?l[l.length-1].children.splice(e[e.length-1]+1,0,...c):l[l.length-1].children=c,l[l.length-1].collapsed=!1,this.setState({root:r},(()=>{const e=new Set(c.map((e=>e.key))),t=this.getNodeArr(e);this.setState({selectedKeys:e,selectedNode:t},(()=>{const o={treeData:a(r).children,selectedNode:t,selectedKeys:Array.from(e),mapping:h,diyData:s};(null==n?void 0:n.length)>0&&(o.trashIds=n),this.props.onChange&&this.props.onChange("onPaste",o)}))}))},this.copyItem=(e,t=!0)=>{const{root:s,selectedKeys:n,selectedNode:o}=this.state,r=[],l=[],c={};if(e){const{path:t}=e,n=t[t.length-1],o=s.getDescendant(t.slice(0,-1)).children[n].clone();"function"==typeof this.props.copyItemFormatFunc&&i.setParamVal(o,"","",(e=>{const t=e.id,s=this.props.copyItemFormatFunc&&this.props.copyItemFormatFunc(e);s&&(c[t]=s.id)})),l.unshift(o),r.unshift(s.getDescendant(t.slice(0,-1))),r[0].children.splice(n+1,0,o),r[0].collapsed=!1}else if(n.size>0){let e=null;for(let t=o.length-1;t>=0;--t){const{path:n}=o[t],a=n[n.length-1],h=s.getDescendant(n.slice(0,-1)).children[a].clone();"function"==typeof this.props.copyItemFormatFunc&&i.setParamVal(h,"","",(e=>{const t=e.id,s=this.props.copyItemFormatFunc&&this.props.copyItemFormatFunc(e);s&&(c[t]=s.id)})),l.unshift(h),r.unshift(s.getDescendant(n.slice(0,-1))),t===o.length-1&&(e=a)}t&&(r[r.length-1].children.splice(e+1,0,...l),r[r.length-1].collapsed=!1)}t?this.setState({root:s},(()=>{const e=new Set(l.map((e=>e.key))),t=this.getNodeArr(e);this.setState({selectedKeys:e,selectedNode:t},(()=>{this.props.onChange&&this.props.onChange("onCopyItem",{treeData:a(s).children,selectedNode:t,selectedKeys:Array.from(e),mapping:c})}))})):this.props.onChange&&this.props.onChange("onCopyItemNoPaste",{treeData:a(s).children,selectedNode:o,selectedKeys:Array.from(n),mapping:c})},this.getNodeArr=e=>this.treeViewRef.current.keysToInfos(e),this.setItemParams=(e,t,s)=>{const{root:n,selectedKeys:o,selectedNode:r}=this.state;let i=[],l=[],c=[];if(s){const{path:o,node:r}=s,a=o[o.length-1];i.unshift(a);const h=n.getDescendant(o.slice(0,-1));l.unshift(h);const d=h.children[a];c.unshift(d),d[e]="__toggle"===t&&"boolean"==typeof d[e]?!d[e]:t,r[e]=d[e]}else if(o.size>0)for(let s=r.length-1;s>=0;s--){const{path:o,node:a}=r[s],h=o[o.length-1];i.unshift(h);const d=n.getDescendant(o.slice(0,-1));l.unshift(d);const p=d.children[h];c.unshift(p),p[e]="__toggle"===t&&"boolean"==typeof p[e]?!p[e]:t,a[e]=p[e]}this.setState({root:n},(()=>{const s=this.getNodeArr(this.state.selectedKeys);this.setState({selectedNode:s},(()=>{this.props.onChange&&this.props.onChange("onSetItemParams",{indexs:i,params:e,value:t,treeData:a(n).children,selectedNode:s,selectedKeys:Array.from(this.state.selectedKeys),parents:l.map((e=>a(e))),items:c.map((e=>a(e)))})}))}))},this.expandTree=(e="single",t=!0)=>{const{root:s,selectedKeys:n,selectedNode:o}=this.state;if("single"===e){if(!n.size)return;for(let e=o.length-1;e>=0;e--){const{path:n,node:r}=o[e],i=n[n.length-1],a=s.getDescendant(n.slice(0,-1)).children[i];a.collapsed="__toggle"===t&&"boolean"==typeof a.collapsed?!a.collapsed:t,r.collapsed=a.collapsed}}else"all"===e&&i.setParamVal(s,"collapsed",t);this.setState({root:s,expandedKeys:new Set([])},(()=>{const n=this.getNodeArr(this.state.selectedKeys);this.setState({selectedNode:n},(()=>{this.props.onChange&&this.props.onChange("onExpandTree",{type:e,treeData:a(s).children,selectedNode:n,selectedKeys:Array.from(this.state.selectedKeys),collapsed:t})}))}))},this.setLayer=e=>{const{root:t,selectedKeys:s,selectedNode:n}=this.state;if(s.size)switch(e){case"upper":case"next":{const s=[],o=[];for(let r=n.length-1;r>=0;r--){const{path:i}=n[r],a=i[i.length-1],l=t.getDescendant(i.slice(0,-1)),[c]=l.children.splice(a,1);o.unshift(c),"next"===e?i[i.length-1]=parseInt(i)+1<l.children.length?parseInt(i)+1:l.children.length:"upper"===e&&(i[i.length-1]=i-1>0?i-1:0),s.unshift(t.getDescendant(i.slice(0,-1)))}s.forEach(((e,t)=>{const s=n[t];e.children.splice(s.path[s.path.length-1],0,o[t]),e.collapsed=!1})),this.setState({root:t,selectedNode:n},(()=>{const s=new Set(o.map((e=>e.key))),n=this.getNodeArr(s);this.setState({selectedKeys:s,selectedNode:n},(()=>{this.props.onChange&&this.props.onChange("onSetLayer",{type:e,treeData:a(t).children,selectedNode:n,selectedKeys:Array.from(s)})}))}));break}case"top":case"bottom":{const s=[],o=[];for(let r=n.length-1;r>=0;r--){const{path:i}=n[r],a=i[i.length-1],l=t.getDescendant(i.slice(0,-1)),[c]=l.children.splice(a,1);o.unshift(c),"top"===e?i[i.length-1]=0:"bottom"===e&&(i[i.length-1]=l.children.length),s.unshift(t.getDescendant(i.slice(0,-1)))}s.forEach(((t,s)=>{"top"===e?t.children.unshift(o[s]):"bottom"===e&&t.children.push(o[s]),t.collapsed=!1})),this.setState({root:t},(()=>{const s=new Set(o.map((e=>e.key))),n=this.getNodeArr(s);this.setState({selectedKeys:s,selectedNode:n},(()=>{this.props.onChange&&this.props.onChange("onSetLayer",{type:e,treeData:a(t).children,selectedNode:n,selectedKeys:Array.from(s)})}))}));break}}},this.onCollapsedChange=(e,t)=>{this.state.root.getDescendant(e.path).collapsed=t,this.setState({root:this.state.root,expandedKeys:new Set([])},(()=>{this.props.onChange&&this.props.onChange("onCollapsedChange",{treeData:a(this.state.root).children,info:e,collapsed:t})}))},this.onMove=(e,t,s,n)=>{const{root:o}=this.state,r=[];for(let t=e.length-1;t>=0;--t){const{path:s}=e[t],i=s[s.length-1],a=o.getDescendant(s.slice(0,-1)),[l]=a.children.splice(i,1);r.unshift(l),e[t].path=n}const i=o.getDescendant(n.slice(0,-1));i.children.splice(n[n.length-1],0,...r),i.collapsed=!1,this.setState({root:o},(()=>{const e=new Set(r.map((e=>e.key))),i=this.getNodeArr(e);this.setState({selectedKeys:e,selectedNode:i},(()=>{this.props.onChange&&this.props.onChange("onMove",{treeData:a(o).children,selectedNode:i,selectedKeys:Array.from(e),dest:t,destIndex:s,destPathAfterMove:n})}))}))},this.onCopy=(e,t,s)=>{const{root:n}=this.state,o=[],r={};for(let t=e.length-1;t>=0;--t){const{path:s}=e[t],a=s[s.length-1],l=n.getDescendant(s.slice(0,-1)).children[a].clone();"function"==typeof this.props.copyItemFormatFunc&&i.setParamVal(l,"","",(e=>{const t=e.id,s=this.props.copyItemFormatFunc&&this.props.copyItemFormatFunc(e);s&&(r[t]=s.id)})),o.unshift(l)}const l=n.getDescendant(t.path);l.children.splice(s,0,...o),l.collapsed=!1,this.setState({root:n},(()=>{const i=new Set(o.map((e=>e.key))),l=this.getNodeArr(i);this.setState({selectedKeys:i,selectedNode:l},(()=>{this.props.onChange&&this.props.onChange("onCopy",{treeData:a(n).children,selectedNode:l,selectedKeys:Array.from(i),src:e,dest:t,destIndex:s,mapping:r})}))}))};const s=i.generate({collapsed:!1,key:"root",title:"root",children:e.data});this.state={root:s,selectedKeys:new Set(e.selectedKeys||[]),selectedNode:[],expandedKeys:new Set([])}}componentDidUpdate(e,t){if(JSON.stringify(this.props.data)!==JSON.stringify(e.data)){const e=i.generate({collapsed:!1,key:"root",title:"root",children:this.props.data});this.setState({root:e})}JSON.stringify(this.props.selectedKeys)!==JSON.stringify(e.selectedKeys)&&this.setSelectedData(this.props.selectedKeys)}setSelectedData(e){const t=this.getNodeArr(new Set(e));this.setState({selectedKeys:new Set(e),selectedNode:t})}componentWillUnmount(){this.setState=(e,t)=>{}}render(){const{root:e,selectedKeys:t,expandedKeys:s}=this.state;return n.createElement(r.TreeView,{ref:this.treeViewRef,root:a(e,s),selectedKeys:t,expandedKeys:s,hoverBackground:this.props.hoverBackground||"#2C2F38",activeBackground:this.props.activeBackground||"#177ddc",searchVal:this.props.searchVal||"",rowHeight:this.props.rowHeight||40,indent:this.props.indent||20,className:this.props.className||"example-tree",rowContent:this.renderRow,onContextMenu:this.onContextMenu,onSelectedKeysChange:this.onSelectedKeysChange,onCollapsedChange:this.onCollapsedChange,onHover:this.props.onHover&&this.props.onHover,onMove:this.onMove,onCopy:this.onCopy,onSearchScroll:(e,t,s)=>{this.props.onChange&&this.props.onChange("onSearchScroll",{searchOffsetNum:e,offsetTop:t,id:s})},onSearch:(e,t,s,n,o)=>{this.setState({expandedKeys:new Set(o)},(()=>{this.props.onChange&&this.props.onChange("onSearch",{searchPathList:e,searchOffsetNum:t,offsetTop:s,id:n,expandedKeys:o})}))},onInit:(e,t)=>{this.setState({selectedKeys:e,selectedNode:t},(()=>{this.props.onChange&&this.props.onChange("onInit",{selectedKeys:e,selectedNode:t})}))}})}}t.Tree=l},874:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TreeView=void 0;const n=s(359),o=s(42),r=s(695),i=s(766),a=s(482),l="x-react-draggable-tree-drag";class c extends n.Component{constructor(e){super(e),this.infoToPath=new Map,this.pathToInfo=new Map,this.visibleInfos=[],this.keyToInfo=new Map,this.searchScroll=e=>{if(!this.state.searchPathList||this.state.searchPathList.length<=0)return;let t=this.state.searchOffsetNum;if("top"===e&&t>0)t--;else{if(!("bottom"===e&&t<this.state.searchPathList.length-1))return;t++}const s=document.querySelector(`.${this.props.className} [data-id="${this.state.searchPathList[t]}"]`),n=s&&t>=0&&t<=this.state.searchPathList.length?s.offsetTop:0;this.setState({searchOffsetNum:t},(()=>{this.props.onSearchScroll&&this.props.onSearchScroll(t+1,n,s?s.getAttribute("data-id"):"")}))},this.getParentElement=e=>!e||e.className.indexOf("react-dragv-tree-wrap")>-1?null:e.className.indexOf("react-dragv-tree_children")>-1?e:this.getParentElement(e.parentElement),this.searchEnv=e=>{if(""===e)return!1;requestAnimationFrame((()=>{var t;const s=document.querySelectorAll(`.${this.props.className} [data-id]`),n=[],o=[];for(let r=0,i=s.length;r<i;r++){const i=s[r].getAttribute("data-title");if(i&&i.indexOf(e)>-1){const e=s[r].getAttribute("data-id");n.includes(e)||n.push(e);const i=this.getParentElement(s[r]);i&&o.push(null===(t=i.previousSibling)||void 0===t?void 0:t.getAttribute("data-id"))}}const r=document.querySelector(`.${this.props.className} [data-id="${n[0]}"]`),i=(null==r?void 0:r.offsetTop)||0;this.setState({searchPathList:n,searchOffsetNum:0},(()=>{this.props.onSearch&&this.props.onSearch(n,r?1:0,i,r?r.getAttribute("data-id"):"",o)}))}))},this.onMouseOver=(e,t)=>{this.props.onHover&&this.props.onHover("mouseover",e,t)},this.onMouseLeave=(e,t)=>{this.props.onHover&&this.props.onHover("mouseleave",e,t)},this.onClickRow=(e,t)=>{var s;t.preventDefault(),t.stopPropagation();const n=new Map;for(const e of this.visibleInfos)if(null===(s=e.node)||void 0===s?void 0:s.children)for(const t of e.node.children)n.set(t.key,e);const{selectedKeys:o}=this.props,{key:r}=e.node;let i;if(t.ctrlKey||t.metaKey){let e=new Set,t=n.get(r);for(;t&&!e.has(t.node.key);)e.add(t.node.key),t=n.get(t.node.key);if(i=new Set(o),[...i].some((t=>e.has(t))))return;i.has(r)?i.delete(r):i.add(r)}else if(t.shiftKey&&o.size>0){const e=this.visibleInfos.map((e=>e.node.key)),t=this.keysToInfos(o).map((e=>e.visibleOffset)),s=e.indexOf(r),a=Math.min(s,...t),l=Math.max(s,...t),c=e.slice(a,l+1);i=new Set(o);for(const e of c){let t=new Set,s=n.get(e);for(;s&&!t.has(s.node.key);)t.add(s.node.key),s=n.get(s.node.key);[...i].some((e=>t.has(e)))||i.add(e)}}else i=new Set([r]);i=this.removeAncestorsFromSelection(i),this.props.onSelectedKeysChange(i,this.keysToInfos(i))},this.onContextMenu=e=>{const{rowHeight:t,selectedKeys:s}=this.props,{visibleInfos:n}=this,o=this.element.getBoundingClientRect(),r=e.clientY-o.top+this.element.scrollTop,i=Math.floor(r/t),a=0<=i&&i<n.length?n[i]:void 0;a&&!s.has(a.node.key)&&this.onClickRow(a,e),this.props.onContextMenu&&this.props.onContextMenu(a,e)},this.onDragOver=e=>{e.preventDefault();const t=e.altKey||e.ctrlKey;e.dataTransfer.dropEffect=t?"copy":"move";const s=this.getDropTarget(e);this.canDrop(s.dest,s.destIndex)?this.updateDropIndicator(s):this.updateDropIndicator(void 0)},this.onDrop=e=>{if(this.updateDropIndicator(void 0),!e.dataTransfer.getData(l))return;let{clientX:t,clientY:s}=e;const n=this.getDropTarget({clientX:t,clientY:s}),{dest:o,destIndex:r}=n;if(!this.canDrop(o,r))return;const i=this.keysToInfos(this.props.selectedKeys);if(e.altKey||e.ctrlKey)this.props.onCopy(i,o,r);else{const e=[...o.path,r],t=[...e];for(const s of i){const n=s.path.slice(0,-1),o=s.path[s.path.length-1];for(let s=0;s<e.length;++s){const r=e.slice(0,s),i=e[s];(0,a.isPathEqual)(n,r)&&o<i&&--t[s]}}this.props.onMove(i,o,r,t)}e.preventDefault()},this.state={searchPathList:[],searchOffsetNum:0}}componentWillUnmount(){this.setState=(e,t)=>{}}componentDidMount(){this.props.onInit&&this.props.onInit(this.props.selectedKeys,this.keysToInfos(this.props.selectedKeys))}render(){const{root:e,rowHeight:t,indent:s}=this.propsWithDefaults(),r=e.children||[];this.clearRows();const a={node:e,selected:!1,current:!1,path:[],visible:!1,visibleOffset:0};this.addRowInfo(a),this.rootInfo=a;const l=(0,o.default)("react-dragv-tree-wrap",this.props.className);return n.createElement("div",{ref:e=>this.element=e,className:l,onDragOver:this.onDragOver,onDrop:this.onDrop,onContextMenu:this.onContextMenu},r.map(((e,t)=>this.renderNode(e,[t],!0))),n.createElement(i.DropIndicator,{ref:e=>this.dropIndicator=e,rowHeight:t,indent:s,dropOverClassName:this.props.dropOverIndicatorClassName,dropBetweenClassName:this.props.dropBetweenIndicatorClassName}))}removeAncestorsFromSelection(e){const t=new Set(e);for(const{path:s}of this.keysToInfos(e))for(let e=1;e<s.length;++e){const n=s.slice(0,e),o=this.pathToInfo.get(n.join());o&&t.delete(o.node.key)}return t}propsWithDefaults(){return Object.assign({},{indent:20},this.props)}clearRows(){this.visibleInfos=[],this.pathToInfo.clear(),this.infoToPath.clear(),this.keyToInfo.clear()}addRowInfo(e){this.infoToPath.set(e,e.path),this.pathToInfo.set(e.path.join(),e),e.visible&&this.visibleInfos.push(e),this.keyToInfo.set(e.node.key,e)}renderNode(e,t,s){const{indent:i,rowHeight:a,selectedKeys:c}=this.propsWithDefaults(),{key:h}=e,d=c.has(h),p={node:e,selected:d,path:t,visible:s,visibleOffset:this.visibleInfos.length};this.addRowInfo(p);const f={paddingLeft:(t.length-1)*i+"px",height:a+"px"},u=(0,o.default)("react-dragv-tree_row",this.props.rowClassName,d&&this.props.rowSelectedClassName,{"react-dragv-tree_row-selected":d}),{children:g,collapsed:y}=e,m=this.props.toggler||r.Toggler,v=this.props.rowContent;let b=n.createElement("div",{key:`row-${h}`,className:u,style:f,onClick:e=>this.onClickRow(p,e),onMouseOver:e=>this.onMouseOver(p,e),onMouseLeave:e=>this.onMouseLeave(p,e),"data-title":e.title,"data-id":e.id,draggable:!0,onDragStart:e=>{if(e.dataTransfer.effectAllowed="copyMove",e.dataTransfer.setData(l,"drag"),!c.has(h)){const e=new Set([h]);this.props.onSelectedKeysChange(e,this.keysToInfos(e))}},onDragEnd:()=>{this.updateDropIndicator(void 0)}},n.createElement(m,{visible:!!g,collapsed:y,onClick:t=>{t.preventDefault(),t.stopPropagation(),e.children&&(this.props.onCollapsedChange(p,!y),t.stopPropagation())}}),n.createElement(v,Object.assign({},p)));if(g){const e=s&&!y,r=(0,o.default)("react-dragv-tree_children",this.props.childrenClassName);return[b,n.createElement("div",{key:`children-${h}`,className:r,hidden:y},g.map(((s,n)=>this.renderNode(s,[...t,n],e))))]}return[b]}keysToInfos(e){const t=[];return e.forEach((e=>{const s=this.keyToInfo.get(e);s&&t.push(s)})),t.sort(((e,t)=>(0,a.comparePaths)(e.path,t.path))),t}updateDropIndicator(e){if(e){const{type:t,index:s,depth:n}=e;this.dropIndicator.setState({type:t,index:s,depth:n})}else this.dropIndicator.setState({type:"none",index:0,depth:0})}getDropTarget(e){const{rowHeight:t,indent:s}=this.propsWithDefaults(),n=this.element.getBoundingClientRect(),o=e.clientX-n.left+this.element.scrollLeft,r=e.clientY-n.top+this.element.scrollTop,i=(0,a.clamp)(Math.floor(r/t),0,this.visibleInfos.length),l=r-i*t;if(i<this.visibleInfos.length&&.25*t<l&&l<.75*t){const e=this.visibleInfos[i];if(e.node.children)return{type:"over",index:i,dest:e,destIndex:0,depth:0}}const c=(0,a.clamp)(l<t/2?i:i+1,0,this.visibleInfos.length);let h=c===this.visibleInfos.length?[this.rootInfo.node.children.length]:this.visibleInfos[c].path;if(0<c){const e=this.visibleInfos[c-1];let t=e.path;const n=e.node.children,r=e.node.collapsed;if(n&&0===n.length&&!r&&(t=[...t,-1]),h.length<t.length){const e=(0,a.clamp)(Math.floor(o/s)-1,h.length,t.length);h=[...t.slice(0,e-1),t[e-1]+1]}}const d=h.slice(0,-1);return{type:"between",index:c,dest:this.pathToInfo.get(d.join()),destIndex:h[h.length-1],depth:h.length-1}}canDrop(e,t){const{selectedKeys:s}=this.props,{path:n}=e;for(let e=0;e<n.length;++e){const t=n.slice(0,n.length-e),o=this.pathToInfo.get(t.join());if(o){const e=o.node.key;if(s.has(e))return!1}}return!0}}t.TreeView=c},916:function(e,t,s){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,s,n){void 0===n&&(n=s),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[s]}})}:function(e,t,s,n){void 0===n&&(n=s),e[n]=t[s]}),o=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||n(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),o(s(502),t),o(s(874),t),o(s(691),t),o(s(695),t),o(s(766),t)},502:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},482:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isPathEqual=t.comparePaths=t.clamp=void 0,t.clamp=function(e,t,s){return Math.max(t,Math.min(e,s))},t.comparePaths=function(e,t){for(let s=0;;++s){if(e.length===s&&t.length===s)return 0;if(e.length===s||e[s]<t[s])return-1;if(t.length===s||t[s]<e[s])return 1}},t.isPathEqual=function(e,t){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(e[s]!==t[s])return!1;return!0}},359:t=>{"use strict";t.exports=e}},s={},n=function e(n){var o=s[n];if(void 0!==o)return o.exports;var r=s[n]={id:n,exports:{}};return t[n].call(r.exports,r,r.exports,e),r.exports}(691),n;var t,s,n}));
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("react"));else if("function"==typeof define&&define.amd)define(["react"],t);else{var s="object"==typeof exports?t(require("react")):t(e.React);for(var n in s)("object"==typeof exports?exports:e)[n]=s[n]}}(self,(function(e){return t={42:(e,t)=>{var s;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var s=arguments[t];if(s){var r=typeof s;if("string"===r||"number"===r)e.push(s);else if(Array.isArray(s)){if(s.length){var i=o.apply(null,s);i&&e.push(i)}}else if("object"===r)if(s.toString===Object.prototype.toString)for(var a in s)n.call(s,a)&&s[a]&&e.push(a);else e.push(s.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(s=function(){return o}.apply(t,[]))||(e.exports=s)}()},848:(e,t,s)=>{(e.exports=s(506)(!1)).push([e.id,'\r\n.react-dragv-tree-wrap {\r\n display: flex;\r\n flex-direction: column;\r\n position: relative;\r\n}\r\n.react-dragv-tree_row {\r\n display: flex;\r\n align-items: center;\r\n}\r\n.react-dragv-tree_row-selected {\r\n background-color: #e0e0e0;\r\n}\r\n.react-dragv-tree_toggler {\r\n width: 10px;\r\n height: 10px;\r\n margin: 0px;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n}\r\n.react-dragv-tree_toggler:before {\r\n content: "";\r\n display: block;\r\n width: 5px;\r\n height: 5px;\r\n box-sizing: border-box;\r\n border-right: 1px solid gray;\r\n border-bottom: 1px solid gray;\r\n transform: rotate(45deg);\r\n transition: all linear 0.2s;\r\n visibility: hidden;\r\n}\r\n.react-dragv-tree_toggler-visible{\r\n margin-left: 10px;\r\n margin-right: 5px;\r\n}\r\n.react-dragv-tree_toggler-visible:before {\r\n visibility: visible;\r\n}\r\n.react-dragv-tree_toggler-collapsed:before {\r\n transform: rotate(-45deg);\r\n}\r\n.react-dragv-tree_dropOver {\r\n position: absolute;\r\n box-sizing: border-box;\r\n pointer-events: none;\r\n border: 2px solid #2196F3;\r\n}\r\n.react-dragv-tree_dropBetween {\r\n position: absolute;\r\n pointer-events: none;\r\n border: 1px solid #2196F3;\r\n}',""])},506:e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var s=function(e,t){var s,n=e[1]||"",o=e[3];if(!o)return n;if(t&&"function"==typeof btoa){var r=(s=o,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(s))))+" */"),i=o.sources.map((function(e){return"/*# sourceURL="+o.sourceRoot+e+" */"}));return[n].concat(i).concat([r]).join("\n")}return[n].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+s+"}":s})).join("")},t.i=function(e,s){"string"==typeof e&&(e=[[null,e,""]]);for(var n={},o=0;o<this.length;o++){var r=this[o][0];"number"==typeof r&&(n[r]=!0)}for(o=0;o<e.length;o++){var i=e[o];"number"==typeof i[0]&&n[i[0]]||(s&&!i[2]?i[2]=s:s&&(i[2]="("+i[2]+") and ("+s+")"),t.push(i))}},t}},944:(e,t,s)=>{var n=s(848);"string"==typeof n&&(n=[[e.id,n,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};s(688)(n,o),n.locals&&(e.exports=n.locals)},688:(e,t,s)=>{var n,o,r={},i=(n=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===o&&(o=n.apply(this,arguments)),o}),a=function(e){return document.querySelector(e)},l=function(e){var t={};return function(e){if("function"==typeof e)return e();if(void 0===t[e]){var s=a.call(this,e);if(window.HTMLIFrameElement&&s instanceof window.HTMLIFrameElement)try{s=s.contentDocument.head}catch(e){s=null}t[e]=s}return t[e]}}(),c=null,h=0,d=[],p=s(408);function f(e,t){for(var s=0;s<e.length;s++){var n=e[s],o=r[n.id];if(o){o.refs++;for(var i=0;i<o.parts.length;i++)o.parts[i](n.parts[i]);for(;i<n.parts.length;i++)o.parts.push(b(n.parts[i],t))}else{var a=[];for(i=0;i<n.parts.length;i++)a.push(b(n.parts[i],t));r[n.id]={id:n.id,refs:1,parts:a}}}}function u(e,t){for(var s=[],n={},o=0;o<e.length;o++){var r=e[o],i=t.base?r[0]+t.base:r[0],a={css:r[1],media:r[2],sourceMap:r[3]};n[i]?n[i].parts.push(a):s.push(n[i]={id:i,parts:[a]})}return s}function g(e,t){var s=l(e.insertInto);if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var n=d[d.length-1];if("top"===e.insertAt)n?n.nextSibling?s.insertBefore(t,n.nextSibling):s.appendChild(t):s.insertBefore(t,s.firstChild),d.push(t);else if("bottom"===e.insertAt)s.appendChild(t);else{if("object"!=typeof e.insertAt||!e.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var o=l(e.insertInto+" "+e.insertAt.before);s.insertBefore(t,o)}}function y(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e);var t=d.indexOf(e);t>=0&&d.splice(t,1)}function m(e){var t=document.createElement("style");return e.attrs.type="text/css",v(t,e.attrs),g(e,t),t}function v(e,t){Object.keys(t).forEach((function(s){e.setAttribute(s,t[s])}))}function b(e,t){var s,n,o,r;if(t.transform&&e.css){if(!(r=t.transform(e.css)))return function(){};e.css=r}if(t.singleton){var i=h++;s=c||(c=m(t)),n=x.bind(null,s,i,!1),o=x.bind(null,s,i,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(s=function(e){var t=document.createElement("link");return e.attrs.type="text/css",e.attrs.rel="stylesheet",v(t,e.attrs),g(e,t),t}(t),n=C.bind(null,s,t),o=function(){y(s),s.href&&URL.revokeObjectURL(s.href)}):(s=m(t),n=I.bind(null,s),o=function(){y(s)});return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else o()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=i()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var s=u(e,t);return f(s,t),function(e){for(var n=[],o=0;o<s.length;o++){var i=s[o];(a=r[i.id]).refs--,n.push(a)}for(e&&f(u(e,t),t),o=0;o<n.length;o++){var a;if(0===(a=n[o]).refs){for(var l=0;l<a.parts.length;l++)a.parts[l]();delete r[a.id]}}}};var w,S=(w=[],function(e,t){return w[e]=t,w.filter(Boolean).join("\n")});function x(e,t,s,n){var o=s?"":n.css;if(e.styleSheet)e.styleSheet.cssText=S(t,o);else{var r=document.createTextNode(o),i=e.childNodes;i[t]&&e.removeChild(i[t]),i.length?e.insertBefore(r,i[t]):e.appendChild(r)}}function I(e,t){var s=t.css,n=t.media;if(n&&e.setAttribute("media",n),e.styleSheet)e.styleSheet.cssText=s;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(s))}}function C(e,t,s){var n=s.css,o=s.sourceMap,r=void 0===t.convertToAbsoluteUrls&&o;(t.convertToAbsoluteUrls||r)&&(n=p(n)),o&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var i=new Blob([n],{type:"text/css"}),a=e.href;e.href=URL.createObjectURL(i),a&&URL.revokeObjectURL(a)}},408:e=>{e.exports=function(e){var t="undefined"!=typeof window&&window.location;if(!t)throw new Error("fixUrls requires window.location");if(!e||"string"!=typeof e)return e;var s=t.protocol+"//"+t.host,n=s+t.pathname.replace(/\/[^\/]*$/,"/");return e.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(e,t){var o,r=t.trim().replace(/^"(.*)"$/,(function(e,t){return t})).replace(/^'(.*)'$/,(function(e,t){return t}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r)?e:(o=0===r.indexOf("//")?r:0===r.indexOf("/")?s+r:n+r.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")}))}},766:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DropIndicator=void 0;const n=s(359),o=s(42);class r extends n.Component{constructor(){super(...arguments),this.state={type:"none",index:0,depth:0}}render(){const{type:e,index:t,depth:s}=this.state,{rowHeight:r,indent:i}=this.props,a=t*r,l={left:"0",top:`${a}px`,width:"100%",height:`${r}px`},c={top:a-1+"px",height:"0",left:(s+1)*i+"px",width:`calc(100% - ${(s+1)*i}px)`};return n.createElement("div",null,n.createElement("div",{className:(0,o.default)("react-dragv-tree_dropOver",this.props.dropOverClassName),hidden:"over"!==e,style:l}),n.createElement("div",{className:(0,o.default)("react-dragv-tree_dropBetween",this.props.dropBetweenClassName),hidden:"between"!==e,style:c}))}}t.DropIndicator=r},695:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Toggler=void 0;const n=s(359),o=s(42);t.Toggler=function(e){const t=(0,o.default)("react-dragv-tree_toggler",{"react-dragv-tree_toggler-visible":e.visible,"react-dragv-tree_toggler-collapsed":e.collapsed});return n.createElement("div",{className:t,onClick:e.onClick})}},691:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Tree=t.guid=void 0;const n=s(359),o=s(42),r=s(916);s(944),t.guid=(e=32,t=!0,s=null)=>{const n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),o=[];if(s=s||n.length,e)for(let t=0;t<e;t++)o[t]=n[0|Math.random()*s];else{let e;o[8]=o[13]=o[18]=o[23]="-",o[14]="4";for(let t=0;t<36;t++)o[t]||(e=0|16*Math.random(),o[t]=n[19==t?3&e|8:e])}return t?(o.shift(),"u"+o.join("")):o.join("")};class i{constructor(e,t,s=!1,n,o,r,i,a,l,c,h){this.title=e,this.children=t,this.collapsed=s,this.key=n,this.id=o,this.img=r,this._package=i,this.show=a,this.pid=l,this.lock=c,this.config=h}getDescendant(e){return 0==e.length?this:this.children?this.children[e[0]].getDescendant(e.slice(1)):void 0}clone(){return new i(this.title,this.children?this.children.map((e=>e.clone())):void 0,this.collapsed,this.key,this.id,this.img,this._package,this.show,this.pid,this.lock,this.config)}static setParamVal(e,t,s,n){if(t&&(e[t]=s),n&&"function"==typeof n&&n(e),e.children&&e.children.length>0)for(let o=0,r=e.children.length;o<r;o++){const r=e.children[o];t&&(r[t]=s);const a=r.children||void 0;a&&a.length>0?i.setParamVal(r,t,s,n):n&&"function"==typeof n&&n(r)}}static generate(e,t){let s=e.children||void 0;if(s&&s.length>0){s=[];for(let t=0,n=e.children.length;t<n;t++)s.push(i.generate(e.children[t],e.id))}const n=e.title,o=e.collapsed,r=e.key,a=e.id,l=e.img,c=e.package||e._package,h=e.show,d=t,p=e.lock,f=e.config;return new i(n,s,o,r,a,l,c,h,d,p,f)}}const a=(e,t)=>{t&&t.size>0&&((null==t?void 0:t.has(e.key))?e.collapsed=!1:e.collapsed=!0);const s={children:(null==e?void 0:e.children)&&(null==e?void 0:e.children.map((e=>a(e,t)))),key:e.key,collapsed:e.collapsed,img:e.img,package:e._package,show:e.show,pid:e.pid,title:e.title,lock:e.lock,id:e.id,config:e.config};return Object.keys(s).filter((e=>null!=s[e]&&"{}"!==JSON.stringify(s[e]))).reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:s[t]})),{})};class l extends n.Component{constructor(e){super(e),this.treeViewRef=n.createRef(),this.clearSelectedKeys=()=>{var e;(this.state.selectedKeys.size>0||(null===(e=this.state.selectedNode)||void 0===e?void 0:e.length)>0)&&this.setState({selectedKeys:new Set([]),selectedNode:[]})},this.renderRow=e=>{const t=this.state.root.getDescendant(e.path),{selected:s}=e;return this.props.renderRow?this.props.renderRow(e.node,s,e,this.delItem,this.copyItem,this.setItemParams,this.groupTree):n.createElement("div",{className:(0,o.default)("example-cell",{selected:s})},t.title)},this.onContextMenu=(e,t)=>{this.props.onChange&&this.props.onChange("onContextMenu",{info:e,ev:t})},this.onSelectedKeysChange=(e,t)=>{this.setState({selectedKeys:e,selectedNode:t},(()=>{this.props.onChange&&this.props.onChange("onSelectedKeysChange",{selectedKeys:Array.from(e),selectedNode:t})}))},this.delItem=e=>{const{root:t,selectedKeys:s,selectedNode:n}=this.state;let o=[],r=[],i=[];if(e){const{path:s}=e,n=s[s.length-1];o.unshift(n);const a=t.getDescendant(s.slice(0,-1));r.unshift(a);const[l]=a.children.splice(n,1);i.unshift(l)}else if(s.size>0)for(let e=n.length-1;e>=0;e--){const{path:s}=n[e],a=s[s.length-1];o.unshift(a);const l=t.getDescendant(s.slice(0,-1));r.unshift(l);const[c]=l.children.splice(a,1);i.unshift(c)}this.setState({root:t,selectedNode:[],selectedKeys:new Set("")},(()=>{this.props.onChange&&this.props.onChange("onDelItem",{treeData:a(t).children,indexs:o,selectedNode:n,selectedKeys:Array.from(s),destItems:r.map((e=>a(e))),items:i.map((e=>a(e)))})}))},this.groupTree=(e,s)=>{const{root:n,selectedKeys:o,selectedNode:r}=this.state,l=[],c=[];let h;if(s){const{path:o,node:r}=s;if(!e&&!r.children)return;const a=o[o.length-1],d=n.getDescendant(o.slice(0,-1)),[p]=d.children.splice(a,1);if(c.unshift(p),l.unshift(n.getDescendant(o.slice(0,-1))),e){const e=`group-${(0,t.guid)(10)}`;h=i.generate({title:"分组",children:c,id:e,key:e,collapsed:!1}),"function"==typeof this.props.groupItemFormatFunc&&this.props.groupItemFormatFunc&&this.props.groupItemFormatFunc(h),l[0].children.splice(o[o.length-1],0,h),l[0].collapsed=!1}else{const e=p;e.children&&e.children.length>0&&(l[0].children.splice(o[o.length-1],0,...e.children),l[0].collapsed=!1)}}else if(o.size>0){for(let t=r.length-1;t>=0;--t){const{path:s,node:o}=r[t];if(!e&&(!o.children||o.children<=0))break;const i=s[s.length-1],a=n.getDescendant(s.slice(0,-1)),[h]=a.children.splice(i,1);h.pid=a.id,c.unshift(h),l.unshift(n.getDescendant(s.slice(0,-1)))}if(l.length<=0||c.length<=0)return;if(e){const e=`group-${(0,t.guid)(10)}`;h=i.generate({title:"分组",children:c,id:e,key:e,collapsed:!1}),"function"==typeof this.props.groupItemFormatFunc&&this.props.groupItemFormatFunc&&this.props.groupItemFormatFunc(h);const s=r[0].path;l[0].children.splice(s[s.length-1],0,h),l[0].collapsed=!1}else l.forEach(((e,t)=>{const s=r[t],n=c[t];n.children&&n.children.length>0&&(e.children.splice(s.path[s.path.length-1],0,...n.children),e.collapsed=!1)}))}this.setState({root:n,selectedNode:r},(()=>{const t=new Set(c.map((e=>e.key))),s=this.getNodeArr(t);this.setState({selectedKeys:t,selectedNode:s},(()=>{this.props.onChange&&this.props.onChange(e?"onGroupTree":"onGroupTreeDel",{treeData:a(n).children,selectedNode:s,selectedKeys:Array.from(t),destItems:l.map((e=>a(e))),items:c.map((e=>a(e))),groupInfo:h&&a(h)||""})}))}))},this.pasteItem=(e,t,s,n=[])=>{var o;const{root:r}=this.state,l=[],c=[],h={};for(let s=t.length-1;s>=0;--s){const o=i.generate(t[s].node?t[s].node:t[s]).clone();(null==n?void 0:n.length)<=0&&"function"==typeof this.props.copyItemFormatFunc&&i.setParamVal(o,"","",(e=>{const t=e.id,s=this.props.copyItemFormatFunc&&this.props.copyItemFormatFunc(e);s&&(h[t]=s.id)})),c.unshift(o),l.unshift(r.getDescendant(e))}(null===(o=l[l.length-1].children)||void 0===o?void 0:o.length)?l[l.length-1].children.splice(e[e.length-1]+1,0,...c):l[l.length-1].children=c,l[l.length-1].collapsed=!1,this.setState({root:r},(()=>{const e=new Set(c.map((e=>e.key))),t=this.getNodeArr(e);this.setState({selectedKeys:e,selectedNode:t},(()=>{const o={treeData:a(r).children,selectedNode:t,selectedKeys:Array.from(e),mapping:h,diyData:s};(null==n?void 0:n.length)>0&&(o.trashIds=n),this.props.onChange&&this.props.onChange("onPaste",o)}))}))},this.copyItem=(e,t=!0)=>{const{root:s,selectedKeys:n,selectedNode:o}=this.state,r=[],l=[],c={};if(e){const{path:t}=e,n=t[t.length-1],o=s.getDescendant(t.slice(0,-1)).children[n].clone();"function"==typeof this.props.copyItemFormatFunc&&i.setParamVal(o,"","",(e=>{const t=e.id,s=this.props.copyItemFormatFunc&&this.props.copyItemFormatFunc(e);s&&(c[t]=s.id)})),l.unshift(o),r.unshift(s.getDescendant(t.slice(0,-1))),r[0].children.splice(n+1,0,o),r[0].collapsed=!1}else if(n.size>0){let e=null;for(let t=o.length-1;t>=0;--t){const{path:n}=o[t],a=n[n.length-1],h=s.getDescendant(n.slice(0,-1)).children[a].clone();"function"==typeof this.props.copyItemFormatFunc&&i.setParamVal(h,"","",(e=>{const t=e.id,s=this.props.copyItemFormatFunc&&this.props.copyItemFormatFunc(e);s&&(c[t]=s.id)})),l.unshift(h),r.unshift(s.getDescendant(n.slice(0,-1))),t===o.length-1&&(e=a)}t&&(r[r.length-1].children.splice(e+1,0,...l),r[r.length-1].collapsed=!1)}t?this.setState({root:s},(()=>{const e=new Set(l.map((e=>e.key))),t=this.getNodeArr(e);this.setState({selectedKeys:e,selectedNode:t},(()=>{this.props.onChange&&this.props.onChange("onCopyItem",{treeData:a(s).children,selectedNode:t,selectedKeys:Array.from(e),mapping:c})}))})):this.props.onChange&&this.props.onChange("onCopyItemNoPaste",{treeData:a(s).children,selectedNode:o,selectedKeys:Array.from(n),mapping:c})},this.getNodeArr=e=>this.treeViewRef.current.keysToInfos(e),this.setItemParams=(e,t,s)=>{const{root:n,selectedKeys:o,selectedNode:r}=this.state;let i=[],l=[],c=[];if(s){const{path:o,node:r}=s,a=o[o.length-1];i.unshift(a);const h=n.getDescendant(o.slice(0,-1));l.unshift(h);const d=h.children[a];c.unshift(d),d[e]="__toggle"===t&&"boolean"==typeof d[e]?!d[e]:t,r[e]=d[e]}else if(o.size>0)for(let s=r.length-1;s>=0;s--){const{path:o,node:a}=r[s],h=o[o.length-1];i.unshift(h);const d=n.getDescendant(o.slice(0,-1));l.unshift(d);const p=d.children[h];c.unshift(p),p[e]="__toggle"===t&&"boolean"==typeof p[e]?!p[e]:t,a[e]=p[e]}this.setState({root:n},(()=>{const s=this.getNodeArr(this.state.selectedKeys);this.setState({selectedNode:s},(()=>{this.props.onChange&&this.props.onChange("onSetItemParams",{indexs:i,params:e,value:t,treeData:a(n).children,selectedNode:s,selectedKeys:Array.from(this.state.selectedKeys),parents:l.map((e=>a(e))),items:c.map((e=>a(e)))})}))}))},this.expandTree=(e="single",t=!0)=>{const{root:s,selectedKeys:n,selectedNode:o}=this.state;if("single"===e){if(!n.size)return;for(let e=o.length-1;e>=0;e--){const{path:n,node:r}=o[e],i=n[n.length-1],a=s.getDescendant(n.slice(0,-1)).children[i];a.collapsed="__toggle"===t&&"boolean"==typeof a.collapsed?!a.collapsed:t,r.collapsed=a.collapsed}}else"all"===e&&i.setParamVal(s,"collapsed",t);this.setState({root:s,expandedKeys:new Set([])},(()=>{const n=this.getNodeArr(this.state.selectedKeys);this.setState({selectedNode:n},(()=>{this.props.onChange&&this.props.onChange("onExpandTree",{type:e,treeData:a(s).children,selectedNode:n,selectedKeys:Array.from(this.state.selectedKeys),collapsed:t})}))}))},this.setLayer=e=>{const{root:t,selectedKeys:s,selectedNode:n}=this.state;if(s.size)switch(e){case"upper":case"next":{const s=[],o=[];for(let r=n.length-1;r>=0;r--){const{path:i}=n[r],a=i[i.length-1],l=t.getDescendant(i.slice(0,-1)),[c]=l.children.splice(a,1);o.unshift(c),"next"===e?i[i.length-1]=parseInt(i)+1<l.children.length?parseInt(i)+1:l.children.length:"upper"===e&&(i[i.length-1]=i-1>0?i-1:0),s.unshift(t.getDescendant(i.slice(0,-1)))}s.forEach(((e,t)=>{const s=n[t];e.children.splice(s.path[s.path.length-1],0,o[t]),e.collapsed=!1})),this.setState({root:t,selectedNode:n},(()=>{const s=new Set(o.map((e=>e.key))),n=this.getNodeArr(s);this.setState({selectedKeys:s,selectedNode:n},(()=>{this.props.onChange&&this.props.onChange("onSetLayer",{type:e,treeData:a(t).children,selectedNode:n,selectedKeys:Array.from(s)})}))}));break}case"top":case"bottom":{const s=[],o=[];for(let r=n.length-1;r>=0;r--){const{path:i}=n[r],a=i[i.length-1],l=t.getDescendant(i.slice(0,-1)),[c]=l.children.splice(a,1);o.unshift(c),"top"===e?i[i.length-1]=0:"bottom"===e&&(i[i.length-1]=l.children.length),s.unshift(t.getDescendant(i.slice(0,-1)))}s.forEach(((t,s)=>{"top"===e?t.children.unshift(o[s]):"bottom"===e&&t.children.push(o[s]),t.collapsed=!1})),this.setState({root:t},(()=>{const s=new Set(o.map((e=>e.key))),n=this.getNodeArr(s);this.setState({selectedKeys:s,selectedNode:n},(()=>{this.props.onChange&&this.props.onChange("onSetLayer",{type:e,treeData:a(t).children,selectedNode:n,selectedKeys:Array.from(s)})}))}));break}}},this.onCollapsedChange=(e,t)=>{this.state.root.getDescendant(e.path).collapsed=t,this.setState({root:this.state.root,expandedKeys:new Set([])},(()=>{this.props.onChange&&this.props.onChange("onCollapsedChange",{treeData:a(this.state.root).children,info:e,collapsed:t})}))},this.onMove=(e,t,s,n)=>{const{root:o}=this.state,r=[];for(let t=e.length-1;t>=0;--t){const{path:s}=e[t],i=s[s.length-1],a=o.getDescendant(s.slice(0,-1)),[l]=a.children.splice(i,1);r.unshift(l),e[t].path=n}const i=o.getDescendant(n.slice(0,-1));i.children.splice(n[n.length-1],0,...r),i.collapsed=!1,this.setState({root:o},(()=>{const e=new Set(r.map((e=>e.key))),i=this.getNodeArr(e);this.setState({selectedKeys:e,selectedNode:i},(()=>{this.props.onChange&&this.props.onChange("onMove",{treeData:a(o).children,selectedNode:i,selectedKeys:Array.from(e),dest:t,destIndex:s,destPathAfterMove:n})}))}))},this.onCopy=(e,t,s)=>{const{root:n}=this.state,o=[],r={};for(let t=e.length-1;t>=0;--t){const{path:s}=e[t],a=s[s.length-1],l=n.getDescendant(s.slice(0,-1)).children[a].clone();"function"==typeof this.props.copyItemFormatFunc&&i.setParamVal(l,"","",(e=>{const t=e.id,s=this.props.copyItemFormatFunc&&this.props.copyItemFormatFunc(e);s&&(r[t]=s.id)})),o.unshift(l)}const l=n.getDescendant(t.path);l.children.splice(s,0,...o),l.collapsed=!1,this.setState({root:n},(()=>{const i=new Set(o.map((e=>e.key))),l=this.getNodeArr(i);this.setState({selectedKeys:i,selectedNode:l},(()=>{this.props.onChange&&this.props.onChange("onCopy",{treeData:a(n).children,selectedNode:l,selectedKeys:Array.from(i),src:e,dest:t,destIndex:s,mapping:r})}))}))};const s=i.generate({collapsed:!1,key:"root",title:"root",children:e.data});this.state={root:s,selectedKeys:new Set(e.selectedKeys||[]),selectedNode:[],expandedKeys:new Set([])}}componentDidUpdate(e,t){if(JSON.stringify(this.props.data)!==JSON.stringify(e.data)){const e=i.generate({collapsed:!1,key:"root",title:"root",children:this.props.data});this.setState({root:e})}JSON.stringify(this.props.selectedKeys)!==JSON.stringify(e.selectedKeys)&&this.setSelectedData(this.props.selectedKeys)}setSelectedData(e){const t=this.getNodeArr(new Set(e));this.setState({selectedKeys:new Set(e),selectedNode:t})}componentWillUnmount(){this.setState=(e,t)=>{}}render(){const{root:e,selectedKeys:t,expandedKeys:s}=this.state;return n.createElement(r.TreeView,{ref:this.treeViewRef,root:a(e,s),selectedKeys:t,expandedKeys:s,hoverBackground:this.props.hoverBackground||"#2C2F38",activeBackground:this.props.activeBackground||"#177ddc",searchVal:this.props.searchVal||"",rowHeight:this.props.rowHeight||40,indent:this.props.indent||20,className:this.props.className||"example-tree",rowContent:this.renderRow,onContextMenu:this.onContextMenu,onSelectedKeysChange:this.onSelectedKeysChange,onCollapsedChange:this.onCollapsedChange,onHover:this.props.onHover&&this.props.onHover,onMove:this.onMove,onCopy:this.onCopy,onSearchScroll:(e,t,s)=>{this.props.onChange&&this.props.onChange("onSearchScroll",{searchOffsetNum:e,offsetTop:t,id:s})},onSearch:(e,t,s,n,o)=>{this.setState({expandedKeys:new Set(o)},(()=>{this.props.onChange&&this.props.onChange("onSearch",{searchPathList:e,searchOffsetNum:t,offsetTop:s,id:n,expandedKeys:o})}))},onInit:(e,t)=>{this.setState({selectedKeys:e,selectedNode:t},(()=>{this.props.onChange&&this.props.onChange("onInit",{selectedKeys:e,selectedNode:t})}))}})}}t.Tree=l},874:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TreeView=void 0;const n=s(359),o=s(42),r=s(695),i=s(766),a=s(482),l="x-react-draggable-tree-drag";class c extends n.Component{constructor(e){super(e),this.infoToPath=new Map,this.pathToInfo=new Map,this.visibleInfos=[],this.keyToInfo=new Map,this.searchScroll=e=>{if(!this.state.searchPathList||this.state.searchPathList.length<=0)return;let t=this.state.searchOffsetNum;if("top"===e&&t>0)t--;else{if(!("bottom"===e&&t<this.state.searchPathList.length-1))return;t++}const s=document.querySelector(`.${this.props.className} [data-id="${this.state.searchPathList[t]}"]`),n=s&&t>=0&&t<=this.state.searchPathList.length?s.offsetTop:0;this.setState({searchOffsetNum:t},(()=>{this.props.onSearchScroll&&this.props.onSearchScroll(t+1,n,s?s.getAttribute("data-id"):"")}))},this.getParentElement=e=>!e||e.className.indexOf("react-dragv-tree-wrap")>-1?null:e.className.indexOf("react-dragv-tree_children")>-1?e:this.getParentElement(e.parentElement),this.searchEnv=e=>{if(""===e)return!1;requestAnimationFrame((()=>{var t;const s=document.querySelectorAll(`.${this.props.className} [data-id]`),n=[],o=[];for(let r=0,i=s.length;r<i;r++){const i=s[r].getAttribute("data-title");if(i&&i.indexOf(e)>-1){const e=s[r].getAttribute("data-id");n.includes(e)||n.push(e);const i=this.getParentElement(s[r]);i&&o.push(null===(t=i.previousSibling)||void 0===t?void 0:t.getAttribute("data-id"))}}const r=document.querySelector(`.${this.props.className} [data-id="${n[0]}"]`),i=(null==r?void 0:r.offsetTop)||0;this.setState({searchPathList:n,searchOffsetNum:0},(()=>{this.props.onSearch&&this.props.onSearch(n,r?1:0,i,r?r.getAttribute("data-id"):"",o)}))}))},this.onMouseOver=(e,t)=>{this.props.onHover&&this.props.onHover("mouseover",e,t)},this.onMouseLeave=(e,t)=>{this.props.onHover&&this.props.onHover("mouseleave",e,t)},this.onClickRow=(e,t)=>{var s;t.preventDefault(),t.stopPropagation();const n=new Map;for(const e of this.visibleInfos)if(null===(s=e.node)||void 0===s?void 0:s.children)for(const t of e.node.children)n.set(t.key,e);const{selectedKeys:o}=this.props,{key:r}=e.node;let i;if(t.ctrlKey||t.metaKey){let e=new Set,t=n.get(r);for(;t&&!e.has(t.node.key);)e.add(t.node.key),t=n.get(t.node.key);if(i=new Set(o),[...i].some((t=>e.has(t))))return;i.has(r)?i.delete(r):i.add(r)}else if(t.shiftKey&&o.size>0){const e=this.visibleInfos.map((e=>e.node.key)),t=this.keysToInfos(o).map((e=>e.visibleOffset)),s=e.indexOf(r),a=Math.min(s,...t),l=Math.max(s,...t),c=e.slice(a,l+1);i=new Set(o);for(const e of c){let t=new Set,s=n.get(e);for(;s&&!t.has(s.node.key);)t.add(s.node.key),s=n.get(s.node.key);[...i].some((e=>t.has(e)))||i.add(e)}}else i=new Set([r]);i=this.removeAncestorsFromSelection(i),this.props.onSelectedKeysChange(i,this.keysToInfos(i))},this.onContextMenu=e=>{const{rowHeight:t,selectedKeys:s}=this.props,{visibleInfos:n}=this,o=this.element.getBoundingClientRect(),r=e.clientY-o.top+this.element.scrollTop,i=Math.floor(r/t),a=0<=i&&i<n.length?n[i]:void 0;a&&!s.has(a.node.key)&&this.onClickRow(a,e),this.props.onContextMenu&&this.props.onContextMenu(a,e)},this.onDragOver=e=>{e.preventDefault();const t=e.altKey||e.ctrlKey;e.dataTransfer.dropEffect=t?"copy":"move";const s=this.getDropTarget(e);this.canDrop(s.dest,s.destIndex)?this.updateDropIndicator(s):this.updateDropIndicator(void 0)},this.onDrop=e=>{if(this.updateDropIndicator(void 0),!e.dataTransfer.getData(l))return;let{clientX:t,clientY:s}=e;const n=this.getDropTarget({clientX:t,clientY:s}),{dest:o,destIndex:r}=n;if(!this.canDrop(o,r))return;const i=this.keysToInfos(this.props.selectedKeys);if(e.altKey||e.ctrlKey)this.props.onCopy(i,o,r);else{const e=[...o.path,r],t=[...e];for(const s of i){const n=s.path.slice(0,-1),o=s.path[s.path.length-1];for(let s=0;s<e.length;++s){const r=e.slice(0,s),i=e[s];(0,a.isPathEqual)(n,r)&&o<i&&--t[s]}}this.props.onMove(i,o,r,t)}e.preventDefault()},this.state={searchPathList:[],searchOffsetNum:0}}componentWillUnmount(){this.setState=(e,t)=>{}}componentDidMount(){this.props.onInit&&this.props.onInit(this.props.selectedKeys,this.keysToInfos(this.props.selectedKeys))}render(){const{root:e,rowHeight:t,indent:s}=this.propsWithDefaults(),r=e.children||[];this.clearRows();const a={node:e,selected:!1,current:!1,path:[],visible:!1,visibleOffset:0};this.addRowInfo(a),this.rootInfo=a;const l=(0,o.default)("react-dragv-tree-wrap",this.props.className);return n.createElement("div",{ref:e=>this.element=e,className:l,onDragOver:this.onDragOver,onDrop:this.onDrop,onContextMenu:this.onContextMenu},r.map(((e,t)=>this.renderNode(e,[t],!0))),n.createElement(i.DropIndicator,{ref:e=>this.dropIndicator=e,rowHeight:t,indent:s,dropOverClassName:this.props.dropOverIndicatorClassName,dropBetweenClassName:this.props.dropBetweenIndicatorClassName}))}removeAncestorsFromSelection(e){const t=new Set(e);for(const{path:s}of this.keysToInfos(e))for(let e=1;e<s.length;++e){const n=s.slice(0,e),o=this.pathToInfo.get(n.join());o&&t.delete(o.node.key)}return t}propsWithDefaults(){return Object.assign({},{indent:20},this.props)}clearRows(){this.visibleInfos=[],this.pathToInfo.clear(),this.infoToPath.clear(),this.keyToInfo.clear()}addRowInfo(e){this.infoToPath.set(e,e.path),this.pathToInfo.set(e.path.join(),e),e.visible&&this.visibleInfos.push(e),this.keyToInfo.set(e.node.key,e)}renderNode(e,t,s){const{indent:i,rowHeight:a,selectedKeys:c}=this.propsWithDefaults(),{key:h}=e,d=c.has(h),p={node:e,selected:d,path:t,visible:s,visibleOffset:this.visibleInfos.length};this.addRowInfo(p);const f={paddingLeft:(t.length-1)*i+"px",height:a+"px"},u=(0,o.default)("react-dragv-tree_row",this.props.rowClassName,d&&this.props.rowSelectedClassName,{"react-dragv-tree_row-selected":d}),{children:g,collapsed:y}=e,m=this.props.toggler||r.Toggler,v=this.props.rowContent;let b=n.createElement("div",{key:`row-${h}`,className:u,style:f,onClick:e=>this.onClickRow(p,e),onMouseOver:e=>this.onMouseOver(p,e),onMouseLeave:e=>this.onMouseLeave(p,e),"data-title":e.title,"data-id":e.id,draggable:!0,onDragStart:e=>{if(e.dataTransfer.effectAllowed="copyMove",e.dataTransfer.setData(l,"drag"),!c.has(h)){const e=new Set([h]);this.props.onSelectedKeysChange(e,this.keysToInfos(e))}},onDragEnd:()=>{this.updateDropIndicator(void 0)}},n.createElement(m,{visible:!!g,collapsed:y,onClick:t=>{t.preventDefault(),t.stopPropagation(),e.children&&(this.props.onCollapsedChange(p,!y),t.stopPropagation())}}),n.createElement(v,Object.assign({},p)));if(g){const e=s&&!y,r=(0,o.default)("react-dragv-tree_children",this.props.childrenClassName);return[b,n.createElement("div",{key:`children-${h}`,className:r,hidden:y},g.map(((s,n)=>this.renderNode(s,[...t,n],e))))]}return[b]}keysToInfos(e){const t=[];return e.forEach((e=>{const s=this.keyToInfo.get(e);s&&t.push(s)})),t.sort(((e,t)=>(0,a.comparePaths)(e.path,t.path))),t}updateDropIndicator(e){if(e){const{type:t,index:s,depth:n}=e;this.dropIndicator.setState({type:t,index:s,depth:n})}else this.dropIndicator.setState({type:"none",index:0,depth:0})}getDropTarget(e){const{rowHeight:t,indent:s}=this.propsWithDefaults(),n=this.element.getBoundingClientRect(),o=e.clientX-n.left+this.element.scrollLeft,r=e.clientY-n.top+this.element.scrollTop,i=(0,a.clamp)(Math.floor(r/t),0,this.visibleInfos.length),l=r-i*t;if(i<this.visibleInfos.length&&.25*t<l&&l<.75*t){const e=this.visibleInfos[i];if(e.node.children)return{type:"over",index:i,dest:e,destIndex:0,depth:0}}const c=(0,a.clamp)(l<t/2?i:i+1,0,this.visibleInfos.length);let h=c===this.visibleInfos.length?[this.rootInfo.node.children.length]:this.visibleInfos[c].path;if(0<c){const e=this.visibleInfos[c-1];let t=e.path;const n=e.node.children,r=e.node.collapsed;if(n&&0===n.length&&!r&&(t=[...t,-1]),h.length<t.length){const e=(0,a.clamp)(Math.floor(o/s)-1,h.length,t.length);h=[...t.slice(0,e-1),t[e-1]+1]}}const d=h.slice(0,-1);return{type:"between",index:c,dest:this.pathToInfo.get(d.join()),destIndex:h[h.length-1],depth:h.length-1}}canDrop(e,t){const{selectedKeys:s}=this.props,{path:n}=e;for(let e=0;e<n.length;++e){const t=n.slice(0,n.length-e),o=this.pathToInfo.get(t.join());if(o){const e=o.node.key;if(s.has(e))return!1}}return!0}}t.TreeView=c},916:function(e,t,s){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,s,n){void 0===n&&(n=s),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[s]}})}:function(e,t,s,n){void 0===n&&(n=s),e[n]=t[s]}),o=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||n(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),o(s(502),t),o(s(874),t),o(s(691),t),o(s(695),t),o(s(766),t)},502:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},482:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isPathEqual=t.comparePaths=t.clamp=void 0,t.clamp=function(e,t,s){return Math.max(t,Math.min(e,s))},t.comparePaths=function(e,t){for(let s=0;;++s){if(e.length===s&&t.length===s)return 0;if(e.length===s||e[s]<t[s])return-1;if(t.length===s||t[s]<e[s])return 1}},t.isPathEqual=function(e,t){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(e[s]!==t[s])return!1;return!0}},359:t=>{"use strict";t.exports=e}},s={},n=function e(n){var o=s[n];if(void 0!==o)return o.exports;var r=s[n]={id:n,exports:{}};return t[n].call(r.exports,r,r.exports,e),r.exports}(691),n;var t,s,n}));
{
"name": "@dragv/react-draggable-tree",
"version": "1.0.22",
"version": "1.0.23",
"main": "lib/index.js",

@@ -5,0 +5,0 @@ "typings": "lib/index.d.ts",