@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.
Files changed (46) hide show
  1. package/README.md +9 -0
  2. package/css/main.css +502 -0
  3. package/css/table-color-vars.css +36 -0
  4. package/css/table-column-filter.css +466 -0
  5. package/index.cjs +39 -39
  6. package/index.d.ts +19 -1
  7. package/index.js +5773 -3371
  8. package/lib/table/action/action-id.type.d.ts +1 -1
  9. package/lib/table/aria/aria-grid-info.d.ts +14 -4
  10. package/lib/table/aria/aria-ids.d.ts +9 -0
  11. package/lib/table/aria/aria-texts.d.ts +6 -0
  12. package/lib/table/aria/aria-texts.if.d.ts +47 -0
  13. package/lib/table/clipboard/input-pipes.d.ts +11 -0
  14. package/lib/table/column-filter/collect-distinct-values.d.ts +30 -0
  15. package/lib/table/column-filter/column-chooser-service.d.ts +33 -0
  16. package/lib/table/column-filter/column-filter-keymap.d.ts +17 -0
  17. package/lib/table/column-filter/column-filter-menu-service.d.ts +58 -0
  18. package/lib/table/column-filter/column-filter-operator.type.d.ts +15 -0
  19. package/lib/table/column-filter/column-filter-options.d.ts +79 -0
  20. package/lib/table/column-filter/column-filter-options.if.d.ts +174 -0
  21. package/lib/table/column-filter/column-filter-service.d.ts +86 -0
  22. package/lib/table/column-filter/column-filter-state.d.ts +43 -0
  23. package/lib/table/column-filter/column-filter-type.type.d.ts +11 -0
  24. package/lib/table/column-filter/column-filter.if.d.ts +50 -0
  25. package/lib/table/column-filter/compile-column-filters.d.ts +85 -0
  26. package/lib/table/column-filter/filter-popup-shell.d.ts +70 -0
  27. package/lib/table/column-filter/filter-row-service.d.ts +82 -0
  28. package/lib/table/column-filter/infer-column-filter-type.d.ts +13 -0
  29. package/lib/table/column-filter/parse-filter-input.d.ts +52 -0
  30. package/lib/table/data/common/checkbox-column-def.d.ts +2 -0
  31. package/lib/table/data/common/event/ge-filter-event.d.ts +45 -0
  32. package/lib/table/data/common/row-number-column-def.d.ts +2 -0
  33. package/lib/table/data/options/auto-restore-options.d.ts +2 -0
  34. package/lib/table/data/options/auto-restore-options.if.d.ts +5 -0
  35. package/lib/table/data/options/table-options.d.ts +9 -0
  36. package/lib/table/data/options/table-options.if.d.ts +47 -0
  37. package/lib/table/data/tablemodel/column/column-def.d.ts +9 -0
  38. package/lib/table/data/tablemodel/column/column-def.if.d.ts +23 -0
  39. package/lib/table/event-adapter.d.ts +3 -0
  40. package/lib/table/event-listener.if.d.ts +9 -0
  41. package/lib/table/render-scope.d.ts +9 -1
  42. package/lib/table/state/table-state.if.d.ts +6 -1
  43. package/lib/table/table-api.d.ts +140 -0
  44. package/lib/table/table-scope.d.ts +73 -0
  45. package/llms.txt +62 -4
  46. package/package.json +1 -1
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * @category Keyboard
7
7
  */
