@mikestools/usetable 0.0.1 → 0.0.2
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 +586 -519
- package/dist/index.d.ts +722 -121
- package/dist/usetable.js +1263 -1078
- package/dist/usetable.umd.cjs +7 -7
- package/package.json +20 -20
- package/showcase/examples/BasicExample.vue +474 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,175 +1,356 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for custom aggregation.
|
|
5
|
+
*/
|
|
6
|
+
export declare interface AggregateConfig<T> {
|
|
7
|
+
/** Initial accumulator value */
|
|
8
|
+
readonly initial: T;
|
|
9
|
+
/** Reducer function */
|
|
10
|
+
readonly reducer: (accumulator: T, value: unknown, rowIndex: number) => T;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Base record interface - all records must have an id.
|
|
15
|
+
* This is the foundation for the shared reactive data schema.
|
|
16
|
+
*/
|
|
17
|
+
export declare interface BaseRecord {
|
|
18
|
+
/** Unique identifier - required on all records */
|
|
19
|
+
readonly id: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Cell change record for dirty tracking.
|
|
24
|
+
*/
|
|
4
25
|
export declare interface CellChange {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
26
|
+
/** Row index */
|
|
27
|
+
readonly row: number;
|
|
28
|
+
/** Column index */
|
|
29
|
+
readonly column: number;
|
|
30
|
+
/** Previous value */
|
|
31
|
+
readonly oldValue: unknown;
|
|
32
|
+
/** New value */
|
|
33
|
+
readonly newValue: unknown;
|
|
9
34
|
}
|
|
10
35
|
|
|
11
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* Configuration for a table cell with content and attributes.
|
|
38
|
+
*/
|
|
12
39
|
export declare interface CellConfig {
|
|
13
|
-
value
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
40
|
+
/** The cell value - can be any type including HTML elements */
|
|
41
|
+
readonly value: unknown;
|
|
42
|
+
/** Optional HTML attributes to apply to the cell */
|
|
43
|
+
readonly attributes?: ElementAttributes;
|
|
44
|
+
/** Column span (colspan attribute) */
|
|
45
|
+
readonly columnSpan?: number;
|
|
46
|
+
/** Row span (rowspan attribute) */
|
|
47
|
+
readonly rowSpan?: number;
|
|
17
48
|
}
|
|
18
49
|
|
|
19
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* Cell position for focus/navigation.
|
|
52
|
+
*/
|
|
20
53
|
export declare interface CellPosition {
|
|
21
|
-
|
|
22
|
-
|
|
54
|
+
/** Row index */
|
|
55
|
+
readonly row: number;
|
|
56
|
+
/** Column index */
|
|
57
|
+
readonly column: number;
|
|
23
58
|
}
|
|
24
59
|
|
|
60
|
+
/**
|
|
61
|
+
* Validator function for a single cell.
|
|
62
|
+
* Returns true if valid, or a string error message if invalid.
|
|
63
|
+
*/
|
|
25
64
|
export declare type CellValidator = (value: unknown) => boolean | string;
|
|
26
65
|
|
|
27
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* Configuration for a table column.
|
|
68
|
+
*/
|
|
28
69
|
export declare interface ColumnConfig {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
70
|
+
/** Header content - string or CellConfig */
|
|
71
|
+
readonly header: string | CellConfig;
|
|
72
|
+
/** Default value for new cells in this column */
|
|
73
|
+
readonly defaultValue?: unknown;
|
|
74
|
+
/** Default attributes for cells in this column */
|
|
75
|
+
readonly defaultAttributes?: ElementAttributes;
|
|
32
76
|
}
|
|
33
77
|
|
|
34
|
-
/**
|
|
78
|
+
/**
|
|
79
|
+
* Column definition for type parsing/formatting.
|
|
80
|
+
*/
|
|
35
81
|
export declare interface ColumnDefinition {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
82
|
+
/** Data type of the column */
|
|
83
|
+
readonly type: 'string' | 'number' | 'date' | 'boolean';
|
|
84
|
+
/** Custom parser function */
|
|
85
|
+
readonly parser?: (value: unknown) => unknown;
|
|
86
|
+
/** Custom formatter function */
|
|
87
|
+
readonly formatter?: (value: unknown) => string;
|
|
88
|
+
/** Default value when cell is empty */
|
|
89
|
+
readonly defaultValue?: unknown;
|
|
90
|
+
/** Whether null/undefined values are allowed */
|
|
91
|
+
readonly nullable?: boolean;
|
|
41
92
|
}
|
|
42
93
|
|
|
43
|
-
/**
|
|
94
|
+
/**
|
|
95
|
+
* Configuration for computed columns.
|
|
96
|
+
*/
|
|
44
97
|
export declare interface ComputedColumnConfig {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
98
|
+
/** Function to compute the column value from row data */
|
|
99
|
+
readonly computeFunction: (row: unknown[]) => unknown;
|
|
100
|
+
/** Column header label */
|
|
101
|
+
readonly label: string;
|
|
102
|
+
/** Position to insert the column */
|
|
103
|
+
readonly index?: number;
|
|
48
104
|
}
|
|
49
105
|
|
|
50
|
-
/**
|
|
106
|
+
/**
|
|
107
|
+
* Configuration for editable cells.
|
|
108
|
+
*/
|
|
51
109
|
export declare interface EditableConfig {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
110
|
+
/** Enable cell editing */
|
|
111
|
+
readonly cells?: boolean;
|
|
112
|
+
/** Enable header editing */
|
|
113
|
+
readonly headers?: boolean;
|
|
114
|
+
/** Enable footer editing */
|
|
115
|
+
readonly footers?: boolean;
|
|
116
|
+
/** Specific columns that are editable */
|
|
117
|
+
readonly editableColumns?: readonly number[];
|
|
118
|
+
/** Specific rows that are editable */
|
|
119
|
+
readonly editableRows?: readonly number[];
|
|
120
|
+
/** Validator function */
|
|
121
|
+
readonly validator?: (value: string, row: number, column: number) => boolean | string;
|
|
122
|
+
/** Parser function to convert string input to stored value */
|
|
123
|
+
readonly parser?: (value: string, row: number, column: number) => unknown;
|
|
124
|
+
/** Callback when a cell is edited */
|
|
125
|
+
readonly onEdit?: (value: unknown, row: number, column: number) => void;
|
|
60
126
|
}
|
|
61
127
|
|
|
62
128
|
/**
|
|
63
129
|
* Comprehensive HTML element attributes for table elements.
|
|
64
|
-
*
|
|
130
|
+
* Supports class, style, data attributes, ARIA attributes, and event handlers.
|
|
65
131
|
*/
|
|
66
132
|
export declare interface ElementAttributes extends Partial<Omit<HTMLElement, 'style' | 'className' | 'classList' | 'children' | 'childNodes' | 'parentNode' | 'parentElement' | 'attributes' | 'tagName' | 'namespaceURI' | 'shadowRoot' | 'assignedSlot' | 'offsetParent' | 'offsetTop' | 'offsetLeft' | 'offsetWidth' | 'offsetHeight' | 'clientTop' | 'clientLeft' | 'clientWidth' | 'clientHeight' | 'scrollTop' | 'scrollLeft' | 'scrollWidth' | 'scrollHeight' | 'innerHTML' | 'outerHTML' | 'innerText' | 'outerText' | 'textContent' | 'addEventListener' | 'removeEventListener' | 'dispatchEvent' | 'getAttribute' | 'setAttribute' | 'removeAttribute' | 'hasAttribute' | 'appendChild' | 'removeChild' | 'replaceChild' | 'insertBefore' | 'querySelector' | 'querySelectorAll' | 'getElementsByTagName' | 'getElementsByClassName' | 'getElementById' | 'animate' | 'getAnimations' | 'attachShadow' | 'closest' | 'matches' | 'webkitMatchesSelector' | 'getBoundingClientRect' | 'getClientRects' | 'scrollIntoView' | 'scroll' | 'scrollBy' | 'scrollTo' | 'focus' | 'blur' | 'click'>>, Partial<GlobalEventHandlers>, Partial<ARIAMixin> {
|
|
133
|
+
/** CSS class - string, array of strings, or object with boolean values */
|
|
67
134
|
class?: string | string[] | Record<string, boolean>;
|
|
135
|
+
/** Inline styles - string or object */
|
|
68
136
|
style?: string | Partial<CSSStyleDeclaration> | Record<string, string | number>;
|
|
137
|
+
/** Data attributes as object */
|
|
69
138
|
dataset?: Record<string, string>;
|
|
70
|
-
|
|
71
|
-
[key: `
|
|
139
|
+
/** Data attributes with prefix */
|
|
140
|
+
[key: `data-${string}`]: string | undefined;
|
|
141
|
+
/** ARIA attributes with prefix */
|
|
142
|
+
[key: `aria-${string}`]: string | undefined;
|
|
143
|
+
/** Allow any other attributes */
|
|
72
144
|
[key: string]: unknown;
|
|
73
145
|
}
|
|
74
146
|
|
|
75
|
-
/**
|
|
147
|
+
/**
|
|
148
|
+
* Ensure a record has an ID, generating one if missing.
|
|
149
|
+
*/
|
|
150
|
+
export declare function ensureId<T extends Record<string, unknown>>(record: T, generator?: IdGenerator): T & {
|
|
151
|
+
id: string;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Filter state for tracking row filtering.
|
|
156
|
+
*/
|
|
76
157
|
export declare interface FilterState {
|
|
158
|
+
/** Whether any filter is active */
|
|
77
159
|
readonly isFiltered: Readonly<Ref<boolean>>;
|
|
160
|
+
/** Number of visible rows after filtering */
|
|
78
161
|
readonly filteredRowCount: Readonly<Ref<number>>;
|
|
162
|
+
/** Indices of visible rows */
|
|
79
163
|
readonly filteredIndices: Readonly<Ref<readonly number[]>>;
|
|
80
164
|
}
|
|
81
165
|
|
|
82
|
-
|
|
166
|
+
/**
|
|
167
|
+
* Find record by ID in array.
|
|
168
|
+
*/
|
|
169
|
+
export declare function findById<T extends BaseRecord>(records: readonly T[], id: string): T | undefined;
|
|
83
170
|
|
|
171
|
+
/**
|
|
172
|
+
* Validator function for all cells.
|
|
173
|
+
* Returns null if valid, or a string error message if invalid.
|
|
174
|
+
*/
|
|
175
|
+
export declare type FullValidator = (value: unknown, row: number, column: number) => string | null;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Default ID generator using crypto.randomUUID.
|
|
179
|
+
*/
|
|
180
|
+
export declare function generateId(): string;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Symbol for tracking auto-generated IDs.
|
|
184
|
+
* Internal use only - invisible to JSON.stringify, Object.keys, for...in.
|
|
185
|
+
*/
|
|
186
|
+
export declare const ID_GENERATED: unique symbol;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* ID generator function type.
|
|
190
|
+
*/
|
|
191
|
+
export declare type IdGenerator = () => string;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Find record index by ID.
|
|
195
|
+
*/
|
|
196
|
+
export declare function indexById<T extends BaseRecord>(records: readonly T[], id: string): number;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Type guard for CellConfig.
|
|
200
|
+
*/
|
|
84
201
|
export declare function isCellConfig(value: unknown): value is CellConfig;
|
|
85
202
|
|
|
203
|
+
/**
|
|
204
|
+
* Type guard for ValidationError.
|
|
205
|
+
*/
|
|
86
206
|
export declare function isValidationError(value: unknown): value is ValidationError;
|
|
87
207
|
|
|
208
|
+
/**
|
|
209
|
+
* Type guard for ValidationError array.
|
|
210
|
+
*/
|
|
88
211
|
export declare function isValidationErrorArray(value: unknown): value is ValidationError[];
|
|
89
212
|
|
|
213
|
+
/**
|
|
214
|
+
* Type guard for ValidationResult.
|
|
215
|
+
*/
|
|
90
216
|
export declare function isValidationResult(value: unknown): value is ValidationResult;
|
|
91
217
|
|
|
92
|
-
/**
|
|
218
|
+
/**
|
|
219
|
+
* Check if a value is a valid ID.
|
|
220
|
+
*/
|
|
221
|
+
export declare function isValidId(value: unknown): value is string;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Pagination configuration.
|
|
225
|
+
*/
|
|
93
226
|
export declare interface PaginationConfig {
|
|
94
|
-
|
|
95
|
-
|
|
227
|
+
/** Number of rows per page */
|
|
228
|
+
readonly pageSize: number;
|
|
229
|
+
/** Initial page (1-based) */
|
|
230
|
+
readonly currentPage?: number;
|
|
96
231
|
}
|
|
97
232
|
|
|
98
|
-
/**
|
|
233
|
+
/**
|
|
234
|
+
* Pagination state.
|
|
235
|
+
*/
|
|
99
236
|
export declare interface PaginationState {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
237
|
+
/** Total number of pages */
|
|
238
|
+
readonly totalPages: Readonly<Ref<number>>;
|
|
239
|
+
/** Current page (1-based) */
|
|
240
|
+
readonly currentPage: Ref<number>;
|
|
241
|
+
/** Number of rows per page */
|
|
242
|
+
readonly pageSize: Ref<number>;
|
|
243
|
+
/** Indices of visible rows on current page */
|
|
244
|
+
readonly visibleRows: Ref<number[]>;
|
|
104
245
|
}
|
|
105
246
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
247
|
+
/* Excluded from this release type: ReactiveCellCollection */
|
|
248
|
+
|
|
249
|
+
/* Excluded from this release type: ReactiveRowCollection */
|
|
250
|
+
|
|
251
|
+
/* Excluded from this release type: ReactiveTBodyCollection */
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Column definition for record-based tables.
|
|
255
|
+
* Maps record fields to table columns.
|
|
256
|
+
*/
|
|
257
|
+
export declare interface RecordColumnDef<T extends BaseRecord = BaseRecord> {
|
|
258
|
+
/** Field name (string) or accessor function */
|
|
259
|
+
readonly field: string | ((record: T) => unknown);
|
|
260
|
+
/** Column header text */
|
|
261
|
+
readonly header: string;
|
|
262
|
+
/** Format value for display */
|
|
263
|
+
readonly format?: (value: unknown, record: T) => string;
|
|
264
|
+
/** Parse display value back to data value */
|
|
265
|
+
readonly parse?: (value: string, record: T) => unknown;
|
|
266
|
+
/** Whether column is editable (default: true for fields, false for functions) */
|
|
267
|
+
readonly editable?: boolean;
|
|
268
|
+
/** Column width */
|
|
269
|
+
readonly width?: string | number;
|
|
270
|
+
/** Default value for new records */
|
|
271
|
+
readonly defaultValue?: unknown;
|
|
110
272
|
}
|
|
111
273
|
|
|
112
|
-
/**
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
274
|
+
/**
|
|
275
|
+
* Options for record-based table configuration.
|
|
276
|
+
*/
|
|
277
|
+
export declare interface RecordTableOptions<T extends BaseRecord = BaseRecord> {
|
|
278
|
+
/** Column definitions mapping fields to columns */
|
|
279
|
+
readonly columns: readonly RecordColumnDef<T>[];
|
|
280
|
+
/** ID generator for new records */
|
|
281
|
+
readonly idGenerator?: IdGenerator;
|
|
282
|
+
/** Callback when a cell is edited */
|
|
283
|
+
readonly onCellEdit?: (recordId: string, field: keyof T | string, value: unknown) => void;
|
|
284
|
+
/** Callback when a row is inserted */
|
|
285
|
+
readonly onRowInsert?: (values: Omit<T, 'id'>) => void;
|
|
286
|
+
/** Callback when a row is deleted */
|
|
287
|
+
readonly onRowDelete?: (recordId: string) => void;
|
|
288
|
+
/** Callback when row selection changes */
|
|
289
|
+
readonly onRowSelect?: (recordId: string | null) => void;
|
|
116
290
|
}
|
|
117
291
|
|
|
118
|
-
/**
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
292
|
+
/**
|
|
293
|
+
* Record-based table state.
|
|
294
|
+
*/
|
|
295
|
+
export declare interface RecordTableState<T extends BaseRecord = BaseRecord> {
|
|
296
|
+
/** All records in the table */
|
|
297
|
+
readonly records: readonly T[];
|
|
298
|
+
/** Currently selected record ID */
|
|
299
|
+
readonly selectedRecordId: string | null;
|
|
300
|
+
/** Record IDs in display order */
|
|
301
|
+
readonly displayOrder: readonly string[];
|
|
122
302
|
}
|
|
123
303
|
|
|
304
|
+
/**
|
|
305
|
+
* Validator function for a row.
|
|
306
|
+
* Returns true if valid, or a string error message if invalid.
|
|
307
|
+
*/
|
|
124
308
|
export declare type RowValidator = (rowData: unknown[]) => boolean | string;
|
|
125
309
|
|
|
126
|
-
/**
|
|
310
|
+
/**
|
|
311
|
+
* Options for search operations.
|
|
312
|
+
*/
|
|
127
313
|
export declare interface SearchOptions {
|
|
128
|
-
|
|
314
|
+
/** Whether search is case-sensitive */
|
|
315
|
+
readonly caseSensitive?: boolean;
|
|
129
316
|
}
|
|
130
317
|
|
|
131
|
-
/**
|
|
318
|
+
/**
|
|
319
|
+
* Search result for a found cell.
|
|
320
|
+
*/
|
|
132
321
|
export declare interface SearchResult {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
322
|
+
/** Row index */
|
|
323
|
+
readonly row: number;
|
|
324
|
+
/** Column index */
|
|
325
|
+
readonly column: number;
|
|
326
|
+
/** The found value */
|
|
327
|
+
readonly value: unknown;
|
|
136
328
|
}
|
|
137
329
|
|
|
138
|
-
/**
|
|
330
|
+
/**
|
|
331
|
+
* Sort state for tracking column sorting.
|
|
332
|
+
*/
|
|
139
333
|
export declare interface SortState {
|
|
334
|
+
/** Currently sorted column index */
|
|
140
335
|
readonly columnIndex: Readonly<Ref<number | null>>;
|
|
336
|
+
/** Whether sorted ascending */
|
|
141
337
|
readonly ascending: Readonly<Ref<boolean>>;
|
|
338
|
+
/** Whether sorted descending */
|
|
142
339
|
readonly descending: Readonly<Ref<boolean>>;
|
|
143
340
|
}
|
|
144
341
|
|
|
145
|
-
/**
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
readonly headers: Ref<string>;
|
|
152
|
-
readonly abbr: Ref<string>;
|
|
153
|
-
readonly scope: Ref<string>;
|
|
154
|
-
}
|
|
342
|
+
/**
|
|
343
|
+
* Strip generated ID from record (for export).
|
|
344
|
+
*/
|
|
345
|
+
export declare function stripGeneratedId<T extends {
|
|
346
|
+
id: string;
|
|
347
|
+
}>(record: T): Omit<T, 'id'> | T;
|
|
155
348
|
|
|
156
|
-
|
|
157
|
-
export declare interface TableRow extends ReactiveCellCollection {
|
|
158
|
-
readonly element: Readonly<Ref<HTMLTableRowElement>>;
|
|
159
|
-
readonly rowIndex: Readonly<Ref<number>>;
|
|
160
|
-
readonly sectionRowIndex: Readonly<Ref<number>>;
|
|
161
|
-
insertCell(index?: number): HTMLTableCellElement;
|
|
162
|
-
deleteCell(index: number): void;
|
|
163
|
-
getCell(index: number): TableCell | undefined;
|
|
164
|
-
}
|
|
349
|
+
/* Excluded from this release type: TableCell */
|
|
165
350
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
insertRow(index?: number): HTMLTableRowElement;
|
|
170
|
-
deleteRow(index: number): void;
|
|
171
|
-
getRow(index: number): TableRow | undefined;
|
|
172
|
-
}
|
|
351
|
+
/* Excluded from this release type: TableRow */
|
|
352
|
+
|
|
353
|
+
/* Excluded from this release type: TableSection */
|
|
173
354
|
|
|
174
355
|
/**
|
|
175
356
|
* A comprehensive Vue composable for direct HTML table DOM manipulation.
|
|
@@ -178,327 +359,747 @@ export declare interface TableSection extends ReactiveRowCollection {
|
|
|
178
359
|
*/
|
|
179
360
|
export declare function useTable(element: Ref<HTMLTableElement>): UseTableReturn;
|
|
180
361
|
|
|
181
|
-
/**
|
|
362
|
+
/**
|
|
363
|
+
* Main table composable return type.
|
|
364
|
+
*
|
|
365
|
+
* Provides comprehensive table manipulation capabilities including:
|
|
366
|
+
* - DOM structure methods
|
|
367
|
+
* - Data layer methods
|
|
368
|
+
* - Sorting, filtering, and searching
|
|
369
|
+
* - Selection and focus management
|
|
370
|
+
* - Validation and transformation
|
|
371
|
+
* - Import/export functionality
|
|
372
|
+
* - Undo/redo support
|
|
373
|
+
* - Pagination and virtual scrolling
|
|
374
|
+
*/
|
|
182
375
|
export declare interface UseTableReturn extends ReactiveRowCollection, ReactiveTBodyCollection {
|
|
376
|
+
/** The table element */
|
|
183
377
|
readonly element: Readonly<Ref<HTMLTableElement>>;
|
|
378
|
+
/** Caption element */
|
|
184
379
|
readonly caption: Ref<HTMLTableCaptionElement | null>;
|
|
380
|
+
/** Thead element */
|
|
185
381
|
readonly tHead: Ref<HTMLTableSectionElement | null>;
|
|
382
|
+
/** Tfoot element */
|
|
186
383
|
readonly tFoot: Ref<HTMLTableSectionElement | null>;
|
|
384
|
+
/** Table body data as 2D array */
|
|
187
385
|
readonly data: Ref<unknown[][]>;
|
|
386
|
+
/** Header texts */
|
|
188
387
|
readonly headers: Ref<string[]>;
|
|
388
|
+
/** Number of columns */
|
|
189
389
|
readonly columnCount: Readonly<Ref<number>>;
|
|
390
|
+
/** Create or get existing caption */
|
|
190
391
|
createCaption(): HTMLTableCaptionElement;
|
|
392
|
+
/** Delete caption */
|
|
191
393
|
deleteCaption(): void;
|
|
394
|
+
/** Create or get existing thead */
|
|
192
395
|
createTHead(): HTMLTableSectionElement;
|
|
396
|
+
/** Delete thead */
|
|
193
397
|
deleteTHead(): void;
|
|
398
|
+
/** Create or get existing tfoot */
|
|
194
399
|
createTFoot(): HTMLTableSectionElement;
|
|
400
|
+
/** Delete tfoot */
|
|
195
401
|
deleteTFoot(): void;
|
|
402
|
+
/** Create new tbody */
|
|
196
403
|
createTBody(): HTMLTableSectionElement;
|
|
404
|
+
/** Insert row at index */
|
|
197
405
|
insertRow(index?: number): HTMLTableRowElement;
|
|
406
|
+
/** Delete row at index */
|
|
198
407
|
deleteRow(index: number): void;
|
|
408
|
+
/** Get thead as TableSection */
|
|
199
409
|
getTHead(): TableSection | undefined;
|
|
410
|
+
/** Get tfoot as TableSection */
|
|
200
411
|
getTFoot(): TableSection | undefined;
|
|
412
|
+
/** Get tbody at index as TableSection */
|
|
201
413
|
getTBody(index: number): TableSection | undefined;
|
|
414
|
+
/** Get row at index as TableRow */
|
|
202
415
|
getRow(index: number): TableRow | undefined;
|
|
416
|
+
/** Add a row with data */
|
|
203
417
|
addRow(rowData: readonly unknown[], index?: number): HTMLTableRowElement;
|
|
418
|
+
/** Remove row at index */
|
|
204
419
|
removeRow(index: number): void;
|
|
420
|
+
/** Add a column */
|
|
205
421
|
addColumn(headerText?: string, defaultValue?: unknown, index?: number): void;
|
|
422
|
+
/** Remove column at index */
|
|
206
423
|
removeColumn(index: number): void;
|
|
424
|
+
/** Set cell value */
|
|
207
425
|
setCell(rowIndex: number, columnIndex: number, value: unknown): void;
|
|
426
|
+
/** Get cell value */
|
|
208
427
|
getCell(rowIndex: number, columnIndex: number): unknown;
|
|
428
|
+
/** Set caption text */
|
|
209
429
|
setCaption(text: string): void;
|
|
430
|
+
/** Set all headers */
|
|
210
431
|
setHeaders(headerTexts: readonly string[]): void;
|
|
432
|
+
/** Set footer row */
|
|
211
433
|
setFooter(footerData: readonly unknown[]): void;
|
|
434
|
+
/** Set all data */
|
|
212
435
|
setData(newData: readonly (readonly unknown[])[]): void;
|
|
436
|
+
/** Clear body data (keep headers) */
|
|
213
437
|
clearData(): void;
|
|
438
|
+
/** Reset entire table */
|
|
214
439
|
reset(): void;
|
|
440
|
+
/** Sync reactive state with DOM */
|
|
215
441
|
sync(): void;
|
|
442
|
+
/** Add row with cell configs */
|
|
216
443
|
addRowWithAttributes(rowData: readonly (unknown | CellConfig)[], attributes?: ElementAttributes, index?: number): HTMLTableRowElement;
|
|
444
|
+
/** Add column with config */
|
|
217
445
|
addColumnWithAttributes(config: ColumnConfig, index?: number): void;
|
|
446
|
+
/** Set headers with configs */
|
|
218
447
|
setHeadersWithAttributes(headerConfigs: readonly (string | CellConfig)[]): void;
|
|
448
|
+
/** Set cell with attributes */
|
|
219
449
|
setCellWithAttributes(rowIndex: number, columnIndex: number, value: unknown, attributes?: ElementAttributes): void;
|
|
450
|
+
/** Get row data copy */
|
|
220
451
|
getRowData(index: number): unknown[] | undefined;
|
|
452
|
+
/** Set row data */
|
|
221
453
|
setRowData(index: number, rowData: readonly unknown[]): void;
|
|
454
|
+
/** Get all row data as copy */
|
|
222
455
|
getAllRowData(): unknown[][];
|
|
456
|
+
/** Get column data */
|
|
223
457
|
getColumnData(index: number): unknown[];
|
|
458
|
+
/** Set column data */
|
|
224
459
|
setColumnData(index: number, columnData: readonly unknown[]): void;
|
|
460
|
+
/** Get cell range */
|
|
225
461
|
getCellRange(rowStart: number, rowEnd: number, columnStart: number, columnEnd: number): unknown[][];
|
|
462
|
+
/** Set cell range */
|
|
226
463
|
setCellRange(rowStart: number, columnStart: number, rangeData: readonly (readonly unknown[])[]): void;
|
|
464
|
+
/** Get header data copy */
|
|
227
465
|
getHeaderData(): string[];
|
|
466
|
+
/** Get footer data */
|
|
228
467
|
getFooterData(): unknown[] | undefined;
|
|
468
|
+
/** Set footer cell */
|
|
229
469
|
setFooterCell(columnIndex: number, value: unknown): void;
|
|
470
|
+
/** Get footer cell */
|
|
230
471
|
getFooterCell(columnIndex: number): unknown;
|
|
472
|
+
/** Update cell with config */
|
|
231
473
|
updateCell(rowIndex: number, columnIndex: number, config: CellConfig): void;
|
|
474
|
+
/** Update row data */
|
|
232
475
|
updateRow(index: number, rowData: readonly (unknown | CellConfig)[]): void;
|
|
476
|
+
/** Get cell DOM element */
|
|
233
477
|
getCellElement(rowIndex: number, columnIndex: number): HTMLTableCellElement | undefined;
|
|
478
|
+
/** Get row DOM element */
|
|
234
479
|
getRowElement(index: number): HTMLTableRowElement | undefined;
|
|
480
|
+
/** Select multiple rows */
|
|
235
481
|
selectRows(indices: readonly number[]): unknown[][];
|
|
482
|
+
/** Select multiple columns */
|
|
236
483
|
selectColumns(indices: readonly number[]): unknown[][];
|
|
484
|
+
/** Update multiple rows */
|
|
237
485
|
updateRows(updates: ReadonlyMap<number, readonly (unknown | CellConfig)[]>): void;
|
|
486
|
+
/** Update multiple cells */
|
|
238
487
|
updateCells(updates: ReadonlyMap<readonly [number, number], unknown | CellConfig>): void;
|
|
488
|
+
/** Get all row elements */
|
|
239
489
|
getRowElements(): readonly HTMLTableRowElement[];
|
|
490
|
+
/** Get cells for a row */
|
|
240
491
|
getRowCellElements(rowIndex: number): readonly HTMLTableCellElement[];
|
|
492
|
+
/** Set multiple rows */
|
|
241
493
|
setRows(startIndex: number, rows: readonly (readonly (unknown | CellConfig)[])[]): void;
|
|
494
|
+
/** Validate single cell */
|
|
242
495
|
validateCell(rowIndex: number, columnIndex: number, validator: CellValidator): true | ValidationError;
|
|
496
|
+
/** Validate single row */
|
|
243
497
|
validateRow(index: number, validator: RowValidator): true | ValidationError[];
|
|
498
|
+
/** Validate single column */
|
|
244
499
|
validateColumn(index: number, validator: CellValidator): true | ValidationError[];
|
|
500
|
+
/** Validate all cells */
|
|
245
501
|
validateAll(validator: FullValidator): ValidationResult;
|
|
502
|
+
/** Sum of column values */
|
|
246
503
|
sum(columnIndex: number): number;
|
|
504
|
+
/** Average of column values */
|
|
247
505
|
average(columnIndex: number): number;
|
|
506
|
+
/** Minimum value in column */
|
|
248
507
|
min(columnIndex: number): unknown;
|
|
508
|
+
/** Maximum value in column */
|
|
249
509
|
max(columnIndex: number): unknown;
|
|
510
|
+
/** Count values in column */
|
|
250
511
|
count(columnIndex: number, predicate?: (value: unknown) => boolean): number;
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
}): T;
|
|
512
|
+
/** Custom aggregation */
|
|
513
|
+
aggregate<T>(columnIndex: number, options: AggregateConfig<T>): T;
|
|
514
|
+
/** Transform all cells in column */
|
|
255
515
|
transformColumn(columnIndex: number, transformer: (value: unknown, rowIndex: number) => unknown): void;
|
|
516
|
+
/** Transform all cells in row */
|
|
256
517
|
transformRow(rowIndex: number, transformer: (value: unknown, colIndex: number) => unknown): void;
|
|
518
|
+
/** Transform all cells */
|
|
257
519
|
transformCells(transformer: (value: unknown, rowIndex: number, colIndex: number) => unknown): void;
|
|
520
|
+
/** Export to CSV string */
|
|
258
521
|
exportToCSV(): string;
|
|
522
|
+
/** Export to JSON string */
|
|
259
523
|
exportToJSON(): string;
|
|
524
|
+
/** Import from 2D array */
|
|
260
525
|
importFromArray(data: readonly (readonly unknown[])[]): void;
|
|
526
|
+
/** Import from CSV string */
|
|
261
527
|
importFromCSV(csv: string): void;
|
|
528
|
+
/** Import from JSON string */
|
|
262
529
|
importFromJSON(json: string): void;
|
|
530
|
+
/** Search all cells */
|
|
263
531
|
search(query: string, options?: SearchOptions): SearchResult[];
|
|
532
|
+
/** Search single column */
|
|
264
533
|
searchColumn(columnIndex: number, query: string, options?: SearchOptions): SearchResult[];
|
|
534
|
+
/** Selected row indices */
|
|
265
535
|
readonly selectedRows: Readonly<Ref<Set<number>>>;
|
|
536
|
+
/** Selected cell keys (row,column format) */
|
|
266
537
|
readonly selectedCells: Readonly<Ref<Set<string>>>;
|
|
538
|
+
/** Select a row */
|
|
267
539
|
selectRow(index: number): void;
|
|
540
|
+
/** Deselect a row */
|
|
268
541
|
deselectRow(index: number): void;
|
|
542
|
+
/** Toggle row selection */
|
|
269
543
|
toggleRowSelection(index: number): void;
|
|
544
|
+
/** Check if row is selected */
|
|
270
545
|
isRowSelected(index: number): boolean;
|
|
546
|
+
/** Select a cell */
|
|
271
547
|
selectCell(rowIndex: number, columnIndex: number): void;
|
|
548
|
+
/** Clear all selection */
|
|
272
549
|
clearSelection(): void;
|
|
550
|
+
/** Enable cell editing */
|
|
273
551
|
enableCellEditing(config?: EditableConfig): void;
|
|
552
|
+
/** Disable cell editing */
|
|
274
553
|
disableCellEditing(): void;
|
|
554
|
+
/** Enable header editing */
|
|
275
555
|
enableHeaderEditing(config?: Omit<EditableConfig, 'cells'>): void;
|
|
556
|
+
/** Disable header editing */
|
|
276
557
|
disableHeaderEditing(): void;
|
|
558
|
+
/** Enable editing for specific column */
|
|
277
559
|
enableColumnEditing(columnIndex: number, config?: EditableConfig): void;
|
|
560
|
+
/** Disable editing for specific column */
|
|
278
561
|
disableColumnEditing(columnIndex: number): void;
|
|
562
|
+
/** Enable editing for specific row */
|
|
279
563
|
enableRowEditing(rowIndex: number, config?: EditableConfig): void;
|
|
564
|
+
/** Disable editing for specific row */
|
|
280
565
|
disableRowEditing(rowIndex: number): void;
|
|
566
|
+
/** Enable double-click to edit (returns cleanup) */
|
|
281
567
|
enableEditing(): () => void;
|
|
568
|
+
/** Group rows by key function */
|
|
282
569
|
groupBy(keyFunction: (row: unknown[]) => string | number): Map<string | number, number[]>;
|
|
570
|
+
/** Add computed column */
|
|
283
571
|
addComputedColumn(config: ComputedColumnConfig): number;
|
|
572
|
+
/** Remove computed column */
|
|
284
573
|
removeComputedColumn(index: number): void;
|
|
285
|
-
pagination
|
|
574
|
+
/** Current pagination state */
|
|
575
|
+
readonly pagination: PaginationState | null;
|
|
576
|
+
/** Enable pagination */
|
|
286
577
|
paginate(config: PaginationConfig): void;
|
|
578
|
+
/** Go to next page */
|
|
287
579
|
nextPage(): void;
|
|
580
|
+
/** Go to previous page */
|
|
288
581
|
previousPage(): void;
|
|
582
|
+
/** Go to specific page */
|
|
289
583
|
goToPage(page: number): void;
|
|
290
|
-
|
|
584
|
+
/** Current virtual scroll state */
|
|
585
|
+
readonly virtualScroll: VirtualScrollState | null;
|
|
586
|
+
/** Enable virtual scrolling */
|
|
291
587
|
enableVirtualScrolling(config: VirtualScrollConfig): void;
|
|
588
|
+
/** Disable virtual scrolling */
|
|
292
589
|
disableVirtualScrolling(): void;
|
|
590
|
+
/** Execute operations with rollback on error */
|
|
293
591
|
transaction<T>(callback: () => T | Promise<T>): T | Promise<T>;
|
|
592
|
+
/** Subscribe to data changes (returns unsubscribe) */
|
|
294
593
|
onDataChange(callback: (data: unknown[][]) => void): () => void;
|
|
594
|
+
/** Current sort state */
|
|
295
595
|
readonly sortState: SortState;
|
|
596
|
+
/** Sort column ascending */
|
|
296
597
|
sortColumnAscending(columnIndex: number): void;
|
|
598
|
+
/** Sort column descending */
|
|
297
599
|
sortColumnDescending(columnIndex: number): void;
|
|
600
|
+
/** Sort column ascending with custom comparator */
|
|
298
601
|
sortColumnAscendingWith(columnIndex: number, comparator: (a: unknown, b: unknown) => number): void;
|
|
602
|
+
/** Sort column descending with custom comparator */
|
|
299
603
|
sortColumnDescendingWith(columnIndex: number, comparator: (a: unknown, b: unknown) => number): void;
|
|
604
|
+
/** Clear sorting */
|
|
300
605
|
clearColumnSort(): void;
|
|
606
|
+
/** Get sorted column index */
|
|
301
607
|
getSortedColumnIndex(): number | null;
|
|
608
|
+
/** Check if sorted ascending */
|
|
302
609
|
isSortedAscending(): boolean;
|
|
610
|
+
/** Check if sorted descending */
|
|
303
611
|
isSortedDescending(): boolean;
|
|
612
|
+
/** Check if any sort is active */
|
|
304
613
|
isSorted(): boolean;
|
|
614
|
+
/** Current filter state */
|
|
305
615
|
readonly filterState: FilterState;
|
|
616
|
+
/** Filter rows by predicate */
|
|
306
617
|
filterRows(predicate: (rowData: unknown[], rowIndex: number) => boolean): void;
|
|
618
|
+
/** Filter by column predicate */
|
|
307
619
|
filterColumn(columnIndex: number, predicate: (value: unknown) => boolean): void;
|
|
620
|
+
/** Filter by exact value */
|
|
308
621
|
filterColumnByValue(columnIndex: number, value: unknown): void;
|
|
622
|
+
/** Filter by multiple values */
|
|
309
623
|
filterColumnByValues(columnIndex: number, values: readonly unknown[]): void;
|
|
624
|
+
/** Clear all filters */
|
|
310
625
|
clearFilters(): void;
|
|
626
|
+
/** Get visible row indices */
|
|
311
627
|
getFilteredRowIndices(): readonly number[];
|
|
628
|
+
/** Set function to generate row keys */
|
|
312
629
|
setRowKeyFunction(keyFunction: (rowData: unknown[], rowIndex: number) => string | number): void;
|
|
630
|
+
/** Clear row key function */
|
|
313
631
|
clearRowKeyFunction(): void;
|
|
632
|
+
/** Check if row key function is set */
|
|
314
633
|
hasRowKeyFunction(): boolean;
|
|
634
|
+
/** Get row data by key */
|
|
315
635
|
getRowByKey(key: string | number): unknown[] | undefined;
|
|
636
|
+
/** Get row index by key */
|
|
316
637
|
getRowIndexByKey(key: string | number): number | undefined;
|
|
638
|
+
/** Update row by key */
|
|
317
639
|
updateRowByKey(key: string | number, rowData: readonly unknown[]): boolean;
|
|
640
|
+
/** Remove row by key */
|
|
318
641
|
removeRowByKey(key: string | number): boolean;
|
|
642
|
+
/** Check if row with key exists */
|
|
319
643
|
hasRowWithKey(key: string | number): boolean;
|
|
644
|
+
/** Get key for row */
|
|
320
645
|
getRowKey(rowIndex: number): string | number | undefined;
|
|
646
|
+
/** Get all row keys */
|
|
321
647
|
getAllRowKeys(): readonly (string | number)[];
|
|
648
|
+
/** Set column definition */
|
|
322
649
|
setColumnDefinition(columnIndex: number, definition: ColumnDefinition): void;
|
|
650
|
+
/** Set all column definitions */
|
|
323
651
|
setColumnDefinitions(definitions: readonly (ColumnDefinition | undefined)[]): void;
|
|
652
|
+
/** Clear column definition */
|
|
324
653
|
clearColumnDefinition(columnIndex: number): void;
|
|
654
|
+
/** Clear all column definitions */
|
|
325
655
|
clearColumnDefinitions(): void;
|
|
656
|
+
/** Get column definition */
|
|
326
657
|
getColumnDefinition(columnIndex: number): ColumnDefinition | undefined;
|
|
658
|
+
/** Check if column has definition */
|
|
327
659
|
hasColumnDefinition(columnIndex: number): boolean;
|
|
660
|
+
/** Get parsed cell value */
|
|
328
661
|
getParsedCell(rowIndex: number, columnIndex: number): unknown;
|
|
662
|
+
/** Get parsed row data */
|
|
329
663
|
getParsedRowData(rowIndex: number): unknown[];
|
|
664
|
+
/** Get parsed column data */
|
|
330
665
|
getParsedColumnData(columnIndex: number): unknown[];
|
|
666
|
+
/** Get all parsed data */
|
|
331
667
|
getParsedData(): unknown[][];
|
|
668
|
+
/** Whether table has unsaved changes */
|
|
332
669
|
readonly dirtyState: Readonly<Ref<boolean>>;
|
|
670
|
+
/** Mark as clean (save point) */
|
|
333
671
|
markClean(): void;
|
|
672
|
+
/** Mark as dirty */
|
|
334
673
|
markDirty(): void;
|
|
674
|
+
/** Check if dirty */
|
|
335
675
|
isDirty(): boolean;
|
|
676
|
+
/** Check if has changes */
|
|
336
677
|
hasChanges(): boolean;
|
|
678
|
+
/** Get all cell changes */
|
|
337
679
|
getChangedCells(): readonly CellChange[];
|
|
680
|
+
/** Get changed row indices */
|
|
338
681
|
getChangedRowIndices(): readonly number[];
|
|
682
|
+
/** Get changed column indices */
|
|
339
683
|
getChangedColumnIndices(): readonly number[];
|
|
684
|
+
/** Undo last change */
|
|
340
685
|
undo(): boolean;
|
|
686
|
+
/** Redo last undone change */
|
|
341
687
|
redo(): boolean;
|
|
688
|
+
/** Clear history */
|
|
342
689
|
clearHistory(): void;
|
|
690
|
+
/** Check if can undo */
|
|
343
691
|
canUndo(): boolean;
|
|
692
|
+
/** Check if can redo */
|
|
344
693
|
canRedo(): boolean;
|
|
694
|
+
/** Get undo stack size */
|
|
345
695
|
getUndoStackSize(): number;
|
|
696
|
+
/** Get redo stack size */
|
|
346
697
|
getRedoStackSize(): number;
|
|
698
|
+
/** Set history limit */
|
|
347
699
|
setHistoryLimit(limit: number): void;
|
|
700
|
+
/** Get history limit */
|
|
348
701
|
getHistoryLimit(): number;
|
|
702
|
+
/** Select all rows */
|
|
349
703
|
selectAllRows(): void;
|
|
704
|
+
/** Deselect all rows */
|
|
350
705
|
deselectAllRows(): void;
|
|
706
|
+
/** Select range of rows */
|
|
351
707
|
selectRowRange(startIndex: number, endIndex: number): void;
|
|
708
|
+
/** Invert row selection */
|
|
352
709
|
invertRowSelection(): void;
|
|
710
|
+
/** Get data for selected rows */
|
|
353
711
|
getSelectedRowData(): readonly unknown[][];
|
|
712
|
+
/** Get selected row indices */
|
|
354
713
|
getSelectedRowIndices(): readonly number[];
|
|
714
|
+
/** Get selected cell positions */
|
|
355
715
|
getSelectedCellIndices(): readonly CellPosition[];
|
|
716
|
+
/** Currently focused cell */
|
|
356
717
|
readonly focusedCell: Readonly<Ref<CellPosition | null>>;
|
|
718
|
+
/** Focus a cell */
|
|
357
719
|
focusCell(rowIndex: number, columnIndex: number): void;
|
|
720
|
+
/** Clear cell focus */
|
|
358
721
|
clearCellFocus(): void;
|
|
722
|
+
/** Get focused cell position */
|
|
359
723
|
getFocusedCell(): CellPosition | null;
|
|
724
|
+
/** Check if cell is focused */
|
|
360
725
|
isCellFocused(rowIndex: number, columnIndex: number): boolean;
|
|
726
|
+
/** Move focus up */
|
|
361
727
|
moveFocusUp(): boolean;
|
|
728
|
+
/** Move focus down */
|
|
362
729
|
moveFocusDown(): boolean;
|
|
730
|
+
/** Move focus left */
|
|
363
731
|
moveFocusLeft(): boolean;
|
|
732
|
+
/** Move focus right */
|
|
364
733
|
moveFocusRight(): boolean;
|
|
734
|
+
/** Move focus to first cell */
|
|
365
735
|
moveFocusToFirstCell(): void;
|
|
736
|
+
/** Move focus to last cell */
|
|
366
737
|
moveFocusToLastCell(): void;
|
|
738
|
+
/** Move focus to row start */
|
|
367
739
|
moveFocusToRowStart(): void;
|
|
740
|
+
/** Move focus to row end */
|
|
368
741
|
moveFocusToRowEnd(): void;
|
|
742
|
+
/** Enable keyboard navigation (returns cleanup) */
|
|
369
743
|
enableKeyboardNavigation(): () => void;
|
|
744
|
+
/** Count of visible columns */
|
|
370
745
|
readonly visibleColumnCount: Readonly<Ref<number>>;
|
|
746
|
+
/** Hide a column */
|
|
371
747
|
hideColumn(columnIndex: number): void;
|
|
748
|
+
/** Show a column */
|
|
372
749
|
showColumn(columnIndex: number): void;
|
|
750
|
+
/** Toggle column visibility */
|
|
373
751
|
toggleColumnVisibility(columnIndex: number): void;
|
|
752
|
+
/** Check if column is visible */
|
|
374
753
|
isColumnVisible(columnIndex: number): boolean;
|
|
754
|
+
/** Get visible column indices */
|
|
375
755
|
getVisibleColumnIndices(): readonly number[];
|
|
756
|
+
/** Get hidden column indices */
|
|
376
757
|
getHiddenColumnIndices(): readonly number[];
|
|
758
|
+
/** Move row from one position to another */
|
|
377
759
|
moveRow(fromIndex: number, toIndex: number): void;
|
|
760
|
+
/** Move row up */
|
|
378
761
|
moveRowUp(rowIndex: number): boolean;
|
|
762
|
+
/** Move row down */
|
|
379
763
|
moveRowDown(rowIndex: number): boolean;
|
|
764
|
+
/** Move row to top */
|
|
380
765
|
moveRowToTop(rowIndex: number): void;
|
|
766
|
+
/** Move row to bottom */
|
|
381
767
|
moveRowToBottom(rowIndex: number): void;
|
|
768
|
+
/** Swap two rows */
|
|
382
769
|
swapRows(indexA: number, indexB: number): void;
|
|
770
|
+
/** Move column from one position to another */
|
|
383
771
|
moveColumn(fromIndex: number, toIndex: number): void;
|
|
772
|
+
/** Move column left */
|
|
384
773
|
moveColumnLeft(columnIndex: number): boolean;
|
|
774
|
+
/** Move column right */
|
|
385
775
|
moveColumnRight(columnIndex: number): boolean;
|
|
776
|
+
/** Move column to start */
|
|
386
777
|
moveColumnToStart(columnIndex: number): void;
|
|
778
|
+
/** Move column to end */
|
|
387
779
|
moveColumnToEnd(columnIndex: number): void;
|
|
780
|
+
/** Swap two columns */
|
|
388
781
|
swapColumns(indexA: number, indexB: number): void;
|
|
782
|
+
/** Copy selected cells to string */
|
|
389
783
|
copySelectedCells(): string;
|
|
784
|
+
/** Copy selected rows to string */
|
|
390
785
|
copySelectedRows(): string;
|
|
786
|
+
/** Copy row to string */
|
|
391
787
|
copyRow(rowIndex: number): string;
|
|
788
|
+
/** Copy column to string */
|
|
392
789
|
copyColumn(columnIndex: number): string;
|
|
790
|
+
/** Copy cell to string */
|
|
393
791
|
copyCell(rowIndex: number, columnIndex: number): string;
|
|
792
|
+
/** Copy cell range to string */
|
|
394
793
|
copyCellRange(rowStart: number, columnStart: number, rowEnd: number, columnEnd: number): string;
|
|
794
|
+
/** Paste data at cell */
|
|
395
795
|
pasteAtCell(rowIndex: number, columnIndex: number, data: string): void;
|
|
796
|
+
/** Expanded row indices */
|
|
396
797
|
readonly expandedRows: Readonly<Ref<ReadonlySet<number>>>;
|
|
798
|
+
/** Rows pinned to top */
|
|
397
799
|
readonly pinnedTopRows: Readonly<Ref<readonly number[]>>;
|
|
800
|
+
/** Rows pinned to bottom */
|
|
398
801
|
readonly pinnedBottomRows: Readonly<Ref<readonly number[]>>;
|
|
802
|
+
/** Expand a row */
|
|
399
803
|
expandRow(rowIndex: number): void;
|
|
804
|
+
/** Collapse a row */
|
|
400
805
|
collapseRow(rowIndex: number): void;
|
|
806
|
+
/** Toggle row expansion */
|
|
401
807
|
toggleRowExpansion(rowIndex: number): void;
|
|
808
|
+
/** Expand all rows */
|
|
402
809
|
expandAllRows(): void;
|
|
810
|
+
/** Collapse all rows */
|
|
403
811
|
collapseAllRows(): void;
|
|
812
|
+
/** Check if row is expanded */
|
|
404
813
|
isRowExpanded(rowIndex: number): boolean;
|
|
814
|
+
/** Get expanded row indices */
|
|
405
815
|
getExpandedRowIndices(): readonly number[];
|
|
816
|
+
/** Pin row to top */
|
|
406
817
|
pinRowTop(rowIndex: number): void;
|
|
818
|
+
/** Pin row to bottom */
|
|
407
819
|
pinRowBottom(rowIndex: number): void;
|
|
820
|
+
/** Unpin a row */
|
|
408
821
|
unpinRow(rowIndex: number): void;
|
|
822
|
+
/** Unpin all rows */
|
|
409
823
|
unpinAllRows(): void;
|
|
824
|
+
/** Check if row is pinned to top */
|
|
410
825
|
isRowPinnedTop(rowIndex: number): boolean;
|
|
826
|
+
/** Check if row is pinned to bottom */
|
|
411
827
|
isRowPinnedBottom(rowIndex: number): boolean;
|
|
828
|
+
/** Get indices of rows pinned to top */
|
|
412
829
|
getPinnedTopRowIndices(): readonly number[];
|
|
830
|
+
/** Get indices of rows pinned to bottom */
|
|
413
831
|
getPinnedBottomRowIndices(): readonly number[];
|
|
832
|
+
/** Set cell metadata */
|
|
414
833
|
setCellMeta<T>(rowIndex: number, columnIndex: number, key: string, value: T): void;
|
|
834
|
+
/** Get cell metadata */
|
|
415
835
|
getCellMeta<T>(rowIndex: number, columnIndex: number, key: string): T | undefined;
|
|
836
|
+
/** Check if cell has metadata */
|
|
416
837
|
hasCellMeta(rowIndex: number, columnIndex: number, key: string): boolean;
|
|
838
|
+
/** Clear all cell metadata */
|
|
417
839
|
clearCellMeta(rowIndex: number, columnIndex: number): void;
|
|
840
|
+
/** Clear specific cell metadata key */
|
|
418
841
|
clearCellMetaKey(rowIndex: number, columnIndex: number, key: string): void;
|
|
842
|
+
/** Set row metadata */
|
|
419
843
|
setRowMeta<T>(rowIndex: number, key: string, value: T): void;
|
|
844
|
+
/** Get row metadata */
|
|
420
845
|
getRowMeta<T>(rowIndex: number, key: string): T | undefined;
|
|
846
|
+
/** Check if row has metadata */
|
|
421
847
|
hasRowMeta(rowIndex: number, key: string): boolean;
|
|
848
|
+
/** Clear all row metadata */
|
|
422
849
|
clearRowMeta(rowIndex: number): void;
|
|
850
|
+
/** Clear specific row metadata key */
|
|
423
851
|
clearRowMetaKey(rowIndex: number, key: string): void;
|
|
852
|
+
/** Set column metadata */
|
|
424
853
|
setColumnMeta<T>(columnIndex: number, key: string, value: T): void;
|
|
854
|
+
/** Get column metadata */
|
|
425
855
|
getColumnMeta<T>(columnIndex: number, key: string): T | undefined;
|
|
856
|
+
/** Check if column has metadata */
|
|
426
857
|
hasColumnMeta(columnIndex: number, key: string): boolean;
|
|
858
|
+
/** Clear all column metadata */
|
|
427
859
|
clearColumnMeta(columnIndex: number): void;
|
|
860
|
+
/** Clear specific column metadata key */
|
|
428
861
|
clearColumnMetaKey(columnIndex: number, key: string): void;
|
|
862
|
+
/** Subscribe to row add events */
|
|
429
863
|
onRowAdd(callback: (rowData: unknown[], rowIndex: number) => void): () => void;
|
|
864
|
+
/** Subscribe to row remove events */
|
|
430
865
|
onRowRemove(callback: (rowData: unknown[], rowIndex: number) => void): () => void;
|
|
866
|
+
/** Subscribe to row update events */
|
|
431
867
|
onRowUpdate(callback: (rowIndex: number, oldRowData: unknown[], newRowData: unknown[]) => void): () => void;
|
|
868
|
+
/** Subscribe to cell change events */
|
|
432
869
|
onCellChange(callback: (rowIndex: number, columnIndex: number, oldValue: unknown, newValue: unknown) => void): () => void;
|
|
870
|
+
/** Subscribe to row selection change events */
|
|
433
871
|
onRowSelectionChange(callback: (selectedIndices: ReadonlySet<number>) => void): () => void;
|
|
872
|
+
/** Subscribe to cell selection change events */
|
|
434
873
|
onCellSelectionChange(callback: (selectedCells: ReadonlySet<string>) => void): () => void;
|
|
874
|
+
/** Subscribe to sort change events */
|
|
435
875
|
onSortChange(callback: (columnIndex: number | null, ascending: boolean) => void): () => void;
|
|
876
|
+
/** Subscribe to filter change events */
|
|
436
877
|
onFilterChange(callback: (filteredIndices: readonly number[]) => void): () => void;
|
|
878
|
+
/** Subscribe to cell focus change events */
|
|
437
879
|
onCellFocusChange(callback: (cell: CellPosition | null) => void): () => void;
|
|
880
|
+
/** Subscribe to column visibility change events */
|
|
438
881
|
onColumnVisibilityChange(callback: (columnIndex: number, visible: boolean) => void): () => void;
|
|
882
|
+
/** Begin batch update (defer reactivity) */
|
|
439
883
|
beginBatchUpdate(): void;
|
|
884
|
+
/** End batch update (commit changes) */
|
|
440
885
|
endBatchUpdate(): void;
|
|
886
|
+
/** Cancel batch update (rollback) */
|
|
441
887
|
cancelBatchUpdate(): void;
|
|
888
|
+
/** Check if batch updating */
|
|
442
889
|
isBatchUpdating(): boolean;
|
|
890
|
+
/** Execute callback as batch */
|
|
443
891
|
batchUpdate(callback: () => void): void;
|
|
892
|
+
/** Whether table is loading */
|
|
444
893
|
readonly tableLoading: Readonly<Ref<boolean>>;
|
|
894
|
+
/** Set table loading state */
|
|
445
895
|
setTableLoading(loading: boolean): void;
|
|
896
|
+
/** Set cell loading state */
|
|
446
897
|
setCellLoading(rowIndex: number, columnIndex: number, loading: boolean): void;
|
|
898
|
+
/** Set row loading state */
|
|
447
899
|
setRowLoading(rowIndex: number, loading: boolean): void;
|
|
900
|
+
/** Set column loading state */
|
|
448
901
|
setColumnLoading(columnIndex: number, loading: boolean): void;
|
|
902
|
+
/** Check if table is loading */
|
|
449
903
|
isTableLoading(): boolean;
|
|
904
|
+
/** Check if cell is loading */
|
|
450
905
|
isCellLoading(rowIndex: number, columnIndex: number): boolean;
|
|
906
|
+
/** Check if row is loading */
|
|
451
907
|
isRowLoading(rowIndex: number): boolean;
|
|
908
|
+
/** Check if column is loading */
|
|
452
909
|
isColumnLoading(columnIndex: number): boolean;
|
|
910
|
+
/** Load data with fetcher */
|
|
453
911
|
loadData(fetcher: () => Promise<readonly (readonly unknown[])[]>): Promise<void>;
|
|
912
|
+
/** Append rows asynchronously */
|
|
454
913
|
appendRowsAsync(fetcher: () => Promise<readonly (readonly unknown[])[]>): Promise<void>;
|
|
914
|
+
/** Prepend rows asynchronously */
|
|
455
915
|
prependRowsAsync(fetcher: () => Promise<readonly (readonly unknown[])[]>): Promise<void>;
|
|
916
|
+
/** Number of columns frozen on left */
|
|
456
917
|
readonly frozenLeftColumnCount: Readonly<Ref<number>>;
|
|
918
|
+
/** Number of columns frozen on right */
|
|
457
919
|
readonly frozenRightColumnCount: Readonly<Ref<number>>;
|
|
920
|
+
/** Freeze columns on left */
|
|
458
921
|
freezeColumnsLeft(count: number): void;
|
|
922
|
+
/** Freeze columns on right */
|
|
459
923
|
freezeColumnsRight(count: number): void;
|
|
924
|
+
/** Unfreeze columns on left */
|
|
460
925
|
unfreezeColumnsLeft(): void;
|
|
926
|
+
/** Unfreeze columns on right */
|
|
461
927
|
unfreezeColumnsRight(): void;
|
|
928
|
+
/** Unfreeze all columns */
|
|
462
929
|
unfreezeAllColumns(): void;
|
|
930
|
+
/** Get frozen left column count */
|
|
463
931
|
getFrozenLeftColumnCount(): number;
|
|
932
|
+
/** Get frozen right column count */
|
|
464
933
|
getFrozenRightColumnCount(): number;
|
|
934
|
+
/** Check if column is frozen on left */
|
|
465
935
|
isColumnFrozenLeft(columnIndex: number): boolean;
|
|
936
|
+
/** Check if column is frozen on right */
|
|
466
937
|
isColumnFrozenRight(columnIndex: number): boolean;
|
|
938
|
+
/** Check if any columns are frozen */
|
|
467
939
|
hasFrozenColumns(): boolean;
|
|
940
|
+
/**
|
|
941
|
+
* Configure table for record-based data.
|
|
942
|
+
* This enables integration with useDatabase and other composables.
|
|
943
|
+
*/
|
|
944
|
+
setRecordColumns<T extends BaseRecord>(columns: readonly RecordColumnDef<T>[]): void;
|
|
945
|
+
/**
|
|
946
|
+
* Clear record column configuration.
|
|
947
|
+
*/
|
|
948
|
+
clearRecordColumns(): void;
|
|
949
|
+
/**
|
|
950
|
+
* Check if record columns are configured.
|
|
951
|
+
*/
|
|
952
|
+
hasRecordColumns(): boolean;
|
|
953
|
+
/**
|
|
954
|
+
* Get the configured record columns.
|
|
955
|
+
*/
|
|
956
|
+
getRecordColumns<T extends BaseRecord>(): readonly RecordColumnDef<T>[] | undefined;
|
|
957
|
+
/**
|
|
958
|
+
* Set table data from an array of records.
|
|
959
|
+
* Records must have an `id` field.
|
|
960
|
+
*/
|
|
961
|
+
setRecords<T extends BaseRecord>(records: readonly T[]): void;
|
|
962
|
+
/**
|
|
963
|
+
* Get all records from the table.
|
|
964
|
+
* Returns records reconstructed from table data using column definitions.
|
|
965
|
+
*/
|
|
966
|
+
getRecords<T extends BaseRecord>(): readonly T[];
|
|
967
|
+
/**
|
|
968
|
+
* Get a single record by ID.
|
|
969
|
+
*/
|
|
970
|
+
getRecordById<T extends BaseRecord>(id: string): T | undefined;
|
|
971
|
+
/**
|
|
972
|
+
* Get record ID for a row index.
|
|
973
|
+
*/
|
|
974
|
+
getRecordId(rowIndex: number): string | undefined;
|
|
975
|
+
/**
|
|
976
|
+
* Get row index for a record ID.
|
|
977
|
+
*/
|
|
978
|
+
getRowIndexForRecord(recordId: string): number | undefined;
|
|
979
|
+
/**
|
|
980
|
+
* Update a record by ID.
|
|
981
|
+
* Only updates the specified fields.
|
|
982
|
+
*/
|
|
983
|
+
updateRecord<T extends BaseRecord>(id: string, updates: Partial<Omit<T, 'id'>>): boolean;
|
|
984
|
+
/**
|
|
985
|
+
* Add a new record to the table.
|
|
986
|
+
* If no ID is provided, one will be generated.
|
|
987
|
+
*/
|
|
988
|
+
addRecord<T extends BaseRecord>(record: T | Omit<T, 'id'>, index?: number): string;
|
|
989
|
+
/**
|
|
990
|
+
* Remove a record by ID.
|
|
991
|
+
*/
|
|
992
|
+
removeRecord(id: string): boolean;
|
|
993
|
+
/**
|
|
994
|
+
* Check if a record with the given ID exists.
|
|
995
|
+
*/
|
|
996
|
+
hasRecord(id: string): boolean;
|
|
997
|
+
/**
|
|
998
|
+
* Get record IDs for selected rows.
|
|
999
|
+
*/
|
|
1000
|
+
getSelectedRecordIds(): readonly string[];
|
|
1001
|
+
/**
|
|
1002
|
+
* Select rows by record IDs.
|
|
1003
|
+
*/
|
|
1004
|
+
selectRecords(ids: readonly string[]): void;
|
|
1005
|
+
/**
|
|
1006
|
+
* Deselect rows by record IDs.
|
|
1007
|
+
*/
|
|
1008
|
+
deselectRecords(ids: readonly string[]): void;
|
|
1009
|
+
/**
|
|
1010
|
+
* Get the selected records.
|
|
1011
|
+
*/
|
|
1012
|
+
getSelectedRecords<T extends BaseRecord>(): readonly T[];
|
|
1013
|
+
/**
|
|
1014
|
+
* Subscribe to record changes.
|
|
1015
|
+
* Callback receives the record ID and the updated record.
|
|
1016
|
+
*/
|
|
1017
|
+
onRecordChange<T extends BaseRecord>(callback: (recordId: string, record: T, changeType: 'add' | 'update' | 'remove') => void): () => void;
|
|
1018
|
+
/**
|
|
1019
|
+
* Set the ID generator for new records.
|
|
1020
|
+
*/
|
|
1021
|
+
setIdGenerator(generator: IdGenerator): void;
|
|
1022
|
+
/**
|
|
1023
|
+
* Convert array row data to a record object using column definitions.
|
|
1024
|
+
*/
|
|
1025
|
+
rowToRecord<T extends BaseRecord>(rowIndex: number): T | undefined;
|
|
1026
|
+
/**
|
|
1027
|
+
* Convert a record to array row data using column definitions.
|
|
1028
|
+
*/
|
|
1029
|
+
recordToRow<T extends BaseRecord>(record: T): unknown[];
|
|
1030
|
+
/**
|
|
1031
|
+
* Export records to JSON (uses column definitions).
|
|
1032
|
+
*/
|
|
1033
|
+
exportRecordsToJSON(): string;
|
|
1034
|
+
/**
|
|
1035
|
+
* Import records from JSON.
|
|
1036
|
+
*/
|
|
1037
|
+
importRecordsFromJSON(json: string): void;
|
|
468
1038
|
}
|
|
469
1039
|
|
|
470
|
-
/**
|
|
1040
|
+
/**
|
|
1041
|
+
* Validation error for a specific cell.
|
|
1042
|
+
*/
|
|
471
1043
|
export declare interface ValidationError {
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
1044
|
+
/** Row index */
|
|
1045
|
+
readonly row: number;
|
|
1046
|
+
/** Column index */
|
|
1047
|
+
readonly column: number;
|
|
1048
|
+
/** The invalid value */
|
|
1049
|
+
readonly value: unknown;
|
|
1050
|
+
/** Error message */
|
|
1051
|
+
readonly message: string;
|
|
476
1052
|
}
|
|
477
1053
|
|
|
478
|
-
/**
|
|
1054
|
+
/**
|
|
1055
|
+
* Result of validation operations.
|
|
1056
|
+
*/
|
|
479
1057
|
export declare interface ValidationResult {
|
|
480
|
-
|
|
481
|
-
|
|
1058
|
+
/** Whether validation passed */
|
|
1059
|
+
readonly valid: boolean;
|
|
1060
|
+
/** Array of validation errors */
|
|
1061
|
+
readonly errors: readonly ValidationError[];
|
|
482
1062
|
}
|
|
483
1063
|
|
|
484
|
-
/**
|
|
1064
|
+
/**
|
|
1065
|
+
* Virtual scrolling configuration.
|
|
1066
|
+
*/
|
|
485
1067
|
export declare interface VirtualScrollConfig {
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
1068
|
+
/** Height of each row in pixels */
|
|
1069
|
+
readonly rowHeight: number;
|
|
1070
|
+
/** Number of extra rows to render above/below viewport */
|
|
1071
|
+
readonly overscan: number;
|
|
1072
|
+
/** Height of the scroll container in pixels */
|
|
1073
|
+
readonly containerHeight: number;
|
|
489
1074
|
}
|
|
490
1075
|
|
|
491
|
-
/**
|
|
1076
|
+
/**
|
|
1077
|
+
* Virtual scrolling state.
|
|
1078
|
+
*/
|
|
492
1079
|
export declare interface VirtualScrollState {
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
1080
|
+
/** Current scroll position */
|
|
1081
|
+
readonly scrollTop: Ref<number>;
|
|
1082
|
+
/** Height of each row */
|
|
1083
|
+
readonly rowHeight: number;
|
|
1084
|
+
/** Overscan count */
|
|
1085
|
+
readonly overscan: number;
|
|
1086
|
+
/** Container height */
|
|
1087
|
+
readonly containerHeight: number;
|
|
1088
|
+
/** Indices of currently visible rows */
|
|
1089
|
+
readonly visibleRows: Ref<number[]>;
|
|
1090
|
+
/** Start index of visible range */
|
|
1091
|
+
readonly startIndex: Ref<number>;
|
|
1092
|
+
/** End index of visible range */
|
|
1093
|
+
readonly endIndex: Ref<number>;
|
|
1094
|
+
/** Scroll event handler (internal) */
|
|
500
1095
|
scrollHandler?: () => void;
|
|
1096
|
+
/** Container element (internal) */
|
|
501
1097
|
container?: HTMLElement;
|
|
502
1098
|
}
|
|
503
1099
|
|
|
1100
|
+
/**
|
|
1101
|
+
* Check if a record's ID was auto-generated.
|
|
1102
|
+
*/
|
|
1103
|
+
export declare function wasIdGenerated(record: object): boolean;
|
|
1104
|
+
|
|
504
1105
|
export { }
|