%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/bitrix/www/bitrix/components/bitrix/main.ui.grid/templates/.default/
Upload File :
Create Path :
Current File : //home/bitrix/www/bitrix/components/bitrix/main.ui.grid/templates/.default/script.min.js

(function(){"use strict";BX.namespace("BX.Main");BX.Main.grid=function(t,e,i,n,s,o,a,r,l){this.settings=null;this.containerId="";this.container=null;this.wrapper=null;this.fadeContainer=null;this.scrollContainer=null;this.pagination=null;this.moreButton=null;this.table=null;this.rows=null;this.history=false;this.userOptions=null;this.checkAll=null;this.sortable=null;this.updater=null;this.data=null;this.fader=null;this.editor=null;this.isEditMode=null;this.pinHeader=null;this.pinPanel=null;this.arParams=null;this.resize=null;this.init(t,e,i,n,s,o,a,r,l)};BX.Main.grid.isNeedResourcesReady=function(t){return BX.hasClass(t,"main-grid-load-animation")};BX.Main.grid.prototype={init:function(t,e,i,n,s,o,a,r,l){this.baseUrl=window.location.pathname+window.location.search;this.container=BX(t);if(!BX.type.isNotEmptyString(t)){throw"BX.Main.grid.init: parameter containerId is empty"}if(BX.type.isPlainObject(e)){this.arParams=e}else{throw new Error("BX.Main.grid.init: arParams isn't object")}this.settings=new BX.Grid.Settings;this.containerId=t;this.userOptions=new BX.Grid.UserOptions(this,i,n,s);this.gridSettings=new BX.Grid.SettingsWindow(this);this.messages=new BX.Grid.Message(this,l);if(this.getParam("ALLOW_PIN_HEADER")){this.pinHeader=new BX.Grid.PinHeader(this);BX.addCustomEvent(window,"Grid::headerUpdated",BX.proxy(this.bindOnCheckAll,this))}this.bindOnCheckAll();if(this.getParam("ALLOW_HORIZONTAL_SCROLL")){this.fader=new BX.Grid.Fader(this)}this.pageSize=new BX.Grid.Pagesize(this);this.editor=new BX.Grid.InlineEditor(this,r);if(this.getParam("SHOW_ACTION_PANEL")){this.actionPanel=new BX.Grid.ActionPanel(this,o,a);this.pinPanel=new BX.Grid.PinPanel(this)}this.isEditMode=false;if(!BX.type.isDomNode(this.getContainer())){throw"BX.Main.grid.init: Failed to find container with id "+this.getContainerId()}if(!BX.type.isDomNode(this.getTable())){throw"BX.Main.grid.init: Failed to find table"}this.bindOnRowEvents();if(this.getParam("ALLOW_COLUMNS_RESIZE")){this.resize=new BX.Grid.Resize(this)}this.bindOnMoreButtonEvents();this.bindOnClickPaginationLinks();this.bindOnClickHeader();if(this.getParam("ALLOW_ROWS_SORT")){this.initRowsDragAndDrop()}if(this.getParam("ALLOW_COLUMNS_SORT")){this.initColsDragAndDrop()}this.getRows().initSelected();this.adjustEmptyTable(this.getRows().getSourceBodyChild());BX.onCustomEvent(this.getContainer(),"Grid::ready",[this]);BX.addCustomEvent(window,"Grid::unselectRow",BX.proxy(this._onUnselectRows,this));BX.addCustomEvent(window,"Grid::unselectRows",BX.proxy(this._onUnselectRows,this));BX.addCustomEvent(window,"Grid::allRowsUnselected",BX.proxy(this._onUnselectRows,this));BX.addCustomEvent(window,"Grid::updated",BX.proxy(this._onGridUpdated,this));window.frames[this.getFrameId()].onresize=BX.throttle(this._onFrameResize,20,this);this.initStickedColumns()},destroy:function(){BX.removeCustomEvent(window,"Grid::unselectRow",BX.proxy(this._onUnselectRows,this));BX.removeCustomEvent(window,"Grid::unselectRows",BX.proxy(this._onUnselectRows,this));BX.removeCustomEvent(window,"Grid::allRowsUnselected",BX.proxy(this._onUnselectRows,this));BX.removeCustomEvent(window,"Grid::headerPinned",BX.proxy(this.bindOnCheckAll,this));this.getPinHeader()&&this.getPinHeader().destroy();this.getFader()&&this.getFader().destroy();this.getResize()&&this.getResize().destroy();this.getColsSortable()&&this.getColsSortable().destroy();this.getRowsSortable()&&this.getRowsSortable().destroy();this.getSettingsWindow()&&this.getSettingsWindow().destroy()},_onFrameResize:function(){BX.onCustomEvent(window,"Grid::resize",[this])},_onGridUpdated:function(){this.initStickedColumns();this.adjustFadePosition(this.getFadeOffset())},getFrameId:function(){return"main-grid-tmp-frame-"+this.getContainerId()},enableActionsPanel:function(){if(this.getParam("SHOW_ACTION_PANEL")){var t=this.getActionsPanel().getPanel();if(BX.type.isDomNode(t)){BX.removeClass(t,this.settings.get("classDisable"))}}},disableActionsPanel:function(){if(this.getParam("SHOW_ACTION_PANEL")){var t=this.getActionsPanel().getPanel();if(BX.type.isDomNode(t)){BX.addClass(t,this.settings.get("classDisable"))}}},getSettingsWindow:function(){return this.gridSettings},_onUnselectRows:function(){var t=this.getActionsPanel();var e;if(t instanceof BX.Grid.ActionPanel){e=t.getForAllCheckbox();if(BX.type.isDomNode(e)){e.checked=null;this.disableForAllCounter()}}},isIE:function(){if(!BX.type.isBoolean(this.ie)){this.ie=BX.hasClass(document.documentElement,"bx-ie")}return this.ie},isTouch:function(){if(!BX.type.isBoolean(this.touch)){this.touch=BX.hasClass(document.documentElement,"bx-touch")}return this.touch},getParam:function(t,e){if(e===undefined){e=null}return this.arParams.hasOwnProperty(t)?this.arParams[t]:e},getCounterTotal:function(){return BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classCounterTotal"),true)},getActionKey:function(){return"action_button_"+this.getId()},getPinHeader:function(){if(this.getParam("ALLOW_PIN_HEADER")){this.pinHeader=this.pinHeader||new BX.Grid.PinHeader(this)}return this.pinHeader},getResize:function(){if(!(this.resize instanceof BX.Grid.Resize)&&this.getParam("ALLOW_COLUMNS_RESIZE")){this.resize=new BX.Grid.Resize(this)}return this.resize},confirmForAll:function(t){var e;var i=this;if(BX.type.isDomNode(t)){e=BX.Grid.Utils.getByTag(t,"input",true)}if(e.checked){this.getActionsPanel().confirmDialog({CONFIRM:true,CONFIRM_MESSAGE:this.arParams.CONFIRM_FOR_ALL_MESSAGE},function(){if(BX.type.isDomNode(e)){e.checked=true}i.selectAllCheckAllCheckboxes();i.getRows().selectAll();i.enableForAllCounter();i.updateCounterDisplayed();i.updateCounterSelected();i.enableActionsPanel();BX.onCustomEvent(window,"Grid::allRowsSelected",[])},function(){if(BX.type.isDomNode(e)){e.checked=null;i.disableForAllCounter();i.updateCounterDisplayed();i.updateCounterSelected()}})}else{this.unselectAllCheckAllCheckboxes();this.getRows().unselectAll();this.disableForAllCounter();this.updateCounterDisplayed();this.updateCounterSelected();this.disableActionsPanel();BX.onCustomEvent(window,"Grid::allRowsUnselected",[])}},editSelected:function(){this.getRows().editSelected()},editSelectedSave:function(){var t={FIELDS:this.getRows().getEditSelectedValues()};if(this.getParam("ALLOW_VALIDATE")){this.tableFade();t[this.getActionKey()]="validate";this.getData().request("","POST",t,"validate",function(e){e=JSON.parse(e);if(e.messages.length){this.arParams["MESSAGES"]=e.messages;this.messages.show();var i=this.getActionsPanel().getButtons().find(function(t){return t.id==="grid_edit_button_control"});this.tableUnfade();BX.fireEvent(i,"click")}else{t[this.getActionKey()]="edit";this.reloadTable("POST",t)}}.bind(this));return}t[this.getActionKey()]="edit";this.reloadTable("POST",t)},getForAllKey:function(){return"action_all_rows_"+this.getId()},updateRow:function(t,e,i,n){var s=this.getRows().getById(t);if(s instanceof BX.Grid.Row){s.update(e,i,n)}},removeRow:function(t,e,i,n){var s=this.getRows().getById(t);if(s instanceof BX.Grid.Row){s.remove(e,i,n)}},addRow:function(t,e,i){var n=this.getUserOptions().getAction("GRID_ADD_ROW");var s={action:n,data:t};var o=this;this.tableFade();this.getData().request(e,"POST",s,null,function(){var e=this.getBodyRows();o.getUpdater().updateBodyRows(e);o.tableUnfade();o.getRows().reset();o.getUpdater().updateFootRows(this.getFootRows());o.getUpdater().updatePagination(this.getPagination());o.getUpdater().updateMoreButton(this.getMoreButton());o.getUpdater().updateCounterTotal(this.getCounterTotal());o.bindOnRowEvents();o.adjustEmptyTable(e);o.bindOnMoreButtonEvents();o.bindOnClickPaginationLinks();o.updateCounterDisplayed();o.updateCounterSelected();if(o.getParam("ALLOW_COLUMNS_SORT")){o.colsSortable.reinit()}if(o.getParam("ALLOW_ROWS_SORT")){o.rowsSortable.reinit()}BX.onCustomEvent(window,"Grid::rowAdded",[{data:t,grid:o,response:this}]);BX.onCustomEvent(window,"Grid::updated",[o]);if(BX.type.isFunction(i)){i({data:t,grid:o,response:this})}})},editSelectedCancel:function(){this.getRows().editSelectedCancel()},removeSelected:function(){var t={ID:this.getRows().getSelectedIds()};var e=this.getActionsPanel().getValues();t[this.getActionKey()]="delete";t[this.getForAllKey()]=this.getForAllKey()in e?e[this.getForAllKey()]:"N";this.reloadTable("POST",t)},sendSelected:function(){var t=this.getActionsPanel().getValues();var e=this.getRows().getSelectedIds();var i={rows:e,controls:t};this.reloadTable("POST",i)},getActionsPanel:function(){return this.actionPanel},getApplyButton:function(){return BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classPanelButton"),true)},getEditor:function(){return this.editor},reload:function(t){this.reloadTable("GET",{},null,t)},getPanels:function(){return BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classPanels"),true)},getEmptyBlock:function(){return BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classEmptyBlock"),true)},adjustEmptyTable:function(t){requestAnimationFrame(function(){function e(t){var e=t.currentTarget;BX.Grid.Utils.requestAnimationFrame(function(){BX.style(a,"transform","translate3d("+BX.scrollLeft(e)+"px, 0px, 0")})}if(!BX.hasClass(document.documentElement,"bx-ie")&&BX.type.isArray(t)&&t.length===1&&BX.hasClass(t[0],this.settings.get("classEmptyRows"))){var i=BX.pos(this.getContainer());var n=BX.scrollTop(window)+BX.height(window);var s=i.bottom-n;var o=BX.height(this.getPanels());var a=this.getEmptyBlock();var r=BX.width(this.getContainer());if(r){BX.width(a,r)}BX.style(a,"transform","translate3d("+BX.scrollLeft(this.getScrollContainer())+"px, 0px, 0");BX.unbind(this.getScrollContainer(),"scroll",e);BX.bind(this.getScrollContainer(),"scroll",e);var l=this.getContainer();var d=0;while(l=l.parentElement){var h=parseFloat(BX.style(l,"padding-top"));var c=parseFloat(BX.style(l,"padding-bottom"));if(!isNaN(h)){d+=h}if(!isNaN(c)){d+=c}}if(s>0){BX.style(this.getTable(),"min-height",i.height-s-o-d+"px")}else{BX.style(this.getTable(),"min-height",i.height+Math.abs(s)-o-d+"px")}}else{BX.style(this.getTable(),"min-height","")}}.bind(this))},reloadTable:function(t,e,i,n){var s;if(!BX.type.isNotEmptyString(t)){t="GET"}if(!BX.type.isPlainObject(e)){e={}}var o=this;this.tableFade();if(!BX.type.isString(n)){n=""}this.getData().request(n,t,e,"",function(){o.getRows().reset();s=this.getBodyRows();o.getUpdater().updateHeadRows(this.getHeadRows());o.getUpdater().updateBodyRows(s);o.getUpdater().updateFootRows(this.getFootRows());o.getUpdater().updatePagination(this.getPagination());o.getUpdater().updateMoreButton(this.getMoreButton());o.getUpdater().updateCounterTotal(this.getCounterTotal());o.adjustEmptyTable(s);o.bindOnRowEvents();o.bindOnMoreButtonEvents();o.bindOnClickPaginationLinks();o.bindOnClickHeader();o.bindOnCheckAll();o.updateCounterDisplayed();o.updateCounterSelected();o.disableActionsPanel();o.disableForAllCounter();if(o.getParam("SHOW_ACTION_PANEL")){o.getUpdater().updateGroupActions(this.getActionPanel())}if(o.getParam("ALLOW_COLUMNS_SORT")){o.colsSortable.reinit()}if(o.getParam("ALLOW_ROWS_SORT")){o.rowsSortable.reinit()}o.tableUnfade();BX.onCustomEvent(window,"Grid::updated",[o]);if(BX.type.isFunction(i)){i()}})},getGroupEditButton:function(){return BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classGroupEditButton"),true)},getGroupDeleteButton:function(){return BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classGroupDeleteButton"),true)},enableGroupActions:function(){var t=this.getGroupEditButton();var e=this.getGroupDeleteButton();if(BX.type.isDomNode(t)){BX.removeClass(t,this.settings.get("classGroupActionsDisabled"))}if(BX.type.isDomNode(e)){BX.removeClass(e,this.settings.get("classGroupActionsDisabled"))}},disableGroupActions:function(){var t=this.getGroupEditButton();var e=this.getGroupDeleteButton();if(BX.type.isDomNode(t)){BX.addClass(t,this.settings.get("classGroupActionsDisabled"))}if(BX.type.isDomNode(e)){BX.addClass(e,this.settings.get("classGroupActionsDisabled"))}},closeActionsMenu:function(){var t=this.getRows().getRows();for(var e=0,i=t.length;e<i;e++){t[e].closeActionsMenu()}},getPageSize:function(){return this.pageSize},getFader:function(){return this.fader},getData:function(){this.data=this.data||new BX.Grid.Data(this);return this.data},getUpdater:function(){this.updater=this.updater||new BX.Grid.Updater(this);return this.updater},isSortableHeader:function(t){return BX.hasClass(t,this.settings.get("classHeaderSortable"))},isNoSortableHeader:function(t){return BX.hasClass(t,this.settings.get("classHeaderNoSortable"))},bindOnClickHeader:function(){var t=this;var e;BX.bind(this.getContainer(),"click",function(i){e=BX.findParent(i.target,{tag:"th"},true,false);if(e&&t.isSortableHeader(e)&&!t.preventSortableClick){t.preventSortableClick=false;t._clickOnSortableHeader(e,i)}})},enableEditMode:function(){this.isEditMode=true},disableEditMode:function(){this.isEditMode=false},isEditMode:function(){return this.isEditMode},getColumnHeaderCellByName:function(t){return BX.Grid.Utils.getBySelector(this.getContainer(),"#"+this.getId()+' th[data-name="'+t+'"]',true)},getColumnByName:function(t){var e=this.getParam("DEFAULT_COLUMNS");return!!t&&t in e?e[t]:null},adjustIndex:function(t){var e=this.getAllRows()[0].querySelectorAll(".main-grid-fixed-column").length;return t+e},getColumnByIndex:function(t){t=this.adjustIndex(t);return this.getAllRows().reduce(function(e,i){if(!i.classList.contains("main-grid-row-custom")&&!i.classList.contains("main-grid-row-empty")){e.push(i.children[t])}return e},[])},getAllRows:function(){var t=[].slice.call(this.getTable().rows);var e=this.getContainer().parentElement.querySelector(".main-grid-fixed-bar table");if(e){t.push(e.rows[0])}return t},initStickedColumns:function(){[].slice.call(this.getAllRows()[0].children).forEach(function(t,e){if(t.classList.contains("main-grid-sticked-column")){this.stickyColumnByIndex(e)}},this);this.getResize().destroy();this.getResize().init(this)},stickyColumnByIndex:function(t){var e=this.getColumnByIndex(t);var i=e[0].clientWidth;var n=e.map(function(t){return BX.height(t)});e.forEach(function(t,e){var s=BX.clone(t);t.style.minWidth=i+"px";t.style.width=i+"px";t.style.minHeight=n[e]+"px";var o=this.getLastStickyCellFromRowByIndex(e);if(o){var a=parseInt(BX.style(o,"left"));var r=parseInt(BX.style(o,"width"));a=isNaN(a)?0:a;r=isNaN(r)?0:r;t.style.left=a+r+"px"}t.classList.add("main-grid-fixed-column");t.classList.add("main-grid-cell-static");s.classList.add("main-grid-cell-static");if(this.getColsSortable()){this.getColsSortable().unregister(t);this.getColsSortable().unregister(s)}BX.insertAfter(s,t)},this);this.adjustFadePosition(this.getFadeOffset())},adjustFixedColumnsPosition:function(){var t=this.getAllRows()[0].querySelectorAll(".main-grid-fixed-column").length;var e=[].slice.call(this.getAllRows()[0].children).reduce(function(t,e,i,n){var s;var o;if(n[i-1]&&n[i-1].classList.contains("main-grid-fixed-column")){s=parseInt(BX.style(n[i-1],"left"));o=parseInt(BX.style(n[i-1],"width"));s=isNaN(s)?0:s;o=isNaN(o)?0:o;t.push({index:i+1,left:s+o})}return t},[]);e.forEach(function(i){var n=this.getColumnByIndex(i.index-t);n.forEach(function(t){if(i.index!==e[e.length-1].index){t.style.left=i.left+"px"}})},this);this.getAllRows().forEach(function(t){var e=BX.height(t);var i=[].slice.call(t.children);i.forEach(function(t){t.style.minHeight=e+"px"})})},getLastStickyCellFromRowByIndex:function(t){return[].slice.call(this.getAllRows()[t].children).reduceRight(function(t,e){if(!t&&e.classList.contains("main-grid-fixed-column")){t=e}return t},null)},getFadeOffset:function(){var t=0;var e=this.getLastStickyCellFromRowByIndex(0);if(e){var i=parseInt(BX.style(e,"left"));var n=e.offsetWidth;i=isNaN(i)?0:i;n=isNaN(n)?0:n;t=i+n}return t},adjustFadePosition:function(t){var e=this.getFader().getEarLeft();var i=this.getFader().getShadowLeft();e.style.left=t+"px";i.style.left=t+"px"},sortByColumn:function(t){var e=null;var i=null;if(!BX.type.isPlainObject(t)){e=this.getColumnHeaderCellByName(t);i=this.getColumnByName(t)}else{i=t;i.sort_url=this.prepareSortUrl(t)}if(i&&(!!e&&!BX.hasClass(e,this.settings.get("classLoad"))||!e)){!!e&&BX.addClass(e,this.settings.get("classLoad"));this.tableFade();var n=this;this.getUserOptions().setSort(i.sort_by,i.sort_order,function(){n.getData().request(i.sort_url,null,null,"sort",function(){n.rows=null;n.getUpdater().updateHeadRows(this.getHeadRows());n.getUpdater().updateBodyRows(this.getBodyRows());n.getUpdater().updatePagination(this.getPagination());n.getUpdater().updateMoreButton(this.getMoreButton());n.bindOnRowEvents();n.bindOnMoreButtonEvents();n.bindOnClickPaginationLinks();n.bindOnClickHeader();n.bindOnCheckAll();n.updateCounterDisplayed();n.updateCounterSelected();n.disableActionsPanel();n.disableForAllCounter();if(n.getParam("SHOW_ACTION_PANEL")){n.getActionsPanel().resetForAllCheckbox()}if(n.getParam("ALLOW_ROWS_SORT")){n.rowsSortable.reinit()}if(n.getParam("ALLOW_COLUMNS_SORT")){n.colsSortable.reinit()}BX.onCustomEvent(window,"BX.Main.grid:sort",[i,n]);BX.onCustomEvent(window,"Grid::updated",[n]);n.tableUnfade()})})}},prepareSortUrl:function(t){var e=window.location.toString();if("sort_by"in t){e=BX.util.add_url_param(e,{by:t.sort_by})}if("sort_order"in t){e=BX.util.add_url_param(e,{order:t.sort_order})}return e},_clickOnSortableHeader:function(t,e){e.preventDefault();this.sortByColumn(BX.data(t,"name"))},getObserver:function(){return BX.Grid.observer},initRowsDragAndDrop:function(){this.rowsSortable=new BX.Grid.RowsSortable(this)},initColsDragAndDrop:function(){this.colsSortable=new BX.Grid.ColsSortable(this)},getRowsSortable:function(){return this.rowsSortable},getColsSortable:function(){return this.colsSortable},getUserOptionsHandlerUrl:function(){return this.userOptionsHandlerUrl||""},getUserOptions:function(){return this.userOptions},getCheckAllCheckboxes:function(){var t=BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classCheckAllCheckboxes"));return t.map(function(t){return new BX.Grid.Element(t)})},selectAllCheckAllCheckboxes:function(){this.getCheckAllCheckboxes().forEach(function(t){t.getNode().checked=true})},unselectAllCheckAllCheckboxes:function(){this.getCheckAllCheckboxes().forEach(function(t){t.getNode().checked=false})},adjustCheckAllCheckboxes:function(){var t=this.getRows().getBodyChild().filter(function(t){return t.isShown()}).length;var e=this.getRows().getSelected().filter(function(t){return t.isShown()}).length;t===e?this.selectAllCheckAllCheckboxes():this.unselectAllCheckAllCheckboxes()},bindOnCheckAll:function(){var t=this;this.getCheckAllCheckboxes().forEach(function(e){e.getObserver().add(e.getNode(),"change",t._clickOnCheckAll,t)})},_clickOnCheckAll:function(t){t.preventDefault();this.toggleSelectionAll()},toggleSelectionAll:function(){if(!this.getRows().isAllSelected()){this.getRows().selectAll();this.selectAllCheckAllCheckboxes();this.enableActionsPanel();BX.onCustomEvent(window,"Grid::allRowsSelected",[this])}else{this.getRows().unselectAll();this.unselectAllCheckAllCheckboxes();this.disableActionsPanel();BX.onCustomEvent(window,"Grid::allRowsUnselected",[this])}this.updateCounterSelected()},bindOnClickPaginationLinks:function(){var t=this;this.getPagination().getLinks().forEach(function(e){e.getObserver().add(e.getNode(),"click",t._clickOnPaginationLink,t)})},bindOnMoreButtonEvents:function(){var t=this;this.getMoreButton().getObserver().add(this.getMoreButton().getNode(),"click",t._clickOnMoreButton,t)},bindOnRowEvents:function(){var t=this.getObserver();var e=this.getParam("SHOW_ROW_CHECKBOXES");var i=this.getParam("ENABLE_COLLAPSIBLE_ROWS");this.getRows().getBodyChild().forEach(function(n){e&&t.add(n.getNode(),"click",this._onClickOnRow,this);n.getDefaultAction()&&t.add(n.getNode(),"dblclick",this._onRowDblclick,this);n.getActionsButton()&&t.add(n.getActionsButton(),"click",this._clickOnRowActionsButton,this);i&&n.getCollapseButton()&&t.add(n.getCollapseButton(),"click",this._onCollapseButtonClick,this)},this)},_onCollapseButtonClick:function(t){t.preventDefault();t.stopPropagation();var e=this.getRows().get(t.currentTarget);e.toggleChildRows();if(e.isCustom()){this.getUserOptions().setCollapsedGroups(this.getRows().getIdsCollapsedGroups())}else{this.getUserOptions().setExpandedRows(this.getRows().getIdsExpandedRows())}BX.fireEvent(document.body,"click")},_clickOnRowActionsButton:function(t){var e=this.getRows().get(t.target);t.preventDefault();if(!e.actionsMenuIsShown()){e.showActionsMenu()}else{e.closeActionsMenu()}},_onRowDblclick:function(event){event.preventDefault();var row=this.getRows().get(event.target);var defaultJs="";if(!row.isEdit()){clearTimeout(this.clickTimer);this.clickPrevent=true;try{defaultJs=row.getDefaultAction();eval(defaultJs)}catch(t){console.warn(t)}}},_onClickOnRow:function(t){var e=50;var i=window.getSelection();if(t.target.nodeName==="LABEL"){t.preventDefault()}if(t.shiftKey||i.toString().length===0){i.removeAllRanges();this.clickTimer=setTimeout(BX.delegate(function(){if(!this.clickPrevent){n.apply(this,[t])}this.clickPrevent=false},this),e)}function n(t){var e,i,n,s,o,a;var r=true;if(t.target.nodeName!=="A"&&t.target.nodeName!=="INPUT"){i=this.getRows().get(t.target);a=i.getContentContainer(t.target);if(BX.type.isDomNode(a)&&t.target.nodeName!=="TD"&&t.target!==a){r=BX.data(a,"prevent-default")==="true"}if(r){if(i.getCheckbox()){e=[];this.currentIndex=0;this.getRows().getRows().forEach(function(t,e){if(t===i){this.currentIndex=e}},this);this.lastIndex=this.lastIndex||this.currentIndex;if(!t.shiftKey){if(!i.isSelected()){i.select();BX.onCustomEvent(window,"Grid::selectRow",[i,this])}else{i.unselect();BX.onCustomEvent(window,"Grid::unselectRow",[i,this])}}else{s=Math.min(this.currentIndex,this.lastIndex);o=Math.max(this.currentIndex,this.lastIndex);while(s<=o){e.push(this.getRows().getRows()[s]);s++}n=e.some(function(t){return!t.isSelected()});if(n){e.forEach(function(t){t.select()});BX.onCustomEvent(window,"Grid::selectRows",[e,this])}else{e.forEach(function(t){t.unselect()});BX.onCustomEvent(window,"Grid::unselectRows",[e,this])}}this.updateCounterSelected();this.lastIndex=this.currentIndex}this.adjustRows();this.adjustCheckAllCheckboxes()}}}},adjustRows:function(){if(this.getRows().isSelected()){BX.onCustomEvent(window,"Grid::thereSelectedRows",[]);this.enableActionsPanel()}else{BX.onCustomEvent(window,"Grid::noSelectedRows",[]);this.disableActionsPanel()}},getPagination:function(){return new BX.Grid.Pagination(this)},getState:function(){return window.history.state},tableFade:function(){BX.addClass(this.getTable(),this.settings.get("classTableFade"));this.getLoader().show();BX.onCustomEvent("Grid::disabled",[this])},tableUnfade:function(){BX.removeClass(this.getTable(),this.settings.get("classTableFade"));this.getLoader().hide();BX.onCustomEvent("Grid::enabled",[this])},_clickOnPaginationLink:function(t){t.preventDefault();var e=this;var i=this.getPagination().getLink(t.target);if(!i.isLoad()){this.getUserOptions().resetExpandedRows();i.load();this.tableFade();this.getData().request(i.getLink(),null,null,"pagination",function(){e.rows=null;e.getUpdater().updateBodyRows(this.getBodyRows());e.getUpdater().updateHeadRows(this.getHeadRows());e.getUpdater().updateMoreButton(this.getMoreButton());e.getUpdater().updatePagination(this.getPagination());e.bindOnRowEvents();e.bindOnMoreButtonEvents();e.bindOnClickPaginationLinks();e.bindOnClickHeader();e.bindOnCheckAll();e.updateCounterDisplayed();e.updateCounterSelected();e.disableActionsPanel();e.disableForAllCounter();if(e.getParam("SHOW_ACTION_PANEL")){e.getActionsPanel().resetForAllCheckbox()}if(e.getParam("ALLOW_ROWS_SORT")){e.rowsSortable.reinit()}if(e.getParam("ALLOW_COLUMNS_SORT")){e.colsSortable.reinit()}i.unload();e.tableUnfade();BX.onCustomEvent(window,"Grid::updated",[e])})}},_clickOnMoreButton:function(t){t.preventDefault();var e=this;var i=this.getMoreButton();i.load();this.getData().request(i.getLink(),null,null,"more",function(){e.getUpdater().appendBodyRows(this.getBodyRows());e.getUpdater().updateMoreButton(this.getMoreButton());e.getUpdater().updatePagination(this.getPagination());e.getRows().reset();e.bindOnRowEvents();e.bindOnMoreButtonEvents();e.bindOnClickPaginationLinks();e.bindOnClickHeader();e.bindOnCheckAll();e.updateCounterDisplayed();e.updateCounterSelected();if(e.getParam("ALLOW_ROWS_SORT")){e.rowsSortable.reinit()}if(e.getParam("ALLOW_COLUMNS_SORT")){e.colsSortable.reinit()}e.unselectAllCheckAllCheckboxes()})},getAjaxId:function(){return BX.data(this.getContainer(),this.settings.get("ajaxIdDataProp"))},update:function(t,e){var i,n,s,o,a,r;if(!BX.type.isNotEmptyString(t)){return}o=BX.Grid.Utils.getByTag(this.getTable(),"tbody",true);a=BX.Grid.Utils.getByTag(this.getTable(),"thead",true);r=BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classNavPanel"),true);t=BX.create("div",{html:t});n=BX.Grid.Utils.getByClass(t,this.settings.get("classHeadRow"));i=BX.Grid.Utils.getByClass(t,this.settings.get("classDataRows"));s=BX.Grid.Utils.getByClass(t,this.settings.get("classNavPanel"),true);if(e===this.settings.get("updateActionMore")){this.getRows().addRows(i);this.unselectAllCheckAllCheckboxes()}if(e===this.settings.get("updateActionPagination")){BX.cleanNode(o);this.getRows().addRows(i);this.unselectAllCheckAllCheckboxes()}if(e===this.settings.get("updateActionSort")){BX.cleanNode(a);BX.cleanNode(o);a.appendChild(n[0]);this.getRows().addRows(i)}r.innerHTML=s.innerHTML;this.bindOnRowEvents();this.bindOnMoreButtonEvents();this.bindOnClickPaginationLinks();this.bindOnClickHeader();this.bindOnCheckAll();this.updateCounterDisplayed();this.updateCounterSelected();this.sortable.reinit()},getCounterDisplayed:function(){return BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classCounterDisplayed"))},getCounterSelected:function(){return BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classCounterSelected"))},updateCounterDisplayed:function(){var t=this.getCounterDisplayed();var e;if(BX.type.isArray(t)){e=this.getRows();t.forEach(function(t){if(BX.type.isDomNode(t)){t.innerText=e.getCountDisplayed()}},this)}},updateCounterSelected:function(){var t=this.getCounterSelected();var e;if(BX.type.isArray(t)){e=this.getRows();t.forEach(function(t){if(BX.type.isDomNode(t)){t.innerText=e.getCountSelected()}},this)}},getContainerId:function(){return this.containerId},getId:function(){return this.containerId},getContainer:function(){return BX(this.getContainerId())},getCounter:function(){if(!this.counter){this.counter=BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classCounter"))}return this.counter},enableForAllCounter:function(){var t=this.getCounter();if(BX.type.isArray(t)){t.forEach(function(t){BX.addClass(t,this.settings.get("classForAllCounterEnabled"))},this)}},disableForAllCounter:function(){var t=this.getCounter();if(BX.type.isArray(t)){t.forEach(function(t){BX.removeClass(t,this.settings.get("classForAllCounterEnabled"))},this)}},getScrollContainer:function(){if(!this.scrollContainer){this.scrollContainer=BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classScrollContainer"),true)}return this.scrollContainer},getWrapper:function(){if(!this.wrapper){this.wrapper=BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classWrapper"),true)}return this.wrapper},getFadeContainer:function(){if(!this.fadeContainer){this.fadeContainer=BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classFadeContainer"),true)}return this.fadeContainer},getTable:function(){return BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classTable"),true)},getHeaders:function(){return BX.Grid.Utils.getBySelector(this.getWrapper(),'.main-grid-header[data-relative="'+this.getContainerId()+'"]')},getHead:function(){return BX.Grid.Utils.getByTag(this.getContainer(),"thead",true)},getBody:function(){return BX.Grid.Utils.getByTag(this.getContainer(),"tbody",true)},getFoot:function(){return BX.Grid.Utils.getByTag(this.getContainer(),"tfoot",true)},getRows:function(){if(!(this.rows instanceof BX.Grid.Rows)){this.rows=new BX.Grid.Rows(this)}return this.rows},getMoreButton:function(){var t=BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classMoreButton"),true);return new BX.Grid.Element(t,this)},getLoader:function(){if(!(this.loader instanceof BX.Grid.Loader)){this.loader=new BX.Grid.Loader(this)}return this.loader},blockSorting:function(){var t=BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classHeadCell"));t.forEach(function(t){if(this.isSortableHeader(t)){BX.removeClass(t,this.settings.get("classHeaderSortable"));BX.addClass(t,this.settings.get("classHeaderNoSortable"))}},this)},unblockSorting:function(){var t=BX.Grid.Utils.getByClass(this.getContainer(),this.settings.get("classHeadCell"));t.forEach(function(t){if(this.isNoSortableHeader(t)&&t.dataset.sortBy){BX.addClass(t,this.settings.get("classHeaderSortable"));BX.removeClass(t,this.settings.get("classHeaderNoSortable"))}},this)},confirmDialog:function(t,e,i){var n,s,o,a;if("CONFIRM"in t&&t.CONFIRM){t.CONFIRM_MESSAGE=t.CONFIRM_MESSAGE||this.arParams.CONFIRM_MESSAGE;t.CONFIRM_APPLY_BUTTON=t.CONFIRM_APPLY_BUTTON||this.arParams.CONFIRM_APPLY;t.CONFIRM_CANCEL_BUTTON=t.CONFIRM_CANCEL_BUTTON||this.arParams.CONFIRM_CANCEL;n=new BX.PopupWindow(this.getContainerId()+"-confirm-dialog",null,{content:'<div class="main-grid-confirm-content">'+t.CONFIRM_MESSAGE+"</div>",titleBar:"CONFIRM_TITLE"in t?t.CONFIRM_TITLE:"",autoHide:false,zIndex:9999,overlay:.4,offsetTop:-100,closeIcon:true,closeByEsc:true,events:{onClose:function(){BX.unbind(window,"keydown",r)}},buttons:[new BX.PopupWindowButton({text:t.CONFIRM_APPLY_BUTTON,id:this.getContainerId()+"-confirm-dialog-apply-button",events:{click:function(){BX.type.isFunction(e)?e():null;this.popupWindow.close();this.popupWindow.destroy();BX.onCustomEvent(window,"Grid::confirmDialogApply",[this]);BX.unbind(window,"keydown",r)}}}),new BX.PopupWindowButtonLink({text:t.CONFIRM_CANCEL_BUTTON,id:this.getContainerId()+"-confirm-dialog-cancel-button",events:{click:function(){BX.type.isFunction(i)?i():null;this.popupWindow.close();this.popupWindow.destroy();BX.onCustomEvent(window,"Grid::confirmDialogCancel",[this]);BX.unbind(window,"keydown",r)}}})]});if(!n.isShown()){n.show();s=n.popupContainer;BX.removeClass(s,this.settings.get("classCloseAnimation"));BX.addClass(s,this.settings.get("classShowAnimation"));o=BX(this.getContainerId()+"-confirm-dialog-apply-button");a=BX(this.getContainerId()+"-confirm-dialog-cancel-button");BX.bind(window,"keydown",r)}}else{BX.type.isFunction(e)?e():null}function r(t){if(t.code==="Enter"){t.preventDefault();t.stopPropagation();BX.fireEvent(o,"click")}if(t.code==="Escape"){t.preventDefault();t.stopPropagation();BX.fireEvent(a,"click")}}}}})();
//# sourceMappingURL=script.map.js

Zerion Mini Shell 1.0