@genesislcap/grid-pro 15.63.0 → 15.64.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.
Files changed (44) hide show
  1. package/.cursor/rules/ag-embedded-components.mdc +1 -0
  2. package/dist/custom-elements.json +12848 -12340
  3. package/dist/dts/column-selection/column-selection.styles.d.ts.map +1 -1
  4. package/dist/dts/datasource/base.datasource.d.ts +2 -1
  5. package/dist/dts/datasource/base.datasource.d.ts.map +1 -1
  6. package/dist/dts/grid-components.d.ts +9 -0
  7. package/dist/dts/grid-components.d.ts.map +1 -1
  8. package/dist/dts/grid-pro.d.ts +58 -11
  9. package/dist/dts/grid-pro.d.ts.map +1 -1
  10. package/dist/dts/grid-pro.template.d.ts.map +1 -1
  11. package/dist/dts/grid-pro.types.d.ts +4 -7
  12. package/dist/dts/grid-pro.types.d.ts.map +1 -1
  13. package/dist/dts/index.d.ts +1 -0
  14. package/dist/dts/index.d.ts.map +1 -1
  15. package/dist/dts/react.d.ts +68 -58
  16. package/dist/dts/status-bar/index.d.ts +5 -0
  17. package/dist/dts/status-bar/index.d.ts.map +1 -0
  18. package/dist/dts/status-bar/resolve-status-bar-panels.d.ts +43 -0
  19. package/dist/dts/status-bar/resolve-status-bar-panels.d.ts.map +1 -0
  20. package/dist/dts/status-bar/status-bar.d.ts +439 -0
  21. package/dist/dts/status-bar/status-bar.d.ts.map +1 -0
  22. package/dist/dts/status-bar/status-bar.styles.d.ts +6 -0
  23. package/dist/dts/status-bar/status-bar.styles.d.ts.map +1 -0
  24. package/dist/dts/status-bar/status-bar.template.d.ts +12 -0
  25. package/dist/dts/status-bar/status-bar.template.d.ts.map +1 -0
  26. package/dist/esm/column-selection/column-selection.styles.js +26 -5
  27. package/dist/esm/datasource/base.datasource.js +3 -3
  28. package/dist/esm/grid-components.js +2 -0
  29. package/dist/esm/grid-pro.js +144 -113
  30. package/dist/esm/grid-pro.styles.js +1 -1
  31. package/dist/esm/grid-pro.template.js +23 -12
  32. package/dist/esm/grid-pro.types.js +2 -3
  33. package/dist/esm/index.js +1 -0
  34. package/dist/esm/status-bar/index.js +4 -0
  35. package/dist/esm/status-bar/resolve-status-bar-panels.js +67 -0
  36. package/dist/esm/status-bar/status-bar.js +171 -0
  37. package/dist/esm/status-bar/status-bar.styles.js +49 -0
  38. package/dist/esm/status-bar/status-bar.template.js +16 -0
  39. package/dist/esm/status-bar-components/row-count.status-bar.js +2 -1
  40. package/dist/grid-pro.api.json +1672 -488
  41. package/dist/grid-pro.d.ts +569 -18
  42. package/dist/react.cjs +46 -39
  43. package/dist/react.mjs +38 -32
  44. package/package.json +12 -12
@@ -1,5 +1,4 @@
1
1
  import { __awaiter, __decorate, __rest } from "tslib";
2
- import { DatasourceDefaults } from '@genesislcap/foundation-comms';
3
2
  import { avoidTreeShaking, LifecycleMixin, respondToVisibility, } from '@genesislcap/foundation-utils';
4
3
  import { baseLayerLuminance, StandardLuminance } from '@microsoft/fast-components';
5
4
  import { attr, css, DOM, observable } from '@microsoft/fast-element';
@@ -24,10 +23,12 @@ import { agDragGhostShadowDomStyles, rowMatchAlertStyles } from './grid-pro.styl
24
23
  import { gridProTemplate as template } from './grid-pro.template';
