@deephaven/iris-grid 1.11.0 → 1.12.1

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
@@ -1779,7 +1779,7 @@ class IrisGrid extends Component {
1779
1779
  columnCount
1780
1780
  } = model;
1781
1781
  var modelColumn = GridUtils.getModelIndex(column, movedColumns);
1782
- if (column == null || column < 0 || columnCount <= column || !model.isFilterable(modelColumn)) {
1782
+ if (column == null || columnCount <= column || !model.isFilterable(modelColumn)) {
1783
1783
  this.setState({
1784
1784
  focusedFilterBarColumn: null
1785
1785
  });
@@ -1790,23 +1790,13 @@ class IrisGrid extends Component {
1790
1790
  metrics
1791
1791
  } = this.state;
1792
1792
  assertNotNull(metrics);
1793
- var {
1794
- left,
1795
- rightVisible,
1796
- lastLeft
1797
- } = metrics;
1798
- if (column < left) {
1793
+ var metricState = this.getMetricState();
1794
+ assertNotNull(metricState);
1795
+ var scrollColumn = metricCalculator.getScrollLeftForColumn(column, metricState, metrics);
1796
+ if (scrollColumn != null) {
1799
1797
  var _this$grid4;
1800
1798
  (_this$grid4 = this.grid) === null || _this$grid4 === void 0 || _this$grid4.setViewState({
1801
- left: column
1802
- }, true);
1803
- } else if (rightVisible < column) {
1804
- var _this$grid5;
1805
- var metricState = this.getMetricState();
1806
- assertNotNull(metricState);
1807
- var newLeft = metricCalculator.getLastLeft(metricState, column, metricCalculator.getVisibleWidth(metricState));
1808
- (_this$grid5 = this.grid) === null || _this$grid5 === void 0 || _this$grid5.setViewState({
1809
- left: Math.min(newLeft, lastLeft),
1799
+ left: scrollColumn,
1810
1800
  leftOffset: 0
1811
1801
  }, true);
1812
1802
  }
@@ -1817,13 +1807,13 @@ class IrisGrid extends Component {
1817
1807
  });
1818
1808
  }
1819
1809
  hideColumnByVisibleIndex(columnVisibleIndex) {
1820
- var _this$grid6;
1810
+ var _this$grid5;
1821
1811
  var {
1822
1812
  metricCalculator,
1823
1813
  movedColumns
1824
1814
  } = this.state;
1825
1815
  metricCalculator.setColumnWidth(GridUtils.getModelIndex(columnVisibleIndex, movedColumns), 0);
1826
- (_this$grid6 = this.grid) === null || _this$grid6 === void 0 || _this$grid6.forceUpdate();
1816
+ (_this$grid5 = this.grid) === null || _this$grid5 === void 0 || _this$grid5.forceUpdate();
1827
1817
  }
1828
1818
  freezeColumnByColumnName(columnName) {
1829
1819
  var {
@@ -1906,7 +1896,7 @@ class IrisGrid extends Component {
1906
1896
  }
1907
1897
  }
1908
1898
  handleColumnVisibilityChanged(modelIndexes, isVisible) {
1909
- var _this$grid7;
1899
+ var _this$grid6;
1910
1900
  var {
1911
1901
  metricCalculator,
1912
1902
  metrics
@@ -1931,7 +1921,7 @@ class IrisGrid extends Component {
1931
1921
  metricCalculator.setColumnWidth(modelIndex, 0);
1932
1922
  });
1933
1923
  }
1934
- (_this$grid7 = this.grid) === null || _this$grid7 === void 0 || _this$grid7.forceUpdate();
1924
+ (_this$grid6 = this.grid) === null || _this$grid6 === void 0 || _this$grid6.forceUpdate();
1935
1925
  }
1936
1926
  handleColumnVisibilityReset() {
1937
1927
  var _model$layoutHints$fr, _model$layoutHints2;
@@ -1961,8 +1951,8 @@ class IrisGrid extends Component {
1961
1951
  });
1962
1952
  }
1963
1953
  handleAnimationLoop() {
1964
- var _this$grid8;
1965
- (_this$grid8 = this.grid) === null || _this$grid8 === void 0 || _this$grid8.updateCanvas();
1954
+ var _this$grid7;
1955
+ (_this$grid7 = this.grid) === null || _this$grid7 === void 0 || _this$grid7.updateCanvas();
1966
1956
  if (this.isAnimating) {
1967
1957
  this.animationFrame = requestAnimationFrame(this.handleAnimationLoop);
1968
1958
  }
@@ -2016,7 +2006,7 @@ class IrisGrid extends Component {
2016
2006
  }
2017
2007
  }
