UNPKG

@progress/kendo-react-scheduler

Version:

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

48 lines (47 loc) 1.77 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 o from "react"; import { useIsomorphicLayoutEffect as S, COLLECTION_ACTION as a } from "@progress/kendo-react-common"; import { useSchedulerViewItemsContext as x } from "../context/SchedulerViewContext.mjs"; const v = (m, l) => { const { _ref: p, itemRef: I, _maxSiblingsPerSlot: t, _siblings: c, _order: n } = m, r = o.useRef(null), i = o.useRef(null), [, s] = x(); return o.useImperativeHandle(r, () => ({ element: i.current, props: m, get _maxSiblingsPerSlot() { return t == null ? void 0 : t.current; }, set _maxSiblingsPerSlot(e) { var d; e != null && t !== void 0 && t.current !== void 0 && (t.current = e, (d = c == null ? void 0 : c.current) == null || d.forEach((u) => { var f; !u || u._maxSiblingsPerSlot === e || e < ((f = u._maxSiblingsPerSlot) != null ? f : 0) || (u._maxSiblingsPerSlot = e); })); }, get _order() { return n == null ? void 0 : n.current; }, set _order(e) { e !== void 0 && n !== void 0 && n.current !== void 0 && (n.current = e); } })), o.useImperativeHandle(l, () => r.current), o.useImperativeHandle(p, () => r.current), o.useImperativeHandle(I, () => r.current), S(() => (s({ type: a.add, item: r }), () => { s({ type: a.remove, item: r }); })), { item: r, element: i }; }; export { v as useSchedulerItem };