@toolbox-web/grid 3.9.1 → 3.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/all.js +1 -1
  2. package/all.js.map +1 -1
  3. package/custom-elements.json +2 -2
  4. package/index.js +1 -1
  5. package/index.js.map +1 -1
  6. package/lib/core/grid.d.ts +8 -4
  7. package/lib/core/plugin/base-plugin.d.ts +7 -0
  8. package/lib/core/types.d.ts +8 -3
  9. package/lib/features/clipboard.js.map +1 -1
  10. package/lib/features/column-virtualization.js.map +1 -1
  11. package/lib/features/context-menu.js.map +1 -1
  12. package/lib/features/editing.js.map +1 -1
  13. package/lib/features/export.js.map +1 -1
  14. package/lib/features/filtering.js.map +1 -1
  15. package/lib/features/grouping-columns.js.map +1 -1
  16. package/lib/features/grouping-rows.js.map +1 -1
  17. package/lib/features/master-detail.js.map +1 -1
  18. package/lib/features/multi-sort.js.map +1 -1
  19. package/lib/features/pinned-columns.js.map +1 -1
  20. package/lib/features/pinned-rows.js.map +1 -1
  21. package/lib/features/pivot.js.map +1 -1
  22. package/lib/features/print.js.map +1 -1
  23. package/lib/features/registry.js +1 -1
  24. package/lib/features/registry.js.map +1 -1
  25. package/lib/features/reorder-columns.js.map +1 -1
  26. package/lib/features/responsive.js.map +1 -1
  27. package/lib/features/row-drag-drop.js.map +1 -1
  28. package/lib/features/selection.js.map +1 -1
  29. package/lib/features/server-side.js.map +1 -1
  30. package/lib/features/shell.js.map +1 -1
  31. package/lib/features/sticky-rows.js.map +1 -1
  32. package/lib/features/tooltip.js.map +1 -1
  33. package/lib/features/tree.js.map +1 -1
  34. package/lib/features/undo-redo.js.map +1 -1
  35. package/lib/features/visibility.js.map +1 -1
  36. package/lib/plugins/clipboard/index.js.map +1 -1
  37. package/lib/plugins/column-virtualization/index.js.map +1 -1
  38. package/lib/plugins/context-menu/context-menu-plugin.d.ts +9 -4
  39. package/lib/plugins/context-menu/index.js +1 -1
  40. package/lib/plugins/context-menu/index.js.map +1 -1
  41. package/lib/plugins/context-menu/types.d.ts +8 -4
  42. package/lib/plugins/editing/editors.d.ts +15 -0
  43. package/lib/plugins/editing/index.js +1 -1
  44. package/lib/plugins/editing/index.js.map +1 -1
  45. package/lib/plugins/editing/internal/dirty-tracking-manager.d.ts +2 -1
  46. package/lib/plugins/editing/types.d.ts +5 -1
  47. package/lib/plugins/export/index.js +1 -1
  48. package/lib/plugins/export/index.js.map +1 -1
  49. package/lib/plugins/filtering/filter-model.d.ts +22 -2
  50. package/lib/plugins/filtering/filter-panel-default.d.ts +15 -1
  51. package/lib/plugins/filtering/filtering-plugin.d.ts +5 -2
  52. package/lib/plugins/filtering/index.d.ts +1 -1
  53. package/lib/plugins/filtering/index.js +1 -1
  54. package/lib/plugins/filtering/index.js.map +1 -1
  55. package/lib/plugins/filtering/types.d.ts +58 -3
  56. package/lib/plugins/grouping-columns/index.js.map +1 -1
  57. package/lib/plugins/grouping-rows/grouping-rows-plugin.d.ts +7 -14
  58. package/lib/plugins/grouping-rows/grouping-rows.d.ts +48 -0
  59. package/lib/plugins/grouping-rows/index.d.ts +1 -1
  60. package/lib/plugins/grouping-rows/index.js +1 -1
  61. package/lib/plugins/grouping-rows/index.js.map +1 -1
  62. package/lib/plugins/grouping-rows/types.d.ts +21 -0
  63. package/lib/plugins/hierarchy/index.js.map +1 -1
  64. package/lib/plugins/master-detail/index.d.ts +1 -1
  65. package/lib/plugins/master-detail/index.js +1 -1
  66. package/lib/plugins/master-detail/index.js.map +1 -1
  67. package/lib/plugins/master-detail/master-detail-plugin.d.ts +28 -6
  68. package/lib/plugins/master-detail/master-detail.d.ts +0 -8
  69. package/lib/plugins/master-detail/types.d.ts +25 -1
  70. package/lib/plugins/multi-sort/index.js +1 -1
  71. package/lib/plugins/multi-sort/index.js.map +1 -1
  72. package/lib/plugins/pinned-columns/index.js.map +1 -1
  73. package/lib/plugins/pinned-rows/index.js.map +1 -1
  74. package/lib/plugins/pivot/index.js +1 -1
  75. package/lib/plugins/pivot/index.js.map +1 -1
  76. package/lib/plugins/pivot/pivot-plugin.d.ts +2 -0
  77. package/lib/plugins/pivot/types.d.ts +2 -0
  78. package/lib/plugins/print/index.js.map +1 -1
  79. package/lib/plugins/reorder-columns/index.js.map +1 -1
  80. package/lib/plugins/responsive/index.js.map +1 -1
  81. package/lib/plugins/row-drag-drop/index.js.map +1 -1
  82. package/lib/plugins/selection/index.js +1 -1
  83. package/lib/plugins/selection/index.js.map +1 -1
  84. package/lib/plugins/selection/selection-plugin.d.ts +8 -1
  85. package/lib/plugins/server-side/datasource-types.d.ts +28 -0
  86. package/lib/plugins/server-side/datasource.d.ts +7 -0
  87. package/lib/plugins/server-side/index.js +1 -1
  88. package/lib/plugins/server-side/index.js.map +1 -1
  89. package/lib/plugins/server-side/server-side-plugin.d.ts +61 -8
  90. package/lib/plugins/server-side/types.d.ts +9 -1
  91. package/lib/plugins/shared/form-field-target.d.ts +10 -0
  92. package/lib/plugins/shared/format-value.d.ts +12 -0
  93. package/lib/plugins/shell/index.js.map +1 -1
  94. package/lib/plugins/sticky-rows/index.js.map +1 -1
  95. package/lib/plugins/tooltip/index.js.map +1 -1
  96. package/lib/plugins/tree/index.js +1 -1
  97. package/lib/plugins/tree/index.js.map +1 -1
  98. package/lib/plugins/tree/tree-plugin.d.ts +5 -11
  99. package/lib/plugins/tree/types.d.ts +22 -6
  100. package/lib/plugins/undo-redo/history.d.ts +2 -1
  101. package/lib/plugins/undo-redo/index.js +1 -1
  102. package/lib/plugins/undo-redo/index.js.map +1 -1
  103. package/lib/plugins/undo-redo/types.d.ts +13 -1
  104. package/lib/plugins/undo-redo/undo-redo-plugin.d.ts +15 -2
  105. package/lib/plugins/visibility/index.js.map +1 -1
  106. package/package.json +1 -1
  107. package/umd/grid.all.umd.js +1 -1
  108. package/umd/grid.all.umd.js.map +1 -1
  109. package/umd/grid.umd.js +1 -1
  110. package/umd/grid.umd.js.map +1 -1
  111. package/umd/plugins/clipboard.umd.js.map +1 -1
  112. package/umd/plugins/column-virtualization.umd.js.map +1 -1
  113. package/umd/plugins/context-menu.umd.js +1 -1
  114. package/umd/plugins/context-menu.umd.js.map +1 -1
  115. package/umd/plugins/editing.umd.js +1 -1
  116. package/umd/plugins/editing.umd.js.map +1 -1
  117. package/umd/plugins/export.umd.js +1 -1
  118. package/umd/plugins/export.umd.js.map +1 -1
  119. package/umd/plugins/filtering.umd.js +1 -1
  120. package/umd/plugins/filtering.umd.js.map +1 -1
  121. package/umd/plugins/grouping-columns.umd.js.map +1 -1
  122. package/umd/plugins/grouping-rows.umd.js +1 -1
  123. package/umd/plugins/grouping-rows.umd.js.map +1 -1
  124. package/umd/plugins/hierarchy.umd.js.map +1 -1
  125. package/umd/plugins/master-detail.umd.js +1 -1
  126. package/umd/plugins/master-detail.umd.js.map +1 -1
  127. package/umd/plugins/multi-sort.umd.js +1 -1
  128. package/umd/plugins/multi-sort.umd.js.map +1 -1
  129. package/umd/plugins/pinned-columns.umd.js.map +1 -1
  130. package/umd/plugins/pinned-rows.umd.js.map +1 -1
  131. package/umd/plugins/pivot.umd.js +1 -1
  132. package/umd/plugins/pivot.umd.js.map +1 -1
  133. package/umd/plugins/print.umd.js.map +1 -1
  134. package/umd/plugins/reorder-columns.umd.js.map +1 -1
  135. package/umd/plugins/responsive.umd.js.map +1 -1
  136. package/umd/plugins/row-drag-drop.umd.js.map +1 -1
  137. package/umd/plugins/selection.umd.js +1 -1
  138. package/umd/plugins/selection.umd.js.map +1 -1
  139. package/umd/plugins/server-side.umd.js +1 -1
  140. package/umd/plugins/server-side.umd.js.map +1 -1
  141. package/umd/plugins/shell.umd.js.map +1 -1
  142. package/umd/plugins/sticky-rows.umd.js.map +1 -1
  143. package/umd/plugins/tooltip.umd.js.map +1 -1
  144. package/umd/plugins/tree.umd.js +1 -1
  145. package/umd/plugins/tree.umd.js.map +1 -1
  146. package/umd/plugins/undo-redo.umd.js +1 -1
  147. package/umd/plugins/undo-redo.umd.js.map +1 -1
  148. package/umd/plugins/visibility.umd.js.map +1 -1
