@genesislcap/grid-pro 14.170.0-genxgit.1 → 14.170.1-alpha-2fe40dd.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 +38 -1
- package/dist/dts/datasource/server-side.datasource.d.ts +7 -8
- package/dist/dts/datasource/server-side.datasource.d.ts.map +1 -1
- package/dist/esm/datasource/server-side.datasource.js +82 -64
- package/dist/grid-pro.d.ts +7 -7
- package/docs/api-report.md +8 -1
- package/package.json +13 -13
|
@@ -8157,6 +8157,20 @@
|
|
|
8157
8157
|
"text": "SocketObservable<FilteredDataServerResult>"
|
|
8158
8158
|
}
|
|
8159
8159
|
},
|
|
8160
|
+
{
|
|
8161
|
+
"kind": "field",
|
|
8162
|
+
"name": "dataserverStreamSubscription",
|
|
8163
|
+
"type": {
|
|
8164
|
+
"text": "SocketSubscription"
|
|
8165
|
+
}
|
|
8166
|
+
},
|
|
8167
|
+
{
|
|
8168
|
+
"kind": "field",
|
|
8169
|
+
"name": "createDataserverStreamFunc",
|
|
8170
|
+
"type": {
|
|
8171
|
+
"text": "(\n existingParams?: any,\n ) => Promise<SocketObservable<FilteredDataServerResult>>"
|
|
8172
|
+
}
|
|
8173
|
+
},
|
|
8160
8174
|
{
|
|
8161
8175
|
"kind": "field",
|
|
8162
8176
|
"name": "resourceName",
|
|
@@ -8282,6 +8296,25 @@
|
|
|
8282
8296
|
}
|
|
8283
8297
|
]
|
|
8284
8298
|
},
|
|
8299
|
+
{
|
|
8300
|
+
"kind": "method",
|
|
8301
|
+
"name": "applyServerSideData",
|
|
8302
|
+
"privacy": "private",
|
|
8303
|
+
"parameters": [
|
|
8304
|
+
{
|
|
8305
|
+
"name": "params",
|
|
8306
|
+
"type": {
|
|
8307
|
+
"text": "IServerSideGetRowsParams"
|
|
8308
|
+
}
|
|
8309
|
+
},
|
|
8310
|
+
{
|
|
8311
|
+
"name": "result",
|
|
8312
|
+
"type": {
|
|
8313
|
+
"text": "RawDataServerResult"
|
|
8314
|
+
}
|
|
8315
|
+
}
|
|
8316
|
+
]
|
|
8317
|
+
},
|
|
8285
8318
|
{
|
|
8286
8319
|
"kind": "method",
|
|
8287
8320
|
"name": "sortMapByNumericKey",
|
|
@@ -8306,7 +8339,11 @@
|
|
|
8306
8339
|
},
|
|
8307
8340
|
{
|
|
8308
8341
|
"kind": "method",
|
|
8309
|
-
"name": "
|
|
8342
|
+
"name": "deinit"
|
|
8343
|
+
},
|
|
8344
|
+
{
|
|
8345
|
+
"kind": "method",
|
|
8346
|
+
"name": "refreshDatasource",
|
|
8310
8347
|
"privacy": "private",
|
|
8311
8348
|
"return": {
|
|
8312
8349
|
"type": {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IServerSideDatasource, IServerSideGetRowsParams, IServerSideRowModel, RowDataTransaction, ServerSideTransactionResult } from '@ag-grid-community/core';
|
|
2
|
-
import { Auth, Connect, FilteredDataServerResult, MetadataDetail, SocketObservable } from '@genesislcap/foundation-comms';
|
|
2
|
+
import { Auth, Connect, FilteredDataServerResult, MetadataDetail, SocketObservable, SocketSubscription } from '@genesislcap/foundation-comms';
|
|
3
3
|
import { GridProBaseDatasource, StreamBaseDatasource } from './base.datasource';
|
|
4
4
|
/**
|
|
5
5
|
* Type definition for configuration options used for streams.
|
|
@@ -8,7 +8,7 @@ import { GridProBaseDatasource, StreamBaseDatasource } from './base.datasource';
|
|
|
8
8
|
* @alpha
|
|
9
9
|
*/
|
|
10
10
|
export type StreamDatasourceOptions = {
|
|
11
|
-
|
|
11
|
+
createDataserverStreamFunc: (existingParams?: any) => Promise<SocketObservable<FilteredDataServerResult>>;
|
|
12
12
|
resourceName: string;
|
|
13
13
|
resourceParams?: any;
|
|
14
14
|
resourceIndexes?: Map<string, [string]>;
|
|
@@ -26,6 +26,8 @@ export declare class StreamDatasource extends StreamBaseDatasource implements IS
|
|
|
26
26
|
auth: Auth;
|
|
27
27
|
connect: Connect;
|
|
28
28
|
dataserverStream: SocketObservable<FilteredDataServerResult>;
|
|
29
|
+
dataserverStreamSubscription: SocketSubscription;
|
|
30
|
+
createDataserverStreamFunc: (existingParams?: any) => Promise<SocketObservable<FilteredDataServerResult>>;
|
|
29
31
|
private resourceName;
|
|
30
32
|
resourceParams: any;
|
|
31
33
|
private resourceIndexes;
|
|
@@ -52,9 +54,11 @@ export declare class StreamDatasource extends StreamBaseDatasource implements IS
|
|
|
52
54
|
private currentSortModel;
|
|
53
55
|
constructor(options: StreamDatasourceOptions);
|
|
54
56
|
getRows(params: IServerSideGetRowsParams): Promise<void>;
|
|
57
|
+
private applyServerSideData;
|
|
55
58
|
private sortMapByNumericKey;
|
|
56
59
|
dataLogoff(): Promise<void>;
|
|
57
|
-
|
|
60
|
+
deinit(): Promise<void>;
|
|
61
|
+
private refreshDatasource;
|
|
58
62
|
private getOrderByAndToBeSortedColIds;
|
|
59
63
|
private handleCurrentStreamLoad;
|
|
60
64
|
private buildCriteriaMatchFromFilters;
|
|
@@ -245,11 +249,6 @@ declare const GridProServerSideDatasource_base: (new (...args: any[]) => {
|
|
|
245
249
|
ariaReadOnly: string;
|
|
246
250
|
ariaRequired: string;
|
|
247
251
|
ariaRoleDescription: string;
|
|
248
|
-
/**
|
|
249
|
-
* A Genesis Datasource element, for server-side | SSRM-compatible data fetching and used exclusively by the GridPro element.
|
|
250
|
-
* @remarks Only supports Server-Side Row Model. Requires `@ag-grid-enterprise/server-side-row-model` setup and valid AG Grid Enterprise license.
|
|
251
|
-
* @alpha
|
|
252
|
-
*/
|
|
253
252
|
ariaRowCount: string;
|
|
254
253
|
ariaRowIndex: string;
|
|
255
254
|
ariaRowIndexText: string;
|
|
@@ -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,EACxB,mBAAmB,EAEnB,kBAAkB,EAClB,2BAA2B,EAG5B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,IAAI,EACJ,OAAO,EAIP,wBAAwB,EAIxB,cAAc,
|
|
1
|
+
{"version":3,"file":"server-side.datasource.d.ts","sourceRoot":"","sources":["../../../src/datasource/server-side.datasource.ts"],"names":[],"mappings":"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"}
|
|
@@ -26,7 +26,7 @@ export class StreamDatasource extends StreamBaseDatasource {
|
|
|
26
26
|
this.moreRows = false;
|
|
27
27
|
this.calculatedRowsCount = 0;
|
|
28
28
|
this.lastSequenceId = 0;
|
|
29
|
-
this.
|
|
29
|
+
this.createDataserverStreamFunc = options.createDataserverStreamFunc;
|
|
30
30
|
this.resourceName = options.resourceName;
|
|
31
31
|
this.resourceParams = options.resourceParams;
|
|
32
32
|
this.originalCriteriaMatch = options.resourceParams.CRITERIA_MATCH;
|
|
@@ -38,7 +38,7 @@ export class StreamDatasource extends StreamBaseDatasource {
|
|
|
38
38
|
this.pagination = options.pagination;
|
|
39
39
|
}
|
|
40
40
|
getRows(params) {
|
|
41
|
-
var _a
|
|
41
|
+
var _a;
|
|
42
42
|
return __awaiter(this, void 0, void 0, function* () {
|
|
43
43
|
const filterModelBeingApplied = params.request.filterModel;
|
|
44
44
|
const filtersAreBeingApplied = Object.keys(filterModelBeingApplied).length > 0;
|
|
@@ -48,28 +48,29 @@ export class StreamDatasource extends StreamBaseDatasource {
|
|
|
48
48
|
if (filtersAreGettingCleaned && this.currentFilterModel) {
|
|
49
49
|
this.currentFilterModel = null;
|
|
50
50
|
this.resourceParams.CRITERIA_MATCH = this.originalCriteriaMatch;
|
|
51
|
-
yield this.
|
|
51
|
+
yield this.refreshDatasource(params);
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
else if (filterModelBeingAppliedDiffersFromCurrent && filtersAreBeingApplied) {
|
|
55
55
|
this.currentFilterModel = filterModelBeingApplied;
|
|
56
56
|
this.resourceParams.CRITERIA_MATCH = this.buildCriteriaMatchFromFilters();
|
|
57
|
-
yield this.
|
|
57
|
+
yield this.refreshDatasource(params);
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
const toBeAppliedSortModel = params.request.sortModel;
|
|
62
|
-
if (
|
|
62
|
+
if (((_a = this.currentSortModel) === null || _a === void 0 ? void 0 : _a.length) !== toBeAppliedSortModel.length ||
|
|
63
63
|
toBeAppliedSortModel.length > 0) {
|
|
64
64
|
if (toBeAppliedSortModel.length === 0 && this.currentSortModel) {
|
|
65
65
|
this.calculatedRowsCount = 0;
|
|
66
66
|
this.currentSortModel = null;
|
|
67
67
|
this.resourceParams.ORDER_BY = null;
|
|
68
68
|
this.resourceParams.REVERSE = null;
|
|
69
|
-
yield this.
|
|
69
|
+
yield this.refreshDatasource(params);
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
72
|
else if (toBeAppliedSortModel.length > 0) {
|
|
73
|
+
this.currentSortModel = toBeAppliedSortModel;
|
|
73
74
|
const coldIdBeingSorted = toBeAppliedSortModel[0].colId; // Not allowing multiple sorts by user
|
|
74
75
|
const sortTypeBeingApplied = toBeAppliedSortModel[0].sort;
|
|
75
76
|
const orderByAndToBeSortedColIds = this.getOrderByAndToBeSortedColIds(this.resourceIndexes, coldIdBeingSorted);
|
|
@@ -80,15 +81,13 @@ export class StreamDatasource extends StreamBaseDatasource {
|
|
|
80
81
|
logger.warn('The FIELD/column (${coldIdBeingSorted}) being sorted is not part of an INDEX, required for the [orderBy] operation. See https://learn.genesis.global/docs/database/data-types/index-entities/');
|
|
81
82
|
logger.debug('Available indexes:', availableIndexes);
|
|
82
83
|
logger.debug('Columns that can be sorted with the available indexes:', availableIndexFields);
|
|
83
|
-
(_b = params.api) === null || _b === void 0 ? void 0 : _b.refreshServerSide({ purge: true });
|
|
84
84
|
params.fail();
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
87
|
else if (JSON.stringify(toBeAppliedSortModel) !== JSON.stringify(this.currentSortModel)) {
|
|
88
|
-
this.currentSortModel = toBeAppliedSortModel;
|
|
89
88
|
this.resourceParams.ORDER_BY = orderByAndToBeSortedColIds.orderBy;
|
|
90
89
|
this.resourceParams.REVERSE = sortTypeBeingApplied === 'desc' ? true : false;
|
|
91
|
-
yield this.
|
|
90
|
+
yield this.refreshDatasource(params);
|
|
92
91
|
return;
|
|
93
92
|
}
|
|
94
93
|
}
|
|
@@ -96,55 +95,62 @@ export class StreamDatasource extends StreamBaseDatasource {
|
|
|
96
95
|
if (this.moreRows && params.request.startRow >= Number(this.maxRows)) {
|
|
97
96
|
this.connect.getMoreRows(this.streamSourceRef);
|
|
98
97
|
}
|
|
99
|
-
this.dataserverStream
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
this.moreRows = result.MORE_ROWS;
|
|
108
|
-
if (result.ROW) {
|
|
109
|
-
const nextMessage = dataServerResultFilter(result);
|
|
110
|
-
this.handleCurrentStreamLoad(nextMessage);
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
this.rowData = new Map();
|
|
114
|
-
const successRowData = { rowData: [] };
|
|
115
|
-
successRowData.rowCount = 0;
|
|
116
|
-
params.success(successRowData);
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
this.lastSequenceId = result.SEQUENCE_ID;
|
|
120
|
-
if (this.lastSequenceId === 1) {
|
|
121
|
-
this.streamSourceRef = result.SOURCE_REF;
|
|
122
|
-
this.server_ROWS_COUNT = (_a = result.ROWS_COUNT) !== null && _a !== void 0 ? _a : this.rowData.size;
|
|
123
|
-
}
|
|
124
|
-
const successRowData = {
|
|
125
|
-
rowData: Array.from(this.sortMapByNumericKey(this.rowData).values()),
|
|
126
|
-
rowCount: this.pagination && !this.resourceParams.CRITERIA_MATCH
|
|
127
|
-
? Math.min(this.server_ROWS_COUNT, this.maxView)
|
|
128
|
-
: undefined,
|
|
129
|
-
};
|
|
130
|
-
this.calculatedRowsCount = this.client_ROWS_COUNT;
|
|
131
|
-
if (this.calculatedRowsCount === 0) {
|
|
132
|
-
this.calculatedRowsCount = params.request.endRow;
|
|
133
|
-
}
|
|
134
|
-
if (params.request.endRow > this.maxView ||
|
|
135
|
-
params.request.endRow > this.calculatedRowsCount) {
|
|
136
|
-
successRowData.rowCount = this.calculatedRowsCount;
|
|
137
|
-
}
|
|
138
|
-
else if (params.request.endRow === this.server_ROWS_COUNT) {
|
|
139
|
-
successRowData.rowCount = this.server_ROWS_COUNT;
|
|
140
|
-
}
|
|
141
|
-
else if (!this.moreRows && this.server_ROWS_COUNT > this.calculatedRowsCount) {
|
|
142
|
-
successRowData.rowCount = this.calculatedRowsCount;
|
|
143
|
-
}
|
|
144
|
-
params.success(successRowData);
|
|
98
|
+
if (!this.dataserverStream) {
|
|
99
|
+
this.dataserverStream = yield this.createDataserverStreamFunc(this.resourceParams);
|
|
100
|
+
}
|
|
101
|
+
this.dataserverStreamSubscription = this.dataserverStream
|
|
102
|
+
.pipe(take(1))
|
|
103
|
+
.subscribe((dataserverResult) => {
|
|
104
|
+
this.applyServerSideData(params, dataserverResult);
|
|
145
105
|
});
|
|
146
106
|
});
|
|
147
107
|
}
|
|
108
|
+
applyServerSideData(params, result) {
|
|
109
|
+
var _a;
|
|
110
|
+
const messageType = result.MESSAGE_TYPE;
|
|
111
|
+
if (messageType &&
|
|
112
|
+
(messageType === MessageType.LOGOFF_ACK || messageType === MessageType.MSG_NACK)) {
|
|
113
|
+
params.fail();
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
this.moreRows = result.MORE_ROWS;
|
|
117
|
+
if (result.ROW) {
|
|
118
|
+
const nextMessage = dataServerResultFilter(result);
|
|
119
|
+
this.handleCurrentStreamLoad(nextMessage);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
this.rowData = new Map();
|
|
123
|
+
const successRowData = { rowData: [] };
|
|
124
|
+
successRowData.rowCount = 0;
|
|
125
|
+
params.success(successRowData);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
this.lastSequenceId = result.SEQUENCE_ID;
|
|
129
|
+
if (this.lastSequenceId === 1) {
|
|
130
|
+
this.streamSourceRef = result.SOURCE_REF;
|
|
131
|
+
this.server_ROWS_COUNT = (_a = result.ROWS_COUNT) !== null && _a !== void 0 ? _a : this.rowData.size;
|
|
132
|
+
}
|
|
133
|
+
const successRowData = {
|
|
134
|
+
rowData: Array.from(this.sortMapByNumericKey(this.rowData).values()),
|
|
135
|
+
rowCount: this.pagination && !this.resourceParams.CRITERIA_MATCH
|
|
136
|
+
? Math.min(this.server_ROWS_COUNT, this.maxView)
|
|
137
|
+
: undefined,
|
|
138
|
+
};
|
|
139
|
+
this.calculatedRowsCount = this.client_ROWS_COUNT;
|
|
140
|
+
if (this.calculatedRowsCount === 0) {
|
|
141
|
+
this.calculatedRowsCount = params.request.endRow;
|
|
142
|
+
}
|
|
143
|
+
if (params.request.endRow > this.maxView || params.request.endRow > this.calculatedRowsCount) {
|
|
144
|
+
successRowData.rowCount = this.calculatedRowsCount;
|
|
145
|
+
}
|
|
146
|
+
else if (params.request.endRow === this.server_ROWS_COUNT) {
|
|
147
|
+
successRowData.rowCount = this.server_ROWS_COUNT;
|
|
148
|
+
}
|
|
149
|
+
else if (!this.moreRows && this.server_ROWS_COUNT > this.calculatedRowsCount) {
|
|
150
|
+
successRowData.rowCount = this.calculatedRowsCount;
|
|
151
|
+
}
|
|
152
|
+
params.success(successRowData);
|
|
153
|
+
}
|
|
148
154
|
sortMapByNumericKey(inputMap) {
|
|
149
155
|
// Convert Map to array of key-value pairs
|
|
150
156
|
const sortedArray = Array.from(inputMap.entries()).sort(([key1], [key2]) => +key2 - +key1);
|
|
@@ -161,16 +167,23 @@ export class StreamDatasource extends StreamBaseDatasource {
|
|
|
161
167
|
this.streamSourceRef = undefined;
|
|
162
168
|
});
|
|
163
169
|
}
|
|
164
|
-
|
|
170
|
+
deinit() {
|
|
165
171
|
var _a;
|
|
166
172
|
return __awaiter(this, void 0, void 0, function* () {
|
|
167
|
-
yield this.dataLogoff();
|
|
168
173
|
this.rowData = new Map();
|
|
169
174
|
this.client_ROWS_COUNT = 0;
|
|
170
|
-
|
|
171
|
-
|
|
175
|
+
this.calculatedRowsCount = 0;
|
|
176
|
+
this.server_ROWS_COUNT = 0;
|
|
172
177
|
this.dataserverStream = undefined;
|
|
173
|
-
|
|
178
|
+
(_a = this.dataserverStreamSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
179
|
+
this.dataserverStreamSubscription = undefined;
|
|
180
|
+
yield this.dataLogoff();
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
refreshDatasource(params) {
|
|
184
|
+
var _a;
|
|
185
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
186
|
+
yield this.deinit();
|
|
174
187
|
(_a = params.api) === null || _a === void 0 ? void 0 : _a.refreshServerSide({ purge: true });
|
|
175
188
|
params.fail();
|
|
176
189
|
});
|
|
@@ -342,6 +355,7 @@ let GridProServerSideDatasource = class GridProServerSideDatasource extends Life
|
|
|
342
355
|
deinit() {
|
|
343
356
|
var _a;
|
|
344
357
|
this.clearRowData();
|
|
358
|
+
this.ssrmDatasource.deinit();
|
|
345
359
|
this.ssrmDatasource = undefined;
|
|
346
360
|
this.originalFieldDef = undefined;
|
|
347
361
|
(_a = this.agGrid.gridApi) === null || _a === void 0 ? void 0 : _a.refreshServerSide({ purge: true });
|
|
@@ -361,7 +375,7 @@ let GridProServerSideDatasource = class GridProServerSideDatasource extends Life
|
|
|
361
375
|
}, cacheBlockSize: this.maxRows, defaultColDef: {
|
|
362
376
|
filter: true,
|
|
363
377
|
resizable: true,
|
|
364
|
-
sortable:
|
|
378
|
+
// sortable: false,
|
|
365
379
|
}, pagination: this.pagination, paginationPageSize: this.maxRows, rowBuffer: 0, rowModelType: 'serverSide', suppressServerSideInfiniteScroll: false, suppressMultiSort: true, onFilterChanged: (params) => { }, onSortChanged: (params) => { } }, this.deferredGridOptions);
|
|
366
380
|
this.agGrid.addEventListener('onGridReady', () => __awaiter(this, void 0, void 0, function* () {
|
|
367
381
|
const meta = yield this.connect
|
|
@@ -374,9 +388,8 @@ let GridProServerSideDatasource = class GridProServerSideDatasource extends Life
|
|
|
374
388
|
const fieldMetadata = toFieldMetadata(this.originalFieldDef);
|
|
375
389
|
const agColumnDefs = yield this.getAgColumnDefs(fieldMetadata);
|
|
376
390
|
this.agGrid.gridApi.setColumnDefs(agColumnDefs);
|
|
377
|
-
const dataserverStream = yield this.createDataserverStream();
|
|
378
391
|
this.ssrmDatasource = new StreamDatasource({
|
|
379
|
-
|
|
392
|
+
createDataserverStreamFunc: this.createDataserverStream.bind(this),
|
|
380
393
|
resourceName: this.resourceName,
|
|
381
394
|
resourceParams: this.params,
|
|
382
395
|
resourceIndexes: this.indexes,
|
|
@@ -447,6 +460,9 @@ let GridProServerSideDatasource = class GridProServerSideDatasource extends Life
|
|
|
447
460
|
var _a;
|
|
448
461
|
const messageType = message.MESSAGE_TYPE;
|
|
449
462
|
if (messageType === MessageType.QUERY_UPDATE && message.ROW) {
|
|
463
|
+
if (!this.ssrmDatasource) {
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
450
466
|
const nextMessage = dataServerResultFilter(message);
|
|
451
467
|
this.agTransaction = { add: [], remove: [], update: [] };
|
|
452
468
|
this.handleStreamInserts(nextMessage.inserts);
|
|
@@ -467,7 +483,9 @@ let GridProServerSideDatasource = class GridProServerSideDatasource extends Life
|
|
|
467
483
|
}
|
|
468
484
|
});
|
|
469
485
|
const onError = (error) => logger.error(error);
|
|
470
|
-
return this.connect.stream(this.resourceName,
|
|
486
|
+
return this.connect.stream(this.resourceName, (message) => {
|
|
487
|
+
streamOnMessage(message);
|
|
488
|
+
}, onError, existingParams !== null && existingParams !== void 0 ? existingParams : this.params, false);
|
|
471
489
|
});
|
|
472
490
|
}
|
|
473
491
|
handleStreamDeletesTemp(deletes) {
|
package/dist/grid-pro.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ import type { ServerSideTransaction } from '@ag-grid-community/core';
|
|
|
45
45
|
import type { ServerSideTransactionResult } from '@ag-grid-community/core';
|
|
46
46
|
import { Session } from '@genesislcap/foundation-comms';
|
|
47
47
|
import { SocketObservable } from '@genesislcap/foundation-comms';
|
|
48
|
+
import { SocketSubscription } from '@genesislcap/foundation-comms';
|
|
48
49
|
import { Swatch } from '@microsoft/fast-components';
|
|
49
50
|
import { SwatchRGB } from '@microsoft/fast-components';
|
|
50
51
|
import { TextField } from '@genesislcap/foundation-ui';
|
|
@@ -2851,11 +2852,6 @@ declare const GridProServerSideDatasource_base: (new (...args: any[]) => {
|
|
|
2851
2852
|
ariaReadOnly: string;
|
|
2852
2853
|
ariaRequired: string;
|
|
2853
2854
|
ariaRoleDescription: string;
|
|
2854
|
-
/**
|
|
2855
|
-
* A Genesis Datasource element, for server-side | SSRM-compatible data fetching and used exclusively by the GridPro element.
|
|
2856
|
-
* @remarks Only supports Server-Side Row Model. Requires `@ag-grid-enterprise/server-side-row-model` setup and valid AG Grid Enterprise license.
|
|
2857
|
-
* @alpha
|
|
2858
|
-
*/
|
|
2859
2855
|
ariaRowCount: string;
|
|
2860
2856
|
ariaRowIndex: string;
|
|
2861
2857
|
ariaRowIndexText: string;
|
|
@@ -3228,6 +3224,8 @@ export declare class StreamDatasource extends StreamBaseDatasource implements IS
|
|
|
3228
3224
|
auth: Auth;
|
|
3229
3225
|
connect: Connect;
|
|
3230
3226
|
dataserverStream: SocketObservable<FilteredDataServerResult>;
|
|
3227
|
+
dataserverStreamSubscription: SocketSubscription;
|
|
3228
|
+
createDataserverStreamFunc: (existingParams?: any) => Promise<SocketObservable<FilteredDataServerResult>>;
|
|
3231
3229
|
private resourceName;
|
|
3232
3230
|
resourceParams: any;
|
|
3233
3231
|
private resourceIndexes;
|
|
@@ -3254,9 +3252,11 @@ export declare class StreamDatasource extends StreamBaseDatasource implements IS
|
|
|
3254
3252
|
private currentSortModel;
|
|
3255
3253
|
constructor(options: StreamDatasourceOptions);
|
|
3256
3254
|
getRows(params: IServerSideGetRowsParams): Promise<void>;
|
|
3255
|
+
private applyServerSideData;
|
|
3257
3256
|
private sortMapByNumericKey;
|
|
3258
3257
|
dataLogoff(): Promise<void>;
|
|
3259
|
-
|
|
3258
|
+
deinit(): Promise<void>;
|
|
3259
|
+
private refreshDatasource;
|
|
3260
3260
|
private getOrderByAndToBeSortedColIds;
|
|
3261
3261
|
private handleCurrentStreamLoad;
|
|
3262
3262
|
private buildCriteriaMatchFromFilters;
|
|
@@ -3271,7 +3271,7 @@ export declare class StreamDatasource extends StreamBaseDatasource implements IS
|
|
|
3271
3271
|
* @alpha
|
|
3272
3272
|
*/
|
|
3273
3273
|
export declare type StreamDatasourceOptions = {
|
|
3274
|
-
|
|
3274
|
+
createDataserverStreamFunc: (existingParams?: any) => Promise<SocketObservable<FilteredDataServerResult>>;
|
|
3275
3275
|
resourceName: string;
|
|
3276
3276
|
resourceParams?: any;
|
|
3277
3277
|
resourceIndexes?: Map<string, [string]>;
|
package/docs/api-report.md
CHANGED
|
@@ -51,6 +51,7 @@ import type { ServerSideTransaction } from '@ag-grid-community/core';
|
|
|
51
51
|
import type { ServerSideTransactionResult } from '@ag-grid-community/core';
|
|
52
52
|
import { Session } from '@genesislcap/foundation-comms';
|
|
53
53
|
import { SocketObservable } from '@genesislcap/foundation-comms';
|
|
54
|
+
import { SocketSubscription } from '@genesislcap/foundation-comms';
|
|
54
55
|
import { Swatch } from '@microsoft/fast-components';
|
|
55
56
|
import { SwatchRGB } from '@microsoft/fast-components';
|
|
56
57
|
import { TextField } from '@genesislcap/foundation-ui';
|
|
@@ -1339,10 +1340,16 @@ export class StreamDatasource extends StreamBaseDatasource implements IServerSid
|
|
|
1339
1340
|
// (undocumented)
|
|
1340
1341
|
connect: Connect;
|
|
1341
1342
|
// (undocumented)
|
|
1343
|
+
createDataserverStreamFunc: (existingParams?: any) => Promise<SocketObservable<FilteredDataServerResult>>;
|
|
1344
|
+
// (undocumented)
|
|
1342
1345
|
dataLogoff(): Promise<void>;
|
|
1343
1346
|
// (undocumented)
|
|
1344
1347
|
dataserverStream: SocketObservable<FilteredDataServerResult>;
|
|
1345
1348
|
// (undocumented)
|
|
1349
|
+
dataserverStreamSubscription: SocketSubscription;
|
|
1350
|
+
// (undocumented)
|
|
1351
|
+
deinit(): Promise<void>;
|
|
1352
|
+
// (undocumented)
|
|
1346
1353
|
getRows(params: IServerSideGetRowsParams): Promise<void>;
|
|
1347
1354
|
// (undocumented)
|
|
1348
1355
|
resourceParams: any;
|
|
@@ -1354,7 +1361,7 @@ export class StreamDatasource extends StreamBaseDatasource implements IServerSid
|
|
|
1354
1361
|
|
|
1355
1362
|
// @alpha
|
|
1356
1363
|
export type StreamDatasourceOptions = {
|
|
1357
|
-
|
|
1364
|
+
createDataserverStreamFunc: (existingParams?: any) => Promise<SocketObservable<FilteredDataServerResult>>;
|
|
1358
1365
|
resourceName: string;
|
|
1359
1366
|
resourceParams?: any;
|
|
1360
1367
|
resourceIndexes?: Map<string, [string]>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/grid-pro",
|
|
3
3
|
"description": "Genesis Foundation AG Grid",
|
|
4
|
-
"version": "14.170.
|
|
4
|
+
"version": "14.170.1-alpha-2fe40dd.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -30,20 +30,20 @@
|
|
|
30
30
|
"test:debug": "genx test --debug"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@genesislcap/foundation-testing": "14.170.
|
|
34
|
-
"@genesislcap/genx": "14.170.
|
|
35
|
-
"@genesislcap/rollup-builder": "14.170.
|
|
36
|
-
"@genesislcap/ts-builder": "14.170.
|
|
37
|
-
"@genesislcap/uvu-playwright-builder": "14.170.
|
|
38
|
-
"@genesislcap/vite-builder": "14.170.
|
|
39
|
-
"@genesislcap/webpack-builder": "14.170.
|
|
33
|
+
"@genesislcap/foundation-testing": "14.170.1-alpha-2fe40dd.0",
|
|
34
|
+
"@genesislcap/genx": "14.170.1-alpha-2fe40dd.0",
|
|
35
|
+
"@genesislcap/rollup-builder": "14.170.1-alpha-2fe40dd.0",
|
|
36
|
+
"@genesislcap/ts-builder": "14.170.1-alpha-2fe40dd.0",
|
|
37
|
+
"@genesislcap/uvu-playwright-builder": "14.170.1-alpha-2fe40dd.0",
|
|
38
|
+
"@genesislcap/vite-builder": "14.170.1-alpha-2fe40dd.0",
|
|
39
|
+
"@genesislcap/webpack-builder": "14.170.1-alpha-2fe40dd.0",
|
|
40
40
|
"rimraf": "^3.0.2"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@genesislcap/foundation-comms": "14.170.
|
|
44
|
-
"@genesislcap/foundation-logger": "14.170.
|
|
45
|
-
"@genesislcap/foundation-ui": "14.170.
|
|
46
|
-
"@genesislcap/foundation-utils": "14.170.
|
|
43
|
+
"@genesislcap/foundation-comms": "14.170.1-alpha-2fe40dd.0",
|
|
44
|
+
"@genesislcap/foundation-logger": "14.170.1-alpha-2fe40dd.0",
|
|
45
|
+
"@genesislcap/foundation-ui": "14.170.1-alpha-2fe40dd.0",
|
|
46
|
+
"@genesislcap/foundation-utils": "14.170.1-alpha-2fe40dd.0",
|
|
47
47
|
"@microsoft/fast-colors": "^5.3.1",
|
|
48
48
|
"@microsoft/fast-components": "^2.30.6",
|
|
49
49
|
"@microsoft/fast-element": "^1.12.0",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"access": "public"
|
|
70
70
|
},
|
|
71
71
|
"customElements": "dist/custom-elements.json",
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "9ba958a4c69abeeb2c5a7eb80eec47540d381a74"
|
|
73
73
|
}
|