targetj 1.0.234 → 1.0.236
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/build/BaseModel.js +56 -35
- package/build/BracketGenerator.js +3 -3
- package/build/EventListener.js +144 -20
- package/build/LocationManager.js +82 -26
- package/build/PageManager.js +1 -1
- package/build/RunScheduler.js +145 -103
- package/build/TModelManager.js +43 -28
- package/build/TUtil.js +32 -0
- package/build/TargetData.js +22 -2
- package/build/TargetExecutor.js +1 -1
- package/build/TargetManager.js +3 -3
- package/build/TargetUtil.js +93 -26
- package/dist/targetjs.js +1 -1
- package/dist/targetjs.js.gz +0 -0
- package/package.json +1 -1
package/build/TModelManager.js
CHANGED
|
@@ -44,7 +44,7 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
|
|
|
44
44
|
reasyncStyle: [],
|
|
45
45
|
reattach: [],
|
|
46
46
|
relocation: [],
|
|
47
|
-
|
|
47
|
+
deletedDom: [],
|
|
48
48
|
noDom: [],
|
|
49
49
|
updatingTModels: [],
|
|
50
50
|
activeTModels: [],
|
|
@@ -52,6 +52,7 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
|
|
|
52
52
|
activeTargets: []
|
|
53
53
|
};
|
|
54
54
|
this.visibleOidMap = {};
|
|
55
|
+
this.preservedDomMap = {};
|
|
55
56
|
this.targetMethodMap = {};
|
|
56
57
|
this.noDomMap = {};
|
|
57
58
|
}
|
|
@@ -76,6 +77,7 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
|
|
|
76
77
|
key: "clearAll",
|
|
77
78
|
value: function clearAll() {
|
|
78
79
|
this.visibleOidMap = {};
|
|
80
|
+
this.preservedDomMap = {};
|
|
79
81
|
this.clearFrameLists();
|
|
80
82
|
this.deleteDoms();
|
|
81
83
|
}
|
|
@@ -84,6 +86,7 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
|
|
|
84
86
|
value: function analyze() {
|
|
85
87
|
var _this = this;
|
|
86
88
|
var lastVisibleMap = _objectSpread({}, this.visibleOidMap);
|
|
89
|
+
var lastPreservedMap = _objectSpread({}, this.preservedDomMap);
|
|
87
90
|
this.clearFrameLists();
|
|
88
91
|
var activated = [];
|
|
89
92
|
var _iterator = _createForOfIteratorHelper((0, _App.getLocationManager)().hasLocationList),
|
|
@@ -92,35 +95,40 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
|
|
|
92
95
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
93
96
|
var tmodel = _step.value;
|
|
94
97
|
lastVisibleMap[tmodel.oid] = undefined;
|
|
98
|
+
lastPreservedMap[tmodel.oid] = undefined;
|
|
95
99
|
if (!tmodel.exists()) {
|
|
96
100
|
if (tmodel.hasDom()) {
|
|
97
|
-
this.
|
|
101
|
+
this.addToDeletedDom(tmodel);
|
|
98
102
|
}
|
|
99
103
|
delete this.visibleOidMap[tmodel.oid];
|
|
104
|
+
delete this.preservedDomMap[tmodel.oid];
|
|
100
105
|
continue;
|
|
101
106
|
}
|
|
102
107
|
var visible = tmodel.isVisible();
|
|
103
108
|
if (visible && tmodel.isIncluded()) {
|
|
104
109
|
this.visibleOidMap[tmodel.oid] = tmodel;
|
|
110
|
+
delete this.preservedDomMap[tmodel.oid];
|
|
105
111
|
this.lists.visible.push(tmodel);
|
|
106
112
|
} else {
|
|
107
113
|
delete this.visibleOidMap[tmodel.oid];
|
|
108
114
|
}
|
|
109
|
-
var
|
|
110
|
-
if (
|
|
111
|
-
this.
|
|
115
|
+
var preserveDom = this.shouldPreserveDom(tmodel);
|
|
116
|
+
if (!visible && preserveDom && tmodel.hasDom()) {
|
|
117
|
+
this.preservedDomMap[tmodel.oid] = tmodel;
|
|
118
|
+
} else {
|
|
119
|
+
delete this.preservedDomMap[tmodel.oid];
|
|
112
120
|
}
|
|
113
121
|
if (tmodel.hasDom()) {
|
|
114
|
-
if (!tmodel.canHaveDom() || !tmodel.isIncluded() || tmodel.canDeleteDom() && !visible && !
|
|
115
|
-
this.
|
|
122
|
+
if (!tmodel.canHaveDom() || !tmodel.isIncluded() || tmodel.canDeleteDom() && !visible && !preserveDom) {
|
|
123
|
+
this.addToDeletedDom(tmodel);
|
|
116
124
|
tmodel.getChildren().forEach(function (tmodel) {
|
|
117
125
|
if (!tmodel.managesOwnScroll()) {
|
|
118
|
-
_this.
|
|
126
|
+
_this.addToRecursiveDeletedDom(tmodel);
|
|
119
127
|
}
|
|
120
128
|
});
|
|
121
129
|
}
|
|
122
130
|
}
|
|
123
|
-
if (visible || tmodel.isActivated()
|
|
131
|
+
if (visible || tmodel.isActivated()) {
|
|
124
132
|
var _state$updatingTarget, _state$activeTargetLi;
|
|
125
133
|
var state = tmodel.state();
|
|
126
134
|
if (((_state$updatingTarget = state.updatingTargetList) === null || _state$updatingTarget === void 0 ? void 0 : _state$updatingTarget.length) > 0 || tmodel.hasAnimatingTargets()) {
|
|
@@ -132,7 +140,7 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
|
|
|
132
140
|
this.lists.activeTargets = [].concat(_toConsumableArray(this.lists.activeTargets), _toConsumableArray(state.activeTargetList));
|
|
133
141
|
}
|
|
134
142
|
}
|
|
135
|
-
if (visible || tmodel.isActivated()
|
|
143
|
+
if (visible || tmodel.isActivated()) {
|
|
136
144
|
if (this.needsRerender(tmodel)) {
|
|
137
145
|
this.lists.rerender.push(tmodel);
|
|
138
146
|
}
|
|
@@ -157,7 +165,7 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
|
|
|
157
165
|
activated.push(tmodel);
|
|
158
166
|
}
|
|
159
167
|
}
|
|
160
|
-
if (visible || tmodel.requiresDom()
|
|
168
|
+
if (visible || tmodel.requiresDom()) {
|
|
161
169
|
if (tmodel.canHaveDom() && !tmodel.hasDom() && tmodel.isIncluded() && !this.noDomMap[tmodel.oid]) {
|
|
162
170
|
var _tmodel$getDomHolder, _tmodel$getDomParent;
|
|
163
171
|
if ((_tmodel$getDomHolder = tmodel.getDomHolder()) !== null && _tmodel$getDomHolder !== void 0 && _tmodel$getDomHolder.exists() || this.noDomMap[(_tmodel$getDomParent = tmodel.getDomParent()) === null || _tmodel$getDomParent === void 0 ? void 0 : _tmodel$getDomParent.oid]) {
|
|
@@ -177,27 +185,27 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
|
|
|
177
185
|
activated.forEach(function (t) {
|
|
178
186
|
return t.deactivate();
|
|
179
187
|
});
|
|
180
|
-
Object.values(lastVisibleMap).filter(function (v) {
|
|
188
|
+
Object.values(_objectSpread(_objectSpread({}, lastVisibleMap), lastPreservedMap)).filter(function (v) {
|
|
181
189
|
return v !== undefined;
|
|
182
190
|
}).forEach(function (tmodel) {
|
|
183
191
|
if (tmodel.hasDom()) {
|
|
184
192
|
if (!tmodel.exists() || !tmodel.isIncluded()) {
|
|
185
|
-
_this.
|
|
193
|
+
_this.addToDeletedDom(tmodel);
|
|
186
194
|
}
|
|
187
195
|
}
|
|
188
196
|
});
|
|
189
|
-
return this.lists.noDom.length > 0 ? 0 : this.lists.reattach.length > 0 ? 1 : this.lists.relocation.length > 0 ? 2 : this.lists.rerender.length > 0 ? 3 : this.lists.reasyncStyle.length > 0 ? 4 : this.lists.
|
|
197
|
+
return this.lists.noDom.length > 0 ? 0 : this.lists.reattach.length > 0 ? 1 : this.lists.relocation.length > 0 ? 2 : this.lists.rerender.length > 0 ? 3 : this.lists.reasyncStyle.length > 0 ? 4 : this.lists.deletedDom.length > 0 ? 5 : this.lists.restyle.length > 0 ? 10 : -1;
|
|
190
198
|
}
|
|
191
199
|
}, {
|
|
192
200
|
key: "shouldPreserveDom",
|
|
193
201
|
value: function shouldPreserveDom(tmodel) {
|
|
194
|
-
if (!tmodel.
|
|
202
|
+
if (!tmodel.isIncluded()) {
|
|
195
203
|
return false;
|
|
196
204
|
}
|
|
197
|
-
|
|
198
|
-
if (!tmodel.isIncluded()) {
|
|
205
|
+
if (!tmodel.isVisible() && _TUtil.TUtil.isDefined(tmodel.targets.isVisible)) {
|
|
199
206
|
return false;
|
|
200
207
|
}
|
|
208
|
+
var parent = tmodel.parent;
|
|
201
209
|
while (parent && parent !== (0, _App.tRoot)()) {
|
|
202
210
|
if (_TUtil.TUtil.isDefined(parent.targets.canDeleteDom)) {
|
|
203
211
|
return parent.val('canDeleteDom') === false;
|
|
@@ -225,27 +233,29 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
|
|
|
225
233
|
return true;
|
|
226
234
|
}
|
|
227
235
|
}, {
|
|
228
|
-
key: "
|
|
229
|
-
value: function
|
|
236
|
+
key: "addToRecursiveDeletedDom",
|
|
237
|
+
value: function addToRecursiveDeletedDom(tmodel) {
|
|
230
238
|
var _this2 = this;
|
|
231
239
|
delete this.visibleOidMap[tmodel.oid];
|
|
232
|
-
|
|
240
|
+
delete this.preservedDomMap[tmodel.oid];
|
|
241
|
+
if (!this.lists.deletedDom.includes(tmodel)) {
|
|
233
242
|
if (tmodel.hasDom()) {
|
|
234
|
-
this.lists.
|
|
243
|
+
this.lists.deletedDom.push(tmodel);
|
|
235
244
|
}
|
|
236
245
|
tmodel.getChildren().forEach(function (tmodel) {
|
|
237
246
|
if (!tmodel.managesOwnScroll()) {
|
|
238
|
-
_this2.
|
|
247
|
+
_this2.addToRecursiveDeletedDom(tmodel);
|
|
239
248
|
}
|
|
240
249
|
});
|
|
241
250
|
}
|
|
242
251
|
}
|
|
243
252
|
}, {
|
|
244
|
-
key: "
|
|
245
|
-
value: function
|
|
253
|
+
key: "addToDeletedDom",
|
|
254
|
+
value: function addToDeletedDom(tmodel) {
|
|
246
255
|
delete this.visibleOidMap[tmodel.oid];
|
|
247
|
-
|
|
248
|
-
|
|
256
|
+
delete this.preservedDomMap[tmodel.oid];
|
|
257
|
+
if (!this.lists.deletedDom.includes(tmodel)) {
|
|
258
|
+
this.lists.deletedDom.push(tmodel);
|
|
249
259
|
}
|
|
250
260
|
}
|
|
251
261
|
}, {
|
|
@@ -253,6 +263,11 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
|
|
|
253
263
|
value: function getVisibles() {
|
|
254
264
|
return Object.values(this.visibleOidMap);
|
|
255
265
|
}
|
|
266
|
+
}, {
|
|
267
|
+
key: "getAvailableDoms",
|
|
268
|
+
value: function getAvailableDoms() {
|
|
269
|
+
return Object.values(_objectSpread(_objectSpread({}, this.preservedDomMap), this.visibleOidMap));
|
|
270
|
+
}
|
|
256
271
|
}, {
|
|
257
272
|
key: "needsRelocation",
|
|
258
273
|
value: function needsRelocation(tmodel) {
|
|
@@ -384,7 +399,7 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
|
|
|
384
399
|
}, {
|
|
385
400
|
key: "deleteDoms",
|
|
386
401
|
value: function deleteDoms() {
|
|
387
|
-
var _iterator5 = _createForOfIteratorHelper(this.lists.
|
|
402
|
+
var _iterator5 = _createForOfIteratorHelper(this.lists.deletedDom),
|
|
388
403
|
_step5;
|
|
389
404
|
try {
|
|
390
405
|
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
@@ -399,7 +414,7 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
|
|
|
399
414
|
} finally {
|
|
400
415
|
_iterator5.f();
|
|
401
416
|
}
|
|
402
|
-
this.lists.
|
|
417
|
+
this.lists.deletedDom.length = 0;
|
|
403
418
|
}
|
|
404
419
|
}, {
|
|
405
420
|
key: "deleteDom",
|
package/build/TUtil.js
CHANGED
|
@@ -364,6 +364,12 @@ var TUtil = exports.TUtil = /*#__PURE__*/function () {
|
|
|
364
364
|
tmodel.setScheduleTimeStamp(key, now);
|
|
365
365
|
return 0;
|
|
366
366
|
}
|
|
367
|
+
var remaining = tmodel.getScheduleRemainingTime(key);
|
|
368
|
+
if (TUtil.isDefined(remaining)) {
|
|
369
|
+
tmodel.setScheduleTimeStamp(key, now - Math.max(interval - remaining, 0));
|
|
370
|
+
tmodel.resetScheduleRemainingTime(key);
|
|
371
|
+
return remaining;
|
|
372
|
+
}
|
|
367
373
|
var lastScheduledTime = tmodel.getScheduleTimeStamp(key);
|
|
368
374
|
if (TUtil.isDefined(lastScheduledTime)) {
|
|
369
375
|
var elapsed = now - lastScheduledTime;
|
|
@@ -372,6 +378,32 @@ var TUtil = exports.TUtil = /*#__PURE__*/function () {
|
|
|
372
378
|
tmodel.setScheduleTimeStamp(key, now);
|
|
373
379
|
return interval;
|
|
374
380
|
}
|
|
381
|
+
}, {
|
|
382
|
+
key: "pauseSchedule",
|
|
383
|
+
value: function pauseSchedule(tmodel, key) {
|
|
384
|
+
var interval = tmodel.getTargetInterval(key);
|
|
385
|
+
var lastScheduledTime = tmodel.getScheduleTimeStamp(key);
|
|
386
|
+
if (interval <= 0 || !TUtil.isDefined(lastScheduledTime)) {
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
var now = TUtil.now();
|
|
390
|
+
var elapsed = now - lastScheduledTime;
|
|
391
|
+
var remaining = Math.max(interval - elapsed, 0);
|
|
392
|
+
tmodel.setScheduleRemainingTime(key, remaining);
|
|
393
|
+
tmodel.resetScheduleTimeStamp(key);
|
|
394
|
+
}
|
|
395
|
+
}, {
|
|
396
|
+
key: "resumeSchedule",
|
|
397
|
+
value: function resumeSchedule(tmodel, key) {
|
|
398
|
+
var remaining = tmodel.getScheduleRemainingTime(key);
|
|
399
|
+
if (!TUtil.isDefined(remaining)) {
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
var now = TUtil.now();
|
|
403
|
+
var interval = tmodel.getTargetInterval(key);
|
|
404
|
+
tmodel.setScheduleTimeStamp(key, now - Math.max(interval - remaining, 0));
|
|
405
|
+
tmodel.resetScheduleRemainingTime(key);
|
|
406
|
+
}
|
|
375
407
|
}, {
|
|
376
408
|
key: "runTargetValue",
|
|
377
409
|
value: function runTargetValue(tmodel, target, key, cycle, lastValue) {
|
package/build/TargetData.js
CHANGED
|
@@ -708,7 +708,11 @@ _defineProperty(TargetData, "attributesToTargets", {
|
|
|
708
708
|
onscroll: 'onScroll',
|
|
709
709
|
onscrollleft: 'onScrollLeft',
|
|
710
710
|
onscrolltop: 'onScrollTop',
|
|
711
|
+
onscrollleftend: 'onScrollLeftEnd',
|
|
712
|
+
onscrolltopend: 'onScrollTopEnd',
|
|
711
713
|
onwindowscroll: 'onWindowScroll',
|
|
714
|
+
onwindowscrolltopend: 'onWindowScrollTopEnd',
|
|
715
|
+
onwindowscrollleftend: 'onWindowScrollLeftEnd',
|
|
712
716
|
onpopstate: 'onPopState',
|
|
713
717
|
onchange: 'onChange',
|
|
714
718
|
oninput: 'onInput',
|
|
@@ -796,7 +800,11 @@ _defineProperty(TargetData, "targetToEventsMapping", {
|
|
|
796
800
|
onScroll: ['touchStart', 'mouseStart', 'wheelEvents'],
|
|
797
801
|
onScrollLeft: ['touchStart', 'mouseStart', 'wheelEvents'],
|
|
798
802
|
onScrollTop: ['touchStart', 'mouseStart', 'wheelEvents'],
|
|
803
|
+
onScrollLeftEnd: ['touchStart', 'mouseStart', 'wheelEvents'],
|
|
804
|
+
onScrollTopEnd: ['touchStart', 'mouseStart', 'wheelEvents'],
|
|
799
805
|
onWindowScroll: ['containerScroll'],
|
|
806
|
+
onWindowScrollTopEnd: ['containerScroll'],
|
|
807
|
+
onWindowScrollLeftEnd: ['containerScroll'],
|
|
800
808
|
onPopState: ['popState'],
|
|
801
809
|
onChange: ['changeEvents'],
|
|
802
810
|
onInput: ['inputEvents'],
|
|
@@ -879,8 +887,20 @@ _defineProperty(TargetData, "allEventMap", {
|
|
|
879
887
|
onScrollLeft: function onScrollLeft(tmodel) {
|
|
880
888
|
return (0, _App.getEvents)().getOrientation() !== 'vertical' && (0, _App.getEvents)().isScrollLeftHandler(tmodel) && (0, _App.getEvents)().deltaX();
|
|
881
889
|
},
|
|
882
|
-
|
|
883
|
-
return (0, _App.getEvents)().getEventType() === '
|
|
890
|
+
onScrollTopEnd: function onScrollTopEnd(tmodel) {
|
|
891
|
+
return (0, _App.getEvents)().getEventType() === 'scrolltopend' && (0, _App.getEvents)().isScrollTopEndHandler(tmodel);
|
|
892
|
+
},
|
|
893
|
+
onScrollLeftEnd: function onScrollLeftEnd(tmodel) {
|
|
894
|
+
return (0, _App.getEvents)().getEventType() === 'scrollleftend' && (0, _App.getEvents)().isScrollLeftEndHandler(tmodel);
|
|
895
|
+
},
|
|
896
|
+
onWindowScroll: function onWindowScroll(tmodel) {
|
|
897
|
+
return (0, _App.getEvents)().getEventType() === 'scroll' && (0, _App.getEvents)().getEventTModel() === tmodel;
|
|
898
|
+
},
|
|
899
|
+
onWindowScrollTopEnd: function onWindowScrollTopEnd(tmodel) {
|
|
900
|
+
return (0, _App.getEvents)().getEventType() === 'windowscrolltopend' && (0, _App.getEvents)().getEventTModel() === tmodel;
|
|
901
|
+
},
|
|
902
|
+
onWindowScrollLeftEnd: function onWindowScrollLeftEnd(tmodel) {
|
|
903
|
+
return (0, _App.getEvents)().getEventType() === 'windowscrollleftend' && (0, _App.getEvents)().getEventTModel() === tmodel;
|
|
884
904
|
},
|
|
885
905
|
onPopState: function onPopState() {
|
|
886
906
|
return (0, _App.getEvents)().getEventType() === 'popstate';
|
package/build/TargetExecutor.js
CHANGED
|
@@ -163,7 +163,7 @@ var TargetExecutor = exports.TargetExecutor = /*#__PURE__*/function () {
|
|
|
163
163
|
var newStatus = TargetExecutor.calculateTargetStatus(tmodel, targetValue, key);
|
|
164
164
|
tmodel.setTargetStatus(key, newStatus);
|
|
165
165
|
if (!_TargetData.TargetData.ignoreRerun[key] && tmodel.shouldScheduleRun(key)) {
|
|
166
|
-
(0, _App.getRunScheduler)().schedule(1, 'updateTarget2-' + tmodel.oid
|
|
166
|
+
(0, _App.getRunScheduler)().schedule(1, 'updateTarget2-' + tmodel.oid);
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
}, {
|
package/build/TargetManager.js
CHANGED
|
@@ -65,7 +65,7 @@ var TargetManager = exports.TargetManager = /*#__PURE__*/function () {
|
|
|
65
65
|
}
|
|
66
66
|
var schedulePeriod = _TUtil.TUtil.scheduleExecution(tmodel, key);
|
|
67
67
|
if (schedulePeriod > 0) {
|
|
68
|
-
(0, _App.getRunScheduler)().
|
|
68
|
+
(0, _App.getRunScheduler)().schedule(schedulePeriod, "targetSchedule__".concat(tmodel.oid));
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -97,7 +97,7 @@ var TargetManager = exports.TargetManager = /*#__PURE__*/function () {
|
|
|
97
97
|
var key = _step2.value;
|
|
98
98
|
schedulePeriod = _TUtil.TUtil.scheduleExecution(tmodel, key);
|
|
99
99
|
if (schedulePeriod > 0) {
|
|
100
|
-
(0, _App.getRunScheduler)().schedule(schedulePeriod, "setActualValues-".concat(tmodel.oid
|
|
100
|
+
(0, _App.getRunScheduler)().schedule(schedulePeriod, "setActualValues-".concat(tmodel.oid));
|
|
101
101
|
} else {
|
|
102
102
|
tmodel.resetScheduleTimeStamp(key);
|
|
103
103
|
this.setActualValue(tmodel, key);
|
|
@@ -333,7 +333,7 @@ var TargetManager = exports.TargetManager = /*#__PURE__*/function () {
|
|
|
333
333
|
return;
|
|
334
334
|
}
|
|
335
335
|
if (!tmodel.isTargetImperative(key) && !tmodel.isTargetEnabled(key)) {
|
|
336
|
-
(0, _App.getRunScheduler)().schedule(15, "setActualValue-postpone-".concat(tmodel.oid, "
|
|
336
|
+
(0, _App.getRunScheduler)().schedule(15, "setActualValue-postpone-".concat(tmodel.oid, "}"));
|
|
337
337
|
return;
|
|
338
338
|
}
|
|
339
339
|
var theValue = tmodel.getTargetValue(key);
|
package/build/TargetUtil.js
CHANGED
|
@@ -311,7 +311,7 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
311
311
|
tmodel.setTargetMethodName(key, "onComplete");
|
|
312
312
|
}
|
|
313
313
|
var fetchAction = target === null || target === void 0 ? void 0 : target.fetchAction;
|
|
314
|
-
if (fetchAction && (0, _App.getLoader)().
|
|
314
|
+
if (fetchAction && (0, _App.getLoader)().isLoadingSuccessful(tmodel, key)) {
|
|
315
315
|
var index = tmodel.fetchActionTargetList.indexOf(key);
|
|
316
316
|
if (index >= 0) {
|
|
317
317
|
tmodel.fetchActionTargetList.splice(index, 1);
|
|
@@ -411,7 +411,7 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
411
411
|
}, {
|
|
412
412
|
key: "isTargetFullyCompleted",
|
|
413
413
|
value: function isTargetFullyCompleted(tmodel, key) {
|
|
414
|
-
var result = !tmodel.isTargetUpdating(key) && tmodel.
|
|
414
|
+
var result = !tmodel.isTargetUpdating(key) && tmodel.isTargetTreeComplete(key) === true;
|
|
415
415
|
if (result && !tmodel.isTargetImperative(key)) {
|
|
416
416
|
result = !tmodel.hasUpdatingImperativeTargets(key);
|
|
417
417
|
}
|
|
@@ -437,17 +437,17 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
437
437
|
if (tmodel.hasUpdatingImperativeTargets(targetName)) {
|
|
438
438
|
return tmodel.oid + "." + targetName + ": " + tmodel.getUpdatingImperativeTargets(targetName);
|
|
439
439
|
}
|
|
440
|
-
if (tmodel.
|
|
441
|
-
//const activeChildrenList = [ ...(tmodel.
|
|
442
|
-
//return tmodel.oid + "." + targetName + " ==> " + tmodel.getTargetStatus(targetName) + ", " + tmodel.
|
|
440
|
+
if (tmodel.isTargetTreeComplete(targetName) !== true) {
|
|
441
|
+
//const activeChildrenList = [ ...TargetUtil.getActiveChildren(tmodel, tmodel.targets[targetName].completionScope).values() ];
|
|
442
|
+
//return tmodel.oid + "." + targetName + " ==> " + tmodel.getTargetStatus(targetName) + ", " + tmodel.isTargetTreeComplete(targetName) + ":: " + activeChildrenList.map(t => t.oid + ':' + t.hasAnyUpdates()) + ", " + [ ...TargetUtil.getUpdatingChildren(tmodel, targetName).keys() ];
|
|
443
443
|
return false;
|
|
444
444
|
}
|
|
445
445
|
}
|
|
446
446
|
return true;
|
|
447
447
|
}
|
|
448
448
|
}, {
|
|
449
|
-
key: "
|
|
450
|
-
value: function
|
|
449
|
+
key: "isTargetTreeComplete",
|
|
450
|
+
value: function isTargetTreeComplete(tmodel, key) {
|
|
451
451
|
var target = tmodel.targets[key];
|
|
452
452
|
if (target) {
|
|
453
453
|
var _target$childAction, _target$childAction2, _target$childAction3;
|
|
@@ -467,13 +467,13 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
467
467
|
if (!tmodel.isTargetComplete(key) && !tmodel.isTargetDone(key)) {
|
|
468
468
|
return 'not done';
|
|
469
469
|
}
|
|
470
|
-
if (((_target$childAction = target.childAction) === null || _target$childAction === void 0 ? void 0 : _target$childAction.length) > 0 && TargetUtil.getUpdatingChildren(tmodel, key, target.
|
|
470
|
+
if (((_target$childAction = target.childAction) === null || _target$childAction === void 0 ? void 0 : _target$childAction.length) > 0 && TargetUtil.getUpdatingChildren(tmodel, key, target.completionScope).size > 0) {
|
|
471
471
|
return 'updating children';
|
|
472
472
|
}
|
|
473
|
-
if (((_target$childAction2 = target.childAction) === null || _target$childAction2 === void 0 ? void 0 : _target$childAction2.length) > 0 && TargetUtil.getActiveChildren(tmodel, target.
|
|
473
|
+
if (((_target$childAction2 = target.childAction) === null || _target$childAction2 === void 0 ? void 0 : _target$childAction2.length) > 0 && TargetUtil.getActiveChildren(tmodel, target.completionScope).size > 0) {
|
|
474
474
|
return 'active children';
|
|
475
475
|
}
|
|
476
|
-
if (((_target$childAction3 = target.childAction) === null || _target$childAction3 === void 0 ? void 0 : _target$childAction3.length) > 0 && TargetUtil.areTargetChildrenComplete(target.childAction, target.
|
|
476
|
+
if (((_target$childAction3 = target.childAction) === null || _target$childAction3 === void 0 ? void 0 : _target$childAction3.length) > 0 && TargetUtil.areTargetChildrenComplete(target.childAction, target.completionScope) !== true) {
|
|
477
477
|
return 'incomplete children';
|
|
478
478
|
}
|
|
479
479
|
if (target.fetchAction && !(0, _App.getLoader)().isLoadingSuccessful(tmodel, key)) {
|
|
@@ -485,7 +485,7 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
485
485
|
}, {
|
|
486
486
|
key: "areTargetChildrenComplete",
|
|
487
487
|
value: function areTargetChildrenComplete(children) {
|
|
488
|
-
var
|
|
488
|
+
var completionScope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'all';
|
|
489
489
|
if (!children) {
|
|
490
490
|
return true;
|
|
491
491
|
}
|
|
@@ -494,14 +494,14 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
494
494
|
try {
|
|
495
495
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
496
496
|
var child = _step2.value;
|
|
497
|
-
if (TargetUtil.shouldIgnoreChildForCompletion(child,
|
|
497
|
+
if (TargetUtil.shouldIgnoreChildForCompletion(child, completionScope)) {
|
|
498
498
|
continue;
|
|
499
499
|
}
|
|
500
500
|
if (child.exists() && !TargetUtil.isTModelComplete(child)) {
|
|
501
501
|
return child.oid;
|
|
502
502
|
}
|
|
503
503
|
if (child.hasChildren()) {
|
|
504
|
-
if (!TargetUtil.areTargetChildrenComplete(child.getChildren(),
|
|
504
|
+
if (!TargetUtil.areTargetChildrenComplete(child.getChildren(), completionScope)) {
|
|
505
505
|
return child.oid;
|
|
506
506
|
}
|
|
507
507
|
}
|
|
@@ -517,12 +517,12 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
517
517
|
key: "getUpdatingChildren",
|
|
518
518
|
value: function getUpdatingChildren(tmodel, originalTargetName) {
|
|
519
519
|
var _tmodel$updatingChild, _tmodel$updatingChild2, _tmodel$animatingChil, _tmodel$animatingChil2;
|
|
520
|
-
var
|
|
520
|
+
var completionScope = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "all";
|
|
521
521
|
var childrenMap = new Map();
|
|
522
522
|
var children = [].concat(_toConsumableArray((_tmodel$updatingChild = (_tmodel$updatingChild2 = tmodel.updatingChildrenMap) === null || _tmodel$updatingChild2 === void 0 ? void 0 : _tmodel$updatingChild2.values()) !== null && _tmodel$updatingChild !== void 0 ? _tmodel$updatingChild : []), _toConsumableArray((_tmodel$animatingChil = (_tmodel$animatingChil2 = tmodel.animatingChildrenMap) === null || _tmodel$animatingChil2 === void 0 ? void 0 : _tmodel$animatingChil2.values()) !== null && _tmodel$animatingChil !== void 0 ? _tmodel$animatingChil : []));
|
|
523
523
|
children.forEach(function (child) {
|
|
524
524
|
var _child$updatingTarget;
|
|
525
|
-
if (TargetUtil.shouldIgnoreChildForCompletion(child,
|
|
525
|
+
if (TargetUtil.shouldIgnoreChildForCompletion(child, completionScope)) {
|
|
526
526
|
return;
|
|
527
527
|
}
|
|
528
528
|
var updatingList = [].concat(_toConsumableArray((_child$updatingTarget = child.updatingTargetList) !== null && _child$updatingTarget !== void 0 ? _child$updatingTarget : []), _toConsumableArray(child.animatingMap ? _toConsumableArray(child.animatingMap.keys()) : []));
|
|
@@ -563,11 +563,11 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
563
563
|
key: "getActiveChildren",
|
|
564
564
|
value: function getActiveChildren(tmodel) {
|
|
565
565
|
var _tmodel$activeChildre, _tmodel$activeChildre2;
|
|
566
|
-
var
|
|
566
|
+
var completionScope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'all';
|
|
567
567
|
var childrenMap = new Map();
|
|
568
568
|
var children = _toConsumableArray((_tmodel$activeChildre = (_tmodel$activeChildre2 = tmodel.activeChildrenMap) === null || _tmodel$activeChildre2 === void 0 ? void 0 : _tmodel$activeChildre2.values()) !== null && _tmodel$activeChildre !== void 0 ? _tmodel$activeChildre : []);
|
|
569
569
|
children.forEach(function (child) {
|
|
570
|
-
if (TargetUtil.shouldIgnoreChildForCompletion(child,
|
|
570
|
+
if (TargetUtil.shouldIgnoreChildForCompletion(child, completionScope)) {
|
|
571
571
|
return;
|
|
572
572
|
}
|
|
573
573
|
if (child.activeTargetList.length) {
|
|
@@ -578,11 +578,11 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
578
578
|
}
|
|
579
579
|
}, {
|
|
580
580
|
key: "shouldIgnoreChildForCompletion",
|
|
581
|
-
value: function shouldIgnoreChildForCompletion(child,
|
|
582
|
-
if (
|
|
581
|
+
value: function shouldIgnoreChildForCompletion(child, completionScope) {
|
|
582
|
+
if (completionScope === "none") {
|
|
583
583
|
return true;
|
|
584
584
|
}
|
|
585
|
-
if (
|
|
585
|
+
if (completionScope === "visible") {
|
|
586
586
|
return child.visibilityStatus && !child.isVisible();
|
|
587
587
|
}
|
|
588
588
|
return false;
|
|
@@ -683,6 +683,23 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
683
683
|
originalTargetName: originalTargetName
|
|
684
684
|
};
|
|
685
685
|
}
|
|
686
|
+
}, {
|
|
687
|
+
key: "resetTargetState",
|
|
688
|
+
value: function resetTargetState(tmodel, targetName) {
|
|
689
|
+
var visited = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Set();
|
|
690
|
+
if (!tmodel || !targetName) {
|
|
691
|
+
return;
|
|
692
|
+
}
|
|
693
|
+
TargetUtil.resetSingleTargetState(tmodel, targetName);
|
|
694
|
+
var target = tmodel.targets[targetName];
|
|
695
|
+
var nextTarget = target === null || target === void 0 ? void 0 : target.activateNextTarget;
|
|
696
|
+
var nextTargetDef = tmodel.targets[nextTarget];
|
|
697
|
+
if (!nextTargetDef || !nextTarget.endsWith('$') && nextTargetDef.active === false) {
|
|
698
|
+
return;
|
|
699
|
+
}
|
|
700
|
+
TargetUtil.resetTargetsBetween(tmodel, targetName, nextTarget, visited);
|
|
701
|
+
TargetUtil.resetTargetPipelineState(tmodel, nextTarget, visited);
|
|
702
|
+
}
|
|
686
703
|
}, {
|
|
687
704
|
key: "resetTargetPipelineState",
|
|
688
705
|
value: function resetTargetPipelineState(tmodel, targetName) {
|
|
@@ -699,7 +716,6 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
699
716
|
TargetUtil.resetTargetChildState(child, visited);
|
|
700
717
|
}
|
|
701
718
|
});
|
|
702
|
-
target.childAction = [];
|
|
703
719
|
}
|
|
704
720
|
if ((_target$addChildActio = target.addChildAction) !== null && _target$addChildActio !== void 0 && _target$addChildActio.length) {
|
|
705
721
|
target.addChildAction.forEach(function (child) {
|
|
@@ -707,7 +723,6 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
707
723
|
TargetUtil.resetTargetChildState(child, visited);
|
|
708
724
|
}
|
|
709
725
|
});
|
|
710
|
-
target.addChildAction = [];
|
|
711
726
|
}
|
|
712
727
|
var nextTarget = target === null || target === void 0 ? void 0 : target.activateNextTarget;
|
|
713
728
|
if (!nextTarget) {
|
|
@@ -717,8 +732,39 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
717
732
|
if (!nextTargetDef || !nextTarget.endsWith('$') && nextTargetDef.active === false) {
|
|
718
733
|
return;
|
|
719
734
|
}
|
|
735
|
+
TargetUtil.resetTargetsBetween(tmodel, targetName, nextTarget, visited);
|
|
720
736
|
TargetUtil.resetTargetPipelineState(tmodel, nextTarget, visited);
|
|
721
737
|
}
|
|
738
|
+
}, {
|
|
739
|
+
key: "resetTargetsBetween",
|
|
740
|
+
value: function resetTargetsBetween(tmodel, fromTarget, toTarget, visited) {
|
|
741
|
+
var names = tmodel.functionTargetNames;
|
|
742
|
+
var fromIndex = names.indexOf(fromTarget);
|
|
743
|
+
var toIndex = names.indexOf(toTarget);
|
|
744
|
+
if (fromIndex < 0 || toIndex < 0 || toIndex <= fromIndex) {
|
|
745
|
+
return;
|
|
746
|
+
}
|
|
747
|
+
for (var i = fromIndex + 1; i < toIndex; i++) {
|
|
748
|
+
var _target$childAction5, _target$addChildActio2;
|
|
749
|
+
var key = names[i];
|
|
750
|
+
TargetUtil.resetSingleTargetState(tmodel, key);
|
|
751
|
+
var target = tmodel.targets[key];
|
|
752
|
+
if (target !== null && target !== void 0 && (_target$childAction5 = target.childAction) !== null && _target$childAction5 !== void 0 && _target$childAction5.length) {
|
|
753
|
+
target.childAction.forEach(function (child) {
|
|
754
|
+
if (child) {
|
|
755
|
+
TargetUtil.resetTargetChildState(child, visited);
|
|
756
|
+
}
|
|
757
|
+
});
|
|
758
|
+
}
|
|
759
|
+
if (target !== null && target !== void 0 && (_target$addChildActio2 = target.addChildAction) !== null && _target$addChildActio2 !== void 0 && _target$addChildActio2.length) {
|
|
760
|
+
target.addChildAction.forEach(function (child) {
|
|
761
|
+
if (child) {
|
|
762
|
+
TargetUtil.resetTargetChildState(child, visited);
|
|
763
|
+
}
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
}
|
|
722
768
|
}, {
|
|
723
769
|
key: "resetTargetChildState",
|
|
724
770
|
value: function resetTargetChildState(tmodel, visited) {
|
|
@@ -729,11 +775,11 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
729
775
|
visited.add(sig);
|
|
730
776
|
var names = Object.keys(tmodel.targetValues);
|
|
731
777
|
for (var i = 0; i < names.length; i++) {
|
|
732
|
-
var _target$
|
|
778
|
+
var _target$childAction6, _target$addChildActio3;
|
|
733
779
|
var key = names[i];
|
|
734
780
|
var target = tmodel.targets[key];
|
|
735
781
|
TargetUtil.resetSingleTargetState(tmodel, key);
|
|
736
|
-
if (target !== null && target !== void 0 && (_target$
|
|
782
|
+
if (target !== null && target !== void 0 && (_target$childAction6 = target.childAction) !== null && _target$childAction6 !== void 0 && _target$childAction6.length) {
|
|
737
783
|
target.childAction.forEach(function (child) {
|
|
738
784
|
if (child) {
|
|
739
785
|
TargetUtil.resetTargetChildState(child, visited);
|
|
@@ -741,7 +787,7 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
741
787
|
});
|
|
742
788
|
target.childAction = [];
|
|
743
789
|
}
|
|
744
|
-
if (target !== null && target !== void 0 && (_target$
|
|
790
|
+
if (target !== null && target !== void 0 && (_target$addChildActio3 = target.addChildAction) !== null && _target$addChildActio3 !== void 0 && _target$addChildActio3.length) {
|
|
745
791
|
target.addChildAction.forEach(function (child) {
|
|
746
792
|
if (child) {
|
|
747
793
|
TargetUtil.resetTargetChildState(child, visited);
|
|
@@ -760,7 +806,7 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
760
806
|
targetValue.triggeredByCompleteCount = 0;
|
|
761
807
|
targetValue.resetFlag = true;
|
|
762
808
|
targetValue.nextTargetUpdateCount = 0;
|
|
763
|
-
targetValue.status = '
|
|
809
|
+
targetValue.status = '';
|
|
764
810
|
}
|
|
765
811
|
tmodel.cancelAnimation();
|
|
766
812
|
tmodel.activatedTargets.length = 0;
|
|
@@ -769,5 +815,26 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
769
815
|
tmodel.removeFromUpdatingTargets(key);
|
|
770
816
|
TargetUtil.clearPendingTarget(tmodel, key);
|
|
771
817
|
}
|
|
818
|
+
}, {
|
|
819
|
+
key: "removeChildFromTargetActions",
|
|
820
|
+
value: function removeChildFromTargetActions(parent, child) {
|
|
821
|
+
if (!parent || !child) {
|
|
822
|
+
return;
|
|
823
|
+
}
|
|
824
|
+
for (var _i2 = 0, _Object$values = Object.values(parent.targets); _i2 < _Object$values.length; _i2++) {
|
|
825
|
+
var _target$childAction7, _target$addChildActio4;
|
|
826
|
+
var target = _Object$values[_i2];
|
|
827
|
+
if ((_target$childAction7 = target.childAction) !== null && _target$childAction7 !== void 0 && _target$childAction7.length) {
|
|
828
|
+
target.childAction = target.childAction.filter(function (c) {
|
|
829
|
+
return c !== child;
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
if ((_target$addChildActio4 = target.addChildAction) !== null && _target$addChildActio4 !== void 0 && _target$addChildActio4.length) {
|
|
833
|
+
target.addChildAction = target.addChildAction.filter(function (c) {
|
|
834
|
+
return c !== child;
|
|
835
|
+
});
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
}
|
|
772
839
|
}]);
|
|
773
840
|
}();
|