@guiexpert/table 1.1.116 → 1.1.117

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.
@@ -0,0 +1,32 @@
1
+ /**
2
+ * A cover grid that fills the whole width ({@link TableOptionsIf.coverGridFill}, since 1.1.117): as many tiles per row
3
+ * as fit with `tileWidth` (at least 1), then the tiles are stretched until the last one ends flush with the right
4
+ * edge (the first columns get the rest pixels, 1 px each). With `aspectRatio` the height grows with the width.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * const fill: CoverGridFillOptionsIf = {
9
+ * tileWidth: 165, // wanted (minimal) width of a tile
10
+ * aspectRatio: 220 / 165, // height / width of the cover image
11
+ * extraHeight: 44 // two lines of text below the cover
12
+ * };
13
+ * // 960 px → 5 tiles of 192 × 300 px (round(192 × 220 / 165) + 44)
14
+ * ```
15
+ *
16
+ * @since 1.1.117
17
+ * @category Table model
18
+ */
19
+ export interface CoverGridFillOptionsIf {
20
+ /**
21
+ * The wanted width of a tile in px – the minimal width: columns = `max(1, floor(width / tileWidth))`, then the tiles
22
+ * get wider until they fill the row. With `coverGridFill: true` the `coverWidth` of the model.
23
+ */
24
+ tileWidth: number;
25
+ /**
26
+ * Height / width of the stretched part of the tile (e.g. `220 / 165` for a book cover). Tile height =
27
+ * `round(tile width × aspectRatio) + extraHeight`. Not set: the height stays `coverHeight`.
28
+ */
29
+ aspectRatio?: number;
30
+ /** A fixed height added to the scaled height (a caption below the image), only with `aspectRatio`. Default 0. */
31
+ extraHeight?: number;
32
+ }
@@ -0,0 +1,41 @@
1
+ import { CoverGridFillOptionsIf } from './cover-grid-fill-options.if.js';
2
+
3
+ /**
4
+ * The geometry of a cover grid that fills its width ({@link computeCoverGridFill}).
5
+ *
6
+ * @since 1.1.117
7
+ * @category Table model
8
+ */
9
+ export interface CoverGridFillLayoutIf {
10
+ /** Tiles per row, ≥ 1. */
11
+ columns: number;
12
+ /** The width of the narrowest tile; the first `rest` columns are 1 px wider. */
13
+ baseWidth: number;
14
+ /** Pixels left over by `columns × baseWidth` – one more pixel for each of the first `rest` columns. */
15
+ rest: number;
16
+ /** The height of a tile (`coverHeight` without `aspectRatio`). */
17
+ tileHeight: number;
18
+ }
19
+ /**
20
+ * Computes the tiles of a cover grid that fill a width (DOM-free; {@link CoverGridBodyModel} uses it with
21
+ * {@link TableOptionsIf.coverGridFill}): columns = `max(1, floor(width / tileWidth))`, `baseWidth` =
22
+ * `floor(width / columns)`, the rest pixels go to the first columns (1 px each), so the last tile ends flush with the
23
+ * edge. Height = `round(baseWidth × aspectRatio) + extraHeight`, at least 1 (without a valid `aspectRatio`:
24
+ * `coverHeight`; an `extraHeight` that is no finite number counts as 0). A width ≤ 0 (hidden host) gives one column of
25
+ * `tileWidth` – no division by 0; a `tileWidth` that is no positive number gives one column of the whole width.
26
+ *
27
+ * @param width - the width to fill in px (fractions are floored)
28
+ * @param fill - wanted tile width, aspect ratio and extra height
29
+ * @param coverHeight - the height without `aspectRatio`
30
+ * @returns columns, widths and height
31
+ * @since 1.1.117
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * const layout = computeCoverGridFill(961, { tileWidth: 165 }, 220);
36
+ * // { columns: 5, baseWidth: 192, rest: 1, tileHeight: 220 } → widths 193, 192, 192, 192, 192
37
+ * ```
38
+ *
39
+ * @category Table model
40
+ */
41
+ export declare function computeCoverGridFill(width: number, fill: CoverGridFillOptionsIf, coverHeight: number): CoverGridFillLayoutIf;
@@ -25,6 +25,7 @@ import { UndoOptionsIf } from '../../undo/undo-options.if.js';
25
25
  import { CellFormulaOptionsIf } from '../../sheet/cell-formula-options.if.js';
26
26
  import { SpreadsheetOptionsIf } from '../../spreadsheet/spreadsheet-options.if.js';
27
27
  import { BatchEditOptionsIf } from '../../batch-edit/batch-edit-options.if.js';
28
+ import { CoverGridFillOptionsIf } from '../../cover-grid/cover-grid-fill-options.if.js';
28
29
 
