j-templates 7.0.41 → 7.0.43
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/Node/vNode.js +13 -20
- package/package.json +1 -1
package/Node/vNode.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.vNode = void 0;
|
|
4
4
|
const Store_1 = require("../Store");
|
|
5
|
-
const functions_1 = require("../Utils/functions");
|
|
6
5
|
const injector_1 = require("../Utils/injector");
|
|
7
6
|
const list_1 = require("../Utils/list");
|
|
8
7
|
const thread_1 = require("../Utils/thread");
|
|
@@ -153,18 +152,20 @@ function Children(vnode, children, data) {
|
|
|
153
152
|
function CreateChildrenScope(vnode, children, data) {
|
|
154
153
|
if (data === undefined)
|
|
155
154
|
return Store_1.ObservableScope.Create(WrapStaticChildren(vnode, children));
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
155
|
+
const dataScope = Store_1.ObservableScope.Create(data);
|
|
156
|
+
data = function () {
|
|
157
|
+
const result = Store_1.ObservableScope.Value(dataScope);
|
|
158
|
+
if (!result)
|
|
159
|
+
return [];
|
|
160
|
+
if (Array.isArray(result))
|
|
161
|
+
return result;
|
|
162
|
+
return [result];
|
|
163
|
+
};
|
|
164
164
|
const nodeList = list_1.List.Create();
|
|
165
|
-
const scope = Store_1.ObservableScope.Create(WrapChildren(vnode.injector, children,
|
|
165
|
+
const scope = Store_1.ObservableScope.Create(WrapChildren(vnode.injector, children, data, nodeList));
|
|
166
166
|
Store_1.ObservableScope.OnDestroyed(scope, function () {
|
|
167
167
|
DestroyNodeList(nodeList);
|
|
168
|
+
Store_1.ObservableScope.Destroy(dataScope);
|
|
168
169
|
});
|
|
169
170
|
return scope;
|
|
170
171
|
}
|
|
@@ -196,6 +197,8 @@ function WrapChildren(injector, children, data, nodeList) {
|
|
|
196
197
|
vNode.DestroyAll(existingNode.data.nodes);
|
|
197
198
|
existingNode.data.nodes = Store_1.ObservableScope.Value(existingNode.data.scope);
|
|
198
199
|
}
|
|
200
|
+
else
|
|
201
|
+
Store_1.ObservableScope.Touch(existingNode.data.scope);
|
|
199
202
|
}
|
|
200
203
|
else {
|
|
201
204
|
nodeListMap.delete(data);
|
|
@@ -275,16 +278,6 @@ function UpdateChildren(vnode, init = false, skipInit = false) {
|
|
|
275
278
|
});
|
|
276
279
|
});
|
|
277
280
|
}
|
|
278
|
-
function ToArray(callback) {
|
|
279
|
-
return function (...args) {
|
|
280
|
-
const result = callback(...args);
|
|
281
|
-
if (Array.isArray(result))
|
|
282
|
-
return result;
|
|
283
|
-
if (!result)
|
|
284
|
-
return [];
|
|
285
|
-
return [result];
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
281
|
function ScheduledAssignment(assign) {
|
|
289
282
|
let scheduled = false;
|
|
290
283
|
return function (scope) {
|