@guiexpert/table 1.1.94 → 1.1.97
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 +16 -0
- package/css/main.css +299 -0
- package/css/table-calc.css +7 -0
- package/css/table-color-vars.css +58 -0
- package/css/table-fill-batch.css +58 -0
- package/css/table-master-detail.css +95 -0
- package/css/table-row-drag.css +81 -0
- package/index.cjs +37 -35
- package/index.d.ts +34 -0
- package/index.js +9749 -5000
- package/lib/table/action/action-id.type.d.ts +1 -1
- package/lib/table/aria/aria-ids.d.ts +7 -0
- package/lib/table/aria/aria-texts.d.ts +13 -0
- package/lib/table/aria/aria-texts.if.d.ts +101 -0
- package/lib/table/batch-edit/batch-edit-options.d.ts +21 -0
- package/lib/table/batch-edit/batch-edit-options.if.d.ts +20 -0
- package/lib/table/batch-edit/batch-edit-service.d.ts +104 -0
- package/lib/table/batch-edit/cell-change.if.d.ts +39 -0
- package/lib/table/batch-edit/cell-value-change.if.d.ts +18 -0
- package/lib/table/batch-edit/pending-cell-changes.d.ts +104 -0
- package/lib/table/calc/column-values.d.ts +55 -0
- package/lib/table/calc/show-values-as-internals.d.ts +4 -0
- package/lib/table/calc/show-values-as.d.ts +87 -0
- package/lib/table/calc/show-values-as.type.d.ts +55 -0
- package/lib/table/calc/value-getter-context.if.d.ts +35 -0
- package/lib/table/calc/value-getter.type.d.ts +36 -0
- package/lib/table/data/common/event/ge-batch-edit-event.d.ts +46 -0
- package/lib/table/data/common/event/ge-detail-event.d.ts +40 -0
- package/lib/table/data/common/event/ge-model-change-event.d.ts +27 -1
- package/lib/table/data/common/event/ge-row-drag-event.d.ts +89 -0
- package/lib/table/data/options/auto-restore-options.d.ts +2 -0
- package/lib/table/data/options/auto-restore-options.if.d.ts +6 -0
- package/lib/table/data/options/table-options.d.ts +8 -0
- package/lib/table/data/options/table-options.if.d.ts +62 -0
- package/lib/table/data/tablemodel/areamodel/abstract-area-model.d.ts +66 -0
- package/lib/table/data/tablemodel/areamodel/area-model-aggregate-footer.d.ts +5 -0
- package/lib/table/data/tablemodel/areamodel/area-model-array-of-arrays.d.ts +24 -0
- package/lib/table/data/tablemodel/areamodel/area-model-object-array.d.ts +70 -0
- package/lib/table/data/tablemodel/areamodel/area-model-pivot.d.ts +31 -0
- package/lib/table/data/tablemodel/areamodel/area-model-row-groups.d.ts +23 -1
- package/lib/table/data/tablemodel/areamodel/area-model-tree.d.ts +83 -0
- package/lib/table/data/tablemodel/areamodel/area-model.if.d.ts +55 -0
- package/lib/table/data/tablemodel/column/column-def.d.ts +31 -1
- package/lib/table/data/tablemodel/column/column-def.if.d.ts +86 -0
- package/lib/table/ele-scope.d.ts +14 -0
- package/lib/table/event-adapter.d.ts +10 -0
- package/lib/table/event-listener.if.d.ts +39 -0
- package/lib/table/factory/table-factory.d.ts +11 -0
- package/lib/table/fill/compute-fill-changes.d.ts +67 -0
- package/lib/table/fill/fill-direction.type.d.ts +7 -0
- package/lib/table/fill/fill-handle-options.d.ts +29 -0
- package/lib/table/fill/fill-handle-options.if.d.ts +35 -0
- package/lib/table/fill/fill-handle-service.d.ts +55 -0
- package/lib/table/fill/fill-series.d.ts +60 -0
- package/lib/table/fill/fill-value-context.if.d.ts +36 -0
- package/lib/table/formula/compile-formula.d.ts +86 -0
- package/lib/table/formula/evaluator.d.ts +19 -0
- package/lib/table/formula/formula-ast.if.d.ts +42 -0
- package/lib/table/formula/formula-error.d.ts +59 -0
- package/lib/table/formula/formula-options.if.d.ts +41 -0
- package/lib/table/formula/formula-values.d.ts +13 -0
- package/lib/table/formula/functions.d.ts +18 -0
- package/lib/table/formula/parser.d.ts +10 -0
- package/lib/table/formula/tokenizer.d.ts +22 -0
- package/lib/table/master-detail/detail-renderer.if.d.ts +99 -0
- package/lib/table/master-detail/master-detail-options.d.ts +30 -0
- package/lib/table/master-detail/master-detail-options.if.d.ts +60 -0
- package/lib/table/master-detail/master-detail-service.d.ts +223 -0
- package/lib/table/pivot/pivot-value.type.d.ts +13 -0
- package/lib/table/render-scope.d.ts +154 -0
- package/lib/table/renderer/edit/input-cell-renderer.d.ts +1 -1
- package/lib/table/renderer/edit/select-cell-renderer.d.ts +1 -1
- package/lib/table/row-drag/move-rows.d.ts +157 -0
- package/lib/table/row-drag/row-drag-options.d.ts +28 -0
- package/lib/table/row-drag/row-drag-options.if.d.ts +36 -0
- package/lib/table/row-drag/row-drag-service.d.ts +130 -0
- package/lib/table/row-drag/row-drop-target.if.d.ts +29 -0
- package/lib/table/row-layout/row-layout.d.ts +120 -0
- package/lib/table/service/excel-service.d.ts +6 -0
- package/lib/table/service/excel-service.if.d.ts +35 -0
- package/lib/table/state/table-state.if.d.ts +4 -1
- package/lib/table/state/table-state.service.d.ts +4 -0
- package/lib/table/table-api.d.ts +378 -2
- package/lib/table/table-scope.d.ts +185 -0
- package/package.json +1 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { DetailRendererIf, DetailRenderFnType } from './detail-renderer.if.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The height of a detail row: px, or `"auto"` = measured from its content (a `ResizeObserver` follows changes).
|
|
5
|
+
*
|
|
6
|
+
* @category Master/detail
|
|
7
|
+
* @since 1.1.97
|
|
8
|
+
*/
|
|
9
|
+
export type DetailHeightType = number | "auto";
|
|
10
|
+
/**
|
|
11
|
+
* Master/detail: a master row can be expanded; below it a detail row over the full width of the table (fixed columns
|
|
12
|
+
* included) shows any content – a nested GuiExpert table, a form, a chart, a framework component. Works with virtual
|
|
13
|
+
* scrolling and millions of rows: the content is created when the detail row becomes visible and lives until it is
|
|
14
|
+
* collapsed (scrolling only hides and shows it). Only for flat body models (not for trees, row groups and pivot tables).
|
|
15
|
+
*
|
|
16
|
+
* Fields you leave out keep their default ({@link MasterDetailOptions}).
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* const tableOptions: TableOptionsIf = {
|
|
20
|
+
* ...new TableOptions(),
|
|
21
|
+
* masterDetail: {
|
|
22
|
+
* detailHeight: 180,
|
|
23
|
+
* detailRenderer: (_container, order: Order, ctx) => {
|
|
24
|
+
* ctx.createTable({
|
|
25
|
+
* tableModel: TableFactory.createTableModel({ rows: order.items, properties: ["sku", "name", "qty", "price"] })
|
|
26
|
+
* });
|
|
27
|
+
* }
|
|
28
|
+
* }
|
|
29
|
+
* };
|
|
30
|
+
*
|
|
31
|
+
* @see Training: [Master/detail](https://gui.expert/training/master-detail/)
|
|
32
|
+
*
|
|
33
|
+
* @category Master/detail
|
|
34
|
+
* @since 1.1.97
|
|
35
|
+
*/
|
|
36
|
+
export interface MasterDetailOptionsIf<T = any> {
|
|
37
|
+
/** Renders the content of a detail row (function or object with `render()`). */
|
|
38
|
+
detailRenderer: DetailRendererIf<T> | DetailRenderFnType<T>;
|
|
39
|
+
/** Which rows can be expanded. Default: every row. */
|
|
40
|
+
isMaster?: (row: T, rowIndex: number) => boolean;
|
|
41
|
+
/** Height of the detail rows: px, `"auto"` (measured) or a function per row. Default `"auto"`. */
|
|
42
|
+
detailHeight: DetailHeightType | ((row: T, rowIndex: number) => DetailHeightType);
|
|
43
|
+
/** Height of an `"auto"` detail row before its content was measured (px). Default 200. */
|
|
44
|
+
estimatedDetailHeight: number;
|
|
45
|
+
/**
|
|
46
|
+
* The column with the expand/collapse icon: column index or property. Default: the first data column (behind a row
|
|
47
|
+
* number and a row checkbox column – where a tree has its arrow).
|
|
48
|
+
*/
|
|
49
|
+
toggleColumn?: number | string;
|
|
50
|
+
/**
|
|
51
|
+
* At most this many detail contents exist at the same time. Beyond it the detail row that was out of view the
|
|
52
|
+
* longest is destroyed and created again when it scrolls back into view (`context.recreated`). Default 50.
|
|
53
|
+
*/
|
|
54
|
+
maxRenderedDetails: number;
|
|
55
|
+
/**
|
|
56
|
+
* The id of a master row – keeps detail rows open when the rows are replaced by new objects with the same ids
|
|
57
|
+
* (`setRows`). Default: `autoRestoreOptions.getRowId`, otherwise the row object itself.
|
|
58
|
+
*/
|
|
59
|
+
getRowId?: (row: T) => string | number;
|
|
60
|
+
}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { TableScope } from '../table-scope.js';
|
|
2
|
+
import { TableApi } from '../table-api.js';
|
|
3
|
+
import { TableModelIf } from '../data/tablemodel/table-model.if.js';
|
|
4
|
+
import { TableOptionsIf } from '../data/options/table-options.if.js';
|
|
5
|
+
import { EventListenerIf } from '../event-listener.if.js';
|
|
6
|
+
import { GeDetailEventSource } from '../data/common/event/ge-detail-event.js';
|
|
7
|
+
import { MasterDetailOptionsIf } from './master-detail-options.if.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The part of a nested table the master/detail service needs (a {@link TableScope}).
|
|
11
|
+
*
|
|
12
|
+
* @category Internals
|
|
13
|
+
* @since 1.1.97
|
|
14
|
+
*/
|
|
15
|
+
export interface NestedTableScopeIf {
|
|
16
|
+
firstInit(): unknown;
|
|
17
|
+
getApi(): TableApi;
|
|
18
|
+
destroy(): void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Creates the {@link TableScope} of a nested table (given by `TableScope` – no import cycle).
|
|
22
|
+
*
|
|
23
|
+
* @category Internals
|
|
24
|
+
* @since 1.1.97
|
|
25
|
+
*/
|
|
26
|
+
export type NestedTableScopeFactory = (host: HTMLDivElement, tableModel: TableModelIf, tableOptions: TableOptionsIf | undefined, eventListener: EventListenerIf | undefined) => NestedTableScopeIf;
|
|
27
|
+
/**
|
|
28
|
+
* Master/detail of a table ({@link TableOptionsIf.masterDetail}): the expanded master rows, the detail layer and the
|
|
29
|
+
* life cycle of the detail contents. Created by {@link TableScope} (`tableScope.masterDetailService`); use the
|
|
30
|
+
* {@link TableApi} (`setDetailExpanded`, `toggleDetail` …).
|
|
31
|
+
*
|
|
32
|
+
* - **Layer**: one div `ge-table-detail-layer` in the host, over the body (full width, fixed columns included, without
|
|
33
|
+
* the scroll bars). It is never cleared by the virtual rendering and does not scroll horizontally.
|
|
34
|
+
* - **Positions**: the heights of the detail rows are extras of the body {@link RowLayout} (behind their master row);
|
|
35
|
+
* `RenderScope` reports the detail rows in view after every render pass ({@link layoutVisible}).
|
|
36
|
+
* - **Life cycle**: the content is created when the detail row becomes visible, hidden (not destroyed) when it scrolls
|
|
37
|
+
* out of view, destroyed when it is collapsed, beyond `maxRenderedDetails` or when the table is destroyed.
|
|
38
|
+
* - **Events**: mouse, keyboard and pointer events from a detail row are ignored by the outer table
|
|
39
|
+
* ({@link isInLayer}); the mouse wheel over a detail row scrolls the outer table when nothing in the detail scrolls.
|
|
40
|
+
*
|
|
41
|
+
* @category Internals
|
|
42
|
+
* @since 1.1.97
|
|
43
|
+
*/
|
|
44
|
+
export declare class MasterDetailService {
|
|
45
|
+
private readonly scope;
|
|
46
|
+
private readonly createNestedScope;
|
|
47
|
+
/** The complete options (defaults + `tableOptions.masterDetail`). */
|
|
48
|
+
readonly options: MasterDetailOptionsIf;
|
|
49
|
+
private readonly active;
|
|
50
|
+
private layer?;
|
|
51
|
+
private readonly entries;
|
|
52
|
+
private byIndex;
|
|
53
|
+
private visibleNow;
|
|
54
|
+
private renderPass;
|
|
55
|
+
private renderedCount;
|
|
56
|
+
private toggleColumnIndex;
|
|
57
|
+
private resizeFrame;
|
|
58
|
+
private destroyed;
|
|
59
|
+
constructor(scope: TableScope, createNestedScope: NestedTableScopeFactory);
|
|
60
|
+
/** True if master/detail is configured (and the body is flat). */
|
|
61
|
+
isActive(): boolean;
|
|
62
|
+
/** True if at least one master row is expanded. */
|
|
63
|
+
hasExpanded(): boolean;
|
|
64
|
+
/** The detail layer (`undefined` without master/detail). */
|
|
65
|
+
getLayer(): HTMLDivElement | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* True if an event comes from a detail row (or a nested table in it) – the outer table ignores it.
|
|
68
|
+
*
|
|
69
|
+
* @param {Event} evt - a DOM event while it is dispatched
|
|
70
|
+
* @returns {boolean} whether its path contains the detail layer
|
|
71
|
+
*/
|
|
72
|
+
isInLayer(evt: Event): boolean;
|
|
73
|
+
/** The id of a master row: `options.getRowId`, `autoRestoreOptions.getRowId`, the row object or its index. */
|
|
74
|
+
keyOf(row: unknown, rowIndex: number): unknown;
|
|
75
|
+
/**
|
|
76
|
+
* True if the row at a display index can be expanded ({@link MasterDetailOptionsIf.isMaster}).
|
|
77
|
+
*
|
|
78
|
+
* @param {number} rowIndex - display index
|
|
79
|
+
* @returns {boolean} whether it is a master row
|
|
80
|
+
*/
|
|
81
|
+
isMasterAt(rowIndex: number): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* True if the master row at a display index is expanded.
|
|
84
|
+
*
|
|
85
|
+
* @param {number} rowIndex - display index
|
|
86
|
+
* @returns {boolean} whether its detail row is open
|
|
87
|
+
*/
|
|
88
|
+
isExpandedAt(rowIndex: number): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* True if a row (display index or row object) is expanded.
|
|
91
|
+
*
|
|
92
|
+
* @param {number | object} rowOrIndex - display index or row object
|
|
93
|
+
* @returns {boolean} whether its detail row is open
|
|
94
|
+
*/
|
|
95
|
+
isExpanded(rowOrIndex: unknown): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Expands or collapses a master row. The table repaints and reports the change ({@link TableScope}).
|
|
98
|
+
*
|
|
99
|
+
* @param {number | object} rowOrIndex - display index or row object
|
|
100
|
+
* @param {boolean} expanded - the new state
|
|
101
|
+
* @param {GeDetailEventSource} [source] - what changed it (for the event)
|
|
102
|
+
* @returns {boolean} false if nothing changed (no master row, already in that state, no master/detail)
|
|
103
|
+
*/
|
|
104
|
+
setExpanded(rowOrIndex: unknown, expanded: boolean, source?: GeDetailEventSource): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Expands all master rows that are shown (their contents are created only when they scroll into view).
|
|
107
|
+
* No event per row.
|
|
108
|
+
*
|
|
109
|
+
* @returns {number} the number of rows that were expanded
|
|
110
|
+
*/
|
|
111
|
+
expandAll(): number;
|
|
112
|
+
/**
|
|
113
|
+
* Collapses all detail rows (their contents are destroyed). No event per row.
|
|
114
|
+
*
|
|
115
|
+
* @returns {number} the number of rows that were collapsed
|
|
116
|
+
*/
|
|
117
|
+
collapseAll(): number;
|
|
118
|
+
/** The expanded master rows (row objects; for models without row objects: `undefined`). */
|
|
119
|
+
getExpandedRows(): unknown[];
|
|
120
|
+
/**
|
|
121
|
+
* Expands exactly these rows and collapses all others – the restore of the table state. Rows that are no master
|
|
122
|
+
* rows are skipped. No event per row.
|
|
123
|
+
*
|
|
124
|
+
* @param {unknown[]} rows - row objects of the body model
|
|
125
|
+
* @param {GeDetailEventSource} [source] - what changed it
|
|
126
|
+
* @returns {boolean} true if something changed
|
|
127
|
+
*/
|
|
128
|
+
setExpandedRows(rows: readonly unknown[], source?: GeDetailEventSource): boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Destroys the content of a detail row and creates it again (e.g. after the row's data changed).
|
|
131
|
+
*
|
|
132
|
+
* @param {number | object} rowOrIndex - display index or row object
|
|
133
|
+
* @returns {boolean} false if the row is not expanded
|
|
134
|
+
*/
|
|
135
|
+
refresh(rowOrIndex: unknown): boolean;
|
|
136
|
+
/**
|
|
137
|
+
* The container of a detail row (the element `detailRenderer` renders into) – only while its content exists.
|
|
138
|
+
*
|
|
139
|
+
* @param {number | object} rowOrIndex - display index or row object
|
|
140
|
+
* @returns {HTMLDivElement | undefined} the container
|
|
141
|
+
*/
|
|
142
|
+
getDetailElement(rowOrIndex: unknown): HTMLDivElement | undefined;
|
|
143
|
+
/**
|
|
144
|
+
* The display index of the master row a DOM node belongs to (a detail row or something in it).
|
|
145
|
+
*
|
|
146
|
+
* @param {Node} node - a node in the detail layer
|
|
147
|
+
* @returns {number} the display index, -1 if none
|
|
148
|
+
*/
|
|
149
|
+
getMasterRowIndexOf(node: Node | null): number;
|
|
150
|
+
/**
|
|
151
|
+
* The display indices and heights of the expanded master rows that are shown – the extras of the body row layout.
|
|
152
|
+
* Called by `RenderScope` when the row layout is built (after filtering, sorting, editing, a detail toggle …): one
|
|
153
|
+
* pass over the shown rows. Removes expanded rows that no longer exist in the model (`getAllRows()`).
|
|
154
|
+
*
|
|
155
|
+
* @returns {{ rowIndices: number[], heights: number[] } | undefined} the extras, `undefined` without expanded rows
|
|
156
|
+
*/
|
|
157
|
+
computeExtras(): {
|
|
158
|
+
rowIndices: number[];
|
|
159
|
+
heights: number[];
|
|
160
|
+
} | undefined;
|
|
161
|
+
/**
|
|
162
|
+
* Called at the start of the body render pass: the column of the expand icon.
|
|
163
|
+
*/
|
|
164
|
+
startRenderPass(): void;
|
|
165
|
+
/**
|
|
166
|
+
* Shows the detail rows in view (called by `RenderScope` after the body rows were rendered): creates missing
|
|
167
|
+
* contents, sets their positions, hides the ones that left the view and destroys the oldest hidden contents beyond
|
|
168
|
+
* {@link MasterDetailOptionsIf.maxRenderedDetails}.
|
|
169
|
+
*
|
|
170
|
+
* @param {number[]} triples - `rowIndex, top, height` of each detail row in view; `top` relative to the body top
|
|
171
|
+
*/
|
|
172
|
+
layoutVisible(triples: number[]): void;
|
|
173
|
+
/**
|
|
174
|
+
* Position and size of the layer: the visible body including the fixed columns, without the scroll bars.
|
|
175
|
+
*
|
|
176
|
+
* @param {number} left - px in the host
|
|
177
|
+
* @param {number} top - px in the host (below the header)
|
|
178
|
+
* @param {number} width - px
|
|
179
|
+
* @param {number} height - px
|
|
180
|
+
*/
|
|
181
|
+
setBounds(left: number, top: number, width: number, height: number): void;
|
|
182
|
+
/**
|
|
183
|
+
* Decorates a body cell of the toggle column of a master row with the expand icon (`ge-table-detail-toggle`).
|
|
184
|
+
*
|
|
185
|
+
* @param {HTMLDivElement} cell - the rendered cell
|
|
186
|
+
* @param {number} rowIndex - display index
|
|
187
|
+
* @param {number} columnIndex - model column index
|
|
188
|
+
*/
|
|
189
|
+
decorateCell(cell: HTMLDivElement, rowIndex: number, columnIndex: number): void;
|
|
190
|
+
/**
|
|
191
|
+
* Called when the table is destroyed: destroys all detail contents and removes the layer.
|
|
192
|
+
*/
|
|
193
|
+
destroy(): void;
|
|
194
|
+
private getBody;
|
|
195
|
+
private getAllRows;
|
|
196
|
+
/** isMaster for a row that is not shown (filtered out) – the index is unknown (-1). */
|
|
197
|
+
private isMasterRow;
|
|
198
|
+
/** `[row, rowIndex]` of a display index or a row object (index -1 if the row is not shown). */
|
|
199
|
+
private resolve;
|
|
200
|
+
private heightOf;
|
|
201
|
+
private detailHeightOf;
|
|
202
|
+
private computeToggleColumnIndex;
|
|
203
|
+
private pruneRemovedRows;
|
|
204
|
+
private createLayer;
|
|
205
|
+
private createContent;
|
|
206
|
+
private createNestedTable;
|
|
207
|
+
private place;
|
|
208
|
+
private park;
|
|
209
|
+
/** The focus is inside a detail row that is hidden or removed: the master table (row) takes it. */
|
|
210
|
+
private releaseFocus;
|
|
211
|
+
private onResize;
|
|
212
|
+
private enforceLimit;
|
|
213
|
+
private destroyContent;
|
|
214
|
+
private clearAll;
|
|
215
|
+
/** The mouse wheel over a detail row: scrolls the outer table if nothing in the detail row takes the movement. */
|
|
216
|
+
private onWheel;
|
|
217
|
+
private canScrollInside;
|
|
218
|
+
/** Tab on a master row with an open detail row: the focus moves to the first focusable element in it. */
|
|
219
|
+
private onHostKeyDown;
|
|
220
|
+
/** The host got the focus back from a detail row (Shift+Tab): its master row gets the focus. */
|
|
221
|
+
private onHostFocus;
|
|
222
|
+
private findFocusable;
|
|
223
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ValueAccessor } from '../aggregation/value-accessor.type.js';
|
|
2
2
|
import { AggregatorRef } from '../aggregation/aggregator-name.type.js';
|
|
3
3
|
import { AggregatorIf } from '../aggregation/aggregator.if.js';
|
|
4
|
+
import { ShowValuesAsConfig, ShowValuesAsIf } from '../calc/show-values-as.type.js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* One value of a pivot table in full form: where the value of a row comes from, how it is aggregated, and how its
|
|
@@ -32,6 +33,16 @@ export interface PivotValueIf<T = any> {
|
|
|
32
33
|
label?: string;
|
|
33
34
|
/** The text of a result in a cell. Default: numbers with at most two decimals (`"1,234.5"`). Excel gets the raw value. */
|
|
34
35
|
format?: (result: unknown) => string;
|
|
36
|
+
/**
|
|
37
|
+
* „Show values as“ (since 1.1.95): `"percentOfRowTotal"` (each pivot row = 100 %), `"percentOfColumnTotal"`,
|
|
38
|
+
* `"percentOfGrandTotal"` or `"percentOfParentTotal"` (share of the parent row group). The cells then hold the
|
|
39
|
+
* fraction (Excel: number with percent format), the text is a percentage; `format` is not used. Other modes of
|
|
40
|
+
* {@link ShowValuesAs} don't apply to a pivot (the value is shown).
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* values: [{ value: "umsatz", showValuesAs: "percentOfRowTotal" }]
|
|
44
|
+
*/
|
|
45
|
+
showValuesAs?: ShowValuesAsConfig;
|
|
35
46
|
}
|
|
36
47
|
/**
|
|
37
48
|
* A value of a pivot table: a property path or function (summed) or the full form {@link PivotValueIf}.
|
|
@@ -64,4 +75,6 @@ export interface PivotValueInfoIf {
|
|
|
64
75
|
readonly aggregator: AggregatorIf;
|
|
65
76
|
/** The format of a result, if one was given. */
|
|
66
77
|
readonly format?: (result: unknown) => string;
|
|
78
|
+
/** „Show values as“, if one was given (since 1.1.95). */
|
|
79
|
+
readonly showValuesAs?: ShowValuesAsIf;
|
|
67
80
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { RowDragService } from './row-drag/row-drag-service.js';
|
|
2
|
+
import { BatchEditService } from './batch-edit/batch-edit-service.js';
|
|
3
|
+
import { FillHandleService } from './fill/fill-handle-service.js';
|
|
1
4
|
import { TableOverlayChange } from './overlay/table-overlay.js';
|
|
2
5
|
import { EleScope } from './ele-scope.js';
|
|
3
6
|
import { TableModelIf } from './data/tablemodel/table-model.if.js';
|
|
@@ -23,6 +26,8 @@ import { AreaObjectMapType } from './data/common/area-map.type.js';
|
|
|
23
26
|
import { TableCellUpdateEventIf } from './data/common/event/input/table-cell-update-event.if.js';
|
|
24
27
|
import { AriaGridInfo } from './aria/aria-grid-info.js';
|
|
25
28
|
import { AriaTextsIf } from './aria/aria-texts.if.js';
|
|
29
|
+
import { RowLayout } from './row-layout/row-layout.js';
|
|
30
|
+
import { MasterDetailService } from './master-detail/master-detail-service.js';
|
|
26
31
|
|
|
27
32
|
/** @category Internals */
|
|
28
33
|
export declare class RenderScope extends EleScope {
|
|
@@ -85,7 +90,136 @@ export declare class RenderScope extends EleScope {
|
|
|
85
90
|
* first body row, see `TableScope`. `undefined`: the focus is in the body ({@link FocusModelIf}).
|
|
86
91
|
*/
|
|
87
92
|
protected headerFocus?: [number, number];
|
|
93
|
+
/**
|
|
94
|
+
* Row drag of this table (drag handles, pointer and keyboard drag) – created by {@link TableScope}.
|
|
95
|
+
* @since 1.1.95
|
|
96
|
+
*/
|
|
97
|
+
rowDragService?: RowDragService;
|
|
98
|
+
/**
|
|
99
|
+
* Batch edit of this table (pending values, shown in the cells) – created by {@link TableScope}.
|
|
100
|
+
* @since 1.1.96
|
|
101
|
+
*/
|
|
102
|
+
batchEditService?: BatchEditService;
|
|
103
|
+
/**
|
|
104
|
+
* Fill handle of this table – created by {@link TableScope}.
|
|
105
|
+
* @since 1.1.96
|
|
106
|
+
*/
|
|
107
|
+
fillHandleService?: FillHandleService;
|
|
108
|
+
/**
|
|
109
|
+
* Master/detail of this table (detail rows below master rows) – created by {@link TableScope} with
|
|
110
|
+
* `tableOptions.masterDetail`.
|
|
111
|
+
* @since 1.1.97
|
|
112
|
+
*/
|
|
113
|
+
masterDetailService?: MasterDetailService;
|
|
114
|
+
/** Positions of the body rows (prefix sums of the heights + detail rows), see {@link getBodyRowLayout}. */
|
|
115
|
+
private readonly bodyRowLayout;
|
|
116
|
+
private bodyRowLayoutDirty;
|
|
117
|
+
private bodyRowLayoutModel?;
|
|
88
118
|
constructor(hostElement: HTMLDivElement, tableModel: TableModelIf, dom: ConvenienceDomService, tableOptions: TableOptionsIf);
|
|
119
|
+
/**
|
|
120
|
+
* The DOM service of this table (all DOM access of the table goes through it).
|
|
121
|
+
*
|
|
122
|
+
* @returns {ConvenienceDomService} the service
|
|
123
|
+
* @since 1.1.95
|
|
124
|
+
*/
|
|
125
|
+
getDomService(): ConvenienceDomService;
|
|
126
|
+
/**
|
|
127
|
+
* The visible body in client (viewport) coordinates – including fixed west/east columns, without the scroll bar –
|
|
128
|
+
* and the content pixels scrolled out at its top. Row drag computes the row under the pointer with it.
|
|
129
|
+
*
|
|
130
|
+
* @returns {{ top: number, height: number, left: number, width: number, contentScrollTop: number }} the geometry
|
|
131
|
+
* @since 1.1.95
|
|
132
|
+
*/
|
|
133
|
+
getBodyViewport(): {
|
|
134
|
+
top: number;
|
|
135
|
+
height: number;
|
|
136
|
+
left: number;
|
|
137
|
+
width: number;
|
|
138
|
+
contentScrollTop: number;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* The rectangle of a body cell in host coordinates (relative to the padding box of the host) – computed from the
|
|
142
|
+
* row and column positions, also for cells that are not rendered – and the visible part of its area (`clip…`: the
|
|
143
|
+
* body between header and footer, horizontally the fixed west/east area or the scrollable center).
|
|
144
|
+
*
|
|
145
|
+
* @param {number} rowIndex - display index
|
|
146
|
+
* @param {number} columnIndex - model index
|
|
147
|
+
* @returns {{ left: number, top: number, width: number, height: number, clipLeft: number, clipRight: number, clipTop: number, clipBottom: number }} the geometry
|
|
148
|
+
* @since 1.1.96
|
|
149
|
+
*/
|
|
150
|
+
getBodyCellRectInHost(rowIndex: number, columnIndex: number): {
|
|
151
|
+
left: number;
|
|
152
|
+
top: number;
|
|
153
|
+
width: number;
|
|
154
|
+
height: number;
|
|
155
|
+
clipLeft: number;
|
|
156
|
+
clipRight: number;
|
|
157
|
+
clipTop: number;
|
|
158
|
+
clipBottom: number;
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* The body cell at a point in host coordinates, clamped to the body (a point above the body = row 0, right of the
|
|
162
|
+
* columns = the last column …) – computed, not read from the DOM.
|
|
163
|
+
*
|
|
164
|
+
* @param {number} x - x relative to the host's padding box
|
|
165
|
+
* @param {number} y - y relative to the host's padding box
|
|
166
|
+
* @returns {[number, number]} row and column index, `[-1, -1]` without rows or columns
|
|
167
|
+
* @since 1.1.96
|
|
168
|
+
*/
|
|
169
|
+
getBodyCellAtHostPoint(x: number, y: number): [number, number];
|
|
170
|
+
/**
|
|
171
|
+
* The positions of the body rows: prefix sums of the row heights (O(log n) lookups also for variable heights) plus
|
|
172
|
+
* the heights of open detail rows. Built lazily – again after {@link invalidateRowLayout}, a new body model or
|
|
173
|
+
* another row count.
|
|
174
|
+
*
|
|
175
|
+
* @returns {RowLayout} the layout of the body rows
|
|
176
|
+
* @since 1.1.97
|
|
177
|
+
*/
|
|
178
|
+
getBodyRowLayout(): RowLayout;
|
|
179
|
+
/**
|
|
180
|
+
* Marks the positions of the body rows as outdated (rows filtered, sorted, edited, added or removed, a detail row
|
|
181
|
+
* opened or closed) – they are computed again on the next access.
|
|
182
|
+
*
|
|
183
|
+
* @since 1.1.97
|
|
184
|
+
*/
|
|
185
|
+
invalidateRowLayout(): void;
|
|
186
|
+
/**
|
|
187
|
+
* Sets the height of the detail row behind one body row in the current row layout without building it again
|
|
188
|
+
* (a detail row was expanded or collapsed). Does nothing if the layout is outdated anyway.
|
|
189
|
+
*
|
|
190
|
+
* @param {number} rowIndex - display index of the master row
|
|
191
|
+
* @param {number} height - the detail height, 0 = none
|
|
192
|
+
* @returns {boolean} true if the layout was updated, false if it is outdated (it is built again on the next access)
|
|
193
|
+
* @since 1.1.97
|
|
194
|
+
*/
|
|
195
|
+
setBodyRowExtra(rowIndex: number, height: number): boolean;
|
|
196
|
+
/** True if open detail rows take space between the body rows. */
|
|
197
|
+
protected hasBodyRowExtras(): boolean;
|
|
198
|
+
/**
|
|
199
|
+
* The top of a body row in content pixels: {@link AreaModelIf.getYPosByRowIndex} plus the heights of the open detail
|
|
200
|
+
* rows above it (master/detail).
|
|
201
|
+
*
|
|
202
|
+
* @param {number} rowIndex - display index
|
|
203
|
+
* @returns {number} px from the top of the first body row
|
|
204
|
+
* @since 1.1.97
|
|
205
|
+
*/
|
|
206
|
+
getBodyRowTop(rowIndex: number): number;
|
|
207
|
+
/**
|
|
208
|
+
* The body row at a content position (a position in an open detail row belongs to its master row). Above the rows:
|
|
209
|
+
* 0, below: the last row, without rows: -1.
|
|
210
|
+
*
|
|
211
|
+
* @param {number} contentY - px from the top of the first body row
|
|
212
|
+
* @returns {number} display index
|
|
213
|
+
* @since 1.1.97
|
|
214
|
+
*/
|
|
215
|
+
getBodyRowIndexAtY(contentY: number): number;
|
|
216
|
+
/**
|
|
217
|
+
* Scroll bar pixels per content pixel: 1, below 1 for a capped scroll height ({@link isScrollHeightCapped}).
|
|
218
|
+
*
|
|
219
|
+
* @returns {number} the factor for `scrollTop` changes
|
|
220
|
+
* @since 1.1.95
|
|
221
|
+
*/
|
|
222
|
+
getScrollerToContentRatioY(): number;
|
|
89
223
|
isEditing(): boolean;
|
|
90
224
|
/**
|
|
91
225
|
* Resets the editor renderer by clearing its values and state.
|
|
@@ -193,6 +327,11 @@ export declare class RenderScope extends EleScope {
|
|
|
193
327
|
* @returns {void}
|
|
194
328
|
*/
|
|
195
329
|
updateCells(events: TableCellUpdateEventIf[], repaintAll?: boolean): void;
|
|
330
|
+
/**
|
|
331
|
+
* After `updateCells()` without a repaint: draws the rendered cells of calculated and „Show values as“ columns of
|
|
332
|
+
* the body again (they depend on the changed cells, e.g. `total = price * quantity` or a share of the total).
|
|
333
|
+
*/
|
|
334
|
+
protected rerenderCalculatedCells(): void;
|
|
196
335
|
/**
|
|
197
336
|
* After `updateCells()` without a repaint: draws the rendered aggregate cells of the group rows of a row grouping
|
|
198
337
|
* again (they follow the changed rows; labels and counts don't change – a moved row repaints the whole table).
|
|
@@ -257,6 +396,15 @@ export declare class RenderScope extends EleScope {
|
|
|
257
396
|
* scaled and scrollTop is no longer a content pixel position.
|
|
258
397
|
*/
|
|
259
398
|
isScrollHeightCapped(): boolean;
|
|
399
|
+
/**
|
|
400
|
+
* The model's content height plus the heights of open detail rows (master/detail).
|
|
401
|
+
*
|
|
402
|
+
* @returns {number} px
|
|
403
|
+
* @since 1.1.97
|
|
404
|
+
*/
|
|
405
|
+
/** The detail layer (master/detail) covers the visible body. @since 1.1.97 */
|
|
406
|
+
protected adjustDetailLayerBounds(left: number, top: number, width: number, height: number): void;
|
|
407
|
+
protected getBodyContentHeight(): number;
|
|
260
408
|
/** Scrollable range of the content in content pixels (content height minus visible body height). */
|
|
261
409
|
protected getContentScrollRangeY(): number;
|
|
262
410
|
/** Scrollable range of the scroll viewport in scroll bar pixels. */
|
|
@@ -469,6 +617,12 @@ export declare class RenderScope extends EleScope {
|
|
|
469
617
|
*
|
|
470
618
|
* @returns {void}
|
|
471
619
|
*/
|
|
620
|
+
/**
|
|
621
|
+
* Hides the hover row and column – e.g. while the pointer is over a detail row (master/detail).
|
|
622
|
+
*
|
|
623
|
+
* @since 1.1.97
|
|
624
|
+
*/
|
|
625
|
+
hideHover(): void;
|
|
472
626
|
protected hideHoverRow(): void;
|
|
473
627
|
/**
|
|
474
628
|
* Adjusts the position and size of the hover column based on the mouse move event.
|
|
@@ -6,5 +6,5 @@ import { RendererCleanupFnType } from '../renderer-cleanup-fn.type.js';
|
|
|
6
6
|
|
|
7
7
|
/** @category Renderers & editing */
|
|
8
8
|
export declare class InputCellRenderer implements CellRendererIf {
|
|
9
|
-
render(cellDiv: HTMLDivElement, rowIndex: number, columnIndex: number, areaIdent: AreaIdent, areaModel: AreaModelIf,
|
|
9
|
+
render(cellDiv: HTMLDivElement, rowIndex: number, columnIndex: number, areaIdent: AreaIdent, areaModel: AreaModelIf, cellValue: any, domService: DomServiceIf): RendererCleanupFnType | undefined;
|
|
10
10
|
}
|
|
@@ -10,5 +10,5 @@ export declare class SelectCellRenderer implements CellRendererIf {
|
|
|
10
10
|
protected options: ValueLabelIf[];
|
|
11
11
|
constructor(options: ValueLabelIf[]);
|
|
12
12
|
static create(values: string[]): SelectCellRenderer;
|
|
13
|
-
render(cellDiv: HTMLDivElement, rowIndex: number, columnIndex: number, areaIdent: AreaIdent, areaModel: AreaModelIf,
|
|
13
|
+
render(cellDiv: HTMLDivElement, rowIndex: number, columnIndex: number, areaIdent: AreaIdent, areaModel: AreaModelIf, cellValue: any, domService: DomServiceIf): RendererCleanupFnType | undefined;
|
|
14
14
|
}
|