targetj 1.0.231 → 1.0.232

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.
@@ -7,11 +7,11 @@ exports.TargetUtil = void 0;
7
7
  var _App = require("./App.js");
8
8
  var _TUtil = require("./TUtil.js");
9
9
  var _TargetData = require("./TargetData.js");
10
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
11
10
  function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
12
11
  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."); }
13
12
  function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
14
13
  function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
14
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
15
15
  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; } } }; }
16
16
  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; } }
17
17
  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; }
@@ -419,12 +419,9 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
419
419
  return tmodel.oid + "." + targetName + ": " + tmodel.getUpdatingImperativeTargets(targetName);
420
420
  }
421
421
  if (tmodel.isTargetCompleteDeep(targetName) !== true) {
422
- var _tmodel$activeChildre, _tmodel$activeChildre2;
423
- var activeChildrenList = _toConsumableArray((_tmodel$activeChildre = (_tmodel$activeChildre2 = tmodel.activeChildrenMap) === null || _tmodel$activeChildre2 === void 0 ? void 0 : _tmodel$activeChildre2.values()) !== null && _tmodel$activeChildre !== void 0 ? _tmodel$activeChildre : []);
424
- return tmodel.oid + "." + targetName + " ==> " + tmodel.getTargetStatus(targetName) + ", " + tmodel.isTargetCompleteDeep(targetName) + ":: " + activeChildrenList.map(function (t) {
425
- return t.oid + ':' + t.hasAnyUpdates();
426
- }) + ", " + _toConsumableArray(TargetUtil.getUpdatingChildren(tmodel, targetName).keys());
427
- //return false;
422
+ //const activeChildrenList = [ ...(tmodel.activeChildrenMap?.values() ?? []) ];
423
+ //return tmodel.oid + "." + targetName + " ==> " + tmodel.getTargetStatus(targetName) + ", " + tmodel.isTargetCompleteDeep(targetName) + ":: " + activeChildrenList.map(t => t.oid + ':' + t.hasAnyUpdates()) + ", " + [ ...TargetUtil.getUpdatingChildren(tmodel, targetName).keys() ];
424
+ return false;
428
425
  }
429
426
  }
430
427
  return true;
@@ -451,13 +448,13 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
451
448
  if (!tmodel.isTargetComplete(key) && !tmodel.isTargetDone(key)) {
452
449
  return 'not done';
453
450
  }