25
24
  import { DEFAULT_STATUS_BAR_CONFIG, EDITED_COLUMN_FIELD, ERROR_COLUMN_FIELD, GRID_READY_EVENT, GridOptionsConfig, GridProRendererTypes, GridProStatusBarTypes, } from './grid-pro.types';
26
25
  import { StatePersistence } from './state-persistence';
26
+ import { GridProStatusBar } from './status-bar';
27
+ import { resolveAgStatusBarPanels, } from './status-bar/resolve-status-bar-panels';
27
28
  import { LabelValueStatusBarComponent, LoadMoreStatusBarComponent, ReloadStatusBarComponent, RowCountStatusBarComponent, } from './status-bar-components';
28
29
  import { ErrorTooltip } from './tooltips';
29
30
  import { convertToKebabCase, logger, mergeAndDedupColDefWithColumnState, sanitizeColumnState, } from './utils';
30
- avoidTreeShaking(GridProGenesisDatasource, GridProClientSideDatasource, GridProServerSideDatasource, GridProInfiniteDatasource, GridProCell, GridProColumn, ColumnSelection);
31
+ avoidTreeShaking(GridProGenesisDatasource, GridProClientSideDatasource, GridProServerSideDatasource, GridProInfiniteDatasource, GridProCell, GridProColumn, ColumnSelection, GridProStatusBar);
31
32
  ModuleRegistry.registerModules([
32
33
  CsvExportModule,
33
34
  ClientSideRowModelModule,
@@ -123,6 +124,40 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
123
124
  this.initGrid();
124
125
  }
125
126
  }
127
+ withStatusBarChanged() {
128
+ this.applyStatusBarMode();
129
+ }
130
+ /**
131
+ * AG's enterprise status bar is in use, configured from `statusBarConfig` as before.
132
+ * @internal
133
+ */
134
+ get usesAgStatusBar() {
135
+ return this.statusBarMode === 'ag';
136
+ }
137
+ /**
138
+ * Grid Pro renders its own status-bar host.
139
+ * @internal
140
+ */
141
+ get usesCommunityStatusBar() {
142
+ return this.statusBarMode === 'community';
143
+ }
144
+ /**
145
+ * The status-bar host, once its element is registered with the design system.
146
+ * @internal
147
+ */
148
+ get statusBar() {
149
+ const el = this.statusBarRef;
150
+ if (!el)
151
+ return undefined;
152
+ if (el instanceof GridProStatusBar)
153
+ return el;
154
+ if (!this.warnedUnregisteredStatusBar) {
155
+ this.warnedUnregisteredStatusBar = true;
156
+ logger.warn(`Grid Pro: <${el.localName}> is not registered, so the status bar is not shown. ` +
157
+ 'Register the design system status bar element (e.g. rapidGridProStatusBar) with the grid.');
158
+ }
159
+ return undefined;
160
+ }
126
161
  enableColumnSelectionChanged() {
127
162
  this.syncColumnSelectionHostLayout();
128
163
  }
@@ -178,19 +213,26 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
178
213
  /**
179
214
  * Configuration for the grid status bar components.
180
215
  * @remarks
181
- * This requires AG Grid Enterprise module to be enabled.
182
- * The status bar will only be displayed if the Enterprise module is available.
183
- * @see https://www.ag-grid.com/javascript-data-grid/component-status-bar/
216
+ * Rendered by the status-bar host. `aggregation` is ignored until a panel exists for it.
184
217
  */
185
218
  this.statusBarConfig = DEFAULT_STATUS_BAR_CONFIG;
186
219
  /**
187
- * Enables or disables the grid status bar.
220
+ * Enables or disables the status bar under the grid.
188
221
  * @remarks
189
222
  * Default is false.
190
223
  * When disabled, no status bar will be displayed regardless of statusBarConfig.
191
- * This requires AG Grid Enterprise module to be available for the status bar to be displayed when enabled.
192
224
  */
193
225
  this.withStatusBar = false;
