@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.
Files changed (220) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/LICENSE +21 -0
  3. package/README.md +5535 -2
  4. package/THIRD_PARTY_NOTICES.md +10 -0
  5. package/dist/engine/clipboard/copy.d.ts +40 -0
  6. package/dist/engine/clipboard/options.d.ts +16 -0
  7. package/dist/engine/clipboard/text.d.ts +32 -0
  8. package/dist/engine/columns/autosize.d.ts +43 -0
  9. package/dist/engine/columns/dataType.d.ts +30 -0
  10. package/dist/engine/columns/fold.d.ts +48 -0
  11. package/dist/engine/columns/layout.d.ts +150 -0
  12. package/dist/engine/columns/model.d.ts +369 -0
  13. package/dist/engine/columns/query.d.ts +16 -0
  14. package/dist/engine/columns/tooltips.d.ts +27 -0
  15. package/dist/engine/data/client/clientSource.d.ts +151 -0
  16. package/dist/engine/data/client/columnFilters.d.ts +106 -0
  17. package/dist/engine/data/client/descendants.d.ts +35 -0
  18. package/dist/engine/data/client/diff.d.ts +23 -0
  19. package/dist/engine/data/client/fields.d.ts +70 -0
  20. package/dist/engine/data/client/filter.d.ts +95 -0
  21. package/dist/engine/data/client/flatten.d.ts +141 -0
  22. package/dist/engine/data/client/groupSize.d.ts +14 -0
  23. package/dist/engine/data/client/hierarchy.d.ts +85 -0
  24. package/dist/engine/data/client/order.d.ts +32 -0
  25. package/dist/engine/data/client/pipeline.d.ts +277 -0
  26. package/dist/engine/data/client/remap.d.ts +33 -0
  27. package/dist/engine/data/client/trees.d.ts +41 -0
  28. package/dist/engine/data/client/types.d.ts +173 -0
  29. package/dist/engine/data/memory/generate.d.ts +36 -0
  30. package/dist/engine/data/memory/memoryDatasource.d.ts +46 -0
  31. package/dist/engine/data/rowKey.d.ts +15 -0
  32. package/dist/engine/data/server/contract.d.ts +64 -0
  33. package/dist/engine/data/server/expansion.d.ts +35 -0
  34. package/dist/engine/data/server/levelStore.d.ts +99 -0
  35. package/dist/engine/data/server/loader.d.ts +128 -0
  36. package/dist/engine/data/server/reader.d.ts +88 -0
  37. package/dist/engine/data/server/response.d.ts +31 -0
  38. package/dist/engine/data/server/serverSource.d.ts +130 -0
  39. package/dist/engine/data/shared/aggregate.d.ts +12 -0
  40. package/dist/engine/data/shared/columnFilter.d.ts +19 -0
  41. package/dist/engine/data/shared/compare.d.ts +12 -0
  42. package/dist/engine/data/shared/dateParts.d.ts +19 -0
  43. package/dist/engine/data/shared/distinct.d.ts +30 -0
  44. package/dist/engine/data/shared/filterRecord.d.ts +7 -0
  45. package/dist/engine/data/shared/keys.d.ts +17 -0
  46. package/dist/engine/data/shared/quickFilter.d.ts +17 -0
  47. package/dist/engine/data/shared/sourceUtils.d.ts +11 -0
  48. package/dist/engine/data/shared/splice.d.ts +9 -0
  49. package/dist/engine/detail/builds.d.ts +26 -0
  50. package/dist/engine/detail/content.d.ts +24 -0
  51. package/dist/engine/detail/controller.d.ts +176 -0
  52. package/dist/engine/detail/events.d.ts +11 -0
  53. package/dist/engine/detail/follow.d.ts +56 -0
  54. package/dist/engine/detail/layer.d.ts +119 -0
  55. package/dist/engine/detail/live.d.ts +96 -0
  56. package/dist/engine/detail/options.d.ts +53 -0
  57. package/dist/engine/detail/state.d.ts +140 -0
  58. package/dist/engine/edit/clear.d.ts +20 -0
  59. package/dist/engine/edit/editing.d.ts +4 -0
  60. package/dist/engine/edit/editors/date.d.ts +3 -0
  61. package/dist/engine/edit/editors/index.d.ts +23 -0
  62. package/dist/engine/edit/editors/internals.d.ts +25 -0
  63. package/dist/engine/edit/editors/largeText.d.ts +2 -0
  64. package/dist/engine/edit/editors/number.d.ts +4 -0
  65. package/dist/engine/edit/editors/select.d.ts +2 -0
  66. package/dist/engine/edit/editors/text.d.ts +15 -0
  67. package/dist/engine/edit/fill.d.ts +47 -0
  68. package/dist/engine/edit/fillHandle.d.ts +66 -0
  69. package/dist/engine/edit/fillValues.d.ts +15 -0
  70. package/dist/engine/edit/operations.d.ts +68 -0
  71. package/dist/engine/edit/paste.d.ts +23 -0
  72. package/dist/engine/edit/pastePlan.d.ts +17 -0
  73. package/dist/engine/edit/popupHost.d.ts +63 -0
  74. package/dist/engine/edit/session.d.ts +52 -0
  75. package/dist/engine/edit/types.d.ts +234 -0
  76. package/dist/engine/edit/undo.d.ts +38 -0
  77. package/dist/engine/edit/validation.d.ts +10 -0
  78. package/dist/engine/edit/values.d.ts +38 -0
  79. package/dist/engine/export/columns.d.ts +19 -0
  80. package/dist/engine/export/deliver.d.ts +47 -0
  81. package/dist/engine/export/dsv.d.ts +2 -0
  82. package/dist/engine/export/expanded.d.ts +69 -0
  83. package/dist/engine/export/export.d.ts +25 -0
  84. package/dist/engine/export/headers.d.ts +15 -0
  85. package/dist/engine/export/options.d.ts +19 -0
  86. package/dist/engine/export/plan.d.ts +43 -0
  87. package/dist/engine/export/values.d.ts +33 -0
  88. package/dist/engine/export/walk.d.ts +31 -0
  89. package/dist/engine/export/writer.d.ts +62 -0
  90. package/dist/engine/export/xlsx/cells.d.ts +31 -0
  91. package/dist/engine/export/xlsx/index.d.ts +12 -0
  92. package/dist/engine/export/xlsx/parts.d.ts +36 -0
  93. package/dist/engine/export/xlsx/sheet.d.ts +30 -0
  94. package/dist/engine/export/xlsx/styles.d.ts +15 -0
  95. package/dist/engine/export/xlsx/table.d.ts +8 -0
  96. package/dist/engine/export/xlsx/zip.d.ts +24 -0
  97. package/dist/engine/filter/groupFilter.d.ts +28 -0
  98. package/dist/engine/filter/model.d.ts +235 -0
  99. package/dist/engine/filter/shorthand.d.ts +36 -0
  100. package/dist/engine/filter/state.d.ts +76 -0
  101. package/dist/engine/filter/summary.d.ts +16 -0
  102. package/dist/engine/filter/values.d.ts +40 -0
  103. package/dist/engine/find/index.d.ts +94 -0
  104. package/dist/engine/find/match.d.ts +38 -0
  105. package/dist/engine/find/model.d.ts +115 -0
  106. package/dist/engine/grid.d.ts +42 -0
  107. package/dist/engine/i18n/numbers.d.ts +34 -0
  108. package/dist/engine/i18n/texts.d.ts +306 -0
  109. package/dist/engine/interact/autoScroll.d.ts +11 -0
  110. package/dist/engine/interact/body.d.ts +41 -0
  111. package/dist/engine/interact/focus.d.ts +158 -0
  112. package/dist/engine/interact/header.d.ts +216 -0
  113. package/dist/engine/interact/host.d.ts +400 -0
  114. package/dist/engine/interact/keyboard.d.ts +20 -0
  115. package/dist/engine/interact/menuKey.d.ts +7 -0
  116. package/dist/engine/interact/own.d.ts +2 -0
  117. package/dist/engine/interact/ranges.d.ts +68 -0
  118. package/dist/engine/interact/rowSelection.d.ts +53 -0
  119. package/dist/engine/interact/shortcut.d.ts +21 -0
  120. package/dist/engine/interact/tooltips.d.ts +63 -0
  121. package/dist/engine/measure.d.ts +30 -0
  122. package/dist/engine/render/cells.d.ts +322 -0
  123. package/dist/engine/render/columns.d.ts +28 -0
  124. package/dist/engine/render/dom.d.ts +24 -0
  125. package/dist/engine/render/flash.d.ts +74 -0
  126. package/dist/engine/render/groupCell.d.ts +50 -0
  127. package/dist/engine/render/groupPanel.d.ts +21 -0
  128. package/dist/engine/render/header.d.ts +162 -0
  129. package/dist/engine/render/overlay.d.ts +15 -0
  130. package/dist/engine/render/pinnedRows.d.ts +106 -0
  131. package/dist/engine/render/rowPool.d.ts +3 -0
  132. package/dist/engine/render/scrollbars.d.ts +77 -0
  133. package/dist/engine/render/strategy.d.ts +397 -0
  134. package/dist/engine/reportError.d.ts +7 -0
  135. package/dist/engine/rowdrag/controller.d.ts +80 -0
  136. package/dist/engine/rowdrag/events.d.ts +17 -0
  137. package/dist/engine/rowdrag/gesture.d.ts +33 -0
  138. package/dist/engine/rowdrag/keys.d.ts +21 -0
  139. package/dist/engine/rowdrag/model.d.ts +67 -0
  140. package/dist/engine/rowdrag/options.d.ts +34 -0
  141. package/dist/engine/rowdrag/rows.d.ts +61 -0
  142. package/dist/engine/rowdrag/target.d.ts +59 -0
  143. package/dist/engine/rowdrag/zones.d.ts +79 -0
  144. package/dist/engine/schedule.d.ts +29 -0
  145. package/dist/engine/selection/aggregate.d.ts +30 -0
  146. package/dist/engine/selection/options.d.ts +7 -0
  147. package/dist/engine/selection/rangeRows.d.ts +19 -0
  148. package/dist/engine/selection/ranges.d.ts +114 -0
  149. package/dist/engine/selection/rows.d.ts +207 -0
  150. package/dist/engine/source.d.ts +225 -0
  151. package/dist/engine/synthetic.d.ts +28 -0
  152. package/dist/engine/table/cells.d.ts +52 -0
  153. package/dist/engine/table/headers.d.ts +20 -0
  154. package/dist/engine/table/host.d.ts +65 -0
  155. package/dist/engine/table/job.d.ts +21 -0
  156. package/dist/engine/table/rows.d.ts +99 -0
  157. package/dist/engine/table/slicer.d.ts +54 -0
  158. package/dist/engine/table/takes.d.ts +145 -0
  159. package/dist/engine/types.d.ts +2950 -0
  160. package/dist/engine/ui/announce.d.ts +7 -0
  161. package/dist/engine/ui/chooser.d.ts +19 -0
  162. package/dist/engine/ui/columnList.d.ts +41 -0
  163. package/dist/engine/ui/columnMenu.d.ts +96 -0
  164. package/dist/engine/ui/columnsPanel.d.ts +16 -0
  165. package/dist/engine/ui/contextMenu.d.ts +48 -0
  166. package/dist/engine/ui/controller.d.ts +295 -0
  167. package/dist/engine/ui/filters/apply.d.ts +53 -0
  168. package/dist/engine/ui/filters/custom.d.ts +3 -0
  169. package/dist/engine/ui/filters/date.d.ts +12 -0
  170. package/dist/engine/ui/filters/host.d.ts +102 -0
  171. package/dist/engine/ui/filters/multi.d.ts +6 -0
  172. package/dist/engine/ui/filters/number.d.ts +15 -0
  173. package/dist/engine/ui/filters/numberMask.d.ts +15 -0
  174. package/dist/engine/ui/filters/set.d.ts +3 -0
  175. package/dist/engine/ui/filters/simple.d.ts +52 -0
  176. package/dist/engine/ui/filters/text.d.ts +5 -0
  177. package/dist/engine/ui/filtersPanel.d.ts +18 -0
  178. package/dist/engine/ui/floating.d.ts +66 -0
  179. package/dist/engine/ui/floatingShorthand.d.ts +20 -0
  180. package/dist/engine/ui/floatingTypes.d.ts +82 -0
  181. package/dist/engine/ui/icons.d.ts +25 -0
  182. package/dist/engine/ui/menu.d.ts +45 -0
  183. package/dist/engine/ui/overlayHost.d.ts +7 -0
  184. package/dist/engine/ui/place.d.ts +37 -0
  185. package/dist/engine/ui/popup.d.ts +97 -0
  186. package/dist/engine/ui/sideBar.d.ts +26 -0
  187. package/dist/engine/ui/statusBar.d.ts +29 -0
  188. package/dist/engine/ui/toolbar/buttons.d.ts +21 -0
  189. package/dist/engine/ui/toolbar/chipState.d.ts +52 -0
  190. package/dist/engine/ui/toolbar/chips.d.ts +23 -0
  191. package/dist/engine/ui/toolbar/findBox.d.ts +10 -0
  192. package/dist/engine/ui/toolbar/quickFilterBox.d.ts +12 -0
  193. package/dist/engine/ui/toolbar/registry.d.ts +5 -0
  194. package/dist/engine/ui/toolbar/toolbar.d.ts +31 -0
  195. package/dist/engine/ui/toolbar/types.d.ts +23 -0
  196. package/dist/engine/ui/tooltip.d.ts +34 -0
  197. package/dist/engine/ui/virtualList.d.ts +35 -0
  198. package/dist/engine/viewport/heightView.d.ts +62 -0
  199. package/dist/engine/viewport/heights.d.ts +39 -0
  200. package/dist/engine/viewport/intervals.d.ts +19 -0
  201. package/dist/engine/viewport/range.d.ts +51 -0
  202. package/dist/engine/viewport/scroll.d.ts +45 -0
  203. package/dist/engine/viewport/stack.d.ts +160 -0
  204. package/dist/grid-C34VEap6.js +32310 -0
  205. package/dist/index.d.ts +19 -0
  206. package/dist/index.js +1273 -0
  207. package/dist/ingrid.css +1 -0
  208. package/dist/internal.d.ts +13 -0
  209. package/dist/internal.js +1 -0
  210. package/dist/locale/de.d.ts +4 -0
  211. package/dist/locale/de.js +222 -0
  212. package/dist/themes/primevue.css +63 -0
  213. package/dist/themes/tailwind.css +68 -0
  214. package/dist/vue/InGrid.vue.d.ts +263 -0
  215. package/dist/vue/stableOptions.d.ts +8 -0
  216. package/dist/vue/useClientSource.d.ts +28 -0
  217. package/dist/vue/useServerSource.d.ts +8 -0
  218. package/dist/vue/vueRenderer.d.ts +164 -0
  219. package/dist/xlsx-59umS_n_.js +325 -0
  220. package/package.json +78 -5
