PromucFlow_constructor/app/client/src/actions/widgetActions.tsx

65 lines
1.4 KiB
TypeScript
Raw Normal View History

2020-01-30 13:23:04 +00:00
import {
ReduxActionTypes,
ReduxAction,
ReduxActionErrorTypes,
} from "constants/ReduxActionConstants";
import {
2020-02-18 10:41:52 +00:00
ExecuteActionPayload,
2020-01-30 13:23:04 +00:00
ExecuteErrorPayload,
PageAction,
} from "constants/ActionConstants";
2020-04-13 08:24:13 +00:00
import { BatchAction, batchAction } from "actions/batchActions";
export const executeAction = (
2020-02-18 10:41:52 +00:00
payload: ExecuteActionPayload,
): ReduxAction<ExecuteActionPayload> => {
return {
type: ReduxActionTypes.EXECUTE_ACTION,
2020-02-18 10:41:52 +00:00
payload,
};
};
2019-11-20 08:10:01 +00:00
2020-01-30 13:23:04 +00:00
export const executeActionError = (
executeErrorPayload: ExecuteErrorPayload,
): ReduxAction<ExecuteErrorPayload> => ({
type: ReduxActionErrorTypes.EXECUTE_ACTION_ERROR,
payload: executeErrorPayload,
});
export const executePageLoadActions = (
2020-01-30 10:55:37 +00:00
payload: PageAction[][],
): ReduxAction<PageAction[][]> => ({
type: ReduxActionTypes.EXECUTE_PAGE_LOAD_ACTIONS,
payload,
});
export const disableDragAction = (
disable: boolean,
2020-01-20 09:00:37 +00:00
): ReduxAction<{ disable: boolean }> => {
return {
type: ReduxActionTypes.DISABLE_WIDGET_DRAG,
payload: {
2020-01-20 09:00:37 +00:00
disable,
},
};
};
2020-04-03 09:32:13 +00:00
export const createModalAction = (
modalName: string,
): ReduxAction<{ modalName: string }> => {
return {
type: ReduxActionTypes.CREATE_MODAL_INIT,
2020-04-03 09:32:13 +00:00
payload: {
modalName,
},
};
};
2020-04-13 08:24:13 +00:00
export const focusWidget = (
widgetId?: string,
): BatchAction<{ widgetId?: string }> =>
batchAction({
type: ReduxActionTypes.FOCUS_WIDGET,
payload: { widgetId },
});