text: function(e,t,r){"use strict";var a,i=I(e("../../events/core/events_engine")),l,n=I(e("./ui.grid_core.modules")),o,u=I(e("../shared/filtering")),s,d=I(e("./ui.grid_core.utils")),c=e("./ui.grid_core.header_filter_core"),h,p=I(e("../../localization/message")),m,f=I(e("../../events/click")),F=e("../../core/utils/data"),g=e("../../core/utils/iterator"),v=e("../../core/utils/type"),_=e("../../core/utils/position"),C=e("../../core/utils/extend"),y=e("../../data/data_source/data_source"),w,x=I(e("../../localization/date")),S=e("../../core/utils/variable_wrapper"),V=e("../../core/utils/deferred");function I(e){return e&&e.__esModule?e:{default:e}}var b={month:function(e){return x.default.getMonthNames()[e-1]},quarter:function(e){return x.default.format(new Date(2e3,3*e-1),"quarter")}},H=n.default.ViewController.inherit((T=function(e,t,r){var a=u.default.getGroupInterval(t),i=d.default.getFormatOptionsByColumn(t,"headerFilter");return a&&(i.groupInterval=a[r],d.default.isDateType(t.dataType)?i.format=b[a[r]]:"number"===t.dataType&&(i.getDisplayFormat=function(){var i={format:t.format,target:"headerFilter"},l=d.default.formatValue(e,i),n=e+a[r],o=d.default.formatValue(n,i);return l&&o?l+" - "+o:""})),i},{init:function(){this._columnsController=this.getController("columns"),this._dataController=this.getController("data"),this._headerFilterView=this.getView("headerFilterView")},_updateSelectedState:function(e,t){for(var r=e.length,a="exclude"===t.filterType;r--;){var i=e[r];"items"in e[r]&&this._updateSelectedState(e[r].items,t),(0,c.updateHeaderFilterItemSelectionState)(i,d.default.getIndexByKey(e[r].value,t.filterValues,null)>-1,a)}},_normalizeGroupItem:function(e,t,r){var a,i,l=r.path,n=r.valueSelector,o=r.displaySelector,u=r.column;return n&&o?(a=n(e),i=o(e)):i=a=e.key,(0,v.isObject)(e)?e===a&&(e=(0,C.extend)({},e)):e={},l.push(a),1===l.length?e.value=l[0]:e.value=l.join("/"),e.text=this.getHeaderItemText(i,u,t,r.headerFilterOptions),delete e.key,e},getHeaderItemText:function(e,t,r,a){var i=d.default.formatValue(e,T(e,t,r));return i||(i=a.texts.emptyValue),i},_processGroupItems:function(e,t,r,a){var i,l,n=this,o,u=a.column.lookup,s=a.level;r=r||[],t=t||0,u&&(i=(0,F.compileGetter)(u.displayExpr),l=(0,F.compileGetter)(u.valueExpr));for(var d=0;d<e.length;d++)e[d]=this._normalizeGroupItem(e[d],t,{column:a.column,headerFilterOptions:a.headerFilterOptions,displaySelector:i,valueSelector:l,path:r}),"items"in e[d]&&(t!==s&&(0,v.isDefined)(e[d].value)?this._processGroupItems(e[d].items,t+1,r,a):delete e[d].items),r.pop()},getDataSource:function(e){var t,r,a,i=this,l=i._dataController.dataSource(),n=d.default.getHeaderFilterGroupParameters(e,l&&l.remoteOperations().grouping),o=e.headerFilter&&e.headerFilter.dataSource,u=i.option("headerFilter"),s=!1,c={component:i.component};if(l)return(0,v.isDefined)(o)&&!(0,v.isFunction)(o)?c.dataSource=(0,y.normalizeDataSourceOptions)(o):e.lookup?(s=!0,l=e.lookup.dataSource,(0,v.isFunction)(l)&&!(0,S.isWrapped)(l)&&(l=l({})),l=(0,y.normalizeDataSourceOptions)(l),c.dataSource=l):(r=Array.isArray(n)?n.length-1:0,i._currentColumn=e,t=i._dataController.getCombinedFilter(),i._currentColumn=null,c.dataSource={filter:t,group:n,useDefaultSearch:!0,load:function(t){var a=new V.Deferred;return t.dataField=e.dataField||e.name,l.load(t).done(function(t){i._processGroupItems(t,null,null,{level:r,column:e,headerFilterOptions:u}),a.resolve(t)}).fail(a.reject),a}}),(0,v.isFunction)(o)&&o.call(e,c),a=c.dataSource.postProcess,c.dataSource.postProcess=function(t){var r=t;return s&&(0!==this.pageIndex()||this.searchValue()||(r=r.slice(0)).unshift(null),i._processGroupItems(r,null,null,{level:0,column:e,headerFilterOptions:u})),r=a&&a.call(this,r)||r,i._updateSelectedState(r,e),r},c.dataSource},getCurrentColumn:function(){return this._currentColumn},showHeaderFilterMenu:function(e,t){var r=this._columnsController,a=(0,C.extend)(!0,{},this._columnsController.getColumns()[e]);if(a){var i=r.getVisibleIndex(e),l=t?this.getView("headerPanel"):this.getView("columnHeadersView"),n=n||l.getColumnElements().eq(t?a.groupIndex:i);this.showHeaderFilterMenuBase({columnElement:n,column:a,applyFilter:!0,apply:function(){r.columnOption(e,{filterValues:this.filterValues,filterType:this.filterType})}})}},showHeaderFilterMenuBase:function(e){var t=this,r=e.column;if(r){var a=u.default.getGroupInterval(r);(0,C.extend)(e,r,{type:a&&a.length>1?"tree":"list",onShowing:function(r){var a=r.component.overlayContent().dxResizable("instance");a&&a.option("onResizeEnd",function(r){var a=t.getController("columns"),i=a.columnOption(e.dataField,"headerFilter");(i=i||{}).width=r.width,i.height=r.height,a.columnOption(e.dataField,"headerFilter",i,!0)})}}),e.dataSource=t.getDataSource(e),e.isFilterBuilder&&(e.dataSource.filter=null,e.alignment="right"),t._headerFilterView.showHeaderFilterMenu(e.columnElement,e)}},hideHeaderFilterMenu:function(){this._headerFilterView.hideHeaderFilterMenu()}})),T,D=(0,C.extend)({},c.headerFilterMixin,{_renderCellContent:function(e,t){var r,a=this,i=t.column;!i.command&&(0,c.allowHeaderFiltering)(i)&&this.option("headerFilter.visible")&&"header"===t.rowType&&(r=this._applyColumnState({name:"headerFilter",rootElement:e,column:i,showColumnLines:this.option("showColumnLines")}))&&this._subscribeToIndicatorEvent(r,i,"headerFilter"),this.callBase(e,t)},_subscribeToIndicatorEvent:function(e,t,r){var a=this;"headerFilter"===r&&i.default.on(e,f.default.name,a.createAction(function(e){var r;e.event.stopPropagation(),a.getController("headerFilter").showHeaderFilterMenu(t.index,!1)}))},_updateIndicator:function(e,t,r){var a=this.callBase(e,t,r);a&&this._subscribeToIndicatorEvent(a,t,r)},_updateHeaderFilterIndicators:function(){this.option("headerFilter.visible")&&this._updateIndicators("headerFilter")},_needUpdateFilterIndicators:function(){return!0},_columnOptionChanged:function(e){var t=e.optionNames;d.default.checkChanges(t,["filterValues","filterType"])?this._needUpdateFilterIndicators()&&this._updateHeaderFilterIndicators():this.callBase(e)}}),E=(0,C.extend)({},c.headerFilterMixin,{_createGroupPanelItem:function(e,t){var r,a=this,l=a.callBase.apply(a,arguments);return!t.command&&(0,c.allowHeaderFiltering)(t)&&a.option("headerFilter.visible")&&(r=a._applyColumnState({name:"headerFilter",rootElement:l,column:{alignment:(0,_.getDefaultAlignment)(a.option("rtlEnabled")),filterValues:t.filterValues,allowHeaderFiltering:!0},showColumnLines:!0}))&&i.default.on(r,f.default.name,a.createAction(function(e){var r;e.event.stopPropagation(),a.getController("headerFilter").showHeaderFilterMenu(t.index,!0)})),l}});function O(e){return["!",e]}var G={skipCalculateColumnFilters:function(){return!1},_calculateAdditionalFilter:function(){if(this.skipCalculateColumnFilters())return this.callBase();var e=this,t=[this.callBase()],r=this._columnsController.getVisibleColumns(),a,i=this.getController("headerFilter").getCurrentColumn();return(0,g.each)(r,function(e,r){var a;if((!i||i.index!==r.index)&&(0,c.allowHeaderFiltering)(r)&&r.calculateFilterExpression&&Array.isArray(r.filterValues)&&r.filterValues.length){var l=[];(0,g.each)(r.filterValues,function(e,t){Array.isArray(t)?a=t:(r.deserializeValue&&!d.default.isDateType(r.dataType)&&"number"!==r.dataType&&(t=r.deserializeValue(t)),a=r.createFilterExpression(t,"=","headerFilter")),a&&(a.columnIndex=r.index),l.push(a)}),l=d.default.combineFilters(l,"or"),t.push("exclude"===r.filterType?["!",l]:l)}}),d.default.combineFilters(t)}};r.exports={invertFilterExpression:O,defaultOptions:function(){return{headerFilter:{visible:!1,width:252,height:325,allowSearch:!1,searchTimeout:500,texts:{emptyValue:p.default.format("dxDataGrid-headerFilterEmptyValue"),ok:p.default.format("dxDataGrid-headerFilterOK"),cancel:p.default.format("dxDataGrid-headerFilterCancel")}}}},controllers:{headerFilter:H},views:{headerFilterView:c.HeaderFilterView},extenders:{controllers:{data:G},views:{columnHeadersView:D,headerPanel:E}}}}
  
  