| 213 | * hidden |
| 214 | */ |
| 215 | export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema> implements IBaseNode { |
| 216 | private emitter: IEventBus; |
| 217 | |
| 218 | /** |
| 219 | * 是节点实例 |
| 220 | */ |
| 221 | readonly isNode = true; |
| 222 | |
| 223 | /** |
| 224 | * 节点 id |
| 225 | */ |
| 226 | readonly id: string; |
| 227 | |
| 228 | /** |
| 229 | * 节点组件类型 |
| 230 | * 特殊节点: |
| 231 | * * Page 页面 |
| 232 | * * Block 区块 |
| 233 | * * Component 组件/元件 |
| 234 | * * Fragment 碎片节点,无 props,有指令 |
| 235 | * * Leaf 文字节点 | 表达式节点,无 props,无指令? |
| 236 | * * Slot 插槽节点,无 props,正常 children,有 slotArgs,有指令 |
| 237 | */ |
| 238 | readonly componentName: string; |
| 239 | |
| 240 | /** |
| 241 | * 属性抽象 |
| 242 | */ |
| 243 | props: IProps; |
| 244 | |
| 245 | protected _children?: INodeChildren; |
| 246 | |
| 247 | /** |
| 248 | * @deprecated |
| 249 | */ |
| 250 | private _addons: { [key: string]: { exportData: () => any; isProp: boolean } } = {}; |
| 251 | |
| 252 | @obx.ref private _parent: INode | null = null; |
| 253 | |
| 254 | /** |
| 255 | * 父级节点 |
| 256 | */ |
| 257 | get parent(): INode | null { |
| 258 | return this._parent; |
| 259 | } |
| 260 | |
| 261 | /** |
| 262 | * 当前节点子集 |
| 263 | */ |
| 264 | get children(): INodeChildren | null { |
| 265 | return this._children || null; |
| 266 | } |
| 267 | |
| 268 | /** |
| 269 | * 当前节点深度 |
| 270 | */ |
| 271 | @computed get zLevel(): number { |
| 272 | if (this._parent) { |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…