handsontable 12.3.1 → 12.3.2-next-bcef33c-20230315

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. package/3rdparty/walkontable/src/calculator/viewportColumns.js +31 -9
  2. package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +31 -9
  3. package/3rdparty/walkontable/src/calculator/viewportRows.js +21 -6
  4. package/3rdparty/walkontable/src/calculator/viewportRows.mjs +21 -6
  5. package/3rdparty/walkontable/src/core/_base.js +19 -20
  6. package/3rdparty/walkontable/src/core/_base.mjs +19 -20
  7. package/3rdparty/walkontable/src/scroll.js +14 -3
  8. package/3rdparty/walkontable/src/scroll.mjs +14 -3
  9. package/3rdparty/walkontable/src/table.js +4 -2
  10. package/3rdparty/walkontable/src/table.mjs +4 -2
  11. package/3rdparty/walkontable/src/types.js +1 -0
  12. package/3rdparty/walkontable/src/types.mjs +1 -0
  13. package/3rdparty/walkontable/src/viewport.js +11 -14
  14. package/3rdparty/walkontable/src/viewport.mjs +11 -14
  15. package/CHANGELOG.md +7 -0
  16. package/base.js +2 -2
  17. package/base.mjs +2 -2
  18. package/core.js +32 -21
  19. package/core.mjs +32 -21
  20. package/dataMap/metaManager/metaSchema.js +9 -9
  21. package/dataMap/metaManager/metaSchema.mjs +9 -9
  22. package/dist/handsontable.css +2 -2
  23. package/dist/handsontable.full.css +2 -2
  24. package/dist/handsontable.full.js +4631 -3987
  25. package/dist/handsontable.full.min.css +8 -8
  26. package/dist/handsontable.full.min.js +241 -227
  27. package/dist/handsontable.js +2753 -2435
  28. package/dist/handsontable.min.css +7 -7
  29. package/dist/handsontable.min.js +3 -3
  30. package/dist/languages/all.js +1 -1
  31. package/dist/languages/all.min.js +1 -1
  32. package/dist/languages/zh-CN.js +1 -1
  33. package/dist/languages/zh-CN.min.js +1 -1
  34. package/editors/autocompleteEditor/autocompleteEditor.js +8 -9
  35. package/editors/autocompleteEditor/autocompleteEditor.mjs +8 -9
  36. package/helpers/mixed.js +2 -2
  37. package/helpers/mixed.mjs +2 -2
  38. package/i18n/languages/zh-CN.js +1 -1
  39. package/i18n/languages/zh-CN.mjs +3 -3
  40. package/languages/all.js +1 -1
  41. package/languages/index.js +1 -1
  42. package/languages/zh-CN.js +1 -1
  43. package/languages/zh-CN.mjs +3 -3
  44. package/package.json +12 -13
  45. package/plugins/base/base.js +9 -10
  46. package/plugins/base/base.mjs +9 -10
  47. package/plugins/collapsibleColumns/collapsibleColumns.js +24 -7
  48. package/plugins/collapsibleColumns/collapsibleColumns.mjs +24 -7
  49. package/plugins/copyPaste/copyPaste.js +92 -16
  50. package/plugins/copyPaste/copyPaste.mjs +92 -16
  51. package/plugins/copyPaste/copyableRanges.js +14 -8
  52. package/plugins/copyPaste/copyableRanges.mjs +14 -8
  53. package/plugins/customBorders/customBorders.js +6 -7
  54. package/plugins/customBorders/customBorders.mjs +6 -7
  55. package/plugins/filters/filters.js +0 -8
  56. package/plugins/filters/filters.mjs +0 -8
  57. package/plugins/formulas/formulas.js +34 -7
  58. package/plugins/formulas/formulas.mjs +34 -7
  59. package/plugins/hiddenColumns/hiddenColumns.js +12 -7
  60. package/plugins/hiddenColumns/hiddenColumns.mjs +12 -7
  61. package/plugins/hiddenRows/hiddenRows.js +12 -7
  62. package/plugins/hiddenRows/hiddenRows.mjs +12 -7
  63. package/plugins/nestedHeaders/nestedHeaders.js +26 -7
  64. package/plugins/nestedHeaders/nestedHeaders.mjs +26 -7
  65. package/plugins/nestedHeaders/stateManager/index.js +18 -0
  66. package/plugins/nestedHeaders/stateManager/index.mjs +18 -0
  67. package/plugins/nestedHeaders/stateManager/sourceSettings.js +19 -0
  68. package/plugins/nestedHeaders/stateManager/sourceSettings.mjs +19 -0
  69. package/translations/changesObservable/observer.js +7 -0
  70. package/translations/changesObservable/observer.mjs +7 -0
  71. package/translations/maps/linkedPhysicalIndexToValueMap.js +6 -0
  72. package/translations/maps/linkedPhysicalIndexToValueMap.mjs +6 -0
