@leafer/display 1.0.0-beta.6 → 1.0.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -9
- package/src/Branch.ts +31 -30
- package/src/Leaf.ts +1 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/display",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.8",
|
|
4
4
|
"description": "@leafer/display",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,15 +19,15 @@
|
|
|
19
19
|
"leaferjs"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@leafer/math": "1.0.0-beta.
|
|
23
|
-
"@leafer/data": "1.0.0-beta.
|
|
24
|
-
"@leafer/layout": "1.0.0-beta.
|
|
25
|
-
"@leafer/display-module": "1.0.0-beta.
|
|
26
|
-
"@leafer/event": "1.0.0-beta.
|
|
27
|
-
"@leafer/decorator": "1.0.0-beta.
|
|
28
|
-
"@leafer/helper": "1.0.0-beta.
|
|
22
|
+
"@leafer/math": "1.0.0-beta.8",
|
|
23
|
+
"@leafer/data": "1.0.0-beta.8",
|
|
24
|
+
"@leafer/layout": "1.0.0-beta.8",
|
|
25
|
+
"@leafer/display-module": "1.0.0-beta.8",
|
|
26
|
+
"@leafer/event": "1.0.0-beta.8",
|
|
27
|
+
"@leafer/decorator": "1.0.0-beta.8",
|
|
28
|
+
"@leafer/helper": "1.0.0-beta.8"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@leafer/interface": "1.0.0-beta.
|
|
31
|
+
"@leafer/interface": "1.0.0-beta.8"
|
|
32
32
|
}
|
|
33
33
|
}
|
package/src/Branch.ts
CHANGED
|
@@ -67,7 +67,6 @@ export class Branch extends Leaf {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
public add(child: ILeaf, index?: number): void {
|
|
70
|
-
|
|
71
70
|
if (child.parent) child.parent.remove(child)
|
|
72
71
|
child.parent = this
|
|
73
72
|
|
|
@@ -79,48 +78,50 @@ export class Branch extends Leaf {
|
|
|
79
78
|
|
|
80
79
|
if (this.leafer) {
|
|
81
80
|
child.__bindLeafer(this.leafer)
|
|
82
|
-
|
|
83
|
-
if (this.leafer.ready) {
|
|
84
|
-
const { ADD } = ChildEvent
|
|
85
|
-
const event = new ChildEvent(ADD, child, this)
|
|
86
|
-
if (child.hasEvent(ADD)) child.emitEvent(event)
|
|
87
|
-
if (this.hasEvent(ADD) && !this.isLeafer) this.emitEvent(event)
|
|
88
|
-
this.leafer.emitEvent(event)
|
|
89
|
-
}
|
|
81
|
+
if (this.leafer.ready) this.__emitChildEvent(ChildEvent.ADD, child)
|
|
90
82
|
}
|
|
91
|
-
|
|
92
83
|
}
|
|
93
84
|
|
|
94
85
|
public remove(child?: Leaf): void {
|
|
95
|
-
|
|
96
86
|
if (child) {
|
|
97
87
|
const index = this.children.indexOf(child)
|
|
98
88
|
if (index > -1) {
|
|
99
89
|
this.children.splice(index, 1)
|
|
100
|
-
if (this.__hasMask) this.__updateMask()
|
|
101
|
-
this.__layout.boxChange()
|
|
102
|
-
|
|
103
90
|
if (child.isBranch) this.__.__childBranchNumber = (this.__.__childBranchNumber || 1) - 1
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
if (this.leafer) {
|
|
107
|
-
child.__bindLeafer(null)
|
|
108
|
-
|
|
109
|
-
if (this.leafer.ready) {
|
|
110
|
-
const { REMOVE } = ChildEvent
|
|
111
|
-
const event = new ChildEvent(REMOVE, child, this)
|
|
112
|
-
if (child.hasEvent(REMOVE)) child.emitEvent(event)
|
|
113
|
-
if (this.hasEvent(REMOVE) && !this.isLeafer) this.emitEvent(event)
|
|
114
|
-
this.leafer.emitEvent(event)
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
91
|
+
this.__preRemove()
|
|
92
|
+
this.__realRemoveChild(child)
|
|
118
93
|
}
|
|
119
|
-
} else {
|
|
94
|
+
} else if (child === undefined) {
|
|
120
95
|
super.remove()
|
|
121
96
|
}
|
|
97
|
+
}
|
|
122
98
|
|
|
99
|
+
public removeAll(): void {
|
|
100
|
+
const { children } = this
|
|
101
|
+
this.children = []
|
|
102
|
+
this.__preRemove()
|
|
103
|
+
this.__.__childBranchNumber = 0
|
|
104
|
+
children.forEach(child => { this.__realRemoveChild(child) })
|
|
123
105
|
}
|
|
124
|
-
}
|
|
125
106
|
|
|
107
|
+
protected __preRemove(): void {
|
|
108
|
+
if (this.__hasMask) this.__updateMask()
|
|
109
|
+
if (this.__hasEraser) this.__updateEraser()
|
|
110
|
+
this.__layout.boxChange()
|
|
111
|
+
}
|
|
126
112
|
|
|
113
|
+
protected __realRemoveChild(child: ILeaf): void {
|
|
114
|
+
child.parent = null
|
|
115
|
+
if (this.leafer) {
|
|
116
|
+
child.__bindLeafer(null)
|
|
117
|
+
if (this.leafer.ready) this.__emitChildEvent(ChildEvent.REMOVE, child)
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
protected __emitChildEvent(type: string, child: ILeaf): void {
|
|
122
|
+
const event = new ChildEvent(type, child, this)
|
|
123
|
+
if (child.hasEvent(type)) child.emitEvent(event)
|
|
124
|
+
if (this.hasEvent(type) && !this.isLeafer) this.emitEvent(event)
|
|
125
|
+
this.leafer.emitEvent(event)
|
|
126
|
+
}
|
|
127
|
+
}
|
package/src/Leaf.ts
CHANGED
|
@@ -130,8 +130,7 @@ export class Leaf implements ILeaf {
|
|
|
130
130
|
|
|
131
131
|
public forceUpdate(attrName?: string): void {
|
|
132
132
|
if (!attrName) attrName = 'x'
|
|
133
|
-
const value = this.__.
|
|
134
|
-
this.__[attrName] = (value === null) ? 0 : null;
|
|
133
|
+
const value = this.__.__getInput(attrName);
|
|
135
134
|
(this as any)[attrName] = value
|
|
136
135
|
}
|
|
137
136
|
|