diff --git a/packages/designer/src/designer/designer.ts b/packages/designer/src/designer/designer.ts index 74a86d645..b665ed1f6 100644 --- a/packages/designer/src/designer/designer.ts +++ b/packages/designer/src/designer/designer.ts @@ -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); diff --git a/packages/shell/src/document-model.ts b/packages/shell/src/document-model.ts index 1b29ac0a0..c5610fcb5 100644 --- a/packages/shell/src/document-model.ts +++ b/packages/shell/src/document-model.ts @@ -61,6 +61,13 @@ export default class DocumentModel { return new DocumentModel(document); } + /** + * id + */ + get id() { + return this[documentSymbol].id; + } + /** * 获取当前文档所属的 project * @returns diff --git a/packages/shell/src/node.ts b/packages/shell/src/node.ts index 732656385..8ffbc9285 100644 --- a/packages/shell/src/node.ts +++ b/packages/shell/src/node.ts @@ -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 */ diff --git a/packages/shell/src/props.ts b/packages/shell/src/props.ts index d4d40cdf8..293fa60df 100644 --- a/packages/shell/src/props.ts +++ b/packages/shell/src/props.ts @@ -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); + } } \ No newline at end of file diff --git a/packages/shell/src/setting-prop-entry.ts b/packages/shell/src/setting-prop-entry.ts index 57b4c8a36..7449e7bc2 100644 --- a/packages/shell/src/setting-prop-entry.ts +++ b/packages/shell/src/setting-prop-entry.ts @@ -64,6 +64,10 @@ export default class SettingPropEntry { return this[settingPropEntrySymbol].extraProps; } + get props() { + return SettingTopEntry.create(this[settingPropEntrySymbol].props); + } + /** * 获取设置属性对应的节点实例 */