@bnsights/bbsf-controls 1.0.45 → 1.0.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4697,6 +4697,16 @@
4697
4697
  }, false);
4698
4698
  }
4699
4699
  }
4700
+ //Add click event on Reset Filter button
4701
+ if (this.options.ResetFilterButtonName != null) {
4702
+ var button = document.getElementsByName(this.options.ResetFilterButtonName)[0];
4703
+ if (button != undefined) {
4704
+ var element = button;
4705
+ element.addEventListener("click", function (e) {
4706
+ _this.clearFilters();
4707
+ }, false);
4708
+ }
4709
+ }
4700
4710
  if (this.options.TypeaheadSearchControlNames != null && this.options.TypeaheadSearchControlNames.length > 0) {
4701
4711
  var TypeaheadSearchControlNames = this.options.TypeaheadSearchControlNames;
4702
4712
  for (var index = 0; index < TypeaheadSearchControlNames.length; index++) {
@@ -4756,40 +4766,7 @@
4756
4766
  pagingDTO.TotalCount = this.totalRow;
4757
4767
  pagingDTO.IsFilterUpdated = IsFilterUpdated;
4758
4768
  var filters = {};
4759
- if (this.options.Filters != null && this.options.Filters != []) {
4760
- for (var index = 0; index < this.options.Filters.length; index++) {
4761
- if (this.options.Filters[index].FormControlName != null && this.options.Filters[index].FormControlName != "") {
4762
- var FormControlName = this.options.Filters[index].FormControlName;
4763
- var ControlValue = this.group.controls[FormControlName].value;
4764
- if (ControlValue != undefined && ControlValue != null) {
4765
- if (this.options.Filters[index].FilterType == exports.FilterType.DatePicker) {
4766
- if (Array.isArray(ControlValue)) {
4767
- for (var element = 0; element < ControlValue.length; element++) {
4768
- var value = ControlValue[element];
4769
- filters[this.options.Filters[index].ActionParameterName] = value;
4770
- }
4771
- }
4772
- else {
4773
- filters[this.options.Filters[index].ActionParameterName] = ControlValue;
4774
- }
4775
- }
4776
- else {
4777
- if (this.options.Filters[index].FilterType == exports.FilterType.AutocompleteTextBox)
4778
- ControlValue = JSON.stringify(ControlValue);
4779
- if (this.options.Filters[index].FilterType == exports.FilterType.TagInput)
4780
- ControlValue = JSON.stringify(ControlValue);
4781
- filters[this.options.Filters[index].ActionParameterName] = ControlValue;
4782
- }
4783
- }
4784
- }
4785
- else {
4786
- var ElementjQuerySelector = this.options.Filters[index].jQuerySelector;
4787
- var ElementValue = document.querySelector(ElementjQuerySelector).value;
4788
- if (ElementValue != undefined && ElementValue != null)
4789
- filters[this.options.Filters[index].ActionParameterName] = ElementValue;
4790
- }
4791
- }
4792
- }
4769
+ filters = this.getFiltersValue();
4793
4770
  //Set Filters object that sent to action URL
4794
4771
  var filtersDTO = {
4795
4772
  PagingDTO: pagingDTO,
@@ -4855,6 +4832,60 @@
4855
4832
  this.itemsText = this.utilityService.getResourceValue("Item");
4856
4833
  }
4857
4834
  };
4835
+ PagingComponent.prototype.clearFilters = function () {
4836
+ if (this.options.Filters != null && this.options.Filters != []) {
4837
+ for (var index = 0; index < this.options.Filters.length; index++) {
4838
+ if (this.options.Filters[index].FormControlName != null && this.options.Filters[index].FormControlName != "") {
4839
+ var FormControlName = this.options.Filters[index].FormControlName;
4840
+ this.group.controls[FormControlName].setValue(null);
4841
+ }
4842
+ }
4843
+ this.ReinitializePaging();
4844
+ }
4845
+ };
4846
+ PagingComponent.prototype.getFiltersValue = function () {
4847
+ var filters = {};
4848
+ if (this.options.Filters != null && this.options.Filters != []) {
4849
+ for (var index = 0; index < this.options.Filters.length; index++) {
4850
+ if (this.options.Filters[index].FormControlName != null && this.options.Filters[index].FormControlName != "") {
4851
+ var FormControlName = this.options.Filters[index].FormControlName;
4852
+ var ControlValue = this.group.controls[FormControlName].value;
4853
+ if (ControlValue != undefined && ControlValue != null && ControlValue != "") {
4854
+ if (this.options.Filters[index].FilterType == exports.FilterType.DatePicker) {
4855
+ if (Array.isArray(ControlValue)) {
4856
+ for (var element = 0; element < ControlValue.length; element++) {
4857
+ var value = ControlValue[element];
4858
+ filters[this.options.Filters[index].ActionParameterName] = value;
4859
+ }
4860
+ }
4861
+ else {
4862
+ filters[this.options.Filters[index].ActionParameterName] = ControlValue;
4863
+ }
4864
+ }
4865
+ else {
4866
+ if (this.options.Filters[index].FilterType == exports.FilterType.AutocompleteTextBox)
4867
+ ControlValue = JSON.stringify(ControlValue);
4868
+ if (this.options.Filters[index].FilterType == exports.FilterType.TagInput)
4869
+ ControlValue = JSON.stringify(ControlValue);
4870
+ filters[this.options.Filters[index].ActionParameterName] = ControlValue;
4871
+ }
4872
+ }
4873
+ else {
4874
+ filters[this.options.Filters[index].ActionParameterName] = null;
4875
+ }
4876
+ }
4877
+ else {
4878
+ var ElementjQuerySelector = this.options.Filters[index].jQuerySelector;
4879
+ var ElementValue = document.querySelector(ElementjQuerySelector).value;
4880
+ if (ElementValue != undefined && ElementValue != null)
4881
+ filters[this.options.Filters[index].ActionParameterName] = ElementValue;
4882
+ else
4883
+ filters[this.options.Filters[index].ActionParameterName] = null;
4884
+ }
4885
+ }
4886
+ }
4887
+ return filters;
4888
+ };
4858
4889
  return PagingComponent;
4859
4890
  }());
4860
4891
  PagingComponent.decorators = [
@@ -7797,6 +7828,8 @@
7797
7828
  /**listens to the window scroll instead of the actual element scroll. this allows to invoke a callback function in the scope of the element while listenning to the window scroll. */
7798
7829
  this.ScrollWindow = true;
7799
7830
  this.ForceDirection = exports.ForceDirection.English;
7831
+ /** Clear Filter button selector */
7832
+ this.ResetFilterButtonName = null;
7800
7833
  }
7801
7834
  return PagingOptions;
7802
7835
  }());