454
- if (((_target$childAction = target.childAction) === null || _target$childAction === void 0 ? void 0 : _target$childAction.length) > 0 && TargetUtil.getUpdatingChildren(tmodel, key).size > 0) {
451
+ if (((_target$childAction = target.childAction) === null || _target$childAction === void 0 ? void 0 : _target$childAction.length) > 0 && TargetUtil.getUpdatingChildren(tmodel, key, target.waitForChildren).size > 0) {
455
452
  return 'updating children';
456
453
  }
457
- if (((_target$childAction2 = target.childAction) === null || _target$childAction2 === void 0 ? void 0 : _target$childAction2.length) > 0 && TargetUtil.getActiveChildren(tmodel).size > 0) {
454
+ if (((_target$childAction2 = target.childAction) === null || _target$childAction2 === void 0 ? void 0 : _target$childAction2.length) > 0 && TargetUtil.getActiveChildren(tmodel, target.waitForChildren).size > 0) {
458
455
  return 'active children';
459
456
  }
460
- if (((_target$childAction3 = target.childAction) === null || _target$childAction3 === void 0 ? void 0 : _target$childAction3.length) > 0 && TargetUtil.areTargetChildrenComplete(target.childAction) !== true) {
457
+ if (((_target$childAction3 = target.childAction) === null || _target$childAction3 === void 0 ? void 0 : _target$childAction3.length) > 0 && TargetUtil.areTargetChildrenComplete(target.childAction, target.waitForChildren) !== true) {
461
458
  return 'incomplete children';
462
459
  }
463
460
  if (target.fetchAction && !(0, _App.getLoader)().isLoadingSuccessful(tmodel, key)) {
@@ -469,6 +466,7 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
469
466
  }, {
470
467
  key: "areTargetChildrenComplete",
471
468
  value: function areTargetChildrenComplete(children) {
469
+ var waitForChildren = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'all';
472
470
  if (!children) {
473
471
  return true;
474
472
  }
@@ -477,14 +475,14 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
477
475
  try {
478
476
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
479
477
  var child = _step2.value;
480
- if (!child.isVisible() && child.visibilityStatus) {
478
+ if (TargetUtil.shouldIgnoreChildForCompletion(child, waitForChildren)) {
481
479
  continue;
482
480
  }
483
481
  if (_App.App.tmodelIdMap[child.oid] && !TargetUtil.isTModelComplete(child)) {
484
482
  return false;
485
483
  }
486
484
  if (child.hasChildren()) {
487
- if (!TargetUtil.areTargetChildrenComplete(child.getChildren())) {
485
+ if (!TargetUtil.areTargetChildrenComplete(child.getChildren(), waitForChildren)) {
488
486
  return false;
489
487
  }
490
488
  }
@@ -500,12 +498,14 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
500
498
  key: "getUpdatingChildren",
501
499
  value: function getUpdatingChildren(tmodel, originalTargetName) {
502
500
  var _tmodel$updatingChild, _tmodel$updatingChild2, _tmodel$animatingChil, _tmodel$animatingChil2;
501
+ var waitForChildren = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "all";
503
502
  var childrenMap = new Map();
504
503
  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 : []));
505
- children.filter(function (child) {
506
- return child.isVisible() || !child.visibilityStatus;
507
- }).forEach(function (child) {
504
+ children.forEach(function (child) {
508
505
  var _child$updatingTarget;
506
+ if (TargetUtil.shouldIgnoreChildForCompletion(child, waitForChildren)) {
507
+ return;
508
+ }
509
509
  var updatingList = [].concat(_toConsumableArray((_child$updatingTarget = child.updatingTargetList) !== null && _child$updatingTarget !== void 0 ? _child$updatingTarget : []), _toConsumableArray(child.animatingMap ? _toConsumableArray(child.animatingMap.keys()) : []));
510
510
  var _iterator3 = _createForOfIteratorHelper(updatingList),
511
511
  _step3;
@@ -543,18 +543,31 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
543
543
  }, {
544
544
  key: "getActiveChildren",
545
545
  value: function getActiveChildren(tmodel) {
546
- var _tmodel$activeChildre3, _tmodel$activeChildre4;
546
+ var _tmodel$activeChildre, _tmodel$activeChildre2;
547
+ var waitForChildren = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'all';
547
548
  var childrenMap = new Map();
548
- var children = _toConsumableArray((_tmodel$activeChildre3 = (_tmodel$activeChildre4 = tmodel.activeChildrenMap) === null || _tmodel$activeChildre4 === void 0 ? void 0 : _tmodel$activeChildre4.values()) !== null && _tmodel$activeChildre3 !== void 0 ? _tmodel$activeChildre3 : []);
549
- children.filter(function (child) {
550
- return child.isVisible() || !child.visibilityStatus;
551
- }).forEach(function (child) {
549
+ 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 : []);
550
+ children.forEach(function (child) {
551
+ if (TargetUtil.shouldIgnoreChildForCompletion(child, waitForChildren)) {
552
+ return;
553
+ }
552
554
  if (child.activeTargetList.length) {
553
555
  childrenMap.set(child.oid, child);
554
556
  }
555
557
  });
556
558
  return childrenMap;
557
559
  }
560
+ }, {
561
+ key: "shouldIgnoreChildForCompletion",
562
+ value: function shouldIgnoreChildForCompletion(child, waitForChildren) {
563
+ if (waitForChildren === "none") {
564
+ return true;
565
+ }
566
+ if (waitForChildren === "visible") {
567
+ return child.visibilityStatus && !child.isVisible();
568
+ }
569
+ return false;
570
+ }
558
571
  }, {
559
572
  key: "activateSingleTarget",
560
573
  value: function activateSingleTarget(tmodel, targetName) {