8
- export declare const actionIds: readonly ["COPY_2_CLIPBOARD", "START_EDITING", "TOGGLE_SELECTION", "SELECT_ALL", "DESELECT_ALL", "NAVIGATE_LEFT", "NAVIGATE_RIGHT", "NAVIGATE_UP", "NAVIGATE_DOWN", "NAVIGATE_ROW_START", "NAVIGATE_ROW_END", "NAVIGATE_FIRST_CELL", "NAVIGATE_LAST_CELL", "NAVIGATE_PAGE_UP", "NAVIGATE_PAGE_DOWN", "ACTIVATE_CELL", "MOVE_ROW_UP", "MOVE_ROW_DOWN", "FILL_DOWN", "FILL_RIGHT", "NAVIGATE_NEXT_CELL", "NAVIGATE_PREVIOUS_CELL", "EXTEND_SELECTION_UP", "EXTEND_SELECTION_DOWN", "EXTEND_SELECTION_LEFT", "EXTEND_SELECTION_RIGHT", "EXTEND_SELECTION_ROW_START", "EXTEND_SELECTION_ROW_END", "EXTEND_SELECTION_PAGE_UP", "EXTEND_SELECTION_PAGE_DOWN", "NAVIGATE_DATA_EDGE_UP", "NAVIGATE_DATA_EDGE_DOWN", "NAVIGATE_DATA_EDGE_LEFT", "NAVIGATE_DATA_EDGE_RIGHT", "EXTEND_TO_DATA_EDGE_UP", "EXTEND_TO_DATA_EDGE_DOWN", "EXTEND_TO_DATA_EDGE_LEFT", "EXTEND_TO_DATA_EDGE_RIGHT", "SELECT_ROW", "SELECT_COLUMN", "CLEAR_CELLS", "CLEAR_AND_EDIT", "CUT_2_CLIPBOARD", "PASTE_FROM_CLIPBOARD", "UNDO", "REDO"];
8
+ export declare const actionIds: readonly ["COPY_2_CLIPBOARD", "START_EDITING", "TOGGLE_SELECTION", "SELECT_ALL", "DESELECT_ALL", "NAVIGATE_LEFT", "NAVIGATE_RIGHT", "NAVIGATE_UP", "NAVIGATE_DOWN", "NAVIGATE_ROW_START", "NAVIGATE_ROW_END", "NAVIGATE_FIRST_CELL", "NAVIGATE_LAST_CELL", "NAVIGATE_PAGE_UP", "NAVIGATE_PAGE_DOWN", "ACTIVATE_CELL", "MOVE_ROW_UP", "MOVE_ROW_DOWN", "FILL_DOWN", "FILL_RIGHT", "NAVIGATE_NEXT_CELL", "NAVIGATE_PREVIOUS_CELL", "EXTEND_SELECTION_UP", "EXTEND_SELECTION_DOWN", "EXTEND_SELECTION_LEFT", "EXTEND_SELECTION_RIGHT", "EXTEND_SELECTION_ROW_START", "EXTEND_SELECTION_ROW_END", "EXTEND_SELECTION_PAGE_UP", "EXTEND_SELECTION_PAGE_DOWN", "NAVIGATE_DATA_EDGE_UP", "NAVIGATE_DATA_EDGE_DOWN", "NAVIGATE_DATA_EDGE_LEFT", "NAVIGATE_DATA_EDGE_RIGHT", "EXTEND_TO_DATA_EDGE_UP", "EXTEND_TO_DATA_EDGE_DOWN", "EXTEND_TO_DATA_EDGE_LEFT", "EXTEND_TO_DATA_EDGE_RIGHT", "SELECT_ROW", "SELECT_COLUMN", "CLEAR_CELLS", "CLEAR_AND_EDIT", "CUT_2_CLIPBOARD", "PASTE_FROM_CLIPBOARD", "UNDO", "REDO", "FOCUS_COLUMN_FILTER", "OPEN_COLUMN_FILTER_MENU"];
9
9
  /**
10
10
  * Represents an action ID.
11
11
  *
@@ -32,26 +32,36 @@ export declare class AriaGridInfo {
32
32
  readonly bodyRowCount: number;
33
33
  readonly footerRowCount: number;
34
34
  private readonly colIndexMap;
35
+ readonly filterRowCount: number;
35
36
  /**
36
37
  * @param {number} headerRowCount - rendered header rows (0 if the header is hidden)
37
38
  * @param {number} bodyRowCount - body rows of the model (negative = unknown)
38
39
  * @param {number} footerRowCount - rendered footer rows (0 if the footer is hidden)
39
40
  * @param {number[]} colIndexMap - per model column its `aria-colindex` (0 = hidden)
41
+ * @param {number} [filterRowCount=0] - rendered filter row count (1 when the filter row is visible, else 0)
40
42
  */
41
- constructor(headerRowCount: number, bodyRowCount: number, footerRowCount: number, colIndexMap: number[]);
43
+ constructor(headerRowCount: number, bodyRowCount: number, footerRowCount: number, colIndexMap: number[], filterRowCount?: number);
42
44
  /**
43
45
  * Reads the counts of a table model.
44
46
  *
45
47
  * @param {TableModelIf} tableModel - the table model (only the area models, header/footer visibility and column widths are read)
48
+ * @param {number} [filterRowCount=0] - rendered filter row count (1 when the filter row is visible, else 0)
46
49
  * @returns {AriaGridInfo} the counts
47
50
  */
48
- static create(tableModel: Pick<TableModelIf, "getAreaModel" | "isHeaderVisibe" | "isFooterVisibe" | "getColumnCount" | "getColumnWidth">): AriaGridInfo;
49
- /** `aria-rowcount` of the grid: header + body + footer rows, `-1` if the body does not know its row count. */
51
+ static create(tableModel: Pick<TableModelIf, "getAreaModel" | "isHeaderVisibe" | "isFooterVisibe" | "getColumnCount" | "getColumnWidth">, filterRowCount?: number): AriaGridInfo;
52
+ /** `aria-rowcount` of the grid: header + filter row + body + footer rows, `-1` if the body does not know its row count. */
50
53
  get rowCount(): number;
51
54
  /** `aria-colcount` of the grid: the number of shown columns. */
52
55
  get colCount(): number;
53
56
  /**
54
- * `aria-rowindex` of a row (1-based over header → body → footer).
57
+ * 1-based `aria-rowindex` of the persistent filter row (immediately after the header rows), or `0` when none is shown.
58
+ *
59
+ * @returns {number} 1-based row number in the grid
60
+ * @since 1.1.114
61
+ */
62
+ filterRowIndex(): number;
63
+ /**
64
+ * `aria-rowindex` of a row (1-based over header → filter row → body → footer).
55
65
  *
56
66
  * @param {AreaIdent} area - header, body or footer
57
67
  * @param {number} rowIndex - row index in the area
@@ -47,6 +47,15 @@ export declare class AriaIds {
47
47
  * @returns {string} e.g. `"ge-t1-rg-body-center"`
48
48
  */
49
49
  rowGroup(area: AreaIdent, side: SideIdent): string;
