@timlassiter11/yatl 1.0.0 → 1.0.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 +52 -20
- package/dist/index.d.ts +52 -20
- package/dist/index.js +212 -146
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +211 -146
- package/dist/index.mjs.map +1 -1
- package/dist/yatl.min.global.js +40 -40
- package/dist/yatl.min.global.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -199,11 +199,11 @@ interface ColumnState<T> {
|
|
|
199
199
|
/**
|
|
200
200
|
* The current sort order of the column.
|
|
201
201
|
*/
|
|
202
|
-
|
|
202
|
+
sort: SortState | null;
|
|
203
203
|
/**
|
|
204
204
|
* The currently set width of the column in pixels.
|
|
205
205
|
*/
|
|
206
|
-
width
|
|
206
|
+
width: number | null;
|
|
207
207
|
}
|
|
208
208
|
/**
|
|
209
209
|
* Represents the current state of the table
|
|
@@ -306,6 +306,14 @@ declare class YatlSearchEvent extends YatlEvent<{
|
|
|
306
306
|
static readonly EVENT_NAME = "yatl-search";
|
|
307
307
|
constructor(query: string);
|
|
308
308
|
}
|
|
309
|
+
declare class YatlStateChangeEvent<T> extends YatlEvent<{
|
|
310
|
+
state: TableState<T>;
|
|
311
|
+
triggers: string[];
|
|
312
|
+
}> {
|
|
313
|
+
triggers: string[];
|
|
314
|
+
static readonly EVENT_NAME = "yatl-state-change";
|
|
315
|
+
constructor(state: TableState<T>, triggers: string[]);
|
|
316
|
+
}
|
|
309
317
|
|
|
310
318
|
/**
|
|
311
319
|
* Represents a dynamic and interactive table with features like sorting, searching, filtering,
|
|
@@ -319,6 +327,7 @@ declare class YatlTable<T extends object> extends LitElement {
|
|
|
319
327
|
private _enableSearchScoring;
|
|
320
328
|
private _columns;
|
|
321
329
|
private _columnStates;
|
|
330
|
+
private _columnOrder;
|
|
322
331
|
private _storageOptions;
|
|
323
332
|
private _data;
|
|
324
333
|
private _searchQuery;
|
|
@@ -399,12 +408,32 @@ declare class YatlTable<T extends object> extends LitElement {
|
|
|
399
408
|
*/
|
|
400
409
|
get columns(): ColumnOptions<T>[];
|
|
401
410
|
set columns(columns: ColumnOptions<T>[]);
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
411
|
+
get columnOrder(): NestedKeyOf<T>[];
|
|
412
|
+
set columnOrder(columns: NestedKeyOf<T>[]);
|
|
413
|
+
get columnVisibility(): {
|
|
414
|
+
field: NestedKeyOf<T>;
|
|
415
|
+
visible: boolean;
|
|
416
|
+
}[];
|
|
417
|
+
set columnVisibility(columns: {
|
|
418
|
+
field: NestedKeyOf<T>;
|
|
419
|
+
visible: boolean;
|
|
420
|
+
}[]);
|
|
421
|
+
get columnSort(): {
|
|
422
|
+
field: NestedKeyOf<T>;
|
|
423
|
+
sort: SortState | null;
|
|
424
|
+
}[];
|
|
425
|
+
set columnSort(columns: {
|
|
426
|
+
field: NestedKeyOf<T>;
|
|
427
|
+
sort: SortState | null;
|
|
428
|
+
}[]);
|
|
429
|
+
get columnWidths(): {
|
|
430
|
+
field: NestedKeyOf<T>;
|
|
431
|
+
width: number | null;
|
|
432
|
+
}[];
|
|
433
|
+
set columnWidths(columns: {
|
|
434
|
+
field: NestedKeyOf<T>;
|
|
435
|
+
width: number | null;
|
|
436
|
+
}[]);
|
|
408
437
|
/**
|
|
409
438
|
* The current text string used to filter the table data.
|
|
410
439
|
* Setting this property triggers a new search and render cycle.
|
|
@@ -510,13 +539,6 @@ declare class YatlTable<T extends object> extends LitElement {
|
|
|
510
539
|
scrollToOriginalIndex(index: number): Promise<void>;
|
|
511
540
|
scrollToFilteredIndex(index: number): Promise<void>;
|
|
512
541
|
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
542
|
/**
|
|
521
543
|
* Finds the first row
|
|
522
544
|
* @param field
|
|
@@ -560,10 +582,10 @@ declare class YatlTable<T extends object> extends LitElement {
|
|
|
560
582
|
deleteRow(index: number): void;
|
|
561
583
|
protected renderColumnSortIcon(column: ColumnOptions<T>, state: ColumnState<T>): TemplateResult<1> | typeof nothing;
|
|
562
584
|
protected renderColumnResizer(column: ColumnOptions<T>, _state: ColumnState<T>): TemplateResult<1> | typeof nothing;
|
|
563
|
-
protected renderHeaderCell(
|
|
585
|
+
protected renderHeaderCell(field: NestedKeyOf<T>): TemplateResult<1> | typeof nothing;
|
|
564
586
|
protected renderHeader(): TemplateResult<1>;
|
|
565
587
|
protected renderCellContents(value: unknown, column: ColumnOptions<T>, row: T): unknown;
|
|
566
|
-
protected renderCell(
|
|
588
|
+
protected renderCell(field: NestedKeyOf<T>, row: T): TemplateResult<1> | typeof nothing;
|
|
567
589
|
protected renderRow(row: T, index: number): TemplateResult<1>;
|
|
568
590
|
protected renderBody(): TemplateResult<1>;
|
|
569
591
|
protected renderFooter(): TemplateResult<1> | typeof nothing;
|
|
@@ -592,12 +614,16 @@ declare class YatlTable<T extends object> extends LitElement {
|
|
|
592
614
|
private filterRows;
|
|
593
615
|
private compareRows;
|
|
594
616
|
private sortRows;
|
|
595
|
-
private createColumnStates;
|
|
596
617
|
private createMetadata;
|
|
597
618
|
private updateInternalQuery;
|
|
598
619
|
private get columnData();
|
|
599
|
-
|
|
620
|
+
/**
|
|
621
|
+
* Gets the width of each column in the
|
|
622
|
+
* order they will appear in the grid.
|
|
623
|
+
*/
|
|
624
|
+
private getGridWidths;
|
|
600
625
|
private scheduleSave;
|
|
626
|
+
private getColumnState;
|
|
601
627
|
private saveStateToStorage;
|
|
602
628
|
private loadStateFromStorage;
|
|
603
629
|
private handleHeaderClicked;
|
|
@@ -627,6 +653,12 @@ interface EventMap<T> {
|
|
|
627
653
|
'yatl-column-resize': YatlColumnResizeEvent<T>;
|
|
628
654
|
'yatl-column-reorder': YatlColumnReorderEvent<T>;
|
|
629
655
|
'yatl-search': YatlSearchEvent;
|
|
656
|
+
'yatl-state-change': YatlStateChangeEvent<T>;
|
|
657
|
+
}
|
|
658
|
+
declare global {
|
|
659
|
+
interface HTMLElementTagNameMap {
|
|
660
|
+
'yatl-table': YatlTable<object>;
|
|
661
|
+
}
|
|
630
662
|
}
|
|
631
663
|
|
|
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 };
|
|
664
|
+
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, YatlStateChangeEvent, YatlTable, createRegexTokenizer, findColumn, whitespaceTokenizer };
|
package/dist/index.d.ts
CHANGED
|
@@ -199,11 +199,11 @@ interface ColumnState<T> {
|
|
|
199
199
|
/**
|
|
200
200
|
* The current sort order of the column.
|
|
201
201
|
*/
|
|
202
|
-
|
|
202
|
+
sort: SortState | null;
|
|
203
203
|
/**
|
|
204
204
|
* The currently set width of the column in pixels.
|
|
205
205
|
*/
|
|
206
|
-
width
|
|
206
|
+
width: number | null;
|
|
207
207
|
}
|
|
208
208
|
/**
|
|
209
209
|
* Represents the current state of the table
|
|
@@ -306,6 +306,14 @@ declare class YatlSearchEvent extends YatlEvent<{
|
|
|
306
306
|
static readonly EVENT_NAME = "yatl-search";
|
|
307
307
|
constructor(query: string);
|
|
308
308
|
}
|
|
309
|
+
declare class YatlStateChangeEvent<T> extends YatlEvent<{
|
|
310
|
+
state: TableState<T>;
|
|
311
|
+
triggers: string[];
|
|
312
|
+
}> {
|
|
313
|
+
triggers: string[];
|
|
314
|
+
static readonly EVENT_NAME = "yatl-state-change";
|
|
315
|
+
constructor(state: TableState<T>, triggers: string[]);
|
|
316
|
+
}
|
|
309
317
|
|
|
310
318
|
/**
|
|
311
319
|
* Represents a dynamic and interactive table with features like sorting, searching, filtering,
|
|
@@ -319,6 +327,7 @@ declare class YatlTable<T extends object> extends LitElement {
|
|
|
319
327
|
private _enableSearchScoring;
|
|
320
328
|
private _columns;
|
|
321
329
|
private _columnStates;
|
|
330
|
+
private _columnOrder;
|
|
322
331
|
private _storageOptions;
|
|
323
332
|
private _data;
|
|
324
333
|
private _searchQuery;
|
|
@@ -399,12 +408,32 @@ declare class YatlTable<T extends object> extends LitElement {
|
|
|
399
408
|
*/
|
|
400
409
|
get columns(): ColumnOptions<T>[];
|
|
401
410
|
set columns(columns: ColumnOptions<T>[]);
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
411
|
+
get columnOrder(): NestedKeyOf<T>[];
|
|
412
|
+
set columnOrder(columns: NestedKeyOf<T>[]);
|
|
413
|
+
get columnVisibility(): {
|
|
414
|
+
field: NestedKeyOf<T>;
|
|
415
|
+
visible: boolean;
|
|
416
|
+
}[];
|
|
417
|
+
set columnVisibility(columns: {
|
|
418
|
+
field: NestedKeyOf<T>;
|
|
419
|
+
visible: boolean;
|
|
420
|
+
}[]);
|
|
421
|
+
get columnSort(): {
|
|
422
|
+
field: NestedKeyOf<T>;
|
|
423
|
+
sort: SortState | null;
|
|
424
|
+
}[];
|
|
425
|
+
set columnSort(columns: {
|
|
426
|
+
field: NestedKeyOf<T>;
|
|
427
|
+
sort: SortState | null;
|
|
428
|
+
}[]);
|
|
429
|
+
get columnWidths(): {
|
|
430
|
+
field: NestedKeyOf<T>;
|
|
431
|
+
width: number | null;
|
|
432
|
+
}[];
|
|
433
|
+
set columnWidths(columns: {
|
|
434
|
+
field: NestedKeyOf<T>;
|
|
435
|
+
width: number | null;
|
|
436
|
+
}[]);
|
|
408
437
|
/**
|
|
409
438
|
* The current text string used to filter the table data.
|
|
410
439
|
* Setting this property triggers a new search and render cycle.
|
|
@@ -510,13 +539,6 @@ declare class YatlTable<T extends object> extends LitElement {
|
|
|
510
539
|
scrollToOriginalIndex(index: number): Promise<void>;
|
|
511
540
|
scrollToFilteredIndex(index: number): Promise<void>;
|
|
512
541
|
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
542
|
/**
|
|
521
543
|
* Finds the first row
|
|
522
544
|
* @param field
|
|
@@ -560,10 +582,10 @@ declare class YatlTable<T extends object> extends LitElement {
|
|
|
560
582
|
deleteRow(index: number): void;
|
|
561
583
|
protected renderColumnSortIcon(column: ColumnOptions<T>, state: ColumnState<T>): TemplateResult<1> | typeof nothing;
|
|
562
584
|
protected renderColumnResizer(column: ColumnOptions<T>, _state: ColumnState<T>): TemplateResult<1> | typeof nothing;
|
|
563
|
-
protected renderHeaderCell(
|
|
585
|
+
protected renderHeaderCell(field: NestedKeyOf<T>): TemplateResult<1> | typeof nothing;
|
|
564
586
|
protected renderHeader(): TemplateResult<1>;
|
|
565
587
|
protected renderCellContents(value: unknown, column: ColumnOptions<T>, row: T): unknown;
|
|
566
|
-
protected renderCell(
|
|
588
|
+
protected renderCell(field: NestedKeyOf<T>, row: T): TemplateResult<1> | typeof nothing;
|
|
567
589
|
protected renderRow(row: T, index: number): TemplateResult<1>;
|
|
568
590
|
protected renderBody(): TemplateResult<1>;
|
|
569
591
|
protected renderFooter(): TemplateResult<1> | typeof nothing;
|
|
@@ -592,12 +614,16 @@ declare class YatlTable<T extends object> extends LitElement {
|
|
|
592
614
|
private filterRows;
|
|
593
615
|
private compareRows;
|
|
594
616
|
private sortRows;
|
|
595
|
-
private createColumnStates;
|
|
596
617
|
private createMetadata;
|
|
597
618
|
private updateInternalQuery;
|
|
598
619
|
private get columnData();
|
|
599
|
-
|
|
620
|
+
/**
|
|
621
|
+
* Gets the width of each column in the
|
|
622
|
+
* order they will appear in the grid.
|
|
623
|
+
*/
|
|
624
|
+
private getGridWidths;
|
|
600
625
|
private scheduleSave;
|
|
626
|
+
private getColumnState;
|
|
601
627
|
private saveStateToStorage;
|
|
602
628
|
private loadStateFromStorage;
|
|
603
629
|
private handleHeaderClicked;
|
|
@@ -627,6 +653,12 @@ interface EventMap<T> {
|
|
|
627
653
|
'yatl-column-resize': YatlColumnResizeEvent<T>;
|
|
628
654
|
'yatl-column-reorder': YatlColumnReorderEvent<T>;
|
|
629
655
|
'yatl-search': YatlSearchEvent;
|
|
656
|
+
'yatl-state-change': YatlStateChangeEvent<T>;
|
|
657
|
+
}
|
|
658
|
+
declare global {
|
|
659
|
+
interface HTMLElementTagNameMap {
|
|
660
|
+
'yatl-table': YatlTable<object>;
|
|
661
|
+
}
|
|
630
662
|
}
|
|
631
663
|
|
|
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 };
|
|
664
|
+
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, YatlStateChangeEvent, YatlTable, createRegexTokenizer, findColumn, whitespaceTokenizer };
|