feat(editor): 新增 hideSidebar 配置支持隐藏左侧面板

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
roymondchen 2026-05-29 16:49:10 +08:00
parent cbc4b25072
commit a3333e2b4e
3 changed files with 13 additions and 5 deletions

View File

@ -3,6 +3,7 @@
:disabled-page-fragment="disabledPageFragment"
:page-bar-sort-options="pageBarSortOptions"
:page-filter-function="pageFilterFunction"
:hide-sidebar="hideSidebar"
>
<template #header>
<slot name="header"></slot>

View File

@ -34,6 +34,8 @@ export interface EditorProps {
datasourceList?: DatasourceTypeOption[];
/** 左侧面板配置 */
sidebar?: SideBarData;
/** 是否隐藏左侧面板 */
hideSidebar?: boolean;
/** 顶部工具栏配置 */
menu?: MenuBarData;
/** 组件树右键菜单 */

View File

@ -23,15 +23,15 @@
left-class="m-editor-framework-left"
center-class="m-editor-framework-center"
right-class="m-editor-framework-right"
:left="columnWidth.left"
:left="hideSidebar ? undefined : columnWidth.left"
:right="columnWidth.right"
:min-left="MIN_LEFT_COLUMN_WIDTH"
:min-left="hideSidebar ? 0 : MIN_LEFT_COLUMN_WIDTH"
:min-right="MIN_RIGHT_COLUMN_WIDTH"
:min-center="MIN_CENTER_COLUMN_WIDTH"
:width="frameworkRect.width"
@change="columnWidthChange"
>
<template #left>
<template v-if="!hideSidebar" #left>
<slot name="sidebar"></slot>
</template>
@ -94,10 +94,12 @@ defineOptions({
name: 'MEditorFramework',
});
defineProps<{
const props = defineProps<{
disabledPageFragment: boolean;
pageBarSortOptions?: PageBarSortOptions;
pageFilterFunction?: (_page: MPage | MPageFragment, _keyword: string) => boolean;
/** 是否隐藏左侧面板 */
hideSidebar?: boolean;
}>();
const codeOptions = inject('codeOptions', {});
@ -132,7 +134,10 @@ watch(
);
const columnWidthChange = (columnW: GetColumnWidth) => {
storageService.setItem(LEFT_COLUMN_WIDTH_STORAGE_KEY, columnW.left, { protocol: Protocol.NUMBER });
// left 0
if (!props.hideSidebar) {
storageService.setItem(LEFT_COLUMN_WIDTH_STORAGE_KEY, columnW.left, { protocol: Protocol.NUMBER });
}
storageService.setItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY, columnW.right, { protocol: Protocol.NUMBER });
uiService.set('columnWidth', columnW);