targetj 1.0.226 → 1.0.228

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.
@@ -1137,11 +1137,20 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
1137
1137
  }
1138
1138
  }, {
1139
1139
  key: "activateTarget",
1140
- value: function activateTarget(key, value) {
1140
+ value: function activateTarget(key, value, options) {
1141
+ var actualValue = value;
1142
+ var actualOptions = options;
1143
+ if (value !== null && value !== void 0 && value.reset && Object.keys(value).length === 1 && !options) {
1144
+ actualValue = undefined;
1145
+ actualOptions = value;
1146
+ }
1141
1147
  if (this.canTargetBeActivated(key)) {
1142
- var _target$childAction, _target$addChildActio;
1143
- if (_TUtil.TUtil.isDefined(value)) {
1144
- this.val("___".concat(key), value);
1148
+ var _actualOptions, _target$childAction, _target$addChildActio;
1149
+ if ((_actualOptions = actualOptions) !== null && _actualOptions !== void 0 && _actualOptions.reset) {
1150
+ _TargetUtil.TargetUtil.resetTargetPipelineState(this, key);
1151
+ }
1152
+ if (_TUtil.TUtil.isDefined(actualValue)) {
1153
+ this.val("___".concat(key), actualValue);
1145
1154
  }
1146
1155
  if (this.isVisible()) {
1147
1156
  this.markLayoutDirty(key);
@@ -36,6 +36,7 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
36
36
  this.tmodelKeyMap = {};
37
37
  this.fetchingAPIMap = {};
38
38
  this.fetchingImageMap = {};
39
+ this.fetchSeq = 0;
39
40
  }
40
41
  return _createClass(LoadingManager, [{
41
42
  key: "clear",
@@ -43,6 +44,7 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
43
44
  this.tmodelKeyMap = {};
44
45
  this.fetchingAPIMap = {};
45
46
  this.fetchingImageMap = {};
47
+ this.fetchSeq = 0;
46
48
  }
47
49
  }, {
48
50
  key: "fetchCommon",
@@ -117,7 +119,8 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
117
119
  }, {
118
120
  key: "getFetchKey",
119
121
  value: function getFetchKey(tmodel, url, query) {
120
- return query ? "".concat(tmodel.oid, "_").concat(url, "_").concat(tmodel.getTargetCycle(tmodel.key), "_").concat(JSON.stringify(query)) : "".concat(tmodel.oid, "_").concat(url, "_").concat(tmodel.getTargetCycle(tmodel.key));
122
+ var base = query ? "".concat(tmodel.oid, "_").concat(url, "_").concat(tmodel.getTargetCycle(tmodel.key), "_").concat(JSON.stringify(query)) : "".concat(tmodel.oid, "_").concat(url, "_").concat(tmodel.getTargetCycle(tmodel.key));
123
+ return "".concat(base, "_").concat(++this.fetchSeq);
121
124
  }
122
125
  }, {
123
126
  key: "getTModelKey",
@@ -217,6 +217,7 @@ var TModelUtil = exports.TModelUtil = /*#__PURE__*/function () {
217
217
  if (width > 0 || width === 0 && child.lastVal('width') > 0) {
218
218
  child.addToStyleTargetList('width');
219
219
  }
220
+ child.markLayoutDirty('width');
220
221
  (0, _App.getRunScheduler)().schedule(15, 'resize');
221
222
  }
222
223
  }
@@ -239,6 +240,7 @@ var TModelUtil = exports.TModelUtil = /*#__PURE__*/function () {
239
240
  if (height > 0 || height === 0 && child.lastVal('height') > 0) {
240
241
  child.addToStyleTargetList('height');
241
242
  }
243
+ child.markLayoutDirty('height');
242
244
  (0, _App.getRunScheduler)().schedule(15, 'resize');
243
245
  }
244
246
  }
package/build/TUtil.js CHANGED
@@ -7,6 +7,7 @@ exports.TUtil = void 0;
7
7
  var _App = require("./App.js");
8
8
  var _TargetUtil = require("./TargetUtil.js");
9
9
  var _TargetData = require("./TargetData.js");
10
+ var _TargetParser = require("./TargetParser");
10
11
  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; } } }; }
11
12
  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); }
12
13
  function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
