@guiexpert/table 1.1.113 → 1.1.114
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/css/main.css +502 -0
- package/css/table-color-vars.css +36 -0
- package/css/table-column-filter.css +466 -0
- package/index.cjs +39 -39
- package/index.d.ts +19 -1
- package/index.js +5773 -3371
- package/lib/table/action/action-id.type.d.ts +1 -1
- package/lib/table/aria/aria-grid-info.d.ts +14 -4
- package/lib/table/aria/aria-ids.d.ts +9 -0
- package/lib/table/aria/aria-texts.d.ts +6 -0
- package/lib/table/aria/aria-texts.if.d.ts +47 -0
- package/lib/table/clipboard/input-pipes.d.ts +11 -0
- package/lib/table/column-filter/collect-distinct-values.d.ts +30 -0
- package/lib/table/column-filter/column-chooser-service.d.ts +33 -0
- package/lib/table/column-filter/column-filter-keymap.d.ts +17 -0
- package/lib/table/column-filter/column-filter-menu-service.d.ts +58 -0
- package/lib/table/column-filter/column-filter-operator.type.d.ts +15 -0
- package/lib/table/column-filter/column-filter-options.d.ts +79 -0
- package/lib/table/column-filter/column-filter-options.if.d.ts +174 -0
- package/lib/table/column-filter/column-filter-service.d.ts +86 -0
- package/lib/table/column-filter/column-filter-state.d.ts +43 -0
- package/lib/table/column-filter/column-filter-type.type.d.ts +11 -0
- package/lib/table/column-filter/column-filter.if.d.ts +50 -0
- package/lib/table/column-filter/compile-column-filters.d.ts +85 -0
- package/lib/table/column-filter/filter-popup-shell.d.ts +70 -0
- package/lib/table/column-filter/filter-row-service.d.ts +82 -0
- package/lib/table/column-filter/infer-column-filter-type.d.ts +13 -0
- package/lib/table/column-filter/parse-filter-input.d.ts +52 -0
- package/lib/table/data/common/checkbox-column-def.d.ts +2 -0
- package/lib/table/data/common/event/ge-filter-event.d.ts +45 -0
- package/lib/table/data/common/row-number-column-def.d.ts +2 -0
- package/lib/table/data/options/auto-restore-options.d.ts +2 -0
- package/lib/table/data/options/auto-restore-options.if.d.ts +5 -0
- package/lib/table/data/options/table-options.d.ts +9 -0
- package/lib/table/data/options/table-options.if.d.ts +47 -0
- package/lib/table/data/tablemodel/column/column-def.d.ts +9 -0
- package/lib/table/data/tablemodel/column/column-def.if.d.ts +23 -0
- package/lib/table/event-adapter.d.ts +3 -0
- package/lib/table/event-listener.if.d.ts +9 -0
- package/lib/table/render-scope.d.ts +9 -1
- package/lib/table/state/table-state.if.d.ts +6 -1
- package/lib/table/table-api.d.ts +140 -0
- package/lib/table/table-scope.d.ts +73 -0
- package/llms.txt +62 -4
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ import { GeUndoEvent } from './data/common/event/ge-undo-event.js';
|
|
|
3
3
|
import { GeDetailEvent } from './data/common/event/ge-detail-event.js';
|
|
4
4
|
import { GeColumnResizeEvent } from './data/common/event/ge-column-resize-event.js';
|
|
5
5
|
import { GeColumnMoveEvent } from './data/common/event/ge-column-move-event.js';
|
|
6
|
+
import { GeFilterEvent } from './data/common/event/ge-filter-event.js';
|
|
6
7
|
import { GeMouseEvent } from './data/common/event/ge-mouse-event.js';
|
|
7
8
|
import { GeModelChangeEvent } from './data/common/event/ge-model-change-event.js';
|
|
8
9
|
import { GeScrollEvent } from './data/common/event/ge-scroll-event.js';
|
|
@@ -148,4 +149,12 @@ export interface EventListenerIf extends EventFocusChangedListenerIf, EventSelec
|
|
|
148
149
|
* @since 1.1.110
|
|
149
150
|
*/
|
|
150
151
|
onColumnMoveEnd?(evt: GeColumnMoveEvent): void;
|
|
152
|
+
/**
|
|
153
|
+
* Optional: column filters changed ({@link TableApi.setColumnFilter}, filter row, filter menu or state restore).
|
|
154
|
+
* Called once per filter pass, after the table filtered and rendered (so `getDisplayedRowCount()` equals
|
|
155
|
+
* `evt.rowCount`). See {@link GeFilterEvent}.
|
|
156
|
+
*
|
|
157
|
+
* @since 1.1.114
|
|
158
|
+
*/
|
|
159
|
+
onFilterChanged?(evt: GeFilterEvent): void;
|
|
151
160
|
}
|
|
@@ -2,6 +2,7 @@ import { RowDragService } from './row-drag/row-drag-service.js';
|
|
|
2
2
|
import { BatchEditService } from './batch-edit/batch-edit-service.js';
|
|
3
3
|
import { FillHandleService } from './fill/fill-handle-service.js';
|
|
4
4
|
import { CellEditorService } from './sheet-editing/cell-editor-service.js';
|
|
5
|
+
import { ColumnFilterMenuService } from './column-filter/column-filter-menu-service.js';
|
|
5
6
|
import { TableOverlayChange } from './overlay/table-overlay.js';
|
|
6
7
|
import { EleScope } from './ele-scope.js';
|
|
7
8
|
import { TableModelIf } from './data/tablemodel/table-model.if.js';
|
|
@@ -121,6 +122,11 @@ export declare class RenderScope extends EleScope {
|
|
|
121
122
|
* @since 1.1.96
|
|
122
123
|
*/
|
|
123
124
|
batchEditService?: BatchEditService;
|
|
125
|
+
/**
|
|
126
|
+
* Per-column filter menu ({@link TableOptionsIf.columnFilterMenu}) – created by {@link TableScope}.
|
|
127
|
+
* @since 1.1.114
|
|
128
|
+
*/
|
|
129
|
+
columnFilterMenuService?: ColumnFilterMenuService;
|
|
124
130
|
/**
|
|
125
131
|
* Fill handle of this table – created by {@link TableScope}.
|
|
126
132
|
* @since 1.1.96
|
|
@@ -562,6 +568,8 @@ export declare class RenderScope extends EleScope {
|
|
|
562
568
|
* @protected
|
|
563
569
|
*/
|
|
564
570
|
protected adjustArea(areaIdent: AreaIdent, yStart?: number): void;
|
|
571
|
+
/** Number of visible persistent filter rows (0 without filter row; overridden in {@link TableScope}). @since 1.1.114 */
|
|
572
|
+
protected getFilterRowCount(): number;
|
|
565
573
|
/**
|
|
566
574
|
* Row and column numbers for screen readers of the current render pass (computed at its start).
|
|
567
575
|
*
|
|
@@ -772,7 +780,7 @@ export declare class RenderScope extends EleScope {
|
|
|
772
780
|
* Content pixels of the center columns scrolled out on the left – the offset that is actually rendered
|
|
773
781
|
* (see adjustColumnsToRowParent), the horizontal counterpart of `contentScrollTop`.
|
|
774
782
|
*/
|
|
775
|
-
|
|
783
|
+
getContentScrollLeft(): number;
|
|
776
784
|
/**
|
|
777
785
|
* Hide hover column.
|
|
778
786
|
*
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SortState } from '../data/common/sort-state.type.js';
|
|
2
|
+
import { ColumnFiltersMap } from '../column-filter/column-filter.if.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* The id of a row in a {@link TableStateIf} – what {@link AutoRestoreOptionsIf.getRowId} returns.
|
|
@@ -26,7 +27,7 @@ export type TableStateRowId = string | number;
|
|
|
26
27
|
* @category State
|
|
27
28
|
* @since 1.1.92
|
|
28
29
|
*/
|
|
29
|
-
export type TableStatePart = "columns" | "sort" | "scroll" | "tree" | "checked" | "selection" | "headerGroups" | "custom" | "details";
|
|
30
|
+
export type TableStatePart = "columns" | "sort" | "scroll" | "tree" | "checked" | "selection" | "headerGroups" | "custom" | "details" | "filters";
|
|
30
31
|
/**
|
|
31
32
|
* The state of a table as plain JSON: column layout, sorting, scroll position, tree, checked and selected rows,
|
|
32
33
|
* header groups and data of your own. Get it with {@link TableApi.getState}, apply it with
|
|
@@ -79,6 +80,10 @@ export interface TableStateIf {
|
|
|
79
80
|
selection?: TableSelectionStateIf;
|
|
80
81
|
/** The state of the header groups with a toggle. */
|
|
81
82
|
headerGroups?: TableHeaderGroupStateIf[];
|
|
83
|
+
/** Active built-in column filters by column property (Date values serialized as ISO text). @since 1.1.114 */
|
|
84
|
+
filters?: ColumnFiltersMap;
|
|
85
|
+
/** Visibility of the filter row (set when {@link TableOptionsIf.filterRow} is configured). @since 1.1.114 */
|
|
86
|
+
filterRowVisible?: boolean;
|
|
82
87
|
/** Data of your application, e.g. the text of a filter field (must be JSON). */
|
|
83
88
|
custom?: unknown;
|
|
84
89
|
}
|
package/lib/table/table-api.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ import { ExcelExportOptionsIf } from './service/excel-export-options.if.js';
|
|
|
29
29
|
import { SheetEngine } from './sheet/sheet-engine.js';
|
|
30
30
|
import { ScrollPositionIf } from './data/common/scroll-position.if.js';
|
|
31
31
|
import { AppendRowsOptionsIf, AppendRowsResultIf, RowsAppendedOptionsIf } from './live-append/append-rows-options.if.js';
|
|
32
|
+
import { ColumnFilterIf, ColumnFiltersMap } from './column-filter/column-filter.if.js';
|
|
32
33
|
|
|
33
34
|
/**
|
|
34
35
|
* The public API of one table – everything you do with a table after it has been created:
|
|
@@ -220,6 +221,145 @@ export declare class TableApi {
|
|
|
220
221
|
* @see TableScope.externalFilterChanged
|
|
221
222
|
*/
|
|
222
223
|
externalFilterChanged(): void;
|
|
224
|
+
/**
|
|
225
|
+
* Sets or clears the built-in filter of one column (by model index, property, `"#<index>"`, or `ColumnDefIf`),
|
|
226
|
+
* compiles all active column filters into one predicate (AND with `externalFilterFunction`), filters, keeps the
|
|
227
|
+
* sort order, repaints once and fires {@link EventListenerIf.onFilterChanged}.
|
|
228
|
+
*
|
|
229
|
+
* @param {number | string | ColumnDefIf} column - column index, property or definition
|
|
230
|
+
* @param {ColumnFilterIf | undefined} filter - condition and/or allowed values, or `undefined` to clear
|
|
231
|
+
*
|
|
232
|
+
* @example
|
|
233
|
+
* tableApi.setColumnFilter("seats", { condition: { operator: "greaterThan", value: 40 } });
|
|
234
|
+
* tableApi.setColumnFilter("region", { values: ["EMEA", "APAC"] });
|
|
235
|
+
* tableApi.setColumnFilter("seats", undefined); // clear one column
|
|
236
|
+
*
|
|
237
|
+
* @since 1.1.114
|
|
238
|
+
*/
|
|
239
|
+
setColumnFilter(column: number | string | ColumnDefIf, filter: ColumnFilterIf | undefined): void;
|
|
240
|
+
/**
|
|
241
|
+
* Returns a copy of the active filter of one column, or `undefined` when the column is unfiltered.
|
|
242
|
+
*
|
|
243
|
+
* @param {number | string | ColumnDefIf} column - column index, property or definition
|
|
244
|
+
* @returns {ColumnFilterIf | undefined} the active filter
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* const filter = tableApi.getColumnFilter("region");
|
|
248
|
+
*
|
|
249
|
+
* @since 1.1.114
|
|
250
|
+
*/
|
|
251
|
+
getColumnFilter(column: number | string | ColumnDefIf): ColumnFilterIf | undefined;
|
|
252
|
+
/**
|
|
253
|
+
* Returns a plain JSON-safe copy of all active column filters (property → {@link ColumnFilterIf}).
|
|
254
|
+
*
|
|
255
|
+
* @returns {ColumnFiltersMap} active column filters
|
|
256
|
+
*
|
|
257
|
+
* @example
|
|
258
|
+
* const filters = tableApi.getColumnFilters();
|
|
259
|
+
*
|
|
260
|
+
* @since 1.1.114
|
|
261
|
+
*/
|
|
262
|
+
getColumnFilters(): ColumnFiltersMap;
|
|
263
|
+
/**
|
|
264
|
+
* Replaces all column filters in one batch: one filter pass, one render, one {@link EventListenerIf.onFilterChanged}.
|
|
265
|
+
*
|
|
266
|
+
* @param {ColumnFiltersMap} filters - new filters by column property
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* tableApi.setColumnFilters({
|
|
270
|
+
* region: { values: ["EMEA"] },
|
|
271
|
+
* seats: { condition: { operator: "greaterOrEqual", value: 20 } }
|
|
272
|
+
* });
|
|
273
|
+
*
|
|
274
|
+
* @since 1.1.114
|
|
275
|
+
*/
|
|
276
|
+
setColumnFilters(filters: ColumnFiltersMap): void;
|
|
277
|
+
/**
|
|
278
|
+
* Clears all active column filters in one pass.
|
|
279
|
+
*
|
|
280
|
+
* @example
|
|
281
|
+
* tableApi.clearColumnFilters();
|
|
282
|
+
*
|
|
283
|
+
* @since 1.1.114
|
|
284
|
+
*/
|
|
285
|
+
clearColumnFilters(): void;
|
|
286
|
+
/**
|
|
287
|
+
* Returns `true` when the given column currently has an active column filter.
|
|
288
|
+
*
|
|
289
|
+
* @param {number | string | ColumnDefIf} column - column index, property or definition
|
|
290
|
+
* @returns {boolean} whether the column is filtered
|
|
291
|
+
*
|
|
292
|
+
* @example
|
|
293
|
+
* if (tableApi.isColumnFiltered("region")) console.log("Region is filtered");
|
|
294
|
+
*
|
|
295
|
+
* @since 1.1.114
|
|
296
|
+
*/
|
|
297
|
+
isColumnFiltered(column: number | string | ColumnDefIf): boolean;
|
|
298
|
+
/**
|
|
299
|
+
* Shows or hides the persistent filter row below the column titles ({@link TableOptionsIf.filterRow}).
|
|
300
|
+
* Hiding the filter row keeps all active column filters intact; use {@link clearColumnFilters} to clear them.
|
|
301
|
+
*
|
|
302
|
+
* @param {boolean} visible - `true` to show the filter row, `false` to hide it
|
|
303
|
+
*
|
|
304
|
+
* @example
|
|
305
|
+
* tableApi.setFilterRowVisible(!tableApi.isFilterRowVisible());
|
|
306
|
+
*
|
|
307
|
+
* @since 1.1.114
|
|
308
|
+
*/
|
|
309
|
+
setFilterRowVisible(visible: boolean): void;
|
|
310
|
+
/**
|
|
311
|
+
* Returns `true` when the persistent filter row is currently visible.
|
|
312
|
+
*
|
|
313
|
+
* @returns {boolean} whether the filter row is shown
|
|
314
|
+
*
|
|
315
|
+
* @example
|
|
316
|
+
* const open = tableApi.isFilterRowVisible();
|
|
317
|
+
*
|
|
318
|
+
* @since 1.1.114
|
|
319
|
+
*/
|
|
320
|
+
isFilterRowVisible(): boolean;
|
|
321
|
+
/**
|
|
322
|
+
* Opens the per-column filter menu popup anchored to the given column's header cell.
|
|
323
|
+
*
|
|
324
|
+
* @param {number | string | ColumnDefIf} column - column index, property or definition
|
|
325
|
+
* @returns {boolean} `true` if the menu opened, `false` if the column is missing, hidden or not filterable
|
|
326
|
+
*
|
|
327
|
+
* @example
|
|
328
|
+
* tableApi.showColumnFilterMenu("region");
|
|
329
|
+
*
|
|
330
|
+
* @since 1.1.114
|
|
331
|
+
*/
|
|
332
|
+
showColumnFilterMenu(column: number | string | ColumnDefIf): boolean;
|
|
333
|
+
/**
|
|
334
|
+
* Closes the currently open per-column filter menu popup, if any.
|
|
335
|
+
*
|
|
336
|
+
* @example
|
|
337
|
+
* tableApi.hideColumnFilterMenu();
|
|
338
|
+
*
|
|
339
|
+
* @since 1.1.114
|
|
340
|
+
*/
|
|
341
|
+
hideColumnFilterMenu(): void;
|
|
342
|
+
/**
|
|
343
|
+
* Opens the column visibility chooser popup (optionally anchored to a button in your app).
|
|
344
|
+
* Respects {@link ColumnDefIf.hideable}, keeps at least one column visible, and persists visibility via `"columns"` state.
|
|
345
|
+
*
|
|
346
|
+
* @param {HTMLElement} [anchor] - optional trigger element to position the popup next to
|
|
347
|
+
*
|
|
348
|
+
* @example
|
|
349
|
+
* columnsButton.addEventListener("click", () => tableApi.showColumnChooser(columnsButton));
|
|
350
|
+
*
|
|
351
|
+
* @since 1.1.114
|
|
352
|
+
*/
|
|
353
|
+
showColumnChooser(anchor?: HTMLElement): void;
|
|
354
|
+
/**
|
|
355
|
+
* Closes the column visibility chooser popup, if open.
|
|
356
|
+
*
|
|
357
|
+
* @example
|
|
358
|
+
* tableApi.hideColumnChooser();
|
|
359
|
+
*
|
|
360
|
+
* @since 1.1.114
|
|
361
|
+
*/
|
|
362
|
+
hideColumnChooser(): void;
|
|
223
363
|
/**
|
|
224
364
|
* Scrolls the table content to the specified pixel coordinates.
|
|
225
365
|
*
|
|
@@ -52,6 +52,12 @@ import { UndoOptionsIf } from './undo/undo-options.if.js';
|
|
|
52
52
|
import { UndoService } from './undo/undo-service.js';
|
|
53
53
|
import { ShortcutActionIdMapping } from './action/shortcut-actionid-mapping.type.js';
|
|
54
54
|
import { AppendRowsOptionsIf, AppendRowsResultIf, RowsAppendedOptionsIf } from './live-append/append-rows-options.if.js';
|
|
55
|
+
import { FilterFunction } from './data/common/filter-function.js';
|
|
56
|
+
import { GeFilterEventSource } from './data/common/event/ge-filter-event.js';
|
|
57
|
+
import { ColumnFilterService } from './column-filter/column-filter-service.js';
|
|
58
|
+
import { ColumnFilterIf, ColumnFiltersMap } from './column-filter/column-filter.if.js';
|
|
59
|
+
import { FilterRowService } from './column-filter/filter-row-service.js';
|
|
60
|
+
import { ColumnChooserService } from './column-filter/column-chooser-service.js';
|
|
55
61
|
|
|
56
62
|
/**
|
|
57
63
|
* Creates and runs one table in a host element – the core that every framework wrapper uses.
|
|
@@ -105,6 +111,12 @@ export declare class TableScope extends RenderScope implements OnActionTriggered
|
|
|
105
111
|
* @since 1.1.92
|
|
106
112
|
*/
|
|
107
113
|
readonly stateService: TableStateService;
|
|
114
|
+
/** Built-in column filters ({@link TableApi.setColumnFilter}, since 1.1.114). */
|
|
115
|
+
readonly columnFilterService: ColumnFilterService;
|
|
116
|
+
/** Persistent filter row below the column titles ({@link TableOptionsIf.filterRow}, since 1.1.114). */
|
|
117
|
+
filterRowService?: FilterRowService;
|
|
118
|
+
/** Column visibility chooser popup ({@link TableApi.showColumnChooser}, since 1.1.114). */
|
|
119
|
+
columnChooserService?: ColumnChooserService;
|
|
108
120
|
protected selectionService: SelectionService;
|
|
109
121
|
protected keyEvent?: GeKeyEvent;
|
|
110
122
|
private api;
|
|
@@ -933,6 +945,23 @@ export declare class TableScope extends RenderScope implements OnActionTriggered
|
|
|
933
945
|
* @param {() => void} fn - code that changes the selection model
|
|
934
946
|
*/
|
|
935
947
|
holdSelectionEvents(fn: () => void): void;
|
|
948
|
+
/**
|
|
949
|
+
* Returns the effective filter predicate combining `tableOptions.externalFilterFunction` and active column filters
|
|
950
|
+
* via AND (returns `externalFilterFunction` unchanged when no column filters are active).
|
|
951
|
+
*
|
|
952
|
+
* @since 1.1.114
|
|
953
|
+
*/
|
|
954
|
+
getEffectiveFilterFunction(): FilterFunction<any> | undefined;
|
|
955
|
+
/**
|
|
956
|
+
* Runs one filter pass with `predictFn`, re-applies sorting, invalidates aggregates, updates height/scroll wrapper
|
|
957
|
+
* and optionally repaints and announces the row count. Used by {@link externalFilterChanged} and
|
|
958
|
+
* {@link ColumnFilterService}. `keepHorizontalScroll` (column filters) scrolls to the first row only.
|
|
959
|
+
*
|
|
960
|
+
* @since 1.1.114
|
|
961
|
+
*/
|
|
962
|
+
applyFilterFunction(predictFn: FilterFunction<any>, clearSelection?: boolean, repaintNow?: boolean, keepHorizontalScroll?: boolean): void;
|
|
963
|
+
/** Re-applies active column filters after `TableApi.setRows()` without repainting. @since 1.1.114 */
|
|
964
|
+
reapplyFilterAfterSetRows(predictFn: FilterFunction<any>): void;
|
|
936
965
|
/**
|
|
937
966
|
* Updates the table (repaint) when an external filter is changed.
|
|
938
967
|
*
|
|
@@ -940,6 +969,50 @@ export declare class TableScope extends RenderScope implements OnActionTriggered
|
|
|
940
969
|
* @return {void}
|
|
941
970
|
*/
|
|
942
971
|
externalFilterChanged(clearSelection?: boolean): void;
|
|
972
|
+
/** See {@link TableApi.setColumnFilter}. @since 1.1.114 */
|
|
973
|
+
setColumnFilter(column: number | string | ColumnDefIf, filter: ColumnFilterIf | undefined): void;
|
|
974
|
+
/** See {@link TableApi.getColumnFilter}. @since 1.1.114 */
|
|
975
|
+
getColumnFilter(column: number | string | ColumnDefIf): ColumnFilterIf | undefined;
|
|
976
|
+
/** See {@link TableApi.getColumnFilters}. @since 1.1.114 */
|
|
977
|
+
getColumnFilters(): ColumnFiltersMap;
|
|
978
|
+
/** See {@link TableApi.setColumnFilters}. @since 1.1.114 */
|
|
979
|
+
setColumnFilters(filters: ColumnFiltersMap): void;
|
|
980
|
+
/** See {@link TableApi.clearColumnFilters}. @since 1.1.114 */
|
|
981
|
+
clearColumnFilters(): void;
|
|
982
|
+
/** See {@link TableApi.isColumnFiltered}. @since 1.1.114 */
|
|
983
|
+
isColumnFiltered(column: number | string | ColumnDefIf): boolean;
|
|
984
|
+
/** Extra height reserved below the header rows (e.g. persistent filter row) for {@link TableModel.recalcPadding}. @since 1.1.114 */
|
|
985
|
+
getHeaderExtraHeight(): number;
|
|
986
|
+
protected getFilterRowCount(): number;
|
|
987
|
+
/** True if a DOM event originates inside the built-in filter UI (filter row or popup). @since 1.1.114 */
|
|
988
|
+
isEventInFilterUI(evt: Event): boolean;
|
|
989
|
+
/** See {@link TableApi.showColumnFilterMenu}. @since 1.1.114 */
|
|
990
|
+
showColumnFilterMenu(column: number | string | ColumnDefIf): boolean;
|
|
991
|
+
/** Toggles the filter menu for `columnIndex` (used by the header funnel button). @since 1.1.114 */
|
|
992
|
+
toggleColumnFilterMenu(columnIndex: number): boolean;
|
|
993
|
+
/** See {@link TableApi.hideColumnFilterMenu}. @since 1.1.114 */
|
|
994
|
+
hideColumnFilterMenu(): void;
|
|
995
|
+
/** See {@link TableApi.showColumnChooser}. @since 1.1.114 */
|
|
996
|
+
showColumnChooser(anchor?: HTMLElement): void;
|
|
997
|
+
/** See {@link TableApi.hideColumnChooser}. @since 1.1.114 */
|
|
998
|
+
hideColumnChooser(): void;
|
|
999
|
+
/** True if a filter row service is configured on this table. @since 1.1.114 */
|
|
1000
|
+
hasFilterRow(): boolean;
|
|
1001
|
+
/** See {@link TableApi.isFilterRowVisible}. @since 1.1.114 */
|
|
1002
|
+
isFilterRowVisible(): boolean;
|
|
1003
|
+
/** See {@link TableApi.setFilterRowVisible}. @since 1.1.114 */
|
|
1004
|
+
setFilterRowVisible(visible: boolean): void;
|
|
1005
|
+
/** Restores filter row visibility from {@link TableStateService} without triggering an extra repaint. @since 1.1.114 */
|
|
1006
|
+
restoreFilterRowVisible(visible: boolean): boolean;
|
|
1007
|
+
/** Called by {@link ColumnFilterService} after filters changed so the filter UI stays in sync. @since 1.1.114 */
|
|
1008
|
+
onColumnFiltersChanged(source: GeFilterEventSource): void;
|
|
1009
|
+
/** Clears a lingering header focus ring when the user focuses a filter row input. @since 1.1.114 */
|
|
1010
|
+
clearHeaderFocusForFilterRow(): void;
|
|
1011
|
+
/** Moves keyboard focus from a filter row input up to the column's lowest header cell. @since 1.1.114 */
|
|
1012
|
+
focusHeaderFromFilterRow(columnIndex: number): void;
|
|
1013
|
+
/** Moves keyboard focus from a filter row input down to the first visible body row in that column. @since 1.1.114 */
|
|
1014
|
+
focusBodyFromFilterRow(columnIndex: number): void;
|
|
1015
|
+
private initFilterRowService;
|
|
943
1016
|
/**
|
|
944
1017
|
* Handle the double click event on the table header.
|
|
945
1018
|
*
|
package/llms.txt
CHANGED
|
@@ -354,8 +354,8 @@ tableApi.sortByColumn("total", "desc"); // like a double click
|
|
|
354
354
|
```
|
|
355
355
|
|
|
356
356
|
- The header sorts on **double click** (not single click). After changing data: `tableApi.reSort()`.
|
|
357
|
-
- `externalFilterChanged()` filters all rows, clears the selection and scrolls to the top.
|
|
358
|
-
|
|
357
|
+
- `externalFilterChanged()` filters all rows, clears the selection and scrolls to the top. For a built-in filter row,
|
|
358
|
+
Excel-style value checklist and column chooser (since 1.1.114), see **R19**; both compose with AND. → instructions.md 6.2, 6.3, 6.28
|
|
359
359
|
|
|
360
360
|
### R10 – Own cell renderer
|
|
361
361
|
|
|
@@ -450,11 +450,13 @@ host without destroying the first.
|
|
|
450
450
|
|
|
451
451
|
### R17 – Not built in (and how to do it)
|
|
452
452
|
|
|
453
|
-
- **Filter UI**: inputs of your own + `externalFilterFunction` + `externalFilterChanged()` (R9).
|
|
454
453
|
- **Context menu**: `onContextmenu` + your own HTML menu (R3); example `apps/table-demo/spreadsheet.html`.
|
|
454
|
+
- **Status bar**: a plain HTML bar below the host wired to `onFilterChanged`, `setFilterRowVisible`,
|
|
455
|
+
`showColumnChooser(btn)`, `clearColumnFilters()` and `requestFullscreen()` (R19, `apps/table-demo/column-filter.html`).
|
|
455
456
|
- **Pagination**: not needed for size (virtual scrolling); if wanted, `setRows(page)` + `repaintHard()`.
|
|
456
457
|
- **Server-side row model** (fetch rows on demand): an own `AreaModel` whose `getValueAt` reads a cache and requests
|
|
457
|
-
missing blocks; `repaint()` when a block arrives (R8).
|
|
458
|
+
missing blocks; `repaint()` when a block arrives (R8). Combine with `columnFilter: { managed: false }` (R19) for
|
|
459
|
+
server-side column filtering.
|
|
458
460
|
- **Drag between tables**: row drag works inside one table (`rowDrag: true`); between tables use `onRowDragEnd` +
|
|
459
461
|
`rowDragOptions.managed: false` and move the data yourself.
|
|
460
462
|
|
|
@@ -479,6 +481,55 @@ Once per drag, after the table applied the change (no `setTimeout`); `type: "can
|
|
|
479
481
|
(`source: "dblclick"`; own measurement `tableOptions.columnAutoWidth.getWidth`). Renders of a live table while the
|
|
480
482
|
user drags are fine. → instructions.md 6.27
|
|
481
483
|
|
|
484
|
+
### R19 – Built-in column filters, Excel value checklist and column chooser (since 1.1.114)
|
|
485
|
+
|
|
486
|
+
```ts
|
|
487
|
+
import { ColumnDef, EventAdapter, TableFactory, TableOptions, px120, px160 } from "@guiexpert/table";
|
|
488
|
+
import type { GeFilterEvent, TableApi, TableOptionsIf } from "@guiexpert/table";
|
|
489
|
+
|
|
490
|
+
interface Account { id: number; name: string; region: string; revenue: number; active: boolean }
|
|
491
|
+
declare const rows: Account[];
|
|
492
|
+
declare const tableApi: TableApi;
|
|
493
|
+
declare const columnsBtn: HTMLElement;
|
|
494
|
+
|
|
495
|
+
const tableModel = TableFactory.createTableModel({
|
|
496
|
+
rows,
|
|
497
|
+
columnDefs: [
|
|
498
|
+
ColumnDef.create({ property: "id", headerLabel: "ID", width: px120, hideable: false, filter: "number" }),
|
|
499
|
+
ColumnDef.create({ property: "name", headerLabel: "Account", width: px160 }),
|
|
500
|
+
ColumnDef.create({ property: "region", headerLabel: "Region", width: px120 }),
|
|
501
|
+
ColumnDef.create({ property: "revenue", headerLabel: "Revenue", width: px120, filter: "number" }),
|
|
502
|
+
ColumnDef.create({ property: "active", headerLabel: "Active", width: px120, filter: "boolean" }),
|
|
503
|
+
],
|
|
504
|
+
});
|
|
505
|
+
|
|
506
|
+
const tableOptions: TableOptionsIf = {
|
|
507
|
+
...new TableOptions(),
|
|
508
|
+
filterRow: { debounce: 150 }, // persistent filter inputs below the header (or `true`)
|
|
509
|
+
columnFilterMenu: true, // funnel button + virtualized Excel value checklist
|
|
510
|
+
columnFilter: { locale: "en" }, // set managed: false for server-side filtering
|
|
511
|
+
};
|
|
512
|
+
|
|
513
|
+
const listener = new EventAdapter();
|
|
514
|
+
listener.onFilterChanged = (evt: GeFilterEvent) => {
|
|
515
|
+
console.log(evt.rowCount, "/", evt.unfilteredRowCount, evt.filters);
|
|
516
|
+
};
|
|
517
|
+
|
|
518
|
+
tableApi.setColumnFilter("revenue", { condition: { operator: "greaterThan", value: 10_000 } });
|
|
519
|
+
tableApi.setColumnFilter("region", { values: ["DACH", "Nordics"] });
|
|
520
|
+
tableApi.showColumnChooser(columnsBtn); // anchor to any button (hideable: false locks a column)
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
- Filter-row shorthand: `>100`, `10..20`, `=exact`, `!=x`, `^start`, `end$`, `""` (blank), `2026-01..2026-03`; boolean
|
|
524
|
+
renders a tri-state select. Opt out per column with `ColumnDef.filter: false`.
|
|
525
|
+
- API: `setColumnFilter` (`undefined` clears one column), `setColumnFilters`, `clearColumnFilters`, `getColumnFilter`,
|
|
526
|
+
`getColumnFilters`, `isColumnFiltered`, `setFilterRowVisible` / `isFilterRowVisible`,
|
|
527
|
+
`showColumnFilterMenu` / `hideColumnFilterMenu`, `showColumnChooser` / `hideColumnChooser`.
|
|
528
|
+
- Composes with `externalFilterFunction` (logical AND) and `appendRows()` (keeps input focus/caret/IME).
|
|
529
|
+
- Shortcuts: `Ctrl/⌘+Shift+F` focuses the active column's filter input; `Alt+ArrowDown` opens the column filter menu.
|
|
530
|
+
- State persistence: `"filters"` part (`TableStateIf.filters` + `filterRowVisible`, `autoRestoreFilterState: true`).
|
|
531
|
+
→ instructions.md 6.28, showcase "columnfilter", `apps/table-demo/column-filter.html`
|
|
532
|
+
|
|
482
533
|
More (short): tree + checkboxes `TreeFactory` (instructions.md 6.6), master/detail `masterDetail` (6.18), row grouping
|
|
483
534
|
`RowGroupFactory` (5.6), pivot `PivotFactory` (5.7), calculated columns `valueGetter`/`formula` (5.2, 5.9), spreadsheet
|
|
484
535
|
`SpreadsheetFactory.create` (6.25), cover grid (5.10), totals footer `footerAggregates` (5.4), row numbers (5.2).
|
|
@@ -525,6 +576,11 @@ Symptom → cause → fix.
|
|
|
525
576
|
- **Own `mousedown`/`mouseup`/`dblclick` listeners on the header** (to save widths, lock a column, fit on double click)
|
|
526
577
|
→ the table had no column events before 1.1.110 → `onColumnResizeEnd` / `onColumnMoveEnd` (R18),
|
|
527
578
|
`ColumnDef.resizable: false` / `movable: false`, the built-in double click (`columnAutoWidth`).
|
|
579
|
+
- **Filter row or filter menu enabled on a custom `AreaModel` does not filter rows** → custom `AreaModel` without
|
|
580
|
+
`externalFilterChanged()` → set `columnFilter: { managed: false }` and filter in `onFilterChanged` (or supply
|
|
581
|
+
`ColumnDef.filter = { getValues }`) (R19).
|
|
582
|
+
- **Hiding the filter row (`setFilterRowVisible(false)`) still hides rows** → by design, toggling the filter row only
|
|
583
|
+
toggles the UI; active filters stay → call `tableApi.clearColumnFilters()` if you want to clear them too (R19).
|
|
528
584
|
- **`AsyncBodyAreaModelObjectArray` cannot be imported** → unfinished, not exported → own `AreaModel` (R8, R17).
|
|
529
585
|
- **Invented APIs** – these do NOT exist: `getSelectedRows()`, `onKeyDown`, `api.addRow()`, `api.refresh()`,
|
|
530
586
|
`setData()`, `gridOptions`, `rowData`, `columnDefs` as a table option (it is a model parameter). Use R4–R7.
|
|
@@ -539,6 +595,7 @@ Full answers: instructions.md section 6.26 (https://github.com/guiexperttable/mo
|
|
|
539
595
|
- `repaint()` = values changed, same row count; `repaintHard()` = row count or heights changed; `updateCells()` = single cells.
|
|
540
596
|
- Variable row heights: implement `getRowHeight(i)`; `getConstantRowHeight()` only if all rows are equally high. `defaultRowHeights` only applies to models the factory builds or whose `getRowHeight()` returns 0.
|
|
541
597
|
- Save the column layout when the user resizes or moves a column: `onColumnResizeEnd` / `onColumnMoveEnd` (wrappers `columnResizeEnd`, `columnMoveEnd`, since 1.1.110) – once per drag, after the change; read `tableApi.getState(["columns"])` there. Lock a column: `ColumnDef.resizable: false`, `movable: false`. Double click on the column border fits the width (`columnAutoWidth`, `tableApi.autoResizeColumn(column)`).
|
|
598
|
+
- Built-in column filters, Excel value checklist and column chooser: `filterRow: true`, `columnFilterMenu: true`, `tableApi.showColumnChooser(btn)` (since 1.1.114); events `onFilterChanged` (wrapper `filterChanged`); state part `"filters"` (`autoRestoreFilterState: true`); server-side via `columnFilter: { managed: false }`. → R19, instructions.md 6.28.
|
|
542
599
|
- Empty table: the host div needs a fixed height and the stylesheet `@guiexpert/table/css/main.css`.
|
|
543
600
|
|
|
544
601
|
## Feature reference
|
|
@@ -574,6 +631,7 @@ What the table can do – one line per feature, details in instructions.md (each
|
|
|
574
631
|
- Spreadsheet mode (since 1.1.99): SpreadsheetFactory.create({ data: unknown[][], rowCount (100), columnCount (26), columnWidth, rowHeight, rowNumbers, locale, functions, tableOptions }) → { tableModel: SpreadsheetTableModel, tableOptions } – column letters (AreaModelSheetHeader), row numbers, sparse AreaModelSheet; preset tableOptions.spreadsheet: true | { editing, clipboard, undo, cellFormulas, fillHandle } (false = off) for any flat table (TableFactory columnLetters: true). FormulaBar(container, api) – address box + formula input. api.getActiveCell(), goToAddress("B2:C5"), insertRows(at, count), deleteRows, insertColumns, deleteColumns (references adjusted, one undo step, source "structure"), getSheetData() (inputs for JSON).
|
|
575
632
|
- Angular signal component (since 1.1.100, Angular 22 and later): TableSignalComponent, selector guiexpert-table-signal, from @guiexpert/angular-table@22.x – inputs (input()) tableModel (TableModelIf | undefined), tableOptions (default new TableOptions()), loading, debounceMouseClickDelay (150, 0 = synchronous); tableApi = model<TableApi | undefined>() → [(tableApi)]="api" with api = signal<TableApi | undefined>(undefined), (tableApiChange), viewChild(TableSignalComponent)?.tableApi(); set when the table is built, switches directly to the new API on a new model/options, undefined after destroy, written from outside = replaced. Outputs (output()): no tableReady (the API comes as the signal tableApi / tableApiChange), mouseClicked, mouseMoved, mouseDragging, mouseDraggingEnded, contextMenu (camelCase – TableComponent's (contextmenu) also receives the native MouseEvent first), scroll, modelChanged, selectionChanged, focusChanged, checkboxChanged, stateChanged, rowDragStart/Move/End, batchEditChanged, detailExpandedChanged, editingChanged, undoStackChanged, columnResizeStart/End, columnMoveStart/End (since 1.1.110) – events of the table (mouse, keyboard, scroll …) are emitted outside the Angular zone (write signals in handlers). effect() instead of ngOnChanges, no RxJS, zoneless (provideZonelessChangeDetection()), SSR: no table on the server. TableComponent (<guiexpert-table>) unchanged for Angular 14 – 22+.
|
|
576
633
|
- Column drag (since 1.1.110): events EventListenerIf.onColumnResizeStart/End (GeColumnResizeEvent: type "start" | "end" | "cancel", source "mouse" | "dblclick", columnIndex, columnDef, property, oldWidth, newWidth) and onColumnMoveStart/End (GeColumnMoveEvent: type, fromIndex, toIndex, columnDef, property, columnOrder, moved) – only user actions, once per drag, the end after the change, start after 4 px, Escape / tableApi.cancelColumnDrag() = "cancel", tableApi.isColumnDragging(); wrappers columnResizeStart/End, columnMoveStart/End. Locks: ColumnDef.resizable: false (no handle, no double click, no auto width), movable: false (fixed place, applyState keeps it); RowNumberColumnDef has both false; a column stays in its area (west/center/east). Double click on the resize handle fits the width (no sorting): tableOptions.columnAutoWidth: { doubleClick (true), maxRows (10,000: all body rows, above only the rendered rows), getWidth(ctx: ColumnAutoWidthContextIf { columnIndex, columnDef, property, source, firstRenderedRow, lastRenderedRow, measureText(text), getDefaultWidth() }) => number | undefined }, limited by minWidth/maxWidth; tableApi.autoResizeColumn(index | property | ColumnDef) → width | undefined.
|
|
634
|
+
- 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`.
|
|
577
635
|
- 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.
|
|
578
636
|
- Custom filtering
|
|
579
637
|
- In-place cell editing
|