@rowsncolumns/grid 8.0.8 → 9.0.1
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/dist/Cell.d.ts +1 -1
- package/dist/Cell.js +10 -6
- package/dist/Cell.js.map +1 -1
- package/dist/CellOverlay.js +17 -12
- package/dist/CellOverlay.js.map +1 -1
- package/dist/FillHandle.d.ts +1 -1
- package/dist/FillHandle.js +2 -2
- package/dist/FillHandle.js.map +1 -1
- package/dist/Grid.d.ts +17 -15
- package/dist/Grid.js +139 -133
- package/dist/Grid.js.map +1 -1
- package/dist/GridLine.d.ts +1 -1
- package/dist/GridLine.js.map +1 -1
- package/dist/Image.d.ts +2 -2
- package/dist/Image.js +13 -7
- package/dist/Image.js.map +1 -1
- package/dist/Selection.js +2 -2
- package/dist/Selection.js.map +1 -1
- package/dist/helpers.d.ts +6 -7
- package/dist/helpers.js +139 -100
- package/dist/helpers.js.map +1 -1
- package/dist/hooks/useCopyPaste.js +12 -12
- package/dist/hooks/useCopyPaste.js.map +1 -1
- package/dist/hooks/useEditable.d.ts +3 -3
- package/dist/hooks/useEditable.js +57 -52
- package/dist/hooks/useEditable.js.map +1 -1
- package/dist/hooks/useFilter.d.ts +7 -7
- package/dist/hooks/useFilter.js +17 -13
- package/dist/hooks/useFilter.js.map +1 -1
- package/dist/hooks/useImage.js +2 -2
- package/dist/hooks/useImage.js.map +1 -1
- package/dist/hooks/usePagination.d.ts +3 -3
- package/dist/hooks/usePagination.js +9 -5
- package/dist/hooks/usePagination.js.map +1 -1
- package/dist/hooks/useSelection.d.ts +2 -2
- package/dist/hooks/useSelection.js +65 -65
- package/dist/hooks/useSelection.js.map +1 -1
- package/dist/hooks/useSizer.d.ts +3 -3
- package/dist/hooks/useSizer.js +19 -19
- package/dist/hooks/useSizer.js.map +1 -1
- package/dist/hooks/useTooltip.js +22 -18
- package/dist/hooks/useTooltip.js.map +1 -1
- package/dist/hooks/useTouch.js +12 -11
- package/dist/hooks/useTouch.js.map +1 -1
- package/dist/hooks/useUndo.js +9 -9
- package/dist/hooks/useUndo.js.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +25 -23
- package/dist/utils.js.map +1 -1
- package/package.json +9 -9
- package/src/Cell.tsx +1 -1
- package/src/FillHandle.tsx +2 -2
- package/src/Grid.tsx +27 -31
- package/src/GridLine.tsx +3 -3
- package/src/Image.tsx +31 -18
- package/src/helpers.ts +2 -2
- package/src/hooks/useCopyPaste.ts +2 -2
- package/src/hooks/useEditable.tsx +8 -10
- package/src/hooks/useFilter.tsx +3 -3
- package/src/hooks/usePagination.tsx +4 -4
- package/src/hooks/useSelection.ts +13 -23
- package/src/hooks/useSizer.ts +2 -2
- package/src/hooks/useTooltip.tsx +2 -3
- package/src/hooks/useTouch.ts +14 -6
- package/src/tests/Grid.spec.tsx +2 -3
- package/src/tests/usePagination.test.ts +2 -2
- package/src/tests/useSelection.test.ts +3 -1
- package/src/utils.tsx +2 -2
- package/src/.DS_Store +0 -0
- package/src/hooks/.DS_Store +0 -0
package/dist/helpers.js
CHANGED
|
@@ -15,7 +15,7 @@ var ItemType;
|
|
|
15
15
|
ItemType["row"] = "row";
|
|
16
16
|
ItemType["column"] = "column";
|
|
17
17
|
})(ItemType = exports.ItemType || (exports.ItemType = {}));
|
|
18
|
-
|
|
18
|
+
const getRowStartIndexForOffset = ({ rowHeight, columnWidth, rowCount, columnCount, instanceProps, offset, scale, }) => {
|
|
19
19
|
return findNearestItem({
|
|
20
20
|
itemType: ItemType.row,
|
|
21
21
|
rowHeight,
|
|
@@ -27,8 +27,9 @@ exports.getRowStartIndexForOffset = ({ rowHeight, columnWidth, rowCount, columnC
|
|
|
27
27
|
scale,
|
|
28
28
|
});
|
|
29
29
|
};
|
|
30
|
-
exports.
|
|
31
|
-
|
|
30
|
+
exports.getRowStartIndexForOffset = getRowStartIndexForOffset;
|
|
31
|
+
const getRowStopIndexForStartIndex = ({ startIndex, rowCount, rowHeight, columnWidth, scrollTop, containerHeight, instanceProps, scale, }) => {
|
|
32
|
+
const itemMetadata = (0, exports.getItemMetadata)({
|
|
32
33
|
itemType: ItemType.row,
|
|
33
34
|
rowHeight,
|
|
34
35
|
columnWidth,
|
|
@@ -41,7 +42,7 @@ exports.getRowStopIndexForStartIndex = ({ startIndex, rowCount, rowHeight, colum
|
|
|
41
42
|
let stopIndex = startIndex;
|
|
42
43
|
while (stopIndex < rowCount - 1 && offset < maxOffset) {
|
|
43
44
|
stopIndex++;
|
|
44
|
-
offset += exports.getItemMetadata({
|
|
45
|
+
offset += (0, exports.getItemMetadata)({
|
|
45
46
|
itemType: ItemType.row,
|
|
46
47
|
rowHeight,
|
|
47
48
|
columnWidth,
|
|
@@ -52,7 +53,8 @@ exports.getRowStopIndexForStartIndex = ({ startIndex, rowCount, rowHeight, colum
|
|
|
52
53
|
}
|
|
53
54
|
return stopIndex;
|
|
54
55
|
};
|
|
55
|
-
exports.
|
|
56
|
+
exports.getRowStopIndexForStartIndex = getRowStopIndexForStartIndex;
|
|
57
|
+
const getColumnStartIndexForOffset = ({ rowHeight, columnWidth, rowCount, columnCount, instanceProps, offset, scale, }) => {
|
|
56
58
|
return findNearestItem({
|
|
57
59
|
itemType: ItemType.column,
|
|
58
60
|
rowHeight,
|
|
@@ -64,8 +66,9 @@ exports.getColumnStartIndexForOffset = ({ rowHeight, columnWidth, rowCount, colu
|
|
|
64
66
|
scale,
|
|
65
67
|
});
|
|
66
68
|
};
|
|
67
|
-
exports.
|
|
68
|
-
|
|
69
|
+
exports.getColumnStartIndexForOffset = getColumnStartIndexForOffset;
|
|
70
|
+
const getColumnStopIndexForStartIndex = ({ startIndex, rowHeight, columnWidth, instanceProps, containerWidth, scrollLeft, columnCount, scale, }) => {
|
|
71
|
+
const itemMetadata = (0, exports.getItemMetadata)({
|
|
69
72
|
itemType: ItemType.column,
|
|
70
73
|
index: startIndex,
|
|
71
74
|
rowHeight,
|
|
@@ -78,7 +81,7 @@ exports.getColumnStopIndexForStartIndex = ({ startIndex, rowHeight, columnWidth,
|
|
|
78
81
|
let stopIndex = startIndex;
|
|
79
82
|
while (stopIndex < columnCount - 1 && offset < maxOffset) {
|
|
80
83
|
stopIndex++;
|
|
81
|
-
offset += exports.getItemMetadata({
|
|
84
|
+
offset += (0, exports.getItemMetadata)({
|
|
82
85
|
itemType: ItemType.column,
|
|
83
86
|
rowHeight,
|
|
84
87
|
columnWidth,
|
|
@@ -89,21 +92,24 @@ exports.getColumnStopIndexForStartIndex = ({ startIndex, rowHeight, columnWidth,
|
|
|
89
92
|
}
|
|
90
93
|
return stopIndex;
|
|
91
94
|
};
|
|
92
|
-
exports.
|
|
95
|
+
exports.getColumnStopIndexForStartIndex = getColumnStopIndexForStartIndex;
|
|
96
|
+
const getBoundedCells = (area) => {
|
|
93
97
|
const cells = new Set();
|
|
94
98
|
if (!area)
|
|
95
99
|
return cells;
|
|
96
100
|
const { top, bottom, left, right } = area;
|
|
97
101
|
for (let i = top; i <= bottom; i++) {
|
|
98
102
|
for (let j = left; j <= right; j++) {
|
|
99
|
-
cells.add(exports.cellIdentifier(i, j));
|
|
103
|
+
cells.add((0, exports.cellIdentifier)(i, j));
|
|
100
104
|
}
|
|
101
105
|
}
|
|
102
106
|
return cells;
|
|
103
107
|
};
|
|
104
|
-
exports.
|
|
105
|
-
|
|
106
|
-
|
|
108
|
+
exports.getBoundedCells = getBoundedCells;
|
|
109
|
+
const itemKey = ({ rowIndex, columnIndex }) => `${rowIndex}:${columnIndex}`;
|
|
110
|
+
exports.itemKey = itemKey;
|
|
111
|
+
const getRowOffset = ({ index, rowHeight, columnWidth, instanceProps, scale, }) => {
|
|
112
|
+
return (0, exports.getItemMetadata)({
|
|
107
113
|
itemType: ItemType.row,
|
|
108
114
|
index,
|
|
109
115
|
rowHeight,
|
|
@@ -112,8 +118,9 @@ exports.getRowOffset = ({ index, rowHeight, columnWidth, instanceProps, scale, }
|
|
|
112
118
|
scale,
|
|
113
119
|
}).offset;
|
|
114
120
|
};
|
|
115
|
-
exports.
|
|
116
|
-
|
|
121
|
+
exports.getRowOffset = getRowOffset;
|
|
122
|
+
const getColumnOffset = ({ index, rowHeight, columnWidth, instanceProps, scale, }) => {
|
|
123
|
+
return (0, exports.getItemMetadata)({
|
|
117
124
|
itemType: ItemType.column,
|
|
118
125
|
index,
|
|
119
126
|
rowHeight,
|
|
@@ -122,13 +129,16 @@ exports.getColumnOffset = ({ index, rowHeight, columnWidth, instanceProps, scale
|
|
|
122
129
|
scale,
|
|
123
130
|
}).offset;
|
|
124
131
|
};
|
|
125
|
-
exports.
|
|
132
|
+
exports.getColumnOffset = getColumnOffset;
|
|
133
|
+
const getRowHeight = (index, instanceProps) => {
|
|
126
134
|
return instanceProps.rowMetadataMap[index].size;
|
|
127
135
|
};
|
|
128
|
-
exports.
|
|
136
|
+
exports.getRowHeight = getRowHeight;
|
|
137
|
+
const getColumnWidth = (index, instanceProps) => {
|
|
129
138
|
return instanceProps.columnMetadataMap[index].size;
|
|
130
139
|
};
|
|
131
|
-
exports.
|
|
140
|
+
exports.getColumnWidth = getColumnWidth;
|
|
141
|
+
const getItemMetadata = ({ itemType, index, rowHeight, columnWidth, instanceProps, scale = 2, }) => {
|
|
132
142
|
var _a;
|
|
133
143
|
let itemMetadataMap, itemSize, lastMeasuredIndex, recalcIndices;
|
|
134
144
|
if (itemType === "column") {
|
|
@@ -172,6 +182,7 @@ exports.getItemMetadata = ({ itemType, index, rowHeight, columnWidth, instancePr
|
|
|
172
182
|
}
|
|
173
183
|
return itemMetadataMap[index];
|
|
174
184
|
};
|
|
185
|
+
exports.getItemMetadata = getItemMetadata;
|
|
175
186
|
const findNearestItem = ({ itemType, rowHeight, columnWidth, rowCount, columnCount, instanceProps, offset, scale, }) => {
|
|
176
187
|
let itemMetadataMap, lastMeasuredIndex;
|
|
177
188
|
if (itemType === "column") {
|
|
@@ -216,7 +227,7 @@ const findNearestItem = ({ itemType, rowHeight, columnWidth, rowCount, columnCou
|
|
|
216
227
|
const findNearestItemBinarySearch = ({ itemType, rowHeight, columnWidth, instanceProps, high, low, offset, scale, }) => {
|
|
217
228
|
while (low <= high) {
|
|
218
229
|
const middle = low + Math.floor((high - low) / 2);
|
|
219
|
-
const currentOffset = exports.getItemMetadata({
|
|
230
|
+
const currentOffset = (0, exports.getItemMetadata)({
|
|
220
231
|
itemType,
|
|
221
232
|
rowHeight,
|
|
222
233
|
columnWidth,
|
|
@@ -245,7 +256,7 @@ const findNearestItemExponentialSearch = ({ itemType, rowHeight, columnWidth, ro
|
|
|
245
256
|
const itemCount = itemType === "column" ? columnCount : rowCount;
|
|
246
257
|
let interval = 1;
|
|
247
258
|
while (index < itemCount &&
|
|
248
|
-
exports.getItemMetadata({
|
|
259
|
+
(0, exports.getItemMetadata)({
|
|
249
260
|
itemType,
|
|
250
261
|
rowHeight,
|
|
251
262
|
columnWidth,
|
|
@@ -267,7 +278,7 @@ const findNearestItemExponentialSearch = ({ itemType, rowHeight, columnWidth, ro
|
|
|
267
278
|
scale,
|
|
268
279
|
});
|
|
269
280
|
};
|
|
270
|
-
|
|
281
|
+
const getEstimatedTotalHeight = (rowCount, instanceProps) => {
|
|
271
282
|
const { estimatedRowHeight } = instanceProps;
|
|
272
283
|
let totalSizeOfMeasuredRows = 0;
|
|
273
284
|
let { lastMeasuredRowIndex, rowMetadataMap } = instanceProps;
|
|
@@ -284,7 +295,8 @@ exports.getEstimatedTotalHeight = (rowCount, instanceProps) => {
|
|
|
284
295
|
const totalSizeOfUnmeasuredItems = numUnmeasuredItems * estimatedRowHeight;
|
|
285
296
|
return totalSizeOfMeasuredRows + totalSizeOfUnmeasuredItems;
|
|
286
297
|
};
|
|
287
|
-
exports.
|
|
298
|
+
exports.getEstimatedTotalHeight = getEstimatedTotalHeight;
|
|
299
|
+
const getEstimatedTotalWidth = (columnCount, instanceProps) => {
|
|
288
300
|
const { estimatedColumnWidth } = instanceProps;
|
|
289
301
|
let totalSizeOfMeasuredRows = 0;
|
|
290
302
|
let { lastMeasuredColumnIndex, columnMetadataMap } = instanceProps;
|
|
@@ -301,8 +313,10 @@ exports.getEstimatedTotalWidth = (columnCount, instanceProps) => {
|
|
|
301
313
|
const totalSizeOfUnmeasuredItems = numUnmeasuredItems * estimatedColumnWidth;
|
|
302
314
|
return totalSizeOfMeasuredRows + totalSizeOfUnmeasuredItems;
|
|
303
315
|
};
|
|
316
|
+
exports.getEstimatedTotalWidth = getEstimatedTotalWidth;
|
|
304
317
|
/* Create a stringified cell identifier */
|
|
305
|
-
|
|
318
|
+
const cellIdentifier = (rowIndex, columnIndex) => `${rowIndex},${columnIndex}`;
|
|
319
|
+
exports.cellIdentifier = cellIdentifier;
|
|
306
320
|
/**
|
|
307
321
|
* @desc Throttle fn
|
|
308
322
|
* @param func function
|
|
@@ -349,9 +363,9 @@ function rafThrottle(callback) {
|
|
|
349
363
|
};
|
|
350
364
|
}
|
|
351
365
|
exports.rafThrottle = rafThrottle;
|
|
352
|
-
|
|
366
|
+
const getOffsetForIndexAndAlignment = ({ itemType, containerHeight, containerWidth, rowHeight, columnWidth, columnCount, rowCount, index, align = Align.smart, scrollOffset, instanceProps, scrollbarSize, frozenOffset = 0, scale, estimatedTotalHeight, estimatedTotalWidth, }) => {
|
|
353
367
|
const size = itemType === "column" ? containerWidth : containerHeight;
|
|
354
|
-
const itemMetadata = exports.getItemMetadata({
|
|
368
|
+
const itemMetadata = (0, exports.getItemMetadata)({
|
|
355
369
|
itemType,
|
|
356
370
|
rowHeight,
|
|
357
371
|
columnWidth,
|
|
@@ -397,18 +411,21 @@ exports.getOffsetForIndexAndAlignment = ({ itemType, containerHeight, containerW
|
|
|
397
411
|
}
|
|
398
412
|
}
|
|
399
413
|
};
|
|
400
|
-
exports.
|
|
401
|
-
|
|
414
|
+
exports.getOffsetForIndexAndAlignment = getOffsetForIndexAndAlignment;
|
|
415
|
+
const getOffsetForColumnAndAlignment = (props) => {
|
|
416
|
+
return (0, exports.getOffsetForIndexAndAlignment)({
|
|
402
417
|
itemType: ItemType.column,
|
|
403
418
|
...props,
|
|
404
419
|
});
|
|
405
420
|
};
|
|
406
|
-
exports.
|
|
407
|
-
|
|
421
|
+
exports.getOffsetForColumnAndAlignment = getOffsetForColumnAndAlignment;
|
|
422
|
+
const getOffsetForRowAndAlignment = (props) => {
|
|
423
|
+
return (0, exports.getOffsetForIndexAndAlignment)({
|
|
408
424
|
itemType: ItemType.row,
|
|
409
425
|
...props,
|
|
410
426
|
});
|
|
411
427
|
};
|
|
428
|
+
exports.getOffsetForRowAndAlignment = getOffsetForRowAndAlignment;
|
|
412
429
|
// Animation frame based implementation of setTimeout.
|
|
413
430
|
// Inspired by Joe Lambert, https://gist.github.com/joelambert/1002116#file-requesttimeout-js
|
|
414
431
|
const hasNativePerformanceNow = typeof performance === "object" && typeof performance.now === "function";
|
|
@@ -440,7 +457,7 @@ function requestTimeout(callback, delay) {
|
|
|
440
457
|
return timeoutID;
|
|
441
458
|
}
|
|
442
459
|
exports.requestTimeout = requestTimeout;
|
|
443
|
-
|
|
460
|
+
const selectionFromActiveCell = (activeCell) => {
|
|
444
461
|
if (!activeCell)
|
|
445
462
|
return [];
|
|
446
463
|
return [
|
|
@@ -454,22 +471,24 @@ exports.selectionFromActiveCell = (activeCell) => {
|
|
|
454
471
|
},
|
|
455
472
|
];
|
|
456
473
|
};
|
|
474
|
+
exports.selectionFromActiveCell = selectionFromActiveCell;
|
|
457
475
|
/**
|
|
458
476
|
* Check if a selection are spans multiple cells
|
|
459
477
|
* @param sel
|
|
460
478
|
*/
|
|
461
|
-
|
|
479
|
+
const selectionSpansCells = (sel) => {
|
|
462
480
|
if (!sel)
|
|
463
481
|
return false;
|
|
464
482
|
return sel.bottom !== sel.top || sel.left !== sel.right;
|
|
465
483
|
};
|
|
484
|
+
exports.selectionSpansCells = selectionSpansCells;
|
|
466
485
|
/**
|
|
467
486
|
* When user tries to drag a selection
|
|
468
487
|
* @param initialSelection
|
|
469
488
|
* @param from
|
|
470
489
|
* @param to
|
|
471
490
|
*/
|
|
472
|
-
|
|
491
|
+
const newSelectionFromDrag = (initialSelection, from, to, topBound = 0, leftBound = 0, rowCount, columnCount) => {
|
|
473
492
|
const currentBounds = initialSelection.bounds;
|
|
474
493
|
const top = Math.max(topBound, Math.min(rowCount, to.rowIndex + currentBounds.top - from.rowIndex));
|
|
475
494
|
const left = Math.max(leftBound, Math.min(columnCount, to.columnIndex + currentBounds.left - from.columnIndex));
|
|
@@ -482,13 +501,14 @@ exports.newSelectionFromDrag = (initialSelection, from, to, topBound = 0, leftBo
|
|
|
482
501
|
},
|
|
483
502
|
};
|
|
484
503
|
};
|
|
504
|
+
exports.newSelectionFromDrag = newSelectionFromDrag;
|
|
485
505
|
/**
|
|
486
506
|
* Clamp cell coordinates to be inside activeCell and selection
|
|
487
507
|
* @param coords
|
|
488
508
|
* @param activeCell
|
|
489
509
|
* @param selection
|
|
490
510
|
*/
|
|
491
|
-
|
|
511
|
+
const clampCellCoords = (coords, activeCell, selection) => {
|
|
492
512
|
if (activeCell) {
|
|
493
513
|
coords.rowIndex = Math.max(activeCell.rowIndex, coords.rowIndex);
|
|
494
514
|
coords.columnIndex = Math.min(activeCell.columnIndex, coords.columnIndex);
|
|
@@ -499,23 +519,25 @@ exports.clampCellCoords = (coords, activeCell, selection) => {
|
|
|
499
519
|
}
|
|
500
520
|
return coords;
|
|
501
521
|
};
|
|
522
|
+
exports.clampCellCoords = clampCellCoords;
|
|
502
523
|
/**
|
|
503
524
|
* Converts a number to alphabet
|
|
504
525
|
* @param i
|
|
505
526
|
*/
|
|
506
|
-
|
|
507
|
-
return ((i >= 26 ? exports.numberToAlphabet(((i / 26) >> 0) - 1) : "") +
|
|
527
|
+
const numberToAlphabet = (i) => {
|
|
528
|
+
return ((i >= 26 ? (0, exports.numberToAlphabet)(((i / 26) >> 0) - 1) : "") +
|
|
508
529
|
"abcdefghijklmnopqrstuvwxyz"[i % 26 >> 0]).toUpperCase();
|
|
509
530
|
};
|
|
531
|
+
exports.numberToAlphabet = numberToAlphabet;
|
|
510
532
|
/**
|
|
511
533
|
* Convert selections to html and csv data
|
|
512
534
|
* @param rows
|
|
513
535
|
*/
|
|
514
|
-
|
|
536
|
+
const prepareClipboardData = (rows) => {
|
|
515
537
|
const html = ["<table>"];
|
|
516
538
|
const csv = [];
|
|
517
539
|
const sanitizeCell = (value) => {
|
|
518
|
-
if (exports.isNull(value))
|
|
540
|
+
if ((0, exports.isNull)(value))
|
|
519
541
|
return "";
|
|
520
542
|
return value;
|
|
521
543
|
};
|
|
@@ -525,7 +547,7 @@ exports.prepareClipboardData = (rows) => {
|
|
|
525
547
|
row.forEach((cell) => {
|
|
526
548
|
var _a;
|
|
527
549
|
html.push(`<td>${sanitizeCell(cell)}</td>`);
|
|
528
|
-
csvRow.push(`${(_a = exports.castToString(cell)) === null || _a === void 0 ? void 0 : _a.replace(/"/g, '""')}`);
|
|
550
|
+
csvRow.push(`${(_a = (0, exports.castToString)(cell)) === null || _a === void 0 ? void 0 : _a.replace(/"/g, '""')}`);
|
|
529
551
|
});
|
|
530
552
|
csv.push(csvRow.join(","));
|
|
531
553
|
html.push("</tr>");
|
|
@@ -533,14 +555,15 @@ exports.prepareClipboardData = (rows) => {
|
|
|
533
555
|
html.push("</table>");
|
|
534
556
|
return [html.join(""), csv.join("\n")];
|
|
535
557
|
};
|
|
558
|
+
exports.prepareClipboardData = prepareClipboardData;
|
|
536
559
|
/**
|
|
537
560
|
* Cycles active cell within selecton bounds
|
|
538
561
|
* @param activeCellBounds
|
|
539
562
|
* @param selectionBounds
|
|
540
563
|
* @param direction
|
|
541
564
|
*/
|
|
542
|
-
|
|
543
|
-
const intersects = exports.areaIntersects(activeCellBounds, selectionBounds);
|
|
565
|
+
const findNextCellWithinBounds = (activeCellBounds, selectionBounds, direction = types_1.Direction.Right) => {
|
|
566
|
+
const intersects = (0, exports.areaIntersects)(activeCellBounds, selectionBounds);
|
|
544
567
|
if (!intersects)
|
|
545
568
|
return null;
|
|
546
569
|
let rowIndex, columnIndex;
|
|
@@ -595,12 +618,13 @@ exports.findNextCellWithinBounds = (activeCellBounds, selectionBounds, direction
|
|
|
595
618
|
}
|
|
596
619
|
return nextActiveCell;
|
|
597
620
|
};
|
|
621
|
+
exports.findNextCellWithinBounds = findNextCellWithinBounds;
|
|
598
622
|
/**
|
|
599
623
|
* Check if 2 areas overlap
|
|
600
624
|
* @param area1
|
|
601
625
|
* @param area2
|
|
602
626
|
*/
|
|
603
|
-
|
|
627
|
+
const areaIntersects = (area1, area2) => {
|
|
604
628
|
if (area1.left > area2.right || area2.left > area1.right) {
|
|
605
629
|
return false;
|
|
606
630
|
}
|
|
@@ -609,23 +633,25 @@ exports.areaIntersects = (area1, area2) => {
|
|
|
609
633
|
}
|
|
610
634
|
return true;
|
|
611
635
|
};
|
|
636
|
+
exports.areaIntersects = areaIntersects;
|
|
612
637
|
/**
|
|
613
638
|
* Check if area is inside another area
|
|
614
639
|
* @param needle
|
|
615
640
|
* @param haystack
|
|
616
641
|
*/
|
|
617
|
-
|
|
642
|
+
const areaInsideArea = (needle, haystack) => {
|
|
618
643
|
return (needle.top >= haystack.top &&
|
|
619
644
|
needle.bottom <= haystack.bottom &&
|
|
620
645
|
needle.left >= haystack.left &&
|
|
621
646
|
needle.right <= haystack.right);
|
|
622
647
|
};
|
|
648
|
+
exports.areaInsideArea = areaInsideArea;
|
|
623
649
|
/**
|
|
624
650
|
* Check if two areas are equal
|
|
625
651
|
* @param area1
|
|
626
652
|
* @param area2
|
|
627
653
|
*/
|
|
628
|
-
|
|
654
|
+
const isAreasEqual = (area1, area2) => {
|
|
629
655
|
if (area1 === void 0 || area2 === void 0) {
|
|
630
656
|
return false;
|
|
631
657
|
}
|
|
@@ -634,15 +660,16 @@ exports.isAreasEqual = (area1, area2) => {
|
|
|
634
660
|
area1.left === area2.left &&
|
|
635
661
|
area1.right === area2.right);
|
|
636
662
|
};
|
|
663
|
+
exports.isAreasEqual = isAreasEqual;
|
|
637
664
|
/**
|
|
638
665
|
* Get maximum bound of an area, caters to merged cells
|
|
639
666
|
* @param area
|
|
640
667
|
* @param boundGetter
|
|
641
668
|
*/
|
|
642
|
-
|
|
669
|
+
const extendAreaToMergedCells = (_area, mergedCells) => {
|
|
643
670
|
const area = { ..._area };
|
|
644
671
|
for (const bounds of mergedCells) {
|
|
645
|
-
if (exports.areaIntersects(area, bounds)) {
|
|
672
|
+
if ((0, exports.areaIntersects)(area, bounds)) {
|
|
646
673
|
area.top = Math.min(area.top, bounds.top);
|
|
647
674
|
area.bottom = Math.max(area.bottom, bounds.bottom);
|
|
648
675
|
area.right = Math.max(area.right, bounds.right);
|
|
@@ -651,6 +678,7 @@ exports.extendAreaToMergedCells = (_area, mergedCells) => {
|
|
|
651
678
|
}
|
|
652
679
|
return area;
|
|
653
680
|
};
|
|
681
|
+
exports.extendAreaToMergedCells = extendAreaToMergedCells;
|
|
654
682
|
/**
|
|
655
683
|
* Convert 2 cells to bounds
|
|
656
684
|
* @param start
|
|
@@ -659,7 +687,7 @@ exports.extendAreaToMergedCells = (_area, mergedCells) => {
|
|
|
659
687
|
*
|
|
660
688
|
* 2 loops O(n)
|
|
661
689
|
*/
|
|
662
|
-
|
|
690
|
+
const cellRangeToBounds = (start, end, spanMerges = true, getCellBounds) => {
|
|
663
691
|
let top = Math.min(start.rowIndex, end.rowIndex);
|
|
664
692
|
let bottom = Math.max(start.rowIndex, end.rowIndex);
|
|
665
693
|
let left = Math.min(start.columnIndex, end.columnIndex);
|
|
@@ -696,13 +724,14 @@ exports.cellRangeToBounds = (start, end, spanMerges = true, getCellBounds) => {
|
|
|
696
724
|
bottom,
|
|
697
725
|
};
|
|
698
726
|
};
|
|
727
|
+
exports.cellRangeToBounds = cellRangeToBounds;
|
|
699
728
|
/**
|
|
700
729
|
* Check if its being rendered in Browser or SSR
|
|
701
730
|
*/
|
|
702
731
|
exports.canUseDOM = !!(typeof window !== "undefined" &&
|
|
703
732
|
window.document &&
|
|
704
733
|
window.document.createElement);
|
|
705
|
-
|
|
734
|
+
const AutoSizerCanvas = (defaults = {}) => {
|
|
706
735
|
const { fontFamily = "Arial", fontSize = 12, fontWeight = "", fontStyle = "", lineHeight = 16, scale = 1, } = defaults;
|
|
707
736
|
var o = {
|
|
708
737
|
fontFamily,
|
|
@@ -738,7 +767,7 @@ exports.AutoSizerCanvas = (defaults = {}) => {
|
|
|
738
767
|
}
|
|
739
768
|
return { width: Math.ceil(width), height: Math.ceil(height) };
|
|
740
769
|
};
|
|
741
|
-
const measureText = (text) => getWidthOfLongestText(exports.castToString(text));
|
|
770
|
+
const measureText = (text) => getWidthOfLongestText((0, exports.castToString)(text));
|
|
742
771
|
const reset = () => setFont(defaults);
|
|
743
772
|
/* Set font in constructor */
|
|
744
773
|
setFont(o);
|
|
@@ -749,21 +778,24 @@ exports.AutoSizerCanvas = (defaults = {}) => {
|
|
|
749
778
|
reset,
|
|
750
779
|
};
|
|
751
780
|
};
|
|
781
|
+
exports.AutoSizerCanvas = AutoSizerCanvas;
|
|
752
782
|
/* Export a singleton */
|
|
753
|
-
exports.autoSizerCanvas = exports.AutoSizerCanvas();
|
|
783
|
+
exports.autoSizerCanvas = (0, exports.AutoSizerCanvas)();
|
|
754
784
|
/* Check if a value is null */
|
|
755
|
-
|
|
756
|
-
exports.
|
|
757
|
-
|
|
785
|
+
const isNull = (value) => value === void 0 || value === null || value === "";
|
|
786
|
+
exports.isNull = isNull;
|
|
787
|
+
const isEqualCells = (a, b) => {
|
|
788
|
+
if ((0, exports.isNull)(a) || (0, exports.isNull)(b) || a === null || b === null)
|
|
758
789
|
return false;
|
|
759
790
|
return a.rowIndex === b.rowIndex && a.columnIndex === b.columnIndex;
|
|
760
791
|
};
|
|
792
|
+
exports.isEqualCells = isEqualCells;
|
|
761
793
|
/**
|
|
762
794
|
* Simple utility function to check if cell is within bounds
|
|
763
795
|
* @param cell
|
|
764
796
|
* @param bounds
|
|
765
797
|
*/
|
|
766
|
-
|
|
798
|
+
const isCellWithinBounds = (cell, bounds) => {
|
|
767
799
|
if (cell.rowIndex < bounds.top || cell.rowIndex > bounds.bottom) {
|
|
768
800
|
return false;
|
|
769
801
|
}
|
|
@@ -772,7 +804,8 @@ exports.isCellWithinBounds = (cell, bounds) => {
|
|
|
772
804
|
}
|
|
773
805
|
return true;
|
|
774
806
|
};
|
|
775
|
-
exports.
|
|
807
|
+
exports.isCellWithinBounds = isCellWithinBounds;
|
|
808
|
+
const clampIndex = (index, isHidden, direction) => {
|
|
776
809
|
switch (direction) {
|
|
777
810
|
case types_1.Direction.Right:
|
|
778
811
|
case types_1.Direction.Down:
|
|
@@ -792,6 +825,7 @@ exports.clampIndex = (index, isHidden, direction) => {
|
|
|
792
825
|
}
|
|
793
826
|
return index;
|
|
794
827
|
};
|
|
828
|
+
exports.clampIndex = clampIndex;
|
|
795
829
|
/**
|
|
796
830
|
* Find a cell with content if the current cell is out of the current dataregion
|
|
797
831
|
* [
|
|
@@ -809,41 +843,41 @@ exports.clampIndex = (index, isHidden, direction) => {
|
|
|
809
843
|
* @param direction
|
|
810
844
|
* @param limit
|
|
811
845
|
*/
|
|
812
|
-
|
|
846
|
+
const findNextContentfulCell = (activeCell, getValue, isHidden, direction, limit) => {
|
|
813
847
|
var { rowIndex, columnIndex } = activeCell;
|
|
814
848
|
switch (direction) {
|
|
815
849
|
case types_1.Direction.Down: {
|
|
816
|
-
rowIndex = exports.clampIndex(Math.min(rowIndex + 1, limit), isHidden, direction);
|
|
850
|
+
rowIndex = (0, exports.clampIndex)(Math.min(rowIndex + 1, limit), isHidden, direction);
|
|
817
851
|
let value = getValue({ rowIndex, columnIndex });
|
|
818
|
-
while (exports.isNull(value) && rowIndex < limit) {
|
|
819
|
-
rowIndex = exports.clampIndex(Math.min(++rowIndex, limit), isHidden, direction);
|
|
852
|
+
while ((0, exports.isNull)(value) && rowIndex < limit) {
|
|
853
|
+
rowIndex = (0, exports.clampIndex)(Math.min(++rowIndex, limit), isHidden, direction);
|
|
820
854
|
value = getValue({ rowIndex, columnIndex });
|
|
821
855
|
}
|
|
822
856
|
return { rowIndex, columnIndex };
|
|
823
857
|
}
|
|
824
858
|
case types_1.Direction.Up: {
|
|
825
|
-
rowIndex = exports.clampIndex(Math.max(rowIndex - 1, limit), isHidden, direction);
|
|
859
|
+
rowIndex = (0, exports.clampIndex)(Math.max(rowIndex - 1, limit), isHidden, direction);
|
|
826
860
|
let value = getValue({ rowIndex, columnIndex });
|
|
827
|
-
while (exports.isNull(value) && rowIndex > limit) {
|
|
828
|
-
rowIndex = exports.clampIndex(Math.max(--rowIndex, limit), isHidden, direction);
|
|
861
|
+
while ((0, exports.isNull)(value) && rowIndex > limit) {
|
|
862
|
+
rowIndex = (0, exports.clampIndex)(Math.max(--rowIndex, limit), isHidden, direction);
|
|
829
863
|
value = getValue({ rowIndex, columnIndex });
|
|
830
864
|
}
|
|
831
865
|
return { rowIndex, columnIndex };
|
|
832
866
|
}
|
|
833
867
|
case types_1.Direction.Right: {
|
|
834
|
-
columnIndex = exports.clampIndex(Math.min(columnIndex + 1, limit), isHidden, direction);
|
|
868
|
+
columnIndex = (0, exports.clampIndex)(Math.min(columnIndex + 1, limit), isHidden, direction);
|
|
835
869
|
let value = getValue({ rowIndex, columnIndex });
|
|
836
|
-
while (exports.isNull(value) && columnIndex < limit) {
|
|
837
|
-
columnIndex = exports.clampIndex(Math.min(++columnIndex, limit), isHidden, direction);
|
|
870
|
+
while ((0, exports.isNull)(value) && columnIndex < limit) {
|
|
871
|
+
columnIndex = (0, exports.clampIndex)(Math.min(++columnIndex, limit), isHidden, direction);
|
|
838
872
|
value = getValue({ rowIndex, columnIndex });
|
|
839
873
|
}
|
|
840
874
|
return { rowIndex, columnIndex };
|
|
841
875
|
}
|
|
842
876
|
case types_1.Direction.Left: {
|
|
843
|
-
columnIndex = exports.clampIndex(Math.max(columnIndex - 1, limit), isHidden, direction);
|
|
877
|
+
columnIndex = (0, exports.clampIndex)(Math.max(columnIndex - 1, limit), isHidden, direction);
|
|
844
878
|
let value = getValue({ rowIndex, columnIndex });
|
|
845
|
-
while (exports.isNull(value) && columnIndex > limit) {
|
|
846
|
-
columnIndex = exports.clampIndex(Math.max(--columnIndex, limit), isHidden, direction);
|
|
879
|
+
while ((0, exports.isNull)(value) && columnIndex > limit) {
|
|
880
|
+
columnIndex = (0, exports.clampIndex)(Math.max(--columnIndex, limit), isHidden, direction);
|
|
847
881
|
value = getValue({ rowIndex, columnIndex });
|
|
848
882
|
}
|
|
849
883
|
return { rowIndex, columnIndex };
|
|
@@ -852,6 +886,7 @@ exports.findNextContentfulCell = (activeCell, getValue, isHidden, direction, lim
|
|
|
852
886
|
return activeCell;
|
|
853
887
|
}
|
|
854
888
|
};
|
|
889
|
+
exports.findNextContentfulCell = findNextContentfulCell;
|
|
855
890
|
/**
|
|
856
891
|
* Find the next cell
|
|
857
892
|
* @param activeCell
|
|
@@ -860,61 +895,61 @@ exports.findNextContentfulCell = (activeCell, getValue, isHidden, direction, lim
|
|
|
860
895
|
* @param direction
|
|
861
896
|
* @param limit
|
|
862
897
|
*/
|
|
863
|
-
|
|
898
|
+
const findLastContentfulCell = (activeCell, getValue, isHidden, direction, limit) => {
|
|
864
899
|
var { rowIndex, columnIndex } = activeCell;
|
|
865
900
|
switch (direction) {
|
|
866
901
|
case types_1.Direction.Down: {
|
|
867
|
-
rowIndex = exports.clampIndex(Math.min(rowIndex + 1, limit), isHidden, direction);
|
|
902
|
+
rowIndex = (0, exports.clampIndex)(Math.min(rowIndex + 1, limit), isHidden, direction);
|
|
868
903
|
let value = getValue({ rowIndex, columnIndex });
|
|
869
|
-
while (!exports.isNull(value) && rowIndex < limit) {
|
|
870
|
-
rowIndex = exports.clampIndex(Math.min(++rowIndex, limit), isHidden, direction);
|
|
904
|
+
while (!(0, exports.isNull)(value) && rowIndex < limit) {
|
|
905
|
+
rowIndex = (0, exports.clampIndex)(Math.min(++rowIndex, limit), isHidden, direction);
|
|
871
906
|
value = getValue({ rowIndex, columnIndex });
|
|
872
907
|
}
|
|
873
908
|
return {
|
|
874
909
|
columnIndex,
|
|
875
|
-
rowIndex: exports.isNull(getValue({ columnIndex, rowIndex }))
|
|
910
|
+
rowIndex: (0, exports.isNull)(getValue({ columnIndex, rowIndex }))
|
|
876
911
|
? rowIndex - 1
|
|
877
912
|
: rowIndex,
|
|
878
913
|
};
|
|
879
914
|
}
|
|
880
915
|
case types_1.Direction.Up: {
|
|
881
|
-
rowIndex = exports.clampIndex(Math.max(rowIndex - 1, limit), isHidden, direction);
|
|
916
|
+
rowIndex = (0, exports.clampIndex)(Math.max(rowIndex - 1, limit), isHidden, direction);
|
|
882
917
|
let value = getValue({ rowIndex, columnIndex });
|
|
883
|
-
while (!exports.isNull(value) && rowIndex > limit) {
|
|
884
|
-
rowIndex = exports.clampIndex(Math.max(--rowIndex, limit), isHidden, direction);
|
|
918
|
+
while (!(0, exports.isNull)(value) && rowIndex > limit) {
|
|
919
|
+
rowIndex = (0, exports.clampIndex)(Math.max(--rowIndex, limit), isHidden, direction);
|
|
885
920
|
value = getValue({ rowIndex, columnIndex });
|
|
886
921
|
}
|
|
887
922
|
return {
|
|
888
923
|
columnIndex,
|
|
889
|
-
rowIndex: exports.isNull(getValue({ columnIndex, rowIndex }))
|
|
924
|
+
rowIndex: (0, exports.isNull)(getValue({ columnIndex, rowIndex }))
|
|
890
925
|
? rowIndex + 1
|
|
891
926
|
: rowIndex,
|
|
892
927
|
};
|
|
893
928
|
}
|
|
894
929
|
case types_1.Direction.Right: {
|
|
895
|
-
columnIndex = exports.clampIndex(Math.min(columnIndex + 1, limit), isHidden, direction);
|
|
930
|
+
columnIndex = (0, exports.clampIndex)(Math.min(columnIndex + 1, limit), isHidden, direction);
|
|
896
931
|
let value = getValue({ rowIndex, columnIndex });
|
|
897
|
-
while (!exports.isNull(value) && columnIndex < limit) {
|
|
898
|
-
columnIndex = exports.clampIndex(Math.min(++columnIndex, limit), isHidden, direction);
|
|
932
|
+
while (!(0, exports.isNull)(value) && columnIndex < limit) {
|
|
933
|
+
columnIndex = (0, exports.clampIndex)(Math.min(++columnIndex, limit), isHidden, direction);
|
|
899
934
|
value = getValue({ rowIndex, columnIndex });
|
|
900
935
|
}
|
|
901
936
|
return {
|
|
902
937
|
rowIndex,
|
|
903
|
-
columnIndex: exports.isNull(getValue({ columnIndex, rowIndex }))
|
|
938
|
+
columnIndex: (0, exports.isNull)(getValue({ columnIndex, rowIndex }))
|
|
904
939
|
? columnIndex - 1
|
|
905
940
|
: columnIndex,
|
|
906
941
|
};
|
|
907
942
|
}
|
|
908
943
|
case types_1.Direction.Left: {
|
|
909
|
-
columnIndex = exports.clampIndex(Math.max(columnIndex - 1, limit), isHidden, direction);
|
|
944
|
+
columnIndex = (0, exports.clampIndex)(Math.max(columnIndex - 1, limit), isHidden, direction);
|
|
910
945
|
let value = getValue({ rowIndex, columnIndex });
|
|
911
|
-
while (!exports.isNull(value) && columnIndex > limit) {
|
|
912
|
-
columnIndex = exports.clampIndex(Math.max(--columnIndex, limit), isHidden, direction);
|
|
946
|
+
while (!(0, exports.isNull)(value) && columnIndex > limit) {
|
|
947
|
+
columnIndex = (0, exports.clampIndex)(Math.max(--columnIndex, limit), isHidden, direction);
|
|
913
948
|
value = getValue({ rowIndex, columnIndex });
|
|
914
949
|
}
|
|
915
950
|
return {
|
|
916
951
|
rowIndex,
|
|
917
|
-
columnIndex: exports.isNull(getValue({ columnIndex, rowIndex }))
|
|
952
|
+
columnIndex: (0, exports.isNull)(getValue({ columnIndex, rowIndex }))
|
|
918
953
|
? columnIndex + 1
|
|
919
954
|
: columnIndex,
|
|
920
955
|
};
|
|
@@ -923,32 +958,33 @@ exports.findLastContentfulCell = (activeCell, getValue, isHidden, direction, lim
|
|
|
923
958
|
return activeCell;
|
|
924
959
|
}
|
|
925
960
|
};
|
|
961
|
+
exports.findLastContentfulCell = findLastContentfulCell;
|
|
926
962
|
/**
|
|
927
963
|
* Ex
|
|
928
964
|
*/
|
|
929
|
-
|
|
965
|
+
const findNextCellInDataRegion = (activeCell, getValue, isHidden, direction, limit) => {
|
|
930
966
|
var { rowIndex, columnIndex } = activeCell;
|
|
931
|
-
const isCurrentCellEmpty = exports.isNull(getValue(activeCell));
|
|
967
|
+
const isCurrentCellEmpty = (0, exports.isNull)(getValue(activeCell));
|
|
932
968
|
const didWeReachTheEdge = (cur, next) => {
|
|
933
969
|
return (cur && next) || (cur && !next) || (!cur && next);
|
|
934
970
|
};
|
|
935
971
|
switch (direction) {
|
|
936
972
|
case types_1.Direction.Down: {
|
|
937
973
|
const nextCellValue = getValue({ rowIndex: rowIndex + 1, columnIndex });
|
|
938
|
-
const isNextCellEmpty = exports.isNull(nextCellValue);
|
|
974
|
+
const isNextCellEmpty = (0, exports.isNull)(nextCellValue);
|
|
939
975
|
const isEdge = didWeReachTheEdge(isCurrentCellEmpty, isNextCellEmpty);
|
|
940
976
|
const nextCell = isEdge
|
|
941
|
-
? exports.findNextContentfulCell(activeCell, getValue, isHidden, direction, limit)
|
|
942
|
-
: exports.findLastContentfulCell(activeCell, getValue, isHidden, direction, limit);
|
|
977
|
+
? (0, exports.findNextContentfulCell)(activeCell, getValue, isHidden, direction, limit)
|
|
978
|
+
: (0, exports.findLastContentfulCell)(activeCell, getValue, isHidden, direction, limit);
|
|
943
979
|
return nextCell === null || nextCell === void 0 ? void 0 : nextCell.rowIndex;
|
|
944
980
|
}
|
|
945
981
|
case types_1.Direction.Up: {
|
|
946
982
|
const nextCellValue = getValue({ rowIndex: rowIndex - 1, columnIndex });
|
|
947
|
-
const isNextCellEmpty = exports.isNull(nextCellValue);
|
|
983
|
+
const isNextCellEmpty = (0, exports.isNull)(nextCellValue);
|
|
948
984
|
const isEdge = didWeReachTheEdge(isCurrentCellEmpty, isNextCellEmpty);
|
|
949
985
|
const nextCell = isEdge
|
|
950
|
-
? exports.findNextContentfulCell(activeCell, getValue, isHidden, direction, limit)
|
|
951
|
-
: exports.findLastContentfulCell(activeCell, getValue, isHidden, direction, limit);
|
|
986
|
+
? (0, exports.findNextContentfulCell)(activeCell, getValue, isHidden, direction, limit)
|
|
987
|
+
: (0, exports.findLastContentfulCell)(activeCell, getValue, isHidden, direction, limit);
|
|
952
988
|
return nextCell === null || nextCell === void 0 ? void 0 : nextCell.rowIndex;
|
|
953
989
|
}
|
|
954
990
|
case types_1.Direction.Right: {
|
|
@@ -956,11 +992,11 @@ exports.findNextCellInDataRegion = (activeCell, getValue, isHidden, direction, l
|
|
|
956
992
|
rowIndex,
|
|
957
993
|
columnIndex: columnIndex + 1,
|
|
958
994
|
});
|
|
959
|
-
const isNextCellEmpty = exports.isNull(nextCellValue);
|
|
995
|
+
const isNextCellEmpty = (0, exports.isNull)(nextCellValue);
|
|
960
996
|
const isEdge = didWeReachTheEdge(isCurrentCellEmpty, isNextCellEmpty);
|
|
961
997
|
const nextCell = isEdge
|
|
962
|
-
? exports.findNextContentfulCell(activeCell, getValue, isHidden, direction, limit)
|
|
963
|
-
: exports.findLastContentfulCell(activeCell, getValue, isHidden, direction, limit);
|
|
998
|
+
? (0, exports.findNextContentfulCell)(activeCell, getValue, isHidden, direction, limit)
|
|
999
|
+
: (0, exports.findLastContentfulCell)(activeCell, getValue, isHidden, direction, limit);
|
|
964
1000
|
return nextCell === null || nextCell === void 0 ? void 0 : nextCell.columnIndex;
|
|
965
1001
|
}
|
|
966
1002
|
case types_1.Direction.Left: {
|
|
@@ -968,27 +1004,30 @@ exports.findNextCellInDataRegion = (activeCell, getValue, isHidden, direction, l
|
|
|
968
1004
|
rowIndex,
|
|
969
1005
|
columnIndex: columnIndex - 1,
|
|
970
1006
|
});
|
|
971
|
-
const isNextCellEmpty = exports.isNull(nextCellValue);
|
|
1007
|
+
const isNextCellEmpty = (0, exports.isNull)(nextCellValue);
|
|
972
1008
|
const isEdge = didWeReachTheEdge(isCurrentCellEmpty, isNextCellEmpty);
|
|
973
1009
|
const nextCell = isEdge
|
|
974
|
-
? exports.findNextContentfulCell(activeCell, getValue, isHidden, direction, limit)
|
|
975
|
-
: exports.findLastContentfulCell(activeCell, getValue, isHidden, direction, limit);
|
|
1010
|
+
? (0, exports.findNextContentfulCell)(activeCell, getValue, isHidden, direction, limit)
|
|
1011
|
+
: (0, exports.findLastContentfulCell)(activeCell, getValue, isHidden, direction, limit);
|
|
976
1012
|
return nextCell === null || nextCell === void 0 ? void 0 : nextCell.columnIndex;
|
|
977
1013
|
}
|
|
978
1014
|
}
|
|
979
1015
|
};
|
|
1016
|
+
exports.findNextCellInDataRegion = findNextCellInDataRegion;
|
|
980
1017
|
/* Focusable node names */
|
|
981
1018
|
exports.focusableNodeNames = new Set(["INPUT", "TEXTAREA", "SELECT"]);
|
|
982
1019
|
/**
|
|
983
1020
|
* Converts a value to string
|
|
984
1021
|
* @param value
|
|
985
1022
|
*/
|
|
986
|
-
|
|
1023
|
+
const castToString = (value) => {
|
|
987
1024
|
if (value === null || value === void 0)
|
|
988
1025
|
return void 0;
|
|
989
1026
|
return typeof value !== "string" ? "" + value : value;
|
|
990
1027
|
};
|
|
991
|
-
exports.
|
|
1028
|
+
exports.castToString = castToString;
|
|
1029
|
+
const isArrowKey = (keyCode) => {
|
|
992
1030
|
return [types_1.KeyCodes.Up, types_1.KeyCodes.Down, types_1.KeyCodes.Left, types_1.KeyCodes.Right].includes(keyCode);
|
|
993
1031
|
};
|
|
1032
|
+
exports.isArrowKey = isArrowKey;
|
|
994
1033
|
//# sourceMappingURL=helpers.js.map
|