2022-04-12 10:50:01 +00:00
|
|
|
import {
|
|
|
|
|
ReduxActionTypes,
|
|
|
|
|
ReduxAction,
|
2022-11-23 09:48:23 +00:00
|
|
|
ReduxActionType,
|
2022-04-12 10:50:01 +00:00
|
|
|
} from "@appsmith/constants/ReduxActionConstants";
|
2022-11-14 04:19:25 +00:00
|
|
|
import { UpdateWidgetsPayload } from "reducers/entityReducers/canvasWidgetsReducer";
|
2021-02-25 14:00:02 +00:00
|
|
|
import { DynamicPath } from "utils/DynamicBindingUtils";
|
2019-09-18 10:19:50 +00:00
|
|
|
|
2020-02-26 12:44:56 +00:00
|
|
|
export const updateWidgetPropertyRequest = (
|
2019-09-18 10:19:50 +00:00
|
|
|
widgetId: string,
|
2021-01-25 08:57:26 +00:00
|
|
|
propertyPath: string,
|
2019-09-18 10:19:50 +00:00
|
|
|
propertyValue: any,
|
2020-02-26 12:44:56 +00:00
|
|
|
): ReduxAction<UpdateWidgetPropertyRequestPayload> => {
|
2019-09-18 10:19:50 +00:00
|
|
|
return {
|
2019-11-06 06:35:15 +00:00
|
|
|
type: ReduxActionTypes.UPDATE_WIDGET_PROPERTY_REQUEST,
|
2019-09-18 10:19:50 +00:00
|
|
|
payload: {
|
|
|
|
|
widgetId,
|
2021-01-25 08:57:26 +00:00
|
|
|
propertyPath,
|
2019-09-18 10:19:50 +00:00
|
|
|
propertyValue,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-03-01 09:45:54 +00:00
|
|
|
export interface BatchPropertyUpdatePayload {
|
|
|
|
|
modify?: Record<string, unknown>; //Key value pairs of paths and values to update
|
|
|
|
|
remove?: string[]; //Array of paths to delete
|
2021-04-23 05:43:13 +00:00
|
|
|
triggerPaths?: string[]; // Array of paths in the modify and remove list which are trigger paths
|
2022-11-23 09:48:23 +00:00
|
|
|
postUpdateAction?: ReduxActionType; // Array of action types we need to dispatch after propert updates.
|
2021-03-01 09:45:54 +00:00
|
|
|
}
|
|
|
|
|
|
2021-01-25 08:57:26 +00:00
|
|
|
export const batchUpdateWidgetProperty = (
|
|
|
|
|
widgetId: string,
|
2021-03-01 09:45:54 +00:00
|
|
|
updates: BatchPropertyUpdatePayload,
|
2021-09-21 07:55:56 +00:00
|
|
|
shouldReplay = true,
|
2021-01-25 08:57:26 +00:00
|
|
|
): ReduxAction<UpdateWidgetPropertyPayload> => ({
|
|
|
|
|
type: ReduxActionTypes.BATCH_UPDATE_WIDGET_PROPERTY,
|
|
|
|
|
payload: {
|
|
|
|
|
widgetId,
|
|
|
|
|
updates,
|
2021-09-21 07:55:56 +00:00
|
|
|
shouldReplay,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
export const batchUpdateMultipleWidgetProperties = (
|
|
|
|
|
updatesArray: UpdateWidgetPropertyPayload[],
|
|
|
|
|
): ReduxAction<{ updatesArray: UpdateWidgetPropertyPayload[] }> => ({
|
|
|
|
|
type: ReduxActionTypes.BATCH_UPDATE_MULTIPLE_WIDGETS_PROPERTY,
|
|
|
|
|
payload: {
|
|
|
|
|
updatesArray,
|
2021-01-25 08:57:26 +00:00
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export const deleteWidgetProperty = (
|
|
|
|
|
widgetId: string,
|
2021-02-16 10:29:08 +00:00
|
|
|
propertyPaths: string[],
|
2021-01-25 08:57:26 +00:00
|
|
|
): ReduxAction<DeleteWidgetPropertyPayload> => ({
|
|
|
|
|
type: ReduxActionTypes.DELETE_WIDGET_PROPERTY,
|
|
|
|
|
payload: {
|
|
|
|
|
widgetId,
|
2021-02-16 10:29:08 +00:00
|
|
|
propertyPaths,
|
2021-01-25 08:57:26 +00:00
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
2020-02-26 12:44:56 +00:00
|
|
|
export const setWidgetDynamicProperty = (
|
|
|
|
|
widgetId: string,
|
2021-01-25 08:57:26 +00:00
|
|
|
propertyPath: string,
|
2020-02-26 12:44:56 +00:00
|
|
|
isDynamic: boolean,
|
2022-05-04 09:45:57 +00:00
|
|
|
shouldRejectDynamicBindingPathList = true,
|
2020-02-26 12:44:56 +00:00
|
|
|
): ReduxAction<SetWidgetDynamicPropertyPayload> => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.SET_WIDGET_DYNAMIC_PROPERTY,
|
|
|
|
|
payload: {
|
|
|
|
|
widgetId,
|
2021-01-25 08:57:26 +00:00
|
|
|
propertyPath,
|
2020-02-26 12:44:56 +00:00
|
|
|
isDynamic,
|
2022-05-04 09:45:57 +00:00
|
|
|
shouldRejectDynamicBindingPathList,
|
2020-02-26 12:44:56 +00:00
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2022-11-14 04:19:25 +00:00
|
|
|
export const updateMultipleWidgetPropertiesAction = (
|
|
|
|
|
widgetsToUpdate: UpdateWidgetsPayload,
|
feat: Non auto height invisible widgets (#20118)
## Description
This PR adds another feature update we had planned for Auto Height
- [ ] For new applications, in View and Preview mode, any widget which
is invisible will let go of its space and collapse if it's either on the
main Canvas or a container-like widget which has Auto-height enabled.
- [ ] Widgets within a container-like Widget, say Tabs, that doesn't
have Auto-height enabled, will now let go of their space if they're
invisible.
- [ ] The experience in Edit mode has not changed.
TL;DR: In new applications, in the Preview and Published _AKA_ View
modes, if a widget is invisible and within an Auto-height-enabled
container like a Tab, a Modal, a Form, or the main Canvas, it will fully
collapse, allowing widgets below it to move up and take its space. This
changes the behavior today prior to the release of this PR for
Auto-height-enabled widgets.
Fixes #19983
Fixes #18681
2023-02-14 13:36:19 +00:00
|
|
|
shouldEval = false,
|
2022-11-14 04:19:25 +00:00
|
|
|
) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.UPDATE_MULTIPLE_WIDGET_PROPERTIES,
|
feat: Non auto height invisible widgets (#20118)
## Description
This PR adds another feature update we had planned for Auto Height
- [ ] For new applications, in View and Preview mode, any widget which
is invisible will let go of its space and collapse if it's either on the
main Canvas or a container-like widget which has Auto-height enabled.
- [ ] Widgets within a container-like Widget, say Tabs, that doesn't
have Auto-height enabled, will now let go of their space if they're
invisible.
- [ ] The experience in Edit mode has not changed.
TL;DR: In new applications, in the Preview and Published _AKA_ View
modes, if a widget is invisible and within an Auto-height-enabled
container like a Tab, a Modal, a Form, or the main Canvas, it will fully
collapse, allowing widgets below it to move up and take its space. This
changes the behavior today prior to the release of this PR for
Auto-height-enabled widgets.
Fixes #19983
Fixes #18681
2023-02-14 13:36:19 +00:00
|
|
|
payload: { widgetsToUpdate, shouldEval },
|
2022-11-14 04:19:25 +00:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-02-26 12:44:56 +00:00
|
|
|
export interface UpdateWidgetPropertyRequestPayload {
|
2019-09-18 10:19:50 +00:00
|
|
|
widgetId: string;
|
2021-01-25 08:57:26 +00:00
|
|
|
propertyPath: string;
|
2019-09-18 10:19:50 +00:00
|
|
|
propertyValue: any;
|
2020-02-26 12:44:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface UpdateWidgetPropertyPayload {
|
|
|
|
|
widgetId: string;
|
2021-03-01 09:45:54 +00:00
|
|
|
updates: BatchPropertyUpdatePayload;
|
2021-02-25 14:00:02 +00:00
|
|
|
dynamicUpdates?: {
|
2022-07-14 07:02:35 +00:00
|
|
|
dynamicBindingPathList?: DynamicPath[];
|
|
|
|
|
dynamicTriggerPathList?: DynamicPath[];
|
|
|
|
|
dynamicPropertyPathList?: DynamicPath[];
|
2021-02-25 14:00:02 +00:00
|
|
|
};
|
2021-09-21 07:55:56 +00:00
|
|
|
shouldReplay?: boolean;
|
2020-02-26 12:44:56 +00:00
|
|
|
}
|
|
|
|
|
|
2021-11-23 08:01:46 +00:00
|
|
|
export interface UpdateCanvasLayoutPayload {
|
2021-03-03 05:26:47 +00:00
|
|
|
width: number;
|
2021-03-16 05:01:37 +00:00
|
|
|
height: number;
|
2023-01-09 05:24:41 +00:00
|
|
|
scale: number;
|
2021-03-03 05:26:47 +00:00
|
|
|
}
|
|
|
|
|
|
2020-02-26 12:44:56 +00:00
|
|
|
export interface SetWidgetDynamicPropertyPayload {
|
|
|
|
|
widgetId: string;
|
2021-01-25 08:57:26 +00:00
|
|
|
propertyPath: string;
|
2020-02-26 12:44:56 +00:00
|
|
|
isDynamic: boolean;
|
2022-05-04 09:45:57 +00:00
|
|
|
shouldRejectDynamicBindingPathList?: boolean;
|
2019-11-14 09:28:51 +00:00
|
|
|
}
|
2021-01-25 08:57:26 +00:00
|
|
|
|
|
|
|
|
export interface DeleteWidgetPropertyPayload {
|
|
|
|
|
widgetId: string;
|
2021-02-16 10:29:08 +00:00
|
|
|
propertyPaths: string[];
|
2021-01-25 08:57:26 +00:00
|
|
|
}
|