@bnsights/bbsf-controls 1.0.60 → 1.0.62

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.
@@ -4045,6 +4045,7 @@ class TagsInputComponent {
4045
4045
  this.markAllAsTouched = false;
4046
4046
  this.validationRules = [];
4047
4047
  this.validationRulesasync = [];
4048
+ this.SearchResultHasItems = false;
4048
4049
  this.resetError = () => {
4049
4050
  this.controlValidationService.RemoveGlobalError();
4050
4051
  };
@@ -4181,6 +4182,9 @@ class TagsInputComponent {
4181
4182
  }
4182
4183
  AddTag(event, key) {
4183
4184
  var _a, _b;
4185
+ //Check if input is yab press
4186
+ if (event.key === "Tab")
4187
+ return;
4184
4188
  //Check if input is enter press
4185
4189
  if (this.IsNoMatch == true && event.key == "Enter" && this.options.AllowNewSelection && key.selected) {
4186
4190
  if (!(this.tags.length >= this.options.MaxNumberTags)) {
@@ -4198,7 +4202,7 @@ class TagsInputComponent {
4198
4202
  }
4199
4203
  //Check if input is charachter
4200
4204
  else if (String.fromCharCode(event.keyCode).match(/(\w|\s)/g)) {
4201
- if (this.IsNoMatch == true && this.options.AllowNewSelection == false && key.selected) {
4205
+ if (this.IsNoMatch && !this.options.AllowNewSelection && key.selected) {
4202
4206
  this.TagsFormControl.setErrors({ "errorMassage": this.options.NoResultText });
4203
4207
  this.TagsFormControl.markAsTouched();
4204
4208
  }
@@ -4242,13 +4246,27 @@ class TagsInputComponent {
4242
4246
  onNoOptionsMatch(event) {
4243
4247
  this.IsNoMatch = event;
4244
4248
  }
4249
+ onTagsInputBlur(SearchKey) {
4250
+ if (SearchKey.selected && this.options.AllowNewSelection && this.IsNoMatch && this.tags.length < this.options.MaxNumberTags) {
4251
+ this.tags.push({ name: SearchKey.selected });
4252
+ this.group.get(this.options.Name).setValue(this.tags);
4253
+ this.group.get(this.options.Name).markAllAsTouched();
4254
+ this.group.updateValueAndValidity();
4255
+ if (this.group.get(this.options.Name).valid) {
4256
+ SearchKey.selected = null;
4257
+ return;
4258
+ }
4259
+ else
4260
+ this.tags.pop();
4261
+ }
4262
+ }
4245
4263
  }
4246
4264
  TagsInputComponent.controlContainerstatic = null;
4247
4265
  TagsInputComponent.decorators = [
4248
4266
  { type: Component, args: [{
4249
4267
  // tslint:disable-next-line: component-selector
4250
4268
  selector: 'BBSF-TagsInput',
4251
- 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",
4269
+ 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 <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 (onBlurInput)=\"onTagsInputBlur(SearchKey)\">\r\n </b-tags-input>\r\n <div class=\"text-danger Required-text\" *ngIf=\"(TagsFormControl.invalid && TagsFormControl.touched)\">\r\n {{getErrorValidation(TagsFormControl.errors|keyvalue)}}\r\n </div>\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",
4252
4270
  styles: [".example-form{min-width:150px;max-width:500px;width:100%}.example-full-width{width:100%}.flip_V{transform:scaleY(-1)}\n"]
4253
4271
  },] }
4254
4272
  ];
@@ -5614,10 +5632,13 @@ class FormComponent {
5614
5632
  let submitModel = this.options.GetModelFunction();
5615
5633
  let submittedService = this.options.ServiceSubmitFunction.apply(null, submitModel);
5616
5634
  submittedService.subscribe((result) => {
5617
- let modal = document.getElementsByClassName("modal show");
5618
- if (modal.length > 0) {
5619
- let closeButton = modal[0].querySelector("[data-dismiss='modal']");
5620
- closeButton.click();
5635
+ if (!this.options.DisableModalDismiss) {
5636
+ //Dismiss closest modal of the form only
5637
+ let modal = document.getElementById(this.fromName).closest('.modal.show');
5638
+ if (modal) {
5639
+ let closeButton = modal.querySelector("[data-dismiss='modal']");
5640
+ closeButton.click();
5641
+ }
5621
5642
  }
5622
5643
  if (!this.options.DisableSuccessNotification)
5623
5644
  this.utilityService.notifySuccessMessage();
@@ -7076,7 +7097,6 @@ src="{{(tag.imageURL?tag.imageURL:defaultImageURL)}}" />
7076
7097
 
7077
7098
  <ng-template #withTypeahead>
7078
7099
  <span [ngSwitch]="ViewMode">
7079
-
7080
7100
  <span *ngSwitchCase="tagInputViewEnum.WithImage">
7081
7101
  <input *ngIf="(options !== null)" class="tags-input__input-field" type="text" [placeholder]="getPlaceholder()"
7082
7102
  name="tags" (keydown.backspace)="removeLastTag(tagInput)" [(ngModel)]="selected" [typeahead]="options"
@@ -7085,6 +7105,7 @@ src="{{(tag.imageURL?tag.imageURL:defaultImageURL)}}" />
7085
7105
  [typeaheadScrollable]="scrollableOptions" [typeaheadLatinize]="true"
7086
7106
  [typeaheadItemTemplate]="itemTemplateWithImage" [typeaheadOptionsInScrollableView]="scrollableOptionsInView"
7087
7107
  [disabled]="!canAddTags || maximumOfTagsReached()" [hidden]="!canAddTags || maximumOfTagsReached()"
7108
+ (blur)="onBlur()" autocomplete="off"
7088
7109
  #tagInput />
7089
7110
  </span>
7090
7111
 
@@ -7097,6 +7118,7 @@ src="{{(tag.imageURL?tag.imageURL:defaultImageURL)}}" />
7097
7118
  [typeaheadItemTemplate]="itemTemplateWithoutImage"
7098
7119
  [typeaheadOptionsInScrollableView]="scrollableOptionsInView"
7099
7120
  [disabled]="!canAddTags || maximumOfTagsReached()" [hidden]="!canAddTags || maximumOfTagsReached()"
7121
+ (blur)="onBlur()" autocomplete="off"
7100
7122
  #tagInput />
7101
7123
  </span>
7102
7124
 
@@ -7109,6 +7131,7 @@ src="{{(tag.imageURL?tag.imageURL:defaultImageURL)}}" />
7109
7131
  [typeaheadItemTemplate]="itemTemplateWithoutInitial"
7110
7132
  [typeaheadOptionsInScrollableView]="scrollableOptionsInView"
7111
7133
  [disabled]="!canAddTags || maximumOfTagsReached()" [hidden]="!canAddTags || maximumOfTagsReached()"
7134
+ (blur)="onBlur()" autocomplete="off"
7112
7135
  #tagInput />
7113
7136
  </span>
7114
7137
 
@@ -7121,6 +7144,7 @@ src="{{(tag.imageURL?tag.imageURL:defaultImageURL)}}" />
7121
7144
  [typeaheadItemTemplate]="itemTemplateWithoutImage"
7122
7145
  [typeaheadOptionsInScrollableView]="scrollableOptionsInView"
7123
7146
  [disabled]="!canAddTags || maximumOfTagsReached()" [hidden]="!canAddTags || maximumOfTagsReached()"
7147
+ (blur)="onBlur()" autocomplete="off"
7124
7148
  #tagInput />
7125
7149
  </span>
7126
7150
 
@@ -7223,6 +7247,13 @@ class BTagsInputComponent {
7223
7247
  this.onTagsChanged = new EventEmitter();
7224
7248
  this.onMaxTagsReached = new EventEmitter();
7225
7249
  this.onNoOptionsMatch = new EventEmitter();
7250
+ this.onBlurInput = new EventEmitter();
7251
+ // (keydown.Tab) = "onTab($event)"
7252
+ //onTab(event) {
7253
+ // this.onTabInput.emit();
7254
+ // event.preventDefault();
7255
+ // event.stopPropagation();
7256
+ //}
7226
7257
  }
7227
7258
  getPlaceholder() {
7228
7259
  if (this.tags && this.tags.length > 0) {
@@ -7310,7 +7341,6 @@ class BTagsInputComponent {
7310
7341
  this.onTouchedCallback = fn;
7311
7342
  }
7312
7343
  calculateInitials(name) {
7313
- debugger;
7314
7344
  var fullName = name.split(' ');
7315
7345
  var initials = "";
7316
7346
  if (fullName.length > 1)
@@ -7319,6 +7349,9 @@ class BTagsInputComponent {
7319
7349
  initials = fullName.shift().charAt(0);
7320
7350
  return initials.toUpperCase();
7321
7351
  }
7352
+ onBlur() {
7353
+ this.onBlurInput.emit();
7354
+ }
7322
7355
  }
7323
7356
  BTagsInputComponent.decorators = [
7324
7357
  { type: Component, args: [{
@@ -7343,7 +7376,8 @@ BTagsInputComponent.propDecorators = {
7343
7376
  scrollableOptionsInView: [{ type: Input }],
7344
7377
  onTagsChanged: [{ type: Output }],
7345
7378
  onMaxTagsReached: [{ type: Output }],
7346
- onNoOptionsMatch: [{ type: Output }]
7379
+ onNoOptionsMatch: [{ type: Output }],
7380
+ onBlurInput: [{ type: Output }]
7347
7381
  };
7348
7382
 
7349
7383
  let options;
@@ -7787,6 +7821,8 @@ class FormOptions {
7787
7821
  this.DisableErrorNotification = false;
7788
7822
  //If ="true" disable startblockui before submission
7789
7823
  this.DisableBlockUI = false;
7824
+ //If ="true" disable modal from dismiss automatically
7825
+ this.DisableModalDismiss = false;
7790
7826
  }
7791
7827
  }
7792
7828