ngx-bootstrap
Version:
Angular Bootstrap
47 lines • 2.19 kB
JavaScript
import { ChangeDetectionStrategy, Component, ElementRef, Input, Renderer2 } from '@angular/core';
import { BsDatepickerConfig } from '../../bs-datepicker.config';
export class BsDatepickerDayDecoratorComponent {
constructor(_config, _elRef, _renderer) {
this._config = _config;
this._elRef = _elRef;
this._renderer = _renderer;
this.day = { date: new Date(), label: '' };
}
ngOnInit() {
var _a, _b, _c;
if (((_a = this.day) === null || _a === void 0 ? void 0 : _a.isToday) && this._config && this._config.customTodayClass) {
this._renderer.addClass(this._elRef.nativeElement, this._config.customTodayClass);
}
if (typeof ((_b = this.day) === null || _b === void 0 ? void 0 : _b.customClasses) === 'string') {
(_c = this.day) === null || _c === void 0 ? void 0 : _c.customClasses.split(' ').filter((className) => className).forEach((className) => {
this._renderer.addClass(this._elRef.nativeElement, className);
});
}
}
}
BsDatepickerDayDecoratorComponent.decorators = [
{ type: Component, args: [{
selector: '[bsDatepickerDayDecorator]',
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
'[class.disabled]': 'day.isDisabled',
'[class.is-highlighted]': 'day.isHovered',
'[class.is-other-month]': 'day.isOtherMonth',
'[class.is-active-other-month]': 'day.isOtherMonthHovered',
'[class.in-range]': 'day.isInRange',
'[class.select-start]': 'day.isSelectionStart',
'[class.select-end]': 'day.isSelectionEnd',
'[class.selected]': 'day.isSelected'
},
template: `{{ day && day.label || '' }}`
},] }
];
BsDatepickerDayDecoratorComponent.ctorParameters = () => [
{ type: BsDatepickerConfig },
{ type: ElementRef },
{ type: Renderer2 }
];
BsDatepickerDayDecoratorComponent.propDecorators = {
day: [{ type: Input }]
};
//# sourceMappingURL=bs-datepicker-day-decorator.directive.js.map