226
+ /**
227
+ * Which status bar the grid uses, decided once the grid api exists: `ag` when AG Grid's
228
+ * enterprise `StatusBarModule` is registered, `community` otherwise. `pending` renders neither.
229
+ * @internal
230
+ */
231
+ this.statusBarMode = 'pending';
232
+ /** Params pushed to status panels, replayed when the community bar mounts or rebuilds one. */
233
+ this.statusPanelState = {};
234
+ this.warnedUnregisteredStatusBar = false;
235
+ this.warnedGridOptionsStatusBar = false;
194
236
  /**
195
237
  * Shows a Columns side panel on the trailing edge of the grid.
196
238
  * @public
@@ -331,6 +373,7 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
331
373
  var _a;
332
374
  super.connectedCallback();
333
375
  this.syncColumnSelectionHostLayout();
376
+ this.syncStatusBarHostLayout();
334
377
  this.disposed = false;
335
378
  const luminanceTarget = (_a = this.provider) !== null && _a !== void 0 ? _a : this;
336
379
  this.luminanceSubscription = baseLayerLuminance.subscribe(this.luminanceObserver, luminanceTarget);
@@ -403,6 +446,44 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
403
446
  syncColumnSelectionHostLayout() {
404
447
  this.classList.toggle('has-column-selection', this.enableColumnSelection);
405
448
  }
449
+ syncStatusBarHostLayout() {
450
+ this.classList.toggle('has-status-bar', !!this.withStatusBar && this.usesCommunityStatusBar);
451
+ }
452
+ /**
453
+ * Chooses between AG's enterprise status bar and the community bar once the grid api exists,
454
+ * and hands AG its `statusBar` option when the enterprise one is used.
455
+ */
456
+ applyStatusBarMode() {
457
+ var _a, _b, _c;
458
+ const api = this.gridApi;
459
+ if (api && !((_a = api.isDestroyed) === null || _a === void 0 ? void 0 : _a.call(api))) {
460
+ this.statusBarMode = ((_b = api.isModuleRegistered) === null || _b === void 0 ? void 0 : _b.call(api, 'StatusBarModule')) ? 'ag' : 'community';
461
+ if (this.usesAgStatusBar) {
462
+ api.setGridOption('statusBar', this.buildAgStatusBar((_c = api.getGridOption) === null || _c === void 0 ? void 0 : _c.call(api, 'rowModelType')));
463
+ }
464
+ else if (this.withStatusBar && this.userStatusBar && !this.warnedGridOptionsStatusBar) {
465
+ this.warnedGridOptionsStatusBar = true;
466
+ logger.warn('Grid Pro: gridOptions.statusBar is ignored because the AG Grid Enterprise ' +
467
+ 'StatusBarModule is not registered. Use statusBarConfig instead.');
468
+ }
469
+ }
470
+ this.syncStatusBarHostLayout();
471
+ }
472
+ buildAgStatusBar(rowModelType) {
473
+ var _a, _b;
474
+ if (!this.withStatusBar) {
475
+ return this.userStatusBar;
476
+ }
477
+ const userPanels = (_b = (_a = this.userStatusBar) === null || _a === void 0 ? void 0 : _a.statusPanels) !== null && _b !== void 0 ? _b : [];
478
+ const statusPanels = resolveAgStatusBarPanels({
479
+ withStatusBar: this.withStatusBar,
480
+ statusBarConfig: this.statusBarConfig,
481
+ isServerSide: this.isServerSide || rowModelType === 'serverSide',
482
+ isInfiniteRowModel: this.isInfiniteRowModel || rowModelType === 'infinite',
483
+ gridProDatasource: this.gridProDatasource,
484
+ }, userPanels);
485
+ return Object.assign(Object.assign({}, this.userStatusBar), { statusPanels });
486
+ }
406
487
  performDisconnectCleanup() {
407
488
  if (this.debounced) {
408
489
  clearTimeout(this.debounced);
@@ -424,12 +505,17 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
424
505
  this.gridEventsQueue = [];
425
506
  }
426
507
  destroyGridInstance() {
508
+ var _a;
427
509
  if (this.gridApi) {
428
510
  this.gridEventListeners.forEach((listener, eventType) => {
429
511
  this.gridApi.removeEventListener(eventType, listener);
430
512
  });
431
513
  }
432
514
  this.gridEventListeners.clear();
515
+ // Panels hold grid api listeners; release them while the api is still alive.
516
+ (_a = this.statusBar) === null || _a === void 0 ? void 0 : _a.releasePanels();
517
+ // The next grid's datasource reports its own Load More state.
518
+ delete this.statusPanelState[GridProStatusBarTypes.loadMore];
433
519
  if (this.gridApi) {
434
520
  this.gridApi.destroy();
435
521
  }
@@ -668,17 +754,25 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
668
754
  * @internal
669
755
  */
670
756
  handleMoreDataAvailable(event) {
671
- var _a, _b, _c, _d;
672
757
  const { hasMoreData, sourceRef } = event.detail;
673
- if (!this.gridApi)
674
- return;
675
- const statusBar = (_b = (_a = this.gridApi).getStatusPanel) === null || _b === void 0 ? void 0 : _b.call(_a, GridProStatusBarTypes.loadMore);
676
- if (statusBar) {
677
- (_d = (_c = statusBar).updateParams) === null || _d === void 0 ? void 0 : _d.call(_c, {
678
- moreRows: hasMoreData,
679
- sourceRef,
680
- });
758
+ this.updateStatusPanel(GridProStatusBarTypes.loadMore, { moreRows: hasMoreData, sourceRef });
759
+ }
760
+ updateStatusPanel(key, params) {
761
+ var _a;
762
+ if (!this.usesAgStatusBar) {
763
+ // Kept even before the bar exists, so the community panel mounts with the right state.
764
+ this.statusPanelState[key] = Object.assign(Object.assign({}, this.statusPanelState[key]), params);
681
765
  }
766
+ const panel = this.getStatusPanel(key);
767
+ (_a = panel === null || panel === void 0 ? void 0 : panel.updateParams) === null || _a === void 0 ? void 0 : _a.call(panel, params);
768
+ return panel;
769
+ }
770
+ /**
771
+ * Params pushed to a status panel so far, for the community bar to mount it with.
772
+ * @internal
773
+ */
774
+ getStatusPanelState(key) {
775
+ return this.statusPanelState[key];
682
776
  }
683
777
  /**
684
778
  * Handles datasource errors
@@ -899,6 +993,20 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
899
993
  const selectedRows = this.getSelectedRows();
900
994
  return selectedRows.length > 0;
901
995
  }
996
+ /**
997
+ * Returns a mounted status-bar panel by type.
998
+ * @public
999
+ * @param key - Panel type, one of {@link GridProStatusBarTypes}.
1000
+ * @remarks
1001
+ * Works for both the community status bar and AG Grid's enterprise one.
1002
+ */
1003
+ getStatusPanel(key) {
1004
+ var _a, _b, _c;
1005
+ if (this.usesAgStatusBar) {
1006
+ return (_b = (_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.getStatusPanel) === null || _b === void 0 ? void 0 : _b.call(_a, key);
1007
+ }
1008
+ return (_c = this.statusBar) === null || _c === void 0 ? void 0 : _c.getStatusPanel(key);
1009
+ }
902
1010
  /**
903
1011
  * Updates the label-value status bar component with new label and value
904
1012
  * @public
@@ -913,16 +1021,12 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
913
1021
  * ```
914
1022
  */
915
1023
  updateLabelValueStatusBar(params) {
916
- var _a, _b;
917
1024
  if (!this.gridApi) {
918
1025
  logger.warn('Grid Pro: Cannot update label-value status bar - grid API not available');
919
1026
  return;
920
1027
  }
921
- const statusBar = (_b = (_a = this.gridApi).getStatusPanel) === null || _b === void 0 ? void 0 : _b.call(_a, GridProStatusBarTypes.labelValue);
922
- if (statusBar && typeof statusBar.updateParams === 'function') {
923
- statusBar.updateParams(params);
924
- }
925
- else {
1028
+ const panel = this.updateStatusPanel(GridProStatusBarTypes.labelValue, Object.assign({}, params));
1029
+ if (!panel || typeof panel.updateParams !== 'function') {
926
1030
  logger.warn('Grid Pro: Label-value status bar component not found or updateParams method not available');
927
1031
  }
928
1032
  }
@@ -1096,10 +1200,12 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
1096
1200
  return;
1097
1201
  this.agAttributes[attrName] = attribute.value;
1098
1202
  });
1099
- const { columnDefs, components, defaultColDef, getRowId, onGridReady, onFilterChanged, onFirstDataRendered } = options, rest = __rest(options, ["columnDefs", "components", "defaultColDef", "getRowId", "onGridReady", "onFilterChanged", "onFirstDataRendered"]);
1100
- 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), headerHeight: this.headerHeight, rowHeight: this.rowHeight, animateRows: false, suppressDragLeaveHidesColumns: true }), this.eventsAndCallbacks), { onGridReady: (event) => __awaiter(this, void 0, void 0, function* () {
1203
+ const { columnDefs, components, defaultColDef, getRowId, onGridReady, onFilterChanged, onFirstDataRendered, statusBar } = options, rest = __rest(options, ["columnDefs", "components", "defaultColDef", "getRowId", "onGridReady", "onFilterChanged", "onFirstDataRendered", "statusBar"]);
1204
+ this.userStatusBar = statusBar;
1205
+ const derivedOptions = Object.assign(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), headerHeight: this.headerHeight, rowHeight: this.rowHeight, animateRows: false, suppressDragLeaveHidesColumns: true }), this.eventsAndCallbacks), { onGridReady: (event) => __awaiter(this, void 0, void 0, function* () {
1101
1206
  var _a, _b, _c;
1102
1207
  this.gridApi = event.api;
1208
+ this.applyStatusBarMode();
1103
1209
  if (this.gridEventsQueue.length) {
1104
1210
  this.gridEventsQueue.forEach((type) => {
1105
1211
  this.addGridEventListener(type);
@@ -1178,7 +1284,7 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
1178
1284
  if (onFilterChanged) {
1179
1285
  onFilterChanged(filterChangedEvent);
1180
1286
  }
1181
- }, onGridSizeChanged: gridOnChangeCallback, onSortChanged: gridOnChangeCallback }), rest);
1287
+ }, onGridSizeChanged: gridOnChangeCallback, onSortChanged: gridOnChangeCallback }), rest), (statusBar && !this.withStatusBar ? { statusBar } : {}));
1182
1288
  if (this.gridProDatasource) {
1183
1289
  derivedOptions.columnDefs = columnDefs;
1184
1290
  derivedOptions.getRowId = getRowId;
@@ -1340,95 +1446,17 @@ export class GridPro extends LifecycleMixin(FoundationElement) {
1340
1446
  return colDefsToReturn;
1341
1447
  });
