UNPKG

ng-zorro-antd

Version:

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

163 lines (161 loc) 19.9 kB
/** * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ import { __decorate, __metadata } from "tslib"; import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, ElementRef, EventEmitter, forwardRef, Input, Output, TemplateRef, ViewEncapsulation } from '@angular/core'; import { NG_VALUE_ACCESSOR } from '@angular/forms'; import { CandyDate } from 'ng-zorro-antd/core/time'; import { InputBoolean } from 'ng-zorro-antd/core/util'; import { NzDateCellDirective as DateCell, NzDateFullCellDirective as DateFullCell, NzMonthCellDirective as MonthCell, NzMonthFullCellDirective as MonthFullCell } from './calendar-cells'; export class NzCalendarComponent { constructor(cdr, elementRef) { this.cdr = cdr; this.elementRef = elementRef; this.activeDate = new CandyDate(); this.prefixCls = 'ant-picker-calendar'; this.onChangeFn = () => { }; this.onTouchFn = () => { }; this.nzMode = 'month'; this.nzModeChange = new EventEmitter(); this.nzPanelChange = new EventEmitter(); this.nzSelectChange = new EventEmitter(); this.nzValueChange = new EventEmitter(); this.nzFullscreen = true; // TODO: move to host after View Engine deprecation this.elementRef.nativeElement.classList.add('ant-picker-calendar'); } get dateCell() { return (this.nzDateCell || this.nzDateCellChild); } get dateFullCell() { return (this.nzDateFullCell || this.nzDateFullCellChild); } get monthCell() { return (this.nzMonthCell || this.nzMonthCellChild); } get monthFullCell() { return (this.nzMonthFullCell || this.nzMonthFullCellChild); } onModeChange(mode) { this.nzModeChange.emit(mode); this.nzPanelChange.emit({ date: this.activeDate.nativeDate, mode }); } onYearSelect(year) { const date = this.activeDate.setYear(year); this.updateDate(date); } onMonthSelect(month) { const date = this.activeDate.setMonth(month); this.updateDate(date); } onDateSelect(date) { // Only activeDate is enough in calendar // this.value = date; this.updateDate(date); } writeValue(value) { this.updateDate(new CandyDate(value), false); this.cdr.markForCheck(); } registerOnChange(fn) { this.onChangeFn = fn; } registerOnTouched(fn) { this.onTouchFn = fn; } updateDate(date, touched = true) { this.activeDate = date; if (touched) { this.onChangeFn(date.nativeDate); this.onTouchFn(); this.nzSelectChange.emit(date.nativeDate); this.nzValueChange.emit(date.nativeDate); } } ngOnChanges(changes) { if (changes.nzValue) { this.updateDate(new CandyDate(this.nzValue), false); } } } NzCalendarComponent.decorators = [ { type: Component, args: [{ encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, selector: 'nz-calendar', exportAs: 'nzCalendar', template: ` <nz-calendar-header [fullscreen]="nzFullscreen" [activeDate]="activeDate" [(mode)]="nzMode" (modeChange)="onModeChange($event)" (yearChange)="onYearSelect($event)" (monthChange)="onMonthSelect($event)" ></nz-calendar-header> <div class="ant-picker-panel"> <div class="ant-picker-{{ nzMode === 'month' ? 'date' : 'month' }}-panel"> <div class="ant-picker-body"> <ng-container *ngIf="nzMode === 'month'; then monthModeTable; else yearModeTable"></ng-container> </div> </div> </div> <ng-template #monthModeTable> <!-- TODO(@wenqi73) [cellRender] [fullCellRender] --> <date-table [prefixCls]="prefixCls" [value]="activeDate" [activeDate]="activeDate" [cellRender]="$any(dateCell)" [fullCellRender]="$any(dateFullCell)" [disabledDate]="nzDisabledDate" (valueChange)="onDateSelect($event)" ></date-table> </ng-template> <!-- TODO(@wenqi73) [cellRender] [fullCellRender] --> <ng-template #yearModeTable> <month-table [prefixCls]="prefixCls" [value]="activeDate" [activeDate]="activeDate" [cellRender]="$any(monthCell)" [fullCellRender]="$any(monthFullCell)" (valueChange)="onDateSelect($event)" ></month-table> </ng-template> `, host: { '[class.ant-picker-calendar-full]': 'nzFullscreen', '[class.ant-picker-calendar-mini]': '!nzFullscreen' }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => NzCalendarComponent), multi: true }] },] } ]; NzCalendarComponent.ctorParameters = () => [ { type: ChangeDetectorRef }, { type: ElementRef } ]; NzCalendarComponent.propDecorators = { nzMode: [{ type: Input }], nzValue: [{ type: Input }], nzDisabledDate: [{ type: Input }], nzModeChange: [{ type: Output }], nzPanelChange: [{ type: Output }], nzSelectChange: [{ type: Output }], nzValueChange: [{ type: Output }], nzDateCell: [{ type: Input }], nzDateCellChild: [{ type: ContentChild, args: [DateCell, { static: false, read: TemplateRef },] }], nzDateFullCell: [{ type: Input }], nzDateFullCellChild: [{ type: ContentChild, args: [DateFullCell, { static: false, read: TemplateRef },] }], nzMonthCell: [{ type: Input }], nzMonthCellChild: [{ type: ContentChild, args: [MonthCell, { static: false, read: TemplateRef },] }], nzMonthFullCell: [{ type: Input }], nzMonthFullCellChild: [{ type: ContentChild, args: [MonthFullCell, { static: false, read: TemplateRef },] }], nzFullscreen: [{ type: Input }] }; __decorate([ InputBoolean(), __metadata("design:type", Boolean) ], NzCalendarComponent.prototype, "nzFullscreen", void 0); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2FsZW5kYXIuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6Ii9ob21lL3ZzdHMvd29yay8xL3MvY29tcG9uZW50cy9jYWxlbmRhci8iLCJzb3VyY2VzIjpbImNhbGVuZGFyLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7O0dBR0c7O0FBRUgsT0FBTyxFQUNMLHVCQUF1QixFQUN2QixpQkFBaUIsRUFDakIsU0FBUyxFQUNULFlBQVksRUFDWixVQUFVLEVBQ1YsWUFBWSxFQUNaLFVBQVUsRUFDVixLQUFLLEVBRUwsTUFBTSxFQUVOLFdBQVcsRUFDWCxpQkFBaUIsRUFDbEIsTUFBTSxlQUFlLENBQUM7QUFDdkIsT0FBTyxFQUF3QixpQkFBaUIsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBRXpFLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUVwRCxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0seUJ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