handsontable 0.0.0-next-10cbf34-20221130 → 0.0.0-next-4a99ab8-20221201

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of handsontable might be problematic. Click here for more details.

@@ -1,5 +1,5 @@
1
1
  export default class CellCoords {
2
- constructor(row: number, column: number);
2
+ constructor(row: number, column: number, isRtl?: boolean);
3
3
 
4
4
  row: number;
5
5
  col: number;
@@ -19,20 +19,33 @@ function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _
19
19
  function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
20
20
  function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
21
21
  var _isRtl = /*#__PURE__*/new WeakMap();
22
+ /* eslint-disable jsdoc/require-description-complete-sentence */
22
23
  /**
23
- * CellCoords holds cell coordinates (row, column) and few method to validate them and retrieve as an array or an object.
24
+ * @description
24
25
  *
25
- * @util
26
+ * The `CellCoords` class holds the coordinates (`row`, `col`) of a single cell.
27
+ *
28
+ * It also contains methods for validating the coordinates
29
+ * and retrieving them as an object.
30
+ *
31
+ * To import the `CellCoords` class:
32
+ *
33
+ * ```js
34
+ * import Handsontable, { CellCoords } from '/handsontable';
35
+ *
36
+ * // or, using modules
37
+ * import Handsontable, { CellCoords } from '/handsontable/base';
38
+ * ```
26
39
  */
27
40
  var CellCoords = /*#__PURE__*/function () {
28
41
  /**
29
- * Row index.
42
+ * A visual row index.
30
43
  *
31
44
  * @type {number}
32
45
  */
33
46
 
34
47
  /**
35
- * Column index.
48
+ * A visual column index.
36
49
  *
37
50
  * @type {number}
38
51
  */
@@ -58,19 +71,28 @@ var CellCoords = /*#__PURE__*/function () {
58
71
  }
59
72
 
60
73
  /**
61
- * Checks if given set of coordinates is valid in context of a given Walkontable instance.
74
+ * Checks if the coordinates in your `CellCoords` instance are valid
75
+ * in the context of a given Walkontable instance.
76
+ *
77
+ * The `row` index:
78
+ * - Can't be negative.
79
+ * - Can't be higher than the total number of rows in the Walkontable instance.
80
+ *
81
+ * The `col` index:
82
+ * - Can't be negative.
83
+ * - Can't be higher than the total number of columns in the Walkontable instance.
62
84
  *
63
85
  * @param {Walkontable} wot A Walkontable instance.
64
- * @returns {boolean}
86
+ * @returns {boolean} `true`: The coordinates are valid.
65
87
  */
66
88
  _createClass(CellCoords, [{
67
89
  key: "isValid",
68
90
  value: function isValid(wot) {
69
- // is it a valid cell index (0 or higher)
91
+ // check if the row and column indexes are valid (0 or higher)
70
92
  if (this.row < 0 || this.col < 0) {
71
93
  return false;
72
94
  }
73
- // is selection within total rows and columns
95
+ // check if the selection fits in the total of rows and columns
74
96
  if (this.row >= wot.getSetting('totalRows') || this.col >= wot.getSetting('totalColumns')) {
75
97
  return false;
76
98
  }
@@ -78,9 +100,10 @@ var CellCoords = /*#__PURE__*/function () {
78
100
  }
79
101
 
80
102
  /**
81
- * Checks if this cell coordinates are the same as cell coordinates given as an argument.
103
+ * Checks if another set of coordinates (`cellCoords`)
104
+ * is equal to the coordinates in your `CellCoords` instance.
82
105
  *
83
- * @param {CellCoords} cellCoords Cell coordinates to equal.
106
+ * @param {CellCoords} cellCoords Coordinates to check.
84
107
  * @returns {boolean}
85
108
  */
86
109
  }, {
@@ -93,9 +116,10 @@ var CellCoords = /*#__PURE__*/function () {
93
116
  }
94
117
 
95
118
  /**
96
- * Checks if tested coordinates are positioned in south-east from this cell coordinates.
119
+ * Checks if another set of coordinates (`testedCoords`)
120
+ * is south-east of the coordinates in your `CellCoords` instance.
97
121
  *
98
- * @param {object} testedCoords Cell coordinates to check.
122
+ * @param {CellCoords} testedCoords Coordinates to check.
99
123
  * @returns {boolean}
100
124
  */
101
125
  }, {
@@ -105,9 +129,10 @@ var CellCoords = /*#__PURE__*/function () {
105
129
  }
106
130
 
107
131
  /**
108
- * Checks if tested coordinates are positioned in north-east from this cell coordinates.
132
+ * Checks if another set of coordinates (`testedCoords`)
133
+ * is north-west of the coordinates in your `CellCoords` instance.
109
134
  *
110
- * @param {object} testedCoords Cell coordinates to check.
135
+ * @param {CellCoords} testedCoords Coordinates to check.
111
136
  * @returns {boolean}
112
137
  */
113
138
  }, {
@@ -117,9 +142,10 @@ var CellCoords = /*#__PURE__*/function () {
117
142
  }
118
143
 
119
144
  /**
120
- * Checks if tested coordinates are positioned in south-west from this cell coordinates.
145
+ * Checks if another set of coordinates (`testedCoords`)
146
+ * is south-west of the coordinates in your `CellCoords` instance.
121
147
  *
122
- * @param {object} testedCoords Cell coordinates to check.
148
+ * @param {CellCoords} testedCoords Coordinates to check.
123
149
  * @returns {boolean}
124
150
  */
125
151
  }, {
@@ -129,9 +155,10 @@ var CellCoords = /*#__PURE__*/function () {
129
155
  }
130
156
 
131
157
  /**
132
- * Checks if tested coordinates are positioned in north-east from this cell coordinates.
158
+ * Checks if another set of coordinates (`testedCoords`)
159
+ * is north-east of the coordinates in your `CellCoords` instance.
133
160
  *
134
- * @param {object} testedCoords Cell coordinates to check.
161
+ * @param {CellCoords} testedCoords Coordinates to check.
135
162
  * @returns {boolean}
136
163
  */
137
164
  }, {
@@ -141,8 +168,9 @@ var CellCoords = /*#__PURE__*/function () {
141
168
  }
142
169
 
143
170
  /**
144
- * Normalizes the coordinates to the nearest valid position. The coordinates that point
145
- * to the headers (negative values) are normalized to 0.
171
+ * Normalizes the coordinates in your `CellCoords` instance to the nearest valid position.
172
+ *
173
+ * Coordinates that point to headers (negative values) are normalized to `0`.
146
174
  *
147
175
  * @returns {CellCoords}
148
176
  */
@@ -155,7 +183,7 @@ var CellCoords = /*#__PURE__*/function () {
155
183
  }
156
184
 
157
185
  /**
158
- * Clones the coordinates.
186
+ * Clones your `CellCoords` instance.
159
187
  *
160
188
  * @returns {CellCoords}
161
189
  */
@@ -166,9 +194,9 @@ var CellCoords = /*#__PURE__*/function () {
166
194
  }
167
195
 
168
196
  /**
169
- * Converts CellCoords to literal object with `row` and `col` properties.
197
+ * Converts your `CellCoords` instance into an object literal with `row` and `col` properties.
170
198
  *
171
- * @returns {object} Returns a literal object with `row` and `col` properties.
199
+ * @returns {{row: number, col: number}} An object literal with `row` and `col` properties.
172
200
  */
173
201
  }, {
174
202
  key: "toObject",
@@ -15,20 +15,33 @@ function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _
15
15
  function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
16
16
  function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
17
17
  var _isRtl = /*#__PURE__*/new WeakMap();
18
+ /* eslint-disable jsdoc/require-description-complete-sentence */
18
19
  /**
19
- * CellCoords holds cell coordinates (row, column) and few method to validate them and retrieve as an array or an object.
20
+ * @description
20
21
  *
21
- * @util
22
+ * The `CellCoords` class holds the coordinates (`row`, `col`) of a single cell.
23
+ *
24
+ * It also contains methods for validating the coordinates
25
+ * and retrieving them as an object.
26
+ *
27
+ * To import the `CellCoords` class:
28
+ *
29
+ * ```js
30
+ * import Handsontable, { CellCoords } from '/handsontable';
31
+ *
32
+ * // or, using modules
33
+ * import Handsontable, { CellCoords } from '/handsontable/base';
34
+ * ```
22
35
  */
23
36
  var CellCoords = /*#__PURE__*/function () {
24
37
  /**
25
- * Row index.
38
+ * A visual row index.
26
39
  *
27
40
  * @type {number}
28
41
  */
29
42
 
30
43
  /**
31
- * Column index.
44
+ * A visual column index.
32
45
  *
33
46
  * @type {number}
34
47
  */
@@ -54,19 +67,28 @@ var CellCoords = /*#__PURE__*/function () {
54
67
  }
55
68
 
56
69
  /**
57
- * Checks if given set of coordinates is valid in context of a given Walkontable instance.
70
+ * Checks if the coordinates in your `CellCoords` instance are valid
71
+ * in the context of a given Walkontable instance.
72
+ *
73
+ * The `row` index:
74
+ * - Can't be negative.
75
+ * - Can't be higher than the total number of rows in the Walkontable instance.
76
+ *
77
+ * The `col` index:
78
+ * - Can't be negative.
79
+ * - Can't be higher than the total number of columns in the Walkontable instance.
58
80
  *
59
81
  * @param {Walkontable} wot A Walkontable instance.
60
- * @returns {boolean}
82
+ * @returns {boolean} `true`: The coordinates are valid.
61
83
  */
62
84
  _createClass(CellCoords, [{
63
85
  key: "isValid",
64
86
  value: function isValid(wot) {
65
- // is it a valid cell index (0 or higher)
87
+ // check if the row and column indexes are valid (0 or higher)
66
88
  if (this.row < 0 || this.col < 0) {
67
89
  return false;
68
90
  }
69
- // is selection within total rows and columns
91
+ // check if the selection fits in the total of rows and columns
70
92
  if (this.row >= wot.getSetting('totalRows') || this.col >= wot.getSetting('totalColumns')) {
71
93
  return false;
72
94
  }
@@ -74,9 +96,10 @@ var CellCoords = /*#__PURE__*/function () {
74
96
  }
75
97
 
76
98
  /**
77
- * Checks if this cell coordinates are the same as cell coordinates given as an argument.
99
+ * Checks if another set of coordinates (`cellCoords`)
100
+ * is equal to the coordinates in your `CellCoords` instance.
78
101
  *
79
- * @param {CellCoords} cellCoords Cell coordinates to equal.
102
+ * @param {CellCoords} cellCoords Coordinates to check.
80
103
  * @returns {boolean}
81
104
  */
82
105
  }, {
@@ -89,9 +112,10 @@ var CellCoords = /*#__PURE__*/function () {
89
112
  }
90
113
 
91
114
  /**
92
- * Checks if tested coordinates are positioned in south-east from this cell coordinates.
115
+ * Checks if another set of coordinates (`testedCoords`)
116
+ * is south-east of the coordinates in your `CellCoords` instance.
93
117
  *
94
- * @param {object} testedCoords Cell coordinates to check.
118
+ * @param {CellCoords} testedCoords Coordinates to check.
95
119
  * @returns {boolean}
96
120
  */
97
121
  }, {
@@ -101,9 +125,10 @@ var CellCoords = /*#__PURE__*/function () {
101
125
  }
102
126
 
103
127
  /**
104
- * Checks if tested coordinates are positioned in north-east from this cell coordinates.
128
+ * Checks if another set of coordinates (`testedCoords`)
129
+ * is north-west of the coordinates in your `CellCoords` instance.
105
130
  *
106
- * @param {object} testedCoords Cell coordinates to check.
131
+ * @param {CellCoords} testedCoords Coordinates to check.
107
132
  * @returns {boolean}
108
133
  */
109
134
  }, {
@@ -113,9 +138,10 @@ var CellCoords = /*#__PURE__*/function () {
113
138
  }
114
139
 
115
140
  /**
116
- * Checks if tested coordinates are positioned in south-west from this cell coordinates.
141
+ * Checks if another set of coordinates (`testedCoords`)
142
+ * is south-west of the coordinates in your `CellCoords` instance.
117
143
  *
118
- * @param {object} testedCoords Cell coordinates to check.
144
+ * @param {CellCoords} testedCoords Coordinates to check.
119
145
  * @returns {boolean}
120
146
  */
121
147
  }, {
@@ -125,9 +151,10 @@ var CellCoords = /*#__PURE__*/function () {
125
151
  }
126
152
 
127
153
  /**
128
- * Checks if tested coordinates are positioned in north-east from this cell coordinates.
154
+ * Checks if another set of coordinates (`testedCoords`)
155
+ * is north-east of the coordinates in your `CellCoords` instance.
129
156
  *
130
- * @param {object} testedCoords Cell coordinates to check.
157
+ * @param {CellCoords} testedCoords Coordinates to check.
131
158
  * @returns {boolean}
132
159
  */
133
160
  }, {
@@ -137,8 +164,9 @@ var CellCoords = /*#__PURE__*/function () {
137
164
  }
138
165
 
139
166
  /**
140
- * Normalizes the coordinates to the nearest valid position. The coordinates that point
141
- * to the headers (negative values) are normalized to 0.
167
+ * Normalizes the coordinates in your `CellCoords` instance to the nearest valid position.
168
+ *
169
+ * Coordinates that point to headers (negative values) are normalized to `0`.
142
170
  *
143
171
  * @returns {CellCoords}
144
172
  */
@@ -151,7 +179,7 @@ var CellCoords = /*#__PURE__*/function () {
151
179
  }
152
180
 
153
181
  /**
154
- * Clones the coordinates.
182
+ * Clones your `CellCoords` instance.
155
183
  *
156
184
  * @returns {CellCoords}
157
185
  */
@@ -162,9 +190,9 @@ var CellCoords = /*#__PURE__*/function () {
162
190
  }
163
191
 
164
192
  /**
165
- * Converts CellCoords to literal object with `row` and `col` properties.
193
+ * Converts your `CellCoords` instance into an object literal with `row` and `col` properties.
166
194
  *
167
- * @returns {object} Returns a literal object with `row` and `col` properties.
195
+ * @returns {{row: number, col: number}} An object literal with `row` and `col` properties.
168
196
  */
169
197
  }, {
170
198
  key: "toObject",
@@ -1,7 +1,9 @@
1
1
  import CellCoords from './coords';
2
2
 
3
+ type DirectionType = 'NW-SE' | 'NE-SW' | 'SE-NW' | 'SW-NE';
4
+
3
5
  export default class CellRange {
4
- constructor(highlight: CellCoords, from?: CellCoords, to?: CellCoords);
6
+ constructor(highlight: CellCoords, from?: CellCoords, to?: CellCoords, isRtl?: boolean);
5
7
 
6
8
  highlight: CellCoords;
7
9
  from: CellCoords;
@@ -16,6 +18,7 @@ export default class CellRange {
16
18
  getOuterWidth(): number;
17
19
  getHeight(): number;
18
20
  getWidth(): number;
21
+ getCellsCount(): number;
19
22
  includes(cellCoords: CellCoords): boolean;
20
23
  includesRange(cellRange: CellRange): boolean;
21
24
  isEqual(cellRange: CellRange): boolean;
@@ -26,34 +29,34 @@ export default class CellRange {
26
29
  isOverlappingVertically(cellRange: CellRange): boolean;
27
30
  expand(cellCoords: CellCoords): boolean;
28
31
  expandByRange(expandingRange: CellRange): boolean;
29
- getDirection(): string;
30
- setDirection(direction: string): void;
31
- getVerticalDirection(): string;
32
- getHorizontalDirection(): string;
32
+ getDirection(): DirectionType;
33
+ setDirection(direction: DirectionType): void;
34
+ getVerticalDirection(): 'N-S' | 'S-N';
35
+ getHorizontalDirection(): 'W-E' | 'E-W';
33
36
  flipDirectionVertically(): void;
34
37
  flipDirectionHorizontally(): void;
35
38
  getTopStartCorner(): CellCoords;
36
- getTopEndCorner(): CellCoords;
37
- getBottomStartCorner(): CellCoords;
38
- getBottomEndCorner(): CellCoords;
39
39
  getTopLeftCorner(): CellCoords;
40
+ getBottomEndCorner(): CellCoords;
41
+ getBottomRightCorner(): CellCoords;
42
+ getTopEndCorner(): CellCoords;
40
43
  getTopRightCorner(): CellCoords;
44
+ getBottomStartCorner(): CellCoords;
41
45
  getBottomLeftCorner(): CellCoords;
42
- getBottomRightCorner(): CellCoords;
43
46
  getOuterTopStartCorner(): CellCoords;
44
- getOuterTopEndCorner(): CellCoords;
45
47
  getOuterTopLeftCorner(): CellCoords;
48
+ getOuterBottomEndCorner(): CellCoords;
49
+ getOuterBottomRightCorner(): CellCoords;
50
+ getOuterTopEndCorner(): CellCoords;
46
51
  getOuterTopRightCorner(): CellCoords;
47
52
  getOuterBottomStartCorner(): CellCoords;
48
- getOuterBottomEndCorner(): CellCoords;
49
53
  getOuterBottomLeftCorner(): CellCoords;
50
- getOuterBottomRightCorner(): CellCoords;
51
54
  isCorner(coords: CellCoords, expandedRange?: CellRange): boolean;
52
55
  getOppositeCorner(coords: CellCoords, expandedRange?: CellRange): CellCoords;
53
- getBordersSharedWith(range: CellRange): any[];
54
- getInner(): any[];
55
- getAll(): any[];
56
+ getBordersSharedWith(range: CellRange): Array<'top' | 'right' | 'bottom' | 'left'>;
57
+ getInner(): CellCoords[];
58
+ getAll(): CellCoords[];
56
59
  forAll(callback: (row: number, column: number) => boolean): void;
57
60
  clone(): CellRange;
58
- toObject(): any;
61
+ toObject(): { from: { row: number, col: number}, to: { row: number, col: number} };
59
62
  }