Your IP : 3.143.3.114


Current Path : /var/www/u0635749/data/www/hobbyclick.ru/public/www/bitrix/js/report/js/dashboard/
Upload File :
Current File : /var/www/u0635749/data/www/hobbyclick.ru/public/www/bitrix/js/report/js/dashboard/cell.min.js

(function(){BX.namespace("BX.Report.Dashboard");BX.Report.Dashboard.Cell=function(t){this.height=t.height||400;this.widget=t.widget;this.flexValue=t.flexValue||1;this.row=t.row;this.empty=true;this.rendered=false;this.id=t.id;this.layout={cellContainer:null,tempContainer:null}};BX.Report.Dashboard.Cell.prototype={getId:function(){return this.id},getWidget:function(){return this.widget},getRow:function(){return this.row},getHeight:function(){return this.height},setHeight:function(t){this.height=t;if(this.isRendered()){this.getContainer().style.minHeight=t+"px"}},getContainer:function(){if(this.layout.cellContainer){return this.layout.cellContainer}this.layout.cellContainer=BX.create("div",{attrs:{className:"report-visualconstructor-dashboard-cell report-visualconstructor-dashboard-empty-cell","data-id":this.id,"data-type":"cell"},style:{flex:this.flexValue||1,minHeight:"0"}});this.layout.cellContainer.onbxdestdragstart=BX.delegate(this.onWidgetDragStart,this);this.layout.cellContainer.onbxdestdraghover=BX.delegate(this.onWidgetDragEnter,this);this.layout.cellContainer.onbxdestdraghout=BX.delegate(this.onWidgetDragLeave,this);this.layout.cellContainer.onbxdestdragfinish=BX.delegate(this.onWidgetDragDrop,this);this.layout.cellContainer.onbxdestdragstop=BX.delegate(this.onWidgetDragEnd,this);jsDD.registerDest(this.layout.cellContainer,30);return this.layout.cellContainer},getCellTempContainer:function(){if(this.layout.tempContainer){return this.layout.tempContainer}this.layout.tempContainer=BX.create("div",{text:"Drop here widget or ",attrs:{className:"report-visualconstructor-dashboard-cell-temp-content"}});var t=BX.create("ins",{html:"create",events:{}});this.layout.tempContainer.appendChild(t);return this.layout.tempContainer},onWidgetDragStart:function(t){if(t.dataset.type!=="widget"){return}var e=this.getRow().getBoard().getWidget(t.dataset.id);if(e.getCell().getRow().getBoard()!==this.getRow().getBoard()){return}if(e.getHeight()>this.getHeight()){return}if(!e.isResizeable()&&e.getCell().getContainer().clientWidth>this.getContainer().clientWidth+4){return}if(this.isEmpty()){this.getContainer().classList.add("report-visualconstructor-dashboard-empty-cell-droppable")}jsDD.refreshDestArea()},onWidgetDragEnter:function(t){if(t.dataset.type!=="widget"){return}var e=this.getRow().getBoard().getWidget(t.dataset.id);if(e.getCell().getRow().getBoard()!==this.getRow().getBoard()){return}if(e.getHeight()>this.getHeight()){return}if(!e.isResizeable()&&e.getCell().getContainer().clientWidth>this.getContainer().clientWidth+4){return}if(this.isEmpty()){this.getContainer().classList.add("report-visualconstructor-dashboard-empty-cell-droppable-active");this.expendTimer=setTimeout(function(){this.getContainer().style.transition="min-height 700ms";this.getContainer().style.minHeight=e.getHeight()+"px";this.getContainer().addEventListener("transitionend",function(){jsDD.refreshDestArea()},false)}.bind(this),300)}else{this.moveTimer=setTimeout(BX.delegate(function(){var e=this.getRow().getBoard().getWidget(t.dataset.id);if(e!==this.getWidget()){this.getRow().moveWidget(e,this.getWidget())}},this),500)}},onWidgetDragLeave:function(t){if(t.dataset.type!=="widget"){return}var e=this.getRow().getBoard().getWidget(t.dataset.id);if(e.getCell().getRow().getBoard()!==this.getRow().getBoard()){return}if(!e.isResizeable()&&e.getCell().getContainer().clientWidth>this.getContainer().clientWidth+4){return}this.getContainer().classList.remove("report-visualconstructor-dashboard-empty-cell-droppable-active");clearTimeout(this.moveTimer);clearTimeout(this.expendTimer);setTimeout(function(){this.getContainer().style.minHeight="50px"}.bind(this),300)},onWidgetDragDrop:function(t){clearTimeout(this.moveTimer);if(t.dataset.type!=="widget"){return}var e=this.getRow().getBoard().getWidget(t.dataset.id);if(e.getCell().getRow().getBoard()!==this.getRow().getBoard()){return}if(!e.isResizeable()&&e.getCell().getContainer().clientWidth>this.getContainer().clientWidth+4){return}if(e.getHeight()>this.getHeight()){return}if(this.isEmpty()){e.dropped=true;var i=e.getCell();var r=e.getRow();if(r!==this.getRow()){r.removeWidget(e);this.getRow().addWidget(e)}this.setWidget(e);e.setCell(this);var s=this.getContainer().clientHeight;var o=e.getHeight();var n=Math.round(s/o);if(n>1){this.getRow().getRowLayout().transformCellToContainer(this,{orientation:"vertical",cellCount:n})}this.getRow().getRowLayout().adjustNoEmptyCellsInCellLevel(this);if(r.getWidgets().length!==0&&i.getId()!==this.getId()){i.clear()}this.getRow().getBoard().lazyLoad();BX.onCustomEvent(this.getRow().getBoard(),"BX.Report.Dashboard.Widget:afterMove",[this.getRow().getWidgets(),this.getRow()]);if(r.getWidgets().length!==0){i.adjustToMaxSize();BX.onCustomEvent(this.getRow().getBoard(),"BX.Report.Dashboard.Widget:afterMove",[i.getRow().getWidgets(),i.getRow()])}this.getRow().removePseudo()}this.getRow().getBoard().removePseudoRows()},onWidgetDragEnd:function(t){if(t.dataset.type==="widget"){var e=this.getRow().getBoard().getWidget(t.dataset.id);if(e&&!e.dropped){e.getCell().setWidget(e)}this.getContainer().classList.remove("report-visualconstructor-dashboard-empty-cell-droppable");this.getContainer().classList.remove("report-visualconstructor-dashboard-empty-cell-droppable-active");if(!this.isEmpty()){this.getContainer().style.transition="min-height 300ms";this.getContainer().style.minHeight=this.getWidget().getHeight()+"px"}}},clear:function(){BX.cleanNode(this.getContainer());this.getCellTempContainer().classList.remove("report-visualconstructor-dashboard-hidden-temp-content");this.getContainer().appendChild(this.getCellTempContainer());this.getContainer().classList.add("report-visualconstructor-dashboard-empty-cell");this.getContainer().style.minHeight="";this.empty=true;this.widget=null;this.getRow().getRowLayout().getCellById(this.getId()).empty=true;this.getRow().getRowLayout().getCellById(this.getId()).widget=null;BX.onCustomEvent(this,"BX.Report.Dashboard.Cell:clean",[this])},isEmpty:function(){return this.empty},render:function(){var t=this.getContainer();t.appendChild(this.getCellTempContainer());if(this.getWidget()instanceof BX.Report.Dashboard.Widget){t.classList.remove("report-visualconstructor-dashboard-empty-cell");t.classList.remove("report-visualconstructor-dashboard-empty-cell-droppable");t.appendChild(this.getWidget().render());t.style.minHeight=this.getWidget().getHeight()+"px";this.getWidget().setCell(this);this.getCellTempContainer().classList.add("report-visualconstructor-dashboard-hidden-temp-content");this.empty=false}else{this.clear()}this.rendered=true;return t},isRendered:function(){return this.rendered},setWidget:function(t){this.widget=t;this.setHeight(t.getHeight());if(this.isRendered()){this.render();if(this.widget.loaded){BX.onCustomEvent(this.getWidget(),"Dashboard.Board.Widget:onAfterRender")}}},adjustToMaxSize:function(){this.getRow().getRowLayout().adjustCellToMaxSize(this)},destroy:function(){jsDD.unregisterDest(this.getContainer());jsDD.current_dest_index=false;BX.remove(this.getContainer())}}})();