UNPKG

ng-zorro-antd

Version:

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

159 lines (152 loc) 5.78 kB
import { CommonModule } from '@angular/common'; import { Directive, ComponentFactoryResolver, ViewContainerRef, Input, Component, ViewEncapsulation, ChangeDetectionStrategy, ViewChild, TemplateRef, ContentChildren, NgModule } from '@angular/core'; import { NzOutletModule } from 'ng-zorro-antd/core/outlet'; import { CdkPortalOutlet, TemplatePortal } from '@angular/cdk/portal'; /** * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ class NzCommentAvatarDirective { } NzCommentAvatarDirective.decorators = [ { type: Directive, args: [{ selector: 'nz-avatar[nz-comment-avatar]', exportAs: 'nzCommentAvatar' },] } ]; class NzCommentContentDirective { } NzCommentContentDirective.decorators = [ { type: Directive, args: [{ selector: 'nz-comment-content, [nz-comment-content]', exportAs: 'nzCommentContent', host: { class: 'ant-comment-content-detail' } },] } ]; class NzCommentActionHostDirective extends CdkPortalOutlet { constructor(componentFactoryResolver, viewContainerRef) { super(componentFactoryResolver, viewContainerRef); } ngOnInit() { super.ngOnInit(); } ngOnDestroy() { super.ngOnDestroy(); } ngAfterViewInit() { this.attach(this.nzCommentActionHost); } } NzCommentActionHostDirective.decorators = [ { type: Directive, args: [{ selector: '[nzCommentActionHost]', exportAs: 'nzCommentActionHost' },] } ]; NzCommentActionHostDirective.ctorParameters = () => [ { type: ComponentFactoryResolver }, { type: ViewContainerRef } ]; NzCommentActionHostDirective.propDecorators = { nzCommentActionHost: [{ type: Input }] }; class NzCommentActionComponent { constructor(viewContainerRef) { this.viewContainerRef = viewContainerRef; this.contentPortal = null; } get content() { return this.contentPortal; } ngOnInit() { this.contentPortal = new TemplatePortal(this.implicitContent, this.viewContainerRef); } } NzCommentActionComponent.decorators = [ { type: Component, args: [{ selector: 'nz-comment-action', exportAs: 'nzCommentAction', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: '<ng-template><ng-content></ng-content></ng-template>' },] } ]; NzCommentActionComponent.ctorParameters = () => [ { type: ViewContainerRef } ]; NzCommentActionComponent.propDecorators = { implicitContent: [{ type: ViewChild, args: [TemplateRef, { static: true },] }] }; /** * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ class NzCommentComponent { constructor() { } } NzCommentComponent.decorators = [ { type: Component, args: [{ selector: 'nz-comment', exportAs: 'nzComment', template: ` <div class="ant-comment-inner"> <div class="ant-comment-avatar"> <ng-content select="nz-avatar[nz-comment-avatar]"></ng-content> </div> <div class="ant-comment-content"> <div class="ant-comment-content-author"> <span *ngIf="nzAuthor" class="ant-comment-content-author-name"> <ng-container *nzStringTemplateOutlet="nzAuthor">{{ nzAuthor }}</ng-container> </span> <span *ngIf="nzDatetime" class="ant-comment-content-author-time"> <ng-container *nzStringTemplateOutlet="nzDatetime">{{ nzDatetime }}</ng-container> </span> </div> <ng-content select="nz-comment-content"></ng-content> <ul class="ant-comment-actions" *ngIf="actions?.length"> <li *ngFor="let action of actions"> <span><ng-template [nzCommentActionHost]="action.content"></ng-template></span> </li> </ul> </div> </div> <div class="ant-comment-nested"> <ng-content></ng-content> </div> `, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'ant-comment' } },] } ]; NzCommentComponent.ctorParameters = () => []; NzCommentComponent.propDecorators = { nzAuthor: [{ type: Input }], nzDatetime: [{ type: Input }], actions: [{ type: ContentChildren, args: [NzCommentActionComponent,] }] }; /** * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ const NZ_COMMENT_CELLS = [NzCommentAvatarDirective, NzCommentContentDirective, NzCommentActionComponent, NzCommentActionHostDirective]; class NzCommentModule { } NzCommentModule.decorators = [ { type: NgModule, args: [{ imports: [CommonModule, NzOutletModule], exports: [NzCommentComponent, ...NZ_COMMENT_CELLS], declarations: [NzCommentComponent, ...NZ_COMMENT_CELLS] },] } ]; /** * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ /** * Generated bundle index. Do not edit. */ export { NzCommentActionComponent, NzCommentActionHostDirective, NzCommentAvatarDirective, NzCommentComponent, NzCommentContentDirective, NzCommentModule }; //# sourceMappingURL=ng-zorro-antd-comment.js.map