@keenmate/web-grid 1.0.0-rc15 → 1.0.1
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/README.md +13 -6
- package/ai/INDEX.txt +360 -0
- package/ai/basic-setup.txt +165 -0
- package/ai/callbacks-events.txt +297 -0
- package/ai/columns.txt +486 -0
- package/ai/dropdown-editors.txt +504 -0
- package/ai/editing.txt +545 -0
- package/ai/fill-handle.txt +128 -0
- package/ai/frozen-columns.txt +142 -0
- package/ai/grid-modes.txt +267 -0
- package/ai/keyboard-navigation.txt +429 -0
- package/ai/public-methods.txt +231 -0
- package/ai/row-locking.txt +214 -0
- package/ai/selection.txt +403 -0
- package/ai/sorting-filtering-pagination.txt +375 -0
- package/ai/styling-theming.txt +291 -0
- package/ai/toolbar-actions.txt +475 -0
- package/ai/typescript-types.txt +498 -0
- package/ai/virtual-scroll.txt +146 -0
- package/dist/grid.d.ts +4 -0
- package/dist/modules/navigation/focus.d.ts +4 -0
- package/dist/modules/navigation/index.d.ts +1 -1
- package/dist/modules/toolbar/index.d.ts +1 -1
- package/dist/types.d.ts +3 -0
- package/dist/web-grid.js +2038 -1997
- package/dist/web-grid.umd.js +80 -79
- package/package.json +2 -1
- package/src/css/_cell-selection.css +5 -3
- package/src/css/_dark-mode.css +44 -7
- package/src/css/_dialogs.css +1 -1
- package/src/css/_freeze.css +10 -5
- package/src/css/_navigation.css +15 -8
- package/src/css/_selection.css +5 -3
- package/src/css/_variables.css +3 -0
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
CALLBACKS AND EVENTS
|
|
2
|
+
====================
|
|
3
|
+
@keenmate/web-grid - Complete reference for all callbacks and events.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
NAMING CONVENTION
|
|
7
|
+
-----------------
|
|
8
|
+
on* = Events (fire-and-forget notifications, return value is ignored)
|
|
9
|
+
*Callback = Callbacks (return value affects component behavior)
|
|
10
|
+
|
|
11
|
+
Events can be safely ignored. The component works without them.
|
|
12
|
+
Callbacks affect behavior. The component depends on the return value.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
GRID-LEVEL EVENTS (PROPERTY-BASED)
|
|
16
|
+
-----------------------------------
|
|
17
|
+
All events are set as properties on the grid element. They are NOT DOM
|
|
18
|
+
CustomEvents (except onrowdelete which is both).
|
|
19
|
+
|
|
20
|
+
onrowchange
|
|
21
|
+
Signature: (detail: RowChangeDetail<T>) => void
|
|
22
|
+
Fires when a cell value changes (after commit).
|
|
23
|
+
Detail: { row, draftRow, rowIndex, field, oldValue, newValue, isValid, validationError }
|
|
24
|
+
The row is the original (unchanged). The draftRow contains the user's edits
|
|
25
|
+
including invalid values.
|
|
26
|
+
|
|
27
|
+
onroweditstart
|
|
28
|
+
Signature: (detail: { row: T, rowIndex: number, field: string }) => void
|
|
29
|
+
Fires when editing begins on a cell.
|
|
30
|
+
|
|
31
|
+
onroweditcancel
|
|
32
|
+
Signature: (detail: { row: T, rowIndex: number, field: string }) => void
|
|
33
|
+
Fires when the user cancels an edit (Escape key).
|
|
34
|
+
|
|
35
|
+
onvalidationerror
|
|
36
|
+
Signature: (detail: { row: T, rowIndex: number, field: string, error: string }) => void
|
|
37
|
+
Fires when beforeCommitCallback or validateCallback rejects a value.
|
|
38
|
+
|
|
39
|
+
ontoolbarclick
|
|
40
|
+
Signature: (detail: ToolbarClickDetail<T>) => void
|
|
41
|
+
Fires when a toolbar button is clicked.
|
|
42
|
+
Detail: { item: NormalizedToolbarItem<T>, rowIndex: number, row: T }
|
|
43
|
+
|
|
44
|
+
onrowaction
|
|
45
|
+
Signature: (detail: { action: string, rowIndex: number, row: T }) => void
|
|
46
|
+
LEGACY. Use ontoolbarclick instead.
|
|
47
|
+
|
|
48
|
+
oncontextmenuopen
|
|
49
|
+
Signature: (context: ContextMenuContext<T>) => void
|
|
50
|
+
Fires when the cell/row context menu opens.
|
|
51
|
+
Context: { row, rowIndex, colIndex, column, cellValue }
|
|
52
|
+
|
|
53
|
+
onheadercontextmenuopen
|
|
54
|
+
Signature: (context: HeaderMenuContext<T>) => void
|
|
55
|
+
Fires when the header context menu opens.
|
|
56
|
+
Context: { column, field, columnIndex, sortDirection, isFrozen, allColumns, labels }
|
|
57
|
+
|
|
58
|
+
ondatarequest
|
|
59
|
+
Signature: (detail: DataRequestDetail) => void
|
|
60
|
+
Fires when sort, page, or pageSize changes.
|
|
61
|
+
Detail: { sort, page, pageSize, trigger, mode, skip }
|
|
62
|
+
trigger: 'sort' | 'page' | 'pageSize' | 'init' | 'loadMore'
|
|
63
|
+
mode: 'replace' | 'append' (append for infinite scroll loadMore)
|
|
64
|
+
|
|
65
|
+
onrowdelete
|
|
66
|
+
Signature: (detail: { rowIndex: number, row: T }) => void
|
|
67
|
+
Fires when Ctrl+Delete is pressed on a row.
|
|
68
|
+
NOTE: This is the ONLY callback also dispatched as a DOM CustomEvent.
|
|
69
|
+
Both the property callback and addEventListener('rowdelete', ...) work.
|
|
70
|
+
|
|
71
|
+
onrowfocus
|
|
72
|
+
Signature: (detail: RowFocusDetail<T>) => void
|
|
73
|
+
Fires when a different row is focused (useful for master/detail patterns).
|
|
74
|
+
Detail: { rowIndex, row, previousRowIndex }
|
|
75
|
+
|
|
76
|
+
onrowlockchange
|
|
77
|
+
Signature: (detail: RowLockChangeDetail<T>) => void
|
|
78
|
+
Fires when a row's lock state changes.
|
|
79
|
+
Detail: { rowId, row, rowIndex, lockInfo, source }
|
|
80
|
+
source: 'property' | 'callback' | 'external'
|
|
81
|
+
|
|
82
|
+
oncolumnresize
|
|
83
|
+
Signature: (detail: ColumnResizeDetail) => void
|
|
84
|
+
Fires when a column is resized by dragging.
|
|
85
|
+
Detail: { field, oldWidth, newWidth, allWidths }
|
|
86
|
+
|
|
87
|
+
oncolumnreorder
|
|
88
|
+
Signature: (detail: ColumnReorderDetail) => void
|
|
89
|
+
Fires when a column is reordered by dragging.
|
|
90
|
+
Detail: { field, fromIndex, toIndex, allOrder }
|
|
91
|
+
|
|
92
|
+
oncellselectionchange
|
|
93
|
+
Signature: (detail: CellSelectionChangeDetail) => void
|
|
94
|
+
Fires when the cell range selection changes.
|
|
95
|
+
Detail: { range: CellRange | null, cellCount: number }
|
|
96
|
+
|
|
97
|
+
onbeforepaste
|
|
98
|
+
Signature: (detail: BeforePasteDetail<T>) => void
|
|
99
|
+
Fires before paste is applied. Allows cancellation or cell skipping.
|
|
100
|
+
Detail: { rawText, parsedRows, hasHeaders, headerMapping, targetRowIndex,
|
|
101
|
+
targetColIndex, newRowsCount, cancel, skipCells }
|
|
102
|
+
Set detail.cancel = true to cancel the entire paste.
|
|
103
|
+
Add "row-col" keys to detail.skipCells to skip specific cells.
|
|
104
|
+
|
|
105
|
+
onpaste
|
|
106
|
+
Signature: (detail: PasteDetail<T>) => void
|
|
107
|
+
Fires after paste is applied.
|
|
108
|
+
Detail: { totalCells, successfulCells, failedCells, skippedCells,
|
|
109
|
+
newRowsCreated, cellResults, hadHeaders }
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
GRID-LEVEL CALLBACKS (RETURN VALUE MATTERS)
|
|
113
|
+
-------------------------------------------
|
|
114
|
+
|
|
115
|
+
fillDragCallback
|
|
116
|
+
Signature: (detail: FillDragDetail) => boolean | void
|
|
117
|
+
Called when fill handle drag completes. Return false to cancel the fill.
|
|
118
|
+
|
|
119
|
+
paginationLabelsCallback
|
|
120
|
+
Signature: (context: PaginationLabelsContext) => Partial<PaginationLabels>
|
|
121
|
+
Returns translated/customized pagination text labels.
|
|
122
|
+
|
|
123
|
+
summaryContentCallback
|
|
124
|
+
Signature: (context: SummaryContext<T>) => string
|
|
125
|
+
Returns HTML string for the summary bar content.
|
|
126
|
+
|
|
127
|
+
customStylesCallback
|
|
128
|
+
Signature: () => string
|
|
129
|
+
Returns CSS string injected into the shadow DOM.
|
|
130
|
+
|
|
131
|
+
rowClassCallback
|
|
132
|
+
Signature: (row: T, rowIndex: number) => string | null
|
|
133
|
+
Returns CSS class name(s) to apply to a row element.
|
|
134
|
+
|
|
135
|
+
validationTooltipCallback
|
|
136
|
+
Signature: (context: ValidationTooltipContext<T>) => string | null
|
|
137
|
+
Returns HTML string for validation error tooltips (grid-level default).
|
|
138
|
+
|
|
139
|
+
shortcutsHelpContentCallback
|
|
140
|
+
Signature: () => string
|
|
141
|
+
Returns custom HTML to display alongside the shortcuts help list.
|
|
142
|
+
|
|
143
|
+
createRowCallback
|
|
144
|
+
Signature: (pastedData: Record<string, unknown>, rowIndex: number) => T
|
|
145
|
+
Creates a new row object from pasted data when paste adds rows beyond the
|
|
146
|
+
current items array. Required for multi-row paste to create new rows.
|
|
147
|
+
|
|
148
|
+
createEmptyRowCallback
|
|
149
|
+
Signature: () => T | Promise<T>
|
|
150
|
+
Creates a blank row for the new-row entry feature (isNewRowEnabled).
|
|
151
|
+
Called when the user focuses the empty row at the bottom/top.
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
COLUMN-LEVEL CALLBACKS (ON COLUMN<T>)
|
|
155
|
+
--------------------------------------
|
|
156
|
+
|
|
157
|
+
formatCallback
|
|
158
|
+
Signature: (value: unknown, row: T) => string
|
|
159
|
+
Returns formatted display string for the cell value. Text only (no HTML).
|
|
160
|
+
|
|
161
|
+
templateCallback
|
|
162
|
+
Signature: (row: T) => string
|
|
163
|
+
Returns HTML string for custom cell content.
|
|
164
|
+
|
|
165
|
+
renderCallback
|
|
166
|
+
Signature: (row: T, element: HTMLElement) => void
|
|
167
|
+
Imperative cell rendering. Receives the <td> element directly.
|
|
168
|
+
NOTE: Defined in the type system but not yet wired into rendering.
|
|
169
|
+
|
|
170
|
+
tooltipCallback
|
|
171
|
+
Signature: (value: unknown, row: T) => string | null
|
|
172
|
+
Returns tooltip text for the cell. Takes priority over tooltipMember.
|
|
173
|
+
|
|
174
|
+
validateCallback (DEPRECATED)
|
|
175
|
+
Signature: (value: unknown, row: T) => string | null | Promise<string | null>
|
|
176
|
+
Returns error message or null. Use beforeCommitCallback instead.
|
|
177
|
+
|
|
178
|
+
beforeCommitCallback
|
|
179
|
+
Signature: (context: BeforeCommitContext<T>) => BeforeCommitResult | Promise<BeforeCommitResult>
|
|
180
|
+
Validates and optionally transforms value before commit.
|
|
181
|
+
Context: { value, oldValue, row, rowIndex, field }
|
|
182
|
+
Return values:
|
|
183
|
+
{ valid: true } Accept
|
|
184
|
+
{ valid: true, transformedValue: x } Accept with transformation
|
|
185
|
+
{ valid: false, message: 'Error' } Reject with message
|
|
186
|
+
true / null / undefined Accept
|
|
187
|
+
false Reject (no message)
|
|
188
|
+
'Error message' Reject with that string as message
|
|
189
|
+
|
|
190
|
+
cellEditCallback
|
|
191
|
+
Signature: (context: CustomEditorContext<T>) => void
|
|
192
|
+
Handler for editor: 'custom'. Receives { value, row, rowIndex, field, commit, cancel }.
|
|
193
|
+
|
|
194
|
+
cellClassCallback
|
|
195
|
+
Signature: (value: unknown, row: T) => string | null
|
|
196
|
+
Returns dynamic CSS class name(s) for cells in this column.
|
|
197
|
+
|
|
198
|
+
validationTooltipCallback (column-level)
|
|
199
|
+
Signature: (context: ValidationTooltipContext<T>) => string | null
|
|
200
|
+
Returns HTML for this column's validation error tooltip. Overrides grid-level.
|
|
201
|
+
|
|
202
|
+
beforeCopyCallback
|
|
203
|
+
Signature: (value: unknown, row: T) => string
|
|
204
|
+
Transforms value before copying to clipboard.
|
|
205
|
+
|
|
206
|
+
beforePasteCallback
|
|
207
|
+
Signature: (value: string, row: T) => unknown
|
|
208
|
+
Processes pasted value before applying to the cell.
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
EDITOR OPTION CALLBACKS (ON EDITOROPTIONS<T>)
|
|
212
|
+
----------------------------------------------
|
|
213
|
+
These are set inside column.editorOptions for select, combobox, and
|
|
214
|
+
autocomplete editor types.
|
|
215
|
+
|
|
216
|
+
loadOptions
|
|
217
|
+
Signature: (row: T, field: string) => Promise<EditorOption[]>
|
|
218
|
+
Async option loader. Trigger controlled by optionsLoadTrigger.
|
|
219
|
+
|
|
220
|
+
getValueCallback
|
|
221
|
+
Signature: (option: EditorOption) => string | number
|
|
222
|
+
Returns the value to store from an option.
|
|
223
|
+
|
|
224
|
+
getDisplayCallback
|
|
225
|
+
Signature: (option: EditorOption) => string
|
|
226
|
+
Returns the display text for an option.
|
|
227
|
+
|
|
228
|
+
getSearchCallback
|
|
229
|
+
Signature: (option: EditorOption) => string
|
|
230
|
+
Returns searchable text (falls back to display text).
|
|
231
|
+
|
|
232
|
+
getIconCallback
|
|
233
|
+
Signature: (option: EditorOption) => string
|
|
234
|
+
Returns icon/emoji for an option.
|
|
235
|
+
|
|
236
|
+
getSubtitleCallback
|
|
237
|
+
Signature: (option: EditorOption) => string
|
|
238
|
+
Returns subtitle/description for an option.
|
|
239
|
+
|
|
240
|
+
getDisabledCallback
|
|
241
|
+
Signature: (option: EditorOption) => boolean
|
|
242
|
+
Returns whether an option is disabled.
|
|
243
|
+
|
|
244
|
+
getGroupCallback
|
|
245
|
+
Signature: (option: EditorOption) => string
|
|
246
|
+
Returns group name for grouping options.
|
|
247
|
+
|
|
248
|
+
renderOptionCallback
|
|
249
|
+
Signature: (option: EditorOption, context: OptionRenderContext) => string
|
|
250
|
+
Returns custom HTML for rendering an option in the dropdown.
|
|
251
|
+
Context: { index, isHighlighted, isSelected, isDisabled }
|
|
252
|
+
|
|
253
|
+
onselect
|
|
254
|
+
Signature: (option: EditorOption, row: T) => void
|
|
255
|
+
Event (fire-and-forget). Fires when an option is selected.
|
|
256
|
+
|
|
257
|
+
searchCallback (autocomplete only)
|
|
258
|
+
Signature: (query: string, row: T, signal?: AbortSignal) => Promise<EditorOption[]>
|
|
259
|
+
Async search function. Receives AbortSignal for cancellation on new searches.
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
CONTEXT MENU ITEM CALLBACKS
|
|
263
|
+
----------------------------
|
|
264
|
+
|
|
265
|
+
onclick (on ContextMenuItem<T>)
|
|
266
|
+
Signature: (context: ContextMenuContext<T>) => void | Promise<void>
|
|
267
|
+
Context: { row, rowIndex, colIndex, column, cellValue }
|
|
268
|
+
|
|
269
|
+
onclick (on HeaderMenuItem<T>)
|
|
270
|
+
Signature: (context: HeaderMenuContext<T>) => void | Promise<void>
|
|
271
|
+
Context: { column, field, columnIndex, sortDirection, isFrozen, allColumns, labels }
|
|
272
|
+
|
|
273
|
+
label/icon/disabled/visible can be static values or functions receiving context.
|
|
274
|
+
submenu: (context) => HeaderMenuItem[] for dynamic submenus.
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
TOOLBAR ITEM CALLBACKS
|
|
278
|
+
-----------------------
|
|
279
|
+
|
|
280
|
+
onclick (on RowToolbarItem<T>)
|
|
281
|
+
Signature: (detail: { row: T, rowIndex: number }) => void | Promise<void>
|
|
282
|
+
|
|
283
|
+
disabled: boolean | (row: T, rowIndex: number) => boolean
|
|
284
|
+
hidden: boolean | (row: T, rowIndex: number) => boolean
|
|
285
|
+
tooltipCallback: (row: T, rowIndex: number) => string
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
SHORTCUT CALLBACKS
|
|
289
|
+
------------------
|
|
290
|
+
|
|
291
|
+
RowShortcut<T>.action
|
|
292
|
+
Signature: (ctx: ShortcutContext<T>) => void | Promise<void>
|
|
293
|
+
Context: { row, rowIndex, colIndex, column, cellValue }
|
|
294
|
+
|
|
295
|
+
RangeShortcut<T>.action
|
|
296
|
+
Signature: (ctx: RangeShortcutContext<T>) => void | Promise<void>
|
|
297
|
+
Context: { rows, rowIndices, cellRange?, cells? }
|