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.

55 lines (54 loc) 2.31 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { intersects, toUTCDate, roundAllDayEnd } from '../utils'; import { Pipe } from '@angular/core'; import * as i0 from "@angular/core"; /** * @hidden */ export const createTasks = (periodStart, periodEnd, items) => { const tasks = []; const utcStart = toUTCDate(periodStart); const utcEnd = toUTCDate(periodEnd); for (let index = 0; index < items.length; index++) { const item = items[index]; const event = item.event; const task = { index, start: item.start, end: item.end, event: event, isAllDay: false }; const endTime = event.isAllDay ? roundAllDayEnd(item) : task.end; const startTime = event.isAllDay ? task.start.stripTime() : task.start; task.startTime = startTime.toUTCDate(); task.endTime = endTime.toUTCDate(); if (intersects(task.startTime, task.endTime, utcStart, utcEnd)) { tasks.push(task); task.head = task.endTime > utcEnd; task.tail = task.startTime < utcStart; } } return tasks; }; /** * @hidden */ export class SortPipe { transform(value, ..._args) { return value.sort((item1, item2) => (item1.startTime.getTime() - item2.startTime.getTime())); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SortPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: SortPipe, isStandalone: true, name: "sort" }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SortPipe, decorators: [{ type: Pipe, args: [{ // eslint-disable-next-line @angular-eslint/pipe-prefix name: 'sort', standalone: true }] }] });