UNPKG

@progress/kendo-angular-gantt

Version:
63 lines (62 loc) 2.99 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { Injectable } from '@angular/core'; import { IntlService } from '@progress/kendo-angular-intl'; import { addDays, getDate } from '@progress/kendo-date-math'; import { MappingService } from '../common/mapping.service'; import { TimelineBaseViewService } from './timeline-base-view.service'; import * as i0 from "@angular/core"; import * as i1 from "@progress/kendo-angular-intl"; import * as i2 from "../common/mapping.service"; /** * @hidden */ export class TimelineWeekViewService extends TimelineBaseViewService { constructor(intlService, mapper) { super(intlService, mapper); } /** * Gets a date a day before the first task start with hours, minutes, seconds, milliseconds cleared. */ getStartOffset(rangeStart) { return addDays(getDate(rangeStart), -1); } /** * Gets a date a day after the last task start with hours, minutes, seconds, milliseconds cleared. */ getEndOffset(rangeEnd) { return addDays(getDate(rangeEnd), 1); } /** * * @param tasks - The tasks which are going to be rendered in the table * @returns {number} */ getTableWidth(tasks) { const timeSlots = this.getSlots(tasks)[1]; const slotWidth = this.options.slotWidth; return Math.round(timeSlots.length * slotWidth); } /** * * @param tasks - The tasks which are going to be rendered in the table * @returns {Array<Object>} - A collection containing the day and hours slots * Used to render the number of columns and the header */ getSlots(tasks) { // will return the header rows slots const slots = []; const { start, end } = this.getRange(tasks); const weeks = this.getWeeks(start, end, this.options.timelineHeadersDateFormat?.groupHeaderDateFormat); const days = this.getDays(start, end, this.options.timelineHeadersDateFormat?.columnHeaderDateFormat); slots.push(weeks, days); return slots; } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TimelineWeekViewService, deps: [{ token: i1.IntlService }, { token: i2.MappingService }], target: i0.ɵɵFactoryTarget.Injectable }); static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TimelineWeekViewService }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TimelineWeekViewService, decorators: [{ type: Injectable }], ctorParameters: () => [{ type: i1.IntlService }, { type: i2.MappingService }] });