@ohayojp.com/components
Version:
Common business components of ohayojp.
203 lines (196 loc) • 6.87 kB
JavaScript
import { Component, ChangeDetectionStrategy, ViewEncapsulation, Input, ChangeDetectorRef, ContentChildren, NgModule } from '@angular/core';
import { __decorate, __metadata } from 'tslib';
import { InputNumber } from '@ohayojp.com/util';
import { CommonModule } from '@angular/common';
import { NzAvatarModule } from 'ng-zorro-antd/avatar';
import { NzToolTipModule } from 'ng-zorro-antd/tooltip';
/**
* @fileoverview added by tsickle
* Generated from: avatar-list-item.component.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class AvatarListItemComponent {
}
AvatarListItemComponent.decorators = [
{
type: Component, args: [{
selector: 'avatar-list-item, [avatar-list-item]',
exportAs: 'avatarListItem',
template: `<ng-content></ng-content>`,
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None
}]
}
];
AvatarListItemComponent.propDecorators = {
src: [{ type: Input }],
text: [{ type: Input }],
icon: [{ type: Input }],
tips: [{ type: Input }]
};
if (false) {
/** @type {?} */
AvatarListItemComponent.prototype.src;
/** @type {?} */
AvatarListItemComponent.prototype.text;
/** @type {?} */
AvatarListItemComponent.prototype.icon;
/** @type {?} */
AvatarListItemComponent.prototype.tips;
}
/**
* @fileoverview added by tsickle
* Generated from: avatar-list.component.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class AvatarListComponent {
/**
* @param {?} cdr
*/
constructor(cdr) {
this.cdr = cdr;
this.inited = false;
this.items = [];
this.exceedCount = 0;
this.cls = '';
this.avatarSize = '';
this.maxLength = 0;
}
/**
* @param {?} value
* @return {?}
*/
set size(value) {
this.cls = 'avatar-list__item' + (value === 'default' ? '' : ` avatar-list__${value}`);
switch (value) {
case 'large':
case 'small':
case 'default':
this.avatarSize = value;
break;
default:
this.avatarSize = 'small';
break;
}
}
/**
* @private
* @return {?}
*/
gen() {
const { _items } = this;
/** @type {?} */
const maxLength = this.maxLength > 0 ? this.maxLength : _items.length;
/** @type {?} */
const numOfChildren = _items.length;
/** @type {?} */
const numToShow = maxLength > 0 && maxLength >= numOfChildren ? numOfChildren : maxLength;
this.items = _items.toArray().slice(0, numToShow);
this.exceedCount = numToShow < numOfChildren ? numOfChildren - maxLength : 0;
this.cdr.detectChanges();
}
/**
* @return {?}
*/
ngAfterViewInit() {
this.gen();
this.inited = true;
}
/**
* @return {?}
*/
ngOnChanges() {
if (this.inited) {
this.gen();
}
}
}
AvatarListComponent.decorators = [
{
type: Component, args: [{
selector: 'avatar-list',
exportAs: 'avatarList',
template: "<ul class=\"avatar-list__wrap\">\n <li *ngFor=\"let i of items\" [ngClass]=\"cls\">\n <nz-avatar *ngIf=\"i.tips\" nz-tooltip [nzTooltipTitle]=\"i.tips\" [nzSrc]=\"i.src\" [nzText]=\"i.text\" [nzIcon]=\"i.icon\" [nzSize]=\"avatarSize\"></nz-avatar>\n <nz-avatar *ngIf=\"!i.tips\" [nzSrc]=\"i.src\" [nzText]=\"i.text\" [nzIcon]=\"i.icon\" [nzSize]=\"avatarSize\"></nz-avatar>\n </li>\n <li *ngIf=\"exceedCount > 0\" [ngClass]=\"cls\">\n <nz-avatar [nzSize]=\"avatarSize\" style=\"cursor: auto;\" [ngStyle]=\"excessItemsStyle\" [nzText]=\"'+' + exceedCount\"></nz-avatar>\n </li>\n</ul>\n",
host: { '[class.avatar-list]': 'true' },
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None
}]
}
];
/** @nocollapse */
AvatarListComponent.ctorParameters = () => [
{ type: ChangeDetectorRef }
];
AvatarListComponent.propDecorators = {
_items: [{ type: ContentChildren, args: [AvatarListItemComponent, { descendants: false },] }],
size: [{ type: Input }],
maxLength: [{ type: Input }],
excessItemsStyle: [{ type: Input }]
};
__decorate([
InputNumber(),
__metadata("design:type", Object)
], AvatarListComponent.prototype, "maxLength", void 0);
if (false) {
/** @type {?} */
AvatarListComponent.ngAcceptInputType_maxLength;
/**
* @type {?}
* @private
*/
AvatarListComponent.prototype.inited;
/**
* @type {?}
* @private
*/
AvatarListComponent.prototype._items;
/** @type {?} */
AvatarListComponent.prototype.items;
/** @type {?} */
AvatarListComponent.prototype.exceedCount;
/** @type {?} */
AvatarListComponent.prototype.cls;
/** @type {?} */
AvatarListComponent.prototype.avatarSize;
/** @type {?} */
AvatarListComponent.prototype.maxLength;
/** @type {?} */
AvatarListComponent.prototype.excessItemsStyle;
/**
* @type {?}
* @private
*/
AvatarListComponent.prototype.cdr;
}
/**
* @fileoverview added by tsickle
* Generated from: avatar-list.module.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
const COMPONENTS = [AvatarListComponent, AvatarListItemComponent];
class AvatarListModule {
}
AvatarListModule.decorators = [
{
type: NgModule, args: [{
imports: [CommonModule, NzAvatarModule, NzToolTipModule],
declarations: [...COMPONENTS],
exports: [...COMPONENTS],
},]
}
];
/**
* @fileoverview added by tsickle
* Generated from: public_api.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* Generated from: avatarList.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
export { AvatarListComponent, AvatarListItemComponent, AvatarListModule };
//# sourceMappingURL=avatarList.js.map