@ember-lattice/ember 0.0.0-stage → 1.1.0
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/CHANGELOG.md +71 -0
- package/LICENSE.md +21 -0
- package/NOTICE +30 -0
- package/README.md +176 -2
- package/addon-main.cjs +4 -0
- package/declarations/board/declarations.d.ts +129 -0
- package/declarations/board/declarations.d.ts.map +1 -0
- package/declarations/board/lattice-board.d.ts +153 -0
- package/declarations/board/lattice-board.d.ts.map +1 -0
- package/declarations/grid/alignment.d.ts +30 -0
- package/declarations/grid/alignment.d.ts.map +1 -0
- package/declarations/grid/auto-columns.d.ts +22 -0
- package/declarations/grid/auto-columns.d.ts.map +1 -0
- package/declarations/grid/cell-state.d.ts +17 -0
- package/declarations/grid/cell-state.d.ts.map +1 -0
- package/declarations/grid/clipboard.d.ts +7 -0
- package/declarations/grid/clipboard.d.ts.map +1 -0
- package/declarations/grid/columns/column-def.d.ts +120 -0
- package/declarations/grid/columns/column-def.d.ts.map +1 -0
- package/declarations/grid/columns/declarations.d.ts +212 -0
- package/declarations/grid/columns/declarations.d.ts.map +1 -0
- package/declarations/grid/columns/memo.d.ts +32 -0
- package/declarations/grid/columns/memo.d.ts.map +1 -0
- package/declarations/grid/columns/owned-table.d.ts +40 -0
- package/declarations/grid/columns/owned-table.d.ts.map +1 -0
- package/declarations/grid/columns/registry.d.ts +13 -0
- package/declarations/grid/columns/registry.d.ts.map +1 -0
- package/declarations/grid/keyboard.d.ts +24 -0
- package/declarations/grid/keyboard.d.ts.map +1 -0
- package/declarations/grid/lattice-grid.d.ts +854 -0
- package/declarations/grid/lattice-grid.d.ts.map +1 -0
- package/declarations/grid/row-number.d.ts +24 -0
- package/declarations/grid/row-number.d.ts.map +1 -0
- package/declarations/grid/selection.d.ts +24 -0
- package/declarations/grid/selection.d.ts.map +1 -0
- package/declarations/grid/state-host.d.ts +66 -0
- package/declarations/grid/state-host.d.ts.map +1 -0
- package/declarations/grid/types.d.ts +417 -0
- package/declarations/grid/types.d.ts.map +1 -0
- package/declarations/index.d.ts +27 -0
- package/declarations/index.d.ts.map +1 -0
- package/declarations/list/lattice-list.d.ts +184 -0
- package/declarations/list/lattice-list.d.ts.map +1 -0
- package/dist/index.js +5031 -0
- package/dist/index.js.map +1 -0
- package/package.json +92 -3
|
@@ -0,0 +1,854 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import type { SafeString } from '@ember/template';
|
|
3
|
+
import { ScaledScroll, VirtualizerState } from '@ember-lattice/virtual';
|
|
4
|
+
import type { ComponentLike } from '@glint/template';
|
|
5
|
+
import { CellStateStore } from './cell-state.ts';
|
|
6
|
+
import { GridStateHandle } from './state-host.ts';
|
|
7
|
+
import { GridAlignment } from './alignment.ts';
|
|
8
|
+
import type { AlignedColumns, AlignedGrid } from './alignment.ts';
|
|
9
|
+
import { ColumnRegistry } from './columns/registry.ts';
|
|
10
|
+
import type { GridState } from './columns/owned-table.ts';
|
|
11
|
+
import type { BlockCell, Declaration, GridColumns } from './columns/declarations';
|
|
12
|
+
import type { LatticeLocale, LatticeLocaleTextOverride } from '@ember-lattice/core';
|
|
13
|
+
import type { GridHostState, GridStateTarget } from './state-host.ts';
|
|
14
|
+
import type { CellPosition } from './keyboard.ts';
|
|
15
|
+
import type { GridCell, GridChromeApi, GridEngineTable, GridContextMenuApi, GridContextTarget, GridEditCell, GridColumn, GridEditing, GridEditTrigger, GridFind, GridGroupInfo, GridHeader, GridNotes, GridRange, GridRow, GridRowEditorField, GridRowComponentSignature, GridRowDrop, GridRowModel, GridRowMove, GridTable, LatticeCellSignature, LatticeHeaderLabelSignature, GridHeaderApi, LatticeColumnMeta, LatticeHeaderSignature, PinSide } from './types.ts';
|
|
16
|
+
export interface LatticeGridSignature<T = unknown> {
|
|
17
|
+
Element: HTMLDivElement;
|
|
18
|
+
Args: {
|
|
19
|
+
/**
|
|
20
|
+
* The engine form: a table from `@ember-lattice/core` `constructTable`. Give `@table` or
|
|
21
|
+
* `@data`, not both.
|
|
22
|
+
*/
|
|
23
|
+
table?: GridTable;
|
|
24
|
+
/**
|
|
25
|
+
* The template form (ADR 0028): the data rows. The grid makes and owns the table, with the
|
|
26
|
+
* columns that its block declares (`<g.Column>`). A new array shows; no `setOptions` call.
|
|
27
|
+
*/
|
|
28
|
+
data?: ReadonlyArray<T>;
|
|
29
|
+
/**
|
|
30
|
+
* The template form: more engine features, with their row models (`tableFeatures` keys). The
|
|
31
|
+
* grid has sizing, resizing, sorting, visibility, ordering, pinning and row selection.
|
|
32
|
+
*/
|
|
33
|
+
features?: Record<string, unknown>;
|
|
34
|
+
/** The template form: the table state of the first render (`initialState`). */
|
|
35
|
+
initialState?: GridState;
|
|
36
|
+
/** The template form: the controlled table state, by slice. Give `@onStateChange` too. */
|
|
37
|
+
state?: GridState;
|
|
38
|
+
/** The template form: called with the whole table state after each change of a slice. */
|
|
39
|
+
onStateChange?: (state: GridState) => void;
|
|
40
|
+
/** The accessible name of the grid. */
|
|
41
|
+
label: string;
|
|
42
|
+
/**
|
|
43
|
+
* The fixed row height in px. Default: the computed `--lt-row-height`. `'auto'`: each row
|
|
44
|
+
* has the measured height of its content.
|
|
45
|
+
*/
|
|
46
|
+
rowHeight?: number | 'auto';
|
|
47
|
+
/** True for a row that renders one cell across all columns, with `@fullWidthRow`. */
|
|
48
|
+
isFullWidthRow?: (row: GridRow) => boolean;
|
|
49
|
+
/** The component of a full-width row. */
|
|
50
|
+
fullWidthRow?: ComponentLike<GridRowComponentSignature>;
|
|
51
|
+
/** Master/detail: each row gets a toggle that shows this component in a row under it. */
|
|
52
|
+
detailRow?: ComponentLike<GridRowComponentSignature>;
|
|
53
|
+
/** The rows that have a detail row. Default: all rows. */
|
|
54
|
+
hasDetail?: (row: GridRow) => boolean;
|
|
55
|
+
/** True while the rows load: the loading overlay shows and the grid is `aria-busy`. */
|
|
56
|
+
loading?: boolean;
|
|
57
|
+
/** Row drag: a drag handle (`meta.lattice.rowDrag`) or Alt+arrows move a row in this grid. */
|
|
58
|
+
onRowMove?: (move: GridRowMove) => void;
|
|
59
|
+
/** A row of another grid is dropped on this grid. */
|
|
60
|
+
onRowDrop?: (drop: GridRowDrop) => void;
|
|
61
|
+
/** The number of rows outside the view on each side. Default: 4. */
|
|
62
|
+
overscan?: number;
|
|
63
|
+
/**
|
|
64
|
+
* More options of the table that the grid makes, for a feature that has no arg: for example
|
|
65
|
+
* `globalFilterFn` or `autoResetCellSelection`. The grid reads them when it makes the table.
|
|
66
|
+
* With `@table`, give the options to `constructTable`.
|
|
67
|
+
*/
|
|
68
|
+
tableOptions?: Record<string, unknown>;
|
|
69
|
+
/**
|
|
70
|
+
* The ID of a row. With `@data`: the ID of a data row, as the table option `getRowId`. With
|
|
71
|
+
* `@table`: the ID of a grid row. Default: the table row ID.
|
|
72
|
+
*/
|
|
73
|
+
getRowId?: (row: never) => string;
|
|
74
|
+
/** Called on Enter or a double click on a data cell that does not open an editor. */
|
|
75
|
+
onCellActivate?: (target: {
|
|
76
|
+
row: GridRow;
|
|
77
|
+
column: GridColumn;
|
|
78
|
+
}) => void;
|
|
79
|
+
/**
|
|
80
|
+
* A row model from `@ember-lattice/data`. Default: the rows of the table. In the template form,
|
|
81
|
+
* give a function that makes the model from the table that the grid owns, for example
|
|
82
|
+
* `ServerRowModel.forGrid({ source })`. `@data` is then optional.
|
|
83
|
+
*/
|
|
84
|
+
rowModel?: GridRowModel<T> | ((table: GridTable) => GridRowModel<T>);
|
|
85
|
+
/**
|
|
86
|
+
* The handle that saves and restores the scroll offset and the active cell, from
|
|
87
|
+
* `LatticeGrid.stateHost()`. Give the same handle to `persistGridState` as `host`.
|
|
88
|
+
*/
|
|
89
|
+
stateHost?: GridStateHandle;
|
|
90
|
+
/** The editing plug-in: an `EditController` from `@ember-lattice/editing`. */
|
|
91
|
+
editing?: GridEditing;
|
|
92
|
+
/**
|
|
93
|
+
* The pointer action that opens a cell editor: `singleClick`, `doubleClick` or `none` (only the
|
|
94
|
+
* keys). A column `meta.lattice.editTrigger` wins. Default: `doubleClick`.
|
|
95
|
+
*/
|
|
96
|
+
editTrigger?: GridEditTrigger;
|
|
97
|
+
/** True: when the focus leaves the editor for a place outside it, the edit saves. Default: false. */
|
|
98
|
+
stopEditingWhenCellsLoseFocus?: boolean;
|
|
99
|
+
/** The density preset on `.lt-grid` (`data-lt-density`). Default: `normal`. */
|
|
100
|
+
density?: 'compact' | 'normal' | 'comfortable';
|
|
101
|
+
/** The find hook: each cell gets `data-find-match` from `matchAt(rowId, columnId)`. */
|
|
102
|
+
find?: GridFind;
|
|
103
|
+
/** A floating filter for each column: the grid adds a header row with one for each column. */
|
|
104
|
+
floatingFilter?: ComponentLike<LatticeHeaderSignature>;
|
|
105
|
+
/** Called on a right click, Shift+F10 or the ContextMenu key on a body cell. */
|
|
106
|
+
onCellContextMenu?: (target: GridContextTarget) => void;
|
|
107
|
+
/** The external filter: client rows (not pinned rows) that give false do not show. */
|
|
108
|
+
externalFilter?: (row: GridRow) => boolean;
|
|
109
|
+
/** The notes hook: a cell with a note has a mark, and hover or focus shows the note. */
|
|
110
|
+
notes?: GridNotes;
|
|
111
|
+
/** The alignment of this grid with other grids (`LatticeGrid.alignment()`). */
|
|
112
|
+
aligned?: GridAlignment;
|
|
113
|
+
/** The locale of the column type formats (`meta.columnType`) and of the numbers in the text. Default: the owner locale. */
|
|
114
|
+
locale?: string;
|
|
115
|
+
/** Locale text that replaces the owner text and the English defaults for this grid (ADR 0024). */
|
|
116
|
+
localeText?: LatticeLocaleTextOverride;
|
|
117
|
+
};
|
|
118
|
+
Blocks: {
|
|
119
|
+
/** The template form: the declarations of the columns (`<g.Column>`). They render no element. */
|
|
120
|
+
default: [GridColumns<T>];
|
|
121
|
+
/**
|
|
122
|
+
* The template form: the declarations, when the grid also gets another named block
|
|
123
|
+
* (`<:sideBar>`, for example). Glimmer then needs the declarations in a named block.
|
|
124
|
+
*/
|
|
125
|
+
columns: [GridColumns<T>];
|
|
126
|
+
/** The side bar, at the inline end of `div.lt-grid-root`, outside `role=grid`. */
|
|
127
|
+
/**
|
|
128
|
+
* Before `div.lt-grid-root`, in `div.lt-toolbar-region`: a toolbar (`Toolbar` of
|
|
129
|
+
* `@ember-lattice/ui`, for example). It gets the grid API.
|
|
130
|
+
*/
|
|
131
|
+
toolbar: [GridChromeApi];
|
|
132
|
+
/** After `div.lt-grid-root`, in `div.lt-status-bar-region`: a status bar. It gets the grid API. */
|
|
133
|
+
statusBar: [GridChromeApi];
|
|
134
|
+
sideBar: [GridChromeApi];
|
|
135
|
+
/** A context menu, in `.lt-overlay`. It gets the request target and the grid actions. */
|
|
136
|
+
contextMenu: [GridContextMenuApi];
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* One leaf column in a row. The list has all columns in their order, so a change of the column
|
|
141
|
+
* range never moves a cell element: it only adds or removes cells (focus stays on the cell).
|
|
142
|
+
*/
|
|
143
|
+
interface ColumnSlot {
|
|
144
|
+
key: string;
|
|
145
|
+
column: GridColumn;
|
|
146
|
+
/** False for a center column outside the range: it has no element. */
|
|
147
|
+
rendered: boolean;
|
|
148
|
+
/** A spacer before the cell, for the center columns before it that are not rendered. */
|
|
149
|
+
gap: SafeString | null;
|
|
150
|
+
/** The 1-based `aria-colindex`. */
|
|
151
|
+
aria: number;
|
|
152
|
+
pin: PinSide;
|
|
153
|
+
size: number;
|
|
154
|
+
style: SafeString;
|
|
155
|
+
component: ComponentLike<LatticeCellSignature> | null;
|
|
156
|
+
/** The template form: the column has a `<:cell>` block (`meta.lattice.cellBlock`). */
|
|
157
|
+
block: boolean;
|
|
158
|
+
full: boolean;
|
|
159
|
+
/** The template form: the column has a `<:header>` block. */
|
|
160
|
+
headerBlock: boolean;
|
|
161
|
+
/** The template form: the column has a `<:headerEnd>` block. */
|
|
162
|
+
headerEndBlock: boolean;
|
|
163
|
+
/** The header slot component (`meta.lattice.header`). */
|
|
164
|
+
headerSlot: ComponentLike<LatticeHeaderSignature> | null;
|
|
165
|
+
/** The component in place of the header label text (`meta.lattice.headerLabel`). */
|
|
166
|
+
headerLabel: ComponentLike<LatticeHeaderLabelSignature> | null;
|
|
167
|
+
/** The row number column: the cell shows the display position. */
|
|
168
|
+
rowNumber: boolean;
|
|
169
|
+
/** The cell has a row drag handle. */
|
|
170
|
+
rowDrag: boolean;
|
|
171
|
+
/** `meta.lattice.cellDescription` and `cellInvalid`. */
|
|
172
|
+
describe: LatticeColumnMeta['cellDescription'] | null;
|
|
173
|
+
invalid: LatticeColumnMeta['cellInvalid'] | null;
|
|
174
|
+
}
|
|
175
|
+
/** The cells of a row and the spacer after the center range when no column is end-pinned. */
|
|
176
|
+
interface RowLayout {
|
|
177
|
+
slots: ColumnSlot[];
|
|
178
|
+
tail: SafeString | null;
|
|
179
|
+
}
|
|
180
|
+
/** A header cell in a group row. */
|
|
181
|
+
interface GroupSlot {
|
|
182
|
+
key: string;
|
|
183
|
+
header: GridHeader;
|
|
184
|
+
label: string;
|
|
185
|
+
aria: number;
|
|
186
|
+
colSpan: number;
|
|
187
|
+
pin: PinSide;
|
|
188
|
+
style: SafeString;
|
|
189
|
+
}
|
|
190
|
+
/** A data row in a slot or in the held layer. */
|
|
191
|
+
interface RowView {
|
|
192
|
+
row: GridRow;
|
|
193
|
+
id: string;
|
|
194
|
+
/** The 0-based index in the row model. */
|
|
195
|
+
index: number;
|
|
196
|
+
/** True for the active row: it stays rendered also outside the range. */
|
|
197
|
+
held: boolean;
|
|
198
|
+
style: SafeString;
|
|
199
|
+
/** The 1-based `aria-level` in a treegrid. */
|
|
200
|
+
level: number | undefined;
|
|
201
|
+
group: GridGroupInfo | undefined;
|
|
202
|
+
/** `aria-expanded`: a group row or a tree row with sub rows. */
|
|
203
|
+
expanded: 'true' | 'false' | undefined;
|
|
204
|
+
/** True for a tree row with sub rows: its first cell has a toggle before the value. */
|
|
205
|
+
treeToggle: boolean;
|
|
206
|
+
/** True for an open group or tree row: it sticks under the header while its rows scroll. */
|
|
207
|
+
sticky: boolean;
|
|
208
|
+
/** A pinned row (the engine row pinning): it stays at the top or the bottom of the view. */
|
|
209
|
+
pinned: 'top' | 'bottom' | undefined;
|
|
210
|
+
/** True for a full-width row (`@isFullWidthRow`): one cell across all columns. */
|
|
211
|
+
fullWidth: boolean;
|
|
212
|
+
}
|
|
213
|
+
/** The detail row of a master row (`@detailRow`): one cell across all columns. */
|
|
214
|
+
interface DetailView {
|
|
215
|
+
row: undefined;
|
|
216
|
+
master: GridRow;
|
|
217
|
+
id: string;
|
|
218
|
+
index: number;
|
|
219
|
+
held: boolean;
|
|
220
|
+
style: SafeString;
|
|
221
|
+
}
|
|
222
|
+
/** A row that is not loaded: skeleton cells, `aria-busy`, or `data-failed`. */
|
|
223
|
+
interface SkeletonView {
|
|
224
|
+
row: undefined;
|
|
225
|
+
id: string;
|
|
226
|
+
index: number;
|
|
227
|
+
held: boolean;
|
|
228
|
+
failed: boolean;
|
|
229
|
+
style: SafeString;
|
|
230
|
+
level: number | undefined;
|
|
231
|
+
}
|
|
232
|
+
type AnyView = RowView | SkeletonView | DetailView;
|
|
233
|
+
export default class LatticeGrid<T = unknown> extends Component<LatticeGridSignature<T>> implements GridStateTarget, AlignedGrid {
|
|
234
|
+
/** A new `GridStateHost` for `persistGridState` and `@stateHost` (ADR 0011). */
|
|
235
|
+
static stateHost: () => GridStateHandle;
|
|
236
|
+
/** A new `GridAlignment`: give it to `@aligned` of each grid to align (contract section 11). */
|
|
237
|
+
static alignment: () => GridAlignment;
|
|
238
|
+
cellState: CellStateStore;
|
|
239
|
+
scale: ScaledScroll;
|
|
240
|
+
/** The active cell, as `aria-rowindex` and `aria-colindex`. Null: the first data cell. */
|
|
241
|
+
private _activeCell;
|
|
242
|
+
/** The text direction of the grid, read after it renders. Undefined before that. */
|
|
243
|
+
dir: 'ltr' | 'rtl' | undefined;
|
|
244
|
+
/** The locale text and the locale of this grid (ADR 0024): `@localeText`, then the owner. */
|
|
245
|
+
get l(): LatticeLocale;
|
|
246
|
+
get rtl(): boolean;
|
|
247
|
+
private get _active();
|
|
248
|
+
private set _active(value);
|
|
249
|
+
private pool;
|
|
250
|
+
private _element;
|
|
251
|
+
private _scroller;
|
|
252
|
+
private _suppressClick;
|
|
253
|
+
/**
|
|
254
|
+
* The grid for its row components. The row type `T` is for Glint at the call site of the grid;
|
|
255
|
+
* the rows of the grid do not read it.
|
|
256
|
+
*/
|
|
257
|
+
get rowHost(): LatticeGrid;
|
|
258
|
+
/** What the chrome blocks get: the table and the grid root. */
|
|
259
|
+
get chromeApi(): GridChromeApi;
|
|
260
|
+
/**
|
|
261
|
+
* The table for the chrome blocks and the state handle. `@table` is a table from
|
|
262
|
+
* `constructTable`, and the grid makes its own table with `constructTable`.
|
|
263
|
+
*/
|
|
264
|
+
get engineTable(): GridEngineTable;
|
|
265
|
+
registry: ColumnRegistry<Declaration>;
|
|
266
|
+
private ownedTable;
|
|
267
|
+
/**
|
|
268
|
+
* The table: `@table`, or with `@data`, the table that the grid makes from its declarations. The
|
|
269
|
+
* grid makes it at the first read, after its declarations block (ADR 0028).
|
|
270
|
+
*/
|
|
271
|
+
get table(): GridTable;
|
|
272
|
+
/**
|
|
273
|
+
* The row model: `@rowModel`, or the model that the `@rowModel` function makes from the table.
|
|
274
|
+
* The grid calls the function again only when it changes.
|
|
275
|
+
*/
|
|
276
|
+
get rowModel(): GridRowModel | undefined;
|
|
277
|
+
private builtModel;
|
|
278
|
+
/**
|
|
279
|
+
* The columns of the table that the grid owns: the declarations, then the columns that the row
|
|
280
|
+
* model adds (the pivot columns of the server row model).
|
|
281
|
+
*/
|
|
282
|
+
get ownedColumns(): ReadonlyArray<object>;
|
|
283
|
+
/**
|
|
284
|
+
* The column defs of the template form: the declarations, in template order, or with no
|
|
285
|
+
* declarations, one column for each key of the first rows. The array is the same while the
|
|
286
|
+
* declarations do not change, so the memos of the table hold.
|
|
287
|
+
*/
|
|
288
|
+
get declaredColumns(): ReadonlyArray<object>;
|
|
289
|
+
private warnedFeatures;
|
|
290
|
+
/**
|
|
291
|
+
* In development, one warning for each column arg whose engine feature the grid does not have.
|
|
292
|
+
* The engine ignores the option then. `warn` is a no-op in production builds.
|
|
293
|
+
*/
|
|
294
|
+
private warnMissingFeatures;
|
|
295
|
+
/** The auto columns change only when the keys of the first rows change. */
|
|
296
|
+
private get autoColumns();
|
|
297
|
+
private autoMemo;
|
|
298
|
+
private makeTable;
|
|
299
|
+
private anchors;
|
|
300
|
+
private anchorKey;
|
|
301
|
+
private blockKey;
|
|
302
|
+
/** The anchor of a block cell, in the cell element: one for each slot and column. */
|
|
303
|
+
anchorFor: (slot: number, cell: ColumnSlot) => HTMLElement;
|
|
304
|
+
/** The block cells of the rendered rows, by column ID. */
|
|
305
|
+
get blockCells(): ReadonlyMap<string, BlockCell[]>;
|
|
306
|
+
get hasBlockCells(): boolean;
|
|
307
|
+
blockCellsOf: (id: string) => ReadonlyArray<BlockCell>;
|
|
308
|
+
cellFor: (row: GridRow, column: GridColumn) => GridCell;
|
|
309
|
+
private lazyRowState;
|
|
310
|
+
private lazyColState;
|
|
311
|
+
get rowState(): VirtualizerState;
|
|
312
|
+
get colState(): VirtualizerState;
|
|
313
|
+
/** The computed `--lt-row-height`, for the density presets when `@rowHeight` is not given. */
|
|
314
|
+
private _cssRowHeight;
|
|
315
|
+
get rowHeight(): number;
|
|
316
|
+
private readRowHeight;
|
|
317
|
+
get rows(): ReadonlyArray<GridRow>;
|
|
318
|
+
/** The pinned rows of the engine row pinning, and a function for the other rows. */
|
|
319
|
+
get pinnedRows(): {
|
|
320
|
+
top: readonly GridRow[];
|
|
321
|
+
bottom: readonly GridRow[];
|
|
322
|
+
center: () => readonly GridRow[];
|
|
323
|
+
};
|
|
324
|
+
/** The heights of the pinned top rows and bottom rows. */
|
|
325
|
+
get pinnedTopHeight(): number;
|
|
326
|
+
get pinnedBottomHeight(): number;
|
|
327
|
+
/** True when rows float: sticky group rows or pinned rows read the view offsets from CSS. */
|
|
328
|
+
get floats(): boolean;
|
|
329
|
+
/**
|
|
330
|
+
* The view top and the view bottom, in body px, as CSS variables on the scroller. The floating
|
|
331
|
+
* rows read them, so a scroll moves them with no render (ADR 0018).
|
|
332
|
+
*/
|
|
333
|
+
private writeViewVars;
|
|
334
|
+
/** The number of body rows: the rows of the row model, or of the table, and detail rows. */
|
|
335
|
+
get rowCount(): number;
|
|
336
|
+
/** The row at a 0-based index, or undefined when it is not loaded (or a detail row). */
|
|
337
|
+
rowAt(index: number): GridRow | undefined;
|
|
338
|
+
/** Moves a row in this grid: the app moves it in its data. The live region says the move. */
|
|
339
|
+
private moveRow;
|
|
340
|
+
/** Alt+ArrowUp and Alt+ArrowDown move the row of the active cell, and the active cell. */
|
|
341
|
+
private moveKey;
|
|
342
|
+
/** A press on a drag handle: the drop row is under the pointer, in this grid or in another. */
|
|
343
|
+
onRowDragStart: (row: GridRow, fromIndex: number, event: PointerEvent) => void;
|
|
344
|
+
/** True when the table has the engine cell spanning feature (client rows only). */
|
|
345
|
+
get spanning(): boolean;
|
|
346
|
+
/**
|
|
347
|
+
* The span of a cell, or undefined for a cell of one row and one column. A cell that a cell
|
|
348
|
+
* above covers leaves a spacer of the width of its column span; a cell that a cell before it covers leaves
|
|
349
|
+
* nothing, because the spanning cell is as wide as all its columns.
|
|
350
|
+
*/
|
|
351
|
+
spanOf: (row: GridRow, slot: ColumnSlot) => {
|
|
352
|
+
covered: boolean;
|
|
353
|
+
spacer: null;
|
|
354
|
+
rowSpan?: undefined;
|
|
355
|
+
colSpan?: undefined;
|
|
356
|
+
style?: undefined;
|
|
357
|
+
} | {
|
|
358
|
+
covered: boolean;
|
|
359
|
+
spacer: import("@ember/template").TrustedHTML;
|
|
360
|
+
rowSpan?: undefined;
|
|
361
|
+
colSpan?: undefined;
|
|
362
|
+
style?: undefined;
|
|
363
|
+
} | {
|
|
364
|
+
covered: boolean;
|
|
365
|
+
spacer: null;
|
|
366
|
+
rowSpan: number | undefined;
|
|
367
|
+
colSpan: number | undefined;
|
|
368
|
+
style: import("@ember/template").TrustedHTML;
|
|
369
|
+
} | undefined;
|
|
370
|
+
/** The first row of each row span that covers a row: it stays rendered with its merged cell. */
|
|
371
|
+
private spanAnchors;
|
|
372
|
+
/** A row with a cell that spans rows paints over the rows under it. */
|
|
373
|
+
private spansDown;
|
|
374
|
+
/** The IDs of the master rows with an open detail row. */
|
|
375
|
+
private _details;
|
|
376
|
+
hasDetail: (row: GridRow) => boolean;
|
|
377
|
+
isDetailOpen: (row: GridRow) => boolean;
|
|
378
|
+
toggleDetail: (row: GridRow) => void;
|
|
379
|
+
/** The client rows with a detail row after each open master row (a detail row is undefined). */
|
|
380
|
+
get display(): {
|
|
381
|
+
rows: ReadonlyArray<GridRow | undefined>;
|
|
382
|
+
details: ReadonlyMap<number, GridRow>;
|
|
383
|
+
};
|
|
384
|
+
get fullWidthComponent(): ComponentLike<GridRowComponentSignature> | undefined;
|
|
385
|
+
get detailComponent(): ComponentLike<GridRowComponentSignature> | undefined;
|
|
386
|
+
/** A full-width cell spans the rows: it is as wide as all columns. */
|
|
387
|
+
get fullWidthStyle(): import("@ember/template").TrustedHTML;
|
|
388
|
+
/** The tab stop of a full-width cell: it is the active cell for any column of its row. */
|
|
389
|
+
rowTabIndex: (ariaRow: number) => 0 | -1;
|
|
390
|
+
/** True when rows have measured heights: `@rowHeight="auto"`, or an open detail row. */
|
|
391
|
+
get measured(): boolean;
|
|
392
|
+
/** The key of a row for the measured sizes: its row ID, so a size stays with its row. */
|
|
393
|
+
private keyAt;
|
|
394
|
+
/** The virtual start of a row: measured, or the fixed row height. */
|
|
395
|
+
private startOf;
|
|
396
|
+
/** Measures a row element (ResizeObserver, through the virtualizer), as `LatticeList` does. */
|
|
397
|
+
measureRow: import("ember-modifier").FunctionBasedModifier<{
|
|
398
|
+
Args: {
|
|
399
|
+
Positional: [number, boolean];
|
|
400
|
+
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
401
|
+
};
|
|
402
|
+
Element: HTMLElement;
|
|
403
|
+
}>;
|
|
404
|
+
toggleGroup: (index: number) => void;
|
|
405
|
+
/** True for a row that Enter opens and closes: a group row, or a tree row with sub rows. */
|
|
406
|
+
private isToggleRow;
|
|
407
|
+
/** Client rows have levels when the table has the engine expanding feature (ADR 0018). */
|
|
408
|
+
get clientTree(): boolean;
|
|
409
|
+
/** The group of a client group row: the label is the group value and the leaf row count. */
|
|
410
|
+
private clientGroup;
|
|
411
|
+
get headerGroups(): readonly import("./types.ts").GridHeaderGroup[];
|
|
412
|
+
/** The header rows: the group rows, the leaf header row and the floating filter row. */
|
|
413
|
+
get headerRowCount(): number;
|
|
414
|
+
/** The `aria-rowindex` of the floating filter row, or 0 when there is none. */
|
|
415
|
+
get floatingRow(): number;
|
|
416
|
+
get headerHeight(): number;
|
|
417
|
+
get columns(): {
|
|
418
|
+
start: GridColumn[];
|
|
419
|
+
center: readonly GridColumn[];
|
|
420
|
+
end: readonly GridColumn[];
|
|
421
|
+
all: GridColumn[];
|
|
422
|
+
centerSizes: number[];
|
|
423
|
+
centerStarts: number[];
|
|
424
|
+
startWidth: number;
|
|
425
|
+
centerWidth: number;
|
|
426
|
+
endWidth: number;
|
|
427
|
+
};
|
|
428
|
+
get totalWidth(): number;
|
|
429
|
+
get colCount(): number;
|
|
430
|
+
/** The active cell, kept inside the grid when rows or columns go away. */
|
|
431
|
+
get activeCell(): CellPosition;
|
|
432
|
+
/** The 0-based data row of the active cell, or -1 when it is a header cell. */
|
|
433
|
+
get activeIndex(): number;
|
|
434
|
+
tabIndexFor: (ariaRow: number, ariaCol: number) => 0 | -1;
|
|
435
|
+
rowIdOf: (row: GridRow) => string;
|
|
436
|
+
valueFor: (row: GridRow, column: GridColumn) => unknown;
|
|
437
|
+
/** The text of a cheap cell: a staged or saving value of `@editing` first. */
|
|
438
|
+
textFor: (row: GridRow, column: GridColumn) => string;
|
|
439
|
+
isDirty: (row: GridRow, column: GridColumn) => boolean;
|
|
440
|
+
stateFor: (rowId: string, column: GridColumn) => import("./cell-state.ts").CellState;
|
|
441
|
+
findMatch: (row: GridRow, column: GridColumn) => "current" | "match" | undefined;
|
|
442
|
+
get density(): "compact" | "normal" | "comfortable";
|
|
443
|
+
contains: (element: Element) => boolean;
|
|
444
|
+
/** The cells of one row, in visual order: start-pinned, the center range, end-pinned. */
|
|
445
|
+
get layout(): RowLayout;
|
|
446
|
+
/** The leaf header cells, in the same layout as the rows. */
|
|
447
|
+
get leafHeaders(): Map<string, GridHeader>;
|
|
448
|
+
/** The group header rows, above the leaf header row. They are not virtualized. */
|
|
449
|
+
get groupRows(): Array<{
|
|
450
|
+
key: string;
|
|
451
|
+
aria: number;
|
|
452
|
+
cells: GroupSlot[];
|
|
453
|
+
}>;
|
|
454
|
+
/** The sticky inset of a pinned column: the sizes of the pinned columns nearer the edge. */
|
|
455
|
+
private insetOf;
|
|
456
|
+
headerLabelFor: (column: GridColumn) => string;
|
|
457
|
+
/** The `aria-rowindex` of the leaf header row: the last row of column headers. */
|
|
458
|
+
get leafHeaderRow(): number;
|
|
459
|
+
/** The size of the sizer element: the rows, scaled above the cap (ADR 0003). */
|
|
460
|
+
get sizerStyle(): import("@ember/template").TrustedHTML;
|
|
461
|
+
get bodyHeight(): number;
|
|
462
|
+
get bodyStyle(): import("@ember/template").TrustedHTML;
|
|
463
|
+
get rowWidthStyle(): import("@ember/template").TrustedHTML;
|
|
464
|
+
private view;
|
|
465
|
+
/**
|
|
466
|
+
* An open group row sticks under the header, one row height lower for each level, while its
|
|
467
|
+
* rows scroll. The last row of its group pushes it up. `--lt-view-top` is the scroll offset in
|
|
468
|
+
* body px: a scroll listener sets it, so a scroll moves the row with no render (ADR 0018).
|
|
469
|
+
*/
|
|
470
|
+
private stickyStyle;
|
|
471
|
+
/**
|
|
472
|
+
* The last row of the group of each client row: the row before the next row that is not deeper.
|
|
473
|
+
* One pass over the rows when they change, so a scroll reads it with no scan (ADR 0018).
|
|
474
|
+
*/
|
|
475
|
+
private get groupEnds();
|
|
476
|
+
/** `top` or `bottom` for a pinned row: the first rows and the last rows of the list. */
|
|
477
|
+
private pinnedAt;
|
|
478
|
+
/** A pinned row floats at the top or the bottom of the view, as a sticky row does. */
|
|
479
|
+
private pinnedStyle;
|
|
480
|
+
/** The index of each client row by its row ID, to find the parent rows of a row. */
|
|
481
|
+
private get clientIndexes();
|
|
482
|
+
/** The open parent rows of the rows in range: they stick at the top, so they stay rendered. */
|
|
483
|
+
private parentsOf;
|
|
484
|
+
/**
|
|
485
|
+
* The row slots. A row keeps its slot while it is in range, so the slot element and its
|
|
486
|
+
* cells stay. A row that comes into range takes a free slot. The active row keeps its slot
|
|
487
|
+
* also when it leaves the range: this is the held row (ADR 0002), with its DOM focus.
|
|
488
|
+
*/
|
|
489
|
+
get slots(): Array<AnyView | null>;
|
|
490
|
+
setup: import("ember-modifier").FunctionBasedModifier<{
|
|
491
|
+
Args: {
|
|
492
|
+
Positional: unknown[];
|
|
493
|
+
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
494
|
+
};
|
|
495
|
+
Element: HTMLElement;
|
|
496
|
+
}>;
|
|
497
|
+
/** Give the row virtualizer the current row count and sizes. It runs after render. */
|
|
498
|
+
syncRows: import("ember-modifier").FunctionBasedModifier<{
|
|
499
|
+
Args: {
|
|
500
|
+
Positional: [number, number, number, number, number, number, number, boolean, unknown];
|
|
501
|
+
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
502
|
+
};
|
|
503
|
+
Element: HTMLElement;
|
|
504
|
+
}>;
|
|
505
|
+
/** Tell the row model the rows in view, and the query, after each render. */
|
|
506
|
+
syncModel: import("ember-modifier").FunctionBasedModifier<{
|
|
507
|
+
Args: {
|
|
508
|
+
Positional: [GridRowModel<unknown> | undefined, number, number, string | undefined];
|
|
509
|
+
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
510
|
+
};
|
|
511
|
+
Element: HTMLElement;
|
|
512
|
+
}>;
|
|
513
|
+
/** The first row in view and the row after the last, for `syncModel`. */
|
|
514
|
+
get range(): [number, number];
|
|
515
|
+
private _warned;
|
|
516
|
+
/**
|
|
517
|
+
* In development, warn once when a full cell column is on a grid of more than 100,000 rows.
|
|
518
|
+
* Each new row in view then makes new components, which is slow (ADR 0002). `warn` is a no-op
|
|
519
|
+
* in production builds.
|
|
520
|
+
*/
|
|
521
|
+
private warnFullCells;
|
|
522
|
+
/** Give the column virtualizer the center column sizes and the pinned widths. */
|
|
523
|
+
syncCols: import("ember-modifier").FunctionBasedModifier<{
|
|
524
|
+
Args: {
|
|
525
|
+
Positional: [readonly number[], number, number, boolean];
|
|
526
|
+
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
527
|
+
};
|
|
528
|
+
Element: HTMLElement;
|
|
529
|
+
}>;
|
|
530
|
+
private positionOf;
|
|
531
|
+
onFocusIn: (event: FocusEvent) => void;
|
|
532
|
+
private cellElement;
|
|
533
|
+
private focusActive;
|
|
534
|
+
/** Make a cell the active cell, scroll it into view, and focus it after the render. */
|
|
535
|
+
private activate;
|
|
536
|
+
private get pageRows();
|
|
537
|
+
onKeyDown: (event: KeyboardEvent) => void;
|
|
538
|
+
/** Shift+F10 and the ContextMenu key (APG). */
|
|
539
|
+
private menuKey;
|
|
540
|
+
/** F2 or Enter: focus the first control in a header slot or a floating filter cell. */
|
|
541
|
+
private enterWidget;
|
|
542
|
+
/** Escape in a header slot or a floating filter: the focus goes back to its cell. */
|
|
543
|
+
private leaveWidget;
|
|
544
|
+
/** The cell of the open context menu, for the `contextMenu` block. */
|
|
545
|
+
contextTarget: GridContextTarget | null;
|
|
546
|
+
/** True after a key opened the menu: the `contextmenu` event of the same key is ignored. */
|
|
547
|
+
private _keyMenu;
|
|
548
|
+
private openContextMenu;
|
|
549
|
+
/** A right click on a body cell. With no hook and no block, the browser menu opens. */
|
|
550
|
+
/** True when the grid has a context menu: the `contextMenu` block or `@onCellContextMenu`. */
|
|
551
|
+
private get _hasMenu();
|
|
552
|
+
private _menuBlock;
|
|
553
|
+
/** The template tells the grid when it has a `contextMenu` block. */
|
|
554
|
+
noteMenuBlock: import("ember-modifier").FunctionBasedModifier<{
|
|
555
|
+
Args: {
|
|
556
|
+
Positional: [boolean];
|
|
557
|
+
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
558
|
+
};
|
|
559
|
+
Element: HTMLElement;
|
|
560
|
+
}>;
|
|
561
|
+
onContextMenu: (hasMenu: boolean, event: MouseEvent) => void;
|
|
562
|
+
closeMenu: () => void;
|
|
563
|
+
/** The selection as TSV, for a menu "Copy". With headers: the header labels come first. */
|
|
564
|
+
copyText: (withHeaders?: boolean) => string;
|
|
565
|
+
/** Pastes TSV at the start corner of the last range, through `@editing` (one undo step). */
|
|
566
|
+
pasteText: (text: string) => Promise<void>;
|
|
567
|
+
/** The last grid message (a sort, a refused paste), for the live region. */
|
|
568
|
+
liveMessage: string;
|
|
569
|
+
get countMessage(): string;
|
|
570
|
+
private announceSort;
|
|
571
|
+
/** The index of a row by its ID (with a row model: of a loaded row), or -1. */
|
|
572
|
+
private indexOfRow;
|
|
573
|
+
scrollToCell(rowId: string, columnId: string): boolean;
|
|
574
|
+
/** Opens the editor of a cell, as F2 does (`GridStateHandle.startEditing`). */
|
|
575
|
+
startEditing(rowId: string, columnId: string): boolean;
|
|
576
|
+
private columnAt;
|
|
577
|
+
private activateCell;
|
|
578
|
+
onDoubleClick: (event: MouseEvent) => void;
|
|
579
|
+
/** A click opens the editor of a column with the `singleClick` trigger. */
|
|
580
|
+
onClick: (event: MouseEvent) => void;
|
|
581
|
+
/**
|
|
582
|
+
* Opens the editor for a pointer action, when it is the trigger of the column. A click with a
|
|
583
|
+
* modifier key (a range) or on a button or a link in the cell does not open it. A click on a
|
|
584
|
+
* display input (the stars of a rating) opens it. True: the editor opens.
|
|
585
|
+
*/
|
|
586
|
+
private pointerEdit;
|
|
587
|
+
get selectable(): boolean;
|
|
588
|
+
get multiSelect(): boolean;
|
|
589
|
+
get multiselectable(): boolean;
|
|
590
|
+
/** True when the table has the cell selection feature: ranges of cells. */
|
|
591
|
+
get cellSelectable(): boolean;
|
|
592
|
+
/** Client rows use the engine ranges. With `@rowModel`, the grid owns one range. */
|
|
593
|
+
get engineRanges(): boolean;
|
|
594
|
+
/** The grid range with `@rowModel`: two corners as 0-based row and column indexes. */
|
|
595
|
+
private _range;
|
|
596
|
+
/** The cell ranges, or the active cell as a range when there is no range. */
|
|
597
|
+
get selection(): GridRange[];
|
|
598
|
+
/** `aria-selected` of a cell: in a range (or the active cell when there is no range). */
|
|
599
|
+
cellSelected: (index: number, ariaCol: number) => "true" | "false" | undefined;
|
|
600
|
+
/** The logical edges of the ranges that a cell sits on, for the range borders of the theme. */
|
|
601
|
+
rangeEdge: (index: number, ariaCol: number) => string | undefined;
|
|
602
|
+
/** The fill handle is on the end corner of the last range. */
|
|
603
|
+
isFillCorner: (index: number, ariaCol: number) => boolean;
|
|
604
|
+
/** The cell at 0-based display indexes, or undefined outside the loaded rows. */
|
|
605
|
+
cellRefAt(index: number, col: number): GridEditCell | undefined;
|
|
606
|
+
/** The cells of a range, row by row. */
|
|
607
|
+
private cellsOf;
|
|
608
|
+
/** Makes the cell at a position the one-cell range: a move with no Shift. */
|
|
609
|
+
private focusSelection;
|
|
610
|
+
/** Shift+arrows extend the last range; Ctrl+A selects all cells. */
|
|
611
|
+
private rangeKey;
|
|
612
|
+
/** Moves the focus corner of the grid range (`@rowModel`), from the active cell at first. */
|
|
613
|
+
private extendOwnRange;
|
|
614
|
+
/** The engine cell under a mouse event, for a press (a range start) or a drag. */
|
|
615
|
+
private engineCell;
|
|
616
|
+
/** A press starts a range; Shift extends the last range, Ctrl adds a range (the engine). */
|
|
617
|
+
onMouseDown: (event: MouseEvent) => void;
|
|
618
|
+
onMouseOver: (event: MouseEvent) => void;
|
|
619
|
+
onMouseOut: (event: MouseEvent) => void;
|
|
620
|
+
onFocusOut: (event: FocusEvent) => void;
|
|
621
|
+
/** The loading message, or "No rows" for an empty grid. Outside `role=grid`, as a status. */
|
|
622
|
+
get overlayMessage(): string;
|
|
623
|
+
tooltipId: string;
|
|
624
|
+
/** The cell of the tooltip, its text and its place in the viewport. */
|
|
625
|
+
tooltip: {
|
|
626
|
+
row: number;
|
|
627
|
+
col: number;
|
|
628
|
+
text: string;
|
|
629
|
+
style: SafeString;
|
|
630
|
+
} | null;
|
|
631
|
+
/**
|
|
632
|
+
* The `aria-describedby` of a cell: its own description (`meta.lattice.cellDescription`), then
|
|
633
|
+
* the open tooltip and the open note.
|
|
634
|
+
*/
|
|
635
|
+
describedBy: (index: number, slot: ColumnSlot, row: GridRow) => string | undefined;
|
|
636
|
+
/** `aria-invalid` of a cell, from `meta.lattice.cellInvalid`. */
|
|
637
|
+
invalidFor: (row: GridRow, slot: ColumnSlot) => "true" | undefined;
|
|
638
|
+
private descriptionId;
|
|
639
|
+
/** The descriptions of the rendered cells, in a hidden list outside `role=grid`. */
|
|
640
|
+
get cellDescriptions(): Array<{
|
|
641
|
+
id: string;
|
|
642
|
+
text: string;
|
|
643
|
+
}>;
|
|
644
|
+
noteId: string;
|
|
645
|
+
/** The cell of the open note and its text. */
|
|
646
|
+
note: {
|
|
647
|
+
row: number;
|
|
648
|
+
col: number;
|
|
649
|
+
text: string;
|
|
650
|
+
} | null;
|
|
651
|
+
hasNote: (row: GridRow, column: GridColumn) => boolean;
|
|
652
|
+
private showNote;
|
|
653
|
+
private hideNote;
|
|
654
|
+
/**
|
|
655
|
+
* Puts the note under its cell, by measurement as in `placeEditor`, and again on each scroll.
|
|
656
|
+
* When the tooltip of the same cell is open, the note goes under the tooltip, so they do not
|
|
657
|
+
* overlap. When the cell is not rendered, the note hides.
|
|
658
|
+
*/
|
|
659
|
+
placeNote: import("ember-modifier").FunctionBasedModifier<{
|
|
660
|
+
Args: {
|
|
661
|
+
Positional: [CellPosition | null, CellPosition | null];
|
|
662
|
+
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
663
|
+
};
|
|
664
|
+
Element: HTMLElement;
|
|
665
|
+
}>;
|
|
666
|
+
private showTooltip;
|
|
667
|
+
private hideTooltip;
|
|
668
|
+
/** A touch press that stays this long, in ms, opens the context menu. */
|
|
669
|
+
static LONG_PRESS: number;
|
|
670
|
+
/** A long press on a body cell opens the context menu, as a right click does. */
|
|
671
|
+
onPointerDown: (event: PointerEvent) => void;
|
|
672
|
+
/** Ends the long press that runs: a `contextmenu` event (Android) opens the menu in its place. */
|
|
673
|
+
private _stopPress;
|
|
674
|
+
private onBodyCell;
|
|
675
|
+
/** Puts the ranges on the clipboard as TSV and HTML. False: not a copy from a body cell. */
|
|
676
|
+
private writeClipboard;
|
|
677
|
+
onCopy: (event: ClipboardEvent) => void;
|
|
678
|
+
/** A copy, then a clear of the cells through `@editing` (one undo step). */
|
|
679
|
+
onCut: (event: ClipboardEvent) => void;
|
|
680
|
+
/** Pastes TSV at the start corner of the last range, through `@editing` (one undo step). */
|
|
681
|
+
onPaste: (event: ClipboardEvent) => void;
|
|
682
|
+
/** A drag of the fill handle: down or to the inline end, whichever is farther. */
|
|
683
|
+
onFillStart: (event: PointerEvent) => void;
|
|
684
|
+
private fill;
|
|
685
|
+
/**
|
|
686
|
+
* Ctrl+D copies the top row of the range into the rows under it, and Ctrl+R copies the first
|
|
687
|
+
* column into the columns at its inline end, as spreadsheets do. In one row (or one column),
|
|
688
|
+
* the source is the row above (or the column at the inline start). It is one undo step, through
|
|
689
|
+
* the same `fill` as the fill handle. A row number cell is never a source or a target.
|
|
690
|
+
*/
|
|
691
|
+
private fillKey;
|
|
692
|
+
editorId: string;
|
|
693
|
+
/** The cell in edit, as `aria-rowindex` and `aria-colindex`. It can differ from the active cell. */
|
|
694
|
+
private _editPosition;
|
|
695
|
+
get editPosition(): CellPosition | null;
|
|
696
|
+
/** The edit mode of the edited column: `popup` puts the editor under the cell. */
|
|
697
|
+
get editMode(): "cell" | "popup";
|
|
698
|
+
/** The fields of a full-row edit: the rendered columns that `@editing` can edit. */
|
|
699
|
+
get rowEditFields(): GridRowEditorField[];
|
|
700
|
+
/** The 1-based number of the edited row, for the name of the row editor. */
|
|
701
|
+
get editRowNumber(): number;
|
|
702
|
+
get editInvalid(): boolean;
|
|
703
|
+
/** Enter or F2 opens the editor; a typed key opens it with the key; Ctrl+Z and Ctrl+Y. */
|
|
704
|
+
private editKey;
|
|
705
|
+
/** Opens the editor on the cell (or the row editor), then moves the focus into it. */
|
|
706
|
+
private startEdit;
|
|
707
|
+
/**
|
|
708
|
+
* Focuses the element with the editor ID. When that element cannot take the focus (a
|
|
709
|
+
* fieldset, the root of a calendar), the focus goes to its checked or current item, else to
|
|
710
|
+
* its first control.
|
|
711
|
+
*/
|
|
712
|
+
private focusEditor;
|
|
713
|
+
/** The commit of a press or a focus change: only one at a time, and only while in edit. */
|
|
714
|
+
private _pressCommit;
|
|
715
|
+
private commitOnce;
|
|
716
|
+
/** With `@stopEditingWhenCellsLoseFocus`: the focus goes outside the overlay, so the edit saves. */
|
|
717
|
+
onEditorFocusOut: (event: FocusEvent) => void;
|
|
718
|
+
/** With `@stopEditingWhenCellsLoseFocus`: a press outside the grid saves the edit. */
|
|
719
|
+
saveOnOutsidePress: import("ember-modifier").FunctionBasedModifier<{
|
|
720
|
+
Args: {
|
|
721
|
+
Positional: [boolean | undefined];
|
|
722
|
+
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
723
|
+
};
|
|
724
|
+
Element: HTMLElement;
|
|
725
|
+
}>;
|
|
726
|
+
/** Escape cancels; Enter commits and moves down; Tab commits and moves to the inline end. */
|
|
727
|
+
onEditorKeyDown: (event: KeyboardEvent) => void;
|
|
728
|
+
/**
|
|
729
|
+
* Escape cancels the edit. It runs in the capture phase: a control can stop the key in the
|
|
730
|
+
* bubble phase (a closed combobox clears its text). A layer in the editor that Escape closes
|
|
731
|
+
* (a list, a popover) cancels the key first, and then the edit stays open.
|
|
732
|
+
*/
|
|
733
|
+
onEditorEscape: (event: KeyboardEvent) => void;
|
|
734
|
+
private commitRowAndMove;
|
|
735
|
+
private commitAndMove;
|
|
736
|
+
/**
|
|
737
|
+
* Puts the editor on the edited cell. It measures where the editor lands and moves it by the
|
|
738
|
+
* difference, so it works in any containing block and with a scaled page. It does this again
|
|
739
|
+
* on each scroll, so the editor follows its cell. The edited row is held (ADR 0002, amendment 1):
|
|
740
|
+
* when the cell leaves the view, the editor is clipped, not hidden, so its control keeps focus.
|
|
741
|
+
*/
|
|
742
|
+
placeEditor: import("ember-modifier").FunctionBasedModifier<{
|
|
743
|
+
Args: {
|
|
744
|
+
Positional: [CellPosition | null];
|
|
745
|
+
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
746
|
+
};
|
|
747
|
+
Element: HTMLElement;
|
|
748
|
+
}>;
|
|
749
|
+
/**
|
|
750
|
+
* Puts the row editor over the edited row, and each field over its cell, by measurement as in
|
|
751
|
+
* `placeEditor`. It does this again on each scroll.
|
|
752
|
+
*/
|
|
753
|
+
placeRowEditor: import("ember-modifier").FunctionBasedModifier<{
|
|
754
|
+
Args: {
|
|
755
|
+
Positional: [CellPosition | null];
|
|
756
|
+
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
757
|
+
};
|
|
758
|
+
Element: HTMLElement;
|
|
759
|
+
}>;
|
|
760
|
+
/** The scroll offset (virtual px, ADR 0003) and the active cell that the user chose. */
|
|
761
|
+
readState(): Required<GridHostState>;
|
|
762
|
+
applyState(state: GridHostState): void;
|
|
763
|
+
private toggleSort;
|
|
764
|
+
private sortBy;
|
|
765
|
+
/** True for an event from a header slot or a control in the label: no sort and no drag. */
|
|
766
|
+
private inSlot;
|
|
767
|
+
onHeaderClick: (column: GridColumn, event: MouseEvent) => void;
|
|
768
|
+
/** A separator needs the column resizing feature, and `enableResizing` not false. */
|
|
769
|
+
canResize: (column: GridColumn) => boolean;
|
|
770
|
+
private resize;
|
|
771
|
+
onResizeKey: (column: GridColumn, event: KeyboardEvent) => void;
|
|
772
|
+
onResizeStart: (column: GridColumn, event: PointerEvent) => void;
|
|
773
|
+
stopClick: (event: MouseEvent) => void;
|
|
774
|
+
/** A double click on the separator sizes the column to its content. */
|
|
775
|
+
onResizeDoubleClick: (column: GridColumn, event: MouseEvent) => void;
|
|
776
|
+
/** The flex columns that a resize or an auto-size took out of flex. */
|
|
777
|
+
private _fixedFlex;
|
|
778
|
+
/** The width and the fixed sizes of the last flex pass: the same input needs no pass. */
|
|
779
|
+
private _flexKey;
|
|
780
|
+
private _flexFrame;
|
|
781
|
+
private isFlex;
|
|
782
|
+
/** The table as core `applyFlexWidths` and `autoSizeColumns` read it. */
|
|
783
|
+
private get sizingTable();
|
|
784
|
+
/** Runs a flex pass in the next frame: a size write in a ResizeObserver callback can loop. */
|
|
785
|
+
private scheduleFlex;
|
|
786
|
+
private applyFlex;
|
|
787
|
+
/**
|
|
788
|
+
* The grid API of the header slots and the floating filters (`@grid`). With no IDs, it sizes
|
|
789
|
+
* the columns that have a separator: a column that cannot resize keeps its size.
|
|
790
|
+
*/
|
|
791
|
+
headerApi: GridHeaderApi;
|
|
792
|
+
/** Sizes columns to their widest rendered content (`GridStateHandle.autoSizeColumns`). */
|
|
793
|
+
autoSizeColumns(columnIds?: ReadonlyArray<string>): void;
|
|
794
|
+
/**
|
|
795
|
+
* The width of the widest rendered content of a column, in CSS px: the header label and slot,
|
|
796
|
+
* and the body and total cells. Undefined when no cell of the column is rendered.
|
|
797
|
+
*/
|
|
798
|
+
private measureColumn;
|
|
799
|
+
/** True when the table has no columns and has rows: the grid makes columns from the rows. */
|
|
800
|
+
get wantsAutoColumns(): boolean;
|
|
801
|
+
/** Sets the auto columns after the render in which the first rows show. */
|
|
802
|
+
syncAutoColumns: import("ember-modifier").FunctionBasedModifier<{
|
|
803
|
+
Args: {
|
|
804
|
+
Positional: [boolean];
|
|
805
|
+
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
806
|
+
};
|
|
807
|
+
Element: HTMLElement;
|
|
808
|
+
}>;
|
|
809
|
+
/** A table with no columns gets a column for each key of its first rows. */
|
|
810
|
+
private setAutoColumns;
|
|
811
|
+
private _alignment;
|
|
812
|
+
private _leaveAlignment;
|
|
813
|
+
/** The column state that aligned grids share: a change of it runs `syncAligned`. */
|
|
814
|
+
get alignedKey(): string;
|
|
815
|
+
alignedColumns(): AlignedColumns;
|
|
816
|
+
alignColumns(state: AlignedColumns): void;
|
|
817
|
+
/** The offset that an aligned grid set: the scroll event of it is not sent back. */
|
|
818
|
+
private _alignedLeft;
|
|
819
|
+
alignScroll(left: number): void;
|
|
820
|
+
/** Sends a horizontal scroll to the aligned grids, but not one that came from them. */
|
|
821
|
+
private scrolledAligned;
|
|
822
|
+
/**
|
|
823
|
+
* Joins `@aligned` on the first run; later runs send a column change to the other grids. The
|
|
824
|
+
* work waits until the render ends: it reads and writes the other tables, and a modifier
|
|
825
|
+
* tracks what it reads.
|
|
826
|
+
*/
|
|
827
|
+
syncAligned: import("ember-modifier").FunctionBasedModifier<{
|
|
828
|
+
Args: {
|
|
829
|
+
Positional: [GridAlignment | undefined, string | undefined];
|
|
830
|
+
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
831
|
+
};
|
|
832
|
+
Element: HTMLElement;
|
|
833
|
+
}>;
|
|
834
|
+
willDestroy(): void;
|
|
835
|
+
onHeaderPointerDown: (column: GridColumn, event: PointerEvent) => void;
|
|
836
|
+
private moveColumn;
|
|
837
|
+
get rowDraft(): Readonly<Record<string, unknown>>;
|
|
838
|
+
setRowValue: (columnId: string, value: unknown) => void | undefined;
|
|
839
|
+
get rangeStart(): number;
|
|
840
|
+
get rangeEnd(): number;
|
|
841
|
+
/** All rows plus the header rows, or -1 when the row model does not know the count (ARIA). */
|
|
842
|
+
get ariaRowCount(): number;
|
|
843
|
+
get footerHeight(): number;
|
|
844
|
+
/** The grand total row is after the last row. */
|
|
845
|
+
get totalAriaRow(): number;
|
|
846
|
+
/** The total row stays at the bottom of the view while the rows scroll. */
|
|
847
|
+
get footerStyle(): import("@ember/template").TrustedHTML;
|
|
848
|
+
get role(): "treegrid" | "grid";
|
|
849
|
+
get overscan(): number;
|
|
850
|
+
/** The row height when `@rowHeight` is given, and the flex size beside a side bar. */
|
|
851
|
+
gridStyle: (split: boolean) => import("@ember/template").TrustedHTML | undefined;
|
|
852
|
+
}
|
|
853
|
+
export {};
|
|
854
|
+
//# sourceMappingURL=lattice-grid.d.ts.map
|