UNPKG

vue-okr-tree

Version:

一个特殊布局模式结构的`vue Tree`组件

2 lines 33.5 kB
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("vue")):"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["vue-okr-tree"]=t(require("vue")):e["vue-okr-tree"]=t(e["Vue"])})("undefined"!==typeof self?self:this,(function(e){return 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="",n(n.s="fae3")}({"01f9":function(e,t,n){"use strict";var r=n("2d00"),o=n("5ca1"),i=n("2aba"),s=n("32e9"),a=n("84f2"),d=n("41a0"),l=n("7f20"),u=n("38fd"),c=n("2b4c")("iterator"),f=!([].keys&&"next"in[].keys()),h="@@iterator",p="keys",y="values",v=function(){return this};e.exports=function(e,t,n,b,N,g,C){d(n,t,b);var m,x,w,k=function(e){if(!f&&e in L)return L[e];switch(e){case p:return function(){return new n(this,e)};case y:return function(){return new n(this,e)}}return function(){return new n(this,e)}},_=t+" Iterator",S=N==y,E=!1,L=e.prototype,O=L[c]||L[h]||N&&L[N],T=O||k(N),B=N?S?k("entries"):T:void 0,K="Array"==t&&L.entries||O;if(K&&(w=u(K.call(new e)),w!==Object.prototype&&w.next&&(l(w,_,!0),r||"function"==typeof w[c]||s(w,c,v))),S&&O&&O.name!==y&&(E=!0,T=function(){return O.call(this)}),r&&!C||!f&&!E&&L[c]||s(L,c,T),a[t]=T,a[_]=v,N)if(m={values:S?T:k(y),keys:g?T:k(p),entries:B},C)for(x in m)x in L||i(L,x,m[x]);else o(o.P+o.F*(f||E),t,m);return m}},"0d58":function(e,t,n){var r=n("ce10"),o=n("e11e");e.exports=Object.keys||function(e){return r(e,o)}},"11e9":function(e,t,n){var r=n("52a7"),o=n("4630"),i=n("6821"),s=n("6a99"),a=n("69a8"),d=n("c69a"),l=Object.getOwnPropertyDescriptor;t.f=n("9e1e")?l:function(e,t){if(e=i(e),t=s(t,!0),d)try{return l(e,t)}catch(n){}if(a(e,t))return o(!r.f.call(e,t),e[t])}},1495:function(e,t,n){var r=n("86cc"),o=n("cb7c"),i=n("0d58");e.exports=n("9e1e")?Object.defineProperties:function(e,t){o(e);var n,s=i(t),a=s.length,d=0;while(a>d)r.f(e,n=s[d++],t[n]);return e}},"230e":function(e,t,n){var r=n("d3f4"),o=n("7726").document,i=r(o)&&r(o.createElement);e.exports=function(e){return i?o.createElement(e):{}}},"2aba":function(e,t,n){var r=n("7726"),o=n("32e9"),i=n("69a8"),s=n("ca5a")("src"),a=n("fa5b"),d="toString",l=(""+a).split(d);n("8378").inspectSource=function(e){return a.call(e)},(e.exports=function(e,t,n,a){var d="function"==typeof n;d&&(i(n,"name")||o(n,"name",t)),e[t]!==n&&(d&&(i(n,s)||o(n,s,e[t]?""+e[t]:l.join(String(t)))),e===r?e[t]=n:a?e[t]?e[t]=n:o(e,t,n):(delete e[t],o(e,t,n)))})(Function.prototype,d,(function(){return"function"==typeof this&&this[s]||a.call(this)}))},"2aeb":function(e,t,n){var r=n("cb7c"),o=n("1495"),i=n("e11e"),s=n("613b")("IE_PROTO"),a=function(){},d="prototype",l=function(){var e,t=n("230e")("iframe"),r=i.length,o="<",s=">";t.style.display="none",n("fab2").appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write(o+"script"+s+"document.F=Object"+o+"/script"+s),e.close(),l=e.F;while(r--)delete l[d][i[r]];return l()};e.exports=Object.create||function(e,t){var n;return null!==e?(a[d]=r(e),n=new a,a[d]=null,n[s]=e):n=l(),void 0===t?n:o(n,t)}},"2b4c":function(e,t,n){var r=n("5537")("wks"),o=n("ca5a"),i=n("7726").Symbol,s="function"==typeof i,a=e.exports=function(e){return r[e]||(r[e]=s&&i[e]||(s?i:o)("Symbol."+e))};a.store=r},"2d00":function(e,t){e.exports=!1},"2d95":function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},"32e9":function(e,t,n){var r=n("86cc"),o=n("4630");e.exports=n("9e1e")?function(e,t,n){return r.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},"38fd":function(e,t,n){var r=n("69a8"),o=n("4bf8"),i=n("613b")("IE_PROTO"),s=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=o(e),r(e,i)?e[i]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?s:null}},"3a2a":function(e,t,n){},"41a0":function(e,t,n){"use strict";var r=n("2aeb"),o=n("4630"),i=n("7f20"),s={};n("32e9")(s,n("2b4c")("iterator"),(function(){return this})),e.exports=function(e,t,n){e.prototype=r(s,{next:o(1,n)}),i(e,t+" Iterator")}},4588:function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},4630:function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},"4bf8":function(e,t,n){var r=n("be13");e.exports=function(e){return Object(r(e))}},"52a7":function(e,t){t.f={}.propertyIsEnumerable},5537:function(e,t,n){var r=n("8378"),o=n("7726"),i="__core-js_shared__",s=o[i]||(o[i]={});(e.exports=function(e,t){return s[e]||(s[e]=void 0!==t?t:{})})("versions",[]).push({version:r.version,mode:n("2d00")?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},"5ca1":function(e,t,n){var r=n("7726"),o=n("8378"),i=n("32e9"),s=n("2aba"),a=n("9b43"),d="prototype",l=function(e,t,n){var u,c,f,h,p=e&l.F,y=e&l.G,v=e&l.S,b=e&l.P,N=e&l.B,g=y?r:v?r[t]||(r[t]={}):(r[t]||{})[d],C=y?o:o[t]||(o[t]={}),m=C[d]||(C[d]={});for(u in y&&(n=t),n)c=!p&&g&&void 0!==g[u],f=(c?g:n)[u],h=N&&c?a(f,r):b&&"function"==typeof f?a(Function.call,f):f,g&&s(g,u,f,e&l.U),C[u]!=f&&i(C,u,h),b&&m[u]!=f&&(m[u]=f)};r.core=o,l.F=1,l.G=2,l.S=4,l.P=8,l.B=16,l.W=32,l.U=64,l.R=128,e.exports=l},"5dbc":function(e,t,n){var r=n("d3f4"),o=n("8b97").set;e.exports=function(e,t,n){var i,s=t.constructor;return s!==n&&"function"==typeof s&&(i=s.prototype)!==n.prototype&&r(i)&&o&&o(e,i),e}},"606e":function(e,t,n){"use strict";n("3a2a")},"613b":function(e,t,n){var r=n("5537")("keys"),o=n("ca5a");e.exports=function(e){return r[e]||(r[e]=o(e))}},"626a":function(e,t,n){var r=n("2d95");e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},6821:function(e,t,n){var r=n("626a"),o=n("be13");e.exports=function(e){return r(o(e))}},"69a8":function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},"6a99":function(e,t,n){var r=n("d3f4");e.exports=function(e,t){if(!r(e))return e;var n,o;if(t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;if("function"==typeof(n=e.valueOf)&&!r(o=n.call(e)))return o;if(!t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;throw TypeError("Can't convert object to primitive value")}},7726:function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},"77f1":function(e,t,n){var r=n("4588"),o=Math.max,i=Math.min;e.exports=function(e,t){return e=r(e),e<0?o(e+t,0):i(e,t)}},"79e5":function(e,t){e.exports=function(e){try{return!!e()}catch(t){return!0}}},"7f20":function(e,t,n){var r=n("86cc").f,o=n("69a8"),i=n("2b4c")("toStringTag");e.exports=function(e,t,n){e&&!o(e=n?e:e.prototype,i)&&r(e,i,{configurable:!0,value:t})}},"7f7f":function(e,t,n){var r=n("86cc").f,o=Function.prototype,i=/^\s*function ([^ (]*)/,s="name";s in o||n("9e1e")&&r(o,s,{configurable:!0,get:function(){try{return(""+this).match(i)[1]}catch(e){return""}}})},8378:function(e,t){var n=e.exports={version:"2.6.11"};"number"==typeof __e&&(__e=n)},"84f2":function(e,t){e.exports={}},"86cc":function(e,t,n){var r=n("cb7c"),o=n("c69a"),i=n("6a99"),s=Object.defineProperty;t.f=n("9e1e")?Object.defineProperty:function(e,t,n){if(r(e),t=i(t,!0),r(n),o)try{return s(e,t,n)}catch(a){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},"8b97":function(e,t,n){var r=n("d3f4"),o=n("cb7c"),i=function(e,t){if(o(e),!r(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,r){try{r=n("9b43")(Function.call,n("11e9").f(Object.prototype,"__proto__").set,2),r(e,[]),t=!(e instanceof Array)}catch(o){t=!0}return function(e,n){return i(e,n),t?e.__proto__=n:r(e,n),e}}({},!1):void 0),check:i}},"8bbf":function(t,n){t.exports=e},9093:function(e,t,n){var r=n("ce10"),o=n("e11e").concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,o)}},"9b43":function(e,t,n){var r=n("d8e8");e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},"9c6c":function(e,t,n){var r=n("2b4c")("unscopables"),o=Array.prototype;void 0==o[r]&&n("32e9")(o,r,{}),e.exports=function(e){o[r][e]=!0}},"9def":function(e,t,n){var r=n("4588"),o=Math.min;e.exports=function(e){return e>0?o(r(e),9007199254740991):0}},"9e1e":function(e,t,n){e.exports=!n("79e5")((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},aa77:function(e,t,n){var r=n("5ca1"),o=n("be13"),i=n("79e5"),s=n("fdef"),a="["+s+"]",d="​…",l=RegExp("^"+a+a+"*"),u=RegExp(a+a+"*$"),c=function(e,t,n){var o={},a=i((function(){return!!s[e]()||d[e]()!=d})),l=o[e]=a?t(f):s[e];n&&(o[n]=l),r(r.P+r.F*a,"String",o)},f=c.trim=function(e,t){return e=String(o(e)),1&t&&(e=e.replace(l,"")),2&t&&(e=e.replace(u,"")),e};e.exports=c},ac6a:function(e,t,n){for(var r=n("cadf"),o=n("0d58"),i=n("2aba"),s=n("7726"),a=n("32e9"),d=n("84f2"),l=n("2b4c"),u=l("iterator"),c=l("toStringTag"),f=d.Array,h={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},p=o(h),y=0;y<p.length;y++){var v,b=p[y],N=h[b],g=s[b],C=g&&g.prototype;if(C&&(C[u]||a(C,u,f),C[c]||a(C,c,b),d[b]=f,N))for(v in r)C[v]||i(C,v,r[v],!0)}},be13:function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},c366:function(e,t,n){var r=n("6821"),o=n("9def"),i=n("77f1");e.exports=function(e){return function(t,n,s){var a,d=r(t),l=o(d.length),u=i(s,l);if(e&&n!=n){while(l>u)if(a=d[u++],a!=a)return!0}else for(;l>u;u++)if((e||u in d)&&d[u]===n)return e||u||0;return!e&&-1}}},c5f6:function(e,t,n){"use strict";var r=n("7726"),o=n("69a8"),i=n("2d95"),s=n("5dbc"),a=n("6a99"),d=n("79e5"),l=n("9093").f,u=n("11e9").f,c=n("86cc").f,f=n("aa77").trim,h="Number",p=r[h],y=p,v=p.prototype,b=i(n("2aeb")(v))==h,N="trim"in String.prototype,g=function(e){var t=a(e,!1);if("string"==typeof t&&t.length>2){t=N?t.trim():f(t,3);var n,r,o,i=t.charCodeAt(0);if(43===i||45===i){if(n=t.charCodeAt(2),88===n||120===n)return NaN}else if(48===i){switch(t.charCodeAt(1)){case 66:case 98:r=2,o=49;break;case 79:case 111:r=8,o=55;break;default:return+t}for(var s,d=t.slice(2),l=0,u=d.length;l<u;l++)if(s=d.charCodeAt(l),s<48||s>o)return NaN;return parseInt(d,r)}}return+t};if(!p(" 0o1")||!p("0b1")||p("+0x1")){p=function(e){var t=arguments.length<1?0:e,n=this;return n instanceof p&&(b?d((function(){v.valueOf.call(n)})):i(n)!=h)?s(new y(g(t)),n,p):g(t)};for(var C,m=n("9e1e")?l(y):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),x=0;m.length>x;x++)o(y,C=m[x])&&!o(p,C)&&c(p,C,u(y,C));p.prototype=v,v.constructor=p,n("2aba")(r,h,p)}},c69a:function(e,t,n){e.exports=!n("9e1e")&&!n("79e5")((function(){return 7!=Object.defineProperty(n("230e")("div"),"a",{get:function(){return 7}}).a}))},ca5a:function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},cadf:function(e,t,n){"use strict";var r=n("9c6c"),o=n("d53b"),i=n("84f2"),s=n("6821");e.exports=n("01f9")(Array,"Array",(function(e,t){this._t=s(e),this._i=0,this._k=t}),(function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,o(1)):o(0,"keys"==t?n:"values"==t?e[n]:[n,e[n]])}),"values"),i.Arguments=i.Array,r("keys"),r("values"),r("entries")},cb7c:function(e,t,n){var r=n("d3f4");e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},ce10:function(e,t,n){var r=n("69a8"),o=n("6821"),i=n("c366")(!1),s=n("613b")("IE_PROTO");e.exports=function(e,t){var n,a=o(e),d=0,l=[];for(n in a)n!=s&&r(a,n)&&l.push(n);while(t.length>d)r(a,n=t[d++])&&(~i(l,n)||l.push(n));return l}},d3f4:function(e,t){e.exports=function(e){return"object"===typeof e?null!==e:"function"===typeof e}},d53b:function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},d8e8:function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},e11e:function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},f6fd:function(e,t){(function(e){var t="currentScript",n=e.getElementsByTagName("script");t in e||Object.defineProperty(e,t,{get:function(){try{throw new Error}catch(r){var e,t=(/.*at [^\(]*\((.*):.+:.+\)$/gi.exec(r.stack)||[!1])[1];for(e in n)if(n[e].src==t||"interactive"==n[e].readyState)return n[e];return null}}})})(document)},fa5b:function(e,t,n){e.exports=n("5537")("native-function-to-string",Function.toString)},fab2:function(e,t,n){var r=n("7726").document;e.exports=r&&r.documentElement},fae3:function(e,t,n){"use strict";var r;(n.r(t),n.d(t,"VueOkrTree",(function(){return T})),"undefined"!==typeof window)&&(n("f6fd"),(r=window.document.currentScript)&&(r=r.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))&&(n.p=r[1]));var o=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"org-chart-container"},[n("div",{ref:"orgChartRoot",staticClass:"org-chart-node-children",class:{vertical:"vertical"===e.direction,horizontal:"horizontal"===e.direction,"show-collapsable":e.showCollapsable,"one-branch":1===e.data.length}},e._l(e.root.childNodes,(function(t){return n("OkrTreeNode",{key:e.getNodeKey(t),attrs:{node:t,root:e.root,orkstyle:"","show-collapsable":e.showCollapsable,"label-width":e.labelWidth,"label-height":e.labelHeight,renderContent:e.renderContent,nodeBtnContent:e.nodeBtnContent,"selected-key":e.selectedKey,"default-expand-all":e.defaultExpandAll,"node-key":e.nodeKey,"show-node-num":e.showNodeNum,props:e.props}})})),1)])},i=[],s=(n("c5f6"),n("8bbf")),a=n.n(s),d=function(){var e=this,t=this,n=t.$createElement,r=t._self._c||n;return t.node.visible?r("div",{staticClass:"org-chart-node",class:{collapsed:!t.node.leftExpanded||!t.node.expanded,"is-leaf":t.isLeaf,"is-current":t.node.isCurrent,"is-left-child-node":t.isLeftChildNode,"is-not-child":1===t.node.level&&t.node.childNodes.length<=0&&t.leftChildNodes.length<=0,"only-both-tree-node":1===t.node.level&&t.tree.store.onlyBothTree},on:{contextmenu:function(t){return e.handleContextMenu(t)}}},[r("transition",{attrs:{duration:t.animateDuration,name:t.animateName}},[t.showLeftChildNode?r("div",{staticClass:"org-chart-node-left-children",style:{visibility:t.node.leftExpanded?"":"hidden",height:t.node.leftExpanded?"":"0"}},t._l(t.leftChildNodes,(function(e){return r("OkrTreeNode",{key:t.getNodeKey(e),attrs:{"show-collapsable":t.showCollapsable,node:e,"label-width":t.labelWidth,"label-height":t.labelHeight,renderContent:t.renderContent,nodeBtnContent:t.nodeBtnContent,"selected-key":t.selectedKey,"node-key":t.nodeKey,props:t.props,"show-node-num":t.showNodeNum,"is-left-child-node":""}})})),1):t._e()]),r("div",{staticClass:"org-chart-node-label",class:{"is-root-label":1===t.node.level,"is-not-right-child":1===t.node.level&&t.node.childNodes.length<=0,"is-not-left-child":1===t.node.level&&t.leftChildNodes.length<=0}},[t.showNodeLeftBtn&&t.leftChildNodes.length>0?r("div",{staticClass:"org-chart-node-left-btn",class:{expanded:t.node.leftExpanded},on:{click:function(e){return t.handleBtnClick("left")}}},[t.showNodeNum?[t.node.leftExpanded?t._e():r("span",{staticClass:"org-chart-node-btn-text"},[t._v("\n "+t._s(1===t.node.level&&t.leftChildNodes.length>0?t.leftChildNodes.length:t.node.childNodes.length)+"\n ")])]:r("node-btn-content",{attrs:{node:t.node}},[t._t("default")],2)],2):t._e(),r("div",{staticClass:"org-chart-node-label-inner",class:t.computeLabelClass,style:t.computeLabelStyle,on:{click:t.handleNodeClick}},[r("node-content",{attrs:{node:t.node}},[t._t("default",[t._v("\n "+t._s(t.node.label)+"\n ")])],2)],1),t.showNodeBtn&&!t.isLeftChildNode?r("div",{staticClass:"org-chart-node-btn",class:{expanded:t.node.expanded},on:{click:function(e){return t.handleBtnClick("right")}}},[t.showNodeNum?[t.node.expanded?t._e():r("span",{staticClass:"org-chart-node-btn-text"},[t._v("\n "+t._s(t.node.childNodes.length)+"\n ")])]:r("node-btn-content",{attrs:{node:t.node}},[t._t("default")],2)],2):t._e()]),r("transition",{attrs:{duration:t.animateDuration,name:t.animateName}},[!t.isLeftChildNode&&t.node.childNodes&&t.node.childNodes.length>0?r("div",{staticClass:"org-chart-node-children",style:{visibility:t.node.expanded?"":"hidden",height:t.node.expanded?"":"0"}},t._l(t.node.childNodes,(function(e){return r("OkrTreeNode",{key:t.getNodeKey(e),attrs:{"show-collapsable":t.showCollapsable,node:e,"label-width":t.labelWidth,"label-height":t.labelHeight,renderContent:t.renderContent,nodeBtnContent:t.nodeBtnContent,"selected-key":t.selectedKey,"node-key":t.nodeKey,"show-node-num":t.showNodeNum,props:t.props}})})),1):t._e()])],1):t._e()},l=[],u=(n("7f7f"),"$treeNodeId"),c=function(e,t){t&&!t[u]&&Object.defineProperty(t,u,{value:e.id,enumerable:!1,configurable:!1,writable:!1})},f=function(e,t){return e?t[e]:t[u]},h={name:"OkrTreeNode",inject:["okrEventBus"],props:{props:{},node:{default:function(){return{}}},root:{default:function(){return{}}},showCollapsable:{type:Boolean,default:!1},isLeftChildNode:{type:Boolean,default:!1},renderContent:Function,nodeBtnContent:Function,showNodeNum:Boolean,labelWidth:[String,Number],labelHeight:[String,Number],selectedKey:String,nodeKey:String},components:{NodeContent:{props:{node:{required:!0}},render:function(e){var t=this.$parent;return t._props.renderContent?t._props.renderContent(e,this.node):this.$scopedSlots.default(this.node)}},NodeBtnContent:{props:{node:{required:!0}},render:function(e){var t=this.$parent;return t._props.nodeBtnContent?t._props.nodeBtnContent(e,this.node):this.$scopedSlots.default?this.$scopedSlots.default(this.node):void 0}}},computed:{isLeaf:function(){return 1===this.node.level?0==this.leftChildNodes.length&&0==this.node.childNodes.length:this.node.isLeaf},leftChildNodes:function(){return this.tree.store.onlyBothTree?this.isLeftChildNode?this.node.childNodes:this.node.leftChildNodes:[]},animateName:function(){return this.tree.store.animate?this.tree.store.animateName:""},animateDuration:function(){return this.tree.store.animate?this.tree.store.animateDuration:0},showNodeBtn:function(){return this.isLeftChildNode?"horizontal"===this.tree.store.direction&&this.showCollapsable&&this.leftChildNodes.length>0||1===this.level:this.showCollapsable&&this.node.childNodes&&this.node.childNodes.length>0},showNodeLeftBtn:function(){return"horizontal"===this.tree.store.direction&&this.showCollapsable&&this.leftChildNodes.length>0},computeLabelStyle:function(){var e=this.labelWidth,t=void 0===e?"auto":e,n=this.labelHeight,r=void 0===n?"auto":n;return"number"===typeof t&&(t="".concat(t,"px")),"number"===typeof r&&(r="".concat(r,"px")),{width:t,height:r}},computeLabelClass:function(){var e=[],t=this.tree.store;return t.labelClassName&&("function"===typeof t.labelClassName?e.push(t.labelClassName(this.node)):e.push(t.labelClassName)),t.currentLableClassName&&this.node.isCurrent&&("function"===typeof t.currentLableClassName?e.push(t.currentLableClassName(this.node)):e.push(t.currentLableClassName)),this.node.isCurrent&&e.push("is-current"),e},computNodeStyle:function(){return{display:this.node.expanded?"":"none"}},computLeftNodeStyle:function(){return{display:this.node.leftExpanded?"":"none"}},showLeftChildNode:function(){return this.tree.onlyBothTree&&"horizontal"===this.tree.store.direction&&this.leftChildNodes&&this.leftChildNodes.length>0}},watch:{"node.expanded":function(e){},"node.leftExpanded":function(e){}},data:function(){return{expanded:!1,tree:null}},created:function(){var e=this.$parent;e.isTree?this.tree=e:this.tree=e.tree;var t=this.tree;t||console.warn("Can not find node's tree.")},methods:{getNodeKey:function(e){return f(this.nodeKey,e.data)},handleNodeClick:function(){var e=this.tree.store;e.setCurrentNode(this.node),this.tree.$emit("node-click",this.node.data,this.node,this)},handleBtnClick:function(e){e="left"===e;var t=this.tree.store;t.onlyBothTree&&e?this.node.leftExpanded?(this.node.leftExpanded=!1,this.tree.$emit("node-collapse",this.node.data,this.node,this)):(this.node.leftExpanded=!0,this.tree.$emit("node-expand",this.node.data,this.node,this)):this.node.expanded?(this.node.collapse(),this.tree.$emit("node-collapse",this.node.data,this.node,this)):(this.node.expand(),this.tree.$emit("node-expand",this.node.data,this.node,this))},handleContextMenu:function(e){this.tree._events["node-contextmenu"]&&this.tree._events["node-contextmenu"].length>0&&(e.stopPropagation(),e.preventDefault()),this.tree.$emit("node-contextmenu",e,this.node.data,this.node,this)}}},p=h;function y(e,t,n,r,o,i,s,a){var d,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),s?(d=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"===typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),o&&o.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(s)},l._ssrRegister=d):o&&(d=a?function(){o.call(this,(l.functional?this.parent:this).$root.$options.shadowRoot)}:o),d)if(l.functional){l._injectStyles=d;var u=l.render;l.render=function(e,t){return d.call(t),u(e,t)}}else{var c=l.beforeCreate;l.beforeCreate=c?[].concat(c,d):[d]}return{exports:e,options:l}}var v=y(p,d,l,!1,null,null,null),b=v.exports;function N(e){return N="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},N(e)}n("ac6a");function g(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function C(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)}}function m(e,t,n){return t&&C(e.prototype,t),n&&C(e,n),e}var x=function(e){for(var t=1,n=arguments.length;t<n;t++){var r=arguments[t]||{};for(var o in r)if(r.hasOwnProperty(o)){var i=r[o];void 0!==i&&(e[o]=i)}}return e},w=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("undefined"===typeof o){var i=r[t];return void 0===i?"":i}},k=0,_=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];for(var r in g(this,e),this.isLeftChild=n,this.id=k++,this.data=null,this.expanded=!1,this.leftExpanded=!1,this.isCurrent=!1,this.visible=!0,this.parent=null,t)t.hasOwnProperty(r)&&(this[r]=t[r]);this.level=0,this.childNodes=[],this.leftChildNodes=[],this.parent&&(this.level=this.parent.level+1);var o=this.store;if(!o)throw new Error("[Node]store is required!");if(o.registerNode(this),this.data&&(this.setData(this.data,n),!o.defaultExpandAll&&o.showCollapsable||(this.expanded=!0,this.leftExpanded=!0)),Array.isArray(this.data)||c(this,this.data),this.data){var i=o.defaultExpandedKeys,s=o.key;s&&i&&-1!==i.indexOf(this.key)&&this.expand(null,!0),s&&void 0!==o.currentNodeKey&&this.key===o.currentNodeKey&&(o.currentNode=this,o.currentNode.isCurrent=!0),this.updateLeafState()}}return m(e,[{key:"setData",value:function(e,t){Array.isArray(e)||c(this,e);var n;this.store;this.data=e,this.childNodes=[],n=0===this.level&&this.data instanceof Array?this.data:w(this,"children")||[];for(var r=0,o=n.length;r<o;r++)this.insertChild({data:n[r]},null,null,t)}},{key:"hasLeftChild",value:function(){var e=this.store;return e.onlyBothTree&&"horizontal"===e.direction}},{key:"insertChild",value:function(t,n,r,o){if(!t)throw new Error("insertChild error: child is required.");if(!(t instanceof e)){if(!r){var i=this.getChildren(!0);-1===i.indexOf(t.data)&&(void 0===n||null===n||n<0?i.push(t.data):i.splice(n,0,t.data))}x(t,{parent:this,store:this.store}),t=new e(t,o)}t.level=this.level+1,void 0===n||null===n||n<0?this.childNodes.push(t):this.childNodes.splice(n,0,t),this.updateLeafState()}},{key:"getChildren",value: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]}},{key:"updateLeafState",value:function(){if(!0!==this.store.lazy||!0===this.loaded||"undefined"===typeof 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}},{key:"updateLeftLeafState",value:function(){if(!0!==this.store.lazy||!0===this.loaded||"undefined"===typeof this.isLeafByUser){var e=this.leftChildNodes;!this.store.lazy||!0===this.store.lazy&&!0===this.loaded?this.isLeaf=!e||0===e.length:this.isLeaf=!1}else this.isLeaf=this.isLeafByUser}},{key:"collapse",value:function(){this.expanded=!1}},{key:"expand",value:function(e,t){var n=this,r=function(){if(t){var r=n.parent;while(r.level>0)r.isLeftChild?r.leftExpanded=!0:r.expanded=!0,r=r.parent}n.isLeftChild?n.leftExpanded=!0:n.expanded=!0,e&&e()};r()}},{key:"removeChild",value: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()}},{key:"insertBefore",value:function(e,t){var n;t&&(n=this.childNodes.indexOf(t)),this.insertChild(e,n)}},{key:"insertAfter",value:function(e,t){var n;t&&(n=this.childNodes.indexOf(t),-1!==n&&(n+=1)),this.insertChild(e,n)}},{key:"key",get:function(){var e=this.store.key;return this.data?this.data[e]:null}},{key:"label",get:function(){return w(this,"label")}}]),e}(),S=function(){function e(t){for(var n in g(this,e),this.currentNode=null,this.currentNodeKey=null,t)t.hasOwnProperty(n)&&(this[n]=t[n]);this.nodesMap={},this.root=new _({data:this.data,store:this},!1),this.setLeftData(this.leftData)}return m(e,[{key:"filter",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"childNodes";this.filterRight(e,t)}},{key:"filterRight",value:function(e,t){var n=this.filterNodeMethod,r=function t(r,o){var i;if(i=r.root?r.root.childNodes[0][o]:r.childNodes,i.forEach((function(r){r.visible=n.call(r,e,r.data,r),t(r,o)})),!r.visible&&i.length){var s=!0;s=!i.some((function(e){return e.visible})),r.root?r.root.visible=!1===s:r.visible=!1===s}e&&r.visible&&r.expand()};r(this,t)}},{key:"registerNode",value:function(e){var t=this.key;if(t&&e&&e.data){var n=e.key;void 0!==n&&(this.nodesMap[e.key]=e)}}},{key:"deregisterNode",value:function(e){var t=this,n=this.key;n&&e&&e.data&&(e.childNodes.forEach((function(e){t.deregisterNode(e)})),delete this.nodesMap[e.key])}},{key:"setData",value:function(e){var t=e!==this.root.data;t?this.root.setData(e):this.root.updateChildren(),this.setLeftData(this.leftData)}},{key:"setLeftData",value:function(e){if(this.root.store.onlyBothTree){if(!e)throw new Error("[Tree] leftData is required in onlyBothTree");this.leftData&&(this.isLeftChilds=new _({data:e,store:this},!0),this.isLeftChilds&&(this.root.childNodes[0].leftChildNodes=this.isLeftChilds.childNodes[0].childNodes,this.root.childNodes[0].leftExpanded=this.isLeftChilds.childNodes[0].leftExpanded))}}},{key:"updateChildren",value: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 s=0,a=t.length;s<a;s++){var d=t[s];this.append(d,n.data)}}}},{key:"getNode",value:function(e){if(e instanceof _)return e;var t="object"!==N(e)?e:f(this.key,e);return this.nodesMap[t]||null}},{key:"setDefaultExpandedKeys",value:function(e){var t=this;e=e||[],this.defaultExpandedKeys=e,e.forEach((function(e){var n=t.getNode(e);n&&n.expand(null,!0)}))}},{key:"setCurrentNode",value:function(e){var t=this.currentNode;t&&(t.isCurrent=!1),this.currentNode=e,this.currentNode.isCurrent=!0}},{key:"setUserCurrentNode",value:function(e){var t=e.key,n=this.nodesMap[t];this.setCurrentNode(n)}},{key:"setCurrentNodeKey",value:function(e){if(null===e||void 0===e)return this.currentNode&&(this.currentNode.isCurrent=!1),void(this.currentNode=null);var t=this.getNode(e);t&&this.setCurrentNode(t)}},{key:"getCurrentNode",value:function(){return this.currentNode}},{key:"remove",value:function(e){var t=this.getNode(e);t&&t.parent&&(t===this.currentNode&&(this.currentNode=null),t.parent.removeChild(t))}},{key:"append",value:function(e,t){var n=t?this.getNode(t):this.root;n&&n.insertChild({data:e})}},{key:"insertBefore",value:function(e,t){var n=this.getNode(t);n.parent.insertBefore({data:e},n)}},{key:"insertAfter",value:function(e,t){var n=this.getNode(t);n.parent.insertAfter({data:e},n)}}]),e}(),E={name:"OkrTree",components:{OkrTreeNode:b},provide:function(){return{okrEventBus:this.okrEventBus}},props:{data:{required:!0},leftData:{type:Array},direction:{type:String,default:"vertical"},showCollapsable:{type:Boolean,default:!1},onlyBothTree:{type:Boolean,default:!1},orkstyle:{type:Boolean,default:!1},renderContent:Function,nodeBtnContent:Function,showNodeNum:Boolean,labelWidth:[String,Number],labelHeight:[String,Number],labelClassName:[Function,String],currentLableClassName:[Function,String],selectedKey:String,defaultExpandAll:{type:Boolean,default:!1},currentNodeKey:[String,Number],nodeKey:String,defaultExpandedKeys:{type:Array},filterNodeMethod:Function,props:{default:function(){return{leftChildren:"leftChildren",children:"children",label:"label",disabled:"disabled"}}},animate:{type:Boolean,default:!1},animateName:{type:String,default:"okr-zoom-in-center"},animateDuration:{type:Number,default:200}},computed:{ondeClass:function(){return{findNode:null}}},data:function(){return{okrEventBus:new a.a,store:null,root:null}},created:function(){this.isTree=!0,this.store=new S({key:this.nodeKey,data:this.data,leftData:this.leftData,props:this.props,defaultExpandedKeys:this.defaultExpandedKeys,showCollapsable:this.showCollapsable,currentNodeKey:this.currentNodeKey,defaultExpandAll:this.defaultExpandAll,filterNodeMethod:this.filterNodeMethod,labelClassName:this.labelClassName,currentLableClassName:this.currentLableClassName,onlyBothTree:this.onlyBothTree,direction:this.direction,animate:this.animate,animateName:this.animateName}),this.root=this.store.root},watch:{data:function(e){this.store.setData(e)},leftData:function(e){this.store.setLeftData(e)},defaultExpandedKeys:function(e){this.store.defaultExpandedKeys=e,this.store.setDefaultExpandedKeys(e)}},methods:{filter:function(e){if(!this.filterNodeMethod)throw new Error("[Tree] filterNodeMethod is required when filter");this.store.filter(e),this.onlyBothTree&&this.store.filter(e,"leftChildNodes")},getNodeKey:function(e){return f(this.nodeKey,e.data)},setCurrentNode:function(e){if(!this.nodeKey)throw new Error("[Tree] nodeKey is required in setCurrentNode");this.store.setUserCurrentNode(e)},getNode:function(e){return this.store.getNode(e)},setCurrentKey:function(e){if(!this.nodeKey)throw new Error("[Tree] nodeKey is required in setCurrentKey");this.store.setCurrentNodeKey(e)},remove:function(e){this.store.remove(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},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)},updateKeyChildren:function(e,t){if(!this.nodeKey)throw new Error("[Tree] nodeKey is required in updateKeyChild");this.store.updateChildren(e,t)}}},L=E,O=(n("606e"),y(L,o,i,!1,null,null,null)),T=O.exports},fdef:function(e,t){e.exports="\t\n\v\f\r   ᠎              \u2028\u2029\ufeff"}})})); //# sourceMappingURL=vue-okr-tree.umd.min.js.map