@bnsights/bbsf-controls 1.0.51 → 1.0.52

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.
@@ -4507,6 +4507,9 @@
4507
4507
  // this.group.addControl(this.options.Name, new FormControl(''));
4508
4508
  // this.TagInputControl = this.group.controls[this.options.Name]; // new FormControl('',validationRules);
4509
4509
  this.TagsFormControl.setValue(this.options.Value);
4510
+ if (this.options.IsRequired) {
4511
+ this.validationRules.push(forms.Validators.required);
4512
+ }
4510
4513
  if (this.options.CustomValidation.length > 0) {
4511
4514
  var Validations = this.options.CustomValidation;
4512
4515
  for (var index = 0; index < Validations.length; index++) {
@@ -4514,9 +4517,6 @@
4514
4517
  this.validationRules.push(Validation.functionBody);
4515
4518
  }
4516
4519
  }
4517
- if (this.options.IsRequired) {
4518
- this.validationRules.push(forms.Validators.required);
4519
- }
4520
4520
  this.TagsFormControl.setValidators(this.validationRules);
4521
4521
  this.TagsFormControl.setAsyncValidators(this.validationRulesasync);
4522
4522
  if (this.options.IsDisabled) {
@@ -4525,7 +4525,7 @@
4525
4525
  if (this.options.Value != undefined && this.options.Value != []) {
4526
4526
  for (var index = 0; index < this.options.Value.length; index++) {
4527
4527
  var element = this.options.Value[index];
4528
- this.SelectedId.push(element.key);
4528
+ this.SelectedId.push(element.id);
4529
4529
  }
4530
4530
  this.tags = this.options.Value;
4531
4531
  this.TagsFormControl.setValue(this.options.Value);
@@ -4559,7 +4559,7 @@
4559
4559
  this.controlUtility.CopyInputMessage(inputElement);
4560
4560
  };
4561
4561
  TagsInputComponent.prototype.searchFunctionFactory = function (Text) {
4562
- var Url = this.options.ActionURL + "?" + this.options.QueryParamName + "=" + Text + "&" + this.options.SelectedItemsParamName + "=" + this.SelectedId;
4562
+ var Url = this.options.ActionURL + "?" + this.options.QueryParamName + "=" + encodeURIComponent(Text) + "&" + this.options.SelectedItemsParamName + "=" + this.SelectedId;
4563
4563
  if (this.options.ExtraFilters)
4564
4564
  Url = Url + ("&" + this.options.ExtraFilters);
4565
4565
  var requestOptionsModel = new bbsfUtilities.RequestOptionsModel();
@@ -4569,7 +4569,7 @@
4569
4569
  return Model;
4570
4570
  };
4571
4571
  TagsInputComponent.prototype.AddTag = function (event, key) {
4572
- if (this.IsNoMatch == true && this.options.AllowNewSelection == false && (key.selected != null || key.selected != "")) {
4572
+ if (this.IsNoMatch == true && this.options.AllowNewSelection == false && key.selected) {
4573
4573
  this.TagsFormControl.setErrors({ "errorMassage": this.options.NoResultText });
4574
4574
  this.TagsFormControl.markAsTouched();
4575
4575
  this.TagsFormControl.invalid;
@@ -4581,28 +4581,39 @@
4581
4581
  }
4582
4582
  else if (this.IsNoMatch == true && event == "Enter" && this.options.AllowNewSelection && key.selected) {
4583
4583
  if (!(this.tags.length >= this.options.MaxNumberTags)) {
4584
- this.tags.push({ key: "", value: key.selected });
4585
- key.selected = null;
4584
+ this.tags.push({ name: key.selected });
4585
+ this.group.get(this.options.Name).setValue(this.tags);
4586
+ this.group.get(this.options.Name).markAllAsTouched();
4587
+ this.group.updateValueAndValidity();
4588
+ if (this.group.get(this.options.Name).valid) {
4589
+ key.selected = null;
4590
+ return;
4591
+ }
4592
+ else
4593
+ this.tags.pop();
4586
4594
  }
4587
4595
  }
4588
4596
  };
4589
4597
  TagsInputComponent.prototype.onTagsChanged = function (result) {
4590
4598
  //console.log(this.tags)
4591
4599
  if (result["change"] == "add") {
4592
- this.SelectedId.push(result.tag.key);
4600
+ this.SelectedId.push(result.tag.id);
4593
4601
  }
4594
4602
  if (result["change"] == "remove") {
4595
- this.SelectedId = this.SelectedId.filter(function (item) { return item != result.tag.key; });
4603
+ this.SelectedId = this.SelectedId.filter(function (item) { return item != result.tag.id; });
4596
4604
  if (this.SelectedId.length == 0 && this.options.IsRequired == true) {
4597
4605
  this.TagsFormControl.setErrors({ required: "" });
4598
4606
  this.TagsFormControl.markAsTouched();
4599
4607
  this.TagsFormControl.invalid;
4600
4608
  }
4601
4609
  }
4602
- var originalValue = this.TagsFormControl.value.map(function (a) { return a.key; });
4610
+ var originalValue = this.TagsFormControl.value.map(function (a) { return a.id; });
4603
4611
  if (this.options.PatchFunction && this.options.PatchPath && this.TagsFormControl.valid) {
4604
4612
  this.controlUtility.patchControlValue(originalValue, this.options.PatchFunction, this.options.PatchPath);
4605
4613
  }
4614
+ this.group.get(this.options.Name).setValue(this.tags);
4615
+ this.TagsFormControl.updateValueAndValidity();
4616
+ this.group.updateValueAndValidity();
4606
4617
  this.OnChange.emit(originalValue);
4607
4618
  };
4608
4619
  TagsInputComponent.prototype.onNoOptionsMatch = function (event) {
@@ -6129,12 +6140,11 @@
6129
6140
  //Modal confirmation submit function
6130
6141
  ConfirmationModalComponent.prototype.submit = function () {
6131
6142
  var _this = this;
6132
- console.log("options in submit function");
6133
- console.log(this.options);
6134
6143
  var submitModel = this.options.ServiceSubmitModel;
6135
6144
  var submittedService = this.options.ServiceSubmitFunction.apply(null, submitModel);
6136
6145
  submittedService.subscribe(function (result) {
6137
- _this.modalService.dismissAll();
6146
+ if (!_this.options.DisableModalDismiss)
6147
+ _this.modalService.dismissAll();
6138
6148
  if (!_this.options.DisableSuccessNotification) {
6139
6149
  if (!_this.options.SuccessNotificationMessage)
6140
6150
  _this.options.SuccessNotificationMessage = _this.utilityService.getResourceValue("DeletedSuccessfully");
@@ -8168,6 +8178,8 @@
8168
8178
  this.DisableSuccessNotification = false;
8169
8179
  //If ="true" disable notification after submission error
8170
8180
  this.DisableErrorNotification = false;
8181
+ //If ="true" disable prevent modal from dismiss automatically
8182
+ this.DisableModalDismiss = false;
8171
8183
  }
8172
8184
  return ConfirmationModalOptions;
8173
8185
  }());