29
30
  /**
30
31
  * The default editor of {@link TableOptions.getEditRenderer}: a text input in the cell ({@link InputCellRenderer}).
@@ -129,6 +130,8 @@ export declare class TableOptions implements TableOptionsIf {
129
130
  direction?: TableDirection;
130
131
  /** When the focus frame is drawn ({@link TableOptionsIf.focusFrame}). Not set = `"always"`. @since 1.1.115 */
131
132
  focusFrame?: FocusFrameMode;
133
+ /** A cover grid fills the whole width ({@link TableOptionsIf.coverGridFill}). Not set = off. @since 1.1.117 */
134
+ coverGridFill?: boolean | Partial<CoverGridFillOptionsIf>;
132
135
  /** Persistent filter row below the column titles ({@link TableOptionsIf.filterRow}). Not set = off. @since 1.1.114 */
133
136
  filterRow?: boolean | Partial<FilterRowOptionsIf>;
134
137
  /** Per-column filter menu popup ({@link TableOptionsIf.columnFilterMenu}). Not set = off. @since 1.1.114 */
@@ -24,6 +24,7 @@ import { TableStateIf } from '../../state/table-state.if.js';
24
24
  import { OverlayOptionsIf } from './overlay-options.if.js';
25
25
  import { TableDirection } from '../../rtl/table-direction.type.js';
26
26
  import { FocusFrameMode } from '../../focus/focus-frame.type.js';
27
+ import { CoverGridFillOptionsIf } from '../../cover-grid/cover-grid-fill-options.if.js';
27
28
  import { ColumnAutoWidthOptionsIf } from '../../column-drag/column-auto-width-options.if.js';
28
29
  import { ColumnFilterMenuOptionsIf, ColumnFilterOptionsIf, ColumnFilterTextsIf, FilterRowOptionsIf } from '../../column-filter/column-filter-options.if.js';
29
30
 
