@zcomponent/core 0.0.11 → 0.0.12
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/lib/zcomponent.d.ts +1 -0
- package/lib/zcomponent.js +5 -0
- package/package.json +1 -1
package/lib/zcomponent.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ export declare class ZComponent<RootType = any> extends Component<RootType> {
|
|
|
36
36
|
[id: string]: Component | Component[];
|
|
37
37
|
};
|
|
38
38
|
entityByID: Map<string, any>;
|
|
39
|
+
entityByLabel: Map<string, any>;
|
|
39
40
|
private _constructedResolve;
|
|
40
41
|
constructed: Promise<void>;
|
|
41
42
|
isConstructed: boolean;
|
package/lib/zcomponent.js
CHANGED
|
@@ -21,6 +21,7 @@ export class ZComponent extends Component {
|
|
|
21
21
|
this.idByElement = new Map();
|
|
22
22
|
this.nodes = {};
|
|
23
23
|
this.entityByID = new Map();
|
|
24
|
+
this.entityByLabel = new Map();
|
|
24
25
|
this.constructed = new Promise(resolve => this._constructedResolve = resolve);
|
|
25
26
|
this.isConstructed = false;
|
|
26
27
|
this._nodesById = new Map();
|
|
@@ -69,6 +70,8 @@ export class ZComponent extends Component {
|
|
|
69
70
|
setCurrentZComponentConstruction(that);
|
|
70
71
|
super(contextManager, constructorProps);
|
|
71
72
|
that.entityByID.set(nodeId, this);
|
|
73
|
+
if (node?.label)
|
|
74
|
+
that.entityByLabel.set(node.label, this);
|
|
72
75
|
that._nodesById.set(nodeId, this);
|
|
73
76
|
for (const element of this.elementsResolved) {
|
|
74
77
|
that.idByElement.set(element, nodeId);
|
|
@@ -111,6 +114,8 @@ export class ZComponent extends Component {
|
|
|
111
114
|
}
|
|
112
115
|
dispose() {
|
|
113
116
|
that.entityByID.delete(nodeId);
|
|
117
|
+
if (node.label)
|
|
118
|
+
that.entityByLabel.delete(node.label);
|
|
114
119
|
that._nodesById.delete(nodeId);
|
|
115
120
|
for (const element of this.elementsResolved) {
|
|
116
121
|
that.idByElement.delete(element);
|