@genesislcap/grid-pro 14.501.0 → 15.0.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 +14 -618
- package/dist/dts/datasource/base.datasource.d.ts +0 -1
- package/dist/dts/datasource/base.datasource.d.ts.map +1 -1
- package/dist/dts/datasource/base.types.d.ts +0 -1
- package/dist/dts/datasource/base.types.d.ts.map +1 -1
- package/dist/dts/datasource/client-side.datasource.d.ts +1 -1
- package/dist/dts/datasource/server-side.datasource.d.ts +1 -2
- package/dist/dts/datasource/server-side.datasource.d.ts.map +1 -1
- package/dist/dts/datasource/server-side.resource-base.d.ts +1 -10
- package/dist/dts/datasource/server-side.resource-base.d.ts.map +1 -1
- package/dist/dts/datasource/server-side.resource-dataserver.d.ts +1 -2
- package/dist/dts/datasource/server-side.resource-dataserver.d.ts.map +1 -1
- package/dist/dts/datasource/server-side.resource-reqrep.d.ts +2 -2
- package/dist/dts/datasource/server-side.resource-reqrep.d.ts.map +1 -1
- package/dist/dts/grid-pro-beta.d.ts +1 -23
- package/dist/dts/grid-pro-beta.d.ts.map +1 -1
- package/dist/dts/grid-pro-genesis-datasource/datasource-events.types.d.ts +1 -7
- package/dist/dts/grid-pro-genesis-datasource/datasource-events.types.d.ts.map +1 -1
- package/dist/dts/grid-pro-genesis-datasource/grid-pro-genesis-datasource.d.ts +1 -1
- package/dist/dts/grid-pro-genesis-datasource/grid-pro-genesis-datasource.d.ts.map +1 -1
- package/dist/dts/grid-pro.d.ts +1 -23
- package/dist/dts/grid-pro.d.ts.map +1 -1
- package/dist/dts/grid-pro.types.d.ts +0 -1
- package/dist/dts/grid-pro.types.d.ts.map +1 -1
- package/dist/dts/react.d.ts +4 -4
- package/dist/dts/status-bar-components/index.d.ts +0 -1
- package/dist/dts/status-bar-components/index.d.ts.map +1 -1
- package/dist/dts/status-bar-components/load-more.status-bar.d.ts +0 -2
- package/dist/dts/status-bar-components/load-more.status-bar.d.ts.map +1 -1
- package/dist/dts/status-bar-components/row-count.status-bar.d.ts +1 -2
- package/dist/dts/status-bar-components/row-count.status-bar.d.ts.map +1 -1
- package/dist/esm/datasource/base.datasource.js +1 -1
- package/dist/esm/datasource/client-side.datasource.js +1 -1
- package/dist/esm/datasource/server-side.datasource.js +3 -13
- package/dist/esm/datasource/server-side.resource-base.js +1 -26
- package/dist/esm/datasource/server-side.resource-dataserver.js +25 -150
- package/dist/esm/datasource/server-side.resource-reqrep.js +10 -37
- package/dist/esm/grid-pro-beta.js +8 -52
- package/dist/esm/grid-pro-genesis-datasource/grid-pro-genesis-datasource.js +2 -4
- package/dist/esm/grid-pro.js +8 -52
- package/dist/esm/grid-pro.types.js +0 -1
- package/dist/esm/status-bar-components/index.js +0 -1
- package/dist/esm/status-bar-components/load-more.status-bar.js +5 -19
- package/dist/esm/status-bar-components/row-count.status-bar.js +1 -2
- package/dist/grid-pro.api.json +12 -430
- package/dist/grid-pro.d.ts +7 -96
- package/package.json +14 -14
- package/dist/dts/status-bar-components/pagination.status-bar.d.ts +0 -32
- package/dist/dts/status-bar-components/pagination.status-bar.d.ts.map +0 -1
- package/dist/esm/status-bar-components/pagination.status-bar.js +0 -238
|
@@ -83,7 +83,7 @@ const serverSideSortIndicatorCSS = `
|
|
|
83
83
|
* @fires datasource-filters-restored - Fired when persisted filters are reapplied
|
|
84
84
|
* @fires datasource-data-cleared - Fired when server-side row data is cleared. detail: `DataClearedEventDetail`
|
|
85
85
|
* @fires apply-server-side-transaction - Fired to apply a server-side row transaction
|
|
86
|
-
* @fires datasource-ready - Fired when the host grid is ready
|
|
86
|
+
* @fires datasource-ready - Fired when the host grid is ready to start loading data
|
|
87
87
|
*/
|
|
88
88
|
let GridProServerSideDatasource = class GridProServerSideDatasource extends LifecycleMixin(GridProBaseDatasource) {
|
|
89
89
|
constructor() {
|
|
@@ -265,15 +265,13 @@ let GridProServerSideDatasource = class GridProServerSideDatasource extends Life
|
|
|
265
265
|
resizable: true,
|
|
266
266
|
sortable: false,
|
|
267
267
|
unSortIcon: true,
|
|
268
|
-
}, rowBuffer: 0, rowModelType: 'serverSide', suppressServerSideInfiniteScroll: false, suppressMultiSort: true, onFilterChanged: (params) => { }, onSortChanged: (params) => { }
|
|
268
|
+
}, rowBuffer: 0, rowModelType: 'serverSide', suppressServerSideInfiniteScroll: false, suppressMultiSort: true, onFilterChanged: (params) => { }, onSortChanged: (params) => { } }, this.deferredGridOptions);
|
|
269
269
|
this.$emit(datasourceEventNames.initialize, {
|
|
270
270
|
options: gridOptions,
|
|
271
271
|
keepColDefsOnClearRowData: this.keepColDefsOnClearRowData,
|
|
272
272
|
});
|
|
273
273
|
// TODO: refactor this to prevent rendering datasource component until grid is ready
|
|
274
|
-
this.addEventListener(datasourceEventNames.ready, (
|
|
275
|
-
const { pagination } = event.detail;
|
|
276
|
-
this.pagination = pagination;
|
|
274
|
+
this.addEventListener(datasourceEventNames.ready, () => __awaiter(this, void 0, void 0, function* () {
|
|
277
275
|
const initOK = yield this.initializeDatasource(this.datasourceOptions(), true, false);
|
|
278
276
|
if (!initOK) {
|
|
279
277
|
logger.debug(`Genesis Datasource init failed for ${this.resourceName}`);
|
|
@@ -313,7 +311,6 @@ let GridProServerSideDatasource = class GridProServerSideDatasource extends Life
|
|
|
313
311
|
maxRows: +this.maxRows,
|
|
314
312
|
maxView: +this.maxView,
|
|
315
313
|
rowId: this.rowId,
|
|
316
|
-
pagination: this.pagination,
|
|
317
314
|
zeroBasedViewNumber: this.zeroBasedViewNumber,
|
|
318
315
|
pagingMode: this.pagingMode,
|
|
319
316
|
criteriaOnlyRequest: this.datasource.criteriaOnlyRequest,
|
|
@@ -333,7 +330,6 @@ let GridProServerSideDatasource = class GridProServerSideDatasource extends Life
|
|
|
333
330
|
maxRows: +this.maxRows,
|
|
334
331
|
maxView: +this.maxView,
|
|
335
332
|
rowId: this.rowId,
|
|
336
|
-
pagination: this.pagination,
|
|
337
333
|
zeroBasedViewNumber: this.zeroBasedViewNumber,
|
|
338
334
|
});
|
|
339
335
|
}
|
|
@@ -351,12 +347,6 @@ let GridProServerSideDatasource = class GridProServerSideDatasource extends Life
|
|
|
351
347
|
}
|
|
352
348
|
});
|
|
353
349
|
}
|
|
354
|
-
onPaginationChanged(event) {
|
|
355
|
-
var _a;
|
|
356
|
-
if (this.ssrmDatasource) {
|
|
357
|
-
this.ssrmDatasource.isNewPageSize = (_a = event.newPage) !== null && _a !== void 0 ? _a : false;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
350
|
destroy() {
|
|
361
351
|
return __awaiter(this, void 0, void 0, function* () {
|
|
362
352
|
var _a, _b;
|
|
@@ -3,7 +3,7 @@ import { Auth, Connect, logger, } from '@genesislcap/foundation-comms';
|
|
|
3
3
|
import { UUID } from '@genesislcap/foundation-utils';
|
|
4
4
|
/**
|
|
5
5
|
* Base class for server-side resource datasources used in Grid Pro SSRM implementations.
|
|
6
|
-
* Provides common logic for filtering, sorting, and
|
|
6
|
+
* Provides common logic for filtering, sorting, and infinite-scroll row counting.
|
|
7
7
|
*
|
|
8
8
|
* @beta
|
|
9
9
|
*/
|
|
@@ -24,12 +24,6 @@ export class BaseServerSideDatasource {
|
|
|
24
24
|
this.moreRows = false;
|
|
25
25
|
this.calculatedRowsCount = 0;
|
|
26
26
|
this.currentSequenceId = null;
|
|
27
|
-
/**
|
|
28
|
-
* Whether the corrective ROWS_COUNT snapshot() has resolved for the current CRITERIA_MATCH.
|
|
29
|
-
* Reset in destroy() so it re-resolves on filter/sort changes.
|
|
30
|
-
* @internal
|
|
31
|
-
*/
|
|
32
|
-
this.criteriaRowCountResolved = false;
|
|
33
27
|
this.reloadResourceDataFunc = options.reloadResourceDataFunc;
|
|
34
28
|
this.errorHandlerFunc = options.errorHandlerFunc;
|
|
35
29
|
this.onNoDataAvailableFunc = options.onNoDataAvailableFunc;
|
|
@@ -42,7 +36,6 @@ export class BaseServerSideDatasource {
|
|
|
42
36
|
this.maxRows = options.maxRows;
|
|
43
37
|
this.maxView = options.maxView;
|
|
44
38
|
this.rowId = options.rowId;
|
|
45
|
-
this.pagination = options.pagination;
|
|
46
39
|
this.zeroBasedViewNumber = options.zeroBasedViewNumber;
|
|
47
40
|
this.pagingMode = options.pagingMode;
|
|
48
41
|
this.criteriaOnlyRequest = (_a = options.criteriaOnlyRequest) !== null && _a !== void 0 ? _a : false;
|
|
@@ -134,7 +127,6 @@ export class BaseServerSideDatasource {
|
|
|
134
127
|
this.moreRows = false;
|
|
135
128
|
this.sourceRef = undefined;
|
|
136
129
|
this.lastSuccessRowData = undefined;
|
|
137
|
-
this.criteriaRowCountResolved = false;
|
|
138
130
|
}
|
|
139
131
|
refreshDatasource(params) {
|
|
140
132
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -370,27 +362,10 @@ export class BaseServerSideDatasource {
|
|
|
370
362
|
.filter((k) => this.resourceColDefs.findIndex((o) => o.NAME === k) !== -1)
|
|
371
363
|
.filter((k) => this.currentFilterModel[k].filterType === filterType);
|
|
372
364
|
}
|
|
373
|
-
getPageNumber(start, recordsPerPage, totalRecords, zeroBasedViewNumber = true) {
|
|
374
|
-
if (totalRecords !== undefined && start > totalRecords) {
|
|
375
|
-
start = Math.floor((totalRecords - 1) / recordsPerPage) * recordsPerPage + 1;
|
|
376
|
-
}
|
|
377
|
-
const currentPageIndex = Math.ceil(start / recordsPerPage);
|
|
378
|
-
return zeroBasedViewNumber ? currentPageIndex : currentPageIndex + 1;
|
|
379
|
-
}
|
|
380
365
|
getCorrectRowCount(params) {
|
|
381
366
|
const currentLastRowNumber = params.request.endRow;
|
|
382
367
|
this.calculatedRowsCount = this.clientRowsCount || currentLastRowNumber;
|
|
383
|
-
const defaultCount = Math.min(this.serverRowsCount, this.maxView);
|
|
384
368
|
let rowCount;
|
|
385
|
-
const criteriaMatch = this.getResourceParam('CRITERIA_MATCH');
|
|
386
|
-
if (this.pagination) {
|
|
387
|
-
rowCount = !criteriaMatch ? Math.min(this.serverRowsCount, this.maxView) : undefined;
|
|
388
|
-
if (criteriaMatch) {
|
|
389
|
-
const loadedCount = this.rowData.size;
|
|
390
|
-
rowCount = loadedCount > 0 ? Math.min(loadedCount, this.maxView) : defaultCount;
|
|
391
|
-
}
|
|
392
|
-
return rowCount;
|
|
393
|
-
}
|
|
394
369
|
// Infinite scroll: getRows() only resolves a block once the cumulative row cache covers
|
|
395
370
|
// its full extent or the stream reported no more data, so blocks are either full or final.
|
|
396
371
|
if (!this.moreRows) {
|
|
@@ -17,7 +17,7 @@ export class DataserverServerSideDatasource extends BaseServerSideDatasource {
|
|
|
17
17
|
*/
|
|
18
18
|
this.pendingBlocks = new Set();
|
|
19
19
|
/**
|
|
20
|
-
* Highest absolute row index already handed to AG Grid this session
|
|
20
|
+
* Highest absolute row index already handed to AG Grid this session.
|
|
21
21
|
* Live DELETEs below this watermark must not remove cache entries - see
|
|
22
22
|
* handleCurrentStreamLoad.
|
|
23
23
|
* @internal
|
|
@@ -41,7 +41,6 @@ export class DataserverServerSideDatasource extends BaseServerSideDatasource {
|
|
|
41
41
|
}
|
|
42
42
|
getRows(params) {
|
|
43
43
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
var _a, _b;
|
|
45
44
|
// setupFiltering()/setupSorting() return true when they triggered a refresh: the
|
|
46
45
|
// datasource was re-initialized and AG Grid's SSRM cache purged, so getRows() is
|
|
47
46
|
// re-invoked with fresh params and this invocation is superseded. It must still resolve
|
|
@@ -57,14 +56,6 @@ export class DataserverServerSideDatasource extends BaseServerSideDatasource {
|
|
|
57
56
|
params.fail();
|
|
58
57
|
return;
|
|
59
58
|
}
|
|
60
|
-
if (this.pagination && !this.isNewPageSize && this.currentSequenceId > 0) {
|
|
61
|
-
const requestFilter = JSON.stringify((_a = params.request.filterModel) !== null && _a !== void 0 ? _a : {});
|
|
62
|
-
const currentFilter = JSON.stringify((_b = this.currentFilterModel) !== null && _b !== void 0 ? _b : {});
|
|
63
|
-
if (requestFilter === currentFilter && this.lastSuccessRowData) {
|
|
64
|
-
params.success(this.lastSuccessRowData);
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
59
|
if (!this.dataserverStream) {
|
|
69
60
|
this.dataserverStream = yield this.createDataserverStreamFunc(this.resourceParams);
|
|
70
61
|
}
|
|
@@ -77,23 +68,13 @@ export class DataserverServerSideDatasource extends BaseServerSideDatasource {
|
|
|
77
68
|
// Infinite scroll keeps a session-cumulative row cache (see handleCurrentStreamLoad);
|
|
78
69
|
// when it already covers this block, or the stream ended, no further stream messages
|
|
79
70
|
// will arrive for this request - resolve it synchronously from the cache.
|
|
80
|
-
const blockAlreadyCovered =
|
|
81
|
-
this.currentSequenceId >= 1 &&
|
|
82
|
-
(this.rowData.size >= blockEndRow || !this.moreRows);
|
|
71
|
+
const blockAlreadyCovered = this.currentSequenceId >= 1 && (this.rowData.size >= blockEndRow || !this.moreRows);
|
|
83
72
|
if (this.currentSequenceId >= 1 &&
|
|
84
73
|
!blockAlreadyCovered &&
|
|
85
74
|
(this.moreRows || params.request.startRow >= Number(this.maxRows))) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
: 0;
|
|
90
|
-
this.resourceParams.VIEW_NUMBER = this.getPageNumber(startRow, this.maxRows, this.maxView, this.zeroBasedViewNumber);
|
|
91
|
-
}
|
|
92
|
-
const viewNumber = this.pagination
|
|
93
|
-
? this.resourceParams.VIEW_NUMBER
|
|
94
|
-
: Number.isFinite(Number(this.resourceParams.VIEW_NUMBER))
|
|
95
|
-
? Number(this.resourceParams.VIEW_NUMBER)
|
|
96
|
-
: 0;
|
|
75
|
+
const viewNumber = Number.isFinite(Number(this.resourceParams.VIEW_NUMBER))
|
|
76
|
+
? Number(this.resourceParams.VIEW_NUMBER)
|
|
77
|
+
: 0;
|
|
97
78
|
if (Number.isFinite(viewNumber)) {
|
|
98
79
|
this.connect.getMoreRows(this.sourceRef, viewNumber);
|
|
99
80
|
}
|
|
@@ -118,14 +99,12 @@ export class DataserverServerSideDatasource extends BaseServerSideDatasource {
|
|
|
118
99
|
applyResult = false;
|
|
119
100
|
clearSafetyTimer(timer);
|
|
120
101
|
settleBlock();
|
|
121
|
-
|
|
122
|
-
this.deliveredRowCount = Math.max(this.deliveredRowCount, blockEndRow);
|
|
123
|
-
}
|
|
102
|
+
this.deliveredRowCount = Math.max(this.deliveredRowCount, blockEndRow);
|
|
124
103
|
const allRows = Array.from(this.rowData.values());
|
|
125
104
|
const successRowData = {
|
|
126
|
-
//
|
|
127
|
-
//
|
|
128
|
-
rowData:
|
|
105
|
+
// Deliver only this block's slice of the cache - AG Grid SSRM expects exactly the
|
|
106
|
+
// rows for its startRow..endRow range.
|
|
107
|
+
rowData: allRows.slice(blockStartRow, blockEndRow),
|
|
129
108
|
};
|
|
130
109
|
successRowData.rowCount = this.getCorrectRowCount(params);
|
|
131
110
|
this.lastSuccessRowData = successRowData;
|
|
@@ -155,7 +134,6 @@ export class DataserverServerSideDatasource extends BaseServerSideDatasource {
|
|
|
155
134
|
}, DataserverServerSideDatasource.BLOCK_RESOLVE_TIMEOUT_MS);
|
|
156
135
|
pendingBlock.cancel = () => failBlock(safetyTimer);
|
|
157
136
|
pendingBlock.handle = (dataserverResult) => {
|
|
158
|
-
var _a;
|
|
159
137
|
const messageType = dataserverResult === null || dataserverResult === void 0 ? void 0 : dataserverResult.MESSAGE_TYPE;
|
|
160
138
|
if (messageType &&
|
|
161
139
|
(messageType === MessageType.LOGOFF_ACK || messageType === MessageType.MSG_NACK)) {
|
|
@@ -168,52 +146,6 @@ export class DataserverServerSideDatasource extends BaseServerSideDatasource {
|
|
|
168
146
|
failBlock(safetyTimer);
|
|
169
147
|
return;
|
|
170
148
|
}
|
|
171
|
-
if (this.pagination) {
|
|
172
|
-
const incomingRowCount = (_a = dataserverResult === null || dataserverResult === void 0 ? void 0 : dataserverResult.ROW) === null || _a === void 0 ? void 0 : _a.length;
|
|
173
|
-
const shouldApply = applyResult || (incomingRowCount > 0 && this.rowData.size === 0);
|
|
174
|
-
if (!shouldApply) {
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
// Paginated mode keeps the original behaviour: each message resolves the request
|
|
178
|
-
// (page swap).
|
|
179
|
-
DOM.queueUpdate(() => __awaiter(this, void 0, void 0, function* () {
|
|
180
|
-
var _a, _b;
|
|
181
|
-
if (!applyResult && !(incomingRowCount > 0 && this.rowData.size === 0)) {
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
// Claim the block synchronously, before the await below, so a concurrently queued
|
|
185
|
-
// update sees applyResult === false and bails - and so applyResult is never
|
|
186
|
-
// reassigned based on a value read before an await (require-atomic-updates).
|
|
187
|
-
applyResult = false;
|
|
188
|
-
clearSafetyTimer(safetyTimer);
|
|
189
|
-
// TODO: this is a bit of hack, due GSF not returning a different ROWS_COUNT when there is a CRITERIA_MATCH
|
|
190
|
-
if (this.resourceParams.CRITERIA_MATCH && !this.criteriaRowCountResolved) {
|
|
191
|
-
const updatedInfo = yield this.connect.snapshot(this.resourceName, {
|
|
192
|
-
MAX_ROWS: this.maxView,
|
|
193
|
-
MAX_VIEW: this.maxView,
|
|
194
|
-
CRITERIA_MATCH: this.resourceParams.CRITERIA_MATCH,
|
|
195
|
-
});
|
|
196
|
-
if (!updatedInfo.ROW && !updatedInfo.ROWS_COUNT) {
|
|
197
|
-
logger.warn('No data returned when criteria is applied.');
|
|
198
|
-
this.serverRowsCount = 0;
|
|
199
|
-
this.clientRowsCount = 0;
|
|
200
|
-
}
|
|
201
|
-
else {
|
|
202
|
-
// ROWS_COUNT ignores CRITERIA_MATCH and ROW.length is capped at page size;
|
|
203
|
-
// Math.max may over-report (self-corrects when the stream ends) but never
|
|
204
|
-
// under-reports, which would make AG Grid stop requesting blocks.
|
|
205
|
-
const rowsCount = (_a = updatedInfo.ROWS_COUNT) !== null && _a !== void 0 ? _a : 0;
|
|
206
|
-
const rowLength = (_b = updatedInfo.ROW) === null || _b === void 0 ? void 0 : _b.length;
|
|
207
|
-
this.serverRowsCount =
|
|
208
|
-
rowLength !== undefined ? Math.max(rowsCount, rowLength) : rowsCount;
|
|
209
|
-
this.criteriaRowCountResolved = true;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
this.applyServerSideData(params, dataserverResult);
|
|
213
|
-
settleBlock();
|
|
214
|
-
}));
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
149
|
if (!applyResult) {
|
|
218
150
|
return;
|
|
219
151
|
}
|
|
@@ -268,19 +200,17 @@ export class DataserverServerSideDatasource extends BaseServerSideDatasource {
|
|
|
268
200
|
}
|
|
269
201
|
return;
|
|
270
202
|
}
|
|
271
|
-
if (
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
this.serverRowsCount = (_a = dataserverResult.ROWS_COUNT) !== null && _a !== void 0 ? _a : this.rowData.size;
|
|
283
|
-
}
|
|
203
|
+
if ((dataserverResult === null || dataserverResult === void 0 ? void 0 : dataserverResult.MORE_ROWS) !== undefined) {
|
|
204
|
+
this.moreRows = dataserverResult.MORE_ROWS;
|
|
205
|
+
}
|
|
206
|
+
if (dataserverResult === null || dataserverResult === void 0 ? void 0 : dataserverResult.ROW) {
|
|
207
|
+
const nextMessage = dataServerResultFilter(dataserverResult, this.rowId);
|
|
208
|
+
this.handleCurrentStreamLoad(nextMessage);
|
|
209
|
+
this.currentSequenceId = dataserverResult.SEQUENCE_ID;
|
|
210
|
+
if (this.currentSequenceId === 1) {
|
|
211
|
+
this.sourceRef = dataserverResult.SOURCE_REF;
|
|
212
|
+
if (this.serverRowsCount === 0) {
|
|
213
|
+
this.serverRowsCount = (_a = dataserverResult.ROWS_COUNT) !== null && _a !== void 0 ? _a : this.rowData.size;
|
|
284
214
|
}
|
|
285
215
|
}
|
|
286
216
|
}
|
|
@@ -288,61 +218,6 @@ export class DataserverServerSideDatasource extends BaseServerSideDatasource {
|
|
|
288
218
|
block.handle(dataserverResult);
|
|
289
219
|
}
|
|
290
220
|
}
|
|
291
|
-
applyServerSideData(params, result) {
|
|
292
|
-
var _a;
|
|
293
|
-
const messageType = result.MESSAGE_TYPE;
|
|
294
|
-
if (messageType &&
|
|
295
|
-
(messageType === MessageType.LOGOFF_ACK || messageType === MessageType.MSG_NACK)) {
|
|
296
|
-
// Trigger error dialog for connection/authentication errors
|
|
297
|
-
if (this.errorHandlerFunc) {
|
|
298
|
-
const errorMessage = messageType === MessageType.LOGOFF_ACK
|
|
299
|
-
? `Connection lost to ${this.resourceName}`
|
|
300
|
-
: `Authentication failed for ${this.resourceName}`;
|
|
301
|
-
this.errorHandlerFunc(errorMessage, 'connection');
|
|
302
|
-
}
|
|
303
|
-
params.fail();
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
this.moreRows = result.MORE_ROWS;
|
|
307
|
-
if (result.ROW) {
|
|
308
|
-
const nextMessage = dataServerResultFilter(result, this.rowId);
|
|
309
|
-
this.handleCurrentStreamLoad(nextMessage);
|
|
310
|
-
}
|
|
311
|
-
else {
|
|
312
|
-
// An empty stream message arrived while we still hold previously loaded rows.
|
|
313
|
-
// Keep showing those rows, but always resolve the AG Grid request — returning
|
|
314
|
-
// without calling params.success/fail leaves the SSRM block stuck in a
|
|
315
|
-
// perpetual loading state. Follow-up to PR #2327.
|
|
316
|
-
if (this.currentSequenceId >= 1 && this.rowData.size > 0) {
|
|
317
|
-
const retainedRowData = {
|
|
318
|
-
rowData: Array.from(this.rowData.values()),
|
|
319
|
-
rowCount: this.getCorrectRowCount(params),
|
|
320
|
-
};
|
|
321
|
-
this.lastSuccessRowData = retainedRowData;
|
|
322
|
-
params.success(retainedRowData);
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
325
|
-
this.completeEmptyResult(params);
|
|
326
|
-
return;
|
|
327
|
-
}
|
|
328
|
-
this.currentSequenceId = result.SEQUENCE_ID;
|
|
329
|
-
if (this.currentSequenceId === 1) {
|
|
330
|
-
this.sourceRef = result.SOURCE_REF;
|
|
331
|
-
if (this.serverRowsCount === 0) {
|
|
332
|
-
this.serverRowsCount = (_a = result.ROWS_COUNT) !== null && _a !== void 0 ? _a : this.rowData.size;
|
|
333
|
-
}
|
|
334
|
-
// Deliberately not overriding serverRowsCount with ROW.length under CRITERIA_MATCH:
|
|
335
|
-
// ROW.length is just the first batch's size and clobbered the corrected count from
|
|
336
|
-
// the snapshot() workaround in getRows().
|
|
337
|
-
}
|
|
338
|
-
const successRowData = {
|
|
339
|
-
rowData: Array.from(this.rowData.values()),
|
|
340
|
-
};
|
|
341
|
-
successRowData.rowCount = this.getCorrectRowCount(params);
|
|
342
|
-
this.lastSuccessRowData = successRowData;
|
|
343
|
-
params.success(successRowData);
|
|
344
|
-
this.notifyNoDataAvailableIfEmpty(params, successRowData);
|
|
345
|
-
}
|
|
346
221
|
/**
|
|
347
222
|
* Dataserver-specific sorting setup that validates columns are part of an index.
|
|
348
223
|
* This is required because dataserver needs indexed columns for efficient sorting.
|
|
@@ -422,10 +297,10 @@ export class DataserverServerSideDatasource extends BaseServerSideDatasource {
|
|
|
422
297
|
var _a, _b, _c, _d, _e;
|
|
423
298
|
if (!result)
|
|
424
299
|
return;
|
|
425
|
-
//
|
|
426
|
-
//
|
|
427
|
-
//
|
|
428
|
-
const rows =
|
|
300
|
+
// Infinite scroll accumulates a session-cumulative cache, as GSF splits batches across
|
|
301
|
+
// messages and later batches append. Map preserves insertion order, so the cache can be
|
|
302
|
+
// sliced by block range.
|
|
303
|
+
const rows = new Map(this.rowData);
|
|
429
304
|
(_a = result.inserts) === null || _a === void 0 ? void 0 : _a.forEach((insertData) => {
|
|
430
305
|
rows.set(insertData[this.rowId], insertData);
|
|
431
306
|
});
|
|
@@ -446,7 +321,7 @@ export class DataserverServerSideDatasource extends BaseServerSideDatasource {
|
|
|
446
321
|
}
|
|
447
322
|
// Rows already handed to AG Grid sit at fixed absolute indices; removing them from
|
|
448
323
|
// the cumulative cache would shift slice() offsets for later blocks.
|
|
449
|
-
if (
|
|
324
|
+
if (this.deliveredRowCount > 0) {
|
|
450
325
|
let index = 0;
|
|
451
326
|
for (const mapKey of rows.keys()) {
|
|
452
327
|
if (mapKey === key) {
|
|
@@ -49,13 +49,9 @@ export class ReqRepServerSideDatasource extends BaseServerSideDatasource {
|
|
|
49
49
|
params.fail();
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
|
-
if (this.pagination && !this.isNewPageSize && this.currentSequenceId > 0) {
|
|
53
|
-
params.success(this.lastSuccessRowData);
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
52
|
const effectivePagingMode = this.getEffectivePagingMode();
|
|
57
|
-
//
|
|
58
|
-
this.
|
|
53
|
+
// Advance the view/offset position based on paging mode
|
|
54
|
+
this.advancePagingPosition(params, effectivePagingMode);
|
|
59
55
|
const requestParams = {
|
|
60
56
|
DETAILS: this.buildRequestDetails(effectivePagingMode),
|
|
61
57
|
};
|
|
@@ -69,18 +65,12 @@ export class ReqRepServerSideDatasource extends BaseServerSideDatasource {
|
|
|
69
65
|
});
|
|
70
66
|
}
|
|
71
67
|
/**
|
|
72
|
-
*
|
|
68
|
+
* Advance the view/offset position based on paging mode
|
|
73
69
|
*/
|
|
74
|
-
|
|
70
|
+
advancePagingPosition(params, effectivePagingMode) {
|
|
75
71
|
if (effectivePagingMode === 'viewBased') {
|
|
76
72
|
if (this.currentSequenceId !== null && this.currentSequenceId >= 0 && this.moreRows) {
|
|
77
|
-
|
|
78
|
-
this.resourceParams.DETAILS.VIEW_NUMBER = this.getPageNumber(params.request.startRow, this.maxRows, undefined, // Don't pass maxView as totalRecords since it's not a valid total count
|
|
79
|
-
this.zeroBasedViewNumber);
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
this.resourceParams.DETAILS.VIEW_NUMBER += 1;
|
|
83
|
-
}
|
|
73
|
+
this.resourceParams.DETAILS.VIEW_NUMBER += 1;
|
|
84
74
|
}
|
|
85
75
|
}
|
|
86
76
|
else {
|
|
@@ -133,7 +123,7 @@ export class ReqRepServerSideDatasource extends BaseServerSideDatasource {
|
|
|
133
123
|
}
|
|
134
124
|
}
|
|
135
125
|
applyServerSideData(params, result, isLastView) {
|
|
136
|
-
var _a, _b
|
|
126
|
+
var _a, _b;
|
|
137
127
|
const messageType = result.MESSAGE_TYPE;
|
|
138
128
|
if (messageType &&
|
|
139
129
|
(messageType === MessageType.LOGOFF_ACK || messageType === MessageType.MSG_NACK)) {
|
|
@@ -189,13 +179,7 @@ export class ReqRepServerSideDatasource extends BaseServerSideDatasource {
|
|
|
189
179
|
const currentBatchSize = this.rowData.size;
|
|
190
180
|
this.discoveredTotalRowCount = params.request.startRow + currentBatchSize;
|
|
191
181
|
}
|
|
192
|
-
|
|
193
|
-
if (this.pagination) {
|
|
194
|
-
this.serverRowsCount = (_b = result.ROWS_COUNT) !== null && _b !== void 0 ? _b : this.rowData.size;
|
|
195
|
-
}
|
|
196
|
-
else {
|
|
197
|
-
this.serverRowsCount += (_c = result.ROWS_COUNT) !== null && _c !== void 0 ? _c : this.rowData.size;
|
|
198
|
-
}
|
|
182
|
+
this.serverRowsCount += (_b = result.ROWS_COUNT) !== null && _b !== void 0 ? _b : this.rowData.size;
|
|
199
183
|
const successRowData = {
|
|
200
184
|
rowData: Array.from(this.rowData.values()),
|
|
201
185
|
};
|
|
@@ -206,23 +190,12 @@ export class ReqRepServerSideDatasource extends BaseServerSideDatasource {
|
|
|
206
190
|
}
|
|
207
191
|
getCorrectRowCount(params) {
|
|
208
192
|
let rowCount;
|
|
209
|
-
if (this.pagination) {
|
|
210
|
-
if (this.moreRows) {
|
|
211
|
-
// More data available, return -1 to indicate unknown total
|
|
212
|
-
rowCount = -1;
|
|
213
|
-
}
|
|
214
|
-
else {
|
|
215
|
-
// Use discovered total if available, otherwise calculate from current position
|
|
216
|
-
rowCount = this.discoveredTotalRowCount || params.request.startRow + this.rowData.size;
|
|
217
|
-
}
|
|
218
|
-
return rowCount;
|
|
219
|
-
}
|
|
220
|
-
// Non-pagination mode (streaming)
|
|
221
193
|
if (this.moreRows) {
|
|
222
|
-
|
|
194
|
+
// More data available, return -1 to indicate unknown total
|
|
195
|
+
rowCount = -1;
|
|
223
196
|
}
|
|
224
197
|
else {
|
|
225
|
-
// Use discovered total
|
|
198
|
+
// Use discovered total if available, otherwise calculate from current position
|
|
226
199
|
rowCount = this.discoveredTotalRowCount || params.request.startRow + this.rowData.size;
|
|
227
200
|
}
|
|
228
201
|
return rowCount;
|
|
@@ -18,7 +18,7 @@ import { datasourceEventNames, } from './grid-pro-genesis-datasource/datasource-
|
|
|
18
18
|
import { AG_PROPERTIES, copyAttributesToGridOptions, DEBOUNCED_RESIZE_TIME, gridProErrorNames, gridProEventNames, } from './grid-pro.definitions';
|
|
19
19
|
import { DEFAULT_STATUS_BAR_CONFIG, EDITED_COLUMN_FIELD, ERROR_COLUMN_FIELD, GRID_READY_EVENT, GridOptionsConfig, GridProRendererTypes, GridProStatusBarTypes, } from './grid-pro.types';
|
|
20
20
|
import { StatePersistence } from './state-persistence';
|
|
21
|
-
import { LabelValueStatusBarComponent, LoadMoreStatusBarComponent,
|
|
21
|
+
import { LabelValueStatusBarComponent, LoadMoreStatusBarComponent, ReloadStatusBarComponent, RowCountStatusBarComponent, } from './status-bar-components';
|
|
22
22
|
import { ErrorTooltip } from './tooltips';
|
|
23
23
|
import { convertToKebabCase, logger, mergeAndDedupColDefWithColumnState, sanitizeColumnState, } from './utils';
|
|
24
24
|
avoidTreeShaking(GridProGenesisDatasource, GridProClientSideDatasource, GridProServerSideDatasource, GridProCell, GridProColumn);
|
|
@@ -116,17 +116,6 @@ export class GridProBeta extends LifecycleMixin(FoundationElement) {
|
|
|
116
116
|
this.enableRowFlashing = false;
|
|
117
117
|
this.columnComponentName = 'grid-pro-column';
|
|
118
118
|
this.themeMode = 'dark';
|
|
119
|
-
/**
|
|
120
|
-
* Enable pagination for the grid.
|
|
121
|
-
* @remarks
|
|
122
|
-
* When enabled, the grid will automatically configure pagination settings.
|
|
123
|
-
* Note that AG Grid's full pagination functionality requires the Enterprise module.
|
|
124
|
-
* While basic pagination will work in Community edition, advanced features like
|
|
125
|
-
* custom pagination components require Enterprise.
|
|
126
|
-
* @see https://www.ag-grid.com/javascript-data-grid/row-pagination/
|
|
127
|
-
* @see https://www.ag-grid.com/javascript-data-grid/server-side-model-pagination/
|
|
128
|
-
*/
|
|
129
|
-
this.pagination = false;
|
|
130
119
|
/**
|
|
131
120
|
* Configuration for the grid status bar components.
|
|
132
121
|
* @remarks
|
|
@@ -296,9 +285,6 @@ export class GridProBeta extends LifecycleMixin(FoundationElement) {
|
|
|
296
285
|
});
|
|
297
286
|
// Add datasource event listeners
|
|
298
287
|
this.toggleDatasourceEventListeners(true);
|
|
299
|
-
this.paginationPageSize = this.isServerSide
|
|
300
|
-
? this.gridProDatasource.maxRows
|
|
301
|
-
: DatasourceDefaults.DEFAULT_PAGINATION_PAGE_SIZE;
|
|
302
288
|
}
|
|
303
289
|
disconnectedCallback() {
|
|
304
290
|
var _a;
|
|
@@ -634,7 +620,6 @@ export class GridProBeta extends LifecycleMixin(FoundationElement) {
|
|
|
634
620
|
[GridProRendererTypes.stringEditor]: StringEditor,
|
|
635
621
|
[GridProStatusBarTypes.labelValue]: LabelValueStatusBarComponent,
|
|
636
622
|
[GridProStatusBarTypes.loadMore]: LoadMoreStatusBarComponent,
|
|
637
|
-
[GridProStatusBarTypes.pagination]: PaginationStatusBarComponent,
|
|
638
623
|
[GridProStatusBarTypes.reload]: ReloadStatusBarComponent,
|
|
639
624
|
[GridProStatusBarTypes.rowCount]: RowCountStatusBarComponent,
|
|
640
625
|
};
|
|
@@ -949,9 +934,7 @@ export class GridProBeta extends LifecycleMixin(FoundationElement) {
|
|
|
949
934
|
this.notifyDatasourceVisibleColumns();
|
|
950
935
|
// TODO: prevent rendering datasource slot until grid is ready
|
|
951
936
|
// so there is no need for this even and handling it in datasources
|
|
952
|
-
(_c = this.gridProDatasource) === null || _c === void 0 ? void 0 : _c.$emit(datasourceEventNames.ready
|
|
953
|
-
pagination: this.pagination,
|
|
954
|
-
});
|
|
937
|
+
(_c = this.gridProDatasource) === null || _c === void 0 ? void 0 : _c.$emit(datasourceEventNames.ready);
|
|
955
938
|
this.restoreColumnState();
|
|
956
939
|
this.restoreCachedFilterConfig();
|
|
957
940
|
this.debouncedColumnAutosize();
|
|
@@ -986,7 +969,7 @@ export class GridProBeta extends LifecycleMixin(FoundationElement) {
|
|
|
986
969
|
if (this.gridProDatasource) {
|
|
987
970
|
derivedOptions.columnDefs = columnDefs;
|
|
988
971
|
derivedOptions.getRowId = getRowId;
|
|
989
|
-
this.
|
|
972
|
+
this.setupStatusBar(derivedOptions);
|
|
990
973
|
this.setLocalGridOptions(derivedOptions);
|
|
991
974
|
}
|
|
992
975
|
else {
|
|
@@ -996,7 +979,7 @@ export class GridProBeta extends LifecycleMixin(FoundationElement) {
|
|
|
996
979
|
}
|
|
997
980
|
derivedOptions.columnDefs = value;
|
|
998
981
|
derivedOptions.getRowId = getRowId;
|
|
999
|
-
this.
|
|
982
|
+
this.setupStatusBar(derivedOptions);
|
|
1000
983
|
this.setLocalGridOptions(derivedOptions);
|
|
1001
984
|
this.initGrid();
|
|
1002
985
|
});
|
|
@@ -1132,13 +1115,11 @@ export class GridProBeta extends LifecycleMixin(FoundationElement) {
|
|
|
1132
1115
|
return panels.some((panel) => panel.statusPanel === statusPanelType);
|
|
1133
1116
|
}
|
|
1134
1117
|
addRowCountPanel(statusPanels, gridOptions) {
|
|
1135
|
-
//
|
|
1136
|
-
//
|
|
1137
|
-
// where pagination is disabled.
|
|
1118
|
+
// The custom rowCount panel is used for server-side infinite scroll (load more) scenarios;
|
|
1119
|
+
// client-side row models use AG Grid's own row count component instead.
|
|
1138
1120
|
if (this.statusBarConfig && this.statusBarConfig.rows === true) {
|
|
1139
1121
|
const isServerSide = this.isServerSide || (gridOptions === null || gridOptions === void 0 ? void 0 : gridOptions.rowModelType) === 'serverSide';
|
|
1140
|
-
|
|
1141
|
-
if (isServerSide && !isPaginationEnabled) {
|
|
1122
|
+
if (isServerSide) {
|
|
1142
1123
|
if (!this.panelExists(GridProStatusBarTypes.rowCount, statusPanels)) {
|
|
1143
1124
|
statusPanels.push({
|
|
1144
1125
|
statusPanel: GridProStatusBarTypes.rowCount,
|
|
@@ -1190,25 +1171,10 @@ export class GridProBeta extends LifecycleMixin(FoundationElement) {
|
|
|
1190
1171
|
statusPanels.push(...newDatasourcePanels);
|
|
1191
1172
|
}
|
|
1192
1173
|
}
|
|
1193
|
-
|
|
1194
|
-
if (this['_pagination']) {
|
|
1195
|
-
if (!this.panelExists(GridProStatusBarTypes.pagination, statusPanels)) {
|
|
1196
|
-
statusPanels.push({
|
|
1197
|
-
statusPanel: GridProStatusBarTypes.pagination,
|
|
1198
|
-
align: 'right',
|
|
1199
|
-
});
|
|
1200
|
-
}
|
|
1201
|
-
}
|
|
1202
|
-
}
|
|
1203
|
-
setupPaginationAndStatusBar(gridOptions) {
|
|
1174
|
+
setupStatusBar(gridOptions) {
|
|
1204
1175
|
// Keep the guard for production code, but allow override for testing
|
|
1205
1176
|
// if (this.initialised && !allowDuplicateCheck) return;
|
|
1206
1177
|
var _a, _b;
|
|
1207
|
-
if (this['_pagination']) {
|
|
1208
|
-
gridOptions.pagination = true;
|
|
1209
|
-
gridOptions.suppressScrollOnNewData = true;
|
|
1210
|
-
gridOptions.paginationPageSize = this.paginationPageSize;
|
|
1211
|
-
}
|
|
1212
1178
|
// Set default status bar with components based on configuration
|
|
1213
1179
|
if (this.withStatusBar && this.statusBarConfig) {
|
|
1214
1180
|
// For duplicate checking (testing scenario), clear existing status panels to prevent duplicates
|
|
@@ -1219,10 +1185,6 @@ export class GridProBeta extends LifecycleMixin(FoundationElement) {
|
|
|
1219
1185
|
this.addMaxRowsPanel(statusPanels);
|
|
1220
1186
|
this.addAggregationPanel(statusPanels);
|
|
1221
1187
|
this.addDatasourcePanels(statusPanels);
|
|
1222
|
-
if (this['_pagination']) {
|
|
1223
|
-
gridOptions.suppressPaginationPanel = true;
|
|
1224
|
-
this.addPaginationPanel(statusPanels);
|
|
1225
|
-
}
|
|
1226
1188
|
const userDefinedStatusPanels = ((_b = gridOptions.statusBar) === null || _b === void 0 ? void 0 : _b.statusPanels) || [];
|
|
1227
1189
|
const newUserDefinedPanels = userDefinedStatusPanels.filter((panel) => !this.panelExists(panel.statusPanel, statusPanels));
|
|
1228
1190
|
statusPanels.push(...newUserDefinedPanels);
|
|
@@ -1332,12 +1294,6 @@ __decorate([
|
|
|
1332
1294
|
__decorate([
|
|
1333
1295
|
observable
|
|
1334
1296
|
], GridProBeta.prototype, "gridComponents", void 0);
|
|
1335
|
-
__decorate([
|
|
1336
|
-
attr({ mode: 'boolean' })
|
|
1337
|
-
], GridProBeta.prototype, "pagination", void 0);
|
|
1338
|
-
__decorate([
|
|
1339
|
-
attr({ attribute: 'pagination-page-size' })
|
|
1340
|
-
], GridProBeta.prototype, "paginationPageSize", void 0);
|
|
1341
1297
|
__decorate([
|
|
1342
1298
|
observable
|
|
1343
1299
|
], GridProBeta.prototype, "statusBarConfig", void 0);
|
|
@@ -30,7 +30,7 @@ const withoutColumnDefs = null;
|
|
|
30
30
|
* @fires datasource-data-loaded - Fired when a data payload is loaded for the grid. detail: `DataLoadedEventDetail`
|
|
31
31
|
* @fires datasource-loading-started - Fired when a load or refresh starts
|
|
32
32
|
* @fires datasource-more-data-available - Fired when more server rows can be requested. detail: `MoreDataAvailableEventDetail`
|
|
33
|
-
* @fires datasource-ready - Fired when the host grid is ready
|
|
33
|
+
* @fires datasource-ready - Fired when the host grid is ready to start loading data
|
|
34
34
|
* @fires datasource-init - Fired when initial grid data is ready for the client-side model
|
|
35
35
|
* @fires more-rows-changed - Fired when MORE_ROWS availability changes. detail: `MoreRowsDetail`
|
|
36
36
|
* @fires datasource-size-changed - Fired when layout or viewport sizing affects the datasource. detail: `GrigProGenesisDatasourceSizeChangedEventDetail`
|
|
@@ -152,9 +152,7 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
152
152
|
options: Object.assign({ getRowId: (params) => params.data[this.rowId] }, this.deferredGridOptions),
|
|
153
153
|
});
|
|
154
154
|
// TODO: instead of listening to ready event, we should only render the datasource slot when the grid is ready
|
|
155
|
-
this.addEventListener(datasourceEventNames.ready, (
|
|
156
|
-
const { pagination } = event.detail;
|
|
157
|
-
this.pagination = pagination;
|
|
155
|
+
this.addEventListener(datasourceEventNames.ready, () => __awaiter(this, void 0, void 0, function* () {
|
|
158
156
|
yield this.loadResourceData();
|
|
159
157
|
}), { once: true });
|
|
160
158
|
const filterDebounceTime = 600;
|