50
+ /**
51
+ * The ID of one of the three row groups (`west`, `center`, `east`) of the persistent filter row, referenced by
52
+ * `aria-owns` of the host when {@link TableOptionsIf.filterRow} is enabled.
53
+ *
54
+ * @param {SideIdent} side - west, center or east
55
+ * @returns {string} e.g. `"ge-t1-rg-filter-center"`
56
+ * @since 1.1.114
57
+ */
58
+ filterRowGroup(side: SideIdent): string;
50
59
  /**
51
60
  * The ID of the row group of the detail rows (master/detail), referenced by `aria-owns` of the host.
52
61
  *
@@ -70,4 +70,10 @@ export declare class AriaTexts implements AriaTextsIf {
70
70
  rowsDeleted(count: number): string;
71
71
  columnsInserted(count: number): string;
72
72
  columnsDeleted(count: number): string;
73
+ filterInput(columnLabel: string): string;
74
+ clearColumnFilter(columnLabel: string): string;
75
+ filterColumn(columnLabel: string): string;
76
+ filterColumnActive(columnLabel: string): string;
77
+ filterMenuDialog(columnLabel: string): string;
78
+ columnChooserDialog(): string;
73
79
  }
@@ -382,4 +382,51 @@ export interface AriaTextsIf {
382
382
  * @since 1.1.99
383
383
  */
384
384
  columnsDeleted?(count: number): string;
385
+ /**
386
+ * Accessible name of a column filter input in the persistent filter row ({@link TableOptionsIf.filterRow}).
387
+ *
388
+ * @param {string} columnLabel - the header label of the column
389
+ * @returns {string} default: `"Filter Region"`
390
+ * @since 1.1.114
391
+ */
392
+ filterInput?(columnLabel: string): string;
393
+ /**
394
+ * Accessible name of the clear (`×`) button of a column filter input ({@link TableOptionsIf.filterRow}).
395
+ *
396
+ * @param {string} columnLabel - the header label of the column
397
+ * @returns {string} default: `"Clear filter for Region"`
398
+ * @since 1.1.114
399
+ */
400
+ clearColumnFilter?(columnLabel: string): string;
401
+ /**
402
+ * Accessible name of the header funnel button when the column has no active filter ({@link TableOptionsIf.columnFilterMenu}).
403
+ *
404
+ * @param {string} columnLabel - the header label of the column
405
+ * @returns {string} default: `"Filter menu for Region"`
406
+ * @since 1.1.114
407
+ */
408
+ filterColumn?(columnLabel: string): string;
409
+ /**
410
+ * Accessible name of the header funnel button when the column has an active filter ({@link TableOptionsIf.columnFilterMenu}).
411
+ *
412
+ * @param {string} columnLabel - the header label of the column
413
+ * @returns {string} default: `"Filter menu for Region (active)"`
414
+ * @since 1.1.114
415
+ */
416
+ filterColumnActive?(columnLabel: string): string;
417
+ /**
418
+ * Accessible name of the per-column filter menu dialog ({@link TableOptionsIf.columnFilterMenu}).
419
+ *
420
+ * @param {string} columnLabel - the header label of the column
421
+ * @returns {string} default: `"Filter Region"`
422
+ * @since 1.1.114
423
+ */
424
+ filterMenuDialog?(columnLabel: string): string;
425
+ /**
426
+ * Accessible name of the column chooser dialog ({@link TableApi.showColumnChooser}).
427
+ *
428
+ * @returns {string} default: `"Choose columns"`
429
+ * @since 1.1.114
430
+ */
431
+ columnChooserDialog?(): string;
385
432
  }
@@ -1,5 +1,13 @@
1
1
  import { editInputPipe } from '../renderer/edit/edit-input-pipe.if.js';
2
2
 
3
+ /**
4
+ * Parses a number as people type and paste it: group separators of the locale (`1.234,56` in de-DE, `1,234.56` in
5
+ * en-US, spaces where the locale groups with spaces), a leading `+`/`-` (also U+2212) or parentheses for negative
6
+ * numbers, a percent sign (÷ 100), currency signs or ISO codes at the start or end (`€ 12`, `12 EUR`), exponent
7
+ * notation. `undefined` if the text is no number (`"SKU 123"`, `"+49 123"` in en-US, `"(-5)"`).
8
+ */
9
+ /** @internal */
10
+ export declare function parseLocaleNumber(text: string, locale?: string): number | undefined;
3
11
  /**
4
12
  * An `editInputPipe` for numbers in the format of a locale, for the editor and for pasting: `"1.234,56"` (de-DE) and
5
13
  * `"1,234.56"` (en-US) → `1234.56`, `"12 %"` → `0.12`, `"€ 9,90"` → `9.9`, `"(5)"` → `-5`. Empty text stays `""`,
@@ -15,6 +23,9 @@ import { editInputPipe } from '../renderer/edit/edit-input-pipe.if.js';
15
23
  * @since 1.1.99
16
24
  */
17
25
  export declare function createNumberInputPipe(locale?: string): editInputPipe;