@@ -539,6 +540,28 @@ export interface TableOptionsIf {
539
540
  * @since 1.1.115
540
541
  */
541
542
  focusFrame?: FocusFrameMode;
543
+ /**
544
+ * A cover grid ({@link CoverGridFactory.createCoverGridModel}) fills the whole width: as many tiles of `tileWidth`
545
+ * per row as fit (at least 1), stretched until the last one ends flush with the edge (also next to a classic scroll
546
+ * bar); with `aspectRatio` the height grows with the width (`round(width × aspectRatio) + extraHeight`). A resize is
547
+ * taken over in the same frame with one render (not after {@link resizeEventDebounceDelay}), the top item and the
548
+ * focused item stay. `true` = `{ tileWidth: coverWidth }`, height unchanged. Change it at runtime with
549
+ * {@link TableApi.setCoverGridFill} (the options object stays as it is). `false` switches off a fill that was set
550
+ * on the model. Only for a cover grid body – any other body: a console warning, no effect.
551
+ *
552
+ * Replaces the code apps wrote before 1.1.117: an own `ResizeObserver`, `recalcColumnWidths()` and a function that
553
+ * set `coverWidth`/`coverHeight` (`fitCoversToWidth` in the demo models).
554
+ *
555
+ * @example
556
+ * const tableOptions: TableOptionsIf = {
557
+ * ...CoverGridFactory.createCoverGridDefaultOptions(264, () => "books"),
558
+ * coverGridFill: { tileWidth: 165, aspectRatio: 220 / 165, extraHeight: 44 }
559
+ * };
560
+ *
561
+ * @since 1.1.117
562
+ * @see [Live demo: cover grid](https://gui.expert/showcase/covergrid/run/)
563
+ */
564
+ coverGridFill?: boolean | Partial<CoverGridFillOptionsIf>;
542
565
  /**
543
566
  * The state the table starts with: column layout, sorting, tree, checked and selected rows … – e.g. loaded from
544
567
  * your server ({@link TableApi.getState}, {@link EventListenerIf.onStateChanged}). A state stored by
@@ -7,6 +7,7 @@ import { SortItem } from '../../common/sort-item.js';
7
7
  import { AreaIdent } from '../area-ident.type.js';
8
8
  import { SorterService } from '../../../service/sorter.service.js';
9
9
  import { TileLayoutIf } from './tile-layout.if.js';
10
+ import { CoverGridFillOptionsIf } from '../../../cover-grid/cover-grid-fill-options.if.js';
10
11
 
11
12
  /**
12
13
  * Body of a cover grid: `filteredItems[row * columns + column]` is the item of a tile (`getValueAt`), `columns` =
@@ -19,6 +20,10 @@ import { TileLayoutIf } from './tile-layout.if.js';
19
20
  * The model is a {@link TileLayoutIf} (since 1.1.115): the keyboard moves from item to item, empty tiles never get
20
21
  * the focus and the focus follows the item after sorting, filtering and resizing.
21
22
  *
23
+ * Full width (since 1.1.117): with {@link setFill} (or {@link TableOptionsIf.coverGridFill}) the columns come from the
24
+ * wanted tile width and the tiles are stretched until they fill the row – `coverWidth`/`coverHeight` then hold the
25
+ * **effective** size (renderers can read them), the wanted width is `getFill().tileWidth`.
26
+ *
22
27
  * @example
23
28
  * ```ts
24
29
  * declare const grid: CoverGridTableModel<string>;
@@ -37,13 +42,78 @@ export declare class CoverGridBodyModel<T> implements AreaModelIf, TileLayoutIf
37
42
  coverHeight: number;
38
43
  width: number;
39
44
  firstRowPaddingTop: number;
45
+ /** Marks the model for {@link isCoverGridBodyModel} (works across copies of the core). @since 1.1.117 */
46
+ readonly kind = "CoverGridBodyModel";
40
47
  rowSelectionModel: CheckboxModelIf<any> | undefined;
41
48
  areaIdent: AreaIdent;
42
49
  filteredItems: T[];
43
50
  /** @internal */
44
51
  protected sorterService: SorterService;
52
+ /** Full width: the settings (`undefined` = off) and the geometry for `fillWidth`. */
53
+ private fill?;
54
+ private fillLayout?;
55
+ private fillWidth;
45
56
  constructor(items: T[], cellRenderer: CellRendererIf, coverWidth?: number, coverHeight?: number, width?: number, firstRowPaddingTop?: number);
46
57
  setParentWidth(widthInPixel: number): void;
58
+ /**
59
+ * Lets the tiles fill the whole width (since 1.1.117): columns = `max(1, floor(width / tileWidth))`, the tiles are
60
+ * stretched until the last one ends flush with the edge (the first columns get the rest pixels), with `aspectRatio`
61
+ * the height follows. `coverWidth`/`coverHeight` are set to the effective size at once and after every width change.
62
+ * A part changes only that part (with `replace` the parts are the whole settings – `tileWidth` stays if not given);
63
+ * `true` = `{ tileWidth: coverWidth }`; `false` switches it off – the tiles get `tileWidth` (and the height of that
64
+ * width with `aspectRatio`). While it is on, `coverWidth`/`coverHeight` are an **output**: values you write are
65
+ * replaced with the next width change – change the tile size with `setFill` / {@link TableApi.setCoverGridFill}. Call `tableApi.repaintHard()` afterwards – or use
66
+ * {@link TableApi.setCoverGridFill}, which does it with one render. The table usually calls it for you
67
+ * ({@link TableOptionsIf.coverGridFill}).
68
+ *
69
+ * @param fill - the settings, `true` or `false`
70
+ * @param replace - `true`: the given parts replace the settings instead of changing them (the table uses it for
71
+ * {@link TableOptionsIf.coverGridFill})
72
+ * @since 1.1.117
73
+ *
74
+ * @example
75
+ * ```ts
76
+ * declare const grid: CoverGridTableModel<string>;
77
+ * grid.bodyModel.setFill({ tileWidth: 165, aspectRatio: 4 / 3 });
78
+ * tableApi.repaintHard();
79
+ * ```
80
+ */
81
+ setFill(fill: boolean | Partial<CoverGridFillOptionsIf> | undefined, replace?: boolean): void;
82
+ /**
83
+ * The settings of the full width ({@link setFill}) – a copy, `undefined` if the tiles keep `coverWidth`.
84
+ *
85
+ * @returns {CoverGridFillOptionsIf | undefined} the settings
86
+ * @since 1.1.117
87
+ */
88
+ getFill(): CoverGridFillOptionsIf | undefined;
89
+ /**
90
+ * The width of the tiles in a column: `coverWidth`, with {@link setFill} 1 px more for the first columns (the rest
91
+ * pixels of the width).
92
+ *
93
+ * @param columnIndex - the column
94
+ * @returns {number} the width in px
95
+ * @since 1.1.117
96
+ */
97
+ getTileWidthAt(columnIndex: number): number;
98
+ /**
99
+ * The x position of a column from the start of the row (`columnIndex × coverWidth`, with {@link setFill} plus the
100
+ * rest pixels of the columns before).
101
+ *
102
+ * @param columnIndex - the column
103
+ * @returns {number} the position in px
104
+ * @since 1.1.117
105
+ */
106
+ getTileLeftAt(columnIndex: number): number;
107
+ /**
108
+ * The width of a full row of tiles (`columns × coverWidth`; with {@link setFill} exactly the width).
109
+ *
110
+ * @returns {number} the width in px
111
+ * @since 1.1.117
112
+ */
113
+ getTileRowWidth(): number;
114
+ /** The geometry of the full width – computed again if `width` changed (also when an app set it directly). */
115
+ private getFillLayout;
116
+ private applyFill;
47
117
  getRowCount(): number;
48
118
  /**
49
119
  * The number of grid rows without the external filter (`0` without items).
@@ -54,7 +124,8 @@ export declare class CoverGridBodyModel<T> implements AreaModelIf, TileLayoutIf
54
124
  getUnfilteredRowCount(): number;
55
125
  /**
56
126
  * The number of tiles per row: as many as fit into the width – at least 1 (a width smaller than one tile, width 0
57
- * or a tile width of 0; before 1.1.115 a narrow grid had 0 columns and `Infinity` rows).
127
+ * or a tile width of 0; before 1.1.115 a narrow grid had 0 columns and `Infinity` rows). With {@link setFill}: as
128
+ * many tiles of `tileWidth` as fit (`coverWidth` is the stretched width then).
58
129
  *
59
130
  * @returns {number} tiles per row, ≥ 1
60
131
  */
@@ -78,6 +149,15 @@ export declare class CoverGridBodyModel<T> implements AreaModelIf, TileLayoutIf
78
149
  getValueAt(rowIndex: number, columnIndex: number): T | undefined;
79
150
  getTextValueAt(_rowIndex: number, _columnIndex: number): string;
80
151
  getTooltipAt(_rowIndex: number, _columnIndex: number): any;
152
+ /**
153
+ * All rows have the tile height (`coverHeight`) – unless the first row is higher (`firstRowPaddingTop`). The table
154
+ * then computes row positions as `index × coverHeight` instead of building the prefix sums of all rows on every
155
+ * `repaintHard()` (since 1.1.117: a resize of a grid with 1,000,000 items no longer costs O(rows)).
156
+ *
157
+ * @returns {number | undefined} `coverHeight`, `undefined` with `firstRowPaddingTop`
158
+ * @since 1.1.117
159
+ */
160
+ getConstantRowHeight(): number | undefined;
81
161
  getRowHeight(rowIndex: number): number;
82
162
  getCellRenderer(_rowIndex: number, _columnIndex: number): CellRendererIf | undefined;
83
163
  getColspanAt(_rowIndex: number, _columnIndex: number): number;
@@ -90,8 +170,22 @@ export declare class CoverGridBodyModel<T> implements AreaModelIf, TileLayoutIf
90
170
  isRowCheckable(_rowIndex: number): boolean;
91
171
  isRowChecked(_rowIndex: number): CheckedType | undefined;
92
172
  setRowChecked(_rowIndex: number, _checked: boolean): void;
173
+ /**
174
+ * `1`: a tile never spans columns ({@link getColspanAt} is always 0). Since 1.1.117 – before, it reported 31, and
175
+ * every other number of rows (a resize) scanned all rows for spans. A subclass that overrides `getColspanAt` or
176
+ * `getRowspanAt` gets 31 as before.
177
+ *
178
+ * @returns {number} 1, 31 for a subclass with own spans
179
+ */
93
180
  getMaxColspan(): number;
181
+ /**
182
+ * `1`: a tile never spans rows ({@link getRowspanAt} is always 0). Since 1.1.117, see {@link getMaxColspan}.
183
+ *
184
+ * @returns {number} 1, 31 for a subclass with own spans
185
+ */
94
186
  getMaxRowspan(): number;
187
+ /** True if a subclass overrides `getColspanAt` or `getRowspanAt` (spans possible). */
188
+ private hasOwnSpans;
95
189
  getYPosByRowIndex(rowIndex: number): number;
96
190
  init(): void;
97
191
  externalFilterChanged<_T>(predict: FilterFunction<any>): void;
@@ -35,6 +35,7 @@ export declare class CoverGridTableModel<T> implements TableModelIf {
35
35
  init(): void;
36
36
  setParentWidth(widthInPixel: number): void;
37
37
  getColumnCount(): number;
38
+ /** The x position of a column – the sum of the widths before it (with `coverGridFill` they differ by 1 px). */
38
39
  getXPosByColumnIndex(columnIndex: number): number;
39
40
  getAreaModel(rowAreaIdent: AreaIdent): AreaModelIf;
40
41
  getBodyModel(): AreaModelIf;
@@ -48,7 +49,8 @@ export declare class CoverGridTableModel<T> implements TableModelIf {
48
49
  getColumnDefs(): ColumnDefIf[] | undefined;
49
50
  getColumnProperty(_columnIndex: number): string;
50
51
  getBodyRowByIndex(rowIndex: number): any;
51
- getColumnWidth(_columnIndex: number): number;
52
+ /** `coverWidth`; with `coverGridFill` the first columns are 1 px wider (the rest pixels of the width). */
53
+ getColumnWidth(columnIndex: number): number;
52
54
  setColumnWidth(_columnIndex: number, width: number): void;
53
55
  recalcSize(_clientWidth: number): void;
54
56
  recalcPadding(): void;
@@ -7,6 +7,7 @@ import { TreeRowIf } from './data/common/tree-row-if.js';
7
7
  import { AreaModelPivot } from './data/tablemodel/areamodel/area-model-pivot.js';
8
8
  import { PivotTableModel } from './pivot/pivot-table-model.js';
9
9
  import { PivotColumnDef } from './pivot/pivot-column-def.js';
10
+ import { CoverGridBodyModel } from './data/tablemodel/areamodel/cover-grid-body-model.js';
10
11
 
11
12
  /**
12
13
  * Checks if the given row is a tree row.
@@ -173,3 +174,17 @@ export declare function isAreaModelPivot(o: any): o is AreaModelPivot;
173
174
  * @category Pivot
174
175
  */
175
176
  export declare function isPivotColumnDef(o: any): o is PivotColumnDef;
177
+ /**
178
+ * True for the body of a cover grid ({@link CoverGridBodyModel}). Works across copies of the core.
179
+ *
180
+ * @param {any} o - the object to check, e.g. `tableModel.getBodyModel()`
181
+ * @returns {boolean} true for a cover grid body
182
+ *
183
+ * @example
184
+ * const body = tableModel.getBodyModel();
185
+ * const fill = isCoverGridBodyModel(body) ? body.getFill() : undefined;
186
+ *
187
+ * @since 1.1.117
188
+ * @category Table model
189
+ */
190
+ export declare function isCoverGridBodyModel(o: any): o is CoverGridBodyModel<unknown>;
@@ -386,8 +386,20 @@ export declare class RenderScope extends EleScope {
386
386
  recalcColumnWidths(clientWidth?: number): void;
387
387
  /** `TableModelIf.setParentWidth` – remembers the width for {@link adjustRelativeColumnWidthsToScrollBar}. */
388
388
  protected setParentWidth(widthInPixel: number): void;
389
- /** True if a column has a % or weight width (it depends on the width of the host). */
389
+ /**
390
+ * True if a column has a % or weight width (it depends on the width of the host) – or the body is a cover grid
391
+ * (since 1.1.117: its number of tiles per row and with `coverGridFill` their width follow the width; a vertical
392
+ * scroll bar that appears after the first layout takes room – before, the first render had one tile too many and a
393
+ * horizontal scroll bar until the debounced resize).
394
+ */
390
395
  protected hasRelativeColumnWidths(): boolean;
396
+ /**
397
+ * True if the body is a cover grid whose tiles fill the width ({@link TableOptionsIf.coverGridFill}).
398
+ *
399
+ * @returns {boolean} true with an active fill
400
+ * @since 1.1.117
401
+ */
402
+ isCoverGridFillActive(): boolean;
391
403
  protected layoutContainers(): void;
392
404
  /**
393
405
  * % and weight columns share the width next to the vertical scroll bar. The bar appears (or disappears) only after
@@ -396,6 +408,7 @@ export declare class RenderScope extends EleScope {
396
408
  * they are computed again (once – the flag stops a second pass) with the width that is available now.
397
409
  */
398
410
  protected adjustRelativeColumnWidthsToScrollBar(): void;
411
+ private relayoutForWidth;
399
412
  /**
400
413
  * The width that % and weight columns share: host width minus the fixed west columns and a vertical scroll bar.
401
414
  *
@@ -3,7 +3,10 @@ import { TableScope } from './table-scope.js';
3
3
  /**
4
4
  * Class representing a ResizeHandler.
5
5
  * @class
6
- * @classdesc Handles resizing of elements and calls a callback function on resize. These calls will be debounced with 500 ms.
6
+ * @classdesc Handles resizing of the host element and calls `TableScope.recalcColumnWidths` – debounced by
7
+ * `resizeEventDebounceDelay` (500 ms). A cover grid that fills its width (`coverGridFill`, since 1.1.117) takes the
8
+ * new size over at once: in the `ResizeObserver` callback (after the layout, before the paint – the same frame, at most
9
+ * one callback and so one render per frame); a pending debounced call is dropped.
7
10
  *
8
11
  * @category Internals
9
12
  */
@@ -12,10 +15,14 @@ export declare class ResizeHandler {
12
15
  protected debounceDelay: number;
13
16
  private readonly resizeObserver;
14
17
  private disconnected;
18
+ private timer;
15
19
  constructor(tableScope: TableScope, debounceDelay?: number);
16
20
  /**
17
21
  * Stops observing the host element. Called by {@link TableScope.destroy}.
18
22
  */
19
23
  disconnect(): void;
24
+ private onResize;
25
+ /** Drops a debounced call that has not run yet (e.g. a render that takes the width over anyway). */
26
+ cancelPending(): void;
20
27
  private handleResize;
21
28
  }
@@ -11,6 +11,7 @@ import { ShortcutActionIdMapping } from './action/shortcut-actionid-mapping.type
11
11
  import { SelectionModelIf } from './selection/selection-model.if.js';
12
12
  import { TableModelIf } from './data/tablemodel/table-model.if.js';
13
13
  import { AreaModelIf } from './data/tablemodel/areamodel/area-model.if.js';
14
+ import { CoverGridFillOptionsIf } from './cover-grid/cover-grid-fill-options.if.js';
14
15
  import { PivotConfigIf } from './pivot/pivot-config.if.js';
15
16
  import { RowGroupField } from './rowgroup/row-group-field.type.js';
16
17
  import { SelectionAggregatesIf } from './aggregation/selection-aggregates.if.js';
@@ -1592,6 +1593,36 @@ export declare class TableApi {
1592
1593
  * @since 1.1.94
1593
1594
  */
1594
1595
  getRowGroupBy(): RowGroupField[] | undefined;
1596
+ /**
1597
+ * Cover grid ({@link CoverGridFactory}): lets the tiles fill the whole width or changes how
1598
+ * ({@link TableOptionsIf.coverGridFill}) – e.g. a size slider, without a new model and without an own
1599
+ * `ResizeObserver`. Parts are merged with the current settings (`{ tileWidth: 220 }` keeps `aspectRatio` and
1600
+ * `extraHeight`), `true` = `{ tileWidth: coverWidth }`, `false` switches it off (tiles of `tileWidth`, a gap on the
1601
+ * right again). One render; the top item and the focused item stay. The options object is not changed: a framework
1602
+ * wrapper that builds the table again with the same options starts with their value.
1603
+ *
1604
+ * @param {boolean | Partial<CoverGridFillOptionsIf>} fill - the changed parts, `true` or `false`
1605
+ * @returns {boolean} false if the body is no cover grid
1606
+ *
1607
+ * @example
1608
+ * slider.addEventListener("input", () => tableApi.setCoverGridFill({ tileWidth: Number(slider.value) }));
1609
+ * stretch.addEventListener("change", () => tableApi.setCoverGridFill(stretch.checked));
1610
+ *
1611
+ * @since 1.1.117
1612
+ */
1613
+ setCoverGridFill(fill: boolean | Partial<CoverGridFillOptionsIf>): boolean;
1614
+ /**
1615
+ * Cover grid: the settings of the full width ({@link setCoverGridFill}, {@link TableOptionsIf.coverGridFill}).
1616
+ *
1617
+ * @returns {CoverGridFillOptionsIf | undefined} a copy, `undefined` if the tiles keep their width or the body is
1618
+ * no cover grid
1619
+ *
1620
+ * @example
1621
+ * const tileWidth = tableApi.getCoverGridFill()?.tileWidth ?? 165;
1622
+ *
1623
+ * @since 1.1.117
1624
+ */
1625
+ getCoverGridFill(): CoverGridFillOptionsIf | undefined;
1595
1626
  /**
1596
1627
  * Pivot table ({@link PivotFactory}): pivots again – other row fields, column fields or values, or new rows –
1597
1628
  * without a new table model (a new model would rebuild the table in every framework wrapper). The model gets new
@@ -23,6 +23,7 @@ import { OnActionTriggeredIf } from './action/on-action-triggered.if.js';
23
23
  import { ActionId } from './action/action-id.type.js';
24
24
  import { ShortcutService } from './action/shortcut.service.js';
25
25
  import { TreeRowIf } from './data/common/tree-row-if.js';
26
+ import { CoverGridFillOptionsIf } from './cover-grid/cover-grid-fill-options.if.js';
26
27
  import { PivotConfigIf } from './pivot/pivot-config.if.js';
27
28
  import { RowGroupField } from './rowgroup/row-group-field.type.js';
28
29
  import { LicenseManager } from './license-manager.js';
@@ -983,6 +984,28 @@ export declare class TableScope extends RenderScope implements OnActionTriggered
983
984
  * @returns {boolean} false if the body is no row grouping
984
985
  */
985
986
  setRowGroupBy(groupBy: RowGroupField[]): boolean;
987
+ /**
988
+ * `tableOptions.coverGridFill` (since 1.1.117): hands it to the body of a cover grid before the first layout – it
989
+ * replaces the settings of the model (a change by `setCoverGridFill` is gone after a rebuild); not set = the model
990
+ * keeps what it has (a fill set on the model directly); another body = one warning.
991
+ */
992
+ private applyCoverGridFillOption;
993
+ /**
994
+ * A cover grid fills the width (see {@link TableApi.setCoverGridFill}): new settings, then one render; the top item
995
+ * and the focused item stay.
996
+ *
997
+ * @param {boolean | Partial<CoverGridFillOptionsIf>} fill - changed parts, `true` or `false` (off)
998
+ * @returns {boolean} false if the body is no cover grid
999
+ * @since 1.1.117
1000
+ */
1001
+ setCoverGridFill(fill: boolean | Partial<CoverGridFillOptionsIf>): boolean;
1002
+ /**
1003
+ * The settings of a cover grid that fills the width – a copy, `undefined` if it is off or the body is no cover grid.
1004
+ *
1005
+ * @returns {CoverGridFillOptionsIf | undefined} the settings
1006
+ * @since 1.1.117
1007
+ */
1008
+ getCoverGridFill(): CoverGridFillOptionsIf | undefined;
986
1009
  /**
987
1010
  * Pivots a pivot table again (see {@link TableApi.setPivotConfig}): new columns, header and totals in the same model,
988
1011
  * then the layout of the table is built again. Sorting and selection are reset (the columns are different).
package/llms.txt CHANGED
@@ -583,6 +583,37 @@ const tableApi = new TableScope(host, tableModel, new SimpleDomService(), tableO
583
583
  - Focus frame: `tableOptions.focusFrame: "always"` (default) | `"keyboard"` (cover grid default, like `:focus-visible`)
584
584
  | `"never"`. → instructions.md 5.10
585
585
 
586
+ ### R21 – Cover grid in the full width, tile size with a slider (since 1.1.117)
587
+
588
+ ```ts
589
+ import { CellRendererIf, CoverGridFactory, EventAdapter, SimpleDomService, TableOptionsIf, TableScope } from "@guiexpert/table";
590
+
591
+ declare const host: HTMLDivElement;
592
+ declare const books: { title: string }[];
593
+ declare const renderer: CellRendererIf; // draws one cover (R20)
594
+ declare const slider: HTMLInputElement;
595
+
596
+ const tableModel = CoverGridFactory.createCoverGridModel(books, renderer, 165, 264);
597
+ const tableOptions: TableOptionsIf = {
598
+ ...CoverGridFactory.createCoverGridDefaultOptions(264, () => "books"),
599
+ coverGridFill: { tileWidth: 165, aspectRatio: 220 / 165, extraHeight: 44 } // 44 px caption below the cover
600
+ };
601
+ const tableApi = new TableScope(host, tableModel, new SimpleDomService(), tableOptions, new EventAdapter())
602
+ .firstInit().getApi();
603
+ slider.addEventListener("input", () => tableApi.setCoverGridFill({ tileWidth: Number(slider.value) }));
604
+ ```
605
+
606
+ - Columns = `max(1, floor(width / tileWidth))`; the tiles are stretched until the last one ends flush with the edge
607
+ (rest pixels go to the first columns, 1 px each; next to a classic scroll bar they leave room for it). Height =
608
+ `round(tile width × aspectRatio) + extraHeight`, without `aspectRatio` it stays `coverHeight`.
609
+ - A resize takes effect in the same frame with **one** render (not after `resizeEventDebounceDelay`); the top item
610
+ and the focused item stay. **No** own `ResizeObserver`, no `recalcColumnWidths()`, no code that sets
611
+ `coverWidth`/`coverHeight` (that was the way before 1.1.117).
612
+ - `setCoverGridFill(parts)` merges (`{ tileWidth }` keeps the ratio), `true` = `{ tileWidth: coverWidth }`, `false` =
613
+ off (tiles of `tileWidth`, a gap on the right). `getCoverGridFill()` reads it. The options object is not changed.
614
+ - `bodyModel.coverWidth`/`coverHeight` hold the effective (stretched) size – renderers can read them. Any other body
615
+ than a cover grid: a console warning, no effect. → instructions.md 5.10
616
+
586
617
  ## Pitfalls
587
618
 
588
619
  Symptom → cause → fix.
@@ -628,6 +659,9 @@ Symptom → cause → fix.
628
659
  (only after keys) or `"never"` (since 1.1.115, R20).
629
660
  - **A cover grid cannot be used with the keyboard / arrow keys stop at the end of a row** → `shortcutActionsDisabled:
630
661
  true` from old examples, or a version before 1.1.115 → remove the option; the grid navigates item by item (R20).
662
+ - **A cover grid leaves a gap on the right / the columns jump half a second after a resize** → tiles keep
663
+ `coverWidth`, the table debounces its resize (`resizeEventDebounceDelay` 500 ms) → `coverGridFill` (since 1.1.117,
664
+ R21) instead of an own `ResizeObserver` + `fitCoversToWidth`.
631
665
  - **A double click opens the item, Enter does nothing** → only `onMouseClicked` with `clickCount === 2` is handled →
632
666
  `onCellActivated` (R20).
633
667
  - **Own `mousedown`/`mouseup`/`dblclick` listeners on the header** (to save widths, lock a column, fit on double click)
@@ -656,6 +690,7 @@ Full answers: instructions.md section 6.26 (https://github.com/guiexperttable/mo
656
690
  - Open a row or a cover with Enter or a double click: `listener.onCellActivated = evt => open(evt.row ?? evt.value)` (wrappers `cellActivated`, since 1.1.115) – one handler for keyboard and mouse; only if the gesture did nothing else (checkbox, tree node, detail row, editor); the Enter key is not consumed. → R20
657
691
  - Hide the focus frame: `tableOptions.focusFrame: "never"`; only while the keyboard is used: `"keyboard"` (default of a cover grid, since 1.1.115). Not with CSS, not with `new FocusModel("none")`.
658
692
  - Cover grid with the keyboard (since 1.1.115): built in – arrows move from item to item (wrap at the end of a row), Home/End first/last item, Enter opens, the focus follows the item after sort/filter/resize. → R20
693
+ - 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
659
694
  - 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).
660
695
  - `@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.
661
696
  - Empty table: the host div needs a fixed height and the stylesheet `@guiexpert/table/css/main.css`.
@@ -696,6 +731,7 @@ What the table can do – one line per feature, details in instructions.md (each
696
731
  - Column filters, filter menu and column chooser (since 1.1.114): opt-in persistent filter row `tableOptions.filterRow: true | FilterRowOptionsIf` (visible, debounce, placeholder, height, clearButtonVisible, minInputWidthInPx), Excel-style per-column filter menu `tableOptions.columnFilterMenu: true | ColumnFilterMenuOptionsIf` (showCondition, showValues, applyOnChange, maxValues, virtualized unique-value checklist, async `ColumnDef.filter.getValues`), global `tableOptions.columnFilter: ColumnFilterOptionsIf` (`managed: true | false`, `caseSensitive`, `locale`, `maxValues`), `tableOptions.columnFilterTexts: ColumnFilterTextsIf`; per-column `ColumnDef.filter: false | "text" | "number" | "date" | "boolean" | ColumnFilterColumnOptionsIf` (type, valueGetter, caseSensitive, placeholder, getValues) and `ColumnDef.hideable: false`; shorthand syntax in filter row (`>100`, `10..20`, `=x`, `!=x`, `^a`, `z$`, `""`, `2026-01..2026-03`, tri-state boolean); `TableApi`: `setColumnFilter`, `setColumnFilters`, `clearColumnFilters`, `getColumnFilter`, `getColumnFilters`, `isColumnFiltered`, `setFilterRowVisible`, `isFilterRowVisible`, `showColumnFilterMenu`, `hideColumnFilterMenu`, `showColumnChooser`, `hideColumnChooser`; event `EventListenerIf.onFilterChanged(GeFilterEvent: filters, property, source, rowCount, unfilteredRowCount)` (wrappers: `filterChanged`); composes with `externalFilterFunction` (AND) and live `appendRows` (input focus/caret/IME preserved); state part `"filters"` (`TableStateIf.filters`, `filterRowVisible`, `autoRestoreOptions.autoRestoreFilterState`); keyboard `FOCUS_COLUMN_FILTER` (Ctrl/⌘+Shift+F), `OPEN_COLUMN_FILTER_MENU` (Alt+ArrowDown); top-layer popups (`popover="manual"` with fullscreen/Shadow DOM fallback), RTL & fixed columns; DOM-free engine `parseFilterInput`, `formatFilterCondition`, `compileSingleColumnFilter`, `compileColumnFilterPredicate`, `inferColumnFilterType`, `collectDistinctValues`; CSS `ge-table-filter-row*`, `ge-table-filter-menu*`, `ge-table-column-chooser*`, `--ge-table-filter-*`. Showcase `columnfilter`, demo `apps/table-demo/column-filter.html`.
697
732
  - 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.
698
733
  - 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).
734
+ - 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)).
699
735
  - Custom filtering
700
736
  - In-place cell editing
701
737
  - 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.116",
3
+ "version": "1.1.117",
4
4
  "license": "MIT",
5
5
  "author": "Dr. Marc Kronberg <info@gui.expert> (https://gui.expert)",
6
6
  "repository": {