@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.46 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2026 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("react"),v=require("@progress/kendo-react-intl"),d=require("@progress/kendo-react-buttons"),f=require("@progress/kendo-react-common"),C=require("@progress/kendo-svg-icons"),w=require("../../../context/SchedulerContext.js");function y(n){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const s in n)if(s!=="default"){const o=Object.getOwnPropertyDescriptor(n,s);Object.defineProperty(r,s,o.get?o:{enumerable:!0,get:()=>n[s]})}}return r.default=n,Object.freeze(r)}const t=y(S),b=t.forwardRef(()=>{const n=t.useRef(null),[r,s]=t.useState("desktop"),o=w.useSchedulerViewsContext(),u=f.useWindow(n),[p,c]=w.useSchedulerActiveViewContext(),i=o.find(e=>e.props.name===p),a=v.useLocalization(),g=t.useCallback(e=>{c&&(e.syntheticEvent.preventDefault(),c(e.item.name))},[c]),h=t.useCallback(e=>{c&&c(e)},[c]),k=t.useMemo(()=>o.map(e=>({value:e.props.name,text:typeof e.props.title=="function"?e.props.title(a):e.props.title,tabIndex:-1})),[o,a]),m=()=>{u().matchMedia&&s(u().matchMedia("(min-width: 1024px)").matches?"desktop":"mobile")};return t.useEffect(()=>{m();const e=u().ResizeObserver,l=e&&new e(m);return l&&l.observe(n.current),()=>{l&&l.disconnect()}},[]),t.createElement(t.Fragment,null,i&&r==="mobile"&&t.createElement("div",{className:"k-scheduler-tools",ref:n},t.createElement(d.DropDownButton,{className:"k-views-dropdown",onItemClick:g,popupSettings:{popupClass:"k-scheduler-toolbar"},textField:"title",items:o.map(e=>({...e.props,selected:e.props.name===p,title:typeof e.props.title=="function"?e.props.title(a):e.props.title})),text:t.createElement(t.Fragment,null,typeof i.props.title=="function"?i.props.title(a):i.props.title,t.createElement(f.IconWrap,{name:"chevron-down",icon:C.chevronDownIcon}))})),r==="desktop"&&t.createElement(d.SegmentedControl,{ref:e=>{e&&(n.current=e.element)},className:"k-scheduler-views",role:"group",value:p,onChange:h,items:k}))});b.displayName="KendoReactSchedulerViewSelectorList";exports.ViewSelectorList=b;