Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1786173

Browse files
author
FalkWolsky
committed
Improving conditional withMethodExposing rendering for backwards compatibility
1 parentf253a14 commit1786173

File tree

2 files changed

+26
-15
lines changed

2 files changed

+26
-15
lines changed

‎client/packages/lowcoder-comps/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name":"lowcoder-comps",
3-
"version":"0.0.37",
3+
"version":"0.0.38",
44
"type":"module",
55
"license":"MIT",
66
"dependencies": {

‎client/packages/lowcoder-comps/src/comps/calendarComp/calendarComp.tsx‎

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ import {
4343
jsonValueExposingStateControl,
4444
CalendarDeleteIcon,
4545
Tooltip,
46+
AbstractComp,
47+
MultiBaseComp,
4648
}from"lowcoder-sdk";
4749

4850
import{
@@ -71,6 +73,7 @@ import {
7173

7274
// this should ensure backwards compatibility with older versions of the SDK
7375
constsafeDragEventHandlerControl=typeofDragEventHandlerControl!=='undefined' ?DragEventHandlerControl :()=>{};
76+
constisVariantCompAvailable=typeofAbstractComp!=='undefined'&&AbstractComp!==null&&typeofMultiBaseComp!=='undefined'&&MultiBaseComp!==null;
7477

7578
constchildrenMap={
7679
events:jsonValueExposingStateControl("events",defaultData),
@@ -624,17 +627,25 @@ const TmpCalendarComp = withExposingConfigs(CalendarBasicComp, [
624627
NameConfigHidden,
625628
]);
626629

627-
exportconstCalendarComp=withMethodExposing(TmpCalendarComp,[
628-
{
629-
method:{
630-
name:"setCalendarView",
631-
description:"timeGridWeek || timeGridDay || dayGridMonth || listWeek || resourceTimelineDay || resourceTimeGridDay || resourceTimelineWeek || resourceTimelineMonth",
632-
params:[{name:"viewType",type:"string"}],
633-
},
634-
execute:(comp,values)=>{
635-
constviewType=values[0]asstring;
636-
viewType=="" ?viewType :"timeGridWeek";
637-
returncomp.children.licenseKey.getView()=="" ?comp.children.defaultFreeView.dispatchChangeValueAction(viewType) :comp.children.defaultPremiumView.dispatchChangeValueAction(viewType);
638-
}
639-
},
640-
]);
630+
letCalendarComp;
631+
632+
if(isVariantCompAvailable){
633+
CalendarComp=withMethodExposing(TmpCalendarComp,[
634+
{
635+
method:{
636+
name:"setCalendarView",
637+
description:"Sets the view of the calendar to a specified type",
638+
params:[{name:"viewType",type:"string"}],
639+
},
640+
execute:(comp,values)=>{
641+
constviewType=values[0]asstring||"timeGridWeek";// Default to "timeGridWeek" if undefined
642+
constviewKey=comp.children.licenseKey.getView()==="" ?'defaultFreeView' :'defaultPremiumView';
643+
comp.children[viewKey].dispatchChangeValueAction(viewType);
644+
}
645+
},
646+
]);
647+
}else{
648+
CalendarComp=TmpCalendarComp;
649+
}
650+
651+
export{CalendarComp};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp