apex-grid 1.1.0 → 3.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.
- package/LICENSE +76 -5
- package/README.md +523 -10
- package/components/cell.d.ts +39 -0
- package/components/cell.js +334 -5
- package/components/cell.js.map +1 -1
- package/components/filter-row.d.ts +7 -5
- package/components/filter-row.js +151 -68
- package/components/filter-row.js.map +1 -1
- package/components/grid.d.ts +955 -4
- package/components/grid.js +412 -40
- package/components/grid.js.map +1 -1
- package/components/header-row.d.ts +21 -1
- package/components/header-row.js +140 -7
- package/components/header-row.js.map +1 -1
- package/components/header.d.ts +7 -0
- package/components/header.js +151 -31
- package/components/header.js.map +1 -1
- package/components/paginator.d.ts +56 -0
- package/components/paginator.js +148 -0
- package/components/paginator.js.map +1 -0
- package/components/row.d.ts +21 -2
- package/components/row.js +185 -10
- package/components/row.js.map +1 -1
- package/components/toolbar.d.ts +60 -0
- package/components/toolbar.js +259 -0
- package/components/toolbar.js.map +1 -0
- package/components/virtualizer.js +1 -1
- package/components/virtualizer.js.map +1 -1
- package/controllers/data-operation.d.ts +14 -0
- package/controllers/data-operation.js +19 -2
- package/controllers/data-operation.js.map +1 -1
- package/controllers/dom.d.ts +37 -1
- package/controllers/dom.js +176 -9
- package/controllers/dom.js.map +1 -1
- package/controllers/editing.d.ts +130 -0
- package/controllers/editing.js +197 -0
- package/controllers/editing.js.map +1 -0
- package/controllers/expansion.d.ts +68 -0
- package/controllers/expansion.js +126 -0
- package/controllers/expansion.js.map +1 -0
- package/controllers/navigation.d.ts +17 -6
- package/controllers/navigation.js +24 -8
- package/controllers/navigation.js.map +1 -1
- package/controllers/pagination.d.ts +102 -0
- package/controllers/pagination.js +106 -0
- package/controllers/pagination.js.map +1 -0
- package/controllers/reorder.d.ts +78 -0
- package/controllers/reorder.js +124 -0
- package/controllers/reorder.js.map +1 -0
- package/controllers/selection.d.ts +109 -0
- package/controllers/selection.js +168 -0
- package/controllers/selection.js.map +1 -0
- package/controllers/sort.js +28 -0
- package/controllers/sort.js.map +1 -1
- package/controllers/state.d.ts +47 -1
- package/controllers/state.js +48 -1
- package/controllers/state.js.map +1 -1
- package/controllers/tree.d.ts +87 -0
- package/controllers/tree.js +0 -0
- package/controllers/tree.js.map +1 -0
- package/custom-elements.json +6491 -1355
- package/define.js.map +1 -1
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/highlight.css +77 -14
- package/docs/assets/icons.js +1 -1
- package/docs/assets/icons.svg +1 -1
- package/docs/assets/main.js +4 -4
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +3 -3
- package/docs/classes/ApexGrid.html +320 -24
- package/docs/functions/setup.html +16 -0
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +543 -9
- package/docs/interfaces/ApexCellValueChangedEvent.html +11 -0
- package/docs/interfaces/ApexCellValueChangingEvent.html +13 -0
- package/docs/interfaces/ApexColumnMovedEvent.html +8 -0
- package/docs/interfaces/ApexColumnMovingEvent.html +11 -0
- package/docs/interfaces/ApexColumnPinnedEvent.html +6 -0
- package/docs/interfaces/ApexColumnPinningEvent.html +8 -0
- package/docs/interfaces/ApexDetailContext.html +8 -0
- package/docs/interfaces/ApexFilteredEvent.html +4 -4
- package/docs/interfaces/ApexFilteringEvent.html +4 -4
- package/docs/interfaces/ApexGridEventMap.html +60 -9
- package/docs/interfaces/ApexHeaderContext.html +4 -4
- package/docs/interfaces/ApexPageChangedEvent.html +10 -0
- package/docs/interfaces/ApexPageChangingEvent.html +10 -0
- package/docs/interfaces/ApexQuickFilterChangedEvent.html +4 -0
- package/docs/interfaces/ApexQuickFilterChangingEvent.html +6 -0
- package/docs/interfaces/ApexRowEditEndedEvent.html +6 -0
- package/docs/interfaces/ApexRowEditStartedEvent.html +4 -0
- package/docs/interfaces/ApexRowExpandedEvent.html +8 -0
- package/docs/interfaces/ApexRowExpandingEvent.html +11 -0
- package/docs/interfaces/ApexRowSelectedEvent.html +8 -0
- package/docs/interfaces/ApexRowSelectingEvent.html +11 -0
- package/docs/interfaces/ApexTreeRowExpandedEvent.html +8 -0
- package/docs/interfaces/ApexTreeRowExpandingEvent.html +10 -0
- package/docs/interfaces/BaseApexCellContext.html +12 -6
- package/docs/interfaces/BaseApexEditorContext.html +19 -0
- package/docs/interfaces/BaseColumnConfiguration.html +88 -14
- package/docs/interfaces/BaseColumnSortConfiguration.html +4 -4
- package/docs/interfaces/BaseFilterExpression.html +5 -5
- package/docs/interfaces/BaseSortExpression.html +4 -4
- package/docs/interfaces/CSVExportOptions.html +22 -0
- package/docs/interfaces/ColumnFilterConfiguration.html +3 -3
- package/docs/interfaces/DataPipelineConfiguration.html +13 -4
- package/docs/interfaces/ExportFormat.html +10 -0
- package/docs/interfaces/ExportOptions.html +15 -0
- package/docs/interfaces/GridEditingConfiguration.html +10 -0
- package/docs/interfaces/GridExpansionConfiguration.html +15 -0
- package/docs/interfaces/GridSelectionConfiguration.html +11 -0
- package/docs/interfaces/GridSortConfiguration.html +4 -4
- package/docs/interfaces/GridTreeConfiguration.html +33 -0
- package/docs/interfaces/PaginationConfiguration.html +18 -0
- package/docs/interfaces/PaginationState.html +10 -0
- package/docs/media/LICENSE +80 -0
- package/docs/media/_tokens.scss +106 -0
- package/docs/media/package.json +85 -0
- package/docs/modules.html +1 -1
- package/docs/types/ApexCellContext.html +2 -2
- package/docs/types/ApexEditorContext.html +2 -0
- package/docs/types/BasePropertyType.html +2 -2
- package/docs/types/BaseSortComparer.html +2 -2
- package/docs/types/ColumnConfiguration.html +2 -2
- package/docs/types/ColumnDropPosition.html +2 -0
- package/docs/types/ColumnSortConfiguration.html +2 -2
- package/docs/types/DataPipelineHook.html +2 -2
- package/docs/types/DataPipelineParams.html +5 -5
- package/docs/types/DataType.html +47 -2
- package/docs/types/EditMode.html +6 -0
- package/docs/types/EditTrigger.html +4 -0
- package/docs/types/ExportCellValue.html +5 -0
- package/docs/types/ExportSource.html +8 -0
- package/docs/types/FilterCriteria.html +2 -2
- package/docs/types/FilterExpression.html +2 -2
- package/docs/types/Keys.html +2 -2
- package/docs/types/PaginationMode.html +6 -0
- package/docs/types/PinPosition.html +5 -0
- package/docs/types/PropertyType.html +2 -2
- package/docs/types/SelectionMode.html +7 -0
- package/docs/types/SortComparer.html +2 -2
- package/docs/types/SortExpression.html +2 -2
- package/docs/types/SortState.html +2 -2
- package/docs/types/SortingDirection.html +1 -1
- package/index.d.ts +5 -2
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/internal/column-types.d.ts +94 -0
- package/internal/column-types.js +428 -0
- package/internal/column-types.js.map +1 -0
- package/internal/export.d.ts +114 -0
- package/internal/export.js +122 -0
- package/internal/export.js.map +1 -0
- package/internal/feature-module.d.ts +27 -0
- package/internal/feature-module.js +2 -0
- package/internal/feature-module.js.map +1 -0
- package/internal/flip.d.ts +80 -0
- package/internal/flip.js +52 -0
- package/internal/flip.js.map +1 -0
- package/internal/icons.d.ts +31 -0
- package/internal/icons.js +145 -0
- package/internal/icons.js.map +1 -0
- package/internal/index.d.ts +20 -0
- package/internal/index.js +6 -0
- package/internal/index.js.map +1 -0
- package/internal/tags.d.ts +2 -0
- package/internal/tags.js +2 -0
- package/internal/tags.js.map +1 -1
- package/internal/types.d.ts +473 -3
- package/internal/types.js.map +1 -1
- package/internal/utils.d.ts +24 -1
- package/internal/utils.js +48 -7
- package/internal/utils.js.map +1 -1
- package/operations/filter/tree.d.ts +1 -1
- package/operations/filter/types.js.map +1 -1
- package/operations/pagination.d.ts +19 -0
- package/operations/pagination.js +12 -0
- package/operations/pagination.js.map +1 -0
- package/operations/quick-filter.d.ts +21 -0
- package/operations/quick-filter.js +26 -0
- package/operations/quick-filter.js.map +1 -0
- package/operations/sort/types.js.map +1 -1
- package/package.json +10 -5
- package/setup.d.ts +51 -0
- package/setup.js +31 -0
- package/setup.js.map +1 -0
- package/styles/_checkbox.css.js +3 -0
- package/styles/_checkbox.css.js.map +1 -0
- package/styles/_tokens.css.js +3 -0
- package/styles/_tokens.css.js.map +1 -0
- package/styles/body-cell/body-cell.css.js +1 -1
- package/styles/body-cell/body-cell.css.js.map +1 -1
- package/styles/body-cell/cell-renderers.css.js +3 -0
- package/styles/body-cell/cell-renderers.css.js.map +1 -0
- package/styles/body-row/body-row.css.js +1 -1
- package/styles/body-row/body-row.css.js.map +1 -1
- package/styles/filter-row/filter-row.css.js +1 -1
- package/styles/filter-row/filter-row.css.js.map +1 -1
- package/styles/grid/_grid.base.css.js +1 -1
- package/styles/grid/_grid.base.css.js.map +1 -1
- package/styles/grid/grid.css.js +3 -0
- package/styles/grid/grid.css.js.map +1 -0
- package/styles/header-cell/header-cell.css.js +1 -1
- package/styles/header-cell/header-cell.css.js.map +1 -1
- package/styles/header-row/header-row.base.css.js +1 -1
- package/styles/header-row/header-row.base.css.js.map +1 -1
- package/styles/paginator/paginator.css.d.ts +1 -0
- package/styles/paginator/paginator.css.js +3 -0
- package/styles/paginator/paginator.css.js.map +1 -0
- package/styles/toolbar/toolbar.css.d.ts +1 -0
- package/styles/toolbar/toolbar.css.js +3 -0
- package/styles/toolbar/toolbar.css.js.map +1 -0
- package/styles.css +17 -0
- package/internal/icon-registry.d.ts +0 -1
- package/internal/icon-registry.js +0 -29
- package/internal/icon-registry.js.map +0 -1
- package/internal/theming.d.ts +0 -34
- package/internal/theming.js +0 -123
- package/internal/theming.js.map +0 -1
- package/styles/grid/themes/light/grid.bootstrap.css.js +0 -3
- package/styles/grid/themes/light/grid.bootstrap.css.js.map +0 -1
- package/styles/grid/themes/light/grid.fluent.css.js +0 -3
- package/styles/grid/themes/light/grid.fluent.css.js.map +0 -1
- package/styles/grid/themes/light/grid.indigo.css.js +0 -3
- package/styles/grid/themes/light/grid.indigo.css.js.map +0 -1
- package/styles/grid/themes/light/grid.material.css.js +0 -3
- package/styles/grid/themes/light/grid.material.css.js.map +0 -1
- /package/styles/{grid/themes/light/grid.bootstrap.css.d.ts → _checkbox.css.d.ts} +0 -0
- /package/styles/{grid/themes/light/grid.fluent.css.d.ts → _tokens.css.d.ts} +0 -0
- /package/styles/{grid/themes/light/grid.indigo.css.d.ts → body-cell/cell-renderers.css.d.ts} +0 -0
- /package/styles/grid/{themes/light/grid.material.css.d.ts → grid.css.d.ts} +0 -0
package/internal/types.d.ts
CHANGED
|
@@ -18,8 +18,73 @@ 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
|
-
/**
|
|
22
|
-
|
|
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
|
+
* The remaining types are premium presentation renderers over primitive
|
|
54
|
+
* values; for sorting / filtering they behave as their underlying value type:
|
|
55
|
+
* - `'currency'` formats a number via `Intl.NumberFormat` (tabular, right
|
|
56
|
+
* aligned). Configure with {@link BaseColumnConfiguration.currency} /
|
|
57
|
+
* {@link BaseColumnConfiguration.locale}. Editable via a number input.
|
|
58
|
+
* - `'avatar'` renders the value's first letter in a tinted circle (hue is
|
|
59
|
+
* derived from the value, stable per row).
|
|
60
|
+
* - `'badge'` renders the value as a colored pill. Pick the look with
|
|
61
|
+
* {@link BaseColumnConfiguration.badgeVariant}.
|
|
62
|
+
* - `'progress'` renders a number (0..`max`, default `max` 100) as a health
|
|
63
|
+
* bar; the fill color tiers at ≥80 / ≥65 / below.
|
|
64
|
+
* - `'sparkline'` renders a `number[]` as an inline trend chart with an
|
|
65
|
+
* optional delta label ({@link BaseColumnConfiguration.showDelta}).
|
|
66
|
+
* - `'status'` renders a pill with a leading dot. The state is taken from
|
|
67
|
+
* {@link BaseColumnConfiguration.statusVariant} or inferred from the value.
|
|
68
|
+
*/
|
|
69
|
+
export type DataType = 'number' | 'string' | 'boolean' | 'select' | 'rating' | 'date' | 'image' | 'currency' | 'avatar' | 'badge' | 'progress' | 'sparkline' | 'status';
|
|
70
|
+
/** Visual variant for a `type: 'badge'` pill. */
|
|
71
|
+
export type BadgeVariant = 'gold' | 'brand' | 'neutral' | 'muted';
|
|
72
|
+
/** State for a `type: 'status'` badge. */
|
|
73
|
+
export type StatusVariant = 'active' | 'trial' | 'churn';
|
|
74
|
+
/**
|
|
75
|
+
* Display format presets for `'date'` columns. Map to
|
|
76
|
+
* `Intl.DateTimeFormatOptions.dateStyle`.
|
|
77
|
+
*/
|
|
78
|
+
export type ColumnDateFormat = 'short' | 'medium' | 'long' | 'full';
|
|
79
|
+
/**
|
|
80
|
+
* An entry in a `'select'` column's `options` list. Bare values use
|
|
81
|
+
* `String(value)` as their display label; the explicit form lets you give
|
|
82
|
+
* a value a separate display label.
|
|
83
|
+
*/
|
|
84
|
+
export type ColumnSelectOption<V = unknown> = V | {
|
|
85
|
+
value: V;
|
|
86
|
+
label?: string;
|
|
87
|
+
};
|
|
23
88
|
/**
|
|
24
89
|
* Configures the sort behavior for the grid.
|
|
25
90
|
*/
|
|
@@ -59,6 +124,15 @@ export interface ColumnFilterConfiguration {
|
|
|
59
124
|
*/
|
|
60
125
|
caseSensitive?: boolean;
|
|
61
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* Pin position for a column.
|
|
129
|
+
*
|
|
130
|
+
* @remarks
|
|
131
|
+
* `'start'` pins the column to the leading edge of the grid (inline-start);
|
|
132
|
+
* `'end'` pins it to the trailing edge. `null` or `undefined` means the column
|
|
133
|
+
* is part of the scrollable region.
|
|
134
|
+
*/
|
|
135
|
+
export type PinPosition = 'start' | 'end' | null;
|
|
62
136
|
/** Configuration object for grid columns. */
|
|
63
137
|
export interface BaseColumnConfiguration<T extends object, K extends Keys<T> = Keys<T>> {
|
|
64
138
|
/**
|
|
@@ -95,6 +169,39 @@ export interface BaseColumnConfiguration<T extends object, K extends Keys<T> = K
|
|
|
95
169
|
* Whether the column is hidden or not.
|
|
96
170
|
*/
|
|
97
171
|
hidden?: boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Whether this column is included when exporting via
|
|
174
|
+
* {@link ApexGrid.exportToCSV} (or the enterprise grid's XLSX export).
|
|
175
|
+
*
|
|
176
|
+
* @remarks
|
|
177
|
+
* Defaults to `true`. Set to `false` to omit a column from generated files
|
|
178
|
+
* (useful for action columns, derived UI, or sensitive fields). The
|
|
179
|
+
* grid-rendered selection checkbox column is never exported regardless of
|
|
180
|
+
* this flag.
|
|
181
|
+
*/
|
|
182
|
+
exportable?: boolean;
|
|
183
|
+
/**
|
|
184
|
+
* Pin the column to a side of the grid.
|
|
185
|
+
*
|
|
186
|
+
* @remarks
|
|
187
|
+
* Pinned columns stay fixed during horizontal scroll. Use `'start'` (left in LTR,
|
|
188
|
+
* right in RTL) for the leading edge or `'end'` for the trailing edge. The grid
|
|
189
|
+
* renders columns in the order: `'start'`-pinned, unpinned, `'end'`-pinned, while
|
|
190
|
+
* preserving the original array order inside each group. The `columns` array
|
|
191
|
+
* itself is not mutated.
|
|
192
|
+
*/
|
|
193
|
+
pinned?: PinPosition;
|
|
194
|
+
/**
|
|
195
|
+
* Whether this column can be reordered via drag-and-drop or the
|
|
196
|
+
* {@link ApexGrid.moveColumn} API.
|
|
197
|
+
*
|
|
198
|
+
* @remarks
|
|
199
|
+
* Has no effect unless the grid's `columnReordering` flag is `true`. When
|
|
200
|
+
* unset, columns inherit the grid-wide flag. Reordering is constrained to the
|
|
201
|
+
* column's own pinning group — start-pinned columns can only swap with other
|
|
202
|
+
* start-pinned columns, and likewise for end-pinned and unpinned.
|
|
203
|
+
*/
|
|
204
|
+
reorderable?: boolean;
|
|
98
205
|
/**
|
|
99
206
|
* Whether the the column can be resized or not.
|
|
100
207
|
*/
|
|
@@ -115,6 +222,97 @@ export interface BaseColumnConfiguration<T extends object, K extends Keys<T> = K
|
|
|
115
222
|
* Cell template callback.
|
|
116
223
|
*/
|
|
117
224
|
cellTemplate?: (params: ApexCellContext<T, K>) => TemplateResult | unknown;
|
|
225
|
+
/**
|
|
226
|
+
* Whether values in this column can be edited inline.
|
|
227
|
+
*
|
|
228
|
+
* @remarks
|
|
229
|
+
* Has no effect unless the grid's `editing.enabled` is `true`. The default
|
|
230
|
+
* editor is chosen from the column's `type` (`'string'` → text input,
|
|
231
|
+
* `'number'` → number input, `'boolean'` → checkbox). Supply
|
|
232
|
+
* {@link BaseColumnConfiguration.editorTemplate} for full control.
|
|
233
|
+
*/
|
|
234
|
+
editable?: boolean;
|
|
235
|
+
/**
|
|
236
|
+
* Custom editor template invoked while this column's cell is in edit mode.
|
|
237
|
+
*
|
|
238
|
+
* @remarks
|
|
239
|
+
* The callback receives an {@link ApexEditorContext} that includes the cell
|
|
240
|
+
* value plus `commit` / `cancel` helpers. Returning a focusable element is
|
|
241
|
+
* recommended so keyboard handoff works.
|
|
242
|
+
*/
|
|
243
|
+
editorTemplate?: (params: ApexEditorContext<T, K>) => TemplateResult | unknown;
|
|
244
|
+
/**
|
|
245
|
+
* Option list for columns with `type: 'select'`.
|
|
246
|
+
*
|
|
247
|
+
* @remarks
|
|
248
|
+
* Each entry is either a bare value or an explicit `{ value, label }` pair.
|
|
249
|
+
* The cell renders the matching option's `label` in display mode and a
|
|
250
|
+
* native `<select>` of all options in edit mode. Has no effect on columns
|
|
251
|
+
* with another `type`.
|
|
252
|
+
*/
|
|
253
|
+
options?: ColumnSelectOption<BasePropertyType<T, K>>[];
|
|
254
|
+
/**
|
|
255
|
+
* Upper bound for `type: 'rating'` and `type: 'progress'`.
|
|
256
|
+
*
|
|
257
|
+
* @remarks
|
|
258
|
+
* For `'rating'` this is the star count (default `5`); the displayed value is
|
|
259
|
+
* clamped to `[0, max]`. For `'progress'` this is the value that fills the bar
|
|
260
|
+
* to 100% (default `100`). Has no effect on columns with another `type`.
|
|
261
|
+
*/
|
|
262
|
+
max?: number;
|
|
263
|
+
/**
|
|
264
|
+
* Display format for columns with `type: 'date'`.
|
|
265
|
+
*
|
|
266
|
+
* @remarks
|
|
267
|
+
* Selects an `Intl.DateTimeFormatOptions.dateStyle` preset. Defaults to
|
|
268
|
+
* `'medium'`. Has no effect on columns with another `type`.
|
|
269
|
+
*/
|
|
270
|
+
format?: ColumnDateFormat;
|
|
271
|
+
/**
|
|
272
|
+
* Cropping shape for columns with `type: 'image'`.
|
|
273
|
+
*
|
|
274
|
+
* @remarks
|
|
275
|
+
* `'square'` (default) renders the image at its native aspect. `'circle'`
|
|
276
|
+
* crops to a circle (useful for avatars). Has no effect on columns with
|
|
277
|
+
* another `type`.
|
|
278
|
+
*/
|
|
279
|
+
shape?: 'square' | 'circle';
|
|
280
|
+
/**
|
|
281
|
+
* Alt text for `<img>` elements rendered by `type: 'image'` columns.
|
|
282
|
+
*
|
|
283
|
+
* @remarks
|
|
284
|
+
* Defaults to the column key. Has no effect on columns with another
|
|
285
|
+
* `type`.
|
|
286
|
+
*/
|
|
287
|
+
alt?: string;
|
|
288
|
+
/**
|
|
289
|
+
* ISO 4217 currency code for `type: 'currency'` columns (e.g. `'USD'`,
|
|
290
|
+
* `'EUR'`). Defaults to `'USD'`. Has no effect on columns with another
|
|
291
|
+
* `type`.
|
|
292
|
+
*/
|
|
293
|
+
currency?: string;
|
|
294
|
+
/**
|
|
295
|
+
* BCP 47 locale for `type: 'currency'` number formatting. Defaults to the
|
|
296
|
+
* runtime locale. Has no effect on columns with another `type`.
|
|
297
|
+
*/
|
|
298
|
+
locale?: string;
|
|
299
|
+
/**
|
|
300
|
+
* Visual variant for `type: 'badge'` columns. A literal applies to every
|
|
301
|
+
* cell; a callback picks per value. Defaults to `'neutral'`. Has no effect
|
|
302
|
+
* on columns with another `type`.
|
|
303
|
+
*/
|
|
304
|
+
badgeVariant?: BadgeVariant | ((value: BasePropertyType<T, K>) => BadgeVariant);
|
|
305
|
+
/**
|
|
306
|
+
* State for `type: 'status'` columns. A literal applies to every cell; a
|
|
307
|
+
* callback maps a value to a state. When omitted the state is inferred from
|
|
308
|
+
* the value text. Has no effect on columns with another `type`.
|
|
309
|
+
*/
|
|
310
|
+
statusVariant?: StatusVariant | ((value: BasePropertyType<T, K>) => StatusVariant);
|
|
311
|
+
/**
|
|
312
|
+
* Whether `type: 'sparkline'` columns render a trailing delta-% label.
|
|
313
|
+
* Defaults to `true`. Has no effect on columns with another `type`.
|
|
314
|
+
*/
|
|
315
|
+
showDelta?: boolean;
|
|
118
316
|
}
|
|
119
317
|
/**
|
|
120
318
|
* See {@link BaseColumnConfiguration} for the full documentation.
|
|
@@ -157,11 +355,200 @@ export interface BaseApexCellContext<T extends object, K extends Keys<T> = Keys<
|
|
|
157
355
|
* The value from the data source for this cell.
|
|
158
356
|
*/
|
|
159
357
|
value: PropertyType<T, K>;
|
|
358
|
+
/**
|
|
359
|
+
* Commits a new value for this cell without entering edit mode. Available
|
|
360
|
+
* when the column is editable. Used by interactive display widgets
|
|
361
|
+
* (e.g. the built-in boolean checkbox) so they can toggle inline.
|
|
362
|
+
*
|
|
363
|
+
* Goes through the cancellable `cellValueChanging` event and follow-up
|
|
364
|
+
* `cellValueChanged` event — same write path as an edit-mode commit.
|
|
365
|
+
*/
|
|
366
|
+
commit?: (value: PropertyType<T, K>) => Promise<boolean>;
|
|
160
367
|
}
|
|
161
368
|
/**
|
|
162
369
|
* See {@link BaseApexCellContext} for the full documentation.
|
|
163
370
|
*/
|
|
164
371
|
export type ApexCellContext<T extends object, K extends Keys<T> = Keys<T>> = K extends Keys<T> ? BaseApexCellContext<T, K> : never;
|
|
372
|
+
/**
|
|
373
|
+
* Context object handed to a custom editor template.
|
|
374
|
+
*
|
|
375
|
+
* @remarks
|
|
376
|
+
* Includes the cell's current `value` plus `commit` / `cancel` callbacks so
|
|
377
|
+
* the editor can hand its result back to the grid. The custom editor is also
|
|
378
|
+
* responsible for forwarding `Enter` / `Escape` to those callbacks.
|
|
379
|
+
*/
|
|
380
|
+
export interface BaseApexEditorContext<T extends object, K extends Keys<T> = Keys<T>> extends BaseApexCellContext<T, K> {
|
|
381
|
+
/**
|
|
382
|
+
* Commits `value` as the new cell value, going through the cancellable
|
|
383
|
+
* `cellValueChanging` event and then `cellValueChanged`.
|
|
384
|
+
*
|
|
385
|
+
* @returns `true` if the value was applied, `false` if cancelled.
|
|
386
|
+
*/
|
|
387
|
+
commit: (value: PropertyType<T, K>) => Promise<boolean>;
|
|
388
|
+
/**
|
|
389
|
+
* Discards the in-progress edit and exits edit mode.
|
|
390
|
+
*/
|
|
391
|
+
cancel: () => void;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* See {@link BaseApexEditorContext} for the full documentation.
|
|
395
|
+
*/
|
|
396
|
+
export type ApexEditorContext<T extends object, K extends Keys<T> = Keys<T>> = K extends Keys<T> ? BaseApexEditorContext<T, K> : never;
|
|
397
|
+
/**
|
|
398
|
+
* The edit trigger used to enter cell edit mode.
|
|
399
|
+
*
|
|
400
|
+
* @remarks
|
|
401
|
+
* `'click'` enters edit on a single click on the cell; `'doubleClick'`
|
|
402
|
+
* requires a double click. Defaults to `'doubleClick'`.
|
|
403
|
+
*/
|
|
404
|
+
export type EditTrigger = 'click' | 'doubleClick';
|
|
405
|
+
/**
|
|
406
|
+
* Edit mode for the grid.
|
|
407
|
+
*
|
|
408
|
+
* @remarks
|
|
409
|
+
* `'cell'` — each cell is committed independently on blur or `Enter`.
|
|
410
|
+
* `'row'` — all editable cells in the row enter edit mode together; changes
|
|
411
|
+
* are batched and applied via {@link ApexGrid.commitEdit} or rolled back via
|
|
412
|
+
* {@link ApexGrid.cancelEdit}.
|
|
413
|
+
*/
|
|
414
|
+
export type EditMode = 'cell' | 'row';
|
|
415
|
+
/**
|
|
416
|
+
* Selection mode for the grid.
|
|
417
|
+
*
|
|
418
|
+
* @remarks
|
|
419
|
+
* `'single'` — at most one row may be selected at any time. New clicks
|
|
420
|
+
* replace the existing selection.
|
|
421
|
+
* `'multiple'` — multiple rows can be selected. Plain clicks replace the
|
|
422
|
+
* selection, Ctrl/Cmd+click toggles a row additively, and Shift+click
|
|
423
|
+
* selects a range from the previous anchor.
|
|
424
|
+
*/
|
|
425
|
+
export type SelectionMode = 'single' | 'multiple';
|
|
426
|
+
/**
|
|
427
|
+
* Grid-level row-selection configuration.
|
|
428
|
+
*/
|
|
429
|
+
export interface GridSelectionConfiguration {
|
|
430
|
+
/**
|
|
431
|
+
* Whether row selection is enabled. Disabled by default.
|
|
432
|
+
*/
|
|
433
|
+
enabled?: boolean;
|
|
434
|
+
/**
|
|
435
|
+
* Single-row vs multi-row selection. Defaults to `'multiple'`.
|
|
436
|
+
*/
|
|
437
|
+
mode?: SelectionMode;
|
|
438
|
+
/**
|
|
439
|
+
* Whether to render the built-in checkbox column at the start of every
|
|
440
|
+
* row. When `false`, selection is still available via the public API
|
|
441
|
+
* (`selectRow`, `selectedRows = ...`) and via Space on the active row.
|
|
442
|
+
* Defaults to `false`.
|
|
443
|
+
*/
|
|
444
|
+
showCheckboxColumn?: boolean;
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Context passed to {@link GridExpansionConfiguration.detailTemplate}.
|
|
448
|
+
*/
|
|
449
|
+
export interface ApexDetailContext<T extends object> {
|
|
450
|
+
/** The row data for the expanded row. */
|
|
451
|
+
data: T;
|
|
452
|
+
/** The view-relative row index of the master row. */
|
|
453
|
+
rowIndex: number;
|
|
454
|
+
/** The grid element. Useful for emitting events back from the detail. */
|
|
455
|
+
parent: ApexGrid<T>;
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Grid-level tree-data (nested rows) configuration.
|
|
459
|
+
*
|
|
460
|
+
* @remarks
|
|
461
|
+
* Tree mode renders hierarchical data as nested rows that share the same
|
|
462
|
+
* column layout — collapsible parents with indented children, AG Grid's
|
|
463
|
+
* "tree data" pattern. The data array stays flat; the grid derives the
|
|
464
|
+
* hierarchy from {@link getDataPath} at runtime.
|
|
465
|
+
*
|
|
466
|
+
* This is distinct from {@link GridExpansionConfiguration} (master-detail),
|
|
467
|
+
* which expands a row to show an arbitrary detail panel. Tree mode and
|
|
468
|
+
* expansion mode can be enabled together, but the chevron column is
|
|
469
|
+
* reserved by whichever is currently rendering the chevron — typically the
|
|
470
|
+
* tree feature when both are enabled.
|
|
471
|
+
*
|
|
472
|
+
* @example
|
|
473
|
+
* ```ts
|
|
474
|
+
* grid.tree = {
|
|
475
|
+
* enabled: true,
|
|
476
|
+
* getDataPath: (row) => row.path,
|
|
477
|
+
* };
|
|
478
|
+
* ```
|
|
479
|
+
*/
|
|
480
|
+
export interface GridTreeConfiguration<T extends object> {
|
|
481
|
+
/** Whether tree mode is enabled. Disabled by default. */
|
|
482
|
+
enabled?: boolean;
|
|
483
|
+
/**
|
|
484
|
+
* Callback that returns the hierarchical path for a row. The path is a
|
|
485
|
+
* sequence of segments from root to the row's own position — for example
|
|
486
|
+
* `['Adrian']` for a CEO, `['Adrian', 'Bryan']` for a VP under Adrian,
|
|
487
|
+
* and so on. Required when `enabled` is `true`.
|
|
488
|
+
*/
|
|
489
|
+
getDataPath: (row: T) => readonly string[];
|
|
490
|
+
/**
|
|
491
|
+
* Which column displays the chevron + indentation. Defaults to the first
|
|
492
|
+
* visible non-hidden data column.
|
|
493
|
+
*/
|
|
494
|
+
groupColumnKey?: Keys<T>;
|
|
495
|
+
/**
|
|
496
|
+
* Initial expansion state:
|
|
497
|
+
* - `false` (default): all rows collapsed.
|
|
498
|
+
* - `true`: every row expanded.
|
|
499
|
+
* - `number`: expand all rows up to and including the given depth (0 = roots only).
|
|
500
|
+
*/
|
|
501
|
+
defaultExpanded?: boolean | number;
|
|
502
|
+
/**
|
|
503
|
+
* Pixels of indentation per depth level. Defaults to `20`.
|
|
504
|
+
*/
|
|
505
|
+
childIndent?: number;
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Grid-level row-expansion (master-detail) configuration.
|
|
509
|
+
*/
|
|
510
|
+
export interface GridExpansionConfiguration<T extends object> {
|
|
511
|
+
/**
|
|
512
|
+
* Whether row expansion is enabled. Disabled by default.
|
|
513
|
+
*/
|
|
514
|
+
enabled?: boolean;
|
|
515
|
+
/**
|
|
516
|
+
* Callback that produces the detail panel content for an expanded row.
|
|
517
|
+
* Required when `enabled` is `true`.
|
|
518
|
+
*/
|
|
519
|
+
detailTemplate?: (context: ApexDetailContext<T>) => TemplateResult | unknown;
|
|
520
|
+
/**
|
|
521
|
+
* Optional per-row predicate that gates which rows may be expanded. When
|
|
522
|
+
* omitted, every row is expandable.
|
|
523
|
+
*/
|
|
524
|
+
isExpandable?: (row: T) => boolean;
|
|
525
|
+
/**
|
|
526
|
+
* Whether to render the built-in chevron toggle column at the start of
|
|
527
|
+
* every row (after the selection column, when present). Defaults to `true`.
|
|
528
|
+
* Set to `false` to drive expansion entirely through the public API or a
|
|
529
|
+
* custom cell template.
|
|
530
|
+
*/
|
|
531
|
+
showToggleColumn?: boolean;
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* Grid-level editing configuration.
|
|
535
|
+
*/
|
|
536
|
+
export interface GridEditingConfiguration {
|
|
537
|
+
/**
|
|
538
|
+
* Whether editing is enabled. Per-column opt-in still applies via
|
|
539
|
+
* {@link BaseColumnConfiguration.editable}.
|
|
540
|
+
*/
|
|
541
|
+
enabled?: boolean;
|
|
542
|
+
/**
|
|
543
|
+
* Whether each cell commits independently or whether the whole row is edited
|
|
544
|
+
* as a batch. Defaults to `'cell'`.
|
|
545
|
+
*/
|
|
546
|
+
mode?: EditMode;
|
|
547
|
+
/**
|
|
548
|
+
* The interaction that opens an editor. Defaults to `'doubleClick'`.
|
|
549
|
+
*/
|
|
550
|
+
trigger?: EditTrigger;
|
|
551
|
+
}
|
|
165
552
|
/**
|
|
166
553
|
* The parameters passed to a {@link DataPipelineHook} callback.
|
|
167
554
|
*/
|
|
@@ -177,7 +564,7 @@ export type DataPipelineParams<T extends object> = {
|
|
|
177
564
|
/**
|
|
178
565
|
* The type of data operation being performed.
|
|
179
566
|
*/
|
|
180
|
-
type: 'sort' | 'filter';
|
|
567
|
+
type: 'sort' | 'filter' | 'quickFilter' | 'pagination';
|
|
181
568
|
};
|
|
182
569
|
/**
|
|
183
570
|
* Callback function for customizing data operations in the grid.
|
|
@@ -195,4 +582,87 @@ export interface DataPipelineConfiguration<T extends object> {
|
|
|
195
582
|
* Hook for customizing filter operations.
|
|
196
583
|
*/
|
|
197
584
|
filter?: DataPipelineHook<T>;
|
|
585
|
+
/**
|
|
586
|
+
* Hook for customizing pagination operations.
|
|
587
|
+
*
|
|
588
|
+
* @remarks
|
|
589
|
+
* The hook receives the filtered + sorted data slice for the grid to render and the current
|
|
590
|
+
* pagination state. Return the page slice. For server-driven pagination, return the externally
|
|
591
|
+
* fetched page and report the row total via {@link ApexGrid.totalItems}.
|
|
592
|
+
*/
|
|
593
|
+
pagination?: DataPipelineHook<T>;
|
|
594
|
+
/**
|
|
595
|
+
* Hook for customizing quick (global) filter operations.
|
|
596
|
+
*
|
|
597
|
+
* @remarks
|
|
598
|
+
* Called before column filtering. Return the records that match the {@link ApexGrid.quickFilter}
|
|
599
|
+
* value. If omitted, the default substring matcher is used.
|
|
600
|
+
*/
|
|
601
|
+
quickFilter?: DataPipelineHook<T>;
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* The pagination mode for the grid.
|
|
605
|
+
*
|
|
606
|
+
* @remarks
|
|
607
|
+
* `'local'` — the grid slices the in-memory {@link ApexGrid.dataView} by `page` and `pageSize`.
|
|
608
|
+
* `'remote'` — the consumer drives data fetching; the grid emits paging events but does not
|
|
609
|
+
* slice the data. Use together with {@link DataPipelineConfiguration.pagination} or by setting
|
|
610
|
+
* `data` to the current page on `pageChanged`.
|
|
611
|
+
*/
|
|
612
|
+
export type PaginationMode = 'local' | 'remote';
|
|
613
|
+
/**
|
|
614
|
+
* Pagination configuration for the grid.
|
|
615
|
+
*/
|
|
616
|
+
export interface PaginationConfiguration {
|
|
617
|
+
/**
|
|
618
|
+
* Whether pagination is enabled.
|
|
619
|
+
*
|
|
620
|
+
* @remarks
|
|
621
|
+
* When `false`, the grid renders no paginator and applies no slicing — the full
|
|
622
|
+
* {@link ApexGrid.dataView} is virtualized as usual.
|
|
623
|
+
*/
|
|
624
|
+
enabled?: boolean;
|
|
625
|
+
/**
|
|
626
|
+
* The pagination mode. Defaults to `'local'`.
|
|
627
|
+
*/
|
|
628
|
+
mode?: PaginationMode;
|
|
629
|
+
/**
|
|
630
|
+
* The current page (zero-based). Defaults to `0`.
|
|
631
|
+
*/
|
|
632
|
+
page?: number;
|
|
633
|
+
/**
|
|
634
|
+
* The number of records per page. Defaults to `25`.
|
|
635
|
+
*/
|
|
636
|
+
pageSize?: number;
|
|
637
|
+
/**
|
|
638
|
+
* The list of page sizes offered in the paginator's page-size dropdown.
|
|
639
|
+
* Defaults to `[10, 25, 50, 100]`.
|
|
640
|
+
*/
|
|
641
|
+
pageSizeOptions?: number[];
|
|
642
|
+
/**
|
|
643
|
+
* In `'remote'` mode the consumer must supply the unfiltered row total so the paginator
|
|
644
|
+
* can compute the page count. Ignored in `'local'` mode.
|
|
645
|
+
*/
|
|
646
|
+
totalItems?: number;
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* Resolved pagination state passed to controllers and event payloads.
|
|
650
|
+
*/
|
|
651
|
+
export interface PaginationState {
|
|
652
|
+
/**
|
|
653
|
+
* The current page (zero-based).
|
|
654
|
+
*/
|
|
655
|
+
page: number;
|
|
656
|
+
/**
|
|
657
|
+
* The number of records per page.
|
|
658
|
+
*/
|
|
659
|
+
pageSize: number;
|
|
660
|
+
/**
|
|
661
|
+
* The total number of pages.
|
|
662
|
+
*/
|
|
663
|
+
pageCount: number;
|
|
664
|
+
/**
|
|
665
|
+
* The total number of records before pagination (after filter/sort).
|
|
666
|
+
*/
|
|
667
|
+
totalItems: number;
|
|
198
668
|
}
|
package/internal/types.js.map
CHANGED
|
@@ -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>> =\n K extends Keys<T> ? BasePropertyType<T, K> : 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 *\n * The remaining types are premium presentation renderers over primitive\n * values; for sorting / filtering they behave as their underlying value type:\n * - `'currency'` formats a number via `Intl.NumberFormat` (tabular, right\n * aligned). Configure with {@link BaseColumnConfiguration.currency} /\n * {@link BaseColumnConfiguration.locale}. Editable via a number input.\n * - `'avatar'` renders the value's first letter in a tinted circle (hue is\n * derived from the value, stable per row).\n * - `'badge'` renders the value as a colored pill. Pick the look with\n * {@link BaseColumnConfiguration.badgeVariant}.\n * - `'progress'` renders a number (0..`max`, default `max` 100) as a health\n * bar; the fill color tiers at ≥80 / ≥65 / below.\n * - `'sparkline'` renders a `number[]` as an inline trend chart with an\n * optional delta label ({@link BaseColumnConfiguration.showDelta}).\n * - `'status'` renders a pill with a leading dot. The state is taken from\n * {@link BaseColumnConfiguration.statusVariant} or inferred from the value.\n */\nexport type DataType =\n | 'number'\n | 'string'\n | 'boolean'\n | 'select'\n | 'rating'\n | 'date'\n | 'image'\n | 'currency'\n | 'avatar'\n | 'badge'\n | 'progress'\n | 'sparkline'\n | 'status';\n\n/** Visual variant for a `type: 'badge'` pill. */\nexport type BadgeVariant = 'gold' | 'brand' | 'neutral' | 'muted';\n\n/** State for a `type: 'status'` badge. */\nexport type StatusVariant = 'active' | 'trial' | 'churn';\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>> =\n K extends Keys<T> ? BaseColumnSortConfiguration<T, K> : 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 the enterprise grid's XLSX export).\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 * Upper bound for `type: 'rating'` and `type: 'progress'`.\n *\n * @remarks\n * For `'rating'` this is the star count (default `5`); the displayed value is\n * clamped to `[0, max]`. For `'progress'` this is the value that fills the bar\n * to 100% (default `100`). 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 * ISO 4217 currency code for `type: 'currency'` columns (e.g. `'USD'`,\n * `'EUR'`). Defaults to `'USD'`. Has no effect on columns with another\n * `type`.\n */\n currency?: string;\n /**\n * BCP 47 locale for `type: 'currency'` number formatting. Defaults to the\n * runtime locale. Has no effect on columns with another `type`.\n */\n locale?: string;\n /**\n * Visual variant for `type: 'badge'` columns. A literal applies to every\n * cell; a callback picks per value. Defaults to `'neutral'`. Has no effect\n * on columns with another `type`.\n */\n badgeVariant?: BadgeVariant | ((value: BasePropertyType<T, K>) => BadgeVariant);\n /**\n * State for `type: 'status'` columns. A literal applies to every cell; a\n * callback maps a value to a state. When omitted the state is inferred from\n * the value text. Has no effect on columns with another `type`.\n */\n statusVariant?: StatusVariant | ((value: BasePropertyType<T, K>) => StatusVariant);\n /**\n * Whether `type: 'sparkline'` columns render a trailing delta-% label.\n * Defaults to `true`. Has no effect on columns with another `type`.\n */\n showDelta?: boolean;\n}\n\n/**\n * See {@link BaseColumnConfiguration} for the full documentation.\n */\nexport type ColumnConfiguration<T extends object, K extends Keys<T> = Keys<T>> =\n K extends Keys<T> ? BaseColumnConfiguration<T, K> : 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>> =\n K extends Keys<T> ? BaseApexCellContext<T, K> : 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>> =\n K extends Keys<T> ? BaseApexEditorContext<T, K> : 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"]}
|
package/internal/utils.d.ts
CHANGED
|
@@ -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
|
-
|
|
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>>;
|