@bnsights/bbsf-controls 1.0.43 → 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.
@@ -2544,9 +2544,9 @@
2544
2544
  }
2545
2545
  return this.controlUtility.getErrorValidationMassage(ErrorList, this.group, this.options);
2546
2546
  };
2547
- DropdownListComponent.prototype.onItemSelect = function (item) {
2547
+ DropdownListComponent.prototype.onItemSelect = function () {
2548
2548
  this.onChangeService.ChangeValue(this.options.Name);
2549
- var originalValue = item;
2549
+ var originalValue = this.options.SelectedItems;
2550
2550
  if (this.options.PatchFunction && this.options.PatchPath && this.group.get(this.options.Name).valid) {
2551
2551
  this.controlUtility.patchControlValue(originalValue, this.options.PatchFunction, this.options.PatchPath);
2552
2552
  }
@@ -2590,7 +2590,7 @@
2590
2590
  { type: i0.Component, args: [{
2591
2591
  // tslint:disable-next-line: component-selector
2592
2592
  selector: 'BBSF-DropdownList',
2593
- template: "<div class=\"b-control b-dropdown-list\">\r\n <div class=\"form-group row validate is-invalid\" [formGroup]=\"group\">\r\n <label class=\"b-label col-form-label col-sm-12 \" [ngClass]=\"(options.ViewType==1)?'col-md-12':'col-md-3'\"\r\n [hidden]=\"options.HideLabel\">\r\n {{options.LabelValue}}\r\n <span *ngIf=\"(options.ShowAsterisk&&options.IsRequired)||(options.IsRequired)\" class=\"text-danger Required-text\"\r\n aria-required=\"true\">*</span>\r\n </label>\r\n\r\n <div class=\"col-sm-12\" [ngClass]=\"(options.ViewType==1)?'':'col-md-9'\">\r\n <ng-select *ngIf=\"options.DisableBootstrapSelect==false\" dir=\"{{options.ForceDirection==2?'rtl':''}}\"\r\n [bindValue]=\"options.ItemTempletkey\" [bindLabel]=\"options.ItemTempletvalue\" [items]=\"options.DataSource\"\r\n [notFoundText]=\"'No data found.'\" [maxSelectedItems]=\"options.LimitSelection\"\r\n [searchable]=\"options.AllowSearchFilter\" [multiple]=\"!options.SingleSelection\" [readonly]=\"options.IsDisabled\"\r\n [clearable]=\"true\" placeholder=\"{{options.Placeholder}}\" id=\"{{options.Name}}\"\r\n [selectableGroup]=\"true\" [selectableGroupAsModel]=\"false\" formControlName=\"{{options.Name}}\"\r\n [(ngModel)]=\"options.SelectedItems\" (change)=\"onItemSelect($event[options.ItemTempletkey])\" (clear)=\"Clear()\"\r\n [class.is-invalid]=\"DropdownListFormControl.invalid && DropdownListFormControl.touched\"\r\n [closeOnSelect]=\"options.SingleSelection ? true : false\">\r\n\r\n <ng-template *ngIf=\"options.ShowCheckbox\" ng-option-tmp let-item=\"item\" let-item$=\"item$\" let-index=\"index\">\r\n <div class=\"ks-cboxtags\">\r\n <input id=\"item-{{index}}\" type=\"checkbox\" [ngModelOptions]=\"{standalone: true}\" [ngModel]=\"item$.selected\"\r\n class=\" \" /> <label class=\"ng-option-label mb-0\" id={{item.key}}>{{item.value}}</label>\r\n </div>\r\n </ng-template>\r\n\r\n <ng-template *ngIf=\"!options.ShowCheckbox\" ng-option-tmp let-item=\"item\" let-item$=\"item$\" let-index=\"index\">\r\n <label class=\"ng-option-label mb-0\" id={{item.key}}>{{item.value}}</label>\r\n </ng-template>\r\n\r\n </ng-select>\r\n\r\n <select *ngIf=\"options.DisableBootstrapSelect\" class=\"form-control bnsights-control\"\r\n dir=\"{{options.ForceDirection==2?'rtl':''}}\" (change)=\"onItemSelect($event.target.value)\"\r\n [disabled]=\"options.IsDisabled\" formControlName=\"{{options.Name}}\">\r\n <option value=\"\" disabled>--select--</option>\r\n <option *ngFor=\"let item of options.DataSource\" value=\"{{item.key}}\" [ngValue]=\"item.key\">\r\n {{item.value}}\r\n </option>\r\n </select>\r\n\r\n <div class=\"text-danger Required-text\"\r\n *ngIf=\"(DropdownListFormControl.invalid && DropdownListFormControl.touched)\">\r\n {{getErrorValidation(DropdownListFormControl.errors|keyvalue)}}\r\n </div>\r\n\r\n <div class=\"d-flex justify-content-between align-items-center\">\r\n <div class=\"control-desc\">{{options.LabelDescription}}</div>\r\n </div>\r\n\r\n <!-- <div *ngIf=\"DropdownListFormControl.valid\">{{resetError()}}</div> -->\r\n <div *ngIf=\"(group.valid&&group.dirty&&group.touched )||(group.untouched&&group.invalid&&group.dirty) \">\r\n {{resetError()}}</div>\r\n\r\n\r\n </div>\r\n </div>\r\n</div>\r\n",
2593
+ template: "<div class=\"b-control b-dropdown-list\">\r\n <div class=\"form-group row validate is-invalid\" [formGroup]=\"group\">\r\n <label class=\"b-label col-form-label col-sm-12 \" [ngClass]=\"(options.ViewType==1)?'col-md-12':'col-md-3'\"\r\n [hidden]=\"options.HideLabel\">\r\n {{options.LabelValue}}\r\n <span *ngIf=\"(options.ShowAsterisk&&options.IsRequired)||(options.IsRequired)\" class=\"text-danger Required-text\"\r\n aria-required=\"true\">*</span>\r\n </label>\r\n\r\n <div class=\"col-sm-12\" [ngClass]=\"(options.ViewType==1)?'':'col-md-9'\">\r\n <ng-select *ngIf=\"options.DisableBootstrapSelect==false\" dir=\"{{options.ForceDirection==2?'rtl':''}}\"\r\n [bindValue]=\"options.ItemTempletkey\" [bindLabel]=\"options.ItemTempletvalue\" [items]=\"options.DataSource\"\r\n [notFoundText]=\"'No data found.'\" [maxSelectedItems]=\"options.LimitSelection\"\r\n [searchable]=\"options.AllowSearchFilter\" [multiple]=\"!options.SingleSelection\" [readonly]=\"options.IsDisabled\"\r\n [clearable]=\"true\" placeholder=\"{{options.Placeholder}}\" id=\"{{options.Name}}\"\r\n [selectableGroup]=\"true\" [selectableGroupAsModel]=\"false\" formControlName=\"{{options.Name}}\"\r\n [(ngModel)]=\"options.SelectedItems\" (change)=\"onItemSelect()\" (clear)=\"Clear()\"\r\n [class.is-invalid]=\"DropdownListFormControl.invalid && DropdownListFormControl.touched\"\r\n [closeOnSelect]=\"options.SingleSelection ? true : false\">\r\n\r\n <ng-template *ngIf=\"options.ShowCheckbox\" ng-option-tmp let-item=\"item\" let-item$=\"item$\" let-index=\"index\">\r\n <div class=\"ks-cboxtags\">\r\n <input id=\"item-{{index}}\" type=\"checkbox\" [ngModelOptions]=\"{standalone: true}\" [ngModel]=\"item$.selected\"\r\n class=\" \" /> <label class=\"ng-option-label mb-0\" id={{item.key}}>{{item.value}}</label>\r\n </div>\r\n </ng-template>\r\n\r\n <ng-template *ngIf=\"!options.ShowCheckbox\" ng-option-tmp let-item=\"item\" let-item$=\"item$\" let-index=\"index\">\r\n <label class=\"ng-option-label mb-0\" id={{item.key}}>{{item.value}}</label>\r\n </ng-template>\r\n\r\n </ng-select>\r\n\r\n <select *ngIf=\"options.DisableBootstrapSelect\" class=\"form-control bnsights-control\"\r\n dir=\"{{options.ForceDirection==2?'rtl':''}}\" (change)=\"onItemSelect()\" [(ngModel)]=\"options.SelectedItems\" [disabled]=\"options.IsDisabled\" formControlName=\"{{options.Name}}\">\r\n <option value=\"\" disabled>--{{UtilityService.getResourceValue(\"select\")}}--</option>\r\n <option *ngFor=\"let item of options.DataSource\" value=\"{{item.key}}\" [ngValue]=\"item.key\">\r\n {{item.value}}\r\n </option>\r\n </select>\r\n\r\n <div class=\"text-danger Required-text\"\r\n *ngIf=\"(DropdownListFormControl.invalid && DropdownListFormControl.touched)\">\r\n {{getErrorValidation(DropdownListFormControl.errors|keyvalue)}}\r\n </div>\r\n\r\n <div class=\"d-flex justify-content-between align-items-center\">\r\n <div class=\"control-desc\">{{options.LabelDescription}}</div>\r\n </div>\r\n\r\n <!-- <div *ngIf=\"DropdownListFormControl.valid\">{{resetError()}}</div> -->\r\n <div *ngIf=\"(group.valid&&group.dirty&&group.touched )||(group.untouched&&group.invalid&&group.dirty) \">\r\n {{resetError()}}</div>\r\n\r\n\r\n </div>\r\n </div>\r\n</div>\r\n",
2594
2594
  styles: [".cuppa-dropdown{background-color:#fff}.arrow-up,.arrow-down{border-left:none!important;border-right:none!important}.dropdown-list{padding-top:0!important}.c-token{background-color:#6495ed}.pure-checkbox .selected-item{background-color:#6495ed;color:#fff}\n"]
2595
2595
  },] }
2596
2596
  ];
@@ -4545,7 +4545,7 @@
4545
4545
  this.TagsFormControl.invalid;
4546
4546
  }
