PromucFlow_constructor/app/client/src/actions/widgetActions.tsx
Ashok Kumar M 8c8141650a
Feature: Widget grouping Phase I (Multi select and Bulk Delete) + Canvas Enhancements. (#4219)
* Feature: Canvas layer enhancements(DIP)

* feedback fixes

* fixing build

* dip

* dip

* dip

* fixing build

* dip

* dev fixes

* dip

* Fixing top bottom resize handles

* dip

* reposition widget name on top edges.

* dip

* dip

* dip

* dip

* renaming selectedWidget to lastSelectedWidget

* code clean up

* Fixing list widget as per grid scale.

* Fixing existing specs.

* Adding migration test cases.

* dip

* FIxing proppane in modal.

* fixing modal z-indedx.

* fix for modal name.

* dip

* dip

* dip

* adding test cases for hotkeys.

* dip

* dip

* fixing build

* Trying some performance improvements for jests.

* 17 mins with runinband lets try without it.

* minor bug fixes.

* code clean up

* save migrated app on fetch.

* fixing few cypress tests

* fixing cypress tests

* fixing cypress tests.

* fixing cypress

* updated DSL

* Addressing code review comments.

* test fails

* dip

* eslint fixes.

* fixing debugger cypress tests.

* updating latest page version.

* updating migration changes to cypress dsl's.

* updating chart data fixes for cypress tests.

Co-authored-by: Apple <nandan@thinkify.io>
2021-05-18 23:59:39 +05:30

167 lines
3.5 KiB
TypeScript

import {
ReduxActionTypes,
ReduxAction,
ReduxActionErrorTypes,
ReduxActionWithoutPayload,
} from "constants/ReduxActionConstants";
import {
ExecuteActionPayload,
ExecuteErrorPayload,
} from "constants/AppsmithActionConstants/ActionConstants";
import { BatchAction, batchAction } from "actions/batchActions";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
export const executeAction = (
payload: ExecuteActionPayload,
): BatchAction<ExecuteActionPayload> =>
batchAction({
type: ReduxActionTypes.EXECUTE_ACTION,
payload,
});
export const executeActionError = (
executeErrorPayload: ExecuteErrorPayload,
): ReduxAction<ExecuteErrorPayload> => {
return {
type: ReduxActionErrorTypes.EXECUTE_ACTION_ERROR,
payload: executeErrorPayload,
};
};
export const executePageLoadActions = (): ReduxActionWithoutPayload => ({
type: ReduxActionTypes.EXECUTE_PAGE_LOAD_ACTIONS,
});
export const disableDragAction = (
isDraggingDisabled: boolean,
): ReduxAction<{ isDraggingDisabled: boolean }> => {
return {
type: ReduxActionTypes.DISABLE_WIDGET_DRAG,
payload: {
isDraggingDisabled,
},
};
};
export const createModalAction = (
modalName: string,
): ReduxAction<{ modalName: string }> => {
return {
type: ReduxActionTypes.CREATE_MODAL_INIT,
payload: {
modalName,
},
};
};
export const focusWidget = (
widgetId?: string,
): ReduxAction<{ widgetId?: string }> => ({
type: ReduxActionTypes.FOCUS_WIDGET,
payload: { widgetId },
});
export const selectWidget = (
widgetId?: string,
isMultiSelect?: boolean,
): ReduxAction<{ widgetId?: string; isMultiSelect?: boolean }> => ({
type: ReduxActionTypes.SELECT_WIDGET,
payload: { widgetId, isMultiSelect },
});
export const selectAllWidgets = (
widgetIds?: string[],
): ReduxAction<{ widgetIds?: string[] }> => {
return {
type: ReduxActionTypes.SELECT_MULTIPLE_WIDGETS,
payload: { widgetIds },
};
};
export const selectAllWidgetsInit = () => {
return {
type: ReduxActionTypes.SELECT_MULTIPLE_WIDGETS_INIT,
};
};
export const showModal = (id: string) => {
return {
type: ReduxActionTypes.SHOW_MODAL,
payload: {
modalId: id,
},
};
};
export const closeAllModals = () => {
return {
type: ReduxActionTypes.CLOSE_MODAL,
payload: {},
};
};
export const forceOpenPropertyPane = (id: string) => {
PerformanceTracker.startTracking(
PerformanceTransactionName.OPEN_PROPERTY_PANE,
);
return {
type: ReduxActionTypes.SHOW_PROPERTY_PANE,
payload: {
widgetId: id,
force: true,
},
};
};
export const closePropertyPane = () => {
return {
type: ReduxActionTypes.HIDE_PROPERTY_PANE,
payload: {
force: false,
},
};
};
export const copyWidget = (isShortcut: boolean) => {
return {
type: ReduxActionTypes.COPY_SELECTED_WIDGET_INIT,
payload: {
isShortcut: !!isShortcut,
},
};
};
export const pasteWidget = () => {
return {
type: ReduxActionTypes.PASTE_COPIED_WIDGET_INIT,
};
};
export const deleteSelectedWidget = (
isShortcut: boolean,
disallowUndo = false,
) => {
return {
type: ReduxActionTypes.WIDGET_DELETE,
payload: {
isShortcut,
disallowUndo,
},
};
};
export const cutWidget = () => {
return {
type: ReduxActionTypes.CUT_SELECTED_WIDGET,
};
};
export const addTableWidgetFromQuery = (queryName: string) => {
return {
type: ReduxActionTypes.ADD_TABLE_WIDGET_FROM_QUERY,
payload: queryName,
};
};