UNPKG

fundamental-ngx

Version:

SAP Fiori Fundamentals, implemented in Angular

94 lines 12.9 kB
/** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ import { Component, ContentChildren, HostListener, Input, QueryList } from '@angular/core'; import { ShellbarActionComponent } from './shellbar-action.component'; var ShellbarActionsComponent = /** @class */ (function () { function ShellbarActionsComponent() { this.actionsCollapsed = false; this.showCollapsedProducts = false; } /** * @return {?} */ ShellbarActionsComponent.prototype.onResize = /** * @return {?} */ function () { this.actionsCollapsed = window.innerWidth < 1024; }; /** * @return {?} */ ShellbarActionsComponent.prototype.ngOnInit = /** * @return {?} */ function () { this.onResize(); }; /** * @return {?} */ ShellbarActionsComponent.prototype.ngAfterContentChecked = /** * @return {?} */ function () { var _this = this; this.totalNotifications = 0; this.shellbarActions.forEach((/** * @param {?} action * @return {?} */ function (action) { if (action.notificationCount && typeof action.notificationCount === 'number') { _this.totalNotifications = _this.totalNotifications + action.notificationCount; } })); }; /** * @param {?} event * @return {?} */ ShellbarActionsComponent.prototype.toggleCollapsedProducts = /** * @param {?} event * @return {?} */ function (event) { event.preventDefault(); event.stopPropagation(); this.showCollapsedProducts = !this.showCollapsedProducts; }; ShellbarActionsComponent.decorators = [ { type: Component, args: [{ selector: 'fd-shellbar-actions', template: "<div class=\"fd-shellbar__actions\">\n <div *ngIf=\"actionsCollapsed && shellbarActions.length\"\n class=\"fd-shellbar__action fd-shellbar__action--collapse\">\n <div class=\"fd-shellbar-collapse\">\n <fd-popover [options]=\"{placement: 'bottom-end'}\"\n [focusTrapped]=\"false\">\n <fd-popover-control>\n <div class=\"fd-shellbar-collapse--control\">\n <button class=\"fd-button--shell sap-icon--overflow\"\n aria-label=\"Collapsed Item Menu\">\n <span *ngIf=\"totalNotifications\"\n class=\"fd-counter fd-counter--notification\">{{totalNotifications}}</span>\n </button>\n </div>\n </fd-popover-control>\n <fd-popover-body>\n <fd-menu>\n <ul fd-menu-list\n *ngIf=\"!showCollapsedProducts\">\n <div *ngFor=\"let action of shellbarActions\"\n class=\"fd-menu__addon-before\">\n <span [ngClass]=\"'sap-icon--' + action.glyph\"></span>\n </div>\n <li fd-menu-item\n *ngFor=\"let action of shellbarActions\"\n (click)=\"action.callback($event)\">\n {{action.label}}\n </li>\n <div *ngIf=\"productSwitcher\"\n class=\"fd-menu__addon-before\">\n <span [ngClass]=\"'sap-icon--grid'\"></span>\n </div>\n <li fd-menu-item\n *ngIf=\"productSwitcher\"\n (click)=\"toggleCollapsedProducts($event);\">\n Product Switcher\n </li>\n </ul>\n <ul fd-menu-list\n *ngIf=\"showCollapsedProducts\">\n <li fd-menu-item\n (click)=\"toggleCollapsedProducts($event)\">\n <span class=\"fd-menu__item sap-icon--nav-back\"></span>\n </li>\n <hr>\n <li fd-menu-item\n *ngFor=\"let product of productSwitcher\"\n (click)=\"product.callback($event)\">\n {{product.title}}\n </li>\n </ul>\n </fd-menu>\n </fd-popover-body>\n </fd-popover>\n </div>\n </div>\n <ng-content></ng-content>\n <ng-content select=\"fd-shellbar-action\"></ng-content>\n <ng-container *ngIf=\"user\">\n <div class=\"fd-shellbar__action fd-shellbar__action--show-always\">\n <div class=\"fd-user-menu\">\n <fd-popover [options]=\"{placement: 'bottom-end'}\"\n [focusTrapped]=\"false\">\n <fd-popover-control>\n <div class=\"fd-user-menu__control\">\n <span *ngIf=\"!user.image\"\n class=\"fd-identifier fd-identifier--xs fd-identifier--circle\"\n [ngClass]=\"(user.colorAccent ? 'fd-has-background-color-accent-' + user.colorAccent : '')\">\n {{user.initials}}\n </span>\n <span *ngIf=\"user.image\"\n class=\"fd-identifier fd-identifier--xs fd-identifier--circle fd-identifier--thumbnail\"\n [ngStyle]=\"{'background-image': 'url(' + user.image + ')'}\">\n </span>\n </div>\n </fd-popover-control>\n <fd-popover-body>\n <fd-menu>\n <ul fd-menu-list>\n <li fd-menu-item\n *ngFor=\"let item of userMenu\"\n (click)=\"item.callback($event)\">\n {{item.text}}\n </li>\n </ul>\n </fd-menu>\n </fd-popover-body>\n </fd-popover>\n </div>\n </div>\n </ng-container>\n <ng-container *ngIf=\"productSwitcher\">\n <div class=\"fd-shellbar__action fd-shellbar__action--collapsible\">\n <div class=\"fd-product-switcher\">\n <fd-popover [options]=\"{placement: 'bottom-end'}\"\n [focusTrapped]=\"false\">\n <fd-popover-control>\n <button class=\"fd-button--shell sap-icon--grid\"></button>\n </fd-popover-control>\n <fd-popover-body>\n <div class=\"fd-product-switcher__body\">\n <nav>\n <ul>\n <li *ngFor=\"let product of productSwitcher\"\n (click)=\"product.callback($event)\">\n <span class=\"fd-product-switcher__product-icon\">\n <img [src]=\"product.image\">\n </span>\n <span class=\"fd-product-switcher__product-title\">\n {{product.title}}\n </span>\n </li>\n </ul>\n </nav>\n </div>\n </fd-popover-body>\n </fd-popover>\n </div>\n </div>\n </ng-container>\n</div>" }] } ]; ShellbarActionsComponent.propDecorators = { productSwitcher: [{ type: Input }], user: [{ type: Input }], userMenu: [{ type: Input }], shellbarActions: [{ type: ContentChildren, args: [ShellbarActionComponent,] }], onResize: [{ type: HostListener, args: ['window:resize', [],] }] }; return ShellbarActionsComponent; }()); export { ShellbarActionsComponent }; if (false) { /** @type {?} */ ShellbarActionsComponent.prototype.actionsCollapsed; /** @type {?} */ ShellbarActionsComponent.prototype.showCollapsedProducts; /** @type {?} */ ShellbarActionsComponent.prototype.productSwitcher; /** @type {?} */ ShellbarActionsComponent.prototype.user; /** @type {?} */ ShellbarActionsComponent.prototype.userMenu; /** @type {?} */ ShellbarActionsComponent.prototype.shellbarActions; /** @type {?} */ ShellbarActionsComponent.prototype.totalNotifications; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2hlbGxiYXItYWN0aW9ucy5jb21wb25lbnQuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9mdW5kYW1lbnRhbC1uZ3gvIiwic291cmNlcyI6WyJsaWIvc2hlbGxiYXIvc2hlbGxiYX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