26
+ /** A date from ISO text (`2026-10-16`, `2026-10-16T08:30[:00]`) or the short date of the locale (`16.10.2026`). */
27
+ /** @internal */
28
+ export declare function parseDateText(text: string, locale?: string): Date | undefined;
18
29
  /**
19
30
  * An `editInputPipe` for dates: ISO text (`"2026-10-16"`, with time `"2026-10-16T08:30"`) or the short date of the
20
31
  * locale (`"16.10.2026"` in de-DE, `"10/16/2026"` in en-US) → `Date` (local time). Empty text stays `""`, other text as
@@ -0,0 +1,30 @@
1
+ import { ColumnFilterValueItemIf } from './column-filter-options.if.js';
2
+
3
+ /** Options for {@link collectDistinctValues}. */
4
+ export interface CollectDistinctValuesOptionsIf {
5
+ /** Maximum distinct values to collect before truncating (default `10_000`). */
6
+ maxValues?: number;
7
+ /** Case-insensitive substring filter applied to item labels during collection. */
8
+ search?: string;
9
+ /** Label for blank values (`null`, `undefined`, `""`, `NaN`). Default `"(Blanks)"`. */
10
+ blanksLabel?: string;
11
+ /** Optional custom formatter for non-blank values. */
12
+ formatValue?: (value: unknown) => string;
13
+ }
14
+ /** Result of {@link collectDistinctValues}. */
15
+ export interface DistinctValuesResultIf {
16
+ items: ColumnFilterValueItemIf[];
17
+ truncated: boolean;
18
+ }
19
+ /**
20
+ * Collects distinct values of one column in a single pass with a `Map` (preserving `1 !== "1"`), natural sorting
21
+ * (numbers numerically, dates chronologically, blanks last), optional substring search, and a `maxValues` cap.
22
+ *
23
+ * @example
24
+ * const res = collectDistinctValues([{ r: "EMEA" }, { r: "APAC" }, { r: "EMEA" }], (x: { r: string }) => x.r);
25
+ * res.items.map(i => i.value); // ["APAC", "EMEA"]
26
+ *
27
+ * @category Sorting & filtering
28
+ * @since 1.1.114
29
+ */
30
+ export declare function collectDistinctValues<T = any>(rows: readonly T[], getValue: (row: T) => unknown, options?: CollectDistinctValuesOptionsIf): DistinctValuesResultIf;
@@ -0,0 +1,33 @@
1
+ import { TableScope } from '../table-scope.js';
2
+ import { FilterPopupCloseReason } from './filter-popup-shell.js';
3
+
4
+ /**
5
+ * Column visibility chooser popup ({@link TableApi.showColumnChooser} / {@link TableApi.hideColumnChooser}).
6
+ *
7
+ * Reuses {@link FilterPopupShell} (`popover="manual"` with fallback), lists columns in current display order
8
+ * (excluding {@link RowNumberColumnDef} and {@link CheckboxColumnDef}), respects {@link ColumnDefIf.hideable},
9
+ * prevents hiding the last visible column, and persists changes through `TableScope.setColumnVisible` (`"columns"` state).
10
+ *
11
+ * @category Internals
12
+ * @since 1.1.114
13
+ */
14
+ export declare class ColumnChooserService {
15
+ private readonly scope;
16
+ private readonly popup;
17
+ private lastAnchor?;
18
+ private destroyed;
19
+ constructor(scope: TableScope);
20
+ isOpen(): boolean;
21
+ isInPopup(evt: Event): boolean;
22
+ /**
23
+ * Opens the column chooser popup anchored to `anchor` (or the inline-end header edge of the table if omitted).
24
+ * Calling `open` with the same anchor while already open toggles it closed.
25
+ */
26
+ open(anchor?: HTMLElement): void;
27
+ close(reason?: FilterPopupCloseReason): void;
28
+ destroy(): void;
29
+ private handleClosed;
30
+ private defaultAnchorRect;
31
+ private collectColumns;
32
+ private renderContent;
33
+ }
@@ -0,0 +1,17 @@
1
+ import { ShortcutActionIdMapping } from '../action/shortcut-actionid-mapping.type.js';
2
+
3
+ /**
4
+ * Keyboard shortcuts for built-in column filtering ({@link TableOptionsIf.filterRow} /
5
+ * {@link TableOptionsIf.columnFilterMenu}) – applied as a layer over the system mapping only when one of those
6
+ * options is enabled; `tableOptions.shortcutActionIdMapping` still overrides it.
7
+ *
8
+ * @param {boolean} mac - macOS keys (`⌘+Shift+F` instead of `Ctrl+Shift+F`)
9
+ * @returns {ShortcutActionIdMapping} the layer
10
+ *
11
+ * @example
12
+ * columnFilterShortcutLayer(false)["ctrl+shift+f"]; // "FOCUS_COLUMN_FILTER"
13
+ *
14
+ * @category Sorting & filtering
15
+ * @since 1.1.114
16
+ */
17
+ export declare function columnFilterShortcutLayer(mac: boolean): ShortcutActionIdMapping;
@@ -0,0 +1,58 @@
1
+ import { ColumnDefIf } from '../data/tablemodel/column/column-def.if.js';
2
+ import { TableScope } from '../table-scope.js';
3
+ import { ColumnFilterMenuOptionsIf } from './column-filter-options.if.js';
4
+ import { FilterPopupCloseReason } from './filter-popup-shell.js';
5
+
6
+ /**
7
+ * Per-column filter menu popup ({@link TableOptionsIf.columnFilterMenu}): renders the funnel button in every
8
+ * filterable header cell and opens a top-layer {@link FilterPopupShell} with comparison operators, condition input(s)
9
+ * and a searchable, virtualized distinct-values checkbox list.
10
+ *
11
+ * @category Internals
12
+ * @since 1.1.114
13
+ */
14
+ export declare class ColumnFilterMenuService {
15
+ private readonly scope;
16
+ readonly options: ColumnFilterMenuOptionsIf;
17
+ private readonly showHeaderButtons;
18
+ private readonly supported;
19
+ private readonly popup;
20
+ private openProperty?;
21
+ private openColumnIndex;
22
+ private searchTimer?;
23
+ private loadGeneration;
24
+ private destroyed;
25
+ constructor(scope: TableScope, options: ColumnFilterMenuOptionsIf, showHeaderButtons?: boolean);
26
+ /** Whether the filter menu feature is active for this table. */
27
+ isActive(): boolean;
28
+ /** Whether header cells should render the funnel button (true when `tableOptions.columnFilterMenu` is enabled). */
29
+ hasHeaderButtons(): boolean;
30
+ /** Whether a column filter menu popup is currently open. */
31
+ isOpen(): boolean;
32
+ /** Column index whose menu is currently open, or `-1`. */
33
+ getOpenColumnIndex(): number;
34
+ /** True if a DOM event originated inside the open filter menu popup. */
35
+ isInPopup(evt: Event): boolean;
36
+ /**
37
+ * Appends the funnel button to a lowest-row header cell when the column is filterable.
38
+ * Called from `RenderScope.renderCell()`.
39
+ */
40
+ decorateHeaderCell(cell: HTMLDivElement, rowIndex: number, columnIndex: number): void;
41
+ /** Toggles the filter menu for `column` (closes if already open for the same column). */
42
+ toggle(column: number | string | ColumnDefIf): boolean;
43
+ /**
44
+ * Opens the filter menu popup anchored to the given column's header cell / funnel button.
45
+ * Returns `false` if the column does not exist, is hidden, or is not filterable.
46
+ */
47
+ open(column: number | string | ColumnDefIf): boolean;
48
+ /** Closes the currently open filter menu popup, if any. */
49
+ close(reason?: FilterPopupCloseReason): void;
50
+ /** Releases timers, listeners and popup DOM. */
51
+ destroy(): void;
52
+ private handleClosed;
53
+ private findHeaderAnchor;
54
+ private fallbackAnchorRect;
55
+ private setHeaderButtonExpanded;
56
+ private renderMenuContent;
57
+ private clearSearchTimer;
58
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Comparison operators for a {@link ColumnFilterConditionIf}.
3
+ *
4
+ * - Text: `"contains"`, `"startsWith"`, `"endsWith"`, `"equals"`, `"notEquals"`, `"blank"`, `"notBlank"`.
5
+ * - Number / Date: `"equals"`, `"notEquals"`, `"lessThan"`, `"lessOrEqual"`, `"greaterThan"`, `"greaterOrEqual"`,
6
+ * `"between"`, `"blank"`, `"notBlank"`.
7
+ * - Boolean: `"equals"`, `"notEquals"`, `"blank"`, `"notBlank"`.
8
+ *
9
+ * @example
10
+ * const op: ColumnFilterOperator = "greaterThan";
11
+ *
12
+ * @category Sorting & filtering
13
+ * @since 1.1.114
14
+ */
15
+ export type ColumnFilterOperator = "contains" | "startsWith" | "endsWith" | "equals" | "notEquals" | "lessThan" | "lessOrEqual" | "greaterThan" | "greaterOrEqual" | "between" | "blank" | "notBlank";
@@ -0,0 +1,79 @@
1
+ import { ColumnFilterOperator } from './column-filter-operator.type.js';
2
+ import { ColumnFilterMenuOptionsIf, ColumnFilterOptionsIf, ColumnFilterTextsIf, FilterRowOptionsIf } from './column-filter-options.if.js';
3
+
4
+ /**
5
+ * Default options of the per-column filter menu ({@link TableOptionsIf.columnFilterMenu}).
6
+ *
7
+ * @example
8
+ * const opts = ColumnFilterMenuOptions.create({ applyOnChange: true });
9
+ *
10
+ * @category Sorting & filtering
11
+ * @since 1.1.114
12
+ */
13
+ export declare class ColumnFilterMenuOptions implements ColumnFilterMenuOptionsIf {
14
+ showCondition: boolean;
15
+ showValues: boolean;
16
+ applyOnChange: boolean;
17
+ maxValues: number;
18
+ static create(option?: boolean | Partial<ColumnFilterMenuOptionsIf>, defaultMaxValues?: number): ColumnFilterMenuOptionsIf | undefined;
19
+ }
20
+ /**
21
+ * Default options of the persistent filter row ({@link TableOptionsIf.filterRow}).
22
+ *
23
+ * @example
24
+ * const opts = FilterRowOptions.create({ debounce: 100 });
25
+ *
26
+ * @category Sorting & filtering
27
+ * @since 1.1.114
28
+ */
29
+ export declare class FilterRowOptions implements FilterRowOptionsIf {
30
+ visible: boolean;
31
+ debounce: number;
32
+ placeholder?: string;
33
+ height: number;
34
+ clearButtonVisible: boolean;
35
+ minInputWidthInPx: number;
36
+ static create(option?: boolean | Partial<FilterRowOptionsIf>): FilterRowOptionsIf | undefined;
37
+ }
38
+ /**
39
+ * Default global options of {@link TableOptionsIf.columnFilter}.
40
+ *
41
+ * @example
42
+ * const opts = ColumnFilterOptions.create({ caseSensitive: true });
43
+ *
44
+ * @category Sorting & filtering
45
+ * @since 1.1.114
46
+ */
47
+ export declare class ColumnFilterOptions implements ColumnFilterOptionsIf {
48
+ managed: boolean;
49
+ caseSensitive: boolean;
50
+ locale?: string;
51
+ maxValues: number;
52
+ static create(partial?: Partial<ColumnFilterOptionsIf>): ColumnFilterOptionsIf;
53
+ }
54
+ /**
55
+ * Default English UI texts of {@link TableOptionsIf.columnFilterTexts}.
56
+ *
57
+ * @example
58
+ * const texts = ColumnFilterTexts.create({ ok: "Übernehmen", cancel: "Abbrechen" });
59
+ *
60
+ * @category Sorting & filtering
61
+ * @since 1.1.114
62
+ */
63
+ export declare class ColumnFilterTexts implements ColumnFilterTextsIf {
64
+ searchPlaceholder: string;
65
+ searchValuesPlaceholder: string;
66
+ selectAll: string;
67
+ blanks: string;
68
+ ok: string;
69
+ cancel: string;
70
+ clear: string;
71
+ andLabel: string;
72
+ noValues: string;
73
+ columnsTitle: string;
74
+ searchColumnsPlaceholder: string;
75
+ operators: Record<ColumnFilterOperator, string>;
76
+ selectedValuesCount(count: number): string;
77
+ valuesTruncated(max: number): string;
78
+ static create(partial?: Partial<ColumnFilterTextsIf>): ColumnFilterTextsIf;
79
+ }
@@ -0,0 +1,174 @@
1
+ import { ColumnDefIf } from '../data/tablemodel/column/column-def.if.js';
2
+ import { ColumnFilterOperator } from './column-filter-operator.type.js';
3
+ import { ColumnFilterType } from './column-filter-type.type.js';
4
+ import { ColumnFiltersMap } from './column-filter.if.js';
5
+
6
+ /**
7
+ * One item in the distinct-values checklist of a column filter menu.
8
+ *
9
+ * @category Sorting & filtering
10
+ * @since 1.1.114
11
+ */
12
+ export interface ColumnFilterValueItemIf {
13
+ /** Raw cell value stored in {@link ColumnFilterIf.values}. */
14
+ value: unknown;
15
+ /** Display label (defaults to the formatted value, or `(Blanks)` for blank values). */
16
+ label?: string;
17
+ /** Optional number of matching rows for this value. */
18
+ count?: number;
19
+ }
20
+ /**
21
+ * Context passed to {@link ColumnFilterColumnOptionsIf.getValues} when a filter menu requests its distinct values.
22
+ *
23
+ * @category Sorting & filtering
24
+ * @since 1.1.114
25
+ */
26
+ export interface ColumnFilterValuesContextIf {
27
+ /** Model column index. */
28
+ columnIndex: number;
29
+ /** Column definition, if any. */
30
+ columnDef: ColumnDefIf | undefined;
31
+ /** Column property (or `"#<index>"`). */
32
+ property: string;
33
+ /** Current search text entered in the filter menu. */
34
+ search: string;
35
+ /** Configured maximum number of distinct values. */
36
+ maxValues: number;
37
+ /** Active filters of all other columns. */
38
+ otherFilters: ColumnFiltersMap;
39
+ }
40
+ /**
41
+ * Per-column configuration of {@link ColumnDefIf.filter}.
42
+ *
43
+ * @example
44
+ * ColumnDef.create({
45
+ * property: "total",
46
+ * headerLabel: "Total",
47
+ * filter: { type: "number", placeholder: "> 100" }
48
+ * });
49
+ *
50
+ * @category Sorting & filtering
51
+ * @since 1.1.114
52
+ */
53
+ export interface ColumnFilterColumnOptionsIf {
54
+ /** Explicit column filter type (inferred from data when omitted). */
55
+ type?: ColumnFilterType;
56
+ /** Custom value getter for filtering this column (defaults to `getRowValue` / `valueGetter` / cell formulas). */
57
+ valueGetter?: (row: any) => unknown;
58
+ /** Case sensitivity for text comparisons on this column (defaults to `tableOptions.columnFilter.caseSensitive`). */
59
+ caseSensitive?: boolean;
60
+ /** Placeholder text in the filter row input of this column. */
61
+ placeholder?: string;
62
+ /** Custom or server-side distinct values provider for the filter menu. */
63
+ getValues?: (ctx: ColumnFilterValuesContextIf) => ColumnFilterValueItemIf[] | Promise<ColumnFilterValueItemIf[]>;
64
+ }
65
+ /**
66
+ * Value of {@link ColumnDefIf.filter}: `false` disables filtering for the column, `true` enables it with inferred
67
+ * type, a {@link ColumnFilterType} picks the type, or an object configures details.
68
+ *
69
+ * @category Sorting & filtering
70
+ * @since 1.1.114
71
+ */
72
+ export type ColumnFilterColumnOption = boolean | ColumnFilterType | Partial<ColumnFilterColumnOptionsIf>;
73
+ /**
74
+ * Configuration of the persistent filter row below the column titles ({@link TableOptionsIf.filterRow}).
75
+ *
76
+ * @example
77
+ * const tableOptions: TableOptionsIf = {
78
+ * ...new TableOptions(),
79
+ * filterRow: { debounce: 150, height: 34, clearButtonVisible: true }
80
+ * };
81
+ *
82
+ * @category Sorting & filtering
83
+ * @since 1.1.114
84
+ */
85
+ export interface FilterRowOptionsIf {
86
+ /** Initial visibility of the filter row. Default `true` once `filterRow` is enabled. */
87
+ visible: boolean;
88
+ /** Debounce delay in milliseconds while typing (`0` applies immediately). Default `200`. */
89
+ debounce: number;
90
+ /** Placeholder shown in filter inputs (defaults to `columnFilterTexts.searchPlaceholder`). */
91
+ placeholder?: string;
92
+ /** Height of the filter row in pixels. Default `34`. */
93
+ height: number;
94
+ /** Show a small clear (`×`) button when a column filter input is non-empty or active. Default `true`. */
95
+ clearButtonVisible: boolean;
96
+ /** Below this column width (px) a compact button is shown instead of a cramped input. Default `44`. */
97
+ minInputWidthInPx: number;
98
+ }
99
+ /**
100
+ * Configuration of the per-column filter menu popup ({@link TableOptionsIf.columnFilterMenu}).
101
+ *
102
+ * @example
103
+ * const tableOptions: TableOptionsIf = {
104
+ * ...new TableOptions(),
105
+ * columnFilterMenu: { showCondition: true, showValues: true, applyOnChange: false, maxValues: 10_000 }
106
+ * };
107
+ *
108
+ * @category Sorting & filtering
109
+ * @since 1.1.114
110
+ */
111
+ export interface ColumnFilterMenuOptionsIf {
112
+ /** Show the operator selector and condition input(s). Default `true`. */
113
+ showCondition: boolean;
114
+ /** Show the searchable distinct-values checkbox list. Default `true`. */
115
+ showValues: boolean;
116
+ /** Apply changes immediately instead of waiting for the OK button. Default `false`. */
117
+ applyOnChange: boolean;
118
+ /** Maximum distinct values collected for the checklist (defaults to `columnFilter.maxValues`, `10_000`). */
119
+ maxValues: number;
120
+ }
121
+ /**
122
+ * Global options for built-in column filtering ({@link TableOptionsIf.columnFilter}).
123
+ *
124
+ * @example
125
+ * const tableOptions: TableOptionsIf = {
126
+ * ...new TableOptions(),
127
+ * columnFilter: { managed: false } // server-side filtering via onFilterChanged
128
+ * };
129
+ *
130
+ * @category Sorting & filtering
131
+ * @since 1.1.114
132
+ */
133
+ export interface ColumnFilterOptionsIf {
134
+ /**
135
+ * `true` (default): the table filters the body rows itself.
136
+ * `false`: the table only keeps the filter state, updates its UI and fires {@link EventListenerIf.onFilterChanged}
137
+ * (for server-side filtering).
138
+ */
139
+ managed: boolean;
140
+ /** Case-sensitive text comparisons. Default `false`. */
141
+ caseSensitive: boolean;
142
+ /** BCP 47 locale used when parsing numbers and dates from filter input (default: browser locale). */
143
+ locale?: string;
144
+ /** Maximum distinct values collected for a column filter menu. Default `10_000`. */
145
+ maxValues: number;
146
+ }
147
+ /**
148
+ * Localizable UI labels of the filter row, filter menu and column chooser ({@link TableOptionsIf.columnFilterTexts}).
149
+ *
150
+ * @example
151
+ * const tableOptions: TableOptionsIf = {
152
+ * ...new TableOptions(),
153
+ * columnFilterTexts: { searchPlaceholder: "Suchen", ok: "Übernehmen", cancel: "Abbrechen", clear: "Zurücksetzen" }
154
+ * };
155
+ *
156
+ * @category Sorting & filtering
157
+ * @since 1.1.114
158
+ */
159
+ export interface ColumnFilterTextsIf {
160
+ searchPlaceholder: string;
161
+ searchValuesPlaceholder: string;
162
+ selectAll: string;
163
+ blanks: string;
164
+ ok: string;
165
+ cancel: string;
166
+ clear: string;
167
+ andLabel: string;
168
+ selectedValuesCount: (count: number) => string;
169
+ valuesTruncated: (max: number) => string;
170
+ noValues: string;
171
+ columnsTitle: string;
172
+ searchColumnsPlaceholder: string;
173
+ operators: Record<ColumnFilterOperator, string>;
174
+ }
@@ -0,0 +1,86 @@
1
+ import { FilterFunction } from '../data/common/filter-function.js';
2
+ import { GeFilterEventSource } from '../data/common/event/ge-filter-event.js';
3
+ import { ColumnDefIf } from '../data/tablemodel/column/column-def.if.js';
4
+ import { TableScope } from '../table-scope.js';
5
+ import { ColumnFilterOptionsIf, ColumnFilterTextsIf } from './column-filter-options.if.js';
6
+ import { ColumnFilterType } from './column-filter-type.type.js';
7
+ import { ColumnFilterIf, ColumnFiltersMap } from './column-filter.if.js';
8
+ import { CollectDistinctValuesOptionsIf, DistinctValuesResultIf } from './collect-distinct-values.js';
9
+
10
+ /**
11
+ * Manages built-in column filters for one {@link TableScope} (`tableScope.columnFilterService`):
12
+ * holds the active {@link ColumnFiltersMap}, compiles them into a single row predicate combined with
13
+ * `tableOptions.externalFilterFunction`, caches inferred column types, updates the table state and fires
14
+ * {@link EventListenerIf.onFilterChanged}.
15
+ *
16
+ * @category Internals
17
+ * @since 1.1.114
18
+ */
19
+ export declare class ColumnFilterService {
20
+ private readonly scope;
21
+ private filters;
22
+ private readonly typeCache;
23
+ private warnedNonFilterable;
24
+ private cachedCompiled?;
25
+ constructor(scope: TableScope);
26
+ getOptions(): ColumnFilterOptionsIf;
27
+ getTexts(): ColumnFilterTextsIf;
28
+ /** True if the column at `columnIndex` can be filtered by the user (filter row / filter menu). */
29
+ isColumnFilterable(columnIndex: number): boolean;
30
+ /** True if at least one column filter is active. */
31
+ hasActiveFilters(): boolean;
32
+ /** True if the body model supports client-side filtering. */
33
+ isBodyFilterable(): boolean;
34
+ /** Resolves a column index, property string, `#<index>` key, or `ColumnDefIf`. */
35
+ resolveColumn(column: number | string | ColumnDefIf): {
36
+ property: string;
37
+ columnIndex: number;
38
+ columnDef?: ColumnDefIf;
39
+ } | undefined;
40
+ /** Gets the filter of one column (copy), or `undefined` if unfiltered. */
41
+ getColumnFilter(column: number | string | ColumnDefIf): ColumnFilterIf | undefined;
42
+ /** Returns a shallow/serialized copy of all active column filters. */
43
+ getColumnFilters(): ColumnFiltersMap;
44
+ /** True if the column has an active filter. */
45
+ isColumnFiltered(column: number | string | ColumnDefIf): boolean;
46
+ /** Sets or clears the filter of a single column, runs 1 filter pass + 1 render + 1 `onFilterChanged`. */
47
+ setColumnFilter(column: number | string | ColumnDefIf, filter: ColumnFilterIf | undefined, source?: GeFilterEventSource): void;
48
+ /** Replaces all column filters in one batch (1 filter pass, 1 render, 1 `onFilterChanged`). */
49
+ setColumnFilters(filters: ColumnFiltersMap, source?: GeFilterEventSource): void;
50
+ /** Clears all active column filters. */
51
+ clearColumnFilters(source?: GeFilterEventSource): void;
52
+ /**
53
+ * Restores filters from {@link TableStateService} (during `firstInit()` or `applyState()`).
54
+ * Unknown column properties are ignored. Returns `true` if the filter set changed.
55
+ */
56
+ applyStateFilters(raw: unknown, runFilterNow: boolean): boolean;
57
+ /**
58
+ * Returns the effective {@link FilterFunction} combining `tableOptions.externalFilterFunction` and all active
59
+ * column filters with AND. When no column filters are active (or `managed: false`), returns
60
+ * `tableOptions.externalFilterFunction` directly (bit-identical to before 1.1.114).
61
+ */
62
+ getEffectiveFilterFunction(): FilterFunction<any> | undefined;
63
+ /** Clears cached column types (called after `setRows` or model changes). */
64
+ invalidateTypeCache(): void;
65
+ /** Called by `TableApi.setRows()`: invalidates cached types and re-applies active column filters to the new rows. */
66
+ onRowsReplaced(): void;
67
+ /** Returns the effective {@link ColumnFilterType} of a column (explicit or inferred and cached). */
68
+ getColumnFilterType(columnIndex: number, property: string, columnDef?: ColumnDefIf): ColumnFilterType;
69
+ /**
70
+ * Collects distinct values of one column over all source rows filtered by all **other** active filters
71
+ * (Excel-style cascading values for the filter menu).
72
+ */
73
+ collectColumnDistinctValues(column: number | string | ColumnDefIf, options?: CollectDistinctValuesOptionsIf): DistinctValuesResultIf;
74
+ /** Snapshot of all filters excluding `excludeProperty`. */
75
+ getOtherFilters(excludeProperty: string): ColumnFiltersMap;
76
+ private commitFilters;
77
+ private runManagedFilter;
78
+ private emitFilterEvent;
79
+ private validPropertySet;
80
+ private getCompiledColumnPredicate;
81
+ private buildOtherFiltersPredicate;
82
+ private compileForFilters;
83
+ private buildValueGetter;
84
+ private collectSampleRows;
85
+ private getAllRowsForDistinct;
86
+ }