@deephaven/iris-grid 0.85.40 → 0.85.41

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/IrisGrid.js CHANGED
@@ -1738,7 +1738,7 @@ class IrisGrid extends Component {
1738
1738
  columnCount
1739
1739
  } = model;
1740
1740
  var modelColumn = GridUtils.getModelIndex(column, movedColumns);
1741
- if (column == null || column < 0 || columnCount <= column || !model.isFilterable(modelColumn)) {
1741
+ if (column == null || columnCount <= column || !model.isFilterable(modelColumn)) {
1742
1742
  this.setState({
1743
1743
  focusedFilterBarColumn: null
1744
1744
  });
@@ -1749,23 +1749,13 @@ class IrisGrid extends Component {
1749
1749
  metrics
1750
1750
  } = this.state;
1751
1751
  assertNotNull(metrics);
1752
- var {
1753
- left,
1754
- rightVisible,
1755
- lastLeft
1756
- } = metrics;
1757
- if (column < left) {
1752
+ var metricState = this.getMetricState();
1753
+ assertNotNull(metricState);
1754
+ var scrollColumn = metricCalculator.getScrollLeftForColumn(column, metricState, metrics);
1755
+ if (scrollColumn != null) {
1758
1756
  var _this$grid4;
1759
1757
  (_this$grid4 = this.grid) === null || _this$grid4 === void 0 ? void 0 : _this$grid4.setViewState({
1760
- left: column
1761
- }, true);
1762
- } else if (rightVisible < column) {
1763
- var _this$grid5;
1764
- var metricState = this.getMetricState();
1765
- assertNotNull(metricState);
1766
- var newLeft = metricCalculator.getLastLeft(metricState, column, metricCalculator.getVisibleWidth(metricState));
1767
- (_this$grid5 = this.grid) === null || _this$grid5 === void 0 ? void 0 : _this$grid5.setViewState({
1768
- left: Math.min(newLeft, lastLeft),
1758
+ left: scrollColumn,
1769
1759
  leftOffset: 0
1770
1760
  }, true);
1771
1761
  }
@@ -1776,13 +1766,13 @@ class IrisGrid extends Component {
1776
1766
  });
1777
1767
  }
1778
1768
  hideColumnByVisibleIndex(columnVisibleIndex) {
1779
- var _this$grid6;
1769
+ var _this$grid5;
1780
1770
  var {
1781
1771
  metricCalculator,
1782
1772
  movedColumns
1783
1773
  } = this.state;
1784
1774
  metricCalculator.setColumnWidth(GridUtils.getModelIndex(columnVisibleIndex, movedColumns), 0);
1785
- (_this$grid6 = this.grid) === null || _this$grid6 === void 0 ? void 0 : _this$grid6.forceUpdate();
1775
+ (_this$grid5 = this.grid) === null || _this$grid5 === void 0 ? void 0 : _this$grid5.forceUpdate();
1786
1776
  }
1787
1777
  freezeColumnByColumnName(columnName) {
1788
1778
  var {
@@ -1854,7 +1844,7 @@ class IrisGrid extends Component {
1854
1844
  }
1855
1845
  }
1856
1846
  handleColumnVisibilityChanged(modelIndexes, isVisible) {
1857
- var _this$grid7;
1847
+ var _this$grid6;
1858
1848
  var {
1859
1849
  metricCalculator,
1860
1850
  metrics
@@ -1875,7 +1865,7 @@ class IrisGrid extends Component {
1875
1865
  metricCalculator.setColumnWidth(modelIndex, 0);
1876
1866
  });
1877
1867
  }
1878
- (_this$grid7 = this.grid) === null || _this$grid7 === void 0 ? void 0 : _this$grid7.forceUpdate();
1868
+ (_this$grid6 = this.grid) === null || _this$grid6 === void 0 ? void 0 : _this$grid6.forceUpdate();
1879
1869
  }
1880
1870
  handleColumnVisibilityReset() {
1881
1871
  var _model$layoutHints$fr, _model$layoutHints2;
@@ -1905,8 +1895,8 @@ class IrisGrid extends Component {
1905
1895
  });
1906
1896
  }
1907
1897
  handleAnimationLoop() {
1908
- var _this$grid8;
1909
- (_this$grid8 = this.grid) === null || _this$grid8 === void 0 ? void 0 : _this$grid8.updateCanvas();
1898
+ var _this$grid7;
1899
+ (_this$grid7 = this.grid) === null || _this$grid7 === void 0 ? void 0 : _this$grid7.updateCanvas();
1910
1900
  if (this.isAnimating) {
1911
1901
  this.animationFrame = requestAnimationFrame(this.handleAnimationLoop);
1912
1902
  }
@@ -1960,7 +1950,7 @@ class IrisGrid extends Component {
1960
1950
  }
1961
1951
  }
