vue-okr-tree-vue3
Version:
基于qq449245884/vue-okr-tree改为vue3版本
2 lines • 34.6 kB
JavaScript
(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(){var t={9662:function(e,t,n){var r=n(7854),o=n(614),i=n(6330),s=r.TypeError;e.exports=function(e){if(o(e))return e;throw s(i(e)+" is not a function")}},6077:function(e,t,n){var r=n(7854),o=n(614),i=r.String,s=r.TypeError;e.exports=function(e){if("object"==typeof e||o(e))return e;throw s("Can't set "+i(e)+" as a prototype")}},9670:function(e,t,n){var r=n(7854),o=n(111),i=r.String,s=r.TypeError;e.exports=function(e){if(o(e))return e;throw s(i(e)+" is not an object")}},1318:function(e,t,n){var r=n(5656),o=n(1400),i=n(6244),s=function(e){return function(t,n,s){var a,l=r(t),d=i(l),c=o(s,d);if(e&&n!=n){while(d>c)if(a=l[c++],a!=a)return!0}else for(;d>c;c++)if((e||c in l)&&l[c]===n)return e||c||0;return!e&&-1}};e.exports={includes:s(!0),indexOf:s(!1)}},4326:function(e,t,n){var r=n(1702),o=r({}.toString),i=r("".slice);e.exports=function(e){return i(o(e),8,-1)}},648:function(e,t,n){var r=n(7854),o=n(1694),i=n(614),s=n(4326),a=n(5112),l=a("toStringTag"),d=r.Object,c="Arguments"==s(function(){return arguments}()),u=function(e,t){try{return e[t]}catch(n){}};e.exports=o?s:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=u(t=d(e),l))?n:c?s(t):"Object"==(r=s(t))&&i(t.callee)?"Arguments":r}},7741:function(e,t,n){var r=n(1702),o=r("".replace),i=function(e){return String(Error(e).stack)}("zxcasd"),s=/\n\s*at [^:]*:[^\n]*/,a=s.test(i);e.exports=function(e,t){if(a&&"string"==typeof e)while(t--)e=o(e,s,"");return e}},9920:function(e,t,n){var r=n(2597),o=n(3887),i=n(1236),s=n(3070);e.exports=function(e,t,n){for(var a=o(t),l=s.f,d=i.f,c=0;c<a.length;c++){var u=a[c];r(e,u)||n&&r(n,u)||l(e,u,d(t,u))}}},8880:function(e,t,n){var r=n(9781),o=n(3070),i=n(9114);e.exports=r?function(e,t,n){return o.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},9114:function(e){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},9781:function(e,t,n){var r=n(7293);e.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},317:function(e,t,n){var r=n(7854),o=n(111),i=r.document,s=o(i)&&o(i.createElement);e.exports=function(e){return s?i.createElement(e):{}}},8113:function(e,t,n){var r=n(5005);e.exports=r("navigator","userAgent")||""},7392:function(e,t,n){var r,o,i=n(7854),s=n(8113),a=i.process,l=i.Deno,d=a&&a.versions||l&&l.version,c=d&&d.v8;c&&(r=c.split("."),o=r[0]>0&&r[0]<4?1:+(r[0]+r[1])),!o&&s&&(r=s.match(/Edge\/(\d+)/),(!r||r[1]>=74)&&(r=s.match(/Chrome\/(\d+)/),r&&(o=+r[1]))),e.exports=o},748:function(e){e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},2914:function(e,t,n){var r=n(7293),o=n(9114);e.exports=!r((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",o(1,7)),7!==e.stack)}))},2109:function(e,t,n){var r=n(7854),o=n(1236).f,i=n(8880),s=n(1320),a=n(3505),l=n(9920),d=n(4705);e.exports=function(e,t){var n,c,u,h,f,p,y=e.target,v=e.global,m=e.stat;if(c=v?r:m?r[y]||a(y,{}):(r[y]||{}).prototype,c)for(u in t){if(f=t[u],e.noTargetGet?(p=o(c,u),h=p&&p.value):h=c[u],n=d(v?u:y+(m?".":"#")+u,e.forced),!n&&void 0!==h){if(typeof f==typeof h)continue;l(f,h)}(e.sham||h&&h.sham)&&i(f,"sham",!0),s(c,u,f,e)}}},7293:function(e){e.exports=function(e){try{return!!e()}catch(t){return!0}}},2104:function(e,t,n){var r=n(4374),o=Function.prototype,i=o.apply,s=o.call;e.exports="object"==typeof Reflect&&Reflect.apply||(r?s.bind(i):function(){return s.apply(i,arguments)})},4374:function(e,t,n){var r=n(7293);e.exports=!r((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},6916:function(e,t,n){var r=n(4374),o=Function.prototype.call;e.exports=r?o.bind(o):function(){return o.apply(o,arguments)}},6530:function(e,t,n){var r=n(9781),o=n(2597),i=Function.prototype,s=r&&Object.getOwnPropertyDescriptor,a=o(i,"name"),l=a&&"something"===function(){}.name,d=a&&(!r||r&&s(i,"name").configurable);e.exports={EXISTS:a,PROPER:l,CONFIGURABLE:d}},1702:function(e,t,n){var r=n(4374),o=Function.prototype,i=o.bind,s=o.call,a=r&&i.bind(s,s);e.exports=r?function(e){return e&&a(e)}:function(e){return e&&function(){return s.apply(e,arguments)}}},5005:function(e,t,n){var r=n(7854),o=n(614),i=function(e){return o(e)?e:void 0};e.exports=function(e,t){return arguments.length<2?i(r[e]):r[e]&&r[e][t]}},8173:function(e,t,n){var r=n(9662);e.exports=function(e,t){var n=e[t];return null==n?void 0:r(n)}},7854:function(e,t,n){var r=function(e){return e&&e.Math==Math&&e};e.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof n.g&&n.g)||function(){return this}()||Function("return this")()},2597:function(e,t,n){var r=n(1702),o=n(7908),i=r({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return i(o(e),t)}},3501:function(e){e.exports={}},4664:function(e,t,n){var r=n(9781),o=n(7293),i=n(317);e.exports=!r&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},8361:function(e,t,n){var r=n(7854),o=n(1702),i=n(7293),s=n(4326),a=r.Object,l=o("".split);e.exports=i((function(){return!a("z").propertyIsEnumerable(0)}))?function(e){return"String"==s(e)?l(e,""):a(e)}:a},9587:function(e,t,n){var r=n(614),o=n(111),i=n(7674);e.exports=function(e,t,n){var s,a;return i&&r(s=t.constructor)&&s!==n&&o(a=s.prototype)&&a!==n.prototype&&i(e,a),e}},2788:function(e,t,n){var r=n(1702),o=n(614),i=n(5465),s=r(Function.toString);o(i.inspectSource)||(i.inspectSource=function(e){return s(e)}),e.exports=i.inspectSource},8340:function(e,t,n){var r=n(111),o=n(8880);e.exports=function(e,t){r(t)&&"cause"in t&&o(e,"cause",t.cause)}},9909:function(e,t,n){var r,o,i,s=n(8536),a=n(7854),l=n(1702),d=n(111),c=n(8880),u=n(2597),h=n(5465),f=n(6200),p=n(3501),y="Object already initialized",v=a.TypeError,m=a.WeakMap,b=function(e){return i(e)?o(e):r(e,{})},g=function(e){return function(t){var n;if(!d(t)||(n=o(t)).type!==e)throw v("Incompatible receiver, "+e+" required");return n}};if(s||h.state){var N=h.state||(h.state=new m),C=l(N.get),x=l(N.has),w=l(N.set);r=function(e,t){if(x(N,e))throw new v(y);return t.facade=e,w(N,e,t),t},o=function(e){return C(N,e)||{}},i=function(e){return x(N,e)}}else{var k=f("state");p[k]=!0,r=function(e,t){if(u(e,k))throw new v(y);return t.facade=e,c(e,k,t),t},o=function(e){return u(e,k)?e[k]:{}},i=function(e){return u(e,k)}}e.exports={set:r,get:o,has:i,enforce:b,getterFor:g}},614:function(e){e.exports=function(e){return"function"==typeof e}},4705:function(e,t,n){var r=n(7293),o=n(614),i=/#|\.prototype\./,s=function(e,t){var n=l[a(e)];return n==c||n!=d&&(o(t)?r(t):!!t)},a=s.normalize=function(e){return String(e).replace(i,".").toLowerCase()},l=s.data={},d=s.NATIVE="N",c=s.POLYFILL="P";e.exports=s},111:function(e,t,n){var r=n(614);e.exports=function(e){return"object"==typeof e?null!==e:r(e)}},1913:function(e){e.exports=!1},2190:function(e,t,n){var r=n(7854),o=n(5005),i=n(614),s=n(7976),a=n(3307),l=r.Object;e.exports=a?function(e){return"symbol"==typeof e}:function(e){var t=o("Symbol");return i(t)&&s(t.prototype,l(e))}},6244:function(e,t,n){var r=n(7466);e.exports=function(e){return r(e.length)}},133:function(e,t,n){var r=n(7392),o=n(7293);e.exports=!!Object.getOwnPropertySymbols&&!o((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},8536:function(e,t,n){var r=n(7854),o=n(614),i=n(2788),s=r.WeakMap;e.exports=o(s)&&/native code/.test(i(s))},6277:function(e,t,n){var r=n(1340);e.exports=function(e,t){return void 0===e?arguments.length<2?"":t:r(e)}},3070:function(e,t,n){var r=n(7854),o=n(9781),i=n(4664),s=n(3353),a=n(9670),l=n(4948),d=r.TypeError,c=Object.defineProperty,u=Object.getOwnPropertyDescriptor,h="enumerable",f="configurable",p="writable";t.f=o?s?function(e,t,n){if(a(e),t=l(t),a(n),"function"===typeof e&&"prototype"===t&&"value"in n&&p in n&&!n[p]){var r=u(e,t);r&&r[p]&&(e[t]=n.value,n={configurable:f in n?n[f]:r[f],enumerable:h in n?n[h]:r[h],writable:!1})}return c(e,t,n)}:c:function(e,t,n){if(a(e),t=l(t),a(n),i)try{return c(e,t,n)}catch(r){}if("get"in n||"set"in n)throw d("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},1236:function(e,t,n){var r=n(9781),o=n(6916),i=n(5296),s=n(9114),a=n(5656),l=n(4948),d=n(2597),c=n(4664),u=Object.getOwnPropertyDescriptor;t.f=r?u:function(e,t){if(e=a(e),t=l(t),c)try{return u(e,t)}catch(n){}if(d(e,t))return s(!o(i.f,e,t),e[t])}},8006:function(e,t,n){var r=n(6324),o=n(748),i=o.concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,i)}},5181:function(e,t){t.f=Object.getOwnPropertySymbols},7976:function(e,t,n){var r=n(1702);e.exports=r({}.isPrototypeOf)},6324:function(e,t,n){var r=n(1702),o=n(2597),i=n(5656),s=n(1318).indexOf,a=n(3501),l=r([].push);e.exports=function(e,t){var n,r=i(e),d=0,c=[];for(n in r)!o(a,n)&&o(r,n)&&l(c,n);while(t.length>d)o(r,n=t[d++])&&(~s(c,n)||l(c,n));return c}},5296:function(e,t){"use strict";var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,o=r&&!n.call({1:2},1);t.f=o?function(e){var t=r(this,e);return!!t&&t.enumerable}:n},7674:function(e,t,n){var r=n(1702),o=n(9670),i=n(6077);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{e=r(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set),e(n,[]),t=n instanceof Array}catch(s){}return function(n,r){return o(n),i(r),t?e(n,r):n.__proto__=r,n}}():void 0)},2140:function(e,t,n){var r=n(7854),o=n(6916),i=n(614),s=n(111),a=r.TypeError;e.exports=function(e,t){var n,r;if("string"===t&&i(n=e.toString)&&!s(r=o(n,e)))return r;if(i(n=e.valueOf)&&!s(r=o(n,e)))return r;if("string"!==t&&i(n=e.toString)&&!s(r=o(n,e)))return r;throw a("Can't convert object to primitive value")}},3887:function(e,t,n){var r=n(5005),o=n(1702),i=n(8006),s=n(5181),a=n(9670),l=o([].concat);e.exports=r("Reflect","ownKeys")||function(e){var t=i.f(a(e)),n=s.f;return n?l(t,n(e)):t}},1320:function(e,t,n){var r=n(7854),o=n(614),i=n(2597),s=n(8880),a=n(3505),l=n(2788),d=n(9909),c=n(6530).CONFIGURABLE,u=d.get,h=d.enforce,f=String(String).split("String");(e.exports=function(e,t,n,l){var d,u=!!l&&!!l.unsafe,p=!!l&&!!l.enumerable,y=!!l&&!!l.noTargetGet,v=l&&void 0!==l.name?l.name:t;o(n)&&("Symbol("===String(v).slice(0,7)&&(v="["+String(v).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!i(n,"name")||c&&n.name!==v)&&s(n,"name",v),d=h(n),d.source||(d.source=f.join("string"==typeof v?v:""))),e!==r?(u?!y&&e[t]&&(p=!0):delete e[t],p?e[t]=n:s(e,t,n)):p?e[t]=n:a(t,n)})(Function.prototype,"toString",(function(){return o(this)&&u(this).source||l(this)}))},4488:function(e,t,n){var r=n(7854),o=r.TypeError;e.exports=function(e){if(void 0==e)throw o("Can't call method on "+e);return e}},3505:function(e,t,n){var r=n(7854),o=Object.defineProperty;e.exports=function(e,t){try{o(r,e,{value:t,configurable:!0,writable:!0})}catch(n){r[e]=t}return t}},6200:function(e,t,n){var r=n(2309),o=n(9711),i=r("keys");e.exports=function(e){return i[e]||(i[e]=o(e))}},5465:function(e,t,n){var r=n(7854),o=n(3505),i="__core-js_shared__",s=r[i]||o(i,{});e.exports=s},2309:function(e,t,n){var r=n(1913),o=n(5465);(e.exports=function(e,t){return o[e]||(o[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.21.1",mode:r?"pure":"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.21.1/LICENSE",source:"https://github.com/zloirock/core-js"})},1400:function(e,t,n){var r=n(9303),o=Math.max,i=Math.min;e.exports=function(e,t){var n=r(e);return n<0?o(n+t,0):i(n,t)}},5656:function(e,t,n){var r=n(8361),o=n(4488);e.exports=function(e){return r(o(e))}},9303:function(e){var t=Math.ceil,n=Math.floor;e.exports=function(e){var r=+e;return r!==r||0===r?0:(r>0?n:t)(r)}},7466:function(e,t,n){var r=n(9303),o=Math.min;e.exports=function(e){return e>0?o(r(e),9007199254740991):0}},7908:function(e,t,n){var r=n(7854),o=n(4488),i=r.Object;e.exports=function(e){return i(o(e))}},7593:function(e,t,n){var r=n(7854),o=n(6916),i=n(111),s=n(2190),a=n(8173),l=n(2140),d=n(5112),c=r.TypeError,u=d("toPrimitive");e.exports=function(e,t){if(!i(e)||s(e))return e;var n,r=a(e,u);if(r){if(void 0===t&&(t="default"),n=o(r,e,t),!i(n)||s(n))return n;throw c("Can't convert object to primitive value")}return void 0===t&&(t="number"),l(e,t)}},4948:function(e,t,n){var r=n(7593),o=n(2190);e.exports=function(e){var t=r(e,"string");return o(t)?t:t+""}},1694:function(e,t,n){var r=n(5112),o=r("toStringTag"),i={};i[o]="z",e.exports="[object z]"===String(i)},1340:function(e,t,n){var r=n(7854),o=n(648),i=r.String;e.exports=function(e){if("Symbol"===o(e))throw TypeError("Cannot convert a Symbol value to a string");return i(e)}},6330:function(e,t,n){var r=n(7854),o=r.String;e.exports=function(e){try{return o(e)}catch(t){return"Object"}}},9711:function(e,t,n){var r=n(1702),o=0,i=Math.random(),s=r(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+s(++o+i,36)}},3307:function(e,t,n){var r=n(133);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},3353:function(e,t,n){var r=n(9781),o=n(7293);e.exports=r&&o((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},5112:function(e,t,n){var r=n(7854),o=n(2309),i=n(2597),s=n(9711),a=n(133),l=n(3307),d=o("wks"),c=r.Symbol,u=c&&c["for"],h=l?c:c&&c.withoutSetter||s;e.exports=function(e){if(!i(d,e)||!a&&"string"!=typeof d[e]){var t="Symbol."+e;a&&i(c,e)?d[e]=c[e]:d[e]=l&&u?u(t):h(t)}return d[e]}},9191:function(e,t,n){"use strict";var r=n(5005),o=n(2597),i=n(8880),s=n(7976),a=n(7674),l=n(9920),d=n(9587),c=n(6277),u=n(8340),h=n(7741),f=n(2914),p=n(1913);e.exports=function(e,t,n,y){var v=y?2:1,m=e.split("."),b=m[m.length-1],g=r.apply(null,m);if(g){var N=g.prototype;if(!p&&o(N,"cause")&&delete N.cause,!n)return g;var C=r("Error"),x=t((function(e,t){var n=c(y?t:e,void 0),r=y?new g(e):new g;return void 0!==n&&i(r,"message",n),f&&i(r,"stack",h(r.stack,2)),this&&s(N,this)&&d(r,this,x),arguments.length>v&&u(r,arguments[v]),r}));if(x.prototype=N,"Error"!==b&&(a?a(x,C):l(x,C,{name:!0})),l(x,g),!p)try{N.name!==b&&i(N,"name",b),N.constructor=x}catch(w){}return x}}},1703:function(e,t,n){var r=n(2109),o=n(7854),i=n(2104),s=n(9191),a="WebAssembly",l=o[a],d=7!==Error("e",{cause:7}).cause,c=function(e,t){var n={};n[e]=s(e,t,d),r({global:!0,forced:d},n)},u=function(e,t){if(l&&l[e]){var n={};n[e]=s(a+"."+e,t,d),r({target:a,stat:!0,forced:d},n)}};c("Error",(function(e){return function(t){return i(e,this,arguments)}})),c("EvalError",(function(e){return function(t){return i(e,this,arguments)}})),c("RangeError",(function(e){return function(t){return i(e,this,arguments)}})),c("ReferenceError",(function(e){return function(t){return i(e,this,arguments)}})),c("SyntaxError",(function(e){return function(t){return i(e,this,arguments)}})),c("TypeError",(function(e){return function(t){return i(e,this,arguments)}})),c("URIError",(function(e){return function(t){return i(e,this,arguments)}})),u("CompileError",(function(e){return function(t){return i(e,this,arguments)}})),u("LinkError",(function(e){return function(t){return i(e,this,arguments)}})),u("RuntimeError",(function(e){return function(t){return i(e,this,arguments)}}))},3744:function(e,t){"use strict";t.Z=(e,t)=>{const n=e.__vccOpts||e;for(const[r,o]of t)n[r]=o;return n}},7203:function(t){"use strict";t.exports=e}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,r),i.exports}!function(){r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}}(),function(){r.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}()}(),function(){r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}}(),function(){r.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}}(),function(){r.p=""}();var o={};return function(){"use strict";if(r.r(o),r.d(o,{VueOkrTree:function(){return B}}),"undefined"!==typeof window){var e=window.document.currentScript,t=e&&e.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);t&&(r.p=t[1])}var n=r(7203);const i={class:"org-chart-container"};function s(e,t,r,o,s,a){const l=(0,n.resolveComponent)("OkrTreeNode");return(0,n.openBlock)(),(0,n.createElementBlock)("div",i,[(0,n.createElementVNode)("div",{ref:"orgChartRoot",class:(0,n.normalizeClass)(["org-chart-node-children",{vertical:"vertical"===r.direction,horizontal:"horizontal"===r.direction,"show-collapsable":r.showCollapsable,"one-branch":1===r.data.length}])},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(s.root.childNodes,(e=>((0,n.openBlock)(),(0,n.createBlock)(l,{node:e,root:s.root,orkstyle:"","show-collapsable":r.showCollapsable,"label-width":r.labelWidth,"label-height":r.labelHeight,renderContent:r.renderContent,nodeBtnContent:r.nodeBtnContent,"selected-key":r.selectedKey,"default-expand-all":r.defaultExpandAll,"node-key":r.nodeKey,"show-node-num":r.showNodeNum,key:a.getNodeKey(e),props:r.props},null,8,["node","root","show-collapsable","label-width","label-height","renderContent","nodeBtnContent","selected-key","default-expand-all","node-key","show-node-num","props"])))),128))],2)])}r(1703);const a={key:0,class:"org-chart-node-left-children"},l={key:0,class:"org-chart-node-btn-text"},d={key:0,class:"org-chart-node-btn-text"},c={key:1,class:"org-chart-node-children"};function u(e,t,r,o,i,s){const u=(0,n.resolveComponent)("OkrTreeNode",!0),h=(0,n.resolveComponent)("node-btn-content"),f=(0,n.resolveComponent)("node-content");return r.node.visible?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:(0,n.normalizeClass)(["org-chart-node",{collapsed:!r.node.leftExpanded||!r.node.expanded,"is-leaf":s.isLeaf,"is-current":r.node.isCurrent,"is-left-child-node":r.isLeftChildNode,"is-not-child":1===r.node.level&&r.node.childNodes.length<=0&&s.leftChildNodes.length<=0,"only-both-tree-node":1===r.node.level&&i.tree.store.onlyBothTree}]),onContextmenu:t[3]||(t[3]=e=>this.handleContextMenu(e))},[s.showLeftChildNode?(0,n.withDirectives)(((0,n.openBlock)(),(0,n.createElementBlock)("div",a,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(s.leftChildNodes,(e=>((0,n.openBlock)(),(0,n.createBlock)(u,{"show-collapsable":r.showCollapsable,node:e,"label-width":r.labelWidth,"label-height":r.labelHeight,renderContent:r.renderContent,nodeBtnContent:r.nodeBtnContent,"selected-key":r.selectedKey,"node-key":r.nodeKey,key:s.getNodeKey(e),props:r.props,"show-node-num":r.showNodeNum,"is-left-child-node":""},null,8,["show-collapsable","node","label-width","label-height","renderContent","nodeBtnContent","selected-key","node-key","props","show-node-num"])))),128))],512)),[[n.vShow,r.node.leftExpanded]]):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["org-chart-node-label",{"is-root-label":1===r.node.level,"is-not-right-child":1===r.node.level&&r.node.childNodes.length<=0,"is-not-left-child":1===r.node.level&&s.leftChildNodes.length<=0}])},[s.showNodeLeftBtn&&s.leftChildNodes.length>0?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:(0,n.normalizeClass)(["org-chart-node-left-btn",{expanded:r.node.leftExpanded}]),onClick:t[0]||(t[0]=e=>s.handleBtnClick("left"))},[r.showNodeNum?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:0},[r.node.leftExpanded?(0,n.createCommentVNode)("",!0):((0,n.openBlock)(),(0,n.createElementBlock)("span",l,(0,n.toDisplayString)(1===r.node.level&&s.leftChildNodes.length>0?s.leftChildNodes.length:r.node.childNodes.length),1))],64)):((0,n.openBlock)(),(0,n.createBlock)(h,{key:1,node:r.node},{default:(0,n.withCtx)((()=>[(0,n.renderSlot)(e.$slots,"default")])),_:3},8,["node"]))],2)):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["org-chart-node-label-inner",s.computeLabelClass]),onClick:t[1]||(t[1]=(...e)=>s.handleNodeClick&&s.handleNodeClick(...e)),style:(0,n.normalizeStyle)(s.computeLabelStyle)},[(0,n.createVNode)(f,{node:r.node},{default:(0,n.withCtx)((()=>[(0,n.renderSlot)(e.$slots,"default",{},(()=>[(0,n.createTextVNode)((0,n.toDisplayString)(r.node.label),1)]))])),_:3},8,["node"])],6),s.showNodeBtn&&!r.isLeftChildNode?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:1,class:(0,n.normalizeClass)(["org-chart-node-btn",{expanded:r.node.expanded}]),onClick:t[2]||(t[2]=e=>s.handleBtnClick("right"))},[r.showNodeNum?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:0},[r.node.expanded?(0,n.createCommentVNode)("",!0):((0,n.openBlock)(),(0,n.createElementBlock)("span",d,(0,n.toDisplayString)(r.node.childNodes.length),1))],64)):((0,n.openBlock)(),(0,n.createBlock)(h,{key:1,node:r.node},{default:(0,n.withCtx)((()=>[(0,n.renderSlot)(e.$slots,"default")])),_:3},8,["node"]))],2)):(0,n.createCommentVNode)("",!0)],2),!r.isLeftChildNode&&r.node.childNodes&&r.node.childNodes.length>0?(0,n.withDirectives)(((0,n.openBlock)(),(0,n.createElementBlock)("div",c,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(r.node.childNodes,(e=>((0,n.openBlock)(),(0,n.createBlock)(u,{"show-collapsable":r.showCollapsable,node:e,"label-width":r.labelWidth,"label-height":r.labelHeight,renderContent:r.renderContent,nodeBtnContent:r.nodeBtnContent,"selected-key":r.selectedKey,"node-key":r.nodeKey,key:s.getNodeKey(e),"show-node-num":r.showNodeNum,props:r.props},null,8,["show-collapsable","node","label-width","label-height","renderContent","nodeBtnContent","selected-key","node-key","show-node-num","props"])))),128))],512)),[[n.vShow,r.node.expanded]]):(0,n.createCommentVNode)("",!0)],34)):(0,n.createCommentVNode)("",!0)}const h="$treeNodeId",f=function(e,t){t&&!t[h]&&Object.defineProperty(t,h,{value:e.id,enumerable:!1,configurable:!1,writable:!1})},p=function(e,t){return e?t[e]:t[h]};var y={name:"OkrTreeNode",props:{props:{},node:{default(){return{level:0,childNodes:[],leftExpanded:!1,expanded:!1}}},root:{default(){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(e){const t=this.$parent;return t.$props.renderContent?t.$props.renderContent(e,this.node):this.$slots.default(this.node)}},NodeBtnContent:{props:{node:{required:!0}},render(e){const t=this.$parent;return t.$props.nodeBtnContent?t.$props.nodeBtnContent(e,this.node):this.$slots.default?this.$slots.default(this.node):void 0}}},computed:{isLeaf(){return 1===this.node.level?0==this.leftChildNodes.length&&0==this.node.childNodes.length:this.node.isLeaf},leftChildNodes(){return this.tree&&this.tree.store.onlyBothTree?this.isLeftChildNode?this.node.childNodes:this.node.leftChildNodes:[]},animateName(){return this.tree&&this.tree.store.animate?this.tree.store.animateName:""},animateDuration(){return this.tree&&this.tree.store.animate?this.tree.store.animateDuration:0},showNodeBtn(){return this.isLeftChildNode?this.tree&&"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(){return this.tree&&"horizontal"===this.tree.store.direction&&this.showCollapsable&&this.leftChildNodes.length>0},computeLabelStyle(){let{labelWidth:e="auto",labelHeight:t="auto"}=this;return"number"===typeof e&&(e=`${e}px`),"number"===typeof t&&(t=`${t}px`),{width:e,height:t}},computeLabelClass(){let e=[];if(this.tree){const t=this.tree.store;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")}return e},computNodeStyle(){return{display:this.node.expanded?"":"none"}},computLeftNodeStyle(){return{display:this.node.leftExpanded?"":"none"}},showLeftChildNode(){return this.tree&&this.tree.onlyBothTree&&"horizontal"===this.tree.store.direction&&this.leftChildNodes&&this.leftChildNodes.length>0}},watch:{"node.expanded"(e){},"node.leftExpanded"(e){}},data(){return{expanded:!1,tree:null}},created(){const e=this.$parent;e.isTree?this.tree=e:this.tree=e.tree;const t=this.tree;t||console.warn("Can not find node's tree.")},methods:{getNodeKey(e){return p(this.nodeKey,e.data)},handleNodeClick(){const e=this.tree.store;e.setCurrentNode(this.node),this.tree.$emit("node-click",this.node.data,this.node,this)},handleBtnClick(e){if(e="left"===e,this.tree){const t=this.tree.store;if(t.onlyBothTree&&e)return void(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(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)}}},v=r(3744);const m=(0,v.Z)(y,[["render",u]]);var b=m;function g(e){for(let t=1,n=arguments.length;t<n;t++){let n=arguments[t]||{};for(let t in n)if(n.hasOwnProperty(t)){let r=n[t];void 0!==r&&(e[t]=r)}}return e}const N=function(e,t){const 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){const e=r[t];return void 0===e?"":e}};let C=0;class x{constructor(e,t=!1){this.isLeftChild=t,this.id=C++,this.data=null,this.expanded=!1,this.leftExpanded=!1,this.isCurrent=!1,this.visible=!0,this.parent=null;for(let i in e)e.hasOwnProperty(i)&&(this[i]=e[i]);this.level=0,this.childNodes=[],this.leftChildNodes=[],this.parent&&(this.level=this.parent.level+1);const n=this.store;if(!n)throw new Error("[Node]store is required!");if(n.registerNode(this),this.data&&(this.setData(this.data,t),!n.defaultExpandAll&&n.showCollapsable||(this.expanded=!0,this.leftExpanded=!0)),Array.isArray(this.data)||f(this,this.data),!this.data)return;const r=n.defaultExpandedKeys,o=n.key;o&&r&&-1!==r.indexOf(this.key)&&this.expand(null,!0),o&&void 0!==n.currentNodeKey&&this.key===n.currentNodeKey&&(n.currentNode=this,n.currentNode.isCurrent=!0),this.updateLeafState()}setData(e,t){Array.isArray(e)||f(this,e);this.store;let n;this.data=e,this.childNodes=[],n=0===this.level&&this.data instanceof Array?this.data:N(this,"children")||[];for(let r=0,o=n.length;r<o;r++)this.insertChild({data:n[r]},null,null,t)}get key(){const e=this.store.key;return this.data?this.data[e]:null}get label(){return N(this,"label")}hasLeftChild(){const e=this.store;return e.onlyBothTree&&"horizontal"===e.direction}insertChild(e,t,n,r){if(!e)throw new Error("insertChild error: child is required.");if(!(e instanceof x)){if(!n){const n=this.getChildren(!0);-1===n.indexOf(e.data)&&(void 0===t||null===t||t<0?n.push(e.data):n.splice(t,0,e.data))}g(e,{parent:this,store:this.store}),e=new x(e,r)}e.level=this.level+1,void 0===t||null===t||t<0?this.childNodes.push(e):this.childNodes.splice(t,0,e),this.updateLeafState()}getChildren(e=!1){if(0===this.level)return this.data;const t=this.data;if(!t)return null;const n=this.store.props;let r="children";return n&&(r=n.children||"children"),void 0===t[r]&&(t[r]=null),e&&!t[r]&&(t[r]=[]),t[r]}updateLeafState(){if(!0===this.store.lazy&&!0!==this.loaded&&"undefined"!==typeof this.isLeafByUser)return void(this.isLeaf=this.isLeafByUser);const e=this.childNodes;!this.store.lazy||!0===this.store.lazy&&!0===this.loaded?this.isLeaf=!e||0===e.length:this.isLeaf=!1}updateLeftLeafState(){if(!0===this.store.lazy&&!0!==this.loaded&&"undefined"!==typeof this.isLeafByUser)return void(this.isLeaf=this.isLeafByUser);const e=this.leftChildNodes;!this.store.lazy||!0===this.store.lazy&&!0===this.loaded?this.isLeaf=!e||0===e.length:this.isLeaf=!1}collapse(){this.expanded=!1}expand(e,t){const n=()=>{if(t){let e=this.parent;while(e.level>0)e.isLeftChild?e.leftExpanded=!0:e.expanded=!0,e=e.parent}this.isLeftChild?this.leftExpanded=!0:this.expanded=!0,e&&e()};n()}removeChild(e){const t=this.getChildren()||[],n=t.indexOf(e.data);n>-1&&t.splice(n,1);const r=this.childNodes.indexOf(e);r>-1&&(this.store&&this.store.deregisterNode(e),e.parent=null,this.childNodes.splice(r,1)),this.updateLeafState()}insertBefore(e,t){let n;t&&(n=this.childNodes.indexOf(t)),this.insertChild(e,n)}insertAfter(e,t){let n;t&&(n=this.childNodes.indexOf(t),-1!==n&&(n+=1)),this.insertChild(e,n)}}class w{constructor(e){this.currentNode=null,this.currentNodeKey=null;for(let t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);if(this.nodesMap={},this.root=new x({data:this.data,store:this},!1),this.root.store.onlyBothTree){if(!this.leftData)throw new Error("[Tree] leftData is required in onlyBothTree");this.leftData&&(this.isLeftChilds=new x({data:this.leftData,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))}}filter(e,t="childNodes"){this.filterRight(e,t)}filterRight(e,t){const n=this.filterNodeMethod,r=function(t,o){let i;if(i=t.root?t.root.childNodes[0][o]:t.childNodes,i.forEach((t=>{t.visible=n.call(t,e,t.data,t),r(t,o)})),!t.visible&&i.length){let e=!0;e=!i.some((e=>e.visible)),t.root?t.root.visible=!1===e:t.visible=!1===e}e&&t.visible&&t.expand()};r(this,t)}registerNode(e){const t=this.key;if(!t||!e||!e.data)return;const n=e.key;void 0!==n&&(this.nodesMap[e.key]=e)}deregisterNode(e){const t=this.key;t&&e&&e.data&&(e.childNodes.forEach((e=>{this.deregisterNode(e)})),delete this.nodesMap[e.key])}setData(e){const t=e!==this.root.data;t?this.root.setData(e):this.root.updateChildren()}updateChildren(e,t){const n=this.nodesMap[e];if(!n)return;const r=n.childNodes;for(let o=r.length-1;o>=0;o--){const e=r[o];this.remove(e.data)}for(let o=0,i=t.length;o<i;o++){const e=t[o];this.append(e,n.data)}}getNode(e){if(e instanceof x)return e;const t="object"!==typeof e?e:p(this.key,e);return this.nodesMap[t]||null}setDefaultExpandedKeys(e){e=e||[],this.defaultExpandedKeys=e,e.forEach((e=>{const t=this.getNode(e);t&&t.expand(null,!0)}))}setCurrentNode(e){const t=this.currentNode;t&&(t.isCurrent=!1),this.currentNode=e,this.currentNode.isCurrent=!0}setUserCurrentNode(e){const t=e.key,n=this.nodesMap[t];this.setCurrentNode(n)}setCurrentNodeKey(e){if(null===e||void 0===e)return this.currentNode&&(this.currentNode.isCurrent=!1),void(this.currentNode=null);const t=this.getNode(e);t&&this.setCurrentNode(t)}getCurrentNode(){return this.currentNode}remove(e){const t=this.getNode(e);t&&t.parent&&(t===this.currentNode&&(this.currentNode=null),t.parent.removeChild(t))}append(e,t){const n=t?this.getNode(t):this.root;n&&n.insertChild({data:e})}insertBefore(e,t){const n=this.getNode(t);n.parent.insertBefore({data:e},n)}insertAfter(e,t){const n=this.getNode(t);n.parent.insertAfter({data:e},n)}}var k={name:"OkrTree",components:{OkrTreeNode:b},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(){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(){return{findNode:null}}},data(){return{store:null,root:null}},created(){this.isTree=!0,this.store=new w({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(e){this.store.setData(e)},defaultExpandedKeys(e){this.store.defaultExpandedKeys=e,this.store.setDefaultExpandedKeys(e)}},methods:{filter(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(e){return p(this.nodeKey,e.data)},setCurrentNode(e){if(!this.nodeKey)throw new Error("[Tree] nodeKey is required in setCurrentNode");this.store.setUserCurrentNode(e)},getNode(e){return this.store.getNode(e)},setCurrentKey(e){if(!this.nodeKey)throw new Error("[Tree] nodeKey is required in setCurrentKey");this.store.setCurrentNodeKey(e)},remove(e){this.store.remove(e)},getCurrentNode(){const e=this.store.getCurrentNode();return e?e.data:null},getCurrentKey(){if(!this.nodeKey)throw new Error("[Tree] nodeKey is required in getCurrentKey");const e=this.getCurrentNode();return e?e[this.nodeKey]:null},append(e,t){this.store.append(e,t)},insertBefore(e,t){this.store.insertBefore(e,t)},insertAfter(e,t){this.store.insertAfter(e,t)},updateKeyChildren(e,t){if(!this.nodeKey)throw new Error("[Tree] nodeKey is required in updateKeyChild");this.store.updateChildren(e,t)}}};const E=(0,v.Z)(k,[["render",s]]);var B=E}(),o}()}));
//# sourceMappingURL=vue-okr-tree.umd.min.js.map