feat(editor): 新增配置控制属性配置面板右下角的源码按钮是否显示

This commit is contained in:
roymondchen 2024-04-12 19:31:09 +08:00
parent 006133102f
commit 92049cf251
4 changed files with 8 additions and 2 deletions

View File

@ -81,6 +81,7 @@
<slot name="props-panel"> <slot name="props-panel">
<PropsPanel <PropsPanel
:extend-state="extendFormState" :extend-state="extendFormState"
:disabled-show-src="disabledShowSrc"
@mounted="(instance: any) => $emit('props-panel-mounted', instance)" @mounted="(instance: any) => $emit('props-panel-mounted', instance)"
@form-error="(e: any) => $emit('props-form-error', e)" @form-error="(e: any) => $emit('props-form-error', e)"
@submit-error="(e: any) => $emit('props-submit-error', e)" @submit-error="(e: any) => $emit('props-submit-error', e)"

View File

@ -80,6 +80,8 @@ export interface EditorProps {
disabledPageFragment?: boolean; disabledPageFragment?: boolean;
/** 禁用双击在浮层中单独编辑选中组件 */ /** 禁用双击在浮层中单独编辑选中组件 */
disabledStageOverlay?: boolean; disabledStageOverlay?: boolean;
/** 禁用属性配置面板右下角显示源码的按钮 */
disabledShowSrc?: boolean;
/** 中间工作区域中画布渲染的内容 */ /** 中间工作区域中画布渲染的内容 */
render?: (stage: StageCore) => HTMLDivElement | Promise<HTMLDivElement>; render?: (stage: StageCore) => HTMLDivElement | Promise<HTMLDivElement>;
/** 选中时会在画布上复制出一个大小相同的dom实际拖拽的是这个dom此方法用于干预这个dom的生成方式 */ /** 选中时会在画布上复制出一个大小相同的dom实际拖拽的是这个dom此方法用于干预这个dom的生成方式 */
@ -101,6 +103,7 @@ export const defaultEditorProps = {
containerHighlightClassName: CONTAINER_HIGHLIGHT_CLASS_NAME, containerHighlightClassName: CONTAINER_HIGHLIGHT_CLASS_NAME,
containerHighlightDuration: 800, containerHighlightDuration: 800,
containerHighlightType: ContainerHighlightType.DEFAULT, containerHighlightType: ContainerHighlightType.DEFAULT,
disabledShowSrc: false,
componentGroupList: () => [], componentGroupList: () => [],
datasourceList: () => [], datasourceList: () => [],
menu: () => ({ left: [], right: [] }), menu: () => ({ left: [], right: [] }),

View File

@ -3,7 +3,7 @@
<slot name="props-panel-header"></slot> <slot name="props-panel-header"></slot>
<MForm <MForm
ref="configForm" ref="configForm"
:class="`m-editor-props-panel ${propsPanelSize}`" :class="propsPanelSize"
:popper-class="`m-editor-props-panel-popper ${propsPanelSize}`" :popper-class="`m-editor-props-panel-popper ${propsPanelSize}`"
:size="propsPanelSize" :size="propsPanelSize"
:init-values="values" :init-values="values"
@ -14,6 +14,7 @@
></MForm> ></MForm>
<TMagicButton <TMagicButton
v-if="!disabledShowSrc"
class="m-editor-props-panel-src-icon" class="m-editor-props-panel-src-icon"
circle circle
size="large" size="large"
@ -57,6 +58,7 @@ defineOptions({
}); });
defineProps<{ defineProps<{
disabledShowSrc?: boolean;
extendState?: (state: FormState) => Record<string, any> | Promise<Record<string, any>>; extendState?: (state: FormState) => Record<string, any> | Promise<Record<string, any>>;
}>(); }>();

View File

@ -1,5 +1,5 @@
.m-editor-props-panel { .m-editor-props-panel {
padding: 0 10px; padding: 0 10px 50px 10px;
.m-editor-props-panel-src-icon { .m-editor-props-panel-src-icon {
position: absolute; position: absolute;