GeezerVison is showing github.com — feat: add some necessary methods and attributes · webstager/lowcode-engine@4fd7f27
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: packages/designer/src/designer/designer.ts +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -550,7 +550,7 @@ export class Designer { |
550 | 550 |
|
551 | 551 | return reducers.reduce((xprops, reducer) => { |
552 | 552 | try { |
553 | | - return reducer(xprops, node, { stage }); |
| 553 | + return reducer(xprops, node.internalToShellNode() as any, { stage }); |
554 | 554 | } catch (e) { |
555 | 555 | // todo: add log |
556 | 556 | console.warn(e); |
|
Collapse file
Copy file name to clipboardExpand all lines: packages/shell/src/document-model.ts +7Lines changed: 7 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -61,6 +61,13 @@ export default class DocumentModel { |
61 | 61 | return new DocumentModel(document); |
62 | 62 | } |
63 | 63 |
|
| 64 | + /** |
| 65 | + * id |
| 66 | + */ |
| 67 | + get id() { |
| 68 | + return this[documentSymbol].id; |
| 69 | + } |
| 70 | + |
64 | 71 | /** |
65 | 72 | * 获取当前文档所属的 project |
66 | 73 | * @returns |
|
Collapse file
Copy file name to clipboardExpand all lines: packages/shell/src/node.ts +5Lines changed: 5 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -9,6 +9,7 @@ import Props from './props'; |
9 | 9 | import DocumentModel from './document-model'; |
10 | 10 | import NodeChildren from './node-children'; |
11 | 11 | import ComponentMeta from './component-meta'; |
| 12 | +import SettingTopEntry from './setting-top-entry'; |
12 | 13 | import { documentSymbol, nodeSymbol } from './symbols'; |
13 | 14 |
|
14 | 15 | const shellNodeSymbol = Symbol('shellNodeSymbol'); |
@@ -237,6 +238,10 @@ export default class Node { |
237 | 238 | return this[nodeSymbol].schema; |
238 | 239 | } |
239 | 240 |
|
| 241 | + get settingEntry(): any { |
| 242 | + return SettingTopEntry.create(this[nodeSymbol].settingEntry as any); |
| 243 | + } |
| 244 | + |
240 | 245 | /** |
241 | 246 | * @deprecated use .children instead |
242 | 247 | */ |
|
Collapse file
Copy file name to clipboardExpand all lines: packages/shell/src/props.ts +19Lines changed: 19 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -94,4 +94,23 @@ export default class Props { |
94 | 94 | setExtraPropValue(path: string, value: CompositeValue) { |
95 | 95 | return this.getExtraProp(path)?.setValue(value); |
96 | 96 | } |
| 97 | + |
| 98 | + /** |
| 99 | + * test if the specified key is existing or not. |
| 100 | + * @param key |
| 101 | + * @returns |
| 102 | + */ |
| 103 | + has(key: string) { |
| 104 | + return this[propsSymbol].has(key); |
| 105 | + } |
| 106 | + |
| 107 | + /** |
| 108 | + * add a key with given value |
| 109 | + * @param value |
| 110 | + * @param key |
| 111 | + * @returns |
| 112 | + */ |
| 113 | + add(value: CompositeValue, key?: string | number | undefined) { |
| 114 | + return this[propsSymbol].add(value, key); |
| 115 | + } |
97 | 116 | } |
Collapse file
Copy file name to clipboardExpand all lines: packages/shell/src/setting-prop-entry.ts +4Lines changed: 4 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -64,6 +64,10 @@ export default class SettingPropEntry { |
64 | 64 | return this[settingPropEntrySymbol].extraProps; |
65 | 65 | } |
66 | 66 |
|
| 67 | + get props() { |
| 68 | + return SettingTopEntry.create(this[settingPropEntrySymbol].props); |
| 69 | + } |
| 70 | + |
67 | 71 | /** |
68 | 72 | * 获取设置属性对应的节点实例 |
69 | 73 | */ |
|