UNPKG

ng-zorro-antd-yj

Version:

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

324 lines 28.6 kB
/** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ import { CdkConnectedOverlay, CdkOverlayOrigin } from '@angular/cdk/overlay'; import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, EventEmitter, Input, Output, ViewChild, ViewEncapsulation } from '@angular/core'; import { slideMotion } from '../core/animation/slide'; import { DateHelperService } from '../i18n/date-helper.service'; export class NzPickerComponent { /** * @param {?} dateHelper * @param {?} changeDetector */ constructor(dateHelper, changeDetector) { this.dateHelper = dateHelper; this.changeDetector = changeDetector; this.noAnimation = false; this.isRange = false; this.open = undefined; this.valueChange = new EventEmitter(); this.openChange = new EventEmitter(); // Emitted when overlay's open state change this.prefixCls = 'ant-calendar'; this.animationOpenState = false; this.overlayOpen = false; // Available when "open"=undefined // Available when "open"=undefined this.overlayOffsetY = 0; this.overlayOffsetX = -2; this.overlayPositions = (/** @type {?} */ ([ { // offsetX: -10, // TODO: What a pity, cdk/overlay current not support offset configs even though it already provide these properties // offsetY: -10, originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'top' }, { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'bottom' }, { originX: 'end', originY: 'top', overlayX: 'end', overlayY: 'top' }, { originX: 'end', originY: 'bottom', overlayX: 'end', overlayY: 'bottom' } ])); this.dropdownAnimation = 'bottom'; this.currentPositionX = 'start'; this.currentPositionY = 'top'; } /** * @return {?} */ get realOpenState() { // The value that really decide the open state of overlay return this.isOpenHandledByUser() ? !!this.open : this.overlayOpen; } /** * @return {?} */ ngOnInit() { } /** * @return {?} */ ngAfterViewInit() { if (this.autoFocus) { if (this.isRange) { /** @type {?} */ const firstInput = (/** @type {?} */ (((/** @type {?} */ (this.pickerInput.nativeElement))).querySelector('input:first-child'))); firstInput.focus(); // Focus on the first input } else { this.pickerInput.nativeElement.focus(); } } } // Show overlay content /** * @return {?} */ showOverlay() { if (!this.realOpenState) { this.overlayOpen = true; this.openChange.emit(this.overlayOpen); setTimeout((/** * @return {?} */ () => { if (this.cdkConnectedOverlay && this.cdkConnectedOverlay.overlayRef) { this.cdkConnectedOverlay.overlayRef.updatePosition(); } })); } } /** * @return {?} */ hideOverlay() { if (this.realOpenState) { this.overlayOpen = false; this.openChange.emit(this.overlayOpen); } } /** * @return {?} */ onClickInputBox() { if (!this.disabled && !this.isOpenHandledByUser()) { this.showOverlay(); } } /** * @return {?} */ onClickBackdrop() { this.hideOverlay(); } /** * @return {?} */ onOverlayDetach() { this.hideOverlay(); } // NOTE: A issue here, the first time position change, the animation will not be triggered. // Because the overlay's "positionChange" event is emitted after the content's full shown up. // All other components like "nz-dropdown" which depends on overlay also has the same issue. // See: https://github.com/NG-ZORRO/ng-zorro-antd/issues/1429 /** * @param {?} position * @return {?} */ onPositionChange(position) { this.dropdownAnimation = position.connectionPair.originY === 'top' ? 'bottom' : 'top'; this.currentPositionX = (/** @type {?} */ (position.connectionPair.originX)); this.currentPositionY = (/** @type {?} */ (position.connectionPair.originY)); this.changeDetector.detectChanges(); // Take side-effects to position styles } /** * @param {?} event * @return {?} */ onClickClear(event) { event.preventDefault(); event.stopPropagation(); this.value = this.isRange ? [] : null; this.valueChange.emit(this.value); } /** * @param {?=} partType * @return {?} */ getReadableValue(partType) { /** @type {?} */ let value; if (this.isRange) { value = ((/** @type {?} */ (this.value)))[this.getPartTypeIndex((/** @type {?} */ (partType)))]; } else { value = (/** @type {?} */ (this.value)); } return value ? this.dateHelper.format(value.nativeDate, this.format) : null; } /** * @param {?} partType * @return {?} */ getPartTypeIndex(partType) { return { left: 0, right: 1 }[partType]; } /** * @param {?=} partType * @return {?} */ getPlaceholder(partType) { return this.isRange ? this.placeholder[this.getPartTypeIndex((/** @type {?} */ (partType)))] : ((/** @type {?} */ (this.placeholder))); } /** * @param {?} value * @return {?} */ isEmptyValue(value) { if (value === null) { return true; } else if (this.isRange) { return !value || !Array.isArray(value) || value.every((/** * @param {?} val * @return {?} */ val => !val)); } else { return !value; } } // Whether open state is permanently controlled by user himself /** * @return {?} */ isOpenHandledByUser() { return this.open !== undefined; } /** * @return {?} */ animationStart() { if (this.realOpenState) { this.animationOpenState = true; } } /** * @return {?} */ animationDone() { this.animationOpenState = this.realOpenState; } } NzPickerComponent.decorators = [ { type: Component, args: [{ encapsulation: ViewEncapsulation.None, selector: 'nz-picker', template: "<span\n cdkOverlayOrigin\n #origin=\"cdkOverlayOrigin\"\n class=\"{{ prefixCls }}-picker {{ size ? prefixCls + '-picker-' + size : '' }} {{ className }}\"\n [ngStyle]=\"style\"\n tabindex=\"0\"\n (click)=\"onClickInputBox()\"\n>\n <!-- Content of single picker -->\n <ng-container *ngIf=\"!isRange\">\n <input\n #pickerInput\n class=\"{{ prefixCls }}-picker-input ant-input\"\n [class.ant-input-lg]=\"size === 'large'\"\n [class.ant-input-sm]=\"size === 'small'\"\n [class.ant-input-disabled]=\"disabled\"\n\n [disabled]=\"disabled\"\n readonly\n value=\"{{ getReadableValue() }}\"\n placeholder=\"{{ getPlaceholder() }}\"\n />\n <ng-container *ngTemplateOutlet=\"tplRightRest\"></ng-container>\n </ng-container>\n\n <!-- Content of range picker -->\n <ng-container *ngIf=\"isRange\">\n <span\n #pickerInput\n class=\"{{ prefixCls }}-picker-input ant-input\"\n [class.ant-input-lg]=\"size === 'large'\"\n [class.ant-input-sm]=\"size === 'small'\"\n [class.ant-input-disabled]=\"disabled\"\n >\n <ng-container *ngTemplateOutlet=\"tplRangeInput; context: { partType: 'left' }\"></ng-container>\n <span class=\"{{ prefixCls }}-range-picker-separator\"> ~ </span>\n <ng-container *ngTemplateOutlet=\"tplRangeInput; context: { partType: 'right' }\"></ng-container>\n <ng-container *ngTemplateOutlet=\"tplRightRest\"></ng-container>\n </span>\n </ng-container>\n</span>\n\n<!-- Input for Range ONLY -->\n<ng-template #tplRangeInput let-partType=\"partType\">\n <input\n class=\"{{ prefixCls }}-range-picker-input\"\n [disabled]=\"disabled\"\n readonly\n value=\"{{ getReadableValue(partType) }}\"\n placeholder=\"{{ getPlaceholder(partType) }}\"\n />\n</ng-template>\n\n<!-- Right operator icons -->\n<ng-template #tplRightRest>\n <i\n nz-icon\n type=\"close-circle\"\n theme=\"fill\"\n *ngIf=\"!disabled && !isEmptyValue(value) && allowClear\"\n class=\"{{ prefixCls }}-picker-clear\"\n (click)=\"onClickClear($event)\"\n ></i>\n <span class=\"{{ prefixCls }}-picker-icon\">\n <i nz-icon type=\"calendar\"></i>\n </span>\n</ng-template>\n\n<!-- Overlay -->\n<ng-template\n cdkConnectedOverlay\n nzConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"origin\"\n [cdkConnectedOverlayOpen]=\"realOpenState\"\n [cdkConnectedOverlayHasBackdrop]=\"!isOpenHandledByUser()\"\n [cdkConnectedOverlayPositions]=\"overlayPositions\"\n (positionChange)=\"onPositionChange($event)\"\n (backdropClick)=\"onClickBackdrop()\"\n (detach)=\"onOverlayDetach()\"\n>\n <div\n [nzNoAnimation]=\"noAnimation\"\n [@slideMotion]=\"dropdownAnimation\"\n (@slideMotion.start)=\"animationStart()\"\n (@slideMotion.done)=\"animationDone()\"\n style=\"position: relative;\"\n [style.left]=\"currentPositionX === 'start' ? '-2px' : '2px'\"\n [style.top]=\"currentPositionY === 'top' ? '-2px' : '2px'\"\n > <!-- Compatible for overlay that not support offset dynamically and immediately -->\n <ng-content></ng-content>\n </div>\n</ng-template>", animations: [slideMotion], changeDetection: ChangeDetectionStrategy.OnPush }] } ]; /** @nocollapse */ NzPickerComponent.ctorParameters = () => [ { type: DateHelperService }, { type: ChangeDetectorRef } ]; NzPickerComponent.propDecorators = { noAnimation: [{ type: Input }], isRange: [{ type: Input }], open: [{ type: Input }], disabled: [{ type: Input }], placeholder: [{ type: Input }], allowClear: [{ type: Input }], autoFocus: [{ type: Input }], className: [{ type: Input }], format: [{ type: Input }], size: [{ type: Input }], style: [{ type: Input }], value: [{ type: Input }], valueChange: [{ type: Output }], openChange: [{ type: Output }], origin: [{ type: ViewChild, args: ['origin',] }], cdkConnectedOverlay: [{ type: ViewChild, args: [CdkConnectedOverlay,] }], pickerInput: [{ type: ViewChild, args: ['pickerInput',] }] }; if (false) { /** @type {?} */ NzPickerComponent.prototype.noAnimation; /** @type {?} */ NzPickerComponent.prototype.isRange; /** @type {?} */ NzPickerComponent.prototype.open; /** @type {?} */ NzPickerComponent.prototype.disabled; /** @type {?} */ NzPickerComponent.prototype.placeholder; /** @type {?} */ NzPickerComponent.prototype.allowClear; /** @type {?} */ NzPickerComponent.prototype.autoFocus; /** @type {?} */ NzPickerComponent.prototype.className; /** @type {?} */ NzPickerComponent.prototype.format; /** @type {?} */ NzPickerComponent.prototype.size; /** @type {?} */ NzPickerComponent.prototype.style; /** @type {?} */ NzPickerComponent.prototype.value; /** @type {?} */ NzPickerComponent.prototype.valueChange; /** @type {?} */ NzPickerComponent.prototype.openChange; /** @type {?} */ NzPickerComponent.prototype.origin; /** @type {?} */ NzPickerComponent.prototype.cdkConnectedOverlay; /** @type {?} */ NzPickerComponent.prototype.pickerInput; /** @type {?} */ NzPickerComponent.prototype.prefixCls; /** @type {?} */ NzPickerComponent.prototype.animationOpenState; /** @type {?} */ NzPickerComponent.prototype.overlayOpen; /** @type {?} */ NzPickerComponent.prototype.overlayOffsetY; /** @type {?} */ NzPickerComponent.prototype.overlayOffsetX; /** @type {?} */ NzPickerComponent.prototype.overlayPositions; /** @type {?} */ NzPickerComponent.prototype.dropdownAnimation; /** @type {?} */ NzPickerComponent.prototype.currentPositionX; /** @type {?} */ NzPickerComponent.prototype.currentPositionY; /** * @type {?} * @private */ NzPickerComponent.prototype.dateHelper; /** * @type {?} * @private */ NzPickerComponent.prototype.changeDetector; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGlja2VyLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiJuZzovL25nLXpvcnJvLW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