@genesislcap/grid-pro 14.141.3 → 14.142.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/dist/custom-elements.json +2283 -973
- package/dist/dts/datasource/base.datasource.d.ts +58 -2
- package/dist/dts/datasource/base.datasource.d.ts.map +1 -1
- package/dist/dts/datasource/server-side.datasource.d.ts +19 -12
- package/dist/dts/datasource/server-side.datasource.d.ts.map +1 -1
- package/dist/dts/grid-pro-genesis-datasource/grid-pro-genesis-datasource.d.ts +6 -66
- package/dist/dts/grid-pro-genesis-datasource/grid-pro-genesis-datasource.d.ts.map +1 -1
- package/dist/esm/datasource/base.datasource.js +181 -13
- package/dist/esm/datasource/server-side.datasource.js +69 -63
- package/dist/esm/grid-pro-genesis-datasource/grid-pro-genesis-datasource.js +16 -156
- package/dist/grid-pro.api.json +188 -61
- package/dist/grid-pro.d.ts +88 -90
- package/docs/api/grid-pro.gridprogenesisdatasource.applyasyncfuncname.md +11 -0
- package/docs/api/grid-pro.gridprogenesisdatasource.applyfuncname.md +11 -0
- package/docs/api/grid-pro.gridprogenesisdatasource.applytransaction.md +22 -0
- package/docs/api/grid-pro.gridprogenesisdatasource.applytransactionasync.md +23 -0
- package/docs/api/grid-pro.gridprogenesisdatasource.md +4 -2
- package/docs/api-report.md +29 -16
- package/package.json +8 -8
- package/docs/api/grid-pro.gridprogenesisdatasource.rowdatamapper.md +0 -13
- package/docs/api/grid-pro.gridprogenesisdatasource.rowidattr.md +0 -15
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import type { ColumnState, GridOptions } from '@ag-grid-community/core';
|
|
1
|
+
import type { ColumnState, GridOptions, RowDataTransaction, ServerSideTransaction } from '@ag-grid-community/core';
|
|
2
2
|
import { Connect } from '@genesislcap/foundation-comms';
|
|
3
3
|
import { FoundationElement } from '@microsoft/fast-foundation';
|
|
4
|
-
|
|
4
|
+
import { GridPro } from '../grid-pro';
|
|
5
|
+
export declare class GenesisGridDatasourceElement extends FoundationElement {
|
|
5
6
|
connect: Connect;
|
|
6
7
|
deferredGridOptions: GridOptions;
|
|
7
8
|
deferredColumnStates: ColumnState[];
|
|
9
|
+
/**
|
|
10
|
+
* Allows grid data updates to be processed via and external function before applying in grid
|
|
11
|
+
*/
|
|
12
|
+
rowDataMapper: Function;
|
|
8
13
|
criteria: string;
|
|
9
14
|
fields: string;
|
|
10
15
|
isSnapshot: boolean;
|
|
@@ -14,5 +19,56 @@ export declare class GridProBaseDatasource extends FoundationElement {
|
|
|
14
19
|
orderBy: string;
|
|
15
20
|
resourceName: string;
|
|
16
21
|
reverse: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Attribute to set an unique identifier for the row.
|
|
24
|
+
*
|
|
25
|
+
* Defaults to `ROW_REF` or `RECORD_ID` depending on the resource type.
|
|
26
|
+
* @privateRemarks Attribute-only, not to be used as a property. Use `rowId` getter instead.
|
|
27
|
+
*/
|
|
28
|
+
rowIdAttr: any;
|
|
29
|
+
protected get rowId(): string;
|
|
30
|
+
/**
|
|
31
|
+
* Returns whether the `row-id` attribute is the default one, depending on the resource type.
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
protected get hasDefaultRowId(): boolean;
|
|
35
|
+
protected get defaultRowIdByResourceType(): string;
|
|
36
|
+
protected isRequestServer: boolean;
|
|
37
|
+
protected get agGrid(): GridPro | null;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The operation type for the {@link @genesislcap/grid-pro#GridProBaseDatasource.mapTransaction} method.
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
export declare enum OperationType {
|
|
44
|
+
Add = "add",
|
|
45
|
+
Update = "update",
|
|
46
|
+
Remove = "remove"
|
|
47
|
+
}
|
|
48
|
+
export declare class GridProBaseDatasource extends GenesisGridDatasourceElement {
|
|
49
|
+
protected dataSubWasLoggedOff: boolean;
|
|
50
|
+
rowData: Map<string, any>;
|
|
51
|
+
protected agTransaction: RowDataTransaction | ServerSideTransaction;
|
|
52
|
+
protected applyFuncName: string;
|
|
53
|
+
protected applyAsyncFuncName: string;
|
|
54
|
+
protected handleStreamInserts(insertedRows: any[]): void;
|
|
55
|
+
protected handleStreamDeletes(deletedRows: any[]): void;
|
|
56
|
+
protected handleStreamUpdates(updatedRows: any[]): void;
|
|
57
|
+
protected applyAllAgTransactions(): void;
|
|
58
|
+
private flashAddedCells;
|
|
59
|
+
private applyMappedAgTransaction;
|
|
60
|
+
protected applyTransaction(agTransaction: RowDataTransaction): any;
|
|
61
|
+
protected applyTransactionAsync(agTransaction: RowDataTransaction, callback?: (res: any) => void): void;
|
|
62
|
+
/**
|
|
63
|
+
* Maps the transaction data to the row data mapper function, if it exists.
|
|
64
|
+
* @param transaction - The transaction data to be mapped.
|
|
65
|
+
* @param operations - The operations to be mapped. Can be 'add', 'update' or 'remove'.
|
|
66
|
+
* @returns The mapped transaction (if the row data mapper function exists), or the original transaction.
|
|
67
|
+
*/
|
|
68
|
+
private mapTransaction;
|
|
69
|
+
}
|
|
70
|
+
export declare class StreamBaseDatasource {
|
|
71
|
+
protected rowId: string;
|
|
72
|
+
rowData: Map<string, any>;
|
|
17
73
|
}
|
|
18
74
|
//# sourceMappingURL=base.datasource.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.datasource.d.ts","sourceRoot":"","sources":["../../../src/datasource/base.datasource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"base.datasource.d.ts","sourceRoot":"","sources":["../../../src/datasource/base.datasource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,qBAAa,4BAA6B,SAAQ,iBAAiB;IACxD,OAAO,EAAG,OAAO,CAAC;IAEf,mBAAmB,EAAE,WAAW,CAAC;IACjC,oBAAoB,EAAE,WAAW,EAAE,CAAC;IAEhD;;OAEG;IACS,aAAa,EAAE,QAAQ,CAAC;IAE9B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACgC,UAAU,UAAS;IACvC,OAAO,EAAE,MAAM,CAAmC;IAClD,OAAO,EAAE,MAAM,CAAoC;IAC/B,UAAU,UAAS;IACvC,OAAO,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IAChC,OAAO,UAAS;IAE3C;;;;;OAKG;IAC4B,SAAS,MAAC;IAMzC,SAAS,KAAK,KAAK,IAAI,MAAM,CAI5B;IAED;;;OAGG;IACH,SAAS,KAAK,eAAe,IAAI,OAAO,CAMvC;IAED,SAAS,KAAK,0BAA0B,IAAI,MAAM,CAIjD;IAED,SAAS,CAAC,eAAe,UAAS;IAElC,SAAS,KAAK,MAAM,IAAI,OAAO,GAAG,IAAI,CAErC;CACF;AAED;;;GAGG;AACH,oBAAY,aAAa;IACvB,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAED,qBAAa,qBAAsB,SAAQ,4BAA4B;IACrE,SAAS,CAAC,mBAAmB,UAAS;IAEtC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAa;IAEtC,SAAS,CAAC,aAAa,EAAE,kBAAkB,GAAG,qBAAqB,CAIjE;IAEF,SAAS,CAAC,aAAa,EAAE,MAAM,CAAC;IAChC,SAAS,CAAC,kBAAkB,EAAE,MAAM,CAAC;IAErC,SAAS,CAAC,mBAAmB,CAAC,YAAY,EAAE,GAAG,EAAE;IAgBjD,SAAS,CAAC,mBAAmB,CAAC,WAAW,EAAE,GAAG,EAAE;IAgBhD,SAAS,CAAC,mBAAmB,CAAC,WAAW,EAAE,GAAG,EAAE;IAuBhD,SAAS,CAAC,sBAAsB;IAsChC,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,wBAAwB;IAkBhC,SAAS,CAAC,gBAAgB,CAAC,aAAa,EAAE,kBAAkB,GAAG,GAAG;IAIlE,SAAS,CAAC,qBAAqB,CAAC,aAAa,EAAE,kBAAkB,EAAE,QAAQ,CAAC,EAAE,CAAC,GAAG,KAAA,KAAK,IAAI;IAI3F;;;;;OAKG;IACH,OAAO,CAAC,cAAc;CAwBvB;AAED,qBAAa,oBAAoB;IAC/B,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAa;CACvC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { IServerSideDatasource, IServerSideGetRowsParams } from '@ag-grid-community/core';
|
|
1
|
+
import type { IServerSideDatasource, IServerSideGetRowsParams, IServerSideRowModel, RowDataTransaction, ServerSideTransactionResult } from '@ag-grid-community/core';
|
|
2
2
|
import { Auth, Connect, FilteredDataServerResult, MetadataDetail, SocketObservable } from '@genesislcap/foundation-comms';
|
|
3
|
-
import { GridProBaseDatasource } from './base.datasource';
|
|
3
|
+
import { GridProBaseDatasource, StreamBaseDatasource } from './base.datasource';
|
|
4
4
|
/**
|
|
5
5
|
* Type definition for configuration options used for streams.
|
|
6
6
|
* @remarks
|
|
@@ -22,7 +22,7 @@ export type StreamDatasourceOptions = {
|
|
|
22
22
|
* The IServerSideDatasource implementation, used for SSRM (Server-Side Row Model) in the grid.
|
|
23
23
|
* @alpha
|
|
24
24
|
*/
|
|
25
|
-
export declare class StreamDatasource implements IServerSideDatasource {
|
|
25
|
+
export declare class StreamDatasource extends StreamBaseDatasource implements IServerSideDatasource {
|
|
26
26
|
auth: Auth;
|
|
27
27
|
connect: Connect;
|
|
28
28
|
dataserverStream: SocketObservable<FilteredDataServerResult>;
|
|
@@ -38,27 +38,25 @@ export declare class StreamDatasource implements IServerSideDatasource {
|
|
|
38
38
|
* The number of rows in the grid. THIS DO NOT CONSIDER CRITERIA_MATCH scenarios.
|
|
39
39
|
* @internal
|
|
40
40
|
*/
|
|
41
|
-
|
|
41
|
+
server_ROWS_COUNT: number;
|
|
42
42
|
/**
|
|
43
43
|
* The number of rows in the grid. THIS IS A LOCAL COUNT CONSIDERING CONSIDER CRITERIA_MATCH scenarios.
|
|
44
44
|
* @internal
|
|
45
45
|
*/
|
|
46
|
-
|
|
46
|
+
client_ROWS_COUNT: number;
|
|
47
47
|
private moreRows;
|
|
48
48
|
private calculatedRowsCount;
|
|
49
49
|
private lastSequenceId;
|
|
50
50
|
private currentFilterModel;
|
|
51
51
|
private originalCriteriaMatch;
|
|
52
52
|
private currentSortModel;
|
|
53
|
-
private rowData;
|
|
54
|
-
private agTransaction;
|
|
55
|
-
private rowId;
|
|
56
53
|
constructor(options: StreamDatasourceOptions);
|
|
57
54
|
getRows(params: IServerSideGetRowsParams): Promise<void>;
|
|
55
|
+
private sortMapByNumericKey;
|
|
58
56
|
private dataLogoff;
|
|
59
57
|
private restartSubscription;
|
|
60
58
|
private getOrderByAndToBeSortedColIds;
|
|
61
|
-
private
|
|
59
|
+
private handleCurrentStreamLoad;
|
|
62
60
|
private buildCriteriaMatchFromFilters;
|
|
63
61
|
private criteriaFromFilters;
|
|
64
62
|
private getFiltersByType;
|
|
@@ -214,6 +212,11 @@ declare const GridProServerSideDatasource_base: (new (...args: any[]) => {
|
|
|
214
212
|
readonly DOCUMENT_TYPE_NODE: number;
|
|
215
213
|
readonly ELEMENT_NODE: number;
|
|
216
214
|
readonly ENTITY_NODE: number;
|
|
215
|
+
/**
|
|
216
|
+
* A Genesis Datasource element, for server-side | SSRM-compatible data fetching and used exclusively by the GridPro element.
|
|
217
|
+
* @remarks Only supports Server-Side Row Model. Requires `@ag-grid-enterprise/server-side-row-model` setup and valid AG Grid Enterprise license.
|
|
218
|
+
* @alpha
|
|
219
|
+
*/
|
|
217
220
|
readonly ENTITY_REFERENCE_NODE: number;
|
|
218
221
|
readonly NOTATION_NODE: number;
|
|
219
222
|
readonly PROCESSING_INSTRUCTION_NODE: number;
|
|
@@ -394,12 +397,13 @@ declare const GridProServerSideDatasource_base: (new (...args: any[]) => {
|
|
|
394
397
|
* @alpha
|
|
395
398
|
*/
|
|
396
399
|
export declare class GridProServerSideDatasource extends GridProServerSideDatasource_base {
|
|
400
|
+
applyFuncName: string;
|
|
401
|
+
applyAsyncFuncName: string;
|
|
397
402
|
criteriaChanged(oldCriteria: string, newCriteria: string): void;
|
|
398
403
|
resourceNameChanged(oldValue: string, newValue: string): void;
|
|
399
404
|
pagination: boolean;
|
|
400
|
-
rowId: string;
|
|
401
405
|
private indexes;
|
|
402
|
-
private
|
|
406
|
+
private ssrmDatasource;
|
|
403
407
|
private originalFieldDef;
|
|
404
408
|
connectedCallback(): void;
|
|
405
409
|
disconnectedCallback(): void;
|
|
@@ -407,12 +411,15 @@ export declare class GridProServerSideDatasource extends GridProServerSideDataso
|
|
|
407
411
|
init(): void;
|
|
408
412
|
reset(): void;
|
|
409
413
|
restart(): void;
|
|
410
|
-
private get agGrid();
|
|
411
414
|
private clearRowData;
|
|
412
415
|
private getResourceIndexes;
|
|
413
416
|
get params(): any;
|
|
417
|
+
get rowModel(): IServerSideRowModel;
|
|
414
418
|
private createDataserverStream;
|
|
419
|
+
private handleStreamDeletesTemp;
|
|
415
420
|
private getAgColumnDefs;
|
|
421
|
+
applyTransaction(agTransaction: RowDataTransaction): ServerSideTransactionResult;
|
|
422
|
+
applyTransactionAsync(agTransaction: RowDataTransaction, callback?: (res: ServerSideTransactionResult) => void): void;
|
|
416
423
|
}
|
|
417
424
|
export {};
|
|
418
425
|
//# sourceMappingURL=server-side.datasource.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-side.datasource.d.ts","sourceRoot":"","sources":["../../../src/datasource/server-side.datasource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,qBAAqB,EACrB,wBAAwB,
|
|
1
|
+
{"version":3,"file":"server-side.datasource.d.ts","sourceRoot":"","sources":["../../../src/datasource/server-side.datasource.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
+
import type { RowDataTransaction, RowNodeTransaction } from '@ag-grid-community/core';
|
|
1
2
|
import { Auth, Datasource } from '@genesislcap/foundation-comms';
|
|
2
3
|
import { GridProBaseDatasource } from '../datasource/base.datasource';
|
|
3
|
-
/**
|
|
4
|
-
* The operation type for the {@link @genesislcap/grid-pro#GridProGenesisDatasource.mapTransaction} method.
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
7
|
-
export declare enum OperationType {
|
|
8
|
-
Add = "add",
|
|
9
|
-
Update = "update",
|
|
10
|
-
Remove = "remove"
|
|
11
|
-
}
|
|
12
4
|
declare const GridProGenesisDatasource_base: (new (...args: any[]) => {
|
|
13
5
|
"__#1@#_container": import("@genesislcap/foundation-utils").FoundationLayoutContainer | import("@genesislcap/foundation-utils").LayoutCacheContainer | import("@genesislcap/foundation-utils").DOMContainer;
|
|
14
6
|
"__#1@#_latestTokenCode": string;
|
|
@@ -24,11 +16,6 @@ declare const GridProGenesisDatasource_base: (new (...args: any[]) => {
|
|
|
24
16
|
connectedCallback(): void;
|
|
25
17
|
readonly $fastController: import("@microsoft/fast-element").Controller;
|
|
26
18
|
$emit(type: string, detail?: any, options?: Omit<CustomEventInit<any>, "detail">): boolean | void;
|
|
27
|
-
/**
|
|
28
|
-
* Returns the `row-id` attribute, depending on the resource type.
|
|
29
|
-
* @remarks Will favour the `row-id` attribute if set.
|
|
30
|
-
* @internal
|
|
31
|
-
*/
|
|
32
19
|
disconnectedCallback(): void;
|
|
33
20
|
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
34
21
|
accessKey: string;
|
|
@@ -97,23 +84,13 @@ declare const GridProGenesisDatasource_base: (new (...args: any[]) => {
|
|
|
97
84
|
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf<SVGElement>;
|
|
98
85
|
getElementsByTagNameNS(namespace: string, localName: string): HTMLCollectionOf<Element>;
|
|
99
86
|
hasAttribute(qualifiedName: string): boolean;
|
|
100
|
-
/**
|
|
101
|
-
* Sends a DATA_LOGOFF when the resource is an active stream
|
|
102
|
-
* @remarks Will only happen for streaming DATASERER resources.
|
|
103
|
-
* @internal
|
|
104
|
-
*/
|
|
105
87
|
hasAttributeNS(namespace: string, localName: string): boolean;
|
|
106
88
|
hasAttributes(): boolean;
|
|
107
89
|
hasPointerCapture(pointerId: number): boolean;
|
|
108
90
|
insertAdjacentElement(where: InsertPosition, element: Element): Element;
|
|
109
91
|
insertAdjacentHTML(position: InsertPosition, text: string): void;
|
|
110
92
|
insertAdjacentText(where: InsertPosition, data: string): void;
|
|
111
|
-
matches(selectors: string): boolean;
|
|
112
|
-
* Clears the rowData and columnDefs for the grid.
|
|
113
|
-
* @remarks This is called when `reloadResourceData` happens, on criteria and filters change or full `reset`.
|
|
114
|
-
* @param withColumnDefs - Whether to clear the columnDefs as well. Defaults to true.
|
|
115
|
-
* @internal
|
|
116
|
-
*/
|
|
93
|
+
matches(selectors: string): boolean;
|
|
117
94
|
releasePointerCapture(pointerId: number): void;
|
|
118
95
|
removeAttribute(qualifiedName: string): void;
|
|
119
96
|
removeAttributeNS(namespace: string, localName: string): void;
|
|
@@ -357,50 +334,24 @@ declare const GridProGenesisDatasource_base: (new (...args: any[]) => {
|
|
|
357
334
|
export declare class GridProGenesisDatasource extends GridProGenesisDatasource_base {
|
|
358
335
|
auth: Auth;
|
|
359
336
|
datasource: Datasource;
|
|
337
|
+
applyFuncName: string;
|
|
338
|
+
applyAsyncFuncName: string;
|
|
360
339
|
criteriaChanged(oldCriteria: string, newCriteria: string): void;
|
|
361
340
|
pollingInterval: number;
|
|
362
341
|
disablePolling: boolean;
|
|
363
342
|
request: any;
|
|
364
343
|
resourceNameChanged(oldValue: string, newValue: string): void;
|
|
365
|
-
/**
|
|
366
|
-
* Attribute to set an unique identifier for the row.
|
|
367
|
-
*
|
|
368
|
-
* Defaults to `ROW_REF` or `RECORD_ID` depending on the resource type.
|
|
369
|
-
* @privateRemarks Attribute-only, not to be used as a property. Use `rowId` getter instead.
|
|
370
|
-
*/
|
|
371
|
-
rowIdAttr: any;
|
|
372
344
|
restartOnReconnection: boolean;
|
|
373
|
-
/**
|
|
374
|
-
* Allows grid data updates to be processed via and external function before applying in grid
|
|
375
|
-
*/
|
|
376
|
-
rowDataMapper: Function;
|
|
377
345
|
private dataSub;
|
|
378
346
|
private updateSub;
|
|
379
347
|
private connectionSub;
|
|
380
|
-
private isRequestServer;
|
|
381
348
|
private requiresFullRowDataAndColDefs;
|
|
382
|
-
private dataSubWasLoggedOff;
|
|
383
|
-
private rows;
|
|
384
|
-
private agTransaction;
|
|
385
349
|
private sourceRef;
|
|
386
350
|
private criteriaFromFilters;
|
|
387
351
|
private update;
|
|
388
352
|
connectedCallback(): void;
|
|
389
353
|
disconnectedCallback(): void;
|
|
390
354
|
deepClone(): Node;
|
|
391
|
-
private get agGrid();
|
|
392
|
-
/**
|
|
393
|
-
* Returns the `row-id` attribute, depending on the resource type.
|
|
394
|
-
* @remarks Will favour the `row-id` attribute if set.
|
|
395
|
-
* @internal
|
|
396
|
-
*/
|
|
397
|
-
private get rowId();
|
|
398
|
-
/**
|
|
399
|
-
* Returns whether the `row-id` attribute is the default one, depending on the resource type.
|
|
400
|
-
* @internal
|
|
401
|
-
*/
|
|
402
|
-
private get hasDefaultRowId();
|
|
403
|
-
private get defaultRowIdByResourceType();
|
|
404
355
|
/**
|
|
405
356
|
* Initializes the datasource.
|
|
406
357
|
* @public
|
|
@@ -467,23 +418,12 @@ export declare class GridProGenesisDatasource extends GridProGenesisDatasource_b
|
|
|
467
418
|
private handleStreamResult;
|
|
468
419
|
private applyRequestServerData;
|
|
469
420
|
private applyDataserverData;
|
|
470
|
-
private applyAllAgTransactions;
|
|
471
|
-
private flashAddedCells;
|
|
472
|
-
private applyMappedAgTransaction;
|
|
473
|
-
/**
|
|
474
|
-
* Maps the transaction data to the row data mapper function, if it exists.
|
|
475
|
-
* @param transaction - The transaction data to be mapped.
|
|
476
|
-
* @param operations - The operations to be mapped. Can be 'add', 'update' or 'remove'.
|
|
477
|
-
* @returns The mapped transaction (if the row data mapper function exists), or the original transaction.
|
|
478
|
-
*/
|
|
479
|
-
private mapTransaction;
|
|
480
|
-
private handleStreamInserts;
|
|
481
|
-
private handleStreamDeletes;
|
|
482
|
-
private handleStreamUpdates;
|
|
483
421
|
private getAgColumnDefs;
|
|
484
422
|
private buildCriteria;
|
|
485
423
|
setFilter(fieldName: string, newFilter: string): void;
|
|
486
424
|
removeFilter(fieldName: string): void;
|
|
425
|
+
applyTransaction(agTransaction: RowDataTransaction): RowNodeTransaction | null | undefined;
|
|
426
|
+
applyTransactionAsync(agTransaction: RowDataTransaction, callback?: (res: RowNodeTransaction) => void): void;
|
|
487
427
|
}
|
|
488
428
|
export {};
|
|
489
429
|
//# sourceMappingURL=grid-pro-genesis-datasource.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid-pro-genesis-datasource.d.ts","sourceRoot":"","sources":["../../../src/grid-pro-genesis-datasource/grid-pro-genesis-datasource.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"grid-pro-genesis-datasource.d.ts","sourceRoot":"","sources":["../../../src/grid-pro-genesis-datasource/grid-pro-genesis-datasource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC9F,OAAO,EACL,IAAI,EACJ,UAAU,EAaX,MAAM,+BAA+B,CAAC;AAMvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAetE;;;;GAIG;AACH,qBAGa,wBAAyB,SAAQ,6BAAqC;IAC3E,IAAI,EAAG,IAAI,CAAC;IACN,UAAU,EAAG,UAAU,CAAC;IAEpC,aAAa,SAAsB;IACnC,kBAAkB,SAA2B;IAG7C,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;IASf,eAAe,EAAE,MAAM,CACf;IACQ,cAAc,EAAE,OAAO,CAAS;IAC7E,OAAO,EAAE,GAAG,CAAC;IAEzB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAKW,qBAAqB,UAAS;IAE/F,OAAO,CAAC,OAAO,CAAe;IAC9B,OAAO,CAAC,SAAS,CAAe;IAChC,OAAO,CAAC,aAAa,CAAe;IAEpC,OAAO,CAAC,6BAA6B,CAAQ;IAE7C,OAAO,CAAC,SAAS,CAAS;IAE1B,OAAO,CAAC,mBAAmB,CAAkC;IAC7D,OAAO,CAAC,MAAM,CAAwE;IAEtF,iBAAiB;IAuBjB,oBAAoB;IASX,SAAS,IAAI,IAAI;IAU1B;;;;OAIG;IACG,IAAI;IAqDV;;;OAGG;IACH,MAAM;IAIN;;;;OAIG;IACH,KAAK;IA8BL;;;OAGG;IACH,OAAO;IAKP;;OAEG;IACH,WAAW;IAIX;;;;OAIG;IACH,OAAO,CAAC,UAAU;IAUlB;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAWpB;;;;OAIG;IACH,OAAO,CAAC,UAAU;IAgBlB;;;;;OAKG;YACW,kBAAkB;IAYhC;;;;;;OAMG;YACW,gBAAgB;IA0D9B,OAAO,CAAC,cAAc;IActB,YAAY,CAAC,MAAM,KAAA;IAOnB,OAAO,CAAC,iBAAiB;IAiBzB,OAAO,CAAC,kBAAkB;IAU1B,OAAO,CAAC,sBAAsB;IA2C9B,OAAO,CAAC,mBAAmB;IAsB3B,OAAO,CAAC,eAAe;IAwEvB,OAAO,CAAC,aAAa;IAMd,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAK9C,YAAY,CAAC,SAAS,EAAE,MAAM;IAK5B,gBAAgB,CACvB,aAAa,EAAE,kBAAkB,GAChC,kBAAkB,GAAG,IAAI,GAAG,SAAS;IAI/B,qBAAqB,CAC5B,aAAa,EAAE,kBAAkB,EACjC,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,kBAAkB,KAAK,IAAI,GAC3C,IAAI;CAGR"}
|
|
@@ -3,7 +3,7 @@ import { DatasourceDefaults } from '@genesislcap/foundation-comms';
|
|
|
3
3
|
import { Connect } from '@genesislcap/foundation-comms';
|
|
4
4
|
import { attr, observable } from '@microsoft/fast-element';
|
|
5
5
|
import { FoundationElement } from '@microsoft/fast-foundation';
|
|
6
|
-
export class
|
|
6
|
+
export class GenesisGridDatasourceElement extends FoundationElement {
|
|
7
7
|
constructor() {
|
|
8
8
|
super(...arguments);
|
|
9
9
|
this.isSnapshot = false;
|
|
@@ -11,41 +11,209 @@ export class GridProBaseDatasource extends FoundationElement {
|
|
|
11
11
|
this.maxView = DatasourceDefaults.MAX_VIEW_1000;
|
|
12
12
|
this.movingView = false;
|
|
13
13
|
this.reverse = false;
|
|
14
|
+
this.isRequestServer = false;
|
|
15
|
+
}
|
|
16
|
+
/* Returns the `row-id` attribute, depending on the resource type.
|
|
17
|
+
* @remarks Will favour the `row-id` attribute if set.
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
get rowId() {
|
|
21
|
+
if (this.rowIdAttr)
|
|
22
|
+
return this.rowIdAttr;
|
|
23
|
+
if (this.isRequestServer)
|
|
24
|
+
return DatasourceDefaults.REQUEST_SERVER_ROW_ID;
|
|
25
|
+
return DatasourceDefaults.DATASERVER_ROW_ID;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Returns whether the `row-id` attribute is the default one, depending on the resource type.
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
get hasDefaultRowId() {
|
|
32
|
+
return (!this.rowIdAttr ||
|
|
33
|
+
this.rowIdAttr === DatasourceDefaults.REQUEST_SERVER_ROW_ID ||
|
|
34
|
+
this.rowIdAttr === DatasourceDefaults.DATASERVER_ROW_ID);
|
|
35
|
+
}
|
|
36
|
+
get defaultRowIdByResourceType() {
|
|
37
|
+
return this.isRequestServer
|
|
38
|
+
? DatasourceDefaults.REQUEST_SERVER_ROW_ID
|
|
39
|
+
: DatasourceDefaults.DATASERVER_ROW_ID;
|
|
40
|
+
}
|
|
41
|
+
get agGrid() {
|
|
42
|
+
return this.parentElement;
|
|
14
43
|
}
|
|
15
44
|
}
|
|
16
45
|
__decorate([
|
|
17
46
|
Connect
|
|
18
|
-
],
|
|
47
|
+
], GenesisGridDatasourceElement.prototype, "connect", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
observable
|
|
50
|
+
], GenesisGridDatasourceElement.prototype, "deferredGridOptions", void 0);
|
|
19
51
|
__decorate([
|
|
20
52
|
observable
|
|
21
|
-
],
|
|
53
|
+
], GenesisGridDatasourceElement.prototype, "deferredColumnStates", void 0);
|
|
22
54
|
__decorate([
|
|
23
55
|
observable
|
|
24
|
-
],
|
|
56
|
+
], GenesisGridDatasourceElement.prototype, "rowDataMapper", void 0);
|
|
25
57
|
__decorate([
|
|
26
58
|
attr
|
|
27
|
-
],
|
|
59
|
+
], GenesisGridDatasourceElement.prototype, "criteria", void 0);
|
|
28
60
|
__decorate([
|
|
29
61
|
attr
|
|
30
|
-
],
|
|
62
|
+
], GenesisGridDatasourceElement.prototype, "fields", void 0);
|
|
31
63
|
__decorate([
|
|
32
64
|
attr({ mode: 'boolean', attribute: 'is-snapshot' })
|
|
33
|
-
],
|
|
65
|
+
], GenesisGridDatasourceElement.prototype, "isSnapshot", void 0);
|
|
34
66
|
__decorate([
|
|
35
67
|
attr({ attribute: 'max-rows' })
|
|
36
|
-
],
|
|
68
|
+
], GenesisGridDatasourceElement.prototype, "maxRows", void 0);
|
|
37
69
|
__decorate([
|
|
38
70
|
attr({ attribute: 'max-view' })
|
|
39
|
-
],
|
|
71
|
+
], GenesisGridDatasourceElement.prototype, "maxView", void 0);
|
|
40
72
|
__decorate([
|
|
41
73
|
attr({ mode: 'boolean', attribute: 'moving-view' })
|
|
42
|
-
],
|
|
74
|
+
], GenesisGridDatasourceElement.prototype, "movingView", void 0);
|
|
43
75
|
__decorate([
|
|
44
76
|
attr({ attribute: 'order-by' })
|
|
45
|
-
],
|
|
77
|
+
], GenesisGridDatasourceElement.prototype, "orderBy", void 0);
|
|
46
78
|
__decorate([
|
|
47
79
|
attr({ attribute: 'resource-name' })
|
|
48
|
-
],
|
|
80
|
+
], GenesisGridDatasourceElement.prototype, "resourceName", void 0);
|
|
49
81
|
__decorate([
|
|
50
82
|
attr({ mode: 'boolean' })
|
|
51
|
-
],
|
|
83
|
+
], GenesisGridDatasourceElement.prototype, "reverse", void 0);
|
|
84
|
+
__decorate([
|
|
85
|
+
attr({ attribute: 'row-id' })
|
|
86
|
+
], GenesisGridDatasourceElement.prototype, "rowIdAttr", void 0);
|
|
87
|
+
/**
|
|
88
|
+
* The operation type for the {@link @genesislcap/grid-pro#GridProBaseDatasource.mapTransaction} method.
|
|
89
|
+
* @internal
|
|
90
|
+
*/
|
|
91
|
+
export var OperationType;
|
|
92
|
+
(function (OperationType) {
|
|
93
|
+
OperationType["Add"] = "add";
|
|
94
|
+
OperationType["Update"] = "update";
|
|
95
|
+
OperationType["Remove"] = "remove";
|
|
96
|
+
})(OperationType || (OperationType = {}));
|
|
97
|
+
export class GridProBaseDatasource extends GenesisGridDatasourceElement {
|
|
98
|
+
constructor() {
|
|
99
|
+
super(...arguments);
|
|
100
|
+
this.dataSubWasLoggedOff = false;
|
|
101
|
+
this.rowData = new Map();
|
|
102
|
+
this.agTransaction = {
|
|
103
|
+
add: [],
|
|
104
|
+
remove: [],
|
|
105
|
+
update: [],
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
handleStreamInserts(insertedRows) {
|
|
109
|
+
insertedRows === null || insertedRows === void 0 ? void 0 : insertedRows.forEach((insertData) => {
|
|
110
|
+
if (this.rowData.has(insertData[this.rowId]) || this.dataSubWasLoggedOff) {
|
|
111
|
+
const rowToBeUpdated = this.rowData.get(insertData[this.rowId]);
|
|
112
|
+
const updatedRow = Object.assign(Object.assign({}, rowToBeUpdated), insertData);
|
|
113
|
+
this.agTransaction.update.push(updatedRow);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
this.agTransaction.add.push(insertData);
|
|
117
|
+
this.agTransaction.addIndex = 0;
|
|
118
|
+
}
|
|
119
|
+
this.rowData.set(insertData[this.rowId], insertData);
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
handleStreamDeletes(deletedRows) {
|
|
123
|
+
deletedRows === null || deletedRows === void 0 ? void 0 : deletedRows.forEach((deleteData) => {
|
|
124
|
+
if (this.hasDefaultRowId || this.isRequestServer) {
|
|
125
|
+
this.agTransaction.remove.push({ [this.rowId]: deleteData[this.rowId] });
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
const rowToBeDeleted = Object.values(Object.fromEntries(this.rowData)).find((obj) => obj[this.defaultRowIdByResourceType] === deleteData[this.defaultRowIdByResourceType]);
|
|
129
|
+
this.agTransaction.remove.push({ [this.rowId]: rowToBeDeleted[this.rowId] });
|
|
130
|
+
}
|
|
131
|
+
this.rowData.delete(deleteData[this.rowId]);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
handleStreamUpdates(updatedRows) {
|
|
135
|
+
updatedRows === null || updatedRows === void 0 ? void 0 : updatedRows.forEach((updateData) => {
|
|
136
|
+
let updatedRow;
|
|
137
|
+
if (this.hasDefaultRowId || this.isRequestServer) {
|
|
138
|
+
const rowToBeUpdated = this.rowData.get(updateData[this.rowId]);
|
|
139
|
+
updatedRow = Object.assign(Object.assign({}, rowToBeUpdated), updateData);
|
|
140
|
+
this.agTransaction.update.push(updatedRow);
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
const rowToBeUpdated = Object.values(Object.fromEntries(this.rowData)).find((obj) => obj[this.defaultRowIdByResourceType] === updateData[this.defaultRowIdByResourceType]);
|
|
144
|
+
updatedRow = Object.assign(Object.assign({}, rowToBeUpdated), updateData);
|
|
145
|
+
this.agTransaction.update.push(updatedRow);
|
|
146
|
+
}
|
|
147
|
+
this.rowData.set(updateData[this.rowId], updatedRow);
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
applyAllAgTransactions() {
|
|
151
|
+
if (!this.agTransaction.add.length &&
|
|
152
|
+
!this.agTransaction.update.length &&
|
|
153
|
+
!this.agTransaction.remove.length) {
|
|
154
|
+
this.agGrid.gridApi.hideOverlay();
|
|
155
|
+
if (this.rowData.size === 0) {
|
|
156
|
+
this.agGrid.gridApi.showNoRowsOverlay();
|
|
157
|
+
}
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
if (this.agTransaction.add.length > 0) {
|
|
161
|
+
this.applyMappedAgTransaction({ add: this.agTransaction.add, addIndex: this.agGrid.addIndex }, OperationType.Add, this.agGrid.asyncAdd);
|
|
162
|
+
}
|
|
163
|
+
if (this.agTransaction.remove.length > 0) {
|
|
164
|
+
this.applyMappedAgTransaction({ remove: this.agTransaction.remove }, OperationType.Remove, this.agGrid.asyncRemove);
|
|
165
|
+
}
|
|
166
|
+
if (this.agTransaction.update.length > 0) {
|
|
167
|
+
this.applyMappedAgTransaction({ update: this.agTransaction.update }, OperationType.Update, this.agGrid.asyncUpdate);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
flashAddedCells(rowNodes) {
|
|
171
|
+
if (this.agGrid.enableRowFlashing && (rowNodes === null || rowNodes === void 0 ? void 0 : rowNodes.length)) {
|
|
172
|
+
this.agGrid.gridApi.flashCells({ rowNodes });
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
applyMappedAgTransaction(agTransaction, operation, isAsync) {
|
|
176
|
+
if (isAsync) {
|
|
177
|
+
this.applyTransactionAsync(this.mapTransaction(agTransaction, [operation]), (changedNodes) => {
|
|
178
|
+
this.flashAddedCells(changedNodes.add);
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
const changedNodes = this.applyTransaction(this.mapTransaction(agTransaction, [operation]));
|
|
183
|
+
this.flashAddedCells(changedNodes.add);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
applyTransaction(agTransaction) {
|
|
187
|
+
throw new Error('Method not implemented.');
|
|
188
|
+
}
|
|
189
|
+
applyTransactionAsync(agTransaction, callback) {
|
|
190
|
+
throw new Error('Method not implemented.');
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Maps the transaction data to the row data mapper function, if it exists.
|
|
194
|
+
* @param transaction - The transaction data to be mapped.
|
|
195
|
+
* @param operations - The operations to be mapped. Can be 'add', 'update' or 'remove'.
|
|
196
|
+
* @returns The mapped transaction (if the row data mapper function exists), or the original transaction.
|
|
197
|
+
*/
|
|
198
|
+
mapTransaction(transaction, operations = Object.values(OperationType)) {
|
|
199
|
+
if (!this.rowDataMapper) {
|
|
200
|
+
return transaction;
|
|
201
|
+
}
|
|
202
|
+
const mappedTransaction = {};
|
|
203
|
+
if (operations.includes(OperationType.Add)) {
|
|
204
|
+
mappedTransaction.add = this.rowDataMapper(transaction.add, this.rowData);
|
|
205
|
+
}
|
|
206
|
+
if (operations.includes(OperationType.Remove)) {
|
|
207
|
+
mappedTransaction.remove = this.rowDataMapper(transaction.remove, this.rowData);
|
|
208
|
+
}
|
|
209
|
+
if (operations.includes(OperationType.Update)) {
|
|
210
|
+
mappedTransaction.update = this.rowDataMapper(transaction.update, this.rowData);
|
|
211
|
+
}
|
|
212
|
+
return mappedTransaction;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
export class StreamBaseDatasource {
|
|
216
|
+
constructor() {
|
|
217
|
+
this.rowData = new Map();
|
|
218
|
+
}
|
|
219
|
+
}
|