ag-grid-community 33.2.3 → 33.2.4

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.
@@ -22292,7 +22292,8 @@ class FocusService extends beanStub_1.BeanStub {
22292
22292
  // grid cell will still be focused as far as the grid is concerned,
22293
22293
  // however the browser focus will have moved somewhere else.
22294
22294
  getFocusCellToUseAfterRefresh() {
22295
- if (this.gos.get('suppressFocusAfterRefresh') || !this.focusedCell) {
22295
+ const { gos, focusedCell } = this;
22296
+ if (gos.get('suppressFocusAfterRefresh') || gos.get('suppressCellFocus') || !focusedCell) {
22296
22297
  return null;
22297
22298
  }
22298
22299
  // we check that the browser is actually focusing on the grid, if it is not, then
@@ -22301,7 +22302,7 @@ class FocusService extends beanStub_1.BeanStub {
22301
22302
  if (!this.doesRowOrCellHaveBrowserFocus()) {
22302
22303
  return null;
22303
22304
  }
22304
- return this.focusedCell;
22305
+ return focusedCell;
22305
22306
  }
22306
22307
  getFocusHeaderToUseAfterRefresh() {
22307
22308
  if (this.gos.get('suppressFocusAfterRefresh') || !this.focusedHeader) {
@@ -42553,6 +42554,9 @@ class RowCtrl extends beanStub_1.BeanStub {
42553
42554
  this.allRowGuis.forEach(callback);
42554
42555
  }
42555
42556
  }
42557
+ isRowRendered() {
42558
+ return this.allRowGuis.length > 0;
42559
+ }
42556
42560
  onRowHeightChanged(gui) {
42557
42561
  // check for exists first - if the user is resetting the row height, then
42558
42562
  // it will be null (or undefined) momentarily until the next time the flatten
@@ -43052,37 +43056,50 @@ class RowRenderer extends beanStub_1.BeanStub {
43052
43056
  this.allRowCtrls = liveList;
43053
43057
  }
43054
43058
  }
43055
- isCellRendered(rowIndex, column) {
43059
+ /**
43060
+ * Checks if the cell is rendered or not. Also returns true if row ctrl is present but has not rendered
43061
+ * cells yet.
43062
+ * @returns true if cellCtrl is present, or if the row is present but has not rendered rows yet
43063
+ */
43064
+ isCellBeingRendered(rowIndex, column) {
43056
43065
  const rowCtrl = this.rowCtrlsByRowIndex[rowIndex];
43057
- // if no column, simply check for row ctrl
43058
- if (!column) {
43066
+ // if no column, simply check for row ctrl, if no rowCtrl then return false
43067
+ if (!column || !rowCtrl) {
43059
43068
  return !!rowCtrl;
43060
43069
  }
43061
- if (rowCtrl && rowCtrl.isFullWidth()) {
43070
+ if (rowCtrl.isFullWidth()) {
43062
43071
  return true;
43063
43072
  }
43064
- // check if this is spanned, if it has been rendered by the span renderer
43073
+ // return true if:
43074
+ // - spannedRowRenderer has a cell for this position,
43075
+ // - or if the rowCtrl has a cell for this column
43076
+ // - or if the row is not rendered yet, as it might try to render it
43065
43077
  const spannedCell = this.beans.spannedRowRenderer?.getCellByPosition({ rowIndex, column, rowPinned: null });
43066
- if (spannedCell) {
43067
- return true;
43068
- }
43069
- // otherwise, check if the cell is rendered
43070
- return !!rowCtrl?.getCellCtrl(column);
43078
+ return !!spannedCell || !!rowCtrl.getCellCtrl(column) || !rowCtrl.isRowRendered();
43071
43079
  }
43072
43080
  /**
43073
43081
  * Notifies all row and cell controls of any change in focused cell.
43074
43082
  * @param event cell focused event
43075
43083
  */
43084
+ updateCellFocus(event) {
43085
+ this.getAllCellCtrls().forEach((cellCtrl) => cellCtrl.onCellFocused(event));
43086
+ this.getFullWidthRowCtrls().forEach((rowCtrl) => rowCtrl.onFullWidthRowFocused(event));
43087
+ }
43088
+ /**
43089
+ * Called when a new cell is focused in the grid
43090
+ * - if the focused cell isn't rendered; re-draw rows to dry to render it
43091
+ * - subsequently updates all cell and row controls with the new focused cell
43092
+ * @param event cell focused event
43093
+ */
43076
43094
  onCellFocusChanged(event) {
43077
43095
  // if the focused cell has not been rendered, need to render cell so focus can be captured.
43078
43096
  if (event && event.rowIndex != null && !event.rowPinned) {
43079
43097
  const col = this.beans.colModel.getCol(event.column) ?? undefined;
43080
- if (!this.isCellRendered(event.rowIndex, col)) {
43098
+ if (!this.isCellBeingRendered(event.rowIndex, col)) {
43081
43099
  this.redraw();
43082
43100
  }
43083
43101
  }
43084
- this.getAllCellCtrls().forEach((cellCtrl) => cellCtrl.onCellFocused(event));
43085
- this.getFullWidthRowCtrls().forEach((rowCtrl) => rowCtrl.onFullWidthRowFocused(event));
43102
+ this.updateCellFocus(event);
43086
43103
  }
43087
43104
  onSuppressCellFocusChanged(suppressCellFocus) {
43088
43105
  this.getAllCellCtrls().forEach((cellCtrl) => cellCtrl.onSuppressCellFocusChanged(suppressCellFocus));
@@ -43093,10 +43110,8 @@ class RowRenderer extends beanStub_1.BeanStub {
43093
43110
  // all active cells.
43094
43111
  registerCellEventListeners() {
43095
43112
  this.addManagedEventListeners({
43096
- cellFocused: (event) => {
43097
- this.onCellFocusChanged(event);
43098
- },
43099
- cellFocusCleared: () => this.onCellFocusChanged(),
43113
+ cellFocused: (event) => this.onCellFocusChanged(event),
43114
+ cellFocusCleared: () => this.updateCellFocus(),
43100
43115
  flashCells: (event) => {
43101
43116
  const { cellFlashSvc } = this.beans;
43102
43117
  if (cellFlashSvc) {
@@ -43443,7 +43458,7 @@ class RowRenderer extends beanStub_1.BeanStub {
43443
43458
  }
43444
43459
  // if the grid lost focus, we need to try to bring it back
43445
43460
  if (!focusSvc.doesRowOrCellHaveBrowserFocus()) {
43446
- this.onCellFocusChanged((0, gridOptionsUtils_1._addGridCommonParams)(this.gos, {
43461
+ this.updateCellFocus((0, gridOptionsUtils_1._addGridCommonParams)(this.gos, {
43447
43462
  ...cellToFocus,
43448
43463
  forceBrowserFocus: true,
43449
43464
  preventScrollOnBrowserFocus: true,
@@ -55956,7 +55971,7 @@ exports.VanillaFrameworkOverrides = VanillaFrameworkOverrides;
55956
55971
  Object.defineProperty(exports, "__esModule", ({ value: true }));
55957
55972
  exports.VERSION = void 0;
55958
55973
  // DO NOT UPDATE MANUALLY: Generated from script during build time
55959
- exports.VERSION = '33.2.3';
55974
+ exports.VERSION = '33.2.4';
55960
55975
 
55961
55976
 
55962
55977
  /***/ }),
@@ -1239,7 +1239,7 @@ function _waitUntil(condition, callback, timeout = 100, timeoutMessage) {
1239
1239
  }
1240
1240
 
1241
1241
  // packages/ag-grid-community/src/version.ts
1242
- var VERSION = "33.2.3";
1242
+ var VERSION = "33.2.4";
1243
1243
 
1244
1244
  // packages/ag-grid-community/src/validation/logging.ts
1245
1245
  var MAX_URL_LENGTH = 2e3;
@@ -11652,6 +11652,9 @@ var RowCtrl = class extends BeanStub {
11652
11652
  this.allRowGuis.forEach(callback);
11653
11653
  }
11654
11654
  }
11655
+ isRowRendered() {
11656
+ return this.allRowGuis.length > 0;
11657
+ }
11655
11658
  onRowHeightChanged(gui) {
11656
11659
  if (this.rowNode.rowHeight == null) {
11657
11660
  return;
@@ -27787,13 +27790,14 @@ var FocusService = class extends BeanStub {
27787
27790
  // grid cell will still be focused as far as the grid is concerned,
27788
27791
  // however the browser focus will have moved somewhere else.
27789
27792
  getFocusCellToUseAfterRefresh() {
27790
- if (this.gos.get("suppressFocusAfterRefresh") || !this.focusedCell) {
27793
+ const { gos, focusedCell } = this;
27794
+ if (gos.get("suppressFocusAfterRefresh") || gos.get("suppressCellFocus") || !focusedCell) {
27791
27795
  return null;
27792
27796
  }
27793
27797
  if (!this.doesRowOrCellHaveBrowserFocus()) {
27794
27798
  return null;
27795
27799
  }
27796
- return this.focusedCell;
27800
+ return focusedCell;
27797
27801
  }
27798
27802
  getFocusHeaderToUseAfterRefresh() {
27799
27803
  if (this.gos.get("suppressFocusAfterRefresh") || !this.focusedHeader) {
@@ -31183,33 +31187,44 @@ var RowRenderer = class extends BeanStub {
31183
31187
  this.allRowCtrls = liveList;
31184
31188
  }
31185
31189
  }
31186
- isCellRendered(rowIndex, column) {
31190
+ /**
31191
+ * Checks if the cell is rendered or not. Also returns true if row ctrl is present but has not rendered
31192
+ * cells yet.
31193
+ * @returns true if cellCtrl is present, or if the row is present but has not rendered rows yet
31194
+ */
31195
+ isCellBeingRendered(rowIndex, column) {
31187
31196
  const rowCtrl = this.rowCtrlsByRowIndex[rowIndex];
31188
- if (!column) {
31197
+ if (!column || !rowCtrl) {
31189
31198
  return !!rowCtrl;
31190
31199
  }
31191
- if (rowCtrl && rowCtrl.isFullWidth()) {
31200
+ if (rowCtrl.isFullWidth()) {
31192
31201
  return true;
31193
31202
  }
31194
31203
  const spannedCell = this.beans.spannedRowRenderer?.getCellByPosition({ rowIndex, column, rowPinned: null });
31195
- if (spannedCell) {
31196
- return true;
31197
- }
31198
- return !!rowCtrl?.getCellCtrl(column);
31204
+ return !!spannedCell || !!rowCtrl.getCellCtrl(column) || !rowCtrl.isRowRendered();
31199
31205
  }
31200
31206
  /**
31201
31207
  * Notifies all row and cell controls of any change in focused cell.
31202
31208
  * @param event cell focused event
31203
31209
  */
31210
+ updateCellFocus(event) {
31211
+ this.getAllCellCtrls().forEach((cellCtrl) => cellCtrl.onCellFocused(event));
31212
+ this.getFullWidthRowCtrls().forEach((rowCtrl) => rowCtrl.onFullWidthRowFocused(event));
31213
+ }
31214
+ /**
31215
+ * Called when a new cell is focused in the grid
31216
+ * - if the focused cell isn't rendered; re-draw rows to dry to render it
31217
+ * - subsequently updates all cell and row controls with the new focused cell
31218
+ * @param event cell focused event
31219
+ */
31204
31220
  onCellFocusChanged(event) {
31205
31221
  if (event && event.rowIndex != null && !event.rowPinned) {
31206
31222
  const col = this.beans.colModel.getCol(event.column) ?? void 0;
31207
- if (!this.isCellRendered(event.rowIndex, col)) {
31223
+ if (!this.isCellBeingRendered(event.rowIndex, col)) {
31208
31224
  this.redraw();
31209
31225
  }
31210
31226
  }
31211
- this.getAllCellCtrls().forEach((cellCtrl) => cellCtrl.onCellFocused(event));
31212
- this.getFullWidthRowCtrls().forEach((rowCtrl) => rowCtrl.onFullWidthRowFocused(event));
31227
+ this.updateCellFocus(event);
31213
31228
  }
31214
31229
  onSuppressCellFocusChanged(suppressCellFocus) {
31215
31230
  this.getAllCellCtrls().forEach((cellCtrl) => cellCtrl.onSuppressCellFocusChanged(suppressCellFocus));
@@ -31220,10 +31235,8 @@ var RowRenderer = class extends BeanStub {
31220
31235
  // all active cells.
31221
31236
  registerCellEventListeners() {
31222
31237
  this.addManagedEventListeners({
31223
- cellFocused: (event) => {
31224
- this.onCellFocusChanged(event);
31225
- },
31226
- cellFocusCleared: () => this.onCellFocusChanged(),
31238
+ cellFocused: (event) => this.onCellFocusChanged(event),
31239
+ cellFocusCleared: () => this.updateCellFocus(),
31227
31240
  flashCells: (event) => {
31228
31241
  const { cellFlashSvc } = this.beans;
31229
31242
  if (cellFlashSvc) {
@@ -31532,7 +31545,7 @@ var RowRenderer = class extends BeanStub {
31532
31545
  return;
31533
31546
  }
31534
31547
  if (!focusSvc.doesRowOrCellHaveBrowserFocus()) {
31535
- this.onCellFocusChanged(
31548
+ this.updateCellFocus(
31536
31549
  _addGridCommonParams(this.gos, {
31537
31550
  ...cellToFocus,
31538
31551
  forceBrowserFocus: true,