apex-grid 1.1.0 → 2.0.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 (206) hide show
  1. package/LICENSE +76 -5
  2. package/README.md +520 -10
  3. package/components/cell.d.ts +39 -0
  4. package/components/cell.js +334 -5
  5. package/components/cell.js.map +1 -1
  6. package/components/filter-row.d.ts +7 -5
  7. package/components/filter-row.js +151 -68
  8. package/components/filter-row.js.map +1 -1
  9. package/components/grid.d.ts +948 -1
  10. package/components/grid.js +403 -13
  11. package/components/grid.js.map +1 -1
  12. package/components/header-row.d.ts +21 -1
  13. package/components/header-row.js +140 -7
  14. package/components/header-row.js.map +1 -1
  15. package/components/header.d.ts +7 -0
  16. package/components/header.js +151 -25
  17. package/components/header.js.map +1 -1
  18. package/components/paginator.d.ts +56 -0
  19. package/components/paginator.js +148 -0
  20. package/components/paginator.js.map +1 -0
  21. package/components/row.d.ts +21 -2
  22. package/components/row.js +185 -10
  23. package/components/row.js.map +1 -1
  24. package/components/toolbar.d.ts +60 -0
  25. package/components/toolbar.js +275 -0
  26. package/components/toolbar.js.map +1 -0
  27. package/components/virtualizer.js +1 -1
  28. package/components/virtualizer.js.map +1 -1
  29. package/controllers/data-operation.d.ts +14 -0
  30. package/controllers/data-operation.js +19 -2
  31. package/controllers/data-operation.js.map +1 -1
  32. package/controllers/dom.d.ts +37 -1
  33. package/controllers/dom.js +176 -9
  34. package/controllers/dom.js.map +1 -1
  35. package/controllers/editing.d.ts +130 -0
  36. package/controllers/editing.js +197 -0
  37. package/controllers/editing.js.map +1 -0
  38. package/controllers/expansion.d.ts +68 -0
  39. package/controllers/expansion.js +126 -0
  40. package/controllers/expansion.js.map +1 -0
  41. package/controllers/navigation.d.ts +17 -6
  42. package/controllers/navigation.js +24 -8
  43. package/controllers/navigation.js.map +1 -1
  44. package/controllers/pagination.d.ts +102 -0
  45. package/controllers/pagination.js +106 -0
  46. package/controllers/pagination.js.map +1 -0
  47. package/controllers/reorder.d.ts +78 -0
  48. package/controllers/reorder.js +124 -0
  49. package/controllers/reorder.js.map +1 -0
  50. package/controllers/selection.d.ts +109 -0
  51. package/controllers/selection.js +168 -0
  52. package/controllers/selection.js.map +1 -0
  53. package/controllers/sort.js +28 -0
  54. package/controllers/sort.js.map +1 -1
  55. package/controllers/state.d.ts +32 -0
  56. package/controllers/state.js +37 -0
  57. package/controllers/state.js.map +1 -1
  58. package/controllers/tree.d.ts +87 -0
  59. package/controllers/tree.js +0 -0
  60. package/controllers/tree.js.map +1 -0
  61. package/custom-elements.json +6142 -992
  62. package/docs/assets/hierarchy.js +1 -1
  63. package/docs/assets/highlight.css +70 -14
  64. package/docs/assets/navigation.js +1 -1
  65. package/docs/assets/search.js +1 -1
  66. package/docs/classes/ApexGrid.html +316 -19
  67. package/docs/functions/setup.html +22 -0
  68. package/docs/hierarchy.html +1 -1
  69. package/docs/index.html +503 -9
  70. package/docs/interfaces/ApexCellValueChangedEvent.html +11 -0
  71. package/docs/interfaces/ApexCellValueChangingEvent.html +13 -0
  72. package/docs/interfaces/ApexColumnMovedEvent.html +8 -0
  73. package/docs/interfaces/ApexColumnMovingEvent.html +11 -0
  74. package/docs/interfaces/ApexColumnPinnedEvent.html +6 -0
  75. package/docs/interfaces/ApexColumnPinningEvent.html +8 -0
  76. package/docs/interfaces/ApexDetailContext.html +8 -0
  77. package/docs/interfaces/ApexFilteredEvent.html +1 -1
  78. package/docs/interfaces/ApexFilteringEvent.html +3 -3
  79. package/docs/interfaces/ApexGridEventMap.html +58 -7
  80. package/docs/interfaces/ApexHeaderContext.html +1 -1
  81. package/docs/interfaces/ApexPageChangedEvent.html +10 -0
  82. package/docs/interfaces/ApexPageChangingEvent.html +10 -0
  83. package/docs/interfaces/ApexQuickFilterChangedEvent.html +4 -0
  84. package/docs/interfaces/ApexQuickFilterChangingEvent.html +6 -0
  85. package/docs/interfaces/ApexRowEditEndedEvent.html +6 -0
  86. package/docs/interfaces/ApexRowEditStartedEvent.html +4 -0
  87. package/docs/interfaces/ApexRowExpandedEvent.html +8 -0
  88. package/docs/interfaces/ApexRowExpandingEvent.html +11 -0
  89. package/docs/interfaces/ApexRowSelectedEvent.html +8 -0
  90. package/docs/interfaces/ApexRowSelectingEvent.html +11 -0
  91. package/docs/interfaces/ApexTreeRowExpandedEvent.html +8 -0
  92. package/docs/interfaces/ApexTreeRowExpandingEvent.html +10 -0
  93. package/docs/interfaces/BaseApexCellContext.html +9 -3
  94. package/docs/interfaces/BaseApexEditorContext.html +19 -0
  95. package/docs/interfaces/BaseColumnConfiguration.html +65 -10
  96. package/docs/interfaces/BaseColumnSortConfiguration.html +1 -1
  97. package/docs/interfaces/BaseFilterExpression.html +1 -1
  98. package/docs/interfaces/BaseSortExpression.html +1 -1
  99. package/docs/interfaces/CSVExportOptions.html +22 -0
  100. package/docs/interfaces/ColumnFilterConfiguration.html +1 -1
  101. package/docs/interfaces/DataPipelineConfiguration.html +13 -4
  102. package/docs/interfaces/ExportOptions.html +15 -0
  103. package/docs/interfaces/GridEditingConfiguration.html +10 -0
  104. package/docs/interfaces/GridExpansionConfiguration.html +15 -0
  105. package/docs/interfaces/GridSelectionConfiguration.html +11 -0
  106. package/docs/interfaces/GridSortConfiguration.html +1 -1
  107. package/docs/interfaces/GridTreeConfiguration.html +33 -0
  108. package/docs/interfaces/PaginationConfiguration.html +18 -0
  109. package/docs/interfaces/PaginationState.html +10 -0
  110. package/docs/interfaces/XLSXExportOptions.html +17 -0
  111. package/docs/media/package.json +83 -0
  112. package/docs/media/publish.yml +111 -0
  113. package/docs/modules.html +1 -1
  114. package/docs/types/ApexCellContext.html +1 -1
  115. package/docs/types/ApexEditorContext.html +2 -0
  116. package/docs/types/BasePropertyType.html +1 -1
  117. package/docs/types/BaseSortComparer.html +1 -1
  118. package/docs/types/ColumnConfiguration.html +1 -1
  119. package/docs/types/ColumnDropPosition.html +2 -0
  120. package/docs/types/ColumnSortConfiguration.html +1 -1
  121. package/docs/types/DataPipelineHook.html +1 -1
  122. package/docs/types/DataPipelineParams.html +3 -3
  123. package/docs/types/DataType.html +30 -2
  124. package/docs/types/EditMode.html +6 -0
  125. package/docs/types/EditTrigger.html +4 -0
  126. package/docs/types/ExportCellValue.html +5 -0
  127. package/docs/types/ExportSource.html +8 -0
  128. package/docs/types/FilterCriteria.html +1 -1
  129. package/docs/types/FilterExpression.html +1 -1
  130. package/docs/types/Keys.html +1 -1
  131. package/docs/types/PaginationMode.html +6 -0
  132. package/docs/types/PinPosition.html +5 -0
  133. package/docs/types/PropertyType.html +1 -1
  134. package/docs/types/SelectionMode.html +7 -0
  135. package/docs/types/SortComparer.html +1 -1
  136. package/docs/types/SortExpression.html +1 -1
  137. package/docs/types/SortState.html +1 -1
  138. package/docs/types/SortingDirection.html +1 -1
  139. package/index.d.ts +5 -2
  140. package/index.js +1 -0
  141. package/index.js.map +1 -1
  142. package/internal/column-types.d.ts +94 -0
  143. package/internal/column-types.js +268 -0
  144. package/internal/column-types.js.map +1 -0
  145. package/internal/export.d.ts +106 -0
  146. package/internal/export.js +122 -0
  147. package/internal/export.js.map +1 -0
  148. package/internal/flip.d.ts +80 -0
  149. package/internal/flip.js +52 -0
  150. package/internal/flip.js.map +1 -0
  151. package/internal/icons.d.ts +24 -0
  152. package/internal/icons.js +134 -0
  153. package/internal/icons.js.map +1 -0
  154. package/internal/tags.d.ts +2 -0
  155. package/internal/tags.js +2 -0
  156. package/internal/tags.js.map +1 -1
  157. package/internal/theming.js +1 -1
  158. package/internal/theming.js.map +1 -1
  159. package/internal/types.d.ts +424 -3
  160. package/internal/types.js.map +1 -1
  161. package/internal/utils.d.ts +24 -1
  162. package/internal/utils.js +48 -7
  163. package/internal/utils.js.map +1 -1
  164. package/internal/xlsx.d.ts +22 -0
  165. package/internal/xlsx.js +228 -0
  166. package/internal/xlsx.js.map +1 -0
  167. package/operations/pagination.d.ts +19 -0
  168. package/operations/pagination.js +12 -0
  169. package/operations/pagination.js.map +1 -0
  170. package/operations/quick-filter.d.ts +21 -0
  171. package/operations/quick-filter.js +26 -0
  172. package/operations/quick-filter.js.map +1 -0
  173. package/package.json +6 -5
  174. package/setup.d.ts +58 -0
  175. package/setup.js +29 -0
  176. package/setup.js.map +1 -0
  177. package/styles/body-cell/body-cell.css.js +1 -1
  178. package/styles/body-cell/body-cell.css.js.map +1 -1
  179. package/styles/body-row/body-row.css.js +1 -1
  180. package/styles/body-row/body-row.css.js.map +1 -1
  181. package/styles/filter-row/filter-row.css.js +1 -1
  182. package/styles/filter-row/filter-row.css.js.map +1 -1
  183. package/styles/grid/_grid.base.css.js +1 -1
  184. package/styles/grid/_grid.base.css.js.map +1 -1
  185. package/styles/grid/themes/light/grid.bootstrap.css.js +1 -1
  186. package/styles/grid/themes/light/grid.bootstrap.css.js.map +1 -1
  187. package/styles/grid/themes/light/grid.fluent.css.js +1 -1
  188. package/styles/grid/themes/light/grid.fluent.css.js.map +1 -1
  189. package/styles/grid/themes/light/grid.indigo.css.js +1 -1
  190. package/styles/grid/themes/light/grid.indigo.css.js.map +1 -1
  191. package/styles/grid/themes/light/grid.material.css.js +1 -1
  192. package/styles/grid/themes/light/grid.material.css.js.map +1 -1
  193. package/styles/header-cell/header-cell.css.js +1 -1
  194. package/styles/header-cell/header-cell.css.js.map +1 -1
  195. package/styles/header-row/header-row.base.css.js +1 -1
  196. package/styles/header-row/header-row.base.css.js.map +1 -1
  197. package/styles/paginator/paginator.css.d.ts +1 -0
  198. package/styles/paginator/paginator.css.js +3 -0
  199. package/styles/paginator/paginator.css.js.map +1 -0
  200. package/styles/toolbar/toolbar.css.d.ts +1 -0
  201. package/styles/toolbar/toolbar.css.js +3 -0
  202. package/styles/toolbar/toolbar.css.js.map +1 -0
  203. package/styles.css +17 -0
  204. package/internal/icon-registry.d.ts +0 -1
  205. package/internal/icon-registry.js +0 -29
  206. package/internal/icon-registry.js.map +0 -1
