UNPKG

@progress/kendo-react-scheduler

Version:

React Scheduler brings the functionality of Outlook's Calendar to a single UI component. KendoReact Scheduler package

55 lines (54 loc) 2.14 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ import * as f from "react"; import { intersects as u } from "../utils/index.mjs"; import { orderBy as v } from "@progress/kendo-data-query"; import { ZonedDate as m } from "@progress/kendo-date-math"; const S = (i, { timezone: t }, { groups: l, ranges: e }) => { const o = []; return v(i, [ { field: "start", dir: "asc" }, { field: "end", dir: "desc" }, { field: "isAllDay", dir: "desc" } ]).forEach((a) => { l.forEach((s) => { const n = l.length === 1 ? A(a, s) : s; E(a, n) && e.forEach((d) => { if (F(a, d)) { const r = f.createRef(), p = f.createRef(), D = d.end < a.end, R = a.start < d.start, y = m.fromLocalDate(a.start, t), I = m.fromLocalDate(a.end, t), h = { ...a, _ref: p, itemRef: r, head: D, tail: R, order: null, zonedStart: y, zonedEnd: I, group: n, range: d, slots: [], isRecurring: !!a.recurrenceRule, isException: !a.recurrenceRule && a.recurrenceId !== null && a.recurrenceId !== void 0, isAllDay: !!a.isAllDay }; o.push(h); } }); }); }), o; }, A = (i, t) => ({ index: 0, resources: t.resources.filter((l) => B(i, l)) }), B = (i, t) => t.multiple ? (i.dataItem[t.field] || []).some((l) => t[t.valueField] === l) : i.dataItem[t.field] === t[t.valueField], E = (i, t) => !t.resources.some( (l) => l.multiple ? !i.dataItem[l.field].some((e) => l[l.valueField] === e) : i.dataItem[l.field] !== l[l.valueField] ), F = (i, t) => u(t.start, t.end, i.start, i.end) && (t.isAllDay === void 0 || !!i.isAllDay == !!t.isAllDay); export { E as inGroup, F as inRange, S as toItems };