@bnsights/bbsf-controls 1.0.44 → 1.0.47

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++) {
@@ -4746,6 +4756,8 @@
4746
4756
  PagingComponent.prototype.getItemList = function (page, IsFilterUpdated) {
4747
4757
  var _this = this;
4748
4758
  if (IsFilterUpdated === void 0) { IsFilterUpdated = false; }
4759
+ if (this.options.StartPagingCallback)
4760
+ this.options.StartPagingCallback.call(null);
4749
4761
  var pagingDTO = new PagingDTO();
4750
4762
  var size = Number.parseInt(this.options.PageSize.toString());
4751
4763
  if (this.options.IsLoadMoreControl)
@@ -4755,42 +4767,16 @@
4755
4767
  pagingDTO.CurrentPageNumber = page;
4756
4768
  pagingDTO.TotalCount = this.totalRow;
4757
4769
  pagingDTO.IsFilterUpdated = IsFilterUpdated;
4758
- var params = new http$1.HttpParams();
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
- params = params.append(this.options.Filters[index].ActionParameterName, value);
4770
- }
4771
- }
4772
- else {
4773
- params = params.append(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
- params = params.append(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
- params = params.append(this.options.Filters[index].ActionParameterName, ElementValue);
4790
- }
4791
- }
4792
- }
4793
- this.requestHandlerService.post(this.options.ActionPostURL, pagingDTO, null, params, null)
4770
+ var filters = {};
4771
+ filters = this.getFiltersValue();
4772
+ //Set Filters object that sent to action URL
4773
+ var filtersDTO = {
4774
+ PagingDTO: pagingDTO,
4775
+ Filters: filters
4776
+ };
4777
+ var requestOptions = new bbsfUtilities.RequestOptionsModel();
4778
+ requestOptions.disableBlockUI = this.options.DisableBlockUI;
4779
+ this.requestHandlerService.post(this.options.ActionPostURL, this.options.Filters && this.options.Filters.length > 0 ? filtersDTO : pagingDTO, null, null, requestOptions)
4794
4780
  .subscribe(function (responseData) {
4795
4781
  _this.result = responseData.items; //this.castItems(responseData.items);
4796
4782
  var castedResult = classTransformer.plainToClass(_this.options.TypeOfResponse, _this.result, { excludeExtraneousValues: true });
@@ -4850,6 +4836,60 @@
4850
4836
  this.itemsText = this.utilityService.getResourceValue("Item");
4851
4837
  }
4852
4838
  };
4839
+ PagingComponent.prototype.clearFilters = function () {
4840
+ if (this.options.Filters != null && this.options.Filters != []) {
4841
+ for (var index = 0; index < this.options.Filters.length; index++) {
4842
+ if (this.options.Filters[index].FormControlName != null && this.options.Filters[index].FormControlName != "") {
4843
+ var FormControlName = this.options.Filters[index].FormControlName;
4844
+ this.group.controls[FormControlName].setValue(null);
4845
+ }
4846
+ }
4847
+ this.ReinitializePaging();
4848
+ }
4849
+ };
4850
+ PagingComponent.prototype.getFiltersValue = function () {
4851
+ var filters = {};
4852
+ if (this.options.Filters != null && this.options.Filters != []) {
4853
+ for (var index = 0; index < this.options.Filters.length; index++) {
4854
+ if (this.options.Filters[index].FormControlName != null && this.options.Filters[index].FormControlName != "") {
4855
+ var FormControlName = this.options.Filters[index].FormControlName;
4856
+ var ControlValue = this.group.controls[FormControlName].value;
4857
+ if (ControlValue != undefined && ControlValue != null && ControlValue != "") {
4858
+ if (this.options.Filters[index].FilterType == exports.FilterType.DatePicker) {
4859
+ if (Array.isArray(ControlValue)) {
4860
+ for (var element = 0; element < ControlValue.length; element++) {
4861
+ var value = ControlValue[element];
4862
+ filters[this.options.Filters[index].ActionParameterName] = value;
4863
+ }
4864
+ }
4865
+ else {
4866
+ filters[this.options.Filters[index].ActionParameterName] = ControlValue;
4867
+ }
4868
+ }
4869
+ else {
4870
+ if (this.options.Filters[index].FilterType == exports.FilterType.AutocompleteTextBox)
4871
+ ControlValue = JSON.stringify(ControlValue);
4872
+ if (this.options.Filters[index].FilterType == exports.FilterType.TagInput)
4873
+ ControlValue = JSON.stringify(ControlValue);
4874
+ filters[this.options.Filters[index].ActionParameterName] = ControlValue;
4875
+ }
4876
+ }
4877
+ else {
4878
+ filters[this.options.Filters[index].ActionParameterName] = null;
4879
+ }
4880
+ }
4881
+ else {
4882
+ var ElementjQuerySelector = this.options.Filters[index].jQuerySelector;
4883
+ var ElementValue = document.querySelector(ElementjQuerySelector).value;
4884
+ if (ElementValue != undefined && ElementValue != null)
4885
+ filters[this.options.Filters[index].ActionParameterName] = ElementValue;
4886
+ else
4887
+ filters[this.options.Filters[index].ActionParameterName] = null;
4888
+ }
4889
+ }
4890
+ }
4891
+ return filters;
4892
+ };
4853
4893
  return PagingComponent;
4854
4894
  }());
4855
4895
  PagingComponent.decorators = [
@@ -5851,10 +5891,7 @@
5851
5891
  FormComponent.prototype.ngAfterViewInit = function () {
5852
5892
  var _this = this;
5853
5893
  this.options.FormGroup.valueChanges.subscribe(function (es) {
5854
- if (_this.isChange != null)
5855
- _this.OnChange.emit(_this.isChange);
5856
- else
5857
- _this.isChange = true;
5894
+ _this.OnChange.emit(true);
5858
5895
  });
5859
5896
  };
5860
5897
  FormComponent.prototype.submit = function () {
@@ -7795,6 +7832,10 @@
7795
7832
  /**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. */
7796
7833
  this.ScrollWindow = true;
7797
7834
  this.ForceDirection = exports.ForceDirection.English;
7835
+ /** Clear Filter button selector */
7836
+ this.ResetFilterButtonName = null;
7837
+ this.DisableBlockUI = false;
7838
+ this.StartPagingCallback = null;
7798
7839
  }
7799
7840
  return PagingOptions;
7800
7841
  }());