4547
4547
  }
4548
- var originalValue = this.TagsFormControl.value;
4548
+ var originalValue = this.TagsFormControl.value.map(function (a) { return a.key; });
4549
4549
  if (this.options.PatchFunction && this.options.PatchPath && this.TagsFormControl.valid) {
4550
4550
  this.controlUtility.patchControlValue(originalValue, this.options.PatchFunction, this.options.PatchPath);
4551
4551
  }
@@ -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++) {
@@ -4755,42 +4765,14 @@
4755
4765
  pagingDTO.CurrentPageNumber = page;
4756
4766
  pagingDTO.TotalCount = this.totalRow;
4757
4767
  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)
4768
+ var filters = {};
4769
+ filters = this.getFiltersValue();
4770
+ //Set Filters object that sent to action URL
4771
+ var filtersDTO = {
4772
+ PagingDTO: pagingDTO,
4773
+ Filters: filters
4774
+ };
4775
+ this.requestHandlerService.post(this.options.ActionPostURL, this.options.Filters && this.options.Filters.length > 0 ? filtersDTO : pagingDTO)
4794
4776
  .subscribe(function (responseData) {
4795
4777
  _this.result = responseData.items; //this.castItems(responseData.items);
4796
4778
  var castedResult = classTransformer.plainToClass(_this.options.TypeOfResponse, _this.result, { excludeExtraneousValues: true });
@@ -4850,6 +4832,60 @@
4850
4832
  this.itemsText = this.utilityService.getResourceValue("Item");
4851
4833
  }
4852
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
+ };
4853
4889
  return PagingComponent;
