ag-grid-community 33.2.2 → 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.
@@ -23675,7 +23675,8 @@ class FocusService extends beanStub_1.BeanStub {
23675
23675
  // grid cell will still be focused as far as the grid is concerned,
23676
23676
  // however the browser focus will have moved somewhere else.
23677
23677
  getFocusCellToUseAfterRefresh() {
23678
- if (this.gos.get('suppressFocusAfterRefresh') || !this.focusedCell) {
23678
+ const { gos, focusedCell } = this;
23679
+ if (gos.get('suppressFocusAfterRefresh') || gos.get('suppressCellFocus') || !focusedCell) {
23679
23680
  return null;
23680
23681
  }
23681
23682
  // we check that the browser is actually focusing on the grid, if it is not, then
@@ -23684,7 +23685,7 @@ class FocusService extends beanStub_1.BeanStub {
23684
23685
  if (!this.doesRowOrCellHaveBrowserFocus()) {
23685
23686
  return null;
23686
23687
  }
23687
- return this.focusedCell;
23688
+ return focusedCell;
23688
23689
  }
23689
23690
  getFocusHeaderToUseAfterRefresh() {
23690
23691
  if (this.gos.get('suppressFocusAfterRefresh') || !this.focusedHeader) {
@@ -25426,7 +25427,7 @@ class GridBodyScrollFeature extends beanStub_1.BeanStub {
25426
25427
  shouldBlockHorizontalScroll(scrollTo) {
25427
25428
  const clientWidth = this.centerRowsCtrl.getCenterWidth();
25428
25429
  const { scrollWidth } = this.centerRowsCtrl.eViewport;
25429
- if (this.enableRtl && (0, dom_1._isRtlNegativeScroll)()) {
25430
+ if (this.enableRtl) {
25430
25431
  if (scrollTo > 0) {
25431
25432
  return true;
25432
25433
  }
@@ -25471,7 +25472,7 @@ class GridBodyScrollFeature extends beanStub_1.BeanStub {
25471
25472
  // if this is call is coming from the alignedGridsSvc, we don't need to validate the
25472
25473
  // scroll, because it has already been validated by the grid firing the scroll event.
25473
25474
  if (!fromAlignedGridsService && this.shouldBlockScrollUpdate(ScrollDir.Horizontal, hScrollPosition)) {
25474
- if (this.enableRtl && (0, dom_1._isRtlNegativeScroll)()) {
25475
+ if (this.enableRtl) {
25475
25476
  hScrollPosition = hScrollPosition > 0 ? 0 : maxScrollLeft;
25476
25477
  }
25477
25478
  else {
@@ -43950,6 +43951,9 @@ class RowCtrl extends beanStub_1.BeanStub {
43950
43951
  this.allRowGuis.forEach(callback);
43951
43952
  }
43952
43953
  }
43954
+ isRowRendered() {
43955
+ return this.allRowGuis.length > 0;
43956
+ }
43953
43957
  onRowHeightChanged(gui) {
43954
43958
  // check for exists first - if the user is resetting the row height, then
43955
43959
  // it will be null (or undefined) momentarily until the next time the flatten
@@ -44449,37 +44453,50 @@ class RowRenderer extends beanStub_1.BeanStub {
44449
44453
  this.allRowCtrls = liveList;
44450
44454
  }
44451
44455
  }
44452
- isCellRendered(rowIndex, column) {
44456
+ /**
44457
+ * Checks if the cell is rendered or not. Also returns true if row ctrl is present but has not rendered
44458
+ * cells yet.
44459
+ * @returns true if cellCtrl is present, or if the row is present but has not rendered rows yet
44460
+ */
44461
+ isCellBeingRendered(rowIndex, column) {
44453
44462
  const rowCtrl = this.rowCtrlsByRowIndex[rowIndex];
44454
- // if no column, simply check for row ctrl
44455
- if (!column) {
44463
+ // if no column, simply check for row ctrl, if no rowCtrl then return false
44464
+ if (!column || !rowCtrl) {
44456
44465
  return !!rowCtrl;
44457
44466
  }
44458
- if (rowCtrl && rowCtrl.isFullWidth()) {
44467
+ if (rowCtrl.isFullWidth()) {
44459
44468
  return true;
44460
44469
  }
44461
- // check if this is spanned, if it has been rendered by the span renderer
44470
+ // return true if:
44471
+ // - spannedRowRenderer has a cell for this position,
44472
+ // - or if the rowCtrl has a cell for this column
44473
+ // - or if the row is not rendered yet, as it might try to render it
44462
44474
  const spannedCell = this.beans.spannedRowRenderer?.getCellByPosition({ rowIndex, column, rowPinned: null });
44463
- if (spannedCell) {
44464
- return true;
44465
- }
44466
- // otherwise, check if the cell is rendered
44467
- return !!rowCtrl?.getCellCtrl(column);
44475
+ return !!spannedCell || !!rowCtrl.getCellCtrl(column) || !rowCtrl.isRowRendered();
44468
44476
  }
44469
44477
  /**
44470
44478
  * Notifies all row and cell controls of any change in focused cell.
44471
44479
  * @param event cell focused event
44472
44480
  */
44481
+ updateCellFocus(event) {
44482
+ this.getAllCellCtrls().forEach((cellCtrl) => cellCtrl.onCellFocused(event));
44483
+ this.getFullWidthRowCtrls().forEach((rowCtrl) => rowCtrl.onFullWidthRowFocused(event));
44484
+ }
44485
+ /**
44486
+ * Called when a new cell is focused in the grid
44487
+ * - if the focused cell isn't rendered; re-draw rows to dry to render it
44488
+ * - subsequently updates all cell and row controls with the new focused cell
44489
+ * @param event cell focused event
44490
+ */
44473
44491
  onCellFocusChanged(event) {
44474
44492
  // if the focused cell has not been rendered, need to render cell so focus can be captured.
44475
44493
  if (event && event.rowIndex != null && !event.rowPinned) {
44476
44494
  const col = this.beans.colModel.getCol(event.column) ?? undefined;
44477
- if (!this.isCellRendered(event.rowIndex, col)) {
44495
+ if (!this.isCellBeingRendered(event.rowIndex, col)) {
44478
44496
  this.redraw();
44479
44497
  }
44480
44498
  }
44481
- this.getAllCellCtrls().forEach((cellCtrl) => cellCtrl.onCellFocused(event));
44482
- this.getFullWidthRowCtrls().forEach((rowCtrl) => rowCtrl.onFullWidthRowFocused(event));
44499
+ this.updateCellFocus(event);
44483
44500
  }
44484
44501
  onSuppressCellFocusChanged(suppressCellFocus) {
44485
44502
  this.getAllCellCtrls().forEach((cellCtrl) => cellCtrl.onSuppressCellFocusChanged(suppressCellFocus));
@@ -44490,10 +44507,8 @@ class RowRenderer extends beanStub_1.BeanStub {
44490
44507
  // all active cells.
44491
44508
  registerCellEventListeners() {
44492
44509
  this.addManagedEventListeners({
44493
- cellFocused: (event) => {
44494
- this.onCellFocusChanged(event);
44495
- },
44496
- cellFocusCleared: () => this.onCellFocusChanged(),
44510
+ cellFocused: (event) => this.onCellFocusChanged(event),
44511
+ cellFocusCleared: () => this.updateCellFocus(),
44497
44512
  flashCells: (event) => {
44498
44513
  const { cellFlashSvc } = this.beans;
44499
44514
  if (cellFlashSvc) {
@@ -44840,7 +44855,7 @@ class RowRenderer extends beanStub_1.BeanStub {
44840
44855
  }
44841
44856
  // if the grid lost focus, we need to try to bring it back
44842
44857
  if (!focusSvc.doesRowOrCellHaveBrowserFocus()) {
44843
- this.onCellFocusChanged((0, gridOptionsUtils_1._addGridCommonParams)(this.gos, {
44858
+ this.updateCellFocus((0, gridOptionsUtils_1._addGridCommonParams)(this.gos, {
44844
44859
  ...cellToFocus,
44845
44860
  forceBrowserFocus: true,
44846
44861
  preventScrollOnBrowserFocus: true,
@@ -52833,11 +52848,10 @@ exports._parseDateTimeFromString = _parseDateTimeFromString;
52833
52848
 
52834
52849
 
52835
52850
  Object.defineProperty(exports, "__esModule", ({ value: true }));
52836
- exports._createElement = exports.DataRefAttribute = exports._requestAnimationFrame = exports._preserveRangesWhile = exports._observeResize = exports._addOrRemoveAttribute = exports._isNodeOrElement = exports._formatSize = exports._setFixedHeight = exports._setFixedWidth = exports._setElementWidth = exports._isVerticalScrollShowing = exports._isHorizontalScrollShowing = exports._addStylesToElement = exports._insertWithDomOrder = exports._setDomChildOrder = exports._ensureDomOrder = exports._loadTemplate = exports._isVisible = exports._isInDOM = exports._removeFromParent = exports._clearElement = exports._setScrollLeft = exports._getScrollLeft = exports._isRtlNegativeScroll = exports._getElementRectWithOffset = exports._getAbsoluteWidth = exports._getAbsoluteHeight = exports._getInnerWidth = exports._getInnerHeight = exports._getElementSize = exports._isElementChildOfClass = exports._setDisabled = exports._setVisible = exports._setDisplayed = exports._isFocusableFormField = exports.FOCUSABLE_EXCLUDE = exports.FOCUSABLE_SELECTOR = exports._radioCssClass = void 0;
52851
+ exports._createElement = exports.DataRefAttribute = exports._requestAnimationFrame = exports._preserveRangesWhile = exports._observeResize = exports._addOrRemoveAttribute = exports._isNodeOrElement = exports._formatSize = exports._setFixedHeight = exports._setFixedWidth = exports._setElementWidth = exports._isVerticalScrollShowing = exports._isHorizontalScrollShowing = exports._addStylesToElement = exports._insertWithDomOrder = exports._setDomChildOrder = exports._ensureDomOrder = exports._loadTemplate = exports._isVisible = exports._isInDOM = exports._removeFromParent = exports._clearElement = exports._setScrollLeft = exports._getScrollLeft = exports._getElementRectWithOffset = exports._getAbsoluteWidth = exports._getAbsoluteHeight = exports._getInnerWidth = exports._getInnerHeight = exports._getElementSize = exports._isElementChildOfClass = exports._setDisabled = exports._setVisible = exports._setDisplayed = exports._isFocusableFormField = exports.FOCUSABLE_EXCLUDE = exports.FOCUSABLE_SELECTOR = exports._radioCssClass = void 0;
52837
52852
  const gridOptionsUtils_1 = __webpack_require__(7274);
52838
52853
  const aria_1 = __webpack_require__(5230);
52839
52854
  const browser_1 = __webpack_require__(8667);
52840
- let rtlNegativeScroll;
52841
52855
  /**
52842
52856
  * This method adds a class to an element and remove that class from all siblings.
52843
52857
  * Useful for toggling state.
@@ -52980,52 +52994,17 @@ function _getElementRectWithOffset(el) {
52980
52994
  };
52981
52995
  }
52982
52996
  exports._getElementRectWithOffset = _getElementRectWithOffset;
52983
- function _isRtlNegativeScroll() {
52984
- if (typeof rtlNegativeScroll === 'boolean') {
52985
- return rtlNegativeScroll;
52986
- }
52987
- const template = document.createElement('div');
52988
- template.style.direction = 'rtl';
52989
- template.style.width = '10px';
52990
- template.style.height = '5px';
52991
- template.style.position = 'fixed';
52992
- template.style.top = '0px';
52993
- template.style.overflow = 'hidden';
52994
- template.dir = 'rtl';
52995
- template.innerHTML =
52996
- /* html */
52997
- `<div style="width: 20px">
52998
- <span style="display: inline-block; width: 1px"></span>
52999
- <span style="display: inline-block; width: 1px"></span>
53000
- </div>`;
53001
- document.body.appendChild(template);
53002
- template.scrollLeft = 1;
53003
- rtlNegativeScroll = Math.floor(template.scrollLeft) === 0;
53004
- document.body.removeChild(template);
53005
- return rtlNegativeScroll;
53006
- }
53007
- exports._isRtlNegativeScroll = _isRtlNegativeScroll;
53008
52997
  function _getScrollLeft(element, rtl) {
53009
52998
  let scrollLeft = element.scrollLeft;
53010
52999
  if (rtl) {
53011
- // Absolute value - for FF that reports RTL scrolls in negative numbers
53012
53000
  scrollLeft = Math.abs(scrollLeft);
53013
- if ((0, browser_1._isBrowserChrome)() && !_isRtlNegativeScroll()) {
53014
- scrollLeft = element.scrollWidth - element.getBoundingClientRect().width - scrollLeft;
53015
- }
53016
53001
  }
53017
53002
  return scrollLeft;
53018
53003
  }
53019
53004
  exports._getScrollLeft = _getScrollLeft;
53020
53005
  function _setScrollLeft(element, value, rtl) {
53021
53006
  if (rtl) {
53022
- // Chrome and Safari when doing RTL have the END position of the scroll as zero, not the start
53023
- if (_isRtlNegativeScroll()) {
53024
- value *= -1;
53025
- }
53026
- else if ((0, browser_1._isBrowserSafari)() || (0, browser_1._isBrowserChrome)()) {
53027
- value = element.scrollWidth - element.getBoundingClientRect().width - value;
53028
- }
53007
+ value *= -1;
53029
53008
  }
53030
53009
  element.scrollLeft = value;
53031
53010
  }
@@ -57389,7 +57368,7 @@ exports.VanillaFrameworkOverrides = VanillaFrameworkOverrides;
57389
57368
  Object.defineProperty(exports, "__esModule", ({ value: true }));
57390
57369
  exports.VERSION = void 0;
57391
57370
  // DO NOT UPDATE MANUALLY: Generated from script during build time
57392
- exports.VERSION = '33.2.2';
57371
+ exports.VERSION = '33.2.4';
57393
57372
 
57394
57373
 
57395
57374
  /***/ }),