ng-zorro-antd-calendar.mjs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540
  1. import * as i0 from '@angular/core';
  2. import { Directive, EventEmitter, booleanAttribute, Output, Input, ChangeDetectionStrategy, ViewEncapsulation, Component, TemplateRef, forwardRef, ContentChild, NgModule } from '@angular/core';
  3. import * as i3 from '@angular/forms';
  4. import { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
  5. import { NzStringTemplateOutletDirective } from 'ng-zorro-antd/core/outlet';
  6. import { CandyDate } from 'ng-zorro-antd/core/time';
  7. import * as i4 from 'ng-zorro-antd/radio';
  8. import { NzRadioModule } from 'ng-zorro-antd/radio';
  9. import * as i2 from 'ng-zorro-antd/select';
  10. import { NzSelectModule } from 'ng-zorro-antd/select';
  11. import * as i1 from 'ng-zorro-antd/i18n';
  12. import { Subject } from 'rxjs';
  13. import { takeUntil } from 'rxjs/operators';
  14. import * as i2$1 from 'ng-zorro-antd/date-picker';
  15. import { LibPackerModule } from 'ng-zorro-antd/date-picker';
  16. import * as i1$1 from '@angular/cdk/bidi';
  17. /**
  18. * Use of this source code is governed by an MIT-style license that can be
  19. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  20. */
  21. class NzDateCellDirective {
  22. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzDateCellDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
  23. static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.2", type: NzDateCellDirective, isStandalone: true, selector: "[nzDateCell]", exportAs: ["nzDateCell"], ngImport: i0 });
  24. }
  25. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzDateCellDirective, decorators: [{
  26. type: Directive,
  27. args: [{
  28. selector: '[nzDateCell]',
  29. exportAs: 'nzDateCell'
  30. }]
  31. }] });
  32. class NzMonthCellDirective {
  33. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzMonthCellDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
  34. static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.2", type: NzMonthCellDirective, isStandalone: true, selector: "[nzMonthCell]", exportAs: ["nzMonthCell"], ngImport: i0 });
  35. }
  36. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzMonthCellDirective, decorators: [{
  37. type: Directive,
  38. args: [{
  39. selector: '[nzMonthCell]',
  40. exportAs: 'nzMonthCell'
  41. }]
  42. }] });
  43. class NzDateFullCellDirective {
  44. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzDateFullCellDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
  45. static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.2", type: NzDateFullCellDirective, isStandalone: true, selector: "[nzDateFullCell]", exportAs: ["nzDateFullCell"], ngImport: i0 });
  46. }
  47. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzDateFullCellDirective, decorators: [{
  48. type: Directive,
  49. args: [{
  50. selector: '[nzDateFullCell]',
  51. exportAs: 'nzDateFullCell'
  52. }]
  53. }] });
  54. class NzMonthFullCellDirective {
  55. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzMonthFullCellDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
  56. static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.2", type: NzMonthFullCellDirective, isStandalone: true, selector: "[nzMonthFullCell]", exportAs: ["nzMonthFullCell"], ngImport: i0 });
  57. }
  58. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzMonthFullCellDirective, decorators: [{
  59. type: Directive,
  60. args: [{
  61. selector: '[nzMonthFullCell]',
  62. exportAs: 'nzMonthFullCell'
  63. }]
  64. }] });
  65. /**
  66. * Use of this source code is governed by an MIT-style license that can be
  67. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  68. */
  69. class NzCalendarHeaderComponent {
  70. i18n;
  71. dateHelper;
  72. mode = 'month';
  73. fullscreen = true;
  74. activeDate = new CandyDate();
  75. nzCustomHeader;
  76. modeChange = new EventEmitter();
  77. yearChange = new EventEmitter();
  78. monthChange = new EventEmitter();
  79. // @Output() readonly valueChange: EventEmitter<CandyDate> = new EventEmitter();
  80. yearOffset = 10;
  81. yearTotal = 20;
  82. years = [];
  83. months = [];
  84. get activeYear() {
  85. return this.activeDate.getYear();
  86. }
  87. get activeMonth() {
  88. return this.activeDate.getMonth();
  89. }
  90. get size() {
  91. return this.fullscreen ? 'default' : 'small';
  92. }
  93. get yearTypeText() {
  94. return this.i18n.getLocale().Calendar.lang.year;
  95. }
  96. get monthTypeText() {
  97. return this.i18n.getLocale().Calendar.lang.month;
  98. }
  99. constructor(i18n, dateHelper) {
  100. this.i18n = i18n;
  101. this.dateHelper = dateHelper;
  102. }
  103. ngOnInit() {
  104. this.setUpYears();
  105. this.setUpMonths();
  106. }
  107. ngOnChanges(changes) {
  108. if (changes['activeDate']) {
  109. const previousActiveDate = changes['activeDate'].previousValue;
  110. const currentActiveDate = changes['activeDate'].currentValue;
  111. if (previousActiveDate?.getYear() !== currentActiveDate?.getYear()) {
  112. this.setUpYears();
  113. }
  114. }
  115. }
  116. updateYear(year) {
  117. this.yearChange.emit(year);
  118. this.setUpYears(year);
  119. }
  120. setUpYears(year) {
  121. const start = (year || this.activeYear) - this.yearOffset;
  122. const end = start + this.yearTotal;
  123. this.years = [];
  124. for (let i = start; i < end; i++) {
  125. this.years.push({ label: `${i}`, value: i });
  126. }
  127. }
  128. setUpMonths() {
  129. this.months = [];
  130. for (let i = 0; i < 12; i++) {
  131. const dateInMonth = this.activeDate.setMonth(i);
  132. const monthText = this.dateHelper.format(dateInMonth.nativeDate, 'MMM');
  133. this.months.push({ label: monthText, value: i });
  134. }
  135. }
  136. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCalendarHeaderComponent, deps: [{ token: i1.NzI18nService }, { token: i1.DateHelperService }], target: i0.ɵɵFactoryTarget.Component });
  137. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.2", type: NzCalendarHeaderComponent, isStandalone: true, selector: "nz-calendar-header", inputs: { mode: "mode", fullscreen: ["fullscreen", "fullscreen", booleanAttribute], activeDate: "activeDate", nzCustomHeader: "nzCustomHeader" }, outputs: { modeChange: "modeChange", yearChange: "yearChange", monthChange: "monthChange" }, host: { properties: { "style.display": "'block'" }, classAttribute: "ant-fullcalendar-header" }, exportAs: ["nzCalendarHeader"], usesOnChanges: true, ngImport: i0, template: `
  138. @if (nzCustomHeader) {
  139. <ng-container *nzStringTemplateOutlet="nzCustomHeader">{{ nzCustomHeader }}</ng-container>
  140. } @else {
  141. <div class="ant-picker-calendar-header">
  142. <nz-select
  143. class="ant-picker-calendar-year-select"
  144. [nzSize]="size"
  145. [nzDropdownMatchSelectWidth]="false"
  146. [ngModel]="activeYear"
  147. (ngModelChange)="updateYear($event)"
  148. >
  149. @for (year of years; track year.value) {
  150. <nz-option [nzLabel]="year.label" [nzValue]="year.value" />
  151. }
  152. </nz-select>
  153. @if (mode === 'month') {
  154. <nz-select
  155. class="ant-picker-calendar-month-select"
  156. [nzSize]="size"
  157. [nzDropdownMatchSelectWidth]="false"
  158. [ngModel]="activeMonth"
  159. (ngModelChange)="monthChange.emit($event)"
  160. >
  161. @for (month of months; track month.value) {
  162. <nz-option [nzLabel]="month.label" [nzValue]="month.value" />
  163. }
  164. </nz-select>
  165. }
  166. <nz-radio-group
  167. class="ant-picker-calendar-mode-switch"
  168. [(ngModel)]="mode"
  169. (ngModelChange)="modeChange.emit($event)"
  170. [nzSize]="size"
  171. >
  172. <label nz-radio-button nzValue="month">{{ monthTypeText }}</label>
  173. <label nz-radio-button nzValue="year">{{ yearTypeText }}</label>
  174. </nz-radio-group>
  175. </div>
  176. }
  177. `, isInline: true, dependencies: [{ kind: "ngmodule", type: NzSelectModule }, { kind: "component", type: i2.NzOptionComponent, selector: "nz-option", inputs: ["nzTitle", "nzLabel", "nzValue", "nzKey", "nzDisabled", "nzHide", "nzCustomContent"], exportAs: ["nzOption"] }, { kind: "component", type: i2.NzSelectComponent, selector: "nz-select", inputs: ["nzId", "nzSize", "nzStatus", "nzOptionHeightPx", "nzOptionOverflowSize", "nzDropdownClassName", "nzDropdownMatchSelectWidth", "nzDropdownStyle", "nzNotFoundContent", "nzPlaceHolder", "nzPlacement", "nzMaxTagCount", "nzDropdownRender", "nzCustomTemplate", "nzSuffixIcon", "nzClearIcon", "nzRemoveIcon", "nzMenuItemSelectedIcon", "nzTokenSeparators", "nzMaxTagPlaceholder", "nzMaxMultipleCount", "nzMode", "nzFilterOption", "compareWith", "nzAllowClear", "nzBorderless", "nzShowSearch", "nzLoading", "nzAutoFocus", "nzAutoClearSearchValue", "nzServerSearch", "nzDisabled", "nzOpen", "nzSelectOnTab", "nzBackdrop", "nzOptions", "nzShowArrow"], outputs: ["nzOnSearch", "nzScrollToBottom", "nzOpenChange", "nzBlur", "nzFocus"], exportAs: ["nzSelect"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: NzRadioModule }, { kind: "component", type: i4.NzRadioComponent, selector: "[nz-radio],[nz-radio-button]", inputs: ["nzValue", "nzDisabled", "nzAutoFocus", "nz-radio-button"], exportAs: ["nzRadio"] }, { kind: "component", type: i4.NzRadioGroupComponent, selector: "nz-radio-group", inputs: ["nzDisabled", "nzButtonStyle", "nzSize", "nzName"], exportAs: ["nzRadioGroup"] }, { kind: "directive", type: NzStringTemplateOutletDirective, selector: "[nzStringTemplateOutlet]", inputs: ["nzStringTemplateOutletContext", "nzStringTemplateOutlet"], exportAs: ["nzStringTemplateOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
  178. }
  179. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCalendarHeaderComponent, decorators: [{
  180. type: Component,
  181. args: [{
  182. encapsulation: ViewEncapsulation.None,
  183. changeDetection: ChangeDetectionStrategy.OnPush,
  184. selector: 'nz-calendar-header',
  185. exportAs: 'nzCalendarHeader',
  186. template: `
  187. @if (nzCustomHeader) {
  188. <ng-container *nzStringTemplateOutlet="nzCustomHeader">{{ nzCustomHeader }}</ng-container>
  189. } @else {
  190. <div class="ant-picker-calendar-header">
  191. <nz-select
  192. class="ant-picker-calendar-year-select"
  193. [nzSize]="size"
  194. [nzDropdownMatchSelectWidth]="false"
  195. [ngModel]="activeYear"
  196. (ngModelChange)="updateYear($event)"
  197. >
  198. @for (year of years; track year.value) {
  199. <nz-option [nzLabel]="year.label" [nzValue]="year.value" />
  200. }
  201. </nz-select>
  202. @if (mode === 'month') {
  203. <nz-select
  204. class="ant-picker-calendar-month-select"
  205. [nzSize]="size"
  206. [nzDropdownMatchSelectWidth]="false"
  207. [ngModel]="activeMonth"
  208. (ngModelChange)="monthChange.emit($event)"
  209. >
  210. @for (month of months; track month.value) {
  211. <nz-option [nzLabel]="month.label" [nzValue]="month.value" />
  212. }
  213. </nz-select>
  214. }
  215. <nz-radio-group
  216. class="ant-picker-calendar-mode-switch"
  217. [(ngModel)]="mode"
  218. (ngModelChange)="modeChange.emit($event)"
  219. [nzSize]="size"
  220. >
  221. <label nz-radio-button nzValue="month">{{ monthTypeText }}</label>
  222. <label nz-radio-button nzValue="year">{{ yearTypeText }}</label>
  223. </nz-radio-group>
  224. </div>
  225. }
  226. `,
  227. host: {
  228. class: 'ant-fullcalendar-header',
  229. '[style.display]': `'block'`
  230. },
  231. imports: [NzSelectModule, FormsModule, NzRadioModule, NzStringTemplateOutletDirective]
  232. }]
  233. }], ctorParameters: () => [{ type: i1.NzI18nService }, { type: i1.DateHelperService }], propDecorators: { mode: [{
  234. type: Input
  235. }], fullscreen: [{
  236. type: Input,
  237. args: [{ transform: booleanAttribute }]
  238. }], activeDate: [{
  239. type: Input
  240. }], nzCustomHeader: [{
  241. type: Input
  242. }], modeChange: [{
  243. type: Output
  244. }], yearChange: [{
  245. type: Output
  246. }], monthChange: [{
  247. type: Output
  248. }] } });
  249. class NzCalendarComponent {
  250. cdr;
  251. directionality;
  252. activeDate = new CandyDate();
  253. prefixCls = 'ant-picker-calendar';
  254. destroy$ = new Subject();
  255. dir = 'ltr';
  256. onChangeFn = () => { };
  257. onTouchFn = () => { };
  258. nzMode = 'month';
  259. nzValue;
  260. nzDisabledDate;
  261. nzModeChange = new EventEmitter();
  262. nzPanelChange = new EventEmitter();
  263. nzSelectChange = new EventEmitter();
  264. nzValueChange = new EventEmitter();
  265. /**
  266. * Cannot use @Input and @ContentChild on one variable
  267. * because { static: false } will make @Input property get delayed
  268. **/
  269. nzDateCell;
  270. nzDateCellChild;
  271. get dateCell() {
  272. return (this.nzDateCell || this.nzDateCellChild);
  273. }
  274. nzDateFullCell;
  275. nzDateFullCellChild;
  276. get dateFullCell() {
  277. return (this.nzDateFullCell || this.nzDateFullCellChild);
  278. }
  279. nzMonthCell;
  280. nzMonthCellChild;
  281. get monthCell() {
  282. return (this.nzMonthCell || this.nzMonthCellChild);
  283. }
  284. nzMonthFullCell;
  285. nzMonthFullCellChild;
  286. get monthFullCell() {
  287. return (this.nzMonthFullCell || this.nzMonthFullCellChild);
  288. }
  289. nzCustomHeader;
  290. nzFullscreen = true;
  291. constructor(cdr, directionality) {
  292. this.cdr = cdr;
  293. this.directionality = directionality;
  294. }
  295. ngOnInit() {
  296. this.dir = this.directionality.value;
  297. this.directionality.change?.pipe(takeUntil(this.destroy$)).subscribe(() => {
  298. this.dir = this.directionality.value;
  299. });
  300. }
  301. onModeChange(mode) {
  302. this.nzModeChange.emit(mode);
  303. this.nzPanelChange.emit({ date: this.activeDate.nativeDate, mode });
  304. }
  305. onYearSelect(year) {
  306. const date = this.activeDate.setYear(year);
  307. this.updateDate(date);
  308. }
  309. onMonthSelect(month) {
  310. const date = this.activeDate.setMonth(month);
  311. this.updateDate(date);
  312. }
  313. onDateSelect(date) {
  314. // Only activeDate is enough in calendar
  315. // this.value = date;
  316. this.updateDate(date);
  317. }
  318. writeValue(value) {
  319. this.updateDate(new CandyDate(value), false);
  320. this.cdr.markForCheck();
  321. }
  322. registerOnChange(fn) {
  323. this.onChangeFn = fn;
  324. }
  325. registerOnTouched(fn) {
  326. this.onTouchFn = fn;
  327. }
  328. updateDate(date, touched = true) {
  329. this.activeDate = date;
  330. if (touched) {
  331. this.onChangeFn(date.nativeDate);
  332. this.onTouchFn();
  333. this.nzSelectChange.emit(date.nativeDate);
  334. this.nzValueChange.emit(date.nativeDate);
  335. }
  336. }
  337. ngOnChanges(changes) {
  338. if (changes.nzValue) {
  339. this.updateDate(new CandyDate(this.nzValue), false);
  340. }
  341. }
  342. ngOnDestroy() {
  343. this.destroy$.next();
  344. this.destroy$.complete();
  345. }
  346. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCalendarComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1$1.Directionality }], target: i0.ɵɵFactoryTarget.Component });
  347. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.2", type: NzCalendarComponent, isStandalone: true, selector: "nz-calendar", inputs: { nzMode: "nzMode", nzValue: "nzValue", nzDisabledDate: "nzDisabledDate", nzDateCell: "nzDateCell", nzDateFullCell: "nzDateFullCell", nzMonthCell: "nzMonthCell", nzMonthFullCell: "nzMonthFullCell", nzCustomHeader: "nzCustomHeader", nzFullscreen: ["nzFullscreen", "nzFullscreen", booleanAttribute] }, outputs: { nzModeChange: "nzModeChange", nzPanelChange: "nzPanelChange", nzSelectChange: "nzSelectChange", nzValueChange: "nzValueChange" }, host: { properties: { "class.ant-picker-calendar-full": "nzFullscreen", "class.ant-picker-calendar-mini": "!nzFullscreen", "class.ant-picker-calendar-rtl": "dir === 'rtl'" }, classAttribute: "ant-picker-calendar" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => NzCalendarComponent), multi: true }], queries: [{ propertyName: "nzDateCellChild", first: true, predicate: NzDateCellDirective, descendants: true, read: TemplateRef }, { propertyName: "nzDateFullCellChild", first: true, predicate: NzDateFullCellDirective, descendants: true, read: TemplateRef }, { propertyName: "nzMonthCellChild", first: true, predicate: NzMonthCellDirective, descendants: true, read: TemplateRef }, { propertyName: "nzMonthFullCellChild", first: true, predicate: NzMonthFullCellDirective, descendants: true, read: TemplateRef }], exportAs: ["nzCalendar"], usesOnChanges: true, ngImport: i0, template: `
  348. <nz-calendar-header
  349. [fullscreen]="nzFullscreen"
  350. [activeDate]="activeDate"
  351. [nzCustomHeader]="nzCustomHeader"
  352. [(mode)]="nzMode"
  353. (modeChange)="onModeChange($event)"
  354. (yearChange)="onYearSelect($event)"
  355. (monthChange)="onMonthSelect($event)"
  356. ></nz-calendar-header>
  357. <div class="ant-picker-panel">
  358. <div class="ant-picker-{{ nzMode === 'month' ? 'date' : 'month' }}-panel">
  359. <div class="ant-picker-body">
  360. @if (nzMode === 'month') {
  361. <!-- TODO(@wenqi73) [cellRender] [fullCellRender] -->
  362. <date-table
  363. [prefixCls]="prefixCls"
  364. [value]="activeDate"
  365. [activeDate]="activeDate"
  366. [cellRender]="$any(dateCell)"
  367. [fullCellRender]="$any(dateFullCell)"
  368. [disabledDate]="nzDisabledDate"
  369. (valueChange)="onDateSelect($event)"
  370. ></date-table>
  371. } @else {
  372. <month-table
  373. [prefixCls]="prefixCls"
  374. [value]="activeDate"
  375. [activeDate]="activeDate"
  376. [cellRender]="$any(monthCell)"
  377. [fullCellRender]="$any(monthFullCell)"
  378. (valueChange)="onDateSelect($event)"
  379. ></month-table>
  380. }
  381. </div>
  382. </div>
  383. </div>
  384. `, isInline: true, dependencies: [{ kind: "component", type: NzCalendarHeaderComponent, selector: "nz-calendar-header", inputs: ["mode", "fullscreen", "activeDate", "nzCustomHeader"], outputs: ["modeChange", "yearChange", "monthChange"], exportAs: ["nzCalendarHeader"] }, { kind: "ngmodule", type: LibPackerModule }, { kind: "component", type: i2$1.ɵDateTableComponent, selector: "date-table", inputs: ["format"], exportAs: ["dateTable"] }, { kind: "component", type: i2$1.ɵMonthTableComponent, selector: "month-table", exportAs: ["monthTable"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
  385. }
  386. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCalendarComponent, decorators: [{
  387. type: Component,
  388. args: [{
  389. encapsulation: ViewEncapsulation.None,
  390. changeDetection: ChangeDetectionStrategy.OnPush,
  391. selector: 'nz-calendar',
  392. exportAs: 'nzCalendar',
  393. template: `
  394. <nz-calendar-header
  395. [fullscreen]="nzFullscreen"
  396. [activeDate]="activeDate"
  397. [nzCustomHeader]="nzCustomHeader"
  398. [(mode)]="nzMode"
  399. (modeChange)="onModeChange($event)"
  400. (yearChange)="onYearSelect($event)"
  401. (monthChange)="onMonthSelect($event)"
  402. ></nz-calendar-header>
  403. <div class="ant-picker-panel">
  404. <div class="ant-picker-{{ nzMode === 'month' ? 'date' : 'month' }}-panel">
  405. <div class="ant-picker-body">
  406. @if (nzMode === 'month') {
  407. <!-- TODO(@wenqi73) [cellRender] [fullCellRender] -->
  408. <date-table
  409. [prefixCls]="prefixCls"
  410. [value]="activeDate"
  411. [activeDate]="activeDate"
  412. [cellRender]="$any(dateCell)"
  413. [fullCellRender]="$any(dateFullCell)"
  414. [disabledDate]="nzDisabledDate"
  415. (valueChange)="onDateSelect($event)"
  416. ></date-table>
  417. } @else {
  418. <month-table
  419. [prefixCls]="prefixCls"
  420. [value]="activeDate"
  421. [activeDate]="activeDate"
  422. [cellRender]="$any(monthCell)"
  423. [fullCellRender]="$any(monthFullCell)"
  424. (valueChange)="onDateSelect($event)"
  425. ></month-table>
  426. }
  427. </div>
  428. </div>
  429. </div>
  430. `,
  431. host: {
  432. class: 'ant-picker-calendar',
  433. '[class.ant-picker-calendar-full]': 'nzFullscreen',
  434. '[class.ant-picker-calendar-mini]': '!nzFullscreen',
  435. '[class.ant-picker-calendar-rtl]': `dir === 'rtl'`
  436. },
  437. providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => NzCalendarComponent), multi: true }],
  438. imports: [NzCalendarHeaderComponent, LibPackerModule]
  439. }]
  440. }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i1$1.Directionality }], propDecorators: { nzMode: [{
  441. type: Input
  442. }], nzValue: [{
  443. type: Input
  444. }], nzDisabledDate: [{
  445. type: Input
  446. }], nzModeChange: [{
  447. type: Output
  448. }], nzPanelChange: [{
  449. type: Output
  450. }], nzSelectChange: [{
  451. type: Output
  452. }], nzValueChange: [{
  453. type: Output
  454. }], nzDateCell: [{
  455. type: Input
  456. }], nzDateCellChild: [{
  457. type: ContentChild,
  458. args: [NzDateCellDirective, { static: false, read: TemplateRef }]
  459. }], nzDateFullCell: [{
  460. type: Input
  461. }], nzDateFullCellChild: [{
  462. type: ContentChild,
  463. args: [NzDateFullCellDirective, { static: false, read: TemplateRef }]
  464. }], nzMonthCell: [{
  465. type: Input
  466. }], nzMonthCellChild: [{
  467. type: ContentChild,
  468. args: [NzMonthCellDirective, { static: false, read: TemplateRef }]
  469. }], nzMonthFullCell: [{
  470. type: Input
  471. }], nzMonthFullCellChild: [{
  472. type: ContentChild,
  473. args: [NzMonthFullCellDirective, { static: false, read: TemplateRef }]
  474. }], nzCustomHeader: [{
  475. type: Input
  476. }], nzFullscreen: [{
  477. type: Input,
  478. args: [{ transform: booleanAttribute }]
  479. }] } });
  480. /**
  481. * Use of this source code is governed by an MIT-style license that can be
  482. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  483. */
  484. class NzCalendarModule {
  485. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCalendarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
  486. static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.2", ngImport: i0, type: NzCalendarModule, imports: [NzCalendarHeaderComponent,
  487. NzCalendarComponent,
  488. NzDateCellDirective,
  489. NzDateFullCellDirective,
  490. NzMonthCellDirective,
  491. NzMonthFullCellDirective], exports: [NzCalendarComponent,
  492. NzDateCellDirective,
  493. NzDateFullCellDirective,
  494. NzMonthCellDirective,
  495. NzMonthFullCellDirective] });
  496. static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCalendarModule, imports: [NzCalendarHeaderComponent,
  497. NzCalendarComponent] });
  498. }
  499. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzCalendarModule, decorators: [{
  500. type: NgModule,
  501. args: [{
  502. imports: [
  503. NzCalendarHeaderComponent,
  504. NzCalendarComponent,
  505. NzDateCellDirective,
  506. NzDateFullCellDirective,
  507. NzMonthCellDirective,
  508. NzMonthFullCellDirective
  509. ],
  510. exports: [
  511. NzCalendarComponent,
  512. NzDateCellDirective,
  513. NzDateFullCellDirective,
  514. NzMonthCellDirective,
  515. NzMonthFullCellDirective
  516. ]
  517. }]
  518. }] });
  519. /**
  520. * Use of this source code is governed by an MIT-style license that can be
  521. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  522. */
  523. /**
  524. * Generated bundle index. Do not edit.
  525. */
  526. export { NzCalendarComponent, NzCalendarHeaderComponent, NzCalendarModule, NzDateCellDirective, NzDateFullCellDirective, NzMonthCellDirective, NzMonthFullCellDirective };
  527. //# sourceMappingURL=ng-zorro-antd-calendar.mjs.map