@@ -18,8 +18,53 @@ export type BasePropertyType<T, K extends Keys<T> = Keys<T>> = T[K];
18
18
  * Helper type for resolving types of type T.
19
19
  */
20
20
  export type PropertyType<T, K extends Keys<T> = Keys<T>> = K extends Keys<T> ? BasePropertyType<T, K> : never;
21
- /** The data for the current column. */
22
- export type DataType = 'number' | 'string' | 'boolean';
21
+ /**
22
+ * The data type — or, for the declarative built-ins (`'select'`, `'rating'`,
23
+ * `'date'`, `'image'`), the presentation type — for the current column.
24
+ *
25
+ * @remarks
26
+ * - `'string'` / `'number'` are the primitive data types. They drive the
27
+ * default filter operands, the default editor, and the default sort
28
+ * comparison.
29
+ * - `'boolean'` stores `true` / `false`. In display mode the grid renders
30
+ * a check-mark icon for `true` and a dimmed mark for `false`. In edit
31
+ * mode the default editor is a native checkbox.
32
+ * - `'select'` is a presentation type for columns that store one of a fixed
33
+ * set of values. Supply the available options via
34
+ * {@link BaseColumnConfiguration.options}. The cell renders the matching
35
+ * option's label in display mode and a native `<select>` in edit mode.
36
+ * For sorting / filtering, select columns behave as their underlying
37
+ * value type (typically string).
38
+ * - `'rating'` renders a numeric value (0..`max`) as filled stars in display
39
+ * mode and as an interactive star picker in edit mode. Configure the star
40
+ * count via {@link BaseColumnConfiguration.max} (defaults to `5`).
41
+ * For sorting / filtering, rating columns behave as numbers.
42
+ * - `'date'` renders values as locale-aware formatted dates in display mode
43
+ * and a native `<input type="date">` in edit mode. Accepts `Date`
44
+ * instances, ISO strings, or millisecond timestamps as input and commits
45
+ * back in the same shape. Configure the display format via
46
+ * {@link BaseColumnConfiguration.format} (`'short' | 'medium' | 'long' |
47
+ * 'full'`, default `'medium'`).
48
+ * - `'image'` renders the value as an `<img>` source. Use
49
+ * {@link BaseColumnConfiguration.shape} to pick between `'square'`
50
+ * (default) and `'circle'`. The cell's default text editor is used for
51
+ * editing the URL string when `editable: true` is set.
52
+ */
53
+ export type DataType = 'number' | 'string' | 'boolean' | 'select' | 'rating' | 'date' | 'image';
54
+ /**
55
+ * Display format presets for `'date'` columns. Map to
56
+ * `Intl.DateTimeFormatOptions.dateStyle`.
57
+ */
58
+ export type ColumnDateFormat = 'short' | 'medium' | 'long' | 'full';
59
+ /**
60
+ * An entry in a `'select'` column's `options` list. Bare values use
61
+ * `String(value)` as their display label; the explicit form lets you give
62
+ * a value a separate display label.
63
+ */
64
+ export type ColumnSelectOption<V = unknown> = V | {
65
+ value: V;
66
+ label?: string;
67
+ };
23
68
  /**
24
69
  * Configures the sort behavior for the grid.
25
70
  */
@@ -59,6 +104,15 @@ export interface ColumnFilterConfiguration {
59
104
  */
60
105
  caseSensitive?: boolean;
61
106
  }
107
+ /**
108
+ * Pin position for a column.
109
+ *
110
+ * @remarks
111
+ * `'start'` pins the column to the leading edge of the grid (inline-start);
112
+ * `'end'` pins it to the trailing edge. `null` or `undefined` means the column
113
+ * is part of the scrollable region.
114
+ */
115
+ export type PinPosition = 'start' | 'end' | null;
62
116
  /** Configuration object for grid columns. */
