Deploy AIOS web (React glide grid + FastAPI slice)
Browse files- RELEASES.json +1 -1
- VERSION +1 -1
- web/public/AIOS_DEPLOY_RECEIPT +1 -1
- web/src/customer-grid/CustomerGrid.tsx +150 -27
- web/src/customer-grid/GridPager.tsx +15 -2
- web/src/customer-grid/apiBridge.ts +23 -1
- web/src/customer-grid/useCustomerData.ts +2 -2
- web/src/customer-grid/useGetCellContent.ts +3 -12
- web/src/index.css +37 -1
RELEASES.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"current": "
|
| 3 |
"releases": [
|
| 4 |
{
|
| 5 |
"version": "v75",
|
|
|
|
| 1 |
{
|
| 2 |
+
"current": "f58c31d",
|
| 3 |
"releases": [
|
| 4 |
{
|
| 5 |
"version": "v75",
|
VERSION
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
f58c31d
|
web/public/AIOS_DEPLOY_RECEIPT
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
8b4013a2c71f0080d36b3072ad388063dee5f96089a2a1f15e9861c1ccd15fec
|
web/src/customer-grid/CustomerGrid.tsx
CHANGED
|
@@ -34,8 +34,9 @@ import { acceptsQueryPreview, routeQueryViewMutation } from "./queryPreview";
|
|
| 34 |
// ⭐ WAVE 30 · W30-T42 (contract C2) — the WINDOWED grid's arithmetic, pure and node-run in
|
| 35 |
// `verify_grid_ux.py`, because every one of these decisions is taken inside a callback where
|
| 36 |
// only its own source text could otherwise be checked.
|
| 37 |
-
import {
|
| 38 |
-
|
|
|
|
| 39 |
// ⭐⭐ W50-T03 / CONTRACT C1 — the windowed aggregate's envelope. Lane F serves the route
|
| 40 |
// (W50-T31); this side is written to C1's shape and degrades to the loaded window until it
|
| 41 |
// lands, which is the done-when's own observable rather than a workaround.
|
|
@@ -1353,6 +1354,51 @@ function writeFoldMemory(key: string, expanded: ReadonlySet<string>): void {
|
|
| 1353 |
* whole bucket) and loses its footer — the same shape `groupRows` produces for a folded group,
|
| 1354 |
* so nothing downstream can tell which of the two folded it.
|
| 1355 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1356 |
export function foldGroups(rows: VisibleRow[], expanded: ReadonlySet<string>): VisibleRow[] {
|
| 1357 |
const out: VisibleRow[] = [];
|
| 1358 |
let hidden = false;
|
|
@@ -3621,16 +3667,18 @@ function CustomerGridSurface({
|
|
| 3621 |
() => windowPredicateKey(config.filters, config.filterConj, config.sorts, search),
|
| 3622 |
[config.filters, config.filterConj, config.sorts, search]
|
| 3623 |
);
|
|
|
|
|
|
|
| 3624 |
const windowRequest = useCallback(
|
| 3625 |
(offset: number) => ({
|
| 3626 |
offset,
|
| 3627 |
-
limit:
|
| 3628 |
filters: config.filters,
|
| 3629 |
filterConj: config.filterConj,
|
| 3630 |
sorts: config.sorts,
|
| 3631 |
search,
|
| 3632 |
}),
|
| 3633 |
-
[config.filters, config.filterConj, config.sorts, search]
|
| 3634 |
);
|
| 3635 |
/* ⭐⭐ HOTFIX 2026-09-23 — THE PAGE. The owner revoked the virtualise-only ruling: *"I want
|
| 3636 |
fucking either pagination or next page and only load 50 at a time"*. A read-through grid now
|
|
@@ -3639,11 +3687,30 @@ function CustomerGridSurface({
|
|
| 3639 |
const [pageOffset, setPageOffset] = useState(0);
|
| 3640 |
const pageOffsetRef = useRef(0);
|
| 3641 |
pageOffsetRef.current = pageOffset;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3642 |
const goToPage = useCallback((offset: number) => {
|
| 3643 |
const next = Math.max(0, Math.floor(offset));
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3644 |
setPageOffset(next);
|
| 3645 |
requestWindow(windowRequest(next));
|
| 3646 |
-
}, [requestWindow, windowRequest]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3647 |
const sentPredicate = useRef<string | null>(null);
|
| 3648 |
useEffect(() => {
|
| 3649 |
if (!serverWindowed) {
|
|
@@ -3689,11 +3756,13 @@ function CustomerGridSurface({
|
|
| 3689 |
(range: Rectangle, tx: number) => {
|
| 3690 |
// HOTFIX 2026-09-23: a read-through grid PAGES (the pager under the canvas) instead of
|
| 3691 |
// appending on scroll, so the visible region only drives the summary bar's track now.
|
| 3692 |
-
|
|
|
|
| 3693 |
setCanvasX(Number.isFinite(tx) ? tx : 0);
|
| 3694 |
},
|
| 3695 |
[]
|
| 3696 |
);
|
|
|
|
| 3697 |
|
| 3698 |
// CG-8 — measure conditions, answered by the host as `{ruleId: pid[]}`. Converted to Sets
|
| 3699 |
// once here rather than per row: the pipeline runs this over every row of the book.
|
|
@@ -4308,14 +4377,25 @@ function CustomerGridSurface({
|
|
| 4308 |
kind: "group-footer",
|
| 4309 |
groupKey: key,
|
| 4310 |
aggs: h.aggs,
|
| 4311 |
-
...(h.count >
|
| 4312 |
-
? { page: { offset: page?.offset ?? 0, total: h.count, size:
|
| 4313 |
: {}),
|
| 4314 |
});
|
| 4315 |
}
|
| 4316 |
return out;
|
| 4317 |
}, [serverWindowed, config.groupBy, serverAggs, fields, summaryMap, groupSummaryOn, expanded,
|
| 4318 |
-
groupPages]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4319 |
/** R6's SECOND SENTENCE, on the client side of the wire: the limits D's route DECLARED on this
|
| 4320 |
* response. Received and painted nothing = the limit is silent again, one layer further out. */
|
| 4321 |
// ⭐ W32-T03: `counts` rides along so the clamped-window clause can say "Showing 5,000 of
|
|
@@ -4405,9 +4485,13 @@ function CustomerGridSurface({
|
|
| 4405 |
() => {
|
| 4406 |
if (serverGroupRows) return serverGroupRows;
|
| 4407 |
const painted = applyGroupAnalytics(foldGroups(visibleRows, expanded), analytics);
|
| 4408 |
-
|
|
|
|
|
|
|
|
|
|
| 4409 |
},
|
| 4410 |
-
[serverGroupRows, visibleRows, expanded, analytics, groupSummaryOn, groupSort
|
|
|
|
| 4411 |
);
|
| 4412 |
/* ⭐⭐ W50-T03 — EVERY MATCHED ROW THE FOLD LEAVES OPEN, AND NOTHING APPENDED.
|
| 4413 |
W50-T01 / R1 retired the cap that used to stand between the pipeline and the canvas, and
|
|
@@ -4419,6 +4503,36 @@ function CustomerGridSurface({
|
|
| 4419 |
therefore the folded list BY IDENTITY, and any slice or append here is the cap coming back
|
| 4420 |
in a new coat. */
|
| 4421 |
const displayRows = foldedRows;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4422 |
/* ⭐⭐ W50-T02 — `displayPidToIndex` IS BACK, and the reason is narrower than the one W50-T01
|
| 4423 |
retired it for. Selection, detail navigation and the new-row cursor are all POSITIONAL
|
| 4424 |
against what is on screen, and a folded group shifts every row under it. When nothing is
|
|
@@ -6202,17 +6316,7 @@ function CustomerGridSurface({
|
|
| 6202 |
toggleFold(row.groupKey);
|
| 6203 |
return;
|
| 6204 |
}
|
| 6205 |
-
|
| 6206 |
-
// Previous, the right half Next (`groupFooterCell` paints both marks there).
|
| 6207 |
-
if (row.kind === "group-footer" && row.page) {
|
| 6208 |
-
event.preventDefault();
|
| 6209 |
-
if (cell[0] !== 0) return;
|
| 6210 |
-
const { offset, total, size } = row.page;
|
| 6211 |
-
const back = event.localEventX < event.bounds.width / 2;
|
| 6212 |
-
const next = back ? offset - size : offset + size;
|
| 6213 |
-
if (next >= 0 && next < total) loadGroupPage(row.groupKey, next);
|
| 6214 |
-
return;
|
| 6215 |
-
}
|
| 6216 |
// W40-T30 — the virtual "Go" cell's tap door stood here, matched by POSITION on the index
|
| 6217 |
// one past the persisted columns. Owner instruction 27 removed it; the transit link is a
|
| 6218 |
// pre-set URL field now, so it opens through the ordinary url-cell branch below, which is
|
|
@@ -11750,6 +11854,23 @@ function CustomerGridSurface({
|
|
| 11750 |
)}
|
| 11751 |
</>
|
| 11752 |
)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11753 |
{/* ⭐⭐ W50-T03 (instruction 1, R2) — THE SUMMARY BAR, INSIDE THE BOX AND PINNED TO ITS
|
| 11754 |
BOTTOM EDGE. Last child of `.cg-grid-box` so it paints over the void rectangles
|
| 11755 |
rather than under them, and inside it rather than beside it so it cannot drift away
|
|
@@ -11772,13 +11893,15 @@ function CustomerGridSurface({
|
|
| 11772 |
every page reachable: `matched` is the server's own count, so this is a view onto the
|
| 11773 |
whole population rather than a cap on it (standing rule 1). Grouped, each open group
|
| 11774 |
pages on its own footer instead. */}
|
| 11775 |
-
{
|
| 11776 |
<GridPager
|
| 11777 |
-
offset={pageOffset}
|
| 11778 |
-
size={
|
| 11779 |
-
|
| 11780 |
-
|
|
|
|
| 11781 |
onPage={goToPage}
|
|
|
|
| 11782 |
/>
|
| 11783 |
)}
|
| 11784 |
{/* ⭐ W30-T42 — the WINDOWED grid's honest footnotes, in the strip that already exists
|
|
|
|
| 34 |
// ⭐ WAVE 30 · W30-T42 (contract C2) — the WINDOWED grid's arithmetic, pure and node-run in
|
| 35 |
// `verify_grid_ux.py`, because every one of these decisions is taken inside a callback where
|
| 36 |
// only its own source text could otherwise be checked.
|
| 37 |
+
import { PAGE_SIZES, fetchAggregates, fetchTableWindow, personalGridLayout, readPageSize,
|
| 38 |
+
writePageSize } from "./apiBridge";
|
| 39 |
+
import { GridPager, pageLabel } from "./GridPager";
|
| 40 |
// ⭐⭐ W50-T03 / CONTRACT C1 — the windowed aggregate's envelope. Lane F serves the route
|
| 41 |
// (W50-T31); this side is written to C1's shape and degrades to the loaded window until it
|
| 42 |
// lands, which is the done-when's own observable rather than a workaround.
|
|
|
|
| 1354 |
* whole bucket) and loses its footer — the same shape `groupRows` produces for a folded group,
|
| 1355 |
* so nothing downstream can tell which of the two folded it.
|
| 1356 |
*/
|
| 1357 |
+
/**
|
| 1358 |
+
* HOTFIX 2026-09-24 — PAGE A WHOLE-BOOK LIST. Ungrouped: the data rows `[offset, offset + size)`.
|
| 1359 |
+
* Grouped: every group keeps its header and footer, an open group shows `size` of its rows from
|
| 1360 |
+
* its own offset, and its footer carries `page` so the same footer pager the read-through grid
|
| 1361 |
+
* uses can move it. Totals were computed over the whole bucket before this, so they stay whole.
|
| 1362 |
+
*/
|
| 1363 |
+
export function pageClientRows(
|
| 1364 |
+
rows: VisibleRow[],
|
| 1365 |
+
offset: number,
|
| 1366 |
+
size: number,
|
| 1367 |
+
groupOffsets: ReadonlyMap<string, number>
|
| 1368 |
+
): VisibleRow[] {
|
| 1369 |
+
const grouped = rows.some((vr) => vr.kind === "group-header");
|
| 1370 |
+
if (!grouped) {
|
| 1371 |
+
const data = rows.filter((vr) => vr.kind === "data");
|
| 1372 |
+
if (data.length <= size && offset === 0) return rows;
|
| 1373 |
+
return data.slice(offset, offset + size);
|
| 1374 |
+
}
|
| 1375 |
+
const out: VisibleRow[] = [];
|
| 1376 |
+
let bucket: VisibleRow[] = [];
|
| 1377 |
+
let key = "";
|
| 1378 |
+
const flush = (footer: VisibleRow | null) => {
|
| 1379 |
+
const start = groupOffsets.get(key) ?? 0;
|
| 1380 |
+
out.push(...bucket.slice(start, start + size));
|
| 1381 |
+
if (footer && footer.kind === "group-footer") {
|
| 1382 |
+
out.push(bucket.length > size
|
| 1383 |
+
? { ...footer, page: { offset: start, total: bucket.length, size } }
|
| 1384 |
+
: footer);
|
| 1385 |
+
}
|
| 1386 |
+
bucket = [];
|
| 1387 |
+
};
|
| 1388 |
+
for (const vr of rows) {
|
| 1389 |
+
if (vr.kind === "group-header") {
|
| 1390 |
+
key = vr.groupKey;
|
| 1391 |
+
out.push(vr);
|
| 1392 |
+
} else if (vr.kind === "data") {
|
| 1393 |
+
bucket.push(vr);
|
| 1394 |
+
} else {
|
| 1395 |
+
flush(vr);
|
| 1396 |
+
}
|
| 1397 |
+
}
|
| 1398 |
+
if (bucket.length) flush(null);
|
| 1399 |
+
return out;
|
| 1400 |
+
}
|
| 1401 |
+
|
| 1402 |
export function foldGroups(rows: VisibleRow[], expanded: ReadonlySet<string>): VisibleRow[] {
|
| 1403 |
const out: VisibleRow[] = [];
|
| 1404 |
let hidden = false;
|
|
|
|
| 3667 |
() => windowPredicateKey(config.filters, config.filterConj, config.sorts, search),
|
| 3668 |
[config.filters, config.filterConj, config.sorts, search]
|
| 3669 |
);
|
| 3670 |
+
/* HOTFIX 2026-09-24 — ONE PAGE SIZE FOR EVERY DATABASE (50 / 100 / 200, default 100). */
|
| 3671 |
+
const [pageSize, setPageSizeState] = useState<number>(() => readPageSize());
|
| 3672 |
const windowRequest = useCallback(
|
| 3673 |
(offset: number) => ({
|
| 3674 |
offset,
|
| 3675 |
+
limit: pageSize,
|
| 3676 |
filters: config.filters,
|
| 3677 |
filterConj: config.filterConj,
|
| 3678 |
sorts: config.sorts,
|
| 3679 |
search,
|
| 3680 |
}),
|
| 3681 |
+
[config.filters, config.filterConj, config.sorts, search, pageSize]
|
| 3682 |
);
|
| 3683 |
/* ⭐⭐ HOTFIX 2026-09-23 — THE PAGE. The owner revoked the virtualise-only ruling: *"I want
|
| 3684 |
fucking either pagination or next page and only load 50 at a time"*. A read-through grid now
|
|
|
|
| 3687 |
const [pageOffset, setPageOffset] = useState(0);
|
| 3688 |
const pageOffsetRef = useRef(0);
|
| 3689 |
pageOffsetRef.current = pageOffset;
|
| 3690 |
+
/* HOTFIX 2026-09-24 — EVERY DATABASE PAGES. Owner: *"ALL databases should have the damn
|
| 3691 |
+
pagination ... the databases are ALL MODULAR and standardized."* A read-through table asks
|
| 3692 |
+
the server for the page; a table already held whole (Odoo customers, typed tables) pages
|
| 3693 |
+
the painted list (`foldedRows`), through the same pager and the same offset. */
|
| 3694 |
+
const [clientPageOffset, setClientPageOffset] = useState(0);
|
| 3695 |
const goToPage = useCallback((offset: number) => {
|
| 3696 |
const next = Math.max(0, Math.floor(offset));
|
| 3697 |
+
if (!serverWindowed) {
|
| 3698 |
+
setClientPageOffset(next);
|
| 3699 |
+
return;
|
| 3700 |
+
}
|
| 3701 |
setPageOffset(next);
|
| 3702 |
requestWindow(windowRequest(next));
|
| 3703 |
+
}, [serverWindowed, requestWindow, windowRequest]);
|
| 3704 |
+
const setPageSize = useCallback((n: number) => {
|
| 3705 |
+
writePageSize(n);
|
| 3706 |
+
setPageSizeState(n);
|
| 3707 |
+
setClientPageOffset(0);
|
| 3708 |
+
if (serverWindowed) {
|
| 3709 |
+
setPageOffset(0);
|
| 3710 |
+
requestWindow({ ...windowRequest(0), limit: n });
|
| 3711 |
+
}
|
| 3712 |
+
}, [serverWindowed, requestWindow, windowRequest]);
|
| 3713 |
+
useEffect(() => { setClientPageOffset(0); }, [windowPredicate, scope, config.groupBy]);
|
| 3714 |
const sentPredicate = useRef<string | null>(null);
|
| 3715 |
useEffect(() => {
|
| 3716 |
if (!serverWindowed) {
|
|
|
|
| 3756 |
(range: Rectangle, tx: number) => {
|
| 3757 |
// HOTFIX 2026-09-23: a read-through grid PAGES (the pager under the canvas) instead of
|
| 3758 |
// appending on scroll, so the visible region only drives the summary bar's track now.
|
| 3759 |
+
setVisibleRange((prev) => (prev && prev.y === range.y && prev.height === range.height
|
| 3760 |
+
? prev : { y: range.y, height: range.height }));
|
| 3761 |
setCanvasX(Number.isFinite(tx) ? tx : 0);
|
| 3762 |
},
|
| 3763 |
[]
|
| 3764 |
);
|
| 3765 |
+
const [visibleRange, setVisibleRange] = useState<{ y: number; height: number } | null>(null);
|
| 3766 |
|
| 3767 |
// CG-8 — measure conditions, answered by the host as `{ruleId: pid[]}`. Converted to Sets
|
| 3768 |
// once here rather than per row: the pipeline runs this over every row of the book.
|
|
|
|
| 4377 |
kind: "group-footer",
|
| 4378 |
groupKey: key,
|
| 4379 |
aggs: h.aggs,
|
| 4380 |
+
...(h.count > pageSize
|
| 4381 |
+
? { page: { offset: page?.offset ?? 0, total: h.count, size: pageSize } }
|
| 4382 |
: {}),
|
| 4383 |
});
|
| 4384 |
}
|
| 4385 |
return out;
|
| 4386 |
}, [serverWindowed, config.groupBy, serverAggs, fields, summaryMap, groupSummaryOn, expanded,
|
| 4387 |
+
groupPages, pageSize]);
|
| 4388 |
+
/* HOTFIX 2026-09-24 — a WHOLE-BOOK table's open groups page too, one offset per group. */
|
| 4389 |
+
const [clientGroupOffsets, setClientGroupOffsets] = useState<ReadonlyMap<string, number>>(
|
| 4390 |
+
() => new Map());
|
| 4391 |
+
useEffect(() => { setClientGroupOffsets(new Map()); }, [windowPredicate, scope, config.groupBy]);
|
| 4392 |
+
const goGroupPage = useCallback((key: string, offset: number) => {
|
| 4393 |
+
if (serverWindowed) {
|
| 4394 |
+
loadGroupPage(key, offset);
|
| 4395 |
+
return;
|
| 4396 |
+
}
|
| 4397 |
+
setClientGroupOffsets((prev) => new Map(prev).set(key, Math.max(0, offset)));
|
| 4398 |
+
}, [serverWindowed, loadGroupPage]);
|
| 4399 |
/** R6's SECOND SENTENCE, on the client side of the wire: the limits D's route DECLARED on this
|
| 4400 |
* response. Received and painted nothing = the limit is silent again, one layer further out. */
|
| 4401 |
// ⭐ W32-T03: `counts` rides along so the clamped-window clause can say "Showing 5,000 of
|
|
|
|
| 4485 |
() => {
|
| 4486 |
if (serverGroupRows) return serverGroupRows;
|
| 4487 |
const painted = applyGroupAnalytics(foldGroups(visibleRows, expanded), analytics);
|
| 4488 |
+
if (groupSummaryOn) return summaryModeRows(painted, analytics.nums, groupSort);
|
| 4489 |
+
// HOTFIX 2026-09-24: a whole-book table pages what it paints (see `pageClientRows`).
|
| 4490 |
+
if (serverWindowed || displayMode !== "grid") return painted;
|
| 4491 |
+
return pageClientRows(painted, clientPageOffset, pageSize, clientGroupOffsets);
|
| 4492 |
},
|
| 4493 |
+
[serverGroupRows, visibleRows, expanded, analytics, groupSummaryOn, groupSort, serverWindowed,
|
| 4494 |
+
displayMode, clientPageOffset, pageSize, clientGroupOffsets]
|
| 4495 |
);
|
| 4496 |
/* ⭐⭐ W50-T03 — EVERY MATCHED ROW THE FOLD LEAVES OPEN, AND NOTHING APPENDED.
|
| 4497 |
W50-T01 / R1 retired the cap that used to stand between the pipeline and the canvas, and
|
|
|
|
| 4503 |
therefore the folded list BY IDENTITY, and any slice or append here is the cap coming back
|
| 4504 |
in a new coat. */
|
| 4505 |
const displayRows = foldedRows;
|
| 4506 |
+
/* ⭐ HOTFIX 2026-09-24 — THE GROUP PAGER IS A DOM OVERLAY. Owner: *"should not be constrained by
|
| 4507 |
+
the width of the first column. It should overlay"*, with the same purple buttons as the main
|
| 4508 |
+
pager. Placed from glide's own `getBounds` for the footer row (the hover Expand's method),
|
| 4509 |
+
recomputed on scroll, and clamped to the rows the grid box can show. */
|
| 4510 |
+
const [groupPagers, setGroupPagers] = useState<
|
| 4511 |
+
{ key: string; top: number; left: number; height: number;
|
| 4512 |
+
page: { offset: number; total: number; size: number } }[]
|
| 4513 |
+
>([]);
|
| 4514 |
+
useLayoutEffect(() => {
|
| 4515 |
+
const box = gridBoxRef.current?.getBoundingClientRect();
|
| 4516 |
+
const grid = gridRef.current;
|
| 4517 |
+
if (!box || !grid || !config.groupBy) {
|
| 4518 |
+
setGroupPagers((prev) => (prev.length ? [] : prev));
|
| 4519 |
+
return;
|
| 4520 |
+
}
|
| 4521 |
+
const first = visibleRange ? Math.max(0, visibleRange.y - 1) : 0;
|
| 4522 |
+
const last = visibleRange ? visibleRange.y + visibleRange.height + 1 : displayRows.length;
|
| 4523 |
+
const next: typeof groupPagers = [];
|
| 4524 |
+
for (let i = first; i < Math.min(last, displayRows.length); i++) {
|
| 4525 |
+
const vr = displayRows[i];
|
| 4526 |
+
if (vr?.kind !== "group-footer" || !vr.page) continue;
|
| 4527 |
+
const b = grid.getBounds(0, i);
|
| 4528 |
+
if (!b) continue;
|
| 4529 |
+
const top = b.y - box.top;
|
| 4530 |
+
if (top < HEADER_PX || top + b.height > box.height) continue;
|
| 4531 |
+
next.push({ key: vr.groupKey, top, left: Math.max(0, b.x - box.left), height: b.height,
|
| 4532 |
+
page: vr.page });
|
| 4533 |
+
}
|
| 4534 |
+
setGroupPagers((prev) => (JSON.stringify(prev) === JSON.stringify(next) ? prev : next));
|
| 4535 |
+
}, [displayRows, visibleRange, canvasX, config.groupBy]);
|
| 4536 |
/* ⭐⭐ W50-T02 — `displayPidToIndex` IS BACK, and the reason is narrower than the one W50-T01
|
| 4537 |
retired it for. Selection, detail navigation and the new-row cursor are all POSITIONAL
|
| 4538 |
against what is on screen, and a folded group shifts every row under it. When nothing is
|
|
|
|
| 6316 |
toggleFold(row.groupKey);
|
| 6317 |
return;
|
| 6318 |
}
|
| 6319 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6320 |
// W40-T30 — the virtual "Go" cell's tap door stood here, matched by POSITION on the index
|
| 6321 |
// one past the persisted columns. Owner instruction 27 removed it; the transit link is a
|
| 6322 |
// pre-set URL field now, so it opens through the ordinary url-cell branch below, which is
|
|
|
|
| 11854 |
)}
|
| 11855 |
</>
|
| 11856 |
)}
|
| 11857 |
+
{groupPagers.map((gp) => (
|
| 11858 |
+
<div key={gp.key} className="cg-group-pager"
|
| 11859 |
+
style={{ top: gp.top, left: gp.left, height: gp.height }}>
|
| 11860 |
+
<button type="button" className="cg-pager-btn" disabled={gp.page.offset <= 0}
|
| 11861 |
+
onClick={() => goGroupPage(gp.key, Math.max(0, gp.page.offset - gp.page.size))}>
|
| 11862 |
+
Previous
|
| 11863 |
+
</button>
|
| 11864 |
+
<span className="cg-pager-label">
|
| 11865 |
+
{pageLabel(gp.page.offset, gp.page.size, gp.page.total)}
|
| 11866 |
+
</span>
|
| 11867 |
+
<button type="button" className="cg-pager-btn"
|
| 11868 |
+
disabled={gp.page.offset + gp.page.size >= gp.page.total}
|
| 11869 |
+
onClick={() => goGroupPage(gp.key, gp.page.offset + gp.page.size)}>
|
| 11870 |
+
Next
|
| 11871 |
+
</button>
|
| 11872 |
+
</div>
|
| 11873 |
+
))}
|
| 11874 |
{/* ⭐⭐ W50-T03 (instruction 1, R2) — THE SUMMARY BAR, INSIDE THE BOX AND PINNED TO ITS
|
| 11875 |
BOTTOM EDGE. Last child of `.cg-grid-box` so it paints over the void rectangles
|
| 11876 |
rather than under them, and inside it rather than beside it so it cannot drift away
|
|
|
|
| 11893 |
every page reachable: `matched` is the server's own count, so this is a view onto the
|
| 11894 |
whole population rather than a cap on it (standing rule 1). Grouped, each open group
|
| 11895 |
pages on its own footer instead. */}
|
| 11896 |
+
{!config.groupBy && displayMode === "grid" && !loading && (
|
| 11897 |
<GridPager
|
| 11898 |
+
offset={serverWindowed ? pageOffset : clientPageOffset}
|
| 11899 |
+
size={pageSize}
|
| 11900 |
+
sizes={PAGE_SIZES}
|
| 11901 |
+
total={serverWindowed ? (payload?.counts?.matched ?? 0) : filteredPids.length}
|
| 11902 |
+
pending={serverWindowed && windowPending}
|
| 11903 |
onPage={goToPage}
|
| 11904 |
+
onSize={setPageSize}
|
| 11905 |
/>
|
| 11906 |
)}
|
| 11907 |
{/* ⭐ W30-T42 — the WINDOWED grid's honest footnotes, in the strip that already exists
|
web/src/customer-grid/GridPager.tsx
CHANGED
|
@@ -16,15 +16,20 @@ export function pageLabel(offset: number, size: number, total: number): string {
|
|
| 16 |
export function GridPager({
|
| 17 |
offset,
|
| 18 |
size,
|
|
|
|
| 19 |
total,
|
| 20 |
pending,
|
| 21 |
onPage,
|
|
|
|
| 22 |
}: {
|
| 23 |
offset: number;
|
| 24 |
size: number;
|
|
|
|
|
|
|
| 25 |
total: number;
|
| 26 |
pending: boolean;
|
| 27 |
onPage: (offset: number) => void;
|
|
|
|
| 28 |
}) {
|
| 29 |
const pages = Math.max(1, Math.ceil(total / size));
|
| 30 |
const page = Math.min(pages, Math.floor(offset / size) + 1);
|
|
@@ -34,7 +39,7 @@ export function GridPager({
|
|
| 34 |
<nav className="cg-pager" aria-label="Pages" aria-busy={pending || undefined}>
|
| 35 |
<button
|
| 36 |
type="button"
|
| 37 |
-
className="cg-btn"
|
| 38 |
disabled={!hasPrev}
|
| 39 |
onClick={() => onPage(Math.max(0, offset - size))}
|
| 40 |
>
|
|
@@ -46,12 +51,20 @@ export function GridPager({
|
|
| 46 |
</span>
|
| 47 |
<button
|
| 48 |
type="button"
|
| 49 |
-
className="cg-btn"
|
| 50 |
disabled={!hasNext}
|
| 51 |
onClick={() => onPage(offset + size)}
|
| 52 |
>
|
| 53 |
Next
|
| 54 |
</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
</nav>
|
| 56 |
);
|
| 57 |
}
|
|
|
|
| 16 |
export function GridPager({
|
| 17 |
offset,
|
| 18 |
size,
|
| 19 |
+
sizes,
|
| 20 |
total,
|
| 21 |
pending,
|
| 22 |
onPage,
|
| 23 |
+
onSize,
|
| 24 |
}: {
|
| 25 |
offset: number;
|
| 26 |
size: number;
|
| 27 |
+
/** HOTFIX 2026-09-24: the page-size choices, on the same line as Previous / Next. */
|
| 28 |
+
sizes: readonly number[];
|
| 29 |
total: number;
|
| 30 |
pending: boolean;
|
| 31 |
onPage: (offset: number) => void;
|
| 32 |
+
onSize: (size: number) => void;
|
| 33 |
}) {
|
| 34 |
const pages = Math.max(1, Math.ceil(total / size));
|
| 35 |
const page = Math.min(pages, Math.floor(offset / size) + 1);
|
|
|
|
| 39 |
<nav className="cg-pager" aria-label="Pages" aria-busy={pending || undefined}>
|
| 40 |
<button
|
| 41 |
type="button"
|
| 42 |
+
className="cg-pager-btn"
|
| 43 |
disabled={!hasPrev}
|
| 44 |
onClick={() => onPage(Math.max(0, offset - size))}
|
| 45 |
>
|
|
|
|
| 51 |
</span>
|
| 52 |
<button
|
| 53 |
type="button"
|
| 54 |
+
className="cg-pager-btn"
|
| 55 |
disabled={!hasNext}
|
| 56 |
onClick={() => onPage(offset + size)}
|
| 57 |
>
|
| 58 |
Next
|
| 59 |
</button>
|
| 60 |
+
<label className="cg-pager-size">
|
| 61 |
+
<span>Rows per page</span>
|
| 62 |
+
<select value={size} onChange={(e) => onSize(Number(e.currentTarget.value))}>
|
| 63 |
+
{sizes.map((n) => (
|
| 64 |
+
<option key={n} value={n}>{n}</option>
|
| 65 |
+
))}
|
| 66 |
+
</select>
|
| 67 |
+
</label>
|
| 68 |
</nav>
|
| 69 |
);
|
| 70 |
}
|
web/src/customer-grid/apiBridge.ts
CHANGED
|
@@ -567,7 +567,29 @@ export async function fetchAssignedCustomerRows(viewId: string): Promise<Custome
|
|
| 567 |
* `datastore.WINDOW_MAX` (5,000) and REPORTS the clamp rather than trimming quietly. */
|
| 568 |
// HOTFIX 2026-09-23 (owner): "pagination or next page and only load 50 at a time". The grid
|
| 569 |
// pages a read-through table 50 rows at a time with Prev / Next; `total` stays the server's.
|
| 570 |
-
export const WINDOW_ROWS =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 571 |
|
| 572 |
export interface RowWindowRequest {
|
| 573 |
offset: number;
|
|
|
|
| 567 |
* `datastore.WINDOW_MAX` (5,000) and REPORTS the clamp rather than trimming quietly. */
|
| 568 |
// HOTFIX 2026-09-23 (owner): "pagination or next page and only load 50 at a time". The grid
|
| 569 |
// pages a read-through table 50 rows at a time with Prev / Next; `total` stays the server's.
|
| 570 |
+
export const WINDOW_ROWS = 100;
|
| 571 |
+
|
| 572 |
+
/** HOTFIX 2026-09-24 (owner): "a pagination option, 50/100/200 at a time, while 100 record at a
|
| 573 |
+
* time is the default." One vocabulary for every database, remembered per browser. */
|
| 574 |
+
export const PAGE_SIZES = [50, 100, 200] as const;
|
| 575 |
+
const PAGE_SIZE_KEY = "cg.pageSize";
|
| 576 |
+
|
| 577 |
+
export function readPageSize(): number {
|
| 578 |
+
try {
|
| 579 |
+
const n = Number(localStorage.getItem(PAGE_SIZE_KEY));
|
| 580 |
+
return (PAGE_SIZES as readonly number[]).includes(n) ? n : WINDOW_ROWS;
|
| 581 |
+
} catch {
|
| 582 |
+
return WINDOW_ROWS;
|
| 583 |
+
}
|
| 584 |
+
}
|
| 585 |
+
|
| 586 |
+
export function writePageSize(n: number): void {
|
| 587 |
+
try {
|
| 588 |
+
localStorage.setItem(PAGE_SIZE_KEY, String(n));
|
| 589 |
+
} catch {
|
| 590 |
+
/* a blocked store only loses the preference, never the page */
|
| 591 |
+
}
|
| 592 |
+
}
|
| 593 |
|
| 594 |
export interface RowWindowRequest {
|
| 595 |
offset: number;
|
web/src/customer-grid/useCustomerData.ts
CHANGED
|
@@ -42,7 +42,7 @@ import {
|
|
| 42 |
usesPinnedRows,
|
| 43 |
setSurfaceScope,
|
| 44 |
subscribeChanges,
|
| 45 |
-
|
| 46 |
} from "./apiBridge";
|
| 47 |
import type { PersonalGridLayout, RowWindowRequest } from "./apiBridge";
|
| 48 |
import { DERIVED_CELLS_EVENT, ROWS_STALE_EVENT, WORKSPACE_STALE_EVENT } from "../apiContract";
|
|
@@ -575,7 +575,7 @@ export function useCustomerData(
|
|
| 575 |
grid applies later: it is the PREMISE of the tab, so the very first read has to
|
| 576 |
carry it or the tab paints the whole database for one frame and then narrows,
|
| 577 |
which is a wrong answer that happens to be brief. */
|
| 578 |
-
? fetchTableWindow(tableKey, { offset: 0, limit:
|
| 579 |
// A related read always takes the pinned window door, even with an empty roster.
|
| 580 |
: fetchTopicRows(topic),
|
| 581 |
wsPromise,
|
|
|
|
| 42 |
usesPinnedRows,
|
| 43 |
setSurfaceScope,
|
| 44 |
subscribeChanges,
|
| 45 |
+
readPageSize,
|
| 46 |
} from "./apiBridge";
|
| 47 |
import type { PersonalGridLayout, RowWindowRequest } from "./apiBridge";
|
| 48 |
import { DERIVED_CELLS_EVENT, ROWS_STALE_EVENT, WORKSPACE_STALE_EVENT } from "../apiContract";
|
|
|
|
| 575 |
grid applies later: it is the PREMISE of the tab, so the very first read has to
|
| 576 |
carry it or the tab paints the whole database for one frame and then narrows,
|
| 577 |
which is a wrong answer that happens to be brief. */
|
| 578 |
+
? fetchTableWindow(tableKey, { offset: 0, limit: readPageSize(), related })
|
| 579 |
// A related read always takes the pinned window door, even with an empty roster.
|
| 580 |
: fetchTopicRows(topic),
|
| 581 |
wsPromise,
|
web/src/customer-grid/useGetCellContent.ts
CHANGED
|
@@ -201,18 +201,9 @@ function groupFooterCell(vr: GroupFooterRow, col: number, field: Field | undefin
|
|
| 201 |
const agg = field ? vr.aggs[field.key] : undefined;
|
| 202 |
// HOTFIX 2026-09-23: a paged group's first footer cell is its pager. The click handler in
|
| 203 |
// `CustomerGrid.onCellClicked` reads the left half as Previous and the right half as Next.
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
const to = Math.min(total, offset + size).toLocaleString();
|
| 208 |
-
const prev = offset > 0 ? "‹ Prev" : "";
|
| 209 |
-
const next = offset + size < total ? "Next ›" : "";
|
| 210 |
-
return {
|
| 211 |
-
...summaryCell(`${prev} ${from} to ${to} of ${total.toLocaleString()} ${next}`.trim(),
|
| 212 |
-
SUMMARY_BG, SUMMARY_TEXT, SUMMARY_FONT),
|
| 213 |
-
contentAlign: "center",
|
| 214 |
-
};
|
| 215 |
-
}
|
| 216 |
if (agg === undefined && col === 0 && vr.groupKey === TOTAL_GROUP_KEY)
|
| 217 |
return {
|
| 218 |
...summaryCell(TOTAL_ROW_LABEL, SUMMARY_BG, SUMMARY_TEXT, SUMMARY_FONT),
|
|
|
|
| 201 |
const agg = field ? vr.aggs[field.key] : undefined;
|
| 202 |
// HOTFIX 2026-09-23: a paged group's first footer cell is its pager. The click handler in
|
| 203 |
// `CustomerGrid.onCellClicked` reads the left half as Previous and the right half as Next.
|
| 204 |
+
// HOTFIX 2026-09-24: a paged group's pager is a DOM overlay (`CustomerGrid` `.cg-group-pager`),
|
| 205 |
+
// so it is not clipped to the first column's width; this cell stays blank beneath it.
|
| 206 |
+
if (col === 0 && vr.page) return summaryCell("", SUMMARY_BG, SUMMARY_TEXT, SUMMARY_FONT);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 207 |
if (agg === undefined && col === 0 && vr.groupKey === TOTAL_GROUP_KEY)
|
| 208 |
return {
|
| 209 |
...summaryCell(TOTAL_ROW_LABEL, SUMMARY_BG, SUMMARY_TEXT, SUMMARY_FONT),
|
web/src/index.css
CHANGED
|
@@ -426,7 +426,7 @@ body {
|
|
| 426 |
.cg-pager {
|
| 427 |
display: flex;
|
| 428 |
align-items: center;
|
| 429 |
-
justify-content: flex-
|
| 430 |
gap: 12px;
|
| 431 |
padding: 6px 12px;
|
| 432 |
border-top: 1px solid var(--cg-line, #E3E8EF);
|
|
@@ -436,6 +436,42 @@ body {
|
|
| 436 |
}
|
| 437 |
.cg-pager-label { display: inline-flex; gap: 10px; font-variant-numeric: tabular-nums; }
|
| 438 |
.cg-pager-page { color: var(--cg-faint, #8A97A8); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 439 |
.cg-pager[aria-busy="true"] .cg-pager-label { opacity: 0.6; }
|
| 440 |
/* The view-switch pending bar: the rows stay painted underneath it. */
|
| 441 |
.cg-view-pending {
|
|
|
|
| 426 |
.cg-pager {
|
| 427 |
display: flex;
|
| 428 |
align-items: center;
|
| 429 |
+
justify-content: flex-start;
|
| 430 |
gap: 12px;
|
| 431 |
padding: 6px 12px;
|
| 432 |
border-top: 1px solid var(--cg-line, #E3E8EF);
|
|
|
|
| 436 |
}
|
| 437 |
.cg-pager-label { display: inline-flex; gap: 10px; font-variant-numeric: tabular-nums; }
|
| 438 |
.cg-pager-page { color: var(--cg-faint, #8A97A8); }
|
| 439 |
+
/* HOTFIX 2026-09-24 (owner): Previous / Next in the brand's primary purple, so they are easy to find. */
|
| 440 |
+
.cg-pager-btn {
|
| 441 |
+
font: inherit;
|
| 442 |
+
font-size: 12px;
|
| 443 |
+
font-weight: 600;
|
| 444 |
+
padding: 4px 12px;
|
| 445 |
+
border-radius: 6px;
|
| 446 |
+
border: 1px solid var(--lp-primary, #5433cc);
|
| 447 |
+
background: var(--lp-primary, #5433cc);
|
| 448 |
+
color: #fff;
|
| 449 |
+
cursor: pointer;
|
| 450 |
+
}
|
| 451 |
+
.cg-pager-btn:hover:not(:disabled) { background: var(--lp-primary-hover, #472bad); }
|
| 452 |
+
.cg-pager-btn:disabled {
|
| 453 |
+
background: var(--lp-primary-tint, #eeeafc);
|
| 454 |
+
border-color: var(--lp-primary-tint, #eeeafc);
|
| 455 |
+
color: #8a7fc0;
|
| 456 |
+
cursor: default;
|
| 457 |
+
}
|
| 458 |
+
.cg-pager-size { display: inline-flex; align-items: center; gap: 6px; }
|
| 459 |
+
/* HOTFIX 2026-09-24: a group's pager rides over its footer row, free of the first column's width. */
|
| 460 |
+
.cg-group-pager {
|
| 461 |
+
position: absolute;
|
| 462 |
+
z-index: 2;
|
| 463 |
+
display: flex;
|
| 464 |
+
align-items: center;
|
| 465 |
+
gap: 10px;
|
| 466 |
+
padding: 0 8px;
|
| 467 |
+
background: #F7F8FA;
|
| 468 |
+
font-size: 12px;
|
| 469 |
+
color: var(--cg-muted, #5B6B7F);
|
| 470 |
+
white-space: nowrap;
|
| 471 |
+
pointer-events: auto;
|
| 472 |
+
}
|
| 473 |
+
.cg-group-pager .cg-pager-btn { padding: 2px 10px; }
|
| 474 |
+
.cg-pager-size select { font: inherit; font-size: 12px; padding: 2px 4px; }
|
| 475 |
.cg-pager[aria-busy="true"] .cg-pager-label { opacity: 0.6; }
|
| 476 |
/* The view-switch pending bar: the rows stay painted underneath it. */
|
| 477 |
.cg-view-pending {
|