targetj 1.0.230 → 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; }
@@ -123,7 +123,10 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
123
123
  var originalMethod = target[method];
124
124
  var shouldWrap = method === 'value' || typeof originalMethod === 'function' && _TargetData.TargetData.isLifeCycleMethod(method);
125
125
  if (shouldWrap) {
126
- target[method] = function () {
126
+ if (originalMethod.__isBoundTargetMethod) {
127
+ return;
128
+ }
129
+ var wrappedMethod = function wrappedMethod() {
127
130
  var _getPrevUpdateTime;
128
131
  if (!_TargetData.TargetData.lifecycleCoreSet.has(method)) {
129
132
  TargetUtil.currentTargetName = key;
@@ -137,6 +140,8 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
137
140
  lastPrevUpdateTime = (_getPrevUpdateTime = getPrevUpdateTime()) !== null && _getPrevUpdateTime !== void 0 ? _getPrevUpdateTime : lastPrevUpdateTime;
138
141
  return result;
139
142
  };
143
+ wrappedMethod.__isBoundTargetMethod = true;
144
+ target[method] = wrappedMethod;
140
145
  }
141
146
  });
142
147
  }
@@ -414,12 +419,9 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
414
419
  return tmodel.oid + "." + targetName + ": " + tmodel.getUpdatingImperativeTargets(targetName);
415
420
  }
416
421
  if (tmodel.isTargetCompleteDeep(targetName) !== true) {
417
- var _tmodel$activeChildre, _tmodel$activeChildre2;
418
- 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 : []);
419
- return tmodel.oid + "." + targetName + " ==> " + tmodel.getTargetStatus(targetName) + ", " + tmodel.isTargetCompleteDeep(targetName) + ":: " + activeChildrenList.map(function (t) {
420
- return t.oid + ':' + t.hasAnyUpdates();
421
- }) + ", " + _toConsumableArray(TargetUtil.getUpdatingChildren(tmodel, targetName).keys());
422
- //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;
423
425
  }
424
426
  }
425
427
  return true;
@@ -446,13 +448,13 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
446
448
  if (!tmodel.isTargetComplete(key) && !tmodel.isTargetDone(key)) {
447
449
  return 'not done';
448
450
  }
449
- 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) {
450
452
  return 'updating children';
451
453
  }
452
- 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) {
453
455
  return 'active children';
454
456
  }
455
- 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) {
456
458
  return 'incomplete children';
457
459
  }
458
460
  if (target.fetchAction && !(0, _App.getLoader)().isLoadingSuccessful(tmodel, key)) {
@@ -464,6 +466,7 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
464
466
  }, {
465
467
  key: "areTargetChildrenComplete",
466
468
  value: function areTargetChildrenComplete(children) {
469
+ var waitForChildren = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'all';
467
470
  if (!children) {
468
471
  return true;
469
472
  }
@@ -472,14 +475,14 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
472
475
  try {
473
476
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
474
477
  var child = _step2.value;
475
- if (!child.isVisible() && child.visibilityStatus) {
478
+ if (TargetUtil.shouldIgnoreChildForCompletion(child, waitForChildren)) {
476
479
  continue;
477
480
  }
478
481
  if (_App.App.tmodelIdMap[child.oid] && !TargetUtil.isTModelComplete(child)) {
479
482
  return false;
480
483
  }
481
484
  if (child.hasChildren()) {
482
- if (!TargetUtil.areTargetChildrenComplete(child.getChildren())) {
485
+ if (!TargetUtil.areTargetChildrenComplete(child.getChildren(), waitForChildren)) {
483
486
  return false;
484
487
  }
485
488
  }
@@ -495,12 +498,14 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
495
498
  key: "getUpdatingChildren",
496
499
  value: function getUpdatingChildren(tmodel, originalTargetName) {
497
500
  var _tmodel$updatingChild, _tmodel$updatingChild2, _tmodel$animatingChil, _tmodel$animatingChil2;
501
+ var waitForChildren = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "all";
498
502
  var childrenMap = new Map();
499
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 : []));
500
- children.filter(function (child) {
501
- return child.isVisible() || !child.visibilityStatus;
502
- }).forEach(function (child) {
504
+ children.forEach(function (child) {
503
505
  var _child$updatingTarget;
506
+ if (TargetUtil.shouldIgnoreChildForCompletion(child, waitForChildren)) {
507
+ return;
508
+ }
504
509
  var updatingList = [].concat(_toConsumableArray((_child$updatingTarget = child.updatingTargetList) !== null && _child$updatingTarget !== void 0 ? _child$updatingTarget : []), _toConsumableArray(child.animatingMap ? _toConsumableArray(child.animatingMap.keys()) : []));
505
510
  var _iterator3 = _createForOfIteratorHelper(updatingList),
506
511
  _step3;
@@ -538,18 +543,31 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
538
543
  }, {
539
544
  key: "getActiveChildren",
540
545
  value: function getActiveChildren(tmodel) {
541
- var _tmodel$activeChildre3, _tmodel$activeChildre4;
546
+ var _tmodel$activeChildre, _tmodel$activeChildre2;
547
+ var waitForChildren = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'all';
542
548
  var childrenMap = new Map();
543
- 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 : []);
544
- children.filter(function (child) {
545
- return child.isVisible() || !child.visibilityStatus;
546
- }).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
+ }
547
554
  if (child.activeTargetList.length) {
548
555
  childrenMap.set(child.oid, child);
549
556
  }
550
557
  });
551
558
  return childrenMap;
552
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
+ }
553
571
  }, {
554
572
  key: "activateSingleTarget",
555
573
  value: function activateSingleTarget(tmodel, targetName) {