From 9b2f4e1412318054f096c74ae28c61b0657ad75b Mon Sep 17 00:00:00 2001 From: Cheton Wu Date: Sat, 16 Apr 2016 14:00:32 +0800 Subject: [PATCH 01/17] Update examples --- examples/classic/index.styl | 34 ++++++++++++++------------------ examples/classic/renderer.js | 16 +++++++-------- examples/filebrowser/index.js | 2 +- examples/filebrowser/index.styl | 31 +++++++++++++---------------- examples/filebrowser/renderer.js | 16 +++++++-------- 5 files changed, 46 insertions(+), 53 deletions(-) diff --git a/examples/classic/index.styl b/examples/classic/index.styl index 6e4ea85..0850b15 100644 --- a/examples/classic/index.styl +++ b/examples/classic/index.styl @@ -23,30 +23,26 @@ font-size: 16px; line-height: 42px; } - [data-id="tree"] { - border: 1px solid #ccc; - background-color: #fff; - } - .tree { border: 1px solid #ccc; background-color: #fff; } - .tree-toggler { + + .infinite-tree-toggler { text-align: center; margin-right: 5px; } - .tree-folder-icon { + .infinite-tree-folder-icon { width: 19px; } - .tree-folder-icon:first-child { + .infinite-tree-folder-icon:first-child { margin-left: 20px; } - .tree-folder-icon:before { + .infinite-tree-folder-icon:before { margin-right: 5px; } - .tree-node .count { + .infinite-tree-node .count { position: absolute; right: 4px; padding: 0 8px; @@ -74,34 +70,34 @@ // Outline removes default browser's borders for focused element. outline: 0; - .tree-selected.tree-item, - .tree-selected.tree-item:hover { + .infinite-tree-selected.infinite-tree-item, + .infinite-tree-selected.infinite-tree-item:hover { background: #deecfd; border: 1px solid #0066cc; } - .tree-item { + .infinite-tree-item { border: 1px solid transparent; cursor: default; } - .tree-item:hover { + .infinite-tree-item:hover { background: #f2fdff; } - .tree-item.dragover { + .infinite-tree-item.dragover { border: 1px dotted #ccc; background-color: #f5f6f7; } - .tree-node { + .infinite-tree-node { position: relative; } - .tree-toggler { + .infinite-tree-toggler { color: #666; user-select: none; } - .tree-toggler:hover { + .infinite-tree-toggler:hover { color: #333; text-decoration: none; } - .tree-title { + .infinite-tree-title { cursor: pointer; user-select: none; } diff --git a/examples/classic/renderer.js b/examples/classic/renderer.js index 4348f2b..6f07147 100644 --- a/examples/classic/renderer.js +++ b/examples/classic/renderer.js @@ -26,13 +26,13 @@ const renderer = (node, treeOptions) => { const toggler = buildHTML('a', togglerContent, { 'class': (() => { if (!more && loadOnDemand) { - return classNames('tree-toggler', 'tree-closed'); + return classNames(treeOptions.togglerClass, 'infinite-tree-closed'); } if (more && open) { - return classNames('tree-toggler'); + return classNames(treeOptions.togglerClass); } if (more && !open) { - return classNames('tree-toggler', 'tree-closed'); + return classNames(treeOptions.togglerClass, 'infinite-tree-closed'); } return ''; })() @@ -40,7 +40,7 @@ const renderer = (node, treeOptions) => { const icon = buildHTML('i', '', { 'class': classNames( - 'tree-folder-icon', + 'infinite-tree-folder-icon', 'glyphicon', { 'glyphicon-folder-open': more && open }, { 'glyphicon-folder-close': more && !open }, @@ -48,7 +48,7 @@ const renderer = (node, treeOptions) => { ) }); const title = buildHTML('span', quoteattr(name), { - 'class': classNames('tree-title') + 'class': classNames('infinite-tree-title') }); const loadingIcon = buildHTML('i', '', { 'style': 'margin-left: 5px', @@ -63,7 +63,7 @@ const renderer = (node, treeOptions) => { 'class': 'count' }); const treeNode = buildHTML('div', toggler + icon + title + loadingIcon + count, { - 'class': 'tree-node', + 'class': 'infinite-tree-node', 'style': 'margin-left: ' + depth * 18 + 'px' }); @@ -76,8 +76,8 @@ const renderer = (node, treeOptions) => { 'aria-children': childrenLength, 'aria-total': total, 'class': classNames( - 'tree-item', - { 'tree-selected': selected } + 'infinite-tree-item', + { 'infinite-tree-selected': selected } ) }; if (droppable) { diff --git a/examples/filebrowser/index.js b/examples/filebrowser/index.js index 6da254d..7a46f28 100644 --- a/examples/filebrowser/index.js +++ b/examples/filebrowser/index.js @@ -7,7 +7,7 @@ import data from './data'; // Makes header columns equal width to content columns const fitHeaderColumns = () => { - const row = document.querySelector('#filebrowser .infinite-tree-content tr.tree-item'); + const row = document.querySelector('#filebrowser .infinite-tree-content tr.infinite-tree-item'); const headers = document.querySelectorAll('#filebrowser table.filebrowser-header > thead > tr > th'); for (let c = row.firstChild, i = 0; c !== null && i < headers.length; c = c.nextSibling, ++i) { headers[i].style.width = c.clientWidth + 'px'; diff --git a/examples/filebrowser/index.styl b/examples/filebrowser/index.styl index 378bda2..1c9e365 100644 --- a/examples/filebrowser/index.styl +++ b/examples/filebrowser/index.styl @@ -2,10 +2,6 @@ #filebrowser { - [data-id="tree"] { - border: 1px solid #ccc; - background-color: #fff; - } .nowrap { white-space: nowrap; } @@ -17,17 +13,18 @@ border: 1px solid #ccc; background-color: #fff; } - .tree-toggler { + + .infinite-tree-toggler { text-align: center; margin-right: 5px; } - .tree-folder-icon { + .infinite-tree-folder-icon { width: 19px; } - .tree-folder-icon:first-child { + .infinite-tree-folder-icon:first-child { margin-left: 20px; } - .tree-folder-icon:before { + .infinite-tree-folder-icon:before { margin-right: 5px; } @@ -48,34 +45,34 @@ // Outline removes default browser's borders for focused element. outline: 0; - .tree-selected.tree-item, - .tree-selected.tree-item:hover { + .infinite-tree-selected.infinite-tree-item, + .infinite-tree-selected.infinite-tree-item:hover { background: #deecfd; //border: 1px solid #0066cc; } - .tree-item { + .infinite-tree-item { border: 1px solid transparent; cursor: default; } - .tree-item:hover { + .infinite-tree-item:hover { background: #f2fdff; } - .tree-item.dragover { + .infinite-tree-item.dragover { border: 1px dotted #ccc; background-color: #f5f6f7; } - .tree-node { + .infinite-tree-node { position: relative; } - .tree-toggler { + .infinite-tree-toggler { color: #666; user-select: none; } - .tree-toggler:hover { + .infinite-tree-toggler:hover { color: #333; text-decoration: none; } - .tree-title { + .infinite-tree-title { cursor: pointer; user-select: none; } diff --git a/examples/filebrowser/renderer.js b/examples/filebrowser/renderer.js index f4f2884..0933c9b 100644 --- a/examples/filebrowser/renderer.js +++ b/examples/filebrowser/renderer.js @@ -25,13 +25,13 @@ const renderer = (node, treeOptions) => { const toggler = buildHTML('a', togglerContent, { 'class': (() => { if (!more && loadOnDemand) { - return classNames('tree-toggler', 'tree-closed'); + return classNames(treeOptions.togglerClass, 'infinite-tree-closed'); } if (more && open) { - return classNames('tree-toggler'); + return classNames(treeOptions.togglerClass); } if (more && !open) { - return classNames('tree-toggler', 'tree-closed'); + return classNames(treeOptions.togglerClass, 'infinite-tree-closed'); } return ''; })() @@ -39,7 +39,7 @@ const renderer = (node, treeOptions) => { const icon = buildHTML('i', '', { 'class': classNames( - 'tree-folder-icon', + 'infinite-tree-folder-icon', 'glyphicon', { 'glyphicon-folder-open': more && open }, { 'glyphicon-folder-close': more && !open }, @@ -47,7 +47,7 @@ const renderer = (node, treeOptions) => { ) }); const title = buildHTML('span', quoteattr(name), { - 'class': classNames('tree-title') + 'class': classNames('infinite-tree-title') }); const loadingIcon = buildHTML('i', '', { 'style': 'margin-left: 5px', @@ -60,7 +60,7 @@ const renderer = (node, treeOptions) => { }); const columnName = buildHTML('td', toggler + icon + title + loadingIcon, { - 'class': 'tree-node nowrap', + 'class': 'infinite-tree-node nowrap', 'style': 'padding-left: ' + depth * 18 + 'px' }); const columnSize = buildHTML('td', typeof props.size !== undefined ? props.size : '', { @@ -88,8 +88,8 @@ const renderer = (node, treeOptions) => { 'aria-children': childrenLength, 'aria-total': total, 'class': classNames( - 'tree-item', - { 'tree-selected': selected } + 'infinite-tree-item', + { 'infinite-tree-selected': selected } ) }); }; From e05ac3640dbb09bee1df0e51b6f7be0ccd9d557e Mon Sep 17 00:00:00 2001 From: Cheton Wu Date: Sat, 16 Apr 2016 14:04:10 +0800 Subject: [PATCH 02/17] Consistent class naming --- src/index.styl | 18 +++++++++--------- src/infinite-tree.js | 18 ++++++++++-------- src/renderer.js | 14 +++++++------- 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/src/index.styl b/src/index.styl index 83f60e3..23af854 100644 --- a/src/index.styl +++ b/src/index.styl @@ -13,34 +13,34 @@ // Outline removes default browser's borders for focused element. outline: 0; - .tree-selected.tree-item, - .tree-selected.tree-item:hover { + .infinite-tree-selected.infinite-tree-item, + .infinite-tree-selected.infinite-tree-item:hover { background: #deecfd; border: 1px solid #0066cc; } - .tree-item { + .infinite-tree-item { border: 1px solid transparent; cursor: default; } - .tree-item:hover { + .infinite-tree-item:hover { background: #f2fdff; } - .tree-item.dragover { + .infinite-tree-item.infinite-tree-dragover { border: 1px dotted #ccc; background-color: #f5f6f7; } - .tree-node { + .infinite-tree-node { position: relative; } - .tree-toggler { + .infinite-tree-toggler { color: #666; user-select: none; } - .tree-toggler:hover { + .infinite-tree-toggler:hover { color: #333; text-decoration: none; } - .tree-title { + .infinite-tree-title { cursor: pointer; user-select: none; } diff --git a/src/infinite-tree.js b/src/infinite-tree.js index 352b4c5..dd04419 100644 --- a/src/infinite-tree.js +++ b/src/infinite-tree.js @@ -11,6 +11,7 @@ import { removeEventListener, classNames, addClass, + hasClass, removeClass, isDOMElement } from './helper'; @@ -36,7 +37,7 @@ const ensureNodeInstance = (node) => { class InfiniteTree extends events.EventEmitter { options = { autoOpen: false, - dragoverClass: 'dragover', + dragoverClass: 'infinite-tree-dragover', droppable: false, el: null, layout: 'div', @@ -45,7 +46,8 @@ class InfiniteTree extends events.EventEmitter { noDataText: 'No data', rowRenderer: defaultRowRenderer, selectable: true, - shouldSelectNode: null + shouldSelectNode: null, + togglerClass: 'infinite-tree-toggler' }; state = { openNodes: [], @@ -63,7 +65,7 @@ class InfiniteTree extends events.EventEmitter { contentListener = { 'click': (e) => { let itemTarget = null; - let handleToggler = false; + let clickToggler = false; stopPropagation(e); @@ -74,8 +76,8 @@ class InfiniteTree extends events.EventEmitter { } while (itemTarget && itemTarget.parentElement !== this.contentElement) { - if (itemTarget.className.indexOf('tree-toggler') >= 0) { - handleToggler = true; + if (hasClass(itemTarget, this.options.togglerClass)) { + clickToggler = true; } itemTarget = itemTarget.parentElement; } @@ -92,7 +94,7 @@ class InfiniteTree extends events.EventEmitter { } // Click on the toggler to open/close a tree node - if (handleToggler) { + if (clickToggler) { this.toggleNode(node); return; } @@ -855,8 +857,8 @@ class InfiniteTree extends events.EventEmitter { if (!this.contentElement) { return false; } - // Get the offset height of the first child element that contains the "tree-item" class - const firstChild = this.contentElement.querySelectorAll('.tree-item')[0]; + // Get the offset height of the first child + const firstChild = this.contentElement.firstChild; const rowHeight = (firstChild && firstChild.offsetHeight) || 0; this.scrollTop(nodeIndex * rowHeight); diff --git a/src/renderer.js b/src/renderer.js index a797f4b..6d9c3a6 100644 --- a/src/renderer.js +++ b/src/renderer.js @@ -19,22 +19,22 @@ const defaultRowRenderer = (node, treeOptions) => { const toggler = buildHTML('a', togglerContent, { 'class': (() => { if (more && open) { - return classNames('tree-toggler'); + return classNames('infinite-tree-toggler'); } if (more && !open) { - return classNames('tree-toggler', 'tree-closed'); + return classNames('infinite-tree-toggler', 'infinite-tree-closed'); } if (!more && loadOnDemand) { - return classNames('tree-toggler', 'tree-closed'); + return classNames('infinite-tree-toggler', 'infinite-tree-closed'); } return ''; })() }); const title = buildHTML('span', quoteattr(name), { - 'class': classNames('tree-title') + 'class': classNames('infinite-tree-title') }); const treeNode = buildHTML('div', toggler + title, { - 'class': 'tree-node', + 'class': 'infinite-tree-node', 'style': 'margin-left: ' + depth * 18 + 'px' }); @@ -47,8 +47,8 @@ const defaultRowRenderer = (node, treeOptions) => { 'aria-children': childrenLength, 'aria-total': total, 'class': classNames( - 'tree-item', - { 'tree-selected': selected } + 'infinite-tree-item', + { 'infinite-tree-selected': selected } ), 'droppable': true }); From 7ea0b4ce1ae6dd02affd7554e861bac7632991d6 Mon Sep 17 00:00:00 2001 From: Cheton Wu Date: Sat, 16 Apr 2016 14:04:25 +0800 Subject: [PATCH 03/17] Consistent class namings --- dist/infinite-tree.css | 18 +++++++++--------- dist/infinite-tree.js | 29 +++++++++++++++-------------- dist/infinite-tree.min.js | 4 ++-- 3 files changed, 26 insertions(+), 25 deletions(-) diff --git a/dist/infinite-tree.css b/dist/infinite-tree.css index 6462b98..bd1a7f0 100644 --- a/dist/infinite-tree.css +++ b/dist/infinite-tree.css @@ -8,37 +8,37 @@ .infinite-tree-content { outline: 0; } -.infinite-tree-content .tree-selected.tree-item, -.infinite-tree-content .tree-selected.tree-item:hover { +.infinite-tree-content .infinite-tree-selected.infinite-tree-item, +.infinite-tree-content .infinite-tree-selected.infinite-tree-item:hover { background: #deecfd; border: 1px solid #06c; } -.infinite-tree-content .tree-item { +.infinite-tree-content .infinite-tree-item { border: 1px solid transparent; cursor: default; } -.infinite-tree-content .tree-item:hover { +.infinite-tree-content .infinite-tree-item:hover { background: #f2fdff; } -.infinite-tree-content .tree-item.dragover { +.infinite-tree-content .infinite-tree-item.infinite-tree-dragover { border: 1px dotted #ccc; background-color: #f5f6f7; } -.infinite-tree-content .tree-node { +.infinite-tree-content .infinite-tree-node { position: relative; } -.infinite-tree-content .tree-toggler { +.infinite-tree-content .infinite-tree-toggler { color: #666; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } -.infinite-tree-content .tree-toggler:hover { +.infinite-tree-content .infinite-tree-toggler:hover { color: #333; text-decoration: none; } -.infinite-tree-content .tree-title { +.infinite-tree-content .infinite-tree-title { cursor: pointer; -webkit-user-select: none; -moz-user-select: none; diff --git a/dist/infinite-tree.js b/dist/infinite-tree.js index 777f3ba..031fa89 100644 --- a/dist/infinite-tree.js +++ b/dist/infinite-tree.js @@ -136,7 +136,7 @@ return /******/ (function(modules) { // webpackBootstrap _this.options = { autoOpen: false, - dragoverClass: 'dragover', + dragoverClass: 'infinite-tree-dragover', droppable: false, el: null, layout: 'div', @@ -145,7 +145,8 @@ return /******/ (function(modules) { // webpackBootstrap noDataText: 'No data', rowRenderer: _renderer.defaultRowRenderer, selectable: true, - shouldSelectNode: null + shouldSelectNode: null, + togglerClass: 'infinite-tree-toggler' }; _this.state = { openNodes: [], @@ -162,7 +163,7 @@ return /******/ (function(modules) { // webpackBootstrap _this.contentListener = { 'click': function click(e) { var itemTarget = null; - var handleToggler = false; + var clickToggler = false; (0, _helper.stopPropagation)(e); @@ -174,8 +175,8 @@ return /******/ (function(modules) { // webpackBootstrap } while (itemTarget && itemTarget.parentElement !== _this.contentElement) { - if (itemTarget.className.indexOf('tree-toggler') >= 0) { - handleToggler = true; + if ((0, _helper.hasClass)(itemTarget, _this.options.togglerClass)) { + clickToggler = true; } itemTarget = itemTarget.parentElement; } @@ -192,7 +193,7 @@ return /******/ (function(modules) { // webpackBootstrap } // Click on the toggler to open/close a tree node - if (handleToggler) { + if (clickToggler) { _this.toggleNode(node); return; } @@ -1016,8 +1017,8 @@ return /******/ (function(modules) { // webpackBootstrap if (!this.contentElement) { return false; } - // Get the offset height of the first child element that contains the "tree-item" class - var firstChild = this.contentElement.querySelectorAll('.tree-item')[0]; + // Get the offset height of the first child + var firstChild = this.contentElement.firstChild; var rowHeight = firstChild && firstChild.offsetHeight || 0; this.scrollTop(nodeIndex * rowHeight); @@ -2346,22 +2347,22 @@ return /******/ (function(modules) { // webpackBootstrap var toggler = (0, _helper.buildHTML)('a', togglerContent, { 'class': function () { if (more && open) { - return (0, _helper.classNames)('tree-toggler'); + return (0, _helper.classNames)('infinite-tree-toggler'); } if (more && !open) { - return (0, _helper.classNames)('tree-toggler', 'tree-closed'); + return (0, _helper.classNames)('infinite-tree-toggler', 'infinite-tree-closed'); } if (!more && loadOnDemand) { - return (0, _helper.classNames)('tree-toggler', 'tree-closed'); + return (0, _helper.classNames)('infinite-tree-toggler', 'infinite-tree-closed'); } return ''; }() }); var title = (0, _helper.buildHTML)('span', (0, _helper.quoteattr)(name), { - 'class': (0, _helper.classNames)('tree-title') + 'class': (0, _helper.classNames)('infinite-tree-title') }); var treeNode = (0, _helper.buildHTML)('div', toggler + title, { - 'class': 'tree-node', + 'class': 'infinite-tree-node', 'style': 'margin-left: ' + depth * 18 + 'px' }); @@ -2373,7 +2374,7 @@ return /******/ (function(modules) { // webpackBootstrap 'aria-selected': selected, 'aria-children': childrenLength, 'aria-total': total, - 'class': (0, _helper.classNames)('tree-item', { 'tree-selected': selected }), + 'class': (0, _helper.classNames)('infinite-tree-item', { 'infinite-tree-selected': selected }), 'droppable': true }); }; diff --git a/dist/infinite-tree.min.js b/dist/infinite-tree.min.js index 49b0267..b82d425 100644 --- a/dist/infinite-tree.min.js +++ b/dist/infinite-tree.min.js @@ -1,3 +1,3 @@ /*! infinite-tree v0.9.0 | (c) 2016 Cheton Wu | MIT | https://github.com/cheton/infinite-tree */ -!function(root,factory){"object"==typeof exports&&"object"==typeof module?module.exports=factory():"function"==typeof define&&define.amd?define([],factory):"object"==typeof exports?exports.InfiniteTree=factory():root.InfiniteTree=factory()}(this,function(){return function(modules){function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={exports:{},id:moduleId,loaded:!1};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.loaded=!0,module.exports}var installedModules={};return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.p="",__webpack_require__(0)}([function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}var _infiniteTree=__webpack_require__(1),_infiniteTree2=_interopRequireDefault(_infiniteTree);module.exports=_infiniteTree2["default"]},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol?"symbol":typeof obj},_events=__webpack_require__(2),_events2=_interopRequireDefault(_events),_clusterize=__webpack_require__(3),_clusterize2=_interopRequireDefault(_clusterize),_flattree=__webpack_require__(4),_lookupTable=__webpack_require__(8),_lookupTable2=_interopRequireDefault(_lookupTable),_renderer=__webpack_require__(9),_helper=__webpack_require__(10),error=function(){for(var _len=arguments.length,args=Array(_len),_key=0;_len>_key;_key++)args[_key]=arguments[_key];if(console&&console.error){var prefix="[InfiniteTree]";console.error.apply(console,[prefix].concat(args))}},ensureNodeInstance=function(node){return node?node instanceof _flattree.Node?!0:(error("The node must be a Node object."),!1):!1},InfiniteTree=function(_events$EventEmitter){function InfiniteTree(el,options){_classCallCheck(this,InfiniteTree);var _this=_possibleConstructorReturn(this,_events$EventEmitter.call(this));return _this.options={autoOpen:!1,dragoverClass:"dragover",droppable:!1,el:null,layout:"div",loadNodes:null,noDataClass:"infinite-tree-no-data",noDataText:"No data",rowRenderer:_renderer.defaultRowRenderer,selectable:!0,shouldSelectNode:null},_this.state={openNodes:[],rootNode:null,selectedNode:null},_this.clusterize=null,_this.nodeTable=new _lookupTable2["default"],_this.nodes=[],_this.rows=[],_this.scrollElement=null,_this.contentElement=null,_this.dragoverElement=null,_this.contentListener={click:function(e){var itemTarget=null,handleToggler=!1;for((0,_helper.stopPropagation)(e),e.target&&e.currentTarget?itemTarget=e.target!==e.currentTarget?e.target:null:e.srcElement&&(itemTarget=e.srcElement);itemTarget&&itemTarget.parentElement!==_this.contentElement;)itemTarget.className.indexOf("tree-toggler")>=0&&(handleToggler=!0),itemTarget=itemTarget.parentElement;if(itemTarget){var id=itemTarget.getAttribute("aria-id"),node=_this.getNodeById(id);if(node)return handleToggler?void _this.toggleNode(node):void _this.selectNode(node)}},dragenter:function(e){var itemTarget=null;for(e.target&&e.currentTarget?itemTarget=e.target!==e.currentTarget?e.target:null:e.srcElement&&(itemTarget=e.srcElement);itemTarget&&itemTarget.parentElement!==_this.contentElement;)itemTarget=itemTarget.parentElement;if(itemTarget&&_this.dragoverElement!==itemTarget){if((0,_helper.removeClass)(_this.dragoverElement,_this.options.dragoverClass),_this.dragoverElement=null,!itemTarget.hasAttribute("droppable"))return;var canDrop=!itemTarget.getAttribute("droppable").match(/false/i);canDrop&&((0,_helper.addClass)(itemTarget,_this.options.dragoverClass),_this.dragoverElement=itemTarget)}},dragend:function(e){_this.dragoverElement&&((0,_helper.removeClass)(_this.dragoverElement,_this.options.dragoverClass),_this.dragoverElement=null)},dragover:function(e){return(0,_helper.preventDefault)(e),e.dataTransfer.dropEffect="move",!1},drop:function(e){if((0,_helper.preventDefault)(e),_this.dragoverElement){var id=_this.dragoverElement.getAttribute("aria-id"),node=_this.getNodeById(id);(0,_helper.removeClass)(_this.dragoverElement,_this.options.dragoverClass),_this.dragoverElement=null,_this.emit("dropNode",node,e)}}},(0,_helper.isDOMElement)(el)?options.el=el:options=el,_this.options=(0,_helper.extend)({},_this.options,options),_this.options.el?(_this.create(),options.data&&_this.loadData(options.data),_this):(console.error("Failed to initialize infinite-tree: el is not specified.",options),_possibleConstructorReturn(_this))}return _inherits(InfiniteTree,_events$EventEmitter),InfiniteTree.prototype.create=function(){this.options.el||error("The element option is not specified.");var tag=null;if(this.scrollElement=document.createElement("div"),"table"===this.options.layout){var tableElement=document.createElement("table");tableElement.className=(0,_helper.classNames)("infinite-tree","infinite-tree-table");var contentElement=document.createElement("tbody");tableElement.appendChild(contentElement),this.scrollElement.appendChild(tableElement),this.contentElement=contentElement,tag="tr"}else{var _contentElement=document.createElement("div");this.scrollElement.appendChild(_contentElement),this.contentElement=_contentElement,tag="div"}this.scrollElement.className=(0,_helper.classNames)("infinite-tree","infinite-tree-scroll"),this.contentElement.className=(0,_helper.classNames)("infinite-tree","infinite-tree-content"),this.options.el.appendChild(this.scrollElement),this.clusterize=new _clusterize2["default"]({tag:tag,rows:[],scrollElem:this.scrollElement,contentElem:this.contentElement,no_data_text:this.options.noDataText,no_data_class:this.options.noDataClass}),(0,_helper.addEventListener)(this.contentElement,"click",this.contentListener.click),this.options.droppable&&((0,_helper.addEventListener)(document,"dragend",this.contentListener.dragend),(0,_helper.addEventListener)(this.contentElement,"dragenter",this.contentListener.dragenter),(0,_helper.addEventListener)(this.contentElement,"dragover",this.contentListener.dragover),(0,_helper.addEventListener)(this.contentElement,"drop",this.contentListener.drop))},InfiniteTree.prototype.destroy=function(){for((0,_helper.removeEventListener)(this.contentElement,"click",this.contentListener),this.options.droppable&&((0,_helper.removeEventListener)(document,"dragend",this.contentListener.dragend),(0,_helper.removeEventListener)(this.contentElement,"dragenter",this.contentListener.dragenter),(0,_helper.removeEventListener)(this.contentElement,"dragover",this.contentListener.dragover),(0,_helper.removeEventListener)(this.contentElement,"drop",this.contentListener.drop)),this.clear(),this.clusterize&&(this.clusterize.destroy(!0),this.clusterize=null);this.contentElement.firstChild;)this.contentElement.removeChild(this.contentElement.firstChild);for(;this.scrollElement.firstChild;)this.scrollElement.removeChild(this.scrollElement.firstChild);if(this.options.el)for(var containerElement=this.options.el;containerElement.firstChild;)containerElement.removeChild(containerElement.firstChild);this.contentElement=null,this.scrollElement=null},InfiniteTree.prototype.addChildNodes=function(newNodes,index,parentNode){var _this2=this;if(newNodes=[].concat(newNodes||[]),0===newNodes.length)return!1;if("object"===("undefined"==typeof index?"undefined":_typeof(index))?(parentNode=index||this.state.rootNode,index=parentNode.children.length):parentNode=parentNode||this.state.rootNode,!ensureNodeInstance(parentNode))return!1;newNodes.forEach(function(newNode){newNode.parent=parentNode}),parentNode.children.splice.apply(parentNode.children,[index,0].concat(newNodes)),index=parentNode.children.indexOf(newNodes[0]);var deleteCount=parentNode.state.total,nodes=(0,_flattree.flatten)(parentNode.children,{openNodes:this.state.openNodes}),rows=nodes.map(function(node){return _this2.options.rowRenderer(node,_this2.options)});if(parentNode===this.state.rootNode)this.nodes=nodes,this.rows=rows;else{var parentOffset=this.nodes.indexOf(parentNode);parentOffset>=0&&(this.nodes.splice.apply(this.nodes,[parentOffset+1,deleteCount].concat(nodes)),this.rows.splice.apply(this.rows,[parentOffset+1,deleteCount].concat(rows)),this.rows[parentOffset]=this.options.rowRenderer(parentNode,this.options))}return parentNode.children.slice(index).forEach(function(childNode){_this2.flattenNode(childNode).forEach(function(node){void 0!==node.id&&_this2.nodeTable.set(node.id,node)})}),this.update(),!0},InfiniteTree.prototype.appendChildNode=function(newNode,parentNode){if(parentNode=parentNode||this.state.rootNode,!ensureNodeInstance(parentNode))return!1;var index=parentNode.children.length,newNodes=[].concat(newNode||[]);return this.addChildNodes(newNodes,index,parentNode)},InfiniteTree.prototype.clear=function(){this.clusterize.clear(),this.nodeTable.clear(),this.nodes=[],this.rows=[],this.state.openNodes=[],this.state.rootNode=null,this.state.selectedNode=null},InfiniteTree.prototype.closeNode=function(node){if(!ensureNodeInstance(node))return!1;var nodeIndex=this.nodes.indexOf(node);if(0>nodeIndex)return error("Invalid node index"),!1;if(this.state.openNodes.indexOf(node)<0)return!1;if(this.state.selectedNode&&this.state.selectedNode!==node){var selectedIndex=this.nodes.indexOf(this.state.selectedNode),rangeFrom=nodeIndex+1,rangeTo=nodeIndex+node.state.total;selectedIndex>=rangeFrom&&rangeTo>=selectedIndex&&this.selectNode(node)}node.state.open=!1;var openNodes=this.state.openNodes.filter(function(node){return node.hasChildren()&&node.state.open});this.state.openNodes=openNodes;for(var deleteCount=node.state.total,p=node;null!==p;p=p.parent)p.state.total=p.state.total-deleteCount;return this.nodes.splice(nodeIndex+1,deleteCount),this.rows.splice(nodeIndex+1,deleteCount),this.rows[nodeIndex]=this.options.rowRenderer(node,this.options),this.emit("closeNode",node),this.update(),!0},InfiniteTree.prototype.flattenChildNodes=function(parentNode){if(parentNode=parentNode||this.state.rootNode,!ensureNodeInstance(parentNode))return[];for(var list=[],node=parentNode.getFirstChild();node;)if(list.push(node),node.hasChildren())node=node.getFirstChild();else{for(;null===node.getNextSibling()&&node.parent!==parentNode;)node=node.getParent();node=node.getNextSibling()}return list},InfiniteTree.prototype.flattenNode=function(node){return[node].concat(this.flattenChildNodes(node))},InfiniteTree.prototype.getChildNodes=function(parentNode){return parentNode=parentNode||this.state.rootNode,ensureNodeInstance(parentNode)?parentNode.children:[]},InfiniteTree.prototype.getNodeById=function(id){var node=this.nodeTable.get(id);if(!node){if(node=this.nodes.filter(function(node){return node.id===id})[0],!node)return null;this.nodeTable.set(node.id,node)}return node},InfiniteTree.prototype.getOpenNodes=function(){return this.state.openNodes.slice()},InfiniteTree.prototype.getRootNode=function(){return this.state.rootNode},InfiniteTree.prototype.getSelectedNode=function(){return this.state.selectedNode},InfiniteTree.prototype.insertNodeAfter=function(newNode,referenceNode){if(!ensureNodeInstance(referenceNode))return!1;var parentNode=referenceNode.getParent(),index=parentNode.children.indexOf(referenceNode)+1,newNodes=[].concat(newNode||[]);return this.addChildNodes(newNodes,index,parentNode)},InfiniteTree.prototype.insertNodeBefore=function(newNode,referenceNode){if(!ensureNodeInstance(referenceNode))return!1;var parentNode=referenceNode.getParent(),index=parentNode.children.indexOf(referenceNode),newNodes=[].concat(newNode||[]);return this.addChildNodes(newNodes,index,parentNode)},InfiniteTree.prototype.loadData=function(){var _this3=this,data=arguments.length<=0||void 0===arguments[0]?[]:arguments[0];this.nodes=(0,_flattree.flatten)(data,{openAllNodes:this.options.autoOpen}),this.nodeTable.clear(),this.state.openNodes=this.nodes.filter(function(node){return node.hasChildren()&&node.state.open}),this.state.rootNode=function(){for(var node=arguments.length<=0||void 0===arguments[0]?null:arguments[0];node&&null!==node.parent;)node=node.parent;return node}(this.nodes.length>0?this.nodes[0]:null),this.state.selectedNode=null,this.state.rootNode&&this.flattenChildNodes(this.state.rootNode).forEach(function(node){void 0!==node.id&&_this3.nodeTable.set(node.id,node)}),this.rows=this.nodes.map(function(node){return _this3.options.rowRenderer(node,_this3.options)}),this.update()},InfiniteTree.prototype.openNode=function(node){var _this4=this;if(!ensureNodeInstance(node))return!1;var nodeIndex=this.nodes.indexOf(node);if(0>nodeIndex)return error("Invalid node index"),!1;if(this.state.openNodes.indexOf(node)>=0)return!1;if(!node.hasChildren()&&node.loadOnDemand)return"function"!=typeof this.options.loadNodes?!1:node.state.loading===!0?!1:(node.state.loading=!0,this.rows[nodeIndex]=this.options.rowRenderer(node,this.options),this.update(),this.options.loadNodes(node,function(err,nodes){node.state.loading=!1,_this4.rows[nodeIndex]=_this4.options.rowRenderer(node,_this4.options),_this4.update(),err||nodes&&(nodes=[].concat(nodes||[]),0!==nodes.length&&(nodes.forEach(function(childNode){_this4.appendChildNode(childNode,node)}),node.hasChildren()&&_this4.openNode(node)))}),!1);node.state.open=!0;var openNodes=[node].concat(this.state.openNodes);this.state.openNodes=openNodes;var nodes=(0,_flattree.flatten)(node.children,{openNodes:this.state.openNodes}),rows=nodes.map(function(node){return _this4.options.rowRenderer(node,_this4.options)});return this.nodes.splice.apply(this.nodes,[nodeIndex+1,0].concat(nodes)),this.rows.splice.apply(this.rows,[nodeIndex+1,0].concat(rows)),this.rows[nodeIndex]=this.options.rowRenderer(node,this.options),nodes.length>0&&!this.nodeTable.get(nodes[0])&&nodes.forEach(function(node){void 0!==node.id&&_this4.nodeTable.set(node.id,node)}),this.emit("openNode",node),this.update(),!0},InfiniteTree.prototype.removeChildNodes=function(parentNode){var _this5=this;if(!ensureNodeInstance(parentNode))return!1;if(0===parentNode.children.length)return!1;var parentNodeIndex=this.nodes.indexOf(parentNode);if(parentNodeIndex>=0&&this.state.selectedNode){var selectedIndex=this.nodes.indexOf(this.state.selectedNode),rangeFrom=parentNodeIndex+1,rangeTo=parentNodeIndex+parentNode.state.total;selectedIndex>=rangeFrom&&rangeTo>=selectedIndex&&this.selectNode(parentNode)}parentNode.children=[],parentNode.state.open=parentNode.state.open&&parentNode.children.length>0;for(var deleteCount=parentNode.state.total,p=parentNode;null!==p;p=p.parent)p.state.total=p.state.total-deleteCount;return parentNodeIndex>=0&&(this.nodes.splice(parentNodeIndex+1,deleteCount),this.rows.splice(parentNodeIndex+1,deleteCount),this.rows[parentNodeIndex]=this.options.rowRenderer(parentNode,this.options)),!function(){var childNodes=_this5.flattenChildNodes(parentNode);_this5.state.openNodes=_this5.state.openNodes.filter(function(node){return childNodes.indexOf(node)<0}),childNodes.forEach(function(node){_this5.nodeTable.unset(node.id)})}(),this.update(),!0},InfiniteTree.prototype.removeNode=function(node){var _this6=this;if(!ensureNodeInstance(node))return!1;var parentNode=node.parent;if(!parentNode)return!1;var nodeIndex=this.nodes.indexOf(node),parentNodeIndex=this.nodes.indexOf(parentNode);if(nodeIndex>=0&&this.state.selectedNode){var selectedIndex=this.nodes.indexOf(this.state.selectedNode),rangeFrom=nodeIndex,rangeTo=nodeIndex+node.state.total+1;if(selectedIndex>=rangeFrom&&rangeTo>=selectedIndex){var selectedNode=node.getNextSibling()||node.getPreviousSibling()||node.getParent();this.selectNode(selectedNode)}}parentNode.children.splice(parentNode.children.indexOf(node),1),parentNode.state.open=parentNode.state.open&&parentNode.children.length>0;for(var deleteCount=node.state.total+1,p=parentNode;null!==p;p=p.parent)p.state.total=p.state.total-deleteCount;return nodeIndex>=0&&(this.nodes.splice(nodeIndex,deleteCount),this.rows.splice(nodeIndex,deleteCount)),parentNodeIndex>=0&&(this.rows[parentNodeIndex]=this.options.rowRenderer(parentNode,this.options)),!function(){var nodes=_this6.flattenNode(node);_this6.state.openNodes=_this6.state.openNodes.filter(function(node){return nodes.indexOf(node)<0}),nodes.forEach(function(node){_this6.nodeTable.unset(node.id)})}(),this.update(),!0},InfiniteTree.prototype.scrollToNode=function(node){if(!ensureNodeInstance(node))return!1;var nodeIndex=this.nodes.indexOf(node);if(0>nodeIndex)return!1;if(!this.contentElement)return!1;var firstChild=this.contentElement.querySelectorAll(".tree-item")[0],rowHeight=firstChild&&firstChild.offsetHeight||0;return this.scrollTop(nodeIndex*rowHeight),!0},InfiniteTree.prototype.scrollTop=function(value){return this.scrollElement?(void 0!==value&&(this.scrollElement.scrollTop=Number(value)),this.scrollElement.scrollTop):0},InfiniteTree.prototype.selectNode=function(){var node=arguments.length<=0||void 0===arguments[0]?null:arguments[0],_options=this.options,selectable=_options.selectable,shouldSelectNode=_options.shouldSelectNode;if(!selectable)return!1;if("function"==typeof shouldSelectNode&&!shouldSelectNode(node))return!1;if(null===node){if(this.state.selectedNode){var selectedNode=this.state.selectedNode,selectedIndex=this.nodes.indexOf(selectedNode);return selectedNode.state.selected=!1,this.rows[selectedIndex]=this.options.rowRenderer(selectedNode,this.options),this.state.selectedNode=null,this.emit("selectNode",null),this.update(),!0}return!1}if(!ensureNodeInstance(node))return!1;var nodeIndex=this.nodes.indexOf(node);if(0>nodeIndex)return error("Invalid node index"),!1;if(this.state.selectedNode!==node&&(node.state.selected=!0,this.rows[nodeIndex]=this.options.rowRenderer(node,this.options)),this.state.selectedNode){var _selectedNode=this.state.selectedNode,_selectedIndex=this.nodes.indexOf(_selectedNode);_selectedNode.state.selected=!1,this.rows[_selectedIndex]=this.options.rowRenderer(_selectedNode,this.options)}return this.state.selectedNode!==node?(this.state.selectedNode=node,this.emit("selectNode",node)):(this.state.selectedNode=null,this.emit("selectNode",null)),this.update(),!0},InfiniteTree.prototype.toggleNode=function(node){this.state.openNodes.indexOf(node)>=0?this.closeNode(node):this.openNode(node)},InfiniteTree.prototype.toString=function(){var node=arguments.length<=0||void 0===arguments[0]?null:arguments[0],traverse=function traverse(node){var s="[";if(node&&node.children)for(var _loop=function(i){var list=[];s+="{",Object.keys(node).forEach(function(key){var value=node[key];if("parent"!==key)return"children"===key?void list.push('"'+key+'":'+traverse(node.children[i])):void("string"==typeof value||"object"===("undefined"==typeof value?"undefined":_typeof(value))?list.push('"'+key+'":'+JSON.stringify(value)):list.push('"'+key+'":'+value))}),s+=list.join(","),s=s+"}"+(i===node.children.length-1?"":",")},i=0;i=0&&(this.rows[nodeIndex]=this.options.rowRenderer(node,this.options),this.update())}},InfiniteTree}(_events2["default"].EventEmitter);exports["default"]=InfiniteTree},function(module,exports){function EventEmitter(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function isFunction(arg){return"function"==typeof arg}function isNumber(arg){return"number"==typeof arg}function isObject(arg){return"object"==typeof arg&&null!==arg}function isUndefined(arg){return void 0===arg}module.exports=EventEmitter,EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._maxListeners=void 0,EventEmitter.defaultMaxListeners=10,EventEmitter.prototype.setMaxListeners=function(n){if(!isNumber(n)||0>n||isNaN(n))throw TypeError("n must be a positive number");return this._maxListeners=n,this},EventEmitter.prototype.emit=function(type){var er,handler,len,args,i,listeners;if(this._events||(this._events={}),"error"===type&&(!this._events.error||isObject(this._events.error)&&!this._events.error.length)){if(er=arguments[1],er instanceof Error)throw er;throw TypeError('Uncaught, unspecified "error" event.')}if(handler=this._events[type],isUndefined(handler))return!1;if(isFunction(handler))switch(arguments.length){case 1:handler.call(this);break;case 2:handler.call(this,arguments[1]);break;case 3:handler.call(this,arguments[1],arguments[2]);break;default:args=Array.prototype.slice.call(arguments,1),handler.apply(this,args)}else if(isObject(handler))for(args=Array.prototype.slice.call(arguments,1),listeners=handler.slice(),len=listeners.length,i=0;len>i;i++)listeners[i].apply(this,args);return!0},EventEmitter.prototype.addListener=function(type,listener){var m;if(!isFunction(listener))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",type,isFunction(listener.listener)?listener.listener:listener),this._events[type]?isObject(this._events[type])?this._events[type].push(listener):this._events[type]=[this._events[type],listener]:this._events[type]=listener,isObject(this._events[type])&&!this._events[type].warned&&(m=isUndefined(this._maxListeners)?EventEmitter.defaultMaxListeners:this._maxListeners,m&&m>0&&this._events[type].length>m&&(this._events[type].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[type].length),"function"==typeof console.trace&&console.trace())),this},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.once=function(type,listener){function g(){this.removeListener(type,g),fired||(fired=!0,listener.apply(this,arguments))}if(!isFunction(listener))throw TypeError("listener must be a function");var fired=!1;return g.listener=listener,this.on(type,g),this},EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events||!this._events[type])return this;if(list=this._events[type],length=list.length,position=-1,list===listener||isFunction(list.listener)&&list.listener===listener)delete this._events[type],this._events.removeListener&&this.emit("removeListener",type,listener);else if(isObject(list)){for(i=length;i-- >0;)if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}if(0>position)return this;1===list.length?(list.length=0,delete this._events[type]):list.splice(position,1),this._events.removeListener&&this.emit("removeListener",type,listener)}return this},EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[type]&&delete this._events[type],this;if(0===arguments.length){for(key in this._events)"removeListener"!==key&&this.removeAllListeners(key);return this.removeAllListeners("removeListener"),this._events={},this}if(listeners=this._events[type],isFunction(listeners))this.removeListener(type,listeners);else if(listeners)for(;listeners.length;)this.removeListener(type,listeners[listeners.length-1]);return delete this._events[type],this},EventEmitter.prototype.listeners=function(type){var ret;return ret=this._events&&this._events[type]?isFunction(this._events[type])?[this._events[type]]:this._events[type].slice():[]},EventEmitter.prototype.listenerCount=function(type){if(this._events){var evlistener=this._events[type];if(isFunction(evlistener))return 1;if(evlistener)return evlistener.length}return 0},EventEmitter.listenerCount=function(emitter,type){return emitter.listenerCount(type)}},function(module,exports,__webpack_require__){!function(name,definition){module.exports=definition()}("Clusterize",function(){"use strict";function on(evt,element,fnc){return element.addEventListener?element.addEventListener(evt,fnc,!1):element.attachEvent("on"+evt,fnc)}function off(evt,element,fnc){return element.removeEventListener?element.removeEventListener(evt,fnc,!1):element.detachEvent("on"+evt,fnc)}function isArray(arr){return"[object Array]"===Object.prototype.toString.call(arr)}function getStyle(prop,elem){return window.getComputedStyle?window.getComputedStyle(elem)[prop]:elem.currentStyle[prop]}var ie=function(){for(var v=3,el=document.createElement("b"),all=el.all||[];el.innerHTML="",all[0];);return v>4?v:document.documentMode}(),is_mac=navigator.platform.toLowerCase().indexOf("mac")+1,Clusterize=function(data){if(!(this instanceof Clusterize))return new Clusterize(data);var self=this,defaults={item_height:0,block_height:0,rows_in_block:50,rows_in_cluster:0,cluster_height:0,blocks_in_cluster:4,tag:null,content_tag:null,show_no_data_row:!0,no_data_class:"clusterize-no-data",no_data_text:"No data",keep_parity:!0,callbacks:{},scroll_top:0};self.options={};for(var option,options=["rows_in_block","blocks_in_cluster","show_no_data_row","no_data_class","no_data_text","keep_parity","tag","callbacks"],i=0;option=options[i];i++)self.options[option]="undefined"!=typeof data[option]&&null!=data[option]?data[option]:defaults[option];for(var elem,elems=["scroll","content"],i=0;elem=elems[i];i++)if(self[elem+"_elem"]=data[elem+"Id"]?document.getElementById(data[elem+"Id"]):data[elem+"Elem"],!self[elem+"_elem"])throw new Error("Error! Could not find "+elem+" element");self.content_elem.hasAttribute("tabindex")||self.content_elem.setAttribute("tabindex",0);var rows=isArray(data.rows)?data.rows:self.fetchMarkup(),cache={data:"",bottom:0},scroll_top=self.scroll_elem.scrollTop;self.exploreEnvironment(rows),self.insertToDOM(rows,cache),self.scroll_elem.scrollTop=scroll_top;var last_cluster=!1,scroll_debounce=0,pointer_events_set=!1,scrollEv=function(){is_mac&&(pointer_events_set||(self.content_elem.style.pointerEvents="none"),pointer_events_set=!0,clearTimeout(scroll_debounce),scroll_debounce=setTimeout(function(){self.content_elem.style.pointerEvents="auto",pointer_events_set=!1},50)),last_cluster!=(last_cluster=self.getClusterNum())&&self.insertToDOM(rows,cache),self.options.callbacks.scrollingProgress&&self.options.callbacks.scrollingProgress(self.getScrollProgress())},resize_debounce=0,resizeEv=function(){clearTimeout(resize_debounce),resize_debounce=setTimeout(self.refresh,100)};on("scroll",self.scroll_elem,scrollEv),on("resize",window,resizeEv),self.destroy=function(clean){off("scroll",self.scroll_elem,scrollEv),off("resize",window,resizeEv),self.html((clean?self.generateEmptyRow():rows).join(""))},self.refresh=function(){self.getRowsHeight(rows)&&self.update(rows)},self.update=function(new_rows){rows=isArray(new_rows)?new_rows:[];var scroll_top=self.scroll_elem.scrollTop;rows.length*self.options.item_height=ie&&!opts.tag&&(opts.tag=rows[0].match(/<([^>\s\/]*)/)[1].toLowerCase()),this.content_elem.children.length<=1&&this.html(rows[0]+rows[0]+rows[0]),opts.tag||(opts.tag=this.content_elem.children[0].tagName.toLowerCase()),this.getRowsHeight(rows))},getRowsHeight:function(rows){var opts=this.options,prev_item_height=opts.item_height;if(opts.cluster_height=0,rows.length){var nodes=this.content_elem.children;return opts.item_height=nodes[Math.floor(nodes.length/2)].offsetHeight,"tr"==opts.tag&&"collapse"!=getStyle("borderCollapse",this.content_elem)&&(opts.item_height+=parseInt(getStyle("borderSpacing",this.content_elem))||0),opts.block_height=opts.item_height*opts.rows_in_block,opts.rows_in_cluster=opts.blocks_in_cluster*opts.rows_in_block,opts.cluster_height=opts.blocks_in_cluster*opts.block_height,prev_item_height!=opts.item_height}},getClusterNum:function(){return this.options.scroll_top=this.scroll_elem.scrollTop,Math.floor(this.options.scroll_top/(this.options.cluster_height-this.options.block_height))||0},generateEmptyRow:function(){var opts=this.options;if(!opts.tag||!opts.show_no_data_row)return[];var td,empty_row=document.createElement(opts.tag),no_data_content=document.createTextNode(opts.no_data_text);return empty_row.className=opts.no_data_class,"tr"==opts.tag&&(td=document.createElement("td"),td.appendChild(no_data_content)),empty_row.appendChild(td||no_data_content),[empty_row.outerHTML]},generate:function(rows,cluster_num){var opts=this.options,rows_len=rows.length;if(rows_lentop_offset&&rows_above++;for(var i=items_start;items_end>i;i++)rows[i]&&this_cluster_rows.push(rows[i]);return{top_offset:top_offset,bottom_offset:bottom_offset,rows_above:rows_above,rows:this_cluster_rows}},renderExtraTag:function(class_name,height){var tag=document.createElement(this.options.tag),clusterize_prefix="clusterize-";return tag.className=[clusterize_prefix+"extra-row",clusterize_prefix+class_name].join(" "),height&&(tag.style.height=height+"px"),tag.outerHTML},insertToDOM:function(rows,cache){var data=this.generate(rows,this.getClusterNum()),this_cluster_rows=data.rows.join(""),this_cluster_content_changed=this.checkChanges("data",this_cluster_rows,cache),only_bottom_offset_changed=this.checkChanges("bottom",data.bottom_offset,cache),callbacks=this.options.callbacks,layout=[];this_cluster_content_changed?(data.top_offset&&(this.options.keep_parity&&layout.push(this.renderExtraTag("keep-parity")), -layout.push(this.renderExtraTag("top-space",data.top_offset))),layout.push(this_cluster_rows),data.bottom_offset&&layout.push(this.renderExtraTag("bottom-space",data.bottom_offset)),callbacks.clusterWillChange&&callbacks.clusterWillChange(),this.html(layout.join("")),"ol"==this.options.content_tag&&this.content_elem.setAttribute("start",data.rows_above),callbacks.clusterChanged&&callbacks.clusterChanged()):only_bottom_offset_changed&&(this.content_elem.lastChild.style.height=data.bottom_offset+"px")},html:function(data){var content_elem=this.content_elem;if(ie&&9>=ie&&"tr"==this.options.tag){var last,div=document.createElement("div");for(div.innerHTML=""+data+"
";last=content_elem.lastChild;)content_elem.removeChild(last);for(var rows_nodes=this.getChildNodes(div.firstChild.firstChild);rows_nodes.length;)content_elem.appendChild(rows_nodes.shift())}else content_elem.innerHTML=data},getChildNodes:function(tag){for(var child_nodes=tag.children,nodes=[],i=0,ii=child_nodes.length;ii>i;i++)nodes.push(child_nodes[i]);return nodes},checkChanges:function(type,value,cache){var changed=value!=cache[type];return cache[type]=value,changed}},Clusterize})},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}exports.__esModule=!0,exports.Node=exports.flatten=void 0;var _flatten=__webpack_require__(5),_flatten2=_interopRequireDefault(_flatten),_node=__webpack_require__(7),_node2=_interopRequireDefault(_node);exports.flatten=_flatten2["default"],exports.Node=_node2["default"]},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}exports.__esModule=!0;var _extend=__webpack_require__(6),_extend2=_interopRequireDefault(_extend),_node=__webpack_require__(7),_node2=_interopRequireDefault(_node),flatten=function flatten(){var nodes=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],options=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];nodes=[].concat(nodes);var flatten=[],stack=[],pool={lastChild:{}};options.openAllNodes=!!options.openAllNodes,options.openNodes=options.openNodes||[],options.throwOnError=!!options.throwOnError;var firstNode=nodes.length>0?nodes[0]:null,parentNode=firstNode?firstNode.parent:null;!parentNode||parentNode instanceof _node2["default"]||(parentNode=new _node2["default"](parentNode));var rootNode=parentNode||new _node2["default"]({label:"",parent:null,children:nodes,state:{depth:-1,open:!0,path:"",prefixMask:"",total:0}});if(rootNode===parentNode)for(var subtotal=rootNode.state.total||0,p=rootNode;p;){var _p$state=p.state,path=_p$state.path,_p$state$total=_p$state.total,total=void 0===_p$state$total?0:_p$state$total;if(p.isLastChild()&&path&&(pool.lastChild[path]=!0),p.state.total=total-subtotal,p.state.total<0){if(options.throwOnError)throw new Error("The node might have been corrupted: id="+JSON.stringify(p.id)+", state="+JSON.stringify(p.state));console&&console.log("Error: The node might have been corrupted: id=%s, label=%s, parent=%s, children=%s, state=%s",JSON.stringify(p.id),JSON.stringify(p.label),p.parent,p.children,JSON.stringify(p.state))}p=p.parent}for(stack.push([rootNode,rootNode.state.depth,0]);stack.length>0;)for(var _stack$pop=stack.pop(),current=_stack$pop[0],depth=_stack$pop[1],index=_stack$pop[2],_loop=function(){var node=current.children[index];node instanceof _node2["default"]||(node=new _node2["default"](node)),node.parent=current,node.children=node.children||[],node.parent.children[index]=node;var path=current.state.path+"."+index,open=node.hasChildren()&&function(){var openAllNodes=options.openAllNodes,openNodes=options.openNodes;return openAllNodes?!0:openNodes.indexOf(node)>=0?!0:openNodes.indexOf(node.id)>=0}(),prefixMask=function(prefix){for(var mask="";prefix.length>0;)prefix=prefix.replace(/\.\d+$/,""),mask=!prefix||pool.lastChild[prefix]?"0"+mask:"1"+mask;return mask}(path);node.isLastChild()&&(pool.lastChild[path]=!0),node.state=(0,_extend2["default"])({},node.state,{depth:depth+1,open:open,path:path,prefixMask:prefixMask,total:0});for(var parentDidOpen=!0,_p=node;null!==_p.parent;){if(_p.parent.state.open===!1){parentDidOpen=!1;break}_p=_p.parent}if(parentDidOpen){flatten.push(node);for(var _p2=node;null!==_p2.parent;)_p2.parent.state.total++,_p2=_p2.parent}++index,node.hasChildren()&&(stack.push([current,depth,index]),index=0,depth+=1,current=node)};index1?_len-1:0),_key=1;_len>_key;_key++)sources[_key-1]=arguments[_key];if(void 0===target||null===target)throw new TypeError("Cannot convert undefined or null to object");for(var output=Object(target),index=0;index0&&index>=0&&index0&&(node=this.children[0]),node},Node.prototype.getLastChild=function(){var node=null;return this.children.length>0&&(node=this.children[this.children.length-1]),node},Node.prototype.getNextSibling=function(){var node=null;if(this.parent){var index=this.parent.children.indexOf(this);index>=0&&index0&&index0},Node.prototype.isLastChild=function(){var hasNextSibling=this.getNextSibling();return!hasNextSibling},Node}();exports["default"]=Node},function(module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}exports.__esModule=!0;var LookupTable=function(){function LookupTable(){_classCallCheck(this,LookupTable),this.data={}}return LookupTable.prototype.clear=function(){this.data={}},LookupTable.prototype.get=function(key){return this.data[key]},LookupTable.prototype.has=function(key){return void 0!==this.data[key]},LookupTable.prototype.set=function(key,value){return this.data[key]=value,value},LookupTable.prototype.unset=function(key){void 0!==this.data[key]&&delete this.data[key]},LookupTable}();exports["default"]=LookupTable},function(module,exports,__webpack_require__){"use strict";exports.__esModule=!0,exports.defaultRowRenderer=void 0;var _helper=__webpack_require__(10),defaultRowRenderer=function(node,treeOptions){var id=node.id,name=node.name,_node$loadOnDemand=node.loadOnDemand,loadOnDemand=void 0===_node$loadOnDemand?!1:_node$loadOnDemand,children=node.children,state=node.state,depth=state.depth,open=state.open,path=state.path,total=state.total,_state$selected=state.selected,selected=void 0===_state$selected?!1:_state$selected,childrenLength=Object.keys(children).length,more=node.hasChildren(),togglerContent="";more&&open&&(togglerContent="▼"),more&&!open&&(togglerContent="►"),!more&&loadOnDemand&&(togglerContent="►");var toggler=(0,_helper.buildHTML)("a",togglerContent,{"class":function(){return more&&open?(0,_helper.classNames)("tree-toggler"):more&&!open?(0,_helper.classNames)("tree-toggler","tree-closed"):!more&&loadOnDemand?(0,_helper.classNames)("tree-toggler","tree-closed"):""}()}),title=(0,_helper.buildHTML)("span",(0,_helper.quoteattr)(name),{"class":(0,_helper.classNames)("tree-title")}),treeNode=(0,_helper.buildHTML)("div",toggler+title,{"class":"tree-node",style:"margin-left: "+18*depth+"px"});return(0,_helper.buildHTML)("div",treeNode,{"aria-id":id,"aria-expanded":more&&open,"aria-depth":depth,"aria-path":path,"aria-selected":selected,"aria-children":childrenLength,"aria-total":total,"class":(0,_helper.classNames)("tree-item",{"tree-selected":selected}),droppable:!0})};exports.defaultRowRenderer=defaultRowRenderer},function(module,exports){"use strict";exports.__esModule=!0;var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol?"symbol":typeof obj},extend=function(target){for(var _len=arguments.length,sources=Array(_len>1?_len-1:0),_key=1;_len>_key;_key++)sources[_key-1]=arguments[_key];target=target||{};for(var index=0;index=0},addClass=function(el,className){if(!el)return"";if(!hasClass(el,className)){var classes=el.className.split(" ");el.className=classes.concat(className).join(" ")}return el.className},removeClass=function(el,className){if(!el)return"";if(hasClass(el,className)){var classes=el.className.split(" ");el.className=classes.filter(function(c){return c!==className}).join(" ")}return el.className},toggleClass=function(el,className){el&&(hasClass(el,className)?removeClass(el,className):addClass(el,className))},classNames=function classNames(){for(var _len2=arguments.length,args=Array(_len2),_key2=0;_len2>_key2;_key2++)args[_key2]=arguments[_key2];var classNames=[];return args.forEach(function(arg){Array.isArray(arg)?classNames=classNames.concat(arg):"object"===("undefined"==typeof arg?"undefined":_typeof(arg))?Object.keys(arg).forEach(function(className){var ok=arg[className];ok&&classNames.push(className)}):classNames.push(arg)}),classNames.join(" ")},isDOMElement=function(o){return"object"===("undefined"==typeof HTMLElement?"undefined":_typeof(HTMLElement))?o instanceof HTMLElement:o&&"object"===("undefined"==typeof o?"undefined":_typeof(o))&&1===o.nodeType&&"string"==typeof o.nodeName},isDOMNode=function(o){return"object"===("undefined"==typeof Node?"undefined":_typeof(Node))?o instanceof Node:o&&"object"===("undefined"==typeof o?"undefined":_typeof(o))&&"number"==typeof o.nodeType&&"string"==typeof o.nodeName},quoteattr=function(s,preserveCR){return preserveCR=preserveCR?" ":"\n",(""+s).replace(/&/g,"&").replace(/'/g,"'").replace(/"/g,""").replace(//g,">").replace(/\r\n/g,preserveCR).replace(/[\r\n]/g,preserveCR)},buildHTML=function buildHTML(tag,html,attrs){switch(tag){case"select":if("object"===("undefined"==typeof html?"undefined":_typeof(html))){var options=html||{};html="";for(var value in options)options.hasOwnProperty(value)&&(html+=buildHTML("option",options[value]||"",{value:value}))}break;default:"object"===("undefined"==typeof html?"undefined":_typeof(html))&&(attrs=html,html=void 0)}var h="<"+tag;for(var attr in attrs)attrs.hasOwnProperty(attr)&&"undefined"!=typeof attrs[attr]&&(h+=" "+attr+'="'+quoteattr(attrs[attr])+'"');return h+="undefined"!=typeof html?">"+html+"":"/>"};exports.extend=extend,exports.preventDefault=preventDefault,exports.stopPropagation=stopPropagation,exports.dispatchEvent=dispatchEvent,exports.addEventListener=addEventListener,exports.removeEventListener=removeEventListener,exports.hasClass=hasClass,exports.addClass=addClass,exports.removeClass=removeClass,exports.toggleClass=toggleClass,exports.classNames=classNames,exports.isDOMElement=isDOMElement,exports.isDOMNode=isDOMNode,exports.quoteattr=quoteattr,exports.buildHTML=buildHTML}])}); \ No newline at end of file +!function(root,factory){"object"==typeof exports&&"object"==typeof module?module.exports=factory():"function"==typeof define&&define.amd?define([],factory):"object"==typeof exports?exports.InfiniteTree=factory():root.InfiniteTree=factory()}(this,function(){return function(modules){function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={exports:{},id:moduleId,loaded:!1};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.loaded=!0,module.exports}var installedModules={};return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.p="",__webpack_require__(0)}([function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}var _infiniteTree=__webpack_require__(1),_infiniteTree2=_interopRequireDefault(_infiniteTree);module.exports=_infiniteTree2["default"]},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol?"symbol":typeof obj},_events=__webpack_require__(2),_events2=_interopRequireDefault(_events),_clusterize=__webpack_require__(3),_clusterize2=_interopRequireDefault(_clusterize),_flattree=__webpack_require__(4),_lookupTable=__webpack_require__(8),_lookupTable2=_interopRequireDefault(_lookupTable),_renderer=__webpack_require__(9),_helper=__webpack_require__(10),error=function(){for(var _len=arguments.length,args=Array(_len),_key=0;_len>_key;_key++)args[_key]=arguments[_key];if(console&&console.error){var prefix="[InfiniteTree]";console.error.apply(console,[prefix].concat(args))}},ensureNodeInstance=function(node){return node?node instanceof _flattree.Node?!0:(error("The node must be a Node object."),!1):!1},InfiniteTree=function(_events$EventEmitter){function InfiniteTree(el,options){_classCallCheck(this,InfiniteTree);var _this=_possibleConstructorReturn(this,_events$EventEmitter.call(this));return _this.options={autoOpen:!1,dragoverClass:"infinite-tree-dragover",droppable:!1,el:null,layout:"div",loadNodes:null,noDataClass:"infinite-tree-no-data",noDataText:"No data",rowRenderer:_renderer.defaultRowRenderer,selectable:!0,shouldSelectNode:null,togglerClass:"infinite-tree-toggler"},_this.state={openNodes:[],rootNode:null,selectedNode:null},_this.clusterize=null,_this.nodeTable=new _lookupTable2["default"],_this.nodes=[],_this.rows=[],_this.scrollElement=null,_this.contentElement=null,_this.dragoverElement=null,_this.contentListener={click:function(e){var itemTarget=null,clickToggler=!1;for((0,_helper.stopPropagation)(e),e.target&&e.currentTarget?itemTarget=e.target!==e.currentTarget?e.target:null:e.srcElement&&(itemTarget=e.srcElement);itemTarget&&itemTarget.parentElement!==_this.contentElement;)(0,_helper.hasClass)(itemTarget,_this.options.togglerClass)&&(clickToggler=!0),itemTarget=itemTarget.parentElement;if(itemTarget){var id=itemTarget.getAttribute("aria-id"),node=_this.getNodeById(id);if(node)return clickToggler?void _this.toggleNode(node):void _this.selectNode(node)}},dragenter:function(e){var itemTarget=null;for(e.target&&e.currentTarget?itemTarget=e.target!==e.currentTarget?e.target:null:e.srcElement&&(itemTarget=e.srcElement);itemTarget&&itemTarget.parentElement!==_this.contentElement;)itemTarget=itemTarget.parentElement;if(itemTarget&&_this.dragoverElement!==itemTarget){if((0,_helper.removeClass)(_this.dragoverElement,_this.options.dragoverClass),_this.dragoverElement=null,!itemTarget.hasAttribute("droppable"))return;var canDrop=!itemTarget.getAttribute("droppable").match(/false/i);canDrop&&((0,_helper.addClass)(itemTarget,_this.options.dragoverClass),_this.dragoverElement=itemTarget)}},dragend:function(e){_this.dragoverElement&&((0,_helper.removeClass)(_this.dragoverElement,_this.options.dragoverClass),_this.dragoverElement=null)},dragover:function(e){return(0,_helper.preventDefault)(e),e.dataTransfer.dropEffect="move",!1},drop:function(e){if((0,_helper.preventDefault)(e),_this.dragoverElement){var id=_this.dragoverElement.getAttribute("aria-id"),node=_this.getNodeById(id);(0,_helper.removeClass)(_this.dragoverElement,_this.options.dragoverClass),_this.dragoverElement=null,_this.emit("dropNode",node,e)}}},(0,_helper.isDOMElement)(el)?options.el=el:options=el,_this.options=(0,_helper.extend)({},_this.options,options),_this.options.el?(_this.create(),options.data&&_this.loadData(options.data),_this):(console.error("Failed to initialize infinite-tree: el is not specified.",options),_possibleConstructorReturn(_this))}return _inherits(InfiniteTree,_events$EventEmitter),InfiniteTree.prototype.create=function(){this.options.el||error("The element option is not specified.");var tag=null;if(this.scrollElement=document.createElement("div"),"table"===this.options.layout){var tableElement=document.createElement("table");tableElement.className=(0,_helper.classNames)("infinite-tree","infinite-tree-table");var contentElement=document.createElement("tbody");tableElement.appendChild(contentElement),this.scrollElement.appendChild(tableElement),this.contentElement=contentElement,tag="tr"}else{var _contentElement=document.createElement("div");this.scrollElement.appendChild(_contentElement),this.contentElement=_contentElement,tag="div"}this.scrollElement.className=(0,_helper.classNames)("infinite-tree","infinite-tree-scroll"),this.contentElement.className=(0,_helper.classNames)("infinite-tree","infinite-tree-content"),this.options.el.appendChild(this.scrollElement),this.clusterize=new _clusterize2["default"]({tag:tag,rows:[],scrollElem:this.scrollElement,contentElem:this.contentElement,no_data_text:this.options.noDataText,no_data_class:this.options.noDataClass}),(0,_helper.addEventListener)(this.contentElement,"click",this.contentListener.click),this.options.droppable&&((0,_helper.addEventListener)(document,"dragend",this.contentListener.dragend),(0,_helper.addEventListener)(this.contentElement,"dragenter",this.contentListener.dragenter),(0,_helper.addEventListener)(this.contentElement,"dragover",this.contentListener.dragover),(0,_helper.addEventListener)(this.contentElement,"drop",this.contentListener.drop))},InfiniteTree.prototype.destroy=function(){for((0,_helper.removeEventListener)(this.contentElement,"click",this.contentListener),this.options.droppable&&((0,_helper.removeEventListener)(document,"dragend",this.contentListener.dragend),(0,_helper.removeEventListener)(this.contentElement,"dragenter",this.contentListener.dragenter),(0,_helper.removeEventListener)(this.contentElement,"dragover",this.contentListener.dragover),(0,_helper.removeEventListener)(this.contentElement,"drop",this.contentListener.drop)),this.clear(),this.clusterize&&(this.clusterize.destroy(!0),this.clusterize=null);this.contentElement.firstChild;)this.contentElement.removeChild(this.contentElement.firstChild);for(;this.scrollElement.firstChild;)this.scrollElement.removeChild(this.scrollElement.firstChild);if(this.options.el)for(var containerElement=this.options.el;containerElement.firstChild;)containerElement.removeChild(containerElement.firstChild);this.contentElement=null,this.scrollElement=null},InfiniteTree.prototype.addChildNodes=function(newNodes,index,parentNode){var _this2=this;if(newNodes=[].concat(newNodes||[]),0===newNodes.length)return!1;if("object"===("undefined"==typeof index?"undefined":_typeof(index))?(parentNode=index||this.state.rootNode,index=parentNode.children.length):parentNode=parentNode||this.state.rootNode,!ensureNodeInstance(parentNode))return!1;newNodes.forEach(function(newNode){newNode.parent=parentNode}),parentNode.children.splice.apply(parentNode.children,[index,0].concat(newNodes)),index=parentNode.children.indexOf(newNodes[0]);var deleteCount=parentNode.state.total,nodes=(0,_flattree.flatten)(parentNode.children,{openNodes:this.state.openNodes}),rows=nodes.map(function(node){return _this2.options.rowRenderer(node,_this2.options)});if(parentNode===this.state.rootNode)this.nodes=nodes,this.rows=rows;else{var parentOffset=this.nodes.indexOf(parentNode);parentOffset>=0&&(this.nodes.splice.apply(this.nodes,[parentOffset+1,deleteCount].concat(nodes)),this.rows.splice.apply(this.rows,[parentOffset+1,deleteCount].concat(rows)),this.rows[parentOffset]=this.options.rowRenderer(parentNode,this.options))}return parentNode.children.slice(index).forEach(function(childNode){_this2.flattenNode(childNode).forEach(function(node){void 0!==node.id&&_this2.nodeTable.set(node.id,node)})}),this.update(),!0},InfiniteTree.prototype.appendChildNode=function(newNode,parentNode){if(parentNode=parentNode||this.state.rootNode,!ensureNodeInstance(parentNode))return!1;var index=parentNode.children.length,newNodes=[].concat(newNode||[]);return this.addChildNodes(newNodes,index,parentNode)},InfiniteTree.prototype.clear=function(){this.clusterize.clear(),this.nodeTable.clear(),this.nodes=[],this.rows=[],this.state.openNodes=[],this.state.rootNode=null,this.state.selectedNode=null},InfiniteTree.prototype.closeNode=function(node){if(!ensureNodeInstance(node))return!1;var nodeIndex=this.nodes.indexOf(node);if(0>nodeIndex)return error("Invalid node index"),!1;if(this.state.openNodes.indexOf(node)<0)return!1;if(this.state.selectedNode&&this.state.selectedNode!==node){var selectedIndex=this.nodes.indexOf(this.state.selectedNode),rangeFrom=nodeIndex+1,rangeTo=nodeIndex+node.state.total;selectedIndex>=rangeFrom&&rangeTo>=selectedIndex&&this.selectNode(node)}node.state.open=!1;var openNodes=this.state.openNodes.filter(function(node){return node.hasChildren()&&node.state.open});this.state.openNodes=openNodes;for(var deleteCount=node.state.total,p=node;null!==p;p=p.parent)p.state.total=p.state.total-deleteCount;return this.nodes.splice(nodeIndex+1,deleteCount),this.rows.splice(nodeIndex+1,deleteCount),this.rows[nodeIndex]=this.options.rowRenderer(node,this.options),this.emit("closeNode",node),this.update(),!0},InfiniteTree.prototype.flattenChildNodes=function(parentNode){if(parentNode=parentNode||this.state.rootNode,!ensureNodeInstance(parentNode))return[];for(var list=[],node=parentNode.getFirstChild();node;)if(list.push(node),node.hasChildren())node=node.getFirstChild();else{for(;null===node.getNextSibling()&&node.parent!==parentNode;)node=node.getParent();node=node.getNextSibling()}return list},InfiniteTree.prototype.flattenNode=function(node){return[node].concat(this.flattenChildNodes(node))},InfiniteTree.prototype.getChildNodes=function(parentNode){return parentNode=parentNode||this.state.rootNode,ensureNodeInstance(parentNode)?parentNode.children:[]},InfiniteTree.prototype.getNodeById=function(id){var node=this.nodeTable.get(id);if(!node){if(node=this.nodes.filter(function(node){return node.id===id})[0],!node)return null;this.nodeTable.set(node.id,node)}return node},InfiniteTree.prototype.getOpenNodes=function(){return this.state.openNodes.slice()},InfiniteTree.prototype.getRootNode=function(){return this.state.rootNode},InfiniteTree.prototype.getSelectedNode=function(){return this.state.selectedNode},InfiniteTree.prototype.insertNodeAfter=function(newNode,referenceNode){if(!ensureNodeInstance(referenceNode))return!1;var parentNode=referenceNode.getParent(),index=parentNode.children.indexOf(referenceNode)+1,newNodes=[].concat(newNode||[]);return this.addChildNodes(newNodes,index,parentNode)},InfiniteTree.prototype.insertNodeBefore=function(newNode,referenceNode){if(!ensureNodeInstance(referenceNode))return!1;var parentNode=referenceNode.getParent(),index=parentNode.children.indexOf(referenceNode),newNodes=[].concat(newNode||[]);return this.addChildNodes(newNodes,index,parentNode)},InfiniteTree.prototype.loadData=function(){var _this3=this,data=arguments.length<=0||void 0===arguments[0]?[]:arguments[0];this.nodes=(0,_flattree.flatten)(data,{openAllNodes:this.options.autoOpen}),this.nodeTable.clear(),this.state.openNodes=this.nodes.filter(function(node){return node.hasChildren()&&node.state.open}),this.state.rootNode=function(){for(var node=arguments.length<=0||void 0===arguments[0]?null:arguments[0];node&&null!==node.parent;)node=node.parent;return node}(this.nodes.length>0?this.nodes[0]:null),this.state.selectedNode=null,this.state.rootNode&&this.flattenChildNodes(this.state.rootNode).forEach(function(node){void 0!==node.id&&_this3.nodeTable.set(node.id,node)}),this.rows=this.nodes.map(function(node){return _this3.options.rowRenderer(node,_this3.options)}),this.update()},InfiniteTree.prototype.openNode=function(node){var _this4=this;if(!ensureNodeInstance(node))return!1;var nodeIndex=this.nodes.indexOf(node);if(0>nodeIndex)return error("Invalid node index"),!1;if(this.state.openNodes.indexOf(node)>=0)return!1;if(!node.hasChildren()&&node.loadOnDemand)return"function"!=typeof this.options.loadNodes?!1:node.state.loading===!0?!1:(node.state.loading=!0,this.rows[nodeIndex]=this.options.rowRenderer(node,this.options),this.update(),this.options.loadNodes(node,function(err,nodes){node.state.loading=!1,_this4.rows[nodeIndex]=_this4.options.rowRenderer(node,_this4.options),_this4.update(),err||nodes&&(nodes=[].concat(nodes||[]),0!==nodes.length&&(nodes.forEach(function(childNode){_this4.appendChildNode(childNode,node)}),node.hasChildren()&&_this4.openNode(node)))}),!1);node.state.open=!0;var openNodes=[node].concat(this.state.openNodes);this.state.openNodes=openNodes;var nodes=(0,_flattree.flatten)(node.children,{openNodes:this.state.openNodes}),rows=nodes.map(function(node){return _this4.options.rowRenderer(node,_this4.options)});return this.nodes.splice.apply(this.nodes,[nodeIndex+1,0].concat(nodes)),this.rows.splice.apply(this.rows,[nodeIndex+1,0].concat(rows)),this.rows[nodeIndex]=this.options.rowRenderer(node,this.options),nodes.length>0&&!this.nodeTable.get(nodes[0])&&nodes.forEach(function(node){void 0!==node.id&&_this4.nodeTable.set(node.id,node)}),this.emit("openNode",node),this.update(),!0},InfiniteTree.prototype.removeChildNodes=function(parentNode){var _this5=this;if(!ensureNodeInstance(parentNode))return!1;if(0===parentNode.children.length)return!1;var parentNodeIndex=this.nodes.indexOf(parentNode);if(parentNodeIndex>=0&&this.state.selectedNode){var selectedIndex=this.nodes.indexOf(this.state.selectedNode),rangeFrom=parentNodeIndex+1,rangeTo=parentNodeIndex+parentNode.state.total;selectedIndex>=rangeFrom&&rangeTo>=selectedIndex&&this.selectNode(parentNode)}parentNode.children=[],parentNode.state.open=parentNode.state.open&&parentNode.children.length>0;for(var deleteCount=parentNode.state.total,p=parentNode;null!==p;p=p.parent)p.state.total=p.state.total-deleteCount;return parentNodeIndex>=0&&(this.nodes.splice(parentNodeIndex+1,deleteCount),this.rows.splice(parentNodeIndex+1,deleteCount),this.rows[parentNodeIndex]=this.options.rowRenderer(parentNode,this.options)),!function(){var childNodes=_this5.flattenChildNodes(parentNode);_this5.state.openNodes=_this5.state.openNodes.filter(function(node){return childNodes.indexOf(node)<0}),childNodes.forEach(function(node){_this5.nodeTable.unset(node.id)})}(),this.update(),!0},InfiniteTree.prototype.removeNode=function(node){var _this6=this;if(!ensureNodeInstance(node))return!1;var parentNode=node.parent;if(!parentNode)return!1;var nodeIndex=this.nodes.indexOf(node),parentNodeIndex=this.nodes.indexOf(parentNode);if(nodeIndex>=0&&this.state.selectedNode){var selectedIndex=this.nodes.indexOf(this.state.selectedNode),rangeFrom=nodeIndex,rangeTo=nodeIndex+node.state.total+1;if(selectedIndex>=rangeFrom&&rangeTo>=selectedIndex){var selectedNode=node.getNextSibling()||node.getPreviousSibling()||node.getParent();this.selectNode(selectedNode)}}parentNode.children.splice(parentNode.children.indexOf(node),1),parentNode.state.open=parentNode.state.open&&parentNode.children.length>0;for(var deleteCount=node.state.total+1,p=parentNode;null!==p;p=p.parent)p.state.total=p.state.total-deleteCount;return nodeIndex>=0&&(this.nodes.splice(nodeIndex,deleteCount),this.rows.splice(nodeIndex,deleteCount)),parentNodeIndex>=0&&(this.rows[parentNodeIndex]=this.options.rowRenderer(parentNode,this.options)),!function(){var nodes=_this6.flattenNode(node);_this6.state.openNodes=_this6.state.openNodes.filter(function(node){return nodes.indexOf(node)<0}),nodes.forEach(function(node){_this6.nodeTable.unset(node.id)})}(),this.update(),!0},InfiniteTree.prototype.scrollToNode=function(node){if(!ensureNodeInstance(node))return!1;var nodeIndex=this.nodes.indexOf(node);if(0>nodeIndex)return!1;if(!this.contentElement)return!1;var firstChild=this.contentElement.firstChild,rowHeight=firstChild&&firstChild.offsetHeight||0;return this.scrollTop(nodeIndex*rowHeight),!0},InfiniteTree.prototype.scrollTop=function(value){return this.scrollElement?(void 0!==value&&(this.scrollElement.scrollTop=Number(value)),this.scrollElement.scrollTop):0},InfiniteTree.prototype.selectNode=function(){var node=arguments.length<=0||void 0===arguments[0]?null:arguments[0],_options=this.options,selectable=_options.selectable,shouldSelectNode=_options.shouldSelectNode;if(!selectable)return!1;if("function"==typeof shouldSelectNode&&!shouldSelectNode(node))return!1;if(null===node){if(this.state.selectedNode){var selectedNode=this.state.selectedNode,selectedIndex=this.nodes.indexOf(selectedNode);return selectedNode.state.selected=!1,this.rows[selectedIndex]=this.options.rowRenderer(selectedNode,this.options),this.state.selectedNode=null,this.emit("selectNode",null),this.update(),!0}return!1}if(!ensureNodeInstance(node))return!1;var nodeIndex=this.nodes.indexOf(node);if(0>nodeIndex)return error("Invalid node index"),!1;if(this.state.selectedNode!==node&&(node.state.selected=!0,this.rows[nodeIndex]=this.options.rowRenderer(node,this.options)),this.state.selectedNode){var _selectedNode=this.state.selectedNode,_selectedIndex=this.nodes.indexOf(_selectedNode);_selectedNode.state.selected=!1,this.rows[_selectedIndex]=this.options.rowRenderer(_selectedNode,this.options)}return this.state.selectedNode!==node?(this.state.selectedNode=node,this.emit("selectNode",node)):(this.state.selectedNode=null,this.emit("selectNode",null)),this.update(),!0},InfiniteTree.prototype.toggleNode=function(node){this.state.openNodes.indexOf(node)>=0?this.closeNode(node):this.openNode(node)},InfiniteTree.prototype.toString=function(){var node=arguments.length<=0||void 0===arguments[0]?null:arguments[0],traverse=function traverse(node){var s="[";if(node&&node.children)for(var _loop=function(i){var list=[];s+="{",Object.keys(node).forEach(function(key){var value=node[key];if("parent"!==key)return"children"===key?void list.push('"'+key+'":'+traverse(node.children[i])):void("string"==typeof value||"object"===("undefined"==typeof value?"undefined":_typeof(value))?list.push('"'+key+'":'+JSON.stringify(value)):list.push('"'+key+'":'+value))}),s+=list.join(","),s=s+"}"+(i===node.children.length-1?"":",")},i=0;i=0&&(this.rows[nodeIndex]=this.options.rowRenderer(node,this.options),this.update())}},InfiniteTree}(_events2["default"].EventEmitter);exports["default"]=InfiniteTree},function(module,exports){function EventEmitter(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function isFunction(arg){return"function"==typeof arg}function isNumber(arg){return"number"==typeof arg}function isObject(arg){return"object"==typeof arg&&null!==arg}function isUndefined(arg){return void 0===arg}module.exports=EventEmitter,EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._maxListeners=void 0,EventEmitter.defaultMaxListeners=10,EventEmitter.prototype.setMaxListeners=function(n){if(!isNumber(n)||0>n||isNaN(n))throw TypeError("n must be a positive number");return this._maxListeners=n,this},EventEmitter.prototype.emit=function(type){var er,handler,len,args,i,listeners;if(this._events||(this._events={}),"error"===type&&(!this._events.error||isObject(this._events.error)&&!this._events.error.length)){if(er=arguments[1],er instanceof Error)throw er;throw TypeError('Uncaught, unspecified "error" event.')}if(handler=this._events[type],isUndefined(handler))return!1;if(isFunction(handler))switch(arguments.length){case 1:handler.call(this);break;case 2:handler.call(this,arguments[1]);break;case 3:handler.call(this,arguments[1],arguments[2]);break;default:args=Array.prototype.slice.call(arguments,1),handler.apply(this,args)}else if(isObject(handler))for(args=Array.prototype.slice.call(arguments,1),listeners=handler.slice(),len=listeners.length,i=0;len>i;i++)listeners[i].apply(this,args);return!0},EventEmitter.prototype.addListener=function(type,listener){var m;if(!isFunction(listener))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",type,isFunction(listener.listener)?listener.listener:listener),this._events[type]?isObject(this._events[type])?this._events[type].push(listener):this._events[type]=[this._events[type],listener]:this._events[type]=listener,isObject(this._events[type])&&!this._events[type].warned&&(m=isUndefined(this._maxListeners)?EventEmitter.defaultMaxListeners:this._maxListeners,m&&m>0&&this._events[type].length>m&&(this._events[type].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[type].length),"function"==typeof console.trace&&console.trace())),this},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.once=function(type,listener){function g(){this.removeListener(type,g),fired||(fired=!0,listener.apply(this,arguments))}if(!isFunction(listener))throw TypeError("listener must be a function");var fired=!1;return g.listener=listener,this.on(type,g),this},EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events||!this._events[type])return this;if(list=this._events[type],length=list.length,position=-1,list===listener||isFunction(list.listener)&&list.listener===listener)delete this._events[type],this._events.removeListener&&this.emit("removeListener",type,listener);else if(isObject(list)){for(i=length;i-- >0;)if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}if(0>position)return this;1===list.length?(list.length=0,delete this._events[type]):list.splice(position,1),this._events.removeListener&&this.emit("removeListener",type,listener)}return this},EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[type]&&delete this._events[type],this;if(0===arguments.length){for(key in this._events)"removeListener"!==key&&this.removeAllListeners(key);return this.removeAllListeners("removeListener"),this._events={},this}if(listeners=this._events[type],isFunction(listeners))this.removeListener(type,listeners);else if(listeners)for(;listeners.length;)this.removeListener(type,listeners[listeners.length-1]);return delete this._events[type],this},EventEmitter.prototype.listeners=function(type){var ret;return ret=this._events&&this._events[type]?isFunction(this._events[type])?[this._events[type]]:this._events[type].slice():[]},EventEmitter.prototype.listenerCount=function(type){if(this._events){var evlistener=this._events[type];if(isFunction(evlistener))return 1;if(evlistener)return evlistener.length}return 0},EventEmitter.listenerCount=function(emitter,type){return emitter.listenerCount(type)}},function(module,exports,__webpack_require__){!function(name,definition){module.exports=definition()}("Clusterize",function(){"use strict";function on(evt,element,fnc){return element.addEventListener?element.addEventListener(evt,fnc,!1):element.attachEvent("on"+evt,fnc)}function off(evt,element,fnc){return element.removeEventListener?element.removeEventListener(evt,fnc,!1):element.detachEvent("on"+evt,fnc)}function isArray(arr){return"[object Array]"===Object.prototype.toString.call(arr)}function getStyle(prop,elem){return window.getComputedStyle?window.getComputedStyle(elem)[prop]:elem.currentStyle[prop]}var ie=function(){for(var v=3,el=document.createElement("b"),all=el.all||[];el.innerHTML="",all[0];);return v>4?v:document.documentMode}(),is_mac=navigator.platform.toLowerCase().indexOf("mac")+1,Clusterize=function(data){if(!(this instanceof Clusterize))return new Clusterize(data);var self=this,defaults={item_height:0,block_height:0,rows_in_block:50,rows_in_cluster:0,cluster_height:0,blocks_in_cluster:4,tag:null,content_tag:null,show_no_data_row:!0,no_data_class:"clusterize-no-data",no_data_text:"No data",keep_parity:!0,callbacks:{},scroll_top:0};self.options={};for(var option,options=["rows_in_block","blocks_in_cluster","show_no_data_row","no_data_class","no_data_text","keep_parity","tag","callbacks"],i=0;option=options[i];i++)self.options[option]="undefined"!=typeof data[option]&&null!=data[option]?data[option]:defaults[option];for(var elem,elems=["scroll","content"],i=0;elem=elems[i];i++)if(self[elem+"_elem"]=data[elem+"Id"]?document.getElementById(data[elem+"Id"]):data[elem+"Elem"],!self[elem+"_elem"])throw new Error("Error! Could not find "+elem+" element");self.content_elem.hasAttribute("tabindex")||self.content_elem.setAttribute("tabindex",0);var rows=isArray(data.rows)?data.rows:self.fetchMarkup(),cache={data:"",bottom:0},scroll_top=self.scroll_elem.scrollTop;self.exploreEnvironment(rows),self.insertToDOM(rows,cache),self.scroll_elem.scrollTop=scroll_top;var last_cluster=!1,scroll_debounce=0,pointer_events_set=!1,scrollEv=function(){is_mac&&(pointer_events_set||(self.content_elem.style.pointerEvents="none"),pointer_events_set=!0,clearTimeout(scroll_debounce),scroll_debounce=setTimeout(function(){self.content_elem.style.pointerEvents="auto",pointer_events_set=!1},50)),last_cluster!=(last_cluster=self.getClusterNum())&&self.insertToDOM(rows,cache),self.options.callbacks.scrollingProgress&&self.options.callbacks.scrollingProgress(self.getScrollProgress())},resize_debounce=0,resizeEv=function(){clearTimeout(resize_debounce),resize_debounce=setTimeout(self.refresh,100)};on("scroll",self.scroll_elem,scrollEv),on("resize",window,resizeEv),self.destroy=function(clean){off("scroll",self.scroll_elem,scrollEv),off("resize",window,resizeEv),self.html((clean?self.generateEmptyRow():rows).join(""))},self.refresh=function(){self.getRowsHeight(rows)&&self.update(rows)},self.update=function(new_rows){rows=isArray(new_rows)?new_rows:[];var scroll_top=self.scroll_elem.scrollTop;rows.length*self.options.item_height=ie&&!opts.tag&&(opts.tag=rows[0].match(/<([^>\s\/]*)/)[1].toLowerCase()),this.content_elem.children.length<=1&&this.html(rows[0]+rows[0]+rows[0]),opts.tag||(opts.tag=this.content_elem.children[0].tagName.toLowerCase()),this.getRowsHeight(rows))},getRowsHeight:function(rows){var opts=this.options,prev_item_height=opts.item_height;if(opts.cluster_height=0,rows.length){var nodes=this.content_elem.children;return opts.item_height=nodes[Math.floor(nodes.length/2)].offsetHeight,"tr"==opts.tag&&"collapse"!=getStyle("borderCollapse",this.content_elem)&&(opts.item_height+=parseInt(getStyle("borderSpacing",this.content_elem))||0),opts.block_height=opts.item_height*opts.rows_in_block,opts.rows_in_cluster=opts.blocks_in_cluster*opts.rows_in_block,opts.cluster_height=opts.blocks_in_cluster*opts.block_height,prev_item_height!=opts.item_height}},getClusterNum:function(){return this.options.scroll_top=this.scroll_elem.scrollTop,Math.floor(this.options.scroll_top/(this.options.cluster_height-this.options.block_height))||0},generateEmptyRow:function(){var opts=this.options;if(!opts.tag||!opts.show_no_data_row)return[];var td,empty_row=document.createElement(opts.tag),no_data_content=document.createTextNode(opts.no_data_text);return empty_row.className=opts.no_data_class,"tr"==opts.tag&&(td=document.createElement("td"),td.appendChild(no_data_content)),empty_row.appendChild(td||no_data_content),[empty_row.outerHTML]},generate:function(rows,cluster_num){var opts=this.options,rows_len=rows.length;if(rows_lentop_offset&&rows_above++;for(var i=items_start;items_end>i;i++)rows[i]&&this_cluster_rows.push(rows[i]);return{top_offset:top_offset,bottom_offset:bottom_offset,rows_above:rows_above,rows:this_cluster_rows}},renderExtraTag:function(class_name,height){var tag=document.createElement(this.options.tag),clusterize_prefix="clusterize-";return tag.className=[clusterize_prefix+"extra-row",clusterize_prefix+class_name].join(" "),height&&(tag.style.height=height+"px"),tag.outerHTML},insertToDOM:function(rows,cache){var data=this.generate(rows,this.getClusterNum()),this_cluster_rows=data.rows.join(""),this_cluster_content_changed=this.checkChanges("data",this_cluster_rows,cache),only_bottom_offset_changed=this.checkChanges("bottom",data.bottom_offset,cache),callbacks=this.options.callbacks,layout=[];this_cluster_content_changed?(data.top_offset&&(this.options.keep_parity&&layout.push(this.renderExtraTag("keep-parity")), +layout.push(this.renderExtraTag("top-space",data.top_offset))),layout.push(this_cluster_rows),data.bottom_offset&&layout.push(this.renderExtraTag("bottom-space",data.bottom_offset)),callbacks.clusterWillChange&&callbacks.clusterWillChange(),this.html(layout.join("")),"ol"==this.options.content_tag&&this.content_elem.setAttribute("start",data.rows_above),callbacks.clusterChanged&&callbacks.clusterChanged()):only_bottom_offset_changed&&(this.content_elem.lastChild.style.height=data.bottom_offset+"px")},html:function(data){var content_elem=this.content_elem;if(ie&&9>=ie&&"tr"==this.options.tag){var last,div=document.createElement("div");for(div.innerHTML=""+data+"
";last=content_elem.lastChild;)content_elem.removeChild(last);for(var rows_nodes=this.getChildNodes(div.firstChild.firstChild);rows_nodes.length;)content_elem.appendChild(rows_nodes.shift())}else content_elem.innerHTML=data},getChildNodes:function(tag){for(var child_nodes=tag.children,nodes=[],i=0,ii=child_nodes.length;ii>i;i++)nodes.push(child_nodes[i]);return nodes},checkChanges:function(type,value,cache){var changed=value!=cache[type];return cache[type]=value,changed}},Clusterize})},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}exports.__esModule=!0,exports.Node=exports.flatten=void 0;var _flatten=__webpack_require__(5),_flatten2=_interopRequireDefault(_flatten),_node=__webpack_require__(7),_node2=_interopRequireDefault(_node);exports.flatten=_flatten2["default"],exports.Node=_node2["default"]},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}exports.__esModule=!0;var _extend=__webpack_require__(6),_extend2=_interopRequireDefault(_extend),_node=__webpack_require__(7),_node2=_interopRequireDefault(_node),flatten=function flatten(){var nodes=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],options=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];nodes=[].concat(nodes);var flatten=[],stack=[],pool={lastChild:{}};options.openAllNodes=!!options.openAllNodes,options.openNodes=options.openNodes||[],options.throwOnError=!!options.throwOnError;var firstNode=nodes.length>0?nodes[0]:null,parentNode=firstNode?firstNode.parent:null;!parentNode||parentNode instanceof _node2["default"]||(parentNode=new _node2["default"](parentNode));var rootNode=parentNode||new _node2["default"]({label:"",parent:null,children:nodes,state:{depth:-1,open:!0,path:"",prefixMask:"",total:0}});if(rootNode===parentNode)for(var subtotal=rootNode.state.total||0,p=rootNode;p;){var _p$state=p.state,path=_p$state.path,_p$state$total=_p$state.total,total=void 0===_p$state$total?0:_p$state$total;if(p.isLastChild()&&path&&(pool.lastChild[path]=!0),p.state.total=total-subtotal,p.state.total<0){if(options.throwOnError)throw new Error("The node might have been corrupted: id="+JSON.stringify(p.id)+", state="+JSON.stringify(p.state));console&&console.log("Error: The node might have been corrupted: id=%s, label=%s, parent=%s, children=%s, state=%s",JSON.stringify(p.id),JSON.stringify(p.label),p.parent,p.children,JSON.stringify(p.state))}p=p.parent}for(stack.push([rootNode,rootNode.state.depth,0]);stack.length>0;)for(var _stack$pop=stack.pop(),current=_stack$pop[0],depth=_stack$pop[1],index=_stack$pop[2],_loop=function(){var node=current.children[index];node instanceof _node2["default"]||(node=new _node2["default"](node)),node.parent=current,node.children=node.children||[],node.parent.children[index]=node;var path=current.state.path+"."+index,open=node.hasChildren()&&function(){var openAllNodes=options.openAllNodes,openNodes=options.openNodes;return openAllNodes?!0:openNodes.indexOf(node)>=0?!0:openNodes.indexOf(node.id)>=0}(),prefixMask=function(prefix){for(var mask="";prefix.length>0;)prefix=prefix.replace(/\.\d+$/,""),mask=!prefix||pool.lastChild[prefix]?"0"+mask:"1"+mask;return mask}(path);node.isLastChild()&&(pool.lastChild[path]=!0),node.state=(0,_extend2["default"])({},node.state,{depth:depth+1,open:open,path:path,prefixMask:prefixMask,total:0});for(var parentDidOpen=!0,_p=node;null!==_p.parent;){if(_p.parent.state.open===!1){parentDidOpen=!1;break}_p=_p.parent}if(parentDidOpen){flatten.push(node);for(var _p2=node;null!==_p2.parent;)_p2.parent.state.total++,_p2=_p2.parent}++index,node.hasChildren()&&(stack.push([current,depth,index]),index=0,depth+=1,current=node)};index1?_len-1:0),_key=1;_len>_key;_key++)sources[_key-1]=arguments[_key];if(void 0===target||null===target)throw new TypeError("Cannot convert undefined or null to object");for(var output=Object(target),index=0;index0&&index>=0&&index0&&(node=this.children[0]),node},Node.prototype.getLastChild=function(){var node=null;return this.children.length>0&&(node=this.children[this.children.length-1]),node},Node.prototype.getNextSibling=function(){var node=null;if(this.parent){var index=this.parent.children.indexOf(this);index>=0&&index0&&index0},Node.prototype.isLastChild=function(){var hasNextSibling=this.getNextSibling();return!hasNextSibling},Node}();exports["default"]=Node},function(module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}exports.__esModule=!0;var LookupTable=function(){function LookupTable(){_classCallCheck(this,LookupTable),this.data={}}return LookupTable.prototype.clear=function(){this.data={}},LookupTable.prototype.get=function(key){return this.data[key]},LookupTable.prototype.has=function(key){return void 0!==this.data[key]},LookupTable.prototype.set=function(key,value){return this.data[key]=value,value},LookupTable.prototype.unset=function(key){void 0!==this.data[key]&&delete this.data[key]},LookupTable}();exports["default"]=LookupTable},function(module,exports,__webpack_require__){"use strict";exports.__esModule=!0,exports.defaultRowRenderer=void 0;var _helper=__webpack_require__(10),defaultRowRenderer=function(node,treeOptions){var id=node.id,name=node.name,_node$loadOnDemand=node.loadOnDemand,loadOnDemand=void 0===_node$loadOnDemand?!1:_node$loadOnDemand,children=node.children,state=node.state,depth=state.depth,open=state.open,path=state.path,total=state.total,_state$selected=state.selected,selected=void 0===_state$selected?!1:_state$selected,childrenLength=Object.keys(children).length,more=node.hasChildren(),togglerContent="";more&&open&&(togglerContent="▼"),more&&!open&&(togglerContent="►"),!more&&loadOnDemand&&(togglerContent="►");var toggler=(0,_helper.buildHTML)("a",togglerContent,{"class":function(){return more&&open?(0,_helper.classNames)("infinite-tree-toggler"):more&&!open?(0,_helper.classNames)("infinite-tree-toggler","infinite-tree-closed"):!more&&loadOnDemand?(0,_helper.classNames)("infinite-tree-toggler","infinite-tree-closed"):""}()}),title=(0,_helper.buildHTML)("span",(0,_helper.quoteattr)(name),{"class":(0,_helper.classNames)("infinite-tree-title")}),treeNode=(0,_helper.buildHTML)("div",toggler+title,{"class":"infinite-tree-node",style:"margin-left: "+18*depth+"px"});return(0,_helper.buildHTML)("div",treeNode,{"aria-id":id,"aria-expanded":more&&open,"aria-depth":depth,"aria-path":path,"aria-selected":selected,"aria-children":childrenLength,"aria-total":total,"class":(0,_helper.classNames)("infinite-tree-item",{"infinite-tree-selected":selected}),droppable:!0})};exports.defaultRowRenderer=defaultRowRenderer},function(module,exports){"use strict";exports.__esModule=!0;var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol?"symbol":typeof obj},extend=function(target){for(var _len=arguments.length,sources=Array(_len>1?_len-1:0),_key=1;_len>_key;_key++)sources[_key-1]=arguments[_key];target=target||{};for(var index=0;index=0},addClass=function(el,className){if(!el)return"";if(!hasClass(el,className)){var classes=el.className.split(" ");el.className=classes.concat(className).join(" ")}return el.className},removeClass=function(el,className){if(!el)return"";if(hasClass(el,className)){var classes=el.className.split(" ");el.className=classes.filter(function(c){return c!==className}).join(" ")}return el.className},toggleClass=function(el,className){el&&(hasClass(el,className)?removeClass(el,className):addClass(el,className))},classNames=function classNames(){for(var _len2=arguments.length,args=Array(_len2),_key2=0;_len2>_key2;_key2++)args[_key2]=arguments[_key2];var classNames=[];return args.forEach(function(arg){Array.isArray(arg)?classNames=classNames.concat(arg):"object"===("undefined"==typeof arg?"undefined":_typeof(arg))?Object.keys(arg).forEach(function(className){var ok=arg[className];ok&&classNames.push(className)}):classNames.push(arg)}),classNames.join(" ")},isDOMElement=function(o){return"object"===("undefined"==typeof HTMLElement?"undefined":_typeof(HTMLElement))?o instanceof HTMLElement:o&&"object"===("undefined"==typeof o?"undefined":_typeof(o))&&1===o.nodeType&&"string"==typeof o.nodeName},isDOMNode=function(o){return"object"===("undefined"==typeof Node?"undefined":_typeof(Node))?o instanceof Node:o&&"object"===("undefined"==typeof o?"undefined":_typeof(o))&&"number"==typeof o.nodeType&&"string"==typeof o.nodeName},quoteattr=function(s,preserveCR){return preserveCR=preserveCR?" ":"\n",(""+s).replace(/&/g,"&").replace(/'/g,"'").replace(/"/g,""").replace(//g,">").replace(/\r\n/g,preserveCR).replace(/[\r\n]/g,preserveCR)},buildHTML=function buildHTML(tag,html,attrs){switch(tag){case"select":if("object"===("undefined"==typeof html?"undefined":_typeof(html))){var options=html||{};html="";for(var value in options)options.hasOwnProperty(value)&&(html+=buildHTML("option",options[value]||"",{value:value}))}break;default:"object"===("undefined"==typeof html?"undefined":_typeof(html))&&(attrs=html,html=void 0)}var h="<"+tag;for(var attr in attrs)attrs.hasOwnProperty(attr)&&"undefined"!=typeof attrs[attr]&&(h+=" "+attr+'="'+quoteattr(attrs[attr])+'"');return h+="undefined"!=typeof html?">"+html+"":"/>"};exports.extend=extend,exports.preventDefault=preventDefault,exports.stopPropagation=stopPropagation,exports.dispatchEvent=dispatchEvent,exports.addEventListener=addEventListener,exports.removeEventListener=removeEventListener,exports.hasClass=hasClass,exports.addClass=addClass,exports.removeClass=removeClass,exports.toggleClass=toggleClass,exports.classNames=classNames,exports.isDOMElement=isDOMElement,exports.isDOMNode=isDOMNode,exports.quoteattr=quoteattr,exports.buildHTML=buildHTML}])}); \ No newline at end of file From 34b04de94cfc10fd3df1d54338aebe59be74ef03 Mon Sep 17 00:00:00 2001 From: Cheton Wu Date: Sat, 16 Apr 2016 17:51:58 +0800 Subject: [PATCH 04/17] Update examples --- examples/classic/index.styl | 47 ----------------------------- examples/examples.html | 4 +-- examples/examples.js | 3 +- examples/filebrowser/index.styl | 52 ++++----------------------------- 4 files changed, 10 insertions(+), 96 deletions(-) diff --git a/examples/classic/index.styl b/examples/classic/index.styl index 0850b15..3b6fc20 100644 --- a/examples/classic/index.styl +++ b/examples/classic/index.styl @@ -55,55 +55,8 @@ text-align: center; border-radius: 2px; } - - - .infinite-tree { - } .infinite-tree-scroll { overflow: auto; max-height: 400px; } - .infinite-tree-table { - width: 100%; - } - .infinite-tree-content { - // Outline removes default browser's borders for focused element. - outline: 0; - - .infinite-tree-selected.infinite-tree-item, - .infinite-tree-selected.infinite-tree-item:hover { - background: #deecfd; - border: 1px solid #0066cc; - } - .infinite-tree-item { - border: 1px solid transparent; - cursor: default; - } - .infinite-tree-item:hover { - background: #f2fdff; - } - .infinite-tree-item.dragover { - border: 1px dotted #ccc; - background-color: #f5f6f7; - } - .infinite-tree-node { - position: relative; - } - .infinite-tree-toggler { - color: #666; - user-select: none; - } - .infinite-tree-toggler:hover { - color: #333; - text-decoration: none; - } - .infinite-tree-title { - cursor: pointer; - user-select: none; - } - } - // centering message that appears when no data provided - .infinite-tree-no-data { - text-align: center; - } } diff --git a/examples/examples.html b/examples/examples.html index b3f5e90..e7ddcdc 100644 --- a/examples/examples.html +++ b/examples/examples.html @@ -62,14 +62,14 @@
-
+
diff --git a/examples/examples.js b/examples/examples.js index 866bece..d77b9aa 100644 --- a/examples/examples.js +++ b/examples/examples.js @@ -1,4 +1,5 @@ import { addClass, removeClass, addEventListener } from '../src/helper'; +import '../src/index.styl'; import * as classic from './classic'; import * as filebrowser from './filebrowser'; @@ -13,7 +14,7 @@ const routes = { const sidebar = document.getElementById('sidebar'); -let activeSectionId = 'classic'; +let activeSectionId = window.location.hash.substr(2) || 'classic'; addClass(document.querySelector('#sidebar [data-section-id="' + activeSectionId + '"]').parentNode, 'active'); addClass(document.querySelector('section[id="' + activeSectionId + '"]'), 'active'); diff --git a/examples/filebrowser/index.styl b/examples/filebrowser/index.styl index 1c9e365..3a81978 100644 --- a/examples/filebrowser/index.styl +++ b/examples/filebrowser/index.styl @@ -28,57 +28,17 @@ margin-right: 5px; } - /* Change the max-height to suit your needs. */ .infinite-tree-content { - } - .infinite-tree { - } - .infinite-tree-scroll { - overflow-y: auto; - overflow-x: hidden; - max-height: 400px; - } - .infinite-tree-table { - width: 100%; - } - .infinite-tree-content { - // Outline removes default browser's borders for focused element. - outline: 0; - .infinite-tree-selected.infinite-tree-item, .infinite-tree-selected.infinite-tree-item:hover { background: #deecfd; - //border: 1px solid #0066cc; - } - .infinite-tree-item { - border: 1px solid transparent; - cursor: default; - } - .infinite-tree-item:hover { - background: #f2fdff; - } - .infinite-tree-item.dragover { - border: 1px dotted #ccc; - background-color: #f5f6f7; - } - .infinite-tree-node { - position: relative; - } - .infinite-tree-toggler { - color: #666; - user-select: none; - } - .infinite-tree-toggler:hover { - color: #333; - text-decoration: none; - } - .infinite-tree-title { - cursor: pointer; - user-select: none; + border-color: transparent; } } - // centering message that appears when no data provided - .infinite-tree-no-data { - text-align: center; + + .infinite-tree-scroll { + overflow-y: auto; + overflow-x: hidden; + max-height: 400px; } } From d8992ccce3bc62142d3a5d963dfec91d606c240b Mon Sep 17 00:00:00 2001 From: Cheton Wu Date: Sat, 16 Apr 2016 17:58:32 +0800 Subject: [PATCH 05/17] Add pack-examples script --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 2fb6691..f62d03e 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "prepublish": "npm run lint && npm test && npm run build && npm run dist && npm run stylus && npm run build-examples && npm run release", "build": "babel --out-dir ./lib ./src", "build-examples": "cd examples; webpack", + "pack-examples": "npm run build-examples && zip -r examples.zip examples/{dist,*.html,*.css}", "test": "./babel-tap --coverage test/*.js", "dist": "webpack; BUILD_ENV=dist webpack", "release": "mkdir -p releases; cp -f dist/infinite-tree.css releases/infinite-tree-${npm_package_version}.css; cp -f dist/infinite-tree.js releases/infinite-tree-${npm_package_version}.js; cp -f dist/infinite-tree.min.js releases/infinite-tree-${npm_package_version}.min.js", From 9eafc514e5f7a92dbdab6eb11f9125cc585834b7 Mon Sep 17 00:00:00 2001 From: Cheton Wu Date: Sat, 16 Apr 2016 18:29:15 +0800 Subject: [PATCH 06/17] Update examples --- examples/classic/index.js | 2 +- examples/common.css | 1 + examples/{classic => }/data.json | 0 examples/default/animation.styl | 22 ++++++ examples/default/index.js | 119 ++++++++++++++++++++++++++++++ examples/default/index.styl | 62 ++++++++++++++++ examples/examples.html | 37 ++++++++-- examples/examples.js | 4 + examples/{classic => }/gendata.js | 0 9 files changed, 239 insertions(+), 8 deletions(-) rename examples/{classic => }/data.json (100%) create mode 100644 examples/default/animation.styl create mode 100644 examples/default/index.js create mode 100644 examples/default/index.styl rename examples/{classic => }/gendata.js (100%) diff --git a/examples/classic/index.js b/examples/classic/index.js index e26e398..3f5b783 100644 --- a/examples/classic/index.js +++ b/examples/classic/index.js @@ -3,7 +3,7 @@ import renderer from './renderer'; import './index.styl'; import './animation.styl'; import { addEventListener, preventDefault, stopPropagation, quoteattr } from '../../src/helper'; -import data from './data.json'; +import data from '../data.json'; const updatePreview = (node) => { const el = document.querySelector('#classic [data-id="preview"]'); diff --git a/examples/common.css b/examples/common.css index af13411..ea8ce4c 100644 --- a/examples/common.css +++ b/examples/common.css @@ -1,5 +1,6 @@ html, body { font-family: Arial, Helvetica, sans-serif; + min-width: 800px; } .navbar .navbar-brand { color: #f0f0f0; diff --git a/examples/classic/data.json b/examples/data.json similarity index 100% rename from examples/classic/data.json rename to examples/data.json diff --git a/examples/default/animation.styl b/examples/default/animation.styl new file mode 100644 index 0000000..62705ec --- /dev/null +++ b/examples/default/animation.styl @@ -0,0 +1,22 @@ +// +// http://stackoverflow.com/questions/6410730/webkit-css-endless-rotation-animation-how +// +@-webkit-keyframes rotating /* Safari and Chrome */ { + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +} +@keyframes rotating { + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +} +.rotating { + animation: rotating 2s linear infinite; +} diff --git a/examples/default/index.js b/examples/default/index.js new file mode 100644 index 0000000..6a4f2c1 --- /dev/null +++ b/examples/default/index.js @@ -0,0 +1,119 @@ +import InfiniteTree from '../../src'; +import './index.styl'; +import './animation.styl'; +import { addEventListener, preventDefault, stopPropagation, quoteattr } from '../../src/helper'; +import data from '../data.json'; + +const updatePreview = (node) => { + const el = document.querySelector('#default [data-id="preview"]'); + if (node) { + let o = { + id: node.id, + name: node.name, + children: node.children ? node.children.length : 0, + parent: node.parent ? node.parent.id : null, + state: node.state + }; + if (node.loadOnDemand !== undefined) { + o.loadOnDemand = node.loadOnDemand; + } + el.innerHTML = JSON.stringify(o, null, 2).replace(/\n/g, '
').replace(/\s/g, ' '); + } else { + el.innerHTML = ''; + } +}; + +const tree = new InfiniteTree(document.querySelector('#default [data-id="tree"]'), { + autoOpen: true, // Defaults to false + droppable: true, // Defaults to false + loadNodes: (parentNode, done) => { + const suffix = parentNode.id.replace(/(\w)+/, ''); + const nodes = [ + { + id: 'node1' + suffix, + name: 'Node 1' + }, + { + id: 'node2' + suffix, + name: 'Node 2' + } + ]; + setTimeout(() => { + done(null, nodes); + }, 1000); + }, + selectable: true, // Defaults to true + shouldSelectNode: (node) => { // Defaults to null + if (!node || (node === tree.getSelectedNode())) { + return false; // Prevent from deselecting the current node + } + return true; + } +}); + +tree.on('contentWillUpdate', () => { + console.log('contentWillUpdate'); +}); +tree.on('contentDidUpdate', () => { + console.log('contentDidUpdate'); + const node = tree.getSelectedNode(); + updatePreview(node); +}); +tree.on('openNode', (node) => { + console.log('openNode', node); +}); +tree.on('closeNode', (node) => { + console.log('closeNode', node); +}); +tree.on('dropNode', (node, e) => { + console.log('dropNode', node); + const source = e.dataTransfer.getData('text'); + const innerHTML = 'Dropped to ' + quoteattr(node.name) + ''; + document.querySelector('#default [data-id="dropped-result"]').innerHTML = innerHTML; +}); +tree.on('selectNode', (node) => { + console.log('selectNode', node); + updatePreview(node); +}); + +tree.loadData(data); + +// Scroll Element +addEventListener(tree.scrollElement, 'scroll', (e) => { + const progress = (tree.scrollElement.scrollTop / tree.contentElement.clientHeight) * 100 || 0; + document.querySelector('#default [data-id="scrolling-progress"]').style.width = progress + '%'; +}); + +// Draggable Element +const draggableElement = document.querySelector('#default [data-id="draggable-element"]'); + +// http://stackoverflow.com/questions/5500615/internet-explorer-9-drag-and-drop-dnd +addEventListener(draggableElement, 'selectstart', (e) => { + preventDefault(e); + stopPropagation(e); + draggableElement.dragDrop(); + return false; +}); + +addEventListener(draggableElement, 'dragstart', (e) => { + e.dataTransfer.effectAllowed = 'move'; + const target = e.target || e.srcElement; + e.dataTransfer.setData('text', target.id); + document.querySelector('#default [data-id="dropped-result"]').innerHTML = ''; +}); + +addEventListener(draggableElement, 'dragend', function(e) { +}); + +const load = () => { + const childNodes = tree.getChildNodes(); + + if (childNodes.length > 0) { + // Select the first node + tree.selectNode(childNodes[0]); + } +}; + +export { + load +} diff --git a/examples/default/index.styl b/examples/default/index.styl new file mode 100644 index 0000000..9bea850 --- /dev/null +++ b/examples/default/index.styl @@ -0,0 +1,62 @@ +@import 'nib' + +#default { + .preview { + font-family: Consolas; + font-size: 14px; + font-weight: bold; + white-space: pre-wrap; + background-color: #282c34; + border: solid 1px #ccc; + color: #9197a3; + padding: 20px; + min-height: 400px; + } + .progress-bar { + -webkit-transition: none; + -moz-transition: none; + -ms-transition: none; + -o-transition: none; + transition: none; + } + .dropped-result { + font-size: 16px; + line-height: 42px; + } + .tree { + border: 1px solid #ccc; + background-color: #fff; + } + + .infinite-tree-toggler { + text-align: center; + margin-right: 5px; + } + .infinite-tree-folder-icon { + width: 19px; + } + .infinite-tree-folder-icon:first-child { + margin-left: 20px; + } + .infinite-tree-folder-icon:before { + margin-right: 5px; + } + + .infinite-tree-node .count { + position: absolute; + right: 4px; + padding: 0 8px; + height: 18px; + line-height: 18px; + background-color: #D8DFEA; + color: #3B5998; + font-style: normal; + font-weight: bold; + text-align: center; + border-radius: 2px; + } + .infinite-tree-scroll { + overflow: auto; + max-height: 400px; + } +} diff --git a/examples/examples.html b/examples/examples.html index e7ddcdc..8161ed7 100644 --- a/examples/examples.html +++ b/examples/examples.html @@ -21,6 +21,7 @@ top: 0; bottom: 0; right: 0; + width: 80%; } #main section { display: none; @@ -62,15 +63,16 @@
- -
- + +
+
@@ -94,11 +96,32 @@
-
+
+
+ +
+ +
+
+
+ + +
+
+
-
-
-
+
+
+
+
diff --git a/examples/examples.js b/examples/examples.js index d77b9aa..9ed8192 100644 --- a/examples/examples.js +++ b/examples/examples.js @@ -1,9 +1,13 @@ import { addClass, removeClass, addEventListener } from '../src/helper'; import '../src/index.styl'; +import * as _default from './default'; import * as classic from './classic'; import * as filebrowser from './filebrowser'; const routes = { + 'default': () => { + _default.load(); + }, 'classic': () => { classic.load(); }, diff --git a/examples/classic/gendata.js b/examples/gendata.js similarity index 100% rename from examples/classic/gendata.js rename to examples/gendata.js From a460263eef7a04eb46badddd5c2f34a3f984d044 Mon Sep 17 00:00:00 2001 From: Cheton Wu Date: Sat, 16 Apr 2016 18:35:28 +0800 Subject: [PATCH 07/17] Update examples --- examples/examples.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/examples.js b/examples/examples.js index 9ed8192..4d908c6 100644 --- a/examples/examples.js +++ b/examples/examples.js @@ -18,7 +18,7 @@ const routes = { const sidebar = document.getElementById('sidebar'); -let activeSectionId = window.location.hash.substr(2) || 'classic'; +let activeSectionId = window.location.hash.substr(2) || 'default'; addClass(document.querySelector('#sidebar [data-section-id="' + activeSectionId + '"]').parentNode, 'active'); addClass(document.querySelector('section[id="' + activeSectionId + '"]'), 'active'); From 50b061a2c463565ae55fe281521272849a0712bf Mon Sep 17 00:00:00 2001 From: Cheton Wu Date: Sat, 16 Apr 2016 20:15:11 +0800 Subject: [PATCH 08/17] Update examples --- examples/examples.html | 7 +++++++ examples/examples.js | 5 ++--- examples/loading.gif | Bin 0 -> 18550 bytes 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 examples/loading.gif diff --git a/examples/examples.html b/examples/examples.html index 8161ed7..05e1e33 100644 --- a/examples/examples.html +++ b/examples/examples.html @@ -23,6 +23,12 @@ right: 0; width: 80%; } +#main .loading { + margin-top: 20px; + background: url("loading.gif") no-repeat 0 0; + width: 60px; + height: 60px; +} #main section { display: none; } @@ -70,6 +76,7 @@
+
diff --git a/examples/examples.js b/examples/examples.js index 4d908c6..5f12a93 100644 --- a/examples/examples.js +++ b/examples/examples.js @@ -16,15 +16,14 @@ const routes = { } }; -const sidebar = document.getElementById('sidebar'); - let activeSectionId = window.location.hash.substr(2) || 'default'; +addClass(document.querySelector('#main .loading'), 'hidden'); addClass(document.querySelector('#sidebar [data-section-id="' + activeSectionId + '"]').parentNode, 'active'); addClass(document.querySelector('section[id="' + activeSectionId + '"]'), 'active'); routes[activeSectionId] && routes[activeSectionId](); -addEventListener(sidebar, 'click', (e) => { +addEventListener(document.getElementById('sidebar'), 'click', (e) => { const target = e.target || e.srcElement; let itemTarget = target; diff --git a/examples/loading.gif b/examples/loading.gif new file mode 100644 index 0000000000000000000000000000000000000000..4d836dd7f095815908511de77b61533e321e7584 GIT binary patch literal 18550 zcmeI4XF${U+P||PgB8Mt00{(07z&7ph?uaa4T#86*|J2If{04Oo(2SDlY|w9EJ4Al z4GaZ`rbC>(;Ht z#>OTlCfm1f-?3wdnVFfnxw(afg_V_+t*x!Sy}g5jgQKJ4&Ye5I`Q{rkne61`v}@Nc z7Z;b^yLY>~y1Kc!xx2f2czAevdU|jCbaeEQBS&ImW8>oDjvhT4A0L10*s+9! zgyYALpEz-XLZMKp)TE@OC;K ze*5jEOP4NRzWm*H-?7>3zP`Tx{(cUJGcYhPI5;>oG{og{hlhtpMncf z-?(w(=FOX~(My(y_dS1$Dw-JaXiVzhNkp6qc~Jo(6N5|C>F-YZx7aIEkU zH&^ZPtV=&7>-tHd!8gy(J4X%G#%zxpQbdo+xHPMBYE0PB&#7O|z9G5DQm4|6cg>I2|~RtRo{ zrodekAM9_FyVY2`Q>?^HumeL@mVO-(*V^!4?57+KGdZQHi-7-DK_%EO4I zr6ms_*4EZGHa0wr*xA{Af)QtD=g%>+1`r-SyuH2G17wXJd~Sq?haWn0XpJ5*F)?33 z$H|i?6B83Z0Z3|U>gNnu0|<{E`T6-@1W0LVDUTuL<>fq#R8>{|5k^=n)_RhhJ$v?# zVA9>)-P6;v9wt|=Tv_8uZ*MOTDSwhD|8bc7@WT&$p73DucP7bt3~0KnVc>|FFhLeW z?8S-!w(~GRuKchk=Bxi^L1;H3qm7qpY zQlrA|;o@!am=a;PPK2ch%Pdj2bX#eDBsbZOR~#)t@5UBoQZ{W2gf!&TRg(}NzIGIA!^PRtWUG5L5jmG& zHBaX&eK3p{$QO#qCI<%;y4m&2o!NWq%v@>M`NerFQP3C!Ik$b7TOqY!3sRa0z=GlC zb=Uxn^oR_bY;h0?RBy#$|UJA>JciGF92Gdw-pRdtbfqFN+fy47%aF zL8OjFp5W0YAIISJhekEAyXBX>&D?# zR68zLA>HC?9>Ktu5g1#Cp&qOkZMb!?p_OYF-cvCv9p3&-sRmKyl!$-@c(^-jlX~;8 z=pb_oJ+!KmFhe`i-=Evsy%0V-q9B~Fmwc{uVwy$TKWH&{ps`cyVVrrgwN)<2k`y&? z2Qh9de<(p~ue`a-k=ANpXjpU6A#~WI%l-z!Tuw&&I|Rlb9frUJFKAaN!et5srJ>f? z)vhXcP+e|Ov2cjQ;Zk2~d68{f?+v#~K93n2GOQ@dE2EqxNc+di{1XG`{{L&}R}5e< znDv2zhk>;yp{J+EV}PNd;aZg71Avz!_yFKd|Ic&8Cji*9XAeJ0d?iO5IB?+e9I>7U zYiWWYOq|p9gI|JJxx+ zf70DcRAJTUjy6zKz+KO0GBU^66{0#fMZBlZ7}_9EdJ!Y7rX`OqPOj{lr{1Xc!l6YE z0|7bRbz7cdv}t!#u30Xm~iEMBBiFJC1s`VCqpk_MQf&QQH-*d)WLpBl!3^_YQ z#vONL$eW0L0Fg%_K57y_|ggk8ye82G0XCPrJAV&lS4eG6IQs*0lu`QG!+G zi%Z|JB}AgfrohGLEIQK54x!8x%VO>ZKdlf^8-~anFbEF7=OuTf6F4F@vk7nXB5Mlk zESSS8{s>O8m=)_nP*GhmYNYy7a0j-sE+JjRj)7FsOz#Ma(ln>)NoSsZ+o7%Uv=I{A z0hK63IWJ^)0Nw}UI|m~ND-SpXt7(;XHw-sHBYQbYH+?d+YieFjV~&-{Uo9fo?bE8P z&kG8bxR9xTj82%kHHp-+YhfI0U1||}PHeU?;~pZkhgzU#HgpWuqqm2=)V?B)vb`jr z!(>rZqQrIV>Ug15iz@nIv|71E&pq%F%HjpFGTcV5Pt>wwP#)YmO>cv|XlF%4QM;|B znslNDL#6_xtvf4k5FRNV;ONy~pPw_K4UZu%q}?19M?q5}Kin^<%6m>?)JrGHW{!Xr zbUe~#TnWrm;7IXGVlusa?ylHdcUryA?cjqcK;Z9z;1d$8S4((2o^O}dc(4`=cy?)x z2WwtwEfbJPq&2U!77M;eh4pr6JrcfXm-uSwi&Xeu)zTMv@Od)$1O~itu%?!HQt1;6 z{Pj$*9s_*G^j9$OZ-;~bYNjtrv-Kp13R@#Vd?1U^O(FK;)lt8a0K*X3h_}PP>!bWi z0(E^K3yEG4ILvMYYvwmn5O|`P5ae%Fa7GkXdXM(Rms=(>eMwg(1A`WKNkr9j_|#iV zNYRW9e(Y-`Zd723N{UC*^AJ0r&XL|0q5T#+91IkTpFn%%)M4}7ZRGrPk%$L~@tVQi zz1{oDGcDh#uCSF+fs!#&0|C~XH?m}vf|jfu&n9c87jKJ8P3lDNbUh&!~>D2;ta95HV+Um9fL$W z6_ZlLcUX)mWy|bF0)VJ=49OErp;pW6y9Dzm85G7$|4sta*#R-HBR#T3z+^&TvFDND zT0eI?-N0h^fW`T;h(SVe{=VWd|DuiQn7&xG8_YDh5LmHalIzE|UfL_$hyuBHy?HiO z?ju1UAP^GZ85bp5lX|*DC151=n~@nrnkeN}y*#QEFN7~mG;1U+;+7WhQN)&!#-?kE zvnq7D$D&=+*(=6E=ny3HabZg_$gWW=7#4iAu2?0^x^96X$aqVkJP{~Lkc}N+GTjzmusEO&C1ux zw=sLrIK;rA)9$`$7;YEnvK#%bcqFvdRV?$FOI7kJ0nYf&_<@f~#KKz)Bi_xyCaw;5 zt2HLyYun4D_q{8sL%?5}bZ=~uDX>x5?wK7!8qvS+)0LdK|#pxv%l+qrU2gT$6~Rc2Lb-nU+;tXS%6n4@O{vl4Ej6{@CN@M zC4x`lz*?uUri9kF313VBUvWc!QVj9O|DSO~U(5n)6~mv;0=$ZW9|S&!z`xNo{6~t0 z&$Gbat!UuQ{?Ol3Kv(?g+Uze&P9SvqnD^q%aKEJhrj!{k1uXcQ(|NPsZmAt2$&*29 zaQAk6?e%R=T**tfp4{NcpkcO~^Rm57nF!djhZ#AgC=+%9b!i5>#3pVq!5roarrxB4 zc{!jLfI(-q6k3qDU6cja)U0^eJqxmpBvsdYe6JDt7NYf#K)A0&6U&VnHmLG}89jv( zvxW|4nq5#WQ`>`hds(GM{T5Lv-atxLC^hX{MZb3Os1&IgrIY6omO4lmG4OVS`YRo? zS@x7p;^I!ZQ1P>rGVid&=}GmbJNq@EhTS$cAldKosP8*CORHH@^B;FYUu(R1o8@G6 z2q%$}^Yll;584@1plN0O;_CjVc-x~?sZK?Xm1J>y~i1+)M* zZ}@HY*GK2KIaMCr^Ja8oLh?b}PUxXR$Qk+4(FPq3@pW)EHJ?s$hi;2>)o09E6`tYsI0T+LJN5 z)cluuWnuZz-eoq-23(e#Z2GB=C55F%nGRGst{>=#)FE6zSKrACaYSCR{>AMq!`EJY zsoruwzYh3>0E&u=e*^(uvCOkUYbf}{1`&xw-s}JCPUw%u{~vYB{MY{{tul`TYt;a+ zRsOsk;8n{1>fm2%mH$jH@Wt`JUIney%U>x4_yORr_X2;tXMXzh>3^%{^)X;Q0Zx2a zBS0ygODOiklD1m^MgZ?>Wio=>BMzsN>W5SfXvVAHfkrmN2|9?A9kiTi-H;g)fG1qb zs{{9EV_7szAq}k7!@B57uQTh2S6cD7D&~{qr!IV^7IlHzNPTUZ3&U=(_kYzS;?xUDPzd>!e!3kE@4|u2@IXR`M>ha}|j2iR? z<599u)g|=wYds60-55I3Dh_shirNGYFLKpzAT!`Wg_XkWmjXd)y95fW^hq!`HXt#ouMwz!%|p4F9?%vb!a z4j`zRpUC#9E%ZSP20(>{0f`VOK$lc_q6Ry3G}Dm)1PJQ_*k=?S2v5sn?k;*oOl{6* zp58%cKRFEf*-|y{guzcZDGZto$R31`+vJtXYN}-!M9BH+)Q=v}AT1o6JfmGIe5P7E zsaA3%8!$h?g@9*i>gLP!Fil&Q^{prfOxOkxMBQ|QwV3zTJsx6)w|k{k5RAt5)}jX{ zr{b+=y>Suordp50q3rY0tdt;Xd0aj{B2nmAIL;rN^T6urMGt~Th)&LE1RFAB9Mf`v zVyHr}9ua+(cgbLiI~sdM;9ffJ@lHV^v~_6!un#@#9C5|5(pSgfBO(>o7mzJiFRh%c83xbk0y8+@bABjqY!DuztOW?|^s|;A@~y91!pS9KRIiw*h?h^GCh#=ktGkJN%Ur;7{%o zeZEPw)&hSr?bk08{rSf}f8g`FVE$u&eGB|AS^s}q_pDzm`il7fn=cmeSinQT-rqw& zOJ@-2x5c1>E2D&oYU|$3j`-gi;cAurybv&f8)EQ6fb*^VK?z<6*nXTa!wUiCq03(5 z9rJTG6j^hW!);Dozj?3+igVk4hFA=~EjhN>ZYy3bx){XJq&4iKkOk@%$D%P6O2KW0 zHJ$TWS1J3G5!t8|dJz*$cwOA+>aAtcj2N6-Lfrg5DOB{-S$o=U`5eW(7P!f>#NY)( z!r64^XiSs3)@-={;f1TE-$3$ER>KAd=kQo2`6U-|%3>Vkezdg0Ikt&XS(+Wx_igo@ zL7eVeo$e@0i3e6Y#zMdAZ9a)4*j6KrQEXgyuu7?umkbE33R{K8gjm)3)P%k?oYg=v46sTC zt7$V>3E9#98d&@A-lLV&2|HUKt1-2Rmk0aYvFW+9Y+!Yq97i!F&~AWK(s{Jwz<$fo zPIOtkhZ_XE_0mXQxcZIBJ!b`*iA(1WdMxeHY6!WQT3>LDe73VT9(B;+l6@q9xC6v^|GHYeE4fXyth72`0xh(7k7a8 zo$u$i=ijS+zpi?|IQ_q}P5SwBpTA1V^E_X9=>Myu|NqGI{CB7HlMLYgI{=znBGv%F zye6y34ZxC&y>x$T0P3^?@umzn3%{Y$B8nvp)y%0v6^LbIk1uM@);dNVHG9sgp4SeG z>~-ITtaeN*URVy^Iw~$>3d!=i_Y+5qRIhu=a8)&ruDrn&YTAyc?G$H$f0ATWcQNqB zfgv3p{YU6#)Ie^>`*)oBySq=gNX?pSG!v~;#ok=PchNOB8a?fdk+z>aWJ z(+A|8v#>?LnPV;mjN7AGExlL9Xv*f-&V7uYoqUH;H&3`EB=ZBA^-RM;?tRINv@QQg zJ=F?ue8(xQa8Do2IKN*Qtndxkd7U{4 zx-p-2r$oL{UxOwEoW_YZpWRYNyswy9u9^LjHL|O}Bv?5&l{N}Q+8V2mq$+HfnAWsp z^SlvFB^h2{EPIiOHS)gK=kj6RMDG5Ir`4t zfADQDfNcXVxu&HB01%O)Fq3PU?fO}<0$|j*+NcDy`GG!(h{l{#E?O$wE3P#D907!cS#}a5Qex0ky&>A)nviQ@5sElP0ERqz8+O+KRYO>VWM@%ZN#j^c~^W>z^Pk^J4-6q7LYm6)Ck@}Gz*hPg#`pH_mflK zZJ1v)oYUMC{a!R|b6U=H&RLAYEwquoE2nDD^?UhS=N=7)dyX+vx(d}NLAy5wAB;Zq z&8-lTRFCcTQ6r;uNy^$KPDg_(Mr={kkI4Gj1?w*7p7;o zR8KH-8aHK$pC%@d+aY2Lwbr9y@*y+RX|8W~%uikZCO`sETP zjgUNkAd^H)%84m7hhH~DggSv4+pv1}X)A3MK-T@$HYP zoo#vtgrkX?G?a#H1PPkl(T$MWR?hC1h8+gk=Pu zEXc8g19eG%I*Jm)+0(Gfl9)YJ%FoHJTJ{sjXI7=!*hf&oOIt_NMb6sMP|Emgk_sHA zL0Z#4Ty4ov8Kl7hvc?1*f5c9^ZMIM70|E$u=tTAogG#2gDV{Ms8>NtJudAgHr^sIR z>1$gfVq7@7^F+gR+fk5Er*;_0lRd)3DwelxEQ195_Csq2xz=R@Dej|C#pl~pmF-gZ z5=r*ts|R#sCWzku^g^AV#e($^_~hn{Uk$8B0q^pRcQvpc2)w4?D}soBg0_|$K4-$` zj_8X(;B^G+necgT;2)oTkqnYRa<3RB5v7i$nW%e5fnq}QJS#48wW_3y-4~#}#uvP-U%rayTNDiGA-L5}k)J8^A zm3}F<$cQSaEdlH3OV zB96RGIww2#Q^$O(`ON%H8FWhR_8;Fi&s>fDknr8fw4>fDRgqp}Q9ytoE71}O4zC%N zcQa^DB|3W1`vgFMHll=xzKepiQ!|$7rX$eKhHC)Eux9lG?SsmrXMf{B&=V`bEXyx< zi)g1ek|;RFkx_VF{6t_oVl{ zDc%$;%yHrAW9>)_S&lMAYCIVsm>2;%U=Yp>E`w4cND>*3Y+NN4K~XL?66lv2Gu0=S z+SnDZ&N8NsqxJNYfW|R)6%Cub#aUKG!k*8G=OAb9xVGh>QmEbA$F|B?knIy#`@01zM&vmLNEYke;dRw3Vo+^adn>b?zahpPYyUv2zC~TGmI? z<%<#S2nYxU5nxa~HvzDRVtocR$&w1F8cmX0;__MIQQmH7Y-pG+*rgM>sHY>OO?(A^ z;?WmWsr^iMla6sYyNMzRZ3g#&2C&naKiojNvBKRitz@U*+(rciB@O!Fy0^LMRDoVk zTB*=um>K6GUkSDS&)L6r9-yYC#y>gciy?jh;I{#MJ;dJ%`lBnc_3NPgV`IJ^;thKr zAD{L6Kzu#KZvc31i1+B{9RvKUGk*Q+pMPomzg~&0fBJuZ6~I3>{$$esnE=2q2mazZ z=wFmXUnvLvZdU<(E5w`qKEKcYHYLZk+25dkShJh^O|Na1-LDzIo09@jcE=eFpZYZe zSUq3O^tPlnCp*&9o73xdW{ zYt;#g+?bG?c}_nk3M;H?_E+1&mxSG2r>f7l+3A!9OBYq)`~*~9dt}!4mf?POd(A}! zfBXx z5hgavJZ%b)1)dKl)z$pW^x~)hkdL9t_oOSM#AzyAkt+c=X#F4=XXcX=oVqQ&Drmq* zlPO)dZ=Fn{X44NY%uoWQ>#oZrY=(=K&56xT!ItTl61t)aR$zx=?d_HczrZb&DR4u) z^%0S~UFo}CVs)vKLzdlRDkFtXf(js8y*}7WAen@c*XLBEMNRCfR3>Wcs)!O)X48}x z#&$o+HF>k}*b!1V^F*b6! z7bf>n);lq7Ik`U_jcEfwkslX^3f$wl^4cYPFIbj4J;D!3+Xme`P2ZpI@6N#g)Gm-T zxmECc^DIfmy=svoQEEy@@8JcYVhLnHD*Or)kF;%0qop63ncAOIi<4WZSQcz2lf@JXY~9`o43YC4jV;dm@5u zM%p9f0y$*eXA?c4FSGKj$Y>P5|DVtQPY|%S8MHnDtR0E*9{%gQ0p63JKmWhD7Q{Og zUjMNP-dfNXO9H+FTK~O?wVr@?4zOMTeQ`1L6Ai?B=JT$E`QMoM;_&A`^Lh2a`V(RP z2PXbZF|aoI|08=qpL?Hw^^+5S@_Q5i^*;Pj|3`mWj{qafH3Wn!NfKm(v7}w)&cC$+ zasV+z)Qror6D~(_mtnIXoufpRg4a2xI|q!YDn>|ZuOvbp^1+UlAY;oPv{-089iYehhcb+M-Jdmqa1mrU)CCtFe}ss!KiIO12xd zB>~&pGCPBUMjBnt>2G@E59n_rZjptJkCiTs?JYTltUX?g5CjS*fbGXKr4BXP98IAth)m4`A6`gR@Q*Q) zE94$Z6)gu za~bmV&g^t&YQ7M+$`!8bfYu0ar%DJv9pl0)Pn*sL!PSB;l;*Z#^8IDg6(Y!<9ZT}Cuy(BmQ literal 0 HcmV?d00001 From 157c72bd8c467d4103c0463744db2f1380e457d8 Mon Sep 17 00:00:00 2001 From: Cheton Wu Date: Sat, 16 Apr 2016 20:46:21 +0800 Subject: [PATCH 09/17] Update examples.html --- examples/examples.html | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/examples/examples.html b/examples/examples.html index 05e1e33..5fb8959 100644 --- a/examples/examples.html +++ b/examples/examples.html @@ -103,6 +103,13 @@
+
+
+
+
+
+
+
@@ -131,6 +138,13 @@
+
+
+
+
+
+
+
From d3ccb19b6486b09f3606f969c85fa6ce17dfef5b Mon Sep 17 00:00:00 2001 From: Cheton Wu Date: Sat, 16 Apr 2016 22:54:21 +0800 Subject: [PATCH 10/17] Adds nodeIdAttr option to specify the node id attribute in each tree item --- src/infinite-tree.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/infinite-tree.js b/src/infinite-tree.js index dd04419..0c3a5b7 100644 --- a/src/infinite-tree.js +++ b/src/infinite-tree.js @@ -42,6 +42,7 @@ class InfiniteTree extends events.EventEmitter { el: null, layout: 'div', loadNodes: null, + nodeIdAttr: 'data-id', noDataClass: 'infinite-tree-no-data', noDataText: 'No data', rowRenderer: defaultRowRenderer, @@ -86,7 +87,7 @@ class InfiniteTree extends events.EventEmitter { return; } - const id = itemTarget.getAttribute('aria-id'); + const id = itemTarget.getAttribute(this.options.nodeIdAttr); const node = this.getNodeById(id); if (!node) { @@ -157,7 +158,7 @@ class InfiniteTree extends events.EventEmitter { preventDefault(e); if (this.dragoverElement) { - const id = this.dragoverElement.getAttribute('aria-id'); + const id = this.dragoverElement.getAttribute(this.options.nodeIdAttr); const node = this.getNodeById(id); removeClass(this.dragoverElement, this.options.dragoverClass); From f38fe6d1befd9a6c25b22318ddc20c839840b0d9 Mon Sep 17 00:00:00 2001 From: Cheton Wu Date: Sat, 16 Apr 2016 22:54:38 +0800 Subject: [PATCH 11/17] Renamed aria-* to data-* --- src/renderer.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/renderer.js b/src/renderer.js index 6d9c3a6..1311506 100644 --- a/src/renderer.js +++ b/src/renderer.js @@ -39,13 +39,13 @@ const defaultRowRenderer = (node, treeOptions) => { }); return buildHTML('div', treeNode, { - 'aria-id': id, - 'aria-expanded': more && open, - 'aria-depth': depth, - 'aria-path': path, - 'aria-selected': selected, - 'aria-children': childrenLength, - 'aria-total': total, + 'data-id': id, + 'data-expanded': more && open, + 'data-depth': depth, + 'data-path': path, + 'data-selected': selected, + 'data-children': childrenLength, + 'data-total': total, 'class': classNames( 'infinite-tree-item', { 'infinite-tree-selected': selected } From 5475d0f7ed2c7e379bc93e1f9a4db984917a1319 Mon Sep 17 00:00:00 2001 From: Cheton Wu Date: Sat, 16 Apr 2016 22:54:47 +0800 Subject: [PATCH 12/17] Renamed aria-* to data-* --- examples/classic/renderer.js | 14 +++++++------- examples/filebrowser/renderer.js | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/examples/classic/renderer.js b/examples/classic/renderer.js index 6f07147..c3b55f9 100644 --- a/examples/classic/renderer.js +++ b/examples/classic/renderer.js @@ -68,13 +68,13 @@ const renderer = (node, treeOptions) => { }); let treeNodeAttributes = { - 'aria-id': id, - 'aria-expanded': more && open, - 'aria-depth': depth, - 'aria-path': path, - 'aria-selected': selected, - 'aria-children': childrenLength, - 'aria-total': total, + 'data-id': id, + 'data-expanded': more && open, + 'data-depth': depth, + 'data-path': path, + 'data-selected': selected, + 'data-children': childrenLength, + 'data-total': total, 'class': classNames( 'infinite-tree-item', { 'infinite-tree-selected': selected } diff --git a/examples/filebrowser/renderer.js b/examples/filebrowser/renderer.js index 0933c9b..ac557c3 100644 --- a/examples/filebrowser/renderer.js +++ b/examples/filebrowser/renderer.js @@ -80,13 +80,13 @@ const renderer = (node, treeOptions) => { }); return buildHTML('tr', columnName + columnSize + columnType + columnDate, { - 'aria-id': id, - 'aria-expanded': more && open, - 'aria-depth': depth, - 'aria-path': path, - 'aria-selected': selected, - 'aria-children': childrenLength, - 'aria-total': total, + 'data-id': id, + 'data-expanded': more && open, + 'data-depth': depth, + 'data-path': path, + 'data-selected': selected, + 'data-children': childrenLength, + 'data-total': total, 'class': classNames( 'infinite-tree-item', { 'infinite-tree-selected': selected } From 9b224befcd777c678901f6b5b87646e4d0257f0c Mon Sep 17 00:00:00 2001 From: Cheton Wu Date: Sat, 16 Apr 2016 22:54:58 +0800 Subject: [PATCH 13/17] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 15fefb7..89fbc39 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,8 @@ var tree = new InfiniteTree({ done(null, nodes); }, 1000); }, + // The id attribute of the node + nodeIdAttr: 'data-id', // Return false to prevent selecting a node shouldSelectNode: function(node) { if (!node || (node === tree.getSelectedNode())) { From e7fa5baed34e6c5a01838c678824e223d7ae4184 Mon Sep 17 00:00:00 2001 From: Cheton Wu Date: Sat, 16 Apr 2016 23:00:05 +0800 Subject: [PATCH 14/17] Update README.md --- README.md | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 89fbc39..60941c5 100644 --- a/README.md +++ b/README.md @@ -61,28 +61,22 @@ var data = { var tree = new InfiniteTree({ el: document.querySelector('#tree'), data: data, - // Open all nodes - autoOpen: true, - // Droppable elements - droppable: true, - // Load nodes on demand - loadNodes: function(parentNode, done) { + autoOpen: true, // open all nodes + droppable: true, // droppable + loadNodes: function(parentNode, done) { // load node on demand var nodes = []; setTimeout(function() { // Loading... done(null, nodes); }, 1000); }, - // The id attribute of the node - nodeIdAttr: 'data-id', - // Return false to prevent selecting a node - shouldSelectNode: function(node) { + nodeIdAttr: 'data-id', // the node id attribute + shouldSelectNode: function(node) { // determine if the node is selectable if (!node || (node === tree.getSelectedNode())) { - return false; // Prevent from deselecting the current node + return false; // prevent from deselecting the current node } return true; }, - // Render tree nodes with your own way - rowRenderer: function(node, treeOptions) { + rowRenderer: function(node, treeOptions) { // customizable renderer return '
' + node.name + '
'; } }); From 9f02d51cd29032d63d9d9dd2b6e47e9ea05a4877 Mon Sep 17 00:00:00 2001 From: Cheton Wu Date: Sat, 16 Apr 2016 23:00:25 +0800 Subject: [PATCH 15/17] Add droppableAttr option --- src/infinite-tree.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/infinite-tree.js b/src/infinite-tree.js index 0c3a5b7..33977e3 100644 --- a/src/infinite-tree.js +++ b/src/infinite-tree.js @@ -39,6 +39,7 @@ class InfiniteTree extends events.EventEmitter { autoOpen: false, dragoverClass: 'infinite-tree-dragover', droppable: false, + droppableAttr: 'droppable', el: null, layout: 'div', loadNodes: null, @@ -125,11 +126,11 @@ class InfiniteTree extends events.EventEmitter { removeClass(this.dragoverElement, this.options.dragoverClass); this.dragoverElement = null; - if (!(itemTarget.hasAttribute('droppable'))) { + if (!(itemTarget.hasAttribute(this.options.droppableAttr))) { return; } - const canDrop = !(itemTarget.getAttribute('droppable').match(/false/i)); + const canDrop = !(itemTarget.getAttribute(this.options.droppableAttr).match(/false/i)); if (canDrop) { addClass(itemTarget, this.options.dragoverClass); this.dragoverElement = itemTarget; From 54b0e1b92f0f4ae9ab94725ceb5f06bec36260b4 Mon Sep 17 00:00:00 2001 From: Cheton Wu Date: Sat, 16 Apr 2016 23:29:33 +0800 Subject: [PATCH 16/17] Update infinite-tree.js --- src/infinite-tree.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/infinite-tree.js b/src/infinite-tree.js index 33977e3..e4d547a 100644 --- a/src/infinite-tree.js +++ b/src/infinite-tree.js @@ -43,9 +43,9 @@ class InfiniteTree extends events.EventEmitter { el: null, layout: 'div', loadNodes: null, - nodeIdAttr: 'data-id', noDataClass: 'infinite-tree-no-data', noDataText: 'No data', + nodeIdAttr: 'data-id', rowRenderer: defaultRowRenderer, selectable: true, shouldSelectNode: null, From 900255ffdaab742c0d53ff274fae3351c2b8121d Mon Sep 17 00:00:00 2001 From: Cheton Wu Date: Sat, 16 Apr 2016 23:31:08 +0800 Subject: [PATCH 17/17] v1.0.0 --- dist/infinite-tree.js | 24 +++++++++++++----------- dist/infinite-tree.min.js | 4 ++-- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/dist/infinite-tree.js b/dist/infinite-tree.js index 031fa89..50cefae 100644 --- a/dist/infinite-tree.js +++ b/dist/infinite-tree.js @@ -138,11 +138,13 @@ return /******/ (function(modules) { // webpackBootstrap autoOpen: false, dragoverClass: 'infinite-tree-dragover', droppable: false, + droppableAttr: 'droppable', el: null, layout: 'div', loadNodes: null, noDataClass: 'infinite-tree-no-data', noDataText: 'No data', + nodeIdAttr: 'data-id', rowRenderer: _renderer.defaultRowRenderer, selectable: true, shouldSelectNode: null, @@ -185,7 +187,7 @@ return /******/ (function(modules) { // webpackBootstrap return; } - var id = itemTarget.getAttribute('aria-id'); + var id = itemTarget.getAttribute(_this.options.nodeIdAttr); var node = _this.getNodeById(id); if (!node) { @@ -224,11 +226,11 @@ return /******/ (function(modules) { // webpackBootstrap (0, _helper.removeClass)(_this.dragoverElement, _this.options.dragoverClass); _this.dragoverElement = null; - if (!itemTarget.hasAttribute('droppable')) { + if (!itemTarget.hasAttribute(_this.options.droppableAttr)) { return; } - var canDrop = !itemTarget.getAttribute('droppable').match(/false/i); + var canDrop = !itemTarget.getAttribute(_this.options.droppableAttr).match(/false/i); if (canDrop) { (0, _helper.addClass)(itemTarget, _this.options.dragoverClass); _this.dragoverElement = itemTarget; @@ -257,7 +259,7 @@ return /******/ (function(modules) { // webpackBootstrap (0, _helper.preventDefault)(e); if (_this.dragoverElement) { - var id = _this.dragoverElement.getAttribute('aria-id'); + var id = _this.dragoverElement.getAttribute(_this.options.nodeIdAttr); var node = _this.getNodeById(id); (0, _helper.removeClass)(_this.dragoverElement, _this.options.dragoverClass); @@ -2367,13 +2369,13 @@ return /******/ (function(modules) { // webpackBootstrap }); return (0, _helper.buildHTML)('div', treeNode, { - 'aria-id': id, - 'aria-expanded': more && open, - 'aria-depth': depth, - 'aria-path': path, - 'aria-selected': selected, - 'aria-children': childrenLength, - 'aria-total': total, + 'data-id': id, + 'data-expanded': more && open, + 'data-depth': depth, + 'data-path': path, + 'data-selected': selected, + 'data-children': childrenLength, + 'data-total': total, 'class': (0, _helper.classNames)('infinite-tree-item', { 'infinite-tree-selected': selected }), 'droppable': true }); diff --git a/dist/infinite-tree.min.js b/dist/infinite-tree.min.js index b82d425..5ff9a87 100644 --- a/dist/infinite-tree.min.js +++ b/dist/infinite-tree.min.js @@ -1,3 +1,3 @@ /*! infinite-tree v0.9.0 | (c) 2016 Cheton Wu | MIT | https://github.com/cheton/infinite-tree */ -!function(root,factory){"object"==typeof exports&&"object"==typeof module?module.exports=factory():"function"==typeof define&&define.amd?define([],factory):"object"==typeof exports?exports.InfiniteTree=factory():root.InfiniteTree=factory()}(this,function(){return function(modules){function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={exports:{},id:moduleId,loaded:!1};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.loaded=!0,module.exports}var installedModules={};return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.p="",__webpack_require__(0)}([function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}var _infiniteTree=__webpack_require__(1),_infiniteTree2=_interopRequireDefault(_infiniteTree);module.exports=_infiniteTree2["default"]},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol?"symbol":typeof obj},_events=__webpack_require__(2),_events2=_interopRequireDefault(_events),_clusterize=__webpack_require__(3),_clusterize2=_interopRequireDefault(_clusterize),_flattree=__webpack_require__(4),_lookupTable=__webpack_require__(8),_lookupTable2=_interopRequireDefault(_lookupTable),_renderer=__webpack_require__(9),_helper=__webpack_require__(10),error=function(){for(var _len=arguments.length,args=Array(_len),_key=0;_len>_key;_key++)args[_key]=arguments[_key];if(console&&console.error){var prefix="[InfiniteTree]";console.error.apply(console,[prefix].concat(args))}},ensureNodeInstance=function(node){return node?node instanceof _flattree.Node?!0:(error("The node must be a Node object."),!1):!1},InfiniteTree=function(_events$EventEmitter){function InfiniteTree(el,options){_classCallCheck(this,InfiniteTree);var _this=_possibleConstructorReturn(this,_events$EventEmitter.call(this));return _this.options={autoOpen:!1,dragoverClass:"infinite-tree-dragover",droppable:!1,el:null,layout:"div",loadNodes:null,noDataClass:"infinite-tree-no-data",noDataText:"No data",rowRenderer:_renderer.defaultRowRenderer,selectable:!0,shouldSelectNode:null,togglerClass:"infinite-tree-toggler"},_this.state={openNodes:[],rootNode:null,selectedNode:null},_this.clusterize=null,_this.nodeTable=new _lookupTable2["default"],_this.nodes=[],_this.rows=[],_this.scrollElement=null,_this.contentElement=null,_this.dragoverElement=null,_this.contentListener={click:function(e){var itemTarget=null,clickToggler=!1;for((0,_helper.stopPropagation)(e),e.target&&e.currentTarget?itemTarget=e.target!==e.currentTarget?e.target:null:e.srcElement&&(itemTarget=e.srcElement);itemTarget&&itemTarget.parentElement!==_this.contentElement;)(0,_helper.hasClass)(itemTarget,_this.options.togglerClass)&&(clickToggler=!0),itemTarget=itemTarget.parentElement;if(itemTarget){var id=itemTarget.getAttribute("aria-id"),node=_this.getNodeById(id);if(node)return clickToggler?void _this.toggleNode(node):void _this.selectNode(node)}},dragenter:function(e){var itemTarget=null;for(e.target&&e.currentTarget?itemTarget=e.target!==e.currentTarget?e.target:null:e.srcElement&&(itemTarget=e.srcElement);itemTarget&&itemTarget.parentElement!==_this.contentElement;)itemTarget=itemTarget.parentElement;if(itemTarget&&_this.dragoverElement!==itemTarget){if((0,_helper.removeClass)(_this.dragoverElement,_this.options.dragoverClass),_this.dragoverElement=null,!itemTarget.hasAttribute("droppable"))return;var canDrop=!itemTarget.getAttribute("droppable").match(/false/i);canDrop&&((0,_helper.addClass)(itemTarget,_this.options.dragoverClass),_this.dragoverElement=itemTarget)}},dragend:function(e){_this.dragoverElement&&((0,_helper.removeClass)(_this.dragoverElement,_this.options.dragoverClass),_this.dragoverElement=null)},dragover:function(e){return(0,_helper.preventDefault)(e),e.dataTransfer.dropEffect="move",!1},drop:function(e){if((0,_helper.preventDefault)(e),_this.dragoverElement){var id=_this.dragoverElement.getAttribute("aria-id"),node=_this.getNodeById(id);(0,_helper.removeClass)(_this.dragoverElement,_this.options.dragoverClass),_this.dragoverElement=null,_this.emit("dropNode",node,e)}}},(0,_helper.isDOMElement)(el)?options.el=el:options=el,_this.options=(0,_helper.extend)({},_this.options,options),_this.options.el?(_this.create(),options.data&&_this.loadData(options.data),_this):(console.error("Failed to initialize infinite-tree: el is not specified.",options),_possibleConstructorReturn(_this))}return _inherits(InfiniteTree,_events$EventEmitter),InfiniteTree.prototype.create=function(){this.options.el||error("The element option is not specified.");var tag=null;if(this.scrollElement=document.createElement("div"),"table"===this.options.layout){var tableElement=document.createElement("table");tableElement.className=(0,_helper.classNames)("infinite-tree","infinite-tree-table");var contentElement=document.createElement("tbody");tableElement.appendChild(contentElement),this.scrollElement.appendChild(tableElement),this.contentElement=contentElement,tag="tr"}else{var _contentElement=document.createElement("div");this.scrollElement.appendChild(_contentElement),this.contentElement=_contentElement,tag="div"}this.scrollElement.className=(0,_helper.classNames)("infinite-tree","infinite-tree-scroll"),this.contentElement.className=(0,_helper.classNames)("infinite-tree","infinite-tree-content"),this.options.el.appendChild(this.scrollElement),this.clusterize=new _clusterize2["default"]({tag:tag,rows:[],scrollElem:this.scrollElement,contentElem:this.contentElement,no_data_text:this.options.noDataText,no_data_class:this.options.noDataClass}),(0,_helper.addEventListener)(this.contentElement,"click",this.contentListener.click),this.options.droppable&&((0,_helper.addEventListener)(document,"dragend",this.contentListener.dragend),(0,_helper.addEventListener)(this.contentElement,"dragenter",this.contentListener.dragenter),(0,_helper.addEventListener)(this.contentElement,"dragover",this.contentListener.dragover),(0,_helper.addEventListener)(this.contentElement,"drop",this.contentListener.drop))},InfiniteTree.prototype.destroy=function(){for((0,_helper.removeEventListener)(this.contentElement,"click",this.contentListener),this.options.droppable&&((0,_helper.removeEventListener)(document,"dragend",this.contentListener.dragend),(0,_helper.removeEventListener)(this.contentElement,"dragenter",this.contentListener.dragenter),(0,_helper.removeEventListener)(this.contentElement,"dragover",this.contentListener.dragover),(0,_helper.removeEventListener)(this.contentElement,"drop",this.contentListener.drop)),this.clear(),this.clusterize&&(this.clusterize.destroy(!0),this.clusterize=null);this.contentElement.firstChild;)this.contentElement.removeChild(this.contentElement.firstChild);for(;this.scrollElement.firstChild;)this.scrollElement.removeChild(this.scrollElement.firstChild);if(this.options.el)for(var containerElement=this.options.el;containerElement.firstChild;)containerElement.removeChild(containerElement.firstChild);this.contentElement=null,this.scrollElement=null},InfiniteTree.prototype.addChildNodes=function(newNodes,index,parentNode){var _this2=this;if(newNodes=[].concat(newNodes||[]),0===newNodes.length)return!1;if("object"===("undefined"==typeof index?"undefined":_typeof(index))?(parentNode=index||this.state.rootNode,index=parentNode.children.length):parentNode=parentNode||this.state.rootNode,!ensureNodeInstance(parentNode))return!1;newNodes.forEach(function(newNode){newNode.parent=parentNode}),parentNode.children.splice.apply(parentNode.children,[index,0].concat(newNodes)),index=parentNode.children.indexOf(newNodes[0]);var deleteCount=parentNode.state.total,nodes=(0,_flattree.flatten)(parentNode.children,{openNodes:this.state.openNodes}),rows=nodes.map(function(node){return _this2.options.rowRenderer(node,_this2.options)});if(parentNode===this.state.rootNode)this.nodes=nodes,this.rows=rows;else{var parentOffset=this.nodes.indexOf(parentNode);parentOffset>=0&&(this.nodes.splice.apply(this.nodes,[parentOffset+1,deleteCount].concat(nodes)),this.rows.splice.apply(this.rows,[parentOffset+1,deleteCount].concat(rows)),this.rows[parentOffset]=this.options.rowRenderer(parentNode,this.options))}return parentNode.children.slice(index).forEach(function(childNode){_this2.flattenNode(childNode).forEach(function(node){void 0!==node.id&&_this2.nodeTable.set(node.id,node)})}),this.update(),!0},InfiniteTree.prototype.appendChildNode=function(newNode,parentNode){if(parentNode=parentNode||this.state.rootNode,!ensureNodeInstance(parentNode))return!1;var index=parentNode.children.length,newNodes=[].concat(newNode||[]);return this.addChildNodes(newNodes,index,parentNode)},InfiniteTree.prototype.clear=function(){this.clusterize.clear(),this.nodeTable.clear(),this.nodes=[],this.rows=[],this.state.openNodes=[],this.state.rootNode=null,this.state.selectedNode=null},InfiniteTree.prototype.closeNode=function(node){if(!ensureNodeInstance(node))return!1;var nodeIndex=this.nodes.indexOf(node);if(0>nodeIndex)return error("Invalid node index"),!1;if(this.state.openNodes.indexOf(node)<0)return!1;if(this.state.selectedNode&&this.state.selectedNode!==node){var selectedIndex=this.nodes.indexOf(this.state.selectedNode),rangeFrom=nodeIndex+1,rangeTo=nodeIndex+node.state.total;selectedIndex>=rangeFrom&&rangeTo>=selectedIndex&&this.selectNode(node)}node.state.open=!1;var openNodes=this.state.openNodes.filter(function(node){return node.hasChildren()&&node.state.open});this.state.openNodes=openNodes;for(var deleteCount=node.state.total,p=node;null!==p;p=p.parent)p.state.total=p.state.total-deleteCount;return this.nodes.splice(nodeIndex+1,deleteCount),this.rows.splice(nodeIndex+1,deleteCount),this.rows[nodeIndex]=this.options.rowRenderer(node,this.options),this.emit("closeNode",node),this.update(),!0},InfiniteTree.prototype.flattenChildNodes=function(parentNode){if(parentNode=parentNode||this.state.rootNode,!ensureNodeInstance(parentNode))return[];for(var list=[],node=parentNode.getFirstChild();node;)if(list.push(node),node.hasChildren())node=node.getFirstChild();else{for(;null===node.getNextSibling()&&node.parent!==parentNode;)node=node.getParent();node=node.getNextSibling()}return list},InfiniteTree.prototype.flattenNode=function(node){return[node].concat(this.flattenChildNodes(node))},InfiniteTree.prototype.getChildNodes=function(parentNode){return parentNode=parentNode||this.state.rootNode,ensureNodeInstance(parentNode)?parentNode.children:[]},InfiniteTree.prototype.getNodeById=function(id){var node=this.nodeTable.get(id);if(!node){if(node=this.nodes.filter(function(node){return node.id===id})[0],!node)return null;this.nodeTable.set(node.id,node)}return node},InfiniteTree.prototype.getOpenNodes=function(){return this.state.openNodes.slice()},InfiniteTree.prototype.getRootNode=function(){return this.state.rootNode},InfiniteTree.prototype.getSelectedNode=function(){return this.state.selectedNode},InfiniteTree.prototype.insertNodeAfter=function(newNode,referenceNode){if(!ensureNodeInstance(referenceNode))return!1;var parentNode=referenceNode.getParent(),index=parentNode.children.indexOf(referenceNode)+1,newNodes=[].concat(newNode||[]);return this.addChildNodes(newNodes,index,parentNode)},InfiniteTree.prototype.insertNodeBefore=function(newNode,referenceNode){if(!ensureNodeInstance(referenceNode))return!1;var parentNode=referenceNode.getParent(),index=parentNode.children.indexOf(referenceNode),newNodes=[].concat(newNode||[]);return this.addChildNodes(newNodes,index,parentNode)},InfiniteTree.prototype.loadData=function(){var _this3=this,data=arguments.length<=0||void 0===arguments[0]?[]:arguments[0];this.nodes=(0,_flattree.flatten)(data,{openAllNodes:this.options.autoOpen}),this.nodeTable.clear(),this.state.openNodes=this.nodes.filter(function(node){return node.hasChildren()&&node.state.open}),this.state.rootNode=function(){for(var node=arguments.length<=0||void 0===arguments[0]?null:arguments[0];node&&null!==node.parent;)node=node.parent;return node}(this.nodes.length>0?this.nodes[0]:null),this.state.selectedNode=null,this.state.rootNode&&this.flattenChildNodes(this.state.rootNode).forEach(function(node){void 0!==node.id&&_this3.nodeTable.set(node.id,node)}),this.rows=this.nodes.map(function(node){return _this3.options.rowRenderer(node,_this3.options)}),this.update()},InfiniteTree.prototype.openNode=function(node){var _this4=this;if(!ensureNodeInstance(node))return!1;var nodeIndex=this.nodes.indexOf(node);if(0>nodeIndex)return error("Invalid node index"),!1;if(this.state.openNodes.indexOf(node)>=0)return!1;if(!node.hasChildren()&&node.loadOnDemand)return"function"!=typeof this.options.loadNodes?!1:node.state.loading===!0?!1:(node.state.loading=!0,this.rows[nodeIndex]=this.options.rowRenderer(node,this.options),this.update(),this.options.loadNodes(node,function(err,nodes){node.state.loading=!1,_this4.rows[nodeIndex]=_this4.options.rowRenderer(node,_this4.options),_this4.update(),err||nodes&&(nodes=[].concat(nodes||[]),0!==nodes.length&&(nodes.forEach(function(childNode){_this4.appendChildNode(childNode,node)}),node.hasChildren()&&_this4.openNode(node)))}),!1);node.state.open=!0;var openNodes=[node].concat(this.state.openNodes);this.state.openNodes=openNodes;var nodes=(0,_flattree.flatten)(node.children,{openNodes:this.state.openNodes}),rows=nodes.map(function(node){return _this4.options.rowRenderer(node,_this4.options)});return this.nodes.splice.apply(this.nodes,[nodeIndex+1,0].concat(nodes)),this.rows.splice.apply(this.rows,[nodeIndex+1,0].concat(rows)),this.rows[nodeIndex]=this.options.rowRenderer(node,this.options),nodes.length>0&&!this.nodeTable.get(nodes[0])&&nodes.forEach(function(node){void 0!==node.id&&_this4.nodeTable.set(node.id,node)}),this.emit("openNode",node),this.update(),!0},InfiniteTree.prototype.removeChildNodes=function(parentNode){var _this5=this;if(!ensureNodeInstance(parentNode))return!1;if(0===parentNode.children.length)return!1;var parentNodeIndex=this.nodes.indexOf(parentNode);if(parentNodeIndex>=0&&this.state.selectedNode){var selectedIndex=this.nodes.indexOf(this.state.selectedNode),rangeFrom=parentNodeIndex+1,rangeTo=parentNodeIndex+parentNode.state.total;selectedIndex>=rangeFrom&&rangeTo>=selectedIndex&&this.selectNode(parentNode)}parentNode.children=[],parentNode.state.open=parentNode.state.open&&parentNode.children.length>0;for(var deleteCount=parentNode.state.total,p=parentNode;null!==p;p=p.parent)p.state.total=p.state.total-deleteCount;return parentNodeIndex>=0&&(this.nodes.splice(parentNodeIndex+1,deleteCount),this.rows.splice(parentNodeIndex+1,deleteCount),this.rows[parentNodeIndex]=this.options.rowRenderer(parentNode,this.options)),!function(){var childNodes=_this5.flattenChildNodes(parentNode);_this5.state.openNodes=_this5.state.openNodes.filter(function(node){return childNodes.indexOf(node)<0}),childNodes.forEach(function(node){_this5.nodeTable.unset(node.id)})}(),this.update(),!0},InfiniteTree.prototype.removeNode=function(node){var _this6=this;if(!ensureNodeInstance(node))return!1;var parentNode=node.parent;if(!parentNode)return!1;var nodeIndex=this.nodes.indexOf(node),parentNodeIndex=this.nodes.indexOf(parentNode);if(nodeIndex>=0&&this.state.selectedNode){var selectedIndex=this.nodes.indexOf(this.state.selectedNode),rangeFrom=nodeIndex,rangeTo=nodeIndex+node.state.total+1;if(selectedIndex>=rangeFrom&&rangeTo>=selectedIndex){var selectedNode=node.getNextSibling()||node.getPreviousSibling()||node.getParent();this.selectNode(selectedNode)}}parentNode.children.splice(parentNode.children.indexOf(node),1),parentNode.state.open=parentNode.state.open&&parentNode.children.length>0;for(var deleteCount=node.state.total+1,p=parentNode;null!==p;p=p.parent)p.state.total=p.state.total-deleteCount;return nodeIndex>=0&&(this.nodes.splice(nodeIndex,deleteCount),this.rows.splice(nodeIndex,deleteCount)),parentNodeIndex>=0&&(this.rows[parentNodeIndex]=this.options.rowRenderer(parentNode,this.options)),!function(){var nodes=_this6.flattenNode(node);_this6.state.openNodes=_this6.state.openNodes.filter(function(node){return nodes.indexOf(node)<0}),nodes.forEach(function(node){_this6.nodeTable.unset(node.id)})}(),this.update(),!0},InfiniteTree.prototype.scrollToNode=function(node){if(!ensureNodeInstance(node))return!1;var nodeIndex=this.nodes.indexOf(node);if(0>nodeIndex)return!1;if(!this.contentElement)return!1;var firstChild=this.contentElement.firstChild,rowHeight=firstChild&&firstChild.offsetHeight||0;return this.scrollTop(nodeIndex*rowHeight),!0},InfiniteTree.prototype.scrollTop=function(value){return this.scrollElement?(void 0!==value&&(this.scrollElement.scrollTop=Number(value)),this.scrollElement.scrollTop):0},InfiniteTree.prototype.selectNode=function(){var node=arguments.length<=0||void 0===arguments[0]?null:arguments[0],_options=this.options,selectable=_options.selectable,shouldSelectNode=_options.shouldSelectNode;if(!selectable)return!1;if("function"==typeof shouldSelectNode&&!shouldSelectNode(node))return!1;if(null===node){if(this.state.selectedNode){var selectedNode=this.state.selectedNode,selectedIndex=this.nodes.indexOf(selectedNode);return selectedNode.state.selected=!1,this.rows[selectedIndex]=this.options.rowRenderer(selectedNode,this.options),this.state.selectedNode=null,this.emit("selectNode",null),this.update(),!0}return!1}if(!ensureNodeInstance(node))return!1;var nodeIndex=this.nodes.indexOf(node);if(0>nodeIndex)return error("Invalid node index"),!1;if(this.state.selectedNode!==node&&(node.state.selected=!0,this.rows[nodeIndex]=this.options.rowRenderer(node,this.options)),this.state.selectedNode){var _selectedNode=this.state.selectedNode,_selectedIndex=this.nodes.indexOf(_selectedNode);_selectedNode.state.selected=!1,this.rows[_selectedIndex]=this.options.rowRenderer(_selectedNode,this.options)}return this.state.selectedNode!==node?(this.state.selectedNode=node,this.emit("selectNode",node)):(this.state.selectedNode=null,this.emit("selectNode",null)),this.update(),!0},InfiniteTree.prototype.toggleNode=function(node){this.state.openNodes.indexOf(node)>=0?this.closeNode(node):this.openNode(node)},InfiniteTree.prototype.toString=function(){var node=arguments.length<=0||void 0===arguments[0]?null:arguments[0],traverse=function traverse(node){var s="[";if(node&&node.children)for(var _loop=function(i){var list=[];s+="{",Object.keys(node).forEach(function(key){var value=node[key];if("parent"!==key)return"children"===key?void list.push('"'+key+'":'+traverse(node.children[i])):void("string"==typeof value||"object"===("undefined"==typeof value?"undefined":_typeof(value))?list.push('"'+key+'":'+JSON.stringify(value)):list.push('"'+key+'":'+value))}),s+=list.join(","),s=s+"}"+(i===node.children.length-1?"":",")},i=0;i=0&&(this.rows[nodeIndex]=this.options.rowRenderer(node,this.options),this.update())}},InfiniteTree}(_events2["default"].EventEmitter);exports["default"]=InfiniteTree},function(module,exports){function EventEmitter(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function isFunction(arg){return"function"==typeof arg}function isNumber(arg){return"number"==typeof arg}function isObject(arg){return"object"==typeof arg&&null!==arg}function isUndefined(arg){return void 0===arg}module.exports=EventEmitter,EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._maxListeners=void 0,EventEmitter.defaultMaxListeners=10,EventEmitter.prototype.setMaxListeners=function(n){if(!isNumber(n)||0>n||isNaN(n))throw TypeError("n must be a positive number");return this._maxListeners=n,this},EventEmitter.prototype.emit=function(type){var er,handler,len,args,i,listeners;if(this._events||(this._events={}),"error"===type&&(!this._events.error||isObject(this._events.error)&&!this._events.error.length)){if(er=arguments[1],er instanceof Error)throw er;throw TypeError('Uncaught, unspecified "error" event.')}if(handler=this._events[type],isUndefined(handler))return!1;if(isFunction(handler))switch(arguments.length){case 1:handler.call(this);break;case 2:handler.call(this,arguments[1]);break;case 3:handler.call(this,arguments[1],arguments[2]);break;default:args=Array.prototype.slice.call(arguments,1),handler.apply(this,args)}else if(isObject(handler))for(args=Array.prototype.slice.call(arguments,1),listeners=handler.slice(),len=listeners.length,i=0;len>i;i++)listeners[i].apply(this,args);return!0},EventEmitter.prototype.addListener=function(type,listener){var m;if(!isFunction(listener))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",type,isFunction(listener.listener)?listener.listener:listener),this._events[type]?isObject(this._events[type])?this._events[type].push(listener):this._events[type]=[this._events[type],listener]:this._events[type]=listener,isObject(this._events[type])&&!this._events[type].warned&&(m=isUndefined(this._maxListeners)?EventEmitter.defaultMaxListeners:this._maxListeners,m&&m>0&&this._events[type].length>m&&(this._events[type].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[type].length),"function"==typeof console.trace&&console.trace())),this},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.once=function(type,listener){function g(){this.removeListener(type,g),fired||(fired=!0,listener.apply(this,arguments))}if(!isFunction(listener))throw TypeError("listener must be a function");var fired=!1;return g.listener=listener,this.on(type,g),this},EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events||!this._events[type])return this;if(list=this._events[type],length=list.length,position=-1,list===listener||isFunction(list.listener)&&list.listener===listener)delete this._events[type],this._events.removeListener&&this.emit("removeListener",type,listener);else if(isObject(list)){for(i=length;i-- >0;)if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}if(0>position)return this;1===list.length?(list.length=0,delete this._events[type]):list.splice(position,1),this._events.removeListener&&this.emit("removeListener",type,listener)}return this},EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[type]&&delete this._events[type],this;if(0===arguments.length){for(key in this._events)"removeListener"!==key&&this.removeAllListeners(key);return this.removeAllListeners("removeListener"),this._events={},this}if(listeners=this._events[type],isFunction(listeners))this.removeListener(type,listeners);else if(listeners)for(;listeners.length;)this.removeListener(type,listeners[listeners.length-1]);return delete this._events[type],this},EventEmitter.prototype.listeners=function(type){var ret;return ret=this._events&&this._events[type]?isFunction(this._events[type])?[this._events[type]]:this._events[type].slice():[]},EventEmitter.prototype.listenerCount=function(type){if(this._events){var evlistener=this._events[type];if(isFunction(evlistener))return 1;if(evlistener)return evlistener.length}return 0},EventEmitter.listenerCount=function(emitter,type){return emitter.listenerCount(type)}},function(module,exports,__webpack_require__){!function(name,definition){module.exports=definition()}("Clusterize",function(){"use strict";function on(evt,element,fnc){return element.addEventListener?element.addEventListener(evt,fnc,!1):element.attachEvent("on"+evt,fnc)}function off(evt,element,fnc){return element.removeEventListener?element.removeEventListener(evt,fnc,!1):element.detachEvent("on"+evt,fnc)}function isArray(arr){return"[object Array]"===Object.prototype.toString.call(arr)}function getStyle(prop,elem){return window.getComputedStyle?window.getComputedStyle(elem)[prop]:elem.currentStyle[prop]}var ie=function(){for(var v=3,el=document.createElement("b"),all=el.all||[];el.innerHTML="",all[0];);return v>4?v:document.documentMode}(),is_mac=navigator.platform.toLowerCase().indexOf("mac")+1,Clusterize=function(data){if(!(this instanceof Clusterize))return new Clusterize(data);var self=this,defaults={item_height:0,block_height:0,rows_in_block:50,rows_in_cluster:0,cluster_height:0,blocks_in_cluster:4,tag:null,content_tag:null,show_no_data_row:!0,no_data_class:"clusterize-no-data",no_data_text:"No data",keep_parity:!0,callbacks:{},scroll_top:0};self.options={};for(var option,options=["rows_in_block","blocks_in_cluster","show_no_data_row","no_data_class","no_data_text","keep_parity","tag","callbacks"],i=0;option=options[i];i++)self.options[option]="undefined"!=typeof data[option]&&null!=data[option]?data[option]:defaults[option];for(var elem,elems=["scroll","content"],i=0;elem=elems[i];i++)if(self[elem+"_elem"]=data[elem+"Id"]?document.getElementById(data[elem+"Id"]):data[elem+"Elem"],!self[elem+"_elem"])throw new Error("Error! Could not find "+elem+" element");self.content_elem.hasAttribute("tabindex")||self.content_elem.setAttribute("tabindex",0);var rows=isArray(data.rows)?data.rows:self.fetchMarkup(),cache={data:"",bottom:0},scroll_top=self.scroll_elem.scrollTop;self.exploreEnvironment(rows),self.insertToDOM(rows,cache),self.scroll_elem.scrollTop=scroll_top;var last_cluster=!1,scroll_debounce=0,pointer_events_set=!1,scrollEv=function(){is_mac&&(pointer_events_set||(self.content_elem.style.pointerEvents="none"),pointer_events_set=!0,clearTimeout(scroll_debounce),scroll_debounce=setTimeout(function(){self.content_elem.style.pointerEvents="auto",pointer_events_set=!1},50)),last_cluster!=(last_cluster=self.getClusterNum())&&self.insertToDOM(rows,cache),self.options.callbacks.scrollingProgress&&self.options.callbacks.scrollingProgress(self.getScrollProgress())},resize_debounce=0,resizeEv=function(){clearTimeout(resize_debounce),resize_debounce=setTimeout(self.refresh,100)};on("scroll",self.scroll_elem,scrollEv),on("resize",window,resizeEv),self.destroy=function(clean){off("scroll",self.scroll_elem,scrollEv),off("resize",window,resizeEv),self.html((clean?self.generateEmptyRow():rows).join(""))},self.refresh=function(){self.getRowsHeight(rows)&&self.update(rows)},self.update=function(new_rows){rows=isArray(new_rows)?new_rows:[];var scroll_top=self.scroll_elem.scrollTop;rows.length*self.options.item_height=ie&&!opts.tag&&(opts.tag=rows[0].match(/<([^>\s\/]*)/)[1].toLowerCase()),this.content_elem.children.length<=1&&this.html(rows[0]+rows[0]+rows[0]),opts.tag||(opts.tag=this.content_elem.children[0].tagName.toLowerCase()),this.getRowsHeight(rows))},getRowsHeight:function(rows){var opts=this.options,prev_item_height=opts.item_height;if(opts.cluster_height=0,rows.length){var nodes=this.content_elem.children;return opts.item_height=nodes[Math.floor(nodes.length/2)].offsetHeight,"tr"==opts.tag&&"collapse"!=getStyle("borderCollapse",this.content_elem)&&(opts.item_height+=parseInt(getStyle("borderSpacing",this.content_elem))||0),opts.block_height=opts.item_height*opts.rows_in_block,opts.rows_in_cluster=opts.blocks_in_cluster*opts.rows_in_block,opts.cluster_height=opts.blocks_in_cluster*opts.block_height,prev_item_height!=opts.item_height}},getClusterNum:function(){return this.options.scroll_top=this.scroll_elem.scrollTop,Math.floor(this.options.scroll_top/(this.options.cluster_height-this.options.block_height))||0},generateEmptyRow:function(){var opts=this.options;if(!opts.tag||!opts.show_no_data_row)return[];var td,empty_row=document.createElement(opts.tag),no_data_content=document.createTextNode(opts.no_data_text);return empty_row.className=opts.no_data_class,"tr"==opts.tag&&(td=document.createElement("td"),td.appendChild(no_data_content)),empty_row.appendChild(td||no_data_content),[empty_row.outerHTML]},generate:function(rows,cluster_num){var opts=this.options,rows_len=rows.length;if(rows_lentop_offset&&rows_above++;for(var i=items_start;items_end>i;i++)rows[i]&&this_cluster_rows.push(rows[i]);return{top_offset:top_offset,bottom_offset:bottom_offset,rows_above:rows_above,rows:this_cluster_rows}},renderExtraTag:function(class_name,height){var tag=document.createElement(this.options.tag),clusterize_prefix="clusterize-";return tag.className=[clusterize_prefix+"extra-row",clusterize_prefix+class_name].join(" "),height&&(tag.style.height=height+"px"),tag.outerHTML},insertToDOM:function(rows,cache){var data=this.generate(rows,this.getClusterNum()),this_cluster_rows=data.rows.join(""),this_cluster_content_changed=this.checkChanges("data",this_cluster_rows,cache),only_bottom_offset_changed=this.checkChanges("bottom",data.bottom_offset,cache),callbacks=this.options.callbacks,layout=[];this_cluster_content_changed?(data.top_offset&&(this.options.keep_parity&&layout.push(this.renderExtraTag("keep-parity")), -layout.push(this.renderExtraTag("top-space",data.top_offset))),layout.push(this_cluster_rows),data.bottom_offset&&layout.push(this.renderExtraTag("bottom-space",data.bottom_offset)),callbacks.clusterWillChange&&callbacks.clusterWillChange(),this.html(layout.join("")),"ol"==this.options.content_tag&&this.content_elem.setAttribute("start",data.rows_above),callbacks.clusterChanged&&callbacks.clusterChanged()):only_bottom_offset_changed&&(this.content_elem.lastChild.style.height=data.bottom_offset+"px")},html:function(data){var content_elem=this.content_elem;if(ie&&9>=ie&&"tr"==this.options.tag){var last,div=document.createElement("div");for(div.innerHTML=""+data+"
";last=content_elem.lastChild;)content_elem.removeChild(last);for(var rows_nodes=this.getChildNodes(div.firstChild.firstChild);rows_nodes.length;)content_elem.appendChild(rows_nodes.shift())}else content_elem.innerHTML=data},getChildNodes:function(tag){for(var child_nodes=tag.children,nodes=[],i=0,ii=child_nodes.length;ii>i;i++)nodes.push(child_nodes[i]);return nodes},checkChanges:function(type,value,cache){var changed=value!=cache[type];return cache[type]=value,changed}},Clusterize})},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}exports.__esModule=!0,exports.Node=exports.flatten=void 0;var _flatten=__webpack_require__(5),_flatten2=_interopRequireDefault(_flatten),_node=__webpack_require__(7),_node2=_interopRequireDefault(_node);exports.flatten=_flatten2["default"],exports.Node=_node2["default"]},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}exports.__esModule=!0;var _extend=__webpack_require__(6),_extend2=_interopRequireDefault(_extend),_node=__webpack_require__(7),_node2=_interopRequireDefault(_node),flatten=function flatten(){var nodes=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],options=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];nodes=[].concat(nodes);var flatten=[],stack=[],pool={lastChild:{}};options.openAllNodes=!!options.openAllNodes,options.openNodes=options.openNodes||[],options.throwOnError=!!options.throwOnError;var firstNode=nodes.length>0?nodes[0]:null,parentNode=firstNode?firstNode.parent:null;!parentNode||parentNode instanceof _node2["default"]||(parentNode=new _node2["default"](parentNode));var rootNode=parentNode||new _node2["default"]({label:"",parent:null,children:nodes,state:{depth:-1,open:!0,path:"",prefixMask:"",total:0}});if(rootNode===parentNode)for(var subtotal=rootNode.state.total||0,p=rootNode;p;){var _p$state=p.state,path=_p$state.path,_p$state$total=_p$state.total,total=void 0===_p$state$total?0:_p$state$total;if(p.isLastChild()&&path&&(pool.lastChild[path]=!0),p.state.total=total-subtotal,p.state.total<0){if(options.throwOnError)throw new Error("The node might have been corrupted: id="+JSON.stringify(p.id)+", state="+JSON.stringify(p.state));console&&console.log("Error: The node might have been corrupted: id=%s, label=%s, parent=%s, children=%s, state=%s",JSON.stringify(p.id),JSON.stringify(p.label),p.parent,p.children,JSON.stringify(p.state))}p=p.parent}for(stack.push([rootNode,rootNode.state.depth,0]);stack.length>0;)for(var _stack$pop=stack.pop(),current=_stack$pop[0],depth=_stack$pop[1],index=_stack$pop[2],_loop=function(){var node=current.children[index];node instanceof _node2["default"]||(node=new _node2["default"](node)),node.parent=current,node.children=node.children||[],node.parent.children[index]=node;var path=current.state.path+"."+index,open=node.hasChildren()&&function(){var openAllNodes=options.openAllNodes,openNodes=options.openNodes;return openAllNodes?!0:openNodes.indexOf(node)>=0?!0:openNodes.indexOf(node.id)>=0}(),prefixMask=function(prefix){for(var mask="";prefix.length>0;)prefix=prefix.replace(/\.\d+$/,""),mask=!prefix||pool.lastChild[prefix]?"0"+mask:"1"+mask;return mask}(path);node.isLastChild()&&(pool.lastChild[path]=!0),node.state=(0,_extend2["default"])({},node.state,{depth:depth+1,open:open,path:path,prefixMask:prefixMask,total:0});for(var parentDidOpen=!0,_p=node;null!==_p.parent;){if(_p.parent.state.open===!1){parentDidOpen=!1;break}_p=_p.parent}if(parentDidOpen){flatten.push(node);for(var _p2=node;null!==_p2.parent;)_p2.parent.state.total++,_p2=_p2.parent}++index,node.hasChildren()&&(stack.push([current,depth,index]),index=0,depth+=1,current=node)};index1?_len-1:0),_key=1;_len>_key;_key++)sources[_key-1]=arguments[_key];if(void 0===target||null===target)throw new TypeError("Cannot convert undefined or null to object");for(var output=Object(target),index=0;index0&&index>=0&&index0&&(node=this.children[0]),node},Node.prototype.getLastChild=function(){var node=null;return this.children.length>0&&(node=this.children[this.children.length-1]),node},Node.prototype.getNextSibling=function(){var node=null;if(this.parent){var index=this.parent.children.indexOf(this);index>=0&&index0&&index0},Node.prototype.isLastChild=function(){var hasNextSibling=this.getNextSibling();return!hasNextSibling},Node}();exports["default"]=Node},function(module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}exports.__esModule=!0;var LookupTable=function(){function LookupTable(){_classCallCheck(this,LookupTable),this.data={}}return LookupTable.prototype.clear=function(){this.data={}},LookupTable.prototype.get=function(key){return this.data[key]},LookupTable.prototype.has=function(key){return void 0!==this.data[key]},LookupTable.prototype.set=function(key,value){return this.data[key]=value,value},LookupTable.prototype.unset=function(key){void 0!==this.data[key]&&delete this.data[key]},LookupTable}();exports["default"]=LookupTable},function(module,exports,__webpack_require__){"use strict";exports.__esModule=!0,exports.defaultRowRenderer=void 0;var _helper=__webpack_require__(10),defaultRowRenderer=function(node,treeOptions){var id=node.id,name=node.name,_node$loadOnDemand=node.loadOnDemand,loadOnDemand=void 0===_node$loadOnDemand?!1:_node$loadOnDemand,children=node.children,state=node.state,depth=state.depth,open=state.open,path=state.path,total=state.total,_state$selected=state.selected,selected=void 0===_state$selected?!1:_state$selected,childrenLength=Object.keys(children).length,more=node.hasChildren(),togglerContent="";more&&open&&(togglerContent="▼"),more&&!open&&(togglerContent="►"),!more&&loadOnDemand&&(togglerContent="►");var toggler=(0,_helper.buildHTML)("a",togglerContent,{"class":function(){return more&&open?(0,_helper.classNames)("infinite-tree-toggler"):more&&!open?(0,_helper.classNames)("infinite-tree-toggler","infinite-tree-closed"):!more&&loadOnDemand?(0,_helper.classNames)("infinite-tree-toggler","infinite-tree-closed"):""}()}),title=(0,_helper.buildHTML)("span",(0,_helper.quoteattr)(name),{"class":(0,_helper.classNames)("infinite-tree-title")}),treeNode=(0,_helper.buildHTML)("div",toggler+title,{"class":"infinite-tree-node",style:"margin-left: "+18*depth+"px"});return(0,_helper.buildHTML)("div",treeNode,{"aria-id":id,"aria-expanded":more&&open,"aria-depth":depth,"aria-path":path,"aria-selected":selected,"aria-children":childrenLength,"aria-total":total,"class":(0,_helper.classNames)("infinite-tree-item",{"infinite-tree-selected":selected}),droppable:!0})};exports.defaultRowRenderer=defaultRowRenderer},function(module,exports){"use strict";exports.__esModule=!0;var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol?"symbol":typeof obj},extend=function(target){for(var _len=arguments.length,sources=Array(_len>1?_len-1:0),_key=1;_len>_key;_key++)sources[_key-1]=arguments[_key];target=target||{};for(var index=0;index=0},addClass=function(el,className){if(!el)return"";if(!hasClass(el,className)){var classes=el.className.split(" ");el.className=classes.concat(className).join(" ")}return el.className},removeClass=function(el,className){if(!el)return"";if(hasClass(el,className)){var classes=el.className.split(" ");el.className=classes.filter(function(c){return c!==className}).join(" ")}return el.className},toggleClass=function(el,className){el&&(hasClass(el,className)?removeClass(el,className):addClass(el,className))},classNames=function classNames(){for(var _len2=arguments.length,args=Array(_len2),_key2=0;_len2>_key2;_key2++)args[_key2]=arguments[_key2];var classNames=[];return args.forEach(function(arg){Array.isArray(arg)?classNames=classNames.concat(arg):"object"===("undefined"==typeof arg?"undefined":_typeof(arg))?Object.keys(arg).forEach(function(className){var ok=arg[className];ok&&classNames.push(className)}):classNames.push(arg)}),classNames.join(" ")},isDOMElement=function(o){return"object"===("undefined"==typeof HTMLElement?"undefined":_typeof(HTMLElement))?o instanceof HTMLElement:o&&"object"===("undefined"==typeof o?"undefined":_typeof(o))&&1===o.nodeType&&"string"==typeof o.nodeName},isDOMNode=function(o){return"object"===("undefined"==typeof Node?"undefined":_typeof(Node))?o instanceof Node:o&&"object"===("undefined"==typeof o?"undefined":_typeof(o))&&"number"==typeof o.nodeType&&"string"==typeof o.nodeName},quoteattr=function(s,preserveCR){return preserveCR=preserveCR?" ":"\n",(""+s).replace(/&/g,"&").replace(/'/g,"'").replace(/"/g,""").replace(//g,">").replace(/\r\n/g,preserveCR).replace(/[\r\n]/g,preserveCR)},buildHTML=function buildHTML(tag,html,attrs){switch(tag){case"select":if("object"===("undefined"==typeof html?"undefined":_typeof(html))){var options=html||{};html="";for(var value in options)options.hasOwnProperty(value)&&(html+=buildHTML("option",options[value]||"",{value:value}))}break;default:"object"===("undefined"==typeof html?"undefined":_typeof(html))&&(attrs=html,html=void 0)}var h="<"+tag;for(var attr in attrs)attrs.hasOwnProperty(attr)&&"undefined"!=typeof attrs[attr]&&(h+=" "+attr+'="'+quoteattr(attrs[attr])+'"');return h+="undefined"!=typeof html?">"+html+"":"/>"};exports.extend=extend,exports.preventDefault=preventDefault,exports.stopPropagation=stopPropagation,exports.dispatchEvent=dispatchEvent,exports.addEventListener=addEventListener,exports.removeEventListener=removeEventListener,exports.hasClass=hasClass,exports.addClass=addClass,exports.removeClass=removeClass,exports.toggleClass=toggleClass,exports.classNames=classNames,exports.isDOMElement=isDOMElement,exports.isDOMNode=isDOMNode,exports.quoteattr=quoteattr,exports.buildHTML=buildHTML}])}); \ No newline at end of file +!function(root,factory){"object"==typeof exports&&"object"==typeof module?module.exports=factory():"function"==typeof define&&define.amd?define([],factory):"object"==typeof exports?exports.InfiniteTree=factory():root.InfiniteTree=factory()}(this,function(){return function(modules){function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={exports:{},id:moduleId,loaded:!1};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.loaded=!0,module.exports}var installedModules={};return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.p="",__webpack_require__(0)}([function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}var _infiniteTree=__webpack_require__(1),_infiniteTree2=_interopRequireDefault(_infiniteTree);module.exports=_infiniteTree2["default"]},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol?"symbol":typeof obj},_events=__webpack_require__(2),_events2=_interopRequireDefault(_events),_clusterize=__webpack_require__(3),_clusterize2=_interopRequireDefault(_clusterize),_flattree=__webpack_require__(4),_lookupTable=__webpack_require__(8),_lookupTable2=_interopRequireDefault(_lookupTable),_renderer=__webpack_require__(9),_helper=__webpack_require__(10),error=function(){for(var _len=arguments.length,args=Array(_len),_key=0;_len>_key;_key++)args[_key]=arguments[_key];if(console&&console.error){var prefix="[InfiniteTree]";console.error.apply(console,[prefix].concat(args))}},ensureNodeInstance=function(node){return node?node instanceof _flattree.Node?!0:(error("The node must be a Node object."),!1):!1},InfiniteTree=function(_events$EventEmitter){function InfiniteTree(el,options){_classCallCheck(this,InfiniteTree);var _this=_possibleConstructorReturn(this,_events$EventEmitter.call(this));return _this.options={autoOpen:!1,dragoverClass:"infinite-tree-dragover",droppable:!1,droppableAttr:"droppable",el:null,layout:"div",loadNodes:null,noDataClass:"infinite-tree-no-data",noDataText:"No data",nodeIdAttr:"data-id",rowRenderer:_renderer.defaultRowRenderer,selectable:!0,shouldSelectNode:null,togglerClass:"infinite-tree-toggler"},_this.state={openNodes:[],rootNode:null,selectedNode:null},_this.clusterize=null,_this.nodeTable=new _lookupTable2["default"],_this.nodes=[],_this.rows=[],_this.scrollElement=null,_this.contentElement=null,_this.dragoverElement=null,_this.contentListener={click:function(e){var itemTarget=null,clickToggler=!1;for((0,_helper.stopPropagation)(e),e.target&&e.currentTarget?itemTarget=e.target!==e.currentTarget?e.target:null:e.srcElement&&(itemTarget=e.srcElement);itemTarget&&itemTarget.parentElement!==_this.contentElement;)(0,_helper.hasClass)(itemTarget,_this.options.togglerClass)&&(clickToggler=!0),itemTarget=itemTarget.parentElement;if(itemTarget){var id=itemTarget.getAttribute(_this.options.nodeIdAttr),node=_this.getNodeById(id);if(node)return clickToggler?void _this.toggleNode(node):void _this.selectNode(node)}},dragenter:function(e){var itemTarget=null;for(e.target&&e.currentTarget?itemTarget=e.target!==e.currentTarget?e.target:null:e.srcElement&&(itemTarget=e.srcElement);itemTarget&&itemTarget.parentElement!==_this.contentElement;)itemTarget=itemTarget.parentElement;if(itemTarget&&_this.dragoverElement!==itemTarget){if((0,_helper.removeClass)(_this.dragoverElement,_this.options.dragoverClass),_this.dragoverElement=null,!itemTarget.hasAttribute(_this.options.droppableAttr))return;var canDrop=!itemTarget.getAttribute(_this.options.droppableAttr).match(/false/i);canDrop&&((0,_helper.addClass)(itemTarget,_this.options.dragoverClass),_this.dragoverElement=itemTarget)}},dragend:function(e){_this.dragoverElement&&((0,_helper.removeClass)(_this.dragoverElement,_this.options.dragoverClass),_this.dragoverElement=null)},dragover:function(e){return(0,_helper.preventDefault)(e),e.dataTransfer.dropEffect="move",!1},drop:function(e){if((0,_helper.preventDefault)(e),_this.dragoverElement){var id=_this.dragoverElement.getAttribute(_this.options.nodeIdAttr),node=_this.getNodeById(id);(0,_helper.removeClass)(_this.dragoverElement,_this.options.dragoverClass),_this.dragoverElement=null,_this.emit("dropNode",node,e)}}},(0,_helper.isDOMElement)(el)?options.el=el:options=el,_this.options=(0,_helper.extend)({},_this.options,options),_this.options.el?(_this.create(),options.data&&_this.loadData(options.data),_this):(console.error("Failed to initialize infinite-tree: el is not specified.",options),_possibleConstructorReturn(_this))}return _inherits(InfiniteTree,_events$EventEmitter),InfiniteTree.prototype.create=function(){this.options.el||error("The element option is not specified.");var tag=null;if(this.scrollElement=document.createElement("div"),"table"===this.options.layout){var tableElement=document.createElement("table");tableElement.className=(0,_helper.classNames)("infinite-tree","infinite-tree-table");var contentElement=document.createElement("tbody");tableElement.appendChild(contentElement),this.scrollElement.appendChild(tableElement),this.contentElement=contentElement,tag="tr"}else{var _contentElement=document.createElement("div");this.scrollElement.appendChild(_contentElement),this.contentElement=_contentElement,tag="div"}this.scrollElement.className=(0,_helper.classNames)("infinite-tree","infinite-tree-scroll"),this.contentElement.className=(0,_helper.classNames)("infinite-tree","infinite-tree-content"),this.options.el.appendChild(this.scrollElement),this.clusterize=new _clusterize2["default"]({tag:tag,rows:[],scrollElem:this.scrollElement,contentElem:this.contentElement,no_data_text:this.options.noDataText,no_data_class:this.options.noDataClass}),(0,_helper.addEventListener)(this.contentElement,"click",this.contentListener.click),this.options.droppable&&((0,_helper.addEventListener)(document,"dragend",this.contentListener.dragend),(0,_helper.addEventListener)(this.contentElement,"dragenter",this.contentListener.dragenter),(0,_helper.addEventListener)(this.contentElement,"dragover",this.contentListener.dragover),(0,_helper.addEventListener)(this.contentElement,"drop",this.contentListener.drop))},InfiniteTree.prototype.destroy=function(){for((0,_helper.removeEventListener)(this.contentElement,"click",this.contentListener),this.options.droppable&&((0,_helper.removeEventListener)(document,"dragend",this.contentListener.dragend),(0,_helper.removeEventListener)(this.contentElement,"dragenter",this.contentListener.dragenter),(0,_helper.removeEventListener)(this.contentElement,"dragover",this.contentListener.dragover),(0,_helper.removeEventListener)(this.contentElement,"drop",this.contentListener.drop)),this.clear(),this.clusterize&&(this.clusterize.destroy(!0),this.clusterize=null);this.contentElement.firstChild;)this.contentElement.removeChild(this.contentElement.firstChild);for(;this.scrollElement.firstChild;)this.scrollElement.removeChild(this.scrollElement.firstChild);if(this.options.el)for(var containerElement=this.options.el;containerElement.firstChild;)containerElement.removeChild(containerElement.firstChild);this.contentElement=null,this.scrollElement=null},InfiniteTree.prototype.addChildNodes=function(newNodes,index,parentNode){var _this2=this;if(newNodes=[].concat(newNodes||[]),0===newNodes.length)return!1;if("object"===("undefined"==typeof index?"undefined":_typeof(index))?(parentNode=index||this.state.rootNode,index=parentNode.children.length):parentNode=parentNode||this.state.rootNode,!ensureNodeInstance(parentNode))return!1;newNodes.forEach(function(newNode){newNode.parent=parentNode}),parentNode.children.splice.apply(parentNode.children,[index,0].concat(newNodes)),index=parentNode.children.indexOf(newNodes[0]);var deleteCount=parentNode.state.total,nodes=(0,_flattree.flatten)(parentNode.children,{openNodes:this.state.openNodes}),rows=nodes.map(function(node){return _this2.options.rowRenderer(node,_this2.options)});if(parentNode===this.state.rootNode)this.nodes=nodes,this.rows=rows;else{var parentOffset=this.nodes.indexOf(parentNode);parentOffset>=0&&(this.nodes.splice.apply(this.nodes,[parentOffset+1,deleteCount].concat(nodes)),this.rows.splice.apply(this.rows,[parentOffset+1,deleteCount].concat(rows)),this.rows[parentOffset]=this.options.rowRenderer(parentNode,this.options))}return parentNode.children.slice(index).forEach(function(childNode){_this2.flattenNode(childNode).forEach(function(node){void 0!==node.id&&_this2.nodeTable.set(node.id,node)})}),this.update(),!0},InfiniteTree.prototype.appendChildNode=function(newNode,parentNode){if(parentNode=parentNode||this.state.rootNode,!ensureNodeInstance(parentNode))return!1;var index=parentNode.children.length,newNodes=[].concat(newNode||[]);return this.addChildNodes(newNodes,index,parentNode)},InfiniteTree.prototype.clear=function(){this.clusterize.clear(),this.nodeTable.clear(),this.nodes=[],this.rows=[],this.state.openNodes=[],this.state.rootNode=null,this.state.selectedNode=null},InfiniteTree.prototype.closeNode=function(node){if(!ensureNodeInstance(node))return!1;var nodeIndex=this.nodes.indexOf(node);if(0>nodeIndex)return error("Invalid node index"),!1;if(this.state.openNodes.indexOf(node)<0)return!1;if(this.state.selectedNode&&this.state.selectedNode!==node){var selectedIndex=this.nodes.indexOf(this.state.selectedNode),rangeFrom=nodeIndex+1,rangeTo=nodeIndex+node.state.total;selectedIndex>=rangeFrom&&rangeTo>=selectedIndex&&this.selectNode(node)}node.state.open=!1;var openNodes=this.state.openNodes.filter(function(node){return node.hasChildren()&&node.state.open});this.state.openNodes=openNodes;for(var deleteCount=node.state.total,p=node;null!==p;p=p.parent)p.state.total=p.state.total-deleteCount;return this.nodes.splice(nodeIndex+1,deleteCount),this.rows.splice(nodeIndex+1,deleteCount),this.rows[nodeIndex]=this.options.rowRenderer(node,this.options),this.emit("closeNode",node),this.update(),!0},InfiniteTree.prototype.flattenChildNodes=function(parentNode){if(parentNode=parentNode||this.state.rootNode,!ensureNodeInstance(parentNode))return[];for(var list=[],node=parentNode.getFirstChild();node;)if(list.push(node),node.hasChildren())node=node.getFirstChild();else{for(;null===node.getNextSibling()&&node.parent!==parentNode;)node=node.getParent();node=node.getNextSibling()}return list},InfiniteTree.prototype.flattenNode=function(node){return[node].concat(this.flattenChildNodes(node))},InfiniteTree.prototype.getChildNodes=function(parentNode){return parentNode=parentNode||this.state.rootNode,ensureNodeInstance(parentNode)?parentNode.children:[]},InfiniteTree.prototype.getNodeById=function(id){var node=this.nodeTable.get(id);if(!node){if(node=this.nodes.filter(function(node){return node.id===id})[0],!node)return null;this.nodeTable.set(node.id,node)}return node},InfiniteTree.prototype.getOpenNodes=function(){return this.state.openNodes.slice()},InfiniteTree.prototype.getRootNode=function(){return this.state.rootNode},InfiniteTree.prototype.getSelectedNode=function(){return this.state.selectedNode},InfiniteTree.prototype.insertNodeAfter=function(newNode,referenceNode){if(!ensureNodeInstance(referenceNode))return!1;var parentNode=referenceNode.getParent(),index=parentNode.children.indexOf(referenceNode)+1,newNodes=[].concat(newNode||[]);return this.addChildNodes(newNodes,index,parentNode)},InfiniteTree.prototype.insertNodeBefore=function(newNode,referenceNode){if(!ensureNodeInstance(referenceNode))return!1;var parentNode=referenceNode.getParent(),index=parentNode.children.indexOf(referenceNode),newNodes=[].concat(newNode||[]);return this.addChildNodes(newNodes,index,parentNode)},InfiniteTree.prototype.loadData=function(){var _this3=this,data=arguments.length<=0||void 0===arguments[0]?[]:arguments[0];this.nodes=(0,_flattree.flatten)(data,{openAllNodes:this.options.autoOpen}),this.nodeTable.clear(),this.state.openNodes=this.nodes.filter(function(node){return node.hasChildren()&&node.state.open}),this.state.rootNode=function(){for(var node=arguments.length<=0||void 0===arguments[0]?null:arguments[0];node&&null!==node.parent;)node=node.parent;return node}(this.nodes.length>0?this.nodes[0]:null),this.state.selectedNode=null,this.state.rootNode&&this.flattenChildNodes(this.state.rootNode).forEach(function(node){void 0!==node.id&&_this3.nodeTable.set(node.id,node)}),this.rows=this.nodes.map(function(node){return _this3.options.rowRenderer(node,_this3.options)}),this.update()},InfiniteTree.prototype.openNode=function(node){var _this4=this;if(!ensureNodeInstance(node))return!1;var nodeIndex=this.nodes.indexOf(node);if(0>nodeIndex)return error("Invalid node index"),!1;if(this.state.openNodes.indexOf(node)>=0)return!1;if(!node.hasChildren()&&node.loadOnDemand)return"function"!=typeof this.options.loadNodes?!1:node.state.loading===!0?!1:(node.state.loading=!0,this.rows[nodeIndex]=this.options.rowRenderer(node,this.options),this.update(),this.options.loadNodes(node,function(err,nodes){node.state.loading=!1,_this4.rows[nodeIndex]=_this4.options.rowRenderer(node,_this4.options),_this4.update(),err||nodes&&(nodes=[].concat(nodes||[]),0!==nodes.length&&(nodes.forEach(function(childNode){_this4.appendChildNode(childNode,node)}),node.hasChildren()&&_this4.openNode(node)))}),!1);node.state.open=!0;var openNodes=[node].concat(this.state.openNodes);this.state.openNodes=openNodes;var nodes=(0,_flattree.flatten)(node.children,{openNodes:this.state.openNodes}),rows=nodes.map(function(node){return _this4.options.rowRenderer(node,_this4.options)});return this.nodes.splice.apply(this.nodes,[nodeIndex+1,0].concat(nodes)),this.rows.splice.apply(this.rows,[nodeIndex+1,0].concat(rows)),this.rows[nodeIndex]=this.options.rowRenderer(node,this.options),nodes.length>0&&!this.nodeTable.get(nodes[0])&&nodes.forEach(function(node){void 0!==node.id&&_this4.nodeTable.set(node.id,node)}),this.emit("openNode",node),this.update(),!0},InfiniteTree.prototype.removeChildNodes=function(parentNode){var _this5=this;if(!ensureNodeInstance(parentNode))return!1;if(0===parentNode.children.length)return!1;var parentNodeIndex=this.nodes.indexOf(parentNode);if(parentNodeIndex>=0&&this.state.selectedNode){var selectedIndex=this.nodes.indexOf(this.state.selectedNode),rangeFrom=parentNodeIndex+1,rangeTo=parentNodeIndex+parentNode.state.total;selectedIndex>=rangeFrom&&rangeTo>=selectedIndex&&this.selectNode(parentNode)}parentNode.children=[],parentNode.state.open=parentNode.state.open&&parentNode.children.length>0;for(var deleteCount=parentNode.state.total,p=parentNode;null!==p;p=p.parent)p.state.total=p.state.total-deleteCount;return parentNodeIndex>=0&&(this.nodes.splice(parentNodeIndex+1,deleteCount),this.rows.splice(parentNodeIndex+1,deleteCount),this.rows[parentNodeIndex]=this.options.rowRenderer(parentNode,this.options)),!function(){var childNodes=_this5.flattenChildNodes(parentNode);_this5.state.openNodes=_this5.state.openNodes.filter(function(node){return childNodes.indexOf(node)<0}),childNodes.forEach(function(node){_this5.nodeTable.unset(node.id)})}(),this.update(),!0},InfiniteTree.prototype.removeNode=function(node){var _this6=this;if(!ensureNodeInstance(node))return!1;var parentNode=node.parent;if(!parentNode)return!1;var nodeIndex=this.nodes.indexOf(node),parentNodeIndex=this.nodes.indexOf(parentNode);if(nodeIndex>=0&&this.state.selectedNode){var selectedIndex=this.nodes.indexOf(this.state.selectedNode),rangeFrom=nodeIndex,rangeTo=nodeIndex+node.state.total+1;if(selectedIndex>=rangeFrom&&rangeTo>=selectedIndex){var selectedNode=node.getNextSibling()||node.getPreviousSibling()||node.getParent();this.selectNode(selectedNode)}}parentNode.children.splice(parentNode.children.indexOf(node),1),parentNode.state.open=parentNode.state.open&&parentNode.children.length>0;for(var deleteCount=node.state.total+1,p=parentNode;null!==p;p=p.parent)p.state.total=p.state.total-deleteCount;return nodeIndex>=0&&(this.nodes.splice(nodeIndex,deleteCount),this.rows.splice(nodeIndex,deleteCount)),parentNodeIndex>=0&&(this.rows[parentNodeIndex]=this.options.rowRenderer(parentNode,this.options)),!function(){var nodes=_this6.flattenNode(node);_this6.state.openNodes=_this6.state.openNodes.filter(function(node){return nodes.indexOf(node)<0}),nodes.forEach(function(node){_this6.nodeTable.unset(node.id)})}(),this.update(),!0},InfiniteTree.prototype.scrollToNode=function(node){if(!ensureNodeInstance(node))return!1;var nodeIndex=this.nodes.indexOf(node);if(0>nodeIndex)return!1;if(!this.contentElement)return!1;var firstChild=this.contentElement.firstChild,rowHeight=firstChild&&firstChild.offsetHeight||0;return this.scrollTop(nodeIndex*rowHeight),!0},InfiniteTree.prototype.scrollTop=function(value){return this.scrollElement?(void 0!==value&&(this.scrollElement.scrollTop=Number(value)),this.scrollElement.scrollTop):0},InfiniteTree.prototype.selectNode=function(){var node=arguments.length<=0||void 0===arguments[0]?null:arguments[0],_options=this.options,selectable=_options.selectable,shouldSelectNode=_options.shouldSelectNode;if(!selectable)return!1;if("function"==typeof shouldSelectNode&&!shouldSelectNode(node))return!1;if(null===node){if(this.state.selectedNode){var selectedNode=this.state.selectedNode,selectedIndex=this.nodes.indexOf(selectedNode);return selectedNode.state.selected=!1,this.rows[selectedIndex]=this.options.rowRenderer(selectedNode,this.options),this.state.selectedNode=null,this.emit("selectNode",null),this.update(),!0}return!1}if(!ensureNodeInstance(node))return!1;var nodeIndex=this.nodes.indexOf(node);if(0>nodeIndex)return error("Invalid node index"),!1;if(this.state.selectedNode!==node&&(node.state.selected=!0,this.rows[nodeIndex]=this.options.rowRenderer(node,this.options)),this.state.selectedNode){var _selectedNode=this.state.selectedNode,_selectedIndex=this.nodes.indexOf(_selectedNode);_selectedNode.state.selected=!1,this.rows[_selectedIndex]=this.options.rowRenderer(_selectedNode,this.options)}return this.state.selectedNode!==node?(this.state.selectedNode=node,this.emit("selectNode",node)):(this.state.selectedNode=null,this.emit("selectNode",null)),this.update(),!0},InfiniteTree.prototype.toggleNode=function(node){this.state.openNodes.indexOf(node)>=0?this.closeNode(node):this.openNode(node)},InfiniteTree.prototype.toString=function(){var node=arguments.length<=0||void 0===arguments[0]?null:arguments[0],traverse=function traverse(node){var s="[";if(node&&node.children)for(var _loop=function(i){var list=[];s+="{",Object.keys(node).forEach(function(key){var value=node[key];if("parent"!==key)return"children"===key?void list.push('"'+key+'":'+traverse(node.children[i])):void("string"==typeof value||"object"===("undefined"==typeof value?"undefined":_typeof(value))?list.push('"'+key+'":'+JSON.stringify(value)):list.push('"'+key+'":'+value))}),s+=list.join(","),s=s+"}"+(i===node.children.length-1?"":",")},i=0;i=0&&(this.rows[nodeIndex]=this.options.rowRenderer(node,this.options),this.update())}},InfiniteTree}(_events2["default"].EventEmitter);exports["default"]=InfiniteTree},function(module,exports){function EventEmitter(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function isFunction(arg){return"function"==typeof arg}function isNumber(arg){return"number"==typeof arg}function isObject(arg){return"object"==typeof arg&&null!==arg}function isUndefined(arg){return void 0===arg}module.exports=EventEmitter,EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._maxListeners=void 0,EventEmitter.defaultMaxListeners=10,EventEmitter.prototype.setMaxListeners=function(n){if(!isNumber(n)||0>n||isNaN(n))throw TypeError("n must be a positive number");return this._maxListeners=n,this},EventEmitter.prototype.emit=function(type){var er,handler,len,args,i,listeners;if(this._events||(this._events={}),"error"===type&&(!this._events.error||isObject(this._events.error)&&!this._events.error.length)){if(er=arguments[1],er instanceof Error)throw er;throw TypeError('Uncaught, unspecified "error" event.')}if(handler=this._events[type],isUndefined(handler))return!1;if(isFunction(handler))switch(arguments.length){case 1:handler.call(this);break;case 2:handler.call(this,arguments[1]);break;case 3:handler.call(this,arguments[1],arguments[2]);break;default:args=Array.prototype.slice.call(arguments,1),handler.apply(this,args)}else if(isObject(handler))for(args=Array.prototype.slice.call(arguments,1),listeners=handler.slice(),len=listeners.length,i=0;len>i;i++)listeners[i].apply(this,args);return!0},EventEmitter.prototype.addListener=function(type,listener){var m;if(!isFunction(listener))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",type,isFunction(listener.listener)?listener.listener:listener),this._events[type]?isObject(this._events[type])?this._events[type].push(listener):this._events[type]=[this._events[type],listener]:this._events[type]=listener,isObject(this._events[type])&&!this._events[type].warned&&(m=isUndefined(this._maxListeners)?EventEmitter.defaultMaxListeners:this._maxListeners,m&&m>0&&this._events[type].length>m&&(this._events[type].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[type].length),"function"==typeof console.trace&&console.trace())),this},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.once=function(type,listener){function g(){this.removeListener(type,g),fired||(fired=!0,listener.apply(this,arguments))}if(!isFunction(listener))throw TypeError("listener must be a function");var fired=!1;return g.listener=listener,this.on(type,g),this},EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events||!this._events[type])return this;if(list=this._events[type],length=list.length,position=-1,list===listener||isFunction(list.listener)&&list.listener===listener)delete this._events[type],this._events.removeListener&&this.emit("removeListener",type,listener);else if(isObject(list)){for(i=length;i-- >0;)if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}if(0>position)return this;1===list.length?(list.length=0,delete this._events[type]):list.splice(position,1),this._events.removeListener&&this.emit("removeListener",type,listener)}return this},EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[type]&&delete this._events[type],this;if(0===arguments.length){for(key in this._events)"removeListener"!==key&&this.removeAllListeners(key);return this.removeAllListeners("removeListener"),this._events={},this}if(listeners=this._events[type],isFunction(listeners))this.removeListener(type,listeners);else if(listeners)for(;listeners.length;)this.removeListener(type,listeners[listeners.length-1]);return delete this._events[type],this},EventEmitter.prototype.listeners=function(type){var ret;return ret=this._events&&this._events[type]?isFunction(this._events[type])?[this._events[type]]:this._events[type].slice():[]},EventEmitter.prototype.listenerCount=function(type){if(this._events){var evlistener=this._events[type];if(isFunction(evlistener))return 1;if(evlistener)return evlistener.length}return 0},EventEmitter.listenerCount=function(emitter,type){return emitter.listenerCount(type)}},function(module,exports,__webpack_require__){!function(name,definition){module.exports=definition()}("Clusterize",function(){"use strict";function on(evt,element,fnc){return element.addEventListener?element.addEventListener(evt,fnc,!1):element.attachEvent("on"+evt,fnc)}function off(evt,element,fnc){return element.removeEventListener?element.removeEventListener(evt,fnc,!1):element.detachEvent("on"+evt,fnc)}function isArray(arr){return"[object Array]"===Object.prototype.toString.call(arr)}function getStyle(prop,elem){return window.getComputedStyle?window.getComputedStyle(elem)[prop]:elem.currentStyle[prop]}var ie=function(){for(var v=3,el=document.createElement("b"),all=el.all||[];el.innerHTML="",all[0];);return v>4?v:document.documentMode}(),is_mac=navigator.platform.toLowerCase().indexOf("mac")+1,Clusterize=function(data){if(!(this instanceof Clusterize))return new Clusterize(data);var self=this,defaults={item_height:0,block_height:0,rows_in_block:50,rows_in_cluster:0,cluster_height:0,blocks_in_cluster:4,tag:null,content_tag:null,show_no_data_row:!0,no_data_class:"clusterize-no-data",no_data_text:"No data",keep_parity:!0,callbacks:{},scroll_top:0};self.options={};for(var option,options=["rows_in_block","blocks_in_cluster","show_no_data_row","no_data_class","no_data_text","keep_parity","tag","callbacks"],i=0;option=options[i];i++)self.options[option]="undefined"!=typeof data[option]&&null!=data[option]?data[option]:defaults[option];for(var elem,elems=["scroll","content"],i=0;elem=elems[i];i++)if(self[elem+"_elem"]=data[elem+"Id"]?document.getElementById(data[elem+"Id"]):data[elem+"Elem"],!self[elem+"_elem"])throw new Error("Error! Could not find "+elem+" element");self.content_elem.hasAttribute("tabindex")||self.content_elem.setAttribute("tabindex",0);var rows=isArray(data.rows)?data.rows:self.fetchMarkup(),cache={data:"",bottom:0},scroll_top=self.scroll_elem.scrollTop;self.exploreEnvironment(rows),self.insertToDOM(rows,cache),self.scroll_elem.scrollTop=scroll_top;var last_cluster=!1,scroll_debounce=0,pointer_events_set=!1,scrollEv=function(){is_mac&&(pointer_events_set||(self.content_elem.style.pointerEvents="none"),pointer_events_set=!0,clearTimeout(scroll_debounce),scroll_debounce=setTimeout(function(){self.content_elem.style.pointerEvents="auto",pointer_events_set=!1},50)),last_cluster!=(last_cluster=self.getClusterNum())&&self.insertToDOM(rows,cache),self.options.callbacks.scrollingProgress&&self.options.callbacks.scrollingProgress(self.getScrollProgress())},resize_debounce=0,resizeEv=function(){clearTimeout(resize_debounce),resize_debounce=setTimeout(self.refresh,100)};on("scroll",self.scroll_elem,scrollEv),on("resize",window,resizeEv),self.destroy=function(clean){off("scroll",self.scroll_elem,scrollEv),off("resize",window,resizeEv),self.html((clean?self.generateEmptyRow():rows).join(""))},self.refresh=function(){self.getRowsHeight(rows)&&self.update(rows)},self.update=function(new_rows){rows=isArray(new_rows)?new_rows:[];var scroll_top=self.scroll_elem.scrollTop;rows.length*self.options.item_height=ie&&!opts.tag&&(opts.tag=rows[0].match(/<([^>\s\/]*)/)[1].toLowerCase()),this.content_elem.children.length<=1&&this.html(rows[0]+rows[0]+rows[0]),opts.tag||(opts.tag=this.content_elem.children[0].tagName.toLowerCase()),this.getRowsHeight(rows))},getRowsHeight:function(rows){var opts=this.options,prev_item_height=opts.item_height;if(opts.cluster_height=0,rows.length){var nodes=this.content_elem.children;return opts.item_height=nodes[Math.floor(nodes.length/2)].offsetHeight,"tr"==opts.tag&&"collapse"!=getStyle("borderCollapse",this.content_elem)&&(opts.item_height+=parseInt(getStyle("borderSpacing",this.content_elem))||0),opts.block_height=opts.item_height*opts.rows_in_block,opts.rows_in_cluster=opts.blocks_in_cluster*opts.rows_in_block,opts.cluster_height=opts.blocks_in_cluster*opts.block_height,prev_item_height!=opts.item_height}},getClusterNum:function(){return this.options.scroll_top=this.scroll_elem.scrollTop,Math.floor(this.options.scroll_top/(this.options.cluster_height-this.options.block_height))||0},generateEmptyRow:function(){var opts=this.options;if(!opts.tag||!opts.show_no_data_row)return[];var td,empty_row=document.createElement(opts.tag),no_data_content=document.createTextNode(opts.no_data_text);return empty_row.className=opts.no_data_class,"tr"==opts.tag&&(td=document.createElement("td"),td.appendChild(no_data_content)),empty_row.appendChild(td||no_data_content),[empty_row.outerHTML]},generate:function(rows,cluster_num){var opts=this.options,rows_len=rows.length;if(rows_lentop_offset&&rows_above++;for(var i=items_start;items_end>i;i++)rows[i]&&this_cluster_rows.push(rows[i]);return{top_offset:top_offset,bottom_offset:bottom_offset,rows_above:rows_above,rows:this_cluster_rows}},renderExtraTag:function(class_name,height){var tag=document.createElement(this.options.tag),clusterize_prefix="clusterize-";return tag.className=[clusterize_prefix+"extra-row",clusterize_prefix+class_name].join(" "),height&&(tag.style.height=height+"px"),tag.outerHTML},insertToDOM:function(rows,cache){var data=this.generate(rows,this.getClusterNum()),this_cluster_rows=data.rows.join(""),this_cluster_content_changed=this.checkChanges("data",this_cluster_rows,cache),only_bottom_offset_changed=this.checkChanges("bottom",data.bottom_offset,cache),callbacks=this.options.callbacks,layout=[]; +this_cluster_content_changed?(data.top_offset&&(this.options.keep_parity&&layout.push(this.renderExtraTag("keep-parity")),layout.push(this.renderExtraTag("top-space",data.top_offset))),layout.push(this_cluster_rows),data.bottom_offset&&layout.push(this.renderExtraTag("bottom-space",data.bottom_offset)),callbacks.clusterWillChange&&callbacks.clusterWillChange(),this.html(layout.join("")),"ol"==this.options.content_tag&&this.content_elem.setAttribute("start",data.rows_above),callbacks.clusterChanged&&callbacks.clusterChanged()):only_bottom_offset_changed&&(this.content_elem.lastChild.style.height=data.bottom_offset+"px")},html:function(data){var content_elem=this.content_elem;if(ie&&9>=ie&&"tr"==this.options.tag){var last,div=document.createElement("div");for(div.innerHTML=""+data+"
";last=content_elem.lastChild;)content_elem.removeChild(last);for(var rows_nodes=this.getChildNodes(div.firstChild.firstChild);rows_nodes.length;)content_elem.appendChild(rows_nodes.shift())}else content_elem.innerHTML=data},getChildNodes:function(tag){for(var child_nodes=tag.children,nodes=[],i=0,ii=child_nodes.length;ii>i;i++)nodes.push(child_nodes[i]);return nodes},checkChanges:function(type,value,cache){var changed=value!=cache[type];return cache[type]=value,changed}},Clusterize})},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}exports.__esModule=!0,exports.Node=exports.flatten=void 0;var _flatten=__webpack_require__(5),_flatten2=_interopRequireDefault(_flatten),_node=__webpack_require__(7),_node2=_interopRequireDefault(_node);exports.flatten=_flatten2["default"],exports.Node=_node2["default"]},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}exports.__esModule=!0;var _extend=__webpack_require__(6),_extend2=_interopRequireDefault(_extend),_node=__webpack_require__(7),_node2=_interopRequireDefault(_node),flatten=function flatten(){var nodes=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],options=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];nodes=[].concat(nodes);var flatten=[],stack=[],pool={lastChild:{}};options.openAllNodes=!!options.openAllNodes,options.openNodes=options.openNodes||[],options.throwOnError=!!options.throwOnError;var firstNode=nodes.length>0?nodes[0]:null,parentNode=firstNode?firstNode.parent:null;!parentNode||parentNode instanceof _node2["default"]||(parentNode=new _node2["default"](parentNode));var rootNode=parentNode||new _node2["default"]({label:"",parent:null,children:nodes,state:{depth:-1,open:!0,path:"",prefixMask:"",total:0}});if(rootNode===parentNode)for(var subtotal=rootNode.state.total||0,p=rootNode;p;){var _p$state=p.state,path=_p$state.path,_p$state$total=_p$state.total,total=void 0===_p$state$total?0:_p$state$total;if(p.isLastChild()&&path&&(pool.lastChild[path]=!0),p.state.total=total-subtotal,p.state.total<0){if(options.throwOnError)throw new Error("The node might have been corrupted: id="+JSON.stringify(p.id)+", state="+JSON.stringify(p.state));console&&console.log("Error: The node might have been corrupted: id=%s, label=%s, parent=%s, children=%s, state=%s",JSON.stringify(p.id),JSON.stringify(p.label),p.parent,p.children,JSON.stringify(p.state))}p=p.parent}for(stack.push([rootNode,rootNode.state.depth,0]);stack.length>0;)for(var _stack$pop=stack.pop(),current=_stack$pop[0],depth=_stack$pop[1],index=_stack$pop[2],_loop=function(){var node=current.children[index];node instanceof _node2["default"]||(node=new _node2["default"](node)),node.parent=current,node.children=node.children||[],node.parent.children[index]=node;var path=current.state.path+"."+index,open=node.hasChildren()&&function(){var openAllNodes=options.openAllNodes,openNodes=options.openNodes;return openAllNodes?!0:openNodes.indexOf(node)>=0?!0:openNodes.indexOf(node.id)>=0}(),prefixMask=function(prefix){for(var mask="";prefix.length>0;)prefix=prefix.replace(/\.\d+$/,""),mask=!prefix||pool.lastChild[prefix]?"0"+mask:"1"+mask;return mask}(path);node.isLastChild()&&(pool.lastChild[path]=!0),node.state=(0,_extend2["default"])({},node.state,{depth:depth+1,open:open,path:path,prefixMask:prefixMask,total:0});for(var parentDidOpen=!0,_p=node;null!==_p.parent;){if(_p.parent.state.open===!1){parentDidOpen=!1;break}_p=_p.parent}if(parentDidOpen){flatten.push(node);for(var _p2=node;null!==_p2.parent;)_p2.parent.state.total++,_p2=_p2.parent}++index,node.hasChildren()&&(stack.push([current,depth,index]),index=0,depth+=1,current=node)};index1?_len-1:0),_key=1;_len>_key;_key++)sources[_key-1]=arguments[_key];if(void 0===target||null===target)throw new TypeError("Cannot convert undefined or null to object");for(var output=Object(target),index=0;index0&&index>=0&&index0&&(node=this.children[0]),node},Node.prototype.getLastChild=function(){var node=null;return this.children.length>0&&(node=this.children[this.children.length-1]),node},Node.prototype.getNextSibling=function(){var node=null;if(this.parent){var index=this.parent.children.indexOf(this);index>=0&&index0&&index0},Node.prototype.isLastChild=function(){var hasNextSibling=this.getNextSibling();return!hasNextSibling},Node}();exports["default"]=Node},function(module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}exports.__esModule=!0;var LookupTable=function(){function LookupTable(){_classCallCheck(this,LookupTable),this.data={}}return LookupTable.prototype.clear=function(){this.data={}},LookupTable.prototype.get=function(key){return this.data[key]},LookupTable.prototype.has=function(key){return void 0!==this.data[key]},LookupTable.prototype.set=function(key,value){return this.data[key]=value,value},LookupTable.prototype.unset=function(key){void 0!==this.data[key]&&delete this.data[key]},LookupTable}();exports["default"]=LookupTable},function(module,exports,__webpack_require__){"use strict";exports.__esModule=!0,exports.defaultRowRenderer=void 0;var _helper=__webpack_require__(10),defaultRowRenderer=function(node,treeOptions){var id=node.id,name=node.name,_node$loadOnDemand=node.loadOnDemand,loadOnDemand=void 0===_node$loadOnDemand?!1:_node$loadOnDemand,children=node.children,state=node.state,depth=state.depth,open=state.open,path=state.path,total=state.total,_state$selected=state.selected,selected=void 0===_state$selected?!1:_state$selected,childrenLength=Object.keys(children).length,more=node.hasChildren(),togglerContent="";more&&open&&(togglerContent="▼"),more&&!open&&(togglerContent="►"),!more&&loadOnDemand&&(togglerContent="►");var toggler=(0,_helper.buildHTML)("a",togglerContent,{"class":function(){return more&&open?(0,_helper.classNames)("infinite-tree-toggler"):more&&!open?(0,_helper.classNames)("infinite-tree-toggler","infinite-tree-closed"):!more&&loadOnDemand?(0,_helper.classNames)("infinite-tree-toggler","infinite-tree-closed"):""}()}),title=(0,_helper.buildHTML)("span",(0,_helper.quoteattr)(name),{"class":(0,_helper.classNames)("infinite-tree-title")}),treeNode=(0,_helper.buildHTML)("div",toggler+title,{"class":"infinite-tree-node",style:"margin-left: "+18*depth+"px"});return(0,_helper.buildHTML)("div",treeNode,{"data-id":id,"data-expanded":more&&open,"data-depth":depth,"data-path":path,"data-selected":selected,"data-children":childrenLength,"data-total":total,"class":(0,_helper.classNames)("infinite-tree-item",{"infinite-tree-selected":selected}),droppable:!0})};exports.defaultRowRenderer=defaultRowRenderer},function(module,exports){"use strict";exports.__esModule=!0;var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol?"symbol":typeof obj},extend=function(target){for(var _len=arguments.length,sources=Array(_len>1?_len-1:0),_key=1;_len>_key;_key++)sources[_key-1]=arguments[_key];target=target||{};for(var index=0;index=0},addClass=function(el,className){if(!el)return"";if(!hasClass(el,className)){var classes=el.className.split(" ");el.className=classes.concat(className).join(" ")}return el.className},removeClass=function(el,className){if(!el)return"";if(hasClass(el,className)){var classes=el.className.split(" ");el.className=classes.filter(function(c){return c!==className}).join(" ")}return el.className},toggleClass=function(el,className){el&&(hasClass(el,className)?removeClass(el,className):addClass(el,className))},classNames=function classNames(){for(var _len2=arguments.length,args=Array(_len2),_key2=0;_len2>_key2;_key2++)args[_key2]=arguments[_key2];var classNames=[];return args.forEach(function(arg){Array.isArray(arg)?classNames=classNames.concat(arg):"object"===("undefined"==typeof arg?"undefined":_typeof(arg))?Object.keys(arg).forEach(function(className){var ok=arg[className];ok&&classNames.push(className)}):classNames.push(arg)}),classNames.join(" ")},isDOMElement=function(o){return"object"===("undefined"==typeof HTMLElement?"undefined":_typeof(HTMLElement))?o instanceof HTMLElement:o&&"object"===("undefined"==typeof o?"undefined":_typeof(o))&&1===o.nodeType&&"string"==typeof o.nodeName},isDOMNode=function(o){return"object"===("undefined"==typeof Node?"undefined":_typeof(Node))?o instanceof Node:o&&"object"===("undefined"==typeof o?"undefined":_typeof(o))&&"number"==typeof o.nodeType&&"string"==typeof o.nodeName},quoteattr=function(s,preserveCR){return preserveCR=preserveCR?" ":"\n",(""+s).replace(/&/g,"&").replace(/'/g,"'").replace(/"/g,""").replace(//g,">").replace(/\r\n/g,preserveCR).replace(/[\r\n]/g,preserveCR)},buildHTML=function buildHTML(tag,html,attrs){switch(tag){case"select":if("object"===("undefined"==typeof html?"undefined":_typeof(html))){var options=html||{};html="";for(var value in options)options.hasOwnProperty(value)&&(html+=buildHTML("option",options[value]||"",{value:value}))}break;default:"object"===("undefined"==typeof html?"undefined":_typeof(html))&&(attrs=html,html=void 0)}var h="<"+tag;for(var attr in attrs)attrs.hasOwnProperty(attr)&&"undefined"!=typeof attrs[attr]&&(h+=" "+attr+'="'+quoteattr(attrs[attr])+'"');return h+="undefined"!=typeof html?">"+html+"":"/>"};exports.extend=extend,exports.preventDefault=preventDefault,exports.stopPropagation=stopPropagation,exports.dispatchEvent=dispatchEvent,exports.addEventListener=addEventListener,exports.removeEventListener=removeEventListener,exports.hasClass=hasClass,exports.addClass=addClass,exports.removeClass=removeClass,exports.toggleClass=toggleClass,exports.classNames=classNames,exports.isDOMElement=isDOMElement,exports.isDOMNode=isDOMNode,exports.quoteattr=quoteattr,exports.buildHTML=buildHTML}])}); \ No newline at end of file