@bnsights/bbsf-controls 1.0.56 → 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.
- package/README.md +9 -0
- package/bnsights-bbsf-controls-1.0.58.tgz +0 -0
- package/bnsights-bbsf-controls.metadata.json +1 -1
- package/bundles/bnsights-bbsf-controls.umd.js +66 -29
- package/bundles/bnsights-bbsf-controls.umd.js.map +1 -1
- package/esm2015/lib/Shared/components/ng-tag-input.js +5 -2
- package/esm2015/lib/controls/Repeater/repeater-table/repeater-table.component.js +7 -4
- package/esm2015/lib/controls/TagsInput/TagsInput.component.js +47 -15
- package/fesm2015/bnsights-bbsf-controls.js +55 -18
- package/fesm2015/bnsights-bbsf-controls.js.map +1 -1
- package/lib/controls/TagsInput/TagsInput.component.d.ts +6 -3
- package/package.json +1 -1
- package/bnsights-bbsf-controls-1.0.55.tgz +0 -0
- package/bnsights-bbsf-controls-1.0.56.tgz +0 -0
|
@@ -4488,14 +4488,14 @@
|
|
|
4488
4488
|
TagsInputComponent.controlContainerstatic = this.controlContainer;
|
|
4489
4489
|
}
|
|
4490
4490
|
TagsInputComponent.showErrorOfInputs = function (errors) {
|
|
4491
|
-
var e_1,
|
|
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
|
|
4498
|
-
var iterator =
|
|
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,13 +4504,17 @@
|
|
|
4504
4504
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
4505
4505
|
finally {
|
|
4506
4506
|
try {
|
|
4507
|
-
if (
|
|
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
|
}
|
|
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) {
|
|
@@ -4581,6 +4596,9 @@
|
|
|
4581
4596
|
this.controlUtility.CopyInputMessage(inputElement);
|
|
4582
4597
|
};
|
|
4583
4598
|
TagsInputComponent.prototype.searchFunctionFactory = function (Text) {
|
|
4599
|
+
//If no text then return empty observable
|
|
4600
|
+
if (!Text)
|
|
4601
|
+
return rxjs.EMPTY;
|
|
4584
4602
|
var Url = this.options.ActionURL + "?" + this.options.QueryParamName + "=" + encodeURIComponent(Text) + "&" + this.options.SelectedItemsParamName + "=" + this.SelectedId;
|
|
4585
4603
|
if (this.options.ExtraFilters)
|
|
4586
4604
|
Url = Url + ("&" + this.options.ExtraFilters);
|
|
@@ -4591,17 +4609,9 @@
|
|
|
4591
4609
|
return Model;
|
|
4592
4610
|
};
|
|
4593
4611
|
TagsInputComponent.prototype.AddTag = function (event, key) {
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
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;
|
|
4603
|
-
}
|
|
4604
|
-
else if (this.IsNoMatch == true && event == "Enter" && this.options.AllowNewSelection && key.selected) {
|
|
4612
|
+
var _a, _b;
|
|
4613
|
+
//Check if input is enter press
|
|
4614
|
+
if (this.IsNoMatch == true && event.key == "Enter" && this.options.AllowNewSelection && key.selected) {
|
|
4605
4615
|
if (!(this.tags.length >= this.options.MaxNumberTags)) {
|
|
4606
4616
|
this.tags.push({ name: key.selected });
|
|
4607
4617
|
this.group.get(this.options.Name).setValue(this.tags);
|
|
@@ -4615,6 +4625,26 @@
|
|
|
4615
4625
|
this.tags.pop();
|
|
4616
4626
|
}
|
|
4617
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
|
+
}
|
|
4639
|
+
//Remove unmatched error incase of deleting search value
|
|
4640
|
+
else if (event.key === "Backspace" && ((_a = key.selected) === null || _a === void 0 ? void 0 : _a.length) <= 1 && this.TagsFormControl.hasError('errorMassage')) {
|
|
4641
|
+
this.TagsFormControl.setErrors({ "errorMassage": null });
|
|
4642
|
+
this.TagsFormControl.updateValueAndValidity();
|
|
4643
|
+
if (((_b = this.SelectedId) === null || _b === void 0 ? void 0 : _b.length) == 0 && this.options.IsRequired) {
|
|
4644
|
+
this.TagsFormControl.setErrors({ required: "" });
|
|
4645
|
+
this.TagsFormControl.markAsTouched();
|
|
4646
|
+
}
|
|
4647
|
+
}
|
|
4618
4648
|
};
|
|
4619
4649
|
TagsInputComponent.prototype.onTagsChanged = function (result) {
|
|
4620
4650
|
//console.log(this.tags)
|
|
@@ -4648,7 +4678,7 @@
|
|
|
4648
4678
|
{ type: i0.Component, args: [{
|
|
4649
4679
|
// tslint:disable-next-line: component-selector
|
|
4650
4680
|
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
|
|
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",
|
|
4652
4682
|
styles: [".example-form{min-width:150px;max-width:500px;width:100%}.example-full-width{width:100%}.flip_V{transform:scaleY(-1)}\n"]
|
|
4653
4683
|
},] }
|
|
4654
4684
|
];
|
|
@@ -4665,7 +4695,8 @@
|
|
|
4665
4695
|
TagsInputComponent.propDecorators = {
|
|
4666
4696
|
group: [{ type: i0.Input }],
|
|
4667
4697
|
options: [{ type: i0.Input }],
|
|
4668
|
-
OnChange: [{ type: i0.Output }]
|
|
4698
|
+
OnChange: [{ type: i0.Output }],
|
|
4699
|
+
SearchKey: [{ type: i0.ViewChild, args: ['SearchKey', { static: false },] }]
|
|
4669
4700
|
};
|
|
4670
4701
|
|
|
4671
4702
|
var PagingDTO = /** @class */ (function () {
|
|
@@ -7374,7 +7405,7 @@
|
|
|
7374
7405
|
if (this.options.RepeaterValue.length > 0) {
|
|
7375
7406
|
this.originalItems = this.options.RepeaterValue;
|
|
7376
7407
|
for (var index = 0; index < this.options.RepeaterValue.length; index++) {
|
|
7377
|
-
this.items.push(index
|
|
7408
|
+
this.items.push(index);
|
|
7378
7409
|
}
|
|
7379
7410
|
}
|
|
7380
7411
|
else
|
|
@@ -7453,14 +7484,17 @@
|
|
|
7453
7484
|
this.items = this.items.filter(function (res) { return res != _this.items[Index]; });
|
|
7454
7485
|
};
|
|
7455
7486
|
RepeaterTableComponent.prototype.addItem = function () {
|
|
7456
|
-
|
|
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);
|
|
7457
7491
|
};
|
|
7458
7492
|
return RepeaterTableComponent;
|
|
7459
7493
|
}());
|
|
7460
7494
|
RepeaterTableComponent.decorators = [
|
|
7461
7495
|
{ type: i0.Component, args: [{
|
|
7462
7496
|
selector: 'BBSF-repeater-table',
|
|
7463
|
-
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)
|
|
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>"
|
|
7464
7498
|
},] }
|
|
7465
7499
|
];
|
|
7466
7500
|
RepeaterTableComponent.ctorParameters = function () { return [
|
|
@@ -7565,7 +7599,8 @@
|
|
|
7565
7599
|
}
|
|
7566
7600
|
};
|
|
7567
7601
|
BTagsInputComponent.prototype.removeLastTag = function (tagInput) {
|
|
7568
|
-
|
|
7602
|
+
var _a;
|
|
7603
|
+
if (!this.removeLastOnBackspace || !((_a = this.tags) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
7569
7604
|
return;
|
|
7570
7605
|
}
|
|
7571
7606
|
if (tagInput.value === '') {
|
|
@@ -7573,16 +7608,18 @@
|
|
|
7573
7608
|
}
|
|
7574
7609
|
};
|
|
7575
7610
|
BTagsInputComponent.prototype.addTag = function (tagInput) {
|
|
7576
|
-
var
|
|
7611
|
+
var _b;
|
|
7577
7612
|
if (tagInput.value.trim() !== '') {
|
|
7578
|
-
var tag = (
|
|
7579
|
-
|
|
7580
|
-
|
|
7613
|
+
var tag = (_b = {},
|
|
7614
|
+
_b[this.displayField] = tagInput.value,
|
|
7615
|
+
_b);
|
|
7581
7616
|
this.addPredefinedTag(tag);
|
|
7582
7617
|
}
|
|
7583
7618
|
tagInput.value = '';
|
|
7584
7619
|
};
|
|
7585
7620
|
BTagsInputComponent.prototype.addPredefinedTag = function (tag) {
|
|
7621
|
+
if (this.tags == null)
|
|
7622
|
+
this.tags = [];
|
|
7586
7623
|
if (!this.maximumOfTagsReached()) {
|
|
7587
7624
|
this.tags.push(tag);
|
|
7588
7625
|
this.tagsChanged('add', tag);
|
|
@@ -7605,11 +7642,11 @@
|
|
|
7605
7642
|
return this.canDeleteTags;
|
|
7606
7643
|
};
|
|
7607
7644
|
BTagsInputComponent.prototype.typeaheadOnSelect = function (e) {
|
|
7608
|
-
var
|
|
7645
|
+
var _b;
|
|
7609
7646
|
if (typeof e.item === 'string') {
|
|
7610
|
-
this.addPredefinedTag((
|
|
7611
|
-
|
|
7612
|
-
|
|
7647
|
+
this.addPredefinedTag((_b = {},
|
|
7648
|
+
_b[this.displayField] = e.value,
|
|
7649
|
+
_b));
|
|
7613
7650
|
}
|
|
7614
7651
|
else {
|
|
7615
7652
|
this.addPredefinedTag(e.item);
|