UNPKG

ng-zorro-antd-yj

Version:

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

200 lines 16.4 kB
/** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core'; import { CandyDate } from '../candy-date'; /** @type {?} */ const MAX_ROW = 4; /** @type {?} */ const MAX_COL = 3; export class DecadePanelComponent { constructor() { this.valueChange = new EventEmitter(); this.prefixCls = 'ant-calendar-decade-panel'; } /** * @return {?} */ get startYear() { return parseInt(`${this.value.getYear() / 100}`, 10) * 100; } /** * @return {?} */ get endYear() { return this.startYear + 99; } /** * @param {?} changes * @return {?} */ ngOnChanges(changes) { if (changes.value) { this.render(); } } /** * @return {?} */ previousCentury() { this.gotoYear(-100); } /** * @return {?} */ nextCentury() { this.gotoYear(100); } /** * @param {?} _index * @param {?} decadeData * @return {?} */ trackPanelDecade(_index, decadeData) { return decadeData.content; } /** * @private * @return {?} */ render() { if (this.value) { this.panelDecades = this.makePanelDecades(); } } // Re-render panel content by the header's buttons (NOTE: Do not try to trigger final value change) /** * @private * @param {?} amount * @return {?} */ gotoYear(amount) { this.value = this.value.addYears(amount); // this.valueChange.emit(this.value); // Do not try to trigger final value change this.render(); } /** * @private * @param {?} startYear * @return {?} */ chooseDecade(startYear) { this.value = this.value.setYear(startYear); this.valueChange.emit(this.value); } /** * @private * @return {?} */ makePanelDecades() { /** @type {?} */ const decades = []; /** @type {?} */ const currentYear = this.value.getYear(); /** @type {?} */ const startYear = this.startYear; /** @type {?} */ const endYear = this.endYear; /** @type {?} */ const previousYear = startYear - 10; /** @type {?} */ let index = 0; for (let rowIndex = 0; rowIndex < MAX_ROW; rowIndex++) { decades[rowIndex] = []; for (let colIndex = 0; colIndex < MAX_COL; colIndex++) { /** @type {?} */ const start = previousYear + index * 10; /** @type {?} */ const end = previousYear + index * 10 + 9; /** @type {?} */ const content = `${start}-${end}`; /** @type {?} */ const cell = (decades[rowIndex][colIndex] = { content, title: content, isCurrent: currentYear >= start && currentYear <= end, isLowerThanStart: end < startYear, isBiggerThanEnd: start > endYear, classMap: null, onClick: null }); cell.classMap = { [`${this.prefixCls}-cell`]: true, [`${this.prefixCls}-selected-cell`]: cell.isCurrent, [`${this.prefixCls}-last-century-cell`]: cell.isLowerThanStart, [`${this.prefixCls}-next-century-cell`]: cell.isBiggerThanEnd }; if (cell.isLowerThanStart) { cell.onClick = (/** * @return {?} */ () => this.previousCentury()); } else if (cell.isBiggerThanEnd) { cell.onClick = (/** * @return {?} */ () => this.nextCentury()); } else { cell.onClick = (/** * @return {?} */ () => this.chooseDecade(start)); } index++; } } return decades; } } DecadePanelComponent.decorators = [ { type: Component, args: [{ encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, // tslint:disable-next-line:component-selector selector: 'decade-panel', template: "<div class=\"{{ prefixCls }}\">\n <div class=\"{{ prefixCls }}-header\">\n <a\n class=\"{{ prefixCls }}-prev-century-btn\"\n role=\"button\"\n (click)=\"previousCentury()\"\n title=\"{{ locale.previousCentury }}\"\n ></a>\n\n <div class=\"{{ prefixCls }}-century\">\n {{ startYear }}-{{ endYear }}\n </div>\n <a\n class=\"{{ prefixCls }}-next-century-btn\"\n role=\"button\"\n (click)=\"nextCentury()\"\n title=\"{{ locale.nextCentury }}\"\n ></a>\n </div>\n <div class=\"{{ prefixCls }}-body\">\n <table class=\"{{ prefixCls }}-table\" cellSpacing=\"0\" role=\"grid\">\n <tbody class=\"{{ prefixCls }}-tbody\">\n <tr *ngFor=\"let row of panelDecades\" role=\"row\">\n <td *ngFor=\"let cell of row; trackBy: trackPanelDecade\"\n role=\"gridcell\"\n title=\"{{ cell.title }}\"\n (click)=\"cell.onClick()\"\n [ngClass]=\"cell.classMap\"\n >\n <a class=\"{{ prefixCls }}-decade\">{{ cell.content }}</a>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n</div>" }] } ]; /** @nocollapse */ DecadePanelComponent.ctorParameters = () => []; DecadePanelComponent.propDecorators = { locale: [{ type: Input }], value: [{ type: Input }], valueChange: [{ type: Output }] }; if (false) { /** @type {?} */ DecadePanelComponent.prototype.locale; /** @type {?} */ DecadePanelComponent.prototype.value; /** @type {?} */ DecadePanelComponent.prototype.valueChange; /** @type {?} */ DecadePanelComponent.prototype.prefixCls; /** @type {?} */ DecadePanelComponent.prototype.panelDecades; } /** * @record */ export function PanelDecadeData() { } if (false) { /** @type {?} */ PanelDecadeData.prototype.content; /** @type {?} */ PanelDecadeData.prototype.title; /** @type {?} */ PanelDecadeData.prototype.isCurrent; /** @type {?} */ PanelDecadeData.prototype.isLowerThanStart; /** @type {?} */ PanelDecadeData.prototype.isBiggerThanEnd; /** @type {?|undefined} */ PanelDecadeData.prototype.classMap; /** @type {?} */ PanelDecadeData.prototype.onClick; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVjYWRlLXBhbmVsLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiJuZzovL25nLXpvcnJvLWFudGQteWovIiwic291cmNlcyI6WyJkYXRlLXBpY2tlci9saWIvZGVjYWRlL2RlY2FkZS1wYW5lbC5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztBQUFBLE9BQU8sRUFDTCx1QkFBdUIsRUFDdkIsU0FBUyxFQUNULFlBQVksRUFDWixLQUFLLEVBRUwsTUFBTSxFQUVOLGlCQUFpQixFQUNsQixNQUFNLGVBQWUsQ0FBQztBQUd2QixPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sZUFBZSxDQUFDOztNQUVwQyxPQUFPLEdBQUcsQ0FBQzs7TUFDWCxPQUFPLEdBQUcsQ0FBQztBQVNqQixNQUFNLE9BQU8sb0JBQW9CO0lBZ0IvQjtRQVptQixnQkFBVyxHQUFHLElBQUksWUFBWSxFQUFhLENBQUM7UUFTL0QsY0FBUyxHQ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XQodGhpcy52YWx1ZSk7XG4gIH1cblxuICBwcml2YXRlIG1ha2VQYW5lbERlY2FkZXMoKTogUGFuZWxEZWNhZGVEYXRhW11bXSB7XG4gICAgY29uc3QgZGVjYWRlczogUGFuZWxEZWNhZGVEYXRhW11bXSA9IFtdO1xuICAgIGNvbnN0IGN1cnJlbnRZZWFyID0gdGhpcy52YWx1ZS5nZXRZZWFyKCk7XG4gICAgY29uc3Qgc3RhcnRZZWFyID0gdGhpcy5zdGFydFllYXI7XG4gICAgY29uc3QgZW5kWWVhciA9IHRoaXMuZW5kWWVhcjtcbiAgICBjb25zdCBwcmV2aW91c1llYXIgPSBzdGFydFllYXIgLSAxMDtcblxuICAgIGxldCBpbmRleCA9IDA7XG4gICAgZm9yIChsZXQgcm93SW5kZXggPSAwOyByb3dJbmRleCA8IE1BWF9ST1c7IHJvd0luZGV4KyspIHtcbiAgICAgIGRlY2FkZXNbcm93SW5kZXhdID0gW107XG4gICAgICBmb3IgKGxldCBjb2xJbmRleCA9IDA7IGNvbEluZGV4IDwgTUFYX0NPTDsgY29sSW5kZXgrKykge1xuICAgICAgICBjb25zdCBzdGFydCA9IHByZXZpb3VzWWVhciArIGluZGV4ICogMTA7XG4gICAgICAgIGNvbnN0IGVuZCA9IHByZXZpb3VzWWVhciArIGluZGV4ICogMTAgKyA5O1xuICAgICAgICBjb25zdCBjb250ZW50ID0gYCR7c3RhcnR9LSR7ZW5kfWA7XG5cbiAgICAgICAgY29uc3QgY2VsbDogUGFuZWxEZWNhZGVEYXRhID0gKGRlY2FkZXNbcm93SW5kZXhdW2NvbEluZGV4XSA9IHtcbiAgICAgICAgICBjb250ZW50LFxuICAgICAgICAgIHRpdGxlOiBjb250ZW50LFxuICAgICAgICAgIGlzQ3VycmVudDogY3VycmVudFllYXIgPj0gc3RhcnQgJiYgY3VycmVudFllYXIgPD0gZW5kLFxuICAgICAgICAgIGlzTG93ZXJUaGFuU3RhcnQ6IGVuZCA8IHN0YXJ0WWVhcixcbiAgIC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