/*!@license * Infragistics.Web.ClientUI Grid Multi Headers 19.1.20 * * Copyright (c) 2011-2019 Infragistics Inc. * * http://www.infragistics.com/ * * Depends on: * jquery-1.9.1.js * jquery.ui.core.js * jquery.ui.widget.js * infragistics.ui.grid.framework.js * infragistics.ui.shared.js * infragistics.dataSource.js * infragistics.util.js */ (function(factory){if(typeof define==="function"&&define.amd){define(["./infragistics.ui.grid.framework"],factory)}else{return factory(jQuery)}})(function($){$.widget("ui.igGridMultiColumnHeaders",$.ui.igWidget,{localeWidgetName:"igGridMultiColumnHeaders",css:{multiHeaderCell:"ui-iggrid-multiheader-cell",expandedHeaderIndicator:"ui-iggrid-multiheader-expanded",collapsedHeaderIndicator:"ui-iggrid-multiheader-collapsed",collapsibleIndicatorContainer:"ui-iggrid-indicatorcontainer ui-iggrid-collapsibleindicatorcontainer"},options:{inherit:false},events:{groupCollapsing:"groupCollapsing",groupCollapsed:"groupCollapsed",groupExpanding:"groupExpanding",groupExpanded:"groupExpanded"},_createWidget:function(){$.Widget.prototype._createWidget.apply(this,arguments)},changeLocale:function(){var self=this;this.grid.container().find("[data-expanded-state]").each(function(){self._changeLocaleForElement($(this))})},_registerWidget:$.noop,_unregisterWidget:$.noop,_renderingMultiColumnHeader:function(){this._renderHeaderColumns(this.grid._headerParent);this.grid._trigger(this.grid.events.headerRendered,null,{owner:this.grid,table:this.grid.headersTable()});this.grid._headerRenderCancel=false},_analyzeRowspanRows:function(oldCols,level){var i,col,groups=[],ml=this.grid._maxLevel-level,rowspan;for(i=0;i0){rowspan=col.rowspan}if(col.group!==undefined&&col.group!==null){groups.push({group:col.group,level:level+rowspan})}else{if(col.level===0){if(col.rowspan===null||col.rowspan===undefined||isNaN(col.rowspan)){if(ml+1-col.level>0){col.rowspan=ml+1-col.level}}}}if(this._rows[ml]===undefined||this._rows[ml]===null){this._rows[ml]=[]}this._rows[ml].push(col)}for(i=0;i').appendTo(headerContainer);for(i=0;i0){$container=$thead.empty().attr("role","rowgroup")}else{$container=$('').appendTo($container)}this._tr={};oldCols=this.grid._oldCols;this._rows={};this._analyzeRowspanRows(oldCols,0);for(i=this.grid._maxLevel;i>=0;i--){if(this._rows[i]!==null&&this._rows[i]!==undefined){this._renderRow($container,this._rows[i],i)}}for(i=0;icolgroup>col").eq(this.grid.getVisibleIndexByKey(key,true));$col.remove();parents=this.grid._getParentsMultiHeader(key);for(j=0;j0){mchElement=this.grid._getMultiHeaderColumnById(parentCol.identifier);if(mchElement&&mchElement.children){mchChildren=mchElement.children;isToHide=true;if(mchElement.hidden!==true){for(k=0;k"),$headerCell,childIds="",i,length;if(col.group){length=col.group.length;for(i=0;i'+col.headerText+"").attr({role:"columnheader","aria-label":col.headerText,tabIndex:grid.options.tabIndex}).addClass(headerClass).addClass(customClass);if(col.colspan>1){$th.attr("colspan",col.colspan)}if(col.rowspan>1){$headerCell.attr("rowspan",col.rowspan)}if(col.key){$headerCell.attr("id",this.grid.element[0].id+"_"+col.key)}if(col.level===0){id=col.key;isMultiColumnHeader=false;$headerCell.attr("data-isheadercell",true)}else{id=col.identifier;$headerCell.addClass(this.css.multiHeaderCell);$headerCell.attr("data-mch-id",col.identifier);if(childIds){$headerCell.attr("aria-owns",childIds)}}grid._trigger(grid.events.headerCellRendered,null,{owner:grid,th:$headerCell,columnKey:id,isMultiColumnHeader:isMultiColumnHeader});return $headerCell},_renderCollapsibleHeaderIndicator:function($th,col){var $container,$anchor,$button,self=this,shouldExpand=false,title;if(col&&col.groupOptions&&col.groupOptions.allowGroupCollapsing===true){shouldExpand=col.groupOptions.expanded===true;$container=$("
").addClass(self.css.collapsibleIndicatorContainer);title=shouldExpand?this._getLocaleValue("expandedColumnIconTooltip"):this._getLocaleValue("collapsedColumnIconTooltip");$anchor=$("").attr("href","#").attr({title:title,"data-expanded-state":shouldExpand,"data-localeid":shouldExpand?"expandedColumnIconTooltip":"collapsedColumnIconTooltip","data-localeattr":"title"}).attr("tabindex",0).on({keydown:function(event){if(event.keyCode===$.ui.keyCode.ENTER||event.keyCode===$.ui.keyCode.SPACE){self._headerIndicatorClick(event)}}}).appendTo($container);$button=$("").addClass(shouldExpand?this.css.expandedHeaderIndicator:this.css.collapsedHeaderIndicator).on({click:this._headerIndicatorClickHandler}).appendTo($anchor);$container.appendTo($th)}},expandGroup:function(groupKey,callback){this._setExpanded(groupKey,true,null,false,callback)},collapseGroup:function(groupKey,callback){this._setExpanded(groupKey,false,null,false,callback)},toggleGroup:function(groupKey,callback){this._setExpanded(groupKey,null,null,false,callback)},_setToggleButtonTooltip:function($button,expanded){var localeId=expanded?"expandedColumnIconTooltip":"collapsedColumnIconTooltip";$button.attr({title:this._getLocaleValue(localeId),"data-localeid":localeId,"data-expanded-state":expanded})},_setExpanded:function(groupKey,expanded,event,throwEvents,callback){var self=this,i,column,isExpanded,th,headerRows=self.grid.headersTable().find("thead > tr"),groupColumnsLength,noCancel,totalMchWidth=0,isFixedHeader=false,cw=this.grid.container().width(),fixing=this.grid.element.data("igGridColumnFixing");column=self.grid._getMultiHeaderColumnById(groupKey);if(!column||!column.groupOptions||column.groupOptions.allowGroupCollapsing===false||!column.group){return}isExpanded=column.groupOptions.expanded===true;if(isExpanded===expanded){return}if(this.grid.hasFixedColumns()){isFixedHeader=this.grid.fixedTable().find("th[data-mch-id='"+groupKey+"']").length?true:false;for(i=0;icw-fixing.options.minimalVisibleAreaWidth){throw new Error(this._getLocaleValue("cannotExpandMultiColumnHeader"))}}}if(expanded!==true&&expanded!==false){expanded=!isExpanded}th=headerRows.find("th[data-mch-id="+groupKey+"]");if(throwEvents===true){noCancel=self._trigger(expanded?self.events.groupExpanding:self.events.groupCollapsing,event,{owner:self,column:column,element:th});if(noCancel===false){return}}groupColumnsLength=column.group.length;self.grid._loadingIndicator.show();setTimeout(function(){column.groupOptions.expanded=!column.groupOptions.expanded;for(i=0;i0){collapsibleHeaderIcons.find("> a").off("keydown").find("> span").off("click");collapsibleHeaderIcons.remove()}this._superApply(arguments);return this}});$.extend($.ui.igGridMultiColumnHeaders,{version:"19.1.20"});return $});