Skip to content

Commit

Permalink
feat: add hideComponentAction config
Browse files Browse the repository at this point in the history
  • Loading branch information
liujuping committed Jan 5, 2024
1 parent 173978f commit ce609e3
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
6 changes: 6 additions & 0 deletions docs/docs/api/configOptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,12 @@ config.set('enableCondition', false)

是否在只有一个 item 的时候隐藏设置 tabs

#### hideComponentAction

`@type {boolean}` `@default {false}`

隐藏设计器辅助层

#### thisRequiredInJSE

`@type {boolean}` `@default {true}`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
ComponentType,
} from 'react';
import classNames from 'classnames';
import { observer, computed, Tip } from '@alilc/lowcode-editor-core';
import { observer, computed, Tip, engineConfig } from '@alilc/lowcode-editor-core';
import { createIcon, isReactComponent, isActionContentObject } from '@alilc/lowcode-utils';
import { IPublicTypeActionContentObject } from '@alilc/lowcode-types';
import { BuiltinSimulatorHost } from '../host';
Expand Down Expand Up @@ -47,14 +47,18 @@ export class BorderSelectingInstance extends Component<{
});

const { hideSelectTools } = observed.node.componentMeta.advanced;
const hideComponentAction = engineConfig.get('hideComponentAction');

if (hideSelectTools) {
return null;
}

return (
<div className={className} style={style}>
{!dragging && <Toolbar observed={observed} />}
<div
className={className}
style={style}
>
{(!dragging && !hideComponentAction) ? <Toolbar observed={observed} /> : null}
</div>
);
}
Expand Down
5 changes: 5 additions & 0 deletions packages/editor-core/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ const VALID_ENGINE_OPTIONS = {
type: 'function',
description: '应用级设计模式下,窗口为空时展示的占位组件',
},
hideComponentAction: {
type: 'boolean',
description: '是否隐藏设计器辅助层',
default: false,
},
};

const getStrictModeValue = (engineOptions: IPublicTypeEngineOptions, defaultValue: boolean): boolean => {
Expand Down
6 changes: 6 additions & 0 deletions packages/types/src/shell/type/engine-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ export interface IPublicTypeEngineOptions {
* 应用级设计模式下,自动打开第一个窗口
*/
enableAutoOpenFirstWindow?: boolean;

/**
* @default false
* 隐藏设计器辅助层
*/
hideComponentAction?: boolean;
}

/**
Expand Down

0 comments on commit ce609e3

Please sign in to comment.