@@ -42,9 +42,7 @@ import {
4242 CustomModal ,
4343 jsonValueExposingStateControl ,
4444 CalendarDeleteIcon ,
45- Tooltip ,
46- AbstractComp ,
47- MultiBaseComp ,
45+ Tooltip
4846} from "lowcoder-sdk" ;
4947
5048import {
@@ -73,7 +71,6 @@ import {
7371
7472// this should ensure backwards compatibility with older versions of the SDK
7573const safeDragEventHandlerControl = typeof DragEventHandlerControl !== 'undefined' ? DragEventHandlerControl : ( ) => { } ;
76- const isVariantCompAvailable = typeof AbstractComp !== 'undefined' && AbstractComp !== null && typeof MultiBaseComp !== 'undefined' && MultiBaseComp !== null ;
7774
7875const childrenMap = {
7976 events : jsonValueExposingStateControl ( "events" , defaultData ) ,
@@ -627,10 +624,9 @@ const TmpCalendarComp = withExposingConfigs(CalendarBasicComp, [
627624 NameConfigHidden ,
628625] ) ;
629626
630- let CalendarComp ;
627+ let CalendarComp = withMethodExposing ( TmpCalendarComp , [
631628
632- if ( isVariantCompAvailable ) {
633- CalendarComp = withMethodExposing ( TmpCalendarComp , [
629+ /* this is not backwards compatible with older versions of the SDK
634630 {
635631 method: {
636632 name: "setCalendarView",
@@ -642,10 +638,109 @@ if (isVariantCompAvailable) {
642638 const viewKey = comp.children.licenseKey.getView() === "" ? 'defaultFreeView' : 'defaultPremiumView';
643639 comp.children[viewKey].dispatchChangeValueAction(viewType);
644640 }
645- } ,
641+ },*/
642+
643+
644+ {
645+ method : {
646+ name : "setResourceTimeGridDayView" ,
647+ description : "Switches the calendar view to 'Resource Time Grid Day', which displays resources along the vertical axis and the hours of a single day along the horizontal axis." ,
648+ params : [ { name : "viewType" , type : "string" } ] ,
649+ } ,
650+ execute : ( comp ) => {
651+ const viewKey = comp . children . licenseKey . getView ( ) === "" ? 'defaultFreeView' : 'defaultPremiumView' ;
652+ comp . children [ "viewKey" ] . dispatchChangeValueAction ( "resourceTimeGridDay" ) ;
653+ }
654+ } ,
655+ {
656+ method : {
657+ name : "setResourceTimelineDayView" ,
658+ description : "Switches the calendar view to 'Resource Timeline Day', showing events against a timeline for a single day, segmented by resources." ,
659+ params : [ { name : "viewType" , type : "string" } ] ,
660+ } ,
661+ execute : ( comp ) => {
662+ const viewKey = comp . children . licenseKey . getView ( ) === "" ? 'defaultFreeView' : 'defaultPremiumView' ;
663+ comp . children [ "viewKey" ] . dispatchChangeValueAction ( "resourceTimelineDay" ) ;
664+ }
665+ } ,
666+ {
667+ method : {
668+ name : "setDayGridWeekView" ,
669+ description : "Switches the calendar view to 'Day Grid Week', where the days of the week are displayed as columns and events are laid out in grid form." ,
670+ params : [ { name : "viewType" , type : "string" } ] ,
671+ } ,
672+ execute : ( comp ) => {
673+ const viewKey = comp . children . licenseKey . getView ( ) === "" ? 'defaultFreeView' : 'defaultPremiumView' ;
674+ comp . children [ "viewKey" ] . dispatchChangeValueAction ( "dayGridWeek" ) ;
675+ }
676+ } ,
677+ {
678+ method : {
679+ name : "setTimeGridWeekView" ,
680+ description : "Switches the calendar view to 'Day Grid Week', where the days of the week are displayed as columns and events are laid out in grid form." ,
681+ params : [ { name : "viewType" , type : "string" } ] ,
682+ } ,
683+ execute : ( comp ) => {
684+ const viewKey = comp . children . licenseKey . getView ( ) === "" ? 'defaultFreeView' : 'defaultPremiumView' ;
685+ comp . children [ "viewKey" ] . dispatchChangeValueAction ( "timeGridWeek" ) ;
686+ }
687+ } ,
688+ {
689+ method : {
690+ name : "setTimeGridDayView" ,
691+ description : "Switches the calendar view to 'Time Grid Day', which shows a detailed hourly schedule for a single day." ,
692+ params : [ { name : "viewType" , type : "string" } ] ,
693+ } ,
694+ execute : ( comp ) => {
695+ const viewKey = comp . children . licenseKey . getView ( ) === "" ? 'defaultFreeView' : 'defaultPremiumView' ;
696+ comp . children [ "viewKey" ] . dispatchChangeValueAction ( "timeGridDay" ) ;
697+ }
698+ } ,
699+ {
700+ method : {
701+ name : "setDayGridDayView" ,
702+ description : "Switches the calendar view to 'Day Grid Day', displaying a single day in a grid layout that includes all events for that day." ,
703+ params : [ { name : "viewType" , type : "string" } ] ,
704+ } ,
705+ execute : ( comp ) => {
706+ const viewKey = comp . children . licenseKey . getView ( ) === "" ? 'defaultFreeView' : 'defaultPremiumView' ;
707+ comp . children [ "viewKey" ] . dispatchChangeValueAction ( "dayGridDay" ) ;
708+ }
709+ } ,
710+ {
711+ method : {
712+ name : "setListWeekView" ,
713+ description : "Switches the calendar view to 'List Week', which provides a list-style overview of all events happening throughout the week." ,
714+ params : [ { name : "viewType" , type : "string" } ] ,
715+ } ,
716+ execute : ( comp ) => {
717+ const viewKey = comp . children . licenseKey . getView ( ) === "" ? 'defaultFreeView' : 'defaultPremiumView' ;
718+ comp . children [ "viewKey" ] . dispatchChangeValueAction ( "listWeek" ) ;
719+ }
720+ } ,
721+ {
722+ method : {
723+ name : "setDayGridMonthView" ,
724+ description : "Switches the calendar view to 'Day Grid Month', presenting the entire month in a grid with events displayed on their respective days." ,
725+ params : [ { name : "viewType" , type : "string" } ] ,
726+ } ,
727+ execute : ( comp ) => {
728+ const viewKey = comp . children . licenseKey . getView ( ) === "" ? 'defaultFreeView' : 'defaultPremiumView' ;
729+ comp . children [ "viewKey" ] . dispatchChangeValueAction ( "dayGridMonth" ) ;
730+ }
731+ } ,
732+ {
733+ method : {
734+ name : "setMultiMonthYearView" ,
735+ description : "Switches the calendar view to 'Multi Month Year', showing multiple months at once, allowing for long-term planning and overview." ,
736+ params : [ { name : "viewType" , type : "string" } ] ,
737+ } ,
738+ execute : ( comp ) => {
739+ const viewKey = comp . children . licenseKey . getView ( ) === "" ? 'defaultFreeView' : 'defaultPremiumView' ;
740+ comp . children [ "viewKey" ] . dispatchChangeValueAction ( "multiMonthYear" ) ;
741+ }
742+ }
646743 ] ) ;
647- } else {
648- CalendarComp = TmpCalendarComp ;
649- }
744+
650745
651746export { CalendarComp } ;
0 commit comments