@keenmate/web-grid 1.0.0-rc15 → 1.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/README.md CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  A feature-rich, framework-agnostic data grid web component built with TypeScript. Sorting, filtering, pagination, inline editing (8 editor types), cell range selection, clipboard support, row toolbar, context menus, frozen columns, column reorder/resize, fill handle, virtual scroll, dark mode, and full CSS variable theming — all in a Shadow DOM encapsulated `<web-grid>` element.
4
4
 
5
- > **RC15 Note:** This release includes a complete rewrite of how the component handles user input and renders content, based on an action pipeline architecture. All DOM events are now translated into typed actions and dispatched through a centralized pipeline with specialized executors, replacing the previous scattered event handler approach. See [Architecture](#architecture) for details.
6
-
7
5
  ## Installation
8
6
 
9
7
  ```bash
@@ -154,7 +152,7 @@ This architecture separates mode detection (the adapter decides *what* action a
154
152
  | `cellToolbar` | `(row, rowIndex, field, colIndex) => RowToolbarConfig[] \| undefined` | — | Cell-specific toolbar items |
155
153
  | `cellToolbarOffset` | `number \| string` | `0.2` | Horizontal offset: `0`–`1` as fraction of cell width, or CSS length (e.g., `'2rem'`) |
156
154
  | `toolbarBtnMinWidth` | `string` | — | Min-width for toolbar buttons (CSS value). Overrides `--wg-toolbar-btn-min-width` |
157
- | `inlineActionsTitle` | `string` | | Header title for inline actions column (when `toolbarPosition='inline'`) |
155
+ | `inlineActionsTitle` | `string` | `'Actions'` | Header title for inline actions column (when `toolbarPosition='inline'`). Set to `''` for no title |
158
156
 
159
157
  > **Deprecated aliases:** `toolbarAlign` → use `toolbarVerticalAlign`; `toolbarTopPosition` → use `toolbarHorizontalAlign`.
160
158
 
package/ai/INDEX.txt ADDED
@@ -0,0 +1,360 @@
1
+ DOCUMENTATION INDEX
2
+ ===================
3
+
4
+ Quick reference for finding documentation on specific topics.
5
+
6
+ FILE OVERVIEW
7
+ -------------
8
+ basic-setup.txt - Installation, imports, first grid, critical notes
9
+ columns.txt - Column definitions, field types, alignment, templates
10
+ editing.txt - Inline editing, editor types, draft management, validation
11
+ dropdown-editors.txt - Select, combobox, autocomplete editors and EditorOptions
12
+ grid-modes.txt - Mode property, presets (display, navigate, inline, etc.)
13
+ selection.txt - Row selection, cell ranges, column selection, row focus
14
+ sorting-filtering-pagination.txt - Sorting, filtering, pagination, server-side data, summary
15
+ keyboard-navigation.txt - Navigation keys, editing keys, custom shortcuts, help overlay
16
+ toolbar-actions.txt - Row toolbar, inline actions, cell toolbar, context menus
17
+ callbacks-events.txt - All events (on*) and callbacks (*Callback) reference
18
+ public-methods.txt - All public methods on the <web-grid> element
19
+ frozen-columns.txt - Freeze columns to left during horizontal scroll
20
+ fill-handle.txt - Excel-like drag-to-fill for copying cell values
21
+ virtual-scroll.txt - Virtual scroll and infinite scroll for large datasets
22
+ row-locking.txt - Optimistic row locking, external lock management
23
+ styling-theming.txt - CSS variables, --base-* integration, theming
24
+ typescript-types.txt - All exported TypeScript type definitions
25
+
26
+ KEYWORD INDEX
27
+ =============
28
+
29
+ A
30
+ -
31
+ Accessibility -> keyboard-navigation.txt
32
+ Actions -> toolbar-actions.txt
33
+ Alignment -> columns.txt
34
+ Autocomplete -> dropdown-editors.txt
35
+ Auto-scroll -> frozen-columns.txt, keyboard-navigation.txt
36
+
37
+ B
38
+ -
39
+ beforeCommitCallback -> editing.txt, callbacks-events.txt, columns.txt
40
+ Border -> styling-theming.txt
41
+
42
+ C
43
+ -
44
+ Callbacks -> callbacks-events.txt, columns.txt, editing.txt
45
+ Cell editing -> editing.txt, columns.txt
46
+ Cell focus -> selection.txt, keyboard-navigation.txt
47
+ Cell range selection -> selection.txt
48
+ Cell toolbar -> toolbar-actions.txt
49
+ cellClass -> columns.txt
50
+ cellClassCallback -> columns.txt
51
+ cellEditCallback -> columns.txt, callbacks-events.txt
52
+ cellSelectionMode -> selection.txt
53
+ Checkboxes -> selection.txt
54
+ Column definition -> columns.txt, typescript-types.txt
55
+ Column order -> public-methods.txt, columns.txt
56
+ Column resize -> columns.txt
57
+ Column selection -> selection.txt
58
+ Combobox -> dropdown-editors.txt
59
+ commitDraft -> editing.txt, public-methods.txt
60
+ Context menu -> toolbar-actions.txt
61
+ Copy/paste -> keyboard-navigation.txt, selection.txt
62
+ createEmptyRowCallback -> callbacks-events.txt, editing.txt
63
+ createRowCallback -> callbacks-events.txt
64
+ CSS variables -> styling-theming.txt
65
+ Custom element -> basic-setup.txt
66
+
67
+ D
68
+ -
69
+ Data request -> sorting-filtering-pagination.txt, callbacks-events.txt
70
+ Delete row -> keyboard-navigation.txt, callbacks-events.txt
71
+ Disabled columns -> columns.txt
72
+ Draft management -> editing.txt, public-methods.txt
73
+ Drag-to-fill -> fill-handle.txt
74
+ Dropdown editors -> dropdown-editors.txt
75
+
76
+ E
77
+ -
78
+ editAllRows -> editing.txt, grid-modes.txt
79
+ editBehavior -> editing.txt
80
+ Editor types -> editing.txt, dropdown-editors.txt
81
+ editTrigger -> editing.txt
82
+ EditorOptions -> dropdown-editors.txt, typescript-types.txt
83
+ Events -> callbacks-events.txt
84
+ Export -> keyboard-navigation.txt, selection.txt
85
+
86
+ F
87
+ -
88
+ Field -> columns.txt
89
+ Fill handle -> fill-handle.txt
90
+ fillDragCallback -> fill-handle.txt, callbacks-events.txt
91
+ fillDirection -> fill-handle.txt, columns.txt
92
+ Filter -> sorting-filtering-pagination.txt
93
+ focusCell -> public-methods.txt
94
+ formatCallback -> columns.txt, callbacks-events.txt
95
+ freezeColumns -> frozen-columns.txt
96
+ Frozen columns -> frozen-columns.txt
97
+
98
+ G
99
+ -
100
+ getDisplayCallback -> dropdown-editors.txt, callbacks-events.txt
101
+ getValueCallback -> dropdown-editors.txt, callbacks-events.txt
102
+ Grid labels -> sorting-filtering-pagination.txt, callbacks-events.txt
103
+ Grid modes -> grid-modes.txt
104
+ Groups -> dropdown-editors.txt
105
+
106
+ H
107
+ -
108
+ Header menu -> toolbar-actions.txt
109
+ headerInfo -> columns.txt
110
+ Help overlay -> keyboard-navigation.txt
111
+ Horizontal align -> columns.txt
112
+
113
+ I
114
+ -
115
+ idValueCallback -> editing.txt, row-locking.txt
116
+ idValueMember -> editing.txt, row-locking.txt
117
+ Infinite scroll -> virtual-scroll.txt
118
+ Inline actions -> toolbar-actions.txt
119
+ inlineActionsTitle -> toolbar-actions.txt
120
+ Installation -> basic-setup.txt
121
+ isEditable -> columns.txt, editing.txt
122
+ isFrozen -> frozen-columns.txt, columns.txt
123
+ isLocked -> row-locking.txt
124
+ isSortable -> columns.txt, sorting-filtering-pagination.txt
125
+ isVirtualScrollEnabled -> virtual-scroll.txt
126
+ Items -> basic-setup.txt
127
+
128
+ K
129
+ -
130
+ Keyboard navigation -> keyboard-navigation.txt
131
+ Keyboard shortcuts -> keyboard-navigation.txt
132
+
133
+ L
134
+ -
135
+ Labels -> sorting-filtering-pagination.txt, callbacks-events.txt
136
+ Lock -> row-locking.txt
137
+ lockRowById -> row-locking.txt, public-methods.txt
138
+
139
+ M
140
+ -
141
+ maxLines -> columns.txt
142
+ Methods -> public-methods.txt
143
+ Mode -> grid-modes.txt
144
+ Multiple sort -> sorting-filtering-pagination.txt
145
+
146
+ N
147
+ -
148
+ Navigate mode -> grid-modes.txt, editing.txt
149
+ New row entry -> editing.txt
150
+ newRowPosition -> editing.txt
151
+ isNewRowEnabled -> editing.txt
152
+
153
+ O
154
+ -
155
+ oncontextmenuopen -> callbacks-events.txt, toolbar-actions.txt
156
+ ondatarequest -> callbacks-events.txt, sorting-filtering-pagination.txt
157
+ onrowchange -> callbacks-events.txt, editing.txt
158
+ onroweditstart -> callbacks-events.txt, editing.txt
159
+ onrowlockchange -> callbacks-events.txt, row-locking.txt
160
+ onselectionchange -> callbacks-events.txt, selection.txt
161
+ onbeforepaste -> callbacks-events.txt
162
+ onpaste -> callbacks-events.txt
163
+
164
+ P
165
+ -
166
+ Pagination -> sorting-filtering-pagination.txt
167
+ Paste -> callbacks-events.txt, keyboard-navigation.txt
168
+ Public methods -> public-methods.txt
169
+
170
+ R
171
+ -
172
+ renderOptionCallback -> dropdown-editors.txt, callbacks-events.txt
173
+ Resize -> columns.txt
174
+ Row focus -> selection.txt
175
+ Row locking -> row-locking.txt
176
+ Row numbers -> columns.txt, basic-setup.txt
177
+ Row selection -> selection.txt
178
+ Row shortcuts -> keyboard-navigation.txt
179
+ Row toolbar -> toolbar-actions.txt
180
+ rowLocking -> row-locking.txt, typescript-types.txt
181
+ RowToolbarConfig -> toolbar-actions.txt, typescript-types.txt
182
+
183
+ S
184
+ -
185
+ searchCallback -> dropdown-editors.txt, callbacks-events.txt
186
+ Select editor -> dropdown-editors.txt
187
+ Selection -> selection.txt
188
+ Shadow DOM -> basic-setup.txt, styling-theming.txt
189
+ Shift+click -> selection.txt
190
+ Shortcuts -> keyboard-navigation.txt
191
+ Sort -> sorting-filtering-pagination.txt
192
+ sortMode -> sorting-filtering-pagination.txt
193
+ SortState -> sorting-filtering-pagination.txt, typescript-types.txt
194
+ Sticky headers -> styling-theming.txt
195
+ Summary bar -> sorting-filtering-pagination.txt
196
+
197
+ T
198
+ -
199
+ templateCallback -> columns.txt, callbacks-events.txt
200
+ Text overflow -> columns.txt
201
+ Theming -> styling-theming.txt
202
+ Toolbar -> toolbar-actions.txt
203
+ tooltipCallback -> columns.txt, callbacks-events.txt
204
+ TypeScript -> typescript-types.txt
205
+ Types -> typescript-types.txt
206
+
207
+ U
208
+ -
209
+ unlockRowById -> row-locking.txt, public-methods.txt
210
+
211
+ V
212
+ -
213
+ validateCallback -> editing.txt, columns.txt, callbacks-events.txt
214
+ Validation -> editing.txt
215
+ Vertical align -> columns.txt
216
+ Virtual scroll -> virtual-scroll.txt
217
+ virtualScrollThreshold -> virtual-scroll.txt
218
+
219
+ W
220
+ -
221
+ Web component -> basic-setup.txt
222
+ Width -> columns.txt
223
+ --wg-* variables -> styling-theming.txt
224
+
225
+ Z
226
+ -
227
+ z-index -> frozen-columns.txt, styling-theming.txt
228
+
229
+ COMMON QUESTIONS
230
+ ================
231
+
232
+ Q: How do I get started?
233
+ A: -> basic-setup.txt
234
+
235
+ Q: How do I define columns?
236
+ A: -> columns.txt
237
+
238
+ Q: How do I enable editing?
239
+ A: -> editing.txt
240
+
241
+ Q: How do I use dropdown editors (select, combobox, autocomplete)?
242
+ A: -> dropdown-editors.txt
243
+
244
+ Q: What do the grid modes do?
245
+ A: -> grid-modes.txt
246
+
247
+ Q: How does row selection work?
248
+ A: -> selection.txt
249
+
250
+ Q: How do I enable cell range selection?
251
+ A: -> selection.txt (CELL RANGE SELECTION section)
252
+
253
+ Q: How do I add sorting, filtering, or pagination?
254
+ A: -> sorting-filtering-pagination.txt
255
+
256
+ Q: What keyboard shortcuts are available?
257
+ A: -> keyboard-navigation.txt
258
+
259
+ Q: How do I add action buttons to rows?
260
+ A: -> toolbar-actions.txt
261
+
262
+ Q: How do I add a context menu?
263
+ A: -> toolbar-actions.txt (CELL CONTEXT MENU section)
264
+
265
+ Q: What events and callbacks are available?
266
+ A: -> callbacks-events.txt
267
+
268
+ Q: What public methods does the grid have?
269
+ A: -> public-methods.txt
270
+
271
+ Q: How do I freeze columns?
272
+ A: -> frozen-columns.txt
273
+
274
+ Q: How do I use the fill handle (drag-to-fill)?
275
+ A: -> fill-handle.txt
276
+
277
+ Q: My grid is slow with large datasets
278
+ A: -> virtual-scroll.txt
279
+
280
+ Q: How do I implement row locking?
281
+ A: -> row-locking.txt
282
+
283
+ Q: How do I customize colors and styles?
284
+ A: -> styling-theming.txt
285
+
286
+ Q: Where are the TypeScript types?
287
+ A: -> typescript-types.txt
288
+
289
+ Q: How do I do server-side sorting/filtering/pagination?
290
+ A: -> sorting-filtering-pagination.txt (SERVER-SIDE section)
291
+
292
+ Q: How do I validate cell edits?
293
+ A: -> editing.txt (VALIDATION section)
294
+
295
+ Q: How do I add custom keyboard shortcuts?
296
+ A: -> keyboard-navigation.txt (CUSTOM SHORTCUTS section)
297
+
298
+ Q: How do I handle paste events?
299
+ A: -> callbacks-events.txt (onbeforepaste, onpaste)
300
+
301
+ Q: How do I add a new-row entry row?
302
+ A: -> editing.txt (NEW ROW ENTRY section)
303
+
304
+ FEATURES BY CATEGORY
305
+ ====================
306
+
307
+ GETTING STARTED
308
+ - Installation and imports -> basic-setup.txt
309
+ - First grid -> basic-setup.txt
310
+ - Grid modes -> grid-modes.txt
311
+
312
+ DATA & COLUMNS
313
+ - Column definitions -> columns.txt
314
+ - Editor types -> editing.txt, dropdown-editors.txt
315
+ - Templates and formatting -> columns.txt
316
+ - TypeScript types -> typescript-types.txt
317
+
318
+ EDITING
319
+ - Inline editing -> editing.txt
320
+ - New row entry -> editing.txt
321
+ - Draft management -> editing.txt
322
+ - Validation -> editing.txt
323
+ - Dropdown editors -> dropdown-editors.txt
324
+ - Fill handle -> fill-handle.txt
325
+
326
+ SELECTION & NAVIGATION
327
+ - Row selection -> selection.txt
328
+ - Cell range selection -> selection.txt
329
+ - Column selection -> selection.txt
330
+ - Keyboard navigation -> keyboard-navigation.txt
331
+ - Custom shortcuts -> keyboard-navigation.txt
332
+
333
+ DATA DISPLAY
334
+ - Sorting -> sorting-filtering-pagination.txt
335
+ - Filtering -> sorting-filtering-pagination.txt
336
+ - Pagination -> sorting-filtering-pagination.txt
337
+ - Server-side data -> sorting-filtering-pagination.txt
338
+ - Summary bar -> sorting-filtering-pagination.txt
339
+
340
+ ACTIONS & MENUS
341
+ - Row toolbar -> toolbar-actions.txt
342
+ - Inline actions -> toolbar-actions.txt
343
+ - Cell toolbar -> toolbar-actions.txt
344
+ - Context menus -> toolbar-actions.txt
345
+ - Header menu -> toolbar-actions.txt
346
+
347
+ PERFORMANCE
348
+ - Virtual scroll -> virtual-scroll.txt
349
+ - Infinite scroll -> virtual-scroll.txt
350
+ - Frozen columns -> frozen-columns.txt
351
+
352
+ CUSTOMIZATION
353
+ - CSS variables -> styling-theming.txt
354
+ - Theming -> styling-theming.txt
355
+ - Row locking -> row-locking.txt
356
+
357
+ API REFERENCE
358
+ - Events and callbacks -> callbacks-events.txt
359
+ - Public methods -> public-methods.txt
360
+ - TypeScript types -> typescript-types.txt
@@ -0,0 +1,165 @@
1
+ CRITICAL NOTES
2
+ --------------
3
+ - @keenmate/web-grid is a web component. It registers <web-grid> as a custom element.
4
+ - Shadow DOM encapsulated. External CSS does not reach internal styles.
5
+ - Items and columns are set via JavaScript properties, NOT HTML attributes.
6
+ - The import itself registers the custom element. No manual registration needed.
7
+ - Setting the "mode" property applies sensible defaults for editing, selection,
8
+ and dropdown behavior. You can override individual properties after setting mode.
9
+
10
+
11
+ INSTALLATION
12
+ ------------
13
+ npm install @keenmate/web-grid
14
+
15
+
16
+ ES MODULE IMPORT (RECOMMENDED)
17
+ ------------------------------
18
+ Import the package in a module script. The import registers <web-grid> automatically.
19
+
20
+ <script type="module">
21
+ import '@keenmate/web-grid'
22
+ </script>
23
+
24
+ <web-grid id="grid"></web-grid>
25
+
26
+ <script type="module">
27
+ const grid = document.getElementById('grid')
28
+
29
+ grid.items = [
30
+ { id: 1, name: 'Alice', age: 28 },
31
+ { id: 2, name: 'Bob', age: 34 }
32
+ ]
33
+
34
+ grid.columns = [
35
+ { field: 'id', title: 'ID', width: '60px' },
36
+ { field: 'name', title: 'Name' },
37
+ { field: 'age', title: 'Age' }
38
+ ]
39
+ </script>
40
+
41
+
42
+ UMD SCRIPT TAG USAGE
43
+ --------------------
44
+ For non-module environments, use the UMD bundle via a CDN:
45
+
46
+ <script src="https://unpkg.com/@keenmate/web-grid"></script>
47
+ <web-grid id="grid"></web-grid>
48
+
49
+ Then set items and columns the same way via JavaScript properties.
50
+
51
+
52
+ MINIMAL GRID SETUP
53
+ ------------------
54
+ Two properties are required for a functional grid:
55
+
56
+ items - Array of data objects. Each object is one row.
57
+ columns - Array of column definitions. Each must have a "field" property
58
+ matching a key in the data objects.
59
+
60
+ Minimal column definition:
61
+ { field: 'name' }
62
+
63
+ Typical column definition:
64
+ { field: 'name', title: 'Full Name', width: '200px' }
65
+
66
+ Minimal working example:
67
+
68
+ const grid = document.querySelector('web-grid')
69
+ grid.items = [{ name: 'Alice', age: 28 }]
70
+ grid.columns = [
71
+ { field: 'name', title: 'Name' },
72
+ { field: 'age', title: 'Age' }
73
+ ]
74
+
75
+
76
+ BASIC ATTRIBUTES AND PROPERTIES
77
+ --------------------------------
78
+ These are commonly used display and behavior properties. They can be set as
79
+ HTML attributes (kebab-case) or JavaScript properties (camelCase).
80
+
81
+ Attribute (HTML) Property (JS) Type Default Description
82
+ ---------------------- ---------------------- --------- -------- -----------
83
+ is-striped isStriped boolean false Alternate row backgrounds
84
+ is-hoverable isHoverable boolean false Highlight row on hover
85
+ sort-mode sortMode string 'none' 'none', 'single', or 'multi'
86
+ is-filterable isFilterable boolean false Show per-column filter inputs
87
+ is-pageable isPageable boolean false Enable pagination
88
+ page-size pageSize number 10 Rows per page
89
+ is-editable isEditable boolean false Enable cell editing
90
+ edit-trigger editTrigger string 'dblclick' How editing starts (see below)
91
+ is-row-numbers-visible isRowNumbersVisible boolean false Show row number column
92
+ mode mode string (none) Grid mode (see below)
93
+ is-scrollable isScrollable boolean false Enable scroll container
94
+ freeze-columns freezeColumns number 0 Freeze first N columns
95
+
96
+ Edit trigger values: 'click', 'dblclick', 'button', 'always', 'navigate'
97
+
98
+ Sorting example:
99
+
100
+ grid.sortMode = 'multi'
101
+
102
+ Pagination example:
103
+
104
+ grid.isPageable = true
105
+ grid.pageSize = 25
106
+ grid.pageSizes = [10, 25, 50, 100]
107
+
108
+ Filtering example:
109
+
110
+ grid.isFilterable = true
111
+
112
+
113
+ CORE PROPERTIES
114
+ ---------------
115
+ items : T[]
116
+ The data array. Each element is a row object. Setting this re-renders the grid.
117
+ Example: grid.items = [{ id: 1, name: 'Alice' }, { id: 2, name: 'Bob' }]
118
+
119
+ columns : Column<T>[]
120
+ Column definitions array. Each column requires at minimum a "field" property.
121
+ Key column fields:
122
+ field - (required) Data property name
123
+ title - Header display text
124
+ width - CSS width string (e.g. '100px', '20%')
125
+ isEditable - Enable editing for this column
126
+ editor - Editor type: 'text', 'number', 'checkbox', 'select',
127
+ 'combobox', 'autocomplete', 'date', 'custom'
128
+ formatCallback - Function to format display value: (value, row) => string
129
+ templateCallback - Function returning HTML string: (row) => string
130
+ horizontalAlign - 'left', 'center', 'right', 'justify'
131
+ isSortable - Enable sorting for this column
132
+ isFilterable - Enable filtering for this column
133
+ isFrozen - Stick column to left during horizontal scroll
134
+ isHidden - Hide column but keep in array for toggling
135
+
136
+
137
+ GRID MODES OVERVIEW
138
+ -------------------
139
+ The "mode" property sets sensible defaults for common use cases. Set it before
140
+ overriding individual properties.
141
+
142
+ grid.mode = 'read-only'
143
+ No editing. Click to select cells. For display grids with copy support.
144
+ Sets: isEditable=false, cellSelectionMode='click'
145
+
146
+ grid.mode = 'excel'
147
+ Navigate cells with arrows, type to start editing, Escape to cancel.
148
+ Click+drag for cell selection.
149
+ Sets: isEditable=true, editTrigger='navigate', cellSelectionMode='click',
150
+ dropdownToggleVisibility='always'
151
+
152
+ grid.mode = 'input-matrix'
153
+ All cells always in edit mode. Shift+click for cell selection. Tab to
154
+ navigate between fields.
155
+ Sets: isEditable=true, editTrigger='always', cellSelectionMode='shift',
156
+ dropdownToggleVisibility='always', shouldShowDropdownOnFocus=true
157
+
158
+ For detailed grid mode documentation, see grid-modes.txt.
159
+
160
+
161
+ BROWSER SUPPORT
162
+ ---------------
163
+ Chrome/Edge 88+
164
+ Firefox 78+
165
+ Safari 14+