UNPKG

@taskgenius/calendar

Version:

A lightweight, configurable TypeScript calendar component with drag-and-drop support

3 lines (2 loc) 2.59 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./presets-BUMiolmt.cjs"),r=require("./adapters/dayjs.cjs"),t=require("./adapters/native.cjs"),a=require("./adapters/date-fns.cjs");function n(){return(e,r=0)=>r>0?`${e.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${e}:00`}class s extends e.Calendar{constructor(r,t={}){var a;const n=t.viewRegistry??new e.ViewRegistry,s=(null==(a=t.view)?void 0:a.type)??"week";0!==n.size&&n.has(s)||(n.has("month")||n.register(e.MonthView),n.has("week")||n.register(e.WeekView),n.has("day")||n.register(e.DayView)),super(r,{...t,viewRegistry:n})}}exports.BaseView=e.BaseView,exports.CalendarCore=e.Calendar,exports.DayView=e.DayView,exports.DragController=e.DragController,exports.EventManager=e.EventManager,exports.InteractionController=e.InteractionController,exports.MonthEngine=e.MonthEngine,exports.MonthRenderer=e.MonthRenderer,exports.MonthView=e.MonthView,exports.TimeEngine=e.TimeEngine,exports.TimeRenderer=e.TimeRenderer,exports.TimeView=e.TimeView,exports.ViewRegistry=e.ViewRegistry,exports.WeekView=e.WeekView,exports.applyThemeVariables=e.applyThemeVariables,exports.clearThemeVariables=e.clearThemeVariables,exports.createCalendar=e.createCalendar,exports.createDayCalendar=e.createDayCalendar,exports.createFullCalendar=e.createFullCalendar,exports.createMonthCalendar=e.createMonthCalendar,exports.createViewRegistry=e.createViewRegistry,exports.createWeekCalendar=e.createWeekCalendar,exports.registerBuiltInViews=e.registerBuiltInViews,exports.DayJsAdapter=r.DayJsAdapter,exports.NativeDateAdapter=t.NativeDateAdapter,exports.DateFnsAdapter=a.DateFnsAdapter,exports.Calendar=s,exports.customTimeLabels=function(e,r){const t=r||((e,r=0)=>r>0?`${e.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${e}:00`);return(r,a=0)=>e[r]||t(r,a)},exports.format12h=function(){return(e,r=0)=>{const t=e>=12?"PM":"AM",a=e%12||12;return r>0?`${a}:${r.toString().padStart(2,"0")} ${t}`:`${a} ${t}`}},exports.format24h=n,exports.formatCompact=function(){return(e,r=0)=>r>0?`${e}:${r.toString().padStart(2,"0")}`:`${e}`},exports.hideDays=function(e){return(r,t)=>!e.includes(t.dayOfWeek)},exports.hideHours=function(e){return r=>!e.includes(r)},exports.hideWeekdays=function(){return(e,r)=>r.isWeekend},exports.hideWeekends=function(){return(e,r)=>!r.isWeekend},exports.onlyDays=function(e){return(r,t)=>e.includes(t.dayOfWeek)},exports.onlyHours=function(e){return r=>e.includes(r)},exports.workingHours=function(e=8,r=18){return t=>t>=e&&t<r}; //# sourceMappingURL=index.cjs.map