targetj 1.0.234 → 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.
@@ -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.isTargetCompleteDeep(key) === true;
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.isTargetCompleteDeep(targetName) !== true) {
441
- //const activeChildrenList = [ ...(tmodel.activeChildrenMap?.values() ?? []) ];
442
- //return tmodel.oid + "." + targetName + " ==> " + tmodel.getTargetStatus(targetName) + ", " + tmodel.isTargetCompleteDeep(targetName) + ":: " + activeChildrenList.map(t => t.oid + ':' + t.hasAnyUpdates()) + ", " + [ ...TargetUtil.getUpdatingChildren(tmodel, targetName).keys() ];
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: "isTargetCompleteDeep",
450
- value: function isTargetCompleteDeep(tmodel, key) {
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.waitForChildren).size > 0) {
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.waitForChildren).size > 0) {
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.waitForChildren) !== true) {
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 waitForChildren = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'all';
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, waitForChildren)) {
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(), waitForChildren)) {
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 waitForChildren = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "all";
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, waitForChildren)) {
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 waitForChildren = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'all';
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, waitForChildren)) {
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, waitForChildren) {
582
- if (waitForChildren === "none") {
581
+ value: function shouldIgnoreChildForCompletion(child, completionScope) {
582
+ if (completionScope === "none") {
583
583
  return true;
584
584
  }
585
- if (waitForChildren === "visible") {
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$childAction5, _target$addChildActio2;
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$childAction5 = target.childAction) !== null && _target$childAction5 !== void 0 && _target$childAction5.length) {
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$addChildActio2 = target.addChildAction) !== null && _target$addChildActio2 !== void 0 && _target$addChildActio2.length) {
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 = 'complete';
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
  }();