@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.42 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
*-------------------------------------------------------------------------------------------
*/
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("react"),g=require("@progress/kendo-react-intl"),S=require("@progress/kendo-react-buttons"),u=require("@progress/kendo-react-common"),v=require("@progress/kendo-svg-icons"),h=require("./ViewSelectorItem.js"),f=require("../../../context/SchedulerContext.js");function y(o){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const r in o)if(r!=="default"){const c=Object.getOwnPropertyDescriptor(o,r);Object.defineProperty(n,r,c.get?c:{enumerable:!0,get:()=>o[r]})}}return n.default=o,Object.freeze(n)}const t=y(k),w=t.forwardRef(()=>{const o=t.useRef(null),[n,r]=t.useState("desktop"),c=f.useSchedulerViewsContext(),l=u.useWindow(o),[p,a]=f.useSchedulerActiveViewContext(),s=c.find(e=>e.props.name===p),d=g.useLocalization(),b=t.useCallback(e=>{a&&(e.syntheticEvent.preventDefault(),a(e.item.name))},[a]),m=()=>{l().matchMedia&&r(l().matchMedia("(min-width: 1024px)").matches?"desktop":"mobile")};return t.useEffect(()=>{m();const e=l().ResizeObserver,i=e&&new e(m);return i&&i.observe(o.current),()=>{i&&i.disconnect()}},[]),t.createElement("div",{className:u.classNames("k-toolbar-button-group k-button-group k-button-group-solid",{"k-scheduler-views":n==="desktop","k-scheduler-tools":n==="mobile"}),role:"group",ref:o},s&&n==="mobile"&&t.createElement(S.DropDownButton,{className:"k-views-dropdown",onItemClick:b,popupSettings:{popupClass:"k-scheduler-toolbar"},textField:"title",items:c.map(e=>({...e.props,selected:e.props.name===p,title:typeof e.props.title=="function"?e.props.title.call(void 0,d):e.props.title})),text:t.createElement(t.Fragment,null,typeof s.props.title=="function"?s.props.title.call(void 0,d):s.props.title,t.createElement(u.IconWrap,{name:"caret-alt-down",icon:v.caretAltDownIcon}))}),n==="desktop"&&t.createElement(t.Fragment,null,c.map(e=>t.createElement(h.ViewSelectorItem,{key:e.props.name,view:e.props}))))});w.displayName="KendoReactSchedulerViewSelectorList";exports.ViewSelectorList=w;