63
117
  export interface BaseColumnConfiguration<T extends object, K extends Keys<T> = Keys<T>> {
64
118
  /**
@@ -95,6 +149,39 @@ export interface BaseColumnConfiguration<T extends object, K extends Keys<T> = K
95
149
  * Whether the column is hidden or not.
96
150
  */
97
151
  hidden?: boolean;
152
+ /**
153
+ * Whether this column is included when exporting via
154
+ * {@link ApexGrid.exportToCSV} or {@link ApexGrid.exportToXLSX}.
155
+ *
156
+ * @remarks
157
+ * Defaults to `true`. Set to `false` to omit a column from generated files
158
+ * (useful for action columns, derived UI, or sensitive fields). The
159
+ * grid-rendered selection checkbox column is never exported regardless of
160
+ * this flag.
161
+ */
162
+ exportable?: boolean;
163
+ /**
164
+ * Pin the column to a side of the grid.
165
+ *
166
+ * @remarks
167
+ * Pinned columns stay fixed during horizontal scroll. Use `'start'` (left in LTR,
168
+ * right in RTL) for the leading edge or `'end'` for the trailing edge. The grid
169
+ * renders columns in the order: `'start'`-pinned, unpinned, `'end'`-pinned, while
170
+ * preserving the original array order inside each group. The `columns` array
171
+ * itself is not mutated.
172
+ */
173
+ pinned?: PinPosition;
174
+ /**
175
+ * Whether this column can be reordered via drag-and-drop or the
176
+ * {@link ApexGrid.moveColumn} API.
177
+ *
178
+ * @remarks
179
+ * Has no effect unless the grid's `columnReordering` flag is `true`. When
180
+ * unset, columns inherit the grid-wide flag. Reordering is constrained to the
181
+ * column's own pinning group — start-pinned columns can only swap with other
182
+ * start-pinned columns, and likewise for end-pinned and unpinned.
183
+ */
184
+ reorderable?: boolean;
98
185
  /**
99
186
  * Whether the the column can be resized or not.
100
187
  */
@@ -115,6 +202,68 @@ export interface BaseColumnConfiguration<T extends object, K extends Keys<T> = K
115
202
  * Cell template callback.
116
203
  */
117
204
  cellTemplate?: (params: ApexCellContext<T, K>) => TemplateResult | unknown;
205
+ /**
206
+ * Whether values in this column can be edited inline.
207
+ *
208
+ * @remarks
209
+ * Has no effect unless the grid's `editing.enabled` is `true`. The default
210
+ * editor is chosen from the column's `type` (`'string'` → text input,
211
+ * `'number'` → number input, `'boolean'` → checkbox). Supply
212
+ * {@link BaseColumnConfiguration.editorTemplate} for full control.
213
+ */
214
+ editable?: boolean;
215
+ /**
216
+ * Custom editor template invoked while this column's cell is in edit mode.
217
+ *
218
+ * @remarks
219
+ * The callback receives an {@link ApexEditorContext} that includes the cell
220
+ * value plus `commit` / `cancel` helpers. Returning a focusable element is
221
+ * recommended so keyboard handoff works.
222
+ */
223
+ editorTemplate?: (params: ApexEditorContext<T, K>) => TemplateResult | unknown;
224
+ /**
225
+ * Option list for columns with `type: 'select'`.
226
+ *
227
+ * @remarks
228
+ * Each entry is either a bare value or an explicit `{ value, label }` pair.
229
+ * The cell renders the matching option's `label` in display mode and a
230
+ * native `<select>` of all options in edit mode. Has no effect on columns
231
+ * with another `type`.
232
+ */
233
+ options?: ColumnSelectOption<BasePropertyType<T, K>>[];
234
+ /**
235
+ * Star count for columns with `type: 'rating'`.
236
+ *
237
+ * @remarks
238
+ * The displayed value is clamped to the range `[0, max]`. Defaults to `5`.
239
+ * Has no effect on columns with another `type`.
240
+ */
241
+ max?: number;
242
+ /**
243
+ * Display format for columns with `type: 'date'`.
244
+ *
245
+ * @remarks
246
+ * Selects an `Intl.DateTimeFormatOptions.dateStyle` preset. Defaults to
247
+ * `'medium'`. Has no effect on columns with another `type`.
248
+ */
249
+ format?: ColumnDateFormat;
250
+ /**
251
+ * Cropping shape for columns with `type: 'image'`.
252
+ *
253
+ * @remarks
254
+ * `'square'` (default) renders the image at its native aspect. `'circle'`
255
+ * crops to a circle (useful for avatars). Has no effect on columns with
256
+ * another `type`.
257
+ */
258
+ shape?: 'square' | 'circle';
259
+ /**
260
+ * Alt text for `<img>` elements rendered by `type: 'image'` columns.
261
+ *
262
+ * @remarks
263
+ * Defaults to the column key. Has no effect on columns with another
264
+ * `type`.
265
+ */
266
+ alt?: string;
118
267
  }
119
268
  /**
120
269
  * See {@link BaseColumnConfiguration} for the full documentation.
@@ -157,11 +306,200 @@ export interface BaseApexCellContext<T extends object, K extends Keys<T> = Keys<
157
306
  * The value from the data source for this cell.
158
307
  */
159
308
  value: PropertyType<T, K>;
309
+ /**
310
+ * Commits a new value for this cell without entering edit mode. Available
311
+ * when the column is editable. Used by interactive display widgets
312
+ * (e.g. the built-in boolean checkbox) so they can toggle inline.
313
+ *
314
+ * Goes through the cancellable `cellValueChanging` event and follow-up
315
+ * `cellValueChanged` event — same write path as an edit-mode commit.
316
+ */
317
+ commit?: (value: PropertyType<T, K>) => Promise<boolean>;
160
318
  }
161
319
  /**
162
320
  * See {@link BaseApexCellContext} for the full documentation.
163
321
  */
164
322
  export type ApexCellContext<T extends object, K extends Keys<T> = Keys<T>> = K extends Keys<T> ? BaseApexCellContext<T, K> : never;
