katoikia-app/web-ui/web-react/node_modules/primereact/organizationchart/organizationchart.cjs.min.js

2 lines
8.2 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/utils");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(e);function r(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 i(e){if(Array.isArray(e))return r(e)}function l(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function a(e,t){if(e){if("string"==typeof e)return r(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)?r(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 c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(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 u(e,t,n){return t&&p(e.prototype,t),n&&p(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function f(e,t){return f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},f(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&&f(e,t)}function m(e){return m="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},m(e)}function y(e,t){if(t&&("object"===m(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return c(e)}function v(e){return v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},v(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 b(e){var t=N();return function(){var n,o=v(e);if(t){var r=v(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return y(this,n)}}function N(){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 S=function(n){h(i,e.Component);var r=b(i);function i(e){var t;return d(this,i),(t=r.call(this,e)).node=t.props.node,t.state={expanded:t.node.expanded},t}return u(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 e=this;this.node=this.props.node;var n=this.getColspan(),r=t.classNames("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)?o.default.createElement("div",null,this.props.nodeTemplate(this.node)):o.default.createElement("div",null,this.node.label),a=t.classNames("p-node-toggler-icon",{"pi pi-chevron-down":this.state.expanded,"pi pi-chevron-up":!this.state.expanded}),s=o.default.createElement("tr",null,o.default.createElement("td",{colSpan:n},o.default.createElement("div",{className:r,onClick:function(t){return e.onNodeClick(t,e.node)}},l,!this.getLeaf()&&o.default.createElement("a",{href:"#",className:"p-node-toggler",onClick:function(t){return e.toggleNode(t,e.node)}},o.default.createElement("i",{className:a}))))),c=!this.getLeaf()&&this.state.expanded?"inherit":"hidden",d=o.default.createElement("tr",{style:{visibility:c},className:"p-organizationchart-lines"},o.default.createElement("td",{colSpan:n},o.default.createElement("div",{className:"p-organizationchart-line-down"}))),p=this.node.children&&this.node.children.length,u=o.default.createElement("tr",{style:{visibility:c},className:"p-organizationchart-lines"},this.node.children&&1===this.node.children.length&&o.default.createElement("td",{colSpan:this.getColspan()},o.default.createElement("div",{className:"p-organizationchart-line-down"})),this.node.children&&this.node.children.length>1&&this.node.children.map((function(e,n){var r=t.classNames("p-organizationchart-line-left",{"p-organizationchart-line-top":0!==n}),i=t.classNames("p-organizationchart-line-right",{"p-organizationchart-line-top":n!==p-1});return[o.default.createElement("td",{key:n+"_lineleft",className:r}," "),o.default.createElement("td",{key:n+"_lineright",className:i}," ")]}))),f=o.default.createElement("tr",{style:{visibility:c},className:"p-organizationchart-nodes"},this.node.children&&this.node.children.map((function(t,n){return o.default.createElement("td",{key:n,colSpan:"2"},o.default.createElement(i,{node:t,nodeTemplate:e.props.nodeTemplate,selectionMode:e.props.selectionMode,onNodeClick:e.props.onNodeClick,isSelected:e.props.isSelected}))})));return o.default.createElement("table",{className:"p-organizationchart-table"},o.default.createElement("tbody",null,s,d,u,f))}}]),i}();g(S,"defaultProps",{node:null,nodeTemplate:null,root:!1,first:!1,last:!1,selectionMode:null,onNodeClick:null,isSelected:null});var E=function(n){h(p,e.Component);var r=b(p);function p(e){var t;return d(this,p),(t=r.call(this,e)).root=t.props.value&&t.props.value.length?t.props.value[0]:null,t.onNodeClick=t.onNodeClick.bind(c(t)),t.isSelected=t.isSelected.bind(c(t)),t}return u(p,[{key:"onNodeClick",value:function(e,t){if(this.props.selectionMode){var n=e.target;if(n.className&&(-1!==n.className.indexOf("p-node-toggler")||-1!==n.className.indexOf("p-node-toggler-icon")))return;if(!1===t.selectable)return;var o,r=this.findIndexInSelection(t),c=r>=0;"single"===this.props.selectionMode?c?(o=null,this.props.onNodeUnselect&&this.props.onNodeUnselect({originalEvent:e,node:t})):(o=t,this.props.onNodeSelect&&this.props.onNodeSelect({originalEvent:e,node:t})):"multiple"===this.props.selectionMode&&(c?(o=this.props.selection.filter((function(e,t){return t!==r})),this.props.onNodeUnselect&&this.props.onNodeUnselect({originalEvent:e,node:t})):(o=[].concat(i(d=this.props.selection||[])||l(d)||a(d)||s(),[t]),this.props.onNodeSelect&&this.props.onNodeSelect({originalEvent:e,node:t}))),this.props.onSelectionChange&&this.props.onSelectionChange({originalEvent:e,data:o})}var d}},{key:"findIndexInSelection",value:function(e){var t=-1;if(this.props.selectionMode&&this.props.selection)if("single"===this.props.selectionMode)t=this.props.selection===e?0:-1;else if("multiple"===this.props.selectionMode)for(var n=0;n<this.props.selection.length;n++)if(this.props.selection[n]===e){t=n;break}return t}},{key:"isSelected",value:function(e){return-1!==this.findIndexInSelection(e)}},{key:"render",value:function(){this.root=this.props.value&&this.props.value.length?this.props.value[0]:null;var e=t.classNames("p-organizationchart p-component",this.props.className);return o.default.createElement("div",{id:this.props.id,style:this.props.style,className:e},o.default.createElement(S,{node:this.root,nodeTemplate:this.props.nodeTemplate,selectionMode:this.props.selectionMode,onNodeClick:this.onNodeClick,isSelected:this.isSelected}))}}]),p}();g(E,"defaultProps",{id:null,value:null,style:null,className:null,selectionMode:null,selection:null,nodeTemplate:null,onSelectionChange:null,onNodeSelect:null,onNodeUnselect:null}),exports.OrganizationChart=E,exports.OrganizationChartNode=S;