mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-01 13:40:41 +00:00
feat: 增加 Node#lock 接口, 并且支持禁止锁定的节点的编辑操作
This commit is contained in:
parent
c88f254e71
commit
e051c3f0d7
@ -54,6 +54,10 @@ export class SettingTopEntry implements SettingEntry {
|
||||
return this.nodes.length === 1;
|
||||
}
|
||||
|
||||
get isLocked(): boolean {
|
||||
return this.first.isLocked;
|
||||
}
|
||||
|
||||
/**
|
||||
* 多个
|
||||
*/
|
||||
|
||||
@ -44,7 +44,7 @@ import { NodeRemoveOptions } from '../../types';
|
||||
* conditionGroup use for condition, for exclusive
|
||||
* title display on outline
|
||||
* ignored ignore this node will not publish to render, but will store
|
||||
* isLocked can not select/hover/ item on canvas but can control on outline
|
||||
* isLocked can not select/hover/ item on canvas and outline
|
||||
* hidden not visible on canvas
|
||||
* slotArgs like loopArgs, for slot node
|
||||
*
|
||||
@ -374,6 +374,20 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 锁住当前节点
|
||||
*/
|
||||
lock(flag = true) {
|
||||
this.setExtraProp('isLocked', flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前节点的锁定状态
|
||||
*/
|
||||
get isLocked(): boolean {
|
||||
return !!this.getExtraProp('isLocked', false)?.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择当前节点
|
||||
*/
|
||||
|
||||
@ -123,7 +123,7 @@ export class SettingsPrimaryPane extends Component<{ editor: Editor; config: any
|
||||
|
||||
render() {
|
||||
const { settings } = this.main;
|
||||
const editor = globalContext.get(Editor);
|
||||
const editor = globalContext.get('editor');
|
||||
if (!settings) {
|
||||
// 未选中节点,提示选中 或者 显示根节点设置
|
||||
return (
|
||||
@ -135,6 +135,16 @@ export class SettingsPrimaryPane extends Component<{ editor: Editor; config: any
|
||||
);
|
||||
}
|
||||
|
||||
if (settings.isLocked) {
|
||||
return (
|
||||
<div className="lc-settings-main">
|
||||
<div className="lc-settings-notice">
|
||||
<p>该节点已被锁定,无法配置</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (Array.isArray(settings.items) && settings.items.length === 0) {
|
||||
return (
|
||||
<div className="lc-settings-main">
|
||||
|
||||
@ -175,7 +175,7 @@ plugins.register((ctx: ILowCodePluginContext) => {
|
||||
},
|
||||
};
|
||||
});
|
||||
export async function init(container?: Element, options?: EngineOptions) {
|
||||
export async function init(container?: HTMLElement, options?: EngineOptions) {
|
||||
let engineOptions = null;
|
||||
let engineContainer = null;
|
||||
if (isPlainObject(container)) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user