Skip to content

Commit 1a3d073

Browse files
added switch to show resource events in free view
1 parent c02f94b commit 1a3d073

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

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

+8
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ let childrenMap: any = {
204204
currentPremiumView: dropdownControl(DefaultWithPremiumViewOptions, "resourceTimelineDay"),
205205
animationStyle: styleControl(AnimationStyle, 'animationStyle'),
206206
showVerticalScrollbar: withDefault(BoolControl, false),
207+
showResourceEventsInFreeView: withDefault(BoolControl, false),
207208
initialData: stateComp<JSONObject>({}),
208209
updatedEvents: stateComp<JSONObject>({}),
209210
insertedEvents: stateComp<JSONObject>({}),
@@ -248,6 +249,7 @@ let CalendarBasicComp = (function () {
248249
animationStyle?:any;
249250
modalStyle?:any;
250251
showVerticalScrollbar?:boolean;
252+
showResourceEventsInFreeView?: boolean;
251253
initialData: Array<EventType>;
252254
inputFormat: string;
253255
}, dispatch: any) => {
@@ -291,12 +293,16 @@ let CalendarBasicComp = (function () {
291293
]);
292294

293295
const currentEvents = useMemo(() => {
296+
if (props.showResourceEventsInFreeView && Boolean(props.licenseKey)) {
297+
return props.events.filter((event: { resourceId: any; }) => Boolean(event.resourceId))
298+
}
294299
return currentView == "resourceTimelineDay" || currentView == "resourceTimeGridDay"
295300
? props.events.filter((event: { resourceId: any; }) => Boolean(event.resourceId))
296301
: props.events.filter((event: { resourceId: any; }) => !Boolean(event.resourceId));
297302
}, [
298303
currentView,
299304
props.events,
305+
props.showResourceEventsInFreeView,
300306
])
301307

302308
// we use one central stack of events for all views
@@ -1072,6 +1078,7 @@ let CalendarBasicComp = (function () {
10721078
modalStyle: { getPropertyView: () => any; };
10731079
licenseKey: { getView: () => any; propertyView: (arg0: { label: string; }) => any; };
10741080
showVerticalScrollbar: { propertyView: (arg0: { label: string; }) => any; };
1081+
showResourceEventsInFreeView: { propertyView: (arg0: { label: string; }) => any; };
10751082
inputFormat: { propertyView: (arg0: {}) => any; };
10761083
}) => {
10771084
const license = children.licenseKey.getView();
@@ -1134,6 +1141,7 @@ let CalendarBasicComp = (function () {
11341141
: children.currentPremiumView.propertyView({ label: trans("calendar.defaultView"), tooltip: trans("calendar.defaultViewTooltip"), })}
11351142
{children.firstDay.propertyView({ label: trans("calendar.startWeek"), })}
11361143
{children.showVerticalScrollbar.propertyView({ label: trans("calendar.showVerticalScrollbar")})}
1144+
{Boolean(license) && children.showResourceEventsInFreeView.propertyView({ label: trans("calendar.showResourceEventsInFreeView")})}
11371145
</Section>
11381146
<Section name={sectionNames.style}>
11391147
{children.style.getPropertyView()}

client/packages/lowcoder-comps/src/i18n/comps/locales/en.ts

+1
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,7 @@ export const en = {
473473
animationDuration:"Duration",
474474
animationIterationCount:"IterationCount",
475475
showVerticalScrollbar:"Show Vertical ScrollBar",
476+
showResourceEventsInFreeView:"Show Resource Events In Free View",
476477
inputFormat: "Input Format",
477478
reference: "Please Refer to",
478479
},

0 commit comments

Comments
 (0)