1342
1448
  }
1343
- panelExists(statusPanelType, panels) {
1344
- return panels.some((panel) => panel.statusPanel === statusPanelType);
1345
- }
1346
- addRowCountPanel(statusPanels, gridOptions) {
1347
- // The custom rowCount panel is used for server-side infinite scroll (load more) scenarios;
1348
- // client-side row models use AG Grid's own row count component instead.
1349
- if (this.statusBarConfig && this.statusBarConfig.rows === true) {
1350
- // Check the derived gridOptions parameter, not this.gridOptions: setupStatusBar runs
1351
- // before setLocalGridOptions populates the field, so on first init the field is still
1352
- // undefined and a standalone grid's rowModelType would be missed.
1353
- const isServerSide = this.isServerSide ||
1354
- this.isInfiniteRowModel ||
1355
- (gridOptions === null || gridOptions === void 0 ? void 0 : gridOptions.rowModelType) === 'infinite' ||
1356
- (gridOptions === null || gridOptions === void 0 ? void 0 : gridOptions.rowModelType) === 'serverSide';
1357
- if (isServerSide) {
1358
- if (!this.panelExists(GridProStatusBarTypes.rowCount, statusPanels)) {
1359
- statusPanels.push({
1360
- statusPanel: GridProStatusBarTypes.rowCount,
1361
- align: 'left',
1362
- });
1363
- }
1364
- }
1365
- else if (!isServerSide) {
1366
- const rowCountStatusPanel = 'agTotalAndFilteredRowCountComponent';
1367
- if (!this.panelExists(rowCountStatusPanel, statusPanels)) {
1368
- statusPanels.push({
1369
- statusPanel: rowCountStatusPanel,
1370
- align: 'left',
1371
- });
1372
- }
1373
- }
1374
- }
1375
- }
1376
- addMaxRowsPanel(statusPanels) {
1377
- if (this.statusBarConfig && this.statusBarConfig.maxRows === true) {
1378
- if (!this.panelExists(GridProStatusBarTypes.labelValue, statusPanels)) {
1379
- statusPanels.push({
1380
- statusPanel: GridProStatusBarTypes.labelValue,
1381
- statusPanelParams: {
1382
- label: 'Max Rows',
1383
- value: this.gridProDatasource.maxRows || DatasourceDefaults.MAX_ROWS_250,
1384
- hide: false,
1385
- },
1386
- align: 'left',
1387
- });
1388
- }
1389
- }
1390
- }
1391
- addAggregationPanel(statusPanels) {
1392
- if (this.statusBarConfig && this.statusBarConfig.aggregation === true) {
1393
- if (!this.panelExists('agAggregationComponent', statusPanels)) {
1394
- statusPanels.push({
1395
- statusPanel: 'agAggregationComponent',
1396
- align: 'right',
1397
- });
1398
- }
1399
- }
1400
- }
1401
- addDatasourcePanels(statusPanels) {
1402
- if (this.gridProDatasource) {
1403
- // The infinite row model loads on scroll, so its loadMore() is a no-op: suppress the
1404
- // Load More panel for it the same way it is suppressed for the server-side row model.
1405
- const datasourceStatusPanels = this.gridProDatasource.getDatasourceStatusBarPanels(this.isServerSide || this.isInfiniteRowModel, this.statusBarConfig);
1406
- // Filter out duplicate datasource panels
1407
- const newDatasourcePanels = datasourceStatusPanels.filter((panel) => !this.panelExists(panel.statusPanel, statusPanels));
1408
- statusPanels.push(...newDatasourcePanels);
1409
- }
1410
- }
1449
+ /**
1450
+ * Refreshes the status bar from the current config and datasource: AG's enterprise bar when the
1451
+ * previous grid had its module, otherwise the status-bar host.
1452
+ */
1411
1453
  setupStatusBar(gridOptions) {
1412
- // Keep the guard for production code, but allow override for testing
1413
- // if (this.initialised && !allowDuplicateCheck) return;
1414
- var _a, _b;
1415
- // Set default status bar with components based on configuration
1416
- if (this.withStatusBar && this.statusBarConfig) {
1417
- // For duplicate checking (testing scenario), clear existing status panels to prevent duplicates
1418
- // unless they are user-defined panels that we want to preserve
1419
- const existingPanels = ((_a = gridOptions.statusBar) === null || _a === void 0 ? void 0 : _a.statusPanels) || [];
1420
- const statusPanels = [...existingPanels];
1421
- this.addRowCountPanel(statusPanels, gridOptions);
1422
- this.addMaxRowsPanel(statusPanels);
1423
- this.addAggregationPanel(statusPanels);
1424
- this.addDatasourcePanels(statusPanels);
1425
- const userDefinedStatusPanels = ((_b = gridOptions.statusBar) === null || _b === void 0 ? void 0 : _b.statusPanels) || [];
1426
- const newUserDefinedPanels = userDefinedStatusPanels.filter((panel) => !this.panelExists(panel.statusPanel, statusPanels));
1427
- statusPanels.push(...newUserDefinedPanels);
1428
- gridOptions.statusBar = {
1429
- statusPanels: statusPanels,
1430
- };
1454
+ var _a;
1455
+ if (this.usesAgStatusBar && this.withStatusBar) {
1456
+ gridOptions.statusBar = this.buildAgStatusBar(gridOptions.rowModelType);
1457
+ return;
1431
1458
  }
1459
+ (_a = this.statusBar) === null || _a === void 0 ? void 0 : _a.syncPanels();
1432
1460
  }
1433
1461
  get observedAttributes() {
1434
1462
  // allow properties to be supplied either lowercased or kebab-cased
@@ -1537,6 +1565,9 @@ __decorate([
1537
1565
  __decorate([
1538
1566
  attr({ mode: 'boolean', attribute: 'with-status-bar' })
1539
1567
  ], GridPro.prototype, "withStatusBar", void 0);
1568
+ __decorate([
1569
+ observable
1570
+ ], GridPro.prototype, "statusBarMode", void 0);
1540
1571
  __decorate([
1541
1572
  attr({ mode: 'boolean', attribute: 'enable-column-selection' })
1542
1573
  ], GridPro.prototype, "enableColumnSelection", void 0);
@@ -1578,7 +1609,7 @@ export const foundationGridPro = GridPro.compose(Object.assign({ baseName: 'grid
1578
1609
  height: 100%;
1579
1610
  }
1580
1611
 
1581
- :host([ds-disconnected]) {
1612
+ :host([ds-disconnected]:not(.has-column-selection):not(.has-status-bar)) {
1582
1613
  display: block;
1583
1614
  }
1584
1615
 
@@ -101,7 +101,7 @@ export const foundationGridProStyles = css `
101
101
  height: 100%;
102
102
  }
103
103
 
104
- :host([ds-disconnected]) {
104
+ :host([ds-disconnected]:not(.has-column-selection):not(.has-status-bar)) {
105
105
  display: block;
106
106
  }
107
107
 
@@ -8,18 +8,29 @@ import { getErrorHandlerDialogTemplate } from './datasource/error-handler.dialog
8
8
  */
9
9
  export const getGridProTemplate = (prefix = 'foundation') => html `
10
10
  <template>
11
- <span part="grid" data-ag-theme-mode=${(x) => x.themeMode} class="${(x) => x.classNames}">
12
- <slot name="grid" ${ref('gridSlot')}></slot>
13
- <slot></slot>
14
- </span>
15
- ${when((x) => !!x.enableColumnSelection, html `
16
- <div class="grid-pro-side-bar" part="side-bar">
17
- <${prefix}-column-selection
18
- docked
19
- label="Columns"
20
- :gridHost="${(x) => x}"
21
- ></${prefix}-column-selection>
22
- </div>
11
+ <div class="grid-pro-main" part="main">
12
+ <span part="grid" data-ag-theme-mode=${(x) => x.themeMode} class="${(x) => x.classNames}">
13
+ <slot name="grid" ${ref('gridSlot')}></slot>
14
+ <slot></slot>
15
+ </span>
16
+ ${when((x) => !!x.enableColumnSelection, html `
17
+ <div class="grid-pro-side-bar" part="side-bar">
18
+ <${prefix}-column-selection
19
+ docked
20
+ label="Columns"
21
+ :gridHost="${(x) => x}"
22
+ ></${prefix}-column-selection>
23
+ </div>
24
+ `)}
25
+ </div>
26
+ ${when((x) => !!x.withStatusBar && !!x.usesCommunityStatusBar, html `
27
+ <${prefix}-grid-pro-status-bar
28
+ class="grid-pro-status-bar"
29
+ ${ref('statusBarRef')}
30
+ :gridHost="${(x) => x}"
31
+ :gridApi="${(x) => x.gridApi}"
32
+ :statusBarConfig="${(x) => x.statusBarConfig}"
33
+ ></${prefix}-grid-pro-status-bar>
23
34
  `)}
24
35
  ${(x) => x.customErrorHandlerTemplate
25
36
  ? x.customErrorHandlerTemplate(prefix, x.gridErrorItems.filter(({ type }) => type === 'datasource'))
@@ -141,9 +141,8 @@ export var GridProRendererTypes;
141
141
  * The available Grid Pro Status Bar Types
142
142
  * @public
143
143
  * @remarks
144
- * These status bar components require AG Grid Enterprise module to be enabled.
145
- * Status bar components will only be displayed if the Enterprise module is available.
146
- * @see https://www.ag-grid.com/javascript-data-grid/component-status-bar/
144
+ * Mounted by the status-bar host on {@link GridPro}.
145
+ * `aggregation` is ignored until a panel exists for it.
147
146
  */
148
147
  export var GridProStatusBarTypes;
149
148
  (function (GridProStatusBarTypes) {
package/dist/esm/index.js CHANGED
@@ -17,6 +17,7 @@ export * from './grid-pro-genesis-datasource';
17
17
  export * from './multicolumn-dropdown';
18
18
  export * from './row-alert';
19
19
  export * from './state-persistence';
20
+ export * from './status-bar';
20
21
  export * from './status-bar-components';
21
22
  export * from './style';
22
23
  export * from './tooltips';
@@ -0,0 +1,4 @@
1
+ export * from './resolve-status-bar-panels';
2
+ export * from './status-bar';
3
+ export * from './status-bar.styles';
4
+ export * from './status-bar.template';
@@ -0,0 +1,67 @@
1
+ import { DatasourceDefaults } from '@genesislcap/foundation-comms';
2
+ import { GridProStatusBarTypes } from '../grid-pro.types';
3
+ /**
4
+ * Builds the status-bar panel list from `withStatusBar` + `statusBarConfig`.
5
+ * `aggregation` is ignored until a panel exists for it.
6
+ * @internal
7
+ */
8
+ export function resolveStatusBarPanels(host) {
9
+ return buildPanels(host, false);
10
+ }
11
+ /**
12
+ * Builds the panel list for AG Grid's enterprise status bar, used when its `StatusBarModule` is
13
+ * registered. Client-side grids get AG's filtered / total row count, and `aggregation` maps to
14
+ * AG's aggregation panel. Panels from `gridOptions.statusBar` come first and are kept.
15
+ * @internal
16
+ */
17
+ export function resolveAgStatusBarPanels(host, userPanels = []) {
18
+ const panels = [...userPanels];
19
+ for (const panel of buildPanels(host, true)) {
20
+ if (!panels.some((existing) => existing.statusPanel === panel.statusPanel)) {
21
+ panels.push(panel);
22
+ }
23
+ }
24
+ return panels;
25
+ }
26
+ function buildPanels(host, agStatusBar) {
27
+ var _a;
28
+ const config = host.statusBarConfig;
29
+ if (!host.withStatusBar || !config) {
30
+ return [];
31
+ }
32
+ const panels = [];
33
+ const fetchesOnScroll = host.isServerSide || host.isInfiniteRowModel;
34
+ if (config.rows === true) {
35
+ panels.push({
36
+ statusPanel: agStatusBar && !fetchesOnScroll
37
+ ? 'agTotalAndFilteredRowCountComponent'
38
+ : GridProStatusBarTypes.rowCount,
39
+ align: 'left',
40
+ });
41
+ }
42
+ if (config.maxRows === true) {
43
+ panels.push({
44
+ statusPanel: GridProStatusBarTypes.labelValue,
45
+ statusPanelParams: {
46
+ label: 'Max Rows',
47
+ value: ((_a = host.gridProDatasource) === null || _a === void 0 ? void 0 : _a.maxRows) || DatasourceDefaults.MAX_ROWS_250,
48
+ hide: false,
49
+ },
50
+ align: 'left',
51
+ });
52
+ }
53
+ if (agStatusBar && config.aggregation === true) {
54
+ panels.push({ statusPanel: 'agAggregationComponent', align: 'right' });
55
+ }
56
+ const datasource = host.gridProDatasource;
57
+ if (datasource === null || datasource === void 0 ? void 0 : datasource.getDatasourceStatusBarPanels) {
58
+ // Both row models fetch on scroll, so Load More would do nothing.
59
+ const datasourcePanels = datasource.getDatasourceStatusBarPanels(fetchesOnScroll, config);
60
+ for (const panel of datasourcePanels) {
61
+ if (!panels.some((existing) => existing.statusPanel === panel.statusPanel)) {
62
+ panels.push(panel);
63
+ }
64
+ }
65
+ }
66
+ return panels;
67
+ }