@keenmate/web-grid 1.0.0-rc09 → 1.0.0-rc11
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/dist/grid.d.ts +112 -66
- package/dist/index.d.ts +1 -1
- package/dist/modules/cell-selection/index.d.ts +29 -0
- package/dist/modules/focus-events/index.d.ts +42 -0
- package/dist/modules/navigation/index.d.ts +1 -1
- package/dist/modules/scroll-events/index.d.ts +27 -0
- package/dist/modules/types.d.ts +4 -0
- package/dist/types.d.ts +58 -34
- package/dist/web-component.d.ts +73 -45
- package/dist/web-grid.js +6289 -5799
- package/dist/web-grid.umd.js +247 -241
- package/package.json +78 -78
- package/src/css/_cell-selection.css +58 -0
- package/src/css/_cells.css +13 -2
- package/src/css/_dialogs.css +2 -2
- package/src/css/_dropdown.css +33 -3
- package/src/css/_freeze.css +2 -2
- package/src/css/_header.css +46 -8
- package/src/css/_navigation.css +5 -0
- package/src/css/_toolbar.css +7 -7
- package/src/css/_variables.css +45 -9
- package/src/css/main.css +8 -6
package/dist/grid.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Column, CellValidationState, RowToolbarConfig, ContextMenuItem, RowShortcut, RowChangeDetail, ToolbarClickDetail, RowActionClickDetail, ContextMenuContext, HeaderMenuConfig, HeaderMenuContext, EditTrigger, EditStartSelection, EditingCell, FocusedCell, SortMode, SortState, DataRequestDetail, DataRequestTrigger, BeforeCommitResult, GridMode, ToggleVisibility, PaginationLabelsCallback, SummaryContentCallback, ValidationTooltipContext, ToolbarPosition, GridLabels, RowLockInfo, RowLockingOptions, RowLockChangeDetail, ColumnWidthState, ColumnResizeDetail, ColumnOrderState, ColumnReorderDetail, FillDragDetail, FillDirection, RangeShortcut } from './types.js';
|
|
1
|
+
import type { Column, CellValidationState, RowToolbarConfig, ContextMenuItem, RowShortcut, RowChangeDetail, ToolbarClickDetail, RowActionClickDetail, ContextMenuContext, HeaderMenuConfig, HeaderMenuContext, EditTrigger, EditStartSelection, EditingCell, FocusedCell, SortMode, SortState, DataRequestDetail, DataRequestTrigger, BeforeCommitResult, GridMode, ToggleVisibility, PaginationLabelsCallback, SummaryContentCallback, ValidationTooltipContext, ToolbarPosition, GridLabels, RowLockInfo, RowLockingOptions, RowLockChangeDetail, ColumnWidthState, ColumnResizeDetail, ColumnOrderState, ColumnReorderDetail, FillDragDetail, FillDirection, RangeShortcut, CellSelectionMode, CellRange, CellSelectionChangeDetail } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* WebGrid - Core logic class for the data grid
|
|
4
4
|
*
|
|
@@ -9,25 +9,25 @@ export declare class WebGrid<T = unknown> {
|
|
|
9
9
|
protected _items: T[];
|
|
10
10
|
protected _columns: Column<T>[];
|
|
11
11
|
protected _sortMode: SortMode;
|
|
12
|
-
protected
|
|
13
|
-
protected
|
|
12
|
+
protected _isFilterable: boolean;
|
|
13
|
+
protected _isPageable: boolean;
|
|
14
14
|
protected _pageSize: number;
|
|
15
15
|
protected _pageSizes: number[];
|
|
16
|
-
protected
|
|
17
|
-
protected
|
|
18
|
-
protected
|
|
16
|
+
protected _isStriped: boolean;
|
|
17
|
+
protected _isHoverable: boolean;
|
|
18
|
+
protected _isEditable: boolean;
|
|
19
19
|
protected _editTrigger: EditTrigger;
|
|
20
20
|
protected _editStartSelection: EditStartSelection;
|
|
21
21
|
protected _mode: GridMode;
|
|
22
22
|
protected _dropdownToggleVisibility: ToggleVisibility;
|
|
23
|
-
protected
|
|
24
|
-
protected
|
|
25
|
-
protected
|
|
26
|
-
protected
|
|
27
|
-
protected
|
|
23
|
+
protected _shouldShowDropdownOnFocus: boolean;
|
|
24
|
+
protected _shouldOpenDropdownOnEnter: boolean;
|
|
25
|
+
protected _isCheckboxAlwaysEditable: boolean;
|
|
26
|
+
protected _isRowNumbersVisible: boolean;
|
|
27
|
+
protected _isStickyRowNumbers: boolean;
|
|
28
28
|
protected _freezeColumns: number;
|
|
29
29
|
protected _invalidCells: CellValidationState[];
|
|
30
|
-
protected
|
|
30
|
+
protected _isRowToolbarVisible: boolean;
|
|
31
31
|
protected _rowToolbar: RowToolbarConfig<T>[];
|
|
32
32
|
protected _toolbarVerticalAlign: 'top' | 'center' | 'bottom';
|
|
33
33
|
protected _toolbarHorizontalAlign: 'start' | 'center' | 'end' | 'cursor';
|
|
@@ -39,7 +39,7 @@ export declare class WebGrid<T = unknown> {
|
|
|
39
39
|
protected _contextMenuYOffset: number;
|
|
40
40
|
protected _headerContextMenu: HeaderMenuConfig<T>[] | undefined;
|
|
41
41
|
protected _rowShortcuts: RowShortcut<T>[] | undefined;
|
|
42
|
-
protected
|
|
42
|
+
protected _isShortcutsHelpVisible: boolean;
|
|
43
43
|
protected _shortcutsHelpPosition: 'top-right' | 'top-left';
|
|
44
44
|
protected _shortcutsHelpContentCallback: (() => string) | undefined;
|
|
45
45
|
protected _idValueMember: keyof T | undefined;
|
|
@@ -48,15 +48,15 @@ export declare class WebGrid<T = unknown> {
|
|
|
48
48
|
protected _externalLocks: Map<unknown, RowLockInfo>;
|
|
49
49
|
protected _onrowlockchange: ((detail: RowLockChangeDetail<T>) => void) | undefined;
|
|
50
50
|
protected _gridName: string | null;
|
|
51
|
-
protected
|
|
51
|
+
protected _shouldPersistColumnWidths: boolean;
|
|
52
52
|
protected _columnWidths: Map<string, string>;
|
|
53
53
|
protected _oncolumnresize: ((detail: ColumnResizeDetail) => void) | undefined;
|
|
54
|
-
protected
|
|
55
|
-
protected
|
|
54
|
+
protected _isColumnReorderAllowed: boolean;
|
|
55
|
+
protected _shouldPersistColumnOrder: boolean;
|
|
56
56
|
protected _columnOrder: Map<string, number>;
|
|
57
57
|
protected _oncolumnreorder: ((detail: ColumnReorderDetail) => void) | undefined;
|
|
58
58
|
protected _fillDirection: FillDirection;
|
|
59
|
-
protected
|
|
59
|
+
protected _fillDragCallback: ((detail: FillDragDetail) => boolean | void) | undefined;
|
|
60
60
|
protected _onrowchange: ((detail: RowChangeDetail<T>) => void) | undefined;
|
|
61
61
|
protected _onroweditstart: ((detail: {
|
|
62
62
|
row: T;
|
|
@@ -95,15 +95,15 @@ export declare class WebGrid<T = unknown> {
|
|
|
95
95
|
protected _summaryPosition?: string;
|
|
96
96
|
protected _summaryContentCallback?: SummaryContentCallback<T>;
|
|
97
97
|
protected _summaryMetadata: unknown;
|
|
98
|
-
protected
|
|
98
|
+
protected _isSummaryInline: boolean;
|
|
99
99
|
protected _customStylesCallback?: () => string;
|
|
100
100
|
protected _rowClassCallback?: (row: T, rowIndex: number) => string | null;
|
|
101
101
|
protected _labels: GridLabels;
|
|
102
|
-
protected
|
|
102
|
+
protected _isVirtualScrollEnabled: boolean;
|
|
103
103
|
protected _virtualScrollThreshold: number;
|
|
104
104
|
protected _virtualScrollRowHeight: number;
|
|
105
105
|
protected _virtualScrollBuffer: number;
|
|
106
|
-
protected
|
|
106
|
+
protected _isInfiniteScrollEnabled: boolean;
|
|
107
107
|
protected _infiniteScrollThreshold: number;
|
|
108
108
|
protected _hasMoreItems: boolean;
|
|
109
109
|
protected _isLoadingMore: boolean;
|
|
@@ -122,26 +122,34 @@ export declare class WebGrid<T = unknown> {
|
|
|
122
122
|
protected _selectedRows: Set<number>;
|
|
123
123
|
protected _lastSelectedRowIndex: number | null;
|
|
124
124
|
protected _rangeShortcuts: RangeShortcut<T>[];
|
|
125
|
+
protected _cellSelectionMode: CellSelectionMode;
|
|
126
|
+
protected _selectedCellRange: CellRange | null;
|
|
127
|
+
protected _lastClickedCell: {
|
|
128
|
+
rowIndex: number;
|
|
129
|
+
colIndex: number;
|
|
130
|
+
} | null;
|
|
131
|
+
protected _shouldCopyWithHeaders: boolean;
|
|
132
|
+
protected _oncellselectionchange: ((detail: CellSelectionChangeDetail) => void) | null;
|
|
125
133
|
get items(): T[];
|
|
126
134
|
set items(value: T[]);
|
|
127
135
|
get columns(): Column<T>[];
|
|
128
136
|
set columns(value: Column<T>[]);
|
|
129
137
|
get sortMode(): SortMode;
|
|
130
138
|
set sortMode(value: SortMode);
|
|
131
|
-
get
|
|
132
|
-
set
|
|
133
|
-
get
|
|
134
|
-
set
|
|
139
|
+
get isFilterable(): boolean;
|
|
140
|
+
set isFilterable(value: boolean);
|
|
141
|
+
get isPageable(): boolean;
|
|
142
|
+
set isPageable(value: boolean);
|
|
135
143
|
get pageSize(): number;
|
|
136
144
|
set pageSize(value: number);
|
|
137
145
|
get pageSizes(): number[];
|
|
138
146
|
set pageSizes(value: number[]);
|
|
139
|
-
get
|
|
140
|
-
set
|
|
141
|
-
get
|
|
142
|
-
set
|
|
143
|
-
get
|
|
144
|
-
set
|
|
147
|
+
get isStriped(): boolean;
|
|
148
|
+
set isStriped(value: boolean);
|
|
149
|
+
get isHoverable(): boolean;
|
|
150
|
+
set isHoverable(value: boolean);
|
|
151
|
+
get isEditable(): boolean;
|
|
152
|
+
set isEditable(value: boolean);
|
|
145
153
|
get editTrigger(): EditTrigger;
|
|
146
154
|
set editTrigger(value: EditTrigger);
|
|
147
155
|
get editStartSelection(): EditStartSelection;
|
|
@@ -154,20 +162,20 @@ export declare class WebGrid<T = unknown> {
|
|
|
154
162
|
* Get effective toggle visibility for a column (column override or grid default)
|
|
155
163
|
*/
|
|
156
164
|
getEffectiveToggleVisibility(column: Column<T>): ToggleVisibility;
|
|
157
|
-
get
|
|
158
|
-
set
|
|
159
|
-
get
|
|
160
|
-
set
|
|
161
|
-
/**
|
|
162
|
-
* Get effective
|
|
163
|
-
*/
|
|
164
|
-
|
|
165
|
-
get
|
|
166
|
-
set
|
|
167
|
-
get
|
|
168
|
-
set
|
|
169
|
-
get
|
|
170
|
-
set
|
|
165
|
+
get shouldShowDropdownOnFocus(): boolean;
|
|
166
|
+
set shouldShowDropdownOnFocus(value: boolean);
|
|
167
|
+
get shouldOpenDropdownOnEnter(): boolean;
|
|
168
|
+
set shouldOpenDropdownOnEnter(value: boolean);
|
|
169
|
+
/**
|
|
170
|
+
* Get effective shouldOpenDropdownOnEnter for a column (column override or grid default)
|
|
171
|
+
*/
|
|
172
|
+
getEffectiveShouldOpenDropdownOnEnter(column: Column<T>): boolean;
|
|
173
|
+
get isCheckboxAlwaysEditable(): boolean;
|
|
174
|
+
set isCheckboxAlwaysEditable(value: boolean);
|
|
175
|
+
get isRowNumbersVisible(): boolean;
|
|
176
|
+
set isRowNumbersVisible(value: boolean);
|
|
177
|
+
get isStickyRowNumbers(): boolean;
|
|
178
|
+
set isStickyRowNumbers(value: boolean);
|
|
171
179
|
get freezeColumns(): number;
|
|
172
180
|
set freezeColumns(value: number);
|
|
173
181
|
/**
|
|
@@ -193,8 +201,8 @@ export declare class WebGrid<T = unknown> {
|
|
|
193
201
|
get isValidating(): boolean;
|
|
194
202
|
get currentCellError(): string | null;
|
|
195
203
|
get hoveredRowIndex(): number | null;
|
|
196
|
-
get
|
|
197
|
-
set
|
|
204
|
+
get isRowToolbarVisible(): boolean;
|
|
205
|
+
set isRowToolbarVisible(value: boolean);
|
|
198
206
|
get rowToolbar(): RowToolbarConfig<T>[];
|
|
199
207
|
set rowToolbar(value: RowToolbarConfig<T>[]);
|
|
200
208
|
get toolbarVerticalAlign(): 'top' | 'center' | 'bottom';
|
|
@@ -221,8 +229,8 @@ export declare class WebGrid<T = unknown> {
|
|
|
221
229
|
set headerContextMenu(value: HeaderMenuConfig<T>[] | undefined);
|
|
222
230
|
get rowShortcuts(): RowShortcut<T>[] | undefined;
|
|
223
231
|
set rowShortcuts(value: RowShortcut<T>[] | undefined);
|
|
224
|
-
get
|
|
225
|
-
set
|
|
232
|
+
get isShortcutsHelpVisible(): boolean;
|
|
233
|
+
set isShortcutsHelpVisible(value: boolean);
|
|
226
234
|
get shortcutsHelpPosition(): 'top-right' | 'top-left';
|
|
227
235
|
set shortcutsHelpPosition(value: 'top-right' | 'top-left');
|
|
228
236
|
get shortcutsHelpContentCallback(): (() => string) | undefined;
|
|
@@ -247,24 +255,24 @@ export declare class WebGrid<T = unknown> {
|
|
|
247
255
|
set summaryContentCallback(value: SummaryContentCallback<T> | undefined);
|
|
248
256
|
get summaryMetadata(): unknown;
|
|
249
257
|
set summaryMetadata(value: unknown);
|
|
250
|
-
get
|
|
251
|
-
set
|
|
258
|
+
get isSummaryInline(): boolean;
|
|
259
|
+
set isSummaryInline(value: boolean);
|
|
252
260
|
get customStylesCallback(): (() => string) | undefined;
|
|
253
261
|
set customStylesCallback(value: (() => string) | undefined);
|
|
254
262
|
get rowClassCallback(): ((row: T, rowIndex: number) => string | null) | undefined;
|
|
255
263
|
set rowClassCallback(value: ((row: T, rowIndex: number) => string | null) | undefined);
|
|
256
264
|
get labels(): GridLabels;
|
|
257
265
|
set labels(value: Partial<GridLabels>);
|
|
258
|
-
get
|
|
259
|
-
set
|
|
266
|
+
get isVirtualScrollEnabled(): boolean;
|
|
267
|
+
set isVirtualScrollEnabled(value: boolean);
|
|
260
268
|
get virtualScrollThreshold(): number;
|
|
261
269
|
set virtualScrollThreshold(value: number);
|
|
262
270
|
get virtualScrollRowHeight(): number;
|
|
263
271
|
set virtualScrollRowHeight(value: number);
|
|
264
272
|
get virtualScrollBuffer(): number;
|
|
265
273
|
set virtualScrollBuffer(value: number);
|
|
266
|
-
get
|
|
267
|
-
set
|
|
274
|
+
get isInfiniteScrollEnabled(): boolean;
|
|
275
|
+
set isInfiniteScrollEnabled(value: boolean);
|
|
268
276
|
get infiniteScrollThreshold(): number;
|
|
269
277
|
set infiniteScrollThreshold(value: number);
|
|
270
278
|
get hasMoreItems(): boolean;
|
|
@@ -275,10 +283,6 @@ export declare class WebGrid<T = unknown> {
|
|
|
275
283
|
* Check if virtual scroll should be used
|
|
276
284
|
*/
|
|
277
285
|
shouldUseVirtualScroll(): boolean;
|
|
278
|
-
get showRowActions(): boolean;
|
|
279
|
-
set showRowActions(value: boolean);
|
|
280
|
-
get rowActions(): RowToolbarConfig<T>[];
|
|
281
|
-
set rowActions(value: RowToolbarConfig<T>[]);
|
|
282
286
|
set onrowchange(value: ((detail: RowChangeDetail<T>) => void) | undefined);
|
|
283
287
|
set onroweditstart(value: ((detail: {
|
|
284
288
|
row: T;
|
|
@@ -324,20 +328,20 @@ export declare class WebGrid<T = unknown> {
|
|
|
324
328
|
set onrowlockchange(value: ((detail: RowLockChangeDetail<T>) => void) | undefined);
|
|
325
329
|
get gridName(): string | null;
|
|
326
330
|
set gridName(value: string | null);
|
|
327
|
-
get
|
|
328
|
-
set
|
|
331
|
+
get shouldPersistColumnWidths(): boolean;
|
|
332
|
+
set shouldPersistColumnWidths(value: boolean);
|
|
329
333
|
get oncolumnresize(): ((detail: ColumnResizeDetail) => void) | undefined;
|
|
330
334
|
set oncolumnresize(value: ((detail: ColumnResizeDetail) => void) | undefined);
|
|
331
|
-
get
|
|
332
|
-
set
|
|
333
|
-
get
|
|
334
|
-
set
|
|
335
|
+
get isColumnReorderAllowed(): boolean;
|
|
336
|
+
set isColumnReorderAllowed(value: boolean);
|
|
337
|
+
get shouldPersistColumnOrder(): boolean;
|
|
338
|
+
set shouldPersistColumnOrder(value: boolean);
|
|
335
339
|
get oncolumnreorder(): ((detail: ColumnReorderDetail) => void) | undefined;
|
|
336
340
|
set oncolumnreorder(value: ((detail: ColumnReorderDetail) => void) | undefined);
|
|
337
341
|
get fillDirection(): FillDirection;
|
|
338
342
|
set fillDirection(value: FillDirection);
|
|
339
|
-
get
|
|
340
|
-
set
|
|
343
|
+
get fillDragCallback(): ((detail: FillDragDetail) => boolean | void) | undefined;
|
|
344
|
+
set fillDragCallback(value: ((detail: FillDragDetail) => boolean | void) | undefined);
|
|
341
345
|
get selectedRows(): number[];
|
|
342
346
|
get rangeShortcuts(): RangeShortcut<T>[];
|
|
343
347
|
set rangeShortcuts(value: RangeShortcut<T>[]);
|
|
@@ -346,6 +350,44 @@ export declare class WebGrid<T = unknown> {
|
|
|
346
350
|
selectRowRange(fromIndex: number, toIndex: number): void;
|
|
347
351
|
clearSelection(): void;
|
|
348
352
|
getSelectedRowsData(): T[];
|
|
353
|
+
/**
|
|
354
|
+
* Copy selected rows to clipboard in TSV format (Excel-compatible)
|
|
355
|
+
* @returns true if copy was successful, false if no selection or clipboard failed
|
|
356
|
+
*/
|
|
357
|
+
copySelectedRowsToClipboard(): Promise<boolean>;
|
|
358
|
+
get cellSelectionMode(): CellSelectionMode;
|
|
359
|
+
set cellSelectionMode(value: CellSelectionMode);
|
|
360
|
+
get shouldCopyWithHeaders(): boolean;
|
|
361
|
+
set shouldCopyWithHeaders(value: boolean);
|
|
362
|
+
get selectedCellRange(): CellRange | null;
|
|
363
|
+
get lastClickedCell(): {
|
|
364
|
+
rowIndex: number;
|
|
365
|
+
colIndex: number;
|
|
366
|
+
} | null;
|
|
367
|
+
set lastClickedCell(value: {
|
|
368
|
+
rowIndex: number;
|
|
369
|
+
colIndex: number;
|
|
370
|
+
} | null);
|
|
371
|
+
get oncellselectionchange(): ((detail: CellSelectionChangeDetail) => void) | null;
|
|
372
|
+
set oncellselectionchange(value: ((detail: CellSelectionChangeDetail) => void) | null);
|
|
373
|
+
selectCellRange(range: CellRange): void;
|
|
374
|
+
clearCellSelection(): void;
|
|
375
|
+
getSelectedCells(): Array<{
|
|
376
|
+
row: T;
|
|
377
|
+
rowIndex: number;
|
|
378
|
+
colIndex: number;
|
|
379
|
+
field: string;
|
|
380
|
+
value: unknown;
|
|
381
|
+
}>;
|
|
382
|
+
/**
|
|
383
|
+
* Check if a cell is in the selected cell range
|
|
384
|
+
*/
|
|
385
|
+
isCellInSelectedRange(rowIndex: number, colIndex: number): boolean;
|
|
386
|
+
/**
|
|
387
|
+
* Copy selected cell range to clipboard in TSV format (Excel-compatible)
|
|
388
|
+
* @returns true if copy was successful, false if no selection or clipboard failed
|
|
389
|
+
*/
|
|
390
|
+
copyCellSelectionToClipboard(): Promise<boolean>;
|
|
349
391
|
get isNavigateMode(): boolean;
|
|
350
392
|
get filteredItems(): T[];
|
|
351
393
|
get sortedItems(): T[];
|
|
@@ -369,6 +411,10 @@ export declare class WebGrid<T = unknown> {
|
|
|
369
411
|
* Called when mode is set.
|
|
370
412
|
*/
|
|
371
413
|
protected applyModeDefaults(): void;
|
|
414
|
+
/**
|
|
415
|
+
* Check for configuration conflicts and warn user
|
|
416
|
+
*/
|
|
417
|
+
protected checkSelectionConflicts(): void;
|
|
372
418
|
protected requestUpdate(): void;
|
|
373
419
|
getRowDraft(rowIndex: number): T | undefined;
|
|
374
420
|
hasRowDraft(rowIndex: number): boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { GridElement } from './web-component.js';
|
|
2
2
|
export { WebGrid } from './grid.js';
|
|
3
|
-
export type { EditorType, EditTrigger, OptionsLoadTrigger, DateOutputFormat, EditorOption, EditorOptions, CustomEditorContext, CellValidationState, ValidationResult, BeforeCommitContext, BeforeCommitResult, Column, CellRenderCallback, RowChangeDetail, PredefinedToolbarItemType, ToolbarPosition, ToolbarTooltip, RowToolbarItem, RowToolbarConfig, NormalizedToolbarItem, ToolbarClickDetail, RowActionType, RowActionClickDetail, ContextMenuContext, ContextMenuItem, QuickGridProps, SortState, DataRequestDetail, DataRequestTrigger, GridLabels, RowLockInfo, RowLockingOptions, RowLockChangeDetail, LockedRowEditBehavior, ColumnWidthState, ColumnResizeDetail, ColumnOrderState, ColumnReorderDetail, FillDragDetail, FillDirection, RangeShortcut, RangeShortcutContext, EditingCell, FocusedCell, SortDirection, ToolbarRowGroup, PopupPosition, ConnectorArrowDir } from './types.js';
|
|
3
|
+
export type { EditorType, EditTrigger, OptionsLoadTrigger, DateOutputFormat, EditorOption, EditorOptions, CustomEditorContext, CellValidationState, ValidationResult, BeforeCommitContext, BeforeCommitResult, Column, CellRenderCallback, RowChangeDetail, PredefinedToolbarItemType, ToolbarPosition, ToolbarTooltip, RowToolbarItem, RowToolbarConfig, NormalizedToolbarItem, ToolbarClickDetail, RowActionType, RowActionClickDetail, ContextMenuContext, ContextMenuItem, QuickGridProps, SortState, DataRequestDetail, DataRequestTrigger, GridLabels, RowLockInfo, RowLockingOptions, RowLockChangeDetail, LockedRowEditBehavior, ColumnWidthState, ColumnResizeDetail, ColumnOrderState, ColumnReorderDetail, FillDragDetail, FillDirection, RangeShortcut, RangeShortcutContext, CellSelectionMode, CellRange, CellSelectionChangeDetail, EditingCell, FocusedCell, SortDirection, ToolbarRowGroup, PopupPosition, ConnectorArrowDir } from './types.js';
|
|
4
4
|
export { GridElement as default } from './web-component.js';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { GridContext } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Check if cell selection drag is in progress
|
|
4
|
+
*/
|
|
5
|
+
export declare function isCellSelecting(): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Check if cell selection drag is pending (mouse down but not dragging yet)
|
|
8
|
+
*/
|
|
9
|
+
export declare function isCellSelectionPending(): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Handle mousedown on a cell to start selection
|
|
12
|
+
*/
|
|
13
|
+
export declare function handleCellMouseDown<T>(ctx: GridContext<T>, rowIndex: number, colIndex: number, event: MouseEvent): void;
|
|
14
|
+
/**
|
|
15
|
+
* Handle Shift+Click to extend/create range to clicked cell
|
|
16
|
+
*/
|
|
17
|
+
export declare function handleCellShiftClick<T>(ctx: GridContext<T>, rowIndex: number, colIndex: number): void;
|
|
18
|
+
/**
|
|
19
|
+
* Create persistent range border (after selection complete)
|
|
20
|
+
*/
|
|
21
|
+
export declare function createRangeBorder<T>(ctx: GridContext<T>): void;
|
|
22
|
+
/**
|
|
23
|
+
* Update range border position (e.g., on scroll)
|
|
24
|
+
*/
|
|
25
|
+
export declare function updateRangeBorder<T>(ctx: GridContext<T>): void;
|
|
26
|
+
/**
|
|
27
|
+
* Remove the persistent range border
|
|
28
|
+
*/
|
|
29
|
+
export declare function removeRangeBorder(): void;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type FocusEventType = 'blur' | 'focusout';
|
|
2
|
+
export type FocusHandler = (target: HTMLElement, relatedTarget: HTMLElement | null) => void;
|
|
3
|
+
export interface FocusSubscription {
|
|
4
|
+
unsubscribe: () => void;
|
|
5
|
+
}
|
|
6
|
+
export interface FocusEventManager {
|
|
7
|
+
/**
|
|
8
|
+
* Subscribe to focus events
|
|
9
|
+
* @param type - 'blur' for editor blur (capture phase), 'focusout' for table focusout
|
|
10
|
+
* @param handler - Callback with target and relatedTarget
|
|
11
|
+
* @returns Subscription object with unsubscribe method
|
|
12
|
+
*/
|
|
13
|
+
subscribe(type: FocusEventType, handler: FocusHandler): FocusSubscription;
|
|
14
|
+
/**
|
|
15
|
+
* Unified guard check - returns true if blur should be skipped
|
|
16
|
+
* Checks: isCommittingFromKeyboard, isTransitioningCells, isClosingViaToggle, isOpeningDropdown
|
|
17
|
+
*/
|
|
18
|
+
shouldSkipBlur(): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Initialize focus listeners on the table element
|
|
21
|
+
*/
|
|
22
|
+
init(table: HTMLElement): void;
|
|
23
|
+
/**
|
|
24
|
+
* Remove all listeners and subscriptions
|
|
25
|
+
*/
|
|
26
|
+
destroy(): void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Guard state for blur handling
|
|
30
|
+
*/
|
|
31
|
+
export interface BlurGuardState {
|
|
32
|
+
isCommittingFromKeyboard: boolean;
|
|
33
|
+
isTransitioningCells: boolean;
|
|
34
|
+
isClosingViaToggle: boolean;
|
|
35
|
+
isOpeningDropdown: boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Create a focus event manager for a single grid instance
|
|
39
|
+
* @param getGuardState - Callback to get current guard flag state
|
|
40
|
+
* @param resetClosingViaToggle - Callback to reset the isClosingViaToggle flag
|
|
41
|
+
*/
|
|
42
|
+
export declare function createFocusEventManager(getGuardState: () => BlurGuardState, resetClosingViaToggle: () => void): FocusEventManager;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { focusCellElement, updateFocusVisual, clearEditingVisual, handleCellFocus, moveFocus, tryStartEdit, getCursorPositionFromClick, handleTableFocusOut, scrollToRowPosition } from './focus.js';
|
|
1
|
+
export { focusCellElement, updateFocusVisual, clearEditingVisual, restoreEditingCellToDisplayMode, handleCellFocus, moveFocus, tryStartEdit, getCursorPositionFromClick, handleTableFocusOut, scrollToRowPosition } from './focus.js';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type ScrollSource = 'container' | 'window';
|
|
2
|
+
export type ScrollHandler = () => void;
|
|
3
|
+
export interface ScrollSubscription {
|
|
4
|
+
unsubscribe: () => void;
|
|
5
|
+
}
|
|
6
|
+
export interface ScrollEventManager {
|
|
7
|
+
/**
|
|
8
|
+
* Subscribe to scroll events from a specific source
|
|
9
|
+
* @param source - 'container' for grid container scroll, 'window' for window scroll
|
|
10
|
+
* @param handler - Callback function to invoke on scroll
|
|
11
|
+
* @returns Subscription object with unsubscribe method
|
|
12
|
+
*/
|
|
13
|
+
subscribe(source: ScrollSource, handler: ScrollHandler): ScrollSubscription;
|
|
14
|
+
/**
|
|
15
|
+
* Initialize scroll listeners (called once in connectedCallback)
|
|
16
|
+
* @param container - The grid container element (.wg)
|
|
17
|
+
*/
|
|
18
|
+
init(container: HTMLElement): void;
|
|
19
|
+
/**
|
|
20
|
+
* Remove all listeners and subscriptions (called in disconnectedCallback)
|
|
21
|
+
*/
|
|
22
|
+
destroy(): void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Create a scroll event manager for a single grid instance
|
|
26
|
+
*/
|
|
27
|
+
export declare function createScrollEventManager(): ScrollEventManager;
|
package/dist/modules/types.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { WebGrid } from '../grid.js';
|
|
2
2
|
import type { Column, EditorOption, EditorOptions } from '../types.js';
|
|
3
|
+
import type { ScrollEventManager } from './scroll-events/index.js';
|
|
4
|
+
import type { FocusEventManager } from './focus-events/index.js';
|
|
3
5
|
/**
|
|
4
6
|
* GridElement context interface for module functions
|
|
5
7
|
* This is the subset of GridElement that modules need access to
|
|
@@ -29,4 +31,6 @@ export interface GridContext<T = unknown> {
|
|
|
29
31
|
getCurrentEditingColumn(): Column<T> | null;
|
|
30
32
|
getCurrentEditorOptions(): EditorOptions;
|
|
31
33
|
moveFocusAfterCommit(rowIndex: number, field: string, direction: 'down' | 'up' | 'next' | 'prev'): void;
|
|
34
|
+
readonly scrollEvents: ScrollEventManager;
|
|
35
|
+
readonly focusEvents: FocusEventManager;
|
|
32
36
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export type OptionsLoadTrigger = "immediate" | "oneditstart" | "ondropdownopen";
|
|
|
6
6
|
export type DateOutputFormat = "date" | "iso" | "timestamp";
|
|
7
7
|
export type EditStartSelection = "mousePosition" | "selectAll" | "cursorAtStart" | "cursorAtEnd";
|
|
8
8
|
export type FillDirection = "vertical" | "all";
|
|
9
|
+
export type CellSelectionMode = "disabled" | "click" | "shift";
|
|
9
10
|
export type EditorOption = {
|
|
10
11
|
value: string | number | boolean;
|
|
11
12
|
label: string;
|
|
@@ -41,6 +42,7 @@ export type EditorOptions<T = unknown> = {
|
|
|
41
42
|
emptyLabel?: string;
|
|
42
43
|
noOptionsText?: string;
|
|
43
44
|
searchingText?: string;
|
|
45
|
+
dropdownMinWidth?: string;
|
|
44
46
|
maxLength?: number;
|
|
45
47
|
placeholder?: string;
|
|
46
48
|
pattern?: string;
|
|
@@ -58,7 +60,7 @@ export type EditorOptions<T = unknown> = {
|
|
|
58
60
|
dateFormat?: string;
|
|
59
61
|
outputFormat?: DateOutputFormat;
|
|
60
62
|
initialOptions?: EditorOption[];
|
|
61
|
-
|
|
63
|
+
searchCallback?: (query: string, row: T, signal?: AbortSignal) => Promise<EditorOption[]>;
|
|
62
64
|
minSearchLength?: number;
|
|
63
65
|
debounceMs?: number;
|
|
64
66
|
multiple?: boolean;
|
|
@@ -95,37 +97,41 @@ export type Column<T> = {
|
|
|
95
97
|
field: keyof T | string;
|
|
96
98
|
title: string;
|
|
97
99
|
headerInfo?: string;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
+
isSortable?: boolean;
|
|
101
|
+
isFilterable?: boolean;
|
|
100
102
|
width?: string;
|
|
101
103
|
minWidth?: string;
|
|
102
104
|
maxWidth?: string;
|
|
103
105
|
textOverflow?: 'wrap' | 'ellipsis';
|
|
104
|
-
|
|
106
|
+
maxLines?: number;
|
|
107
|
+
horizontalAlign?: "left" | "center" | "right" | "justify";
|
|
108
|
+
verticalAlign?: "top" | "middle" | "bottom";
|
|
109
|
+
headerHorizontalAlign?: "left" | "center" | "right" | "justify";
|
|
110
|
+
headerVerticalAlign?: "top" | "middle" | "bottom";
|
|
105
111
|
cellClass?: string;
|
|
106
112
|
cellClassCallback?: (value: unknown, row: T) => string | null;
|
|
107
113
|
formatCallback?: (value: unknown, row: T) => string;
|
|
108
114
|
templateCallback?: (row: T) => string;
|
|
109
115
|
renderCallback?: CellRenderCallback<T>;
|
|
110
|
-
|
|
116
|
+
isEditable?: boolean;
|
|
111
117
|
editor?: EditorType;
|
|
112
118
|
editTrigger?: EditTrigger;
|
|
113
119
|
dropdownToggleVisibility?: ToggleVisibility;
|
|
114
|
-
|
|
120
|
+
shouldOpenDropdownOnEnter?: boolean;
|
|
115
121
|
editorOptions?: EditorOptions<T>;
|
|
116
122
|
validateCallback?: (value: unknown, row: T) => string | null | Promise<string | null>;
|
|
117
123
|
beforeCommitCallback?: (context: BeforeCommitContext<T>) => BeforeCommitResult | Promise<BeforeCommitResult>;
|
|
118
124
|
cellEditCallback?: (context: CustomEditorContext<T>) => void;
|
|
119
|
-
|
|
125
|
+
isEditButtonVisible?: boolean;
|
|
120
126
|
tooltipMember?: string;
|
|
121
127
|
tooltipCallback?: (value: unknown, row: T) => string | null;
|
|
122
128
|
beforeCopyCallback?: (value: unknown, row: T) => string;
|
|
123
129
|
beforePasteCallback?: (value: string, row: T) => unknown;
|
|
124
130
|
validationTooltipCallback?: (context: ValidationTooltipContext<T>) => string | null;
|
|
125
|
-
|
|
126
|
-
|
|
131
|
+
isFrozen?: boolean;
|
|
132
|
+
isResizable?: boolean;
|
|
127
133
|
fillDirection?: FillDirection;
|
|
128
|
-
|
|
134
|
+
isHidden?: boolean;
|
|
129
135
|
};
|
|
130
136
|
export type ValidationTooltipContext<T> = {
|
|
131
137
|
field: string;
|
|
@@ -144,6 +150,10 @@ export type RowChangeDetail<T> = {
|
|
|
144
150
|
isValid: boolean;
|
|
145
151
|
validationError?: string | null;
|
|
146
152
|
};
|
|
153
|
+
export type CellSelectionChangeDetail = {
|
|
154
|
+
range: CellRange | null;
|
|
155
|
+
cellCount: number;
|
|
156
|
+
};
|
|
147
157
|
export type PredefinedToolbarItemType = 'add' | 'delete' | 'duplicate' | 'moveUp' | 'moveDown';
|
|
148
158
|
export type ToolbarPosition = 'auto' | 'left' | 'right' | 'top' | 'inline';
|
|
149
159
|
export type ToolbarTooltip = {
|
|
@@ -240,9 +250,25 @@ export type RowShortcut<T> = {
|
|
|
240
250
|
action: (ctx: ShortcutContext<T>) => void | Promise<void>;
|
|
241
251
|
disabled?: boolean | ((ctx: ShortcutContext<T>) => boolean);
|
|
242
252
|
};
|
|
253
|
+
export type CellRange = {
|
|
254
|
+
startRowIndex: number;
|
|
255
|
+
startColIndex: number;
|
|
256
|
+
endRowIndex: number;
|
|
257
|
+
endColIndex: number;
|
|
258
|
+
startField: string;
|
|
259
|
+
endField: string;
|
|
260
|
+
};
|
|
243
261
|
export type RangeShortcutContext<T> = {
|
|
244
262
|
rows: T[];
|
|
245
263
|
rowIndices: number[];
|
|
264
|
+
cellRange?: CellRange;
|
|
265
|
+
cells?: Array<{
|
|
266
|
+
row: T;
|
|
267
|
+
rowIndex: number;
|
|
268
|
+
colIndex: number;
|
|
269
|
+
field: string;
|
|
270
|
+
value: unknown;
|
|
271
|
+
}>;
|
|
246
272
|
};
|
|
247
273
|
export type RangeShortcut<T> = {
|
|
248
274
|
key: string;
|
|
@@ -261,13 +287,13 @@ export type ParsedKeyCombo = {
|
|
|
261
287
|
export type QuickGridProps<T> = {
|
|
262
288
|
items: T[];
|
|
263
289
|
columns: Column<T>[];
|
|
264
|
-
|
|
265
|
-
|
|
290
|
+
isFilterable?: boolean;
|
|
291
|
+
isPageable?: boolean;
|
|
266
292
|
pageSize?: number;
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
293
|
+
isStriped?: boolean;
|
|
294
|
+
isHoverable?: boolean;
|
|
295
|
+
isRowNumbersVisible?: boolean;
|
|
296
|
+
isStickyRowNumbers?: boolean;
|
|
271
297
|
freezeColumns?: number;
|
|
272
298
|
class?: string;
|
|
273
299
|
style?: string;
|
|
@@ -284,27 +310,23 @@ export type QuickGridProps<T> = {
|
|
|
284
310
|
paginationLayout?: string;
|
|
285
311
|
summaryPosition?: string;
|
|
286
312
|
summaryContentCallback?: SummaryContentCallback<T>;
|
|
287
|
-
|
|
288
|
-
|
|
313
|
+
isSummaryInline?: boolean;
|
|
314
|
+
isEditable?: boolean;
|
|
289
315
|
editTrigger?: EditTrigger;
|
|
290
316
|
editStartSelection?: EditStartSelection;
|
|
291
317
|
mode?: GridMode;
|
|
292
318
|
dropdownToggleVisibility?: ToggleVisibility;
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
319
|
+
shouldShowDropdownOnFocus?: boolean;
|
|
320
|
+
shouldOpenDropdownOnEnter?: boolean;
|
|
321
|
+
isCheckboxAlwaysEditable?: boolean;
|
|
296
322
|
invalidCells?: CellValidationState[];
|
|
297
|
-
|
|
323
|
+
isRowToolbarVisible?: boolean;
|
|
298
324
|
rowToolbar?: RowToolbarConfig<T>[];
|
|
299
325
|
toolbarVerticalAlign?: 'top' | 'center' | 'bottom';
|
|
300
326
|
toolbarHorizontalAlign?: 'start' | 'center' | 'end' | 'cursor';
|
|
301
327
|
toolbarTrigger?: 'hover' | 'click' | 'button';
|
|
302
328
|
toolbarPosition?: ToolbarPosition;
|
|
303
329
|
inlineActionsTitle?: string;
|
|
304
|
-
showRowActions?: boolean;
|
|
305
|
-
rowActions?: RowToolbarConfig<T>[];
|
|
306
|
-
toolbarAlign?: 'top' | 'center' | 'bottom';
|
|
307
|
-
toolbarTopPosition?: 'start' | 'center' | 'end' | 'cursor';
|
|
308
330
|
contextMenu?: ContextMenuItem<T>[];
|
|
309
331
|
contextMenuXOffset?: number;
|
|
310
332
|
contextMenuYOffset?: number;
|
|
@@ -312,14 +334,14 @@ export type QuickGridProps<T> = {
|
|
|
312
334
|
headerContextMenu?: HeaderMenuConfig<T>[];
|
|
313
335
|
onheadercontextmenuopen?: (context: HeaderMenuContext<T>) => void;
|
|
314
336
|
rowShortcuts?: RowShortcut<T>[];
|
|
315
|
-
|
|
337
|
+
isShortcutsHelpVisible?: boolean;
|
|
316
338
|
shortcutsHelpPosition?: 'top-right' | 'top-left';
|
|
317
339
|
shortcutsHelpContentCallback?: () => string;
|
|
318
|
-
|
|
340
|
+
isVirtualScrollEnabled?: boolean;
|
|
319
341
|
virtualScrollThreshold?: number;
|
|
320
342
|
virtualScrollRowHeight?: number;
|
|
321
343
|
virtualScrollBuffer?: number;
|
|
322
|
-
|
|
344
|
+
isInfiniteScrollEnabled?: boolean;
|
|
323
345
|
infiniteScrollThreshold?: number;
|
|
324
346
|
hasMoreItems?: boolean;
|
|
325
347
|
onrowchange?: (detail: RowChangeDetail<T>) => void;
|
|
@@ -341,19 +363,21 @@ export type QuickGridProps<T> = {
|
|
|
341
363
|
}) => void;
|
|
342
364
|
validationTooltipCallback?: (context: ValidationTooltipContext<T>) => string | null;
|
|
343
365
|
ontoolbarclick?: (detail: ToolbarClickDetail<T>) => void;
|
|
344
|
-
onrowaction?: (detail: RowActionClickDetail<T>) => void;
|
|
345
366
|
ondatarequest?: (detail: DataRequestDetail) => void;
|
|
346
367
|
onrowdelete?: (detail: {
|
|
347
368
|
rowIndex: number;
|
|
348
369
|
row: T;
|
|
349
370
|
}) => void;
|
|
350
371
|
gridName?: string;
|
|
351
|
-
|
|
372
|
+
shouldPersistColumnWidths?: boolean;
|
|
352
373
|
oncolumnresize?: (detail: ColumnResizeDetail) => void;
|
|
353
|
-
|
|
354
|
-
|
|
374
|
+
isColumnReorderAllowed?: boolean;
|
|
375
|
+
shouldPersistColumnOrder?: boolean;
|
|
355
376
|
oncolumnreorder?: (detail: ColumnReorderDetail) => void;
|
|
356
|
-
|
|
377
|
+
fillDragCallback?: (detail: FillDragDetail) => boolean | void;
|
|
378
|
+
cellSelectionMode?: CellSelectionMode;
|
|
379
|
+
shouldCopyWithHeaders?: boolean;
|
|
380
|
+
oncellselectionchange?: (detail: CellSelectionChangeDetail) => void;
|
|
357
381
|
};
|
|
358
382
|
export type EditingCell = {
|
|
359
383
|
rowIndex: number;
|