targetj 1.0.235 → 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.
@@ -649,9 +649,37 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
649
649
  }, {
650
650
  key: "isScheduledPending",
651
651
  value: function isScheduledPending(key) {
652
+ var remainingTime = this.getScheduleRemainingTime(key);
653
+ if (_TUtil.TUtil.isDefined(remainingTime)) {
654
+ return remainingTime > 0;
655
+ }
652
656
  var lastScheduledTime = this.getScheduleTimeStamp(key);
653
657
  var interval = this.getTargetInterval(key);
654
- return lastScheduledTime && lastScheduledTime + interval > _TUtil.TUtil.now();
658
+ return _TUtil.TUtil.isDefined(lastScheduledTime) && lastScheduledTime + interval > _TUtil.TUtil.now();
659
+ }
660
+ }, {
661
+ key: "getScheduleRemainingTime",
662
+ value: function getScheduleRemainingTime(key) {
663
+ var _this$targetValues$ke8;
664
+ return (_this$targetValues$ke8 = this.targetValues[key]) === null || _this$targetValues$ke8 === void 0 ? void 0 : _this$targetValues$ke8.scheduleRemainingTime;
665
+ }
666
+ }, {
667
+ key: "setScheduleRemainingTime",
668
+ value: function setScheduleRemainingTime(key, remainingTime) {
669
+ var targetValue = this.targetValues[key];
670
+ if (!targetValue) {
671
+ return;
672
+ }
673
+ targetValue.scheduleRemainingTime = remainingTime;
674
+ }
675
+ }, {
676
+ key: "resetScheduleRemainingTime",
677
+ value: function resetScheduleRemainingTime(key) {
678
+ var targetValue = this.targetValues[key];
679
+ if (!targetValue) {
680
+ return;
681
+ }
682
+ delete targetValue.scheduleRemainingTime;
655
683
  }
656
684
  }, {
657
685
  key: "isTargetInLoop",
@@ -685,14 +713,14 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
685
713
  }, {
686
714
  key: "getTargetInitialValue",
687
715
  value: function getTargetInitialValue(key) {
688
- var _this$targetValues$ke8;
689
- return (_this$targetValues$ke8 = this.targetValues[key]) === null || _this$targetValues$ke8 === void 0 ? void 0 : _this$targetValues$ke8.initialValue;
716
+ var _this$targetValues$ke9;
717
+ return (_this$targetValues$ke9 = this.targetValues[key]) === null || _this$targetValues$ke9 === void 0 ? void 0 : _this$targetValues$ke9.initialValue;
690
718
  }
691
719
  }, {
692
720
  key: "getLastUpdate",
693
721
  value: function getLastUpdate(key) {
694
- var _this$targetValues$ke9;
695
- return (_this$targetValues$ke9 = this.targetValues[key]) === null || _this$targetValues$ke9 === void 0 ? void 0 : _this$targetValues$ke9.lastUpdate;
722
+ var _this$targetValues$ke10;
723
+ return (_this$targetValues$ke10 = this.targetValues[key]) === null || _this$targetValues$ke10 === void 0 ? void 0 : _this$targetValues$ke10.lastUpdate;
696
724
  }
697
725
  }, {
698
726
  key: "getDimLastUpdate",
@@ -703,8 +731,8 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
703
731
  }, {
704
732
  key: "getTargetActivationTime",
705
733
  value: function getTargetActivationTime(key) {
706
- var _this$targetValues$ke10, _this$targetValues$ke11;
707
- return (_this$targetValues$ke10 = (_this$targetValues$ke11 = this.targetValues[key]) === null || _this$targetValues$ke11 === void 0 ? void 0 : _this$targetValues$ke11.activationTime) !== null && _this$targetValues$ke10 !== void 0 ? _this$targetValues$ke10 : 0;
734
+ var _this$targetValues$ke11, _this$targetValues$ke12;
735
+ return (_this$targetValues$ke11 = (_this$targetValues$ke12 = this.targetValues[key]) === null || _this$targetValues$ke12 === void 0 ? void 0 : _this$targetValues$ke12.activationTime) !== null && _this$targetValues$ke11 !== void 0 ? _this$targetValues$ke11 : 0;
708
736
  }
709
737
  }, {
710
738
  key: "getTargetCreationTime",
@@ -727,8 +755,8 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
727
755
  }, {
728
756
  key: "getTargetEasing",
729
757
  value: function getTargetEasing(key) {
730
- var _this$targetValues$ke12;
731
- var easing = (_this$targetValues$ke12 = this.targetValues[key]) === null || _this$targetValues$ke12 === void 0 ? void 0 : _this$targetValues$ke12.easing;
758
+ var _this$targetValues$ke13;
759
+ var easing = (_this$targetValues$ke13 = this.targetValues[key]) === null || _this$targetValues$ke13 === void 0 ? void 0 : _this$targetValues$ke13.easing;
732
760
  var target = this.targets[key];
733
761
  if (!target) {
734
762
  return easing;
@@ -738,8 +766,8 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
738
766
  }, {
739
767
  key: "getTargetInterval",
740
768
  value: function getTargetInterval(key) {
741
- var _this$targetValues$ke13, _this$targetValues$ke14;
742
- var interval = (_this$targetValues$ke13 = (_this$targetValues$ke14 = this.targetValues[key]) === null || _this$targetValues$ke14 === void 0 ? void 0 : _this$targetValues$ke14.interval) !== null && _this$targetValues$ke13 !== void 0 ? _this$targetValues$ke13 : 0;
769
+ var _this$targetValues$ke14, _this$targetValues$ke15;
770
+ var interval = (_this$targetValues$ke14 = (_this$targetValues$ke15 = this.targetValues[key]) === null || _this$targetValues$ke15 === void 0 ? void 0 : _this$targetValues$ke15.interval) !== null && _this$targetValues$ke14 !== void 0 ? _this$targetValues$ke14 : 0;
743
771
  var target = this.targets[key];
744
772
  if (!target) {
745
773
  return interval;
@@ -749,8 +777,8 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
749
777
  }, {
750
778
  key: "getTargetSteps",
751
779
  value: function getTargetSteps(key) {
752
- var _this$targetValues$ke15, _this$targetValues$ke16;
753
- var steps = (_this$targetValues$ke15 = (_this$targetValues$ke16 = this.targetValues[key]) === null || _this$targetValues$ke16 === void 0 ? void 0 : _this$targetValues$ke16.steps) !== null && _this$targetValues$ke15 !== void 0 ? _this$targetValues$ke15 : 0;
780
+ var _this$targetValues$ke16, _this$targetValues$ke17;
781
+ var steps = (_this$targetValues$ke16 = (_this$targetValues$ke17 = this.targetValues[key]) === null || _this$targetValues$ke17 === void 0 ? void 0 : _this$targetValues$ke17.steps) !== null && _this$targetValues$ke16 !== void 0 ? _this$targetValues$ke16 : 0;
754
782
  var target = this.targets[key];
755
783
  if (!target) {
756
784
  return steps;
@@ -760,8 +788,8 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
760
788
  }, {
761
789
  key: "getTargetCycles",
762
790
  value: function getTargetCycles(key) {
763
- var _this$targetValues$ke17, _this$targetValues$ke18;
764
- var cycles = (_this$targetValues$ke17 = (_this$targetValues$ke18 = this.targetValues[key]) === null || _this$targetValues$ke18 === void 0 ? void 0 : _this$targetValues$ke18.cycles) !== null && _this$targetValues$ke17 !== void 0 ? _this$targetValues$ke17 : 1;
791
+ var _this$targetValues$ke18, _this$targetValues$ke19;
792
+ var cycles = (_this$targetValues$ke18 = (_this$targetValues$ke19 = this.targetValues[key]) === null || _this$targetValues$ke19 === void 0 ? void 0 : _this$targetValues$ke19.cycles) !== null && _this$targetValues$ke18 !== void 0 ? _this$targetValues$ke18 : 1;
765
793
  var target = this.targets[key];
766
794
  if (!target) {
767
795
  return cycles;
@@ -771,14 +799,14 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
771
799
  }, {
772
800
  key: "getTargetCycle",
773
801
  value: function getTargetCycle(key) {
774
- var _this$targetValues$ke19, _this$targetValues$ke20;
775
- return (_this$targetValues$ke19 = (_this$targetValues$ke20 = this.targetValues[key]) === null || _this$targetValues$ke20 === void 0 ? void 0 : _this$targetValues$ke20.cycle) !== null && _this$targetValues$ke19 !== void 0 ? _this$targetValues$ke19 : 0;
802
+ var _this$targetValues$ke20, _this$targetValues$ke21;
803
+ return (_this$targetValues$ke20 = (_this$targetValues$ke21 = this.targetValues[key]) === null || _this$targetValues$ke21 === void 0 ? void 0 : _this$targetValues$ke21.cycle) !== null && _this$targetValues$ke20 !== void 0 ? _this$targetValues$ke20 : 0;
776
804
  }
777
805
  }, {
778
806
  key: "getValueListPointer",
779
807
  value: function getValueListPointer(key) {
780
- var _this$targetValues$ke21, _this$targetValues$ke22;
781
- return (_this$targetValues$ke21 = (_this$targetValues$ke22 = this.targetValues[key]) === null || _this$targetValues$ke22 === void 0 ? void 0 : _this$targetValues$ke22.valuePointer) !== null && _this$targetValues$ke21 !== void 0 ? _this$targetValues$ke21 : 0;
808
+ var _this$targetValues$ke22, _this$targetValues$ke23;
809
+ return (_this$targetValues$ke22 = (_this$targetValues$ke23 = this.targetValues[key]) === null || _this$targetValues$ke23 === void 0 ? void 0 : _this$targetValues$ke23.valuePointer) !== null && _this$targetValues$ke22 !== void 0 ? _this$targetValues$ke22 : 0;
782
810
  }
783
811
  }, {
784
812
  key: "incrementTargetCycle",
@@ -1000,9 +1028,9 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
1000
1028
  }, {
1001
1029
  key: "addToAnimatingMap",
1002
1030
  value: function addToAnimatingMap(key) {
1003
- var _this$targetValues$ke23, _this$getParent7;
1031
+ var _this$targetValues$ke24, _this$getParent7;
1004
1032
  var record = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1005
- if ((_this$targetValues$ke23 = this.targetValues[key]) !== null && _this$targetValues$ke23 !== void 0 && _this$targetValues$ke23.snapAnimation) {
1033
+ if ((_this$targetValues$ke24 = this.targetValues[key]) !== null && _this$targetValues$ke24 !== void 0 && _this$targetValues$ke24.snapAnimation) {
1006
1034
  return;
1007
1035
  }
1008
1036
  this.animatingMap || (this.animatingMap = new Map());
@@ -543,7 +543,7 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
543
543
  case 'resize':
544
544
  this.windowEpoch++;
545
545
  this.resizeRoot();
546
- (0, _App.getManager)().getVisibles().forEach(function (t) {
546
+ (0, _App.getManager)().getAvailableDoms().forEach(function (t) {
547
547
  if (t.targets['onResize']) {
548
548
  t.markLayoutDirty('resize-event');
549
549
  }
@@ -1078,7 +1078,7 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
1078
1078
  this.currentTouch.prevDeltaY += deltaY;
1079
1079
  this.currentTouch.deltaX = this.currentTouch.prevDeltaX;
1080
1080
  this.currentTouch.deltaY = this.currentTouch.prevDeltaY;
1081
- if (this.scrollEndTimeStamp.x > 0 || this.scrollEndTimeStamp.y > 0) {
1081
+ if (endDelay && (this.scrollEndTimeStamp.x > 0 || this.scrollEndTimeStamp.y > 0)) {
1082
1082
  (0, _App.getRunScheduler)().schedule(endDelay, 'scroll-end-check');
1083
1083
  }
1084
1084
  }
@@ -18,7 +18,11 @@ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructur
18
18
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
19
19
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
20
20
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
21
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
22
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
21
23
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
24
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
25
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
22
26
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
23
27
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
24
28
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -495,9 +499,61 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
495
499
  }
496
500
  if (tmodel.isNowInvisible) {
497
501
  this.addToLocationList(tmodel);
502
+ this.pauseSchedules(tmodel);
503
+ }
504
+ if (tmodel.isNowVisible) {
505
+ this.resumeSchedules(tmodel);
498
506
  }
499
507
  tmodel.addToParentVisibleChildren();
500
508
  }
509
+ }, {
510
+ key: "pauseSchedules",
511
+ value: function pauseSchedules(tmodel) {
512
+ if (tmodel.type === 'BI') {
513
+ return;
514
+ }
515
+ var keys = new Set([].concat(_toConsumableArray(tmodel.activeTargetList), _toConsumableArray(tmodel.updatingTargetList)));
516
+ var _iterator = _createForOfIteratorHelper(keys),
517
+ _step;
518
+ try {
519
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
520
+ var key = _step.value;
521
+ var target = tmodel.targets[key];
522
+ if (_TUtil.TUtil.isDefined(tmodel.getScheduleTimeStamp(key)) && (target === null || target === void 0 ? void 0 : target.pauseOn) === 'hidden') {
523
+ _TUtil.TUtil.pauseSchedule(tmodel, key);
524
+ }
525
+ }
526
+ } catch (err) {
527
+ _iterator.e(err);
528
+ } finally {
529
+ _iterator.f();
530
+ }
531
+ }
532
+ }, {
533
+ key: "resumeSchedules",
534
+ value: function resumeSchedules(tmodel) {
535
+ if (tmodel.type === 'BI') {
536
+ return;
537
+ }
538
+ var keys = new Set([].concat(_toConsumableArray(tmodel.activeTargetList), _toConsumableArray(tmodel.updatingTargetList)));
539
+ var _iterator2 = _createForOfIteratorHelper(keys),
540
+ _step2;
541
+ try {
542
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
543
+ var key = _step2.value;
544
+ var target = tmodel.targets[key];
545
+ var remaining = tmodel.getScheduleRemainingTime(key);
546
+ if (_TUtil.TUtil.isDefined(remaining) && (target === null || target === void 0 ? void 0 : target.pauseOn) === 'hidden') {
547
+ _TUtil.TUtil.resumeSchedule(tmodel, key);
548
+ (0, _App.getRunScheduler)().schedule(remaining, 'resume-' + tmodel.oid + '-' + key);
549
+ }
550
+ }
551
+ } catch (err) {
552
+ _iterator2.e(err);
553
+ } finally {
554
+ _iterator2.f();
555
+ }
556
+ }
501
557
  }, {
502
558
  key: "calculateTargets",
503
559
  value: function calculateTargets(tmodel) {
@@ -512,17 +568,17 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
512
568
  while (tmodel.activatedTargets.length && guard++ < 50) {
513
569
  var batch = tmodel.activatedTargets.slice(0);
514
570
  tmodel.activatedTargets.length = 0;
515
- var _iterator = _createForOfIteratorHelper(batch),
516
- _step;
571
+ var _iterator3 = _createForOfIteratorHelper(batch),
572
+ _step3;
517
573
  try {
518
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
519
- var key = _step.value;
574
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
575
+ var key = _step3.value;
520
576
  (0, _App.getTargetManager)().applyTargetValue(tmodel, key);
521
577
  }
522
578
  } catch (err) {
523
- _iterator.e(err);
579
+ _iterator3.e(err);
524
580
  } finally {
525
- _iterator.f();
581
+ _iterator3.f();
526
582
  }
527
583
  }
528
584
  (0, _App.getTargetManager)().applyTargetValues(tmodel);
@@ -561,11 +617,11 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
561
617
  var list = _this2.resumePausedList.slice();
562
618
  _this2.resumePausedList.length = 0;
563
619
  _this2.resumePausedMap = {};
564
- var _iterator2 = _createForOfIteratorHelper(list),
565
- _step2;
620
+ var _iterator4 = _createForOfIteratorHelper(list),
621
+ _step4;
566
622
  try {
567
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
568
- var tmodel = _step2.value;
623
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
624
+ var tmodel = _step4.value;
569
625
  var batch = tmodel.pausedBatch;
570
626
  if (!batch || !tmodel.hasDom()) {
571
627
  continue;
@@ -577,9 +633,9 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
577
633
  }
578
634
  }
579
635
  } catch (err) {
580
- _iterator2.e(err);
636
+ _iterator4.e(err);
581
637
  } finally {
582
- _iterator2.f();
638
+ _iterator4.f();
583
639
  }
584
640
  });
585
641
  });
@@ -591,20 +647,20 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
591
647
  if ((externalEventMap === null || externalEventMap === void 0 ? void 0 : externalEventMap.size) > 0) {
592
648
  var eventTargets = [];
593
649
  var eventMap = _TargetData.TargetData.allEventMap;
594
- var _iterator3 = _createForOfIteratorHelper(externalEventMap),
595
- _step3;
650
+ var _iterator5 = _createForOfIteratorHelper(externalEventMap),
651
+ _step5;
596
652
  try {
597
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
598
- var _step3$value = _slicedToArray(_step3.value, 1),
599
- targetName = _step3$value[0];
653
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
654
+ var _step5$value = _slicedToArray(_step5.value, 1),
655
+ targetName = _step5$value[0];
600
656
  if (eventMap[targetName](tmodel)) {
601
657
  eventTargets.push(tmodel.allTargetMap[targetName]);
602
658
  }
603
659
  }
604
660
  } catch (err) {
605
- _iterator3.e(err);
661
+ _iterator5.e(err);
606
662
  } finally {
607
- _iterator3.f();
663
+ _iterator5.f();
608
664
  }
609
665
  this.runEventTargets(tmodel, eventTargets);
610
666
  }
@@ -616,20 +672,20 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
616
672
  var eventMap = _TargetData.TargetData.internalEventMap;
617
673
  var internalEventMap = tmodel.internalEventMap;
618
674
  if ((internalEventMap === null || internalEventMap === void 0 ? void 0 : internalEventMap.size) > 0) {
619
- var _iterator4 = _createForOfIteratorHelper(internalEventMap),
620
- _step4;
675
+ var _iterator6 = _createForOfIteratorHelper(internalEventMap),
676
+ _step6;
621
677
  try {
622
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
623
- var _step4$value = _slicedToArray(_step4.value, 1),
624
- targetName = _step4$value[0];
678
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
679
+ var _step6$value = _slicedToArray(_step6.value, 1),
680
+ targetName = _step6$value[0];
625
681
  if (eventMap[targetName](tmodel)) {
626
682
  eventTargets.push(tmodel.allTargetMap[targetName]);
627
683
  }
628
684
  }
629
685
  } catch (err) {
630
- _iterator4.e(err);
686
+ _iterator6.e(err);
631
687
  } finally {
632
- _iterator4.f();
688
+ _iterator6.f();
633
689
  }
634
690
  }
635
691
  this.runEventTargets(tmodel, eventTargets);
@@ -162,7 +162,7 @@ var PageManager = exports.PageManager = /*#__PURE__*/function () {
162
162
  value: function onPageClose() {
163
163
  _App.tApp.resizeLastUpdate = _TUtil.TUtil.now();
164
164
  (0, _App.getEvents)().resizeRoot();
165
- _App.tApp.manager.getVisibles().forEach(function (tmodel) {
165
+ _App.tApp.manager.getAvailableDoms().forEach(function (tmodel) {
166
166
  (0, _App.getLocationManager)().runEventTargets(tmodel, ['onPageClose']);
167
167
  });
168
168
  }
@@ -44,7 +44,7 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
44
44
  reasyncStyle: [],
45
45
  reattach: [],
46
46
  relocation: [],
47
- invisibleDom: [],
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.addToInvisibleDom(tmodel);
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 keepDom = this.shouldPreserveDom(tmodel);
110
- if (keepDom) {
111
- this.visibleOidMap[tmodel.oid] = tmodel;
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 && !keepDom) {
115
- this.addToInvisibleDom(tmodel);
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.addToRecursiveInvisibleDom(tmodel);
126
+ _this.addToRecursiveDeletedDom(tmodel);
119
127
  }
120
128
  });
121
129
  }
122
130
  }
123
- if (visible || tmodel.isActivated() || keepDom) {
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() || keepDom) {
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() || keepDom) {
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.addToInvisibleDom(tmodel);
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.invisibleDom.length > 0 ? 5 : this.lists.restyle.length > 0 ? 10 : -1;
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.isVisible() && _TUtil.TUtil.isDefined(tmodel.targets.isVisible)) {
202
+ if (!tmodel.isIncluded()) {
195
203
  return false;
196
204
  }
197
- var parent = tmodel.parent;
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: "addToRecursiveInvisibleDom",
229
- value: function addToRecursiveInvisibleDom(tmodel) {
236
+ key: "addToRecursiveDeletedDom",
237
+ value: function addToRecursiveDeletedDom(tmodel) {
230
238
  var _this2 = this;
231
239
  delete this.visibleOidMap[tmodel.oid];
232
- if (!this.lists.invisibleDom.includes(tmodel)) {
240
+ delete this.preservedDomMap[tmodel.oid];
241
+ if (!this.lists.deletedDom.includes(tmodel)) {
233
242
  if (tmodel.hasDom()) {
234
- this.lists.invisibleDom.push(tmodel);
243
+ this.lists.deletedDom.push(tmodel);
235
244
  }
236
245
  tmodel.getChildren().forEach(function (tmodel) {
237
246
  if (!tmodel.managesOwnScroll()) {
238
- _this2.addToRecursiveInvisibleDom(tmodel);
247
+ _this2.addToRecursiveDeletedDom(tmodel);
239
248
  }
240
249
  });
241
250
  }
242
251
  }
243
252
  }, {
244
- key: "addToInvisibleDom",
245
- value: function addToInvisibleDom(tmodel) {
253
+ key: "addToDeletedDom",
254
+ value: function addToDeletedDom(tmodel) {
246
255
  delete this.visibleOidMap[tmodel.oid];
247
- if (!this.lists.invisibleDom.includes(tmodel)) {
248
- this.lists.invisibleDom.push(tmodel);
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.invisibleDom),
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.invisibleDom.length = 0;
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) {
@@ -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)().isLoadingComplete(tmodel, key)) {
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);