UNPKG

ng-zorro-antd-yj

Version:

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

192 lines 15.9 kB
/** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ import * as tslib_1 from "tslib"; import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core'; import { NzNoAnimationDirective } from '../core/no-animation/nz-no-animation.directive'; import { toBoolean, valueFunctionProp, InputBoolean } from '../core/util/convert'; import { NzI18nService } from '../i18n/nz-i18n.service'; import { DateHelperService } from '../i18n/date-helper.service'; import { AbstractPickerComponent } from './abstract-picker.component'; export class DateRangePickerComponent extends AbstractPickerComponent { /** * @param {?} i18n * @param {?} cdr * @param {?} dateHelper * @param {?=} noAnimation */ constructor(i18n, cdr, dateHelper, noAnimation) { super(i18n, cdr, dateHelper, noAnimation); this.showWeek = false; // Should show as week picker this.nzShowToday = true; this.nzOnPanelChange = new EventEmitter(); this.nzOnOk = new EventEmitter(); } /** * @return {?} */ get nzShowTime() { return this._showTime; } /** * @param {?} value * @return {?} */ set nzShowTime(value) { this._showTime = typeof value === 'object' ? value : toBoolean(value); } /** * @return {?} */ get realShowToday() { // Range not support nzShowToday currently return !this.isRange && this.nzShowToday; } /** * @return {?} */ ngOnInit() { super.ngOnInit(); // Default format when it's empty if (!this.nzFormat) { if (this.showWeek) { this.nzFormat = this.dateHelper.relyOnDatePipe ? 'yyyy-ww' : 'YYYY-WW'; // Format for week } else { if (this.dateHelper.relyOnDatePipe) { this.nzFormat = this.nzShowTime ? 'yyyy-MM-dd HH:mm:ss' : 'yyyy-MM-dd'; } else { this.nzFormat = this.nzShowTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD'; } } } } /** * @param {?} changes * @return {?} */ ngOnChanges(changes) { super.ngOnChanges(changes); if (changes.nzRenderExtraFooter) { this.extraFooter = valueFunctionProp(this.nzRenderExtraFooter); } if (changes.nzShowTime || changes.nzStyle) { this.setFixedPickerStyle(); } } // If has no timepicker and the user select a date by date panel, then close picker /** * @param {?} value * @return {?} */ onValueChange(value) { super.onValueChange(value); if (!this.nzShowTime) { this.closeOverlay(); } } // Emitted when done with date selecting /** * @return {?} */ onResultOk() { if (this.isRange) { /** @type {?} */ const value = (/** @type {?} */ (this.nzValue)); if (value.length) { this.nzOnOk.emit([value[0].nativeDate, value[1].nativeDate]); } else { this.nzOnOk.emit([]); } } else { if (this.nzValue) { this.nzOnOk.emit(((/** @type {?} */ (this.nzValue))).nativeDate); } else { this.nzOnOk.emit(null); } } this.closeOverlay(); } /** * @param {?} open * @return {?} */ onOpenChange(open) { this.nzOnOpenChange.emit(open); } // Setup fixed style for picker /** * @private * @return {?} */ setFixedPickerStyle() { /** @type {?} */ const showTimeFixes = {}; if (this.nzShowTime) { showTimeFixes.width = this.isRange ? '350px' : '195px'; } this.pickerStyle = Object.assign({}, showTimeFixes, this.nzStyle); } } DateRangePickerComponent.decorators = [ { type: Component, args: [{ template: `` // Just for rollup }] } ]; /** @nocollapse */ DateRangePickerComponent.ctorParameters = () => [ { type: NzI18nService }, { type: ChangeDetectorRef }, { type: DateHelperService }, { type: NzNoAnimationDirective } ]; DateRangePickerComponent.propDecorators = { nzDateRender: [{ type: Input }], nzDisabledTime: [{ type: Input }], nzRenderExtraFooter: [{ type: Input }], nzShowToday: [{ type: Input }], nzMode: [{ type: Input }], nzRanges: [{ type: Input }], nzOnPanelChange: [{ type: Output }], nzShowTime: [{ type: Input }], nzOnOk: [{ type: Output }] }; tslib_1.__decorate([ InputBoolean(), tslib_1.__metadata("design:type", Boolean) ], DateRangePickerComponent.prototype, "nzShowToday", void 0); if (false) { /** @type {?} */ DateRangePickerComponent.prototype.showWeek; /** @type {?} */ DateRangePickerComponent.prototype.nzDateRender; /** @type {?} */ DateRangePickerComponent.prototype.nzDisabledTime; /** @type {?} */ DateRangePickerComponent.prototype.nzRenderExtraFooter; /** @type {?} */ DateRangePickerComponent.prototype.nzShowToday; /** @type {?} */ DateRangePickerComponent.prototype.nzMode; /** @type {?} */ DateRangePickerComponent.prototype.nzRanges; /** @type {?} */ DateRangePickerComponent.prototype.nzOnPanelChange; /** * @type {?} * @private */ DateRangePickerComponent.prototype._showTime; /** @type {?} */ DateRangePickerComponent.prototype.nzOnOk; /** @type {?} */ DateRangePickerComponent.prototype.pickerStyle; /** @type {?} */ DateRangePickerComponent.prototype.extraFooter; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGF0ZS1yYW5nZS1waWNrZXIuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6Im5nOi8vbmctem9ycm8tYW50ZC15ai8iLCJzb3VyY2VzIjpbImRhdGUtcGlja2VyL2RhdGUtcmFuZ2UtcGlja2VyLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLE9BQU8sRUFDTCxpQkFBaUIsRUFDakIsU0FBUyxFQUNULFlBQVksRUFDWixLQUFLLEVBR0wsTUFBTSxFQUdQLE1BQU0sZUFBZSxDQUFDO0FBRXZCLE9BQU8sRUFBRSxzQkFBc0IsRUFBRSxNQUFNLGdEQUFnRCxDQUFDO0FBRXhGLE9BQU8sRUFBRSxTQUFTLEVBQUUsaUJBQWlCLEVBQUUsWUFBWSxFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFDbEYsT0FBTyxFQUFFLGFBQWEsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBR3hELE9BQU8sRUFBRSxpQkFBaUIsRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQ2hFLE9BQU8sRUFBRSx1QkFBdUIsRUFBa0IsTUFBTSw2QkFBNkIsQ0FBQztBQU10RixNQUFNLE9BQU8sd0JBQXlCLFNBQVEsdUJBQXVCOzs7Ozs7O0lBNkJuRSxZQUNFLElBQW1CLEVBQ25CLEdBQXNCLEVBQ3RCLFVBQTZCLEVBQzdCLFdBQW9DO1FBRXBDLEtBQUssQ0FBQyxJQUF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