@genesislcap/grid-pro 14.348.0 → 14.350.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 +2293 -1443
- package/dist/dts/cell-renderers/boolean.renderer.d.ts.map +1 -1
- package/dist/dts/datasource/base.datasource.d.ts +20 -15
- 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 +9 -9
- package/dist/dts/datasource/server-side.datasource.d.ts.map +1 -1
- package/dist/dts/grid-pro-genesis-datasource/datasource-events.types.d.ts +101 -0
- package/dist/dts/grid-pro-genesis-datasource/datasource-events.types.d.ts.map +1 -0
- package/dist/dts/grid-pro-genesis-datasource/grid-pro-genesis-datasource.d.ts +24 -9
- package/dist/dts/grid-pro-genesis-datasource/grid-pro-genesis-datasource.d.ts.map +1 -1
- package/dist/dts/grid-pro-v34.d.ts +862 -0
- package/dist/dts/grid-pro-v34.d.ts.map +1 -0
- package/dist/dts/grid-pro.d.ts +88 -1
- package/dist/dts/grid-pro.d.ts.map +1 -1
- package/dist/dts/grid-pro.definitions.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/label-value.status-bar.d.ts +1 -1
- package/dist/dts/status-bar-components/label-value.status-bar.d.ts.map +1 -1
- package/dist/dts/status-bar-components/load-more.status-bar.d.ts +1 -1
- package/dist/dts/status-bar-components/load-more.status-bar.d.ts.map +1 -1
- package/dist/dts/status-bar-components/pagination.status-bar.d.ts +1 -1
- package/dist/dts/status-bar-components/pagination.status-bar.d.ts.map +1 -1
- package/dist/dts/status-bar-components/reload.status-bar.d.ts +1 -1
- package/dist/dts/status-bar-components/reload.status-bar.d.ts.map +1 -1
- package/dist/esm/cell-renderers/boolean.renderer.js +6 -7
- package/dist/esm/datasource/base.datasource.js +68 -95
- package/dist/esm/datasource/index.js +1 -0
- package/dist/esm/datasource/server-side.datasource.js +127 -149
- package/dist/esm/grid-pro-genesis-datasource/datasource-events.types.js +33 -0
- package/dist/esm/grid-pro-genesis-datasource/grid-pro-genesis-datasource.js +83 -78
- package/dist/esm/grid-pro-v34.js +1034 -0
- package/dist/esm/grid-pro.definitions.js +1 -1
- package/dist/esm/grid-pro.js +283 -8
- package/dist/esm/grid-pro.template.js +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/status-bar-components/pagination.status-bar.js +18 -11
- package/dist/grid-pro.api.json +3188 -698
- package/dist/grid-pro.d.ts +1171 -118
- package/docs/api/grid-pro.errorhandlerdialogstyles.md +11 -0
- package/docs/api/grid-pro.genesisgriddatasourceelement.md +0 -21
- package/docs/api/grid-pro.geterrorhandlerdialogtemplate.md +64 -0
- package/docs/api/grid-pro.gridpro.md +17 -0
- package/docs/api/grid-pro.gridpro.thememode.md +11 -0
- package/docs/api/{grid-pro.gridprobasedatasource.applyallagtransactions.md → grid-pro.gridprobasedatasource.applyalltransactions.md} +3 -3
- package/docs/api/grid-pro.gridprobasedatasource.applytransaction.md +3 -3
- package/docs/api/grid-pro.gridprobasedatasource.getdatasourcestatusbarpanels.md +15 -1
- package/docs/api/grid-pro.gridprobasedatasource.isdisconnected.md +1 -1
- package/docs/api/{grid-pro.gridprobasedatasource.agtransaction.md → grid-pro.gridprobasedatasource.keepcoldefsonclearrowdata.md} +3 -3
- package/docs/api/grid-pro.gridprobasedatasource.md +17 -55
- package/docs/api/grid-pro.gridprobasedatasource.pagination.md +1 -1
- package/docs/api/grid-pro.gridprobasedatasource.setdisconnected.md +1 -1
- package/docs/api/{grid-pro.gridprobasedatasource.applyfuncname.md → grid-pro.gridprobasedatasource.transactiondata.md} +3 -3
- package/docs/api/grid-pro.gridprogenesisdatasource.applytransaction.md +4 -4
- package/docs/api/grid-pro.gridprogenesisdatasource.init.md +4 -20
- package/docs/api/grid-pro.gridprogenesisdatasource.md +7 -34
- package/docs/api/{grid-pro.gridprogenesisdatasource.applyfuncname.md → grid-pro.gridprogenesisdatasource.transactiondata.md} +3 -3
- package/docs/api/grid-pro.gridproserversidedatasource.applytransaction.md +4 -4
- package/docs/api/grid-pro.gridproserversidedatasource.md +1 -74
- package/docs/api/grid-pro.gridproserversidedatasource.onpaginationchanged.md +2 -2
- package/docs/api/{grid-pro.gridproserversidedatasource.rowmodel.md → grid-pro.gridprov34._constructor_.md} +5 -3
- package/docs/api/grid-pro.gridprov34.addeventlistener.md +89 -0
- package/docs/api/{grid-pro.gridproserversidedatasource.applyfuncname.md → grid-pro.gridprov34.aggrid.md} +3 -3
- package/docs/api/{grid-pro.gridproserversidedatasource.applyasyncfuncname.md → grid-pro.gridprov34.aggridoptions.md} +3 -3
- package/docs/api/grid-pro.gridprov34.autocellrendererbytype.md +14 -0
- package/docs/api/grid-pro.gridprov34.cachefilterconfig.md +18 -0
- package/docs/api/grid-pro.gridprov34.classnames.md +14 -0
- package/docs/api/grid-pro.gridprov34.clearlocalgridoptions.md +17 -0
- package/docs/api/grid-pro.gridprov34.columncomponentname.md +14 -0
- package/docs/api/grid-pro.gridprov34.combineallgridcomponents.md +53 -0
- package/docs/api/grid-pro.gridprov34.connectedcallback.md +18 -0
- package/docs/api/grid-pro.gridprov34.customerrorhandlertemplate.md +21 -0
- package/docs/api/grid-pro.gridprov34.disconnectedcallback.md +18 -0
- package/docs/api/grid-pro.gridprov34.enablecellflashing.md +21 -0
- package/docs/api/grid-pro.gridprov34.enablerowflashing.md +16 -0
- package/docs/api/grid-pro.gridprov34.eventsandcallbacks.md +14 -0
- package/docs/api/grid-pro.gridprov34.getfiltermodel.md +20 -0
- package/docs/api/grid-pro.gridprov34.getsavedcolumnstate.md +21 -0
- package/docs/api/grid-pro.gridprov34.getselectedrows.md +19 -0
- package/docs/api/{grid-pro.gridproserversidedatasource.applytransactionasync.md → grid-pro.gridprov34.globaleventlistener.md} +7 -9
- package/docs/api/grid-pro.gridprov34.gridapi.md +14 -0
- package/docs/api/grid-pro.gridprov34.gridautosizingenabled.md +16 -0
- package/docs/api/grid-pro.gridprov34.gridcomponents.md +16 -0
- package/docs/api/grid-pro.gridprov34.griderroritems.md +14 -0
- package/docs/api/grid-pro.gridprov34.gridoptions.md +14 -0
- package/docs/api/grid-pro.gridprov34.gridoptionsconfig.md +28 -0
- package/docs/api/grid-pro.gridprov34.gridparams.md +12 -0
- package/docs/api/grid-pro.gridprov34.gridprodatasource.md +18 -0
- package/docs/api/grid-pro.gridprov34.gridslot.md +14 -0
- package/docs/api/grid-pro.gridprov34.hasselectedrows.md +19 -0
- package/docs/api/grid-pro.gridprov34.headercasetype.md +18 -0
- package/docs/api/grid-pro.gridprov34.headerheight.md +14 -0
- package/docs/api/grid-pro.gridprov34.hidedatasourceerror.md +18 -0
- package/docs/api/grid-pro.gridprov34.initialised.md +14 -0
- package/docs/api/grid-pro.gridprov34.isserverside.md +12 -0
- package/docs/api/grid-pro.gridprov34.md +1008 -0
- package/docs/api/grid-pro.gridprov34.mergeallcolumndefsandstates.md +230 -0
- package/docs/api/grid-pro.gridprov34.onlytemplatecoldefs.md +14 -0
- package/docs/api/grid-pro.gridprov34.pagination.md +21 -0
- package/docs/api/grid-pro.gridprov34.paginationpagesize.md +25 -0
- package/docs/api/grid-pro.gridprov34.persistcolumnstatekey.md +16 -0
- package/docs/api/grid-pro.gridprov34.persistfiltermodelkey.md +16 -0
- package/docs/api/grid-pro.gridprov34.provider.md +14 -0
- package/docs/api/grid-pro.gridprov34.restorecachedfilterconfig.md +18 -0
- package/docs/api/grid-pro.gridprov34.rowdata.md +18 -0
- package/docs/api/grid-pro.gridprov34.rowdatachanged.md +67 -0
- package/docs/api/grid-pro.gridprov34.rowheight.md +14 -0
- package/docs/api/grid-pro.gridprov34.setfiltermodel.md +55 -0
- package/docs/api/grid-pro.gridprov34.setuppaginationandstatusbar.md +53 -0
- package/docs/api/grid-pro.gridprov34.statepersistanceenabled.md +18 -0
- package/docs/api/grid-pro.gridprov34.statepersistence.md +14 -0
- package/docs/api/grid-pro.gridprov34.statusbarconfig.md +21 -0
- package/docs/api/grid-pro.gridprov34.thememode.md +14 -0
- package/docs/api/grid-pro.gridprov34.withstatusbar.md +21 -0
- package/docs/api/grid-pro.md +29 -1
- package/docs/api-report.md.api.md +377 -41
- package/package.json +16 -14
- package/docs/api/grid-pro.genesisgriddatasourceelement.aggrid.md +0 -11
- package/docs/api/grid-pro.gridprobasedatasource.applyasyncfuncname.md +0 -11
- package/docs/api/grid-pro.gridprobasedatasource.applytransactionasync.md +0 -66
- package/docs/api/grid-pro.gridprogenesisdatasource.applyasyncfuncname.md +0 -11
- package/docs/api/grid-pro.gridprogenesisdatasource.applytransactionasync.md +0 -66
|
@@ -19,7 +19,7 @@ export function getFilterByFieldType(type) {
|
|
|
19
19
|
return 'agDateColumnFilter';
|
|
20
20
|
case 'string':
|
|
21
21
|
case 'enum':
|
|
22
|
-
return '
|
|
22
|
+
return 'agTextColumnFilter'; // TODO: handle multi and set filter in criteriaFromFilters
|
|
23
23
|
default:
|
|
24
24
|
return 'agTextColumnFilter';
|
|
25
25
|
}
|
package/dist/esm/grid-pro.js
CHANGED
|
@@ -17,6 +17,7 @@ import { GridProClientSideDatasource, GridProServerSideDatasource } from './data
|
|
|
17
17
|
import { baseDatasourceEventNames } from './datasource/base.types';
|
|
18
18
|
import { agThemeFontFaceMap, defaultAgGridFontFace } from './external';
|
|
19
19
|
import { GridProGenesisDatasource, gridProGenesisDatasourceEventNames, } from './grid-pro-genesis-datasource';
|
|
20
|
+
import { datasourceEventNames, } from './grid-pro-genesis-datasource/datasource-events.types';
|
|
20
21
|
import { DEBOUNCED_RESIZE_TIME, gridProErrorNames, gridProEventNames, } from './grid-pro.definitions';
|
|
21
22
|
import { foundationGridProStyles as styles } from './grid-pro.styles';
|
|
22
23
|
import { gridProTemplate as template } from './grid-pro.template';
|
|
@@ -144,6 +145,7 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
144
145
|
this.gridFontFace = defaultAgGridFontFace;
|
|
145
146
|
this.columnComponentName = 'grid-pro-column';
|
|
146
147
|
this.theme = AgGridTheme.alpine;
|
|
148
|
+
this.themeMode = 'dark';
|
|
147
149
|
/**
|
|
148
150
|
* Enable pagination for the grid.
|
|
149
151
|
* @remarks
|
|
@@ -239,6 +241,7 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
239
241
|
}
|
|
240
242
|
hideDatasourceError() {
|
|
241
243
|
this.gridErrorItems = this.gridErrorItems.filter((item) => item.type !== gridProErrorNames.datasource);
|
|
244
|
+
this.removeAttribute('ds-disconnected');
|
|
242
245
|
}
|
|
243
246
|
connectedCallback() {
|
|
244
247
|
super.connectedCallback();
|
|
@@ -264,6 +267,7 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
264
267
|
this.rootEventsListeners.forEach(({ key, action }) => {
|
|
265
268
|
this.addEventListener(key, action);
|
|
266
269
|
});
|
|
270
|
+
this.toggleDatasourceEventListeners(true);
|
|
267
271
|
this.paginationPageSize = this.isServerSide
|
|
268
272
|
? this.gridProDatasource.maxRows
|
|
269
273
|
: DatasourceDefaults.DEFAULT_PAGINATION_PAGE_SIZE;
|
|
@@ -275,6 +279,7 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
275
279
|
this.rootEventsListeners.forEach(({ key, action }) => {
|
|
276
280
|
this.removeEventListener(key, action);
|
|
277
281
|
});
|
|
282
|
+
this.toggleDatasourceEventListeners(false);
|
|
278
283
|
DOM.queueUpdate(() => {
|
|
279
284
|
var _a;
|
|
280
285
|
if (!shouldRunDisconnect)
|
|
@@ -286,6 +291,257 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
286
291
|
this.registeredGridEvents.clear();
|
|
287
292
|
});
|
|
288
293
|
}
|
|
294
|
+
/**
|
|
295
|
+
* Helper method to add or remove datasource event listeners
|
|
296
|
+
* @internal
|
|
297
|
+
*/
|
|
298
|
+
toggleDatasourceEventListeners(add) {
|
|
299
|
+
const eventHandlers = [
|
|
300
|
+
[datasourceEventNames.initialize, this.handleInitialize],
|
|
301
|
+
[datasourceEventNames.dataLoaded, this.handleDataLoaded],
|
|
302
|
+
[datasourceEventNames.dataChanged, this.handleDataChanged],
|
|
303
|
+
[datasourceEventNames.schemaUpdated, this.handleSchemaUpdated],
|
|
304
|
+
[datasourceEventNames.dataCleared, this.handleDataCleared],
|
|
305
|
+
[datasourceEventNames.loadingStarted, this.handleLoadingStarted],
|
|
306
|
+
[datasourceEventNames.loadingFinished, this.handleLoadingFinished],
|
|
307
|
+
[datasourceEventNames.noDataAvailable, this.handleNoDataAvailable],
|
|
308
|
+
[datasourceEventNames.filtersRestored, this.handleFiltersRestored],
|
|
309
|
+
[datasourceEventNames.moreDataAvailable, this.handleMoreDataAvailable],
|
|
310
|
+
[datasourceEventNames.error, this.handleDatasourceError],
|
|
311
|
+
// Server-side specific events
|
|
312
|
+
[datasourceEventNames.cacheFilterConfig, this.cacheFilterConfig],
|
|
313
|
+
[datasourceEventNames.refreshServerSide, this.handleRefreshServerSide],
|
|
314
|
+
[datasourceEventNames.setServerSideDatasource, this.handleSetServerSideDatasource],
|
|
315
|
+
[datasourceEventNames.addGridCssClass, this.handleAddGridCssClass],
|
|
316
|
+
[datasourceEventNames.removeGridCssClass, this.handleRemoveGridCssClass],
|
|
317
|
+
[datasourceEventNames.applyServerSideTransaction, this.handleApplyServerSideTransaction],
|
|
318
|
+
];
|
|
319
|
+
const method = add ? 'addEventListener' : 'removeEventListener';
|
|
320
|
+
eventHandlers.forEach(([eventName, handler]) => {
|
|
321
|
+
this[method](eventName, handler.bind(this));
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Handles datasource initialization
|
|
326
|
+
* @internal
|
|
327
|
+
*/
|
|
328
|
+
handleInitialize(event) {
|
|
329
|
+
const { options, keepColDefsOnClearRowData } = event.detail;
|
|
330
|
+
// Set the grid options and initialize the grid
|
|
331
|
+
this.gridOptions = Object.assign(Object.assign({}, this.agGridOptions), options);
|
|
332
|
+
if (keepColDefsOnClearRowData) {
|
|
333
|
+
this.columnState = this.columnApi.getColumnState();
|
|
334
|
+
}
|
|
335
|
+
this.initGrid();
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Handles data loading from datasource
|
|
339
|
+
* @internal
|
|
340
|
+
*/
|
|
341
|
+
handleDataLoaded(event) {
|
|
342
|
+
const { data } = event.detail;
|
|
343
|
+
if (this.gridApi) {
|
|
344
|
+
this.gridApi.setRowData(data);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Handles data changes from datasource
|
|
349
|
+
* @internal
|
|
350
|
+
*/
|
|
351
|
+
handleDataChanged(event) {
|
|
352
|
+
var _a, _b, _c;
|
|
353
|
+
const { changes } = event.detail;
|
|
354
|
+
if (!this.gridApi)
|
|
355
|
+
return;
|
|
356
|
+
if (((_a = changes.add) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
357
|
+
if (this.asyncAdd) {
|
|
358
|
+
this.gridApi.applyTransactionAsync({ add: changes.add, addIndex: this.addIndex }, (result) => {
|
|
359
|
+
this.flashAddedCells(result === null || result === void 0 ? void 0 : result.add);
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
const result = this.gridApi.applyTransaction({ add: changes.add, addIndex: this.addIndex });
|
|
364
|
+
this.flashAddedCells(result === null || result === void 0 ? void 0 : result.add);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
if (((_b = changes.update) === null || _b === void 0 ? void 0 : _b.length) > 0) {
|
|
368
|
+
if (this.asyncUpdate) {
|
|
369
|
+
this.gridApi.applyTransactionAsync({ update: changes.update });
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
this.gridApi.applyTransaction({ update: changes.update });
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
if (((_c = changes.remove) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
|
376
|
+
if (this.asyncRemove) {
|
|
377
|
+
this.gridApi.applyTransactionAsync({ remove: changes.remove });
|
|
378
|
+
}
|
|
379
|
+
else {
|
|
380
|
+
this.gridApi.applyTransaction({ remove: changes.remove });
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
flashAddedCells(rowNodes) {
|
|
385
|
+
if (this.enableRowFlashing && (rowNodes === null || rowNodes === void 0 ? void 0 : rowNodes.length)) {
|
|
386
|
+
this.gridApi.flashCells({ rowNodes });
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Handles schema updates from datasource
|
|
391
|
+
* @internal
|
|
392
|
+
*/
|
|
393
|
+
handleSchemaUpdated(event) {
|
|
394
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
395
|
+
const { schema } = event.detail;
|
|
396
|
+
if (this.gridApi) {
|
|
397
|
+
// Merge with template definitions
|
|
398
|
+
const mergedColumnDefs = yield this.mergeAllColumnDefsAndStates(schema, true);
|
|
399
|
+
this.gridApi.setColumnDefs(mergedColumnDefs);
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Handles data clearing from datasource
|
|
405
|
+
* @internal
|
|
406
|
+
*/
|
|
407
|
+
handleDataCleared(event) {
|
|
408
|
+
var _a, _b;
|
|
409
|
+
const { includeSchema } = event.detail;
|
|
410
|
+
if (!this.gridApi)
|
|
411
|
+
return;
|
|
412
|
+
// Flush any pending async transactions
|
|
413
|
+
if (this.asyncAdd || this.asyncUpdate || this.asyncRemove) {
|
|
414
|
+
(_b = (_a = this.gridApi).flushAsyncTransactions) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
415
|
+
}
|
|
416
|
+
if (includeSchema) {
|
|
417
|
+
this.gridApi.setColumnDefs([]);
|
|
418
|
+
}
|
|
419
|
+
this.gridApi.setRowData([]);
|
|
420
|
+
this.gridApi.refreshCells({ force: true });
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Handles loading started from datasource
|
|
424
|
+
* @internal
|
|
425
|
+
*/
|
|
426
|
+
handleLoadingStarted() {
|
|
427
|
+
if (this.gridApi) {
|
|
428
|
+
this.gridApi.showLoadingOverlay();
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Handles loading finished from datasource
|
|
433
|
+
* @internal
|
|
434
|
+
*/
|
|
435
|
+
handleLoadingFinished() {
|
|
436
|
+
if (this.gridApi) {
|
|
437
|
+
this.gridApi.hideOverlay();
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Handles no data available from datasource
|
|
442
|
+
* @internal
|
|
443
|
+
*/
|
|
444
|
+
handleNoDataAvailable() {
|
|
445
|
+
if (this.gridApi) {
|
|
446
|
+
this.gridApi.showNoRowsOverlay();
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Handles filter restoration from datasource
|
|
451
|
+
* @internal
|
|
452
|
+
*/
|
|
453
|
+
handleFiltersRestored() {
|
|
454
|
+
this.restoreCachedFilterConfig();
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Handles more data availability from datasource
|
|
458
|
+
* @internal
|
|
459
|
+
*/
|
|
460
|
+
handleMoreDataAvailable(event) {
|
|
461
|
+
var _a, _b, _c, _d;
|
|
462
|
+
const { hasMoreData, sourceRef } = event.detail;
|
|
463
|
+
if (!this.gridApi)
|
|
464
|
+
return;
|
|
465
|
+
const statusBar = (_b = (_a = this.gridApi).getStatusPanel) === null || _b === void 0 ? void 0 : _b.call(_a, GridProStatusBarTypes.loadMore);
|
|
466
|
+
if (statusBar) {
|
|
467
|
+
(_d = (_c = statusBar).updateParams) === null || _d === void 0 ? void 0 : _d.call(_c, {
|
|
468
|
+
moreRows: hasMoreData,
|
|
469
|
+
sourceRef,
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Handles datasource errors
|
|
475
|
+
* @internal
|
|
476
|
+
*/
|
|
477
|
+
handleDatasourceError(event) {
|
|
478
|
+
// Set visual indicator on grid
|
|
479
|
+
this.setAttribute('ds-disconnected', 'ds-disconnected');
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Handles refreshing server-side data
|
|
483
|
+
* @internal
|
|
484
|
+
*/
|
|
485
|
+
handleRefreshServerSide(event) {
|
|
486
|
+
const { purge } = event.detail;
|
|
487
|
+
if (this.gridApi) {
|
|
488
|
+
this.gridApi.refreshServerSide({ purge });
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* Handles setting server-side datasource
|
|
493
|
+
* @internal
|
|
494
|
+
*/
|
|
495
|
+
handleSetServerSideDatasource(event) {
|
|
496
|
+
const { datasource } = event.detail;
|
|
497
|
+
if (this.gridApi) {
|
|
498
|
+
this.gridApi.setServerSideDatasource(datasource);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Handles adding CSS class to grid element
|
|
503
|
+
* @internal
|
|
504
|
+
*/
|
|
505
|
+
handleAddGridCssClass(event) {
|
|
506
|
+
var _a;
|
|
507
|
+
const { className } = event.detail;
|
|
508
|
+
// Add CSS class to grid element
|
|
509
|
+
const gridElement = ((_a = this.gridSlot) === null || _a === void 0 ? void 0 : _a.parentElement) || this;
|
|
510
|
+
if (gridElement) {
|
|
511
|
+
gridElement.classList.add(className);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Handles removing CSS class from grid element
|
|
516
|
+
* @internal
|
|
517
|
+
*/
|
|
518
|
+
handleRemoveGridCssClass(event) {
|
|
519
|
+
var _a;
|
|
520
|
+
const { className } = event.detail;
|
|
521
|
+
// Remove CSS class from grid element
|
|
522
|
+
const gridElement = ((_a = this.gridSlot) === null || _a === void 0 ? void 0 : _a.parentElement) || this;
|
|
523
|
+
if (gridElement) {
|
|
524
|
+
gridElement.classList.remove(className);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* Handles applying server-side transactions
|
|
529
|
+
* @internal
|
|
530
|
+
*/
|
|
531
|
+
handleApplyServerSideTransaction(event) {
|
|
532
|
+
const { transaction, async, callback } = event.detail;
|
|
533
|
+
if (!this.gridApi)
|
|
534
|
+
return;
|
|
535
|
+
if (async) {
|
|
536
|
+
this.gridApi.applyServerSideTransactionAsync(transaction, callback);
|
|
537
|
+
}
|
|
538
|
+
else {
|
|
539
|
+
const result = this.gridApi.applyServerSideTransaction(transaction);
|
|
540
|
+
if (callback) {
|
|
541
|
+
callback(result);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
289
545
|
combineAllGridComponents(gridOptionsComponents) {
|
|
290
546
|
const defaultFoundationAgComponents = {
|
|
291
547
|
[GridProRendererTypes.action]: ActionRenderer,
|
|
@@ -554,6 +810,7 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
554
810
|
});
|
|
555
811
|
const { columnDefs, components, defaultColDef, getRowId, onGridReady, onFilterChanged, onFirstDataRendered } = options, rest = __rest(options, ["columnDefs", "components", "defaultColDef", "getRowId", "onGridReady", "onFilterChanged", "onFirstDataRendered"]);
|
|
556
812
|
const derivedOptions = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, this.gridOptionsConfig), { defaultColDef: Object.assign({ enableCellChangeFlash: this.enableCellFlashing, filter: true, resizable: true, sortable: true }, defaultColDef), components: this.combineAllGridComponents(components), suppressDragLeaveHidesColumns: true }), this.eventsAndCallbacks), { onGridReady: (event) => {
|
|
813
|
+
var _a, _b, _c;
|
|
557
814
|
this.gridApi = event.api;
|
|
558
815
|
this.columnApi = event.columnApi;
|
|
559
816
|
if (this.gridEventsQueue.length) {
|
|
@@ -567,6 +824,12 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
567
824
|
if (onGridReady) {
|
|
568
825
|
onGridReady(event);
|
|
569
826
|
}
|
|
827
|
+
if (((_a = this.gridProDatasource) === null || _a === void 0 ? void 0 : _a.keepColDefsOnClearRowData) && ((_b = this.columnState) === null || _b === void 0 ? void 0 : _b.length) > 0) {
|
|
828
|
+
this.columnApi.applyColumnState({
|
|
829
|
+
state: this.columnState,
|
|
830
|
+
applyOrder: true,
|
|
831
|
+
});
|
|
832
|
+
}
|
|
570
833
|
this.$emit(Events.EVENT_GRID_READY, {
|
|
571
834
|
event,
|
|
572
835
|
gridId: this.id,
|
|
@@ -576,6 +839,10 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
576
839
|
event,
|
|
577
840
|
gridId: this.id,
|
|
578
841
|
});
|
|
842
|
+
// Emit datasource ready event, signals that the datasource is ready to be used
|
|
843
|
+
// TODO: prevent rendering datasource slot until grid is ready
|
|
844
|
+
// so there is no need for this even and handling it in datasources
|
|
845
|
+
(_c = this.gridProDatasource) === null || _c === void 0 ? void 0 : _c.$emit(datasourceEventNames.ready, { pagination: this.pagination });
|
|
579
846
|
this.restoreColumnState.bind(this)();
|
|
580
847
|
this.restoreCachedFilterConfig.bind(this)();
|
|
581
848
|
this.debouncedColumnAutosize.bind(this)();
|
|
@@ -592,16 +859,21 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
592
859
|
onFilterChanged(filterChangedEvent);
|
|
593
860
|
}
|
|
594
861
|
}, onGridSizeChanged: gridOnChangeCallback, onSortChanged: gridOnChangeCallback }), rest);
|
|
862
|
+
const hasGetRowId = 'getRowId' in (options !== null && options !== void 0 ? options : {});
|
|
595
863
|
if (this.gridProDatasource) {
|
|
596
864
|
derivedOptions.columnDefs = columnDefs;
|
|
597
|
-
|
|
865
|
+
if (hasGetRowId) {
|
|
866
|
+
derivedOptions.getRowId = getRowId;
|
|
867
|
+
}
|
|
598
868
|
this.setupPaginationAndStatusBar(derivedOptions);
|
|
599
869
|
this.setLocalGridOptions(derivedOptions);
|
|
600
870
|
}
|
|
601
871
|
else {
|
|
602
872
|
this.mergeAllColumnDefsAndStates(columnDefs).then((value) => {
|
|
603
873
|
derivedOptions.columnDefs = value;
|
|
604
|
-
|
|
874
|
+
if (hasGetRowId) {
|
|
875
|
+
derivedOptions.getRowId = getRowId;
|
|
876
|
+
}
|
|
605
877
|
this.setupPaginationAndStatusBar(derivedOptions);
|
|
606
878
|
this.setLocalGridOptions(derivedOptions);
|
|
607
879
|
this.initGrid();
|
|
@@ -609,14 +881,14 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
609
881
|
}
|
|
610
882
|
}
|
|
611
883
|
setLocalGridOptions(derivedOptions) {
|
|
612
|
-
this.agGridOptions = Object.assign(Object.assign({}, this.agGridOptions), ComponentUtil.copyAttributesToGridOptions(derivedOptions, this.agAttributes));
|
|
884
|
+
this.agGridOptions = Object.assign(Object.assign({}, (this.agGridOptions || {})), ComponentUtil.copyAttributesToGridOptions(derivedOptions, this.agAttributes));
|
|
613
885
|
}
|
|
614
886
|
/**
|
|
615
887
|
* Clears the local grid options, this is used to clear the grid options when the grid is restarted.
|
|
616
888
|
* @public
|
|
617
889
|
*/
|
|
618
890
|
clearLocalGridOptions() {
|
|
619
|
-
this.agGridOptions =
|
|
891
|
+
this.agGridOptions = {};
|
|
620
892
|
}
|
|
621
893
|
initGrid() {
|
|
622
894
|
DOM.queueUpdate(() => {
|
|
@@ -735,11 +1007,11 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
735
1007
|
panelExists(statusPanelType, panels) {
|
|
736
1008
|
return panels.some((panel) => panel.statusPanel === statusPanelType);
|
|
737
1009
|
}
|
|
738
|
-
addRowCountPanel(statusPanels) {
|
|
1010
|
+
addRowCountPanel(statusPanels, gridOptions) {
|
|
739
1011
|
// For server-side models, AG Grid's built-in row count components don't work properly
|
|
740
1012
|
// because they expect access to the complete dataset. Instead, rely on our custom
|
|
741
1013
|
// pagination component which properly handles server-side row counts.
|
|
742
|
-
if (this.isServerSide) {
|
|
1014
|
+
if (this.isServerSide || (gridOptions === null || gridOptions === void 0 ? void 0 : gridOptions.rowModelType) === 'serverSide') {
|
|
743
1015
|
return;
|
|
744
1016
|
}
|
|
745
1017
|
if (this.statusBarConfig && this.statusBarConfig.rows === true) {
|
|
@@ -779,7 +1051,7 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
779
1051
|
}
|
|
780
1052
|
addDatasourcePanels(statusPanels) {
|
|
781
1053
|
if (this.gridProDatasource) {
|
|
782
|
-
const datasourceStatusPanels = this.gridProDatasource.getDatasourceStatusBarPanels(this.isServerSide);
|
|
1054
|
+
const datasourceStatusPanels = this.gridProDatasource.getDatasourceStatusBarPanels(this.isServerSide, this.statusBarConfig);
|
|
783
1055
|
// Filter out duplicate datasource panels
|
|
784
1056
|
const newDatasourcePanels = datasourceStatusPanels.filter((panel) => !this.panelExists(panel.statusPanel, statusPanels));
|
|
785
1057
|
statusPanels.push(...newDatasourcePanels);
|
|
@@ -810,7 +1082,7 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
|
|
|
810
1082
|
// unless they are user-defined panels that we want to preserve
|
|
811
1083
|
const existingPanels = ((_a = gridOptions.statusBar) === null || _a === void 0 ? void 0 : _a.statusPanels) || [];
|
|
812
1084
|
const statusPanels = [...existingPanels];
|
|
813
|
-
this.addRowCountPanel(statusPanels);
|
|
1085
|
+
this.addRowCountPanel(statusPanels, gridOptions);
|
|
814
1086
|
this.addMaxRowsPanel(statusPanels);
|
|
815
1087
|
this.addAggregationPanel(statusPanels);
|
|
816
1088
|
this.addDatasourcePanels(statusPanels);
|
|
@@ -1057,6 +1329,9 @@ __decorate([
|
|
|
1057
1329
|
__decorate([
|
|
1058
1330
|
observable
|
|
1059
1331
|
], GridPro.prototype, "gridSlot", void 0);
|
|
1332
|
+
__decorate([
|
|
1333
|
+
observable
|
|
1334
|
+
], GridPro.prototype, "themeMode", void 0);
|
|
1060
1335
|
__decorate([
|
|
1061
1336
|
observable
|
|
1062
1337
|
], GridPro.prototype, "gridComponents", void 0);
|
|
@@ -8,7 +8,7 @@ import { getErrorHandlerDialogTemplate } from './datasource/error-handler.dialog
|
|
|
8
8
|
*/
|
|
9
9
|
export const getGridProTemplate = (prefix = 'foundation') => html `
|
|
10
10
|
<template>
|
|
11
|
-
<span part="grid" class="${(x) => x.classNames}">
|
|
11
|
+
<span part="grid" data-ag-theme-mode=${(x) => x.themeMode} class="${(x) => x.classNames}">
|
|
12
12
|
<slot name="grid" ${ref('gridSlot')}></slot>
|
|
13
13
|
<slot></slot>
|
|
14
14
|
</span>
|
package/dist/esm/index.js
CHANGED
|
@@ -152,31 +152,38 @@ export class PaginationStatusBarComponent {
|
|
|
152
152
|
return button;
|
|
153
153
|
}
|
|
154
154
|
goToPage(page) {
|
|
155
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
155
156
|
switch (page) {
|
|
156
157
|
case 'first':
|
|
157
|
-
this.api.paginationGoToFirstPage()
|
|
158
|
+
((_b = (_a = this.api).paginationGoToFirstPage) === null || _b === void 0 ? void 0 : _b.call(_a)) ||
|
|
159
|
+
((_d = (_c = this.api.paginationProxy) === null || _c === void 0 ? void 0 : _c.goToFirstPage) === null || _d === void 0 ? void 0 : _d.call(_c));
|
|
158
160
|
break;
|
|
159
161
|
case 'previous':
|
|
160
|
-
this.api.paginationGoToPreviousPage()
|
|
162
|
+
((_f = (_e = this.api).paginationGoToPreviousPage) === null || _f === void 0 ? void 0 : _f.call(_e)) ||
|
|
163
|
+
((_h = (_g = this.api.paginationProxy) === null || _g === void 0 ? void 0 : _g.goToPreviousPage) === null || _h === void 0 ? void 0 : _h.call(_g));
|
|
161
164
|
break;
|
|
162
165
|
case 'next':
|
|
163
|
-
this.api.paginationGoToNextPage()
|
|
166
|
+
((_k = (_j = this.api).paginationGoToNextPage) === null || _k === void 0 ? void 0 : _k.call(_j)) ||
|
|
167
|
+
((_m = (_l = this.api.paginationProxy) === null || _l === void 0 ? void 0 : _l.goToNextPage) === null || _m === void 0 ? void 0 : _m.call(_l));
|
|
164
168
|
break;
|
|
165
169
|
case 'last':
|
|
166
|
-
this.api.paginationGoToLastPage()
|
|
170
|
+
((_p = (_o = this.api).paginationGoToLastPage) === null || _p === void 0 ? void 0 : _p.call(_o)) ||
|
|
171
|
+
((_r = (_q = this.api.paginationProxy) === null || _q === void 0 ? void 0 : _q.goToLastPage) === null || _r === void 0 ? void 0 : _r.call(_q));
|
|
167
172
|
break;
|
|
168
173
|
}
|
|
169
174
|
}
|
|
170
175
|
updateDisplay() {
|
|
171
|
-
var _a, _b, _c, _d;
|
|
172
|
-
|
|
173
|
-
const
|
|
174
|
-
const
|
|
175
|
-
const
|
|
176
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
177
|
+
// Use compatibility layer for v34 pagination API
|
|
178
|
+
const apiAny = this.api;
|
|
179
|
+
const currentPage = ((_e = (_b = (_a = apiAny.paginationGetCurrentPage) === null || _a === void 0 ? void 0 : _a.call(apiAny)) !== null && _b !== void 0 ? _b : (_d = (_c = apiAny.paginationProxy) === null || _c === void 0 ? void 0 : _c.getCurrentPage) === null || _d === void 0 ? void 0 : _d.call(_c)) !== null && _e !== void 0 ? _e : 0) + 1; // 1-based for display
|
|
180
|
+
const totalPages = (_k = (_g = (_f = apiAny.paginationGetTotalPages) === null || _f === void 0 ? void 0 : _f.call(apiAny)) !== null && _g !== void 0 ? _g : (_j = (_h = apiAny.paginationProxy) === null || _h === void 0 ? void 0 : _h.getTotalPages) === null || _j === void 0 ? void 0 : _j.call(_h)) !== null && _k !== void 0 ? _k : 1;
|
|
181
|
+
const pageSize = (_m = (_l = apiAny.paginationGetPageSize) === null || _l === void 0 ? void 0 : _l.call(apiAny)) !== null && _m !== void 0 ? _m : (_p = (_o = apiAny.paginationProxy) === null || _o === void 0 ? void 0 : _o.getPageSize) === null || _p === void 0 ? void 0 : _p.call(_o);
|
|
182
|
+
const rowCount = (_r = (_q = apiAny.paginationGetRowCount) === null || _q === void 0 ? void 0 : _q.call(apiAny)) !== null && _r !== void 0 ? _r : (_t = (_s = apiAny.paginationProxy) === null || _s === void 0 ? void 0 : _s.getMasterRowCount) === null || _t === void 0 ? void 0 : _t.call(_s);
|
|
176
183
|
// Check if we're in server-side mode and if the total count is uncertain
|
|
177
184
|
// Add null checks for test environment compatibility
|
|
178
|
-
const isServerSide = ((
|
|
179
|
-
const hasUncertainTotal = isServerSide &&
|
|
185
|
+
const isServerSide = ((_x = (_w = (_v = (_u = this.api).getModel) === null || _v === void 0 ? void 0 : _v.call(_u)) === null || _w === void 0 ? void 0 : _w.getType) === null || _x === void 0 ? void 0 : _x.call(_w)) === 'serverSide';
|
|
186
|
+
const hasUncertainTotal = isServerSide && apiAny.paginationIsLastPageFound && !apiAny.paginationIsLastPageFound();
|
|
180
187
|
// Update the page numbers
|
|
181
188
|
this.pageNumberDisplay.textContent = currentPage.toString();
|
|
182
189
|
this.pageNumberTotalDisplay.textContent = hasUncertainTotal ? 'more' : totalPages.toString();
|