@sebgroup/green-angular 2.0.1 → 2.0.3
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/esm2020/lib/context-menu/context-menu.component.mjs +3 -3
- package/esm2020/lib/dropdown/dropdown.component.mjs +16 -10
- package/fesm2015/sebgroup-green-angular.mjs +13 -10
- package/fesm2015/sebgroup-green-angular.mjs.map +1 -1
- package/fesm2020/sebgroup-green-angular.mjs +16 -10
- package/fesm2020/sebgroup-green-angular.mjs.map +1 -1
- package/lib/dropdown/dropdown.component.d.ts +6 -5
- package/package.json +3 -3
|
@@ -407,10 +407,10 @@ class NggContextMenuComponent {
|
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
409
|
NggContextMenuComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NggContextMenuComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: ON_SCROLL_TOKEN, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
410
|
-
NggContextMenuComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: NggContextMenuComponent, selector: "ngg-context-menu", inputs: { direction: "direction", menuItems: "menuItems", menuItemTemplate: "menuItemTemplate", menuAnchorTemplate: "menuAnchorTemplate", closeOnScroll: "closeOnScroll" }, outputs: { contextMenuItemClicked: "contextMenuItemClicked" }, host: { listeners: { "document:click": "onDocumentClick($event.target)" } }, viewQueries: [{ propertyName: "popover", first: true, predicate: ["contextMenuPopover"], descendants: true }, { propertyName: "anchor", first: true, predicate: ["contextMenuAnchor"], descendants: true }], ngImport: i0, template: "<button\n #contextMenuAnchor\n class=\"ghost small px-3\"\n [class.active]=\"isActive\"\n (click)=\"open()\"\n>\n <ng-container\n [ngTemplateOutlet]=\"menuAnchorTemplate ?? defaultButtonTemplate\"\n >\n </ng-container>\n</button>\n\n<div class=\"context-menu-overlay\">\n <div\n class=\"popover popover-context-menu\"\n [class.active]=\"isActive\"\n [style.top]=\"top\"\n [style.left]=\"left\"\n #contextMenuPopover\n >\n <ul role=\"listbox\">\n <li\n *ngFor=\"let menuItem of menuItems\"\n (click)=\"onItemClick(menuItem)\"\n tabindex=\"0\"\n (keydown)=\"onMenuItemKeyDown($event, menuItem)\"\n >\n <ng-container\n [ngTemplateOutlet]=\"menuItemTemplate ?? defaultMenuItemTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"\n >\n </ng-container>\n </li>\n </ul>\n </div>\n</div>\n\n<ng-template #defaultMenuItemTemplate let-menuItem>\n <span>{{ menuItem.label }}</span>\n</ng-template>\n\n<ng-template #defaultButtonTemplate>\n <i class=\"sg-icon sg-icon-ellipsis\">Open context menu</i>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
410
|
+
NggContextMenuComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: NggContextMenuComponent, selector: "ngg-context-menu", inputs: { direction: "direction", menuItems: "menuItems", menuItemTemplate: "menuItemTemplate", menuAnchorTemplate: "menuAnchorTemplate", closeOnScroll: "closeOnScroll" }, outputs: { contextMenuItemClicked: "contextMenuItemClicked" }, host: { listeners: { "document:click": "onDocumentClick($event.target)" } }, viewQueries: [{ propertyName: "popover", first: true, predicate: ["contextMenuPopover"], descendants: true }, { propertyName: "anchor", first: true, predicate: ["contextMenuAnchor"], descendants: true }], ngImport: i0, template: "<button\n #contextMenuAnchor\n class=\"ghost small px-3 border-0\"\n [class.active]=\"isActive\"\n (click)=\"open()\"\n>\n <ng-container\n [ngTemplateOutlet]=\"menuAnchorTemplate ?? defaultButtonTemplate\"\n >\n </ng-container>\n</button>\n\n<div class=\"context-menu-overlay\">\n <div\n class=\"popover popover-context-menu\"\n [class.active]=\"isActive\"\n [style.top]=\"top\"\n [style.left]=\"left\"\n #contextMenuPopover\n >\n <ul role=\"listbox\">\n <li\n *ngFor=\"let menuItem of menuItems\"\n (click)=\"onItemClick(menuItem)\"\n tabindex=\"0\"\n (keydown)=\"onMenuItemKeyDown($event, menuItem)\"\n >\n <ng-container\n [ngTemplateOutlet]=\"menuItemTemplate ?? defaultMenuItemTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"\n >\n </ng-container>\n </li>\n </ul>\n </div>\n</div>\n\n<ng-template #defaultMenuItemTemplate let-menuItem>\n <span>{{ menuItem.label }}</span>\n</ng-template>\n\n<ng-template #defaultButtonTemplate>\n <i class=\"sg-icon sg-icon-ellipsis\">Open context menu</i>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
411
411
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NggContextMenuComponent, decorators: [{
|
|
412
412
|
type: Component,
|
|
413
|
-
args: [{ selector: 'ngg-context-menu', template: "<button\n #contextMenuAnchor\n class=\"ghost small px-3\"\n [class.active]=\"isActive\"\n (click)=\"open()\"\n>\n <ng-container\n [ngTemplateOutlet]=\"menuAnchorTemplate ?? defaultButtonTemplate\"\n >\n </ng-container>\n</button>\n\n<div class=\"context-menu-overlay\">\n <div\n class=\"popover popover-context-menu\"\n [class.active]=\"isActive\"\n [style.top]=\"top\"\n [style.left]=\"left\"\n #contextMenuPopover\n >\n <ul role=\"listbox\">\n <li\n *ngFor=\"let menuItem of menuItems\"\n (click)=\"onItemClick(menuItem)\"\n tabindex=\"0\"\n (keydown)=\"onMenuItemKeyDown($event, menuItem)\"\n >\n <ng-container\n [ngTemplateOutlet]=\"menuItemTemplate ?? defaultMenuItemTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"\n >\n </ng-container>\n </li>\n </ul>\n </div>\n</div>\n\n<ng-template #defaultMenuItemTemplate let-menuItem>\n <span>{{ menuItem.label }}</span>\n</ng-template>\n\n<ng-template #defaultButtonTemplate>\n <i class=\"sg-icon sg-icon-ellipsis\">Open context menu</i>\n</ng-template>\n" }]
|
|
413
|
+
args: [{ selector: 'ngg-context-menu', template: "<button\n #contextMenuAnchor\n class=\"ghost small px-3 border-0\"\n [class.active]=\"isActive\"\n (click)=\"open()\"\n>\n <ng-container\n [ngTemplateOutlet]=\"menuAnchorTemplate ?? defaultButtonTemplate\"\n >\n </ng-container>\n</button>\n\n<div class=\"context-menu-overlay\">\n <div\n class=\"popover popover-context-menu\"\n [class.active]=\"isActive\"\n [style.top]=\"top\"\n [style.left]=\"left\"\n #contextMenuPopover\n >\n <ul role=\"listbox\">\n <li\n *ngFor=\"let menuItem of menuItems\"\n (click)=\"onItemClick(menuItem)\"\n tabindex=\"0\"\n (keydown)=\"onMenuItemKeyDown($event, menuItem)\"\n >\n <ng-container\n [ngTemplateOutlet]=\"menuItemTemplate ?? defaultMenuItemTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: menuItem }\"\n >\n </ng-container>\n </li>\n </ul>\n </div>\n</div>\n\n<ng-template #defaultMenuItemTemplate let-menuItem>\n <span>{{ menuItem.label }}</span>\n</ng-template>\n\n<ng-template #defaultButtonTemplate>\n <i class=\"sg-icon sg-icon-ellipsis\">Open context menu</i>\n</ng-template>\n" }]
|
|
414
414
|
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i2.Subject, decorators: [{
|
|
415
415
|
type: Optional
|
|
416
416
|
}, {
|
|
@@ -511,8 +511,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
511
511
|
}] });
|
|
512
512
|
|
|
513
513
|
class NggDropdownComponent {
|
|
514
|
-
constructor(injector) {
|
|
514
|
+
constructor(injector, _cdr) {
|
|
515
515
|
this.injector = injector;
|
|
516
|
+
this._cdr = _cdr;
|
|
516
517
|
this.loop = false;
|
|
517
518
|
this.display = 'label';
|
|
518
519
|
this.useValue = 'value';
|
|
@@ -526,10 +527,11 @@ class NggDropdownComponent {
|
|
|
526
527
|
this._value = target.value;
|
|
527
528
|
this.texts = {
|
|
528
529
|
...this.texts,
|
|
529
|
-
select: this.
|
|
530
|
+
select: this.displayTextByValue(this._value),
|
|
530
531
|
};
|
|
531
532
|
this.onChangeFn?.(this.value);
|
|
532
533
|
this.valueChange.emit(this.value);
|
|
534
|
+
this._cdr.detectChanges();
|
|
533
535
|
};
|
|
534
536
|
// These adapter functions are used to maintain backwards compatibility with the old interface
|
|
535
537
|
this.compareWithAdapter = (o1, o2) => {
|
|
@@ -545,7 +547,7 @@ class NggDropdownComponent {
|
|
|
545
547
|
this.optionByValue = (value) => {
|
|
546
548
|
return this.options?.find((o) => o[this.useValue] === value);
|
|
547
549
|
};
|
|
548
|
-
this.
|
|
550
|
+
this.displayTextByValue = (value) => {
|
|
549
551
|
if (!Array.isArray(value))
|
|
550
552
|
return (this.optionByValue(value)?.[this.display] ||
|
|
551
553
|
(this.texts?.placeholder ?? 'Select'));
|
|
@@ -577,7 +579,7 @@ class NggDropdownComponent {
|
|
|
577
579
|
this._value = newValue;
|
|
578
580
|
this.texts = {
|
|
579
581
|
...this.texts,
|
|
580
|
-
select: this.
|
|
582
|
+
select: this.displayTextByValue(this._value),
|
|
581
583
|
};
|
|
582
584
|
}
|
|
583
585
|
get value() {
|
|
@@ -592,7 +594,7 @@ class NggDropdownComponent {
|
|
|
592
594
|
get control() {
|
|
593
595
|
return this.injector.get(NgControl);
|
|
594
596
|
}
|
|
595
|
-
|
|
597
|
+
ngOnInit() {
|
|
596
598
|
if (!this._value) {
|
|
597
599
|
if (this.multiSelect)
|
|
598
600
|
this._value = this.options
|
|
@@ -600,6 +602,10 @@ class NggDropdownComponent {
|
|
|
600
602
|
?.map((o) => o[this.useValue]);
|
|
601
603
|
else
|
|
602
604
|
this._value = this.options?.find((o) => o.selected === true)?.[this.useValue];
|
|
605
|
+
this.texts = {
|
|
606
|
+
...this.texts,
|
|
607
|
+
select: this.displayTextByValue(this._value),
|
|
608
|
+
};
|
|
603
609
|
}
|
|
604
610
|
this.texts = {
|
|
605
611
|
close: this.texts?.close ?? 'Close',
|
|
@@ -607,7 +613,7 @@ class NggDropdownComponent {
|
|
|
607
613
|
placeholder: this.texts?.placeholder ?? 'Select',
|
|
608
614
|
searchPlaceholder: this.texts?.searchPlaceholder ?? 'Search',
|
|
609
615
|
selected: this.texts?.selected ?? 'selected',
|
|
610
|
-
select: this.
|
|
616
|
+
select: this.displayTextByValue(this._value),
|
|
611
617
|
};
|
|
612
618
|
}
|
|
613
619
|
writeValue(value) {
|
|
@@ -623,7 +629,7 @@ class NggDropdownComponent {
|
|
|
623
629
|
return (value === '' || value === 'true' || value.toString() === 'true' || false);
|
|
624
630
|
}
|
|
625
631
|
}
|
|
626
|
-
NggDropdownComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NggDropdownComponent, deps: [{ token: Injector }], target: i0.ɵɵFactoryTarget.Component });
|
|
632
|
+
NggDropdownComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NggDropdownComponent, deps: [{ token: Injector }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
627
633
|
NggDropdownComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: NggDropdownComponent, selector: "ngg-dropdown", inputs: { id: "id", texts: "texts", loop: "loop", display: "display", useValue: "useValue", label: "label", options: "options", valid: "valid", invalid: "invalid", compareWith: "compareWith", searchFilter: "searchFilter", fixedPlacement: "fixedPlacement", multiSelect: "multiSelect", searchable: "searchable", value: "value" }, outputs: { valueChange: "valueChange", touched: "touched" }, providers: [
|
|
628
634
|
{
|
|
629
635
|
provide: NG_VALUE_ACCESSOR,
|
|
@@ -643,7 +649,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
643
649
|
}], ctorParameters: function () { return [{ type: i0.Injector, decorators: [{
|
|
644
650
|
type: Inject,
|
|
645
651
|
args: [Injector]
|
|
646
|
-
}] }]; }, propDecorators: { id: [{
|
|
652
|
+
}] }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { id: [{
|
|
647
653
|
type: Input
|
|
648
654
|
}], texts: [{
|
|
649
655
|
type: Input
|