@@ -54,6 +54,7 @@ import { ServerSideConfig } from './types';
54
54
  * @since 0.1.1
55
55
  */
56
56
  export declare class ServerSidePlugin extends BaseGridPlugin<ServerSideConfig> {
57
+ #private;
57
58
  /**
58
59
  * Plugin manifest declaring capabilities, hooks, events, and queries.
59
60
  * @internal
@@ -75,7 +76,15 @@ export declare class ServerSidePlugin extends BaseGridPlugin<ServerSideConfig> {
75
76
  * can cancel the underlying network call.
76
77
  */
77
78
  private blockControllers;
78
- private lastRequestId;
79
+ /**
80
+ * In-flight `getChildRows` requests. Aborted only on `detach()` or when the
81
+ * requester's `FetchChildrenQuery.signal` fires — NOT on sort/filter/refresh:
82
+ * cancellation is requester-owned (Tree, GroupingRows, MasterDetail each
83
+ * abort their own stale loads). An abort broadcasts only `datasource:loading`
84
+ * `false`, which no requester treats as a release, so an unrequested abort
85
+ * would strand its loading state.
86
+ */
87
+ private childControllers;
79
88
  private scrollDebounceTimer?;
80
89
  /**
81
90
  * One-shot flag set when a block lands; consumed in `afterRender()` to re-check
@@ -90,11 +99,28 @@ export declare class ServerSidePlugin extends BaseGridPlugin<ServerSideConfig> {
90
99
  /** @internal */
91
100
  detach(): void;
92
101
  /**
93
- * Abort all in-flight block requests. Called when the plugin tears down,
94
- * the data source is replaced, the cache is purged, or the sort/filter
95
- * model changes (the previously loaded block coordinates no longer apply).
102
+ * Abort all in-flight block requests and release their loading slots. Called
103
+ * when the plugin tears down, the data source is replaced, the cache is purged,
104
+ * or the sort/filter model changes (the previously loaded block coordinates no
105
+ * longer apply).
96
106
  */
97
107
  private abortAllBlocks;
108
+ /**
109
+ * Release `blockNum`'s in-flight slot when its request settles — but only if
110
+ * `controller` still owns it. An aborted request settles a microtask after the
111
+ * abort, by which time a superseding request (refresh, sort/filter change) may
112
+ * have re-registered the same block; deleting that entry would orphan the new
113
+ * request from `abortAllBlocks()` and let stale rows land in the cache.
114
+ */
115
+ private releaseBlock;
116
+ /**
117
+ * Effective sort/filter ownership. The `data-src` URL source only slices a cached
118
+ * dataset and ignores `sortModel` / `filterModel`, so it is always `'local'` —
119
+ * otherwise a sort or filter would refetch the unchanged rows and nobody would
120
+ * apply it.
121
+ */
122
+ private get sortMode();
123
+ private get filterMode();
98
124
  /**
99
125
  * Build enrichment params by querying sort/filter models from loaded plugins.
100
126
  *
@@ -104,10 +130,29 @@ export declare class ServerSidePlugin extends BaseGridPlugin<ServerSideConfig> {
104
130
  */
105
131
  private getEnrichmentParams;
106
132
  /**
107
- * Translate visible viewport indices to node-space indices via structural plugins.
108
- * Falls back to 1:1 mapping (flat data) when no structural plugin responds.
109
- */
110
- private getViewportMapping;
133
+ * Blocks (ascending) the viewport — expanded by `threshold` rows both ways to
134
+ * prefetch — needs loaded. The viewport is translated through a structural
135
+ * plugin's `datasource:viewport-mapping` when one responds, else 1:1 (flat data).
136
+ *
137
+ * When the displayed rows are not `managedNodes` itself, a later stage may have
138
+ * dropped or reordered rows (local filter or sort), or a structural plugin
139
+ * renumbered the rows it kept (Tree counts the remaining roots from zero). Then a
140
+ * display index is no longer a node index, so the blocks of the placeholders on
141
+ * screen are added: their `__index` is their node index, and loaded rows need no fetch.
142
+ */
143
+ private getRequiredBlockNumbers;
144
+ /**
145
+ * `totalNodeCount`, or `Infinity` while it is unknown — `0` means "not yet loaded"
146
+ * (just after purgeCache, or before the first fetch resolves), and block 0 must
147
+ * still be fetchable then.
148
+ */
149
+ private get knownTotal();
150
+ /** Whether the displayed rows are not `managedNodes` itself, so display indices may not be node indices. */
151
+ private get displayDiffers();
152
+ /** A structural plugin's (Tree, GroupingRows) translation of the viewport to node space, if any. */
153
+ private queryViewportMapping;
154
+ /** Add the block of every placeholder displayed in `[displayStart, displayEnd)` (may be fractional). */
155
+ private addPlaceholderBlocks;
111
156
  /**
112
157
  * Handle sort or filter model changes.
113
158
  * Purge cache and refetch current viewport with new enrichment params.
@@ -125,6 +170,12 @@ export declare class ServerSidePlugin extends BaseGridPlugin<ServerSideConfig> {
125
170
  * Returns loaded rows + one extra block of placeholders to trigger next fetch.
126
171
  */
127
172
  private getInfiniteScrollEstimate;
173
+ /**
174
+ * Length `managedNodes` must have: the infinite-scroll estimate, else
175
+ * `totalNodeCount` (guarded against an invalid value from a malformed
176
+ * datasource response, e.g. `undefined`).
177
+ */
178
+ private getNodeCount;
128
179
  /**
129
180
  * Check current viewport and load any missing blocks.
130
181
  */
@@ -141,6 +192,8 @@ export declare class ServerSidePlugin extends BaseGridPlugin<ServerSideConfig> {
141
192
  handleQuery(query: PluginQuery): unknown;
142
193
  /**
143
194
  * Fetch child rows via the datasource and broadcast the result.
195
+ * `requesterSignal` (from `FetchChildrenQuery.signal`) aborts the request;
196
+ * an aborted request broadcasts only `datasource:loading` `false`.
144
197
  */
145
198
  private fetchChildren;
146
199
  /**
@@ -76,6 +76,8 @@ export interface ServerSideConfig {
76
76
  * How sort changes affect the cache.
77
77
  * - `'server'` (default): purge cache and refetch via `getRows({ sortModel })`.
78
78
  * Use when the backend supports the requested sort shape natively.
79
+ * MultiSortPlugin does not re-sort the returned rows locally — the data
80
+ * source's order (and its loading placeholders' block positions) is shown as-is.
79
81
  * - `'local'`: keep the loaded blocks; sort the loaded rows in-place via
80
82
  * the active sort plugin (MultiSort or core sort). `sortModel` is **not**
81
83
  * sent on subsequent block fetches. Loading placeholder rows
@@ -83,6 +85,7 @@ export interface ServerSideConfig {
83
85
  *
84
86
  * Use `'local'` when the server cannot sort by every column the user can sort
85
87
  * (e.g. APIs that only support a single sort field, or no sort at all).
88
+ * Ignored for the `data-src` URL source, which always sorts locally.
86
89
  *
87
90
  * @default 'server'
88
91
  */
@@ -90,9 +93,14 @@ export interface ServerSideConfig {
90
93
  /**
91
94
  * How filter changes affect the cache.
92
95
  * - `'server'` (default): purge cache and refetch via `getRows({ filterModel })`.
96
+ * FilteringPlugin does not re-filter the returned rows locally — the data
97
+ * source's result (and its loading placeholders) is shown as-is.
93
98
  * - `'local'`: keep the loaded blocks; filter only the rows currently in cache
94
99
  * via FilteringPlugin's normal pipeline. `filterModel` is **not** sent on
95
- * subsequent block fetches.
100
+ * subsequent block fetches. Loading placeholders (see `isLoadingPlaceholder()`)
101
+ * always pass the filter until their block loads.
102
+ *
103
+ * Ignored for the `data-src` URL source, which always filters locally.
96
104
  *
97
105
  * In `'local'` mode the user only filters the currently loaded subset —
98
106
  * scrolling further loads more blocks which then re-enter the local filter.
@@ -0,0 +1,10 @@
1
+ /**
2
+ * True when a keyboard event originates in a text-entry control — `<input>`, `<select>`,
3
+ * `<textarea>` or a contenteditable element. Plugin key handlers (e.g. Space to toggle a tree
4
+ * row) must defer to the control so the keystroke is typed rather than swallowed.
5
+ *
6
+ * Reads `composedPath()[0]` so controls inside an editor's open shadow root are recognised;
7
+ * `event.target` is retargeted to the shadow host by the time the grid sees the event.
8
+ * @internal
9
+ */
10
+ export declare function isFormFieldKeyTarget(event: Event): boolean;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Call a column `format` outside the core cell pipeline (filter-panel labels, Pivot aggregates).
3
+ *
4
+ * Some of these values have no source row — `valuesHandler` results and Pivot aggregates — so
5
+ * `row` is `undefined` there even though `format` is typed `(value, row: TRow)`. A formatter
6
+ * that reads the row then throws; this guard reports the error and lets the caller fall back
7
+ * to the raw value, mirroring the core cell pipeline (TBW062).
8
+ *
9
+ * @returns The formatted string (`''` for a nullish result), or `undefined` when `format` threw.
10
+ * @internal
11
+ */
12
+ export declare function tryFormat<TRow>(format: (value: unknown, row: TRow) => unknown, value: unknown, row: TRow | undefined, onError: (error: unknown) => void): string | undefined;