@progress/kendo-react-scheduler
Version:
React Scheduler brings the functionality of Outlook's Calendar to a single UI component. KendoReact Scheduler package
9 lines (8 loc) • 2.1 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("react"),a=require("@progress/kendo-react-common"),w=require("../context/SchedulerViewContext.js"),d=require("../hooks/use-items-selection.js"),S=require("../hooks/use-slots-selection.js"),m=require("../hooks/useCellSync.js"),x=require("../hooks/use-items-focus.js"),E=require("../hooks/use-slots-focus.js");function _(e){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const c=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(l,t,c.get?c:{enumerable:!0,get:()=>e[t]})}}return l.default=e,Object.freeze(l)}const s=_(T),f=s.forwardRef((e,l)=>{const t=s.useRef(null);s.useImperativeHandle(l,()=>t.current);const[c,h]=a.useCollection([]),[i,p]=a.useCollection([]),[I,y]=x.useItemsFocus(c),[C,b]=E.useSlotsFocus(i),[g,o]=d.useItemsSelection(c),[O,n]=S.useSlotsSelection(),k=s.useCallback((u,r)=>{n({type:S.SLOTS_SELECT_ACTION.reset}),o(u,r)},[o,n]),q=s.useCallback((u,r)=>{o({type:d.ITEMS_SELECT_ACTION.reset},r),n(u)},[o,n]),N=s.useMemo(()=>a.classNames("k-scheduler-layout k-scheduler-layout-flex",e.className),[e.className]);return m.useCellSync({element:t,selector:".k-group-cell",attribute:"data-depth-index",explicitDepth:!0}),m.useCellSync({element:t,selector:".k-side-cell",attribute:"data-depth-index",explicitDepth:!1}),s.createElement(w.SchedulerViewContext,{props:e.props,ranges:e.ranges,items:[c,h],slots:[i,p],selectedItems:[g,k],selectedSlots:[O,q],focusedItems:[I,y],focusedSlots:[C,b]},s.createElement("div",{ref:t,style:e.style,className:N,role:"presentation"},e.children))});f.displayName="KendoReactSchedulerBaseView";exports.BaseView=f;