@bnsights/bbsf-controls 1.0.57 → 1.0.58

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.
@@ -4511,6 +4511,10 @@
4511
4511
  }
4512
4512
  }
4513
4513
  };
4514
+ TagsInputComponent.prototype.ngOnDestroy = function () {
4515
+ if (this.changeValueSubscription)
4516
+ this.changeValueSubscription.unsubscribe();
4517
+ };
4514
4518
  TagsInputComponent.prototype.ngOnInit = function () {
4515
4519
  var _this = this;
4516
4520
  this.controlValidationService.isCreatedBefor = false;
@@ -4556,6 +4560,17 @@
4556
4560
  _this.group.markAllAsTouched();
4557
4561
  _this.markAllAsTouched = true;
4558
4562
  });
4563
+ //Check for changing in value
4564
+ this.changeValueSubscription = this.TagsFormControl.valueChanges.subscribe(function (c) {
4565
+ var _a;
4566
+ _this.tags = _this.TagsFormControl.value;
4567
+ _this.SelectedId = (_a = _this.tags) === null || _a === void 0 ? void 0 : _a.filter(function (item) { return item.id; }).map(function (item) { return item.id; });
4568
+ if (_this.tags == null) {
4569
+ _this.SearchKey.selected = "";
4570
+ _this.tags = [];
4571
+ _this.TagsFormControl.setValue([]);
4572
+ }
4573
+ });
4559
4574
  };
4560
4575
  TagsInputComponent.prototype.ngAfterViewInit = function () {
4561
4576
  if (this.options.AttributeList != null) {
@@ -4595,19 +4610,8 @@
4595
4610
  };
4596
4611
  TagsInputComponent.prototype.AddTag = function (event, key) {
4597
4612
  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
- }
4608
- }
4609
4613
  //Check if input is enter press
4610
- else if (this.IsNoMatch == true && event.key == "Enter" && this.options.AllowNewSelection && key.selected) {
4614
+ if (this.IsNoMatch == true && event.key == "Enter" && this.options.AllowNewSelection && key.selected) {
4611
4615
  if (!(this.tags.length >= this.options.MaxNumberTags)) {
4612
4616
  this.tags.push({ name: key.selected });
4613
4617
  this.group.get(this.options.Name).setValue(this.tags);
@@ -4621,6 +4625,17 @@
4621
4625
  this.tags.pop();
4622
4626
  }
4623
4627
  }
4628
+ //Check if input is charachter
4629
+ else if (String.fromCharCode(event.keyCode).match(/(\w|\s)/g)) {
4630
+ if (this.IsNoMatch == true && this.options.AllowNewSelection == false && key.selected) {
4631
+ this.TagsFormControl.setErrors({ "errorMassage": this.options.NoResultText });
4632
+ this.TagsFormControl.markAsTouched();
4633
+ }
4634
+ else if (this.IsNoMatch == false && this.options.AllowNewSelection == false) {
4635
+ this.TagsFormControl.clearValidators();
4636
+ this.TagsFormControl.updateValueAndValidity();
4637
+ }
4638
+ }
4624
4639
  //Remove unmatched error incase of deleting search value
4625
4640
  else if (event.key === "Backspace" && ((_a = key.selected) === null || _a === void 0 ? void 0 : _a.length) <= 1 && this.TagsFormControl.hasError('errorMassage')) {
4626
4641
  this.TagsFormControl.setErrors({ "errorMassage": null });
@@ -4663,7 +4678,7 @@
4663
4678
  { type: i0.Component, args: [{
4664
4679
  // tslint:disable-next-line: component-selector
4665
4680
  selector: 'BBSF-TagsInput',
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",
4681
+ 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",
4667
4682
  styles: [".example-form{min-width:150px;max-width:500px;width:100%}.example-full-width{width:100%}.flip_V{transform:scaleY(-1)}\n"]
4668
4683
  },] }
4669
4684
  ];
@@ -4680,7 +4695,8 @@
4680
4695
  TagsInputComponent.propDecorators = {
4681
4696
  group: [{ type: i0.Input }],
4682
4697
  options: [{ type: i0.Input }],
4683
- OnChange: [{ type: i0.Output }]
4698
+ OnChange: [{ type: i0.Output }],
4699
+ SearchKey: [{ type: i0.ViewChild, args: ['SearchKey', { static: false },] }]
4684
4700
  };
4685
4701
 
4686
4702
  var PagingDTO = /** @class */ (function () {
@@ -7389,7 +7405,7 @@
7389
7405
  if (this.options.RepeaterValue.length > 0) {
7390
7406
  this.originalItems = this.options.RepeaterValue;
7391
7407
  for (var index = 0; index < this.options.RepeaterValue.length; index++) {
7392
- this.items.push(index + 1);
7408
+ this.items.push(index);
7393
7409
  }
7394
7410
  }
7395
7411
  else
@@ -7468,14 +7484,17 @@
7468
7484
  this.items = this.items.filter(function (res) { return res != _this.items[Index]; });
7469
7485
  };
7470
7486
  RepeaterTableComponent.prototype.addItem = function () {
7471
- this.items.push(this.items[this.items.length - 1] + 1);
7487
+ if (this.items.length == 0)
7488
+ this.items.push(this.items.length);
7489
+ else
7490
+ this.items.push(this.items[this.items.length - 1] + 1);
7472
7491
  };
7473
7492
  return RepeaterTableComponent;
7474
7493
  }());
