@duoduo-oba/ng-devui
Version:
DevUI components based on Angular
1,148 lines (1,116 loc) • 74.4 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/router'), require('ng-devui/i18n')) :
typeof define === 'function' && define.amd ? define('ng-devui/accordion', ['exports', '@angular/core', '@angular/common', '@angular/router', 'ng-devui/i18n'], factory) :
(global = global || self, factory((global['ng-devui'] = global['ng-devui'] || {}, global['ng-devui'].accordion = {}), global.ng.core, global.ng.common, global.ng.router, global['ng-devui'].i18n));
}(this, (function (exports, core, common, router, i18n) { 'use strict';
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
function __decorate(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}
function __param(paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
}
function __metadata(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
}
function __awaiter(thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
function __exportStar(m, exports) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
function __values(o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
}
function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
}
function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
function __spreadArrays() {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
function __await(v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
}
function __asyncGenerator(thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
}
function __asyncDelegator(o) {
var i, p;
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
}
function __asyncValues(o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
}
function __makeTemplateObject(cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
function __importStar(mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result.default = mod;
return result;
}
function __importDefault(mod) {
return (mod && mod.__esModule) ? mod : { default: mod };
}
/**
* @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 core.EventEmitter(); // 可展开菜单展开事件
// 可展开菜单展开事件
this.itemClick = new core.EventEmitter(); // 可点击菜单点击事件
// 可点击菜单点击事件
this.activeItemChange = new core.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: core.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: i18n.I18nService }
]; };
AccordionComponent.propDecorators = {
data: [{ type: core.Input }],
titleKey: [{ type: core.Input }],
loadingKey: [{ type: core.Input }],
childrenKey: [{ type: core.Input }],
disabledKey: [{ type: core.Input }],
activeKey: [{ type: core.Input }],
openKey: [{ type: core.Input }],
menuItemTemplate: [{ type: core.Input }],
itemTemplate: [{ type: core.Input }],
menuToggle: [{ type: core.Output }],
itemClick: [{ type: core.Output }],
activeItemChange: [{ type: core.Output }],
restrictOneOpen: [{ type: core.Input }],
autoOpenActiveMenu: [{ type: core.Input }],
showNoContent: [{ type: core.Input }],
noContentTemplate: [{ type: core.Input }],
loadingTemplate: [{ type: core.Input }],
innerListTemplate: [{ type: core.Input }],
linkType: [{ type: core.Input }],
linkTypeKey: [{ type: core.Input }],
linkKey: [{ type: core.Input }],
linkTargetKey: [{ type: core.Input }],
linkDefaultTarget: [{ type: core.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: core.Input }],
deepth: [{ type: core.Input }],
parent: [{ type: core.Input }],
disabled: [{ type: core.HostBinding, args: ['class.disabled',] }],
title: [{ type: core.HostBinding, args: ['attr.title',] }],
textIndent: [{ type: core.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: core.HostBinding, args: ['class.active',] }],
defaultClasses: [{ type: core.HostBinding, args: ['class.devui-accordion-item-title',] }, { type: core.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: core.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: core.ViewEncapsulation.None
}] }
];
/** @nocollapse */
AccordionItemRouterlinkComponent.ctorParameters = function () { return [
{ type: AccordionComponent },
{ type: router.Router }
]; };
AccordionItemRouterlinkComponent.propDecorators = {
routerLinkActiveDirective: [{ type: core.ViewChild, args: [router.RouterLinkActive, { static: false },] }],
routerLinkActived: [{ type: core.HostBinding, args: ['class.devui-router-active',] }],
onClick: [{ type: core.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: core.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: core.ViewEncapsulation.None
}] }
];
/** @nocollapse */
AccordionMenuComponent.ctorParameters = function () { return [
{ type: AccordionComponent }
]; };
AccordionMenuComponent.propDecorators = {
defaultClasses: [{ type: core.HostBinding, args: ['class.devui-accordion-menu-item',] }],
open: [{ type: core.HostBinding, args: ['class.open',] }],
routerLinkActived: [{ type: core.HostBinding, args: ['class.devui-router-active',] }],
hasActiveChildren: [{ type: core.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 {?}