UNPKG

@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.97 kB
/** * @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"),q=require("@progress/kendo-react-common"),B=require("../hooks/useSchedulerSlot.js");function F(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const o=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(r,a,o.get?o:{enumerable:!0,get:()=>e[a]})}}return r.default=e,Object.freeze(r)}const n=F(T),m=n.forwardRef((e,r)=>{const{onFocus:a,onBlur:o,onClick:c,onMouseEnter:u,onMouseLeave:s,onMouseOut:d,onMouseOver:i,onDoubleClick:k,onKeyDown:b,onKeyPress:f,onKeyUp:y}=e,{slot:l,element:C}=B.useSchedulerSlot(e,r),S=e.tabIndex!==void 0?e.tabIndex===null?void 0:e.tabIndex:e.selected?0:-1,D=n.useMemo(()=>{var v,h;const t=(v=e.isWorkHour)!=null?v:g.isWorkHour,I=(h=e.isWorkDay)!=null?h:g.isWorkDay;return q.classNames("k-scheduler-cell",e.className,"k-slot-cell",{"k-nonwork-hour":!t||!I,"k-selected":e.selected})},[e.className,e.selected,e.isWorkHour,e.isWorkDay]),M=n.useMemo(()=>({userSelect:"none",...e.style}),[e.style]),O=n.useCallback(t=>{a&&a.call(void 0,{syntheticEvent:t,target:l.current})},[a,l]),K=n.useCallback(t=>{o&&o.call(void 0,{syntheticEvent:t,target:l.current})},[o,l]),W=n.useCallback(t=>{c&&c.call(void 0,{syntheticEvent:t,target:l.current})},[c,l]),x=n.useCallback(t=>{i&&i.call(void 0,{syntheticEvent:t,target:l.current})},[i,l]),P=n.useCallback(t=>{d&&d.call(void 0,{syntheticEvent:t,target:l.current})},[d,l]),w=n.useCallback(t=>{u&&u.call(void 0,{syntheticEvent:t,target:l.current})},[u,l]),N=n.useCallback(t=>{s&&s.call(void 0,{syntheticEvent:t,target:l.current})},[s,l]),j=n.useCallback(t=>{k&&k.call(void 0,{syntheticEvent:t,target:l.current})},[k,l]),H=n.useCallback(t=>{b&&b.call(void 0,{syntheticEvent:t,target:l.current})},[b,l]),R=n.useCallback(t=>{f&&f.call(void 0,{syntheticEvent:t,target:l.current})},[f,l]),E=n.useCallback(t=>{y&&y.call(void 0,{syntheticEvent:t,target:l.current})},[y,l]);return n.createElement("div",{ref:C,id:e.id,style:M,className:D,tabIndex:S,"aria-selected":e.selected||void 0,onFocus:O,onBlur:K,onClick:W,onMouseEnter:w,onMouseLeave:N,onMouseOver:x,onMouseOut:P,onDoubleClick:j,onKeyDown:H,onKeyPress:R,onKeyUp:E,"data-slot":!0,"data-slot-allday":e.isAllDay,"data-slot-start":e.start.getTime(),"data-slot-end":e.end.getTime(),"data-slot-group":e.group.index,"data-slot-range":e.range.index,"data-slot-index":e.index},e.children)}),g={isWorkHour:!0,isWorkDay:!0};m.displayName="KendoReactSchedulerSlot";exports.SchedulerSlot=m;exports.schedulerSlotDefaultProps=g;