@@ -0,0 +1,10 @@
1
+ # Third-party notices
2
+
3
+ InGrid contains no third-party source code verbatim.
4
+
5
+ | Component | Licence | Files | Copyright notice |
6
+ |---|---|---|---|
7
+ | — | — | — | — |
8
+
9
+ The runtime dependencies (`@vueuse/core`, `es-toolkit`, `fflate`) are not bundled into `dist`: they stay external in the
10
+ library build, and their licences travel with their npm packages.
@@ -0,0 +1,40 @@
1
+ import { type FocusModel } from '../interact/focus';
2
+ import type { CopyController, InteractHost } from '../interact/host';
3
+ import type { Slicer } from '../table/slicer';
4
+ /**
5
+ * The copy flash's hold: how long the copied cells keep `.ig-copied` — the stylesheet's fade is shorter;
6
+ * under reduced motion its tint holds this long (`ingrid.css`).
7
+ */
8
+ export declare const FLASH_MS = 600;
9
+ /**
10
+ * Switches the `beforecopy` listener of grids created after the call on or off, so a Safari check — does Cmd+C fire
11
+ * `copy` with and without it — needs no rebuild (the playground's `?beforecopy=off`). Grids already
12
+ * created keep theirs. Not public: exported from `internal.ts` only, not covered by semver.
13
+ *
14
+ * @internal
15
+ */
16
+ export declare function setBeforeCopyListener(on: boolean): void;
17
+ /** The copy plumbing as the grid drives it: the controller of the key map and the menus, plus the grid's own calls. */
18
+ export interface Copy extends CopyController {
19
+ /**
20
+ * A splice (`at`) or a reset (`at` 0) reached the grid: a text being built from the live rows in slices that reach
21
+ * row `at` is cancelled (the rows changed meanwhile). A server read follows its own rules. A cut's
22
+ * clear that has not run yet is dropped too.
23
+ */
24
+ moved(at: number): void;
25
+ /**
26
+ * `Grid.cut()` and the menu's Cut: what Mod+C would copy, copied; once its text is written, the
27
+ * cells it took go to `InteractHost.cutWritten`, which clears the editable ones (nothing on a grid that can't edit,
28
+ * or with `clipboard.cut: false`). False: nothing copied (off, nothing to copy, declined, failed).
29
+ */
30
+ cut(source: 'menu' | 'api'): Promise<boolean>;
31
+ /** A clipboard event belongs to this grid as a copy's does (`paste` too): the grid's own focus. */
32
+ owns(e: Event): boolean;
33
+ }
34
+ /**
35
+ * A non-collapsed native text selection inside `root`; with `target`, one that covers it — a right-click on
36
+ * selected text keeps the browser's menu. Read on demand, once per gesture: VueUse's useTextSelection would keep a
37
+ * selectionchange listener per grid alive.
38
+ */
39
+ export declare function nativeSelectionIn(root: Node, target?: Node): boolean;
40
+ export declare function createCopy(host: InteractHost, focus: FocusModel, slicer: Slicer): Copy;
@@ -0,0 +1,16 @@
1
+ import { type Shortcut } from '../interact/shortcut';
2
+ import type { ClipboardOptions } from '../types';
3
+ /** `ClipboardOptions.keys` parsed: each chord, null while unbound. */
4
+ export interface CopyKeys {
5
+ copyWithHeaders: Shortcut | null;
6
+ copyWithGroupHeaders: Shortcut | null;
7
+ }
8
+ /** The clipboard options with their defaults; the hooks stay optional. */
9
+ export interface ResolvedClipboard extends Required<Pick<ClipboardOptions, 'headers' | 'delimiter' | 'quote' | 'rows' | 'paste' | 'cut'>>, Pick<ClipboardOptions, 'value' | 'header' | 'confirm' | 'write' | 'read' | 'pasteCell' | 'pasteData'> {
10
+ keys: CopyKeys;
11
+ }
12
+ /**
13
+ * Copying is on by default: `true`, `undefined` and an object resolve; `false` turns it off (null). `warn` gets the one
14
+ * hint for a key that is no chord (`clipboard.keys`) or a chord the grid's own keys take first.
15
+ */
16
+ export declare function resolveClipboard(option: boolean | ClipboardOptions | null | undefined, warn?: (key: string, message: string) => void, editing?: boolean): ResolvedClipboard | null;
@@ -0,0 +1,32 @@
1
+ import { type TableColumn } from '../table/cells';
2
+ import type { TableHost } from '../table/host';
3
+ import type { TableRows } from '../table/rows';
4
+ import type { TableBlock } from '../table/takes';
5
+ import type { ResolvedClipboard } from './options';
6
+ export interface CopyTextOptions {
7
+ delimiter: string;
8
+ quote: boolean;
9
+ headers: boolean | 'groups';
10
+ layout: 'blocks' | 'grid';
11
+ }
12
+ /** Wraps a value containing the delimiter, `"`, `\r` or `\n` in quotes with inner quotes doubled. */
13
+ export declare function quoteCell(text: string, delimiter: string): string;
14
+ /**
15
+ * The cell texts of a copy over `rows`: the table's cell reader, then the `value` hook (told a pinned row's
16
+ * `pinned`) and the column's mode.
17
+ */
18
+ export declare function cellTexts(host: TableHost, opts: Pick<ResolvedClipboard, 'value'>, rows: TableRows): (row: number, c: TableColumn) => string;
19
+ /**
20
+ * Yields after every 512 cells — a row `keep` leaves out counts as one — and returns the text. `cell` gives a
21
+ * cell's final text. The lines built since the last yield are joined there and appended to the text, so no step joins
22
+ * every line (a final join would be one long task for a million rows). Group header lines tell groups
23
+ * apart by identity (`headerLevels`): a run's name sits in its first column.
24
+ */
25
+ export declare function buildCopyText(blocks: readonly TableBlock[], cell: (row: number, column: TableColumn) => string, options: CopyTextOptions): Generator<void, string>;
26
+ /**
27
+ * The inverse of `quoteCell`: clipboard text into rows of cells. Lines end in `\r\n`, `\n` or `\r`; **one**
28
+ * trailing line end is dropped (`'A\n\n'` is two rows, the second empty); `''` has no rows. With `quote` on, a cell
29
+ * that starts with `"` runs to the closing quote, `""` is one quote, and a line break inside stays in the cell; with it
30
+ * off the marks are plain text. Rows keep their own lengths.
31
+ */
32
+ export declare function parseClipboard(text: string, delimiter: string, quote: boolean): string[][];
@@ -0,0 +1,43 @@
1
+ import type { Locale } from '../i18n/texts';
2
+ import { type EmptyGroupRows } from '../render/cells';
3
+ import type { SectionSource } from '../render/pinnedRows';
4
+ import { type ViewportSource } from '../source';
5
+ import type { RowRange } from '../viewport/range';
6
+ import type { ResolvedColumn } from './layout';
7
+ export interface AutoSizeRequest {
8
+ columns: readonly ResolvedColumn[];
9
+ /** Rows considered: the rendered range. */
10
+ rows: RowRange;
11
+ source: ViewportSource;
12
+ header: boolean;
13
+ /** Where the probe cell goes (inside the grid, so it inherits the tokens; e.g. `.ig-probes`). */
14
+ probeParent: HTMLElement;
15
+ /** Carries `.ig-measuring` while natural widths are read. */
16
+ root: HTMLElement;
17
+ headerCell(id: string): HTMLElement | null;
18
+ /** Rendered body cells of a column slot; null when the strategy cannot tell. */
19
+ bodyCells(slot: number): HTMLElement[] | null;
20
+ locale: Locale;
21
+ /**
22
+ * A client source's group rows, which draw nothing in plain columns (`emptyGroupRows`), and its total rows'
23
+ * inputs; null otherwise.
24
+ */
25
+ emptyGroups: EmptyGroupRows | null;
26
+ /**
27
+ * The pinned sections with rows, measured beside the body's rendered range — every row
28
+ * of each (a section draws all its rows), its text in a pinned row's own font (bold by default, so often the
29
+ * widest text of a column); none without pinned rows. A pinned row draws no grid control: the parts before a
30
+ * body cell's content add nothing to a pinned cell's width, and a grid-owned column's pinned cells are empty.
31
+ */
32
+ pinned: readonly SectionSource[];
33
+ /** The drawn pinned cells of a column slot (a renderer column's are measured by their content). */
34
+ pinnedCells(slot: number): HTMLElement[];
35
+ }
36
+ /**
37
+ * Wanted widths per column id, before clamping. Text cells are measured with canvas `measureText` over the
38
+ * considered rows (works outside the horizontal window too), in the font of the row they are in (group rows have their
39
+ * own weight); renderer cells by their rendered content, and left out when none is rendered; the header (optionally)
40
+ * by its natural width. The group column measures what its cells show: the label of the row's `info` plus the
41
+ * indent of its level, the chevron and the count.
42
+ */
43
+ export declare function measureColumns(req: AutoSizeRequest): Map<string, number>;
@@ -0,0 +1,30 @@
1
+ import { type DataType } from '../edit/values';
2
+ import type { ViewportSource } from '../source';
3
+ import type { ColumnDef } from '../types';
4
+ /**
5
+ * The data type inference for booleans: the first value that is not `null` / `undefined` decides, a
6
+ * boolean makes a checkbox column. `undefined` while there is no such value (undecided).
7
+ */
8
+ export declare function inferBoolean(values: Iterable<unknown>): boolean | undefined;
9
+ /**
10
+ * Which data columns are checkbox columns. A column with a renderer (any origin) never is; `dataType:
11
+ * 'boolean'` makes it one on any source, `false` never; unset, a client source decides by the values of the column's
12
+ * field in source order, unless the field is computed. A `format` does not stop it. `undecided`: some inferable column
13
+ * found no value yet, so the caller infers again at the first data.
14
+ *
15
+ * `types`: the data type of each column that may be edited (`editable` set and not `false`), for its
16
+ * editor and parser — the given `dataType`, else a client source's inference from the same first value, widened
17
+ * (`inferDataType`: text for any other string; objects and an all-empty column stay out). Not inferred: computed fields,
18
+ * columns with `parse` or a `renderer`.
19
+ *
20
+ * Runs once per (source, column definitions) and once more at the first non-empty data, never per bind (hot path: the
21
+ * grid caches the result, `ResolvedColumn.checkbox` carries it to the cells).
22
+ */
23
+ export declare function checkboxColumns(leaves: readonly {
24
+ id: string;
25
+ def: ColumnDef;
26
+ }[], source: ViewportSource): {
27
+ ids: ReadonlySet<string>;
28
+ undecided: boolean;
29
+ types: ReadonlyMap<string, DataType>;
30
+ };
@@ -0,0 +1,48 @@
1
+ import type { Lane } from '../viewport/range';
2
+ import type { DisplayLayout, ResolvedColumn } from './layout';
3
+ import type { Leaf } from './model';
4
+ /**
5
+ * Column groups that fold. Over a group's direct children that are not hidden — a column, or
6
+ * a child group while any column under it is not hidden — the group can fold when one shows while open (`'open'` or
7
+ * unset), one shows while closed (`'closed'` or unset) and one carries `'open'` or `'closed'`. A group that cannot fold
8
+ * shows every child. A column is away (left out of the display, not hidden) when a group above it that can fold is in
9
+ * the state its child on that path does not show in. Returns the ids of the groups that can fold and of the columns
10
+ * away. `columnGroupShow` on an ungrouped column or a top-level group is ignored: no group decides about it.
11
+ */
12
+ export declare function foldColumns(leaves: readonly Leaf[], hidden: (id: string) => boolean, open: (groupId: string) => boolean): {
13
+ foldable: Set<string>;
14
+ away: Set<string>;
15
+ };
16
+ /**
17
+ * The lane whose run a column belongs to: a displayed column's lane, else the one its pin gives (the slot of
18
+ * a column that is not displayed says centre).
19
+ */
20
+ export declare function memberLane(col: ResolvedColumn): Lane;
21
+ /**
22
+ * A group's run: what a move or a drag-out of the group at `level` above `id` carries. Walking the full order
23
+ * both ways from `id`, it looks only at the columns of `id`'s lane (`memberLane`: a member pinned elsewhere stays in its
24
+ * lane, any column of another lane is passed over); among those it takes the members (hidden and folded-away ones too),
25
+ * passes over the columns that are not displayed (a hidden column does not split a segment) and stops at a displayed
26
+ * non-member. `[id]` when `id` has no group at `level`. Runs per segment on every header update (`movableSegments`):
27
+ * `id`'s place comes from `layout.orderOf`, never from a search of the order.
28
+ */
29
+ export declare function groupRun(layout: DisplayLayout, id: string, level: number): string[];
30
+ /**
31
+ * The run a leaf carries (a drag or a key move of a closed group's only shown column moves the whole group):
32
+ * outermost first, the run of the first closed group above `id` whose run shows no column but `id`; null without one.
33
+ */
34
+ export declare function loneRun(layout: DisplayLayout, id: string): string[] | null;
35
+ /**
36
+ * A drop's anchor widened past a closed group: nothing lands inside a closed group's run. Outermost first, the
37
+ * first closed group of the anchor's column whose run holds none of `moving` widens it — `before` to before the run's
38
+ * first member, `after` to after its last; otherwise (or for `null`) the anchor itself is returned.
39
+ */
40
+ export declare function widenAnchor(layout: DisplayLayout, anchor: {
41
+ before: string;
42
+ } | {
43
+ after: string;
44
+ } | null, moving: ReadonlySet<string>): {
45
+ before: string;
46
+ } | {
47
+ after: string;
48
+ } | null;
@@ -0,0 +1,150 @@
1
+ import type { ColumnDef, ColumnGroupInfo, ColumnInfo, PinnedSide, SortDirection } from '../types';
2
+ import type { ColumnSlot, ColumnsLayout, Lane } from '../viewport/range';
3
+ import { type ColumnKind, type ColumnModel, type GroupColumnSpec, type GroupRef, type RowNumberValue } from './model';
4
+ /** A column as the renderers see it. */
5
+ export interface ResolvedColumn {
6
+ id: string;
7
+ kind: ColumnKind;
8
+ def: ColumnDef;
9
+ /** Stable slot: names the `--ig-x-<index>` / `--ig-w-<index>` variables. */
10
+ index: number;
11
+ field: string;
12
+ /** Lane, lane-relative x, width and display index; meaningful only while `displayed`. */
13
+ slot: ColumnSlot;
14
+ displayed: boolean;
15
+ /**
16
+ * Moves when anything a bound cell depends on changes (definition, lane, hidden, being the centre column beside a
17
+ * pinned lane), never for widths, nor for order except where a move changes that boundary column.
18
+ */
19
+ version: number;
20
+ /**
21
+ * The first centre column after a non-empty left lane, the last one before a non-empty right lane: the
22
+ * lane's boundary line lies over its cells' edge on that side, so their ring and range edge move in (a class).
23
+ */
24
+ afterPinned: boolean;
25
+ beforePinned: boolean;
26
+ /**
27
+ * The left lane's last column: the lane's boundary line lies beside its own column line, so its cells and
28
+ * header elements draw no column line there (a class): the last left-pinned cell has one line.
29
+ */
30
+ lastPinned: boolean;
31
+ /** Resolved width in px (flex included; the clamped state width while hidden). */
32
+ width: number;
33
+ flex: number | null;
34
+ hidden: boolean;
35
+ pinned: PinnedSide | null;
36
+ sort: SortDirection | null;
37
+ sortIndex: number | null;
38
+ /** Position among the grouped columns (data columns only; `null` in tree mode, where grouping is ignored). */
39
+ rowGroup: number | null;
40
+ aggregate: string | null;
41
+ /** The user may group by it: a data column without `groupable: false`, outside tree mode. */
42
+ groupable: boolean;
43
+ /** The group column's spec. */
44
+ group?: GroupColumnSpec;
45
+ groups: GroupRef[];
46
+ /** A checkbox column (`checkboxColumns`): its cells draw a box for boolean values. Part of the cell key. */
47
+ checkbox: boolean;
48
+ /** Cell value of the row-number column. */
49
+ value?: RowNumberValue;
50
+ }
51
+ /** A group header cell or a filler in one header row. */
52
+ export interface Segment {
53
+ kind: 'group' | 'filler';
54
+ /** Header row, 0 = top. */
55
+ level: number;
56
+ lane: Lane;
57
+ /** Slots of the first and last leaf under the segment. */
58
+ first: number;
59
+ last: number;
60
+ count: number;
61
+ group: GroupRef | null;
62
+ /** Display index of the first leaf. */
63
+ displayIndex: number;
64
+ }
65
+ /** The column groups' fold state of one layout. */
66
+ export interface GroupFolds {
67
+ /** The groups that can fold now (a chevron shows). */
68
+ readonly foldable: ReadonlySet<string>;
69
+ /** The current groups stored open, also those that cannot fold. */
70
+ readonly open: ReadonlySet<string>;
71
+ }
72
+ /** No group folds and none is open: `toColumnInfo`'s default, for callers without a layout's folds. */
73
+ export declare const NO_FOLDS: GroupFolds;
74
+ /** The public description of a column group: the one builder, so every site reports `foldable` and `open`. */
75
+ export declare function groupInfo(folds: GroupFolds, g: GroupRef): ColumnGroupInfo;
76
+ export interface DisplayLayout extends ColumnsLayout {
77
+ /** By slot; ids no longer defined keep their last entry with `displayed: false`. */
78
+ columns: ResolvedColumn[];
79
+ /**
80
+ * Number of group header rows, counted over the columns that are not hidden before the fold: opening or
81
+ * closing a group never changes the header's height.
82
+ */
83
+ levels: number;
84
+ /** The column groups' fold state. */
85
+ folds: GroupFolds;
86
+ segments: Segment[];
87
+ displayedCount: number;
88
+ /** Slot of every defined id. */
89
+ slotOf: ReadonlyMap<string, number>;
90
+ /** Defined ids in full order. */
91
+ order: readonly string[];
92
+ /** Index in `order` of every defined id (a group's run starts there, `groupRun`). */
93
+ orderOf: ReadonlyMap<string, number>;
94
+ }
95
+ /** Stable slot per column id: allocated on first sight, never reused. */
96
+ export declare class SlotRegistry {
97
+ private readonly slots;
98
+ slot(id: string): number;
99
+ get size(): number;
100
+ }
101
+ /**
102
+ * The single width-clamping rule: `min` is `minWidth` (default 40) floored at 0, `max` the smaller of `maxWidth` and
103
+ * the optional `extraMax` cap (never below `min`). Layout, auto-size and resize all clamp through it.
104
+ */
105
+ export declare function widthBounds(def: Pick<ColumnDef, 'minWidth' | 'maxWidth'>, extraMax?: number): {
106
+ min: number;
107
+ max: number;
108
+ };
109
+ /** The displayed leaves under a header segment, in display order (its lane's `count` columns from `first`). */
110
+ export declare function segmentLeaves(layout: DisplayLayout, s: Segment): ResolvedColumn[];
111
+ /**
112
+ * A group resize's widths: `total` shared among `cols` in proportion to their widths at the start,
113
+ * each held within its `min`…`max`; a column that reaches a bound keeps it and the others share the rest (one scale for
114
+ * all, so a pass meets either upper or lower bounds). Whole px: the rounding remainder goes to the last free column.
115
+ */
116
+ export declare function distributeWidths(total: number, cols: readonly {
117
+ width: number;
118
+ min: number;
119
+ max: number;
120
+ }[]): number[];
121
+ /** Element-wise identity of primitives and functions (es-toolkit's isEqual compares deeply, not what is meant here). */
122
+ export declare function sameKey(a: readonly unknown[], b: readonly unknown[]): boolean;
123
+ /**
124
+ * Flex widths: shares of `free` proportional to flex, clamped to min/max iteratively (a clamped column's
125
+ * surplus goes to the others), whole pixels with the remainder on the last open column.
126
+ */
127
+ export declare function resolveFlex(items: readonly {
128
+ flex: number;
129
+ min: number;
130
+ max: number;
131
+ }[], free: number): number[];
132
+ /** Recomputes the display layout from the model; `previous` carries slots of removed ids and versions. */
133
+ export declare function computeLayout(model: ColumnModel, slots: SlotRegistry, viewportWidth: number, previous: DisplayLayout | null,
134
+ /** The ids of the checkbox columns (`checkboxColumns`); none by default. */
135
+ checkboxes?: ReadonlySet<string>): DisplayLayout;
136
+ /** Width (px) the centre keeps beside the pinned lanes: pinned lanes needing more of the viewport get unpinned. */
137
+ export declare const PIN_MARGIN = 50;
138
+ /**
139
+ * The pinned columns to unpin so the centre keeps PIN_MARGIN px of a viewport `viewportWidth` wide: only when the
140
+ * viewport is wider than the margin and the pinned lanes take more than its width less the
141
+ * margin. Columns leave the right and the left lane in turn, right first, each lane's innermost (next to the centre)
142
+ * first, until the lanes fit; grid-owned columns and those with `pinnable: false` stay. Empty when nothing has to go.
143
+ */
144
+ export declare function pinnedOverflow(layout: DisplayLayout, viewportWidth: number): string[];
145
+ /**
146
+ * The public description of a column: what menus, panels and app-built choosers need, so they read no
147
+ * definitions. `filterActive` comes from the grid's filter state (required, so no caller can forget it); `folds`
148
+ * from the layout the column is in (its groups' `foldable` and `open`).
149
+ */
150
+ export declare function toColumnInfo(col: ResolvedColumn, filterActive: boolean, grouped?: boolean, folds?: GroupFolds): ColumnInfo;