@olvnck/ingrid 0.0.0-stage → 0.15.21
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 +13 -0
- package/LICENSE +21 -0
- package/README.md +5535 -2
- package/THIRD_PARTY_NOTICES.md +10 -0
- package/dist/engine/clipboard/copy.d.ts +40 -0
- package/dist/engine/clipboard/options.d.ts +16 -0
- package/dist/engine/clipboard/text.d.ts +32 -0
- package/dist/engine/columns/autosize.d.ts +43 -0
- package/dist/engine/columns/dataType.d.ts +30 -0
- package/dist/engine/columns/fold.d.ts +48 -0
- package/dist/engine/columns/layout.d.ts +150 -0
- package/dist/engine/columns/model.d.ts +369 -0
- package/dist/engine/columns/query.d.ts +16 -0
- package/dist/engine/columns/tooltips.d.ts +27 -0
- package/dist/engine/data/client/clientSource.d.ts +151 -0
- package/dist/engine/data/client/columnFilters.d.ts +106 -0
- package/dist/engine/data/client/descendants.d.ts +35 -0
- package/dist/engine/data/client/diff.d.ts +23 -0
- package/dist/engine/data/client/fields.d.ts +70 -0
- package/dist/engine/data/client/filter.d.ts +95 -0
- package/dist/engine/data/client/flatten.d.ts +141 -0
- package/dist/engine/data/client/groupSize.d.ts +14 -0
- package/dist/engine/data/client/hierarchy.d.ts +85 -0
- package/dist/engine/data/client/order.d.ts +32 -0
- package/dist/engine/data/client/pipeline.d.ts +277 -0
- package/dist/engine/data/client/remap.d.ts +33 -0
- package/dist/engine/data/client/trees.d.ts +41 -0
- package/dist/engine/data/client/types.d.ts +173 -0
- package/dist/engine/data/memory/generate.d.ts +36 -0
- package/dist/engine/data/memory/memoryDatasource.d.ts +46 -0
- package/dist/engine/data/rowKey.d.ts +15 -0
- package/dist/engine/data/server/contract.d.ts +64 -0
- package/dist/engine/data/server/expansion.d.ts +35 -0
- package/dist/engine/data/server/levelStore.d.ts +99 -0
- package/dist/engine/data/server/loader.d.ts +128 -0
- package/dist/engine/data/server/reader.d.ts +88 -0
- package/dist/engine/data/server/response.d.ts +31 -0
- package/dist/engine/data/server/serverSource.d.ts +130 -0
- package/dist/engine/data/shared/aggregate.d.ts +12 -0
- package/dist/engine/data/shared/columnFilter.d.ts +19 -0
- package/dist/engine/data/shared/compare.d.ts +12 -0
- package/dist/engine/data/shared/dateParts.d.ts +19 -0
- package/dist/engine/data/shared/distinct.d.ts +30 -0
- package/dist/engine/data/shared/filterRecord.d.ts +7 -0
- package/dist/engine/data/shared/keys.d.ts +17 -0
- package/dist/engine/data/shared/quickFilter.d.ts +17 -0
- package/dist/engine/data/shared/sourceUtils.d.ts +11 -0
- package/dist/engine/data/shared/splice.d.ts +9 -0
- package/dist/engine/detail/builds.d.ts +26 -0
- package/dist/engine/detail/content.d.ts +24 -0
- package/dist/engine/detail/controller.d.ts +176 -0
- package/dist/engine/detail/events.d.ts +11 -0
- package/dist/engine/detail/follow.d.ts +56 -0
- package/dist/engine/detail/layer.d.ts +119 -0
- package/dist/engine/detail/live.d.ts +96 -0
- package/dist/engine/detail/options.d.ts +53 -0
- package/dist/engine/detail/state.d.ts +140 -0
- package/dist/engine/edit/clear.d.ts +20 -0
- package/dist/engine/edit/editing.d.ts +4 -0
- package/dist/engine/edit/editors/date.d.ts +3 -0
- package/dist/engine/edit/editors/index.d.ts +23 -0
- package/dist/engine/edit/editors/internals.d.ts +25 -0
- package/dist/engine/edit/editors/largeText.d.ts +2 -0
- package/dist/engine/edit/editors/number.d.ts +4 -0
- package/dist/engine/edit/editors/select.d.ts +2 -0
- package/dist/engine/edit/editors/text.d.ts +15 -0
- package/dist/engine/edit/fill.d.ts +47 -0
- package/dist/engine/edit/fillHandle.d.ts +66 -0
- package/dist/engine/edit/fillValues.d.ts +15 -0
- package/dist/engine/edit/operations.d.ts +68 -0
- package/dist/engine/edit/paste.d.ts +23 -0
- package/dist/engine/edit/pastePlan.d.ts +17 -0
- package/dist/engine/edit/popupHost.d.ts +63 -0
- package/dist/engine/edit/session.d.ts +52 -0
- package/dist/engine/edit/types.d.ts +234 -0
- package/dist/engine/edit/undo.d.ts +38 -0
- package/dist/engine/edit/validation.d.ts +10 -0
- package/dist/engine/edit/values.d.ts +38 -0
- package/dist/engine/export/columns.d.ts +19 -0
- package/dist/engine/export/deliver.d.ts +47 -0
- package/dist/engine/export/dsv.d.ts +2 -0
- package/dist/engine/export/expanded.d.ts +69 -0
- package/dist/engine/export/export.d.ts +25 -0
- package/dist/engine/export/headers.d.ts +15 -0
- package/dist/engine/export/options.d.ts +19 -0
- package/dist/engine/export/plan.d.ts +43 -0
- package/dist/engine/export/values.d.ts +33 -0
- package/dist/engine/export/walk.d.ts +31 -0
- package/dist/engine/export/writer.d.ts +62 -0
- package/dist/engine/export/xlsx/cells.d.ts +31 -0
- package/dist/engine/export/xlsx/index.d.ts +12 -0
- package/dist/engine/export/xlsx/parts.d.ts +36 -0
- package/dist/engine/export/xlsx/sheet.d.ts +30 -0
- package/dist/engine/export/xlsx/styles.d.ts +15 -0
- package/dist/engine/export/xlsx/table.d.ts +8 -0
- package/dist/engine/export/xlsx/zip.d.ts +24 -0
- package/dist/engine/filter/groupFilter.d.ts +28 -0
- package/dist/engine/filter/model.d.ts +235 -0
- package/dist/engine/filter/shorthand.d.ts +36 -0
- package/dist/engine/filter/state.d.ts +76 -0
- package/dist/engine/filter/summary.d.ts +16 -0
- package/dist/engine/filter/values.d.ts +40 -0
- package/dist/engine/find/index.d.ts +94 -0
- package/dist/engine/find/match.d.ts +38 -0
- package/dist/engine/find/model.d.ts +115 -0
- package/dist/engine/grid.d.ts +42 -0
- package/dist/engine/i18n/numbers.d.ts +34 -0
- package/dist/engine/i18n/texts.d.ts +306 -0
- package/dist/engine/interact/autoScroll.d.ts +11 -0
- package/dist/engine/interact/body.d.ts +41 -0
- package/dist/engine/interact/focus.d.ts +158 -0
- package/dist/engine/interact/header.d.ts +216 -0
- package/dist/engine/interact/host.d.ts +400 -0
- package/dist/engine/interact/keyboard.d.ts +20 -0
- package/dist/engine/interact/menuKey.d.ts +7 -0
- package/dist/engine/interact/own.d.ts +2 -0
- package/dist/engine/interact/ranges.d.ts +68 -0
- package/dist/engine/interact/rowSelection.d.ts +53 -0
- package/dist/engine/interact/shortcut.d.ts +21 -0
- package/dist/engine/interact/tooltips.d.ts +63 -0
- package/dist/engine/measure.d.ts +30 -0
- package/dist/engine/render/cells.d.ts +322 -0
- package/dist/engine/render/columns.d.ts +28 -0
- package/dist/engine/render/dom.d.ts +24 -0
- package/dist/engine/render/flash.d.ts +74 -0
- package/dist/engine/render/groupCell.d.ts +50 -0
- package/dist/engine/render/groupPanel.d.ts +21 -0
- package/dist/engine/render/header.d.ts +162 -0
- package/dist/engine/render/overlay.d.ts +15 -0
- package/dist/engine/render/pinnedRows.d.ts +106 -0
- package/dist/engine/render/rowPool.d.ts +3 -0
- package/dist/engine/render/scrollbars.d.ts +77 -0
- package/dist/engine/render/strategy.d.ts +397 -0
- package/dist/engine/reportError.d.ts +7 -0
- package/dist/engine/rowdrag/controller.d.ts +80 -0
- package/dist/engine/rowdrag/events.d.ts +17 -0
- package/dist/engine/rowdrag/gesture.d.ts +33 -0
- package/dist/engine/rowdrag/keys.d.ts +21 -0
- package/dist/engine/rowdrag/model.d.ts +67 -0
- package/dist/engine/rowdrag/options.d.ts +34 -0
- package/dist/engine/rowdrag/rows.d.ts +61 -0
- package/dist/engine/rowdrag/target.d.ts +59 -0
- package/dist/engine/rowdrag/zones.d.ts +79 -0
- package/dist/engine/schedule.d.ts +29 -0
- package/dist/engine/selection/aggregate.d.ts +30 -0
- package/dist/engine/selection/options.d.ts +7 -0
- package/dist/engine/selection/rangeRows.d.ts +19 -0
- package/dist/engine/selection/ranges.d.ts +114 -0
- package/dist/engine/selection/rows.d.ts +207 -0
- package/dist/engine/source.d.ts +225 -0
- package/dist/engine/synthetic.d.ts +28 -0
- package/dist/engine/table/cells.d.ts +52 -0
- package/dist/engine/table/headers.d.ts +20 -0
- package/dist/engine/table/host.d.ts +65 -0
- package/dist/engine/table/job.d.ts +21 -0
- package/dist/engine/table/rows.d.ts +99 -0
- package/dist/engine/table/slicer.d.ts +54 -0
- package/dist/engine/table/takes.d.ts +145 -0
- package/dist/engine/types.d.ts +2950 -0
- package/dist/engine/ui/announce.d.ts +7 -0
- package/dist/engine/ui/chooser.d.ts +19 -0
- package/dist/engine/ui/columnList.d.ts +41 -0
- package/dist/engine/ui/columnMenu.d.ts +96 -0
- package/dist/engine/ui/columnsPanel.d.ts +16 -0
- package/dist/engine/ui/contextMenu.d.ts +48 -0
- package/dist/engine/ui/controller.d.ts +295 -0
- package/dist/engine/ui/filters/apply.d.ts +53 -0
- package/dist/engine/ui/filters/custom.d.ts +3 -0
- package/dist/engine/ui/filters/date.d.ts +12 -0
- package/dist/engine/ui/filters/host.d.ts +102 -0
- package/dist/engine/ui/filters/multi.d.ts +6 -0
- package/dist/engine/ui/filters/number.d.ts +15 -0
- package/dist/engine/ui/filters/numberMask.d.ts +15 -0
- package/dist/engine/ui/filters/set.d.ts +3 -0
- package/dist/engine/ui/filters/simple.d.ts +52 -0
- package/dist/engine/ui/filters/text.d.ts +5 -0
- package/dist/engine/ui/filtersPanel.d.ts +18 -0
- package/dist/engine/ui/floating.d.ts +66 -0
- package/dist/engine/ui/floatingShorthand.d.ts +20 -0
- package/dist/engine/ui/floatingTypes.d.ts +82 -0
- package/dist/engine/ui/icons.d.ts +25 -0
- package/dist/engine/ui/menu.d.ts +45 -0
- package/dist/engine/ui/overlayHost.d.ts +7 -0
- package/dist/engine/ui/place.d.ts +37 -0
- package/dist/engine/ui/popup.d.ts +97 -0
- package/dist/engine/ui/sideBar.d.ts +26 -0
- package/dist/engine/ui/statusBar.d.ts +29 -0
- package/dist/engine/ui/toolbar/buttons.d.ts +21 -0
- package/dist/engine/ui/toolbar/chipState.d.ts +52 -0
- package/dist/engine/ui/toolbar/chips.d.ts +23 -0
- package/dist/engine/ui/toolbar/findBox.d.ts +10 -0
- package/dist/engine/ui/toolbar/quickFilterBox.d.ts +12 -0
- package/dist/engine/ui/toolbar/registry.d.ts +5 -0
- package/dist/engine/ui/toolbar/toolbar.d.ts +31 -0
- package/dist/engine/ui/toolbar/types.d.ts +23 -0
- package/dist/engine/ui/tooltip.d.ts +34 -0
- package/dist/engine/ui/virtualList.d.ts +35 -0
- package/dist/engine/viewport/heightView.d.ts +62 -0
- package/dist/engine/viewport/heights.d.ts +39 -0
- package/dist/engine/viewport/intervals.d.ts +19 -0
- package/dist/engine/viewport/range.d.ts +51 -0
- package/dist/engine/viewport/scroll.d.ts +45 -0
- package/dist/engine/viewport/stack.d.ts +160 -0
- package/dist/grid-C34VEap6.js +32310 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +1273 -0
- package/dist/ingrid.css +1 -0
- package/dist/internal.d.ts +13 -0
- package/dist/internal.js +1 -0
- package/dist/locale/de.d.ts +4 -0
- package/dist/locale/de.js +222 -0
- package/dist/themes/primevue.css +63 -0
- package/dist/themes/tailwind.css +68 -0
- package/dist/vue/InGrid.vue.d.ts +263 -0
- package/dist/vue/stableOptions.d.ts +8 -0
- package/dist/vue/useClientSource.d.ts +28 -0
- package/dist/vue/useServerSource.d.ts +8 -0
- package/dist/vue/vueRenderer.d.ts +164 -0
- package/dist/xlsx-59umS_n_.js +325 -0
- package/package.json +78 -5
|
@@ -0,0 +1,2950 @@
|
|
|
1
|
+
import type { ClientSourceOptions } from './data/client/types';
|
|
2
|
+
import type { GroupKey } from './data/server/contract';
|
|
3
|
+
import type { DatePart } from './data/shared/dateParts';
|
|
4
|
+
import type { ColumnFilterModel, FilterDefaults, FilterModel, FilterOption, GroupSizeFilterDef } from './filter/model';
|
|
5
|
+
import type { GridTexts, LocaleOptions } from './i18n/texts';
|
|
6
|
+
import type { FilterValues, RowInfo, ViewportSource } from './source';
|
|
7
|
+
import type { RowRange } from './viewport/range';
|
|
8
|
+
export type { RowRange };
|
|
9
|
+
/** Everything a custom cell renderer needs to draw one cell. */
|
|
10
|
+
export interface CellContext {
|
|
11
|
+
/** The display row; in a pinned row its index in its section (`pinned`). */
|
|
12
|
+
row: number;
|
|
13
|
+
column: ColumnDef;
|
|
14
|
+
value: unknown;
|
|
15
|
+
text: string;
|
|
16
|
+
loaded: boolean;
|
|
17
|
+
/** Group-column cells: the row's metadata (a copy). */
|
|
18
|
+
info?: RowInfo;
|
|
19
|
+
/** A pinned row's section: `'top'` or `'bottom'`; absent in a body row. */
|
|
20
|
+
pinned?: 'top' | 'bottom';
|
|
21
|
+
/**
|
|
22
|
+
* Writes the cell's value through the grid's write path (the column's `setValue`, else
|
|
23
|
+
* `row[field]`); true when written, and then `onCellValueChanged` fires and the row is drawn again. Present only
|
|
24
|
+
* in data columns, on loaded data rows of a source that can write (`ViewportSource.writeCell`) and in pinned rows
|
|
25
|
+
* (written into the app's object, whatever the source); not in a column over a computed field (a client
|
|
26
|
+
* `FieldDef.value` getter) without its own `setValue`. Bound to this
|
|
27
|
+
* context: once the cell is due to be drawn again (a write, a refresh, a reset, a block reload), or
|
|
28
|
+
* shows another row (scrolled, recycled, moved by a data change), it writes nothing and returns false — use the
|
|
29
|
+
* context of the latest `update`. A control that changes itself (a checkbox) restores its state on false.
|
|
30
|
+
*/
|
|
31
|
+
setValue?: (value: unknown) => boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Find: the cell's searched text split by the find term — `text`, or the column's `findText`
|
|
34
|
+
* string — with the active occurrence's part flagged `activeMatch`; present while a term is set and the cell holds
|
|
35
|
+
* a match. A renderer draws its own marks from it (the grid marks plain-text cells only). A change of the term, the
|
|
36
|
+
* options or the active match calls `update` again only on the cells whose parts changed: on `findNext`, the old
|
|
37
|
+
* and the new active match's.
|
|
38
|
+
*/
|
|
39
|
+
find?: readonly FindPart[];
|
|
40
|
+
}
|
|
41
|
+
export interface CellRendererInstance {
|
|
42
|
+
/** Called on every (re)bind of the cell and whenever its data changes. */
|
|
43
|
+
update(ctx: CellContext): void;
|
|
44
|
+
destroy(): void;
|
|
45
|
+
}
|
|
46
|
+
/** Creates one instance per pooled cell element; instances are reused while scrolling. */
|
|
47
|
+
export interface CellRenderer {
|
|
48
|
+
create(host: HTMLElement): CellRendererInstance;
|
|
49
|
+
}
|
|
50
|
+
export type SortDirection = 'asc' | 'desc';
|
|
51
|
+
export type PinnedSide = 'left' | 'right';
|
|
52
|
+
/** The header icons an app can replace, with the column group chevrons. */
|
|
53
|
+
export type HeaderIconName = 'menu' | 'filter' | 'filterActive' | 'sortAscending' | 'sortDescending' | 'columnGroupClosed' | 'columnGroupOpened' | 'chevronLeft' | 'chevronRight' | 'sort' | 'group' | 'groupSize' | 'eyeOff' | 'moved';
|
|
54
|
+
/** One SVG path per icon in a 16 × 16 view box, drawn even-odd; an empty string counts as not set. */
|
|
55
|
+
export type HeaderIcons = Partial<Record<HeaderIconName, string>>;
|
|
56
|
+
/**
|
|
57
|
+
* What a cell's `tooltip` function receives: the cell's context without `loaded` and `setValue` — a cell
|
|
58
|
+
* tooltip shows on loaded rows only. Read when the tooltip shows, not when the cell is drawn.
|
|
59
|
+
*/
|
|
60
|
+
export interface TooltipContext {
|
|
61
|
+
/** Display index; in a pinned row its index in its section (`pinned`). */
|
|
62
|
+
row: number;
|
|
63
|
+
/** A pinned row's section: `'top'` or `'bottom'`; absent for a body row. */
|
|
64
|
+
pinned?: 'top' | 'bottom';
|
|
65
|
+
/**
|
|
66
|
+
* The column whose `tooltip` runs: the cell's own, on the group column's group rows the grouped column of that
|
|
67
|
+
* level (merged over `defaultColumn`).
|
|
68
|
+
*/
|
|
69
|
+
column: ColumnDef;
|
|
70
|
+
/**
|
|
71
|
+
* The cell's raw value (the group column's group rows: the key). Undefined where a client source's group row draws
|
|
72
|
+
* nothing in a data column (see `format`), which reads no value; `text` is `''` there.
|
|
73
|
+
*/
|
|
74
|
+
value: unknown;
|
|
75
|
+
/** The cell's shown text (what `format` returns; the group column's group rows: the shown label). */
|
|
76
|
+
text: string;
|
|
77
|
+
/** The row's metadata (a copy, read when it shows); absent for a source without `rowInfo`. */
|
|
78
|
+
info?: RowInfo;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* What a column's `findText` receives: the cell as find reads it. Called for every searched
|
|
82
|
+
* cell when find builds its count (rows inside closed groups too) and when a drawn cell is bound while a term is set (a plain-text
|
|
83
|
+
* cell only when its shown text contains the term, `marks` tests that first; a renderer cell always); not for a cell that draws nothing (a client source's empty group cell, see `format`).
|
|
84
|
+
*/
|
|
85
|
+
export interface FindTextContext {
|
|
86
|
+
/**
|
|
87
|
+
* The display row; −1 for a row inside a closed group (as `format` gets there). In a pinned row its index in its
|
|
88
|
+
* section (`pinned`).
|
|
89
|
+
*/
|
|
90
|
+
row: number;
|
|
91
|
+
/** A pinned row's section: `'top'` or `'bottom'`; absent for a body row. */
|
|
92
|
+
pinned?: 'top' | 'bottom';
|
|
93
|
+
/** The column whose `findText` runs (the group column's own definition there). */
|
|
94
|
+
column: ColumnDef;
|
|
95
|
+
/** The cell's raw value (the group column's group rows: the key). */
|
|
96
|
+
value: unknown;
|
|
97
|
+
/**
|
|
98
|
+
* The cell's shown text: what `format` returns (the group column's group rows: the label with its level's format
|
|
99
|
+
* and "(Blank)", without the count). A checkbox column's box has a text here (its value's), though the cell shows
|
|
100
|
+
* none.
|
|
101
|
+
*/
|
|
102
|
+
text: string;
|
|
103
|
+
/** The row's metadata; null for a source without `rowInfo`. */
|
|
104
|
+
info: RowInfo | null;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* One occurrence of the find term: `grid.findGetActiveMatch()`, `FindChange.activeMatch`. Occurrences
|
|
108
|
+
* are counted in the order rows show — the pinned top rows, the body's rows (rows inside closed groups at their place),
|
|
109
|
+
* the pinned bottom rows —, then columns, then left to right in the cell.
|
|
110
|
+
*/
|
|
111
|
+
export interface FindMatch {
|
|
112
|
+
/**
|
|
113
|
+
* The display row. −1 while the row is inside a closed group: going to a match opens its groups, so −1 shows only
|
|
114
|
+
* after the app closed one of them again. In a pinned row its index in its section (`pinned`).
|
|
115
|
+
*/
|
|
116
|
+
row: number;
|
|
117
|
+
/** A pinned row's section: `'top'` or `'bottom'`; absent for a body row. */
|
|
118
|
+
pinned?: 'top' | 'bottom';
|
|
119
|
+
/** Column id. */
|
|
120
|
+
column: string;
|
|
121
|
+
/** 1-based, within its cell. */
|
|
122
|
+
numInMatch: number;
|
|
123
|
+
/** 1-based, within the grid. */
|
|
124
|
+
numOverall: number;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* A piece of a text split by the find term (`grid.findGetParts`): plain text, an occurrence
|
|
128
|
+
* (`match`), or the active occurrence (`match` and `activeMatch`).
|
|
129
|
+
*/
|
|
130
|
+
export interface FindPart {
|
|
131
|
+
value: string;
|
|
132
|
+
match?: boolean;
|
|
133
|
+
activeMatch?: boolean;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* `onFindChange`: once per change of the term, the active match or the count — for a label such as
|
|
137
|
+
* "3 / 12". Not when only the active match's row moved (a group above it opened or closed).
|
|
138
|
+
*/
|
|
139
|
+
export interface FindChange {
|
|
140
|
+
/** The term (`''`: find is off). */
|
|
141
|
+
find: string;
|
|
142
|
+
/** Null while no match is active (a new term activates none until `findNext` / `findPrevious` / `findGoTo`). */
|
|
143
|
+
activeMatch: FindMatch | null;
|
|
144
|
+
totalMatches: number;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* What a header's `headerTooltip` function receives: the column or the column group (with its `foldable`
|
|
148
|
+
* and `open`), and `text`, the shown header name.
|
|
149
|
+
*/
|
|
150
|
+
export type HeaderTooltipContext = {
|
|
151
|
+
column: ColumnInfo;
|
|
152
|
+
text: string;
|
|
153
|
+
} | {
|
|
154
|
+
group: ColumnGroupInfo;
|
|
155
|
+
text: string;
|
|
156
|
+
};
|
|
157
|
+
/** The grid's styled tooltips: `GridOptions.tooltips`, `Grid.setTooltips`. */
|
|
158
|
+
export interface TooltipOptions {
|
|
159
|
+
/** ms from the pointer resting on a target to its tooltip showing (default 2000; at least 200). */
|
|
160
|
+
showDelay?: number;
|
|
161
|
+
/** ms a shown tooltip stays before it hides by itself (default 10000; at least 200). */
|
|
162
|
+
hideDelay?: number;
|
|
163
|
+
/** ms the next tooltip waits instead of `showDelay` within 1 s of a shown one hiding (default 200; at least 200). */
|
|
164
|
+
switchDelay?: number;
|
|
165
|
+
/** `'always'` (default), or `'truncated'`: only where the hovered text does not fit. */
|
|
166
|
+
show?: 'always' | 'truncated';
|
|
167
|
+
/** The browser's own tooltip (`title`) instead of the styled one (default false). */
|
|
168
|
+
browser?: boolean;
|
|
169
|
+
/** A touch hold shows the tooltip (default true). */
|
|
170
|
+
touch?: boolean;
|
|
171
|
+
}
|
|
172
|
+
export type { DatePart } from './data/shared/dateParts';
|
|
173
|
+
export interface ColumnDef {
|
|
174
|
+
/** Unique among the leaf columns; any string (dots, spaces, Unicode). */
|
|
175
|
+
id: string;
|
|
176
|
+
/** Field passed to `ViewportSource.getValue`; defaults to `id`. */
|
|
177
|
+
field?: string;
|
|
178
|
+
/** Header text; defaults to `id`. */
|
|
179
|
+
headerName?: string;
|
|
180
|
+
/** Initial width in px (default 200); the user's width wins unless this value changes. */
|
|
181
|
+
width?: number;
|
|
182
|
+
/** Initial share of the free width; a resized flex column becomes fixed. */
|
|
183
|
+
flex?: number;
|
|
184
|
+
/** Initial pinning. */
|
|
185
|
+
pinned?: PinnedSide;
|
|
186
|
+
/** Initially hidden. */
|
|
187
|
+
hidden?: boolean;
|
|
188
|
+
/** Initial sort. */
|
|
189
|
+
sort?: SortDirection;
|
|
190
|
+
/** Initial grouping position, 0 = outermost; applies like `sort`. */
|
|
191
|
+
rowGroup?: number;
|
|
192
|
+
/** Initial aggregation: 'sum' | 'avg' | 'min' | 'max' | 'count', or a name the server knows. */
|
|
193
|
+
aggregate?: string;
|
|
194
|
+
/** The user may group by this column (default true). */
|
|
195
|
+
groupable?: boolean;
|
|
196
|
+
/**
|
|
197
|
+
* Grouping by parts of a date: one hidden column per part, headed
|
|
198
|
+
* "<headerName> (Year)" (`texts.datePartYear`, …), id `ig:<part>:<id>`, listed right before this column. Whenever
|
|
199
|
+
* this column is grouped (its initial `rowGroup`, a group panel drop, the column menu) its parts are grouped before
|
|
200
|
+
* it, each a level of its own afterwards. Client data computes them from `Date` values and ISO-8601 strings
|
|
201
|
+
* (components as written); `formattedMonth` shows the month's name in `locale.lang`. Server data: not yet.
|
|
202
|
+
*/
|
|
203
|
+
groupHierarchy?: readonly DatePart[];
|
|
204
|
+
/** Default 40. */
|
|
205
|
+
minWidth?: number;
|
|
206
|
+
maxWidth?: number;
|
|
207
|
+
/** Default true. */
|
|
208
|
+
sortable?: boolean;
|
|
209
|
+
/** Default true. */
|
|
210
|
+
resizable?: boolean;
|
|
211
|
+
/** Default true. */
|
|
212
|
+
movable?: boolean;
|
|
213
|
+
/**
|
|
214
|
+
* Alignment of the body cells, and of the header unless `headerAlign` is set; default 'start'. `'center'` centres
|
|
215
|
+
* the text (class `ig-align-center`).
|
|
216
|
+
*/
|
|
217
|
+
align?: 'start' | 'end' | 'center';
|
|
218
|
+
/**
|
|
219
|
+
* Alignment of the header label; default: `align`. An end-aligned label ends next to the sort indicator and the
|
|
220
|
+
* header buttons, which stay at the cell's right end. `'center'` centres the label box's text; the sort
|
|
221
|
+
* indicator and the buttons still follow it.
|
|
222
|
+
*/
|
|
223
|
+
headerAlign?: 'start' | 'end' | 'center';
|
|
224
|
+
/**
|
|
225
|
+
* The column's data type. `'boolean'`: the column is a checkbox column on any source; `false`: never one and
|
|
226
|
+
* never inferred; unset: a client source infers it (no `renderer`, a field that is not computed, and the first value
|
|
227
|
+
* that is not `null` / `undefined` is a boolean makes a checkbox column). A `renderer` wins over any value. Inferred
|
|
228
|
+
* once per source and set of definitions, and once at the first data of a source that had none.
|
|
229
|
+
*
|
|
230
|
+
* Editing widens it: the data type also picks the editor and the default parser of an editable
|
|
231
|
+
* column (`'text'`, `'number'`, `'date'` / `'dateTime'` for `Date` values, `'dateString'` / `'dateTimeString'` for ISO
|
|
232
|
+
* strings). Unset, a client source infers it from the first value that is not `null` / `undefined`, only on columns
|
|
233
|
+
* that pass `editable`, and not on computed fields or columns with `parse` or a `renderer`; server rows are text
|
|
234
|
+
* unless it is given.
|
|
235
|
+
*/
|
|
236
|
+
dataType?: 'text' | 'number' | 'boolean' | 'date' | 'dateTime' | 'dateString' | 'dateTimeString' | false;
|
|
237
|
+
/**
|
|
238
|
+
* Whether the user may change the column's values in the grid; default `false`. A function is asked per cell
|
|
239
|
+
* (a throw is reported once and counts as no). Editable cells open an editor (Enter, F2, a character,
|
|
240
|
+
* a double-click), take Delete, paste, fill and undo. A checkbox column's cell is live when it is editable and the
|
|
241
|
+
* cell can be written (a loaded data row on a source with `writeCell`, or a pinned row, whose box writes into the
|
|
242
|
+
* app's object; over a computed field the column needs its `setValue`). A live box toggles on a click
|
|
243
|
+
* and on Space in its cell, writing `!value` (`onCellValueChanged` with `source: 'checkbox'`); any other box is
|
|
244
|
+
* greyed, and a press on it is a press on its cell. A checkbox column never opens an editor.
|
|
245
|
+
*/
|
|
246
|
+
editable?: boolean | ((ctx: EditableContext) => boolean);
|
|
247
|
+
/**
|
|
248
|
+
* The editor of an editable column: a built-in's name, a `CellEditor`, or a function of the row returning
|
|
249
|
+
* an `EditorChoice` (a falsy result: the data type's). Unset: `dataType` chooses.
|
|
250
|
+
*/
|
|
251
|
+
editor?: EditorName | CellEditor | ((ctx: EditableContext) => EditorChoice | undefined);
|
|
252
|
+
/** The editor's parameters: an object, or a function of the row. */
|
|
253
|
+
editorParams?: object | ((ctx: EditableContext) => object);
|
|
254
|
+
/** The editor shows as a popup: `true` / `'over'` on the cell, `'under'` below it. The choice's `popup` wins. */
|
|
255
|
+
editorPopup?: boolean | 'over' | 'under';
|
|
256
|
+
/** What opens the editor with the pointer in this column; beats `EditingOptions.click`. */
|
|
257
|
+
editClick?: 'double' | 'single' | 'none';
|
|
258
|
+
/**
|
|
259
|
+
* Turns typed or pasted text into the value to write. Default: the data
|
|
260
|
+
* type's parser, which refuses a text it cannot read: the cell then stays as it was.
|
|
261
|
+
*/
|
|
262
|
+
parse?: (text: string, ctx: EditableContext) => unknown;
|
|
263
|
+
/**
|
|
264
|
+
* Checks a value before a commit: returns the error texts, or nothing / an empty list when it is valid.
|
|
265
|
+
* Runs for edits only, not for paste, fill or clear.
|
|
266
|
+
*/
|
|
267
|
+
validate?: (ctx: ValidateContext) => readonly string[] | null | undefined;
|
|
268
|
+
/** `false`: pasting never writes this column. */
|
|
269
|
+
paste?: false;
|
|
270
|
+
/** `false`: the fill handle never writes this column and shows no handle on it. */
|
|
271
|
+
fill?: false;
|
|
272
|
+
headerClass?: string;
|
|
273
|
+
/**
|
|
274
|
+
* Default true: the header cell reaches up over the empty group rows above it (a column with no group, or fewer
|
|
275
|
+
* groups than the deepest one). False keeps it in the leaf row.
|
|
276
|
+
*/
|
|
277
|
+
spanHeaderHeight?: boolean;
|
|
278
|
+
/**
|
|
279
|
+
* When the column shows inside its group while the group can fold: `'open'` only while the group is
|
|
280
|
+
* open, `'closed'` only while it is closed; unset: always. A column a closed group does not show is left out of the
|
|
281
|
+
* display (`displayed: false`), not hidden. Ignored on an ungrouped column; not a `defaultColumn` key.
|
|
282
|
+
*/
|
|
283
|
+
columnGroupShow?: 'open' | 'closed';
|
|
284
|
+
/**
|
|
285
|
+
* The header cell's tooltip: `true` the shown header name, a text, or a function of the column and that
|
|
286
|
+
* name (empty: none); `false` none (turns a `defaultColumn` one off). The grid's styled tooltip, shown after
|
|
287
|
+
* `TooltipOptions.showDelay`; `title` under `browser: true`. Works in `defaultColumn` (the group column too).
|
|
288
|
+
*/
|
|
289
|
+
headerTooltip?: boolean | string | ((ctx: HeaderTooltipContext) => string | null | undefined);
|
|
290
|
+
/**
|
|
291
|
+
* The body cells' tooltip: `true` the cell's shown text, a text, or a function of the cell (read when it
|
|
292
|
+
* shows; empty: none); `false` none (turns a `defaultColumn` one off). Runs on group and total rows too
|
|
293
|
+
* (`info.kind`). The grid's styled tooltip, shown after `TooltipOptions.showDelay`; `title` under `browser: true`.
|
|
294
|
+
* Works in `defaultColumn`, which also reaches the group column (`GroupColumnOptions.tooltip`). Default none.
|
|
295
|
+
*/
|
|
296
|
+
tooltip?: boolean | string | ((ctx: TooltipContext) => string | null | undefined);
|
|
297
|
+
/** Custom header content. */
|
|
298
|
+
headerRenderer?: HeaderRenderer;
|
|
299
|
+
/**
|
|
300
|
+
* Measure the wrapped content and grow the row to fit: the content plus `--ig-cell-padding-y` above and below and,
|
|
301
|
+
* in a row taller than the theme's line and padding, its room (half above the first line). Padding a
|
|
302
|
+
* `cellClass` gives the cell itself is not measured (the last line would be cut); set the token instead.
|
|
303
|
+
*/
|
|
304
|
+
autoHeight?: boolean;
|
|
305
|
+
/**
|
|
306
|
+
* Where a text too long for its cell is cut: `'end'` (default) keeps its beginning and ends with "…"; `'start'`
|
|
307
|
+
* keeps its end and starts with "…" ("…/folder/file.csv"), the characters staying in their order (class
|
|
308
|
+
* `ig-ellipsis-start`). A display change only: copy, export, sort and filter see the full text. A renderer's
|
|
309
|
+
* own content is not cut by it. An `autoHeight` column ignores the option (its text wraps).
|
|
310
|
+
*/
|
|
311
|
+
ellipsis?: 'end' | 'start';
|
|
312
|
+
/**
|
|
313
|
+
* The cell's text. Not called where a client source's group row or tree filler draws nothing (it has no data): a
|
|
314
|
+
* column that is neither aggregated nor the one showing its key — its level's grouped column, the tree's label
|
|
315
|
+
* field; nor is `renderer` or a function `cellClass`. A server's group rows show what the server sent. In a
|
|
316
|
+
* pinned row `row` is its index in its section and `pinned` its section; body rows get no third
|
|
317
|
+
* argument.
|
|
318
|
+
*/
|
|
319
|
+
format?: (value: unknown, row: number, pinned?: 'top' | 'bottom') => string;
|
|
320
|
+
/**
|
|
321
|
+
* The text find searches in this column's cells: a string replaces the
|
|
322
|
+
* shown text, `null` takes the cell out of the search, `undefined` keeps the shown text (what `format` returns). A
|
|
323
|
+
* cell that shows a checkbox (a checkbox column's boolean) is searched only by a string from here. Matches in a
|
|
324
|
+
* replaced text count, but the cell draws no marks (its shown text is not that text): a renderer can draw them
|
|
325
|
+
* from `CellContext.find`. A throw is reported once and keeps the shown text. Works in `defaultColumn`, which also
|
|
326
|
+
* reaches the group column (`GroupColumnOptions.findText`).
|
|
327
|
+
*/
|
|
328
|
+
findText?: (ctx: FindTextContext) => string | null | undefined;
|
|
329
|
+
renderer?: CellRenderer;
|
|
330
|
+
/**
|
|
331
|
+
* Class name(s) added to the column's body cells: a string for every cell, or a function of the cell's value and
|
|
332
|
+
* row. A function is called when the cell's value is bound (a row coming into view, a data change, a row
|
|
333
|
+
* moved by a splice), not in every frame, and not for rows that are loading or failed or for cells a client group
|
|
334
|
+
* row draws nothing in (see `format`); its result is written only when it changed. A throwing function is
|
|
335
|
+
* reported once and adds no class. Pass a stable function (defined once): a new function re-binds the whole column.
|
|
336
|
+
* In a pinned row `row` is its index in its section and `pinned` its section, as for `format`.
|
|
337
|
+
*/
|
|
338
|
+
cellClass?: string | ((value: unknown, row: number, pinned?: 'top' | 'bottom') => string | undefined);
|
|
339
|
+
/**
|
|
340
|
+
* The column's filter: `true` = 'text' (InGrid has no data types), a kind, or a definition (an
|
|
341
|
+
* object without `type` is a text filter); `false` / absent = no filter. A change of kind, or losing the filter,
|
|
342
|
+
* drops the column's model (`onFilterChange` source 'definitions'); any other change keeps it when it still fits.
|
|
343
|
+
*/
|
|
344
|
+
filter?: FilterOption;
|
|
345
|
+
/** A cell in the floating-filter row (default false). */
|
|
346
|
+
floatingFilter?: boolean;
|
|
347
|
+
/** The header's menu button (default true). */
|
|
348
|
+
menuButton?: boolean;
|
|
349
|
+
/**
|
|
350
|
+
* Replacements for the header icons of this column; beats `GridOptions.icons`. Not the column group
|
|
351
|
+
* chevrons: a group's are the grid's.
|
|
352
|
+
*/
|
|
353
|
+
icons?: HeaderIcons;
|
|
354
|
+
/** The header's filter button, shown only when no floating-filter button is (default true). */
|
|
355
|
+
filterButton?: boolean;
|
|
356
|
+
/** The button in the floating cell that opens the filter (default true). */
|
|
357
|
+
floatingFilterButton?: boolean;
|
|
358
|
+
/** A right-click on the header opens the column menu (default true). */
|
|
359
|
+
headerMenu?: boolean;
|
|
360
|
+
/** Column menu entries (an array or a callback; beats `GridOptions.columnMenu.items`). */
|
|
361
|
+
menuItems?: MenuItems<ColumnMenuContext>;
|
|
362
|
+
/** Context menu entries for this column's cells (beats `GridOptions.contextMenu.items`). */
|
|
363
|
+
contextMenuItems?: MenuItems<ContextMenuContext>;
|
|
364
|
+
/** The aggregate functions the UI offers for this column (`true` = the built-ins). */
|
|
365
|
+
aggregates?: boolean | readonly string[];
|
|
366
|
+
/** Listed in the column chooser and the columns panel (default true). */
|
|
367
|
+
chooser?: boolean;
|
|
368
|
+
/** The UI may hide it (default true; the API still can). */
|
|
369
|
+
hideable?: boolean;
|
|
370
|
+
/**
|
|
371
|
+
* The UI may pin it (default true). `false` also keeps the grid from unpinning it when the pinned columns leave the
|
|
372
|
+
* centre less than 50 px; the API still can.
|
|
373
|
+
*/
|
|
374
|
+
pinnable?: boolean;
|
|
375
|
+
/** What a copy writes: the displayed text (default), the raw value, or nothing. */
|
|
376
|
+
copy?: 'text' | 'value' | false;
|
|
377
|
+
/**
|
|
378
|
+
* What an export writes: `'auto'` — CSV / TSV the displayed text, XLSX a finite number, bigint,
|
|
379
|
+
* boolean or valid `Date` typed, anything else the displayed text; `'text'` the displayed text; `'value'` the raw
|
|
380
|
+
* value; `false` leaves the column out; an object adds XLSX details. Default: from `copy` — `false` leaves it out,
|
|
381
|
+
* `'value'` is `'value'`, otherwise `'auto'` (the clipboard hooks are not inherited).
|
|
382
|
+
*/
|
|
383
|
+
export?: false | 'auto' | 'text' | 'value' | ExportColumn;
|
|
384
|
+
/** false: arrows, Tab, Home / End skip the column (it can still be clicked); default true. */
|
|
385
|
+
navigable?: boolean;
|
|
386
|
+
/**
|
|
387
|
+
* Writes a value of this column into a row, for `CellContext.setValue` and
|
|
388
|
+
* `grid.setCellValue`: called with the row object — a client source's own object; a server source's loaded row as a
|
|
389
|
+
* plain object of its fields, whose own fields it keeps as a local patch — and the new value. Writes wherever
|
|
390
|
+
* the app keeps the value; `false` refuses the write (nothing changes, no event), anything else counts as written.
|
|
391
|
+
* Without it the grid writes `row[field]` — except into a computed field (a client `FieldDef.value` getter), whose
|
|
392
|
+
* column can be written only through this setter. A throw is reported once and refuses.
|
|
393
|
+
*/
|
|
394
|
+
setValue?(row: object, value: unknown): boolean | void;
|
|
395
|
+
/** With `RowDragOptions.handle` `'cells'`: a grip before this column's cell content. */
|
|
396
|
+
rowDrag?: boolean;
|
|
397
|
+
/**
|
|
398
|
+
* With `DetailOptions.toggle` `'cells'`: the detail chevron before this column's cell content.
|
|
399
|
+
* Ignored, with one hint, while `detail` is off, on the group column and under `toggle: 'column'`.
|
|
400
|
+
*/
|
|
401
|
+
detailToggle?: boolean;
|
|
402
|
+
/**
|
|
403
|
+
* Another value (`equals`, else `Object.is`) or another text (what `format` returns) lights the cell up, timed as
|
|
404
|
+
* `flashCells` (hold 500 ms, fade 1000 ms) in a teal green (`.ig-flash-change`, `--ig-change-flash-bg`). The
|
|
405
|
+
* changes that count: a client `setData` / `refresh()` with the `id` option or the same array, a server `refresh()`
|
|
406
|
+
* with ids, `setCellValue`, a renderer's `setValue`. Cells on screen only; never sorting, filtering, grouping,
|
|
407
|
+
* expanding, scrolling, added rows, definition or locale changes, custom sources. Ends early like every flash
|
|
408
|
+
* (`Grid.flashCells`). Default false; works in `defaultColumn` too.
|
|
409
|
+
*/
|
|
410
|
+
flashChanges?: boolean;
|
|
411
|
+
/**
|
|
412
|
+
* `(old, new)`: whether two values count as the same for `flashChanges`. Default `Object.is`, so `NaN` stays
|
|
413
|
+
* without a flash; a changed text flashes anyway; the flash only.
|
|
414
|
+
*/
|
|
415
|
+
equals?: (a: unknown, b: unknown) => boolean;
|
|
416
|
+
}
|
|
417
|
+
export interface ColumnGroupDef {
|
|
418
|
+
headerName: string;
|
|
419
|
+
children: ColumnNode[];
|
|
420
|
+
/** Stable id; default: derived from the position in the definitions and the header name. */
|
|
421
|
+
groupId?: string;
|
|
422
|
+
headerClass?: string;
|
|
423
|
+
/** The group and its columns are listed in the column chooser and the columns panel (default true). */
|
|
424
|
+
chooser?: boolean;
|
|
425
|
+
/**
|
|
426
|
+
* The label stays in view while the group's header cell is partly scrolled out on the left: it moves right with the
|
|
427
|
+
* scroll, inside the cell, until it reaches the cell's right end (default true). Only groups in the centre (not
|
|
428
|
+
* pinned) move; leaf labels never do. `false` keeps it in its place.
|
|
429
|
+
*/
|
|
430
|
+
stickyLabel?: boolean;
|
|
431
|
+
/**
|
|
432
|
+
* As `ColumnDef.columnGroupShow`, for a group inside a group: the whole child group shows or goes with its parent's
|
|
433
|
+
* open state. Ignored on a top-level group.
|
|
434
|
+
*/
|
|
435
|
+
columnGroupShow?: 'open' | 'closed';
|
|
436
|
+
/**
|
|
437
|
+
* The group header's tooltip, as `ColumnDef.headerTooltip`: its function receives `{ group, text }`
|
|
438
|
+
* (`text`: the shown header name).
|
|
439
|
+
*/
|
|
440
|
+
headerTooltip?: ColumnDef['headerTooltip'];
|
|
441
|
+
/**
|
|
442
|
+
* The group starts open (default false). Counts only for a group id the grid has not seen before: a known id keeps
|
|
443
|
+
* its state across new definitions (`Grid.getColumnGroupState`).
|
|
444
|
+
*/
|
|
445
|
+
openByDefault?: boolean;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* A column definition or a column group. The entry `{ id: 'ig:group' }` at the top level marks where the group column
|
|
449
|
+
* goes (whenever it appears, and at `resetColumnState()`); it is no data column, takes no other keys (configure the
|
|
450
|
+
* column with `groupColumn`) and is ignored inside a column group. Without it the group column goes first, after the
|
|
451
|
+
* row-number and other leading columns.
|
|
452
|
+
*/
|
|
453
|
+
export type ColumnNode = ColumnDef | ColumnGroupDef;
|
|
454
|
+
/**
|
|
455
|
+
* Merged shallowly under every leaf definition (definition values win). A definition value that is `undefined` counts
|
|
456
|
+
* as not set, so `{ id, width: saved[id] }` falls back to the default width. To opt one column out of a default, give
|
|
457
|
+
* it the neutral value: `flex: 0` (keeps its width), `sortable: true`, `align: 'start'`, `headerAlign: 'start'`,
|
|
458
|
+
* `autoHeight: false`, `ellipsis: 'end'`, `flashChanges: false`, `tooltip: false`, `headerTooltip: false`,
|
|
459
|
+
* `dataType: false`, `editable: false`.
|
|
460
|
+
* `renderer`, `headerRenderer`, `format`, `pinned` and `sort` have no typed neutral value yet, so a column cannot opt
|
|
461
|
+
* out of them: keep them out of the defaults and set them on the columns that need them. `rowGroup` is not a default
|
|
462
|
+
* (grouping every column makes no sense), nor is `columnGroupShow` (which columns a group folds is chosen per column).
|
|
463
|
+
*/
|
|
464
|
+
export type ColumnDefaults = Partial<Omit<ColumnDef, 'id' | 'field' | 'headerName' | 'rowGroup' | 'columnGroupShow'>>;
|
|
465
|
+
export interface RowNumbersOptions {
|
|
466
|
+
/** Default 60. */
|
|
467
|
+
width?: number;
|
|
468
|
+
/** Default 40. */
|
|
469
|
+
minWidth?: number;
|
|
470
|
+
/** Default 120. */
|
|
471
|
+
maxWidth?: number;
|
|
472
|
+
/**
|
|
473
|
+
* Cell value; default `row + 1`. Pass a stable function (defined once, not an inline arrow re-created on every
|
|
474
|
+
* update): a new function counts as a changed definition and re-binds the column's cells. Also called for rows
|
|
475
|
+
* still loading (they keep their number): return `''` when the value needs the row's data. `'source'`: a
|
|
476
|
+
* client source's row keeps its place in the rows array (`rows.sourceIndexOf(row) + 1`) through sorting,
|
|
477
|
+
* filtering and grouping; group rows and fillers count 1, 2, 3, … among their siblings, and an export
|
|
478
|
+
* numbers rows inside closed groups the same way. Other sources number by position, with one console hint.
|
|
479
|
+
*/
|
|
480
|
+
value?: ((row: number) => string | number) | 'source';
|
|
481
|
+
/** With cell selection, a row number's click selects the row's cells; default true. */
|
|
482
|
+
selects?: boolean;
|
|
483
|
+
/**
|
|
484
|
+
* The row-number cells' tooltip, as `ColumnDef.tooltip`: `true` the shown number, a text, or a function
|
|
485
|
+
* of the cell (`{ row, value, text, info }` — `info.unmatched`, `info.kind`; empty: none). Its own setting only:
|
|
486
|
+
* `defaultColumn.tooltip` does not reach the row numbers. Default none.
|
|
487
|
+
*/
|
|
488
|
+
tooltip?: ColumnDef['tooltip'];
|
|
489
|
+
}
|
|
490
|
+
/** `GridOptions.dragOutHides` as an object: hiding by drag-out on, at a distance of its own. */
|
|
491
|
+
export interface DragOutOptions {
|
|
492
|
+
/**
|
|
493
|
+
* How far (px) outside the grid a dragged header must be let go to hide its columns; default 32. A negative or
|
|
494
|
+
* non-finite value counts as the default, with a console hint.
|
|
495
|
+
*/
|
|
496
|
+
distance?: number;
|
|
497
|
+
}
|
|
498
|
+
/** The grid-owned group column; `field` switches the grid to tree mode. */
|
|
499
|
+
export interface GroupColumnOptions {
|
|
500
|
+
/**
|
|
501
|
+
* Where a group label too long for the column is cut: `'end'` (default) or `'start'` ("…/folder/name"; the count
|
|
502
|
+
* after the label stays whole). Not taken from `defaultColumn` (class `ig-ellipsis-start` on the label).
|
|
503
|
+
*/
|
|
504
|
+
ellipsis?: 'end' | 'start';
|
|
505
|
+
/** Default "Group". */
|
|
506
|
+
headerName?: string;
|
|
507
|
+
/** Default 200. */
|
|
508
|
+
width?: number;
|
|
509
|
+
/** Default 80; 208 with `groupedFilters`, an own `filter` and `floatingFilter` (the main box beside the aside). */
|
|
510
|
+
minWidth?: number;
|
|
511
|
+
maxWidth?: number;
|
|
512
|
+
pinned?: PinnedSide;
|
|
513
|
+
/** The child count "(N)" after a group label (default true). */
|
|
514
|
+
showCount?: boolean;
|
|
515
|
+
/**
|
|
516
|
+
* A double-click on its cell expands or collapses a group row or tree parent, as the chevron's click does
|
|
517
|
+
* (default true). Not on the chevron, a checkbox or a grip, nor after an `onCellDoubleClick` listener's
|
|
518
|
+
* `preventDefault`. `false`: only the chevron and the keys toggle.
|
|
519
|
+
*/
|
|
520
|
+
doubleClickToggle?: boolean;
|
|
521
|
+
/** Default true: the header cell reaches up over the empty group rows above it (see `ColumnDef.spanHeaderHeight`). */
|
|
522
|
+
spanHeaderHeight?: boolean;
|
|
523
|
+
/** Replaces the label only; indent, chevron and count stay the grid's. */
|
|
524
|
+
renderer?: CellRenderer;
|
|
525
|
+
/** Tree mode: the field shown as each row's label. */
|
|
526
|
+
field?: string;
|
|
527
|
+
/** Header clicks sort by it (default true). */
|
|
528
|
+
sortable?: boolean;
|
|
529
|
+
/** Added to the grid's own header class. */
|
|
530
|
+
headerClass?: string;
|
|
531
|
+
/** Class name(s) for its body cells, as `ColumnDef.cellClass`; the grid's own classes stay. */
|
|
532
|
+
cellClass?: ColumnDef['cellClass'];
|
|
533
|
+
/** Custom header content, as `ColumnDef.headerRenderer`. */
|
|
534
|
+
headerRenderer?: HeaderRenderer;
|
|
535
|
+
/** The header's menu button (default true). */
|
|
536
|
+
menuButton?: boolean;
|
|
537
|
+
/**
|
|
538
|
+
* Its own filter; the model is stored under the id 'ig:group'.
|
|
539
|
+
*
|
|
540
|
+
* Tree mode (`field` is set): a column's filter kind (`'text'`, `'number'`, `'date'`, `'set'`, `'multi'`,
|
|
541
|
+
* a definition object, or `true` for text) filters the rows by the tree's labels, as a column on the label field
|
|
542
|
+
* would: its entry names that field, a client source tests a row by the field's value and a path filler by its key,
|
|
543
|
+
* and matches stay with their ancestors (`tree.keepDescendants`).
|
|
544
|
+
*
|
|
545
|
+
* Row grouping: a filter on the groups. 'groupSize' (or a `GroupSizeFilterDef`) is the built-in one on a group's row
|
|
546
|
+
* count (no filter in tree mode); any other kind reaches a server as an entry with field 'ig:group' and is
|
|
547
|
+
* ignored by the client source, as is a custom kind in tree mode. Dropped when grouping ends.
|
|
548
|
+
*/
|
|
549
|
+
filter?: FilterOption | 'groupSize' | GroupSizeFilterDef;
|
|
550
|
+
/** A cell in the floating-filter row (default false). */
|
|
551
|
+
floatingFilter?: boolean;
|
|
552
|
+
/** As `ColumnDef.floatingFilterButton`: the button in its floating cell that opens the filter (default true). Not taken from `defaultColumn`. */
|
|
553
|
+
floatingFilterButton?: boolean;
|
|
554
|
+
/** As `ColumnDef.filterButton`: its header's filter button, shown only when no floating-filter button is (default true). Not taken from `defaultColumn`. */
|
|
555
|
+
filterButton?: boolean;
|
|
556
|
+
/**
|
|
557
|
+
* The group column also hosts the filters of the grouped columns that have one: its filter
|
|
558
|
+
* button and floating cell reach them. Ignored in tree mode (one console hint). Default false.
|
|
559
|
+
*/
|
|
560
|
+
groupedFilters?: boolean;
|
|
561
|
+
/**
|
|
562
|
+
* As `ColumnDef.rowDrag`: with `RowDragOptions.handle` `'cells'`, a grip in its cells after the row
|
|
563
|
+
* checkbox, before the chevron.
|
|
564
|
+
*/
|
|
565
|
+
rowDrag?: boolean;
|
|
566
|
+
/** As `ColumnDef.flashChanges`; default `defaultColumn`'s. */
|
|
567
|
+
flashChanges?: boolean;
|
|
568
|
+
/** As `ColumnDef.equals`; default `defaultColumn`'s. */
|
|
569
|
+
equals?: (a: unknown, b: unknown) => boolean;
|
|
570
|
+
/**
|
|
571
|
+
* As `ColumnDef.tooltip`, on its leaf rows and in tree mode on every row (a group row shows the grouped
|
|
572
|
+
* column's `tooltip`); default `defaultColumn`'s. `false` turns a default one off.
|
|
573
|
+
*/
|
|
574
|
+
tooltip?: ColumnDef['tooltip'];
|
|
575
|
+
/** As `ColumnDef.headerTooltip`; default `defaultColumn`'s. */
|
|
576
|
+
headerTooltip?: ColumnDef['headerTooltip'];
|
|
577
|
+
/**
|
|
578
|
+
* As `ColumnDef.findText`, on every row of the group column (`ctx.column` is its definition);
|
|
579
|
+
* default `defaultColumn`'s.
|
|
580
|
+
*/
|
|
581
|
+
findText?: ColumnDef['findText'];
|
|
582
|
+
}
|
|
583
|
+
/** InGrid's own column-state shape. */
|
|
584
|
+
export interface ColumnState {
|
|
585
|
+
id: string;
|
|
586
|
+
width?: number;
|
|
587
|
+
/** `null` = explicitly no flex. */
|
|
588
|
+
flex?: number | null;
|
|
589
|
+
hidden?: boolean;
|
|
590
|
+
pinned?: PinnedSide | null;
|
|
591
|
+
sort?: SortDirection | null;
|
|
592
|
+
sortIndex?: number | null;
|
|
593
|
+
/** Position among the grouped columns; `null` = not grouped. */
|
|
594
|
+
rowGroup?: number | null;
|
|
595
|
+
aggregate?: string | null;
|
|
596
|
+
}
|
|
597
|
+
export interface ApplyColumnStateOptions {
|
|
598
|
+
/** Listed ids go first, in the given order; the others follow in their current order. */
|
|
599
|
+
order?: boolean;
|
|
600
|
+
/**
|
|
601
|
+
* Applied to every known column that is not listed. Its `sort` and `rowGroup` also reach the remembered state of
|
|
602
|
+
* removed columns and the entries kept for never-seen ids, so `{ sort: null }` clears sorting for good.
|
|
603
|
+
*/
|
|
604
|
+
defaults?: Omit<ColumnState, 'id'>;
|
|
605
|
+
}
|
|
606
|
+
export type StateSource = 'definitions' | 'api' | 'resize' | 'autosize' | 'move' | 'pin' | 'hide' | 'sort'
|
|
607
|
+
/**
|
|
608
|
+
* A grouping gesture: the group panel, the column menu, the Columns panel, or the top bar's groups chip (the bar
|
|
609
|
+
* also reports `'sort'`, `'hide'`, `'pin'` and `'move'` for its other chips).
|
|
610
|
+
*/
|
|
611
|
+
| 'group'
|
|
612
|
+
/**
|
|
613
|
+
* An aggregation chosen in the column menu or the columns panel's Values section; aggregation
|
|
614
|
+
* changes through the API report `'api'`.
|
|
615
|
+
*/
|
|
616
|
+
| 'aggregate'
|
|
617
|
+
/** The grid unpinned columns because the pinned ones left the centre less than 50 px. */
|
|
618
|
+
| 'viewport';
|
|
619
|
+
export interface ColumnStateChange {
|
|
620
|
+
source: StateSource;
|
|
621
|
+
}
|
|
622
|
+
export interface SortModelItem {
|
|
623
|
+
id: string;
|
|
624
|
+
direction: SortDirection;
|
|
625
|
+
}
|
|
626
|
+
/** A column group as menus, renderers and hooks see it: a snapshot, taken when it was handed out. */
|
|
627
|
+
export interface ColumnGroupInfo {
|
|
628
|
+
id: string;
|
|
629
|
+
headerName: string;
|
|
630
|
+
/**
|
|
631
|
+
* It can fold now: among its children that are not hidden, one has a `columnGroupShow`, and open and
|
|
632
|
+
* closed each show at least one.
|
|
633
|
+
*/
|
|
634
|
+
foldable: boolean;
|
|
635
|
+
/** Its stored open state, also while it cannot fold. */
|
|
636
|
+
open: boolean;
|
|
637
|
+
}
|
|
638
|
+
/** A column group's open state: `Grid.getColumnGroupState`, `GridOptions.columnGroupState`. */
|
|
639
|
+
export interface ColumnGroupState {
|
|
640
|
+
id: string;
|
|
641
|
+
open: boolean;
|
|
642
|
+
}
|
|
643
|
+
/** One open or close of column groups: the groups whose state changed, by a gesture or an API call. */
|
|
644
|
+
export interface ColumnGroupToggle {
|
|
645
|
+
groups: ColumnGroupState[];
|
|
646
|
+
source: 'ui' | 'api';
|
|
647
|
+
}
|
|
648
|
+
export interface ColumnInfo {
|
|
649
|
+
id: string;
|
|
650
|
+
headerName: string;
|
|
651
|
+
kind: 'data' | 'rowNumber' | 'group' | 'selection' | 'rowDrag' | 'detail';
|
|
652
|
+
hidden: boolean;
|
|
653
|
+
pinned: PinnedSide | null;
|
|
654
|
+
/** Resolved px (flex included). */
|
|
655
|
+
width: number;
|
|
656
|
+
sort: SortDirection | null;
|
|
657
|
+
sortIndex: number | null;
|
|
658
|
+
/** Position among the grouped columns; `null` = not grouped (always in tree mode). */
|
|
659
|
+
rowGroup: number | null;
|
|
660
|
+
aggregate: string | null;
|
|
661
|
+
/** Outermost first. */
|
|
662
|
+
groups: ColumnGroupInfo[];
|
|
663
|
+
/** The field its values come from (`field`, default the id; 'ig:group' for the group column). */
|
|
664
|
+
field: string;
|
|
665
|
+
/** A header click sorts by it (never the row-number or selection column). */
|
|
666
|
+
sortable: boolean;
|
|
667
|
+
/** The user may move it (never the row-number or selection column). */
|
|
668
|
+
movable: boolean;
|
|
669
|
+
resizable: boolean;
|
|
670
|
+
/** The user may group by it: a data column without `groupable: false`, outside tree mode. */
|
|
671
|
+
groupable: boolean;
|
|
672
|
+
/** The UI may hide it: a data column without `hideable: false`. */
|
|
673
|
+
hideable: boolean;
|
|
674
|
+
/** The UI may pin it: a data or group column without `pinnable: false`. */
|
|
675
|
+
pinnable: boolean;
|
|
676
|
+
/**
|
|
677
|
+
* Listed by the column chooser and the columns panel: a data column without `chooser: false`, under no group with
|
|
678
|
+
* `chooser: false` — what an app's own chooser honours.
|
|
679
|
+
*/
|
|
680
|
+
chooser: boolean;
|
|
681
|
+
/**
|
|
682
|
+
* The filter kind ('text', 'number', 'date', 'set', 'multi' or a custom name); null = no filter. The group column
|
|
683
|
+
* without an own filter but with grouped-column filter entries (`groupColumn.groupedFilters`) reports 'grouped'.
|
|
684
|
+
*/
|
|
685
|
+
filter: string | null;
|
|
686
|
+
/** The column has an applied filter model. */
|
|
687
|
+
filterActive: boolean;
|
|
688
|
+
/** The aggregate functions the UI offers (`ColumnDef.aggregates`; [] = none). */
|
|
689
|
+
aggregates: readonly string[];
|
|
690
|
+
}
|
|
691
|
+
/**
|
|
692
|
+
* What a header renderer draws from. `update` runs when the header text, sort, sort index, pinning, groups (their
|
|
693
|
+
* `foldable` and `open` too), grouping (`column.rowGroup`), aggregation (`column.aggregate`) or active filter
|
|
694
|
+
* (`filterActive`) of the column change, and when the group column starts or stops hosting its grouped columns'
|
|
695
|
+
* filters (`column.filter: 'grouped'`). A width change alone does not trigger it, on purpose (it happens on every
|
|
696
|
+
* resize frame), so `column.width` is the width at the last update. A hidden column's header is not drawn, so a
|
|
697
|
+
* renderer never sees `column.hidden: true`.
|
|
698
|
+
*/
|
|
699
|
+
export interface HeaderContext {
|
|
700
|
+
column: ColumnInfo;
|
|
701
|
+
text: string;
|
|
702
|
+
sort: SortDirection | null;
|
|
703
|
+
sortIndex: number | null;
|
|
704
|
+
/** The column has an applied filter model (as `column.filterActive`). */
|
|
705
|
+
filterActive: boolean;
|
|
706
|
+
}
|
|
707
|
+
export interface HeaderRendererInstance {
|
|
708
|
+
update(ctx: HeaderContext): void;
|
|
709
|
+
destroy(): void;
|
|
710
|
+
}
|
|
711
|
+
/** Owns only the header cell's content; the grid keeps sort indicator, resize handle and drag behaviour. */
|
|
712
|
+
export interface HeaderRenderer {
|
|
713
|
+
create(host: HTMLElement): HeaderRendererInstance;
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* What an app-defined filter UI draws from: `update` gets a new context on every model change, from any
|
|
717
|
+
* place, so the UI keeps no state of its own.
|
|
718
|
+
*/
|
|
719
|
+
export interface FilterUiContext<M = unknown> {
|
|
720
|
+
column: ColumnInfo;
|
|
721
|
+
/** The model the UI shows: the applied one, or with an Apply button the one staged by `setModel`. */
|
|
722
|
+
model: M | null;
|
|
723
|
+
/** Applies now (source 'ui'); with an Apply button it is staged until Apply. */
|
|
724
|
+
setModel(model: M | null): void;
|
|
725
|
+
/** Closes the popup (no-op in the filters panel). */
|
|
726
|
+
close(): void;
|
|
727
|
+
/**
|
|
728
|
+
* The grid's overlay host (`Grid.getOverlayHost`): attach a dropdown panel or date picker here instead of
|
|
729
|
+
* `<body>` (PrimeVue: `appendTo`), so it draws above the popup and a click in it stays inside.
|
|
730
|
+
*/
|
|
731
|
+
overlayHost: HTMLElement;
|
|
732
|
+
/** The source's distinct values of the column's field, among the rows passing the other filters. */
|
|
733
|
+
values(options?: {
|
|
734
|
+
search?: string;
|
|
735
|
+
}): Promise<FilterValues>;
|
|
736
|
+
texts: GridTexts;
|
|
737
|
+
}
|
|
738
|
+
export interface FilterRendererInstance {
|
|
739
|
+
update(ctx: FilterUiContext): void;
|
|
740
|
+
/** Focuses its first control when the popup opens; without it the popup's first control has focus. */
|
|
741
|
+
focus?(): void;
|
|
742
|
+
destroy(): void;
|
|
743
|
+
}
|
|
744
|
+
/** A custom filter kind's popup / panel UI (`CustomFilterDef.renderer`): one instance per column, kept while it lives. */
|
|
745
|
+
export interface FilterRenderer {
|
|
746
|
+
create(host: HTMLElement): FilterRendererInstance;
|
|
747
|
+
}
|
|
748
|
+
/** What an app-defined floating filter draws from, on any filter kind. */
|
|
749
|
+
export interface FloatingFilterContext<M = unknown> {
|
|
750
|
+
column: ColumnInfo;
|
|
751
|
+
/** The applied model in the kind's own shape, as `getColumnFilter` returns it (a multi child: its slot); null: none. */
|
|
752
|
+
model: M | null;
|
|
753
|
+
/**
|
|
754
|
+
* Applies at once (source 'floating'), validated as `setColumnFilter` validates (problems on the console once each);
|
|
755
|
+
* a model the kind rejects changes nothing, where `setColumnFilter` would clear the filter. `debounce`: `true`
|
|
756
|
+
* waits as the kind's built-in floating editor does (the filter's `debounceMs`, else 500 ms for text and number, no
|
|
757
|
+
* wait for date, set, multi and custom kinds or with an Apply button), a number waits that many ms; each call
|
|
758
|
+
* restarts the wait, and a call without it, or a change of the column's filter from elsewhere, drops the waiting
|
|
759
|
+
* model.
|
|
760
|
+
*/
|
|
761
|
+
setModel(model: M | null, options?: {
|
|
762
|
+
debounce?: boolean | number;
|
|
763
|
+
}): void;
|
|
764
|
+
/** Opens the column's filter popup (the built-in one for a built-in kind), as `Grid.showFilter`. */
|
|
765
|
+
openFilter(): void;
|
|
766
|
+
/** The grid's overlay host (`Grid.getOverlayHost`), for the renderer's own overlays. */
|
|
767
|
+
overlayHost: HTMLElement;
|
|
768
|
+
texts: GridTexts;
|
|
769
|
+
}
|
|
770
|
+
export interface FloatingFilterRendererInstance {
|
|
771
|
+
update(ctx: FloatingFilterContext): void;
|
|
772
|
+
destroy(): void;
|
|
773
|
+
}
|
|
774
|
+
/** An app's floating-filter cell (`floatingRenderer` on any filter definition): it replaces the built-in editor. */
|
|
775
|
+
export interface FloatingFilterRenderer {
|
|
776
|
+
create(host: HTMLElement): FloatingFilterRendererInstance;
|
|
777
|
+
}
|
|
778
|
+
/** A filter model change: delivered after the source received the new query. */
|
|
779
|
+
export interface FilterChange {
|
|
780
|
+
/**
|
|
781
|
+
* 'ui': a filter popup or panel, or the top bar's filters and group-size chips; 'floating': the
|
|
782
|
+
* floating-filter row; 'definitions': a column definition change.
|
|
783
|
+
*/
|
|
784
|
+
source: 'ui' | 'floating' | 'api' | 'definitions';
|
|
785
|
+
/** The columns whose model changed. */
|
|
786
|
+
columns: string[];
|
|
787
|
+
}
|
|
788
|
+
/** A grid popup opened or closed: top-level popups only (a sub-menu goes with its menu). */
|
|
789
|
+
export interface PopupChange {
|
|
790
|
+
open: boolean;
|
|
791
|
+
kind: 'filter' | 'columnMenu' | 'contextMenu' | 'chooser' | 'toolbarMenu'
|
|
792
|
+
/** A cell editor's popup: large text, an editor with `popup`, a select's list. */
|
|
793
|
+
| 'editor';
|
|
794
|
+
/** The column the popup is about; null for a context menu on the empty area or the column chooser. */
|
|
795
|
+
column: string | null;
|
|
796
|
+
}
|
|
797
|
+
/** A menu entry: an item, a built-in item by name, or a separator. */
|
|
798
|
+
export type MenuEntry = MenuItem | BuiltInMenuItem | 'separator';
|
|
799
|
+
/** Menu entries, or a builder that receives the defaults (as entries) and returns the menu's entries. */
|
|
800
|
+
export type MenuItems<C> = readonly MenuEntry[] | ((ctx: C & {
|
|
801
|
+
defaults: MenuEntry[];
|
|
802
|
+
}) => MenuEntry[]);
|
|
803
|
+
export interface MenuItem {
|
|
804
|
+
label: string;
|
|
805
|
+
/** Called with the menu's context (column, row, value, grid). */
|
|
806
|
+
action?: (ctx: MenuActionContext) => void;
|
|
807
|
+
disabled?: boolean;
|
|
808
|
+
/** A check mark instead of the icon. */
|
|
809
|
+
checked?: boolean;
|
|
810
|
+
/** SVG path data in a 16 × 16 view box, or an element. */
|
|
811
|
+
icon?: string | (() => Element);
|
|
812
|
+
/** Display only; binds no key. */
|
|
813
|
+
shortcut?: string;
|
|
814
|
+
/** The grid's styled tooltip on the item; its `title` under `tooltips: { browser: true }`. */
|
|
815
|
+
tooltip?: string;
|
|
816
|
+
className?: string;
|
|
817
|
+
subMenu?: readonly MenuEntry[];
|
|
818
|
+
/** Stay open after the action. */
|
|
819
|
+
keepOpen?: boolean;
|
|
820
|
+
}
|
|
821
|
+
export type BuiltInMenuItem = 'sortAsc' | 'sortDesc' | 'sortClear' | 'filter' | 'pin' | 'pinLeft' | 'pinRight' | 'unpin' | 'aggregate' | 'autoSize' | 'autoSizeAll' | 'group' | 'ungroup' | 'chooseColumns' | 'resetColumns' | 'expandAll' | 'collapseAll'
|
|
822
|
+
/** Shown in the default context menu only while a column may be editable. */
|
|
823
|
+
| 'cut' | 'copy' | 'copyWithHeaders' | 'copyWithGroupHeaders' | 'paste' | 'export' | 'exportCsv' | 'exportTsv' | 'exportXlsx' | 'exportSelection' | 'exportSelectionCsv' | 'exportSelectionTsv' | 'exportSelectionXlsx';
|
|
824
|
+
/** What a column menu (or a header group's menu) is about. */
|
|
825
|
+
export interface ColumnMenuContext {
|
|
826
|
+
column: ColumnInfo | null;
|
|
827
|
+
group: ColumnGroupInfo | null;
|
|
828
|
+
grid: Grid;
|
|
829
|
+
}
|
|
830
|
+
/** What a context menu is about: the clicked cell, or nothing on the empty area. */
|
|
831
|
+
export interface ContextMenuContext {
|
|
832
|
+
/** The row's display index (null on the empty area); in a pinned row its index in its section (`pinned`). */
|
|
833
|
+
row: number | null;
|
|
834
|
+
/**
|
|
835
|
+
* A pinned row's section: `'top'` or `'bottom'`; absent for a body row and the empty area. A
|
|
836
|
+
* pinned row's default entries leave out "Export selection" (its last fallback is a body row).
|
|
837
|
+
*/
|
|
838
|
+
pinned?: 'top' | 'bottom';
|
|
839
|
+
column: ColumnInfo | null;
|
|
840
|
+
value: unknown;
|
|
841
|
+
event: MouseEvent | null;
|
|
842
|
+
grid: Grid;
|
|
843
|
+
}
|
|
844
|
+
export type MenuActionContext = ColumnMenuContext | ContextMenuContext;
|
|
845
|
+
/** The built-in tool panels of the side bar. */
|
|
846
|
+
export type ToolPanelId = 'columns' | 'filters';
|
|
847
|
+
/** What a custom tool panel draws from. */
|
|
848
|
+
export interface ToolPanelContext {
|
|
849
|
+
grid: Grid;
|
|
850
|
+
texts: GridTexts;
|
|
851
|
+
}
|
|
852
|
+
export interface ToolPanelRendererInstance {
|
|
853
|
+
/** Called each time the panel opens and when the locale changes. */
|
|
854
|
+
update(ctx: ToolPanelContext): void;
|
|
855
|
+
destroy(): void;
|
|
856
|
+
}
|
|
857
|
+
/** A custom tool panel's content (`ToolPanelDef.renderer`): created when the panel first opens, kept while it lives. */
|
|
858
|
+
export interface ToolPanelRenderer {
|
|
859
|
+
create(host: HTMLElement): ToolPanelRendererInstance;
|
|
860
|
+
}
|
|
861
|
+
/** The columns panel. */
|
|
862
|
+
export interface ColumnsPanelOptions {
|
|
863
|
+
/** A search box over the names (default true). */
|
|
864
|
+
search?: boolean;
|
|
865
|
+
/** A tri-state checkbox over the listed hideable columns (default true). */
|
|
866
|
+
selectAll?: boolean;
|
|
867
|
+
/** Expand / collapse every group (default true). */
|
|
868
|
+
expandAll?: boolean;
|
|
869
|
+
/** Rows drag (and Alt+Up / Alt+Down move) their columns (default true). */
|
|
870
|
+
reorder?: boolean;
|
|
871
|
+
/** The Row Groups section (default true); never in tree mode or for a source that cannot group. */
|
|
872
|
+
rowGroups?: boolean;
|
|
873
|
+
/** The Values section (default true); shown only while some column has `aggregates`. */
|
|
874
|
+
values?: boolean;
|
|
875
|
+
/**
|
|
876
|
+
* Sort markers: each sorted column's row shows the header's glyph and, while two or more columns
|
|
877
|
+
* are sorted (hidden ones included), its priority; a click on the marker flips the direction and keeps the
|
|
878
|
+
* column's place in the sort order, its × removes that sort (both report `'sort'`); on the active row of a
|
|
879
|
+
* sortable sorted column Enter flips and Delete / Backspace removes. The row's accessible name carries the state
|
|
880
|
+
* (`texts.sortStateAscending` / `sortStateDescending`, and `sortStatePriority` with two or more sorts); a
|
|
881
|
+
* `sortable: false` column shows the marker only. A closed group in the list over a sorted column shows a dot.
|
|
882
|
+
* Default false.
|
|
883
|
+
*/
|
|
884
|
+
sort?: boolean;
|
|
885
|
+
/**
|
|
886
|
+
* A "Reset columns" button at the bottom (`ig-button ig-columns-panel-reset`, `texts.resetColumns`):
|
|
887
|
+
* `true` runs `grid.resetColumnState()`, a function runs instead (the app's own reset). Default off.
|
|
888
|
+
*/
|
|
889
|
+
reset?: boolean | ((ctx: {
|
|
890
|
+
grid: Grid;
|
|
891
|
+
}) => void);
|
|
892
|
+
}
|
|
893
|
+
/** The filters panel. */
|
|
894
|
+
export interface FiltersPanelOptions {
|
|
895
|
+
/** A search box over the names (default true). */
|
|
896
|
+
search?: boolean;
|
|
897
|
+
/** Expand / collapse every section (default true). */
|
|
898
|
+
expandAll?: boolean;
|
|
899
|
+
}
|
|
900
|
+
/** A tool panel of the side bar: a built-in one by id ('columns', 'filters') or an app-defined one. */
|
|
901
|
+
export interface ToolPanelDef {
|
|
902
|
+
id: string;
|
|
903
|
+
/** The button's label; default from the texts for the built-in panels, else the id. */
|
|
904
|
+
label?: string;
|
|
905
|
+
/** The button's icon: SVG path data in a 16 × 16 view box. */
|
|
906
|
+
icon?: string;
|
|
907
|
+
/** The content of a custom panel. */
|
|
908
|
+
renderer?: ToolPanelRenderer;
|
|
909
|
+
/** Initial width in px (default 250); the user's width is kept while the grid lives. */
|
|
910
|
+
width?: number;
|
|
911
|
+
/** Default 180. */
|
|
912
|
+
minWidth?: number;
|
|
913
|
+
/** Default 600. */
|
|
914
|
+
maxWidth?: number;
|
|
915
|
+
/** For id 'columns'. */
|
|
916
|
+
columns?: ColumnsPanelOptions;
|
|
917
|
+
/** For id 'filters'. */
|
|
918
|
+
filters?: FiltersPanelOptions;
|
|
919
|
+
}
|
|
920
|
+
/** The side bar. */
|
|
921
|
+
export interface SideBarOptions {
|
|
922
|
+
/** Default ['columns', 'filters']. */
|
|
923
|
+
panels?: readonly (ToolPanelId | ToolPanelDef)[];
|
|
924
|
+
/** The panel open at start (default none). */
|
|
925
|
+
open?: string | null;
|
|
926
|
+
/** Default 'right'. */
|
|
927
|
+
position?: 'left' | 'right';
|
|
928
|
+
/** The whole side bar is hidden (default false). */
|
|
929
|
+
hidden?: boolean;
|
|
930
|
+
}
|
|
931
|
+
export interface AutoSizeOptions {
|
|
932
|
+
/** Include the header content (default true). */
|
|
933
|
+
header?: boolean;
|
|
934
|
+
/** Extra upper bound in px (below `maxWidth`). */
|
|
935
|
+
max?: number;
|
|
936
|
+
}
|
|
937
|
+
/** `GridOptions.scrollbars`. */
|
|
938
|
+
export interface ScrollbarsOptions {
|
|
939
|
+
/** `'always'`: the vertical bar stays while nothing overflows; on overlay platforms the bars are drawn. */
|
|
940
|
+
vertical?: 'auto' | 'always';
|
|
941
|
+
/** `'always'`: the horizontal bar stays while nothing overflows; on overlay platforms the bars are drawn. */
|
|
942
|
+
horizontal?: 'auto' | 'always';
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* The group `GridOptions.groupTotalRow`'s function is asked about — once per group per run (a tree: per
|
|
946
|
+
* parent or filler with visible children).
|
|
947
|
+
*/
|
|
948
|
+
export interface TotalRowGroup {
|
|
949
|
+
/** The group's keys, outermost first (its own last). */
|
|
950
|
+
path: readonly GroupKey[];
|
|
951
|
+
/** Its level, 0 = top. */
|
|
952
|
+
level: number;
|
|
953
|
+
/** Its own key. */
|
|
954
|
+
key: GroupKey;
|
|
955
|
+
/** The level's grouped field (a tree: its label field, `groupColumn.field`). */
|
|
956
|
+
field: string;
|
|
957
|
+
}
|
|
958
|
+
export interface GridOptions {
|
|
959
|
+
/** Column definitions; `{ id: 'ig:group' }` at the top level places the group column (see `ColumnNode`). */
|
|
960
|
+
columns: ColumnNode[];
|
|
961
|
+
rows: ViewportSource;
|
|
962
|
+
/**
|
|
963
|
+
* Computed row height in px; evaluated the first time the engine meets a loaded row. Must be cheap and pure:
|
|
964
|
+
* it is called during rendering and measurement. A pinned row's gets its index in its section,
|
|
965
|
+
* the section's own small source (its `getValue` reads the row) and its section as `pinned`; body rows get no
|
|
966
|
+
* third argument.
|
|
967
|
+
*/
|
|
968
|
+
rowHeight?: (row: number, source: ViewportSource, pinned?: 'top' | 'bottom') => number;
|
|
969
|
+
overscan?: {
|
|
970
|
+
rows?: number;
|
|
971
|
+
columnsPx?: number;
|
|
972
|
+
};
|
|
973
|
+
ariaLabel?: string;
|
|
974
|
+
/** Merged under every leaf definition. */
|
|
975
|
+
defaultColumn?: ColumnDefaults;
|
|
976
|
+
/** The grid-owned row-number column. */
|
|
977
|
+
rowNumbers?: boolean | RowNumbersOptions;
|
|
978
|
+
/** Applied with `{ order: true }` at creation, before the first render. */
|
|
979
|
+
columnState?: ColumnState[];
|
|
980
|
+
/**
|
|
981
|
+
* The column groups' open states, applied at creation after the definitions and the column state, with
|
|
982
|
+
* no event. Groups not listed start at `openByDefault`.
|
|
983
|
+
*/
|
|
984
|
+
columnGroupState?: ColumnGroupState[];
|
|
985
|
+
/** The grid-owned group column; `field` switches to tree mode. */
|
|
986
|
+
groupColumn?: GroupColumnOptions;
|
|
987
|
+
/**
|
|
988
|
+
* The row group panel above the header: `true` always, `'onlyWhenGrouping'` while at least one
|
|
989
|
+
* column is grouped; default false; never shown in tree mode.
|
|
990
|
+
*/
|
|
991
|
+
groupPanel?: boolean | 'onlyWhenGrouping';
|
|
992
|
+
/**
|
|
993
|
+
* A header dragged more than 32 px outside the grid and let go hides its columns (default `true`).
|
|
994
|
+
* `{ distance }` sets that distance in px. The top bar's height does not count: above
|
|
995
|
+
* the grid the distance is measured from the group bar, else from the header. The group bar keeps a 32 px margin
|
|
996
|
+
* above and beside it however short the distance. `false`: outside the grid the drag shows the refused look and
|
|
997
|
+
* the drop changes nothing; `hideable: false` refuses it per column either way.
|
|
998
|
+
*/
|
|
999
|
+
dragOutHides?: boolean | DragOutOptions;
|
|
1000
|
+
/**
|
|
1001
|
+
* Columns slide into their new place, the header and the rows (default `true`): a column the user moves within a
|
|
1002
|
+
* side from the header (a drop, Shift+← / →), a column group folding open or closed, and columns hidden or shown
|
|
1003
|
+
* (the column list, a drag out of the grid, the top bar's chip, `grid.setHidden`) — not when a pinned side changes
|
|
1004
|
+
* its width. The slide lasts `--ig-column-move-duration` (200 ms; `0s` turns it off too). `true` plays no slide
|
|
1005
|
+
* under `prefers-reduced-motion`; `'always'` plays it there too; `false` never.
|
|
1006
|
+
*/
|
|
1007
|
+
animateColumnMoves?: boolean | 'always';
|
|
1008
|
+
/**
|
|
1009
|
+
* Open group rows and tree parents stay under the header while their rows scroll by, nested ones stacked, the stack
|
|
1010
|
+
* at most half the rows area (default `true`). Live: `grid.setStickyGroupRows(on)`.
|
|
1011
|
+
*/
|
|
1012
|
+
stickyGroupRows?: boolean;
|
|
1013
|
+
/**
|
|
1014
|
+
* Client data: each open group (or tree parent) gets a total row with its aggregates, "Total <label>"
|
|
1015
|
+
* in the group column — its first (`'top'`) or last (`'bottom'`) row. A function answers per group, `undefined` = no
|
|
1016
|
+
* total for that one. Default none. Live: `grid.setGroupTotalRow(value)`.
|
|
1017
|
+
*/
|
|
1018
|
+
groupTotalRow?: 'top' | 'bottom' | ((group: TotalRowGroup) => 'top' | 'bottom' | undefined);
|
|
1019
|
+
/**
|
|
1020
|
+
* Client data: one row with the aggregates over every row the filters pass, "Total" — the first
|
|
1021
|
+
* (`'top'`) or last (`'bottom'`) row, or a row of the pinned section above (`'pinnedTop'`: its first) or below
|
|
1022
|
+
* (`'pinnedBottom'`: its last) the rows, beside `pinnedTopRows` / `pinnedBottomRows`; none while no row
|
|
1023
|
+
* passes. Default none. Live: `grid.setGrandTotalRow(value)`.
|
|
1024
|
+
*/
|
|
1025
|
+
grandTotalRow?: 'top' | 'bottom' | 'pinnedTop' | 'pinnedBottom';
|
|
1026
|
+
/**
|
|
1027
|
+
* Total rows stick to the edge they belong to while their rows scroll by (default `true`); `'grand'` or `'group'`
|
|
1028
|
+
* names the only kind that still sticks, `false` none. Live: `grid.setStickyTotalRows(value)`.
|
|
1029
|
+
*/
|
|
1030
|
+
stickyTotalRows?: boolean | 'grand' | 'group';
|
|
1031
|
+
/**
|
|
1032
|
+
* An open group's row keeps its aggregates while its total row shows them too (default `false`:
|
|
1033
|
+
* blank). Live: `grid.setKeepGroupValues(on)`.
|
|
1034
|
+
*/
|
|
1035
|
+
keepGroupValues?: boolean;
|
|
1036
|
+
/**
|
|
1037
|
+
* Rows of the app's own objects pinned above the body, under the header: they stay in view
|
|
1038
|
+
* while the body scrolls, in array order. Each column reads its field as on a body row — through the client
|
|
1039
|
+
* source's field getter (`FieldDef.value`) when the grid shows a `clientSource`, else `row[field]` — and draws it
|
|
1040
|
+
* with the same column definitions. Never sorted, filtered, grouped, aggregated or selected; not counted in
|
|
1041
|
+
* `rowCount` or the status bar. Keep them few: every pinned row is drawn. Live: `grid.setPinnedTopRows(rows)`.
|
|
1042
|
+
*/
|
|
1043
|
+
pinnedTopRows?: readonly object[];
|
|
1044
|
+
/** As `pinnedTopRows`, pinned below the body, at the grid's bottom edge. Live: `grid.setPinnedBottomRows(rows)`. */
|
|
1045
|
+
pinnedBottomRows?: readonly object[];
|
|
1046
|
+
/**
|
|
1047
|
+
* Keys that expand / collapse every group (or tree parent) from any body cell or header cell, the column menu's
|
|
1048
|
+
* "Expand all" / "Collapse all" (default `false`). `true` = `>` expands, `<`
|
|
1049
|
+
* collapses; an object names the keys (`KeyboardEvent.key`, exact — Shift is not checked, so any layout works), a
|
|
1050
|
+
* missing one has no key. Ignored with Ctrl, ⌘ or Alt, from an editable target, and while nothing is expandable.
|
|
1051
|
+
* Live: `grid.setGroupKeys(keys)`.
|
|
1052
|
+
*/
|
|
1053
|
+
groupKeys?: boolean | {
|
|
1054
|
+
expandAll?: string;
|
|
1055
|
+
collapseAll?: string;
|
|
1056
|
+
};
|
|
1057
|
+
/**
|
|
1058
|
+
* The status bar under the body: `true` = one `totalAndFilteredRows` panel; default none. A grid
|
|
1059
|
+
* without it creates no bar element.
|
|
1060
|
+
*/
|
|
1061
|
+
statusBar?: boolean | StatusBarOptions;
|
|
1062
|
+
/**
|
|
1063
|
+
* The top bar above the grid: quick-filter box, find box, count chips, buttons and app items; `false` or
|
|
1064
|
+
* left out = no bar (no element is created). Live: `grid.setToolbar`. Not inherited by detail grids.
|
|
1065
|
+
*/
|
|
1066
|
+
toolbar?: false | ToolbarOptions;
|
|
1067
|
+
/** Texts and number format: English built in; `@olvnck/ingrid/locale/de` ships German. */
|
|
1068
|
+
locale?: LocaleOptions;
|
|
1069
|
+
/**
|
|
1070
|
+
* The quick filter's text: rows stay when every word (split on whitespace, case-insensitive)
|
|
1071
|
+
* occurs in one of their values in the fields of columns that are not hidden (a column a closed group does not show
|
|
1072
|
+
* is still searched), the grouped fields or the tree's label field. Handed to the source in its query
|
|
1073
|
+
* (`RowQuery.quickFilter`); a source without `setQuery` cannot filter (a console hint says so once). Not column
|
|
1074
|
+
* state: `getColumnState` does not carry it.
|
|
1075
|
+
*/
|
|
1076
|
+
quickFilter?: string;
|
|
1077
|
+
/**
|
|
1078
|
+
* Find: the cells' shown texts that contain this text are marked, and
|
|
1079
|
+
* `findNext` / `findPrevious` / `findGoTo` move the active match (opening its groups, scrolling it in). The whole
|
|
1080
|
+
* text is one substring, matched as typed (not trimmed, no word splitting), per occurrence; `''` or absent: off.
|
|
1081
|
+
* Rows stay as they are (the quick filter removes rows). Client sources only. Live: `grid.setFind(text)`.
|
|
1082
|
+
*/
|
|
1083
|
+
find?: string;
|
|
1084
|
+
/** Find's options: `caseSensitive` (default false). Live: `grid.setFindOptions(options)`. */
|
|
1085
|
+
findOptions?: {
|
|
1086
|
+
caseSensitive?: boolean;
|
|
1087
|
+
};
|
|
1088
|
+
/**
|
|
1089
|
+
* Class name(s) for a body row, e.g. from the row's data. Called when the row is bound (a row coming
|
|
1090
|
+
* into view, a data change, a row moved by a splice), not in every frame, and not for rows that are loading or
|
|
1091
|
+
* failed; group rows and tree fillers go through it too. Its result is written only when it changed. A throwing
|
|
1092
|
+
* function is reported once and adds no class. Pass a stable function: `setRowClass` re-binds every rendered row.
|
|
1093
|
+
* Pinned rows go through it too, with their index in their section and their section as `pinned`;
|
|
1094
|
+
* body rows get no second argument.
|
|
1095
|
+
*/
|
|
1096
|
+
rowClass?: (row: number, pinned?: 'top' | 'bottom') => string | undefined;
|
|
1097
|
+
/**
|
|
1098
|
+
* The column filters applied at creation, before the first query: column id → that column's model
|
|
1099
|
+
* (`getFilterModel()`'s shape). Validated as `setFilterModel` validates.
|
|
1100
|
+
*/
|
|
1101
|
+
filterModel?: FilterModel;
|
|
1102
|
+
/** Merged key by key under every built-in filter definition, e.g. `{ maxConditions: 99 }`. */
|
|
1103
|
+
filterDefaults?: FilterDefaults;
|
|
1104
|
+
/**
|
|
1105
|
+
* Replacements for the header icons: menu, filter, filter active, sort arrows, and the column group chevrons.
|
|
1106
|
+
*/
|
|
1107
|
+
icons?: HeaderIcons;
|
|
1108
|
+
/**
|
|
1109
|
+
* The styled tooltips of cells, headers and menu items: their delays, `'truncated'`, the browser's own
|
|
1110
|
+
* tooltip instead, the touch hold. Which cells and headers have one: `ColumnDef.tooltip` / `headerTooltip`.
|
|
1111
|
+
*/
|
|
1112
|
+
tooltips?: TooltipOptions;
|
|
1113
|
+
/** The column menu. */
|
|
1114
|
+
columnMenu?: {
|
|
1115
|
+
/**
|
|
1116
|
+
* The grid-wide entries (a column's `menuItems` wins): an array, or a builder called with the menu's context and
|
|
1117
|
+
* its default entries (built-in item names and separators) each time the menu opens. Also used for the menu of
|
|
1118
|
+
* a group header and of the empty header area (`column` null). An empty list opens nothing.
|
|
1119
|
+
*/
|
|
1120
|
+
items?: MenuItems<ColumnMenuContext>;
|
|
1121
|
+
/**
|
|
1122
|
+
* The header's menu button: 'always' shown (default), or 'hover': shown while the pointer is over the header
|
|
1123
|
+
* cell, while its menu is open and while focus is inside the cell; it keeps its room either way.
|
|
1124
|
+
*/
|
|
1125
|
+
button?: 'always' | 'hover';
|
|
1126
|
+
};
|
|
1127
|
+
/**
|
|
1128
|
+
* The context menu: a right-click over a body cell or the empty body area opens
|
|
1129
|
+
* the cell's entries — the column's `contextMenuItems`, else `items`, else the defaults — at the pointer; the
|
|
1130
|
+
* ContextMenu key and Shift+F10 open the focused cell's, anchored to it (a cell out of view is scrolled into view
|
|
1131
|
+
* first).
|
|
1132
|
+
*
|
|
1133
|
+
* The defaults, while copying is on: Copy (`'copy'`, with the platform's shortcut) and Copy with headers
|
|
1134
|
+
* (`'copyWithHeaders'`), plus Copy with group headers (`'copyWithGroupHeaders'`) only while the columns have groups;
|
|
1135
|
+
* then, while export is on, a separator and Export (`'export'`: CSV, TSV and Excel sub-items `'exportCsv'`,
|
|
1136
|
+
* `'exportTsv'`, `'exportXlsx'`), which exports every row, and — on a row — Export selection (`'exportSelection'`:
|
|
1137
|
+
* sub-items `'exportSelectionCsv'`, `'exportSelectionTsv'`, `'exportSelectionXlsx'`), which exports
|
|
1138
|
+
* `rows: 'selection'` with that row as its last fallback. An `items` array replaces them; a builder gets
|
|
1139
|
+
* them as `defaults`. With no entries — `clipboard: false` and no `items`, or an empty array — nothing opens and the
|
|
1140
|
+
* browser's own menu shows. The browser's menu also stays over editable content (inputs, text areas), over
|
|
1141
|
+
* interactive content in a cell (a renderer's button, link or form field) and, with `textSelection`, over selected
|
|
1142
|
+
* text.
|
|
1143
|
+
*
|
|
1144
|
+
* A right-click inside a cell range keeps the ranges and the focus; outside every range it moves focus to the cell
|
|
1145
|
+
* and collapses the ranges to it — also when the menu then has no entries and the browser's menu shows; it never
|
|
1146
|
+
* changes the row selection. `false` turns the menu and these rules off, column entries included (default true).
|
|
1147
|
+
*/
|
|
1148
|
+
contextMenu?: boolean | {
|
|
1149
|
+
/**
|
|
1150
|
+
* The grid-wide entries: an array, or a builder called with the menu's context and the default entries as
|
|
1151
|
+
* `defaults` each time the menu opens. Built-in item names apply to the clicked cell's column; without one
|
|
1152
|
+
* (the empty area, the row-number column) the column-bound names are left out.
|
|
1153
|
+
*/
|
|
1154
|
+
items?: MenuItems<ContextMenuContext>;
|
|
1155
|
+
/**
|
|
1156
|
+
* A `contextmenu` with Ctrl held (Ctrl + right-click; on macOS also Ctrl + click) opens the grid's menu too;
|
|
1157
|
+
* default false: it is left to the browser's menu.
|
|
1158
|
+
*/
|
|
1159
|
+
withControlKey?: boolean;
|
|
1160
|
+
};
|
|
1161
|
+
/**
|
|
1162
|
+
* The side bar beside the body: `true` shows the columns and filters panels with the columns panel
|
|
1163
|
+
* open; 'columns' or 'filters' shows that panel alone, open; the object form starts with no panel open unless
|
|
1164
|
+
* `open` says so. Default: no side bar.
|
|
1165
|
+
*/
|
|
1166
|
+
sideBar?: boolean | ToolPanelId | SideBarOptions;
|
|
1167
|
+
/**
|
|
1168
|
+
* The body's placeholder, centred under the header: `texts.noRows` ("No rows to show") while the grid has no
|
|
1169
|
+
* rows — none in the data, all filtered out, no groups — once the source answered (not while a server source loads
|
|
1170
|
+
* its first block); `texts.noColumns` ("No columns to show") while every data column is hidden, when the body also
|
|
1171
|
+
* draws no rows. A polite live region; the pointer passes through it. Default true; `false` shows neither text.
|
|
1172
|
+
*/
|
|
1173
|
+
noRowsOverlay?: boolean;
|
|
1174
|
+
/**
|
|
1175
|
+
* When the scrollbars show: `'always'` keeps that axis's bar while nothing overflows, and where the platform's
|
|
1176
|
+
* scrollbars overlay the content (macOS by default) the grid draws both bars itself, in their own strip, in the
|
|
1177
|
+
* theme's colours (`--ig-scrollbar-size`, `--ig-scrollbar-track-bg`, `--ig-scrollbar-thumb-bg`,
|
|
1178
|
+
* `--ig-scrollbar-thumb-hover-bg`; Chromium and WebKit — Firefox keeps the platform's). Default `'auto'` for both:
|
|
1179
|
+
* the platform's bars, shown while their axis overflows.
|
|
1180
|
+
*/
|
|
1181
|
+
scrollbars?: ScrollbarsOptions;
|
|
1182
|
+
/** Row selection; a string is `{ mode }` with the defaults. Default: none. */
|
|
1183
|
+
rowSelection?: 'single' | 'multiple' | RowSelectionOptions;
|
|
1184
|
+
/** The row selection applied at creation (Vue: `v-model:selection`). */
|
|
1185
|
+
selection?: RowSelectionState;
|
|
1186
|
+
/** Cell selection; `true` is `{}`. Default false. */
|
|
1187
|
+
cellSelection?: boolean | CellSelectionOptions;
|
|
1188
|
+
/** The cell ranges applied at creation (Vue: `v-model:cellRanges`). */
|
|
1189
|
+
cellRanges?: readonly CellRange[];
|
|
1190
|
+
/** Copying; `false` turns it off (keys, menu items and `copy()`; `copyText()` still works). Default true. */
|
|
1191
|
+
clipboard?: boolean | ClipboardOptions;
|
|
1192
|
+
/**
|
|
1193
|
+
* Exporting: the defaults of every export (a request's fields win field by field). `false` removes
|
|
1194
|
+
* the menu items and makes `export()` resolve `{ cancelled: true }`; `exportBlob()` still works. Default true.
|
|
1195
|
+
*/
|
|
1196
|
+
export?: boolean | ExportOptions;
|
|
1197
|
+
/** Cells take keyboard focus; `'row'`: rows are the unit. Default true. */
|
|
1198
|
+
cellFocus?: boolean | 'row';
|
|
1199
|
+
/** Header cells take keyboard focus. Default true. */
|
|
1200
|
+
headerFocus?: boolean;
|
|
1201
|
+
/** Body cells take part in the browser's text selection. Default false. */
|
|
1202
|
+
textSelection?: boolean;
|
|
1203
|
+
/** Overrides the target of a navigation key. */
|
|
1204
|
+
navigate?: (move: NavigationMove) => CellAddress | null | false | undefined;
|
|
1205
|
+
/**
|
|
1206
|
+
* Turns row dragging on for this grid's rows; `true` = `{}`. Default off: without it nothing is
|
|
1207
|
+
* built — a grid that only receives drops needs no `rowDrag`.
|
|
1208
|
+
*/
|
|
1209
|
+
rowDrag?: boolean | RowDragOptions;
|
|
1210
|
+
/**
|
|
1211
|
+
* Master/detail: a detail under master rows, opened by a chevron. Default off: without it nothing is
|
|
1212
|
+
* built — no toggle column, no per-row call, no listener.
|
|
1213
|
+
*/
|
|
1214
|
+
detail?: DetailOptions;
|
|
1215
|
+
/**
|
|
1216
|
+
* Cell editing: how editors open, close and validate. Columns opt in with `ColumnDef.editable`. Live:
|
|
1217
|
+
* `Grid.setEditing`. Default `{}`: nothing is built while no column may be edited.
|
|
1218
|
+
*/
|
|
1219
|
+
editing?: EditingOptions;
|
|
1220
|
+
}
|
|
1221
|
+
export interface RowSelectionOptions {
|
|
1222
|
+
mode: 'single' | 'multiple';
|
|
1223
|
+
/** Default true; false for a selectable row = a disabled box. */
|
|
1224
|
+
checkboxes?: boolean | ((ctx: RowSelectContext) => boolean);
|
|
1225
|
+
/** The selection column (default) or the group column. */
|
|
1226
|
+
checkboxLocation?: 'column' | 'group';
|
|
1227
|
+
/** 'multiple' only; default: true while row boxes are in the selection column. */
|
|
1228
|
+
headerCheckbox?: boolean;
|
|
1229
|
+
/** Clicks on the row select / Mod-click deselects; default false. */
|
|
1230
|
+
click?: boolean | 'select' | 'deselect';
|
|
1231
|
+
/** Plain clicks toggle and add (touch-friendly); default false. */
|
|
1232
|
+
clickToggles?: boolean;
|
|
1233
|
+
/** Default: every data row (with an id on server sources). */
|
|
1234
|
+
selectable?: (ctx: RowSelectContext) => boolean;
|
|
1235
|
+
/** Default false. */
|
|
1236
|
+
hideDisabledCheckboxes?: boolean;
|
|
1237
|
+
/** Header checkbox, Ctrl/Cmd+A, `selectAll()`; default 'filtered'. */
|
|
1238
|
+
selectAll?: 'all' | 'filtered';
|
|
1239
|
+
/** Default 'self'. */
|
|
1240
|
+
groupSelects?: 'self' | 'descendants' | 'filteredDescendants';
|
|
1241
|
+
/** Moving the focused cell to a row selects it alone. */
|
|
1242
|
+
followFocus?: boolean;
|
|
1243
|
+
/** Default width 40. */
|
|
1244
|
+
selectionColumn?: {
|
|
1245
|
+
width?: number;
|
|
1246
|
+
};
|
|
1247
|
+
}
|
|
1248
|
+
export interface CellSelectionOptions {
|
|
1249
|
+
/** More than one range (Ctrl/Cmd adds); default true. */
|
|
1250
|
+
multiple?: boolean;
|
|
1251
|
+
/** 'row': every range spans all columns; default 'cell'. */
|
|
1252
|
+
unit?: 'cell' | 'row';
|
|
1253
|
+
/** Column selection from headers; default false. */
|
|
1254
|
+
columns?: false | 'click' | 'modifier';
|
|
1255
|
+
/** Headers of columns in a range are highlighted; default false. */
|
|
1256
|
+
headerHighlight?: boolean;
|
|
1257
|
+
/** What Mod+A selects while row selection is on too; default 'cells'. */
|
|
1258
|
+
selectAllKey?: 'cells' | 'rows';
|
|
1259
|
+
/**
|
|
1260
|
+
* The fill handle: a small square at the range's bottom-right corner, dragged over more cells. `true`
|
|
1261
|
+
* = `{}`. Default off (and `unit: 'cell'` only, with exactly one range). `direction`: `'xy'` (default; whichever
|
|
1262
|
+
* axis the pointer is further along), `'x'` or `'y'`. `clearOnShrink` (default true): dragging back clears the cells
|
|
1263
|
+
* given up. `value` may replace any filled value (`ctx.default` keeps it, `null` clears the cell) or return `undefined` to skip the cell.
|
|
1264
|
+
*/
|
|
1265
|
+
fill?: boolean | {
|
|
1266
|
+
direction?: 'xy' | 'x' | 'y';
|
|
1267
|
+
clearOnShrink?: boolean;
|
|
1268
|
+
value?: (ctx: FillValueContext) => unknown;
|
|
1269
|
+
};
|
|
1270
|
+
/**
|
|
1271
|
+
* The range handle: the same small square at the range's bottom-right
|
|
1272
|
+
* corner, but dragging it only resizes the range — its top-left cell stays, the corner follows the pointer — and
|
|
1273
|
+
* writes nothing, so it suits read-only grids. Default false; `unit: 'cell'` only, with exactly one range. With
|
|
1274
|
+
* `fill` on too, the fill handle takes the corner instead.
|
|
1275
|
+
*/
|
|
1276
|
+
rangeHandle?: boolean;
|
|
1277
|
+
}
|
|
1278
|
+
export interface ClipboardOptions {
|
|
1279
|
+
/** A header line (and group-header lines) on every copy; default false. */
|
|
1280
|
+
headers?: boolean | 'groups';
|
|
1281
|
+
/** Default '\t'. */
|
|
1282
|
+
delimiter?: string;
|
|
1283
|
+
/** Excel-style quoting; default true. */
|
|
1284
|
+
quote?: boolean;
|
|
1285
|
+
/** Copy selected rows before the focused cell; default false. */
|
|
1286
|
+
rows?: boolean;
|
|
1287
|
+
/** A cell's text; undefined = the default. */
|
|
1288
|
+
value?: (ctx: CopyCellContext) => string | undefined;
|
|
1289
|
+
/** A header's text; undefined = the default. */
|
|
1290
|
+
header?: (ctx: CopyHeaderContext) => string | undefined;
|
|
1291
|
+
/**
|
|
1292
|
+
* Asked before every copy; false cancels it. Gets the same `CopyInfo` as `write` (`target`, `headers`, `source` and
|
|
1293
|
+
* the size); nothing it sees depends on the text, which is built after the answer. A cancelled gesture (Mod+C,
|
|
1294
|
+
* a copy key, a `copy` event) is not asked again when the same gesture is delivered again within a second.
|
|
1295
|
+
*/
|
|
1296
|
+
confirm?: (info: CopyInfo) => boolean | Promise<boolean>;
|
|
1297
|
+
/** Replaces the clipboard write. */
|
|
1298
|
+
write?: (text: string, info: CopyInfo) => void | Promise<void>;
|
|
1299
|
+
/**
|
|
1300
|
+
* Keys for "Copy with headers" / "Copy with group headers", named after the menu items. A chord such as
|
|
1301
|
+
* `'Mod+Shift+C'`: `+`-separated, modifiers `Mod` (Ctrl or ⌘), `Shift`, `Alt` (case-insensitive, any order), the
|
|
1302
|
+
* last part the key (one character, `F1`–`F24` or a named key such as `PageDown`); at least `Mod` or `Alt`. An
|
|
1303
|
+
* invalid string binds nothing (one console hint). The menu items show the bound key as their shortcut. Off by
|
|
1304
|
+
* default.
|
|
1305
|
+
*/
|
|
1306
|
+
keys?: {
|
|
1307
|
+
copyWithHeaders?: string;
|
|
1308
|
+
copyWithGroupHeaders?: string;
|
|
1309
|
+
};
|
|
1310
|
+
/** Pasting; default true where cells are editable. `false` switches Mod+V, the menu item and `paste()` off. */
|
|
1311
|
+
paste?: boolean;
|
|
1312
|
+
/** Cutting; default true where cells are editable. `false`: Mod+X and `cut()` only copy. */
|
|
1313
|
+
cut?: boolean;
|
|
1314
|
+
/**
|
|
1315
|
+
* Reads the clipboard for a paste, the twin of `write`; replaces `navigator.clipboard.readText`
|
|
1316
|
+
* (Tauri and Electron hosts, a browser that refuses the read).
|
|
1317
|
+
*/
|
|
1318
|
+
read?: () => string | Promise<string>;
|
|
1319
|
+
/** Runs instead of the column's `parse` for one pasted text: return the value to write, as is (typed, not text). */
|
|
1320
|
+
pasteCell?: (ctx: PasteCellContext) => unknown;
|
|
1321
|
+
/** Sees the pasted rows and may return others, or `null` to cancel. */
|
|
1322
|
+
pasteData?: (rows: string[][]) => string[][] | null;
|
|
1323
|
+
}
|
|
1324
|
+
export interface CellAddress {
|
|
1325
|
+
/** Display index; in a pinned row its index in its section (`pinned`). */
|
|
1326
|
+
row: number;
|
|
1327
|
+
/** Column id. */
|
|
1328
|
+
column: string;
|
|
1329
|
+
/**
|
|
1330
|
+
* A pinned row's section: `'top'` or `'bottom'`; absent for a body row, whose index keeps its
|
|
1331
|
+
* meaning. Focusing a pinned cell scrolls its column into view, never the rows.
|
|
1332
|
+
*/
|
|
1333
|
+
pinned?: 'top' | 'bottom';
|
|
1334
|
+
}
|
|
1335
|
+
export type RowId = string | number;
|
|
1336
|
+
/** The row selection as JSON: selected ids, or with `all` every row except `ids`. */
|
|
1337
|
+
export interface RowSelectionState {
|
|
1338
|
+
all?: boolean;
|
|
1339
|
+
ids: readonly RowId[];
|
|
1340
|
+
}
|
|
1341
|
+
/**
|
|
1342
|
+
* A rectangle of cells. Rows are display indexes, `first` ≤ `last`; 'all' grows with the view and covers the
|
|
1343
|
+
* pinned rows too. A corner in a pinned section names it — `firstPinned` for `first`, `lastPinned` for
|
|
1344
|
+
* `last`, its row then the index in that section —, so one range can run from the top section through the body into
|
|
1345
|
+
* the bottom one; the corners are ordered top < body < bottom. A body corner has no such key.
|
|
1346
|
+
*/
|
|
1347
|
+
export interface CellRange {
|
|
1348
|
+
rows: {
|
|
1349
|
+
first: number;
|
|
1350
|
+
last: number;
|
|
1351
|
+
firstPinned?: 'top' | 'bottom';
|
|
1352
|
+
lastPinned?: 'top' | 'bottom';
|
|
1353
|
+
} | 'all';
|
|
1354
|
+
/** Column ids in display order; 'all' = every range column. */
|
|
1355
|
+
columns: readonly string[] | 'all';
|
|
1356
|
+
/** The corner a gesture started at; Shift extends from it. */
|
|
1357
|
+
anchor: CellAddress;
|
|
1358
|
+
}
|
|
1359
|
+
/** What `selectable` and `checkboxes` judge: rows without a display index too (filtered out, collapsed, not loaded). */
|
|
1360
|
+
export interface RowSelectContext {
|
|
1361
|
+
/** Display index; null when the row is not displayed. */
|
|
1362
|
+
row: number | null;
|
|
1363
|
+
/** The client row object; undefined on server sources. */
|
|
1364
|
+
data: unknown;
|
|
1365
|
+
id: RowId | null;
|
|
1366
|
+
}
|
|
1367
|
+
export interface NavigationMove {
|
|
1368
|
+
/** `event.key`. */
|
|
1369
|
+
key: string;
|
|
1370
|
+
from: CellAddress;
|
|
1371
|
+
/** The grid's own target; null at an edge or when Tab would leave the grid. */
|
|
1372
|
+
to: CellAddress | null;
|
|
1373
|
+
/**
|
|
1374
|
+
* True for a Shift move: the grid extends the selection — the active range's far corner, else the row
|
|
1375
|
+
* selection — from its anchor to the target. A `CellAddress` answer is the end it extends to, `false` stops the
|
|
1376
|
+
* key, `null` / `undefined` leave it to the grid's own Shift move. For a Shift move `to` is where the grid would
|
|
1377
|
+
* extend to.
|
|
1378
|
+
*/
|
|
1379
|
+
extend: boolean;
|
|
1380
|
+
event: KeyboardEvent;
|
|
1381
|
+
}
|
|
1382
|
+
export interface CopyCellContext {
|
|
1383
|
+
/** Display index; in a pinned row its index in its section (`pinned`). */
|
|
1384
|
+
row: number;
|
|
1385
|
+
column: ColumnInfo;
|
|
1386
|
+
/** Raw. */
|
|
1387
|
+
value: unknown;
|
|
1388
|
+
/** Displayed. */
|
|
1389
|
+
text: string;
|
|
1390
|
+
/** The row's metadata (group rows, levels); null on flat sources without it. */
|
|
1391
|
+
info: RowInfo | null;
|
|
1392
|
+
/** A pinned row's section: `'top'` or `'bottom'`; absent for a body row. */
|
|
1393
|
+
pinned?: 'top' | 'bottom';
|
|
1394
|
+
}
|
|
1395
|
+
export interface CopyHeaderContext {
|
|
1396
|
+
/** A header line cell. */
|
|
1397
|
+
column: ColumnInfo | null;
|
|
1398
|
+
/** A group-header line cell. */
|
|
1399
|
+
group: ColumnGroupInfo | null;
|
|
1400
|
+
/** The default text. */
|
|
1401
|
+
text: string;
|
|
1402
|
+
}
|
|
1403
|
+
export interface CopySize {
|
|
1404
|
+
rows: number;
|
|
1405
|
+
columns: number;
|
|
1406
|
+
cells: number;
|
|
1407
|
+
/** Rows still to be read from a server (a lower bound for grouped views). */
|
|
1408
|
+
unloaded: number;
|
|
1409
|
+
}
|
|
1410
|
+
export interface CopyInfo extends CopySize {
|
|
1411
|
+
target: 'ranges' | 'rows' | 'cell';
|
|
1412
|
+
headers: boolean | 'groups';
|
|
1413
|
+
source: 'keyboard' | 'menu' | 'api';
|
|
1414
|
+
}
|
|
1415
|
+
export interface AggregationPanelOptions {
|
|
1416
|
+
/** Default all five. */
|
|
1417
|
+
functions?: readonly ('count' | 'sum' | 'min' | 'max' | 'avg')[];
|
|
1418
|
+
/** Default 'values'. */
|
|
1419
|
+
numbers?: 'values' | 'text';
|
|
1420
|
+
format?: (value: number | bigint, fn: 'count' | 'sum' | 'min' | 'max' | 'avg') => string;
|
|
1421
|
+
}
|
|
1422
|
+
export interface FocusCellOptions {
|
|
1423
|
+
/** Vertical alignment (columns scroll to 'nearest'); default 'nearest'; false: no scroll. */
|
|
1424
|
+
align?: ScrollAlign | false;
|
|
1425
|
+
/** Move DOM focus to the cell; default true; false keeps it where it is. */
|
|
1426
|
+
browserFocus?: boolean;
|
|
1427
|
+
/** The cell also becomes the only range (cell selection on); default false. */
|
|
1428
|
+
select?: boolean;
|
|
1429
|
+
}
|
|
1430
|
+
export interface CopyOptions {
|
|
1431
|
+
/** Default 'auto': the ranges, the selected rows or the focused cell, by the copy key's priority. */
|
|
1432
|
+
target?: 'auto' | 'ranges' | 'rows' | 'cell';
|
|
1433
|
+
/** Default: the option's. */
|
|
1434
|
+
headers?: boolean | 'groups';
|
|
1435
|
+
/** How several ranges are written; default 'blocks'. */
|
|
1436
|
+
layout?: 'blocks' | 'grid';
|
|
1437
|
+
}
|
|
1438
|
+
export interface CopyResult {
|
|
1439
|
+
/** Rows, columns and cells copied; with `cancelled` the planned or the partial extent, not a promise. */
|
|
1440
|
+
rows: number;
|
|
1441
|
+
columns: number;
|
|
1442
|
+
cells: number;
|
|
1443
|
+
cancelled: boolean;
|
|
1444
|
+
}
|
|
1445
|
+
export type ExportFormat = 'csv' | 'tsv' | 'xlsx';
|
|
1446
|
+
/** An export's header rows (`ExportOptions.headers`). */
|
|
1447
|
+
export type ExportHeaders = boolean | 'groups' | 'folded';
|
|
1448
|
+
/**
|
|
1449
|
+
* What an export writes and how it is delivered: the grid's defaults (`GridOptions.export`) and every
|
|
1450
|
+
* request (`ExportRequest`), whose fields win field by field.
|
|
1451
|
+
*/
|
|
1452
|
+
export interface ExportOptions {
|
|
1453
|
+
/**
|
|
1454
|
+
* Default `'all'`: every row of the view — filters and sort as shown, every group's rows whether it is open or
|
|
1455
|
+
* closed, loaded or not (a server source reads what it has not sent, closed groups' levels included). `'selected'`:
|
|
1456
|
+
* the selected rows, displayed or inside closed groups; under the descendants modes a selected group row brings
|
|
1457
|
+
* every row below it. `'ranges'`: the cell ranges' union as one table, cells outside every range empty, a group row
|
|
1458
|
+
* in a range bringing its whole group with that range's columns; `columns` is ignored. `'selection'`: `'ranges'`
|
|
1459
|
+
* when the ranges cover more than one cell, else `'selected'` when rows are selected, else one row — the request's
|
|
1460
|
+
* `row`, else the focused cell's — with its whole group when it is a group row; else no rows.
|
|
1461
|
+
*/
|
|
1462
|
+
rows?: 'all' | 'selected' | 'ranges' | 'selection';
|
|
1463
|
+
/**
|
|
1464
|
+
* Default `'displayed'`: the displayed data columns and the group column in display order (left-pinned, centre,
|
|
1465
|
+
* right-pinned). `'all'`: hidden columns too, each at its place. A list of ids: those columns in the list's order
|
|
1466
|
+
* (hidden ones included, unknown ids skipped). Never the selection or row-drag handle column, never a column
|
|
1467
|
+
* whose `export` is false.
|
|
1468
|
+
*/
|
|
1469
|
+
columns?: 'displayed' | 'all' | readonly string[];
|
|
1470
|
+
/** The row-number column first, with the values it draws and the header `texts.rowNumberHeader`; default false. */
|
|
1471
|
+
rowNumbers?: boolean;
|
|
1472
|
+
/**
|
|
1473
|
+
* The group rows of a grouped view (the shown rows of open groups stay either way); default true. `false` leaves out
|
|
1474
|
+
* group rows and a tree's fillers only: total rows stay, each with its label written as text.
|
|
1475
|
+
*/
|
|
1476
|
+
groupRows?: boolean;
|
|
1477
|
+
/**
|
|
1478
|
+
* The pinned rows, in display order: with `rows: 'all'` the top section's rows right after the header
|
|
1479
|
+
* rows and the bottom section's last; with `'ranges'` / `'selection'` a range's pinned rows at their place
|
|
1480
|
+
* (`'selected'` has none: pinned rows are never selected). Default `true`: both sections; `'top'` / `'bottom'`: that
|
|
1481
|
+
* one; `false`: none. XLSX writes them as plain rows (outline level 0); `freeze` is unchanged.
|
|
1482
|
+
*/
|
|
1483
|
+
pinnedRows?: boolean | 'top' | 'bottom';
|
|
1484
|
+
/**
|
|
1485
|
+
* Default `'groups'`: one row per column-group level above the header row, a group's name in its first column;
|
|
1486
|
+
* `true`: the header row only; `false`: none; `'folded'`: one header row, each column's group names and its own
|
|
1487
|
+
* joined by `groupSeparator` ("Address / City"). A function picks one per format — group rows as
|
|
1488
|
+
* merged cells in XLSX, one folded row in CSV and TSV: `({ format }) => (format === 'xlsx' ? 'groups' : 'folded')`;
|
|
1489
|
+
* a throw is reported once, and it or any other answer writes the default.
|
|
1490
|
+
*/
|
|
1491
|
+
headers?: ExportHeaders | ((ctx: {
|
|
1492
|
+
format: ExportFormat;
|
|
1493
|
+
}) => ExportHeaders);
|
|
1494
|
+
/** The separator of `'folded'` headers; default `' / '`. */
|
|
1495
|
+
groupSeparator?: string;
|
|
1496
|
+
/**
|
|
1497
|
+
* Default `','` (csv) / `'\t'` (tsv); any string, e.g. `';'` for a German Excel. A grid-level `delimiter` applies to
|
|
1498
|
+
* CSV only: a TSV request uses a tab unless it names its own.
|
|
1499
|
+
*/
|
|
1500
|
+
delimiter?: string;
|
|
1501
|
+
/**
|
|
1502
|
+
* Default `'needed'`: a value containing the delimiter, a double quote, CR or LF is quoted (inner quotes doubled);
|
|
1503
|
+
* `'all'`: every cell, headers and empty cells included; `false`: as they are.
|
|
1504
|
+
*/
|
|
1505
|
+
quote?: 'needed' | 'all' | false;
|
|
1506
|
+
/** Default `'\r\n'`; the last line ends with it too. */
|
|
1507
|
+
lineEnding?: '\r\n' | '\n';
|
|
1508
|
+
/** A UTF-8 byte order mark first, so Excel reads umlauts on a double-click; default true. */
|
|
1509
|
+
bom?: boolean;
|
|
1510
|
+
/**
|
|
1511
|
+
* A text cell (header cells included) starting with `=`, `+`, `-`, `@`, a tab or a CR gets a leading apostrophe
|
|
1512
|
+
* unless the whole text is a number (`-5` stays); default true. A number's formatted text is no text cell while it
|
|
1513
|
+
* is number-shaped — a sign, a currency symbol, digits with grouping and decimal separators, `%` / `‰` — so
|
|
1514
|
+
* `-1,234.50` or `-5 €` stay; anything else in it (`-5 EUR`, `-2+3`) is escaped. XLSX never needs it.
|
|
1515
|
+
*/
|
|
1516
|
+
escapeFormulas?: boolean;
|
|
1517
|
+
/** Default `texts.exportSheetName` ('Sheet1'); `\ / ? * [ ] :` become spaces, at most 31 characters. */
|
|
1518
|
+
sheetName?: string;
|
|
1519
|
+
/** Frozen panes: the header rows (default), also the left-pinned columns and row numbers, or none. */
|
|
1520
|
+
freeze?: 'header' | 'headerAndPinned' | false;
|
|
1521
|
+
/**
|
|
1522
|
+
* The header row and the rows below it as an Excel table, so Excel knows the data area and shows the
|
|
1523
|
+
* filter buttons; default false. Only a flat list becomes one: a grouped view, a tree, an export with a `detail`
|
|
1524
|
+
* hook, without a header row (`headers: false`) or of a grid with pinned rows that `pinnedRows` takes stays a plain
|
|
1525
|
+
* sheet. Group rows of `headers: 'groups'` stay above the table. A table's column names are its header texts,
|
|
1526
|
+
* unique and not empty: an empty header is written as `texts.exportTableColumn` and the column's number
|
|
1527
|
+
* ("Column3"), a repeated one gets a number ("Name2"), and a line break, tab or control character in one becomes a
|
|
1528
|
+
* space.
|
|
1529
|
+
*/
|
|
1530
|
+
table?: boolean;
|
|
1531
|
+
/** Default `'export'`; the format's extension is added unless the name ends with it (any case). */
|
|
1532
|
+
fileName?: string | ((ctx: {
|
|
1533
|
+
format: ExportFormat;
|
|
1534
|
+
}) => string);
|
|
1535
|
+
/**
|
|
1536
|
+
* A cell's value, for every written cell: a string is written as text, a number, bigint, boolean or `Date` as that
|
|
1537
|
+
* value (CSV / TSV: `String`, dates ISO 8601), `null` empty, `undefined` the default. `ctx` is refilled for the next
|
|
1538
|
+
* cell: read it inside the call. A throw is reported once and the default is used.
|
|
1539
|
+
*/
|
|
1540
|
+
value?: (ctx: ExportCellContext) => ExportValue | undefined;
|
|
1541
|
+
/**
|
|
1542
|
+
* Rows of cell values written below an exported row, values as `value` returns them; `null` /
|
|
1543
|
+
* `undefined`: nothing. Called for every exported row that is not a group row (and has values) — masters or not,
|
|
1544
|
+
* `detail` on or off: the hook decides; `ctx.open` tells whether that row's detail is open (false for a row that is
|
|
1545
|
+
* no master and while `detail` is off) —, not for `rows: 'ranges'` exports — nor for `rows: 'selection'` when it
|
|
1546
|
+
* takes the ranges (its selected rows or its one row get it); a row wider than the exported columns is cut to their
|
|
1547
|
+
* count. On a server source `ctx.data` holds the exported columns' fields only; inside a closed group `ctx.row` is −1
|
|
1548
|
+
* (`ctx.open` still tells the master's state). Detail content is not exported otherwise. A throw is reported once and
|
|
1549
|
+
* writes nothing below that row.
|
|
1550
|
+
*/
|
|
1551
|
+
detail?: (ctx: ExportDetailContext) => readonly (readonly ExportValue[])[] | null | undefined;
|
|
1552
|
+
/** A header or group header cell's text (`ctx.column` or `ctx.group`); undefined = the default. */
|
|
1553
|
+
header?: (ctx: ExportHeaderContext) => string | undefined;
|
|
1554
|
+
/**
|
|
1555
|
+
* Asked before anything is read (`export()` only); `false`, or a promise of it, cancels. A desktop host may show its
|
|
1556
|
+
* Save dialog here and remember the path for `write`.
|
|
1557
|
+
*/
|
|
1558
|
+
confirm?: (size: ExportSize) => boolean | Promise<boolean>;
|
|
1559
|
+
/** After each slice that wrote rows (at most once a frame) and once at the end, when `rows === of`. */
|
|
1560
|
+
progress?: (p: {
|
|
1561
|
+
rows: number;
|
|
1562
|
+
of: number;
|
|
1563
|
+
}) => void;
|
|
1564
|
+
/** Replaces the download (`export()` only): the built file and the written counts. A rejection rejects `export()`. */
|
|
1565
|
+
write?: (file: ExportFile, info: ExportInfo) => void | Promise<void>;
|
|
1566
|
+
/**
|
|
1567
|
+
* Chunks as they are built (`export()` only; wins over `write`): each written and awaited in order, `close()` at the
|
|
1568
|
+
* end, `abort(reason)` on cancel or failure. `info` carries the planned counts.
|
|
1569
|
+
*/
|
|
1570
|
+
stream?: (info: ExportInfo) => ExportSink | Promise<ExportSink>;
|
|
1571
|
+
}
|
|
1572
|
+
/** One export: the options over the grid's, the format (default `'csv'`) and a signal that cancels it. */
|
|
1573
|
+
export interface ExportRequest extends ExportOptions {
|
|
1574
|
+
format?: ExportFormat;
|
|
1575
|
+
signal?: AbortSignal;
|
|
1576
|
+
/**
|
|
1577
|
+
* `rows: 'selection'`'s last fallback: this display row (with its group when it is a group row) instead of the
|
|
1578
|
+
* focused cell's — the context menu passes the row it was opened on.
|
|
1579
|
+
*/
|
|
1580
|
+
row?: number;
|
|
1581
|
+
}
|
|
1582
|
+
/** A cell as an export writes it; `null` is an empty cell. */
|
|
1583
|
+
export type ExportValue = string | number | bigint | boolean | Date | null;
|
|
1584
|
+
export interface ExportCellContext extends CopyCellContext {
|
|
1585
|
+
format: ExportFormat;
|
|
1586
|
+
}
|
|
1587
|
+
export interface ExportHeaderContext extends CopyHeaderContext {
|
|
1588
|
+
format: ExportFormat;
|
|
1589
|
+
}
|
|
1590
|
+
/** What an export will write, before anything is read (`confirm`). */
|
|
1591
|
+
export interface ExportSize {
|
|
1592
|
+
format: ExportFormat;
|
|
1593
|
+
/** With its extension. */
|
|
1594
|
+
fileName: string;
|
|
1595
|
+
rows: number;
|
|
1596
|
+
columns: number;
|
|
1597
|
+
cells: number;
|
|
1598
|
+
/** Rows a server must still send (a lower bound for grouped views). */
|
|
1599
|
+
unloaded: number;
|
|
1600
|
+
}
|
|
1601
|
+
/** `write`: the written counts; `stream`: the planned ones. */
|
|
1602
|
+
export interface ExportInfo extends ExportSize {
|
|
1603
|
+
source: 'menu' | 'api';
|
|
1604
|
+
}
|
|
1605
|
+
/** A built file. */
|
|
1606
|
+
export interface ExportFile {
|
|
1607
|
+
blob: Blob;
|
|
1608
|
+
name: string;
|
|
1609
|
+
/** Its media type (`text/csv;charset=utf-8`, …). */
|
|
1610
|
+
type: string;
|
|
1611
|
+
format: ExportFormat;
|
|
1612
|
+
rows: number;
|
|
1613
|
+
columns: number;
|
|
1614
|
+
cells: number;
|
|
1615
|
+
/** XLSX: rows, columns or texts were cut at Excel's limits. */
|
|
1616
|
+
truncated: boolean;
|
|
1617
|
+
}
|
|
1618
|
+
/** Where a `stream` export writes its chunks: a `WritableStream`'s writer or a `FileSystemWritableFileStream` fits. */
|
|
1619
|
+
export interface ExportSink {
|
|
1620
|
+
write(chunk: Uint8Array): void | Promise<void>;
|
|
1621
|
+
close(): void | Promise<void>;
|
|
1622
|
+
abort?(reason: unknown): void | Promise<void>;
|
|
1623
|
+
}
|
|
1624
|
+
export interface ExportResult {
|
|
1625
|
+
/** Data rows written (group rows and the `detail` hook's rows included, header rows not). */
|
|
1626
|
+
rows: number;
|
|
1627
|
+
columns: number;
|
|
1628
|
+
cells: number;
|
|
1629
|
+
bytes: number;
|
|
1630
|
+
truncated: boolean;
|
|
1631
|
+
cancelled: boolean;
|
|
1632
|
+
}
|
|
1633
|
+
/** `ColumnDef.export`'s object form: the mode and the column's XLSX details. */
|
|
1634
|
+
export interface ExportColumn {
|
|
1635
|
+
/** Default `'auto'`. */
|
|
1636
|
+
value?: 'auto' | 'text' | 'value';
|
|
1637
|
+
/**
|
|
1638
|
+
* XLSX: how strings are written — decimal numbers (`'1234.5'`, `'-1e3'`; not `'0x1F'`), ISO dates, `true` /
|
|
1639
|
+
* `false`, or everything as text.
|
|
1640
|
+
*/
|
|
1641
|
+
type?: 'number' | 'date' | 'boolean' | 'text';
|
|
1642
|
+
/** XLSX: an Excel format code for the column's number and date cells, e.g. `'#,##0.00'`. */
|
|
1643
|
+
numberFormat?: string;
|
|
1644
|
+
/** XLSX: the width in px; default the grid's width. */
|
|
1645
|
+
width?: number;
|
|
1646
|
+
}
|
|
1647
|
+
export interface CellPointerEvent {
|
|
1648
|
+
/** Display index; in a pinned row its index in its section (`pinned`). */
|
|
1649
|
+
row: number;
|
|
1650
|
+
/** A pinned row's section: `'top'` or `'bottom'`; absent for a body row. */
|
|
1651
|
+
pinned?: 'top' | 'bottom';
|
|
1652
|
+
column: ColumnInfo;
|
|
1653
|
+
/** The raw value; undefined while the row loads. */
|
|
1654
|
+
value: unknown;
|
|
1655
|
+
event: MouseEvent;
|
|
1656
|
+
}
|
|
1657
|
+
/** The built-in editors. */
|
|
1658
|
+
export type EditorName = 'text' | 'number' | 'date' | 'dateString' | 'select' | 'largeText';
|
|
1659
|
+
/** What a function `ColumnDef.editor` returns: a falsy result means the data type's editor. */
|
|
1660
|
+
export interface EditorChoice {
|
|
1661
|
+
editor?: EditorName | CellEditor;
|
|
1662
|
+
params?: object;
|
|
1663
|
+
popup?: boolean | 'over' | 'under';
|
|
1664
|
+
}
|
|
1665
|
+
/** The cell an `editable` / `editor` / `editorParams` / `parse` function is asked about. */
|
|
1666
|
+
export interface EditableContext {
|
|
1667
|
+
/** The row object (a pinned row: the app's own object; a server row: the plain object of its fields). */
|
|
1668
|
+
row: object;
|
|
1669
|
+
/** Display index; in a pinned row its index in its section (`pinned`). */
|
|
1670
|
+
rowIndex: number;
|
|
1671
|
+
pinned?: 'top' | 'bottom';
|
|
1672
|
+
column: ColumnDef;
|
|
1673
|
+
}
|
|
1674
|
+
/** What `ColumnDef.validate` is asked. */
|
|
1675
|
+
export interface ValidateContext extends EditableContext {
|
|
1676
|
+
/** The value about to be written, parsed. */
|
|
1677
|
+
value: unknown;
|
|
1678
|
+
/** The errors found so far (the editor's own). */
|
|
1679
|
+
errors: readonly string[];
|
|
1680
|
+
params: object;
|
|
1681
|
+
}
|
|
1682
|
+
/** A custom cell editor. */
|
|
1683
|
+
export interface CellEditor {
|
|
1684
|
+
/** Builds the editor in `host`; null vetoes the edit (nothing starts, no event). */
|
|
1685
|
+
create(host: HTMLElement, ctx: CellEditorContext): CellEditorInstance | null;
|
|
1686
|
+
}
|
|
1687
|
+
/** An open editor. Every callback is isolated and reported once. */
|
|
1688
|
+
export interface CellEditorInstance {
|
|
1689
|
+
/** The value to write; absent: the last `ctx.setValue`, else the start value. May run more than once. */
|
|
1690
|
+
getValue?(): unknown;
|
|
1691
|
+
/** Takes focus; absent: the first tabbable element in the host. */
|
|
1692
|
+
focus?(): void;
|
|
1693
|
+
errors?(): readonly string[] | null;
|
|
1694
|
+
/** True at a stop: nothing is written. */
|
|
1695
|
+
cancelled?(): boolean;
|
|
1696
|
+
destroy?(): void;
|
|
1697
|
+
}
|
|
1698
|
+
/** What `CellEditor.create` gets. */
|
|
1699
|
+
export interface CellEditorContext extends EditableContext {
|
|
1700
|
+
/** The start value, raw. */
|
|
1701
|
+
value: unknown;
|
|
1702
|
+
/** The printable character, `'Backspace'`, `'Enter'`, `'F2'`, or null. */
|
|
1703
|
+
key: string | null;
|
|
1704
|
+
params: object;
|
|
1705
|
+
/** Sets the value to commit; also runs validation. */
|
|
1706
|
+
setValue(value: unknown): void;
|
|
1707
|
+
stop(cancel?: boolean, event?: KeyboardEvent): void;
|
|
1708
|
+
validate(): void;
|
|
1709
|
+
/** The column's parser (`ColumnDef.parse`, else the data type's). */
|
|
1710
|
+
parse(text: string): unknown;
|
|
1711
|
+
format(value: unknown): string;
|
|
1712
|
+
}
|
|
1713
|
+
/** `GridOptions.editing`. */
|
|
1714
|
+
export interface EditingOptions {
|
|
1715
|
+
/** What opens an editor with the pointer; default `'double'`. */
|
|
1716
|
+
click?: 'double' | 'single' | 'none';
|
|
1717
|
+
/** Enter moves down: `'afterEdit'` after a commit, `'always'` (Excel style) also when not editing; default false. */
|
|
1718
|
+
enterMoves?: false | 'afterEdit' | 'always';
|
|
1719
|
+
/** Tab in an editor commits and opens the next cell's editor (`'edit'`) or only moves focus (`'focus'`); default `'edit'`. */
|
|
1720
|
+
tab?: 'edit' | 'focus';
|
|
1721
|
+
/** macOS: Backspace opens an empty editor instead of clearing; default false. */
|
|
1722
|
+
backspaceEdits?: boolean;
|
|
1723
|
+
/** Focus leaving the grid (the window, another element) commits; default false. */
|
|
1724
|
+
stopOnFocusLoss?: boolean;
|
|
1725
|
+
/** An invalid value on commit: reverted (`'revert'`) or the editor stays open (`'block'`); default `'revert'`. */
|
|
1726
|
+
invalid?: 'revert' | 'block';
|
|
1727
|
+
/** The grid writes nothing; `onCellEditRequest` asks the app to; default false. */
|
|
1728
|
+
request?: boolean;
|
|
1729
|
+
/** Undo and redo (`Grid.undo`, Mod+Z); default false; `limit` default 10. */
|
|
1730
|
+
undo?: boolean | {
|
|
1731
|
+
limit?: number;
|
|
1732
|
+
};
|
|
1733
|
+
}
|
|
1734
|
+
/** `ClipboardOptions.pasteCell`. */
|
|
1735
|
+
export interface PasteCellContext {
|
|
1736
|
+
/** The pasted text of this cell. */
|
|
1737
|
+
text: string;
|
|
1738
|
+
column: ColumnInfo;
|
|
1739
|
+
/** The row object it lands in. */
|
|
1740
|
+
row: unknown;
|
|
1741
|
+
/** Display index; in a pinned row its index in its section (`pinned`). */
|
|
1742
|
+
rowIndex: number;
|
|
1743
|
+
pinned?: 'top' | 'bottom';
|
|
1744
|
+
/** The cell's value before the paste. */
|
|
1745
|
+
oldValue: unknown;
|
|
1746
|
+
}
|
|
1747
|
+
/** `CellSelectionOptions.fill.value`. */
|
|
1748
|
+
export interface FillValueContext {
|
|
1749
|
+
column: ColumnInfo;
|
|
1750
|
+
/** The row object it lands in. */
|
|
1751
|
+
row: unknown;
|
|
1752
|
+
/** Display index; in a pinned row its index in its section (`pinned`). */
|
|
1753
|
+
rowIndex: number;
|
|
1754
|
+
pinned?: 'top' | 'bottom';
|
|
1755
|
+
direction: 'up' | 'down' | 'left' | 'right';
|
|
1756
|
+
/** The source cells' values the fill continues from, in order. */
|
|
1757
|
+
sources: readonly unknown[];
|
|
1758
|
+
/** Which filled cell this is, counted from 0 in the fill's direction. */
|
|
1759
|
+
index: number;
|
|
1760
|
+
/** The value the grid would write. */
|
|
1761
|
+
default: unknown;
|
|
1762
|
+
}
|
|
1763
|
+
/** An edit started. */
|
|
1764
|
+
export interface CellEditEvent {
|
|
1765
|
+
row: unknown;
|
|
1766
|
+
/** Display index; in a pinned row its index in its section (`pinned`). */
|
|
1767
|
+
rowIndex: number;
|
|
1768
|
+
pinned?: 'top' | 'bottom';
|
|
1769
|
+
column: ColumnInfo;
|
|
1770
|
+
value: unknown;
|
|
1771
|
+
event?: Event;
|
|
1772
|
+
}
|
|
1773
|
+
/** An edit ended. `changed` says whether a value was written (or requested). */
|
|
1774
|
+
export interface CellEditStopEvent extends CellEditEvent {
|
|
1775
|
+
oldValue: unknown;
|
|
1776
|
+
newValue: unknown;
|
|
1777
|
+
changed: boolean;
|
|
1778
|
+
cancelled: boolean;
|
|
1779
|
+
}
|
|
1780
|
+
/** `editing.request`: the value the app is asked to apply. */
|
|
1781
|
+
export interface CellEditRequest {
|
|
1782
|
+
row: unknown;
|
|
1783
|
+
rowIndex: number;
|
|
1784
|
+
pinned?: 'top' | 'bottom';
|
|
1785
|
+
column: ColumnInfo;
|
|
1786
|
+
oldValue: unknown;
|
|
1787
|
+
newValue: unknown;
|
|
1788
|
+
source: CellValueChange['source'];
|
|
1789
|
+
}
|
|
1790
|
+
/** A multi-cell edit operation. */
|
|
1791
|
+
export interface EditOperation {
|
|
1792
|
+
kind: 'clear' | 'paste' | 'cut' | 'fill' | 'copyDown' | 'bulk' | 'undo' | 'redo';
|
|
1793
|
+
source: 'key' | 'menu' | 'api' | 'pointer';
|
|
1794
|
+
changes: readonly {
|
|
1795
|
+
row: unknown;
|
|
1796
|
+
rowIndex: number;
|
|
1797
|
+
pinned?: 'top' | 'bottom';
|
|
1798
|
+
column: string;
|
|
1799
|
+
oldValue: unknown;
|
|
1800
|
+
newValue: unknown;
|
|
1801
|
+
}[];
|
|
1802
|
+
/** Request mode: nothing was written. */
|
|
1803
|
+
requested: boolean;
|
|
1804
|
+
initialRange?: CellRange;
|
|
1805
|
+
finalRange?: CellRange;
|
|
1806
|
+
}
|
|
1807
|
+
export interface CellKeyEvent {
|
|
1808
|
+
/** Display index; in a pinned row its index in its section (`pinned`). */
|
|
1809
|
+
row: number;
|
|
1810
|
+
/** A pinned row's section: `'top'` or `'bottom'`; absent for a body row. */
|
|
1811
|
+
pinned?: 'top' | 'bottom';
|
|
1812
|
+
column: ColumnInfo;
|
|
1813
|
+
value: unknown;
|
|
1814
|
+
/** Fired before the grid acts: `event.preventDefault()` keeps the grid out. */
|
|
1815
|
+
event: KeyboardEvent;
|
|
1816
|
+
/** The key came from inside an open cell editor (Enter, Escape and Tab bubble out of it). */
|
|
1817
|
+
editing: boolean;
|
|
1818
|
+
}
|
|
1819
|
+
/** What `Grid.flashCells` flashes: positions, like the cell ranges. */
|
|
1820
|
+
export interface FlashCellsOptions {
|
|
1821
|
+
/**
|
|
1822
|
+
* Display rows, inclusive; omitted: every row. Rows outside the rendered window are taken: they flash if they come
|
|
1823
|
+
* into view while the flash runs.
|
|
1824
|
+
*/
|
|
1825
|
+
rows?: RowRange | readonly RowRange[];
|
|
1826
|
+
/**
|
|
1827
|
+
* Column ids; omitted: every displayed column except the row-number and selection columns, which flash only when
|
|
1828
|
+
* named (the group column is one of every).
|
|
1829
|
+
*/
|
|
1830
|
+
columns?: readonly string[];
|
|
1831
|
+
/** ms the highlight holds before it fades; default the theme's `--ig-flash-hold` (500 ms). */
|
|
1832
|
+
duration?: number;
|
|
1833
|
+
}
|
|
1834
|
+
/** A written cell. */
|
|
1835
|
+
export interface CellValueChange {
|
|
1836
|
+
/**
|
|
1837
|
+
* The row object written, as `ColumnDef.setValue` received it (a server row: the plain object of its fields; a
|
|
1838
|
+
* pinned row: the app's own object).
|
|
1839
|
+
*/
|
|
1840
|
+
row: unknown;
|
|
1841
|
+
/** The row's display index at the write; in a pinned row its index in its section (`pinned`). */
|
|
1842
|
+
rowIndex: number;
|
|
1843
|
+
/**
|
|
1844
|
+
* A pinned row's section: a checkbox column's live box or a renderer's `setValue` in a pinned
|
|
1845
|
+
* row wrote into the app's object; absent for a body row.
|
|
1846
|
+
*/
|
|
1847
|
+
pinned?: 'top' | 'bottom';
|
|
1848
|
+
column: ColumnInfo;
|
|
1849
|
+
/** The cell's value before the write (what it showed). */
|
|
1850
|
+
oldValue: unknown;
|
|
1851
|
+
/** The value written (as given). */
|
|
1852
|
+
newValue: unknown;
|
|
1853
|
+
/**
|
|
1854
|
+
* A renderer's `CellContext.setValue` (`'renderer'`), `grid.setCellValue` (`'api'`), or a checkbox
|
|
1855
|
+
* column's live box — a click on it, or Space on its cell (`'checkbox'`); also an editor's
|
|
1856
|
+
* commit (`'edit'`), Delete or Backspace (`'clear'`), `paste`, `cut`, the fill handle (`'fill'`), Mod+D / `copyDown`
|
|
1857
|
+
* (`'copyDown'`), Mod+Enter (`'bulk'`) and `undo` / `redo`.
|
|
1858
|
+
*/
|
|
1859
|
+
source: 'renderer' | 'api' | 'checkbox' | 'edit' | 'clear' | 'paste' | 'cut' | 'fill' | 'copyDown' | 'bulk' | 'undo' | 'redo';
|
|
1860
|
+
}
|
|
1861
|
+
export interface FocusChange {
|
|
1862
|
+
cell: CellAddress | null;
|
|
1863
|
+
header: {
|
|
1864
|
+
column: string | null;
|
|
1865
|
+
group: string | null;
|
|
1866
|
+
floating: boolean;
|
|
1867
|
+
} | null;
|
|
1868
|
+
/**
|
|
1869
|
+
* The master row whose detail holds the focus; null elsewhere — a listener that reads `cell` and
|
|
1870
|
+
* `header` both null as "no focus" must look at it too.
|
|
1871
|
+
*/
|
|
1872
|
+
detail: number | null;
|
|
1873
|
+
source: 'pointer' | 'keyboard' | 'api' | 'data';
|
|
1874
|
+
}
|
|
1875
|
+
export interface SelectionChange {
|
|
1876
|
+
source: 'click' | 'checkbox' | 'keyboard' | 'selectAll' | 'api' | 'data';
|
|
1877
|
+
/** `selectedRowCount()`: null when unknown (a select-all on a server source without a total), not 0. */
|
|
1878
|
+
count: number | null;
|
|
1879
|
+
}
|
|
1880
|
+
export interface RangeChange {
|
|
1881
|
+
ranges: readonly CellRange[];
|
|
1882
|
+
/** A gesture began (pointer down, first key). */
|
|
1883
|
+
started: boolean;
|
|
1884
|
+
/** The gesture ended; a one-step change has both. */
|
|
1885
|
+
finished: boolean;
|
|
1886
|
+
source: 'pointer' | 'keyboard' | 'api' | 'data';
|
|
1887
|
+
}
|
|
1888
|
+
/** Where a drop lands on its own rows or a grid zone: between rows, onto a row, or both. */
|
|
1889
|
+
export type RowDropPositions = 'between' | 'on' | 'both';
|
|
1890
|
+
export interface RowDragOptions {
|
|
1891
|
+
/** Where a row is grabbed; default `'cells'` when a column sets `rowDrag`, else `'column'`. */
|
|
1892
|
+
handle?: 'column' | 'cells' | 'row';
|
|
1893
|
+
/** The grip column `ig:row-drag`; default width 28. */
|
|
1894
|
+
handleColumn?: {
|
|
1895
|
+
width?: number;
|
|
1896
|
+
};
|
|
1897
|
+
/** Which rows can be dragged; default every loaded data row. A throw counts as false. */
|
|
1898
|
+
draggable?: (ctx: RowDragContext) => boolean;
|
|
1899
|
+
/** A press on a selected row drags the selection (multiple row selection); default false. */
|
|
1900
|
+
multiple?: boolean;
|
|
1901
|
+
/**
|
|
1902
|
+
* The ghost's text; a throw is reported once and the default text is used. Asked when the drag starts
|
|
1903
|
+
* (`over` null) and again whenever the target changes — the grid, zone, row, position or `allowed`, as
|
|
1904
|
+
* `onRowDragMove` reports it, never per pointer move — so the text can say what a release would do here: `over` is
|
|
1905
|
+
* that event's (null over nothing that takes rows).
|
|
1906
|
+
*/
|
|
1907
|
+
label?: (rows: DraggedRows, over: RowDragOver | null) => string;
|
|
1908
|
+
/** Drops on its own rows move them; default false. */
|
|
1909
|
+
reorder?: boolean;
|
|
1910
|
+
/** Drops on its own rows; default false; `reorder` makes it `'between'`. */
|
|
1911
|
+
drop?: false | RowDropPositions;
|
|
1912
|
+
/** Refuses a target on its own rows. */
|
|
1913
|
+
canDrop?: (ctx: RowDropContext) => boolean;
|
|
1914
|
+
}
|
|
1915
|
+
export interface GridDropZoneOptions {
|
|
1916
|
+
/** Default `'between'`. */
|
|
1917
|
+
positions?: RowDropPositions;
|
|
1918
|
+
canDrop?: (ctx: RowDropContext) => boolean;
|
|
1919
|
+
}
|
|
1920
|
+
/** A grid as a target of other grids' drags; opaque, made by `Grid.rowDropZone`. */
|
|
1921
|
+
export interface RowDropZone {
|
|
1922
|
+
readonly grid: Grid;
|
|
1923
|
+
}
|
|
1924
|
+
/** An element as a target of row drags. */
|
|
1925
|
+
export interface ElementDropZone {
|
|
1926
|
+
element: HTMLElement;
|
|
1927
|
+
canDrop?: (ctx: ZoneDragContext) => boolean;
|
|
1928
|
+
onEnter?(e: ZoneDragEvent): void;
|
|
1929
|
+
/** Each pointer step over it, at most once a frame. */
|
|
1930
|
+
onMove?(e: ZoneDragEvent): void;
|
|
1931
|
+
onLeave?(e: ZoneDragEvent): void;
|
|
1932
|
+
onDrop?(e: ZoneDragEvent): void;
|
|
1933
|
+
}
|
|
1934
|
+
export interface RowDragContext {
|
|
1935
|
+
row: number;
|
|
1936
|
+
id: RowId | null;
|
|
1937
|
+
data: unknown;
|
|
1938
|
+
info: RowInfo | null;
|
|
1939
|
+
}
|
|
1940
|
+
export interface DraggedRows {
|
|
1941
|
+
/** The pressed (keyboard twin: the focused) row's display index. */
|
|
1942
|
+
row: number;
|
|
1943
|
+
/** The dragged rows' display indexes, in display order. */
|
|
1944
|
+
rows: readonly number[];
|
|
1945
|
+
ids: readonly (RowId | null)[];
|
|
1946
|
+
/** Client: row objects; server: rows as plain objects of their fields. */
|
|
1947
|
+
data: readonly unknown[];
|
|
1948
|
+
/**
|
|
1949
|
+
* A drag of the selection: the selection at the press — the model's, so it includes selected rows `draggable`
|
|
1950
|
+
* refuses (they are not in `rows`): apply the same rule when acting on the selection.
|
|
1951
|
+
*/
|
|
1952
|
+
selection: RowSelectionState | null;
|
|
1953
|
+
/** Rows dragged; null: a server select-all of unknown size (a select-all's count is the model's, as `selection`). */
|
|
1954
|
+
count: number | null;
|
|
1955
|
+
}
|
|
1956
|
+
export interface RowDropTarget {
|
|
1957
|
+
/** Display index in the target grid. */
|
|
1958
|
+
row: number;
|
|
1959
|
+
position: 'above' | 'below' | 'on';
|
|
1960
|
+
id: RowId | null;
|
|
1961
|
+
/** As in `DraggedRows`; undefined for a row still loading. */
|
|
1962
|
+
data: unknown;
|
|
1963
|
+
/**
|
|
1964
|
+
* The row's `RowInfo`, a copy (kind, level, expanded, childCount, …). It has no group key and no tree parent: read a
|
|
1965
|
+
* group key from `data`'s field (a group row: `id`) and find a tree parent by `id` in the app's own data.
|
|
1966
|
+
*/
|
|
1967
|
+
info: RowInfo | null;
|
|
1968
|
+
}
|
|
1969
|
+
export interface RowDropContext {
|
|
1970
|
+
rows: DraggedRows;
|
|
1971
|
+
from: Grid;
|
|
1972
|
+
/** Null: no row. */
|
|
1973
|
+
target: RowDropTarget | null;
|
|
1974
|
+
}
|
|
1975
|
+
export interface ZoneDragContext {
|
|
1976
|
+
rows: DraggedRows;
|
|
1977
|
+
from: Grid;
|
|
1978
|
+
}
|
|
1979
|
+
export interface ZoneDragEvent extends ZoneDragContext {
|
|
1980
|
+
x: number;
|
|
1981
|
+
y: number;
|
|
1982
|
+
event: PointerEvent;
|
|
1983
|
+
}
|
|
1984
|
+
export interface RowDragOver {
|
|
1985
|
+
/** The grid under the pointer; null for an element zone. */
|
|
1986
|
+
grid: Grid | null;
|
|
1987
|
+
/** Null: the source grid's own rows. */
|
|
1988
|
+
zone: RowDropZone | ElementDropZone | null;
|
|
1989
|
+
target: RowDropTarget | null;
|
|
1990
|
+
/** False also over its own rows with `drop: false`. */
|
|
1991
|
+
allowed: boolean;
|
|
1992
|
+
}
|
|
1993
|
+
export interface RowDragStart {
|
|
1994
|
+
rows: DraggedRows;
|
|
1995
|
+
}
|
|
1996
|
+
export interface RowDragMove {
|
|
1997
|
+
rows: DraggedRows;
|
|
1998
|
+
/** Null: over nothing that takes rows. */
|
|
1999
|
+
over: RowDragOver | null;
|
|
2000
|
+
}
|
|
2001
|
+
export interface RowDragEnd {
|
|
2002
|
+
rows: DraggedRows;
|
|
2003
|
+
drop: RowDragOver | null;
|
|
2004
|
+
cancelled: boolean;
|
|
2005
|
+
}
|
|
2006
|
+
export interface RowDrop {
|
|
2007
|
+
rows: DraggedRows;
|
|
2008
|
+
/** The source grid (this grid for its own rows). */
|
|
2009
|
+
from: Grid;
|
|
2010
|
+
target: RowDropTarget | null;
|
|
2011
|
+
source: 'pointer' | 'keyboard';
|
|
2012
|
+
/** A managed reorder moved the rows. */
|
|
2013
|
+
moved: boolean;
|
|
2014
|
+
/** Then: the array the source now holds, in the new order. */
|
|
2015
|
+
order: readonly unknown[] | null;
|
|
2016
|
+
}
|
|
2017
|
+
/**
|
|
2018
|
+
* A detail under master rows. A new value applies field by field and never touches a live detail's
|
|
2019
|
+
* content: a new `grid`, `renderer`, `refresh` or `openByDefault` applies from the next build, refresh or ask;
|
|
2020
|
+
* `height`, `minHeight`, `maxHeight`, `keep`, `master` and `toggle` act at once. So an inline object re-created on every
|
|
2021
|
+
* render costs a comparison and nothing else. The callbacks are isolated: a throw is reported once and counts as
|
|
2022
|
+
* "not a master", "closed", the `'auto'` height, or the error panel.
|
|
2023
|
+
*/
|
|
2024
|
+
export interface DetailOptions {
|
|
2025
|
+
/**
|
|
2026
|
+
* Which rows are masters; default every loaded data row. Asked when a row first enters the view, and by an
|
|
2027
|
+
* export with `export.detail` for each exported row not asked yet (that answer is not kept).
|
|
2028
|
+
*/
|
|
2029
|
+
master?: (ctx: DetailRowContext) => boolean;
|
|
2030
|
+
/**
|
|
2031
|
+
* Whether a master nobody toggled is open; default false. A function's answer is kept once asked (an
|
|
2032
|
+
* export's ask, as `master`'s, is not).
|
|
2033
|
+
*/
|
|
2034
|
+
openByDefault?: boolean | ((ctx: DetailRowContext) => boolean);
|
|
2035
|
+
/** Where the chevron sits; default `'cells'` when a column sets `detailToggle`, else `'column'`. */
|
|
2036
|
+
toggle?: 'column' | 'cells';
|
|
2037
|
+
/** The toggle column `ig:detail`; default width 28. */
|
|
2038
|
+
toggleColumn?: {
|
|
2039
|
+
width?: number;
|
|
2040
|
+
};
|
|
2041
|
+
/** The built-in detail grid. */
|
|
2042
|
+
grid?: DetailGridSpec | ((ctx: DetailContext) => DetailGridSpec);
|
|
2043
|
+
/** Custom content instead; wins over `grid`. */
|
|
2044
|
+
renderer?: DetailRenderer;
|
|
2045
|
+
/**
|
|
2046
|
+
* The detail's height: a number for every master; a function per master, asked when its detail opens
|
|
2047
|
+
* and when its data changes (a throw, a non-finite or a negative answer: `'auto'`); `'auto'` (default) the
|
|
2048
|
+
* content's natural height between `minHeight` and `maxHeight`.
|
|
2049
|
+
*/
|
|
2050
|
+
height?: number | 'auto' | ((ctx: DetailRowContext) => number);
|
|
2051
|
+
/** `'auto'`: default 100. */
|
|
2052
|
+
minHeight?: number;
|
|
2053
|
+
/** `'auto'`: default 400 for the built-in grid (it scrolls inside beyond), none for custom content. */
|
|
2054
|
+
maxHeight?: number;
|
|
2055
|
+
/** Details kept alive while not drawn; default 20. `0` destroys a detail as soon as it is hidden. */
|
|
2056
|
+
keep?: number;
|
|
2057
|
+
/** When a master's data changes; default `'rows'`. */
|
|
2058
|
+
refresh?: 'rows' | 'all' | 'none';
|
|
2059
|
+
}
|
|
2060
|
+
export interface DetailRowContext {
|
|
2061
|
+
/** The master's display index at the call. */
|
|
2062
|
+
row: number;
|
|
2063
|
+
id: RowId | null;
|
|
2064
|
+
/** Client: the row object; server: its loaded fields as a plain object. */
|
|
2065
|
+
data: unknown;
|
|
2066
|
+
/** A copy. */
|
|
2067
|
+
info: RowInfo | null;
|
|
2068
|
+
}
|
|
2069
|
+
export interface DetailContext extends DetailRowContext {
|
|
2070
|
+
/** The master grid. */
|
|
2071
|
+
grid: Grid;
|
|
2072
|
+
/** Custom content's own grid joins the registry; `null` removes it. */
|
|
2073
|
+
register(detail: Grid | null): void;
|
|
2074
|
+
texts: GridTexts;
|
|
2075
|
+
}
|
|
2076
|
+
/** The built-in detail grid. */
|
|
2077
|
+
export interface DetailGridSpec {
|
|
2078
|
+
/** Columns, selection, … and `detail` for a nested level. */
|
|
2079
|
+
options: Omit<GridOptions, 'rows'>;
|
|
2080
|
+
rows?: (ctx: DetailContext) => readonly object[] | Promise<readonly object[]>;
|
|
2081
|
+
/** Instead of `rows`: any source, destroyed with its detail. */
|
|
2082
|
+
source?: (ctx: DetailContext) => ViewportSource;
|
|
2083
|
+
/** `id`, `fields`, … of the client source built over `rows`. */
|
|
2084
|
+
sourceOptions?: ClientSourceOptions<object>;
|
|
2085
|
+
}
|
|
2086
|
+
/** Custom detail content. */
|
|
2087
|
+
export interface DetailRenderer {
|
|
2088
|
+
create(host: HTMLElement): DetailRendererInstance;
|
|
2089
|
+
}
|
|
2090
|
+
export interface DetailRendererInstance {
|
|
2091
|
+
/** Right after `create`, and on every refresh. */
|
|
2092
|
+
update(ctx: DetailContext): void;
|
|
2093
|
+
/** Moves focus inside; default: the first / last tabbable element. */
|
|
2094
|
+
focus?(edge: 'start' | 'end'): boolean;
|
|
2095
|
+
destroy(): void;
|
|
2096
|
+
}
|
|
2097
|
+
/** A live detail grid, built-in or registered. */
|
|
2098
|
+
export interface DetailGridInfo {
|
|
2099
|
+
grid: Grid;
|
|
2100
|
+
/** −1: the master is not displayed. */
|
|
2101
|
+
row: number;
|
|
2102
|
+
id: RowId | null;
|
|
2103
|
+
data: unknown;
|
|
2104
|
+
}
|
|
2105
|
+
export interface DetailToggle {
|
|
2106
|
+
/** Null: `setAllDetailsOpen`. */
|
|
2107
|
+
row: number | null;
|
|
2108
|
+
id: RowId | null;
|
|
2109
|
+
data: unknown;
|
|
2110
|
+
open: boolean;
|
|
2111
|
+
source: 'pointer' | 'keyboard' | 'api';
|
|
2112
|
+
}
|
|
2113
|
+
/**
|
|
2114
|
+
* An exported row that is not a group row (`ExportOptions.detail`). Inside a closed group `row` is
|
|
2115
|
+
* −1. `data` is the client row object; on a server source the exported columns' fields only, as a plain object (`id`
|
|
2116
|
+
* holds the row's id).
|
|
2117
|
+
*/
|
|
2118
|
+
export interface ExportDetailContext extends DetailRowContext {
|
|
2119
|
+
/**
|
|
2120
|
+
* The row is a master whose detail is open in the grid — by its key, so also when it is not loaded or inside a closed
|
|
2121
|
+
* group; false for a row that is no master and while `detail` is off.
|
|
2122
|
+
*/
|
|
2123
|
+
open: boolean;
|
|
2124
|
+
format: ExportFormat;
|
|
2125
|
+
}
|
|
2126
|
+
export type ScrollAlign = 'start' | 'center' | 'end' | 'nearest';
|
|
2127
|
+
/**
|
|
2128
|
+
* Where the grid is scrolled: the first visible row, how many
|
|
2129
|
+
* px of it lie above the top of the rows area, and the centre columns' horizontal scroll position in px. Row-based, so
|
|
2130
|
+
* a restore stays exact while row heights are measured.
|
|
2131
|
+
*/
|
|
2132
|
+
export interface ScrollPosition {
|
|
2133
|
+
row: number;
|
|
2134
|
+
offset: number;
|
|
2135
|
+
left: number;
|
|
2136
|
+
}
|
|
2137
|
+
export interface Grid {
|
|
2138
|
+
setColumns(columns: ColumnNode[]): void;
|
|
2139
|
+
setDefaultColumn(defaults?: ColumnDefaults): void;
|
|
2140
|
+
setRowNumbers(rowNumbers?: boolean | RowNumbersOptions): void;
|
|
2141
|
+
/**
|
|
2142
|
+
* Row selection options; adds or removes the selection column. A change of `mode` or `groupSelects`
|
|
2143
|
+
* clears the selection; turning row selection off drops it.
|
|
2144
|
+
*/
|
|
2145
|
+
setRowSelection(options?: GridOptions['rowSelection']): void;
|
|
2146
|
+
/**
|
|
2147
|
+
* The row selection as JSON: the selected ids — on a client source always a list (no `all`),
|
|
2148
|
+
* filtered-out rows included; a server source's `{ all, ids }` rule. Rows without an id are not listed (use
|
|
2149
|
+
* `getSelectedRows`).
|
|
2150
|
+
*/
|
|
2151
|
+
getSelection(): RowSelectionState;
|
|
2152
|
+
/**
|
|
2153
|
+
* Replaces the selection (`null` clears it). Ids no row holds yet are kept until rows with them appear; on a client
|
|
2154
|
+
* source `{ all: true, ids }` selects every current row except `ids`, resolved at once. One `SelectionChange` 'api'
|
|
2155
|
+
* when it changed.
|
|
2156
|
+
*/
|
|
2157
|
+
setSelection(state: RowSelectionState | null): void;
|
|
2158
|
+
/**
|
|
2159
|
+
* Client sources: the selected row objects in display order, then the hidden ones in source order; `displayed: true`
|
|
2160
|
+
* leaves the hidden ones out. Server sources: `[]` (use `getSelection`).
|
|
2161
|
+
*/
|
|
2162
|
+
getSelectedRows(options?: {
|
|
2163
|
+
displayed?: boolean;
|
|
2164
|
+
}): unknown[];
|
|
2165
|
+
/** Selected rows; null: unknown (a server's `all` over a grouped or tree query). */
|
|
2166
|
+
selectedRowCount(): number | null;
|
|
2167
|
+
/** A display row's state; null = a row with children some of whose descendants are selected. */
|
|
2168
|
+
isRowSelected(row: number): boolean | null;
|
|
2169
|
+
/**
|
|
2170
|
+
* Selects display rows (ids go through `setSelection`); `clear` deselects the others. In 'single' mode several rows
|
|
2171
|
+
* select the last one (one console hint). Rows that cannot be selected are skipped.
|
|
2172
|
+
*/
|
|
2173
|
+
selectRows(rows: number | readonly number[], options?: {
|
|
2174
|
+
clear?: boolean;
|
|
2175
|
+
}): void;
|
|
2176
|
+
/** Deselects display rows. */
|
|
2177
|
+
deselectRows(rows: number | readonly number[]): void;
|
|
2178
|
+
/** 'multiple' only: selects every selectable row of the scope; default: the option's `selectAll` scope. */
|
|
2179
|
+
selectAll(scope?: 'all' | 'filtered'): void;
|
|
2180
|
+
/** 'multiple' only: deselects the scope's rows; default: everything, hidden rows included. */
|
|
2181
|
+
deselectAll(scope?: 'all' | 'filtered'): void;
|
|
2182
|
+
/**
|
|
2183
|
+
* One event per gesture or call that changed the row selection, after it applied; a listener's own changes
|
|
2184
|
+
* are delivered after the current event, in order. Returns the unsubscribe function.
|
|
2185
|
+
*/
|
|
2186
|
+
onSelectionChange(listener: (event: SelectionChange) => void): () => void;
|
|
2187
|
+
/**
|
|
2188
|
+
* The cell ranges: copies, normalised (rows ordered, columns in display order), the active range last;
|
|
2189
|
+
* `[]` while cell selection is off. Initial `cellRanges` that wait for the grid's first rows are returned as given.
|
|
2190
|
+
*/
|
|
2191
|
+
getCellRanges(): CellRange[];
|
|
2192
|
+
/**
|
|
2193
|
+
* Replaces the ranges (rows are display indexes, kept as given until a reset clamps them). In the row unit every
|
|
2194
|
+
* range spans all columns; without `multiple` only the last one is kept (one console hint). One `RangeChange` 'api'
|
|
2195
|
+
* when they changed; ignored while cell selection is off.
|
|
2196
|
+
*/
|
|
2197
|
+
setCellRanges(ranges: readonly CellRange[]): void;
|
|
2198
|
+
/** Adds a range (replaces them without `multiple`); the anchor defaults to its first cell. */
|
|
2199
|
+
addCellRange(range: Omit<CellRange, 'anchor'> & {
|
|
2200
|
+
anchor?: CellAddress;
|
|
2201
|
+
}): void;
|
|
2202
|
+
clearCellRanges(): void;
|
|
2203
|
+
/**
|
|
2204
|
+
* The app's row objects behind the cell ranges, each once in display order (the ranges' union, a one-cell range
|
|
2205
|
+
* included): a group row in a range brings its whole group's rows that pass the filters, closed groups too, as the
|
|
2206
|
+
* `'ranges'` export takes them; a tree parent with data is itself and its range rows. A range's pinned rows are not
|
|
2207
|
+
* among them: they are no data rows. Client sources; a server or custom source returns `[]`, as does no
|
|
2208
|
+
* range or cell selection off.
|
|
2209
|
+
*/
|
|
2210
|
+
getRangeRows(): unknown[];
|
|
2211
|
+
/**
|
|
2212
|
+
* `getRangeRows()` on every source: on a server source the rows behind the ranges are read by the same
|
|
2213
|
+
* rule — a group row's whole group, closed groups through the datasource, as the ranges export reads them — each a
|
|
2214
|
+
* plain object of the fields of the grid's columns (hidden ones and the group column's too); group rows are not
|
|
2215
|
+
* rows, a tree parent is. A client source resolves to `getRangeRows()`, a custom source to `[]`. Rejects with an
|
|
2216
|
+
* `AbortError` when the rows change while they are read, `setRows` replaces the source or the grid goes; with the
|
|
2217
|
+
* datasource's error when a request fails. The ranges are taken when called.
|
|
2218
|
+
*/
|
|
2219
|
+
readRangeRows(): Promise<unknown[]>;
|
|
2220
|
+
/**
|
|
2221
|
+
* The union's extent: distinct rows, distinct columns, cells counted once; pinned rows included (the status bar
|
|
2222
|
+
* reads the same summary).
|
|
2223
|
+
*/
|
|
2224
|
+
getCellRangeSummary(): {
|
|
2225
|
+
rows: number;
|
|
2226
|
+
columns: number;
|
|
2227
|
+
cells: number;
|
|
2228
|
+
};
|
|
2229
|
+
/**
|
|
2230
|
+
* Cell selection options. Turning it off drops the ranges; switching to the row unit widens them to all
|
|
2231
|
+
* columns, back to the cell unit collapses them to one cell; `multiple: false` keeps the active one. One
|
|
2232
|
+
* `RangeChange` 'api' when the ranges changed.
|
|
2233
|
+
*/
|
|
2234
|
+
setCellSelection(options?: GridOptions['cellSelection']): void;
|
|
2235
|
+
/**
|
|
2236
|
+
* One event per step of a gesture, per call and per data or column change that changed the ranges; a
|
|
2237
|
+
* listener's own changes are delivered after the current event, in order. Returns the unsubscribe function.
|
|
2238
|
+
*/
|
|
2239
|
+
onRangeChange(listener: (event: RangeChange) => void): () => void;
|
|
2240
|
+
/**
|
|
2241
|
+
* Copies: the ranges, the selected rows or the focused cell (by priority, or `target`), through the
|
|
2242
|
+
* `clipboard.write` hook or the browser's clipboard (a `ClipboardItem` with a pending text), after `confirm`.
|
|
2243
|
+
* Resolves with the copied size; `cancelled: true` when `confirm` said no, a newer copy replaced it, the grid went,
|
|
2244
|
+
* copying is off, or the rows changed before the text was built from them — while `confirm` was open (any source;
|
|
2245
|
+
* a `rows: 'all'` range only by `setRows`), while it was built or while a server read them — or the row
|
|
2246
|
+
* selection did, for a copy of the selected rows that finds them as it builds, or the browser has no
|
|
2247
|
+
* `ClipboardItem` for a text built after the gesture. Rejects when the write fails (reported once). Nothing to copy:
|
|
2248
|
+
* zeros, nothing written.
|
|
2249
|
+
*/
|
|
2250
|
+
copy(options?: CopyOptions): Promise<CopyResult>;
|
|
2251
|
+
/**
|
|
2252
|
+
* The text `copy(options)` would write, written nowhere (no `confirm`, no flash); also while copying is off. Server
|
|
2253
|
+
* rows not loaded are read; rejects with an `AbortError` when the rows (or, for selected rows, the row
|
|
2254
|
+
* selection) change meanwhile or the grid goes.
|
|
2255
|
+
*/
|
|
2256
|
+
copyText(options?: CopyOptions): Promise<string>;
|
|
2257
|
+
/** The clipboard options: `false` turns copying off (keys, menu items, `copy()`). */
|
|
2258
|
+
setClipboard(options?: GridOptions['clipboard']): void;
|
|
2259
|
+
/**
|
|
2260
|
+
* Starts editing a cell: the gate must pass (an editable data cell, `cellFocus: true`). Scrolls the cell
|
|
2261
|
+
* in and commits an edit open elsewhere first. `key` seeds the editor as a typed character or `'Backspace'` would.
|
|
2262
|
+
* False when nothing started (the gate said no, an editor vetoed, block mode holds another cell).
|
|
2263
|
+
*/
|
|
2264
|
+
startEditing(cell: CellAddress & {
|
|
2265
|
+
key?: string;
|
|
2266
|
+
}): boolean;
|
|
2267
|
+
/** Ends the open edit: commits it, or drops it with `cancel`. False when it was refused (block mode, invalid value); true when none was open. */
|
|
2268
|
+
stopEditing(cancel?: boolean): boolean;
|
|
2269
|
+
/** The cell being edited, or null. */
|
|
2270
|
+
editingCell(): CellAddress | null;
|
|
2271
|
+
/** The open editor's instance (a custom editor's own object), or null. */
|
|
2272
|
+
cellEditor(): CellEditorInstance | null;
|
|
2273
|
+
/** The open editor's current error texts; empty when valid or when none is open. */
|
|
2274
|
+
editErrors(): readonly string[];
|
|
2275
|
+
/** Undoes the last edit operation (`editing.undo` on). False when there is nothing to undo. */
|
|
2276
|
+
undo(): boolean;
|
|
2277
|
+
/** Redoes the last undone operation. False when there is nothing to redo. */
|
|
2278
|
+
redo(): boolean;
|
|
2279
|
+
/** How many operations `undo` can step back over. */
|
|
2280
|
+
undoSize(): number;
|
|
2281
|
+
/** How many operations `redo` can step forward over. */
|
|
2282
|
+
redoSize(): number;
|
|
2283
|
+
/**
|
|
2284
|
+
* Pastes `text` into the ranges, or the focused cell; without `text` the clipboard is read through
|
|
2285
|
+
* `clipboard.read`, else the browser's. Resolves true when something was written.
|
|
2286
|
+
*/
|
|
2287
|
+
paste(text?: string): Promise<boolean>;
|
|
2288
|
+
/** Copies, then clears what copy took; on a grid nobody can edit it only copies. Resolves true when the copy succeeded (a grid nobody can edit only copies; so does `clipboard.cut: false`). */
|
|
2289
|
+
cut(): Promise<boolean>;
|
|
2290
|
+
/** Copies the range's first row down over the rest, per column (Mod+D). True when an operation was made (in request mode too: the app was asked, nothing is written); false when nothing was. */
|
|
2291
|
+
copyDown(): boolean;
|
|
2292
|
+
/** The editing options: replaces them; unset gives the defaults. */
|
|
2293
|
+
setEditing(options?: GridOptions['editing']): void;
|
|
2294
|
+
/** A cell's editor opened. Returns the unsubscribe function. */
|
|
2295
|
+
onCellEditStart(listener: (event: CellEditEvent) => void): () => void;
|
|
2296
|
+
/** An edit ended, committed or cancelled; fires only after a start, once. Returns the unsubscribe function. */
|
|
2297
|
+
onCellEditStop(listener: (event: CellEditStopEvent) => void): () => void;
|
|
2298
|
+
/** With `editing.request`: the grid wrote nothing and asks the app to. Returns the unsubscribe function. */
|
|
2299
|
+
onCellEditRequest(listener: (event: CellEditRequest) => void): () => void;
|
|
2300
|
+
/** One event per clear, paste, cut, fill, copy-down, bulk fill, undo or redo with all its changes. Returns the unsubscribe function. */
|
|
2301
|
+
onEditOperation(listener: (event: EditOperation) => void): () => void;
|
|
2302
|
+
/**
|
|
2303
|
+
* Exports: builds the file in slices between frames — server rows not loaded are read — and
|
|
2304
|
+
* delivers it as a download, through `write` or through `stream`, after `confirm`. One export at a time: a newer
|
|
2305
|
+
* one cancels the running one, as do `signal`, the grid's destruction, `setExport(false)` and rows changing before
|
|
2306
|
+
* the export's last row while it is built (an append after it does not). Resolves with the written counts;
|
|
2307
|
+
* `cancelled: true` when it was cancelled or exporting is off. Rejects when a server read or the delivery fails
|
|
2308
|
+
* (reported once). The live region says "Exported N rows" afterwards.
|
|
2309
|
+
*/
|
|
2310
|
+
export(request?: ExportRequest): Promise<ExportResult>;
|
|
2311
|
+
/**
|
|
2312
|
+
* The file `export(request)` would build, delivered nowhere (no `confirm`, `write` or `stream`); also while
|
|
2313
|
+
* exporting is off. Rejects with an `AbortError` when cancelled.
|
|
2314
|
+
*/
|
|
2315
|
+
exportBlob(request?: ExportRequest): Promise<ExportFile>;
|
|
2316
|
+
/** The export defaults: `false` turns exporting off (menu items, `export()`) and cancels a running `export()`. */
|
|
2317
|
+
setExport(options?: GridOptions['export']): void;
|
|
2318
|
+
/**
|
|
2319
|
+
* The focused cell: kept while DOM focus is elsewhere, so it is the cell Tab returns to; null when none
|
|
2320
|
+
* (or `cellFocus: false`). A pinned row's cell carries `pinned`, `row` its index in its section.
|
|
2321
|
+
*/
|
|
2322
|
+
getFocusedCell(): CellAddress | null;
|
|
2323
|
+
/**
|
|
2324
|
+
* Focuses a cell: scrolled into view (`align`, default 'nearest'; columns to the nearest edge), with DOM focus
|
|
2325
|
+
* unless `browserFocus: false`, the only range with `select: true`. Resolves once the cell is drawn and its row
|
|
2326
|
+
* loaded, at once with `align: false`. `null` clears the focused cell. One `FocusChange` 'api' when it changed. With
|
|
2327
|
+
* `pinned` a pinned row's cell, `row` its index in that section: only its column scrolls into view.
|
|
2328
|
+
*/
|
|
2329
|
+
setFocusedCell(cell: CellAddress | null, options?: FocusCellOptions): Promise<void>;
|
|
2330
|
+
/** The focused header cell: a column's leaf or floating cell, or a group; null when a body cell (or none) is focused. */
|
|
2331
|
+
getFocusedHeader(): {
|
|
2332
|
+
column: string | null;
|
|
2333
|
+
group: string | null;
|
|
2334
|
+
floating: boolean;
|
|
2335
|
+
} | null;
|
|
2336
|
+
/** Focuses a column's header cell (`floating`: its floating cell) or a group's header cell, with DOM focus. */
|
|
2337
|
+
focusHeader(target: {
|
|
2338
|
+
column: string;
|
|
2339
|
+
} | {
|
|
2340
|
+
group: string;
|
|
2341
|
+
}, options?: {
|
|
2342
|
+
floating?: boolean;
|
|
2343
|
+
}): void;
|
|
2344
|
+
/** DOM focus into the grid: the remembered position, else the first data cell of the first visible row, else the header. */
|
|
2345
|
+
focus(): void;
|
|
2346
|
+
/**
|
|
2347
|
+
* One event per change of the focused cell or header cell — not when DOM focus merely leaves and comes back.
|
|
2348
|
+
* A listener's own changes are delivered after the current event, in order. Returns the unsubscribe function.
|
|
2349
|
+
*/
|
|
2350
|
+
onFocusChange(listener: (event: FocusChange) => void): () => void;
|
|
2351
|
+
setCellFocus(cellFocus?: GridOptions['cellFocus']): void;
|
|
2352
|
+
setHeaderFocus(headerFocus?: boolean): void;
|
|
2353
|
+
/**
|
|
2354
|
+
* Body cells take part in the browser's text selection: pointer drags then select text instead
|
|
2355
|
+
* of making ranges; Shift+click and keys still make ranges. Default false.
|
|
2356
|
+
*/
|
|
2357
|
+
setTextSelection(textSelection?: boolean): void;
|
|
2358
|
+
setNavigate(navigate?: GridOptions['navigate']): void;
|
|
2359
|
+
/**
|
|
2360
|
+
* Runs a key event through the body keys as if the focused cell had received it (with no focused
|
|
2361
|
+
* cell: the first navigable cell of the first visible row), without moving DOM focus unless `focus: true` — the
|
|
2362
|
+
* "search box drives the list" pattern. True when the grid handled the key: the caller then calls
|
|
2363
|
+
* `preventDefault()`; the grid does not prevent it here.
|
|
2364
|
+
*/
|
|
2365
|
+
handleKey(event: KeyboardEvent, options?: {
|
|
2366
|
+
focus?: boolean;
|
|
2367
|
+
}): boolean;
|
|
2368
|
+
/**
|
|
2369
|
+
* A key on or inside a body cell, before the grid acts: `event.preventDefault()` keeps the grid out. Called
|
|
2370
|
+
* synchronously from the key event, each listener isolated; returns the unsubscribe function. A pinned row's
|
|
2371
|
+
* cell too, with its `pinned`.
|
|
2372
|
+
*/
|
|
2373
|
+
onCellKeyDown(listener: (event: CellKeyEvent) => void): () => void;
|
|
2374
|
+
/**
|
|
2375
|
+
* A click on a body cell: its row, column and raw value. None for a row checkbox, the rest of its selection
|
|
2376
|
+
* cell or a group chevron (the grid's own controls). Listeners are isolated, and get nothing after `destroy()`.
|
|
2377
|
+
* Returns the unsubscribe function. A pinned row's cell too, with its `pinned`.
|
|
2378
|
+
*/
|
|
2379
|
+
onCellClick(listener: (event: CellPointerEvent) => void): () => void;
|
|
2380
|
+
/** A double click on a body cell, as `onCellClick` (its two clicks fire `onCellClick` too). */
|
|
2381
|
+
onCellDoubleClick(listener: (event: CellPointerEvent) => void): () => void;
|
|
2382
|
+
/**
|
|
2383
|
+
* Writes a cell's value: `row` is a display row, or a client source's row object (found by
|
|
2384
|
+
* its id with the `id` option, else as the object; it must be displayed); `columnId` a data column, hidden
|
|
2385
|
+
* ones too. The write goes through the column's `setValue`, else into `row[field]`. True when written:
|
|
2386
|
+
* `onCellValueChanged` fires (source 'api'), then the row is drawn again; rows are not sorted, filtered or grouped
|
|
2387
|
+
* again — the row stays where it is until the next query change or `refresh()`. False, with nothing written: a
|
|
2388
|
+
* value equal to the cell's (`Object.is`), a refused write, a row not loaded, a group row, a tree filler or a tree
|
|
2389
|
+
* parent's aggregate, a grid-owned column (row number, selection, group) or a column over a computed field without
|
|
2390
|
+
* its own `setValue` (one console hint per column), or a source that cannot write (`ViewportSource.writeCell`;
|
|
2391
|
+
* one console hint).
|
|
2392
|
+
*/
|
|
2393
|
+
setCellValue(row: number | object, columnId: string, value: unknown): boolean;
|
|
2394
|
+
/**
|
|
2395
|
+
* One event per written cell, synchronous: after the write, before the row is drawn again; a
|
|
2396
|
+
* listener's own writes are delivered after the current event, in order. Listeners are isolated and get
|
|
2397
|
+
* nothing after `destroy()`. Returns the unsubscribe function.
|
|
2398
|
+
*/
|
|
2399
|
+
onCellValueChanged(listener: (event: CellValueChange) => void): () => void;
|
|
2400
|
+
/**
|
|
2401
|
+
* Flashes cells: `.ig-flash` — the `--ig-flash-bg` tint held for `duration` (default
|
|
2402
|
+
* `--ig-flash-hold`, 500 ms), then faded over `--ig-flash-fade` (1000 ms); under `prefers-reduced-motion` held, then
|
|
2403
|
+
* gone without a fade. `flashCells()` flashes every row, including rows that scroll in during the flash. The flash
|
|
2404
|
+
* is kept by position, not on elements: a cell scrolled out and back while it runs shows it at its phase, and a cell
|
|
2405
|
+
* flashed again starts again. A reset, a sort, filter or grouping change, a splice (an expand, a collapse, an
|
|
2406
|
+
* insert) and a definition change that adds, removes or re-fields a leaf column (`setColumns`, `setDefaultColumn`,
|
|
2407
|
+
* `setGroupColumn`, `setRowNumbers` / `setRowSelection` showing or dropping their column) end every flash; value
|
|
2408
|
+
* changes, scrolling, column moves, resizes and pins do not, nor does a definition change that keeps every leaf's
|
|
2409
|
+
* id and field (an equal new array, a header, `setLocale`). Drawn in the next frame. Row positions are the
|
|
2410
|
+
* row order at the call: a flash requested in the same task as a sort, quick-filter or grouping change is ended by
|
|
2411
|
+
* that change — flash after the grid applied it, e.g. after `await grid.scrollToRow(i)`.
|
|
2412
|
+
*/
|
|
2413
|
+
flashCells(target?: FlashCellsOptions): void;
|
|
2414
|
+
/**
|
|
2415
|
+
* Every defined leaf (hidden ones too) in full order, all keys filled; not the selection column, which
|
|
2416
|
+
* has no state of its own.
|
|
2417
|
+
*/
|
|
2418
|
+
getColumnState(): ColumnState[];
|
|
2419
|
+
applyColumnState(entries: ColumnState[], options?: ApplyColumnStateOptions): void;
|
|
2420
|
+
/**
|
|
2421
|
+
* Back to the definitions' initial values and definition order; removed columns get their definition's sort back.
|
|
2422
|
+
* The column groups keep their open states (`resetColumnGroupState`).
|
|
2423
|
+
*/
|
|
2424
|
+
resetColumnState(): void;
|
|
2425
|
+
/**
|
|
2426
|
+
* The open state of every column group of the current definitions, in definition order. A group id keeps
|
|
2427
|
+
* its state across new definitions; a new id starts at `openByDefault`, and a renamed group without a `groupId`
|
|
2428
|
+
* takes the state of the group at its place in the previous definitions.
|
|
2429
|
+
*/
|
|
2430
|
+
getColumnGroupState(): ColumnGroupState[];
|
|
2431
|
+
/**
|
|
2432
|
+
* Sets the listed groups open or closed: ids not in the current definitions are ignored, the first entry of an id
|
|
2433
|
+
* wins. A closed group's `'open'` columns leave the display (`displayed: false`, not hidden), its `'closed'` ones
|
|
2434
|
+
* return; a state set on a group that cannot fold is kept and applies once it can. One `onColumnGroupToggle` event
|
|
2435
|
+
* listing the groups that changed; no column-state event.
|
|
2436
|
+
*/
|
|
2437
|
+
applyColumnGroupState(entries: ColumnGroupState[]): void;
|
|
2438
|
+
/** Opens or closes one column group (`applyColumnGroupState` with one entry). */
|
|
2439
|
+
setColumnGroupOpen(id: string, open: boolean): void;
|
|
2440
|
+
/** Every column group back to its `openByDefault` (one `onColumnGroupToggle` event when any changed). */
|
|
2441
|
+
resetColumnGroupState(): void;
|
|
2442
|
+
/**
|
|
2443
|
+
* Columns with a sort, by sort index. A removed column keeps its sort with its state; when the column returns, that
|
|
2444
|
+
* sort ranks after the current keys, and sorts that return together keep their order.
|
|
2445
|
+
*/
|
|
2446
|
+
getSortModel(): SortModelItem[];
|
|
2447
|
+
/**
|
|
2448
|
+
* Replaces the sort model: unlisted columns lose their sort, removed ones included (as a plain header click does).
|
|
2449
|
+
*/
|
|
2450
|
+
setSortModel(model: SortModelItem[]): void;
|
|
2451
|
+
/** Grouped column ids, outermost first. */
|
|
2452
|
+
getRowGroups(): string[];
|
|
2453
|
+
/** Replaces the grouping (state event 'api'); visibility is not touched. */
|
|
2454
|
+
setRowGroups(ids: string[]): void;
|
|
2455
|
+
/** Replaces the group column's options (a definitions change). */
|
|
2456
|
+
setGroupColumn(options?: GroupColumnOptions): void;
|
|
2457
|
+
/** Replaces the quick filter's text (`GridOptions.quickFilter`); `undefined` or `''` turns it off. */
|
|
2458
|
+
setQuickFilter(text?: string): void;
|
|
2459
|
+
/** The quick filter's stored text as given; '' when none. */
|
|
2460
|
+
getQuickFilter(): string;
|
|
2461
|
+
/**
|
|
2462
|
+
* The quick filter's stored text changed, from any path: `setQuickFilter` and the `quickFilter`
|
|
2463
|
+
* prop (`source` `'api'`), the toolbar's box (`'toolbar'`); once per change of the text. Returns the unsubscribe
|
|
2464
|
+
* function.
|
|
2465
|
+
*/
|
|
2466
|
+
onQuickFilterChange(listener: (change: {
|
|
2467
|
+
text: string;
|
|
2468
|
+
source: 'toolbar' | 'api';
|
|
2469
|
+
}) => void): () => void;
|
|
2470
|
+
/**
|
|
2471
|
+
* The displayed row count changed: server blocks landing, a group's children arriving after an expansion, a
|
|
2472
|
+
* filter, a client data change. `count` is the number of displayed rows (what the status bar counts: group rows and
|
|
2473
|
+
* expanded children included, pinned rows not). Fires once after the pass that changed it, not when a pass leaves it as it was; the listener hears
|
|
2474
|
+
* changes made after it was added, each listener isolated. Costs nothing while nobody listens. Returns the
|
|
2475
|
+
* unsubscribe function.
|
|
2476
|
+
*/
|
|
2477
|
+
onRowCountChange(listener: (count: number) => void): () => void;
|
|
2478
|
+
/**
|
|
2479
|
+
* Replaces the find term (`GridOptions.find`); `undefined` or `''` turns find off. A new term leaves no
|
|
2480
|
+
* match active, also when it only refines the old one; the term the grid already has changes nothing. Client sources
|
|
2481
|
+
* only: on another source a console hint says so once, and the find calls answer 0, null and `[]`.
|
|
2482
|
+
*/
|
|
2483
|
+
setFind(text?: string): void;
|
|
2484
|
+
/** Replaces find's options (`GridOptions.findOptions`); the active match stays while its occurrence still exists. */
|
|
2485
|
+
setFindOptions(options?: GridOptions['findOptions']): void;
|
|
2486
|
+
/**
|
|
2487
|
+
* Makes the next match active: from none the first, after the last the first again. Opens the
|
|
2488
|
+
* closed groups holding it and scrolls it into view as little as needed (`'nearest'`): its row clear of the stuck
|
|
2489
|
+
* group rows, its column beside the pinned ones (a pinned row's match: only its column, the rows stay). The
|
|
2490
|
+
* keyboard focus, the cell ranges and the flashes stay as they are, so an app's find box keeps the caret.
|
|
2491
|
+
*/
|
|
2492
|
+
findNext(): void;
|
|
2493
|
+
/** Makes the previous match active: from none the last, before the first the last again. As `findNext` otherwise. */
|
|
2494
|
+
findPrevious(): void;
|
|
2495
|
+
/**
|
|
2496
|
+
* Makes match `n` active (1-based, `FindMatch.numOverall`), as `findNext` does. Nothing for a number out of range,
|
|
2497
|
+
* nor for the active match unless `force` (it is then gone to again: its groups opened, scrolled into view again).
|
|
2498
|
+
*/
|
|
2499
|
+
findGoTo(n: number, force?: boolean): void;
|
|
2500
|
+
/** No match is active afterwards; the count stays. */
|
|
2501
|
+
findClearActive(): void;
|
|
2502
|
+
/** The occurrences of the term in the grid (rows inside closed groups included); 0 while find is off. */
|
|
2503
|
+
findGetTotalMatches(): number;
|
|
2504
|
+
/** The active match; null when none is. */
|
|
2505
|
+
findGetActiveMatch(): FindMatch | null;
|
|
2506
|
+
/** The occurrences in one displayed cell (a pinned row's with `pinned`); 0 for a cell find does not search. */
|
|
2507
|
+
findGetNumMatches(cell: CellAddress): number;
|
|
2508
|
+
/**
|
|
2509
|
+
* `text` split by the term, the active occurrence flagged when the cell `{ row, column, pinned }` holds
|
|
2510
|
+
* it — for a renderer that draws the marks itself (`pinned`: a pinned row's section, absent for a body row). A
|
|
2511
|
+
* renderer that splits its text into pieces passes, per piece, the occurrences in the pieces before it
|
|
2512
|
+
* (`precedingNumMatches`). Without a term, one plain part. Made for drawing: it never counts the matches again, so
|
|
2513
|
+
* right after a change of the rows the active flag may lag one frame.
|
|
2514
|
+
*/
|
|
2515
|
+
findGetParts(params: {
|
|
2516
|
+
row: number;
|
|
2517
|
+
column: string;
|
|
2518
|
+
pinned?: 'top' | 'bottom';
|
|
2519
|
+
text: string;
|
|
2520
|
+
precedingNumMatches?: number;
|
|
2521
|
+
}): FindPart[];
|
|
2522
|
+
/**
|
|
2523
|
+
* Counts the matches again: after the app changed values in its row objects without telling the source
|
|
2524
|
+
* (`refresh()`). Sorting, filtering, new data, column and locale changes, and the grid's own writes need no call.
|
|
2525
|
+
*/
|
|
2526
|
+
findRefresh(): void;
|
|
2527
|
+
/** Find's term, active match or count changed (`FindChange`); returns the unsubscribe function. */
|
|
2528
|
+
onFindChange(listener: (event: FindChange) => void): () => void;
|
|
2529
|
+
/** Replaces when the row group panel shows (`GridOptions.groupPanel`). */
|
|
2530
|
+
setGroupPanel(mode: boolean | 'onlyWhenGrouping'): void;
|
|
2531
|
+
/** Replaces `GridOptions.dragOutHides` (and its distance); a running drag follows at its next move. */
|
|
2532
|
+
setDragOutHides(value: boolean | DragOutOptions): void;
|
|
2533
|
+
/** Replaces `GridOptions.animateColumnMoves`; from the next slide (a running one finishes). */
|
|
2534
|
+
setAnimateColumnMoves(on: boolean | 'always'): void;
|
|
2535
|
+
/** Replaces `GridOptions.stickyGroupRows`; from the next frame. */
|
|
2536
|
+
setStickyGroupRows(on: boolean): void;
|
|
2537
|
+
/** Replaces `GridOptions.groupTotalRow`; `undefined` = none. The rows follow at once. */
|
|
2538
|
+
setGroupTotalRow(value?: GridOptions['groupTotalRow']): void;
|
|
2539
|
+
/** Replaces `GridOptions.grandTotalRow`; `undefined` = none. The rows follow at once. */
|
|
2540
|
+
setGrandTotalRow(value?: GridOptions['grandTotalRow']): void;
|
|
2541
|
+
/** Replaces `GridOptions.stickyTotalRows`; from the next frame. */
|
|
2542
|
+
setStickyTotalRows(value: boolean | 'grand' | 'group'): void;
|
|
2543
|
+
/** Replaces `GridOptions.keepGroupValues`; the cells follow in the next frame. */
|
|
2544
|
+
setKeepGroupValues(on: boolean): void;
|
|
2545
|
+
/**
|
|
2546
|
+
* Replaces the rows pinned above the body (`GridOptions.pinnedTopRows`); `undefined` or `[]` empties the
|
|
2547
|
+
* section. A new array or the same one: the rows are drawn again, so after changing a pinned object itself, set the
|
|
2548
|
+
* same array again.
|
|
2549
|
+
*/
|
|
2550
|
+
setPinnedTopRows(rows?: readonly object[]): void;
|
|
2551
|
+
/** As `setPinnedTopRows`, for the rows pinned below the body (`GridOptions.pinnedBottomRows`). */
|
|
2552
|
+
setPinnedBottomRows(rows?: readonly object[]): void;
|
|
2553
|
+
/** The rows pinned above the body, the array as given; `[]` when none. */
|
|
2554
|
+
getPinnedTopRows(): readonly object[];
|
|
2555
|
+
/** The rows pinned below the body, the array as given; `[]` when none. */
|
|
2556
|
+
getPinnedBottomRows(): readonly object[];
|
|
2557
|
+
/** Replaces `GridOptions.groupKeys`; from the next key. */
|
|
2558
|
+
setGroupKeys(keys: GridOptions['groupKeys']): void;
|
|
2559
|
+
/** Replaces the status bar's panels (`GridOptions.statusBar`); `undefined` or `false` = no panel. */
|
|
2560
|
+
setStatusBar(options?: GridOptions['statusBar']): void;
|
|
2561
|
+
/** Replaces the top bar (`GridOptions.toolbar`); `undefined` or `false` removes it. */
|
|
2562
|
+
setToolbar(options?: GridOptions['toolbar']): void;
|
|
2563
|
+
/** Replaces the locale (`GridOptions.locale`); `undefined` = English. Every text of the grid follows. */
|
|
2564
|
+
setLocale(locale?: LocaleOptions): void;
|
|
2565
|
+
/** The current texts (the locale's over English), for app-built UI. */
|
|
2566
|
+
texts(): GridTexts;
|
|
2567
|
+
/** One event per completed change; returns the unsubscribe function. */
|
|
2568
|
+
onColumnStateChange(listener: (event: ColumnStateChange) => void): () => void;
|
|
2569
|
+
/**
|
|
2570
|
+
* One event per call or gesture that opened or closed column groups, listing the groups whose state
|
|
2571
|
+
* changed. Listeners are isolated and get nothing after `destroy()`. Returns the unsubscribe function.
|
|
2572
|
+
*/
|
|
2573
|
+
onColumnGroupToggle(listener: (event: ColumnGroupToggle) => void): () => void;
|
|
2574
|
+
/** Full order, or displayed order (lanes left → right). */
|
|
2575
|
+
getColumns(options?: {
|
|
2576
|
+
displayed?: boolean;
|
|
2577
|
+
}): ColumnInfo[];
|
|
2578
|
+
/**
|
|
2579
|
+
* Remove-then-insert at `toIndex` of the data and group columns (the row-number and selection columns are not
|
|
2580
|
+
* counted).
|
|
2581
|
+
*/
|
|
2582
|
+
moveColumns(ids: string[], toIndex: number): void;
|
|
2583
|
+
setPinned(ids: string[], side: PinnedSide | null): void;
|
|
2584
|
+
setHidden(ids: string[], hidden: boolean): void;
|
|
2585
|
+
/**
|
|
2586
|
+
* Scrolls horizontally so a centre column is visible; pinned or hidden columns, and columns a closed group does not
|
|
2587
|
+
* show (the group is not opened), are a no-op.
|
|
2588
|
+
*/
|
|
2589
|
+
ensureColumnVisible(id: string, align?: ScrollAlign): void;
|
|
2590
|
+
/**
|
|
2591
|
+
* Fits columns to their rendered rows (and header): default all displayed data columns. Resolves once applied;
|
|
2592
|
+
* waits for web fonts once. A no-op until the grid is laid out: on a hidden grid (`display: none`) or
|
|
2593
|
+
* before its first frame it resolves without changing a width.
|
|
2594
|
+
*/
|
|
2595
|
+
autoSize(ids?: string[], options?: AutoSizeOptions): Promise<void>;
|
|
2596
|
+
setRows(source: ViewportSource): void;
|
|
2597
|
+
/**
|
|
2598
|
+
* Scrolls row `index` into view. Resolves true once the row is loaded and drawn; false when a user scroll, another
|
|
2599
|
+
* scrollToRow, a reset, setRows or destroy supersedes it, when its row fails to load, or at once when the grid has
|
|
2600
|
+
* no rows or is not laid out. With sticky group rows, `'start'` — and scrolling into view from
|
|
2601
|
+
* above — leaves room for the row's sticking ancestors: the row lands right below the stack, not behind it.
|
|
2602
|
+
*/
|
|
2603
|
+
scrollToRow(index: number, align?: ScrollAlign): Promise<boolean>;
|
|
2604
|
+
/**
|
|
2605
|
+
* Where the grid is scrolled, as its last frame showed it (no layout read); while the grid is hidden (a closed
|
|
2606
|
+
* dialog, `display: none`), where it was when it was last shown. `{ row: 0, offset: 0, left: 0 }` before any row
|
|
2607
|
+
* showed. `row` is the first visible row, which may lie behind the stuck group rows.
|
|
2608
|
+
*/
|
|
2609
|
+
getScrollPosition(): ScrollPosition;
|
|
2610
|
+
/**
|
|
2611
|
+
* Scrolls to a position `getScrollPosition` gave: `row` at the top with `offset` px of it above, the centre columns
|
|
2612
|
+
* at `left`. Resolves as `scrollToRow` (true once the row is loaded and drawn; false when superseded, or at once
|
|
2613
|
+
* when the grid has no rows or is not laid out — call it once a hidden grid shows). Leaves no room for sticky group
|
|
2614
|
+
* rows: `setScrollPosition(getScrollPosition())` restores exactly.
|
|
2615
|
+
*/
|
|
2616
|
+
setScrollPosition(position: ScrollPosition): Promise<boolean>;
|
|
2617
|
+
/** Re-reads values and computed heights of a row range, or of everything. */
|
|
2618
|
+
refresh(range?: RowRange): void;
|
|
2619
|
+
/** Drops all known row heights and re-measures rendered rows. */
|
|
2620
|
+
resetRowHeights(): void;
|
|
2621
|
+
/**
|
|
2622
|
+
* Replaces the computed row height (`GridOptions.rowHeight`; `undefined` = default height only). Known heights are
|
|
2623
|
+
* dropped and evaluated or measured again; the first visible row keeps its screen position.
|
|
2624
|
+
*/
|
|
2625
|
+
setRowHeight(rowHeight?: GridOptions['rowHeight']): void;
|
|
2626
|
+
/** Replaces `GridOptions.rowClass` (`undefined` = none); the rendered rows are bound again with it. */
|
|
2627
|
+
setRowClass(rowClass?: GridOptions['rowClass']): void;
|
|
2628
|
+
/** Sets the grid's accessible name (`GridOptions.ariaLabel`); `undefined` or `''` removes it. */
|
|
2629
|
+
setAriaLabel(label?: string): void;
|
|
2630
|
+
getRenderedRange(): RowRange;
|
|
2631
|
+
/** The applied column filters: column id → model, active filters only (a copy). */
|
|
2632
|
+
getFilterModel(): FilterModel;
|
|
2633
|
+
/**
|
|
2634
|
+
* Replaces the filter model and re-filters at once: unlisted columns are cleared; unknown ids and columns without a
|
|
2635
|
+
* filter are skipped (one console hint); a malformed model is normalised or dropped column by column.
|
|
2636
|
+
*/
|
|
2637
|
+
setFilterModel(model: FilterModel | null): void;
|
|
2638
|
+
/** A column's applied model (a copy); null = none. */
|
|
2639
|
+
getColumnFilter(id: string): ColumnFilterModel | null;
|
|
2640
|
+
/**
|
|
2641
|
+
* Applies a column's model at once (`null` clears it): when the call returns, the source has the new query (a
|
|
2642
|
+
* client source has re-filtered, a server source has purged). A model equal to the current one changes nothing.
|
|
2643
|
+
*/
|
|
2644
|
+
setColumnFilter(id: string, model: ColumnFilterModel | null): void;
|
|
2645
|
+
/** One column has an applied filter, or (no id) any column has. */
|
|
2646
|
+
isFilterActive(id?: string): boolean;
|
|
2647
|
+
/** One event per filter model change, after the source received the new query; returns the unsubscribe function. */
|
|
2648
|
+
onFilterChange(listener: (event: FilterChange) => void): () => void;
|
|
2649
|
+
/**
|
|
2650
|
+
* A set filter's values: the source's distinct values of the column's field among the rows that pass the
|
|
2651
|
+
* other columns' filters and the quick filter (with counts when the filter shows them), or its fixed `values`.
|
|
2652
|
+
*/
|
|
2653
|
+
filterValues(id: string, options?: {
|
|
2654
|
+
search?: string;
|
|
2655
|
+
}): Promise<FilterValues>;
|
|
2656
|
+
/** The column's model as text in the grid's locale, for app-built chips; '' = no model. */
|
|
2657
|
+
filterSummary(id: string): string;
|
|
2658
|
+
/** Replaces `GridOptions.filterDefaults`: every filter is resolved again; models that no longer fit change. */
|
|
2659
|
+
setFilterDefaults(defaults?: FilterDefaults): void;
|
|
2660
|
+
/**
|
|
2661
|
+
* Opens the column chooser below the header's start: the columns and their groups (hidden ones too) with
|
|
2662
|
+
* visibility checkboxes, search and reorder, in a resizable dialog; an open one opens there again.
|
|
2663
|
+
*/
|
|
2664
|
+
showColumnChooser(): void;
|
|
2665
|
+
/**
|
|
2666
|
+
* Scrolls the column into view, then opens its filter popup below its filter button (else its header cell); an open
|
|
2667
|
+
* one stays open. A column without a filter, or one not displayed, opens nothing.
|
|
2668
|
+
*/
|
|
2669
|
+
showFilter(id: string): void;
|
|
2670
|
+
/**
|
|
2671
|
+
* Opens the column's menu below its menu button (else its header cell); an open one stays open. A column in view
|
|
2672
|
+
* opens at once; one out of view is scrolled into view first and its menu opens in a later frame, once that scroll
|
|
2673
|
+
* is through (a menu closes on scroll). A column not displayed, or with no entries, opens nothing.
|
|
2674
|
+
*/
|
|
2675
|
+
showColumnMenu(id: string): void;
|
|
2676
|
+
/** Replaces `GridOptions.columnMenu`: the grid-wide entries and the menu button's mode. */
|
|
2677
|
+
setColumnMenu(options?: GridOptions['columnMenu']): void;
|
|
2678
|
+
/** Replaces `GridOptions.icons`: the header's icons follow, popups stay open. */
|
|
2679
|
+
setIcons(icons?: HeaderIcons): void;
|
|
2680
|
+
/**
|
|
2681
|
+
* Replaces `GridOptions.tooltips` as a whole object: missing keys go back to their defaults. A showing
|
|
2682
|
+
* tooltip hides.
|
|
2683
|
+
*/
|
|
2684
|
+
setTooltips(options?: TooltipOptions): void;
|
|
2685
|
+
/**
|
|
2686
|
+
* Opens the context menu for a cell (`row` and `column`), a row, a column or nothing (the empty
|
|
2687
|
+
* area's context), at (`x`, `y`) in client coordinates when both are given, else at the cell's (or the row's)
|
|
2688
|
+
* centre when it is drawn in view, else at the viewport's top-left corner; nothing scrolls. A row outside the rows,
|
|
2689
|
+
* a column not displayed, no entries or `contextMenu: false` open nothing.
|
|
2690
|
+
*/
|
|
2691
|
+
showContextMenu(at: {
|
|
2692
|
+
row?: number;
|
|
2693
|
+
column?: string;
|
|
2694
|
+
x?: number;
|
|
2695
|
+
y?: number;
|
|
2696
|
+
}): void;
|
|
2697
|
+
/** Replaces `GridOptions.contextMenu`: the grid-wide entries and the Ctrl rule, read when a menu opens. */
|
|
2698
|
+
setContextMenu(options?: GridOptions['contextMenu']): void;
|
|
2699
|
+
/** Shows or hides the body's placeholder (`GridOptions.noRowsOverlay`). */
|
|
2700
|
+
setNoRowsOverlay(enabled: boolean): void;
|
|
2701
|
+
/** When the scrollbars show (`GridOptions.scrollbars`); applies at once. */
|
|
2702
|
+
setScrollbars(options?: ScrollbarsOptions): void;
|
|
2703
|
+
/** Closes every open grid popup (filter popups, menus, the column chooser). */
|
|
2704
|
+
hidePopups(): void;
|
|
2705
|
+
/**
|
|
2706
|
+
* The overlay host: attach an app overlay (a dropdown panel, a date picker) here instead of `<body>`, e.g.
|
|
2707
|
+
* PrimeVue's `appendTo`. It sits in the open grid popup, so the overlay draws above it, is not cut off at its edge
|
|
2708
|
+
* and a click in it stays inside; with no popup open it sits in the grid. The same element for the grid's life.
|
|
2709
|
+
*/
|
|
2710
|
+
getOverlayHost(): HTMLElement;
|
|
2711
|
+
/**
|
|
2712
|
+
* One event per top-level popup opened or closed (sub-menus go with their menu), e.g. to count open overlays;
|
|
2713
|
+
* nothing is reported once `destroy` is called, so a popup still open then gets no close event. Returns the unsubscribe function.
|
|
2714
|
+
*/
|
|
2715
|
+
onPopupChange(listener: (event: PopupChange) => void): () => void;
|
|
2716
|
+
/**
|
|
2717
|
+
* Replaces `GridOptions.sideBar`: the panels are built again, the open one as the options say;
|
|
2718
|
+
* a width the user chose stays per panel id. `undefined` or `false` removes the side bar.
|
|
2719
|
+
*/
|
|
2720
|
+
setSideBar(options?: GridOptions['sideBar']): void;
|
|
2721
|
+
/** Opens a tool panel of the side bar by id (another one closes); an unknown id or no side bar changes nothing. */
|
|
2722
|
+
openToolPanel(id: string): void;
|
|
2723
|
+
/** Closes the open tool panel. */
|
|
2724
|
+
closeToolPanel(): void;
|
|
2725
|
+
/** The open tool panel's id; null when none is open (or there is no side bar). */
|
|
2726
|
+
getOpenToolPanel(): string | null;
|
|
2727
|
+
/**
|
|
2728
|
+
* Applies a change of `GridOptions.rowDrag`: the handle column comes and goes, the functions apply
|
|
2729
|
+
* from their next call. `undefined` or `false` turns row dragging off.
|
|
2730
|
+
*/
|
|
2731
|
+
setRowDrag(options?: GridOptions['rowDrag']): void;
|
|
2732
|
+
/**
|
|
2733
|
+
* A drag of this grid's rows began: the press passed the 4 px threshold. Through the grid's event
|
|
2734
|
+
* queue; returns the remover.
|
|
2735
|
+
*/
|
|
2736
|
+
onRowDragStart(listener: (e: RowDragStart) => void): () => void;
|
|
2737
|
+
/**
|
|
2738
|
+
* A drag of this grid's rows ended: dropped, refused, over nothing, or `cancelled` (Escape, a lost pointer, the window
|
|
2739
|
+
* losing focus, a `setRowDrag` change of handle, drop, reorder or multiple). Not after `destroy()`. Returns the remover.
|
|
2740
|
+
*/
|
|
2741
|
+
onRowDragEnd(listener: (e: RowDragEnd) => void): () => void;
|
|
2742
|
+
/**
|
|
2743
|
+
* The target of a drag of this grid's rows changed: another grid or zone, row, position, or
|
|
2744
|
+
* whether a release there would drop (`over.allowed`); `over` null over nothing that takes rows. Target changes, not
|
|
2745
|
+
* pointer moves. Through the grid's event queue; returns the remover.
|
|
2746
|
+
*/
|
|
2747
|
+
onRowDragMove(listener: (e: RowDragMove) => void): () => void;
|
|
2748
|
+
/**
|
|
2749
|
+
* Rows were dropped on this grid: its own rows (`from` is this grid) or another grid's, through
|
|
2750
|
+
* this grid's zone. App-handled drops change nothing in the grid: the app moves its data. Fires before the source's
|
|
2751
|
+
* `onRowDragEnd`; returns the remover.
|
|
2752
|
+
*/
|
|
2753
|
+
onRowDrop(listener: (e: RowDrop) => void): () => void;
|
|
2754
|
+
/**
|
|
2755
|
+
* This grid as a target of other grids' row drags: an opaque zone to add to a source with its
|
|
2756
|
+
* `addRowDropZone`. Over this grid's header, body or status bar the drag aims at its rows by `positions` (default
|
|
2757
|
+
* `'between'`), asks `canDrop`, draws the mark and auto-scrolls here; a drop fires this grid's `onRowDrop` (`from`:
|
|
2758
|
+
* the source). Needs no `rowDrag` of its own. One zone may be added to several sources.
|
|
2759
|
+
*/
|
|
2760
|
+
rowDropZone(options?: GridDropZoneOptions): RowDropZone;
|
|
2761
|
+
/**
|
|
2762
|
+
* Where this grid's row drags may drop besides its own rows: another grid's `rowDropZone`, or an
|
|
2763
|
+
* element zone. The innermost zone under the pointer wins. A second zone of a grid already added (or an element
|
|
2764
|
+
* already added, also a grid's root) and this grid's own zone or root give one console hint and change nothing; a
|
|
2765
|
+
* zone whose grid is destroyed leaves the list; an element zone whose element is out of the document is skipped
|
|
2766
|
+
* until it is back (call the remover when it goes for good). Returns the remover.
|
|
2767
|
+
*/
|
|
2768
|
+
addRowDropZone(zone: RowDropZone | ElementDropZone): () => void;
|
|
2769
|
+
/**
|
|
2770
|
+
* Applies a change of `GridOptions.detail` field by field, never touching a live detail's content
|
|
2771
|
+
* : `master` and `toggle` act at once (a row that stops being a master closes, without an event), a new
|
|
2772
|
+
* `openByDefault` keeps the exceptions; the toggle column comes and goes. `undefined` turns master/detail off and
|
|
2773
|
+
* drops the open state.
|
|
2774
|
+
*/
|
|
2775
|
+
setDetail(options?: DetailOptions): void;
|
|
2776
|
+
/**
|
|
2777
|
+
* Opens or closes the details of these display rows: masters only (`master` is asked first for a
|
|
2778
|
+
* row not asked yet), others are skipped silently. One `onDetailToggle` per row whose state changed.
|
|
2779
|
+
*/
|
|
2780
|
+
setDetailOpen(rows: number | readonly number[], open: boolean): void;
|
|
2781
|
+
/** The row is a master whose detail is open; false for every other row and while `detail` is off. */
|
|
2782
|
+
isDetailOpen(row: number): boolean;
|
|
2783
|
+
/**
|
|
2784
|
+
* Every master opens or closes: the default becomes `open` and every exception goes, so masters not
|
|
2785
|
+
* loaded yet follow too. One `onDetailToggle` with `row: null`.
|
|
2786
|
+
*/
|
|
2787
|
+
setAllDetailsOpen(open: boolean): void;
|
|
2788
|
+
/**
|
|
2789
|
+
* A detail was opened or closed by the user or the API: once per row, once with `row: null` for
|
|
2790
|
+
* `setAllDetailsOpen`; never for closes driven by data. Through the grid's event queue; returns the remover.
|
|
2791
|
+
*/
|
|
2792
|
+
onDetailToggle(listener: (e: DetailToggle) => void): () => void;
|
|
2793
|
+
/**
|
|
2794
|
+
* A master's live detail grid: the built-in one, or the grid its custom content registered with
|
|
2795
|
+
* `ctx.register` — drawn or kept; null for any other row and while `detail` is off.
|
|
2796
|
+
*/
|
|
2797
|
+
getDetailGrid(row: number): Grid | null;
|
|
2798
|
+
/**
|
|
2799
|
+
* Every live detail grid, drawn or kept, with its master's row (−1 while not displayed, e.g.
|
|
2800
|
+
* filtered out), id and data — to flash cells or export in each, say.
|
|
2801
|
+
*/
|
|
2802
|
+
detailGrids(): DetailGridInfo[];
|
|
2803
|
+
/**
|
|
2804
|
+
* Refreshes live details as a change of their masters' data would: these display rows' details,
|
|
2805
|
+
* default every live one — after the app changed rows in place. `rebuild` destroys them and builds them again with
|
|
2806
|
+
* the current options, whatever `refresh` says ("my detail columns changed"). `master` and a height function
|
|
2807
|
+
* are asked again.
|
|
2808
|
+
*/
|
|
2809
|
+
refreshDetails(rows?: number | readonly number[], options?: {
|
|
2810
|
+
rebuild?: boolean;
|
|
2811
|
+
}): void;
|
|
2812
|
+
/**
|
|
2813
|
+
* Focuses the detail stop of master row `row`: its open detail scrolled into view (a detail taller
|
|
2814
|
+
* than the rows area shows its top) with DOM focus, `getFocusedCell()` null and `FocusChange.detail` the row there;
|
|
2815
|
+
* `inside: true` then moves DOM focus into its content — a built-in grid's remembered cell, a renderer's
|
|
2816
|
+
* `focus('start')`, else its first tabbable element —, content not built yet once it is. False for a row whose detail
|
|
2817
|
+
* is not open, and while `cellFocus` is false (no stop).
|
|
2818
|
+
*/
|
|
2819
|
+
focusDetail(row: number, options?: {
|
|
2820
|
+
inside?: boolean;
|
|
2821
|
+
}): boolean;
|
|
2822
|
+
destroy(): void;
|
|
2823
|
+
}
|
|
2824
|
+
/** A built-in status bar panel: the source's row counts, selected rows, aggregation. */
|
|
2825
|
+
export type StatusPanelId = 'totalRows' | 'filteredRows' | 'totalAndFilteredRows' | 'selectedRows' | 'aggregation';
|
|
2826
|
+
/** What an app-defined status panel draws from. */
|
|
2827
|
+
export interface StatusPanelContext {
|
|
2828
|
+
grid: Grid;
|
|
2829
|
+
/**
|
|
2830
|
+
* Data rows from the source's `status()` (group rows and fillers not counted): `total` all of them, `filtered` those
|
|
2831
|
+
* passing the filters; null = unknown (a grouped or tree server source) or, for `filtered`, not filtered here (a
|
|
2832
|
+
* server's total is already filtered).
|
|
2833
|
+
*/
|
|
2834
|
+
counts: {
|
|
2835
|
+
total: number | null;
|
|
2836
|
+
filtered: number | null;
|
|
2837
|
+
};
|
|
2838
|
+
/**
|
|
2839
|
+
* The selection: `rows` the selected rows (null = unknown), `ranges` the cell ranges' union extent.
|
|
2840
|
+
*/
|
|
2841
|
+
selection: {
|
|
2842
|
+
rows: number | null;
|
|
2843
|
+
ranges: {
|
|
2844
|
+
rows: number;
|
|
2845
|
+
columns: number;
|
|
2846
|
+
cells: number;
|
|
2847
|
+
};
|
|
2848
|
+
};
|
|
2849
|
+
texts: GridTexts;
|
|
2850
|
+
}
|
|
2851
|
+
export interface StatusPanelRendererInstance {
|
|
2852
|
+
update(ctx: StatusPanelContext): void;
|
|
2853
|
+
destroy(): void;
|
|
2854
|
+
}
|
|
2855
|
+
/**
|
|
2856
|
+
* An app-defined status panel: created when the bar gets it, `update`d at once, then once per frame after source or
|
|
2857
|
+
* filter changes and at once on a locale change; destroyed when the panels are replaced or the grid goes.
|
|
2858
|
+
*/
|
|
2859
|
+
export interface StatusPanelRenderer {
|
|
2860
|
+
create(host: HTMLElement): StatusPanelRendererInstance;
|
|
2861
|
+
}
|
|
2862
|
+
export interface StatusPanelDef {
|
|
2863
|
+
/** The panel's name (`data-key` on its element; the Vue slot `#status-panel-<key>`). */
|
|
2864
|
+
key: string;
|
|
2865
|
+
panel: StatusPanelId | StatusPanelRenderer;
|
|
2866
|
+
/** The bar's zone; panels keep their list order within it. Default 'right'. */
|
|
2867
|
+
align?: 'left' | 'center' | 'right';
|
|
2868
|
+
/** Options of the built-in 'aggregation' panel. */
|
|
2869
|
+
options?: AggregationPanelOptions;
|
|
2870
|
+
}
|
|
2871
|
+
/** The status bar's panels; a built-in id alone is a panel of that name in the right zone. */
|
|
2872
|
+
export interface StatusBarOptions {
|
|
2873
|
+
panels: readonly (StatusPanelId | StatusPanelDef)[];
|
|
2874
|
+
}
|
|
2875
|
+
/** A built-in top bar item. `'separator'` may repeat and needs no key. */
|
|
2876
|
+
export type ToolbarItemId = 'quickFilter' | 'find' | 'chips' | 'separator';
|
|
2877
|
+
/** The top bar's items; a bare id is that built-in in the default place, its key the id. */
|
|
2878
|
+
export interface ToolbarOptions {
|
|
2879
|
+
items: readonly (ToolbarItemId | ToolbarItemDef)[];
|
|
2880
|
+
/** The default place for items; default 'left'. */
|
|
2881
|
+
align?: 'left' | 'center' | 'right';
|
|
2882
|
+
}
|
|
2883
|
+
/** One bar item with a key; `setToolbar` keeps an item whose key and kind are unchanged. */
|
|
2884
|
+
export interface ToolbarItemDef {
|
|
2885
|
+
/** Unique (separators excepted); `data-key` on its element; the Vue slot `#toolbar-item-<key>`. */
|
|
2886
|
+
key: string;
|
|
2887
|
+
/** A built-in, a renderer, a button or a menu button; left out in Vue, the slot fills it. */
|
|
2888
|
+
item?: ToolbarItemId | ToolbarItemRenderer | ToolbarButton | ToolbarMenuButton;
|
|
2889
|
+
/** Overrides the bar's `align` for this item. */
|
|
2890
|
+
align?: 'left' | 'center' | 'right';
|
|
2891
|
+
/** Options of the built-in named by `item`. */
|
|
2892
|
+
options?: ToolbarQuickFilterOptions | ToolbarFindOptions | ToolbarChipsOptions;
|
|
2893
|
+
}
|
|
2894
|
+
/** What an app item draws from. */
|
|
2895
|
+
export interface ToolbarItemContext {
|
|
2896
|
+
grid: Grid;
|
|
2897
|
+
key: string;
|
|
2898
|
+
texts: GridTexts;
|
|
2899
|
+
}
|
|
2900
|
+
/** What `ToolbarItemRenderer.create` returns: refreshed with a fresh context, destroyed with the item. */
|
|
2901
|
+
export interface ToolbarItemRendererInstance {
|
|
2902
|
+
update(ctx: ToolbarItemContext): void;
|
|
2903
|
+
destroy(): void;
|
|
2904
|
+
}
|
|
2905
|
+
/** An app-defined bar item, the status bar's renderer shape: created once, `update`d on each refresh. */
|
|
2906
|
+
export interface ToolbarItemRenderer {
|
|
2907
|
+
create(host: HTMLElement): ToolbarItemRendererInstance;
|
|
2908
|
+
}
|
|
2909
|
+
/** A plain button; needs at least one of `label`, `icon`, `tooltip`. */
|
|
2910
|
+
export interface ToolbarButton {
|
|
2911
|
+
type: 'button';
|
|
2912
|
+
label?: string;
|
|
2913
|
+
/** As a menu item's icon. */
|
|
2914
|
+
icon?: string | (() => Element);
|
|
2915
|
+
/** The hover text; the accessible name falls back from `label` to `tooltip`. */
|
|
2916
|
+
tooltip?: string;
|
|
2917
|
+
disabled?: boolean;
|
|
2918
|
+
action(ctx: ToolbarItemContext): void;
|
|
2919
|
+
}
|
|
2920
|
+
/** A button opening InGrid's menu below itself (popup kind 'toolbarMenu'); built-in names work in `items`. */
|
|
2921
|
+
export interface ToolbarMenuButton {
|
|
2922
|
+
type: 'menu';
|
|
2923
|
+
label?: string;
|
|
2924
|
+
/** Default: the `menu` icon. */
|
|
2925
|
+
icon?: string | (() => Element);
|
|
2926
|
+
tooltip?: string;
|
|
2927
|
+
items: readonly MenuEntry[] | ((ctx: ToolbarItemContext) => readonly MenuEntry[]);
|
|
2928
|
+
}
|
|
2929
|
+
/** Options of the quick-filter box. */
|
|
2930
|
+
export interface ToolbarQuickFilterOptions {
|
|
2931
|
+
/** Default `texts.toolbarQuickFilter`. */
|
|
2932
|
+
placeholder?: string;
|
|
2933
|
+
}
|
|
2934
|
+
/** Options of the find box. */
|
|
2935
|
+
export interface ToolbarFindOptions {
|
|
2936
|
+
/** Default `texts.toolbarFind`. */
|
|
2937
|
+
placeholder?: string;
|
|
2938
|
+
}
|
|
2939
|
+
/** The count chips' kinds. */
|
|
2940
|
+
export type ToolbarChipKind = 'filters' | 'sorts' | 'groups' | 'groupSize' | 'hidden' | 'pinned' | 'moved';
|
|
2941
|
+
/** Options of the count chips. */
|
|
2942
|
+
export interface ToolbarChipsOptions {
|
|
2943
|
+
/** Which chips and in what order; default `['filters', 'sorts', 'groups', 'hidden']`. */
|
|
2944
|
+
kinds?: readonly ToolbarChipKind[];
|
|
2945
|
+
/** Replaces a chip's click (no automatic commit follows). */
|
|
2946
|
+
clear?: Partial<Record<ToolbarChipKind, (ctx: {
|
|
2947
|
+
grid: Grid;
|
|
2948
|
+
kind: ToolbarChipKind;
|
|
2949
|
+
}) => void>>;
|
|
2950
|
+
}
|