UNPKG

@duoduo-oba/ng-devui

Version:

DevUI components based on Angular

1,245 lines (1,234 loc) 58 kB
import { EventEmitter, Component, Input, Output, HostBinding, ViewEncapsulation, ViewChild, HostListener, Optional, Host, SkipSelf, ViewChildren, NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { Router, RouterLinkActive, RouterModule } from '@angular/router'; import { __assign, __spread, __extends } from 'tslib'; import { I18nService } from '@duoduo-oba/ng-devui/i18n'; /** * @fileoverview added by tsickle * Generated from: accordion.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var AccordionComponent = /** @class */ (function () { function AccordionComponent(i18n) { var _this = this; this.i18n = i18n; /* Key值定义, 用于自定义数据结构 */ this.titleKey = 'title'; // 标题的key,item[titleKey]类型为string,为标题显示内容 // 标题的key,item[titleKey]类型为string,为标题显示内容 this.loadingKey = 'loading'; // 子菜单动态加载item[loadingKey]类型为boolean // 子菜单动态加载item[loadingKey]类型为boolean this.childrenKey = 'children'; // 子菜单Key // 子菜单Key this.disabledKey = 'disabled'; // 是否禁用Key // 是否禁用Key this.activeKey = 'active'; // 菜单是否激活/选中 // 菜单是否激活/选中 this.openKey = 'open'; // 菜单是否打开 // 可点击菜单内容条模板 this.menuToggle = new EventEmitter(); // 可展开菜单展开事件 // 可展开菜单展开事件 this.itemClick = new EventEmitter(); // 可点击菜单点击事件 // 可点击菜单点击事件 this.activeItemChange = new EventEmitter(); /** * 高级选项和模板 */ this.restrictOneOpen = false; // 限制一级菜单同时只能打开一个 // 限制一级菜单同时只能打开一个 this.autoOpenActiveMenu = false; // 自动展开活跃菜单 // 自动展开活跃菜单 this.showNoContent = true; // 没有内容的时候是否显示没有数据 // 可折叠菜单内容完全自定义,用做折叠面板 /* 内置路由/链接/动态判断路由或链接类型 */ this.linkType = ''; this.linkTypeKey = 'linkType'; // linkType为'dependOnLinkTypeKey'时指定对象linkType定义区 // linkType为'dependOnLinkTypeKey'时指定对象linkType定义区 this.linkKey = 'link'; // 链接内容的key // 链接内容的key this.linkTargetKey = 'target'; // 链接目标窗口的key // 链接目标窗口的key this.linkDefaultTarget = '_self'; // 不设置target的时候target默认值 // 点击了可点击菜单 this.itemClickFn = (/** * @param {?} itemEvent * @return {?} */ function (itemEvent) { /** @type {?} */ var prevActiveItem = _this.activeItem; _this.activeItemFn(itemEvent.item); _this.itemClick.emit(__assign({}, itemEvent, { prevActiveItem: prevActiveItem })); }); this.linkItemClickFn = (/** * @param {?} itemEvent * @return {?} */ function (itemEvent) { /** @type {?} */ var prevActiveItem = _this.activeItem; _this.activeItem = itemEvent.item; _this.itemClick.emit(__assign({}, itemEvent, { prevActiveItem: prevActiveItem })); }); // 打开或关闭可折叠菜单 this.menuToggleFn = (/** * @param {?} menuEvent * @return {?} */ function (menuEvent) { _this.openMenuFn(menuEvent.item, menuEvent.open); _this.menuToggle.emit(menuEvent); }); } /** * @param {?} changes * @return {?} */ AccordionComponent.prototype.ngOnChanges = /** * @param {?} changes * @return {?} */ function (changes) { if (changes['data']) { this.initActiveItem(); } if (changes['autoOpenActiveMenu']) { if (this.autoOpenActiveMenu && changes['autoOpenActiveMenu'].previousValue === false) { this.cleanOpenData(); } } }; /** * @return {?} */ AccordionComponent.prototype.ngOnInit = /** * @return {?} */ function () { var _this = this; if (this.data) { this.initActiveItem(); } this.i18nCommonText = this.i18n.getI18nText().common; this.i18nSubscription = this.i18n.langChange().subscribe((/** * @param {?} data * @return {?} */ function (data) { _this.i18nCommonText = data.common; })); }; /** * @return {?} */ AccordionComponent.prototype.ngOnDestroy = /** * @return {?} */ function () { if (this.i18nSubscription) { this.i18nSubscription.unsubscribe(); } }; /** * @private * @param {?} arr * @param {?=} childrenKey * @param {?=} includeParent * @param {?=} includeLeaf * @return {?} */ AccordionComponent.prototype.flatten = /** * @private * @param {?} arr * @param {?=} childrenKey * @param {?=} includeParent * @param {?=} includeLeaf * @return {?} */ function (arr, childrenKey, includeParent, includeLeaf) { var _this = this; if (childrenKey === void 0) { childrenKey = 'children'; } if (includeParent === void 0) { includeParent = false; } if (includeLeaf === void 0) { includeLeaf = true; } return arr.reduce((/** * @param {?} acc * @param {?} cur * @return {?} */ function (acc, cur) { /** @type {?} */ var children = cur[childrenKey]; if (children === undefined) { if (includeLeaf) { acc.push(cur); } } else { if (includeParent) { acc.push(cur); } if (Array.isArray(children)) { acc.push.apply(acc, __spread(_this.flatten(children, childrenKey, includeParent))); } } return acc; }), []); }; /** * @private * @return {?} */ AccordionComponent.prototype.cleanOpenData = /** * @private * @return {?} */ function () { var _this = this; this.flatten(this.data, this.childrenKey, true, false).forEach((/** * @param {?} item * @return {?} */ function (item) { return item[_this.openKey] = undefined; })); }; // 默认激活 // 默认激活 /** * @return {?} */ AccordionComponent.prototype.initActiveItem = // 默认激活 /** * @return {?} */ function () { var _this = this; /** @type {?} */ var activeItem = this.flatten(this.data, this.childrenKey) .filter((/** * @param {?} item * @return {?} */ function (item) { return item[_this.activeKey]; })).pop(); if (activeItem) { if (!this.activeItem) { this.activeItemFn(activeItem); } } else { this.activeItem = undefined; } }; // 激活子菜单项并去掉其他子菜单的激活 // 激活子菜单项并去掉其他子菜单的激活 /** * @param {?} item * @return {?} */ AccordionComponent.prototype.activeItemFn = // 激活子菜单项并去掉其他子菜单的激活 /** * @param {?} item * @return {?} */ function (item) { if (this.activeItem && this.activeItem[this.activeKey]) { this.activeItem[this.activeKey] = false; } item[this.activeKey] = true; this.activeItem = item; this.activeItemChange.emit(this.activeItem); }; // 打开或关闭一级菜单,如果有限制只能展开一项则关闭其他一级菜单 // 打开或关闭一级菜单,如果有限制只能展开一项则关闭其他一级菜单 /** * @param {?} item * @param {?} open * @return {?} */ AccordionComponent.prototype.openMenuFn = // 打开或关闭一级菜单,如果有限制只能展开一项则关闭其他一级菜单 /** * @param {?} item * @param {?} open * @return {?} */ function (item, open) { var _this = this; if (open && this.restrictOneOpen) { ((/** @type {?} */ ((this.data)))).forEach((/** * @param {?} itemtemp * @return {?} */ function (itemtemp) { itemtemp[_this.openKey] = false; })); } item[this.openKey] = open; }; AccordionComponent.decorators = [ { type: Component, args: [{ selector: 'd-accordion', template: "<d-accordion-list class=\"devui-accordion-menu devui-scrollbar\" [data]=\"data\" [deepth]=\"0\" [parent]=\"null\"> </d-accordion-list>\r\n", styles: ["@charset \"UTF-8\";:host{display:block}:host ::ng-deep d-accordion-item,:host ::ng-deep d-accordion-item-hreflink,:host ::ng-deep d-accordion-item-routerlink,:host ::ng-deep d-accordion-list,:host ::ng-deep d-accordion-menu{display:block}:host ::ng-deep .devui-accordion-menu{display:block;background:#fff;box-shadow:0 1px 2px 0 rgba(41,48,64,.2);width:100%;overflow-y:auto}:host ::ng-deep .devui-accordion-menu>.devui-accordion-list>.devui-accordion-item>.devui-accordion-item-title,:host ::ng-deep .devui-accordion-menu>.devui-accordion-list>.devui-accordion-item>.devui-accordion-menu-item>.devui-accordion-item-title{font-weight:700}:host ::ng-deep .devui-accordion-menu .devui-over-flow-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host ::ng-deep .devui-accordion-submenu{background:#fff;width:100%}:host ::ng-deep .devui-accordion-item-title{display:block;height:40px;width:100%;padding:0 10px 0 20px;font-weight:400;line-height:40px;color:#252b3a;background:0 0;cursor:pointer}:host ::ng-deep .devui-accordion-item-title.disabled{opacity:.3;cursor:default}:host ::ng-deep .devui-accordion-item-title:not(.disabled):hover{background:#f2f5fc}:host ::ng-deep .devui-accordion-item-title:not(.disabled).active,:host ::ng-deep .devui-accordion-item-title:not(.disabled).devui-router-active{color:#5e7ce0;background:#f2f5fc}:host ::ng-deep .devui-accordion-item-title:not(.disabled).active>a,:host ::ng-deep .devui-accordion-item-title:not(.disabled).devui-router-active>a{color:#5e7ce0}:host ::ng-deep .devui-accordion-item-title>a{text-decoration:none;display:block;width:100%;color:#252b3a}:host ::ng-deep .devui-accordion-item-title>a:hover{color:inherit;text-decoration:none}:host ::ng-deep d-accordion-item-hreflink.devui-accordion-item-title,:host ::ng-deep d-accordion-item-routerlink.devui-accordion-item-title{padding:0}:host ::ng-deep d-accordion-item-hreflink.devui-accordion-item-title>a,:host ::ng-deep d-accordion-item-routerlink.devui-accordion-item-title>a{padding:0 10px 0 20px}:host ::ng-deep .devui-accordion-menu-item>.devui-accordion-item-title{position:relative;padding-right:30px}:host ::ng-deep .devui-accordion-menu-item>.devui-accordion-item-title>.devui-accordion-open-icon{display:inline-block;text-indent:0;pointer-events:none;position:absolute;right:10px;top:12px;width:16px;height:16px;line-height:16px;-webkit-transition:-webkit-transform .3s ease-out;transition:transform .3s ease-out;transition:transform .3s ease-out,-webkit-transform .3s ease-out}:host ::ng-deep .devui-accordion-menu-item>.devui-accordion-item-title>.devui-accordion-open-icon>svg{width:16px;height:16px}:host ::ng-deep .devui-accordion-menu-item>.devui-accordion-item-title>.devui-accordion-open-icon>svg polygon{fill:#252b3a}:host ::ng-deep .devui-accordion-menu-item>.devui-accordion-item-title:not(.open)>.devui-accordion-open-icon{-webkit-transform:rotate(-90deg);transform:rotate(-90deg);-webkit-transform-origin:center;transform-origin:center}:host ::ng-deep .devui-accordion-menu-item>.devui-accordion-item-title.disabled>.devui-accordion-open-icon{opacity:.3}:host ::ng-deep .devui-accordion-menu-item>.devui-accordion-item-title.active{color:#5e7ce0;background:0 0}:host ::ng-deep d-accordion-list.devui-accordion-menu-hidden{display:none}"] }] } ]; /** @nocollapse */ AccordionComponent.ctorParameters = function () { return [ { type: I18nService } ]; }; AccordionComponent.propDecorators = { data: [{ type: Input }], titleKey: [{ type: Input }], loadingKey: [{ type: Input }], childrenKey: [{ type: Input }], disabledKey: [{ type: Input }], activeKey: [{ type: Input }], openKey: [{ type: Input }], menuItemTemplate: [{ type: Input }], itemTemplate: [{ type: Input }], menuToggle: [{ type: Output }], itemClick: [{ type: Output }], activeItemChange: [{ type: Output }], restrictOneOpen: [{ type: Input }], autoOpenActiveMenu: [{ type: Input }], showNoContent: [{ type: Input }], noContentTemplate: [{ type: Input }], loadingTemplate: [{ type: Input }], innerListTemplate: [{ type: Input }], linkType: [{ type: Input }], linkTypeKey: [{ type: Input }], linkKey: [{ type: Input }], linkTargetKey: [{ type: Input }], linkDefaultTarget: [{ type: Input }] }; return AccordionComponent; }()); if (false) { /** @type {?} */ AccordionComponent.prototype.data; /** @type {?} */ AccordionComponent.prototype.titleKey; /** @type {?} */ AccordionComponent.prototype.loadingKey; /** @type {?} */ AccordionComponent.prototype.childrenKey; /** @type {?} */ AccordionComponent.prototype.disabledKey; /** @type {?} */ AccordionComponent.prototype.activeKey; /** @type {?} */ AccordionComponent.prototype.openKey; /** @type {?} */ AccordionComponent.prototype.menuItemTemplate; /** @type {?} */ AccordionComponent.prototype.itemTemplate; /** @type {?} */ AccordionComponent.prototype.menuToggle; /** @type {?} */ AccordionComponent.prototype.itemClick; /** @type {?} */ AccordionComponent.prototype.activeItemChange; /** * 高级选项和模板 * @type {?} */ AccordionComponent.prototype.restrictOneOpen; /** @type {?} */ AccordionComponent.prototype.autoOpenActiveMenu; /** @type {?} */ AccordionComponent.prototype.showNoContent; /** @type {?} */ AccordionComponent.prototype.noContentTemplate; /** @type {?} */ AccordionComponent.prototype.loadingTemplate; /** @type {?} */ AccordionComponent.prototype.innerListTemplate; /** @type {?} */ AccordionComponent.prototype.linkType; /** @type {?} */ AccordionComponent.prototype.linkTypeKey; /** @type {?} */ AccordionComponent.prototype.linkKey; /** @type {?} */ AccordionComponent.prototype.linkTargetKey; /** @type {?} */ AccordionComponent.prototype.linkDefaultTarget; /** @type {?} */ AccordionComponent.prototype.activeItem; /** @type {?} */ AccordionComponent.prototype.i18nCommonText; /** @type {?} */ AccordionComponent.prototype.i18nSubscription; /** @type {?} */ AccordionComponent.prototype.itemClickFn; /** @type {?} */ AccordionComponent.prototype.linkItemClickFn; /** @type {?} */ AccordionComponent.prototype.menuToggleFn; /** * @type {?} * @private */ AccordionComponent.prototype.i18n; } /** * @fileoverview added by tsickle * Generated from: accordion-base-component.class.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @abstract * @template T */ var AccordionBaseComponent = /** @class */ (function () { function AccordionBaseComponent(accordion) { this.accordion = accordion; this.deepth = 0; } Object.defineProperty(AccordionBaseComponent.prototype, "disabled", { get: /** * @return {?} */ function () { return this.item && this.item[this.accordion.disabledKey]; }, enumerable: true, configurable: true }); Object.defineProperty(AccordionBaseComponent.prototype, "title", { get: /** * @return {?} */ function () { return this.item && this.item[this.accordion.titleKey]; }, enumerable: true, configurable: true }); Object.defineProperty(AccordionBaseComponent.prototype, "textIndent", { get: /** * @return {?} */ function () { return this.deepth * 20 + 'px'; }, enumerable: true, configurable: true }); AccordionBaseComponent.propDecorators = { item: [{ type: Input }], deepth: [{ type: Input }], parent: [{ type: Input }], disabled: [{ type: HostBinding, args: ['class.disabled',] }], title: [{ type: HostBinding, args: ['attr.title',] }], textIndent: [{ type: HostBinding, args: ['style.textIndent',] }] }; return AccordionBaseComponent; }()); if (false) { /** @type {?} */ AccordionBaseComponent.prototype.item; /** @type {?} */ AccordionBaseComponent.prototype.deepth; /** @type {?} */ AccordionBaseComponent.prototype.parent; /** * @type {?} * @protected */ AccordionBaseComponent.prototype.accordion; } /** * @fileoverview added by tsickle * Generated from: accordion-base-item-component.class.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @abstract * @template T */ var AccordionBaseItemComponent = /** @class */ (function (_super) { __extends(AccordionBaseItemComponent, _super); function AccordionBaseItemComponent(accordion) { var _this = _super.call(this, accordion) || this; _this.accordion = accordion; _this.defaultClasses = true; return _this; } Object.defineProperty(AccordionBaseItemComponent.prototype, "itemTemplate", { get: /** * @return {?} */ function () { return this.accordion.itemTemplate; }, enumerable: true, configurable: true }); Object.defineProperty(AccordionBaseItemComponent.prototype, "active", { get: /** * @return {?} */ function () { return this.item && this.item[this.accordion.activeKey]; }, enumerable: true, configurable: true }); AccordionBaseItemComponent.propDecorators = { active: [{ type: HostBinding, args: ['class.active',] }], defaultClasses: [{ type: HostBinding, args: ['class.devui-accordion-item-title',] }, { type: HostBinding, args: ['class.devui-over-flow-ellipsis',] }] }; return AccordionBaseItemComponent; }(AccordionBaseComponent)); if (false) { /** @type {?} */ AccordionBaseItemComponent.prototype.defaultClasses; /** * @type {?} * @protected */ AccordionBaseItemComponent.prototype.accordion; } /** * @fileoverview added by tsickle * Generated from: accordion-base-link-component.class.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @abstract */ var /** * @abstract */ AccordionBaseLinkComponent = /** @class */ (function (_super) { __extends(AccordionBaseLinkComponent, _super); function AccordionBaseLinkComponent(accordion) { var _this = _super.call(this, accordion) || this; _this.accordion = accordion; return _this; } Object.defineProperty(AccordionBaseLinkComponent.prototype, "link", { get: /** * @return {?} */ function () { return this.item && this.item[this.accordion.linkKey]; }, enumerable: true, configurable: true }); Object.defineProperty(AccordionBaseLinkComponent.prototype, "target", { get: /** * @return {?} */ function () { return this.item && this.item[this.accordion.linkTargetKey] || this.accordion.linkDefaultTarget; }, enumerable: true, configurable: true }); Object.defineProperty(AccordionBaseLinkComponent.prototype, "linkType", { get: /** * @return {?} */ function () { return this.item && this.item[this.accordion.linkTypeKey] || ''; }, enumerable: true, configurable: true }); return AccordionBaseLinkComponent; }(AccordionBaseItemComponent)); if (false) { /** * @type {?} * @protected */ AccordionBaseLinkComponent.prototype.accordion; } /** * @fileoverview added by tsickle * Generated from: accordion-item-routerlink.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var AccordionItemRouterlinkComponent = /** @class */ (function (_super) { __extends(AccordionItemRouterlinkComponent, _super); function AccordionItemRouterlinkComponent(accordion, router) { var _this = _super.call(this, accordion) || this; _this.accordion = accordion; _this.router = router; return _this; } Object.defineProperty(AccordionItemRouterlinkComponent.prototype, "routerLinkActived", { get: /** * @return {?} */ function () { return !!(this.routerLinkActiveDirective && this.routerLinkActiveDirective.isActive); }, enumerable: true, configurable: true }); /** * @param {?} event * @return {?} */ AccordionItemRouterlinkComponent.prototype.onClick = /** * @param {?} event * @return {?} */ function (event) { if (!this.disabled) { this.accordion.linkItemClickFn({ item: this.item, parent: this.parent, event: event }); } }; AccordionItemRouterlinkComponent.decorators = [ { type: Component, args: [{ selector: 'd-accordion-item-routerlink', template: "<ng-container *ngIf=\"!disabled\">\r\n <a [routerLink]=\"link\" [routerLinkActive]=\"'devui-router-active'\" target=\"{{ target }}\" rel=\"noopener\" title=\"{{ title }}\">\r\n <ng-container *ngIf=\"!itemTemplate\">\r\n {{ title }}\r\n </ng-container>\r\n <ng-template\r\n *ngIf=\"itemTemplate\"\r\n [ngTemplateOutlet]=\"itemTemplate\"\r\n [ngTemplateOutletContext]=\"{\r\n parent: parent,\r\n item: item,\r\n deepth: deepth\r\n }\"\r\n ></ng-template>\r\n </a>\r\n</ng-container>\r\n<ng-container *ngIf=\"disabled\">\r\n <a title=\"{{ title }}\">\r\n <ng-container *ngIf=\"!itemTemplate\">\r\n {{ title }}\r\n </ng-container>\r\n <ng-template\r\n *ngIf=\"itemTemplate\"\r\n [ngTemplateOutlet]=\"itemTemplate\"\r\n [ngTemplateOutletContext]=\"{\r\n parent: parent,\r\n item: item,\r\n deepth: deepth\r\n }\"\r\n ></ng-template>\r\n </a>\r\n</ng-container>\r\n", encapsulation: ViewEncapsulation.None }] } ]; /** @nocollapse */ AccordionItemRouterlinkComponent.ctorParameters = function () { return [ { type: AccordionComponent }, { type: Router } ]; }; AccordionItemRouterlinkComponent.propDecorators = { routerLinkActiveDirective: [{ type: ViewChild, args: [RouterLinkActive, { static: false },] }], routerLinkActived: [{ type: HostBinding, args: ['class.devui-router-active',] }], onClick: [{ type: HostListener, args: ['click', ['$event'],] }] }; return AccordionItemRouterlinkComponent; }(AccordionBaseLinkComponent)); if (false) { /** @type {?} */ AccordionItemRouterlinkComponent.prototype.routerLinkActiveDirective; /** * @type {?} * @protected */ AccordionItemRouterlinkComponent.prototype.accordion; /** * @type {?} * @private */ AccordionItemRouterlinkComponent.prototype.router; } /** * @fileoverview added by tsickle * Generated from: accordion-menu.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var AccordionMenuComponent = /** @class */ (function (_super) { __extends(AccordionMenuComponent, _super); function AccordionMenuComponent(accordion) { var _this = _super.call(this, accordion) || this; _this.accordion = accordion; _this.defaultClasses = true; return _this; } Object.defineProperty(AccordionMenuComponent.prototype, "menuItemTemplate", { get: /** * @return {?} */ function () { return this.accordion.menuItemTemplate; }, enumerable: true, configurable: true }); Object.defineProperty(AccordionMenuComponent.prototype, "open", { get: /** * @return {?} */ function () { return (this.keyOpen === undefined && this.accordion.autoOpenActiveMenu) ? this.childActived : this.keyOpen; }, enumerable: true, configurable: true }); Object.defineProperty(AccordionMenuComponent.prototype, "keyOpen", { get: /** * @return {?} */ function () { return this.item && this.item[this.accordion.openKey]; }, enumerable: true, configurable: true }); Object.defineProperty(AccordionMenuComponent.prototype, "children", { get: /** * @return {?} */ function () { return this.item && this.item[this.accordion.childrenKey]; }, enumerable: true, configurable: true }); Object.defineProperty(AccordionMenuComponent.prototype, "childActived", { get: /** * @return {?} */ function () { return this.routerLinkActived || this.hasActiveChildren; }, enumerable: true, configurable: true }); Object.defineProperty(AccordionMenuComponent.prototype, "routerLinkActived", { get: /** * @return {?} */ function () { return this.accordionListFromView && this.accordionListFromView.routerLinkActived; }, enumerable: true, configurable: true }); Object.defineProperty(AccordionMenuComponent.prototype, "hasActiveChildren", { get: /** * @return {?} */ function () { return this.accordionListFromView && this.accordionListFromView.hasActiveChildren; }, enumerable: true, configurable: true }); /** * @param {?} event * @return {?} */ AccordionMenuComponent.prototype.toggle = /** * @param {?} event * @return {?} */ function (event) { this.accordion.menuToggleFn({ item: this.item, open: !this.open, parent: this.parent, event: event }); }; AccordionMenuComponent.decorators = [ { type: Component, args: [{ selector: 'd-accordion-menu', template: "<div\r\n class=\"devui-accordion-item-title devui-over-flow-ellipsis\"\r\n [ngClass]=\"{\r\n open: open,\r\n active: childActived,\r\n disabled: disabled\r\n }\"\r\n title=\"{{ title }}\"\r\n (click)=\"!disabled && toggle($event)\"\r\n>\r\n <ng-container *ngIf=\"!menuItemTemplate\">\r\n {{ title }}\r\n </ng-container>\r\n <ng-template\r\n *ngIf=\"menuItemTemplate\"\r\n [ngTemplateOutlet]=\"menuItemTemplate\"\r\n [ngTemplateOutletContext]=\"{\r\n parent: parent,\r\n item: item,\r\n deepth: deepth\r\n }\"\r\n ></ng-template>\r\n <span class=\"devui-accordion-open-icon\">\r\n <svg viewBox=\"0 0 16 16\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\r\n <g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\r\n <polygon points=\"4.5 5 8 8.76923077 11.5 5 13 6.61538462 8 12 3 6.61538462\"></polygon>\r\n </g>\r\n </svg>\r\n </span>\r\n</div>\r\n<d-accordion-list\r\n class=\"devui-accordion-submenu\"\r\n [ngClass]=\"{ 'devui-accordion-menu-hidden': !open }\"\r\n [deepth]=\"deepth + 1\"\r\n [data]=\"children\"\r\n [parent]=\"item\"\r\n>\r\n</d-accordion-list>\r\n", encapsulation: ViewEncapsulation.None }] } ]; /** @nocollapse */ AccordionMenuComponent.ctorParameters = function () { return [ { type: AccordionComponent } ]; }; AccordionMenuComponent.propDecorators = { defaultClasses: [{ type: HostBinding, args: ['class.devui-accordion-menu-item',] }], open: [{ type: HostBinding, args: ['class.open',] }], routerLinkActived: [{ type: HostBinding, args: ['class.devui-router-active',] }], hasActiveChildren: [{ type: HostBinding, args: ['class.devui-has-active-item',] }] }; return AccordionMenuComponent; }(AccordionBaseComponent)); if (false) { /** @type {?} */ AccordionMenuComponent.prototype.defaultClasses; /** @type {?} */ AccordionMenuComponent.prototype.accordionListFromView; /** @type {?} */ AccordionMenuComponent.prototype.accordion; } /** * @fileoverview added by tsickle * Generated from: accordion-list.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var AccordionListComponent = /** @class */ (function () { function AccordionListComponent(parentComponent, accordion) { var _this = this; this.parentComponent = parentComponent; this.accordion = accordion; this.deepth = 0; this.menuToggleItemFn = (/** * @param {?} item * @param {?=} event * @return {?} */ function (item, event) { _this.accordion.menuToggleFn({ item: item, open: !item[_this.accordion.openKey], parent: _this.parent.parent, event: event }); }); this.itemClickItemFn = (/** * @param {?} item * @param {?=} event * @return {?} */ function (item, event) { _this.accordion.itemClickFn({ item: item, parent: _this.parent, event: event }); }); } /** * @return {?} */ AccordionListComponent.prototype.ngOnInit = /** * @return {?} */ function () { var _this = this; if (this.parentComponent) { setTimeout((/** * @return {?} */ function () { _this.parentComponent.accordionListFromView = _this; })); } }; /** * @return {?} */ AccordionListComponent.prototype.ngOnDestroy = /** * @return {?} */ function () { if (this.parentComponent) { this.parentComponent.accordionListFromView = undefined; } }; Object.defineProperty(AccordionListComponent.prototype, "loading", { get: /** * @return {?} */ function () { return this.parent && this.parent[this.accordion.loadingKey]; }, enumerable: true, configurable: true }); Object.defineProperty(AccordionListComponent.prototype, "noContent", { get: /** * @return {?} */ function () { return this.data === undefined || this.data === null || this.data.length === 0; }, enumerable: true, configurable: true }); Object.defineProperty(AccordionListComponent.prototype, "linkTypeKey", { get: /** * @return {?} */ function () { return this.accordion.linkTypeKey; }, enumerable: true, configurable: true }); Object.defineProperty(AccordionListComponent.prototype, "childrenKey", { get: /** * @return {?} */ function () { return this.accordion.childrenKey; }, enumerable: true, configurable: true }); Object.defineProperty(AccordionListComponent.prototype, "activeKey", { get: /** * @return {?} */ function () { return this.accordion.activeKey; }, enumerable: true, configurable: true }); Object.defineProperty(AccordionListComponent.prototype, "itemTemplate", { get: /** * @return {?} */ function () { return this.accordion.itemTemplate; }, enumerable: true, configurable: true }); Object.defineProperty(AccordionListComponent.prototype, "menuItemTemplate", { get: /** * @return {?} */ function () { return this.accordion.menuItemTemplate; }, enumerable: true, configurable: true }); Object.defineProperty(AccordionListComponent.prototype, "innerListTemplate", { get: /** * @return {?} */ function () { return this.accordion.innerListTemplate; }, enumerable: true, configurable: true }); Object.defineProperty(AccordionListComponent.prototype, "loadingTemplate", { get: /** * @return {?} */ function () { return this.accordion.loadingTemplate; }, enumerable: true, configurable: true }); Object.defineProperty(AccordionListComponent.prototype, "noContentTemplate", { get: /** * @return {?} */ function () { return this.accordion.noContentTemplate; }, enumerable: true, configurable: true }); Object.defineProperty(AccordionListComponent.prototype, "linkType", { get: /** * @return {?} */ function () { return this.accordion.linkType; }, enumerable: true, configurable: true }); Object.defineProperty(AccordionListComponent.prototype, "i18nCommonText", { get: /** * @return {?} */ function () { return this.accordion.i18nCommonText; }, enumerable: true, configurable: true }); Object.defineProperty(AccordionListComponent.prototype, "showNoContent", { get: /** * @return {?} */ function () { return this.accordion.showNoContent; }, enumerable: true, configurable: true }); Object.defineProperty(AccordionListComponent.prototype, "linkDefaultTarget", { get: /** * @return {?} */ function () { return this.accordion.linkDefaultTarget; }, enumerable: true, configurable: true }); /** * @private * @param {?} airlc * @return {?} */ AccordionListComponent.prototype.isLinkRouterActive = /** * @private * @param {?} airlc * @return {?} */ function (airlc) { return airlc.routerLinkActived; }; /** * @private * @param {?} amc * @return {?} */ AccordionListComponent.prototype.isMenuRouterActive = /** * @private * @param {?} amc * @return {?} */ function (amc) { return amc.routerLinkActived; }; /** * @private * @param {?} amc * @return {?} */ AccordionListComponent.prototype.isMenuDataActive = /** * @private * @param {?} amc * @return {?} */ function (amc) { return amc.hasActiveChildren; }; /** * @private * @param {?} item * @return {?} */ AccordionListComponent.prototype.isItemDataActive = /** * @private * @param {?} item * @return {?} */ function (item) { return !!item[this.activeKey]; }; /** * @private * @param {?} item * @return {?} */ AccordionListComponent.prototype.isItemData = /** * @private * @param {?} item * @return {?} */ function (item) { return item[this.childrenKey] === undefined; }; Object.defineProperty(AccordionListComponent.prototype, "routerLinkActived", { get: /** * @return {?} */ function () { var _this = this; return (!!this.accordionItemRouterlinkQueryList && this.accordionItemRouterlinkQueryList.some((/** * @param {?} airlc * @return {?} */ function (airlc) { return _this.isLinkRouterActive(airlc); }))) || (!!this.accordionMenuQueryList && this.accordionMenuQueryList.some((/** * @param {?} amc * @return {?} */ function (amc) { return _this.isMenuRouterActive(amc); }))); }, enumerable: true, configurable: true }); Object.defineProperty(AccordionListComponent.prototype, "hasActiveChildren", { get: /** * @return {?} */ function () { var _this = this; return (!!this.accordionMenuQueryList && this.accordionMenuQueryList.some((/** * @param {?} amc * @return {?} */ function (amc) { return _this.isMenuDataActive(amc); }))) || (!!this.data && !!this.data.length && this.data.some((/** * @param {?} item * @return {?} */ function (item) { return _this.isItemData(item) && _this.isItemDataActive(item); }))); }, enumerable: true, configurable: true }); AccordionListComponent.decorators = [ { type: Component, args: [{ selector: 'd-accordion-list', template: "<ul class=\"devui-accordion-list\" *ngIf=\"!innerListTemplate || deepth === 0\">\r\n <li class=\"devui-accordion-item\" *ngFor=\"let item of data\">\r\n <!--\u83DC\u5355\u7C7B\u578B-->\r\n <d-accordion-menu *ngIf=\"item[childrenKey] !== undefined\" [item]=\"item\" [deepth]=\"deepth\" [parent]=\"parent\"></d-accordion-menu>\r\n <!--\u975E\u83DC\u5355\u7C7B\u578B-->\r\n <ng-container *ngIf=\"item[childrenKey] === undefined\">\r\n <!--\u8DEF\u7531\u94FE\u63A5-->\r\n <d-accordion-item-routerlink\r\n *ngIf=\"linkType === 'routerLink'\"\r\n [item]=\"item\"\r\n [deepth]=\"deepth\"\r\n [parent]=\"parent\"\r\n ></d-accordion-item-routerlink>\r\n <!--\u666E\u901A\u94FE\u63A5-->\r\n <d-accordion-item-hreflink\r\n *ngIf=\"linkType === 'hrefLink'\"\r\n [item]=\"item\"\r\n [deepth]=\"deepth\"\r\n [parent]=\"parent\"\r\n ></d-accordion-item-hreflink>\r\n <!--\u52A8\u6001\u94FE\u63A5-->\r\n <ng-container *ngIf=\"linkType === 'dependOnLinkTypeKey'\">\r\n <d-accordion-item-routerlink\r\n *ngIf=\"item[linkTypeKey] === 'routerLink'\"\r\n [item]=\"item\"\r\n [deepth]=\"deepth\"\r\n [parent]=\"parent\"\r\n ></d-accordion-item-routerlink>\r\n <d-accordion-item-hreflink\r\n *ngIf=\"item[linkTypeKey] === 'hrefLink'\"\r\n [item]=\"item\"\r\n [deepth]=\"deepth\"\r\n [parent]=\"parent\"\r\n ></d-accordion-item-hreflink>\r\n <d-accordion-item\r\n *ngIf=\"item[linkTypeKey] !== 'hrefLink' && item[linkTypeKey] !== 'routerLink'\"\r\n [item]=\"item\"\r\n [deepth]=\"deepth\"\r\n [parent]=\"parent\"\r\n ></d-accordion-item>\r\n </ng-container>\r\n <!--\u666E\u901A\u7C7B\u578B-->\r\n <d-accordion-item *ngIf=\"!linkType || linkType === ''\" [item]=\"item\" [deepth]=\"deepth\" [parent]=\"parent\"></d-accordion-item>\r\n </ng-container>\r\n </li>\r\n</ul>\r\n<!--\u5217\u8868\u6A21\u677F-->\r\n<div *ngIf=\"innerListTemplate && deepth !== 0\">\r\n <ng-template\r\n [ngTemplateOutlet]=\"innerListTemplate\"\r\n [ngTemplateOutletContext]=\"{\r\n item: parent,\r\n deepth: deepth,\r\n itemClickFn: itemClickItemFn,\r\n menuToggleFn: menuToggleItemFn\r\n }\"\r\n ></ng-template>\r\n</div>\r\n<!--\u65E0\u6570\u636E/\u52A0\u8F7D\u4E2D\u6A21\u677F-->\r\n<ul *ngIf=\"!innerListTemplate && (loading || (noContent && showNoContent))\">\r\n <!--\u52A0\u8F7D\u4E2D-->\r\n <li *ngIf=\"loading && !loadingTemplate\" class=\"devui-accordion-item\">\r\n <div class=\"devui-accordion-item-title devui-over-flow-ellipsis\" [style.textIndent]=\"deepth * 20 + 'px'\">\r\n {{ i18nCommonText?.loading }}\r\n </div>\r\n </li>\r\n <!--\u81EA\u5B9A\u4E49\u52A0\u8F7D\u4E2D-->\r\n <ng-template\r\n *ngIf=\"loading && loadingTemplate\"\r\n [ngTemplateOutlet]=\"loadingTemplate\"\r\n [ngTemplateOutletContext]=\"{ item: parent, deepth: deepth }\"\r\n ></ng-template>\r\n <!--\u65E0\u6570\u636E-->\r\n <li *ngIf=\"showNoContent && !loading && noContent && !noContentTemplate\" class=\"devui-accordion-item\">\r\n <div class=\"devui-accordion-item-title devui-over-flow-ellipsis disabled\" [style.textIndent]=\"deepth * 20 + 'px'\">\r\n {{ i18nCommonText?.noData }}\r\n </div>\r\n </li>\r\n <!--\u81EA\u5B9A\u4E49\u65E0\u6570\u636E-->\r\n <ng-template\r\n *ngIf=\"showNoContent && !loading && noContent && noContentTemplate\"\r\n [ngTemplateOutlet]=\"noContentTemplate\"\r\n [ngTemplateOutletContext]=\"{ item: parent, deepth: deepth }\"\r\n ></ng-template>\r\n</ul>\r\n", encapsulation: ViewEncapsulation.None }] } ]; /** @nocollapse */ AccordionListComponent.ctorParameters = function () { return [ { type: AccordionMenuComponent, decorators: [{ type: Optional }, { type: Host }, { type: SkipSelf }] }, { type: AccordionComponent } ]; }; AccordionListComponent.propDecorators = { data: [{ type: Input }], deepth: [{ type: Input }], parent: [{ type: Input }], accordionMenuQueryList: [{ type: ViewChildren, args: [AccordionMenuComponent,] }], accordionItemRouterlinkQueryList: [{ type: ViewChildren, args: [AccordionItemRouterlinkComponent,] }] }; return AccordionListComponent; }()); if (false) { /** @type {?} */ AccordionListComponent.prototype.data; /** @type {?} */ AccordionListComponent.prototype.deepth; /** @type {?} */ AccordionListComponent.prototype.parent; /** @type {?} */ AccordionListComponent.prototype.accordionMenuQueryList; /** @type {?} */ AccordionListComponent.prototype.accordionItemRouterlinkQueryList; /** @type {?} */ AccordionListComponent.prototype.menuToggleItemFn; /** @type {?} */ AccordionListComponent.prototype.itemClickItemFn; /** * @type {?} * @private */ AccordionListComponent.prototype.parentComponent; /** * @type {?} * @private */ AccordionListComponent.prototype.accordion; } /** * @fileoverview added by tsickle * Generated from: accordion-item-hreflink.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var AccordionItemHreflinkComponent = /** @class */ (function (_super) { __extends(AccordionItemHreflinkComponent, _super); function AccordionItemHreflinkComponent(accordion) { var _this = _super.call(this, accordion) || this; _this.accordion = accordion; return _this; } /** * @param {?} event * @return {?} */ AccordionItemHreflinkComponent.prototype.onClick = /** * @param {?} event * @return {?} */ function (event) { if (!this.disabled) { this.accordion.linkItemClickFn({ item: this.item, parent: this.parent, event: event }); } }; AccordionItemHreflinkComponent.decorators = [ { type: Component, args: [{ selector: 'd-accordion-item-hreflink', template: "<ng-container *ngIf=\"!disabled\">\r\n <a href=\"{{ link }}\" target=\"{{ target }}\" rel=\"noopener\" title=\"{{ title }}\">\r\n <ng-container *ngIf=\"!itemTemplate\">\r\n {{ title }}\r\n </ng-container>\r\n <ng-template\r\n *ngIf=\"itemTemplate\"\r\n [ngTemplateOutlet]=\"itemTemplate\"\r\n [ngTemplateOutletContext]=\"{\r\n parent: parent,\r\n item: item,\r\n deepth: deepth\r\n }\"\r\n ></ng-template>\r\n </a>\r\n</ng-container>\r\n<ng-container *ngIf=\"disabled\">\r\n <a title=\"{{ title }}\">\r\n <ng-container *ngIf=\"!itemTemplate\">\r\n {{ title }}\r\n </ng-container>\r\n <ng-template\r\n *ngIf=\"itemTemplate\"\r\n [ngTemplateOutlet]=\"itemTemplate\"\r\n [ngTemplateOutletContext]=\"{\r\n parent: parent,\r\n item: item,\r\n deepth: deepth\r\n }\"\r\n ></ng-template>\r\n </a>\r\n</ng-container>\r\n", encapsulation: ViewEncapsulation.None }] } ]; /** @nocollapse */ AccordionItemHreflinkComponent.ctorParameters = function () { return [ { type: AccordionComponent } ]; }; AccordionItemHreflinkComponent.propDecorators = { onClick: [{ type: HostListener, args: ['click', ['$event'],] }] }; return AccordionItemHreflinkComponent; }(AccordionBaseLinkComponent)); if (false) { /** * @type {?} * @protected */ AccordionItemHreflinkComponent.prototype.accordion; } /** * @fileoverview added by tsickle * Generated from: accordion-item.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var AccordionItemComponent = /** @class */ (function (_super) { __extends(AccordionItemComponent, _super); function AccordionItemComponent(accordion) { var _this = _super.call(this, accordion) || this; _this.accordion = accordion; return _this; } /** * @param {?} event * @return {?} */ AccordionItemComponent.prototype.onClick = /** * @param {?} event * @return {?} */ function (event) { if (!this.disabled) { this.accordion.itemClickFn({ item: this.item, parent: this.parent, event: event }); } }; AccordionItemComponent.decorators = [ { type: Component, args: [{ selector: 'd-accordion-item', template: "<ng-container *ngIf=\"!itemTemplate\">\r\n {{ title }}\r\n</ng-container>\r\n<ng-template\r\n *ngIf=\"itemTemplate\"\r\n [ngTemplateOutlet]=\"itemTemplate\"\r\n [ngTemplateOutletContext]=\"{\r\n parent: parent,\r\n item: item,\r\n deepth: deepth\r\n }\"\r\n></ng-template>\r\n", encapsulation: ViewEncapsulation.None }] } ]; /** @nocollapse */ AccordionItemComponent.ctorParameters = function () { return [ { type: AccordionComponent } ]; }; AccordionItemComponent.propDecorators = { onClick: [{ type: HostListener, args: ['click', ['$event'],] }] }; return AccordionItemComponent; }(AccordionBaseItemComponent)); if (false) { /** * @type {?} * @protected */ AccordionItemComponent.prototype.accordion; } /** * @fileoverview added by tsickle * Generated from: accordion.module.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var AccordionModule = /** @class */ (function () { function AccordionModule() { } AccordionModule.decorators = [ { type: NgModule, args: [{ imports: [ CommonModule, RouterModule, ], declarations: [ AccordionComponent, AccordionListComponent, AccordionMenuComponent, AccordionItemComponent, AccordionItemHreflinkComponent, AccordionItemRouterlinkComponent, ], exports: [ AccordionComponent, AccordionListComponent,