Skip to content

Commit ecc5c8d

Browse files
Merge branch 'dev' into fix/table-styles
2 parents 4ab618b + 1828fba commit ecc5c8d

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

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

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {
3232
hiddenPropertyView,
3333
ChangeEventHandlerControl,
3434
DragEventHandlerControl,
35+
CalendarEventHandlerControl,
3536
Section,
3637
sectionNames,
3738
dropdownControl,
@@ -45,7 +46,9 @@ import {
4546
CalendarDeleteIcon,
4647
Tooltip,
4748
useMergeCompStyles,
48-
} from "lowcoder-sdk";
49+
EditorContext,
50+
CompNameContext,
51+
} from 'lowcoder-sdk';
4952

5053
import {
5154
DefaultWithFreeViewOptions,
@@ -76,7 +79,7 @@ let childrenMap: any = {
7679
resourcesEvents: jsonValueExposingStateControl("resourcesEvents", resourcesEventsDefaultData),
7780
resources: jsonValueExposingStateControl("resources", resourcesDefaultData),
7881
resourceName: withDefault(StringControl, trans("calendar.resourcesDefault")),
79-
onEvent: ChangeEventHandlerControl,
82+
onEvent: CalendarEventHandlerControl,
8083
// onDropEvent: safeDragEventHandlerControl,
8184
editable: withDefault(BoolControl, true),
8285
showEventTime: withDefault(BoolControl, true),
@@ -120,6 +123,12 @@ let CalendarBasicComp = (function () {
120123
currentFreeView?: string;
121124
currentPremiumView?: string;
122125
}, dispatch: any) => {
126+
127+
const comp = useContext(EditorContext).getUICompByName(
128+
useContext(CompNameContext)
129+
);
130+
const onEventVal = comp?.toJsonValue().comp.onEvent;
131+
123132

124133
const theme = useContext(ThemeContext);
125134
const ref = createRef<HTMLDivElement>();
@@ -303,7 +312,12 @@ let CalendarBasicComp = (function () {
303312
};
304313
showModal(eventInfo, true);
305314
} else {
306-
showModal(editEvent.current, false);
315+
if (onEventVal && onEventVal.some((e: any) => e.name === 'doubleClick')) {
316+
// Check if 'doubleClick' is included in the array
317+
props.onEvent('doubleClick');
318+
} else {
319+
showModal(editEvent.current as EventType, false);
320+
}
307321
}
308322
};
309323

@@ -433,7 +447,6 @@ let CalendarBasicComp = (function () {
433447
props.onDropEvent("dropEvent");
434448
}
435449
};
436-
437450
return (
438451
<Wrapper
439452
ref={ref}

client/packages/lowcoder/src/comps/controls/eventHandlerControl.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,11 @@ export const DragEventHandlerControl = eventHandlerControl([
700700
dropEvent,
701701
] as const);
702702

703+
export const CalendarEventHandlerControl = eventHandlerControl([
704+
changeEvent,
705+
doubleClickEvent,
706+
] as const);
707+
703708
export const ElementEventHandlerControl = eventHandlerControl([
704709
openEvent,
705710
editedEvent,

0 commit comments

Comments
 (0)