UNPKG

@progress/kendo-angular-scheduler

Version:

Kendo UI Scheduler Angular - Outlook or Google-style angular scheduler calendar. Full-featured and customizable embedded scheduling from the creator developers trust for professional UI components.

105 lines (104 loc) 3.78 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { Input, HostBinding, ElementRef, Directive } from '@angular/core'; import { isDocumentAvailable } from '@progress/kendo-angular-common'; import { LocalizationService } from '@progress/kendo-angular-l10n'; import { BaseSlotService } from './base-slot.service'; import * as i0 from "@angular/core"; import * as i1 from "./base-slot.service"; import * as i2 from "@progress/kendo-angular-l10n"; /** * @hidden */ export class BaseSlotDirective { element; slotService; localization; id; get slotIndex() { return this.key; } get start() { return this._start; } set start(value) { this._start = value; } get end() { return this._end; } set end(value) { this._end = value; } _rect = null; _start; _end; constructor(element, slotService, localization) { this.element = element; this.slotService = slotService; this.localization = localization; } get rect() { if (this._rect) { return this._rect; } const el = this.nativeElement; this._rect = { left: !this.localization.rtl ? el.offsetLeft : this.slotService.containerSize - (el.offsetLeft + el.clientWidth), top: el.offsetTop, width: el.clientWidth, height: el.clientHeight }; return this._rect; } get top() { return this.element ? this.nativeElement.offsetTop : 0; } get padding() { if (!this.element || !isDocumentAvailable()) { return 0; } return parseInt(window.getComputedStyle(this.nativeElement).paddingTop, 10) * 2; } get height() { return this.element ? this.nativeElement.offsetHeight : 0; } set height(value) { if (this.element) { this.nativeElement.style.height = `${value}px`; } if (this._rect) { this._rect.height = value; } } get width() { return this.element ? this.nativeElement.offsetWidth : 0; } get key() { return `${this.id.resourceIndex}:${this.id.rangeIndex}:${this.id.index}`; } get nativeElement() { return this.element.nativeElement; } ngOnInit() { this.slotService.registerSlot(this); } ngOnDestroy() { this.slotService.unregisterSlot(this); } invalidate() { this._rect = null; } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BaseSlotDirective, deps: [{ token: i0.ElementRef }, { token: i1.BaseSlotService }, { token: i2.LocalizationService }], target: i0.ɵɵFactoryTarget.Directive }); static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: BaseSlotDirective, inputs: { id: "id" }, host: { properties: { "attr.data-slot-index": "this.slotIndex" } }, ngImport: i0 }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BaseSlotDirective, decorators: [{ type: Directive }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.BaseSlotService }, { type: i2.LocalizationService }]; }, propDecorators: { id: [{ type: Input }], slotIndex: [{ type: HostBinding, args: ['attr.data-slot-index'] }] } });