2021-06-17 13:26:54 +00:00
|
|
|
import { ReduxActionTypes, ReduxAction } from "constants/ReduxActionConstants";
|
2021-06-28 07:11:47 +00:00
|
|
|
import { MAIN_CONTAINER_WIDGET_ID } from "constants/WidgetConstants";
|
2021-06-17 13:26:54 +00:00
|
|
|
|
|
|
|
|
export const selectWidgetAction = (
|
|
|
|
|
widgetId?: string,
|
|
|
|
|
isMultiSelect?: boolean,
|
|
|
|
|
): ReduxAction<{ widgetId?: string; isMultiSelect?: boolean }> => ({
|
|
|
|
|
type: ReduxActionTypes.SELECT_WIDGET,
|
|
|
|
|
payload: { widgetId, isMultiSelect },
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export const selectWidgetInitAction = (
|
|
|
|
|
widgetId?: string,
|
|
|
|
|
isMultiSelect?: boolean,
|
|
|
|
|
): ReduxAction<{ widgetId?: string; isMultiSelect?: boolean }> => ({
|
|
|
|
|
type: ReduxActionTypes.SELECT_WIDGET_INIT,
|
|
|
|
|
payload: { widgetId, isMultiSelect },
|
|
|
|
|
});
|
|
|
|
|
|
2021-06-28 07:11:47 +00:00
|
|
|
export const selectMultipleWidgetsAction = (
|
2021-06-17 13:26:54 +00:00
|
|
|
widgetIds?: string[],
|
|
|
|
|
): ReduxAction<{ widgetIds?: string[] }> => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.SELECT_MULTIPLE_WIDGETS,
|
|
|
|
|
payload: { widgetIds },
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-06-28 07:11:47 +00:00
|
|
|
export const silentAddSelectionsAction = (
|
2021-06-17 13:26:54 +00:00
|
|
|
widgetIds?: string[],
|
|
|
|
|
): ReduxAction<{ widgetIds?: string[] }> => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.SELECT_WIDGETS,
|
|
|
|
|
payload: { widgetIds },
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const deselectMultipleWidgetsAction = (
|
|
|
|
|
widgetIds?: string[],
|
|
|
|
|
): ReduxAction<{ widgetIds?: string[] }> => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.DESELECT_WIDGETS,
|
|
|
|
|
payload: { widgetIds },
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-06-28 07:11:47 +00:00
|
|
|
export const selectAllWidgetsInCanvasInitAction = (
|
|
|
|
|
canvasId = MAIN_CONTAINER_WIDGET_ID,
|
|
|
|
|
): ReduxAction<{ canvasId: string }> => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.SELECT_ALL_WIDGETS_IN_CANVAS_INIT,
|
|
|
|
|
payload: {
|
|
|
|
|
canvasId,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const selectMultipleWidgetsInitAction = (widgetIds: string[]) => {
|
2021-06-17 13:26:54 +00:00
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.SELECT_MULTIPLE_WIDGETS_INIT,
|
2021-06-28 07:11:47 +00:00
|
|
|
payload: { widgetIds },
|
2021-06-17 13:26:54 +00:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const shiftSelectWidgetsEntityExplorerInitAction = (
|
|
|
|
|
widgetId: string,
|
|
|
|
|
siblingWidgets: string[],
|
|
|
|
|
): ReduxAction<{ widgetId: string; siblingWidgets: string[] }> => ({
|
|
|
|
|
type: ReduxActionTypes.SHIFT_SELECT_WIDGET_INIT,
|
|
|
|
|
payload: { widgetId, siblingWidgets },
|
|
|
|
|
});
|