@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,225 @@
|
|
|
1
|
+
import type { ColumnFilterModel } from './filter/model';
|
|
2
|
+
import type { GridOptions, SortDirection } from './types';
|
|
3
|
+
/** The filter field of the group column (equals `GROUP_ID`; worker-safe, so not imported from the column model). */
|
|
4
|
+
export declare const GROUP_FILTER_FIELD = "ig:group";
|
|
5
|
+
/** Change notifications from a data source. */
|
|
6
|
+
export type SourceChange = {
|
|
7
|
+
type: 'rows';
|
|
8
|
+
first: number;
|
|
9
|
+
last: number;
|
|
10
|
+
} | {
|
|
11
|
+
type: 'count';
|
|
12
|
+
} | {
|
|
13
|
+
type: 'reset';
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Rows [at, at + removed) were replaced by `inserted` new rows; every row after them moved by inserted − removed.
|
|
17
|
+
* Several splices apply in order, each to the rows the previous one left.
|
|
18
|
+
*/
|
|
19
|
+
| {
|
|
20
|
+
type: 'splice';
|
|
21
|
+
at: number;
|
|
22
|
+
removed: number;
|
|
23
|
+
inserted: number;
|
|
24
|
+
};
|
|
25
|
+
export interface QuerySort {
|
|
26
|
+
field: string;
|
|
27
|
+
direction: SortDirection;
|
|
28
|
+
}
|
|
29
|
+
export interface QueryAggregate {
|
|
30
|
+
field: string;
|
|
31
|
+
/** 'sum' | 'avg' | 'min' | 'max' | 'count', or a name the server knows. */
|
|
32
|
+
fn: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The grid's quick filter: its text, trimmed and non-empty (sources split it into words,
|
|
36
|
+
* `quickFilterWords`), and the fields it searches.
|
|
37
|
+
*/
|
|
38
|
+
export interface QuickFilterQuery {
|
|
39
|
+
text: string;
|
|
40
|
+
fields: readonly string[];
|
|
41
|
+
}
|
|
42
|
+
/** What the grid's column state asks the data for: fields, not column ids. */
|
|
43
|
+
export interface RowQuery {
|
|
44
|
+
sort: readonly QuerySort[];
|
|
45
|
+
groupBy: readonly string[];
|
|
46
|
+
aggregates: readonly QueryAggregate[];
|
|
47
|
+
/** The quick filter while its text has a word; null = off. */
|
|
48
|
+
quickFilter: QuickFilterQuery | null;
|
|
49
|
+
/** Tree mode: the field the group column shows on every row (`groupColumn.field`); null otherwise. */
|
|
50
|
+
treeField: string | null;
|
|
51
|
+
/** Active column filters; [] = none. */
|
|
52
|
+
filter: readonly FieldFilter[];
|
|
53
|
+
}
|
|
54
|
+
/** The evaluation options of a filter, as plain data (caseSensitive, inRangeInclusive, includeTime). */
|
|
55
|
+
export interface FilterEvalOptions {
|
|
56
|
+
caseSensitive?: boolean;
|
|
57
|
+
inRangeInclusive?: boolean;
|
|
58
|
+
includeTime?: boolean;
|
|
59
|
+
}
|
|
60
|
+
export interface FieldFilter {
|
|
61
|
+
/** The column's field ('ig:group' for the group column). */
|
|
62
|
+
field: string;
|
|
63
|
+
/** 'text' | 'number' | 'date' | 'groupSize' | 'set' | 'multi' | a custom name. */
|
|
64
|
+
kind: string;
|
|
65
|
+
model: ColumnFilterModel;
|
|
66
|
+
/** caseSensitive, inRangeInclusive, includeTime (plain data). */
|
|
67
|
+
options: FilterEvalOptions;
|
|
68
|
+
/** Multi: one entry per child, model null when inactive. */
|
|
69
|
+
children?: readonly FieldFilter[];
|
|
70
|
+
}
|
|
71
|
+
export interface ValuesRequest {
|
|
72
|
+
field: string;
|
|
73
|
+
/** The other active filters (not this column's). */
|
|
74
|
+
filter: readonly FieldFilter[];
|
|
75
|
+
quickFilter: QuickFilterQuery | null;
|
|
76
|
+
/** Only values whose label contains it (servers may ignore it). */
|
|
77
|
+
search?: string;
|
|
78
|
+
/** A hint for huge lists (servers may ignore it). */
|
|
79
|
+
limit?: number;
|
|
80
|
+
counts: boolean;
|
|
81
|
+
signal?: AbortSignal;
|
|
82
|
+
}
|
|
83
|
+
export interface FilterValues {
|
|
84
|
+
/** Distinct values; one blank entry (null) at most. */
|
|
85
|
+
values: readonly unknown[];
|
|
86
|
+
/** Rows per value, same order. */
|
|
87
|
+
counts?: readonly number[];
|
|
88
|
+
/** false = a server cut the list (the popup says so). */
|
|
89
|
+
complete?: boolean;
|
|
90
|
+
}
|
|
91
|
+
/** What the grid's status bar and menus need to know about the source. */
|
|
92
|
+
export interface SourceStatus {
|
|
93
|
+
/** Rows come from a server (set filters refresh on open by default). */
|
|
94
|
+
remote: boolean;
|
|
95
|
+
/** The column menu and the columns panel offer grouping. */
|
|
96
|
+
canGroup: boolean;
|
|
97
|
+
/** Data rows; null = unknown (a grouped or tree server source). */
|
|
98
|
+
total: number | null;
|
|
99
|
+
/** Data rows passing the filters; null = unknown or not filtered here. */
|
|
100
|
+
filtered: number | null;
|
|
101
|
+
/**
|
|
102
|
+
* The source waits for its first answer since it started or dropped its rows (a server source's purge or regroup):
|
|
103
|
+
* its `rowCount` is not the result yet. The grid shows no "no rows" placeholder meanwhile. Absent = false.
|
|
104
|
+
*/
|
|
105
|
+
pending?: boolean;
|
|
106
|
+
}
|
|
107
|
+
export declare const EMPTY_QUERY: RowQuery;
|
|
108
|
+
/**
|
|
109
|
+
* The total rows the grid asks of a source: `ViewportSource.setTotalRows`. `group`: the groups'
|
|
110
|
+
* total rows (`GridOptions.groupTotalRow`); `grand`: the grand total's place — first or last in the display order, or
|
|
111
|
+
* `'pinned'`, out of it (the pinned section reads it). Null = none.
|
|
112
|
+
*/
|
|
113
|
+
export interface TotalRows {
|
|
114
|
+
group: GridOptions['groupTotalRow'] | null;
|
|
115
|
+
grand: 'top' | 'bottom' | 'pinned' | null;
|
|
116
|
+
}
|
|
117
|
+
/** Metadata of one row of a hierarchical source. */
|
|
118
|
+
export interface RowInfo {
|
|
119
|
+
/** `'total'` = a group's total row or the grand total (`grandTotal`). */
|
|
120
|
+
kind: 'leaf' | 'group' | 'total';
|
|
121
|
+
/** 0 = top level. */
|
|
122
|
+
level: number;
|
|
123
|
+
expandable: boolean;
|
|
124
|
+
expanded: boolean;
|
|
125
|
+
/** null = unknown. */
|
|
126
|
+
childCount: number | null;
|
|
127
|
+
/** 0-based position inside its level (aria-posinset − 1). */
|
|
128
|
+
posInLevel: number;
|
|
129
|
+
/** Its level's row count (aria-setsize). */
|
|
130
|
+
levelSize: number;
|
|
131
|
+
/** A stable id from the server (e.g. a desktop CSV viewer's original file row). */
|
|
132
|
+
id: string | number | null;
|
|
133
|
+
state: 'loading' | 'loaded' | 'error';
|
|
134
|
+
/**
|
|
135
|
+
* The row is expanded and the first rows of the level below it are on their way: the level appears once
|
|
136
|
+
* they arrive; meanwhile the grid marks the row `aria-busy` and its chevron `ig-opening`. Absent = false.
|
|
137
|
+
*/
|
|
138
|
+
opening?: boolean;
|
|
139
|
+
/** The row is the grand total (`kind: 'total'`). Absent = false. */
|
|
140
|
+
grandTotal?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* On a group row: where its total row sits once the group is open — set whether the group is open or
|
|
143
|
+
* closed (an export as if open needs it), so its cells know what to blank. Absent = the group has none.
|
|
144
|
+
*/
|
|
145
|
+
totalRow?: 'top' | 'bottom';
|
|
146
|
+
/**
|
|
147
|
+
* A client source's data row: it is shown although its values no longer pass the filters — it stays
|
|
148
|
+
* where it is after a held update (`setData(rows, { hold: true })`) or a write until the filters run again; the
|
|
149
|
+
* grid gives its row `ig-row-unmatched`. Absent = false.
|
|
150
|
+
*/
|
|
151
|
+
unmatched?: boolean;
|
|
152
|
+
}
|
|
153
|
+
/** A row's info with nothing known yet; every writer of a refilled `RowInfo` sets `grandTotal` and `totalRow`. */
|
|
154
|
+
export declare function emptyRowInfo(): RowInfo;
|
|
155
|
+
/**
|
|
156
|
+
* What an `onExpansionChange` listener is told: why the expansion changed. `'grouping'`: a regroup or an
|
|
157
|
+
* ungroup dropped the open state of removed levels; `'ui'`: a gesture of the grid (chevron, Enter, the column menu's
|
|
158
|
+
* Expand all / Collapse all, `groupKeys`); `'api'`: the app called the source (`expand`, `collapse`, `expandAll`,
|
|
159
|
+
* `collapseAll`, `reveal`, `setExpansion`, `setExpanded`).
|
|
160
|
+
*/
|
|
161
|
+
export interface ExpansionChange {
|
|
162
|
+
source: 'grouping' | 'ui' | 'api';
|
|
163
|
+
}
|
|
164
|
+
/** The only way data reaches the engine. The engine never iterates all rows. */
|
|
165
|
+
export interface ViewportSource {
|
|
166
|
+
readonly rowCount: number;
|
|
167
|
+
isLoaded(row: number): boolean;
|
|
168
|
+
/** Only called when `isLoaded(row)` is true. */
|
|
169
|
+
getValue(row: number, field: string): unknown;
|
|
170
|
+
/**
|
|
171
|
+
* Loading hint for a row range; must not block. The grid passes the rows it draws (visible plus overscan) and, as
|
|
172
|
+
* `anchor`, the row it keeps in place on screen: the first visible row, or a `scrollToRow` target until the
|
|
173
|
+
* user scrolls. Rows inserted above the anchor change nothing on screen.
|
|
174
|
+
*/
|
|
175
|
+
ensureLoaded(first: number, last: number, anchor?: number): void;
|
|
176
|
+
subscribe(listener: (change: SourceChange) => void): () => void;
|
|
177
|
+
/**
|
|
178
|
+
* Row metadata. Fills and returns `into` when given, so the engine allocates nothing per row; a new
|
|
179
|
+
* object otherwise.
|
|
180
|
+
*/
|
|
181
|
+
rowInfo?(row: number, into?: RowInfo): RowInfo;
|
|
182
|
+
/**
|
|
183
|
+
* The displayed row of `row`'s parent group or tree parent; −1 at the top level and out of range.
|
|
184
|
+
* O(depth); also over rows that are not loaded.
|
|
185
|
+
*/
|
|
186
|
+
parentRow?(row: number): number;
|
|
187
|
+
/**
|
|
188
|
+
* One past `row`'s last displayed descendant; `row + 1` when it has none, is closed, or is out of
|
|
189
|
+
* range. O(depth); also over rows that are not loaded.
|
|
190
|
+
*/
|
|
191
|
+
groupEnd?(row: number): number;
|
|
192
|
+
/** The column state's query; called before the first `ensureLoaded` and on every change. */
|
|
193
|
+
setQuery?(query: RowQuery): void;
|
|
194
|
+
/**
|
|
195
|
+
* The total rows to make — the groups' and the grand total — as rows of the source's own display order
|
|
196
|
+
* (`RowInfo.kind: 'total'`); null = none. Called by the grid before the first `ensureLoaded` and on every change of
|
|
197
|
+
* `groupTotalRow` / `grandTotalRow`. A source without it shows no total rows (the grid says so once).
|
|
198
|
+
*/
|
|
199
|
+
setTotalRows?(totals: TotalRows | null): void;
|
|
200
|
+
/**
|
|
201
|
+
* A chevron click; `all`: Alt-click, expand or collapse everything. `source`: `'ui'`
|
|
202
|
+
* when the grid's own gesture made the call; a source tells its expansion listeners `'ui'` for it and `'api'`
|
|
203
|
+
* otherwise.
|
|
204
|
+
*/
|
|
205
|
+
setExpanded?(row: number, expanded: boolean, options?: {
|
|
206
|
+
all?: boolean;
|
|
207
|
+
source?: 'ui' | 'api';
|
|
208
|
+
}): void;
|
|
209
|
+
/** Distinct values of a field for the set filter. */
|
|
210
|
+
filterValues?(request: ValuesRequest): FilterValues | Promise<FilterValues>;
|
|
211
|
+
/** What the status bar and menus need to know. */
|
|
212
|
+
status?(): SourceStatus;
|
|
213
|
+
/**
|
|
214
|
+
* Value writes: the opt-in of a source whose rows can be written. Calls `write` with
|
|
215
|
+
* the object behind display row `row` when the cell (`row`, `field`) shows a value of the row's own — a loaded
|
|
216
|
+
* data row; not a group row, a tree filler or an aggregate — and returns its result; false without calling it
|
|
217
|
+
* otherwise. `plain`: no column setter takes part, `write` puts the value into `data[field]` itself — a source
|
|
218
|
+
* refuses that for a field whose value it computes (a client source's `FieldDef.value` getter), where it
|
|
219
|
+
* would only leave a stray property. `write` returns true when it wrote (into the object, or wherever a column's
|
|
220
|
+
* `setValue` keeps the value); the source then keeps the change (a client source drops the row's cached keys, a
|
|
221
|
+
* server source patches its cached row) and announces nothing: the grid draws the row again itself. Without this
|
|
222
|
+
* method cell contexts have no `setValue` and `grid.setCellValue` returns false.
|
|
223
|
+
*/
|
|
224
|
+
writeCell?(row: number, field: string, write: (data: object) => boolean, plain: boolean): boolean;
|
|
225
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ViewportSource } from './source';
|
|
2
|
+
/** Deterministic 32-bit hash of three integers. */
|
|
3
|
+
export declare function hash3(a: number, b: number, c: number): number;
|
|
4
|
+
export interface SyntheticOptions {
|
|
5
|
+
rows: number;
|
|
6
|
+
cols: number;
|
|
7
|
+
seed?: number;
|
|
8
|
+
/** Fraction of rows whose text columns get 1–5 extra lines. */
|
|
9
|
+
multiline?: number;
|
|
10
|
+
/** > 0 simulates asynchronous block loading. */
|
|
11
|
+
latencyMs?: number;
|
|
12
|
+
blockSize?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface SyntheticSource extends ViewportSource {
|
|
15
|
+
readonly fields: string[];
|
|
16
|
+
/** Number of text lines of the row's text columns (≥ 1). */
|
|
17
|
+
lineCount(row: number): number;
|
|
18
|
+
setRowCount(n: number): void;
|
|
19
|
+
/** Emits a 'rows' change (values are deterministic, so this only simulates an update). */
|
|
20
|
+
touch(first: number, last: number): void;
|
|
21
|
+
/** Number of block loads started (tests). */
|
|
22
|
+
readonly loadRequests: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Deterministic generated data without storage (memory ≈ 0 at any size): column kinds cycle through
|
|
26
|
+
* text (c0, c4, …), integer, decimal and ISO date.
|
|
27
|
+
*/
|
|
28
|
+
export declare function syntheticSource(options: SyntheticOptions): SyntheticSource;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ResolvedColumn } from '../columns/layout';
|
|
2
|
+
import type { SectionSide } from '../render/pinnedRows';
|
|
3
|
+
import { type RowInfo } from '../source';
|
|
4
|
+
import type { ColumnInfo } from '../types';
|
|
5
|
+
import type { HeaderGroup } from './headers';
|
|
6
|
+
import type { TableHost } from './host';
|
|
7
|
+
import { type TableRows } from './rows';
|
|
8
|
+
/** A column of a walk with what its cells and header need. */
|
|
9
|
+
export interface TableColumn {
|
|
10
|
+
id: string;
|
|
11
|
+
col: ResolvedColumn;
|
|
12
|
+
info: ColumnInfo;
|
|
13
|
+
/** Its header text (after the header hook); '' when the walk writes no header. */
|
|
14
|
+
header: string;
|
|
15
|
+
/** Its groups, top level first (texts after the header hook); empty when the walk writes no group headers. */
|
|
16
|
+
groups: readonly HeaderGroup[];
|
|
17
|
+
}
|
|
18
|
+
/** One cell as a copy or an export reads it; one object per reader, refilled per cell. */
|
|
19
|
+
export interface CellRead {
|
|
20
|
+
/** The raw value, as the cell draws it. */
|
|
21
|
+
value: unknown;
|
|
22
|
+
/** The display row (−1 for a row read beneath an open group). */
|
|
23
|
+
display: number;
|
|
24
|
+
/** The row's info (refilled per row); null on a flat source without it. */
|
|
25
|
+
info: RowInfo | null;
|
|
26
|
+
/** A pinned row's section: `format`'s last argument and the hooks' `pinned`; undefined in the body. */
|
|
27
|
+
pinned: SectionSide | undefined;
|
|
28
|
+
/** A copy of `info` for an app hook, one per row, made when first read. */
|
|
29
|
+
readonly hookInfo: RowInfo | null;
|
|
30
|
+
/**
|
|
31
|
+
* The cell is a total row's label — the group column's "Total <label>" / "Total", or the flat label
|
|
32
|
+
* cell's word. Its text is written in every mode (`'value'` too): the raw value is the group's key, or none.
|
|
33
|
+
*/
|
|
34
|
+
label: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* The displayed text: the column's `format` (isolated; a pinned row's with `pinned`), the group label without its
|
|
37
|
+
* count, "(Blank)". Valid only
|
|
38
|
+
* right after the reader returned this object (non-null) for the cell: the next read refills it. It formats on every
|
|
39
|
+
* call — call it at most once per cell.
|
|
40
|
+
*/
|
|
41
|
+
text(): string;
|
|
42
|
+
}
|
|
43
|
+
/** `'value'` texts: null and undefined empty, strings as they are, anything else through `String`. */
|
|
44
|
+
export declare function rawText(value: unknown): string;
|
|
45
|
+
/**
|
|
46
|
+
* The cell reader of one walk over `rows`. Null: the cell is written empty and no hook runs — a row without values, a
|
|
47
|
+
* `NONE` value, a client group row's plain column, which draws nothing. The texts and the client's empty group
|
|
48
|
+
* rows are taken once per reader; the returned `CellRead` is the same object for every cell. `asIfOpen`:
|
|
49
|
+
* the walk writes every group as if open (an export over the expanded order), so a group with a total row blanks its
|
|
50
|
+
* own sums whether open or closed.
|
|
51
|
+
*/
|
|
52
|
+
export declare function cellReader(host: TableHost, rows: TableRows, asIfOpen?: boolean): (row: number, column: TableColumn) => CellRead | null;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** A column group as a header row writes it: its id and its text (after the header hook). */
|
|
2
|
+
export interface HeaderGroup {
|
|
3
|
+
id: string;
|
|
4
|
+
text: string;
|
|
5
|
+
}
|
|
6
|
+
/** One column's cell in a group header line: its group (null: none at that level), whether a run starts here, its span. */
|
|
7
|
+
export interface HeaderCell {
|
|
8
|
+
group: HeaderGroup | null;
|
|
9
|
+
start: boolean;
|
|
10
|
+
/** The run's columns where it starts; 0 elsewhere. */
|
|
11
|
+
span: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Per level (top first) per column; a run = adjacent columns with the same group id here and at every level above:
|
|
15
|
+
* two neighbouring groups of one name are two runs, the name is only the run's text. A column without a group
|
|
16
|
+
* at a level is no run there (`group` null, `start` false).
|
|
17
|
+
*/
|
|
18
|
+
export declare function headerLevels(columns: readonly {
|
|
19
|
+
groups: readonly HeaderGroup[];
|
|
20
|
+
}[]): HeaderCell[][];
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { DisplayLayout } from '../columns/layout';
|
|
2
|
+
import type { GridTexts } from '../i18n/texts';
|
|
3
|
+
import type { RangeColumns, RangeModel } from '../selection/ranges';
|
|
4
|
+
import type { ResolvedRowSelectionUi, RowSelectionConfig, RowSelectionModel } from '../selection/rows';
|
|
5
|
+
import type { ViewportSource } from '../source';
|
|
6
|
+
import type { ColumnInfo, DetailRowContext } from '../types';
|
|
7
|
+
/** What a frame loop hands its callback (VueUse's `useRafFn` arguments): the frame's rAF timestamp. */
|
|
8
|
+
export interface FrameTime {
|
|
9
|
+
readonly timestamp: number;
|
|
10
|
+
}
|
|
11
|
+
/** A frame loop as the slicer drives it (the grid's: VueUse's `useRafFn` controls). */
|
|
12
|
+
export interface FrameLoop {
|
|
13
|
+
resume(): void;
|
|
14
|
+
pause(): void;
|
|
15
|
+
}
|
|
16
|
+
export interface TableHost {
|
|
17
|
+
source(): ViewportSource;
|
|
18
|
+
/** The applied display layout (a pending relayout applied first). */
|
|
19
|
+
layout(): DisplayLayout;
|
|
20
|
+
/** `GridOptions.keepGroupValues` (absent: off), for the cells' rule (`emptyGroupRows`). */
|
|
21
|
+
keepGroupValues?(): boolean;
|
|
22
|
+
columnInfo(id: string): ColumnInfo | null;
|
|
23
|
+
/**
|
|
24
|
+
* The display row count as the grid follows it: every splice applied, so within a batch of splices it may differ
|
|
25
|
+
* from `source().rowCount` until the batch settles. The range model keeps the same count: pass this
|
|
26
|
+
* one to `summary` / `unionBands`.
|
|
27
|
+
*/
|
|
28
|
+
rowCount(): number;
|
|
29
|
+
/** The row selection model; null while row selection is off. */
|
|
30
|
+
rowSelection(): RowSelectionModel | null;
|
|
31
|
+
/** Row selection's resolved options (the header checkbox as it currently applies); null while it is off. */
|
|
32
|
+
rowSelectionUi(): (RowSelectionConfig & ResolvedRowSelectionUi) | null;
|
|
33
|
+
/** The cell range model; null while cell selection is off. */
|
|
34
|
+
ranges(): RangeModel | null;
|
|
35
|
+
/** The range columns in display order (no row-number or selection column), the applied layout's. */
|
|
36
|
+
rangeColumns(): RangeColumns;
|
|
37
|
+
texts(): GridTexts;
|
|
38
|
+
/** A developer hint, printed once per key. */
|
|
39
|
+
warn(key: string, message: string): void;
|
|
40
|
+
/**
|
|
41
|
+
* A range drag (the root's `ig-selecting` class) or a visible row drag runs: the slicer skips the frame,
|
|
42
|
+
* its frames are the drag's.
|
|
43
|
+
*/
|
|
44
|
+
dragging(): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* A frame loop calling `pump` once per frame (with the frame's rAF timestamp), paused at first; undefined
|
|
47
|
+
* once the grid is destroyed.
|
|
48
|
+
*/
|
|
49
|
+
frames(pump: (at?: FrameTime) => void): FrameLoop | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* When the grid's pass is due in this frame, queues `task` to run after it (the frame scheduler's
|
|
52
|
+
* deferred tasks) and returns true; false when none is due (the slicer runs `task` at once). Absent: never.
|
|
53
|
+
*/
|
|
54
|
+
afterPass?(task: () => void): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* The row `ctx` describes is a master whose detail is open (the export hook's `ctx.open`): by its
|
|
57
|
+
* key, loaded or not, displayed or not, remembering nothing; absent or false while master/detail is off.
|
|
58
|
+
*/
|
|
59
|
+
detailOpenOf?(ctx: DetailRowContext): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* The rows of pinned section `side` as a source: copy and export take them in display order around
|
|
62
|
+
* the body's. Absent on a host without sections (a test's): none are taken.
|
|
63
|
+
*/
|
|
64
|
+
sectionSource?(side: 'top' | 'bottom'): ViewportSource;
|
|
65
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Slicer } from './slicer';
|
|
2
|
+
export interface TableJob {
|
|
3
|
+
readonly signal: AbortSignal;
|
|
4
|
+
cancelled: boolean;
|
|
5
|
+
/** A server read failed (reported already): the job rejects with it. */
|
|
6
|
+
failure: unknown;
|
|
7
|
+
/**
|
|
8
|
+
* Its rows are display rows up to this one — taken at plan time and not built yet (`confirm` open), or being
|
|
9
|
+
* built from the live rows in slices —; −1: none (built, a whole-view take, a read that watches itself): `moved`
|
|
10
|
+
* leaves it alone.
|
|
11
|
+
*/
|
|
12
|
+
liveUpTo: number;
|
|
13
|
+
/** Settles (with false) when the job is cancelled: what a wait on the app (`confirm`) races against. */
|
|
14
|
+
readonly cancelledWait: Promise<false>;
|
|
15
|
+
/** Aborts its signal and ends its slices in `slicer` (their promises reject with an `AbortError`). */
|
|
16
|
+
cancel(): void;
|
|
17
|
+
}
|
|
18
|
+
/** The `AbortError` a cancelled copy or export rejects with. */
|
|
19
|
+
export declare function abortError(what: 'copy' | 'export'): DOMException;
|
|
20
|
+
/** A new job whose slices run in `slicer`. */
|
|
21
|
+
export declare function createJob(slicer: Slicer): TableJob;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { ResolvedColumn } from '../columns/layout';
|
|
2
|
+
import { type ExpandedOrder } from '../data/client/clientSource';
|
|
3
|
+
import { type ReadRows } from '../data/server/serverSource';
|
|
4
|
+
import type { RowInfo, ViewportSource } from '../source';
|
|
5
|
+
import type { RowDragContext } from '../types';
|
|
6
|
+
import type { TableColumn } from './cells';
|
|
7
|
+
/** A row with no value to write (not loaded, or a throwing `getValue`): its cells are written empty. */
|
|
8
|
+
export declare const NONE: unique symbol;
|
|
9
|
+
/** The rows a walk reads: display rows of the live source, or rows a server read returned. */
|
|
10
|
+
export interface TableRows {
|
|
11
|
+
/** The display index of walk row `r`; −1 for a row read beneath an open group. */
|
|
12
|
+
display(r: number): number;
|
|
13
|
+
/** Whether row `r` has values. */
|
|
14
|
+
has(r: number): boolean;
|
|
15
|
+
/** Row `r`'s info into `into`; null on a flat source without it. */
|
|
16
|
+
info(r: number, into: RowInfo): RowInfo | null;
|
|
17
|
+
/** Row `r`'s raw value in `col` (its info given); `NONE` when it has none. */
|
|
18
|
+
value(r: number, col: ResolvedColumn, info: RowInfo | null): unknown;
|
|
19
|
+
/**
|
|
20
|
+
* Walk row `r`'s client data node (`dataOfNode` gives its row object; rows inside closed groups too); −1
|
|
21
|
+
* for a group row or a filler. Absent on server reads and other sources.
|
|
22
|
+
*/
|
|
23
|
+
node?(r: number): number;
|
|
24
|
+
/**
|
|
25
|
+
* Walk row `r`'s pinned section, undefined for a body row; absent on a walk of body rows only
|
|
26
|
+
* (`withSections` adds it).
|
|
27
|
+
*/
|
|
28
|
+
pinned?(r: number): 'top' | 'bottom' | undefined;
|
|
29
|
+
}
|
|
30
|
+
/** A walk without rows. */
|
|
31
|
+
export declare const NO_ROWS: TableRows;
|
|
32
|
+
/**
|
|
33
|
+
* The pinned sections a walk reads around its body rows: each side's source — null when not taken or
|
|
34
|
+
* empty — and its row count as the take found it.
|
|
35
|
+
*/
|
|
36
|
+
export interface WalkSections {
|
|
37
|
+
top: ViewportSource | null;
|
|
38
|
+
/** The top rows taken: walk rows `−t … −1`. */
|
|
39
|
+
t: number;
|
|
40
|
+
bottom: ViewportSource | null;
|
|
41
|
+
/** The bottom rows taken: walk rows `size … size + u − 1` after a body walk of `size` rows. */
|
|
42
|
+
u: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* `body` with the pinned sections around it, one index space in display order (`rangeSpan`'s): walk row
|
|
46
|
+
* `r < 0` is top row `r + t`, `0 … size − 1` the body walk's rows, `size + j` bottom row `j`. A section row reads its
|
|
47
|
+
* section source as the cells draw it (`liveRows`): its display index is its row in the section, its node −1, and
|
|
48
|
+
* `pinned` names its side.
|
|
49
|
+
*/
|
|
50
|
+
export declare function withSections(body: TableRows, size: number, s: WalkSections): TableRows;
|
|
51
|
+
/** Merged, sorted row intervals of `rects`. */
|
|
52
|
+
export declare function mergeIntervals(rects: readonly {
|
|
53
|
+
first: number;
|
|
54
|
+
last: number;
|
|
55
|
+
}[]): [number, number][];
|
|
56
|
+
/** Sorted row runs of sorted distinct `rows`. */
|
|
57
|
+
export declare function runsOf(rows: readonly number[]): [number, number][];
|
|
58
|
+
/** Merged `intervals` with gaps of up to `gap` rows closed. */
|
|
59
|
+
export declare function coalesce(intervals: readonly [number, number][], gap: number): [number, number][];
|
|
60
|
+
/** Whether `row` lies in one of the merged `intervals`. */
|
|
61
|
+
export declare function inIntervals(intervals: readonly [number, number][], row: number): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* The rows of a live source: display rows, values as the cells draw them (errors reported as the render pass does); a
|
|
64
|
+
* client source's data nodes.
|
|
65
|
+
*/
|
|
66
|
+
export declare function liveRows(source: ViewportSource): TableRows;
|
|
67
|
+
/** A row's data: a client row object; a server row as a plain object of its fields; undefined otherwise. */
|
|
68
|
+
export declare function rowData(source: ViewportSource, row: number): unknown;
|
|
69
|
+
/**
|
|
70
|
+
* What an app callback sees of a row — row dragging's `draggable` and `canDrop`, master/detail's `master`,
|
|
71
|
+
* `openByDefault`, `height` and a detail's context —; `info` is a copy.
|
|
72
|
+
*/
|
|
73
|
+
export declare function rowContext(source: ViewportSource, row: number): RowDragContext;
|
|
74
|
+
/** The rows of server reads of display intervals: `parts` sorted by `first`, each read's row `i` is display row `first + i`. */
|
|
75
|
+
export declare function readByDisplay(parts: readonly {
|
|
76
|
+
first: number;
|
|
77
|
+
read: ReadRows;
|
|
78
|
+
}[]): TableRows;
|
|
79
|
+
/** The rows of one server read in its own order (`expandAll`: the open groups' levels after their rows). */
|
|
80
|
+
export declare function readByIndex(read: ReadRows): TableRows;
|
|
81
|
+
/**
|
|
82
|
+
* The rows of a client source's expanded order, by position: every row of a grouped or tree view as if
|
|
83
|
+
* every group were open; a row inside a closed group has display index −1. Values as the cells draw them, errors
|
|
84
|
+
* reported once as the render pass does (`liveRows`).
|
|
85
|
+
*/
|
|
86
|
+
export declare function expandedRows(x: ExpandedOrder, source: ViewportSource): TableRows;
|
|
87
|
+
/**
|
|
88
|
+
* The rows of server reads in their own order, one after another (`readTree`'s segments, a read of rows that bring
|
|
89
|
+
* their groups): walk row `r` is row `r − first` of the part whose rows start at `first` (`parts` sorted by `first`,
|
|
90
|
+
* each part's rows right after the previous one's).
|
|
91
|
+
*/
|
|
92
|
+
export declare function readsByIndex(parts: readonly {
|
|
93
|
+
first: number;
|
|
94
|
+
read: ReadRows;
|
|
95
|
+
}[]): TableRows;
|
|
96
|
+
/** Fields a server read needs for `cols` (the group column's grouped fields and label). */
|
|
97
|
+
export declare function fieldsOf(cols: readonly TableColumn[]): string[];
|
|
98
|
+
/** Rows of `intervals` the source has not loaded (client sources: none; server: from its block cache). */
|
|
99
|
+
export declare function unloadedIn(source: ViewportSource, intervals: readonly [number, number][], rows: number): number;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { TableHost } from './host';
|
|
2
|
+
import type { TableJob } from './job';
|
|
3
|
+
/** One slice of building between two frames. */
|
|
4
|
+
export declare const SLICE_MS = 40;
|
|
5
|
+
/** Cells (or rows a `keep` check leaves out) per slice step: slow formatters and hooks cannot overrun a slice. */
|
|
6
|
+
export declare const SLICE_CELLS = 512;
|
|
7
|
+
/** The time from a frame's start a frame-aware run may fill, ms (about a 60 Hz frame). */
|
|
8
|
+
export declare const FRAME_MS = 16;
|
|
9
|
+
/** The least a frame-aware run gets per frame, ms, however full the frame: a build always moves on. */
|
|
10
|
+
export declare const FRAME_FLOOR_MS = 2;
|
|
11
|
+
/**
|
|
12
|
+
* What `run` resolves with when its `pause` hook stopped the generator: the next `run` of it resumes it.
|
|
13
|
+
*/
|
|
14
|
+
export declare const PAUSED: unique symbol;
|
|
15
|
+
/** What a run's owner is asked between the steps of its generator. */
|
|
16
|
+
export interface SliceHooks {
|
|
17
|
+
/** Checked before every step: true cancels the job (it changed under the build). */
|
|
18
|
+
changed?(): boolean;
|
|
19
|
+
/** Checked after every step: true ends this run with `PAUSED` (an export's back-pressure). */
|
|
20
|
+
pause?(): boolean;
|
|
21
|
+
/** After each slice of this run that did not finish it — the frame's budget ran out or `pause` stopped it. */
|
|
22
|
+
slice?(): void;
|
|
23
|
+
/**
|
|
24
|
+
* This run's own budget per frame, ms, within the frame's `SLICE_MS` (find's index builds in 10 ms
|
|
25
|
+
* slices, so frames during a build stay short); default `SLICE_MS`.
|
|
26
|
+
*/
|
|
27
|
+
readonly budgetMs?: number;
|
|
28
|
+
/**
|
|
29
|
+
* The run takes only what the frame has left — each slice min(`budgetMs`, `FRAME_MS` from the frame's
|
|
30
|
+
* start), at least `FRAME_FLOOR_MS` — and runs after the grid's pass when one is due in the frame
|
|
31
|
+
* (`TableHost.afterPass`), so the pass's own time counts (find's index; copy and export keep `SLICE_MS`).
|
|
32
|
+
*/
|
|
33
|
+
readonly frameAware?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export interface Slicer {
|
|
36
|
+
/**
|
|
37
|
+
* `gen` driven in slices between frames until `pause` stops it: resolves with `PAUSED` then (the same generator
|
|
38
|
+
* resumes with the next `run`), else with its value. Rejects as the other overload.
|
|
39
|
+
*/
|
|
40
|
+
run<T>(gen: Generator<void, T>, job: TableJob, hooks: SliceHooks & {
|
|
41
|
+
pause(): boolean;
|
|
42
|
+
}): Promise<T | typeof PAUSED>;
|
|
43
|
+
/**
|
|
44
|
+
* `gen` driven in slices between frames; rejects with an `AbortError` when `job` is cancelled — also by `changed`
|
|
45
|
+
* (which cancels the job when it returns true), checked before every step.
|
|
46
|
+
*/
|
|
47
|
+
run<T>(gen: Generator<void, T>, job: TableJob, hooks?: SliceHooks): Promise<T>;
|
|
48
|
+
/** `gen` run to its end at once (the synchronous path). */
|
|
49
|
+
finish<T>(gen: Generator<void, T>): T;
|
|
50
|
+
/** Ends `job`'s running generators: their promises reject with an `AbortError`. */
|
|
51
|
+
cancel(job: TableJob): void;
|
|
52
|
+
destroy(): void;
|
|
53
|
+
}
|
|
54
|
+
export declare function createSlicer(host: TableHost): Slicer;
|