ng-zorro-antd-card.mjs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  1. import * as i0 from '@angular/core';
  2. import { booleanAttribute, Input, Directive, ViewEncapsulation, ChangeDetectionStrategy, Component, TemplateRef, ViewChild, ContentChildren, ContentChild, NgModule } from '@angular/core';
  3. import { NgTemplateOutlet } from '@angular/common';
  4. import * as i1 from 'ng-zorro-antd/core/outlet';
  5. import { NzOutletModule } from 'ng-zorro-antd/core/outlet';
  6. import { __esDecorate, __runInitializers } from 'tslib';
  7. import { Subject } from 'rxjs';
  8. import { takeUntil } from 'rxjs/operators';
  9. import * as i1$1 from 'ng-zorro-antd/core/config';
  10. import { WithConfig } from 'ng-zorro-antd/core/config';
  11. import * as i4 from 'ng-zorro-antd/skeleton';
  12. import { NzSkeletonModule } from 'ng-zorro-antd/skeleton';
  13. import * as i2 from '@angular/cdk/bidi';
  14. import { BidiModule } from '@angular/cdk/bidi';
  15. /**
  16. * Use of this source code is governed by an MIT-style license that can be
  17. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  18. */
  19. class NzCardGridDirective {
  20. nzHoverable = true;
  21. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCardGridDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
  22. static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "19.2.2", type: NzCardGridDirective, isStandalone: true, selector: "[nz-card-grid]", inputs: { nzHoverable: ["nzHoverable", "nzHoverable", booleanAttribute] }, host: { properties: { "class.ant-card-hoverable": "nzHoverable" }, classAttribute: "ant-card-grid" }, exportAs: ["nzCardGrid"], ngImport: i0 });
  23. }
  24. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCardGridDirective, decorators: [{
  25. type: Directive,
  26. args: [{
  27. selector: '[nz-card-grid]',
  28. exportAs: 'nzCardGrid',
  29. host: {
  30. class: 'ant-card-grid',
  31. '[class.ant-card-hoverable]': 'nzHoverable'
  32. }
  33. }]
  34. }], propDecorators: { nzHoverable: [{
  35. type: Input,
  36. args: [{ transform: booleanAttribute }]
  37. }] } });
  38. /**
  39. * Use of this source code is governed by an MIT-style license that can be
  40. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  41. */
  42. class NzCardMetaComponent {
  43. nzTitle = null;
  44. nzDescription = null;
  45. nzAvatar = null;
  46. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCardMetaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
  47. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.2", type: NzCardMetaComponent, isStandalone: true, selector: "nz-card-meta", inputs: { nzTitle: "nzTitle", nzDescription: "nzDescription", nzAvatar: "nzAvatar" }, host: { classAttribute: "ant-card-meta" }, exportAs: ["nzCardMeta"], ngImport: i0, template: `
  48. @if (nzAvatar) {
  49. <div class="ant-card-meta-avatar">
  50. <ng-template [ngTemplateOutlet]="nzAvatar" />
  51. </div>
  52. }
  53. @if (nzTitle || nzDescription) {
  54. <div class="ant-card-meta-detail">
  55. @if (nzTitle) {
  56. <div class="ant-card-meta-title">
  57. <ng-container *nzStringTemplateOutlet="nzTitle">{{ nzTitle }}</ng-container>
  58. </div>
  59. }
  60. @if (nzDescription) {
  61. <div class="ant-card-meta-description">
  62. <ng-container *nzStringTemplateOutlet="nzDescription">{{ nzDescription }}</ng-container>
  63. </div>
  64. }
  65. </div>
  66. }
  67. `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: NzOutletModule }, { kind: "directive", type: i1.NzStringTemplateOutletDirective, selector: "[nzStringTemplateOutlet]", inputs: ["nzStringTemplateOutletContext", "nzStringTemplateOutlet"], exportAs: ["nzStringTemplateOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
  68. }
  69. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCardMetaComponent, decorators: [{
  70. type: Component,
  71. args: [{
  72. selector: 'nz-card-meta',
  73. exportAs: 'nzCardMeta',
  74. preserveWhitespaces: false,
  75. changeDetection: ChangeDetectionStrategy.OnPush,
  76. encapsulation: ViewEncapsulation.None,
  77. template: `
  78. @if (nzAvatar) {
  79. <div class="ant-card-meta-avatar">
  80. <ng-template [ngTemplateOutlet]="nzAvatar" />
  81. </div>
  82. }
  83. @if (nzTitle || nzDescription) {
  84. <div class="ant-card-meta-detail">
  85. @if (nzTitle) {
  86. <div class="ant-card-meta-title">
  87. <ng-container *nzStringTemplateOutlet="nzTitle">{{ nzTitle }}</ng-container>
  88. </div>
  89. }
  90. @if (nzDescription) {
  91. <div class="ant-card-meta-description">
  92. <ng-container *nzStringTemplateOutlet="nzDescription">{{ nzDescription }}</ng-container>
  93. </div>
  94. }
  95. </div>
  96. }
  97. `,
  98. host: { class: 'ant-card-meta' },
  99. imports: [NgTemplateOutlet, NzOutletModule]
  100. }]
  101. }], propDecorators: { nzTitle: [{
  102. type: Input
  103. }], nzDescription: [{
  104. type: Input
  105. }], nzAvatar: [{
  106. type: Input
  107. }] } });
  108. /**
  109. * Use of this source code is governed by an MIT-style license that can be
  110. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  111. */
  112. class NzCardTabComponent {
  113. template;
  114. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCardTabComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
  115. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.2", type: NzCardTabComponent, isStandalone: true, selector: "nz-card-tab", viewQueries: [{ propertyName: "template", first: true, predicate: TemplateRef, descendants: true, static: true }], exportAs: ["nzCardTab"], ngImport: i0, template: `
  116. <ng-template>
  117. <ng-content></ng-content>
  118. </ng-template>
  119. `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
  120. }
  121. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCardTabComponent, decorators: [{
  122. type: Component,
  123. args: [{
  124. selector: 'nz-card-tab',
  125. exportAs: 'nzCardTab',
  126. encapsulation: ViewEncapsulation.None,
  127. changeDetection: ChangeDetectionStrategy.OnPush,
  128. template: `
  129. <ng-template>
  130. <ng-content></ng-content>
  131. </ng-template>
  132. `
  133. }]
  134. }], propDecorators: { template: [{
  135. type: ViewChild,
  136. args: [TemplateRef, { static: true }]
  137. }] } });
  138. const NZ_CONFIG_MODULE_NAME = 'card';
  139. let NzCardComponent = (() => {
  140. let _nzBordered_decorators;
  141. let _nzBordered_initializers = [];
  142. let _nzBordered_extraInitializers = [];
  143. let _nzHoverable_decorators;
  144. let _nzHoverable_initializers = [];
  145. let _nzHoverable_extraInitializers = [];
  146. let _nzSize_decorators;
  147. let _nzSize_initializers = [];
  148. let _nzSize_extraInitializers = [];
  149. return class NzCardComponent {
  150. static {
  151. const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
  152. _nzBordered_decorators = [WithConfig()];
  153. _nzHoverable_decorators = [WithConfig()];
  154. _nzSize_decorators = [WithConfig()];
  155. __esDecorate(null, null, _nzBordered_decorators, { kind: "field", name: "nzBordered", static: false, private: false, access: { has: obj => "nzBordered" in obj, get: obj => obj.nzBordered, set: (obj, value) => { obj.nzBordered = value; } }, metadata: _metadata }, _nzBordered_initializers, _nzBordered_extraInitializers);
  156. __esDecorate(null, null, _nzHoverable_decorators, { kind: "field", name: "nzHoverable", static: false, private: false, access: { has: obj => "nzHoverable" in obj, get: obj => obj.nzHoverable, set: (obj, value) => { obj.nzHoverable = value; } }, metadata: _metadata }, _nzHoverable_initializers, _nzHoverable_extraInitializers);
  157. __esDecorate(null, null, _nzSize_decorators, { kind: "field", name: "nzSize", static: false, private: false, access: { has: obj => "nzSize" in obj, get: obj => obj.nzSize, set: (obj, value) => { obj.nzSize = value; } }, metadata: _metadata }, _nzSize_initializers, _nzSize_extraInitializers);
  158. if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
  159. }
  160. nzConfigService;
  161. cdr;
  162. directionality;
  163. _nzModuleName = NZ_CONFIG_MODULE_NAME;
  164. nzBordered = __runInitializers(this, _nzBordered_initializers, true);
  165. nzLoading = (__runInitializers(this, _nzBordered_extraInitializers), false);
  166. nzHoverable = __runInitializers(this, _nzHoverable_initializers, false);
  167. nzBodyStyle = (__runInitializers(this, _nzHoverable_extraInitializers), null);
  168. nzCover;
  169. nzActions = [];
  170. nzType = null;
  171. nzSize = __runInitializers(this, _nzSize_initializers, 'default');
  172. nzTitle = __runInitializers(this, _nzSize_extraInitializers);
  173. nzExtra;
  174. listOfNzCardTabComponent;
  175. listOfNzCardGridDirective;
  176. dir = 'ltr';
  177. destroy$ = new Subject();
  178. constructor(nzConfigService, cdr, directionality) {
  179. this.nzConfigService = nzConfigService;
  180. this.cdr = cdr;
  181. this.directionality = directionality;
  182. this.nzConfigService
  183. .getConfigChangeEventForComponent(NZ_CONFIG_MODULE_NAME)
  184. .pipe(takeUntil(this.destroy$))
  185. .subscribe(() => {
  186. this.cdr.markForCheck();
  187. });
  188. }
  189. ngOnInit() {
  190. this.directionality.change?.pipe(takeUntil(this.destroy$)).subscribe((direction) => {
  191. this.dir = direction;
  192. this.cdr.detectChanges();
  193. });
  194. this.dir = this.directionality.value;
  195. }
  196. ngOnDestroy() {
  197. this.destroy$.next(true);
  198. this.destroy$.complete();
  199. }
  200. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCardComponent, deps: [{ token: i1$1.NzConfigService }, { token: i0.ChangeDetectorRef }, { token: i2.Directionality }], target: i0.ɵɵFactoryTarget.Component });
  201. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.2", type: NzCardComponent, isStandalone: true, selector: "nz-card", inputs: { nzBordered: ["nzBordered", "nzBordered", booleanAttribute], nzLoading: ["nzLoading", "nzLoading", booleanAttribute], nzHoverable: ["nzHoverable", "nzHoverable", booleanAttribute], nzBodyStyle: "nzBodyStyle", nzCover: "nzCover", nzActions: "nzActions", nzType: "nzType", nzSize: "nzSize", nzTitle: "nzTitle", nzExtra: "nzExtra" }, host: { properties: { "class.ant-card-loading": "nzLoading", "class.ant-card-bordered": "nzBordered", "class.ant-card-hoverable": "nzHoverable", "class.ant-card-small": "nzSize === \"small\"", "class.ant-card-contain-grid": "listOfNzCardGridDirective && listOfNzCardGridDirective.length", "class.ant-card-type-inner": "nzType === \"inner\"", "class.ant-card-contain-tabs": "!!listOfNzCardTabComponent", "class.ant-card-rtl": "dir === 'rtl'" }, classAttribute: "ant-card" }, queries: [{ propertyName: "listOfNzCardTabComponent", first: true, predicate: NzCardTabComponent, descendants: true }, { propertyName: "listOfNzCardGridDirective", predicate: NzCardGridDirective }], exportAs: ["nzCard"], ngImport: i0, template: `
  202. @if (nzTitle || nzExtra || listOfNzCardTabComponent) {
  203. <div class="ant-card-head">
  204. <div class="ant-card-head-wrapper">
  205. @if (nzTitle) {
  206. <div class="ant-card-head-title">
  207. <ng-container *nzStringTemplateOutlet="nzTitle">{{ nzTitle }}</ng-container>
  208. </div>
  209. }
  210. @if (nzExtra) {
  211. <div class="ant-card-extra">
  212. <ng-container *nzStringTemplateOutlet="nzExtra">{{ nzExtra }}</ng-container>
  213. </div>
  214. }
  215. </div>
  216. @if (listOfNzCardTabComponent) {
  217. <ng-template [ngTemplateOutlet]="listOfNzCardTabComponent.template" />
  218. }
  219. </div>
  220. }
  221. @if (nzCover) {
  222. <div class="ant-card-cover">
  223. <ng-template [ngTemplateOutlet]="nzCover" />
  224. </div>
  225. }
  226. <div class="ant-card-body" [style]="nzBodyStyle">
  227. @if (nzLoading) {
  228. <nz-skeleton [nzActive]="true" [nzTitle]="false" [nzParagraph]="{ rows: 4 }"></nz-skeleton>
  229. } @else {
  230. <ng-content />
  231. }
  232. </div>
  233. @if (nzActions.length) {
  234. <ul class="ant-card-actions">
  235. @for (action of nzActions; track $index) {
  236. <li [style.width.%]="100 / nzActions.length">
  237. <span><ng-template [ngTemplateOutlet]="action" /></span>
  238. </li>
  239. }
  240. </ul>
  241. }
  242. `, isInline: true, dependencies: [{ kind: "ngmodule", type: NzOutletModule }, { kind: "directive", type: i1.NzStringTemplateOutletDirective, selector: "[nzStringTemplateOutlet]", inputs: ["nzStringTemplateOutletContext", "nzStringTemplateOutlet"], exportAs: ["nzStringTemplateOutlet"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: NzSkeletonModule }, { kind: "component", type: i4.NzSkeletonComponent, selector: "nz-skeleton", inputs: ["nzActive", "nzLoading", "nzRound", "nzTitle", "nzAvatar", "nzParagraph"], exportAs: ["nzSkeleton"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
  243. };
  244. })();
  245. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCardComponent, decorators: [{
  246. type: Component,
  247. args: [{
  248. selector: 'nz-card',
  249. exportAs: 'nzCard',
  250. preserveWhitespaces: false,
  251. changeDetection: ChangeDetectionStrategy.OnPush,
  252. encapsulation: ViewEncapsulation.None,
  253. template: `
  254. @if (nzTitle || nzExtra || listOfNzCardTabComponent) {
  255. <div class="ant-card-head">
  256. <div class="ant-card-head-wrapper">
  257. @if (nzTitle) {
  258. <div class="ant-card-head-title">
  259. <ng-container *nzStringTemplateOutlet="nzTitle">{{ nzTitle }}</ng-container>
  260. </div>
  261. }
  262. @if (nzExtra) {
  263. <div class="ant-card-extra">
  264. <ng-container *nzStringTemplateOutlet="nzExtra">{{ nzExtra }}</ng-container>
  265. </div>
  266. }
  267. </div>
  268. @if (listOfNzCardTabComponent) {
  269. <ng-template [ngTemplateOutlet]="listOfNzCardTabComponent.template" />
  270. }
  271. </div>
  272. }
  273. @if (nzCover) {
  274. <div class="ant-card-cover">
  275. <ng-template [ngTemplateOutlet]="nzCover" />
  276. </div>
  277. }
  278. <div class="ant-card-body" [style]="nzBodyStyle">
  279. @if (nzLoading) {
  280. <nz-skeleton [nzActive]="true" [nzTitle]="false" [nzParagraph]="{ rows: 4 }"></nz-skeleton>
  281. } @else {
  282. <ng-content />
  283. }
  284. </div>
  285. @if (nzActions.length) {
  286. <ul class="ant-card-actions">
  287. @for (action of nzActions; track $index) {
  288. <li [style.width.%]="100 / nzActions.length">
  289. <span><ng-template [ngTemplateOutlet]="action" /></span>
  290. </li>
  291. }
  292. </ul>
  293. }
  294. `,
  295. host: {
  296. class: 'ant-card',
  297. '[class.ant-card-loading]': 'nzLoading',
  298. '[class.ant-card-bordered]': 'nzBordered',
  299. '[class.ant-card-hoverable]': 'nzHoverable',
  300. '[class.ant-card-small]': 'nzSize === "small"',
  301. '[class.ant-card-contain-grid]': 'listOfNzCardGridDirective && listOfNzCardGridDirective.length',
  302. '[class.ant-card-type-inner]': 'nzType === "inner"',
  303. '[class.ant-card-contain-tabs]': '!!listOfNzCardTabComponent',
  304. '[class.ant-card-rtl]': `dir === 'rtl'`
  305. },
  306. imports: [NzOutletModule, NgTemplateOutlet, NzSkeletonModule]
  307. }]
  308. }], ctorParameters: () => [{ type: i1$1.NzConfigService }, { type: i0.ChangeDetectorRef }, { type: i2.Directionality }], propDecorators: { nzBordered: [{
  309. type: Input,
  310. args: [{ transform: booleanAttribute }]
  311. }], nzLoading: [{
  312. type: Input,
  313. args: [{ transform: booleanAttribute }]
  314. }], nzHoverable: [{
  315. type: Input,
  316. args: [{ transform: booleanAttribute }]
  317. }], nzBodyStyle: [{
  318. type: Input
  319. }], nzCover: [{
  320. type: Input
  321. }], nzActions: [{
  322. type: Input
  323. }], nzType: [{
  324. type: Input
  325. }], nzSize: [{
  326. type: Input
  327. }], nzTitle: [{
  328. type: Input
  329. }], nzExtra: [{
  330. type: Input
  331. }], listOfNzCardTabComponent: [{
  332. type: ContentChild,
  333. args: [NzCardTabComponent, { static: false }]
  334. }], listOfNzCardGridDirective: [{
  335. type: ContentChildren,
  336. args: [NzCardGridDirective]
  337. }] } });
  338. /**
  339. * Use of this source code is governed by an MIT-style license that can be
  340. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  341. */
  342. class NzCardModule {
  343. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCardModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
  344. static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.2", ngImport: i0, type: NzCardModule, imports: [NzCardComponent, NzCardGridDirective, NzCardMetaComponent, NzCardTabComponent], exports: [BidiModule, NzCardComponent, NzCardGridDirective, NzCardMetaComponent, NzCardTabComponent] });
  345. static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCardModule, imports: [NzCardComponent, NzCardMetaComponent, BidiModule] });
  346. }
  347. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCardModule, decorators: [{
  348. type: NgModule,
  349. args: [{
  350. imports: [NzCardComponent, NzCardGridDirective, NzCardMetaComponent, NzCardTabComponent],
  351. exports: [BidiModule, NzCardComponent, NzCardGridDirective, NzCardMetaComponent, NzCardTabComponent]
  352. }]
  353. }] });
  354. /**
  355. * Use of this source code is governed by an MIT-style license that can be
  356. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  357. */
  358. /**
  359. * Generated bundle index. Do not edit.
  360. */
  361. export { NzCardComponent, NzCardGridDirective, NzCardMetaComponent, NzCardModule, NzCardTabComponent };
  362. //# sourceMappingURL=ng-zorro-antd-card.mjs.map