(
readonly document: Document,
Schema: Schema,
)
| 114 | } |
| 115 | |
| 116 | constructor( |
| 117 | readonly document: Document, |
| 118 | Schema: Schema, |
| 119 | ) { |
| 120 | const { id, componentName, children, props, ...extras } = Schema |
| 121 | |
| 122 | this.id = id || uniqueId('node') |
| 123 | this.componentName = componentName |
| 124 | this.props = new Props(this, props, extras) |
| 125 | this.props.merge(this.upgradeProps(this.initProps(props || {})), this.upgradeProps(extras)) |
| 126 | this.initBuiltinProps() |
| 127 | this._children = new NodeChildren(this, this.initialChildren(children)) |
| 128 | |
| 129 | this.onVisibleChange(visible => { |
| 130 | this.document.designer.postEvent(DESIGNER_EVENT.NODE_VISIBLE_CHANGE, this, visible) |
| 131 | }) |
| 132 | this.onLockChange(locked => { |
| 133 | this.document.designer.postEvent(DESIGNER_EVENT.NODE_LOCK_CHANGE, this, locked) |
| 134 | }) |
| 135 | this.onChildrenChange(info => { |
| 136 | this.document.designer.postEvent(DESIGNER_EVENT.NODE_CHILDREN_CHANGE, { |
| 137 | type: info?.type, |
| 138 | node: this, |
| 139 | }) |
| 140 | }) |
| 141 | } |
| 142 | |
| 143 | import(data: Schema, checkId = false) { |
| 144 | const { componentName, id, children, props, ...extras } = data |
nothing calls this directly
no test coverage detected