@guiexpert/table 1.1.90 → 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 +80 -89
- package/index.d.ts +192 -184
- package/index.js +3229 -1580
- 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 +37 -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 +45 -3
- 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 +24 -1
- package/lib/table/service/excel-service.if.d.ts +7 -0
- 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 +296 -550
- package/lib/table/table-scope.d.ts +213 -86
- package/package.json +23 -8
package/lib/table/table-api.d.ts
CHANGED
|
@@ -1,353 +1,73 @@
|
|
|
1
|
-
import { SortState } from './data/common/sort-state.type';
|
|
2
|
-
import { TableScope } from './table-scope';
|
|
3
|
-
import { ColumnDefIf } from './data/tablemodel/column/column-def.if';
|
|
4
|
-
import { TableCellUpdateEventIf } from './data/common/event/input/table-cell-update-event.if';
|
|
5
|
-
import { SelectionModel } from './selection/selection-model';
|
|
6
|
-
import { ActionId } from './action/action-id.type';
|
|
7
|
-
import { ShortcutActionIdMapping } from './action/shortcut-actionid-mapping.type';
|
|
8
|
-
import { SelectionModelIf } from './selection/selection-model.if';
|
|
9
|
-
import { TableModelIf } from './data/tablemodel/table-model.if';
|
|
10
|
-
import { AreaModelIf } from './data/tablemodel/areamodel/area-model.if';
|
|
1
|
+
import { SortState } from './data/common/sort-state.type.js';
|
|
2
|
+
import { TableScope } from './table-scope.js';
|
|
3
|
+
import { ColumnDefIf } from './data/tablemodel/column/column-def.if.js';
|
|
4
|
+
import { TableCellUpdateEventIf } from './data/common/event/input/table-cell-update-event.if.js';
|
|
5
|
+
import { SelectionModel } from './selection/selection-model.js';
|
|
6
|
+
import { ActionId } from './action/action-id.type.js';
|
|
7
|
+
import { ShortcutActionIdMapping } from './action/shortcut-actionid-mapping.type.js';
|
|
8
|
+
import { SelectionModelIf } from './selection/selection-model.if.js';
|
|
9
|
+
import { TableModelIf } from './data/tablemodel/table-model.if.js';
|
|
10
|
+
import { AreaModelIf } from './data/tablemodel/areamodel/area-model.if.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* The
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* api.scrollToIndex(0, 10);
|
|
72
|
-
* api.repaint();
|
|
73
|
-
* ```
|
|
74
|
-
*
|
|
75
|
-
* ### 2. Chaining Operations
|
|
76
|
-
*
|
|
77
|
-
* While the TableApi doesn't support method chaining directly (most methods return void),
|
|
78
|
-
* you can group related operations together:
|
|
79
|
-
*
|
|
80
|
-
* ```typescript
|
|
81
|
-
* // Perform a sequence of related operations
|
|
82
|
-
* function updateTableSection(api, newRows, startIndex) {
|
|
83
|
-
* api.addRowsAt(newRows, startIndex);
|
|
84
|
-
* api.ensureRowIsVisible(startIndex);
|
|
85
|
-
* api.repaint();
|
|
86
|
-
* }
|
|
87
|
-
* ```
|
|
88
|
-
*
|
|
89
|
-
* ### 3. Event-Driven Updates
|
|
90
|
-
*
|
|
91
|
-
* Use the TableApi to respond to external events:
|
|
92
|
-
*
|
|
93
|
-
* ```typescript
|
|
94
|
-
* // Update table in response to user input
|
|
95
|
-
* searchInput.addEventListener('input', (e) => {
|
|
96
|
-
* const searchText = e.target.value;
|
|
97
|
-
* tableOptions.externalFilterFunction = row => row.name.includes(searchText);
|
|
98
|
-
* tableApi.externalFilterChanged();
|
|
99
|
-
* });
|
|
100
|
-
* ```
|
|
101
|
-
*
|
|
102
|
-
* ### 4. Integration with Application State
|
|
103
|
-
*
|
|
104
|
-
* Synchronize table state with application state:
|
|
105
|
-
*
|
|
106
|
-
* ```typescript
|
|
107
|
-
* // In a state management effect or watcher
|
|
108
|
-
* function onAppStateChanged(newState) {
|
|
109
|
-
* if (newState.tableData !== currentTableData) {
|
|
110
|
-
* tableApi.setRows(newState.tableData);
|
|
111
|
-
* tableApi.repaint();
|
|
112
|
-
* currentTableData = newState.tableData;
|
|
113
|
-
* }
|
|
114
|
-
* }
|
|
115
|
-
* ```
|
|
116
|
-
*
|
|
117
|
-
* ## Performance Considerations
|
|
118
|
-
*
|
|
119
|
-
* The TableApi provides methods that are optimized for different performance scenarios:
|
|
120
|
-
*
|
|
121
|
-
* - For frequent small updates: Use `updateCells()` with `repaintAll=false`
|
|
122
|
-
* - For complete data replacement: Use `setRows()`
|
|
123
|
-
* - For structural changes: Follow with `repaintHard()`
|
|
124
|
-
* - For visual-only changes: Use `repaint()`
|
|
125
|
-
*
|
|
126
|
-
* ## Common Use Cases
|
|
127
|
-
*
|
|
128
|
-
* ### Real-time Data Updates
|
|
129
|
-
*
|
|
130
|
-
* ```typescript
|
|
131
|
-
* // Update specific cells with new values from a data stream
|
|
132
|
-
* dataStream.subscribe(update => {
|
|
133
|
-
* const cellUpdates = update.changes.map(change => ({
|
|
134
|
-
* area: 'body',
|
|
135
|
-
* rowIndex: change.rowIndex,
|
|
136
|
-
* columnIndex: change.columnIndex,
|
|
137
|
-
* value: change.newValue,
|
|
138
|
-
* cssClasses: { 'updated': true }
|
|
139
|
-
* }));
|
|
140
|
-
*
|
|
141
|
-
* tableApi.updateCells(cellUpdates);
|
|
142
|
-
* });
|
|
143
|
-
* ```
|
|
144
|
-
*
|
|
145
|
-
* ### Interactive Filtering
|
|
146
|
-
*
|
|
147
|
-
* ```typescript
|
|
148
|
-
* // Set up filter controls
|
|
149
|
-
* function applyFilters(filters) {
|
|
150
|
-
* tableOptions.externalFilterFunction = row => {
|
|
151
|
-
* return Object.entries(filters).every(([key, value]) => {
|
|
152
|
-
* if (!value) return true; // Skip empty filters
|
|
153
|
-
* return row[key].toString().includes(value);
|
|
154
|
-
* });
|
|
155
|
-
* };
|
|
156
|
-
*
|
|
157
|
-
* tableApi.externalFilterChanged();
|
|
158
|
-
* }
|
|
159
|
-
* ```
|
|
160
|
-
*
|
|
161
|
-
* ### Custom Sorting
|
|
162
|
-
*
|
|
163
|
-
* ```typescript
|
|
164
|
-
* // Apply multi-column sorting
|
|
165
|
-
* function sortByMultipleColumns(sortConfig) {
|
|
166
|
-
* tableApi.sort((a, b) => {
|
|
167
|
-
* for (const {column, direction} of sortConfig) {
|
|
168
|
-
* const aValue = a[column];
|
|
169
|
-
* const bValue = b[column];
|
|
170
|
-
* const comparison = compare(aValue, bValue);
|
|
171
|
-
*
|
|
172
|
-
* if (comparison !== 0) {
|
|
173
|
-
* return direction === 'asc' ? comparison : -comparison;
|
|
174
|
-
* }
|
|
175
|
-
* }
|
|
176
|
-
* return 0;
|
|
177
|
-
* });
|
|
178
|
-
* }
|
|
179
|
-
*
|
|
180
|
-
* function compare(a, b) {
|
|
181
|
-
* if (typeof a === 'string' && typeof b === 'string') {
|
|
182
|
-
* return a.localeCompare(b);
|
|
183
|
-
* }
|
|
184
|
-
* return a < b ? -1 : a > b ? 1 : 0;
|
|
185
|
-
* }
|
|
186
|
-
* ```
|
|
187
|
-
*
|
|
188
|
-
* ### Row Management
|
|
189
|
-
*
|
|
190
|
-
* ```typescript
|
|
191
|
-
* // Add, update, and remove rows based on user interactions
|
|
192
|
-
* function onAddRow(newRow) {
|
|
193
|
-
* tableApi.addRows([newRow]);
|
|
194
|
-
* tableApi.ensureRowIsVisible(tableApi.getDisplayedRowCount() - 1);
|
|
195
|
-
* }
|
|
196
|
-
*
|
|
197
|
-
* function onUpdateRow(updatedRow) {
|
|
198
|
-
* tableApi.updateRows([updatedRow], (a, b) => a.id === b.id);
|
|
199
|
-
* }
|
|
200
|
-
*
|
|
201
|
-
* function onDeleteRow(rowToDelete) {
|
|
202
|
-
* tableApi.removeRows([rowToDelete], (a, b) => a.id === b.id);
|
|
203
|
-
* }
|
|
204
|
-
* ```
|
|
205
|
-
*
|
|
206
|
-
* ### Export and Reporting
|
|
207
|
-
*
|
|
208
|
-
* ```typescript
|
|
209
|
-
* // Set up export buttons
|
|
210
|
-
* exportButton.addEventListener('click', () => {
|
|
211
|
-
* tableApi.downloadExcel('report.xlsx', 'Report Generator');
|
|
212
|
-
* });
|
|
213
|
-
*
|
|
214
|
-
* copyButton.addEventListener('click', () => {
|
|
215
|
-
* tableApi.copyToClipboard()
|
|
216
|
-
* .then(() => showNotification('Data copied to clipboard'))
|
|
217
|
-
* .catch(err => showError('Failed to copy data', err));
|
|
218
|
-
* });
|
|
219
|
-
* ```
|
|
220
|
-
*
|
|
221
|
-
* ### Responsive Behavior
|
|
222
|
-
*
|
|
223
|
-
* ```typescript
|
|
224
|
-
* // Handle window resize events
|
|
225
|
-
* window.addEventListener('resize', () => {
|
|
226
|
-
* tableApi.autoResizeColumns();
|
|
227
|
-
* tableApi.repaintHard();
|
|
228
|
-
* });
|
|
229
|
-
* ```
|
|
230
|
-
*
|
|
231
|
-
* ## Integration with Frameworks
|
|
232
|
-
*
|
|
233
|
-
* ### React
|
|
234
|
-
*
|
|
235
|
-
* ```jsx
|
|
236
|
-
* function DataTable({ data, onRowSelect }) {
|
|
237
|
-
* const tableRef = useRef(null);
|
|
238
|
-
*
|
|
239
|
-
* useEffect(() => {
|
|
240
|
-
* if (tableRef.current && tableRef.current.api) {
|
|
241
|
-
* tableRef.current.api.setRows(data);
|
|
242
|
-
* tableRef.current.api.repaint();
|
|
243
|
-
* }
|
|
244
|
-
* }, [data]);
|
|
245
|
-
*
|
|
246
|
-
* return <div ref={tableRef} className="table-container" />;
|
|
247
|
-
* }
|
|
248
|
-
* ```
|
|
249
|
-
*
|
|
250
|
-
* ### Vue
|
|
251
|
-
*
|
|
252
|
-
* ```vue
|
|
253
|
-
* <template>
|
|
254
|
-
* <div ref="tableContainer"></div>
|
|
255
|
-
* </template>
|
|
256
|
-
*
|
|
257
|
-
* <script>
|
|
258
|
-
* export default {
|
|
259
|
-
* props: ['tableData'],
|
|
260
|
-
* watch: {
|
|
261
|
-
* tableData(newData) {
|
|
262
|
-
* if (this.tableApi) {
|
|
263
|
-
* this.tableApi.setRows(newData);
|
|
264
|
-
* this.tableApi.repaint();
|
|
265
|
-
* }
|
|
266
|
-
* }
|
|
267
|
-
* },
|
|
268
|
-
* mounted() {
|
|
269
|
-
* // Initialize table and get API reference
|
|
270
|
-
* this.tableApi = initializeTable(this.$refs.tableContainer).api;
|
|
271
|
-
* }
|
|
272
|
-
* }
|
|
273
|
-
* </script>
|
|
274
|
-
* ```
|
|
275
|
-
*
|
|
276
|
-
* ### Angular
|
|
277
|
-
*
|
|
278
|
-
* ```typescript
|
|
279
|
-
* @Component({
|
|
280
|
-
* selector: 'app-data-table',
|
|
281
|
-
* template: '<div #tableContainer></div>'
|
|
282
|
-
* })
|
|
283
|
-
* export class DataTableComponent implements OnInit, OnChanges {
|
|
284
|
-
* @Input() data: any[];
|
|
285
|
-
* @ViewChild('tableContainer') tableContainer: ElementRef;
|
|
286
|
-
*
|
|
287
|
-
* private tableApi: TableApi;
|
|
288
|
-
*
|
|
289
|
-
* ngOnInit() {
|
|
290
|
-
* this.tableApi = initializeTable(this.tableContainer.nativeElement).api;
|
|
291
|
-
* }
|
|
292
|
-
*
|
|
293
|
-
* ngOnChanges(changes) {
|
|
294
|
-
* if (changes.data && this.tableApi) {
|
|
295
|
-
* this.tableApi.setRows(this.data);
|
|
296
|
-
* this.tableApi.repaint();
|
|
297
|
-
* }
|
|
298
|
-
* }
|
|
299
|
-
* }
|
|
300
|
-
* ```
|
|
301
|
-
*
|
|
302
|
-
* ## Error Handling
|
|
303
|
-
*
|
|
304
|
-
* The TableApi methods generally don't throw exceptions, but instead log warnings to the console
|
|
305
|
-
* when operations cannot be completed (e.g., when trying to use row operations on an incompatible
|
|
306
|
-
* area model type). It's good practice to check console warnings during development.
|
|
307
|
-
*
|
|
308
|
-
* For asynchronous operations like clipboard access, proper error handling should be used:
|
|
309
|
-
*
|
|
310
|
-
* ```typescript
|
|
311
|
-
* tableApi.copyToClipboard()
|
|
312
|
-
* .then(content => {
|
|
313
|
-
* console.log('Copied to clipboard:', content);
|
|
314
|
-
* })
|
|
315
|
-
* .catch(error => {
|
|
316
|
-
* console.error('Failed to copy to clipboard:', error);
|
|
317
|
-
* // Show user-friendly error message
|
|
318
|
-
* });
|
|
319
|
-
* ```
|
|
320
|
-
*
|
|
321
|
-
* ## Debugging
|
|
322
|
-
*
|
|
323
|
-
* For troubleshooting complex table behavior, the logging system can be enabled:
|
|
324
|
-
*
|
|
325
|
-
* ```typescript
|
|
326
|
-
* // Enable detailed logging
|
|
327
|
-
* tableApi.setLoggingActive(true);
|
|
328
|
-
*
|
|
329
|
-
* // Perform operations that need debugging
|
|
330
|
-
* tableApi.updateCells([...]);
|
|
331
|
-
* tableApi.scrollToIndex(5, 10);
|
|
332
|
-
*
|
|
333
|
-
* // Check if logging is active
|
|
334
|
-
* const isLogging = tableApi.isLoggingActive();
|
|
335
|
-
*
|
|
336
|
-
* // Disable logging when done
|
|
337
|
-
* tableApi.setLoggingActive(false);
|
|
338
|
-
* ```
|
|
339
|
-
*
|
|
340
|
-
* ## Advanced Usage
|
|
341
|
-
*
|
|
342
|
-
* For advanced scenarios, you can access the underlying TableScope:
|
|
343
|
-
*
|
|
344
|
-
* ```typescript
|
|
345
|
-
* const tableScope = tableApi.getTableScope();
|
|
346
|
-
* // Now you can access internal implementation details
|
|
347
|
-
* // Note: This is generally not recommended unless absolutely necessary
|
|
348
|
-
* ```
|
|
349
|
-
*
|
|
350
|
-
* @class TableApi
|
|
13
|
+
* The public API of one table – everything you do with a table after it has been created:
|
|
14
|
+
* scrolling, sorting, filtering, selection, copy, Excel export, updating cells and rows, repainting.
|
|
15
|
+
*
|
|
16
|
+
* Every table has exactly one `TableApi`. You never create it yourself – you get it:
|
|
17
|
+
*
|
|
18
|
+
* | Where | How |
|
|
19
|
+
* |---|---|
|
|
20
|
+
* | Plain TypeScript | `new TableScope(host, model, new SimpleDomService(), options, listener).firstInit().getApi()` |
|
|
21
|
+
* | Web Component | `el.addEventListener("tableReady", e => e.detail)` |
|
|
22
|
+
* | React / Preact / Solid | `<GuiexpertTable tableReady={api => …} />` |
|
|
23
|
+
* | Vue 3 | `<GuiexpertTable @tableReady="api => …" />` |
|
|
24
|
+
* | Svelte 5 | `<GuiexpertTable onTableReady={api => …} />` |
|
|
25
|
+
* | Angular | `<guiexpert-table (tableReady)="onReady($event)" />` |
|
|
26
|
+
*
|
|
27
|
+
* ## The most important methods
|
|
28
|
+
*
|
|
29
|
+
* | Task | Methods |
|
|
30
|
+
* |---|---|
|
|
31
|
+
* | scroll | {@link scrollToIndex}, {@link ensureRowIsVisible}, {@link ensureColumnIsVisible}, {@link scrollToPixel}, {@link getFirstVisibleRowIndex} |
|
|
32
|
+
* | sort | {@link sortByColumn}, {@link sort}, {@link reSort} |
|
|
33
|
+
* | filter | {@link externalFilterChanged} (with {@link TableOptionsIf.externalFilterFunction}) |
|
|
34
|
+
* | export | {@link copyToClipboard}, {@link downloadExcel} |
|
|
35
|
+
* | change data | {@link updateCells}, {@link setRows}, {@link addRows}, {@link updateRows}, {@link removeRows} |
|
|
36
|
+
* | redraw | {@link repaint} (same row count), {@link repaintHard} (row count or heights changed) |
|
|
37
|
+
* | columns | {@link autoResizeColumns}, {@link setColumnWidth}, {@link recalcColumnWidths} |
|
|
38
|
+
* | tree | {@link expandAll}, {@link collapseAll}, {@link setRowExpanded} |
|
|
39
|
+
* | lifecycle | {@link destroy} |
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* // plain TypeScript: create a table and talk to it
|
|
43
|
+
* const tableModel = TableFactory.createTableModel({ rows: orders });
|
|
44
|
+
* const tableApi = new TableScope(host, tableModel, new SimpleDomService(), new TableOptions(), new EventAdapter())
|
|
45
|
+
* .firstInit()
|
|
46
|
+
* .getApi();
|
|
47
|
+
*
|
|
48
|
+
* tableApi.scrollToIndex(0, 50_000); // column 0, row 50,000
|
|
49
|
+
* tableApi.sortByColumn("total", "desc"); // like a double-click on the header
|
|
50
|
+
* await tableApi.copyToClipboard(); // the current selection, tab-separated
|
|
51
|
+
* await tableApi.downloadExcel("orders.xlsx"); // the current view as .xlsx
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* // live data: change single cells, only the visible ones are redrawn
|
|
55
|
+
* tableApi.updateCells([
|
|
56
|
+
* new TableCellUpdateEvent("body", 3, 2, 101.5, { "tick-up": true }),
|
|
57
|
+
* new TableCellUpdateEvent("body", 3, 3, 0.42)
|
|
58
|
+
* ]);
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* // replace the rows of an object-array table – the row count changes, so repaint hard
|
|
62
|
+
* tableApi.setRows(newOrders);
|
|
63
|
+
* tableApi.externalFilterChanged(); // only if a filter function is set
|
|
64
|
+
* tableApi.repaintHard();
|
|
65
|
+
*
|
|
66
|
+
* @see Training: [Your first table](https://gui.expert/training/first-table/),
|
|
67
|
+
* [Sorting](https://gui.expert/training/sorting/), [Filtering](https://gui.expert/training/filtering/),
|
|
68
|
+
* [Excel export](https://gui.expert/training/excel-export/), [Live data](https://gui.expert/training/live-data/)
|
|
69
|
+
*
|
|
70
|
+
* @category Table & API
|
|
351
71
|
*/
|
|
352
72
|
export declare class TableApi {
|
|
353
73
|
readonly tableScope: TableScope;
|
|
@@ -496,7 +216,8 @@ export declare class TableApi {
|
|
|
496
216
|
*
|
|
497
217
|
* @example
|
|
498
218
|
* // Scroll only vertically, keeping the current horizontal position
|
|
499
|
-
*
|
|
219
|
+
* // (an omitted or undefined px means 0; for rows use scrollToIndex(-1, rowIndex))
|
|
220
|
+
* tableApi.scrollToPixel(tableApi.getTableScope().scrollViewport.scrollLeft, 300);
|
|
500
221
|
*
|
|
501
222
|
* @example
|
|
502
223
|
* // Example in a component that needs precise scrolling control
|
|
@@ -522,58 +243,6 @@ export declare class TableApi {
|
|
|
522
243
|
* }
|
|
523
244
|
* }
|
|
524
245
|
*
|
|
525
|
-
* @example
|
|
526
|
-
* // Advanced usage with animated scrolling
|
|
527
|
-
* class SmoothScroller {
|
|
528
|
-
* private tableApi: TableApi;
|
|
529
|
-
* private animationFrameId: number | null = null;
|
|
530
|
-
*
|
|
531
|
-
* constructor(tableApi: TableApi) {
|
|
532
|
-
* this.tableApi = tableApi;
|
|
533
|
-
* }
|
|
534
|
-
*
|
|
535
|
-
* smoothScrollTo(targetX: number, targetY: number, duration: number = 500) {
|
|
536
|
-
* // Cancel any ongoing animation
|
|
537
|
-
* if (this.animationFrameId !== null) {
|
|
538
|
-
* cancelAnimationFrame(this.animationFrameId);
|
|
539
|
-
* }
|
|
540
|
-
*
|
|
541
|
-
* const startTime = performance.now();
|
|
542
|
-
* const startX = this.tableApi.getTableScope().getScrollLeft();
|
|
543
|
-
* const startY = this.tableApi.getTableScope().getScrollTop();
|
|
544
|
-
* const distanceX = targetX - startX;
|
|
545
|
-
* const distanceY = targetY - startY;
|
|
546
|
-
*
|
|
547
|
-
* const step = (currentTime: number) => {
|
|
548
|
-
* const elapsed = currentTime - startTime;
|
|
549
|
-
* const progress = Math.min(elapsed / duration, 1);
|
|
550
|
-
*
|
|
551
|
-
* // Use easing function for smooth animation
|
|
552
|
-
* const easeProgress = 1 - Math.pow(1 - progress, 3); // Cubic ease-out
|
|
553
|
-
*
|
|
554
|
-
* const currentX = startX + distanceX * easeProgress;
|
|
555
|
-
* const currentY = startY + distanceY * easeProgress;
|
|
556
|
-
*
|
|
557
|
-
* this.tableApi.scrollToPixel(currentX, currentY);
|
|
558
|
-
*
|
|
559
|
-
* if (progress < 1) {
|
|
560
|
-
* this.animationFrameId = requestAnimationFrame(step);
|
|
561
|
-
* } else {
|
|
562
|
-
* this.animationFrameId = null;
|
|
563
|
-
* }
|
|
564
|
-
* };
|
|
565
|
-
*
|
|
566
|
-
* this.animationFrameId = requestAnimationFrame(step);
|
|
567
|
-
* }
|
|
568
|
-
*
|
|
569
|
-
* cancelAnimation() {
|
|
570
|
-
* if (this.animationFrameId !== null) {
|
|
571
|
-
* cancelAnimationFrame(this.animationFrameId);
|
|
572
|
-
* this.animationFrameId = null;
|
|
573
|
-
* }
|
|
574
|
-
* }
|
|
575
|
-
* }
|
|
576
|
-
*
|
|
577
246
|
* @see {@link scrollToIndex} - For scrolling based on row and column indices
|
|
578
247
|
* @see {@link ensureRowIsVisible} - For scrolling to make a specific row visible
|
|
579
248
|
*/
|
|
@@ -581,112 +250,130 @@ export declare class TableApi {
|
|
|
581
250
|
/**
|
|
582
251
|
* Scrolls the table to display the specified row and column indices at the top-left corner of the viewport.
|
|
583
252
|
*
|
|
584
|
-
*
|
|
585
|
-
*
|
|
253
|
+
* The row becomes the first row of the body, the column the first column of the scrollable (center) part –
|
|
254
|
+
* as far as the scroll range allows: the last columns and rows cannot move further than to the right/bottom edge.
|
|
586
255
|
*
|
|
587
|
-
*
|
|
256
|
+
* Fixed columns (`fixedLeftColumnCount` / `fixedRightColumnCount`) are always visible: a fixed west column scrolls
|
|
257
|
+
* back to the start (x = 0), a fixed east column – and `-1` or any other index outside the columns – keeps the
|
|
258
|
+
* current horizontal position.
|
|
259
|
+
*
|
|
260
|
+
* @param {number} indexX - The column index (model index, fixed columns included) to scroll to.
|
|
261
|
+
* Defaults to 0 (first column). `-1` keeps the horizontal position.
|
|
588
262
|
* @param {number} indexY - The vertical index (row) to scroll to. Defaults to 0 (topmost row).
|
|
589
263
|
* @returns {void}
|
|
590
264
|
*
|
|
591
265
|
* @example
|
|
592
266
|
* // Scroll to the 5th row, keeping the current horizontal scroll position
|
|
593
|
-
* tableApi.scrollToIndex(
|
|
267
|
+
* tableApi.scrollToIndex(-1, 5);
|
|
594
268
|
*
|
|
595
269
|
* @example
|
|
596
270
|
* // Scroll to column 3, row 10
|
|
597
271
|
* tableApi.scrollToIndex(3, 10);
|
|
598
272
|
*
|
|
599
273
|
* @example
|
|
600
|
-
* //
|
|
601
|
-
*
|
|
602
|
-
* private tableApi: TableApi;
|
|
603
|
-
*
|
|
604
|
-
* constructor(tableApi: TableApi) {
|
|
605
|
-
* this.tableApi = tableApi;
|
|
606
|
-
* }
|
|
607
|
-
*
|
|
608
|
-
* goToCell(columnIndex: number, rowIndex: number) {
|
|
609
|
-
* // Navigate directly to the specified cell position
|
|
610
|
-
* this.tableApi.scrollToIndex(columnIndex, rowIndex);
|
|
611
|
-
*
|
|
612
|
-
* // Optional: Select the cell after navigating to it
|
|
613
|
-
* const selectionModel = this.tableApi.getSelectionModel();
|
|
614
|
-
* if (selectionModel) {
|
|
615
|
-
* selectionModel.selectCell(rowIndex, columnIndex);
|
|
616
|
-
* }
|
|
617
|
-
* }
|
|
618
|
-
* }
|
|
619
|
-
*
|
|
620
|
-
* @example
|
|
621
|
-
* // Advanced usage with search functionality
|
|
622
|
-
* class TableSearcher {
|
|
623
|
-
* findAndScrollToMatch(searchTerm: string) {
|
|
624
|
-
* const tableModel = this.tableApi.getTableModel();
|
|
625
|
-
* const bodyModel = tableModel.getAreaModel('body');
|
|
626
|
-
*
|
|
627
|
-
* // Search for the term in the table data
|
|
628
|
-
* for (let row = 0; row < bodyModel.getRowCount(); row++) {
|
|
629
|
-
* for (let col = 0; col < tableModel.getColumnCount(); col++) {
|
|
630
|
-
* const cellContent = bodyModel.getValueAt(row, col)?.toString() || '';
|
|
631
|
-
*
|
|
632
|
-
* if (cellContent.includes(searchTerm)) {
|
|
633
|
-
* // Found a match, scroll to it
|
|
634
|
-
* this.tableApi.scrollToIndex(col, row);
|
|
635
|
-
* return true;
|
|
636
|
-
* }
|
|
637
|
-
* }
|
|
638
|
-
* }
|
|
639
|
-
*
|
|
640
|
-
* return false; // No match found
|
|
641
|
-
* }
|
|
642
|
-
* }
|
|
274
|
+
* // Scroll to column 3, keeping the rows that are currently shown
|
|
275
|
+
* tableApi.scrollToIndex(3, tableApi.getFirstVisibleRowIndex());
|
|
643
276
|
*
|
|
644
277
|
* @see {@link scrollToPixel} - For scrolling to specific pixel coordinates
|
|
645
278
|
* @see {@link ensureRowIsVisible} - For scrolling to make a specific row visible
|
|
646
279
|
*/
|
|
647
280
|
scrollToIndex(indexX?: number, indexY?: number): void;
|
|
648
281
|
/**
|
|
649
|
-
*
|
|
282
|
+
* Shows or hides the header and repaints the table.
|
|
283
|
+
*
|
|
284
|
+
* A hidden header takes no space – the body moves up and shows more rows. The header rows stay in the model
|
|
285
|
+
* (labels, sort icons, header groups), so `setHeaderVisible(true)` brings them back unchanged.
|
|
286
|
+
* Requires a {@link TableModel} (what all factories create).
|
|
650
287
|
*
|
|
651
|
-
* @param
|
|
288
|
+
* @param {boolean} [visible=true] - false hides the header
|
|
289
|
+
* @returns {void}
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
* // a compact view without column headers
|
|
293
|
+
* tableApi.setHeaderVisible(false);
|
|
652
294
|
*
|
|
653
|
-
* @
|
|
295
|
+
* @example
|
|
296
|
+
* // toggle from a button
|
|
297
|
+
* document.querySelector("#toggle-header")!.addEventListener("click", () =>
|
|
298
|
+
* tableApi.setHeaderVisible(!tableApi.isHeaderVisible()));
|
|
654
299
|
*/
|
|
655
|
-
setHeaderVisible(
|
|
300
|
+
setHeaderVisible(visible?: boolean): void;
|
|
656
301
|
/**
|
|
657
|
-
*
|
|
302
|
+
* Shows or hides a column and repaints the table.
|
|
658
303
|
*
|
|
659
|
-
*
|
|
660
|
-
*
|
|
304
|
+
* The column keeps its definition, its position (also when other columns are dragged) and its width:
|
|
305
|
+
* a hidden column is just not rendered (width 0), not copied ({@link copyToClipboard}) and not exported
|
|
306
|
+
* ({@link downloadExcel}). Showing it again restores the previous width. Works for fixed columns, too.
|
|
661
307
|
*
|
|
662
|
-
* @
|
|
308
|
+
* The same as {@link ColumnDefIf.isVisible} – this method sets it to {@link TrueFn} / {@link FalseFn} (an own
|
|
309
|
+
* `isVisible` function of the column is replaced). Columns without a column definition (e.g. `bodyData` +
|
|
310
|
+
* `columnSizes` without `columnDefs`) can't be hidden.
|
|
311
|
+
*
|
|
312
|
+
* @param {number | string | ColumnDefIf} column - column index (fixed columns included), property (e.g. `"category"`)
|
|
313
|
+
* or the column definition
|
|
314
|
+
* @param {boolean} [visible=true] - false hides the column
|
|
315
|
+
* @returns {boolean} false if the column (definition) does not exist
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* // hide a column by property, show it again later
|
|
319
|
+
* tableApi.setColumnVisible("category", false);
|
|
320
|
+
* tableApi.setColumnVisible("category", true);
|
|
321
|
+
*
|
|
322
|
+
* @example
|
|
323
|
+
* // a checkbox list "visible columns"
|
|
324
|
+
* tableApi.getTableModel().getColumnDefs()?.forEach((columnDef, index) => {
|
|
325
|
+
* const checkbox = document.createElement("input");
|
|
326
|
+
* checkbox.type = "checkbox";
|
|
327
|
+
* checkbox.checked = tableApi.isColumnVisible(index);
|
|
328
|
+
* checkbox.addEventListener("change", () => tableApi.setColumnVisible(columnDef, checkbox.checked));
|
|
329
|
+
* document.body.append(checkbox, columnDef.headerLabel);
|
|
330
|
+
* });
|
|
663
331
|
*/
|
|
664
|
-
setColumnVisible(
|
|
332
|
+
setColumnVisible(column: number | string | ColumnDefIf, visible?: boolean): boolean;
|
|
665
333
|
/**
|
|
666
|
-
* Returns whether a column is visible
|
|
334
|
+
* Returns whether a column is visible ({@link ColumnDefIf.isVisible}, see {@link setColumnVisible}).
|
|
335
|
+
* Columns without a column definition are always visible.
|
|
667
336
|
*
|
|
668
|
-
* @param {number | ColumnDefIf}
|
|
669
|
-
* @return {boolean} - True if the column is visible, false
|
|
337
|
+
* @param {number | string | ColumnDefIf} column - column index, property or column definition
|
|
338
|
+
* @return {boolean} - True if the column is visible, false if it is hidden or does not exist.
|
|
339
|
+
*
|
|
340
|
+
* @example
|
|
341
|
+
* if (!tableApi.isColumnVisible("category")) {
|
|
342
|
+
* tableApi.setColumnVisible("category", true);
|
|
343
|
+
* }
|
|
670
344
|
*/
|
|
671
|
-
isColumnVisible(
|
|
345
|
+
isColumnVisible(column: number | string | ColumnDefIf): boolean;
|
|
672
346
|
/**
|
|
673
|
-
* Checks if the header is visible.
|
|
347
|
+
* Checks if the header is visible: it has at least one row and is not hidden with {@link setHeaderVisible}.
|
|
674
348
|
*
|
|
675
349
|
* @return {boolean} - Returns true if the header is visible, otherwise returns false.
|
|
350
|
+
*
|
|
351
|
+
* @example
|
|
352
|
+
* const headerShown = tableApi.isHeaderVisible();
|
|
676
353
|
*/
|
|
677
354
|
isHeaderVisible(): boolean;
|
|
678
355
|
/**
|
|
679
|
-
*
|
|
356
|
+
* Shows or hides the footer and repaints the table.
|
|
680
357
|
*
|
|
681
|
-
*
|
|
358
|
+
* A hidden footer takes no space – the body gets taller. Its rows stay in the model, so `setFooterVisible(true)`
|
|
359
|
+
* brings them back (an own footer model, e.g. totals, is asked for its values again).
|
|
360
|
+
* Requires a {@link TableModel} (what all factories create).
|
|
361
|
+
*
|
|
362
|
+
* @param {boolean} [visible=true] - false hides the footer
|
|
363
|
+
* @returns {void}
|
|
682
364
|
*
|
|
683
|
-
* @
|
|
365
|
+
* @example
|
|
366
|
+
* // show the totals footer only while a filter is active
|
|
367
|
+
* tableApi.setFooterVisible(!!tableOptions.externalFilterFunction);
|
|
684
368
|
*/
|
|
685
|
-
setFooterVisible(
|
|
369
|
+
setFooterVisible(visible?: boolean): void;
|
|
686
370
|
/**
|
|
687
|
-
* Determines if the footer is visible.
|
|
371
|
+
* Determines if the footer is visible: it has at least one row and is not hidden with {@link setFooterVisible}.
|
|
688
372
|
*
|
|
689
373
|
* @returns {boolean} True if the footer is visible, false otherwise.
|
|
374
|
+
*
|
|
375
|
+
* @example
|
|
376
|
+
* const footerShown = tableApi.isFooterVisible();
|
|
690
377
|
*/
|
|
691
378
|
isFooterVisible(): boolean;
|
|
692
379
|
/**
|
|
@@ -708,12 +395,12 @@ export declare class TableApi {
|
|
|
708
395
|
*
|
|
709
396
|
* @example
|
|
710
397
|
* // Update selection and repaint to show the visual change
|
|
711
|
-
* tableApi.getSelectionModel()
|
|
398
|
+
* tableApi.getSelectionModel()?.togglePoint(2, 3);
|
|
712
399
|
* tableApi.repaint();
|
|
713
400
|
*
|
|
714
401
|
* @example
|
|
715
|
-
* // After changing
|
|
716
|
-
*
|
|
402
|
+
* // After changing values in the row objects yourself, repaint to show them
|
|
403
|
+
* orders[0].status = "paid";
|
|
717
404
|
* tableApi.repaint();
|
|
718
405
|
*
|
|
719
406
|
* @returns {void}
|
|
@@ -764,8 +451,9 @@ export declare class TableApi {
|
|
|
764
451
|
* });
|
|
765
452
|
*
|
|
766
453
|
* @example
|
|
767
|
-
* // Example 4: Using after changing
|
|
768
|
-
*
|
|
454
|
+
* // Example 4: Using after changing ColumnDefIf.isVisible yourself
|
|
455
|
+
* // (setColumnVisible() does this on its own)
|
|
456
|
+
* column.isVisible = FalseFn;
|
|
769
457
|
* tableApi.repaintHard();
|
|
770
458
|
*
|
|
771
459
|
* @returns {void} This method doesn't return a value
|
|
@@ -791,20 +479,9 @@ export declare class TableApi {
|
|
|
791
479
|
* the selection is cleared.
|
|
792
480
|
*
|
|
793
481
|
* @example
|
|
794
|
-
* // Clear all selections in the table
|
|
482
|
+
* // Clear all selections in the table (e.g. from a "reset" button)
|
|
795
483
|
* tableApi.clearSelection();
|
|
796
484
|
*
|
|
797
|
-
* // Example usage in a component
|
|
798
|
-
* class MyComponent {
|
|
799
|
-
* @ViewChild('tableComponent') tableComponent: TableComponent;
|
|
800
|
-
*
|
|
801
|
-
* resetTableSelection(): void {
|
|
802
|
-
* if (this.tableComponent?.api) {
|
|
803
|
-
* this.tableComponent.api.clearSelection();
|
|
804
|
-
* }
|
|
805
|
-
* }
|
|
806
|
-
* }
|
|
807
|
-
*
|
|
808
485
|
* @returns {void}
|
|
809
486
|
*/
|
|
810
487
|
clearSelection(): void;
|
|
@@ -886,6 +563,7 @@ export declare class TableApi {
|
|
|
886
563
|
*
|
|
887
564
|
* The copied data is formatted as tab-separated text that can be pasted into spreadsheet
|
|
888
565
|
* applications like Excel or text editors while maintaining the tabular structure.
|
|
566
|
+
* Screen readers hear "12 cells copied" ({@link AriaTextsIf.copied}).
|
|
889
567
|
*
|
|
890
568
|
* @example
|
|
891
569
|
* // Copy the currently selected data to clipboard
|
|
@@ -911,6 +589,38 @@ export declare class TableApi {
|
|
|
911
589
|
* The string contains the tab-separated representation of the selected table data.
|
|
912
590
|
*/
|
|
913
591
|
copyToClipboard(): Promise<string>;
|
|
592
|
+
/**
|
|
593
|
+
* Speaks a message to screen reader users through the live region of the table (`role="status"`,
|
|
594
|
+
* polite – it does not interrupt). The table itself announces sorting, filter results, copying and
|
|
595
|
+
* "select all"; use this for your own events, e.g. after loading or saving data.
|
|
596
|
+
*
|
|
597
|
+
* @example
|
|
598
|
+
* fetch("/api/orders").then(r => r.json()).then(orders => {
|
|
599
|
+
* tableApi.setRows(orders);
|
|
600
|
+
* tableApi.announce(`${orders.length} orders loaded`);
|
|
601
|
+
* });
|
|
602
|
+
*
|
|
603
|
+
* @param {string} text - plain text (not HTML)
|
|
604
|
+
* @since 1.1.91
|
|
605
|
+
* @see Training: [Accessible tables: keyboard and screen readers](https://gui.expert/training/accessibility/)
|
|
606
|
+
*/
|
|
607
|
+
announce(text: string): void;
|
|
608
|
+
/**
|
|
609
|
+
* The header cell that has the keyboard focus. Arrow up in the first body row moves the focus into the header
|
|
610
|
+
* (Enter sorts or opens/closes a header group there); arrow down leaves it. The {@link FocusModelIf} holds
|
|
611
|
+
* the body focus only and is not changed by this.
|
|
612
|
+
*
|
|
613
|
+
* @example
|
|
614
|
+
* const headerFocus = tableApi.getHeaderFocus();
|
|
615
|
+
* if (headerFocus) {
|
|
616
|
+
* const [headerRow, column] = headerFocus;
|
|
617
|
+
* console.log(`header cell ${headerRow}/${column} has the focus`);
|
|
618
|
+
* }
|
|
619
|
+
*
|
|
620
|
+
* @returns {[number, number] | undefined} header row index and column index, `undefined` if the focus is in the body
|
|
621
|
+
* @since 1.1.91
|
|
622
|
+
*/
|
|
623
|
+
getHeaderFocus(): [number, number] | undefined;
|
|
914
624
|
/**
|
|
915
625
|
* Downloads the current table data as an Excel file.
|
|
916
626
|
*
|
|
@@ -940,7 +650,7 @@ export declare class TableApi {
|
|
|
940
650
|
* // Download table data with custom filename only
|
|
941
651
|
* tableApi.downloadExcel('quarterly-data.xlsx');
|
|
942
652
|
*/
|
|
943
|
-
downloadExcel(fileName?: string, author?: string):
|
|
653
|
+
downloadExcel(fileName?: string, author?: string): Promise<void>;
|
|
944
654
|
/**
|
|
945
655
|
* Returns the TableScope instance associated with this TableApi.
|
|
946
656
|
*
|
|
@@ -996,7 +706,7 @@ export declare class TableApi {
|
|
|
996
706
|
*
|
|
997
707
|
* // Add a selection change listener
|
|
998
708
|
* selectionModel?.addEventSelectionChangedListener({
|
|
999
|
-
*
|
|
709
|
+
* onSelectionChanged: () => {
|
|
1000
710
|
* console.log('Selection has changed');
|
|
1001
711
|
* }
|
|
1002
712
|
* });
|
|
@@ -1047,6 +757,10 @@ export declare class TableApi {
|
|
|
1047
757
|
/**
|
|
1048
758
|
* Sets the rows data for the table body, replacing any existing rows.
|
|
1049
759
|
*
|
|
760
|
+
* Only works with an {@link AreaModelObjectArray} body – logs a console warning otherwise.
|
|
761
|
+
* Does **not** repaint and resets filtering and sorting of the body: afterwards call
|
|
762
|
+
* {@link externalFilterChanged} (if a filter function is set) and {@link repaintHard} (the row count changed).
|
|
763
|
+
*
|
|
1050
764
|
* @template T - The type of elements in the rows array
|
|
1051
765
|
* @param {T[]} rows - An array of data objects to set as the table's rows
|
|
1052
766
|
*
|
|
@@ -1055,13 +769,15 @@ export declare class TableApi {
|
|
|
1055
769
|
* It only works with tables that use AreaModelObjectArray as their body model.
|
|
1056
770
|
*
|
|
1057
771
|
* @return {void} - This method doesn't return anything.
|
|
1058
|
-
*
|
|
1059
|
-
* @throws {Warning} Logs a console warning if the table's body model is not an AreaModelObjectArray
|
|
1060
772
|
*/
|
|
1061
773
|
setRows<T>(rows: T[]): void;
|
|
1062
774
|
/**
|
|
1063
775
|
* Adds new rows to the end of the table body.
|
|
1064
776
|
*
|
|
777
|
+
* Only works with an {@link AreaModelObjectArray} body – logs a console warning otherwise.
|
|
778
|
+
* Does **not** repaint and resets filtering and sorting of the body: afterwards call
|
|
779
|
+
* {@link externalFilterChanged} (if a filter function is set) and {@link repaintHard} (the row count changed).
|
|
780
|
+
*
|
|
1065
781
|
* @template T - The type of elements in the rows array
|
|
1066
782
|
* @param {T[]} rows - An array of data objects to append to the table's existing rows
|
|
1067
783
|
*
|
|
@@ -1071,12 +787,20 @@ export declare class TableApi {
|
|
|
1071
787
|
*
|
|
1072
788
|
* @return {void} - This method doesn't return anything.
|
|
1073
789
|
*
|
|
1074
|
-
*
|
|
790
|
+
*
|
|
791
|
+
* @example
|
|
792
|
+
* tableApi.addRows([{ id: 100_001, customer: "New GmbH" }]);
|
|
793
|
+
* tableApi.repaintHard();
|
|
794
|
+
* tableApi.ensureRowIsVisible(tableApi.getDisplayedRowCount() - 1);
|
|
1075
795
|
*/
|
|
1076
796
|
addRows<T>(rows: T[]): void;
|
|
1077
797
|
/**
|
|
1078
798
|
* Inserts new rows at a specific position in the table body.
|
|
1079
799
|
*
|
|
800
|
+
* Only works with an {@link AreaModelObjectArray} body – logs a console warning otherwise.
|
|
801
|
+
* Does **not** repaint and resets filtering and sorting of the body: afterwards call
|
|
802
|
+
* {@link externalFilterChanged} (if a filter function is set) and {@link repaintHard} (the row count changed).
|
|
803
|
+
*
|
|
1080
804
|
* @template T - The type of elements in the rows array
|
|
1081
805
|
* @param {T[]} rows - An array of data objects to insert into the table
|
|
1082
806
|
* @param {number} rowIndex - The index position where the new rows should be inserted
|
|
@@ -1087,13 +811,15 @@ export declare class TableApi {
|
|
|
1087
811
|
* It only works with tables that use AreaModelObjectArray as their body model.
|
|
1088
812
|
*
|
|
1089
813
|
* @return {void} - This method doesn't return anything.
|
|
1090
|
-
*
|
|
1091
|
-
* @throws {Warning} Logs a console warning if the table's body model is not an AreaModelObjectArray
|
|
1092
814
|
*/
|
|
1093
815
|
addRowsAt<T>(rows: T[], rowIndex: number): void;
|
|
1094
816
|
/**
|
|
1095
817
|
* Removes specified rows from the table body.
|
|
1096
818
|
*
|
|
819
|
+
* Only works with an {@link AreaModelObjectArray} body – logs a console warning otherwise.
|
|
820
|
+
* Does **not** repaint and resets filtering and sorting of the body: afterwards call
|
|
821
|
+
* {@link externalFilterChanged} (if a filter function is set) and {@link repaintHard} (the row count changed).
|
|
822
|
+
*
|
|
1097
823
|
* @template T - The type of elements in the rows array
|
|
1098
824
|
* @param {T[]} rows - An array of data objects to remove from the table
|
|
1099
825
|
* @param {(a: T, b: T) => boolean} predicate - A comparison function that determines if two rows match
|
|
@@ -1105,13 +831,13 @@ export declare class TableApi {
|
|
|
1105
831
|
* It only works with tables that use AreaModelObjectArray as their body model.
|
|
1106
832
|
*
|
|
1107
833
|
* @return {void} - This method doesn't return anything.
|
|
1108
|
-
*
|
|
1109
|
-
* @throws {Warning} Logs a console warning if the table's body model is not an AreaModelObjectArray
|
|
1110
834
|
*/
|
|
1111
835
|
removeRows<T>(rows: T[], predicate?: (a: T, b: T) => boolean): void;
|
|
1112
836
|
/**
|
|
1113
837
|
* Searches for and returns rows from the table body that match the given criteria.
|
|
1114
838
|
*
|
|
839
|
+
* Only works with an {@link AreaModelObjectArray} body – logs a console warning otherwise.
|
|
840
|
+
*
|
|
1115
841
|
* @template T - The type of elements in the rows array
|
|
1116
842
|
*
|
|
1117
843
|
* @description
|
|
@@ -1134,13 +860,11 @@ export declare class TableApi {
|
|
|
1134
860
|
*
|
|
1135
861
|
* @example
|
|
1136
862
|
* // Find rows with simple equality comparison
|
|
1137
|
-
* const matchingRows =
|
|
863
|
+
* const matchingRows = tableApi.findRows([orders[0], orders[1]]);
|
|
1138
864
|
*
|
|
1139
865
|
* @example
|
|
1140
866
|
* // Find rows with custom comparison logic
|
|
1141
|
-
* const matchingRows =
|
|
1142
|
-
*
|
|
1143
|
-
* @throws {Warning} Logs a console warning if the table's body model is not an AreaModelObjectArray
|
|
867
|
+
* const matchingRows = tableApi.findRows<Order>([{ ...orders[0] }], (a, b) => a.id === b.id);
|
|
1144
868
|
*/
|
|
1145
869
|
findRows<T>(rows: T[], predicate?: (a: T, b: T) => boolean): T[];
|
|
1146
870
|
/**
|
|
@@ -1180,12 +904,6 @@ export declare class TableApi {
|
|
|
1180
904
|
* (criteria, row) => row.name.toLowerCase().includes(criteria.name!.toLowerCase())
|
|
1181
905
|
* );
|
|
1182
906
|
*
|
|
1183
|
-
* // Find a person within age range
|
|
1184
|
-
* const ageCriteria = { minAge: 25, maxAge: 35 };
|
|
1185
|
-
* const person3 = tableApi.findRowFromFilteredRowsByAllCriteria<Person>(
|
|
1186
|
-
* ageCriteria,
|
|
1187
|
-
* (criteria, row) => row.age >= criteria.minAge! && row.age <= criteria.maxAge!
|
|
1188
|
-
* );
|
|
1189
907
|
* ```
|
|
1190
908
|
*
|
|
1191
909
|
* @throws {Warning} Logs a warning to console if the body model is not an instance of AreaModelObjectArray
|
|
@@ -1222,17 +940,16 @@ export declare class TableApi {
|
|
|
1222
940
|
* // Find a product row with partial match on name
|
|
1223
941
|
* const criteria = { name: "Phone" };
|
|
1224
942
|
* const product = tableApi.findRowFromAllRowsByAllCriteria(criteria,
|
|
1225
|
-
* (criteria, row) => row.name.includes(criteria.name)
|
|
943
|
+
* (criteria, row) => row.name.includes(criteria.name!)
|
|
1226
944
|
* );
|
|
1227
945
|
*
|
|
1228
946
|
* @example
|
|
1229
947
|
* // Find an order with complex matching logic
|
|
1230
|
-
* const criteria = { total: 100, status: "
|
|
1231
|
-
* const order = tableApi.findRowFromAllRowsByAllCriteria(criteria,
|
|
948
|
+
* const criteria = { total: 100, status: "paid" as const };
|
|
949
|
+
* const order = tableApi.findRowFromAllRowsByAllCriteria<Order>(criteria,
|
|
1232
950
|
* (criteria, row) => {
|
|
1233
|
-
* return row.total > criteria.total &&
|
|
1234
|
-
* row.status === criteria.status
|
|
1235
|
-
* row.items.length > 0;
|
|
951
|
+
* return row.total > criteria.total! &&
|
|
952
|
+
* row.status === criteria.status;
|
|
1236
953
|
* }
|
|
1237
954
|
* );
|
|
1238
955
|
*
|
|
@@ -1242,6 +959,9 @@ export declare class TableApi {
|
|
|
1242
959
|
/**
|
|
1243
960
|
* Updates existing rows in the table body with new data.
|
|
1244
961
|
*
|
|
962
|
+
* Only works with an {@link AreaModelObjectArray} body – logs a console warning otherwise.
|
|
963
|
+
* The properties are copied into the existing objects; nothing is repainted – call {@link repaint} afterwards.
|
|
964
|
+
*
|
|
1245
965
|
* @template T - The type of elements in the rows array
|
|
1246
966
|
* @param {T[]} rows - An array of data objects containing the updated values
|
|
1247
967
|
* @param {(a: T, b: T) => boolean} predicate - A comparison function that determines which rows to update
|
|
@@ -1255,8 +975,6 @@ export declare class TableApi {
|
|
|
1255
975
|
* It only works with tables that use AreaModelObjectArray as their body model.
|
|
1256
976
|
*
|
|
1257
977
|
* @return {void} - This method doesn't return anything.
|
|
1258
|
-
*
|
|
1259
|
-
* @throws {Warning} Logs a console warning if the table's body model is not an AreaModelObjectArray
|
|
1260
978
|
*/
|
|
1261
979
|
updateRows<T>(rows: T[], predicate?: (a: T, b: T) => boolean): void;
|
|
1262
980
|
/**
|
|
@@ -1272,16 +990,48 @@ export declare class TableApi {
|
|
|
1272
990
|
*/
|
|
1273
991
|
sortByColumn(column: number | string, sortState?: SortState): boolean;
|
|
1274
992
|
/**
|
|
1275
|
-
* Re-applies the current sorting configuration to the table data.
|
|
993
|
+
* Re-applies the current sorting configuration to the table data and repaints.
|
|
1276
994
|
*
|
|
1277
995
|
* @description
|
|
1278
|
-
*
|
|
1279
|
-
*
|
|
1280
|
-
* the sort columns or direction.
|
|
996
|
+
* The current sorting is the last {@link sort} function, otherwise the columns with a sort state (the header icons,
|
|
997
|
+
* also restored by `autoRestoreOptions`). Useful when the underlying data has changed and needs to be re-sorted
|
|
998
|
+
* without changing the sort columns or direction. (Before 1.1.91 only the sort items stored by `autoRestoreOptions`
|
|
999
|
+
* were used – without them `reSort()` did nothing.)
|
|
1000
|
+
*
|
|
1001
|
+
* @example
|
|
1002
|
+
* orders[0].total = 999_999;
|
|
1003
|
+
* tableApi.reSort();
|
|
1281
1004
|
*
|
|
1282
1005
|
* @return {void} - This method doesn't return anything.
|
|
1283
1006
|
*/
|
|
1284
1007
|
reSort(): void;
|
|
1008
|
+
/**
|
|
1009
|
+
* Tree tables: expands every row on every level (like the "expand all" icon in the header) and repaints.
|
|
1010
|
+
* No effect for other tables.
|
|
1011
|
+
*
|
|
1012
|
+
* @example
|
|
1013
|
+
* document.querySelector("#expand")!.addEventListener("click", () => tableApi.expandAll());
|
|
1014
|
+
*/
|
|
1015
|
+
expandAll(): void;
|
|
1016
|
+
/**
|
|
1017
|
+
* Tree tables: collapses every row on every level and repaints. No effect for other tables.
|
|
1018
|
+
*
|
|
1019
|
+
* @example
|
|
1020
|
+
* tableApi.collapseAll();
|
|
1021
|
+
*/
|
|
1022
|
+
collapseAll(): void;
|
|
1023
|
+
/**
|
|
1024
|
+
* Tree tables: expands or collapses the displayed body row `rowIndex` (like a click on its arrow), repaints and
|
|
1025
|
+
* remembers the state with `autoRestoreOptions`.
|
|
1026
|
+
*
|
|
1027
|
+
* @param {number} rowIndex - index of the displayed body row
|
|
1028
|
+
* @param {boolean} expanded - the new state
|
|
1029
|
+
* @returns {boolean} false if the table is no tree, the row does not exist or already has this state
|
|
1030
|
+
*
|
|
1031
|
+
* @example
|
|
1032
|
+
* tableApi.setRowExpanded(0, true); // expand the first row
|
|
1033
|
+
*/
|
|
1034
|
+
setRowExpanded(rowIndex: number, expanded: boolean): boolean;
|
|
1285
1035
|
/**
|
|
1286
1036
|
* Sorts the table data using a custom comparison function.
|
|
1287
1037
|
*
|
|
@@ -1299,7 +1049,7 @@ export declare class TableApi {
|
|
|
1299
1049
|
*
|
|
1300
1050
|
* @example
|
|
1301
1051
|
* // Sort table rows by a specific property in ascending order
|
|
1302
|
-
*
|
|
1052
|
+
* tableApi.sort((a: Person, b: Person) => {
|
|
1303
1053
|
* if (a.name < b.name) return -1;
|
|
1304
1054
|
* if (a.name > b.name) return 1;
|
|
1305
1055
|
* return 0;
|
|
@@ -1307,24 +1057,29 @@ export declare class TableApi {
|
|
|
1307
1057
|
*
|
|
1308
1058
|
* @example
|
|
1309
1059
|
* // Sort numbers in descending order
|
|
1310
|
-
*
|
|
1060
|
+
* tableApi.sort((a: { value: number }, b: { value: number }) => b.value - a.value);
|
|
1311
1061
|
*
|
|
1312
1062
|
* @example
|
|
1313
1063
|
* // Sort with multiple criteria
|
|
1314
|
-
*
|
|
1064
|
+
* tableApi.sort((a: Order, b: Order) => {
|
|
1315
1065
|
* // First sort by status
|
|
1316
1066
|
* const statusCompare = a.status.localeCompare(b.status);
|
|
1317
1067
|
* if (statusCompare !== 0) return statusCompare;
|
|
1318
1068
|
*
|
|
1319
1069
|
* // Then sort by name if status is equal
|
|
1320
|
-
* return a.
|
|
1070
|
+
* return a.customer.localeCompare(b.customer);
|
|
1321
1071
|
* });
|
|
1322
1072
|
*
|
|
1323
1073
|
* @example
|
|
1324
1074
|
* // Case-insensitive string sorting
|
|
1325
|
-
*
|
|
1075
|
+
* tableApi.sort((a: Person, b: Person) =>
|
|
1326
1076
|
* a.name.toLowerCase().localeCompare(b.name.toLowerCase())
|
|
1327
1077
|
* );
|
|
1078
|
+
*
|
|
1079
|
+
* @example
|
|
1080
|
+
* // Tree tables: the function compares the tree rows of siblings (your objects: a.data / b.data),
|
|
1081
|
+
* // children stay below their parent
|
|
1082
|
+
* tableApi.sort((a: TreeRowIf<OrderNode>, b: TreeRowIf<OrderNode>) => b.data.total - a.data.total);
|
|
1328
1083
|
*/
|
|
1329
1084
|
sort(compareFn: (a: any, b: any) => number): void;
|
|
1330
1085
|
/**
|
|
@@ -1344,41 +1099,32 @@ export declare class TableApi {
|
|
|
1344
1099
|
* // Ensure row 5 is visible in the viewport
|
|
1345
1100
|
* tableApi.ensureRowIsVisible(5);
|
|
1346
1101
|
*
|
|
1347
|
-
* @example
|
|
1348
|
-
* // Example usage in a component
|
|
1349
|
-
* class MyTableComponent {
|
|
1350
|
-
* private tableApi: TableApi;
|
|
1351
|
-
*
|
|
1352
|
-
* scrollToSpecificRow(rowIndex: number) {
|
|
1353
|
-
* // This will scroll the row into view if it's not visible
|
|
1354
|
-
* const didScroll = this.tableApi.ensureRowIsVisible(rowIndex);
|
|
1355
|
-
*
|
|
1356
|
-
* if (didScroll) {
|
|
1357
|
-
* console.log(`Table scrolled to show row ${rowIndex}`);
|
|
1358
|
-
* } else {
|
|
1359
|
-
* console.log(`Row ${rowIndex} was already visible`);
|
|
1360
|
-
* }
|
|
1361
|
-
* }
|
|
1362
|
-
* }
|
|
1363
|
-
*
|
|
1364
|
-
* @example
|
|
1365
|
-
* // Example with row selection
|
|
1366
|
-
* class TableHandler {
|
|
1367
|
-
* selectAndShowRow(rowIndex: number) {
|
|
1368
|
-
* // First ensure the row is visible
|
|
1369
|
-
* this.tableApi.ensureRowIsVisible(rowIndex);
|
|
1370
|
-
*
|
|
1371
|
-
* // Then perform selection
|
|
1372
|
-
* this.selectionModel.selectRow(rowIndex);
|
|
1373
|
-
* }
|
|
1374
|
-
* }
|
|
1375
|
-
*
|
|
1376
1102
|
* @throws {Error} Implicitly may throw if rowIndex is not a number or if required properties are undefined
|
|
1377
1103
|
*
|
|
1378
1104
|
* @see {@link scrollToIndex} - The underlying method used for scrolling
|
|
1379
1105
|
* @see {@link getDisplayedRowCount} - Related method for getting visible row count
|
|
1380
1106
|
*/
|
|
1381
1107
|
ensureRowIsVisible(rowIndex: number): boolean;
|
|
1108
|
+
/**
|
|
1109
|
+
* Ensures that a column is fully visible by scrolling horizontally if necessary – the counterpart of
|
|
1110
|
+
* {@link ensureRowIsVisible}. A column left of the viewport becomes the first visible column, a column right of it
|
|
1111
|
+
* the last one. The vertical position is kept. The arrow keys use it for the focused cell.
|
|
1112
|
+
*
|
|
1113
|
+
* Fixed columns (`fixedLeftColumnCount` / `fixedRightColumnCount`) are always visible, hidden columns
|
|
1114
|
+
* ({@link setColumnVisible}) can't be scrolled to: both return `false`.
|
|
1115
|
+
*
|
|
1116
|
+
* @param {number} columnIndex - The column index (model index over west + center + east)
|
|
1117
|
+
* @returns {boolean} true if the table was scrolled, false if the column was already visible
|
|
1118
|
+
*
|
|
1119
|
+
* @example
|
|
1120
|
+
* // show the column of a search hit (rowIndex/columnIndex from your own search)
|
|
1121
|
+
* const rowIndex = 1200, columnIndex = 14;
|
|
1122
|
+
* tableApi.ensureColumnIsVisible(columnIndex);
|
|
1123
|
+
* tableApi.ensureRowIsVisible(rowIndex);
|
|
1124
|
+
*
|
|
1125
|
+
* @see {@link scrollToIndex} - scrolls a column and row to the top left
|
|
1126
|
+
*/
|
|
1127
|
+
ensureColumnIsVisible(columnIndex: number): boolean;
|
|
1382
1128
|
/**
|
|
1383
1129
|
* Retrieves the number of rows currently displayed in the table.
|
|
1384
1130
|
*
|
|
@@ -1438,7 +1184,7 @@ export declare class TableApi {
|
|
|
1438
1184
|
* const firstFullVisibleRow = tableApi.getFirstFullVisibleRowIndex();
|
|
1439
1185
|
*
|
|
1440
1186
|
* // Check if a specific row is fully visible
|
|
1441
|
-
* const isRowFullyVisible = (rowIndex) => {
|
|
1187
|
+
* const isRowFullyVisible = (rowIndex: number) => {
|
|
1442
1188
|
* const firstFullVisible = tableApi.getFirstFullVisibleRowIndex();
|
|
1443
1189
|
* const lastFullVisible = tableApi.getLastFullVisibleRowIndex();
|
|
1444
1190
|
* return rowIndex >= firstFullVisible && rowIndex <= lastFullVisible;
|