text: ﻿/*
      *
      * Wijmo Library 5.20153.117
      * http://wijmo.c1.grapecity.com/
      *
      * Copyright(c) GrapeCity, Inc.  All rights reserved.
      *
      * Licensed under the Wijmo Commercial License.
      * 
      * http://wijmo.c1.grapecity.com/license/
      *
      */
  var __extends,wijmo;(function(n){(function(n){(function(){'use strict'})(n.filter||(n.filter={}));var t=n.filter})(n.grid||(n.grid={}));var t=n.grid})(wijmo||(wijmo={})),function(n){(function(t){(function(t){'use strict';var i=function(){function t(t){this._maxValues=250;this._col=t;this._bnd=t.binding?new n.Binding(t.binding):null}return Object.defineProperty(t.prototype,"showValues",{get:function(){return this._values},set:function(n){this._values=n},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"filterText",{get:function(){return this._filterText},set:function(t){this._filterText=n.asString(t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"maxValues",{get:function(){return this._maxValues},set:function(t){this._maxValues=n.asNumber(t,!1,!0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"uniqueValues",{get:function(){return this._uniqueValues},set:function(t){this._uniqueValues=n.asArray(t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"column",{get:function(){return this._col},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isActive",{get:function(){return this._values!=null&&Object.keys(this._values).length>0},enumerable:!0,configurable:!0}),t.prototype.apply=function(t){var i=this.column;return!this._bnd||!this._values||!Object.keys(this._values).length?!0:(t=this._bnd.getValue(t),t=i.dataMap?i.dataMap.getDisplayValue(t):n.Globalize.format(t,i.format),this._values[t]!=undefined)},t.prototype.clear=function(){this.showValues=null;this.filterText=null},t.prototype.implementsInterface=function(n){return n=='IColumnFilter'},t}();t.ValueFilter=i})(t.filter||(t.filter={}));var i=t.filter})(n.grid||(n.grid={}));var t=n.grid}(wijmo||(wijmo={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){(function(t){(function(t){'use strict';var i=function(i){function r(r,u){var f,e;i.call(this,r);this._filter=n.asType(u,t.ValueFilter,!1);f=this.getTemplate();this.applyTemplate('wj-control',f,{_divFilter:'div-filter',_cbSelectAll:'cb-select-all',_spSelectAll:'sp-select-all',_divValues:'div-values'});this._spSelectAll.textContent=n.culture.FlexGridFilter.selectAll;e=u.column.dataMap?'text':'value';this._view=new n.collections.CollectionView;this._view.sortDescriptions.push(new n.collections.SortDescription(e,!0));this._view.filter=this._filterValues.bind(this);this._view.collectionChanged.addHandler(this._updateSelectAllCheck,this);this._filterText='';this._cmbFilter=new n.input.ComboBox(this._divFilter,{placeholder:n.culture.FlexGridFilter.search});this._lbValues=new n.input.ListBox(this._divValues,{displayMemberPath:'text',checkedMemberPath:'show',itemsSource:this._view,itemFormatter:function(t,i){return i?i:n.culture.FlexGridFilter.null}});this._cmbFilter.textChanged.addHandler(this._filterTextChanged,this);this._cbSelectAll.addEventListener('click',this._cbSelectAllClicked.bind(this));this.updateEditor()}return __extends(r,i),Object.defineProperty(r.prototype,"filter",{get:function(){return this._filter},enumerable:!0,configurable:!0}),r.prototype.updateEditor=function(){var r=this._filter.column,i=[],o,s,h,u,f,e,c,t;if(this._filter.uniqueValues)for(o=this._filter.uniqueValues,t=0;t<o.length;t++)u=o[t],i.push({value:u,text:u.toString()});else for(s={},h=r.collectionView?r.collectionView.sourceCollection:[],t=0;t<h.length;t++)u=r._binding.getValue(h[t]),f=r.dataMap?r.dataMap.getDisplayValue(u):n.Globalize.format(u,r.format),s[f]||(s[f]=!0,i.push({value:u,text:f}));if(e=this._filter.showValues,e&&Object.keys(e).length!=0){for(c in e)for(t=0;t<i.length;t++)if(i[t].text==c){i[t].show=!0;break}}else for(t=0;t<i.length;t++)i[t].show=!0;this._lbValues.isContentHtml=r.isContentHtml;this._cmbFilter.text=this._filter.filterText;this._filterText=this._cmbFilter.text.toLowerCase();this._view.pageSize=this._filter.maxValues;this._view.sourceCollection=i;this._view.moveCurrentToPosition(-1)},r.prototype.clearEditor=function(){var t,n;for(this._cmbFilter.text='',this._filterText='',this._view.refresh(),t=this._view.items,n=0;n<t.length;n++)t[n].show=!1},r.prototype.updateFilter=function(){for(var t,i={},r=this._view.items,n=0;n<r.length;n++)t=r[n],t.show&&(i[t.text]=!0);this._filter.showValues=i;this._filter.filterText=this._filterText},r.prototype._filterTextChanged=function(){var n=this;this._toText&&clearTimeout(this._toText);this._toText=setTimeout(function(){var t=n._cmbFilter.text.toLowerCase();t!=n._filterText&&(n._filterText=t,n._view.refresh(),n._cbSelectAll.checked=!0,n._cbSelectAllClicked())},500)},r.prototype._filterValues=function(n){return this._filterText?n&&n.text?n.text.toLowerCase().indexOf(this._filterText)>-1:!1:!0},r.prototype._cbSelectAllClicked=function(){for(var i=this._cbSelectAll.checked,t=this._view.items,n=0;n<t.length;n++)t[n].show=i;this._view.refresh()},r.prototype._updateSelectAllCheck=function(){for(var n=0,t=this._view.items,i=0;i<t.length;i++)t[i].show&&n++;n==0?(this._cbSelectAll.checked=!1,this._cbSelectAll.indeterminate=!1):n==t.length?(this._cbSelectAll.checked=!0,this._cbSelectAll.indeterminate=!1):this._cbSelectAll.indeterminate=!0},r.controlTemplate='<div><div wj-part="div-filter"><\/div><br/><label style="margin-left:11px"><input wj-part="cb-select-all" type="checkbox"> <span wj-part="sp-select-all"><\/span><\/label><br/><div wj-part="div-values" class="wj-dropdown" style="height:150px"><\/div><\/div>',r}(n.Control);t.ValueFilterEditor=i})(t.filter||(t.filter={}));var i=t.filter})(n.grid||(n.grid={}));var t=n.grid}(wijmo||(wijmo={})),function(n){(function(t){(function(t){'use strict';var i=function(){function i(i){this._c1=new t.FilterCondition;this._c2=new t.FilterCondition;this._and=!0;this._col=i;this._bnd=i.binding?new n.Binding(i.binding):null}return Object.defineProperty(i.prototype,"condition1",{get:function(){return this._c1},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"condition2",{get:function(){return this._c2},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"and",{get:function(){return this._and},set:function(t){this._and=n.asBoolean(t);this._bnd=this._col&&this._col.binding?new n.Binding(this._col.binding):null},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"column",{get:function(){return this._col},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isActive",{get:function(){return this._c1.isActive||this._c2.isActive},enumerable:!0,configurable:!0}),i.prototype.apply=function(t){var i=this._col,r=this._c1,u=this._c2,f,e;return!this._bnd||!this.isActive?!0:(t=this._bnd.getValue(t),i.dataMap?t=i.dataMap.getDisplayValue(t):n.isDate(t)?(n.isString(r.value)||n.isString(u.value))&&(t=n.Globalize.format(t,i.format)):n.isNumber(t)&&(t=n.Globalize.parseFloat(n.Globalize.format(t,i.format))),f=r.apply(t),e=u.apply(t),r.isActive&&u.isActive?this._and?f&&e:f||e:r.isActive?f:u.isActive?e:!0)},i.prototype.clear=function(){this._c1.clear();this._c2.clear();this.and=!0},i.prototype.implementsInterface=function(n){return n=='IColumnFilter'},i}();t.ConditionFilter=i})(t.filter||(t.filter={}));var i=t.filter})(n.grid||(n.grid={}));var t=n.grid}(wijmo||(wijmo={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){(function(t){(function(t){'use strict';var i=function(i){function r(r,u){var e,f;i.call(this,r);this._filter=n.asType(u,t.ConditionFilter,!1);e=this.getTemplate();this.applyTemplate('wj-control',e,{_divHdr:'div-hdr',_divCmb1:'div-cmb1',_divVal1:'div-val1',_btnAnd:'btn-and',_btnOr:'btn-or',_spAnd:'sp-and',_spOr:'sp-or',_divCmb2:'div-cmb2',_divVal2:'div-val2'});this._divHdr.textContent=n.culture.FlexGridFilter.header;this._spAnd.textContent=n.culture.FlexGridFilter.and;this._spOr.textContent=n.culture.FlexGridFilter.or;this._cmb1=this._createOperatorCombo(this._divCmb1);this._cmb2=this._createOperatorCombo(this._divCmb2);this._val1=this._createValueInput(this._divVal1);this._val2=this._createValueInput(this._divVal2);f=this._btnAndOrChanged.bind(this);this._btnAnd.addEventListener('change',f);this._btnOr.addEventListener('change',f);this.updateEditor()}return __extends(r,i),Object.defineProperty(r.prototype,"filter",{get:function(){return this._filter},enumerable:!0,configurable:!0}),r.prototype.updateEditor=function(){var t=this._filter.condition1,i=this._filter.condition2;this._cmb1.selectedValue=t.operator;this._cmb2.selectedValue=i.operator;this._val1 instanceof n.input.ComboBox?(this._val1.text=n.changeType(t.value,1,null),this._val2.text=n.changeType(i.value,1,null)):(this._val1.value=t.value,this._val2.value=i.value);this._btnAnd.checked=this._filter.and;this._btnOr.checked=!this._filter.and},r.prototype.clearEditor=function(){this._cmb1.selectedValue=this._cmb2.selectedValue=null;this._val1.text=this._val2.text=null;this._btnAnd.checked=!0;this._btnOr.checked=!1},r.prototype.updateFilter=function(){var t=this._filter.column,i=this._filter.condition1,r=this._filter.condition2,u;i.operator=this._cmb1.selectedValue;r.operator=this._cmb2.selectedValue;this._val1 instanceof n.input.ComboBox?(u=t.dataType==4?1:t.dataType,i.value=n.changeType(this._val1.text,u,t.format),r.value=n.changeType(this._val2.text,u,t.format)):(i.value=this._val1.value,r.value=this._val2.value);this._filter.and=this._btnAnd.checked},r.prototype._createOperatorCombo=function(t){var i=this._filter.column,u=n.culture.FlexGridFilter.stringOperators,r;return i.dataType!=4||this._isTimeFormat(i.format)?i.dataType!=2||i.dataMap?i.dataType!=3||i.dataMap||(u=n.culture.FlexGridFilter.booleanOperators):u=n.culture.FlexGridFilter.numberOperators:u=n.culture.FlexGridFilter.dateOperators,r=new n.input.ComboBox(t),r.itemsSource=u,r.displayMemberPath='name',r.selectedValuePath='op',r},r.prototype._createValueInput=function(t){var r=this._filter.column,i=null;return r.dataType!=4||this._isTimeFormat(r.format)?r.dataType!=2||r.dataMap?(i=new n.input.ComboBox(t),r.dataMap?(i.itemsSource=r.dataMap.getDisplayValues(),i.isEditable=!0):r.dataType==3&&(i.itemsSource=[!0,!1])):(i=new n.input.InputNumber(t),i.format=r.format):(i=new n.input.InputDate(t),i.format=r.format),i.required=!1,i},r.prototype._isTimeFormat=function(t){return t?(t=n.culture.Globalize.calendar.patterns[t]||t,/[Hmst]+/.test(t)):!1},r.prototype._btnAndOrChanged=function(n){this._btnAnd.checked=n.target==this._btnAnd;this._btnOr.checked=n.target==this._btnOr},r.controlTemplate='<div><div wj-part="div-hdr"><\/div><div wj-part="div-cmb1"><\/div><br/><div wj-part="div-val1"><\/div><br/><div style="text-align:center"><label><input wj-part="btn-and" type="radio"> <span wj-part="sp-and"><\/span> <\/label>&nbsp;&nbsp;&nbsp;<label><input wj-part="btn-or" type="radio"> <span wj-part="sp-or"><\/span> <\/label><\/div><div wj-part="div-cmb2"><\/div><br/><div wj-part="div-val2"><\/div><br/><\/div>',r}(n.Control);t.ConditionFilterEditor=i})(t.filter||(t.filter={}));var i=t.filter})(n.grid||(n.grid={}));var t=n.grid}(wijmo||(wijmo={})),function(n){(function(t){(function(t){'use strict';var r=function(){function t(){this._op=null}return Object.defineProperty(t.prototype,"operator",{get:function(){return this._op},set:function(t){this._op=n.asEnum(t,i,!0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this._val},set:function(t){this._val=t;this._strVal=n.isString(t)?t.toString().toLowerCase():null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isActive",{get:function(){switch(this._op){case null:return!1;case 0:case 1:return!0;default:return this._val!=null||this._strVal!=null}},enumerable:!0,configurable:!0}),t.prototype.clear=function(){this.operator=null;this.value=null},t.prototype.apply=function(t){var i=this._strVal||this._val;n.isString(t)&&(t=t.toLowerCase());switch(this._op){case null:return!0;case 0:return n.isDate(t)&&n.isDate(i)?n.DateTime.sameDate(t,i):t==i;case 1:return t!=i;case 2:return t>i;case 3:return t>=i;case 4:return t<i;case 5:return t<=i;case 6:return this._strVal&&n.isString(t)?t.indexOf(this._strVal)==0:!1;case 7:return this._strVal&&n.isString(t)&&t.length>=this._strVal.length?t.substr(t.length-this._strVal.length)==i:!1;case 8:return this._strVal&&n.isString(t)?t.indexOf(this._strVal)>-1:!1;case 9:return this._strVal&&n.isString(t)?t.indexOf(this._strVal)<0:!1}throw'Unknown operator';},t}(),i;t.FilterCondition=r,function(n){n[n.EQ=0]="EQ";n[n.NE=1]="NE";n[n.GT=2]="GT";n[n.GE=3]="GE";n[n.LT=4]="LT";n[n.LE=5]="LE";n[n.BW=6]="BW";n[n.EW=7]="EW";n[n.CT=8]="CT";n[n.NC=9]="NC"}(t.Operator||(t.Operator={}));i=t.Operator})(t.filter||(t.filter={}));var i=t.filter})(n.grid||(n.grid={}));var t=n.grid}(wijmo||(wijmo={})),function(n){(function(t){(function(t){'use strict';var i=function(){function i(n,i){this._owner=n;this._col=i;this._valueFilter=new t.ValueFilter(i);this._conditionFilter=new t.ConditionFilter(i)}return Object.defineProperty(i.prototype,"filterType",{get:function(){return this._filterType!=null?this._filterType:this._owner.defaultFilterType},set:function(i){if(i!=this._filterType){var r=this.isActive;this.clear();this._filterType=n.asEnum(i,t.FilterType,!0);r?this._owner.apply():this._col.grid&&this._col.grid.invalidate()}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"valueFilter",{get:function(){return this._valueFilter},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"conditionFilter",{get:function(){return this._conditionFilter},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"column",{get:function(){return this._col},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isActive",{get:function(){return this._conditionFilter.isActive||this._valueFilter.isActive},enumerable:!0,configurable:!0}),i.prototype.apply=function(n){return this._conditionFilter.apply(n)&&this._valueFilter.apply(n)},i.prototype.clear=function(){this._valueFilter.clear();this._conditionFilter.clear()},i.prototype.implementsInterface=function(n){return n=='IColumnFilter'},i}();t.ColumnFilter=i})(t.filter||(t.filter={}));var i=t.filter})(n.grid||(n.grid={}));var t=n.grid}(wijmo||(wijmo={}));__extends=this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);r.prototype=t.prototype;n.prototype=new r},function(n){(function(t){(function(t){'use strict';n.culture.FlexGridFilter={ascending:'\u2191 Ascending',descending:'\u2193 Descending',apply:'Apply',clear:'Clear',conditions:'Filter by Condition',values:'Filter by Value',search:'Search',selectAll:'Select All',null:'(nothing)',header:'Show items where the value',and:'And',or:'Or',stringOperators:[{name:'(not set)',op:null},{name:'Equals',op:0},{name:'Does not equal',op:1},{name:'Begins with',op:6},{name:'Ends with',op:7},{name:'Contains',op:8},{name:'Does not contain',op:9}],numberOperators:[{name:'(not set)',op:null},{name:'Equals',op:0},{name:'Does not equal',op:1},{name:'Is Greater than',op:2},{name:'Is Greater than or equal to',op:3},{name:'Is Less than',op:4},{name:'Is Less than or equal to',op:5}],dateOperators:[{name:'(not set)',op:null},{name:'Equals',op:0},{name:'Is Before',op:4},{name:'Is After',op:2}],booleanOperators:[{name:'(not set)',op:null},{name:'Equals',op:0},{name:'Does not equal',op:1}]};var i=function(i){function r(r,u,f){var o,h,c,l,s,e;typeof f=="undefined"&&(f=!0);o=this;i.call(this,r);this.filterChanged=new n.Event;this.buttonClicked=new n.Event;this._filter=n.asType(u,t.ColumnFilter);h=this.getTemplate();this.applyTemplate('wj-control wj-columnfiltereditor wj-content',h,{_divSort:'div-sort',_btnAsc:'btn-asc',_btnDsc:'btn-dsc',_divType:'div-type',_aVal:'a-val',_aCnd:'a-cnd',_divEdtVal:'div-edt-val',_divEdtCnd:'div-edt-cnd',_btnApply:'btn-apply',_btnClear:'btn-clear'});this._btnAsc.textContent=n.culture.FlexGridFilter.ascending;this._btnDsc.textContent=n.culture.FlexGridFilter.descending;this._aVal.textContent=n.culture.FlexGridFilter.values;this._aCnd.textContent=n.culture.FlexGridFilter.conditions;this._btnApply.textContent=n.culture.FlexGridFilter.apply;this._btnClear.textContent=n.culture.FlexGridFilter.clear;c=this.filter.conditionFilter.isActive||(u.filterType&2)==0?1:2;this._showFilter(c);l=this.filter.column;s=l.grid.collectionView;f&&s&&s.canSort||(this._divSort.style.display='none');this.updateEditor();e=this._btnClicked.bind(this);this._btnApply.addEventListener('click',e);this._btnClear.addEventListener('click',e);this._btnAsc.addEventListener('click',e);this._btnDsc.addEventListener('click',e);this._aVal.addEventListener('click',e);this._aCnd.addEventListener('click',e);this.hostElement.addEventListener('keydown',function(n){switch(n.keyCode){case 13:switch(n.target.tagName){case'A':case'BUTTON':o._btnClicked(n);break;default:o.updateFilter();o.onFilterChanged();o.onButtonClicked()}n.preventDefault();break;case 27:o.onButtonClicked();n.preventDefault()}})}return __extends(r,i),Object.defineProperty(r.prototype,"filter",{get:function(){return this._filter},enumerable:!0,configurable:!0}),r.prototype.updateEditor=function(){this._edtVal&&this._edtVal.updateEditor();this._edtCnd&&this._edtCnd.updateEditor()},r.prototype.updateFilter=function(){switch(this._getFilterType()){case 2:this._edtVal.updateFilter();this.filter.conditionFilter.clear();break;case 1:this._edtCnd.updateFilter();this.filter.valueFilter.clear()}},r.prototype.onFilterChanged=function(n){this.filterChanged.raise(this,n)},r.prototype.onButtonClicked=function(n){this.buttonClicked.raise(this,n)},r.prototype._showFilter=function(n){n==2&&this._edtVal==null&&(this._edtVal=new t.ValueFilterEditor(this._divEdtVal,this.filter.valueFilter));n==1&&this._edtCnd==null&&(this._edtCnd=new t.ConditionFilterEditor(this._divEdtCnd,this.filter.conditionFilter));(n&this.filter.filterType)!=0&&(n==2?(this._divEdtVal.style.display='',this._divEdtCnd.style.display='none',this._enableLink(this._aVal,!1),this._enableLink(this._aCnd,!0)):(this._divEdtVal.style.display='none',this._divEdtCnd.style.display='',this._enableLink(this._aVal,!0),this._enableLink(this._aCnd,!1)));switch(this.filter.filterType){case 0:case 1:case 2:this._divType.style.display='none';break;default:this._divType.style.display=''}},r.prototype._enableLink=function(n,t){n.style.textDecoration=t?'':'none';n.style.fontWeight=t?'':'bold';t?n.href='':n.removeAttribute('href')},r.prototype._getFilterType=function(){return this._divEdtVal.style.display!='none'?2:1},r.prototype._btnClicked=function(t){if(t.preventDefault(),t.stopPropagation(),!n.hasClass(t.target,'wj-state-disabled')){if(t.target==this._aVal){this._showFilter(2);this._edtVal.focus();return}if(t.target==this._aCnd){this._showFilter(1);this._edtCnd.focus();return}if(t.target==this._btnAsc||t.target==this._btnDsc){var i=this.filter.column,u=i.sortMemberPath?i.sortMemberPath:i.binding,r=i.grid.collectionView,f=new n.collections.SortDescription(u,t.target==this._btnAsc);r.sortDescriptions.deferUpdate(function(){r.sortDescriptions.clear();r.sortDescriptions.push(f)})}t.target==this._btnApply?(this.updateFilter(),this.onFilterChanged()):t.target==this._btnClear&&this.filter.isActive&&(this.filter.clear(),this.onFilterChanged());this.updateEditor();this.onButtonClicked()}},r.controlTemplate='<div><div wj-part="div-sort"><a wj-part="btn-asc" href="" style="min-width:95px" draggable="false"><\/a>&nbsp;&nbsp;&nbsp;<a wj-part="btn-dsc" href="" style="min-width:95px" draggable="false"><\/a><\/div><div style="text-align:right;margin:10px 0px;font-size:80%"><div wj-part="div-type"><a wj-part="a-cnd" href="" draggable="false"><\/a>&nbsp;|&nbsp;<a wj-part="a-val" href="" draggable="false"><\/a><\/div><\/div><div wj-part="div-edt-val"><\/div><div wj-part="div-edt-cnd"><\/div><div style="text-align:right;margin-top:10px"><a wj-part="btn-apply" href="" draggable="false"><\/a>&nbsp;&nbsp;<a wj-part="btn-clear" href="" draggable="false"><\/a><\/div>',r}(n.Control);t.ColumnFilterEditor=i})(t.filter||(t.filter={}));var i=t.filter})(n.grid||(n.grid={}));var t=n.grid}(wijmo||(wijmo={})),function(n){(function(t){(function(i){'use strict';(function(n){n[n.None=0]="None";n[n.Condition=1]="Condition";n[n.Value=2]="Value";n[n.Both=3]="Both"})(i.FilterType||(i.FilterType={}));var r=i.FilterType,u=function(){function u(i){this._showIcons=!0;this._showSort=!0;this._defFilterType=3;this.filterApplied=new n.Event;this.filterChanging=new n.Event;this.filterChanged=new n.Event;var r='Missing dependency: FlexGridFilter requires ';n.assert(n.grid.FlexGrid!=null,r+'wijmo.grid.');n.assert(n.input.ComboBox!=null,r+'wijmo.input.');this._filterGlyph=n.createElement('<div '+u._WJA_FILTER+' style ="float:'+(i._rtl?'left':'right')+';cursor:pointer;padding:0px 4px"><span class="wj-glyph-filter"><\/span><\/div>');this._filters=[];this._grid=n.asType(i,t.FlexGrid,!1);this._grid.formatItem.addHandler(this._formatItem.bind(this));this._grid.itemsSourceChanged.addHandler(this.clear.bind(this));this._grid.hostElement.addEventListener('mousedown',this._mouseDown.bind(this),!0);this._grid.invalidate()}return Object.defineProperty(u.prototype,"grid",{get:function(){return this._grid},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"filterColumns",{get:function(){return this._filterColumns},set:function(t){this._filterColumns=n.asArray(t);this.clear()},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"showFilterIcons",{get:function(){return this._showIcons},set:function(t){t!=this.showFilterIcons&&(this._showIcons=n.asBoolean(t),this._grid&&this._grid.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"showSortButtons",{get:function(){return this._showSort},set:function(t){this._showSort=n.asBoolean(t)},enumerable:!0,configurable:!0}),u.prototype.getColumnFilter=function(r,u){var f,e;for(typeof u=="undefined"&&(u=!0),n.isString(r)?r=this._grid.columns.getColumn(r):n.isNumber(r)&&(r=this._grid.columns[r]),r=n.asType(r,t.Column),f=0;f<this._filters.length;f++)if(this._filters[f].column==r)return this._filters[f];return u&&r.binding?(e=new i.ColumnFilter(this,r),this._filters.push(e),e):null},Object.defineProperty(u.prototype,"defaultFilterType",{get:function(){return this._defFilterType},set:function(t){t!=this.defaultFilterType&&(this._defFilterType=n.asEnum(t,r,!1),this._grid.invalidate(),this.clear())},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"filterDefinition",{get:function(){for(var n,t,u,i={defaultFilterType:this.defaultFilterType,filters:[]},r=0;r<this._filters.length;r++)n=this._filters[r],n&&n.column&&n.column.binding&&(n.conditionFilter.isActive?(t=n.conditionFilter,i.filters.push({binding:n.column.binding,type:'condition',condition1:{operator:t.condition1.operator,value:t.condition1.value},and:t.and,condition2:{operator:t.condition2.operator,value:t.condition2.value}})):n.valueFilter.isActive&&(u=n.valueFilter,i.filters.push({binding:n.column.binding,type:'value',filterText:u.filterText,showValues:u.showValues})));return JSON.stringify(i)},set:function(t){var e=JSON.parse(n.asString(t)),f,r,s;for(this.clear(),this.defaultFilterType=e.defaultFilterType,f=0;f<e.filters.length;f++){var i=e.filters[f],u=this._grid.columns.getColumn(i.binding),o=this.getColumnFilter(u,!0);if(o)switch(i.type){case'condition':r=o.conditionFilter;r.condition1.value=u.dataType==4?n.changeType(i.condition1.value,u.dataType,null):i.condition1.value;r.condition1.operator=i.condition1.operator;r.and=i.and;r.condition2.value=u.dataType==4?n.changeType(i.condition2.value,u.dataType,null):i.condition2.value;r.condition2.operator=i.condition2.operator;break;case'value':s=o.valueFilter;s.filterText=i.filterText;s.showValues=i.showValues}}this.apply()},enumerable:!0,configurable:!0}),u.prototype.editColumnFilter=function(r,u){var o=this,f;this.closeEditor();r=n.isString(r)?this._grid.columns.getColumn(r):n.asType(r,t.Column,!1);f=new t.CellRangeEventArgs(this._grid.cells,new t.CellRange(-1,r.index));this.onFilterChanging(f);if(!f.cancel){f.cancel=!0;var e=document.createElement('div'),a=this.getColumnFilter(r),h=new i.ColumnFilterEditor(e,a,this.showSortButtons);n.addClass(e,'wj-dropdown-panel');this._grid._rtl&&(e.dir='rtl');h.filterChanged.addHandler(function(){f.cancel=!1;setTimeout(function(){f.cancel||o.apply()})});h.buttonClicked.addHandler(function(){o.closeEditor();o.onFilterChanged(f)});h.lostFocus.addHandler(function(){setTimeout(function(){var t=n.Control.getControl(o._divEdt);t&&!t.containsFocus()&&o.closeEditor()},10)});var l=this._grid.columnHeaders,v=u?u.row:l.rows.length-1,y=u?u.col:r.index,s=l.getCellBoundingRect(v,y),c=document.elementFromPoint(s.left+s.width/2,s.top+s.height/2);c=n.closest(c,'.wj-cell');c?n.showPopup(e,c,!1,!1,!1):n.showPopup(e,s);h.focus();this._divEdt=e;this._edtCol=r}},u.prototype.closeEditor=function(){if(this._divEdt){n.hidePopup(this._divEdt,!0);var t=n.Control.getControl(this._divEdt);t&&t.dispose();this._divEdt=null;this._edtCol=null}},u.prototype.apply=function(){var t=this._grid.collectionView,i;t&&(t.filter?t.refresh():t.filter=this._filter.bind(this));i=t?t.updateFilterDefinition:null;n.isFunction(i)&&i.call(t,this);this.onFilterApplied()},u.prototype.clear=function(){this._filters.length&&(this._filters=[],this.apply())},u.prototype.onFilterApplied=function(n){this.filterApplied.raise(this,n)},u.prototype.onFilterChanging=function(n){this.filterChanging.raise(this,n)},u.prototype.onFilterChanged=function(n){this.filterChanged.raise(this,n)},u.prototype._filter=function(n){for(var t=0;t<this._filters.length;t++)if(!this._filters[t].apply(n))return!1;return!0},u.prototype._formatItem=function(i,r){var u,l,o,c;if(r.panel.cellType==2){var f=this._grid,s=f.getMergedRange(r.panel,r.row,r.col)||new t.CellRange(r.row,r.col),h=f.columns[s.col],e=f._getBindingColumn(r.panel,r.row,h);(s.row2==r.panel.rows.length-1||h!=e)&&(u=this.getColumnFilter(e,this.defaultFilterType!=0),this._filterColumns&&this._filterColumns.indexOf(e.binding)<0&&(u=null),u&&u.filterType!=0?(l=f.hostElement&&getComputedStyle(f.hostElement).direction=='rtl',this._showIcons&&(o=r.cell.querySelector('div')||r.cell,c=this._filterGlyph.cloneNode(!0),o.insertBefore(c,o.firstChild)),n.toggleClass(r.cell,'wj-filter-on',u.isActive),n.toggleClass(r.cell,'wj-filter-off',!u.isActive)):(n.removeClass(r.cell,'wj-filter-on'),n.removeClass(r.cell,'wj-filter-off')))}},u.prototype._mouseDown=function(t){var o=this,r,i,e,f;n.closest(t.target,'['+u._WJA_FILTER+']')&&(r=this._grid,i=r.hitTest(t),i.panel==r.columnHeaders&&(e=r.columns[i.col],f=r._getBindingColumn(i.panel,i.row,e),this._divEdt&&this._edtCol==f?this.closeEditor():setTimeout(function(){o.editColumnFilter(f,i)},this._divEdt?100:0),t.stopPropagation(),t.preventDefault()))},u._WJA_FILTER='wj-filter',u}();i.FlexGridFilter=u})(t.filter||(t.filter={}));var i=t.filter})(n.grid||(n.grid={}));var t=n.grid}(wijmo||(wijmo={}))