element-gui
Version:
A Component Library for Vue.js.
1 lines • 37.6 kB
JavaScript
module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/dist/",n(n.s=64)}({0:function(e,t,n){"use strict";function r(e,t,n,r,o,i,d,a){var s,l="function"==typeof e?e.options:e;if(t&&(l.render=t,l.staticRenderFns=n,l._compiled=!0),r&&(l.functional=!0),i&&(l._scopeId="data-v-"+i),d?(s=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),o&&o.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(d)},l._ssrRegister=s):o&&(s=a?function(){o.call(this,(l.functional?this.parent:this).$root.$options.shadowRoot)}:o),s)if(l.functional){l._injectStyles=s;var c=l.render;l.render=function(e,t){return s.call(t),c(e,t)}}else{var h=l.beforeCreate;l.beforeCreate=h?[].concat(h,s):[s]}return{exports:e,options:l}}n.d(t,"a",(function(){return r}))},14:function(e,t){e.exports=require("element-gui/lib/utils/merge")},18:function(e,t){e.exports=require("element-gui/lib/locale")},19:function(e,t){e.exports=require("element-gui/lib/checkbox")},2:function(e,t){e.exports=require("element-gui/lib/utils/util")},23:function(e,t){e.exports=require("throttle-debounce/throttle")},3:function(e,t){e.exports=require("element-gui/lib/utils/dom")},31:function(e,t){e.exports=require("element-gui/lib/transitions/collapse-transition")},34:function(e,t){e.exports=require("element-gui/lib/virtual")},4:function(e,t){e.exports=require("element-gui/lib/mixins/emitter")},64:function(e,t,n){"use strict";n.r(t);var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"el-tree",class:[e.treeSize?"el-tree--"+e.treeSize:"",{"el-tree--highlight-current":e.highlightCurrent,"is-line":e.showLine,"is-dragging":!!e.dragState.draggingNode,"is-drop-not-allow":!e.dragState.allowDrop,"is-drop-inner":"inner"===e.dragState.dropType}],attrs:{role:"tree"}},[e.height?n("el-virtual",{ref:"virtualContainer",staticClass:"el-tree-virtual",style:[{height:e.scrollbar&&e.height?"100%":e.height+"px","overflow-y":e.scrollbar&&e.height?"":"auto"}],attrs:{"wrap-class":"el-tree-virtual__group","item-class":"el-tree-virtual__list","data-key":e.getNodeKey,"data-sources":e.visibleList,"data-component":e.itemComponent,keeps:Math.ceil(e.height/22)+e.extraLine,"extra-props":{renderAfterExpand:e.renderAfterExpand,showCheckbox:e.showCheckbox,renderContent:e.renderContent,treeNodeClass:e.treeNodeClass,onNodeExpand:e.handleNodeExpand}}}):e._l(e.root.childNodes,(function(t){return n("el-tree-node",{key:e.getNodeKey(t),attrs:{node:t,props:e.props,"render-after-expand":e.renderAfterExpand,"show-checkbox":e.showCheckbox,"render-content":e.renderContent,"tree-node-class":e.treeNodeClass},on:{"node-expand":e.handleNodeExpand}})})),e.isEmpty?n("div",{staticClass:"el-tree__empty-block"},[e.$slots.empty?e._t("empty"):n("div",{staticClass:"el-tree__empty-text"},[e._v("\n "+e._s(e.emptyText)+"\n ")])],2):e._e(),n("div",{directives:[{name:"show",rawName:"v-show",value:e.dragState.showDropIndicator,expression:"dragState.showDropIndicator"}],ref:"dropIndicator",staticClass:"el-tree__drop-indicator"})],2)};r._withStripped=!0;var o=n(23),i=n.n(o),d=n(14),a=n.n(d),s="$treeNodeId",l=function(e,t){t&&!t[s]&&Object.defineProperty(t,s,{value:e.id,enumerable:!1,configurable:!1,writable:!1})},c=function(e,t){return e?t[e]:t[s]},h=n(2),u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var f=function(e){for(var t=!0,n=!0,r=!0,o=0,i=e.length;o<i;o++){var d=e[o];(!0!==d.checked||d.indeterminate)&&(t=!1,d.disabled||(r=!1)),(!1!==d.checked||d.indeterminate)&&(n=!1)}return{all:t,none:n,allWithoutDisable:r,half:!t&&!n}},p=function e(t){if(0!==t.childNodes.length&&!t.loading){var n=f(t.childNodes),r=n.all,o=n.none,i=n.half;r?(t.checked=!0,t.indeterminate=!1):i?(t.checked=!1,t.indeterminate=!0):o&&(t.checked=!1,t.indeterminate=!1);var d=t.parent;d&&0!==d.level&&(t.store.checkStrictly||e(d))}},v=function(e,t){var n=e.store.props,r=e.data||{},o=n[t];if("function"==typeof o)return o(r,e);if("string"==typeof o)return r[o];if(void 0===o){var i=r[t];return void 0===i?"":i}},y=0,g=function(){function e(t){for(var n in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.id=y++,this.text=null,this.checked=!1,this.indeterminate=!1,this.data=null,this.expanded=!1,this.parent=null,this.visible=!0,this.isCurrent=!1,this.isSelect=!1,t)t.hasOwnProperty(n)&&(this[n]=t[n]);this.level=0,this.loaded=!1,this.childNodes=[],this.loading=!1,this.parent&&(this.level=this.parent.level+1);var r=this.store;if(!r)throw new Error("[Node]store is required!");r.registerNode(this);var o=r.props;if(o&&void 0!==o.isLeaf){var i=v(this,"isLeaf");"boolean"==typeof i&&(this.isLeafByUser=i)}if(!0!==r.lazy&&this.data?(this.setData(this.data),r.defaultExpandAll&&(this.expanded=!0)):this.level>0&&r.lazy&&r.defaultExpandAll&&this.expand(),Array.isArray(this.data)||l(this,this.data),this.data){var d=r.defaultExpandedKeys,a=r.key;a&&d&&-1!==d.indexOf(this.key)&&this.expand(null,r.autoExpandParent),a&&void 0!==r.currentNodeKey&&this.key===r.currentNodeKey&&(r.currentNode=this,r.currentNode.isCurrent=!0),r.lazy&&r._initDefaultCheckedNode(this),this.updateLeafState()}}return e.prototype.reInitChecked=function(){p(this)},e.prototype.setData=function(e){Array.isArray(e)||l(this,e),this.data=e,this.childNodes=[];for(var t=void 0,n=0,r=(t=0===this.level&&this.data instanceof Array?this.data:v(this,"children")||[]).length;n<r;n++)this.insertChild({data:t[n]})},e.prototype.contains=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=function n(r){for(var o=r.childNodes||[],i=!1,d=0,a=o.length;d<a;d++){var s=o[d];if(s===e||t&&n(s)){i=!0;break}}return i};return n(this)},e.prototype.remove=function(){var e=this.parent;e&&e.removeChild(this)},e.prototype.insertChild=function(t,n,r){if(!t)throw new Error("insertChild error: child is required.");if(!(t instanceof e)){if(!r){var o=this.getChildren(!0)||[];-1===o.indexOf(t.data)&&(void 0===n||n<0?o.push(t.data):o.splice(n,0,t.data))}a()(t,{parent:this,store:this.store}),t=new e(t)}t.level=this.level+1,void 0===n||n<0?this.childNodes.push(t):this.childNodes.splice(n,0,t),this.updateLeafState()},e.prototype.insertBefore=function(e,t){var n=void 0;t&&(n=this.childNodes.indexOf(t)),this.insertChild(e,n)},e.prototype.insertAfter=function(e,t){var n=void 0;t&&-1!==(n=this.childNodes.indexOf(t))&&(n+=1),this.insertChild(e,n)},e.prototype.removeChild=function(e){var t=this.getChildren()||[],n=t.indexOf(e.data);n>-1&&t.splice(n,1);var r=this.childNodes.indexOf(e);r>-1&&(this.store&&this.store.deregisterNode(e),e.parent=null,this.childNodes.splice(r,1)),this.updateLeafState()},e.prototype.removeChildByData=function(e){for(var t=null,n=0;n<this.childNodes.length;n++)if(this.childNodes[n].data===e){t=this.childNodes[n];break}t&&this.removeChild(t)},e.prototype.expand=function(e,t){var n=this,r=function(){if(t)for(var r=n.parent;r.level>0;)r.expanded=!0,r=r.parent;n.expanded=!0,e&&e()};this.shouldLoadData()?this.loadData((function(e){e instanceof Array&&(n.checked?n.setChecked(!0,!0):n.store.checkStrictly||p(n),r())})):r()},e.prototype.doCreateChildren=function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e.forEach((function(e){t.insertChild(a()({data:e},n),void 0,!0)}))},e.prototype.collapse=function(){this.expanded=!1},e.prototype.shouldLoadData=function(){return!0===this.store.lazy&&this.store.load&&!this.loaded},e.prototype.updateLeafState=function(){if(!0!==this.store.lazy||!0===this.loaded||void 0===this.isLeafByUser){var e=this.childNodes;!this.store.lazy||!0===this.store.lazy&&!0===this.loaded?this.isLeaf=!e||0===e.length:this.isLeaf=!1}else this.isLeaf=this.isLeafByUser},e.prototype.setChecked=function(e,t,n,r){var o=this;if(this.indeterminate="half"===e,(!this.store.filterCheckStrictly||this.visible)&&(this.checked=!0===e,!this.store.checkStrictly)){if(!this.shouldLoadData()||this.store.checkDescendants){var i=f(this.childNodes),d=i.all,a=i.allWithoutDisable;this.isLeaf||d||!a||(this.checked=!1,e=!1);var s=function(){if(t){for(var n=o.childNodes,i=0,d=n.length;i<d;i++){var a=n[i];r=r||!1!==e;var s=a.disabled?a.checked:r;a.setChecked(s,t,!0,r)}var l=f(n),c=l.half,h=l.all;h||(o.checked=h,o.indeterminate=c)}};if(this.shouldLoadData())return void this.loadData((function(){s(),p(o)}),{checked:!1!==e});s()}var l=this.parent;l&&0!==l.level&&(n||p(l))}},e.prototype.getChildren=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(0===this.level)return this.data;var t=this.data;if(!t)return null;var n=this.store.props,r="children";return n&&(r=n.children||"children"),void 0===t[r]&&(t[r]=null),e&&!t[r]&&(t[r]=[]),t[r]},e.prototype.updateChildren=function(){var e=this,t=this.getChildren()||[],n=this.childNodes.map((function(e){return e.data})),r={},o=[];t.forEach((function(e,t){var i=e[s];!!i&&Object(h.arrayFindIndex)(n,(function(e){return e[s]===i}))>=0?r[i]={index:t,data:e}:o.push({index:t,data:e})})),this.store.lazy||n.forEach((function(t){r[t[s]]||e.removeChildByData(t)})),o.forEach((function(t){var n=t.index,r=t.data;e.insertChild({data:r},n)})),this.updateLeafState()},e.prototype.loadData=function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!0!==this.store.lazy||!this.store.load||this.loaded||this.loading&&!Object.keys(n).length)e&&e.call(this);else{this.loading=!0;var r=function(r){t.childNodes=[],t.doCreateChildren(r,n),t.loaded=!0,t.loading=!1,t.updateLeafState(),e&&e.call(t,r)};this.store.load(this,r)}},e.prototype.eachNode=function(e){for(var t=[this];t.length>0;){var n=t.shift();t.unshift.apply(t,n.childNodes),e(n)}},e.prototype.reInitChecked=function(){this.store.checkStrictly||p(this)},u(e,[{key:"label",get:function(){return v(this,"label")}},{key:"key",get:function(){var e=this.store.key;return this.data?this.data[e]:null}},{key:"disabled",get:function(){return v(this,"disabled")}},{key:"nextSibling",get:function(){var e=this.parent;if(e){var t=e.childNodes.indexOf(this);if(t>-1)return e.childNodes[t+1]}return null}},{key:"previousSibling",get:function(){var e=this.parent;if(e){var t=e.childNodes.indexOf(this);if(t>-1)return t>0?e.childNodes[t-1]:null}return null}}]),e}(),C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};var k=function(){function e(t){var n=this;for(var r in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.currentNode=null,this.currentNodeKey=null,t)t.hasOwnProperty(r)&&(this[r]=t[r]);(this.nodesMap={},this.root=new g({data:this.data,store:this}),this.lazy&&this.load)?(0,this.load)(this.root,(function(e){n.root.doCreateChildren(e),n._initDefaultCheckedNodes()})):this._initDefaultCheckedNodes()}return e.prototype.filter=function(e){var t=this.filterNodeMethod,n=this.lazy;!function r(o){var i=o.root?o.root.childNodes:o.childNodes,d=!0;return i.forEach((function(n){n.visible=r(n),t.call(n,e,n.data,n)?(d=!1,n.visible=!0):n.visible?d=!1:n.value=!1})),!o.visible&&i.length&&o.root&&(o.root.visible=!1===d),!e||(!o.visible||o.isLeaf||n||o.expand(),!d)}(this)},e.prototype.setData=function(e){e!==this.root.data?(this.root.setData(e),this._initDefaultCheckedNodes()):this.root.updateChildren()},e.prototype.getNode=function(e){if(e instanceof g)return e;var t="object"!==(void 0===e?"undefined":C(e))?e:c(this.key,e);return this.nodesMap[t]||null},e.prototype.insertBefore=function(e,t){var n=this.getNode(t);n.parent.insertBefore({data:e},n)},e.prototype.insertAfter=function(e,t){var n=this.getNode(t);n.parent.insertAfter({data:e},n)},e.prototype.remove=function(e){var t=this.getNode(e);t&&t.parent&&(t===this.currentNode&&(this.currentNode=null),t.parent.removeChild(t))},e.prototype.append=function(e,t){var n=t?this.getNode(t):this.root;n&&n.insertChild({data:e})},e.prototype._initDefaultCheckedNodes=function(){var e=this,t=this.defaultCheckedKeys||[],n=this.nodesMap;t.forEach((function(t){var r=n[t];r&&r.setChecked(!0,!e.checkStrictly)}))},e.prototype._initDefaultCheckedNode=function(e){-1!==(this.defaultCheckedKeys||[]).indexOf(e.key)&&e.setChecked(!0,!this.checkStrictly,!0)},e.prototype.setDefaultCheckedKey=function(e){e!==this.defaultCheckedKeys&&(this.defaultCheckedKeys=e,this._initDefaultCheckedNodes())},e.prototype.registerNode=function(e){this.key&&e&&e.data&&(void 0!==e.key&&(this.nodesMap[e.key]=e))},e.prototype.deregisterNode=function(e){var t=this;this.key&&e&&e.data&&(e.childNodes.forEach((function(e){t.deregisterNode(e)})),delete this.nodesMap[e.key])},e.prototype.getCheckedNodes=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=[],r=function r(o){(o.root?o.root.childNodes:o.childNodes).forEach((function(o){(o.checked||t&&o.indeterminate)&&(!e||e&&o.isLeaf)&&n.push(o.data),r(o)}))};return r(this),n},e.prototype.getCheckedKeys=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.getCheckedNodes(t).map((function(t){return(t||{})[e.key]}))},e.prototype.getHalfCheckedNodes=function(){var e=[];return function t(n){(n.root?n.root.childNodes:n.childNodes).forEach((function(n){n.indeterminate&&e.push(n.data),t(n)}))}(this),e},e.prototype.getHalfCheckedKeys=function(){var e=this;return this.getHalfCheckedNodes().map((function(t){return(t||{})[e.key]}))},e.prototype._getAllNodes=function(){var e=[],t=this.nodesMap;for(var n in t)t.hasOwnProperty(n)&&e.push(t[n]);return e},e.prototype.updateChildren=function(e,t){var n=this.nodesMap[e];if(n){for(var r=n.childNodes,o=r.length-1;o>=0;o--){var i=r[o];this.remove(i.data)}for(var d=0,a=t.length;d<a;d++){var s=t[d];this.append(s,n.data)}}},e.prototype._setCheckedKeys=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments[2],r=this._getAllNodes().sort((function(e,t){return t.level-e.level})),o=Object.create(null),i=Object.keys(n);r.forEach((function(e){return e.setChecked(!1,!1,!0)}));for(var d=0,a=r.length;d<a;d++){var s=r[d],l=s.data[e].toString(),c=i.indexOf(l)>-1;if(c){for(var h=s.parent;h&&h.level>0;)o[h.data[e]]=!0,h=h.parent;s.isLeaf||this.checkStrictly?s.setChecked(!0,!1):(s.setChecked(!0,!0),t&&function(){s.setChecked(!1,!1);!function e(t){t.childNodes.forEach((function(t){t.isLeaf||t.setChecked(!1,!1),e(t)}))}(s)}())}else s.checked&&!o[l]&&s.setChecked(!1,!1)}},e.prototype.setCheckedNodes=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.key,r={};e.forEach((function(e){r[(e||{})[n]]=!0})),this._setCheckedKeys(n,t,r)},e.prototype.setCheckedKeys=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.defaultCheckedKeys=e;var n=this.key,r={};e.forEach((function(e){r[e]=!0})),this._setCheckedKeys(n,t,r)},e.prototype.setDefaultExpandedKeys=function(e){var t=this;e=e||[],this.defaultExpandedKeys=e,e.forEach((function(e){var n=t.getNode(e);n&&n.expand(null,t.autoExpandParent)}))},e.prototype.setChecked=function(e,t,n){var r=this.getNode(e);r&&r.setChecked(!!t,n)},e.prototype.getCurrentNode=function(){return this.currentNode},e.prototype.setCurrentNode=function(e){var t=this.currentNode;t&&(t.isCurrent=!1),this.currentNode=e,this.currentNode.isCurrent=!0},e.prototype.setUserCurrentNode=function(e){var t=e[this.key],n=this.nodesMap[t];this.setCurrentNode(n)},e.prototype.setCurrentNodeKey=function(e){if(null==e)return this.currentNode&&(this.currentNode.isCurrent=!1),void(this.currentNode=null);var t=this.getNode(e);t&&this.setCurrentNode(t)},e}(),x=n(34),N=n.n(x),m=function(){var e=this,t=this,n=t.$createElement,r=t._self._c||n;return r("div",{directives:[{name:"show",rawName:"v-show",value:t.node.visible,expression:"node.visible"}],ref:"node",staticClass:"el-tree-node",class:Object.assign({},{"is-expanded":t.expanded,"is-current":t.node.isCurrent,"is-select":t.node.isSelect,"is-hidden":!t.node.visible,"is-focusable":!t.node.disabled,"is-checked":!t.node.disabled&&t.node.checked},t.treeNodeClass&&t.treeNodeClass(t.node)),attrs:{role:"treeitem",tabindex:"-1","aria-expanded":t.expanded,"aria-disabled":t.node.disabled,"aria-checked":t.node.checked,draggable:t.tree.draggable},on:{click:function(e){return e.stopPropagation(),t.handleClick(e)},keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.handleEnterKeyup(e)},dblclick:function(e){return e.stopPropagation(),t.handleDblClick(e)},contextmenu:function(t){return e.handleContextMenu(t)},dragstart:function(e){return e.stopPropagation(),t.handleDragStart(e)},dragover:function(e){return e.stopPropagation(),t.handleDragOver(e)},dragend:function(e){return e.stopPropagation(),t.handleDragEnd(e)},drop:function(e){return e.stopPropagation(),t.handleDrop(e)}}},[r("div",{staticClass:"el-tree-node__content",class:"el-tree-node__level"+(t.node.level-1),style:{"padding-left":(t.node.level-1)*(t.tree.showLine?0:t.tree.indent)+"px"}},[r("span",{class:[{"is-leaf":t.node.isLeaf},"el-tree-node__expand-icon",t.iconClass],on:{click:function(e){return e.stopPropagation(),t.handleExpandIconClick(e)}}}),t.showCheckbox?r("el-checkbox",{attrs:{size:t.size,indeterminate:t.node.indeterminate,disabled:!!t.node.disabled},on:{change:t.handleCheckChange},nativeOn:{click:function(e){e.stopPropagation()}},model:{value:t.node.checked,callback:function(e){t.$set(t.node,"checked",e)},expression:"node.checked"}}):t._e(),t.node.loading?r("span",{staticClass:"el-tree-node__loading-icon el-icon-loading"}):t._e(),r("node-content",{attrs:{node:t.node}})],1),r("el-collapse-transition",[!t.renderAfterExpand||t.childNodeRendered?r("div",{directives:[{name:"show",rawName:"v-show",value:t.expanded,expression:"expanded"}],staticClass:"el-tree-node__children",attrs:{role:"group","aria-expanded":t.expanded}},t._l(t.node.childNodes,(function(e){return r("el-tree-node",{key:t.getNodeKey(e),attrs:{"render-content":t.renderContent,"tree-node-class":t.treeNodeClass,"render-after-expand":t.renderAfterExpand,"show-checkbox":t.showCheckbox,node:e},on:{"node-expand":t.handleChildNodeExpand}})})),1):t._e()])],1)};m._withStripped=!0;var b=n(31),_=n.n(b),E=n(19),w=n.n(E),S=n(4),D=n.n(S),K={methods:{creator:function(e,t){var n=this[t];e.isTree?this.tree=e:this.tree=e.tree;var r=this.tree;r||console.warn("Can not find node's tree.");var o=(r.props||{}).children||"children";this.$watch(t+".data."+o,(function(){n.updateChildren()})),n.expanded&&(this.expanded=!0,this.childNodeRendered=!0),this.tree.accordion&&this.$on("tree-node-expand",(function(e){n!==e&&n.collapse()}))},getNodeKey:function(e){return c(this.tree.nodeKey,e.data)},handleSelectChange:function(e,t){var n=this.node||this.source;this.oldChecked===e&&this.oldIndeterminate===t||this.tree.$emit("check-change",n.data,e,t),this.oldChecked=e,this.oldIndeterminate=t},handleClick:function(){var e=this.node||this.source,t=this.tree.store;!e.disabled&&t.setCurrentNode(e),this.tree.$emit("current-change",t.currentNode?t.currentNode.data:null,t.currentNode),this.tree.currentNode=this,this.tree.expandOnClickNode&&this.handleExpandIconClick(),this.tree.checkOnClickNode&&!e.disabled&&this.handleCheckChange(null,{target:{checked:!e.checked}}),this.tree.$emit("node-click",e.data,e,this)},handleEnterKeyup:function(e){var t=this.node||this.source;this.tree.$emit("node-enter-keyup",t.data,t,this),e.stopPropagation(),e.preventDefault()},handleDblClick:function(){var e=this.node||this.source;this.tree.$emit("node-dblclick",e.data,e,this)},handleContextMenu:function(e){var t=this.node||this.source;this.tree._events["node-contextmenu"]&&this.tree._events["node-contextmenu"].length>0&&(e.stopPropagation(),e.preventDefault()),this.tree.$emit("node-contextmenu",e,t.data,t,this)},handleExpandIconClick:function(){var e=this.node||this.source;e.isLeaf||(this.expanded?(this.tree.$emit("node-collapse",e.data,e,this),e.collapse()):(e.expand(),this.onNodeExpand?this.onNodeExpand&&this.onNodeExpand(e.data,e,this):this.$emit("node-expand",e.data,e,this)))},handleCheckChange:function(e,t){var n=this,r=this.node||this.source;r.setChecked(t.target.checked,!this.tree.checkStrictly),this.$nextTick((function(){var e=n.tree.store;n.tree.$emit("check",r.data,{checkedNodes:e.getCheckedNodes(),checkedKeys:e.getCheckedKeys(),halfCheckedNodes:e.getHalfCheckedNodes(),halfCheckedKeys:e.getHalfCheckedKeys()})}))},handleChildNodeExpand:function(e,t,n){this.broadcast("ElTreeNode","tree-node-expand",t),this.tree.$emit("node-expand",e,t,n)}}},$=n(9),O={name:"ElTreeNode",componentName:"ElTreeNode",mixins:[D.a,K],inject:["size","isEllipsis"],props:{node:{default:function(){return{}}},props:{},renderContent:Function,treeNodeClass:Function,renderAfterExpand:{type:Boolean,default:!0},showCheckbox:{type:Boolean,default:!1}},components:{ElCollapseTransition:_.a,ElCheckbox:w.a,NodeContent:{props:{node:{required:!0}},directives:{ellipsis:$.a},render:function(e){var t=this.$parent,n=t.tree,r=this.node,o=t.isEllipsis,i=r.data,d=r.store;return t.renderContent?t.renderContent.call(t._renderProxy,e,{_self:n.$vnode.context,node:r,data:i,store:d}):n.$scopedSlots.default?n.$scopedSlots.default({node:r,data:i}):o?e("span",{class:"el-tree-node__label is-ellipsis"},[e("em",{directives:[{name:"ellipsis",value:!0}]},[r.label])]):e("span",{class:"el-tree-node__label"},[r.label])}}},data:function(){return{tree:null,expanded:!1,childNodeRendered:!1,oldChecked:null,oldIndeterminate:null}},computed:{iconClass:function(){return this.node.expanded&&!this.node.isLeaf?this.tree.iconClass&&!this.tree.expandIconClass?this.tree.iconClass+" expanded":this.tree.expandIconClass?this.tree.expandIconClass:"el-icon-arrow-right expanded":this.tree.iconClass?this.tree.iconClass:"el-icon-arrow-right"}},watch:{"node.indeterminate":function(e){this.handleSelectChange(this.node.checked,e)},"node.checked":function(e){this.handleSelectChange(e,this.node.indeterminate)},"node.expanded":function(e){var t=this;this.$nextTick((function(){return t.expanded=e})),e&&(this.childNodeRendered=!0)},"node.childNodes":function(){this.node.reInitChecked()}},methods:{handleChildNodeExpand:function(e,t,n){this.broadcast("ElTreeNode","tree-node-expand",t),this.tree.$emit("node-expand",e,t,n)},handleDragStart:function(e){this.tree.draggable&&this.tree.$emit("tree-node-drag-start",e,this)},handleDragOver:function(e){this.tree.draggable&&(this.tree.$emit("tree-node-drag-over",e,this),e.preventDefault())},handleDrop:function(e){e.preventDefault()},handleDragEnd:function(e){this.tree.draggable&&this.tree.$emit("tree-node-drag-end",e,this)}},created:function(){var e=this.$parent;this.creator(e,"node")}},I=n(0),T=Object(I.a)(O,m,[],!1,null,null,null).exports,A=function(){var e=this,t=this,n=t.$createElement,r=t._self._c||n;return r("div",{directives:[{name:"show",rawName:"v-show",value:t.source.visible,expression:"source.visible"}],ref:"node",staticClass:"el-tree-node",class:Object.assign({},{"is-expanded":t.expanded,"is-current":t.source.isCurrent,"is-select":t.source.isSelect,"is-hidden":!t.source.visible,"is-focusable":!t.source.disabled,"is-checked":!t.source.disabled&&t.source.checked},t.treeNodeClass&&t.treeNodeClass(t.source)),attrs:{role:"treeitem",tabindex:"-1","aria-expanded":t.expanded,"aria-disabled":t.source.disabled,"aria-checked":t.source.checked,draggable:t.tree.draggable},on:{click:function(e){return e.stopPropagation(),t.handleClick(e)},dblclick:function(e){return e.stopPropagation(),t.handleDblClick(e)},contextmenu:function(t){return e.handleContextMenu(t)},dragstart:function(e){return e.stopPropagation(),t.handleDragStart(e)},dragover:function(e){return e.stopPropagation(),t.handleDragOver(e)},dragend:function(e){return e.stopPropagation(),t.handleDragEnd(e)},drop:function(e){return e.stopPropagation(),t.handleDrop(e)}}},[r("div",{staticClass:"el-tree-node__content",class:"el-tree-node__level"+(t.source.level-1),style:{"padding-left":(t.source.level-1)*t.tree.indent+"px"}},[r("span",{class:[{"is-leaf":t.source.isLeaf,expanded:!t.source.isLeaf&&t.expanded},"el-tree-node__expand-icon",t.iconClass],on:{click:function(e){return e.stopPropagation(),t.handleExpandIconClick(e)}}}),t.showCheckbox?r("el-checkbox",{attrs:{size:t.size,indeterminate:t.source.indeterminate,disabled:!!t.source.disabled},on:{change:t.handleCheckChange},nativeOn:{click:function(e){e.stopPropagation()}},model:{value:t.source.checked,callback:function(e){t.$set(t.source,"checked",e)},expression:"source.checked"}}):t._e(),t.source.loading?r("span",{staticClass:"el-tree-node__loading-icon el-icon-loading"}):t._e(),r("node-content",{attrs:{node:t.source}})],1)])};A._withStripped=!0;var L={name:"ElTreeVirtualNode",componentName:"ElTreeVirtualNode",mixins:[D.a,K],inject:["size","isEllipsis"],props:{source:{default:function(){return{}}},renderContent:Function,treeNodeClass:Function,showCheckbox:{type:Boolean,default:!1},onNodeExpand:Function},components:{ElCheckbox:w.a,NodeContent:{props:{node:{required:!0}},directives:{ellipsis:$.a},render:function(e){var t=this.$parent,n=t.tree,r=this.node,o=t.isEllipsis,i=r.data,d=r.store;return t.renderContent?t.renderContent.call(t._renderProxy,e,{_self:n.$vnode.context,node:r,data:i,store:d}):n.$scopedSlots.default?n.$scopedSlots.default({node:r,data:i}):o?e("span",{class:"el-tree-node__label is-ellipsis"},[e("em",{directives:[{name:"ellipsis",value:!0}]},[r.label])]):e("span",{class:"el-tree-node__label"},[r.label])}}},data:function(){return{tree:null,expanded:!1,childNodeRendered:!1,oldChecked:null,oldIndeterminate:null}},computed:{iconClass:function(){return this.source.expanded&&!this.source.isLeaf?this.tree.iconClass&&!this.tree.expandIconClass?this.tree.iconClass+" expanded":this.tree.expandIconClass?this.tree.expandIconClass:"el-icon-arrow-right expanded":this.tree.iconClass?this.tree.iconClass:"el-icon-arrow-right"}},watch:{"source.indeterminate":function(e){this.handleSelectChange(this.source.checked,e)},"source.checked":function(e){this.handleSelectChange(e,this.source.indeterminate)},"source.expanded":function(e){var t=this;this.$nextTick((function(){return t.expanded=e})),e&&(this.childNodeRendered=!0)},"node.childNodes":function(){this.node.reInitChecked()}},methods:{handleDragStart:function(e){this.tree.draggable&&this.tree.$emit("tree-node-drag-start",e,this)},handleDragOver:function(e){this.tree.draggable&&(this.tree.$emit("tree-node-drag-over",e,this),e.preventDefault())},handleDrop:function(e){e.preventDefault()},handleDragEnd:function(e){this.tree.draggable&&this.tree.$emit("tree-node-drag-end",e,this)}},created:function(){var e=this.$parent.$parent.$parent;this.creator(e,"source")}},P=Object(I.a)(L,A,[],!1,null,null,null).exports,B=n(18),q=n(3),j={name:"ElTree",mixins:[D.a],components:{ElVirtual:N.a,ElTreeNode:T},provide:function(){return{size:this.treeSize,isEllipsis:this.ellipsis}},data:function(){return{store:null,root:null,currentNode:null,treeItems:null,checkboxItems:[],dragState:{showDropIndicator:!1,draggingNode:null,dropNode:null,allowDrop:!0},itemComponent:P}},props:{data:{type:Array},emptyText:{type:String,default:function(){return Object(B.t)("el.tree.emptyText")}},size:String,renderAfterExpand:{type:Boolean,default:!0},nodeKey:String,checkStrictly:Boolean,defaultExpandAll:Boolean,expandOnClickNode:{type:Boolean,default:!0},checkOnClickNode:Boolean,checkDescendants:{type:Boolean,default:!1},autoExpandParent:{type:Boolean,default:!0},defaultCheckedKeys:Array,defaultExpandedKeys:Array,currentNodeKey:[String,Number],renderContent:Function,treeNodeClass:Function,showCheckbox:{type:Boolean,default:!1},draggable:{type:Boolean,default:!1},allowDrag:Function,allowDrop:Function,props:{default:function(){return{children:"children",label:"label",disabled:"disabled"}}},showLine:{type:Boolean,default:!1},lazy:{type:Boolean,default:!1},ellipsis:{type:Boolean,default:!1},highlightCurrent:Boolean,load:Function,filterNodeMethod:Function,accordion:Boolean,indent:{type:Number,default:18},iconClass:String,expandIconClass:String,filterCheckStrictly:Boolean,height:{type:Number,default:0},extraLine:{type:Number,default:10}},computed:{children:{set:function(e){this.data=e},get:function(){return this.data}},treeItemArray:function(){return Array.prototype.slice.call(this.treeItems)},isEmpty:function(){var e=this.root.childNodes;return!e||0===e.length||e.every((function(e){return!e.visible}))},treeSize:function(){return this.size||(this.$ELEMENT||{}).size},scrollbar:function(){return"el-scrollbar"===this.$parent.$options._componentTag},visibleList:function(){return this.flattenTree(this.root.childNodes)},virtualContainer:function(){return this.$refs.virtualContainer.virtual}},watch:{defaultCheckedKeys:function(e){this.store.setDefaultCheckedKey(e)},defaultExpandedKeys:function(e){this.store.defaultExpandedKeys=e,this.store.setDefaultExpandedKeys(e)},data:function(e){this.store.setData(e)},checkboxItems:function(e){Array.prototype.forEach.call(e,(function(e){e.setAttribute("tabindex",-1)}))},checkStrictly:function(e){this.store.checkStrictly=e},filterCheckStrictly:function(e){this.store.filterCheckStrictly=e}},methods:{flattenTree:function(e){var t=this;return e.reduce((function(e,n){return n.visible&&e.push(n),n.expanded&&n.childNodes.length&&e.push.apply(e,t.flattenTree(n.childNodes)),e}),[])},filter:function(e){if(!this.filterNodeMethod)throw new Error("[Tree] filterNodeMethod is required when filter");this.store.filter(e)},getNodeKey:function(e){return c(this.nodeKey,e.data)},getNodePath:function(e){if(!this.nodeKey)throw new Error("[Tree] nodeKey is required in getNodePath");var t=this.store.getNode(e);if(!t)return[];for(var n=[t.data],r=t.parent;r&&r!==this.root;)n.push(r.data),r=r.parent;return n.reverse()},getCheckedNodes:function(e,t){return this.store.getCheckedNodes(e,t)},getCheckedKeys:function(e){return this.store.getCheckedKeys(e)},getCurrentNode:function(){var e=this.store.getCurrentNode();return e?e.data:null},getCurrentKey:function(){if(!this.nodeKey)throw new Error("[Tree] nodeKey is required in getCurrentKey");var e=this.getCurrentNode();return e?e[this.nodeKey]:null},setCheckedNodes:function(e,t){if(!this.nodeKey)throw new Error("[Tree] nodeKey is required in setCheckedNodes");this.store.setCheckedNodes(e,t)},setCheckedKeys:function(e,t){if(!this.nodeKey)throw new Error("[Tree] nodeKey is required in setCheckedKeys");this.store.setCheckedKeys(e,t)},setChecked:function(e,t,n){this.store.setChecked(e,t,n)},getHalfCheckedNodes:function(){return this.store.getHalfCheckedNodes()},getHalfCheckedKeys:function(){return this.store.getHalfCheckedKeys()},setCurrentNode:function(e){if(!this.nodeKey)throw new Error("[Tree] nodeKey is required in setCurrentNode");this.store.setUserCurrentNode(e)},setCurrentKey:function(e){if(!this.nodeKey)throw new Error("[Tree] nodeKey is required in setCurrentKey");this.store.setCurrentNodeKey(e)},getNode:function(e){return this.store.getNode(e)},remove:function(e){this.store.remove(e)},append:function(e,t){this.store.append(e,t)},insertBefore:function(e,t){this.store.insertBefore(e,t)},insertAfter:function(e,t){this.store.insertAfter(e,t)},handleNodeExpand:function(e,t,n){this.broadcast("ElTreeNode","tree-node-expand",t),this.$emit("node-expand",e,t,n)},updateKeyChildren:function(e,t){if(!this.nodeKey)throw new Error("[Tree] nodeKey is required in updateKeyChild");this.store.updateChildren(e,t)},initTabIndex:function(){this.treeItems=this.$el.querySelectorAll(".is-focusable[role=treeitem]"),this.checkboxItems=this.$el.querySelectorAll("input[type=checkbox]");var e=this.$el.querySelectorAll(".is-checked[role=treeitem]");e.length?e[0].setAttribute("tabindex",0):this.treeItems[0]&&this.treeItems[0].setAttribute("tabindex",0)},handleKeydown:function(e){var t=e.target;if(-1!==t.className.indexOf("el-tree-node")){var n=e.keyCode;this.treeItems=this.$el.querySelectorAll(".is-focusable[role=treeitem]");var r=this.treeItemArray.indexOf(t),o=void 0;[38,40].indexOf(n)>-1&&(e.preventDefault(),o=38===n?0!==r?r-1:0:r<this.treeItemArray.length-1?r+1:0,this.treeItemArray[o].focus()),[37,39].indexOf(n)>-1&&(e.preventDefault(),t.click());var i=t.querySelector('[type="checkbox"]');[13,32].indexOf(n)>-1&&i&&(e.preventDefault(),i.click())}}},created:function(){var e=this;this.isTree=!0,this.store=new k({key:this.nodeKey,data:this.data,lazy:this.lazy,props:this.props,load:this.load,currentNodeKey:this.currentNodeKey,checkStrictly:this.checkStrictly,filterCheckStrictly:this.filterCheckStrictly,checkDescendants:this.checkDescendants,defaultCheckedKeys:this.defaultCheckedKeys,defaultExpandedKeys:this.defaultExpandedKeys,autoExpandParent:this.autoExpandParent,defaultExpandAll:this.defaultExpandAll,filterNodeMethod:this.filterNodeMethod}),this.root=this.store.root;var t=this.dragState;this.$on("tree-node-drag-start",(function(n,r){if("function"==typeof e.allowDrag&&!e.allowDrag(r.node))return n.preventDefault(),!1;n.dataTransfer.effectAllowed="move";try{n.dataTransfer.setData("text/plain","")}catch(e){}t.draggingNode=r,e.$emit("node-drag-start",r.node,n)})),this.$on("tree-node-drag-over",i()(100,(function(n,r){var o=function(e,t){for(var n=e;n&&"BODY"!==n.tagName;){if(n.__vue__&&n.__vue__.$options.name===t)return n.__vue__;n=n.parentNode}return null}(n.target,"ElTreeNode"),i=t.dropNode;i&&i!==o&&Object(q.removeClass)(i.$el,"is-drop-inner");var d=t.draggingNode;if(d&&o){var a=!0,s=!0,l=!0,c=!0;"function"==typeof e.allowDrop&&(a=e.allowDrop(d.node,o.node,"prev"),c=s=e.allowDrop(d.node,o.node,"inner"),l=e.allowDrop(d.node,o.node,"next")),n.dataTransfer&&(n.dataTransfer.dropEffect=s?"move":"none"),(a||s||l)&&i!==o&&(i&&e.$emit("node-drag-leave",d.node,i.node,n),e.$emit("node-drag-enter",d.node,o.node,n)),(a||s||l)&&(t.dropNode=o),o.node.nextSibling===d.node&&(l=!1),o.node.previousSibling===d.node&&(a=!1),o.node.contains(d.node,!1)&&(s=!1),(d.node===o.node||d.node.contains(o.node))&&(a=!1,s=!1,l=!1);var h=o.$el.getBoundingClientRect(),u=e.$el.getBoundingClientRect(),f=void 0,p=a?s?.25:l?.45:1:-1,v=l?s?.75:a?.55:0:1,y=-9999,g=n.clientY-h.top;f=g<h.height*p?"before":g>h.height*v?"after":s?"inner":"none";var C=o.$el.querySelector(".el-tree-node__content").getBoundingClientRect(),k=o.$el.querySelector(".el-tree-node__expand-icon").getBoundingClientRect(),x=e.$refs.dropIndicator;"before"===f?y=C.top-u.top:"after"===f&&(y=C.bottom-u.top),x.style.top=y+"px",x.style.left=k.right-u.left+"px","inner"===f?Object(q.addClass)(o.$el,"is-drop-inner"):Object(q.removeClass)(o.$el,"is-drop-inner"),t.showDropIndicator="before"===f||"after"===f,t.allowDrop=t.showDropIndicator||c,t.dropType=f,e.$emit("node-drag-over",d.node,o.node,n)}}))),this.$on("tree-node-drag-end",(function(n){var r=t.draggingNode,o=t.dropType,i=t.dropNode;if(n.preventDefault(),n.dataTransfer&&(n.dataTransfer.dropEffect="move"),r&&i){var d={data:r.node.data},a=r.node.parent;"none"!==o&&r.node.remove();var s=i.tree.showCheckbox;"before"===o?(i.node.parent.insertBefore(d,i.node),s&&i.node.parent.reInitChecked()):"after"===o?(i.node.parent.insertAfter(d,i.node),s&&i.node.parent.reInitChecked()):"inner"===o&&(i.node.insertChild(d),s&&i.node.reInitChecked()),s&&a&&a.reInitChecked(),"none"!==o&&(e.store.registerNode(d),e.store.key&&r.node.eachNode((function(t){var n=t.data[e.store.key],r=e.store.nodesMap[n];r&&r.setChecked(t.checked,!e.store.checkStrictly)}))),Object(q.removeClass)(i.$el,"is-drop-inner"),e.$emit("node-drag-end",r.node,i.node,o,n),"none"!==o&&e.$emit("node-drop",r.node,i.node,o,n)}r&&!i&&e.$emit("node-drag-end",r.node,null,o,n),t.showDropIndicator=!1,t.draggingNode=null,t.dropNode=null,t.allowDrop=!0}))},mounted:function(){this.initTabIndex(),this.$el.addEventListener("keydown",this.handleKeydown)},updated:function(){this.treeItems=this.$el.querySelectorAll("[role=treeitem]"),this.checkboxItems=this.$el.querySelectorAll("input[type=checkbox]")},beforeDestroy:function(){this.$el.removeEventListener("keydown",this.handleKeydown)}},z=Object(I.a)(j,r,[],!1,null,null,null).exports;z.install=function(e){e.component(z.name,z)};t.default=z},9:function(e,t,n){"use strict";var r=n(2);t.a={inserted:function(e,t){e.onmouseover=function(){var t=e.offsetWidth;Object(r.isIE)()&&(e.parentNode.style.textOverflow="clip",t=e.offsetWidth,e.parentNode.style.textOverflow="ellipsis"),e.parentNode.offsetWidth<t&&(e.title=e.innerHTML.replace(/<[^>]*>/g,""))},e.onmouseout=function(){e.title&&e.removeAttribute("title")}}}}});