323
+ /**
324
+ * Context object handed to a custom editor template.
325
+ *
326
+ * @remarks
327
+ * Includes the cell's current `value` plus `commit` / `cancel` callbacks so
328
+ * the editor can hand its result back to the grid. The custom editor is also
329
+ * responsible for forwarding `Enter` / `Escape` to those callbacks.
330
+ */
331
+ export interface BaseApexEditorContext<T extends object, K extends Keys<T> = Keys<T>> extends BaseApexCellContext<T, K> {
332
+ /**
333
+ * Commits `value` as the new cell value, going through the cancellable
334
+ * `cellValueChanging` event and then `cellValueChanged`.
335
+ *
336
+ * @returns `true` if the value was applied, `false` if cancelled.
337
+ */
338
+ commit: (value: PropertyType<T, K>) => Promise<boolean>;
339
+ /**
340
+ * Discards the in-progress edit and exits edit mode.
341
+ */
342
+ cancel: () => void;
343
+ }
344
+ /**
345
+ * See {@link BaseApexEditorContext} for the full documentation.
346
+ */
347
+ export type ApexEditorContext<T extends object, K extends Keys<T> = Keys<T>> = K extends Keys<T> ? BaseApexEditorContext<T, K> : never;
348
+ /**
349
+ * The edit trigger used to enter cell edit mode.
350
+ *
351
+ * @remarks
352
+ * `'click'` enters edit on a single click on the cell; `'doubleClick'`
353
+ * requires a double click. Defaults to `'doubleClick'`.
354
+ */
355
+ export type EditTrigger = 'click' | 'doubleClick';
356
+ /**
357
+ * Edit mode for the grid.
358
+ *
359
+ * @remarks
360
+ * `'cell'` — each cell is committed independently on blur or `Enter`.
361
+ * `'row'` — all editable cells in the row enter edit mode together; changes
362
+ * are batched and applied via {@link ApexGrid.commitEdit} or rolled back via
363
+ * {@link ApexGrid.cancelEdit}.
364
+ */
365
+ export type EditMode = 'cell' | 'row';
366
+ /**
367
+ * Selection mode for the grid.
368
+ *
369
+ * @remarks
370
+ * `'single'` — at most one row may be selected at any time. New clicks
371
+ * replace the existing selection.
372
+ * `'multiple'` — multiple rows can be selected. Plain clicks replace the
373
+ * selection, Ctrl/Cmd+click toggles a row additively, and Shift+click
374
+ * selects a range from the previous anchor.
375
+ */
376
+ export type SelectionMode = 'single' | 'multiple';
377
+ /**
378
+ * Grid-level row-selection configuration.
379
+ */
380
+ export interface GridSelectionConfiguration {
381
+ /**
382
+ * Whether row selection is enabled. Disabled by default.
383
+ */
384
+ enabled?: boolean;
385
+ /**
386
+ * Single-row vs multi-row selection. Defaults to `'multiple'`.
387
+ */
388
+ mode?: SelectionMode;
389
+ /**
390
+ * Whether to render the built-in checkbox column at the start of every
391
+ * row. When `false`, selection is still available via the public API
392
+ * (`selectRow`, `selectedRows = ...`) and via Space on the active row.
393
+ * Defaults to `false`.
394
+ */
395
+ showCheckboxColumn?: boolean;
396
+ }
397
+ /**
398
+ * Context passed to {@link GridExpansionConfiguration.detailTemplate}.
399
+ */
400
+ export interface ApexDetailContext<T extends object> {
401
+ /** The row data for the expanded row. */
402
+ data: T;
403
+ /** The view-relative row index of the master row. */
404
+ rowIndex: number;
405
+ /** The grid element. Useful for emitting events back from the detail. */
406
+ parent: ApexGrid<T>;
407
+ }
408
+ /**
409
+ * Grid-level tree-data (nested rows) configuration.
410
+ *
411
+ * @remarks
412
+ * Tree mode renders hierarchical data as nested rows that share the same
413
+ * column layout — collapsible parents with indented children, AG Grid's
414
+ * "tree data" pattern. The data array stays flat; the grid derives the
415
+ * hierarchy from {@link getDataPath} at runtime.
416
+ *
417
+ * This is distinct from {@link GridExpansionConfiguration} (master-detail),
418
+ * which expands a row to show an arbitrary detail panel. Tree mode and
419
+ * expansion mode can be enabled together, but the chevron column is
420
+ * reserved by whichever is currently rendering the chevron — typically the
421
+ * tree feature when both are enabled.
422
+ *
423
+ * @example
424
+ * ```ts
425
+ * grid.tree = {
426
+ * enabled: true,
427
+ * getDataPath: (row) => row.path,
428
+ * };
429
+ * ```
430
+ */
431
+ export interface GridTreeConfiguration<T extends object> {
432
+ /** Whether tree mode is enabled. Disabled by default. */
433
+ enabled?: boolean;
434
+ /**
435
+ * Callback that returns the hierarchical path for a row. The path is a
436
+ * sequence of segments from root to the row's own position — for example
437
+ * `['Adrian']` for a CEO, `['Adrian', 'Bryan']` for a VP under Adrian,
438
+ * and so on. Required when `enabled` is `true`.
439
+ */
440
+ getDataPath: (row: T) => readonly string[];
441
+ /**
442
+ * Which column displays the chevron + indentation. Defaults to the first
443
+ * visible non-hidden data column.
444
+ */
445
+ groupColumnKey?: Keys<T>;
446
+ /**
447
+ * Initial expansion state:
448
+ * - `false` (default): all rows collapsed.
449
+ * - `true`: every row expanded.
450
+ * - `number`: expand all rows up to and including the given depth (0 = roots only).
451
+ */
452
+ defaultExpanded?: boolean | number;
453
+ /**
454
+ * Pixels of indentation per depth level. Defaults to `20`.
455
+ */
456
+ childIndent?: number;
457
+ }
458
+ /**
459
+ * Grid-level row-expansion (master-detail) configuration.
460
+ */
461
+ export interface GridExpansionConfiguration<T extends object> {
462
+ /**
463
+ * Whether row expansion is enabled. Disabled by default.
464
+ */
465
+ enabled?: boolean;
466
+ /**
467
+ * Callback that produces the detail panel content for an expanded row.
468
+ * Required when `enabled` is `true`.
469
+ */
470
+ detailTemplate?: (context: ApexDetailContext<T>) => TemplateResult | unknown;
471
+ /**
472
+ * Optional per-row predicate that gates which rows may be expanded. When
473
+ * omitted, every row is expandable.
474
+ */
475
+ isExpandable?: (row: T) => boolean;
476
+ /**
477
+ * Whether to render the built-in chevron toggle column at the start of
478
+ * every row (after the selection column, when present). Defaults to `true`.
479
+ * Set to `false` to drive expansion entirely through the public API or a
480
+ * custom cell template.
481
+ */
482
+ showToggleColumn?: boolean;
483
+ }
484
+ /**
485
+ * Grid-level editing configuration.
486
+ */
487
+ export interface GridEditingConfiguration {
488
+ /**
489
+ * Whether editing is enabled. Per-column opt-in still applies via
490
+ * {@link BaseColumnConfiguration.editable}.
491
+ */
492
+ enabled?: boolean;
493
+ /**
494
+ * Whether each cell commits independently or whether the whole row is edited
495
+ * as a batch. Defaults to `'cell'`.
496
+ */
497
+ mode?: EditMode;
498
+ /**
499
+ * The interaction that opens an editor. Defaults to `'doubleClick'`.
500
+ */
501
+ trigger?: EditTrigger;
502
+ }
165
503
  /**
166
504
  * The parameters passed to a {@link DataPipelineHook} callback.
167
505
  */
@@ -177,7 +515,7 @@ export type DataPipelineParams<T extends object> = {
177
515
  /**
178
516
  * The type of data operation being performed.
179
517
  */
180
- type: 'sort' | 'filter';
518
+ type: 'sort' | 'filter' | 'quickFilter' | 'pagination';
181
519
  };
182
520
  /**
183
521
  * Callback function for customizing data operations in the grid.
@@ -195,4 +533,87 @@ export interface DataPipelineConfiguration<T extends object> {
195
533
  * Hook for customizing filter operations.
196
534
  */
197
535
  filter?: DataPipelineHook<T>;