4854
4890
  }());
4855
4891
  PagingComponent.decorators = [
@@ -5851,10 +5887,7 @@
5851
5887
  FormComponent.prototype.ngAfterViewInit = function () {
5852
5888
  var _this = this;
5853
5889
  this.options.FormGroup.valueChanges.subscribe(function (es) {
5854
- if (_this.isChange != null)
5855
- _this.OnChange.emit(_this.isChange);
5856
- else
5857
- _this.isChange = true;
5890
+ _this.OnChange.emit(true);
5858
5891
  });
5859
5892
  };
5860
5893
  FormComponent.prototype.submit = function () {
@@ -6432,11 +6465,23 @@
6432
6465
  function RenderComponentService(componentFactoryResolver) {
6433
6466
  this.componentFactoryResolver = componentFactoryResolver;
6434
6467
  }
6435
- RenderComponentService.prototype.renderDynamicComponent = function (viewContainerRef, component, group, options) {
6468
+ RenderComponentService.prototype.renderDynamicComponent = function (viewContainerRef, component, group, options, size) {
6469
+ if (size === void 0) { size = 0; }
6436
6470
  var factory = this.componentFactoryResolver.resolveComponentFactory(component);
6437
6471
  var componentRef = viewContainerRef.createComponent(factory);
6438
6472
  componentRef.instance.group = group;
6439
6473
  componentRef.instance.options = options;
6474
+ if (size > 0) {
6475
+ var htmlElement = componentRef.hostView.rootNodes[0];
6476
+ // `element` is the element you want to wrap
6477
+ var parent = htmlElement.parentNode;
6478
+ var wrapper = document.createElement('div');
6479
+ wrapper.className = "col-md-" + size;
6480
+ // set the wrapper as child (instead of the element)
6481
+ parent.replaceChild(wrapper, htmlElement);
6482
+ // set element as child of wrapper
6483
+ wrapper.appendChild(htmlElement);
6484
+ }
6440
6485
  };
6441
6486
  return RenderComponentService;
6442
6487
  }());
@@ -7783,6 +7828,8 @@
7783
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. */
7784
7829
  this.ScrollWindow = true;
7785
7830
  this.ForceDirection = exports.ForceDirection.English;
7831
+ /** Clear Filter button selector */
7832
+ this.ResetFilterButtonName = null;
7786
7833
  }
7787
7834
  return PagingOptions;
7788
7835
  }());