@energycap/components 0.27.3-ECAPID-377-Implement-Sidebar.20220121-0740 → 0.27.3-ECAPID-377-Nav-Item-Test.20220125-1711
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/bundles/energycap-components.umd.js +22 -4
- package/bundles/energycap-components.umd.js.map +1 -1
- package/bundles/energycap-components.umd.min.js +1 -1
- package/bundles/energycap-components.umd.min.js.map +1 -1
- package/energycap-components.metadata.json +1 -1
- package/esm2015/lib/controls/menu/menu.component.js +21 -4
- package/esm2015/lib/controls/navigation/nav-item-active.directive.js +3 -2
- package/fesm2015/energycap-components.js +22 -4
- package/fesm2015/energycap-components.js.map +1 -1
- package/lib/controls/menu/menu.component.d.ts +10 -0
- package/lib/controls/navigation/nav-item-active.directive.d.ts +6 -1
- package/package.json +1 -1
|
@@ -2653,6 +2653,12 @@
|
|
|
2653
2653
|
* Item currently highlighted by keyboard navigation
|
|
2654
2654
|
*/
|
|
2655
2655
|
this.highlightedItem = null;
|
|
2656
|
+
/**
|
|
2657
|
+
* Tells the menu to maintain the selected/lastSelected item. Turning this off is useful for
|
|
2658
|
+
* action type menus that are displayed on the screen at all times and you do not
|
|
2659
|
+
* want the item to be selected when clicked.
|
|
2660
|
+
*/
|
|
2661
|
+
this.maintainSelectedItem = true;
|
|
2656
2662
|
/**
|
|
2657
2663
|
* Emitted when `selected` is changed. Emits the referenced object.
|
|
2658
2664
|
*
|
|
@@ -2676,6 +2682,10 @@
|
|
|
2676
2682
|
*/
|
|
2677
2683
|
this.lastSelected = null;
|
|
2678
2684
|
}
|
|
2685
|
+
MenuComponent.prototype.onRouterLinkActivated = function (event) {
|
|
2686
|
+
// this.selectItem(event.event, event.item);
|
|
2687
|
+
console.log(event);
|
|
2688
|
+
};
|
|
2679
2689
|
/**
|
|
2680
2690
|
* Sets & displays the interalized template based on
|
|
2681
2691
|
* the set template.
|
|
@@ -2755,8 +2765,14 @@
|
|
|
2755
2765
|
else {
|
|
2756
2766
|
this.onSelection(item);
|
|
2757
2767
|
}
|
|
2758
|
-
this.
|
|
2759
|
-
|
|
2768
|
+
if (this.maintainSelectedItem) {
|
|
2769
|
+
this.selected = item;
|
|
2770
|
+
this.lastSelected = item;
|
|
2771
|
+
}
|
|
2772
|
+
else {
|
|
2773
|
+
this.selected = null;
|
|
2774
|
+
this.lastSelected = null;
|
|
2775
|
+
}
|
|
2760
2776
|
}
|
|
2761
2777
|
};
|
|
2762
2778
|
/**
|
|
@@ -2977,7 +2993,7 @@
|
|
|
2977
2993
|
MenuComponent.decorators = [
|
|
2978
2994
|
{ type: i0.Component, args: [{
|
|
2979
2995
|
selector: 'ec-menu',
|
|
2980
|
-
template: "<nav>\r\n <div class=\"parent\"\r\n [class.no-data]=\"showNoItems && (!items || items.length === 0)\">\r\n <header id=\"{{id}}_header\"\r\n class=\"item-wrapper\"\r\n [class.is-selected]=\"highlightedItemIndex === -1\"\r\n *ngIf=\"parent\"\r\n (click)=\"back($event)\">\r\n <i class=\"ec-icon icon-angle-down rotate-90 flex-shrink\"></i>\r\n <span class=\"label text-truncate flex-grow\">{{parent?.label}}</span>\r\n </header>\r\n\r\n <ul id=\"{{id}}_list\">\r\n <li *ngFor=\"let item of items; index as i\"\r\n id=\"{{item.id || id + '_item' + i}}\"\r\n class=\"{{item.display || 'item'}} {{item.classList}}\"\r\n [attr.disabled]=\"item.disabled\"\r\n [hidden]=\"item.hidden\"\r\n ecNavItemActive=\"is-selected\"\r\n [ecNavItemActiveQueryParams]=\"item.queryParams\"\r\n [ecNavItemActiveUrl]=\"item.url\"\r\n [ecNavItemActiveExactMatch]='item.isActiveExactMatch'\r\n (routerLinkActivated)=\"
|
|
2996
|
+
template: "<nav>\r\n <div class=\"parent\"\r\n [class.no-data]=\"showNoItems && (!items || items.length === 0)\">\r\n <header id=\"{{id}}_header\"\r\n class=\"item-wrapper\"\r\n [class.is-selected]=\"highlightedItemIndex === -1\"\r\n *ngIf=\"parent\"\r\n (click)=\"back($event)\">\r\n <i class=\"ec-icon icon-angle-down rotate-90 flex-shrink\"></i>\r\n <span class=\"label text-truncate flex-grow\">{{parent?.label}}</span>\r\n </header>\r\n\r\n <ul id=\"{{id}}_list\">\r\n <li *ngFor=\"let item of items; index as i\"\r\n id=\"{{item.id || id + '_item' + i}}\"\r\n class=\"{{item.display || 'item'}} {{item.classList}}\"\r\n [attr.disabled]=\"item.disabled\"\r\n [hidden]=\"item.hidden\"\r\n ecNavItemActive=\"is-selected\"\r\n [ecNavItemCurrentItem]=\"item\"\r\n [ecNavItemActiveQueryParams]=\"item.queryParams\"\r\n [ecNavItemActiveUrl]=\"item.url\"\r\n [ecNavItemActiveExactMatch]='item.isActiveExactMatch'\r\n (routerLinkActivated)=\"onRouterLinkActivated($event)\"\r\n [ngClass]=\"{'is-highlighted':(selected === item && item?.display !== 'heading') || highlightedItem === item, 'is-link': item.url, 'is-disabled': item.disabled, 'is-readonly': item.readonly, 'is-checked': item.checked}\"\r\n (click)=\"selectItem($event, item)\">\r\n\r\n <a *ngIf=\"item.url && !item.externalLink\"\r\n id=\"{{item.id}}_link\"\r\n class=\"item-wrapper\"\r\n [routerLink]=\"item.url\"\r\n [queryParams]=\"item.queryParams || null\"\r\n target=\"{{item.target || '_self'}}\">\r\n\r\n <ng-container *ngTemplateOutlet=\"internalizedTemplate; context: {$implicit: item}\"></ng-container>\r\n </a>\r\n\r\n <a *ngIf=\"item.url && item.externalLink\"\r\n id=\"{{item.id}}_link\"\r\n class=\"item-wrapper\"\r\n href=\"{{item.url}}\"\r\n target=\"{{item.target || '_self'}}\">\r\n\r\n <ng-container *ngTemplateOutlet=\"internalizedTemplate; context: {$implicit: item}\"></ng-container>\r\n </a>\r\n\r\n <div *ngIf=\"!item.url\"\r\n class=\"item-wrapper\">\r\n <ng-container *ngTemplateOutlet=\"internalizedTemplate; context: {$implicit: item}\"></ng-container>\r\n </div>\r\n </li>\r\n </ul>\r\n\r\n <p class=\"no-data-message\">{{noDataText | translate}}</p>\r\n </div>\r\n\r\n <!-- Child menu (Rendered to the right) -->\r\n <ec-menu *ngIf=\"selected?.items\"\r\n id=\"{{id}}_child\"\r\n class=\"child\"\r\n [parent]=\"selected\"\r\n [items]=\"selected?.items\"\r\n [showNoItems]=\"true\"\r\n [templateType]=\"templateType\"\r\n [enableKeyNav]=\"true\"\r\n (selectedChanged)=\"onSelection($event)\"\r\n (menuClosed)=\"toggleChildMenu(false)\">\r\n </ec-menu>\r\n</nav>\r\n\r\n<!-- 'label' Item Template -->\r\n<ng-template #label\r\n let-item>\r\n <span id=\"{{item.id}}_label\"\r\n class=\"label\">{{item.label}}</span>\r\n\r\n <i class=\"ec-icon icon-angle-down rotate-270\" *ngIf=\"item?.items\"></i>\r\n</ng-template>\r\n\r\n<!-- 'checkAndLabel' Item Template -->\r\n<ng-template #checkAndLabel\r\n let-item>\r\n\r\n <i class=\"ec-icon icon-check ec-icon-sm\" *ngIf=\"item.display !== 'heading'\"></i>\r\n\r\n <i class=\"ec-icon {{item.icon}} ml-2\" *ngIf=\"item.icon\"></i>\r\n\r\n <span id=\"{{item.id}}_label\"\r\n class=\"label\">{{item.label}}</span>\r\n\r\n <i class=\"ec-icon icon-angle-down rotate-270\" *ngIf=\"item?.items\"></i>\r\n</ng-template>\r\n\r\n<!-- 'iconAndLabel' Item Template -->\r\n<ng-template #iconAndLabel\r\n let-item>\r\n\r\n <i class=\"ec-icon {{item.icon}}\"></i>\r\n\r\n <span id=\"{{item.id}}_label\"\r\n class=\"label\">{{item.label}}</span>\r\n\r\n <i class=\"ec-icon icon-angle-down rotate-270\" *ngIf=\"item?.items\"></i>\r\n</ng-template>",
|
|
2981
2997
|
styles: ["@-webkit-keyframes spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}:host{background-color:#fff;display:block;font-size:.875rem;font-weight:400}:host.open>nav>.child,:host.open>nav>.parent{height:100%;left:0;position:absolute;right:0;top:0;transition:transform .25s ease}:host.open>nav>.parent{transform:translateX(0)}:host.open>nav>.child{transform:translateX(100%)}:host.open-active>nav>.parent{transform:translateX(-100%)}:host.open-active>nav>.child{transform:translateX(0)}:host(.bg-transparent){background-color:transparent}:host-context(.is-always-open){height:100%}:host-context(.is-always-open) .item-wrapper{padding-left:1rem;padding-right:1rem}nav{height:100%;overflow:hidden}.parent,nav{display:flex;position:relative}.parent{flex:auto;flex-direction:column;max-width:100%}.parent>header{background-color:#dee2e4;color:rgba(26,26,35,.66);cursor:pointer}.parent>header.is-highlighted,.parent>header.is-selected{background-color:#d9edf2}.parent>header:hover{background-color:#bfe0e9}.parent.no-data ul{display:none}.parent.no-data .no-data-message{display:block}ul{flex:auto;height:100%;list-style:none;margin:0;overflow-y:auto;padding:0}ul li{cursor:pointer}ul li.is-highlighted,ul li.is-selected{background-color:#d9edf2}ul li:hover{background-color:#bfe0e9}ul li:focus{background-color:rgba(26,26,35,.38);outline:none}ul li:active{background-color:#0084a9;color:#fff}ul li.is-disabled,ul li:disabled{color:rgba(26,26,35,.66);cursor:default;opacity:.65}ul li a{border-bottom:0;color:inherit;text-decoration:none}ul li.heading{background-color:#dee2e4;color:rgba(26,26,35,.66)}ul li.heading .item-wrapper{cursor:default}ul li.divider{border-bottom:1px solid #d2d7d9}ul li.is-disabled,ul li.is-readonly{background-color:transparent;color:inherit;cursor:default}ul li.is-checked .icon-check{opacity:1}.item-wrapper{color:inherit;cursor:inherit;display:flex;line-height:1.25rem;min-height:1.75rem;padding:.25rem .5rem}.item-wrapper .label{margin-right:auto}.item-wrapper .label+.ec-icon{margin-left:.5rem}.item-wrapper .ec-icon{flex:none;margin-top:.125rem}.item-wrapper .ec-icon+.label{margin-left:.5rem}.item-wrapper .ec-icon-sm{margin-top:.25rem}.item-wrapper .icon-check{opacity:0}.no-data-message{color:rgba(26,26,35,.38);display:none;font-size:1rem;margin-bottom:0;padding:1rem;text-align:center}:host-context(ec-tree) ul{overflow-x:hidden}:host-context(ec-tree) li{white-space:nowrap}:host-context(ec-tree) li.is-highlighted,:host-context(ec-tree) li.is-selected{font-weight:700}:host-context(ec-tree) li.is-highlighted:not(:hover),:host-context(ec-tree) li.is-selected:not(:hover){background-color:transparent}"]
|
|
2982
2998
|
},] }
|
|
2983
2999
|
];
|
|
@@ -3000,6 +3016,7 @@
|
|
|
3000
3016
|
noDataText: [{ type: i0.Input }],
|
|
3001
3017
|
enableKeyNav: [{ type: i0.Input }],
|
|
3002
3018
|
highlightedItem: [{ type: i0.Input }],
|
|
3019
|
+
maintainSelectedItem: [{ type: i0.Input }],
|
|
3003
3020
|
selectedChanged: [{ type: i0.Output }],
|
|
3004
3021
|
menuClosed: [{ type: i0.Output }],
|
|
3005
3022
|
labelTemplate: [{ type: i0.ViewChild, args: ['label', { static: true },] }],
|
|
@@ -3806,7 +3823,7 @@
|
|
|
3806
3823
|
if (this._url && this.classValue) {
|
|
3807
3824
|
if (this.router.isActive(this._url, this._exact)) {
|
|
3808
3825
|
this.renderer.addClass(this.el.nativeElement, this.classValue);
|
|
3809
|
-
this.routerLinkActivated.emit(new Event('routerLinkActivated'));
|
|
3826
|
+
this.routerLinkActivated.emit({ event: new Event('routerLinkActivated'), item: this.currentItem });
|
|
3810
3827
|
}
|
|
3811
3828
|
else {
|
|
3812
3829
|
this.renderer.removeClass(this.el.nativeElement, this.classValue);
|
|
@@ -3830,6 +3847,7 @@
|
|
|
3830
3847
|
classValue: [{ type: i0.Input, args: ['ecNavItemActive',] }],
|
|
3831
3848
|
exact: [{ type: i0.Input, args: ['ecNavItemActiveExactMatch',] }],
|
|
3832
3849
|
queryParams: [{ type: i0.Input, args: ['ecNavItemActiveQueryParams',] }],
|
|
3850
|
+
currentItem: [{ type: i0.Input, args: ['ecNavItemCurrentItem',] }],
|
|
3833
3851
|
url: [{ type: i0.Input, args: ['ecNavItemActiveUrl',] }],
|
|
3834
3852
|
routerLinkActivated: [{ type: i0.Output }]
|
|
3835
3853
|
};
|