## Description https://github.com/user-attachments/assets/764917aa-74ea-4c1b-8361-6441344227fd Fixes #36281 _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.All" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/10845273743> > Commit: 88d0b70bec732e804919a056cb0f350ae8580aa0 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10845273743&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Fri, 13 Sep 2024 09:32:43 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new optional `parentId` property for enhanced widget selection, allowing for hierarchical management. - Updated widget selection and deletion processes to utilize the `parentId` for improved contextual handling based on layout type. - **Bug Fixes** - Enhanced logic in widget selection to ensure the correct parent ID is used, improving overall selection accuracy. - **Documentation** - Updated documentation to reflect changes in widget selection and deletion functionalities. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
70 lines
2.0 KiB
TypeScript
70 lines
2.0 KiB
TypeScript
import type { ReduxAction } from "ee/constants/ReduxActionConstants";
|
|
import { ReduxActionTypes } from "ee/constants/ReduxActionConstants";
|
|
import type { SelectionRequestType } from "sagas/WidgetSelectUtils";
|
|
import type { NavigationMethod } from "utils/history";
|
|
|
|
export interface WidgetSelectionRequestPayload {
|
|
selectionRequestType: SelectionRequestType;
|
|
payload?: string[];
|
|
invokedBy?: NavigationMethod;
|
|
basePageId?: string;
|
|
parentId?: string;
|
|
}
|
|
|
|
export type WidgetSelectionRequest = (
|
|
selectionRequestType: SelectionRequestType,
|
|
payload?: string[],
|
|
invokedBy?: NavigationMethod,
|
|
basePageId?: string,
|
|
parentId?: string,
|
|
) => ReduxAction<WidgetSelectionRequestPayload>;
|
|
|
|
// Use to select a widget programmatically via platform action
|
|
export const selectWidgetInitAction: WidgetSelectionRequest = (
|
|
selectionRequestType,
|
|
payload,
|
|
invokedBy?: NavigationMethod,
|
|
basePageId?: string,
|
|
parentId?: string,
|
|
) => ({
|
|
type: ReduxActionTypes.SELECT_WIDGET_INIT,
|
|
payload: { selectionRequestType, payload, basePageId, invokedBy, parentId },
|
|
});
|
|
|
|
export interface SetSelectedWidgetsPayload {
|
|
widgetIds: string[];
|
|
invokedBy?: NavigationMethod;
|
|
}
|
|
|
|
// To be used to collect selected widget state from url and set on state
|
|
export const setSelectedWidgets = (
|
|
widgetIds: string[],
|
|
invokedBy?: NavigationMethod,
|
|
): ReduxAction<SetSelectedWidgetsPayload> => {
|
|
return {
|
|
type: ReduxActionTypes.SET_SELECTED_WIDGETS,
|
|
payload: { widgetIds, invokedBy },
|
|
};
|
|
};
|
|
|
|
export const setLastSelectedWidget = (widgetId: string) => {
|
|
return {
|
|
type: ReduxActionTypes.SET_LAST_SELECTED_WIDGET,
|
|
payload: { lastSelectedWidget: widgetId },
|
|
};
|
|
};
|
|
|
|
export const setSelectedWidgetAncestry = (widgetIds: string[]) => {
|
|
return {
|
|
type: ReduxActionTypes.SET_SELECTED_WIDGET_ANCESTRY,
|
|
payload: widgetIds,
|
|
};
|
|
};
|
|
|
|
export const setEntityExplorerAncestry = (widgetIds: string[]) => {
|
|
return {
|
|
type: ReduxActionTypes.SET_ENTITY_EXPLORER_WIDGET_ANCESTRY,
|
|
payload: widgetIds,
|
|
};
|
|
};
|