targetj 1.0.233 → 1.0.235

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.
@@ -57,19 +57,28 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
57
57
  key: "openPage",
58
58
  value: function () {
59
59
  var _openPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(link) {
60
- var visibles, newVisibles;
60
+ var shouldReset,
61
+ visibles,
62
+ newVisibles,
63
+ _args = arguments;
61
64
  return _regeneratorRuntime().wrap(function _callee$(_context) {
62
65
  while (1) switch (_context.prev = _context.next) {
63
66
  case 0:
64
- _context.next = 2;
65
- return _App.tApp.stop();
66
- case 2:
67
+ shouldReset = _args.length > 1 && _args[1] !== undefined ? _args[1] : true;
68
+ if (!shouldReset) {
69
+ _context.next = 7;
70
+ break;
71
+ }
67
72
  _context.next = 4;
68
- return _App.tApp.reset();
73
+ return _App.tApp.stop();
69
74
  case 4:
75
+ (0, _App.getLocationManager)().cancelCurrentCalculation();
76
+ _context.next = 7;
77
+ return _App.tApp.reset();
78
+ case 7:
70
79
  link = _TUtil.TUtil.getFullLink(link);
71
80
  if (this.pageCache[link]) {
72
- _context.next = 15;
81
+ _context.next = 18;
73
82
  break;
74
83
  }
75
84
  _App.tApp.tRoot.$dom.innerHTML("");
@@ -77,12 +86,12 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
77
86
  _App.App.tmodelIdMap = {};
78
87
  _App.tApp.tRoot = _App.tApp.tRootFactory();
79
88
  this.lastLink = link;
80
- _context.next = 13;
89
+ _context.next = 16;
81
90
  return _App.tApp.start();
82
- case 13:
83
- _context.next = 30;
91
+ case 16:
92
+ _context.next = 34;
84
93
  break;
85
- case 15:
94
+ case 18:
86
95
  _App.tApp.tRoot = this.pageCache[link].tRoot;
87
96
  _App.App.oids = this.pageCache[link].oids;
88
97
  _App.App.tmodelIdMap = this.pageCache[link].tmodelIdMap;
@@ -93,17 +102,18 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
93
102
  visibles.forEach(function (tmodel) {
94
103
  tmodel.visibilityStatus = undefined;
95
104
  });
105
+ _App.tApp.manager.activatePendingTargetsAfterDom(visibles);
96
106
  _App.tApp.manager.visibleOidMap = _objectSpread({}, this.pageCache[link].visibleOidMap);
97
107
  newVisibles.forEach(function (visible) {
98
108
  _App.tApp.manager.visibleOidMap[visible.oid] = visible;
99
109
  });
100
110
  window.scrollTo(this.pageCache[link].scrollLeft, this.pageCache[link].scrollTop);
101
111
  this.lastLink = link;
102
- _context.next = 29;
112
+ _context.next = 33;
103
113
  return _App.tApp.start();
104
- case 29:
114
+ case 33:
105
115
  (0, _App.getRunScheduler)().restoreSnapshot(this.pageCache[link].runSnapshot);
106
- case 30:
116
+ case 34:
107
117
  case "end":
108
118
  return _context.stop();
109
119
  }
@@ -118,30 +128,25 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
118
128
  key: "openLinkFromHistory",
119
129
  value: function () {
120
130
  var _openLinkFromHistory = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(state) {
131
+ var link;
121
132
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
122
133
  while (1) switch (_context2.prev = _context2.next) {
123
134
  case 0:
124
- if (!state.link) {
125
- _context2.next = 6;
135
+ link = state.link || state.browserUrl;
136
+ if (link) {
137
+ _context2.next = 3;
126
138
  break;
127
139
  }
128
- this.onPageClose();
129
- _context2.next = 4;
130
- return this.openLink(state.link, false);
131
- case 4:
132
- _context2.next = 10;
133
- break;
134
- case 6:
135
- if (!state.browserUrl) {
136
- _context2.next = 10;
137
- break;
140
+ return _context2.abrupt("return");
141
+ case 3:
142
+ if (state.browserUrl) {
143
+ history.replaceState({
144
+ link: link
145
+ }, "", link);
138
146
  }
139
- history.replaceState({
140
- link: state.browserUrl
141
- }, "", state.browserUrl);
142
- _context2.next = 10;
143
- return this.openPage(state.browserUrl);
144
- case 10:
147
+ _context2.next = 6;
148
+ return this.openLink(link, false);
149
+ case 6:
145
150
  case "end":
146
151
  return _context2.stop();
147
152
  }
@@ -166,6 +171,7 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
166
171
  value: function () {
167
172
  var _openLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(link) {
168
173
  var updateHistory,
174
+ runSnapshot,
169
175
  html,
170
176
  _args3 = arguments;
171
177
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
@@ -173,32 +179,42 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
173
179
  case 0:
174
180
  updateHistory = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : true;
175
181
  link = _TUtil.TUtil.getFullLink(link);
176
- if (this.lastLink) {
177
- _App.tApp.tRoot.$dom = _$Dom.$Dom.query('#tgjs-root') ? new _$Dom.$Dom('#tgjs-root') : new _$Dom.$Dom('body');
178
- html = _App.tApp.tRoot.$dom.innerHTML();
179
- this.onPageClose();
180
- this.pageCache[this.lastLink] = {
181
- link: this.lastLink,
182
- html: html,
183
- oids: _objectSpread({}, _App.App.oids),
184
- tmodelIdMap: _objectSpread({}, _App.App.tmodelIdMap),
185
- visibleOidMap: _objectSpread({}, _App.tApp.manager.visibleOidMap),
186
- scrollLeft: _$Dom.$Dom.getWindowScrollLeft() || 0,
187
- scrollTop: _$Dom.$Dom.getWindowScrollTop() || 0,
188
- tRoot: _App.tApp.tRoot,
189
- runSnapshot: (0, _App.getRunScheduler)().getSnapshot()
190
- };
182
+ if (!this.lastLink) {
183
+ _context3.next = 13;
184
+ break;
191
185
  }
186
+ runSnapshot = (0, _App.getRunScheduler)().getSnapshot();
187
+ _context3.next = 6;
188
+ return _App.tApp.stop();
189
+ case 6:
190
+ (0, _App.getLocationManager)().cancelCurrentCalculation();
191
+ this.onPageClose();
192
+ _App.tApp.tRoot.$dom = _$Dom.$Dom.query('#tgjs-root') ? new _$Dom.$Dom('#tgjs-root') : new _$Dom.$Dom('body');
193
+ html = _App.tApp.tRoot.$dom.innerHTML();
194
+ this.pageCache[this.lastLink] = {
195
+ link: this.lastLink,
196
+ html: html,
197
+ oids: _objectSpread({}, _App.App.oids),
198
+ tmodelIdMap: _objectSpread({}, _App.App.tmodelIdMap),
199
+ visibleOidMap: _objectSpread({}, _App.tApp.manager.visibleOidMap),
200
+ scrollLeft: _$Dom.$Dom.getWindowScrollLeft() || 0,
201
+ scrollTop: _$Dom.$Dom.getWindowScrollTop() || 0,
202
+ tRoot: _App.tApp.tRoot,
203
+ runSnapshot: runSnapshot
204
+ };
205
+ _context3.next = 13;
206
+ return _App.tApp.reset();
207
+ case 13:
192
208
  if (updateHistory) {
193
209
  history.pushState({
194
210
  link: link
195
211
  }, "", link);
196
212
  }
197
- _context3.next = 6;
198
- return this.openPage(link);
199
- case 6:
213
+ _context3.next = 16;
214
+ return this.openPage(link, false);
215
+ case 16:
200
216
  (0, _App.getRunScheduler)().schedule(0, "pagemanager-processOpenLink");
201
- case 7:
217
+ case 17:
202
218
  case "end":
203
219
  return _context3.stop();
204
220
  }
@@ -98,19 +98,11 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
98
98
  var insertTime = _TUtil.TUtil.now();
99
99
  this.delayRun(effectiveDelay, runId, insertTime);
100
100
  }
101
- }, {
102
- key: "timeSchedule",
103
- value: function timeSchedule(delay, runId) {
104
- if (!_App.tApp.isRunning() || this.resetting) {
105
- return;
106
- }
107
- this.delayRun(delay, runId, _TUtil.TUtil.now());
108
- }
109
101
  }, {
110
102
  key: "run",
111
103
  value: function () {
112
104
  var _run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(delay, runId) {
113
- var _this$delayProcess;
105
+ var handedOff;
114
106
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
115
107
  while (1) switch (_context2.prev = _context2.next) {
116
108
  case 0:
@@ -133,53 +125,56 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
133
125
  this.runId = runId;
134
126
  this.runningFlag = true;
135
127
  this.runStartTime = _TUtil.TUtil.now();
136
- if (_App.tApp.debugLevel === 1) {
137
- _TUtil.TUtil.log(true)("Request from: ".concat(runId, " delay: ").concat(delay, " runningStep:").concat(this.runningStep, " dom:").concat(this.domProcessing, " runs:").concat(this.nextRuns.length, " D:").concat((_this$delayProcess = this.delayProcess) === null || _this$delayProcess === void 0 ? void 0 : _this$delayProcess.delay, " events:").concat((0, _App.getEvents)().eventQueue.length));
138
- }
128
+ handedOff = false;
129
+ _context2.prev = 10;
139
130
  if (!(this.phase === 0)) {
140
- _context2.next = 16;
131
+ _context2.next = 17;
141
132
  break;
142
133
  }
143
134
  (0, _App.getEvents)().captureEvents();
144
135
  _App.tApp.targetManager.applyTargetValues((0, _App.tRoot)());
145
- _context2.next = 15;
136
+ _context2.next = 16;
146
137
  return (0, _App.getLocationManager)().calculateAll();
147
- case 15:
148
- this.phase = 1;
149
138
  case 16:
139
+ this.phase = 1;
140
+ case 17:
150
141
  if (!(_TUtil.TUtil.now() - this.runStartTime > FRAME_BUDGET_MS)) {
151
- _context2.next = 19;
142
+ _context2.next = 21;
152
143
  break;
153
144
  }
145
+ handedOff = true;
154
146
  this.requestNextSlice(runId);
155
147
  return _context2.abrupt("return");
156
- case 19:
148
+ case 21:
157
149
  if (this.phase === 1) {
158
150
  this.runningStep = _App.tApp.manager.analyze();
159
151
  this.phase = 2;
160
152
  }
161
153
  if (!(_TUtil.TUtil.now() - this.runStartTime > FRAME_BUDGET_MS)) {
162
- _context2.next = 23;
154
+ _context2.next = 26;
163
155
  break;
164
156
  }
157
+ handedOff = true;
165
158
  this.requestNextSlice(runId);
166
159
  return _context2.abrupt("return");
167
- case 23:
160
+ case 26:
168
161
  if (this.phase === 2) {
169
162
  (0, _App.getLocationManager)().calculateActivated();
170
163
  _App.tApp.events.resetEventsOnTimeout();
171
164
  this.phase = 3;
172
165
  }
173
166
  if (!(_TUtil.TUtil.now() - this.runStartTime > FRAME_BUDGET_MS)) {
174
- _context2.next = 27;
167
+ _context2.next = 31;
175
168
  break;
176
169
  }
170
+ handedOff = true;
177
171
  this.requestNextSlice(runId);
178
172
  return _context2.abrupt("return");
179
- case 27:
173
+ case 31:
180
174
  if (this.phase === 3) {
181
175
  if (this.runningStep >= 0) {
182
176
  if (this.domProcessing === 0) {
177
+ handedOff = true;
183
178
  this.domOperations(this.runningStep);
184
179
  } else if (!this.rerunId) {
185
180
  this.rerunId = "domrun ".concat(runId);
@@ -191,11 +186,24 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
191
186
  if (this.domProcessing === 0) {
192
187
  this.needsRerun();
193
188
  }
194
- case 30:
189
+ _context2.next = 40;
190
+ break;
191
+ case 36:
192
+ _context2.prev = 36;
193
+ _context2.t0 = _context2["catch"](10);
194
+ this.phase = 0;
195
+ throw _context2.t0;
196
+ case 40:
197
+ _context2.prev = 40;
198
+ if (!handedOff && this.domProcessing === 0) {
199
+ this.runningFlag = false;
200
+ }
201
+ return _context2.finish(40);
202
+ case 43:
195
203
  case "end":
196
204
  return _context2.stop();
197
205
  }
198
- }, _callee2, this);
206
+ }, _callee2, this, [[10, 36, 40, 43]]);
199
207
  }));
200
208
  function run(_x, _x2) {
201
209
  return _run.apply(this, arguments);
@@ -213,7 +221,7 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
213
221
  this.sliceQueued = true;
214
222
  requestAnimationFrame(function () {
215
223
  _this.sliceQueued = false;
216
- _this.delayRun(0, "slice-".concat(runId), _TUtil.TUtil.now());
224
+ _this.schedule(0, "slice-".concat(runId));
217
225
  });
218
226
  }
219
227
  }, {
@@ -225,35 +233,32 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
225
233
  var id = this.rerunId;
226
234
  this.rerunId = '';
227
235
  this.schedule(0, "rerun-".concat(id));
228
- return;
229
- }
230
- var newDelay = this.nextRuns.length > 0 ? this.nextRuns[0].delay - (_TUtil.TUtil.now() - this.nextRuns[0].insertTime) : undefined;
231
- if (newDelay === undefined || (0, _App.getManager)().lists.activeTModels.length > 0 || (0, _App.getManager)().lists.updatingTModels.length > 0 || (0, _App.getManager)().lists.restyle.length > 0 || (0, _App.getManager)().lists.reasyncStyle.length > 0 || (0, _App.getEvents)().eventQueue.length > 0 || (0, _App.getLocationManager)().activatedList.length > 0) {
232
- if ((0, _App.getEvents)().eventQueue.length > 0) {
233
- this.schedule(1, "events-".concat((0, _App.getEvents)().eventQueue.length));
234
- } else if ((0, _App.getLocationManager)().activatedList.length > 0) {
235
- this.schedule(1, "getManager-locationManager-activatedList");
236
- } else if ((0, _App.getManager)().lists.updatingTModels.length > 0) {
237
- this.schedule(1, "getManager-needsRerun-updatingTModels");
238
- } else if ((0, _App.getManager)().lists.activeTModels.length > 0) {
239
- var activeTModel = (0, _App.getManager)().lists.activeTModels.find(function (tmodel) {
240
- return tmodel.targetExecutionCount === 0 || tmodel.activeTargetList.filter(function (target) {
241
- return !tmodel.isScheduledPending(target);
242
- }).some(function (target) {
243
- return tmodel.shouldScheduleRun(target);
236
+ } else if ((0, _App.getEvents)().eventQueue.length > 0) {
237
+ this.schedule(0, "events-".concat((0, _App.getEvents)().eventQueue.length));
238
+ } else {
239
+ var newDelay = this.nextRuns.length > 0 ? this.nextRuns[0].delay - (_TUtil.TUtil.now() - this.nextRuns[0].insertTime) : undefined;
240
+ if (newDelay === undefined || (0, _App.getManager)().lists.activeTModels.length > 0 || (0, _App.getManager)().lists.updatingTModels.length > 0 || (0, _App.getManager)().lists.restyle.length > 0 || (0, _App.getManager)().lists.reasyncStyle.length > 0 || (0, _App.getEvents)().eventQueue.length > 0 || (0, _App.getLocationManager)().activatedList.length > 0) {
241
+ if ((0, _App.getLocationManager)().activatedList.length > 0) {
242
+ this.schedule(1, "getManager-locationManager-activatedList");
243
+ } else if ((0, _App.getManager)().lists.updatingTModels.length > 0) {
244
+ this.schedule(1, "getManager-needsRerun-updatingTModels");
245
+ } else if ((0, _App.getManager)().lists.activeTModels.length > 0) {
246
+ var activeTModel = (0, _App.getManager)().lists.activeTModels.find(function (tmodel) {
247
+ return tmodel.targetExecutionCount === 0 || tmodel.activeTargetList.filter(function (target) {
248
+ return !tmodel.isScheduledPending(target);
249
+ }).some(function (target) {
250
+ return tmodel.shouldScheduleRun(target);
251
+ });
244
252
  });
245
- });
246
- if (activeTModel) {
247
- var delay = !this.activeStartTime || _TUtil.TUtil.now() - this.activeStartTime > 15 ? 1 : 15;
248
- this.activeStartTime = _TUtil.TUtil.now();
249
- this.schedule(delay, "getManager-needsRerun-".concat(activeTModel.oid, "-").concat(activeTModel.activeTargetList));
253
+ if (activeTModel) {
254
+ var delay = !this.activeStartTime || _TUtil.TUtil.now() - this.activeStartTime > 15 ? 1 : 15;
255
+ this.activeStartTime = _TUtil.TUtil.now();
256
+ this.schedule(delay, "getManager-needsRerun-".concat(activeTModel.oid, "-").concat(activeTModel.activeTargetList));
257
+ }
250
258
  }
251
259
  }
252
260
  }
253
- if (!this.delayProcess && this.nextRuns.length > 0) {
254
- var _delay = Math.max(1, this.nextRuns[0].delay - (_TUtil.TUtil.now() - this.nextRuns[0].insertTime));
255
- this.schedule(_delay, "wake-nextRun");
256
- }
261
+ this.executeNextRun();
257
262
  }
258
263
  }, {
259
264
  key: "domOperations",
@@ -262,20 +267,23 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
262
267
  this.domProcessing = 1;
263
268
  if (runningStep === 10) {
264
269
  this.domFixStyles();
265
- } else {
266
- Promise.all(RunScheduler.domSteps.filter(function (_, index) {
267
- return index >= runningStep;
268
- }).map(function (step) {
269
- return Promise.resolve().then(step);
270
- })).then(function () {
271
- if ((0, _App.getManager)().lists.restyle.length) {
272
- _this2.domFixStyles();
273
- } else {
274
- _this2.domProcessing = 0;
275
- _this2.needsRerun();
276
- }
277
- });
270
+ return;
278
271
  }
272
+ Promise.all(RunScheduler.domSteps.filter(function (_, index) {
273
+ return index >= runningStep;
274
+ }).map(function (step) {
275
+ return Promise.resolve().then(step);
276
+ })).then(function () {
277
+ if ((0, _App.getManager)().lists.restyle.length) {
278
+ _this2.domFixStyles();
279
+ return;
280
+ }
281
+ _this2.domProcessing = 0;
282
+ _this2.needsRerun();
283
+ }).catch(function () {
284
+ _this2.domProcessing = 0;
285
+ _this2.needsRerun();
286
+ });
279
287
  }
280
288
  }, {
281
289
  key: "domFixStyles",
@@ -283,16 +291,19 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
283
291
  var _this3 = this;
284
292
  this.domProcessing = 2;
285
293
  requestAnimationFrame(function () {
286
- (0, _App.getManager)().fixStyles();
287
- _this3.domProcessing = 0;
288
- _this3.needsRerun();
294
+ try {
295
+ (0, _App.getManager)().fixStyles();
296
+ } finally {
297
+ _this3.domProcessing = 0;
298
+ _this3.needsRerun();
299
+ }
289
300
  });
290
301
  }
291
302
  }, {
292
303
  key: "clearDelayProcess",
293
304
  value: function clearDelayProcess() {
294
- var _this$delayProcess2;
295
- if ((_this$delayProcess2 = this.delayProcess) !== null && _this$delayProcess2 !== void 0 && _this$delayProcess2.timeoutId) {
305
+ var _this$delayProcess;
306
+ if ((_this$delayProcess = this.delayProcess) !== null && _this$delayProcess !== void 0 && _this$delayProcess.timeoutId) {
296
307
  clearTimeout(this.delayProcess.timeoutId);
297
308
  this.delayProcess.timeoutId = undefined;
298
309
  }
@@ -310,53 +321,78 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
310
321
  delay: delay,
311
322
  timeoutId: undefined
312
323
  };
313
- delayProcess.timeoutId = setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
314
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
315
- while (1) switch (_context3.prev = _context3.next) {
316
- case 0:
317
- if (!(_this4.delayProcess !== delayProcess)) {
318
- _context3.next = 2;
319
- break;
320
- }
321
- return _context3.abrupt("return");
322
- case 2:
323
- delayProcess.timeoutId = undefined;
324
- _context3.next = 5;
325
- return _this4.run(delay, runId);
326
- case 5:
327
- if (_this4.delayProcess === delayProcess) {
324
+ var execute = /*#__PURE__*/function () {
325
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
326
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
327
+ while (1) switch (_context3.prev = _context3.next) {
328
+ case 0:
329
+ if (!(_this4.delayProcess !== delayProcess)) {
330
+ _context3.next = 2;
331
+ break;
332
+ }
333
+ return _context3.abrupt("return");
334
+ case 2:
335
+ _this4.clearDelayProcess();
336
+ _context3.prev = 3;
337
+ _context3.next = 6;
338
+ return _this4.run(delay, runId);
339
+ case 6:
340
+ _context3.prev = 6;
328
341
  _this4.executeNextRun();
329
- }
330
- case 6:
331
- case "end":
332
- return _context3.stop();
333
- }
334
- }, _callee3);
335
- })), Math.max(0, delay));
342
+ return _context3.finish(6);
343
+ case 9:
344
+ case "end":
345
+ return _context3.stop();
346
+ }
347
+ }, _callee3, null, [[3,, 6, 9]]);
348
+ }));
349
+ return function execute() {
350
+ return _ref.apply(this, arguments);
351
+ };
352
+ }();
336
353
  this.delayProcess = delayProcess;
