@olvnck/ingrid 0.0.0-stage → 0.15.20
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 +7 -0
- package/LICENSE +21 -0
- package/README.md +5533 -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,397 @@
|
|
|
1
|
+
import type { DisplayLayout, ResolvedColumn } from '../columns/layout';
|
|
2
|
+
import type { Locale } from '../i18n/texts';
|
|
3
|
+
import type { RowInfo, ViewportSource } from '../source';
|
|
4
|
+
import type { FindPart, GridOptions } from '../types';
|
|
5
|
+
import type { HeightView } from '../viewport/heightView';
|
|
6
|
+
import type { ColumnsLayout, RowRange } from '../viewport/range';
|
|
7
|
+
import type { DrawnStack } from '../viewport/stack';
|
|
8
|
+
import type { CellTitle } from './cells';
|
|
9
|
+
import type { FlashRegistry } from './flash';
|
|
10
|
+
export interface RowHandle {
|
|
11
|
+
readonly row: number;
|
|
12
|
+
readonly el: HTMLElement;
|
|
13
|
+
}
|
|
14
|
+
export interface FrameState {
|
|
15
|
+
render: RowRange;
|
|
16
|
+
/**
|
|
17
|
+
* Internal indices of the centre-lane columns inside the horizontal window, plus the autoHeight centre columns,
|
|
18
|
+
* which are never windowed.
|
|
19
|
+
*/
|
|
20
|
+
centerCols: readonly number[];
|
|
21
|
+
scrollTop: number;
|
|
22
|
+
modelTop: number;
|
|
23
|
+
rowCount: number;
|
|
24
|
+
/**
|
|
25
|
+
* Offset of the rows slab (`StrategyContext.rowsEl`) inside the rows region: a multiple of 4 px, so exact in the
|
|
26
|
+
* float32 that transforms are stored in. Row positions relative to it stay small and exact.
|
|
27
|
+
*/
|
|
28
|
+
slabTop: number;
|
|
29
|
+
/**
|
|
30
|
+
* The stack drawn over `render` — its sticking candidates and the sticking ancestors of its first
|
|
31
|
+
* row, which the strategy keeps bound outside the range —; null while the grid draws none (both options are off, or
|
|
32
|
+
* the source lacks `parentRow` / `groupEnd`). Both stacks — the top one with the top totals and the top
|
|
33
|
+
* grand total, the bottom one (`bottomByRow`) — and the kept total rows outside the range (`keptTotals`,
|
|
34
|
+
* `keptBottom`), which the strategy keeps bound too.
|
|
35
|
+
*/
|
|
36
|
+
stack: DrawnStack | null;
|
|
37
|
+
/** How far a span box may reach beyond the rendered rows: four rows-area heights. */
|
|
38
|
+
spanMargin: number;
|
|
39
|
+
/** The rows region's end in slab coordinates (`regionH − slabTop`): a span box's bottom never passes it. */
|
|
40
|
+
regionEnd: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* What a strategy draws of the focus, read once per render. The grid keeps one object and
|
|
44
|
+
* rewrites it; nothing in it is per row.
|
|
45
|
+
*/
|
|
46
|
+
export interface FocusDraw {
|
|
47
|
+
/** The logically focused row (`.ig-row-focus`); −1 = none. */
|
|
48
|
+
row: number;
|
|
49
|
+
/** The focused cell's column slot (`.ig-cell-focus`); −1 = none (`cellFocus: 'row'`, or no focused cell). */
|
|
50
|
+
slot: number;
|
|
51
|
+
/** `cellFocus: 'row'`: the focused row element takes DOM focus (`tabindex="-1"`). */
|
|
52
|
+
rowMode: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* The row kept bound while the grid holds DOM focus, also outside the render range, where it is parked beside the
|
|
55
|
+
* drawn rows; −1 = none.
|
|
56
|
+
*/
|
|
57
|
+
keep: number;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* A row's grips: `'on'` it can be dragged, `'off'` the grip shows disabled (`draggable`
|
|
61
|
+
* said no, a client group row or tree filler), `'none'` no grip (a row still loading or failed: its cells draw that).
|
|
62
|
+
*/
|
|
63
|
+
export type GripState = 'on' | 'off' | 'none';
|
|
64
|
+
/**
|
|
65
|
+
* The grips a strategy draws, read once per render. The handle column's cells (`kind: 'rowDrag'`) always
|
|
66
|
+
* hold one; with `cells` (the `'cells'` handle) the cells of `ColumnDef.rowDrag` columns too. `state` is read at a
|
|
67
|
+
* row's full or moved bind only, as `rowClass`; a new object (the options changed) is read again for every
|
|
68
|
+
* bound row.
|
|
69
|
+
*/
|
|
70
|
+
export interface RowGrips {
|
|
71
|
+
readonly cells: boolean;
|
|
72
|
+
state(row: number): GripState;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* A bound row's detail chevron: `'open'` / `'closed'` a master's, `'none'` no master (a
|
|
76
|
+
* non-master, a group row or tree filler, a row still loading or failed). Not the open state by key (`DetailState`).
|
|
77
|
+
*/
|
|
78
|
+
export type RowDetailState = 'open' | 'closed' | 'none';
|
|
79
|
+
/**
|
|
80
|
+
* The master rows a strategy draws, read once per render. The toggle column's cells (`kind: 'detail'`)
|
|
81
|
+
* always hold the chevron; with `cells` the cells of `ColumnDef.detailToggle` columns too (a non-master's keep its
|
|
82
|
+
* room). `state` is read at a row's full or moved bind, and for every bound row when `version` moved — one comparison
|
|
83
|
+
* per bound row otherwise. It reads the master answers the pass's height rounds cached; only a row they did not reach
|
|
84
|
+
* (the kept focused row outside the render range, a row a capped round left) is asked then.
|
|
85
|
+
*/
|
|
86
|
+
export interface RowDetails {
|
|
87
|
+
readonly version: number;
|
|
88
|
+
readonly cells: boolean;
|
|
89
|
+
state(row: number): RowDetailState;
|
|
90
|
+
}
|
|
91
|
+
/** The change flash, read once per render while a displayed column has `flashChanges`. */
|
|
92
|
+
export interface ChangeFlash {
|
|
93
|
+
/** Slots of the displayed columns with `flashChanges`: their cells keep the value and text of their last bind. */
|
|
94
|
+
readonly slots: ReadonlySet<number>;
|
|
95
|
+
/** A value pass came since the last pass (a built-in source's data change, a value write): compare this render. */
|
|
96
|
+
readonly pass: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Moves on every definition or locale change (`setColumns`, `setDefaultColumn`, `setLocale`, …; not a layout change
|
|
99
|
+
* such as a width or a fold): a render it moved for compares nothing, even on a value pass — it only re-keys.
|
|
100
|
+
*/
|
|
101
|
+
readonly definitions: number;
|
|
102
|
+
/** One registry entry for the changed cells (display row → column ids), at the theme's times read for this pass. */
|
|
103
|
+
flash(cells: ReadonlyMap<number, ReadonlySet<string>>): void;
|
|
104
|
+
}
|
|
105
|
+
export interface StrategyContext {
|
|
106
|
+
root: HTMLElement;
|
|
107
|
+
/** The element rows go into: the slab inside the rows region, positioned by the grid at `FrameState.slabTop`. */
|
|
108
|
+
rowsEl: HTMLElement;
|
|
109
|
+
/**
|
|
110
|
+
* The height view: `top` / `height` position a row with its open detail's room below its cells;
|
|
111
|
+
* `cellHeight` is what the row element draws. Without master/detail every call is the cell index's.
|
|
112
|
+
*/
|
|
113
|
+
heights: HeightView;
|
|
114
|
+
source(): ViewportSource;
|
|
115
|
+
/** `layout().columns`: every column ever defined, indexed by its stable slot. */
|
|
116
|
+
columns(): readonly ResolvedColumn[];
|
|
117
|
+
/** The current display layout; a new object whenever it was recomputed. */
|
|
118
|
+
layout(): DisplayLayout;
|
|
119
|
+
/** Registers an autoHeight wrapper of a (re)bound row for measurement. */
|
|
120
|
+
observeAutoHeight(wrap: HTMLElement, owner: RowHandle): void;
|
|
121
|
+
unobserveAutoHeight(wrap: HTMLElement): void;
|
|
122
|
+
/** Budgeted deferred work (frame scheduler). */
|
|
123
|
+
defer(task: () => void): void;
|
|
124
|
+
/**
|
|
125
|
+
* Rows have `aria-rowindex = row + ariaRowOffset()`, read once per render: the header rows come first,
|
|
126
|
+
* then the pinned top section, the body, the bottom section.
|
|
127
|
+
*/
|
|
128
|
+
ariaRowOffset(): number;
|
|
129
|
+
/** Grouping or tree mode is on: rows carry `--ig-level` and treegrid ARIA. */
|
|
130
|
+
hierarchical(): boolean;
|
|
131
|
+
/**
|
|
132
|
+
* `GridOptions.rowClass`, read when a row is bound; undefined = none. A section pool passes its side as the
|
|
133
|
+
* last argument (`pinned`); the body calls it with the row only.
|
|
134
|
+
*/
|
|
135
|
+
rowClass(): GridOptions['rowClass'];
|
|
136
|
+
/** The grid's current locale (texts and number format); a new object whenever `setLocale` is called. */
|
|
137
|
+
locale(): Locale;
|
|
138
|
+
/**
|
|
139
|
+
* `GridOptions.keepGroupValues` — an open group's row keeps its sums while its total row shows. Read
|
|
140
|
+
* once per render; absent: off. Optional: a strategy may ignore it.
|
|
141
|
+
*/
|
|
142
|
+
keepGroupValues?(): boolean;
|
|
143
|
+
/**
|
|
144
|
+
* The grand total sits at the top (`grandTotalRow` `'top'` or `'pinnedTop'`), so its border token faces
|
|
145
|
+
* down (`ig-row-grand-total-top`); else up. Asked when a grand total row is bound; absent: the bottom. Optional:
|
|
146
|
+
* a strategy may ignore it.
|
|
147
|
+
*/
|
|
148
|
+
grandTotalTop?(): boolean;
|
|
149
|
+
/**
|
|
150
|
+
* The grid shows total rows in the rows area (group totals asked, or a `'top'` / `'bottom'` grand
|
|
151
|
+
* total): with a source that has `parentRow` / `groupEnd` they sit in span boxes from bind on, as expandable rows do
|
|
152
|
+
* — also while `stickyTotalRows` is off, so the option moves no element. Read once per render; absent
|
|
153
|
+
* or false: no total row sits in a span (a leaf row's bind pays one comparison of the flag). Optional: a strategy
|
|
154
|
+
* may ignore it.
|
|
155
|
+
*/
|
|
156
|
+
totalSpans?(): boolean;
|
|
157
|
+
/**
|
|
158
|
+
* A drawn row's state bits (`ROW_SELECTED`, `ROW_PARTIAL`, `ROW_ARIA_SELECTED`, `ROW_BOX`,
|
|
159
|
+
* `ROW_BOX_DISABLED`, `ROW_DRAGGING`). A strategy reads them for a bound row only when the row was (re-)bound or
|
|
160
|
+
* `stateVersion()` moved, and keeps the last bits per row; `ROW_FOCUS` is not among them, the strategy adds it from
|
|
161
|
+
* `focusDraw()`. Absent while row selection is off and no row drag runs. Optional: a strategy may ignore
|
|
162
|
+
* them.
|
|
163
|
+
*/
|
|
164
|
+
rowBits?(row: number): number;
|
|
165
|
+
/**
|
|
166
|
+
* A drawn cell's state bits for the column in `slot` (`ResolvedColumn.index`): the range model's level, edges
|
|
167
|
+
* and `CELL_SELECTED` (`CELL_*` in `selection/ranges.ts`), plus `CELL_ARIA` and `CELL_ROW_RANGE`; not `CELL_FOCUS`,
|
|
168
|
+
* which the strategy adds from `focusDraw()`.
|
|
169
|
+
* Absent while cell selection is off, and then a strategy does no per-cell work. Read for a bound cell only when it
|
|
170
|
+
* was bound (to a row or a column) or `stateVersion()` moved, and kept per cell. Optional: a strategy may ignore
|
|
171
|
+
* it.
|
|
172
|
+
*/
|
|
173
|
+
cellBits?(row: number, slot: number): number;
|
|
174
|
+
/** Moves whenever a drawn row's or cell's state bits may have changed (selection, ranges, data). */
|
|
175
|
+
stateVersion?(): number;
|
|
176
|
+
/**
|
|
177
|
+
* The focus to draw, read once per render; absent while cell and header focus are both off, and then a
|
|
178
|
+
* strategy does no focus work at all. A focus move rewrites only the previous and the new focused row and cell:
|
|
179
|
+
* it moves no state version.
|
|
180
|
+
*/
|
|
181
|
+
focusDraw?(): FocusDraw | null;
|
|
182
|
+
/**
|
|
183
|
+
* The row of this pool an open edit is on, −1 none. Asked only on rare binds: a row
|
|
184
|
+
* whose kind flipped to one in a span is held out of it while the edit lasts, in every engine; a cell of that row
|
|
185
|
+
* changing lanes (a pin change) with the editor holding focus moves by `moveBefore` where the engine has it.
|
|
186
|
+
* Optional: absent, the pool does neither.
|
|
187
|
+
*/
|
|
188
|
+
editRow?(): number;
|
|
189
|
+
/**
|
|
190
|
+
* The row drag's drop mark on this grid, read once per render beside `focusDraw`; absent
|
|
191
|
+
* while no drag targets this grid. A mark move rewrites only the previous and the new target row: it moves no state
|
|
192
|
+
* version.
|
|
193
|
+
*/
|
|
194
|
+
dropMark?(): DropMark | null;
|
|
195
|
+
/**
|
|
196
|
+
* The grid's value write for a renderer (source 'renderer'): the data cell of `row` in
|
|
197
|
+
* column `column`. Absent while the source cannot write, and then cell contexts get no `setValue`. Read once per
|
|
198
|
+
* render, and again when a renderer writes. Optional: a strategy may ignore it.
|
|
199
|
+
*/
|
|
200
|
+
writeCell?(row: number, column: string, value: unknown): boolean;
|
|
201
|
+
/**
|
|
202
|
+
* Column slots whose cell contexts get no `setValue` although the source can write (a computed field
|
|
203
|
+
* without a column setter); null when none. Read once per render, while `writeCell` is present.
|
|
204
|
+
*/
|
|
205
|
+
unwritableSlots?(): ReadonlySet<number> | null;
|
|
206
|
+
/**
|
|
207
|
+
* The cell flash: read once per render; a bound cell's flash part is looked up when its row
|
|
208
|
+
* is (re-)bound or the cell joins it while a flash runs, and for every bound row when `version` moved. Optional:
|
|
209
|
+
* a strategy may ignore it.
|
|
210
|
+
*/
|
|
211
|
+
flash?: FlashRegistry;
|
|
212
|
+
/**
|
|
213
|
+
* The change flash, read once per render; absent while no displayed column has `flashChanges`,
|
|
214
|
+
* and then bind, place and scroll do no change-flash work beyond one comparison per bound row, a null check per cell
|
|
215
|
+
* bind and the two `keep` branches in `bindCellValue`. Optional: a strategy may ignore it.
|
|
216
|
+
*/
|
|
217
|
+
readonly changeFlash?: ChangeFlash;
|
|
218
|
+
/**
|
|
219
|
+
* `tooltips.browser`: the cells' `title`, read once per render; absent while browser tooltips are off or
|
|
220
|
+
* no column has a tooltip, and then a cell bind does no title work beyond two comparisons.
|
|
221
|
+
* Optional: a strategy may ignore it.
|
|
222
|
+
*/
|
|
223
|
+
readonly cellTitle?: CellTitle;
|
|
224
|
+
/**
|
|
225
|
+
* The row grips, read once per render; null while row dragging is off or grabs whole rows (`'row'`), and
|
|
226
|
+
* then a strategy does no grip work at all. Optional: a strategy may ignore it.
|
|
227
|
+
*/
|
|
228
|
+
grips?(): RowGrips | null;
|
|
229
|
+
/**
|
|
230
|
+
* The master rows: the chevrons, `.ig-detail-open` (`ROW_DETAIL_OPEN`) and the detail's `aria-expanded`.
|
|
231
|
+
* Read once per render; absent (or null) while master/detail is off, and then a strategy does no detail work at all.
|
|
232
|
+
* Optional: a strategy may ignore it.
|
|
233
|
+
*/
|
|
234
|
+
details?(): RowDetails | null;
|
|
235
|
+
/**
|
|
236
|
+
* A bound row's shown detail strip, null when none: `reorderDom` puts the row right before it and never
|
|
237
|
+
* moves it. Absent while master/detail is off. Optional: a strategy may ignore it.
|
|
238
|
+
*/
|
|
239
|
+
detailEl?(row: number): HTMLElement | null;
|
|
240
|
+
/**
|
|
241
|
+
* Find's marks in the drawn cells and renderers' `ctx.find`, read once per render;
|
|
242
|
+
* absent while no term is set or the source is no client source, and then a cell bind does no find work beyond
|
|
243
|
+
* a null check, and a bound row one comparison. Optional: a strategy may ignore it.
|
|
244
|
+
*/
|
|
245
|
+
readonly find?: FindDraw;
|
|
246
|
+
/**
|
|
247
|
+
* Section mode: this pool draws the pinned-row section on that side (`rowsEl` the section, `source()`
|
|
248
|
+
* its small section source, `heights` its own height index) and every row of it — frames with `stack: null`, no
|
|
249
|
+
* grips, details or row numbers, its rows `.ig-row-pinned`; the cells' callbacks get it as their `pinned`. Fixed for
|
|
250
|
+
* the pool's life (read once, at creation). Absent for the body, which then does nothing new.
|
|
251
|
+
*/
|
|
252
|
+
readonly section?: 'top' | 'bottom';
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* What a strategy needs to mark find's occurrences in its drawn cells: drawn cells test
|
|
256
|
+
* their own text with the term's matcher — the index's rules, so the marks equal the count — and ask only which
|
|
257
|
+
* occurrence is active, without building the index (drawing never waits for it). One per side: a pinned section's
|
|
258
|
+
* pool gets its section's draw, whose `row` is the row in that section.
|
|
259
|
+
*/
|
|
260
|
+
export interface FindDraw {
|
|
261
|
+
/**
|
|
262
|
+
* Moves on a term, option or active-match change: every bound row redraws its cells' marks and renderer parts from
|
|
263
|
+
* the text the cells show (the mark rebind: no `format` or function `cellClass`, and a renderer's `update`
|
|
264
|
+
* only where its parts changed). The strategy keeps the version each row was drawn at (one comparison per bound row).
|
|
265
|
+
*/
|
|
266
|
+
readonly version: number;
|
|
267
|
+
/**
|
|
268
|
+
* Moves with `version` on a term or option change only — the occurrences change; while it stays, a `version` move is
|
|
269
|
+
* an active-match change, and only the cells of the old and the new active match change.
|
|
270
|
+
*/
|
|
271
|
+
readonly matchVersion: number;
|
|
272
|
+
/**
|
|
273
|
+
* The term's occurrences to mark in a drawn cell's shown `text` (`formatCellText`'s, for `value` in display row
|
|
274
|
+
* `row`), flat `[start, end, …]` (UTF-16 offsets, `end` exclusive); null when it has none or the cell's searched text
|
|
275
|
+
* is not its drawn text (a `findText` string, `null`, a checkbox: its matches count, it shows no marks).
|
|
276
|
+
*/
|
|
277
|
+
marks(col: ResolvedColumn, value: unknown, text: string, row: number, info: RowInfo | null): readonly number[] | null;
|
|
278
|
+
/**
|
|
279
|
+
* A renderer cell's `ctx.find`: its searched text (`text`, or the column's `findText` string) split by
|
|
280
|
+
* the term, the active occurrence flagged; null when that text holds no occurrence or the cell is out of the search.
|
|
281
|
+
*/
|
|
282
|
+
parts(col: ResolvedColumn, value: unknown, text: string, row: number, info: RowInfo | null): FindPart[] | null;
|
|
283
|
+
/** The active occurrence in the cell of display row `row` and column `column`: its `numInMatch`, 0 = none. */
|
|
284
|
+
activeIn(row: number, column: string): number;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* The row state bits (`StrategyContext.rowBits`); the low byte indexes the row class table, which grows by
|
|
288
|
+
* `ROW_DRAGGING` and the drop mark.
|
|
289
|
+
*/
|
|
290
|
+
export declare const ROW_SELECTED = 32;
|
|
291
|
+
/** The logically focused row. */
|
|
292
|
+
export declare const ROW_FOCUS = 64;
|
|
293
|
+
/** A row with children whose descendants are partly selected: its box is indeterminate. */
|
|
294
|
+
export declare const ROW_PARTIAL = 128;
|
|
295
|
+
/** The state bits that are classes on the row element. */
|
|
296
|
+
export declare const ROW_STATE_CLASSES: number;
|
|
297
|
+
/** Row selection is on: the row carries `aria-selected`. */
|
|
298
|
+
export declare const ROW_ARIA_SELECTED = 256;
|
|
299
|
+
/** The row shows a checkbox: checked with `ROW_SELECTED`, indeterminate with `ROW_PARTIAL`. */
|
|
300
|
+
export declare const ROW_BOX = 512;
|
|
301
|
+
/** The row's checkbox is disabled (not selectable, or `checkboxes` said false). */
|
|
302
|
+
export declare const ROW_BOX_DISABLED = 1024;
|
|
303
|
+
/** A row of a running row drag: `.ig-row-dragging` in the source grid, for the drag's length. */
|
|
304
|
+
export declare const ROW_DRAGGING = 2048;
|
|
305
|
+
/**
|
|
306
|
+
* Bit 11 of the row pool's class table: an open master's row, `.ig-detail-open` (its chevron turned).
|
|
307
|
+
* A class-table bit, not one of the row state bits (`rowBits`), whose `ROW_DRAGGING` has the same value.
|
|
308
|
+
*/
|
|
309
|
+
export declare const ROW_DETAIL_OPEN: number;
|
|
310
|
+
/**
|
|
311
|
+
* The drop target a row drag marks: the row gets `.ig-row-drop-on` (a tint and a ring) or the insert
|
|
312
|
+
* line on its top (`above`) or bottom (`below`) edge. `refused`: the row under the pointer that does not
|
|
313
|
+
* take the drop as an `on` target, `.ig-row-drop-refused` (a tint that is transparent unless the app sets it).
|
|
314
|
+
*/
|
|
315
|
+
export interface DropMark {
|
|
316
|
+
row: number;
|
|
317
|
+
kind: 'on' | 'above' | 'below' | 'refused';
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* The cell state bits (`StrategyContext.cellBits`) above the nine that index the cell class table: a range
|
|
321
|
+
* column's cell while cell selection is on carries `aria-selected` (`true` with `CELL_SELECTED`).
|
|
322
|
+
*/
|
|
323
|
+
export declare const CELL_ARIA = 512;
|
|
324
|
+
/** The row-number cell of a row a range covers: `.ig-row-number-range`. */
|
|
325
|
+
export declare const CELL_ROW_RANGE = 1024;
|
|
326
|
+
/**
|
|
327
|
+
* The fill drag's preview: the edges of the cells a fill drag adds (or gives up), `.ig-fill-top` /
|
|
328
|
+
* `-right` / `-bottom` / `-left`. Set only while a fill drag runs, outside the nine bits of the cell class table.
|
|
329
|
+
*/
|
|
330
|
+
export declare const CELL_FILL_TOP: number;
|
|
331
|
+
export declare const CELL_FILL_RIGHT: number;
|
|
332
|
+
export declare const CELL_FILL_BOTTOM: number;
|
|
333
|
+
export declare const CELL_FILL_LEFT: number;
|
|
334
|
+
/** All four: one mask per cell whose bits changed. */
|
|
335
|
+
export declare const CELL_FILL: number;
|
|
336
|
+
/** The rendering seam: the recycling strategy lives in rowPool.ts. */
|
|
337
|
+
export interface RenderStrategy {
|
|
338
|
+
/**
|
|
339
|
+
* Renders a frame. Column changes arrive through the context only: a cell whose column's `version` differs from the
|
|
340
|
+
* one it was bound with is re-bound; a changed display index rewrites just its `aria-colindex`.
|
|
341
|
+
*/
|
|
342
|
+
render(frame: FrameState): void;
|
|
343
|
+
/** Rewrites only position and height of bound rows (after height changes). */
|
|
344
|
+
reposition(frame: FrameState): void;
|
|
345
|
+
/** Rows whose data changed: their cells are rewritten on the next render. */
|
|
346
|
+
invalidate(first: number, last: number): void;
|
|
347
|
+
/**
|
|
348
|
+
* Rows [at, at + removed) became `inserted` new rows: bound rows after them move to their new
|
|
349
|
+
* index and keep their content, except what derives from the row index (row numbers, renderers, `format`),
|
|
350
|
+
* which the next render re-binds; the removed ones are released. Optional: without it the grid invalidates from
|
|
351
|
+
* `at`.
|
|
352
|
+
*/
|
|
353
|
+
splice?(at: number, removed: number, inserted: number): void;
|
|
354
|
+
/** Row index of a bound row element, -1 if none (chevron clicks). */
|
|
355
|
+
rowOf?(rowEl: Element): number;
|
|
356
|
+
/**
|
|
357
|
+
* The view of `rowEl` now stands for `row` — taken out of the bound rows or the free ones (a
|
|
358
|
+
* splice may have released it), whoever sat at `row` released — and is bound again at the next render as the same
|
|
359
|
+
* row (its span rule), with no DOM move. Called just before a render, or once a batch of changes is applied, while an
|
|
360
|
+
* editor in it must keep focus. Optional: without it the editor's row is drawn by index.
|
|
361
|
+
*/
|
|
362
|
+
rekey?(rowEl: Element, row: number): void;
|
|
363
|
+
/** The element of a bound row, null if none (`cellFocus: 'row'` focuses it). */
|
|
364
|
+
rowElement?(row: number): HTMLElement | null;
|
|
365
|
+
/**
|
|
366
|
+
* The y (slab-relative) this strategy last wrote for a bound row — inside the render range its position, for the kept
|
|
367
|
+
* row its parking place —, null if unbound: the detail layer puts a master's detail right below its cells.
|
|
368
|
+
* A cached number, no DOM read. Optional: without it no detail is drawn.
|
|
369
|
+
*/
|
|
370
|
+
rowY?(row: number): number | null;
|
|
371
|
+
/**
|
|
372
|
+
* A bound row's outer node among the rows slab's children: its span box when it sits in one, else its
|
|
373
|
+
* element; null if unbound. The detail layer puts a master's strip after it. Optional: without it, `rowElement`.
|
|
374
|
+
*/
|
|
375
|
+
rowOuter?(row: number): HTMLElement | null;
|
|
376
|
+
/** The bound body cell of a row in a column slot, null if none (the focused cell's element). */
|
|
377
|
+
cellElement?(row: number, slot: number): HTMLElement | null;
|
|
378
|
+
/**
|
|
379
|
+
* The column slot a body cell element is bound to, −1 if none: exact also between a layout change and the next
|
|
380
|
+
* render, when `aria-colindex` still shows the previous display index.
|
|
381
|
+
*/
|
|
382
|
+
cellSlot?(cellEl: Element): number;
|
|
383
|
+
rows(): Iterable<RowHandle>;
|
|
384
|
+
/** Rendered body cell elements of a column slot (auto-size of renderer columns); optional for other strategies. */
|
|
385
|
+
cellElements?(slot: number): HTMLElement[];
|
|
386
|
+
reorderDom(): void;
|
|
387
|
+
trim(): void;
|
|
388
|
+
destroy(): void;
|
|
389
|
+
}
|
|
390
|
+
export type StrategyFactory = (ctx: StrategyContext) => RenderStrategy;
|
|
391
|
+
/**
|
|
392
|
+
* Row position relative to the rows slab, valid in native and stretched mode: the position inside the rows
|
|
393
|
+
* region minus the slab offset, so it stays small and float32-exact far down large grids.
|
|
394
|
+
*/
|
|
395
|
+
export declare function rowY(rowTop: number, frame: Pick<FrameState, 'scrollTop' | 'modelTop' | 'slabTop'>): number;
|
|
396
|
+
/** Bound column indices in display order: left lane, centre window, right lane. */
|
|
397
|
+
export declare function activeColumns(layout: ColumnsLayout, centerCols: readonly number[]): number[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Reports an error without throwing into the caller, so one failing task or cell cannot stop the engine. */
|
|
2
|
+
export declare function reportError(err: unknown): void;
|
|
3
|
+
/**
|
|
4
|
+
* Reports an error once per (owner, key). App callbacks (format, rowHeight, getValue, …) run for every rendered
|
|
5
|
+
* row in every frame: one that throws for a row would otherwise flood the error report while the row is in range.
|
|
6
|
+
*/
|
|
7
|
+
export declare function reportErrorOnce(owner: object, key: string, err: unknown): void;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { RowDragColumnSpec } from '../columns/model';
|
|
2
|
+
import type { InteractHost } from '../interact/host';
|
|
3
|
+
import type { GripState, RowGrips } from '../render/strategy';
|
|
4
|
+
import { type SourceChange } from '../source';
|
|
5
|
+
import type { ElementDropZone, GridDropZoneOptions, GridOptions, RowDropZone } from '../types';
|
|
6
|
+
import type { RowDragEvents } from './events';
|
|
7
|
+
import { type ResolvedRowDrag } from './options';
|
|
8
|
+
import { type DropSide } from './target';
|
|
9
|
+
/**
|
|
10
|
+
* One row-drag controller per grid, built by `grid.ts` on the first `rowDrag` that is not off, or the first
|
|
11
|
+
* `rowDropZone` / `addRowDropZone` call. It holds the gesture, the events, the grid's drop side and its
|
|
12
|
+
* zone list, the zones of other grids added to it and its own zones handed to others, the element zones
|
|
13
|
+
* and the keyboard twin.
|
|
14
|
+
*/
|
|
15
|
+
export interface RowDragController {
|
|
16
|
+
/** Takes a new `GridOptions.rowDrag`; resolves it against the columns and the source now. */
|
|
17
|
+
setOptions(option: GridOptions['rowDrag']): void;
|
|
18
|
+
/** The resolved options; null while row dragging is off. */
|
|
19
|
+
options(): ResolvedRowDrag | null;
|
|
20
|
+
/**
|
|
21
|
+
* The handle column the column model should hold: `{ width }` while the handle resolves to `'column'`, else null.
|
|
22
|
+
* Resolves again, as the columns (`ColumnDef.rowDrag`) or the source may have changed since `setOptions`.
|
|
23
|
+
*/
|
|
24
|
+
columnSpec(): RowDragColumnSpec | null;
|
|
25
|
+
/**
|
|
26
|
+
* A row's grip, read when the row is bound: `'none'` for a row still loading or failed, `'off'`
|
|
27
|
+
* for a group row (a client group row or tree filler) and where `draggable` says no — a throw is reported once and
|
|
28
|
+
* counts as no —, else `'on'`.
|
|
29
|
+
*/
|
|
30
|
+
gripState(row: number): GripState;
|
|
31
|
+
/**
|
|
32
|
+
* What the row pool draws (`StrategyContext.grips`): null while row dragging is off or grabs whole rows (`'row'`);
|
|
33
|
+
* a new object when the handle or `draggable` changed, so every bound row is read again.
|
|
34
|
+
*/
|
|
35
|
+
grips(): RowGrips | null;
|
|
36
|
+
/** This grid's drop side: its own rows' drops, other grids' through its zones. Built on first use. */
|
|
37
|
+
side(): DropSide;
|
|
38
|
+
/**
|
|
39
|
+
* A zone of this grid for other grids' drags: a new frozen `{ grid }` each call, registered with this
|
|
40
|
+
* grid's drop side (built now) and the options resolved (`positions` default `'between'`).
|
|
41
|
+
*/
|
|
42
|
+
rowDropZone(options?: GridDropZoneOptions): RowDropZone;
|
|
43
|
+
/**
|
|
44
|
+
* Where this grid's drags may drop besides its own rows: another grid's zone or an app element. A
|
|
45
|
+
* second zone of a grid already in the list, an element already in it (also a grid's root: one entry per root,
|
|
46
|
+
* either kind first), this grid's own zone or root and an object no `rowDropZone` made give one hint each and
|
|
47
|
+
* change nothing. Returns the remover (a no-op for a zone not added).
|
|
48
|
+
*/
|
|
49
|
+
addRowDropZone(zone: RowDropZone | ElementDropZone): () => void;
|
|
50
|
+
/**
|
|
51
|
+
* A change of the grid's source, after the grid applied it: a source swapped by `setRows` resolves the options again
|
|
52
|
+
* (a server source has no managed reorder) and brings its own "in array order" answer, which the lock follows from
|
|
53
|
+
* then on. A running press or drag follows its rows or ends, and the drop side's `canDrop`
|
|
54
|
+
* answers go.
|
|
55
|
+
*/
|
|
56
|
+
sourceChanged(change: SourceChange): void;
|
|
57
|
+
/**
|
|
58
|
+
* The grid's `settle` after a batch of source changes, before its focus 'data' change: focus follows a dropped row the
|
|
59
|
+
* app moved itself.
|
|
60
|
+
*/
|
|
61
|
+
settled(): void;
|
|
62
|
+
/** A `FocusChange` other than 'data' went out: a pending follow of a dropped row is dropped. */
|
|
63
|
+
focusMoved(): void;
|
|
64
|
+
/** Adds a row-drag event listener (the grid's `onRowDragStart` …); returns its remover. */
|
|
65
|
+
on: RowDragEvents['on'];
|
|
66
|
+
/**
|
|
67
|
+
* The keyboard twin: Alt+↑ (−1) / Alt+↓ (1) on the focused cell. True when the press counts (applied
|
|
68
|
+
* in the next frame); false — the key passes — at an edge, refused, or while the own rows take no gap drops.
|
|
69
|
+
*/
|
|
70
|
+
moveByKey(dir: -1 | 1): boolean;
|
|
71
|
+
/** A visible drag of this grid's rows runs (`TableHost.dragging`). */
|
|
72
|
+
dragging(): boolean;
|
|
73
|
+
destroy(): void;
|
|
74
|
+
}
|
|
75
|
+
/** What the options resolve against; read at each resolve (the columns and the source can change). */
|
|
76
|
+
export interface RowDragContext {
|
|
77
|
+
dragColumns: boolean;
|
|
78
|
+
server: boolean;
|
|
79
|
+
}
|
|
80
|
+
export declare function createRowDragController(host: InteractHost, context: () => RowDragContext, events: RowDragEvents): RowDragController;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { RowDragEnd, RowDragMove, RowDragStart, RowDrop } from '../types';
|
|
2
|
+
export interface RowDragEventMap {
|
|
3
|
+
start: RowDragStart;
|
|
4
|
+
move: RowDragMove;
|
|
5
|
+
end: RowDragEnd;
|
|
6
|
+
drop: RowDrop;
|
|
7
|
+
}
|
|
8
|
+
export interface RowDragEvents {
|
|
9
|
+
/** Adds a listener; returns its remover. */
|
|
10
|
+
on<K extends keyof RowDragEventMap>(kind: K, listener: (e: RowDragEventMap[K]) => void): () => void;
|
|
11
|
+
/** Queues `event` for the kind's listeners (through the grid's queue); each listener isolated. */
|
|
12
|
+
emit<K extends keyof RowDragEventMap>(kind: K, event: RowDragEventMap[K]): void;
|
|
13
|
+
/** The kind has a listener: without one the caller builds no event object. */
|
|
14
|
+
has(kind: keyof RowDragEventMap): boolean;
|
|
15
|
+
destroy(): void;
|
|
16
|
+
}
|
|
17
|
+
export declare function createRowDragEvents(queue: (run: () => void) => void): RowDragEvents;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { InteractHost } from '../interact/host';
|
|
2
|
+
import type { SourceChange } from '../source';
|
|
3
|
+
import type { RowDragEvents } from './events';
|
|
4
|
+
import type { ResolvedRowDrag } from './options';
|
|
5
|
+
import type { DropSide } from './target';
|
|
6
|
+
import { type SourceZone } from './zones';
|
|
7
|
+
/** What the gesture reads of its controller. */
|
|
8
|
+
export interface GestureContext {
|
|
9
|
+
options(): ResolvedRowDrag | null;
|
|
10
|
+
/** The row can be dragged (`gripState` 'on'): asked by a whole-row press; a live grip was asked when bound. */
|
|
11
|
+
draggable(row: number): boolean;
|
|
12
|
+
events: RowDragEvents;
|
|
13
|
+
/** The source's zone list by anchor, its own root first. */
|
|
14
|
+
zones(): ReadonlyMap<Element, SourceZone>;
|
|
15
|
+
/** The drop side a zone aims through (its own rows: this grid's); null for a zone without one. */
|
|
16
|
+
sideOf(zone: SourceZone): DropSide | null;
|
|
17
|
+
}
|
|
18
|
+
export interface RowGesture {
|
|
19
|
+
/** A visible drag of this grid's rows runs (past the threshold, not cancelled). */
|
|
20
|
+
dragging(): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* A press ends quietly; a visible drag is cancelled, and its release still makes no click (a structural change).
|
|
23
|
+
*/
|
|
24
|
+
cancel(): void;
|
|
25
|
+
/**
|
|
26
|
+
* The grid's source changed: a press follows its row or ends; a drag's rows follow theirs (splices remap them,
|
|
27
|
+
* rows that left the data leave the drag), and a reset, an emptied drag or a server row without an id cancels it.
|
|
28
|
+
*/
|
|
29
|
+
sourceChanged(change: SourceChange): void;
|
|
30
|
+
/** Stops a press or drag silently: no event, no announcement. */
|
|
31
|
+
destroy(): void;
|
|
32
|
+
}
|
|
33
|
+
export declare function createRowGesture(host: InteractHost, ctx: GestureContext): RowGesture;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { InteractHost } from '../interact/host';
|
|
2
|
+
import type { ResolvedRowDrag } from './options';
|
|
3
|
+
import type { DropSide, DropSideOptions } from './target';
|
|
4
|
+
/** What the twin reads of its controller. */
|
|
5
|
+
export interface KeyContext {
|
|
6
|
+
options(): ResolvedRowDrag | null;
|
|
7
|
+
/** What the grid's own rows take (none while `reorder` cannot apply). */
|
|
8
|
+
own: DropSideOptions;
|
|
9
|
+
/** The row can be dragged (`gripState` 'on': loaded, a data row, `draggable`). */
|
|
10
|
+
draggable(row: number): boolean;
|
|
11
|
+
/** The grid's drop side, which applies the move. */
|
|
12
|
+
side(): DropSide;
|
|
13
|
+
}
|
|
14
|
+
export interface KeyMover {
|
|
15
|
+
/** One press of Alt+↑ (−1) / Alt+↓ (1): true when it counts (the key is the grid's), false when the key passes. */
|
|
16
|
+
press(dir: -1 | 1): boolean;
|
|
17
|
+
/** A data change from elsewhere: the pending steps go (their rows' indexes may mean other rows now). */
|
|
18
|
+
sourceChanged(): void;
|
|
19
|
+
destroy(): void;
|
|
20
|
+
}
|
|
21
|
+
export declare function createKeyMover(host: InteractHost, ctx: KeyContext): KeyMover;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { RowDropPositions, RowDropTarget } from '../types';
|
|
2
|
+
import type { HeightView } from '../viewport/heightView';
|
|
3
|
+
/** `above` / `below` / `on` — the position of a drop target. */
|
|
4
|
+
export type DropPosition = RowDropTarget['position'];
|
|
5
|
+
/**
|
|
6
|
+
* The height view as aiming reads it (`HeightIndex` satisfies it): a row with its open detail, and
|
|
7
|
+
* `cellHeight` its cell part, whose halves and quarters aiming takes — absent where rows have none.
|
|
8
|
+
*/
|
|
9
|
+
export interface RowGeometry extends Pick<HeightView, 'rowCount' | 'top' | 'height' | 'rowAt'> {
|
|
10
|
+
cellHeight?(row: number): number;
|
|
11
|
+
}
|
|
12
|
+
/** Where the pointer is in a grid: the rows area at model y, or its header / status bar (y ignored). */
|
|
13
|
+
export interface AimPoint {
|
|
14
|
+
area: 'rows' | 'header' | 'status';
|
|
15
|
+
y: number;
|
|
16
|
+
/** The last frame's fully visible rows (`last < first`: none). */
|
|
17
|
+
visible: {
|
|
18
|
+
first: number;
|
|
19
|
+
last: number;
|
|
20
|
+
};
|
|
21
|
+
/** The row may be an `on` target: loaded, and no total row; else `on` it is refused before `canDrop`. */
|
|
22
|
+
loaded(row: number): boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Row −1 with position null: no row (target null). `allow`: the answer without `canDrop` — 'no' may be turned into
|
|
26
|
+
* a yes by `canDrop`, 'never' is refused before it (a row still loading, or a total row, as an `on` target).
|
|
27
|
+
*/
|
|
28
|
+
export interface Aim {
|
|
29
|
+
row: number;
|
|
30
|
+
position: DropPosition | null;
|
|
31
|
+
allow: 'yes' | 'no' | 'never';
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Halves for `between`; quarters with the middle half `on` for `both`; the whole row for `on`. An open master's halves
|
|
35
|
+
* and quarters are its cell part's; a point over its detail is `below` it, or `on` it for `on` (the detail belongs to
|
|
36
|
+
* its master).
|
|
37
|
+
*/
|
|
38
|
+
export declare function aimAt(p: AimPoint, g: RowGeometry, positions: RowDropPositions): Aim;
|
|
39
|
+
/** `row` is one of `rows` (ascending): a binary search, no set built per call. */
|
|
40
|
+
export declare function inSorted(rows: readonly number[], row: number): boolean;
|
|
41
|
+
/** The gap a drop lands in: above r → r; below r → r + 1; on / none → −1. */
|
|
42
|
+
export declare function gapOf(aim: Aim): number;
|
|
43
|
+
/**
|
|
44
|
+
* A target whose move would leave the display order as it is: `on` a dragged row, or a gap inside or at
|
|
45
|
+
* the two edges of a contiguous block. `dragged` ascending.
|
|
46
|
+
*/
|
|
47
|
+
export declare function isNoOp(dragged: readonly number[], aim: Aim): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* The array after moving `dragged` (ascending display indexes) into `gap` (0 … length; the gap counts rows before the
|
|
50
|
+
* move), the dragged rows keeping their order. One pass; the input is not touched.
|
|
51
|
+
*/
|
|
52
|
+
export declare function moveArray<T>(rows: readonly T[], dragged: readonly number[], gap: number): T[];
|
|
53
|
+
/**
|
|
54
|
+
* The index dragged row `row` gets when `dragged` (ascending, `row` among them) go into `gap`, as `moveArray` puts it:
|
|
55
|
+
* the gap less the dragged rows above it, plus the row's rank among the dragged rows.
|
|
56
|
+
*/
|
|
57
|
+
export declare function landingOf(dragged: readonly number[], gap: number, row: number): number;
|
|
58
|
+
/**
|
|
59
|
+
* Where `steps` presses of Alt+↑ (`dir` −1) / Alt+↓ (1) put the dragged rows: above the row `steps` above
|
|
60
|
+
* the topmost, or below the row `steps` below the bottom-most. Null at an edge.
|
|
61
|
+
*/
|
|
62
|
+
export declare function keyAim(dragged: readonly number[], dir: -1 | 1, steps: number, rowCount: number): Aim | null;
|
|
63
|
+
/**
|
|
64
|
+
* Display indexes after a splice at `at` (`removed` rows replaced by `inserted`): rows before it stay, rows after move,
|
|
65
|
+
* rows inside the removed range are gone. `rows` ascending; so is the result.
|
|
66
|
+
*/
|
|
67
|
+
export declare function remapRows(rows: readonly number[], at: number, removed: number, inserted: number): number[];
|