7475
7494
  RepeaterTableComponent.decorators = [
7476
7495
  { type: i0.Component, args: [{
7477
7496
  selector: 'BBSF-repeater-table',
7478
- template: "<div class=\"b-control b-repeater-table\">\r\n <table class=\"{{options.RepeaterTableExtraClasses}}\">\r\n <thead>\r\n <tr class=\"{{options.RepeaterTableRowExtraClasses}}\">\r\n <th *ngFor=\"let item of options.RepeaterStructure\" class=\"min-w-150px\">{{item.HeaderTitle}}</th>\r\n <th>{{utilityService.getResourceValue(options.ActionLabelKey)}}</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr *ngFor=\"let item of items ; index as i\">\r\n <td *ngFor=\"let RepeaterField of options.RepeaterStructure ; index as r\">\r\n <repeater-field-builder [RepeaterField]=\"RepeaterField\" [itemNumber]=\"i\"\r\n [itemsValue]=\"originalItems\" [controlNumber]=\"r\" [group]=\"repeaterGroup\">\r\n </repeater-field-builder>\r\n </td>\r\n <td class=\"d-flex align-items-center\">\r\n <button class=\"{{options.DeleteButtonExtraClasses}}\" type=\"button\" (click)=\"deleteItem(i)\"\r\n [disabled]=\"(items.length ==options.MinRequiredItems&&options.IsRequired) ||(originalItems.length-1>=i)\">\r\n <span [innerHTML]=\"options.DeleteButtonText\"></span></button>\r\n </td>\r\n </tr>\r\n </tbody>\r\n <tfoot>\r\n <tr>\r\n <td colspan=\"4\">\r\n <div class=\"row\">\r\n <div class=\"col-md-12 d-grid gap-2\"> \r\n <button class=\"{{options.AddButtonExtraClasses}}\" type=\"button\" (click)=\"addItem()\"><span\r\n [innerHTML]=\"options.AddButtonText\"></span></button>\r\n </div>\r\n </div>\r\n </td>\r\n </tr>\r\n </tfoot>\r\n </table>\r\n</div>"
7497
+ template: "<div class=\"b-control b-repeater-table\">\r\n <table class=\"{{options.RepeaterTableExtraClasses}}\">\r\n <thead>\r\n <tr class=\"{{options.RepeaterTableRowExtraClasses}}\">\r\n <th *ngFor=\"let item of options.RepeaterStructure\" class=\"min-w-150px\">{{item.HeaderTitle}}</th>\r\n <th>{{utilityService.getResourceValue(options.ActionLabelKey)}}</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr *ngFor=\"let item of items ; index as i\">\r\n <td *ngFor=\"let RepeaterField of options.RepeaterStructure ; index as r\">\r\n <repeater-field-builder [RepeaterField]=\"RepeaterField\" [itemNumber]=\"i\"\r\n [itemsValue]=\"originalItems\" [controlNumber]=\"r\" [group]=\"repeaterGroup\">\r\n </repeater-field-builder>\r\n </td>\r\n <td class=\"d-flex align-items-center\">\r\n <button class=\"{{options.DeleteButtonExtraClasses}}\" type=\"button\" (click)=\"deleteItem(i)\"\r\n [disabled]=\"(items.length ==options.MinRequiredItems&&options.IsRequired)\">\r\n <span [innerHTML]=\"options.DeleteButtonText\"></span></button>\r\n </td>\r\n </tr>\r\n </tbody>\r\n <!-- ||(originalItems.length-1>=i -->\r\n <tfoot>\r\n <tr>\r\n <td colspan=\"4\">\r\n <div class=\"row\">\r\n <div class=\"col-md-12 d-grid gap-2\"> \r\n <button class=\"{{options.AddButtonExtraClasses}}\" type=\"button\" (click)=\"addItem()\"><span\r\n [innerHTML]=\"options.AddButtonText\"></span></button>\r\n </div>\r\n </div>\r\n </td>\r\n </tr>\r\n </tfoot>\r\n </table>\r\n</div>"
7479
7498
  },] }
7480
7499
  ];
