@ai-matrx/design-system 0.48.6 → 0.48.7
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/CHANGELOG.md +8 -0
- package/dist/data-table/index.cjs +18 -0
- package/dist/data-table/index.cjs.map +1 -1
- package/dist/data-table/index.js +18 -0
- package/dist/data-table/index.js.map +1 -1
- package/dist/data-table/spreadsheet.cjs +18 -0
- package/dist/data-table/spreadsheet.cjs.map +1 -1
- package/dist/data-table/spreadsheet.js +18 -0
- package/dist/data-table/spreadsheet.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.48.7
|
|
4
|
+
### Unreleased
|
|
5
|
+
|
|
6
|
+
### DATA-V2-BASICS (2026-09-27): a click off the table lets go
|
|
7
|
+
|
|
8
|
+
- **`useSpreadsheetGrid`: while a range is held, a pointerdown outside the table (its `[data-matrx-table]` root) and outside every layer it may have opened (menu, listbox, dialog, popper, toast) clears the range and takes the keyboard off the grid.** An open cell editor loses focus with it and saves as a Tab away would. Before, a 12-cell range survived a click on the page header or the sidebar while the keyboard fell to `<body>`, so Escape could not clear it either (Arman: "that's often the easiest way you get yourself out of strange state conditions").
|
|
9
|
+
- Proof: `data-table/MatrxDataTable.outside-click-lets-go.test.tsx` (red on the previous hook: the range survived).
|
|
10
|
+
|
|
3
11
|
## 0.48.6
|
|
4
12
|
|
|
5
13
|
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
|
@@ -43019,6 +43019,7 @@ function camePastAPortalIntoTheContainer(target) {
|
|
|
43019
43019
|
if (!element) return false;
|
|
43020
43020
|
return element.closest('[data-matrx-table-spreadsheet="true"]') === null;
|
|
43021
43021
|
}
|
|
43022
|
+
var LAYERS_THE_GRID_OPENS = '[data-radix-popper-content-wrapper], [data-radix-portal], [role="menu"], [role="listbox"], [role="dialog"], [role="alertdialog"], [data-sonner-toaster]';
|
|
43022
43023
|
var READ_ONLY_REASON = "This table is view-only \u2014 you can select and copy, but not change cells.";
|
|
43023
43024
|
function useSpreadsheetGrid(options) {
|
|
43024
43025
|
const [range, setRange] = (0, import_react15.useState)(null);
|
|
@@ -43273,6 +43274,23 @@ function useSpreadsheetGrid(options) {
|
|
|
43273
43274
|
},
|
|
43274
43275
|
[endEdit, focusIsLost]
|
|
43275
43276
|
);
|
|
43277
|
+
const holdsARange = range !== null;
|
|
43278
|
+
(0, import_react15.useEffect)(() => {
|
|
43279
|
+
if (!holdsARange || typeof document === "undefined") return;
|
|
43280
|
+
const onPointerDown = (event) => {
|
|
43281
|
+
const target = event.target instanceof Element ? event.target : null;
|
|
43282
|
+
const container = catcherRef.current?.closest('[data-matrx-table-spreadsheet="true"]');
|
|
43283
|
+
if (!target || !container || !container.isConnected) return;
|
|
43284
|
+
const table = container.closest("[data-matrx-table]") ?? container;
|
|
43285
|
+
if (table.contains(target) || target.closest(LAYERS_THE_GRID_OPENS)) return;
|
|
43286
|
+
setRange(null);
|
|
43287
|
+
setFillTarget(null);
|
|
43288
|
+
const active = document.activeElement;
|
|
43289
|
+
if (active instanceof HTMLElement && container.contains(active)) active.blur();
|
|
43290
|
+
};
|
|
43291
|
+
document.addEventListener("pointerdown", onPointerDown, true);
|
|
43292
|
+
return () => document.removeEventListener("pointerdown", onPointerDown, true);
|
|
43293
|
+
}, [holdsARange]);
|
|
43276
43294
|
const controller = (0, import_react15.useMemo)(() => ({ endEdit, select, focusGrid }), [endEdit, select, focusGrid]);
|
|
43277
43295
|
const onKeyDown = (0, import_react15.useCallback)(
|
|
43278
43296
|
(event) => {
|