targetj 1.0.241 → 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/build/TModel.js CHANGED
@@ -66,17 +66,18 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
66
66
  return _createClass(TModel, [{
67
67
  key: "createViewport",
68
68
  value: function createViewport() {
69
- var _this$getParent$$dom$, _this$getParent, _this$getParent$$dom$2, _this$getParent2;
70
69
  this.viewport = this.viewport || new Viewport();
71
- var x = -this.getScrollLeft(),
72
- y = -this.getScrollTop();
70
+ var scrollTop = this.getScrollTop();
71
+ var scrollLeft = this.getScrollLeft();
72
+ var x = -scrollLeft,
73
+ y = -scrollTop;
73
74
  this.viewport.xNext = x;
74
75
  this.viewport.xNorth = x;
75
76
  this.viewport.xEast = x;
76
77
  this.viewport.xSouth = x;
77
78
  this.viewport.xWest = x;
78
- this.viewport.scrollLeft = -(this.getScrollLeft() + ((_this$getParent$$dom$ = (_this$getParent = this.getParent()) === null || _this$getParent === void 0 || (_this$getParent = _this$getParent.$dom) === null || _this$getParent === void 0 ? void 0 : _this$getParent.getScrollLeft()) !== null && _this$getParent$$dom$ !== void 0 ? _this$getParent$$dom$ : 0));
79
- this.viewport.scrollTop = -(this.getScrollTop() + ((_this$getParent$$dom$2 = (_this$getParent2 = this.getParent()) === null || _this$getParent2 === void 0 || (_this$getParent2 = _this$getParent2.$dom) === null || _this$getParent2 === void 0 ? void 0 : _this$getParent2.getScrollTop()) !== null && _this$getParent$$dom$2 !== void 0 ? _this$getParent$$dom$2 : 0));
79
+ this.viewport.scrollLeft = x;
80
+ this.viewport.scrollTop = y;
80
81
  this.viewport.absX = this.absX;
81
82
  this.viewport.absY = this.absY;
82
83
  this.viewport.xOverflowReset = x;
@@ -87,22 +88,16 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
87
88
  this.viewport.yEast = y;
88
89
  this.viewport.ySouth = y;
89
90
  this.calcContentWidthHeight();
90
- this.viewport.container = this;
91
+ this.viewport.setContainer(this);
91
92
  return this.viewport;
92
93
  }
93
94
  }, {
94
95
  key: "calcContentWidthHeight",
95
96
  value: function calcContentWidthHeight() {
96
- var contentHeight = this.viewport.ySouth - this.viewport.yNorth;
97
- var contentWidth = this.viewport.xEast - this.viewport.xWest;
98
- var topBaseHeight = this.viewport.yEast - this.viewport.yNorth;
99
- var bottomBaseWidth = this.viewport.xSouth - this.viewport.xWest;
100
- if (contentHeight !== this.contentHeight || this.contentWidth !== contentWidth || this.topBaseHeight !== topBaseHeight || this.bottomBaseWidth !== bottomBaseWidth) {
101
- this.contentHeight = contentHeight;
102
- this.topBaseHeight = topBaseHeight;
103
- this.bottomBaseWidth = bottomBaseWidth;
104
- this.contentWidth = contentWidth;
105
- }
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;
106
101
  }
107
102
  }, {
108
103
  key: "adjustViewport",
@@ -499,8 +494,8 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
499
494
  value: function getParentValueAtMyIndex(targetName) {
500
495
  var parentValue = this.getParentValue(targetName);
501
496
  if (Array.isArray(parentValue)) {
502
- var _this$getParent3;
503
- var index = (_this$getParent3 = this.getParent()) === null || _this$getParent3 === void 0 ? void 0 : _this$getParent3.getChildIndex(this);
497
+ var _this$getParent;
498
+ var index = (_this$getParent = this.getParent()) === null || _this$getParent === void 0 ? void 0 : _this$getParent.getChildIndex(this);
504
499
  if (typeof index === 'number') {
505
500
  return parentValue[index];
506
501
  }
@@ -572,8 +567,9 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
572
567
  return domParent ? domParent.$dom : null;
573
568
  }
574
569
  }, {
575
- key: "bug",
576
- value: function bug() {
570
+ key: "debug",
571
+ value: function debug() {
572
+ var _this6 = this;
577
573
  return [{
578
574
  visible: this.isVisible()
579
575
  }, {
@@ -588,6 +584,8 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
588
584
  width: this.getWidth()
589
585
  }, {
590
586
  height: this.getHeight()
587
+ }, {
588
+ tmodelComplete: TargetUtil.isTModelComplete(this)
591
589
  }, {
592
590
  targets: this.originalTargetNames
593
591
  }, {
@@ -604,6 +602,14 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
604
602
  styleTargetMap: _toConsumableArray(this.styleTargetMap ? _toConsumableArray(this.styleTargetMap.keys()) : [])
605
603
  }, {
606
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
+ })
607
613
  }, {
608
614
  updatingChildren: this.updatingChildrenMap ? _toConsumableArray(this.updatingChildrenMap.keys()) : []
609
615
  }, {
@@ -641,10 +647,11 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
641
647
  }, {
642
648
  key: "managesOwnScroll",
643
649
  value: function managesOwnScroll() {
650
+ var _this$$dom$getScrollT, _this$$dom, _this$$dom$getScrollL, _this$$dom2;
644
651
  if (TUtil.isDefined(this.val('managesOwnScroll'))) {
645
652
  return !!this.val('managesOwnScroll');
646
653
  }
647
- 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;
648
655
  }
649
656
  }, {
650
657
  key: "calcVisibility",
@@ -740,11 +747,40 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
740
747
  var _this$val5;
741
748
  return (_this$val5 = this.val('topBaseHeight')) !== null && _this$val5 !== void 0 ? _this$val5 : 0;
742
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
+ }
743
779
  }, {
744
780
  key: "getContainerOverflowMode",
745
781
  value: function getContainerOverflowMode() {
746
- var _this$val6;
747
- return (_this$val6 = this.val('containerOverflowMode')) !== null && _this$val6 !== void 0 ? _this$val6 : 'auto';
782
+ var _this$val7;
783
+ return (_this$val7 = this.val('containerOverflowMode')) !== null && _this$val7 !== void 0 ? _this$val7 : 'auto';
748
784
  }
749
785
  }, {
750
786
  key: "getItemOverflowMode",
@@ -851,8 +887,8 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
851
887
  }, {
852
888
  key: "getBaseElement",
853
889
  value: function getBaseElement() {
854
- var _this$$dom;
855
- return this.val('baseElement') || this.val('element') || ((_this$$dom = this.$dom) === null || _this$$dom === void 0 || (_this$$dom = _this$$dom.element) === null || _this$$dom === void 0 || (_this$$dom = _this$$dom.tagName) === null || _this$$dom === void 0 ? void 0 : _this$$dom.toLowerCase());
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());
856
892
  }
857
893
  }, {
858
894
  key: "getOpacity",
@@ -947,8 +983,8 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
947
983
  }, {
948
984
  key: "getMeasuringScale",
949
985
  value: function getMeasuringScale() {
950
- var _this$val7;
951
- return (_this$val7 = this.val('measuringScale')) !== null && _this$val7 !== void 0 ? _this$val7 : 1;
986
+ var _this$val8;
987
+ return (_this$val8 = this.val('measuringScale')) !== null && _this$val8 !== void 0 ? _this$val8 : 1;
952
988
  }
953
989
  }, {
954
990
  key: "getZIndex",
@@ -956,26 +992,54 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
956
992
  return this.val('zIndex');
957
993
  }
958
994
  }, {
959
- key: "getTopMargin",
960
- value: function getTopMargin() {
961
- return this.val('topMargin');
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");
962
1025
  }
963
1026
  }, {
964
- key: "getLeftMargin",
965
- value: function getLeftMargin() {
966
- return this.val('leftMargin');
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");
967
1031
  }
968
1032
  }, {
969
- key: "getRightMargin",
970
- value: function getRightMargin() {
971
- var _this$getParentValue;
972
- return this.val('rightMargin') + ((_this$getParentValue = this.getParentValue('gap')) !== null && _this$getParentValue !== void 0 ? _this$getParentValue : 0);
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");
973
1037
  }
974
1038
  }, {
975
- key: "getBottomMargin",
976
- value: function getBottomMargin() {
977
- var _this$getParentValue2;
978
- return this.val('bottomMargin') + ((_this$getParentValue2 = this.getParentValue('gap')) !== null && _this$getParentValue2 !== void 0 ? _this$getParentValue2 : 0);
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");
979
1043
  }
980
1044
  }, {
981
1045
  key: "getWidth",
@@ -1042,9 +1106,9 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
1042
1106
  }, {
1043
1107
  key: "isFormControl",
1044
1108
  value: function isFormControl() {
1045
- var _this$$dom2;
1109
+ var _this$$dom4;
1046
1110
  var t = this.getBaseElement();
1047
- return t === 'input' || t === 'select' || t === 'textarea' || ((_this$$dom2 = this.$dom) === null || _this$$dom2 === void 0 || (_this$$dom2 = _this$$dom2.element) === null || _this$$dom2 === void 0 ? void 0 : _this$$dom2.isContentEditable);
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);
1048
1112
  }
1049
1113
  }, {
1050
1114
  key: "isOverflowHidden",
@@ -1,11 +1,11 @@
1
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); }
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; } } }; }
2
3
  function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
