mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-13 04:03:07 +00:00
feat: add some necessary methods and attributes
This commit is contained in:
parent
98ececa9c1
commit
4fd7f27f8e
@ -550,7 +550,7 @@ export class Designer {
|
||||
|
||||
return reducers.reduce((xprops, reducer) => {
|
||||
try {
|
||||
return reducer(xprops, node, { stage });
|
||||
return reducer(xprops, node.internalToShellNode() as any, { stage });
|
||||
} catch (e) {
|
||||
// todo: add log
|
||||
console.warn(e);
|
||||
|
||||
@ -61,6 +61,13 @@ export default class DocumentModel {
|
||||
return new DocumentModel(document);
|
||||
}
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
get id() {
|
||||
return this[documentSymbol].id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前文档所属的 project
|
||||
* @returns
|
||||
|
||||
@ -9,6 +9,7 @@ import Props from './props';
|
||||
import DocumentModel from './document-model';
|
||||
import NodeChildren from './node-children';
|
||||
import ComponentMeta from './component-meta';
|
||||
import SettingTopEntry from './setting-top-entry';
|
||||
import { documentSymbol, nodeSymbol } from './symbols';
|
||||
|
||||
const shellNodeSymbol = Symbol('shellNodeSymbol');
|
||||
@ -237,6 +238,10 @@ export default class Node {
|
||||
return this[nodeSymbol].schema;
|
||||
}
|
||||
|
||||
get settingEntry(): any {
|
||||
return SettingTopEntry.create(this[nodeSymbol].settingEntry as any);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use .children instead
|
||||
*/
|
||||
|
||||
@ -94,4 +94,23 @@ export default class Props {
|
||||
setExtraPropValue(path: string, value: CompositeValue) {
|
||||
return this.getExtraProp(path)?.setValue(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* test if the specified key is existing or not.
|
||||
* @param key
|
||||
* @returns
|
||||
*/
|
||||
has(key: string) {
|
||||
return this[propsSymbol].has(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* add a key with given value
|
||||
* @param value
|
||||
* @param key
|
||||
* @returns
|
||||
*/
|
||||
add(value: CompositeValue, key?: string | number | undefined) {
|
||||
return this[propsSymbol].add(value, key);
|
||||
}
|
||||
}
|
||||
@ -64,6 +64,10 @@ export default class SettingPropEntry {
|
||||
return this[settingPropEntrySymbol].extraProps;
|
||||
}
|
||||
|
||||
get props() {
|
||||
return SettingTopEntry.create(this[settingPropEntrySymbol].props);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设置属性对应的节点实例
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user