536
+ /**
537
+ * Hook for customizing pagination operations.
538
+ *
539
+ * @remarks
540
+ * The hook receives the filtered + sorted data slice for the grid to render and the current
541
+ * pagination state. Return the page slice. For server-driven pagination, return the externally
542
+ * fetched page and report the row total via {@link ApexGrid.totalItems}.
543
+ */
544
+ pagination?: DataPipelineHook<T>;
545
+ /**
546
+ * Hook for customizing quick (global) filter operations.
547
+ *
548
+ * @remarks
549
+ * Called before column filtering. Return the records that match the {@link ApexGrid.quickFilter}
550
+ * value. If omitted, the default substring matcher is used.
551
+ */
552
+ quickFilter?: DataPipelineHook<T>;
553
+ }
554
+ /**
555
+ * The pagination mode for the grid.
556
+ *
557
+ * @remarks
558
+ * `'local'` — the grid slices the in-memory {@link ApexGrid.dataView} by `page` and `pageSize`.
559
+ * `'remote'` — the consumer drives data fetching; the grid emits paging events but does not
560
+ * slice the data. Use together with {@link DataPipelineConfiguration.pagination} or by setting
561
+ * `data` to the current page on `pageChanged`.
562
+ */
563
+ export type PaginationMode = 'local' | 'remote';
564
+ /**
565
+ * Pagination configuration for the grid.
566
+ */
567
+ export interface PaginationConfiguration {
568
+ /**
569
+ * Whether pagination is enabled.
570
+ *
571
+ * @remarks
572
+ * When `false`, the grid renders no paginator and applies no slicing — the full
573
+ * {@link ApexGrid.dataView} is virtualized as usual.
574
+ */
575
+ enabled?: boolean;
576
+ /**
577
+ * The pagination mode. Defaults to `'local'`.
578
+ */
579
+ mode?: PaginationMode;
580
+ /**
581
+ * The current page (zero-based). Defaults to `0`.
582
+ */
583
+ page?: number;
584
+ /**
585
+ * The number of records per page. Defaults to `25`.
586
+ */
587
+ pageSize?: number;
588
+ /**
589
+ * The list of page sizes offered in the paginator's page-size dropdown.
590
+ * Defaults to `[10, 25, 50, 100]`.
591
+ */
592
+ pageSizeOptions?: number[];
593
+ /**
594
+ * In `'remote'` mode the consumer must supply the unfiltered row total so the paginator
595
+ * can compute the page count. Ignored in `'local'` mode.
596
+ */
597
+ totalItems?: number;
598
+ }
599
+ /**
600
+ * Resolved pagination state passed to controllers and event payloads.
601
+ */
602
+ export interface PaginationState {
603
+ /**
604
+ * The current page (zero-based).
605
+ */
606
+ page: number;
607
+ /**
608
+ * The number of records per page.
609
+ */
610
+ pageSize: number;
611
+ /**
612
+ * The total number of pages.
613
+ */
614
+ pageCount: number;
615
+ /**
616
+ * The total number of records before pagination (after filter/sort).
617
+ */
618
+ totalItems: number;
198
619
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/internal/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactiveControllerHost, TemplateResult } from 'lit';\nimport type ApexGridCell from '../components/cell.js';\nimport type { ApexGrid } from '../components/grid.js';\nimport type ApexGridHeader from '../components/header.js';\nimport type ApexGridRow from '../components/row.js';\nimport type { SortComparer } from '../operations/sort/types.js';\n\nexport type NavigationState = 'previous' | 'current';\nexport type GridHost<T extends object> = ReactiveControllerHost & ApexGrid<T>;\n\n/**\n * Helper type for resolving keys of type T.\n */\nexport type Keys<T> = keyof T;\n\n/**\n * Helper type for resolving types of type T.\n */\nexport type BasePropertyType<T, K extends Keys<T> = Keys<T>> = T[K];\n\n/**\n * Helper type for resolving types of type T.\n */\nexport type PropertyType<T, K extends Keys<T> = Keys<T>> = K extends Keys<T>\n ? BasePropertyType<T, K>\n : never;\n\n/** The data for the current column. */\nexport type DataType = 'number' | 'string' | 'boolean';\n\n/**\n * Configures the sort behavior for the grid.\n */\nexport interface GridSortConfiguration {\n /**\n * Whether multiple sorting is enabled.\n */\n multiple: boolean;\n /**\n * Whether tri-state sorting is enabled.\n */\n triState: boolean;\n}\n\n/**\n * Extended sort configuration for a column.\n */\nexport interface BaseColumnSortConfiguration<T, K extends Keys<T> = Keys<T>> {\n /**\n * Whether the sort operations will be case sensitive.\n */\n caseSensitive?: boolean;\n /**\n * Custom comparer function for sort operations for this column.\n */\n comparer?: SortComparer<T, K>;\n}\n\n/**\n * See {@link BaseColumnSortConfiguration} for the full documentation.\n */\nexport type ColumnSortConfiguration<T, K extends Keys<T> = Keys<T>> = K extends Keys<T>\n ? BaseColumnSortConfiguration<T, K>\n : never;\n\n/**\n * Extended filter configuration for a column.\n */\nexport interface ColumnFilterConfiguration {\n /**\n * Whether the filter operations will be case sensitive.\n */\n caseSensitive?: boolean;\n}\n\n/** Configuration object for grid columns. */\nexport interface BaseColumnConfiguration<T extends object, K extends Keys<T> = Keys<T>> {\n /**\n * The field for from the data the this column will reference.\n */\n key: K;\n /**\n * The type of data this column will reference.\n *\n * Affects the default filter operands if the column is with filtering enabled.\n *\n * @remarks\n * If not passed, `string` is assumed to be the default type.\n *\n */\n type?: DataType;\n /**\n * Optional text to display in the column header. By default, the column key is used\n * to render the header text.\n */\n headerText?: string;\n /**\n * Width for the current column.\n *\n * Accepts most CSS units for controlling width.\n *\n * @remarks\n * If not passed, the column will try to size itself based on the number of other\n * columns and the total width of the grid.\n *\n */\n width?: string;\n /**\n * Whether the column is hidden or not.\n */\n hidden?: boolean;\n /**\n * Whether the the column can be resized or not.\n */\n resizable?: boolean;\n /**\n * Whether the column can be sorted or not.\n */\n sort?: ColumnSortConfiguration<T, K> | boolean;\n /**\n * Whether filter operation can be applied on the column or not.\n */\n filter?: ColumnFilterConfiguration | boolean;\n /**\n * Header template callback.\n */\n headerTemplate?: (params: ApexHeaderContext<T>) => TemplateResult | unknown;\n /**\n * Cell template callback.\n */\n cellTemplate?: (params: ApexCellContext<T, K>) => TemplateResult | unknown;\n}\n\n/**\n * See {@link BaseColumnConfiguration} for the full documentation.\n */\nexport type ColumnConfiguration<T extends object, K extends Keys<T> = Keys<T>> = K extends Keys<T>\n ? BaseColumnConfiguration<T, K>\n : never;\n\nexport interface ActiveNode<T> {\n column: Keys<T>;\n row: number;\n}\n\n/**\n * Context object for the column header template callback.\n */\nexport interface ApexHeaderContext<T extends object> {\n /**\n * The header element parent of the template.\n */\n parent: ApexGridHeader<T>;\n /**\n * The current configuration for the column.\n */\n column: ColumnConfiguration<T>;\n}\n\n/**\n * Context object for the row cell template callback.\n */\nexport interface BaseApexCellContext<T extends object, K extends Keys<T> = Keys<T>> {\n /**\n * The cell element parent of the template.\n */\n parent: ApexGridCell<T>;\n /**\n * The row element containing the cell.\n */\n row: ApexGridRow<T>;\n /**\n * The current configuration for the column.\n */\n column: ColumnConfiguration<T, K>;\n /**\n * The value from the data source for this cell.\n */\n value: PropertyType<T, K>;\n}\n\n/**\n * See {@link BaseApexCellContext} for the full documentation.\n */\nexport type ApexCellContext<T extends object, K extends Keys<T> = Keys<T>> = K extends Keys<T>\n ? BaseApexCellContext<T, K>\n : never;\n\n/**\n * The parameters passed to a {@link DataPipelineHook} callback.\n */\nexport type DataPipelineParams<T extends object> = {\n /**\n * The current data state of the grid.\n */\n data: T[];\n /**\n * The grid component itself.\n */\n grid: ApexGrid<T>;\n /**\n * The type of data operation being performed.\n */\n type: 'sort' | 'filter';\n};\n\n/**\n * Callback function for customizing data operations in the grid.\n */\nexport type DataPipelineHook<T extends object> = (\n state: DataPipelineParams<T>\n) => T[] | Promise<T[]>;\n\n/**\n * Configuration for customizing the various data operations of the grid.\n */\nexport interface DataPipelineConfiguration<T extends object> {\n /**\n * Hook for customizing sort operations.\n */\n sort?: DataPipelineHook<T>;\n /**\n * Hook for customizing filter operations.\n */\n filter?: DataPipelineHook<T>;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/internal/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactiveControllerHost, TemplateResult } from 'lit';\nimport type ApexGridCell from '../components/cell.js';\nimport type { ApexGrid } from '../components/grid.js';\nimport type ApexGridHeader from '../components/header.js';\nimport type ApexGridRow from '../components/row.js';\nimport type { SortComparer } from '../operations/sort/types.js';\n\nexport type NavigationState = 'previous' | 'current';\nexport type GridHost<T extends object> = ReactiveControllerHost & ApexGrid<T>;\n\n/**\n * Helper type for resolving keys of type T.\n */\nexport type Keys<T> = keyof T;\n\n/**\n * Helper type for resolving types of type T.\n */\nexport type BasePropertyType<T, K extends Keys<T> = Keys<T>> = T[K];\n\n/**\n * Helper type for resolving types of type T.\n */\nexport type PropertyType<T, K extends Keys<T> = Keys<T>> = K extends Keys<T>\n ? BasePropertyType<T, K>\n : never;\n\n/**\n * The data type — or, for the declarative built-ins (`'select'`, `'rating'`,\n * `'date'`, `'image'`), the presentation type — for the current column.\n *\n * @remarks\n * - `'string'` / `'number'` are the primitive data types. They drive the\n * default filter operands, the default editor, and the default sort\n * comparison.\n * - `'boolean'` stores `true` / `false`. In display mode the grid renders\n * a check-mark icon for `true` and a dimmed mark for `false`. In edit\n * mode the default editor is a native checkbox.\n * - `'select'` is a presentation type for columns that store one of a fixed\n * set of values. Supply the available options via\n * {@link BaseColumnConfiguration.options}. The cell renders the matching\n * option's label in display mode and a native `<select>` in edit mode.\n * For sorting / filtering, select columns behave as their underlying\n * value type (typically string).\n * - `'rating'` renders a numeric value (0..`max`) as filled stars in display\n * mode and as an interactive star picker in edit mode. Configure the star\n * count via {@link BaseColumnConfiguration.max} (defaults to `5`).\n * For sorting / filtering, rating columns behave as numbers.\n * - `'date'` renders values as locale-aware formatted dates in display mode\n * and a native `<input type=\"date\">` in edit mode. Accepts `Date`\n * instances, ISO strings, or millisecond timestamps as input and commits\n * back in the same shape. Configure the display format via\n * {@link BaseColumnConfiguration.format} (`'short' | 'medium' | 'long' |\n * 'full'`, default `'medium'`).\n * - `'image'` renders the value as an `<img>` source. Use\n * {@link BaseColumnConfiguration.shape} to pick between `'square'`\n * (default) and `'circle'`. The cell's default text editor is used for\n * editing the URL string when `editable: true` is set.\n */\nexport type DataType = 'number' | 'string' | 'boolean' | 'select' | 'rating' | 'date' | 'image';\n\n/**\n * Display format presets for `'date'` columns. Map to\n * `Intl.DateTimeFormatOptions.dateStyle`.\n */\nexport type ColumnDateFormat = 'short' | 'medium' | 'long' | 'full';\n\n/**\n * An entry in a `'select'` column's `options` list. Bare values use\n * `String(value)` as their display label; the explicit form lets you give\n * a value a separate display label.\n */\nexport type ColumnSelectOption<V = unknown> = V | { value: V; label?: string };\n\n/**\n * Configures the sort behavior for the grid.\n */\nexport interface GridSortConfiguration {\n /**\n * Whether multiple sorting is enabled.\n */\n multiple: boolean;\n /**\n * Whether tri-state sorting is enabled.\n */\n triState: boolean;\n}\n\n/**\n * Extended sort configuration for a column.\n */\nexport interface BaseColumnSortConfiguration<T, K extends Keys<T> = Keys<T>> {\n /**\n * Whether the sort operations will be case sensitive.\n */\n caseSensitive?: boolean;\n /**\n * Custom comparer function for sort operations for this column.\n */\n comparer?: SortComparer<T, K>;\n}\n\n/**\n * See {@link BaseColumnSortConfiguration} for the full documentation.\n */\nexport type ColumnSortConfiguration<T, K extends Keys<T> = Keys<T>> = K extends Keys<T>\n ? BaseColumnSortConfiguration<T, K>\n : never;\n\n/**\n * Extended filter configuration for a column.\n */\nexport interface ColumnFilterConfiguration {\n /**\n * Whether the filter operations will be case sensitive.\n */\n caseSensitive?: boolean;\n}\n\n/**\n * Pin position for a column.\n *\n * @remarks\n * `'start'` pins the column to the leading edge of the grid (inline-start);\n * `'end'` pins it to the trailing edge. `null` or `undefined` means the column\n * is part of the scrollable region.\n */\nexport type PinPosition = 'start' | 'end' | null;\n\n/** Configuration object for grid columns. */\nexport interface BaseColumnConfiguration<T extends object, K extends Keys<T> = Keys<T>> {\n /**\n * The field for from the data the this column will reference.\n */\n key: K;\n /**\n * The type of data this column will reference.\n *\n * Affects the default filter operands if the column is with filtering enabled.\n *\n * @remarks\n * If not passed, `string` is assumed to be the default type.\n *\n */\n type?: DataType;\n /**\n * Optional text to display in the column header. By default, the column key is used\n * to render the header text.\n */\n headerText?: string;\n /**\n * Width for the current column.\n *\n * Accepts most CSS units for controlling width.\n *\n * @remarks\n * If not passed, the column will try to size itself based on the number of other\n * columns and the total width of the grid.\n *\n */\n width?: string;\n /**\n * Whether the column is hidden or not.\n */\n hidden?: boolean;\n /**\n * Whether this column is included when exporting via\n * {@link ApexGrid.exportToCSV} or {@link ApexGrid.exportToXLSX}.\n *\n * @remarks\n * Defaults to `true`. Set to `false` to omit a column from generated files\n * (useful for action columns, derived UI, or sensitive fields). The\n * grid-rendered selection checkbox column is never exported regardless of\n * this flag.\n */\n exportable?: boolean;\n /**\n * Pin the column to a side of the grid.\n *\n * @remarks\n * Pinned columns stay fixed during horizontal scroll. Use `'start'` (left in LTR,\n * right in RTL) for the leading edge or `'end'` for the trailing edge. The grid\n * renders columns in the order: `'start'`-pinned, unpinned, `'end'`-pinned, while\n * preserving the original array order inside each group. The `columns` array\n * itself is not mutated.\n */\n pinned?: PinPosition;\n /**\n * Whether this column can be reordered via drag-and-drop or the\n * {@link ApexGrid.moveColumn} API.\n *\n * @remarks\n * Has no effect unless the grid's `columnReordering` flag is `true`. When\n * unset, columns inherit the grid-wide flag. Reordering is constrained to the\n * column's own pinning group — start-pinned columns can only swap with other\n * start-pinned columns, and likewise for end-pinned and unpinned.\n */\n reorderable?: boolean;\n /**\n * Whether the the column can be resized or not.\n */\n resizable?: boolean;\n /**\n * Whether the column can be sorted or not.\n */\n sort?: ColumnSortConfiguration<T, K> | boolean;\n /**\n * Whether filter operation can be applied on the column or not.\n */\n filter?: ColumnFilterConfiguration | boolean;\n /**\n * Header template callback.\n */\n headerTemplate?: (params: ApexHeaderContext<T>) => TemplateResult | unknown;\n /**\n * Cell template callback.\n */\n cellTemplate?: (params: ApexCellContext<T, K>) => TemplateResult | unknown;\n /**\n * Whether values in this column can be edited inline.\n *\n * @remarks\n * Has no effect unless the grid's `editing.enabled` is `true`. The default\n * editor is chosen from the column's `type` (`'string'` → text input,\n * `'number'` → number input, `'boolean'` → checkbox). Supply\n * {@link BaseColumnConfiguration.editorTemplate} for full control.\n */\n editable?: boolean;\n /**\n * Custom editor template invoked while this column's cell is in edit mode.\n *\n * @remarks\n * The callback receives an {@link ApexEditorContext} that includes the cell\n * value plus `commit` / `cancel` helpers. Returning a focusable element is\n * recommended so keyboard handoff works.\n */\n editorTemplate?: (params: ApexEditorContext<T, K>) => TemplateResult | unknown;\n /**\n * Option list for columns with `type: 'select'`.\n *\n * @remarks\n * Each entry is either a bare value or an explicit `{ value, label }` pair.\n * The cell renders the matching option's `label` in display mode and a\n * native `<select>` of all options in edit mode. Has no effect on columns\n * with another `type`.\n */\n options?: ColumnSelectOption<BasePropertyType<T, K>>[];\n /**\n * Star count for columns with `type: 'rating'`.\n *\n * @remarks\n * The displayed value is clamped to the range `[0, max]`. Defaults to `5`.\n * Has no effect on columns with another `type`.\n */\n max?: number;\n /**\n * Display format for columns with `type: 'date'`.\n *\n * @remarks\n * Selects an `Intl.DateTimeFormatOptions.dateStyle` preset. Defaults to\n * `'medium'`. Has no effect on columns with another `type`.\n */\n format?: ColumnDateFormat;\n /**\n * Cropping shape for columns with `type: 'image'`.\n *\n * @remarks\n * `'square'` (default) renders the image at its native aspect. `'circle'`\n * crops to a circle (useful for avatars). Has no effect on columns with\n * another `type`.\n */\n shape?: 'square' | 'circle';\n /**\n * Alt text for `<img>` elements rendered by `type: 'image'` columns.\n *\n * @remarks\n * Defaults to the column key. Has no effect on columns with another\n * `type`.\n */\n alt?: string;\n}\n\n/**\n * See {@link BaseColumnConfiguration} for the full documentation.\n */\nexport type ColumnConfiguration<T extends object, K extends Keys<T> = Keys<T>> = K extends Keys<T>\n ? BaseColumnConfiguration<T, K>\n : never;\n\nexport interface ActiveNode<T> {\n column: Keys<T>;\n row: number;\n}\n\n/**\n * Context object for the column header template callback.\n */\nexport interface ApexHeaderContext<T extends object> {\n /**\n * The header element parent of the template.\n */\n parent: ApexGridHeader<T>;\n /**\n * The current configuration for the column.\n */\n column: ColumnConfiguration<T>;\n}\n\n/**\n * Context object for the row cell template callback.\n */\nexport interface BaseApexCellContext<T extends object, K extends Keys<T> = Keys<T>> {\n /**\n * The cell element parent of the template.\n */\n parent: ApexGridCell<T>;\n /**\n * The row element containing the cell.\n */\n row: ApexGridRow<T>;\n /**\n * The current configuration for the column.\n */\n column: ColumnConfiguration<T, K>;\n /**\n * The value from the data source for this cell.\n */\n value: PropertyType<T, K>;\n /**\n * Commits a new value for this cell without entering edit mode. Available\n * when the column is editable. Used by interactive display widgets\n * (e.g. the built-in boolean checkbox) so they can toggle inline.\n *\n * Goes through the cancellable `cellValueChanging` event and follow-up\n * `cellValueChanged` event — same write path as an edit-mode commit.\n */\n commit?: (value: PropertyType<T, K>) => Promise<boolean>;\n}\n\n/**\n * See {@link BaseApexCellContext} for the full documentation.\n */\nexport type ApexCellContext<T extends object, K extends Keys<T> = Keys<T>> = K extends Keys<T>\n ? BaseApexCellContext<T, K>\n : never;\n\n/**\n * Context object handed to a custom editor template.\n *\n * @remarks\n * Includes the cell's current `value` plus `commit` / `cancel` callbacks so\n * the editor can hand its result back to the grid. The custom editor is also\n * responsible for forwarding `Enter` / `Escape` to those callbacks.\n */\nexport interface BaseApexEditorContext<T extends object, K extends Keys<T> = Keys<T>>\n extends BaseApexCellContext<T, K> {\n /**\n * Commits `value` as the new cell value, going through the cancellable\n * `cellValueChanging` event and then `cellValueChanged`.\n *\n * @returns `true` if the value was applied, `false` if cancelled.\n */\n commit: (value: PropertyType<T, K>) => Promise<boolean>;\n /**\n * Discards the in-progress edit and exits edit mode.\n */\n cancel: () => void;\n}\n\n/**\n * See {@link BaseApexEditorContext} for the full documentation.\n */\nexport type ApexEditorContext<T extends object, K extends Keys<T> = Keys<T>> = K extends Keys<T>\n ? BaseApexEditorContext<T, K>\n : never;\n\n/**\n * The edit trigger used to enter cell edit mode.\n *\n * @remarks\n * `'click'` enters edit on a single click on the cell; `'doubleClick'`\n * requires a double click. Defaults to `'doubleClick'`.\n */\nexport type EditTrigger = 'click' | 'doubleClick';\n\n/**\n * Edit mode for the grid.\n *\n * @remarks\n * `'cell'` — each cell is committed independently on blur or `Enter`.\n * `'row'` — all editable cells in the row enter edit mode together; changes\n * are batched and applied via {@link ApexGrid.commitEdit} or rolled back via\n * {@link ApexGrid.cancelEdit}.\n */\nexport type EditMode = 'cell' | 'row';\n\n/**\n * Selection mode for the grid.\n *\n * @remarks\n * `'single'` — at most one row may be selected at any time. New clicks\n * replace the existing selection.\n * `'multiple'` — multiple rows can be selected. Plain clicks replace the\n * selection, Ctrl/Cmd+click toggles a row additively, and Shift+click\n * selects a range from the previous anchor.\n */\nexport type SelectionMode = 'single' | 'multiple';\n\n/**\n * Grid-level row-selection configuration.\n */\nexport interface GridSelectionConfiguration {\n /**\n * Whether row selection is enabled. Disabled by default.\n */\n enabled?: boolean;\n /**\n * Single-row vs multi-row selection. Defaults to `'multiple'`.\n */\n mode?: SelectionMode;\n /**\n * Whether to render the built-in checkbox column at the start of every\n * row. When `false`, selection is still available via the public API\n * (`selectRow`, `selectedRows = ...`) and via Space on the active row.\n * Defaults to `false`.\n */\n showCheckboxColumn?: boolean;\n}\n\n/**\n * Context passed to {@link GridExpansionConfiguration.detailTemplate}.\n */\nexport interface ApexDetailContext<T extends object> {\n /** The row data for the expanded row. */\n data: T;\n /** The view-relative row index of the master row. */\n rowIndex: number;\n /** The grid element. Useful for emitting events back from the detail. */\n parent: ApexGrid<T>;\n}\n\n/**\n * Grid-level tree-data (nested rows) configuration.\n *\n * @remarks\n * Tree mode renders hierarchical data as nested rows that share the same\n * column layout — collapsible parents with indented children, AG Grid's\n * \"tree data\" pattern. The data array stays flat; the grid derives the\n * hierarchy from {@link getDataPath} at runtime.\n *\n * This is distinct from {@link GridExpansionConfiguration} (master-detail),\n * which expands a row to show an arbitrary detail panel. Tree mode and\n * expansion mode can be enabled together, but the chevron column is\n * reserved by whichever is currently rendering the chevron — typically the\n * tree feature when both are enabled.\n *\n * @example\n * ```ts\n * grid.tree = {\n * enabled: true,\n * getDataPath: (row) => row.path,\n * };\n * ```\n */\nexport interface GridTreeConfiguration<T extends object> {\n /** Whether tree mode is enabled. Disabled by default. */\n enabled?: boolean;\n /**\n * Callback that returns the hierarchical path for a row. The path is a\n * sequence of segments from root to the row's own position — for example\n * `['Adrian']` for a CEO, `['Adrian', 'Bryan']` for a VP under Adrian,\n * and so on. Required when `enabled` is `true`.\n */\n getDataPath: (row: T) => readonly string[];\n /**\n * Which column displays the chevron + indentation. Defaults to the first\n * visible non-hidden data column.\n */\n groupColumnKey?: Keys<T>;\n /**\n * Initial expansion state:\n * - `false` (default): all rows collapsed.\n * - `true`: every row expanded.\n * - `number`: expand all rows up to and including the given depth (0 = roots only).\n */\n defaultExpanded?: boolean | number;\n /**\n * Pixels of indentation per depth level. Defaults to `20`.\n */\n childIndent?: number;\n}\n\n/**\n * Grid-level row-expansion (master-detail) configuration.\n */\nexport interface GridExpansionConfiguration<T extends object> {\n /**\n * Whether row expansion is enabled. Disabled by default.\n */\n enabled?: boolean;\n /**\n * Callback that produces the detail panel content for an expanded row.\n * Required when `enabled` is `true`.\n */\n detailTemplate?: (context: ApexDetailContext<T>) => TemplateResult | unknown;\n /**\n * Optional per-row predicate that gates which rows may be expanded. When\n * omitted, every row is expandable.\n */\n isExpandable?: (row: T) => boolean;\n /**\n * Whether to render the built-in chevron toggle column at the start of\n * every row (after the selection column, when present). Defaults to `true`.\n * Set to `false` to drive expansion entirely through the public API or a\n * custom cell template.\n */\n showToggleColumn?: boolean;\n}\n\n/**\n * Grid-level editing configuration.\n */\nexport interface GridEditingConfiguration {\n /**\n * Whether editing is enabled. Per-column opt-in still applies via\n * {@link BaseColumnConfiguration.editable}.\n */\n enabled?: boolean;\n /**\n * Whether each cell commits independently or whether the whole row is edited\n * as a batch. Defaults to `'cell'`.\n */\n mode?: EditMode;\n /**\n * The interaction that opens an editor. Defaults to `'doubleClick'`.\n */\n trigger?: EditTrigger;\n}\n\n/**\n * The parameters passed to a {@link DataPipelineHook} callback.\n */\nexport type DataPipelineParams<T extends object> = {\n /**\n * The current data state of the grid.\n */\n data: T[];\n /**\n * The grid component itself.\n */\n grid: ApexGrid<T>;\n /**\n * The type of data operation being performed.\n */\n type: 'sort' | 'filter' | 'quickFilter' | 'pagination';\n};\n\n/**\n * Callback function for customizing data operations in the grid.\n */\nexport type DataPipelineHook<T extends object> = (\n state: DataPipelineParams<T>\n) => T[] | Promise<T[]>;\n\n/**\n * Configuration for customizing the various data operations of the grid.\n */\nexport interface DataPipelineConfiguration<T extends object> {\n /**\n * Hook for customizing sort operations.\n */\n sort?: DataPipelineHook<T>;\n /**\n * Hook for customizing filter operations.\n */\n filter?: DataPipelineHook<T>;\n /**\n * Hook for customizing pagination operations.\n *\n * @remarks\n * The hook receives the filtered + sorted data slice for the grid to render and the current\n * pagination state. Return the page slice. For server-driven pagination, return the externally\n * fetched page and report the row total via {@link ApexGrid.totalItems}.\n */\n pagination?: DataPipelineHook<T>;\n /**\n * Hook for customizing quick (global) filter operations.\n *\n * @remarks\n * Called before column filtering. Return the records that match the {@link ApexGrid.quickFilter}\n * value. If omitted, the default substring matcher is used.\n */\n quickFilter?: DataPipelineHook<T>;\n}\n\n/**\n * The pagination mode for the grid.\n *\n * @remarks\n * `'local'` — the grid slices the in-memory {@link ApexGrid.dataView} by `page` and `pageSize`.\n * `'remote'` — the consumer drives data fetching; the grid emits paging events but does not\n * slice the data. Use together with {@link DataPipelineConfiguration.pagination} or by setting\n * `data` to the current page on `pageChanged`.\n */\nexport type PaginationMode = 'local' | 'remote';\n\n/**\n * Pagination configuration for the grid.\n */\nexport interface PaginationConfiguration {\n /**\n * Whether pagination is enabled.\n *\n * @remarks\n * When `false`, the grid renders no paginator and applies no slicing — the full\n * {@link ApexGrid.dataView} is virtualized as usual.\n */\n enabled?: boolean;\n /**\n * The pagination mode. Defaults to `'local'`.\n */\n mode?: PaginationMode;\n /**\n * The current page (zero-based). Defaults to `0`.\n */\n page?: number;\n /**\n * The number of records per page. Defaults to `25`.\n */\n pageSize?: number;\n /**\n * The list of page sizes offered in the paginator's page-size dropdown.\n * Defaults to `[10, 25, 50, 100]`.\n */\n pageSizeOptions?: number[];\n /**\n * In `'remote'` mode the consumer must supply the unfiltered row total so the paginator\n * can compute the page count. Ignored in `'local'` mode.\n */\n totalItems?: number;\n}\n\n/**\n * Resolved pagination state passed to controllers and event payloads.\n */\nexport interface PaginationState {\n /**\n * The current page (zero-based).\n */\n page: number;\n /**\n * The number of records per page.\n */\n pageSize: number;\n /**\n * The total number of pages.\n */\n pageCount: number;\n /**\n * The total number of records before pagination (after filter/sort).\n */\n totalItems: number;\n}\n"]}
@@ -1,6 +1,29 @@
1
1
  import type { StyleInfo } from 'lit/directives/style-map.js';
