@deephaven/iris-grid 0.72.1-beta.0 → 0.72.1-beta.3

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
@@ -57,6 +57,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
57
57
  import { Fragment as _Fragment } from "react/jsx-runtime";
58
58
  import { jsxs as _jsxs } from "react/jsx-runtime";
59
59
  var log = Log.module('IrisGrid');
60
+ var VIEWPORT_LOADING_DELAY = 500;
60
61
  var UPDATE_DOWNLOAD_THROTTLE = 500;
61
62
  var SET_FILTER_DEBOUNCE = 250;
62
63
  var SEEK_ROW_DEBOUNCE = 250;
@@ -349,6 +350,25 @@ class IrisGrid extends Component {
349
350
  searchFilter
350
351
  });
351
352
  }, SET_FILTER_DEBOUNCE));
353
+ _defineProperty(this, "showViewportLoading", throttle(() => {
354
+ var {
355
+ model
356
+ } = this.props;
357
+ var {
358
+ loadingSpinnerShown
359
+ } = this.state;
360
+ if (model.isViewportPending && !loadingSpinnerShown) {
361
+ // We only want to show the viewport loading if the viewport is still loading
362
+ // and we're not already showing a loader for something else
363
+ this.startLoading('Waiting for viewport...', {
364
+ loadingCancelShown: false,
365
+ loadingBlocksGrid: false
366
+ });
367
+ }
368
+ }, VIEWPORT_LOADING_DELAY, {
369
+ leading: false,
370
+ trailing: true
371
+ }));
352
372
  _defineProperty(this, "handleConditionalFormatEditorUpdate", debounce(conditionalFormatPreview => {
353
373
  this.setState({
354
374
  conditionalFormatPreview
@@ -504,6 +524,7 @@ class IrisGrid extends Component {
504
524
  this.handleCustomColumnsChanged = this.handleCustomColumnsChanged.bind(this);
505
525
  this.handleSelectDistinctChanged = this.handleSelectDistinctChanged.bind(this);
506
526
  this.handlePendingDataUpdated = this.handlePendingDataUpdated.bind(this);
527
+ this.handleViewportUpdated = this.handleViewportUpdated.bind(this);
507
528
  this.handlePendingCommitClicked = this.handlePendingCommitClicked.bind(this);
508
529
  this.handlePendingDiscardClicked = this.handlePendingDiscardClicked.bind(this);
509
530
  this.handleGotoRowSelectedRowNumberSubmit = this.handleGotoRowSelectedRowNumberSubmit.bind(this);
@@ -525,6 +546,7 @@ class IrisGrid extends Component {
525
546
  this.handleGotoValueSelectedFilterChanged = this.handleGotoValueSelectedFilterChanged.bind(this);
526
547
  this.handleGotoValueChanged = this.handleGotoValueChanged.bind(this);
527
548
  this.handleGotoValueSubmitted = this.handleGotoValueSubmitted.bind(this);
549
+ this.handleViewportUpdated = this.handleViewportUpdated.bind(this);
528
550
  this.makeQuickFilter = this.makeQuickFilter.bind(this);
529
551
  this.grid = null;
530
552
  this.lastLoadedConfig = null;
@@ -655,6 +677,8 @@ class IrisGrid extends Component {
655
677
  loadingText: null,
656
678
  loadingScrimProgress: null,
657
679
  loadingSpinnerShown: false,
680
+ loadingCancelShown: false,
681
+ loadingBlocksGrid: false,
658
682
  movedColumns: _movedColumns,
659
683
  movedRows,
660
684
  shownColumnTooltip: null,
@@ -737,7 +761,9 @@ class IrisGrid extends Component {
737
761
  this.clearGridInputField();
738
762
  this.clearCrossColumSearch();
739
763
  }
740
- this.startLoading('Filtering...', true);
764
+ this.startLoading('Filtering...', {
765
+ resetRanges: true
766
+ });
741
767
  this.applyInputFilters(changedInputFilters, replaceExistingFilters);
742
768
  }
743
769
  if (isSelectingColumn !== prevProps.isSelectingColumn) {
@@ -747,7 +773,9 @@ class IrisGrid extends Component {
747
773
  this.updateFormatterSettings(settings);
748
774
  }
749
775
  if (customFilters !== prevProps.customFilters) {
750
- this.startLoading('Filtering...', true);
776
+ this.startLoading('Filtering...', {
777
+ resetRanges: true
778
+ });
751
779
  }
752
780
  if (sorts !== prevProps.sorts) {
753
781
  this.updateSorts(sorts);
@@ -802,6 +830,7 @@ class IrisGrid extends Component {
802
830
  if (this.animationFrame !== undefined) {
803
831
  cancelAnimationFrame(this.animationFrame);
804
832
  }
833
+ this.showViewportLoading.cancel();
805
834
  }
806
835
 
807
836
  // When the loading scrim started/when it should extend to the end of the screen.
@@ -997,7 +1026,9 @@ class IrisGrid extends Component {
997
1026
  }
998
1027
  setAdvancedFilter(modelIndex, filter, options) {
999
1028
  log.debug('Setting advanced filter', modelIndex, filter);
1000
- this.startLoading('Filtering...', true);
1029
+ this.startLoading('Filtering...', {
1030
+ resetRanges: true
1031
+ });
1001
1032
  this.setState(_ref7 => {
1002
1033
  var {
1003
1034
  advancedFilters
@@ -1025,7 +1056,9 @@ class IrisGrid extends Component {
1025
1056
  */
1026
1057
  setQuickFilter(modelIndex, filter, text) {
1027
1058
  log.debug('Setting quick filter', modelIndex, filter, text);
1028
- this.startLoading('Filtering...', true);
1059
+ this.startLoading('Filtering...', {
1060
+ resetRanges: true
1061
+ });
1029
1062
  this.setState(_ref8 => {
1030
1063
  var {
1031
1064
  quickFilters
@@ -1081,7 +1114,9 @@ class IrisGrid extends Component {
1081
1114
  });
1082
1115
  }
1083
1116
  removeColumnFilter(modelRange) {
1084
- this.startLoading('Filtering...', true);
1117
+ this.startLoading('Filtering...', {
1118
+ resetRanges: true
1119
+ });
1085
1120
  var clearRange = Array.isArray(modelRange) ? modelRange : [modelRange, modelRange];
1086
1121
  this.setState(_ref10 => {
1087
1122
  var {
@@ -1107,7 +1142,9 @@ class IrisGrid extends Component {
1107
1142
  });
1108
1143
  }
1109
1144
  removeQuickFilter(modelColumn) {
1110
- this.startLoading('Clearing Filter...', true);
1145
+ this.startLoading('Clearing Filter...', {
1146
+ resetRanges: true
1147
+ });
1111
1148
  this.setState(_ref11 => {
1112
1149
  var {
1113
1150
  quickFilters
@@ -1132,7 +1169,9 @@ class IrisGrid extends Component {
1132
1169
 
1133
1170
  // if there is an active quick filter input field, reset it as well
1134
1171
  this.clearGridInputField();
1135
- this.startLoading('Clearing Filters...', true);
1172
+ this.startLoading('Clearing Filters...', {
1173
+ resetRanges: true
1174
+ });
1136
1175
  this.setState({
1137
1176
  quickFilters: new Map(),
1138
1177
  advancedFilters: new Map(),
@@ -1192,7 +1231,9 @@ class IrisGrid extends Component {
1192
1231
  filter: this.makeQuickFilter(column, text, formatter.timeZone)
1193
1232
  });
1194
1233
  });
1195
- this.startLoading('Rebuilding filters...', true);
1234
+ this.startLoading('Rebuilding filters...', {
1235
+ resetRanges: true
1236
+ });
1196
1237
  this.setState({
1197
1238
  quickFilters: newQuickFilters,
1198
1239
  advancedFilters: newAdvancedFilters
@@ -1452,9 +1493,15 @@ class IrisGrid extends Component {
1452
1493
  }
1453
1494
  }
1454
1495
  startLoading(loadingText) {
1455
- var resetRanges = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1496
+ var {
1497
+ resetRanges = false,
1498
+ loadingCancelShown = true,
1499
+ loadingBlocksGrid = true
1500
+ } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1456
1501
  this.setState({
1457
- loadingText
1502
+ loadingText,
1503
+ loadingCancelShown,
1504
+ loadingBlocksGrid
1458
1505
  });
1459
1506
  var theme = this.getTheme();
1460
1507
  if (resetRanges && this.grid) {
@@ -1486,12 +1533,14 @@ class IrisGrid extends Component {
1486
1533
  }
1487
1534
  }
1488
1535
  stopLoading() {
1536
+ this.showViewportLoading.cancel();
1489
1537
  this.loadingScrimStartTime = undefined;
1490
1538
  this.loadingScrimFinishTime = undefined;
1491
1539
  this.setState({
1492
1540
  loadingText: null,
1493
1541
  loadingScrimProgress: null,
1494
- loadingSpinnerShown: false
1542
+ loadingSpinnerShown: false,
1543
+ loadingCancelShown: false
1495
1544
  });
1496
1545
  if (this.loadingTimer != null) {
1497
1546
  clearTimeout(this.loadingTimer);
@@ -1555,12 +1604,14 @@ class IrisGrid extends Component {
1555
1604
  model.addEventListener(IrisGridModel.EVENT.REQUEST_FAILED, this.handleRequestFailed);
1556
1605
  model.addEventListener(IrisGridModel.EVENT.COLUMNS_CHANGED, this.handleCustomColumnsChanged);
1557
1606
  model.addEventListener(IrisGridModel.EVENT.PENDING_DATA_UPDATED, this.handlePendingDataUpdated);
1607
+ model.addEventListener(IrisGridModel.EVENT.VIEWPORT_UPDATED, this.handleViewportUpdated);
1558
1608
  }
1559
1609
  stopListening(model) {
1560
1610
  model.removeEventListener(IrisGridModel.EVENT.UPDATED, this.handleUpdate);
1561
1611
  model.removeEventListener(IrisGridModel.EVENT.REQUEST_FAILED, this.handleRequestFailed);
1562
1612
  model.removeEventListener(IrisGridModel.EVENT.COLUMNS_CHANGED, this.handleCustomColumnsChanged);
1563
1613
  model.removeEventListener(IrisGridModel.EVENT.PENDING_DATA_UPDATED, this.handlePendingDataUpdated);
1614
+ model.removeEventListener(IrisGridModel.EVENT.VIEWPORT_UPDATED, this.handleViewportUpdated);
1564
1615
  }
1565
1616
  focus() {
1566
1617
  var _this$grid2;
@@ -1752,6 +1803,24 @@ class IrisGrid extends Component {
1752
1803
  } = this.props;
1753
1804
  onError(error);
1754
1805
  }
1806
+ handleViewportUpdated() {
1807
+ var {
1808
+ model
1809
+ } = this.props;
1810
+ var {
1811
+ loadingText,
1812
+ loadingSpinnerShown
1813
+ } = this.state;
1814
+ var loadingMessage = 'Waiting for viewport...';
1815
+
1816
+ // pending and no timer already exists
1817
+ if (model.isViewportPending && !loadingSpinnerShown) {
1818
+ this.showViewportLoading();
1819
+ } else if (loadingText === loadingMessage && !model.isViewportPending) {
1820
+ // extra conditions because timeout might get cleared by update
1821
+ this.stopLoading();
1822
+ }
1823
+ }
1755
1824
  showAllColumns() {
1756
1825
  var _this$grid9;
1757
1826
  var {
@@ -2179,7 +2248,9 @@ class IrisGrid extends Component {
2179
2248
  });
2180
2249
  }
2181
2250
  handleFilterBarChange(value) {
2182
- this.startLoading('Filtering...', true);
2251
+ this.startLoading('Filtering...', {
2252
+ resetRanges: true
2253
+ });
2183
2254
  this.setState(_ref13 => {
2184
2255
  var {
2185
2256
  focusedFilterBarColumn,
@@ -2286,14 +2357,18 @@ class IrisGrid extends Component {
2286
2357
  } = this.state;
2287
2358
  if (isMissingPartitionError(error) && partitionConfig != null) {
2288
2359
  // We'll try loading the initial partition again
2289
- this.startLoading('Reloading partition...', true);
2360
+ this.startLoading('Reloading partition...', {
2361
+ resetRanges: true
2362
+ });
2290
2363
  this.setState({
2291
2364
  partitionConfig: undefined
2292
2365
  }, () => {
2293
2366
  this.initState();
2294
2367
  });
2295
2368
  } else if (this.canRollback()) {
2296
- this.startLoading('Rolling back changes...', true);
2369
+ this.startLoading('Rolling back changes...', {
2370
+ resetRanges: true
2371
+ });
2297
2372
  this.rollback();
2298
2373
  } else {
2299
2374
  log.error('Table failed and unable to rollback');
@@ -3164,6 +3239,8 @@ class IrisGrid extends Component {
3164
3239
  loadingText,
3165
3240
  loadingScrimProgress,
3166
3241
  loadingSpinnerShown,
3242
+ loadingCancelShown,
3243
+ loadingBlocksGrid,
3167
3244
  shownColumnTooltip,
3168
3245
  hoverAdvancedFilter,
3169
3246
  shownAdvancedFilter,
@@ -3305,7 +3382,7 @@ class IrisGrid extends Component {
3305
3382
  type: "button",
3306
3383
  onClick: this.handleCancel,
3307
3384
  className: classNames('iris-grid-btn-cancel', {
3308
- show: loadingSpinnerShown
3385
+ show: loadingCancelShown
3309
3386
  }),
3310
3387
  children: [/*#__PURE__*/_jsx(FontAwesomeIcon, {
3311
3388
  icon: vsClose,
@@ -3316,9 +3393,9 @@ class IrisGrid extends Component {
3316
3393
  var _gridY = metrics ? metrics.gridY : 0;
3317
3394
  loadingElement = /*#__PURE__*/_jsx("div", {
3318
3395
  className: "iris-grid-loading",
3319
- style: {
3396
+ style: loadingBlocksGrid ? {
3320
3397
  top: _gridY
3321
- },
3398
+ } : {},
3322
3399
  children: loadingStatus
3323
3400
  });
3324
3401
  }