@sheetxl/grid-react 0.3.3 → 0.3.4
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/browser/cjs/index.cjs +5 -5
- package/browser/esm/index.mjs +1370 -1369
- package/licenses/dependencies.txt +2 -2
- package/node/esm/index.mjs +75 -74
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Name: @sheetxl/utils
|
|
2
|
-
Version: 0.3.
|
|
2
|
+
Version: 0.3.4
|
|
3
3
|
License: SEE LICENSE IN <LICENSE>
|
|
4
4
|
Private: false
|
|
5
5
|
Description: Utils - Utilities used by most SheetXL components.
|
|
@@ -21,7 +21,7 @@ https://www.sheetxl.com/licensing-pricing
|
|
|
21
21
|
---
|
|
22
22
|
|
|
23
23
|
Name: @sheetxl/utils-react
|
|
24
|
-
Version: 0.3.
|
|
24
|
+
Version: 0.3.4
|
|
25
25
|
License: SEE LICENSE IN <LICENSE>
|
|
26
26
|
Private: false
|
|
27
27
|
Description: Utils React - Utilities for React capabilities needed for all SheetXL components.
|
package/node/esm/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license @sheetxl/grid-react - Grid - Advanced data grid component for React - v0.3.
|
|
2
|
+
* @license @sheetxl/grid-react - Grid - Advanced data grid component for React - v0.3.4
|
|
3
3
|
*
|
|
4
4
|
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
5
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
@@ -1585,38 +1585,38 @@ const kn = () => "sheetxl-ui-" + Mn++, Rn = o["useId".toString()], Pn = null !=
|
|
|
1585
1585
|
return { x: u2.x ?? 0, y: u2.y ?? 0, height: Math.min(p2 - u2.y, u2.height) + 1, width: Math.min(f3 - u2.x, u2.width) + 1 };
|
|
1586
1586
|
}, [E2]), k2 = Tt(o2, [o2]), R2 = i(() => {
|
|
1587
1587
|
n2?.getStage()?.focus();
|
|
1588
|
-
}, [n2]), P2 = Tt((e5) => {
|
|
1589
|
-
c2?.(e5),
|
|
1590
|
-
}, [c2]),
|
|
1588
|
+
}, [n2]), P2 = l(null), O2 = Tt((e5) => {
|
|
1589
|
+
c2?.(e5), H2(), I2(true), P2.current = null;
|
|
1590
|
+
}, [c2]), L2 = Tt((e5) => {
|
|
1591
1591
|
a2?.(e5.coords);
|
|
1592
|
-
}, [a2]),
|
|
1593
|
-
e5.isSubmitted || e5.isCancelled || (
|
|
1594
|
-
}, [f2]),
|
|
1592
|
+
}, [a2]), D2 = Tt((e5) => {
|
|
1593
|
+
e5.isSubmitted || e5.isCancelled || ($2.current.isEditorClosed = true, R2(), e5.isCancelled = true, f2?.(e5.coords), H2());
|
|
1594
|
+
}, [f2]), z2 = Tt((e5) => {
|
|
1595
1595
|
if (e5.isSubmitted || e5.isCancelled) return false;
|
|
1596
1596
|
try {
|
|
1597
|
-
return e5.isEditorClosing = true, e5.isSubmitted = true, e5.isEditorSubmitted || (e5.isEditorSubmitted = true, e5.editorRefs[0]?.submitEdit?.()), e5.coords, d2?.(e5.coords), e5.isEditorClosed = true, R2(),
|
|
1597
|
+
return P2.current = e5.coords, e5.isEditorClosing = true, e5.isSubmitted = true, e5.isEditorSubmitted || (e5.isEditorSubmitted = true, e5.editorRefs[0]?.submitEdit?.()), e5.coords, d2?.(e5.coords), e5.isEditorClosed = true, R2(), H2(), true;
|
|
1598
1598
|
} catch (t3) {
|
|
1599
1599
|
throw e5.isEditorClosing = false, e5.isSubmitted = false, t3;
|
|
1600
1600
|
}
|
|
1601
|
-
}, [d2]),
|
|
1602
|
-
I2(false), g2?.(e5.coords),
|
|
1603
|
-
}, [g2]),
|
|
1604
|
-
e5 &&
|
|
1605
|
-
}, []),
|
|
1601
|
+
}, [d2]), A2 = Tt((e5) => {
|
|
1602
|
+
I2(false), g2?.(e5.coords), H2();
|
|
1603
|
+
}, [g2]), $2 = l(null), B2 = l(null), F2 = l(null), j2 = l([]), [V2, W2] = p((e5) => e5 + 1, 0), H2 = i((e5) => {
|
|
1604
|
+
e5 && j2.current.push(e5), W2();
|
|
1605
|
+
}, []), N2 = Tt((e5) => {
|
|
1606
1606
|
if (e5.defaultPrevented || e5.isSynthetic) return;
|
|
1607
1607
|
if (!n2) return;
|
|
1608
1608
|
const t3 = n2?.getCellCoordsFromClient(e5.clientX, e5.clientY);
|
|
1609
1609
|
if (!t3) return;
|
|
1610
|
-
|
|
1611
|
-
}, [n2]), N2 = Tt((e5) => {
|
|
1612
|
-
const t3 = e5.nativeEvent;
|
|
1613
|
-
H2(t3);
|
|
1610
|
+
H2({ eventType: "pointer", event: e5, coords: t3 });
|
|
1614
1611
|
}, [n2]), U2 = Tt((e5) => {
|
|
1612
|
+
const t3 = e5.nativeEvent;
|
|
1613
|
+
N2(t3);
|
|
1614
|
+
}, [n2]), K2 = Tt((e5) => {
|
|
1615
1615
|
if (e5.defaultPrevented || e5.isSynthetic) return;
|
|
1616
1616
|
if (!n2?.getStage()) return;
|
|
1617
|
-
const t3 =
|
|
1617
|
+
const t3 = B2.current;
|
|
1618
1618
|
w2(e5, t3) && (e5.stopPropagation(), e5.preventDefault()), e5.key;
|
|
1619
|
-
|
|
1619
|
+
H2({ eventType: "keyboard", event: e5, coords: t3 });
|
|
1620
1620
|
}, [n2]);
|
|
1621
1621
|
u(() => {
|
|
1622
1622
|
const e5 = (e6, t4) => {
|
|
@@ -1624,20 +1624,20 @@ const kn = () => "sheetxl-ui-" + Mn++, Rn = o["useId".toString()], Pn = null !=
|
|
|
1624
1624
|
if (!o4) return null;
|
|
1625
1625
|
const r3 = o4;
|
|
1626
1626
|
if (!k2(o4)) return null;
|
|
1627
|
-
|
|
1627
|
+
O2?.(o4);
|
|
1628
1628
|
const i2 = Me.uuidV4();
|
|
1629
|
-
t4 = Object.freeze({ autoFocus: true, ...t4 }),
|
|
1629
|
+
t4 = Object.freeze({ autoFocus: true, ...t4 }), F2.current = o4;
|
|
1630
1630
|
const l2 = { coords: r3, startEvent: t4, uuid: i2, isMounted: false, isStarted: false, isSubmitted: false, isEditorSubmitted: false, isEditorClosing: false, isEditorClosed: false, isCancelled: false, events: [], editorRefsDispatchEditorEvent: [], editorRefs: [], onMount: (e7) => {
|
|
1631
|
-
l2.isMounted || (l2.isMounted = true,
|
|
1631
|
+
l2.isMounted || (l2.isMounted = true, H2());
|
|
1632
1632
|
}, onUnmount: (e7) => {
|
|
1633
1633
|
if (0 === l2.editorRefs.length) {
|
|
1634
1634
|
const e8 = () => {
|
|
1635
|
-
l2.isMounted = false,
|
|
1635
|
+
l2.isMounted = false, H2();
|
|
1636
1636
|
};
|
|
1637
1637
|
if (document.activeElement !== document.body) e8();
|
|
1638
1638
|
else {
|
|
1639
1639
|
const t5 = (e9) => {
|
|
1640
|
-
e9.defaultPrevented || e9.target !== document.body ||
|
|
1640
|
+
e9.defaultPrevented || e9.target !== document.body || K2(e9);
|
|
1641
1641
|
};
|
|
1642
1642
|
window.addEventListener("keydown", t5, true), n2.getStage()?.addEventListener("focusin", () => {
|
|
1643
1643
|
window.removeEventListener("keydown", t5), e8();
|
|
@@ -1647,102 +1647,103 @@ const kn = () => "sheetxl-ui-" + Mn++, Rn = o["useId".toString()], Pn = null !=
|
|
|
1647
1647
|
} };
|
|
1648
1648
|
return l2;
|
|
1649
1649
|
};
|
|
1650
|
-
if (
|
|
1651
|
-
const t3 =
|
|
1650
|
+
if (j2.current.length <= 0 && !$2.current) return;
|
|
1651
|
+
const t3 = j2.current[0];
|
|
1652
1652
|
Bn(t3), ((e6) => {
|
|
1653
1653
|
const t4 = [], n3 = e6?.length ?? 0;
|
|
1654
1654
|
for (let o4 = 0; o4 < n3; o4++) {
|
|
1655
1655
|
const n4 = e6[o4];
|
|
1656
1656
|
t4.push(Bn(n4));
|
|
1657
1657
|
}
|
|
1658
|
-
})(
|
|
1659
|
-
let o3 =
|
|
1660
|
-
if (
|
|
1661
|
-
if (
|
|
1662
|
-
else if (
|
|
1663
|
-
if (
|
|
1664
|
-
|
|
1658
|
+
})(j2.current), $2.current, $2.current;
|
|
1659
|
+
let o3 = $2.current;
|
|
1660
|
+
if ($2.current) {
|
|
1661
|
+
if ($2.current.isDone) $2.current = null;
|
|
1662
|
+
else if ($2.current.isSubmitted || $2.current.isCancelled) {
|
|
1663
|
+
if ($2.current.isMounted) return;
|
|
1664
|
+
$2.current.isDone || (A2($2.current), $2.current.isDone = true);
|
|
1665
1665
|
}
|
|
1666
1666
|
}
|
|
1667
1667
|
if (t3) {
|
|
1668
1668
|
if ("start" === t3.eventType) {
|
|
1669
|
-
const n3 = t3, o4 = n3.startEvent?.cell ??
|
|
1670
|
-
|
|
1669
|
+
const n3 = t3, o4 = n3.startEvent?.cell ?? B2.current;
|
|
1670
|
+
$2.current && ne.isEqualCells($2.current.coords, o4) || ($2.current = e5(o4, n3.startEvent));
|
|
1671
1671
|
} else if ("keyboard" === t3.eventType) {
|
|
1672
1672
|
const n3 = t3.event;
|
|
1673
|
-
if (
|
|
1674
|
-
n3.key,
|
|
1675
|
-
for (let e6 = 0; e6 <
|
|
1673
|
+
if ($2.current) {
|
|
1674
|
+
n3.key, $2.current.events, $2.current.events.push(t3);
|
|
1675
|
+
for (let e6 = 0; e6 < $2.current.editorRefsDispatchEditorEvent.length; e6++) $2.current.editorRefsDispatchEditorEvent[e6](t3);
|
|
1676
1676
|
} else {
|
|
1677
1677
|
if (w2(n3, t3.coords)) {
|
|
1678
1678
|
let n4;
|
|
1679
|
-
const o4 = e5(n4?.cell ??
|
|
1680
|
-
o4 && o4.events.push(t3),
|
|
1679
|
+
const o4 = e5(n4?.cell ?? B2.current, n4);
|
|
1680
|
+
o4 && o4.events.push(t3), $2.current = o4;
|
|
1681
1681
|
}
|
|
1682
1682
|
}
|
|
1683
1683
|
} else if ("pointer" === t3.eventType) {
|
|
1684
1684
|
const n3 = t3.event;
|
|
1685
|
-
if (
|
|
1686
|
-
|
|
1687
|
-
for (let e6 = 0; e6 <
|
|
1685
|
+
if ($2.current) {
|
|
1686
|
+
$2.current.events.push(t3);
|
|
1687
|
+
for (let e6 = 0; e6 < $2.current.editorRefsDispatchEditorEvent.length; e6++) $2.current.editorRefsDispatchEditorEvent[e6](t3);
|
|
1688
1688
|
} else {
|
|
1689
|
-
const o4 = t3?.coords ??
|
|
1689
|
+
const o4 = t3?.coords ?? B2.current, r3 = m2(n3, o4);
|
|
1690
1690
|
if (r3) {
|
|
1691
1691
|
let n4;
|
|
1692
1692
|
"boolean" != typeof n4 && (n4 = r3);
|
|
1693
1693
|
const i2 = e5(o4, n4);
|
|
1694
|
-
i2 && i2.events.push(t3),
|
|
1694
|
+
i2 && i2.events.push(t3), $2.current = i2;
|
|
1695
1695
|
}
|
|
1696
1696
|
}
|
|
1697
1697
|
} else if ("submit" === t3.eventType) {
|
|
1698
|
-
if (
|
|
1699
|
-
if (
|
|
1700
|
-
|
|
1698
|
+
if ($2.current && !$2.current.isSubmitted && !$2.current.isCancelled) {
|
|
1699
|
+
if (!$2.current.isMounted) return;
|
|
1700
|
+
z2($2.current);
|
|
1701
1701
|
}
|
|
1702
1702
|
} else if ("cancel" === t3.eventType) {
|
|
1703
|
-
if (
|
|
1704
|
-
if (
|
|
1705
|
-
|
|
1703
|
+
if ($2.current && !$2.current.isSubmitted && !$2.current.isCancelled) {
|
|
1704
|
+
if (!$2.current.isMounted) return;
|
|
1705
|
+
D2($2.current);
|
|
1706
1706
|
}
|
|
1707
1707
|
} else if ("coordsChange" === t3.eventType) {
|
|
1708
1708
|
const e6 = t3;
|
|
1709
|
-
if (
|
|
1710
|
-
if (
|
|
1709
|
+
if (B2.current = e6.activeCoords, $2.current, $2.current && !$2.current.isSubmitted && !$2.current.isCancelled) {
|
|
1710
|
+
if (!$2.current.isMounted) return;
|
|
1711
1711
|
try {
|
|
1712
|
-
|
|
1712
|
+
z2($2.current);
|
|
1713
1713
|
} catch (e7) {
|
|
1714
1714
|
}
|
|
1715
1715
|
}
|
|
1716
1716
|
}
|
|
1717
1717
|
}
|
|
1718
|
-
|
|
1719
|
-
n2 &&
|
|
1718
|
+
j2.current.length > 0 && (j2.current.shift(), H2()), 0 === j2.current.length && (!$2.current || $2.current.isEditorClosing || $2.current.isEditorClosed ? !$2.current && o3 && R2() : $2.current.isMounted && !$2.current.isStarted && ($2.current.isStarted = true, $2.current.startEvent.autoFocus && ("string" == typeof $2.current.startEvent.autoFocus ? $2.current.editorRefs[0]?.autoFocus($2.current.startEvent.autoFocus) : $2.current.editorRefs[0]?.autoFocus()), L2?.($2.current), requestAnimationFrame(() => {
|
|
1719
|
+
n2 && $2.current?.coords && n2.scrollCellCoordsIntoView($2.current.coords);
|
|
1720
1720
|
})));
|
|
1721
|
-
}, [
|
|
1722
|
-
|
|
1723
|
-
|
|
1721
|
+
}, [V2]), s(() => {
|
|
1722
|
+
if (P2.current && ne.isEqualCells(P2.current, S2)) return;
|
|
1723
|
+
F2.current = S2;
|
|
1724
|
+
const e5 = $2.current?.coords;
|
|
1724
1725
|
if (!ne.isEqualCells(e5, S2)) {
|
|
1725
|
-
|
|
1726
|
-
|
|
1726
|
+
$2.current && ($2.current.isEditorClosing = true);
|
|
1727
|
+
H2({ eventType: "coordsChange", activeCoords: S2 });
|
|
1727
1728
|
}
|
|
1728
1729
|
}, [S2]);
|
|
1729
|
-
const
|
|
1730
|
-
|
|
1731
|
-
}, []), { width:
|
|
1730
|
+
const q2 = i((e5) => {
|
|
1731
|
+
K2(e5.nativeEvent);
|
|
1732
|
+
}, []), { width: Y2 = 0, height: X2 = 0 } = C2 ?? { width: 0, height: 0 }, G2 = Tt(r2, [r2]);
|
|
1732
1733
|
return { overlay: Tt((t3) => {
|
|
1733
|
-
if (
|
|
1734
|
-
|
|
1735
|
-
let n3 = T2(t3,
|
|
1736
|
-
n3 && 0 !== n3.width && 0 !== n3.height || (n3 = { x: 0, y: 0, width:
|
|
1734
|
+
if (!$2.current || $2.current.isEditorClosed) return $2.current, null;
|
|
1735
|
+
$2.current.coords;
|
|
1736
|
+
let n3 = T2(t3, $2.current.coords, Y2, X2, b2, E2), o3 = true;
|
|
1737
|
+
n3 && 0 !== n3.width && 0 !== n3.height || (n3 = { x: 0, y: 0, width: Y2, height: Y2 }, o3 = false);
|
|
1737
1738
|
const r3 = t3.getZoom(), i2 = { containerBounds: { x: 0, y: 0, width: n3.width / r3, height: n3.height / r3 }, setNaturalDimensions: M2, zoom: r3 };
|
|
1738
|
-
return e(Wn, { session:
|
|
1739
|
-
}, [r2, b2,
|
|
1740
|
-
|
|
1739
|
+
return e(Wn, { session: $2.current, refLatestCoords: F2, handleSubmitEdit: z2, handleCancelEdit: D2, cellBounds: n3, borderStrokeWidth: v2, borderStrokeFill: y2, isInBounds: o3, getCellEditor: G2, propsEditor: i2, alignment: E2, ...x2 }, "editor:" + $2.current.uuid);
|
|
1740
|
+
}, [r2, b2, V2, Y2, X2, E2, v2, y2]), startEdit: i((e5) => {
|
|
1741
|
+
H2({ eventType: "start", startEvent: e5 });
|
|
1741
1742
|
}, []), submitEdit: i(() => {
|
|
1742
|
-
|
|
1743
|
+
H2({ eventType: "submit" });
|
|
1743
1744
|
}, []), cancelEdit: i(() => {
|
|
1744
|
-
|
|
1745
|
-
}, []), onKeyboardEvent:
|
|
1745
|
+
H2({ eventType: "cancel" });
|
|
1746
|
+
}, []), onKeyboardEvent: q2, onPointerEvent: U2, onKeyboardEventNative: K2, onPointerEventNative: N2, isEditing: _2 };
|
|
1746
1747
|
}, Nn = ({ gridRef: e5, gridMainRef: t2, orientation: n2 = $, headerCount: o2, selectionPolicy: r2 = "multiple", newSelectionMode: s2 = "clear", alwaysScrollToActiveCoords: c2 = true, onDragStart: a2, onDragEnd: u2, pointerDownInterceptor: h2, pointerMoveInterceptor: f2, onPointerUp: p2, newSelection: g2, modifySelection: w2, appendSelection: m2, clearSelections: x2 }) => {
|
|
1747
1748
|
const y2 = o2 ?? ((n2 === $ ? e5.current?.rowCount : e5.current?.columnCount) || 0), v2 = l(null), b2 = l(null), S2 = l(false), E2 = l(null), _2 = i((e6) => n2 === A ? { rowIndex: 0, colIndex: e6.colIndex } : { rowIndex: e6.rowIndex, colIndex: 0 }, [n2]), I2 = i((e6) => n2 === A ? { rowIndex: t2.current ? t2.current.rowCount - 1 : 0, colIndex: e6.colIndex } : { rowIndex: e6.rowIndex, colIndex: t2.current ? t2.current.columnCount - 1 : 0 }, [n2]), C2 = (e6) => {
|
|
1748
1749
|
b2.current = I2(e6), w2(b2.current, v2.current);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sheetxl/grid-react",
|
|
3
3
|
"description": "Grid - Advanced data grid component for React",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.4",
|
|
5
5
|
"license": "SEE LICENSE IN <LICENSE>",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"table"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@sheetxl/utils": "^0.3.
|
|
34
|
-
"@sheetxl/utils-react": "^0.3.
|
|
33
|
+
"@sheetxl/utils": "^0.3.4",
|
|
34
|
+
"@sheetxl/utils-react": "^0.3.4",
|
|
35
35
|
"clsx": "^2.1.1",
|
|
36
36
|
"react-merge-refs": "^3.0.2",
|
|
37
37
|
"react-use": "^17.6.0",
|