@genesislcap/grid-pro 14.275.3 → 14.276.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/README.md +428 -15
- package/dist/custom-elements.json +1306 -141
- package/dist/dts/datasource/base.datasource.d.ts +38 -1
- package/dist/dts/datasource/base.datasource.d.ts.map +1 -1
- package/dist/dts/datasource/index.d.ts +1 -0
- package/dist/dts/datasource/index.d.ts.map +1 -1
- package/dist/dts/datasource/server-side.datasource.d.ts +6 -5
- 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 +34 -12
- package/dist/dts/grid-pro-genesis-datasource/grid-pro-genesis-datasource.d.ts.map +1 -1
- package/dist/dts/grid-pro.d.ts +65 -16
- package/dist/dts/grid-pro.d.ts.map +1 -1
- package/dist/dts/grid-pro.styles.d.ts.map +1 -1
- package/dist/dts/grid-pro.types.d.ts +91 -0
- package/dist/dts/grid-pro.types.d.ts.map +1 -1
- package/dist/dts/index.d.ts +1 -0
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/status-bar-components/index.d.ts +5 -0
- package/dist/dts/status-bar-components/index.d.ts.map +1 -0
- package/dist/dts/status-bar-components/label-value.status-bar.d.ts +21 -0
- package/dist/dts/status-bar-components/label-value.status-bar.d.ts.map +1 -0
- package/dist/dts/status-bar-components/load-more.status-bar.d.ts +43 -0
- package/dist/dts/status-bar-components/load-more.status-bar.d.ts.map +1 -0
- package/dist/dts/status-bar-components/pagination.status-bar.d.ts +32 -0
- package/dist/dts/status-bar-components/pagination.status-bar.d.ts.map +1 -0
- package/dist/dts/status-bar-components/reload.status-bar.d.ts +36 -0
- package/dist/dts/status-bar-components/reload.status-bar.d.ts.map +1 -0
- package/dist/esm/datasource/base.datasource.js +124 -7
- package/dist/esm/datasource/index.js +1 -0
- package/dist/esm/datasource/server-side.datasource.js +9 -9
- package/dist/esm/grid-pro-genesis-datasource/grid-pro-genesis-datasource.js +111 -34
- package/dist/esm/grid-pro.js +116 -2
- package/dist/esm/grid-pro.styles.js +10 -0
- package/dist/esm/grid-pro.types.js +28 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/status-bar-components/index.js +4 -0
- package/dist/esm/status-bar-components/label-value.status-bar.js +33 -0
- package/dist/esm/status-bar-components/load-more.status-bar.js +209 -0
- package/dist/esm/status-bar-components/pagination.status-bar.js +206 -0
- package/dist/esm/status-bar-components/reload.status-bar.js +162 -0
- package/dist/grid-pro.api.json +6872 -3339
- package/dist/grid-pro.d.ts +384 -32
- package/docs/api/grid-pro.criteriadelimiter.md +13 -0
- package/docs/api/grid-pro.criteriajoin.md +13 -0
- package/docs/api/grid-pro.default_status_bar_config.md +13 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.aggrid.md +11 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.connect.md +11 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.criteria.md +11 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.criteriafromfilters.md +11 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.datasource.md +11 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.datasourceoptions.md +15 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.datasourcestatuschanged.md +23 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.defaultrowidbyresourcetype.md +11 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.deferredcolumnstates.md +11 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.deferredgridoptions.md +11 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.disablepolling.md +11 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.fields.md +11 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.isrequestserver.md +11 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.issnapshot.md +11 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.maxrows.md +11 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.maxview.md +11 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.md +55 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.movingview.md +11 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.orderby.md +11 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.pollinginterval.md +11 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.removefilter.md +22 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.request.md +11 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.requestautosetup.md +18 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.resourcename.md +11 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.reverse.md +11 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.rowdatamapper.md +13 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.rowid.md +11 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.rowidattr.md +15 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.setfilter.md +23 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.update.md +11 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.viewnumber.md +11 -0
- package/docs/api/grid-pro.gridpro.clearlocalgridoptions.md +17 -0
- package/docs/api/grid-pro.gridpro.gridprodatasource.md +2 -2
- package/docs/api/grid-pro.gridpro.md +8 -2
- package/docs/api/grid-pro.gridpro.pagination.md +18 -0
- package/docs/api/grid-pro.gridpro.paginationpagesize.md +18 -0
- package/docs/api/grid-pro.gridpro.persistcolumnstatekey.md +1 -1
- package/docs/api/grid-pro.gridpro.setuppaginationandstatusbar.md +22 -0
- package/docs/api/grid-pro.gridpro.statusbarconfig.md +18 -0
- package/docs/api/grid-pro.gridpro.withstatusbar.md +18 -0
- package/docs/api/grid-pro.gridprobasedatasource.agtransaction.md +11 -0
- package/docs/api/grid-pro.gridprobasedatasource.applyallagtransactions.md +15 -0
- package/docs/api/grid-pro.gridprobasedatasource.applyasyncfuncname.md +11 -0
- package/docs/api/grid-pro.gridprobasedatasource.applyfuncname.md +11 -0
- package/docs/api/grid-pro.gridprobasedatasource.applytransaction.md +22 -0
- package/docs/api/grid-pro.gridprobasedatasource.applytransactionasync.md +23 -0
- package/docs/api/grid-pro.gridprobasedatasource.datasubwasloggedoff.md +11 -0
- package/docs/api/grid-pro.gridprobasedatasource.destroy.md +15 -0
- package/docs/api/grid-pro.gridprobasedatasource.generatecolumndefsfrommetadata.md +23 -0
- package/docs/api/grid-pro.gridprobasedatasource.getdatasourcestatusbarpanels.md +24 -0
- package/docs/api/grid-pro.gridprobasedatasource.handlestreamdeletes.md +22 -0
- package/docs/api/grid-pro.gridprobasedatasource.handlestreaminserts.md +23 -0
- package/docs/api/grid-pro.gridprobasedatasource.handlestreamupdates.md +22 -0
- package/docs/api/grid-pro.gridprobasedatasource.loadmore.md +15 -0
- package/docs/api/grid-pro.gridprobasedatasource.md +42 -0
- package/docs/api/grid-pro.gridprobasedatasource.pagination.md +11 -0
- package/docs/api/grid-pro.gridprobasedatasource.reloadresourcedata.md +15 -0
- package/docs/api/grid-pro.gridprobasedatasource.restart.md +15 -0
- package/docs/api/grid-pro.gridprobasedatasource.rowdata.md +11 -0
- package/docs/api/grid-pro.gridprogenesisdatasource.handlestreamdeletes.md +24 -0
- package/docs/api/grid-pro.gridprogenesisdatasource.handlestreaminserts.md +22 -0
- package/docs/api/grid-pro.gridprogenesisdatasource.handlestreamupdates.md +22 -0
- package/docs/api/grid-pro.gridprogenesisdatasource.loadmore.md +15 -0
- package/docs/api/grid-pro.gridprogenesisdatasource.md +6 -1
- package/docs/api/grid-pro.gridprogenesisdatasource.reloadresourcedata.md +21 -0
- package/docs/api/grid-pro.gridprogenesisdatasource.restart.md +3 -3
- package/docs/api/grid-pro.gridprostatusbarconfig.loadmore.md +18 -0
- package/docs/api/grid-pro.gridprostatusbarconfig.maxrows.md +18 -0
- package/docs/api/grid-pro.gridprostatusbarconfig.md +27 -0
- package/docs/api/grid-pro.gridprostatusbarconfig.reload.md +18 -0
- package/docs/api/grid-pro.gridprostatusbarconfig.rows.md +18 -0
- package/docs/api/grid-pro.gridprostatusbarloadmoreconfig.appearance.md +18 -0
- package/docs/api/grid-pro.gridprostatusbarloadmoreconfig.md +22 -0
- package/docs/api/grid-pro.gridprostatusbarloadmoreconfig.onloadmore.md +13 -0
- package/docs/api/grid-pro.gridprostatusbarloadmoreconfig.tooltip.md +18 -0
- package/docs/api/grid-pro.gridprostatusbarreloadconfig.icon.md +18 -0
- package/docs/api/grid-pro.gridprostatusbarreloadconfig.md +22 -0
- package/docs/api/grid-pro.gridprostatusbarreloadconfig.onreload.md +13 -0
- package/docs/api/grid-pro.gridprostatusbarreloadconfig.tooltip.md +18 -0
- package/docs/api/grid-pro.gridprostatusbartypes.md +27 -0
- package/docs/api/grid-pro.labelvaluestatusbarcomponent.destroy.md +15 -0
- package/docs/api/grid-pro.labelvaluestatusbarcomponent.getgui.md +15 -0
- package/docs/api/grid-pro.labelvaluestatusbarcomponent.init.md +22 -0
- package/docs/api/grid-pro.labelvaluestatusbarcomponent.md +23 -0
- package/docs/api/grid-pro.labelvaluestatusbarparams.md +17 -0
- package/docs/api/grid-pro.loadmorestatusbarcomponent.destroy.md +15 -0
- package/docs/api/grid-pro.loadmorestatusbarcomponent.getgui.md +15 -0
- package/docs/api/grid-pro.loadmorestatusbarcomponent.init.md +22 -0
- package/docs/api/grid-pro.loadmorestatusbarcomponent.md +25 -0
- package/docs/api/grid-pro.loadmorestatusbarcomponent.updatebuttonvisibility.md +15 -0
- package/docs/api/grid-pro.loadmorestatusbarcomponent.updateparams.md +22 -0
- package/docs/api/grid-pro.loadmorestatusbarparams.md +18 -0
- package/docs/api/grid-pro.md +16 -0
- package/docs/api/grid-pro.paginationstatusbarcomponent.destroy.md +15 -0
- package/docs/api/grid-pro.paginationstatusbarcomponent.getgui.md +15 -0
- package/docs/api/grid-pro.paginationstatusbarcomponent.init.md +22 -0
- package/docs/api/grid-pro.paginationstatusbarcomponent.md +23 -0
- package/docs/api/grid-pro.reloadstatusbarcomponent.destroy.md +15 -0
- package/docs/api/grid-pro.reloadstatusbarcomponent.getgui.md +15 -0
- package/docs/api/grid-pro.reloadstatusbarcomponent.init.md +22 -0
- package/docs/api/grid-pro.reloadstatusbarcomponent.md +24 -0
- package/docs/api/grid-pro.reloadstatusbarcomponent.updateparams.md +22 -0
- package/docs/api/grid-pro.reloadstatusbarparams.md +17 -0
- package/docs/api-report.md +256 -6
- package/package.json +13 -13
|
@@ -7,6 +7,7 @@ import { BehaviorSubject, EMPTY } from 'rxjs';
|
|
|
7
7
|
import { catchError, debounceTime, skip, tap } from 'rxjs/operators';
|
|
8
8
|
import { criteriaDelimiter, GridProBaseDatasource } from '../datasource/base.datasource';
|
|
9
9
|
import { getClientSideFilterParamsByFieldType } from '../datasource/client-side.grid-definitions';
|
|
10
|
+
import { GridProStatusBarTypes } from '../grid-pro.types';
|
|
10
11
|
import { logger } from '../utils/logger';
|
|
11
12
|
import { gridProGenesisDatasourceEventNames } from './grid-pro-genesis-datasource.config';
|
|
12
13
|
const withoutFullInit = null;
|
|
@@ -21,10 +22,13 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
21
22
|
super(...arguments);
|
|
22
23
|
this.applyFuncName = 'applyTransaction';
|
|
23
24
|
this.applyAsyncFuncName = 'applyTransactionAsync';
|
|
25
|
+
// Cache for rowData array to avoid repeated Array.from() calls
|
|
26
|
+
this.cachedRowArray = [];
|
|
24
27
|
this.restartOnReconnection = true;
|
|
25
28
|
this.keepColDefsOnClearRowData = false;
|
|
26
29
|
this.requiresFullRowDataAndColDefs = true;
|
|
27
30
|
this._lastMoreRows = false;
|
|
31
|
+
this._isMoreRowsResult = false;
|
|
28
32
|
}
|
|
29
33
|
// DatasourceOptions
|
|
30
34
|
criteriaChanged(oldCriteria, newCriteria) {
|
|
@@ -146,24 +150,8 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
146
150
|
* @public
|
|
147
151
|
*/
|
|
148
152
|
destroy() {
|
|
149
|
-
this.reset();
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Deinitialises the datasource, resetting it to its initial state.
|
|
153
|
-
* @deprecated Use `destroy` instead
|
|
154
|
-
* @public
|
|
155
|
-
*/
|
|
156
|
-
deinit() {
|
|
157
|
-
this.reset();
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Resets the datasource to its initial state.
|
|
161
|
-
* @public
|
|
162
|
-
* @deprecated Use `destroy` instead
|
|
163
|
-
*/
|
|
164
|
-
reset() {
|
|
165
153
|
var _a;
|
|
166
|
-
logger.debug('GridProGenesisDatasource.
|
|
154
|
+
logger.debug('GridProGenesisDatasource.destroy()', this.resourceName);
|
|
167
155
|
if (this.dataSub) {
|
|
168
156
|
this.dataSub.unsubscribe();
|
|
169
157
|
this.dataSub = undefined;
|
|
@@ -177,6 +165,9 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
177
165
|
this.connectionSub = undefined;
|
|
178
166
|
}
|
|
179
167
|
this.clearRowData();
|
|
168
|
+
this._lastMoreRows = false;
|
|
169
|
+
this._isMoreRowsResult = false;
|
|
170
|
+
this.agGrid.clearLocalGridOptions();
|
|
180
171
|
this.requiresFullRowDataAndColDefs = true;
|
|
181
172
|
this.dataSubWasLoggedOff = false;
|
|
182
173
|
this.criteriaFromFilters = new Map();
|
|
@@ -187,24 +178,45 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
187
178
|
this.datasource.destroy();
|
|
188
179
|
}
|
|
189
180
|
/**
|
|
190
|
-
*
|
|
181
|
+
* Deinitialises the datasource, resetting it to its initial state.
|
|
182
|
+
* @deprecated Use `destroy` instead
|
|
191
183
|
* @public
|
|
192
184
|
*/
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
185
|
+
deinit() {
|
|
186
|
+
logger.debug('GridProGenesisDatasource.deinit()', this.resourceName);
|
|
187
|
+
this.destroy();
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Resets the datasource to its initial state.
|
|
191
|
+
* @public
|
|
192
|
+
* @deprecated Use `destroy` instead
|
|
193
|
+
*/
|
|
194
|
+
reset() {
|
|
195
|
+
logger.debug('GridProGenesisDatasource.reset()', this.resourceName);
|
|
200
196
|
this.destroy();
|
|
201
|
-
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Restarts the datasource, uses `destroy` and `init` in sequence.
|
|
200
|
+
* @public
|
|
201
|
+
*/
|
|
202
|
+
restart() {
|
|
203
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
204
|
+
let columnDefinitions;
|
|
205
|
+
let columnStates;
|
|
206
|
+
if (this.keepColDefsOnClearRowData) {
|
|
207
|
+
columnDefinitions = this.agGrid.gridApi.getColumnDefs();
|
|
208
|
+
columnStates = this.agGrid.columnApi.getColumnState();
|
|
209
|
+
}
|
|
210
|
+
this.destroy();
|
|
211
|
+
yield this.init(columnDefinitions, columnStates);
|
|
212
|
+
});
|
|
202
213
|
}
|
|
203
214
|
/**
|
|
204
215
|
* Force the grid to redispatch the current rows
|
|
205
216
|
*/
|
|
206
217
|
refreshRows() {
|
|
207
|
-
this.
|
|
218
|
+
this.updateCachedRowArray(); // Ensure the cache is up-to-date
|
|
219
|
+
this.setRowData(this.cachedRowArray);
|
|
208
220
|
}
|
|
209
221
|
/**
|
|
210
222
|
* Clears the rowData and columnDefs for the grid.
|
|
@@ -218,6 +230,7 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
218
230
|
(_b = (_a = this.agGrid) === null || _a === void 0 ? void 0 : _a.gridApi) === null || _b === void 0 ? void 0 : _b.flushAsyncTransactions();
|
|
219
231
|
}
|
|
220
232
|
this.rowData = new Map();
|
|
233
|
+
this.cachedRowArray = []; // Clear the cached array
|
|
221
234
|
this.agTransaction = undefined;
|
|
222
235
|
if (withColumnDefs && !this.keepColDefsOnClearRowData) {
|
|
223
236
|
(_d = (_c = this.agGrid) === null || _c === void 0 ? void 0 : _c.gridApi) === null || _d === void 0 ? void 0 : _d.setColumnDefs([]);
|
|
@@ -253,16 +266,27 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
253
266
|
}
|
|
254
267
|
const data = this.rowDataMapper ? this.rowDataMapper(rowData) : rowData;
|
|
255
268
|
this.agGrid.restoreCachedFilterConfig();
|
|
269
|
+
// Use transactions for adding data
|
|
256
270
|
this.agTransaction = { add: data ? [...data] : [], remove: [], update: [], addIndex: 0 };
|
|
257
271
|
this.applyAllAgTransactions();
|
|
272
|
+
// Update the cached row array
|
|
273
|
+
this.updateCachedRowArray();
|
|
258
274
|
this.requiresFullRowDataAndColDefs = false;
|
|
259
275
|
});
|
|
260
276
|
}
|
|
277
|
+
/**
|
|
278
|
+
* Updates the cached row array from the rowData Map
|
|
279
|
+
* @internal
|
|
280
|
+
*/
|
|
281
|
+
updateCachedRowArray() {
|
|
282
|
+
this.cachedRowArray = Array.from(this.rowData.values());
|
|
283
|
+
}
|
|
261
284
|
/**
|
|
262
285
|
* Resets the grid data while keeping columnDefs and sends a DATA_LOGOFF message if it's a stream.
|
|
263
|
-
*
|
|
286
|
+
* Loads resource data without full initialization (no metadata fetch).
|
|
264
287
|
* @remarks This is used when the grid is already initialized and we want to reload the data due to a criteria/filter change.
|
|
265
|
-
* @
|
|
288
|
+
* @see loadResourceData
|
|
289
|
+
* @public
|
|
266
290
|
*/
|
|
267
291
|
reloadResourceData() {
|
|
268
292
|
var _a, _b;
|
|
@@ -284,6 +308,7 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
284
308
|
* Handles both snapshot and stream data (for both REQUEST_SERVER and DATASERVER resource types).
|
|
285
309
|
*
|
|
286
310
|
* @param withFullInit - if true, will call datasource.init() with requiresMetadataFetch = true, fetching fresh metadata
|
|
311
|
+
* @see reloadResourceData
|
|
287
312
|
* @internal
|
|
288
313
|
*/
|
|
289
314
|
loadResourceData(withFullInit = true) {
|
|
@@ -314,6 +339,10 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
314
339
|
return EMPTY;
|
|
315
340
|
}))
|
|
316
341
|
.subscribe((result) => {
|
|
342
|
+
this._sourceRef = result.SOURCE_REF;
|
|
343
|
+
const hasMoreRowsInResult = 'MORE_ROWS' in result;
|
|
344
|
+
const hasRowsCountInResult = 'ROWS_COUNT' in result;
|
|
345
|
+
this._isMoreRowsResult = hasMoreRowsInResult && !hasRowsCountInResult;
|
|
317
346
|
if (result === null || result === void 0 ? void 0 : result.ERROR) {
|
|
318
347
|
this.handleErrors(result.ERROR);
|
|
319
348
|
}
|
|
@@ -324,10 +353,13 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
324
353
|
return;
|
|
325
354
|
}
|
|
326
355
|
this.dataSubWasLoggedOff = false;
|
|
356
|
+
if (hasMoreRowsInResult) {
|
|
357
|
+
this.updateLoadMoreStatus(result.MORE_ROWS, result.SOURCE_REF);
|
|
358
|
+
}
|
|
327
359
|
if (result.ROW) {
|
|
328
360
|
const nextMessage = dataServerResultFilter(result);
|
|
329
361
|
this.handleStreamResult(nextMessage);
|
|
330
|
-
if (result.MORE_ROWS !== this._lastMoreRows) {
|
|
362
|
+
if (hasMoreRowsInResult && result.MORE_ROWS !== this._lastMoreRows) {
|
|
331
363
|
const moreRowsDetail = {
|
|
332
364
|
moreRows: result.MORE_ROWS,
|
|
333
365
|
sourceRef: result.SOURCE_REF,
|
|
@@ -396,6 +428,27 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
396
428
|
this.applyDataserverData(result);
|
|
397
429
|
}
|
|
398
430
|
}
|
|
431
|
+
/**
|
|
432
|
+
* Updates the status bar based on more rows status
|
|
433
|
+
* @param moreRows - Whether more rows are available
|
|
434
|
+
* @param sourceRef - The source reference
|
|
435
|
+
* @param rowsCount - The total number of rows
|
|
436
|
+
* @remarks
|
|
437
|
+
* This method requires AG Grid Enterprise module to work properly.
|
|
438
|
+
* It will silently fail if the Enterprise module is not available.
|
|
439
|
+
*/
|
|
440
|
+
updateLoadMoreStatus(moreRows, sourceRef) {
|
|
441
|
+
var _a, _b, _c;
|
|
442
|
+
if (!((_a = this.agGrid) === null || _a === void 0 ? void 0 : _a.gridApi))
|
|
443
|
+
return;
|
|
444
|
+
const statusBar = this.agGrid.gridApi.getStatusPanel(GridProStatusBarTypes.loadMore);
|
|
445
|
+
if (statusBar) {
|
|
446
|
+
(_c = (_b = statusBar).updateParams) === null || _c === void 0 ? void 0 : _c.call(_b, {
|
|
447
|
+
moreRows,
|
|
448
|
+
sourceRef,
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
}
|
|
399
452
|
applyRequestServerData(requestServerResult) {
|
|
400
453
|
var _a;
|
|
401
454
|
const previousSize = this.rowData.size;
|
|
@@ -423,13 +476,17 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
423
476
|
this.destroy();
|
|
424
477
|
return;
|
|
425
478
|
}
|
|
426
|
-
|
|
479
|
+
// Update cache and use it if available
|
|
480
|
+
this.updateCachedRowArray();
|
|
481
|
+
const rowData = this.rowData.size > 0 ? this.cachedRowArray : requestServerData;
|
|
427
482
|
this.handleSizeChanged(previousSize, this.rowData.size);
|
|
428
483
|
this.setRowData(rowData);
|
|
429
484
|
return;
|
|
430
485
|
}
|
|
431
486
|
const rowsToUpdate = [];
|
|
432
|
-
|
|
487
|
+
// Update cache before using it
|
|
488
|
+
this.updateCachedRowArray();
|
|
489
|
+
const rowsToDelete = this.cachedRowArray.filter((row) => {
|
|
433
490
|
const match = requestServerData.find((data) => data[this.rowId] === row[this.rowId]);
|
|
434
491
|
if (match) {
|
|
435
492
|
rowsToUpdate.push(match);
|
|
@@ -452,8 +509,9 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
452
509
|
(_a = dataServerResult.inserts) === null || _a === void 0 ? void 0 : _a.forEach((insertData) => {
|
|
453
510
|
this.rowData.set(insertData[this.rowId], insertData);
|
|
454
511
|
});
|
|
455
|
-
|
|
456
|
-
this.
|
|
512
|
+
// Update and use the cached array
|
|
513
|
+
this.updateCachedRowArray();
|
|
514
|
+
this.setRowData(this.cachedRowArray);
|
|
457
515
|
this.handleSizeChanged(previousSize, this.rowData.size);
|
|
458
516
|
return;
|
|
459
517
|
}
|
|
@@ -494,6 +552,25 @@ let GridProGenesisDatasource = class GridProGenesisDatasource extends LifecycleM
|
|
|
494
552
|
oldValue: oldSize,
|
|
495
553
|
});
|
|
496
554
|
}
|
|
555
|
+
handleStreamInserts(inserts = []) {
|
|
556
|
+
super.handleStreamInserts(inserts, this._isMoreRowsResult ? this.cachedRowArray.length : 0);
|
|
557
|
+
this.updateCachedRowArray();
|
|
558
|
+
}
|
|
559
|
+
handleStreamUpdates(updates = []) {
|
|
560
|
+
super.handleStreamUpdates(updates);
|
|
561
|
+
this.updateCachedRowArray();
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* Handles stream deletes by removing records from the grid.
|
|
565
|
+
* @param deletes - List of records to remove from the grid stream
|
|
566
|
+
*/
|
|
567
|
+
handleStreamDeletes(deletes = []) {
|
|
568
|
+
super.handleStreamDeletes(deletes);
|
|
569
|
+
this.updateCachedRowArray();
|
|
570
|
+
}
|
|
571
|
+
loadMore() {
|
|
572
|
+
this.connect.getMoreRows(this._sourceRef);
|
|
573
|
+
}
|
|
497
574
|
};
|
|
498
575
|
__decorate([
|
|
499
576
|
attr({ mode: 'boolean', attribute: 'restart-on-reconnection' })
|
package/dist/esm/grid-pro.js
CHANGED
|
@@ -2,6 +2,7 @@ import { __awaiter, __decorate, __rest } from "tslib";
|
|
|
2
2
|
import { ClientSideRowModelModule } from '@ag-grid-community/client-side-row-model';
|
|
3
3
|
import { ComponentUtil, Events, Grid, ModuleRegistry } from '@ag-grid-community/core';
|
|
4
4
|
import { CsvExportModule } from '@ag-grid-community/csv-export';
|
|
5
|
+
import { DatasourceDefaults } from '@genesislcap/foundation-comms';
|
|
5
6
|
import { insertDocumentCSSRule, LifecycleMixin, respondToVisibility, } from '@genesislcap/foundation-utils';
|
|
6
7
|
import { attr, DOM, observable } from '@microsoft/fast-element';
|
|
7
8
|
import { FoundationElement } from '@microsoft/fast-foundation';
|
|
@@ -18,8 +19,9 @@ import { GridProGenesisDatasource, gridProGenesisDatasourceEventNames, } from '.
|
|
|
18
19
|
import { DEBOUNCED_RESIZE_TIME, gridProEventNames, gridProErrorNames, } from './grid-pro.definitions';
|
|
19
20
|
import { foundationGridProStyles as styles } from './grid-pro.styles';
|
|
20
21
|
import { gridProTemplate as template } from './grid-pro.template';
|
|
21
|
-
import { AgGridTheme, agThemeFontsId, agThemeTokenMapClassname, ERROR_COLUMN_FIELD, EDITED_COLUMN_FIELD, GridOptionsConfig, GridProRendererTypes, GRID_READY_EVENT, } from './grid-pro.types';
|
|
22
|
+
import { AgGridTheme, agThemeFontsId, agThemeTokenMapClassname, ERROR_COLUMN_FIELD, EDITED_COLUMN_FIELD, GridOptionsConfig, GridProRendererTypes, GRID_READY_EVENT, GridProStatusBarTypes, DEFAULT_STATUS_BAR_CONFIG, } from './grid-pro.types';
|
|
22
23
|
import { StatePersistence } from './state-persistence';
|
|
24
|
+
import { LabelValueStatusBarComponent, LoadMoreStatusBarComponent, PaginationStatusBarComponent, ReloadStatusBarComponent, } from './status-bar-components';
|
|
23
25
|
import { ErrorTooltip } from './tooltips';
|
|
24
26
|
import { convertToKebabCase, logger, mergeAndDedupColDefWithColumnState } from './utils';
|
|
25
27
|
GridProGenesisDatasource;
|
|
@@ -122,6 +124,41 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
122
124
|
this.gridFontFace = defaultAgGridFontFace;
|
|
123
125
|
this.columnComponentName = 'grid-pro-column';
|
|
124
126
|
this.theme = AgGridTheme.alpine;
|
|
127
|
+
/**
|
|
128
|
+
* Enable pagination for the grid.
|
|
129
|
+
* @remarks
|
|
130
|
+
* When enabled, the grid will automatically configure pagination settings.
|
|
131
|
+
* Note that AG Grid's full pagination functionality requires the Enterprise module.
|
|
132
|
+
* While basic pagination will work in Community edition, advanced features like
|
|
133
|
+
* custom pagination components require Enterprise.
|
|
134
|
+
* @see https://www.ag-grid.com/javascript-data-grid/row-pagination/
|
|
135
|
+
* @see https://www.ag-grid.com/javascript-data-grid/server-side-model-pagination/
|
|
136
|
+
*/
|
|
137
|
+
this.pagination = false;
|
|
138
|
+
/**
|
|
139
|
+
* Number of rows per page when pagination is enabled.
|
|
140
|
+
* @remarks
|
|
141
|
+
* **Default Value:** `DatasourceDefaults.DEFAULT_PAGINATION_PAGE_SIZE (25)` (default MAX_ROWS divided by 10)
|
|
142
|
+
* Only used when pagination is enabled.
|
|
143
|
+
* Note that AG Grid's full pagination functionality requires the Enterprise module.
|
|
144
|
+
*/
|
|
145
|
+
this.paginationPageSize = DatasourceDefaults.DEFAULT_PAGINATION_PAGE_SIZE;
|
|
146
|
+
/**
|
|
147
|
+
* Configuration for the grid status bar components.
|
|
148
|
+
* @remarks
|
|
149
|
+
* This requires AG Grid Enterprise module to be enabled.
|
|
150
|
+
* The status bar will only be displayed if the Enterprise module is available.
|
|
151
|
+
* @see https://www.ag-grid.com/javascript-data-grid/component-status-bar/
|
|
152
|
+
*/
|
|
153
|
+
this.statusBarConfig = DEFAULT_STATUS_BAR_CONFIG;
|
|
154
|
+
/**
|
|
155
|
+
* Enables or disables the grid status bar.
|
|
156
|
+
* @remarks
|
|
157
|
+
* Default is false.
|
|
158
|
+
* When disabled, no status bar will be displayed regardless of statusBarConfig.
|
|
159
|
+
* This requires AG Grid Enterprise module to be available for the status bar to be displayed when enabled.
|
|
160
|
+
*/
|
|
161
|
+
this.withStatusBar = false;
|
|
125
162
|
this.rehydrationAttempted = false;
|
|
126
163
|
this.rootEventsListeners = [];
|
|
127
164
|
this.gridEventsQueue = [];
|
|
@@ -220,6 +257,10 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
220
257
|
[GridProRendererTypes.multiselectEditor]: MultiselectEditor,
|
|
221
258
|
[GridProRendererTypes.dateEditor]: DateEditor,
|
|
222
259
|
[GridProRendererTypes.stringEditor]: StringEditor,
|
|
260
|
+
[GridProStatusBarTypes.labelValue]: LabelValueStatusBarComponent,
|
|
261
|
+
[GridProStatusBarTypes.loadMore]: LoadMoreStatusBarComponent,
|
|
262
|
+
[GridProStatusBarTypes.pagination]: PaginationStatusBarComponent,
|
|
263
|
+
[GridProStatusBarTypes.reload]: ReloadStatusBarComponent,
|
|
223
264
|
};
|
|
224
265
|
return Object.assign(Object.assign(Object.assign({}, defaultFoundationAgComponents), gridOptionsComponents), this.gridComponents);
|
|
225
266
|
}
|
|
@@ -332,7 +373,7 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
332
373
|
}
|
|
333
374
|
/**
|
|
334
375
|
* Get the datasource element.
|
|
335
|
-
* @remarks This will return the first datasource element found in the light DOM
|
|
376
|
+
* @remarks This will return the first datasource element found in the light DOM, wrapping all concrete datasource implementations.
|
|
336
377
|
* @public
|
|
337
378
|
*/
|
|
338
379
|
get gridProDatasource() {
|
|
@@ -388,12 +429,14 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
388
429
|
if (this.gridProDatasource) {
|
|
389
430
|
derivedOptions.columnDefs = columnDefs;
|
|
390
431
|
derivedOptions.getRowId = getRowId;
|
|
432
|
+
this.setupPaginationAndStatusBar(derivedOptions);
|
|
391
433
|
this.setLocalGridOptions(derivedOptions);
|
|
392
434
|
}
|
|
393
435
|
else {
|
|
394
436
|
this.mergeAllColumnDefsAndStates(columnDefs).then((value) => {
|
|
395
437
|
derivedOptions.columnDefs = value;
|
|
396
438
|
derivedOptions.getRowId = getRowId;
|
|
439
|
+
this.setupPaginationAndStatusBar(derivedOptions);
|
|
397
440
|
this.setLocalGridOptions(derivedOptions);
|
|
398
441
|
this.initGrid();
|
|
399
442
|
});
|
|
@@ -402,6 +445,13 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
402
445
|
setLocalGridOptions(derivedOptions) {
|
|
403
446
|
this.agGridOptions = Object.assign(Object.assign({}, this.agGridOptions), ComponentUtil.copyAttributesToGridOptions(derivedOptions, this.agAttributes));
|
|
404
447
|
}
|
|
448
|
+
/**
|
|
449
|
+
* Clears the local grid options, this is used to clear the grid options when the grid is restarted.
|
|
450
|
+
* @public
|
|
451
|
+
*/
|
|
452
|
+
clearLocalGridOptions() {
|
|
453
|
+
this.agGridOptions = undefined;
|
|
454
|
+
}
|
|
405
455
|
initGrid() {
|
|
406
456
|
DOM.queueUpdate(() => {
|
|
407
457
|
if (this.initialised) {
|
|
@@ -504,6 +554,58 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
504
554
|
return colDefsToReturn;
|
|
505
555
|
});
|
|
506
556
|
}
|
|
557
|
+
setupPaginationAndStatusBar(gridOptions) {
|
|
558
|
+
// TODO: when this happens "pagination" is undefined, (due init cycles, DS being child of grid) so we need to use this['_pagination'] for now
|
|
559
|
+
const pagination = this['_pagination'];
|
|
560
|
+
if (pagination && gridOptions.rowModelType) {
|
|
561
|
+
gridOptions.pagination = true;
|
|
562
|
+
gridOptions.paginationPageSize = this.paginationPageSize;
|
|
563
|
+
gridOptions.suppressScrollOnNewData = true;
|
|
564
|
+
}
|
|
565
|
+
// Set default status bar with components based on configuration
|
|
566
|
+
if (!gridOptions.statusBar && this.withStatusBar && this.statusBarConfig) {
|
|
567
|
+
// Create status panels based on config
|
|
568
|
+
const statusPanels = [];
|
|
569
|
+
// Always add row count component
|
|
570
|
+
if (this.statusBarConfig && this.statusBarConfig.rows === true) {
|
|
571
|
+
statusPanels.push({
|
|
572
|
+
statusPanel: gridOptions.rowModelType === 'serverSide'
|
|
573
|
+
? 'agTotalRowCountComponent'
|
|
574
|
+
: 'agTotalAndFilteredRowCountComponent',
|
|
575
|
+
align: 'left',
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
// Add max rows component if explicitly enabled
|
|
579
|
+
if (this.statusBarConfig && this.statusBarConfig.maxRows === true) {
|
|
580
|
+
statusPanels.push({
|
|
581
|
+
statusPanel: GridProStatusBarTypes.labelValue,
|
|
582
|
+
statusPanelParams: {
|
|
583
|
+
label: 'Max Rows',
|
|
584
|
+
value: this.gridProDatasource.maxRows || DatasourceDefaults.MAX_ROWS_250,
|
|
585
|
+
hide: false,
|
|
586
|
+
},
|
|
587
|
+
align: 'left',
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
// Add datasource-specific status bar components
|
|
591
|
+
if (this.gridProDatasource) {
|
|
592
|
+
const isServerSide = gridOptions.rowModelType === 'serverSide';
|
|
593
|
+
const datasourceStatusPanels = this.gridProDatasource.getDatasourceStatusBarPanels(isServerSide);
|
|
594
|
+
statusPanels.push(...datasourceStatusPanels);
|
|
595
|
+
}
|
|
596
|
+
// Add pagination status if pagination is enabled
|
|
597
|
+
if (pagination) {
|
|
598
|
+
gridOptions.suppressPaginationPanel = true;
|
|
599
|
+
statusPanels.push({
|
|
600
|
+
statusPanel: GridProStatusBarTypes.pagination,
|
|
601
|
+
align: 'right',
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
gridOptions.statusBar = {
|
|
605
|
+
statusPanels,
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
}
|
|
507
609
|
get observedAttributes() {
|
|
508
610
|
// allow properties to be supplied either lowercased or kebab-cased
|
|
509
611
|
// this allows the user to either supply (for example) enableSorting or enabled-sorting
|
|
@@ -641,6 +743,18 @@ __decorate([
|
|
|
641
743
|
__decorate([
|
|
642
744
|
observable
|
|
643
745
|
], GridPro.prototype, "gridComponents", void 0);
|
|
746
|
+
__decorate([
|
|
747
|
+
attr({ mode: 'boolean' })
|
|
748
|
+
], GridPro.prototype, "pagination", void 0);
|
|
749
|
+
__decorate([
|
|
750
|
+
attr({ attribute: 'pagination-page-size' })
|
|
751
|
+
], GridPro.prototype, "paginationPageSize", void 0);
|
|
752
|
+
__decorate([
|
|
753
|
+
observable
|
|
754
|
+
], GridPro.prototype, "statusBarConfig", void 0);
|
|
755
|
+
__decorate([
|
|
756
|
+
attr({ mode: 'boolean', attribute: 'with-status-bar' })
|
|
757
|
+
], GridPro.prototype, "withStatusBar", void 0);
|
|
644
758
|
__decorate([
|
|
645
759
|
GridOptionsConfig
|
|
646
760
|
], GridPro.prototype, "gridOptionsConfig", void 0);
|
|
@@ -12,6 +12,7 @@ export const foundationGridProStyles = css `
|
|
|
12
12
|
--datasource-error-background-opacity: 0.5;
|
|
13
13
|
--datasource-error-dialog-max-width: 50%;
|
|
14
14
|
--datasource-error-dialog-min-width: auto;
|
|
15
|
+
--ag-status-bar-height: 32.5px;
|
|
15
16
|
|
|
16
17
|
position: relative;
|
|
17
18
|
width: 100%;
|
|
@@ -67,4 +68,13 @@ export const foundationGridProStyles = css `
|
|
|
67
68
|
.error {
|
|
68
69
|
border-color: var(--error-color) !important;
|
|
69
70
|
}
|
|
71
|
+
|
|
72
|
+
.ag-status-bar {
|
|
73
|
+
height: var(--ag-status-bar-height);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.ag-status-name-value {
|
|
77
|
+
padding-top: var(--ag-grid-size);
|
|
78
|
+
padding-bottom: var(--ag-grid-size);
|
|
79
|
+
}
|
|
70
80
|
`;
|
|
@@ -135,6 +135,21 @@ export var GridProRendererTypes;
|
|
|
135
135
|
GridProRendererTypes["stringEditor"] = "stringEditor";
|
|
136
136
|
GridProRendererTypes["multiselectEditor"] = "multiselectEditor";
|
|
137
137
|
})(GridProRendererTypes || (GridProRendererTypes = {}));
|
|
138
|
+
/**
|
|
139
|
+
* The available Grid Pro Status Bar Types
|
|
140
|
+
* @public
|
|
141
|
+
* @remarks
|
|
142
|
+
* These status bar components require AG Grid Enterprise module to be enabled.
|
|
143
|
+
* Status bar components will only be displayed if the Enterprise module is available.
|
|
144
|
+
* @see https://www.ag-grid.com/javascript-data-grid/component-status-bar/
|
|
145
|
+
*/
|
|
146
|
+
export var GridProStatusBarTypes;
|
|
147
|
+
(function (GridProStatusBarTypes) {
|
|
148
|
+
GridProStatusBarTypes["labelValue"] = "labelValue";
|
|
149
|
+
GridProStatusBarTypes["pagination"] = "pagination";
|
|
150
|
+
GridProStatusBarTypes["loadMore"] = "loadMore";
|
|
151
|
+
GridProStatusBarTypes["reload"] = "reload";
|
|
152
|
+
})(GridProStatusBarTypes || (GridProStatusBarTypes = {}));
|
|
138
153
|
/**
|
|
139
154
|
* Event fired when grid is ready
|
|
140
155
|
* @public
|
|
@@ -180,3 +195,16 @@ export var GridProCaseType;
|
|
|
180
195
|
GridProCaseType["sentenceCase"] = "sentenceCase";
|
|
181
196
|
GridProCaseType["snakeCase"] = "snakeCase";
|
|
182
197
|
})(GridProCaseType || (GridProCaseType = {}));
|
|
198
|
+
/**
|
|
199
|
+
* Default status bar configuration
|
|
200
|
+
* @public
|
|
201
|
+
*/
|
|
202
|
+
export const DEFAULT_STATUS_BAR_CONFIG = {
|
|
203
|
+
rows: true,
|
|
204
|
+
loadMore: {
|
|
205
|
+
tooltip: 'Load more rows from server',
|
|
206
|
+
},
|
|
207
|
+
reload: {
|
|
208
|
+
tooltip: 'Reload the datasource.',
|
|
209
|
+
},
|
|
210
|
+
};
|
package/dist/esm/index.js
CHANGED
|
@@ -12,6 +12,7 @@ export * from './grid-pro.types';
|
|
|
12
12
|
export * from './grid-pro';
|
|
13
13
|
export * from './grid-pro-genesis-datasource';
|
|
14
14
|
export * from './state-persistence';
|
|
15
|
+
export * from './status-bar-components';
|
|
15
16
|
export * from './style';
|
|
16
17
|
export * from './tooltips';
|
|
17
18
|
export * from './utils';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Label Value Status Bar Component
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export class LabelValueStatusBarComponent {
|
|
6
|
+
init(params) {
|
|
7
|
+
this.element = document.createElement('div');
|
|
8
|
+
this.element.classList.add('ag-status-name-value', 'ag-status-panel');
|
|
9
|
+
this.element.setAttribute('data-test-id', 'grid-label-value-panel');
|
|
10
|
+
this.element.setAttribute('role', 'status');
|
|
11
|
+
const statusBarParams = params;
|
|
12
|
+
if (statusBarParams.hide) {
|
|
13
|
+
this.element.style.display = 'none';
|
|
14
|
+
}
|
|
15
|
+
// Set accessible label for the entire component
|
|
16
|
+
this.element.setAttribute('aria-label', `${statusBarParams.label}: ${statusBarParams.value}`);
|
|
17
|
+
const label = document.createElement('span');
|
|
18
|
+
label.setAttribute('data-test-id', 'grid-label-value-label');
|
|
19
|
+
label.setAttribute('aria-hidden', 'true'); // Hide from screen readers since parent has full aria-label
|
|
20
|
+
label.innerHTML = `${statusBarParams.label}: `;
|
|
21
|
+
const value = document.createElement('span');
|
|
22
|
+
value.classList.add('ag-status-name-value-value');
|
|
23
|
+
value.setAttribute('data-test-id', 'grid-label-value-value');
|
|
24
|
+
value.setAttribute('aria-hidden', 'true'); // Hide from screen readers since parent has full aria-label
|
|
25
|
+
value.innerHTML = statusBarParams.value;
|
|
26
|
+
this.element.appendChild(label);
|
|
27
|
+
this.element.appendChild(value);
|
|
28
|
+
}
|
|
29
|
+
getGui() {
|
|
30
|
+
return this.element;
|
|
31
|
+
}
|
|
32
|
+
destroy() { }
|
|
33
|
+
}
|