@guiexpert/table 1.1.119 → 1.1.121

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.
@@ -132,6 +132,11 @@ export declare class TableOptions implements TableOptionsIf {
132
132
  focusFrame?: FocusFrameMode;
133
133
  /** A cover grid fills the whole width ({@link TableOptionsIf.coverGridFill}). Not set = off. @since 1.1.117 */
134
134
  coverGridFill?: boolean | Partial<CoverGridFillOptionsIf>;
135
+ /**
136
+ * Rows that stay visible keep their cells when the table scrolls or the selection changes
137
+ * ({@link TableOptionsIf.keepCellsOnScroll}). Not set = `true`. @since 1.1.120
138
+ */
139
+ keepCellsOnScroll?: boolean;
135
140
  /** Persistent filter row below the column titles ({@link TableOptionsIf.filterRow}). Not set = off. @since 1.1.114 */
136
141
  filterRow?: boolean | Partial<FilterRowOptionsIf>;
137
142
  /** Per-column filter menu popup ({@link TableOptionsIf.columnFilterMenu}). Not set = off. @since 1.1.114 */
@@ -562,6 +562,30 @@ export interface TableOptionsIf {
562
562
  * @see [Live demo: cover grid](https://gui.expert/showcase/covergrid/run/)
563
563
  */
564
564
  coverGridFill?: boolean | Partial<CoverGridFillOptionsIf>;
565
+ /**
566
+ * Rows that stay visible keep their cells (default `true`, since 1.1.120): a scroll step builds only the rows that
567
+ * come into view – the others keep their row element **with** its cells, only its position changes. The same for a
568
+ * change of selection or focus (a click, an arrow key): only the rows whose selection or focus changed are built.
569
+ * A cell renderer therefore runs **once when its row comes into view** (and with every `repaint()`,
570
+ * `updateCells()`, sorting, filter … as before), its cleanup function once when the row leaves the view or is built
571
+ * again. An `<img>`, `<canvas>`, `<video>`, `<input>` or framework component in a cell is not created again while
572
+ * its row is visible: no reloading images, focus and caret stay.
573
+ *
574
+ * Before 1.1.120 every render pass – also every scroll step – emptied the table and built every visible cell again.
575
+ * Consequence of the new default: data you change **without telling the table** (no `repaint()`, no
576
+ * `updateCells()`) no longer shows up with the next scroll step or click, but when the row is built again.
577
+ * `false` brings back the old behaviour (every pass builds every cell).
578
+ *
579
+ * Horizontal scrolling builds the cells of the scrollable columns as before (the fixed columns stay); a body with
580
+ * col-/rowspans is always built completely.
581
+ *
582
+ * @example
583
+ * // a renderer that must run for every scroll step (rare): switch it off
584
+ * const tableOptions: TableOptionsIf = { ...new TableOptions(), keepCellsOnScroll: false };
585
+ *
586
+ * @since 1.1.120
587
+ */
588
+ keepCellsOnScroll?: boolean;
565
589
  /**
566
590
  * The state the table starts with: column layout, sorting, tree, checked and selected rows … – e.g. loaded from
567
591
  * your server ({@link TableApi.getState}, {@link EventListenerIf.onStateChanged}). A state stored by
@@ -154,6 +154,37 @@ export declare class RenderScope extends EleScope {
154
154
  * @since 1.1.99
155
155
  */
156
156
  tableSheet?: TableSheet;
157
+ /**
158
+ * The next render pass may keep the rows that did not change – set by the passes that only scroll or only change
159
+ * selection and focus ({@link renderKeepingRows}), read and cleared at the start of {@link adjustAfterScrolling}.
160
+ * Every other pass builds every cell, as before 1.1.120.
161
+ */
162
+ private keepRowsRequested;
163
+ /** A repaint was asked for but did not run yet ({@link invalidateRenderedRows}): the drawn rows may be outdated. */
164
+ private renderedRowsStale;
165
+ /** This pass keeps rows (and header/footer) that did not change. */
166
+ private keepRowsInPass;
167
+ /** The drawn body rows by row index – only while rows are recorded ({@link canRecordBodyRows}). */
168
+ private readonly renderedRows;
169
+ /** The last body pass recorded its rows (otherwise the rows in the DOM are unknown: build all). */
170
+ private renderedRowsRecorded;
171
+ /** Columns and widths of the last pass – another layout builds everything. */
172
+ private renderedLayoutKey;
173
+ /** Header and footer of the last pass: built for this key (horizontal offset, header focus). */
174
+ private renderedFixedAreas;
175
+ private renderPassId;
176
+ private bodyPass?;
177
+ /** The row side whose cells are built now: their cleanup functions and custom classes are recorded in it. */
178
+ private buildingSide?;
179
+ /** The horizontal offset of the center cells in this pass (see adjustColumnsToRowParent). */
180
+ private centerLeftOfPass;
181
+ /**
182
+ * Selection or focus changed since the last render pass ({@link TableScope} sets it in `onSelectionChanged` and
183
+ * `onFocusChanged`) – see {@link BodyPass.checkCustom}.
184
+ */
185
+ protected selectionOrFocusChanged: boolean;
186
+ /** Focused cell, header focus and focus frame of the last pass (models that change without an event). */
187
+ private renderedFocusKey;
157
188
  /** Positions of the body rows (prefix sums of the heights + detail rows), see {@link getBodyRowLayout}. */
158
189
  private readonly bodyRowLayout;
159
190
  private bodyRowLayoutDirty;
@@ -375,6 +406,36 @@ export declare class RenderScope extends EleScope {
375
406
  * @since 1.1.107
376
407
  */
377
408
  onViewportScroll(): void;
409
+ /**
410
+ * A render pass for a change that touches **only** the scroll position, the selection, the focus or the focus frame:
411
+ * rows that stay visible and whose selection and focus are the same keep their cells (their renderers do not run,
412
+ * images are not loaded again, an input keeps focus and caret), header and footer are not built again. Everything
413
+ * else – data, columns, sizes, sorting, filter … – must call {@link repaint} or {@link repaintHard}.
414
+ *
415
+ * With `keepCellsOnScroll: false`, a body with col-/rowspans or a repaint that is still due
416
+ * ({@link invalidateRenderedRows}) it builds every cell like {@link repaint}.
417
+ *
418
+ * @since 1.1.120
419
+ */
420
+ renderKeepingRows(): void;
421
+ /**
422
+ * Marks the drawn rows as outdated: the next render pass builds every cell, also a pass that would keep rows (a
423
+ * scroll step). Called where a repaint is asked for but runs later (the debounced repaint after a mouse click).
424
+ *
425
+ * @since 1.1.120
426
+ */
427
+ invalidateRenderedRows(): void;
428
+ /** `keepCellsOnScroll` (default true). */
429
+ private isKeepCellsEnabled;
430
+ /**
431
+ * Are the body rows recorded (and may they be kept)? Not with `keepCellsOnScroll: false`, and not with col-/rowspans
432
+ * in the body: span cells lie outside their rows and are positioned by the scroll offset.
433
+ */
434
+ private canRecordBodyRows;
435
+ /** Columns and widths the rows are built for (all changes of them repaint – this is the safety net). */
436
+ private createLayoutKey;
437
+ /** Header or footer: not built again by a pass that keeps rows if nothing it shows changed. */
438
+ private adjustFixedArea;
378
439
  /**
379
440
  * Recalculates the column widths of the table (% and weight columns depend on the available width) and repaints.
380
441
  *
@@ -590,6 +651,57 @@ export declare class RenderScope extends EleScope {
590
651
  * @protected
591
652
  */
592
653
  protected adjustArea(areaIdent: AreaIdent, yStart?: number): void;
654
+ /** The loop over the body rows left the viewport at this row: last (fully) visible row, number of displayed rows. */
655
+ private setLastVisibleBodyRow;
656
+ /** What the body pass needs for every row – read once (selection and focus model, the drawn center columns). */
657
+ private createBodyPass;
658
+ /**
659
+ * What a row shows of the selection and the focus in the columns `from … to` – what changes without new data. The
660
+ * same key as when the row was drawn: the row is kept as it is. Another key: selection and focus are drawn again
661
+ * on the kept cells ({@link redecorateRowSide}).
662
+ */
663
+ private bodyRowStateKey;
664
+ /**
665
+ * What the **cells** of a row show beyond their data and that may change without a pass that builds everything: an
666
+ * open in-cell editor (`getEditRenderer`), the cell that owns the editor above it (`aria-owns`), pending values of a
667
+ * batch edit, a row that is dragged, an open detail row. Another key: the cells are built again.
668
+ */
669
+ private bodyRowEditorKey;
670
+ /** Custom classes and styles of a cell as one text ('' = none) – see {@link RenderedRowSide.customKeys}. */
671
+ private static customKeyOf;
672
+ /**
673
+ * Draws selection and focus of a kept row side again **without touching its cells** (their content, an `<img>`, an
674
+ * input with its focus stay): the selection backgrounds and the focus frame are replaced – at the places a pass that
675
+ * builds the row puts them –, the cells get their selection class, `aria-selected` and the row its `aria-selected`.
676
+ *
677
+ * @returns {boolean} false if that is not enough and the side must be built: a cell is missing, or the custom
678
+ * classes or styles of a cell (`getCustomClassesAt`, `getCustomStyleAt`) changed – e.g. a model that marks the
679
+ * selected row with a class of its own
680
+ */
681
+ private redecorateRowSide;
682
+ /**
683
+ * Draws a body row whose sides are recorded: a side that did not change (same height, same position of its cells,
684
+ * same selection and focus) keeps its row div with all cells – only `top` is set. Any other side is built (again)
685
+ * and put behind the row before it, so the order of the row divs stays the order of the rows.
686
+ */
687
+ private renderRecordedBodyRow;
688
+ private renderRecordedRowSide;
689
+ /** The custom classes and styles of the drawn cells of a kept side are the ones they were built with. */
690
+ private hasSameCustomKeys;
691
+ /**
692
+ * An open in-cell editor (`getEditRenderer`) in a kept row gets the focus back, as it does when its cell is built
693
+ * (a click on another cell or on the scroll bar took it; the grid ignores the arrow keys while the editor is open).
694
+ */
695
+ private refocusInCellEditor;
696
+ /** Calls the cleanup functions of the cells of a row side – once (the list is emptied first). */
697
+ private runSideCleanups;
698
+ private runRowCleanups;
699
+ /** After the loop of a pass that keeps rows: the rows that were not drawn left the view. */
700
+ private removeRowsOutOfView;
701
+ /** Forgets all recorded rows and calls the cleanup functions of their cells (the areas are emptied by the caller). */
702
+ private dropRenderedRows;
703
+ /** The recorded side of a body row that holds a cell div. */
704
+ private findRenderedSide;
593
705
  /** Number of visible persistent filter rows (0 without filter row; overridden in {@link TableScope}). @since 1.1.114 */
594
706
  protected getFilterRowCount(): number;
595
707
  /**
@@ -8,7 +8,19 @@ import { RendererCleanupFnType } from './renderer-cleanup-fn.type.js';
8
8
  * Assign it per column and area (`columnDef.rendererMap.body = …`, or `bodyRenderer` in {@link ColumnDef.create})
9
9
  * or return it from {@link AreaModelIf.getCellRenderer}.
10
10
  *
11
- * Renderers are called only for visible cells, on every repaint – keep them cheap.
11
+ * **When it runs** (since 1.1.120): only for visible cells – **once when the row comes into view**, and again with
12
+ * every repaint that may show other data (`repaint()`, `repaintHard()`, `updateCells()`, sorting, filter, new column
13
+ * widths …). Scrolling, a click or an arrow key do **not** call it again for a row that stays visible: the row keeps
14
+ * its cells, so an `<img>`, `<canvas>`, `<input>` or framework component you create here stays the same element (no
15
+ * image is loaded again, focus and caret stay). The cleanup function you return runs once – when the row leaves the
16
+ * view, when the cell is built again, or when the table is destroyed.
17
+ *
18
+ * Consequences: read what the cell shows from `cellValue` / the model **in `render()`** and tell the table when data
19
+ * changed ({@link TableApi.repaint}, {@link TableApi.updateCells}) – it no longer shows up by itself with the next
20
+ * scroll step. A renderer whose look depends on the selection or the focus is not called when they change (the table
21
+ * draws its own selection and focus on the kept cells); use `getCustomClassesAt()` for that – a changed class builds
22
+ * the row again – or call `repaint()` in `onSelectionChanged`. {@link TableOptionsIf.keepCellsOnScroll} `false`
23
+ * brings back the behaviour before 1.1.120 (every render pass builds every visible cell).
12
24
  *
13
25
  * @example
14
26
  * class StatusBadgeRenderer implements CellRendererIf {
@@ -23,6 +35,20 @@ import { RendererCleanupFnType } from './renderer-cleanup-fn.type.js';
23
35
  * }
24
36
  * columnDefs[9].rendererMap.body = new StatusBadgeRenderer();
25
37
  *
38
+ * @example
39
+ * // A picture per row: the <img> is created once while the row is visible – not for every scroll step
40
+ * class PictureRenderer implements CellRendererIf {
41
+ * render(cellDiv: HTMLDivElement, _rowIndex: number, _columnIndex: number, _areaIdent: AreaIdent,
42
+ * _areaModel: AreaModelIf, url: unknown): RendererCleanupFnType | undefined {
43
+ * const img = document.createElement("img");
44
+ * img.src = String(url);
45
+ * img.alt = "";
46
+ * img.loading = "lazy";
47
+ * cellDiv.appendChild(img);
48
+ * return () => img.removeAttribute("src"); // once, when the row leaves the view: stops a running download
49
+ * }
50
+ * }
51
+ *
26
52
  * @see Training: [Cell renderers](https://gui.expert/training/cell-renderers/),
27
53
  * [Framework components as cells](https://gui.expert/training/framework-components/)
28
54
  *
@@ -39,7 +65,8 @@ export interface CellRendererIf {
39
65
  * @param areaModel - the model of this area (e.g. for `getRowByIndex(rowIndex)`)
40
66
  * @param cellValue - the value of the cell (`areaModel.getValueAt(rowIndex, columnIndex)`)
41
67
  * @param domService - create and change elements through it (works with Angular's Renderer2, too)
42
- * @returns optionally a cleanup function, called before the cell is drawn again
68
+ * @returns optionally a cleanup function – called once when the cell goes away: its row leaves the view, the cell
69
+ * is built again (a repaint, `updateCells()`) or the table is destroyed
43
70
  */
44
71
  render(cellDiv: HTMLDivElement, rowIndex: number, columnIndex: number, areaIdent: AreaIdent, areaModel: AreaModelIf, cellValue: any, domService: DomServiceIf): RendererCleanupFnType | undefined;
45
72
  }
@@ -1,2 +1,16 @@
1
- /** @category Renderers & editing */
1
+ /**
2
+ * A function a {@link CellRendererIf} may return from `render()`: the table calls it **once** when the cell goes away
3
+ * – its row leaves the view (scrolling), the cell is built again (a repaint, `updateCells()`, sorting, filter …) or
4
+ * the table is destroyed. Remove listeners and timers, unmount a framework component, stop a download.
5
+ *
6
+ * Since 1.1.120 it is **not** called for every scroll step: rows that stay visible keep their cells
7
+ * ({@link TableOptionsIf.keepCellsOnScroll}).
8
+ *
9
+ * @example
10
+ * const span = document.createElement("span");
11
+ * const timer = setInterval(() => { span.textContent = new Date().toLocaleTimeString(); }, 1000);
12
+ * const cleanup: RendererCleanupFnType = () => clearInterval(timer);
13
+ *
14
+ * @category Renderers & editing
15
+ */
2
16
  export type RendererCleanupFnType = Function;
@@ -117,6 +117,42 @@ export declare class ConvenienceDomService {
117
117
  createAreaDivWithClass(clazz: string, parent: HTMLDivElement, areaIdent: AreaIdent, sideIdent: SideIdent): HTMLDivElement;
118
118
  createDivWithClass(clazz: string, parent: HTMLDivElement): HTMLDivElement;
119
119
  addRowDiv(divScope: DivScope, geo: GeoData, rowIndex: number | undefined, areaIdent: AreaIdent, sideIdent: SideIdent, text?: string): HTMLDivElement;
120
+ /**
121
+ * The row div of a row – a new one or the (emptied) one the row had before – with its classes, position and
122
+ * attributes, but **not** put into the area: {@link addRowDiv} appends it, {@link insertAfter} puts it at its place
123
+ * between rows that are kept (since 1.1.120).
124
+ *
125
+ * @param {DivScope} divScope - the area (its `cache` holds the row divs by row index)
126
+ * @param {GeoData} geo - position and size, `geo.index` = the row index
127
+ * @param {number} rowIndex - the row index
128
+ * @param {AreaIdent} areaIdent - header, body or footer
129
+ * @param {SideIdent} sideIdent - west, center or east
130
+ * @param {string} [text] - a text for debugging
131
+ * @returns {HTMLDivElement} the row div
132
+ * @since 1.1.120
133
+ */
134
+ prepareRowDiv(divScope: DivScope, geo: GeoData, rowIndex: number | undefined, areaIdent: AreaIdent, sideIdent: SideIdent, text?: string): HTMLDivElement;
135
+ /**
136
+ * Puts a child directly behind another child of the parent (`previous` undefined: at the start). A child that is
137
+ * already there is **not** moved: moving an element in the DOM drops the focus and the caret of an input in it and
138
+ * restarts its CSS transitions.
139
+ *
140
+ * @param {HTMLElement} parent - the parent element
141
+ * @param {HTMLElement} child - the element to place
142
+ * @param {HTMLElement} [previous] - the child it follows
143
+ * @since 1.1.120
144
+ */
145
+ insertAfter(parent: HTMLElement, child: HTMLElement, previous?: HTMLElement): void;
146
+ /**
147
+ * Puts a child before another child of the parent (`null`: at the end) – with {@link DomServiceIf.insertBefore} if
148
+ * the DOM service has it, otherwise directly.
149
+ *
150
+ * @param {HTMLElement} parent - the parent element
151
+ * @param {HTMLElement} child - the element to insert or to move
152
+ * @param {HTMLElement | null} before - the child it is put in front of
153
+ * @since 1.1.120
154
+ */
155
+ insertBefore(parent: HTMLElement, child: HTMLElement, before: HTMLElement | null): void;
120
156
  addColumnDiv(para: AddColumnDivPara): HTMLDivElement;
121
157
  addCheckboxToDiv(parent: HTMLDivElement, checkedType: CheckedType, areaIdent: AreaIdent, rowIndex: number, ariaLabel?: string): HTMLDivElement;
122
158
  addLabelDiv(parent: HTMLDivElement, text?: string, firstTreeColumn?: boolean, rowIndex?: number, columnIndex?: number, areaIdent?: AreaIdent): HTMLDivElement;
@@ -37,4 +37,21 @@ export interface DomServiceIf {
37
37
  * @since 1.1.91
38
38
  */
39
39
  removeAttribute?(ele: HTMLElement, key: string): void;
40
+ /**
41
+ * Inserts a child before another child of the parent (`before === null`: at the end). Optional (since 1.1.120): rows
42
+ * that scroll into view above the rows that are kept are inserted before them. Without it the table calls
43
+ * `parent.insertBefore(child, before)` itself.
44
+ *
45
+ * @param {HTMLElement} parent - the parent element
46
+ * @param {HTMLElement} child - the element to insert (or to move)
47
+ * @param {HTMLElement | null} before - the child the new one is put in front of, `null` = append
48
+ *
49
+ * @example
50
+ * insertBefore(parent: HTMLElement, child: HTMLElement, before: HTMLElement | null): void {
51
+ * parent.insertBefore(child, before);
52
+ * }
53
+ *
54
+ * @since 1.1.120
55
+ */
56
+ insertBefore?(parent: HTMLElement, child: HTMLElement, before: HTMLElement | null): void;
40
57
  }
@@ -11,4 +11,5 @@ export declare class SimpleDomService implements DomServiceIf {
11
11
  createText(value: string): any;
12
12
  setAttribute(ele: HTMLElement, key: string, value: string): void;
13
13
  removeAttribute(ele: HTMLElement, key: string): void;
14
+ insertBefore(parent: HTMLElement, child: HTMLElement, before: HTMLElement | null): void;
14
15
  }
@@ -1047,13 +1047,32 @@ export declare class TableScope extends RenderScope implements OnActionTriggered
1047
1047
  * @returns {void}
1048
1048
  */
1049
1049
  onMouseClicked(evt: GeMouseEvent, previousEvt: GeMouseEvent | undefined): boolean;
1050
- debounceRepaint(): void;
1050
+ /** The scheduled repaint keeps the rows that did not change (it was asked for by selection/focus changes only). */
1051
+ private pendingRepaintKeepsRows;
1052
+ /** The same for a repaint that {@link cancelPendingRepaint} took out (the mouse handler holds it until mouseup). */
1053
+ private cancelledRepaintKeepsRows;
1054
+ /**
1055
+ * Repaints a moment later (1 ms): after the events of the current mouse click (a repaint replaces cells – the
1056
+ * browser would send `click`/`dblclick` to a removed element).
1057
+ *
1058
+ * @param {boolean} [keepRows=false] - true: only selection, focus or the focus frame changed – rows whose selection
1059
+ * and focus are the same keep their cells ({@link renderKeepingRows}, since 1.1.120). false: data may have
1060
+ * changed, every cell is built; until then also a scroll step builds every cell.
1061
+ */
1062
+ debounceRepaint(keepRows?: boolean): void;
1051
1063
  /**
1052
1064
  * Cancels a repaint scheduled by {@link debounceRepaint}.
1053
1065
  *
1054
1066
  * @returns true if a repaint was pending
1055
1067
  */
1056
1068
  cancelPendingRepaint(): boolean;
1069
+ /**
1070
+ * Schedules the repaint again that {@link cancelPendingRepaint} took out (the mouse handler after `mouseup`) – a
1071
+ * repaint that keeps rows stays one.
1072
+ *
1073
+ * @since 1.1.120
1074
+ */
1075
+ resumeCancelledRepaint(): void;
1057
1076
  publishGeMouseEvent(evt: GeMouseEvent): void;
1058
1077
  onFocusChanged(sm: FocusModelIf): void;
1059
1078
  /**
package/llms.txt CHANGED
@@ -382,6 +382,30 @@ const column = ColumnDef.create({ property: "status", headerLabel: "Status", bod
382
382
  `TrueFalseCellRenderer`, `CheckboxCellRenderer`, … Framework components as cells: `ComponentRendererWrapper` (React,
383
383
  Preact, Vue, Svelte, Solid), Angular `RenderWrapperFactory.create(MyComponent, cdr)`.
384
384
  - If you must build HTML: `escapeHtml(value)`. Buttons/inputs in a cell: `tabindex="-1"`. → instructions.md 6.1, 6.14
385
+ - **When `render()` runs (since 1.1.120):** once when the row comes into view, and with every repaint that may show
386
+ other data (`repaint()`, `repaintHard()`, `updateCells()`, sorting, filter). **Not** for every scroll step, click or
387
+ arrow key: a row that stays visible keeps its cells. The cleanup function runs once, when the row leaves the view
388
+ (or the cell is built again, or the table is destroyed).
389
+
390
+ **Pictures in cells** – create the `<img>` in the renderer; it is the same element while the row is visible (no
391
+ reload while scrolling or selecting, no cache "URL → element" needed):
392
+
393
+ ```ts
394
+ import { AreaIdent, AreaModelIf, CellRendererIf, ColumnDef, RendererCleanupFnType, px200 } from "@guiexpert/table";
395
+
396
+ class PictureRenderer implements CellRendererIf {
397
+ render(cellDiv: HTMLDivElement, _rowIndex: number, _columnIndex: number, _areaIdent: AreaIdent,
398
+ _areaModel: AreaModelIf, url: unknown): RendererCleanupFnType | undefined {
399
+ const img = document.createElement("img");
400
+ img.src = String(url);
401
+ img.alt = "";
402
+ img.loading = "lazy";
403
+ cellDiv.appendChild(img);
404
+ return () => img.removeAttribute("src"); // once, when the row leaves the view: stops a running download
405
+ }
406
+ }
407
+ const picture = ColumnDef.create({ property: "pictureUrl", headerLabel: "Picture", width: px200, bodyRenderer: new PictureRenderer() });
408
+ ```
385
409
 
386
410
  ### R11 – Editing
387
411
 
@@ -679,6 +703,10 @@ Symptom → cause → fix.
679
703
  `ColumnDef.filter = { getValues }`) (R19).
680
704
  - **Hiding the filter row (`setFilterRowVisible(false)`) still hides rows** → by design, toggling the filter row only
681
705
  toggles the UI; active filters stay → call `tableApi.clearColumnFilters()` if you want to clear them too (R19).
706
+ - **A cell shows an old value after I changed my row object** (since 1.1.120) → rows that stay visible keep their
707
+ cells; scrolling or a click no longer rebuilds them → say that data changed: `updateCells([...])`, `repaint()` or
708
+ `repaintHard()` (R6). Same for a renderer whose look depends on the selection: `getCustomClassesAt()` or `repaint()`
709
+ in `onSelectionChanged`. Old behaviour: `tableOptions.keepCellsOnScroll: false`.
682
710
  - **`AsyncBodyAreaModelObjectArray` cannot be imported** → unfinished, not exported → own `AreaModel` (R8, R17).
683
711
  - **Invented APIs** – these do NOT exist: `getSelectedRows()`, `onKeyDown`, `api.addRow()`, `api.refresh()`,
684
712
  `setData()`, `gridOptions`, `rowData`, `columnDefs` as a table option (it is a model parameter). Use R4–R7.
@@ -701,6 +729,8 @@ Full answers: instructions.md section 6.26 (https://github.com/guiexperttable/mo
701
729
  - Cover grid in the full width (since 1.1.117): `tableOptions.coverGridFill: { tileWidth, aspectRatio, extraHeight }` – tiles stretch flush to the edge, a resize takes effect in the same frame; slider: `tableApi.setCoverGridFill({ tileWidth })`. → R21
702
730
  - Cover grid warns "the body model has no row objects": fixed in 1.1.116 – its scroll state stores the first visible item (`id`/`uuid` or `getRowId(item, index)`), no warning; a resize or a new tile size keeps that item at the top. Never `getRowId: (_row, rowIndex) => rowIndex` for a cover grid (a row holds other items after a resize).
703
731
  - `@guiexpert/demo-table-models` makes the bundle ~600 kB bigger: fixed in 1.1.116 (nothing computed on import, `"sideEffects": false`); an app with only `BookCoverRenderer` ≈ 11 kB minified.
732
+ - Pictures (or inputs, canvases, components) in cells flicker / reload while scrolling or clicking: fixed in 1.1.120 – rows that stay visible keep their cells, `render()` runs once per row in view, the cleanup once when it leaves. Remove caches "URL → element". → R10
733
+ - A changed row object does not show after scrolling (since 1.1.120): call `tableApi.updateCells(...)` / `repaint()` / `repaintHard()` – a visible row keeps its cells. A renderer that must run on every scroll step: `tableOptions.keepCellsOnScroll: false`. → R6, R10
704
734
  - Empty table: the host div needs a fixed height and the stylesheet `@guiexpert/table/css/main.css`.
705
735
 
706
736
  ## Feature reference
@@ -741,6 +771,7 @@ What the table can do – one line per feature, details in instructions.md (each
741
771
  - Live data / log tail (since 1.1.108): tableApi.appendRows(rows, { follow?: "auto" (default: stays at the end if it was at the end, else the first visible row stays) | true (always the end) | false (freeze), maxRows?: ring buffer – oldest rows removed from the start in blocks of ≥ 1 % }) → AppendRowsResultIf { added, shown, removed, following } | false (tree, row groups, pivot, spreadsheet, cell formulas) – AreaModelObjectArray body only, IN PLACE (pushes to your array, no copy), O(k): externalFilterFunction only for the new rows, sorted column / sort(fn) → merged in (binary search, behind equal rows); selection, focus, Shift+arrow anchor and checked rows stay at their rows (RowIndexShift, SelectionModel/FocusModel.adjustForRowChanges – no onSelectionChanged unless a selected row left the buffer); one render pass, none when only rows below the view came in (cells not rebuilt). Held mouse button: "auto" keeps the rows under the pointer and follows again after release. Own AreaModel: append yourself, then tableApi.rowsAppended(count, { follow, removedAtStart }). Not addRows() (copies all rows, resets filter and sort). Showcase logtail, demo apps/table-demo/log-tail.html, LogTailController + createLogTailModelAndOptions in @guiexpert/demo-table-models.
742
772
  - Open a cell, tile navigation, focus frame (since 1.1.115): EventListenerIf.onCellActivated(GeCellActivateEvent: areaIdent "body", rowIndex, columnIndex, value, row, source "keyboard" | "mouse" | "api", originalEvent) – Enter on the focused body cell or a double click, in every table, after the built-in jobs (row checkbox, detail row, tree node, editing.enterKey; double click: editor of an editable cell, tree node), not on handles, empty tiles or under a blocking overlay; the Enter key is not consumed; wrappers cellActivated. Cover grid keyboard: AreaModelIf.getTileLayout?(): TileLayoutIf { getTileCount, getTilesPerRow, getTileAt(index), indexOfTile(item) } (CoverGridBodyModel implements it) → the items are one sequence: ←/→ previous/next with wrap (RTL mirrored), ↑/↓ one row (↓ without a tile below: last item), Home/End and Ctrl/⌘+Home/End first/last item, Page Up/Down; empty tiles never focused (keys and mouse); one render per key; the focus follows the item (sort, filter, resize, new items; filtered out → tile at the same index). DOM-free: navigateTiles(index, action, { count, perRow, pageRows, firstVisible }), tileIndexToCell, cellToTileIndex. tableOptions.focusFrame: "always" (default) | "keyboard" (only while the keyboard is used, default of CoverGridFactory.createCoverGridDefaultOptions) | "never"; FocusModel("none") does not hide the frame. CoverGridFactory.createCoverGridDefaultOptions (alias, the old createCoverGrisDefaultOptions is deprecated). Cover grid fixes: at least one column (was 0 → Infinity rows), no empty extra row, sort()/doSort() sort a copy (the app's items array keeps its order).
743
773
  - Cover grid in the full width (since 1.1.117): tableOptions.coverGridFill: true | Partial<CoverGridFillOptionsIf { tileWidth, aspectRatio?, extraHeight? }> → columns = max(1, floor(layout width / tileWidth)), tiles stretched flush (first columns +1 px for the rest), height = round(width × aspectRatio) + extraHeight (without ratio: coverHeight); a resize in the ResizeObserver callback (same frame, one render, no debounce), top item and focused item stay; next to a classic scroll bar the width is corrected in the same layout. TableApi.setCoverGridFill(parts | true | false): boolean (merges, one render, false = no cover grid), getCoverGridFill(). Model: CoverGridBodyModel.setFill/getFill/getTileWidthAt/getTileLeftAt/getTileRowWidth, coverWidth/coverHeight = effective size; DOM-free computeCoverGridFill(width, fill, coverHeight); isCoverGridBodyModel. Other body: one console warning. Also 1.1.117: CoverGridBodyModel.getConstantRowHeight() = coverHeight and getMaxColspan()/getMaxRowspan() = 1 (a resize of 1,000,000 items no longer O(rows)).
774
+ - Cells of visible rows are kept (since 1.1.120): tableOptions.keepCellsOnScroll (default true). A scroll step (scroll bar, wheel, scrollToPixel/scrollToIndex/ensureRowIsVisible/ensureColumnIsVisible) builds only the rows that come into view – rows that stay keep their row element with all cells, only `top` changes; header and footer are not built again by a vertical step; a horizontal step builds the scrollable columns, fixed columns stay. A change of selection, focus or focus frame (click, arrow keys, Shift+arrows, Ctrl/⌘+A, drag selection, tile navigation) builds no cell: selection backgrounds, the focus frame, `aria-selected` and `aria-activedescendant` are drawn on the kept cells (a cell whose getCustomClassesAt/getCustomStyleAt changed is built again). CellRendererIf.render() runs once per row in view (and with repaint(), repaintHard(), updateCells(), sorting, filter, column widths …), its cleanup function once when the row leaves the view, the cell is built again or the table is destroyed; updateCells() calls the cleanup of the replaced content at once. Not kept: a body with col-/rowspans (built completely, as before). `false` = every render pass builds every visible cell (behaviour before 1.1.120). Data changed without a repaint shows when the row is built again, not with the next scroll step (setRows/addRows/removeRows/updateRows mark the rows as outdated). DomServiceIf.insertBefore?(parent, child, before) is optional (the table falls back to the DOM).
744
775
  - Custom filtering
745
776
  - In-place cell editing
746
777
  - User-defined key and mouse events
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guiexpert/table",
3
- "version": "1.1.119",
3
+ "version": "1.1.121",
4
4
  "license": "MIT",
5
5
  "author": "Dr. Marc Kronberg <info@gui.expert> (https://gui.expert)",
6
6
  "repository": {