2
2
  import type { ColumnConfiguration, GridHost } from './types.js';
3
- export declare function applyColumnWidths<T extends object>(columns: Array<ColumnConfiguration<T>>): StyleInfo;
3
+ /** Width of the auto-rendered selection (checkbox) column in CSS pixels. */
4
+ export declare const SELECTION_COLUMN_WIDTH = 44;
5
+ /** Width of the auto-rendered expansion (chevron) column in CSS pixels. */
6
+ export declare const EXPANSION_COLUMN_WIDTH = 40;
7
+ export declare function applyColumnWidths<T extends object>(columns: Array<ColumnConfiguration<T>>, options?: {
8
+ showSelectionColumn?: boolean;
9
+ showExpansionColumn?: boolean;
10
+ }): StyleInfo;
11
+ /**
12
+ * Returns the visual render order of the columns: start-pinned columns first,
13
+ * then unpinned columns, then end-pinned columns. Within each group the
14
+ * original `columns` array order is preserved.
15
+ *
16
+ * @remarks
17
+ * The grid uses this order for rendering, navigation, and CSS grid track widths.
18
+ * The user-supplied `columns` array is never mutated; this returns a new array.
19
+ */
20
+ export declare function getDisplayColumns<T extends object>(columns: Array<ColumnConfiguration<T>>): Array<ColumnConfiguration<T>>;
21
+ /**
22
+ * Returns `'start'` for the last visible start-pinned column, `'end'` for the
23
+ * first visible end-pinned column, or `null` otherwise. The edge column gets a
24
+ * subtle shadow / border to separate the pinned region from the scrolling one.
25
+ */
26
+ export declare function getPinEdge<T extends object>(displayColumns: Array<ColumnConfiguration<T>>, index: number): 'start' | 'end' | null;
4
27
  export declare function autoGenerateColumns<T extends object>(grid: GridHost<T>): void;
