2022-10-17 15:16:38 +00:00
|
|
|
import {
|
|
|
|
|
getApiPaneConfigSelectedTabIndex,
|
|
|
|
|
getApiPaneResponsePaneHeight,
|
|
|
|
|
getApiPaneResponseSelectedTab,
|
2022-11-25 03:47:00 +00:00
|
|
|
getApiRightPaneSelectedTab,
|
2022-10-17 15:16:38 +00:00
|
|
|
} from "selectors/apiPaneSelectors";
|
|
|
|
|
import {
|
|
|
|
|
setApiPaneResponseSelectedTab,
|
|
|
|
|
setApiPaneConfigSelectedTabIndex,
|
|
|
|
|
setApiPaneResponsePaneHeight,
|
2022-11-25 03:47:00 +00:00
|
|
|
setApiRightPaneSelectedTab,
|
2022-10-17 15:16:38 +00:00
|
|
|
} from "actions/apiPaneActions";
|
|
|
|
|
import { AppState } from "@appsmith/reducers";
|
2022-11-03 16:39:51 +00:00
|
|
|
import { ReduxAction } from "@appsmith/constants/ReduxActionConstants";
|
2022-10-17 15:16:38 +00:00
|
|
|
import {
|
|
|
|
|
getAllPropertySectionState,
|
2022-11-15 06:20:18 +00:00
|
|
|
getFocusableCodeEditorField,
|
2022-10-17 15:16:38 +00:00
|
|
|
getSelectedCanvasDebuggerTab,
|
|
|
|
|
getSelectedPropertyTabIndex,
|
|
|
|
|
} from "selectors/editorContextSelectors";
|
2022-11-15 06:20:18 +00:00
|
|
|
import { setFocusableCodeEditorField } from "actions/editorContextActions";
|
2022-12-05 05:58:17 +00:00
|
|
|
import {
|
|
|
|
|
getAllDatasourceCollapsibleState,
|
|
|
|
|
getSelectedWidgets,
|
|
|
|
|
isDatasourceInViewMode,
|
|
|
|
|
} from "selectors/ui";
|
2022-10-17 15:16:38 +00:00
|
|
|
import { selectMultipleWidgetsInitAction } from "actions/widgetSelectionActions";
|
|
|
|
|
|
|
|
|
|
import { FocusEntity } from "navigation/FocusEntity";
|
|
|
|
|
import { ActionExecutionResizerHeight } from "pages/Editor/APIEditor/constants";
|
|
|
|
|
import {
|
|
|
|
|
getQueryPaneConfigSelectedTabIndex,
|
|
|
|
|
getQueryPaneResponsePaneHeight,
|
|
|
|
|
getQueryPaneResponseSelectedTab,
|
|
|
|
|
} from "selectors/queryPaneSelectors";
|
|
|
|
|
import {
|
|
|
|
|
setQueryPaneConfigSelectedTabIndex,
|
|
|
|
|
setQueryPaneResponsePaneHeight,
|
|
|
|
|
setQueryPaneResponseSelectedTab,
|
|
|
|
|
} from "actions/queryPaneActions";
|
|
|
|
|
import {
|
|
|
|
|
getJSPaneConfigSelectedTabIndex,
|
|
|
|
|
getJSPaneResponsePaneHeight,
|
|
|
|
|
getJSPaneResponseSelectedTab,
|
|
|
|
|
} from "selectors/jsPaneSelectors";
|
|
|
|
|
import {
|
|
|
|
|
setJsPaneConfigSelectedTabIndex,
|
|
|
|
|
setJsPaneResponsePaneHeight,
|
|
|
|
|
setJsPaneResponseSelectedTab,
|
|
|
|
|
} from "actions/jsPaneActions";
|
|
|
|
|
import {
|
|
|
|
|
setAllPropertySectionState,
|
2022-11-15 06:20:18 +00:00
|
|
|
setFocusablePropertyPaneField,
|
2022-10-17 15:16:38 +00:00
|
|
|
setSelectedPropertyTabIndex,
|
|
|
|
|
} from "actions/propertyPaneActions";
|
|
|
|
|
import { setCanvasDebuggerSelectedTab } from "actions/debuggerActions";
|
2022-12-05 05:58:17 +00:00
|
|
|
import {
|
|
|
|
|
setAllDatasourceCollapsible,
|
|
|
|
|
setDatasourceViewMode,
|
|
|
|
|
} from "actions/datasourceActions";
|
2022-10-17 15:16:38 +00:00
|
|
|
import { PluginPackageName } from "entities/Action";
|
2022-11-15 06:20:18 +00:00
|
|
|
import { getFocusablePropertyPaneField } from "selectors/propertyPaneSelectors";
|
2022-10-17 15:16:38 +00:00
|
|
|
|
|
|
|
|
export enum FocusElement {
|
|
|
|
|
ApiPaneConfigTabs = "ApiPaneConfigTabs",
|
|
|
|
|
ApiPaneResponseTabs = "ApiPaneResponseTabs",
|
|
|
|
|
ApiPaneResponseHeight = "ApiPaneResponseHeight",
|
2022-12-02 03:06:22 +00:00
|
|
|
DatasourceViewMode = "DatasourceViewMode",
|
2022-12-05 05:58:17 +00:00
|
|
|
DatasourceAccordions = "DatasourceAccordions",
|
2022-11-25 03:47:00 +00:00
|
|
|
ApiRightPaneTabs = "ApiRightPaneTabs",
|
2022-10-17 15:16:38 +00:00
|
|
|
QueryPaneConfigTabs = "QueryPaneConfigTabs",
|
|
|
|
|
QueryPaneResponseTabs = "QueryPaneResponseTabs",
|
|
|
|
|
QueryPaneResponseHeight = "QueryPaneResponseHeight",
|
|
|
|
|
JSPaneConfigTabs = "JSPaneConfigTabs",
|
|
|
|
|
JSPaneResponseTabs = "JSPaneResponseTabs",
|
|
|
|
|
JSPaneResponseHeight = "JSPaneResponseHeight",
|
2022-11-15 06:20:18 +00:00
|
|
|
CodeEditor = "CodeEditor",
|
2022-10-17 15:16:38 +00:00
|
|
|
PropertyField = "PropertyField",
|
|
|
|
|
PropertySections = "PropertySections",
|
|
|
|
|
PropertyTabs = "PropertyTabs",
|
|
|
|
|
SelectedWidgets = "SelectedWidgets",
|
|
|
|
|
CanvasDebuggerTabs = "CanvasDebuggerTabs",
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Config = {
|
|
|
|
|
name: FocusElement;
|
|
|
|
|
selector: (state: AppState) => unknown;
|
|
|
|
|
setter: (payload: any) => ReduxAction<any>;
|
|
|
|
|
defaultValue?: unknown;
|
|
|
|
|
subTypes?: Record<string, { defaultValue: unknown }>;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const FocusElementsConfig: Record<FocusEntity, Config[]> = {
|
|
|
|
|
[FocusEntity.NONE]: [],
|
|
|
|
|
[FocusEntity.CANVAS]: [
|
|
|
|
|
{
|
|
|
|
|
name: FocusElement.PropertySections,
|
|
|
|
|
selector: getAllPropertySectionState,
|
|
|
|
|
setter: setAllPropertySectionState,
|
|
|
|
|
defaultValue: {},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: FocusElement.SelectedWidgets,
|
|
|
|
|
selector: getSelectedWidgets,
|
|
|
|
|
setter: selectMultipleWidgetsInitAction,
|
|
|
|
|
defaultValue: [],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: FocusElement.CanvasDebuggerTabs,
|
|
|
|
|
selector: getSelectedCanvasDebuggerTab,
|
|
|
|
|
setter: setCanvasDebuggerSelectedTab,
|
2022-11-15 06:20:18 +00:00
|
|
|
defaultValue: 0,
|
2022-10-17 15:16:38 +00:00
|
|
|
},
|
|
|
|
|
],
|
2022-12-02 03:06:22 +00:00
|
|
|
[FocusEntity.DATASOURCE]: [
|
|
|
|
|
{
|
|
|
|
|
name: FocusElement.DatasourceViewMode,
|
|
|
|
|
selector: isDatasourceInViewMode,
|
|
|
|
|
setter: setDatasourceViewMode,
|
|
|
|
|
defaultValue: true,
|
|
|
|
|
},
|
2022-12-05 05:58:17 +00:00
|
|
|
{
|
|
|
|
|
name: FocusElement.DatasourceAccordions,
|
|
|
|
|
selector: getAllDatasourceCollapsibleState,
|
|
|
|
|
setter: setAllDatasourceCollapsible,
|
|
|
|
|
},
|
2022-12-02 03:06:22 +00:00
|
|
|
],
|
2022-10-17 15:16:38 +00:00
|
|
|
[FocusEntity.JS_OBJECT]: [
|
|
|
|
|
{
|
2022-11-15 06:20:18 +00:00
|
|
|
name: FocusElement.CodeEditor,
|
|
|
|
|
selector: getFocusableCodeEditorField,
|
|
|
|
|
setter: setFocusableCodeEditorField,
|
2022-10-17 15:16:38 +00:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: FocusElement.JSPaneConfigTabs,
|
|
|
|
|
selector: getJSPaneConfigSelectedTabIndex,
|
|
|
|
|
setter: setJsPaneConfigSelectedTabIndex,
|
|
|
|
|
defaultValue: 0,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: FocusElement.JSPaneResponseTabs,
|
|
|
|
|
selector: getJSPaneResponseSelectedTab,
|
|
|
|
|
setter: setJsPaneResponseSelectedTab,
|
2022-11-15 06:20:18 +00:00
|
|
|
defaultValue: 0,
|
2022-10-17 15:16:38 +00:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: FocusElement.JSPaneResponseHeight,
|
|
|
|
|
selector: getJSPaneResponsePaneHeight,
|
|
|
|
|
setter: setJsPaneResponsePaneHeight,
|
|
|
|
|
defaultValue: ActionExecutionResizerHeight,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
[FocusEntity.QUERY]: [
|
|
|
|
|
{
|
2022-11-15 06:20:18 +00:00
|
|
|
name: FocusElement.CodeEditor,
|
|
|
|
|
selector: getFocusableCodeEditorField,
|
|
|
|
|
setter: setFocusableCodeEditorField,
|
2022-10-17 15:16:38 +00:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: FocusElement.QueryPaneConfigTabs,
|
|
|
|
|
selector: getQueryPaneConfigSelectedTabIndex,
|
|
|
|
|
setter: setQueryPaneConfigSelectedTabIndex,
|
|
|
|
|
defaultValue: 0,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: FocusElement.QueryPaneResponseTabs,
|
|
|
|
|
selector: getQueryPaneResponseSelectedTab,
|
|
|
|
|
setter: setQueryPaneResponseSelectedTab,
|
|
|
|
|
defaultValue: 0,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: FocusElement.QueryPaneResponseHeight,
|
|
|
|
|
selector: getQueryPaneResponsePaneHeight,
|
|
|
|
|
setter: setQueryPaneResponsePaneHeight,
|
|
|
|
|
defaultValue: ActionExecutionResizerHeight,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
[FocusEntity.PROPERTY_PANE]: [
|
|
|
|
|
{
|
|
|
|
|
name: FocusElement.PropertyTabs,
|
|
|
|
|
selector: getSelectedPropertyTabIndex,
|
|
|
|
|
setter: setSelectedPropertyTabIndex,
|
|
|
|
|
defaultValue: 0,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: FocusElement.PropertyField,
|
2022-11-15 06:20:18 +00:00
|
|
|
selector: getFocusablePropertyPaneField,
|
|
|
|
|
setter: setFocusablePropertyPaneField,
|
2022-10-17 15:16:38 +00:00
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
[FocusEntity.API]: [
|
|
|
|
|
{
|
2022-11-15 06:20:18 +00:00
|
|
|
name: FocusElement.CodeEditor,
|
|
|
|
|
selector: getFocusableCodeEditorField,
|
|
|
|
|
setter: setFocusableCodeEditorField,
|
2022-10-17 15:16:38 +00:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: FocusElement.ApiPaneConfigTabs,
|
|
|
|
|
selector: getApiPaneConfigSelectedTabIndex,
|
|
|
|
|
setter: setApiPaneConfigSelectedTabIndex,
|
|
|
|
|
defaultValue: 0,
|
|
|
|
|
subTypes: {
|
|
|
|
|
[PluginPackageName.GRAPHQL]: {
|
|
|
|
|
defaultValue: 2,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: FocusElement.ApiPaneResponseTabs,
|
|
|
|
|
selector: getApiPaneResponseSelectedTab,
|
|
|
|
|
setter: setApiPaneResponseSelectedTab,
|
2022-11-15 06:20:18 +00:00
|
|
|
defaultValue: 0,
|
2022-10-17 15:16:38 +00:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: FocusElement.ApiPaneResponseHeight,
|
|
|
|
|
selector: getApiPaneResponsePaneHeight,
|
|
|
|
|
setter: setApiPaneResponsePaneHeight,
|
|
|
|
|
defaultValue: ActionExecutionResizerHeight,
|
|
|
|
|
},
|
2022-11-25 03:47:00 +00:00
|
|
|
{
|
|
|
|
|
name: FocusElement.ApiRightPaneTabs,
|
|
|
|
|
selector: getApiRightPaneSelectedTab,
|
|
|
|
|
setter: setApiRightPaneSelectedTab,
|
|
|
|
|
},
|
2022-10-17 15:16:38 +00:00
|
|
|
],
|
|
|
|
|
};
|