@ox0/data-grid 0.4.1 → 0.6.0
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataGrid.d.ts","sourceRoot":"","sources":["../../src/components/DataGrid.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAYL,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AAWd,OAAO,KAAK,EAIV,aAAa,EAQd,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"DataGrid.d.ts","sourceRoot":"","sources":["../../src/components/DataGrid.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAYL,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AAWd,OAAO,KAAK,EAIV,aAAa,EAQd,MAAM,UAAU,CAAA;AAqQjB;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CAAC,GAAG,SAAS,MAAM,EAAE,KAAK,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,SAAS,CAm9EjF"}
|
|
@@ -49,6 +49,14 @@ export type CellActionsProps = {
|
|
|
49
49
|
/** The accessible name of the button on `cell`. */
|
|
50
50
|
readonly labelFor: (cell: HTMLElement) => string;
|
|
51
51
|
};
|
|
52
|
+
/**
|
|
53
|
+
* `focus()` with `focusVisible` (whether the browser shows the focus ring) — supported by current
|
|
54
|
+
* browsers, but missing from older DOM type libraries, hence the wider options type.
|
|
55
|
+
*/
|
|
56
|
+
export declare function focusWith(element: HTMLElement, options: {
|
|
57
|
+
readonly focusVisible: boolean;
|
|
58
|
+
readonly preventScroll?: boolean;
|
|
59
|
+
}): void;
|
|
52
60
|
/**
|
|
53
61
|
* The cell menu (spec "Filtering from cells"): one ⋯ button for the whole grid, moved onto the
|
|
54
62
|
* hovered cell — a button per cell would cost a component in every mounted cell — and the menu it
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cell-actions.d.ts","sourceRoot":"","sources":["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CAAC,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;CAAE,CACjF,CAAA;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,GAAG,IAAI,GAAG,YAAY,CAqChF;AASD,oFAAoF;AACpF,wBAAgB,UAAU,CACxB,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE;IACL,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;IAC5B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;IAC5B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;CAC5B,EACD,OAAO,EAAE;IACP,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAA;IACjC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAC1B,GACA,UAAU,EAAE,CA4Cd"}
|
package/dist/index.js
CHANGED
|
@@ -308,7 +308,7 @@ __webpack_require__.add({
|
|
|
308
308
|
left: 0;
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
-
.groupRow-ooQc5M:focus-visible {
|
|
311
|
+
.row-hfdKNj:focus-visible, .selectedRow-qs8lAI:focus-visible, .groupRow-ooQc5M:focus-visible {
|
|
312
312
|
outline: 2px solid var(--ox0-color-focus-ring);
|
|
313
313
|
outline-offset: -2px;
|
|
314
314
|
}
|
|
@@ -796,28 +796,6 @@ __webpack_require__.add({
|
|
|
796
796
|
pointer-events: auto;
|
|
797
797
|
}
|
|
798
798
|
|
|
799
|
-
.cell-q3dXM7 {
|
|
800
|
-
--_actions-clear: calc(var(--ox0-space-2xs) + 24px);
|
|
801
|
-
--_actions-fade: linear-gradient(to left,
|
|
802
|
-
transparent var(--_actions-clear),
|
|
803
|
-
#000 calc(var(--_actions-clear) + 8px));
|
|
804
|
-
--_actions-fade-start: linear-gradient(to right,
|
|
805
|
-
transparent var(--_actions-clear),
|
|
806
|
-
#000 calc(var(--_actions-clear) + 8px));
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
.cell-q3dXM7[data-actions-hover]:not([data-pinned]), .cell-q3dXM7[data-pinned][data-actions-hover] > * {
|
|
810
|
-
mask-image: var(--_actions-fade);
|
|
811
|
-
}
|
|
812
|
-
|
|
813
|
-
.cell-q3dXM7[data-align="end"] > .cellText-Ge3QlA, .cell-q3dXM7[data-align="end"] > .cellWrap-lWoNaf {
|
|
814
|
-
text-align: end;
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
.cell-q3dXM7[data-align="end"][data-actions-hover]:not([data-pinned]), .cell-q3dXM7[data-align="end"][data-pinned][data-actions-hover] > * {
|
|
818
|
-
mask-image: var(--_actions-fade-start);
|
|
819
|
-
}
|
|
820
|
-
|
|
821
799
|
.cell-q3dXM7[data-filter-pending="include"] {
|
|
822
800
|
background: var(--ox0-color-accent-subtle);
|
|
823
801
|
box-shadow: inset 0 0 0 1px var(--ox0-color-accent);
|
|
@@ -3392,9 +3370,46 @@ data_grid_module_options.insertStyleElement = insertStyleElement_default();
|
|
|
3392
3370
|
injectStylesIntoStyleTag_default()(data_grid_module_0.A, data_grid_module_options);
|
|
3393
3371
|
const data_grid_module = data_grid_module_0.A && data_grid_module_0.A.locals ? data_grid_module_0.A.locals : void 0;
|
|
3394
3372
|
const HOVER_ATTRIBUTE = "data-actions-hover";
|
|
3373
|
+
function focusWith(element, options) {
|
|
3374
|
+
const focusOptions = options;
|
|
3375
|
+
element.focus(focusOptions);
|
|
3376
|
+
}
|
|
3377
|
+
function showsFocusRing(element) {
|
|
3378
|
+
try {
|
|
3379
|
+
return element.matches(":focus-visible");
|
|
3380
|
+
} catch {
|
|
3381
|
+
return false;
|
|
3382
|
+
}
|
|
3383
|
+
}
|
|
3384
|
+
function focusToReturn(row) {
|
|
3385
|
+
const active = row ?? document.activeElement;
|
|
3386
|
+
return active instanceof HTMLElement && active !== document.body ? {
|
|
3387
|
+
element: active,
|
|
3388
|
+
ring: showsFocusRing(active)
|
|
3389
|
+
} : null;
|
|
3390
|
+
}
|
|
3391
|
+
const FADE_PX = 8;
|
|
3392
|
+
function fadeUnderButton(cell, button, side) {
|
|
3393
|
+
const box = cell.getBoundingClientRect();
|
|
3394
|
+
const buttonBox = button.getBoundingClientRect();
|
|
3395
|
+
for (const child of cell.children){
|
|
3396
|
+
if (!(child instanceof HTMLElement)) continue;
|
|
3397
|
+
const childBox = child.getBoundingClientRect();
|
|
3398
|
+
const overlap = "end" === side ? childBox.right - buttonBox.left : buttonBox.right - childBox.left;
|
|
3399
|
+
if (overlap <= 0 || 0 === box.width) continue;
|
|
3400
|
+
const direction = "end" === side ? "to left" : "to right";
|
|
3401
|
+
child.style.maskImage = `linear-gradient(${direction}, transparent ${overlap}px, #000 ${overlap + FADE_PX}px)`;
|
|
3402
|
+
}
|
|
3403
|
+
}
|
|
3404
|
+
function clearFade(cell) {
|
|
3405
|
+
for (const child of cell.children)if (child instanceof HTMLElement) child.style.removeProperty("mask-image");
|
|
3406
|
+
}
|
|
3395
3407
|
function placeAnchor(anchor, cellRef, cell) {
|
|
3396
3408
|
const previous = cellRef.current;
|
|
3397
|
-
if (previous && previous !== cell)
|
|
3409
|
+
if (previous && previous !== cell) {
|
|
3410
|
+
previous.removeAttribute(HOVER_ATTRIBUTE);
|
|
3411
|
+
clearFade(previous);
|
|
3412
|
+
}
|
|
3398
3413
|
cellRef.current = cell;
|
|
3399
3414
|
if (!anchor) return;
|
|
3400
3415
|
const frame = anchor.parentElement;
|
|
@@ -3407,12 +3422,16 @@ function placeAnchor(anchor, cellRef, cell) {
|
|
|
3407
3422
|
anchor.style.left = `${box.left - frameBox.left}px`;
|
|
3408
3423
|
anchor.style.width = `${box.width}px`;
|
|
3409
3424
|
anchor.style.height = `${box.height}px`;
|
|
3410
|
-
|
|
3425
|
+
const side = "end" === cell.dataset.align ? "start" : "end";
|
|
3426
|
+
anchor.dataset.side = side;
|
|
3427
|
+
const button = anchor.querySelector("button");
|
|
3428
|
+
if (button) fadeUnderButton(cell, button, side);
|
|
3411
3429
|
}
|
|
3412
3430
|
function CellActions({ apiRef, sectionsFor, onAction, labelFor }) {
|
|
3413
3431
|
const anchorRef = useRef(null);
|
|
3414
3432
|
const cellRef = useRef(null);
|
|
3415
3433
|
const rowRef = useRef(null);
|
|
3434
|
+
const returnRef = useRef(null);
|
|
3416
3435
|
const isOpenRef = useRef(false);
|
|
3417
3436
|
const shiftRef = useRef(false);
|
|
3418
3437
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -3440,6 +3459,7 @@ function CellActions({ apiRef, sectionsFor, onAction, labelFor }) {
|
|
|
3440
3459
|
placeAnchor(anchorRef.current, cellRef, cell);
|
|
3441
3460
|
setLabel(latest.current.labelFor(cell));
|
|
3442
3461
|
rowRef.current = options.row ?? null;
|
|
3462
|
+
returnRef.current = focusToReturn(options.row);
|
|
3443
3463
|
const next = latest.current.sectionsFor(cell, options.row);
|
|
3444
3464
|
if (0 === next.length) return;
|
|
3445
3465
|
setSections(next);
|
|
@@ -3474,12 +3494,18 @@ function CellActions({ apiRef, sectionsFor, onAction, labelFor }) {
|
|
|
3474
3494
|
const opened = cell ? latest.current.sectionsFor(cell, void 0) : [];
|
|
3475
3495
|
if (0 === opened.length) return;
|
|
3476
3496
|
rowRef.current = null;
|
|
3497
|
+
returnRef.current = focusToReturn(void 0);
|
|
3477
3498
|
setSections(opened);
|
|
3478
3499
|
}
|
|
3479
3500
|
isOpenRef.current = next;
|
|
3480
3501
|
setIsOpen(next);
|
|
3481
3502
|
if (!next) {
|
|
3482
|
-
|
|
3503
|
+
const back = returnRef.current;
|
|
3504
|
+
if (back?.element.isConnected) focusWith(back.element, {
|
|
3505
|
+
focusVisible: back.ring,
|
|
3506
|
+
preventScroll: true
|
|
3507
|
+
});
|
|
3508
|
+
returnRef.current = null;
|
|
3483
3509
|
rowRef.current = null;
|
|
3484
3510
|
place(null);
|
|
3485
3511
|
}
|
|
@@ -3494,6 +3520,7 @@ function CellActions({ apiRef, sectionsFor, onAction, labelFor }) {
|
|
|
3494
3520
|
onOpenChange: handleOpenChange,
|
|
3495
3521
|
trigger: /*#__PURE__*/ jsx(IconButton, {
|
|
3496
3522
|
icon: MoreHorizontalIcon,
|
|
3523
|
+
isTooltipDisabled: isOpen,
|
|
3497
3524
|
label: label,
|
|
3498
3525
|
size: "xs",
|
|
3499
3526
|
tabIndex: -1,
|
|
@@ -6205,9 +6232,10 @@ function DataGrid(props) {
|
|
|
6205
6232
|
return {
|
|
6206
6233
|
column,
|
|
6207
6234
|
type,
|
|
6235
|
+
row: rowElement,
|
|
6208
6236
|
isList: Array.isArray(raw),
|
|
6209
6237
|
values: cellFilterValues(raw, type, timeZone),
|
|
6210
|
-
text:
|
|
6238
|
+
text: cell.innerText.trim()
|
|
6211
6239
|
};
|
|
6212
6240
|
}
|
|
6213
6241
|
function runFilterAction(column, value, action, apply, window1) {
|
|
@@ -6284,7 +6312,7 @@ function DataGrid(props) {
|
|
|
6284
6312
|
});
|
|
6285
6313
|
sections.push({
|
|
6286
6314
|
key: `${target.column.id}:${key}`,
|
|
6287
|
-
label: `${target.column.header}: ${null === value ? "(empty)" :
|
|
6315
|
+
label: `${target.column.header}: ${null === value ? "(empty)" : String(value)}`,
|
|
6288
6316
|
columnId: target.column.id,
|
|
6289
6317
|
value,
|
|
6290
6318
|
text,
|
|
@@ -6304,8 +6332,8 @@ function DataGrid(props) {
|
|
|
6304
6332
|
function cellActionsLabel(cell) {
|
|
6305
6333
|
const target = cellTarget(cell);
|
|
6306
6334
|
if (!target) return "Filter options";
|
|
6307
|
-
const
|
|
6308
|
-
return `Filter options for ${target.column.header}: ${
|
|
6335
|
+
const value = target.isList ? target.values.map(valueLabel).join(", ") : valueLabel(target.values[0] ?? null);
|
|
6336
|
+
return `Filter options for ${target.column.header}: ${value}`;
|
|
6309
6337
|
}
|
|
6310
6338
|
function modifiedCellClick(event) {
|
|
6311
6339
|
if (!cellActionsOn) return null;
|
|
@@ -6328,6 +6356,14 @@ function DataGrid(props) {
|
|
|
6328
6356
|
event.stopPropagation();
|
|
6329
6357
|
const [value = null] = click.hit.values;
|
|
6330
6358
|
runFilterAction(click.hit.column, value, click.action, event.shiftKey);
|
|
6359
|
+
const row = click.hit.row;
|
|
6360
|
+
if (row?.hasAttribute("tabindex")) {
|
|
6361
|
+
if (multiSelect || isFocusOnly) setMultiFocusIndex(Number(row.dataset.rowIndex));
|
|
6362
|
+
focusWith(row, {
|
|
6363
|
+
focusVisible: false,
|
|
6364
|
+
preventScroll: true
|
|
6365
|
+
});
|
|
6366
|
+
}
|
|
6331
6367
|
}
|
|
6332
6368
|
function handleCellMouseDownCapture(event) {
|
|
6333
6369
|
if (modifiedCellClick(event)) event.preventDefault();
|
|
@@ -6475,7 +6511,15 @@ function DataGrid(props) {
|
|
|
6475
6511
|
}
|
|
6476
6512
|
}
|
|
6477
6513
|
function handleGridKeyDown(event) {
|
|
6514
|
+
if (event.target instanceof Node && !event.currentTarget.contains(event.target)) return;
|
|
6478
6515
|
const isModified = event.ctrlKey || event.metaKey;
|
|
6516
|
+
if (cellActionsOn && isModified && "Enter" === event.key && null !== pendingTokens) {
|
|
6517
|
+
event.preventDefault();
|
|
6518
|
+
queryBarApiRef.current?.edit((pending)=>pending, {
|
|
6519
|
+
apply: true
|
|
6520
|
+
});
|
|
6521
|
+
return;
|
|
6522
|
+
}
|
|
6479
6523
|
if (cellActionsOn && "F10" === event.key && event.shiftKey) {
|
|
6480
6524
|
const target = event.target;
|
|
6481
6525
|
if (target instanceof HTMLElement && target.matches('[role="row"][data-row-index]')) {
|
|
@@ -6546,6 +6590,12 @@ function DataGrid(props) {
|
|
|
6546
6590
|
setOpenRowId(selectedRowId);
|
|
6547
6591
|
return;
|
|
6548
6592
|
}
|
|
6593
|
+
const focusedRow = event.target instanceof HTMLElement && event.target.matches('[role="row"][data-row-index]') ? Number(event.target.dataset.rowIndex) : -1;
|
|
6594
|
+
if (-1 === selectedIndexRef.current && focusedRow > 0 && ("ArrowDown" === event.key || "ArrowUp" === event.key)) {
|
|
6595
|
+
event.preventDefault();
|
|
6596
|
+
focusRowAt(focusedRow);
|
|
6597
|
+
return;
|
|
6598
|
+
}
|
|
6549
6599
|
const currentIndex = selectedIndexRef.current;
|
|
6550
6600
|
const to = navigationTarget(event, -1 === currentIndex ? -1 : currentIndex);
|
|
6551
6601
|
if (null === to) return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ox0/data-grid",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/esturcke/ox0-platform.git",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@tanstack/react-virtual": "^3.14.13",
|
|
25
25
|
"zustand": "^5.0.0",
|
|
26
|
-
"@ox0/hooks": "0.4.0",
|
|
27
26
|
"@ox0/query": "0.7.0",
|
|
28
27
|
"@ox0/tokens": "0.8.0",
|
|
29
|
-
"@ox0/
|
|
28
|
+
"@ox0/hooks": "0.4.0",
|
|
29
|
+
"@ox0/ui": "3.17.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"react": "^19.0.0",
|