@leafer/display 1.0.5 → 1.0.7
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 +11 -11
- package/src/Branch.ts +7 -5
- package/src/Leaf.ts +1 -1
- package/types/index.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/display",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "@leafer/display",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,17 +22,17 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/math": "1.0.
|
|
26
|
-
"@leafer/data": "1.0.
|
|
27
|
-
"@leafer/layout": "1.0.
|
|
28
|
-
"@leafer/display-module": "1.0.
|
|
29
|
-
"@leafer/event": "1.0.
|
|
30
|
-
"@leafer/decorator": "1.0.
|
|
31
|
-
"@leafer/helper": "1.0.
|
|
32
|
-
"@leafer/debug": "1.0.
|
|
33
|
-
"@leafer/platform": "1.0.
|
|
25
|
+
"@leafer/math": "1.0.7",
|
|
26
|
+
"@leafer/data": "1.0.7",
|
|
27
|
+
"@leafer/layout": "1.0.7",
|
|
28
|
+
"@leafer/display-module": "1.0.7",
|
|
29
|
+
"@leafer/event": "1.0.7",
|
|
30
|
+
"@leafer/decorator": "1.0.7",
|
|
31
|
+
"@leafer/helper": "1.0.7",
|
|
32
|
+
"@leafer/debug": "1.0.7",
|
|
33
|
+
"@leafer/platform": "1.0.7"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@leafer/interface": "1.0.
|
|
36
|
+
"@leafer/interface": "1.0.7"
|
|
37
37
|
}
|
|
38
38
|
}
|
package/src/Branch.ts
CHANGED
|
@@ -65,12 +65,16 @@ export class Branch extends Leaf { // tip: rewrited Group
|
|
|
65
65
|
|
|
66
66
|
public add(child: ILeaf, index?: number): void {
|
|
67
67
|
if (child === this) return
|
|
68
|
-
|
|
68
|
+
const noIndex = index === undefined
|
|
69
|
+
if (!child.__) {
|
|
70
|
+
if (child instanceof Array) return child.forEach(item => { this.add(item, index); noIndex || index++ }) // add []
|
|
71
|
+
else child = UICreator.get(child.tag, child) // add JSON
|
|
72
|
+
}
|
|
69
73
|
|
|
70
74
|
if (child.parent) child.parent.remove(child)
|
|
71
75
|
child.parent = this
|
|
72
76
|
|
|
73
|
-
|
|
77
|
+
noIndex ? this.children.push(child) : this.children.splice(index, 0, child)
|
|
74
78
|
if (child.isBranch) this.__.__childBranchNumber = (this.__.__childBranchNumber || 0) + 1
|
|
75
79
|
|
|
76
80
|
child.__layout.boxChanged || child.__layout.boxChange() // layouted(removed), need update
|
|
@@ -86,9 +90,7 @@ export class Branch extends Leaf { // tip: rewrited Group
|
|
|
86
90
|
this.__layout.affectChildrenSort && this.__layout.childrenSortChange()
|
|
87
91
|
}
|
|
88
92
|
|
|
89
|
-
public addMany(...children: ILeaf[]): void {
|
|
90
|
-
children.forEach(child => this.add(child))
|
|
91
|
-
}
|
|
93
|
+
public addMany(...children: ILeaf[]): void { this.add(children as any) }
|
|
92
94
|
|
|
93
95
|
public remove(child?: ILeaf, destroy?: boolean): void {
|
|
94
96
|
if (child) {
|
package/src/Leaf.ts
CHANGED
|
@@ -612,7 +612,7 @@ export class Leaf implements ILeaf {
|
|
|
612
612
|
|
|
613
613
|
public __updateSortChildren(): void { }
|
|
614
614
|
|
|
615
|
-
public add(_child: ILeaf | ILeafInputData, _index?: number): void { }
|
|
615
|
+
public add(_child: ILeaf | ILeaf[] | ILeafInputData | ILeafInputData[], _index?: number): void { }
|
|
616
616
|
|
|
617
617
|
public remove(_child?: ILeaf | number | string | IFindMethod, destroy?: boolean): void {
|
|
618
618
|
if (this.parent) this.parent.remove(this, destroy)
|
package/types/index.d.ts
CHANGED
|
@@ -168,7 +168,7 @@ declare class Leaf implements ILeaf {
|
|
|
168
168
|
__updateMotionPath(): void;
|
|
169
169
|
__runAnimation(_type: 'in' | 'out', _complete?: IFunction): void;
|
|
170
170
|
__updateSortChildren(): void;
|
|
171
|
-
add(_child: ILeaf | ILeafInputData, _index?: number): void;
|
|
171
|
+
add(_child: ILeaf | ILeaf[] | ILeafInputData | ILeafInputData[], _index?: number): void;
|
|
172
172
|
remove(_child?: ILeaf | number | string | IFindMethod, destroy?: boolean): void;
|
|
173
173
|
dropTo(parent: ILeaf, index?: number, resize?: boolean): void;
|
|
174
174
|
on(_type: string | string[] | IEventMap, _listener?: IEventListener, _options?: IEventOption): void;
|