Skip to content
This repository was archived by the owner on Dec 21, 2022. It is now read-only.

Commit c3ff6c3

Browse files
fix(calendar): fix more events not respecting clicked date
1 parent a00fa05 commit c3ff6c3

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

packages-web/calendar/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "calendar",
33
"widgetName": "Calendar",
4-
"version": "1.0.5",
4+
"version": "1.0.6",
55
"description": "Display and manage calendar events",
66
"copyright": "Mendix BV",
77
"repository": {

packages-web/calendar/src/components/Calendar.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,17 @@ export interface CalendarEvent {
6565
title: string;
6666
}
6767

68-
class Calendar extends Component<CalendarProps> {
68+
interface State {
69+
date?: Date;
70+
}
71+
72+
class Calendar extends Component<CalendarProps, State> {
73+
readonly state: State = {
74+
date: undefined
75+
};
76+
77+
private readonly onNavigateHandler = this.onNavigate.bind(this);
78+
6979
render(): ReactNode {
7080
return createElement(
7181
SizeContainer,
@@ -125,6 +135,10 @@ class Calendar extends Component<CalendarProps> {
125135
return createElement(Alert, { className: "widget-calendar-alert" }, this.props.alertMessage);
126136
}
127137

138+
private onNavigate(date: Date): void {
139+
this.setState({ date });
140+
}
141+
128142
private renderCalendar(): ReactNode {
129143
const wrapToolbar = (injectedProps: HOCToolbarProps): Function => (toolbarProps: Container.ToolbarProps) =>
130144
createElement(CustomToolbar as any, { ...injectedProps, ...toolbarProps });
@@ -136,8 +150,9 @@ class Calendar extends Component<CalendarProps> {
136150
components: {
137151
toolbar: wrapToolbar({ customViews: this.getToolbarProps(), onClickToolbarButton: this.onRangeChange })
138152
},
153+
onNavigate: this.onNavigateHandler,
139154
eventPropGetter: this.eventColor,
140-
date: this.props.startPosition,
155+
date: this.state.date ?? this.props.startPosition,
141156
defaultView: this.defaultView(),
142157
formats: this.props.viewOption === "custom" ? this.props.formats : "",
143158
messages: this.props.viewOption === "custom" ? this.props.messages : "",

packages-web/calendar/src/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<package xmlns="http://www.mendix.com/package/1.0/">
3-
<clientModule name="Calendar2" version="1.0.5" xmlns="http://www.mendix.com/clientModule/1.0/">
3+
<clientModule name="Calendar2" version="1.0.6" xmlns="http://www.mendix.com/clientModule/1.0/">
44
<widgetFiles>
55
<widgetFile path="Calendar.xml"/>
66
</widgetFiles>

0 commit comments

Comments
 (0)