ng-zorro-antd-comment.mjs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. import * as i0 from '@angular/core';
  2. import { Directive, Input, TemplateRef, ViewChild, ChangeDetectionStrategy, ViewEncapsulation, Component, ContentChildren, NgModule } from '@angular/core';
  3. import { CdkPortalOutlet, TemplatePortal } from '@angular/cdk/portal';
  4. import { Subject } from 'rxjs';
  5. import { takeUntil } from 'rxjs/operators';
  6. import * as i2 from 'ng-zorro-antd/core/outlet';
  7. import { NzOutletModule } from 'ng-zorro-antd/core/outlet';
  8. import * as i1 from '@angular/cdk/bidi';
  9. /**
  10. * Use of this source code is governed by an MIT-style license that can be
  11. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  12. */
  13. class NzCommentAvatarDirective {
  14. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCommentAvatarDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
  15. static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.2", type: NzCommentAvatarDirective, isStandalone: true, selector: "nz-avatar[nz-comment-avatar]", exportAs: ["nzCommentAvatar"], ngImport: i0 });
  16. }
  17. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCommentAvatarDirective, decorators: [{
  18. type: Directive,
  19. args: [{
  20. selector: 'nz-avatar[nz-comment-avatar]',
  21. exportAs: 'nzCommentAvatar'
  22. }]
  23. }] });
  24. class NzCommentContentDirective {
  25. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCommentContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
  26. static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.2", type: NzCommentContentDirective, isStandalone: true, selector: "nz-comment-content, [nz-comment-content]", host: { classAttribute: "ant-comment-content-detail" }, exportAs: ["nzCommentContent"], ngImport: i0 });
  27. }
  28. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCommentContentDirective, decorators: [{
  29. type: Directive,
  30. args: [{
  31. selector: 'nz-comment-content, [nz-comment-content]',
  32. exportAs: 'nzCommentContent',
  33. host: { class: 'ant-comment-content-detail' }
  34. }]
  35. }] });
  36. class NzCommentActionHostDirective extends CdkPortalOutlet {
  37. nzCommentActionHost;
  38. constructor(componentFactoryResolver, viewContainerRef) {
  39. super(componentFactoryResolver, viewContainerRef);
  40. }
  41. ngOnInit() {
  42. super.ngOnInit();
  43. }
  44. ngOnDestroy() {
  45. super.ngOnDestroy();
  46. }
  47. ngAfterViewInit() {
  48. this.attach(this.nzCommentActionHost);
  49. }
  50. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCommentActionHostDirective, deps: [{ token: i0.ComponentFactoryResolver }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
  51. static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.2", type: NzCommentActionHostDirective, isStandalone: true, selector: "[nzCommentActionHost]", inputs: { nzCommentActionHost: "nzCommentActionHost" }, exportAs: ["nzCommentActionHost"], usesInheritance: true, ngImport: i0 });
  52. }
  53. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCommentActionHostDirective, decorators: [{
  54. type: Directive,
  55. args: [{
  56. selector: '[nzCommentActionHost]',
  57. exportAs: 'nzCommentActionHost'
  58. }]
  59. }], ctorParameters: () => [{ type: i0.ComponentFactoryResolver }, { type: i0.ViewContainerRef }], propDecorators: { nzCommentActionHost: [{
  60. type: Input
  61. }] } });
  62. class NzCommentActionComponent {
  63. viewContainerRef;
  64. implicitContent;
  65. contentPortal = null;
  66. get content() {
  67. return this.contentPortal;
  68. }
  69. constructor(viewContainerRef) {
  70. this.viewContainerRef = viewContainerRef;
  71. }
  72. ngOnInit() {
  73. this.contentPortal = new TemplatePortal(this.implicitContent, this.viewContainerRef);
  74. }
  75. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCommentActionComponent, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component });
  76. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.2", type: NzCommentActionComponent, isStandalone: true, selector: "nz-comment-action", viewQueries: [{ propertyName: "implicitContent", first: true, predicate: TemplateRef, descendants: true, static: true }], exportAs: ["nzCommentAction"], ngImport: i0, template: '<ng-template><ng-content /></ng-template>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
  77. }
  78. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCommentActionComponent, decorators: [{
  79. type: Component,
  80. args: [{
  81. selector: 'nz-comment-action',
  82. exportAs: 'nzCommentAction',
  83. template: '<ng-template><ng-content /></ng-template>',
  84. encapsulation: ViewEncapsulation.None,
  85. changeDetection: ChangeDetectionStrategy.OnPush
  86. }]
  87. }], ctorParameters: () => [{ type: i0.ViewContainerRef }], propDecorators: { implicitContent: [{
  88. type: ViewChild,
  89. args: [TemplateRef, { static: true }]
  90. }] } });
  91. class NzCommentComponent {
  92. cdr;
  93. directionality;
  94. nzAuthor;
  95. nzDatetime;
  96. dir = 'ltr';
  97. destroy$ = new Subject();
  98. actions;
  99. constructor(cdr, directionality) {
  100. this.cdr = cdr;
  101. this.directionality = directionality;
  102. }
  103. ngOnInit() {
  104. this.directionality.change?.pipe(takeUntil(this.destroy$)).subscribe((direction) => {
  105. this.dir = direction;
  106. this.cdr.detectChanges();
  107. });
  108. this.dir = this.directionality.value;
  109. }
  110. ngOnDestroy() {
  111. this.destroy$.next();
  112. this.destroy$.complete();
  113. }
  114. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCommentComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.Directionality }], target: i0.ɵɵFactoryTarget.Component });
  115. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.2", type: NzCommentComponent, isStandalone: true, selector: "nz-comment", inputs: { nzAuthor: "nzAuthor", nzDatetime: "nzDatetime" }, host: { properties: { "class.ant-comment": "true", "class.ant-comment-rtl": "dir === \"rtl\"" } }, queries: [{ propertyName: "actions", predicate: NzCommentActionComponent }], exportAs: ["nzComment"], ngImport: i0, template: `
  116. <div class="ant-comment-inner">
  117. <div class="ant-comment-avatar">
  118. <ng-content select="nz-avatar[nz-comment-avatar]"></ng-content>
  119. </div>
  120. <div class="ant-comment-content">
  121. <div class="ant-comment-content-author">
  122. @if (nzAuthor) {
  123. <span class="ant-comment-content-author-name">
  124. <ng-container *nzStringTemplateOutlet="nzAuthor">{{ nzAuthor }}</ng-container>
  125. </span>
  126. }
  127. @if (nzDatetime) {
  128. <span class="ant-comment-content-author-time">
  129. <ng-container *nzStringTemplateOutlet="nzDatetime">{{ nzDatetime }}</ng-container>
  130. </span>
  131. }
  132. </div>
  133. <ng-content select="nz-comment-content" />
  134. @if (actions?.length) {
  135. <ul class="ant-comment-actions">
  136. @for (action of actions; track action) {
  137. <li>
  138. <span><ng-template [nzCommentActionHost]="action.content" /></span>
  139. </li>
  140. }
  141. </ul>
  142. }
  143. </div>
  144. </div>
  145. <div class="ant-comment-nested">
  146. <ng-content />
  147. </div>
  148. `, isInline: true, dependencies: [{ kind: "ngmodule", type: NzOutletModule }, { kind: "directive", type: i2.NzStringTemplateOutletDirective, selector: "[nzStringTemplateOutlet]", inputs: ["nzStringTemplateOutletContext", "nzStringTemplateOutlet"], exportAs: ["nzStringTemplateOutlet"] }, { kind: "directive", type: NzCommentActionHostDirective, selector: "[nzCommentActionHost]", inputs: ["nzCommentActionHost"], exportAs: ["nzCommentActionHost"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
  149. }
  150. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCommentComponent, decorators: [{
  151. type: Component,
  152. args: [{
  153. selector: 'nz-comment',
  154. exportAs: 'nzComment',
  155. template: `
  156. <div class="ant-comment-inner">
  157. <div class="ant-comment-avatar">
  158. <ng-content select="nz-avatar[nz-comment-avatar]"></ng-content>
  159. </div>
  160. <div class="ant-comment-content">
  161. <div class="ant-comment-content-author">
  162. @if (nzAuthor) {
  163. <span class="ant-comment-content-author-name">
  164. <ng-container *nzStringTemplateOutlet="nzAuthor">{{ nzAuthor }}</ng-container>
  165. </span>
  166. }
  167. @if (nzDatetime) {
  168. <span class="ant-comment-content-author-time">
  169. <ng-container *nzStringTemplateOutlet="nzDatetime">{{ nzDatetime }}</ng-container>
  170. </span>
  171. }
  172. </div>
  173. <ng-content select="nz-comment-content" />
  174. @if (actions?.length) {
  175. <ul class="ant-comment-actions">
  176. @for (action of actions; track action) {
  177. <li>
  178. <span><ng-template [nzCommentActionHost]="action.content" /></span>
  179. </li>
  180. }
  181. </ul>
  182. }
  183. </div>
  184. </div>
  185. <div class="ant-comment-nested">
  186. <ng-content />
  187. </div>
  188. `,
  189. encapsulation: ViewEncapsulation.None,
  190. changeDetection: ChangeDetectionStrategy.OnPush,
  191. host: {
  192. '[class.ant-comment]': `true`,
  193. '[class.ant-comment-rtl]': `dir === "rtl"`
  194. },
  195. imports: [NzOutletModule, NzCommentActionHostDirective]
  196. }]
  197. }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i1.Directionality }], propDecorators: { nzAuthor: [{
  198. type: Input
  199. }], nzDatetime: [{
  200. type: Input
  201. }], actions: [{
  202. type: ContentChildren,
  203. args: [NzCommentActionComponent]
  204. }] } });
  205. /**
  206. * Use of this source code is governed by an MIT-style license that can be
  207. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  208. */
  209. const NZ_COMMENT_CELLS = [
  210. NzCommentAvatarDirective,
  211. NzCommentContentDirective,
  212. NzCommentActionComponent,
  213. NzCommentActionHostDirective
  214. ];
  215. class NzCommentModule {
  216. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCommentModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
  217. static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.2", ngImport: i0, type: NzCommentModule, imports: [NzCommentComponent, NzCommentAvatarDirective,
  218. NzCommentContentDirective,
  219. NzCommentActionComponent,
  220. NzCommentActionHostDirective], exports: [NzCommentComponent, NzCommentAvatarDirective,
  221. NzCommentContentDirective,
  222. NzCommentActionComponent,
  223. NzCommentActionHostDirective] });
  224. static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCommentModule, imports: [NzCommentComponent] });
  225. }
  226. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCommentModule, decorators: [{
  227. type: NgModule,
  228. args: [{
  229. imports: [NzCommentComponent, ...NZ_COMMENT_CELLS],
  230. exports: [NzCommentComponent, ...NZ_COMMENT_CELLS]
  231. }]
  232. }] });
  233. /**
  234. * Use of this source code is governed by an MIT-style license that can be
  235. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  236. */
  237. /**
  238. * Generated bundle index. Do not edit.
  239. */
  240. export { NzCommentActionComponent, NzCommentActionHostDirective, NzCommentAvatarDirective, NzCommentComponent, NzCommentContentDirective, NzCommentModule };
  241. //# sourceMappingURL=ng-zorro-antd-comment.mjs.map