@@ -304,6 +305,9 @@ var TUtil = exports.TUtil = /*#__PURE__*/function () {
304
305
  }, {
305
306
  key: "runTargetValue",
306
307
  value: function runTargetValue(tmodel, target, key, cycle, lastValue) {
308
+ if (_TargetParser.TargetParser.isIntervalTarget(target) && cycle === 1) {
309
+ return;
310
+ }
307
311
  var cleanKey = _TargetUtil.TargetUtil.getTargetName(key);
308
312
  var isExternalEvent = _TargetData.TargetData.allEventMap[cleanKey];
309
313
  if (isExternalEvent) {
@@ -161,7 +161,7 @@ var TargetParser = exports.TargetParser = /*#__PURE__*/function () {
161
161
  if (target.isInterval && _TUtil.TUtil.isDefined(target.interval)) {
162
162
  return true;
163
163
  }
164
- return _TUtil.TUtil.isDefined(target.interval) && !_TUtil.TUtil.isDefined(target.steps) && !_TUtil.TUtil.isDefined(target.cycles) && !_TUtil.TUtil.isDefined(target.value);
164
+ return _TUtil.TUtil.isDefined(target.interval) && !_TUtil.TUtil.isDefined(target.steps) && !_TUtil.TUtil.isDefined(target.cycles);
165
165
  }
166
166
  }, {
167
167
  key: "isPrimitiveArray",
@@ -642,5 +642,88 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
642
642
  originalTargetName: originalTargetName
643
643
  };
644
644
  }
645
+ }, {
646
+ key: "resetTargetPipelineState",
647
+ value: function resetTargetPipelineState(tmodel, targetName) {
648
+ var _target$childAction4, _target$addChildActio;
649
+ var visited = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Set();
650
+ if (!tmodel || !targetName) {
651
+ return;
652
+ }
653
+ var target = tmodel.targets[targetName];
654
+ TargetUtil.resetSingleTargetState(tmodel, targetName);
655
+ if ((_target$childAction4 = target.childAction) !== null && _target$childAction4 !== void 0 && _target$childAction4.length) {
656
+ target.childAction.forEach(function (child) {
657
+ if (child) {
658
+ TargetUtil.resetTargetChildState(child, visited);
659
+ }
660
+ });
661
+ target.childAction = [];
662
+ }
663
+ if ((_target$addChildActio = target.addChildAction) !== null && _target$addChildActio !== void 0 && _target$addChildActio.length) {
664
+ target.addChildAction.forEach(function (child) {
665
+ if (child) {
666
+ TargetUtil.resetTargetChildState(child, visited);
667
+ }
668
+ });
669
+ target.addChildAction = [];
670
+ }
671
+ var nextTarget = target === null || target === void 0 ? void 0 : target.activateNextTarget;
672
+ if (!nextTarget) {
673
+ return;
674
+ }
675
+ var nextTargetDef = tmodel.targets[nextTarget];
676
+ if (!nextTargetDef || !nextTarget.endsWith('$') && nextTargetDef.active === false) {
677
+ return;
678
+ }
679
+ TargetUtil.resetTargetPipelineState(tmodel, nextTarget, visited);
680
+ }
681
+ }, {
682
+ key: "resetTargetChildState",
683
+ value: function resetTargetChildState(tmodel, visited) {
684
+ var sig = "".concat(tmodel.oid);
685
+ if (visited.has(sig)) {
686
+ return;
687
+ }
688
+ visited.add(sig);
689
+ var names = Object.keys(tmodel.targetValues);
690
+ for (var i = 0; i < names.length; i++) {
691
+ var _target$childAction5, _target$addChildActio2;
692
+ var key = names[i];
693
+ var target = tmodel.targets[key];
694
+ TargetUtil.resetSingleTargetState(tmodel, key);
695
+ if (target !== null && target !== void 0 && (_target$childAction5 = target.childAction) !== null && _target$childAction5 !== void 0 && _target$childAction5.length) {
696
+ target.childAction.forEach(function (child) {
697
+ if (child) {
698
+ TargetUtil.resetTargetChildState(child, visited);
699
+ }
700
+ });
701
+ target.childAction = [];
702
+ }
703
+ if (target !== null && target !== void 0 && (_target$addChildActio2 = target.addChildAction) !== null && _target$addChildActio2 !== void 0 && _target$addChildActio2.length) {
704
+ target.addChildAction.forEach(function (child) {
705
+ if (child) {
706
+ TargetUtil.resetTargetChildState(child, visited);
707
+ }
708
+ });
709
+ target.addChildAction = [];
710
+ }
711
+ }
712
+ }
713
+ }, {
714
+ key: "resetSingleTargetState",
715
+ value: function resetSingleTargetState(tmodel, key) {
716
+ var targetValue = tmodel.targetValues[key];
717
+ if (targetValue) {
718
+ targetValue.completeCount = 0;
719
+ targetValue.nextTargetUpdateCount = 0;
720
+ }
721
+ tmodel.cancelAnimation();
722
+ tmodel.activatedTargets.length = 0;
723
+ tmodel.removeFromActiveTargets(key);
724
+ tmodel.removeFromAnimatingMap(key);
725
+ tmodel.removeFromUpdatingTargets(key);
726
+ TargetUtil.clearPendingTargets(tmodel, key);
727
+ }
645
728
  }]);
646
729
  }();
package/build/Viewport.js CHANGED
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.Viewport = void 0;
7
+ var _TModelUtil = require("./TModelUtil.js");
7
8
  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); }
8
9
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
9
10
  function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
@@ -130,7 +131,7 @@ var Viewport = exports.Viewport = /*#__PURE__*/function () {
130
131
  var scale = child.getMeasuringScale();
131
132
  var topBaseHeight = child.getTopBaseHeight() * scale;
132
133
  var maxHeight = child.getHeight() * scale + this.currentChild.getTopMargin() + this.currentChild.getBottomMargin();
133
- var maxWidth = child.getItemOverflowMode() === 'always' ? this.container.getWidth() : child.getBaseWidth() * scale + this.currentChild.getLeftMargin() + this.currentChild.getRightMargin();
134
+ var maxWidth = child.getItemOverflowMode() === 'always' && _TModelUtil.TModelUtil.isWidthDefined(this.container) ? this.container.getWidth() : child.getBaseWidth() * scale + this.currentChild.getLeftMargin() + this.currentChild.getRightMargin();
134
135
  if (child.type !== 'BI' && this.container.type === 'BI') {
135
136
  var layout = this.computeBoundary(child, 'layout');
136
137
  var animated = this.computeBoundary(child, 'animated');