targetj 1.0.240 → 1.0.241
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 +27 -5
- package/build/$Dom.js +21 -25
- package/build/AnimationManager.js +39 -44
- package/build/AnimationUtil.js +41 -45
- package/build/App.js +73 -74
- package/build/BaseModel.js +86 -90
- package/build/Bracket.js +7 -11
- package/build/BracketGenerator.js +15 -19
- package/build/ColorUtil.js +3 -8
- package/build/DomInit.js +34 -38
- package/build/Easing.js +3 -8
- package/build/EventListener.js +63 -67
- package/build/LoadingManager.js +34 -38
- package/build/LocationManager.js +52 -56
- package/build/Moves.js +17 -21
- package/build/PageManager.js +64 -68
- package/build/RunScheduler.js +46 -50
- package/build/ScheduleUtil.js +20 -24
- package/build/SearchUtil.js +16 -20
- package/build/TModel.js +52 -56
- package/build/TModelManager.js +37 -41
- package/build/TModelUtil.js +47 -50
- package/build/TUtil.js +16 -20
- package/build/TargetData.js +35 -40
- package/build/TargetExecutor.js +72 -76
- package/build/TargetManager.js +49 -52
- package/build/TargetParser.js +35 -39
- package/build/TargetUtil.js +25 -29
- package/build/Viewport.js +6 -10
- package/build/VisibilityUtil.js +11 -15
- package/build/index.js +20 -225
- package/dist/targetjs.js +1 -1
- package/dist/targetjs.js.gz +0 -0
- package/package.json +1 -1
package/build/ScheduleUtil.js
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ScheduleUtil = void 0;
|
|
7
|
-
var _TUtil = require("./TUtil.js");
|
|
8
|
-
var _App = require("./App.js");
|
|
9
1
|
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); }
|
|
10
2
|
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
3
|
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
@@ -23,11 +15,14 @@ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o =
|
|
|
23
15
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
24
16
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
25
17
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
18
|
+
import { TUtil } from "./TUtil.js";
|
|
19
|
+
import { getRunScheduler, getAnimationManager } from "./App.js";
|
|
20
|
+
|
|
26
21
|
/**
|
|
27
22
|
*
|
|
28
23
|
* It provides a variety of helping functions for scheduling target execution
|
|
29
24
|
*/
|
|
30
|
-
var ScheduleUtil =
|
|
25
|
+
var ScheduleUtil = /*#__PURE__*/function () {
|
|
31
26
|
function ScheduleUtil() {
|
|
32
27
|
_classCallCheck(this, ScheduleUtil);
|
|
33
28
|
}
|
|
@@ -35,7 +30,7 @@ var ScheduleUtil = exports.ScheduleUtil = /*#__PURE__*/function () {
|
|
|
35
30
|
key: "scheduleExecution",
|
|
36
31
|
value: function scheduleExecution(tmodel, key) {
|
|
37
32
|
var interval = tmodel.getTargetInterval(key);
|
|
38
|
-
var now =
|
|
33
|
+
var now = TUtil.now();
|
|
39
34
|
if (interval <= 0) {
|
|
40
35
|
return 0;
|
|
41
36
|
}
|
|
@@ -44,13 +39,13 @@ var ScheduleUtil = exports.ScheduleUtil = /*#__PURE__*/function () {
|
|
|
44
39
|
return 0;
|
|
45
40
|
}
|
|
46
41
|
var remaining = tmodel.getScheduleRemainingTime(key);
|
|
47
|
-
if (
|
|
42
|
+
if (TUtil.isDefined(remaining)) {
|
|
48
43
|
tmodel.setScheduleTimeStamp(key, now - Math.max(interval - remaining, 0));
|
|
49
44
|
tmodel.resetScheduleRemainingTime(key);
|
|
50
45
|
return remaining;
|
|
51
46
|
}
|
|
52
47
|
var lastScheduledTime = tmodel.getScheduleTimeStamp(key);
|
|
53
|
-
if (
|
|
48
|
+
if (TUtil.isDefined(lastScheduledTime)) {
|
|
54
49
|
var elapsed = now - lastScheduledTime;
|
|
55
50
|
return Math.max(interval - elapsed, 0);
|
|
56
51
|
}
|
|
@@ -65,7 +60,7 @@ var ScheduleUtil = exports.ScheduleUtil = /*#__PURE__*/function () {
|
|
|
65
60
|
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
66
61
|
key = _Object$entries$_i[0],
|
|
67
62
|
targetValue = _Object$entries$_i[1];
|
|
68
|
-
if (
|
|
63
|
+
if (TUtil.isDefined(targetValue.scheduleTimeStamp) || TUtil.isDefined(targetValue.scheduleRemainingTime)) {
|
|
69
64
|
keys.push(key);
|
|
70
65
|
}
|
|
71
66
|
}
|
|
@@ -96,7 +91,7 @@ var ScheduleUtil = exports.ScheduleUtil = /*#__PURE__*/function () {
|
|
|
96
91
|
var shouldPause = ScheduleUtil.shouldPauseTarget(tmodel, key);
|
|
97
92
|
if (shouldPause) {
|
|
98
93
|
var _tmodel$animatingMap2;
|
|
99
|
-
if (
|
|
94
|
+
if (TUtil.isDefined(tmodel.getScheduleTimeStamp(key))) {
|
|
100
95
|
ScheduleUtil.pauseSchedule(tmodel, key);
|
|
101
96
|
}
|
|
102
97
|
if ((_tmodel$animatingMap2 = tmodel.animatingMap) !== null && _tmodel$animatingMap2 !== void 0 && _tmodel$animatingMap2.has(key)) {
|
|
@@ -105,16 +100,16 @@ var ScheduleUtil = exports.ScheduleUtil = /*#__PURE__*/function () {
|
|
|
105
100
|
continue;
|
|
106
101
|
}
|
|
107
102
|
var remaining = tmodel.getScheduleRemainingTime(key);
|
|
108
|
-
if (
|
|
103
|
+
if (TUtil.isDefined(remaining)) {
|
|
109
104
|
ScheduleUtil.resumeSchedule(tmodel, key);
|
|
110
105
|
tmodel.addTargetToStatusList(key);
|
|
111
|
-
|
|
106
|
+
getRunScheduler().scheduleOnlyIfEarlier(remaining, "resume-".concat(tmodel.oid, "-").concat(key));
|
|
112
107
|
continue;
|
|
113
108
|
}
|
|
114
|
-
if (
|
|
109
|
+
if (TUtil.isDefined(tmodel.getScheduleTimeStamp(key))) {
|
|
115
110
|
var delay = ScheduleUtil.scheduleExecution(tmodel, key);
|
|
116
111
|
tmodel.addTargetToStatusList(key);
|
|
117
|
-
|
|
112
|
+
getRunScheduler().scheduleOnlyIfEarlier(delay, "resume-".concat(tmodel.oid, "-").concat(key));
|
|
118
113
|
}
|
|
119
114
|
}
|
|
120
115
|
} catch (err) {
|
|
@@ -123,7 +118,7 @@ var ScheduleUtil = exports.ScheduleUtil = /*#__PURE__*/function () {
|
|
|
123
118
|
_iterator.f();
|
|
124
119
|
}
|
|
125
120
|
if (animationsToPause.size) {
|
|
126
|
-
|
|
121
|
+
getAnimationManager().pauseAnimations(tmodel, animationsToPause);
|
|
127
122
|
}
|
|
128
123
|
}
|
|
129
124
|
}, {
|
|
@@ -131,10 +126,10 @@ var ScheduleUtil = exports.ScheduleUtil = /*#__PURE__*/function () {
|
|
|
131
126
|
value: function pauseSchedule(tmodel, key) {
|
|
132
127
|
var interval = tmodel.getTargetInterval(key);
|
|
133
128
|
var lastScheduledTime = tmodel.getScheduleTimeStamp(key);
|
|
134
|
-
if (interval <= 0 || !
|
|
129
|
+
if (interval <= 0 || !TUtil.isDefined(lastScheduledTime)) {
|
|
135
130
|
return;
|
|
136
131
|
}
|
|
137
|
-
var now =
|
|
132
|
+
var now = TUtil.now();
|
|
138
133
|
var elapsed = now - lastScheduledTime;
|
|
139
134
|
var remaining = Math.max(interval - elapsed, 0);
|
|
140
135
|
tmodel.setScheduleRemainingTime(key, remaining);
|
|
@@ -144,10 +139,10 @@ var ScheduleUtil = exports.ScheduleUtil = /*#__PURE__*/function () {
|
|
|
144
139
|
key: "resumeSchedule",
|
|
145
140
|
value: function resumeSchedule(tmodel, key) {
|
|
146
141
|
var remaining = tmodel.getScheduleRemainingTime(key);
|
|
147
|
-
if (!
|
|
142
|
+
if (!TUtil.isDefined(remaining)) {
|
|
148
143
|
return;
|
|
149
144
|
}
|
|
150
|
-
var now =
|
|
145
|
+
var now = TUtil.now();
|
|
151
146
|
var interval = tmodel.getTargetInterval(key);
|
|
152
147
|
tmodel.setScheduleTimeStamp(key, now - Math.max(interval - remaining, 0));
|
|
153
148
|
tmodel.resetScheduleRemainingTime(key);
|
|
@@ -178,4 +173,5 @@ var ScheduleUtil = exports.ScheduleUtil = /*#__PURE__*/function () {
|
|
|
178
173
|
return false;
|
|
179
174
|
}
|
|
180
175
|
}]);
|
|
181
|
-
}();
|
|
176
|
+
}();
|
|
177
|
+
export { ScheduleUtil };
|
package/build/SearchUtil.js
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.SearchUtil = void 0;
|
|
7
|
-
var _TUtil = require("./TUtil.js");
|
|
8
|
-
var _App = require("./App.js");
|
|
9
1
|
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); }
|
|
10
2
|
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
3
|
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; } }
|
|
@@ -16,10 +8,13 @@ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r),
|
|
|
16
8
|
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; }
|
|
17
9
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
18
10
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
11
|
+
import { TUtil } from "./TUtil.js";
|
|
12
|
+
import { tRoot } from "./App.js";
|
|
13
|
+
|
|
19
14
|
/**
|
|
20
15
|
* It provides search functions to find an object by a specific target, type, or oid
|
|
21
16
|
*/
|
|
22
|
-
var SearchUtil =
|
|
17
|
+
var SearchUtil = /*#__PURE__*/function () {
|
|
23
18
|
function SearchUtil() {
|
|
24
19
|
_classCallCheck(this, SearchUtil);
|
|
25
20
|
}
|
|
@@ -127,7 +122,7 @@ var SearchUtil = exports.SearchUtil = /*#__PURE__*/function () {
|
|
|
127
122
|
key: "findParentByType",
|
|
128
123
|
value: function findParentByType(child, type) {
|
|
129
124
|
var indexKey = "".concat(child.oid, "__").concat(type);
|
|
130
|
-
if (!
|
|
125
|
+
if (!TUtil.isDefined(SearchUtil.foundParentWithType[indexKey])) {
|
|
131
126
|
var parent = child.getParent();
|
|
132
127
|
while (parent) {
|
|
133
128
|
if (parent.type === type) {
|
|
@@ -143,11 +138,11 @@ var SearchUtil = exports.SearchUtil = /*#__PURE__*/function () {
|
|
|
143
138
|
key: "findParentByTarget",
|
|
144
139
|
value: function findParentByTarget(child, targetName, targetValue) {
|
|
145
140
|
var indexKey = "".concat(child.oid, "__").concat(targetName);
|
|
146
|
-
if (!
|
|
141
|
+
if (!TUtil.isDefined(SearchUtil.foundParentWithTarget[indexKey])) {
|
|
147
142
|
var parent = child.getParent();
|
|
148
143
|
while (parent) {
|
|
149
|
-
if (
|
|
150
|
-
if (
|
|
144
|
+
if (TUtil.isDefined(parent.targets[targetName]) || TUtil.isDefined(parent.targetValues[targetName])) {
|
|
145
|
+
if (TUtil.isDefined(targetValue)) {
|
|
151
146
|
if (parent.getTargetValue(targetName) === targetValue) {
|
|
152
147
|
SearchUtil.foundParentWithTarget[indexKey] = parent;
|
|
153
148
|
break;
|
|
@@ -165,7 +160,7 @@ var SearchUtil = exports.SearchUtil = /*#__PURE__*/function () {
|
|
|
165
160
|
}, {
|
|
166
161
|
key: "findByType",
|
|
167
162
|
value: function findByType(type) {
|
|
168
|
-
if (!
|
|
163
|
+
if (!TUtil.isDefined(SearchUtil.foundTypeMap[type])) {
|
|
169
164
|
var _search = function search(container) {
|
|
170
165
|
if (container.type === type) {
|
|
171
166
|
return container;
|
|
@@ -190,7 +185,7 @@ var SearchUtil = exports.SearchUtil = /*#__PURE__*/function () {
|
|
|
190
185
|
_iterator.f();
|
|
191
186
|
}
|
|
192
187
|
};
|
|
193
|
-
var tmodel = _search(
|
|
188
|
+
var tmodel = _search(tRoot());
|
|
194
189
|
if (tmodel) {
|
|
195
190
|
SearchUtil.foundTypeMap[type] = tmodel;
|
|
196
191
|
}
|
|
@@ -200,7 +195,7 @@ var SearchUtil = exports.SearchUtil = /*#__PURE__*/function () {
|
|
|
200
195
|
}, {
|
|
201
196
|
key: "findByTarget",
|
|
202
197
|
value: function findByTarget(target) {
|
|
203
|
-
if (!
|
|
198
|
+
if (!TUtil.isDefined(SearchUtil.foundTargetMap[target])) {
|
|
204
199
|
var _search2 = function search(container) {
|
|
205
200
|
if (container.targets[target]) {
|
|
206
201
|
return container;
|
|
@@ -225,7 +220,7 @@ var SearchUtil = exports.SearchUtil = /*#__PURE__*/function () {
|
|
|
225
220
|
_iterator2.f();
|
|
226
221
|
}
|
|
227
222
|
};
|
|
228
|
-
var tmodel = _search2(
|
|
223
|
+
var tmodel = _search2(tRoot());
|
|
229
224
|
if (tmodel) {
|
|
230
225
|
SearchUtil.foundTargetMap[target] = tmodel;
|
|
231
226
|
}
|
|
@@ -235,7 +230,7 @@ var SearchUtil = exports.SearchUtil = /*#__PURE__*/function () {
|
|
|
235
230
|
}, {
|
|
236
231
|
key: "find",
|
|
237
232
|
value: function find(oid) {
|
|
238
|
-
if (!
|
|
233
|
+
if (!TUtil.isDefined(SearchUtil.foundOids[oid])) {
|
|
239
234
|
var _search3 = function search(container) {
|
|
240
235
|
if (container.oid === oid) {
|
|
241
236
|
return container;
|
|
@@ -260,7 +255,7 @@ var SearchUtil = exports.SearchUtil = /*#__PURE__*/function () {
|
|
|
260
255
|
_iterator3.f();
|
|
261
256
|
}
|
|
262
257
|
};
|
|
263
|
-
var tmodel = _search3(
|
|
258
|
+
var tmodel = _search3(tRoot());
|
|
264
259
|
if (tmodel) {
|
|
265
260
|
SearchUtil.foundOids[oid] = tmodel;
|
|
266
261
|
}
|
|
@@ -274,4 +269,5 @@ _defineProperty(SearchUtil, "foundParentWithTarget", {});
|
|
|
274
269
|
_defineProperty(SearchUtil, "foundTypeMap", {});
|
|
275
270
|
_defineProperty(SearchUtil, "foundTargetMap", {});
|
|
276
271
|
_defineProperty(SearchUtil, "foundOids", {});
|
|
277
|
-
_defineProperty(SearchUtil, "foundHandler", {});
|
|
272
|
+
_defineProperty(SearchUtil, "foundHandler", {});
|
|
273
|
+
export { SearchUtil };
|
package/build/TModel.js
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.TModel = void 0;
|
|
7
|
-
var _BaseModel2 = require("./BaseModel.js");
|
|
8
|
-
var _App = require("./App.js");
|
|
9
|
-
var _Viewport = require("./Viewport.js");
|
|
10
|
-
var _TUtil = require("./TUtil.js");
|
|
11
|
-
var _VisibilityUtil = require("./VisibilityUtil.js");
|
|
12
|
-
var _TargetData = require("./TargetData.js");
|
|
13
|
-
var _SearchUtil = require("./SearchUtil.js");
|
|
14
|
-
var _TargetUtil = require("./TargetUtil.js");
|
|
15
|
-
var _TModelUtil = require("./TModelUtil.js");
|
|
16
|
-
var _DomInit = require("./DomInit.js");
|
|
17
1
|
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
18
2
|
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."); }
|
|
19
3
|
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; } }
|
|
@@ -33,11 +17,22 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
33
17
|
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
34
18
|
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
35
19
|
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
20
|
+
import { BaseModel } from "./BaseModel.js";
|
|
21
|
+
import { App, getLocationManager, getRunScheduler, getEvents } from "./App.js";
|
|
22
|
+
import { Viewport } from "./Viewport.js";
|
|
23
|
+
import { TUtil } from "./TUtil.js";
|
|
24
|
+
import { VisibilityUtil } from "./VisibilityUtil.js";
|
|
25
|
+
import { TargetData } from "./TargetData.js";
|
|
26
|
+
import { SearchUtil } from "./SearchUtil.js";
|
|
27
|
+
import { TargetUtil } from "./TargetUtil.js";
|
|
28
|
+
import { TModelUtil } from "./TModelUtil.js";
|
|
29
|
+
import { DomInit } from "./DomInit.js";
|
|
30
|
+
|
|
36
31
|
/**
|
|
37
32
|
* It provides the base class for all objects in an app where targets are defined.
|
|
38
33
|
* These objects typically have a DOM but can also operate without one.
|
|
39
34
|
*/
|
|
40
|
-
var TModel =
|
|
35
|
+
var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
41
36
|
function TModel(type, targets, oid) {
|
|
42
37
|
var _this;
|
|
43
38
|
_classCallCheck(this, TModel);
|
|
@@ -72,7 +67,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
72
67
|
key: "createViewport",
|
|
73
68
|
value: function createViewport() {
|
|
74
69
|
var _this$getParent$$dom$, _this$getParent, _this$getParent$$dom$2, _this$getParent2;
|
|
75
|
-
this.viewport = this.viewport || new
|
|
70
|
+
this.viewport = this.viewport || new Viewport();
|
|
76
71
|
var x = -this.getScrollLeft(),
|
|
77
72
|
y = -this.getScrollTop();
|
|
78
73
|
this.viewport.xNext = x;
|
|
@@ -115,13 +110,13 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
115
110
|
}, {
|
|
116
111
|
key: "calcAbsolutePosition",
|
|
117
112
|
value: function calcAbsolutePosition(x, y) {
|
|
118
|
-
this.absX =
|
|
119
|
-
this.absY =
|
|
113
|
+
this.absX = TUtil.isDefined(this.val('absX')) ? this.val('absX') : this.getParent().absX + x;
|
|
114
|
+
this.absY = TUtil.isDefined(this.val('absY')) ? this.val('absY') : this.getParent().absY + y;
|
|
120
115
|
}
|
|
121
116
|
}, {
|
|
122
117
|
key: "calcAbsolutePositionFromDom",
|
|
123
118
|
value: function calcAbsolutePositionFromDom() {
|
|
124
|
-
|
|
119
|
+
TModelUtil.calcAbsolutePositionFromDom(this);
|
|
125
120
|
}
|
|
126
121
|
}, {
|
|
127
122
|
key: "removeChild",
|
|
@@ -129,15 +124,15 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
129
124
|
if (!child || !this.allChildrenMap[child.oid]) {
|
|
130
125
|
return;
|
|
131
126
|
}
|
|
132
|
-
|
|
127
|
+
TargetUtil.resetBeforeDeletion(child);
|
|
133
128
|
this.deletedChildren.push(child);
|
|
134
129
|
this.removeFromUpdatingChildren(child);
|
|
135
130
|
this.removeFromActiveChildren(child);
|
|
136
131
|
this.removeFromAnimatingChildren(child);
|
|
137
132
|
this.childrenUpdateFlag = true;
|
|
138
|
-
|
|
133
|
+
getLocationManager().calcChildren(this);
|
|
139
134
|
this.markLayoutDirty('removeChild');
|
|
140
|
-
|
|
135
|
+
getRunScheduler().schedule(1, 'removeChild-' + child.oid);
|
|
141
136
|
return this;
|
|
142
137
|
}
|
|
143
138
|
}, {
|
|
@@ -153,7 +148,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
153
148
|
}
|
|
154
149
|
this.childrenUpdateFlag = true;
|
|
155
150
|
this.markLayoutDirty('moveChild');
|
|
156
|
-
|
|
151
|
+
getRunScheduler().schedule(1, 'moveChild-' + this.oid + "-" + child.oid);
|
|
157
152
|
return this;
|
|
158
153
|
}
|
|
159
154
|
}, {
|
|
@@ -167,7 +162,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
167
162
|
var foundKey = Object.keys(this.actualValues).find(function (key) {
|
|
168
163
|
return _this2.actualValues[key] === child;
|
|
169
164
|
});
|
|
170
|
-
var childDefinition =
|
|
165
|
+
var childDefinition = TUtil.cloneTargetDefinition(child);
|
|
171
166
|
if (foundKey) {
|
|
172
167
|
child = new TModel(childDefinition.id || foundKey, childDefinition);
|
|
173
168
|
} else {
|
|
@@ -175,7 +170,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
175
170
|
}
|
|
176
171
|
}
|
|
177
172
|
if (!child.toDiscard) {
|
|
178
|
-
|
|
173
|
+
App.tmodelIdMap[child.oid] = child;
|
|
179
174
|
this.addedChildren.push({
|
|
180
175
|
index: index,
|
|
181
176
|
child: child
|
|
@@ -188,7 +183,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
188
183
|
if (child.activeTargetList.length > 0) {
|
|
189
184
|
this.addToActiveChildren(child);
|
|
190
185
|
}
|
|
191
|
-
|
|
186
|
+
TargetUtil.markChildAction(this, TargetUtil.currentTargetName, child);
|
|
192
187
|
}
|
|
193
188
|
}
|
|
194
189
|
return this;
|
|
@@ -238,7 +233,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
238
233
|
if (_this4.allChildrenMap[child.oid]) {
|
|
239
234
|
return;
|
|
240
235
|
}
|
|
241
|
-
if (!
|
|
236
|
+
if (!TUtil.isDefined(child.val('canDeleteDom')) && _this4.val('canDeleteDom') === false) {
|
|
242
237
|
child.val('canDeleteDom', false);
|
|
243
238
|
}
|
|
244
239
|
if (index >= _this4.allChildrenList.length) {
|
|
@@ -315,7 +310,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
315
310
|
}
|
|
316
311
|
this.markLayoutDirty('removeChildren');
|
|
317
312
|
this.allChildrenList.forEach(function (t) {
|
|
318
|
-
|
|
313
|
+
TargetUtil.resetBeforeDeletion(t);
|
|
319
314
|
t.$dom = undefined;
|
|
320
315
|
});
|
|
321
316
|
this.allChildrenList = [];
|
|
@@ -341,7 +336,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
341
336
|
}, {
|
|
342
337
|
key: "markEventDirty",
|
|
343
338
|
value: function markEventDirty() {
|
|
344
|
-
this.eventDirtyEpoch =
|
|
339
|
+
this.eventDirtyEpoch = getEvents().eventEpoch;
|
|
345
340
|
if (this.bracket) {
|
|
346
341
|
this.bracket.markEventDirty();
|
|
347
342
|
}
|
|
@@ -415,7 +410,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
415
410
|
}, {
|
|
416
411
|
key: "shouldCalculateChildren",
|
|
417
412
|
value: function shouldCalculateChildren() {
|
|
418
|
-
if (
|
|
413
|
+
if (TUtil.isDefined(this.val('calculateChildren'))) {
|
|
419
414
|
return this.val('calculateChildren');
|
|
420
415
|
}
|
|
421
416
|
if (!this.isIncluded() || this.isDomIsland() && !this.hasDom()) {
|
|
@@ -515,7 +510,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
515
510
|
}, {
|
|
516
511
|
key: "getLoadedItems",
|
|
517
512
|
value: function getLoadedItems(targetName) {
|
|
518
|
-
return this.val(
|
|
513
|
+
return this.val(TUtil.getLoadTargetName(targetName));
|
|
519
514
|
}
|
|
520
515
|
}, {
|
|
521
516
|
key: "delVal",
|
|
@@ -532,7 +527,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
532
527
|
value: function val(key, value) {
|
|
533
528
|
var actual = this.actualValues;
|
|
534
529
|
var lastActual = this.lastActualValues;
|
|
535
|
-
key =
|
|
530
|
+
key = TargetUtil.getTargetName(key);
|
|
536
531
|
if (arguments.length === 2) {
|
|
537
532
|
lastActual[key] = actual[key];
|
|
538
533
|
if (value !== actual[key]) {
|
|
@@ -564,7 +559,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
564
559
|
}, {
|
|
565
560
|
key: "getDomParent",
|
|
566
561
|
value: function getDomParent() {
|
|
567
|
-
return this.val('domParent') ||
|
|
562
|
+
return this.val('domParent') || SearchUtil.findParentByTarget(this, 'domHolder', true);
|
|
568
563
|
}
|
|
569
564
|
}, {
|
|
570
565
|
key: "getDomHolder",
|
|
@@ -624,7 +619,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
624
619
|
}, {
|
|
625
620
|
key: "logTree",
|
|
626
621
|
value: function logTree() {
|
|
627
|
-
|
|
622
|
+
TUtil.logTree(this);
|
|
628
623
|
}
|
|
629
624
|
}, {
|
|
630
625
|
key: "isVisible",
|
|
@@ -646,7 +641,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
646
641
|
}, {
|
|
647
642
|
key: "managesOwnScroll",
|
|
648
643
|
value: function managesOwnScroll() {
|
|
649
|
-
if (
|
|
644
|
+
if (TUtil.isDefined(this.val('managesOwnScroll'))) {
|
|
650
645
|
return !!this.val('managesOwnScroll');
|
|
651
646
|
}
|
|
652
647
|
return !!this.allTargetMap['onScroll'] || !!this.allTargetMap['onScrollLeft'] || !!this.allTargetMap['onScrollTop'] || !!this.allTargetMap['onWindowScroll'];
|
|
@@ -654,12 +649,12 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
654
649
|
}, {
|
|
655
650
|
key: "calcVisibility",
|
|
656
651
|
value: function calcVisibility() {
|
|
657
|
-
return
|
|
652
|
+
return VisibilityUtil.calcVisibility(this);
|
|
658
653
|
}
|
|
659
654
|
}, {
|
|
660
655
|
key: "validateVisibilityInParent",
|
|
661
656
|
value: function validateVisibilityInParent() {
|
|
662
|
-
return
|
|
657
|
+
return TUtil.isDefined(this.val('validateVisibilityInParent')) ? this.val('validateVisibilityInParent') : this.parent.managesOwnScroll();
|
|
663
658
|
}
|
|
664
659
|
}, {
|
|
665
660
|
key: "hasDomHolderChanged",
|
|
@@ -674,7 +669,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
674
669
|
}, {
|
|
675
670
|
key: "mount",
|
|
676
671
|
value: function mount(elemTarget) {
|
|
677
|
-
|
|
672
|
+
DomInit.mount(this, elemTarget);
|
|
678
673
|
return this;
|
|
679
674
|
}
|
|
680
675
|
}, {
|
|
@@ -682,7 +677,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
682
677
|
value: function unmount() {
|
|
683
678
|
var _this$parent2;
|
|
684
679
|
if (this.hasDom() && this.val('sourceDom') && this.domState) {
|
|
685
|
-
|
|
680
|
+
DomInit.restoreDomState(this.$dom.element, this.domState);
|
|
686
681
|
}
|
|
687
682
|
(_this$parent2 = this.parent) === null || _this$parent2 === void 0 || _this$parent2.removeChild(this);
|
|
688
683
|
}
|
|
@@ -714,12 +709,12 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
714
709
|
}, {
|
|
715
710
|
key: "useContentWidth",
|
|
716
711
|
value: function useContentWidth() {
|
|
717
|
-
return
|
|
712
|
+
return TModelUtil.useContentWidth(this);
|
|
718
713
|
}
|
|
719
714
|
}, {
|
|
720
715
|
key: "useContentHeight",
|
|
721
716
|
value: function useContentHeight() {
|
|
722
|
-
return
|
|
717
|
+
return TModelUtil.useContentHeight(this);
|
|
723
718
|
}
|
|
724
719
|
}, {
|
|
725
720
|
key: "getBaseWidth",
|
|
@@ -775,12 +770,12 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
775
770
|
}, {
|
|
776
771
|
key: "canBeAnimated",
|
|
777
772
|
value: function canBeAnimated(key) {
|
|
778
|
-
return
|
|
773
|
+
return TargetData.isGpuPreferred(key) && this.actualValues.webAnimation !== false;
|
|
779
774
|
}
|
|
780
775
|
}, {
|
|
781
776
|
key: "isTextOnly",
|
|
782
777
|
value: function isTextOnly() {
|
|
783
|
-
return
|
|
778
|
+
return TUtil.isDefined(this.val('textOnly')) ? this.val('textOnly') : typeof this.getHtml() === 'string' && this.getHtml().trim().startsWith('<') ? false : true;
|
|
784
779
|
}
|
|
785
780
|
}, {
|
|
786
781
|
key: "getHtml",
|
|
@@ -790,7 +785,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
790
785
|
}, {
|
|
791
786
|
key: "isInFlow",
|
|
792
787
|
value: function isInFlow() {
|
|
793
|
-
return
|
|
788
|
+
return TUtil.isDefined(this.val('isInFlow')) ? this.val('isInFlow') : true;
|
|
794
789
|
}
|
|
795
790
|
}, {
|
|
796
791
|
key: "canHandleEvent",
|
|
@@ -800,17 +795,17 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
800
795
|
}, {
|
|
801
796
|
key: "preventDefault",
|
|
802
797
|
value: function preventDefault() {
|
|
803
|
-
return
|
|
798
|
+
return TUtil.isDefined(this.val('preventDefault')) ? this.val('preventDefault') : this.getParentValue('preventDefault') || false;
|
|
804
799
|
}
|
|
805
800
|
}, {
|
|
806
801
|
key: "canDeleteDom",
|
|
807
802
|
value: function canDeleteDom() {
|
|
808
|
-
return
|
|
803
|
+
return TUtil.isDefined(this.val('canDeleteDom')) ? this.val('canDeleteDom') : !this.reuseDomDefinition();
|
|
809
804
|
}
|
|
810
805
|
}, {
|
|
811
806
|
key: "requiresDom",
|
|
812
807
|
value: function requiresDom() {
|
|
813
|
-
return
|
|
808
|
+
return TUtil.isDefined(this.val('requiresDom')) ? this.val('requiresDom') : this.reuseDomDefinition();
|
|
814
809
|
}
|
|
815
810
|
}, {
|
|
816
811
|
key: "excludeStyling",
|
|
@@ -830,7 +825,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
830
825
|
}, {
|
|
831
826
|
key: "shouldBeBracketed",
|
|
832
827
|
value: function shouldBeBracketed() {
|
|
833
|
-
if (
|
|
828
|
+
if (TUtil.isDefined(this.val('shouldBeBracketed'))) {
|
|
834
829
|
return this.val('shouldBeBracketed');
|
|
835
830
|
}
|
|
836
831
|
return this.getChildren().length > this.getBracketThreshold();
|
|
@@ -851,7 +846,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
851
846
|
}, {
|
|
852
847
|
key: "requiresDomRelocation",
|
|
853
848
|
value: function requiresDomRelocation() {
|
|
854
|
-
return
|
|
849
|
+
return TUtil.isDefined(this.val('requiresDomRelocation')) ? this.val('requiresDomRelocation') : !TUtil.isDefined(this.tfMap.x) && !TUtil.isDefined(this.tfMap.y);
|
|
855
850
|
}
|
|
856
851
|
}, {
|
|
857
852
|
key: "getBaseElement",
|
|
@@ -985,10 +980,10 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
985
980
|
}, {
|
|
986
981
|
key: "getWidth",
|
|
987
982
|
value: function getWidth() {
|
|
988
|
-
if (
|
|
983
|
+
if (TUtil.isDefined(this.targets.width) || TUtil.isDefined(this.targetValues.width)) {
|
|
989
984
|
return this.val("width");
|
|
990
985
|
}
|
|
991
|
-
if (
|
|
986
|
+
if (TUtil.isDefined(this.targets.dim) || TUtil.isDefined(this.targetValues.dim)) {
|
|
992
987
|
return this.val("dim");
|
|
993
988
|
}
|
|
994
989
|
return this.val("width");
|
|
@@ -996,10 +991,10 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
996
991
|
}, {
|
|
997
992
|
key: "getHeight",
|
|
998
993
|
value: function getHeight() {
|
|
999
|
-
if (
|
|
994
|
+
if (TUtil.isDefined(this.targets.height) || TUtil.isDefined(this.targetValues.height)) {
|
|
1000
995
|
return this.val("height");
|
|
1001
996
|
}
|
|
1002
|
-
if (
|
|
997
|
+
if (TUtil.isDefined(this.targets.dim) || TUtil.isDefined(this.targetValues.dim)) {
|
|
1003
998
|
return this.val("dim");
|
|
1004
999
|
}
|
|
1005
1000
|
return this.val("height");
|
|
@@ -1062,4 +1057,5 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
1062
1057
|
return this.val('reuseDomDefinition');
|
|
1063
1058
|
}
|
|
1064
1059
|
}]);
|
|
1065
|
-
}(
|
|
1060
|
+
}(BaseModel);
|
|
1061
|
+
export { TModel };
|