2018
2008
  showAllColumns() {
2019
- var _this$grid9;
2009
+ var _this$grid8;
2020
2010
  var {
2021
2011
  metricCalculator
2022
2012
  } = this.state;
@@ -2028,7 +2018,7 @@ class IrisGrid extends Component {
2028
2018
  metricCalculator.resetColumnWidth(modelIndex);
2029
2019
  }
2030
2020
  }
2031
- (_this$grid9 = this.grid) === null || _this$grid9 === void 0 || _this$grid9.forceUpdate();
2021
+ (_this$grid8 = this.grid) === null || _this$grid8 === void 0 || _this$grid8.forceUpdate();
2032
2022
  }
2033
2023
 
2034
2024
  /**
@@ -2036,9 +2026,9 @@ class IrisGrid extends Component {
2036
2026
  * to keep Grid and IrisGrid metrics in sync since metrics are stored in both places.
2037
2027
  */
2038
2028
  updateMetrics() {
2039
- var _this$grid0;
2029
+ var _this$grid9;
2040
2030
  this.setState({
2041
- metrics: (_this$grid0 = this.grid) === null || _this$grid0 === void 0 ? void 0 : _this$grid0.updateMetrics()
2031
+ metrics: (_this$grid9 = this.grid) === null || _this$grid9 === void 0 ? void 0 : _this$grid9.updateMetrics()
2042
2032
  });
2043
2033
  }
2044
2034
  toggleSort(columnIndex, addToExisting) {
@@ -2059,15 +2049,15 @@ class IrisGrid extends Component {
2059
2049
  }
2060
2050
  }
2061
2051
  updateSorts(sorts) {
2062
- var _this$grid1;
2052
+ var _this$grid0;
2063
2053
  this.startLoading('Sorting...');
2064
2054
  this.setState({
2065
2055
  sorts
2066
2056
  });
2067
- (_this$grid1 = this.grid) === null || _this$grid1 === void 0 || _this$grid1.forceUpdate();
2057
+ (_this$grid0 = this.grid) === null || _this$grid0 === void 0 || _this$grid0.forceUpdate();
2068
2058
  }
2069
2059
  sortColumn(modelColumn) {
2070
- var _this$grid10;
2060
+ var _this$grid1;
2071
2061
  var direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : TableUtils.sortDirection.none;
2072
2062
  var isAbs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
2073
2063
  var addToExisting = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
@@ -2080,15 +2070,15 @@ class IrisGrid extends Component {
2080
2070
  this.setState({
2081
2071
  sorts
2082
2072
  });
2083
- (_this$grid10 = this.grid) === null || _this$grid10 === void 0 || _this$grid10.forceUpdate();
2073
+ (_this$grid1 = this.grid) === null || _this$grid1 === void 0 || _this$grid1.forceUpdate();
2084
2074
  }
2085
2075
  reverse(reverse) {
2086
- var _this$grid11;
2076
+ var _this$grid10;
2087
2077
  this.startLoading('Reversing...');
2088
2078
  this.setState({
2089
2079
  reverse
2090
2080
  });
2091
- (_this$grid11 = this.grid) === null || _this$grid11 === void 0 || _this$grid11.forceUpdate();
2081
+ (_this$grid10 = this.grid) === null || _this$grid10 === void 0 || _this$grid10.forceUpdate();
2092
2082
  }
2093
2083
  isReversible() {
2094
2084
  var {
@@ -2129,8 +2119,8 @@ class IrisGrid extends Component {
2129
2119
  this.focusFilterBar(columnIndex);
2130
2120
  }
2131
2121
  } else {
2132
- var _this$grid12;
2133
- (_this$grid12 = this.grid) === null || _this$grid12 === void 0 || _this$grid12.focus();
2122
+ var _this$grid11;
2123
+ (_this$grid11 = this.grid) === null || _this$grid11 === void 0 || _this$grid11.focus();
2134
2124
  }
2135
2125
  }
2136
2126
  isTableSearchAvailable() {
@@ -2167,13 +2157,13 @@ class IrisGrid extends Component {
2167
2157
  var _this$crossColumnRef2;
2168
2158
  (_this$crossColumnRef2 = this.crossColumnRef) === null || _this$crossColumnRef2 === void 0 || _this$crossColumnRef2.current.focus();
2169
2159
  } else {
2170
- var _this$grid13;
2171
- (_this$grid13 = this.grid) === null || _this$grid13 === void 0 || _this$grid13.focus();
2160
+ var _this$grid12;
2161
+ (_this$grid12 = this.grid) === null || _this$grid12 === void 0 || _this$grid12.focus();
2172
2162
  }
2173
2163
  });
