@dereekb/dbx-web 12.2.0 → 12.3.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.
- package/esm2022/table/lib/index.mjs +2 -1
- package/esm2022/table/lib/table.component.mjs +8 -8
- package/esm2022/table/lib/table.item.action.component.mjs +4 -4
- package/esm2022/table/lib/table.item.cell.component.mjs +4 -5
- package/esm2022/table/lib/table.item.directive.mjs +2 -4
- package/esm2022/table/lib/table.item.header.component.mjs +3 -3
- package/esm2022/table/lib/table.reader.mjs +103 -0
- package/fesm2022/dereekb-dbx-web-table.mjs +115 -14
- package/fesm2022/dereekb-dbx-web-table.mjs.map +1 -1
- package/package.json +1 -1
- package/table/lib/index.d.ts +1 -0
- package/table/lib/table.component.d.ts +2 -0
- package/table/lib/table.item.cell.component.d.ts +1 -1
- package/table/lib/table.item.directive.d.ts +1 -1
- package/table/lib/table.reader.d.ts +102 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { PrimativeKey, Maybe, ReadRequiredKeyFunction } from '@dereekb/util';
|
|
3
|
+
import { DbxTableColumn } from './table';
|
|
4
|
+
import { DbxTableStore } from './table.store';
|
|
5
|
+
export interface DbxTableReaderCellPair<C, T> {
|
|
6
|
+
readonly column: DbxTableColumn<C>;
|
|
7
|
+
readonly item: T;
|
|
8
|
+
}
|
|
9
|
+
export interface DbxTableReaderCellDataPair<C, T, O> extends DbxTableReaderCellPair<C, T> {
|
|
10
|
+
readonly value: O;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Key used for tracking columns.
|
|
14
|
+
*
|
|
15
|
+
* Generally the table name is used for this.
|
|
16
|
+
*/
|
|
17
|
+
export type DbxTableReaderColumnKey = string;
|
|
18
|
+
/**
|
|
19
|
+
* Key used for tracking items.
|
|
20
|
+
*
|
|
21
|
+
* Generally the item's unique identifier is used for this.
|
|
22
|
+
*/
|
|
23
|
+
export type DbxTableReaderItemKey = PrimativeKey;
|
|
24
|
+
/**
|
|
25
|
+
* Default track by function for DbxTableColumn.
|
|
26
|
+
*
|
|
27
|
+
* Returns the column name.
|
|
28
|
+
*
|
|
29
|
+
* @param column
|
|
30
|
+
* @returns
|
|
31
|
+
*/
|
|
32
|
+
export declare const DEFAULT_DBX_TABLE_READER_COLUMN_TRACK_BY: ReadRequiredKeyFunction<DbxTableColumn<DbxTableReaderColumnKey>>;
|
|
33
|
+
/**
|
|
34
|
+
* Function used for tracking unique columns using the column's data.
|
|
35
|
+
*
|
|
36
|
+
* If the column key value is the same between those two columns, then the metadata of both columns will be considered the same/equal.
|
|
37
|
+
*/
|
|
38
|
+
export type DbxTableReaderColumnTrackByFunction<C> = ReadRequiredKeyFunction<DbxTableColumn<C>, DbxTableReaderColumnKey>;
|
|
39
|
+
/**
|
|
40
|
+
* Function used for tracking unique columns using the column's data.
|
|
41
|
+
*
|
|
42
|
+
* If the column key value is the same between those two columns, then the metadata of both columns will be considered the same/equal.
|
|
43
|
+
*/
|
|
44
|
+
export type DbxTableReaderItemTrackByFunction<T> = ReadRequiredKeyFunction<T, DbxTableReaderItemKey>;
|
|
45
|
+
export interface DbxTableReaderDelegate<C, T, O> {
|
|
46
|
+
/**
|
|
47
|
+
* Retrieves the data for a specific column and item/row.
|
|
48
|
+
*
|
|
49
|
+
* @param column
|
|
50
|
+
* @param item
|
|
51
|
+
*/
|
|
52
|
+
readItemCellDataForColumn(column: DbxTableColumn<C>, item: T): Observable<O>;
|
|
53
|
+
/**
|
|
54
|
+
* Used for tracking unique columns.
|
|
55
|
+
*
|
|
56
|
+
* Use if the metadata between columns should be used for unique identification.
|
|
57
|
+
*
|
|
58
|
+
* Defaults to using the column name as the key if not defined.
|
|
59
|
+
*/
|
|
60
|
+
trackColumn?: DbxTableReaderColumnTrackByFunction<C>;
|
|
61
|
+
/**
|
|
62
|
+
* Used for tracking unique items/rows.
|
|
63
|
+
*
|
|
64
|
+
* Use if the metadata between items should be used for unique identification.
|
|
65
|
+
*
|
|
66
|
+
* Defaults to using the item itself as the key if not defined.
|
|
67
|
+
*/
|
|
68
|
+
trackItem: DbxTableReaderItemTrackByFunction<T>;
|
|
69
|
+
}
|
|
70
|
+
export interface DbxTableReaderConfig<C, T, O, G = unknown> {
|
|
71
|
+
/**
|
|
72
|
+
* Delegate used for retrieving the data for a specific column and item/row.
|
|
73
|
+
*/
|
|
74
|
+
readonly delegate: DbxTableReaderDelegate<C, T, O>;
|
|
75
|
+
/**
|
|
76
|
+
* The table store used for retrieving the items.
|
|
77
|
+
*/
|
|
78
|
+
readonly tableStore: DbxTableStore<unknown, C, T, G>;
|
|
79
|
+
}
|
|
80
|
+
export interface DbxTableReader<C, T, O, G = unknown> extends DbxTableReaderConfig<C, T, O, G> {
|
|
81
|
+
/**
|
|
82
|
+
* Retrieves all cell data pairs for a specific column.
|
|
83
|
+
*/
|
|
84
|
+
cellDataPairsForColumn(column: DbxTableColumn<C>): Observable<DbxTableReaderCellDataPair<C, T, O>[]>;
|
|
85
|
+
/**
|
|
86
|
+
* Retrieves all cell data for a specific column.
|
|
87
|
+
*/
|
|
88
|
+
cellDataForColumn(column: DbxTableColumn<C>): Observable<O[]>;
|
|
89
|
+
/**
|
|
90
|
+
* Retrieves the cell data pair for a specific column and item.
|
|
91
|
+
*
|
|
92
|
+
* Returns null if the column is not visible or the item is not found.
|
|
93
|
+
*/
|
|
94
|
+
cellDataPairForColumnAndItem(column: DbxTableColumn<C>, item: T): Observable<Maybe<DbxTableReaderCellDataPair<C, T, O>>>;
|
|
95
|
+
/**
|
|
96
|
+
* Retrieves the cell data for a specific column and item.
|
|
97
|
+
*
|
|
98
|
+
* Returns null if the column is not visible or the item is not found.
|
|
99
|
+
*/
|
|
100
|
+
cellDataForColumnAndItem(column: DbxTableColumn<C>, item: T): Observable<Maybe<O>>;
|
|
101
|
+
}
|
|
102
|
+
export declare function dbxTableReader<C, T, O, G = unknown>(config: DbxTableReaderConfig<C, T, O, G>): DbxTableReader<C, T, O, G>;
|