targetj 1.0.240 → 1.0.242
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/README.md +108 -68
- package/build/$Dom.js +21 -25
- package/build/AnimationManager.js +40 -45
- package/build/AnimationUtil.js +41 -45
- package/build/App.js +73 -74
- package/build/BaseModel.js +86 -90
- package/build/Bracket.js +7 -21
- 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 +66 -75
- 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 +72 -73
- package/build/ScheduleUtil.js +20 -24
- package/build/SearchUtil.js +16 -20
- package/build/TModel.js +159 -99
- package/build/TModelManager.js +37 -41
- package/build/TModelUtil.js +122 -53
- package/build/TUtil.js +16 -20
- package/build/TargetData.js +40 -45
- package/build/TargetExecutor.js +72 -76
- package/build/TargetManager.js +49 -52
- package/build/TargetParser.js +35 -39
- package/build/TargetUtil.js +28 -31
- package/build/Viewport.js +24 -22
- package/build/VisibilityUtil.js +74 -70
- 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/TargetUtil.js
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.TargetUtil = void 0;
|
|
7
|
-
var _App = require("./App.js");
|
|
8
|
-
var _TUtil = require("./TUtil.js");
|
|
9
|
-
var _TargetData = require("./TargetData.js");
|
|
10
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); }
|
|
11
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; } } }; }
|
|
12
3
|
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
@@ -20,10 +11,14 @@ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o =
|
|
|
20
11
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
21
12
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
22
13
|
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); }
|
|
14
|
+
import { App, getLoader, getLocationManager, getManager } from "./App.js";
|
|
15
|
+
import { TUtil } from "./TUtil.js";
|
|
16
|
+
import { TargetData } from "./TargetData.js";
|
|
17
|
+
|
|
23
18
|
/**
|
|
24
19
|
* It provides helper functions for target management, such as deriving the values for steps, intervals, and cycles from targets.
|
|
25
20
|
*/
|
|
26
|
-
var TargetUtil =
|
|
21
|
+
var TargetUtil = /*#__PURE__*/function () {
|
|
27
22
|
function TargetUtil() {
|
|
28
23
|
_classCallCheck(this, TargetUtil);
|
|
29
24
|
}
|
|
@@ -52,7 +47,7 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
52
47
|
isImperative: false,
|
|
53
48
|
originalTargetName: undefined,
|
|
54
49
|
easing: undefined,
|
|
55
|
-
creationTime:
|
|
50
|
+
creationTime: TUtil.now()
|
|
56
51
|
};
|
|
57
52
|
}
|
|
58
53
|
}, {
|
|
@@ -77,8 +72,8 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
77
72
|
var target = tmodel.targets[key];
|
|
78
73
|
var getPrevValue = function getPrevValue() {
|
|
79
74
|
if (prevKey) {
|
|
80
|
-
if (
|
|
81
|
-
return
|
|
75
|
+
if (getLoader().isLoading(tmodel, prevKey)) {
|
|
76
|
+
return getLoader().getLoadingItemValue(tmodel, prevKey, key);
|
|
82
77
|
} else {
|
|
83
78
|
return tmodel.targetValues[prevKey] ? tmodel.targetValues[prevKey].actual : tmodel.val(prevKey);
|
|
84
79
|
}
|
|
@@ -122,14 +117,14 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
122
117
|
}
|
|
123
118
|
Object.keys(target).forEach(function (method) {
|
|
124
119
|
var originalMethod = target[method];
|
|
125
|
-
var shouldWrap = method === 'value' || typeof originalMethod === 'function' &&
|
|
120
|
+
var shouldWrap = method === 'value' || typeof originalMethod === 'function' && TargetData.isLifeCycleMethod(method);
|
|
126
121
|
if (shouldWrap) {
|
|
127
122
|
if (originalMethod.__isBoundTargetMethod) {
|
|
128
123
|
return;
|
|
129
124
|
}
|
|
130
125
|
var wrappedMethod = function wrappedMethod() {
|
|
131
126
|
var _getPrevUpdateTime;
|
|
132
|
-
if (!
|
|
127
|
+
if (!TargetData.lifecycleCoreSet.has(method)) {
|
|
133
128
|
TargetUtil.currentTargetName = key;
|
|
134
129
|
TargetUtil.currentTModel = tmodel;
|
|
135
130
|
}
|
|
@@ -210,13 +205,13 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
210
205
|
TargetUtil.markPendingTargets(tmodel, key);
|
|
211
206
|
}
|
|
212
207
|
} else {
|
|
213
|
-
while (
|
|
208
|
+
while (getLoader().isNextLoadingItemSuccessful(tmodel, key)) {
|
|
214
209
|
if (tmodel.activatedTargets.indexOf(nextTarget) >= 0) {
|
|
215
210
|
tmodel.activatedTargets.push(nextTarget);
|
|
216
211
|
} else {
|
|
217
212
|
TargetUtil.activateTarget(tmodel, nextTarget);
|
|
218
213
|
}
|
|
219
|
-
|
|
214
|
+
getLoader().nextActiveItem(tmodel, key);
|
|
220
215
|
nextTargetActivated = true;
|
|
221
216
|
}
|
|
222
217
|
}
|
|
@@ -303,7 +298,8 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
303
298
|
key: "cleanupTarget",
|
|
304
299
|
value: function cleanupTarget(tmodel, key) {
|
|
305
300
|
TargetUtil.cleanupVisibleComplete(tmodel, key);
|
|
306
|
-
|
|
301
|
+
var cannotBeCleaned = tmodel.isTargetComplete(key) || !TargetUtil.isTargetFullyCompleted(tmodel, key);
|
|
302
|
+
if (cannotBeCleaned) {
|
|
307
303
|
return false;
|
|
308
304
|
}
|
|
309
305
|
tmodel.setTargetComplete(key);
|
|
@@ -313,7 +309,7 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
313
309
|
tmodel.setTargetMethodName(key, "onComplete");
|
|
314
310
|
}
|
|
315
311
|
var fetchAction = target === null || target === void 0 ? void 0 : target.fetchAction;
|
|
316
|
-
if (fetchAction &&
|
|
312
|
+
if (fetchAction && getLoader().isLoadingSuccessful(tmodel, key)) {
|
|
317
313
|
var index = tmodel.fetchActionTargetList.indexOf(key);
|
|
318
314
|
if (index >= 0) {
|
|
319
315
|
tmodel.fetchActionTargetList.splice(index, 1);
|
|
@@ -417,9 +413,9 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
417
413
|
if (TargetUtil.shouldIgnoreChildForCompletion(tmodel, "visible")) {
|
|
418
414
|
return true;
|
|
419
415
|
}
|
|
420
|
-
return !((_state$updatingTarget = state.updatingTargetList) !== null && _state$updatingTarget !== void 0 && _state$updatingTarget.length) && !((_state$activeTargetLi = state.activeTargetList) !== null && _state$activeTargetLi !== void 0 && _state$activeTargetLi.length) && !((_state$activatedTarge = state.activatedTargets) !== null && _state$activatedTarge !== void 0 && _state$activatedTarge.length) && !tmodel.hasAnimatingTargets() && TargetUtil.isFetchingComplete(tmodel) && TargetUtil.getUpdatingChildren(tmodel, undefined, "visible").size === 0 && TargetUtil.getActiveChildren(tmodel, "visible").size === 0 && !((_state$lastChildrenUp = state.lastChildrenUpdate) !== null && _state$lastChildrenUp !== void 0 && (_state$lastChildrenUp = _state$lastChildrenUp.deletions) !== null && _state$lastChildrenUp !== void 0 && _state$lastChildrenUp.length) && !((_state$lastChildrenUp2 = state.lastChildrenUpdate) !== null && _state$lastChildrenUp2 !== void 0 && (_state$lastChildrenUp2 = _state$lastChildrenUp2.additions) !== null && _state$lastChildrenUp2 !== void 0 && _state$lastChildrenUp2.length) && !tmodel.noDomUpdatingTargets && !tmodel.pendingTargets && !
|
|
416
|
+
return !((_state$updatingTarget = state.updatingTargetList) !== null && _state$updatingTarget !== void 0 && _state$updatingTarget.length) && !((_state$activeTargetLi = state.activeTargetList) !== null && _state$activeTargetLi !== void 0 && _state$activeTargetLi.length) && !((_state$activatedTarge = state.activatedTargets) !== null && _state$activatedTarge !== void 0 && _state$activatedTarge.length) && !tmodel.hasAnimatingTargets() && TargetUtil.isFetchingComplete(tmodel) && TargetUtil.getUpdatingChildren(tmodel, undefined, "visible").size === 0 && TargetUtil.getActiveChildren(tmodel, "visible").size === 0 && !((_state$lastChildrenUp = state.lastChildrenUpdate) !== null && _state$lastChildrenUp !== void 0 && (_state$lastChildrenUp = _state$lastChildrenUp.deletions) !== null && _state$lastChildrenUp !== void 0 && _state$lastChildrenUp.length) && !((_state$lastChildrenUp2 = state.lastChildrenUpdate) !== null && _state$lastChildrenUp2 !== void 0 && (_state$lastChildrenUp2 = _state$lastChildrenUp2.additions) !== null && _state$lastChildrenUp2 !== void 0 && _state$lastChildrenUp2.length) && !tmodel.noDomUpdatingTargets && !tmodel.pendingTargets && !getManager().needsReattach(tmodel);
|
|
421
417
|
}
|
|
422
|
-
return !((_state$updatingTarget2 = state.updatingTargetList) !== null && _state$updatingTarget2 !== void 0 && _state$updatingTarget2.length) && !((_state$activeTargetLi2 = state.activeTargetList) !== null && _state$activeTargetLi2 !== void 0 && _state$activeTargetLi2.length) && !((_state$activatedTarge2 = state.activatedTargets) !== null && _state$activatedTarge2 !== void 0 && _state$activatedTarge2.length) && !tmodel.hasAnimatingTargets() && TargetUtil.isFetchingComplete(tmodel) && !tmodel.hasAnimatingChildren() && !tmodel.hasUpdatingChildren() && !tmodel.hasActiveChildren() && !((_state$lastChildrenUp3 = state.lastChildrenUpdate) !== null && _state$lastChildrenUp3 !== void 0 && (_state$lastChildrenUp3 = _state$lastChildrenUp3.deletions) !== null && _state$lastChildrenUp3 !== void 0 && _state$lastChildrenUp3.length) && !((_state$lastChildrenUp4 = state.lastChildrenUpdate) !== null && _state$lastChildrenUp4 !== void 0 && (_state$lastChildrenUp4 = _state$lastChildrenUp4.additions) !== null && _state$lastChildrenUp4 !== void 0 && _state$lastChildrenUp4.length) && !tmodel.noDomUpdatingTargets && !tmodel.pendingTargets && !
|
|
418
|
+
return !((_state$updatingTarget2 = state.updatingTargetList) !== null && _state$updatingTarget2 !== void 0 && _state$updatingTarget2.length) && !((_state$activeTargetLi2 = state.activeTargetList) !== null && _state$activeTargetLi2 !== void 0 && _state$activeTargetLi2.length) && !((_state$activatedTarge2 = state.activatedTargets) !== null && _state$activatedTarge2 !== void 0 && _state$activatedTarge2.length) && !tmodel.hasAnimatingTargets() && TargetUtil.isFetchingComplete(tmodel) && !tmodel.hasAnimatingChildren() && !tmodel.hasUpdatingChildren() && !tmodel.hasActiveChildren() && !((_state$lastChildrenUp3 = state.lastChildrenUpdate) !== null && _state$lastChildrenUp3 !== void 0 && (_state$lastChildrenUp3 = _state$lastChildrenUp3.deletions) !== null && _state$lastChildrenUp3 !== void 0 && _state$lastChildrenUp3.length) && !((_state$lastChildrenUp4 = state.lastChildrenUpdate) !== null && _state$lastChildrenUp4 !== void 0 && (_state$lastChildrenUp4 = _state$lastChildrenUp4.additions) !== null && _state$lastChildrenUp4 !== void 0 && _state$lastChildrenUp4.length) && !tmodel.noDomUpdatingTargets && !tmodel.pendingTargets && !getManager().needsReattach(tmodel);
|
|
423
419
|
}
|
|
424
420
|
}, {
|
|
425
421
|
key: "isFetchingComplete",
|
|
@@ -434,7 +430,7 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
434
430
|
try {
|
|
435
431
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
436
432
|
var key = _step.value;
|
|
437
|
-
if (!
|
|
433
|
+
if (!getLoader().isLoadingSuccessful(tmodel, key)) {
|
|
438
434
|
return false;
|
|
439
435
|
}
|
|
440
436
|
}
|
|
@@ -476,7 +472,7 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
476
472
|
}
|
|
477
473
|
if (tmodel.isTargetTreeComplete(targetName) !== true) {
|
|
478
474
|
//const activeChildrenList = [ ...TargetUtil.getActiveChildren(tmodel, tmodel.targets[targetName].completionScope).values() ];
|
|
479
|
-
//return tmodel.oid + "." + targetName + " ==> " + tmodel.getTargetStatus(targetName) + ", " +
|
|
475
|
+
//return tmodel.oid + "." + targetName + " ==> " + tmodel.getTargetStatus(targetName) + ", " + TargetUtil.isTargetTreeComplete(tmodel, targetName) + ":: " + activeChildrenList.map(t => t.oid + ':' + t.hasAnyUpdates()) + ", " + [ ...TargetUtil.getUpdatingChildren(tmodel, targetName, tmodel.targets[targetName].completionScope).keys() ];
|
|
480
476
|
return false;
|
|
481
477
|
}
|
|
482
478
|
}
|
|
@@ -490,13 +486,13 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
490
486
|
var _target$childAction, _target$childAction2, _target$childAction3;
|
|
491
487
|
var completionScope = completionScopeOverride !== null && completionScopeOverride !== void 0 ? completionScopeOverride : target.completionScope;
|
|
492
488
|
var targetType = _typeof(target.value);
|
|
493
|
-
if (
|
|
489
|
+
if (TargetData.controlTargetMap[key]) {
|
|
494
490
|
return true;
|
|
495
491
|
}
|
|
496
492
|
if (!target.fetchAction && (targetType === 'string' || targetType === 'number' || targetType === 'boolean')) {
|
|
497
493
|
return true;
|
|
498
494
|
}
|
|
499
|
-
if (
|
|
495
|
+
if (getManager().needsReattach(tmodel)) {
|
|
500
496
|
return "needs Reattach";
|
|
501
497
|
}
|
|
502
498
|
if (tmodel.canHaveDom() && !tmodel.hasDom()) {
|
|
@@ -514,7 +510,7 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
514
510
|
if (((_target$childAction3 = target.childAction) === null || _target$childAction3 === void 0 ? void 0 : _target$childAction3.length) > 0 && TargetUtil.areTargetChildrenComplete(target.childAction, completionScope) !== true) {
|
|
515
511
|
return 'incomplete children';
|
|
516
512
|
}
|
|
517
|
-
if (target.fetchAction && !
|
|
513
|
+
if (target.fetchAction && !getLoader().isLoadingSuccessful(tmodel, key)) {
|
|
518
514
|
return 'incomplete loading';
|
|
519
515
|
}
|
|
520
516
|
}
|
|
@@ -715,7 +711,7 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
715
711
|
}, {
|
|
716
712
|
key: "wrapTarget",
|
|
717
713
|
value: function wrapTarget(tmodel, target, key) {
|
|
718
|
-
if (!
|
|
714
|
+
if (!TargetData.controlTargetMap[key]) {
|
|
719
715
|
tmodel.targets[key] = {
|
|
720
716
|
value: target,
|
|
721
717
|
originalTargetName: TargetUtil.currentTargetName,
|
|
@@ -735,9 +731,9 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
735
731
|
tmodel.clearUpdatingChildren();
|
|
736
732
|
tmodel.clearActiveChildren();
|
|
737
733
|
tmodel.clearAnimatingChildren();
|
|
738
|
-
|
|
739
|
-
if (
|
|
740
|
-
delete
|
|
734
|
+
getLocationManager().domIslandSet.delete(tmodel);
|
|
735
|
+
if (App.tmodelIdMap[tmodel.oid] === tmodel) {
|
|
736
|
+
delete App.tmodelIdMap[tmodel.oid];
|
|
741
737
|
}
|
|
742
738
|
}
|
|
743
739
|
}, {
|
|
@@ -892,4 +888,5 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
|
|
|
892
888
|
};
|
|
893
889
|
}
|
|
894
890
|
}]);
|
|
895
|
-
}();
|
|
891
|
+
}();
|
|
892
|
+
export { TargetUtil };
|
package/build/Viewport.js
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Viewport = void 0;
|
|
7
|
-
var _TModelUtil = require("./TModelUtil.js");
|
|
8
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); }
|
|
9
2
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
10
3
|
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); } }
|
|
11
4
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
12
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
13
6
|
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); }
|
|
7
|
+
import { TModelUtil } from "./TModelUtil.js";
|
|
8
|
+
|
|
14
9
|
/**
|
|
15
10
|
* It calculates the locations and visibility of objects
|
|
16
11
|
*/
|
|
17
|
-
var Viewport =
|
|
12
|
+
var Viewport = /*#__PURE__*/function () {
|
|
18
13
|
function Viewport() {
|
|
19
14
|
_classCallCheck(this, Viewport);
|
|
20
15
|
this.xNext = 0;
|
|
@@ -37,6 +32,11 @@ var Viewport = exports.Viewport = /*#__PURE__*/function () {
|
|
|
37
32
|
this.time = 0;
|
|
38
33
|
}
|
|
39
34
|
return _createClass(Viewport, [{
|
|
35
|
+
key: "setContainer",
|
|
36
|
+
value: function setContainer(container) {
|
|
37
|
+
this.container = container;
|
|
38
|
+
}
|
|
39
|
+
}, {
|
|
40
40
|
key: "setCurrentChild",
|
|
41
41
|
value: function setCurrentChild(child) {
|
|
42
42
|
this.currentChild = child;
|
|
@@ -46,8 +46,8 @@ var Viewport = exports.Viewport = /*#__PURE__*/function () {
|
|
|
46
46
|
value: function setLocation() {
|
|
47
47
|
var child = this.currentChild;
|
|
48
48
|
if (!child.targets['excludeXYCalc']) {
|
|
49
|
-
child.x = this.xNext + child.
|
|
50
|
-
child.y = this.yNext + child.
|
|
49
|
+
child.x = this.xNext + child.getMarginLeft() + this.container.getPaddingLeft();
|
|
50
|
+
child.y = this.yNext + child.getMarginTop() + this.container.getPaddingTop();
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
}, {
|
|
@@ -63,8 +63,9 @@ var Viewport = exports.Viewport = /*#__PURE__*/function () {
|
|
|
63
63
|
}, {
|
|
64
64
|
key: "checkChildOverflow",
|
|
65
65
|
value: function checkChildOverflow() {
|
|
66
|
-
var
|
|
67
|
-
|
|
66
|
+
var child = this.currentChild;
|
|
67
|
+
var childWidth = child.getMinWidth();
|
|
68
|
+
return this.xNext + child.getMarginLeft() + childWidth + child.getMarginRight() > this.xOverflowLimit;
|
|
68
69
|
}
|
|
69
70
|
}, {
|
|
70
71
|
key: "overflow",
|
|
@@ -77,7 +78,7 @@ var Viewport = exports.Viewport = /*#__PURE__*/function () {
|
|
|
77
78
|
value: function appendNewLine() {
|
|
78
79
|
var child = this.currentChild;
|
|
79
80
|
var scale = child.getMeasuringScale();
|
|
80
|
-
var maxHeight = child.getHeight() * scale + this.currentChild.
|
|
81
|
+
var maxHeight = child.getHeight() * scale + this.currentChild.getMarginTop() + this.currentChild.getMarginBottom();
|
|
81
82
|
this.xNext = this.scrollLeft - this.xOverflowReset;
|
|
82
83
|
var ySouth = this.yNext + maxHeight + child.val('appendNewLine');
|
|
83
84
|
this.yEast = this.yNext;
|
|
@@ -98,17 +99,17 @@ var Viewport = exports.Viewport = /*#__PURE__*/function () {
|
|
|
98
99
|
if (space === 'layout') {
|
|
99
100
|
x = child.x;
|
|
100
101
|
y = child.y;
|
|
101
|
-
left = x - child.
|
|
102
|
-
right = x + width + child.
|
|
103
|
-
top = y - child.
|
|
104
|
-
bottom = y + height + child.
|
|
102
|
+
left = x - child.getMarginLeft();
|
|
103
|
+
right = x + width + child.getMarginRight();
|
|
104
|
+
top = y - child.getMarginTop();
|
|
105
|
+
bottom = y + height + child.getMarginBottom();
|
|
105
106
|
} else if (space === 'absolute') {
|
|
106
107
|
x = child.absX - this.absX;
|
|
107
108
|
y = child.absY - this.absY;
|
|
108
109
|
left = x;
|
|
109
|
-
right = x + width + child.
|
|
110
|
+
right = x + width + child.getMarginRight();
|
|
110
111
|
top = y;
|
|
111
|
-
bottom = y + height + child.
|
|
112
|
+
bottom = y + height + child.getMarginBottom();
|
|
112
113
|
} else {
|
|
113
114
|
x = child.getX();
|
|
114
115
|
y = child.getY();
|
|
@@ -130,8 +131,8 @@ var Viewport = exports.Viewport = /*#__PURE__*/function () {
|
|
|
130
131
|
var child = this.currentChild;
|
|
131
132
|
var scale = child.getMeasuringScale();
|
|
132
133
|
var topBaseHeight = child.getTopBaseHeight() * scale;
|
|
133
|
-
var maxHeight = child.
|
|
134
|
-
var maxWidth = child.getItemOverflowMode() === 'always' &&
|
|
134
|
+
var maxHeight = child.getLayoutHeight() * scale + this.currentChild.getMarginTop() + this.currentChild.getMarginBottom();
|
|
135
|
+
var maxWidth = child.getItemOverflowMode() === 'always' && TModelUtil.isWidthDefined(this.container) ? this.container.getWidth() : child.getBaseWidth() * scale + this.currentChild.getMarginLeft() + this.currentChild.getMarginRight();
|
|
135
136
|
if (child.type !== 'BI' && this.container.type === 'BI') {
|
|
136
137
|
var layout = this.computeBoundary(child, 'layout');
|
|
137
138
|
var animated = this.computeBoundary(child, 'animated');
|
|
@@ -162,4 +163,5 @@ var Viewport = exports.Viewport = /*#__PURE__*/function () {
|
|
|
162
163
|
}
|
|
163
164
|
}
|
|
164
165
|
}]);
|
|
165
|
-
}();
|
|
166
|
+
}();
|
|
167
|
+
export { Viewport };
|
package/build/VisibilityUtil.js
CHANGED
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.VisibilityUtil = void 0;
|
|
7
|
-
var _App = require("./App.js");
|
|
8
|
-
var _TUtil = require("./TUtil.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 _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
11
3
|
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); } }
|
|
12
4
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
13
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
14
6
|
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); }
|
|
7
|
+
import { tRoot, getScreenHeight, getScreenWidth } from "./App.js";
|
|
8
|
+
import { TUtil } from "./TUtil.js";
|
|
9
|
+
|
|
15
10
|
/**
|
|
16
11
|
*
|
|
17
12
|
* It provides a variety of helping functions for calculating visibility
|
|
18
13
|
*/
|
|
19
|
-
var VisibilityUtil =
|
|
14
|
+
var VisibilityUtil = /*#__PURE__*/function () {
|
|
20
15
|
function VisibilityUtil() {
|
|
21
16
|
_classCallCheck(this, VisibilityUtil);
|
|
22
17
|
}
|
|
@@ -33,59 +28,56 @@ var VisibilityUtil = exports.VisibilityUtil = /*#__PURE__*/function () {
|
|
|
33
28
|
var scale = (domParent.getMeasuringScale() || 1) * child.getMeasuringScale();
|
|
34
29
|
var x = child.absX;
|
|
35
30
|
var y = child.absY;
|
|
36
|
-
var width =
|
|
37
|
-
var height =
|
|
31
|
+
var width = TUtil.isDefined(child.getWidth()) ? scale * child.getWidth() : 0;
|
|
32
|
+
var height = TUtil.isDefined(child.getHeight()) ? scale * child.getHeight() : 0;
|
|
38
33
|
var visibilityMargin = 20;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
status.left = x + width + visibilityMargin >= clip.x;
|
|
47
|
-
status.bottom = y - child.getTopMargin() - visibilityMargin <= clip.b;
|
|
48
|
-
status.top = y + height + child.getBottomMargin() + visibilityMargin >= clip.y;
|
|
49
|
-
status.clipX = clip.x;
|
|
50
|
-
status.clipY = clip.y;
|
|
51
|
-
status.clipR = clip.r;
|
|
52
|
-
status.clipB = clip.b;
|
|
53
|
-
status.parent = clip.source;
|
|
54
|
-
status.isVisible = status.left && status.right && status.top && status.bottom;
|
|
55
|
-
} else {
|
|
56
|
-
status.right = true;
|
|
57
|
-
status.left = true;
|
|
58
|
-
status.bottom = true;
|
|
59
|
-
status.top = true;
|
|
60
|
-
status.clipX = undefined;
|
|
61
|
-
status.clipY = undefined;
|
|
62
|
-
status.clipR = undefined;
|
|
63
|
-
status.clipB = undefined;
|
|
64
|
-
status.parent = "none";
|
|
65
|
-
status.isVisible = true;
|
|
66
|
-
}
|
|
34
|
+
var rect = {
|
|
35
|
+
x: x - visibilityMargin,
|
|
36
|
+
y: y - visibilityMargin,
|
|
37
|
+
r: x + width + visibilityMargin,
|
|
38
|
+
b: y + height + visibilityMargin
|
|
39
|
+
};
|
|
40
|
+
var status = VisibilityUtil.checkVisibility(child, rect);
|
|
67
41
|
status.x = x;
|
|
68
42
|
status.y = y;
|
|
69
43
|
status.width = width;
|
|
70
44
|
status.height = height;
|
|
45
|
+
child.visibilityStatus = status;
|
|
71
46
|
child.actualValues.isVisible = status.isVisible;
|
|
72
47
|
return status.isVisible;
|
|
73
48
|
}
|
|
74
49
|
}, {
|
|
75
|
-
key: "
|
|
76
|
-
value: function
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
50
|
+
key: "checkVisibility",
|
|
51
|
+
value: function checkVisibility(tmodel, rect) {
|
|
52
|
+
while (tmodel) {
|
|
53
|
+
var parent = tmodel.getRealParent();
|
|
54
|
+
if (!parent || parent === tRoot()) {
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
if (VisibilityUtil.shouldClipByAncestor(parent)) {
|
|
58
|
+
var _clip = VisibilityUtil.getParentClip(parent);
|
|
59
|
+
var _isVisible = VisibilityUtil.rectsOverlap(rect, _clip);
|
|
60
|
+
if (!_isVisible) {
|
|
61
|
+
return {
|
|
62
|
+
clip: _clip,
|
|
63
|
+
isVisible: false
|
|
64
|
+
};
|
|
84
65
|
}
|
|
66
|
+
rect = VisibilityUtil.intersectRects(parent, rect, _clip);
|
|
85
67
|
}
|
|
86
|
-
|
|
68
|
+
tmodel = parent;
|
|
87
69
|
}
|
|
88
|
-
|
|
70
|
+
var clip = VisibilityUtil.getScreenViewportRect();
|
|
71
|
+
var isVisible = VisibilityUtil.rectsOverlap(rect, clip);
|
|
72
|
+
if (!isVisible) {
|
|
73
|
+
return {
|
|
74
|
+
clip: clip,
|
|
75
|
+
isVisible: false
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
isVisible: true
|
|
80
|
+
};
|
|
89
81
|
}
|
|
90
82
|
}, {
|
|
91
83
|
key: "getScreenViewportRect",
|
|
@@ -93,40 +85,52 @@ var VisibilityUtil = exports.VisibilityUtil = /*#__PURE__*/function () {
|
|
|
93
85
|
return {
|
|
94
86
|
x: 0,
|
|
95
87
|
y: 0,
|
|
96
|
-
r:
|
|
97
|
-
b:
|
|
88
|
+
r: getScreenWidth(),
|
|
89
|
+
b: getScreenHeight(),
|
|
98
90
|
source: "screen"
|
|
99
91
|
};
|
|
100
92
|
}
|
|
101
93
|
}, {
|
|
102
94
|
key: "shouldClipByAncestor",
|
|
103
95
|
value: function shouldClipByAncestor(ancestor) {
|
|
104
|
-
|
|
96
|
+
var overflow = ancestor.val("overflow");
|
|
97
|
+
return ancestor.managesOwnScroll() || overflow === "hidden" || overflow === "auto" || overflow === "scroll" || overflow === "clip";
|
|
105
98
|
}
|
|
106
99
|
}, {
|
|
107
|
-
key: "
|
|
108
|
-
value: function
|
|
109
|
-
var
|
|
110
|
-
var domScrollLeft = ((
|
|
111
|
-
var domScrollTop = ((
|
|
100
|
+
key: "getParentClip",
|
|
101
|
+
value: function getParentClip(parent) {
|
|
102
|
+
var _parent$$dom, _parent$$dom2;
|
|
103
|
+
var domScrollLeft = ((_parent$$dom = parent.$dom) === null || _parent$$dom === void 0 ? void 0 : _parent$$dom.getScrollLeft()) || 0;
|
|
104
|
+
var domScrollTop = ((_parent$$dom2 = parent.$dom) === null || _parent$$dom2 === void 0 ? void 0 : _parent$$dom2.getScrollTop()) || 0;
|
|
105
|
+
var height = parent.getHeight();
|
|
106
|
+
var width = parent.getWidth();
|
|
112
107
|
return {
|
|
113
|
-
x:
|
|
114
|
-
y:
|
|
115
|
-
r:
|
|
116
|
-
b:
|
|
117
|
-
source:
|
|
108
|
+
x: parent.absX + domScrollLeft,
|
|
109
|
+
y: parent.absY + domScrollTop,
|
|
110
|
+
r: parent.absX + width + domScrollLeft,
|
|
111
|
+
b: parent.absY + height + domScrollTop,
|
|
112
|
+
source: parent
|
|
118
113
|
};
|
|
119
114
|
}
|
|
120
115
|
}, {
|
|
121
|
-
key: "
|
|
122
|
-
value: function
|
|
116
|
+
key: "rectsOverlap",
|
|
117
|
+
value: function rectsOverlap(a, b) {
|
|
118
|
+
return a.x <= b.r && a.r >= b.x && a.y <= b.b && a.b >= b.y;
|
|
119
|
+
}
|
|
120
|
+
}, {
|
|
121
|
+
key: "intersectRects",
|
|
122
|
+
value: function intersectRects(parent, a, b) {
|
|
123
|
+
var _parent$$dom3, _parent$$dom4;
|
|
124
|
+
var domScrollLeft = ((_parent$$dom3 = parent.$dom) === null || _parent$$dom3 === void 0 ? void 0 : _parent$$dom3.getScrollLeft()) || 0;
|
|
125
|
+
var domScrollTop = ((_parent$$dom4 = parent.$dom) === null || _parent$$dom4 === void 0 ? void 0 : _parent$$dom4.getScrollTop()) || 0;
|
|
123
126
|
return {
|
|
124
|
-
x: Math.max(a.x, b.x),
|
|
125
|
-
y: Math.max(a.y, b.y),
|
|
126
|
-
r: Math.min(a.r, b.r),
|
|
127
|
-
b: Math.min(a.b, b.b),
|
|
127
|
+
x: Math.max(a.x - domScrollLeft, b.x - domScrollLeft),
|
|
128
|
+
y: Math.max(a.y - domScrollTop, b.y - domScrollTop),
|
|
129
|
+
r: Math.min(a.r - domScrollLeft, b.r - domScrollLeft),
|
|
130
|
+
b: Math.min(a.b - domScrollTop, b.b - domScrollTop),
|
|
128
131
|
source: b.source
|
|
129
132
|
};
|
|
130
133
|
}
|
|
131
134
|
}]);
|
|
132
|
-
}();
|
|
135
|
+
}();
|
|
136
|
+
export { VisibilityUtil };
|