@timlassiter11/yatl 0.3.21 → 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.
@@ -0,0 +1,632 @@
1
+ import * as lit from 'lit';
2
+ import { LitElement, TemplateResult, nothing, PropertyValues } from 'lit';
3
+
4
+ type NestedKeyOf<ObjectType> = ObjectType extends object ? {
5
+ [Key in keyof ObjectType & (string | number)]: NonNullable<ObjectType[Key]> extends unknown[] ? `${Key}` : NonNullable<ObjectType[Key]> extends object ? // Recurse with the non-nullable type
6
+ `${Key}` | `${Key}.${NestedKeyOf<NonNullable<ObjectType[Key]>>}` : `${Key}`;
7
+ }[keyof ObjectType & (string | number)] : never;
8
+ declare const createRegexTokenizer: (exp?: string) => (value: string) => {
9
+ value: string;
10
+ quoted: boolean;
11
+ }[];
12
+ declare const whitespaceTokenizer: (value: string) => {
13
+ value: string;
14
+ quoted: boolean;
15
+ }[];
16
+ declare function findColumn<T extends {
17
+ field: string;
18
+ }>(field: string, columns: T[]): T | undefined;
19
+
20
+ /**
21
+ * Defines the possible sorting orders for columns.
22
+ */
23
+ type SortOrder = 'asc' | 'desc';
24
+ /**
25
+ * Known compareable type
26
+ */
27
+ type Compareable = string | number | boolean | Date;
28
+ /**
29
+ * Callback for conditionally adding classes to a row
30
+ * @param row - The row data.
31
+ * @returns the part string or list of part strings that should be added to this row.
32
+ */
33
+ type RowPartsCallback<T> = (row: T) => string | string[];
34
+ /**
35
+ * Callback for conditionally adding classes to a cell
36
+ * @param value - The value of the cell.
37
+ * @param field - The field of the column.
38
+ * @param row - The row data.
39
+ */
40
+ type CellPartsCallback<T> = (value: unknown, field: NestedKeyOf<T>, row: T) => string | string[];
41
+ /**
42
+ * Callback for providing the full contents of a rendered cell.
43
+ * @param value - The value of the cell.
44
+ * @param field - The field of the column.
45
+ * @param row - The row data.
46
+ * @returns - Should return an HTMLElement or anything Lit can render
47
+ */
48
+ type CellRenderCallback<T> = (value: unknown, field: NestedKeyOf<T>, row: T) => unknown;
49
+ /**
50
+ * Callback for formatting the value of a cell.
51
+ * Called when the cell is created and when exporting to CSV.
52
+ * @param value - The value of the cell.
53
+ * @param row - The row data.
54
+ */
55
+ type ValueFormatterCallback<T> = (value: unknown, row: T) => string | null;
56
+ /**
57
+ * Callback for comparing two values.
58
+ * @param a - The first value.
59
+ * @param b - The second value.
60
+ * @returns A negative number if a < b, a positive number if a > b, or 0 if they are equal.
61
+ */
62
+ type ComparatorCallback = (a: unknown, b: unknown) => number;
63
+ /**
64
+ * Callback for caching the sort value of a field
65
+ * This function should derive a comparable value (often numerical or lowercase string) from the field's original value, to be used during sorting.
66
+ * @param value - The value of the field.
67
+ * @returns The derived value for sorting (e.g., a number or a standardized string).
68
+ */
69
+ type SortValueCallback = (value: unknown) => Compareable;
70
+ /**
71
+ * A filter object containing keys for the fields to be filtered,
72
+ * and the values used to compare against.
73
+ */
74
+ type Filters<T> = Partial<{
75
+ [K in NestedKeyOf<T>]: unknown;
76
+ }>;
77
+ /**
78
+ * A single query token derived from a larger string
79
+ */
80
+ interface QueryToken {
81
+ /**
82
+ * The value to use for the token
83
+ */
84
+ value: string;
85
+ /**
86
+ * If the token should be treated as quoted.
87
+ * Quoted tokens are searched for exactly, no partial matches.
88
+ */
89
+ quoted: boolean;
90
+ }
91
+ /**
92
+ * Callback for tokenizing a value into a list of string tokens.
93
+ * @param value - The value to tokenize.
94
+ * @returns An array of tokens.
95
+ */
96
+ type TokenizerCallback = (value: string) => QueryToken[];
97
+ /**
98
+ * Callback for filtering a row.
99
+ * @param row - The row data.
100
+ * @param index - The index of the row.
101
+ * @returns True if the row matches the filter, false otherwise.
102
+ */
103
+ type FilterCallback<T> = (row: T, index: number) => boolean;
104
+ /**
105
+ * Callback for filtering a field value against the filter data.
106
+ * @param value - The value to filter.
107
+ * @param filter - The filter to apply.
108
+ * @returns True if the value matches the filter, false otherwise.
109
+ */
110
+ type ColumnFilterCallback = (value: unknown, filter: unknown) => boolean;
111
+ /**
112
+ * Represents the current sort state
113
+ */
114
+ interface SortState {
115
+ /**
116
+ * The sort order
117
+ */
118
+ order: SortOrder;
119
+ /**
120
+ * The sort priority.
121
+ * Lower priority means
122
+ */
123
+ priority: number;
124
+ }
125
+ /**
126
+ * Column options for the table.
127
+ */
128
+ interface ColumnOptions<T> {
129
+ /**
130
+ * The field name in the data object.
131
+ */
132
+ field: NestedKeyOf<T>;
133
+ /**
134
+ * The title to display in the header.
135
+ */
136
+ title?: string;
137
+ /**
138
+ * Whether the column is sortable.
139
+ */
140
+ sortable?: boolean;
141
+ /**
142
+ * Whether the column is searchable.
143
+ */
144
+ searchable?: boolean;
145
+ /**
146
+ * Whether the column's data should be tokenized for searching.
147
+ */
148
+ tokenize?: boolean;
149
+ /**
150
+ * Whether the column should be resizable.
151
+ */
152
+ resizable?: boolean;
153
+ /**
154
+ * A function for tokenizing this column's data.
155
+ * Fallback to the main table tokenizer if not provided.
156
+ */
157
+ searchTokenizer?: TokenizerCallback;
158
+ /**
159
+ * A function to format the value for display.
160
+ */
161
+ valueFormatter?: ValueFormatterCallback<T>;
162
+ /**
163
+ * A function for conditinally adding classes to a cell.
164
+ */
165
+ cellParts?: CellPartsCallback<T>;
166
+ /**
167
+ * A function for rendering the contents of a cell.
168
+ * NOTE: Search highlighting will not work for this cell when used.
169
+ */
170
+ cellRenderer?: CellRenderCallback<T>;
171
+ /**
172
+ * A function to use for sorting the column.
173
+ * This overrides the default sorting behavior.
174
+ */
175
+ sorter?: ComparatorCallback;
176
+ /**
177
+ * A function to derive a comparable value from the cell's original value, specifically for sorting this column.
178
+ * This can be used to preprocess and cache values (e.g., convert to lowercase, extract numbers) before comparison.
179
+ */
180
+ sortValue?: SortValueCallback;
181
+ /**
182
+ * A custom function to determine if a cell's value in this column matches a given filter criterion.
183
+ * This is used when `DataTable.filter()` is called with an object-based filter that targets this column's field.
184
+ */
185
+ filter?: ColumnFilterCallback;
186
+ }
187
+ /**
188
+ * Represents the current state of a column.
189
+ */
190
+ interface ColumnState<T> {
191
+ /**
192
+ * The unique field name of the column.
193
+ */
194
+ field: NestedKeyOf<T>;
195
+ /**
196
+ * The current visibility of the column.
197
+ */
198
+ visible: boolean;
199
+ /**
200
+ * The current sort order of the column.
201
+ */
202
+ sortState?: SortState | null;
203
+ /**
204
+ * The currently set width of the column in pixels.
205
+ */
206
+ width?: number | null;
207
+ }
208
+ /**
209
+ * Represents the current state of the table
210
+ */
211
+ interface TableState<T> {
212
+ /**
213
+ * A list of {@link ColumnState}s representing all of the columns in the table.
214
+ */
215
+ columns: ColumnState<T>[];
216
+ /**
217
+ * The current query applied to the table or null if no query is applied.
218
+ */
219
+ searchQuery: string;
220
+ /**
221
+ * The current filters applied to the table or null if no filters are applied.
222
+ */
223
+ filters: Filters<T> | FilterCallback<T> | null;
224
+ /**
225
+ * The current column order represented as a list of their fields from left to right.
226
+ */
227
+ columnOrder: NestedKeyOf<T>[];
228
+ }
229
+ interface StorageOptions {
230
+ /**
231
+ * The unique key used to store the table state in the browser.
232
+ * * @example "my-app-users-table-v1"
233
+ */
234
+ key: string;
235
+ /**
236
+ * Which storage engine to use.
237
+ * * 'local': Persists after browser is closed (Default).
238
+ * * 'session': Cleared when tab is closed.
239
+ */
240
+ storage?: 'local' | 'session';
241
+ /** Save the current column sorting */
242
+ saveColumnSortOrders?: boolean;
243
+ /** Save the current column visibility */
244
+ saveColumnVisibility?: boolean;
245
+ /** Save the current column widths */
246
+ saveColumnWidths?: boolean;
247
+ /** Save the current order of columns */
248
+ saveColumnOrder?: boolean;
249
+ }
250
+ type ColumnInitOptions<T> = ColumnOptions<T> & Partial<ColumnState<T>>;
251
+ type RestorableColumnState<T> = Partial<Omit<ColumnState<T>, 'field'>> & Pick<ColumnState<T>, 'field'>;
252
+ type RestorableTableState<T> = Partial<Omit<TableState<T>, 'columns'>> & {
253
+ columns?: RestorableColumnState<T>[];
254
+ };
255
+
256
+ declare class YatlEvent<T = unknown> extends CustomEvent<T> {
257
+ constructor(name: string, detail: T, options?: EventInit);
258
+ }
259
+ declare class YatlRowClickEvent<T> extends YatlEvent<{
260
+ row: T;
261
+ index: number;
262
+ field: NestedKeyOf<T>;
263
+ originalEvent: MouseEvent;
264
+ }> {
265
+ static readonly EVENT_NAME = "yatl-row-click";
266
+ constructor(row: T, index: number, field: NestedKeyOf<T>, originalEvent: MouseEvent);
267
+ }
268
+ declare class YatlChangeEvent<T> extends YatlEvent<{
269
+ data: T[];
270
+ }> {
271
+ static readonly EVENT_NAME = "yatl-change";
272
+ constructor(data: T[]);
273
+ }
274
+ declare class YatlSortEvent<T> extends YatlEvent<{
275
+ field: NestedKeyOf<T>;
276
+ order: SortOrder | null;
277
+ }> {
278
+ static readonly EVENT_NAME = "yatl-sort";
279
+ constructor(field: NestedKeyOf<T>, order: SortOrder | null);
280
+ }
281
+ declare class YatlColumnToggleEvent<T> extends YatlEvent<{
282
+ field: NestedKeyOf<T>;
283
+ visible: boolean;
284
+ }> {
285
+ static readonly EVENT_NAME = "yatl-column-toggle";
286
+ constructor(field: NestedKeyOf<T>, visible: boolean);
287
+ }
288
+ declare class YatlColumnResizeEvent<T> extends YatlEvent<{
289
+ field: NestedKeyOf<T>;
290
+ width: number;
291
+ }> {
292
+ static readonly EVENT_NAME = "yatl-column-resize";
293
+ constructor(field: NestedKeyOf<T>, width: number);
294
+ }
295
+ declare class YatlColumnReorderEvent<T> extends YatlEvent<{
296
+ draggedColumn: NestedKeyOf<T>;
297
+ droppedColumn: NestedKeyOf<T>;
298
+ order: NestedKeyOf<T>[];
299
+ }> {
300
+ static readonly EVENT_NAME = "yatl-column-reorder";
301
+ constructor(draggedColumn: NestedKeyOf<T>, droppedColumn: NestedKeyOf<T>, order: NestedKeyOf<T>[]);
302
+ }
303
+ declare class YatlSearchEvent extends YatlEvent<{
304
+ query: string;
305
+ }> {
306
+ static readonly EVENT_NAME = "yatl-search";
307
+ constructor(query: string);
308
+ }
309
+
310
+ /**
311
+ * Represents a dynamic and interactive table with features like sorting, searching, filtering,
312
+ * column resizing, column rearranging, and virtual scrolling.
313
+ */
314
+ declare class YatlTable<T extends object> extends LitElement {
315
+ static styles: lit.CSSResult[];
316
+ private tableElement;
317
+ private virtualizer?;
318
+ private _enableSearchTokenization;
319
+ private _enableSearchScoring;
320
+ private _columns;
321
+ private _columnStates;
322
+ private _storageOptions;
323
+ private _data;
324
+ private _searchQuery;
325
+ private _searchIncludedFields;
326
+ private _searchTokenizer;
327
+ private _filters;
328
+ private _filteredData;
329
+ private hasRestoredState;
330
+ private saveTimer;
331
+ private filterDirty;
332
+ private sortDirty;
333
+ private dataLastUpdate;
334
+ private rowMetadata;
335
+ private queryTokens;
336
+ private resizeState;
337
+ private dragColumn;
338
+ /**
339
+ * Enables virtual scrolling for the table.
340
+ * When enabled, only the visible rows are rendered to the DOM, significantly improving
341
+ * performance for large datasets (1000+ rows).
342
+ * @default false
343
+ */
344
+ enableVirtualScroll: boolean;
345
+ /**
346
+ * When enabled, text matching the current search query will be wrapped in `<mark>` tags.
347
+ * This applies to all visible cells that contain the search term.
348
+ * This does NOT apply to content rendered by the user such as the ColumnOptions.render callback.
349
+ * @default true
350
+ */
351
+ enableSearchHighlight: boolean;
352
+ /**
353
+ * Enables tokenized search behavior.
354
+ * When enabled, the search query is split into individual tokens using the
355
+ * `searchTokenizer` function (defaults to splitting on whitespace).
356
+ * A row is considered a match if **ANY** of the tokens appear in the searchable fields.
357
+ * @default false
358
+ */
359
+ get enableSearchTokenization(): boolean;
360
+ set enableSearchTokenization(enable: boolean);
361
+ /**
362
+ * Enables weighted relevance scoring for search results.
363
+ * When enabled, exact matches and prefix matches are ranked higher than substring matches.
364
+ * Rows are sorted by their relevance score descending.
365
+ * @default false
366
+ */
367
+ get enableSearchScoring(): boolean;
368
+ set enableSearchScoring(enable: boolean);
369
+ /**
370
+ * Allows users to reorder columns by dragging and dropping headers.
371
+ * @default true
372
+ */
373
+ enableColumnReorder: boolean;
374
+ /**
375
+ * Shows the built-in footer row which displays the current record count.
376
+ * The footer content can be customized using the `slot="footer"` element.
377
+ * @default false
378
+ */
379
+ enableFooter: boolean;
380
+ /**
381
+ * The string to display in a cell when the data value is `null` or `undefined`.
382
+ * @default "-"
383
+ */
384
+ nullValuePlaceholder: string;
385
+ /**
386
+ * The message displayed when the `data` array is empty.
387
+ * @default "No records to display"
388
+ */
389
+ emptyMessage: string;
390
+ /**
391
+ * The message displayed when `data` exists but the current search/filter
392
+ * results in zero visible rows.
393
+ * @default "No matching records found"
394
+ */
395
+ noResultsMessage: string;
396
+ /**
397
+ * The definitions for the columns to be rendered.
398
+ * This defines the field mapping, titles, sortability, and other static options.
399
+ */
400
+ get columns(): ColumnOptions<T>[];
401
+ set columns(columns: ColumnOptions<T>[]);
402
+ /**
403
+ * The current dynamic state of the columns (width, visibility, sort order).
404
+ * This property is updated automatically when users interact with the table.
405
+ */
406
+ get columnStates(): ColumnState<T>[];
407
+ set columnStates(states: ColumnState<T>[]);
408
+ /**
409
+ * The current text string used to filter the table data.
410
+ * Setting this property triggers a new search and render cycle.
411
+ */
412
+ get searchQuery(): string;
413
+ set searchQuery(query: string);
414
+ /**
415
+ * A list of extra data fields to include in the search index, even if they are not
416
+ * displayed as visible columns. Useful for searching by ID, hidden keywords, or tags.
417
+ */
418
+ get searchIncludedFields(): NestedKeyOf<T>[];
419
+ set searchIncludedFields(fields: NestedKeyOf<T>[]);
420
+ /**
421
+ * A function that splits the search query into tokens.
422
+ * Only used if `enableSearchTokenization` is true.
423
+ * @default whitespaceTokenizer
424
+ */
425
+ get searchTokenizer(): TokenizerCallback;
426
+ set searchTokenizer(tokenizer: TokenizerCallback);
427
+ /**
428
+ * An optional set of criteria to filter the visible rows.
429
+ * This runs **before** the global search query is applied.
430
+ * * You can provide:
431
+ * 1. A **Partial Object**: matches rows where specific keys equal specific values (AND logic).
432
+ * 2. A **Callback Function**: returns `true` to keep the row, `false` to hide it.
433
+ * * @example
434
+ * // 1. Object Syntax (Simple Exact Match)
435
+ * // Shows rows where status is 'active' AND role is 'admin'
436
+ * table.filters = { status: 'active', role: 'admin' };
437
+ * * @example
438
+ * // 2. Callback Syntax (Complex Logic)
439
+ * // Shows rows where age is over 21 OR they are a VIP
440
+ * table.filters = (row) => row.age > 21 || row.isVip;
441
+ */
442
+ get filters(): Partial<{ [K in NestedKeyOf<T>]: unknown; }> | FilterCallback<T> | null;
443
+ set filters(filters: Partial<{ [K in NestedKeyOf<T>]: unknown; }> | FilterCallback<T> | null);
444
+ /**
445
+ * A callback function to conditionally apply CSS parts to table rows.
446
+ */
447
+ rowParts: RowPartsCallback<T> | null;
448
+ /**
449
+ * Configuration options for automatically saving and restoring table state
450
+ * (column width, order, visibility, etc.) to browser storage.
451
+ */
452
+ get storageOptions(): StorageOptions | null;
453
+ set storageOptions(options: StorageOptions | null);
454
+ /**
455
+ * The array of data objects to be displayed.
456
+ * Objects must satisfy the `WeakKey` constraint (objects only, no primitives).
457
+ */
458
+ get data(): T[];
459
+ set data(value: T[]);
460
+ get filteredData(): T[];
461
+ /**
462
+ * Gets a copy of the current state of the table.
463
+ */
464
+ getState(): TableState<T>;
465
+ /**
466
+ * Restores the table to the provided state.
467
+ * @param state - The state to restore the table to.
468
+ */
469
+ restoreState(state: RestorableTableState<T>): void;
470
+ /**
471
+ * Sorts the table by a specified column and order.
472
+ * If `order` is `null`, the sort on this column is removed.
473
+ * @param field - The field name of the column to sort by.
474
+ * @param order - The sort order: 'asc', 'desc', or `null` to remove sorting for this column.
475
+ * @param clear - Clear all other sorting
476
+ */
477
+ sort(field: NestedKeyOf<T>, order: SortOrder | null, clear?: boolean): void;
478
+ /**
479
+ * Sets the visibility of a specified column.
480
+ * @param field - The field name of the column.
481
+ * @param visible - `true` to show the column, `false` to hide it.
482
+ */
483
+ setColumnVisibility(field: NestedKeyOf<T>, visible: boolean): void;
484
+ /**
485
+ * Toggles the visibility of hte specified column
486
+ * @param field - The field name of the column to toggle.
487
+ */
488
+ toggleColumnVisibility(field: NestedKeyOf<T>): void;
489
+ /**
490
+ * Shows the specified column
491
+ * @param field - The field name of the column to show.
492
+ */
493
+ showColumn(field: NestedKeyOf<T>): void;
494
+ /**
495
+ * Hides the specified column
496
+ * @param field - The field name of the column to hide.
497
+ */
498
+ hideColumn(field: NestedKeyOf<T>): void;
499
+ /**
500
+ * Export the current visible table data to a CSV file.
501
+ * @param filename - The name of the file to save.
502
+ * @param all - If `true`, exports all original data (ignoring filters). If `false` (default), exports only the currently visible (filtered and sorted) rows.
503
+ */
504
+ export(filename: string, all?: boolean): void;
505
+ scrollToRow(row: T): Promise<void>;
506
+ /**
507
+ * Scrolls the table to bring the row at the specified original index into view.
508
+ * @param index - The original index of the row (from the initial dataset).
509
+ */
510
+ scrollToOriginalIndex(index: number): Promise<void>;
511
+ scrollToFilteredIndex(index: number): Promise<void>;
512
+ scrollToPx(px: number): Promise<void>;
513
+ /**
514
+ * Sets the display order of the columns in the table.
515
+ *
516
+ * @param fields - An array of field names representing the new order of columns. Columns not included in the array will be placed at the end.
517
+ * @throws {TypeError} If `fields` is not an array.
518
+ */
519
+ setColumnOrder(fields: NestedKeyOf<T>[]): void;
520
+ /**
521
+ * Finds the first row
522
+ * @param field
523
+ * @param value
524
+ * @returns
525
+ */
526
+ findRow(field: NestedKeyOf<T>, value: unknown): T | undefined;
527
+ /**
528
+ * Finds the original index of the first row where the specified field matches the given value.
529
+ * This searches through the original, unfiltered dataset.
530
+ * @param field - The field name within the row data to search.
531
+ * @param value - The value to match against the field's content.
532
+ * @returns The original index of the found row, or -1 if no match is found.
533
+ * @example
534
+ * ```ts
535
+ * const index = dataTable.indexOf('id', 12345);
536
+ * if (index >= 0) {
537
+ * dataTable.updateRow({description: "Updated description"}, index);
538
+ * }
539
+ * ```
540
+ */
541
+ findRowIndex(field: NestedKeyOf<T>, value: unknown): number;
542
+ /**
543
+ * Updates the data of a row at a specific original index.
544
+ * @param index - The original index of the row to update.
545
+ * @param data - An object containing the new data to assign to the row. Existing fields will be updated, and new fields will be added.
546
+ *
547
+ * @example
548
+ * ```ts
549
+ * const index = dataTable.indexOf('id', 12345);
550
+ * if (index >= 0) {
551
+ * dataTable.updateRow(index, {description: "Updated description"});
552
+ * }
553
+ * ```
554
+ */
555
+ updateRow(index: number, data: Partial<T>): void;
556
+ /**
557
+ * Deletes a row at a specific original index from the table.
558
+ * @param index - The original index of the row to delete.
559
+ */
560
+ deleteRow(index: number): void;
561
+ protected renderColumnSortIcon(column: ColumnOptions<T>, state: ColumnState<T>): TemplateResult<1> | typeof nothing;
562
+ protected renderColumnResizer(column: ColumnOptions<T>, _state: ColumnState<T>): TemplateResult<1> | typeof nothing;
563
+ protected renderHeaderCell(column: ColumnOptions<T>): TemplateResult<1> | typeof nothing;
564
+ protected renderHeader(): TemplateResult<1>;
565
+ protected renderCellContents(value: unknown, column: ColumnOptions<T>, row: T): unknown;
566
+ protected renderCell(column: ColumnOptions<T>, row: T): TemplateResult<1> | typeof nothing;
567
+ protected renderRow(row: T, index: number): TemplateResult<1>;
568
+ protected renderBody(): TemplateResult<1>;
569
+ protected renderFooter(): TemplateResult<1> | typeof nothing;
570
+ protected render(): TemplateResult<1>;
571
+ protected updated(changedProperties: PropertyValues<YatlTable<T>>): void;
572
+ disconnectedCallback(): void;
573
+ /**
574
+ * Calculates a relevance score for a given query against a target string.
575
+ *
576
+ * This function implements a tiered matching strategy:
577
+ * 1. **Exact Match**: The query exactly matches the target. This yields the highest score.
578
+ * 2. **Prefix Match**: The target starts with the query. This is the next most relevant.
579
+ * 3. **Substring Match**: The target contains the query somewhere. This is the least relevant.
580
+ *
581
+ * The final score is weighted and adjusted by the length difference between the query and the target
582
+ * to ensure that more specific matches (e.g., "apple" vs "application" for the query "apple") rank higher.
583
+ *
584
+ * @param query The search term (e.g., "app").
585
+ * @param target The string to be searched (e.g., "Apple" or "Application").
586
+ * @returns A numerical score representing the relevance of the match. Higher is better. Returns 0 if no match is found.
587
+ */
588
+ private calculateSearchScore;
589
+ private searchField;
590
+ private filterField;
591
+ private filterRow;
592
+ private filterRows;
593
+ private compareRows;
594
+ private sortRows;
595
+ private createColumnStates;
596
+ private createMetadata;
597
+ private updateInternalQuery;
598
+ private get columnData();
599
+ private get columnWidths();
600
+ private scheduleSave;
601
+ private saveStateToStorage;
602
+ private loadStateFromStorage;
603
+ private handleHeaderClicked;
604
+ private handleCellClick;
605
+ private handleResizeMouseDown;
606
+ private handleResizeMouseMove;
607
+ private handleResizeMouseUp;
608
+ private handleDragColumnStart;
609
+ private handleDragColumnEnter;
610
+ private handleDragColumnLeave;
611
+ private handleDragColumnOver;
612
+ private handleDragColumnDrop;
613
+ private handleDragColumnEnd;
614
+ addEventListener<K extends keyof EventMap<T>>(type: K, listener: (this: EventMap<T>, ev: EventMap<T>[K]) => void, options?: boolean | AddEventListenerOptions): void;
615
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
616
+ removeEventListener<K extends keyof EventMap<T>>(type: K, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
617
+ dispatchEvent<K extends keyof EventMap<T>>(event: EventMap<T>[K]): boolean;
618
+ }
619
+ /**
620
+ * Defines the mapping between event names and their detail object types.
621
+ */
622
+ interface EventMap<T> {
623
+ 'yatl-row-click': YatlRowClickEvent<T>;
624
+ 'yatl-change': YatlChangeEvent<T>;
625
+ 'yatl-sort': YatlSortEvent<T>;
626
+ 'yatl-column-toggle': YatlColumnToggleEvent<T>;
627
+ 'yatl-column-resize': YatlColumnResizeEvent<T>;
628
+ 'yatl-column-reorder': YatlColumnReorderEvent<T>;
629
+ 'yatl-search': YatlSearchEvent;
630
+ }
631
+
632
+ export { type CellPartsCallback, type CellRenderCallback, type ColumnFilterCallback, type ColumnInitOptions, type ColumnOptions, type ColumnState, type ComparatorCallback, type Compareable, type FilterCallback, type Filters, type NestedKeyOf, type QueryToken, type RestorableColumnState, type RestorableTableState, type RowPartsCallback, type SortOrder, type SortState, type SortValueCallback, type StorageOptions, type TableState, type TokenizerCallback, type ValueFormatterCallback, YatlChangeEvent, YatlColumnReorderEvent, YatlColumnResizeEvent, YatlColumnToggleEvent, YatlEvent, YatlRowClickEvent, YatlSearchEvent, YatlSortEvent, YatlTable, createRegexTokenizer, findColumn, whitespaceTokenizer };