targetj 1.0.237 → 1.0.238
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.
- package/build/BaseModel.js +3 -3
- package/build/TargetUtil.js +54 -75
- package/dist/targetjs.js +1 -1
- package/dist/targetjs.js.gz +0 -0
- package/package.json +1 -1
package/build/BaseModel.js
CHANGED
|
@@ -1175,9 +1175,9 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
|
|
|
1175
1175
|
actualOptions = value;
|
|
1176
1176
|
}
|
|
1177
1177
|
if (this.canTargetBeActivated(key)) {
|
|
1178
|
-
var
|
|
1179
|
-
if (
|
|
1180
|
-
_TargetUtil.TargetUtil.resetTargetState(this, key);
|
|
1178
|
+
var resetOptions = _TargetUtil.TargetUtil.getResetOptions(actualOptions);
|
|
1179
|
+
if (resetOptions.shouldReset) {
|
|
1180
|
+
_TargetUtil.TargetUtil.resetTargetState(this, key, resetOptions);
|
|
1181
1181
|
}
|
|
1182
1182
|
if (_TUtil.TUtil.isDefined(actualValue)) {
|
|
1183
1183
|
this.val("___".concat(key), actualValue);
|
package/build/TargetUtil.js
CHANGED
|
@@ -689,44 +689,33 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
689
689
|
}, {
|
|
690
690
|
key: "resetTargetState",
|
|
691
691
|
value: function resetTargetState(tmodel, targetName) {
|
|
692
|
-
var
|
|
692
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
693
|
+
var visited = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : new Set();
|
|
693
694
|
if (!tmodel || !targetName) {
|
|
694
695
|
return;
|
|
695
696
|
}
|
|
696
697
|
TargetUtil.resetSingleTargetState(tmodel, targetName);
|
|
698
|
+
TargetUtil.resetTargetChildActions(tmodel, targetName, options, visited);
|
|
697
699
|
var target = tmodel.targets[targetName];
|
|
698
700
|
var nextTarget = target === null || target === void 0 ? void 0 : target.activateNextTarget;
|
|
699
701
|
var nextTargetDef = tmodel.targets[nextTarget];
|
|
700
702
|
if (!nextTargetDef || !nextTarget.endsWith('$') && nextTargetDef.active === false) {
|
|
701
703
|
return;
|
|
702
704
|
}
|
|
703
|
-
TargetUtil.resetTargetsBetween(tmodel, targetName, nextTarget, visited);
|
|
704
|
-
TargetUtil.resetTargetPipelineState(tmodel, nextTarget, visited);
|
|
705
|
+
TargetUtil.resetTargetsBetween(tmodel, targetName, nextTarget, options, visited);
|
|
706
|
+
TargetUtil.resetTargetPipelineState(tmodel, nextTarget, options, visited);
|
|
705
707
|
}
|
|
706
708
|
}, {
|
|
707
709
|
key: "resetTargetPipelineState",
|
|
708
710
|
value: function resetTargetPipelineState(tmodel, targetName) {
|
|
709
|
-
var
|
|
710
|
-
var visited = arguments.length >
|
|
711
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
712
|
+
var visited = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : new Set();
|
|
711
713
|
if (!tmodel || !targetName) {
|
|
712
714
|
return;
|
|
713
715
|
}
|
|
714
|
-
var target = tmodel.targets[targetName];
|
|
715
716
|
TargetUtil.resetSingleTargetState(tmodel, targetName);
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
if (child) {
|
|
719
|
-
TargetUtil.resetTargetChildState(child, visited);
|
|
720
|
-
}
|
|
721
|
-
});
|
|
722
|
-
}
|
|
723
|
-
if ((_target$addChildActio = target.addChildAction) !== null && _target$addChildActio !== void 0 && _target$addChildActio.length) {
|
|
724
|
-
target.addChildAction.forEach(function (child) {
|
|
725
|
-
if (child) {
|
|
726
|
-
TargetUtil.resetTargetChildState(child, visited);
|
|
727
|
-
}
|
|
728
|
-
});
|
|
729
|
-
}
|
|
717
|
+
TargetUtil.resetTargetChildActions(tmodel, targetName, options, visited);
|
|
718
|
+
var target = tmodel.targets[targetName];
|
|
730
719
|
var nextTarget = target === null || target === void 0 ? void 0 : target.activateNextTarget;
|
|
731
720
|
if (!nextTarget) {
|
|
732
721
|
return;
|
|
@@ -735,12 +724,14 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
735
724
|
if (!nextTargetDef || !nextTarget.endsWith('$') && nextTargetDef.active === false) {
|
|
736
725
|
return;
|
|
737
726
|
}
|
|
738
|
-
TargetUtil.resetTargetsBetween(tmodel, targetName, nextTarget, visited);
|
|
739
|
-
TargetUtil.resetTargetPipelineState(tmodel, nextTarget, visited);
|
|
727
|
+
TargetUtil.resetTargetsBetween(tmodel, targetName, nextTarget, options, visited);
|
|
728
|
+
TargetUtil.resetTargetPipelineState(tmodel, nextTarget, options, visited);
|
|
740
729
|
}
|
|
741
730
|
}, {
|
|
742
731
|
key: "resetTargetsBetween",
|
|
743
|
-
value: function resetTargetsBetween(tmodel, fromTarget, toTarget
|
|
732
|
+
value: function resetTargetsBetween(tmodel, fromTarget, toTarget) {
|
|
733
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
734
|
+
var visited = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : new Set();
|
|
744
735
|
var names = tmodel.functionTargetNames;
|
|
745
736
|
var fromIndex = names.indexOf(fromTarget);
|
|
746
737
|
var toIndex = names.indexOf(toTarget);
|
|
@@ -748,29 +739,16 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
748
739
|
return;
|
|
749
740
|
}
|
|
750
741
|
for (var i = fromIndex + 1; i < toIndex; i++) {
|
|
751
|
-
var _target$childAction5, _target$addChildActio2;
|
|
752
742
|
var key = names[i];
|
|
753
743
|
TargetUtil.resetSingleTargetState(tmodel, key);
|
|
754
|
-
|
|
755
|
-
if (target !== null && target !== void 0 && (_target$childAction5 = target.childAction) !== null && _target$childAction5 !== void 0 && _target$childAction5.length) {
|
|
756
|
-
target.childAction.forEach(function (child) {
|
|
757
|
-
if (child) {
|
|
758
|
-
TargetUtil.resetTargetChildState(child, visited);
|
|
759
|
-
}
|
|
760
|
-
});
|
|
761
|
-
}
|
|
762
|
-
if (target !== null && target !== void 0 && (_target$addChildActio2 = target.addChildAction) !== null && _target$addChildActio2 !== void 0 && _target$addChildActio2.length) {
|
|
763
|
-
target.addChildAction.forEach(function (child) {
|
|
764
|
-
if (child) {
|
|
765
|
-
TargetUtil.resetTargetChildState(child, visited);
|
|
766
|
-
}
|
|
767
|
-
});
|
|
768
|
-
}
|
|
744
|
+
TargetUtil.resetTargetChildActions(tmodel, key, options, visited);
|
|
769
745
|
}
|
|
770
746
|
}
|
|
771
747
|
}, {
|
|
772
748
|
key: "resetTargetChildState",
|
|
773
|
-
value: function resetTargetChildState(tmodel
|
|
749
|
+
value: function resetTargetChildState(tmodel) {
|
|
750
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
751
|
+
var visited = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Set();
|
|
774
752
|
var sig = "".concat(tmodel.oid);
|
|
775
753
|
if (visited.has(sig)) {
|
|
776
754
|
return;
|
|
@@ -778,25 +756,38 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
778
756
|
visited.add(sig);
|
|
779
757
|
var names = Object.keys(tmodel.targetValues);
|
|
780
758
|
for (var i = 0; i < names.length; i++) {
|
|
781
|
-
var _target$childAction6, _target$addChildActio3;
|
|
782
759
|
var key = names[i];
|
|
783
|
-
var target = tmodel.targets[key];
|
|
784
760
|
TargetUtil.resetSingleTargetState(tmodel, key);
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
761
|
+
TargetUtil.resetTargetChildActions(tmodel, key, options, visited);
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
}, {
|
|
765
|
+
key: "resetTargetChildActions",
|
|
766
|
+
value: function resetTargetChildActions(tmodel, key) {
|
|
767
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
768
|
+
var visited = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : new Set();
|
|
769
|
+
var target = tmodel.targets[key];
|
|
770
|
+
if (!target) {
|
|
771
|
+
return;
|
|
772
|
+
}
|
|
773
|
+
var childActions = target.childAction ? _toConsumableArray(target.childAction) : [];
|
|
774
|
+
var addChildActions = target.addChildAction ? _toConsumableArray(target.addChildAction) : [];
|
|
775
|
+
childActions.forEach(function (child) {
|
|
776
|
+
if (child) {
|
|
777
|
+
TargetUtil.resetTargetChildState(child, options, visited);
|
|
792
778
|
}
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
779
|
+
});
|
|
780
|
+
addChildActions.forEach(function (child) {
|
|
781
|
+
if (child) {
|
|
782
|
+
TargetUtil.resetTargetChildState(child, options, visited);
|
|
783
|
+
}
|
|
784
|
+
});
|
|
785
|
+
if (options.clearChildActions) {
|
|
786
|
+
if (Array.isArray(target.childAction)) {
|
|
787
|
+
target.childAction.length = 0;
|
|
788
|
+
}
|
|
789
|
+
if (Array.isArray(target.addChildAction)) {
|
|
790
|
+
target.addChildAction.length = 0;
|
|
800
791
|
}
|
|
801
792
|
}
|
|
802
793
|
}
|
|
@@ -819,25 +810,13 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
819
810
|
TargetUtil.clearPendingTarget(tmodel, key);
|
|
820
811
|
}
|
|
821
812
|
}, {
|
|
822
|
-
key: "
|
|
823
|
-
value: function
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
var target = _Object$values[_i2];
|
|
830
|
-
if ((_target$childAction7 = target.childAction) !== null && _target$childAction7 !== void 0 && _target$childAction7.length) {
|
|
831
|
-
target.childAction = target.childAction.filter(function (c) {
|
|
832
|
-
return c !== child;
|
|
833
|
-
});
|
|
834
|
-
}
|
|
835
|
-
if ((_target$addChildActio4 = target.addChildAction) !== null && _target$addChildActio4 !== void 0 && _target$addChildActio4.length) {
|
|
836
|
-
target.addChildAction = target.addChildAction.filter(function (c) {
|
|
837
|
-
return c !== child;
|
|
838
|
-
});
|
|
839
|
-
}
|
|
840
|
-
}
|
|
813
|
+
key: "getResetOptions",
|
|
814
|
+
value: function getResetOptions(options) {
|
|
815
|
+
var reset = options === null || options === void 0 ? void 0 : options.reset;
|
|
816
|
+
return {
|
|
817
|
+
shouldReset: reset === true || reset === 'pipeline' || reset === 'tree' || reset === 'all',
|
|
818
|
+
clearChildActions: reset === 'tree' || reset === 'all'
|
|
819
|
+
};
|
|
841
820
|
}
|
|
842
821
|
}]);
|
|
843
822
|
}();
|