1962
1952
  showAllColumns() {
1963
- var _this$grid9;
1953
+ var _this$grid8;
1964
1954
  var {
1965
1955
  metricCalculator
1966
1956
  } = this.state;
@@ -1972,7 +1962,7 @@ class IrisGrid extends Component {
1972
1962
  metricCalculator.resetColumnWidth(modelIndex);
1973
1963
  }
1974
1964
  }
1975
- (_this$grid9 = this.grid) === null || _this$grid9 === void 0 ? void 0 : _this$grid9.forceUpdate();
1965
+ (_this$grid8 = this.grid) === null || _this$grid8 === void 0 ? void 0 : _this$grid8.forceUpdate();
1976
1966
  }
1977
1967
 
1978
1968
  /**
@@ -1980,9 +1970,9 @@ class IrisGrid extends Component {
1980
1970
  * to keep Grid and IrisGrid metrics in sync since metrics are stored in both places.
1981
1971
  */
1982
1972
  updateMetrics() {
1983
- var _this$grid10;
1973
+ var _this$grid9;
1984
1974
  this.setState({
1985
- metrics: (_this$grid10 = this.grid) === null || _this$grid10 === void 0 ? void 0 : _this$grid10.updateMetrics()
1975
+ metrics: (_this$grid9 = this.grid) === null || _this$grid9 === void 0 ? void 0 : _this$grid9.updateMetrics()
1986
1976
  });
1987
1977
  }
1988
1978
  toggleSort(columnIndex, addToExisting) {
@@ -2003,15 +1993,15 @@ class IrisGrid extends Component {
2003
1993
  }
2004
1994
  }
2005
1995
  updateSorts(sorts) {
2006
- var _this$grid11;
1996
+ var _this$grid10;
2007
1997
  this.startLoading('Sorting...');
2008
1998
  this.setState({
2009
1999
  sorts
2010
2000
  });
2011
- (_this$grid11 = this.grid) === null || _this$grid11 === void 0 ? void 0 : _this$grid11.forceUpdate();
2001
+ (_this$grid10 = this.grid) === null || _this$grid10 === void 0 ? void 0 : _this$grid10.forceUpdate();
2012
2002
  }
2013
2003
  sortColumn(modelColumn) {
2014
- var _this$grid12;
2004
+ var _this$grid11;
2015
2005
  var direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : TableUtils.sortDirection.none;
2016
2006
  var isAbs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
2017
2007
  var addToExisting = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
@@ -2024,15 +2014,15 @@ class IrisGrid extends Component {
2024
2014
  this.setState({
2025
2015
  sorts
2026
2016
  });
2027
- (_this$grid12 = this.grid) === null || _this$grid12 === void 0 ? void 0 : _this$grid12.forceUpdate();
2017
+ (_this$grid11 = this.grid) === null || _this$grid11 === void 0 ? void 0 : _this$grid11.forceUpdate();
2028
2018
  }
2029
2019
  reverse(reverse) {
2030
- var _this$grid13;
2020
+ var _this$grid12;
2031
2021
  this.startLoading('Reversing...');
2032
2022
  this.setState({
2033
2023
  reverse
2034
2024
  });
2035
- (_this$grid13 = this.grid) === null || _this$grid13 === void 0 ? void 0 : _this$grid13.forceUpdate();
2025
+ (_this$grid12 = this.grid) === null || _this$grid12 === void 0 ? void 0 : _this$grid12.forceUpdate();
2036
2026
  }
2037
2027
  isReversible() {
2038
2028
  var {
@@ -2073,8 +2063,8 @@ class IrisGrid extends Component {
2073
2063
  this.focusFilterBar(columnIndex);
2074
2064
  }
2075
2065
  } else {
2076
- var _this$grid14;
2077
- (_this$grid14 = this.grid) === null || _this$grid14 === void 0 ? void 0 : _this$grid14.focus();
2066
+ var _this$grid13;
2067
+ (_this$grid13 = this.grid) === null || _this$grid13 === void 0 ? void 0 : _this$grid13.focus();
2078
2068
  }
2079
2069
  }
2080
2070
  isTableSearchAvailable() {
@@ -2111,13 +2101,13 @@ class IrisGrid extends Component {
2111
2101
  var _this$crossColumnRef2;
2112
2102
  (_this$crossColumnRef2 = this.crossColumnRef) === null || _this$crossColumnRef2 === void 0 ? void 0 : _this$crossColumnRef2.current.focus();
2113
2103
  } else {
2114
- var _this$grid15;
2115
- (_this$grid15 = this.grid) === null || _this$grid15 === void 0 ? void 0 : _this$grid15.focus();
2104
+ var _this$grid14;
2105
+ (_this$grid14 = this.grid) === null || _this$grid14 === void 0 ? void 0 : _this$grid14.focus();
2116
2106
  }
2117
2107
  });