3
4
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
5
- function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
6
- 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; } } }; }
7
5
  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; } }
8
6
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
7
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
8
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
9
9
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
10
10
  function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
11
11
  function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
@@ -28,6 +28,78 @@ var TModelUtil = /*#__PURE__*/function () {
28
28
  _classCallCheck(this, TModelUtil);
29
29
  }
30
30
  return _createClass(TModelUtil, null, [{
31
+ key: "getMarginValue",
32
+ value: function getMarginValue(tmodel, side) {
33
+ var margin = tmodel.val("margin");
34
+ if (typeof margin === "number") {
35
+ return margin;
36
+ }
37
+ if (Array.isArray(margin)) {
38
+ if (margin.length === 2) {
39
+ var _margin = _slicedToArray(margin, 2),
40
+ vertical = _margin[0],
41
+ horizontal = _margin[1];
42
+ return side === "top" || side === "bottom" ? vertical : horizontal;
43
+ }
44
+ if (margin.length === 4) {
45
+ var _margin2 = _slicedToArray(margin, 4),
46
+ top = _margin2[0],
47
+ right = _margin2[1],
48
+ bottom = _margin2[2],
49
+ left = _margin2[3];
50
+ if (side === "top") {
51
+ return top;
52
+ }
53
+ if (side === "right") {
54
+ return right;
55
+ }
56
+ if (side === "bottom") {
57
+ return bottom;
58
+ }
59
+ if (side === "left") {
60
+ return left;
61
+ }
62
+ }
63
+ }
64
+ return 0;
65
+ }
66
+ }, {
67
+ key: "getPaddingValue",
68
+ value: function getPaddingValue(tmodel, side) {
69
+ var padding = tmodel.val("padding");
70
+ if (typeof padding === "number") {
71
+ return padding;
72
+ }
73
+ if (Array.isArray(padding)) {
74
+ if (padding.length === 2) {
75
+ var _padding = _slicedToArray(padding, 2),
76
+ vertical = _padding[0],
77
+ horizontal = _padding[1];
78
+ return side === "top" || side === "bottom" ? vertical : horizontal;
79
+ }
80
+ if (padding.length === 4) {
81
+ var _padding2 = _slicedToArray(padding, 4),
82
+ top = _padding2[0],
83
+ right = _padding2[1],
84
+ bottom = _padding2[2],
85
+ left = _padding2[3];
86
+ if (side === "top") {
87
+ return top;
88
+ }
89
+ if (side === "right") {
90
+ return right;
91
+ }
92
+ if (side === "bottom") {
93
+ return bottom;
94
+ }
95
+ if (side === "left") {
96
+ return left;
97
+ }
98
+ }
99
+ }
100
+ return 0;
101
+ }
102
+ }, {
31
103
  key: "shouldMeasureHeightFromDom",
32
104
  value: function shouldMeasureHeightFromDom(tmodel) {
33
105
  if (tmodel.val('heightFromDom') === false) {
@@ -29,10 +29,6 @@ var TargetData = /*#__PURE__*/function () {
29
29
  y: 0,
30
30
  width: 0,
31
31
  height: 0,
32
- leftMargin: 0,
33
- rightMargin: 0,
34
- topMargin: 0,
35
- bottomMargin: 0,
36
32
  opacity: 1,
37
33
  scale: 1,
38
34
  scrollLeft: 0,
@@ -768,6 +764,10 @@ _defineProperty(TargetData, "attributesToTargets", {
768
764
  paddingright: 'paddingRight',
769
765
  paddingtop: 'paddingTop',
770
766
  paddingbottom: 'paddingBottom',
767
+ marginleft: 'marginLeft',
768
+ marginright: 'marginRight',
769
+ margintop: 'marginTop',
770
+ marginbottom: 'marginBottom',
771
771
  userselect: 'userSelect',
772
772
  arialabel: 'ariaLabel',
773
773
  ariacurrent: 'ariaCurrent',
@@ -911,7 +911,7 @@ _defineProperty(TargetData, "allEventMap", {
911
911
  });
912
912
  _defineProperty(TargetData, "excludedTargetKeys", new Set(['originalTargetName', 'originalTModel', 'activateNextTarget', 'invokerTarget', 'invokerTModel', 'active', 'addChildAction', 'childAction', 'fetchAction']));
913
913
  _defineProperty(TargetData, "lifecycleCallbackSet", new Set(['onComplete', 'onValueChange', 'onImperativeEnd', 'onImperativeStep', 'onStepsEnd', 'onSuccess', 'onError']));
914
- _defineProperty(TargetData, "lifecycleCoreSet", new Set(['value', 'steps', 'cycles', 'enabledOn', 'loop', 'interval']));
914
+ _defineProperty(TargetData, "lifecycleCoreSet", new Set(['value', 'steps', 'cycles', 'enabledOn', 'pauseOn', 'loop', 'interval']));
915
915
  _defineProperty(TargetData, "lifecycleMethodSet", new Set([].concat(_toConsumableArray(_TargetData.lifecycleCallbackSet), _toConsumableArray(_TargetData.lifecycleCoreSet))));
916
916
  _defineProperty(TargetData, "lifecyclePatterns", {
917
917
  step: /^on[A-Za-z]+Step$/,
@@ -174,7 +174,7 @@ var TargetExecutor = /*#__PURE__*/function () {
174
174
  var newStatus = TargetExecutor.calculateTargetStatus(tmodel, targetValue, key);
175
175
  tmodel.setTargetStatus(key, newStatus);
176
176
  if (!TargetData.ignoreRerun[key] && tmodel.shouldScheduleRun(key)) {
177
- getRunScheduler().schedule(1, 'updateTarget2-' + tmodel.oid);
177
+ getRunScheduler().schedule(1, 'updateTarget2-' + tmodel.oid + "-" + key);
178
178
  }
179
179
  }
180
180
  }, {
@@ -298,7 +298,8 @@ var TargetUtil = /*#__PURE__*/function () {
298
298
  key: "cleanupTarget",
299
299
  value: function cleanupTarget(tmodel, key) {
300
300
  TargetUtil.cleanupVisibleComplete(tmodel, key);
301
- if (tmodel.isTargetComplete(key) || !TargetUtil.isTargetFullyCompleted(tmodel, key)) {
301
+ var cannotBeCleaned = tmodel.isTargetComplete(key) || !TargetUtil.isTargetFullyCompleted(tmodel, key);
302
+ if (cannotBeCleaned) {
302
303
  return false;
303
304
  }
304
305
  tmodel.setTargetComplete(key);
@@ -471,7 +472,7 @@ var TargetUtil = /*#__PURE__*/function () {
471
472
  }
472
473
  if (tmodel.isTargetTreeComplete(targetName) !== true) {
473
474
  //const activeChildrenList = [ ...TargetUtil.getActiveChildren(tmodel, tmodel.targets[targetName].completionScope).values() ];
474
- //return tmodel.oid + "." + targetName + " ==> " + tmodel.getTargetStatus(targetName) + ", " + tmodel.isTargetTreeComplete(targetName) + ":: " + activeChildrenList.map(t => t.oid + ':' + t.hasAnyUpdates()) + ", " + [ ...TargetUtil.getUpdatingChildren(tmodel, targetName, tmodel.targets[targetName].completionScope).keys() ];
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() ];
475
476
  return false;
476
477
  }
477
478
  }
package/build/Viewport.js CHANGED
@@ -32,6 +32,11 @@ var Viewport = /*#__PURE__*/function () {
32
32
  this.time = 0;
33
33
  }
34
34
  return _createClass(Viewport, [{
35
+ key: "setContainer",
36
+ value: function setContainer(container) {
37
+ this.container = container;
38
+ }
39
+ }, {
35
40
  key: "setCurrentChild",
36
41
  value: function setCurrentChild(child) {
37
42
  this.currentChild = child;
@@ -41,8 +46,8 @@ var Viewport = /*#__PURE__*/function () {
41
46
  value: function setLocation() {
42
47
  var child = this.currentChild;
43
48
  if (!child.targets['excludeXYCalc']) {
44
- child.x = this.xNext + child.getLeftMargin();
45
- child.y = this.yNext + child.getTopMargin();
49
+ child.x = this.xNext + child.getMarginLeft() + this.container.getPaddingLeft();
50
+ child.y = this.yNext + child.getMarginTop() + this.container.getPaddingTop();
46
51
  }
47
52
  }
48
53
  }, {
@@ -58,8 +63,9 @@ var Viewport = /*#__PURE__*/function () {
58
63
  }, {
59
64
  key: "checkChildOverflow",
60
65
  value: function checkChildOverflow() {
61
- var childWidth = this.currentChild.getMinWidth();
62
- return this.currentChild.x + childWidth + this.currentChild.getLeftMargin() > this.xOverflowLimit;
66
+ var child = this.currentChild;
67
+ var childWidth = child.getMinWidth();
68
+ return this.xNext + child.getMarginLeft() + childWidth + child.getMarginRight() > this.xOverflowLimit;
63
69
  }
64
70
  }, {
65
71
  key: "overflow",
@@ -72,7 +78,7 @@ var Viewport = /*#__PURE__*/function () {
72
78
  value: function appendNewLine() {
73
79
  var child = this.currentChild;
74
80
  var scale = child.getMeasuringScale();
75
- var maxHeight = child.getHeight() * scale + this.currentChild.getTopMargin() + this.currentChild.getBottomMargin();
81
+ var maxHeight = child.getHeight() * scale + this.currentChild.getMarginTop() + this.currentChild.getMarginBottom();
76
82
  this.xNext = this.scrollLeft - this.xOverflowReset;
77
83
  var ySouth = this.yNext + maxHeight + child.val('appendNewLine');
78
84
  this.yEast = this.yNext;
@@ -93,17 +99,17 @@ var Viewport = /*#__PURE__*/function () {
93
99
  if (space === 'layout') {
94
100
  x = child.x;
95
101
  y = child.y;
96
- left = x - child.getLeftMargin();
97
- right = x + width + child.getRightMargin();
98
- top = y - child.getTopMargin();
99
- bottom = y + height + child.getBottomMargin();
102
+ left = x - child.getMarginLeft();
103
+ right = x + width + child.getMarginRight();
104
+ top = y - child.getMarginTop();
105
+ bottom = y + height + child.getMarginBottom();
100
106
  } else if (space === 'absolute') {
101
107
  x = child.absX - this.absX;
102
108
  y = child.absY - this.absY;
103
109
  left = x;
104
- right = x + width + child.getRightMargin();
110
+ right = x + width + child.getMarginRight();
105
111
  top = y;
106
- bottom = y + height + child.getBottomMargin();
112
+ bottom = y + height + child.getMarginBottom();
107
113
  } else {
108
114
  x = child.getX();
109
115
  y = child.getY();
@@ -125,8 +131,8 @@ var Viewport = /*#__PURE__*/function () {
125
131
  var child = this.currentChild;
126
132
  var scale = child.getMeasuringScale();
127
133
  var topBaseHeight = child.getTopBaseHeight() * scale;
128
- var maxHeight = child.getHeight() * scale + this.currentChild.getTopMargin() + this.currentChild.getBottomMargin();
129
- var maxWidth = child.getItemOverflowMode() === 'always' && TModelUtil.isWidthDefined(this.container) ? this.container.getWidth() : child.getBaseWidth() * scale + this.currentChild.getLeftMargin() + this.currentChild.getRightMargin();
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();
130
136
  if (child.type !== 'BI' && this.container.type === 'BI') {
131
137
  var layout = this.computeBoundary(child, 'layout');
132
138
  var animated = this.computeBoundary(child, 'animated');
@@ -31,56 +31,53 @@ var VisibilityUtil = /*#__PURE__*/function () {
31
31
  var width = TUtil.isDefined(child.getWidth()) ? scale * child.getWidth() : 0;
32
32
  var height = TUtil.isDefined(child.getHeight()) ? scale * child.getHeight() : 0;
33
33
  var visibilityMargin = 20;
34
- if (!child.visibilityStatus) {
35
- child.visibilityStatus = {};
36
- }
37
- var status = child.visibilityStatus;
38
- var clip = VisibilityUtil.getVisibilityClipRect(child.getParent());
39
- if (clip) {
40
- status.right = x - visibilityMargin <= clip.r;
41
- status.left = x + width + visibilityMargin >= clip.x;
42
- status.bottom = y - child.getTopMargin() - visibilityMargin <= clip.b;
43
- status.top = y + height + child.getBottomMargin() + visibilityMargin >= clip.y;
44
- status.clipX = clip.x;
45
- status.clipY = clip.y;
46
- status.clipR = clip.r;
47
- status.clipB = clip.b;
48
- status.parent = clip.source;
49
- status.isVisible = status.left && status.right && status.top && status.bottom;
50
- } else {
51
- status.right = true;
52
- status.left = true;
53
- status.bottom = true;
54
- status.top = true;
55
- status.clipX = undefined;
56
- status.clipY = undefined;
57
- status.clipR = undefined;
58
- status.clipB = undefined;
59
- status.parent = "none";
60
- status.isVisible = true;
61
- }
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);
62
41
  status.x = x;
63
42
  status.y = y;
64
43
  status.width = width;
65
44
  status.height = height;
45
+ child.visibilityStatus = status;
66
46
  child.actualValues.isVisible = status.isVisible;
67
47
  return status.isVisible;
68
48
  }
69
49
  }, {
70
- key: "getVisibilityClipRect",
71
- value: function getVisibilityClipRect(container) {
72
- var rect = VisibilityUtil.getScreenViewportRect();
73
- while (container && container !== tRoot()) {
74
- if (VisibilityUtil.shouldClipByAncestor(container)) {
75
- var ancestorRect = VisibilityUtil.getAncestorViewportRect(container);
76
- rect = rect && !container.allTargetMap['onWindowScroll'] ? VisibilityUtil.intersectVisibilityRects(rect, ancestorRect) : ancestorRect;
77
- if (rect.r <= rect.x || rect.b <= rect.y) {
78
- break;
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
+ };
79
65
  }
66
+ rect = VisibilityUtil.intersectRects(parent, rect, _clip);
80
67
  }
81
- container = container.getRealParent();
68
+ tmodel = parent;
69
+ }
70
+ var clip = VisibilityUtil.getScreenViewportRect();
71
+ var isVisible = VisibilityUtil.rectsOverlap(rect, clip);
72
+ if (!isVisible) {
73
+ return {
74
+ clip: clip,
75
+ isVisible: false
76
+ };
82
77
  }
83
- return rect;
78
+ return {
79
+ isVisible: true
80
+ };
84
81
  }
85
82
  }, {
86
83
  key: "getScreenViewportRect",
@@ -96,30 +93,41 @@ var VisibilityUtil = /*#__PURE__*/function () {
96
93
  }, {
97
94
  key: "shouldClipByAncestor",
98
95
  value: function shouldClipByAncestor(ancestor) {
99
- return ancestor.managesOwnScroll();
96
+ var overflow = ancestor.val("overflow");
97
+ return ancestor.managesOwnScroll() || overflow === "hidden" || overflow === "auto" || overflow === "scroll" || overflow === "clip";
100
98
  }
101
99
  }, {
102
- key: "getAncestorViewportRect",
103
- value: function getAncestorViewportRect(ancestor) {
104
- var _ancestor$$dom, _ancestor$$dom2;
105
- var domScrollLeft = ((_ancestor$$dom = ancestor.$dom) === null || _ancestor$$dom === void 0 ? void 0 : _ancestor$$dom.getScrollLeft()) || 0;
106
- var domScrollTop = ((_ancestor$$dom2 = ancestor.$dom) === null || _ancestor$$dom2 === void 0 ? void 0 : _ancestor$$dom2.getScrollTop()) || 0;
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();
107
107
  return {
108
- x: ancestor.absX + domScrollLeft,
109
- y: ancestor.absY + domScrollTop,
110
- r: ancestor.absX + domScrollLeft + ancestor.getWidth(),
111
- b: ancestor.absY + domScrollTop + ancestor.getHeight(),
112
- source: ancestor
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
113
113
  };
114
114
  }
115
115
  }, {
116
- key: "intersectVisibilityRects",
117
- value: function intersectVisibilityRects(a, b) {
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;
118
126
  return {
119
- x: Math.max(a.x, b.x),
120
- y: Math.max(a.y, b.y),
121
- r: Math.min(a.r, b.r),
122
- 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),
123
131
  source: b.source
124
132
  };
125
133
  }