2 lines
7.8 KiB
JavaScript
2 lines
7.8 KiB
JavaScript
|
import e,{Component as t}from"react";import{classNames as n}from"primereact/utils";function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function r(e){if(Array.isArray(e))return o(e)}function i(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function l(e,t){if(e){if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}function s(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function a(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function d(e,t,n){return t&&p(e.prototype,t),n&&p(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function u(e,t){return u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},u(e,t)}function h(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u(e,t)}function f(e){return f="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},f(e)}function m(e,t){if(t&&("object"===f(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return a(e)}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}function g(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function v(e){var t=b();return function(){var n,o=y(e);if(t){var r=y(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return m(this,n)}}function b(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var N=function(o){h(i,t);var r=v(i);function i(e){var t;return c(this,i),(t=r.call(this,e)).node=t.props.node,t.state={expanded:t.node.expanded},t}return d(i,[{key:"getLeaf",value:function(){return!1!==this.node.leaf&&!(this.node.children&&this.node.children.length)}},{key:"getColspan",value:function(){return this.node.children&&this.node.children.length?2*this.node.children.length:null}},{key:"onNodeClick",value:function(e,t){this.props.onNodeClick(e,t)}},{key:"toggleNode",value:function(e,t){this.setState((function(e){return{expanded:!e.expanded}})),e.preventDefault()}},{key:"isSelected",value:function(){return this.props.isSelected(this.node)}},{key:"render",value:function(){var t=this;this.node=this.props.node;var o=this.getColspan(),r=n("p-organizationchart-node-content",this.node.className,{"p-organizationchart-selectable-node":this.props.selectionMode&&!1!==this.node.selectable,"p-highlight":this.isSelected()}),l=this.props.nodeTemplate&&this.props.nodeTemplate(this.node)?e.createElement("div",null,this.props.nodeTemplate(this.node)):e.createElement("div",null,this.node.label),s=n("p-node-toggler-icon",{"pi pi-chevron-down":this.state.expanded,"pi pi-chevron-up":!this.state.expanded}),a=e.createElement("tr",null,e.createElement("td",{colSpan:o},e.createElement("div",{className:r,onClick:function(e){return t.onNodeCli
|