354
+ delayProcess.timeoutId = setTimeout(execute, delay);
337
355
  }
338
356
  }, {
339
357
  key: "executeNextRun",
340
358
  value: function executeNextRun() {
341
- var lastNegativeRun = null;
342
- var nextValidRun = null;
359
+ if (this.runningFlag || this.domProcessing > 0) {
360
+ return;
361
+ }
362
+ if (this.delayProcess) {
363
+ if (this.nextRuns.length > 0) {
364
+ var nextRun = this.nextRuns[0];
365
+ var nextRunTime = nextRun.insertTime + nextRun.delay;
366
+ if (nextRunTime < this.delayProcess.runTime) {
367
+ clearTimeout(this.delayProcess.timeoutId);
368
+ var remaining = Math.max(0, this.delayProcess.runTime - _TUtil.TUtil.now());
369
+ this.insertRun(this.delayProcess.runId, _TUtil.TUtil.now(), remaining);
370
+ this.delayProcess = undefined;
371
+ } else {
372
+ return;
373
+ }
374
+ } else {
375
+ return;
376
+ }
377
+ }
378
+ var runToExecute = null;
343
379
  while (this.nextRuns.length > 0) {
344
- var nextRun = this.nextRuns.shift();
380
+ var _nextRun = this.nextRuns.shift();
345
381
  var now = _TUtil.TUtil.now();
346
- var newDelay = nextRun.delay - (now - nextRun.insertTime);
347
- if (newDelay < 0) {
348
- lastNegativeRun = nextRun;
382
+ var newDelay = _nextRun.delay - (now - _nextRun.insertTime);
383
+ if (newDelay <= 0) {
384
+ runToExecute = _nextRun;
349
385
  } else {
350
- lastNegativeRun = null;
351
- nextValidRun = nextRun;
386
+ this.nextRuns.unshift(_nextRun);
352
387
  break;
353
388
  }
354
389
  }
355
- if (lastNegativeRun) {
356
- this.setDelayProcess(lastNegativeRun.runId, lastNegativeRun.insertTime, lastNegativeRun.delay, _TUtil.TUtil.now(), 0);
357
- } else if (nextValidRun) {
390
+ if (runToExecute) {
391
+ this.setDelayProcess(runToExecute.runId, runToExecute.insertTime, runToExecute.delay, _TUtil.TUtil.now(), 0);
392
+ } else if (this.nextRuns.length > 0) {
393
+ var nextValidRun = this.nextRuns[0];
358
394
  var _now = _TUtil.TUtil.now();
359
- var _newDelay = Math.max(1, nextValidRun.delay - (_now - nextValidRun.insertTime));
395
+ var _newDelay = Math.max(0, nextValidRun.delay - (_now - nextValidRun.insertTime));
360
396
  this.setDelayProcess(nextValidRun.runId, nextValidRun.insertTime, nextValidRun.delay, _now + _newDelay, _newDelay);
361
397
  } else {
362
398
  this.clearDelayProcess();
@@ -386,7 +422,13 @@ var RunScheduler = exports.RunScheduler = /*#__PURE__*/function () {
386
422
  var r = this.nextRuns[mid];
387
423
  var diffTime = r.insertTime + r.delay - (newInsertTime + newDelay);
388
424
  if (diffTime === 0) {
389
- r.runId += '-' + newRunId;
425
+ var _r$count;
426
+ r.count = ((_r$count = r.count) !== null && _r$count !== void 0 ? _r$count : 1) + 1;
427
+ if (r.runId.length < 500) {
428
+ r.runId += '-' + newRunId;
429
+ } else if (!r.runId.endsWith('-...')) {
430
+ r.runId += '-...';
431
+ }
390
432
  return;
391
433
  }
392
434
  if (diffTime > 0) {
package/build/TModel.js CHANGED
@@ -326,6 +326,16 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
326
326
  }
327
327
  return this;
328
328
  }
329
+ }, {
330
+ key: "exists",
331
+ value: function exists() {
332
+ var parent = this.getParent();
333
+ if (!parent) {
334
+ return false;
335
+ }
336
+ parent.getChildren();
337
+ return parent.allChildrenMap[this.oid] === this;
338
+ }
329
339
  }, {
330
340
  key: "addToParentVisibleChildren",
331
341
  value: function addToParentVisibleChildren() {
@@ -92,7 +92,7 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
92
92
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
93
93
  var tmodel = _step.value;
94
94
  lastVisibleMap[tmodel.oid] = undefined;
95
- if (!_App.App.tmodelIdMap[tmodel.oid]) {
95
+ if (!tmodel.exists()) {
96
96
  if (tmodel.hasDom()) {
97
97
  this.addToInvisibleDom(tmodel);
98
98
  }
@@ -181,7 +181,7 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
181
181
  return v !== undefined;
182
182
  }).forEach(function (tmodel) {
183
183
  if (tmodel.hasDom()) {
184
- if (!_App.App.tmodelIdMap[tmodel.oid] || !tmodel.isIncluded()) {
184
+ if (!tmodel.exists() || !tmodel.isIncluded()) {
185
185
  _this.addToInvisibleDom(tmodel);
186
186
  }
187
187
  }
@@ -467,6 +467,7 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
467
467
  if (pending !== null && pending !== void 0 && pending.size) {
468
468
  for (var _i = 0, _arr = _toConsumableArray(pending); _i < _arr.length; _i++) {
469
469
  var target = _arr[_i];
470
+ _TargetUtil.TargetUtil.cleanupTarget(tmodel, target);
470
471
  _TargetUtil.TargetUtil.shouldActivateNextTarget(tmodel, target);
471
472
  }
472
473
  }
package/build/TUtil.js CHANGED
@@ -86,12 +86,12 @@ var TUtil = exports.TUtil = /*#__PURE__*/function () {
86
86
  while (container && container !== (0, _App.tRoot)()) {
87
87
  if (this.shouldClipByAncestor(container)) {
88
88
  var ancestorRect = this.getAncestorViewportRect(container);
89
- rect = rect ? this.intersectVisibilityRects(rect, ancestorRect) : ancestorRect;
89
+ rect = rect && !container.allTargetMap['onWindowScroll'] ? this.intersectVisibilityRects(rect, ancestorRect) : ancestorRect;
90
90
  if (rect.r <= rect.x || rect.b <= rect.y) {
91
91
  break;
92
92
  }
93
93
  }
94
- container = container.getParent();
94
+ container = container.getRealParent();
95
95
  }
96
96
  return rect;
97
97
  }
@@ -297,7 +297,8 @@ var TUtil = exports.TUtil = /*#__PURE__*/function () {
297
297
  var g = _step.value;
298
298
  var gtab = g.isVisible() ? tab + '| ' : tab + 'x ';
299
299
  if (g.type === 'BI') {
300
- console.log("".concat(gtab).concat(g.oid, " v:").concat(g.isVisible(), " x:").concat(Math.floor(g.getX()), " y:").concat(Math.floor(g.getY()), ", absX:").concat(Math.floor(g.absX), ", absY:").concat(Math.floor(g.absY), " n-e-s:").concat(Math.floor(g.viewport.yNorth), "-").concat(Math.floor(g.viewport.yEast), "-").concat(Math.floor(g.viewport.ySouth), " w:").concat(Math.floor(g.getBaseWidth()), " ww:").concat(Math.floor(g.getContentWidth()), " h:").concat(Math.floor(g.getBaseHeight()), " hh:").concat(Math.floor(g.getContentHeight())));
300
+ var _g$viewport, _g$viewport2, _g$viewport3;
301
+ console.log("".concat(gtab).concat(g.oid, " v:").concat(g.isVisible(), " x:").concat(Math.floor(g.getX()), " y:").concat(Math.floor(g.getY()), ", absX:").concat(Math.floor(g.absX), ", absY:").concat(Math.floor(g.absY), " n-e-s:").concat(Math.floor((_g$viewport = g.viewport) === null || _g$viewport === void 0 ? void 0 : _g$viewport.yNorth), "-").concat(Math.floor((_g$viewport2 = g.viewport) === null || _g$viewport2 === void 0 ? void 0 : _g$viewport2.yEast), "-").concat(Math.floor((_g$viewport3 = g.viewport) === null || _g$viewport3 === void 0 ? void 0 : _g$viewport3.ySouth), " w:").concat(Math.floor(g.getBaseWidth()), " ww:").concat(Math.floor(g.getContentWidth()), " h:").concat(Math.floor(g.getBaseHeight()), " hh:").concat(Math.floor(g.getContentHeight())));
301
302
  } else {
302
303
  console.log("".concat(gtab).concat(g.oid, " v:").concat(g.isVisible(), " x:").concat(Math.floor(g.getX()), " y:").concat(Math.floor(g.getY()), " absX:").concat(Math.floor(g.absX), ", absY:").concat(Math.floor(g.absY), " w:").concat(Math.floor(g.getWidth()), " h:").concat(Math.floor(g.getHeight()), " hc:").concat(Math.floor(g.getContentHeight())));
303
304
  }