@vuu-ui/vuu-data-local 3.3.9 → 3.3.10
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/package.json +7 -7
- package/types/src/array-data-source/aggregate-utils.d.ts +8 -0
- package/types/src/array-data-source/array-data-source.d.ts +111 -0
- package/types/src/array-data-source/array-data-utils.d.ts +4 -0
- package/types/src/array-data-source/group-utils.d.ts +10 -0
- package/types/src/array-data-source/sort-utils.d.ts +10 -0
- package/types/src/index.d.ts +3 -0
- package/types/src/json-data-source/JsonDataSource.d.ts +55 -0
- package/types/src/tree-data-source/IconProvider.d.ts +6 -0
- package/types/src/tree-data-source/TreeDataSource.d.ts +51 -0
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "3.3.
|
|
2
|
+
"version": "3.3.10",
|
|
3
3
|
"main": "./src/index.js",
|
|
4
4
|
"author": "heswell",
|
|
5
5
|
"license": "Apache-2.0",
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
"type-defs": "node ../../scripts/build-type-defs.mjs"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@vuu-ui/vuu-data-types": "3.3.
|
|
14
|
-
"@vuu-ui/vuu-table-types": "3.3.
|
|
15
|
-
"@vuu-ui/vuu-filter-types": "3.3.
|
|
16
|
-
"@vuu-ui/vuu-protocol-types": "3.3.
|
|
13
|
+
"@vuu-ui/vuu-data-types": "3.3.10",
|
|
14
|
+
"@vuu-ui/vuu-table-types": "3.3.10",
|
|
15
|
+
"@vuu-ui/vuu-filter-types": "3.3.10",
|
|
16
|
+
"@vuu-ui/vuu-protocol-types": "3.3.10"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@vuu-ui/vuu-filter-parser": "3.3.
|
|
20
|
-
"@vuu-ui/vuu-utils": "3.3.
|
|
19
|
+
"@vuu-ui/vuu-filter-parser": "3.3.10",
|
|
20
|
+
"@vuu-ui/vuu-utils": "3.3.10"
|
|
21
21
|
},
|
|
22
22
|
"sideEffects": false,
|
|
23
23
|
"files": [
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DataSourceRowWithBigint } from "@vuu-ui/vuu-data-types";
|
|
2
|
+
import type { VuuAggregation, VuuGroupBy } from "@vuu-ui/vuu-protocol-types";
|
|
3
|
+
import type { ColumnMap } from "@vuu-ui/vuu-utils";
|
|
4
|
+
import type { GroupMap } from "./group-utils";
|
|
5
|
+
export declare const count: (arr: unknown[]) => number;
|
|
6
|
+
export declare const aggregateData: (aggregations: VuuAggregation[], targetData: readonly DataSourceRowWithBigint[], groupBy: VuuGroupBy, leafData: readonly DataSourceRowWithBigint[], columnMap: ColumnMap, groupMap: GroupMap) => {
|
|
7
|
+
[key: string]: number;
|
|
8
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type { DataSourceBase, DataSourceConstructorProps, DataSourceEvents, DataSourceFilter, DataSourceRow, DataSourceRowWithBigint, DataSourceStatus, DataSourceSubscribeCallback, DataSourceSubscribeProps, TableSchema, WithBaseFilter, WithFullConfig } from "@vuu-ui/vuu-data-types";
|
|
2
|
+
import type { Filter } from "@vuu-ui/vuu-filter-types";
|
|
3
|
+
import type { LinkDescriptorWithLabel, SelectRequest, VuuAggregation, VuuGroupBy, VuuMenu, VuuRowDataItemType, VuuRpcRequest, VuuRpcResponse, VuuSort } from "@vuu-ui/vuu-protocol-types";
|
|
4
|
+
import type { ColumnDescriptor } from "@vuu-ui/vuu-table-types";
|
|
5
|
+
import { type ColumnMap, EventEmitter, Range } from "@vuu-ui/vuu-utils";
|
|
6
|
+
export interface ArrayDataSourceConstructorProps extends Omit<DataSourceConstructorProps, "bufferSize" | "table"> {
|
|
7
|
+
columnDescriptors: readonly ColumnDescriptor[];
|
|
8
|
+
data: Array<Array<bigint | VuuRowDataItemType>>;
|
|
9
|
+
dataMap?: ColumnMap;
|
|
10
|
+
keyColumn?: string;
|
|
11
|
+
rangeChangeRowset?: "delta" | "full";
|
|
12
|
+
}
|
|
13
|
+
export declare class ArrayDataSource extends EventEmitter<DataSourceEvents> implements DataSourceBase<DataSourceRowWithBigint> {
|
|
14
|
+
#private;
|
|
15
|
+
protected clientCallback: DataSourceSubscribeCallback | undefined;
|
|
16
|
+
protected columnDescriptors: readonly ColumnDescriptor[];
|
|
17
|
+
/** sorted offsets of data within raw data, reflecting sort order
|
|
18
|
+
* of columns specified by client.
|
|
19
|
+
*/
|
|
20
|
+
private dataIndices;
|
|
21
|
+
/** Map reflecting positions of data items in raw data */
|
|
22
|
+
private dataMap;
|
|
23
|
+
private groupMap;
|
|
24
|
+
/** the index of key field within raw data row */
|
|
25
|
+
private key;
|
|
26
|
+
private lastRangeServed;
|
|
27
|
+
private rangeChangeRowset;
|
|
28
|
+
private openTreeNodes;
|
|
29
|
+
private preserveScrollPositionAcrossConfigChange;
|
|
30
|
+
protected _config: WithBaseFilter<WithFullConfig> & {
|
|
31
|
+
visualLink?: LinkDescriptorWithLabel;
|
|
32
|
+
};
|
|
33
|
+
protected _menu: VuuMenu | undefined;
|
|
34
|
+
protected selectedRows: Set<string>;
|
|
35
|
+
protected index: Map<string, number>;
|
|
36
|
+
tableSchema: TableSchema;
|
|
37
|
+
viewport: string;
|
|
38
|
+
protected processedData: DataSourceRowWithBigint[] | undefined;
|
|
39
|
+
constructor({ aggregations, baseFilterSpec, columnDescriptors, data, dataMap, filterSpec, groupBy, keyColumn, rangeChangeRowset, sort, title, viewport, }: ArrayDataSourceConstructorProps);
|
|
40
|
+
subscribe({ viewport, columns, aggregations, baseFilterSpec, range, sort, groupBy, filterSpec, }: DataSourceSubscribeProps, callback: DataSourceSubscribeCallback): Promise<void>;
|
|
41
|
+
unsubscribe(): void;
|
|
42
|
+
suspend(): void;
|
|
43
|
+
resume(callback?: DataSourceSubscribeCallback): void;
|
|
44
|
+
disable(): void;
|
|
45
|
+
enable(): void;
|
|
46
|
+
select(selectRequest: Omit<SelectRequest, "vpId">): void;
|
|
47
|
+
private getRowKey;
|
|
48
|
+
openTreeNode(keyOrIndex: string | number): void;
|
|
49
|
+
closeTreeNode(keyOrIndex: string | number): void;
|
|
50
|
+
get pageSize(): number;
|
|
51
|
+
get links(): LinkDescriptorWithLabel[] | undefined;
|
|
52
|
+
set links(links: LinkDescriptorWithLabel[] | undefined);
|
|
53
|
+
get menu(): VuuMenu | undefined;
|
|
54
|
+
get status(): DataSourceStatus;
|
|
55
|
+
get data(): DataSourceRow<bigint | VuuRowDataItemType>[];
|
|
56
|
+
get currentData(): DataSourceRow<bigint | VuuRowDataItemType>[];
|
|
57
|
+
get table(): import("@vuu-ui/vuu-data-types").TableSchemaTable;
|
|
58
|
+
get columns(): string[];
|
|
59
|
+
set columns(columns: string[]);
|
|
60
|
+
get config(): WithBaseFilter<WithFullConfig>;
|
|
61
|
+
set config(config: WithBaseFilter<WithFullConfig>);
|
|
62
|
+
private processNewColumns;
|
|
63
|
+
private indexProcessedData;
|
|
64
|
+
private getFilterPredicate;
|
|
65
|
+
private applyConfig;
|
|
66
|
+
get columnMap(): ColumnMap;
|
|
67
|
+
get selectedRowsCount(): number;
|
|
68
|
+
get size(): number;
|
|
69
|
+
get maxRangeEnd(): number;
|
|
70
|
+
get range(): Range;
|
|
71
|
+
set range(range: Range);
|
|
72
|
+
protected delete(row: VuuRowDataItemType[]): void;
|
|
73
|
+
protected insert: (row: Array<bigint | VuuRowDataItemType>) => void;
|
|
74
|
+
private insertIntoSortedData;
|
|
75
|
+
private validateDataValue;
|
|
76
|
+
protected updateDataItem: (keyValue: string, columnName: string, value: VuuRowDataItemType) => void;
|
|
77
|
+
getRowByKey(key: string): DataSourceRow<bigint | VuuRowDataItemType> | undefined;
|
|
78
|
+
getRowAtIndex(rowIndex: number): DataSourceRow<bigint | VuuRowDataItemType>;
|
|
79
|
+
indexOfRowWithKey: (key: string) => number;
|
|
80
|
+
protected update: (row: VuuRowDataItemType[], columnName: string) => void;
|
|
81
|
+
protected updateRow: (row: Array<bigint | VuuRowDataItemType>, _columnName?: string) => void;
|
|
82
|
+
protected handleDeleteFromTable: (key: string) => Promise<true | string>;
|
|
83
|
+
private setRange;
|
|
84
|
+
private constrainRangeToMaxRangeEnd;
|
|
85
|
+
private get rangeWithBufferWithinMaxRangeEnd();
|
|
86
|
+
sendSizeUpdateToClient(): void;
|
|
87
|
+
sendRowsToClient(forceFullRefresh?: boolean, row?: DataSourceRowWithBigint): void;
|
|
88
|
+
get aggregations(): VuuAggregation[];
|
|
89
|
+
set aggregations(aggregations: VuuAggregation[]);
|
|
90
|
+
get sort(): VuuSort;
|
|
91
|
+
set sort(sort: VuuSort);
|
|
92
|
+
get baseFilter(): DataSourceFilter | undefined;
|
|
93
|
+
set baseFilter(baseFilter: DataSourceFilter | undefined);
|
|
94
|
+
get filter(): DataSourceFilter;
|
|
95
|
+
set filter(filter: DataSourceFilter);
|
|
96
|
+
setFilter(filter: Filter): void;
|
|
97
|
+
clearFilter(): void;
|
|
98
|
+
get groupBy(): VuuGroupBy;
|
|
99
|
+
set groupBy(groupBy: VuuGroupBy);
|
|
100
|
+
get title(): string;
|
|
101
|
+
set title(title: string);
|
|
102
|
+
get _clientCallback(): DataSourceSubscribeCallback | undefined;
|
|
103
|
+
createLink({ parentVpId, link: { fromColumn, toColumn }, }: LinkDescriptorWithLabel): void;
|
|
104
|
+
removeLink(): void;
|
|
105
|
+
remoteProcedureCall<T extends VuuRpcResponse = VuuRpcResponse>(): Promise<T>;
|
|
106
|
+
menuRpcCall(rpcRequest: Omit<VuuRpcRequest, "vpId">): Promise<VuuRpcResponse>;
|
|
107
|
+
freeze(): void;
|
|
108
|
+
unfreeze(): void;
|
|
109
|
+
get freezeTimestamp(): number | undefined;
|
|
110
|
+
get isFrozen(): boolean;
|
|
111
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DataSourceRow, DataSourceRowWithBigint } from "@vuu-ui/vuu-data-types";
|
|
2
|
+
import { ColumnMap, KeySet } from "@vuu-ui/vuu-utils";
|
|
3
|
+
export declare const toClientRow: (row: DataSourceRowWithBigint, keys: KeySet, selectedRows: Set<string>, dataIndices?: number[]) => DataSourceRow;
|
|
4
|
+
export declare const buildDataToClientMap: (columnMap: ColumnMap, dataMap?: ColumnMap) => number[] | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DataSourceRow } from "@vuu-ui/vuu-data-types";
|
|
2
|
+
import type { VuuGroupBy, VuuRowDataItemType } from "@vuu-ui/vuu-protocol-types";
|
|
3
|
+
import { ColumnMap } from "@vuu-ui/vuu-utils";
|
|
4
|
+
export type KeyList = number[];
|
|
5
|
+
export type GroupMap = {
|
|
6
|
+
[key: string]: GroupMap | KeyList;
|
|
7
|
+
};
|
|
8
|
+
export declare const collapseGroup: (key: string, groupedRows: readonly DataSourceRow<bigint | VuuRowDataItemType>[]) => DataSourceRow<bigint | VuuRowDataItemType>[];
|
|
9
|
+
export declare const expandGroup: (keys: string[], sourceRows: readonly DataSourceRow<bigint | VuuRowDataItemType>[], groupBy: VuuGroupBy, columnMap: ColumnMap, groupMap: GroupMap, processedData: readonly DataSourceRow[]) => DataSourceRow[];
|
|
10
|
+
export declare const groupRows: (rows: ReadonlyArray<Array<bigint | VuuRowDataItemType>>, groupBy: VuuGroupBy, columnMap: ColumnMap) => [DataSourceRow[], GroupMap];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DataSourceRowWithBigint } from "@vuu-ui/vuu-data-types";
|
|
2
|
+
import type { VuuSort, VuuSortType } from "@vuu-ui/vuu-protocol-types";
|
|
3
|
+
import { ColumnMap } from "@vuu-ui/vuu-utils";
|
|
4
|
+
export type ColIndexSortDef = [number, VuuSortType];
|
|
5
|
+
type SortCompareResult = 0 | 1 | -1;
|
|
6
|
+
export type RowSortComparator = (item1: DataSourceRowWithBigint, item2: DataSourceRowWithBigint) => SortCompareResult;
|
|
7
|
+
export declare const sortComparator: (sortDefs: ColIndexSortDef[]) => RowSortComparator;
|
|
8
|
+
export declare const sortRows: (rows: readonly DataSourceRowWithBigint[], { sortDefs }: VuuSort, columnMap: ColumnMap) => DataSourceRowWithBigint[];
|
|
9
|
+
export declare function binarySearch(items: DataSourceRowWithBigint[], item: DataSourceRowWithBigint, comparator: RowSortComparator): number;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { ColumnDescriptor } from "@vuu-ui/vuu-table-types";
|
|
2
|
+
import type { LinkDescriptorWithLabel, VuuGroupBy, VuuAggregation, VuuSort, VuuRpcResponse, VuuRpcRequest, SelectRequest } from "@vuu-ui/vuu-protocol-types";
|
|
3
|
+
import type { DataSourceFilter, DataSourceRow, DataSourceConstructorProps, DataSourceEvents, DataSourceStatus, DataSourceSubscribeCallback, DataSourceSubscribeProps, WithFullConfig, MenuRpcResponse, DataSourceBase } from "@vuu-ui/vuu-data-types";
|
|
4
|
+
import { EventEmitter, JsonData, Range } from "@vuu-ui/vuu-utils";
|
|
5
|
+
export interface JsonDataSourceConstructorProps extends Omit<DataSourceConstructorProps, "bufferSize" | "table"> {
|
|
6
|
+
data: JsonData;
|
|
7
|
+
}
|
|
8
|
+
export declare class JsonDataSource extends EventEmitter<DataSourceEvents> implements DataSourceBase {
|
|
9
|
+
#private;
|
|
10
|
+
columnDescriptors: ColumnDescriptor[];
|
|
11
|
+
private clientCallback;
|
|
12
|
+
private expandedRows;
|
|
13
|
+
private visibleRows;
|
|
14
|
+
rowCount: number | undefined;
|
|
15
|
+
viewport: string;
|
|
16
|
+
private keys;
|
|
17
|
+
constructor({ aggregations, data, filterSpec, groupBy, sort, title, viewport, }: JsonDataSourceConstructorProps);
|
|
18
|
+
subscribe({ viewport, columns, aggregations, range, sort, groupBy, filterSpec, }: DataSourceSubscribeProps, callback: DataSourceSubscribeCallback): Promise<void>;
|
|
19
|
+
unsubscribe(): void;
|
|
20
|
+
suspend(): this;
|
|
21
|
+
resume(): this;
|
|
22
|
+
disable(): this;
|
|
23
|
+
enable(): this;
|
|
24
|
+
set data(data: JsonData);
|
|
25
|
+
select(selectRequest: Omit<SelectRequest, "vpId">): void;
|
|
26
|
+
private getRowKey;
|
|
27
|
+
openTreeNode(keyOrIndex: string | number): void;
|
|
28
|
+
closeTreeNode(keyOrIndex: string | number, cascade?: boolean): void;
|
|
29
|
+
get status(): DataSourceStatus;
|
|
30
|
+
get config(): WithFullConfig;
|
|
31
|
+
applyConfig(): import("@vuu-ui/vuu-utils").MaybeDataSourceConfigChanges;
|
|
32
|
+
get selectedRowsCount(): number;
|
|
33
|
+
get size(): number;
|
|
34
|
+
get range(): Range;
|
|
35
|
+
set range(range: Range);
|
|
36
|
+
private sendRowsToClient;
|
|
37
|
+
get columns(): string[];
|
|
38
|
+
set columns(columns: string[]);
|
|
39
|
+
get aggregations(): VuuAggregation[];
|
|
40
|
+
set aggregations(aggregations: VuuAggregation[]);
|
|
41
|
+
get sort(): VuuSort;
|
|
42
|
+
set sort(sort: VuuSort);
|
|
43
|
+
get filter(): DataSourceFilter;
|
|
44
|
+
set filter(filter: DataSourceFilter);
|
|
45
|
+
get groupBy(): VuuGroupBy;
|
|
46
|
+
set groupBy(groupBy: VuuGroupBy);
|
|
47
|
+
get title(): string;
|
|
48
|
+
set title(title: string);
|
|
49
|
+
createLink({ parentVpId, link: { fromColumn, toColumn }, }: LinkDescriptorWithLabel): void;
|
|
50
|
+
removeLink(): void;
|
|
51
|
+
remoteProcedureCall<T extends VuuRpcResponse = VuuRpcResponse>(): Promise<T>;
|
|
52
|
+
menuRpcCall(rpcRequest: Omit<VuuRpcRequest, "vpId">): Promise<MenuRpcResponse | undefined>;
|
|
53
|
+
getChildRows(rowKey: string): DataSourceRow[];
|
|
54
|
+
getRowsAtDepth(depth: number, visibleOnly?: boolean): DataSourceRow[];
|
|
55
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ColumnDescriptor } from "@vuu-ui/vuu-table-types";
|
|
2
|
+
import type { LinkDescriptorWithLabel, VuuRange, VuuRpcResponse, VuuRpcRequest, SelectRequest } from "@vuu-ui/vuu-protocol-types";
|
|
3
|
+
import type { DataSourceRow, DataSourceConstructorProps, DataSourceStatus, DataSourceSubscribeCallback, DataSourceSubscribeProps, MenuRpcResponse, DataSourceFilter, DataSourceBase } from "@vuu-ui/vuu-data-types";
|
|
4
|
+
import { BaseDataSource, TreeSourceNode } from "@vuu-ui/vuu-utils";
|
|
5
|
+
export interface TreeDataSourceConstructorProps extends Omit<DataSourceConstructorProps, "bufferSize" | "table"> {
|
|
6
|
+
data: TreeSourceNode[];
|
|
7
|
+
}
|
|
8
|
+
export declare class TreeDataSource extends BaseDataSource implements DataSourceBase {
|
|
9
|
+
#private;
|
|
10
|
+
columnDescriptors: ColumnDescriptor[];
|
|
11
|
+
private clientCallback;
|
|
12
|
+
private expandedRows;
|
|
13
|
+
private visibleRows;
|
|
14
|
+
private visibleRowIndex;
|
|
15
|
+
rowCount: number | undefined;
|
|
16
|
+
private keys;
|
|
17
|
+
constructor({ data, ...props }: TreeDataSourceConstructorProps);
|
|
18
|
+
subscribe({ aggregations, columns, range, revealSelected, selectedKeyValues, viewport, }: DataSourceSubscribeProps, callback: DataSourceSubscribeCallback): Promise<void>;
|
|
19
|
+
unsubscribe(): void;
|
|
20
|
+
suspend(): this;
|
|
21
|
+
resume(): this;
|
|
22
|
+
disable(): this;
|
|
23
|
+
enable(): this;
|
|
24
|
+
set data(data: TreeSourceNode[]);
|
|
25
|
+
get filter(): DataSourceFilter;
|
|
26
|
+
set filter(filter: DataSourceFilter);
|
|
27
|
+
private applyFilter;
|
|
28
|
+
/**
|
|
29
|
+
* used to apply an initial selection. These may not necessarily be
|
|
30
|
+
* visible. If revealOnSelect is in force, expand nodes as necessary
|
|
31
|
+
* to ensure selected nodes are visible
|
|
32
|
+
*/
|
|
33
|
+
private applySelectedKeyValues;
|
|
34
|
+
private indexOfRowWithKey;
|
|
35
|
+
select(selectRequest: Omit<SelectRequest, "vpId">): void;
|
|
36
|
+
private getRowKey;
|
|
37
|
+
openTreeNode(keyOrIndex: string | number): void;
|
|
38
|
+
closeTreeNode(keyOrIndex: string | number, cascade?: boolean): void;
|
|
39
|
+
get status(): DataSourceStatus;
|
|
40
|
+
get selectedRowsCount(): number;
|
|
41
|
+
get size(): number;
|
|
42
|
+
rangeRequest(range: VuuRange): void;
|
|
43
|
+
private sendRowsToClient;
|
|
44
|
+
createLink({ parentVpId, link: { fromColumn, toColumn }, }: LinkDescriptorWithLabel): void;
|
|
45
|
+
removeLink(): void;
|
|
46
|
+
remoteProcedureCall<T extends VuuRpcResponse = VuuRpcResponse>(): Promise<T>;
|
|
47
|
+
menuRpcCall(rpcRequest: Omit<VuuRpcRequest, "vpId">): Promise<MenuRpcResponse | undefined>;
|
|
48
|
+
getChildRows(rowKey: string): DataSourceRow[];
|
|
49
|
+
getRowsAtDepth(depth: number, visibleOnly?: boolean): DataSourceRow[];
|
|
50
|
+
getRowAtIndex(rowIdx: number): DataSourceRow;
|
|
51
|
+
}
|