From 1954cadac491d5c6b3446cd8f2f21cd7310e269e Mon Sep 17 00:00:00 2001 From: Cheton Wu Date: Mon, 4 Apr 2016 00:22:47 +0800 Subject: [PATCH] Update dist files --- dist/infinite-tree.js | 14 +++++++------- dist/infinite-tree.min.js | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dist/infinite-tree.js b/dist/infinite-tree.js index 5c7ba92..f6e6805 100644 --- a/dist/infinite-tree.js +++ b/dist/infinite-tree.js @@ -2143,9 +2143,6 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; - Object.defineProperty(exports, "__esModule", { - value: true - }); var preventDefault = function preventDefault(e) { if (typeof e.preventDefault !== 'undefined') { e.preventDefault(); @@ -2186,10 +2183,13 @@ return /******/ (function(modules) { // webpackBootstrap } }; - exports.preventDefault = preventDefault; - exports.stopPropagation = stopPropagation; - exports.addEventListener = addEventListener; - exports.removeEventListener = removeEventListener; + // IE8 compatibility output + module.exports = { + preventDefault: preventDefault, + stopPropagation: stopPropagation, + addEventListener: addEventListener, + removeEventListener: removeEventListener + }; /***/ } /******/ ]) diff --git a/dist/infinite-tree.min.js b/dist/infinite-tree.min.js index 36d4c9d..71b4dae 100644 --- a/dist/infinite-tree.min.js +++ b/dist/infinite-tree.min.js @@ -1,3 +1,3 @@ /*! infinite-tree v0.3.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}}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)}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},_createClass=function(){function defineProperties(target,props){for(var i=0;i1?_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;index=0&&(handleToggler=!0),itemTarget=itemTarget.parentElement;var id=itemTarget.getAttribute("aria-id"),node=_this.getNodeById(id);if(!node)return;handleToggler?_this.toggleNode(node):_this.selectNode(node)}},_this.options=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),_createClass(InfiniteTree,[{key:"create",value:function(){var _this2=this;if(!this.options.el)throw new Error("The element option is not specified.");var scrollElement=document.createElement("div");scrollElement.className=(0,_utils.classNames)("infinite-tree","infinite-tree-scroll");var contentElement=document.createElement("div");contentElement.className=(0,_utils.classNames)("infinite-tree","infinite-tree-content"),scrollElement.appendChild(contentElement),this.options.el.appendChild(scrollElement),this.clusterize=new _clusterize2["default"]({tag:"div",rows:[],scrollElem:scrollElement,contentElem:contentElement,no_data_class:"infinite-tree-no-data",callbacks:{clusterWillChange:function(){},clusterChanged:function(){},scrollingProgress:function(progress){_this2.emit("scrollProgress",progress)}}}),this.scrollElement=scrollElement,this.contentElement=contentElement,(0,_polyfill.addEventListener)(this.contentElement,"click",this.contentListener)}},{key:"clear",value:function(){this.clusterize.clear(),this.tbl.clear(),this.nodes=[],this.rows=[],this.state.openNodes=[],this.state.rootNode=null,this.state.selectedNode=null}},{key:"destroy",value:function(){for((0,_polyfill.removeEventListener)(this.contentElement,"click",this.contentListener),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}},{key:"update",value:function(){this.clusterize.update(this.rows)}},{key:"addChildNodeAt",value:function(newNode,index,parentNode){var _this3=this;if(parentNode=parentNode||this.state.rootNode,!(parentNode instanceof _flattree.Node))throw new Error("The parent node must be a Node object.");var rowRenderer=this.options.rowRenderer;if(!newNode)return!1;index=Number(index)||0,0>index&&(index=0),newNode.parent=parentNode,parentNode.children.splice(index,0,newNode);var deleteCount=parentNode.state.total;index=parentNode.children.indexOf(newNode);var nodes=(0,_flattree.flatten)(parentNode.children,{openNodes:this.state.openNodes});newNode=parentNode.getChildAt(index);var rows=nodes.map(function(node){return rowRenderer(node)}),parentOffset=this.nodes.indexOf(parentNode);return this.nodes.splice.apply(this.nodes,[parentOffset+1,deleteCount].concat(nodes)),this.rows.splice.apply(this.rows,[parentOffset+1,deleteCount].concat(rows)),this.tbl.set(newNode.id,newNode),this.flatten(newNode).forEach(function(node){void 0!==node.id&&_this3.tbl.set(node.id,node)}),this.rows[parentOffset]=rowRenderer(parentNode),this.update(),!0}},{key:"appendChildNode",value:function(newNode,parentNode){if(parentNode=parentNode||this.state.rootNode,!(parentNode instanceof _flattree.Node))throw new Error("The parent node must be a Node object.");var index=parentNode.children.length;return this.addChildNodeAt(newNode,index,parentNode)}},{key:"insertNodeAfter",value:function(newNode,referenceNode){if(!(referenceNode instanceof _flattree.Node))throw new Error("The reference node must be a Node object.");var parentNode=referenceNode.getParent(),index=parentNode.children.indexOf(referenceNode)+1;return this.addChildNodeAt(newNode,index,parentNode)}},{key:"insertNodeBefore",value:function(newNode,referenceNode){if(!(referenceNode instanceof _flattree.Node))throw new Error("The reference node must be a Node object.");var parentNode=referenceNode.getParent(),index=parentNode.children.indexOf(referenceNode);return this.addChildNodeAt(newNode,index,parentNode)}},{key:"closeNode",value:function(node){var rowRenderer=this.options.rowRenderer,nodeIndex=this.nodes.indexOf(node);if(0>nodeIndex)throw new Error("Invalid node specified: node.id="+JSON.stringify(node.id));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;p;)p.state.total=p.state.total-deleteCount,p=p.parent;return this.nodes.splice(nodeIndex+1,deleteCount),this.rows.splice(nodeIndex+1,deleteCount),this.rows[nodeIndex]=rowRenderer(node),this.emit("closeNode",node),this.update(),!0}},{key:"getChildNodes",value:function(){var node=arguments.length<=0||void 0===arguments[0]?null:arguments[0];if(node)return node.children||[];for(node=this.nodes.length>0?this.nodes[0]:null;node&&null!==node.parent;)node=node.parent;return node&&node.children||[]}},{key:"getNodeById",value:function(id){var node=this.tbl.get(id);if(!node){if(node=this.nodes.filter(function(node){return node.id===id})[0],!node)return null;this.tbl.set(node.id,node)}return node}},{key:"getSelectedNode",value:function(){return this.state.selectedNode}},{key:"getOpenNodes",value:function(){return this.state.openNodes.slice()}},{key:"loadData",value:function(){var _this4=this,data=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],_options=this.options,autoOpen=_options.autoOpen,rowRenderer=_options.rowRenderer;this.nodes=(0,_flattree.flatten)(data,{openAllNodes:autoOpen}),this.tbl.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[0]),this.state.selectedNode=null,this.flatten(this.state.rootNode).forEach(function(node){void 0!==node.id&&_this4.tbl.set(node.id,node)}),this.rows=this.nodes.map(function(node){return rowRenderer(node)}),this.update()}},{key:"openNode",value:function(node){var _this5=this,rowRenderer=this.options.rowRenderer,nodeIndex=this.nodes.indexOf(node);if(0>nodeIndex)throw new Error("Invalid node specified: node.id="+JSON.stringify(node.id));if(this.state.openNodes.indexOf(node)>=0)return!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 rowRenderer(node)});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]=rowRenderer(node),nodes.length>0&&!this.tbl.get(nodes[0])&&nodes.forEach(function(node){void 0!==node.id&&_this5.tbl.set(node.id,node)}),this.emit("openNode",node),this.update(),!0}},{key:"removeNode",value:function(node){}},{key:"scrollToNode",value:function(node){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)}},{key:"scrollTop",value:function(value){return this.scrollElement?(void 0!==value&&(this.scrollElement.scrollTop=Number(value)),this.scrollElement.scrollTop):0}},{key:"selectNode",value:function(){var node=arguments.length<=0||void 0===arguments[0]?null:arguments[0],rowRenderer=this.options.rowRenderer;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]=rowRenderer(selectedNode),this.state.selectedNode=null,this.emit("selectNode",null),this.update(),!0}return!1}var nodeIndex=this.nodes.indexOf(node);if(0>nodeIndex)throw new Error("Invalid node specified: node.id="+JSON.stringify(node.id));if(this.state.selectedNode!==node&&(node.state.selected=!0,this.rows[nodeIndex]=rowRenderer(node)),this.state.selectedNode){var _selectedNode=this.state.selectedNode,_selectedIndex=this.nodes.indexOf(_selectedNode);_selectedNode.state.selected=!1,this.rows[_selectedIndex]=rowRenderer(_selectedNode)}return this.state.selectedNode!==node?(this.state.selectedNode=node,this.emit("selectNode",node)):(this.state.selectedNode=null,this.emit("selectNode",null)),this.update(),!0}},{key:"toggleNode",value:function(node){this.state.openNodes.indexOf(node)>=0?this.closeNode(node):this.openNode(node)}},{key:"toString",value: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;inodeIndex)throw new Error("Invalid node specified: node.id="+JSON.stringify(node.id));var _node=node,children=_node.children,parent=_node.parent,state=_node.state;node=extend(node,data,{children:children,parent:parent,state:state}),this.rows[nodeIndex]=rowRenderer(node),this.update()}}]),InfiniteTree}(_events2["default"].EventEmitter);module.exports=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}}var _flatten=__webpack_require__(4),_flatten2=_interopRequireDefault(_flatten),_node=__webpack_require__(6),_node2=_interopRequireDefault(_node);module.exports={flatten:_flatten2["default"],Node:_node2["default"]}},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}var _slicedToArray=function(){function sliceIterator(arr,i){var _arr=[],_n=!0,_d=!1,_e=void 0;try{for(var _s,_i=arr[Symbol.iterator]();!(_n=(_s=_i.next()).done)&&(_arr.push(_s.value),!i||_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{!_n&&_i["return"]&&_i["return"]()}finally{if(_d)throw _e}}return _arr}return function(arr,i){if(Array.isArray(arr))return arr;if(Symbol.iterator in Object(arr))return sliceIterator(arr,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),_extend=__webpack_require__(5),_extend2=_interopRequireDefault(_extend),_node=__webpack_require__(6),_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(),_stack$pop2=_slicedToArray(_stack$pop,3),current=_stack$pop2[0],depth=_stack$pop2[1],index=_stack$pop2[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}},{key:"getLastChild",value:function(){var node=null;return this.children.length>0&&(node=this.children[this.children.length-1]),node}},{key:"getNextSibling",value:function(){var node=null;if(this.parent){var index=this.parent.children.indexOf(this);index>=0&&index0&&index0}},{key:"isLastChild",value:function(){var hasNextSibling=this.getNextSibling();return!hasNextSibling}}]),Node}();module.exports=Node},function(module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function defineProperties(target,props){for(var i=0;i"+html+"":"/>"},classNames=function classNames(){for(var _len=arguments.length,args=Array(_len),_key=0;_len>_key;_key++)args[_key]=arguments[_key];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(" ")},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)};module.exports={buildHTML:buildHTML,classNames:classNames,quoteattr:quoteattr}},function(module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var preventDefault=function(e){"undefined"!=typeof e.preventDefault?e.preventDefault():e.returnValue=!1},stopPropagation=function(e){"undefined"!=typeof e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},addEventListener=function(target,type,listener){target.addEventListener?target.addEventListener(type,listener,!1):target.attachEvent&&target.attachEvent("on"+type,listener)},removeEventListener=function(target,type,listener){target.removeEventListener?target.removeEventListener(type,listener,!1):target.detachEvent&&target.detachEvent("on"+type,listener)};exports.preventDefault=preventDefault,exports.stopPropagation=stopPropagation,exports.addEventListener=addEventListener,exports.removeEventListener=removeEventListener}])}); \ No newline at end of file +if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function defineProperties(target,props){for(var i=0;i0&&index>=0&&index0&&(node=this.children[0]),node}},{key:"getLastChild",value:function(){var node=null;return this.children.length>0&&(node=this.children[this.children.length-1]),node}},{key:"getNextSibling",value:function(){var node=null;if(this.parent){var index=this.parent.children.indexOf(this);index>=0&&index0&&index0}},{key:"isLastChild",value:function(){var hasNextSibling=this.getNextSibling();return!hasNextSibling}}]),Node}();module.exports=Node},function(module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function defineProperties(target,props){for(var i=0;i"+html+"":"/>"},classNames=function classNames(){for(var _len=arguments.length,args=Array(_len),_key=0;_len>_key;_key++)args[_key]=arguments[_key];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(" ")},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)};module.exports={buildHTML:buildHTML,classNames:classNames,quoteattr:quoteattr}},function(module,exports){"use strict";var preventDefault=function(e){"undefined"!=typeof e.preventDefault?e.preventDefault():e.returnValue=!1},stopPropagation=function(e){"undefined"!=typeof e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},addEventListener=function(target,type,listener){target.addEventListener?target.addEventListener(type,listener,!1):target.attachEvent&&target.attachEvent("on"+type,listener)},removeEventListener=function(target,type,listener){target.removeEventListener?target.removeEventListener(type,listener,!1):target.detachEvent&&target.detachEvent("on"+type,listener)};module.exports={preventDefault:preventDefault,stopPropagation:stopPropagation,addEventListener:addEventListener,removeEventListener:removeEventListener}}])}); \ No newline at end of file