@deephaven/iris-grid 0.42.1-beta.4 → 0.43.0
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/package.json +15 -15
- package/dist/AdvancedFilterCreator.css +0 -106
- package/dist/AdvancedFilterCreator.css.map +0 -1
- package/dist/AdvancedFilterCreator.js +0 -541
- package/dist/AdvancedFilterCreator.js.map +0 -1
- package/dist/AdvancedFilterCreatorFilterItem.css +0 -9
- package/dist/AdvancedFilterCreatorFilterItem.css.map +0 -1
- package/dist/AdvancedFilterCreatorFilterItem.js +0 -184
- package/dist/AdvancedFilterCreatorFilterItem.js.map +0 -1
- package/dist/AdvancedFilterCreatorSelectValue.css +0 -50
- package/dist/AdvancedFilterCreatorSelectValue.css.map +0 -1
- package/dist/AdvancedFilterCreatorSelectValue.js +0 -301
- package/dist/AdvancedFilterCreatorSelectValue.js.map +0 -1
- package/dist/AdvancedFilterCreatorSelectValueList.js +0 -272
- package/dist/AdvancedFilterCreatorSelectValueList.js.map +0 -1
- package/dist/ColumnHeaderGroup.js +0 -61
- package/dist/ColumnHeaderGroup.js.map +0 -1
- package/dist/ColumnStatistics.css +0 -76
- package/dist/ColumnStatistics.css.map +0 -1
- package/dist/ColumnStatistics.js +0 -202
- package/dist/ColumnStatistics.js.map +0 -1
- package/dist/CommonTypes.js +0 -2
- package/dist/CommonTypes.js.map +0 -1
- package/dist/CrossColumnSearch.css +0 -35
- package/dist/CrossColumnSearch.css.map +0 -1
- package/dist/CrossColumnSearch.js +0 -199
- package/dist/CrossColumnSearch.js.map +0 -1
- package/dist/FilterInputField.css +0 -56
- package/dist/FilterInputField.css.map +0 -1
- package/dist/FilterInputField.js +0 -232
- package/dist/FilterInputField.js.map +0 -1
- package/dist/GotoRow.css +0 -45
- package/dist/GotoRow.css.map +0 -1
- package/dist/GotoRow.js +0 -298
- package/dist/GotoRow.js.map +0 -1
- package/dist/IrisGrid.css +0 -359
- package/dist/IrisGrid.css.map +0 -1
- package/dist/IrisGrid.js +0 -3651
- package/dist/IrisGrid.js.map +0 -1
- package/dist/IrisGridBottomBar.css +0 -85
- package/dist/IrisGridBottomBar.css.map +0 -1
- package/dist/IrisGridBottomBar.js +0 -36
- package/dist/IrisGridBottomBar.js.map +0 -1
- package/dist/IrisGridCellOverflowModal.css +0 -17
- package/dist/IrisGridCellOverflowModal.css.map +0 -1
- package/dist/IrisGridCellOverflowModal.js +0 -157
- package/dist/IrisGridCellOverflowModal.js.map +0 -1
- package/dist/IrisGridCellRendererUtils.js +0 -20
- package/dist/IrisGridCellRendererUtils.js.map +0 -1
- package/dist/IrisGridCopyHandler.css +0 -64
- package/dist/IrisGridCopyHandler.css.map +0 -1
- package/dist/IrisGridCopyHandler.js +0 -331
- package/dist/IrisGridCopyHandler.js.map +0 -1
- package/dist/IrisGridDataBarCellRenderer.js +0 -10
- package/dist/IrisGridDataBarCellRenderer.js.map +0 -1
- package/dist/IrisGridIcons.js +0 -25
- package/dist/IrisGridIcons.js.map +0 -1
- package/dist/IrisGridMetricCalculator.js +0 -33
- package/dist/IrisGridMetricCalculator.js.map +0 -1
- package/dist/IrisGridModel.js +0 -263
- package/dist/IrisGridModel.js.map +0 -1
- package/dist/IrisGridModelFactory.js +0 -27
- package/dist/IrisGridModelFactory.js.map +0 -1
- package/dist/IrisGridModelUpdater.js +0 -96
- package/dist/IrisGridModelUpdater.js.map +0 -1
- package/dist/IrisGridPartitionSelector.css +0 -48
- package/dist/IrisGridPartitionSelector.css.map +0 -1
- package/dist/IrisGridPartitionSelector.js +0 -198
- package/dist/IrisGridPartitionSelector.js.map +0 -1
- package/dist/IrisGridProxyModel.js +0 -530
- package/dist/IrisGridProxyModel.js.map +0 -1
- package/dist/IrisGridRenderer.js +0 -779
- package/dist/IrisGridRenderer.js.map +0 -1
- package/dist/IrisGridShortcuts.js +0 -59
- package/dist/IrisGridShortcuts.js.map +0 -1
- package/dist/IrisGridTableModel.js +0 -273
- package/dist/IrisGridTableModel.js.map +0 -1
- package/dist/IrisGridTableModelTemplate.js +0 -1589
- package/dist/IrisGridTableModelTemplate.js.map +0 -1
- package/dist/IrisGridTestUtils.js +0 -121
- package/dist/IrisGridTestUtils.js.map +0 -1
- package/dist/IrisGridTextCellRenderer.js +0 -139
- package/dist/IrisGridTextCellRenderer.js.map +0 -1
- package/dist/IrisGridTheme.js +0 -96
- package/dist/IrisGridTheme.js.map +0 -1
- package/dist/IrisGridTheme.module.css +0 -69
- package/dist/IrisGridTheme.module.css.map +0 -1
- package/dist/IrisGridTreeTableModel.js +0 -145
- package/dist/IrisGridTreeTableModel.js.map +0 -1
- package/dist/IrisGridUtils.js +0 -1279
- package/dist/IrisGridUtils.js.map +0 -1
- package/dist/MissingKeyError.js +0 -15
- package/dist/MissingKeyError.js.map +0 -1
- package/dist/PartitionSelectorSearch.css +0 -22
- package/dist/PartitionSelectorSearch.css.map +0 -1
- package/dist/PartitionSelectorSearch.js +0 -317
- package/dist/PartitionSelectorSearch.js.map +0 -1
- package/dist/PendingDataBottomBar.css +0 -13
- package/dist/PendingDataBottomBar.css.map +0 -1
- package/dist/PendingDataBottomBar.js +0 -98
- package/dist/PendingDataBottomBar.js.map +0 -1
- package/dist/TableViewportUpdater.js +0 -156
- package/dist/TableViewportUpdater.js.map +0 -1
- package/dist/ToastBottomBar.js +0 -42
- package/dist/ToastBottomBar.js.map +0 -1
- package/dist/TreeTableViewportUpdater.js +0 -96
- package/dist/TreeTableViewportUpdater.js.map +0 -1
- package/dist/declaration.d.js +0 -2
- package/dist/declaration.d.js.map +0 -1
- package/dist/format-context-menus/CustomFormatAction.css +0 -25
- package/dist/format-context-menus/CustomFormatAction.css.map +0 -1
- package/dist/format-context-menus/CustomFormatAction.js +0 -132
- package/dist/format-context-menus/CustomFormatAction.js.map +0 -1
- package/dist/format-context-menus/DateTimeFormatContextMenu.js +0 -53
- package/dist/format-context-menus/DateTimeFormatContextMenu.js.map +0 -1
- package/dist/format-context-menus/DecimalFormatContextMenu.js +0 -59
- package/dist/format-context-menus/DecimalFormatContextMenu.js.map +0 -1
- package/dist/format-context-menus/FormatContextMenuUtils.js +0 -63
- package/dist/format-context-menus/FormatContextMenuUtils.js.map +0 -1
- package/dist/format-context-menus/IntegerFormatContextMenu.js +0 -43
- package/dist/format-context-menus/IntegerFormatContextMenu.js.map +0 -1
- package/dist/format-context-menus/index.js +0 -4
- package/dist/format-context-menus/index.js.map +0 -1
- package/dist/index.js +0 -24
- package/dist/index.js.map +0 -1
- package/dist/key-handlers/ClearFilterKeyHandler.js +0 -21
- package/dist/key-handlers/ClearFilterKeyHandler.js.map +0 -1
- package/dist/key-handlers/CopyKeyHandler.js +0 -31
- package/dist/key-handlers/CopyKeyHandler.js.map +0 -1
- package/dist/key-handlers/ReverseKeyHandler.js +0 -32
- package/dist/key-handlers/ReverseKeyHandler.js.map +0 -1
- package/dist/key-handlers/index.js +0 -4
- package/dist/key-handlers/index.js.map +0 -1
- package/dist/mousehandlers/IrisGridCellOverflowMouseHandler.js +0 -175
- package/dist/mousehandlers/IrisGridCellOverflowMouseHandler.js.map +0 -1
- package/dist/mousehandlers/IrisGridColumnSelectMouseHandler.js +0 -139
- package/dist/mousehandlers/IrisGridColumnSelectMouseHandler.js.map +0 -1
- package/dist/mousehandlers/IrisGridColumnTooltipMouseHandler.js +0 -83
- package/dist/mousehandlers/IrisGridColumnTooltipMouseHandler.js.map +0 -1
- package/dist/mousehandlers/IrisGridContextMenuHandler.css +0 -19
- package/dist/mousehandlers/IrisGridContextMenuHandler.css.map +0 -1
- package/dist/mousehandlers/IrisGridContextMenuHandler.js +0 -1220
- package/dist/mousehandlers/IrisGridContextMenuHandler.js.map +0 -1
- package/dist/mousehandlers/IrisGridDataSelectMouseHandler.js +0 -28
- package/dist/mousehandlers/IrisGridDataSelectMouseHandler.js.map +0 -1
- package/dist/mousehandlers/IrisGridFilterMouseHandler.js +0 -80
- package/dist/mousehandlers/IrisGridFilterMouseHandler.js.map +0 -1
- package/dist/mousehandlers/IrisGridRowTreeMouseHandler.js +0 -126
- package/dist/mousehandlers/IrisGridRowTreeMouseHandler.js.map +0 -1
- package/dist/mousehandlers/IrisGridSortMouseHandler.js +0 -46
- package/dist/mousehandlers/IrisGridSortMouseHandler.js.map +0 -1
- package/dist/mousehandlers/IrisGridTokenMouseHandler.js +0 -151
- package/dist/mousehandlers/IrisGridTokenMouseHandler.js.map +0 -1
- package/dist/mousehandlers/PendingMouseHandler.js +0 -39
- package/dist/mousehandlers/PendingMouseHandler.js.map +0 -1
- package/dist/mousehandlers/index.js +0 -11
- package/dist/mousehandlers/index.js.map +0 -1
- package/dist/sidebar/AdvancedSettings.js +0 -6
- package/dist/sidebar/AdvancedSettings.js.map +0 -1
- package/dist/sidebar/AdvancedSettingsMenu.js +0 -29
- package/dist/sidebar/AdvancedSettingsMenu.js.map +0 -1
- package/dist/sidebar/AdvancedSettingsType.js +0 -7
- package/dist/sidebar/AdvancedSettingsType.js.map +0 -1
- package/dist/sidebar/ChartBuilder.css +0 -56
- package/dist/sidebar/ChartBuilder.css.map +0 -1
- package/dist/sidebar/ChartBuilder.js +0 -443
- package/dist/sidebar/ChartBuilder.js.map +0 -1
- package/dist/sidebar/CustomColumnBuilder.css +0 -58
- package/dist/sidebar/CustomColumnBuilder.css.map +0 -1
- package/dist/sidebar/CustomColumnBuilder.js +0 -384
- package/dist/sidebar/CustomColumnBuilder.js.map +0 -1
- package/dist/sidebar/CustomColumnInput.js +0 -90
- package/dist/sidebar/CustomColumnInput.js.map +0 -1
- package/dist/sidebar/InputEditor.css +0 -35
- package/dist/sidebar/InputEditor.css.map +0 -1
- package/dist/sidebar/InputEditor.js +0 -177
- package/dist/sidebar/InputEditor.js.map +0 -1
- package/dist/sidebar/OptionType.js +0 -19
- package/dist/sidebar/OptionType.js.map +0 -1
- package/dist/sidebar/RollupRows.css +0 -120
- package/dist/sidebar/RollupRows.css.map +0 -1
- package/dist/sidebar/RollupRows.js +0 -519
- package/dist/sidebar/RollupRows.js.map +0 -1
- package/dist/sidebar/SelectDistinctBuilder.css +0 -41
- package/dist/sidebar/SelectDistinctBuilder.css.map +0 -1
- package/dist/sidebar/SelectDistinctBuilder.js +0 -155
- package/dist/sidebar/SelectDistinctBuilder.js.map +0 -1
- package/dist/sidebar/TableCsvExporter.css +0 -32
- package/dist/sidebar/TableCsvExporter.css.map +0 -1
- package/dist/sidebar/TableCsvExporter.js +0 -399
- package/dist/sidebar/TableCsvExporter.js.map +0 -1
- package/dist/sidebar/TableSaver.js +0 -487
- package/dist/sidebar/TableSaver.js.map +0 -1
- package/dist/sidebar/aggregations/AggregationEdit.css +0 -61
- package/dist/sidebar/aggregations/AggregationEdit.css.map +0 -1
- package/dist/sidebar/aggregations/AggregationEdit.js +0 -155
- package/dist/sidebar/aggregations/AggregationEdit.js.map +0 -1
- package/dist/sidebar/aggregations/AggregationOperation.js +0 -19
- package/dist/sidebar/aggregations/AggregationOperation.js.map +0 -1
- package/dist/sidebar/aggregations/AggregationUtils.js +0 -59
- package/dist/sidebar/aggregations/AggregationUtils.js.map +0 -1
- package/dist/sidebar/aggregations/Aggregations.css +0 -43
- package/dist/sidebar/aggregations/Aggregations.css.map +0 -1
- package/dist/sidebar/aggregations/Aggregations.js +0 -178
- package/dist/sidebar/aggregations/Aggregations.js.map +0 -1
- package/dist/sidebar/aggregations/index.js +0 -2
- package/dist/sidebar/aggregations/index.js.map +0 -1
- package/dist/sidebar/conditional-formatting/ColumnFormatEditor.js +0 -123
- package/dist/sidebar/conditional-formatting/ColumnFormatEditor.js.map +0 -1
- package/dist/sidebar/conditional-formatting/ConditionEditor.js +0 -243
- package/dist/sidebar/conditional-formatting/ConditionEditor.js.map +0 -1
- package/dist/sidebar/conditional-formatting/ConditionalFormatEditor.css +0 -22
- package/dist/sidebar/conditional-formatting/ConditionalFormatEditor.css.map +0 -1
- package/dist/sidebar/conditional-formatting/ConditionalFormatEditor.js +0 -109
- package/dist/sidebar/conditional-formatting/ConditionalFormatEditor.js.map +0 -1
- package/dist/sidebar/conditional-formatting/ConditionalFormattingAPIUtils.js +0 -18
- package/dist/sidebar/conditional-formatting/ConditionalFormattingAPIUtils.js.map +0 -1
- package/dist/sidebar/conditional-formatting/ConditionalFormattingMenu.css +0 -57
- package/dist/sidebar/conditional-formatting/ConditionalFormattingMenu.css.map +0 -1
- package/dist/sidebar/conditional-formatting/ConditionalFormattingMenu.js +0 -150
- package/dist/sidebar/conditional-formatting/ConditionalFormattingMenu.js.map +0 -1
- package/dist/sidebar/conditional-formatting/ConditionalFormattingUtils.js +0 -635
- package/dist/sidebar/conditional-formatting/ConditionalFormattingUtils.js.map +0 -1
- package/dist/sidebar/conditional-formatting/RowFormatEditor.js +0 -122
- package/dist/sidebar/conditional-formatting/RowFormatEditor.js.map +0 -1
- package/dist/sidebar/conditional-formatting/StyleEditor.css +0 -55
- package/dist/sidebar/conditional-formatting/StyleEditor.css.map +0 -1
- package/dist/sidebar/conditional-formatting/StyleEditor.js +0 -150
- package/dist/sidebar/conditional-formatting/StyleEditor.js.map +0 -1
- package/dist/sidebar/icons/BarIcon.js +0 -24
- package/dist/sidebar/icons/BarIcon.js.map +0 -1
- package/dist/sidebar/icons/FormatColumnWhereIcon.js +0 -42
- package/dist/sidebar/icons/FormatColumnWhereIcon.js.map +0 -1
- package/dist/sidebar/icons/FormatRowWhereIcon.js +0 -36
- package/dist/sidebar/icons/FormatRowWhereIcon.js.map +0 -1
- package/dist/sidebar/icons/HistogramIcon.js +0 -24
- package/dist/sidebar/icons/HistogramIcon.js.map +0 -1
- package/dist/sidebar/icons/LineIcon.js +0 -27
- package/dist/sidebar/icons/LineIcon.js.map +0 -1
- package/dist/sidebar/icons/PieIcon.js +0 -24
- package/dist/sidebar/icons/PieIcon.js.map +0 -1
- package/dist/sidebar/icons/ScatterIcon.js +0 -74
- package/dist/sidebar/icons/ScatterIcon.js.map +0 -1
- package/dist/sidebar/icons/index.js +0 -8
- package/dist/sidebar/icons/index.js.map +0 -1
- package/dist/sidebar/index.js +0 -18
- package/dist/sidebar/index.js.map +0 -1
- package/dist/sidebar/visibility-ordering-builder/VisibilityOrderingBuilder.css +0 -68
- package/dist/sidebar/visibility-ordering-builder/VisibilityOrderingBuilder.css.map +0 -1
- package/dist/sidebar/visibility-ordering-builder/VisibilityOrderingBuilder.js +0 -964
- package/dist/sidebar/visibility-ordering-builder/VisibilityOrderingBuilder.js.map +0 -1
- package/dist/sidebar/visibility-ordering-builder/VisibilityOrderingBuilderUtils.js +0 -132
- package/dist/sidebar/visibility-ordering-builder/VisibilityOrderingBuilderUtils.js.map +0 -1
- package/dist/sidebar/visibility-ordering-builder/VisibilityOrderingGroup.css +0 -29
- package/dist/sidebar/visibility-ordering-builder/VisibilityOrderingGroup.css.map +0 -1
- package/dist/sidebar/visibility-ordering-builder/VisibilityOrderingGroup.js +0 -188
- package/dist/sidebar/visibility-ordering-builder/VisibilityOrderingGroup.js.map +0 -1
- package/dist/sidebar/visibility-ordering-builder/VisibilityOrderingItem.js +0 -81
- package/dist/sidebar/visibility-ordering-builder/VisibilityOrderingItem.js.map +0 -1
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/PointerSensorWithInteraction.js +0 -30
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/PointerSensorWithInteraction.js.map +0 -1
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/SortableTree.js +0 -158
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/SortableTree.js.map +0 -1
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/SortableTreeInner.js +0 -146
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/SortableTreeInner.js.map +0 -1
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/SortableTreeItem.js +0 -59
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/SortableTreeItem.js.map +0 -1
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/TreeItem.css +0 -139
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/TreeItem.css.map +0 -1
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/TreeItem.js +0 -44
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/TreeItem.js.map +0 -1
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/keyboardCoordinates.js +0 -129
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/keyboardCoordinates.js.map +0 -1
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/types.js +0 -4
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/types.js.map +0 -1
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/utilities.js +0 -261
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/utilities.js.map +0 -1
package/dist/IrisGrid.js
DELETED
|
@@ -1,3651 +0,0 @@
|
|
|
1
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
2
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
3
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
7
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
|
-
import React, { Component } from 'react';
|
|
9
|
-
import memoize from 'memoizee';
|
|
10
|
-
import classNames from 'classnames';
|
|
11
|
-
import { CSSTransition } from 'react-transition-group';
|
|
12
|
-
import PropTypes from 'prop-types';
|
|
13
|
-
import deepEqual from 'deep-equal';
|
|
14
|
-
import Log from '@deephaven/log';
|
|
15
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
16
|
-
import { ContextActions, Stack, Menu, Page, Popper, ThemeExport, Tooltip, Button, ContextActionUtils } from '@deephaven/components';
|
|
17
|
-
import { Grid, GridRange, GridUtils, isEditableGridModel, isExpandableGridModel } from '@deephaven/grid';
|
|
18
|
-
import { dhEye, dhFilterFilled, dhGraphLineUp, dhTriangleDownSquare, vsClose, vsCloudDownload, vsEdit, vsFilter, vsMenu, vsReply, vsRuby, vsSearch, vsSplitHorizontal, vsSymbolOperator, vsTools } from '@deephaven/icons';
|
|
19
|
-
import { DateUtils, Formatter, FormatterUtils, TableUtils } from '@deephaven/jsapi-utils';
|
|
20
|
-
import { assertNotNull, copyToClipboard, EMPTY_ARRAY, EMPTY_MAP, Pending, PromiseUtils, ValidationError, getOrThrow } from '@deephaven/utils';
|
|
21
|
-
import { Type as FilterType } from '@deephaven/filters';
|
|
22
|
-
import throttle from 'lodash.throttle';
|
|
23
|
-
import debounce from 'lodash.debounce';
|
|
24
|
-
import clamp from 'lodash.clamp';
|
|
25
|
-
import { getFormatColumns } from "./sidebar/conditional-formatting/ConditionalFormattingUtils.js";
|
|
26
|
-
import PendingDataBottomBar from "./PendingDataBottomBar.js";
|
|
27
|
-
import IrisGridCopyHandler from "./IrisGridCopyHandler.js";
|
|
28
|
-
import FilterInputField from "./FilterInputField.js";
|
|
29
|
-
import { ClearFilterKeyHandler, CopyKeyHandler, ReverseKeyHandler } from "./key-handlers/index.js";
|
|
30
|
-
import { IrisGridCellOverflowMouseHandler, IrisGridColumnSelectMouseHandler, IrisGridColumnTooltipMouseHandler, IrisGridContextMenuHandler, IrisGridDataSelectMouseHandler, IrisGridFilterMouseHandler, IrisGridRowTreeMouseHandler, IrisGridSortMouseHandler, IrisGridTokenMouseHandler, PendingMouseHandler } from "./mousehandlers/index.js";
|
|
31
|
-
import ToastBottomBar from "./ToastBottomBar.js";
|
|
32
|
-
import IrisGridMetricCalculator from "./IrisGridMetricCalculator.js";
|
|
33
|
-
import IrisGridModelUpdater from "./IrisGridModelUpdater.js";
|
|
34
|
-
import IrisGridRenderer from "./IrisGridRenderer.js";
|
|
35
|
-
import IrisGridTheme from "./IrisGridTheme.js";
|
|
36
|
-
import ColumnStatistics from "./ColumnStatistics.js";
|
|
37
|
-
import "./IrisGrid.css";
|
|
38
|
-
import AdvancedFilterCreator from "./AdvancedFilterCreator.js";
|
|
39
|
-
import { Aggregations, AggregationEdit, AggregationUtils, ChartBuilder, CustomColumnBuilder, OptionType, RollupRows, TableCsvExporter, TableSaver, VisibilityOrderingBuilder } from "./sidebar/index.js";
|
|
40
|
-
import IrisGridUtils from "./IrisGridUtils.js";
|
|
41
|
-
import CrossColumnSearch from "./CrossColumnSearch.js";
|
|
42
|
-
import IrisGridModel from "./IrisGridModel.js";
|
|
43
|
-
import IrisGridPartitionSelector from "./IrisGridPartitionSelector.js";
|
|
44
|
-
import SelectDistinctBuilder from "./sidebar/SelectDistinctBuilder.js";
|
|
45
|
-
import AdvancedSettingsType from "./sidebar/AdvancedSettingsType.js";
|
|
46
|
-
import AdvancedSettingsMenu from "./sidebar/AdvancedSettingsMenu.js";
|
|
47
|
-
import SHORTCUTS from "./IrisGridShortcuts.js";
|
|
48
|
-
import ConditionalFormattingMenu from "./sidebar/conditional-formatting/ConditionalFormattingMenu.js";
|
|
49
|
-
import ConditionalFormatEditor from "./sidebar/conditional-formatting/ConditionalFormatEditor.js";
|
|
50
|
-
import IrisGridCellOverflowModal from "./IrisGridCellOverflowModal.js";
|
|
51
|
-
import GotoRow from "./GotoRow.js";
|
|
52
|
-
var log = Log.module('IrisGrid');
|
|
53
|
-
var UPDATE_DOWNLOAD_THROTTLE = 500;
|
|
54
|
-
var SET_FILTER_DEBOUNCE = 250;
|
|
55
|
-
var SEEK_ROW_DEBOUNCE = 250;
|
|
56
|
-
var SET_CONDITIONAL_FORMAT_DEBOUNCE = 250;
|
|
57
|
-
var DEFAULT_AGGREGATION_SETTINGS = Object.freeze({
|
|
58
|
-
aggregations: EMPTY_ARRAY,
|
|
59
|
-
showOnTop: false
|
|
60
|
-
});
|
|
61
|
-
var UNFORMATTED_DATE_PATTERN = "yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS z";
|
|
62
|
-
function isEmptyConfig(_ref) {
|
|
63
|
-
var {
|
|
64
|
-
advancedFilters,
|
|
65
|
-
aggregationSettings,
|
|
66
|
-
customColumns,
|
|
67
|
-
quickFilters,
|
|
68
|
-
reverseType,
|
|
69
|
-
rollupConfig,
|
|
70
|
-
searchFilter,
|
|
71
|
-
selectDistinctColumns,
|
|
72
|
-
sorts
|
|
73
|
-
} = _ref;
|
|
74
|
-
return advancedFilters.size === 0 && aggregationSettings.aggregations.length === 0 && customColumns.length === 0 && quickFilters.size === 0 && reverseType === TableUtils.REVERSE_TYPE.NONE && rollupConfig == null && searchFilter == null && selectDistinctColumns.length === 0 && sorts.length === 0;
|
|
75
|
-
}
|
|
76
|
-
export class IrisGrid extends Component {
|
|
77
|
-
constructor(props) {
|
|
78
|
-
var _model$layoutHints, _model$layoutHints$hi, _model$columns$0$name, _model$columns$;
|
|
79
|
-
super(props);
|
|
80
|
-
_defineProperty(this, "grid", void 0);
|
|
81
|
-
_defineProperty(this, "gridWrapper", void 0);
|
|
82
|
-
_defineProperty(this, "lastFocusedFilterBarColumn", void 0);
|
|
83
|
-
_defineProperty(this, "lastLoadedConfig", void 0);
|
|
84
|
-
_defineProperty(this, "tooltip", void 0);
|
|
85
|
-
_defineProperty(this, "pending", void 0);
|
|
86
|
-
_defineProperty(this, "globalColumnFormats", void 0);
|
|
87
|
-
_defineProperty(this, "dateTimeFormatterOptions", void 0);
|
|
88
|
-
_defineProperty(this, "decimalFormatOptions", void 0);
|
|
89
|
-
_defineProperty(this, "integerFormatOptions", void 0);
|
|
90
|
-
_defineProperty(this, "truncateNumbersWithPound", void 0);
|
|
91
|
-
_defineProperty(this, "loadingScrimStartTime", void 0);
|
|
92
|
-
_defineProperty(this, "loadingScrimFinishTime", void 0);
|
|
93
|
-
_defineProperty(this, "animationFrame", void 0);
|
|
94
|
-
_defineProperty(this, "loadingTimer", void 0);
|
|
95
|
-
_defineProperty(this, "renderer", void 0);
|
|
96
|
-
_defineProperty(this, "tableSaver", void 0);
|
|
97
|
-
_defineProperty(this, "crossColumnRef", void 0);
|
|
98
|
-
_defineProperty(this, "isAnimating", void 0);
|
|
99
|
-
_defineProperty(this, "filterInputRef", void 0);
|
|
100
|
-
_defineProperty(this, "toggleFilterBarAction", void 0);
|
|
101
|
-
_defineProperty(this, "toggleSearchBarAction", void 0);
|
|
102
|
-
_defineProperty(this, "toggleGotoRowAction", void 0);
|
|
103
|
-
_defineProperty(this, "discardAction", void 0);
|
|
104
|
-
_defineProperty(this, "commitAction", void 0);
|
|
105
|
-
_defineProperty(this, "contextActions", void 0);
|
|
106
|
-
_defineProperty(this, "tableUtils", void 0);
|
|
107
|
-
_defineProperty(this, "getAdvancedMenuOpenedHandler", memoize(column => this.handleAdvancedMenuOpened.bind(this, column), {
|
|
108
|
-
max: 100
|
|
109
|
-
}));
|
|
110
|
-
_defineProperty(this, "getCachedAdvancedFilterMenuActions", memoize((model, column, advancedFilterOptions, sortDirection, formatter) => /*#__PURE__*/React.createElement(AdvancedFilterCreator, {
|
|
111
|
-
model: model,
|
|
112
|
-
column: column,
|
|
113
|
-
onFilterChange: this.handleAdvancedFilterChange,
|
|
114
|
-
onSortChange: this.handleAdvancedFilterSortChange,
|
|
115
|
-
onDone: this.handleAdvancedFilterDone,
|
|
116
|
-
options: advancedFilterOptions,
|
|
117
|
-
sortDirection: sortDirection,
|
|
118
|
-
formatter: formatter,
|
|
119
|
-
tableUtils: this.tableUtils
|
|
120
|
-
}), {
|
|
121
|
-
max: 50
|
|
122
|
-
}));
|
|
123
|
-
_defineProperty(this, "getCachedOptionItems", memoize((isChartBuilderAvailable, isCustomColumnsAvailable, isFormatColumnsAvailable, isRollupAvailable, isTotalsAvailable, isSelectDistinctAvailable, isExportAvailable, toggleFilterBarAction, toggleSearchBarAction, toggleGotoRowAction, isFilterBarShown, showSearchBar, canDownloadCsv, canToggleSearch, showGotoRow, hasAdvancedSettings) => {
|
|
124
|
-
var optionItems = [];
|
|
125
|
-
if (isChartBuilderAvailable) {
|
|
126
|
-
optionItems.push({
|
|
127
|
-
type: OptionType.CHART_BUILDER,
|
|
128
|
-
title: 'Chart Builder',
|
|
129
|
-
icon: dhGraphLineUp
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
optionItems.push({
|
|
133
|
-
type: OptionType.VISIBILITY_ORDERING_BUILDER,
|
|
134
|
-
title: 'Organize Columns',
|
|
135
|
-
icon: dhEye
|
|
136
|
-
});
|
|
137
|
-
if (isFormatColumnsAvailable) {
|
|
138
|
-
optionItems.push({
|
|
139
|
-
type: OptionType.CONDITIONAL_FORMATTING,
|
|
140
|
-
title: 'Conditional Formatting',
|
|
141
|
-
icon: vsEdit
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
if (isCustomColumnsAvailable) {
|
|
145
|
-
optionItems.push({
|
|
146
|
-
type: OptionType.CUSTOM_COLUMN_BUILDER,
|
|
147
|
-
title: 'Custom Columns',
|
|
148
|
-
icon: vsSplitHorizontal
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
if (isRollupAvailable) {
|
|
152
|
-
optionItems.push({
|
|
153
|
-
type: OptionType.ROLLUP_ROWS,
|
|
154
|
-
title: 'Rollup Rows',
|
|
155
|
-
icon: dhTriangleDownSquare
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
if (isTotalsAvailable) {
|
|
159
|
-
optionItems.push({
|
|
160
|
-
type: OptionType.AGGREGATIONS,
|
|
161
|
-
title: 'Aggregate Columns',
|
|
162
|
-
icon: vsSymbolOperator
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
if (isSelectDistinctAvailable) {
|
|
166
|
-
optionItems.push({
|
|
167
|
-
type: OptionType.SELECT_DISTINCT,
|
|
168
|
-
title: 'Select Distinct Values',
|
|
169
|
-
icon: vsRuby
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
if (isExportAvailable && canDownloadCsv) {
|
|
173
|
-
optionItems.push({
|
|
174
|
-
type: OptionType.TABLE_EXPORTER,
|
|
175
|
-
title: 'Download CSV',
|
|
176
|
-
icon: vsCloudDownload
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
if (hasAdvancedSettings) {
|
|
180
|
-
optionItems.push({
|
|
181
|
-
type: OptionType.ADVANCED_SETTINGS,
|
|
182
|
-
title: 'Advanced Settings',
|
|
183
|
-
icon: vsTools
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
optionItems.push({
|
|
187
|
-
type: OptionType.QUICK_FILTERS,
|
|
188
|
-
title: 'Quick Filters',
|
|
189
|
-
subtitle: toggleFilterBarAction.shortcut.getDisplayText(),
|
|
190
|
-
icon: vsFilter,
|
|
191
|
-
isOn: isFilterBarShown,
|
|
192
|
-
onChange: toggleFilterBarAction.action
|
|
193
|
-
});
|
|
194
|
-
if (canToggleSearch) {
|
|
195
|
-
optionItems.push({
|
|
196
|
-
type: OptionType.SEARCH_BAR,
|
|
197
|
-
title: 'Search Bar',
|
|
198
|
-
subtitle: toggleSearchBarAction.shortcut.getDisplayText(),
|
|
199
|
-
icon: vsSearch,
|
|
200
|
-
isOn: showSearchBar,
|
|
201
|
-
onChange: toggleSearchBarAction.action
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
optionItems.push({
|
|
205
|
-
type: OptionType.GOTO,
|
|
206
|
-
title: 'Go to',
|
|
207
|
-
subtitle: toggleGotoRowAction.shortcut.getDisplayText(),
|
|
208
|
-
icon: vsReply,
|
|
209
|
-
isOn: showGotoRow,
|
|
210
|
-
onChange: toggleGotoRowAction.action
|
|
211
|
-
});
|
|
212
|
-
return Object.freeze(optionItems);
|
|
213
|
-
}, {
|
|
214
|
-
max: 1
|
|
215
|
-
}));
|
|
216
|
-
_defineProperty(this, "getCachedHiddenColumns", memoize((metricCalculator, userColumnWidths) => IrisGridUtils.getHiddenColumns(new Map([...metricCalculator.initialColumnWidths, ...userColumnWidths])), {
|
|
217
|
-
max: 1
|
|
218
|
-
}));
|
|
219
|
-
_defineProperty(this, "getAggregationMap", memoize((columns, aggregations) => {
|
|
220
|
-
var aggregationMap = {};
|
|
221
|
-
aggregations.forEach(_ref2 => {
|
|
222
|
-
var {
|
|
223
|
-
operation,
|
|
224
|
-
selected,
|
|
225
|
-
invert
|
|
226
|
-
} = _ref2;
|
|
227
|
-
aggregationMap[operation] = AggregationUtils.getOperationColumnNames(columns, operation, selected, invert);
|
|
228
|
-
});
|
|
229
|
-
return aggregationMap;
|
|
230
|
-
}));
|
|
231
|
-
_defineProperty(this, "getOperationMap", memoize((columns, aggregations) => {
|
|
232
|
-
var operationMap = {};
|
|
233
|
-
aggregations.filter(a => !AggregationUtils.isRollupOperation(a.operation)).forEach(_ref3 => {
|
|
234
|
-
var {
|
|
235
|
-
operation,
|
|
236
|
-
selected,
|
|
237
|
-
invert
|
|
238
|
-
} = _ref3;
|
|
239
|
-
AggregationUtils.getOperationColumnNames(columns, operation, selected, invert).forEach(name => {
|
|
240
|
-
var _operationMap$name;
|
|
241
|
-
var newOperations = [...((_operationMap$name = operationMap[name]) !== null && _operationMap$name !== void 0 ? _operationMap$name : []), operation];
|
|
242
|
-
operationMap[name] = Object.freeze(newOperations);
|
|
243
|
-
});
|
|
244
|
-
});
|
|
245
|
-
return operationMap;
|
|
246
|
-
}));
|
|
247
|
-
_defineProperty(this, "getOperationOrder", memoize(aggregations => aggregations.map(a => a.operation).filter(o => !AggregationUtils.isRollupOperation(o))));
|
|
248
|
-
_defineProperty(this, "getCachedFormatColumns", memoize((dh, columns, rules) => getFormatColumns(dh, columns, rules)));
|
|
249
|
-
_defineProperty(this, "getCachedPreviewFormatColumns", memoize((dh, columns, rulesParam, preview, editIndex) => {
|
|
250
|
-
log.debug('getCachedPreviewFormatColumns', rulesParam, preview, editIndex);
|
|
251
|
-
if (preview !== undefined && editIndex !== undefined) {
|
|
252
|
-
var rules = [...rulesParam];
|
|
253
|
-
rules[editIndex] = preview;
|
|
254
|
-
return this.getCachedFormatColumns(dh, columns, rules);
|
|
255
|
-
}
|
|
256
|
-
return this.getCachedFormatColumns(dh, columns, rulesParam);
|
|
257
|
-
}));
|
|
258
|
-
_defineProperty(this, "getModelRollupConfig", memoize((originalColumns, config, aggregationSettings) => IrisGridUtils.getModelRollupConfig(originalColumns, config, aggregationSettings)));
|
|
259
|
-
_defineProperty(this, "getModelTotalsConfig", memoize((columns, config, aggregationSettings) => {
|
|
260
|
-
var _config$columns$lengt, _config$columns, _aggregations$length;
|
|
261
|
-
var {
|
|
262
|
-
aggregations,
|
|
263
|
-
showOnTop
|
|
264
|
-
} = aggregationSettings;
|
|
265
|
-
// If we've got rollups, then aggregations are applied as part of that...
|
|
266
|
-
if (((_config$columns$lengt = config === null || config === void 0 ? void 0 : (_config$columns = config.columns) === null || _config$columns === void 0 ? void 0 : _config$columns.length) !== null && _config$columns$lengt !== void 0 ? _config$columns$lengt : 0) > 0 || ((_aggregations$length = aggregations === null || aggregations === void 0 ? void 0 : aggregations.length) !== null && _aggregations$length !== void 0 ? _aggregations$length : 0) === 0) {
|
|
267
|
-
return null;
|
|
268
|
-
}
|
|
269
|
-
var operationMap = this.getOperationMap(columns, aggregations);
|
|
270
|
-
var operationOrder = this.getOperationOrder(aggregations);
|
|
271
|
-
return {
|
|
272
|
-
operationMap,
|
|
273
|
-
operationOrder,
|
|
274
|
-
showOnTop
|
|
275
|
-
};
|
|
276
|
-
}));
|
|
277
|
-
_defineProperty(this, "getCachedStateOverride", memoize((hoverSelectColumn, isFilterBarShown, isSelectingColumn, loadingScrimProgress, quickFilters, advancedFilters, sorts, reverseType, rollupConfig, isMenuShown) => ({
|
|
278
|
-
hoverSelectColumn,
|
|
279
|
-
isFilterBarShown,
|
|
280
|
-
isSelectingColumn,
|
|
281
|
-
loadingScrimProgress,
|
|
282
|
-
quickFilters,
|
|
283
|
-
advancedFilters,
|
|
284
|
-
sorts,
|
|
285
|
-
reverseType,
|
|
286
|
-
rollupConfig,
|
|
287
|
-
isMenuShown
|
|
288
|
-
}), {
|
|
289
|
-
max: 1
|
|
290
|
-
}));
|
|
291
|
-
_defineProperty(this, "getCachedFilter", memoize((customFilters, quickFilters, advancedFilters, partitionFilters, searchFilter) => [...(customFilters !== null && customFilters !== void 0 ? customFilters : []), ...(partitionFilters !== null && partitionFilters !== void 0 ? partitionFilters : []), ...IrisGridUtils.getFiltersFromFilterMap(quickFilters), ...IrisGridUtils.getFiltersFromFilterMap(advancedFilters), ...(searchFilter !== undefined ? [searchFilter] : [])], {
|
|
292
|
-
max: 1
|
|
293
|
-
}));
|
|
294
|
-
_defineProperty(this, "getCachedTheme", memoize((theme, isEditable, floatingRowCount) => _objectSpread(_objectSpread(_objectSpread({}, IrisGridTheme), theme), {}, {
|
|
295
|
-
autoSelectRow: !isEditable,
|
|
296
|
-
// We only show the row footers when we have floating rows for aggregations
|
|
297
|
-
rowFooterWidth: floatingRowCount > 0 ? theme.rowFooterWidth : 0
|
|
298
|
-
}), {
|
|
299
|
-
max: 1
|
|
300
|
-
}));
|
|
301
|
-
_defineProperty(this, "getAlwaysFetchColumns", memoize((alwaysFetchColumns, columns, movedColumns, floatingLeftColumnCount, floatingRightColumnCount, draggingRange) => {
|
|
302
|
-
var floatingColumns = [];
|
|
303
|
-
for (var i = 0; i < floatingLeftColumnCount; i += 1) {
|
|
304
|
-
floatingColumns.push(columns[GridUtils.getModelIndex(i, movedColumns)].name);
|
|
305
|
-
}
|
|
306
|
-
for (var _i = 0; _i < floatingRightColumnCount; _i += 1) {
|
|
307
|
-
floatingColumns.push(columns[GridUtils.getModelIndex(columns.length - 1 - _i, movedColumns)].name);
|
|
308
|
-
}
|
|
309
|
-
if (draggingRange) {
|
|
310
|
-
for (var _i2 = draggingRange[0]; _i2 <= draggingRange[1]; _i2 += 1) {
|
|
311
|
-
floatingColumns.push(columns[GridUtils.getModelIndex(_i2, movedColumns)].name);
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
var columnSet = new Set([...alwaysFetchColumns, ...floatingColumns]);
|
|
315
|
-
return Object.freeze([...columnSet]);
|
|
316
|
-
}));
|
|
317
|
-
_defineProperty(this, "updateSearchFilter", debounce((searchValue, selectedSearchColumns, columns, invertSearchColumns) => {
|
|
318
|
-
var {
|
|
319
|
-
model
|
|
320
|
-
} = this.props;
|
|
321
|
-
var searchFilter = CrossColumnSearch.createSearchFilter(model.dh, searchValue, selectedSearchColumns, columns, invertSearchColumns);
|
|
322
|
-
this.setState({
|
|
323
|
-
searchFilter
|
|
324
|
-
});
|
|
325
|
-
}, SET_FILTER_DEBOUNCE));
|
|
326
|
-
_defineProperty(this, "handleConditionalFormatEditorUpdate", debounce(conditionalFormatPreview => {
|
|
327
|
-
this.setState({
|
|
328
|
-
conditionalFormatPreview
|
|
329
|
-
});
|
|
330
|
-
}, SET_CONDITIONAL_FORMAT_DEBOUNCE));
|
|
331
|
-
_defineProperty(this, "handleDownloadProgressUpdate", throttle((tableDownloadProgress, tableDownloadEstimatedTime) => {
|
|
332
|
-
var {
|
|
333
|
-
tableDownloadStatus
|
|
334
|
-
} = this.state;
|
|
335
|
-
if (tableDownloadStatus === TableCsvExporter.DOWNLOAD_STATUS.DOWNLOADING) {
|
|
336
|
-
this.setState({
|
|
337
|
-
tableDownloadProgress,
|
|
338
|
-
tableDownloadEstimatedTime
|
|
339
|
-
});
|
|
340
|
-
}
|
|
341
|
-
}, UPDATE_DOWNLOAD_THROTTLE));
|
|
342
|
-
_defineProperty(this, "getOverflowButtonTooltip", memoize(overflowButtonTooltipProps => {
|
|
343
|
-
if (overflowButtonTooltipProps == null) {
|
|
344
|
-
return null;
|
|
345
|
-
}
|
|
346
|
-
var wrapperStyle = _objectSpread(_objectSpread({
|
|
347
|
-
position: 'absolute'
|
|
348
|
-
}, overflowButtonTooltipProps), {}, {
|
|
349
|
-
pointerEvents: 'none'
|
|
350
|
-
});
|
|
351
|
-
var popperOptions = {
|
|
352
|
-
placement: 'left',
|
|
353
|
-
modifiers: {
|
|
354
|
-
flip: {
|
|
355
|
-
behavior: ['left', 'right']
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
};
|
|
359
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
360
|
-
style: wrapperStyle
|
|
361
|
-
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
362
|
-
key: Date.now(),
|
|
363
|
-
options: popperOptions,
|
|
364
|
-
ref: this.handleTooltipRef
|
|
365
|
-
}, "View full contents"));
|
|
366
|
-
}));
|
|
367
|
-
_defineProperty(this, "getExpandCellTooltip", memoize(expandCellTooltipProps => {
|
|
368
|
-
if (expandCellTooltipProps == null) {
|
|
369
|
-
return null;
|
|
370
|
-
}
|
|
371
|
-
var {
|
|
372
|
-
expandTooltipDisplayValue
|
|
373
|
-
} = this.state;
|
|
374
|
-
var wrapperStyle = _objectSpread(_objectSpread({
|
|
375
|
-
position: 'absolute'
|
|
376
|
-
}, expandCellTooltipProps), {}, {
|
|
377
|
-
pointerEvents: 'none'
|
|
378
|
-
});
|
|
379
|
-
var popperOptions = {
|
|
380
|
-
placement: 'bottom-start'
|
|
381
|
-
};
|
|
382
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
383
|
-
style: wrapperStyle
|
|
384
|
-
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
385
|
-
key: Date.now(),
|
|
386
|
-
options: popperOptions,
|
|
387
|
-
ref: this.handleTooltipRef
|
|
388
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
389
|
-
style: {
|
|
390
|
-
textAlign: 'left'
|
|
391
|
-
}
|
|
392
|
-
}, "Click to ", expandTooltipDisplayValue, " row", /*#__PURE__*/React.createElement("br", null), ContextActionUtils.isMacPlatform() ? '⌘' : 'Ctrl+', "Click to expand row and all children")));
|
|
393
|
-
}));
|
|
394
|
-
_defineProperty(this, "getLinkHoverTooltip", memoize(linkHoverTooltipProps => {
|
|
395
|
-
if (linkHoverTooltipProps == null) {
|
|
396
|
-
return null;
|
|
397
|
-
}
|
|
398
|
-
var {
|
|
399
|
-
linkHoverDisplayValue
|
|
400
|
-
} = this.state;
|
|
401
|
-
var wrapperStyle = _objectSpread(_objectSpread({
|
|
402
|
-
position: 'absolute'
|
|
403
|
-
}, linkHoverTooltipProps), {}, {
|
|
404
|
-
pointerEvents: 'none'
|
|
405
|
-
});
|
|
406
|
-
var popperOptions = {
|
|
407
|
-
placement: 'bottom'
|
|
408
|
-
};
|
|
409
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
410
|
-
style: wrapperStyle
|
|
411
|
-
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
412
|
-
options: popperOptions,
|
|
413
|
-
ref: this.handleTooltipRef
|
|
414
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
415
|
-
className: "link-hover-tooltip"
|
|
416
|
-
}, linkHoverDisplayValue, " - Click once to follow.", /*#__PURE__*/React.createElement("br", null), "Click and hold to select this cell.")));
|
|
417
|
-
}));
|
|
418
|
-
_defineProperty(this, "handleGotoValueChanged", input => {
|
|
419
|
-
this.setState({
|
|
420
|
-
gotoValue: input
|
|
421
|
-
});
|
|
422
|
-
this.debouncedSeekRow(input);
|
|
423
|
-
});
|
|
424
|
-
_defineProperty(this, "debouncedSeekRow", debounce(input => {
|
|
425
|
-
this.seekRow(input);
|
|
426
|
-
}, SEEK_ROW_DEBOUNCE));
|
|
427
|
-
this.handleAdvancedFilterChange = this.handleAdvancedFilterChange.bind(this);
|
|
428
|
-
this.handleAdvancedFilterSortChange = this.handleAdvancedFilterSortChange.bind(this);
|
|
429
|
-
this.handleAdvancedFilterDone = this.handleAdvancedFilterDone.bind(this);
|
|
430
|
-
this.handleAdvancedMenuOpened = this.handleAdvancedMenuOpened.bind(this);
|
|
431
|
-
this.handleGotoRowOpened = this.handleGotoRowOpened.bind(this);
|
|
432
|
-
this.handleGotoRowClosed = this.handleGotoRowClosed.bind(this);
|
|
433
|
-
this.handleAdvancedMenuClosed = this.handleAdvancedMenuClosed.bind(this);
|
|
434
|
-
this.handleAggregationChange = this.handleAggregationChange.bind(this);
|
|
435
|
-
this.handleAggregationsChange = this.handleAggregationsChange.bind(this);
|
|
436
|
-
this.handleAggregationEdit = this.handleAggregationEdit.bind(this);
|
|
437
|
-
this.handleAnimationLoop = this.handleAnimationLoop.bind(this);
|
|
438
|
-
this.handleAnimationStart = this.handleAnimationStart.bind(this);
|
|
439
|
-
this.handleAnimationEnd = this.handleAnimationEnd.bind(this);
|
|
440
|
-
this.handleChartChange = this.handleChartChange.bind(this);
|
|
441
|
-
this.handleChartCreate = this.handleChartCreate.bind(this);
|
|
442
|
-
this.handleGridError = this.handleGridError.bind(this);
|
|
443
|
-
this.handleFilterBarChange = this.handleFilterBarChange.bind(this);
|
|
444
|
-
this.handleFilterBarDone = this.handleFilterBarDone.bind(this);
|
|
445
|
-
this.handleFilterBarTab = this.handleFilterBarTab.bind(this);
|
|
446
|
-
this.handleCancel = this.handleCancel.bind(this);
|
|
447
|
-
this.handleMenu = this.handleMenu.bind(this);
|
|
448
|
-
this.handleMenuClose = this.handleMenuClose.bind(this);
|
|
449
|
-
this.handleMenuSelect = this.handleMenuSelect.bind(this);
|
|
450
|
-
this.handleMenuBack = this.handleMenuBack.bind(this);
|
|
451
|
-
this.handleRequestFailed = this.handleRequestFailed.bind(this);
|
|
452
|
-
this.handleSelectionChanged = this.handleSelectionChanged.bind(this);
|
|
453
|
-
this.handleMovedColumnsChanged = this.handleMovedColumnsChanged.bind(this);
|
|
454
|
-
this.handleHeaderGroupsChanged = this.handleHeaderGroupsChanged.bind(this);
|
|
455
|
-
this.handleUpdate = this.handleUpdate.bind(this);
|
|
456
|
-
this.handleTooltipRef = this.handleTooltipRef.bind(this);
|
|
457
|
-
this.handleViewChanged = this.handleViewChanged.bind(this);
|
|
458
|
-
this.handleFormatSelection = this.handleFormatSelection.bind(this);
|
|
459
|
-
this.handleConditionalFormatCreate = this.handleConditionalFormatCreate.bind(this);
|
|
460
|
-
this.handleConditionalFormatEdit = this.handleConditionalFormatEdit.bind(this);
|
|
461
|
-
this.handleConditionalFormatsChange = this.handleConditionalFormatsChange.bind(this);
|
|
462
|
-
this.handleConditionalFormatEditorSave = this.handleConditionalFormatEditorSave.bind(this);
|
|
463
|
-
this.handleConditionalFormatEditorCancel = this.handleConditionalFormatEditorCancel.bind(this);
|
|
464
|
-
this.handleUpdateCustomColumns = this.handleUpdateCustomColumns.bind(this);
|
|
465
|
-
this.handleCustomColumnsChanged = this.handleCustomColumnsChanged.bind(this);
|
|
466
|
-
this.handleSelectDistinctChanged = this.handleSelectDistinctChanged.bind(this);
|
|
467
|
-
this.handlePendingDataUpdated = this.handlePendingDataUpdated.bind(this);
|
|
468
|
-
this.handlePendingCommitClicked = this.handlePendingCommitClicked.bind(this);
|
|
469
|
-
this.handlePendingDiscardClicked = this.handlePendingDiscardClicked.bind(this);
|
|
470
|
-
this.handleGotoRowSelectedRowNumberSubmit = this.handleGotoRowSelectedRowNumberSubmit.bind(this);
|
|
471
|
-
this.focusRowInGrid = this.focusRowInGrid.bind(this);
|
|
472
|
-
this.handleDownloadTable = this.handleDownloadTable.bind(this);
|
|
473
|
-
this.handleDownloadTableStart = this.handleDownloadTableStart.bind(this);
|
|
474
|
-
this.handleCancelDownloadTable = this.handleCancelDownloadTable.bind(this);
|
|
475
|
-
this.handleDownloadCanceled = this.handleDownloadCanceled.bind(this);
|
|
476
|
-
this.handleDownloadCompleted = this.handleDownloadCompleted.bind(this);
|
|
477
|
-
this.handlePartitionAppend = this.handlePartitionAppend.bind(this);
|
|
478
|
-
this.handlePartitionChange = this.handlePartitionChange.bind(this);
|
|
479
|
-
this.handlePartitionFetchAll = this.handlePartitionFetchAll.bind(this);
|
|
480
|
-
this.handlePartitionDone = this.handlePartitionDone.bind(this);
|
|
481
|
-
this.handleColumnVisibilityChanged = this.handleColumnVisibilityChanged.bind(this);
|
|
482
|
-
this.handleColumnVisibilityReset = this.handleColumnVisibilityReset.bind(this);
|
|
483
|
-
this.handleCrossColumnSearch = this.handleCrossColumnSearch.bind(this);
|
|
484
|
-
this.handleRollupChange = this.handleRollupChange.bind(this);
|
|
485
|
-
this.handleOverflowClose = this.handleOverflowClose.bind(this);
|
|
486
|
-
this.getColumnBoundingRect = this.getColumnBoundingRect.bind(this);
|
|
487
|
-
this.handleGotoRowSelectedRowNumberChanged = this.handleGotoRowSelectedRowNumberChanged.bind(this);
|
|
488
|
-
this.handleGotoValueSelectedColumnNameChanged = this.handleGotoValueSelectedColumnNameChanged.bind(this);
|
|
489
|
-
this.handleGotoValueSelectedFilterChanged = this.handleGotoValueSelectedFilterChanged.bind(this);
|
|
490
|
-
this.handleGotoValueChanged = this.handleGotoValueChanged.bind(this);
|
|
491
|
-
this.handleGotoValueSubmitted = this.handleGotoValueSubmitted.bind(this);
|
|
492
|
-
this.grid = null;
|
|
493
|
-
this.gridWrapper = null;
|
|
494
|
-
this.lastLoadedConfig = null;
|
|
495
|
-
this.pending = new Pending();
|
|
496
|
-
this.globalColumnFormats = EMPTY_ARRAY;
|
|
497
|
-
this.decimalFormatOptions = {};
|
|
498
|
-
this.integerFormatOptions = {};
|
|
499
|
-
this.truncateNumbersWithPound = false;
|
|
500
|
-
|
|
501
|
-
// When the loading scrim started/when it should extend to the end of the screen.
|
|
502
|
-
this.renderer = new IrisGridRenderer();
|
|
503
|
-
this.tableSaver = null;
|
|
504
|
-
this.crossColumnRef = /*#__PURE__*/React.createRef();
|
|
505
|
-
this.isAnimating = false;
|
|
506
|
-
this.filterInputRef = /*#__PURE__*/React.createRef();
|
|
507
|
-
this.toggleFilterBarAction = {
|
|
508
|
-
action: () => this.toggleFilterBar(),
|
|
509
|
-
shortcut: SHORTCUTS.TABLE.TOGGLE_QUICK_FILTER
|
|
510
|
-
};
|
|
511
|
-
this.toggleSearchBarAction = {
|
|
512
|
-
action: () => this.toggleSearchBar(),
|
|
513
|
-
shortcut: SHORTCUTS.TABLE.TOGGLE_SEARCH
|
|
514
|
-
};
|
|
515
|
-
this.toggleGotoRowAction = {
|
|
516
|
-
action: () => this.toggleGotoRow(),
|
|
517
|
-
shortcut: SHORTCUTS.TABLE.GOTO_ROW
|
|
518
|
-
};
|
|
519
|
-
this.discardAction = {
|
|
520
|
-
action: () => {
|
|
521
|
-
var {
|
|
522
|
-
model
|
|
523
|
-
} = this.props;
|
|
524
|
-
if (isEditableGridModel(model) && model.isEditable && model.pendingDataMap.size > 0) {
|
|
525
|
-
this.discardPending().catch(log.error);
|
|
526
|
-
}
|
|
527
|
-
},
|
|
528
|
-
shortcut: SHORTCUTS.INPUT_TABLE.DISCARD
|
|
529
|
-
};
|
|
530
|
-
this.commitAction = {
|
|
531
|
-
action: () => {
|
|
532
|
-
var {
|
|
533
|
-
model
|
|
534
|
-
} = this.props;
|
|
535
|
-
if (isEditableGridModel(model) && model.isEditable && model.pendingDataMap.size > 0 && model.pendingDataErrors.size === 0) {
|
|
536
|
-
this.commitPending().catch(log.error);
|
|
537
|
-
}
|
|
538
|
-
},
|
|
539
|
-
shortcut: SHORTCUTS.INPUT_TABLE.COMMIT
|
|
540
|
-
};
|
|
541
|
-
this.contextActions = [this.toggleFilterBarAction, this.toggleSearchBarAction, this.toggleGotoRowAction, this.discardAction, this.commitAction];
|
|
542
|
-
var {
|
|
543
|
-
aggregationSettings: _aggregationSettings,
|
|
544
|
-
conditionalFormats,
|
|
545
|
-
customColumnFormatMap,
|
|
546
|
-
isFilterBarShown: _isFilterBarShown,
|
|
547
|
-
isSelectingPartition,
|
|
548
|
-
model: _model,
|
|
549
|
-
movedColumns: movedColumnsProp,
|
|
550
|
-
movedRows: movedRowsProp,
|
|
551
|
-
partition,
|
|
552
|
-
partitionColumn,
|
|
553
|
-
rollupConfig: _rollupConfig,
|
|
554
|
-
userColumnWidths: _userColumnWidths,
|
|
555
|
-
userRowHeights,
|
|
556
|
-
showSearchBar: _showSearchBar,
|
|
557
|
-
searchValue: _searchValue,
|
|
558
|
-
selectedSearchColumns: _selectedSearchColumns,
|
|
559
|
-
invertSearchColumns: _invertSearchColumns,
|
|
560
|
-
advancedFilters: _advancedFilters,
|
|
561
|
-
quickFilters: _quickFilters,
|
|
562
|
-
selectDistinctColumns,
|
|
563
|
-
pendingDataMap,
|
|
564
|
-
canCopy,
|
|
565
|
-
frozenColumns,
|
|
566
|
-
columnHeaderGroups
|
|
567
|
-
} = props;
|
|
568
|
-
var keyHandlers = [new ReverseKeyHandler(this), new ClearFilterKeyHandler(this)];
|
|
569
|
-
if (canCopy) {
|
|
570
|
-
keyHandlers.push(new CopyKeyHandler(this));
|
|
571
|
-
}
|
|
572
|
-
var {
|
|
573
|
-
dh: _dh
|
|
574
|
-
} = _model;
|
|
575
|
-
var mouseHandlers = [new IrisGridCellOverflowMouseHandler(this), new IrisGridRowTreeMouseHandler(this), new IrisGridTokenMouseHandler(this), new IrisGridColumnSelectMouseHandler(this), new IrisGridColumnTooltipMouseHandler(this), new IrisGridSortMouseHandler(this), new IrisGridFilterMouseHandler(this), new IrisGridContextMenuHandler(this, _dh), new IrisGridDataSelectMouseHandler(this), new PendingMouseHandler(this)];
|
|
576
|
-
var _movedColumns = movedColumnsProp.length > 0 ? movedColumnsProp : _model.initialMovedColumns;
|
|
577
|
-
var movedRows = movedRowsProp.length > 0 ? movedRowsProp : _model.initialMovedRows;
|
|
578
|
-
var _metricCalculator = new IrisGridMetricCalculator({
|
|
579
|
-
userColumnWidths: new Map(_userColumnWidths),
|
|
580
|
-
userRowHeights: new Map(userRowHeights),
|
|
581
|
-
movedColumns: _movedColumns,
|
|
582
|
-
initialColumnWidths: new Map(_model === null || _model === void 0 ? void 0 : (_model$layoutHints = _model.layoutHints) === null || _model$layoutHints === void 0 ? void 0 : (_model$layoutHints$hi = _model$layoutHints.hiddenColumns) === null || _model$layoutHints$hi === void 0 ? void 0 : _model$layoutHints$hi.map(name => [_model.getColumnIndexByName(name), 0]))
|
|
583
|
-
});
|
|
584
|
-
var searchColumns = _selectedSearchColumns !== null && _selectedSearchColumns !== void 0 ? _selectedSearchColumns : [];
|
|
585
|
-
var _searchFilter = CrossColumnSearch.createSearchFilter(_dh, _searchValue, searchColumns, _model.columns, _invertSearchColumns);
|
|
586
|
-
this.tableUtils = new TableUtils(_dh);
|
|
587
|
-
this.state = {
|
|
588
|
-
isFilterBarShown: _isFilterBarShown,
|
|
589
|
-
isSelectingPartition,
|
|
590
|
-
focusedFilterBarColumn: null,
|
|
591
|
-
metricCalculator: _metricCalculator,
|
|
592
|
-
metrics: undefined,
|
|
593
|
-
keyHandlers,
|
|
594
|
-
mouseHandlers,
|
|
595
|
-
partition,
|
|
596
|
-
partitionColumn,
|
|
597
|
-
partitionTable: null,
|
|
598
|
-
partitionFilters: [],
|
|
599
|
-
// setAdvancedFilter and setQuickFilter mutate the arguments
|
|
600
|
-
// so we want to always use map copies from the state instead of props
|
|
601
|
-
quickFilters: _quickFilters ? new Map(_quickFilters) : new Map(),
|
|
602
|
-
advancedFilters: new Map(_advancedFilters),
|
|
603
|
-
shownAdvancedFilter: null,
|
|
604
|
-
hoverAdvancedFilter: null,
|
|
605
|
-
sorts: [],
|
|
606
|
-
reverseType: TableUtils.REVERSE_TYPE.NONE,
|
|
607
|
-
customColumns: [],
|
|
608
|
-
selectDistinctColumns,
|
|
609
|
-
// selected range in table
|
|
610
|
-
selectedRanges: [],
|
|
611
|
-
// Current ongoing copy operation
|
|
612
|
-
copyOperation: null,
|
|
613
|
-
// The filter that is currently being applied. Reset after update is received
|
|
614
|
-
loadingText: null,
|
|
615
|
-
loadingScrimProgress: null,
|
|
616
|
-
loadingSpinnerShown: false,
|
|
617
|
-
movedColumns: _movedColumns,
|
|
618
|
-
movedRows,
|
|
619
|
-
shownColumnTooltip: null,
|
|
620
|
-
formatter: new Formatter(_dh),
|
|
621
|
-
isMenuShown: false,
|
|
622
|
-
customColumnFormatMap: new Map(customColumnFormatMap),
|
|
623
|
-
conditionalFormats,
|
|
624
|
-
conditionalFormatEditIndex: null,
|
|
625
|
-
conditionalFormatPreview: undefined,
|
|
626
|
-
// Column user is hovering over for selection
|
|
627
|
-
hoverSelectColumn: null,
|
|
628
|
-
isTableDownloading: false,
|
|
629
|
-
isReady: false,
|
|
630
|
-
tableDownloadStatus: '',
|
|
631
|
-
tableDownloadProgress: 0,
|
|
632
|
-
tableDownloadEstimatedTime: 0,
|
|
633
|
-
showSearchBar: _showSearchBar,
|
|
634
|
-
searchFilter: _searchFilter,
|
|
635
|
-
searchValue: _searchValue,
|
|
636
|
-
selectedSearchColumns: searchColumns,
|
|
637
|
-
invertSearchColumns: _invertSearchColumns,
|
|
638
|
-
rollupConfig: _rollupConfig,
|
|
639
|
-
rollupSelectedColumns: [],
|
|
640
|
-
aggregationSettings: _aggregationSettings,
|
|
641
|
-
selectedAggregation: null,
|
|
642
|
-
openOptions: [],
|
|
643
|
-
pendingRowCount: 0,
|
|
644
|
-
pendingDataMap: pendingDataMap !== null && pendingDataMap !== void 0 ? pendingDataMap : new Map(),
|
|
645
|
-
pendingDataErrors: new Map(),
|
|
646
|
-
pendingSavePromise: null,
|
|
647
|
-
pendingSaveError: null,
|
|
648
|
-
toastMessage: null,
|
|
649
|
-
frozenColumns,
|
|
650
|
-
showOverflowModal: false,
|
|
651
|
-
overflowText: '',
|
|
652
|
-
overflowButtonTooltipProps: null,
|
|
653
|
-
expandCellTooltipProps: null,
|
|
654
|
-
expandTooltipDisplayValue: 'expand',
|
|
655
|
-
linkHoverTooltipProps: null,
|
|
656
|
-
linkHoverDisplayValue: '',
|
|
657
|
-
isGotoShown: false,
|
|
658
|
-
gotoRow: '',
|
|
659
|
-
gotoRowError: '',
|
|
660
|
-
gotoValueError: '',
|
|
661
|
-
gotoValueSelectedColumnName: (_model$columns$0$name = (_model$columns$ = _model.columns[0]) === null || _model$columns$ === void 0 ? void 0 : _model$columns$.name) !== null && _model$columns$0$name !== void 0 ? _model$columns$0$name : '',
|
|
662
|
-
gotoValueSelectedFilter: FilterType.eqIgnoreCase,
|
|
663
|
-
gotoValue: '',
|
|
664
|
-
columnHeaderGroups: columnHeaderGroups !== null && columnHeaderGroups !== void 0 ? columnHeaderGroups : _model.initialColumnHeaderGroups
|
|
665
|
-
};
|
|
666
|
-
}
|
|
667
|
-
componentDidMount() {
|
|
668
|
-
var {
|
|
669
|
-
partitionColumn,
|
|
670
|
-
model
|
|
671
|
-
} = this.props;
|
|
672
|
-
var column = partitionColumn !== null && partitionColumn !== void 0 ? partitionColumn : model.columns.find(c => c.isPartitionColumn);
|
|
673
|
-
if (model.isFilterRequired && model.isValuesTableAvailable && column != null) {
|
|
674
|
-
this.loadPartitionsTable(column);
|
|
675
|
-
} else {
|
|
676
|
-
this.initState();
|
|
677
|
-
}
|
|
678
|
-
this.startListening(model);
|
|
679
|
-
}
|
|
680
|
-
componentDidUpdate(prevProps) {
|
|
681
|
-
var {
|
|
682
|
-
inputFilters,
|
|
683
|
-
isSelectingColumn,
|
|
684
|
-
settings,
|
|
685
|
-
model,
|
|
686
|
-
customFilters,
|
|
687
|
-
sorts
|
|
688
|
-
} = this.props;
|
|
689
|
-
if (model !== prevProps.model) {
|
|
690
|
-
this.stopListening(prevProps.model);
|
|
691
|
-
this.startListening(model);
|
|
692
|
-
}
|
|
693
|
-
var changedInputFilters = inputFilters !== prevProps.inputFilters ? inputFilters.filter(inputFilter => !prevProps.inputFilters.includes(inputFilter)) : [];
|
|
694
|
-
if (changedInputFilters.length > 0) {
|
|
695
|
-
var _advancedSettings$get;
|
|
696
|
-
var {
|
|
697
|
-
advancedSettings
|
|
698
|
-
} = this.props;
|
|
699
|
-
var replaceExistingFilters = (_advancedSettings$get = advancedSettings.get(AdvancedSettingsType.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS)) !== null && _advancedSettings$get !== void 0 ? _advancedSettings$get : false;
|
|
700
|
-
if (replaceExistingFilters) {
|
|
701
|
-
this.clearGridInputField();
|
|
702
|
-
this.clearCrossColumSearch();
|
|
703
|
-
}
|
|
704
|
-
this.startLoading('Filtering...', true);
|
|
705
|
-
this.applyInputFilters(changedInputFilters, replaceExistingFilters);
|
|
706
|
-
}
|
|
707
|
-
if (isSelectingColumn !== prevProps.isSelectingColumn) {
|
|
708
|
-
this.resetColumnSelection();
|
|
709
|
-
}
|
|
710
|
-
if (settings !== prevProps.settings) {
|
|
711
|
-
this.updateFormatterSettings(settings);
|
|
712
|
-
}
|
|
713
|
-
if (customFilters !== prevProps.customFilters) {
|
|
714
|
-
this.startLoading('Filtering...', true);
|
|
715
|
-
}
|
|
716
|
-
if (sorts !== prevProps.sorts) {
|
|
717
|
-
this.updateSorts(sorts);
|
|
718
|
-
}
|
|
719
|
-
var {
|
|
720
|
-
loadingScrimStartTime,
|
|
721
|
-
loadingScrimFinishTime
|
|
722
|
-
} = this;
|
|
723
|
-
if (loadingScrimStartTime != null && loadingScrimFinishTime != null) {
|
|
724
|
-
window.requestAnimationFrame(() => {
|
|
725
|
-
var now = Date.now();
|
|
726
|
-
var currentTime = now - loadingScrimStartTime;
|
|
727
|
-
var totalTime = loadingScrimFinishTime - loadingScrimStartTime;
|
|
728
|
-
var loadingScrimProgress = Math.min(currentTime / totalTime, 1);
|
|
729
|
-
if (loadingScrimFinishTime < now) {
|
|
730
|
-
this.loadingScrimStartTime = undefined;
|
|
731
|
-
this.loadingScrimFinishTime = undefined;
|
|
732
|
-
}
|
|
733
|
-
this.setState(state => {
|
|
734
|
-
if (state.loadingScrimProgress == null) {
|
|
735
|
-
log.debug2('Ignoring scrim update because loading cancelled.');
|
|
736
|
-
return null;
|
|
737
|
-
}
|
|
738
|
-
return {
|
|
739
|
-
loadingScrimProgress
|
|
740
|
-
};
|
|
741
|
-
});
|
|
742
|
-
});
|
|
743
|
-
}
|
|
744
|
-
this.sendStateChange();
|
|
745
|
-
}
|
|
746
|
-
componentWillUnmount() {
|
|
747
|
-
var {
|
|
748
|
-
model
|
|
749
|
-
} = this.props;
|
|
750
|
-
this.stopListening(model);
|
|
751
|
-
this.pending.cancel();
|
|
752
|
-
this.updateSearchFilter.cancel();
|
|
753
|
-
if (this.loadingTimer) {
|
|
754
|
-
clearTimeout(this.loadingTimer);
|
|
755
|
-
}
|
|
756
|
-
this.handleDownloadProgressUpdate.cancel();
|
|
757
|
-
if (this.animationFrame !== undefined) {
|
|
758
|
-
cancelAnimationFrame(this.animationFrame);
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
getValueForCell(columnIndex, rowIndex) {
|
|
762
|
-
var rawValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
763
|
-
var {
|
|
764
|
-
model
|
|
765
|
-
} = this.props;
|
|
766
|
-
var {
|
|
767
|
-
dh
|
|
768
|
-
} = model;
|
|
769
|
-
var modelColumn = this.getModelColumn(columnIndex);
|
|
770
|
-
var modelRow = this.getModelRow(rowIndex);
|
|
771
|
-
if (rawValue && modelColumn != null && modelRow != null) {
|
|
772
|
-
var _value = model.valueForCell(modelColumn, modelRow);
|
|
773
|
-
if (TableUtils.isDateType(model.columns[modelColumn].type)) {
|
|
774
|
-
// The returned value is just a long value, we should return the value formatted as a full date string
|
|
775
|
-
var {
|
|
776
|
-
formatter
|
|
777
|
-
} = model;
|
|
778
|
-
return dh.i18n.DateTimeFormat.format(UNFORMATTED_DATE_PATTERN, _value, dh.i18n.TimeZone.getTimeZone(formatter.timeZone));
|
|
779
|
-
}
|
|
780
|
-
return _value;
|
|
781
|
-
}
|
|
782
|
-
if (rawValue) {
|
|
783
|
-
return null;
|
|
784
|
-
}
|
|
785
|
-
if (modelColumn != null && modelRow != null) {
|
|
786
|
-
return model.textForCell(modelColumn, modelRow);
|
|
787
|
-
}
|
|
788
|
-
return '';
|
|
789
|
-
}
|
|
790
|
-
getModelColumn(columnIndex) {
|
|
791
|
-
var {
|
|
792
|
-
metrics
|
|
793
|
-
} = this.state;
|
|
794
|
-
assertNotNull(metrics);
|
|
795
|
-
var {
|
|
796
|
-
modelColumns
|
|
797
|
-
} = metrics;
|
|
798
|
-
if (modelColumns == null) {
|
|
799
|
-
return null;
|
|
800
|
-
}
|
|
801
|
-
return columnIndex != null ? modelColumns.get(columnIndex) : null;
|
|
802
|
-
}
|
|
803
|
-
getModelRow(rowIndex) {
|
|
804
|
-
var {
|
|
805
|
-
metrics
|
|
806
|
-
} = this.state;
|
|
807
|
-
assertNotNull(metrics);
|
|
808
|
-
var {
|
|
809
|
-
modelRows
|
|
810
|
-
} = metrics;
|
|
811
|
-
if (modelRows == null) {
|
|
812
|
-
return null;
|
|
813
|
-
}
|
|
814
|
-
return rowIndex != null ? modelRows.get(rowIndex) : null;
|
|
815
|
-
}
|
|
816
|
-
getTheme() {
|
|
817
|
-
var _ref4;
|
|
818
|
-
var {
|
|
819
|
-
model,
|
|
820
|
-
theme
|
|
821
|
-
} = this.props;
|
|
822
|
-
return this.getCachedTheme(theme, (_ref4 = isEditableGridModel(model) && model.isEditable) !== null && _ref4 !== void 0 ? _ref4 : false, model.floatingTopRowCount + model.floatingBottomRowCount);
|
|
823
|
-
}
|
|
824
|
-
getVisibleColumn(modelIndex) {
|
|
825
|
-
var {
|
|
826
|
-
movedColumns
|
|
827
|
-
} = this.state;
|
|
828
|
-
return GridUtils.getVisibleIndex(modelIndex, movedColumns);
|
|
829
|
-
}
|
|
830
|
-
makeQuickFilter(column, text, timeZone) {
|
|
831
|
-
try {
|
|
832
|
-
return this.tableUtils.makeQuickFilter(column, text, timeZone);
|
|
833
|
-
} catch (err) {
|
|
834
|
-
log.error('Error creating quick filter', err);
|
|
835
|
-
}
|
|
836
|
-
return null;
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
/**
|
|
840
|
-
* Applies the provided input filters as quick filters,
|
|
841
|
-
* and clears any existing quickFilters or advancedFilters on that column
|
|
842
|
-
* @param inputFilters Array of input filters to apply
|
|
843
|
-
* @param replaceExisting If true, new filters will replace the existing ones, instead of merging
|
|
844
|
-
*/
|
|
845
|
-
applyInputFilters(inputFilters) {
|
|
846
|
-
var replaceExisting = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
847
|
-
var {
|
|
848
|
-
model
|
|
849
|
-
} = this.props;
|
|
850
|
-
var {
|
|
851
|
-
advancedFilters,
|
|
852
|
-
quickFilters
|
|
853
|
-
} = this.state;
|
|
854
|
-
var newAdvancedFilters = replaceExisting ? new Map() : new Map(advancedFilters);
|
|
855
|
-
var newQuickFilters = replaceExisting ? new Map() : new Map(quickFilters);
|
|
856
|
-
var isChanged = replaceExisting && advancedFilters.size > 0;
|
|
857
|
-
inputFilters.forEach(_ref5 => {
|
|
858
|
-
var {
|
|
859
|
-
name,
|
|
860
|
-
type,
|
|
861
|
-
value
|
|
862
|
-
} = _ref5;
|
|
863
|
-
var modelIndex = model.columns.findIndex(_ref6 => {
|
|
864
|
-
var {
|
|
865
|
-
name: columnName,
|
|
866
|
-
type: columnType
|
|
867
|
-
} = _ref6;
|
|
868
|
-
return columnName === name && columnType === type;
|
|
869
|
-
});
|
|
870
|
-
if (modelIndex >= 0) {
|
|
871
|
-
isChanged = newAdvancedFilters.delete(modelIndex) || isChanged;
|
|
872
|
-
isChanged = this.applyQuickFilter(modelIndex, value, newQuickFilters) || isChanged;
|
|
873
|
-
} else {
|
|
874
|
-
log.error('Unable to find column for inputFilter', name, type, value);
|
|
875
|
-
}
|
|
876
|
-
});
|
|
877
|
-
if (isChanged) {
|
|
878
|
-
this.setState({
|
|
879
|
-
quickFilters: newQuickFilters,
|
|
880
|
-
advancedFilters: newAdvancedFilters
|
|
881
|
-
});
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
|
|
885
|
-
/**
|
|
886
|
-
* Applies a quick filter
|
|
887
|
-
* @param modelIndex The index in the model of the column to set
|
|
888
|
-
* @param value The string value to set to the quick filter
|
|
889
|
-
* @param quickFilters The quick filters map
|
|
890
|
-
* @returns True if the filters have changed because this quick filter was applied
|
|
891
|
-
*/
|
|
892
|
-
applyQuickFilter(modelIndex, value, quickFilters) {
|
|
893
|
-
var {
|
|
894
|
-
model
|
|
895
|
-
} = this.props;
|
|
896
|
-
var {
|
|
897
|
-
formatter
|
|
898
|
-
} = model;
|
|
899
|
-
var column = model.columns[modelIndex];
|
|
900
|
-
if (value != null && "".concat(value).trim().length > 0) {
|
|
901
|
-
var quickFilter = quickFilters.get(modelIndex);
|
|
902
|
-
if (quickFilter != null) {
|
|
903
|
-
var {
|
|
904
|
-
text
|
|
905
|
-
} = quickFilter;
|
|
906
|
-
if (text === value) {
|
|
907
|
-
log.debug2('Ignoring change to existing filter');
|
|
908
|
-
return false;
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
quickFilters.set(modelIndex, {
|
|
912
|
-
text: value,
|
|
913
|
-
filter: this.makeQuickFilter(column, value, formatter.timeZone)
|
|
914
|
-
});
|
|
915
|
-
return true;
|
|
916
|
-
}
|
|
917
|
-
return quickFilters.delete(modelIndex);
|
|
918
|
-
}
|
|
919
|
-
setAdvancedFilterMap(advancedFilters) {
|
|
920
|
-
this.setState({
|
|
921
|
-
advancedFilters
|
|
922
|
-
});
|
|
923
|
-
}
|
|
924
|
-
setAdvancedFilter(modelIndex, filter, options) {
|
|
925
|
-
log.debug('Setting advanced filter', modelIndex, filter);
|
|
926
|
-
this.startLoading('Filtering...', true);
|
|
927
|
-
this.setState(_ref7 => {
|
|
928
|
-
var {
|
|
929
|
-
advancedFilters
|
|
930
|
-
} = _ref7;
|
|
931
|
-
var newAdvancedFilters = new Map(advancedFilters);
|
|
932
|
-
if (filter == null) {
|
|
933
|
-
newAdvancedFilters.delete(modelIndex);
|
|
934
|
-
} else {
|
|
935
|
-
newAdvancedFilters.set(modelIndex, {
|
|
936
|
-
filter,
|
|
937
|
-
options
|
|
938
|
-
});
|
|
939
|
-
}
|
|
940
|
-
return {
|
|
941
|
-
advancedFilters: newAdvancedFilters
|
|
942
|
-
};
|
|
943
|
-
});
|
|
944
|
-
}
|
|
945
|
-
|
|
946
|
-
/**
|
|
947
|
-
* Sets a quick filter against the provided column
|
|
948
|
-
* @param modelIndex The index in the model for the column this filter is applied to
|
|
949
|
-
* @param filter A filter to apply to the column, or null if there was an error
|
|
950
|
-
* @param text The original text the filter was created with
|
|
951
|
-
*/
|
|
952
|
-
setQuickFilter(modelIndex, filter, text) {
|
|
953
|
-
log.debug('Setting quick filter', modelIndex, filter, text);
|
|
954
|
-
this.startLoading('Filtering...', true);
|
|
955
|
-
this.setState(_ref8 => {
|
|
956
|
-
var {
|
|
957
|
-
quickFilters
|
|
958
|
-
} = _ref8;
|
|
959
|
-
var newQuickFilters = new Map(quickFilters);
|
|
960
|
-
newQuickFilters.set(modelIndex, {
|
|
961
|
-
filter,
|
|
962
|
-
text
|
|
963
|
-
});
|
|
964
|
-
return {
|
|
965
|
-
quickFilters: newQuickFilters
|
|
966
|
-
};
|
|
967
|
-
});
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
/**
|
|
971
|
-
* Set grid filters based on the filter map
|
|
972
|
-
* @param filterMap Filter map
|
|
973
|
-
*/
|
|
974
|
-
setFilterMap(filterMap) {
|
|
975
|
-
var _advancedSettings$get2;
|
|
976
|
-
log.debug('setFilterMap', filterMap);
|
|
977
|
-
var {
|
|
978
|
-
advancedSettings
|
|
979
|
-
} = this.props;
|
|
980
|
-
var clearFiltersOnLinkerFilterUpdate = (_advancedSettings$get2 = advancedSettings.get(AdvancedSettingsType.LINK_CHANGE_CLEARS_ALL_FILTERS)) !== null && _advancedSettings$get2 !== void 0 ? _advancedSettings$get2 : false;
|
|
981
|
-
if (clearFiltersOnLinkerFilterUpdate) {
|
|
982
|
-
this.clearAllFilters();
|
|
983
|
-
}
|
|
984
|
-
var {
|
|
985
|
-
model
|
|
986
|
-
} = this.props;
|
|
987
|
-
filterMap.forEach((_ref9, columnName) => {
|
|
988
|
-
var {
|
|
989
|
-
columnType,
|
|
990
|
-
filterList
|
|
991
|
-
} = _ref9;
|
|
992
|
-
var column = model.columns.find(c => c.name === columnName && c.type === columnType);
|
|
993
|
-
if (column == null) {
|
|
994
|
-
return;
|
|
995
|
-
}
|
|
996
|
-
var columnIndex = model.getColumnIndexByName(column.name);
|
|
997
|
-
assertNotNull(columnIndex);
|
|
998
|
-
var combinedText = IrisGridUtils.combineFiltersFromList(columnType, filterList);
|
|
999
|
-
if (combinedText.length === 0) {
|
|
1000
|
-
this.removeQuickFilter(columnIndex);
|
|
1001
|
-
} else {
|
|
1002
|
-
var {
|
|
1003
|
-
formatter
|
|
1004
|
-
} = model;
|
|
1005
|
-
this.setQuickFilter(columnIndex, this.makeQuickFilter(column, combinedText, formatter.timeZone), "".concat(combinedText));
|
|
1006
|
-
}
|
|
1007
|
-
});
|
|
1008
|
-
}
|
|
1009
|
-
removeColumnFilter(modelColumn) {
|
|
1010
|
-
this.startLoading('Filtering...', true);
|
|
1011
|
-
this.setState(_ref10 => {
|
|
1012
|
-
var {
|
|
1013
|
-
advancedFilters,
|
|
1014
|
-
quickFilters
|
|
1015
|
-
} = _ref10;
|
|
1016
|
-
var newAdvancedFilters = advancedFilters ? new Map(advancedFilters) : new Map();
|
|
1017
|
-
var newQuickFilters = quickFilters ? new Map(quickFilters) : new Map();
|
|
1018
|
-
newQuickFilters.delete(modelColumn);
|
|
1019
|
-
newAdvancedFilters.delete(modelColumn);
|
|
1020
|
-
return {
|
|
1021
|
-
quickFilters: newQuickFilters,
|
|
1022
|
-
advancedFilters: newAdvancedFilters
|
|
1023
|
-
};
|
|
1024
|
-
});
|
|
1025
|
-
}
|
|
1026
|
-
removeQuickFilter(modelColumn) {
|
|
1027
|
-
this.startLoading('Clearing Filter...', true);
|
|
1028
|
-
this.setState(_ref11 => {
|
|
1029
|
-
var {
|
|
1030
|
-
quickFilters
|
|
1031
|
-
} = _ref11;
|
|
1032
|
-
var newQuickFilters = new Map(quickFilters);
|
|
1033
|
-
newQuickFilters.delete(modelColumn);
|
|
1034
|
-
return {
|
|
1035
|
-
quickFilters: newQuickFilters
|
|
1036
|
-
};
|
|
1037
|
-
});
|
|
1038
|
-
}
|
|
1039
|
-
clearAllFilters() {
|
|
1040
|
-
log.debug('Clearing all filters');
|
|
1041
|
-
var {
|
|
1042
|
-
advancedFilters,
|
|
1043
|
-
quickFilters,
|
|
1044
|
-
searchFilter
|
|
1045
|
-
} = this.state;
|
|
1046
|
-
if (quickFilters.size === 0 && advancedFilters.size === 0 && searchFilter === null) {
|
|
1047
|
-
return;
|
|
1048
|
-
}
|
|
1049
|
-
|
|
1050
|
-
// if there is an active quick filter input field, reset it as well
|
|
1051
|
-
this.clearGridInputField();
|
|
1052
|
-
this.startLoading('Clearing Filters...', true);
|
|
1053
|
-
this.setState({
|
|
1054
|
-
quickFilters: new Map(),
|
|
1055
|
-
advancedFilters: new Map(),
|
|
1056
|
-
searchValue: '',
|
|
1057
|
-
searchFilter: undefined
|
|
1058
|
-
});
|
|
1059
|
-
}
|
|
1060
|
-
clearCrossColumSearch() {
|
|
1061
|
-
log.debug('Clearing cross-column search');
|
|
1062
|
-
this.setState({
|
|
1063
|
-
searchValue: '',
|
|
1064
|
-
searchFilter: undefined
|
|
1065
|
-
});
|
|
1066
|
-
}
|
|
1067
|
-
clearGridInputField() {
|
|
1068
|
-
if (this.filterInputRef.current != null) {
|
|
1069
|
-
this.filterInputRef.current.setValue('');
|
|
1070
|
-
}
|
|
1071
|
-
}
|
|
1072
|
-
|
|
1073
|
-
/**
|
|
1074
|
-
* Rebuilds all the current filters. Necessary if something like the time zone has changed.
|
|
1075
|
-
*/
|
|
1076
|
-
rebuildFilters() {
|
|
1077
|
-
log.debug('Rebuilding filters');
|
|
1078
|
-
var {
|
|
1079
|
-
model
|
|
1080
|
-
} = this.props;
|
|
1081
|
-
var {
|
|
1082
|
-
advancedFilters,
|
|
1083
|
-
quickFilters
|
|
1084
|
-
} = this.state;
|
|
1085
|
-
var {
|
|
1086
|
-
columns,
|
|
1087
|
-
formatter
|
|
1088
|
-
} = model;
|
|
1089
|
-
var newAdvancedFilters = new Map();
|
|
1090
|
-
var newQuickFilters = new Map();
|
|
1091
|
-
advancedFilters.forEach((value, key) => {
|
|
1092
|
-
var {
|
|
1093
|
-
options
|
|
1094
|
-
} = value;
|
|
1095
|
-
var column = columns[key];
|
|
1096
|
-
var filter = this.tableUtils.makeAdvancedFilter(column, options, formatter.timeZone);
|
|
1097
|
-
newAdvancedFilters.set(key, {
|
|
1098
|
-
options,
|
|
1099
|
-
filter
|
|
1100
|
-
});
|
|
1101
|
-
});
|
|
1102
|
-
quickFilters.forEach((value, key) => {
|
|
1103
|
-
var {
|
|
1104
|
-
text
|
|
1105
|
-
} = value;
|
|
1106
|
-
var column = columns[key];
|
|
1107
|
-
newQuickFilters.set(key, {
|
|
1108
|
-
text,
|
|
1109
|
-
filter: this.makeQuickFilter(column, text, formatter.timeZone)
|
|
1110
|
-
});
|
|
1111
|
-
});
|
|
1112
|
-
this.startLoading('Rebuilding filters...', true);
|
|
1113
|
-
this.setState({
|
|
1114
|
-
quickFilters: newQuickFilters,
|
|
1115
|
-
advancedFilters: newAdvancedFilters
|
|
1116
|
-
});
|
|
1117
|
-
}
|
|
1118
|
-
setFilters(_ref12) {
|
|
1119
|
-
var {
|
|
1120
|
-
quickFilters,
|
|
1121
|
-
advancedFilters
|
|
1122
|
-
} = _ref12;
|
|
1123
|
-
this.setState({
|
|
1124
|
-
quickFilters,
|
|
1125
|
-
advancedFilters
|
|
1126
|
-
});
|
|
1127
|
-
}
|
|
1128
|
-
updateFormatterSettings(settings) {
|
|
1129
|
-
var _settings$defaultDeci, _settings$defaultInte, _settings$truncateNum;
|
|
1130
|
-
var forceUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
1131
|
-
var globalColumnFormats = FormatterUtils.getColumnFormats(settings);
|
|
1132
|
-
var dateTimeFormatterOptions = FormatterUtils.getDateTimeFormatterOptions(settings);
|
|
1133
|
-
var defaultDecimalFormatOptions = (_settings$defaultDeci = settings === null || settings === void 0 ? void 0 : settings.defaultDecimalFormatOptions) !== null && _settings$defaultDeci !== void 0 ? _settings$defaultDeci : {};
|
|
1134
|
-
var defaultIntegerFormatOptions = (_settings$defaultInte = settings === null || settings === void 0 ? void 0 : settings.defaultIntegerFormatOptions) !== null && _settings$defaultInte !== void 0 ? _settings$defaultInte : {};
|
|
1135
|
-
var truncateNumbersWithPound = (_settings$truncateNum = settings === null || settings === void 0 ? void 0 : settings.truncateNumbersWithPound) !== null && _settings$truncateNum !== void 0 ? _settings$truncateNum : false;
|
|
1136
|
-
var isColumnFormatChanged = !deepEqual(this.globalColumnFormats, globalColumnFormats);
|
|
1137
|
-
var isDateFormattingChanged = !deepEqual(this.dateTimeFormatterOptions, dateTimeFormatterOptions);
|
|
1138
|
-
var isDecimalFormattingChanged = !deepEqual(this.decimalFormatOptions, settings === null || settings === void 0 ? void 0 : settings.defaultDecimalFormatOptions);
|
|
1139
|
-
var isIntegerFormattingChanged = !deepEqual(this.integerFormatOptions, defaultIntegerFormatOptions);
|
|
1140
|
-
var isTruncateNumbersChanged = this.truncateNumbersWithPound !== truncateNumbersWithPound;
|
|
1141
|
-
if (isColumnFormatChanged || isDateFormattingChanged || isDecimalFormattingChanged || isIntegerFormattingChanged || isTruncateNumbersChanged) {
|
|
1142
|
-
this.globalColumnFormats = globalColumnFormats;
|
|
1143
|
-
this.dateTimeFormatterOptions = dateTimeFormatterOptions;
|
|
1144
|
-
this.decimalFormatOptions = defaultDecimalFormatOptions;
|
|
1145
|
-
this.integerFormatOptions = defaultIntegerFormatOptions;
|
|
1146
|
-
this.truncateNumbersWithPound = truncateNumbersWithPound;
|
|
1147
|
-
this.updateFormatter({}, forceUpdate);
|
|
1148
|
-
if (isDateFormattingChanged && forceUpdate) {
|
|
1149
|
-
this.rebuildFilters();
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
}
|
|
1153
|
-
updateFormatter(updatedFormats) {
|
|
1154
|
-
var _this$globalColumnFor;
|
|
1155
|
-
var forceUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
1156
|
-
var {
|
|
1157
|
-
customColumnFormatMap
|
|
1158
|
-
} = this.state;
|
|
1159
|
-
var {
|
|
1160
|
-
model
|
|
1161
|
-
} = this.props;
|
|
1162
|
-
var update = _objectSpread({
|
|
1163
|
-
customColumnFormatMap
|
|
1164
|
-
}, updatedFormats);
|
|
1165
|
-
var mergedColumnFormats = [...((_this$globalColumnFor = this.globalColumnFormats) !== null && _this$globalColumnFor !== void 0 ? _this$globalColumnFor : []), ...update.customColumnFormatMap.values()];
|
|
1166
|
-
var formatter = new Formatter(model.dh, mergedColumnFormats, this.dateTimeFormatterOptions, this.decimalFormatOptions, this.integerFormatOptions, this.truncateNumbersWithPound);
|
|
1167
|
-
log.debug('updateFormatter', this.globalColumnFormats, mergedColumnFormats);
|
|
1168
|
-
this.setState(_objectSpread(_objectSpread({}, update), {}, {
|
|
1169
|
-
formatter
|
|
1170
|
-
}), () => {
|
|
1171
|
-
if (forceUpdate && this.grid) {
|
|
1172
|
-
this.grid.forceUpdate();
|
|
1173
|
-
}
|
|
1174
|
-
});
|
|
1175
|
-
}
|
|
1176
|
-
initFormatter() {
|
|
1177
|
-
var {
|
|
1178
|
-
settings
|
|
1179
|
-
} = this.props;
|
|
1180
|
-
this.updateFormatterSettings(settings);
|
|
1181
|
-
}
|
|
1182
|
-
initState() {
|
|
1183
|
-
var {
|
|
1184
|
-
applyInputFiltersOnInit,
|
|
1185
|
-
inputFilters,
|
|
1186
|
-
sorts,
|
|
1187
|
-
model,
|
|
1188
|
-
reverseType,
|
|
1189
|
-
customColumns,
|
|
1190
|
-
searchValue,
|
|
1191
|
-
selectedSearchColumns,
|
|
1192
|
-
invertSearchColumns
|
|
1193
|
-
} = this.props;
|
|
1194
|
-
var searchColumns = selectedSearchColumns !== null && selectedSearchColumns !== void 0 ? selectedSearchColumns : [];
|
|
1195
|
-
var searchFilter = CrossColumnSearch.createSearchFilter(model.dh, searchValue, searchColumns, model.columns, invertSearchColumns);
|
|
1196
|
-
if (applyInputFiltersOnInit) {
|
|
1197
|
-
// There may be more than one input filter on the same column with value === '' applied last
|
|
1198
|
-
// We don't want to skip it here, so only excluding the ones that were never applied (null)
|
|
1199
|
-
var inputFiltersWithValues = inputFilters.filter(inputFilter => inputFilter.value != null);
|
|
1200
|
-
this.applyInputFilters(inputFiltersWithValues);
|
|
1201
|
-
}
|
|
1202
|
-
this.setState({
|
|
1203
|
-
sorts,
|
|
1204
|
-
reverseType,
|
|
1205
|
-
customColumns,
|
|
1206
|
-
isReady: true,
|
|
1207
|
-
searchFilter
|
|
1208
|
-
});
|
|
1209
|
-
this.initFormatter();
|
|
1210
|
-
}
|
|
1211
|
-
loadPartitionsTable(partitionColumn) {
|
|
1212
|
-
var _this = this;
|
|
1213
|
-
return _asyncToGenerator(function* () {
|
|
1214
|
-
var {
|
|
1215
|
-
model
|
|
1216
|
-
} = _this.props;
|
|
1217
|
-
_this.setState({
|
|
1218
|
-
isSelectingPartition: true
|
|
1219
|
-
});
|
|
1220
|
-
try {
|
|
1221
|
-
var partitionTable = yield _this.pending.add(model.valuesTable(partitionColumn), resolved => resolved.close());
|
|
1222
|
-
var _column = partitionTable.columns[0];
|
|
1223
|
-
var sort = _column.sort().desc();
|
|
1224
|
-
partitionTable.applySort([sort]);
|
|
1225
|
-
partitionTable.setViewport(0, 0, [_column]);
|
|
1226
|
-
var data = yield _this.pending.add(partitionTable.getViewportData());
|
|
1227
|
-
if (data.rows.length > 0) {
|
|
1228
|
-
var row = data.rows[0];
|
|
1229
|
-
var _value2 = row.get(_column);
|
|
1230
|
-
_this.updatePartition(_value2, partitionColumn);
|
|
1231
|
-
_this.setState({
|
|
1232
|
-
isSelectingPartition: true
|
|
1233
|
-
});
|
|
1234
|
-
} else {
|
|
1235
|
-
log.info('Table does not have any data, just fetching all');
|
|
1236
|
-
_this.setState({
|
|
1237
|
-
isSelectingPartition: false
|
|
1238
|
-
});
|
|
1239
|
-
_this.handlePartitionFetchAll();
|
|
1240
|
-
}
|
|
1241
|
-
_this.setState({
|
|
1242
|
-
partitionTable,
|
|
1243
|
-
partitionColumn
|
|
1244
|
-
}, () => {
|
|
1245
|
-
_this.initState();
|
|
1246
|
-
});
|
|
1247
|
-
} catch (error) {
|
|
1248
|
-
_this.handleTableLoadError(error);
|
|
1249
|
-
}
|
|
1250
|
-
})();
|
|
1251
|
-
}
|
|
1252
|
-
updatePartition(partition, partitionColumn) {
|
|
1253
|
-
var {
|
|
1254
|
-
model
|
|
1255
|
-
} = this.props;
|
|
1256
|
-
var partitionFilter = partitionColumn.filter().eq(model.dh.FilterValue.ofString(partition));
|
|
1257
|
-
var partitionFilters = [partitionFilter];
|
|
1258
|
-
this.setState({
|
|
1259
|
-
partition,
|
|
1260
|
-
partitionFilters
|
|
1261
|
-
});
|
|
1262
|
-
}
|
|
1263
|
-
copyCell(columnIndex, rowIndex) {
|
|
1264
|
-
var rawValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
1265
|
-
var {
|
|
1266
|
-
canCopy
|
|
1267
|
-
} = this.props;
|
|
1268
|
-
if (canCopy) {
|
|
1269
|
-
var _value3 = String(this.getValueForCell(columnIndex, rowIndex, rawValue));
|
|
1270
|
-
copyToClipboard(_value3).catch(e => log.error('Unable to copy cell', e));
|
|
1271
|
-
} else {
|
|
1272
|
-
log.error('Attempted to copyCell for user without copy permission.');
|
|
1273
|
-
}
|
|
1274
|
-
}
|
|
1275
|
-
|
|
1276
|
-
/**
|
|
1277
|
-
* Copy the provided ranges to the clipboard
|
|
1278
|
-
* @paramranges The ranges to copy
|
|
1279
|
-
* @param includeHeaders Include the headers or not
|
|
1280
|
-
* @param formatValues Whether to format values or not
|
|
1281
|
-
* @param error Error message if one occurred
|
|
1282
|
-
*/
|
|
1283
|
-
copyRanges(ranges) {
|
|
1284
|
-
var includeHeaders = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1285
|
-
var formatValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
1286
|
-
var error = arguments.length > 3 ? arguments[3] : undefined;
|
|
1287
|
-
var {
|
|
1288
|
-
model,
|
|
1289
|
-
canCopy
|
|
1290
|
-
} = this.props;
|
|
1291
|
-
var {
|
|
1292
|
-
metricCalculator,
|
|
1293
|
-
movedColumns
|
|
1294
|
-
} = this.state;
|
|
1295
|
-
var userColumnWidths = metricCalculator.getUserColumnWidths();
|
|
1296
|
-
if (canCopy) {
|
|
1297
|
-
var copyOperation = {
|
|
1298
|
-
ranges: GridRange.boundedRanges(ranges, model.columnCount, model.rowCount),
|
|
1299
|
-
includeHeaders,
|
|
1300
|
-
formatValues,
|
|
1301
|
-
movedColumns,
|
|
1302
|
-
userColumnWidths,
|
|
1303
|
-
error
|
|
1304
|
-
};
|
|
1305
|
-
this.setState({
|
|
1306
|
-
copyOperation
|
|
1307
|
-
});
|
|
1308
|
-
} else {
|
|
1309
|
-
log.error('Attempted copyRanges for user without copy permission.');
|
|
1310
|
-
}
|
|
1311
|
-
}
|
|
1312
|
-
startLoading(loadingText) {
|
|
1313
|
-
var resetRanges = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1314
|
-
this.setState({
|
|
1315
|
-
loadingText
|
|
1316
|
-
});
|
|
1317
|
-
var theme = this.getTheme();
|
|
1318
|
-
if (resetRanges && this.grid) {
|
|
1319
|
-
this.grid.clearSelectedRanges();
|
|
1320
|
-
this.grid.setViewState({
|
|
1321
|
-
top: 0
|
|
1322
|
-
}, true);
|
|
1323
|
-
}
|
|
1324
|
-
if (this.loadingScrimStartTime == null) {
|
|
1325
|
-
var _this$gridWrapper$get, _this$gridWrapper;
|
|
1326
|
-
var {
|
|
1327
|
-
minScrimTransitionTime,
|
|
1328
|
-
maxScrimTransitionTime
|
|
1329
|
-
} = theme;
|
|
1330
|
-
assertNotNull(minScrimTransitionTime);
|
|
1331
|
-
assertNotNull(maxScrimTransitionTime);
|
|
1332
|
-
var height = (_this$gridWrapper$get = (_this$gridWrapper = this.gridWrapper) === null || _this$gridWrapper === void 0 ? void 0 : _this$gridWrapper.getBoundingClientRect().height) !== null && _this$gridWrapper$get !== void 0 ? _this$gridWrapper$get : 0;
|
|
1333
|
-
var scrimTransitionTime = Math.max(minScrimTransitionTime, Math.min(height / 2, maxScrimTransitionTime));
|
|
1334
|
-
this.loadingScrimStartTime = Date.now();
|
|
1335
|
-
this.loadingScrimFinishTime = this.loadingScrimStartTime + scrimTransitionTime;
|
|
1336
|
-
this.setState({
|
|
1337
|
-
loadingScrimProgress: 0
|
|
1338
|
-
});
|
|
1339
|
-
this.loadingTimer = setTimeout(() => {
|
|
1340
|
-
this.setState({
|
|
1341
|
-
loadingSpinnerShown: true
|
|
1342
|
-
});
|
|
1343
|
-
}, IrisGrid.loadingSpinnerDelay);
|
|
1344
|
-
}
|
|
1345
|
-
}
|
|
1346
|
-
stopLoading() {
|
|
1347
|
-
this.loadingScrimStartTime = undefined;
|
|
1348
|
-
this.loadingScrimFinishTime = undefined;
|
|
1349
|
-
this.setState({
|
|
1350
|
-
loadingText: null,
|
|
1351
|
-
loadingScrimProgress: null,
|
|
1352
|
-
loadingSpinnerShown: false
|
|
1353
|
-
});
|
|
1354
|
-
if (this.loadingTimer != null) {
|
|
1355
|
-
clearTimeout(this.loadingTimer);
|
|
1356
|
-
this.loadingTimer = undefined;
|
|
1357
|
-
}
|
|
1358
|
-
}
|
|
1359
|
-
|
|
1360
|
-
/**
|
|
1361
|
-
* Rolls back the table state to the last known safe state, or if that's not available then clears all sorts/filters/custom columns.
|
|
1362
|
-
*/
|
|
1363
|
-
rollback() {
|
|
1364
|
-
if (this.lastLoadedConfig) {
|
|
1365
|
-
log.debug('loading last loading config', this.lastLoadedConfig);
|
|
1366
|
-
var {
|
|
1367
|
-
advancedFilters,
|
|
1368
|
-
aggregationSettings,
|
|
1369
|
-
customColumns,
|
|
1370
|
-
quickFilters,
|
|
1371
|
-
reverseType,
|
|
1372
|
-
rollupConfig,
|
|
1373
|
-
searchFilter,
|
|
1374
|
-
selectDistinctColumns,
|
|
1375
|
-
sorts
|
|
1376
|
-
} = this.lastLoadedConfig;
|
|
1377
|
-
this.lastLoadedConfig = null;
|
|
1378
|
-
this.setState({
|
|
1379
|
-
advancedFilters,
|
|
1380
|
-
aggregationSettings,
|
|
1381
|
-
customColumns,
|
|
1382
|
-
quickFilters,
|
|
1383
|
-
reverseType,
|
|
1384
|
-
rollupConfig,
|
|
1385
|
-
searchFilter,
|
|
1386
|
-
selectDistinctColumns,
|
|
1387
|
-
sorts
|
|
1388
|
-
});
|
|
1389
|
-
} else {
|
|
1390
|
-
log.debug('remove all sorts, filters, and custom columns');
|
|
1391
|
-
this.setState({
|
|
1392
|
-
advancedFilters: new Map(),
|
|
1393
|
-
aggregationSettings: DEFAULT_AGGREGATION_SETTINGS,
|
|
1394
|
-
customColumns: [],
|
|
1395
|
-
quickFilters: new Map(),
|
|
1396
|
-
reverseType: TableUtils.REVERSE_TYPE.NONE,
|
|
1397
|
-
rollupConfig: undefined,
|
|
1398
|
-
selectDistinctColumns: [],
|
|
1399
|
-
sorts: []
|
|
1400
|
-
});
|
|
1401
|
-
}
|
|
1402
|
-
}
|
|
1403
|
-
|
|
1404
|
-
/**
|
|
1405
|
-
* Check if we can rollback the current state to a safe state.
|
|
1406
|
-
* @returns true if there's a previously known safe state or if some of the current state isn't empty.
|
|
1407
|
-
*/
|
|
1408
|
-
canRollback() {
|
|
1409
|
-
return this.lastLoadedConfig != null || !isEmptyConfig(this.state);
|
|
1410
|
-
}
|
|
1411
|
-
startListening(model) {
|
|
1412
|
-
model.addEventListener(IrisGridModel.EVENT.UPDATED, this.handleUpdate);
|
|
1413
|
-
model.addEventListener(IrisGridModel.EVENT.REQUEST_FAILED, this.handleRequestFailed);
|
|
1414
|
-
model.addEventListener(IrisGridModel.EVENT.COLUMNS_CHANGED, this.handleCustomColumnsChanged);
|
|
1415
|
-
model.addEventListener(IrisGridModel.EVENT.PENDING_DATA_UPDATED, this.handlePendingDataUpdated);
|
|
1416
|
-
}
|
|
1417
|
-
stopListening(model) {
|
|
1418
|
-
model.removeEventListener(IrisGridModel.EVENT.UPDATED, this.handleUpdate);
|
|
1419
|
-
model.removeEventListener(IrisGridModel.EVENT.REQUEST_FAILED, this.handleRequestFailed);
|
|
1420
|
-
model.removeEventListener(IrisGridModel.EVENT.COLUMNS_CHANGED, this.handleCustomColumnsChanged);
|
|
1421
|
-
model.removeEventListener(IrisGridModel.EVENT.PENDING_DATA_UPDATED, this.handlePendingDataUpdated);
|
|
1422
|
-
}
|
|
1423
|
-
focus() {
|
|
1424
|
-
var _this$grid;
|
|
1425
|
-
(_this$grid = this.grid) === null || _this$grid === void 0 ? void 0 : _this$grid.focus();
|
|
1426
|
-
}
|
|
1427
|
-
focusFilterBar(column) {
|
|
1428
|
-
var {
|
|
1429
|
-
movedColumns
|
|
1430
|
-
} = this.state;
|
|
1431
|
-
var {
|
|
1432
|
-
model
|
|
1433
|
-
} = this.props;
|
|
1434
|
-
var {
|
|
1435
|
-
columnCount
|
|
1436
|
-
} = model;
|
|
1437
|
-
var modelColumn = GridUtils.getModelIndex(column, movedColumns);
|
|
1438
|
-
if (column == null || column < 0 || columnCount <= column || !model.isFilterable(modelColumn)) {
|
|
1439
|
-
this.setState({
|
|
1440
|
-
focusedFilterBarColumn: null
|
|
1441
|
-
});
|
|
1442
|
-
return;
|
|
1443
|
-
}
|
|
1444
|
-
var {
|
|
1445
|
-
metricCalculator,
|
|
1446
|
-
metrics
|
|
1447
|
-
} = this.state;
|
|
1448
|
-
assertNotNull(metrics);
|
|
1449
|
-
var {
|
|
1450
|
-
left,
|
|
1451
|
-
rightVisible,
|
|
1452
|
-
lastLeft
|
|
1453
|
-
} = metrics;
|
|
1454
|
-
if (column < left) {
|
|
1455
|
-
var _this$grid2;
|
|
1456
|
-
(_this$grid2 = this.grid) === null || _this$grid2 === void 0 ? void 0 : _this$grid2.setViewState({
|
|
1457
|
-
left: column
|
|
1458
|
-
}, true);
|
|
1459
|
-
} else if (rightVisible < column) {
|
|
1460
|
-
var _this$grid3, _this$grid4;
|
|
1461
|
-
var metricState = (_this$grid3 = this.grid) === null || _this$grid3 === void 0 ? void 0 : _this$grid3.getMetricState();
|
|
1462
|
-
assertNotNull(metricState);
|
|
1463
|
-
var newLeft = metricCalculator.getLastLeft(metricState, column, metricCalculator.getVisibleWidth(metricState));
|
|
1464
|
-
(_this$grid4 = this.grid) === null || _this$grid4 === void 0 ? void 0 : _this$grid4.setViewState({
|
|
1465
|
-
left: Math.min(newLeft, lastLeft),
|
|
1466
|
-
leftOffset: 0
|
|
1467
|
-
}, true);
|
|
1468
|
-
}
|
|
1469
|
-
this.lastFocusedFilterBarColumn = column;
|
|
1470
|
-
this.setState({
|
|
1471
|
-
focusedFilterBarColumn: column,
|
|
1472
|
-
isFilterBarShown: true
|
|
1473
|
-
});
|
|
1474
|
-
}
|
|
1475
|
-
hideColumnByVisibleIndex(columnVisibleIndex) {
|
|
1476
|
-
var _this$grid5;
|
|
1477
|
-
var {
|
|
1478
|
-
metricCalculator,
|
|
1479
|
-
movedColumns
|
|
1480
|
-
} = this.state;
|
|
1481
|
-
metricCalculator.setColumnWidth(GridUtils.getModelIndex(columnVisibleIndex, movedColumns), 0);
|
|
1482
|
-
(_this$grid5 = this.grid) === null || _this$grid5 === void 0 ? void 0 : _this$grid5.forceUpdate();
|
|
1483
|
-
}
|
|
1484
|
-
freezeColumnByColumnName(columnName) {
|
|
1485
|
-
var {
|
|
1486
|
-
frozenColumns,
|
|
1487
|
-
movedColumns
|
|
1488
|
-
} = this.state;
|
|
1489
|
-
var {
|
|
1490
|
-
model
|
|
1491
|
-
} = this.props;
|
|
1492
|
-
log.debug2('freezing column', columnName);
|
|
1493
|
-
var allFrozenColumns = frozenColumns == null ? new Set(model.frozenColumns) : new Set(frozenColumns);
|
|
1494
|
-
allFrozenColumns.add(columnName);
|
|
1495
|
-
var modelIndex = model.getColumnIndexByName(columnName);
|
|
1496
|
-
assertNotNull(modelIndex);
|
|
1497
|
-
var visibleIndex = GridUtils.getVisibleIndex(modelIndex, movedColumns);
|
|
1498
|
-
var newMovedColumns = GridUtils.moveItem(visibleIndex, allFrozenColumns.size - 1, movedColumns);
|
|
1499
|
-
this.setState({
|
|
1500
|
-
frozenColumns: [...allFrozenColumns],
|
|
1501
|
-
movedColumns: newMovedColumns
|
|
1502
|
-
});
|
|
1503
|
-
}
|
|
1504
|
-
unFreezeColumnByColumnName(columnName) {
|
|
1505
|
-
var {
|
|
1506
|
-
frozenColumns,
|
|
1507
|
-
movedColumns
|
|
1508
|
-
} = this.state;
|
|
1509
|
-
var {
|
|
1510
|
-
model
|
|
1511
|
-
} = this.props;
|
|
1512
|
-
log.debug2('unfreezing column', columnName);
|
|
1513
|
-
var allFrozenColumns = frozenColumns == null ? new Set(model.frozenColumns) : new Set(frozenColumns);
|
|
1514
|
-
allFrozenColumns.delete(columnName);
|
|
1515
|
-
var modelIndex = model.getColumnIndexByName(columnName);
|
|
1516
|
-
assertNotNull(modelIndex);
|
|
1517
|
-
var visibleIndex = GridUtils.getVisibleIndex(modelIndex, movedColumns);
|
|
1518
|
-
|
|
1519
|
-
// Move to after remaining frozen columns and front columns
|
|
1520
|
-
var newMovedColumns = GridUtils.moveItem(visibleIndex, allFrozenColumns.size + model.frontColumns.length, movedColumns);
|
|
1521
|
-
this.setState({
|
|
1522
|
-
frozenColumns: [...allFrozenColumns],
|
|
1523
|
-
movedColumns: newMovedColumns
|
|
1524
|
-
});
|
|
1525
|
-
}
|
|
1526
|
-
handleColumnVisibilityChanged(modelIndexes, isVisible) {
|
|
1527
|
-
var _this$grid6;
|
|
1528
|
-
var {
|
|
1529
|
-
metricCalculator,
|
|
1530
|
-
metrics
|
|
1531
|
-
} = this.state;
|
|
1532
|
-
assertNotNull(metrics);
|
|
1533
|
-
if (isVisible) {
|
|
1534
|
-
modelIndexes.forEach(modelIndex => {
|
|
1535
|
-
var defaultWidth = metricCalculator.initialColumnWidths.get(modelIndex);
|
|
1536
|
-
var calculatedWidth = getOrThrow(metrics.calculatedColumnWidths, modelIndex);
|
|
1537
|
-
if (defaultWidth !== calculatedWidth) {
|
|
1538
|
-
metricCalculator.setColumnWidth(modelIndex, calculatedWidth);
|
|
1539
|
-
} else {
|
|
1540
|
-
metricCalculator.resetColumnWidth(modelIndex);
|
|
1541
|
-
}
|
|
1542
|
-
});
|
|
1543
|
-
} else {
|
|
1544
|
-
modelIndexes.forEach(modelIndex => {
|
|
1545
|
-
metricCalculator.setColumnWidth(modelIndex, 0);
|
|
1546
|
-
});
|
|
1547
|
-
}
|
|
1548
|
-
(_this$grid6 = this.grid) === null || _this$grid6 === void 0 ? void 0 : _this$grid6.forceUpdate();
|
|
1549
|
-
}
|
|
1550
|
-
handleColumnVisibilityReset() {
|
|
1551
|
-
var _model$layoutHints$fr, _model$layoutHints2;
|
|
1552
|
-
var {
|
|
1553
|
-
metricCalculator,
|
|
1554
|
-
metrics
|
|
1555
|
-
} = this.state;
|
|
1556
|
-
var {
|
|
1557
|
-
model
|
|
1558
|
-
} = this.props;
|
|
1559
|
-
assertNotNull(metrics);
|
|
1560
|
-
for (var i = 0; i < metrics.columnCount; i += 1) {
|
|
1561
|
-
metricCalculator.resetColumnWidth(i);
|
|
1562
|
-
}
|
|
1563
|
-
this.handleMovedColumnsChanged(model.initialMovedColumns);
|
|
1564
|
-
this.handleHeaderGroupsChanged(model.initialColumnHeaderGroups);
|
|
1565
|
-
this.setState({
|
|
1566
|
-
frozenColumns: (_model$layoutHints$fr = (_model$layoutHints2 = model.layoutHints) === null || _model$layoutHints2 === void 0 ? void 0 : _model$layoutHints2.frozenColumns) !== null && _model$layoutHints$fr !== void 0 ? _model$layoutHints$fr : []
|
|
1567
|
-
});
|
|
1568
|
-
}
|
|
1569
|
-
handleCrossColumnSearch(searchValue, selectedSearchColumns, invertSearchColumns) {
|
|
1570
|
-
var {
|
|
1571
|
-
model
|
|
1572
|
-
} = this.props;
|
|
1573
|
-
this.startLoading('Searching...');
|
|
1574
|
-
this.updateSearchFilter(searchValue, selectedSearchColumns, model.columns, invertSearchColumns);
|
|
1575
|
-
this.setState({
|
|
1576
|
-
searchValue,
|
|
1577
|
-
selectedSearchColumns,
|
|
1578
|
-
invertSearchColumns
|
|
1579
|
-
});
|
|
1580
|
-
}
|
|
1581
|
-
handleAnimationLoop() {
|
|
1582
|
-
var _this$grid7;
|
|
1583
|
-
(_this$grid7 = this.grid) === null || _this$grid7 === void 0 ? void 0 : _this$grid7.updateCanvas();
|
|
1584
|
-
if (this.isAnimating) {
|
|
1585
|
-
this.animationFrame = requestAnimationFrame(this.handleAnimationLoop);
|
|
1586
|
-
}
|
|
1587
|
-
}
|
|
1588
|
-
handleAnimationStart() {
|
|
1589
|
-
log.debug2('handleAnimationStart');
|
|
1590
|
-
this.isAnimating = true;
|
|
1591
|
-
this.animationFrame = requestAnimationFrame(this.handleAnimationLoop);
|
|
1592
|
-
}
|
|
1593
|
-
handleAnimationEnd() {
|
|
1594
|
-
log.debug2('handleAnimationEnd');
|
|
1595
|
-
this.isAnimating = false;
|
|
1596
|
-
}
|
|
1597
|
-
handlePartitionAppend(value) {
|
|
1598
|
-
var {
|
|
1599
|
-
onPartitionAppend
|
|
1600
|
-
} = this.props;
|
|
1601
|
-
var {
|
|
1602
|
-
partitionColumn
|
|
1603
|
-
} = this.state;
|
|
1604
|
-
if (partitionColumn == null) {
|
|
1605
|
-
return;
|
|
1606
|
-
}
|
|
1607
|
-
onPartitionAppend(partitionColumn, value);
|
|
1608
|
-
}
|
|
1609
|
-
handlePartitionChange(partition) {
|
|
1610
|
-
var {
|
|
1611
|
-
partitionColumn
|
|
1612
|
-
} = this.state;
|
|
1613
|
-
if (partitionColumn == null) {
|
|
1614
|
-
return;
|
|
1615
|
-
}
|
|
1616
|
-
this.updatePartition(partition, partitionColumn);
|
|
1617
|
-
}
|
|
1618
|
-
handlePartitionFetchAll() {
|
|
1619
|
-
this.setState({
|
|
1620
|
-
partitionFilters: [],
|
|
1621
|
-
isSelectingPartition: false
|
|
1622
|
-
});
|
|
1623
|
-
}
|
|
1624
|
-
handlePartitionDone() {
|
|
1625
|
-
this.setState({
|
|
1626
|
-
isSelectingPartition: false
|
|
1627
|
-
});
|
|
1628
|
-
}
|
|
1629
|
-
handleTableLoadError(error) {
|
|
1630
|
-
if (PromiseUtils.isCanceled(error)) {
|
|
1631
|
-
return;
|
|
1632
|
-
}
|
|
1633
|
-
log.error(error);
|
|
1634
|
-
var {
|
|
1635
|
-
onError
|
|
1636
|
-
} = this.props;
|
|
1637
|
-
onError(error);
|
|
1638
|
-
}
|
|
1639
|
-
showAllColumns() {
|
|
1640
|
-
var _this$grid8;
|
|
1641
|
-
var {
|
|
1642
|
-
metricCalculator
|
|
1643
|
-
} = this.state;
|
|
1644
|
-
var userColumnWidths = metricCalculator.getUserColumnWidths();
|
|
1645
|
-
var entries = [...userColumnWidths.entries()];
|
|
1646
|
-
for (var i = 0; i < entries.length; i += 1) {
|
|
1647
|
-
var [modelIndex, columnWidth] = entries[i];
|
|
1648
|
-
if (columnWidth === 0) {
|
|
1649
|
-
metricCalculator.resetColumnWidth(modelIndex);
|
|
1650
|
-
}
|
|
1651
|
-
}
|
|
1652
|
-
(_this$grid8 = this.grid) === null || _this$grid8 === void 0 ? void 0 : _this$grid8.forceUpdate();
|
|
1653
|
-
}
|
|
1654
|
-
toggleSort(columnIndex, addToExisting) {
|
|
1655
|
-
log.info('Toggling sort for column', columnIndex);
|
|
1656
|
-
var {
|
|
1657
|
-
model
|
|
1658
|
-
} = this.props;
|
|
1659
|
-
var modelColumn = this.getModelColumn(columnIndex);
|
|
1660
|
-
assertNotNull(modelColumn);
|
|
1661
|
-
if (model.isColumnSortable(columnIndex)) {
|
|
1662
|
-
var {
|
|
1663
|
-
sorts: currentSorts
|
|
1664
|
-
} = this.state;
|
|
1665
|
-
var sorts = TableUtils.toggleSortForColumn(currentSorts, model.columns, modelColumn, addToExisting);
|
|
1666
|
-
this.updateSorts(sorts);
|
|
1667
|
-
} else {
|
|
1668
|
-
log.debug('Column type was not sortable', model.columns[columnIndex]);
|
|
1669
|
-
}
|
|
1670
|
-
}
|
|
1671
|
-
updateSorts(sorts) {
|
|
1672
|
-
var _this$grid9;
|
|
1673
|
-
this.startLoading('Sorting...');
|
|
1674
|
-
this.setState({
|
|
1675
|
-
sorts
|
|
1676
|
-
});
|
|
1677
|
-
(_this$grid9 = this.grid) === null || _this$grid9 === void 0 ? void 0 : _this$grid9.forceUpdate();
|
|
1678
|
-
}
|
|
1679
|
-
sortColumn(modelColumn) {
|
|
1680
|
-
var _this$grid10;
|
|
1681
|
-
var direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : TableUtils.sortDirection.none;
|
|
1682
|
-
var isAbs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
1683
|
-
var addToExisting = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
1684
|
-
assertNotNull(modelColumn);
|
|
1685
|
-
var {
|
|
1686
|
-
model
|
|
1687
|
-
} = this.props;
|
|
1688
|
-
var sorts = TableUtils.sortColumn(model.sort, model.columns, modelColumn, direction, isAbs, addToExisting);
|
|
1689
|
-
this.startLoading('Sorting...');
|
|
1690
|
-
this.setState({
|
|
1691
|
-
sorts
|
|
1692
|
-
});
|
|
1693
|
-
(_this$grid10 = this.grid) === null || _this$grid10 === void 0 ? void 0 : _this$grid10.forceUpdate();
|
|
1694
|
-
}
|
|
1695
|
-
reverse(reverseType) {
|
|
1696
|
-
var _this$grid11;
|
|
1697
|
-
this.startLoading('Reversing...');
|
|
1698
|
-
this.setState({
|
|
1699
|
-
reverseType
|
|
1700
|
-
});
|
|
1701
|
-
(_this$grid11 = this.grid) === null || _this$grid11 === void 0 ? void 0 : _this$grid11.forceUpdate();
|
|
1702
|
-
}
|
|
1703
|
-
isReversible() {
|
|
1704
|
-
var {
|
|
1705
|
-
model
|
|
1706
|
-
} = this.props;
|
|
1707
|
-
return model.isReversible;
|
|
1708
|
-
}
|
|
1709
|
-
toggleFilterBar() {
|
|
1710
|
-
var focusIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.lastFocusedFilterBarColumn;
|
|
1711
|
-
var {
|
|
1712
|
-
isFilterBarShown
|
|
1713
|
-
} = this.state;
|
|
1714
|
-
isFilterBarShown = !isFilterBarShown;
|
|
1715
|
-
this.setState({
|
|
1716
|
-
isFilterBarShown
|
|
1717
|
-
});
|
|
1718
|
-
if (isFilterBarShown) {
|
|
1719
|
-
if (focusIndex != null) {
|
|
1720
|
-
this.focusFilterBar(focusIndex);
|
|
1721
|
-
} else {
|
|
1722
|
-
var columnIndex = 0;
|
|
1723
|
-
var {
|
|
1724
|
-
model: _model2
|
|
1725
|
-
} = this.props;
|
|
1726
|
-
var {
|
|
1727
|
-
columnCount
|
|
1728
|
-
} = _model2;
|
|
1729
|
-
for (var i = 0; i < columnCount; i += 1) {
|
|
1730
|
-
var modelColumn = this.getModelColumn(i);
|
|
1731
|
-
if (modelColumn != null) {
|
|
1732
|
-
var _column2 = _model2.columns[modelColumn];
|
|
1733
|
-
if (_column2 != null && TableUtils.isTextType(_column2.type)) {
|
|
1734
|
-
columnIndex = i;
|
|
1735
|
-
break;
|
|
1736
|
-
}
|
|
1737
|
-
}
|
|
1738
|
-
}
|
|
1739
|
-
this.focusFilterBar(columnIndex);
|
|
1740
|
-
}
|
|
1741
|
-
} else {
|
|
1742
|
-
var _this$grid12;
|
|
1743
|
-
(_this$grid12 = this.grid) === null || _this$grid12 === void 0 ? void 0 : _this$grid12.focus();
|
|
1744
|
-
}
|
|
1745
|
-
}
|
|
1746
|
-
isTableSearchAvailable() {
|
|
1747
|
-
var _model$layoutHints3, _dh$SearchDisplayMode, _dh$SearchDisplayMode2;
|
|
1748
|
-
var {
|
|
1749
|
-
model,
|
|
1750
|
-
canToggleSearch
|
|
1751
|
-
} = this.props;
|
|
1752
|
-
var {
|
|
1753
|
-
dh
|
|
1754
|
-
} = model;
|
|
1755
|
-
var searchDisplayMode = model === null || model === void 0 ? void 0 : (_model$layoutHints3 = model.layoutHints) === null || _model$layoutHints3 === void 0 ? void 0 : _model$layoutHints3.searchDisplayMode;
|
|
1756
|
-
if (searchDisplayMode === ((_dh$SearchDisplayMode = dh.SearchDisplayMode) === null || _dh$SearchDisplayMode === void 0 ? void 0 : _dh$SearchDisplayMode.SEARCH_DISPLAY_HIDE)) {
|
|
1757
|
-
return false;
|
|
1758
|
-
}
|
|
1759
|
-
if (searchDisplayMode === ((_dh$SearchDisplayMode2 = dh.SearchDisplayMode) === null || _dh$SearchDisplayMode2 === void 0 ? void 0 : _dh$SearchDisplayMode2.SEARCH_DISPLAY_SHOW)) {
|
|
1760
|
-
return true;
|
|
1761
|
-
}
|
|
1762
|
-
return canToggleSearch;
|
|
1763
|
-
}
|
|
1764
|
-
toggleSearchBar() {
|
|
1765
|
-
var {
|
|
1766
|
-
showSearchBar
|
|
1767
|
-
} = this.state;
|
|
1768
|
-
if (!this.isTableSearchAvailable()) {
|
|
1769
|
-
return;
|
|
1770
|
-
}
|
|
1771
|
-
var update = !showSearchBar;
|
|
1772
|
-
this.setState({
|
|
1773
|
-
showSearchBar: update
|
|
1774
|
-
}, () => {
|
|
1775
|
-
var _this$crossColumnRef;
|
|
1776
|
-
if (update && (_this$crossColumnRef = this.crossColumnRef) !== null && _this$crossColumnRef !== void 0 && _this$crossColumnRef.current) {
|
|
1777
|
-
var _this$crossColumnRef2;
|
|
1778
|
-
(_this$crossColumnRef2 = this.crossColumnRef) === null || _this$crossColumnRef2 === void 0 ? void 0 : _this$crossColumnRef2.current.focus();
|
|
1779
|
-
} else {
|
|
1780
|
-
var _this$grid13;
|
|
1781
|
-
(_this$grid13 = this.grid) === null || _this$grid13 === void 0 ? void 0 : _this$grid13.focus();
|
|
1782
|
-
}
|
|
1783
|
-
});
|
|
1784
|
-
}
|
|
1785
|
-
toggleGotoRow() {
|
|
1786
|
-
var _this$grid14, _this$grid15;
|
|
1787
|
-
var row = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
1788
|
-
var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
1789
|
-
var columnName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
1790
|
-
var {
|
|
1791
|
-
isGotoShown
|
|
1792
|
-
} = this.state;
|
|
1793
|
-
if (row || value) {
|
|
1794
|
-
// if invoked with a row, keep open instead of toggle
|
|
1795
|
-
this.setState({
|
|
1796
|
-
isGotoShown: true,
|
|
1797
|
-
gotoRow: row,
|
|
1798
|
-
gotoValue: value,
|
|
1799
|
-
gotoValueSelectedColumnName: columnName,
|
|
1800
|
-
gotoRowError: '',
|
|
1801
|
-
gotoValueError: ''
|
|
1802
|
-
});
|
|
1803
|
-
this.focusRowInGrid(row);
|
|
1804
|
-
return;
|
|
1805
|
-
}
|
|
1806
|
-
var cursorRow = (_this$grid14 = this.grid) === null || _this$grid14 === void 0 ? void 0 : _this$grid14.state.cursorRow;
|
|
1807
|
-
var cursorColumn = (_this$grid15 = this.grid) === null || _this$grid15 === void 0 ? void 0 : _this$grid15.state.cursorColumn;
|
|
1808
|
-
if (cursorRow == null || cursorColumn == null) {
|
|
1809
|
-
// if a cell is not selected / grid is not rendered
|
|
1810
|
-
this.setState({
|
|
1811
|
-
isGotoShown: !isGotoShown,
|
|
1812
|
-
gotoRow: '',
|
|
1813
|
-
gotoValue: '',
|
|
1814
|
-
gotoRowError: '',
|
|
1815
|
-
gotoValueError: ''
|
|
1816
|
-
});
|
|
1817
|
-
return;
|
|
1818
|
-
}
|
|
1819
|
-
// if a row is selected
|
|
1820
|
-
var {
|
|
1821
|
-
model
|
|
1822
|
-
} = this.props;
|
|
1823
|
-
var {
|
|
1824
|
-
name,
|
|
1825
|
-
type
|
|
1826
|
-
} = model.columns[cursorColumn];
|
|
1827
|
-
var cellValue = model.valueForCell(cursorColumn, cursorRow);
|
|
1828
|
-
var text = IrisGridUtils.convertValueToText(cellValue, type);
|
|
1829
|
-
this.setState({
|
|
1830
|
-
isGotoShown: !isGotoShown,
|
|
1831
|
-
gotoRow: "".concat(cursorRow),
|
|
1832
|
-
gotoValue: text,
|
|
1833
|
-
gotoValueSelectedColumnName: name,
|
|
1834
|
-
gotoRowError: '',
|
|
1835
|
-
gotoValueError: ''
|
|
1836
|
-
});
|
|
1837
|
-
}
|
|
1838
|
-
commitPending() {
|
|
1839
|
-
var _this2 = this;
|
|
1840
|
-
return _asyncToGenerator(function* () {
|
|
1841
|
-
var _document, _document$activeEleme;
|
|
1842
|
-
var {
|
|
1843
|
-
model
|
|
1844
|
-
} = _this2.props;
|
|
1845
|
-
if (!isEditableGridModel(model) || !model.isEditable) {
|
|
1846
|
-
throw new Error('Cannot save, table is not editable');
|
|
1847
|
-
}
|
|
1848
|
-
var {
|
|
1849
|
-
pendingSavePromise
|
|
1850
|
-
} = _this2.state;
|
|
1851
|
-
if (pendingSavePromise != null) {
|
|
1852
|
-
throw new Error('Save already in progress');
|
|
1853
|
-
}
|
|
1854
|
-
var containsGridCellInputField = (_document = document) === null || _document === void 0 ? void 0 : (_document$activeEleme = _document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.classList.contains('grid-cell-input-field');
|
|
1855
|
-
if (containsGridCellInputField != null && containsGridCellInputField) {
|
|
1856
|
-
var _this2$grid;
|
|
1857
|
-
if (document.activeElement != null && document.activeElement.classList.contains('error')) {
|
|
1858
|
-
throw new ValidationError('Current input is invalid');
|
|
1859
|
-
}
|
|
1860
|
-
|
|
1861
|
-
// Focus the grid again to commit any pending input changes
|
|
1862
|
-
(_this2$grid = _this2.grid) === null || _this2$grid === void 0 ? void 0 : _this2$grid.focus();
|
|
1863
|
-
}
|
|
1864
|
-
var newPendingSavePromise = _this2.pending.add(model.commitPending()).then(() => {
|
|
1865
|
-
_this2.setState({
|
|
1866
|
-
pendingSaveError: null,
|
|
1867
|
-
pendingSavePromise: null
|
|
1868
|
-
});
|
|
1869
|
-
}).catch(err => {
|
|
1870
|
-
if (!PromiseUtils.isCanceled(err)) {
|
|
1871
|
-
_this2.setState({
|
|
1872
|
-
pendingSaveError: err,
|
|
1873
|
-
pendingSavePromise: null
|
|
1874
|
-
});
|
|
1875
|
-
}
|
|
1876
|
-
});
|
|
1877
|
-
_this2.setState({
|
|
1878
|
-
pendingSavePromise: newPendingSavePromise
|
|
1879
|
-
});
|
|
1880
|
-
return newPendingSavePromise;
|
|
1881
|
-
})();
|
|
1882
|
-
}
|
|
1883
|
-
discardPending() {
|
|
1884
|
-
var _this3 = this;
|
|
1885
|
-
return _asyncToGenerator(function* () {
|
|
1886
|
-
var {
|
|
1887
|
-
pendingSavePromise
|
|
1888
|
-
} = _this3.state;
|
|
1889
|
-
if (pendingSavePromise != null) {
|
|
1890
|
-
throw new Error('Cannot cancel a save in progress');
|
|
1891
|
-
}
|
|
1892
|
-
_this3.setState({
|
|
1893
|
-
pendingSavePromise: null,
|
|
1894
|
-
pendingSaveError: null,
|
|
1895
|
-
pendingDataMap: new Map(),
|
|
1896
|
-
pendingDataErrors: new Map()
|
|
1897
|
-
});
|
|
1898
|
-
})();
|
|
1899
|
-
}
|
|
1900
|
-
|
|
1901
|
-
/**
|
|
1902
|
-
* Select the passed in column and notify listener
|
|
1903
|
-
* @param column The column in this table to link
|
|
1904
|
-
*/
|
|
1905
|
-
selectColumn(column) {
|
|
1906
|
-
var {
|
|
1907
|
-
onColumnSelected
|
|
1908
|
-
} = this.props;
|
|
1909
|
-
onColumnSelected(column);
|
|
1910
|
-
}
|
|
1911
|
-
|
|
1912
|
-
/**
|
|
1913
|
-
* Select all the data for a given row and notify listener
|
|
1914
|
-
*/
|
|
1915
|
-
selectData(columnIndex, rowIndex) {
|
|
1916
|
-
var _this4 = this;
|
|
1917
|
-
var {
|
|
1918
|
-
model
|
|
1919
|
-
} = this.props;
|
|
1920
|
-
var {
|
|
1921
|
-
columns,
|
|
1922
|
-
groupedColumns
|
|
1923
|
-
} = model;
|
|
1924
|
-
var dataMap = {};
|
|
1925
|
-
var _loop = function _loop() {
|
|
1926
|
-
var column = columns[i];
|
|
1927
|
-
var {
|
|
1928
|
-
name,
|
|
1929
|
-
type
|
|
1930
|
-
} = column;
|
|
1931
|
-
var value = model.valueForCell(i, rowIndex);
|
|
1932
|
-
var text = model.textForCell(i, rowIndex);
|
|
1933
|
-
var visibleIndex = _this4.getVisibleColumn(i);
|
|
1934
|
-
var isExpandable = isExpandableGridModel(model) && model.isRowExpandable(rowIndex);
|
|
1935
|
-
var isGrouped = groupedColumns.find(c => c.name === name) != null;
|
|
1936
|
-
dataMap[name] = {
|
|
1937
|
-
value,
|
|
1938
|
-
text,
|
|
1939
|
-
type,
|
|
1940
|
-
isGrouped,
|
|
1941
|
-
isExpandable,
|
|
1942
|
-
visibleIndex
|
|
1943
|
-
};
|
|
1944
|
-
};
|
|
1945
|
-
for (var i = 0; i < columns.length; i += 1) {
|
|
1946
|
-
_loop();
|
|
1947
|
-
}
|
|
1948
|
-
var {
|
|
1949
|
-
onDataSelected
|
|
1950
|
-
} = this.props;
|
|
1951
|
-
onDataSelected(rowIndex, dataMap);
|
|
1952
|
-
}
|
|
1953
|
-
handleAdvancedFilterChange(column, filter, options) {
|
|
1954
|
-
var {
|
|
1955
|
-
model
|
|
1956
|
-
} = this.props;
|
|
1957
|
-
var index = model.getColumnIndexByName(column.name);
|
|
1958
|
-
assertNotNull(index);
|
|
1959
|
-
this.setAdvancedFilter(index, filter, options);
|
|
1960
|
-
}
|
|
1961
|
-
handleAdvancedFilterSortChange(column, direction) {
|
|
1962
|
-
var _this$grid16;
|
|
1963
|
-
var addToExisting = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
1964
|
-
var {
|
|
1965
|
-
model
|
|
1966
|
-
} = this.props;
|
|
1967
|
-
var columnIndex = model.getColumnIndexByName(column.name);
|
|
1968
|
-
assertNotNull(columnIndex);
|
|
1969
|
-
var columnName = model.columns[columnIndex].name;
|
|
1970
|
-
var oldSort = TableUtils.getSortForColumn(model.sort, columnName);
|
|
1971
|
-
var newSort = null;
|
|
1972
|
-
if (oldSort == null || oldSort.direction !== direction) {
|
|
1973
|
-
if (direction === TableUtils.sortDirection.descending) {
|
|
1974
|
-
newSort = column.sort().desc();
|
|
1975
|
-
} else {
|
|
1976
|
-
newSort = column.sort().asc();
|
|
1977
|
-
}
|
|
1978
|
-
}
|
|
1979
|
-
var sorts = TableUtils.setSortForColumn(model.sort, columnName, newSort, addToExisting);
|
|
1980
|
-
log.info('Setting table sorts', sorts);
|
|
1981
|
-
this.startLoading('Sorting...');
|
|
1982
|
-
this.setState({
|
|
1983
|
-
sorts
|
|
1984
|
-
});
|
|
1985
|
-
(_this$grid16 = this.grid) === null || _this$grid16 === void 0 ? void 0 : _this$grid16.forceUpdate();
|
|
1986
|
-
}
|
|
1987
|
-
handleAdvancedFilterDone() {
|
|
1988
|
-
var _this$grid17;
|
|
1989
|
-
(_this$grid17 = this.grid) === null || _this$grid17 === void 0 ? void 0 : _this$grid17.focus();
|
|
1990
|
-
}
|
|
1991
|
-
handleAdvancedMenuOpened(column) {
|
|
1992
|
-
this.setState({
|
|
1993
|
-
shownAdvancedFilter: column
|
|
1994
|
-
});
|
|
1995
|
-
}
|
|
1996
|
-
handleGotoRowOpened() {
|
|
1997
|
-
this.setState({
|
|
1998
|
-
isGotoShown: true
|
|
1999
|
-
});
|
|
2000
|
-
}
|
|
2001
|
-
handleGotoRowClosed() {
|
|
2002
|
-
this.setState({
|
|
2003
|
-
isGotoShown: false
|
|
2004
|
-
});
|
|
2005
|
-
}
|
|
2006
|
-
handleAdvancedMenuClosed(columnIndex) {
|
|
2007
|
-
var _this$filterInputRef;
|
|
2008
|
-
var {
|
|
2009
|
-
focusedFilterBarColumn,
|
|
2010
|
-
isFilterBarShown
|
|
2011
|
-
} = this.state;
|
|
2012
|
-
if (isFilterBarShown && focusedFilterBarColumn === columnIndex && ((_this$filterInputRef = this.filterInputRef) === null || _this$filterInputRef === void 0 ? void 0 : _this$filterInputRef.current) !== null) {
|
|
2013
|
-
var _this$filterInputRef2;
|
|
2014
|
-
(_this$filterInputRef2 = this.filterInputRef) === null || _this$filterInputRef2 === void 0 ? void 0 : _this$filterInputRef2.current.focus();
|
|
2015
|
-
this.setState({
|
|
2016
|
-
shownAdvancedFilter: null
|
|
2017
|
-
});
|
|
2018
|
-
} else {
|
|
2019
|
-
this.setState({
|
|
2020
|
-
focusedFilterBarColumn: null,
|
|
2021
|
-
shownAdvancedFilter: null
|
|
2022
|
-
});
|
|
2023
|
-
}
|
|
2024
|
-
}
|
|
2025
|
-
handleCancel() {
|
|
2026
|
-
this.rollback();
|
|
2027
|
-
}
|
|
2028
|
-
|
|
2029
|
-
// eslint-disable-next-line class-methods-use-this
|
|
2030
|
-
handleChartChange() {
|
|
2031
|
-
// TODO: IDS-4242 Update Chart Preview
|
|
2032
|
-
}
|
|
2033
|
-
handleChartCreate(settings) {
|
|
2034
|
-
var {
|
|
2035
|
-
model,
|
|
2036
|
-
onCreateChart
|
|
2037
|
-
} = this.props;
|
|
2038
|
-
onCreateChart(settings, model);
|
|
2039
|
-
}
|
|
2040
|
-
handleGridError(error) {
|
|
2041
|
-
log.warn('Grid Error', error);
|
|
2042
|
-
this.setState({
|
|
2043
|
-
toastMessage: /*#__PURE__*/React.createElement("div", {
|
|
2044
|
-
className: "error-message"
|
|
2045
|
-
}, "".concat(error))
|
|
2046
|
-
});
|
|
2047
|
-
}
|
|
2048
|
-
handleFilterBarChange(value) {
|
|
2049
|
-
this.startLoading('Filtering...', true);
|
|
2050
|
-
this.setState(_ref13 => {
|
|
2051
|
-
var {
|
|
2052
|
-
focusedFilterBarColumn,
|
|
2053
|
-
quickFilters
|
|
2054
|
-
} = _ref13;
|
|
2055
|
-
var newQuickFilters = new Map(quickFilters);
|
|
2056
|
-
if (focusedFilterBarColumn != null) {
|
|
2057
|
-
var modelIndex = this.getModelColumn(focusedFilterBarColumn);
|
|
2058
|
-
assertNotNull(modelIndex);
|
|
2059
|
-
this.applyQuickFilter(modelIndex, value, newQuickFilters);
|
|
2060
|
-
}
|
|
2061
|
-
return {
|
|
2062
|
-
quickFilters: newQuickFilters
|
|
2063
|
-
};
|
|
2064
|
-
});
|
|
2065
|
-
}
|
|
2066
|
-
handleFilterBarDone() {
|
|
2067
|
-
var setGridFocus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
2068
|
-
var defocusInput = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
2069
|
-
if (setGridFocus) {
|
|
2070
|
-
var _this$grid18;
|
|
2071
|
-
(_this$grid18 = this.grid) === null || _this$grid18 === void 0 ? void 0 : _this$grid18.focus();
|
|
2072
|
-
}
|
|
2073
|
-
if (defocusInput) {
|
|
2074
|
-
this.setState({
|
|
2075
|
-
focusedFilterBarColumn: null
|
|
2076
|
-
});
|
|
2077
|
-
}
|
|
2078
|
-
}
|
|
2079
|
-
handleFilterBarTab(backward) {
|
|
2080
|
-
var {
|
|
2081
|
-
focusedFilterBarColumn
|
|
2082
|
-
} = this.state;
|
|
2083
|
-
assertNotNull(focusedFilterBarColumn);
|
|
2084
|
-
if (backward) {
|
|
2085
|
-
this.focusFilterBar(focusedFilterBarColumn - 1);
|
|
2086
|
-
} else {
|
|
2087
|
-
this.focusFilterBar(focusedFilterBarColumn + 1);
|
|
2088
|
-
}
|
|
2089
|
-
}
|
|
2090
|
-
handleFormatSelection(modelIndex, selectedFormat) {
|
|
2091
|
-
var {
|
|
2092
|
-
model
|
|
2093
|
-
} = this.props;
|
|
2094
|
-
var column = model.columns[modelIndex];
|
|
2095
|
-
var {
|
|
2096
|
-
customColumnFormatMap: prevCustomColumnFormatMap
|
|
2097
|
-
} = this.state;
|
|
2098
|
-
var customColumnFormatMap = new Map(prevCustomColumnFormatMap);
|
|
2099
|
-
if (selectedFormat != null) {
|
|
2100
|
-
var normalizedType = TableUtils.getNormalizedType(column.type);
|
|
2101
|
-
assertNotNull(normalizedType);
|
|
2102
|
-
var columnFormattingRule = Formatter.makeColumnFormattingRule(normalizedType, column.name, selectedFormat);
|
|
2103
|
-
customColumnFormatMap.set(column.name, columnFormattingRule);
|
|
2104
|
-
} else {
|
|
2105
|
-
customColumnFormatMap.delete(column.name);
|
|
2106
|
-
}
|
|
2107
|
-
this.updateFormatter({
|
|
2108
|
-
customColumnFormatMap
|
|
2109
|
-
});
|
|
2110
|
-
}
|
|
2111
|
-
handleMenu(e) {
|
|
2112
|
-
e.stopPropagation();
|
|
2113
|
-
this.setState({
|
|
2114
|
-
isMenuShown: true
|
|
2115
|
-
});
|
|
2116
|
-
}
|
|
2117
|
-
handleMenuClose() {
|
|
2118
|
-
this.setState({
|
|
2119
|
-
isMenuShown: false,
|
|
2120
|
-
openOptions: []
|
|
2121
|
-
});
|
|
2122
|
-
}
|
|
2123
|
-
handleMenuBack() {
|
|
2124
|
-
this.setState(_ref14 => {
|
|
2125
|
-
var {
|
|
2126
|
-
openOptions
|
|
2127
|
-
} = _ref14;
|
|
2128
|
-
var newOptions = [...openOptions];
|
|
2129
|
-
newOptions.pop();
|
|
2130
|
-
return {
|
|
2131
|
-
openOptions: newOptions
|
|
2132
|
-
};
|
|
2133
|
-
});
|
|
2134
|
-
}
|
|
2135
|
-
handleMenuSelect(option) {
|
|
2136
|
-
this.setState(_ref15 => {
|
|
2137
|
-
var {
|
|
2138
|
-
openOptions
|
|
2139
|
-
} = _ref15;
|
|
2140
|
-
return {
|
|
2141
|
-
openOptions: [...openOptions, option]
|
|
2142
|
-
};
|
|
2143
|
-
});
|
|
2144
|
-
}
|
|
2145
|
-
handleRequestFailed(event) {
|
|
2146
|
-
var customEvent = event;
|
|
2147
|
-
log.error('request failed:', customEvent.detail);
|
|
2148
|
-
this.stopLoading();
|
|
2149
|
-
if (this.canRollback()) {
|
|
2150
|
-
this.startLoading('Rolling back changes...', true);
|
|
2151
|
-
this.rollback();
|
|
2152
|
-
} else {
|
|
2153
|
-
log.error('Table failed and unable to rollback');
|
|
2154
|
-
var {
|
|
2155
|
-
onError
|
|
2156
|
-
} = this.props;
|
|
2157
|
-
onError(new Error("Error displaying table: ".concat(customEvent.detail)));
|
|
2158
|
-
}
|
|
2159
|
-
}
|
|
2160
|
-
handleUpdate() {
|
|
2161
|
-
var _this$grid19;
|
|
2162
|
-
this.stopLoading();
|
|
2163
|
-
log.debug2('Received model update');
|
|
2164
|
-
var {
|
|
2165
|
-
advancedFilters,
|
|
2166
|
-
aggregationSettings,
|
|
2167
|
-
customColumns,
|
|
2168
|
-
quickFilters,
|
|
2169
|
-
reverseType,
|
|
2170
|
-
rollupConfig,
|
|
2171
|
-
searchFilter,
|
|
2172
|
-
selectDistinctColumns,
|
|
2173
|
-
sorts
|
|
2174
|
-
} = this.state;
|
|
2175
|
-
var config = {
|
|
2176
|
-
advancedFilters,
|
|
2177
|
-
aggregationSettings,
|
|
2178
|
-
customColumns,
|
|
2179
|
-
quickFilters,
|
|
2180
|
-
reverseType,
|
|
2181
|
-
rollupConfig,
|
|
2182
|
-
searchFilter,
|
|
2183
|
-
selectDistinctColumns,
|
|
2184
|
-
sorts
|
|
2185
|
-
};
|
|
2186
|
-
if (!isEmptyConfig(config)) {
|
|
2187
|
-
this.lastLoadedConfig = config;
|
|
2188
|
-
} else {
|
|
2189
|
-
this.lastLoadedConfig = null;
|
|
2190
|
-
}
|
|
2191
|
-
(_this$grid19 = this.grid) === null || _this$grid19 === void 0 ? void 0 : _this$grid19.forceUpdate();
|
|
2192
|
-
}
|
|
2193
|
-
handleViewChanged(metrics) {
|
|
2194
|
-
var _this$grid$state, _this$grid20;
|
|
2195
|
-
var {
|
|
2196
|
-
model
|
|
2197
|
-
} = this.props;
|
|
2198
|
-
var {
|
|
2199
|
-
selectionEndRow = 0
|
|
2200
|
-
} = (_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 : {};
|
|
2201
|
-
var pendingRowCount = 0;
|
|
2202
|
-
if (isEditableGridModel(model) && model.isEditable) {
|
|
2203
|
-
assertNotNull(metrics);
|
|
2204
|
-
var {
|
|
2205
|
-
bottomViewport
|
|
2206
|
-
} = metrics;
|
|
2207
|
-
|
|
2208
|
-
// We have an editable table that we can add new rows to
|
|
2209
|
-
// Display empty rows beneath the table rows that user can fill in
|
|
2210
|
-
var bottomNonFloating = model.rowCount - model.floatingBottomRowCount;
|
|
2211
|
-
if (selectionEndRow === bottomNonFloating - 1) {
|
|
2212
|
-
// Selection is in the last row, add another blank row
|
|
2213
|
-
pendingRowCount = model.pendingRowCount + 1;
|
|
2214
|
-
} else if (selectionEndRow === bottomNonFloating - 2) {
|
|
2215
|
-
// We may have just added a row based on selection moving, so just leave it as is
|
|
2216
|
-
pendingRowCount = model.pendingRowCount;
|
|
2217
|
-
} else {
|
|
2218
|
-
// Otherwise fill up the viewport with empty cells
|
|
2219
|
-
pendingRowCount = Math.max(0, bottomViewport - (model.rowCount - model.pendingRowCount) - model.floatingTopRowCount - model.floatingBottomRowCount - 1);
|
|
2220
|
-
}
|
|
2221
|
-
}
|
|
2222
|
-
this.setState({
|
|
2223
|
-
metrics,
|
|
2224
|
-
pendingRowCount
|
|
2225
|
-
});
|
|
2226
|
-
}
|
|
2227
|
-
handleSelectionChanged(selectedRanges) {
|
|
2228
|
-
assertNotNull(selectedRanges);
|
|
2229
|
-
var {
|
|
2230
|
-
onSelectionChanged
|
|
2231
|
-
} = this.props;
|
|
2232
|
-
var {
|
|
2233
|
-
copyOperation
|
|
2234
|
-
} = this.state;
|
|
2235
|
-
this.setState({
|
|
2236
|
-
selectedRanges
|
|
2237
|
-
});
|
|
2238
|
-
if (copyOperation != null) {
|
|
2239
|
-
this.setState({
|
|
2240
|
-
copyOperation: null
|
|
2241
|
-
});
|
|
2242
|
-
}
|
|
2243
|
-
onSelectionChanged(selectedRanges);
|
|
2244
|
-
}
|
|
2245
|
-
handleMovedColumnsChanged(movedColumns, onChangeApplied) {
|
|
2246
|
-
this.setState({
|
|
2247
|
-
movedColumns
|
|
2248
|
-
}, onChangeApplied);
|
|
2249
|
-
}
|
|
2250
|
-
handleHeaderGroupsChanged(columnHeaderGroups) {
|
|
2251
|
-
var {
|
|
2252
|
-
model
|
|
2253
|
-
} = this.props;
|
|
2254
|
-
this.setState({
|
|
2255
|
-
columnHeaderGroups: IrisGridUtils.parseColumnHeaderGroups(model, columnHeaderGroups).groups
|
|
2256
|
-
}, () => {
|
|
2257
|
-
var _this$grid21;
|
|
2258
|
-
return (_this$grid21 = this.grid) === null || _this$grid21 === void 0 ? void 0 : _this$grid21.forceUpdate();
|
|
2259
|
-
});
|
|
2260
|
-
}
|
|
2261
|
-
handleTooltipRef(tooltip) {
|
|
2262
|
-
// Need to start the timer right away, since we're creating the tooltip when we want the timer to start
|
|
2263
|
-
if (tooltip != null) {
|
|
2264
|
-
tooltip.startTimer();
|
|
2265
|
-
}
|
|
2266
|
-
this.tooltip = tooltip;
|
|
2267
|
-
}
|
|
2268
|
-
handleConditionalFormatsChange(conditionalFormats) {
|
|
2269
|
-
log.debug('Updated conditional formats', conditionalFormats);
|
|
2270
|
-
this.setState({
|
|
2271
|
-
conditionalFormats
|
|
2272
|
-
});
|
|
2273
|
-
}
|
|
2274
|
-
handleConditionalFormatCreate() {
|
|
2275
|
-
log.debug('Create new conditional format');
|
|
2276
|
-
var {
|
|
2277
|
-
openOptions,
|
|
2278
|
-
conditionalFormats
|
|
2279
|
-
} = this.state;
|
|
2280
|
-
this.setState({
|
|
2281
|
-
openOptions: [...openOptions, {
|
|
2282
|
-
type: OptionType.CONDITIONAL_FORMATTING_EDIT,
|
|
2283
|
-
title: "Create Formatting Rule"
|
|
2284
|
-
}],
|
|
2285
|
-
conditionalFormatEditIndex: conditionalFormats.length,
|
|
2286
|
-
// Start with a blank rule
|
|
2287
|
-
conditionalFormatPreview: undefined
|
|
2288
|
-
});
|
|
2289
|
-
}
|
|
2290
|
-
handleConditionalFormatEdit(index) {
|
|
2291
|
-
log.debug('Edit conditional format', index);
|
|
2292
|
-
var {
|
|
2293
|
-
openOptions,
|
|
2294
|
-
conditionalFormats
|
|
2295
|
-
} = this.state;
|
|
2296
|
-
this.setState({
|
|
2297
|
-
openOptions: [...openOptions, {
|
|
2298
|
-
type: OptionType.CONDITIONAL_FORMATTING_EDIT,
|
|
2299
|
-
title: "Edit Formatting Rule"
|
|
2300
|
-
}],
|
|
2301
|
-
conditionalFormatEditIndex: index,
|
|
2302
|
-
// Clone rule to preview temporary changes
|
|
2303
|
-
conditionalFormatPreview: _objectSpread({}, conditionalFormats[index])
|
|
2304
|
-
});
|
|
2305
|
-
}
|
|
2306
|
-
|
|
2307
|
-
// Apply live changes
|
|
2308
|
-
|
|
2309
|
-
handleConditionalFormatEditorSave(config) {
|
|
2310
|
-
log.debug('Save conditional format changes', config);
|
|
2311
|
-
this.setState(state => {
|
|
2312
|
-
if (state.conditionalFormatEditIndex === null) {
|
|
2313
|
-
log.debug('Invalid format index');
|
|
2314
|
-
return null;
|
|
2315
|
-
}
|
|
2316
|
-
var conditionalFormats = [...state.conditionalFormats];
|
|
2317
|
-
conditionalFormats[state.conditionalFormatEditIndex] = config;
|
|
2318
|
-
return {
|
|
2319
|
-
conditionalFormats
|
|
2320
|
-
};
|
|
2321
|
-
}, () => {
|
|
2322
|
-
this.handleMenuBack();
|
|
2323
|
-
});
|
|
2324
|
-
}
|
|
2325
|
-
handleConditionalFormatEditorCancel() {
|
|
2326
|
-
this.handleMenuBack();
|
|
2327
|
-
// Not resetting conditionalFormatPreview here
|
|
2328
|
-
// to prevent editor fields change during the menu transition
|
|
2329
|
-
this.setState({
|
|
2330
|
-
conditionalFormatEditIndex: null
|
|
2331
|
-
});
|
|
2332
|
-
}
|
|
2333
|
-
handleUpdateCustomColumns(customColumns) {
|
|
2334
|
-
log.info("handleUpdateCustomColumns:", customColumns);
|
|
2335
|
-
var {
|
|
2336
|
-
model
|
|
2337
|
-
} = this.props;
|
|
2338
|
-
var {
|
|
2339
|
-
movedColumns,
|
|
2340
|
-
sorts,
|
|
2341
|
-
quickFilters,
|
|
2342
|
-
advancedFilters,
|
|
2343
|
-
selectDistinctColumns
|
|
2344
|
-
} = this.state;
|
|
2345
|
-
var {
|
|
2346
|
-
columns
|
|
2347
|
-
} = model;
|
|
2348
|
-
var oldCustomColumns = model.customColumns.map(customColumn => "".concat(customColumn));
|
|
2349
|
-
var removedColumnNames = IrisGridUtils.getRemovedCustomColumnNames(oldCustomColumns, customColumns);
|
|
2350
|
-
if (removedColumnNames.length > 0) {
|
|
2351
|
-
var newSorts = IrisGridUtils.removeSortsInColumns(sorts, removedColumnNames);
|
|
2352
|
-
var newQuickFilters = IrisGridUtils.removeFiltersInColumns(columns, quickFilters, removedColumnNames);
|
|
2353
|
-
var newAdvancedFilters = IrisGridUtils.removeFiltersInColumns(columns, advancedFilters, removedColumnNames);
|
|
2354
|
-
var newMovedColumns = IrisGridUtils.removeColumnFromMovedColumns(columns, movedColumns, removedColumnNames);
|
|
2355
|
-
var newSelectDistinctColumns = IrisGridUtils.removeColumnsFromSelectDistinctColumns(selectDistinctColumns, removedColumnNames);
|
|
2356
|
-
if (newSorts.length !== sorts.length) {
|
|
2357
|
-
log.debug('removing sorts from removed custom columns...');
|
|
2358
|
-
this.setState({
|
|
2359
|
-
sorts: newSorts
|
|
2360
|
-
});
|
|
2361
|
-
}
|
|
2362
|
-
if (newQuickFilters.size !== quickFilters.size || newAdvancedFilters.size !== advancedFilters.size) {
|
|
2363
|
-
log.debug("removing filters from removed custom columns...");
|
|
2364
|
-
this.setState({
|
|
2365
|
-
quickFilters: newQuickFilters,
|
|
2366
|
-
advancedFilters: newAdvancedFilters
|
|
2367
|
-
});
|
|
2368
|
-
}
|
|
2369
|
-
if (!deepEqual(movedColumns, newMovedColumns)) {
|
|
2370
|
-
log.debug("change moved columns for removed custom columns", newMovedColumns);
|
|
2371
|
-
this.setState({
|
|
2372
|
-
movedColumns: newMovedColumns
|
|
2373
|
-
});
|
|
2374
|
-
}
|
|
2375
|
-
if (!deepEqual(selectDistinctColumns, newSelectDistinctColumns)) {
|
|
2376
|
-
log.debug("change selectDistinct columns for removed custom columns", newMovedColumns);
|
|
2377
|
-
this.setState({
|
|
2378
|
-
selectDistinctColumns: newSelectDistinctColumns
|
|
2379
|
-
});
|
|
2380
|
-
}
|
|
2381
|
-
}
|
|
2382
|
-
this.setState({
|
|
2383
|
-
customColumns
|
|
2384
|
-
});
|
|
2385
|
-
if (customColumns.length > 0) {
|
|
2386
|
-
// If there are no custom columns, the change handler never fires
|
|
2387
|
-
// This causes the loader to stay until canceled by the user
|
|
2388
|
-
this.startLoading('Applying custom columns...');
|
|
2389
|
-
}
|
|
2390
|
-
}
|
|
2391
|
-
handleCustomColumnsChanged() {
|
|
2392
|
-
log.debug('custom columns changed');
|
|
2393
|
-
var {
|
|
2394
|
-
isReady
|
|
2395
|
-
} = this.state;
|
|
2396
|
-
if (isReady) {
|
|
2397
|
-
var _this$grid22;
|
|
2398
|
-
this.stopLoading();
|
|
2399
|
-
(_this$grid22 = this.grid) === null || _this$grid22 === void 0 ? void 0 : _this$grid22.forceUpdate();
|
|
2400
|
-
} else {
|
|
2401
|
-
this.initState();
|
|
2402
|
-
}
|
|
2403
|
-
}
|
|
2404
|
-
handlePendingCommitClicked() {
|
|
2405
|
-
return this.commitPending();
|
|
2406
|
-
}
|
|
2407
|
-
handlePendingDiscardClicked() {
|
|
2408
|
-
return this.discardPending();
|
|
2409
|
-
}
|
|
2410
|
-
handlePendingDataUpdated() {
|
|
2411
|
-
var _this$grid23;
|
|
2412
|
-
log.debug('pending data updated');
|
|
2413
|
-
var {
|
|
2414
|
-
model
|
|
2415
|
-
} = this.props;
|
|
2416
|
-
var {
|
|
2417
|
-
pendingDataMap,
|
|
2418
|
-
pendingDataErrors
|
|
2419
|
-
} = model;
|
|
2420
|
-
this.setState({
|
|
2421
|
-
pendingDataMap,
|
|
2422
|
-
pendingDataErrors,
|
|
2423
|
-
pendingSaveError: null
|
|
2424
|
-
});
|
|
2425
|
-
(_this$grid23 = this.grid) === null || _this$grid23 === void 0 ? void 0 : _this$grid23.forceUpdate();
|
|
2426
|
-
}
|
|
2427
|
-
|
|
2428
|
-
/**
|
|
2429
|
-
* User added, removed, or changed the order of aggregations, or position
|
|
2430
|
-
* @param aggregationSettings The new aggregation settings
|
|
2431
|
-
*/
|
|
2432
|
-
handleAggregationsChange(aggregationSettings) {
|
|
2433
|
-
log.debug('handleAggregationsChange', aggregationSettings);
|
|
2434
|
-
this.startLoading("Aggregating ".concat(aggregationSettings.aggregations.map(a => a.operation).join(', '), "..."));
|
|
2435
|
-
this.setState({
|
|
2436
|
-
aggregationSettings
|
|
2437
|
-
});
|
|
2438
|
-
}
|
|
2439
|
-
|
|
2440
|
-
/**
|
|
2441
|
-
* A specific aggregation has been modified
|
|
2442
|
-
* @param aggregation The new aggregation
|
|
2443
|
-
*/
|
|
2444
|
-
handleAggregationChange(aggregation) {
|
|
2445
|
-
log.debug('handleAggregationChange', aggregation);
|
|
2446
|
-
this.startLoading("Aggregating ".concat(aggregation.operation, "..."));
|
|
2447
|
-
this.setState(_ref16 => {
|
|
2448
|
-
var {
|
|
2449
|
-
aggregationSettings
|
|
2450
|
-
} = _ref16;
|
|
2451
|
-
return {
|
|
2452
|
-
selectedAggregation: aggregation,
|
|
2453
|
-
aggregationSettings: _objectSpread(_objectSpread({}, aggregationSettings), {}, {
|
|
2454
|
-
aggregations: aggregationSettings.aggregations.map(a => a.operation === aggregation.operation ? aggregation : a)
|
|
2455
|
-
})
|
|
2456
|
-
};
|
|
2457
|
-
});
|
|
2458
|
-
}
|
|
2459
|
-
|
|
2460
|
-
/**
|
|
2461
|
-
* An aggregations has been selected for editing
|
|
2462
|
-
* @param aggregation The aggregation to edit
|
|
2463
|
-
*/
|
|
2464
|
-
handleAggregationEdit(aggregation) {
|
|
2465
|
-
log.debug('handleAggregationEdit', aggregation);
|
|
2466
|
-
var {
|
|
2467
|
-
openOptions
|
|
2468
|
-
} = this.state;
|
|
2469
|
-
this.setState({
|
|
2470
|
-
openOptions: [...openOptions, {
|
|
2471
|
-
type: OptionType.AGGREGATION_EDIT,
|
|
2472
|
-
title: "Edit Columns to ".concat(aggregation.operation)
|
|
2473
|
-
}],
|
|
2474
|
-
selectedAggregation: aggregation
|
|
2475
|
-
});
|
|
2476
|
-
}
|
|
2477
|
-
handleRollupChange(rollupConfig) {
|
|
2478
|
-
var _rollupConfig$columns, _rollupConfig$columns2;
|
|
2479
|
-
log.info('Rollup change', rollupConfig);
|
|
2480
|
-
this.resetGridViewState();
|
|
2481
|
-
this.showAllColumns();
|
|
2482
|
-
this.clearAllFilters();
|
|
2483
|
-
this.startLoading("Grouping by columns ".concat((_rollupConfig$columns = rollupConfig === null || rollupConfig === void 0 ? void 0 : (_rollupConfig$columns2 = rollupConfig.columns) === null || _rollupConfig$columns2 === void 0 ? void 0 : _rollupConfig$columns2.join(', ')) !== null && _rollupConfig$columns !== void 0 ? _rollupConfig$columns : '', "..."));
|
|
2484
|
-
|
|
2485
|
-
// Have to clear select distinct since rollup uses the original columns, not the current ones.
|
|
2486
|
-
// IrisGridProxyModel has a check to prevent model update
|
|
2487
|
-
// when selectDistinctModel is cleared and the rollupConfig is set on the model.
|
|
2488
|
-
this.setState({
|
|
2489
|
-
rollupConfig,
|
|
2490
|
-
movedColumns: [],
|
|
2491
|
-
frozenColumns: [],
|
|
2492
|
-
sorts: [],
|
|
2493
|
-
reverseType: TableUtils.REVERSE_TYPE.NONE,
|
|
2494
|
-
selectDistinctColumns: []
|
|
2495
|
-
});
|
|
2496
|
-
}
|
|
2497
|
-
handleSelectDistinctChanged(columnNames) {
|
|
2498
|
-
log.debug('SelectDistinct change', columnNames);
|
|
2499
|
-
this.resetGridViewState();
|
|
2500
|
-
this.showAllColumns();
|
|
2501
|
-
this.clearAllFilters();
|
|
2502
|
-
this.startLoading("Selecting distinct values in ".concat(columnNames.length > 0 ? columnNames.join(', ') : '', "..."));
|
|
2503
|
-
this.setState({
|
|
2504
|
-
selectDistinctColumns: columnNames,
|
|
2505
|
-
movedColumns: [],
|
|
2506
|
-
sorts: [],
|
|
2507
|
-
reverseType: TableUtils.REVERSE_TYPE.NONE
|
|
2508
|
-
});
|
|
2509
|
-
}
|
|
2510
|
-
handleDownloadTableStart() {
|
|
2511
|
-
var {
|
|
2512
|
-
canDownloadCsv
|
|
2513
|
-
} = this.props;
|
|
2514
|
-
if (canDownloadCsv) {
|
|
2515
|
-
this.setState({
|
|
2516
|
-
isTableDownloading: true,
|
|
2517
|
-
tableDownloadProgress: 0,
|
|
2518
|
-
tableDownloadEstimatedTime: null,
|
|
2519
|
-
tableDownloadStatus: TableCsvExporter.DOWNLOAD_STATUS.INITIATING
|
|
2520
|
-
});
|
|
2521
|
-
} else {
|
|
2522
|
-
log.error('Attempted to handleDownloadTableStart for user without download CSV permission.');
|
|
2523
|
-
}
|
|
2524
|
-
}
|
|
2525
|
-
handleDownloadTable(fileName, frozenTable, tableSubscription, snapshotRanges, modelRanges, includeColumnHeaders, useUnformattedValues) {
|
|
2526
|
-
var {
|
|
2527
|
-
canDownloadCsv
|
|
2528
|
-
} = this.props;
|
|
2529
|
-
if (canDownloadCsv) {
|
|
2530
|
-
log.info('start table downloading', fileName, frozenTable, tableSubscription, snapshotRanges, modelRanges, includeColumnHeaders, useUnformattedValues);
|
|
2531
|
-
this.setState(() => {
|
|
2532
|
-
if (this.tableSaver) {
|
|
2533
|
-
this.tableSaver.startDownload(fileName, frozenTable, tableSubscription, snapshotRanges, modelRanges, includeColumnHeaders, useUnformattedValues);
|
|
2534
|
-
}
|
|
2535
|
-
return {
|
|
2536
|
-
tableDownloadStatus: TableCsvExporter.DOWNLOAD_STATUS.DOWNLOADING
|
|
2537
|
-
};
|
|
2538
|
-
});
|
|
2539
|
-
} else {
|
|
2540
|
-
log.error('Attempted to handleDownloadTable for user without download CSV permission.');
|
|
2541
|
-
}
|
|
2542
|
-
}
|
|
2543
|
-
seekRow(inputString) {
|
|
2544
|
-
var _arguments = arguments,
|
|
2545
|
-
_this5 = this;
|
|
2546
|
-
return _asyncToGenerator(function* () {
|
|
2547
|
-
var _this5$grid;
|
|
2548
|
-
var isBackwards = _arguments.length > 1 && _arguments[1] !== undefined ? _arguments[1] : false;
|
|
2549
|
-
var {
|
|
2550
|
-
gotoValueSelectedColumnName: selectedColumnName,
|
|
2551
|
-
gotoValueSelectedFilter
|
|
2552
|
-
} = _this5.state;
|
|
2553
|
-
var {
|
|
2554
|
-
model
|
|
2555
|
-
} = _this5.props;
|
|
2556
|
-
var {
|
|
2557
|
-
dh
|
|
2558
|
-
} = model;
|
|
2559
|
-
if (!model.isSeekRowAvailable) {
|
|
2560
|
-
return;
|
|
2561
|
-
}
|
|
2562
|
-
if (inputString === '') {
|
|
2563
|
-
return;
|
|
2564
|
-
}
|
|
2565
|
-
var selectedColumn = IrisGridUtils.getColumnByName(model.columns, selectedColumnName);
|
|
2566
|
-
if (selectedColumn === undefined) {
|
|
2567
|
-
return;
|
|
2568
|
-
}
|
|
2569
|
-
var searchFromRow = (_this5$grid = _this5.grid) === null || _this5$grid === void 0 ? void 0 : _this5$grid.state.cursorRow;
|
|
2570
|
-
if (searchFromRow == null) {
|
|
2571
|
-
searchFromRow = 0;
|
|
2572
|
-
}
|
|
2573
|
-
var isContains = gotoValueSelectedFilter === FilterType.contains || gotoValueSelectedFilter === FilterType.containsIgnoreCase;
|
|
2574
|
-
var isIgnoreCase = gotoValueSelectedFilter === FilterType.eqIgnoreCase || gotoValueSelectedFilter === FilterType.containsIgnoreCase;
|
|
2575
|
-
try {
|
|
2576
|
-
var _this5$grid2;
|
|
2577
|
-
var {
|
|
2578
|
-
formatter
|
|
2579
|
-
} = model;
|
|
2580
|
-
var columnDataType = TableUtils.getNormalizedType(selectedColumn.type);
|
|
2581
|
-
var rowIndex;
|
|
2582
|
-
switch (columnDataType) {
|
|
2583
|
-
case TableUtils.dataType.CHAR:
|
|
2584
|
-
case TableUtils.dataType.STRING:
|
|
2585
|
-
{
|
|
2586
|
-
rowIndex = yield model.seekRow(searchFromRow, selectedColumn, dh.ValueType.STRING, inputString, isIgnoreCase, isContains, isBackwards !== null && isBackwards !== void 0 ? isBackwards : false);
|
|
2587
|
-
break;
|
|
2588
|
-
}
|
|
2589
|
-
case TableUtils.dataType.DATETIME:
|
|
2590
|
-
{
|
|
2591
|
-
var [startDate] = DateUtils.parseDateRange(dh, inputString, formatter.timeZone);
|
|
2592
|
-
rowIndex = yield model.seekRow(searchFromRow, selectedColumn, dh.ValueType.DATETIME, startDate, undefined, undefined, isBackwards !== null && isBackwards !== void 0 ? isBackwards : false);
|
|
2593
|
-
break;
|
|
2594
|
-
}
|
|
2595
|
-
case TableUtils.dataType.DECIMAL:
|
|
2596
|
-
case TableUtils.dataType.INT:
|
|
2597
|
-
{
|
|
2598
|
-
if (!TableUtils.isBigDecimalType(selectedColumn.type) && !TableUtils.isBigIntegerType(selectedColumn.type)) {
|
|
2599
|
-
var inputValue = parseInt(inputString, 10);
|
|
2600
|
-
if (inputString === '-Infinity') {
|
|
2601
|
-
inputValue = Number.NEGATIVE_INFINITY;
|
|
2602
|
-
} else if (inputString === 'Infinity') {
|
|
2603
|
-
inputValue = Number.POSITIVE_INFINITY;
|
|
2604
|
-
}
|
|
2605
|
-
rowIndex = yield model.seekRow(searchFromRow, selectedColumn, dh.ValueType.NUMBER, inputValue, undefined, undefined, isBackwards !== null && isBackwards !== void 0 ? isBackwards : false);
|
|
2606
|
-
} else {
|
|
2607
|
-
rowIndex = yield model.seekRow(searchFromRow, selectedColumn, dh.ValueType.STRING, inputString, undefined, undefined, isBackwards !== null && isBackwards !== void 0 ? isBackwards : false);
|
|
2608
|
-
}
|
|
2609
|
-
break;
|
|
2610
|
-
}
|
|
2611
|
-
default:
|
|
2612
|
-
{
|
|
2613
|
-
rowIndex = yield model.seekRow(searchFromRow, selectedColumn, dh.ValueType.STRING, _this5.tableUtils.makeValue(selectedColumn.type, inputString, formatter.timeZone), undefined, undefined, isBackwards !== null && isBackwards !== void 0 ? isBackwards : false);
|
|
2614
|
-
}
|
|
2615
|
-
}
|
|
2616
|
-
(_this5$grid2 = _this5.grid) === null || _this5$grid2 === void 0 ? void 0 : _this5$grid2.setFocusRow(rowIndex);
|
|
2617
|
-
_this5.setState({
|
|
2618
|
-
gotoValueError: ''
|
|
2619
|
-
});
|
|
2620
|
-
} catch (e) {
|
|
2621
|
-
_this5.setState({
|
|
2622
|
-
gotoValueError: 'invalid input'
|
|
2623
|
-
});
|
|
2624
|
-
}
|
|
2625
|
-
})();
|
|
2626
|
-
}
|
|
2627
|
-
handleCancelDownloadTable() {
|
|
2628
|
-
var _this$tableSaver;
|
|
2629
|
-
(_this$tableSaver = this.tableSaver) === null || _this$tableSaver === void 0 ? void 0 : _this$tableSaver.cancelDownload();
|
|
2630
|
-
this.setState({
|
|
2631
|
-
isTableDownloading: false
|
|
2632
|
-
});
|
|
2633
|
-
}
|
|
2634
|
-
handleDownloadCompleted() {
|
|
2635
|
-
this.setState({
|
|
2636
|
-
isTableDownloading: false,
|
|
2637
|
-
tableDownloadProgress: 100,
|
|
2638
|
-
tableDownloadStatus: TableCsvExporter.DOWNLOAD_STATUS.FINISHED
|
|
2639
|
-
});
|
|
2640
|
-
}
|
|
2641
|
-
handleDownloadCanceled() {
|
|
2642
|
-
this.setState({
|
|
2643
|
-
isTableDownloading: false,
|
|
2644
|
-
tableDownloadProgress: 0,
|
|
2645
|
-
tableDownloadStatus: TableCsvExporter.DOWNLOAD_STATUS.CANCELED
|
|
2646
|
-
});
|
|
2647
|
-
}
|
|
2648
|
-
|
|
2649
|
-
/**
|
|
2650
|
-
* Delete the specified ranges from the table.
|
|
2651
|
-
* @param ranges The ranges to delete
|
|
2652
|
-
*/
|
|
2653
|
-
deleteRanges(ranges) {
|
|
2654
|
-
var {
|
|
2655
|
-
model
|
|
2656
|
-
} = this.props;
|
|
2657
|
-
this.pending.add(model.delete(ranges)).catch(e => {
|
|
2658
|
-
if (!PromiseUtils.isCanceled(e)) {
|
|
2659
|
-
log.error('Unable to delete ranges', ranges, e);
|
|
2660
|
-
}
|
|
2661
|
-
});
|
|
2662
|
-
}
|
|
2663
|
-
resetColumnSelection() {
|
|
2664
|
-
if (this.grid == null) {
|
|
2665
|
-
return;
|
|
2666
|
-
}
|
|
2667
|
-
var {
|
|
2668
|
-
isSelectingColumn
|
|
2669
|
-
} = this.props;
|
|
2670
|
-
if (isSelectingColumn) {
|
|
2671
|
-
var {
|
|
2672
|
-
columnAllowedCursor
|
|
2673
|
-
} = this.props;
|
|
2674
|
-
this.grid.setState({
|
|
2675
|
-
cursor: columnAllowedCursor
|
|
2676
|
-
});
|
|
2677
|
-
} else {
|
|
2678
|
-
this.grid.setState({
|
|
2679
|
-
cursor: null
|
|
2680
|
-
});
|
|
2681
|
-
this.setState({
|
|
2682
|
-
hoverSelectColumn: null
|
|
2683
|
-
});
|
|
2684
|
-
}
|
|
2685
|
-
}
|
|
2686
|
-
resetGridViewState() {
|
|
2687
|
-
var forceUpdate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
2688
|
-
if (!this.grid) {
|
|
2689
|
-
return;
|
|
2690
|
-
}
|
|
2691
|
-
this.grid.clearSelectedRanges();
|
|
2692
|
-
this.grid.setViewState({
|
|
2693
|
-
left: 0,
|
|
2694
|
-
top: 0,
|
|
2695
|
-
topOffset: 0,
|
|
2696
|
-
leftOffset: 0
|
|
2697
|
-
}, forceUpdate);
|
|
2698
|
-
}
|
|
2699
|
-
sendStateChange() {
|
|
2700
|
-
if (!this.grid) {
|
|
2701
|
-
return;
|
|
2702
|
-
}
|
|
2703
|
-
var {
|
|
2704
|
-
state: irisGridState
|
|
2705
|
-
} = this;
|
|
2706
|
-
var {
|
|
2707
|
-
state: gridState
|
|
2708
|
-
} = this.grid;
|
|
2709
|
-
var {
|
|
2710
|
-
onStateChange
|
|
2711
|
-
} = this.props;
|
|
2712
|
-
onStateChange(irisGridState, gridState);
|
|
2713
|
-
}
|
|
2714
|
-
handleOverflowClose() {
|
|
2715
|
-
this.setState({
|
|
2716
|
-
showOverflowModal: false
|
|
2717
|
-
});
|
|
2718
|
-
}
|
|
2719
|
-
getColumnBoundingRect() {
|
|
2720
|
-
var _this$gridWrapper2;
|
|
2721
|
-
var {
|
|
2722
|
-
metrics,
|
|
2723
|
-
shownColumnTooltip
|
|
2724
|
-
} = this.state;
|
|
2725
|
-
assertNotNull(metrics);
|
|
2726
|
-
assertNotNull(shownColumnTooltip);
|
|
2727
|
-
var gridRect = (_this$gridWrapper2 = this.gridWrapper) === null || _this$gridWrapper2 === void 0 ? void 0 : _this$gridWrapper2.getBoundingClientRect();
|
|
2728
|
-
var popperMargin = 20;
|
|
2729
|
-
assertNotNull(gridRect);
|
|
2730
|
-
var {
|
|
2731
|
-
columnHeaderHeight,
|
|
2732
|
-
allColumnXs,
|
|
2733
|
-
allColumnWidths,
|
|
2734
|
-
width,
|
|
2735
|
-
columnHeaderMaxDepth
|
|
2736
|
-
} = metrics;
|
|
2737
|
-
var columnX = allColumnXs.get(shownColumnTooltip);
|
|
2738
|
-
var columnWidth = allColumnWidths.get(shownColumnTooltip);
|
|
2739
|
-
assertNotNull(columnX);
|
|
2740
|
-
assertNotNull(columnWidth);
|
|
2741
|
-
var left = gridRect.left + clamp(columnX + columnWidth / 2, popperMargin, width - popperMargin);
|
|
2742
|
-
return {
|
|
2743
|
-
top: gridRect.top + (columnHeaderMaxDepth - 1) * columnHeaderHeight,
|
|
2744
|
-
left: gridRect.left + clamp(columnX + columnWidth / 2, popperMargin, width - popperMargin),
|
|
2745
|
-
bottom: gridRect.top + columnHeaderMaxDepth * columnHeaderHeight,
|
|
2746
|
-
right: gridRect.left + clamp(columnX + columnWidth / 2, popperMargin, width - popperMargin) + 1,
|
|
2747
|
-
width: 1,
|
|
2748
|
-
height: columnHeaderHeight,
|
|
2749
|
-
x: left,
|
|
2750
|
-
y: gridRect.top,
|
|
2751
|
-
toJSON: () => {
|
|
2752
|
-
throw new Error('not implemented');
|
|
2753
|
-
}
|
|
2754
|
-
};
|
|
2755
|
-
}
|
|
2756
|
-
handleGotoRowSelectedRowNumberSubmit() {
|
|
2757
|
-
var {
|
|
2758
|
-
gotoRow: rowNumber
|
|
2759
|
-
} = this.state;
|
|
2760
|
-
this.focusRowInGrid(rowNumber);
|
|
2761
|
-
}
|
|
2762
|
-
focusRowInGrid(rowNumber) {
|
|
2763
|
-
var {
|
|
2764
|
-
model
|
|
2765
|
-
} = this.props;
|
|
2766
|
-
var {
|
|
2767
|
-
rowCount
|
|
2768
|
-
} = model;
|
|
2769
|
-
this.setState({
|
|
2770
|
-
gotoRow: rowNumber
|
|
2771
|
-
});
|
|
2772
|
-
if (rowNumber === '') {
|
|
2773
|
-
this.setState({
|
|
2774
|
-
gotoRowError: '',
|
|
2775
|
-
gotoValueError: ''
|
|
2776
|
-
});
|
|
2777
|
-
return;
|
|
2778
|
-
}
|
|
2779
|
-
var rowInt = parseInt(rowNumber, 10);
|
|
2780
|
-
if (rowInt > rowCount || rowInt < -rowCount) {
|
|
2781
|
-
this.setState({
|
|
2782
|
-
gotoRowError: 'Invalid row index'
|
|
2783
|
-
});
|
|
2784
|
-
} else if (rowInt === 0) {
|
|
2785
|
-
var _this$grid24;
|
|
2786
|
-
this.setState({
|
|
2787
|
-
gotoRowError: '',
|
|
2788
|
-
gotoValueError: ''
|
|
2789
|
-
});
|
|
2790
|
-
(_this$grid24 = this.grid) === null || _this$grid24 === void 0 ? void 0 : _this$grid24.setFocusRow(0);
|
|
2791
|
-
} else if (rowInt < 0) {
|
|
2792
|
-
var _this$grid25;
|
|
2793
|
-
this.setState({
|
|
2794
|
-
gotoRowError: '',
|
|
2795
|
-
gotoValueError: ''
|
|
2796
|
-
});
|
|
2797
|
-
(_this$grid25 = this.grid) === null || _this$grid25 === void 0 ? void 0 : _this$grid25.setFocusRow(rowInt + rowCount);
|
|
2798
|
-
} else {
|
|
2799
|
-
var _this$grid26;
|
|
2800
|
-
(_this$grid26 = this.grid) === null || _this$grid26 === void 0 ? void 0 : _this$grid26.setFocusRow(rowInt - 1);
|
|
2801
|
-
this.setState({
|
|
2802
|
-
gotoRowError: '',
|
|
2803
|
-
gotoValueError: ''
|
|
2804
|
-
});
|
|
2805
|
-
}
|
|
2806
|
-
}
|
|
2807
|
-
handleGotoRowSelectedRowNumberChanged(event) {
|
|
2808
|
-
var rowNumber = event.target.value;
|
|
2809
|
-
this.focusRowInGrid(rowNumber);
|
|
2810
|
-
}
|
|
2811
|
-
getColumnTooltip(visibleIndex, metrics, model) {
|
|
2812
|
-
var {
|
|
2813
|
-
columnHeaderHeight,
|
|
2814
|
-
columnHeaderMaxDepth,
|
|
2815
|
-
allColumnXs,
|
|
2816
|
-
allColumnWidths,
|
|
2817
|
-
width
|
|
2818
|
-
} = metrics;
|
|
2819
|
-
var columnX = allColumnXs.get(visibleIndex);
|
|
2820
|
-
var columnWidth = allColumnWidths.get(visibleIndex);
|
|
2821
|
-
if (columnX == null || columnWidth == null) {
|
|
2822
|
-
return null;
|
|
2823
|
-
}
|
|
2824
|
-
|
|
2825
|
-
/**
|
|
2826
|
-
* Create a wrapper dom element, the size of the column header.
|
|
2827
|
-
* The wrapper acts as tooltip parent, the tooltip component
|
|
2828
|
-
* will trigger hide on mouseleave of wrapper or tooltip.
|
|
2829
|
-
* The wrapper should be bound to within the grid dimensions,
|
|
2830
|
-
* so popper only remains triggered while mouse is inside the panel.
|
|
2831
|
-
*/
|
|
2832
|
-
var boundedLeft = Math.max(0, columnX);
|
|
2833
|
-
var boundedWidth = columnWidth;
|
|
2834
|
-
if (columnX + columnWidth > width) {
|
|
2835
|
-
// column is extending past right edge
|
|
2836
|
-
boundedWidth = width - columnX;
|
|
2837
|
-
} else if (columnX < 0) {
|
|
2838
|
-
// column is extending past left edge
|
|
2839
|
-
boundedWidth = columnWidth - Math.abs(columnX);
|
|
2840
|
-
}
|
|
2841
|
-
var wrapperStyle = {
|
|
2842
|
-
position: 'absolute',
|
|
2843
|
-
top: (columnHeaderMaxDepth - 1) * columnHeaderHeight,
|
|
2844
|
-
left: boundedLeft,
|
|
2845
|
-
width: boundedWidth,
|
|
2846
|
-
height: columnHeaderHeight,
|
|
2847
|
-
pointerEvents: 'none'
|
|
2848
|
-
};
|
|
2849
|
-
|
|
2850
|
-
/**
|
|
2851
|
-
* Because the popper parent wrapper center is no longer the same as
|
|
2852
|
-
* the column label center, we create a popper virtual ref, to handle
|
|
2853
|
-
* positioning and keep the popper centered on the label. Creates a
|
|
2854
|
-
* 1px x headerHeight virtual object, placed centered on the column
|
|
2855
|
-
* label, clamped to 0 + margin to width - margin. We add a margin,
|
|
2856
|
-
* otherwise the arrow wants to escape the boundary.
|
|
2857
|
-
*/
|
|
2858
|
-
var virtualReference = {
|
|
2859
|
-
clientWidth: 1,
|
|
2860
|
-
clientHeight: columnHeaderHeight,
|
|
2861
|
-
getBoundingClientRect: this.getColumnBoundingRect
|
|
2862
|
-
};
|
|
2863
|
-
var popperOptions = {
|
|
2864
|
-
placement: 'bottom',
|
|
2865
|
-
modifiers: {
|
|
2866
|
-
flip: {
|
|
2867
|
-
behavior: ['bottom', 'top']
|
|
2868
|
-
}
|
|
2869
|
-
}
|
|
2870
|
-
};
|
|
2871
|
-
var modelColumn = this.getModelColumn(visibleIndex);
|
|
2872
|
-
if (modelColumn == null) return null;
|
|
2873
|
-
var column = model.columns[modelColumn];
|
|
2874
|
-
if (column == null) return null;
|
|
2875
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
2876
|
-
style: wrapperStyle
|
|
2877
|
-
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
2878
|
-
key: column.name,
|
|
2879
|
-
timeout: 400,
|
|
2880
|
-
interactive: true,
|
|
2881
|
-
options: popperOptions,
|
|
2882
|
-
ref: this.handleTooltipRef,
|
|
2883
|
-
referenceObject: virtualReference,
|
|
2884
|
-
onExited: () => {
|
|
2885
|
-
this.setState({
|
|
2886
|
-
shownColumnTooltip: null
|
|
2887
|
-
});
|
|
2888
|
-
}
|
|
2889
|
-
}, /*#__PURE__*/React.createElement(ColumnStatistics, {
|
|
2890
|
-
model: model,
|
|
2891
|
-
column: column,
|
|
2892
|
-
onStatistics: () => {
|
|
2893
|
-
var _this$tooltip;
|
|
2894
|
-
(_this$tooltip = this.tooltip) === null || _this$tooltip === void 0 ? void 0 : _this$tooltip.update();
|
|
2895
|
-
}
|
|
2896
|
-
})));
|
|
2897
|
-
}
|
|
2898
|
-
handleGotoValueSelectedColumnNameChanged(columnName) {
|
|
2899
|
-
var _this$grid27;
|
|
2900
|
-
var {
|
|
2901
|
-
model
|
|
2902
|
-
} = this.props;
|
|
2903
|
-
var cursorRow = (_this$grid27 = this.grid) === null || _this$grid27 === void 0 ? void 0 : _this$grid27.state.cursorRow;
|
|
2904
|
-
if (cursorRow != null) {
|
|
2905
|
-
var _index = model.getColumnIndexByName(columnName);
|
|
2906
|
-
var _column3 = IrisGridUtils.getColumnByName(model.columns, columnName);
|
|
2907
|
-
if (_index == null || _column3 == null) {
|
|
2908
|
-
return;
|
|
2909
|
-
}
|
|
2910
|
-
var _value4 = model.valueForCell(_index, cursorRow);
|
|
2911
|
-
var text = IrisGridUtils.convertValueToText(_value4, _column3.type);
|
|
2912
|
-
this.setState({
|
|
2913
|
-
gotoValueSelectedColumnName: columnName,
|
|
2914
|
-
gotoValue: text,
|
|
2915
|
-
gotoValueError: ''
|
|
2916
|
-
});
|
|
2917
|
-
}
|
|
2918
|
-
this.setState({
|
|
2919
|
-
gotoValueSelectedColumnName: columnName,
|
|
2920
|
-
gotoValueError: ''
|
|
2921
|
-
});
|
|
2922
|
-
}
|
|
2923
|
-
handleGotoValueSelectedFilterChanged(value) {
|
|
2924
|
-
this.setState({
|
|
2925
|
-
gotoValueSelectedFilter: value,
|
|
2926
|
-
gotoValueError: ''
|
|
2927
|
-
});
|
|
2928
|
-
}
|
|
2929
|
-
handleGotoValueSubmitted(isBackwards) {
|
|
2930
|
-
var {
|
|
2931
|
-
gotoValue
|
|
2932
|
-
} = this.state;
|
|
2933
|
-
this.seekRow(gotoValue, isBackwards);
|
|
2934
|
-
}
|
|
2935
|
-
render() {
|
|
2936
|
-
var _rollupConfig$columns3,
|
|
2937
|
-
_rollupConfig$columns4,
|
|
2938
|
-
_this6 = this,
|
|
2939
|
-
_this$grid29,
|
|
2940
|
-
_this$grid29$state$dr,
|
|
2941
|
-
_openOptions;
|
|
2942
|
-
var {
|
|
2943
|
-
children,
|
|
2944
|
-
customFilters,
|
|
2945
|
-
getDownloadWorker,
|
|
2946
|
-
isSelectingColumn,
|
|
2947
|
-
isStuckToBottom,
|
|
2948
|
-
isStuckToRight,
|
|
2949
|
-
model,
|
|
2950
|
-
name,
|
|
2951
|
-
onlyFetchVisibleColumns,
|
|
2952
|
-
alwaysFetchColumns,
|
|
2953
|
-
advancedSettings,
|
|
2954
|
-
onAdvancedSettingsChange,
|
|
2955
|
-
canDownloadCsv,
|
|
2956
|
-
onCreateChart
|
|
2957
|
-
} = this.props;
|
|
2958
|
-
var {
|
|
2959
|
-
metricCalculator,
|
|
2960
|
-
metrics,
|
|
2961
|
-
isFilterBarShown,
|
|
2962
|
-
isSelectingPartition,
|
|
2963
|
-
isMenuShown,
|
|
2964
|
-
isReady,
|
|
2965
|
-
copyOperation,
|
|
2966
|
-
focusedFilterBarColumn,
|
|
2967
|
-
loadingText,
|
|
2968
|
-
loadingScrimProgress,
|
|
2969
|
-
loadingSpinnerShown,
|
|
2970
|
-
keyHandlers,
|
|
2971
|
-
mouseHandlers,
|
|
2972
|
-
shownColumnTooltip,
|
|
2973
|
-
hoverAdvancedFilter,
|
|
2974
|
-
shownAdvancedFilter,
|
|
2975
|
-
hoverSelectColumn,
|
|
2976
|
-
quickFilters,
|
|
2977
|
-
advancedFilters,
|
|
2978
|
-
partition,
|
|
2979
|
-
partitionFilters,
|
|
2980
|
-
partitionTable,
|
|
2981
|
-
partitionColumn,
|
|
2982
|
-
searchFilter,
|
|
2983
|
-
selectDistinctColumns,
|
|
2984
|
-
movedColumns,
|
|
2985
|
-
movedRows,
|
|
2986
|
-
formatter,
|
|
2987
|
-
conditionalFormats,
|
|
2988
|
-
conditionalFormatPreview,
|
|
2989
|
-
conditionalFormatEditIndex,
|
|
2990
|
-
sorts,
|
|
2991
|
-
reverseType,
|
|
2992
|
-
customColumns,
|
|
2993
|
-
selectedRanges,
|
|
2994
|
-
isTableDownloading,
|
|
2995
|
-
tableDownloadStatus,
|
|
2996
|
-
tableDownloadProgress,
|
|
2997
|
-
tableDownloadEstimatedTime,
|
|
2998
|
-
showSearchBar,
|
|
2999
|
-
searchValue,
|
|
3000
|
-
selectedSearchColumns,
|
|
3001
|
-
invertSearchColumns,
|
|
3002
|
-
aggregationSettings,
|
|
3003
|
-
selectedAggregation,
|
|
3004
|
-
rollupConfig,
|
|
3005
|
-
openOptions,
|
|
3006
|
-
pendingSavePromise,
|
|
3007
|
-
pendingSaveError,
|
|
3008
|
-
pendingRowCount,
|
|
3009
|
-
pendingDataErrors,
|
|
3010
|
-
pendingDataMap,
|
|
3011
|
-
toastMessage,
|
|
3012
|
-
frozenColumns,
|
|
3013
|
-
columnHeaderGroups,
|
|
3014
|
-
showOverflowModal,
|
|
3015
|
-
overflowText,
|
|
3016
|
-
overflowButtonTooltipProps,
|
|
3017
|
-
expandCellTooltipProps,
|
|
3018
|
-
linkHoverTooltipProps,
|
|
3019
|
-
isGotoShown,
|
|
3020
|
-
gotoRow,
|
|
3021
|
-
gotoRowError,
|
|
3022
|
-
gotoValueError,
|
|
3023
|
-
gotoValueSelectedColumnName,
|
|
3024
|
-
gotoValue,
|
|
3025
|
-
gotoValueSelectedFilter
|
|
3026
|
-
} = this.state;
|
|
3027
|
-
if (!isReady) {
|
|
3028
|
-
return null;
|
|
3029
|
-
}
|
|
3030
|
-
var theme = this.getTheme();
|
|
3031
|
-
var filter = this.getCachedFilter(customFilters, quickFilters, advancedFilters, partitionFilters, searchFilter);
|
|
3032
|
-
var userColumnWidths = metricCalculator.getUserColumnWidths();
|
|
3033
|
-
var stateOverride = this.getCachedStateOverride(hoverSelectColumn, isFilterBarShown, isSelectingColumn, loadingScrimProgress, quickFilters, advancedFilters, sorts, reverseType, rollupConfig, isMenuShown);
|
|
3034
|
-
var top = metrics ? metrics.top : 0;
|
|
3035
|
-
var bottom = metrics ? metrics.bottomViewport : 0;
|
|
3036
|
-
var left = null;
|
|
3037
|
-
var right = null;
|
|
3038
|
-
if (onlyFetchVisibleColumns) {
|
|
3039
|
-
left = metrics ? metrics.left : 0;
|
|
3040
|
-
right = metrics ? metrics.right : 0;
|
|
3041
|
-
}
|
|
3042
|
-
var isVisible = metrics != null && metrics.width > 0 && metrics.height > 0;
|
|
3043
|
-
var isRollup = ((_rollupConfig$columns3 = rollupConfig === null || rollupConfig === void 0 ? void 0 : (_rollupConfig$columns4 = rollupConfig.columns) === null || _rollupConfig$columns4 === void 0 ? void 0 : _rollupConfig$columns4.length) !== null && _rollupConfig$columns3 !== void 0 ? _rollupConfig$columns3 : 0) > 0;
|
|
3044
|
-
var focusField = null;
|
|
3045
|
-
var debounceMs = metrics ? Math.min(Math.max(IrisGrid.minDebounce, Math.round(metrics.rowCount / 200)), IrisGrid.maxDebounce) : IrisGrid.maxDebounce;
|
|
3046
|
-
if (isFilterBarShown && focusedFilterBarColumn != null && metrics != null) {
|
|
3047
|
-
var {
|
|
3048
|
-
gridX,
|
|
3049
|
-
gridY,
|
|
3050
|
-
allColumnXs,
|
|
3051
|
-
allColumnWidths,
|
|
3052
|
-
width
|
|
3053
|
-
} = metrics;
|
|
3054
|
-
var columnX = allColumnXs.get(focusedFilterBarColumn);
|
|
3055
|
-
var columnWidth = allColumnWidths.get(focusedFilterBarColumn);
|
|
3056
|
-
if (columnX != null && columnWidth != null) {
|
|
3057
|
-
var _theme$filterBarHeigh, _theme$filterBarHeigh2, _this$grid28;
|
|
3058
|
-
var x = gridX + columnX;
|
|
3059
|
-
var y = gridY - ((_theme$filterBarHeigh = theme.filterBarHeight) !== null && _theme$filterBarHeigh !== void 0 ? _theme$filterBarHeigh : 0);
|
|
3060
|
-
var fieldWidth = columnWidth + 1; // cover right border
|
|
3061
|
-
var fieldHeight = ((_theme$filterBarHeigh2 = theme.filterBarHeight) !== null && _theme$filterBarHeigh2 !== void 0 ? _theme$filterBarHeigh2 : 0) - 1; // remove bottom border
|
|
3062
|
-
var style = {
|
|
3063
|
-
top: y,
|
|
3064
|
-
left: x,
|
|
3065
|
-
minWidth: Math.min(fieldWidth, width - x),
|
|
3066
|
-
// Don't cause overflow
|
|
3067
|
-
height: fieldHeight
|
|
3068
|
-
};
|
|
3069
|
-
var _value5 = '';
|
|
3070
|
-
var isValid = true;
|
|
3071
|
-
var modelColumn = this.getModelColumn(focusedFilterBarColumn);
|
|
3072
|
-
assertNotNull(modelColumn);
|
|
3073
|
-
var quickFilter = quickFilters.get(modelColumn);
|
|
3074
|
-
var advancedFilter = advancedFilters.get(modelColumn);
|
|
3075
|
-
if (quickFilter != null) {
|
|
3076
|
-
_value5 = quickFilter.text;
|
|
3077
|
-
isValid = quickFilter.filter != null;
|
|
3078
|
-
}
|
|
3079
|
-
var isBarFiltered = quickFilters.size !== 0 || advancedFilters.size !== 0;
|
|
3080
|
-
focusField = /*#__PURE__*/React.createElement(FilterInputField, {
|
|
3081
|
-
ref: this.filterInputRef,
|
|
3082
|
-
style: style,
|
|
3083
|
-
className: classNames({
|
|
3084
|
-
error: !isValid,
|
|
3085
|
-
active: _value5 !== '' || advancedFilter != null,
|
|
3086
|
-
'iris-grid-has-filter': isBarFiltered
|
|
3087
|
-
}),
|
|
3088
|
-
isAdvancedFilterSet: advancedFilter != null,
|
|
3089
|
-
onAdvancedFiltersTriggered: () => {
|
|
3090
|
-
this.setState({
|
|
3091
|
-
shownAdvancedFilter: focusedFilterBarColumn
|
|
3092
|
-
});
|
|
3093
|
-
},
|
|
3094
|
-
key: focusedFilterBarColumn,
|
|
3095
|
-
onChange: this.handleFilterBarChange,
|
|
3096
|
-
onDone: this.handleFilterBarDone,
|
|
3097
|
-
onTab: this.handleFilterBarTab,
|
|
3098
|
-
onContextMenu: (_this$grid28 = this.grid) === null || _this$grid28 === void 0 ? void 0 : _this$grid28.handleContextMenu,
|
|
3099
|
-
debounceMs: debounceMs,
|
|
3100
|
-
value: _value5
|
|
3101
|
-
});
|
|
3102
|
-
}
|
|
3103
|
-
}
|
|
3104
|
-
var loadingElement = null;
|
|
3105
|
-
if (loadingText != null) {
|
|
3106
|
-
var loadingStatus = /*#__PURE__*/React.createElement("div", {
|
|
3107
|
-
className: "iris-grid-loading-status"
|
|
3108
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
3109
|
-
className: classNames('iris-grid-loading-status-bar', {
|
|
3110
|
-
show: loadingSpinnerShown
|
|
3111
|
-
})
|
|
3112
|
-
}, loadingText), /*#__PURE__*/React.createElement("button", {
|
|
3113
|
-
type: "button",
|
|
3114
|
-
onClick: this.handleCancel,
|
|
3115
|
-
className: classNames('iris-grid-btn-cancel', {
|
|
3116
|
-
show: loadingSpinnerShown
|
|
3117
|
-
})
|
|
3118
|
-
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
3119
|
-
icon: vsClose,
|
|
3120
|
-
transform: "down-1"
|
|
3121
|
-
}), "Cancel"));
|
|
3122
|
-
var _gridY = metrics ? metrics.gridY : 0;
|
|
3123
|
-
loadingElement = /*#__PURE__*/React.createElement("div", {
|
|
3124
|
-
className: "iris-grid-loading",
|
|
3125
|
-
style: {
|
|
3126
|
-
top: _gridY
|
|
3127
|
-
}
|
|
3128
|
-
}, loadingStatus);
|
|
3129
|
-
}
|
|
3130
|
-
var columnTooltip = null;
|
|
3131
|
-
if (shownColumnTooltip != null && metrics) {
|
|
3132
|
-
var _this$tooltip2;
|
|
3133
|
-
columnTooltip = this.getColumnTooltip(shownColumnTooltip, metrics, model);
|
|
3134
|
-
// #510 We may need to update the position of the tooltip if it's already opened and columns are resized
|
|
3135
|
-
(_this$tooltip2 = this.tooltip) === null || _this$tooltip2 === void 0 ? void 0 : _this$tooltip2.update();
|
|
3136
|
-
}
|
|
3137
|
-
var filterBar = [];
|
|
3138
|
-
if (metrics && isFilterBarShown) {
|
|
3139
|
-
var {
|
|
3140
|
-
gridX: _gridX,
|
|
3141
|
-
gridY: _gridY2,
|
|
3142
|
-
visibleColumns,
|
|
3143
|
-
allColumnXs: _allColumnXs,
|
|
3144
|
-
allColumnWidths: _allColumnWidths
|
|
3145
|
-
} = metrics;
|
|
3146
|
-
var {
|
|
3147
|
-
filterBarHeight
|
|
3148
|
-
} = theme;
|
|
3149
|
-
var _loop2 = function _loop2() {
|
|
3150
|
-
var columnIndex = visibleColumns[i];
|
|
3151
|
-
var columnX = _allColumnXs.get(columnIndex);
|
|
3152
|
-
var columnWidth = _allColumnWidths.get(columnIndex);
|
|
3153
|
-
var modelColumn = _this6.getModelColumn(columnIndex);
|
|
3154
|
-
if (modelColumn != null) {
|
|
3155
|
-
var isFilterable = model.isFilterable(modelColumn);
|
|
3156
|
-
if (isFilterable && columnX != null && columnWidth != null && columnWidth > 0) {
|
|
3157
|
-
var _x = _gridX + columnX + columnWidth - 24;
|
|
3158
|
-
var _y = _gridY2 - (filterBarHeight !== null && filterBarHeight !== void 0 ? filterBarHeight : 0) + 2; // 2 acts as top margin for the button
|
|
3159
|
-
var _style = {
|
|
3160
|
-
position: 'absolute',
|
|
3161
|
-
top: _y,
|
|
3162
|
-
left: _x
|
|
3163
|
-
};
|
|
3164
|
-
var _advancedFilter = advancedFilters.get(modelColumn);
|
|
3165
|
-
var isFilterSet = _advancedFilter != null;
|
|
3166
|
-
var isFilterVisible = columnIndex === hoverAdvancedFilter || columnIndex === focusedFilterBarColumn || isFilterSet;
|
|
3167
|
-
var element = /*#__PURE__*/React.createElement("div", {
|
|
3168
|
-
className: classNames('advanced-filter-button-container', {
|
|
3169
|
-
hidden: !isFilterVisible
|
|
3170
|
-
}),
|
|
3171
|
-
key: columnIndex,
|
|
3172
|
-
style: _style
|
|
3173
|
-
}, isFilterVisible && /*#__PURE__*/React.createElement(Button, {
|
|
3174
|
-
kind: "ghost",
|
|
3175
|
-
className: classNames('btn-link-icon advanced-filter-button', {
|
|
3176
|
-
'filter-set': isFilterSet
|
|
3177
|
-
}),
|
|
3178
|
-
onClick: () => {
|
|
3179
|
-
_this6.setState({
|
|
3180
|
-
shownAdvancedFilter: columnIndex
|
|
3181
|
-
});
|
|
3182
|
-
},
|
|
3183
|
-
onContextMenu: event => {
|
|
3184
|
-
var _this6$grid;
|
|
3185
|
-
(_this6$grid = _this6.grid) === null || _this6$grid === void 0 ? void 0 : _this6$grid.handleContextMenu(event);
|
|
3186
|
-
},
|
|
3187
|
-
onMouseEnter: () => {
|
|
3188
|
-
_this6.setState({
|
|
3189
|
-
hoverAdvancedFilter: columnIndex
|
|
3190
|
-
});
|
|
3191
|
-
},
|
|
3192
|
-
onMouseLeave: () => {
|
|
3193
|
-
_this6.setState({
|
|
3194
|
-
hoverAdvancedFilter: null
|
|
3195
|
-
});
|
|
3196
|
-
}
|
|
3197
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
3198
|
-
className: "fa-layers"
|
|
3199
|
-
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
3200
|
-
icon: dhFilterFilled,
|
|
3201
|
-
className: "filter-solid"
|
|
3202
|
-
}), /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
3203
|
-
icon: vsFilter,
|
|
3204
|
-
className: "filter-light"
|
|
3205
|
-
}))));
|
|
3206
|
-
filterBar.push(element);
|
|
3207
|
-
}
|
|
3208
|
-
}
|
|
3209
|
-
};
|
|
3210
|
-
for (var i = 0; i < visibleColumns.length; i += 1) {
|
|
3211
|
-
_loop2();
|
|
3212
|
-
}
|
|
3213
|
-
}
|
|
3214
|
-
var advancedFilterMenus = [];
|
|
3215
|
-
if (metrics) {
|
|
3216
|
-
var {
|
|
3217
|
-
gridX: _gridX2,
|
|
3218
|
-
visibleColumns: _visibleColumns,
|
|
3219
|
-
allColumnXs: _allColumnXs2,
|
|
3220
|
-
allColumnWidths: _allColumnWidths2,
|
|
3221
|
-
columnHeaderHeight
|
|
3222
|
-
} = metrics;
|
|
3223
|
-
var _loop3 = function _loop3() {
|
|
3224
|
-
var columnIndex = _visibleColumns[_i3];
|
|
3225
|
-
var columnX = _allColumnXs2.get(columnIndex);
|
|
3226
|
-
var columnWidth = _allColumnWidths2.get(columnIndex);
|
|
3227
|
-
if (columnX != null && columnWidth != null && columnWidth > 0) {
|
|
3228
|
-
var xColumnHeader = _gridX2 + columnX;
|
|
3229
|
-
var xFilterBar = _gridX2 + columnX + columnWidth - 20;
|
|
3230
|
-
var _style2 = isFilterBarShown ? {
|
|
3231
|
-
position: 'absolute',
|
|
3232
|
-
top: columnHeaderHeight,
|
|
3233
|
-
left: xFilterBar,
|
|
3234
|
-
width: 20,
|
|
3235
|
-
height: theme.filterBarHeight
|
|
3236
|
-
} : {
|
|
3237
|
-
position: 'absolute',
|
|
3238
|
-
top: 0,
|
|
3239
|
-
left: xColumnHeader,
|
|
3240
|
-
width: columnWidth,
|
|
3241
|
-
height: columnHeaderHeight
|
|
3242
|
-
};
|
|
3243
|
-
var _modelColumn = _this6.getModelColumn(columnIndex);
|
|
3244
|
-
if (_modelColumn != null) {
|
|
3245
|
-
var _column4 = model.columns[_modelColumn];
|
|
3246
|
-
if (_column4 == null) {
|
|
3247
|
-
// Grid metrics is likely out of sync with model
|
|
3248
|
-
log.warn("Column does not exist at index ".concat(_modelColumn, " for column array of length ").concat(model.columns.length));
|
|
3249
|
-
// eslint-disable-next-line no-continue
|
|
3250
|
-
return "continue";
|
|
3251
|
-
}
|
|
3252
|
-
var _advancedFilter2 = advancedFilters.get(_modelColumn);
|
|
3253
|
-
var {
|
|
3254
|
-
options: advancedFilterOptions
|
|
3255
|
-
} = _advancedFilter2 || {};
|
|
3256
|
-
var sort = TableUtils.getSortForColumn(model.sort, _column4.name);
|
|
3257
|
-
var sortDirection = sort ? sort.direction : null;
|
|
3258
|
-
var element = /*#__PURE__*/React.createElement("div", {
|
|
3259
|
-
key: columnIndex,
|
|
3260
|
-
className: "advanced-filter-menu-container",
|
|
3261
|
-
style: _style2
|
|
3262
|
-
}, /*#__PURE__*/React.createElement(Popper, {
|
|
3263
|
-
className: "advanced-filter-menu-popper",
|
|
3264
|
-
onEntered: _this6.getAdvancedMenuOpenedHandler(columnIndex),
|
|
3265
|
-
onExited: () => {
|
|
3266
|
-
_this6.handleAdvancedMenuClosed(columnIndex);
|
|
3267
|
-
},
|
|
3268
|
-
isShown: shownAdvancedFilter === columnIndex,
|
|
3269
|
-
interactive: true,
|
|
3270
|
-
closeOnBlur: true,
|
|
3271
|
-
options: {
|
|
3272
|
-
positionFixed: true
|
|
3273
|
-
}
|
|
3274
|
-
}, _this6.getCachedAdvancedFilterMenuActions(model, _column4, advancedFilterOptions, sortDirection, formatter)));
|
|
3275
|
-
advancedFilterMenus.push(element);
|
|
3276
|
-
}
|
|
3277
|
-
}
|
|
3278
|
-
};
|
|
3279
|
-
for (var _i3 = 0; _i3 < _visibleColumns.length; _i3 += 1) {
|
|
3280
|
-
var _ret = _loop3();
|
|
3281
|
-
if (_ret === "continue") continue;
|
|
3282
|
-
}
|
|
3283
|
-
}
|
|
3284
|
-
var optionItems = this.getCachedOptionItems(onCreateChart !== undefined && model.isChartBuilderAvailable, model.isCustomColumnsAvailable, model.isFormatColumnsAvailable, model.isRollupAvailable, model.isTotalsAvailable || isRollup, model.isSelectDistinctAvailable, model.isExportAvailable, this.toggleFilterBarAction, this.toggleSearchBarAction, this.toggleGotoRowAction, isFilterBarShown, showSearchBar, canDownloadCsv, this.isTableSearchAvailable(), isGotoShown, advancedSettings.size > 0);
|
|
3285
|
-
var hiddenColumns = this.getCachedHiddenColumns(metricCalculator, userColumnWidths);
|
|
3286
|
-
var openOptionsStack = openOptions.map(option => {
|
|
3287
|
-
switch (option.type) {
|
|
3288
|
-
case OptionType.CHART_BUILDER:
|
|
3289
|
-
return /*#__PURE__*/React.createElement(ChartBuilder, {
|
|
3290
|
-
model: model,
|
|
3291
|
-
onChange: this.handleChartChange,
|
|
3292
|
-
onSubmit: this.handleChartCreate,
|
|
3293
|
-
key: OptionType.CHART_BUILDER
|
|
3294
|
-
});
|
|
3295
|
-
case OptionType.VISIBILITY_ORDERING_BUILDER:
|
|
3296
|
-
return /*#__PURE__*/React.createElement(VisibilityOrderingBuilder, {
|
|
3297
|
-
model: model,
|
|
3298
|
-
movedColumns: movedColumns,
|
|
3299
|
-
hiddenColumns: hiddenColumns,
|
|
3300
|
-
columnHeaderGroups: columnHeaderGroups,
|
|
3301
|
-
onColumnVisibilityChanged: this.handleColumnVisibilityChanged,
|
|
3302
|
-
onReset: this.handleColumnVisibilityReset,
|
|
3303
|
-
onMovedColumnsChanged: this.handleMovedColumnsChanged,
|
|
3304
|
-
onColumnHeaderGroupChanged: this.handleHeaderGroupsChanged,
|
|
3305
|
-
key: OptionType.VISIBILITY_ORDERING_BUILDER
|
|
3306
|
-
});
|
|
3307
|
-
case OptionType.CONDITIONAL_FORMATTING:
|
|
3308
|
-
return /*#__PURE__*/React.createElement(ConditionalFormattingMenu, {
|
|
3309
|
-
rules: conditionalFormats,
|
|
3310
|
-
onChange: this.handleConditionalFormatsChange,
|
|
3311
|
-
onCreate: this.handleConditionalFormatCreate,
|
|
3312
|
-
onSelect: this.handleConditionalFormatEdit
|
|
3313
|
-
});
|
|
3314
|
-
case OptionType.CONDITIONAL_FORMATTING_EDIT:
|
|
3315
|
-
assertNotNull(model.columns);
|
|
3316
|
-
assertNotNull(this.handleConditionalFormatEditorUpdate);
|
|
3317
|
-
return /*#__PURE__*/React.createElement(ConditionalFormatEditor, {
|
|
3318
|
-
dh: model.dh,
|
|
3319
|
-
columns: model.columns,
|
|
3320
|
-
rule: conditionalFormatPreview,
|
|
3321
|
-
onUpdate: this.handleConditionalFormatEditorUpdate,
|
|
3322
|
-
onSave: this.handleConditionalFormatEditorSave,
|
|
3323
|
-
onCancel: this.handleConditionalFormatEditorCancel
|
|
3324
|
-
});
|
|
3325
|
-
case OptionType.CUSTOM_COLUMN_BUILDER:
|
|
3326
|
-
return /*#__PURE__*/React.createElement(CustomColumnBuilder, {
|
|
3327
|
-
model: model,
|
|
3328
|
-
customColumns: customColumns,
|
|
3329
|
-
onSave: this.handleUpdateCustomColumns,
|
|
3330
|
-
onCancel: this.handleMenuBack,
|
|
3331
|
-
key: OptionType.CUSTOM_COLUMN_BUILDER
|
|
3332
|
-
});
|
|
3333
|
-
case OptionType.ROLLUP_ROWS:
|
|
3334
|
-
return /*#__PURE__*/React.createElement(RollupRows, {
|
|
3335
|
-
model: model,
|
|
3336
|
-
onChange: this.handleRollupChange,
|
|
3337
|
-
config: rollupConfig,
|
|
3338
|
-
key: OptionType.ROLLUP_ROWS
|
|
3339
|
-
});
|
|
3340
|
-
case OptionType.AGGREGATIONS:
|
|
3341
|
-
return /*#__PURE__*/React.createElement(Aggregations, {
|
|
3342
|
-
settings: aggregationSettings,
|
|
3343
|
-
isRollup: isRollup,
|
|
3344
|
-
onChange: this.handleAggregationsChange,
|
|
3345
|
-
onEdit: this.handleAggregationEdit
|
|
3346
|
-
});
|
|
3347
|
-
case OptionType.AGGREGATION_EDIT:
|
|
3348
|
-
return selectedAggregation && /*#__PURE__*/React.createElement(AggregationEdit, {
|
|
3349
|
-
aggregation: selectedAggregation,
|
|
3350
|
-
columns: model.originalColumns,
|
|
3351
|
-
onChange: this.handleAggregationChange
|
|
3352
|
-
});
|
|
3353
|
-
case OptionType.TABLE_EXPORTER:
|
|
3354
|
-
return /*#__PURE__*/React.createElement(TableCsvExporter, {
|
|
3355
|
-
model: model,
|
|
3356
|
-
name: name,
|
|
3357
|
-
userColumnWidths: userColumnWidths,
|
|
3358
|
-
movedColumns: movedColumns,
|
|
3359
|
-
isDownloading: isTableDownloading,
|
|
3360
|
-
tableDownloadStatus: tableDownloadStatus,
|
|
3361
|
-
tableDownloadProgress: tableDownloadProgress,
|
|
3362
|
-
tableDownloadEstimatedTime: tableDownloadEstimatedTime !== null && tableDownloadEstimatedTime !== void 0 ? tableDownloadEstimatedTime : undefined,
|
|
3363
|
-
onDownload: this.handleDownloadTable,
|
|
3364
|
-
onDownloadStart: this.handleDownloadTableStart,
|
|
3365
|
-
onCancel: this.handleCancelDownloadTable,
|
|
3366
|
-
selectedRanges: selectedRanges,
|
|
3367
|
-
key: OptionType.TABLE_EXPORTER
|
|
3368
|
-
});
|
|
3369
|
-
case OptionType.SELECT_DISTINCT:
|
|
3370
|
-
return /*#__PURE__*/React.createElement(SelectDistinctBuilder, {
|
|
3371
|
-
model: model,
|
|
3372
|
-
selectDistinctColumns: selectDistinctColumns,
|
|
3373
|
-
onChange: this.handleSelectDistinctChanged
|
|
3374
|
-
});
|
|
3375
|
-
case OptionType.ADVANCED_SETTINGS:
|
|
3376
|
-
return /*#__PURE__*/React.createElement(AdvancedSettingsMenu, {
|
|
3377
|
-
items: advancedSettings,
|
|
3378
|
-
onChange: onAdvancedSettingsChange
|
|
3379
|
-
});
|
|
3380
|
-
default:
|
|
3381
|
-
throw Error("Unexpected option type ".concat(option.type));
|
|
3382
|
-
}
|
|
3383
|
-
});
|
|
3384
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
3385
|
-
className: "iris-grid",
|
|
3386
|
-
role: "presentation"
|
|
3387
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
3388
|
-
className: "iris-grid-column"
|
|
3389
|
-
}, children != null && /*#__PURE__*/React.createElement("div", {
|
|
3390
|
-
className: "iris-grid-bar"
|
|
3391
|
-
}, children), /*#__PURE__*/React.createElement(CSSTransition, {
|
|
3392
|
-
in: isSelectingPartition,
|
|
3393
|
-
timeout: ThemeExport.transitionSlowMs,
|
|
3394
|
-
classNames: "iris-grid-bar-horizontal",
|
|
3395
|
-
onEnter: this.handleAnimationStart,
|
|
3396
|
-
onEntered: this.handleAnimationEnd,
|
|
3397
|
-
onExit: this.handleAnimationStart,
|
|
3398
|
-
onExited: this.handleAnimationEnd,
|
|
3399
|
-
mountOnEnter: true,
|
|
3400
|
-
unmountOnExit: true
|
|
3401
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
3402
|
-
className: "iris-grid-partition-selector-wrapper iris-grid-bar iris-grid-bar-primary"
|
|
3403
|
-
}, partitionTable && partitionColumn && partition != null && /*#__PURE__*/React.createElement(IrisGridPartitionSelector, {
|
|
3404
|
-
dh: model.dh,
|
|
3405
|
-
table: partitionTable,
|
|
3406
|
-
getFormattedString: (value, type, stringName) => model.displayString(value, type, stringName),
|
|
3407
|
-
columnName: partitionColumn.name,
|
|
3408
|
-
partition: partition,
|
|
3409
|
-
onChange: this.handlePartitionChange,
|
|
3410
|
-
onFetchAll: this.handlePartitionFetchAll,
|
|
3411
|
-
onAppend: this.handlePartitionAppend,
|
|
3412
|
-
onDone: this.handlePartitionDone
|
|
3413
|
-
}))), /*#__PURE__*/React.createElement(CSSTransition, {
|
|
3414
|
-
in: showSearchBar,
|
|
3415
|
-
timeout: ThemeExport.transitionSlowMs,
|
|
3416
|
-
classNames: "iris-grid-bar-horizontal",
|
|
3417
|
-
onEnter: this.handleAnimationStart,
|
|
3418
|
-
onEntered: this.handleAnimationEnd,
|
|
3419
|
-
onExit: this.handleAnimationStart,
|
|
3420
|
-
onExited: this.handleAnimationEnd,
|
|
3421
|
-
mountOnEnter: true,
|
|
3422
|
-
unmountOnExit: true
|
|
3423
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
3424
|
-
className: "iris-grid-bar"
|
|
3425
|
-
}, /*#__PURE__*/React.createElement(CrossColumnSearch, {
|
|
3426
|
-
value: searchValue,
|
|
3427
|
-
selectedColumns: selectedSearchColumns,
|
|
3428
|
-
invertSelection: invertSearchColumns,
|
|
3429
|
-
onChange: this.handleCrossColumnSearch,
|
|
3430
|
-
columns: model.columns,
|
|
3431
|
-
ref: this.crossColumnRef
|
|
3432
|
-
}))), /*#__PURE__*/React.createElement("div", {
|
|
3433
|
-
className: "grid-wrapper",
|
|
3434
|
-
ref: gridWrapper => {
|
|
3435
|
-
this.gridWrapper = gridWrapper;
|
|
3436
|
-
}
|
|
3437
|
-
}, /*#__PURE__*/React.createElement(Grid, {
|
|
3438
|
-
ref: grid => {
|
|
3439
|
-
this.grid = grid;
|
|
3440
|
-
},
|
|
3441
|
-
isStickyBottom: !isEditableGridModel(model) || !model.isEditable,
|
|
3442
|
-
isStuckToBottom: isStuckToBottom,
|
|
3443
|
-
isStuckToRight: isStuckToRight,
|
|
3444
|
-
metricCalculator: metricCalculator,
|
|
3445
|
-
model: model,
|
|
3446
|
-
keyHandlers: keyHandlers,
|
|
3447
|
-
mouseHandlers: mouseHandlers,
|
|
3448
|
-
movedColumns: movedColumns,
|
|
3449
|
-
movedRows: movedRows,
|
|
3450
|
-
onError: this.handleGridError,
|
|
3451
|
-
onViewChanged: this.handleViewChanged,
|
|
3452
|
-
onSelectionChanged: this.handleSelectionChanged,
|
|
3453
|
-
onMovedColumnsChanged: this.handleMovedColumnsChanged,
|
|
3454
|
-
renderer: this.renderer,
|
|
3455
|
-
stateOverride: stateOverride,
|
|
3456
|
-
theme: theme
|
|
3457
|
-
}), /*#__PURE__*/React.createElement(IrisGridCellOverflowModal, {
|
|
3458
|
-
isOpen: showOverflowModal,
|
|
3459
|
-
text: overflowText,
|
|
3460
|
-
onClose: this.handleOverflowClose
|
|
3461
|
-
}), isVisible && /*#__PURE__*/React.createElement(IrisGridModelUpdater, {
|
|
3462
|
-
model: model,
|
|
3463
|
-
modelColumns: model.columns,
|
|
3464
|
-
top: top,
|
|
3465
|
-
bottom: bottom,
|
|
3466
|
-
left: left,
|
|
3467
|
-
right: right,
|
|
3468
|
-
filter: filter,
|
|
3469
|
-
formatter: formatter,
|
|
3470
|
-
sorts: sorts,
|
|
3471
|
-
reverseType: reverseType,
|
|
3472
|
-
movedColumns: movedColumns,
|
|
3473
|
-
customColumns: customColumns,
|
|
3474
|
-
hiddenColumns: hiddenColumns,
|
|
3475
|
-
alwaysFetchColumns: this.getAlwaysFetchColumns(alwaysFetchColumns, model.columns, movedColumns, model.floatingLeftColumnCount, model.floatingRightColumnCount, (_this$grid29 = this.grid) === null || _this$grid29 === void 0 ? void 0 : (_this$grid29$state$dr = _this$grid29.state.draggingColumn) === null || _this$grid29$state$dr === void 0 ? void 0 : _this$grid29$state$dr.range),
|
|
3476
|
-
formatColumns: this.getCachedPreviewFormatColumns(model.dh, model.columns, conditionalFormats, conditionalFormatPreview,
|
|
3477
|
-
// Disable the preview format when we press Back on the format edit page
|
|
3478
|
-
((_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),
|
|
3479
|
-
rollupConfig: this.getModelRollupConfig(model.originalColumns, rollupConfig, aggregationSettings),
|
|
3480
|
-
totalsConfig: this.getModelTotalsConfig(model.columns, rollupConfig, aggregationSettings),
|
|
3481
|
-
selectDistinctColumns: selectDistinctColumns,
|
|
3482
|
-
pendingRowCount: pendingRowCount,
|
|
3483
|
-
pendingDataMap: pendingDataMap,
|
|
3484
|
-
frozenColumns: frozenColumns,
|
|
3485
|
-
columnHeaderGroups: columnHeaderGroups
|
|
3486
|
-
}), !isMenuShown && /*#__PURE__*/React.createElement("div", {
|
|
3487
|
-
className: "grid-settings-button"
|
|
3488
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
3489
|
-
kind: "ghost",
|
|
3490
|
-
"data-testid": "btn-iris-grid-settings-button-".concat(name),
|
|
3491
|
-
onClick: this.handleMenu,
|
|
3492
|
-
icon: /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
3493
|
-
icon: vsMenu,
|
|
3494
|
-
transform: "up-1"
|
|
3495
|
-
}),
|
|
3496
|
-
tooltip: "Table Options"
|
|
3497
|
-
})), focusField, loadingElement, filterBar, columnTooltip, advancedFilterMenus, overflowButtonTooltipProps && this.getOverflowButtonTooltip(overflowButtonTooltipProps), expandCellTooltipProps && this.getExpandCellTooltip(expandCellTooltipProps), linkHoverTooltipProps && this.getLinkHoverTooltip(linkHoverTooltipProps)), /*#__PURE__*/React.createElement(GotoRow, {
|
|
3498
|
-
model: model,
|
|
3499
|
-
isShown: isGotoShown,
|
|
3500
|
-
gotoRow: gotoRow,
|
|
3501
|
-
gotoRowError: gotoRowError,
|
|
3502
|
-
gotoValueError: gotoValueError,
|
|
3503
|
-
onGotoRowSubmit: this.handleGotoRowSelectedRowNumberSubmit,
|
|
3504
|
-
onGotoRowNumberChanged: this.handleGotoRowSelectedRowNumberChanged,
|
|
3505
|
-
onClose: this.handleGotoRowClosed,
|
|
3506
|
-
onEntering: this.handleAnimationStart,
|
|
3507
|
-
onEntered: this.handleAnimationEnd,
|
|
3508
|
-
onExiting: () => {
|
|
3509
|
-
this.handleAnimationStart();
|
|
3510
|
-
this.focus();
|
|
3511
|
-
},
|
|
3512
|
-
onExited: this.handleAnimationEnd,
|
|
3513
|
-
gotoValueSelectedColumnName: gotoValueSelectedColumnName,
|
|
3514
|
-
gotoValue: gotoValue,
|
|
3515
|
-
gotoValueFilter: gotoValueSelectedFilter,
|
|
3516
|
-
onGotoValueSelectedColumnNameChanged: this.handleGotoValueSelectedColumnNameChanged,
|
|
3517
|
-
onGotoValueSelectedFilterChanged: this.handleGotoValueSelectedFilterChanged,
|
|
3518
|
-
onGotoValueChanged: this.handleGotoValueChanged,
|
|
3519
|
-
onGotoValueSubmit: this.handleGotoValueSubmitted
|
|
3520
|
-
}), /*#__PURE__*/React.createElement(PendingDataBottomBar, {
|
|
3521
|
-
error: pendingSaveError,
|
|
3522
|
-
isSaving: pendingSavePromise != null,
|
|
3523
|
-
saveTooltip: "Commit (".concat(this.commitAction.shortcut.getDisplayText(), ")"),
|
|
3524
|
-
discardTooltip: "Discard (".concat(this.discardAction.shortcut.getDisplayText(), ")"),
|
|
3525
|
-
pendingDataErrors: pendingDataErrors,
|
|
3526
|
-
pendingDataMap: pendingDataMap,
|
|
3527
|
-
onEntering: this.handleAnimationStart,
|
|
3528
|
-
onEntered: this.handleAnimationEnd,
|
|
3529
|
-
onExiting: this.handleAnimationStart,
|
|
3530
|
-
onExited: this.handleAnimationEnd,
|
|
3531
|
-
onSave: this.handlePendingCommitClicked,
|
|
3532
|
-
onDiscard: this.handlePendingDiscardClicked
|
|
3533
|
-
}), /*#__PURE__*/React.createElement(ToastBottomBar, null, toastMessage), /*#__PURE__*/React.createElement(IrisGridCopyHandler, {
|
|
3534
|
-
model: model,
|
|
3535
|
-
copyOperation: copyOperation !== null && copyOperation !== void 0 ? copyOperation : undefined,
|
|
3536
|
-
onEntering: this.handleAnimationStart,
|
|
3537
|
-
onEntered: this.handleAnimationEnd,
|
|
3538
|
-
onExiting: this.handleAnimationStart,
|
|
3539
|
-
onExited: this.handleAnimationEnd
|
|
3540
|
-
}), /*#__PURE__*/React.createElement(TableSaver, {
|
|
3541
|
-
dh: model.dh,
|
|
3542
|
-
ref: tableSaver => {
|
|
3543
|
-
this.tableSaver = tableSaver;
|
|
3544
|
-
},
|
|
3545
|
-
getDownloadWorker: getDownloadWorker,
|
|
3546
|
-
onDownloadCompleted: this.handleDownloadCompleted,
|
|
3547
|
-
onDownloadCanceled: this.handleDownloadCanceled,
|
|
3548
|
-
onDownloadProgressUpdate: this.handleDownloadProgressUpdate,
|
|
3549
|
-
isDownloading: tableDownloadStatus === TableCsvExporter.DOWNLOAD_STATUS.DOWNLOADING,
|
|
3550
|
-
formatter: formatter
|
|
3551
|
-
})), /*#__PURE__*/React.createElement(CSSTransition, {
|
|
3552
|
-
in: isMenuShown,
|
|
3553
|
-
timeout: ThemeExport.transitionMidMs,
|
|
3554
|
-
classNames: "slide-left",
|
|
3555
|
-
onEntering: this.handleAnimationStart,
|
|
3556
|
-
onEntered: this.handleAnimationEnd,
|
|
3557
|
-
onExiting: this.handleAnimationStart,
|
|
3558
|
-
onExited: this.handleAnimationEnd,
|
|
3559
|
-
mountOnEnter: true,
|
|
3560
|
-
unmountOnExit: true
|
|
3561
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
3562
|
-
className: "table-sidebar"
|
|
3563
|
-
}, /*#__PURE__*/React.createElement(Stack, null, /*#__PURE__*/React.createElement(Page, {
|
|
3564
|
-
title: "Table Options",
|
|
3565
|
-
onClose: this.handleMenuClose
|
|
3566
|
-
}, /*#__PURE__*/React.createElement(Menu, {
|
|
3567
|
-
onSelect: i => this.handleMenuSelect(optionItems[i]),
|
|
3568
|
-
items: optionItems
|
|
3569
|
-
})), openOptionsStack.map((option, i) => /*#__PURE__*/React.createElement(Page, {
|
|
3570
|
-
title: openOptions[i].title,
|
|
3571
|
-
onBack: this.handleMenuBack,
|
|
3572
|
-
onClose: this.handleMenuClose,
|
|
3573
|
-
key: openOptions[i].type
|
|
3574
|
-
}, option))))), /*#__PURE__*/React.createElement(ContextActions, {
|
|
3575
|
-
actions: this.contextActions
|
|
3576
|
-
}));
|
|
3577
|
-
}
|
|
3578
|
-
}
|
|
3579
|
-
_defineProperty(IrisGrid, "minDebounce", 150);
|
|
3580
|
-
_defineProperty(IrisGrid, "maxDebounce", 500);
|
|
3581
|
-
_defineProperty(IrisGrid, "loadingSpinnerDelay", 800);
|
|
3582
|
-
_defineProperty(IrisGrid, "defaultProps", {
|
|
3583
|
-
children: null,
|
|
3584
|
-
advancedFilters: EMPTY_MAP,
|
|
3585
|
-
advancedSettings: EMPTY_MAP,
|
|
3586
|
-
alwaysFetchColumns: EMPTY_ARRAY,
|
|
3587
|
-
conditionalFormats: EMPTY_ARRAY,
|
|
3588
|
-
customColumnFormatMap: EMPTY_MAP,
|
|
3589
|
-
isFilterBarShown: false,
|
|
3590
|
-
applyInputFiltersOnInit: false,
|
|
3591
|
-
movedColumns: EMPTY_ARRAY,
|
|
3592
|
-
movedRows: EMPTY_ARRAY,
|
|
3593
|
-
inputFilters: EMPTY_ARRAY,
|
|
3594
|
-
customFilters: EMPTY_ARRAY,
|
|
3595
|
-
onCreateChart: undefined,
|
|
3596
|
-
onColumnSelected: () => undefined,
|
|
3597
|
-
onDataSelected: () => undefined,
|
|
3598
|
-
onError: () => undefined,
|
|
3599
|
-
onStateChange: () => undefined,
|
|
3600
|
-
onPartitionAppend: () => undefined,
|
|
3601
|
-
onAdvancedSettingsChange: () => undefined,
|
|
3602
|
-
partition: null,
|
|
3603
|
-
partitionColumn: null,
|
|
3604
|
-
quickFilters: EMPTY_MAP,
|
|
3605
|
-
selectDistinctColumns: EMPTY_ARRAY,
|
|
3606
|
-
sorts: EMPTY_ARRAY,
|
|
3607
|
-
reverseType: TableUtils.REVERSE_TYPE.NONE,
|
|
3608
|
-
customColumns: EMPTY_ARRAY,
|
|
3609
|
-
aggregationSettings: DEFAULT_AGGREGATION_SETTINGS,
|
|
3610
|
-
rollupConfig: undefined,
|
|
3611
|
-
userColumnWidths: EMPTY_MAP,
|
|
3612
|
-
userRowHeights: EMPTY_MAP,
|
|
3613
|
-
onSelectionChanged: () => undefined,
|
|
3614
|
-
isSelectingColumn: false,
|
|
3615
|
-
isSelectingPartition: false,
|
|
3616
|
-
isStuckToBottom: false,
|
|
3617
|
-
isStuckToRight: false,
|
|
3618
|
-
columnSelectionValidator: null,
|
|
3619
|
-
columnAllowedCursor: null,
|
|
3620
|
-
columnNotAllowedCursor: null,
|
|
3621
|
-
name: 'table',
|
|
3622
|
-
onlyFetchVisibleColumns: true,
|
|
3623
|
-
showSearchBar: false,
|
|
3624
|
-
searchValue: '',
|
|
3625
|
-
selectedSearchColumns: null,
|
|
3626
|
-
invertSearchColumns: true,
|
|
3627
|
-
onContextMenu: () => undefined,
|
|
3628
|
-
pendingDataMap: EMPTY_MAP,
|
|
3629
|
-
getDownloadWorker: undefined,
|
|
3630
|
-
settings: {
|
|
3631
|
-
timeZone: 'America/New_York',
|
|
3632
|
-
defaultDateTimeFormat: DateUtils.FULL_DATE_FORMAT,
|
|
3633
|
-
showTimeZone: false,
|
|
3634
|
-
showTSeparator: true,
|
|
3635
|
-
truncateNumbersWithPound: false,
|
|
3636
|
-
formatter: EMPTY_ARRAY,
|
|
3637
|
-
decimalFormatOptions: PropTypes.shape({
|
|
3638
|
-
defaultFormatString: PropTypes.string
|
|
3639
|
-
}),
|
|
3640
|
-
integerFormatOptions: PropTypes.shape({
|
|
3641
|
-
defaultFormatString: PropTypes.string
|
|
3642
|
-
})
|
|
3643
|
-
},
|
|
3644
|
-
canCopy: true,
|
|
3645
|
-
canDownloadCsv: true,
|
|
3646
|
-
frozenColumns: null,
|
|
3647
|
-
theme: IrisGridTheme,
|
|
3648
|
-
canToggleSearch: true
|
|
3649
|
-
});
|
|
3650
|
-
export default IrisGrid;
|
|
3651
|
-
//# sourceMappingURL=IrisGrid.js.map
|