UNPKG

ng-zorro-antd

Version:

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

1 lines 9.48 kB
{"version":3,"file":"ng-zorro-antd-comment.mjs","sources":["../../components/comment/comment-cells.ts","../../components/comment/comment.component.ts","../../components/comment/comment.module.ts","../../components/comment/public-api.ts","../../components/comment/ng-zorro-antd-comment.ts"],"sourcesContent":["/**\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nimport { CdkPortalOutlet, TemplatePortal } from '@angular/cdk/portal';\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component,\n ComponentFactoryResolver,\n Directive,\n Input,\n OnDestroy,\n OnInit,\n TemplateRef,\n ViewChild,\n ViewContainerRef,\n ViewEncapsulation\n} from '@angular/core';\n\n@Directive({\n selector: 'nz-avatar[nz-comment-avatar]',\n exportAs: 'nzCommentAvatar'\n})\nexport class NzCommentAvatarDirective {}\n\n@Directive({\n selector: 'nz-comment-content, [nz-comment-content]',\n exportAs: 'nzCommentContent',\n host: { class: 'ant-comment-content-detail' }\n})\nexport class NzCommentContentDirective {}\n\n@Directive({\n selector: '[nzCommentActionHost]',\n exportAs: 'nzCommentActionHost'\n})\nexport class NzCommentActionHostDirective extends CdkPortalOutlet implements OnInit, OnDestroy, AfterViewInit {\n @Input() nzCommentActionHost?: TemplatePortal | null;\n\n constructor(componentFactoryResolver: ComponentFactoryResolver, viewContainerRef: ViewContainerRef) {\n super(componentFactoryResolver, viewContainerRef);\n }\n\n override ngOnInit(): void {\n super.ngOnInit();\n }\n\n override ngOnDestroy(): void {\n super.ngOnDestroy();\n }\n\n ngAfterViewInit(): void {\n this.attach(this.nzCommentActionHost);\n }\n}\n\n@Component({\n selector: 'nz-comment-action',\n exportAs: 'nzCommentAction',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: '<ng-template><ng-content></ng-content></ng-template>'\n})\nexport class NzCommentActionComponent implements OnInit {\n @ViewChild(TemplateRef, { static: true }) implicitContent!: TemplateRef<void>;\n private contentPortal: TemplatePortal | null = null;\n\n get content(): TemplatePortal | null {\n return this.contentPortal;\n }\n\n constructor(private viewContainerRef: ViewContainerRef) {}\n\n ngOnInit(): void {\n this.contentPortal = new TemplatePortal(this.implicitContent, this.viewContainerRef);\n }\n}\n","/**\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nimport { Direction, Directionality } from '@angular/cdk/bidi';\nimport {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ContentChildren,\n Input,\n OnDestroy,\n OnInit,\n Optional,\n QueryList,\n TemplateRef,\n ViewEncapsulation\n} from '@angular/core';\nimport { Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport { NzCommentActionComponent as CommentAction } from './comment-cells';\n\n@Component({\n selector: 'nz-comment',\n exportAs: 'nzComment',\n template: `\n <div class=\"ant-comment-inner\">\n <div class=\"ant-comment-avatar\">\n <ng-content select=\"nz-avatar[nz-comment-avatar]\"></ng-content>\n </div>\n <div class=\"ant-comment-content\">\n <div class=\"ant-comment-content-author\">\n <span *ngIf=\"nzAuthor\" class=\"ant-comment-content-author-name\">\n <ng-container *nzStringTemplateOutlet=\"nzAuthor\">{{ nzAuthor }}</ng-container>\n </span>\n <span *ngIf=\"nzDatetime\" class=\"ant-comment-content-author-time\">\n <ng-container *nzStringTemplateOutlet=\"nzDatetime\">{{ nzDatetime }}</ng-container>\n </span>\n </div>\n <ng-content select=\"nz-comment-content\"></ng-content>\n <ul class=\"ant-comment-actions\" *ngIf=\"actions?.length\">\n <li *ngFor=\"let action of actions\">\n <span><ng-template [nzCommentActionHost]=\"action.content\"></ng-template></span>\n </li>\n </ul>\n </div>\n </div>\n <div class=\"ant-comment-nested\">\n <ng-content></ng-content>\n </div>\n `,\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[class.ant-comment]': `true`,\n '[class.ant-comment-rtl]': `dir === \"rtl\"`\n }\n})\nexport class NzCommentComponent implements OnDestroy, OnInit {\n @Input() nzAuthor?: string | TemplateRef<void>;\n @Input() nzDatetime?: string | TemplateRef<void>;\n dir: Direction = 'ltr';\n\n private destroy$ = new Subject<void>();\n\n @ContentChildren(CommentAction) actions!: QueryList<CommentAction>;\n constructor(private cdr: ChangeDetectorRef, @Optional() private directionality: Directionality) {}\n\n ngOnInit(): void {\n this.directionality.change?.pipe(takeUntil(this.destroy$)).subscribe((direction: Direction) => {\n this.dir = direction;\n this.cdr.detectChanges();\n });\n\n this.dir = this.directionality.value;\n }\n\n ngOnDestroy(): void {\n this.destroy$.next();\n this.destroy$.complete();\n }\n}\n","/**\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nimport { BidiModule } from '@angular/cdk/bidi';\nimport { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\n\nimport { NzOutletModule } from 'ng-zorro-antd/core/outlet';\n\nimport {\n NzCommentActionComponent,\n NzCommentActionHostDirective,\n NzCommentAvatarDirective,\n NzCommentContentDirective\n} from './comment-cells';\nimport { NzCommentComponent } from './comment.component';\n\nconst NZ_COMMENT_CELLS = [\n NzCommentAvatarDirective,\n NzCommentContentDirective,\n NzCommentActionComponent,\n NzCommentActionHostDirective\n];\n\n@NgModule({\n imports: [BidiModule, CommonModule, NzOutletModule],\n exports: [NzCommentComponent, ...NZ_COMMENT_CELLS],\n declarations: [NzCommentComponent, ...NZ_COMMENT_CELLS]\n})\nexport class NzCommentModule {}\n","/**\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nexport * from './comment.module';\nexport * from './comment.component';\nexport * from './comment-cells';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public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