@rozie-ui/data-table-solid 0.2.6 → 0.3.2
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/README.md +3 -2
- package/dist/index.cjs +696 -255
- package/dist/index.d.cts +7 -3
- package/dist/index.d.mts +7 -3
- package/dist/index.mjs +696 -255
- package/package.json +2 -2
- package/src/DataTable.tsx +1320 -418
- package/src/helpers/columnDefUtils.ts +111 -0
- package/src/helpers/indexMath.ts +25 -0
- package/src/helpers/rowValueUtils.ts +62 -0
- package/src/helpers/tsvGrid.ts +115 -0
package/src/DataTable.tsx
CHANGED
|
@@ -3,6 +3,10 @@ import { Show, createEffect, createSignal, mergeProps, on, onCleanup, onMount, s
|
|
|
3
3
|
import { Key } from '@solid-primitives/keyed';
|
|
4
4
|
import { __rozieInjectStyle, createControllableSignal, parseInlineStyle, rozieAttr, rozieClass, rozieContext, rozieDisplay } from '@rozie/runtime-solid';
|
|
5
5
|
import Popover from '@rozie-ui/popover-solid';
|
|
6
|
+
import { isSafeKey, wrapAggregationFn, indexDefsById, collectGroupableLeafDefs } from './helpers/columnDefUtils';
|
|
7
|
+
import { applyUpdater, clamp, focusables } from './helpers/indexMath';
|
|
8
|
+
import { escapeTsvField, parseTsv, tileGridToBox, tileIndex } from './helpers/tsvGrid';
|
|
9
|
+
import { replaceRowValue, indexOfRowIn, replaceRowValues } from './helpers/rowValueUtils';
|
|
6
10
|
import { createTable, getCoreRowModel, getSortedRowModel, getFilteredRowModel, getPaginationRowModel, getExpandedRowModel, getGroupedRowModel,
|
|
7
11
|
// Faceted filtering (phase 50 reqs 8-9, D-03). All three are supplied UNCONDITIONALLY
|
|
8
12
|
// (mirrors the expand/group models) — inert until a consumer READS a column facet via the
|
|
@@ -37,6 +41,13 @@ __rozieInjectStyle('DataTable-d5dcab4c', `.rozie-data-table[data-rozie-s-d5dcab4
|
|
|
37
41
|
font: var(--rdt-font, 14px system-ui, sans-serif);
|
|
38
42
|
color: var(--rdt-color, inherit);
|
|
39
43
|
}
|
|
44
|
+
.rozie-data-table.rdt-col-windowed[data-rozie-s-d5dcab4c] {
|
|
45
|
+
table-layout: fixed;
|
|
46
|
+
}
|
|
47
|
+
.rozie-data-table.rdt-col-windowed[data-rozie-s-d5dcab4c] .rdt-th[data-rozie-s-d5dcab4c],
|
|
48
|
+
.rozie-data-table.rdt-col-windowed[data-rozie-s-d5dcab4c] .rdt-td[data-rozie-s-d5dcab4c] {
|
|
49
|
+
box-sizing: border-box;
|
|
50
|
+
}
|
|
40
51
|
.rdt-sr-live[data-rozie-s-d5dcab4c] {
|
|
41
52
|
position: absolute;
|
|
42
53
|
width: 1px;
|
|
@@ -482,13 +493,17 @@ interface DataTableProps {
|
|
|
482
493
|
*/
|
|
483
494
|
undoLimit?: number;
|
|
484
495
|
/**
|
|
485
|
-
* Opt-in vertical
|
|
496
|
+
* Opt-in windowing grammar: `false` (default, off — byte-identical to a non-virtual table) | `true` or `'rows'` (vertical row windowing; `true` is byte-behavior-identical to every existing consumer, zero churn) | `'columns'` (horizontal column windowing) | `'both'` (both axes windowed). Row windowing renders only the visible slice of rows inside a bounded `rdt-scroll` container (with leading/trailing spacer rows preserving total scroll height), windowing over the full filtered + sorted (pre-pagination) model and suppressing the client pagination chrome. Column windowing renders only the visible slice of leaf columns inside the same `rdt-scroll` container. An unrecognised string behaves as `false`.
|
|
486
497
|
*/
|
|
487
|
-
virtual?: boolean;
|
|
498
|
+
virtual?: boolean | string;
|
|
488
499
|
/**
|
|
489
|
-
* Estimated row height (px)
|
|
500
|
+
* Estimated row height (px) — the first-paint seed for the windowing engine before any row has been measured. Only consulted when rows are windowed. When `autoMeasure` is `true`, later renders progressively refine the estimate from measured content; when `autoMeasure` is `false` this remains the explicit override for every render.
|
|
490
501
|
*/
|
|
491
502
|
estimateRowHeight?: number;
|
|
503
|
+
/**
|
|
504
|
+
* Opt-in content-driven row-size estimation. When `true`, the windowing engine feeds `estimateSize()` a running mean of measured row heights instead of the fixed `estimateRowHeight` seed, so `getTotalSize()` converges to the true content total on a large table with variable-height rows. Falls back to `estimateRowHeight` before any row has been measured. Default `false` keeps the estimate fixed at `estimateRowHeight` for every render (today's behavior).
|
|
505
|
+
*/
|
|
506
|
+
autoMeasure?: boolean;
|
|
492
507
|
/**
|
|
493
508
|
* A CSS length string bounding the `rdt-scroll` container when `virtual` is on (e.g. `'400px'`). Mirrored to the `--rozie-data-table-max-height` custom property; the prop wins, the token is the fallback.
|
|
494
509
|
*/
|
|
@@ -560,8 +575,8 @@ export interface DataTableHandle {
|
|
|
560
575
|
}
|
|
561
576
|
|
|
562
577
|
export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
563
|
-
const _merged = mergeProps({ columns: (() => [])() as any[], selectionMode: 'none', manual: false, rowCount: null, pageCount: null, expandable: false, getSubRows: null, groupable: false, stickyHeader: false, interactionMode: 'table', singleClickEdit: false, undoable: false, undoLimit: 100, virtual: false, estimateRowHeight: 40, maxHeight: '' }, _props);
|
|
564
|
-
const [local, attrs] = splitProps(_merged, ['data', 'columns', 'selectionMode', 'sorting', 'globalFilter', 'columnFilters', 'pagination', 'manual', 'rowCount', 'pageCount', 'expandable', 'expanded', 'getSubRows', 'groupable', 'grouping', 'rowSelection', 'columnVisibility', 'columnSizing', 'columnOrder', 'columnPinning', 'stickyHeader', 'interactionMode', 'singleClickEdit', 'undoable', 'undoLimit', 'virtual', 'estimateRowHeight', 'maxHeight', 'children', 'ref', 'onSortChange', 'onExpandChange', 'onGroupChange', 'onFilterChange', 'onPageChange', 'onSelectionChange', 'onVisibilityChange', 'onResizeChange', 'onReorderChange', 'onPinChange', 'onHistoryChange', 'onActivecellChange', 'onRangeChange', 'onCellEditCommit', 'onRowEditCommit']);
|
|
578
|
+
const _merged = mergeProps({ columns: (() => [])() as any[], selectionMode: 'none', manual: false, rowCount: null, pageCount: null, expandable: false, getSubRows: null, groupable: false, stickyHeader: false, interactionMode: 'table', singleClickEdit: false, undoable: false, undoLimit: 100, virtual: false, estimateRowHeight: 40, autoMeasure: false, maxHeight: '' }, _props);
|
|
579
|
+
const [local, attrs] = splitProps(_merged, ['data', 'columns', 'selectionMode', 'sorting', 'globalFilter', 'columnFilters', 'pagination', 'manual', 'rowCount', 'pageCount', 'expandable', 'expanded', 'getSubRows', 'groupable', 'grouping', 'rowSelection', 'columnVisibility', 'columnSizing', 'columnOrder', 'columnPinning', 'stickyHeader', 'interactionMode', 'singleClickEdit', 'undoable', 'undoLimit', 'virtual', 'estimateRowHeight', 'autoMeasure', 'maxHeight', 'children', 'ref', 'onSortChange', 'onExpandChange', 'onGroupChange', 'onFilterChange', 'onPageChange', 'onSelectionChange', 'onVisibilityChange', 'onResizeChange', 'onReorderChange', 'onPinChange', 'onHistoryChange', 'onActivecellChange', 'onRangeChange', 'onCellEditCommit', 'onRowEditCommit']);
|
|
565
580
|
const resolved = () => local.children;
|
|
566
581
|
onMount(() => { local.ref?.({ sortColumn, clearSorting, toggleRowExpanded, expandAll, collapseAll, getExpandedRows, applyGrouping, clearGrouping, getFacetedUniqueValues, getFacetedMinMaxValues, getColumnDefs, toggleAllRows, clearSelection, getSelectedRows, setPage, setRowsPerPage, toggleColumnVisibility, applyColumnOrder, resetColumnSizing, pinColumn, focusCell, getActiveCell, clearActiveCell, getRowIndexRelativeToPage, editCell, commitEditing, editRow, getSelectedRange, cut, undo, redo, canUndo, canRedo, clearHistory }); });
|
|
567
582
|
|
|
@@ -751,10 +766,15 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
751
766
|
// into the virtualizer + reconcile IMPERATIVELY here (the table.setOptions re-feed path),
|
|
752
767
|
// NEVER in a render helper (Pitfall 1). Pass the COMPLETE options set (virtual-core's
|
|
753
768
|
// setOptions replaces, not merges). Guarded so the off path executes no virtual-core code.
|
|
754
|
-
if (
|
|
769
|
+
if (rowsWindowed() && virtualizer) {
|
|
755
770
|
virtualizer.setOptions(virtualizerOptions());
|
|
756
771
|
virtualizer._willUpdate();
|
|
757
772
|
}
|
|
773
|
+
// Phase 87 87-04: re-feed the column virtualizer's count/size on the SAME re-derive cycle
|
|
774
|
+
// (a column-visibility/order/pinning change is already in the $watch list below and re-pulls
|
|
775
|
+
// through here) — guarded internally on colsWindowed() && colVirtualizer, so this is a no-op
|
|
776
|
+
// on every other path.
|
|
777
|
+
remeasureColumnWindow();
|
|
758
778
|
// D-05: on every data change (re-sort/filter/paginate/page-size — all re-pull here),
|
|
759
779
|
// clamp the active cell to the new bounds (same indices, clamped if the grid shrank;
|
|
760
780
|
// no row-id following, no top-bounce). isGrid()-gated so 'table' mode is untouched.
|
|
@@ -823,49 +843,91 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
823
843
|
// cell IS the first Tab-in target (matching the Wave-0 probe's "no auto-focus on
|
|
824
844
|
// mount"); the consumer drives focus by Tabbing/clicking in, never the component.
|
|
825
845
|
|
|
826
|
-
// ──
|
|
827
|
-
//
|
|
828
|
-
//
|
|
829
|
-
//
|
|
830
|
-
// the
|
|
831
|
-
|
|
846
|
+
// ── Windowing: capture the scroll element + construct the row virtualizer (req-1/2 — the
|
|
847
|
+
// row virtual-core instance ONLY when rows are windowed; the scroll-element capture whenever
|
|
848
|
+
// EITHER axis is windowed, since both axes observe the SAME .rdt-scroll element — D-03). Built
|
|
849
|
+
// HERE (post-mount) so getScrollElement resolves the rendered .rdt-scroll div and
|
|
850
|
+
// getPrePaginationRowModel reads the live table. ENTIRELY inside the isWindowed()/rowsWindowed()
|
|
851
|
+
// guards: when both axes are off, NO virtual-core runtime code executes (byte-identical-off).
|
|
852
|
+
// _didMount() registers the scroll-element ResizeObserver and returns the teardown stored for
|
|
853
|
+
// $onUnmount.
|
|
854
|
+
if (isWindowed()) {
|
|
832
855
|
gridScrollEl = __rozieRootRef! ? __rozieRootRef!.querySelector('.rdt-scroll') : null;
|
|
856
|
+
}
|
|
857
|
+
if (rowsWindowed()) {
|
|
833
858
|
virtualizer = new Virtualizer(virtualizerOptions());
|
|
834
859
|
virtualizerCleanup = virtualizer._didMount();
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
860
|
+
}
|
|
861
|
+
// Phase 87 87-04: construct the SECOND, horizontal Virtualizer instance when the COLUMN
|
|
862
|
+
// axis is windowed — entirely inside its own colsWindowed() guard, byte-identical-off for
|
|
863
|
+
// 'rows'/true/false.
|
|
864
|
+
if (colsWindowed()) {
|
|
865
|
+
colVirtualizer = new Virtualizer(columnVirtualizerOptions());
|
|
866
|
+
colVirtualizerCleanup = colVirtualizer._didMount();
|
|
867
|
+
}
|
|
868
|
+
// FINE-GRAINED FIRST-WINDOW KICK (Solid/Svelte), either axis: the windowed <For>/{#each}
|
|
869
|
+
// accessor was first evaluated at initial render — while `virtualizer`/`colVirtualizer` were
|
|
870
|
+
// still null — and (because windowedRows()/windowedColIndices() read $data.windowVer up top)
|
|
871
|
+
// subscribed to windowVer then returned []/the full set. Both `let`s are non-reactive, so
|
|
872
|
+
// their assignment above does NOT notify the accessor; we must bump the SIGNAL it subscribed
|
|
873
|
+
// to. _didMount() computes the first window synchronously but its onChange only fires on
|
|
874
|
+
// SUBSEQUENT scroll/resize, so without this explicit bump the first window would never paint
|
|
875
|
+
// on the fine-grained targets. Idempotent + harmless on the coarse targets (they re-render
|
|
876
|
+
// wholesale anyway). ONE bump here (not one per axis, Rule 1 — see the ROZ138 note below)
|
|
877
|
+
// covers both: windowedRows()/windowedColIndices() each simply re-derive against their own
|
|
878
|
+
// now-non-null virtualizer instance off the SAME counter (87-02 checkpoint decision (b): no
|
|
879
|
+
// separate $data.colWindowVer). Gated on isWindowed() (either axis) rather than two separate
|
|
880
|
+
// per-axis bumps: a second `$data.windowVer = $data.windowVer + 1` write later in this SAME
|
|
881
|
+
// $onMount body would dominate-flag ROZ138 (React stale-read) on its own right-hand-side read
|
|
882
|
+
// of the counter it had just written a few lines above — a false positive (this increment
|
|
883
|
+
// idiom lowers to a functional React setState update and is safe regardless of ordering, the
|
|
884
|
+
// same reasoning virtualizerOptions()'s onChange documents), but collapsing to one bump avoids
|
|
885
|
+
// manufacturing the false-positive warning at all rather than accepting it.
|
|
886
|
+
if (isWindowed()) {
|
|
844
887
|
setWindowVer(windowVer() + 1);
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
888
|
+
}
|
|
889
|
+
// After the first window commits (next frame), refine heights + fire the dev-mode warns ONCE.
|
|
890
|
+
// Entirely inside the isWindowed() guard so the off (neither axis windowed) emitted path adds
|
|
891
|
+
// NO code and these warns can never fire there (req-1 byte-identical-off preserved). The
|
|
892
|
+
// row-specific measurement + warns stay further guarded by rowsWindowed() (byte-identical to
|
|
893
|
+
// before this restructure); the column-axis warn (Phase 87 D-07(a)) is guarded by
|
|
894
|
+
// colsWindowed() so it can fire ONLY on the 'columns'/'both' path, never on 'rows'/true/false.
|
|
895
|
+
if (isWindowed()) {
|
|
848
896
|
const afterFirstFrame = () => {
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
897
|
+
if (rowsWindowed()) {
|
|
898
|
+
// D-10: measure the rendered rows.
|
|
899
|
+
remeasureWindow();
|
|
900
|
+
// D-08/A1: a dev-mode runtime warn when the scroll container has no bounded height (the
|
|
901
|
+
// bound may come from consumer CSS the compiler can't see — no compile diagnostic). No
|
|
902
|
+
// process.env guard (not bundler-portable); always-warn-on-misconfig is acceptable.
|
|
903
|
+
const h = gridScrollEl ? gridScrollEl.clientHeight : 0;
|
|
904
|
+
if (!h) {
|
|
905
|
+
console.warn('[rozie-data-table] virtual is on but the scroll container has no bounded height; set maxHeight or --rozie-data-table-max-height');
|
|
906
|
+
}
|
|
907
|
+
// D-07 (RESOLVED — runtime warn, not a compile diagnostic): warn ONCE when the consumer
|
|
908
|
+
// CONFIGURED client pagination alongside virtual, in the non-manual case (the valid
|
|
909
|
+
// virtual+manual combo per D-09 is silent). The pagination prop carries a non-null default
|
|
910
|
+
// ({ pageIndex: 0, pageSize: 10 }) so it is never strictly null — "configured" is therefore
|
|
911
|
+
// detected as a pagination that DIFFERS from that default (a consumer who set a real page
|
|
912
|
+
// size / index). The uncontrolled default ({0,10}) does NOT trip the warn. Behavior + the
|
|
913
|
+
// virtual=false path are untouched (rowsWindowed()-guarded, as before this restructure).
|
|
914
|
+
const pg = pagination();
|
|
915
|
+
const pgConfigured = pg != null && !(pg.pageIndex === 0 && pg.pageSize === 10);
|
|
916
|
+
if (local.manual !== true && pgConfigured) {
|
|
917
|
+
console.warn('[rozie-data-table] virtual+pagination: client pagination is configured but virtual windowing replaces it — the pagination chrome is auto-suppressed. Remove the pagination prop or set manual to silence this.');
|
|
918
|
+
}
|
|
857
919
|
}
|
|
858
|
-
// D-07
|
|
859
|
-
//
|
|
860
|
-
//
|
|
861
|
-
//
|
|
862
|
-
//
|
|
863
|
-
//
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
920
|
+
// Phase 87 Task 1(a) (D-07/D-08 precedent, APPROVED): a dev-mode runtime warn when the
|
|
921
|
+
// column axis is windowed but the scroll container has no bounded width — the horizontal
|
|
922
|
+
// failure mode is worse than the vertical one (an unbounded width renders every column
|
|
923
|
+
// with no scrollbar, so the feature silently does nothing and there is no compile
|
|
924
|
+
// diagnostic possible, since the bound may come from consumer CSS). Guarded by
|
|
925
|
+
// colsWindowed() so it can NEVER fire on the 'rows'/true/false path.
|
|
926
|
+
if (colsWindowed()) {
|
|
927
|
+
const w = gridScrollEl ? gridScrollEl.clientWidth : 0;
|
|
928
|
+
if (!w) {
|
|
929
|
+
console.warn('[rozie-data-table] virtual is on for columns but the scroll container has no bounded width; set a CSS width on an ancestor so the column window can be measured');
|
|
930
|
+
}
|
|
869
931
|
}
|
|
870
932
|
};
|
|
871
933
|
if (typeof requestAnimationFrame === 'function') requestAnimationFrame(() => requestAnimationFrame(afterFirstFrame));else setTimeout(afterFirstFrame, 0);
|
|
@@ -880,6 +942,17 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
880
942
|
});
|
|
881
943
|
onCleanup(() => {
|
|
882
944
|
if (virtualizerCleanup) virtualizerCleanup();
|
|
945
|
+
// Phase 87 87-04: tear down the column virtualizer's scroll-element ResizeObserver too.
|
|
946
|
+
// No-op when column windowing was off (cleanup stays null).
|
|
947
|
+
if (colVirtualizerCleanup) colVirtualizerCleanup();
|
|
948
|
+
// Gap-closure 87-09: disconnect the RTL dir-attribute MutationObserver (ensureColRtlWatch(),
|
|
949
|
+
// windowing.rzts). No-op if column windowing was never on (the observer was never attached).
|
|
950
|
+
teardownColRtlWatch();
|
|
951
|
+
// Gap-closure 87-13 (CR-01): cancel a deferred remeasure sweep still pending at unmount.
|
|
952
|
+
// Must run here — remeasureWindow()'s `!virtualizer || !gridRoot` guard never fires, since
|
|
953
|
+
// neither ref is nulled — or the pass reaches 87-07's refineRowEstimate() and writes
|
|
954
|
+
// $data.windowVer against a torn-down instance.
|
|
955
|
+
teardownRemeasure();
|
|
883
956
|
// CR-04: remove any live fill-drag document listeners if we unmount mid-drag.
|
|
884
957
|
teardownFillDrag();
|
|
885
958
|
// §6 (260709-3qt): remove any live drag-select document listeners on a mid-drag unmount.
|
|
@@ -938,6 +1011,13 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
938
1011
|
let virtualizer: any = null;
|
|
939
1012
|
let virtualizerCleanup: any = null;
|
|
940
1013
|
let gridScrollEl: any = null;
|
|
1014
|
+
// ── Horizontal (column-axis) windowing instance state (Phase 87 87-04) ─────────────────
|
|
1015
|
+
// The SECOND, independent virtual-core instance (AXIS MECHANISM, windowing.rzts): mutable
|
|
1016
|
+
// top-level `let`s (the `virtualizer` precedent above — React hoists to useRef). NULL until
|
|
1017
|
+
// $onMount, and ONLY constructed when colsWindowed(). Shares gridScrollEl (the SAME
|
|
1018
|
+
// .rdt-scroll element) with the row instance — D-03.
|
|
1019
|
+
let colVirtualizer: any = null;
|
|
1020
|
+
let colVirtualizerCleanup: any = null;
|
|
941
1021
|
// CR-01 remeasure scheduling state. remeasurePending dedupes the deferred sweep — at most ONE
|
|
942
1022
|
// rAF is in flight, so a burst of onChange ticks (a fast scroll) collapses to a single measure
|
|
943
1023
|
// pass per frame instead of piling up rAF callbacks that fire mid-gesture. The piled-up
|
|
@@ -948,6 +1028,17 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
948
1028
|
// onChange re-measures the now-stable window. Scroll-driven recycling (the CR-01 case, measured
|
|
949
1029
|
// once motion settles between scroll steps) is unaffected.
|
|
950
1030
|
let remeasurePending = false;
|
|
1031
|
+
// Gap-closure 87-13: the deferred sweep's own rAF handle, plus a disposed latch. Until 87-07 a
|
|
1032
|
+
// post-unmount sweep was inert — it re-measured a detached tree and wrote nothing. 87-07's D-15
|
|
1033
|
+
// re-feed changed that: remeasureWindow() now reaches refineRowEstimate(), which calls
|
|
1034
|
+
// virtualizer.setOptions()/_willUpdate(), mutates gridScrollEl.scrollTop, and WRITES
|
|
1035
|
+
// $data.windowVer. remeasureWindow()'s existing `!virtualizer || !gridRoot` guard cannot catch
|
|
1036
|
+
// this — neither ref is ever nulled after $onMount assigns it — so a scroll/resize burst that
|
|
1037
|
+
// leaves a pass pending across unmount (a route transition mid-scroll) lands a state write on a
|
|
1038
|
+
// torn-down instance. Handle init is `null`, never 0: an Angular leaf types this as the DOM
|
|
1039
|
+
// handle and TS2322s on a numeric seed.
|
|
1040
|
+
let remeasureRaf: any = null;
|
|
1041
|
+
let remeasureDisposed = false;
|
|
951
1042
|
|
|
952
1043
|
// ── Grid interaction-mode constants + DOM root (phase 49, REQ-2/6) ────────────────────
|
|
953
1044
|
// Fixed PageUp/PageDown row step (D-06). Phase 53 swaps this for the visible-window size
|
|
@@ -1109,35 +1200,6 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
1109
1200
|
function currentData(): any {
|
|
1110
1201
|
return data() != null ? data() : dataDefault();
|
|
1111
1202
|
}
|
|
1112
|
-
|
|
1113
|
-
// Prototype-safe id-keyed column resolution (T-48-PP): the `:columns` config array is
|
|
1114
|
-
// applied FIRST (lower precedence), then the <Column> registry OVERRIDES by id (LWW).
|
|
1115
|
-
// byId is a null-prototype object so a consumer column id of "__proto__"/"constructor"
|
|
1116
|
-
// cannot pollute Object.prototype. Returns the table-core ColumnDef[]. (No per-column
|
|
1117
|
-
// render callbacks — cells render via the single #cell/#header scoped slot on this
|
|
1118
|
-
// component, dispatched by columnId; <Column> carries metadata only.)
|
|
1119
|
-
function isSafeKey(k: any) {
|
|
1120
|
-
return k !== '__proto__' && k !== 'constructor' && k !== 'prototype';
|
|
1121
|
-
}
|
|
1122
|
-
// wrapAggregationFn (phase 50 req-5, D-05, threat T-50-04): resolve a per-column
|
|
1123
|
-
// aggregationFn straight onto the ColumnDef (no component-side switch — RESEARCH
|
|
1124
|
-
// anti-pattern). A built-in NAME string ('sum'/'min'/'max'/'extent'/'mean'/'median'/
|
|
1125
|
-
// 'unique'/'uniqueCount'/'count') passes through verbatim — table-core resolves it from its
|
|
1126
|
-
// built-in `aggregationFns` map. A CUSTOM function `(columnId, leafRows, childRows) => any`
|
|
1127
|
-
// is DEFENSIVELY WRAPPED (the runValidator precedent): a consumer fn runs per group, so a
|
|
1128
|
-
// throw is coerced to `undefined` and can never crash getGroupedRowModel (DoS guard).
|
|
1129
|
-
// Anything else → undefined (no aggregation; the cell renders as a placeholder).
|
|
1130
|
-
function wrapAggregationFn(fn: any) {
|
|
1131
|
-
if (typeof fn === 'string') return fn;
|
|
1132
|
-
if (typeof fn !== 'function') return undefined;
|
|
1133
|
-
return (columnId: any, leafRows: any, childRows: any) => {
|
|
1134
|
-
try {
|
|
1135
|
-
return fn(columnId, leafRows, childRows);
|
|
1136
|
-
} catch (err: any) {
|
|
1137
|
-
return undefined;
|
|
1138
|
-
}
|
|
1139
|
-
};
|
|
1140
|
-
}
|
|
1141
1203
|
// Build the table-core ColumnDef for ONE config-array entry. A LEAF entry
|
|
1142
1204
|
// ({ id?, field, header?, … }) maps to an accessor ColumnDef; a GROUP entry
|
|
1143
1205
|
// ({ id?, header, columns: [...] }) maps to a multi-level header GROUP column
|
|
@@ -1208,10 +1270,54 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
1208
1270
|
}
|
|
1209
1271
|
};
|
|
1210
1272
|
}
|
|
1273
|
+
// ══ D-23 (gap-closure, Phase 87 follow-up) — columnDefs() memoization ═══════════════════
|
|
1274
|
+
// ROOT CAUSE (confirmed via CPU profiling the D-13 [vue] fill-drag auto-scroll failure):
|
|
1275
|
+
// defFor(colId) (columnChrome.rzts) — the sole resolver behind editMetaOf/columnEditable/
|
|
1276
|
+
// editorTypeOf/isEditing, all called PER CELL, PER RENDER (isEditing's own header comment:
|
|
1277
|
+
// "Called per-cell in both <td> bodies") — called columnDefs() with ZERO caching. columnDefs()
|
|
1278
|
+
// rebuilds the FULL column-def array (buildConfigDef for every entry in $props.columns,
|
|
1279
|
+
// including recursive group traversal) from scratch on every single invocation. With N
|
|
1280
|
+
// columns and M rendered rows that is an O(N x M x N) = O(N^2 x M) cost PER RENDER COMMIT —
|
|
1281
|
+
// on this plan's 60-column fixture, up to ~1200 cells x 60 rebuilt defs = ~72,000
|
|
1282
|
+
// buildConfigDef calls per commit, repeated on every windowVer-driven re-render during a
|
|
1283
|
+
// sustained scroll gesture (the fill-drag edge-auto-scroll rAF loop bumps windowVer on
|
|
1284
|
+
// every frame). A CPU profile of the failing case showed buildConfigDef consuming ~39% of
|
|
1285
|
+
// ALL wall-clock time during the gesture, with a FURTHER ~27% in Vue's own reactive-Proxy
|
|
1286
|
+
// `get` trap — $props.columns/$data.colReg are reactive on Vue, so every one of the
|
|
1287
|
+
// ~15 property reads buildConfigDef performs per column pays Vue's track()/Reflect.get
|
|
1288
|
+
// overhead, an expense React's plain (non-Proxy) props do not pay. The SAME O(N^2 x M)
|
|
1289
|
+
// algorithmic cost exists on all six targets (this is shared-engine code, dissolved
|
|
1290
|
+
// identically everywhere) — Vue's per-access reactivity overhead is what tips an already
|
|
1291
|
+
// wasteful recompute over the fixed real-time budget used by this test's rAF-driven
|
|
1292
|
+
// auto-scroll hold, not a Vue-specific logic defect. Fixing the recompute (not the timing)
|
|
1293
|
+
// removes the accidental n^2 blowup for every target, and Vue-specifically restores enough
|
|
1294
|
+
// per-frame headroom to keep pace with the auto-scroll loop.
|
|
1295
|
+
//
|
|
1296
|
+
// FIX: cache the resolved array, keyed on the REFERENCE identity of $props.columns and
|
|
1297
|
+
// $data.colReg — the exact two dependencies the reFeed() $watch (DataTable.rozie) already
|
|
1298
|
+
// treats as "changed only when the reference changes" (columns is consumer-memoized like
|
|
1299
|
+
// $props.data/$props.sorting; colReg is reassigned via `{ ...colReg, [key]: spec }` on every
|
|
1300
|
+
// real mutation, NEVER written in place — see DataTable.rozie's own colReg-mutation comment).
|
|
1301
|
+
// A cache hit is an O(1) reference-equality check; a cache miss re-runs the exact same
|
|
1302
|
+
// computation as before (byte-identical output either way — this is a pure memoization, not
|
|
1303
|
+
// a behavior change).
|
|
1304
|
+
let columnDefsCache: any[] | null = null;
|
|
1305
|
+
let columnDefsCacheColumnsRef: any = undefined;
|
|
1306
|
+
let columnDefsCacheColRegRef: any = undefined;
|
|
1307
|
+
// B1 (quick 260906-afh) — the def-lookup index, populated INSIDE this SAME memo block on
|
|
1308
|
+
// a cache MISS only (never rebuilt per call — a per-call recursive scan would restore the
|
|
1309
|
+
// O(N^2 x M) blowup D-23 removed, T-AFH-03). A top-level `let` lowers to a per-instance
|
|
1310
|
+
// `useRef` on React (verified in the emitted leaf), so this is instance-scoped like
|
|
1311
|
+
// columnDefsCache above.
|
|
1312
|
+
let columnDefsIndexCache: any = null;
|
|
1211
1313
|
function columnDefs() {
|
|
1314
|
+
const cfg = local.columns || [];
|
|
1315
|
+
const reg = colReg() || {};
|
|
1316
|
+
if (columnDefsCache && local.columns === columnDefsCacheColumnsRef && colReg() === columnDefsCacheColRegRef) {
|
|
1317
|
+
return columnDefsCache;
|
|
1318
|
+
}
|
|
1212
1319
|
const byId = Object.create(null);
|
|
1213
1320
|
const order = [];
|
|
1214
|
-
const cfg = local.columns || [];
|
|
1215
1321
|
for (const c of cfg as any) {
|
|
1216
1322
|
const def = buildConfigDef(c);
|
|
1217
1323
|
if (!def) continue;
|
|
@@ -1219,7 +1325,6 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
1219
1325
|
if (!(id in byId)) order.push(id);
|
|
1220
1326
|
byId[id] = def;
|
|
1221
1327
|
}
|
|
1222
|
-
const reg = colReg() || {};
|
|
1223
1328
|
for (const id in reg) {
|
|
1224
1329
|
if (!isSafeKey(id)) continue;
|
|
1225
1330
|
const spec = reg[id];
|
|
@@ -1250,9 +1355,23 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
1250
1355
|
}
|
|
1251
1356
|
const out = [];
|
|
1252
1357
|
for (const id of order as any) if (byId[id]) out.push(byId[id]);
|
|
1358
|
+
columnDefsCache = out;
|
|
1359
|
+
columnDefsCacheColumnsRef = local.columns;
|
|
1360
|
+
columnDefsCacheColRegRef = colReg();
|
|
1361
|
+
columnDefsIndexCache = indexDefsById(out);
|
|
1253
1362
|
return out;
|
|
1254
1363
|
}
|
|
1255
1364
|
|
|
1365
|
+
// defIndex: the def-lookup map for the CURRENT columnDefs() array. Calling columnDefs()
|
|
1366
|
+
// first is deliberate — either an O(1) reference-equality cache hit (columnDefsIndexCache
|
|
1367
|
+
// is already fresh) or a miss that repopulates BOTH slots together, so the index can never
|
|
1368
|
+
// go stale relative to the array. Falls back to an empty null-prototype map (never null/
|
|
1369
|
+
// undefined) so a caller can read it unconditionally.
|
|
1370
|
+
function defIndex() {
|
|
1371
|
+
columnDefs();
|
|
1372
|
+
return columnDefsIndexCache || Object.create(null);
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1256
1375
|
// The constant id of the auto-injected leading checkbox column (D-04). Distinct from
|
|
1257
1376
|
// any consumer column id (the registry/config guard never produces a leading "__").
|
|
1258
1377
|
const SELECT_COL_ID = '__rdt_select';
|
|
@@ -1334,9 +1453,6 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
1334
1453
|
_props.onSortChange?.(next);
|
|
1335
1454
|
programmatic--;
|
|
1336
1455
|
}
|
|
1337
|
-
function applyUpdater(updater: any, current: any) {
|
|
1338
|
-
return typeof updater === 'function' ? updater(current) : updater;
|
|
1339
|
-
}
|
|
1340
1456
|
|
|
1341
1457
|
// ── expanded slice: STATIC-KEY fresh-value echo-guarded write funnel (A4) ──────────
|
|
1342
1458
|
// table-core hands an Updater<ExpandedState> = value | (old)=>new; onExpandedChange
|
|
@@ -1732,13 +1848,159 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
1732
1848
|
// windowSource() (the row source), pinnedEditIndex()/pinnedMeasurement() (the D-05 pin hook),
|
|
1733
1849
|
// scheduleRemeasure(), and the gridScrollEl/virtualizer/virtual-core-fn references.
|
|
1734
1850
|
|
|
1851
|
+
// ══ D-05 predicate layer (Phase 87 87-02) — resolves the windowing prop into an axis state,
|
|
1852
|
+
// replacing every bare truthiness read of $props.virtual (which is unsafe once the prop widens
|
|
1853
|
+
// to a string grammar in 87-03: 'columns' is truthy but does NOT mean "windows rows"). Modeled on
|
|
1854
|
+
// resolveAppendTo() in CommandPalette.rozie (the D-01 value-grammar precedent): branch on
|
|
1855
|
+
// typeof === 'string', switch on the known string values, fall back to the boolean cases. THIS
|
|
1856
|
+
// plan still declares `virtual: Boolean` (87-03 widens the declaration to [Boolean, String]), so
|
|
1857
|
+
// resolveVirtual() can currently only return 'off' or 'rows' and colsWindowed() is constantly
|
|
1858
|
+
// false — inert until 87-03/87-04 land the column axis.
|
|
1859
|
+
//
|
|
1860
|
+
// Declared BEFORE windowSource() (below): windowSource() calls rowsWindowed(), and the React
|
|
1861
|
+
// emitter lowers each of these to a useCallback whose dependency array is evaluated eagerly at
|
|
1862
|
+
// the declaration site — a forward reference here is a genuine TDZ (TS2448), not just a style
|
|
1863
|
+
// preference (found running the strict react typecheck gate this task, Rule 1).
|
|
1864
|
+
function resolveVirtual() {
|
|
1865
|
+
const v = local.virtual;
|
|
1866
|
+
if (typeof v === 'string') {
|
|
1867
|
+
if (v === 'rows') return 'rows';
|
|
1868
|
+
if (v === 'columns') return 'columns';
|
|
1869
|
+
if (v === 'both') return 'both';
|
|
1870
|
+
return 'off';
|
|
1871
|
+
}
|
|
1872
|
+
return v === true ? 'rows' : 'off';
|
|
1873
|
+
}
|
|
1874
|
+
// rowsWindowed(): the windowing.rzts host-contract symbol (D-05). Byte-behaviorally identical to
|
|
1875
|
+
// today's `$props.virtual` truthiness — this plan changes NO user-visible behavior.
|
|
1876
|
+
function rowsWindowed() {
|
|
1877
|
+
const s = resolveVirtual();
|
|
1878
|
+
return s === 'rows' || s === 'both';
|
|
1879
|
+
}
|
|
1880
|
+
function colsWindowed() {
|
|
1881
|
+
const s = resolveVirtual();
|
|
1882
|
+
return s === 'columns' || s === 'both';
|
|
1883
|
+
}
|
|
1884
|
+
function isWindowed() {
|
|
1885
|
+
return rowsWindowed() || colsWindowed();
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
// autoMeasureOn() (Phase 87 87-07, D-18): the windowing.rzts host-contract gate for the
|
|
1889
|
+
// running-mean row-size estimator. Real body here: $props.autoMeasure === true. listbox/
|
|
1890
|
+
// combobox define this as a permanent `() => false` one-liner (D-20) so estimateRowSize()'s
|
|
1891
|
+
// accumulator branch is dead code for them.
|
|
1892
|
+
function autoMeasureOn() {
|
|
1893
|
+
return local.autoMeasure === true;
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1896
|
+
// D-10 column-axis host-contract symbols. columnCount()/columnSize() got REAL bodies in
|
|
1897
|
+
// 87-04 (the tracer); forcedColumns() stays an empty-array stub until 87-05 gives it the
|
|
1898
|
+
// pinned + active-cell + editing-column union. Explicit return-type annotations (columnSize /
|
|
1899
|
+
// forcedColumns) copy the pinMeasurement() trick (windowing.rzts) so the strict bundled-leaf
|
|
1900
|
+
// tsc does not flow-narrow a no-op host's return to `never`.
|
|
1901
|
+
//
|
|
1902
|
+
// columnCount(): the leaf-column count the column virtualizer windows over — visibleColCount()
|
|
1903
|
+
// (gridFocusNav.rzts), the SAME index space colIndexOf()/data-col-index already address (D-08).
|
|
1904
|
+
function columnCount(): number {
|
|
1905
|
+
return visibleColCount();
|
|
1906
|
+
}
|
|
1907
|
+
// columnSize(i): the authoritative width of absolute leaf column i (D-06). Reads table-core's
|
|
1908
|
+
// OWN getVisibleLeafColumns() directly — NOT the host's allLeafColumns() wrapper
|
|
1909
|
+
// (columnChrome.rzts), which returns plain `{ id, label, visible }` POJOs with no getSize()
|
|
1910
|
+
// and also EXCLUDES the auto-injected chrome columns (select/expander), breaking the index
|
|
1911
|
+
// alignment with columnCount()/colIndexOf(). getVisibleLeafColumns() is the array
|
|
1912
|
+
// row.getVisibleCells() itself is built from, so its index space matches exactly. Falls back
|
|
1913
|
+
// to table-core's own default column width (150) when the index is out of range.
|
|
1914
|
+
function columnSize(i: number): number {
|
|
1915
|
+
if (!table || !table.getVisibleLeafColumns) return 150;
|
|
1916
|
+
const cols = table.getVisibleLeafColumns();
|
|
1917
|
+
const c = cols[i];
|
|
1918
|
+
return c && typeof c.getSize === 'function' ? c.getSize() : 150;
|
|
1919
|
+
}
|
|
1920
|
+
// forcedColumns() (Phase 87 87-05, D-10): the column-axis mirror of pinnedEditIndex()/
|
|
1921
|
+
// pinnedMeasurement() (the row axis's D-05 pin-extension hook) — unions pinned + active-cell +
|
|
1922
|
+
// editing column indices into the window slice so none of them ever recycle out from under the
|
|
1923
|
+
// user. Reads table.getVisibleLeafColumns() DIRECTLY (the SAME array columnCount()/columnSize()
|
|
1924
|
+
// index against, and the array row.getVisibleCells() is itself built from) — NOT
|
|
1925
|
+
// allLeafColumns() (columnChrome.rzts), which excludes the auto-injected chrome columns and
|
|
1926
|
+
// returns plain POJOs with no getSize(), breaking the index alignment (the exact columnSize()
|
|
1927
|
+
// Rule-1 fix from 87-04, mirrored here rather than repeated).
|
|
1928
|
+
//
|
|
1929
|
+
// The fill-handle corner is DELIBERATELY not forced (D-10 explicit) — no call to
|
|
1930
|
+
// isFillHandleCell here. The whole selected RANGE is not forced either: a range's moving
|
|
1931
|
+
// corner tracks into $data.activeColIndex (extendRange/setRangeFocus), so even a 200-column
|
|
1932
|
+
// range forces at most the ONE active-cell column via the branch below, never the full span —
|
|
1933
|
+
// forcing the whole range would defeat the feature precisely where it is most wanted (D-10).
|
|
1934
|
+
function forcedColumns(): number[] {
|
|
1935
|
+
if (!colsWindowed()) return [];
|
|
1936
|
+
const out = [];
|
|
1937
|
+
if (table && table.getVisibleLeafColumns) {
|
|
1938
|
+
const cols = table.getVisibleLeafColumns();
|
|
1939
|
+
for (let i = 0; i < cols.length; i++) {
|
|
1940
|
+
const c = cols[i];
|
|
1941
|
+
if (c && c.getIsPinned && c.getIsPinned()) out.push(i);
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
// Active cell's column (D-10): required or focusActiveCell()'s [data-col-index="N"]
|
|
1945
|
+
// querySelector cannot resolve for an off-window active cell. Body cells only — a header-
|
|
1946
|
+
// active cell has no column-axis rendering dependency here (headers window separately).
|
|
1947
|
+
if (!activeIsHeader() && activeColIndex() >= 0 && out.indexOf(activeColIndex()) === -1) {
|
|
1948
|
+
out.push(activeColIndex());
|
|
1949
|
+
}
|
|
1950
|
+
// Editing column (D-10): required or an open editor unmounts mid-keystroke when a
|
|
1951
|
+
// horizontal scroll recycles it — the exact failure D-02 was built to fix on the row axis
|
|
1952
|
+
// (T-87-05-01, the phase's one HIGH-severity threat). Single-cell edit mode only
|
|
1953
|
+
// ($data.editingRow/editingCol, mirroring editingColumnId()'s own index pair) — full-row
|
|
1954
|
+
// edit mode (editingRowIndex) has no single "the editing column" to force.
|
|
1955
|
+
if (editingRow() >= 0 && editingCol() >= 0 && out.indexOf(editingCol()) === -1) {
|
|
1956
|
+
out.push(editingCol());
|
|
1957
|
+
}
|
|
1958
|
+
return out;
|
|
1959
|
+
}
|
|
1960
|
+
|
|
1961
|
+
// windowedCells(row) (D-09): the TEMPLATE-ONLY windowed slice of a row's visible cells — wraps
|
|
1962
|
+
// visibleCellsFor(row) (columnChrome.rzts) WITHOUT modifying it. Degrades to the full,
|
|
1963
|
+
// unsliced set when columns are not windowed (byte-identical to today). visibleCellsFor()
|
|
1964
|
+
// itself must never be sliced: colIndexOf/visibleColCount/columnIdAt/cellValueAt/beginEdit all
|
|
1965
|
+
// index into its FULL result (the A2 invariant, 87-02), and slicing it would silently break
|
|
1966
|
+
// all five with no compile error.
|
|
1967
|
+
function windowedCells(row: any) {
|
|
1968
|
+
// subscribe-first (the windowedRows() discipline) so the fine-grained targets' body <td>
|
|
1969
|
+
// r-for re-derives when the column window moves.
|
|
1970
|
+
void windowVer();
|
|
1971
|
+
const cells = visibleCellsFor(row);
|
|
1972
|
+
if (!colsWindowed()) return cells;
|
|
1973
|
+
const idx = windowedColIndices();
|
|
1974
|
+
const out = [];
|
|
1975
|
+
for (let i = 0; i < idx.length; i++) {
|
|
1976
|
+
// WR-01 shrink-window guard, one axis over: drop any index that outruns the row's
|
|
1977
|
+
// current cell list (a brief stale-count window analogous to windowedRows()'s WR-01).
|
|
1978
|
+
const cell = cells[idx[i]];
|
|
1979
|
+
if (cell) out.push(cell);
|
|
1980
|
+
}
|
|
1981
|
+
return out;
|
|
1982
|
+
}
|
|
1983
|
+
|
|
1984
|
+
// remeasureColumnWindow() (Phase 87 87-04) is declared in DataTable.rozie's OWN script, NOT
|
|
1985
|
+
// here — even though it is conceptually this file's D-10 host-shell twin of remeasureWindow()
|
|
1986
|
+
// above. Reason (Rule 1, found via the react typecheck gate): remeasureColumnWindow() must call
|
|
1987
|
+
// columnVirtualizerOptions() (headless-core windowing.rzts). inlineScriptPartials() groups a
|
|
1988
|
+
// RELATIVE partial import (this file) BEFORE a bare-package-specifier partial import
|
|
1989
|
+
// (@rozie-ui/headless-core/windowing.rzts) in the merged per-target output, regardless of which
|
|
1990
|
+
// import statement appears first in DataTable.rozie's own script (verified: columnVirtualizerOptions
|
|
1991
|
+
// emits as a `useCallback` LATER in the react output than every symbol this file exports). A
|
|
1992
|
+
// function declared HERE calling INTO windowing.rzts is therefore a forward reference — the
|
|
1993
|
+
// exact TS2448 TDZ class the 87-02 predicate-layer reordering already fixed once. DataTable.rozie's
|
|
1994
|
+
// OWN top-level script code lands AFTER both partial groups, so remeasureColumnWindow() is safe
|
|
1995
|
+
// declared there instead (see the comment beside windowedHeaderRow()/windowedColSpan()).
|
|
1996
|
+
|
|
1735
1997
|
// windowSource(): the rows fed to the virtualizer AND held in $data.rows — the windowing.rzts
|
|
1736
1998
|
// host-contract source. When virtual, the FULL filtered+sorted PRE-PAGINATION model
|
|
1737
1999
|
// (A2-verified table.getPrePaginationRowModel()) so windowing REPLACES client pagination (req-9);
|
|
1738
2000
|
// else the normal (paginated) row model — the non-virtual path is byte-unchanged.
|
|
1739
2001
|
function windowSource() {
|
|
1740
2002
|
if (!table) return [];
|
|
1741
|
-
if (
|
|
2003
|
+
if (rowsWindowed()) return table.getPrePaginationRowModel().rows;
|
|
1742
2004
|
return table.getRowModel().rows;
|
|
1743
2005
|
}
|
|
1744
2006
|
|
|
@@ -1761,6 +2023,10 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
1761
2023
|
// Each pass only OBSERVES + measures the live window; measureElement is idempotent on an
|
|
1762
2024
|
// already-observed node, so running both is cheap and loop-free.
|
|
1763
2025
|
function scheduleRemeasure() {
|
|
2026
|
+
// 87-13: never arm a new sweep after teardown — an onChange can still fire from a
|
|
2027
|
+
// virtualizer whose own ResizeObserver cleanup has run but whose queued tick was already
|
|
2028
|
+
// in flight.
|
|
2029
|
+
if (remeasureDisposed) return;
|
|
1764
2030
|
if (remeasurePending) return;
|
|
1765
2031
|
remeasurePending = true;
|
|
1766
2032
|
let ranMicro = false;
|
|
@@ -1768,6 +2034,7 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
1768
2034
|
remeasureWindow();
|
|
1769
2035
|
};
|
|
1770
2036
|
const rafPass = () => {
|
|
2037
|
+
remeasureRaf = null;
|
|
1771
2038
|
remeasurePending = false;
|
|
1772
2039
|
remeasureWindow();
|
|
1773
2040
|
};
|
|
@@ -1775,7 +2042,25 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
1775
2042
|
ranMicro = true;
|
|
1776
2043
|
queueMicrotask(microPass);
|
|
1777
2044
|
}
|
|
1778
|
-
|
|
2045
|
+
// 87-13: retain the handle so teardownRemeasure() can cancel a pass that is still pending
|
|
2046
|
+
// at unmount. Without this the callback survives teardown and writes $data.windowVer.
|
|
2047
|
+
if (typeof requestAnimationFrame === 'function') remeasureRaf = requestAnimationFrame(rafPass);else if (ranMicro) remeasurePending = false;else remeasureRaf = setTimeout(rafPass, 0);
|
|
2048
|
+
}
|
|
2049
|
+
|
|
2050
|
+
// 87-13 (CR-01): idempotent teardown for the deferred sweep — the same discipline
|
|
2051
|
+
// teardownFillDrag()/teardownRangeDrag() already follow. Cancels a pending pass and latches
|
|
2052
|
+
// `remeasureDisposed` so the microtask twin (which carries no cancellable handle) and any
|
|
2053
|
+
// in-flight onChange both bail instead of writing to a torn-down instance.
|
|
2054
|
+
function teardownRemeasure() {
|
|
2055
|
+
remeasureDisposed = true;
|
|
2056
|
+
if (remeasureRaf != null) {
|
|
2057
|
+
// Discriminate on requestAnimationFrame — the SAME predicate scheduleRemeasure() branched
|
|
2058
|
+
// on when it produced this handle. Testing cancelAnimationFrame instead would hand a
|
|
2059
|
+
// setTimeout id to cancelAnimationFrame in any env where the two disagree.
|
|
2060
|
+
if (typeof requestAnimationFrame === 'function') cancelAnimationFrame(remeasureRaf);else clearTimeout(remeasureRaf);
|
|
2061
|
+
remeasureRaf = null;
|
|
2062
|
+
}
|
|
2063
|
+
remeasurePending = false;
|
|
1779
2064
|
}
|
|
1780
2065
|
|
|
1781
2066
|
// pinnedEditIndex(): the FULL-MODEL row index of the row currently in edit (D-02 pin-row),
|
|
@@ -1810,6 +2095,11 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
1810
2095
|
// idempotent on an already-observed node (the `prevNode !== node` guard), so re-sweeping the
|
|
1811
2096
|
// visible window each commit is cheap and loop-free.
|
|
1812
2097
|
function remeasureWindow() {
|
|
2098
|
+
// 87-13 (CR-01): the disposed latch, checked BEFORE the ref guard below. That guard cannot
|
|
2099
|
+
// cover unmount — virtualizer/gridRoot are assigned in $onMount and never nulled — so this
|
|
2100
|
+
// is the only thing standing between a pass queued pre-unmount and refineRowEstimate()'s
|
|
2101
|
+
// setOptions/scrollTop/$data.windowVer writes against a torn-down instance.
|
|
2102
|
+
if (remeasureDisposed) return;
|
|
1813
2103
|
if (!virtualizer || !gridRoot) return;
|
|
1814
2104
|
// Bail ONLY while a PROGRAMMATIC scroll is in flight: virtualizer.scrollState is non-null
|
|
1815
2105
|
// exclusively during scrollToIndex / scrollToOffset (the D-12 scroll-then-focus seam) and
|
|
@@ -1821,6 +2111,14 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
1821
2111
|
if (virtualizer.scrollState) return;
|
|
1822
2112
|
const trs = gridRoot.querySelectorAll('tbody.rdt-tbody > tr[data-index]');
|
|
1823
2113
|
for (const tr of trs as any) virtualizer.measureElement(tr);
|
|
2114
|
+
// D-15 (Phase 87 87-07): trigger the shared engine's post-measurement fold + hysteresis
|
|
2115
|
+
// re-feed via the afterRowRemeasure mutable-let hook (DataTable.rozie's own script,
|
|
2116
|
+
// assigned to windowing.rzts's refineRowEstimate()) — NEVER a direct call from this file
|
|
2117
|
+
// into windowing.rzts (see windowing.rzts's HOST CONTRACT comment for the forward-
|
|
2118
|
+
// reference TDZ this indirection avoids, the same class remeasureColumnWindow()'s comment
|
|
2119
|
+
// documents for columnVirtualizerOptions()). Inert (no-op) until the host assigns it; the
|
|
2120
|
+
// off/pre-mount path never reaches this line since virtualizer is null there.
|
|
2121
|
+
if (afterRowRemeasure) afterRowRemeasure();
|
|
1824
2122
|
}
|
|
1825
2123
|
|
|
1826
2124
|
// D-04: this shell exports ONLY the impure, data-table-specific host pieces. The pure windowing
|
|
@@ -1851,6 +2149,61 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
1851
2149
|
// defaulting to no-op): the DataTable host passes its edit-pinning hooks;
|
|
1852
2150
|
// listbox passes nothing. Routing pinning through this host hook (NOT
|
|
1853
2151
|
// inlining it) keeps DataTable's B13 edit-pinning behavior byte-identical.
|
|
2152
|
+
// - rowsWindowed(): boolean — is the ROW axis windowed. REQUIRED, no default — replaces every bare
|
|
2153
|
+
// truthiness read of the host's windowing prop (D-05); `windowedRows()` /
|
|
2154
|
+
// `padTop()` / `padBottom()` / `rowIsOutsideWindow()` below call it by
|
|
2155
|
+
// convention exactly as they already call `pinnedEditIndex()`.
|
|
2156
|
+
// - colsWindowed(): boolean — is the COLUMN axis windowed. REQUIRED, no default. `false` for every
|
|
2157
|
+
// host until it defines the real column-axis mechanism (87-04+).
|
|
2158
|
+
// - columnCount(): number — the leaf-column count the column virtualizer windows over. REQUIRED,
|
|
2159
|
+
// no default.
|
|
2160
|
+
// - columnSize(i: number): number — the authoritative width of absolute leaf column `i`, sourced
|
|
2161
|
+
// from table-core's `getSize()` under D-06. REQUIRED, no default.
|
|
2162
|
+
// - forcedColumns(): number[] — the D-10 OPTIONAL column-axis mirror of `pinnedEditIndex()`: the
|
|
2163
|
+
// DataTable host unions pinned + active-cell + editing column indices into
|
|
2164
|
+
// the column-window slice; listbox/combobox pass an empty array (host-
|
|
2165
|
+
// provided, defaulting to `[]`).
|
|
2166
|
+
// - colVirtualizer — the host's SECOND virtual-core instance, windowing the COLUMN axis
|
|
2167
|
+
// (see the AXIS MECHANISM note below). Host-provided, defaulting to `null`.
|
|
2168
|
+
// - autoMeasureOn(): boolean — the D-18 REQUIRED content-driven-estimate gate (Phase 87 87-07):
|
|
2169
|
+
// data-table's real body reads `$props.autoMeasure === true`; listbox/
|
|
2170
|
+
// combobox/command-palette return `false` so the accumulator branch
|
|
2171
|
+
// estimateRowSize() gates on is dead code for them (D-20).
|
|
2172
|
+
// - afterRowRemeasure — OPTIONAL host-owned mutable `let` (defaults to a no-op / undefined),
|
|
2173
|
+
// assigned to refineRowEstimate() (below) by the host. The DataTable
|
|
2174
|
+
// host's remeasureWindow() (virtualization.rzts) calls it AFTER its
|
|
2175
|
+
// measureElement sweep so the fold + hysteresis re-feed run on every
|
|
2176
|
+
// window commit. Routed through a mutable `let` rather than a direct
|
|
2177
|
+
// call FROM virtualization.rzts INTO this file: a relative-partial CONST
|
|
2178
|
+
// calling a bare-specifier-partial CONST is the exact forward-reference
|
|
2179
|
+
// TDZ class remeasureColumnWindow()'s own DataTable.rozie comment
|
|
2180
|
+
// documents for columnVirtualizerOptions() (inlineScriptPartials()
|
|
2181
|
+
// groups the relative partial BEFORE the bare-specifier partial in the
|
|
2182
|
+
// merged per-target output, regardless of source import order). A
|
|
2183
|
+
// mutable `let` hoists to `useRef` on React and is excluded from a
|
|
2184
|
+
// useCallback's dependency array, sidestepping the hazard entirely — the
|
|
2185
|
+
// SAME mechanism `refreshRowModel` already relies on.
|
|
2186
|
+
//
|
|
2187
|
+
// AXIS MECHANISM (OQ1 / Assumption A1 — resolved from the installed source in 87-02;
|
|
2188
|
+
// LANDED in 87-04: `columnVirtualizerOptions()` below IS the second, horizontal instance this
|
|
2189
|
+
// note originally only documented). `horizontal` is a PER-INSTANCE field of `VirtualizerOptions`
|
|
2190
|
+
// (`node_modules/@tanstack/virtual-core/dist/esm/index.d.ts:67`, installed version 3.17.1 per
|
|
2191
|
+
// `package.json`), and every axis-sensitive internal read consults `instance.options.horizontal` —
|
|
2192
|
+
// `measureElement`'s inlineSize/blockSize + offsetWidth/offsetHeight branch
|
|
2193
|
+
// (`dist/esm/index.js:137,150`), `observeElementOffset`'s scrollLeft/scrollTop branch
|
|
2194
|
+
// (`dist/esm/index.js:118-121`), `getMaxScrollOffset`'s scrollWidth/scrollHeight branch
|
|
2195
|
+
// (`dist/esm/index.js:907-915`), and `scrollWithAdjustments`'s left/top branch
|
|
2196
|
+
// (`dist/esm/index.js:152-161`). So ONE `Virtualizer` instance windows exactly ONE axis: the column
|
|
2197
|
+
// axis needs its own SECOND, independent `Virtualizer` instance constructed with `horizontal: true`,
|
|
2198
|
+
// sharing the SAME `getScrollElement()` (the `rdt-scroll` wrapper) the row instance already uses.
|
|
2199
|
+
// Two options the row axis does not set that the column instance will need: `isRtl?: boolean`
|
|
2200
|
+
// (data-table ships an RTL grid path) and `overscan?: number` (D-07 gives the column axis its own
|
|
2201
|
+
// hardcoded constant, separate from the row axis's `overscan: 8` below).
|
|
2202
|
+
//
|
|
2203
|
+
// isRtl WIRING (gap-closure 87-09, LANDED — see `ensureColRtlWatch()`/`isColRtl()` below,
|
|
2204
|
+
// immediately ahead of `columnVirtualizerOptions()`): data-table has no construction-time RTL
|
|
2205
|
+
// signal (no `dir`/`rtl` prop), and `dir` can be set on `gridScrollEl` at ANY point relative to
|
|
2206
|
+
// mount. `isRtl` is therefore computed LIVE via `getComputedStyle`, not baked in once.
|
|
1854
2207
|
|
|
1855
2208
|
// getItemKey reads the LIVE source (never a frozen mount-render $data.rows closure — the F6
|
|
1856
2209
|
// React stale-closure lesson) so virtual-core's measurement cache keys by stable full-model row
|
|
@@ -1860,17 +2213,316 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
1860
2213
|
return src && src[i] ? src[i].id : undefined;
|
|
1861
2214
|
}
|
|
1862
2215
|
|
|
2216
|
+
// COL_OVERSCAN (D-07): the column axis's own hardcoded overscan constant, separate from the
|
|
2217
|
+
// row axis's `overscan: 8` below. Columns are far wider than rows are tall, so one number
|
|
2218
|
+
// cannot serve both axes; no prop is exposed because no consumer has asked to tune the row
|
|
2219
|
+
// overscan across the four phases it has shipped. Unused until 87-04 constructs the second,
|
|
2220
|
+
// horizontal Virtualizer instance (see the AXIS MECHANISM note above).
|
|
2221
|
+
const COL_OVERSCAN = 3;
|
|
2222
|
+
|
|
2223
|
+
// columnVirtualizerOptions() (Phase 87 87-04): the SECOND, horizontal Virtualizer instance's
|
|
2224
|
+
// full options set — the AXIS MECHANISM note's second instance, landed. Mirrors
|
|
2225
|
+
// virtualizerOptions() exactly except: count/estimateSize read the COLUMN host symbols,
|
|
2226
|
+
// horizontal:true selects the axis, overscan is the column axis's OWN constant (D-07), and
|
|
2227
|
+
// there is NO getItemKey — columns have no stable per-column id in the virtual-core sense, so
|
|
2228
|
+
// they key by index (virtual-core's default). onChange bumps the SAME $data.windowVer counter
|
|
2229
|
+
// the row axis uses (87-02 checkpoint decision (b): no separate $data.colWindowVer) but does
|
|
2230
|
+
// NOT call scheduleRemeasure(): under D-06 column widths come from table-core's getSize()
|
|
2231
|
+
// oracle and are NEVER measured from the DOM, so a horizontal scroll has nothing new to
|
|
2232
|
+
// observe (unlike the row axis's CR-01 recycled-row remeasure sweep).
|
|
2233
|
+
// ══ Gap-closure 87-09 (dir="rtl" column windowing) ═══════════════════════════════════════
|
|
2234
|
+
// virtual-core reads `instance.options.isRtl` FRESH on every native 'scroll' event — the
|
|
2235
|
+
// negation lives inside `observeElementOffset`'s internal per-event closure
|
|
2236
|
+
// (`dist/esm/index.js:119-120`: `el.scrollLeft * (isRtl && -1 || 1)`), called anew each time
|
|
2237
|
+
// the browser fires 'scroll'. But `instance.options` itself is only a plain VALUE snapshot
|
|
2238
|
+
// taken by the LAST `setOptions()` call (`dist/esm/index.js:277-280`:
|
|
2239
|
+
// `for (const key in opts2) merged[key] = opts2[key]` copies the boolean, not a live binding
|
|
2240
|
+
// or getter) — so a static `isRtl` computed ONCE at `colVirtualizer` construction would only
|
|
2241
|
+
// ever reflect direction AT THAT INSTANT. `dir` can be set on `gridScrollEl` at any point
|
|
2242
|
+
// relative to mount (data-table has no construction-time RTL prop), so a MutationObserver on
|
|
2243
|
+
// `gridScrollEl`'s own `dir` attribute re-feeds `colVirtualizer`'s options — a cheap
|
|
2244
|
+
// object-merge via `setOptions()`, deliberately NOT a forced `_willUpdate()` recompute, since
|
|
2245
|
+
// nothing needs to repaint until the next real scroll — the moment direction flips. By the
|
|
2246
|
+
// time the NEXT native 'scroll' event's own offset read runs, `instance.options.isRtl`
|
|
2247
|
+
// already reflects the correction. Ordering is spec-guaranteed, not a race: MutationObserver
|
|
2248
|
+
// callbacks run on the microtask queue, which the HTML event loop always drains before the
|
|
2249
|
+
// next task — and a native 'scroll' event dispatched after a programmatic `scrollLeft` write
|
|
2250
|
+
// is itself a subsequent task, not a microtask racing the same tick.
|
|
2251
|
+
//
|
|
2252
|
+
// F6 STALE-CLOSURE HAZARD (found + fixed this task, React only): calling
|
|
2253
|
+
// columnVirtualizerOptions() FRESH from inside the MutationObserver's callback would
|
|
2254
|
+
// re-derive `count`/`estimateSize` via columnCount() (virtualization.rzts's
|
|
2255
|
+
// visibleColCount(), which reads `$data.rows`). The MutationObserver is attached ONCE,
|
|
2256
|
+
// inside ensureColRtlWatch() at colVirtualizer CONSTRUCTION time ($onMount) — a closure
|
|
2257
|
+
// FROZEN to that render's scope on React, where `$data.rows` is a useState value.
|
|
2258
|
+
// $onMount's row-model seed (refreshRowModel()) resolves via an ASYNC setState, so AT THE
|
|
2259
|
+
// EXACT INSTANT colVirtualizer is constructed, `rows` may still be `[]` in THAT render's
|
|
2260
|
+
// closure — and unlike a `let`-hoisted ref (virtualizer, table, gridScrollEl — always read
|
|
2261
|
+
// via `.current`, always live no matter which render's closure holds the reference),
|
|
2262
|
+
// `$data.rows` is genuine React state: a plain local binding recreated fresh EVERY render,
|
|
2263
|
+
// so a function captured from an OLDER render reads that OLDER render's snapshot FOREVER,
|
|
2264
|
+
// no matter how many later renders populate it. Confirmed empirically: calling
|
|
2265
|
+
// columnVirtualizerOptions() from the frozen callback read `count` back as 0 (not 60),
|
|
2266
|
+
// collapsing getVirtualItems() to []. This is the exact class of bug `virtualItemKey`'s own
|
|
2267
|
+
// header comment already documents ("never a frozen mount-render $data.rows closure") — and
|
|
2268
|
+
// a MUTABLE-LET INDIRECTION (the `afterRowRemeasure` shape, 87-07) does NOT fix it here,
|
|
2269
|
+
// because the hazard lives INSIDE columnVirtualizerOptions()'s own dependency chain
|
|
2270
|
+
// ($data.rows), not in "which function identity gets called" — wrapping a stale call in
|
|
2271
|
+
// another layer of ref does not make an inner React-state read fresh.
|
|
2272
|
+
//
|
|
2273
|
+
// FIX: never call columnVirtualizerOptions() again from this callback at all. Read
|
|
2274
|
+
// `colVirtualizer.options` — virtual-core's OWN internal state, mutated in place on every
|
|
2275
|
+
// setOptions() call regardless of which render's closure triggered it (a REAL object
|
|
2276
|
+
// reference the SAME way `virtualizer`/`table` are, not React state) — and merge in ONLY
|
|
2277
|
+
// the corrected `isRtl`. `count`/`estimateSize`/etc. keep whatever value the LAST correct
|
|
2278
|
+
// setOptions() call gave them (from construction, or from remeasureColumnWindow()'s own
|
|
2279
|
+
// FRESH-per-render re-feed via the $watch-driven refreshRowModel cycle) — untouched,
|
|
2280
|
+
// because this dir-flip has nothing to do with row/column count. isColRtl() itself reads
|
|
2281
|
+
// only `gridScrollEl` (also a ref) and does a live DOM getComputedStyle read — no React
|
|
2282
|
+
// state involved, so it is never stale regardless of which render's closure calls it.
|
|
2283
|
+
let colRtlObserver: any = null;
|
|
2284
|
+
let colRtlObserverEl: any = null;
|
|
2285
|
+
|
|
2286
|
+
// isColRtl(): getComputedStyle (not a raw `.getAttribute('dir')` read) so an ANCESTOR's `dir`
|
|
2287
|
+
// or a CSS `direction: rtl` rule is honored the same way the browser's own bidi layout honors
|
|
2288
|
+
// it, not merely a literal attribute on gridScrollEl itself.
|
|
2289
|
+
function isColRtl(): boolean {
|
|
2290
|
+
if (!gridScrollEl || typeof getComputedStyle !== 'function') return false;
|
|
2291
|
+
return getComputedStyle(gridScrollEl).direction === 'rtl';
|
|
2292
|
+
}
|
|
2293
|
+
|
|
2294
|
+
// ensureColRtlWatch(): idempotent — a no-op once already attached to the CURRENT gridScrollEl
|
|
2295
|
+
// (a stable ref for the component's lifetime once mounted). Self-attaching from inside
|
|
2296
|
+
// columnVirtualizerOptions() means no new host-contract symbol is needed: listbox/combobox/
|
|
2297
|
+
// command-palette never call columnVirtualizerOptions() at all (colsWindowed() is permanently
|
|
2298
|
+
// false for them, D-20), so this code path — and the observer it creates — never exists there.
|
|
2299
|
+
function ensureColRtlWatch(): void {
|
|
2300
|
+
if (!gridScrollEl || colRtlObserverEl === gridScrollEl || typeof MutationObserver !== 'function') return;
|
|
2301
|
+
if (colRtlObserver) colRtlObserver.disconnect();
|
|
2302
|
+
colRtlObserver = new MutationObserver(() => {
|
|
2303
|
+
if (colVirtualizer) colVirtualizer.setOptions({
|
|
2304
|
+
...colVirtualizer.options,
|
|
2305
|
+
isRtl: isColRtl()
|
|
2306
|
+
});
|
|
2307
|
+
});
|
|
2308
|
+
colRtlObserver.observe(gridScrollEl, {
|
|
2309
|
+
attributes: true,
|
|
2310
|
+
attributeFilter: ['dir']
|
|
2311
|
+
});
|
|
2312
|
+
colRtlObserverEl = gridScrollEl;
|
|
2313
|
+
}
|
|
2314
|
+
|
|
2315
|
+
// teardownColRtlWatch(): exported so the DataTable host disconnects the observer alongside
|
|
2316
|
+
// colVirtualizerCleanup() in $onUnmount — mirrors virtual-core's own _didMount()/teardown
|
|
2317
|
+
// discipline for the ResizeObserver it manages internally. No-op if never attached.
|
|
2318
|
+
function teardownColRtlWatch(): void {
|
|
2319
|
+
if (colRtlObserver) colRtlObserver.disconnect();
|
|
2320
|
+
colRtlObserver = null;
|
|
2321
|
+
colRtlObserverEl = null;
|
|
2322
|
+
}
|
|
2323
|
+
function columnVirtualizerOptions(): any {
|
|
2324
|
+
ensureColRtlWatch();
|
|
2325
|
+
return {
|
|
2326
|
+
count: columnCount(),
|
|
2327
|
+
getScrollElement: () => gridScrollEl,
|
|
2328
|
+
estimateSize: (i: any) => columnSize(i),
|
|
2329
|
+
horizontal: true,
|
|
2330
|
+
isRtl: isColRtl(),
|
|
2331
|
+
observeElementRect,
|
|
2332
|
+
observeElementOffset,
|
|
2333
|
+
scrollToFn: elementScroll,
|
|
2334
|
+
measureElement,
|
|
2335
|
+
overscan: COL_OVERSCAN,
|
|
2336
|
+
onChange: () => {
|
|
2337
|
+
setWindowVer(windowVer() + 1);
|
|
2338
|
+
}
|
|
2339
|
+
};
|
|
2340
|
+
}
|
|
2341
|
+
|
|
2342
|
+
// ══ Phase 87 87-07 (D-15/D-18) — content-driven auto-measure: the shared engine's FIRST
|
|
2343
|
+
// mutable top-level state. Hoisted to `useRef` PER-INSTANCE by the React emitter's
|
|
2344
|
+
// hoistModuleLet — the SAME mechanism already load-bearing for `table`, `virtualizer`,
|
|
2345
|
+
// `remeasurePending`, and `gridScrollEl` in the DataTable host (Task 1's confirmed
|
|
2346
|
+
// precedent), so two DataTable instances on one page never share an accumulator
|
|
2347
|
+
// (T-87-07-04). measuredRowTotal/measuredRowCount together give the running MEAN of every
|
|
2348
|
+
// row folded in so far; lastFedRowEstimate is the estimate value most recently pushed into
|
|
2349
|
+
// virtual-core (the hysteresis comparison baseline). ══
|
|
2350
|
+
let measuredRowTotal = 0;
|
|
2351
|
+
let measuredRowCount = 0;
|
|
2352
|
+
let lastFedRowEstimate = 0;
|
|
2353
|
+
// foldedRowHeights: dedupe map (full-model row index -> its last-folded height) so a row
|
|
2354
|
+
// measured TWICE (e.g. scrolled back into view) UPDATES the running mean rather than being
|
|
2355
|
+
// added a second time (T-87-07-03) — a skewed mean produces a lying scrollbar, the exact
|
|
2356
|
+
// defect this feature exists to remove.
|
|
2357
|
+
let foldedRowHeights: Record<number, number> = {};
|
|
2358
|
+
|
|
2359
|
+
// ══ Gap-closure 87-10 — windowVerBumpPending / bumpWindowVer(): coalesce EVERY $data.windowVer
|
|
2360
|
+
// write behind a SINGLE microtask-deferred increment, regardless of how many callers request
|
|
2361
|
+
// one within the same synchronous JS task. ══
|
|
2362
|
+
//
|
|
2363
|
+
// ROOT CAUSE (framework-agnostic; the Solid-specific symptom this closes only EXPOSES it) —
|
|
2364
|
+
// confirmed by instrumenting the installed @tanstack/virtual-core@3.17.1 source directly
|
|
2365
|
+
// (dist/esm/index.js), not by reasoning abstractly: virtual-core's resizeItem() calls
|
|
2366
|
+
// `this.notify(false)` — synchronously invoking `virtualizerOptions().onChange` below — EVERY
|
|
2367
|
+
// TIME a measured row's real size differs from its cached one (`delta !== 0`), independent of
|
|
2368
|
+
// framework (dist/esm/index.js:836-874). remeasureWindow()'s CR-01 sweep
|
|
2369
|
+
// (packages/ui/data-table/src/virtualization.rzts) measures EVERY currently-rendered `<tr>` in
|
|
2370
|
+
// ONE for-loop BEFORE calling afterRowRemeasure() (refineRowEstimate() below) — so a single
|
|
2371
|
+
// synchronous JS task (e.g. the very first measurement pass, which transitions N never-before-
|
|
2372
|
+
// measured rows from the flat seed to their real heights) can fire onChange, and therefore an
|
|
2373
|
+
// UNCOALESCED `$data.windowVer = $data.windowVer + 1`, MANY times in a row — well BEFORE
|
|
2374
|
+
// refineRowEstimate()'s own fold-then-re-feed (which runs only AFTER that loop finishes) has
|
|
2375
|
+
// folded those same measurements into the running mean or re-fed the converged estimate into
|
|
2376
|
+
// virtual-core via setOptions(). A live trace of this exact sequence (instrumented resizeItem/
|
|
2377
|
+
// getMeasurements calls, DataTableColumnVirtualDemo, autoMeasure on) showed Vue batching 3
|
|
2378
|
+
// resizeItem calls before its ONE downstream re-render reads getMeasurements() — already
|
|
2379
|
+
// reflecting the fully-folded, re-fed state — versus Solid re-running its padTop()/padBottom()
|
|
2380
|
+
// effects SYNCHRONOUSLY and IMMEDIATELY on EVERY individual windowVer write (11 interleaved
|
|
2381
|
+
// resize-then-immediate-recompute pairs, each recompute happening mid-sweep, before
|
|
2382
|
+
// refineRowEstimate() had run even once). React/Vue/Svelte/Angular/Lit all batch their own
|
|
2383
|
+
// reactivity to at least a microtask boundary, so their downstream reads land AFTER the whole
|
|
2384
|
+
// synchronous burst (measurement sweep + fold + re-feed) completes — accidentally correct, not
|
|
2385
|
+
// correct by construction. Solid does not auto-batch a signal write made from outside a
|
|
2386
|
+
// Solid-owned event/effect context, so it is the one target where the mid-burst TORN read is
|
|
2387
|
+
// externally observable. Because `setOptions()` + `_willUpdate()` alone do NOT invalidate
|
|
2388
|
+
// virtual-core's own `getMeasurements()` memo (keyed on itemSizeCacheVersion /
|
|
2389
|
+
// getMeasurementOptions() — never on the estimateSize FUNCTION reference itself; confirmed from
|
|
2390
|
+
// the same installed source, dist/esm/index.js:585-587,624), Solid's LAST such mid-sweep
|
|
2391
|
+
// recompute is also the LAST time getMeasurements() is ever invoked for that sweep once no
|
|
2392
|
+
// further row happens to differ from its cache — so the DOM stays frozen on that stale,
|
|
2393
|
+
// pre-fold/pre-re-feed snapshot indefinitely, even though the accumulator itself has already
|
|
2394
|
+
// converged correctly (T-87-07's own confirmed finding).
|
|
2395
|
+
//
|
|
2396
|
+
// FIX: coalesce every requester of a windowVer bump — virtual-core's own onChange AND
|
|
2397
|
+
// refineRowEstimate()'s explicit re-feed bump — behind ONE microtask-deferred write, the SAME
|
|
2398
|
+
// idiom scheduleRemeasure() already uses in virtualization.rzts. This makes the render happen
|
|
2399
|
+
// EXACTLY ONCE, strictly AFTER the entire synchronous burst (including refineRowEstimate()'s
|
|
2400
|
+
// fold + re-feed) on EVERY target, by construction rather than by incidental host-framework
|
|
2401
|
+
// batching. Scoped to the ROW axis only: colVirtualizer never calls resizeItem() at all (D-06 —
|
|
2402
|
+
// column widths come from table-core's getSize() oracle, never measured from the DOM), so
|
|
2403
|
+
// columnVirtualizerOptions()'s onChange cannot hit this burst class and is left untouched.
|
|
2404
|
+
let windowVerBumpPending = false;
|
|
2405
|
+
function bumpWindowVer(): void {
|
|
2406
|
+
if (windowVerBumpPending) return;
|
|
2407
|
+
windowVerBumpPending = true;
|
|
2408
|
+
const flush = () => {
|
|
2409
|
+
windowVerBumpPending = false;
|
|
2410
|
+
setWindowVer(windowVer() + 1);
|
|
2411
|
+
};
|
|
2412
|
+
// Mirrors scheduleRemeasure()'s own defensive queueMicrotask-with-setTimeout-fallback
|
|
2413
|
+
// (virtualization.rzts) for environments where queueMicrotask is unavailable.
|
|
2414
|
+
if (typeof queueMicrotask !== 'undefined') queueMicrotask(flush);else setTimeout(flush, 0);
|
|
2415
|
+
}
|
|
2416
|
+
|
|
2417
|
+
// ESTIMATE_REFEED_DELTA_PX (D-15): the hysteresis threshold gating a re-feed into
|
|
2418
|
+
// virtual-core. Without it, a mean nudging by a fraction of a pixel on every fold would
|
|
2419
|
+
// re-feed on every window commit — the T-87-07-01 DoS control, paired with virtual-core's
|
|
2420
|
+
// own measureElement/resizeItem idempotence (see refineRowEstimate() below).
|
|
2421
|
+
const ESTIMATE_REFEED_DELTA_PX = 4;
|
|
2422
|
+
|
|
2423
|
+
// estimateRowSize(i) (D-15/D-17): the estimateSize() resolver. MUST check !autoMeasureOn()
|
|
2424
|
+
// FIRST so the off path touches zero accumulator state and returns $props.estimateRowHeight
|
|
2425
|
+
// verbatim (D-17's byte-behavioral no-op). The zero-measurements case (first paint,
|
|
2426
|
+
// regardless of autoMeasure) still returns the seed — the very first render has nothing
|
|
2427
|
+
// measured yet either way (D-15).
|
|
2428
|
+
function estimateRowSize(i: number): number {
|
|
2429
|
+
if (!autoMeasureOn()) return local.estimateRowHeight;
|
|
2430
|
+
if (measuredRowCount === 0) return local.estimateRowHeight;
|
|
2431
|
+
return Math.round(measuredRowTotal / measuredRowCount);
|
|
2432
|
+
}
|
|
2433
|
+
|
|
2434
|
+
// foldMeasuredRow(index, height): fold ONE measured row's height into the running-mean
|
|
2435
|
+
// accumulator, UPDATING (not double-adding) an already-folded index (T-87-07-03).
|
|
2436
|
+
function foldMeasuredRow(index: number, height: number): void {
|
|
2437
|
+
const prev = foldedRowHeights[index];
|
|
2438
|
+
if (prev === height) return;
|
|
2439
|
+
if (prev == null) {
|
|
2440
|
+
measuredRowTotal = measuredRowTotal + height;
|
|
2441
|
+
measuredRowCount = measuredRowCount + 1;
|
|
2442
|
+
} else {
|
|
2443
|
+
measuredRowTotal = measuredRowTotal - prev + height;
|
|
2444
|
+
}
|
|
2445
|
+
foldedRowHeights[index] = height;
|
|
2446
|
+
}
|
|
2447
|
+
|
|
2448
|
+
// refineRowEstimate() (D-15/D-16, Phase 87 87-07): the shared engine's post-measurement
|
|
2449
|
+
// orchestration, called via the host's afterRowRemeasure hook (see the HOST CONTRACT note
|
|
2450
|
+
// above for why this is never called directly FROM virtualization.rzts). Folds every
|
|
2451
|
+
// CURRENTLY RENDERED row's REAL measurement (from virtual-core's own getMeasurements() —
|
|
2452
|
+
// never a DOM read), then hysteresis-gates a re-feed into virtual-core, reusing the EXACT
|
|
2453
|
+
// `virtualizer.scrollState` bail remeasureWindow() already applies (T-87-07-02) rather than
|
|
2454
|
+
// inventing a second gating mechanism, and finally (Task 3, D-16) anchor-corrects scrollTop
|
|
2455
|
+
// around the re-feed so the row under the user's eye does not visibly lurch. Entirely a
|
|
2456
|
+
// no-op when !autoMeasureOn() — the off path never folds a measurement, touches
|
|
2457
|
+
// lastFedRowEstimate, or adjusts scrollTop (D-17).
|
|
2458
|
+
function refineRowEstimate(): void {
|
|
2459
|
+
if (!autoMeasureOn() || !virtualizer) return;
|
|
2460
|
+
const items = virtualizer.getVirtualItems();
|
|
2461
|
+
const measurements = virtualizer.getMeasurements();
|
|
2462
|
+
for (let i = 0; i < items.length; i++) {
|
|
2463
|
+
const idx = items[i].index;
|
|
2464
|
+
const m = measurements && measurements[idx];
|
|
2465
|
+
if (m) foldMeasuredRow(idx, m.size);
|
|
2466
|
+
}
|
|
2467
|
+
// T-87-07-02: never re-feed while a PROGRAMMATIC scroll is in flight — the exact bail
|
|
2468
|
+
// remeasureWindow() already applies (virtualizer.scrollState is non-null only during
|
|
2469
|
+
// scrollToIndex/scrollToOffset).
|
|
2470
|
+
if (virtualizer.scrollState) return;
|
|
2471
|
+
const est = estimateRowSize(0);
|
|
2472
|
+
if (Math.abs(est - lastFedRowEstimate) < ESTIMATE_REFEED_DELTA_PX) return;
|
|
2473
|
+
// D-16 anchor capture: the topmost rendered row's full-model index + its CURRENT offset,
|
|
2474
|
+
// taken from virtual-core's own measurements (never a getBoundingClientRect() layout read
|
|
2475
|
+
// — slower, and inconsistent with the measurements the spacer math already uses) — taken
|
|
2476
|
+
// BEFORE the re-feed so the correction below can compute exactly the delta the re-feed
|
|
2477
|
+
// itself introduces. Not restricted to scroll offset 0 (D-16 explicit): a table restored
|
|
2478
|
+
// mid-scroll, or whose content changes height after scrolling, must refine too.
|
|
2479
|
+
const anchorIndex = items.length ? items[0].index : -1;
|
|
2480
|
+
const anchorStart = items.length ? items[0].start : 0;
|
|
2481
|
+
virtualizer.setOptions(virtualizerOptions());
|
|
2482
|
+
virtualizer._willUpdate();
|
|
2483
|
+
lastFedRowEstimate = est;
|
|
2484
|
+
// D-16 anchor correction: read the SAME index's fresh measurement post-re-feed and adjust
|
|
2485
|
+
// scrollTop by the delta so the row under the user's eye stays visually put. Guarded by
|
|
2486
|
+
// the SAME path the re-feed itself is gated on (autoMeasureOn() && scrollState === null,
|
|
2487
|
+
// both already checked above), so it can never fight a programmatic scroll (T-87-07-02).
|
|
2488
|
+
if (anchorIndex >= 0 && gridScrollEl) {
|
|
2489
|
+
const freshMeasurements = virtualizer.getMeasurements();
|
|
2490
|
+
const fresh = freshMeasurements && freshMeasurements[anchorIndex];
|
|
2491
|
+
if (fresh) {
|
|
2492
|
+
const delta = fresh.start - anchorStart;
|
|
2493
|
+
if (delta !== 0) gridScrollEl.scrollTop = gridScrollEl.scrollTop + delta;
|
|
2494
|
+
}
|
|
2495
|
+
}
|
|
2496
|
+
// Explicit windowVer bump (87-07, Rule 1): virtual-core's own setOptions()+_willUpdate()
|
|
2497
|
+
// re-feed above does NOT itself invoke notify()/onChange (confirmed from the installed
|
|
2498
|
+
// source: _willUpdate() is a no-op once `scrollElement` is already set, dist/esm/
|
|
2499
|
+
// index.js:389-393), so a re-feed needs its own explicit trigger to make the spacer
|
|
2500
|
+
// re-derivation happen at all. Routed through bumpWindowVer() (87-10, see its own comment
|
|
2501
|
+
// above) rather than a raw `$data.windowVer = $data.windowVer + 1` — coalescing this bump
|
|
2502
|
+
// with any onChange-triggered ones already pending from the SAME synchronous sweep is what
|
|
2503
|
+
// makes the eventual render land strictly AFTER this fold + re-feed has fully landed, on
|
|
2504
|
+
// every target (the 87-10 fix for the confirmed Solid-specific rendering gap).
|
|
2505
|
+
bumpWindowVer();
|
|
2506
|
+
}
|
|
2507
|
+
|
|
1863
2508
|
// The FULL virtualizer options. virtual-core's setOptions REPLACES options with
|
|
1864
2509
|
// `{ ...defaults, ...opts }` (it does NOT merge with prior options — verified in the 3.17.1
|
|
1865
2510
|
// source), so the re-feed MUST pass the complete set, exactly like every TanStack adapter.
|
|
1866
2511
|
// Returned `any` (the currentState() precedent) so the strict bundled-leaf tsc does not choke
|
|
1867
|
-
// on virtual-core's generic option inference. onChange
|
|
1868
|
-
//
|
|
2512
|
+
// on virtual-core's generic option inference. onChange's windowVer write is routed through
|
|
2513
|
+
// bumpWindowVer() (87-10) rather than a raw `$data.x = $data.x + 1` — resizeItem() can call
|
|
2514
|
+
// this onChange MANY times in a single synchronous sweep (once per row whose real measured
|
|
2515
|
+
// size differs from its cache, e.g. every never-before-measured row in the FIRST window),
|
|
2516
|
+
// and coalescing those into one microtask-deferred write is what keeps every target's render
|
|
2517
|
+
// landing strictly AFTER the whole sweep (see bumpWindowVer()'s own comment for the confirmed
|
|
2518
|
+
// Solid-specific rendering gap this closes). The React emitter still lowers the underlying
|
|
2519
|
+
// `$data.windowVer = $data.windowVer + 1` to functional setState — correct even deferred to a
|
|
2520
|
+
// microtask, exactly as it was correct from a mount closure before.
|
|
1869
2521
|
function virtualizerOptions(): any {
|
|
1870
2522
|
return {
|
|
1871
2523
|
count: windowSource().length,
|
|
1872
2524
|
getScrollElement: () => gridScrollEl,
|
|
1873
|
-
estimateSize: () =>
|
|
2525
|
+
estimateSize: (i: any) => estimateRowSize(i),
|
|
1874
2526
|
observeElementRect,
|
|
1875
2527
|
observeElementOffset,
|
|
1876
2528
|
scrollToFn: elementScroll,
|
|
@@ -1878,7 +2530,7 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
1878
2530
|
overscan: 8,
|
|
1879
2531
|
getItemKey: virtualItemKey,
|
|
1880
2532
|
onChange: () => {
|
|
1881
|
-
|
|
2533
|
+
bumpWindowVer();
|
|
1882
2534
|
// CR-01: re-observe the freshly-committed window so RECYCLED rows get measured.
|
|
1883
2535
|
// virtual-core only observe()s a node you explicitly hand to measureElement (it does
|
|
1884
2536
|
// NOT auto-discover rendered rows — measureElement is the SOLE caller of
|
|
@@ -1933,14 +2585,23 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
1933
2585
|
void windowVer();
|
|
1934
2586
|
void editVer();
|
|
1935
2587
|
if (!virtualizer) {
|
|
1936
|
-
//
|
|
1937
|
-
//
|
|
1938
|
-
//
|
|
1939
|
-
//
|
|
1940
|
-
|
|
2588
|
+
// Rows OFF (Phase 87 D-04: this now includes the colsWindowed()-only path, since the
|
|
2589
|
+
// wrapper template is entered whenever isWindowed(), not just rowsWindowed() — the row
|
|
2590
|
+
// virtualizer is never constructed when only the column axis is windowed, D-04) → the FULL
|
|
2591
|
+
// set, with a SYNTHETIC `vi.index` set to each row's array position (matching rowIndexOf's
|
|
2592
|
+
// own `$data.rows.indexOf(row)` semantics exactly, since $data.rows IS windowSource()'s
|
|
2593
|
+
// output here). Every windowed body binding reads wr.vi.index (data-row, aria-rowindex,
|
|
2594
|
+
// colIndexOf, isEditing, the fill handle) — a bare `null` there is a hard crash the moment
|
|
2595
|
+
// this branch is reached with the wrapper mounted, which colsWindowed()-only now does.
|
|
2596
|
+
// Row-virtual ON but the virtualizer is not yet constructed (pre-$onMount first paint) →
|
|
2597
|
+
// render NOTHING so the template never dereferences a not-yet-real `vi`; the rows appear on
|
|
2598
|
+
// the first onChange after _didMount.
|
|
2599
|
+
if (!rowsWindowed()) {
|
|
1941
2600
|
const rowList = rows() || [];
|
|
1942
|
-
return rowList.map((r: any) => ({
|
|
1943
|
-
vi:
|
|
2601
|
+
return rowList.map((r: any, i: any) => ({
|
|
2602
|
+
vi: {
|
|
2603
|
+
index: i
|
|
2604
|
+
},
|
|
1944
2605
|
row: r
|
|
1945
2606
|
}));
|
|
1946
2607
|
}
|
|
@@ -1997,7 +2658,7 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
1997
2658
|
// and re-derives on the pin/unpin transition (the D-02 spacer subtraction below).
|
|
1998
2659
|
void windowVer();
|
|
1999
2660
|
void editVer();
|
|
2000
|
-
if (!
|
|
2661
|
+
if (!rowsWindowed() || !virtualizer) return 0;
|
|
2001
2662
|
const items = virtualizer.getVirtualItems();
|
|
2002
2663
|
let pad = items.length ? items[0].start : 0;
|
|
2003
2664
|
// D-02 spacer subtraction: when the pinned editing row sits ABOVE the window it is rendered
|
|
@@ -2017,7 +2678,7 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
2017
2678
|
// on pin/unpin.
|
|
2018
2679
|
void windowVer();
|
|
2019
2680
|
void editVer();
|
|
2020
|
-
if (!
|
|
2681
|
+
if (!rowsWindowed() || !virtualizer) return 0;
|
|
2021
2682
|
const items = virtualizer.getVirtualItems();
|
|
2022
2683
|
if (!items.length) return 0;
|
|
2023
2684
|
let pad = virtualizer.getTotalSize() - items[items.length - 1].end;
|
|
@@ -2049,12 +2710,140 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
2049
2710
|
// rowIsOutsideWindow(r): is the full-model row index r absent from the currently rendered
|
|
2050
2711
|
// window? Used by the scroll-then-focus seam (req-5 — scroll a far row in before focusing).
|
|
2051
2712
|
function rowIsOutsideWindow(r: any) {
|
|
2052
|
-
if (!
|
|
2713
|
+
if (!rowsWindowed() || !virtualizer) return false;
|
|
2053
2714
|
const items = virtualizer.getVirtualItems();
|
|
2054
2715
|
for (const it of items as any) if (it.index === r) return false;
|
|
2055
2716
|
return true;
|
|
2056
2717
|
}
|
|
2057
2718
|
|
|
2719
|
+
// ══ Phase 87 87-04 — the column-axis analogs of windowedRows()/padTop()/padBottom()/
|
|
2720
|
+
// rowIsOutsideWindow() above. The column axis has no "row-shaped" identity to carry alongside
|
|
2721
|
+
// a VirtualItem (a column is not a full-model object the way a row is), so windowedColIndices()
|
|
2722
|
+
// returns bare ABSOLUTE leaf-column indices; the template resolves each index back to a header/
|
|
2723
|
+
// cell through the host's own header-group / visibleCellsFor lookups (D-08/D-09). ══
|
|
2724
|
+
|
|
2725
|
+
// windowedColIndices(): the ordered array of ABSOLUTE leaf-column indices to render.
|
|
2726
|
+
function windowedColIndices() {
|
|
2727
|
+
// SUBSCRIBE FIRST (the windowedRows() discipline): colVirtualizer is a non-reactive `let`,
|
|
2728
|
+
// null at first render, so a $data.windowVer read placed BELOW the guards below would mean
|
|
2729
|
+
// Solid's <For> / Svelte's {#each} accessors never subscribe — the column window would stay
|
|
2730
|
+
// blank forever on exactly those two targets. Also subscribe to editVer (mirrors the row
|
|
2731
|
+
// axis's pin/unpin re-derive — the D-10 forced-column union lands on top of this in 87-05).
|
|
2732
|
+
void windowVer();
|
|
2733
|
+
void editVer();
|
|
2734
|
+
if (!colsWindowed()) {
|
|
2735
|
+
// Columns OFF (or rows-only windowed) → every absolute index, the degrade-to-full-set
|
|
2736
|
+
// path that keeps the caller (windowedCells / the header loop) axis-agnostic.
|
|
2737
|
+
const n = columnCount();
|
|
2738
|
+
const out = [];
|
|
2739
|
+
for (let i = 0; i < n; i++) out.push(i);
|
|
2740
|
+
return out;
|
|
2741
|
+
}
|
|
2742
|
+
// Columns windowed but the column virtualizer is not yet constructed (pre-$onMount first
|
|
2743
|
+
// paint) → render NOTHING, matching windowedRows()'s pre-mount behavior.
|
|
2744
|
+
if (!colVirtualizer) return [];
|
|
2745
|
+
const items = colVirtualizer.getVirtualItems();
|
|
2746
|
+
const idx = items.map((it: any) => it.index);
|
|
2747
|
+
// D-10 forced-column union (host hook — empty array until 87-05 gives it a real body):
|
|
2748
|
+
// dedupe-then-append any forced index not already in the virtualized window.
|
|
2749
|
+
const forced = forcedColumns();
|
|
2750
|
+
for (let i = 0; i < forced.length; i++) {
|
|
2751
|
+
if (idx.indexOf(forced[i]) === -1) idx.push(forced[i]);
|
|
2752
|
+
}
|
|
2753
|
+
// Sorted ascending: the body <td> sequence and the header <th> sequence both follow visual
|
|
2754
|
+
// left-to-right order, and the virtual items + forced union are not guaranteed sorted.
|
|
2755
|
+
idx.sort((a: any, b: any) => a - b);
|
|
2756
|
+
return idx;
|
|
2757
|
+
}
|
|
2758
|
+
|
|
2759
|
+
// colPadLeft() / colPadRight() (D-06): the horizontal spacer <td>/<th> widths — the leading
|
|
2760
|
+
// spacer occupies items[0].start, the trailing spacer the gap between the last rendered
|
|
2761
|
+
// item's end and getTotalSize(). Mirrors padTop()/padBottom() exactly, INCLUDING the D-02-style
|
|
2762
|
+
// pin subtraction (87-05): forcedColumns() can return MULTIPLE forced indices (pinned + active +
|
|
2763
|
+
// editing, not just one pin), so each forced index outside the virtual window is checked
|
|
2764
|
+
// individually. A forced column rendered outside the window contributes its OWN real width to
|
|
2765
|
+
// the row (via its <th>/<td>'s own inline width under table-layout:fixed), so that width must
|
|
2766
|
+
// come OUT of the spacer or the row's total overshoots getTotalSize() and the horizontal
|
|
2767
|
+
// scrollbar lengthens on every such scroll. WR-01: decide before/after the window by comparing
|
|
2768
|
+
// the forced INDEX against the window's first/last item INDEX, never by start-OFFSET —
|
|
2769
|
+
// measurement drift makes the offset comparison wrong for the variable-width case (mirrors
|
|
2770
|
+
// padBottom()'s existing WR-01 discipline). A forced column's width is columnSize(i) (the
|
|
2771
|
+
// table-core size oracle, D-06's authoritative source), never a DOM measurement.
|
|
2772
|
+
function colPadLeft() {
|
|
2773
|
+
void windowVer();
|
|
2774
|
+
void editVer();
|
|
2775
|
+
if (!colsWindowed() || !colVirtualizer) return 0;
|
|
2776
|
+
const items = colVirtualizer.getVirtualItems();
|
|
2777
|
+
let pad = items.length ? items[0].start : 0;
|
|
2778
|
+
if (items.length) {
|
|
2779
|
+
const firstIdx = items[0].index;
|
|
2780
|
+
const forced = forcedColumns();
|
|
2781
|
+
for (let i = 0; i < forced.length; i++) {
|
|
2782
|
+
if (forced[i] < firstIdx) pad = pad - columnSize(forced[i]);
|
|
2783
|
+
}
|
|
2784
|
+
}
|
|
2785
|
+
return pad < 0 ? 0 : pad;
|
|
2786
|
+
}
|
|
2787
|
+
function colPadRight() {
|
|
2788
|
+
void windowVer();
|
|
2789
|
+
void editVer();
|
|
2790
|
+
if (!colsWindowed() || !colVirtualizer) return 0;
|
|
2791
|
+
const items = colVirtualizer.getVirtualItems();
|
|
2792
|
+
if (!items.length) return 0;
|
|
2793
|
+
let pad = colVirtualizer.getTotalSize() - items[items.length - 1].end;
|
|
2794
|
+
const lastIdx = items[items.length - 1].index;
|
|
2795
|
+
const forced = forcedColumns();
|
|
2796
|
+
for (let i = 0; i < forced.length; i++) {
|
|
2797
|
+
if (forced[i] > lastIdx) pad = pad - columnSize(forced[i]);
|
|
2798
|
+
}
|
|
2799
|
+
return pad < 0 ? 0 : pad;
|
|
2800
|
+
}
|
|
2801
|
+
// colIsOutsideWindow(c): is the absolute leaf-column index c absent from the currently
|
|
2802
|
+
// rendered column window? The column-axis analog of rowIsOutsideWindow(r) (D-12's
|
|
2803
|
+
// scroll-then-focus seam, wired starting 87-06). Gated on colsWindowed() (never a bare prop
|
|
2804
|
+
// truthiness read — the 87-02 prohibition gate).
|
|
2805
|
+
function colIsOutsideWindow(c: any) {
|
|
2806
|
+
if (!colsWindowed() || !colVirtualizer) return false;
|
|
2807
|
+
const items = colVirtualizer.getVirtualItems();
|
|
2808
|
+
for (const it of items as any) if (it.index === c) return false;
|
|
2809
|
+
return true;
|
|
2810
|
+
}
|
|
2811
|
+
|
|
2812
|
+
// afterRowRemeasure (Phase 87 87-07, D-15): a mutable-`let` indirection so
|
|
2813
|
+
// virtualization.rzts's remeasureWindow() (a relative-partial CONST, textually EARLIER
|
|
2814
|
+
// than windowing.rzts in the merged per-target output) can trigger the shared engine's
|
|
2815
|
+
// post-measurement fold + hysteresis re-feed (refineRowEstimate(), windowing.rzts) without
|
|
2816
|
+
// calling a bare-specifier-partial CONST directly — the exact forward-reference TDZ class
|
|
2817
|
+
// remeasureColumnWindow()'s own comment below documents for columnVirtualizerOptions(). A
|
|
2818
|
+
// mutable `let` hoists to `useRef` on React and never enters a useCallback's dependency
|
|
2819
|
+
// array, sidestepping the hazard there.
|
|
2820
|
+
//
|
|
2821
|
+
// DECLARED HERE — a plain top-level statement placed AFTER both import lines above, NOT
|
|
2822
|
+
// grouped with the other windowing `let`s near the top of this file, and NOT deferred into
|
|
2823
|
+
// $onMount. Two Rule-1 bugs were found and fixed in this exact spot this task, both via the
|
|
2824
|
+
// VR suite:
|
|
2825
|
+
// (a) A top-level `let X = refineRowEstimate` placed BEFORE the import statements (where
|
|
2826
|
+
// the other windowing `let`s live) reads a windowing.rzts symbol at its OWN
|
|
2827
|
+
// declaration's evaluation time. React's own emitter re-groups DataTable.rozie's
|
|
2828
|
+
// entire top-level script AFTER both inlined partials regardless of source position,
|
|
2829
|
+
// so it tolerated that placement — but Vue/Svelte/Solid/Angular/Lit splice each
|
|
2830
|
+
// partial's content at its IMPORT STATEMENT's source position, so a `let` positioned
|
|
2831
|
+
// BEFORE the import genuinely executes before `refineRowEstimate` exists:
|
|
2832
|
+
// `ReferenceError: Cannot access 'refineRowEstimate' before initialization`. Moving the
|
|
2833
|
+
// declaration to AFTER the windowing.rzts import fixes every non-React target — the
|
|
2834
|
+
// splice has already run by this point in the source.
|
|
2835
|
+
// (b) Deferring the assignment into $onMount instead (`afterRowRemeasure = refineRowEstimate`
|
|
2836
|
+
// inside the mount body, mirroring `refreshRowModel`) fixed (a) but broke REACT: it
|
|
2837
|
+
// triggered the react emitter's mount-referenced-helper stable-ref synthesis for
|
|
2838
|
+
// `refineRowEstimate` (a NEW code path for a plain script helper, not the `$computed`
|
|
2839
|
+
// case that mechanism was built for), producing a genuine
|
|
2840
|
+
// `ReferenceError: Cannot access '...' before initialization` in the component's
|
|
2841
|
+
// render body. Reverted; the emitter path itself is out of this plan's scope.
|
|
2842
|
+
// This placement (top-level, immediately after the windowing.rzts import) is therefore the
|
|
2843
|
+
// ONE spot that is simultaneously safe for React (unaffected by source position) and every
|
|
2844
|
+
// other target (past the import-position splice).
|
|
2845
|
+
let afterRowRemeasure = refineRowEstimate;
|
|
2846
|
+
|
|
2058
2847
|
// ── Sort/filter live-announcement (#14) ─────────────────────────────────────────────
|
|
2059
2848
|
// A polite aria-live announcement whenever the consumer changes sorting or filtering, so a
|
|
2060
2849
|
// screen-reader user hears that the rows were reordered / narrowed (which is otherwise silent).
|
|
@@ -2262,10 +3051,18 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
2262
3051
|
|
|
2263
3052
|
// Template helpers reading the resolved column-def metadata by id (plain fns — used
|
|
2264
3053
|
// in template predicates + interpolation; uniform on all 6, no $computed alias trap).
|
|
3054
|
+
// B1 (quick 260906-afh): reads the O(1) def-lookup index (defIndex(), columnBuilders.rzts)
|
|
3055
|
+
// instead of linearly scanning columnDefs() — which only ever held TOP-LEVEL entries, so a
|
|
3056
|
+
// NESTED group leaf (a `columns:` group child) was invisible to every caller (headerLabel,
|
|
3057
|
+
// columnIsFilterable, editMetaOf/columnEditable/editorTypeOf/editorOptionsOf) and silently
|
|
3058
|
+
// took the "no def" fallback. defIndex() resolves both top-level AND nested leaf ids. This
|
|
3059
|
+
// also removes the per-cell O(N) scan D-23 left in place — defIndex() is memoized in the
|
|
3060
|
+
// SAME cache-invalidation block as columnDefs() itself, never rebuilt per call.
|
|
2265
3061
|
function defFor(colId: any) {
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
3062
|
+
if (colId == null) return null;
|
|
3063
|
+
const idx = defIndex();
|
|
3064
|
+
const d = idx[String(colId)];
|
|
3065
|
+
return d != null ? d : null;
|
|
2269
3066
|
}
|
|
2270
3067
|
// Per-row visible cells for the body loop. table-core memoizes row objects by id,
|
|
2271
3068
|
// so a re-pull after a column change (visibility/reorder/pin, or the late <Column>
|
|
@@ -2618,6 +3415,16 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
2618
3415
|
function rowIsGrouped(row: any) {
|
|
2619
3416
|
return !!(tick() >= 0 && row && row.getIsGrouped && row.getIsGrouped());
|
|
2620
3417
|
}
|
|
3418
|
+
// rowIndexIsGrouped (quick 260906-cvo, C1/C2): THE single row-level editability/writability
|
|
3419
|
+
// predicate — a group-header row is a SYNTHETIC row whose `original` is table-core's
|
|
3420
|
+
// `leafRows[0].original` (the same fact cellSlotRow's header comment documents), so any
|
|
3421
|
+
// edit or bulk write resolved through it silently lands on an UNRELATED record. Every edit/
|
|
3422
|
+
// write guard in this component calls THIS predicate — never a re-implemented inline
|
|
3423
|
+
// `getIsGrouped()` check — so the invariant has one definition. Indexes into the SAME
|
|
3424
|
+
// `$data.rows` flattened row list rowIsGrouped reads.
|
|
3425
|
+
function rowIndexIsGrouped(rowIndex: any) {
|
|
3426
|
+
return rowIsGrouped((rows() || [])[rowIndex]);
|
|
3427
|
+
}
|
|
2621
3428
|
// groupingActive: grouping is currently engaged (a non-empty ordered key list). Drives the
|
|
2622
3429
|
// data-group-leaf marker so it is ABSENT when ungrouped (byte-identical-off, req-10).
|
|
2623
3430
|
function groupingActive() {
|
|
@@ -2633,22 +3440,100 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
2633
3440
|
function cellIsAggregated(cellCtx: any) {
|
|
2634
3441
|
return !!(tick() >= 0 && cellCtx && cellCtx.getIsAggregated && cellCtx.getIsAggregated());
|
|
2635
3442
|
}
|
|
2636
|
-
// cellIsPlaceholder:
|
|
2637
|
-
//
|
|
2638
|
-
//
|
|
2639
|
-
//
|
|
2640
|
-
//
|
|
3443
|
+
// cellIsPlaceholder: VERIFIED against @tanstack/table-core@8.21.3 (ColumnGrouping.js:120-121,
|
|
3444
|
+
// quick 260906-afh premise correction). A placeholder cell is a cell IN A GROUPING COLUMN
|
|
3445
|
+
// that is NOT the row's OWN grouping column — `!cell.getIsGrouped() && column.getIsGrouped()`.
|
|
3446
|
+
// That is true both on a group-header row (for every OTHER grouping column) and on every leaf
|
|
3447
|
+
// row (for every grouping column) — it is NOT "never true on a group-header row" and it is NOT
|
|
3448
|
+
// "any non-grouped, non-aggregated cell". The operative consequence for this component: a
|
|
3449
|
+
// placeholder can only EVER be a grouping-column cell, so this branch can never reach a
|
|
3450
|
+
// non-grouping column — it does NOT and CANNOT guard the AGGREGATED-cell `row` leak
|
|
3451
|
+
// (cellSlotRow, below) fixes. Where it DOES apply (e.g. under multi-level grouping, the
|
|
3452
|
+
// OTHER grouping column on a group-header row), table-core still fills cell.getValue() with
|
|
3453
|
+
// the FIRST leaf row's value (cell.getValue() leaks e.g. "Oslo" onto a region-level group
|
|
3454
|
+
// line whose grouping is 'region', not 'city'); this branch renders BLANK via a dedicated
|
|
3455
|
+
// empty template so that leaked value never paints. Tick-gated exactly like cellIsGrouped so
|
|
3456
|
+
// the group chrome re-derives on a re-pull on the fine-grained targets (Solid/Lit).
|
|
2641
3457
|
function cellIsPlaceholder(cellCtx: any) {
|
|
2642
3458
|
return !!(tick() >= 0 && cellCtx && cellCtx.getIsPlaceholder && cellCtx.getIsPlaceholder());
|
|
2643
3459
|
}
|
|
2644
|
-
// groupSubRowCount: the number of underlying LEAF RECORDS under a group-header row (the
|
|
2645
|
-
// shown in the header, e.g. "North (40)"). row.subRows is the IMMEDIATE members — for
|
|
2646
|
-
// grouping those are sub-GROUPS, not records, so "North" with 2 categories / 40
|
|
2647
|
-
// "North (2)"
|
|
2648
|
-
// subRows
|
|
2649
|
-
//
|
|
3460
|
+
// groupSubRowCount: the number of underlying TRUE LEAF RECORDS under a group-header row (the
|
|
3461
|
+
// count shown in the header, e.g. "North (40)"). row.subRows is the IMMEDIATE members — for
|
|
3462
|
+
// MULTI-LEVEL grouping those are sub-GROUPS, not records, so "North" with 2 categories / 40
|
|
3463
|
+
// records would show "North (2)" off subRows alone. row.getLeafRows() is table-core's
|
|
3464
|
+
// `flattenBy(row.subRows, d => d.subRows)` (ColumnGrouping.js / utils.js, verified against
|
|
3465
|
+
// @tanstack/table-core@8.21.3) — it pushes EVERY node it walks, INCLUDING intermediate group
|
|
3466
|
+
// nodes, so under multi-level grouping it over-counts by exactly the number of sub-group
|
|
3467
|
+
// nodes between the row and its true leaves (C4, quick 260906-cvo: North with 2 city
|
|
3468
|
+
// sub-groups + 3 records reported 5, not 3). `row.getIsGrouped()` is `!!row.groupingColumnId`
|
|
3469
|
+
// — precisely the predicate that separates a group node from a real record — so filter the
|
|
3470
|
+
// flattened list on it rather than hand-rolling a recursive `subRows` walk (getLeafRows()
|
|
3471
|
+
// already flattens; the defect is purely that it does not filter). Single-level grouping is
|
|
3472
|
+
// numerically UNCHANGED: a leaf row has no `subRows`, so no node was ever miscounted there.
|
|
2650
3473
|
function groupSubRowCount(row: any) {
|
|
2651
|
-
|
|
3474
|
+
if (row && row.getLeafRows) {
|
|
3475
|
+
const leaves = row.getLeafRows();
|
|
3476
|
+
let n = 0;
|
|
3477
|
+
for (let i = 0; i < leaves.length; i++) {
|
|
3478
|
+
const r = leaves[i];
|
|
3479
|
+
if (!(r && r.getIsGrouped && r.getIsGrouped())) n = n + 1;
|
|
3480
|
+
}
|
|
3481
|
+
return n;
|
|
3482
|
+
}
|
|
3483
|
+
return row && row.subRows ? row.subRows.length : 0;
|
|
3484
|
+
}
|
|
3485
|
+
|
|
3486
|
+
// ── B2 (quick 260906-afh) — group-header row #cell slot descriptor ─────────────────────
|
|
3487
|
+
// PROBLEM: table-core builds a flattened group-header row via
|
|
3488
|
+
// `createRow(table, id, leafRows[0].original, …)` (getGroupedRowModel.js), so `row.original`
|
|
3489
|
+
// on a group row IS the FIRST LEAF's record. The #cell scoped slot's existing 4 call sites
|
|
3490
|
+
// all bound `:row="row.original"` (or `wr.row.original`), so an AGGREGATED cell (a
|
|
3491
|
+
// non-grouping column on a group row — cellIsGrouped()===false, cellIsPlaceholder()===false,
|
|
3492
|
+
// so it takes the #cell r-else branch, same as any ordinary leaf cell) silently handed a
|
|
3493
|
+
// consumer template the WRONG record's fields (T-AFH-05). The grouped cell itself (the
|
|
3494
|
+
// group's own column, .rdt-group-value) has the same #cell binding and the same leak.
|
|
3495
|
+
//
|
|
3496
|
+
// FIX: `cellSlotRow(row)` returns a STABLE GROUP DESCRIPTOR — never `row.original` — for a
|
|
3497
|
+
// group-header row, and `row.original` unchanged for every other row. The descriptor is an
|
|
3498
|
+
// OBJECT, never `null` (T-AFH-06 — a consumer already reading `row.foo` would throw on
|
|
3499
|
+
// Vue/Angular if handed null).
|
|
3500
|
+
//
|
|
3501
|
+
// Descriptor cache (T-AFH-02/T-AFH-04): a null-prototype map keyed on `String(row.id)`,
|
|
3502
|
+
// invalidated wholesale whenever `$data.rowModelVer` (bumped by every refreshRowModel, the
|
|
3503
|
+
// SAME reactive re-derivation discipline visibleCellsFor/rowIsGrouped use) differs from the
|
|
3504
|
+
// generation the map was built for — so the descriptor's REFERENCE IDENTITY is stable
|
|
3505
|
+
// across every cell of one group row within a row-model generation (an unstable reference
|
|
3506
|
+
// would thrash the fine-grained targets, Solid/Lit) and refreshed the moment the grouping
|
|
3507
|
+
// changes. Group row ids are built from consumer grouping VALUES, so the map MUST be
|
|
3508
|
+
// null-prototype — a `__proto__` grouping value must not reach Object.prototype.
|
|
3509
|
+
let groupRowDescriptorCache: any = null;
|
|
3510
|
+
let groupRowDescriptorCacheVer: any = undefined;
|
|
3511
|
+
function groupRowDescriptor(row: any) {
|
|
3512
|
+
const ver = rowModelVer();
|
|
3513
|
+
if (!groupRowDescriptorCache || groupRowDescriptorCacheVer !== ver) {
|
|
3514
|
+
groupRowDescriptorCache = Object.create(null);
|
|
3515
|
+
groupRowDescriptorCacheVer = ver;
|
|
3516
|
+
}
|
|
3517
|
+
const key = String(row.id);
|
|
3518
|
+
let d = groupRowDescriptorCache[key];
|
|
3519
|
+
if (!d) {
|
|
3520
|
+
const groupingColumnId = row.groupingColumnId != null ? row.groupingColumnId : '';
|
|
3521
|
+
const groupingValue = row.getGroupingValue ? row.getGroupingValue(groupingColumnId) : row.groupingValue;
|
|
3522
|
+
d = {
|
|
3523
|
+
isGroupRow: true,
|
|
3524
|
+
groupId: row.id,
|
|
3525
|
+
groupingColumnId,
|
|
3526
|
+
groupingValue,
|
|
3527
|
+
leafCount: groupSubRowCount(row)
|
|
3528
|
+
};
|
|
3529
|
+
groupRowDescriptorCache[key] = d;
|
|
3530
|
+
}
|
|
3531
|
+
return d;
|
|
3532
|
+
}
|
|
3533
|
+
// cellSlotRow: the #cell slot's `:row=` value. A group-header row gets the stable
|
|
3534
|
+
// descriptor above (never the leaked first-leaf record); every other row is unchanged.
|
|
3535
|
+
function cellSlotRow(row: any) {
|
|
3536
|
+
return rowIsGrouped(row) ? groupRowDescriptor(row) : row ? row.original : null;
|
|
2652
3537
|
}
|
|
2653
3538
|
// groupingKeys: the live ordered grouping array — slot prop for the headless #groupBar + the
|
|
2654
3539
|
// default styled-token reflection. Reads currentState() ($props.grouping ?? $data.groupingDefault),
|
|
@@ -2656,14 +3541,18 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
2656
3541
|
function groupingKeys() {
|
|
2657
3542
|
return currentState().grouping || [];
|
|
2658
3543
|
}
|
|
2659
|
-
// groupableColumns: the data columns OFFERED to the headless #groupBar
|
|
2660
|
-
//
|
|
2661
|
-
//
|
|
3544
|
+
// groupableColumns: the data columns OFFERED to the headless #groupBar — `[{ id, label }]`.
|
|
3545
|
+
// Excludes the chrome columns (select/expander are not in columnDefs()). C5+C6 (quick
|
|
3546
|
+
// 260906-cvo): delegates the actual walk to collectGroupableLeafDefs (columnDefUtils.ts) —
|
|
3547
|
+
// a GROUP column (a `columns:` group's own entry) is NEVER offered (it has no accessor and
|
|
3548
|
+
// cannot produce a grouping value, regardless of any `groupable` flag on it), and every
|
|
3549
|
+
// groupable NESTED leaf (a `columns:` group child, opted out via `groupable: false` like any
|
|
3550
|
+
// top-level leaf) IS offered, in declaration order. The consumer builds any bar/drag UI from
|
|
3551
|
+
// this; the component ships none.
|
|
2662
3552
|
function groupableColumns() {
|
|
2663
3553
|
const out = [];
|
|
2664
|
-
const defs = columnDefs();
|
|
3554
|
+
const defs = collectGroupableLeafDefs(columnDefs());
|
|
2665
3555
|
for (const d of defs as any) {
|
|
2666
|
-
if (!d || d.groupable === false) continue;
|
|
2667
3556
|
out.push({
|
|
2668
3557
|
id: d.id,
|
|
2669
3558
|
label: d.header != null ? d.header : d.id
|
|
@@ -2822,7 +3711,7 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
2822
3711
|
// or inherited Lit DOM method named getRowIndexRelativeToPage (ROZ121/124/137 clear).
|
|
2823
3712
|
function getRowIndexRelativeToPage(absRow: any) {
|
|
2824
3713
|
const abs = absRow == null ? toAbsRow(activeRow()) : Math.trunc(Number(absRow)) || 0;
|
|
2825
|
-
if (
|
|
3714
|
+
if (rowsWindowed()) return abs;
|
|
2826
3715
|
return abs - pageRowOffset();
|
|
2827
3716
|
}
|
|
2828
3717
|
|
|
@@ -2843,12 +3732,6 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
2843
3732
|
// DataTable.rozie) — so DataTable.rozie's $expose references them BY NAME with zero
|
|
2844
3733
|
// indirection. This file stays the seam for verbs that need a rename/adapter, not a mandatory
|
|
2845
3734
|
// stop for every $expose entry.
|
|
2846
|
-
// ══ Grid interaction mode (phase 49) — STATE + STRUCTURE only ═══════════════════════════
|
|
2847
|
-
// This plan (02) establishes the gated ARIA roles, the roving single-tab-stop tabindex,
|
|
2848
|
-
// the active-cell index-pair state, the data-* cell markers, and the SINGLE
|
|
2849
|
-
// focusActiveCell() seam. Plan 03 adds the keydown navigation math, the $expose verbs
|
|
2850
|
-
// (focusCell/getActiveCell/clearActiveCell), and the activecell-change event ON TOP.
|
|
2851
|
-
|
|
2852
3735
|
// interactionMode gate. 'grid' lights up roving nav; 'table' (default) is byte-behaviorally
|
|
2853
3736
|
// identical to phase 48 (roles fall back to the literals, tabindex drops).
|
|
2854
3737
|
function isGrid() {
|
|
@@ -2893,7 +3776,7 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
2893
3776
|
// isGrid()-gated (the active-cell API is grid-only); pageIndex()/pageSize() read live table-core
|
|
2894
3777
|
// state through the reactive tick (filterPaginationRowChrome), so this re-derives on a page change.
|
|
2895
3778
|
function pageRowOffset() {
|
|
2896
|
-
if (!isGrid() ||
|
|
3779
|
+
if (!isGrid() || rowsWindowed()) return 0;
|
|
2897
3780
|
return pageIndex() * pageSize();
|
|
2898
3781
|
}
|
|
2899
3782
|
// page-relative active row → absolute (display-order) index.
|
|
@@ -2908,7 +3791,7 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
2908
3791
|
// In virtual mode $data.rows IS the full pre-pagination model (bodyRowCount suffices); in the
|
|
2909
3792
|
// non-virtual paginated body $data.rows is only the page slice, so read the live model.
|
|
2910
3793
|
function prePaginationRowCount() {
|
|
2911
|
-
if (!table ||
|
|
3794
|
+
if (!table || rowsWindowed()) return bodyRowCount();
|
|
2912
3795
|
const pm = table.getPrePaginationRowModel();
|
|
2913
3796
|
return pm && pm.rows ? pm.rows.length : bodyRowCount();
|
|
2914
3797
|
}
|
|
@@ -3014,24 +3897,37 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
3014
3897
|
// here returns the PRE-write value, resolving focus to the BODY cell instead of the
|
|
3015
3898
|
// header. Callers pass the fresh isHeader local; falls back to $data when omitted.
|
|
3016
3899
|
const header = nextIsHeader == null ? activeIsHeader() : nextIsHeader;
|
|
3017
|
-
// ── phase 53 scroll-then-focus (D-12): when windowing AND the target body row
|
|
3018
|
-
// rendered window, scroll it in first, then defer focus to AFTER the new
|
|
3019
|
-
// double-rAF — a single rAF can fire before React's async commit, Pitfall
|
|
3020
|
-
// in-window
|
|
3021
|
-
// The guard reads the resolved `header` (NOT the raw
|
|
3022
|
-
// while a header cell is active falls back to
|
|
3023
|
-
|
|
3024
|
-
|
|
3900
|
+
// ── phase 53 scroll-then-focus (D-12): when windowing AND the target body row and/or column
|
|
3901
|
+
// is OUTSIDE the rendered window, scroll it in first, then defer focus to AFTER the new
|
|
3902
|
+
// window commits (the double-rAF — a single rAF can fire before React's async commit, Pitfall
|
|
3903
|
+
// 4). Header cells and fully in-window cells keep the synchronous path below (table-mode /
|
|
3904
|
+
// non-windowed stay byte-stable). The guard reads the resolved `header` (NOT the raw
|
|
3905
|
+
// `nextIsHeader`) so an omitted-arg call while a header cell is active falls back to
|
|
3906
|
+
// $data.activeIsHeader and skips the scroll path.
|
|
3907
|
+
// Phase 87 87-06 (D-12): widened to the SECOND axis — colIsOutsideWindow(c)/colsWindowed()
|
|
3908
|
+
// mirror rowIsOutsideWindow(r)/rowsWindowed() exactly (both landed in windowing.rzts in
|
|
3909
|
+
// 87-04). Either axis being out triggers the scroll+poll; both scrollToIndex calls fire when
|
|
3910
|
+
// both are out, and the ONE existing poll below is reused unchanged — it already resolves the
|
|
3911
|
+
// target cell by BOTH (row, col) via resolveCellEl(String(r), c), so a cell that becomes
|
|
3912
|
+
// reachable via the column axis needs no new poll logic (per the plan's own key_links note).
|
|
3913
|
+
const rowOut = rowsWindowed() && virtualizer && rowIsOutsideWindow(r);
|
|
3914
|
+
const colOut = colsWindowed() && colVirtualizer && colIsOutsideWindow(c);
|
|
3915
|
+
if (!header && (rowOut || colOut)) {
|
|
3916
|
+
if (rowOut) virtualizer.scrollToIndex(r, {
|
|
3917
|
+
align: 'center'
|
|
3918
|
+
});
|
|
3919
|
+
if (colOut) colVirtualizer.scrollToIndex(c, {
|
|
3025
3920
|
align: 'center'
|
|
3026
3921
|
});
|
|
3027
3922
|
// Bounded rAF-poll-until-cell-present (D-12): scrollToIndex → virtual-core onChange → windowVer
|
|
3028
|
-
// bump → the framework commits the scrolled-in row. On React that commit is async
|
|
3029
|
-
// reconcile) and for a far scroll (e.g. row 4000
|
|
3030
|
-
// fires BEFORE resolveCellEl can find the cell,
|
|
3031
|
-
// React off-window-focus failure). Poll
|
|
3032
|
-
// fast-committing targets resolve on the first
|
|
3033
|
-
// across the few frames its async commit needs.
|
|
3034
|
-
// cannot re-introduce the remeasure-vs-scroll
|
|
3923
|
+
// bump → the framework commits the scrolled-in row/column. On React that commit is async
|
|
3924
|
+
// (setState → reconcile) and for a far scroll (e.g. row 4000, or col 55 on a 60-col table)
|
|
3925
|
+
// spans several frames — a one-shot double-rAF fires BEFORE resolveCellEl can find the cell,
|
|
3926
|
+
// so focus is silently lost (the deterministic React off-window-focus failure). Poll
|
|
3927
|
+
// resolveCellEl for up to ~30 frames: the five fast-committing targets resolve on the first
|
|
3928
|
+
// attempt (behavior unchanged), React retries across the few frames its async commit needs.
|
|
3929
|
+
// The poll ONLY focuses (never measures), so it cannot re-introduce the remeasure-vs-scroll
|
|
3930
|
+
// fight. Inside the rowOut||colOut guard only.
|
|
3035
3931
|
let focusAttempts = 0;
|
|
3036
3932
|
// #9: capture the epoch AFTER this call's own bump (above) so the poll never aborts itself
|
|
3037
3933
|
// (its captured value equals the current epoch). A LATER focusActiveCell / focusCell /
|
|
@@ -3129,9 +4025,6 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
3129
4025
|
function bodyRowCount() {
|
|
3130
4026
|
return (rows() || []).length;
|
|
3131
4027
|
}
|
|
3132
|
-
function clamp(v: any, lo: any, hi: any) {
|
|
3133
|
-
return v < lo ? lo : v > hi ? hi : v;
|
|
3134
|
-
}
|
|
3135
4028
|
|
|
3136
4029
|
// ── Multi-level (grouped) header addressing (B12) ──────────────────────────────────────
|
|
3137
4030
|
// $data.headerGroups is ordered top→bottom; the LEAF header row (the one adjacent to the
|
|
@@ -3371,13 +4264,6 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
3371
4264
|
return resolveCellEl(rowKey, activeColIndex(), activeIsHeader() ? activeHeaderLevel() : null);
|
|
3372
4265
|
}
|
|
3373
4266
|
|
|
3374
|
-
// The focusable descendants of a cell (non-disabled), in DOM order. Pure DOM — uniform ×6.
|
|
3375
|
-
function focusables(cellEl: any) {
|
|
3376
|
-
if (!cellEl || !cellEl.querySelectorAll) return [];
|
|
3377
|
-
const list = Array.prototype.slice.call(cellEl.querySelectorAll('button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])'));
|
|
3378
|
-
return list.filter((n: any) => !n.disabled);
|
|
3379
|
-
}
|
|
3380
|
-
|
|
3381
4267
|
// Enter/F2 → enter interaction mode: focus the active cell's FIRST interactive control
|
|
3382
4268
|
// (D-07 — uniform for header sort buttons and body controls; Enter does NOT sort directly).
|
|
3383
4269
|
// No-op (stay in navigation mode) if the cell has no focusable control.
|
|
@@ -3681,11 +4567,18 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
3681
4567
|
return;
|
|
3682
4568
|
}
|
|
3683
4569
|
// ── C2 (phase 63 wave-8): Enter on a GROUP-HEADER cell toggles that group's collapse/
|
|
3684
|
-
// expand (APG treegrid).
|
|
3685
|
-
//
|
|
3686
|
-
//
|
|
3687
|
-
//
|
|
3688
|
-
//
|
|
4570
|
+
// expand (APG treegrid). C1 (quick 260906-cvo) CORRECTION: the comment here used to claim
|
|
4571
|
+
// "a group cell is non-editable" as "the verified invariant" — that was FALSE AS WRITTEN.
|
|
4572
|
+
// It held only for the grouping column's OWN cell (cellIsGrouped's branch renders before
|
|
4573
|
+
// the editor branch); a non-grouping EDITABLE column's cell on a group row fell straight
|
|
4574
|
+
// through the branch chain to isEditing(...) and opened an editor (the C1 defect this
|
|
4575
|
+
// quick task closed). What is now TRUE, and WHY: isActiveCellEditable() carries an
|
|
4576
|
+
// explicit rowIndexIsGrouped(...) row guard (filterPaginationRowChrome.rzts), so EVERY
|
|
4577
|
+
// editable column's cell on a group row is non-editable — that is what makes the four
|
|
4578
|
+
// edit-entry branches above fall through to this one, not an incidental property of the
|
|
4579
|
+
// grouping column alone. Route it to the SAME onToggleExpand path the chevron uses (group
|
|
4580
|
+
// rows ride the expand model) so one Enter toggles the group. Body cells only (a
|
|
4581
|
+
// header-active Enter is unchanged);
|
|
3689
4582
|
// ($data.rows || [])[$data.activeRow] is the active flattened row (page-relative non-virtual /
|
|
3690
4583
|
// full-model virtual — both index $data.rows). Placed BEFORE the reserved enterControl branch.
|
|
3691
4584
|
else if (key === 'Enter' && !activeIsHeader() && rowIsGrouped((rows() || [])[activeRow()])) {
|
|
@@ -4087,6 +4980,75 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
4087
4980
|
}
|
|
4088
4981
|
}
|
|
4089
4982
|
|
|
4983
|
+
// ══ Phase 87 87-04/87-05 — column-axis template windowing (D-06/D-11; declared HERE (after
|
|
4984
|
+
// the columnChrome/gridFocusNav imports above) so a forward cross-partial reference to
|
|
4985
|
+
// colsWindowed()/windowedColIndices() in the merged per-target output never TDZs on React —
|
|
4986
|
+
// the 87-02 useCallback-deps-array ordering lesson, the SAME reason remeasureColumnWindow()
|
|
4987
|
+
// below stays out of virtualization.rzts). ══
|
|
4988
|
+
// windowedHeadersFor(hg, hgLevel) (87-05): generalizes 87-04's windowedHeaderRow() (leaf-level
|
|
4989
|
+
// only) to EVERY header level with a CLAMPED colspan (D-11). A header spans the CONTIGUOUS run
|
|
4990
|
+
// of leaf-column indices [cursor, cursor + header.colSpan) — table-core lays out every header
|
|
4991
|
+
// level's `headers` array left-to-right over the SAME full leaf-column order, so walking a
|
|
4992
|
+
// running cursor by each header's OWN colSpan reconstructs its absolute leaf range with no
|
|
4993
|
+
// extra table-core calls. Intersect that range with windowedColIndices() (which already unions
|
|
4994
|
+
// the D-10 forced set): a header whose intersection is EMPTY is dropped entirely (a group
|
|
4995
|
+
// wholly outside the window renders no <th> at all — D-11); otherwise it is emitted as
|
|
4996
|
+
// { header, span } with span = the intersection SIZE (the clamp). Degrades to hg.headers
|
|
4997
|
+
// UNCHANGED (span = the header's own colSpan, or 1) when columns are not windowed — the
|
|
4998
|
+
// off-path the template's `:colspan="wh.span > 1 ? wh.span : null"` binding preserves
|
|
4999
|
+
// byte-identically (a bare colspan="1" would change the emitted markup on the unwindowed path).
|
|
5000
|
+
function windowedHeadersFor(hg: any, hgLevel: any) {
|
|
5001
|
+
const headers = hg && hg.headers || [];
|
|
5002
|
+
if (!colsWindowed()) {
|
|
5003
|
+
return headers.map((h: any) => ({
|
|
5004
|
+
header: h,
|
|
5005
|
+
span: h && h.colSpan > 1 ? h.colSpan : 1
|
|
5006
|
+
}));
|
|
5007
|
+
}
|
|
5008
|
+
const idx = windowedColIndices();
|
|
5009
|
+
const idxSet = {};
|
|
5010
|
+
for (let i = 0; i < idx.length; i++) idxSet[idx[i]] = true;
|
|
5011
|
+
let cursor = 0;
|
|
5012
|
+
const out = [];
|
|
5013
|
+
for (let i = 0; i < headers.length; i++) {
|
|
5014
|
+
const h = headers[i];
|
|
5015
|
+
const leafCount = h && h.colSpan ? h.colSpan : 1;
|
|
5016
|
+
const start = cursor;
|
|
5017
|
+
const end = cursor + leafCount;
|
|
5018
|
+
cursor = end;
|
|
5019
|
+
let span = 0;
|
|
5020
|
+
for (let c = start; c < end; c++) if (idxSet[c]) span = span + 1;
|
|
5021
|
+
if (span > 0) out.push({
|
|
5022
|
+
header: h,
|
|
5023
|
+
span
|
|
5024
|
+
});
|
|
5025
|
+
}
|
|
5026
|
+
return out;
|
|
5027
|
+
}
|
|
5028
|
+
// windowedColSpan(): the body row's rendered <td> COUNT under column windowing — the windowed
|
|
5029
|
+
// cell slice length plus the two rdt-col-spacer cells, so the leading/trailing full-row spacer
|
|
5030
|
+
// <tr>s and the #detail <tr> span the SAME column count the body row actually renders (D-06/
|
|
5031
|
+
// D-11's alignment obligation under table-layout:fixed). Off → visibleColCount() unchanged
|
|
5032
|
+
// (byte-identical).
|
|
5033
|
+
function windowedColSpan() {
|
|
5034
|
+
return colsWindowed() ? windowedColIndices().length + 2 : visibleColCount();
|
|
5035
|
+
}
|
|
5036
|
+
// remeasureColumnWindow() (Phase 87 87-04): push a fresh column count/size into the SECOND
|
|
5037
|
+
// (horizontal) virtualizer on every row-model refresh — mirrors the row axis's
|
|
5038
|
+
// virtualizer.setOptions(virtualizerOptions()) + _willUpdate() re-feed in refreshRowModel, so a
|
|
5039
|
+
// runtime column-visibility/order/pinning change (all watched in the $watch list below) keeps
|
|
5040
|
+
// the column virtualizer's count in sync. Never a render helper (Pitfall 1); rides the EXISTING
|
|
5041
|
+
// refreshRowModel imperative re-feed cycle rather than adding a third scheduling path. Declared
|
|
5042
|
+
// HERE (DataTable.rozie's own script), not in virtualization.rzts — see that file's comment for
|
|
5043
|
+
// why: it must call columnVirtualizerOptions() (windowing.rzts), and a function inside
|
|
5044
|
+
// virtualization.rzts calling into windowing.rzts is a forward-reference TDZ on React (the
|
|
5045
|
+
// 87-02 predicate-layer lesson, one file-grouping boundary over).
|
|
5046
|
+
function remeasureColumnWindow() {
|
|
5047
|
+
if (!colsWindowed() || !colVirtualizer) return;
|
|
5048
|
+
colVirtualizer.setOptions(columnVirtualizerOptions());
|
|
5049
|
+
colVirtualizer._willUpdate();
|
|
5050
|
+
}
|
|
5051
|
+
|
|
4090
5052
|
// B6 (phase 63 wave-11) — "the active cell is parked on the empty-grid header fallback" control
|
|
4091
5053
|
// flag, written + read ONLY inside clampActiveCell (never bound in the template). It MUST be a
|
|
4092
5054
|
// plain component-scope `let` (React hoists to useRef), NOT a $data reactive field: clampActiveCell
|
|
@@ -4353,15 +5315,6 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
4353
5315
|
}
|
|
4354
5316
|
}
|
|
4355
5317
|
|
|
4356
|
-
// ══ Clipboard (TSV copy/paste) + drag-fill (phase 51 plan 04 / req-8 / D-03 / D-04) ══════
|
|
4357
|
-
// The async Clipboard API (grantPermissions confirmed in 51-01). Copy = range→TSV; paste =
|
|
4358
|
-
// TSV→cells under the D-03 skip rule (editable AND validator-passing cells only) with an
|
|
4359
|
-
// N-of-M aria-live announce + one cell-edit-commit per committed cell; drag-fill = value-copy
|
|
4360
|
-
// ONLY (D-04, NO series detection). T-51-01 (BLOCKING-high): pasted TSV is UNTRUSTED — every
|
|
4361
|
-
// cell is written as plain string DATA through the per-column validator and rendered via the
|
|
4362
|
-
// SAME {{ }}/rozieDisplay text path as #cell (never innerHTML / a template / a selector); the
|
|
4363
|
-
// cell-resolution query interpolates integer indices only (resolveCellEl, T-49-01).
|
|
4364
|
-
|
|
4365
5318
|
// announce(msg): write the polite aria-live PASTE-announce region (D-03 — "N of M cells
|
|
4366
5319
|
// pasted"). SEPARATE from the validation invalidMsg region (different semantics). '' clears it.
|
|
4367
5320
|
function announce(msg: any) {
|
|
@@ -4411,20 +5364,14 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
4411
5364
|
};
|
|
4412
5365
|
}
|
|
4413
5366
|
|
|
4414
|
-
// B10: escape a TSV field per the spreadsheet convention — a field containing a tab, a CR/LF,
|
|
4415
|
-
// or a double-quote is wrapped in double-quotes with internal quotes DOUBLED; an ordinary
|
|
4416
|
-
// field is emitted verbatim. parseTsv() unescapes symmetrically, so a cell carrying a tab /
|
|
4417
|
-
// newline / quote round-trips without smearing into adjacent cells (T-63-03-02).
|
|
4418
|
-
function escapeTsvField(s: any) {
|
|
4419
|
-
if (s.indexOf('\t') >= 0 || s.indexOf('\n') >= 0 || s.indexOf('\r') >= 0 || s.indexOf('"') >= 0) {
|
|
4420
|
-
return '"' + s.replace(/"/g, '""') + '"';
|
|
4421
|
-
}
|
|
4422
|
-
return s;
|
|
4423
|
-
}
|
|
4424
|
-
|
|
4425
5367
|
// rangeToTsv(): serialize the current range to TSV — rows joined by '\n', cells by '\t',
|
|
4426
5368
|
// reading each cell's value off the visible model by index (cellValueAt). A single active
|
|
4427
5369
|
// cell (no range) serializes that one cell. Each field is B10-escaped. Pure read — never writes.
|
|
5370
|
+
// C2 (quick 260906-cvo) — DELIBERATE NON-CHANGE: this is a READ, unlike applyGridToRange's
|
|
5371
|
+
// write funnel, and stays UNGUARDED for a group-header row on purpose. cellValueAt reads the
|
|
5372
|
+
// column's DISPLAYED aggregate value on a group row (table-core's cell.getValue()), which is
|
|
5373
|
+
// exactly what the user sees — serializing it is correct behavior, not a leak. Do not "fix"
|
|
5374
|
+
// this asymmetry; it is intentional.
|
|
4428
5375
|
function rangeToTsv() {
|
|
4429
5376
|
const box = normalizedRange();
|
|
4430
5377
|
const r0 = box ? box.r0 : activeRow();
|
|
@@ -4443,84 +5390,6 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
4443
5390
|
return lines.join('\n');
|
|
4444
5391
|
}
|
|
4445
5392
|
|
|
4446
|
-
// parseTsv(text): a TSV string → string[][] (rows of cells). Tolerates \r\n; a trailing
|
|
4447
|
-
// newline does not add a phantom empty row. Pure — produces plain string DATA only (T-51-01:
|
|
4448
|
-
// the cells are NEVER eval'd / interpolated into a selector / rendered as markup).
|
|
4449
|
-
function parseTsv(text: any) {
|
|
4450
|
-
const str = text != null ? String(text) : '';
|
|
4451
|
-
// CR-03: length guard BEFORE the parse — an empty string is a no-op, and a pathologically
|
|
4452
|
-
// large clipboard payload (>2M chars) is rejected outright (DoS-shaped input) before the
|
|
4453
|
-
// single-pass scan allocates a cell-per-character grid.
|
|
4454
|
-
if (str === '' || str.length > 2000000) return [];
|
|
4455
|
-
// B10: a quote-aware single-pass state machine (replaces the naive split, which corrupted a
|
|
4456
|
-
// cell containing a tab/newline). A field that OPENS with a double-quote is "quoted": tabs,
|
|
4457
|
-
// newlines, and doubled quotes ("") inside it are literal content until the closing quote;
|
|
4458
|
-
// an unquoted field ends at the next tab/newline. CR/LF and CRLF all delimit a row.
|
|
4459
|
-
const rows = [];
|
|
4460
|
-
let row = [];
|
|
4461
|
-
let field = '';
|
|
4462
|
-
let inQuotes = false;
|
|
4463
|
-
let i = 0;
|
|
4464
|
-
const n = str.length;
|
|
4465
|
-
while (i < n) {
|
|
4466
|
-
const ch = str[i];
|
|
4467
|
-
if (inQuotes) {
|
|
4468
|
-
if (ch === '"') {
|
|
4469
|
-
if (i + 1 < n && str[i + 1] === '"') {
|
|
4470
|
-
field = field + '"';
|
|
4471
|
-
i = i + 2;
|
|
4472
|
-
continue;
|
|
4473
|
-
}
|
|
4474
|
-
inQuotes = false;
|
|
4475
|
-
i = i + 1;
|
|
4476
|
-
continue;
|
|
4477
|
-
}
|
|
4478
|
-
field = field + ch;
|
|
4479
|
-
i = i + 1;
|
|
4480
|
-
continue;
|
|
4481
|
-
}
|
|
4482
|
-
if (ch === '"' && field === '') {
|
|
4483
|
-
inQuotes = true;
|
|
4484
|
-
i = i + 1;
|
|
4485
|
-
continue;
|
|
4486
|
-
}
|
|
4487
|
-
if (ch === '\t') {
|
|
4488
|
-
row.push(field);
|
|
4489
|
-
field = '';
|
|
4490
|
-
i = i + 1;
|
|
4491
|
-
continue;
|
|
4492
|
-
}
|
|
4493
|
-
if (ch === '\r') {
|
|
4494
|
-
if (i + 1 < n && str[i + 1] === '\n') i = i + 1;
|
|
4495
|
-
row.push(field);
|
|
4496
|
-
field = '';
|
|
4497
|
-
rows.push(row);
|
|
4498
|
-
row = [];
|
|
4499
|
-
i = i + 1;
|
|
4500
|
-
continue;
|
|
4501
|
-
}
|
|
4502
|
-
if (ch === '\n') {
|
|
4503
|
-
row.push(field);
|
|
4504
|
-
field = '';
|
|
4505
|
-
rows.push(row);
|
|
4506
|
-
row = [];
|
|
4507
|
-
i = i + 1;
|
|
4508
|
-
continue;
|
|
4509
|
-
}
|
|
4510
|
-
field = field + ch;
|
|
4511
|
-
i = i + 1;
|
|
4512
|
-
}
|
|
4513
|
-
// Flush the trailing field + row.
|
|
4514
|
-
row.push(field);
|
|
4515
|
-
rows.push(row);
|
|
4516
|
-
// Drop a single trailing empty row (a TSV that ends with a newline → a phantom [''] row).
|
|
4517
|
-
if (rows.length > 1) {
|
|
4518
|
-
const last = rows[rows.length - 1];
|
|
4519
|
-
if (last.length === 1 && last[0] === '') rows.pop();
|
|
4520
|
-
}
|
|
4521
|
-
return rows;
|
|
4522
|
-
}
|
|
4523
|
-
|
|
4524
5393
|
// copyRange(): write the current range as TSV to the clipboard (async). No-op when the
|
|
4525
5394
|
// async Clipboard API is unavailable (older/insecure contexts) — a copy is best-effort.
|
|
4526
5395
|
function copyRange() {
|
|
@@ -4556,11 +5425,22 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
4556
5425
|
for (let gr = 0; gr < grid.length; gr++) {
|
|
4557
5426
|
const r = originRow + gr;
|
|
4558
5427
|
if (r > maxRow) break;
|
|
5428
|
+
// C2 (quick 260906-cvo) — hoisted ONCE per ROW (never per cell): a group-header row's
|
|
5429
|
+
// `original` is table-core's `leafRows[0].original` (a synthetic row), so a write
|
|
5430
|
+
// resolved through it silently lands on an unrelated record. This ONE placement closes
|
|
5431
|
+
// pasteRange, cutRange, clearActiveRange AND fillRange — all four build a grid and hand
|
|
5432
|
+
// it to this single funnel, so guarding the four callers individually would be four
|
|
5433
|
+
// chances to miss one.
|
|
5434
|
+
const rowGrouped = rowIndexIsGrouped(r);
|
|
4559
5435
|
const cols = grid[gr] || [];
|
|
4560
5436
|
for (let gc = 0; gc < cols.length; gc++) {
|
|
4561
5437
|
const c = originCol + gc;
|
|
4562
5438
|
if (c > maxCol) break;
|
|
5439
|
+
// A group-row cell still counts toward `total` — it is a skipped TARGET, exactly like
|
|
5440
|
+
// a non-editable or validator-rejected cell — so the "N of M cells pasted" / "no cells
|
|
5441
|
+
// pasted" announce keeps its existing semantics (never silently under-reports M).
|
|
4563
5442
|
total = total + 1;
|
|
5443
|
+
if (rowGrouped) continue;
|
|
4564
5444
|
const colId = columnIdAt(r, c);
|
|
4565
5445
|
if (colId == null || !columnEditable(colId)) continue;
|
|
4566
5446
|
const rowObj = rowOriginalAt(r);
|
|
@@ -4613,43 +5493,6 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
4613
5493
|
return row ? row.id : null;
|
|
4614
5494
|
}
|
|
4615
5495
|
|
|
4616
|
-
// C3: tile a parsed clipboard `grid` (string[][]) to fill a destination `box` — the spreadsheet
|
|
4617
|
-
// paste-into-range semantics. The target rectangle is the MAX of the box dims and the source
|
|
4618
|
-
// dims per axis, so a SMALLER clipboard TILES across a LARGER selection (a single 1×1 cell fills
|
|
4619
|
-
// the whole range; a 2×2 block repeats — tiled[dr][dc] = src[dr % srcRows][dc % srcCols]), while a
|
|
4620
|
-
// clipboard LARGER than the selection pastes its full block from the top-left (preserving the
|
|
4621
|
-
// no-range "clipboard-sized block at the active cell" behavior — a 1×1 destBox + a 1×N clipboard
|
|
4622
|
-
// yields the full 1×N block, byte-for-byte the prior path). Pure — returns a fresh grid; applies
|
|
4623
|
-
// nothing. A ragged/short source row defaults the missing cell to '' (coerced per column on write).
|
|
4624
|
-
function tileGridToBox(grid: any, box: any) {
|
|
4625
|
-
const srcRows = grid.length;
|
|
4626
|
-
// srcCols is the MAX row width across ALL rows (not grid[0].length): a RAGGED clipboard
|
|
4627
|
-
// (a later row WIDER than the first, e.g. TSV "a\tb\nc\td\te") would otherwise never read
|
|
4628
|
-
// the extra column and silently drop those cells. A row SHORTER than srcCols tiles its
|
|
4629
|
-
// missing cells as '' (the `v != null ? v : ''` coercion below), never undefined.
|
|
4630
|
-
let srcCols = 0;
|
|
4631
|
-
for (let i = 0; i < srcRows; i++) {
|
|
4632
|
-
const w = grid[i] && grid[i].length ? grid[i].length : 0;
|
|
4633
|
-
if (w > srcCols) srcCols = w;
|
|
4634
|
-
}
|
|
4635
|
-
if (srcRows <= 0 || srcCols <= 0) return grid;
|
|
4636
|
-
const boxRows = box.r1 - box.r0 + 1;
|
|
4637
|
-
const boxCols = box.c1 - box.c0 + 1;
|
|
4638
|
-
const rows = boxRows > srcRows ? boxRows : srcRows;
|
|
4639
|
-
const cols = boxCols > srcCols ? boxCols : srcCols;
|
|
4640
|
-
const out = [];
|
|
4641
|
-
for (let r = 0; r < rows; r++) {
|
|
4642
|
-
const srcLine = grid[r % srcRows] || [];
|
|
4643
|
-
const line = [];
|
|
4644
|
-
for (let c = 0; c < cols; c++) {
|
|
4645
|
-
const v = srcLine[c % srcCols];
|
|
4646
|
-
line.push(v != null ? v : '');
|
|
4647
|
-
}
|
|
4648
|
-
out.push(line);
|
|
4649
|
-
}
|
|
4650
|
-
return out;
|
|
4651
|
-
}
|
|
4652
|
-
|
|
4653
5496
|
// pasteRange(): read TSV from the clipboard (async), parse it, TILE it over the destination
|
|
4654
5497
|
// (C3), and apply it anchored at the destination top-left under the D-03 skip rule. The grid is
|
|
4655
5498
|
// clamped to the grid bounds (T-51-02). A failed/empty read is a silent no-op.
|
|
@@ -4750,18 +5593,6 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
4750
5593
|
applyGridToRange(grid, r0, c0);
|
|
4751
5594
|
}
|
|
4752
5595
|
|
|
4753
|
-
// tileIndex(i, lo, hi): map an index into the inclusive [lo,hi] source span by TILING (repeat
|
|
4754
|
-
// the source block), handling indices below lo (negative offset) correctly. A 1-wide source
|
|
4755
|
-
// (lo===hi) always returns lo. Used by fillRange to resolve, per target cell, WHICH source
|
|
4756
|
-
// cell it copies — so each column copies its OWN source value down its OWN column.
|
|
4757
|
-
function tileIndex(i: any, lo: any, hi: any) {
|
|
4758
|
-
const span = hi - lo + 1;
|
|
4759
|
-
if (span <= 1) return lo;
|
|
4760
|
-
let k = (i - lo) % span;
|
|
4761
|
-
if (k < 0) k = k + span;
|
|
4762
|
-
return lo + k;
|
|
4763
|
-
}
|
|
4764
|
-
|
|
4765
5596
|
// fillRange(sourceBox): drag-fill (D-04 — VALUE-COPY ONLY, no series detection). B7: the fill
|
|
4766
5597
|
// SOURCE is the PRE-DRAG rectangle (`sourceBox`, captured at pointerdown before the drag grew
|
|
4767
5598
|
// the range); each target cell copies the source cell in its OWN column (and row, when the
|
|
@@ -4827,6 +5658,49 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
4827
5658
|
// but a mid-drag unmount would otherwise leak a pointermove/pointerup listener on document).
|
|
4828
5659
|
let fillDragMove: any = null;
|
|
4829
5660
|
let fillDragUp: any = null;
|
|
5661
|
+
// Phase 87 87-06 (D-13, T-87-06-02): the single rAF handle driving the fill-drag per-axis
|
|
5662
|
+
// edge auto-scroll — a module-`let` beside fillDragMove/fillDragUp (the `let table` precedent;
|
|
5663
|
+
// React hoists to useRef), cleared IDEMPOTENTLY in teardownFillDrag() so an interrupted gesture
|
|
5664
|
+
// never leaves an orphaned scroll loop running forever.
|
|
5665
|
+
let fillEdgeScrollRaf: any = null;
|
|
5666
|
+
// Phase 87 87-06 (D-13): per-axis edge-triggered auto-scroll for the fill drag.
|
|
5667
|
+
// FILL_EDGE_SCROLL_PX — the pixel distance from the scroll container's edge, on either axis,
|
|
5668
|
+
// that engages auto-scroll. 24px: comfortably wider than the fill handle's own hit target but
|
|
5669
|
+
// well inside a typical row/column size, so the gesture recognizably nears an edge before
|
|
5670
|
+
// scrolling engages (not so wide that an ordinary drag near the middle of the viewport
|
|
5671
|
+
// spuriously triggers it).
|
|
5672
|
+
const FILL_EDGE_SCROLL_PX = 24;
|
|
5673
|
+
// FILL_EDGE_SCROLL_STEP — pixels scrolled per animation frame while the pointer sits inside an
|
|
5674
|
+
// edge zone. A fixed step (not distance-proportional) keeps the scroll speed predictable and
|
|
5675
|
+
// the WR-01-style spacer/window math simple to reason about frame-to-frame.
|
|
5676
|
+
const FILL_EDGE_SCROLL_STEP = 16;
|
|
5677
|
+
|
|
5678
|
+
// edgeDelta(clientX, clientY): the per-frame (dx, dy) scroll delta for a pointer at the given
|
|
5679
|
+
// screen position, relative to the scroll container `gridScrollEl` already observed by the row
|
|
5680
|
+
// AND column virtualizers (D-03 — one shared `.rdt-scroll` wrapper for whichever axis/axes are
|
|
5681
|
+
// windowed). Each axis is independently gated on colsWindowed()/rowsWindowed() (never a bare
|
|
5682
|
+
// prop truthiness read — the 87-02 prohibition gate) so a drag near the left/right edge of a
|
|
5683
|
+
// row-only-windowed table (or vice versa) never scrolls an axis that has nothing to reveal.
|
|
5684
|
+
// Pure — reads no gesture state, only the live container rect + the windowing predicates.
|
|
5685
|
+
function edgeDelta(clientX: any, clientY: any) {
|
|
5686
|
+
if (!gridScrollEl) return {
|
|
5687
|
+
dx: 0,
|
|
5688
|
+
dy: 0
|
|
5689
|
+
};
|
|
5690
|
+
const rect = gridScrollEl.getBoundingClientRect();
|
|
5691
|
+
let dx = 0;
|
|
5692
|
+
let dy = 0;
|
|
5693
|
+
if (colsWindowed()) {
|
|
5694
|
+
if (clientX - rect.left < FILL_EDGE_SCROLL_PX) dx = -FILL_EDGE_SCROLL_STEP;else if (rect.right - clientX < FILL_EDGE_SCROLL_PX) dx = FILL_EDGE_SCROLL_STEP;
|
|
5695
|
+
}
|
|
5696
|
+
if (rowsWindowed()) {
|
|
5697
|
+
if (clientY - rect.top < FILL_EDGE_SCROLL_PX) dy = -FILL_EDGE_SCROLL_STEP;else if (rect.bottom - clientY < FILL_EDGE_SCROLL_PX) dy = FILL_EDGE_SCROLL_STEP;
|
|
5698
|
+
}
|
|
5699
|
+
return {
|
|
5700
|
+
dx,
|
|
5701
|
+
dy
|
|
5702
|
+
};
|
|
5703
|
+
}
|
|
4830
5704
|
function teardownFillDrag() {
|
|
4831
5705
|
if (typeof document !== 'undefined') {
|
|
4832
5706
|
if (fillDragMove) document.removeEventListener('pointermove', fillDragMove);
|
|
@@ -4835,6 +5709,15 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
4835
5709
|
fillDragMove = null;
|
|
4836
5710
|
fillDragUp = null;
|
|
4837
5711
|
fillDragging = false;
|
|
5712
|
+
// D-13 (T-87-06-02): idempotent cleanup of the edge-auto-scroll rAF loop — the SAME discipline
|
|
5713
|
+
// fillDragMove/fillDragUp already follow. Called both on a normal pointerup release AND at the
|
|
5714
|
+
// TOP of the next onFillHandlePointerDown (the #leak guard below), so an interrupted gesture
|
|
5715
|
+
// (pointer released off-window, context menu, alt-tab) can never leave a stray rAF scrolling
|
|
5716
|
+
// the table forever.
|
|
5717
|
+
if (fillEdgeScrollRaf != null) {
|
|
5718
|
+
if (typeof cancelAnimationFrame === 'function') cancelAnimationFrame(fillEdgeScrollRaf);
|
|
5719
|
+
fillEdgeScrollRaf = null;
|
|
5720
|
+
}
|
|
4838
5721
|
}
|
|
4839
5722
|
function cellIndexFromPoint(clientX: any, clientY: any) {
|
|
4840
5723
|
if (typeof document === 'undefined' || !document.elementFromPoint) return null;
|
|
@@ -4870,7 +5753,8 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
4870
5753
|
// pointerup was missed (pointer released off-window, context menu, alt-tab), the prior fillDrag's
|
|
4871
5754
|
// document pointermove/pointerup stay attached; overwriting fillDragMove/fillDragUp below would
|
|
4872
5755
|
// strand them (removeEventListener could never reach the old refs) → a permanent global
|
|
4873
|
-
// pointermove leak. teardownFillDrag is idempotent (no-op when nothing is attached)
|
|
5756
|
+
// pointermove leak. teardownFillDrag is idempotent (no-op when nothing is attached) — it ALSO
|
|
5757
|
+
// cancels any orphaned edge-auto-scroll rAF from the same prior gesture.
|
|
4874
5758
|
teardownFillDrag();
|
|
4875
5759
|
fillDragging = true;
|
|
4876
5760
|
// B7: snapshot the PRE-DRAG rectangle (the fill SOURCE) NOW, before pointermove grows the
|
|
@@ -4884,21 +5768,74 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
4884
5768
|
r: sourceBox.r1,
|
|
4885
5769
|
c: sourceBox.c1
|
|
4886
5770
|
} : null;
|
|
5771
|
+
// D-13: the pointer's LAST known screen position, updated on every real pointermove AND read
|
|
5772
|
+
// by the rAF loop below on every frame. The scroll loop must re-resolve the cell under this
|
|
5773
|
+
// FIXED screen point each frame — the pointer itself may not move at all while the user simply
|
|
5774
|
+
// holds it at the edge, but the content sliding beneath it means a DIFFERENT cell sits there
|
|
5775
|
+
// each frame, which is what must extend the range (this is the whole point of "edge-triggered
|
|
5776
|
+
// auto-scroll": a real pointermove would never fire on a stationary pointer).
|
|
5777
|
+
let lastClientX = 0;
|
|
5778
|
+
let lastClientY = 0;
|
|
5779
|
+
// applyPointAt: resolve the cell under (clientX, clientY) and extend the range to it if it is
|
|
5780
|
+
// a NEW cell (B20 dedup — unchanged from the pre-87-06 shape). Shared by both a real
|
|
5781
|
+
// pointermove and every frame of the edge-auto-scroll loop.
|
|
5782
|
+
const applyPointAt = (clientX: any, clientY: any) => {
|
|
5783
|
+
const cell = cellIndexFromPoint(clientX, clientY);
|
|
5784
|
+
if (cell && (!lastCell || cell.r !== lastCell.r || cell.c !== lastCell.c)) {
|
|
5785
|
+
lastCell = cell;
|
|
5786
|
+
setRangeFocus$local(cell.r, cell.c);
|
|
5787
|
+
}
|
|
5788
|
+
};
|
|
5789
|
+
// scrollStep: the single rAF loop (T-87-06-02) — reads the LAST known pointer position each
|
|
5790
|
+
// frame, scrolls the windowed axis/axes still within the edge threshold, then re-resolves the
|
|
5791
|
+
// cell now under that same screen point. Self-terminates (never reschedules) the moment the
|
|
5792
|
+
// gesture ends OR the pointer no longer sits in an edge zone — so leaving the edge, or a
|
|
5793
|
+
// pointerup, stops the scroll immediately with no lingering frame.
|
|
5794
|
+
const scrollStep = () => {
|
|
5795
|
+
if (!fillDragging) {
|
|
5796
|
+
fillEdgeScrollRaf = null;
|
|
5797
|
+
return;
|
|
5798
|
+
}
|
|
5799
|
+
const d = edgeDelta(lastClientX, lastClientY);
|
|
5800
|
+
if (d.dx === 0 && d.dy === 0) {
|
|
5801
|
+
fillEdgeScrollRaf = null;
|
|
5802
|
+
return;
|
|
5803
|
+
}
|
|
5804
|
+
if (gridScrollEl) {
|
|
5805
|
+
// T-87-06-03: direct scrollLeft/scrollTop writes — NEVER virtualizer.scrollToOffset /
|
|
5806
|
+
// colVirtualizer.scrollToOffset. A programmatic virtual-core scroll sets
|
|
5807
|
+
// virtualizer.scrollState, which remeasureWindow() bails on for as long as it is non-null;
|
|
5808
|
+
// a SUSTAINED auto-scroll driven through that API would suppress row remeasurement for the
|
|
5809
|
+
// whole gesture. scrollLeft/scrollTop are ordinary user-scroll-shaped writes (scrollState
|
|
5810
|
+
// stays null), so remeasureWindow() keeps observing recycled rows normally throughout.
|
|
5811
|
+
if (d.dx !== 0) gridScrollEl.scrollLeft = gridScrollEl.scrollLeft + d.dx;
|
|
5812
|
+
if (d.dy !== 0) gridScrollEl.scrollTop = gridScrollEl.scrollTop + d.dy;
|
|
5813
|
+
}
|
|
5814
|
+
applyPointAt(lastClientX, lastClientY);
|
|
5815
|
+
fillEdgeScrollRaf = requestAnimationFrame(scrollStep);
|
|
5816
|
+
};
|
|
4887
5817
|
const move = (ev: any) => {
|
|
4888
5818
|
if (!fillDragging) return;
|
|
4889
|
-
|
|
5819
|
+
lastClientX = ev.clientX;
|
|
5820
|
+
lastClientY = ev.clientY;
|
|
4890
5821
|
// B20: dedup by target cell. setRangeFocus emits range-change, so calling it on EVERY
|
|
4891
5822
|
// pointermove (the pointer fires many per cell) spams the event with identical payloads.
|
|
4892
5823
|
// Only extend (and emit) when the pointer enters a DIFFERENT cell than the last — lastCell
|
|
4893
5824
|
// seeds from the pre-drag bottom-right corner, so a move that stays on the source corner
|
|
4894
5825
|
// or re-enters the same cell is suppressed (the range is unchanged).
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
5826
|
+
applyPointAt(ev.clientX, ev.clientY);
|
|
5827
|
+
// D-13: start the edge-auto-scroll loop the FIRST time the pointer enters an edge zone
|
|
5828
|
+
// (idempotent — fillEdgeScrollRaf is only null when no loop is currently scheduled). The
|
|
5829
|
+
// loop itself (scrollStep) re-evaluates edgeDelta every frame and self-terminates once the
|
|
5830
|
+
// pointer leaves the zone, so no separate "still in zone" check is needed here.
|
|
5831
|
+
if (fillEdgeScrollRaf == null && typeof requestAnimationFrame === 'function') {
|
|
5832
|
+
const d = edgeDelta(ev.clientX, ev.clientY);
|
|
5833
|
+
if (d.dx !== 0 || d.dy !== 0) fillEdgeScrollRaf = requestAnimationFrame(scrollStep);
|
|
4898
5834
|
}
|
|
4899
5835
|
};
|
|
4900
5836
|
const up = () => {
|
|
4901
|
-
// teardownFillDrag clears fillDragging + removes both listeners
|
|
5837
|
+
// teardownFillDrag clears fillDragging + removes both listeners + cancels any in-flight
|
|
5838
|
+
// edge-auto-scroll rAF (CR-04 / T-87-06-02 shared path).
|
|
4902
5839
|
teardownFillDrag();
|
|
4903
5840
|
// A plain click on the fill handle (pointerdown+up with NO intervening drag) leaves lastCell
|
|
4904
5841
|
// at the source box's own origin corner (r1,c1), so fillRange(sourceBox, corner) would
|
|
@@ -4994,13 +5931,6 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
4994
5931
|
}
|
|
4995
5932
|
}
|
|
4996
5933
|
|
|
4997
|
-
// ══ Editable-cell lifecycle (phase 51 plan 02 — RESEARCH Pattern 1/3/4/5) ════════════════
|
|
4998
|
-
// Single-cell, non-virtual. Index-based state (editingRow/editingCol over the visible model),
|
|
4999
|
-
// the display↔editor branch in the keyed <td>, F2/Enter/printable entry off the reserved
|
|
5000
|
-
// onGridKeyDown seam, commit on Enter/Tab/blur, cancel+revert on Escape, sync validation with
|
|
5001
|
-
// D-01 keep-open. All gated by columnEditable() / the editing index pair so a table with no
|
|
5002
|
-
// editable columns lowers byte-identical (the editor branch r-if is always false).
|
|
5003
|
-
|
|
5004
5934
|
// The column id at the active cell (the active row's visible cell list @ activeColIndex).
|
|
5005
5935
|
// Null when out of range (no body rows, or active cell is a header / select column).
|
|
5006
5936
|
function activeCellColumnId() {
|
|
@@ -5016,7 +5946,13 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
5016
5946
|
// isActiveCellEditable: the active cell sits in an editable column AND is a body cell
|
|
5017
5947
|
// (req-1). Gates the F2/Enter/printable edit-entry branches in onGridKeyDown; a
|
|
5018
5948
|
// non-editable active cell falls through to the reserved enterControl path.
|
|
5949
|
+
// C1 (quick 260906-cvo) — Layer 1: a group-header row is NEVER editable, regardless of
|
|
5950
|
+
// column. This is the single highest-value guard in the cluster: it closes Shift+F2, the
|
|
5951
|
+
// checkbox toggle, and the F2/Enter/printable edit-entry branches in ONE edit (they are all
|
|
5952
|
+
// `else if` branches gated on this predicate), AND restores fallthrough so Enter on a group
|
|
5953
|
+
// row reaches the group-toggle branch below them instead of opening an editor.
|
|
5019
5954
|
function isActiveCellEditable() {
|
|
5955
|
+
if (rowIndexIsGrouped(activeRow())) return false;
|
|
5020
5956
|
const colId = activeCellColumnId();
|
|
5021
5957
|
return colId != null && columnEditable(colId);
|
|
5022
5958
|
}
|
|
@@ -5034,6 +5970,14 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
5034
5970
|
// non-virtual, wr.vi.index virtual).
|
|
5035
5971
|
function isEditing(rowIndex: any, colIndex: any) {
|
|
5036
5972
|
if (editVer() < 0) return false;
|
|
5973
|
+
// C1 (quick 260906-cvo) — Layer 6: the ONLY layer whose reachability does not depend on a
|
|
5974
|
+
// keystroke. Editing state is INDEX-based over the visible model, and nothing clears it
|
|
5975
|
+
// when the row model re-derives — a consumer that changes the grouping model WHILE a cell
|
|
5976
|
+
// editor is open can move a group-header row under the index $data.editingRow/
|
|
5977
|
+
// editingRowIndex still holds, rendering the editor on a group row with no beginEdit
|
|
5978
|
+
// involved. Placed AFTER the editVer read (preserves the Svelte/Solid re-derivation
|
|
5979
|
+
// discipline the header comment above documents).
|
|
5980
|
+
if (rowIndexIsGrouped(rowIndex)) return false;
|
|
5037
5981
|
if (editingRowIndex() != null && editingRowIndex() === rowIndex) {
|
|
5038
5982
|
const colId = columnIdAt(rowIndex, colIndex);
|
|
5039
5983
|
return colId != null && columnEditable(colId);
|
|
@@ -5075,29 +6019,6 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
5075
6019
|
setInvalidMsg(msg != null ? msg : '');
|
|
5076
6020
|
}
|
|
5077
6021
|
|
|
5078
|
-
// replaceRowValue: build a FRESH array with ONE row object replaced (the column's field
|
|
5079
|
-
// set to the new value); the rest share by reference (the family immutable whole-array
|
|
5080
|
-
// replace — in-place mutation is silently dropped on React/Solid/Angular/Lit). rowIndex
|
|
5081
|
-
// is over currentData() (== the visible model order for the non-virtual, unsorted/
|
|
5082
|
-
// unfiltered single-cell case; the row id is carried for the commit payload).
|
|
5083
|
-
function replaceRowValue(rows: any, rowIndex: any, field: any, value: any) {
|
|
5084
|
-
const src = rows || [];
|
|
5085
|
-
const out = [];
|
|
5086
|
-
for (let i = 0; i < src.length; i++) {
|
|
5087
|
-
if (i === rowIndex) {
|
|
5088
|
-
// WR-03: own-property spread, NOT `for (const k in orig)` which walks the prototype chain
|
|
5089
|
-
// and would copy inherited enumerable props of typed/class-instance row objects.
|
|
5090
|
-
out.push({
|
|
5091
|
-
...(src[i] || {}),
|
|
5092
|
-
[field]: value
|
|
5093
|
-
});
|
|
5094
|
-
} else {
|
|
5095
|
-
out.push(src[i]);
|
|
5096
|
-
}
|
|
5097
|
-
}
|
|
5098
|
-
return out;
|
|
5099
|
-
}
|
|
5100
|
-
|
|
5101
6022
|
// Map a visible-model body-row index ($data.rows index) to its underlying currentData()
|
|
5102
6023
|
// index via the row's original object identity (sorting/filtering/pagination may reorder
|
|
5103
6024
|
// the visible model away from the source array order). Falls back to the same index.
|
|
@@ -5231,6 +6152,10 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
5231
6152
|
// $data) so a Tab-advance that just setState'd activeRow/Col works on React. Clears any
|
|
5232
6153
|
// prior invalid state. Focus moves into the editor.
|
|
5233
6154
|
function beginEdit(rowIndex: any, colIndex: any, seed: any) {
|
|
6155
|
+
// C1 (quick 260906-cvo) — Layer 2: closes the `onGridClick` (singleClickEdit) path, which
|
|
6156
|
+
// calls beginEdit directly gated ONLY on columnEditable — isActiveCellEditable (Layer 1)
|
|
6157
|
+
// does not run on that path at all.
|
|
6158
|
+
if (rowIndexIsGrouped(rowIndex)) return;
|
|
5234
6159
|
const colId = columnIdAt(rowIndex, colIndex);
|
|
5235
6160
|
if (colId == null || !columnEditable(colId)) return;
|
|
5236
6161
|
// A new edit session starts — reset the sync idempotency latch so THIS session's eventual
|
|
@@ -5277,23 +6202,6 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
5277
6202
|
if (typeof requestAnimationFrame === 'function') requestAnimationFrame(tryFocus);else setTimeout(tryFocus, 0);
|
|
5278
6203
|
}
|
|
5279
6204
|
|
|
5280
|
-
// B23: the index of a committed row WITHIN a given (fresh) visible-model array, resolved by
|
|
5281
|
-
// row IDENTITY. table-core's default getRowId is source-index-based, so a row's id is stable
|
|
5282
|
-
// across a re-sort (only its VISIBLE position moves); a committed edit replaces the row object
|
|
5283
|
-
// via a fresh spread (the `original` reference changes), so match by `id` FIRST, `original`
|
|
5284
|
-
// only as a fallback. Returns -1 when the row filtered out of the view. PURE (the caller passes
|
|
5285
|
-
// the FRESH row list — refreshRowModel's just-pulled `nextRows`, never the React-stale state).
|
|
5286
|
-
function indexOfRowIn(rows: any, rowOriginal: any, rowId: any) {
|
|
5287
|
-
const list = rows || [];
|
|
5288
|
-
for (let i = 0; i < list.length; i++) {
|
|
5289
|
-
const r = list[i];
|
|
5290
|
-
if (!r) continue;
|
|
5291
|
-
if (rowId != null && r.id === rowId) return i;
|
|
5292
|
-
if (rowOriginal != null && r.original === rowOriginal) return i;
|
|
5293
|
-
}
|
|
5294
|
-
return -1;
|
|
5295
|
-
}
|
|
5296
|
-
|
|
5297
6205
|
// endEdit: tear down the editor (shared by commit/cancel). Clears the editing pair +
|
|
5298
6206
|
// draft + invalid state and returns to navigation mode. Does NOT move focus (callers
|
|
5299
6207
|
// decide where focus lands — commit/cancel return it to the owning cell).
|
|
@@ -5454,6 +6362,11 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
5454
6362
|
// editor:'checkbox' columns only (Space/Enter/F2), full-row edit mode is unaffected (the
|
|
5455
6363
|
// editingRowIndex early return in onGridKeyDown already excludes it).
|
|
5456
6364
|
function toggleActiveBooleanCell() {
|
|
6365
|
+
// C1 (quick 260906-cvo) — Layer 4: the only write funnel bypassing both beginEdit/
|
|
6366
|
+
// commitEdit and applyGridToRange. Reachable today only through the Layer-1-gated
|
|
6367
|
+
// checkbox branch, so this line is redundant AT HEAD — it earns its place by making "no
|
|
6368
|
+
// write ever targets a group row" a property of the write funnels themselves.
|
|
6369
|
+
if (rowIndexIsGrouped(activeRow())) return;
|
|
5457
6370
|
const colId = columnIdAt(activeRow(), activeColIndex());
|
|
5458
6371
|
if (colId == null || !columnEditable(colId)) return;
|
|
5459
6372
|
const rowList = rows() || [];
|
|
@@ -5512,13 +6425,6 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
5512
6425
|
focusCellWhenReady(focusRow, focusCol);
|
|
5513
6426
|
}
|
|
5514
6427
|
|
|
5515
|
-
// ══ Full-row edit lifecycle (phase 51 plan 03 / req-6 / D-06, RESEARCH Pattern 6) ════════
|
|
5516
|
-
// Shift+F2 (and the editRow $expose verb) put EVERY editable cell in the active row into
|
|
5517
|
-
// edit at once; one save commits the whole row in ONE writeData (a single fresh-array row
|
|
5518
|
-
// replace) + ONE row-edit-commit event; Escape reverts the whole row as a unit. Per-column
|
|
5519
|
-
// validation still runs on each edited cell at commit (D-01 keep-open if ANY fails). The
|
|
5520
|
-
// editor template branch (isEditing's row arm) is re-used verbatim — no per-mode fork.
|
|
5521
|
-
|
|
5522
6428
|
// The editable [columnId, field] pairs for a body row at the given visible-model index,
|
|
5523
6429
|
// in visible-cell order. field is the column's accessorKey (the row-object key to write).
|
|
5524
6430
|
function editableColumnsForRow(rowIndex: any) {
|
|
@@ -5588,6 +6494,11 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
5588
6494
|
function beginRowEdit(row: any) {
|
|
5589
6495
|
const rowIndex = rowIndexOf(row);
|
|
5590
6496
|
if (rowIndex < 0) return;
|
|
6497
|
+
// C1 (quick 260906-cvo) — Layer 5: a second, independent editing-state funnel that takes a
|
|
6498
|
+
// row OBJECT from its caller. Reachable today only via Shift+F2 (Layer 1), so also
|
|
6499
|
+
// redundant at HEAD; kept for the same reason as Layer 4 — it is a mutation entry point,
|
|
6500
|
+
// and the natural call site for a future #rowActions "Edit" drop-in button.
|
|
6501
|
+
if (rowIndexIsGrouped(rowIndex)) return;
|
|
5591
6502
|
const editable = editableColumnsForRow(rowIndex);
|
|
5592
6503
|
if (editable.length === 0) return;
|
|
5593
6504
|
// A new edit session starts — reset the sync idempotency latch (see editCellLifecycle.rzts).
|
|
@@ -5741,27 +6652,6 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
5741
6652
|
focusCellWhenReady(focusRow, focusCol);
|
|
5742
6653
|
}
|
|
5743
6654
|
|
|
5744
|
-
// replaceRowValues: like replaceRowValue but applies a MAP of field→value to ONE row object
|
|
5745
|
-
// in a single fresh-array replace (req-6 — the whole-row commit is ONE write, not per cell).
|
|
5746
|
-
function replaceRowValues(rows: any, rowIndex: any, fieldValues: any) {
|
|
5747
|
-
const src = rows || [];
|
|
5748
|
-
const fv = fieldValues || {};
|
|
5749
|
-
const out = [];
|
|
5750
|
-
for (let i = 0; i < src.length; i++) {
|
|
5751
|
-
if (i === rowIndex) {
|
|
5752
|
-
// WR-03: own-property spread (orig then the field→value map), NOT a `for..in`
|
|
5753
|
-
// prototype-walking copy. Spread copies own enumerable props only.
|
|
5754
|
-
out.push({
|
|
5755
|
-
...(src[i] || {}),
|
|
5756
|
-
...fv
|
|
5757
|
-
});
|
|
5758
|
-
} else {
|
|
5759
|
-
out.push(src[i]);
|
|
5760
|
-
}
|
|
5761
|
-
}
|
|
5762
|
-
return out;
|
|
5763
|
-
}
|
|
5764
|
-
|
|
5765
6655
|
// Compute the next editable cell for Tab-advance (req-3, RESEARCH Open-Q3 deterministic
|
|
5766
6656
|
// rule): skip non-editable columns within the row; wrap to the NEXT row's first editable
|
|
5767
6657
|
// cell at the row's end; stop (return null) at grid end. Pure index math over the visible
|
|
@@ -6210,9 +7100,17 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
6210
7100
|
// B14: snapshot the PRE-write ABSOLUTE position so the activecell-change emit fires ONLY on a
|
|
6211
7101
|
// real move (mirrors the keyboard path's WR-06 suppression). A no-op focusCell to the already-
|
|
6212
7102
|
// active cell must NOT emit; a header→body landing (prevIsHeader) is a real move.
|
|
7103
|
+
// Phase 87 87-06 (D-08, deferred-items.md "87-03: focusCell's activecell-change emit guard
|
|
7104
|
+
// ignores column-only moves"): also snapshot the PRE-write column so a column-ONLY move (e.g.
|
|
7105
|
+
// focusCell(sameRow, differentCol) — the exact D-08 case) is recognized as a real move too. The
|
|
7106
|
+
// pre-fix guard compared only the row, so DOM focus moved correctly but the event never fired —
|
|
7107
|
+
// logged as a genuine, pre-existing bug in 87-03 and explicitly revisited here because this
|
|
7108
|
+
// plan's absolute-column-index work (and its own acceptance criteria) makes fixing it correct
|
|
7109
|
+
// and cheap now, rather than leaving it deferred.
|
|
6213
7110
|
const prevAbs = toAbsRow(activeRow());
|
|
7111
|
+
const prevCol = activeColIndex();
|
|
6214
7112
|
const prevIsHeader = activeIsHeader();
|
|
6215
|
-
if (
|
|
7113
|
+
if (rowsWindowed()) {
|
|
6216
7114
|
// Virtual mode: $data.activeRow IS the full pre-pagination index (the wr.vi.index space), so
|
|
6217
7115
|
// the absolute index maps 1:1. focusActiveCell already runs the D-12 off-window scroll-then-
|
|
6218
7116
|
// focus path (scrollToIndex(absRow) → deferred-rAF focus) when the row is outside the window.
|
|
@@ -6246,7 +7144,7 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
6246
7144
|
focusActiveCell(localRow, c, false);
|
|
6247
7145
|
}
|
|
6248
7146
|
}
|
|
6249
|
-
if (absRow !== prevAbs || prevIsHeader) {
|
|
7147
|
+
if (absRow !== prevAbs || c !== prevCol || prevIsHeader) {
|
|
6250
7148
|
_props.onActivecellChange?.({
|
|
6251
7149
|
rowIndex: absRow,
|
|
6252
7150
|
colIndex: c
|
|
@@ -6420,7 +7318,7 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
6420
7318
|
|
|
6421
7319
|
{<Show when={local.groupable}><div class={"rdt-group-bar-host"} data-rozie-s-d5dcab4c="">
|
|
6422
7320
|
{(_props.groupBarSlot ?? _props.slots?.['groupBar'])?.({ grouping: groupingKeys(), groupableColumns: groupableColumns(), applyGrouping, clearGrouping }) ?? <Key each={groupingKeys() as readonly any[]} by={(gk) => gk}>{(gk) => <span class={"rdt-group-token"} data-group-token="" data-rozie-s-d5dcab4c="">{rozieDisplay(gk())}</span>}</Key>}
|
|
6423
|
-
</div></Show>}{<Show when={
|
|
7321
|
+
</div></Show>}{<Show when={isWindowed()} fallback={<table aria-rowcount={rozieAttr(gridAriaRowCount())} class={"rozie-data-table" + " " + rozieClass({ 'rdt-sticky': local.stickyHeader })} role={rozieAttr(tableRole())} onKeyDown={($event: KeyboardEvent & { currentTarget: HTMLTableElement; target: Element }) => { onGridKeyDown($event); }} onFocusIn={($event: FocusEvent & { currentTarget: HTMLTableElement; target: Element }) => { syncActiveFromEvent($event); }} onFocusOut={($event: FocusEvent & { currentTarget: HTMLTableElement; target: Element }) => { onGridFocusOut($event); }} onMouseDown={($event: MouseEvent & { currentTarget: HTMLTableElement; target: Element }) => { onGridMouseDown($event); }} onDblClick={($event: MouseEvent & { currentTarget: HTMLTableElement; target: Element }) => { onGridDblClick($event); }} onClick={($event: MouseEvent & { currentTarget: HTMLTableElement; target: Element }) => { onGridClick($event); }} data-rozie-s-d5dcab4c="">
|
|
6424
7322
|
<thead class={"rdt-thead"} role="rowgroup" data-rozie-s-d5dcab4c="">
|
|
6425
7323
|
<Key each={headerGroups() as readonly any[]} by={(hg) => hg.id}>{(hg, hgLevel) => <tr class={"rdt-tr"} role="row" aria-rowindex={rozieAttr(hgLevel() + 1)} data-rozie-s-d5dcab4c="">
|
|
6426
7324
|
<Key each={hg().headers as readonly any[]} by={(header) => header.id}>{(header) => <th class={"rdt-th" + " " + rozieClass({ 'rdt-select-th': isSelectColumn(header().column.id), 'rdt-expander-th': isExpanderColumn(header().column.id), 'rdt-th-resizing': columnIsResizing(header().column.id), 'rdt-cell-active': isActiveCell('__header', headerColIndexOf(hg(), header()), hgLevel()) })} role="columnheader" data-col={rozieAttr(header().column.id)} data-grid-cell="" data-row="__header" data-header-level={rozieAttr(hgLevel())} colSpan={rozieAttr(header().colSpan > 1 ? header().colSpan : null)} data-col-index={rozieAttr(headerColIndexOf(hg(), header()))} tabIndex={rozieAttr(cellTabindex('__header', headerColIndexOf(hg(), header()), hgLevel()))} aria-sort={rozieAttr(ariaSortFor(header().column.id))} style={parseInlineStyle(thStyle(header().column.id))} data-rozie-s-d5dcab4c="">
|
|
@@ -6469,20 +7367,20 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
6469
7367
|
<Key each={visibleCellsFor(row()) as readonly any[]} by={(cell) => cell.id}>{(cell) => <td class={"rdt-td" + " " + rozieClass({ 'rdt-select-td': isSelectColumn(cell().column.id), 'rdt-expander-td': isExpanderColumn(cell().column.id), 'rdt-in-range': inRange(rowIndexOf(row()), colIndexOf(row(), cell())), 'rdt-cell-active': isActiveCell(String(rowIndexOf(row())), colIndexOf(row(), cell())) })} role={rozieAttr(cellRole())} data-col={rozieAttr(cell().column.id)} data-grid-cell="" data-row={rozieAttr(rowIndexOf(row()))} data-col-index={rozieAttr(colIndexOf(row(), cell()))} tabIndex={rozieAttr(cellTabindex(String(rowIndexOf(row())), colIndexOf(row(), cell())))} style={parseInlineStyle(bodyCellStyle(row(), cell().column.id))} aria-invalid={rozieAttr(cellAriaInvalid(rowIndexOf(row()), colIndexOf(row(), cell())))} data-in-range={rozieAttr(inRange(rowIndexOf(row()), colIndexOf(row(), cell())) ? 'true' : null)} data-agg-cell={rozieAttr(cellIsAggregated(cell()) ? cell().column.id : null)} data-rozie-s-d5dcab4c="">
|
|
6470
7368
|
|
|
6471
7369
|
{<Show when={isExpanderColumn(cell().column.id)} fallback={<Show when={isSelectColumn(cell().column.id)} fallback={<Show when={cellIsGrouped(cell())} fallback={<Show when={isEditing(rowIndexOf(row()), colIndexOf(row(), cell()))} fallback={<Show when={cellIsPlaceholder(cell())} fallback={<span class={"rdt-cell-value"} data-rozie-s-d5dcab4c="">
|
|
6472
|
-
{(_props.cellSlot ?? _props.slots?.['cell'])?.({ columnId: cell().column.id, column: cell().column, row: row()
|
|
7370
|
+
{(_props.cellSlot ?? _props.slots?.['cell'])?.({ columnId: cell().column.id, column: cell().column, row: cellSlotRow(row()), value: cell().getValue() }) ?? rozieDisplay(cell().getValue())}
|
|
6473
7371
|
</span>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="" /></Show>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
|
|
6474
7372
|
{<Show when={hasEditorSlot(cell().column.id)} fallback={<Show when={editorTypeOf(cell().column.id) === 'number'} fallback={<Show when={editorTypeOf(cell().column.id) === 'select'} fallback={<Show when={editorTypeOf(cell().column.id) === 'checkbox'} fallback={<input type="text" data-editing-cell="" class={"rdt-cell-editor"} value={editorValueFor(cell().column.id)} onInput={($event: InputEvent & { currentTarget: HTMLInputElement; target: Element }) => { onCellEditorInput(cell().column.id, $event); }} onKeyDown={($event: KeyboardEvent & { currentTarget: HTMLInputElement; target: Element }) => { onEditorKeyDown($event); }} onBlur={($event: FocusEvent & { currentTarget: HTMLInputElement; target: Element }) => { onEditorBlur($event); }} data-rozie-s-d5dcab4c="" />}><input type="checkbox" data-editing-cell="" class={"rdt-cell-editor"} checked={editorCheckedFor(cell().column.id)} onChange={($event: Event & { currentTarget: HTMLInputElement; target: Element }) => { onCellEditorCheckbox(cell().column.id, $event); }} onKeyDown={($event: KeyboardEvent & { currentTarget: HTMLInputElement; target: Element }) => { onEditorKeyDown($event); }} onBlur={($event: FocusEvent & { currentTarget: HTMLInputElement; target: Element }) => { onEditorBlur($event); }} data-rozie-s-d5dcab4c="" /></Show>}><select data-editing-cell="" class={"rdt-cell-editor"} value={editorValueFor(cell().column.id)} onChange={($event: Event & { currentTarget: HTMLSelectElement; target: Element }) => { onCellEditorInput(cell().column.id, $event); }} onKeyDown={($event: KeyboardEvent & { currentTarget: HTMLSelectElement; target: Element }) => { onEditorKeyDown($event); }} onBlur={($event: FocusEvent & { currentTarget: HTMLSelectElement; target: Element }) => { onEditorBlur($event); }} data-rozie-s-d5dcab4c="">
|
|
6475
7373
|
<Key each={editorOptionsOf(cell().column.id) as readonly any[]} by={(opt) => opt.value}>{(opt) => <option value={rozieAttr(opt().value)} data-rozie-s-d5dcab4c="">{rozieDisplay(opt().label)}</option>}</Key>
|
|
6476
7374
|
</select></Show>}><input type="number" data-editing-cell="" class={"rdt-cell-editor"} value={editorValueFor(cell().column.id)} onInput={($event: InputEvent & { currentTarget: HTMLInputElement; target: Element }) => { onCellEditorInput(cell().column.id, $event); }} onKeyDown={($event: KeyboardEvent & { currentTarget: HTMLInputElement; target: Element }) => { onEditorKeyDown($event); }} onBlur={($event: FocusEvent & { currentTarget: HTMLInputElement; target: Element }) => { onEditorBlur($event); }} data-rozie-s-d5dcab4c="" /></Show>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
|
|
6477
|
-
{(_props.editorSlot ?? _props.slots?.['editor'])?.({ columnId: cell().column.id, column: cell().column, row: row()
|
|
7375
|
+
{(_props.editorSlot ?? _props.slots?.['editor'])?.({ columnId: cell().column.id, column: cell().column, row: cellSlotRow(row()), value: editorValueFor(cell().column.id), commit: editorCommitFor(cell().column.id), cancel: editorCancelFor(), autofocus: editorAutofocusFor(cell().column.id, rowIndexOf(row())) })}
|
|
6478
7376
|
</span></Show>}</span></Show>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
|
|
6479
7377
|
<button type="button" data-expander="" aria-expanded={!!rowIsExpanded(row())} aria-label={rozieAttr(rowIsExpanded(row()) ? 'Collapse group' : 'Expand group')} class={"rdt-expander rdt-group-toggle"} onClick={($event: MouseEvent & { currentTarget: HTMLButtonElement; target: Element }) => { onToggleExpand(row(), $event); }} data-rozie-s-d5dcab4c="">{rozieDisplay(rowIsExpanded(row()) ? '▾' : '▸')}</button>
|
|
6480
7378
|
<span class={"rdt-group-value"} data-rozie-s-d5dcab4c="">
|
|
6481
|
-
{(_props.cellSlot ?? _props.slots?.['cell'])?.({ columnId: cell().column.id, column: cell().column, row: row()
|
|
7379
|
+
{(_props.cellSlot ?? _props.slots?.['cell'])?.({ columnId: cell().column.id, column: cell().column, row: cellSlotRow(row()), value: cell().getValue() }) ?? rozieDisplay(cell().getValue())}
|
|
6482
7380
|
</span>
|
|
6483
7381
|
<span class={"rdt-group-count"} data-rozie-s-d5dcab4c="">{rozieDisplay('(' + groupSubRowCount(row()) + ')')}</span>
|
|
6484
7382
|
</span></Show>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
|
|
6485
|
-
{(_props.selectCellSlot ?? _props.slots?.['selectCell'])?.({ row: row()
|
|
7383
|
+
{(_props.selectCellSlot ?? _props.slots?.['selectCell'])?.({ row: cellSlotRow(row()), checked: rowIsSelected(row()), toggle: e => onToggleRow(row(), e) }) ?? <input type="checkbox" aria-label="Select row" class={"rdt-select-row"} checked={rowIsSelected(row())} onChange={($event: Event & { currentTarget: HTMLInputElement; target: Element }) => { onToggleRow(row(), $event); }} data-rozie-s-d5dcab4c="" />}
|
|
6486
7384
|
</span></Show>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
|
|
6487
7385
|
{<Show when={rowCanExpand(row())}><button type="button" data-expander="" aria-expanded={!!rowIsExpanded(row())} aria-label={rozieAttr(rowIsExpanded(row()) ? 'Collapse row' : 'Expand row')} class={"rdt-expander"} onClick={($event: MouseEvent & { currentTarget: HTMLButtonElement; target: Element }) => { onToggleExpand(row(), $event); }} data-rozie-s-d5dcab4c="">{rozieDisplay(rowIsExpanded(row()) ? '▾' : '▸')}</button></Show>}</span></Show>}{<Show when={isFillHandleCell(rowIndexOf(row()), colIndexOf(row(), cell()))}><span data-fill-handle="" data-testid="fill-handle" aria-hidden="true" class={"rdt-fill-handle"} onPointerDown={($event: PointerEvent & { currentTarget: HTMLSpanElement; target: Element }) => { onFillHandlePointerDown($event); }} data-rozie-s-d5dcab4c="" /></Show>}</td>}</Key>
|
|
6488
7386
|
</tr>
|
|
@@ -6493,85 +7391,89 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
6493
7391
|
</td>
|
|
6494
7392
|
</tr></Show>}</>}</Key>
|
|
6495
7393
|
</tbody>
|
|
6496
|
-
</table>}><div class={"rdt-scroll"} style={parseInlineStyle(local.maxHeight ? 'max-height:' + local.maxHeight + ';overflow:auto;--rozie-data-table-max-height:' + local.maxHeight : 'overflow:auto')} data-rozie-s-d5dcab4c="">
|
|
6497
|
-
<table aria-rowcount={rozieAttr(gridAriaRowCount())} class={"rozie-data-table" + " " + rozieClass({ 'rdt-sticky': local.stickyHeader })} role={rozieAttr(tableRole())} onKeyDown={($event: KeyboardEvent & { currentTarget: HTMLTableElement; target: Element }) => { onGridKeyDown($event); }} onFocusIn={($event: FocusEvent & { currentTarget: HTMLTableElement; target: Element }) => { syncActiveFromEvent($event); }} onFocusOut={($event: FocusEvent & { currentTarget: HTMLTableElement; target: Element }) => { onGridFocusOut($event); }} onMouseDown={($event: MouseEvent & { currentTarget: HTMLTableElement; target: Element }) => { onGridMouseDown($event); }} onDblClick={($event: MouseEvent & { currentTarget: HTMLTableElement; target: Element }) => { onGridDblClick($event); }} onClick={($event: MouseEvent & { currentTarget: HTMLTableElement; target: Element }) => { onGridClick($event); }} data-rozie-s-d5dcab4c="">
|
|
7394
|
+
</table>}><div class={"rdt-scroll"} style={parseInlineStyle(rowsWindowed() && local.maxHeight ? 'max-height:' + local.maxHeight + ';overflow:auto;--rozie-data-table-max-height:' + local.maxHeight : 'overflow:auto')} data-rozie-s-d5dcab4c="">
|
|
7395
|
+
<table aria-rowcount={rozieAttr(gridAriaRowCount())} class={"rozie-data-table" + " " + rozieClass({ 'rdt-sticky': local.stickyHeader, 'rdt-col-windowed': colsWindowed() })} role={rozieAttr(tableRole())} onKeyDown={($event: KeyboardEvent & { currentTarget: HTMLTableElement; target: Element }) => { onGridKeyDown($event); }} onFocusIn={($event: FocusEvent & { currentTarget: HTMLTableElement; target: Element }) => { syncActiveFromEvent($event); }} onFocusOut={($event: FocusEvent & { currentTarget: HTMLTableElement; target: Element }) => { onGridFocusOut($event); }} onMouseDown={($event: MouseEvent & { currentTarget: HTMLTableElement; target: Element }) => { onGridMouseDown($event); }} onDblClick={($event: MouseEvent & { currentTarget: HTMLTableElement; target: Element }) => { onGridDblClick($event); }} onClick={($event: MouseEvent & { currentTarget: HTMLTableElement; target: Element }) => { onGridClick($event); }} data-rozie-s-d5dcab4c="">
|
|
6498
7396
|
<thead class={"rdt-thead"} role="rowgroup" data-rozie-s-d5dcab4c="">
|
|
6499
7397
|
<Key each={headerGroups() as readonly any[]} by={(hg) => hg.id}>{(hg, hgLevel) => <tr class={"rdt-tr"} role="row" aria-rowindex={rozieAttr(hgLevel() + 1)} data-rozie-s-d5dcab4c="">
|
|
6500
|
-
|
|
6501
|
-
|
|
6502
|
-
|
|
7398
|
+
|
|
7399
|
+
{<Show when={colsWindowed()}><th class={"rdt-col-spacer"} aria-hidden="true" style={parseInlineStyle('width:' + colPadLeft() + 'px;padding:0;border:0')} data-rozie-s-d5dcab4c="" /></Show>}<Key each={windowedHeadersFor(hg(), hgLevel()) as readonly any[]} by={(wh) => wh.header.id}>{(wh) => <th class={"rdt-th" + " " + rozieClass({ 'rdt-select-th': isSelectColumn(wh().header.column.id), 'rdt-expander-th': isExpanderColumn(wh().header.column.id), 'rdt-th-resizing': columnIsResizing(wh().header.column.id), 'rdt-cell-active': isActiveCell('__header', headerColIndexOf(hg(), wh().header), hgLevel()) })} role="columnheader" data-col={rozieAttr(wh().header.column.id)} data-grid-cell="" data-row="__header" data-header-level={rozieAttr(hgLevel())} colSpan={rozieAttr(wh().span > 1 ? wh().span : null)} data-col-index={rozieAttr(headerColIndexOf(hg(), wh().header))} tabIndex={rozieAttr(cellTabindex('__header', headerColIndexOf(hg(), wh().header), hgLevel()))} aria-sort={rozieAttr(ariaSortFor(wh().header.column.id))} style={parseInlineStyle(thStyle(wh().header.column.id))} data-rozie-s-d5dcab4c="">
|
|
7400
|
+
{<Show when={isSelectColumn(wh().header.column.id)} fallback={<Show when={isExpanderColumn(wh().header.column.id)} fallback={<span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
|
|
7401
|
+
{<Show when={wh().header.column.getCanSort && wh().header.column.getCanSort()} fallback={<span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
|
|
6503
7402
|
<span class={"rdt-header-label"} data-rozie-s-d5dcab4c="">
|
|
6504
|
-
{(_props.colHeaderSlot ?? _props.slots?.['colHeader'])?.({ columnId:
|
|
7403
|
+
{(_props.colHeaderSlot ?? _props.slots?.['colHeader'])?.({ columnId: wh().header.column.id, column: wh().header.column, label: headerLabel(wh().header.column.id) }) ?? rozieDisplay(headerLabel(wh().header.column.id))}
|
|
6505
7404
|
</span>
|
|
6506
|
-
</span>}><button type="button" class={"rdt-sort-btn"} onClick={($event: MouseEvent & { currentTarget: HTMLButtonElement; target: Element }) => { onHeaderSort(
|
|
7405
|
+
</span>}><button type="button" class={"rdt-sort-btn"} onClick={($event: MouseEvent & { currentTarget: HTMLButtonElement; target: Element }) => { onHeaderSort(wh().header.column.id, $event); }} data-rozie-s-d5dcab4c="">
|
|
6507
7406
|
<span class={"rdt-header-label"} data-rozie-s-d5dcab4c="">
|
|
6508
|
-
{(_props.colHeaderSlot ?? _props.slots?.['colHeader'])?.({ columnId:
|
|
7407
|
+
{(_props.colHeaderSlot ?? _props.slots?.['colHeader'])?.({ columnId: wh().header.column.id, column: wh().header.column, label: headerLabel(wh().header.column.id) }) ?? rozieDisplay(headerLabel(wh().header.column.id))}
|
|
6509
7408
|
</span>
|
|
6510
|
-
<span class={"rdt-sort-ind"} aria-hidden="true" data-rozie-s-d5dcab4c="">{rozieDisplay(sortIndicator(
|
|
7409
|
+
<span class={"rdt-sort-ind"} aria-hidden="true" data-rozie-s-d5dcab4c="">{rozieDisplay(sortIndicator(wh().header.column.id))}</span>
|
|
6511
7410
|
</button></Show>}<Popover trigger="click" placement="bottom-end" strategy="fixed" offset={4} data-rozie-s-d5dcab4c="" anchorSlot={() => (<>
|
|
6512
|
-
<button type="button" class={"rdt-col-menu-trigger"} aria-label={rozieAttr('Column options for ' + headerLabel(
|
|
7411
|
+
<button type="button" class={"rdt-col-menu-trigger"} aria-label={rozieAttr('Column options for ' + headerLabel(wh().header.column.id))} data-rozie-s-d5dcab4c="">⋯</button>
|
|
6513
7412
|
</>)}><div class={"rdt-col-menu"} role="menu" data-rozie-s-d5dcab4c="">
|
|
6514
|
-
<button type="button" role="menuitem" aria-pressed={columnPinSide(
|
|
6515
|
-
<button type="button" role="menuitem" aria-pressed={columnPinSide(
|
|
6516
|
-
<button type="button" role="menuitem" aria-pressed={!columnPinSide(
|
|
7413
|
+
<button type="button" role="menuitem" aria-pressed={columnPinSide(wh().header.column.id) === 'left'} class={"rdt-col-menu-item"} onClick={($event: MouseEvent & { currentTarget: HTMLButtonElement; target: Element }) => { onPinColumn(wh().header.column.id, 'left', $event); }} data-rozie-s-d5dcab4c="">Pin left</button>
|
|
7414
|
+
<button type="button" role="menuitem" aria-pressed={columnPinSide(wh().header.column.id) === 'right'} class={"rdt-col-menu-item"} onClick={($event: MouseEvent & { currentTarget: HTMLButtonElement; target: Element }) => { onPinColumn(wh().header.column.id, 'right', $event); }} data-rozie-s-d5dcab4c="">Pin right</button>
|
|
7415
|
+
<button type="button" role="menuitem" aria-pressed={!columnPinSide(wh().header.column.id)} class={"rdt-col-menu-item"} onClick={($event: MouseEvent & { currentTarget: HTMLButtonElement; target: Element }) => { onPinColumn(wh().header.column.id, false, $event); }} data-rozie-s-d5dcab4c="">Unpin</button>
|
|
6517
7416
|
<hr class={"rdt-col-menu-sep"} data-rozie-s-d5dcab4c="" />
|
|
6518
|
-
<button type="button" role="menuitem" class={"rdt-col-menu-item"} onClick={($event: MouseEvent & { currentTarget: HTMLButtonElement; target: Element }) => { onHideColumn(
|
|
7417
|
+
<button type="button" role="menuitem" class={"rdt-col-menu-item"} onClick={($event: MouseEvent & { currentTarget: HTMLButtonElement; target: Element }) => { onHideColumn(wh().header.column.id, $event); }} data-rozie-s-d5dcab4c="">Hide column</button>
|
|
6519
7418
|
</div></Popover>
|
|
6520
|
-
<button type="button" aria-label={rozieAttr('Resize ' + headerLabel(
|
|
7419
|
+
<button type="button" aria-label={rozieAttr('Resize ' + headerLabel(wh().header.column.id))} class={"rdt-resize-handle"} onPointerDown={($event: PointerEvent & { currentTarget: HTMLButtonElement; target: Element }) => { onResizeStart(wh().header.column.id, $event); }} onTouchStart={($event: TouchEvent & { currentTarget: HTMLButtonElement; target: Element }) => { onResizeStart(wh().header.column.id, $event); }} data-rozie-s-d5dcab4c=""><span class={"rdt-resize-grip"} aria-hidden="true" data-rozie-s-d5dcab4c="" /></button>
|
|
6521
7420
|
</span>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="" /></Show>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
|
|
6522
7421
|
{(_props.selectAllSlot ?? _props.slots?.['selectAll'])?.({ checked: isAllRowsSelected(), indeterminate: isSomeRowsSelected(), toggle: onToggleAllRows }) ?? <Show when={local.selectionMode === 'multiple'}><input type="checkbox" aria-label="Select all rows" class={"rdt-select-all"} checked={isAllRowsSelected()} onChange={($event: Event & { currentTarget: HTMLInputElement; target: Element }) => { onToggleAllRows($event); }} data-rozie-s-d5dcab4c="" /></Show>}
|
|
6523
7422
|
</span></Show>}</th>}</Key>
|
|
6524
|
-
|
|
7423
|
+
|
|
7424
|
+
{<Show when={colsWindowed()}><th class={"rdt-col-spacer"} aria-hidden="true" style={parseInlineStyle('width:' + colPadRight() + 'px;padding:0;border:0')} data-rozie-s-d5dcab4c="" /></Show>}</tr>}</Key>
|
|
6525
7425
|
|
|
6526
7426
|
{<Show when={hasAnyFilterableColumn()}><tr class={"rdt-filter-row"} data-rozie-s-d5dcab4c="">
|
|
6527
|
-
<Key each={headerGroups()[headerGroups().length - 1].
|
|
6528
|
-
{<Show when={isSelectColumn(
|
|
6529
|
-
{<Show when={columnIsFilterable(
|
|
6530
|
-
{(_props.filterSlot ?? _props.slots?.['filter'])?.({ columnId:
|
|
7427
|
+
{<Show when={colsWindowed()}><th class={"rdt-col-spacer"} aria-hidden="true" style={parseInlineStyle('width:' + colPadLeft() + 'px;padding:0;border:0')} data-rozie-s-d5dcab4c="" /></Show>}<Key each={windowedHeadersFor(headerGroups()[headerGroups().length - 1], headerGroups().length - 1) as readonly any[]} by={(wh) => wh.header.id}>{(wh) => <th class={"rdt-filter-cell"} role="presentation" data-col={rozieAttr(wh().header.column.id)} style={parseInlineStyle(pinStyle(wh().header.column.id))} data-rozie-s-d5dcab4c="">
|
|
7428
|
+
{<Show when={isSelectColumn(wh().header.column.id)} fallback={<Show when={isExpanderColumn(wh().header.column.id)} fallback={<span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
|
|
7429
|
+
{<Show when={columnIsFilterable(wh().header.column.id) && !hasFilterSlot()}><input type="text" aria-label={rozieAttr('Filter ' + headerLabel(wh().header.column.id))} class={"rdt-col-filter"} value={columnFilterValue(wh().header.column.id)} onInput={($event: InputEvent & { currentTarget: HTMLInputElement; target: Element }) => { onColumnFilterInput(wh().header.column.id, $event); }} onClick={($event: MouseEvent & { currentTarget: HTMLInputElement; target: Element }) => { stopEvent($event); }} data-rozie-s-d5dcab4c="" /></Show>}{<Show when={columnIsFilterable(wh().header.column.id)}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
|
|
7430
|
+
{(_props.filterSlot ?? _props.slots?.['filter'])?.({ columnId: wh().header.column.id, value: columnFilterValue(wh().header.column.id), uniqueValues: getFacetedUniqueValues(wh().header.column.id), minMax: getFacetedMinMaxValues(wh().header.column.id), setFilter: setColumnFilter })}
|
|
6531
7431
|
</span></Show>}</span>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="" /></Show>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="" /></Show>}</th>}</Key>
|
|
6532
|
-
|
|
7432
|
+
{<Show when={colsWindowed()}><th class={"rdt-col-spacer"} aria-hidden="true" style={parseInlineStyle('width:' + colPadRight() + 'px;padding:0;border:0')} data-rozie-s-d5dcab4c="" /></Show>}</tr></Show>}</thead>
|
|
6533
7433
|
|
|
6534
7434
|
<tbody class={"rdt-tbody"} role="rowgroup" data-rozie-s-d5dcab4c="">
|
|
6535
7435
|
|
|
6536
7436
|
<tr class={"rdt-spacer"} aria-hidden="true" data-rozie-s-d5dcab4c="">
|
|
6537
|
-
<td colSpan={rozieAttr(
|
|
7437
|
+
<td colSpan={rozieAttr(windowedColSpan())} style={parseInlineStyle('height:' + padTop() + 'px;padding:0;border:0')} data-rozie-s-d5dcab4c="" />
|
|
6538
7438
|
</tr>
|
|
6539
7439
|
|
|
6540
7440
|
<Key each={windowedRows() as readonly any[]} by={(wr) => wr.row.id}>{(wr) => <>
|
|
6541
7441
|
<tr class={"rdt-tr" + " " + rozieClass({ 'rdt-group-header': rowIsGrouped(wr().row), 'rdt-row-pinned': wr().pinned })} role="row" data-row={rozieAttr(wr().vi.index)} aria-rowindex={rozieAttr(headerRowCount() + wr().vi.index + 1)} data-index={rozieAttr(wr().vi.index)} data-pinned={rozieAttr(wr().pinned ? 'true' : null)} data-depth={rozieAttr(wr().row.depth)} data-group-header={rozieAttr(rowIsGrouped(wr().row) ? wr().row.id : null)} data-group-leaf={rozieAttr(groupingActive() && !rowIsGrouped(wr().row) ? wr().row.id : null)} aria-expanded={(rowIsGrouped(wr().row) ? !!rowIsExpanded(wr().row) : null) ?? undefined} aria-selected={(local.selectionMode !== 'none' ? !!rowIsSelected(wr().row) : null) ?? undefined} aria-level={rozieAttr(groupingActive() ? wr().row.depth + 1 : null)} data-rozie-s-d5dcab4c="">
|
|
6542
|
-
|
|
7442
|
+
|
|
7443
|
+
{<Show when={colsWindowed()}><td class={"rdt-col-spacer"} aria-hidden="true" style={parseInlineStyle('width:' + colPadLeft() + 'px;padding:0;border:0')} data-rozie-s-d5dcab4c="" /></Show>}<Key each={windowedCells(wr().row) as readonly any[]} by={(cell) => cell.id}>{(cell) => <td class={"rdt-td" + " " + rozieClass({ 'rdt-select-td': isSelectColumn(cell().column.id), 'rdt-expander-td': isExpanderColumn(cell().column.id), 'rdt-in-range': inRange(wr().vi.index, colIndexOf(wr().row, cell())), 'rdt-cell-active': isActiveCell(String(wr().vi.index), colIndexOf(wr().row, cell())) })} role={rozieAttr(cellRole())} data-col={rozieAttr(cell().column.id)} data-grid-cell="" data-row={rozieAttr(wr().vi.index)} data-col-index={rozieAttr(colIndexOf(wr().row, cell()))} tabIndex={rozieAttr(cellTabindex(String(wr().vi.index), colIndexOf(wr().row, cell())))} style={parseInlineStyle(bodyCellStyle(wr().row, cell().column.id))} aria-invalid={rozieAttr(cellAriaInvalid(wr().vi.index, colIndexOf(wr().row, cell())))} data-in-range={rozieAttr(inRange(wr().vi.index, colIndexOf(wr().row, cell())) ? 'true' : null)} data-agg-cell={rozieAttr(cellIsAggregated(cell()) ? cell().column.id : null)} data-rozie-s-d5dcab4c="">
|
|
6543
7444
|
|
|
6544
7445
|
{<Show when={isExpanderColumn(cell().column.id)} fallback={<Show when={isSelectColumn(cell().column.id)} fallback={<Show when={cellIsGrouped(cell())} fallback={<Show when={isEditing(wr().vi.index, colIndexOf(wr().row, cell()))} fallback={<Show when={cellIsPlaceholder(cell())} fallback={<span class={"rdt-cell-value"} data-rozie-s-d5dcab4c="">
|
|
6545
|
-
{(_props.cellSlot ?? _props.slots?.['cell'])?.({ columnId: cell().column.id, column: cell().column, row: wr().row
|
|
7446
|
+
{(_props.cellSlot ?? _props.slots?.['cell'])?.({ columnId: cell().column.id, column: cell().column, row: cellSlotRow(wr().row), value: cell().getValue() }) ?? rozieDisplay(cell().getValue())}
|
|
6546
7447
|
</span>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="" /></Show>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
|
|
6547
7448
|
{<Show when={hasEditorSlot(cell().column.id)} fallback={<Show when={editorTypeOf(cell().column.id) === 'number'} fallback={<Show when={editorTypeOf(cell().column.id) === 'select'} fallback={<Show when={editorTypeOf(cell().column.id) === 'checkbox'} fallback={<input type="text" data-editing-cell="" class={"rdt-cell-editor"} value={editorValueFor(cell().column.id)} onInput={($event: InputEvent & { currentTarget: HTMLInputElement; target: Element }) => { onCellEditorInput(cell().column.id, $event); }} onKeyDown={($event: KeyboardEvent & { currentTarget: HTMLInputElement; target: Element }) => { onEditorKeyDown($event); }} onBlur={($event: FocusEvent & { currentTarget: HTMLInputElement; target: Element }) => { onEditorBlur($event); }} data-rozie-s-d5dcab4c="" />}><input type="checkbox" data-editing-cell="" class={"rdt-cell-editor"} checked={editorCheckedFor(cell().column.id)} onChange={($event: Event & { currentTarget: HTMLInputElement; target: Element }) => { onCellEditorCheckbox(cell().column.id, $event); }} onKeyDown={($event: KeyboardEvent & { currentTarget: HTMLInputElement; target: Element }) => { onEditorKeyDown($event); }} onBlur={($event: FocusEvent & { currentTarget: HTMLInputElement; target: Element }) => { onEditorBlur($event); }} data-rozie-s-d5dcab4c="" /></Show>}><select data-editing-cell="" class={"rdt-cell-editor"} value={editorValueFor(cell().column.id)} onChange={($event: Event & { currentTarget: HTMLSelectElement; target: Element }) => { onCellEditorInput(cell().column.id, $event); }} onKeyDown={($event: KeyboardEvent & { currentTarget: HTMLSelectElement; target: Element }) => { onEditorKeyDown($event); }} onBlur={($event: FocusEvent & { currentTarget: HTMLSelectElement; target: Element }) => { onEditorBlur($event); }} data-rozie-s-d5dcab4c="">
|
|
6548
7449
|
<Key each={editorOptionsOf(cell().column.id) as readonly any[]} by={(opt) => opt.value}>{(opt) => <option value={rozieAttr(opt().value)} data-rozie-s-d5dcab4c="">{rozieDisplay(opt().label)}</option>}</Key>
|
|
6549
7450
|
</select></Show>}><input type="number" data-editing-cell="" class={"rdt-cell-editor"} value={editorValueFor(cell().column.id)} onInput={($event: InputEvent & { currentTarget: HTMLInputElement; target: Element }) => { onCellEditorInput(cell().column.id, $event); }} onKeyDown={($event: KeyboardEvent & { currentTarget: HTMLInputElement; target: Element }) => { onEditorKeyDown($event); }} onBlur={($event: FocusEvent & { currentTarget: HTMLInputElement; target: Element }) => { onEditorBlur($event); }} data-rozie-s-d5dcab4c="" /></Show>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
|
|
6550
|
-
{(_props.editorSlot ?? _props.slots?.['editor'])?.({ columnId: cell().column.id, column: cell().column, row: wr().row
|
|
7451
|
+
{(_props.editorSlot ?? _props.slots?.['editor'])?.({ columnId: cell().column.id, column: cell().column, row: cellSlotRow(wr().row), value: editorValueFor(cell().column.id), commit: editorCommitFor(cell().column.id), cancel: editorCancelFor(), autofocus: editorAutofocusFor(cell().column.id, wr().vi.index) })}
|
|
6551
7452
|
</span></Show>}</span></Show>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
|
|
6552
7453
|
<button type="button" data-expander="" aria-expanded={!!rowIsExpanded(wr().row)} aria-label={rozieAttr(rowIsExpanded(wr().row) ? 'Collapse group' : 'Expand group')} class={"rdt-expander rdt-group-toggle"} onClick={($event: MouseEvent & { currentTarget: HTMLButtonElement; target: Element }) => { onToggleExpand(wr().row, $event); }} data-rozie-s-d5dcab4c="">{rozieDisplay(rowIsExpanded(wr().row) ? '▾' : '▸')}</button>
|
|
6553
7454
|
<span class={"rdt-group-value"} data-rozie-s-d5dcab4c="">
|
|
6554
|
-
{(_props.cellSlot ?? _props.slots?.['cell'])?.({ columnId: cell().column.id, column: cell().column, row: wr().row
|
|
7455
|
+
{(_props.cellSlot ?? _props.slots?.['cell'])?.({ columnId: cell().column.id, column: cell().column, row: cellSlotRow(wr().row), value: cell().getValue() }) ?? rozieDisplay(cell().getValue())}
|
|
6555
7456
|
</span>
|
|
6556
7457
|
<span class={"rdt-group-count"} data-rozie-s-d5dcab4c="">{rozieDisplay('(' + groupSubRowCount(wr().row) + ')')}</span>
|
|
6557
7458
|
</span></Show>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
|
|
6558
|
-
{(_props.selectCellSlot ?? _props.slots?.['selectCell'])?.({ row: wr().row
|
|
7459
|
+
{(_props.selectCellSlot ?? _props.slots?.['selectCell'])?.({ row: cellSlotRow(wr().row), checked: rowIsSelected(wr().row), toggle: e => onToggleRow(wr().row, e) }) ?? <input type="checkbox" aria-label="Select row" class={"rdt-select-row"} checked={rowIsSelected(wr().row)} onChange={($event: Event & { currentTarget: HTMLInputElement; target: Element }) => { onToggleRow(wr().row, $event); }} data-rozie-s-d5dcab4c="" />}
|
|
6559
7460
|
</span></Show>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
|
|
6560
7461
|
{<Show when={rowCanExpand(wr().row)}><button type="button" data-expander="" aria-expanded={!!rowIsExpanded(wr().row)} aria-label={rozieAttr(rowIsExpanded(wr().row) ? 'Collapse row' : 'Expand row')} class={"rdt-expander"} onClick={($event: MouseEvent & { currentTarget: HTMLButtonElement; target: Element }) => { onToggleExpand(wr().row, $event); }} data-rozie-s-d5dcab4c="">{rozieDisplay(rowIsExpanded(wr().row) ? '▾' : '▸')}</button></Show>}</span></Show>}{<Show when={isFillHandleCell(wr().vi.index, colIndexOf(wr().row, cell()))}><span data-fill-handle="" data-testid="fill-handle" aria-hidden="true" class={"rdt-fill-handle"} onPointerDown={($event: PointerEvent & { currentTarget: HTMLSpanElement; target: Element }) => { onFillHandlePointerDown($event); }} data-rozie-s-d5dcab4c="" /></Show>}</td>}</Key>
|
|
6561
|
-
|
|
7462
|
+
|
|
7463
|
+
{<Show when={colsWindowed()}><td class={"rdt-col-spacer"} aria-hidden="true" style={parseInlineStyle('width:' + colPadRight() + 'px;padding:0;border:0')} data-rozie-s-d5dcab4c="" /></Show>}</tr>
|
|
6562
7464
|
|
|
6563
7465
|
{<Show when={rowShowsDetail(wr().row)}><tr class={"rdt-detail-row"} role="row" data-detail-row={rozieAttr(wr().row.id)} data-rozie-s-d5dcab4c="">
|
|
6564
|
-
<td class={"rdt-detail-cell"} colSpan={rozieAttr(
|
|
7466
|
+
<td class={"rdt-detail-cell"} colSpan={rozieAttr(windowedColSpan())} data-rozie-s-d5dcab4c="">
|
|
6565
7467
|
{(_props.detailSlot ?? _props.slots?.['detail'])?.({ row: wr().row.original })}
|
|
6566
7468
|
</td>
|
|
6567
7469
|
</tr></Show>}</>}</Key>
|
|
6568
7470
|
|
|
6569
7471
|
<tr class={"rdt-spacer"} aria-hidden="true" data-rozie-s-d5dcab4c="">
|
|
6570
|
-
<td colSpan={rozieAttr(
|
|
7472
|
+
<td colSpan={rozieAttr(windowedColSpan())} style={parseInlineStyle('height:' + padBottom() + 'px;padding:0;border:0')} data-rozie-s-d5dcab4c="" />
|
|
6571
7473
|
</tr>
|
|
6572
7474
|
</tbody>
|
|
6573
7475
|
</table>
|
|
6574
|
-
</div></Show>}{<Show when={!
|
|
7476
|
+
</div></Show>}{<Show when={!rowsWindowed()}><div class={"rdt-pagination"} role="group" aria-label="Pagination" data-rozie-s-d5dcab4c="">
|
|
6575
7477
|
<button type="button" class={"rdt-page-btn rdt-page-prev"} disabled={!canPrevPage()} onClick={($event: MouseEvent & { currentTarget: HTMLButtonElement; target: Element }) => { onPrevPage(); }} data-rozie-s-d5dcab4c="">Prev</button>
|
|
6576
7478
|
<span class={"rdt-page-status"} aria-live="polite" data-rozie-s-d5dcab4c="">
|
|
6577
7479
|
{rozieDisplay('Page ' + (pageIndex() + 1) + ' of ' + displayPageCount())}
|