@@ -35,8 +35,10 @@ var ViewportColumnsCalculator = /*#__PURE__*/function () {
35
35
  * @param {number} options.scrollOffset Current horizontal scroll position of the viewport.
36
36
  * @param {number} options.totalItems Total number of columns.
37
37
  * @param {Function} options.itemSizeFn Function that returns the width of the column at a given index (in px).
38
- * @param {Function} options.overrideFn Function that changes calculated this.startRow, this.endRow (used by MergeCells plugin).
38
+ * @param {Function} options.overrideFn Function that changes calculated this.startRow, this.endRow (used by
39
+ * MergeCells plugin).
39
40
  * @param {string} options.calculationType String which describes types of calculation which will be performed.
41
+ * @param {string} options.inlineStartOffset Inline-start offset of the parent container.
40
42
  * @param {string} [options.stretchMode] Stretch mode 'all' or 'last'.
41
43
  * @param {Function} [options.stretchingItemWidthFn] Function that returns the new width of the stretched column.
42
44
  */
@@ -52,7 +54,8 @@ var ViewportColumnsCalculator = /*#__PURE__*/function () {
52
54
  _ref$stretchingItemWi = _ref.stretchingItemWidthFn,
53
55
  stretchingItemWidthFn = _ref$stretchingItemWi === void 0 ? function (width) {
54
56
  return width;
55
- } : _ref$stretchingItemWi;
57
+ } : _ref$stretchingItemWi,
58
+ inlineStartOffset = _ref.inlineStartOffset;
56
59
  _classCallCheck(this, ViewportColumnsCalculator);
57
60
  privatePool.set(this, {
58
61
  viewportWidth: viewportSize,
@@ -61,7 +64,8 @@ var ViewportColumnsCalculator = /*#__PURE__*/function () {
61
64
  columnWidthFn: itemSizeFn,
62
65
  overrideFn: overrideFn,
63
66
  calculationType: calculationType,
64
- stretchingColumnWidthFn: stretchingItemWidthFn
67
+ stretchingColumnWidthFn: stretchingItemWidthFn,
68
+ inlineStartOffset: inlineStartOffset
65
69
  });
66
70
 
67
71
  /**
@@ -91,6 +95,7 @@ var ViewportColumnsCalculator = /*#__PURE__*/function () {
91
95
  * @type {number|null}
92
96
  */
93
97
  this.startPosition = null;
98
+ this.isVisibleInTrimmingContainer = false;
94
99
  this.stretchAllRatio = 0;
95
100
  this.stretchLastWidth = 0;
96
101
  this.stretch = stretchMode;
@@ -110,36 +115,53 @@ var ViewportColumnsCalculator = /*#__PURE__*/function () {
110
115
  var needReverse = true;
111
116
  var startPositions = [];
112
117
  var columnWidth;
118
+ var firstVisibleColumnWidth = 0;
119
+ var lastVisibleColumnWidth = 0;
113
120
  var priv = privatePool.get(this);
114
121
  var calculationType = priv.calculationType;
115
122
  var overrideFn = priv.overrideFn;
116
123
  var scrollOffset = priv.scrollOffset;
124
+ var zeroBasedScrollOffset = Math.max(priv.scrollOffset, 0);
117
125
  var totalColumns = priv.totalColumns;
118
126
  var viewportWidth = priv.viewportWidth;
127
+ // +1 pixel for row header width compensation for horizontal scroll > 0
128
+ var compensatedViewportWidth = zeroBasedScrollOffset > 0 ? viewportWidth + 1 : viewportWidth;
119
129
  for (var i = 0; i < totalColumns; i++) {
120
130
  columnWidth = this._getColumnWidth(i);
121
- if (sum <= scrollOffset && calculationType !== _constants.FULLY_VISIBLE_TYPE) {
131
+ if (sum <= zeroBasedScrollOffset && calculationType !== _constants.FULLY_VISIBLE_TYPE) {
122
132
  this.startColumn = i;
133
+ firstVisibleColumnWidth = columnWidth;
123
134
  }
124
-
125
- // +1 pixel for row header width compensation for horizontal scroll > 0
126
- var compensatedViewportWidth = scrollOffset > 0 ? viewportWidth + 1 : viewportWidth;
127
- if (sum >= scrollOffset && sum + (calculationType === _constants.FULLY_VISIBLE_TYPE ? columnWidth : 0) <= scrollOffset + compensatedViewportWidth) {
135
+ if (sum >= zeroBasedScrollOffset && sum + (calculationType === _constants.FULLY_VISIBLE_TYPE ? columnWidth : 0) <= zeroBasedScrollOffset + compensatedViewportWidth) {
128
136
  if (this.startColumn === null || this.startColumn === void 0) {
129
137
  this.startColumn = i;
138
+ firstVisibleColumnWidth = columnWidth;
130
139
  }
131
140
  this.endColumn = i;
132
141
  }
133
142
  startPositions.push(sum);
134
143
  sum += columnWidth;
144
+ lastVisibleColumnWidth = columnWidth;
135
145
  if (calculationType !== _constants.FULLY_VISIBLE_TYPE) {
136
146
  this.endColumn = i;
137
147
  }
138
- if (sum >= scrollOffset + viewportWidth) {
148
+ if (sum >= zeroBasedScrollOffset + viewportWidth) {
139
149
  needReverse = false;
140
150
  break;
141
151
  }
142
152
  }
153
+ var mostRightScrollOffset = scrollOffset + viewportWidth - compensatedViewportWidth;
154
+ var inlineEndColumnOffset = calculationType === _constants.FULLY_VISIBLE_TYPE ? 0 : lastVisibleColumnWidth;
155
+ var inlineStartColumnOffset = calculationType === _constants.FULLY_VISIBLE_TYPE ? firstVisibleColumnWidth : 0;
156
+ if (
157
+ // The table is on the left of the viewport
158
+ mostRightScrollOffset < -1 * priv.inlineStartOffset || scrollOffset > startPositions.at(-1) + inlineEndColumnOffset ||
159
+ // The table is on the right of the viewport
160
+ -1 * priv.scrollOffset - priv.viewportWidth > -1 * inlineStartColumnOffset) {
161
+ this.isVisibleInTrimmingContainer = false;
162
+ } else {
163
+ this.isVisibleInTrimmingContainer = true;
164
+ }
143
165
  if (this.endColumn === totalColumns - 1 && needReverse) {
144
166
  this.startColumn = this.endColumn;
145
167
  while (this.startColumn > 0) {
@@ -31,8 +31,10 @@ var ViewportColumnsCalculator = /*#__PURE__*/function () {
31
31
  * @param {number} options.scrollOffset Current horizontal scroll position of the viewport.
32
32
  * @param {number} options.totalItems Total number of columns.
33
33
  * @param {Function} options.itemSizeFn Function that returns the width of the column at a given index (in px).
34
- * @param {Function} options.overrideFn Function that changes calculated this.startRow, this.endRow (used by MergeCells plugin).
34
+ * @param {Function} options.overrideFn Function that changes calculated this.startRow, this.endRow (used by
35
+ * MergeCells plugin).
35
36
  * @param {string} options.calculationType String which describes types of calculation which will be performed.
37
+ * @param {string} options.inlineStartOffset Inline-start offset of the parent container.
36
38
  * @param {string} [options.stretchMode] Stretch mode 'all' or 'last'.
37
39
  * @param {Function} [options.stretchingItemWidthFn] Function that returns the new width of the stretched column.
38
40
  */
@@ -48,7 +50,8 @@ var ViewportColumnsCalculator = /*#__PURE__*/function () {
48
50
  _ref$stretchingItemWi = _ref.stretchingItemWidthFn,
49
51
  stretchingItemWidthFn = _ref$stretchingItemWi === void 0 ? function (width) {
50
52
  return width;
51
- } : _ref$stretchingItemWi;
53
+ } : _ref$stretchingItemWi,
54
+ inlineStartOffset = _ref.inlineStartOffset;
52
55
  _classCallCheck(this, ViewportColumnsCalculator);
53
56
  privatePool.set(this, {
54
57
  viewportWidth: viewportSize,
@@ -57,7 +60,8 @@ var ViewportColumnsCalculator = /*#__PURE__*/function () {
57
60
  columnWidthFn: itemSizeFn,
58
61
  overrideFn: overrideFn,
59
62
  calculationType: calculationType,
60
- stretchingColumnWidthFn: stretchingItemWidthFn
63
+ stretchingColumnWidthFn: stretchingItemWidthFn,
64
+ inlineStartOffset: inlineStartOffset
61
65
  });
62
66
 
63
67
  /**
@@ -87,6 +91,7 @@ var ViewportColumnsCalculator = /*#__PURE__*/function () {
87
91
  * @type {number|null}
88
92
  */
89
93
  this.startPosition = null;
94
+ this.isVisibleInTrimmingContainer = false;
90
95
  this.stretchAllRatio = 0;
91
96
  this.stretchLastWidth = 0;
92
97
  this.stretch = stretchMode;
@@ -106,36 +111,53 @@ var ViewportColumnsCalculator = /*#__PURE__*/function () {
106
111
  var needReverse = true;
107
112
  var startPositions = [];
108
113
  var columnWidth;
114
+ var firstVisibleColumnWidth = 0;
115
+ var lastVisibleColumnWidth = 0;
109
116
  var priv = privatePool.get(this);
110
117
  var calculationType = priv.calculationType;
111
118
  var overrideFn = priv.overrideFn;
112
119
  var scrollOffset = priv.scrollOffset;
120
+ var zeroBasedScrollOffset = Math.max(priv.scrollOffset, 0);
113
121
  var totalColumns = priv.totalColumns;
114
122
  var viewportWidth = priv.viewportWidth;
123
+ // +1 pixel for row header width compensation for horizontal scroll > 0
124
+ var compensatedViewportWidth = zeroBasedScrollOffset > 0 ? viewportWidth + 1 : viewportWidth;
115
125
  for (var i = 0; i < totalColumns; i++) {
116
126
  columnWidth = this._getColumnWidth(i);
117
- if (sum <= scrollOffset && calculationType !== FULLY_VISIBLE_TYPE) {
127
+ if (sum <= zeroBasedScrollOffset && calculationType !== FULLY_VISIBLE_TYPE) {
118
128
  this.startColumn = i;
129
+ firstVisibleColumnWidth = columnWidth;
119
130
  }
120
-
121
- // +1 pixel for row header width compensation for horizontal scroll > 0
122
- var compensatedViewportWidth = scrollOffset > 0 ? viewportWidth + 1 : viewportWidth;
123
- if (sum >= scrollOffset && sum + (calculationType === FULLY_VISIBLE_TYPE ? columnWidth : 0) <= scrollOffset + compensatedViewportWidth) {
131
+ if (sum >= zeroBasedScrollOffset && sum + (calculationType === FULLY_VISIBLE_TYPE ? columnWidth : 0) <= zeroBasedScrollOffset + compensatedViewportWidth) {
124
132
  if (this.startColumn === null || this.startColumn === void 0) {
125
133
  this.startColumn = i;
134
+ firstVisibleColumnWidth = columnWidth;
126
135
  }
127
136
  this.endColumn = i;
128
137
  }
129
138
  startPositions.push(sum);
130
139
  sum += columnWidth;
140
+ lastVisibleColumnWidth = columnWidth;
131
141
  if (calculationType !== FULLY_VISIBLE_TYPE) {
132
142
  this.endColumn = i;
133
143
  }
134
- if (sum >= scrollOffset + viewportWidth) {
144
+ if (sum >= zeroBasedScrollOffset + viewportWidth) {
135
145
  needReverse = false;
136
146
  break;
137
147
  }
138
148
  }
149
+ var mostRightScrollOffset = scrollOffset + viewportWidth - compensatedViewportWidth;
150
+ var inlineEndColumnOffset = calculationType === FULLY_VISIBLE_TYPE ? 0 : lastVisibleColumnWidth;
151
+ var inlineStartColumnOffset = calculationType === FULLY_VISIBLE_TYPE ? firstVisibleColumnWidth : 0;
152
+ if (
153
+ // The table is on the left of the viewport
154
+ mostRightScrollOffset < -1 * priv.inlineStartOffset || scrollOffset > startPositions.at(-1) + inlineEndColumnOffset ||
155
+ // The table is on the right of the viewport
156
+ -1 * priv.scrollOffset - priv.viewportWidth > -1 * inlineStartColumnOffset) {
157
+ this.isVisibleInTrimmingContainer = false;
158
+ } else {
159
+ this.isVisibleInTrimmingContainer = true;
160
+ }
139
161
  if (this.endColumn === totalColumns - 1 && needReverse) {
140
162
  this.startColumn = this.endColumn;
141
163
  while (this.startColumn > 0) {
@@ -86,6 +86,7 @@ var ViewportRowsCalculator = /*#__PURE__*/function () {
86
86
  * @type {number|null}
87
87
  */
88
88
  this.startPosition = null;
89
+ this.isVisibleInTrimmingContainer = false;
89
90
  this.calculate();
90
91
  }
91
92
 
@@ -95,18 +96,21 @@ var ViewportRowsCalculator = /*#__PURE__*/function () {
95
96
  _createClass(ViewportRowsCalculator, [{
96
97
  key: "calculate",
97
98
  value: function calculate() {
98
- var sum = 0;
99
- var needReverse = true;
100
- var startPositions = [];
101
99
  var priv = privatePool.get(this);
102
100
  var calculationType = priv.calculationType;
103
101
  var overrideFn = priv.overrideFn;
104
102
  var rowHeightFn = priv.rowHeightFn;
105
103
  var scrollOffset = priv.scrollOffset;
104
+ var zeroBasedScrollOffset = Math.max(priv.scrollOffset, 0);
106
105
  var totalRows = priv.totalRows;
107
106
  var viewportHeight = priv.viewportHeight;
108
107
  var horizontalScrollbarHeight = priv.horizontalScrollbarHeight || 0;
108
+ var sum = 0;
109
+ var needReverse = true;
110
+ var startPositions = [];
109
111
  var rowHeight;
112
+ var firstVisibleRowHeight = 0;
113
+ var lastVisibleRowHeight = 0;
110
114
 
111
115
  // Calculate the number (start and end index) of rows needed
112
116
  for (var i = 0; i < totalRows; i++) {
@@ -114,26 +118,37 @@ var ViewportRowsCalculator = /*#__PURE__*/function () {
114
118
  if (isNaN(rowHeight)) {
115
119
  rowHeight = ViewportRowsCalculator.DEFAULT_HEIGHT;
116
120
  }
117
- if (sum <= scrollOffset && calculationType !== _constants.FULLY_VISIBLE_TYPE) {
121
+ if (sum <= zeroBasedScrollOffset && calculationType !== _constants.FULLY_VISIBLE_TYPE) {
118
122
  this.startRow = i;
123
+ firstVisibleRowHeight = rowHeight;
119
124
  }
120
- if (sum >= scrollOffset && sum + (calculationType === _constants.FULLY_VISIBLE_TYPE ? rowHeight : 0) <= scrollOffset + viewportHeight - horizontalScrollbarHeight) {
125
+ if (sum >= zeroBasedScrollOffset && sum + (calculationType === _constants.FULLY_VISIBLE_TYPE ? rowHeight : 0) <= zeroBasedScrollOffset + viewportHeight - horizontalScrollbarHeight) {
121
126
  // eslint-disable-line max-len
122
127
  if (this.startRow === null) {
123
128
  this.startRow = i;
129
+ firstVisibleRowHeight = rowHeight;
124
130
  }
125
131
  this.endRow = i;
126
132
  }
127
133
  startPositions.push(sum);
128
134
  sum += rowHeight;
135
+ lastVisibleRowHeight = rowHeight;
129
136
  if (calculationType !== _constants.FULLY_VISIBLE_TYPE) {
130
137
  this.endRow = i;
131
138
  }
132
- if (sum >= scrollOffset + viewportHeight - horizontalScrollbarHeight) {
139
+ if (sum >= zeroBasedScrollOffset + viewportHeight - horizontalScrollbarHeight) {
133
140
  needReverse = false;
134
141
  break;
135
142
  }
136
143
  }
144
+ var mostBottomScrollOffset = scrollOffset + viewportHeight - horizontalScrollbarHeight;
145
+ var topRowOffset = calculationType === _constants.FULLY_VISIBLE_TYPE ? firstVisibleRowHeight : 0;
146
+ var bottomRowOffset = calculationType === _constants.FULLY_VISIBLE_TYPE ? 0 : lastVisibleRowHeight;
147
+ if (mostBottomScrollOffset < topRowOffset || scrollOffset > startPositions.at(-1) + bottomRowOffset) {
148
+ this.isVisibleInTrimmingContainer = false;
149
+ } else {
150
+ this.isVisibleInTrimmingContainer = true;
151
+ }
137
152
 
138
153
  // If the estimation has reached the last row and there is still some space available in the viewport,
139
154
  // we need to render in reverse in order to fill the whole viewport with rows
@@ -82,6 +82,7 @@ var ViewportRowsCalculator = /*#__PURE__*/function () {
82
82
  * @type {number|null}
83
83
  */
84
84
  this.startPosition = null;
85
+ this.isVisibleInTrimmingContainer = false;
85
86
  this.calculate();
86
87
  }
87
88
 
@@ -91,18 +92,21 @@ var ViewportRowsCalculator = /*#__PURE__*/function () {
91
92
  _createClass(ViewportRowsCalculator, [{
92
93
  key: "calculate",
93
94
  value: function calculate() {
94
- var sum = 0;
95
- var needReverse = true;
96
- var startPositions = [];
97
95
  var priv = privatePool.get(this);
98
96
  var calculationType = priv.calculationType;
99
97
  var overrideFn = priv.overrideFn;
100
98
  var rowHeightFn = priv.rowHeightFn;
101
99
  var scrollOffset = priv.scrollOffset;
100
+ var zeroBasedScrollOffset = Math.max(priv.scrollOffset, 0);
102
101
  var totalRows = priv.totalRows;
103
102
  var viewportHeight = priv.viewportHeight;
104
103
  var horizontalScrollbarHeight = priv.horizontalScrollbarHeight || 0;
104
+ var sum = 0;
105
+ var needReverse = true;
106
+ var startPositions = [];
105
107
  var rowHeight;
108
+ var firstVisibleRowHeight = 0;
109
+ var lastVisibleRowHeight = 0;
106
110
 
107
111
  // Calculate the number (start and end index) of rows needed
108
112
  for (var i = 0; i < totalRows; i++) {
@@ -110,26 +114,37 @@ var ViewportRowsCalculator = /*#__PURE__*/function () {
110
114
  if (isNaN(rowHeight)) {
111
115
  rowHeight = ViewportRowsCalculator.DEFAULT_HEIGHT;
112
116
  }
113
- if (sum <= scrollOffset && calculationType !== FULLY_VISIBLE_TYPE) {
117
+ if (sum <= zeroBasedScrollOffset && calculationType !== FULLY_VISIBLE_TYPE) {
114
118
  this.startRow = i;
119
+ firstVisibleRowHeight = rowHeight;
115
120
  }
116
- if (sum >= scrollOffset && sum + (calculationType === FULLY_VISIBLE_TYPE ? rowHeight : 0) <= scrollOffset + viewportHeight - horizontalScrollbarHeight) {
121
+ if (sum >= zeroBasedScrollOffset && sum + (calculationType === FULLY_VISIBLE_TYPE ? rowHeight : 0) <= zeroBasedScrollOffset + viewportHeight - horizontalScrollbarHeight) {
117
122
  // eslint-disable-line max-len
118
123
  if (this.startRow === null) {
119
124
  this.startRow = i;
125
+ firstVisibleRowHeight = rowHeight;
120
126
  }
121
127
  this.endRow = i;
122
128
  }
123
129
  startPositions.push(sum);
124
130
  sum += rowHeight;
131
+ lastVisibleRowHeight = rowHeight;
125
132
  if (calculationType !== FULLY_VISIBLE_TYPE) {
126
133
  this.endRow = i;
127
134
  }
128
- if (sum >= scrollOffset + viewportHeight - horizontalScrollbarHeight) {
135
+ if (sum >= zeroBasedScrollOffset + viewportHeight - horizontalScrollbarHeight) {
129
136
  needReverse = false;
130
137
  break;
131
138
  }
132
139
  }
140
+ var mostBottomScrollOffset = scrollOffset + viewportHeight - horizontalScrollbarHeight;
141
+ var topRowOffset = calculationType === FULLY_VISIBLE_TYPE ? firstVisibleRowHeight : 0;
142
+ var bottomRowOffset = calculationType === FULLY_VISIBLE_TYPE ? 0 : lastVisibleRowHeight;
143
+ if (mostBottomScrollOffset < topRowOffset || scrollOffset > startPositions.at(-1) + bottomRowOffset) {
144
+ this.isVisibleInTrimmingContainer = false;
145
+ } else {
146
+ this.isVisibleInTrimmingContainer = true;
147
+ }
133
148
 
134
149
  // If the estimation has reached the last row and there is still some space available in the viewport,
135
150
  // we need to render in reverse in order to fill the whole viewport with rows
@@ -43,44 +43,40 @@ var CoreAbstract = /*#__PURE__*/function () {
43
43
  _defineProperty(this, "wtOverlays", void 0);
44
44
  _defineProperty(this, "selections", void 0);
45
45
  _defineProperty(this, "wtEvent", void 0);
46
- _defineProperty(this, "guid", "wt_".concat((0, _string.randomString)()));
47
- _defineProperty(this, "drawInterrupted", false);
48
- _defineProperty(this, "drawn", false);
49
- _defineProperty(this, "domBindings", void 0);
50
- _defineProperty(this, "wtSettings", void 0);
51
- this.domBindings = {
52
- rootTable: table,
53
- rootDocument: table.ownerDocument,
54
- rootWindow: table.ownerDocument.defaultView
55
- };
56
- this.wtSettings = settings;
57
- this.wtScroll = new _scroll.default(this.createScrollDao());
58
- }
59
- _createClass(CoreAbstract, [{
60
- key: "eventManager",
61
- get:
62
46
  /**
63
47
  * The walkontable instance id.
64
48
  *
65
49
  * @public
66
50
  * @type {Readonly<string>}
67
51
  */
68
-
52
+ _defineProperty(this, "guid", "wt_".concat((0, _string.randomString)()));
53
+ _defineProperty(this, "drawInterrupted", false);
54
+ _defineProperty(this, "drawn", false);
69
55
  /**
70
56
  * The DOM bindings.
71
57
  *
72
58
  * @public
73
59
  * @type {DomBindings}
74
60
  */
75
-
61
+ _defineProperty(this, "domBindings", void 0);
76
62
  /**
77
63
  * Settings.
78
64
  *
79
65
  * @public
80
66
  * @type {Settings}
81
67
  */
82
-
83
- function get() {
68
+ _defineProperty(this, "wtSettings", void 0);
69
+ this.domBindings = {
70
+ rootTable: table,
71
+ rootDocument: table.ownerDocument,
72
+ rootWindow: table.ownerDocument.defaultView
73
+ };
74
+ this.wtSettings = settings;
75
+ this.wtScroll = new _scroll.default(this.createScrollDao());
76
+ }
77
+ _createClass(CoreAbstract, [{
78
+ key: "eventManager",
79
+ get: function get() {
84
80
  return new _eventManager.default(this);
85
81
  }
86
82
  }, {
@@ -292,6 +288,9 @@ var CoreAbstract = /*#__PURE__*/function () {
292
288
  return wot.wtViewport; // TODO refactoring: move outside dao, use IOC
293
289
  },
294
290
 
291
+ get wtSettings() {
292
+ return wot.wtSettings;
293
+ },
295
294
  get rootWindow() {
296
295
  return wot.domBindings.rootWindow; // TODO refactoring: move outside dao
297
296
  },
@@ -38,44 +38,40 @@ var CoreAbstract = /*#__PURE__*/function () {
38
38
  _defineProperty(this, "wtOverlays", void 0);
39
39
  _defineProperty(this, "selections", void 0);
40
40
  _defineProperty(this, "wtEvent", void 0);
41
- _defineProperty(this, "guid", "wt_".concat(randomString()));
42
- _defineProperty(this, "drawInterrupted", false);
43
- _defineProperty(this, "drawn", false);
44
- _defineProperty(this, "domBindings", void 0);
45
- _defineProperty(this, "wtSettings", void 0);
46
- this.domBindings = {
47
- rootTable: table,
48
- rootDocument: table.ownerDocument,
49
- rootWindow: table.ownerDocument.defaultView
50
- };
51
- this.wtSettings = settings;
52
- this.wtScroll = new Scroll(this.createScrollDao());
53
- }
54
- _createClass(CoreAbstract, [{
55
- key: "eventManager",
56
- get:
57
41
  /**
58
42
  * The walkontable instance id.
59
43
  *
60
44
  * @public
61
45
  * @type {Readonly<string>}
62
46
  */
63
-
47
+ _defineProperty(this, "guid", "wt_".concat(randomString()));
48
+ _defineProperty(this, "drawInterrupted", false);
49
+ _defineProperty(this, "drawn", false);
64
50
  /**
65
51
  * The DOM bindings.
66
52
  *
67
53
  * @public
68
54
  * @type {DomBindings}
69
55
  */
70
-
56
+ _defineProperty(this, "domBindings", void 0);
71
57
  /**
72
58
  * Settings.
73
59
  *
74
60
  * @public
75
61
  * @type {Settings}
76
62
  */
77
-
78
- function get() {
63
+ _defineProperty(this, "wtSettings", void 0);
64
+ this.domBindings = {
65
+ rootTable: table,
66
+ rootDocument: table.ownerDocument,
67
+ rootWindow: table.ownerDocument.defaultView
68
+ };
69
+ this.wtSettings = settings;
70
+ this.wtScroll = new Scroll(this.createScrollDao());
71
+ }
72
+ _createClass(CoreAbstract, [{
73
+ key: "eventManager",
74
+ get: function get() {
79
75
  return new EventManager(this);
80
76
  }
81
77
  }, {
@@ -287,6 +283,9 @@ var CoreAbstract = /*#__PURE__*/function () {
287
283
  return wot.wtViewport; // TODO refactoring: move outside dao, use IOC
288
284
  },
289
285
 
286
+ get wtSettings() {
287
+ return wot.wtSettings;
288
+ },
290
289
  get rootWindow() {
291
290
  return wot.domBindings.rootWindow; // TODO refactoring: move outside dao
292
291
  },
@@ -295,6 +295,7 @@ var Scroll = /*#__PURE__*/function () {
295
295
  key: "getLastVisibleColumn",
296
296
  value: function getLastVisibleColumn() {
297
297
  var _this$dataAccessObjec8 = this.dataAccessObject,
298
+ wtSettings = _this$dataAccessObjec8.wtSettings,
298
299
  inlineStartOverlay = _this$dataAccessObjec8.inlineStartOverlay,
299
300
  wtTable = _this$dataAccessObjec8.wtTable,
300
301
  wtViewport = _this$dataAccessObjec8.wtViewport,
@@ -302,16 +303,26 @@ var Scroll = /*#__PURE__*/function () {
302
303
  rootWindow = _this$dataAccessObjec8.rootWindow;
303
304
  var lastVisibleColumn = wtTable.getLastVisibleColumn();
304
305
  if (inlineStartOverlay.mainTableScrollableElement === rootWindow) {
305
- var rootElementOffset = (0, _element.offset)(wtTable.wtRootElement);
306
+ var isRtl = wtSettings.getSetting('rtlMode');
307
+ var inlineStartRootElementOffset = null;
308
+ if (isRtl) {
309
+ var tableRect = wtTable.TABLE.getBoundingClientRect();
310
+ var rootDocument = this.dataAccessObject.rootWindow.document;
311
+ var docOffsetWidth = rootDocument.documentElement.offsetWidth;
312
+ inlineStartRootElementOffset = Math.abs(tableRect.right - docOffsetWidth);
313
+ } else {
314
+ var rootElementOffset = (0, _element.offset)(wtTable.wtRootElement);
315
+ inlineStartRootElementOffset = rootElementOffset.left;
316
+ }
306
317
  var windowScrollLeft = Math.abs((0, _element.getScrollLeft)(rootWindow, rootWindow));
307
318
 
308
319
  // Only calculate lastVisibleColumn when table didn't filled (from right) whole viewport space
309
- if (rootElementOffset.left > windowScrollLeft) {
320
+ if (inlineStartRootElementOffset > windowScrollLeft) {
310
321
  var windowWidth = (0, _element.innerWidth)(rootWindow);
311
322
  var columnsWidth = wtViewport.getRowHeaderWidth();
312
323
  for (var column = 1; column <= totalColumns; column++) {
313
324
  columnsWidth += inlineStartOverlay.sumCellSizes(column - 1, column);
314
- if (rootElementOffset.left + columnsWidth - windowScrollLeft >= windowWidth) {
325
+ if (inlineStartRootElementOffset + columnsWidth - windowScrollLeft >= windowWidth) {
315
326
  // Return physical column - 1 (-2 because rangeEach gives column index + 1 - sumCellSizes requirements)
316
327
  lastVisibleColumn = column - 2;
317
328
  break;
@@ -291,6 +291,7 @@ var Scroll = /*#__PURE__*/function () {
291
291
  key: "getLastVisibleColumn",
292
292
  value: function getLastVisibleColumn() {
293
293
  var _this$dataAccessObjec8 = this.dataAccessObject,
294
+ wtSettings = _this$dataAccessObjec8.wtSettings,
294
295
  inlineStartOverlay = _this$dataAccessObjec8.inlineStartOverlay,
295
296
  wtTable = _this$dataAccessObjec8.wtTable,
296
297
  wtViewport = _this$dataAccessObjec8.wtViewport,
@@ -298,16 +299,26 @@ var Scroll = /*#__PURE__*/function () {
298
299
  rootWindow = _this$dataAccessObjec8.rootWindow;
299
300
  var lastVisibleColumn = wtTable.getLastVisibleColumn();
300
301
  if (inlineStartOverlay.mainTableScrollableElement === rootWindow) {
301
- var rootElementOffset = offset(wtTable.wtRootElement);
302
+ var isRtl = wtSettings.getSetting('rtlMode');
303
+ var inlineStartRootElementOffset = null;
304
+ if (isRtl) {
305
+ var tableRect = wtTable.TABLE.getBoundingClientRect();
306
+ var rootDocument = this.dataAccessObject.rootWindow.document;
307
+ var docOffsetWidth = rootDocument.documentElement.offsetWidth;
308
+ inlineStartRootElementOffset = Math.abs(tableRect.right - docOffsetWidth);
309
+ } else {
310
+ var rootElementOffset = offset(wtTable.wtRootElement);
311
+ inlineStartRootElementOffset = rootElementOffset.left;
312
+ }
302
313
  var windowScrollLeft = Math.abs(getScrollLeft(rootWindow, rootWindow));
303
314
 
304
315
  // Only calculate lastVisibleColumn when table didn't filled (from right) whole viewport space
305
- if (rootElementOffset.left > windowScrollLeft) {
316
+ if (inlineStartRootElementOffset > windowScrollLeft) {
306
317
  var windowWidth = innerWidth(rootWindow);
307
318
  var columnsWidth = wtViewport.getRowHeaderWidth();
308
319
  for (var column = 1; column <= totalColumns; column++) {
309
320
  columnsWidth += inlineStartOverlay.sumCellSizes(column - 1, column);
310
- if (rootElementOffset.left + columnsWidth - windowScrollLeft >= windowWidth) {
321
+ if (inlineStartRootElementOffset + columnsWidth - windowScrollLeft >= windowWidth) {
311
322
  // Return physical column - 1 (-2 because rangeEach gives column index + 1 - sumCellSizes requirements)
312
323
  lastVisibleColumn = column - 2;
313
324
  break;
@@ -677,7 +677,8 @@ var Table = /*#__PURE__*/function () {
677
677
  *
678
678
  * @param {number} row Row index.
679
679
  * @param {number} [level=0] Header level (0 = most distant to the table).
680
- * @returns {HTMLElement} HTMLElement on success or Number one of the exit codes on error: `null table doesn't have row headers`.
680
+ * @returns {HTMLElement} HTMLElement on success or Number one of the exit codes on error: `null table doesn't have
681
+ * row headers`.
681
682
  */
682
683
  }, {
683
684
  key: "getRowHeader",
@@ -722,7 +723,8 @@ var Table = /*#__PURE__*/function () {
722
723
  * Returns cell coords object for a given TD (or a child element of a TD element).
723
724
  *
724
725
  * @param {HTMLTableCellElement} TD A cell DOM element (or a child of one).
725
- * @returns {CellCoords|null} The coordinates of the provided TD element (or the closest TD element) or null, if the provided element is not applicable.
726
+ * @returns {CellCoords|null} The coordinates of the provided TD element (or the closest TD element) or null, if the
727
+ * provided element is not applicable.
726
728
  */
727
729
  }, {
728
730
  key: "getCoords",
@@ -672,7 +672,8 @@ var Table = /*#__PURE__*/function () {
672
672
  *
673
673
  * @param {number} row Row index.
674
674
  * @param {number} [level=0] Header level (0 = most distant to the table).
675
- * @returns {HTMLElement} HTMLElement on success or Number one of the exit codes on error: `null table doesn't have row headers`.
675
+ * @returns {HTMLElement} HTMLElement on success or Number one of the exit codes on error: `null table doesn't have
676
+ * row headers`.
676
677
  */
677
678
  }, {
678
679
  key: "getRowHeader",
@@ -717,7 +718,8 @@ var Table = /*#__PURE__*/function () {
717
718
  * Returns cell coords object for a given TD (or a child element of a TD element).
718
719
  *
719
720
  * @param {HTMLTableCellElement} TD A cell DOM element (or a child of one).
720
- * @returns {CellCoords|null} The coordinates of the provided TD element (or the closest TD element) or null, if the provided element is not applicable.
721
+ * @returns {CellCoords|null} The coordinates of the provided TD element (or the closest TD element) or null, if the
722
+ * provided element is not applicable.
721
723
  */
722
724
  }, {
723
725
  key: "getCoords",
@@ -50,6 +50,7 @@
50
50
  * @property {number} totalRows TotalRows.
51
51
  * @property {Window} rootWindow RootWindow.
52
52
  * @property {Viewport} wtViewport WtViewport.
53
+ * @property {Settings} wtSettings Walkontable Settings.
53
54
  */
54
55
  /**
55
56
  * The Data Access Object for Table class.
@@ -50,6 +50,7 @@
50
50
  * @property {number} totalRows TotalRows.
51
51
  * @property {Window} rootWindow RootWindow.
52
52
  * @property {Viewport} wtViewport WtViewport.
53
+ * @property {Settings} wtSettings Walkontable Settings.
53
54
  */
54
55
  /**
55
56
  * The Data Access Object for Table class.