react-glide-table 2.3.2 → 2.3.3
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/compound.cjs +11 -0
- package/dist/compound.js +11 -0
- package/dist/core.cjs +11 -0
- package/dist/core.js +11 -0
- package/dist/index.cjs +11 -0
- package/dist/index.js +11 -0
- package/package.json +1 -1
package/dist/compound.cjs
CHANGED
|
@@ -3189,6 +3189,13 @@ function hasFillExtension(sourceBounds, fillBounds) {
|
|
|
3189
3189
|
}
|
|
3190
3190
|
|
|
3191
3191
|
// src/components/ui/table/features/cell-selection/useCellSelection.ts
|
|
3192
|
+
function isFocusOutsideRoot(rootRef) {
|
|
3193
|
+
const root = rootRef?.current;
|
|
3194
|
+
if (!root) return false;
|
|
3195
|
+
const active = document.activeElement;
|
|
3196
|
+
if (!active || active === document.body) return false;
|
|
3197
|
+
return !root.contains(active);
|
|
3198
|
+
}
|
|
3192
3199
|
function useCellSelection({
|
|
3193
3200
|
data,
|
|
3194
3201
|
rows,
|
|
@@ -3297,6 +3304,7 @@ function useCellSelection({
|
|
|
3297
3304
|
if (isEditablePasteTarget(e.target) || isEditablePasteTarget(document.activeElement)) {
|
|
3298
3305
|
return;
|
|
3299
3306
|
}
|
|
3307
|
+
if (isFocusOutsideRoot(rootRef)) return;
|
|
3300
3308
|
const delta = getCellNavigationDelta(e.key);
|
|
3301
3309
|
if (!delta) return;
|
|
3302
3310
|
const prev = dragStateRef.current;
|
|
@@ -3364,6 +3372,7 @@ function useCellSelection({
|
|
|
3364
3372
|
if (isEditablePasteTarget(e.target) || isEditablePasteTarget(document.activeElement)) {
|
|
3365
3373
|
return;
|
|
3366
3374
|
}
|
|
3375
|
+
if (isFocusOutsideRoot(rootRef)) return;
|
|
3367
3376
|
const isSubtreeShortcut = enableSubtreeCopy && e.shiftKey && e.key.toLowerCase() === "c";
|
|
3368
3377
|
const isVisibleCopyShortcut = !e.shiftKey && e.key.toLowerCase() === "c";
|
|
3369
3378
|
if (!isSubtreeShortcut && !isVisibleCopyShortcut) return;
|
|
@@ -3402,6 +3411,7 @@ function useCellSelection({
|
|
|
3402
3411
|
if (isEditablePasteTarget(e.target) || isEditablePasteTarget(document.activeElement)) {
|
|
3403
3412
|
return;
|
|
3404
3413
|
}
|
|
3414
|
+
if (isFocusOutsideRoot(rootRef)) return;
|
|
3405
3415
|
if (e.shiftKey && !enableInsertPaste) {
|
|
3406
3416
|
ignoreNextPasteRef.current = true;
|
|
3407
3417
|
pendingPasteModeRef.current = null;
|
|
@@ -3431,6 +3441,7 @@ function useCellSelection({
|
|
|
3431
3441
|
if (isEditablePasteTarget(e.target) || isEditablePasteTarget(document.activeElement)) {
|
|
3432
3442
|
return;
|
|
3433
3443
|
}
|
|
3444
|
+
if (isFocusOutsideRoot(rootRef)) return;
|
|
3434
3445
|
if (ignoreNextPasteRef.current) {
|
|
3435
3446
|
ignoreNextPasteRef.current = false;
|
|
3436
3447
|
pendingPasteModeRef.current = null;
|
package/dist/compound.js
CHANGED
|
@@ -3177,6 +3177,13 @@ function hasFillExtension(sourceBounds, fillBounds) {
|
|
|
3177
3177
|
}
|
|
3178
3178
|
|
|
3179
3179
|
// src/components/ui/table/features/cell-selection/useCellSelection.ts
|
|
3180
|
+
function isFocusOutsideRoot(rootRef) {
|
|
3181
|
+
const root = rootRef?.current;
|
|
3182
|
+
if (!root) return false;
|
|
3183
|
+
const active = document.activeElement;
|
|
3184
|
+
if (!active || active === document.body) return false;
|
|
3185
|
+
return !root.contains(active);
|
|
3186
|
+
}
|
|
3180
3187
|
function useCellSelection({
|
|
3181
3188
|
data,
|
|
3182
3189
|
rows,
|
|
@@ -3285,6 +3292,7 @@ function useCellSelection({
|
|
|
3285
3292
|
if (isEditablePasteTarget(e.target) || isEditablePasteTarget(document.activeElement)) {
|
|
3286
3293
|
return;
|
|
3287
3294
|
}
|
|
3295
|
+
if (isFocusOutsideRoot(rootRef)) return;
|
|
3288
3296
|
const delta = getCellNavigationDelta(e.key);
|
|
3289
3297
|
if (!delta) return;
|
|
3290
3298
|
const prev = dragStateRef.current;
|
|
@@ -3352,6 +3360,7 @@ function useCellSelection({
|
|
|
3352
3360
|
if (isEditablePasteTarget(e.target) || isEditablePasteTarget(document.activeElement)) {
|
|
3353
3361
|
return;
|
|
3354
3362
|
}
|
|
3363
|
+
if (isFocusOutsideRoot(rootRef)) return;
|
|
3355
3364
|
const isSubtreeShortcut = enableSubtreeCopy && e.shiftKey && e.key.toLowerCase() === "c";
|
|
3356
3365
|
const isVisibleCopyShortcut = !e.shiftKey && e.key.toLowerCase() === "c";
|
|
3357
3366
|
if (!isSubtreeShortcut && !isVisibleCopyShortcut) return;
|
|
@@ -3390,6 +3399,7 @@ function useCellSelection({
|
|
|
3390
3399
|
if (isEditablePasteTarget(e.target) || isEditablePasteTarget(document.activeElement)) {
|
|
3391
3400
|
return;
|
|
3392
3401
|
}
|
|
3402
|
+
if (isFocusOutsideRoot(rootRef)) return;
|
|
3393
3403
|
if (e.shiftKey && !enableInsertPaste) {
|
|
3394
3404
|
ignoreNextPasteRef.current = true;
|
|
3395
3405
|
pendingPasteModeRef.current = null;
|
|
@@ -3419,6 +3429,7 @@ function useCellSelection({
|
|
|
3419
3429
|
if (isEditablePasteTarget(e.target) || isEditablePasteTarget(document.activeElement)) {
|
|
3420
3430
|
return;
|
|
3421
3431
|
}
|
|
3432
|
+
if (isFocusOutsideRoot(rootRef)) return;
|
|
3422
3433
|
if (ignoreNextPasteRef.current) {
|
|
3423
3434
|
ignoreNextPasteRef.current = false;
|
|
3424
3435
|
pendingPasteModeRef.current = null;
|
package/dist/core.cjs
CHANGED
|
@@ -1384,6 +1384,13 @@ function hasFillExtension(sourceBounds, fillBounds) {
|
|
|
1384
1384
|
}
|
|
1385
1385
|
|
|
1386
1386
|
// src/components/ui/table/features/cell-selection/useCellSelection.ts
|
|
1387
|
+
function isFocusOutsideRoot(rootRef) {
|
|
1388
|
+
const root = rootRef?.current;
|
|
1389
|
+
if (!root) return false;
|
|
1390
|
+
const active = document.activeElement;
|
|
1391
|
+
if (!active || active === document.body) return false;
|
|
1392
|
+
return !root.contains(active);
|
|
1393
|
+
}
|
|
1387
1394
|
function useCellSelection({
|
|
1388
1395
|
data,
|
|
1389
1396
|
rows,
|
|
@@ -1492,6 +1499,7 @@ function useCellSelection({
|
|
|
1492
1499
|
if (isEditablePasteTarget(e.target) || isEditablePasteTarget(document.activeElement)) {
|
|
1493
1500
|
return;
|
|
1494
1501
|
}
|
|
1502
|
+
if (isFocusOutsideRoot(rootRef)) return;
|
|
1495
1503
|
const delta = getCellNavigationDelta(e.key);
|
|
1496
1504
|
if (!delta) return;
|
|
1497
1505
|
const prev = dragStateRef.current;
|
|
@@ -1559,6 +1567,7 @@ function useCellSelection({
|
|
|
1559
1567
|
if (isEditablePasteTarget(e.target) || isEditablePasteTarget(document.activeElement)) {
|
|
1560
1568
|
return;
|
|
1561
1569
|
}
|
|
1570
|
+
if (isFocusOutsideRoot(rootRef)) return;
|
|
1562
1571
|
const isSubtreeShortcut = enableSubtreeCopy && e.shiftKey && e.key.toLowerCase() === "c";
|
|
1563
1572
|
const isVisibleCopyShortcut = !e.shiftKey && e.key.toLowerCase() === "c";
|
|
1564
1573
|
if (!isSubtreeShortcut && !isVisibleCopyShortcut) return;
|
|
@@ -1597,6 +1606,7 @@ function useCellSelection({
|
|
|
1597
1606
|
if (isEditablePasteTarget(e.target) || isEditablePasteTarget(document.activeElement)) {
|
|
1598
1607
|
return;
|
|
1599
1608
|
}
|
|
1609
|
+
if (isFocusOutsideRoot(rootRef)) return;
|
|
1600
1610
|
if (e.shiftKey && !enableInsertPaste) {
|
|
1601
1611
|
ignoreNextPasteRef.current = true;
|
|
1602
1612
|
pendingPasteModeRef.current = null;
|
|
@@ -1626,6 +1636,7 @@ function useCellSelection({
|
|
|
1626
1636
|
if (isEditablePasteTarget(e.target) || isEditablePasteTarget(document.activeElement)) {
|
|
1627
1637
|
return;
|
|
1628
1638
|
}
|
|
1639
|
+
if (isFocusOutsideRoot(rootRef)) return;
|
|
1629
1640
|
if (ignoreNextPasteRef.current) {
|
|
1630
1641
|
ignoreNextPasteRef.current = false;
|
|
1631
1642
|
pendingPasteModeRef.current = null;
|
package/dist/core.js
CHANGED
|
@@ -1290,6 +1290,13 @@ function hasFillExtension(sourceBounds, fillBounds) {
|
|
|
1290
1290
|
}
|
|
1291
1291
|
|
|
1292
1292
|
// src/components/ui/table/features/cell-selection/useCellSelection.ts
|
|
1293
|
+
function isFocusOutsideRoot(rootRef) {
|
|
1294
|
+
const root = rootRef?.current;
|
|
1295
|
+
if (!root) return false;
|
|
1296
|
+
const active = document.activeElement;
|
|
1297
|
+
if (!active || active === document.body) return false;
|
|
1298
|
+
return !root.contains(active);
|
|
1299
|
+
}
|
|
1293
1300
|
function useCellSelection({
|
|
1294
1301
|
data,
|
|
1295
1302
|
rows,
|
|
@@ -1398,6 +1405,7 @@ function useCellSelection({
|
|
|
1398
1405
|
if (isEditablePasteTarget(e.target) || isEditablePasteTarget(document.activeElement)) {
|
|
1399
1406
|
return;
|
|
1400
1407
|
}
|
|
1408
|
+
if (isFocusOutsideRoot(rootRef)) return;
|
|
1401
1409
|
const delta = getCellNavigationDelta(e.key);
|
|
1402
1410
|
if (!delta) return;
|
|
1403
1411
|
const prev = dragStateRef.current;
|
|
@@ -1465,6 +1473,7 @@ function useCellSelection({
|
|
|
1465
1473
|
if (isEditablePasteTarget(e.target) || isEditablePasteTarget(document.activeElement)) {
|
|
1466
1474
|
return;
|
|
1467
1475
|
}
|
|
1476
|
+
if (isFocusOutsideRoot(rootRef)) return;
|
|
1468
1477
|
const isSubtreeShortcut = enableSubtreeCopy && e.shiftKey && e.key.toLowerCase() === "c";
|
|
1469
1478
|
const isVisibleCopyShortcut = !e.shiftKey && e.key.toLowerCase() === "c";
|
|
1470
1479
|
if (!isSubtreeShortcut && !isVisibleCopyShortcut) return;
|
|
@@ -1503,6 +1512,7 @@ function useCellSelection({
|
|
|
1503
1512
|
if (isEditablePasteTarget(e.target) || isEditablePasteTarget(document.activeElement)) {
|
|
1504
1513
|
return;
|
|
1505
1514
|
}
|
|
1515
|
+
if (isFocusOutsideRoot(rootRef)) return;
|
|
1506
1516
|
if (e.shiftKey && !enableInsertPaste) {
|
|
1507
1517
|
ignoreNextPasteRef.current = true;
|
|
1508
1518
|
pendingPasteModeRef.current = null;
|
|
@@ -1532,6 +1542,7 @@ function useCellSelection({
|
|
|
1532
1542
|
if (isEditablePasteTarget(e.target) || isEditablePasteTarget(document.activeElement)) {
|
|
1533
1543
|
return;
|
|
1534
1544
|
}
|
|
1545
|
+
if (isFocusOutsideRoot(rootRef)) return;
|
|
1535
1546
|
if (ignoreNextPasteRef.current) {
|
|
1536
1547
|
ignoreNextPasteRef.current = false;
|
|
1537
1548
|
pendingPasteModeRef.current = null;
|
package/dist/index.cjs
CHANGED
|
@@ -1396,6 +1396,13 @@ function hasFillExtension(sourceBounds, fillBounds) {
|
|
|
1396
1396
|
}
|
|
1397
1397
|
|
|
1398
1398
|
// src/components/ui/table/features/cell-selection/useCellSelection.ts
|
|
1399
|
+
function isFocusOutsideRoot(rootRef) {
|
|
1400
|
+
const root = rootRef?.current;
|
|
1401
|
+
if (!root) return false;
|
|
1402
|
+
const active = document.activeElement;
|
|
1403
|
+
if (!active || active === document.body) return false;
|
|
1404
|
+
return !root.contains(active);
|
|
1405
|
+
}
|
|
1399
1406
|
function useCellSelection({
|
|
1400
1407
|
data,
|
|
1401
1408
|
rows,
|
|
@@ -1504,6 +1511,7 @@ function useCellSelection({
|
|
|
1504
1511
|
if (isEditablePasteTarget(e.target) || isEditablePasteTarget(document.activeElement)) {
|
|
1505
1512
|
return;
|
|
1506
1513
|
}
|
|
1514
|
+
if (isFocusOutsideRoot(rootRef)) return;
|
|
1507
1515
|
const delta = getCellNavigationDelta(e.key);
|
|
1508
1516
|
if (!delta) return;
|
|
1509
1517
|
const prev = dragStateRef.current;
|
|
@@ -1571,6 +1579,7 @@ function useCellSelection({
|
|
|
1571
1579
|
if (isEditablePasteTarget(e.target) || isEditablePasteTarget(document.activeElement)) {
|
|
1572
1580
|
return;
|
|
1573
1581
|
}
|
|
1582
|
+
if (isFocusOutsideRoot(rootRef)) return;
|
|
1574
1583
|
const isSubtreeShortcut = enableSubtreeCopy && e.shiftKey && e.key.toLowerCase() === "c";
|
|
1575
1584
|
const isVisibleCopyShortcut = !e.shiftKey && e.key.toLowerCase() === "c";
|
|
1576
1585
|
if (!isSubtreeShortcut && !isVisibleCopyShortcut) return;
|
|
@@ -1609,6 +1618,7 @@ function useCellSelection({
|
|
|
1609
1618
|
if (isEditablePasteTarget(e.target) || isEditablePasteTarget(document.activeElement)) {
|
|
1610
1619
|
return;
|
|
1611
1620
|
}
|
|
1621
|
+
if (isFocusOutsideRoot(rootRef)) return;
|
|
1612
1622
|
if (e.shiftKey && !enableInsertPaste) {
|
|
1613
1623
|
ignoreNextPasteRef.current = true;
|
|
1614
1624
|
pendingPasteModeRef.current = null;
|
|
@@ -1638,6 +1648,7 @@ function useCellSelection({
|
|
|
1638
1648
|
if (isEditablePasteTarget(e.target) || isEditablePasteTarget(document.activeElement)) {
|
|
1639
1649
|
return;
|
|
1640
1650
|
}
|
|
1651
|
+
if (isFocusOutsideRoot(rootRef)) return;
|
|
1641
1652
|
if (ignoreNextPasteRef.current) {
|
|
1642
1653
|
ignoreNextPasteRef.current = false;
|
|
1643
1654
|
pendingPasteModeRef.current = null;
|
package/dist/index.js
CHANGED
|
@@ -1299,6 +1299,13 @@ function hasFillExtension(sourceBounds, fillBounds) {
|
|
|
1299
1299
|
}
|
|
1300
1300
|
|
|
1301
1301
|
// src/components/ui/table/features/cell-selection/useCellSelection.ts
|
|
1302
|
+
function isFocusOutsideRoot(rootRef) {
|
|
1303
|
+
const root = rootRef?.current;
|
|
1304
|
+
if (!root) return false;
|
|
1305
|
+
const active = document.activeElement;
|
|
1306
|
+
if (!active || active === document.body) return false;
|
|
1307
|
+
return !root.contains(active);
|
|
1308
|
+
}
|
|
1302
1309
|
function useCellSelection({
|
|
1303
1310
|
data,
|
|
1304
1311
|
rows,
|
|
@@ -1407,6 +1414,7 @@ function useCellSelection({
|
|
|
1407
1414
|
if (isEditablePasteTarget(e.target) || isEditablePasteTarget(document.activeElement)) {
|
|
1408
1415
|
return;
|
|
1409
1416
|
}
|
|
1417
|
+
if (isFocusOutsideRoot(rootRef)) return;
|
|
1410
1418
|
const delta = getCellNavigationDelta(e.key);
|
|
1411
1419
|
if (!delta) return;
|
|
1412
1420
|
const prev = dragStateRef.current;
|
|
@@ -1474,6 +1482,7 @@ function useCellSelection({
|
|
|
1474
1482
|
if (isEditablePasteTarget(e.target) || isEditablePasteTarget(document.activeElement)) {
|
|
1475
1483
|
return;
|
|
1476
1484
|
}
|
|
1485
|
+
if (isFocusOutsideRoot(rootRef)) return;
|
|
1477
1486
|
const isSubtreeShortcut = enableSubtreeCopy && e.shiftKey && e.key.toLowerCase() === "c";
|
|
1478
1487
|
const isVisibleCopyShortcut = !e.shiftKey && e.key.toLowerCase() === "c";
|
|
1479
1488
|
if (!isSubtreeShortcut && !isVisibleCopyShortcut) return;
|
|
@@ -1512,6 +1521,7 @@ function useCellSelection({
|
|
|
1512
1521
|
if (isEditablePasteTarget(e.target) || isEditablePasteTarget(document.activeElement)) {
|
|
1513
1522
|
return;
|
|
1514
1523
|
}
|
|
1524
|
+
if (isFocusOutsideRoot(rootRef)) return;
|
|
1515
1525
|
if (e.shiftKey && !enableInsertPaste) {
|
|
1516
1526
|
ignoreNextPasteRef.current = true;
|
|
1517
1527
|
pendingPasteModeRef.current = null;
|
|
@@ -1541,6 +1551,7 @@ function useCellSelection({
|
|
|
1541
1551
|
if (isEditablePasteTarget(e.target) || isEditablePasteTarget(document.activeElement)) {
|
|
1542
1552
|
return;
|
|
1543
1553
|
}
|
|
1554
|
+
if (isFocusOutsideRoot(rootRef)) return;
|
|
1544
1555
|
if (ignoreNextPasteRef.current) {
|
|
1545
1556
|
ignoreNextPasteRef.current = false;
|
|
1546
1557
|
pendingPasteModeRef.current = null;
|