2023-03-04 07:25:54 +00:00
|
|
|
import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants";
|
2023-10-04 08:54:16 +00:00
|
|
|
import type { LayoutSystemTypes } from "layoutSystems/types";
|
2023-04-07 13:51:35 +00:00
|
|
|
import type { CanvasWidgetsReduxState } from "reducers/entityReducers/canvasWidgetsReducer";
|
|
|
|
|
import type {
|
|
|
|
|
CONVERSION_STATES,
|
|
|
|
|
SnapShotDetails,
|
|
|
|
|
} from "reducers/uiReducers/layoutConversionReducer";
|
2023-03-04 07:25:54 +00:00
|
|
|
|
2023-04-07 13:51:35 +00:00
|
|
|
/**
|
|
|
|
|
* Calculate size and position changes owing to minSizes and flex wrap.
|
|
|
|
|
* This function is triggered the first time mobile viewport (480px) is encountered.
|
|
|
|
|
* It is also called when increasing viewport size from mobile to desktop.
|
|
|
|
|
*/
|
2023-03-04 07:25:54 +00:00
|
|
|
export const updateLayoutForMobileBreakpointAction = (
|
|
|
|
|
parentId: string,
|
|
|
|
|
isMobile: boolean,
|
|
|
|
|
canvasWidth: number,
|
2023-04-07 13:51:35 +00:00
|
|
|
widgets?: CanvasWidgetsReduxState,
|
|
|
|
|
) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.RECALCULATE_COLUMNS,
|
|
|
|
|
payload: {
|
|
|
|
|
parentId,
|
|
|
|
|
isMobile,
|
|
|
|
|
canvasWidth,
|
|
|
|
|
widgets,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2023-10-04 08:54:16 +00:00
|
|
|
export const updateLayoutSystemType = (layoutSystemType: LayoutSystemTypes) => {
|
2023-04-07 13:51:35 +00:00
|
|
|
return {
|
2023-10-04 08:54:16 +00:00
|
|
|
type: ReduxActionTypes.UPDATE_LAYOUT_SYSTEM_TYPE,
|
|
|
|
|
payload: layoutSystemType,
|
2023-04-07 13:51:35 +00:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const setLayoutConversionStateAction = (
|
|
|
|
|
conversionState: CONVERSION_STATES,
|
|
|
|
|
error?: Error,
|
|
|
|
|
) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.SET_LAYOUT_CONVERSION_STATE,
|
|
|
|
|
payload: { conversionState, error },
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const updateSnapshotDetails = (
|
|
|
|
|
snapShotDetails: SnapShotDetails | undefined,
|
|
|
|
|
) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.UPDATE_SNAPSHOT_DETAILS,
|
|
|
|
|
payload: snapShotDetails,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
export function updateWidgetDimensionAction(
|
|
|
|
|
widgetId: string,
|
|
|
|
|
width: number,
|
|
|
|
|
height: number,
|
|
|
|
|
) {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.UPDATE_WIDGET_DIMENSIONS,
|
|
|
|
|
payload: {
|
|
|
|
|
widgetId,
|
|
|
|
|
width,
|
|
|
|
|
height,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-19 05:22:07 +00:00
|
|
|
export const fetchSnapshotDetailsAction = () => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.FETCH_LAYOUT_SNAPSHOT_DETAILS,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2023-04-07 13:51:35 +00:00
|
|
|
export const setConversionStart = (conversionState: CONVERSION_STATES) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.START_CONVERSION_FLOW,
|
|
|
|
|
payload: conversionState,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const setConversionStop = () => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.STOP_CONVERSION_FLOW,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const setAutoCanvasResizing = (isAutoCanvasResizing: boolean) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.SET_AUTO_CANVAS_RESIZING,
|
|
|
|
|
payload: isAutoCanvasResizing,
|
|
|
|
|
};
|
|
|
|
|
};
|
2023-05-11 04:45:14 +00:00
|
|
|
|
|
|
|
|
export const updatePositionsOnTabChange = (
|
|
|
|
|
widgetId: string,
|
|
|
|
|
selectedTabWidgetId: string,
|
|
|
|
|
) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.UPDATE_POSITIONS_ON_TAB_CHANGE,
|
|
|
|
|
payload: { selectedTabWidgetId, widgetId },
|
|
|
|
|
};
|
|
|
|
|
};
|