5
28
  export declare function asArray<T>(value: T | T[]): T[];
6
29
  export declare function getFilterOperandsFor<T extends object>(column: ColumnConfiguration<T>): Readonly<import("../operations/filter/types.js").FilterOperands<number, import("../operations/filter/operands/number.js").NumberKeys>> | Readonly<import("../operations/filter/types.js").FilterOperands<string, import("../operations/filter/operands/string.js").StringKeys>> | Readonly<import("../operations/filter/types.js").FilterOperands<boolean, import("../operations/filter/operands/boolean.js").BooleanKeys>>;
package/internal/utils.js CHANGED
@@ -1,13 +1,54 @@
1
1
  import { BooleanOperands } from '../operations/filter/operands/boolean.js';
2
2
  import { NumberOperands } from '../operations/filter/operands/number.js';
3
3
  import { StringOperands } from '../operations/filter/operands/string.js';
4
- export function applyColumnWidths(columns) {
5
- return {
6
- 'grid-template-columns': columns
7
- .filter((each) => !each.hidden)
8
- .map(({ width }) => width ?? 'minmax(136px, 1fr)')
9
- .join(' '),
10
- };
4
+ export const SELECTION_COLUMN_WIDTH = 44;
5
+ export const EXPANSION_COLUMN_WIDTH = 40;
6
+ export function applyColumnWidths(columns, options = {}) {
7
+ const tracks = columns
8
+ .filter((each) => !each.hidden)
9
+ .map(({ width }) => width ?? 'minmax(136px, 1fr)');
10
+ if (options.showExpansionColumn) {
11
+ tracks.unshift(`${EXPANSION_COLUMN_WIDTH}px`);
12
+ }
13
+ if (options.showSelectionColumn) {
14
+ tracks.unshift(`${SELECTION_COLUMN_WIDTH}px`);
15
+ }
16
+ return { 'grid-template-columns': tracks.join(' ') };
17
+ }
18
+ export function getDisplayColumns(columns) {
19
+ const start = [];
20
+ const middle = [];
21
+ const end = [];
22
+ for (const column of columns) {
23
+ if (column.pinned === 'start')
24
+ start.push(column);
25
+ else if (column.pinned === 'end')
26
+ end.push(column);
27
+ else
28
+ middle.push(column);
29
+ }
30
+ return [...start, ...middle, ...end];
31
+ }
32
+ export function getPinEdge(displayColumns, index) {
33
+ const column = displayColumns[index];
34
+ if (!column?.pinned)
35
+ return null;
36
+ if (column.pinned === 'start') {
37
+ for (let i = index + 1; i < displayColumns.length; i++) {
38
+ const next = displayColumns[i];
39
+ if (next.hidden)
40
+ continue;
41
+ return next.pinned === 'start' ? null : 'start';
42
+ }
43
+ return 'start';
44
+ }
45
+ for (let i = index - 1; i >= 0; i--) {
46
+ const prev = displayColumns[i];
47
+ if (prev.hidden)
48
+ continue;
49
+ return prev.pinned === 'end' ? null : 'end';
50
+ }
51
+ return 'end';
11
52
  }
12
53
  export function autoGenerateColumns(grid) {
13
54
  if (grid.autoGenerate && grid.columns.length < 1) {