targetj 1.0.228 → 1.0.229
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/AnimationManager.js +39 -31
- package/build/BaseModel.js +5 -3
- package/build/Bracket.js +9 -18
- package/build/BracketGenerator.js +22 -1
- package/build/LoadingManager.js +2 -6
- package/build/LocationManager.js +12 -22
- package/build/TModel.js +14 -12
- package/build/TModelManager.js +52 -15
- package/build/TUtil.js +90 -35
- package/build/TargetData.js +4 -2
- package/build/TargetExecutor.js +8 -5
- package/build/TargetManager.js +2 -2
- package/build/TargetParser.js +2 -1
- package/build/TargetUtil.js +7 -2
- package/dist/targetjs.js +1 -1
- package/dist/targetjs.js.gz +0 -0
- package/package.json +1 -1
|
@@ -47,7 +47,6 @@ var AnimationManager = exports.AnimationManager = /*#__PURE__*/function () {
|
|
|
47
47
|
return _createClass(AnimationManager, [{
|
|
48
48
|
key: "animate",
|
|
49
49
|
value: function animate(tmodel, batch, hooks) {
|
|
50
|
-
var _this = this;
|
|
51
50
|
if (this.isShuttingDown || !tmodel.hasDom()) {
|
|
52
51
|
return;
|
|
53
52
|
}
|
|
@@ -132,6 +131,9 @@ var AnimationManager = exports.AnimationManager = /*#__PURE__*/function () {
|
|
|
132
131
|
hooks: hooks
|
|
133
132
|
};
|
|
134
133
|
tmodel.addToAnimatingMap(_originalKey, rec);
|
|
134
|
+
if (tmodel.targetValues[_originalKey]) {
|
|
135
|
+
tmodel.targetValues[_originalKey].status = 'updating';
|
|
136
|
+
}
|
|
135
137
|
this.recordMap.set(recId, rec);
|
|
136
138
|
}
|
|
137
139
|
} catch (err) {
|
|
@@ -139,16 +141,6 @@ var AnimationManager = exports.AnimationManager = /*#__PURE__*/function () {
|
|
|
139
141
|
} finally {
|
|
140
142
|
_iterator2.f();
|
|
141
143
|
}
|
|
142
|
-
var finalize = function finalize() {
|
|
143
|
-
_this.finalizeAnimation(anim);
|
|
144
|
-
};
|
|
145
|
-
anim.addEventListener("finish", finalize, {
|
|
146
|
-
once: true
|
|
147
|
-
});
|
|
148
|
-
anim.addEventListener("cancel", finalize, {
|
|
149
|
-
once: true
|
|
150
|
-
});
|
|
151
|
-
anim.finished.then(finalize).catch(finalize);
|
|
152
144
|
this.startProgressPoller();
|
|
153
145
|
}
|
|
154
146
|
}, {
|
|
@@ -208,11 +200,12 @@ var AnimationManager = exports.AnimationManager = /*#__PURE__*/function () {
|
|
|
208
200
|
} finally {
|
|
209
201
|
_iterator3.f();
|
|
210
202
|
}
|
|
203
|
+
(0, _App.getRunScheduler)().schedule(35, "finalizeAnimation");
|
|
211
204
|
}
|
|
212
205
|
}, {
|
|
213
206
|
key: "startProgressPoller",
|
|
214
207
|
value: function startProgressPoller() {
|
|
215
|
-
var
|
|
208
|
+
var _this = this;
|
|
216
209
|
if (this.waapiPoller.rafId) {
|
|
217
210
|
return;
|
|
218
211
|
}
|
|
@@ -220,7 +213,7 @@ var AnimationManager = exports.AnimationManager = /*#__PURE__*/function () {
|
|
|
220
213
|
var _tick = function tick() {
|
|
221
214
|
var animsToFinalize = new Set();
|
|
222
215
|
var hasPlaying = false;
|
|
223
|
-
var _iterator4 = _createForOfIteratorHelper(
|
|
216
|
+
var _iterator4 = _createForOfIteratorHelper(_this.recordMap),
|
|
224
217
|
_step4;
|
|
225
218
|
try {
|
|
226
219
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
@@ -232,7 +225,7 @@ var AnimationManager = exports.AnimationManager = /*#__PURE__*/function () {
|
|
|
232
225
|
} else if (record.status === 'playing') {
|
|
233
226
|
hasPlaying = true;
|
|
234
227
|
}
|
|
235
|
-
|
|
228
|
+
_this.updateTModelFromRecord(record);
|
|
236
229
|
var ps = record.anim.playState;
|
|
237
230
|
var ct = (_record$anim$effect = record.anim.effect) === null || _record$anim$effect === void 0 || (_record$anim$effect$g = (_record$anim$effect2 = _record$anim$effect).getComputedTiming) === null || _record$anim$effect$g === void 0 ? void 0 : _record$anim$effect$g.call(_record$anim$effect2);
|
|
238
231
|
var finished = ps === "finished" || ps === "idle" || ct && ct.progress >= 0.999999;
|
|
@@ -251,18 +244,18 @@ var AnimationManager = exports.AnimationManager = /*#__PURE__*/function () {
|
|
|
251
244
|
try {
|
|
252
245
|
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
253
246
|
var anim = _step5.value;
|
|
254
|
-
|
|
247
|
+
_this.finalizeAnimation(anim);
|
|
255
248
|
}
|
|
256
249
|
} catch (err) {
|
|
257
250
|
_iterator5.e(err);
|
|
258
251
|
} finally {
|
|
259
252
|
_iterator5.f();
|
|
260
253
|
}
|
|
261
|
-
if (
|
|
262
|
-
|
|
254
|
+
if (_this.recordMap.size > 0 || hasPlaying) {
|
|
255
|
+
_this.waapiPoller.rafId = requestAnimationFrame(_tick);
|
|
263
256
|
} else {
|
|
264
|
-
|
|
265
|
-
|
|
257
|
+
_this.waapiPoller.alive = false;
|
|
258
|
+
_this.waapiPoller.rafId = 0;
|
|
266
259
|
}
|
|
267
260
|
};
|
|
268
261
|
this.waapiPoller.rafId = requestAnimationFrame(_tick);
|
|
@@ -765,6 +758,21 @@ var AnimationManager = exports.AnimationManager = /*#__PURE__*/function () {
|
|
|
765
758
|
if (!batch) {
|
|
766
759
|
return;
|
|
767
760
|
}
|
|
761
|
+
var _iterator15 = _createForOfIteratorHelper(tmodel.animatingMap),
|
|
762
|
+
_step15;
|
|
763
|
+
try {
|
|
764
|
+
for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
|
|
765
|
+
var _step15$value = _slicedToArray(_step15.value, 1),
|
|
766
|
+
key = _step15$value[0];
|
|
767
|
+
if (tmodel.targetValues[key]) {
|
|
768
|
+
tmodel.targetValues[key].status = 'pause';
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
} catch (err) {
|
|
772
|
+
_iterator15.e(err);
|
|
773
|
+
} finally {
|
|
774
|
+
_iterator15.f();
|
|
775
|
+
}
|
|
768
776
|
var cutTime = Math.min(_TUtil.TUtil.now() - batch.startTime, batch.totalDuration);
|
|
769
777
|
this.cutLastBatch(tmodel, batch, cutTime);
|
|
770
778
|
tmodel.pausedBatch = batch;
|
|
@@ -814,22 +822,22 @@ var AnimationManager = exports.AnimationManager = /*#__PURE__*/function () {
|
|
|
814
822
|
return;
|
|
815
823
|
}
|
|
816
824
|
var keySet = new Set(cleanKeys);
|
|
817
|
-
var
|
|
818
|
-
|
|
825
|
+
var _iterator16 = _createForOfIteratorHelper(el.getAnimations()),
|
|
826
|
+
_step16;
|
|
819
827
|
try {
|
|
820
|
-
for (
|
|
821
|
-
var anim =
|
|
828
|
+
for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
|
|
829
|
+
var anim = _step16.value;
|
|
822
830
|
var effect = anim.effect;
|
|
823
831
|
if (!(effect !== null && effect !== void 0 && effect.getKeyframes)) {
|
|
824
832
|
continue;
|
|
825
833
|
}
|
|
826
834
|
var kfs = effect.getKeyframes();
|
|
827
835
|
var touches = false;
|
|
828
|
-
var
|
|
829
|
-
|
|
836
|
+
var _iterator17 = _createForOfIteratorHelper(kfs),
|
|
837
|
+
_step17;
|
|
830
838
|
try {
|
|
831
|
-
for (
|
|
832
|
-
var kf =
|
|
839
|
+
for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
|
|
840
|
+
var kf = _step17.value;
|
|
833
841
|
for (var _i5 = 0, _Object$keys2 = Object.keys(kf); _i5 < _Object$keys2.length; _i5++) {
|
|
834
842
|
var k = _Object$keys2[_i5];
|
|
835
843
|
if (keySet.has(k)) {
|
|
@@ -842,9 +850,9 @@ var AnimationManager = exports.AnimationManager = /*#__PURE__*/function () {
|
|
|
842
850
|
}
|
|
843
851
|
}
|
|
844
852
|
} catch (err) {
|
|
845
|
-
|
|
853
|
+
_iterator17.e(err);
|
|
846
854
|
} finally {
|
|
847
|
-
|
|
855
|
+
_iterator17.f();
|
|
848
856
|
}
|
|
849
857
|
if (touches) {
|
|
850
858
|
try {
|
|
@@ -853,9 +861,9 @@ var AnimationManager = exports.AnimationManager = /*#__PURE__*/function () {
|
|
|
853
861
|
}
|
|
854
862
|
}
|
|
855
863
|
} catch (err) {
|
|
856
|
-
|
|
864
|
+
_iterator16.e(err);
|
|
857
865
|
} finally {
|
|
858
|
-
|
|
866
|
+
_iterator16.f();
|
|
859
867
|
}
|
|
860
868
|
}
|
|
861
869
|
}]);
|
package/build/BaseModel.js
CHANGED
|
@@ -498,10 +498,11 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
|
|
|
498
498
|
return;
|
|
499
499
|
}
|
|
500
500
|
var oldStatus = targetValue.status;
|
|
501
|
-
if (status === 'done' && oldStatus !== 'done' && oldStatus !== 'complete') {
|
|
501
|
+
if (status === 'done' && oldStatus !== 'done' && oldStatus !== 'complete' && !targetValue.resetFlag) {
|
|
502
502
|
targetValue.completeCount++;
|
|
503
503
|
targetValue.completeTime = _TUtil.TUtil.now();
|
|
504
504
|
}
|
|
505
|
+
targetValue.resetFlag = false;
|
|
505
506
|
targetValue.status = status;
|
|
506
507
|
if (targetValue.status === 'fetching') {
|
|
507
508
|
this.removeFromActiveTargets(key);
|
|
@@ -675,7 +676,8 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
|
|
|
675
676
|
if (t.loop !== undefined) {
|
|
676
677
|
var loop = typeof t.loop === 'function' ? t.loop.call(this, key) : t.loop;
|
|
677
678
|
if (loop === 'passive') {
|
|
678
|
-
|
|
679
|
+
var values = _TargetParser.TargetParser.getValueStepsCycles(this, key);
|
|
680
|
+
return values[0] === this.getTargetValue(key) ? false : true;
|
|
679
681
|
}
|
|
680
682
|
}
|
|
681
683
|
return true;
|
|
@@ -696,7 +698,7 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
|
|
|
696
698
|
key: "getDimLastUpdate",
|
|
697
699
|
value: function getDimLastUpdate() {
|
|
698
700
|
var _this$getLastUpdate, _this$getLastUpdate2, _this$getLastUpdate3, _this$domHeightTimest, _this$domWidthTimesta;
|
|
699
|
-
return Math.max((_this$getLastUpdate = this.getLastUpdate('width')) !== null && _this$getLastUpdate !== void 0 ? _this$getLastUpdate : 0, (_this$getLastUpdate2 = this.getLastUpdate('height')) !== null && _this$getLastUpdate2 !== void 0 ? _this$getLastUpdate2 : 0, (_this$getLastUpdate3 = this.getLastUpdate('
|
|
701
|
+
return Math.max((_this$getLastUpdate = this.getLastUpdate('width')) !== null && _this$getLastUpdate !== void 0 ? _this$getLastUpdate : 0, (_this$getLastUpdate2 = this.getLastUpdate('height')) !== null && _this$getLastUpdate2 !== void 0 ? _this$getLastUpdate2 : 0, (_this$getLastUpdate3 = this.getLastUpdate('dim')) !== null && _this$getLastUpdate3 !== void 0 ? _this$getLastUpdate3 : 0, (_this$domHeightTimest = this.domHeightTimestamp) !== null && _this$domHeightTimest !== void 0 ? _this$domHeightTimest : 0, (_this$domWidthTimesta = this.domWidthTimestamp) !== null && _this$domWidthTimesta !== void 0 ? _this$domWidthTimesta : 0);
|
|
700
702
|
}
|
|
701
703
|
}, {
|
|
702
704
|
key: "getTargetActivationTime",
|
package/build/Bracket.js
CHANGED
|
@@ -29,6 +29,7 @@ var Bracket = exports.Bracket = /*#__PURE__*/function (_TModel) {
|
|
|
29
29
|
_classCallCheck(this, Bracket);
|
|
30
30
|
_this = _callSuper(this, Bracket, ["BI"]);
|
|
31
31
|
_this.parent = parent;
|
|
32
|
+
_this.currentBrakcetStatus = 2;
|
|
32
33
|
return _this;
|
|
33
34
|
}
|
|
34
35
|
_inherits(Bracket, _TModel);
|
|
@@ -157,33 +158,23 @@ var Bracket = exports.Bracket = /*#__PURE__*/function (_TModel) {
|
|
|
157
158
|
}, {
|
|
158
159
|
key: "shouldCalculateChildren",
|
|
159
160
|
value: function shouldCalculateChildren() {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
});
|
|
164
|
-
this.currentStatus = undefined;
|
|
165
|
-
if (visibleChild) {
|
|
166
|
-
this.currentStatus = 'new';
|
|
167
|
-
var parent = this.parent;
|
|
168
|
-
while (parent && parent.type === 'BI') {
|
|
169
|
-
parent.currentStatus = 'new';
|
|
170
|
-
parent = parent.parent;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
161
|
+
var nowVisible = this.isVisible();
|
|
162
|
+
if (this.currentBrakcetStatus >= 1 || this.isNowVisible || this.isNowInvisible) {
|
|
163
|
+
this.currentBrakcetStatus = Math.max(0, this.currentBrakcetStatus - 1);
|
|
173
164
|
return true;
|
|
174
165
|
}
|
|
166
|
+
if (nowVisible) {
|
|
167
|
+
this.currentBrakcetStatus = Math.min(2, this.currentBrakcetStatus + 1);
|
|
168
|
+
}
|
|
175
169
|
if (this.getDirtyLayout() === false) {
|
|
176
170
|
return false;
|
|
177
171
|
}
|
|
178
|
-
|
|
179
|
-
return true;
|
|
180
|
-
}
|
|
181
|
-
return false;
|
|
172
|
+
return nowVisible;
|
|
182
173
|
}
|
|
183
174
|
}, {
|
|
184
175
|
key: "getDirtyLayout",
|
|
185
176
|
value: function getDirtyLayout() {
|
|
186
|
-
return this.getRealParent().managesOwnScroll ? this.getRealParent().backupDirtyLayout : this.dirtyLayout;
|
|
177
|
+
return this.getRealParent().managesOwnScroll() ? this.getRealParent().backupDirtyLayout : this.dirtyLayout;
|
|
187
178
|
}
|
|
188
179
|
}, {
|
|
189
180
|
key: "validateVisibilityInParent",
|
|
@@ -71,6 +71,7 @@ var BracketGenerator = exports.BracketGenerator = /*#__PURE__*/function () {
|
|
|
71
71
|
var _index = parent.allChildrenList.indexOf(child);
|
|
72
72
|
if (_index >= 0) {
|
|
73
73
|
parent.allChildrenList.splice(_index, 1);
|
|
74
|
+
BracketGenerator.markBracketDirty(parent);
|
|
74
75
|
if (parent.allChildrenList.length === 0) {
|
|
75
76
|
deleteChildRecursively(parent.parent, parent);
|
|
76
77
|
}
|
|
@@ -145,11 +146,13 @@ var BracketGenerator = exports.BracketGenerator = /*#__PURE__*/function () {
|
|
|
145
146
|
bracket.startIndex = Math.min(bracket.startIndex, index);
|
|
146
147
|
bracket.endIndex = bracket.startIndex + bracket.allChildrenList.length;
|
|
147
148
|
bracket.currentStatus = 'new';
|
|
149
|
+
bracket.markLayoutDirty('update');
|
|
148
150
|
bracket = targetBracket.getParent();
|
|
149
151
|
while (bracket instanceof _Bracket.Bracket) {
|
|
150
152
|
bracket.startIndex = Math.min(bracket.startIndex, index);
|
|
151
153
|
bracket.endIndex = Math.max(bracket.endIndex, index + 1);
|
|
152
154
|
bracket.currentStatus = 'new';
|
|
155
|
+
bracket.markLayoutDirty('update');
|
|
153
156
|
bracket = bracket.getParent();
|
|
154
157
|
}
|
|
155
158
|
if (targetBracket.allChildrenList.length > bracketSize) {
|
|
@@ -178,11 +181,13 @@ var BracketGenerator = exports.BracketGenerator = /*#__PURE__*/function () {
|
|
|
178
181
|
var _bracket$parent$allCh;
|
|
179
182
|
(_bracket$parent$allCh = bracket.parent.allChildrenList).splice.apply(_bracket$parent$allCh, [index, 1].concat(chunks));
|
|
180
183
|
}
|
|
184
|
+
BracketGenerator.markBracketDirty(bracket);
|
|
181
185
|
if (bracket.parent.allChildrenList.length >= bracketSize) {
|
|
182
186
|
var rebuiltChildren = BracketGenerator.buildTreeBottomUp(page, bracket.parent.allChildrenList);
|
|
183
187
|
bracket.parent.allChildrenList = rebuiltChildren;
|
|
184
188
|
bracket.parent.allChildrenList.forEach(function (child) {
|
|
185
189
|
child.parent = bracket.parent;
|
|
190
|
+
BracketGenerator.markBracketDirty(child);
|
|
186
191
|
});
|
|
187
192
|
|
|
188
193
|
// Update grandparent relationships
|
|
@@ -207,6 +212,12 @@ var BracketGenerator = exports.BracketGenerator = /*#__PURE__*/function () {
|
|
|
207
212
|
BracketGenerator.bracketMap[page.oid] = BracketGenerator.buildTreeBottomUp(page, topBrackets);
|
|
208
213
|
}
|
|
209
214
|
}
|
|
215
|
+
chunks.forEach(function (chunk) {
|
|
216
|
+
return BracketGenerator.markBracketDirty(chunk);
|
|
217
|
+
});
|
|
218
|
+
if (chunks[0].parent instanceof _Bracket.Bracket) {
|
|
219
|
+
BracketGenerator.markBracketDirty(chunks[0].parent);
|
|
220
|
+
}
|
|
210
221
|
}
|
|
211
222
|
}, {
|
|
212
223
|
key: "findOrCreateBracket",
|
|
@@ -233,7 +244,7 @@ var BracketGenerator = exports.BracketGenerator = /*#__PURE__*/function () {
|
|
|
233
244
|
brackets.push(newBracket);
|
|
234
245
|
if (brackets.length > page.getBracketSize()) {
|
|
235
246
|
var topBrackets = BracketGenerator.buildTreeBottomUp(page, brackets);
|
|
236
|
-
BracketGenerator.bracketMap[page.oid]
|
|
247
|
+
BracketGenerator.bracketMap[page.oid] = topBrackets;
|
|
237
248
|
}
|
|
238
249
|
return newBracket;
|
|
239
250
|
}
|
|
@@ -280,6 +291,16 @@ var BracketGenerator = exports.BracketGenerator = /*#__PURE__*/function () {
|
|
|
280
291
|
BracketGenerator.pageMap = {};
|
|
281
292
|
BracketGenerator.all = {};
|
|
282
293
|
}
|
|
294
|
+
}, {
|
|
295
|
+
key: "markBracketDirty",
|
|
296
|
+
value: function markBracketDirty(bracket) {
|
|
297
|
+
var current = bracket;
|
|
298
|
+
while (current && current.type === 'BI') {
|
|
299
|
+
current.currentStatus = 'new';
|
|
300
|
+
current.markLayoutDirty('update');
|
|
301
|
+
current = current.parent;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
283
304
|
}]);
|
|
284
305
|
}();
|
|
285
306
|
_defineProperty(BracketGenerator, "bracketMap", {});
|
package/build/LoadingManager.js
CHANGED
|
@@ -133,7 +133,7 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
|
|
|
133
133
|
var key = this.getTModelKey(tmodel, targetName);
|
|
134
134
|
var loadTargetName = _TUtil.TUtil.getLoadTargetName(targetName);
|
|
135
135
|
var loadingComplete = this.isLoadingComplete(tmodel, targetName);
|
|
136
|
-
if (loadingComplete || !this.tmodelKeyMap[key]) {
|
|
136
|
+
if (loadingComplete || !this.tmodelKeyMap[key] || !tmodel.val(loadTargetName)) {
|
|
137
137
|
var _this$tmodelKeyMap, _this$tmodelKeyMap$ke;
|
|
138
138
|
(_this$tmodelKeyMap$ke = (_this$tmodelKeyMap = this.tmodelKeyMap)[key]) !== null && _this$tmodelKeyMap$ke !== void 0 ? _this$tmodelKeyMap$ke : _this$tmodelKeyMap[key] = {
|
|
139
139
|
fetchMap: {},
|
|
@@ -143,11 +143,7 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
|
|
|
143
143
|
activeIndex: 0,
|
|
144
144
|
accessIndex: 0
|
|
145
145
|
};
|
|
146
|
-
|
|
147
|
-
if (loadingComplete || !tmodel.val(loadTargetName)) {
|
|
148
|
-
if (!tmodel.val(loadTargetName)) {
|
|
149
|
-
tmodel.val(loadTargetName, []);
|
|
150
|
-
}
|
|
146
|
+
tmodel.val(loadTargetName, []);
|
|
151
147
|
}
|
|
152
148
|
if (!this.tmodelKeyMap[key].fetchMap[fetchId]) {
|
|
153
149
|
this.tmodelKeyMap[key].fetchMap[fetchId] = {
|
package/build/LocationManager.js
CHANGED
|
@@ -228,7 +228,7 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
230
|
viewport.setCurrentChild(child);
|
|
231
|
-
if (!child.getDirtyLayout() && !child.currentStatus) {
|
|
231
|
+
if (!child.getDirtyLayout() && !child.currentStatus && child.activeTargetList.length === 0) {
|
|
232
232
|
_this.calcNextLocation(child, container, viewport);
|
|
233
233
|
job.index++;
|
|
234
234
|
return;
|
|
@@ -244,7 +244,7 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
244
244
|
var prevX = child.actualValues.x;
|
|
245
245
|
var prevY = child.actualValues.y;
|
|
246
246
|
var prevWidth = child.getMinWidth();
|
|
247
|
-
if (child.isIncluded()
|
|
247
|
+
if (child.isIncluded()) {
|
|
248
248
|
_this.calculateTargets(child);
|
|
249
249
|
}
|
|
250
250
|
if (prevWidth !== child.getMinWidth() && viewport.isOverflow()) {
|
|
@@ -289,12 +289,6 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
289
289
|
viewport: undefined,
|
|
290
290
|
index: 0
|
|
291
291
|
});
|
|
292
|
-
} else if (!child.isVisible() && child.makeChildrenInvisible !== false) {
|
|
293
|
-
child.makeChildrenInvisible = false;
|
|
294
|
-
_TUtil.TUtil.getDeepList(child).forEach(function (t) {
|
|
295
|
-
t.actualValues.isVisible = false;
|
|
296
|
-
_this.addToLocationList(t);
|
|
297
|
-
});
|
|
298
292
|
}
|
|
299
293
|
}
|
|
300
294
|
};
|
|
@@ -401,8 +395,7 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
401
395
|
}, {
|
|
402
396
|
key: "calcNextLocation",
|
|
403
397
|
value: function calcNextLocation(child, container, viewport) {
|
|
404
|
-
var _child$styleTargetMap
|
|
405
|
-
_this2 = this;
|
|
398
|
+
var _child$styleTargetMap;
|
|
406
399
|
viewport.setLocation();
|
|
407
400
|
if (viewport.isOverflow()) {
|
|
408
401
|
viewport.overflow();
|
|
@@ -433,12 +426,6 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
433
426
|
this.addToLocationList(child);
|
|
434
427
|
}
|
|
435
428
|
this.calculateVisibility(child);
|
|
436
|
-
if (!child.isVisible() && child.hasChildren()) {
|
|
437
|
-
_TUtil.TUtil.getDeepList(child).forEach(function (t) {
|
|
438
|
-
t.actualValues.isVisible = false;
|
|
439
|
-
_this2.addToLocationList(t);
|
|
440
|
-
});
|
|
441
|
-
}
|
|
442
429
|
if (child.isInFlow()) {
|
|
443
430
|
if (_TUtil.TUtil.isNumber(child.val('appendNewLine'))) {
|
|
444
431
|
viewport.appendNewLine();
|
|
@@ -455,6 +442,10 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
455
442
|
var wasVisible = tmodel.isVisible();
|
|
456
443
|
var nowVisible;
|
|
457
444
|
var lastVisibleTest = (_tmodel$visibilitySta = (_tmodel$visibilitySta2 = tmodel.visibilityStatus) === null || _tmodel$visibilitySta2 === void 0 ? void 0 : _tmodel$visibilitySta2.isVisible) !== null && _tmodel$visibilitySta !== void 0 ? _tmodel$visibilitySta : undefined;
|
|
445
|
+
if (!tmodel.visibilityStatus) {
|
|
446
|
+
tmodel.visibilityStatus = {};
|
|
447
|
+
}
|
|
448
|
+
tmodel.visibilityStatus.lastIsVisible = tmodel.visibilityStatus.isVisible;
|
|
458
449
|
var nowVisibleTest = tmodel.calcVisibility();
|
|
459
450
|
if (_TUtil.TUtil.isDefined(tmodel.targets.isVisible)) {
|
|
460
451
|
if (typeof tmodel.targets.isVisible.value === 'function') {
|
|
@@ -472,7 +463,6 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
472
463
|
tmodel.markLayoutDirty('isNowVisible');
|
|
473
464
|
}
|
|
474
465
|
if (tmodel.isNowInvisible) {
|
|
475
|
-
tmodel.makeChildrenInvisible = undefined;
|
|
476
466
|
this.addToLocationList(tmodel);
|
|
477
467
|
}
|
|
478
468
|
tmodel.addToParentVisibleChildren();
|
|
@@ -529,17 +519,17 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
|
|
|
529
519
|
}, {
|
|
530
520
|
key: "scheduleResumePaused",
|
|
531
521
|
value: function scheduleResumePaused() {
|
|
532
|
-
var
|
|
522
|
+
var _this2 = this;
|
|
533
523
|
if (this.resumeScheduled || !this.resumePausedList.length) {
|
|
534
524
|
return;
|
|
535
525
|
}
|
|
536
526
|
this.resumeScheduled = true;
|
|
537
527
|
requestAnimationFrame(function () {
|
|
538
528
|
requestAnimationFrame(function () {
|
|
539
|
-
|
|
540
|
-
var list =
|
|
541
|
-
|
|
542
|
-
|
|
529
|
+
_this2.resumeScheduled = false;
|
|
530
|
+
var list = _this2.resumePausedList.slice();
|
|
531
|
+
_this2.resumePausedList.length = 0;
|
|
532
|
+
_this2.resumePausedMap = {};
|
|
543
533
|
var _iterator2 = _createForOfIteratorHelper(list),
|
|
544
534
|
_step2;
|
|
545
535
|
try {
|
package/build/TModel.js
CHANGED
|
@@ -70,18 +70,17 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
70
70
|
return _createClass(TModel, [{
|
|
71
71
|
key: "createViewport",
|
|
72
72
|
value: function createViewport() {
|
|
73
|
+
var _this$getParent$$dom$, _this$getParent, _this$getParent$$dom$2, _this$getParent2;
|
|
73
74
|
this.viewport = this.viewport || new _Viewport.Viewport();
|
|
74
|
-
var
|
|
75
|
-
|
|
76
|
-
var x = scrollLeft,
|
|
77
|
-
y = scrollTop;
|
|
75
|
+
var x = -this.getScrollLeft(),
|
|
76
|
+
y = -this.getScrollTop();
|
|
78
77
|
this.viewport.xNext = x;
|
|
79
78
|
this.viewport.xNorth = x;
|
|
80
79
|
this.viewport.xEast = x;
|
|
81
80
|
this.viewport.xSouth = x;
|
|
82
81
|
this.viewport.xWest = x;
|
|
83
|
-
this.viewport.scrollLeft =
|
|
84
|
-
this.viewport.scrollTop =
|
|
82
|
+
this.viewport.scrollLeft = -(this.getScrollLeft() + ((_this$getParent$$dom$ = (_this$getParent = this.getParent()) === null || _this$getParent === void 0 || (_this$getParent = _this$getParent.$dom) === null || _this$getParent === void 0 ? void 0 : _this$getParent.getScrollLeft()) !== null && _this$getParent$$dom$ !== void 0 ? _this$getParent$$dom$ : 0));
|
|
83
|
+
this.viewport.scrollTop = -(this.getScrollTop() + ((_this$getParent$$dom$2 = (_this$getParent2 = this.getParent()) === null || _this$getParent2 === void 0 || (_this$getParent2 = _this$getParent2.$dom) === null || _this$getParent2 === void 0 ? void 0 : _this$getParent2.getScrollTop()) !== null && _this$getParent$$dom$2 !== void 0 ? _this$getParent$$dom$2 : 0));
|
|
85
84
|
this.viewport.absX = this.absX;
|
|
86
85
|
this.viewport.absY = this.absY;
|
|
87
86
|
this.viewport.xOverflowReset = x;
|
|
@@ -115,9 +114,8 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
115
114
|
}, {
|
|
116
115
|
key: "calcAbsolutePosition",
|
|
117
116
|
value: function calcAbsolutePosition(x, y) {
|
|
118
|
-
|
|
119
|
-
this.
|
|
120
|
-
this.absY = _TUtil.TUtil.isDefined(this.val('absY')) ? this.val('absY') : this.getParent().absY - ((_this$getParent$$dom$2 = (_this$getParent$$dom2 = this.getParent().$dom) === null || _this$getParent$$dom2 === void 0 ? void 0 : _this$getParent$$dom2.getScrollTop()) !== null && _this$getParent$$dom$2 !== void 0 ? _this$getParent$$dom$2 : 0) + y;
|
|
117
|
+
this.absX = _TUtil.TUtil.isDefined(this.val('absX')) ? this.val('absX') : this.getParent().absX + x;
|
|
118
|
+
this.absY = _TUtil.TUtil.isDefined(this.val('absY')) ? this.val('absY') : this.getParent().absY + y;
|
|
121
119
|
}
|
|
122
120
|
}, {
|
|
123
121
|
key: "calcAbsolutePositionFromDom",
|
|
@@ -415,7 +413,11 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
415
413
|
if (!this.isIncluded() || this.isDomIsland() && !this.hasDom()) {
|
|
416
414
|
return false;
|
|
417
415
|
}
|
|
418
|
-
var
|
|
416
|
+
var hasDirtyLayout = this.dirtyLayout !== false;
|
|
417
|
+
var hasDirtyEvent = this.hasEventDirty();
|
|
418
|
+
var hasDom = this.hasDom();
|
|
419
|
+
var visible = this.isVisible();
|
|
420
|
+
var result = this.currentStatus === 'active' || hasDirtyLayout || visible && hasDirtyEvent || this.isNowVisible || hasDom && hasDirtyEvent;
|
|
419
421
|
this.currentStatus = undefined;
|
|
420
422
|
return result;
|
|
421
423
|
}
|
|
@@ -494,8 +496,8 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
494
496
|
value: function getParentValueAtMyIndex(targetName) {
|
|
495
497
|
var parentValue = this.getParentValue(targetName);
|
|
496
498
|
if (Array.isArray(parentValue)) {
|
|
497
|
-
var _this$
|
|
498
|
-
var index = (_this$
|
|
499
|
+
var _this$getParent3;
|
|
500
|
+
var index = (_this$getParent3 = this.getParent()) === null || _this$getParent3 === void 0 ? void 0 : _this$getParent3.getChildIndex(this);
|
|
499
501
|
if (typeof index === 'number') {
|
|
500
502
|
return parentValue[index];
|
|
501
503
|
}
|
package/build/TModelManager.js
CHANGED
|
@@ -85,6 +85,7 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
|
|
|
85
85
|
var _this = this;
|
|
86
86
|
var lastVisibleMap = _objectSpread({}, this.visibleOidMap);
|
|
87
87
|
this.clearFrameLists();
|
|
88
|
+
var activated = [];
|
|
88
89
|
var _iterator = _createForOfIteratorHelper((0, _App.getLocationManager)().hasLocationList),
|
|
89
90
|
_step;
|
|
90
91
|
try {
|
|
@@ -105,16 +106,31 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
|
|
|
105
106
|
} else {
|
|
106
107
|
delete this.visibleOidMap[tmodel.oid];
|
|
107
108
|
}
|
|
109
|
+
var keepDom = this.shouldPreserveDom(tmodel);
|
|
110
|
+
if (keepDom) {
|
|
111
|
+
this.visibleOidMap[tmodel.oid] = tmodel;
|
|
112
|
+
}
|
|
108
113
|
if (tmodel.hasDom()) {
|
|
109
|
-
if (!tmodel.canHaveDom() || !tmodel.isIncluded() || tmodel.canDeleteDom() && !visible) {
|
|
114
|
+
if (!tmodel.canHaveDom() || !tmodel.isIncluded() || tmodel.canDeleteDom() && !visible && !keepDom) {
|
|
110
115
|
this.addToInvisibleDom(tmodel);
|
|
111
116
|
tmodel.getChildren().forEach(function (tmodel) {
|
|
112
117
|
_this.addToRecursiveInvisibleDom(tmodel);
|
|
113
118
|
});
|
|
114
119
|
}
|
|
115
120
|
}
|
|
116
|
-
if (visible || tmodel.isActivated()) {
|
|
121
|
+
if (visible || tmodel.isActivated() || keepDom) {
|
|
117
122
|
var _state$updatingTarget, _state$activeTargetLi;
|
|
123
|
+
var state = tmodel.state();
|
|
124
|
+
if (((_state$updatingTarget = state.updatingTargetList) === null || _state$updatingTarget === void 0 ? void 0 : _state$updatingTarget.length) > 0 || tmodel.hasAnimatingTargets()) {
|
|
125
|
+
this.lists.updatingTModels.push(tmodel);
|
|
126
|
+
this.lists.updatingTargets = [].concat(_toConsumableArray(this.lists.updatingTargets), _toConsumableArray(state.updatingTargetList));
|
|
127
|
+
}
|
|
128
|
+
if (((_state$activeTargetLi = state.activeTargetList) === null || _state$activeTargetLi === void 0 ? void 0 : _state$activeTargetLi.length) > 0) {
|
|
129
|
+
this.lists.activeTModels.push(tmodel);
|
|
130
|
+
this.lists.activeTargets = [].concat(_toConsumableArray(this.lists.activeTargets), _toConsumableArray(state.activeTargetList));
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (visible || tmodel.isActivated() || keepDom) {
|
|
118
134
|
if (this.needsRerender(tmodel)) {
|
|
119
135
|
this.lists.rerender.push(tmodel);
|
|
120
136
|
}
|
|
@@ -130,22 +146,16 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
|
|
|
130
146
|
if (this.needsRelocation(tmodel)) {
|
|
131
147
|
this.lists.relocation.push(tmodel);
|
|
132
148
|
}
|
|
133
|
-
var
|
|
134
|
-
if (
|
|
135
|
-
this.
|
|
136
|
-
|
|
149
|
+
var _state = tmodel.state();
|
|
150
|
+
if (_state.targetMethodMap && Object.keys(_state.targetMethodMap).length > 0) {
|
|
151
|
+
this.targetMethodMap[tmodel.oid] = _objectSpread({}, _state.targetMethodMap);
|
|
152
|
+
_state.targetMethodMap = {};
|
|
137
153
|
}
|
|
138
|
-
if ((
|
|
139
|
-
|
|
140
|
-
this.lists.activeTargets = [].concat(_toConsumableArray(this.lists.activeTargets), _toConsumableArray(state.activeTargetList));
|
|
141
|
-
}
|
|
142
|
-
if (state.targetMethodMap && Object.keys(state.targetMethodMap).length > 0) {
|
|
143
|
-
this.targetMethodMap[tmodel.oid] = _objectSpread({}, state.targetMethodMap);
|
|
144
|
-
state.targetMethodMap = {};
|
|
154
|
+
if (tmodel.isActivated()) {
|
|
155
|
+
activated.push(tmodel);
|
|
145
156
|
}
|
|
146
|
-
tmodel.deactivate();
|
|
147
157
|
}
|
|
148
|
-
if (visible || tmodel.requiresDom()) {
|
|
158
|
+
if (visible || tmodel.requiresDom() || keepDom) {
|
|
149
159
|
if (tmodel.canHaveDom() && !tmodel.hasDom() && tmodel.isIncluded() && !this.noDomMap[tmodel.oid]) {
|
|
150
160
|
var _tmodel$getDomHolder, _tmodel$getDomParent;
|
|
151
161
|
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]) {
|
|
@@ -162,6 +172,9 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
|
|
|
162
172
|
} finally {
|
|
163
173
|
_iterator.f();
|
|
164
174
|
}
|
|
175
|
+
activated.forEach(function (t) {
|
|
176
|
+
return t.deactivate();
|
|
177
|
+
});
|
|
165
178
|
Object.values(lastVisibleMap).filter(function (v) {
|
|
166
179
|
return v !== undefined;
|
|
167
180
|
}).forEach(function (tmodel) {
|
|
@@ -173,6 +186,24 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
|
|
|
173
186
|
});
|
|
174
187
|
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.invisibleDom.length > 0 ? 5 : this.lists.restyle.length > 0 ? 10 : -1;
|
|
175
188
|
}
|
|
189
|
+
}, {
|
|
190
|
+
key: "shouldPreserveDom",
|
|
191
|
+
value: function shouldPreserveDom(tmodel) {
|
|
192
|
+
var parent = tmodel.parent;
|
|
193
|
+
if (!tmodel.isIncluded()) {
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
while (parent && parent !== (0, _App.tRoot)()) {
|
|
197
|
+
if (_TUtil.TUtil.isDefined(parent.targets.canDeleteDom) && parent.val('canDeleteDom') === false) {
|
|
198
|
+
return true;
|
|
199
|
+
}
|
|
200
|
+
if (_TUtil.TUtil.isDefined(parent.targets.isVisible) && parent.val('isVisible') === true) {
|
|
201
|
+
return true;
|
|
202
|
+
}
|
|
203
|
+
parent = parent.parent;
|
|
204
|
+
}
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
176
207
|
}, {
|
|
177
208
|
key: "isBracketVisible",
|
|
178
209
|
value: function isBracketVisible(tmodel) {
|
|
@@ -368,6 +399,12 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
|
|
|
368
399
|
if (tmodel.hasAnimatingTargets()) {
|
|
369
400
|
(0, _App.getAnimationManager)().pauseTModel(tmodel);
|
|
370
401
|
}
|
|
402
|
+
Object.keys(tmodel.targetValues).forEach(function (key) {
|
|
403
|
+
var targetValue = tmodel.targetValues[key];
|
|
404
|
+
if (targetValue.status === 'updating' && tmodel.updatingTargetList.indexOf(key) === -1) {
|
|
405
|
+
tmodel.setTargetStatus('active');
|
|
406
|
+
}
|
|
407
|
+
});
|
|
371
408
|
var domParent = tmodel.getDomParent();
|
|
372
409
|
if (domParent && domParent.$dom) {
|
|
373
410
|
domParent.$dom.removeElement(tmodel.$dom.element);
|