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.
- package/LICENSE +76 -5
- package/README.md +520 -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 +948 -1
- package/components/grid.js +403 -13
- 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 -25
- 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 +275 -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 +32 -0
- package/controllers/state.js +37 -0
- 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 +6142 -992
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/highlight.css +70 -14
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/ApexGrid.html +316 -19
- package/docs/functions/setup.html +22 -0
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +503 -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 +1 -1
- package/docs/interfaces/ApexFilteringEvent.html +3 -3
- package/docs/interfaces/ApexGridEventMap.html +58 -7
- package/docs/interfaces/ApexHeaderContext.html +1 -1
- 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 +9 -3
- package/docs/interfaces/BaseApexEditorContext.html +19 -0
- package/docs/interfaces/BaseColumnConfiguration.html +65 -10
- package/docs/interfaces/BaseColumnSortConfiguration.html +1 -1
- package/docs/interfaces/BaseFilterExpression.html +1 -1
- package/docs/interfaces/BaseSortExpression.html +1 -1
- package/docs/interfaces/CSVExportOptions.html +22 -0
- package/docs/interfaces/ColumnFilterConfiguration.html +1 -1
- package/docs/interfaces/DataPipelineConfiguration.html +13 -4
- 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 +1 -1
- package/docs/interfaces/GridTreeConfiguration.html +33 -0
- package/docs/interfaces/PaginationConfiguration.html +18 -0
- package/docs/interfaces/PaginationState.html +10 -0
- package/docs/interfaces/XLSXExportOptions.html +17 -0
- package/docs/media/package.json +83 -0
- package/docs/media/publish.yml +111 -0
- package/docs/modules.html +1 -1
- package/docs/types/ApexCellContext.html +1 -1
- package/docs/types/ApexEditorContext.html +2 -0
- package/docs/types/BasePropertyType.html +1 -1
- package/docs/types/BaseSortComparer.html +1 -1
- package/docs/types/ColumnConfiguration.html +1 -1
- package/docs/types/ColumnDropPosition.html +2 -0
- package/docs/types/ColumnSortConfiguration.html +1 -1
- package/docs/types/DataPipelineHook.html +1 -1
- package/docs/types/DataPipelineParams.html +3 -3
- package/docs/types/DataType.html +30 -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 +1 -1
- package/docs/types/FilterExpression.html +1 -1
- package/docs/types/Keys.html +1 -1
- package/docs/types/PaginationMode.html +6 -0
- package/docs/types/PinPosition.html +5 -0
- package/docs/types/PropertyType.html +1 -1
- package/docs/types/SelectionMode.html +7 -0
- package/docs/types/SortComparer.html +1 -1
- package/docs/types/SortExpression.html +1 -1
- package/docs/types/SortState.html +1 -1
- 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 +268 -0
- package/internal/column-types.js.map +1 -0
- package/internal/export.d.ts +106 -0
- package/internal/export.js +122 -0
- package/internal/export.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 +24 -0
- package/internal/icons.js +134 -0
- package/internal/icons.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/theming.js +1 -1
- package/internal/theming.js.map +1 -1
- package/internal/types.d.ts +424 -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/internal/xlsx.d.ts +22 -0
- package/internal/xlsx.js +228 -0
- package/internal/xlsx.js.map +1 -0
- 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/package.json +6 -5
- package/setup.d.ts +58 -0
- package/setup.js +29 -0
- package/setup.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-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/themes/light/grid.bootstrap.css.js +1 -1
- package/styles/grid/themes/light/grid.bootstrap.css.js.map +1 -1
- package/styles/grid/themes/light/grid.fluent.css.js +1 -1
- package/styles/grid/themes/light/grid.fluent.css.js.map +1 -1
- package/styles/grid/themes/light/grid.indigo.css.js +1 -1
- package/styles/grid/themes/light/grid.indigo.css.js.map +1 -1
- package/styles/grid/themes/light/grid.material.css.js +1 -1
- package/styles/grid/themes/light/grid.material.css.js.map +1 -1
- 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/components/grid.d.ts
CHANGED
|
@@ -3,13 +3,16 @@ import { nothing } from 'lit';
|
|
|
3
3
|
import { DataOperationsController } from '../controllers/data-operation.js';
|
|
4
4
|
import { GridDOMController } from '../controllers/dom.js';
|
|
5
5
|
import { StateController } from '../controllers/state.js';
|
|
6
|
+
import { type CSVExportOptions, type XLSXExportOptions } from '../internal/export.js';
|
|
6
7
|
import { EventEmitterBase } from '../internal/mixins/event-emitter.js';
|
|
7
|
-
import type { ColumnConfiguration, DataPipelineConfiguration, GridSortConfiguration, Keys } from '../internal/types.js';
|
|
8
|
+
import type { ColumnConfiguration, DataPipelineConfiguration, GridEditingConfiguration, GridExpansionConfiguration, GridSelectionConfiguration, GridSortConfiguration, GridTreeConfiguration, Keys, PaginationConfiguration, PaginationState, PinPosition } from '../internal/types.js';
|
|
8
9
|
import type { FilterExpression } from '../operations/filter/types.js';
|
|
9
10
|
import type { SortExpression } from '../operations/sort/types.js';
|
|
10
11
|
import ApexFilterRow from './filter-row.js';
|
|
11
12
|
import ApexGridHeaderRow from './header-row.js';
|
|
13
|
+
import ApexGridPaginator from './paginator.js';
|
|
12
14
|
import ApexGridRow from './row.js';
|
|
15
|
+
import ApexGridToolbar from './toolbar.js';
|
|
13
16
|
import ApexVirtualizer from './virtualizer.js';
|
|
14
17
|
/**
|
|
15
18
|
* Event object for the filtering event of the grid.
|
|
@@ -47,6 +50,287 @@ export interface ApexFilteredEvent<T extends object> {
|
|
|
47
50
|
*/
|
|
48
51
|
state: FilterExpression<T>[];
|
|
49
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Event payload for the cancellable `pageChanging` event.
|
|
55
|
+
*/
|
|
56
|
+
export interface ApexPageChangingEvent {
|
|
57
|
+
/**
|
|
58
|
+
* The current page (zero-based) before the change.
|
|
59
|
+
*/
|
|
60
|
+
page: number;
|
|
61
|
+
/**
|
|
62
|
+
* The current page size before the change.
|
|
63
|
+
*/
|
|
64
|
+
pageSize: number;
|
|
65
|
+
/**
|
|
66
|
+
* The proposed page (zero-based) the grid will navigate to.
|
|
67
|
+
*/
|
|
68
|
+
nextPage: number;
|
|
69
|
+
/**
|
|
70
|
+
* The proposed page size after the change.
|
|
71
|
+
*/
|
|
72
|
+
nextPageSize: number;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Event payload for the `pageChanged` event. Mirrors {@link PaginationState}.
|
|
76
|
+
*/
|
|
77
|
+
export interface ApexPageChangedEvent extends PaginationState {
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Event payload for the cancellable `quickFilterChanging` event.
|
|
81
|
+
*/
|
|
82
|
+
export interface ApexQuickFilterChangingEvent {
|
|
83
|
+
/**
|
|
84
|
+
* The current quick-filter value before the change.
|
|
85
|
+
*/
|
|
86
|
+
value: string;
|
|
87
|
+
/**
|
|
88
|
+
* The proposed quick-filter value.
|
|
89
|
+
*/
|
|
90
|
+
nextValue: string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Event payload for the `quickFilterChanged` event.
|
|
94
|
+
*/
|
|
95
|
+
export interface ApexQuickFilterChangedEvent {
|
|
96
|
+
/**
|
|
97
|
+
* The resolved quick-filter value after the change.
|
|
98
|
+
*/
|
|
99
|
+
value: string;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Drop position relative to a target column when reordering.
|
|
103
|
+
*/
|
|
104
|
+
export type ColumnDropPosition = 'before' | 'after';
|
|
105
|
+
/**
|
|
106
|
+
* Event payload for the cancellable `cellValueChanging` event.
|
|
107
|
+
*/
|
|
108
|
+
export interface ApexCellValueChangingEvent<T extends object> {
|
|
109
|
+
/**
|
|
110
|
+
* The column key of the edited cell.
|
|
111
|
+
*/
|
|
112
|
+
key: Keys<T>;
|
|
113
|
+
/**
|
|
114
|
+
* The view-relative row index (matches {@link ApexGrid.pageItems}).
|
|
115
|
+
*/
|
|
116
|
+
rowIndex: number;
|
|
117
|
+
/**
|
|
118
|
+
* The data record being edited (a live reference to the row in
|
|
119
|
+
* {@link ApexGrid.data}).
|
|
120
|
+
*/
|
|
121
|
+
data: T;
|
|
122
|
+
/**
|
|
123
|
+
* The value before the edit.
|
|
124
|
+
*/
|
|
125
|
+
oldValue: unknown;
|
|
126
|
+
/**
|
|
127
|
+
* The candidate new value.
|
|
128
|
+
*/
|
|
129
|
+
newValue: unknown;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Event payload for the `cellValueChanged` event.
|
|
133
|
+
*/
|
|
134
|
+
export interface ApexCellValueChangedEvent<T extends object> {
|
|
135
|
+
/**
|
|
136
|
+
* The column key of the edited cell.
|
|
137
|
+
*/
|
|
138
|
+
key: Keys<T>;
|
|
139
|
+
/**
|
|
140
|
+
* The view-relative row index after the change.
|
|
141
|
+
*/
|
|
142
|
+
rowIndex: number;
|
|
143
|
+
/**
|
|
144
|
+
* The data record after the change (a live reference to the row in
|
|
145
|
+
* {@link ApexGrid.data}).
|
|
146
|
+
*/
|
|
147
|
+
data: T;
|
|
148
|
+
/**
|
|
149
|
+
* The applied value.
|
|
150
|
+
*/
|
|
151
|
+
value: unknown;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Event payload for the `rowEditStarted` event.
|
|
155
|
+
*/
|
|
156
|
+
export interface ApexRowEditStartedEvent {
|
|
157
|
+
/**
|
|
158
|
+
* The view-relative row index entering edit mode.
|
|
159
|
+
*/
|
|
160
|
+
rowIndex: number;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Event payload for the `rowEditEnded` event.
|
|
164
|
+
*/
|
|
165
|
+
export interface ApexRowEditEndedEvent {
|
|
166
|
+
/**
|
|
167
|
+
* The view-relative row index that left edit mode.
|
|
168
|
+
*/
|
|
169
|
+
rowIndex: number;
|
|
170
|
+
/**
|
|
171
|
+
* `true` when pending edits were applied, `false` when discarded.
|
|
172
|
+
*/
|
|
173
|
+
committed: boolean;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Event payload for the cancellable `columnMoving` event.
|
|
177
|
+
*/
|
|
178
|
+
export interface ApexColumnMovingEvent<T extends object> {
|
|
179
|
+
/**
|
|
180
|
+
* The column being moved.
|
|
181
|
+
*/
|
|
182
|
+
key: Keys<T>;
|
|
183
|
+
/**
|
|
184
|
+
* The current index of the moving column in {@link ApexGrid.columns}.
|
|
185
|
+
*/
|
|
186
|
+
fromIndex: number;
|
|
187
|
+
/**
|
|
188
|
+
* The target column key. The dragged column will be placed `position`
|
|
189
|
+
* (before/after) this column.
|
|
190
|
+
*/
|
|
191
|
+
toKey: Keys<T>;
|
|
192
|
+
/**
|
|
193
|
+
* Whether the dragged column is being placed before or after `toKey`.
|
|
194
|
+
*/
|
|
195
|
+
position: ColumnDropPosition;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Event payload for the `columnMoved` event.
|
|
199
|
+
*/
|
|
200
|
+
export interface ApexColumnMovedEvent<T extends object> {
|
|
201
|
+
/**
|
|
202
|
+
* The column that was moved.
|
|
203
|
+
*/
|
|
204
|
+
key: Keys<T>;
|
|
205
|
+
/**
|
|
206
|
+
* The original index in {@link ApexGrid.columns}.
|
|
207
|
+
*/
|
|
208
|
+
fromIndex: number;
|
|
209
|
+
/**
|
|
210
|
+
* The resolved index in {@link ApexGrid.columns} after the move.
|
|
211
|
+
*/
|
|
212
|
+
toIndex: number;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Event payload for the cancellable `rowSelecting` event.
|
|
216
|
+
*/
|
|
217
|
+
export interface ApexRowSelectingEvent<T extends object> {
|
|
218
|
+
/**
|
|
219
|
+
* The rows that will become selected by this change.
|
|
220
|
+
*/
|
|
221
|
+
added: T[];
|
|
222
|
+
/**
|
|
223
|
+
* The rows that will become deselected by this change.
|
|
224
|
+
*/
|
|
225
|
+
removed: T[];
|
|
226
|
+
/**
|
|
227
|
+
* The full current selection before this change is applied.
|
|
228
|
+
*/
|
|
229
|
+
current: T[];
|
|
230
|
+
/**
|
|
231
|
+
* The full selection after this change would be applied. Listeners can
|
|
232
|
+
* inspect this to decide whether to cancel.
|
|
233
|
+
*/
|
|
234
|
+
next: T[];
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Event payload for the `rowSelected` event.
|
|
238
|
+
*/
|
|
239
|
+
export interface ApexRowSelectedEvent<T extends object> {
|
|
240
|
+
/**
|
|
241
|
+
* The rows that became selected in this change.
|
|
242
|
+
*/
|
|
243
|
+
added: T[];
|
|
244
|
+
/**
|
|
245
|
+
* The rows that became deselected in this change.
|
|
246
|
+
*/
|
|
247
|
+
removed: T[];
|
|
248
|
+
/**
|
|
249
|
+
* The full current selection after the change has been applied.
|
|
250
|
+
*/
|
|
251
|
+
selected: T[];
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Event payload for the cancellable `treeRowExpanding` event.
|
|
255
|
+
*/
|
|
256
|
+
export interface ApexTreeRowExpandingEvent<T extends object> {
|
|
257
|
+
/** Rows that will become expanded by this change. */
|
|
258
|
+
added: T[];
|
|
259
|
+
/** Rows that will become collapsed by this change. */
|
|
260
|
+
removed: T[];
|
|
261
|
+
/** The full current tree-expansion set before this change is applied. */
|
|
262
|
+
current: T[];
|
|
263
|
+
/** The full set after this change would be applied. */
|
|
264
|
+
next: T[];
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Event payload for the `treeRowExpanded` event.
|
|
268
|
+
*/
|
|
269
|
+
export interface ApexTreeRowExpandedEvent<T extends object> {
|
|
270
|
+
/** Rows that became expanded in this change. */
|
|
271
|
+
added: T[];
|
|
272
|
+
/** Rows that became collapsed in this change. */
|
|
273
|
+
removed: T[];
|
|
274
|
+
/** The full tree-expansion set after the change has been applied. */
|
|
275
|
+
expanded: T[];
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Event payload for the cancellable `rowExpanding` event.
|
|
279
|
+
*/
|
|
280
|
+
export interface ApexRowExpandingEvent<T extends object> {
|
|
281
|
+
/** The rows that will become expanded by this change. */
|
|
282
|
+
added: T[];
|
|
283
|
+
/** The rows that will become collapsed by this change. */
|
|
284
|
+
removed: T[];
|
|
285
|
+
/** The full current expansion set before this change is applied. */
|
|
286
|
+
current: T[];
|
|
287
|
+
/**
|
|
288
|
+
* The full expansion set after this change would be applied. Listeners can
|
|
289
|
+
* inspect this to decide whether to cancel.
|
|
290
|
+
*/
|
|
291
|
+
next: T[];
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Event payload for the `rowExpanded` event.
|
|
295
|
+
*/
|
|
296
|
+
export interface ApexRowExpandedEvent<T extends object> {
|
|
297
|
+
/** The rows that became expanded in this change. */
|
|
298
|
+
added: T[];
|
|
299
|
+
/** The rows that became collapsed in this change. */
|
|
300
|
+
removed: T[];
|
|
301
|
+
/** The full expansion set after the change has been applied. */
|
|
302
|
+
expanded: T[];
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Event payload for the cancellable `columnPinning` event.
|
|
306
|
+
*/
|
|
307
|
+
export interface ApexColumnPinningEvent<T extends object> {
|
|
308
|
+
/**
|
|
309
|
+
* The target column key.
|
|
310
|
+
*/
|
|
311
|
+
key: Keys<T>;
|
|
312
|
+
/**
|
|
313
|
+
* The current pin position before the change (`null` if unpinned).
|
|
314
|
+
*/
|
|
315
|
+
previous: PinPosition;
|
|
316
|
+
/**
|
|
317
|
+
* The proposed pin position (`null` to unpin).
|
|
318
|
+
*/
|
|
319
|
+
next: PinPosition;
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Event payload for the `columnPinned` event.
|
|
323
|
+
*/
|
|
324
|
+
export interface ApexColumnPinnedEvent<T extends object> {
|
|
325
|
+
/**
|
|
326
|
+
* The target column key.
|
|
327
|
+
*/
|
|
328
|
+
key: Keys<T>;
|
|
329
|
+
/**
|
|
330
|
+
* The resolved pin position after the change.
|
|
331
|
+
*/
|
|
332
|
+
pinned: PinPosition;
|
|
333
|
+
}
|
|
50
334
|
/**
|
|
51
335
|
* Events for the apex-grid.
|
|
52
336
|
*/
|
|
@@ -86,6 +370,150 @@ export interface ApexGridEventMap<T extends object> {
|
|
|
86
370
|
* @event
|
|
87
371
|
*/
|
|
88
372
|
filtered: CustomEvent<ApexFilteredEvent<T>>;
|
|
373
|
+
/**
|
|
374
|
+
* Emitted before the grid navigates to a new page or applies a new page size.
|
|
375
|
+
*
|
|
376
|
+
* @remarks
|
|
377
|
+
* Cancellable — calling `preventDefault()` (or returning a falsy result from
|
|
378
|
+
* `addEventListener` synchronously) aborts the page change.
|
|
379
|
+
*
|
|
380
|
+
* @event
|
|
381
|
+
*/
|
|
382
|
+
pageChanging: CustomEvent<ApexPageChangingEvent>;
|
|
383
|
+
/**
|
|
384
|
+
* Emitted after a page or page-size change has been applied and the pipeline has run.
|
|
385
|
+
*
|
|
386
|
+
* @event
|
|
387
|
+
*/
|
|
388
|
+
pageChanged: CustomEvent<ApexPageChangedEvent>;
|
|
389
|
+
/**
|
|
390
|
+
* Emitted before the quick-filter value is applied.
|
|
391
|
+
*
|
|
392
|
+
* @remarks
|
|
393
|
+
* Cancellable — calling `preventDefault()` aborts the change. The value can
|
|
394
|
+
* be replaced inside the listener by reassigning {@link ApexGrid.quickFilter}.
|
|
395
|
+
*
|
|
396
|
+
* @event
|
|
397
|
+
*/
|
|
398
|
+
quickFilterChanging: CustomEvent<ApexQuickFilterChangingEvent>;
|
|
399
|
+
/**
|
|
400
|
+
* Emitted after a quick-filter change has been applied and the pipeline has run.
|
|
401
|
+
*
|
|
402
|
+
* @event
|
|
403
|
+
*/
|
|
404
|
+
quickFilterChanged: CustomEvent<ApexQuickFilterChangedEvent>;
|
|
405
|
+
/**
|
|
406
|
+
* Emitted before a column's pin position changes.
|
|
407
|
+
*
|
|
408
|
+
* @remarks
|
|
409
|
+
* Cancellable — calling `preventDefault()` aborts the change.
|
|
410
|
+
*
|
|
411
|
+
* @event
|
|
412
|
+
*/
|
|
413
|
+
columnPinning: CustomEvent<ApexColumnPinningEvent<T>>;
|
|
414
|
+
/**
|
|
415
|
+
* Emitted after a column's pin position change has been applied.
|
|
416
|
+
*
|
|
417
|
+
* @event
|
|
418
|
+
*/
|
|
419
|
+
columnPinned: CustomEvent<ApexColumnPinnedEvent<T>>;
|
|
420
|
+
/**
|
|
421
|
+
* Emitted before a column is moved through the UI or {@link ApexGrid.moveColumn}.
|
|
422
|
+
*
|
|
423
|
+
* @remarks
|
|
424
|
+
* Cancellable — calling `preventDefault()` aborts the move. The event detail
|
|
425
|
+
* carries the source column key, its current array index, the target column
|
|
426
|
+
* key and the drop position.
|
|
427
|
+
*
|
|
428
|
+
* @event
|
|
429
|
+
*/
|
|
430
|
+
columnMoving: CustomEvent<ApexColumnMovingEvent<T>>;
|
|
431
|
+
/**
|
|
432
|
+
* Emitted after a column has been moved.
|
|
433
|
+
*
|
|
434
|
+
* @event
|
|
435
|
+
*/
|
|
436
|
+
columnMoved: CustomEvent<ApexColumnMovedEvent<T>>;
|
|
437
|
+
/**
|
|
438
|
+
* Emitted before a cell value is committed.
|
|
439
|
+
*
|
|
440
|
+
* @remarks
|
|
441
|
+
* Cancellable — `preventDefault()` rolls back the candidate value. In row
|
|
442
|
+
* edit mode the event still fires per-cell at commit time.
|
|
443
|
+
*
|
|
444
|
+
* @event
|
|
445
|
+
*/
|
|
446
|
+
cellValueChanging: CustomEvent<ApexCellValueChangingEvent<T>>;
|
|
447
|
+
/**
|
|
448
|
+
* Emitted after a cell value has been committed.
|
|
449
|
+
*
|
|
450
|
+
* @event
|
|
451
|
+
*/
|
|
452
|
+
cellValueChanged: CustomEvent<ApexCellValueChangedEvent<T>>;
|
|
453
|
+
/**
|
|
454
|
+
* Emitted when a row enters edit mode (row edit mode only).
|
|
455
|
+
*
|
|
456
|
+
* @event
|
|
457
|
+
*/
|
|
458
|
+
rowEditStarted: CustomEvent<ApexRowEditStartedEvent>;
|
|
459
|
+
/**
|
|
460
|
+
* Emitted when a row leaves edit mode, with `committed` reporting whether
|
|
461
|
+
* pending edits were applied (row edit mode only).
|
|
462
|
+
*
|
|
463
|
+
* @event
|
|
464
|
+
*/
|
|
465
|
+
rowEditEnded: CustomEvent<ApexRowEditEndedEvent>;
|
|
466
|
+
/**
|
|
467
|
+
* Emitted before the row selection set changes.
|
|
468
|
+
*
|
|
469
|
+
* @remarks
|
|
470
|
+
* Cancellable — calling `preventDefault()` aborts the selection change.
|
|
471
|
+
* Fires for every selection-mutating call (toggle, range select, select-all,
|
|
472
|
+
* programmatic `selectedRows = ...`).
|
|
473
|
+
*
|
|
474
|
+
* @event
|
|
475
|
+
*/
|
|
476
|
+
/**
|
|
477
|
+
* Emitted before the tree-row expansion set changes.
|
|
478
|
+
*
|
|
479
|
+
* @remarks
|
|
480
|
+
* Fires only when {@link ApexGrid.tree} is enabled and a row's tree
|
|
481
|
+
* expansion is toggled (via the chevron, the public API, or
|
|
482
|
+
* `expand-all/collapse-all`). Cancellable.
|
|
483
|
+
*
|
|
484
|
+
* @event
|
|
485
|
+
*/
|
|
486
|
+
treeRowExpanding: CustomEvent<ApexTreeRowExpandingEvent<T>>;
|
|
487
|
+
/**
|
|
488
|
+
* Emitted after a tree-row expansion change has been applied.
|
|
489
|
+
*
|
|
490
|
+
* @event
|
|
491
|
+
*/
|
|
492
|
+
treeRowExpanded: CustomEvent<ApexTreeRowExpandedEvent<T>>;
|
|
493
|
+
/**
|
|
494
|
+
* Emitted before the row expansion set changes.
|
|
495
|
+
*
|
|
496
|
+
* @remarks
|
|
497
|
+
* Cancellable — calling `preventDefault()` aborts the change. Fires for
|
|
498
|
+
* every expansion-mutating call (toggle, expand-all, programmatic
|
|
499
|
+
* `expandedRows = ...`).
|
|
500
|
+
*
|
|
501
|
+
* @event
|
|
502
|
+
*/
|
|
503
|
+
rowExpanding: CustomEvent<ApexRowExpandingEvent<T>>;
|
|
504
|
+
/**
|
|
505
|
+
* Emitted after a row-expansion change has been applied.
|
|
506
|
+
*
|
|
507
|
+
* @event
|
|
508
|
+
*/
|
|
509
|
+
rowExpanded: CustomEvent<ApexRowExpandedEvent<T>>;
|
|
510
|
+
rowSelecting: CustomEvent<ApexRowSelectingEvent<T>>;
|
|
511
|
+
/**
|
|
512
|
+
* Emitted after a row-selection change has been applied.
|
|
513
|
+
*
|
|
514
|
+
* @event
|
|
515
|
+
*/
|
|
516
|
+
rowSelected: CustomEvent<ApexRowSelectedEvent<T>>;
|
|
89
517
|
}
|
|
90
518
|
/**
|
|
91
519
|
* Apex grid is a web component for displaying data in a tabular format quick and easy.
|
|
@@ -93,17 +521,55 @@ export interface ApexGridEventMap<T extends object> {
|
|
|
93
521
|
* Out of the box it provides row virtualization, sort and filter operations (client and server side),
|
|
94
522
|
* the ability to template cells and headers and column hiding.
|
|
95
523
|
*
|
|
524
|
+
* @remarks
|
|
525
|
+
* A working, styled grid requires four setup steps:
|
|
526
|
+
* 1. Register the element: `import 'apex-grid/define'` (or `ApexGrid.register()`).
|
|
527
|
+
* 2. Configure an Ignite UI theme + import the matching CSS, e.g.
|
|
528
|
+
* `import { configureTheme } from 'igniteui-webcomponents';`
|
|
529
|
+
* `import 'igniteui-webcomponents/themes/light/bootstrap.css';`
|
|
530
|
+
* `configureTheme('bootstrap');`
|
|
531
|
+
* 3. Give the host element a bounded height, e.g. `apex-grid { height: 480px }` —
|
|
532
|
+
* the virtualizer collapses without one.
|
|
533
|
+
* 4. Do NOT set `display` on the host — the component declares `:host { display: grid }`
|
|
534
|
+
* internally and any override breaks the track layout.
|
|
535
|
+
*
|
|
536
|
+
* See the README "Getting Started" section for the full example.
|
|
537
|
+
*
|
|
96
538
|
* @element apex-grid
|
|
97
539
|
*
|
|
98
540
|
* @fires sorting - Emitted when sorting is initiated through the UI.
|
|
99
541
|
* @fires sorted - Emitted when a sort operation initiated through the UI has completed.
|
|
100
542
|
* @fires filtering - Emitted when filtering is initiated through the UI.
|
|
101
543
|
* @fires filtered - Emitted when a filter operation initiated through the UI has completed.
|
|
544
|
+
* @fires pageChanging - Cancellable. Emitted before page/page-size changes are applied.
|
|
545
|
+
* @fires pageChanged - Emitted after a page/page-size change has been applied.
|
|
546
|
+
* @fires quickFilterChanging - Cancellable. Emitted before a quick-filter value is applied.
|
|
547
|
+
* @fires quickFilterChanged - Emitted after a quick-filter change has been applied.
|
|
548
|
+
* @fires columnPinning - Cancellable. Emitted before a column's pin position changes.
|
|
549
|
+
* @fires columnPinned - Emitted after a column's pin position has changed.
|
|
550
|
+
* @fires columnMoving - Cancellable. Emitted before a column is moved.
|
|
551
|
+
* @fires columnMoved - Emitted after a column has been moved.
|
|
552
|
+
* @fires cellValueChanging - Cancellable. Emitted before a cell value is committed.
|
|
553
|
+
* @fires cellValueChanged - Emitted after a cell value has been committed.
|
|
554
|
+
* @fires rowEditStarted - Emitted when a row enters edit mode (row mode only).
|
|
555
|
+
* @fires rowEditEnded - Emitted when a row leaves edit mode (row mode only).
|
|
556
|
+
* @fires rowSelecting - Cancellable. Emitted before a selection-set change is applied.
|
|
557
|
+
* @fires rowSelected - Emitted after a selection-set change has been applied.
|
|
102
558
|
*
|
|
103
559
|
*/
|
|
104
560
|
export declare class ApexGrid<T extends object> extends EventEmitterBase<ApexGridEventMap<T>> {
|
|
105
561
|
static get tagName(): "apex-grid";
|
|
106
562
|
static styles: import("lit").CSSResult;
|
|
563
|
+
/**
|
|
564
|
+
* Registers `<apex-grid>` and its internal dependencies with the custom-element
|
|
565
|
+
* registry. Idempotent — safe to call more than once.
|
|
566
|
+
*
|
|
567
|
+
* @remarks
|
|
568
|
+
* Registering the element is only step one of four required for a visible, styled
|
|
569
|
+
* grid. You must also configure an Ignite UI theme + CSS, give the host a bounded
|
|
570
|
+
* height, and avoid overriding `display` on the host. See the README
|
|
571
|
+
* "Getting Started" section for the full setup.
|
|
572
|
+
*/
|
|
107
573
|
static register(): void;
|
|
108
574
|
protected stateController: StateController<T>;
|
|
109
575
|
protected DOM: GridDOMController<T>;
|
|
@@ -114,6 +580,8 @@ export declare class ApexGrid<T extends object> extends EventEmitterBase<ApexGri
|
|
|
114
580
|
protected scrollContainer: ApexVirtualizer;
|
|
115
581
|
protected headerRow: ApexGridHeaderRow<T>;
|
|
116
582
|
protected filterRow: ApexFilterRow<T>;
|
|
583
|
+
protected paginator: ApexGridPaginator<T>;
|
|
584
|
+
protected toolbar: ApexGridToolbar<T>;
|
|
117
585
|
protected dataState: Array<T>;
|
|
118
586
|
protected _rows: NodeListOf<ApexGridRow<T>>;
|
|
119
587
|
/** Column configuration for the grid. */
|
|
@@ -151,6 +619,233 @@ export declare class ApexGrid<T extends object> extends EventEmitterBase<ApexGri
|
|
|
151
619
|
* Configuration object which controls remote data operations for the grid.
|
|
152
620
|
*/
|
|
153
621
|
dataPipelineConfiguration: DataPipelineConfiguration<T>;
|
|
622
|
+
/**
|
|
623
|
+
* Pagination configuration for the grid.
|
|
624
|
+
*
|
|
625
|
+
* @remarks
|
|
626
|
+
* Pagination is disabled by default. Set `enabled: true` and (optionally) `pageSize`
|
|
627
|
+
* to render the built-in `<apex-grid-paginator>` and slice the dataView. For
|
|
628
|
+
* server-side pagination set `mode: 'remote'` and supply `totalItems`. The grid
|
|
629
|
+
* emits the cancellable `pageChanging` event before applying a change and the
|
|
630
|
+
* `pageChanged` event after the pipeline has run.
|
|
631
|
+
*
|
|
632
|
+
* @example
|
|
633
|
+
* ```ts
|
|
634
|
+
* grid.pagination = { enabled: true, pageSize: 25 };
|
|
635
|
+
* grid.addEventListener('pageChanged', (event) => {
|
|
636
|
+
* console.log('Now on page', event.detail.page, 'of', event.detail.pageCount);
|
|
637
|
+
* });
|
|
638
|
+
* ```
|
|
639
|
+
*/
|
|
640
|
+
pagination?: PaginationConfiguration;
|
|
641
|
+
/**
|
|
642
|
+
* The quick-filter (global search) value applied to the dataView.
|
|
643
|
+
*
|
|
644
|
+
* @remarks
|
|
645
|
+
* When non-empty, the grid filters records whose visible-column values contain
|
|
646
|
+
* the term (case-insensitive substring match). Customise by providing
|
|
647
|
+
* {@link DataPipelineConfiguration.quickFilter}.
|
|
648
|
+
*
|
|
649
|
+
* @attr quick-filter
|
|
650
|
+
*/
|
|
651
|
+
quickFilter: string;
|
|
652
|
+
/**
|
|
653
|
+
* Whether the built-in quick-filter input is rendered in the toolbar.
|
|
654
|
+
*
|
|
655
|
+
* @remarks
|
|
656
|
+
* The {@link ApexGrid.quickFilter} value can be controlled programmatically
|
|
657
|
+
* regardless of this flag; this only controls the toolbar input UI.
|
|
658
|
+
*
|
|
659
|
+
* @attr show-quick-filter
|
|
660
|
+
*/
|
|
661
|
+
showQuickFilter: boolean;
|
|
662
|
+
/**
|
|
663
|
+
* Whether the built-in export menu is rendered in the toolbar.
|
|
664
|
+
*
|
|
665
|
+
* @remarks
|
|
666
|
+
* When `true`, the toolbar shows a download button on the trailing side;
|
|
667
|
+
* clicking it opens a menu with "Export CSV" and "Export XLSX" entries
|
|
668
|
+
* that call {@link ApexGrid.exportToCSV} and {@link ApexGrid.exportToXLSX}
|
|
669
|
+
* respectively. Both methods remain callable programmatically regardless
|
|
670
|
+
* of this flag.
|
|
671
|
+
*
|
|
672
|
+
* @attr show-export
|
|
673
|
+
*/
|
|
674
|
+
showExport: boolean;
|
|
675
|
+
/**
|
|
676
|
+
* Enables drag-and-drop column reordering on the column headers.
|
|
677
|
+
*
|
|
678
|
+
* @remarks
|
|
679
|
+
* Per-column opt-out is available through {@link BaseColumnConfiguration.reorderable}.
|
|
680
|
+
* Reordering is constrained to a column's own pinning group — start-pinned
|
|
681
|
+
* columns can only swap with start-pinned, unpinned with unpinned, and
|
|
682
|
+
* end-pinned with end-pinned.
|
|
683
|
+
*
|
|
684
|
+
* @attr column-reordering
|
|
685
|
+
*/
|
|
686
|
+
columnReordering: boolean;
|
|
687
|
+
/**
|
|
688
|
+
* Inline editing configuration for the grid.
|
|
689
|
+
*
|
|
690
|
+
* @remarks
|
|
691
|
+
* Editing is disabled by default. Set `enabled: true` and (optionally) `mode`
|
|
692
|
+
* (`'cell' | 'row'`) and `trigger` (`'click' | 'doubleClick'`) to opt in.
|
|
693
|
+
* Per-column opt-in is required via {@link BaseColumnConfiguration.editable}.
|
|
694
|
+
*
|
|
695
|
+
* @example
|
|
696
|
+
* ```ts
|
|
697
|
+
* grid.editing = { enabled: true, mode: 'cell', trigger: 'doubleClick' };
|
|
698
|
+
* ```
|
|
699
|
+
*/
|
|
700
|
+
editing?: GridEditingConfiguration;
|
|
701
|
+
/**
|
|
702
|
+
* Row selection configuration for the grid.
|
|
703
|
+
*
|
|
704
|
+
* @remarks
|
|
705
|
+
* Selection is disabled by default. Set `enabled: true` and (optionally)
|
|
706
|
+
* `mode` (`'single' | 'multiple'`) and `showCheckboxColumn` to opt in.
|
|
707
|
+
*
|
|
708
|
+
* @example
|
|
709
|
+
* ```ts
|
|
710
|
+
* grid.selection = { enabled: true, mode: 'multiple', showCheckboxColumn: true };
|
|
711
|
+
* ```
|
|
712
|
+
*/
|
|
713
|
+
selection?: GridSelectionConfiguration;
|
|
714
|
+
/**
|
|
715
|
+
* The currently selected rows, in insertion order.
|
|
716
|
+
*
|
|
717
|
+
* @remarks
|
|
718
|
+
* Returned as a plain array snapshot — mutating the returned array does
|
|
719
|
+
* not change the grid's selection. Set this property to replace the
|
|
720
|
+
* selection programmatically (goes through the cancellable
|
|
721
|
+
* `rowSelecting` event).
|
|
722
|
+
*/
|
|
723
|
+
get selectedRows(): T[];
|
|
724
|
+
set selectedRows(rows: ReadonlyArray<T>);
|
|
725
|
+
/**
|
|
726
|
+
* Selects `row`, replacing the existing selection in `'single'` mode or
|
|
727
|
+
* adding to it in `'multiple'` mode.
|
|
728
|
+
*
|
|
729
|
+
* @returns `true` if the selection changed, `false` if the change was
|
|
730
|
+
* rejected by a `rowSelecting` listener or selection is disabled.
|
|
731
|
+
*/
|
|
732
|
+
selectRow(row: T): Promise<boolean>;
|
|
733
|
+
/**
|
|
734
|
+
* Deselects `row`. No-op if `row` is not currently selected.
|
|
735
|
+
*/
|
|
736
|
+
deselectRow(row: T): Promise<boolean>;
|
|
737
|
+
/**
|
|
738
|
+
* Toggles selection of `row`.
|
|
739
|
+
*/
|
|
740
|
+
toggleRowSelection(row: T): Promise<boolean>;
|
|
741
|
+
/**
|
|
742
|
+
* Selects every row in the current view ({@link dataView}). No-op in
|
|
743
|
+
* `'single'` selection mode.
|
|
744
|
+
*/
|
|
745
|
+
selectAllRows(): Promise<boolean>;
|
|
746
|
+
/**
|
|
747
|
+
* Clears the row selection.
|
|
748
|
+
*/
|
|
749
|
+
clearSelection(): Promise<boolean>;
|
|
750
|
+
/**
|
|
751
|
+
* Whether `row` is currently selected.
|
|
752
|
+
*/
|
|
753
|
+
isRowSelected(row: T): boolean;
|
|
754
|
+
/**
|
|
755
|
+
* Row-expansion (master-detail) configuration for the grid.
|
|
756
|
+
*
|
|
757
|
+
* @remarks
|
|
758
|
+
* Expansion is disabled by default. Set `enabled: true` and supply a
|
|
759
|
+
* `detailTemplate` to opt in. The default UX renders a chevron toggle in a
|
|
760
|
+
* dedicated leading column; set `showToggleColumn: false` to drive
|
|
761
|
+
* expansion entirely through the public API or a custom cell template.
|
|
762
|
+
*
|
|
763
|
+
* @example
|
|
764
|
+
* ```ts
|
|
765
|
+
* grid.expansion = {
|
|
766
|
+
* enabled: true,
|
|
767
|
+
* detailTemplate: ({ data }) => html`<order-summary .order=${data}></order-summary>`,
|
|
768
|
+
* };
|
|
769
|
+
* ```
|
|
770
|
+
*/
|
|
771
|
+
expansion?: GridExpansionConfiguration<T>;
|
|
772
|
+
/**
|
|
773
|
+
* The currently expanded rows, in insertion order.
|
|
774
|
+
*
|
|
775
|
+
* @remarks
|
|
776
|
+
* Returned as a plain array snapshot — mutating the returned array does
|
|
777
|
+
* not change the grid's expansion state. Set this property to replace the
|
|
778
|
+
* expansion set programmatically (goes through the cancellable
|
|
779
|
+
* `rowExpanding` event).
|
|
780
|
+
*/
|
|
781
|
+
get expandedRows(): T[];
|
|
782
|
+
set expandedRows(rows: ReadonlyArray<T>);
|
|
783
|
+
/**
|
|
784
|
+
* Expands `row`. No-op when the row is already expanded, expansion is
|
|
785
|
+
* disabled, or the optional `isExpandable` predicate rejects it.
|
|
786
|
+
*/
|
|
787
|
+
expandRow(row: T): Promise<boolean>;
|
|
788
|
+
/**
|
|
789
|
+
* Collapses `row`. No-op when the row is not currently expanded.
|
|
790
|
+
*/
|
|
791
|
+
collapseRow(row: T): Promise<boolean>;
|
|
792
|
+
/**
|
|
793
|
+
* Toggles expansion of `row`.
|
|
794
|
+
*/
|
|
795
|
+
toggleRowExpansion(row: T): Promise<boolean>;
|
|
796
|
+
/**
|
|
797
|
+
* Expands every row in {@link ApexGrid.dataView} that passes the optional
|
|
798
|
+
* `isExpandable` predicate.
|
|
799
|
+
*/
|
|
800
|
+
expandAllRows(): Promise<boolean>;
|
|
801
|
+
/**
|
|
802
|
+
* Collapses every currently expanded row.
|
|
803
|
+
*/
|
|
804
|
+
collapseAllRows(): Promise<boolean>;
|
|
805
|
+
/**
|
|
806
|
+
* Whether `row` is currently expanded.
|
|
807
|
+
*/
|
|
808
|
+
isRowExpanded(row: T): boolean;
|
|
809
|
+
/**
|
|
810
|
+
* Tree-data (nested rows) configuration for the grid.
|
|
811
|
+
*
|
|
812
|
+
* @remarks
|
|
813
|
+
* Tree mode keeps {@link ApexGrid.data} flat; the grid derives the
|
|
814
|
+
* hierarchy from a user-supplied `getDataPath(row)` callback (AG Grid's
|
|
815
|
+
* "tree data" pattern). When enabled, the first visible data column (or
|
|
816
|
+
* the column referenced by `groupColumnKey`) renders a chevron toggle
|
|
817
|
+
* and depth-based indentation.
|
|
818
|
+
*
|
|
819
|
+
* @example
|
|
820
|
+
* ```ts
|
|
821
|
+
* grid.tree = {
|
|
822
|
+
* enabled: true,
|
|
823
|
+
* getDataPath: (row) => row.path, // e.g., ['Adrian'], ['Adrian', 'Bryan']
|
|
824
|
+
* defaultExpanded: true,
|
|
825
|
+
* };
|
|
826
|
+
* ```
|
|
827
|
+
*/
|
|
828
|
+
tree?: GridTreeConfiguration<T>;
|
|
829
|
+
/**
|
|
830
|
+
* Toggles tree-expansion of `row`. No-op when tree mode is disabled or
|
|
831
|
+
* the row has no children.
|
|
832
|
+
*/
|
|
833
|
+
toggleTreeRow(row: T): Promise<boolean>;
|
|
834
|
+
/**
|
|
835
|
+
* Expands a tree row. No-op when the row is already expanded, has no
|
|
836
|
+
* children, or tree mode is disabled.
|
|
837
|
+
*/
|
|
838
|
+
expandTreeRow(row: T): Promise<boolean>;
|
|
839
|
+
/**
|
|
840
|
+
* Collapses a tree row. No-op when the row is not currently expanded.
|
|
841
|
+
*/
|
|
842
|
+
collapseTreeRow(row: T): Promise<boolean>;
|
|
843
|
+
/** Expands every parent row in the current tree. */
|
|
844
|
+
expandAllTreeRows(): Promise<boolean>;
|
|
845
|
+
/** Collapses every currently-expanded tree row. */
|
|
846
|
+
collapseAllTreeRows(): Promise<boolean>;
|
|
847
|
+
/** Whether `row` is currently expanded in the tree. */
|
|
848
|
+
isTreeRowExpanded(row: T): boolean;
|
|
154
849
|
/**
|
|
155
850
|
* Set the sort state for the grid.
|
|
156
851
|
*/
|
|
@@ -180,14 +875,55 @@ export declare class ApexGrid<T extends object> extends EventEmitterBase<ApexGri
|
|
|
180
875
|
* have been applied.
|
|
181
876
|
*/
|
|
182
877
|
get dataView(): ReadonlyArray<T>;
|
|
878
|
+
/**
|
|
879
|
+
* The columns in visual render order: `'start'`-pinned columns first, then
|
|
880
|
+
* unpinned columns, then `'end'`-pinned columns.
|
|
881
|
+
*
|
|
882
|
+
* @remarks
|
|
883
|
+
* Use this when you need to iterate the columns in the same order the grid
|
|
884
|
+
* actually displays them (for example to build a column chooser). Public APIs
|
|
885
|
+
* like {@link ApexGrid.getColumn} continue to operate on the user-supplied
|
|
886
|
+
* {@link ApexGrid.columns} array.
|
|
887
|
+
*/
|
|
888
|
+
get displayColumns(): ReadonlyArray<ColumnConfiguration<T>>;
|
|
183
889
|
/**
|
|
184
890
|
* The total number of items in the {@link ApexGrid.dataView} collection.
|
|
891
|
+
*
|
|
892
|
+
* @remarks
|
|
893
|
+
* This is always the post-filter, post-sort row count — pagination does not change it.
|
|
894
|
+
* Use {@link ApexGrid.pageItems} to read the rows currently rendered into the body.
|
|
185
895
|
*/
|
|
186
896
|
get totalItems(): number;
|
|
897
|
+
/**
|
|
898
|
+
* The records currently rendered into the virtualized body.
|
|
899
|
+
*
|
|
900
|
+
* @remarks
|
|
901
|
+
* Equal to {@link ApexGrid.dataView} when pagination is disabled. With pagination
|
|
902
|
+
* enabled (`'local'` mode) this is the active page slice.
|
|
903
|
+
*/
|
|
904
|
+
get pageItems(): ReadonlyArray<T>;
|
|
905
|
+
/**
|
|
906
|
+
* The current zero-based page index.
|
|
907
|
+
*/
|
|
908
|
+
get page(): number;
|
|
909
|
+
set page(value: number);
|
|
910
|
+
/**
|
|
911
|
+
* The current page size.
|
|
912
|
+
*/
|
|
913
|
+
get pageSize(): number;
|
|
914
|
+
set pageSize(value: number);
|
|
915
|
+
/**
|
|
916
|
+
* The total number of pages computed from {@link ApexGrid.totalItems} and {@link ApexGrid.pageSize}.
|
|
917
|
+
*/
|
|
918
|
+
get pageCount(): number;
|
|
187
919
|
protected watchColumns(_: ColumnConfiguration<T>[], newConfig?: ColumnConfiguration<T>[]): void;
|
|
188
920
|
protected dataChanged(): void;
|
|
189
921
|
protected pipeline(): Promise<void>;
|
|
922
|
+
protected paginationChanged(): void;
|
|
923
|
+
protected quickFilterChanged(): void;
|
|
190
924
|
constructor();
|
|
925
|
+
protected updated(): void;
|
|
926
|
+
protected firstUpdated(): void;
|
|
191
927
|
/**
|
|
192
928
|
* Performs a filter operation in the grid based on the passed expression(s).
|
|
193
929
|
*/
|
|
@@ -204,20 +940,231 @@ export declare class ApexGrid<T extends object> extends EventEmitterBase<ApexGri
|
|
|
204
940
|
* Resets the current filter state of the control.
|
|
205
941
|
*/
|
|
206
942
|
clearFilter(key?: Keys<T>): void;
|
|
943
|
+
/**
|
|
944
|
+
* Navigates the grid to the given zero-based `page` index.
|
|
945
|
+
*
|
|
946
|
+
* @remarks
|
|
947
|
+
* Emits the cancellable `pageChanging` event before applying the change and the
|
|
948
|
+
* `pageChanged` event after. Out-of-range values are clamped into `[0, pageCount - 1]`.
|
|
949
|
+
*
|
|
950
|
+
* @param page - The target zero-based page index.
|
|
951
|
+
* @returns `true` if the change was applied, `false` if cancelled or a no-op.
|
|
952
|
+
*
|
|
953
|
+
* @example
|
|
954
|
+
* ```ts
|
|
955
|
+
* await grid.gotoPage(2);
|
|
956
|
+
* ```
|
|
957
|
+
*/
|
|
958
|
+
gotoPage(page: number): Promise<boolean>;
|
|
959
|
+
/**
|
|
960
|
+
* Updates the grid's page size and returns to the first page.
|
|
961
|
+
*
|
|
962
|
+
* @remarks
|
|
963
|
+
* Emits the cancellable `pageChanging` event before applying the change and the
|
|
964
|
+
* `pageChanged` event after.
|
|
965
|
+
*
|
|
966
|
+
* @param size - The new page size (must be a positive integer).
|
|
967
|
+
* @returns `true` if the change was applied, `false` if cancelled or a no-op.
|
|
968
|
+
*/
|
|
969
|
+
setPageSize(size: number): Promise<boolean>;
|
|
970
|
+
/**
|
|
971
|
+
* Navigates to the next page. No-op if already on the last page.
|
|
972
|
+
*/
|
|
973
|
+
nextPage(): Promise<boolean>;
|
|
974
|
+
/**
|
|
975
|
+
* Navigates to the previous page. No-op if already on the first page.
|
|
976
|
+
*/
|
|
977
|
+
previousPage(): Promise<boolean>;
|
|
978
|
+
/**
|
|
979
|
+
* Navigates to the first page.
|
|
980
|
+
*/
|
|
981
|
+
firstPage(): Promise<boolean>;
|
|
982
|
+
/**
|
|
983
|
+
* Navigates to the last page.
|
|
984
|
+
*/
|
|
985
|
+
lastPage(): Promise<boolean>;
|
|
986
|
+
/**
|
|
987
|
+
* Applies a new quick-filter (global search) value, emitting the cancellable
|
|
988
|
+
* `quickFilterChanging` event first and the `quickFilterChanged` event after the
|
|
989
|
+
* pipeline has run.
|
|
990
|
+
*
|
|
991
|
+
* @param value - The new quick-filter value. Pass `''` to clear.
|
|
992
|
+
* @returns `true` if the change was applied, `false` if cancelled or a no-op.
|
|
993
|
+
*
|
|
994
|
+
* @example
|
|
995
|
+
* ```ts
|
|
996
|
+
* await grid.setQuickFilter('john');
|
|
997
|
+
* ```
|
|
998
|
+
*/
|
|
999
|
+
setQuickFilter(value: string): Promise<boolean>;
|
|
207
1000
|
/**
|
|
208
1001
|
* Returns a {@link ColumnConfiguration} for a given column.
|
|
209
1002
|
*/
|
|
210
1003
|
getColumn(id: Keys<T> | number): ColumnConfiguration<T> | undefined;
|
|
211
1004
|
/**
|
|
212
1005
|
* Updates the column configuration of the grid.
|
|
1006
|
+
*
|
|
1007
|
+
* @remarks
|
|
1008
|
+
* Each updated column is replaced with a fresh object reference so that cells
|
|
1009
|
+
* and headers re-render with the new template / configuration. The
|
|
1010
|
+
* user-supplied `columns` array is also reassigned for Lit reactivity.
|
|
213
1011
|
*/
|
|
214
1012
|
updateColumns(columns: ColumnConfiguration<T> | ColumnConfiguration<T>[]): void;
|
|
1013
|
+
/**
|
|
1014
|
+
* Pins a column to one of the grid's edges, or unpins it when `position` is `null`.
|
|
1015
|
+
*
|
|
1016
|
+
* @remarks
|
|
1017
|
+
* Emits the cancellable `columnPinning` event first and the `columnPinned`
|
|
1018
|
+
* event after the update is applied. The user-supplied {@link ApexGrid.columns}
|
|
1019
|
+
* array is not reordered — only the visual render order changes.
|
|
1020
|
+
*
|
|
1021
|
+
* @param key - The target column key.
|
|
1022
|
+
* @param position - `'start'`, `'end'`, or `null` to unpin.
|
|
1023
|
+
* @returns `true` if the change was applied, `false` if cancelled or a no-op.
|
|
1024
|
+
*
|
|
1025
|
+
* @example
|
|
1026
|
+
* ```ts
|
|
1027
|
+
* await grid.pinColumn('name', 'start');
|
|
1028
|
+
* await grid.pinColumn('actions', 'end');
|
|
1029
|
+
* ```
|
|
1030
|
+
*/
|
|
1031
|
+
pinColumn(key: Keys<T>, position: PinPosition): Promise<boolean>;
|
|
1032
|
+
/**
|
|
1033
|
+
* Unpins a column. Equivalent to {@link ApexGrid.pinColumn}(`key`, `null`).
|
|
1034
|
+
*
|
|
1035
|
+
* @param key - The target column key.
|
|
1036
|
+
* @returns `true` if the change was applied, `false` if the column was already
|
|
1037
|
+
* unpinned or the operation was cancelled.
|
|
1038
|
+
*/
|
|
1039
|
+
unpinColumn(key: Keys<T>): Promise<boolean>;
|
|
1040
|
+
/**
|
|
1041
|
+
* The cell currently in edit mode, or `null`.
|
|
1042
|
+
*/
|
|
1043
|
+
get editingCell(): {
|
|
1044
|
+
rowIndex: number;
|
|
1045
|
+
columnKey: Keys<T>;
|
|
1046
|
+
} | null;
|
|
1047
|
+
/**
|
|
1048
|
+
* The view-relative index of the row currently in edit mode (row edit mode
|
|
1049
|
+
* only), or `null`.
|
|
1050
|
+
*/
|
|
1051
|
+
get editingRow(): number | null;
|
|
1052
|
+
/**
|
|
1053
|
+
* Begins editing the cell at `(rowIndex, columnKey)`.
|
|
1054
|
+
*
|
|
1055
|
+
* @remarks
|
|
1056
|
+
* `rowIndex` is the view-relative index (matches {@link ApexGrid.pageItems}).
|
|
1057
|
+
* Returns `false` when the column isn't editable, the row index is out of
|
|
1058
|
+
* range, or the request was rejected (for example in row mode with pending
|
|
1059
|
+
* changes that couldn't be committed).
|
|
1060
|
+
*/
|
|
1061
|
+
editCell(rowIndex: number, columnKey: Keys<T>): Promise<boolean>;
|
|
1062
|
+
/**
|
|
1063
|
+
* Begins editing the entire row at `rowIndex` (row edit mode only).
|
|
1064
|
+
*
|
|
1065
|
+
* @returns `false` when editing is disabled, the grid is in cell mode, or
|
|
1066
|
+
* the row index is out of range.
|
|
1067
|
+
*/
|
|
1068
|
+
editRow(rowIndex: number): Promise<boolean>;
|
|
1069
|
+
/**
|
|
1070
|
+
* Commits the current edit.
|
|
1071
|
+
*
|
|
1072
|
+
* @remarks
|
|
1073
|
+
* In cell mode this writes the active cell's pending value. In row mode it
|
|
1074
|
+
* flushes all pending values for the active row. Emits `cellValueChanging`
|
|
1075
|
+
* per changed cell (cancellable) and `cellValueChanged` after, followed by
|
|
1076
|
+
* `rowEditEnded` in row mode.
|
|
1077
|
+
*/
|
|
1078
|
+
commitEdit(): Promise<boolean>;
|
|
1079
|
+
/**
|
|
1080
|
+
* Discards the current edit without writing back to {@link ApexGrid.data}.
|
|
1081
|
+
*/
|
|
1082
|
+
cancelEdit(): void;
|
|
1083
|
+
/**
|
|
1084
|
+
* Exports the current grid contents as a CSV string and (in a browser
|
|
1085
|
+
* context) triggers a download.
|
|
1086
|
+
*
|
|
1087
|
+
* @remarks
|
|
1088
|
+
* By default the export uses the post-filter/post-sort `dataView`, includes
|
|
1089
|
+
* every visible column with `exportable !== false`, and prepends a UTF-8 BOM
|
|
1090
|
+
* so Excel opens the file with the right encoding. Pass `source: 'page'` to
|
|
1091
|
+
* export only the current page, `source: 'selected'` to export the current
|
|
1092
|
+
* row selection, or `source: 'all'` to export the raw `data` array. The
|
|
1093
|
+
* returned string is the same content written to the file — useful for
|
|
1094
|
+
* tests or routing the bytes elsewhere.
|
|
1095
|
+
*
|
|
1096
|
+
* @example
|
|
1097
|
+
* ```ts
|
|
1098
|
+
* grid.exportToCSV(); // download data.csv
|
|
1099
|
+
* grid.exportToCSV({ filename: 'users', source: 'selected' });
|
|
1100
|
+
* const text = grid.exportToCSV({ filename: '' }); // string only, no download
|
|
1101
|
+
* ```
|
|
1102
|
+
*/
|
|
1103
|
+
exportToCSV(options?: CSVExportOptions<T>): string;
|
|
1104
|
+
/**
|
|
1105
|
+
* Exports the current grid contents as an `.xlsx` workbook and (in a browser
|
|
1106
|
+
* context) triggers a download.
|
|
1107
|
+
*
|
|
1108
|
+
* @remarks
|
|
1109
|
+
* Produces a single-sheet workbook with a bold header row. Numbers, booleans
|
|
1110
|
+
* and `Date` values keep their native cell type in Excel; everything else is
|
|
1111
|
+
* written as inline strings. Sharing the same `source` / `columns` /
|
|
1112
|
+
* `formatter` options as {@link ApexGrid.exportToCSV}, plus an optional
|
|
1113
|
+
* `sheetName`. Pass `filename: ''` to skip the download and only receive
|
|
1114
|
+
* the bytes back.
|
|
1115
|
+
*
|
|
1116
|
+
* @example
|
|
1117
|
+
* ```ts
|
|
1118
|
+
* grid.exportToXLSX();
|
|
1119
|
+
* grid.exportToXLSX({ filename: 'users', sheetName: 'Users' });
|
|
1120
|
+
* ```
|
|
1121
|
+
*/
|
|
1122
|
+
exportToXLSX(options?: XLSXExportOptions<T>): Uint8Array;
|
|
1123
|
+
/**
|
|
1124
|
+
* Moves a column relative to another column.
|
|
1125
|
+
*
|
|
1126
|
+
* @remarks
|
|
1127
|
+
* Emits the cancellable `columnMoving` event first and `columnMoved` after.
|
|
1128
|
+
* Reordering only succeeds when the source and target columns share the same
|
|
1129
|
+
* pinning group (start / unpinned / end) — cross-group moves return `false`.
|
|
1130
|
+
* Use {@link ApexGrid.pinColumn} to change a column's pinning group first.
|
|
1131
|
+
*
|
|
1132
|
+
* @param fromKey - The column to move.
|
|
1133
|
+
* @param toKey - The reference column.
|
|
1134
|
+
* @param position - Whether to place `fromKey` before or after `toKey`. Defaults to `'before'`.
|
|
1135
|
+
* @returns `true` if the move was applied, `false` if cancelled or a no-op.
|
|
1136
|
+
*
|
|
1137
|
+
* @example
|
|
1138
|
+
* ```ts
|
|
1139
|
+
* await grid.moveColumn('email', 'name', 'after');
|
|
1140
|
+
* ```
|
|
1141
|
+
*/
|
|
1142
|
+
moveColumn(fromKey: Keys<T>, toKey: Keys<T>, position?: ColumnDropPosition): Promise<boolean>;
|
|
215
1143
|
protected bodyClickHandler(event: MouseEvent): void;
|
|
216
1144
|
protected bodyKeydownHandler(event: KeyboardEvent): void;
|
|
217
1145
|
protected renderHeaderRow(): import("lit-html").TemplateResult<1>;
|
|
218
1146
|
protected renderBody(): import("lit-html").TemplateResult<1>;
|
|
219
1147
|
protected renderFilterRow(): typeof nothing | import("lit-html").TemplateResult<1>;
|
|
1148
|
+
protected renderToolbar(): typeof nothing | import("lit-html").TemplateResult<1>;
|
|
1149
|
+
protected renderPaginator(): typeof nothing | import("lit-html").TemplateResult<1>;
|
|
1150
|
+
/**
|
|
1151
|
+
* Renders a visually-hidden polite live region. Status messages set via
|
|
1152
|
+
* {@link announce} land here; screen readers will read them aloud without
|
|
1153
|
+
* stealing focus. We intentionally keep this in the shadow root so we
|
|
1154
|
+
* don't have to coordinate consumer DOM placement.
|
|
1155
|
+
*/
|
|
1156
|
+
protected renderLiveRegion(): import("lit-html").TemplateResult<1>;
|
|
220
1157
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
1158
|
+
/**
|
|
1159
|
+
* Sets the live region's announcement text. Screen readers configured to
|
|
1160
|
+
* read polite live updates will read the new value aloud.
|
|
1161
|
+
*
|
|
1162
|
+
* @remarks
|
|
1163
|
+
* Use this from custom UI affordances (e.g. an "Apply filter" button) so
|
|
1164
|
+
* the change is announced. Built-in operations (sort / filter / page /
|
|
1165
|
+
* select / expand) call this internally already.
|
|
1166
|
+
*/
|
|
1167
|
+
announce(message: string): void;
|
|
221
1168
|
}
|
|
222
1169
|
declare global {
|
|
223
1170
|
interface HTMLElementTagNameMap {
|