2118
2108
  }
2119
2109
  toggleGotoRow() {
2120
- var _this$grid16, _this$grid17;
2110
+ var _this$grid15, _this$grid16;
2121
2111
  var row = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
2122
2112
  var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
2123
2113
  var columnName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
@@ -2139,8 +2129,8 @@ class IrisGrid extends Component {
2139
2129
  (_this$gotoRowRef$curr = this.gotoRowRef.current) === null || _this$gotoRowRef$curr === void 0 ? void 0 : _this$gotoRowRef$curr.focus();
2140
2130
  return;
2141
2131
  }
2142
- var cursorRow = (_this$grid16 = this.grid) === null || _this$grid16 === void 0 ? void 0 : _this$grid16.state.cursorRow;
2143
- var cursorColumn = (_this$grid17 = this.grid) === null || _this$grid17 === void 0 ? void 0 : _this$grid17.state.cursorColumn;
2132
+ var cursorRow = (_this$grid15 = this.grid) === null || _this$grid15 === void 0 ? void 0 : _this$grid15.state.cursorRow;
2133
+ var cursorColumn = (_this$grid16 = this.grid) === null || _this$grid16 === void 0 ? void 0 : _this$grid16.state.cursorColumn;
2144
2134
  if (cursorRow == null || cursorColumn == null) {
2145
2135
  // if a cell is not selected / grid is not rendered
2146
2136
  this.setState({
@@ -2307,7 +2297,7 @@ class IrisGrid extends Component {
2307
2297
  this.setAdvancedFilter(index, filter, options);
2308
2298
  }
2309
2299
  handleAdvancedFilterSortChange(column, direction) {
2310
- var _this$grid18;
2300
+ var _this$grid17;
2311
2301
  var addToExisting = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
2312
2302
  var {
2313
2303
  model
@@ -2330,11 +2320,11 @@ class IrisGrid extends Component {
2330
2320
  this.setState({
2331
2321
  sorts
2332
2322
  });
2333
- (_this$grid18 = this.grid) === null || _this$grid18 === void 0 ? void 0 : _this$grid18.forceUpdate();
2323
+ (_this$grid17 = this.grid) === null || _this$grid17 === void 0 ? void 0 : _this$grid17.forceUpdate();
2334
2324
  }
2335
2325
  handleAdvancedFilterDone() {
2336
- var _this$grid19;
2337
- (_this$grid19 = this.grid) === null || _this$grid19 === void 0 ? void 0 : _this$grid19.focus();
2326
+ var _this$grid18;
2327
+ (_this$grid18 = this.grid) === null || _this$grid18 === void 0 ? void 0 : _this$grid18.focus();
2338
2328
  }
2339
2329
  handleAdvancedMenuOpened(column) {
2340
2330
  this.setState({
@@ -2420,8 +2410,8 @@ class IrisGrid extends Component {
2420
2410
  var setGridFocus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
2421
2411
  var defocusInput = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
2422
2412
  if (setGridFocus) {
2423
- var _this$grid20;
2424
- (_this$grid20 = this.grid) === null || _this$grid20 === void 0 ? void 0 : _this$grid20.focus();
2413
+ var _this$grid19;
2414
+ (_this$grid19 = this.grid) === null || _this$grid19 === void 0 ? void 0 : _this$grid19.focus();
2425
2415
  }
2426
2416
  if (defocusInput) {
2427
2417
  this.setState({
@@ -2528,7 +2518,7 @@ class IrisGrid extends Component {
2528
2518
  }
2529
2519
  }
2530
2520
  handleUpdate() {
2531
- var _this$grid21;
2521
+ var _this$grid20;
2532
2522
  log.debug2('Received model update');
2533
2523
  var {
2534
2524
  advancedFilters,
@@ -2557,7 +2547,7 @@ class IrisGrid extends Component {
2557
2547
  } else {
2558
2548
  this.lastLoadedConfig = null;
2559
2549
  }
2560
- (_this$grid21 = this.grid) === null || _this$grid21 === void 0 ? void 0 : _this$grid21.forceUpdate();
2550
+ (_this$grid20 = this.grid) === null || _this$grid20 === void 0 ? void 0 : _this$grid20.forceUpdate();
2561
2551
  this.stopLoading();
2562
2552
  }
2563
2553
  handleTableChanged() {
@@ -2570,13 +2560,13 @@ class IrisGrid extends Component {
2570
2560
  });
2571
2561
  }
2572
2562
  handleViewChanged(metrics) {
2573
- var _this$grid$state, _this$grid22;
2563
+ var _this$grid$state, _this$grid21;
2574
2564
  var {
2575
2565
  model
2576
2566
  } = this.props;
2577
2567
  var {
2578
2568
  selectionEndRow = 0
2579
- } = (_this$grid$state = (_this$grid22 = this.grid) === null || _this$grid22 === void 0 ? void 0 : _this$grid22.state) !== null && _this$grid$state !== void 0 ? _this$grid$state : {};
2569
+ } = (_this$grid$state = (_this$grid21 = this.grid) === null || _this$grid21 === void 0 ? void 0 : _this$grid21.state) !== null && _this$grid$state !== void 0 ? _this$grid$state : {};
2580
2570
  var pendingRowCount = 0;
2581
2571
  if (isEditableGridModel(model) && model.isEditable) {
2582
2572
  assertNotNull(metrics);
@@ -2604,7 +2594,7 @@ class IrisGrid extends Component {
2604
2594
  });
2605
2595
  }
2606
2596
  handleSelectionChanged(selectedRanges) {
2607
- var _this$grid23;
2597
+ var _this$grid22;
2608
2598
  assertNotNull(selectedRanges);
2609
2599
  var {
2610
2600
  onSelectionChanged
@@ -2620,7 +2610,7 @@ class IrisGrid extends Component {
2620
2610
  copyOperation: null
2621
2611
  });
2622
2612
  }
2623
- if (((_this$grid23 = this.grid) === null || _this$grid23 === void 0 ? void 0 : _this$grid23.state.cursorRow) != null) {
2613
+ if (((_this$grid22 = this.grid) === null || _this$grid22 === void 0 ? void 0 : _this$grid22.state.cursorRow) != null) {
2624
2614
  this.setState({
2625
2615
  gotoRow: "".concat(this.grid.state.cursorRow + 1)
2626
2616
  });
@@ -2639,8 +2629,8 @@ class IrisGrid extends Component {
2639
2629
  this.setState({
2640
2630
  columnHeaderGroups: IrisGridUtils.parseColumnHeaderGroups(model, columnHeaderGroups).groups
2641
2631
  }, () => {
2642
- var _this$grid24;
2643
- return (_this$grid24 = this.grid) === null || _this$grid24 === void 0 ? void 0 : _this$grid24.forceUpdate();
2632
+ var _this$grid23;
2633
+ return (_this$grid23 = this.grid) === null || _this$grid23 === void 0 ? void 0 : _this$grid23.forceUpdate();
2644
2634
  });
2645
2635
  }
2646
2636
  handleTooltipRef(tooltip) {
@@ -2795,7 +2785,7 @@ class IrisGrid extends Component {
2795
2785
  return this.discardPending();
2796
2786
  }
2797
2787
  handlePendingDataUpdated() {
2798
- var _this$grid25;
2788
+ var _this$grid24;
2799
2789
  log.debug('pending data updated');
2800
2790
  var {
2801
2791
  model
@@ -2809,7 +2799,7 @@ class IrisGrid extends Component {
2809
2799
  pendingDataErrors,
2810
2800
  pendingSaveError: null
2811
2801
  });
2812
- (_this$grid25 = this.grid) === null || _this$grid25 === void 0 ? void 0 : _this$grid25.forceUpdate();
2802
+ (_this$grid24 = this.grid) === null || _this$grid24 === void 0 ? void 0 : _this$grid24.forceUpdate();
2813
2803
  }
2814
2804
 
2815
2805
  /**
@@ -3223,22 +3213,22 @@ class IrisGrid extends Component {
3223
3213
  gotoRowError: 'Invalid row index'
3224
3214
  });
3225
3215
  } else if (rowInt === 0) {
3226
- var _this$grid26;
3216
+ var _this$grid25;
3227
3217
  this.setState({
3228
3218
  gotoRowError: '',
3229
3219
  gotoValueError: ''
3230
3220
  });
3231
- (_this$grid26 = this.grid) === null || _this$grid26 === void 0 ? void 0 : _this$grid26.setFocusRow(0);
3221
+ (_this$grid25 = this.grid) === null || _this$grid25 === void 0 ? void 0 : _this$grid25.setFocusRow(0);
3232
3222
  } else if (rowInt < 0) {
3233
- var _this$grid27;
3223
+ var _this$grid26;
3234
3224
  this.setState({
3235
3225
  gotoRowError: '',
3236
3226
  gotoValueError: ''
3237
3227
  });
3238
- (_this$grid27 = this.grid) === null || _this$grid27 === void 0 ? void 0 : _this$grid27.setFocusRow(rowInt + rowCount);
3228
+ (_this$grid26 = this.grid) === null || _this$grid26 === void 0 ? void 0 : _this$grid26.setFocusRow(rowInt + rowCount);
3239
3229
  } else {
3240
- var _this$grid28;
3241
- (_this$grid28 = this.grid) === null || _this$grid28 === void 0 ? void 0 : _this$grid28.setFocusRow(rowInt - 1);
3230
+ var _this$grid27;
3231
+ (_this$grid27 = this.grid) === null || _this$grid27 === void 0 ? void 0 : _this$grid27.setFocusRow(rowInt - 1);
3242
3232
  this.setState({
3243
3233
  gotoRowError: '',
3244
3234
  gotoValueError: ''
@@ -3338,11 +3328,11 @@ class IrisGrid extends Component {
3338
3328
  });
3339
3329
  }
3340
3330
  handleGotoValueSelectedColumnNameChanged(columnName) {
3341
- var _this$grid29;
3331
+ var _this$grid28;
3342
3332
  var {
3343
3333
  model
3344
3334
  } = this.props;
3345
- var cursorRow = (_this$grid29 = this.grid) === null || _this$grid29 === void 0 ? void 0 : _this$grid29.state.cursorRow;
3335
+ var cursorRow = (_this$grid28 = this.grid) === null || _this$grid28 === void 0 ? void 0 : _this$grid28.state.cursorRow;
3346
3336
  var {
3347
3337
  gotoValueSelectedColumnName: prevColumnName,
3348
3338
  gotoValueManuallyChanged
@@ -3390,12 +3380,87 @@ class IrisGrid extends Component {
3390
3380
  } = this.state;
3391
3381
  this.seekRow(gotoValue, isBackwards);
3392
3382
  }
3383
+
3384
+ /**
3385
+ * Render the input field for the focused filter
3386
+ * @param metrics Grid metrics
3387
+ * @param metricCalculator Metric calculator
3388
+ * @param focusedFilterBarColumn Column index for the focused filter
3389
+ * @param quickFilters Quick filters map
3390
+ * @param advancedFilters Advanced filters map
3391
+ * @returns The filter input field element or null if not applicable
3392
+ */
3393
+ getFilterBarInput(metrics, metricCalculator, focusedFilterBarColumn, quickFilters, advancedFilters) {
3394
+ var _this$grid29;
3395
+ if (metrics == null || focusedFilterBarColumn == null) {
3396
+ return null;
3397
+ }
3398
+ var metricState = this.getMetricState();
3399
+ if (metricState == null) {
3400
+ return null;
3401
+ }
3402
+ var filterBoxCoordinates = metricCalculator.getFilterInputCoordinates(focusedFilterBarColumn, metricState, metrics);
3403
+ if (filterBoxCoordinates == null) {
3404
+ return null;
3405
+ }
3406
+ var debounceMs = Math.min(Math.max(IrisGrid.minDebounce, Math.round(metrics.rowCount / 200)), IrisGrid.maxDebounce);
3407
+ var {
3408
+ x,
3409
+ y,
3410
+ width: fieldWidth,
3411
+ height: fieldHeight
3412
+ } = filterBoxCoordinates;
3413
+ var {
3414
+ width
3415
+ } = metrics;
3416
+ var style = {
3417
+ top: y,
3418
+ left: x,
3419
+ minWidth: Math.min(fieldWidth, width - x),
3420
+ // Don't cause overflow
3421
+ height: fieldHeight
3422
+ };
3423
+ var value = '';
3424
+ var isValid = true;
3425
+ var modelColumn = this.getModelColumn(focusedFilterBarColumn);
3426
+ assertNotNull(modelColumn);
3427
+ var quickFilter = quickFilters.get(modelColumn);
3428
+ var advancedFilter = advancedFilters.get(modelColumn);
3429
+ if (quickFilter != null) {
3430
+ value = quickFilter.text;
3431
+ isValid = quickFilter.filter != null;
3432
+ }
3433
+ var isBarFiltered = quickFilters.size !== 0 || advancedFilters.size !== 0;
3434
+ var showAdvancedFilterButton = metricCalculator.getAdvancedFilterButtonCoordinates(focusedFilterBarColumn, metricState, metrics) != null;
3435
+ return /*#__PURE__*/_jsx(FilterInputField, {
3436
+ ref: this.filterInputRef,
3437
+ style: style,
3438
+ className: classNames({
3439
+ error: !isValid,
3440
+ active: value !== '' || advancedFilter != null,
3441
+ 'iris-grid-has-filter': isBarFiltered
3442
+ }),
3443
+ showAdvancedFilterButton: showAdvancedFilterButton,
3444
+ isAdvancedFilterSet: advancedFilter != null,
3445
+ onAdvancedFiltersTriggered: () => {
3446
+ this.setState({
3447
+ shownAdvancedFilter: focusedFilterBarColumn
3448
+ });
3449
+ },
3450
+ onChange: this.handleFilterBarChange,
3451
+ onDone: this.handleFilterBarDone,
3452
+ onTab: this.handleFilterBarTab,
3453
+ onContextMenu: (_this$grid29 = this.grid) === null || _this$grid29 === void 0 ? void 0 : _this$grid29.handleContextMenu,
3454
+ debounceMs: debounceMs,
3455
+ value: value
3456
+ }, focusedFilterBarColumn);
3457
+ }
3393
3458
  render() {
3394
3459
  var _rollupConfig$columns7,
3395
3460
  _rollupConfig$columns8,
3396
3461
  _this7 = this,
3397
- _this$grid31,
3398
- _this$grid31$state$dr,
3462
+ _this$grid30,
3463
+ _this$grid30$state$dr,
3399
3464
  _openOptions;
3400
3465
  var {
3401
3466
  children,
@@ -3499,65 +3564,7 @@ class IrisGrid extends Component {
3499
3564
  }
3500
3565
  var isVisible = metrics != null && metrics.width > 0 && metrics.height > 0;
3501
3566
  var isRollup = ((_rollupConfig$columns7 = rollupConfig === null || rollupConfig === void 0 ? void 0 : (_rollupConfig$columns8 = rollupConfig.columns) === null || _rollupConfig$columns8 === void 0 ? void 0 : _rollupConfig$columns8.length) !== null && _rollupConfig$columns7 !== void 0 ? _rollupConfig$columns7 : 0) > 0;
3502
- var focusField = null;
3503
- var debounceMs = metrics ? Math.min(Math.max(IrisGrid.minDebounce, Math.round(metrics.rowCount / 200)), IrisGrid.maxDebounce) : IrisGrid.maxDebounce;
3504
- if (isFilterBarShown && focusedFilterBarColumn != null && metrics != null) {
3505
- var {
3506
- gridX,
3507
- gridY,
3508
- allColumnXs,
3509
- allColumnWidths,
3510
- width
3511
- } = metrics;
3512
- var columnX = allColumnXs.get(focusedFilterBarColumn);
3513
- var columnWidth = allColumnWidths.get(focusedFilterBarColumn);
3514
- if (columnX != null && columnWidth != null) {
3515
- var _theme$filterBarHeigh, _theme$filterBarHeigh2, _this$grid30;
3516
- var x = gridX + columnX;
3517
- var y = gridY - ((_theme$filterBarHeigh = theme.filterBarHeight) !== null && _theme$filterBarHeigh !== void 0 ? _theme$filterBarHeigh : 0);
3518
- var fieldWidth = columnWidth + 1; // cover right border
3519
- var fieldHeight = ((_theme$filterBarHeigh2 = theme.filterBarHeight) !== null && _theme$filterBarHeigh2 !== void 0 ? _theme$filterBarHeigh2 : 0) - 1; // remove bottom border
3520
- var style = {
3521
- top: y,
3522
- left: x,
3523
- minWidth: Math.min(fieldWidth, width - x),
3524
- // Don't cause overflow
3525
- height: fieldHeight
3526
- };
3527
- var _value4 = '';
3528
- var isValid = true;
3529
- var modelColumn = this.getModelColumn(focusedFilterBarColumn);
3530
- assertNotNull(modelColumn);
3531
- var quickFilter = quickFilters.get(modelColumn);
3532
- var advancedFilter = advancedFilters.get(modelColumn);
3533
- if (quickFilter != null) {
3534
- _value4 = quickFilter.text;
3535
- isValid = quickFilter.filter != null;
3536
- }
3537
- var isBarFiltered = quickFilters.size !== 0 || advancedFilters.size !== 0;
3538
- focusField = /*#__PURE__*/_jsx(FilterInputField, {
3539
- ref: this.filterInputRef,
3540
- style: style,
3541
- className: classNames({
3542
- error: !isValid,
3543
- active: _value4 !== '' || advancedFilter != null,
3544
- 'iris-grid-has-filter': isBarFiltered
3545
- }),
3546
- isAdvancedFilterSet: advancedFilter != null,
3547
- onAdvancedFiltersTriggered: () => {
3548
- this.setState({
3549
- shownAdvancedFilter: focusedFilterBarColumn
3550
- });
3551
- },
3552
- onChange: this.handleFilterBarChange,
3553
- onDone: this.handleFilterBarDone,
3554
- onTab: this.handleFilterBarTab,
3555
- onContextMenu: (_this$grid30 = this.grid) === null || _this$grid30 === void 0 ? void 0 : _this$grid30.handleContextMenu,
3556
- debounceMs: debounceMs,
3557
- value: _value4
3558
- }, focusedFilterBarColumn);
3559
- }
3560
- }
3567
+ var focusField = isFilterBarShown ? this.getFilterBarInput(metrics, metricCalculator, focusedFilterBarColumn, quickFilters, advancedFilters) : null;
3561
3568
  var loadingElement = null;
3562
3569
  if (loadingText != null) {
3563
3570
  var loadingStatus = /*#__PURE__*/_jsxs("div", {
@@ -3579,11 +3586,11 @@ class IrisGrid extends Component {
3579
3586
  }), "Cancel"]
3580
3587
  })]
3581
3588
  });
3582
- var _gridY = metrics ? metrics.gridY : 0;
3589
+ var gridY = metrics ? metrics.gridY : 0;
3583
3590
  loadingElement = /*#__PURE__*/_jsx("div", {
3584
3591
  className: "iris-grid-loading",
3585
3592
  style: loadingBlocksGrid ? {
3586
- top: _gridY
3593
+ top: gridY
3587
3594
  } : {},
3588
3595
  children: loadingStatus
3589
3596
  });
@@ -3597,39 +3604,36 @@ class IrisGrid extends Component {
3597
3604
  }
3598
3605
  var filterBar = [];
3599
3606
  if (metrics && isFilterBarShown) {
3607
+ var metricState = this.getMetricState();
3608
+
3609
+ // Advanced Filter buttons
3600
3610
  var {
3601
- gridX: _gridX,
3602
- gridY: _gridY2,
3603
- visibleColumns,
3604
- allColumnXs: _allColumnXs,
3605
- allColumnWidths: _allColumnWidths
3611
+ visibleColumns
3606
3612
  } = metrics;
3607
- var {
3608
- filterBarHeight
3609
- } = theme;
3610
3613
  var _loop2 = function _loop2() {
3611
3614
  var columnIndex = visibleColumns[i];
3612
- var columnX = _allColumnXs.get(columnIndex);
3613
- var columnWidth = _allColumnWidths.get(columnIndex);
3614
3615
  var modelColumn = _this7.getModelColumn(columnIndex);
3615
3616
  if (modelColumn != null) {
3616
3617
  var isFilterable = model.isFilterable(modelColumn);
3617
- if (isFilterable && columnX != null && columnWidth != null && columnWidth > 0) {
3618
- var _x = _gridX + columnX + columnWidth - 24;
3619
- var _y = _gridY2 - (filterBarHeight !== null && filterBarHeight !== void 0 ? filterBarHeight : 0) + 2; // 2 acts as top margin for the button
3620
- var _style = {
3618
+ var buttonCoordinates = isFilterable && metricState ? metricCalculator.getAdvancedFilterButtonCoordinates(columnIndex, metricState, metrics) : null;
3619
+ if (buttonCoordinates != null) {
3620
+ var {
3621
+ x,
3622
+ y
3623
+ } = buttonCoordinates;
3624
+ var style = {
3621
3625
  position: 'absolute',
3622
- top: _y,
3623
- left: _x
3626
+ top: y,
3627
+ left: x
3624
3628
  };
3625
- var _advancedFilter = advancedFilters.get(modelColumn);
3626
- var isFilterSet = _advancedFilter != null;
3629
+ var advancedFilter = advancedFilters.get(modelColumn);
3630
+ var isFilterSet = advancedFilter != null;
3627
3631
  var isFilterVisible = columnIndex === hoverAdvancedFilter || columnIndex === focusedFilterBarColumn || isFilterSet;
3628
3632
  var element = /*#__PURE__*/_jsx("div", {
3629
3633
  className: classNames('advanced-filter-button-container', {
3630
3634
  hidden: !isFilterVisible
3631
3635
  }),
3632
- style: _style,
3636
+ style: style,
3633
3637
  children: isFilterVisible && /*#__PURE__*/_jsx(Button, {
3634
3638
  kind: "ghost",
3635
3639
  className: classNames('btn-link-icon advanced-filter-button', {
@@ -3677,20 +3681,20 @@ class IrisGrid extends Component {
3677
3681
  var advancedFilterMenus = [];
3678
3682
  if (metrics) {
3679
3683
  var {
3680
- gridX: _gridX2,
3684
+ gridX,
3681
3685
  visibleColumns: _visibleColumns,
3682
- allColumnXs: _allColumnXs2,
3683
- allColumnWidths: _allColumnWidths2,
3686
+ allColumnXs,
3687
+ allColumnWidths,
3684
3688
  columnHeaderHeight
3685
3689
  } = metrics;
3686
3690
  var _loop3 = function _loop3() {
3687
3691
  var columnIndex = _visibleColumns[_i3];
3688
- var columnX = _allColumnXs2.get(columnIndex);
3689
- var columnWidth = _allColumnWidths2.get(columnIndex);
3692
+ var columnX = allColumnXs.get(columnIndex);
3693
+ var columnWidth = allColumnWidths.get(columnIndex);
3690
3694
  if (columnX != null && columnWidth != null && columnWidth > 0) {
3691
- var xColumnHeader = _gridX2 + columnX;
3692
- var xFilterBar = _gridX2 + columnX + columnWidth - 20;
3693
- var _style2 = isFilterBarShown ? {
3695
+ var xColumnHeader = gridX + columnX;
3696
+ var xFilterBar = gridX + columnX + columnWidth - 20;
3697
+ var style = isFilterBarShown ? {
3694
3698
  position: 'absolute',
3695
3699
  top: columnHeaderHeight,
3696
3700
  left: xFilterBar,
@@ -3703,19 +3707,19 @@ class IrisGrid extends Component {
3703
3707
  width: columnWidth,
3704
3708
  height: columnHeaderHeight
3705
3709
  };
3706
- var _modelColumn = _this7.getModelColumn(columnIndex);
3707
- if (_modelColumn != null) {
3708
- var _column3 = model.columns[_modelColumn];
3710
+ var modelColumn = _this7.getModelColumn(columnIndex);
3711
+ if (modelColumn != null) {
3712
+ var _column3 = model.columns[modelColumn];
3709
3713
  if (_column3 == null) {
3710
3714
  // Grid metrics is likely out of sync with model
3711
- log.warn("Column does not exist at index ".concat(_modelColumn, " for column array of length ").concat(model.columns.length));
3715
+ log.warn("Column does not exist at index ".concat(modelColumn, " for column array of length ").concat(model.columns.length));
3712
3716
  // eslint-disable-next-line no-continue
3713
3717
  return "continue";
3714
3718
  }
3715
- var _advancedFilter2 = advancedFilters.get(_modelColumn);
3719
+ var advancedFilter = advancedFilters.get(modelColumn);
3716
3720
  var {
3717
3721
  options: advancedFilterOptions
3718
- } = _advancedFilter2 || {};
3722
+ } = advancedFilter || {};
3719
3723
  var sort = TableUtils.getSortForColumn(model.sort, _column3.name);
3720
3724
  var sortDirection = sort ? sort.direction : null;
3721
3725
  if (!isSortDirection(sortDirection)) {
@@ -3723,7 +3727,7 @@ class IrisGrid extends Component {
3723
3727
  }
3724
3728
  var element = /*#__PURE__*/_jsx("div", {
3725
3729
  className: "advanced-filter-menu-container",
3726
- style: _style2,
3730
+ style: style,
3727
3731
  children: /*#__PURE__*/_jsx(Popper, {
3728
3732
  className: "advanced-filter-menu-popper",
3729
3733
  onEntered: _this7.getAdvancedMenuOpenedHandler(columnIndex),
@@ -3929,7 +3933,7 @@ class IrisGrid extends Component {
3929
3933
  movedColumns: movedColumns,
3930
3934
  customColumns: customColumns,
3931
3935
  hiddenColumns: hiddenColumns,
3932
- alwaysFetchColumns: this.getAlwaysFetchColumns(alwaysFetchColumns, model.columns, movedColumns, model.floatingLeftColumnCount, model.floatingRightColumnCount, (_this$grid31 = this.grid) === null || _this$grid31 === void 0 ? void 0 : (_this$grid31$state$dr = _this$grid31.state.draggingColumn) === null || _this$grid31$state$dr === void 0 ? void 0 : _this$grid31$state$dr.range),
3936
+ alwaysFetchColumns: this.getAlwaysFetchColumns(alwaysFetchColumns, model.columns, movedColumns, model.floatingLeftColumnCount, model.floatingRightColumnCount, (_this$grid30 = this.grid) === null || _this$grid30 === void 0 ? void 0 : (_this$grid30$state$dr = _this$grid30.state.draggingColumn) === null || _this$grid30$state$dr === void 0 ? void 0 : _this$grid30$state$dr.range),
3933
3937
  formatColumns: this.getCachedPreviewFormatColumns(model.dh, model.columns, conditionalFormats, conditionalFormatPreview,
3934
3938
  // Disable the preview format when we press Back on the format edit page
3935
3939
  ((_openOptions = openOptions[openOptions.length - 1]) === null || _openOptions === void 0 ? void 0 : _openOptions.type) === OptionType.CONDITIONAL_FORMATTING_EDIT ? conditionalFormatEditIndex !== null && conditionalFormatEditIndex !== void 0 ? conditionalFormatEditIndex : undefined : undefined),