Skip to content

Commit c4ccb3b

Browse files
committed
chore: update and cleanup
1 parent 8b4134b commit c4ccb3b

File tree

5 files changed

+34
-62
lines changed

5 files changed

+34
-62
lines changed

packages/pluggableWidgets/calendar-web/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
},
2121
"packagePath": "com.mendix.widget.web",
2222
"marketplace": {
23-
"minimumMXVersion": "9.24.0",
24-
"appNumber": 224259,
23+
"minimumMXVersion": "10.22.0",
24+
"appNumber": 107954,
2525
"appName": "Calendar",
2626
"reactReady": true
2727
},
@@ -30,25 +30,25 @@
3030
"branchName": "calendar-web"
3131
},
3232
"scripts": {
33-
"build": "pluggable-widgets-tools build:web",
33+
"build": "cross-env MPKOUTPUT=Calendar.mpk pluggable-widgets-tools build:web",
3434
"create-gh-release": "rui-create-gh-release",
3535
"create-translation": "rui-create-translation",
36-
"dev": "pluggable-widgets-tools start:web",
36+
"dev": "cross-env MPKOUTPUT=Calendar.mpk pluggable-widgets-tools start:web",
3737
"e2e": "echo \"Skipping this e2e test\"",
3838
"e2edev": "run-e2e dev --with-preps",
3939
"format": "pluggable-widgets-tools format",
4040
"lint": "eslint --ext .jsx,.js,.ts,.tsx src/",
4141
"publish-marketplace": "rui-publish-marketplace",
42-
"release": "pluggable-widgets-tools release:web",
43-
"start": "pluggable-widgets-tools start:server",
42+
"release": "cross-env MPKOUTPUT=Calendar.mpk pluggable-widgets-tools release:web",
43+
"start": "cross-env MPKOUTPUT=Calendar.mpk pluggable-widgets-tools start:server",
4444
"test": "cross-env TZ=UTC jest --projects jest.config.js",
4545
"update-changelog": "rui-update-changelog-widget",
4646
"verify": "rui-verify-package-format"
4747
},
4848
"dependencies": {
4949
"classnames": "^2.5.1",
5050
"date-fns": "^4.1.0",
51-
"react-big-calendar": "^1.17.1"
51+
"react-big-calendar": "^1.19.4"
5252
},
5353
"devDependencies": {
5454
"@mendix/automation-utils": "workspace:*",
@@ -60,7 +60,7 @@
6060
"@mendix/widget-plugin-hooks": "workspace:*",
6161
"@mendix/widget-plugin-platform": "workspace:*",
6262
"@mendix/widget-plugin-test-utils": "workspace:*",
63-
"@types/react-big-calendar": "^1.16.1",
63+
"@types/react-big-calendar": "^1.16.2",
6464
"cross-env": "^7.0.3"
6565
}
6666
}

packages/pluggableWidgets/calendar-web/src/Calendar.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@
6262
</attributeTypes>
6363
</property>
6464
</propertyGroup>
65+
</propertyGroup>
66+
<propertyGroup caption="Customization">
6567
<propertyGroup caption="Options">
6668
<property key="view" type="enumeration" defaultValue="standard">
6769
<caption>View</caption>

packages/pluggableWidgets/calendar-web/src/helpers/CalendarPropsBuilder.ts

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -152,30 +152,4 @@ export class CalendarPropsBuilder {
152152

153153
return new Set(visibleDays);
154154
}
155-
156-
// private handleEventDropOrResize = ({ event, start, end }: EventDropOrResize): void => {
157-
// const action = this.props.onDragDropResize?.get(event.item);
158-
159-
// if (action?.canExecute) {
160-
// action.execute({
161-
// oldStart: event.start,
162-
// oldEnd: event.end,
163-
// newStart: start,
164-
// newEnd: end
165-
// });
166-
// }
167-
// };
168-
169-
// private handleRangeChange = (date: Date, view: string, _action: NavigateAction): void => {
170-
// const action = this.props.onViewRangeChange;
171-
172-
// if (action?.canExecute) {
173-
// const { start, end } = getViewRange(view, date);
174-
// action.execute({
175-
// rangeStart: start,
176-
// rangeEnd: end,
177-
// currentView: view
178-
// });
179-
// }
180-
// };
181155
}

packages/pluggableWidgets/calendar-web/src/helpers/useCalendarEvents.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ export function useCalendarEvents(props: CalendarContainerProps): CalendarEventH
3636
}
3737

3838
clickRef.current = setTimeout(() => {
39-
console.log("handleSelectEvent", event);
4039
if (event.item.id === selected?.item.id) {
4140
invokeEdit(event);
4241
} else {
@@ -55,7 +54,6 @@ export function useCalendarEvents(props: CalendarContainerProps): CalendarEventH
5554
}
5655

5756
clickRef.current = setTimeout(() => {
58-
console.log("handleDoubleClickEvent", event);
5957
invokeEdit(event);
6058
}, 250);
6159
},
@@ -64,7 +62,6 @@ export function useCalendarEvents(props: CalendarContainerProps): CalendarEventH
6462

6563
const handleKeyPressEvent = useCallback(
6664
(event: CalendarEvent, e: any) => {
67-
console.log("handleKeyPressEvent", event, e);
6865
if (e.key === "Enter" && selected?.item.id === event.item.id) {
6966
invokeEdit(event);
7067
}
@@ -74,14 +71,16 @@ export function useCalendarEvents(props: CalendarContainerProps): CalendarEventH
7471

7572
const handleCreateEvent = useCallback(
7673
(slotInfo: { start: Date; end: Date; action: string }) => {
77-
console.log("handleCreateEvent", slotInfo);
7874
const action = onCreateEvent;
7975

8076
if (action?.canExecute && enableCreate) {
77+
// is all day : if the difference between start and end is a multiple of 24 hours
78+
const isAllday =
79+
((slotInfo.end.getTime() - slotInfo.start.getTime()) / (24 * 60 * 60 * 1000)) % 1 === 0;
8180
action?.execute({
8281
startDate: slotInfo.start,
8382
endDate: slotInfo.end,
84-
allDay: slotInfo.action === "select"
83+
allDay: isAllday
8584
});
8685
}
8786
},
@@ -131,9 +130,6 @@ export function useCalendarEvents(props: CalendarContainerProps): CalendarEventH
131130
}
132131
};
133132
}, []);
134-
// private invokeEdit(event: CalendarEvent): void {
135-
136-
// }
137133

138134
return {
139135
onSelectEvent: handleSelectEvent,

pnpm-lock.yaml

Lines changed: 20 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)