UNPKG

ng-zorro-antd-yj

Version:

An enterprise-class UI components based on Ant Design and Angular

262 lines 21.3 kB
/** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ import * as tslib_1 from "tslib"; import { ContentChildren, Directive, ElementRef, EventEmitter, Input, Optional, Output, QueryList, SkipSelf } from '@angular/core'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; import { NzUpdateHostClassService } from '../core/services/update-host-class.service'; import { InputBoolean } from '../core/util/convert'; import { NzMenuDropdownService } from '../dropdown/nz-menu-dropdown.service'; import { NzMenuItemDirective } from './nz-menu-item.directive'; import { NzMenuMenuService } from './nz-menu-menu.service'; import { NzMenuService } from './nz-menu.service'; import { NzSubMenuComponent } from './nz-submenu.component'; /** * @param {?} dropService * @param {?} menuService * @return {?} */ export function NzMenuFactory(dropService, menuService) { return dropService ? dropService : menuService; } var NzMenuDirective = /** @class */ (function () { function NzMenuDirective(elementRef, nzMenuService, nzUpdateHostClassService) { this.elementRef = elementRef; this.nzMenuService = nzMenuService; this.nzUpdateHostClassService = nzUpdateHostClassService; this.destroy$ = new Subject(); this.listOfOpenedNzSubMenuComponent = []; this.nzInlineIndent = 24; this.nzTheme = 'light'; this.nzMode = 'vertical'; this.nzInDropDown = false; this.nzInlineCollapsed = false; this.nzSelectable = !this.nzMenuService.isInDropDown; this.nzClick = new EventEmitter(); } /** * @return {?} */ NzMenuDirective.prototype.updateInlineCollapse = /** * @return {?} */ function () { if (this.listOfNzMenuItemDirective) { if (this.nzInlineCollapsed) { this.listOfOpenedNzSubMenuComponent = this.listOfNzSubMenuComponent.filter((/** * @param {?} submenu * @return {?} */ function (submenu) { return submenu.nzOpen; })); this.listOfNzSubMenuComponent.forEach((/** * @param {?} submenu * @return {?} */ function (submenu) { return submenu.setOpenState(false); })); this.nzMode = 'vertical'; } else { this.listOfOpenedNzSubMenuComponent.forEach((/** * @param {?} submenu * @return {?} */ function (submenu) { return submenu.setOpenState(true); })); this.listOfOpenedNzSubMenuComponent = []; this.nzMode = this.cacheMode; } this.nzMenuService.setMode(this.nzMode); } }; /** * @return {?} */ NzMenuDirective.prototype.setClassMap = /** * @return {?} */ function () { var _a; /** @type {?} */ var prefixName = this.nzMenuService.isInDropDown ? 'ant-dropdown-menu' : 'ant-menu'; this.nzUpdateHostClassService.updateHostClass(this.elementRef.nativeElement, (_a = {}, _a["" + prefixName] = true, _a[prefixName + "-root"] = true, _a[prefixName + "-" + this.nzTheme] = true, _a[prefixName + "-" + this.nzMode] = true, _a[prefixName + "-inline-collapsed"] = this.nzInlineCollapsed, _a)); }; /** * @return {?} */ NzMenuDirective.prototype.ngOnInit = /** * @return {?} */ function () { var _this = this; this.setClassMap(); this.nzMenuService.menuItemClick$.pipe(takeUntil(this.destroy$)).subscribe((/** * @param {?} menu * @return {?} */ function (menu) { _this.nzClick.emit(menu); if (_this.nzSelectable) { _this.listOfNzMenuItemDirective.forEach((/** * @param {?} item * @return {?} */ function (item) { return item.setSelectedState(item === menu); })); } })); }; /** * @return {?} */ NzMenuDirective.prototype.ngAfterContentInit = /** * @return {?} */ function () { this.cacheMode = this.nzMode; this.updateInlineCollapse(); }; /** * @param {?} changes * @return {?} */ NzMenuDirective.prototype.ngOnChanges = /** * @param {?} changes * @return {?} */ function (changes) { if (changes.nzInlineCollapsed) { this.updateInlineCollapse(); } if (changes.nzInlineIndent) { this.nzMenuService.setInlineIndent(this.nzInlineIndent); } if (changes.nzInDropDown) { this.nzMenuService.isInDropDown = this.nzInDropDown; } if (changes.nzTheme) { this.nzMenuService.setTheme(this.nzTheme); } if (changes.nzMode) { this.nzMenuService.setMode(this.nzMode); if (!changes.nzMode.isFirstChange() && this.listOfNzSubMenuComponent) { this.listOfNzSubMenuComponent.forEach((/** * @param {?} submenu * @return {?} */ function (submenu) { return submenu.setOpenState(false); })); } } if (changes.nzTheme || changes.nzMode || changes.nzInlineCollapsed) { this.setClassMap(); } }; /** * @return {?} */ NzMenuDirective.prototype.ngOnDestroy = /** * @return {?} */ function () { this.destroy$.next(); this.destroy$.complete(); }; NzMenuDirective.decorators = [ { type: Directive, args: [{ selector: '[nz-menu]', providers: [ NzUpdateHostClassService, NzMenuMenuService, { provide: NzMenuService, useFactory: NzMenuFactory, deps: [[new SkipSelf(), new Optional(), NzMenuDropdownService], NzMenuMenuService] } ] },] } ]; /** @nocollapse */ NzMenuDirective.ctorParameters = function () { return [ { type: ElementRef }, { type: NzMenuService }, { type: NzUpdateHostClassService } ]; }; NzMenuDirective.propDecorators = { listOfNzMenuItemDirective: [{ type: ContentChildren, args: [NzMenuItemDirective, { descendants: true },] }], listOfNzSubMenuComponent: [{ type: ContentChildren, args: [NzSubMenuComponent, { descendants: true },] }], nzInlineIndent: [{ type: Input }], nzTheme: [{ type: Input }], nzMode: [{ type: Input }], nzInDropDown: [{ type: Input }], nzInlineCollapsed: [{ type: Input }], nzSelectable: [{ type: Input }], nzClick: [{ type: Output }] }; tslib_1.__decorate([ InputBoolean(), tslib_1.__metadata("design:type", Object) ], NzMenuDirective.prototype, "nzInDropDown", void 0); tslib_1.__decorate([ InputBoolean(), tslib_1.__metadata("design:type", Object) ], NzMenuDirective.prototype, "nzInlineCollapsed", void 0); tslib_1.__decorate([ InputBoolean(), tslib_1.__metadata("design:type", Object) ], NzMenuDirective.prototype, "nzSelectable", void 0); return NzMenuDirective; }()); export { NzMenuDirective }; if (false) { /** * @type {?} * @private */ NzMenuDirective.prototype.destroy$; /** * @type {?} * @private */ NzMenuDirective.prototype.cacheMode; /** * @type {?} * @private */ NzMenuDirective.prototype.listOfOpenedNzSubMenuComponent; /** @type {?} */ NzMenuDirective.prototype.listOfNzMenuItemDirective; /** @type {?} */ NzMenuDirective.prototype.listOfNzSubMenuComponent; /** @type {?} */ NzMenuDirective.prototype.nzInlineIndent; /** @type {?} */ NzMenuDirective.prototype.nzTheme; /** @type {?} */ NzMenuDirective.prototype.nzMode; /** @type {?} */ NzMenuDirective.prototype.nzInDropDown; /** @type {?} */ NzMenuDirective.prototype.nzInlineCollapsed; /** @type {?} */ NzMenuDirective.prototype.nzSelectable; /** @type {?} */ NzMenuDirective.prototype.nzClick; /** @type {?} */ NzMenuDirective.prototype.elementRef; /** * @type {?} * @private */ NzMenuDirective.prototype.nzMenuService; /** * @type {?} * @private */ NzMenuDirective.prototype.nzUpdateHostClassService; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnotbWVudS5kaXJlY3RpdmUuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9uZy16b3Jyby1hbnRkLXlqLyIsInNvdXJjZXMiOlsibWVudS9uei1tZW51LmRpcmVjdGl2ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLE9BQU8sRUFFTCxlQUFlLEVBQ2YsU0FBUyxFQUNULFVBQVUsRUFDVixZQUFZLEVBQ1osS0FBSyxFQUlMLFFBQVEsRUFDUixNQUFNLEVBQ04sU0FBUyxFQUVULFFBQVEsRUFDVCxNQUFNLGVBQWUsQ0FBQztBQUN2QixPQUFPLEVBQUUsT0FBTyxFQUFFLE1BQU0sTUFBTSxDQUFDO0FBQy9CLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQztBQUMzQyxPQUFPLEVBQUUsd0JBQXdCLEVBQUUsTUFBTSw0Q0FBNEMsQ0FBQztBQUV0RixPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFDcEQsT0FBTyxFQUFFLHFCQUFxQixFQUFFLE1BQU0sc0NBQXNDLENBQUM7QUFDN0UsT0FBTyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFDL0QsT0FBTyxFQUFFLGlCQUFpQixFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFDM0QsT0FBTyxFQUFFLGFBQWEsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQ2xELE9BQ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