@guiexpert/table 1.1.90 → 1.1.92
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 +8 -2
- package/css/main.css +129 -4
- package/css/table-classes.css +93 -0
- package/css/table-color-classes.css +3 -1
- package/css/table-color-vars.css +20 -2
- package/css/table-tree.css +13 -1
- package/index.cjs +111 -96
- package/index.d.ts +203 -184
- package/index.js +4927 -2096
- 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 +62 -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 +72 -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/ge-state-change-event.d.ts +30 -0
- 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 +44 -1
- package/lib/table/data/options/auto-restore-options.if.d.ts +95 -45
- 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/default-row-id.d.ts +4 -0
- 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/overlay-options.d.ts +30 -0
- package/lib/table/data/options/overlay-options.if.d.ts +79 -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 +40 -13
- package/lib/table/data/options/table-options.if.d.ts +152 -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 +13 -4
- package/lib/table/data/tablemodel/areamodel/area-model-cell-groups.d.ts +44 -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 +48 -31
- package/lib/table/data/tablemodel/areamodel/area-model-tree.d.ts +162 -11
- package/lib/table/data/tablemodel/areamodel/area-model.d.ts +66 -104
- package/lib/table/data/tablemodel/areamodel/area-model.if.d.ts +75 -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 +17 -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 +4 -1
- package/lib/table/data/tablemodel/cellgroup/cell-group.if.d.ts +34 -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 +11 -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 +53 -5
- package/lib/table/event-adapter.d.ts +20 -10
- package/lib/table/event-checkbox-changed-handler.d.ts +2 -1
- package/lib/table/event-listener.if.d.ts +50 -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 +20 -9
- package/lib/table/overlay/calc-overlay-kind.d.ts +31 -0
- package/lib/table/overlay/ge-overlay-kind.type.d.ts +17 -0
- package/lib/table/overlay/table-overlay.d.ts +108 -0
- package/lib/table/render-scope.d.ts +141 -27
- 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 +37 -14
- 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/state/state-storage.if.d.ts +39 -0
- package/lib/table/state/table-state-migration.d.ts +36 -0
- package/lib/table/state/table-state-part.d.ts +13 -0
- package/lib/table/state/table-state.if.d.ts +181 -0
- package/lib/table/state/table-state.service.d.ts +158 -0
- package/lib/table/table-api.d.ts +450 -550
- package/lib/table/table-scope.d.ts +288 -114
- package/package.json +23 -8
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { CellRendererIf } from '../../../renderer/cell-render.if';
|
|
2
|
-
import { CheckedType } from '../../common/checked-type';
|
|
3
|
-
import { CheckboxModelIf } from '../../../checkbox/checkbox-model.if';
|
|
4
|
-
import { FilterFunction } from '../../common/filter-function';
|
|
5
|
-
import { SortItem } from '../../common/sort-item';
|
|
6
|
-
import { AreaIdent } from '../area-ident.type';
|
|
1
|
+
import { CellRendererIf } from '../../../renderer/cell-render.if.js';
|
|
2
|
+
import { CheckedType } from '../../common/checked-type.js';
|
|
3
|
+
import { CheckboxModelIf } from '../../../checkbox/checkbox-model.if.js';
|
|
4
|
+
import { FilterFunction } from '../../common/filter-function.js';
|
|
5
|
+
import { SortItem } from '../../common/sort-item.js';
|
|
6
|
+
import { AreaIdent } from '../area-ident.type.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @interface AreaModelIf
|
|
@@ -57,7 +57,7 @@ import { AreaIdent } from '../area-ident.type';
|
|
|
57
57
|
* [2, "Jane", 25],
|
|
58
58
|
* [3, "Bob", 40]
|
|
59
59
|
* ];
|
|
60
|
-
* const footerData = [["", "Average", 31.67]];
|
|
60
|
+
* const footerData = [["", "Average", "31.67"]];
|
|
61
61
|
*
|
|
62
62
|
* // Create the table model with all three areas
|
|
63
63
|
* const tableModel: TableModelIf = TableFactory.createTableModel({
|
|
@@ -88,9 +88,9 @@ import { AreaIdent } from '../area-ident.type';
|
|
|
88
88
|
*
|
|
89
89
|
* // Define column definitions
|
|
90
90
|
* const columnDefs: ColumnDefIf[] = [
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
91
|
+
* new ColumnDef('id', 'ID', new Size(80, 'px')),
|
|
92
|
+
* new ColumnDef('name', 'Name', new Size(150, 'px')),
|
|
93
|
+
* new ColumnDef('age', 'Age', new Size(80, 'px'))
|
|
94
94
|
* ];
|
|
95
95
|
*
|
|
96
96
|
* // Create the table model
|
|
@@ -109,35 +109,36 @@ import { AreaIdent } from '../area-ident.type';
|
|
|
109
109
|
* // Example of implementing a custom AreaModelIf
|
|
110
110
|
* import { AreaModelIf, AreaIdent, CellRendererIf } from "@guiexpert/table";
|
|
111
111
|
*
|
|
112
|
-
* class CustomAreaModel
|
|
112
|
+
* class CustomAreaModel extends AreaModel {
|
|
113
113
|
* constructor(
|
|
114
|
-
*
|
|
115
|
-
* private data: any[][],
|
|
116
|
-
* private
|
|
117
|
-
* ) {
|
|
114
|
+
* areaIdent: AreaIdent,
|
|
115
|
+
* private readonly data: any[][],
|
|
116
|
+
* private readonly rowHeight: number = 30
|
|
117
|
+
* ) {
|
|
118
|
+
* super();
|
|
119
|
+
* this.areaIdent = areaIdent;
|
|
120
|
+
* }
|
|
118
121
|
*
|
|
119
|
-
* getRowCount(): number {
|
|
122
|
+
* override getRowCount(): number {
|
|
120
123
|
* return this.data.length;
|
|
121
124
|
* }
|
|
122
125
|
*
|
|
123
|
-
* getValueAt(rowIndex: number, columnIndex: number): any {
|
|
124
|
-
*
|
|
125
|
-
* const row = this.data[rowIndex];
|
|
126
|
-
* if (columnIndex < 0 || columnIndex >= row.length) return undefined;
|
|
127
|
-
* return row[columnIndex];
|
|
126
|
+
* override getValueAt(rowIndex: number, columnIndex: number): any {
|
|
127
|
+
* return this.data[rowIndex]?.[columnIndex];
|
|
128
128
|
* }
|
|
129
129
|
*
|
|
130
|
-
* getRowHeight(
|
|
131
|
-
* return this.
|
|
130
|
+
* override getRowHeight(_rowIndex: number): number {
|
|
131
|
+
* return this.rowHeight;
|
|
132
132
|
* }
|
|
133
|
-
*
|
|
134
|
-
* // Implement other required methods...
|
|
133
|
+
* // AreaModel has defaults for all other methods
|
|
135
134
|
* }
|
|
136
135
|
*
|
|
137
136
|
* @see {@link TableModelIf} - The parent interface that contains area models
|
|
138
137
|
* @see {@link AreaModel} - A base implementation of this interface
|
|
139
138
|
* @see {@link AbstractAreaModel} - An abstract implementation with common functionality
|
|
140
139
|
* @see {@link AreaModelObjectArray} - An implementation for object array data
|
|
140
|
+
*
|
|
141
|
+
* @category Area models
|
|
141
142
|
*/
|
|
142
143
|
export interface AreaModelIf {
|
|
143
144
|
/**
|
|
@@ -148,7 +149,8 @@ export interface AreaModelIf {
|
|
|
148
149
|
*
|
|
149
150
|
* @example
|
|
150
151
|
* // Creating an area model for the header
|
|
151
|
-
* const headerModel = new AreaModel(
|
|
152
|
+
* const headerModel = new AreaModel();
|
|
153
|
+
* headerModel.areaIdent = "header";
|
|
152
154
|
*
|
|
153
155
|
* @example
|
|
154
156
|
* // Checking which area a model represents
|
|
@@ -167,7 +169,8 @@ export interface AreaModelIf {
|
|
|
167
169
|
* // Creating a checkbox model for row selection
|
|
168
170
|
* import { CheckboxModel } from "@guiexpert/table";
|
|
169
171
|
*
|
|
170
|
-
* const bodyModel = new AreaModel(
|
|
172
|
+
* const bodyModel = new AreaModel();
|
|
173
|
+
* bodyModel.areaIdent = "body";
|
|
171
174
|
* bodyModel.rowSelectionModel = new CheckboxModel();
|
|
172
175
|
*
|
|
173
176
|
* // Later, check if a row is selected
|
|
@@ -258,6 +261,25 @@ export interface AreaModelIf {
|
|
|
258
261
|
* }
|
|
259
262
|
*/
|
|
260
263
|
getRowCount(): number;
|
|
264
|
+
/**
|
|
265
|
+
* The number of rows the area would show **without** the external filter. Optional: the table uses it to tell
|
|
266
|
+
* "No rows to show" (no rows at all) from "No matching rows" (the filter hides all rows) – see
|
|
267
|
+
* {@link OverlayOptionsIf}. Models without it always get "No rows to show".
|
|
268
|
+
*
|
|
269
|
+
* @returns {number} e.g. all rows of an object array; for a tree the displayed rows before filtering
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
* class OrdersBodyModel extends AreaModel {
|
|
273
|
+
* private all: string[][] = [];
|
|
274
|
+
* private shown: string[][] = [];
|
|
275
|
+
* override getRowCount(): number { return this.shown.length; }
|
|
276
|
+
* getUnfilteredRowCount(): number { return this.all.length; }
|
|
277
|
+
* override getValueAt(rowIndex: number, columnIndex: number): any { return this.shown[rowIndex]?.[columnIndex]; }
|
|
278
|
+
* }
|
|
279
|
+
*
|
|
280
|
+
* @since 1.1.92
|
|
281
|
+
*/
|
|
282
|
+
getUnfilteredRowCount?(): number;
|
|
261
283
|
/**
|
|
262
284
|
* Returns the value of the cell at the specified row and column indices.
|
|
263
285
|
* This is one of the most important methods in the area model, as it provides
|
|
@@ -673,7 +695,8 @@ export interface AreaModelIf {
|
|
|
673
695
|
isEditable(rowIndex: number, columnIndex: number): boolean;
|
|
674
696
|
/**
|
|
675
697
|
* Determines whether the cell at the specified row and column indices is selectable.
|
|
676
|
-
* If true, the user can select the cell.
|
|
698
|
+
* If true, the user can select the cell: the table draws the selection only on selectable body cells.
|
|
699
|
+
* All built-in models and {@link AreaModel} return `true` (except the hidden and cover-grid models).
|
|
677
700
|
*
|
|
678
701
|
* @param {number} rowIndex - The index of the row
|
|
679
702
|
* @param {number} columnIndex - The index of the column
|
|
@@ -733,9 +756,9 @@ export interface AreaModelIf {
|
|
|
733
756
|
* @example
|
|
734
757
|
* // Check if a row is checked
|
|
735
758
|
* const checkedState = bodyAreaModel.isRowChecked(1);
|
|
736
|
-
* if (checkedState ===
|
|
759
|
+
* if (checkedState === "full") {
|
|
737
760
|
* console.log('This row is checked');
|
|
738
|
-
* } else if (checkedState ===
|
|
761
|
+
* } else if (checkedState === "semi") {
|
|
739
762
|
* console.log('This row is partially checked');
|
|
740
763
|
* }
|
|
741
764
|
*
|
|
@@ -836,27 +859,29 @@ export interface AreaModelIf {
|
|
|
836
859
|
* ]);
|
|
837
860
|
*
|
|
838
861
|
* @example
|
|
839
|
-
* // Implementation example
|
|
840
|
-
*
|
|
841
|
-
*
|
|
842
|
-
*
|
|
843
|
-
* // Apply sorting to the rows
|
|
844
|
-
* for (const sortItem of sortItems) {
|
|
845
|
-
* const { columnIndex, sortState } = sortItem;
|
|
846
|
-
* const property = this.columnDefs[columnIndex].property;
|
|
847
|
-
* const direction = sortState === 'asc' ? 1 : -1;
|
|
848
|
-
*
|
|
849
|
-
* this.rows.sort((a, b) => {
|
|
850
|
-
* const valueA = a[property];
|
|
851
|
-
* const valueB = b[property];
|
|
852
|
-
*
|
|
853
|
-
* if (valueA < valueB) return -1 * direction;
|
|
854
|
-
* if (valueA > valueB) return 1 * direction;
|
|
855
|
-
* return 0;
|
|
856
|
-
* });
|
|
857
|
-
* }
|
|
862
|
+
* // Implementation example: a body model that sorts its own rows
|
|
863
|
+
* class MyBodyModel extends AreaModelObjectArray<any> {
|
|
864
|
+
* override doSort(sortItems: SortItem[]): boolean {
|
|
865
|
+
* if (!sortItems.length) return false;
|
|
858
866
|
*
|
|
859
|
-
*
|
|
867
|
+
* // Apply sorting to the rows
|
|
868
|
+
* for (const sortItem of sortItems) {
|
|
869
|
+
* const { columnIndex, sortState } = sortItem;
|
|
870
|
+
* const property = this.columnDefs[columnIndex].property;
|
|
871
|
+
* const direction = sortState === 'asc' ? 1 : -1;
|
|
872
|
+
*
|
|
873
|
+
* this.rows.sort((a, b) => {
|
|
874
|
+
* const valueA = a[property];
|
|
875
|
+
* const valueB = b[property];
|
|
876
|
+
*
|
|
877
|
+
* if (valueA < valueB) return -1 * direction;
|
|
878
|
+
* if (valueA > valueB) return 1 * direction;
|
|
879
|
+
* return 0;
|
|
880
|
+
* });
|
|
881
|
+
* }
|
|
882
|
+
*
|
|
883
|
+
* return true;
|
|
884
|
+
* }
|
|
860
885
|
* }
|
|
861
886
|
*/
|
|
862
887
|
doSort(sortItems: SortItem[]): boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AbstractAreaModel } from './abstract-area-model';
|
|
2
|
-
import { ColumnDefIf } from '../column/column-def.if';
|
|
3
|
-
import { FilterFunction } from '../../common/filter-function';
|
|
4
|
-
import { SorterService } from '../../../service/sorter.service';
|
|
5
|
-
import { SortItem } from '../../common/sort-item';
|
|
1
|
+
import { AbstractAreaModel } from './abstract-area-model.js';
|
|
2
|
+
import { ColumnDefIf } from '../column/column-def.if.js';
|
|
3
|
+
import { FilterFunction } from '../../common/filter-function.js';
|
|
4
|
+
import { SorterService } from '../../../service/sorter.service.js';
|
|
5
|
+
import { SortItem } from '../../common/sort-item.js';
|
|
6
6
|
|
|
7
7
|
export declare class AsyncBodyAreaModelObjectArray<T> extends AbstractAreaModel<T> {
|
|
8
8
|
protected readonly maxRowCount: number;
|
|
@@ -1,16 +1,27 @@
|
|
|
1
|
-
import { CellRange } from '../../common/cell-range';
|
|
2
|
-
import { AreaModelIf } from './area-model.if';
|
|
3
|
-
import { TableModelIf } from '../table-model.if';
|
|
1
|
+
import { CellRange } from '../../common/cell-range.js';
|
|
2
|
+
import { AreaModelIf } from './area-model.if.js';
|
|
3
|
+
import { TableModelIf } from '../table-model.if.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Represents a model for handling colspan and rowspan in a table.
|
|
7
|
+
*
|
|
8
|
+
* @category Area models
|
|
7
9
|
*/
|
|
8
10
|
export declare class ColAndRowspanModel {
|
|
9
11
|
protected tableModel: TableModelIf;
|
|
10
12
|
protected areaModel: AreaModelIf;
|
|
11
13
|
protected colAndRowspanRanges: CellRange[] | undefined;
|
|
12
14
|
constructor(tableModel: TableModelIf, areaModel: AreaModelIf);
|
|
15
|
+
/** Row count of the area model at the last {@link init} (−1: not initialized yet). */
|
|
16
|
+
protected rowCountAtInit: number;
|
|
13
17
|
init(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Builds the ranges again if the row count of the area model changed since the last {@link init} – e.g. after
|
|
20
|
+
* `setRows()` or a filter (the old ranges could point to rows that no longer exist). Cheap otherwise.
|
|
21
|
+
*
|
|
22
|
+
* @returns {boolean} true if the ranges were rebuilt
|
|
23
|
+
*/
|
|
24
|
+
initIfRowCountChanged(): boolean;
|
|
14
25
|
getRanges(): CellRange[];
|
|
15
26
|
isInRange(rowIndex: number, columnIndex: number): boolean;
|
|
16
27
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { AreaModelIf } from './area-model.if';
|
|
2
|
-
import { CellRendererIf } from '../../../renderer/cell-render.if';
|
|
3
|
-
import { CheckedType } from '../../common/checked-type';
|
|
4
|
-
import { CheckboxModelIf } from '../../../checkbox/checkbox-model.if';
|
|
5
|
-
import { FilterFunction } from '../../common/filter-function';
|
|
6
|
-
import { SortItem } from '../../common/sort-item';
|
|
7
|
-
import { AreaIdent } from '../area-ident.type';
|
|
8
|
-
import { SorterService } from '../../../service/sorter.service';
|
|
1
|
+
import { AreaModelIf } from './area-model.if.js';
|
|
2
|
+
import { CellRendererIf } from '../../../renderer/cell-render.if.js';
|
|
3
|
+
import { CheckedType } from '../../common/checked-type.js';
|
|
4
|
+
import { CheckboxModelIf } from '../../../checkbox/checkbox-model.if.js';
|
|
5
|
+
import { FilterFunction } from '../../common/filter-function.js';
|
|
6
|
+
import { SortItem } from '../../common/sort-item.js';
|
|
7
|
+
import { AreaIdent } from '../area-ident.type.js';
|
|
8
|
+
import { SorterService } from '../../../service/sorter.service.js';
|
|
9
9
|
|
|
10
|
+
/** @category Area models */
|
|
10
11
|
export declare class CoverGridBodyModel<T> implements AreaModelIf {
|
|
11
12
|
items: T[];
|
|
12
13
|
cellRenderer: CellRendererIf;
|
|
@@ -17,10 +18,18 @@ export declare class CoverGridBodyModel<T> implements AreaModelIf {
|
|
|
17
18
|
rowSelectionModel: CheckboxModelIf<any> | undefined;
|
|
18
19
|
areaIdent: AreaIdent;
|
|
19
20
|
filteredItems: T[];
|
|
21
|
+
/** @internal */
|
|
20
22
|
protected sorterService: SorterService;
|
|
21
23
|
constructor(items: T[], cellRenderer: CellRendererIf, coverWidth?: number, coverHeight?: number, width?: number, firstRowPaddingTop?: number);
|
|
22
24
|
setParentWidth(widthInPixel: number): void;
|
|
23
25
|
getRowCount(): number;
|
|
26
|
+
/**
|
|
27
|
+
* The number of grid rows without the external filter (`0` without items).
|
|
28
|
+
*
|
|
29
|
+
* @returns {number} grid rows for all items
|
|
30
|
+
* @since 1.1.92
|
|
31
|
+
*/
|
|
32
|
+
getUnfilteredRowCount(): number;
|
|
24
33
|
getColumnCount(): number;
|
|
25
34
|
getValueAt(rowIndex: number, columnIndex: number): T | undefined;
|
|
26
35
|
getTextValueAt(_rowIndex: number, _columnIndex: number): string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { CellGroupIf } from './cell-group.if';
|
|
2
|
-
import { CellGroup } from './cell-group';
|
|
1
|
+
import { CellGroupIf } from './cell-group.if.js';
|
|
2
|
+
import { CellGroup } from './cell-group.js';
|
|
3
3
|
|
|
4
|
+
/** @category Header groups */
|
|
4
5
|
export declare class CellGroupExt extends CellGroup {
|
|
5
6
|
rowIndex: number;
|
|
6
7
|
childIndex: number;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { CellGroupIf } from './cell-group.if';
|
|
1
|
+
import { CellGroupIf } from './cell-group.if.js';
|
|
2
2
|
|
|
3
|
+
/** @category Header groups */
|
|
3
4
|
export declare class CellGroup implements CellGroupIf {
|
|
4
5
|
data: any;
|
|
5
6
|
property?: string | undefined;
|
|
@@ -8,5 +9,7 @@ export declare class CellGroup implements CellGroupIf {
|
|
|
8
9
|
visibility: "always" | "inverted" | "normal" | undefined;
|
|
9
10
|
children: CellGroupIf[] | undefined;
|
|
10
11
|
impl: string;
|
|
12
|
+
/** See {@link CellGroupIf.id}. @since 1.1.92 */
|
|
13
|
+
id?: string;
|
|
11
14
|
constructor(data: any, property?: string | undefined, toggle?: boolean | undefined, closed?: boolean, visibility?: "always" | "inverted" | "normal" | undefined, children?: CellGroupIf[] | undefined);
|
|
12
15
|
}
|
|
@@ -1,9 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One node of a grouped header ({@link AreaModelCellGroups}): a group with `children`, or a leaf with a `property`
|
|
3
|
+
* (a leaf becomes a column).
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* const groups: CellGroupIf[] = [
|
|
7
|
+
* { data: "Order", children: [{ data: "ID", property: "id" }, { data: "Date", property: "date" }] },
|
|
8
|
+
* { data: "Customer", toggle: true, children: [
|
|
9
|
+
* { data: "Customer", property: "customer", visibility: "always" }, // stays visible when collapsed
|
|
10
|
+
* { data: "City", property: "city" }] }
|
|
11
|
+
* ];
|
|
12
|
+
* const columnDefs = CellgroupFactory.buildColumnDefs(CellgroupFactory.buildGroupExts(groups));
|
|
13
|
+
* const header = new AreaModelCellGroups("header", groups, columnDefs, 34);
|
|
14
|
+
*
|
|
15
|
+
* @see Training: [Header models: multi-row and grouped](https://gui.expert/training/header-groups/)
|
|
16
|
+
*
|
|
17
|
+
* @category Header groups
|
|
18
|
+
*/
|
|
1
19
|
export interface CellGroupIf {
|
|
20
|
+
/**
|
|
21
|
+
* A stable id of the group, used to remember whether it is collapsed ({@link TableHeaderGroupStateIf},
|
|
22
|
+
* {@link TableApi.setHeaderGroupCollapsed}). Default: the path of the labels, e.g. `"Customer"` or `"2026/Q1"`.
|
|
23
|
+
* @since 1.1.92
|
|
24
|
+
*/
|
|
25
|
+
id?: string;
|
|
26
|
+
/** The label of the group or column. */
|
|
2
27
|
data: any;
|
|
28
|
+
/** Set on leaves only: the property shown in this column. */
|
|
3
29
|
property?: string;
|
|
30
|
+
/** Show a ❯ toggle so that the user can collapse / expand the group. */
|
|
4
31
|
toggle?: boolean;
|
|
32
|
+
/** Current state: collapsed. */
|
|
5
33
|
closed?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* When is this child visible? `"always"` – also when the group is collapsed; `"inverted"` – only when collapsed
|
|
36
|
+
* (e.g. a summary column); `"normal"` / undefined – only when expanded.
|
|
37
|
+
*/
|
|
6
38
|
visibility?: "always" | "inverted" | "normal" | undefined;
|
|
39
|
+
/** Sub-groups or columns. */
|
|
7
40
|
children?: CellGroupIf[] | undefined;
|
|
41
|
+
/** Internal: the implementation type of the node. */
|
|
8
42
|
impl?: string;
|
|
9
43
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { CellGroupIf } from './cell-group.if';
|
|
2
|
-
import { ColumnDefIf } from '../column/column-def.if';
|
|
3
|
-
import { CellGroupExt } from './cell-group-ext';
|
|
1
|
+
import { CellGroupIf } from './cell-group.if.js';
|
|
2
|
+
import { ColumnDefIf } from '../column/column-def.if.js';
|
|
3
|
+
import { CellGroupExt } from './cell-group-ext.js';
|
|
4
4
|
|
|
5
|
+
/** @category Header groups */
|
|
5
6
|
export declare class CellgroupFactory {
|
|
6
7
|
static buildColumnDefs(cellGroups: CellGroupIf[], ret?: ColumnDefIf[]): ColumnDefIf[];
|
|
7
8
|
static buildGroupExts(cellGroups: CellGroupIf[], ret?: CellGroupExt[], deep?: number, parent?: CellGroupExt): CellGroupExt[];
|
|
@@ -1,15 +1,38 @@
|
|
|
1
|
-
import { SizeIf } from '../../common/size.if';
|
|
2
|
-
import { ColumnDefIf, ValueRowSortComparator } from './column-def.if';
|
|
3
|
-
import { CellRendererIf } from '../../../renderer/cell-render.if';
|
|
4
|
-
import { AreaObjectMapType } from '../../common/area-map.type';
|
|
5
|
-
import { AreaObjectMap } from '../../common/area-map';
|
|
6
|
-
import { BooleanFunction } from '../../common/boolean-function';
|
|
7
|
-
import { SortState } from '../../common/sort-state.type';
|
|
8
|
-
import { GetEditRenderer } from '../../../renderer/edit/edit-cell-renderer.type';
|
|
9
|
-
import { editInputPipe } from '../../../renderer/edit/edit-input-pipe.if';
|
|
1
|
+
import { SizeIf } from '../../common/size.if.js';
|
|
2
|
+
import { ColumnDefIf, ValueRowSortComparator } from './column-def.if.js';
|
|
3
|
+
import { CellRendererIf } from '../../../renderer/cell-render.if.js';
|
|
4
|
+
import { AreaObjectMapType } from '../../common/area-map.type.js';
|
|
5
|
+
import { AreaObjectMap } from '../../common/area-map.js';
|
|
6
|
+
import { BooleanFunction } from '../../common/boolean-function.js';
|
|
7
|
+
import { SortState } from '../../common/sort-state.type.js';
|
|
8
|
+
import { GetEditRenderer } from '../../../renderer/edit/edit-cell-renderer.type.js';
|
|
9
|
+
import { editInputPipe } from '../../../renderer/edit/edit-input-pipe.if.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* The column definition – see {@link ColumnDefIf} for all fields.
|
|
13
|
+
*
|
|
14
|
+
* Two ways to create one:
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // short: property, header label, width, CSS classes
|
|
18
|
+
* new ColumnDef("customer", "Customer", px180, bodyLeft);
|
|
19
|
+
* new ColumnDef("total", "Total", px120, allRight); // numbers: right-aligned in header, body and footer
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* // named parameters for everything else
|
|
23
|
+
* ColumnDef.create({
|
|
24
|
+
* property: "status",
|
|
25
|
+
* headerLabel: "Status",
|
|
26
|
+
* width: px110,
|
|
27
|
+
* bodyRenderer: new StatusBadgeRenderer(),
|
|
28
|
+
* sortable: TrueFn,
|
|
29
|
+
* sortComparator: (a: string, b: string) => STATUS_ORDER.indexOf(a) - STATUS_ORDER.indexOf(b)
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* @see Training: [Columns with ColumnDef](https://gui.expert/training/column-definitions/),
|
|
33
|
+
* [Sorting](https://gui.expert/training/sorting/), [Cell renderers](https://gui.expert/training/cell-renderers/)
|
|
34
|
+
*
|
|
35
|
+
* @category Columns
|
|
13
36
|
*/
|
|
14
37
|
export declare class ColumnDef implements ColumnDefIf {
|
|
15
38
|
property: string;
|
|
@@ -31,26 +54,60 @@ export declare class ColumnDef implements ColumnDefIf {
|
|
|
31
54
|
visible: boolean;
|
|
32
55
|
constructor(property: string, headerLabel: string, width?: SizeIf, classes?: AreaObjectMapType<string[]>, rendererMap?: AreaObjectMapType<CellRendererIf>, minWidth?: SizeIf, maxWidth?: SizeIf, sortable?: BooleanFunction | undefined, sortComparator?: ValueRowSortComparator | undefined, sortState?: SortState | undefined, sortStatesOrder?: SortState[] | undefined, sortIconVisible?: BooleanFunction | undefined, editable?: BooleanFunction | undefined, getEditRenderer?: GetEditRenderer | undefined, editInputPipe?: editInputPipe | undefined, isVisible?: BooleanFunction);
|
|
33
56
|
static bodyRenderer(bodyRenderer: CellRendererIf): AreaObjectMap<CellRendererIf>;
|
|
57
|
+
/**
|
|
58
|
+
* Creates a column definition from named parameters. Everything is optional; defaults: width 100 px,
|
|
59
|
+
* visible, not editable, sortable only if `sortable` is given.
|
|
60
|
+
*
|
|
61
|
+
* `headerRenderer` / `bodyRenderer` / `footerRenderer` and `headerClasses` / `bodyClasses` / `footerClasses`
|
|
62
|
+
* fill {@link ColumnDefIf.rendererMap} and {@link ColumnDefIf.classes}.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ColumnDef.create({
|
|
66
|
+
* property: "price", headerLabel: "Price", width: px100,
|
|
67
|
+
* headerClasses: ["ge-table-text-align-right"], bodyClasses: ["ge-table-text-align-right"],
|
|
68
|
+
* sortable: TrueFn
|
|
69
|
+
* });
|
|
70
|
+
*/
|
|
34
71
|
static create(param: {
|
|
72
|
+
/** Property of the row object, see {@link ColumnDefIf.property}. */
|
|
35
73
|
property?: string;
|
|
74
|
+
/** Header label. */
|
|
36
75
|
headerLabel?: string;
|
|
76
|
+
/** Width, default 100 px. */
|
|
37
77
|
width?: SizeIf;
|
|
78
|
+
/** Lower limit for % widths. */
|
|
38
79
|
minWidth?: SizeIf;
|
|
80
|
+
/** Upper limit for % widths. */
|
|
39
81
|
maxWidth?: SizeIf;
|
|
82
|
+
/** Renderer of the header cell. */
|
|
40
83
|
headerRenderer?: CellRendererIf;
|
|
84
|
+
/** Renderer of the body cells. */
|
|
41
85
|
bodyRenderer?: CellRendererIf;
|
|
86
|
+
/** Renderer of the footer cells. */
|
|
42
87
|
footerRenderer?: CellRendererIf;
|
|
88
|
+
/** CSS classes of the header cell, e.g. `["ge-table-text-align-right"]`. */
|
|
43
89
|
headerClasses?: string[];
|
|
90
|
+
/** CSS classes of the body cells. */
|
|
44
91
|
bodyClasses?: string[];
|
|
92
|
+
/** CSS classes of the footer cells. */
|
|
45
93
|
footerClasses?: string[];
|
|
94
|
+
/** Sortable by double-click on the header, e.g. `TrueFn`. */
|
|
46
95
|
sortable?: BooleanFunction;
|
|
96
|
+
/** Show the sort icon (default: follows `sortable`). */
|
|
47
97
|
sortIconVisible?: BooleanFunction;
|
|
98
|
+
/** Own comparison of two cell values. */
|
|
48
99
|
sortComparator?: ValueRowSortComparator;
|
|
100
|
+
/** Initial sort icon (`"asc"`, `"desc"`); sort the rows with `tableModel.doSort()` to match. */
|
|
49
101
|
sortState?: SortState;
|
|
102
|
+
/** Order of the sort states on repeated double-clicks. */
|
|
50
103
|
sortStatesOrder?: SortState[];
|
|
104
|
+
/** Cells can be edited, e.g. `TrueFn`. */
|
|
51
105
|
editable?: BooleanFunction;
|
|
106
|
+
/** Column is shown (default `TrueFn`). */
|
|
52
107
|
isVisible?: BooleanFunction;
|
|
108
|
+
/** The editor of this column. */
|
|
53
109
|
getEditRenderer?: GetEditRenderer;
|
|
110
|
+
/** Converts the editor text before it is stored, e.g. `editInputPipeForNumber`. */
|
|
54
111
|
editInputPipe?: editInputPipe;
|
|
55
112
|
}): ColumnDefIf;
|
|
56
113
|
}
|