@timlassiter11/yatl 1.0.19 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +83 -181
- package/dist/index.d.ts +83 -181
- package/dist/index.js +542 -1270
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +533 -1251
- package/dist/index.mjs.map +1 -1
- package/dist/theme.css +52 -0
- package/dist/yatl.min.global.js +103 -629
- package/dist/yatl.min.global.js.map +1 -1
- package/package.json +8 -12
- package/LICENSE +0 -21
- package/README.md +0 -380
package/dist/index.d.mts
CHANGED
|
@@ -1,62 +1,6 @@
|
|
|
1
|
-
import * as lit_html from 'lit-html';
|
|
2
1
|
import * as lit from 'lit';
|
|
3
|
-
import {
|
|
4
|
-
export { html, noChange, nothing, svg } from 'lit';
|
|
2
|
+
import { TemplateResult, ReactiveController, ReactiveControllerHost, LitElement, nothing } from 'lit';
|
|
5
3
|
import { DirectiveResult } from 'lit/directive.js';
|
|
6
|
-
export { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
|
7
|
-
|
|
8
|
-
declare class YatlButton extends LitElement {
|
|
9
|
-
static styles: lit.CSSResult[];
|
|
10
|
-
disabled: boolean;
|
|
11
|
-
type: 'button' | 'submit' | 'reset';
|
|
12
|
-
render(): lit_html.TemplateResult<1>;
|
|
13
|
-
}
|
|
14
|
-
declare global {
|
|
15
|
-
interface HTMLElementTagNameMap {
|
|
16
|
-
'yatl-button': YatlButton;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
declare class YatlButtonGroup extends LitElement {
|
|
21
|
-
static styles: lit.CSSResult[];
|
|
22
|
-
render(): lit_html.TemplateResult<1>;
|
|
23
|
-
private handleSlotChange;
|
|
24
|
-
}
|
|
25
|
-
declare global {
|
|
26
|
-
interface HTMLElementTagNameMap {
|
|
27
|
-
'yatl-button-group': YatlButtonGroup;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
declare class YatlDropdown extends LitElement {
|
|
32
|
-
static styles: lit.CSSResult[];
|
|
33
|
-
private detailsElement;
|
|
34
|
-
open: boolean;
|
|
35
|
-
protected render(): lit_html.TemplateResult<1>;
|
|
36
|
-
private handleDropdownTriggerClick;
|
|
37
|
-
private handleDocumentClick;
|
|
38
|
-
}
|
|
39
|
-
declare global {
|
|
40
|
-
interface HTMLElementTagNameMap {
|
|
41
|
-
'yatl-dropdown': YatlDropdown;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* @emits yatl-dropdown-toggle - Fired when a dropdown item's checked state changes
|
|
47
|
-
*/
|
|
48
|
-
declare class YatlDropdownItem extends LitElement {
|
|
49
|
-
static styles: lit.CSSResult[];
|
|
50
|
-
value: string;
|
|
51
|
-
checked: boolean;
|
|
52
|
-
protected render(): lit_html.TemplateResult<1>;
|
|
53
|
-
private handleCheckboxChanged;
|
|
54
|
-
}
|
|
55
|
-
declare global {
|
|
56
|
-
interface HTMLElementTagNameMap {
|
|
57
|
-
'yatl-dropdown-item': YatlDropdownItem;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
4
|
|
|
61
5
|
type NestedKeyOf<ObjectType> = ObjectType extends object ? {
|
|
62
6
|
[Key in keyof ObjectType & (string | number)]: NonNullable<ObjectType[Key]> extends unknown[] ? `${Key}` : NonNullable<ObjectType[Key]> extends object ? // Recurse with the non-nullable type
|
|
@@ -66,6 +10,9 @@ type NestedKeyOf<ObjectType> = ObjectType extends object ? {
|
|
|
66
10
|
* Default type for the table.
|
|
67
11
|
*/
|
|
68
12
|
type UnspecifiedRecord = Record<string, any>;
|
|
13
|
+
/**
|
|
14
|
+
* Valid types for Row IDs
|
|
15
|
+
*/
|
|
69
16
|
type RowId = string | number;
|
|
70
17
|
/**
|
|
71
18
|
* Known compareable type
|
|
@@ -228,7 +175,7 @@ interface InternalColumnOptions<T> extends BaseColumnOptions<T> {
|
|
|
228
175
|
* Marks this column as internal-only.
|
|
229
176
|
* It will be indexed for search and filtering, but strictly excluded from the UI.
|
|
230
177
|
*/
|
|
231
|
-
|
|
178
|
+
role: 'internal';
|
|
232
179
|
}
|
|
233
180
|
type ColumnOptions<T> = DisplayColumnOptions<T> | InternalColumnOptions<T>;
|
|
234
181
|
/**
|
|
@@ -288,6 +235,10 @@ type RowSelectionMethod = 'single' | 'multi';
|
|
|
288
235
|
* @returns the part string or list of part strings that should be added to this row.
|
|
289
236
|
*/
|
|
290
237
|
type RowPartsCallback<T> = (row: T) => string | string[];
|
|
238
|
+
/**
|
|
239
|
+
* Options used to configure what state information
|
|
240
|
+
* should be saved and restored automatically.
|
|
241
|
+
*/
|
|
291
242
|
interface StorageOptions {
|
|
292
243
|
/**
|
|
293
244
|
* The unique key used to store the table state in the browser.
|
|
@@ -333,11 +284,20 @@ interface TableState<T> {
|
|
|
333
284
|
type RestorableTableState<T> = Partial<Omit<TableState<T>, 'columns'>> & {
|
|
334
285
|
columns?: RestorableColumnState<T>[];
|
|
335
286
|
};
|
|
287
|
+
/**
|
|
288
|
+
* Options for configuring what date should be exported.
|
|
289
|
+
*/
|
|
336
290
|
interface ExportOptions {
|
|
291
|
+
/** Include all rows including filtered out rows */
|
|
337
292
|
includeAllRows?: boolean;
|
|
293
|
+
/** Include columns that have been hidden */
|
|
338
294
|
includeHiddenColumns?: boolean;
|
|
295
|
+
/** Include columns marked as internal */
|
|
339
296
|
includeInternalColumns?: boolean;
|
|
340
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* Options for configuring a table controller
|
|
300
|
+
*/
|
|
341
301
|
interface TableControllerOptions<T extends object> {
|
|
342
302
|
enableSearchTokenization?: boolean;
|
|
343
303
|
enableSearchScoring?: boolean;
|
|
@@ -352,8 +312,9 @@ interface TableControllerOptions<T extends object> {
|
|
|
352
312
|
/**
|
|
353
313
|
* Base event class that bubbles and is composed.
|
|
354
314
|
*/
|
|
355
|
-
declare class YatlEvent extends Event {
|
|
315
|
+
declare abstract class YatlEvent extends Event {
|
|
356
316
|
constructor(name: string, options?: EventInit);
|
|
317
|
+
abstract clone(): YatlEvent;
|
|
357
318
|
}
|
|
358
319
|
declare class YatlRowClickEvent<T extends object = UnspecifiedRecord> extends YatlEvent {
|
|
359
320
|
readonly row: T;
|
|
@@ -363,26 +324,30 @@ declare class YatlRowClickEvent<T extends object = UnspecifiedRecord> extends Ya
|
|
|
363
324
|
readonly originalEvent: MouseEvent;
|
|
364
325
|
static readonly EVENT_NAME = "yatl-row-click";
|
|
365
326
|
constructor(row: T, rowId: RowId, index: number, field: NestedKeyOf<T>, originalEvent: MouseEvent);
|
|
327
|
+
clone(): YatlRowClickEvent<T>;
|
|
366
328
|
}
|
|
367
|
-
declare class
|
|
329
|
+
declare class YatlRowSelectRequest extends YatlEvent {
|
|
368
330
|
readonly rowId: RowId;
|
|
369
331
|
readonly selected: boolean;
|
|
370
332
|
readonly currentlySelectedRows: RowId[];
|
|
371
333
|
static readonly EVENT_NAME = "yatl-row-select-request";
|
|
372
334
|
constructor(rowId: RowId, selected: boolean, currentlySelectedRows: RowId[]);
|
|
335
|
+
clone(): YatlRowSelectRequest;
|
|
373
336
|
}
|
|
374
337
|
declare class YatlRowSelectEvent extends YatlEvent {
|
|
375
338
|
readonly selectedIds: RowId[];
|
|
376
339
|
readonly previouslySelectedRows: RowId[];
|
|
377
340
|
static readonly EVENT_NAME = "yatl-row-select";
|
|
378
341
|
constructor(selectedIds: RowId[], previouslySelectedRows: RowId[]);
|
|
342
|
+
clone(): YatlRowSelectEvent;
|
|
379
343
|
}
|
|
380
|
-
declare class
|
|
344
|
+
declare class YatlColumnSortRequest<T extends object = UnspecifiedRecord> extends YatlEvent {
|
|
381
345
|
readonly field: NestedKeyOf<T>;
|
|
382
346
|
readonly order: SortOrder | null;
|
|
383
347
|
readonly multisort: boolean;
|
|
384
348
|
static readonly EVENT_NAME = "yatl-column-sort-request";
|
|
385
349
|
constructor(field: NestedKeyOf<T>, order: SortOrder | null, multisort: boolean);
|
|
350
|
+
clone(): YatlColumnSortRequest<T>;
|
|
386
351
|
}
|
|
387
352
|
declare class YatlColumnSortEvent<T extends object = UnspecifiedRecord> extends YatlEvent {
|
|
388
353
|
readonly field: NestedKeyOf<T>;
|
|
@@ -390,96 +355,80 @@ declare class YatlColumnSortEvent<T extends object = UnspecifiedRecord> extends
|
|
|
390
355
|
readonly multisort: boolean;
|
|
391
356
|
static readonly EVENT_NAME = "yatl-column-sort";
|
|
392
357
|
constructor(field: NestedKeyOf<T>, order: SortOrder | null, multisort: boolean);
|
|
393
|
-
|
|
394
|
-
declare class YatlColumnToggleRequestEvent extends YatlEvent {
|
|
395
|
-
readonly field: string;
|
|
396
|
-
readonly visibility: boolean;
|
|
397
|
-
static readonly EVENT_NAME = "yatl-column-toggle-request";
|
|
398
|
-
constructor(field: string, visibility: boolean);
|
|
358
|
+
clone(): YatlColumnSortEvent<T>;
|
|
399
359
|
}
|
|
400
360
|
declare class YatlColumnToggleEvent<T extends object = UnspecifiedRecord> extends YatlEvent {
|
|
401
361
|
readonly field: NestedKeyOf<T>;
|
|
402
362
|
readonly visible: boolean;
|
|
403
363
|
static readonly EVENT_NAME = "yatl-column-toggle";
|
|
404
364
|
constructor(field: NestedKeyOf<T>, visible: boolean);
|
|
365
|
+
clone(): YatlColumnToggleEvent<T>;
|
|
405
366
|
}
|
|
406
367
|
declare class YatlColumnResizeEvent<T extends object = UnspecifiedRecord> extends YatlEvent {
|
|
407
368
|
readonly field: NestedKeyOf<T>;
|
|
408
369
|
readonly width: number | null;
|
|
409
370
|
static readonly EVENT_NAME = "yatl-column-resize";
|
|
410
371
|
constructor(field: NestedKeyOf<T>, width: number | null);
|
|
372
|
+
clone(): YatlColumnResizeEvent<T>;
|
|
411
373
|
}
|
|
412
|
-
declare class
|
|
374
|
+
declare class YatlColumnReorderRequest<T extends object = UnspecifiedRecord> extends YatlEvent {
|
|
413
375
|
readonly movedColumn: NestedKeyOf<T>;
|
|
414
376
|
readonly originalIndex: number;
|
|
415
377
|
readonly newIndex: number;
|
|
416
378
|
static readonly EVENT_NAME = "yatl-column-reorder-request";
|
|
417
379
|
constructor(movedColumn: NestedKeyOf<T>, originalIndex: number, newIndex: number);
|
|
380
|
+
clone(): YatlColumnReorderRequest<T>;
|
|
418
381
|
}
|
|
419
382
|
declare class YatlColumnReorderEvent<T extends object = UnspecifiedRecord> extends YatlEvent {
|
|
420
383
|
readonly order: NestedKeyOf<T>[];
|
|
421
384
|
static readonly EVENT_NAME = "yatl-column-reorder";
|
|
422
385
|
constructor(order: NestedKeyOf<T>[]);
|
|
386
|
+
clone(): YatlColumnReorderEvent<T>;
|
|
423
387
|
}
|
|
424
388
|
declare class YatlTableSearchEvent extends YatlEvent {
|
|
425
389
|
readonly query: string;
|
|
426
390
|
static readonly EVENT_NAME = "yatl-table-search";
|
|
427
391
|
constructor(query: string);
|
|
392
|
+
clone(): YatlTableSearchEvent;
|
|
428
393
|
}
|
|
429
394
|
declare class YatlTableViewChangeEvent<T extends object = UnspecifiedRecord> extends YatlEvent {
|
|
430
395
|
readonly data: T[];
|
|
431
396
|
static readonly EVENT_NAME = "yatl-table-view-change";
|
|
432
397
|
constructor(data: T[]);
|
|
398
|
+
clone(): YatlTableViewChangeEvent<T>;
|
|
433
399
|
}
|
|
434
400
|
declare class YatlTableStateChangeEvent<T extends object = UnspecifiedRecord> extends YatlEvent {
|
|
435
401
|
readonly state: TableState<T>;
|
|
436
402
|
readonly triggers: string[];
|
|
437
403
|
static readonly EVENT_NAME = "yatl-table-state-change";
|
|
438
404
|
constructor(state: TableState<T>, triggers: string[]);
|
|
439
|
-
|
|
440
|
-
declare class YatlDropdownToggleEvent extends YatlEvent {
|
|
441
|
-
readonly value: string;
|
|
442
|
-
readonly checked: boolean;
|
|
443
|
-
static readonly EVENT_NAME = "yatl-dropdown-toggle";
|
|
444
|
-
constructor(value: string, checked: boolean);
|
|
445
|
-
}
|
|
446
|
-
declare class YatlToolbarSearchInput extends YatlEvent {
|
|
447
|
-
readonly value: string;
|
|
448
|
-
static readonly EVENT_NAME = "yatl-toolbar-search-input";
|
|
449
|
-
constructor(value: string);
|
|
450
|
-
}
|
|
451
|
-
declare class YatlToolbarSearchChange extends YatlEvent {
|
|
452
|
-
readonly value: string;
|
|
453
|
-
static readonly EVENT_NAME = "yatl-toolbar-search-change";
|
|
454
|
-
constructor(value: string);
|
|
455
|
-
}
|
|
456
|
-
declare class YatlToolbarExportClick extends YatlEvent {
|
|
457
|
-
static readonly EVENT_NAME = "yatl-toolbar-export-click";
|
|
458
|
-
constructor();
|
|
405
|
+
clone(): YatlTableStateChangeEvent<T>;
|
|
459
406
|
}
|
|
460
407
|
declare global {
|
|
461
408
|
interface HTMLElementEventMap {
|
|
462
409
|
[YatlRowClickEvent.EVENT_NAME]: YatlRowClickEvent;
|
|
463
|
-
[
|
|
410
|
+
[YatlRowSelectRequest.EVENT_NAME]: YatlRowSelectRequest;
|
|
464
411
|
[YatlRowSelectEvent.EVENT_NAME]: YatlRowSelectEvent;
|
|
465
|
-
[
|
|
412
|
+
[YatlColumnSortRequest.EVENT_NAME]: YatlColumnSortRequest;
|
|
466
413
|
[YatlColumnSortEvent.EVENT_NAME]: YatlColumnSortEvent;
|
|
467
|
-
[YatlColumnToggleRequestEvent.EVENT_NAME]: YatlColumnToggleRequestEvent;
|
|
468
414
|
[YatlColumnToggleEvent.EVENT_NAME]: YatlColumnToggleEvent;
|
|
469
415
|
[YatlColumnResizeEvent.EVENT_NAME]: YatlColumnResizeEvent;
|
|
470
|
-
[
|
|
416
|
+
[YatlColumnReorderRequest.EVENT_NAME]: YatlColumnReorderRequest;
|
|
471
417
|
[YatlColumnReorderEvent.EVENT_NAME]: YatlColumnReorderEvent;
|
|
472
418
|
[YatlTableSearchEvent.EVENT_NAME]: YatlTableSearchEvent;
|
|
473
419
|
[YatlTableViewChangeEvent.EVENT_NAME]: YatlTableViewChangeEvent;
|
|
474
420
|
[YatlTableStateChangeEvent.EVENT_NAME]: YatlTableStateChangeEvent;
|
|
475
|
-
[YatlDropdownToggleEvent.EVENT_NAME]: YatlDropdownToggleEvent;
|
|
476
|
-
[YatlToolbarSearchInput.EVENT_NAME]: YatlToolbarSearchInput;
|
|
477
|
-
[YatlToolbarSearchChange.EVENT_NAME]: YatlToolbarSearchChange;
|
|
478
|
-
[YatlToolbarExportClick.EVENT_NAME]: YatlToolbarExportClick;
|
|
479
421
|
}
|
|
480
422
|
}
|
|
481
423
|
|
|
482
|
-
declare class
|
|
424
|
+
declare class TypedEventTarget<TEventMap extends Record<string, Event>> extends EventTarget {
|
|
425
|
+
addEventListener<K extends keyof TEventMap>(type: K, listener: (this: TEventMap, ev: TEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
|
|
426
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
427
|
+
removeEventListener<K extends keyof TEventMap>(type: K, listener: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions): void;
|
|
428
|
+
dispatchEvent<K extends keyof TEventMap>(event: TEventMap[K]): boolean;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
declare class YatlTableController<T extends object = UnspecifiedRecord> extends TypedEventTarget<ControllerEventMap> implements ReactiveController {
|
|
483
432
|
private hosts;
|
|
484
433
|
private _enableSearchTokenization;
|
|
485
434
|
private _enableSearchScoring;
|
|
@@ -625,6 +574,7 @@ declare class YatlTableController<T extends object = UnspecifiedRecord> implemen
|
|
|
625
574
|
getColumnState(field: NestedKeyOf<T>): ColumnState<T>;
|
|
626
575
|
updateColumnState(field: NestedKeyOf<T>, state: RestorableColumnState<T>): void;
|
|
627
576
|
search(query: string): void;
|
|
577
|
+
getColumnFilterValues(field: NestedKeyOf<T>, includeNull?: boolean): Map<unknown, number>;
|
|
628
578
|
/**
|
|
629
579
|
* Sorts the table by a specified column and order.
|
|
630
580
|
* If `order` is `null`, the sort on this column is removed.
|
|
@@ -680,8 +630,7 @@ declare class YatlTableController<T extends object = UnspecifiedRecord> implemen
|
|
|
680
630
|
deselectAll(): void;
|
|
681
631
|
/**
|
|
682
632
|
* Export the current visible table data to a CSV file.
|
|
683
|
-
* @param
|
|
684
|
-
* @param all - If `true`, exports all original data (ignoring filters). If `false` (default), exports only the currently visible (filtered and sorted) rows.
|
|
633
|
+
* @param options - Options for configuring what should be exported.
|
|
685
634
|
*/
|
|
686
635
|
export(options?: ExportOptions): Blob;
|
|
687
636
|
/**
|
|
@@ -729,18 +678,17 @@ declare class YatlTableController<T extends object = UnspecifiedRecord> implemen
|
|
|
729
678
|
updateRowAtIndex(index: number, data: Partial<T>): void;
|
|
730
679
|
/**
|
|
731
680
|
* Deletes the row with the matching ID.
|
|
732
|
-
* @param
|
|
681
|
+
* @param rowIds - The IDs rows to delete
|
|
733
682
|
*/
|
|
734
683
|
deleteRow(...rowIds: RowId[]): void;
|
|
735
684
|
/**
|
|
736
685
|
* Deletes a row at a specific original index from the table.
|
|
737
|
-
* @param
|
|
686
|
+
* @param indexes - The original indexes of rows to delete.
|
|
738
687
|
*/
|
|
739
688
|
deleteRowAtIndex(...indexes: number[]): void;
|
|
740
689
|
getRowId(row: T): RowId;
|
|
741
690
|
getRowIndex(row: T): number;
|
|
742
691
|
getRowHighlightIndicies(row: T): Record<string, [number, number][]> | undefined;
|
|
743
|
-
private dispatchEvent;
|
|
744
692
|
hostConnected(): void;
|
|
745
693
|
hostDisconnected(): void;
|
|
746
694
|
hostUpdate(): void;
|
|
@@ -774,6 +722,16 @@ declare class YatlTableController<T extends object = UnspecifiedRecord> implemen
|
|
|
774
722
|
private saveStateToStorage;
|
|
775
723
|
private loadStateFromStorage;
|
|
776
724
|
}
|
|
725
|
+
type ControllerEventMap = {
|
|
726
|
+
[YatlColumnReorderEvent.EVENT_NAME]: YatlColumnReorderEvent;
|
|
727
|
+
[YatlColumnResizeEvent.EVENT_NAME]: YatlColumnResizeEvent;
|
|
728
|
+
[YatlColumnSortEvent.EVENT_NAME]: YatlColumnSortEvent;
|
|
729
|
+
[YatlColumnToggleEvent.EVENT_NAME]: YatlColumnToggleEvent;
|
|
730
|
+
[YatlRowSelectEvent.EVENT_NAME]: YatlRowSelectEvent;
|
|
731
|
+
[YatlTableSearchEvent.EVENT_NAME]: YatlTableSearchEvent;
|
|
732
|
+
[YatlTableStateChangeEvent.EVENT_NAME]: YatlTableStateChangeEvent;
|
|
733
|
+
[YatlTableViewChangeEvent.EVENT_NAME]: YatlTableViewChangeEvent;
|
|
734
|
+
};
|
|
777
735
|
|
|
778
736
|
/**
|
|
779
737
|
* A virtualized data table capable of handling complex sorting, filtering, and tokenized searching.
|
|
@@ -786,7 +744,6 @@ declare class YatlTableController<T extends object = UnspecifiedRecord> implemen
|
|
|
786
744
|
* @fires yatl-row-select - Fired when the row selection changes.
|
|
787
745
|
* @fires yatl-column-sort-request - Fired before a column sort order changes. Cancellable.
|
|
788
746
|
* @fires yatl-column-sort - Fired when a column sort order changes.
|
|
789
|
-
* @fires yatl-column-toggle-request - Fired before a column's visibility changes. Cancellable.
|
|
790
747
|
* @fires yatl-column-toggle - Fired when a column's visibility changes.
|
|
791
748
|
* @fires yatl-column-resize - Fired after a column has been resized by the user.
|
|
792
749
|
* @fires yatl-column-reorder-request - Fired when the user drops a column into a new position. Cancellable.
|
|
@@ -801,6 +758,7 @@ declare class YatlTable<T extends object = UnspecifiedRecord> extends LitElement
|
|
|
801
758
|
private virtualizer?;
|
|
802
759
|
private resizeState;
|
|
803
760
|
private dragColumn;
|
|
761
|
+
private useYatlUi;
|
|
804
762
|
private _controller;
|
|
805
763
|
get controller(): YatlTableController<T>;
|
|
806
764
|
set controller(controller: YatlTableController<T>);
|
|
@@ -1021,6 +979,7 @@ declare class YatlTable<T extends object = UnspecifiedRecord> extends LitElement
|
|
|
1021
979
|
* @returns
|
|
1022
980
|
*/
|
|
1023
981
|
moveColumn(field: NestedKeyOf<T>, newPosition: number | NestedKeyOf<T>): void;
|
|
982
|
+
resizeColumn(field: NestedKeyOf<T>, width: number | null): void;
|
|
1024
983
|
isRowSelected(row: T): boolean;
|
|
1025
984
|
/**
|
|
1026
985
|
* Toggles the selection state of a specific row.
|
|
@@ -1045,7 +1004,7 @@ declare class YatlTable<T extends object = UnspecifiedRecord> extends LitElement
|
|
|
1045
1004
|
/**
|
|
1046
1005
|
* Export the current visible table data to a CSV file.
|
|
1047
1006
|
* @param filename - The name of the file to save.
|
|
1048
|
-
* @param
|
|
1007
|
+
* @param options - Options for configuring what should be exported.
|
|
1049
1008
|
*/
|
|
1050
1009
|
export(filename: string, options?: ExportOptions): void;
|
|
1051
1010
|
scrollToRow(row: T): Promise<void>;
|
|
@@ -1101,7 +1060,7 @@ declare class YatlTable<T extends object = UnspecifiedRecord> extends LitElement
|
|
|
1101
1060
|
updateRowAtIndex(index: number, data: Partial<T>): void;
|
|
1102
1061
|
/**
|
|
1103
1062
|
* Deletes the row with the matching ID.
|
|
1104
|
-
* @param
|
|
1063
|
+
* @param rowIds - The IDs rows to delete
|
|
1105
1064
|
*/
|
|
1106
1065
|
deleteRow(...rowIds: RowId[]): void;
|
|
1107
1066
|
/**
|
|
@@ -1117,6 +1076,7 @@ declare class YatlTable<T extends object = UnspecifiedRecord> extends LitElement
|
|
|
1117
1076
|
protected renderHeader(): TemplateResult<1>;
|
|
1118
1077
|
protected renderCellContents(value: unknown, column: DisplayColumnOptions<T>, row: T): {} | null | undefined;
|
|
1119
1078
|
protected renderCell(column: DisplayColumnOptions<T>, row: T): TemplateResult<1>;
|
|
1079
|
+
protected renderCheckbox(row: T, selected: boolean): TemplateResult<1>;
|
|
1120
1080
|
protected renderRowSelectorCell(row: T, selected: boolean): TemplateResult<1>;
|
|
1121
1081
|
protected renderRowNumberCell(rowNumber: number): TemplateResult<1>;
|
|
1122
1082
|
protected renderRow(row: T, renderIndex: number): TemplateResult<1>;
|
|
@@ -1124,7 +1084,12 @@ declare class YatlTable<T extends object = UnspecifiedRecord> extends LitElement
|
|
|
1124
1084
|
protected renderFooter(): TemplateResult<1> | typeof nothing;
|
|
1125
1085
|
protected render(): TemplateResult<1>;
|
|
1126
1086
|
private renderCellWrapper;
|
|
1087
|
+
connectedCallback(): void;
|
|
1127
1088
|
disconnectedCallback(): void;
|
|
1089
|
+
private readonly eventNames;
|
|
1090
|
+
private addControllerListeners;
|
|
1091
|
+
private removeControllerListeners;
|
|
1092
|
+
private redispatchControllerEvent;
|
|
1128
1093
|
private hasVisibleColumn;
|
|
1129
1094
|
/**
|
|
1130
1095
|
* Gets the width of each column in the
|
|
@@ -1150,87 +1115,24 @@ declare global {
|
|
|
1150
1115
|
}
|
|
1151
1116
|
}
|
|
1152
1117
|
|
|
1153
|
-
/**
|
|
1154
|
-
* A "Batteries Included" wrapper for `<yatl-table>` that provides a built-in toolbar.
|
|
1155
|
-
*
|
|
1156
|
-
* This element extends the core table engine to automatically render UI controls
|
|
1157
|
-
* for common user actions, such as toggling column visibility and exporting data.
|
|
1158
|
-
*
|
|
1159
|
-
* It inherits all properties and events from `<yatl-table>`.
|
|
1160
|
-
*
|
|
1161
|
-
* @element yatl-table-ui
|
|
1162
|
-
*
|
|
1163
|
-
* @slot toolbar - Adds contents to the right of the toolbar button group
|
|
1164
|
-
* @slot toolbar-button-group - Adds content into the toolbar button group.
|
|
1165
|
-
* @slot footer - Inherited from `yatl-table`. Content to display in the table footer area.
|
|
1166
|
-
* @slot body - Inherited from `yatl-table`. Custom rendering for the table body.
|
|
1167
|
-
*/
|
|
1168
|
-
declare class YatlTableUi<T extends object = UnspecifiedRecord> extends YatlTable<T> {
|
|
1169
|
-
static styles: lit.CSSResult[];
|
|
1170
|
-
/**
|
|
1171
|
-
* Toggles the visibility of the column picker button in the toolbar. Defaults to `true`.
|
|
1172
|
-
*/
|
|
1173
|
-
showColumnPicker: boolean;
|
|
1174
|
-
/**
|
|
1175
|
-
* Toggles the visibility of the CSV export button in the toolbar. Defaults to `true`.
|
|
1176
|
-
*/
|
|
1177
|
-
showExportButton: boolean;
|
|
1178
|
-
protected render(): lit_html.TemplateResult<1>;
|
|
1179
|
-
private handleTableExportClicked;
|
|
1180
|
-
}
|
|
1181
|
-
declare global {
|
|
1182
|
-
interface HTMLElementTagNameMap {
|
|
1183
|
-
'yatl-table-ui': YatlTableUi;
|
|
1184
|
-
}
|
|
1185
|
-
}
|
|
1186
|
-
|
|
1187
|
-
/**
|
|
1188
|
-
* A table toolbar component with a search input, column picker, and export button.
|
|
1189
|
-
*
|
|
1190
|
-
* @element yatl-toolbar
|
|
1191
|
-
* @summary Provides a cohesive set of controls for searching, exporting, and managing column visibility,
|
|
1192
|
-
* along with a flexible slot for custom actions.
|
|
1193
|
-
*
|
|
1194
|
-
* @slot - Adds contents to the right of the toolbar button group
|
|
1195
|
-
* @slot toolbar-button-group - Adds content into the toolbar button group.
|
|
1196
|
-
* @slot column-picker-trigger - Replaces the button used to trigger the column picker.
|
|
1197
|
-
* @slot column-picker-icon - Replaces the icon for the column picker button.
|
|
1198
|
-
* @slot export-button-icon - Replaces the icon for the export button.
|
|
1199
|
-
*
|
|
1200
|
-
* @fires yatl-toolbar-search-input - Fired synchronously as the user types in the search box. Useful for real-time highlighting or suggestions.
|
|
1201
|
-
* @fires yatl-toolbar-search-change - Fired when the user commits a search query (e.g., on 'Enter' or blur). Use this for triggering the actual table filter.
|
|
1202
|
-
* @fires yatl-toolbar-export-click - Fired when the export button is clicked. Payload indicates the requested format.
|
|
1203
|
-
* @fires yatl-column-toggle-request - Fired when a column's visibility is toggled in the dropdown. The consumer must handle this by updating the table state.
|
|
1204
|
-
*
|
|
1205
|
-
*/
|
|
1206
|
-
declare class YatlToolbar<T extends object = UnspecifiedRecord> extends LitElement {
|
|
1207
|
-
static styles: lit.CSSResult[];
|
|
1208
|
-
private _controller?;
|
|
1209
|
-
get controller(): YatlTableController<T> | undefined;
|
|
1210
|
-
set controller(controller: YatlTableController<T> | undefined);
|
|
1211
|
-
showColumnPicker: boolean;
|
|
1212
|
-
showExportButton: boolean;
|
|
1213
|
-
protected render(): lit_html.TemplateResult<1>;
|
|
1214
|
-
protected renderColumnPicker(): lit_html.TemplateResult<1>;
|
|
1215
|
-
protected renderColumnVisibilityToggle(column: DisplayColumnOptions<T>): lit_html.TemplateResult<1>;
|
|
1216
|
-
private handleDropdownToggle;
|
|
1217
|
-
protected renderExportButton(): lit_html.TemplateResult<1>;
|
|
1218
|
-
private onSearchInput;
|
|
1219
|
-
private onSearchChange;
|
|
1220
|
-
private onExportClick;
|
|
1221
|
-
}
|
|
1222
|
-
declare global {
|
|
1223
|
-
interface HTMLElementTagNameMap {
|
|
1224
|
-
'yatl-toolbar': YatlToolbar;
|
|
1225
|
-
}
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1228
1118
|
declare function findColumn<TData extends Record<string, unknown>, TCol extends {
|
|
1229
1119
|
field: NestedKeyOf<TData>;
|
|
1230
1120
|
}>(columns: TCol[], field: NestedKeyOf<TData>): TCol | undefined;
|
|
1231
1121
|
declare function isInternalColumn<T>(col: ColumnOptions<T> | undefined | null): col is InternalColumnOptions<T>;
|
|
1232
1122
|
declare function isDisplayColumn<T>(col: ColumnOptions<T> | undefined | null): col is DisplayColumnOptions<T>;
|
|
1233
1123
|
declare function createState<T>(field: NestedKeyOf<T>, defaults?: Partial<ColumnState<T>>): ColumnState<T>;
|
|
1124
|
+
declare function getColumnStateChanges<T>(oldState: ColumnState<T> | undefined, newState: ColumnState<T>): (keyof ColumnState<T>)[];
|
|
1125
|
+
|
|
1126
|
+
declare function isRowIdType(value: unknown): value is RowId;
|
|
1127
|
+
declare function isRowSelectionMethod(value: string | null): value is RowSelectionMethod;
|
|
1128
|
+
/**
|
|
1129
|
+
* Get a value from an object based on a path.
|
|
1130
|
+
* @param obj - The object to get the value from
|
|
1131
|
+
* @param path - The path of the value
|
|
1132
|
+
* @returns The value found at the given path
|
|
1133
|
+
*/
|
|
1134
|
+
declare function getNestedValue(obj: object, path: string): unknown;
|
|
1135
|
+
declare function setNestedValue(obj: object, path: string, value: unknown): void;
|
|
1234
1136
|
|
|
1235
1137
|
declare const createRegexTokenizer: (exp?: string) => (value: string) => {
|
|
1236
1138
|
value: string;
|
|
@@ -1241,4 +1143,4 @@ declare const whitespaceTokenizer: (value: string) => {
|
|
|
1241
1143
|
quoted: boolean;
|
|
1242
1144
|
}[];
|
|
1243
1145
|
|
|
1244
|
-
export { type BaseColumnOptions, type CellPartsCallback, type CellRenderCallback, type ColumnFilterCallback, type ColumnOptions, type ColumnRole, type ColumnState, type Compareable, type DisplayColumnOptions, type ExportOptions, type FilterCallback, type Filters, type InternalColumnOptions, type NestedKeyOf, type QueryToken, type Renderable, type RestorableColumnState, type RestorableTableState, type RowId, type RowIdCallback, type RowPartsCallback, type RowSelectionMethod, type SortOrder, type SortState, type SortValueCallback, type StorageOptions, type TableControllerOptions, type TableState, type TokenizerCallback, type UnspecifiedRecord, type ValueFormatterCallback,
|
|
1146
|
+
export { type BaseColumnOptions, type CellPartsCallback, type CellRenderCallback, type ColumnFilterCallback, type ColumnOptions, type ColumnRole, type ColumnState, type Compareable, type ControllerEventMap, type DisplayColumnOptions, type ExportOptions, type FilterCallback, type Filters, type InternalColumnOptions, type NestedKeyOf, type QueryToken, type Renderable, type RestorableColumnState, type RestorableTableState, type RowId, type RowIdCallback, type RowPartsCallback, type RowSelectionMethod, type SortOrder, type SortState, type SortValueCallback, type StorageOptions, type TableControllerOptions, type TableState, type TokenizerCallback, TypedEventTarget, type UnspecifiedRecord, type ValueFormatterCallback, YatlColumnReorderEvent, YatlColumnReorderRequest, YatlColumnResizeEvent, YatlColumnSortEvent, YatlColumnSortRequest, YatlColumnToggleEvent, YatlEvent, YatlRowClickEvent, YatlRowSelectEvent, YatlRowSelectRequest, YatlTable, YatlTableController, YatlTableSearchEvent, YatlTableStateChangeEvent, YatlTableViewChangeEvent, createRegexTokenizer, createState, findColumn, getColumnStateChanges, getNestedValue, isDisplayColumn, isInternalColumn, isRowIdType, isRowSelectionMethod, setNestedValue, whitespaceTokenizer };
|