2174
2164
  }
2175
2165
  toggleGotoRow() {
2176
- var _this$grid14, _this$grid15;
2166
+ var _this$grid13, _this$grid14;
2177
2167
  var row = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
2178
2168
  var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
2179
2169
  var columnName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
@@ -2195,8 +2185,8 @@ class IrisGrid extends Component {
2195
2185
  (_this$gotoRowRef$curr = this.gotoRowRef.current) === null || _this$gotoRowRef$curr === void 0 || _this$gotoRowRef$curr.focus();
2196
2186
  return;
2197
2187
  }
2198
- var cursorRow = (_this$grid14 = this.grid) === null || _this$grid14 === void 0 ? void 0 : _this$grid14.state.cursorRow;
2199
- var cursorColumn = (_this$grid15 = this.grid) === null || _this$grid15 === void 0 ? void 0 : _this$grid15.state.cursorColumn;
2188
+ var cursorRow = (_this$grid13 = this.grid) === null || _this$grid13 === void 0 ? void 0 : _this$grid13.state.cursorRow;
2189
+ var cursorColumn = (_this$grid14 = this.grid) === null || _this$grid14 === void 0 ? void 0 : _this$grid14.state.cursorColumn;
2200
2190
  if (cursorRow == null || cursorColumn == null) {
2201
2191
  // if a cell is not selected / grid is not rendered
2202
2192
  this.setState({
@@ -2363,7 +2353,7 @@ class IrisGrid extends Component {
2363
2353
  this.setAdvancedFilter(index, filter, options);
2364
2354
  }
2365
2355
  handleAdvancedFilterSortChange(column, direction) {
2366
- var _this$grid16;
2356
+ var _this$grid15;
2367
2357
  var addToExisting = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
2368
2358
  var {
2369
2359
  model
@@ -2386,11 +2376,11 @@ class IrisGrid extends Component {
2386
2376
  this.setState({
2387
2377
  sorts
2388
2378
  });
2389
- (_this$grid16 = this.grid) === null || _this$grid16 === void 0 || _this$grid16.forceUpdate();
2379
+ (_this$grid15 = this.grid) === null || _this$grid15 === void 0 || _this$grid15.forceUpdate();
2390
2380
  }
2391
2381
  handleAdvancedFilterDone() {
2392
- var _this$grid17;
2393
- (_this$grid17 = this.grid) === null || _this$grid17 === void 0 || _this$grid17.focus();
2382
+ var _this$grid16;
2383
+ (_this$grid16 = this.grid) === null || _this$grid16 === void 0 || _this$grid16.focus();
2394
2384
  }
2395
2385
  handleAdvancedMenuOpened(column) {
2396
2386
  this.setState({
@@ -2476,8 +2466,8 @@ class IrisGrid extends Component {
2476
2466
  var setGridFocus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
2477
2467
  var defocusInput = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
2478
2468
  if (setGridFocus) {
2479
- var _this$grid18;
2480
- (_this$grid18 = this.grid) === null || _this$grid18 === void 0 || _this$grid18.focus();
2469
+ var _this$grid17;
2470
+ (_this$grid17 = this.grid) === null || _this$grid17 === void 0 || _this$grid17.focus();
2481
2471
  }
2482
2472
  if (defocusInput) {
2483
2473
  this.setState({
@@ -2604,7 +2594,7 @@ class IrisGrid extends Component {
2604
2594
  }
2605
2595
  }
2606
2596
  handleUpdate() {
2607
- var _this$grid19;
2597
+ var _this$grid18;
2608
2598
  log.debug2('Received model update');
2609
2599
  var {
2610
2600
  advancedFilters,
@@ -2633,7 +2623,7 @@ class IrisGrid extends Component {
2633
2623
  } else {
2634
2624
  this.lastLoadedConfig = null;
2635
2625
  }
2636
- (_this$grid19 = this.grid) === null || _this$grid19 === void 0 || _this$grid19.forceUpdate();
2626
+ (_this$grid18 = this.grid) === null || _this$grid18 === void 0 || _this$grid18.forceUpdate();
2637
2627
  this.stopLoading();
2638
2628
  }
2639
2629
  handleTableChanged() {
@@ -2646,13 +2636,13 @@ class IrisGrid extends Component {
2646
2636
  });
2647
2637
  }
2648
2638
  handleViewChanged(metrics) {
2649
- var _this$grid$state, _this$grid20;
2639
+ var _this$grid$state, _this$grid19;
2650
2640
  var {
2651
2641
  model
2652
2642
  } = this.props;
2653
2643
  var {
2654
2644
  selectionEndRow = 0
2655
- } = (_this$grid$state = (_this$grid20 = this.grid) === null || _this$grid20 === void 0 ? void 0 : _this$grid20.state) !== null && _this$grid$state !== void 0 ? _this$grid$state : {};
2645
+ } = (_this$grid$state = (_this$grid19 = this.grid) === null || _this$grid19 === void 0 ? void 0 : _this$grid19.state) !== null && _this$grid$state !== void 0 ? _this$grid$state : {};
2656
2646
  var pendingRowCount = 0;
2657
2647
  if (isEditableGridModel(model) && model.isEditable) {
2658
2648
  assertNotNull(metrics);
@@ -2727,8 +2717,8 @@ class IrisGrid extends Component {
2727
2717
  // Parsing them again causes a loop with undo/redo that makes it unusable
2728
2718
  columnHeaderGroups: columnHeaderGroups.every(group => isColumnHeaderGroup(group) && group.isValid()) ? columnHeaderGroups : IrisGridUtils.parseColumnHeaderGroups(model, columnHeaderGroups).groups
2729
2719
  }, () => {
2730
- var _this$grid21;
2731
- return (_this$grid21 = this.grid) === null || _this$grid21 === void 0 ? void 0 : _this$grid21.forceUpdate();
2720
+ var _this$grid20;
2721
+ return (_this$grid20 = this.grid) === null || _this$grid20 === void 0 ? void 0 : _this$grid20.forceUpdate();
2732
2722
  });
2733
2723
  }
2734
2724
  handleTooltipRef(tooltip) {
@@ -2880,7 +2870,7 @@ class IrisGrid extends Component {
2880
2870
  return this.discardPending();
2881
2871
  }
2882
2872
  handlePendingDataUpdated() {
2883
- var _this$grid22;
2873
+ var _this$grid21;
2884
2874
  log.debug('pending data updated');
2885
2875
  var {
2886
2876
  model
@@ -2894,10 +2884,10 @@ class IrisGrid extends Component {
2894
2884
  pendingDataErrors,
2895
2885
  pendingSaveError: null
2896
2886
  });
2897
- (_this$grid22 = this.grid) === null || _this$grid22 === void 0 || _this$grid22.forceUpdate();
2887
+ (_this$grid21 = this.grid) === null || _this$grid21 === void 0 || _this$grid21.forceUpdate();
2898
2888
  }
2899
2889
  handleResizeColumn(modelIndex) {
2900
- var _this$grid23;
2890
+ var _this$grid22;
2901
2891
  var {
2902
2892
  metrics,
2903
2893
  metricCalculator
@@ -2911,10 +2901,10 @@ class IrisGrid extends Component {
2911
2901
  } else {
2912
2902
  metricCalculator.setColumnWidth(modelIndex, contentWidth);
2913
2903
  }
2914
- (_this$grid23 = this.grid) === null || _this$grid23 === void 0 || _this$grid23.forceUpdate();
2904
+ (_this$grid22 = this.grid) === null || _this$grid22 === void 0 || _this$grid22.forceUpdate();
2915
2905
  }
2916
2906
  handleResizeAllColumns() {
2917
- var _this$grid24;
2907
+ var _this$grid23;
2918
2908
  var {
2919
2909
  metrics,
2920
2910
  metricCalculator
@@ -2947,7 +2937,7 @@ class IrisGrid extends Component {
2947
2937
  metricCalculator.setColumnWidth(_modelIndex, _contentWidth);
2948
2938
  }
2949
2939
  }
2950
- (_this$grid24 = this.grid) === null || _this$grid24 === void 0 || _this$grid24.forceUpdate();
2940
+ (_this$grid23 = this.grid) === null || _this$grid23 === void 0 || _this$grid23.forceUpdate();
2951
2941
  }
2952
2942
 
2953
2943
  /**
@@ -3373,22 +3363,22 @@ class IrisGrid extends Component {
3373
3363
  gotoRowError: 'Invalid row index'
3374
3364
  });
3375
3365
  } else if (rowInt === 0) {
3376
- var _this$grid25;
3366
+ var _this$grid24;
3377
3367
  this.setState({
3378
3368
  gotoRowError: '',
3379
3369
  gotoValueError: ''
3380
3370
  });
3381
- (_this$grid25 = this.grid) === null || _this$grid25 === void 0 || _this$grid25.setFocusRow(0);
3371
+ (_this$grid24 = this.grid) === null || _this$grid24 === void 0 || _this$grid24.setFocusRow(0);
3382
3372
  } else if (rowInt < 0) {
3383
- var _this$grid26;
3373
+ var _this$grid25;
3384
3374
  this.setState({
3385
3375
  gotoRowError: '',
3386
3376
  gotoValueError: ''
3387
3377
  });
3388
- (_this$grid26 = this.grid) === null || _this$grid26 === void 0 || _this$grid26.setFocusRow(rowInt + rowCount);
3378
+ (_this$grid25 = this.grid) === null || _this$grid25 === void 0 || _this$grid25.setFocusRow(rowInt + rowCount);
3389
3379
  } else {
3390
- var _this$grid27;
3391
- (_this$grid27 = this.grid) === null || _this$grid27 === void 0 || _this$grid27.setFocusRow(rowInt - 1);
3380
+ var _this$grid26;
3381
+ (_this$grid26 = this.grid) === null || _this$grid26 === void 0 || _this$grid26.setFocusRow(rowInt - 1);
3392
3382
  this.setState({
3393
3383
  gotoRowError: '',
3394
3384
  gotoValueError: ''
@@ -3488,11 +3478,11 @@ class IrisGrid extends Component {
3488
3478
  });
3489
3479
  }
3490
3480
  handleGotoValueSelectedColumnNameChanged(columnName) {
3491
- var _this$grid28;
3481
+ var _this$grid27;
3492
3482
  var {
3493
3483
  model
3494
3484
  } = this.props;
3495
- var cursorRow = (_this$grid28 = this.grid) === null || _this$grid28 === void 0 ? void 0 : _this$grid28.state.cursorRow;
3485
+ var cursorRow = (_this$grid27 = this.grid) === null || _this$grid27 === void 0 ? void 0 : _this$grid27.state.cursorRow;
3496
3486
  var {
3497
3487
  gotoValueSelectedColumnName: prevColumnName,
3498
3488
  gotoValueManuallyChanged
@@ -3540,11 +3530,86 @@ class IrisGrid extends Component {
3540
3530
  } = this.state;
3541
3531
  this.seekRow(gotoValue, isBackwards);
3542
3532
  }
3533
+
3534
+ /**
3535
+ * Render the input field for the focused filter
3536
+ * @param metrics Grid metrics
3537
+ * @param metricCalculator Metric calculator
3538
+ * @param focusedFilterBarColumn Column index for the focused filter
3539
+ * @param quickFilters Quick filters map
3540
+ * @param advancedFilters Advanced filters map
3541
+ * @returns The filter input field element or null if not applicable
3542
+ */
3543
+ getFilterBarInput(metrics, metricCalculator, focusedFilterBarColumn, quickFilters, advancedFilters) {
3544
+ var _this$grid28;
3545
+ if (metrics == null || focusedFilterBarColumn == null) {
3546
+ return null;
3547
+ }
3548
+ var metricState = this.getMetricState();
3549
+ if (metricState == null) {
3550
+ return null;
3551
+ }
3552
+ var filterBoxCoordinates = metricCalculator.getFilterInputCoordinates(focusedFilterBarColumn, metricState, metrics);
3553
+ if (filterBoxCoordinates == null) {
3554
+ return null;
3555
+ }
3556
+ var debounceMs = Math.min(Math.max(IrisGrid.minDebounce, Math.round(metrics.rowCount / 200)), IrisGrid.maxDebounce);
3557
+ var {
3558
+ x,
3559
+ y,
3560
+ width: fieldWidth,
3561
+ height: fieldHeight
3562
+ } = filterBoxCoordinates;
3563
+ var {
3564
+ width
3565
+ } = metrics;
3566
+ var style = {
3567
+ top: y,
3568
+ left: x,
3569
+ minWidth: Math.min(fieldWidth, width - x),
3570
+ // Don't cause overflow
3571
+ height: fieldHeight
3572
+ };
3573
+ var value = '';
3574
+ var isValid = true;
3575
+ var modelColumn = this.getModelColumn(focusedFilterBarColumn);
3576
+ assertNotNull(modelColumn);
3577
+ var quickFilter = quickFilters.get(modelColumn);
3578
+ var advancedFilter = advancedFilters.get(modelColumn);
3579
+ if (quickFilter != null) {
3580
+ value = quickFilter.text;
3581
+ isValid = quickFilter.filter != null;
3582
+ }
3583
+ var isBarFiltered = quickFilters.size !== 0 || advancedFilters.size !== 0;
3584
+ var showAdvancedFilterButton = metricCalculator.getAdvancedFilterButtonCoordinates(focusedFilterBarColumn, metricState, metrics) != null;
3585
+ return /*#__PURE__*/_jsx(FilterInputField, {
3586
+ ref: this.filterInputRef,
3587
+ style: style,
3588
+ className: classNames({
3589
+ error: !isValid,
3590
+ active: value !== '' || advancedFilter != null,
3591
+ 'iris-grid-has-filter': isBarFiltered
3592
+ }),
3593
+ showAdvancedFilterButton: showAdvancedFilterButton,
3594
+ isAdvancedFilterSet: advancedFilter != null,
3595
+ onAdvancedFiltersTriggered: () => {
3596
+ this.setState({
3597
+ shownAdvancedFilter: focusedFilterBarColumn
3598
+ });
3599
+ },
3600
+ onChange: this.handleFilterBarChange,
3601
+ onDone: this.handleFilterBarDone,
3602
+ onTab: this.handleFilterBarTab,
3603
+ onContextMenu: (_this$grid28 = this.grid) === null || _this$grid28 === void 0 ? void 0 : _this$grid28.handleContextMenu,
3604
+ debounceMs: debounceMs,
3605
+ value: value
3606
+ }, focusedFilterBarColumn);
3607
+ }
3543
3608
  render() {
3544
3609
  var _rollupConfig$columns7,
3545
3610
  _rollupConfig$columns8,
3546
3611
  _this7 = this,
3547
- _this$grid30,
3612
+ _this$grid29,
3548
3613
  _openOptions;
3549
3614
  var {
3550
3615
  children,
@@ -3651,65 +3716,7 @@ class IrisGrid extends Component {
3651
3716
  }
3652
3717
  var isVisible = metrics != null && metrics.width > 0 && metrics.height > 0;
3653
3718
  var isRollup = ((_rollupConfig$columns7 = rollupConfig === null || rollupConfig === 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;
3654
- var focusField = null;
3655
- var debounceMs = metrics ? Math.min(Math.max(IrisGrid.minDebounce, Math.round(metrics.rowCount / 200)), IrisGrid.maxDebounce) : IrisGrid.maxDebounce;
3656
- if (isFilterBarShown && focusedFilterBarColumn != null && metrics != null) {
3657
- var {
3658
- gridX,
3659
- gridY,
3660
- allColumnXs,
3661
- allColumnWidths,
3662
- width
3663
- } = metrics;
3664
- var columnX = allColumnXs.get(focusedFilterBarColumn);
3665
- var columnWidth = allColumnWidths.get(focusedFilterBarColumn);
3666
- if (columnX != null && columnWidth != null) {
3667
- var _theme$filterBarHeigh, _theme$filterBarHeigh2, _this$grid29;
3668
- var x = gridX + columnX;
3669
- var y = gridY - ((_theme$filterBarHeigh = theme.filterBarHeight) !== null && _theme$filterBarHeigh !== void 0 ? _theme$filterBarHeigh : 0);
3670
- var fieldWidth = columnWidth + 1; // cover right border
3671
- var fieldHeight = ((_theme$filterBarHeigh2 = theme.filterBarHeight) !== null && _theme$filterBarHeigh2 !== void 0 ? _theme$filterBarHeigh2 : 0) - 1; // remove bottom border
3672
- var style = {
3673
- top: y,
3674
- left: x,
3675
- minWidth: Math.min(fieldWidth, width - x),
3676
- // Don't cause overflow
3677
- height: fieldHeight
3678
- };
3679
- var value = '';
3680
- var isValid = true;
3681
- var modelColumn = this.getModelColumn(focusedFilterBarColumn);
3682
- assertNotNull(modelColumn);
3683
- var quickFilter = quickFilters.get(modelColumn);
3684
- var advancedFilter = advancedFilters.get(modelColumn);
3685
- if (quickFilter != null) {
3686
- value = quickFilter.text;
3687
- isValid = quickFilter.filter != null;
3688
- }
3689
- var isBarFiltered = quickFilters.size !== 0 || advancedFilters.size !== 0;
3690
- focusField = /*#__PURE__*/_jsx(FilterInputField, {
3691
- ref: this.filterInputRef,
3692
- style: style,
3693
- className: classNames({
3694
- error: !isValid,
3695
- active: value !== '' || advancedFilter != null,
3696
- 'iris-grid-has-filter': isBarFiltered
3697
- }),
3698
- isAdvancedFilterSet: advancedFilter != null,
3699
- onAdvancedFiltersTriggered: () => {
3700
- this.setState({
3701
- shownAdvancedFilter: focusedFilterBarColumn
3702
- });
3703
- },
3704
- onChange: this.handleFilterBarChange,
3705
- onDone: this.handleFilterBarDone,
3706
- onTab: this.handleFilterBarTab,
3707
- onContextMenu: (_this$grid29 = this.grid) === null || _this$grid29 === void 0 ? void 0 : _this$grid29.handleContextMenu,
3708
- debounceMs: debounceMs,
3709
- value: value
3710
- }, focusedFilterBarColumn);
3711
- }
3712
- }
3719
+ var focusField = isFilterBarShown ? this.getFilterBarInput(metrics, metricCalculator, focusedFilterBarColumn, quickFilters, advancedFilters) : null;
3713
3720
  var loadingElement = null;
3714
3721
  if (loadingText != null) {
3715
3722
  var loadingStatus = /*#__PURE__*/_jsxs("div", {
@@ -3731,11 +3738,11 @@ class IrisGrid extends Component {
3731
3738
  }), "Cancel"]
3732
3739
  })]
3733
3740
  });
3734
- var _gridY = metrics ? metrics.gridY : 0;
3741
+ var gridY = metrics ? metrics.gridY : 0;
3735
3742
  loadingElement = /*#__PURE__*/_jsx("div", {
3736
3743
  className: "iris-grid-loading",
3737
3744
  style: loadingBlocksGrid ? {
3738
- top: _gridY
3745
+ top: gridY
3739
3746
  } : {},
3740
3747
  children: loadingStatus
3741
3748
  });
@@ -3749,39 +3756,36 @@ class IrisGrid extends Component {
3749
3756
  }
3750
3757
  var filterBar = [];
3751
3758
  if (metrics && isFilterBarShown) {
3759
+ var metricState = this.getMetricState();
3760
+
3761
+ // Advanced Filter buttons
3752
3762
  var {
3753
- gridX: _gridX,
3754
- gridY: _gridY2,
3755
- visibleColumns,
3756
- allColumnXs: _allColumnXs,
3757
- allColumnWidths: _allColumnWidths
3763
+ visibleColumns
3758
3764
  } = metrics;
3759
- var {
3760
- filterBarHeight
3761
- } = theme;
3762
3765
  var _loop2 = function _loop2() {
3763
3766
  var columnIndex = visibleColumns[i];
3764
- var columnX = _allColumnXs.get(columnIndex);
3765
- var columnWidth = _allColumnWidths.get(columnIndex);
3766
3767
  var modelColumn = _this7.getModelColumn(columnIndex);
3767
3768
  if (modelColumn != null) {
3768
3769
  var isFilterable = model.isFilterable(modelColumn);
3769
- if (isFilterable && columnX != null && columnWidth != null && columnWidth > 0) {
3770
- var _x = _gridX + columnX + columnWidth - 24;
3771
- var _y = _gridY2 - (filterBarHeight !== null && filterBarHeight !== void 0 ? filterBarHeight : 0) + 2; // 2 acts as top margin for the button
3772
- var _style = {
3770
+ var buttonCoordinates = isFilterable && metricState ? metricCalculator.getAdvancedFilterButtonCoordinates(columnIndex, metricState, metrics) : null;
3771
+ if (buttonCoordinates != null) {
3772
+ var {
3773
+ x,
3774
+ y
3775
+ } = buttonCoordinates;
3776
+ var style = {
3773
3777
  position: 'absolute',
3774
- top: _y,
3775
- left: _x
3778
+ top: y,
3779
+ left: x
3776
3780
  };
3777
- var _advancedFilter = advancedFilters.get(modelColumn);
3778
- var isFilterSet = _advancedFilter != null;
3781
+ var advancedFilter = advancedFilters.get(modelColumn);
3782
+ var isFilterSet = advancedFilter != null;
3779
3783
  var isFilterVisible = columnIndex === hoverAdvancedFilter || columnIndex === focusedFilterBarColumn || isFilterSet;
3780
3784
  var element = /*#__PURE__*/_jsx("div", {
3781
3785
  className: classNames('advanced-filter-button-container', {
3782
3786
  hidden: !isFilterVisible
3783
3787
  }),
3784
- style: _style,
3788
+ style: style,
3785
3789
  children: isFilterVisible && /*#__PURE__*/_jsx(Button, {
3786
3790
  kind: "ghost",
3787
3791
  className: classNames('btn-link-icon advanced-filter-button', {
@@ -3829,20 +3833,20 @@ class IrisGrid extends Component {
3829
3833
  var advancedFilterMenus = [];
3830
3834
  if (metrics) {
3831
3835
  var {
3832
- gridX: _gridX2,
3836
+ gridX,
3833
3837
  visibleColumns: _visibleColumns,
3834
- allColumnXs: _allColumnXs2,
3835
- allColumnWidths: _allColumnWidths2,
3838
+ allColumnXs,
3839
+ allColumnWidths,
3836
3840
  columnHeaderHeight
3837
3841
  } = metrics;
3838
3842
  var _loop3 = function _loop3() {
3839
3843
  var columnIndex = _visibleColumns[_i4];
3840
- var columnX = _allColumnXs2.get(columnIndex);
3841
- var columnWidth = _allColumnWidths2.get(columnIndex);
3844
+ var columnX = allColumnXs.get(columnIndex);
3845
+ var columnWidth = allColumnWidths.get(columnIndex);
3842
3846
  if (columnX != null && columnWidth != null && columnWidth > 0) {
3843
- var xColumnHeader = _gridX2 + columnX;
3844
- var xFilterBar = _gridX2 + columnX + columnWidth - 20;
3845
- var _style2 = isFilterBarShown ? {
3847
+ var xColumnHeader = gridX + columnX;
3848
+ var xFilterBar = gridX + columnX + columnWidth - 20;
3849
+ var style = isFilterBarShown ? {
3846
3850
  position: 'absolute',
3847
3851
  top: columnHeaderHeight,
3848
3852
  left: xFilterBar,
@@ -3855,19 +3859,19 @@ class IrisGrid extends Component {
3855
3859
  width: columnWidth,
3856
3860
  height: columnHeaderHeight
3857
3861
  };
3858
- var _modelColumn = _this7.getModelColumn(columnIndex);
3859
- if (_modelColumn != null) {
3860
- var column = model.columns[_modelColumn];
3862
+ var modelColumn = _this7.getModelColumn(columnIndex);
3863
+ if (modelColumn != null) {
3864
+ var column = model.columns[modelColumn];
3861
3865
  if (column == null) {
3862
3866
  // Grid metrics is likely out of sync with model
3863
- log.warn("Column does not exist at index ".concat(_modelColumn, " for column array of length ").concat(model.columns.length));
3867
+ log.warn("Column does not exist at index ".concat(modelColumn, " for column array of length ").concat(model.columns.length));
3864
3868
  // eslint-disable-next-line no-continue
3865
3869
  return 1; // continue
3866
3870
  }
3867
- var _advancedFilter2 = advancedFilters.get(_modelColumn);
3871
+ var advancedFilter = advancedFilters.get(modelColumn);
3868
3872
  var {
3869
3873
  options: advancedFilterOptions
3870
- } = _advancedFilter2 || {};
3874
+ } = advancedFilter || {};
3871
3875
  var sort = TableUtils.getSortForColumn(model.sort, column.name);
3872
3876
  var sortDirection = sort ? sort.direction : null;
3873
3877
  if (!isSortDirection(sortDirection)) {
@@ -3875,7 +3879,7 @@ class IrisGrid extends Component {
3875
3879
  }
3876
3880
  var element = /*#__PURE__*/_jsx("div", {
3877
3881
  className: "advanced-filter-menu-container",
3878
- style: _style2,
3882
+ style: style,
3879
3883
  children: /*#__PURE__*/_jsx(Popper, {
3880
3884
  className: "advanced-filter-menu-popper",
3881
3885
  onEntered: _this7.getAdvancedMenuOpenedHandler(columnIndex),
@@ -4086,7 +4090,7 @@ class IrisGrid extends Component {
4086
4090
  movedColumns: movedColumns,
4087
4091
  customColumns: customColumns,
4088
4092
  hiddenColumns: hiddenColumns,
4089
- alwaysFetchColumns: this.getAlwaysFetchColumns(alwaysFetchColumns, model.columns, movedColumns, model.floatingLeftColumnCount, model.floatingRightColumnCount, (_this$grid30 = this.grid) === null || _this$grid30 === void 0 || (_this$grid30 = _this$grid30.state.draggingColumn) === null || _this$grid30 === void 0 ? void 0 : _this$grid30.range),
4093
+ alwaysFetchColumns: this.getAlwaysFetchColumns(alwaysFetchColumns, model.columns, movedColumns, model.floatingLeftColumnCount, model.floatingRightColumnCount, (_this$grid29 = this.grid) === null || _this$grid29 === void 0 || (_this$grid29 = _this$grid29.state.draggingColumn) === null || _this$grid29 === void 0 ? void 0 : _this$grid29.range),
4090
4094
  formatColumns: this.getCachedPreviewFormatColumns(model.dh, model.columns, conditionalFormats, conditionalFormatPreview,
4091
4095
  // Disable the preview format when we press Back on the format edit page
4092
4096
  ((_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),