fixes: calendar and form widgets (#7735)

This commit is contained in:
Arpit 2023-10-11 13:36:30 +05:30 committed by GitHub
parent 30452d94d5
commit 277e616180
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 4 deletions

View file

@ -81,7 +81,7 @@ export const Calendar = function ({
action,
};
fireEvent('onCalendarSlotSelect', { selectedSlots });
fireEvent('onCalendarSlotSelect', { component, selectedSlots });
};
function popoverClosed() {
@ -153,7 +153,7 @@ export const Calendar = function ({
min={startTime}
max={endTime}
onSelectEvent={(calendarEvent, e) => {
fireEvent('onCalendarEventSelect', { calendarEvent });
fireEvent('onCalendarEventSelect', { component, calendarEvent });
if (properties.showPopOverOnEventClick)
setEventPopoverOptions({
...eventPopoverOptions,

View file

@ -8,6 +8,7 @@ import { Box } from '@/Editor/Box';
import { generateUIComponents } from './FormUtils';
import { useMounted } from '@/_hooks/use-mount';
import { removeFunctionObjects } from '@/_helpers/appUtils';
import { useAppInfo } from '@/_stores/appDataStore';
export const Form = function Form(props) {
const {
id,
@ -28,6 +29,10 @@ export const Form = function Form(props) {
dataCy,
paramUpdated,
} = props;
const { events: allAppEvents } = useAppInfo();
const formEvents = allAppEvents.filter((event) => event.target === 'component' && event.sourceId === id);
const { visibility, disabledState, borderRadius, borderColor, boxShadow } = styles;
const { buttonToSubmit, loadingState, advanced, JSONSchema } = properties;
const backgroundColor =
@ -57,7 +62,7 @@ export const Form = function Form(props) {
});
setExposedVariable('submitForm', async function () {
if (isValid) {
onEvent('onSubmit', { component }).then(() => resetComponent());
onEvent('onSubmit', formEvents).then(() => resetComponent());
} else {
fireEvent('onInvalid');
}
@ -167,7 +172,7 @@ export const Form = function Form(props) {
};
const fireSubmissionEvent = () => {
if (isValid) {
onEvent('onSubmit', { component }).then(() => resetComponent());
onEvent('onSubmit', formEvents).then(() => resetComponent());
} else {
fireEvent('onInvalid');
}

View file

@ -639,6 +639,7 @@ export async function onEvent(_ref, eventName, events, options = {}, mode = 'edi
if (eventName === 'onCalendarEventSelect') {
const { component, calendarEvent } = options;
useCurrentStateStore.getState().actions.setCurrentState({
components: {
...getCurrentState().components,
@ -648,6 +649,7 @@ export async function onEvent(_ref, eventName, events, options = {}, mode = 'edi
},
},
});
executeActionsForEventId(_ref, 'onCalendarEventSelect', events, mode, customVariables);
}
@ -662,6 +664,7 @@ export async function onEvent(_ref, eventName, events, options = {}, mode = 'edi
},
},
});
executeActionsForEventId(_ref, 'onCalendarSlotSelect', events, mode, customVariables);
}