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/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);
|
|
@@ -71,17 +66,18 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
71
66
|
return _createClass(TModel, [{
|
|
72
67
|
key: "createViewport",
|
|
73
68
|
value: function createViewport() {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
var
|
|
77
|
-
|
|
69
|
+
this.viewport = this.viewport || new Viewport();
|
|
70
|
+
var scrollTop = this.getScrollTop();
|
|
71
|
+
var scrollLeft = this.getScrollLeft();
|
|
72
|
+
var x = -scrollLeft,
|
|
73
|
+
y = -scrollTop;
|
|
78
74
|
this.viewport.xNext = x;
|
|
79
75
|
this.viewport.xNorth = x;
|
|
80
76
|
this.viewport.xEast = x;
|
|
81
77
|
this.viewport.xSouth = x;
|
|
82
78
|
this.viewport.xWest = x;
|
|
83
|
-
this.viewport.scrollLeft =
|
|
84
|
-
this.viewport.scrollTop =
|
|
79
|
+
this.viewport.scrollLeft = x;
|
|
80
|
+
this.viewport.scrollTop = y;
|
|
85
81
|
this.viewport.absX = this.absX;
|
|
86
82
|
this.viewport.absY = this.absY;
|
|
87
83
|
this.viewport.xOverflowReset = x;
|
|
@@ -92,22 +88,16 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
92
88
|
this.viewport.yEast = y;
|
|
93
89
|
this.viewport.ySouth = y;
|
|
94
90
|
this.calcContentWidthHeight();
|
|
95
|
-
this.viewport.
|
|
91
|
+
this.viewport.setContainer(this);
|
|
96
92
|
return this.viewport;
|
|
97
93
|
}
|
|
98
94
|
}, {
|
|
99
95
|
key: "calcContentWidthHeight",
|
|
100
96
|
value: function calcContentWidthHeight() {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if (contentHeight !== this.contentHeight || this.contentWidth !== contentWidth || this.topBaseHeight !== topBaseHeight || this.bottomBaseWidth !== bottomBaseWidth) {
|
|
106
|
-
this.contentHeight = contentHeight;
|
|
107
|
-
this.topBaseHeight = topBaseHeight;
|
|
108
|
-
this.bottomBaseWidth = bottomBaseWidth;
|
|
109
|
-
this.contentWidth = contentWidth;
|
|
110
|
-
}
|
|
97
|
+
this.contentHeight = this.viewport.ySouth - this.viewport.yNorth;
|
|
98
|
+
this.contentWidth = this.viewport.xEast - this.viewport.xWest;
|
|
99
|
+
this.topBaseHeight = this.viewport.yEast - this.viewport.yNorth;
|
|
100
|
+
this.bottomBaseWidth = this.viewport.xSouth - this.viewport.xWest;
|
|
111
101
|
}
|
|
112
102
|
}, {
|
|
113
103
|
key: "adjustViewport",
|
|
@@ -115,13 +105,13 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
115
105
|
}, {
|
|
116
106
|
key: "calcAbsolutePosition",
|
|
117
107
|
value: function calcAbsolutePosition(x, y) {
|
|
118
|
-
this.absX =
|
|
119
|
-
this.absY =
|
|
108
|
+
this.absX = TUtil.isDefined(this.val('absX')) ? this.val('absX') : this.getParent().absX + x;
|
|
109
|
+
this.absY = TUtil.isDefined(this.val('absY')) ? this.val('absY') : this.getParent().absY + y;
|
|
120
110
|
}
|
|
121
111
|
}, {
|
|
122
112
|
key: "calcAbsolutePositionFromDom",
|
|
123
113
|
value: function calcAbsolutePositionFromDom() {
|
|
124
|
-
|
|
114
|
+
TModelUtil.calcAbsolutePositionFromDom(this);
|
|
125
115
|
}
|
|
126
116
|
}, {
|
|
127
117
|
key: "removeChild",
|
|
@@ -129,15 +119,15 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
129
119
|
if (!child || !this.allChildrenMap[child.oid]) {
|
|
130
120
|
return;
|
|
131
121
|
}
|
|
132
|
-
|
|
122
|
+
TargetUtil.resetBeforeDeletion(child);
|
|
133
123
|
this.deletedChildren.push(child);
|
|
134
124
|
this.removeFromUpdatingChildren(child);
|
|
135
125
|
this.removeFromActiveChildren(child);
|
|
136
126
|
this.removeFromAnimatingChildren(child);
|
|
137
127
|
this.childrenUpdateFlag = true;
|
|
138
|
-
|
|
128
|
+
getLocationManager().calcChildren(this);
|
|
139
129
|
this.markLayoutDirty('removeChild');
|
|
140
|
-
|
|
130
|
+
getRunScheduler().schedule(1, 'removeChild-' + child.oid);
|
|
141
131
|
return this;
|
|
142
132
|
}
|
|
143
133
|
}, {
|
|
@@ -153,7 +143,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
153
143
|
}
|
|
154
144
|
this.childrenUpdateFlag = true;
|
|
155
145
|
this.markLayoutDirty('moveChild');
|
|
156
|
-
|
|
146
|
+
getRunScheduler().schedule(1, 'moveChild-' + this.oid + "-" + child.oid);
|
|
157
147
|
return this;
|
|
158
148
|
}
|
|
159
149
|
}, {
|
|
@@ -167,7 +157,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
167
157
|
var foundKey = Object.keys(this.actualValues).find(function (key) {
|
|
168
158
|
return _this2.actualValues[key] === child;
|
|
169
159
|
});
|
|
170
|
-
var childDefinition =
|
|
160
|
+
var childDefinition = TUtil.cloneTargetDefinition(child);
|
|
171
161
|
if (foundKey) {
|
|
172
162
|
child = new TModel(childDefinition.id || foundKey, childDefinition);
|
|
173
163
|
} else {
|
|
@@ -175,7 +165,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
175
165
|
}
|
|
176
166
|
}
|
|
177
167
|
if (!child.toDiscard) {
|
|
178
|
-
|
|
168
|
+
App.tmodelIdMap[child.oid] = child;
|
|
179
169
|
this.addedChildren.push({
|
|
180
170
|
index: index,
|
|
181
171
|
child: child
|
|
@@ -188,7 +178,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
188
178
|
if (child.activeTargetList.length > 0) {
|
|
189
179
|
this.addToActiveChildren(child);
|
|
190
180
|
}
|
|
191
|
-
|
|
181
|
+
TargetUtil.markChildAction(this, TargetUtil.currentTargetName, child);
|
|
192
182
|
}
|
|
193
183
|
}
|
|
194
184
|
return this;
|
|
@@ -238,7 +228,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
238
228
|
if (_this4.allChildrenMap[child.oid]) {
|
|
239
229
|
return;
|
|
240
230
|
}
|
|
241
|
-
if (!
|
|
231
|
+
if (!TUtil.isDefined(child.val('canDeleteDom')) && _this4.val('canDeleteDom') === false) {
|
|
242
232
|
child.val('canDeleteDom', false);
|
|
243
233
|
}
|
|
244
234
|
if (index >= _this4.allChildrenList.length) {
|
|
@@ -315,7 +305,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
315
305
|
}
|
|
316
306
|
this.markLayoutDirty('removeChildren');
|
|
317
307
|
this.allChildrenList.forEach(function (t) {
|
|
318
|
-
|
|
308
|
+
TargetUtil.resetBeforeDeletion(t);
|
|
319
309
|
t.$dom = undefined;
|
|
320
310
|
});
|
|
321
311
|
this.allChildrenList = [];
|
|
@@ -341,7 +331,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
341
331
|
}, {
|
|
342
332
|
key: "markEventDirty",
|
|
343
333
|
value: function markEventDirty() {
|
|
344
|
-
this.eventDirtyEpoch =
|
|
334
|
+
this.eventDirtyEpoch = getEvents().eventEpoch;
|
|
345
335
|
if (this.bracket) {
|
|
346
336
|
this.bracket.markEventDirty();
|
|
347
337
|
}
|
|
@@ -415,7 +405,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
415
405
|
}, {
|
|
416
406
|
key: "shouldCalculateChildren",
|
|
417
407
|
value: function shouldCalculateChildren() {
|
|
418
|
-
if (
|
|
408
|
+
if (TUtil.isDefined(this.val('calculateChildren'))) {
|
|
419
409
|
return this.val('calculateChildren');
|
|
420
410
|
}
|
|
421
411
|
if (!this.isIncluded() || this.isDomIsland() && !this.hasDom()) {
|
|
@@ -504,8 +494,8 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
504
494
|
value: function getParentValueAtMyIndex(targetName) {
|
|
505
495
|
var parentValue = this.getParentValue(targetName);
|
|
506
496
|
if (Array.isArray(parentValue)) {
|
|
507
|
-
var _this$
|
|
508
|
-
var index = (_this$
|
|
497
|
+
var _this$getParent;
|
|
498
|
+
var index = (_this$getParent = this.getParent()) === null || _this$getParent === void 0 ? void 0 : _this$getParent.getChildIndex(this);
|
|
509
499
|
if (typeof index === 'number') {
|
|
510
500
|
return parentValue[index];
|
|
511
501
|
}
|
|
@@ -515,7 +505,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
515
505
|
}, {
|
|
516
506
|
key: "getLoadedItems",
|
|
517
507
|
value: function getLoadedItems(targetName) {
|
|
518
|
-
return this.val(
|
|
508
|
+
return this.val(TUtil.getLoadTargetName(targetName));
|
|
519
509
|
}
|
|
520
510
|
}, {
|
|
521
511
|
key: "delVal",
|
|
@@ -532,7 +522,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
532
522
|
value: function val(key, value) {
|
|
533
523
|
var actual = this.actualValues;
|
|
534
524
|
var lastActual = this.lastActualValues;
|
|
535
|
-
key =
|
|
525
|
+
key = TargetUtil.getTargetName(key);
|
|
536
526
|
if (arguments.length === 2) {
|
|
537
527
|
lastActual[key] = actual[key];
|
|
538
528
|
if (value !== actual[key]) {
|
|
@@ -564,7 +554,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
564
554
|
}, {
|
|
565
555
|
key: "getDomParent",
|
|
566
556
|
value: function getDomParent() {
|
|
567
|
-
return this.val('domParent') ||
|
|
557
|
+
return this.val('domParent') || SearchUtil.findParentByTarget(this, 'domHolder', true);
|
|
568
558
|
}
|
|
569
559
|
}, {
|
|
570
560
|
key: "getDomHolder",
|
|
@@ -577,8 +567,9 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
577
567
|
return domParent ? domParent.$dom : null;
|
|
578
568
|
}
|
|
579
569
|
}, {
|
|
580
|
-
key: "
|
|
581
|
-
value: function
|
|
570
|
+
key: "debug",
|
|
571
|
+
value: function debug() {
|
|
572
|
+
var _this6 = this;
|
|
582
573
|
return [{
|
|
583
574
|
visible: this.isVisible()
|
|
584
575
|
}, {
|
|
@@ -593,6 +584,8 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
593
584
|
width: this.getWidth()
|
|
594
585
|
}, {
|
|
595
586
|
height: this.getHeight()
|
|
587
|
+
}, {
|
|
588
|
+
tmodelComplete: TargetUtil.isTModelComplete(this)
|
|
596
589
|
}, {
|
|
597
590
|
targets: this.originalTargetNames
|
|
598
591
|
}, {
|
|
@@ -609,6 +602,14 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
609
602
|
styleTargetMap: _toConsumableArray(this.styleTargetMap ? _toConsumableArray(this.styleTargetMap.keys()) : [])
|
|
610
603
|
}, {
|
|
611
604
|
passiveTargetList: this.passiveTargetList
|
|
605
|
+
}, {
|
|
606
|
+
incompleteTargets: Object.keys(this.targetValues).filter(function (key) {
|
|
607
|
+
var _this6$targetValues$k;
|
|
608
|
+
return ((_this6$targetValues$k = _this6.targetValues[key]) === null || _this6$targetValues$k === void 0 ? void 0 : _this6$targetValues$k.status) !== 'complete';
|
|
609
|
+
}).map(function (key) {
|
|
610
|
+
var _this6$targetValues$k2;
|
|
611
|
+
return "".concat(key, ":").concat((_this6$targetValues$k2 = _this6.targetValues[key]) === null || _this6$targetValues$k2 === void 0 ? void 0 : _this6$targetValues$k2.status);
|
|
612
|
+
})
|
|
612
613
|
}, {
|
|
613
614
|
updatingChildren: this.updatingChildrenMap ? _toConsumableArray(this.updatingChildrenMap.keys()) : []
|
|
614
615
|
}, {
|
|
@@ -624,7 +625,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
624
625
|
}, {
|
|
625
626
|
key: "logTree",
|
|
626
627
|
value: function logTree() {
|
|
627
|
-
|
|
628
|
+
TUtil.logTree(this);
|
|
628
629
|
}
|
|
629
630
|
}, {
|
|
630
631
|
key: "isVisible",
|
|
@@ -646,20 +647,21 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
646
647
|
}, {
|
|
647
648
|
key: "managesOwnScroll",
|
|
648
649
|
value: function managesOwnScroll() {
|
|
649
|
-
|
|
650
|
+
var _this$$dom$getScrollT, _this$$dom, _this$$dom$getScrollL, _this$$dom2;
|
|
651
|
+
if (TUtil.isDefined(this.val('managesOwnScroll'))) {
|
|
650
652
|
return !!this.val('managesOwnScroll');
|
|
651
653
|
}
|
|
652
|
-
return !!this.allTargetMap['onScroll'] || !!this.allTargetMap['onScrollLeft'] || !!this.allTargetMap['onScrollTop'] || !!this.allTargetMap['onWindowScroll'];
|
|
654
|
+
return !!this.allTargetMap['onScroll'] || !!this.allTargetMap['onScrollLeft'] || !!this.allTargetMap['onScrollTop'] || !!this.allTargetMap['onWindowScroll'] || ((_this$$dom$getScrollT = (_this$$dom = this.$dom) === null || _this$$dom === void 0 ? void 0 : _this$$dom.getScrollTop()) !== null && _this$$dom$getScrollT !== void 0 ? _this$$dom$getScrollT : 0) !== 0 || ((_this$$dom$getScrollL = (_this$$dom2 = this.$dom) === null || _this$$dom2 === void 0 ? void 0 : _this$$dom2.getScrollLeft()) !== null && _this$$dom$getScrollL !== void 0 ? _this$$dom$getScrollL : 0) !== 0;
|
|
653
655
|
}
|
|
654
656
|
}, {
|
|
655
657
|
key: "calcVisibility",
|
|
656
658
|
value: function calcVisibility() {
|
|
657
|
-
return
|
|
659
|
+
return VisibilityUtil.calcVisibility(this);
|
|
658
660
|
}
|
|
659
661
|
}, {
|
|
660
662
|
key: "validateVisibilityInParent",
|
|
661
663
|
value: function validateVisibilityInParent() {
|
|
662
|
-
return
|
|
664
|
+
return TUtil.isDefined(this.val('validateVisibilityInParent')) ? this.val('validateVisibilityInParent') : this.parent.managesOwnScroll();
|
|
663
665
|
}
|
|
664
666
|
}, {
|
|
665
667
|
key: "hasDomHolderChanged",
|
|
@@ -674,7 +676,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
674
676
|
}, {
|
|
675
677
|
key: "mount",
|
|
676
678
|
value: function mount(elemTarget) {
|
|
677
|
-
|
|
679
|
+
DomInit.mount(this, elemTarget);
|
|
678
680
|
return this;
|
|
679
681
|
}
|
|
680
682
|
}, {
|
|
@@ -682,7 +684,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
682
684
|
value: function unmount() {
|
|
683
685
|
var _this$parent2;
|
|
684
686
|
if (this.hasDom() && this.val('sourceDom') && this.domState) {
|
|
685
|
-
|
|
687
|
+
DomInit.restoreDomState(this.$dom.element, this.domState);
|
|
686
688
|
}
|
|
687
689
|
(_this$parent2 = this.parent) === null || _this$parent2 === void 0 || _this$parent2.removeChild(this);
|
|
688
690
|
}
|
|
@@ -714,12 +716,12 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
714
716
|
}, {
|
|
715
717
|
key: "useContentWidth",
|
|
716
718
|
value: function useContentWidth() {
|
|
717
|
-
return
|
|
719
|
+
return TModelUtil.useContentWidth(this);
|
|
718
720
|
}
|
|
719
721
|
}, {
|
|
720
722
|
key: "useContentHeight",
|
|
721
723
|
value: function useContentHeight() {
|
|
722
|
-
return
|
|
724
|
+
return TModelUtil.useContentHeight(this);
|
|
723
725
|
}
|
|
724
726
|
}, {
|
|
725
727
|
key: "getBaseWidth",
|
|
@@ -745,11 +747,40 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
745
747
|
var _this$val5;
|
|
746
748
|
return (_this$val5 = this.val('topBaseHeight')) !== null && _this$val5 !== void 0 ? _this$val5 : 0;
|
|
747
749
|
}
|
|
750
|
+
}, {
|
|
751
|
+
key: "getLayoutHeight",
|
|
752
|
+
value: function getLayoutHeight() {
|
|
753
|
+
var height = this.getHeight();
|
|
754
|
+
if (this.usesContentBoxSizing()) {
|
|
755
|
+
height += this.getPaddingTop() + this.getPaddingBottom();
|
|
756
|
+
}
|
|
757
|
+
return height;
|
|
758
|
+
}
|
|
759
|
+
}, {
|
|
760
|
+
key: "getLayoutWidth",
|
|
761
|
+
value: function getLayoutWidth() {
|
|
762
|
+
var width = this.getWidth();
|
|
763
|
+
if (this.usesContentBoxSizing()) {
|
|
764
|
+
width += this.getPaddingLeft() + this.getPaddingRight();
|
|
765
|
+
}
|
|
766
|
+
return width;
|
|
767
|
+
}
|
|
768
|
+
}, {
|
|
769
|
+
key: "usesContentBoxSizing",
|
|
770
|
+
value: function usesContentBoxSizing() {
|
|
771
|
+
return this.getBoxSizing() !== "border-box";
|
|
772
|
+
}
|
|
773
|
+
}, {
|
|
774
|
+
key: "getBoxSizing",
|
|
775
|
+
value: function getBoxSizing() {
|
|
776
|
+
var _ref5, _ref6, _this$val6;
|
|
777
|
+
return (_ref5 = (_ref6 = (_this$val6 = this.val("boxSizing")) !== null && _this$val6 !== void 0 ? _this$val6 : this.val("box-sizing")) !== null && _ref6 !== void 0 ? _ref6 : this.getParentValue("boxSizing")) !== null && _ref5 !== void 0 ? _ref5 : "content-box";
|
|
778
|
+
}
|
|
748
779
|
}, {
|
|
749
780
|
key: "getContainerOverflowMode",
|
|
750
781
|
value: function getContainerOverflowMode() {
|
|
751
|
-
var _this$
|
|
752
|
-
return (_this$
|
|
782
|
+
var _this$val7;
|
|
783
|
+
return (_this$val7 = this.val('containerOverflowMode')) !== null && _this$val7 !== void 0 ? _this$val7 : 'auto';
|
|
753
784
|
}
|
|
754
785
|
}, {
|
|
755
786
|
key: "getItemOverflowMode",
|
|
@@ -775,12 +806,12 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
775
806
|
}, {
|
|
776
807
|
key: "canBeAnimated",
|
|
777
808
|
value: function canBeAnimated(key) {
|
|
778
|
-
return
|
|
809
|
+
return TargetData.isGpuPreferred(key) && this.actualValues.webAnimation !== false;
|
|
779
810
|
}
|
|
780
811
|
}, {
|
|
781
812
|
key: "isTextOnly",
|
|
782
813
|
value: function isTextOnly() {
|
|
783
|
-
return
|
|
814
|
+
return TUtil.isDefined(this.val('textOnly')) ? this.val('textOnly') : typeof this.getHtml() === 'string' && this.getHtml().trim().startsWith('<') ? false : true;
|
|
784
815
|
}
|
|
785
816
|
}, {
|
|
786
817
|
key: "getHtml",
|
|
@@ -790,7 +821,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
790
821
|
}, {
|
|
791
822
|
key: "isInFlow",
|
|
792
823
|
value: function isInFlow() {
|
|
793
|
-
return
|
|
824
|
+
return TUtil.isDefined(this.val('isInFlow')) ? this.val('isInFlow') : true;
|
|
794
825
|
}
|
|
795
826
|
}, {
|
|
796
827
|
key: "canHandleEvent",
|
|
@@ -800,17 +831,17 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
800
831
|
}, {
|
|
801
832
|
key: "preventDefault",
|
|
802
833
|
value: function preventDefault() {
|
|
803
|
-
return
|
|
834
|
+
return TUtil.isDefined(this.val('preventDefault')) ? this.val('preventDefault') : this.getParentValue('preventDefault') || false;
|
|
804
835
|
}
|
|
805
836
|
}, {
|
|
806
837
|
key: "canDeleteDom",
|
|
807
838
|
value: function canDeleteDom() {
|
|
808
|
-
return
|
|
839
|
+
return TUtil.isDefined(this.val('canDeleteDom')) ? this.val('canDeleteDom') : !this.reuseDomDefinition();
|
|
809
840
|
}
|
|
810
841
|
}, {
|
|
811
842
|
key: "requiresDom",
|
|
812
843
|
value: function requiresDom() {
|
|
813
|
-
return
|
|
844
|
+
return TUtil.isDefined(this.val('requiresDom')) ? this.val('requiresDom') : this.reuseDomDefinition();
|
|
814
845
|
}
|
|
815
846
|
}, {
|
|
816
847
|
key: "excludeStyling",
|
|
@@ -830,7 +861,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
830
861
|
}, {
|
|
831
862
|
key: "shouldBeBracketed",
|
|
832
863
|
value: function shouldBeBracketed() {
|
|
833
|
-
if (
|
|
864
|
+
if (TUtil.isDefined(this.val('shouldBeBracketed'))) {
|
|
834
865
|
return this.val('shouldBeBracketed');
|
|
835
866
|
}
|
|
836
867
|
return this.getChildren().length > this.getBracketThreshold();
|
|
@@ -851,13 +882,13 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
851
882
|
}, {
|
|
852
883
|
key: "requiresDomRelocation",
|
|
853
884
|
value: function requiresDomRelocation() {
|
|
854
|
-
return
|
|
885
|
+
return TUtil.isDefined(this.val('requiresDomRelocation')) ? this.val('requiresDomRelocation') : !TUtil.isDefined(this.tfMap.x) && !TUtil.isDefined(this.tfMap.y);
|
|
855
886
|
}
|
|
856
887
|
}, {
|
|
857
888
|
key: "getBaseElement",
|
|
858
889
|
value: function getBaseElement() {
|
|
859
|
-
var _this$$
|
|
860
|
-
return this.val('baseElement') || this.val('element') || ((_this$$
|
|
890
|
+
var _this$$dom3;
|
|
891
|
+
return this.val('baseElement') || this.val('element') || ((_this$$dom3 = this.$dom) === null || _this$$dom3 === void 0 || (_this$$dom3 = _this$$dom3.element) === null || _this$$dom3 === void 0 || (_this$$dom3 = _this$$dom3.tagName) === null || _this$$dom3 === void 0 ? void 0 : _this$$dom3.toLowerCase());
|
|
861
892
|
}
|
|
862
893
|
}, {
|
|
863
894
|
key: "getOpacity",
|
|
@@ -952,8 +983,8 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
952
983
|
}, {
|
|
953
984
|
key: "getMeasuringScale",
|
|
954
985
|
value: function getMeasuringScale() {
|
|
955
|
-
var _this$
|
|
956
|
-
return (_this$
|
|
986
|
+
var _this$val8;
|
|
987
|
+
return (_this$val8 = this.val('measuringScale')) !== null && _this$val8 !== void 0 ? _this$val8 : 1;
|
|
957
988
|
}
|
|
958
989
|
}, {
|
|
959
990
|
key: "getZIndex",
|
|
@@ -961,34 +992,62 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
961
992
|
return this.val('zIndex');
|
|
962
993
|
}
|
|
963
994
|
}, {
|
|
964
|
-
key: "
|
|
965
|
-
value: function
|
|
966
|
-
|
|
995
|
+
key: "getMarginTop",
|
|
996
|
+
value: function getMarginTop() {
|
|
997
|
+
var _ref7, _this$val9;
|
|
998
|
+
return (_ref7 = (_this$val9 = this.val("marginTop")) !== null && _this$val9 !== void 0 ? _this$val9 : this.val("topMargin")) !== null && _ref7 !== void 0 ? _ref7 : TModelUtil.getMarginValue(this, "top");
|
|
999
|
+
}
|
|
1000
|
+
}, {
|
|
1001
|
+
key: "getMarginLeft",
|
|
1002
|
+
value: function getMarginLeft() {
|
|
1003
|
+
var _ref8, _this$val10;
|
|
1004
|
+
return (_ref8 = (_this$val10 = this.val("marginLeft")) !== null && _this$val10 !== void 0 ? _this$val10 : this.val("leftMargin")) !== null && _ref8 !== void 0 ? _ref8 : TModelUtil.getMarginValue(this, "left");
|
|
1005
|
+
}
|
|
1006
|
+
}, {
|
|
1007
|
+
key: "getMarginRight",
|
|
1008
|
+
value: function getMarginRight() {
|
|
1009
|
+
var _ref9, _this$val11, _this$getParentValue;
|
|
1010
|
+
var margin = (_ref9 = (_this$val11 = this.val("marginRight")) !== null && _this$val11 !== void 0 ? _this$val11 : this.val("rightMargin")) !== null && _ref9 !== void 0 ? _ref9 : TModelUtil.getMarginValue(this, "right");
|
|
1011
|
+
return margin + ((_this$getParentValue = this.getParentValue("gap")) !== null && _this$getParentValue !== void 0 ? _this$getParentValue : 0);
|
|
1012
|
+
}
|
|
1013
|
+
}, {
|
|
1014
|
+
key: "getMarginBottom",
|
|
1015
|
+
value: function getMarginBottom() {
|
|
1016
|
+
var _ref10, _this$val12, _this$getParentValue2;
|
|
1017
|
+
var margin = (_ref10 = (_this$val12 = this.val("marginBottom")) !== null && _this$val12 !== void 0 ? _this$val12 : this.val("bottomMargin")) !== null && _ref10 !== void 0 ? _ref10 : TModelUtil.getMarginValue(this, "bottom");
|
|
1018
|
+
return margin + ((_this$getParentValue2 = this.getParentValue("gap")) !== null && _this$getParentValue2 !== void 0 ? _this$getParentValue2 : 0);
|
|
1019
|
+
}
|
|
1020
|
+
}, {
|
|
1021
|
+
key: "getPaddingTop",
|
|
1022
|
+
value: function getPaddingTop() {
|
|
1023
|
+
var _ref11, _this$val13;
|
|
1024
|
+
return (_ref11 = (_this$val13 = this.val("paddingTop")) !== null && _this$val13 !== void 0 ? _this$val13 : this.val("topPadding")) !== null && _ref11 !== void 0 ? _ref11 : TModelUtil.getPaddingValue(this, "top");
|
|
967
1025
|
}
|
|
968
1026
|
}, {
|
|
969
|
-
key: "
|
|
970
|
-
value: function
|
|
971
|
-
|
|
1027
|
+
key: "getPaddingLeft",
|
|
1028
|
+
value: function getPaddingLeft() {
|
|
1029
|
+
var _ref12, _this$val14;
|
|
1030
|
+
return (_ref12 = (_this$val14 = this.val("paddingLeft")) !== null && _this$val14 !== void 0 ? _this$val14 : this.val("leftPadding")) !== null && _ref12 !== void 0 ? _ref12 : TModelUtil.getPaddingValue(this, "left");
|
|
972
1031
|
}
|
|
973
1032
|
}, {
|
|
974
|
-
key: "
|
|
975
|
-
value: function
|
|
976
|
-
var _this$
|
|
977
|
-
return
|
|
1033
|
+
key: "getPaddingRight",
|
|
1034
|
+
value: function getPaddingRight() {
|
|
1035
|
+
var _ref13, _this$val15;
|
|
1036
|
+
return (_ref13 = (_this$val15 = this.val("paddingRight")) !== null && _this$val15 !== void 0 ? _this$val15 : this.val("rightPadding")) !== null && _ref13 !== void 0 ? _ref13 : TModelUtil.getPaddingValue(this, "right");
|
|
978
1037
|
}
|
|
979
1038
|
}, {
|
|
980
|
-
key: "
|
|
981
|
-
value: function
|
|
982
|
-
var _this$
|
|
983
|
-
return
|
|
1039
|
+
key: "getPaddingBottom",
|
|
1040
|
+
value: function getPaddingBottom() {
|
|
1041
|
+
var _ref14, _this$val16;
|
|
1042
|
+
return (_ref14 = (_this$val16 = this.val("paddingBottom")) !== null && _this$val16 !== void 0 ? _this$val16 : this.val("bottomPadding")) !== null && _ref14 !== void 0 ? _ref14 : TModelUtil.getPaddingValue(this, "bottom");
|
|
984
1043
|
}
|
|
985
1044
|
}, {
|
|
986
1045
|
key: "getWidth",
|
|
987
1046
|
value: function getWidth() {
|
|
988
|
-
if (
|
|
1047
|
+
if (TUtil.isDefined(this.targets.width) || TUtil.isDefined(this.targetValues.width)) {
|
|
989
1048
|
return this.val("width");
|
|
990
1049
|
}
|
|
991
|
-
if (
|
|
1050
|
+
if (TUtil.isDefined(this.targets.dim) || TUtil.isDefined(this.targetValues.dim)) {
|
|
992
1051
|
return this.val("dim");
|
|
993
1052
|
}
|
|
994
1053
|
return this.val("width");
|
|
@@ -996,10 +1055,10 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
996
1055
|
}, {
|
|
997
1056
|
key: "getHeight",
|
|
998
1057
|
value: function getHeight() {
|
|
999
|
-
if (
|
|
1058
|
+
if (TUtil.isDefined(this.targets.height) || TUtil.isDefined(this.targetValues.height)) {
|
|
1000
1059
|
return this.val("height");
|
|
1001
1060
|
}
|
|
1002
|
-
if (
|
|
1061
|
+
if (TUtil.isDefined(this.targets.dim) || TUtil.isDefined(this.targetValues.dim)) {
|
|
1003
1062
|
return this.val("dim");
|
|
1004
1063
|
}
|
|
1005
1064
|
return this.val("height");
|
|
@@ -1047,9 +1106,9 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
1047
1106
|
}, {
|
|
1048
1107
|
key: "isFormControl",
|
|
1049
1108
|
value: function isFormControl() {
|
|
1050
|
-
var _this$$
|
|
1109
|
+
var _this$$dom4;
|
|
1051
1110
|
var t = this.getBaseElement();
|
|
1052
|
-
return t === 'input' || t === 'select' || t === 'textarea' || ((_this$$
|
|
1111
|
+
return t === 'input' || t === 'select' || t === 'textarea' || ((_this$$dom4 = this.$dom) === null || _this$$dom4 === void 0 || (_this$$dom4 = _this$$dom4.element) === null || _this$$dom4 === void 0 ? void 0 : _this$$dom4.isContentEditable);
|
|
1053
1112
|
}
|
|
1054
1113
|
}, {
|
|
1055
1114
|
key: "isOverflowHidden",
|
|
@@ -1062,4 +1121,5 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
1062
1121
|
return this.val('reuseDomDefinition');
|
|
1063
1122
|
}
|
|
1064
1123
|
}]);
|
|
1065
|
-
}(
|
|
1124
|
+
}(BaseModel);
|
|
1125
|
+
export { TModel };
|