@guiexpert/table 1.1.89 → 1.1.91
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 +3 -1
- package/css/main.css +50 -4
- package/css/table-classes.css +30 -0
- package/css/table-color-classes.css +3 -1
- package/css/table-color-vars.css +4 -2
- package/css/table-tree.css +13 -1
- package/index.cjs +88 -97
- package/index.d.ts +192 -184
- package/index.js +3616 -1879
- package/lib/common/debounce.d.ts +1 -0
- package/lib/common/decorator/avoid-double-execution.decorator.d.ts +2 -0
- package/lib/common/escape-html.d.ts +22 -0
- package/lib/common/generator/column-def-generator-service.d.ts +2 -1
- package/lib/common/generator/domain/property-type.d.ts +19 -0
- package/lib/common/generator/domain/value-info.d.ts +2 -1
- package/lib/common/generator/json-service.d.ts +1 -0
- package/lib/common/generator/property-type.service.d.ts +3 -2
- package/lib/common/generator/scheme-generator-service.d.ts +3 -1
- package/lib/common/generator/string-util.d.ts +7 -0
- package/lib/common/throttle.d.ts +1 -0
- package/lib/table/action/action-id.type.d.ts +5 -1
- package/lib/table/action/on-action-triggered.if.d.ts +2 -1
- package/lib/table/action/osx-shortcut-actionId-mapping.d.ts +3 -1
- package/lib/table/action/shortcut-actionid-mapping.type.d.ts +3 -1
- package/lib/table/action/shortcut-util.d.ts +12 -0
- package/lib/table/action/shortcut.service.d.ts +5 -3
- package/lib/table/action/windows-shortcut-actionId-mapping.d.ts +3 -1
- package/lib/table/aria/aria-grid-info.d.ts +76 -0
- package/lib/table/aria/aria-ids.d.ts +56 -0
- package/lib/table/aria/aria-texts.d.ts +34 -0
- package/lib/table/aria/aria-texts.if.d.ts +88 -0
- package/lib/table/aria/live-announcer.d.ts +53 -0
- package/lib/table/aria/tree-aria-info.d.ts +58 -0
- package/lib/table/checkbox/all-rows-checkbox-model.d.ts +31 -0
- package/lib/table/checkbox/checkbox-model.d.ts +3 -2
- package/lib/table/checkbox/checkbox-model.if.d.ts +2 -1
- package/lib/table/checkbox/tree-checkbox-model.d.ts +19 -4
- package/lib/table/color/color-rgb.d.ts +2 -1
- package/lib/table/color/color-rgb.if.d.ts +2 -0
- package/lib/table/color/ge-css-color-util.d.ts +25 -2
- package/lib/table/color/three-color-gradient-arg.d.ts +3 -2
- package/lib/table/color/three-color-gradient-arg.if.d.ts +3 -1
- package/lib/table/color/two-color-gradient-arg.d.ts +3 -2
- package/lib/table/color/two-color-gradient-arg.if.d.ts +3 -1
- package/lib/table/crud/column-widths.d.ts +2 -1
- package/lib/table/crud/column-widths.if.d.ts +1 -0
- package/lib/table/crud/crud-action.d.ts +1 -0
- package/lib/table/crud/crud-object-edit.d.ts +25 -3
- package/lib/table/crud/crud-object-view.d.ts +6 -0
- package/lib/table/crud/crud-options.d.ts +35 -4
- package/lib/table/crud/crud-options.if.d.ts +3 -2
- package/lib/table/crud/crud-table-model-factory.d.ts +64 -8
- package/lib/table/crud/url-info.d.ts +2 -1
- package/lib/table/crud/url-info.if.d.ts +1 -0
- package/lib/table/crud/urls.if.d.ts +2 -1
- package/lib/table/css-vars.d.ts +1 -0
- package/lib/table/data/chunk/chunk.data-event.d.ts +3 -2
- package/lib/table/data/chunk/chunk.data-event.if.d.ts +2 -1
- package/lib/table/data/chunk/request-chunk.d.ts +2 -1
- package/lib/table/data/chunk/request-chunk.if.d.ts +1 -0
- package/lib/table/data/common/aligns.d.ts +18 -0
- package/lib/table/data/common/area-map-factory.d.ts +3 -2
- package/lib/table/data/common/area-map.d.ts +3 -1
- package/lib/table/data/common/area-map.type.d.ts +1 -0
- package/lib/table/data/common/args-adjust-columns-to-row-parent-params.d.ts +6 -4
- package/lib/table/data/common/args-render-cell-div.d.ts +5 -3
- package/lib/table/data/common/boolean-function.d.ts +10 -0
- package/lib/table/data/common/cell-range.d.ts +16 -7
- package/lib/table/data/common/checkbox-column-def.d.ts +6 -4
- package/lib/table/data/common/checked-type.d.ts +2 -0
- package/lib/table/data/common/event/ge-cell-indices.d.ts +2 -0
- package/lib/table/data/common/event/ge-key-event.d.ts +2 -0
- package/lib/table/data/common/event/ge-model-change-event.d.ts +16 -2
- package/lib/table/data/common/event/ge-mouse-event.d.ts +52 -4
- package/lib/table/data/common/event/ge-scroll-event.d.ts +27 -1
- package/lib/table/data/common/event/input/table-cell-update-event.d.ts +14 -10
- package/lib/table/data/common/event/input/table-cell-update-event.if.d.ts +3 -1
- package/lib/table/data/common/filter-function.d.ts +2 -0
- package/lib/table/data/common/get-t.d.ts +2 -0
- package/lib/table/data/common/index-and-px.d.ts +2 -0
- package/lib/table/data/common/size-unit.type.d.ts +2 -0
- package/lib/table/data/common/size.d.ts +13 -2
- package/lib/table/data/common/size.if.d.ts +3 -1
- package/lib/table/data/common/sizes.d.ts +133 -1
- package/lib/table/data/common/sort-item.d.ts +16 -3
- package/lib/table/data/common/sort-state.type.d.ts +2 -0
- package/lib/table/data/common/tree-arrow.type.d.ts +2 -0
- package/lib/table/data/common/tree-row-if.d.ts +22 -1
- package/lib/table/data/common/tree-row.d.ts +3 -1
- package/lib/table/data/common/value-label.d.ts +2 -1
- package/lib/table/data/common/value-label.if.d.ts +1 -0
- package/lib/table/data/div-scope.type.d.ts +2 -0
- package/lib/table/data/event/mouse-target-data.d.ts +5 -3
- package/lib/table/data/geo-data.d.ts +2 -0
- package/lib/table/data/options/auto-restore-options.d.ts +32 -1
- package/lib/table/data/options/auto-restore-options.if.d.ts +8 -0
- package/lib/table/data/options/default-row-heights.d.ts +20 -2
- package/lib/table/data/options/default-row-heights.if.d.ts +4 -1
- package/lib/table/data/options/header-group-options.d.ts +3 -2
- package/lib/table/data/options/header-group-options.if.d.ts +3 -4
- package/lib/table/data/options/icon.d.ts +2 -1
- package/lib/table/data/options/icon.if.d.ts +2 -0
- package/lib/table/data/options/sorted-options.d.ts +3 -2
- package/lib/table/data/options/sorted-options.if.d.ts +3 -1
- package/lib/table/data/options/table-options.d.ts +44 -13
- package/lib/table/data/options/table-options.if.d.ts +117 -44
- package/lib/table/data/options/tree-options.d.ts +3 -2
- package/lib/table/data/options/tree-options.if.d.ts +3 -1
- package/lib/table/data/side-ident.type.d.ts +2 -0
- package/lib/table/data/table-model-and-options.d.ts +5 -3
- package/lib/table/data/table-model-and-options.if.d.ts +4 -2
- package/lib/table/data/tablemodel/area-ident.type.d.ts +4 -0
- package/lib/table/data/tablemodel/areamodel/abstract-area-model.d.ts +10 -9
- package/lib/table/data/tablemodel/areamodel/area-model-array-of-arrays.d.ts +6 -4
- package/lib/table/data/tablemodel/areamodel/area-model-cell-groups.d.ts +13 -12
- package/lib/table/data/tablemodel/areamodel/area-model-hidden.d.ts +9 -7
- package/lib/table/data/tablemodel/areamodel/area-model-object-array-with-columndefs.d.ts +16 -14
- package/lib/table/data/tablemodel/areamodel/area-model-object-array.d.ts +35 -31
- package/lib/table/data/tablemodel/areamodel/area-model-tree.d.ts +153 -11
- package/lib/table/data/tablemodel/areamodel/area-model.d.ts +66 -104
- package/lib/table/data/tablemodel/areamodel/area-model.if.d.ts +56 -50
- package/lib/table/data/tablemodel/areamodel/async-area-model-object-array.d.ts +5 -5
- package/lib/table/data/tablemodel/areamodel/col-and-rowspan-model.d.ts +14 -3
- package/lib/table/data/tablemodel/areamodel/cover-grid-body-model.d.ts +10 -8
- package/lib/table/data/tablemodel/areamodel/has-default-row-height-if.d.ts +1 -0
- package/lib/table/data/tablemodel/areamodel/object-array-holder.if.d.ts +1 -0
- package/lib/table/data/tablemodel/cellgroup/cell-group-ext.d.ts +3 -2
- package/lib/table/data/tablemodel/cellgroup/cell-group.d.ts +2 -1
- package/lib/table/data/tablemodel/cellgroup/cell-group.if.d.ts +28 -0
- package/lib/table/data/tablemodel/cellgroup/cellgroup-factory.d.ts +4 -3
- package/lib/table/data/tablemodel/column/column-def.d.ts +67 -10
- package/lib/table/data/tablemodel/column/column-def.if.d.ts +63 -96
- package/lib/table/data/tablemodel/column/column-visibility.d.ts +6 -0
- package/lib/table/data/tablemodel/cover-grid-table-model.d.ts +11 -10
- package/lib/table/data/tablemodel/padding.d.ts +2 -0
- package/lib/table/data/tablemodel/table-model.d.ts +75 -14
- package/lib/table/data/tablemodel/table-model.if.d.ts +52 -8
- package/lib/table/ele-scope.d.ts +36 -5
- package/lib/table/event-adapter.d.ts +17 -10
- package/lib/table/event-checkbox-changed-handler.d.ts +2 -1
- package/lib/table/event-listener.if.d.ts +42 -9
- package/lib/table/factory/cover-grid-factory.d.ts +4 -3
- package/lib/table/factory/table-factory.d.ts +103 -64
- package/lib/table/factory/tree-factory.d.ts +81 -4
- package/lib/table/focus/event-focus-changed-listener.if.d.ts +5 -3
- package/lib/table/focus/focus-model.d.ts +7 -5
- package/lib/table/focus/focus-model.if.d.ts +22 -1
- package/lib/table/focus/focus.type.d.ts +2 -0
- package/lib/table/input-handler.d.ts +5 -1
- package/lib/table/instanceof-workaround.d.ts +16 -0
- package/lib/table/license-manager.d.ts +2 -0
- package/lib/table/mouse-handler.d.ts +18 -9
- package/lib/table/render-scope.d.ts +115 -25
- package/lib/table/renderer/action/action-event-listener.if.d.ts +2 -1
- package/lib/table/renderer/action/action-event.d.ts +4 -3
- package/lib/table/renderer/action/action-event.if.d.ts +2 -1
- package/lib/table/renderer/action/actions-cell-renderer.d.ts +8 -7
- package/lib/table/renderer/cell-group-ext-cell-renderer.d.ts +8 -7
- package/lib/table/renderer/cell-render.if.d.ts +41 -4
- package/lib/table/renderer/checkbox-boolean-property-cell-renderer.d.ts +7 -5
- package/lib/table/renderer/checkbox-cell-renderer.d.ts +8 -5
- package/lib/table/renderer/date-to-int-date-cell-renderer.d.ts +6 -5
- package/lib/table/renderer/date-to-iso-cell-renderer.d.ts +6 -5
- package/lib/table/renderer/date-to-locale-date-cell-renderer.d.ts +6 -5
- package/lib/table/renderer/date-to-tec-cell-renderer.d.ts +6 -5
- package/lib/table/renderer/edit/edit-cell-renderer.type.d.ts +2 -1
- package/lib/table/renderer/edit/edit-input-pipe-for-number.d.ts +2 -1
- package/lib/table/renderer/edit/edit-input-pipe.if.d.ts +2 -0
- package/lib/table/renderer/edit/input-cell-renderer.d.ts +6 -5
- package/lib/table/renderer/edit/select-cell-renderer.d.ts +7 -6
- package/lib/table/renderer/male-female-to-icon-cell-renderer.d.ts +19 -6
- package/lib/table/renderer/number-cell-progress-bar-cell-renderer.d.ts +11 -6
- package/lib/table/renderer/number-cell-renderer.d.ts +6 -5
- package/lib/table/renderer/positive-and-negative-number-renderer.d.ts +6 -5
- package/lib/table/renderer/progress-bar-cell-renderer.d.ts +12 -6
- package/lib/table/renderer/renderer-cleanup-fn.type.d.ts +1 -0
- package/lib/table/renderer/renderer.d.ts +3 -2
- package/lib/table/renderer/simple-array-cell-renderer.d.ts +6 -5
- package/lib/table/renderer/star-rating-cell-renderer.d.ts +12 -6
- package/lib/table/renderer/true-false-cell-renderer.d.ts +17 -5
- package/lib/table/resize-handler.d.ts +3 -1
- package/lib/table/selection/event-selection-changed-listener.if.d.ts +2 -1
- package/lib/table/selection/multi-rows-selection-model.d.ts +7 -4
- package/lib/table/selection/selection-model.d.ts +112 -10
- package/lib/table/selection/selection-model.if.d.ts +48 -3
- package/lib/table/selection/selection-service.d.ts +35 -7
- package/lib/table/selection/selection.type.d.ts +3 -0
- package/lib/table/service/abstract-store-state.service.d.ts +1 -1
- package/lib/table/service/convenience-dom.service.d.ts +36 -13
- package/lib/table/service/copy-service.d.ts +18 -4
- package/lib/table/service/copy-service.if.d.ts +4 -3
- package/lib/table/service/data/collapsed-expanded.data.d.ts +1 -0
- package/lib/table/service/data/html-style.type.d.ts +1 -0
- package/lib/table/service/dom-service.if.d.ts +30 -0
- package/lib/table/service/excel-service.d.ts +43 -3
- package/lib/table/service/excel-service.if.d.ts +8 -1
- package/lib/table/service/ge-filter.service.d.ts +1 -0
- package/lib/table/service/simple-dom-service.d.ts +3 -1
- package/lib/table/service/store-state-collapsed-expand.service.d.ts +4 -3
- package/lib/table/service/store-state-scroll-pos.service.d.ts +3 -2
- package/lib/table/service/store-state-sorting.service.d.ts +4 -3
- package/lib/table/service/tree-row.service.d.ts +5 -1
- package/lib/table/table-api.d.ts +309 -550
- package/lib/table/table-scope.d.ts +223 -85
- package/package.json +23 -8
|
@@ -1,56 +1,61 @@
|
|
|
1
|
-
import { TableModelIf } from './data/tablemodel/table-model.if';
|
|
2
|
-
import { AreaIdent } from './data/tablemodel/area-ident.type';
|
|
3
|
-
import { GeMouseEvent } from './data/common/event/ge-mouse-event';
|
|
4
|
-
import { DomServiceIf } from './service/dom-service.if';
|
|
5
|
-
import { TableOptionsIf } from './data/options/table-options.if';
|
|
6
|
-
import { MouseHandler } from './mouse-handler';
|
|
7
|
-
import { EventListenerIf } from './event-listener.if';
|
|
8
|
-
import { TableApi } from './table-api';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
1
|
+
import { TableModelIf } from './data/tablemodel/table-model.if.js';
|
|
2
|
+
import { AreaIdent } from './data/tablemodel/area-ident.type.js';
|
|
3
|
+
import { GeMouseEvent } from './data/common/event/ge-mouse-event.js';
|
|
4
|
+
import { DomServiceIf } from './service/dom-service.if.js';
|
|
5
|
+
import { TableOptionsIf } from './data/options/table-options.if.js';
|
|
6
|
+
import { MouseHandler } from './mouse-handler.js';
|
|
7
|
+
import { EventListenerIf } from './event-listener.if.js';
|
|
8
|
+
import { TableApi } from './table-api.js';
|
|
9
|
+
import { SortState } from './data/common/sort-state.type.js';
|
|
10
|
+
import { StoreStateCollapsedExpandService } from './service/store-state-collapsed-expand.service.js';
|
|
11
|
+
import { StoreStateSortingService } from './service/store-state-sorting.service.js';
|
|
12
|
+
import { RenderScope } from './render-scope.js';
|
|
13
|
+
import { InputHandler } from './input-handler.js';
|
|
14
|
+
import { SelectionService } from './selection/selection-service.js';
|
|
15
|
+
import { GeKeyEvent } from './data/common/event/ge-key-event.js';
|
|
16
|
+
import { OnActionTriggeredIf } from './action/on-action-triggered.if.js';
|
|
17
|
+
import { ActionId } from './action/action-id.type.js';
|
|
18
|
+
import { ShortcutService } from './action/shortcut.service.js';
|
|
19
|
+
import { TreeRowIf } from './data/common/tree-row-if.js';
|
|
20
|
+
import { LicenseManager } from './license-manager.js';
|
|
21
|
+
import { SelectionModel } from './selection/selection-model.js';
|
|
22
|
+
import { CopyServiceIf } from './service/copy-service.if.js';
|
|
23
|
+
import { MouseTargetData } from './data/event/mouse-target-data.js';
|
|
24
|
+
import { SelectionModelIf } from './selection/selection-model.if.js';
|
|
25
|
+
import { FocusModelIf } from './focus/focus-model.if.js';
|
|
26
|
+
import { EventFocusChangedListenerIf } from './focus/event-focus-changed-listener.if.js';
|
|
27
|
+
import { EventSelectionChangedListenerIf } from './selection/event-selection-changed-listener.if.js';
|
|
28
|
+
import { ResizeHandler } from './resize-handler.js';
|
|
29
|
+
import { ExcelServiceIf } from './service/excel-service.if.js';
|
|
30
|
+
import { ColumnDefIf } from './data/tablemodel/column/column-def.if.js';
|
|
31
|
+
import { LiveAnnouncer } from './aria/live-announcer.js';
|
|
28
32
|
|
|
29
33
|
/**
|
|
30
|
-
*
|
|
34
|
+
* Creates and runs one table in a host element – the core that every framework wrapper uses.
|
|
31
35
|
*
|
|
32
|
-
*
|
|
33
|
-
* @
|
|
34
|
-
*
|
|
35
|
-
* @
|
|
36
|
-
* @property {StoreStateCollapsedExpandService | undefined} storeStateCollapsedExpandService - A service to manage and restore the collapsed or expanded state of the table's rows.
|
|
37
|
-
* @property {StoreStateSortingService | undefined} storeSortingService - A service to manage and restore the sort state of the table's columns.
|
|
38
|
-
* @property {SelectionService} selectionService - An instance of SelectionService to manage cell selection in the table.
|
|
39
|
-
* @property {GeKeyEvent | undefined} keyEvent - An object representing the last processed keyboard event.
|
|
40
|
-
* @property {TableApi} api - An instance of TableApi, providing an API for table interactions.
|
|
36
|
+
* It connects the four building blocks: host element, {@link TableModelIf table model}, {@link TableOptionsIf options}
|
|
37
|
+
* and an {@link EventListenerIf event listener}, renders only the visible cells (virtual scrolling in both
|
|
38
|
+
* directions) and handles mouse, keyboard, selection, sorting and editing. Talk to the table through
|
|
39
|
+
* {@link getApi} – the {@link TableApi}.
|
|
41
40
|
*
|
|
42
|
-
*
|
|
43
|
-
* - mouseStartAction: The action performed at the start of a mouse drag operation.
|
|
44
|
-
* - mouseStartWidth: The initial width of an element at the start of a resizing drag operation.
|
|
45
|
-
* - mouseStartColumnIndex: The index of the column at the start of a resizing drag operation.
|
|
46
|
-
* - dragFrom: The initial cell index of a drag operation.
|
|
47
|
-
* - dragTo: The current cell index of a drag operation.
|
|
48
|
-
* - lastDragFrom: The previous initial cell index of a drag operation.
|
|
49
|
-
* - lastDragTo: The previous current cell index of a drag operation.
|
|
50
|
-
* - firstDraggingRendering: A boolean indicating if this is the first render during the current drag operation.
|
|
41
|
+
* The host element needs a height: the table fills it.
|
|
51
42
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
43
|
+
* @example
|
|
44
|
+
* import "@guiexpert/table/css/main.css";
|
|
45
|
+
* import { EventAdapter, SimpleDomService, TableFactory, TableOptions, TableScope } from "@guiexpert/table";
|
|
46
|
+
*
|
|
47
|
+
* const host = document.querySelector<HTMLDivElement>(".table-div")!; // CSS: .table-div { height: 500px }
|
|
48
|
+
* const tableModel = TableFactory.createTableModel({ rows: orders });
|
|
49
|
+
* const tableScope = new TableScope(host, tableModel, new SimpleDomService(), new TableOptions(), new EventAdapter());
|
|
50
|
+
* tableScope.firstInit();
|
|
51
|
+
* const tableApi = tableScope.getApi();
|
|
52
|
+
*
|
|
53
|
+
* // later: remove the table (route change, new model)
|
|
54
|
+
* tableScope.destroy();
|
|
55
|
+
*
|
|
56
|
+
* @see Training: [Your first table in plain TypeScript](https://gui.expert/training/first-table/)
|
|
57
|
+
*
|
|
58
|
+
* @category Table & API
|
|
54
59
|
*/
|
|
55
60
|
export declare class TableScope extends RenderScope implements OnActionTriggeredIf, EventFocusChangedListenerIf, EventSelectionChangedListenerIf {
|
|
56
61
|
protected readonly eventListener: EventListenerIf;
|
|
@@ -72,6 +77,16 @@ export declare class TableScope extends RenderScope implements OnActionTriggered
|
|
|
72
77
|
protected selectionService: SelectionService;
|
|
73
78
|
protected keyEvent?: GeKeyEvent;
|
|
74
79
|
private api;
|
|
80
|
+
/**
|
|
81
|
+
* The live region of this table: screen readers speak its messages (sorting, filter, copy …).
|
|
82
|
+
* Use {@link TableApi.announce} for own messages.
|
|
83
|
+
* @since 1.1.91
|
|
84
|
+
*/
|
|
85
|
+
readonly liveAnnouncer: LiveAnnouncer;
|
|
86
|
+
/** Delay of the "42 rows" announcement after a filter change (typing in a filter field: one announcement). */
|
|
87
|
+
static filterAnnouncementDelayInMs: number;
|
|
88
|
+
/** firstInit() has finished: announcements are made from now on (not for the initial filter). */
|
|
89
|
+
private initialized;
|
|
75
90
|
private mouseStartAction;
|
|
76
91
|
private mouseStartWidth;
|
|
77
92
|
private mouseStartColumnIndex;
|
|
@@ -83,6 +98,13 @@ export declare class TableScope extends RenderScope implements OnActionTriggered
|
|
|
83
98
|
/** Last comparator passed to `sort()`; re-applied after filtering. Cleared by a header sort. */
|
|
84
99
|
private lastSortCompareFn?;
|
|
85
100
|
constructor(hostElement: HTMLDivElement, tableModel: TableModelIf, domService: DomServiceIf, tableOptions: TableOptionsIf, eventListener: EventListenerIf, copyService?: CopyServiceIf, excelService?: ExcelServiceIf);
|
|
101
|
+
/** Time of the last Tab key press on the page (the host is focused right after it). */
|
|
102
|
+
private lastTabKeyTime;
|
|
103
|
+
/**
|
|
104
|
+
* The host got the keyboard focus (Tab): without a focus cell the first shown cell of the first visible row
|
|
105
|
+
* gets the focus, so screen readers announce a cell (`aria-activedescendant`).
|
|
106
|
+
*/
|
|
107
|
+
private onHostKeyboardFocus;
|
|
86
108
|
/**
|
|
87
109
|
* Creates a TableScope instance.
|
|
88
110
|
*
|
|
@@ -105,6 +127,51 @@ export declare class TableScope extends RenderScope implements OnActionTriggered
|
|
|
105
127
|
* @return {boolean} - Returns true if the action was triggered successfully, false otherwise.
|
|
106
128
|
*/
|
|
107
129
|
onActionTriggered(actionId: ActionId): boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Speaks a message to screen reader users (polite live region, see {@link LiveAnnouncer}).
|
|
132
|
+
*
|
|
133
|
+
* @param {string} text - plain text, e.g. "Orders loaded"
|
|
134
|
+
* @param {number} [delayInMs] - wait before the text is written (default {@link LiveAnnouncer.defaultDelayInMs})
|
|
135
|
+
* @since 1.1.91
|
|
136
|
+
*/
|
|
137
|
+
announce(text: string, delayInMs?: number): void;
|
|
138
|
+
/** "12 cells copied" – the selected cells of the shown columns (without a selection: the focused cell). */
|
|
139
|
+
announceCopied(_text?: string): void;
|
|
140
|
+
/** The number of cells a copy takes: selected cells of shown columns (like CopyService), otherwise 1 (focus). */
|
|
141
|
+
private countCopiedCells;
|
|
142
|
+
/**
|
|
143
|
+
* The header cell with the keyboard focus (arrow up in the first body row moves the focus into the header).
|
|
144
|
+
*
|
|
145
|
+
* @returns {[number, number] | undefined} header row and column index of the cell, `undefined` if the focus is in the body
|
|
146
|
+
* @since 1.1.91
|
|
147
|
+
*/
|
|
148
|
+
getHeaderFocus(): [number, number] | undefined;
|
|
149
|
+
/** Moves the body focus to a cell, scrolls it into view and repaints (also leaves the header). */
|
|
150
|
+
private setFocusCell;
|
|
151
|
+
private getFirstShownColumnIndex;
|
|
152
|
+
private getLastShownColumnIndex;
|
|
153
|
+
/** Home, End, Ctrl+Home, Ctrl+End, Page Up/Down and Enter in the body; `undefined` = not such an action. */
|
|
154
|
+
private onBodyNavigation;
|
|
155
|
+
/** Enter on a body cell: toggles its row checkbox, otherwise expands/collapses its tree row. */
|
|
156
|
+
private activateBodyCell;
|
|
157
|
+
/** Arrow up in the first body row: the focus moves to the lowest header row (same column). */
|
|
158
|
+
private moveFocusIntoHeader;
|
|
159
|
+
/** Focuses a header cell – the origin of a span cell that covers (row, column) – and repaints. */
|
|
160
|
+
private setHeaderFocus;
|
|
161
|
+
/**
|
|
162
|
+
* Keys while a header cell has the focus. Returns `undefined` for actions that work as in the body (copy,
|
|
163
|
+
* select all …) – they leave the header focus as it is.
|
|
164
|
+
*/
|
|
165
|
+
private onHeaderAction;
|
|
166
|
+
/** Enter on a header cell: a group with a toggle opens/closes, a sortable (lowest) header cell sorts. */
|
|
167
|
+
private activateHeaderCell;
|
|
168
|
+
/**
|
|
169
|
+
* Closes the cell editor without changing the model (Escape in the editor).
|
|
170
|
+
*
|
|
171
|
+
* @param {HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement} [editor] - the editor element: its value is reset
|
|
172
|
+
* first, so the blur caused by closing does not commit the typed text ("change" event)
|
|
173
|
+
*/
|
|
174
|
+
cancelEditing(editor?: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement): void;
|
|
108
175
|
updateModelValueAfterEdit(areaIdent: AreaIdent, rowIndex: number, columnIndex: number, value: string): void;
|
|
109
176
|
/**
|
|
110
177
|
* Retrieves the TableApi object.
|
|
@@ -149,6 +216,15 @@ export declare class TableScope extends RenderScope implements OnActionTriggered
|
|
|
149
216
|
* @return {GeMouseEvent} - The created GeMouseEvent object.
|
|
150
217
|
*/
|
|
151
218
|
createGeMouseEvent(mouseEvent: MouseEvent): GeMouseEvent;
|
|
219
|
+
/**
|
|
220
|
+
* The element a mouse event belongs to – usually `evt.target`. The scroll viewport lies above the footer areas (its
|
|
221
|
+
* horizontal scroll bar must stay usable), so a mouse event on a footer cell arrives at the viewport: then the footer
|
|
222
|
+
* element below the mouse pointer is returned (not on the scroll bar itself).
|
|
223
|
+
*
|
|
224
|
+
* @param {MouseEvent} evt - a mouse event on the host element
|
|
225
|
+
* @returns {EventTarget | null} the target element
|
|
226
|
+
*/
|
|
227
|
+
getMouseEventTarget(evt: MouseEvent): EventTarget | null;
|
|
152
228
|
/**
|
|
153
229
|
* Handles the mouse down event.
|
|
154
230
|
*
|
|
@@ -194,6 +270,18 @@ export declare class TableScope extends RenderScope implements OnActionTriggered
|
|
|
194
270
|
* @return {void}
|
|
195
271
|
*/
|
|
196
272
|
toggleExpandCollapseAll(expand?: boolean): void;
|
|
273
|
+
/** The last "expand / collapse all" state – the header icon toggles it. */
|
|
274
|
+
allExpanded: boolean;
|
|
275
|
+
/**
|
|
276
|
+
* Expands or collapses one row of a tree table, repaints, and remembers the state (`autoRestoreOptions`).
|
|
277
|
+
*
|
|
278
|
+
* @param {TreeRowIf<any>} row - a tree row of the body model
|
|
279
|
+
* @param {boolean} expanded - the new state
|
|
280
|
+
* @returns {boolean} false if the body is no tree or the state was already set
|
|
281
|
+
*/
|
|
282
|
+
setTreeRowExpanded(row: TreeRowIf<any>, expanded: boolean): boolean;
|
|
283
|
+
/** Remembers the expanded/collapsed state of a row (autoRestoreOptions.getRowId). */
|
|
284
|
+
private storeTreeRowState;
|
|
197
285
|
/**
|
|
198
286
|
* Toggles the checkbox state of a specific row in a table.
|
|
199
287
|
*
|
|
@@ -213,9 +301,24 @@ export declare class TableScope extends RenderScope implements OnActionTriggered
|
|
|
213
301
|
*/
|
|
214
302
|
onMouseClicked(evt: GeMouseEvent, previousEvt: GeMouseEvent | undefined): boolean;
|
|
215
303
|
debounceRepaint(): void;
|
|
304
|
+
/**
|
|
305
|
+
* Cancels a repaint scheduled by {@link debounceRepaint}.
|
|
306
|
+
*
|
|
307
|
+
* @returns true if a repaint was pending
|
|
308
|
+
*/
|
|
309
|
+
cancelPendingRepaint(): boolean;
|
|
216
310
|
publishGeMouseEvent(evt: GeMouseEvent): void;
|
|
217
311
|
onFocusChanged(sm: FocusModelIf): void;
|
|
218
312
|
onSelectionChanged(sm: SelectionModelIf): void;
|
|
313
|
+
private selectionEventsHeld;
|
|
314
|
+
private heldSelectionModel?;
|
|
315
|
+
/**
|
|
316
|
+
* Runs `fn` and reports all selection changes made in it as ONE `onSelectionChanged` event (a click used to fire
|
|
317
|
+
* up to three: `clear()`, adding the new range and the selection service itself).
|
|
318
|
+
*
|
|
319
|
+
* @param {() => void} fn - code that changes the selection model
|
|
320
|
+
*/
|
|
321
|
+
holdSelectionEvents(fn: () => void): void;
|
|
219
322
|
/**
|
|
220
323
|
* Updates the table (repaint) when an external filter is changed.
|
|
221
324
|
*
|
|
@@ -233,6 +336,16 @@ export declare class TableScope extends RenderScope implements OnActionTriggered
|
|
|
233
336
|
* @return {void}
|
|
234
337
|
*/
|
|
235
338
|
onHeaderDblClicked(event: MouseEvent, _rowIdx: number, colIdx: number): void;
|
|
339
|
+
/**
|
|
340
|
+
* Sorts the body by one column – the same as a double click on its header (header icon, filter and
|
|
341
|
+
* auto-restore included). Without `sortState` the next state of the column's sort order is used
|
|
342
|
+
* (asc → desc → asc …).
|
|
343
|
+
*
|
|
344
|
+
* @param {number | string} column - column index or property, e.g. 10 or "total"
|
|
345
|
+
* @param {SortState} [sortState] - "asc", "desc" or "" (unsorted icon, rows keep their current order)
|
|
346
|
+
* @returns {boolean} false if the column does not exist
|
|
347
|
+
*/
|
|
348
|
+
sortByColumn(column: number | string, sortState?: SortState): boolean;
|
|
236
349
|
/**
|
|
237
350
|
* Scrolls the viewport to the specified pixel coordinates.
|
|
238
351
|
*
|
|
@@ -243,13 +356,26 @@ export declare class TableScope extends RenderScope implements OnActionTriggered
|
|
|
243
356
|
*/
|
|
244
357
|
scrollToPixel(px: number, py: number): void;
|
|
245
358
|
/**
|
|
246
|
-
* Scrolls to the
|
|
359
|
+
* Scrolls to a column and a row: the row becomes the first row of the viewport, the column the first column of the
|
|
360
|
+
* scrollable center area (as far as the scroll range allows).
|
|
247
361
|
*
|
|
248
|
-
*
|
|
249
|
-
*
|
|
362
|
+
* A fixed west column scrolls back to the start (x = 0, like before columns were supported). A fixed east column,
|
|
363
|
+
* `-1` or any other index outside the column range keeps the current horizontal position.
|
|
364
|
+
*
|
|
365
|
+
* @param {number} indexX - The column index (model index over west + center + east), `-1` = keep the horizontal position.
|
|
366
|
+
* @param {number} indexY - The row index of the body.
|
|
250
367
|
* @return {void}
|
|
251
368
|
*/
|
|
252
|
-
scrollToIndex(
|
|
369
|
+
scrollToIndex(indexX: number, indexY: number): void;
|
|
370
|
+
/**
|
|
371
|
+
* The horizontal scroll position (`scrollLeft` of the scroll viewport) that shows a column as the first column of
|
|
372
|
+
* the scrollable center area, clamped to the scroll range.
|
|
373
|
+
* A fixed west column returns 0 (start); fixed east columns and indices outside the columns return the current position.
|
|
374
|
+
*
|
|
375
|
+
* @param {number} columnIndex - model column index (west + center + east)
|
|
376
|
+
* @returns {number} scrollLeft in scroll bar pixels
|
|
377
|
+
*/
|
|
378
|
+
protected getScrollLeftForColumnIndex(columnIndex: number): number;
|
|
253
379
|
adjustAfterScrolling(): void;
|
|
254
380
|
/**
|
|
255
381
|
* Sets the selection model for the table.
|
|
@@ -274,13 +400,20 @@ export declare class TableScope extends RenderScope implements OnActionTriggered
|
|
|
274
400
|
focusModel(): FocusModelIf | undefined;
|
|
275
401
|
setDragging(dragging: boolean): void;
|
|
276
402
|
/**
|
|
277
|
-
* Changes the focus cell using the specified deltas.
|
|
403
|
+
* Changes the focus cell using the specified deltas (keyboard navigation).
|
|
404
|
+
* The new focus stays inside the body (first/last row and column) and the focused row is scrolled into view.
|
|
405
|
+
* `onFocusChanged` is fired by the focus model itself (TableScope listens to it).
|
|
278
406
|
*
|
|
279
407
|
* @param {number} dx - The delta for the column index.
|
|
280
408
|
* @param {number} dy - The delta for the row index.
|
|
281
|
-
* @return {boolean} - True if the focus
|
|
409
|
+
* @return {boolean} - True if the key was handled (a focus model exists and the table is not editing), false otherwise.
|
|
282
410
|
*/
|
|
283
411
|
private changeFocusCell;
|
|
412
|
+
/**
|
|
413
|
+
* The column index `dx` steps from `colIdx`, skipping hidden columns (width 0, e.g. `setColumnVisible(…, false)`).
|
|
414
|
+
* Stays inside the columns; if there is no shown column in that direction, the focus stays where it is.
|
|
415
|
+
*/
|
|
416
|
+
private getNextShownColumnIndex;
|
|
284
417
|
/**
|
|
285
418
|
* Resizes the column based on the mouse event.
|
|
286
419
|
*
|
|
@@ -293,7 +426,6 @@ export declare class TableScope extends RenderScope implements OnActionTriggered
|
|
|
293
426
|
* @return {void}
|
|
294
427
|
*/
|
|
295
428
|
private clearSelectionModel;
|
|
296
|
-
private debugOnce;
|
|
297
429
|
/**
|
|
298
430
|
* Restores the scroll position of the table if auto restore options are enabled.
|
|
299
431
|
*
|
|
@@ -335,6 +467,27 @@ export declare class TableScope extends RenderScope implements OnActionTriggered
|
|
|
335
467
|
*/
|
|
336
468
|
calcAutoColumnWidths(): number[];
|
|
337
469
|
setColumnWidth(columnIndex: number, width: number): void;
|
|
470
|
+
/**
|
|
471
|
+
* Shows or hides a column and repaints (see {@link TableApi.setColumnVisible}).
|
|
472
|
+
*
|
|
473
|
+
* @param {number | string | ColumnDefIf} column - column index, property or column definition
|
|
474
|
+
* @param {boolean} visible - false hides the column
|
|
475
|
+
* @returns {boolean} false if the column has no column definition (or the table model can't hide columns)
|
|
476
|
+
*/
|
|
477
|
+
setColumnVisible(column: number | string | ColumnDefIf, visible: boolean): boolean;
|
|
478
|
+
/**
|
|
479
|
+
* Shows or hides the header and repaints (see {@link TableApi.setHeaderVisible}).
|
|
480
|
+
*
|
|
481
|
+
* @param {boolean} visible - false hides the header
|
|
482
|
+
*/
|
|
483
|
+
setHeaderVisible(visible: boolean): void;
|
|
484
|
+
/**
|
|
485
|
+
* Shows or hides the footer and repaints (see {@link TableApi.setFooterVisible}).
|
|
486
|
+
*
|
|
487
|
+
* @param {boolean} visible - false hides the footer
|
|
488
|
+
*/
|
|
489
|
+
setFooterVisible(visible: boolean): void;
|
|
490
|
+
private setAreaVisible;
|
|
338
491
|
autoResizeColumns(recalcWrappers?: boolean): void;
|
|
339
492
|
recalcWrappers(): void;
|
|
340
493
|
reSort(): void;
|
|
@@ -352,7 +505,7 @@ export declare class TableScope extends RenderScope implements OnActionTriggered
|
|
|
352
505
|
* The method performs the following:
|
|
353
506
|
* 1. Checks if the row is above the current viewport (before first visible row)
|
|
354
507
|
* 2. Checks if the row is below the current viewport (after last visible row)
|
|
355
|
-
* 3. Scrolls to make the row visible if needed
|
|
508
|
+
* 3. Scrolls to make the row visible if needed – vertically only, the horizontal position is kept
|
|
356
509
|
*
|
|
357
510
|
* @param {number} rowIndex - The index of the row to make visible
|
|
358
511
|
* @returns {boolean} Returns true if scrolling was needed and performed, false if the row was already visible
|
|
@@ -361,39 +514,24 @@ export declare class TableScope extends RenderScope implements OnActionTriggered
|
|
|
361
514
|
* // Ensure row 5 is visible in the viewport
|
|
362
515
|
* tableScope.ensureRowIsVisible(5);
|
|
363
516
|
*
|
|
364
|
-
* @example
|
|
365
|
-
* // Example usage in a component
|
|
366
|
-
* class MyTableComponent {
|
|
367
|
-
* private tableScope: TableScope;
|
|
368
|
-
*
|
|
369
|
-
* scrollToSpecificRow(rowIndex: number) {
|
|
370
|
-
* // This will scroll the row into view if it's not visible
|
|
371
|
-
* const didScroll = this.tableScope.ensureRowIsVisible(rowIndex);
|
|
372
|
-
*
|
|
373
|
-
* if (didScroll) {
|
|
374
|
-
* console.log(`Table scrolled to show row ${rowIndex}`);
|
|
375
|
-
* } else {
|
|
376
|
-
* console.log(`Row ${rowIndex} was already visible`);
|
|
377
|
-
* }
|
|
378
|
-
* }
|
|
379
|
-
* }
|
|
380
|
-
*
|
|
381
|
-
* @example
|
|
382
|
-
* // Example with row selection
|
|
383
|
-
* class TableHandler {
|
|
384
|
-
* selectAndShowRow(rowIndex: number) {
|
|
385
|
-
* // First ensure the row is visible
|
|
386
|
-
* this.tableScope.ensureRowIsVisible(rowIndex);
|
|
387
|
-
*
|
|
388
|
-
* // Then perform selection
|
|
389
|
-
* this.selectionModel.selectRow(rowIndex);
|
|
390
|
-
* }
|
|
391
|
-
* }
|
|
392
|
-
*
|
|
393
517
|
* @throws {Error} Implicitly may throw if rowIndex is not a number or if required properties are undefined
|
|
394
518
|
*
|
|
395
519
|
* @see {@link scrollToIndex} - The underlying method used for scrolling
|
|
396
520
|
* @see {@link getDisplayedRowCount} - Related method for getting visible row count
|
|
397
521
|
*/
|
|
398
522
|
ensureRowIsVisible(rowIndex: number): boolean;
|
|
523
|
+
/**
|
|
524
|
+
* Ensures that a column of the scrollable center area is fully visible by scrolling horizontally if necessary –
|
|
525
|
+
* the counterpart of {@link ensureRowIsVisible}. A column left of the viewport becomes the first visible column,
|
|
526
|
+
* a column right of it the last one (a column wider than the viewport: the first). The vertical position is kept.
|
|
527
|
+
*
|
|
528
|
+
* Fixed west/east columns are always visible: nothing to do.
|
|
529
|
+
*
|
|
530
|
+
* @param {number} columnIndex - model column index (west + center + east)
|
|
531
|
+
* @returns {boolean} true if the table was scrolled, false if the column was already visible (or is fixed / hidden / out of range)
|
|
532
|
+
*
|
|
533
|
+
* @example
|
|
534
|
+
* tableScope.ensureColumnIsVisible(12);
|
|
535
|
+
*/
|
|
536
|
+
ensureColumnIsVisible(columnIndex: number): boolean;
|
|
399
537
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guiexpert/table",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.91",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Dr. Marc Kronberg <info@gui.expert> (https://gui.expert)",
|
|
6
6
|
"repository": {
|
|
@@ -23,7 +23,10 @@
|
|
|
23
23
|
},
|
|
24
24
|
"exports": {
|
|
25
25
|
".": {
|
|
26
|
-
"import":
|
|
26
|
+
"import": {
|
|
27
|
+
"types": "./index.d.ts",
|
|
28
|
+
"default": "./index.js"
|
|
29
|
+
},
|
|
27
30
|
"require": "./index.cjs"
|
|
28
31
|
},
|
|
29
32
|
"./css/*": "./css/*",
|
|
@@ -34,7 +37,7 @@
|
|
|
34
37
|
},
|
|
35
38
|
"devDependencies": {
|
|
36
39
|
"@types/node": "^20.11.17",
|
|
37
|
-
"vite": "6.
|
|
40
|
+
"vite": "6.4.4",
|
|
38
41
|
"vite-plugin-dts": "^3.7.2",
|
|
39
42
|
"vite-plugin-eslint": "^1.8.1",
|
|
40
43
|
"vite-plugin-static-copy": "^0.17.0",
|
|
@@ -46,7 +49,12 @@
|
|
|
46
49
|
"typedoc-plugin-rename-defaults": "^0.7.0",
|
|
47
50
|
"typedoc-plugin-markdown": "3.17.1",
|
|
48
51
|
"typescript": "5.2.2",
|
|
49
|
-
"@babel/core": "~7.28.6"
|
|
52
|
+
"@babel/core": "~7.28.6",
|
|
53
|
+
"vitest": "5.0.4",
|
|
54
|
+
"@vitest/browser-playwright": "5.0.4",
|
|
55
|
+
"@vitest/coverage-v8": "5.0.4",
|
|
56
|
+
"axe-core": "4.10.3",
|
|
57
|
+
"playwright": "1.64.0"
|
|
50
58
|
},
|
|
51
59
|
"scripts": {
|
|
52
60
|
"i": "pnpm i",
|
|
@@ -54,10 +62,17 @@
|
|
|
54
62
|
"build": "vite build && npm run concat-css:main && npm run concat-css:dist",
|
|
55
63
|
"concat-css:main": "cat css/table*.css > css/main.css",
|
|
56
64
|
"concat-css:dist": "cat css/table*.css > dist/css/main.css",
|
|
57
|
-
"typedoc:
|
|
58
|
-
"typedoc:
|
|
59
|
-
"typedoc:docs-html
|
|
60
|
-
"typedoc:docs-md": "npx typedoc --plugin typedoc-plugin-markdown --out ../../apps/table-website/src/assets/docsmd
|
|
65
|
+
"typedoc:website": "node scripts/typedoc-website.mjs",
|
|
66
|
+
"typedoc:json": "npx typedoc --json ../../apps/table-website/src/assets/json/doctype.json",
|
|
67
|
+
"typedoc:docs-html": "npx typedoc --out ../../apps/table-website/src/assets/docs",
|
|
68
|
+
"typedoc:docs-md": "npx typedoc --plugin typedoc-plugin-markdown --out ../../apps/table-website/src/assets/docsmd",
|
|
69
|
+
"docs:check": "node scripts/check-doc-examples.mjs",
|
|
70
|
+
"test": "vitest run",
|
|
71
|
+
"test:unit": "vitest run --project unit",
|
|
72
|
+
"test:browser": "vitest run --project browser",
|
|
73
|
+
"test:watch": "vitest --project unit",
|
|
74
|
+
"test:coverage": "vitest run --coverage",
|
|
75
|
+
"test:types": "tsc -p tsconfig.spec.json --noEmit",
|
|
61
76
|
"npm-pub": "pnpm publish --no-git-checks --access public"
|
|
62
77
|
}
|
|
63
78
|
}
|