targetj 1.0.145 → 1.0.147

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/Export.js CHANGED
@@ -2,6 +2,7 @@ export * from "./build/App.js"
2
2
  export * from "./build/TModel.js"
3
3
  export * from "./build/Moves.js"
4
4
  export * from "./build/SearchUtil.js"
5
+ export * from "./build/TargetData.js"
5
6
  export * from "./build/TargetUtil.js"
6
7
  export * from "./build/TModelUtil.js"
7
8
  export * from "./build/TUtil.js"
package/README.md CHANGED
@@ -520,7 +520,8 @@ Below is a comparison between implementing animations in TargetJS versus using t
520
520
  ```bash
521
521
  import { App, TModel, getScreenHeight, getScreenWidth } from "targetj";
522
522
 
523
- App(new TModel('TargetJS vs Animation Api', {
523
+ App(new TModel('compare', {
524
+ domHolder: true,
524
525
  addAnimateChild() {
525
526
  this.addChild(new TModel('animation', {
526
527
  width: 150,
@@ -550,10 +551,11 @@ App(new TModel('TargetJS vs Animation Api', {
550
551
  }];
551
552
 
552
553
  return this.$dom.animate(keyframes, {
553
- duration: 4500,
554
+ duration: 4000,
554
555
  iterations: 1
555
556
  });
556
- }, enabledOn: function() {
557
+ },
558
+ enabledOn: function() {
557
559
  return this.hasDom();
558
560
  }
559
561
  }
@@ -562,38 +564,24 @@ App(new TModel('TargetJS vs Animation Api', {
562
564
  addDomChild() {
563
565
  this.addChild(new TModel('dom', {
564
566
  color: 'white',
565
- html: 'TargetJS',
566
- animate: {
567
- cycles: 3,
568
- value(cycle) {
569
- return [
570
- { x: 200, y: 0, rotate: 0, scale: 1, width: 80, height: 80, background: 'orange' },
571
- { x: 250, y: 100, rotate: 180, scale: 1.5, width: 120, height: 120, background: 'brown' },
572
- { x: 350, y: 0, rotate: 360, scale: 1, width: 100, height: 100, background: 'crimson' },
573
- { x: 200, y: 0, rotate: 360, scale: 1, width: 150, height: 150, background: 'purple' }
574
- ][cycle];
575
- },
576
- onValueChange(newValue) {
577
- const steps = this.getTargetCycle(this.key) === 0 ? 0 : 180;
578
- this.setTarget("move", newValue, steps);
579
- }
580
- }
567
+ html: 'TargetJ',
568
+ setup() {
569
+ this.setTarget({ x: 200, y: 0, rotate: 0, scale: 1, width: 80, height: 80, background: 'orange' });
570
+ },
571
+ step1$() {
572
+ this.setTarget({ x: 250, y: 100, rotate: 180, scale: 1.5, width: 120, height: 120, background: 'brown' }, 160);
573
+ },
574
+ _step2$$() {
575
+ this.setTarget({ x: 350, y: 0, rotate: 360, scale: 1, width: 100, height: 100, background: 'crimson' }, 160);
576
+ },
577
+ _step3$$() {
578
+ this.setTarget({ x: 200, y: 0, rotate: 360, scale: 1, width: 150, height: 150, background: 'purple' }, 160);
579
+ }
581
580
  }));
582
581
  },
583
- restartOnBothComplete: {
584
- loop: true,
585
- interval: 50,
586
- value() {
587
- const animation = this.getChild(0).val('animate');
588
- if (animation.currentTime === animation.effect.getComputedTiming().duration
589
- && this.getChild(1).isTargetComplete('animate')) {
590
- this.getChild(0).activateTarget('animate');
591
- this.getChild(1).activateTarget('animate');
592
- }
593
- },
594
- enabledOn: function() {
595
- return this.getChildren().length === 2 && this.getChild(0).val('animate');
596
- }
582
+ _restartOnBothComplete$$() {
583
+ this.getChild(0).activateTarget('animate');
584
+ this.getChild(1).activateTarget('setup');
597
585
  },
598
586
  width() { return getScreenWidth(); },
599
587
  height() { return getScreenHeight(); }
@@ -9,6 +9,7 @@ var _TargetExecutor = require("./TargetExecutor.js");
9
9
  var _TUtil = require("./TUtil.js");
10
10
  var _TModelUtil = require("./TModelUtil.js");
11
11
  var _TargetUtil = require("./TargetUtil.js");
12
+ var _TargetData = require("./TargetData.js");
12
13
  var _$Dom = require("./$Dom.js");
13
14
  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; } } }; }
14
15
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
@@ -98,34 +99,36 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
98
99
  }, {
99
100
  key: "processNewTarget",
100
101
  value: function processNewTarget(key, targetNames) {
101
- if (!_TUtil.TUtil.isDefined(this.targets[key])) {
102
+ var target = this.targets[key];
103
+ if (!_TUtil.TUtil.isDefined(target)) {
102
104
  this.delVal('key');
103
105
  return;
104
106
  }
107
+ if (_typeof(target) !== 'object' || Array.isArray(target)) {
108
+ this.targets[key] = {
109
+ value: target
110
+ };
111
+ target = this.targets[key];
112
+ }
105
113
  _TargetUtil.TargetUtil.bindTarget(this, key, targetNames);
106
114
  var cleanKey = _TargetUtil.TargetUtil.getTargetName(key);
107
115
  var isInactiveKey = key.startsWith('_');
108
116
  if (cleanKey !== key) {
117
+ this.targets[cleanKey] = this.targets[key];
109
118
  if (isInactiveKey) {
110
- this.targets[cleanKey] = _typeof(this.targets[key]) === 'object' && this.targets[key].value ? this.targets[key] : {
111
- value: this.targets[key]
112
- };
113
119
  this.targets[cleanKey].active = false;
114
- } else {
115
- this.targets[cleanKey] = this.targets[key];
116
120
  }
117
121
  delete this.targets[key];
118
122
  key = cleanKey;
119
123
  }
120
- var target = this.targets[key];
121
- if (_TargetUtil.TargetUtil.allEventMap[key] || _TargetUtil.TargetUtil.internalEventMap[key]) {
124
+ if (_TargetData.TargetData.allEventMap[key] || _TargetData.TargetData.internalEventMap[key]) {
122
125
  if (!this.eventTargetMap[key]) {
123
126
  this.eventTargetList.push(key);
124
127
  this.eventTargetMap[key] = true;
125
128
  }
126
129
  return;
127
130
  }
128
- if (_TargetUtil.TargetUtil.bypassInitialProcessingTargetMap[key]) {
131
+ if (_TargetData.TargetData.bypassInitialProcessingTargetMap[key]) {
129
132
  return;
130
133
  }
131
134
  if (_TUtil.TUtil.isDefined(target.initialValue)) {
@@ -134,10 +137,10 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
134
137
  if (!isInactiveKey) {
135
138
  this.addToStyleTargetList(key);
136
139
  }
137
- if (_TargetUtil.TargetUtil.coreTargetMap[key] && !this.coreTargets.includes(key)) {
140
+ if (_TargetData.TargetData.coreTargetMap[key] && !this.coreTargets.includes(key)) {
138
141
  this.coreTargets.push(key);
139
142
  }
140
- if (!_TargetUtil.TargetUtil.mustExecuteTargets[key] && _TUtil.TUtil.isStringBooleanOrNumber(target)) {
143
+ if (!_TargetData.TargetData.mustExecuteTargets[key] && _TUtil.TUtil.isStringBooleanOrNumber(target)) {
141
144
  this.val(key, target);
142
145
  return;
143
146
  }
@@ -183,8 +186,8 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
183
186
  if (this.excludeStyling() || this.targets["exclude".concat(_TUtil.TUtil.capitalizeFirstLetter(key))]) {
184
187
  return;
185
188
  }
186
- var isAsyncStyleTarget = _TargetUtil.TargetUtil.asyncStyleTargetMap[key];
187
- var isAttributeTarget = _TargetUtil.TargetUtil.attributeTargetMap[key];
189
+ var isAsyncStyleTarget = _TargetData.TargetData.asyncStyleTargetMap[key];
190
+ var isAttributeTarget = _TargetData.TargetData.attributeTargetMap[key];
188
191
  if (isAsyncStyleTarget || isAttributeTarget) {
189
192
  if (!this.asyncStyleTargetMap[key]) {
190
193
  this.asyncStyleTargetList.push(key);
@@ -192,7 +195,7 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
192
195
  }
193
196
  } else if (this.isStyleTarget(key)) {
194
197
  var styleFlag = true;
195
- if (_TargetUtil.TargetUtil.transformMap[key]) {
198
+ if (_TargetData.TargetData.transformMap[key]) {
196
199
  if (this.getParent()) {
197
200
  this.calcAbsolutePosition(this.getX(), this.getY());
198
201
  }
@@ -225,7 +228,7 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
225
228
  }, {
226
229
  key: "isStyleTarget",
227
230
  value: function isStyleTarget(key) {
228
- return _TargetUtil.TargetUtil.styleTargetMap[key];
231
+ return _TargetData.TargetData.styleTargetMap[key];
229
232
  }
230
233
  }, {
231
234
  key: "useWindowFrame",
@@ -556,6 +559,9 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
556
559
  }
557
560
  var originalTargetName = _TargetUtil.TargetUtil.currentTargetName;
558
561
  var originalTModel = _TargetUtil.TargetUtil.currentTModel;
562
+ if (this.getParent() === originalTModel) {
563
+ _TargetUtil.TargetUtil.markTargetAction(originalTModel, 'childAction');
564
+ }
559
565
  _TargetExecutor.TargetExecutor.executeImperativeTarget(this, key, value, steps, interval, easing, originalTargetName, originalTModel);
560
566
  return this;
561
567
  }
@@ -652,7 +658,7 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
652
658
  value: function addToUpdatingChildren(child) {
653
659
  if (!this.updatingChildrenMap[child.oid]) {
654
660
  this.updatingChildrenMap[child.oid] = true;
655
- this.updatingChildrenList.push(child.oid);
661
+ this.updatingChildrenList.push(child);
656
662
  }
657
663
  }
658
664
  }, {
@@ -660,7 +666,7 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
660
666
  value: function removeFromUpdatingChildren(child) {
661
667
  if (this.updatingChildrenMap[child.oid]) {
662
668
  delete this.updatingChildrenMap[child.oid];
663
- var index = this.updatingChildrenList.indexOf(child.oid);
669
+ var index = this.updatingChildrenList.indexOf(child);
664
670
  if (index >= 0) {
665
671
  this.updatingChildrenList.splice(index, 1);
666
672
  }
@@ -676,7 +682,7 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
676
682
  value: function addToActiveChildren(child) {
677
683
  if (!this.activeChildrenMap[child.oid]) {
678
684
  this.activeChildrenMap[child.oid] = true;
679
- this.activeChildrenList.push(child.oid);
685
+ this.activeChildrenList.push(child);
680
686
  }
681
687
  }
682
688
  }, {
@@ -684,7 +690,7 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
684
690
  value: function removeFromActiveChildren(child) {
685
691
  if (this.activeChildrenMap[child.oid]) {
686
692
  delete this.activeChildrenMap[child.oid];
687
- var index = this.activeChildrenList.indexOf(child.oid);
693
+ var index = this.activeChildrenList.indexOf(child);
688
694
  if (index >= 0) {
689
695
  this.activeChildrenList.splice(index, 1);
690
696
  }
package/build/Bracket.js CHANGED
@@ -138,7 +138,7 @@ var Bracket = exports.Bracket = /*#__PURE__*/function (_TModel) {
138
138
  }, {
139
139
  key: "validateVisibilityInParent",
140
140
  value: function validateVisibilityInParent() {
141
- return this.getRealParent().validateVisibilityInParent();
141
+ return this.getChildren().length > 0 ? this.getChild(0).validateVisibilityInParent() : false;
142
142
  }
143
143
  }, {
144
144
  key: "getChildren",
@@ -7,7 +7,7 @@ exports.EventListener = void 0;
7
7
  var _$Dom = require("./$Dom.js");
8
8
  var _SearchUtil = require("./SearchUtil.js");
9
9
  var _TUtil = require("./TUtil.js");
10
- var _TargetUtil = require("./TargetUtil.js");
10
+ var _TargetData = require("./TargetData.js");
11
11
  var _App = require("./App.js");
12
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); }
13
13
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -322,7 +322,7 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
322
322
  return;
323
323
  }
324
324
  this.eventTargetMap[targetName] = true;
325
- var events = _TargetUtil.TargetUtil.targetToEventsMapping[targetName];
325
+ var events = _TargetData.TargetData.targetToEventsMapping[targetName];
326
326
  events.forEach(function (event) {
327
327
  if (targetName === 'onTouchStart') {
328
328
  _this3.ignoreStartEvents = false;
@@ -31,7 +31,7 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
31
31
  return _createClass(LoadingManager, [{
32
32
  key: "fetchCommon",
33
33
  value: function fetchCommon(fetchId, cacheId, tmodel, fetchMap, fetchFn) {
34
- this.addToTModelKeyMap(tmodel, tmodel.key, fetchId, cacheId);
34
+ _TargetUtil.TargetUtil.markTargetAction(tmodel, 'fetchAction');
35
35
  if (!cacheId || !this.isFetched(cacheId)) {
36
36
  if (!fetchMap[fetchId]) {
37
37
  fetchMap[fetchId] = {
@@ -52,80 +52,76 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
52
52
  targetName: tmodel.key
53
53
  });
54
54
  }
55
+ } else if (!fetchMap[fetchId]) {
56
+ fetchMap[fetchId] = {
57
+ fetchId: fetchId,
58
+ cacheId: cacheId,
59
+ fetchingFlag: true,
60
+ startTime: _TUtil.TUtil.now(),
61
+ targets: [{
62
+ tmodel: tmodel,
63
+ targetName: tmodel.key
64
+ }],
65
+ fetchMap: fetchMap
66
+ };
55
67
  }
68
+ this.addToTModelKeyMap(tmodel, tmodel.key, fetchId, cacheId);
56
69
  return fetchId;
57
70
  }
71
+ }, {
72
+ key: "fetch",
73
+ value: function fetch(tmodel, url, query, cacheId) {
74
+ var _this = this;
75
+ var fetchId = "".concat(tmodel.oid, "_").concat(url, "_").concat(JSON.stringify(query));
76
+ this.fetchCommon(fetchId, cacheId, tmodel, this.fetchingAPIMap, function () {
77
+ _this.ajaxAPI(url, query, _this.fetchingAPIMap[fetchId]);
78
+ });
79
+ }
80
+ }, {
81
+ key: "fetchImage",
82
+ value: function fetchImage(tmodel, src, cacheId) {
83
+ var _this2 = this;
84
+ var fetchId = "".concat(tmodel.oid, "_").concat(src);
85
+ return this.fetchCommon(fetchId, cacheId, tmodel, this.fetchingImageMap, function () {
86
+ _this2.loadImage(src, _this2.fetchingImageMap[fetchId]);
87
+ });
88
+ }
58
89
  }, {
59
90
  key: "getTModelKey",
60
91
  value: function getTModelKey(tmodel, targetName) {
61
92
  return "".concat(tmodel.oid, " ").concat(targetName);
62
93
  }
94
+ }, {
95
+ key: "getLoadTargetName",
96
+ value: function getLoadTargetName(targetName) {
97
+ return "load-".concat(targetName);
98
+ }
63
99
  }, {
64
100
  key: "addToTModelKeyMap",
65
101
  value: function addToTModelKeyMap(tmodel, targetName, fetchId, cacheId) {
66
102
  var key = this.getTModelKey(tmodel, targetName);
103
+ var loadTargetName = this.getLoadTargetName(targetName);
67
104
  if (!this.tmodelKeyMap[key]) {
68
105
  this.tmodelKeyMap[key] = {
69
106
  fetchMap: {},
70
107
  entryCount: 0,
71
108
  resultCount: 0,
72
- errorCount: 0
109
+ errorCount: 0,
110
+ activeIndex: 0,
111
+ accessIndex: 0
73
112
  };
113
+ tmodel.val(loadTargetName, []);
74
114
  }
75
115
  if (!this.tmodelKeyMap[key].fetchMap[fetchId]) {
76
116
  this.tmodelKeyMap[key].fetchMap[fetchId] = {
77
117
  fetchId: fetchId,
78
- order: this.tmodelKeyMap[key].entryCount,
79
- cachedValue: cacheId && this.isFetched(cacheId) ? this.cacheMap[cacheId] : undefined
118
+ order: this.tmodelKeyMap[key].entryCount
80
119
  };
81
120
  this.tmodelKeyMap[key].entryCount++;
121
+ tmodel.val(loadTargetName).push(undefined);
82
122
  }
83
- }
84
- }, {
85
- key: "initializeLoaderTargetValue",
86
- value: function initializeLoaderTargetValue(tmodel, targetName) {
87
- var _this = this;
88
- var key = this.getTModelKey(tmodel, targetName);
89
- var tmodelEntry = this.tmodelKeyMap[key];
90
- if (!tmodelEntry) {
91
- return;
92
- }
93
- tmodelEntry.resultCount = 0;
94
- if (tmodelEntry.entryCount > 1) {
95
- var fetchEntries = Object.values(tmodelEntry.fetchMap);
96
- var targetValue = Array.from({
97
- length: tmodelEntry.entryCount
98
- }, function (_, i) {
99
- var fetchEntry = fetchEntries.find(function (entry) {
100
- return entry.order === i;
101
- });
102
- if ((fetchEntry === null || fetchEntry === void 0 ? void 0 : fetchEntry.cachedValue) !== undefined) {
103
- tmodelEntry.resultCount++;
104
- _this.callOnSuccessHandler(tmodel, targetName, _objectSpread(_objectSpread({}, fetchEntry.cachedValue), {}, {
105
- fetchingPeriod: 0,
106
- order: i
107
- }));
108
- return fetchEntry.cachedValue.result;
109
- }
110
- return undefined;
111
- });
112
- tmodel.val(targetName, targetValue);
113
- } else {
114
- var singleEntry = Object.values(tmodelEntry.fetchMap)[0];
115
- if ((singleEntry === null || singleEntry === void 0 ? void 0 : singleEntry.cachedValue) !== undefined) {
116
- tmodel.val(targetName, singleEntry.cachedValue.result);
117
- this.callOnSuccessHandler(tmodel, targetName, _objectSpread(_objectSpread({}, singleEntry.cachedValue), {}, {
118
- fetchingPeriod: 0,
119
- order: 0
120
- }));
121
- tmodelEntry.resultCount = 1;
122
- } else {
123
- tmodel.val(targetName, undefined);
124
- }
125
- }
126
- if (tmodelEntry.resultCount === tmodelEntry.entryCount) {
127
- this.removeFromTModelKeyMap(tmodel, targetName);
128
- _TargetUtil.TargetUtil.shouldActivateNextTarget(tmodel, targetName);
123
+ if (cacheId && this.isFetched(cacheId)) {
124
+ this.handleSuccess(this.fetchingAPIMap[fetchId], this.cacheMap[cacheId].result);
129
125
  }
130
126
  }
131
127
  }, {
@@ -135,28 +131,68 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
135
131
  delete this.tmodelKeyMap[key];
136
132
  }
137
133
  }, {
138
- key: "isInTModelKeyMap",
139
- value: function isInTModelKeyMap(tmodel, targetName) {
134
+ key: "isLoading",
135
+ value: function isLoading(tmodel, targetName) {
140
136
  var key = this.getTModelKey(tmodel, targetName);
141
137
  return this.tmodelKeyMap[key];
142
138
  }
143
139
  }, {
144
- key: "fetch",
145
- value: function fetch(tmodel, url, query, cacheId) {
146
- var _this2 = this;
147
- var fetchId = "".concat(tmodel.oid, "_").concat(url, "_").concat(JSON.stringify(query));
148
- return this.fetchCommon(fetchId, cacheId, tmodel, this.fetchingAPIMap, function () {
149
- _this2.ajaxAPI(url, query, _this2.fetchingAPIMap[fetchId]);
150
- });
140
+ key: "isLoadingSuccessful",
141
+ value: function isLoadingSuccessful(tmodel, targetName) {
142
+ var key = this.getTModelKey(tmodel, targetName);
143
+ return this.tmodelKeyMap[key] && this.tmodelKeyMap[key].resultCount === this.tmodelKeyMap[key].entryCount && this.tmodelKeyMap[key].errorCount === 0;
151
144
  }
152
145
  }, {
153
- key: "fetchImage",
154
- value: function fetchImage(tmodel, src, cacheId) {
155
- var _this3 = this;
156
- var fetchId = "".concat(tmodel.oid, "_").concat(src);
157
- return this.fetchCommon(fetchId, cacheId, tmodel, this.fetchingImageMap, function () {
158
- _this3.loadImage(src, _this3.fetchingImageMap[fetchId]);
159
- });
146
+ key: "resetLoadingError",
147
+ value: function resetLoadingError(tmodel, targetName) {
148
+ var key = this.getTModelKey(tmodel, targetName);
149
+ var modelEntry = this.tmodelKeyMap[key];
150
+ if (modelEntry) {
151
+ modelEntry.errorCount = 0;
152
+ }
153
+ }
154
+ }, {
155
+ key: "nextActiveItem",
156
+ value: function nextActiveItem(tmodel, targetName) {
157
+ var key = this.getTModelKey(tmodel, targetName);
158
+ var modelEntry = this.tmodelKeyMap[key];
159
+ if (!modelEntry) {
160
+ return false;
161
+ }
162
+ return modelEntry.activeIndex++;
163
+ }
164
+ }, {
165
+ key: "isNextLoadingItemSuccessful",
166
+ value: function isNextLoadingItemSuccessful(tmodel, targetName) {
167
+ var key = this.getTModelKey(tmodel, targetName);
168
+ var modelEntry = this.tmodelKeyMap[key];
169
+ if (!modelEntry) {
170
+ return false;
171
+ }
172
+ var loadTargetName = this.getLoadTargetName(targetName);
173
+ var targetValue = tmodel.val(loadTargetName);
174
+ return modelEntry.errorCount === 0 && Array.isArray(targetValue) && _TUtil.TUtil.isDefined(targetValue[modelEntry.activeIndex]);
175
+ }
176
+ }, {
177
+ key: "getLoadingItemValue",
178
+ value: function getLoadingItemValue(tmodel, targetName) {
179
+ var target = tmodel.targets[targetName];
180
+ var key = this.getTModelKey(tmodel, targetName);
181
+ var modelEntry = this.tmodelKeyMap[key];
182
+ if (!modelEntry || !target) {
183
+ return undefined;
184
+ }
185
+ var loadTargetName = this.getLoadTargetName(targetName);
186
+ var targetValue = tmodel.val(loadTargetName);
187
+ var result;
188
+ if (target.fetchAction === 'onEnd') {
189
+ result = targetValue.slice(modelEntry.accessIndex);
190
+ modelEntry.accessIndex += result.length;
191
+ } else {
192
+ result = targetValue[modelEntry.accessIndex];
193
+ modelEntry.accessIndex++;
194
+ }
195
+ return result;
160
196
  }
161
197
  }, {
162
198
  key: "isFetching",
@@ -183,7 +219,7 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
183
219
  }, {
184
220
  key: "handleSuccess",
185
221
  value: function handleSuccess(fetchStatus, result) {
186
- var _this4 = this;
222
+ var _this3 = this;
187
223
  var fetchTime = _TUtil.TUtil.now();
188
224
  var fetchId = fetchStatus.fetchId,
189
225
  cacheId = fetchStatus.cacheId,
@@ -198,31 +234,21 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
198
234
  targets.forEach(function (_ref) {
199
235
  var tmodel = _ref.tmodel,
200
236
  targetName = _ref.targetName;
201
- var key = _this4.getTModelKey(tmodel, targetName);
202
- var tmodelEntry = _this4.tmodelKeyMap[key];
237
+ var key = _this3.getTModelKey(tmodel, targetName);
238
+ var tmodelEntry = _this3.tmodelKeyMap[key];
239
+ var loadTargetName = _this3.getLoadTargetName(targetName);
203
240
  if (!tmodelEntry) {
204
241
  return;
205
242
  }
206
243
  var fetchEntry = tmodelEntry.fetchMap[fetchId];
207
- _this4.callOnSuccessHandler(tmodel, targetName, _objectSpread(_objectSpread({}, res), {}, {
244
+ _this3.callOnSuccessHandler(tmodel, targetName, _objectSpread(_objectSpread({}, res), {}, {
208
245
  order: fetchEntry.order
209
246
  }));
210
- if (tmodelEntry.entryCount > 1) {
211
- var targetResults = tmodel.val(targetName);
212
- var _fetchEntry = tmodelEntry.fetchMap[fetchId];
213
- targetResults[_fetchEntry.order] = res.result;
214
- tmodelEntry.resultCount++;
215
- if (tmodelEntry.resultCount === tmodelEntry.entryCount) {
216
- _this4.removeFromTModelKeyMap(tmodel, targetName);
217
- if (tmodelEntry.errorCount === 0) {
218
- _TargetUtil.TargetUtil.shouldActivateNextTarget(tmodel, targetName);
219
- } else {
220
- _this4.callOnErrorHandler(tmodel, targetName);
221
- }
222
- }
223
- } else {
224
- tmodel.val(targetName, res.result);
225
- _this4.removeFromTModelKeyMap(tmodel, targetName);
247
+ var targetResults = tmodel.val(loadTargetName);
248
+ targetResults[fetchEntry.order] = res.result;
249
+ tmodel.val(targetName, targetResults.length === 1 ? targetResults[0] : targetResults);
250
+ tmodelEntry.resultCount++;
251
+ if (tmodelEntry.errorCount === 0) {
226
252
  _TargetUtil.TargetUtil.shouldActivateNextTarget(tmodel, targetName);
227
253
  }
228
254
  });
@@ -235,7 +261,7 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
235
261
  }, {
236
262
  key: "handleError",
237
263
  value: function handleError(fetchStatus, error) {
238
- var _this5 = this;
264
+ var _this4 = this;
239
265
  var fetchTime = _TUtil.TUtil.now();
240
266
  var fetchId = fetchStatus.fetchId,
241
267
  cacheId = fetchStatus.cacheId,
@@ -246,7 +272,7 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
246
272
  var tmodel = _ref2.tmodel,
247
273
  targetName = _ref2.targetName;
248
274
  var key = "".concat(tmodel.oid, " ").concat(targetName);
249
- var tmodelEntry = _this5.tmodelKeyMap[key];
275
+ var tmodelEntry = _this4.tmodelKeyMap[key];
250
276
  if (!tmodelEntry) {
251
277
  return;
252
278
  }
@@ -257,19 +283,11 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
257
283
  order: fetchEntry.order,
258
284
  error: error
259
285
  };
260
- if (tmodelEntry.entryCount > 1) {
261
- var targetValue = tmodel.val(targetName);
262
- targetValue[fetchEntry.order] = res;
263
- tmodelEntry.resultCount++;
264
- tmodelEntry.errorCount++;
265
- if (tmodelEntry.resultCount === tmodelEntry.entryCount) {
266
- _this5.removeFromTModelKeyMap(tmodel, targetName);
267
- _this5.callOnErrorHandler(tmodel, targetName);
268
- }
269
- } else {
270
- tmodel.val(targetName, res);
271
- _this5.removeFromTModelKeyMap(tmodel, targetName);
272
- }
286
+ var targetValue = tmodel.val(targetName);
287
+ targetValue[fetchEntry.order] = res;
288
+ tmodelEntry.resultCount++;
289
+ tmodelEntry.errorCount++;
290
+ _this4.callOnErrorHandler(tmodel, targetName);
273
291
  });
274
292
  delete fetchMap[fetchId];
275
293
  if (cacheId) {
@@ -314,15 +332,15 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
314
332
  }, {
315
333
  key: "ajaxAPI",
316
334
  value: function ajaxAPI(url, query, fetchStatus) {
317
- var _this6 = this;
335
+ var _this5 = this;
318
336
  var defaultQuery = {
319
337
  dataType: "json",
320
338
  type: "GET",
321
339
  success: function success(dataList) {
322
- return _this6.handleSuccess(fetchStatus, dataList);
340
+ return _this5.handleSuccess(fetchStatus, dataList);
323
341
  },
324
342
  error: function error(textStatus) {
325
- return _this6.handleError(fetchStatus, textStatus);
343
+ return _this5.handleError(fetchStatus, textStatus);
326
344
  }
327
345
  };
328
346
  _$Dom.$Dom.ajax(_objectSpread(_objectSpread({}, defaultQuery), {}, {
@@ -334,7 +352,7 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
334
352
  }, {
335
353
  key: "loadImage",
336
354
  value: function loadImage(src, fetchStatus) {
337
- var _this7 = this;
355
+ var _this6 = this;
338
356
  var image = new Image();
339
357
  image.src = src;
340
358
  image.onload = function () {
@@ -343,10 +361,10 @@ var LoadingManager = exports.LoadingManager = /*#__PURE__*/function () {
343
361
  height: image.height,
344
362
  src: image.src
345
363
  };
346
- _this7.handleSuccess(fetchStatus, result);
364
+ _this6.handleSuccess(fetchStatus, result);
347
365
  };
348
366
  image.onerror = function () {
349
- _this7.handleError(fetchStatus, "not found");
367
+ _this6.handleError(fetchStatus, "not found");
350
368
  };
351
369
  }
352
370
  }]);
@@ -7,6 +7,7 @@ exports.LocationManager = void 0;
7
7
  var _BracketGenerator = require("./BracketGenerator.js");
8
8
  var _TUtil = require("./TUtil.js");
9
9
  var _TargetUtil = require("./TargetUtil.js");
10
+ var _TargetData = require("./TargetData.js");
10
11
  var _TModelUtil = require("./TModelUtil.js");
11
12
  var _TargetExecutor = require("./TargetExecutor.js");
12
13
  var _App = require("./App.js");
@@ -73,7 +74,6 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
73
74
  }, {
74
75
  key: "calculate",
75
76
  value: function calculate() {
76
- this.addToLocationList(_App.tApp.tRoot);
77
77
  this.calculateContainer(_App.tApp.tRoot);
78
78
  }
79
79
  }, {
@@ -160,7 +160,7 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
160
160
  }
161
161
  child.getCoreTargets().forEach(function (target) {
162
162
  if (child.isTargetEnabled(target) && !child.isTargetUpdating(target) && !child.isTargetImperative(target)) {
163
- _TargetExecutor.TargetExecutor.executeDeclarativeTarget(child, target);
163
+ _TargetExecutor.TargetExecutor.executeDeclarativeTarget(child, target, child.getTargetCycle(target));
164
164
  }
165
165
  ;
166
166
  });
@@ -254,7 +254,7 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
254
254
  if (eventMap[targetName] && eventMap[targetName](tmodel)) {
255
255
  eventTargets.push(targetName);
256
256
  }
257
- if (attachEvents && _TargetUtil.TargetUtil.targetToEventsMapping[targetName]) {
257
+ if (attachEvents && _TargetData.TargetData.targetToEventsMapping[targetName]) {
258
258
  (0, _App.getEvents)().attachTargetEvents(targetName);
259
259
  }
260
260
  });
@@ -263,12 +263,12 @@ var LocationManager = exports.LocationManager = /*#__PURE__*/function () {
263
263
  }, {
264
264
  key: "checkInternalEventTargets",
265
265
  value: function checkInternalEventTargets(tmodel) {
266
- this.checkEventTargetsByType(tmodel, _TargetUtil.TargetUtil.internalEventMap);
266
+ this.checkEventTargetsByType(tmodel, _TargetData.TargetData.internalEventMap);
267
267
  }
268
268
  }, {
269
269
  key: "checkEventTargets",
270
270
  value: function checkEventTargets(tmodel) {
271
- this.checkEventTargetsByType(tmodel, _TargetUtil.TargetUtil.allEventMap, true);
271
+ this.checkEventTargetsByType(tmodel, _TargetData.TargetData.allEventMap, true);
272
272
  }
273
273
  }, {
274
274
  key: "runEventTargets",