UNPKG

ng-zorro-antd

Version:

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

1 lines • 9.12 kB
{"version":3,"file":"ng-zorro-antd-comment.mjs","names":[],"sources":["../../components/comment/comment-cells.ts","../../components/comment/comment.component.ts","../../components/comment/comment.module.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 Component,\n Directive,\n inject,\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 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 template: '<ng-template><ng-content /></ng-template>',\n encapsulation: ViewEncapsulation.None\n})\nexport class NzCommentActionComponent implements OnInit {\n @ViewChild(TemplateRef, { static: true }) implicitContent!: TemplateRef<void>;\n private viewContainerRef = inject(ViewContainerRef);\n private contentPortal: TemplatePortal | null = null;\n\n get content(): TemplatePortal | null {\n return this.contentPortal;\n }\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 { Directionality } from '@angular/cdk/bidi';\nimport { Component, ContentChildren, inject, Input, QueryList, TemplateRef, ViewEncapsulation } from '@angular/core';\n\nimport { NzOutletModule } from 'ng-zorro-antd/core/outlet';\n\nimport { NzCommentActionComponent as CommentAction, NzCommentActionHostDirective } 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]\" />\n </div>\n <div class=\"ant-comment-content\">\n <div class=\"ant-comment-content-author\">\n @if (nzAuthor) {\n <span class=\"ant-comment-content-author-name\">\n <ng-container *nzStringTemplateOutlet=\"nzAuthor\">{{ nzAuthor }}</ng-container>\n </span>\n }\n @if (nzDatetime) {\n <span class=\"ant-comment-content-author-time\">\n <ng-container *nzStringTemplateOutlet=\"nzDatetime\">{{ nzDatetime }}</ng-container>\n </span>\n }\n </div>\n <ng-content select=\"nz-comment-content\" />\n @if (actions?.length) {\n <ul class=\"ant-comment-actions\">\n @for (action of actions; track action) {\n <li>\n <span><ng-template [nzCommentActionHost]=\"action.content\" /></span>\n </li>\n }\n </ul>\n }\n </div>\n </div>\n <div class=\"ant-comment-nested\">\n <ng-content />\n </div>\n `,\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class.ant-comment]': `true`,\n '[class.ant-comment-rtl]': `dir() === \"rtl\"`\n },\n imports: [NzOutletModule, NzCommentActionHostDirective]\n})\nexport class NzCommentComponent {\n protected readonly dir = inject(Directionality).valueSignal;\n\n @Input() nzAuthor?: string | TemplateRef<void>;\n @Input() nzDatetime?: string | TemplateRef<void>;\n\n @ContentChildren(CommentAction) actions!: QueryList<CommentAction>;\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 { NgModule } from '@angular/core';\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: [NzCommentComponent, ...NZ_COMMENT_CELLS],\n exports: [NzCommentComponent, ...NZ_COMMENT_CELLS]\n})\nexport class NzCommentModule {}\n"],"mappings":";;;;;;AAwBA,IAAa,2BAAb,MAAa,yBAAwB;CAAxB,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAwB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAxB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAwB,cAAA;EAAA,UAAA;EAAA,UAAA,CAAA,iBAAA;EAAA,UAAA;CAAA,CAAA;;AAAxB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAwB,YAAA,CAAA;EAJpC,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,UAAU;EACX,CAAA;;;AAQD,IAAa,4BAAb,MAAa,0BAAyB;CAAzB,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAyB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAzB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAyB,cAAA;EAAA,UAAA;EAAA,MAAA,EAAA,gBAAA,6BAAA;EAAA,UAAA,CAAA,kBAAA;EAAA,UAAA;CAAA,CAAA;;AAAz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