7481
7500
  RepeaterTableComponent.ctorParameters = function () { return [
@@ -7580,7 +7599,8 @@
7580
7599
  }
7581
7600
  };
7582
7601
  BTagsInputComponent.prototype.removeLastTag = function (tagInput) {
7583
- if (!this.removeLastOnBackspace || !this.tags.length) {
7602
+ var _a;
7603
+ if (!this.removeLastOnBackspace || !((_a = this.tags) === null || _a === void 0 ? void 0 : _a.length)) {
7584
7604
  return;
7585
7605
  }
7586
7606
  if (tagInput.value === '') {
@@ -7588,16 +7608,18 @@
7588
7608
  }
7589
7609
  };
7590
7610
  BTagsInputComponent.prototype.addTag = function (tagInput) {
7591
- var _a;
7611
+ var _b;
7592
7612
  if (tagInput.value.trim() !== '') {
7593
- var tag = (_a = {},
7594
- _a[this.displayField] = tagInput.value,
7595
- _a);
7613
+ var tag = (_b = {},
7614
+ _b[this.displayField] = tagInput.value,
7615
+ _b);
7596
7616
  this.addPredefinedTag(tag);
7597
7617
  }
7598
7618
  tagInput.value = '';
7599
7619
  };
7600
7620
  BTagsInputComponent.prototype.addPredefinedTag = function (tag) {
7621
+ if (this.tags == null)
7622
+ this.tags = [];
7601
7623
  if (!this.maximumOfTagsReached()) {
7602
7624
  this.tags.push(tag);
7603
7625
  this.tagsChanged('add', tag);
@@ -7620,11 +7642,11 @@
7620
7642
  return this.canDeleteTags;
7621
7643
  };
7622
7644
  BTagsInputComponent.prototype.typeaheadOnSelect = function (e) {
7623
- var _a;
7645
+ var _b;
7624
7646
  if (typeof e.item === 'string') {
7625
- this.addPredefinedTag((_a = {},
7626
- _a[this.displayField] = e.value,
7627
- _a));
7647
+ this.addPredefinedTag((_b = {},
7648
+ _b[this.displayField] = e.value,
7649
+ _b));
7628
7650
  }
7629
7651
  else {
7630
7652
  this.addPredefinedTag(e.item);