@bnsights/bbsf-controls 1.0.54 → 1.0.57

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.
@@ -4488,14 +4488,14 @@
4488
4488
  TagsInputComponent.controlContainerstatic = this.controlContainer;
4489
4489
  }
4490
4490
  TagsInputComponent.showErrorOfInputs = function (errors) {
4491
- var e_1, _a;
4491
+ var e_1, _c;
4492
4492
  var controlContainerstatic = TagsInputComponent.controlContainerstatic;
4493
4493
  var formGroup = controlContainerstatic.control;
4494
4494
  for (var key in errors) {
4495
4495
  if (errors.hasOwnProperty(key)) {
4496
4496
  try {
4497
- for (var _b = (e_1 = void 0, __values(errors[key])), _c = _b.next(); !_c.done; _c = _b.next()) {
4498
- var iterator = _c.value;
4497
+ for (var _d = (e_1 = void 0, __values(errors[key])), _e = _d.next(); !_e.done; _e = _d.next()) {
4498
+ var iterator = _e.value;
4499
4499
  var formControl = formGroup.get(key);
4500
4500
  formControl.setErrors({ "FluentApi": iterator });
4501
4501
  formControl.markAsTouched();
@@ -4504,7 +4504,7 @@
4504
4504
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
4505
4505
  finally {
4506
4506
  try {
4507
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
4507
+ if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
4508
4508
  }
4509
4509
  finally { if (e_1) throw e_1.error; }
4510
4510
  }
@@ -4581,6 +4581,9 @@
4581
4581
  this.controlUtility.CopyInputMessage(inputElement);
4582
4582
  };
4583
4583
  TagsInputComponent.prototype.searchFunctionFactory = function (Text) {
4584
+ //If no text then return empty observable
4585
+ if (!Text)
4586
+ return rxjs.EMPTY;
4584
4587
  var Url = this.options.ActionURL + "?" + this.options.QueryParamName + "=" + encodeURIComponent(Text) + "&" + this.options.SelectedItemsParamName + "=" + this.SelectedId;
4585
4588
  if (this.options.ExtraFilters)
4586
4589
  Url = Url + ("&" + this.options.ExtraFilters);
@@ -4591,17 +4594,20 @@
4591
4594
  return Model;
4592
4595
  };
4593
4596
  TagsInputComponent.prototype.AddTag = function (event, key) {
4594
- if (this.IsNoMatch == true && this.options.AllowNewSelection == false && key.selected) {
4595
- this.TagsFormControl.setErrors({ "errorMassage": this.options.NoResultText });
4596
- this.TagsFormControl.markAsTouched();
4597
- this.TagsFormControl.invalid;
4598
- }
4599
- else if (this.IsNoMatch == false && this.options.AllowNewSelection == false) {
4600
- this.TagsFormControl.clearValidators();
4601
- this.TagsFormControl.updateValueAndValidity();
4602
- this.TagsFormControl.valid;
4597
+ var _a, _b;
4598
+ //Check if input is charachter
4599
+ if (String.fromCharCode(event.keyCode).match(/(\w|\s)/g)) {
4600
+ if (this.IsNoMatch == true && this.options.AllowNewSelection == false && key.selected) {
4601
+ this.TagsFormControl.setErrors({ "errorMassage": this.options.NoResultText });
4602
+ this.TagsFormControl.markAsTouched();
4603
+ }
4604
+ else if (this.IsNoMatch == false && this.options.AllowNewSelection == false) {
4605
+ this.TagsFormControl.clearValidators();
4606
+ this.TagsFormControl.updateValueAndValidity();
4607
+ }
4603
4608
  }
4604
- else if (this.IsNoMatch == true && event == "Enter" && this.options.AllowNewSelection && key.selected) {
4609
+ //Check if input is enter press
4610
+ else if (this.IsNoMatch == true && event.key == "Enter" && this.options.AllowNewSelection && key.selected) {
4605
4611
  if (!(this.tags.length >= this.options.MaxNumberTags)) {
4606
4612
  this.tags.push({ name: key.selected });
4607
4613
  this.group.get(this.options.Name).setValue(this.tags);
@@ -4615,6 +4621,15 @@
4615
4621
  this.tags.pop();
4616
4622
  }
4617
4623
  }
4624
+ //Remove unmatched error incase of deleting search value
4625
+ else if (event.key === "Backspace" && ((_a = key.selected) === null || _a === void 0 ? void 0 : _a.length) <= 1 && this.TagsFormControl.hasError('errorMassage')) {
4626
+ this.TagsFormControl.setErrors({ "errorMassage": null });
4627
+ this.TagsFormControl.updateValueAndValidity();
4628
+ if (((_b = this.SelectedId) === null || _b === void 0 ? void 0 : _b.length) == 0 && this.options.IsRequired) {
4629
+ this.TagsFormControl.setErrors({ required: "" });
4630
+ this.TagsFormControl.markAsTouched();
4631
+ }
4632
+ }
4618
4633
  };
4619
4634
  TagsInputComponent.prototype.onTagsChanged = function (result) {
4620
4635
  //console.log(this.tags)
@@ -4648,7 +4663,7 @@
4648
4663
  { type: i0.Component, args: [{
4649
4664
  // tslint:disable-next-line: component-selector
4650
4665
  selector: 'BBSF-TagsInput',
4651
- template: "<div class=\"b-control b-tags-input\">\r\n <div class=\"form-group validate is-invalid\" [formGroup]=\"group\">\r\n <div class=\"form-group row\" [formGroup]=\"TagsFormGroup\">\r\n\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 <b-tags-input id=\"typeahead-http\" type=\"text\" class=\"form-control bnsights-control {{options.ExtraClasses}}\"\r\n dir=\"{{options.ForceDirection==2?'rtl':''}}\" [disabled]=\"options.IsDisabled\" aria-describedby=\"email-error\"\r\n aria-invalid=\"true\" formControlName=\"tags\"\r\n [class.is-invalid]=\"TagsFormControl.invalid && TagsFormControl.touched\" placeholder=\"{{options.Placeholder}}\"\r\n id=\"{{options.Name}}\" (onTagsChanged)=\"onTagsChanged($event)\" [(ngModel)]=\"tags\"\r\n removeLastOnBackspace=\"{{options.RemoveLastOnBackspace}}\" (onNoOptionsMatch)=\"onNoOptionsMatch($event)\"\r\n [options]=\"searchFunctionFactory(SearchKey.selected)\" #SearchKey\r\n scrollableOptions=\"{{options.ScrollableOptions}}\" scrollableOptionsInView=\"{{options.MaxSearchResultsCount}}\"\r\n (keypress)=\"AddTag($event.key,SearchKey)\" [ViewMode]=\"options.TagInputMode\"\r\n maxTags=\"{{options.MaxNumberTags}}\" minLengthBeforeOptions=\"{{options.MinSearchLength}}\"\r\n [showDescription]=\"options.ShowDescription\" [defaultImageURL]=\"options.DefaultImgUrl\" name=\"tags\">\r\n </b-tags-input>\r\n\r\n <div class=\"text-danger Required-text\" *ngIf=\"(TagsFormControl.invalid && TagsFormControl.touched)\">\r\n {{getErrorValidation(TagsFormControl.errors|keyvalue)}}\r\n </div>\r\n\r\n\r\n <div class=\"d-flex justify-content-between align-items-center\">\r\n <div class=\"control-desc text-dark\">{{options.LabelDescription}}</div>\r\n </div>\r\n\r\n <div *ngIf=\"(group.valid&&group.dirty&&group.touched )||(group.untouched&&group.invalid&&group.dirty) \">\r\n {{resetError()}}</div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n\r\n",
4666
+ template: "<div class=\"b-control b-tags-input\">\r\n <div class=\"form-group validate is-invalid\" [formGroup]=\"group\">\r\n <div class=\"form-group row\" [formGroup]=\"TagsFormGroup\">\r\n\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 <b-tags-input id=\"typeahead-http\" type=\"text\" class=\"form-control bnsights-control {{options.ExtraClasses}}\"\r\n dir=\"{{options.ForceDirection==2?'rtl':''}}\" [disabled]=\"options.IsDisabled\" aria-describedby=\"email-error\"\r\n aria-invalid=\"true\" formControlName=\"tags\"\r\n [class.is-invalid]=\"TagsFormControl.invalid && TagsFormControl.touched\" placeholder=\"{{options.Placeholder}}\"\r\n id=\"{{options.Name}}\" (onTagsChanged)=\"onTagsChanged($event)\" [(ngModel)]=\"tags\"\r\n removeLastOnBackspace=\"{{options.RemoveLastOnBackspace}}\" (onNoOptionsMatch)=\"onNoOptionsMatch($event)\"\r\n [options]=\"searchFunctionFactory(SearchKey.selected)\" #SearchKey\r\n scrollableOptions=\"{{options.ScrollableOptions}}\" scrollableOptionsInView=\"{{options.MaxSearchResultsCount}}\"\r\n (keydown)=\"AddTag($event,SearchKey)\" [ViewMode]=\"options.TagInputMode\"\r\n maxTags=\"{{options.MaxNumberTags}}\" minLengthBeforeOptions=\"{{options.MinSearchLength}}\"\r\n [showDescription]=\"options.ShowDescription\" [defaultImageURL]=\"options.DefaultImgUrl\" name=\"tags\">\r\n </b-tags-input>\r\n\r\n <div class=\"text-danger Required-text\" *ngIf=\"(TagsFormControl.invalid && TagsFormControl.touched)\">\r\n {{getErrorValidation(TagsFormControl.errors|keyvalue)}}\r\n </div>\r\n\r\n\r\n <div class=\"d-flex justify-content-between align-items-center\">\r\n <div class=\"control-desc text-dark\">{{options.LabelDescription}}</div>\r\n </div>\r\n\r\n <div *ngIf=\"(group.valid&&group.dirty&&group.touched )||(group.untouched&&group.invalid&&group.dirty) \">\r\n {{resetError()}}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n\r\n",
4652
4667
  styles: [".example-form{min-width:150px;max-width:500px;width:100%}.example-full-width{width:100%}.flip_V{transform:scaleY(-1)}\n"]
4653
4668
  },] }
4654
4669
  ];