@deephaven/iris-grid 0.43.0 → 0.44.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/dist/AdvancedFilterCreator.css +106 -0
- package/dist/AdvancedFilterCreator.css.map +1 -0
- package/dist/AdvancedFilterCreator.js +541 -0
- package/dist/AdvancedFilterCreator.js.map +1 -0
- package/dist/AdvancedFilterCreatorFilterItem.css +9 -0
- package/dist/AdvancedFilterCreatorFilterItem.css.map +1 -0
- package/dist/AdvancedFilterCreatorFilterItem.js +184 -0
- package/dist/AdvancedFilterCreatorFilterItem.js.map +1 -0
- package/dist/AdvancedFilterCreatorSelectValue.css +50 -0
- package/dist/AdvancedFilterCreatorSelectValue.css.map +1 -0
- package/dist/AdvancedFilterCreatorSelectValue.js +301 -0
- package/dist/AdvancedFilterCreatorSelectValue.js.map +1 -0
- package/dist/AdvancedFilterCreatorSelectValueList.js +272 -0
- package/dist/AdvancedFilterCreatorSelectValueList.js.map +1 -0
- package/dist/ColumnHeaderGroup.js +61 -0
- package/dist/ColumnHeaderGroup.js.map +1 -0
- package/dist/ColumnStatistics.css +76 -0
- package/dist/ColumnStatistics.css.map +1 -0
- package/dist/ColumnStatistics.js +202 -0
- package/dist/ColumnStatistics.js.map +1 -0
- package/dist/CommonTypes.js +2 -0
- package/dist/CommonTypes.js.map +1 -0
- package/dist/CrossColumnSearch.css +35 -0
- package/dist/CrossColumnSearch.css.map +1 -0
- package/dist/CrossColumnSearch.js +199 -0
- package/dist/CrossColumnSearch.js.map +1 -0
- package/dist/FilterInputField.css +56 -0
- package/dist/FilterInputField.css.map +1 -0
- package/dist/FilterInputField.js +232 -0
- package/dist/FilterInputField.js.map +1 -0
- package/dist/GotoRow.css +45 -0
- package/dist/GotoRow.css.map +1 -0
- package/dist/GotoRow.js +298 -0
- package/dist/GotoRow.js.map +1 -0
- package/dist/IrisGrid.css +359 -0
- package/dist/IrisGrid.css.map +1 -0
- package/dist/IrisGrid.js +3651 -0
- package/dist/IrisGrid.js.map +1 -0
- package/dist/IrisGridBottomBar.css +85 -0
- package/dist/IrisGridBottomBar.css.map +1 -0
- package/dist/IrisGridBottomBar.js +36 -0
- package/dist/IrisGridBottomBar.js.map +1 -0
- package/dist/IrisGridCellOverflowModal.css +17 -0
- package/dist/IrisGridCellOverflowModal.css.map +1 -0
- package/dist/IrisGridCellOverflowModal.js +157 -0
- package/dist/IrisGridCellOverflowModal.js.map +1 -0
- package/dist/IrisGridCellRendererUtils.js +20 -0
- package/dist/IrisGridCellRendererUtils.js.map +1 -0
- package/dist/IrisGridCopyHandler.css +64 -0
- package/dist/IrisGridCopyHandler.css.map +1 -0
- package/dist/IrisGridCopyHandler.js +331 -0
- package/dist/IrisGridCopyHandler.js.map +1 -0
- package/dist/IrisGridDataBarCellRenderer.js +10 -0
- package/dist/IrisGridDataBarCellRenderer.js.map +1 -0
- package/dist/IrisGridIcons.js +25 -0
- package/dist/IrisGridIcons.js.map +1 -0
- package/dist/IrisGridMetricCalculator.js +33 -0
- package/dist/IrisGridMetricCalculator.js.map +1 -0
- package/dist/IrisGridModel.js +263 -0
- package/dist/IrisGridModel.js.map +1 -0
- package/dist/IrisGridModelFactory.js +27 -0
- package/dist/IrisGridModelFactory.js.map +1 -0
- package/dist/IrisGridModelUpdater.js +96 -0
- package/dist/IrisGridModelUpdater.js.map +1 -0
- package/dist/IrisGridPartitionSelector.css +48 -0
- package/dist/IrisGridPartitionSelector.css.map +1 -0
- package/dist/IrisGridPartitionSelector.js +198 -0
- package/dist/IrisGridPartitionSelector.js.map +1 -0
- package/dist/IrisGridProxyModel.js +530 -0
- package/dist/IrisGridProxyModel.js.map +1 -0
- package/dist/IrisGridRenderer.js +779 -0
- package/dist/IrisGridRenderer.js.map +1 -0
- package/dist/IrisGridShortcuts.js +59 -0
- package/dist/IrisGridShortcuts.js.map +1 -0
- package/dist/IrisGridTableModel.js +273 -0
- package/dist/IrisGridTableModel.js.map +1 -0
- package/dist/IrisGridTableModelTemplate.js +1589 -0
- package/dist/IrisGridTableModelTemplate.js.map +1 -0
- package/dist/IrisGridTestUtils.js +121 -0
- package/dist/IrisGridTestUtils.js.map +1 -0
- package/dist/IrisGridTextCellRenderer.js +139 -0
- package/dist/IrisGridTextCellRenderer.js.map +1 -0
- package/dist/IrisGridTheme.js +96 -0
- package/dist/IrisGridTheme.js.map +1 -0
- package/dist/IrisGridTheme.module.css +69 -0
- package/dist/IrisGridTheme.module.css.map +1 -0
- package/dist/IrisGridTreeTableModel.js +145 -0
- package/dist/IrisGridTreeTableModel.js.map +1 -0
- package/dist/IrisGridUtils.js +1279 -0
- package/dist/IrisGridUtils.js.map +1 -0
- package/dist/MissingKeyError.js +15 -0
- package/dist/MissingKeyError.js.map +1 -0
- package/dist/PartitionSelectorSearch.css +22 -0
- package/dist/PartitionSelectorSearch.css.map +1 -0
- package/dist/PartitionSelectorSearch.js +317 -0
- package/dist/PartitionSelectorSearch.js.map +1 -0
- package/dist/PendingDataBottomBar.css +13 -0
- package/dist/PendingDataBottomBar.css.map +1 -0
- package/dist/PendingDataBottomBar.js +98 -0
- package/dist/PendingDataBottomBar.js.map +1 -0
- package/dist/TableViewportUpdater.js +156 -0
- package/dist/TableViewportUpdater.js.map +1 -0
- package/dist/ToastBottomBar.js +42 -0
- package/dist/ToastBottomBar.js.map +1 -0
- package/dist/TreeTableViewportUpdater.js +96 -0
- package/dist/TreeTableViewportUpdater.js.map +1 -0
- package/dist/declaration.d.js +2 -0
- package/dist/declaration.d.js.map +1 -0
- package/dist/format-context-menus/CustomFormatAction.css +25 -0
- package/dist/format-context-menus/CustomFormatAction.css.map +1 -0
- package/dist/format-context-menus/CustomFormatAction.js +132 -0
- package/dist/format-context-menus/CustomFormatAction.js.map +1 -0
- package/dist/format-context-menus/DateTimeFormatContextMenu.js +53 -0
- package/dist/format-context-menus/DateTimeFormatContextMenu.js.map +1 -0
- package/dist/format-context-menus/DecimalFormatContextMenu.js +59 -0
- package/dist/format-context-menus/DecimalFormatContextMenu.js.map +1 -0
- package/dist/format-context-menus/FormatContextMenuUtils.js +63 -0
- package/dist/format-context-menus/FormatContextMenuUtils.js.map +1 -0
- package/dist/format-context-menus/IntegerFormatContextMenu.js +43 -0
- package/dist/format-context-menus/IntegerFormatContextMenu.js.map +1 -0
- package/dist/format-context-menus/index.js +4 -0
- package/dist/format-context-menus/index.js.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/key-handlers/ClearFilterKeyHandler.js +21 -0
- package/dist/key-handlers/ClearFilterKeyHandler.js.map +1 -0
- package/dist/key-handlers/CopyKeyHandler.js +31 -0
- package/dist/key-handlers/CopyKeyHandler.js.map +1 -0
- package/dist/key-handlers/ReverseKeyHandler.js +32 -0
- package/dist/key-handlers/ReverseKeyHandler.js.map +1 -0
- package/dist/key-handlers/index.js +4 -0
- package/dist/key-handlers/index.js.map +1 -0
- package/dist/mousehandlers/IrisGridCellOverflowMouseHandler.js +175 -0
- package/dist/mousehandlers/IrisGridCellOverflowMouseHandler.js.map +1 -0
- package/dist/mousehandlers/IrisGridColumnSelectMouseHandler.js +139 -0
- package/dist/mousehandlers/IrisGridColumnSelectMouseHandler.js.map +1 -0
- package/dist/mousehandlers/IrisGridColumnTooltipMouseHandler.js +83 -0
- package/dist/mousehandlers/IrisGridColumnTooltipMouseHandler.js.map +1 -0
- package/dist/mousehandlers/IrisGridContextMenuHandler.css +19 -0
- package/dist/mousehandlers/IrisGridContextMenuHandler.css.map +1 -0
- package/dist/mousehandlers/IrisGridContextMenuHandler.js +1220 -0
- package/dist/mousehandlers/IrisGridContextMenuHandler.js.map +1 -0
- package/dist/mousehandlers/IrisGridDataSelectMouseHandler.js +28 -0
- package/dist/mousehandlers/IrisGridDataSelectMouseHandler.js.map +1 -0
- package/dist/mousehandlers/IrisGridFilterMouseHandler.js +80 -0
- package/dist/mousehandlers/IrisGridFilterMouseHandler.js.map +1 -0
- package/dist/mousehandlers/IrisGridRowTreeMouseHandler.js +126 -0
- package/dist/mousehandlers/IrisGridRowTreeMouseHandler.js.map +1 -0
- package/dist/mousehandlers/IrisGridSortMouseHandler.js +46 -0
- package/dist/mousehandlers/IrisGridSortMouseHandler.js.map +1 -0
- package/dist/mousehandlers/IrisGridTokenMouseHandler.js +151 -0
- package/dist/mousehandlers/IrisGridTokenMouseHandler.js.map +1 -0
- package/dist/mousehandlers/PendingMouseHandler.js +39 -0
- package/dist/mousehandlers/PendingMouseHandler.js.map +1 -0
- package/dist/mousehandlers/index.js +11 -0
- package/dist/mousehandlers/index.js.map +1 -0
- package/dist/sidebar/AdvancedSettings.js +6 -0
- package/dist/sidebar/AdvancedSettings.js.map +1 -0
- package/dist/sidebar/AdvancedSettingsMenu.js +29 -0
- package/dist/sidebar/AdvancedSettingsMenu.js.map +1 -0
- package/dist/sidebar/AdvancedSettingsType.js +7 -0
- package/dist/sidebar/AdvancedSettingsType.js.map +1 -0
- package/dist/sidebar/ChartBuilder.css +56 -0
- package/dist/sidebar/ChartBuilder.css.map +1 -0
- package/dist/sidebar/ChartBuilder.js +443 -0
- package/dist/sidebar/ChartBuilder.js.map +1 -0
- package/dist/sidebar/CustomColumnBuilder.css +58 -0
- package/dist/sidebar/CustomColumnBuilder.css.map +1 -0
- package/dist/sidebar/CustomColumnBuilder.js +384 -0
- package/dist/sidebar/CustomColumnBuilder.js.map +1 -0
- package/dist/sidebar/CustomColumnInput.d.ts.map +1 -1
- package/dist/sidebar/CustomColumnInput.js +91 -0
- package/dist/sidebar/CustomColumnInput.js.map +1 -0
- package/dist/sidebar/InputEditor.css +35 -0
- package/dist/sidebar/InputEditor.css.map +1 -0
- package/dist/sidebar/InputEditor.d.ts +4 -2
- package/dist/sidebar/InputEditor.d.ts.map +1 -1
- package/dist/sidebar/InputEditor.js +180 -0
- package/dist/sidebar/InputEditor.js.map +1 -0
- package/dist/sidebar/OptionType.js +19 -0
- package/dist/sidebar/OptionType.js.map +1 -0
- package/dist/sidebar/RollupRows.css +120 -0
- package/dist/sidebar/RollupRows.css.map +1 -0
- package/dist/sidebar/RollupRows.js +519 -0
- package/dist/sidebar/RollupRows.js.map +1 -0
- package/dist/sidebar/SelectDistinctBuilder.css +41 -0
- package/dist/sidebar/SelectDistinctBuilder.css.map +1 -0
- package/dist/sidebar/SelectDistinctBuilder.js +155 -0
- package/dist/sidebar/SelectDistinctBuilder.js.map +1 -0
- package/dist/sidebar/TableCsvExporter.css +32 -0
- package/dist/sidebar/TableCsvExporter.css.map +1 -0
- package/dist/sidebar/TableCsvExporter.js +399 -0
- package/dist/sidebar/TableCsvExporter.js.map +1 -0
- package/dist/sidebar/TableSaver.js +487 -0
- package/dist/sidebar/TableSaver.js.map +1 -0
- package/dist/sidebar/aggregations/AggregationEdit.css +61 -0
- package/dist/sidebar/aggregations/AggregationEdit.css.map +1 -0
- package/dist/sidebar/aggregations/AggregationEdit.js +155 -0
- package/dist/sidebar/aggregations/AggregationEdit.js.map +1 -0
- package/dist/sidebar/aggregations/AggregationOperation.js +19 -0
- package/dist/sidebar/aggregations/AggregationOperation.js.map +1 -0
- package/dist/sidebar/aggregations/AggregationUtils.js +59 -0
- package/dist/sidebar/aggregations/AggregationUtils.js.map +1 -0
- package/dist/sidebar/aggregations/Aggregations.css +43 -0
- package/dist/sidebar/aggregations/Aggregations.css.map +1 -0
- package/dist/sidebar/aggregations/Aggregations.js +178 -0
- package/dist/sidebar/aggregations/Aggregations.js.map +1 -0
- package/dist/sidebar/aggregations/index.js +2 -0
- package/dist/sidebar/aggregations/index.js.map +1 -0
- package/dist/sidebar/conditional-formatting/ColumnFormatEditor.js +123 -0
- package/dist/sidebar/conditional-formatting/ColumnFormatEditor.js.map +1 -0
- package/dist/sidebar/conditional-formatting/ConditionEditor.js +243 -0
- package/dist/sidebar/conditional-formatting/ConditionEditor.js.map +1 -0
- package/dist/sidebar/conditional-formatting/ConditionalFormatEditor.css +22 -0
- package/dist/sidebar/conditional-formatting/ConditionalFormatEditor.css.map +1 -0
- package/dist/sidebar/conditional-formatting/ConditionalFormatEditor.js +109 -0
- package/dist/sidebar/conditional-formatting/ConditionalFormatEditor.js.map +1 -0
- package/dist/sidebar/conditional-formatting/ConditionalFormattingAPIUtils.js +18 -0
- package/dist/sidebar/conditional-formatting/ConditionalFormattingAPIUtils.js.map +1 -0
- package/dist/sidebar/conditional-formatting/ConditionalFormattingMenu.css +57 -0
- package/dist/sidebar/conditional-formatting/ConditionalFormattingMenu.css.map +1 -0
- package/dist/sidebar/conditional-formatting/ConditionalFormattingMenu.js +150 -0
- package/dist/sidebar/conditional-formatting/ConditionalFormattingMenu.js.map +1 -0
- package/dist/sidebar/conditional-formatting/ConditionalFormattingUtils.js +635 -0
- package/dist/sidebar/conditional-formatting/ConditionalFormattingUtils.js.map +1 -0
- package/dist/sidebar/conditional-formatting/RowFormatEditor.js +122 -0
- package/dist/sidebar/conditional-formatting/RowFormatEditor.js.map +1 -0
- package/dist/sidebar/conditional-formatting/StyleEditor.css +55 -0
- package/dist/sidebar/conditional-formatting/StyleEditor.css.map +1 -0
- package/dist/sidebar/conditional-formatting/StyleEditor.js +150 -0
- package/dist/sidebar/conditional-formatting/StyleEditor.js.map +1 -0
- package/dist/sidebar/icons/BarIcon.js +24 -0
- package/dist/sidebar/icons/BarIcon.js.map +1 -0
- package/dist/sidebar/icons/FormatColumnWhereIcon.js +42 -0
- package/dist/sidebar/icons/FormatColumnWhereIcon.js.map +1 -0
- package/dist/sidebar/icons/FormatRowWhereIcon.js +36 -0
- package/dist/sidebar/icons/FormatRowWhereIcon.js.map +1 -0
- package/dist/sidebar/icons/HistogramIcon.js +24 -0
- package/dist/sidebar/icons/HistogramIcon.js.map +1 -0
- package/dist/sidebar/icons/LineIcon.js +27 -0
- package/dist/sidebar/icons/LineIcon.js.map +1 -0
- package/dist/sidebar/icons/PieIcon.js +24 -0
- package/dist/sidebar/icons/PieIcon.js.map +1 -0
- package/dist/sidebar/icons/ScatterIcon.js +74 -0
- package/dist/sidebar/icons/ScatterIcon.js.map +1 -0
- package/dist/sidebar/icons/index.js +8 -0
- package/dist/sidebar/icons/index.js.map +1 -0
- package/dist/sidebar/index.d.ts +1 -0
- package/dist/sidebar/index.d.ts.map +1 -1
- package/dist/sidebar/index.js +19 -0
- package/dist/sidebar/index.js.map +1 -0
- package/dist/sidebar/visibility-ordering-builder/VisibilityOrderingBuilder.css +68 -0
- package/dist/sidebar/visibility-ordering-builder/VisibilityOrderingBuilder.css.map +1 -0
- package/dist/sidebar/visibility-ordering-builder/VisibilityOrderingBuilder.js +964 -0
- package/dist/sidebar/visibility-ordering-builder/VisibilityOrderingBuilder.js.map +1 -0
- package/dist/sidebar/visibility-ordering-builder/VisibilityOrderingBuilderUtils.js +132 -0
- package/dist/sidebar/visibility-ordering-builder/VisibilityOrderingBuilderUtils.js.map +1 -0
- package/dist/sidebar/visibility-ordering-builder/VisibilityOrderingGroup.css +29 -0
- package/dist/sidebar/visibility-ordering-builder/VisibilityOrderingGroup.css.map +1 -0
- package/dist/sidebar/visibility-ordering-builder/VisibilityOrderingGroup.js +188 -0
- package/dist/sidebar/visibility-ordering-builder/VisibilityOrderingGroup.js.map +1 -0
- package/dist/sidebar/visibility-ordering-builder/VisibilityOrderingItem.js +81 -0
- package/dist/sidebar/visibility-ordering-builder/VisibilityOrderingItem.js.map +1 -0
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/PointerSensorWithInteraction.js +30 -0
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/PointerSensorWithInteraction.js.map +1 -0
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/SortableTree.js +158 -0
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/SortableTree.js.map +1 -0
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/SortableTreeInner.js +146 -0
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/SortableTreeInner.js.map +1 -0
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/SortableTreeItem.js +59 -0
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/SortableTreeItem.js.map +1 -0
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/TreeItem.css +139 -0
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/TreeItem.css.map +1 -0
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/TreeItem.js +44 -0
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/TreeItem.js.map +1 -0
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/keyboardCoordinates.js +129 -0
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/keyboardCoordinates.js.map +1 -0
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/types.js +4 -0
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/types.js.map +1 -0
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/utilities.js +261 -0
- package/dist/sidebar/visibility-ordering-builder/sortable-tree/utilities.js.map +1 -0
- package/package.json +15 -15
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
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); }
|
|
4
|
+
import React, { Component } from 'react';
|
|
5
|
+
import { Tooltip } from '@deephaven/components';
|
|
6
|
+
import { DOMUtils } from '@deephaven/utils';
|
|
7
|
+
import "./CustomFormatAction.css";
|
|
8
|
+
/**
|
|
9
|
+
* Renders menuElement option with custom format input for use in formatting context menus
|
|
10
|
+
*
|
|
11
|
+
* TODO:
|
|
12
|
+
* - capture focus when this menu action is selected via ArrowUp/ArrowDown keys
|
|
13
|
+
* - dynamically update selected menu item when clicking on the input box
|
|
14
|
+
*/
|
|
15
|
+
class CustomFormatAction extends Component {
|
|
16
|
+
constructor() {
|
|
17
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : CustomFormatAction.defaultProps;
|
|
18
|
+
super(props);
|
|
19
|
+
_defineProperty(this, "inputRef", void 0);
|
|
20
|
+
this.handleInputChange = this.handleInputChange.bind(this);
|
|
21
|
+
this.handleKeyDown = this.handleKeyDown.bind(this);
|
|
22
|
+
this.inputRef = /*#__PURE__*/React.createRef();
|
|
23
|
+
}
|
|
24
|
+
handleInputChange() {
|
|
25
|
+
var {
|
|
26
|
+
onChange
|
|
27
|
+
} = this.props;
|
|
28
|
+
if (this.inputRef.current) {
|
|
29
|
+
onChange(this.inputRef.current.value);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
closeContextMenu() {
|
|
33
|
+
var {
|
|
34
|
+
forwardedProps
|
|
35
|
+
} = this.props;
|
|
36
|
+
var {
|
|
37
|
+
closeMenu
|
|
38
|
+
} = forwardedProps;
|
|
39
|
+
closeMenu(true);
|
|
40
|
+
}
|
|
41
|
+
revertToDefault() {
|
|
42
|
+
var {
|
|
43
|
+
onChange
|
|
44
|
+
} = this.props;
|
|
45
|
+
onChange(null);
|
|
46
|
+
}
|
|
47
|
+
returnFocusToContextMenu() {
|
|
48
|
+
var parentContextMenu = DOMUtils.getClosestByClassName(this.inputRef.current, 'context-menu-container');
|
|
49
|
+
if (parentContextMenu instanceof HTMLElement) {
|
|
50
|
+
parentContextMenu.focus();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
handleKeyDown(event) {
|
|
54
|
+
switch (event.key) {
|
|
55
|
+
case 'Enter':
|
|
56
|
+
event.stopPropagation();
|
|
57
|
+
this.closeContextMenu();
|
|
58
|
+
break;
|
|
59
|
+
case 'Escape':
|
|
60
|
+
event.stopPropagation();
|
|
61
|
+
this.revertToDefault();
|
|
62
|
+
this.closeContextMenu();
|
|
63
|
+
break;
|
|
64
|
+
case 'ArrowRight':
|
|
65
|
+
case 'ArrowLeft':
|
|
66
|
+
event.stopPropagation();
|
|
67
|
+
break;
|
|
68
|
+
case 'ArrowUp':
|
|
69
|
+
case 'ArrowDown':
|
|
70
|
+
this.returnFocusToContextMenu();
|
|
71
|
+
break;
|
|
72
|
+
default:
|
|
73
|
+
event.stopPropagation();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
render() {
|
|
77
|
+
var {
|
|
78
|
+
formatString,
|
|
79
|
+
forwardedProps,
|
|
80
|
+
placeholder,
|
|
81
|
+
title
|
|
82
|
+
} = this.props;
|
|
83
|
+
var {
|
|
84
|
+
menuItem: {
|
|
85
|
+
description
|
|
86
|
+
},
|
|
87
|
+
iconElement
|
|
88
|
+
} = forwardedProps;
|
|
89
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
90
|
+
className: "form-group flex-grow mb-0"
|
|
91
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
92
|
+
className: "custom-format-title"
|
|
93
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
94
|
+
className: "icon"
|
|
95
|
+
}, iconElement), /*#__PURE__*/React.createElement("label", {
|
|
96
|
+
className: "title mb-0",
|
|
97
|
+
htmlFor: "custom-format-input"
|
|
98
|
+
}, title, description != null && /*#__PURE__*/React.createElement(Tooltip, null, description))), /*#__PURE__*/React.createElement("div", {
|
|
99
|
+
className: "pl-2 pr-2 pb-2"
|
|
100
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
101
|
+
id: "custom-format-input",
|
|
102
|
+
className: "form-control text-right mb-0",
|
|
103
|
+
type: "text",
|
|
104
|
+
defaultValue: formatString,
|
|
105
|
+
ref: this.inputRef,
|
|
106
|
+
placeholder: placeholder,
|
|
107
|
+
onKeyDown: this.handleKeyDown,
|
|
108
|
+
onChange: this.handleInputChange,
|
|
109
|
+
autoComplete: "off",
|
|
110
|
+
autoCorrect: "off",
|
|
111
|
+
autoCapitalize: "off",
|
|
112
|
+
spellCheck: "false"
|
|
113
|
+
})));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
_defineProperty(CustomFormatAction, "defaultProps", {
|
|
117
|
+
formatString: '',
|
|
118
|
+
forwardedProps: {
|
|
119
|
+
menuItem: {},
|
|
120
|
+
closeMenu(focusInput) {
|
|
121
|
+
// no-op
|
|
122
|
+
},
|
|
123
|
+
iconElement: null
|
|
124
|
+
},
|
|
125
|
+
placeholder: '',
|
|
126
|
+
title: '',
|
|
127
|
+
onChange(value) {
|
|
128
|
+
// no-op
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
export default CustomFormatAction;
|
|
132
|
+
//# sourceMappingURL=CustomFormatAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomFormatAction.js","names":["React","Component","Tooltip","DOMUtils","CustomFormatAction","constructor","props","defaultProps","handleInputChange","bind","handleKeyDown","inputRef","createRef","onChange","current","value","closeContextMenu","forwardedProps","closeMenu","revertToDefault","returnFocusToContextMenu","parentContextMenu","getClosestByClassName","HTMLElement","focus","event","key","stopPropagation","render","formatString","placeholder","title","menuItem","description","iconElement","focusInput"],"sources":["../../src/format-context-menus/CustomFormatAction.tsx"],"sourcesContent":["import React, { Component } from 'react';\nimport { Tooltip } from '@deephaven/components';\nimport { DOMUtils } from '@deephaven/utils';\n\nimport './CustomFormatAction.scss';\n\ntype CustomFormatActionProps = typeof CustomFormatAction.defaultProps & {\n forwardedProps: {\n menuItem: {\n title?: string;\n description?: string;\n };\n };\n};\n\n/**\n * Renders menuElement option with custom format input for use in formatting context menus\n *\n * TODO:\n * - capture focus when this menu action is selected via ArrowUp/ArrowDown keys\n * - dynamically update selected menu item when clicking on the input box\n */\nclass CustomFormatAction extends Component<CustomFormatActionProps> {\n static defaultProps = {\n formatString: '',\n forwardedProps: {\n menuItem: {},\n closeMenu(focusInput: boolean): void {\n // no-op\n },\n iconElement: null,\n },\n placeholder: '',\n title: '',\n onChange(value: string | null): void {\n // no-op\n },\n };\n\n constructor(\n props: CustomFormatActionProps = CustomFormatAction.defaultProps\n ) {\n super(props);\n\n this.handleInputChange = this.handleInputChange.bind(this);\n this.handleKeyDown = this.handleKeyDown.bind(this);\n\n this.inputRef = React.createRef();\n }\n\n inputRef: React.RefObject<HTMLInputElement>;\n\n handleInputChange(): void {\n const { onChange } = this.props;\n if (this.inputRef.current) {\n onChange(this.inputRef.current.value);\n }\n }\n\n closeContextMenu(): void {\n const { forwardedProps } = this.props;\n const { closeMenu } = forwardedProps;\n closeMenu(true);\n }\n\n revertToDefault(): void {\n const { onChange } = this.props;\n onChange(null);\n }\n\n returnFocusToContextMenu(): void {\n const parentContextMenu = DOMUtils.getClosestByClassName(\n this.inputRef.current,\n 'context-menu-container'\n );\n if (parentContextMenu instanceof HTMLElement) {\n parentContextMenu.focus();\n }\n }\n\n handleKeyDown(event: React.KeyboardEvent<HTMLInputElement>): void {\n switch (event.key) {\n case 'Enter':\n event.stopPropagation();\n this.closeContextMenu();\n break;\n case 'Escape':\n event.stopPropagation();\n this.revertToDefault();\n this.closeContextMenu();\n break;\n case 'ArrowRight':\n case 'ArrowLeft':\n event.stopPropagation();\n break;\n case 'ArrowUp':\n case 'ArrowDown':\n this.returnFocusToContextMenu();\n break;\n default:\n event.stopPropagation();\n }\n }\n\n render(): JSX.Element {\n const { formatString, forwardedProps, placeholder, title } = this.props;\n const {\n menuItem: { description },\n iconElement,\n } = forwardedProps;\n return (\n <div className=\"form-group flex-grow mb-0\">\n <div className=\"custom-format-title\">\n <span className=\"icon\">{iconElement}</span>\n <label className=\"title mb-0\" htmlFor=\"custom-format-input\">\n {title}\n {description != null && <Tooltip>{description}</Tooltip>}\n </label>\n </div>\n <div className=\"pl-2 pr-2 pb-2\">\n <input\n id=\"custom-format-input\"\n className=\"form-control text-right mb-0\"\n type=\"text\"\n defaultValue={formatString}\n ref={this.inputRef}\n placeholder={placeholder}\n onKeyDown={this.handleKeyDown}\n onChange={this.handleInputChange}\n autoComplete=\"off\"\n autoCorrect=\"off\"\n autoCapitalize=\"off\"\n spellCheck=\"false\"\n />\n </div>\n </div>\n );\n }\n}\n\nexport default CustomFormatAction;\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,OAAO,QAAQ,uBAAuB;AAC/C,SAASC,QAAQ,QAAQ,kBAAkB;AAAC;AAa5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,kBAAkB,SAASH,SAAS,CAA0B;EAiBlEI,WAAW,GAET;IAAA,IADAC,KAA8B,uEAAGF,kBAAkB,CAACG,YAAY;IAEhE,KAAK,CAACD,KAAK,CAAC;IAAC;IAEb,IAAI,CAACE,iBAAiB,GAAG,IAAI,CAACA,iBAAiB,CAACC,IAAI,CAAC,IAAI,CAAC;IAC1D,IAAI,CAACC,aAAa,GAAG,IAAI,CAACA,aAAa,CAACD,IAAI,CAAC,IAAI,CAAC;IAElD,IAAI,CAACE,QAAQ,gBAAGX,KAAK,CAACY,SAAS,EAAE;EACnC;EAIAJ,iBAAiB,GAAS;IACxB,IAAM;MAAEK;IAAS,CAAC,GAAG,IAAI,CAACP,KAAK;IAC/B,IAAI,IAAI,CAACK,QAAQ,CAACG,OAAO,EAAE;MACzBD,QAAQ,CAAC,IAAI,CAACF,QAAQ,CAACG,OAAO,CAACC,KAAK,CAAC;IACvC;EACF;EAEAC,gBAAgB,GAAS;IACvB,IAAM;MAAEC;IAAe,CAAC,GAAG,IAAI,CAACX,KAAK;IACrC,IAAM;MAAEY;IAAU,CAAC,GAAGD,cAAc;IACpCC,SAAS,CAAC,IAAI,CAAC;EACjB;EAEAC,eAAe,GAAS;IACtB,IAAM;MAAEN;IAAS,CAAC,GAAG,IAAI,CAACP,KAAK;IAC/BO,QAAQ,CAAC,IAAI,CAAC;EAChB;EAEAO,wBAAwB,GAAS;IAC/B,IAAMC,iBAAiB,GAAGlB,QAAQ,CAACmB,qBAAqB,CACtD,IAAI,CAACX,QAAQ,CAACG,OAAO,EACrB,wBAAwB,CACzB;IACD,IAAIO,iBAAiB,YAAYE,WAAW,EAAE;MAC5CF,iBAAiB,CAACG,KAAK,EAAE;IAC3B;EACF;EAEAd,aAAa,CAACe,KAA4C,EAAQ;IAChE,QAAQA,KAAK,CAACC,GAAG;MACf,KAAK,OAAO;QACVD,KAAK,CAACE,eAAe,EAAE;QACvB,IAAI,CAACX,gBAAgB,EAAE;QACvB;MACF,KAAK,QAAQ;QACXS,KAAK,CAACE,eAAe,EAAE;QACvB,IAAI,CAACR,eAAe,EAAE;QACtB,IAAI,CAACH,gBAAgB,EAAE;QACvB;MACF,KAAK,YAAY;MACjB,KAAK,WAAW;QACdS,KAAK,CAACE,eAAe,EAAE;QACvB;MACF,KAAK,SAAS;MACd,KAAK,WAAW;QACd,IAAI,CAACP,wBAAwB,EAAE;QAC/B;MACF;QACEK,KAAK,CAACE,eAAe,EAAE;IAAC;EAE9B;EAEAC,MAAM,GAAgB;IACpB,IAAM;MAAEC,YAAY;MAAEZ,cAAc;MAAEa,WAAW;MAAEC;IAAM,CAAC,GAAG,IAAI,CAACzB,KAAK;IACvE,IAAM;MACJ0B,QAAQ,EAAE;QAAEC;MAAY,CAAC;MACzBC;IACF,CAAC,GAAGjB,cAAc;IAClB,oBACE;MAAK,SAAS,EAAC;IAA2B,gBACxC;MAAK,SAAS,EAAC;IAAqB,gBAClC;MAAM,SAAS,EAAC;IAAM,GAAEiB,WAAW,CAAQ,eAC3C;MAAO,SAAS,EAAC,YAAY;MAAC,OAAO,EAAC;IAAqB,GACxDH,KAAK,EACLE,WAAW,IAAI,IAAI,iBAAI,oBAAC,OAAO,QAAEA,WAAW,CAAW,CAClD,CACJ,eACN;MAAK,SAAS,EAAC;IAAgB,gBAC7B;MACE,EAAE,EAAC,qBAAqB;MACxB,SAAS,EAAC,8BAA8B;MACxC,IAAI,EAAC,MAAM;MACX,YAAY,EAAEJ,YAAa;MAC3B,GAAG,EAAE,IAAI,CAAClB,QAAS;MACnB,WAAW,EAAEmB,WAAY;MACzB,SAAS,EAAE,IAAI,CAACpB,aAAc;MAC9B,QAAQ,EAAE,IAAI,CAACF,iBAAkB;MACjC,YAAY,EAAC,KAAK;MAClB,WAAW,EAAC,KAAK;MACjB,cAAc,EAAC,KAAK;MACpB,UAAU,EAAC;IAAO,EAClB,CACE,CACF;EAEV;AACF;AAAC,gBApHKJ,kBAAkB,kBACA;EACpByB,YAAY,EAAE,EAAE;EAChBZ,cAAc,EAAE;IACde,QAAQ,EAAE,CAAC,CAAC;IACZd,SAAS,CAACiB,UAAmB,EAAQ;MACnC;IAAA,CACD;IACDD,WAAW,EAAE;EACf,CAAC;EACDJ,WAAW,EAAE,EAAE;EACfC,KAAK,EAAE,EAAE;EACTlB,QAAQ,CAACE,KAAoB,EAAQ;IACnC;EAAA;AAEJ,CAAC;AAuGH,eAAeX,kBAAkB"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
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); }
|
|
4
|
+
import { DateTimeColumnFormatter, TableUtils } from '@deephaven/jsapi-utils';
|
|
5
|
+
import FormatContextMenuUtils from "./FormatContextMenuUtils.js";
|
|
6
|
+
class DateTimeFormatContextMenu {
|
|
7
|
+
/**
|
|
8
|
+
* Creates list of formatting options for DateTime context menu
|
|
9
|
+
* @param formatter Formatter instance
|
|
10
|
+
* @param selectedFormat Selected format object, null for no selected format
|
|
11
|
+
* @returns Array of formatting options for the context menu
|
|
12
|
+
*/
|
|
13
|
+
static getOptions(formatter, selectedFormat) {
|
|
14
|
+
var currentTime = new Date();
|
|
15
|
+
var formatItems = [{
|
|
16
|
+
group: DateTimeFormatContextMenu.dateGroup,
|
|
17
|
+
formatString: 'yyyy-MM-dd'
|
|
18
|
+
}, {
|
|
19
|
+
group: DateTimeFormatContextMenu.dateGroup,
|
|
20
|
+
formatString: 'MM-dd-yyyy'
|
|
21
|
+
}, {
|
|
22
|
+
group: DateTimeFormatContextMenu.timeGroup,
|
|
23
|
+
formatString: 'HH:mm:ss'
|
|
24
|
+
}, {
|
|
25
|
+
group: DateTimeFormatContextMenu.timeGroup,
|
|
26
|
+
formatString: 'HH:mm:ss.SSS'
|
|
27
|
+
}, {
|
|
28
|
+
group: DateTimeFormatContextMenu.timeGroup,
|
|
29
|
+
formatString: 'HH:mm:ss.SSSSSSSSS'
|
|
30
|
+
}, {
|
|
31
|
+
group: DateTimeFormatContextMenu.dateTimeGroup,
|
|
32
|
+
formatString: "yyyy-MM-dd HH:mm:ss"
|
|
33
|
+
}, {
|
|
34
|
+
group: DateTimeFormatContextMenu.dateTimeGroup,
|
|
35
|
+
formatString: "yyyy-MM-dd HH:mm:ss.SSS"
|
|
36
|
+
}, {
|
|
37
|
+
group: DateTimeFormatContextMenu.dateTimeGroup,
|
|
38
|
+
formatString: "yyyy-MM-dd HH:mm:ss.SSSSSSSSS"
|
|
39
|
+
}];
|
|
40
|
+
var presetFormatOptions = formatItems.map(item => {
|
|
41
|
+
var format = DateTimeColumnFormatter.makeFormat('', item.formatString, DateTimeColumnFormatter.TYPE_CONTEXT_PRESET);
|
|
42
|
+
var title = formatter.getFormattedString(currentTime, TableUtils.dataType.DATETIME, '', format);
|
|
43
|
+
return FormatContextMenuUtils.makeOption(title, format, item.group, DateTimeColumnFormatter.isSameFormat(format, selectedFormat));
|
|
44
|
+
});
|
|
45
|
+
var defaultOption = FormatContextMenuUtils.makeOption('Default', null, DateTimeFormatContextMenu.dateGroup, FormatContextMenuUtils.isDefaultSelected(selectedFormat));
|
|
46
|
+
return [defaultOption, ...presetFormatOptions];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
_defineProperty(DateTimeFormatContextMenu, "dateGroup", 10);
|
|
50
|
+
_defineProperty(DateTimeFormatContextMenu, "timeGroup", 20);
|
|
51
|
+
_defineProperty(DateTimeFormatContextMenu, "dateTimeGroup", 30);
|
|
52
|
+
export default DateTimeFormatContextMenu;
|
|
53
|
+
//# sourceMappingURL=DateTimeFormatContextMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateTimeFormatContextMenu.js","names":["DateTimeColumnFormatter","TableUtils","FormatContextMenuUtils","DateTimeFormatContextMenu","getOptions","formatter","selectedFormat","currentTime","Date","formatItems","group","dateGroup","formatString","timeGroup","dateTimeGroup","presetFormatOptions","map","item","format","makeFormat","TYPE_CONTEXT_PRESET","title","getFormattedString","dataType","DATETIME","makeOption","isSameFormat","defaultOption","isDefaultSelected"],"sources":["../../src/format-context-menus/DateTimeFormatContextMenu.ts"],"sourcesContent":["import {\n DateTimeColumnFormatter,\n Formatter,\n TableColumnFormat,\n TableUtils,\n} from '@deephaven/jsapi-utils';\nimport FormatContextMenuUtils, {\n FormatContextMenuOption,\n} from './FormatContextMenuUtils';\n\nclass DateTimeFormatContextMenu {\n static dateGroup = 10;\n\n static timeGroup = 20;\n\n static dateTimeGroup = 30;\n\n /**\n * Creates list of formatting options for DateTime context menu\n * @param formatter Formatter instance\n * @param selectedFormat Selected format object, null for no selected format\n * @returns Array of formatting options for the context menu\n */\n static getOptions(\n formatter: Formatter,\n selectedFormat: TableColumnFormat | null\n ): FormatContextMenuOption[] {\n const currentTime = new Date();\n const formatItems = [\n {\n group: DateTimeFormatContextMenu.dateGroup,\n formatString: 'yyyy-MM-dd',\n },\n {\n group: DateTimeFormatContextMenu.dateGroup,\n formatString: 'MM-dd-yyyy',\n },\n\n {\n group: DateTimeFormatContextMenu.timeGroup,\n formatString: 'HH:mm:ss',\n },\n {\n group: DateTimeFormatContextMenu.timeGroup,\n formatString: 'HH:mm:ss.SSS',\n },\n {\n group: DateTimeFormatContextMenu.timeGroup,\n formatString: 'HH:mm:ss.SSSSSSSSS',\n },\n\n {\n group: DateTimeFormatContextMenu.dateTimeGroup,\n formatString: `yyyy-MM-dd HH:mm:ss`,\n },\n {\n group: DateTimeFormatContextMenu.dateTimeGroup,\n formatString: `yyyy-MM-dd HH:mm:ss.SSS`,\n },\n {\n group: DateTimeFormatContextMenu.dateTimeGroup,\n formatString: `yyyy-MM-dd HH:mm:ss.SSSSSSSSS`,\n },\n ];\n\n const presetFormatOptions = formatItems.map(item => {\n const format = DateTimeColumnFormatter.makeFormat(\n '',\n item.formatString,\n DateTimeColumnFormatter.TYPE_CONTEXT_PRESET\n );\n const title = formatter.getFormattedString(\n currentTime,\n TableUtils.dataType.DATETIME,\n '',\n format\n );\n\n return FormatContextMenuUtils.makeOption(\n title,\n format,\n item.group,\n DateTimeColumnFormatter.isSameFormat(format, selectedFormat)\n );\n });\n\n const defaultOption = FormatContextMenuUtils.makeOption(\n 'Default',\n null,\n DateTimeFormatContextMenu.dateGroup,\n FormatContextMenuUtils.isDefaultSelected(selectedFormat)\n );\n\n return [defaultOption, ...presetFormatOptions];\n }\n}\n\nexport default DateTimeFormatContextMenu;\n"],"mappings":";;;AAAA,SACEA,uBAAuB,EAGvBC,UAAU,QACL,wBAAwB;AAAC,OACzBC,sBAAsB;AAI7B,MAAMC,yBAAyB,CAAC;EAO9B;AACF;AACA;AACA;AACA;AACA;EACE,OAAOC,UAAU,CACfC,SAAoB,EACpBC,cAAwC,EACb;IAC3B,IAAMC,WAAW,GAAG,IAAIC,IAAI,EAAE;IAC9B,IAAMC,WAAW,GAAG,CAClB;MACEC,KAAK,EAAEP,yBAAyB,CAACQ,SAAS;MAC1CC,YAAY,EAAE;IAChB,CAAC,EACD;MACEF,KAAK,EAAEP,yBAAyB,CAACQ,SAAS;MAC1CC,YAAY,EAAE;IAChB,CAAC,EAED;MACEF,KAAK,EAAEP,yBAAyB,CAACU,SAAS;MAC1CD,YAAY,EAAE;IAChB,CAAC,EACD;MACEF,KAAK,EAAEP,yBAAyB,CAACU,SAAS;MAC1CD,YAAY,EAAE;IAChB,CAAC,EACD;MACEF,KAAK,EAAEP,yBAAyB,CAACU,SAAS;MAC1CD,YAAY,EAAE;IAChB,CAAC,EAED;MACEF,KAAK,EAAEP,yBAAyB,CAACW,aAAa;MAC9CF,YAAY;IACd,CAAC,EACD;MACEF,KAAK,EAAEP,yBAAyB,CAACW,aAAa;MAC9CF,YAAY;IACd,CAAC,EACD;MACEF,KAAK,EAAEP,yBAAyB,CAACW,aAAa;MAC9CF,YAAY;IACd,CAAC,CACF;IAED,IAAMG,mBAAmB,GAAGN,WAAW,CAACO,GAAG,CAACC,IAAI,IAAI;MAClD,IAAMC,MAAM,GAAGlB,uBAAuB,CAACmB,UAAU,CAC/C,EAAE,EACFF,IAAI,CAACL,YAAY,EACjBZ,uBAAuB,CAACoB,mBAAmB,CAC5C;MACD,IAAMC,KAAK,GAAGhB,SAAS,CAACiB,kBAAkB,CACxCf,WAAW,EACXN,UAAU,CAACsB,QAAQ,CAACC,QAAQ,EAC5B,EAAE,EACFN,MAAM,CACP;MAED,OAAOhB,sBAAsB,CAACuB,UAAU,CACtCJ,KAAK,EACLH,MAAM,EACND,IAAI,CAACP,KAAK,EACVV,uBAAuB,CAAC0B,YAAY,CAACR,MAAM,EAAEZ,cAAc,CAAC,CAC7D;IACH,CAAC,CAAC;IAEF,IAAMqB,aAAa,GAAGzB,sBAAsB,CAACuB,UAAU,CACrD,SAAS,EACT,IAAI,EACJtB,yBAAyB,CAACQ,SAAS,EACnCT,sBAAsB,CAAC0B,iBAAiB,CAACtB,cAAc,CAAC,CACzD;IAED,OAAO,CAACqB,aAAa,EAAE,GAAGZ,mBAAmB,CAAC;EAChD;AACF;AAAC,gBArFKZ,yBAAyB,eACV,EAAE;AAAA,gBADjBA,yBAAyB,eAGV,EAAE;AAAA,gBAHjBA,yBAAyB,mBAKN,EAAE;AAkF3B,eAAeA,yBAAyB"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
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); }
|
|
4
|
+
import { DecimalColumnFormatter } from '@deephaven/jsapi-utils';
|
|
5
|
+
import FormatContextMenuUtils from "./FormatContextMenuUtils.js";
|
|
6
|
+
class DecimalFormatContextMenu {
|
|
7
|
+
/**
|
|
8
|
+
* Creates list of formatting options for Decimal context menu
|
|
9
|
+
* @param dh JSAPI instance
|
|
10
|
+
* @param selectedFormat Selected format object, null for no selected format
|
|
11
|
+
* @param onCustomFormatChange Callback to call when the custom format is changed
|
|
12
|
+
* @returns Array of formatting options for the context menu
|
|
13
|
+
*/
|
|
14
|
+
static getOptions(dh, selectedFormat, onCustomFormatChange) {
|
|
15
|
+
var formatItems = [{
|
|
16
|
+
format: DecimalColumnFormatter.FORMAT_PERCENT,
|
|
17
|
+
group: DecimalFormatContextMenu.presetGroup
|
|
18
|
+
}, {
|
|
19
|
+
format: DecimalColumnFormatter.FORMAT_BASIS_POINTS,
|
|
20
|
+
group: DecimalFormatContextMenu.presetGroup
|
|
21
|
+
}, {
|
|
22
|
+
format: DecimalColumnFormatter.FORMAT_MILLIONS,
|
|
23
|
+
group: DecimalFormatContextMenu.presetGroup
|
|
24
|
+
}, {
|
|
25
|
+
format: DecimalColumnFormatter.FORMAT_SCIENTIFIC_NOTATION,
|
|
26
|
+
group: DecimalFormatContextMenu.presetGroup
|
|
27
|
+
}, {
|
|
28
|
+
format: DecimalColumnFormatter.FORMAT_ROUND,
|
|
29
|
+
group: DecimalFormatContextMenu.presetRoundGroup
|
|
30
|
+
}, {
|
|
31
|
+
format: DecimalColumnFormatter.FORMAT_ROUND_TWO_DECIMALS,
|
|
32
|
+
group: DecimalFormatContextMenu.presetRoundGroup
|
|
33
|
+
}, {
|
|
34
|
+
format: DecimalColumnFormatter.FORMAT_ROUND_FOUR_DECIMALS,
|
|
35
|
+
group: DecimalFormatContextMenu.presetRoundGroup
|
|
36
|
+
}];
|
|
37
|
+
var defaultFormatOption = FormatContextMenuUtils.makeOption('Default', null, DecimalFormatContextMenu.defaultGroup, FormatContextMenuUtils.isDefaultSelected(selectedFormat));
|
|
38
|
+
var presetFormatOptions = formatItems.map(item => FormatContextMenuUtils.makeOption(item.format.label, item.format, item.group, DecimalColumnFormatter.isSameFormat(item.format, selectedFormat)));
|
|
39
|
+
var isCustomSelected = FormatContextMenuUtils.isCustomSelected(selectedFormat);
|
|
40
|
+
var customFormat = isCustomSelected ? selectedFormat : DecimalColumnFormatter.makeCustomFormat();
|
|
41
|
+
var customFormatOption = FormatContextMenuUtils.makeCustomFormatOption(customFormat, DecimalFormatContextMenu.customGroup, DecimalColumnFormatter.DEFAULT_FORMAT_STRING, isCustomSelected, formatString => {
|
|
42
|
+
if (formatString != null) {
|
|
43
|
+
var newCustomFormat = DecimalColumnFormatter.makeCustomFormat(formatString);
|
|
44
|
+
if (DecimalColumnFormatter.isValid(dh, newCustomFormat)) {
|
|
45
|
+
onCustomFormatChange(newCustomFormat);
|
|
46
|
+
}
|
|
47
|
+
} else {
|
|
48
|
+
onCustomFormatChange(null);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
return [defaultFormatOption, ...presetFormatOptions, customFormatOption];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
_defineProperty(DecimalFormatContextMenu, "defaultGroup", 10);
|
|
55
|
+
_defineProperty(DecimalFormatContextMenu, "presetGroup", 20);
|
|
56
|
+
_defineProperty(DecimalFormatContextMenu, "presetRoundGroup", 30);
|
|
57
|
+
_defineProperty(DecimalFormatContextMenu, "customGroup", 40);
|
|
58
|
+
export default DecimalFormatContextMenu;
|
|
59
|
+
//# sourceMappingURL=DecimalFormatContextMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DecimalFormatContextMenu.js","names":["DecimalColumnFormatter","FormatContextMenuUtils","DecimalFormatContextMenu","getOptions","dh","selectedFormat","onCustomFormatChange","formatItems","format","FORMAT_PERCENT","group","presetGroup","FORMAT_BASIS_POINTS","FORMAT_MILLIONS","FORMAT_SCIENTIFIC_NOTATION","FORMAT_ROUND","presetRoundGroup","FORMAT_ROUND_TWO_DECIMALS","FORMAT_ROUND_FOUR_DECIMALS","defaultFormatOption","makeOption","defaultGroup","isDefaultSelected","presetFormatOptions","map","item","label","isSameFormat","isCustomSelected","customFormat","makeCustomFormat","customFormatOption","makeCustomFormatOption","customGroup","DEFAULT_FORMAT_STRING","formatString","newCustomFormat","isValid"],"sources":["../../src/format-context-menus/DecimalFormatContextMenu.ts"],"sourcesContent":["import {\n DecimalColumnFormat,\n DecimalColumnFormatter,\n} from '@deephaven/jsapi-utils';\nimport type { dh as DhType } from '@deephaven/jsapi-types';\nimport FormatContextMenuUtils, {\n FormatContextMenuOption,\n} from './FormatContextMenuUtils';\n\nclass DecimalFormatContextMenu {\n static defaultGroup = 10;\n\n static presetGroup = 20;\n\n static presetRoundGroup = 30;\n\n static customGroup = 40;\n\n /**\n * Creates list of formatting options for Decimal context menu\n * @param dh JSAPI instance\n * @param selectedFormat Selected format object, null for no selected format\n * @param onCustomFormatChange Callback to call when the custom format is changed\n * @returns Array of formatting options for the context menu\n */\n static getOptions(\n dh: DhType,\n selectedFormat: DecimalColumnFormat,\n onCustomFormatChange: (value: DecimalColumnFormat | null) => void\n ): FormatContextMenuOption[] {\n const formatItems = [\n {\n format: DecimalColumnFormatter.FORMAT_PERCENT,\n group: DecimalFormatContextMenu.presetGroup,\n },\n {\n format: DecimalColumnFormatter.FORMAT_BASIS_POINTS,\n group: DecimalFormatContextMenu.presetGroup,\n },\n {\n format: DecimalColumnFormatter.FORMAT_MILLIONS,\n group: DecimalFormatContextMenu.presetGroup,\n },\n {\n format: DecimalColumnFormatter.FORMAT_SCIENTIFIC_NOTATION,\n group: DecimalFormatContextMenu.presetGroup,\n },\n {\n format: DecimalColumnFormatter.FORMAT_ROUND,\n group: DecimalFormatContextMenu.presetRoundGroup,\n },\n {\n format: DecimalColumnFormatter.FORMAT_ROUND_TWO_DECIMALS,\n group: DecimalFormatContextMenu.presetRoundGroup,\n },\n {\n format: DecimalColumnFormatter.FORMAT_ROUND_FOUR_DECIMALS,\n group: DecimalFormatContextMenu.presetRoundGroup,\n },\n ];\n\n const defaultFormatOption = FormatContextMenuUtils.makeOption(\n 'Default',\n null,\n DecimalFormatContextMenu.defaultGroup,\n FormatContextMenuUtils.isDefaultSelected(selectedFormat)\n );\n\n const presetFormatOptions = formatItems.map(item =>\n FormatContextMenuUtils.makeOption(\n item.format.label,\n item.format,\n item.group,\n DecimalColumnFormatter.isSameFormat(item.format, selectedFormat)\n )\n );\n\n const isCustomSelected = FormatContextMenuUtils.isCustomSelected(\n selectedFormat\n );\n\n const customFormat = isCustomSelected\n ? selectedFormat\n : DecimalColumnFormatter.makeCustomFormat();\n\n const customFormatOption = FormatContextMenuUtils.makeCustomFormatOption(\n customFormat,\n DecimalFormatContextMenu.customGroup,\n DecimalColumnFormatter.DEFAULT_FORMAT_STRING,\n isCustomSelected,\n formatString => {\n if (formatString != null) {\n const newCustomFormat = DecimalColumnFormatter.makeCustomFormat(\n formatString\n );\n if (DecimalColumnFormatter.isValid(dh, newCustomFormat)) {\n onCustomFormatChange(newCustomFormat);\n }\n } else {\n onCustomFormatChange(null);\n }\n }\n );\n\n return [defaultFormatOption, ...presetFormatOptions, customFormatOption];\n }\n}\n\nexport default DecimalFormatContextMenu;\n"],"mappings":";;;AAAA,SAEEA,sBAAsB,QACjB,wBAAwB;AAAC,OAEzBC,sBAAsB;AAI7B,MAAMC,wBAAwB,CAAC;EAS7B;AACF;AACA;AACA;AACA;AACA;AACA;EACE,OAAOC,UAAU,CACfC,EAAU,EACVC,cAAmC,EACnCC,oBAAiE,EACtC;IAC3B,IAAMC,WAAW,GAAG,CAClB;MACEC,MAAM,EAAER,sBAAsB,CAACS,cAAc;MAC7CC,KAAK,EAAER,wBAAwB,CAACS;IAClC,CAAC,EACD;MACEH,MAAM,EAAER,sBAAsB,CAACY,mBAAmB;MAClDF,KAAK,EAAER,wBAAwB,CAACS;IAClC,CAAC,EACD;MACEH,MAAM,EAAER,sBAAsB,CAACa,eAAe;MAC9CH,KAAK,EAAER,wBAAwB,CAACS;IAClC,CAAC,EACD;MACEH,MAAM,EAAER,sBAAsB,CAACc,0BAA0B;MACzDJ,KAAK,EAAER,wBAAwB,CAACS;IAClC,CAAC,EACD;MACEH,MAAM,EAAER,sBAAsB,CAACe,YAAY;MAC3CL,KAAK,EAAER,wBAAwB,CAACc;IAClC,CAAC,EACD;MACER,MAAM,EAAER,sBAAsB,CAACiB,yBAAyB;MACxDP,KAAK,EAAER,wBAAwB,CAACc;IAClC,CAAC,EACD;MACER,MAAM,EAAER,sBAAsB,CAACkB,0BAA0B;MACzDR,KAAK,EAAER,wBAAwB,CAACc;IAClC,CAAC,CACF;IAED,IAAMG,mBAAmB,GAAGlB,sBAAsB,CAACmB,UAAU,CAC3D,SAAS,EACT,IAAI,EACJlB,wBAAwB,CAACmB,YAAY,EACrCpB,sBAAsB,CAACqB,iBAAiB,CAACjB,cAAc,CAAC,CACzD;IAED,IAAMkB,mBAAmB,GAAGhB,WAAW,CAACiB,GAAG,CAACC,IAAI,IAC9CxB,sBAAsB,CAACmB,UAAU,CAC/BK,IAAI,CAACjB,MAAM,CAACkB,KAAK,EACjBD,IAAI,CAACjB,MAAM,EACXiB,IAAI,CAACf,KAAK,EACVV,sBAAsB,CAAC2B,YAAY,CAACF,IAAI,CAACjB,MAAM,EAAEH,cAAc,CAAC,CACjE,CACF;IAED,IAAMuB,gBAAgB,GAAG3B,sBAAsB,CAAC2B,gBAAgB,CAC9DvB,cAAc,CACf;IAED,IAAMwB,YAAY,GAAGD,gBAAgB,GACjCvB,cAAc,GACdL,sBAAsB,CAAC8B,gBAAgB,EAAE;IAE7C,IAAMC,kBAAkB,GAAG9B,sBAAsB,CAAC+B,sBAAsB,CACtEH,YAAY,EACZ3B,wBAAwB,CAAC+B,WAAW,EACpCjC,sBAAsB,CAACkC,qBAAqB,EAC5CN,gBAAgB,EAChBO,YAAY,IAAI;MACd,IAAIA,YAAY,IAAI,IAAI,EAAE;QACxB,IAAMC,eAAe,GAAGpC,sBAAsB,CAAC8B,gBAAgB,CAC7DK,YAAY,CACb;QACD,IAAInC,sBAAsB,CAACqC,OAAO,CAACjC,EAAE,EAAEgC,eAAe,CAAC,EAAE;UACvD9B,oBAAoB,CAAC8B,eAAe,CAAC;QACvC;MACF,CAAC,MAAM;QACL9B,oBAAoB,CAAC,IAAI,CAAC;MAC5B;IACF,CAAC,CACF;IAED,OAAO,CAACa,mBAAmB,EAAE,GAAGI,mBAAmB,EAAEQ,kBAAkB,CAAC;EAC1E;AACF;AAAC,gBAjGK7B,wBAAwB,kBACN,EAAE;AAAA,gBADpBA,wBAAwB,iBAGP,EAAE;AAAA,gBAHnBA,wBAAwB,sBAKF,EAAE;AAAA,gBALxBA,wBAAwB,iBAOP,EAAE;AA4FzB,eAAeA,wBAAwB"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TableColumnFormatter } from '@deephaven/jsapi-utils';
|
|
3
|
+
import CustomFormatAction from "./CustomFormatAction.js";
|
|
4
|
+
class FormatContextMenuUtils {
|
|
5
|
+
/**
|
|
6
|
+
* Returns true if default option should be active in the context menu
|
|
7
|
+
* @param selectedFormat selected format object or null
|
|
8
|
+
*/
|
|
9
|
+
static isDefaultSelected(selectedFormat) {
|
|
10
|
+
return !selectedFormat || ![TableColumnFormatter.TYPE_CONTEXT_CUSTOM, TableColumnFormatter.TYPE_CONTEXT_PRESET].includes(selectedFormat.type);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Returns true if custom format option should be active in the context menu
|
|
15
|
+
* @param selectedFormat selected format object or null
|
|
16
|
+
*/
|
|
17
|
+
static isCustomSelected(selectedFormat) {
|
|
18
|
+
return selectedFormat != null && selectedFormat.type === TableColumnFormatter.TYPE_CONTEXT_CUSTOM;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Creates context menu option
|
|
23
|
+
* @param title Context menu title
|
|
24
|
+
* @param format Format object
|
|
25
|
+
* @param group Context menu group
|
|
26
|
+
* @param isSelected Is current option selected
|
|
27
|
+
*/
|
|
28
|
+
static makeOption(title, format, group, isSelected) {
|
|
29
|
+
return {
|
|
30
|
+
title,
|
|
31
|
+
description: title,
|
|
32
|
+
group,
|
|
33
|
+
format,
|
|
34
|
+
isSelected
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Creates context menu option with an input element
|
|
40
|
+
* @param format Format object
|
|
41
|
+
* @param group Context menu group
|
|
42
|
+
* @param placeholder Input element placeholder
|
|
43
|
+
* @param isSelected Is current option selected
|
|
44
|
+
* @param onChange Input element onChange callback
|
|
45
|
+
*/
|
|
46
|
+
static makeCustomFormatOption(format, group, placeholder, isSelected, onChange) {
|
|
47
|
+
return {
|
|
48
|
+
title: format.label,
|
|
49
|
+
description: format.label,
|
|
50
|
+
format,
|
|
51
|
+
group,
|
|
52
|
+
isSelected,
|
|
53
|
+
menuElement: /*#__PURE__*/React.createElement(CustomFormatAction, {
|
|
54
|
+
formatString: format.formatString,
|
|
55
|
+
title: format.label,
|
|
56
|
+
placeholder: placeholder,
|
|
57
|
+
onChange: onChange
|
|
58
|
+
})
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
export default FormatContextMenuUtils;
|
|
63
|
+
//# sourceMappingURL=FormatContextMenuUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormatContextMenuUtils.js","names":["React","TableColumnFormatter","CustomFormatAction","FormatContextMenuUtils","isDefaultSelected","selectedFormat","TYPE_CONTEXT_CUSTOM","TYPE_CONTEXT_PRESET","includes","type","isCustomSelected","makeOption","title","format","group","isSelected","description","makeCustomFormatOption","placeholder","onChange","label","menuElement","formatString"],"sources":["../../src/format-context-menus/FormatContextMenuUtils.tsx"],"sourcesContent":["import React from 'react';\nimport {\n TableColumnFormat,\n TableColumnFormatter,\n} from '@deephaven/jsapi-utils';\nimport CustomFormatAction from './CustomFormatAction';\n\nexport interface FormatContextMenuOption {\n title: string;\n description: string;\n group: number;\n format: TableColumnFormat | null;\n isSelected: boolean;\n}\n\nexport interface CustomFormatOption extends FormatContextMenuOption {\n menuElement: React.ReactElement;\n}\n\nclass FormatContextMenuUtils {\n /**\n * Returns true if default option should be active in the context menu\n * @param selectedFormat selected format object or null\n */\n static isDefaultSelected(selectedFormat: TableColumnFormat | null): boolean {\n return (\n !selectedFormat ||\n ![\n TableColumnFormatter.TYPE_CONTEXT_CUSTOM,\n TableColumnFormatter.TYPE_CONTEXT_PRESET,\n ].includes(selectedFormat.type)\n );\n }\n\n /**\n * Returns true if custom format option should be active in the context menu\n * @param selectedFormat selected format object or null\n */\n static isCustomSelected(selectedFormat: TableColumnFormat): boolean {\n return (\n selectedFormat != null &&\n selectedFormat.type === TableColumnFormatter.TYPE_CONTEXT_CUSTOM\n );\n }\n\n /**\n * Creates context menu option\n * @param title Context menu title\n * @param format Format object\n * @param group Context menu group\n * @param isSelected Is current option selected\n */\n static makeOption(\n title: string,\n format: TableColumnFormat | null,\n group: number,\n isSelected: boolean\n ): FormatContextMenuOption {\n return {\n title,\n description: title,\n group,\n format,\n isSelected,\n };\n }\n\n /**\n * Creates context menu option with an input element\n * @param format Format object\n * @param group Context menu group\n * @param placeholder Input element placeholder\n * @param isSelected Is current option selected\n * @param onChange Input element onChange callback\n */\n static makeCustomFormatOption(\n format: TableColumnFormat,\n group: number,\n placeholder: string,\n isSelected: boolean,\n onChange: (value: string | null) => void\n ): CustomFormatOption {\n return {\n title: format.label,\n description: format.label,\n format,\n group,\n isSelected,\n menuElement: (\n <CustomFormatAction\n formatString={format.formatString}\n title={format.label}\n placeholder={placeholder}\n onChange={onChange}\n />\n ),\n };\n }\n}\n\nexport default FormatContextMenuUtils;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAEEC,oBAAoB,QACf,wBAAwB;AAAC,OACzBC,kBAAkB;AAczB,MAAMC,sBAAsB,CAAC;EAC3B;AACF;AACA;AACA;EACE,OAAOC,iBAAiB,CAACC,cAAwC,EAAW;IAC1E,OACE,CAACA,cAAc,IACf,CAAC,CACCJ,oBAAoB,CAACK,mBAAmB,EACxCL,oBAAoB,CAACM,mBAAmB,CACzC,CAACC,QAAQ,CAACH,cAAc,CAACI,IAAI,CAAC;EAEnC;;EAEA;AACF;AACA;AACA;EACE,OAAOC,gBAAgB,CAACL,cAAiC,EAAW;IAClE,OACEA,cAAc,IAAI,IAAI,IACtBA,cAAc,CAACI,IAAI,KAAKR,oBAAoB,CAACK,mBAAmB;EAEpE;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACE,OAAOK,UAAU,CACfC,KAAa,EACbC,MAAgC,EAChCC,KAAa,EACbC,UAAmB,EACM;IACzB,OAAO;MACLH,KAAK;MACLI,WAAW,EAAEJ,KAAK;MAClBE,KAAK;MACLD,MAAM;MACNE;IACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,OAAOE,sBAAsB,CAC3BJ,MAAyB,EACzBC,KAAa,EACbI,WAAmB,EACnBH,UAAmB,EACnBI,QAAwC,EACpB;IACpB,OAAO;MACLP,KAAK,EAAEC,MAAM,CAACO,KAAK;MACnBJ,WAAW,EAAEH,MAAM,CAACO,KAAK;MACzBP,MAAM;MACNC,KAAK;MACLC,UAAU;MACVM,WAAW,eACT,oBAAC,kBAAkB;QACjB,YAAY,EAAER,MAAM,CAACS,YAAa;QAClC,KAAK,EAAET,MAAM,CAACO,KAAM;QACpB,WAAW,EAAEF,WAAY;QACzB,QAAQ,EAAEC;MAAS;IAGzB,CAAC;EACH;AACF;AAEA,eAAehB,sBAAsB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
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); }
|
|
4
|
+
import { IntegerColumnFormatter } from '@deephaven/jsapi-utils';
|
|
5
|
+
import FormatContextMenuUtils from "./FormatContextMenuUtils.js";
|
|
6
|
+
class IntegerFormatContextMenu {
|
|
7
|
+
/**
|
|
8
|
+
* Creates list of formatting options for Integer context menu
|
|
9
|
+
* @param dh JSAPI instance
|
|
10
|
+
* @param selectedFormat Selected format object, null for no selected format
|
|
11
|
+
* @param onCustomFormatChange Callback to call when the custom format is changed
|
|
12
|
+
* @returns Array of formatting options for the context menu
|
|
13
|
+
*/
|
|
14
|
+
static getOptions(dh, selectedFormat, onCustomFormatChange) {
|
|
15
|
+
var formatItems = [{
|
|
16
|
+
format: IntegerColumnFormatter.FORMAT_MILLIONS,
|
|
17
|
+
group: IntegerFormatContextMenu.presetGroup
|
|
18
|
+
}, {
|
|
19
|
+
format: IntegerColumnFormatter.FORMAT_SCIENTIFIC_NOTATION,
|
|
20
|
+
group: IntegerFormatContextMenu.presetGroup
|
|
21
|
+
}];
|
|
22
|
+
var defaultFormatOption = FormatContextMenuUtils.makeOption('Default', null, IntegerFormatContextMenu.defaultGroup, FormatContextMenuUtils.isDefaultSelected(selectedFormat));
|
|
23
|
+
var presetFormatOptions = formatItems.map(item => FormatContextMenuUtils.makeOption(item.format.label, item.format, item.group, IntegerColumnFormatter.isSameFormat(item.format, selectedFormat)));
|
|
24
|
+
var isCustomSelected = FormatContextMenuUtils.isCustomSelected(selectedFormat);
|
|
25
|
+
var customFormat = isCustomSelected ? selectedFormat : IntegerColumnFormatter.makeCustomFormat();
|
|
26
|
+
var customFormatOption = FormatContextMenuUtils.makeCustomFormatOption(customFormat, IntegerFormatContextMenu.customGroup, IntegerColumnFormatter.DEFAULT_FORMAT_STRING, isCustomSelected, formatString => {
|
|
27
|
+
if (formatString != null) {
|
|
28
|
+
var newCustomFormat = IntegerColumnFormatter.makeCustomFormat(formatString);
|
|
29
|
+
if (IntegerColumnFormatter.isValid(dh, newCustomFormat)) {
|
|
30
|
+
onCustomFormatChange(newCustomFormat);
|
|
31
|
+
}
|
|
32
|
+
} else {
|
|
33
|
+
onCustomFormatChange(null);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
return [defaultFormatOption, ...presetFormatOptions, customFormatOption];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
_defineProperty(IntegerFormatContextMenu, "defaultGroup", 10);
|
|
40
|
+
_defineProperty(IntegerFormatContextMenu, "presetGroup", 20);
|
|
41
|
+
_defineProperty(IntegerFormatContextMenu, "customGroup", 30);
|
|
42
|
+
export default IntegerFormatContextMenu;
|
|
43
|
+
//# sourceMappingURL=IntegerFormatContextMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IntegerFormatContextMenu.js","names":["IntegerColumnFormatter","FormatContextMenuUtils","IntegerFormatContextMenu","getOptions","dh","selectedFormat","onCustomFormatChange","formatItems","format","FORMAT_MILLIONS","group","presetGroup","FORMAT_SCIENTIFIC_NOTATION","defaultFormatOption","makeOption","defaultGroup","isDefaultSelected","presetFormatOptions","map","item","label","isSameFormat","isCustomSelected","customFormat","makeCustomFormat","customFormatOption","makeCustomFormatOption","customGroup","DEFAULT_FORMAT_STRING","formatString","newCustomFormat","isValid"],"sources":["../../src/format-context-menus/IntegerFormatContextMenu.ts"],"sourcesContent":["import {\n IntegerColumnFormat,\n IntegerColumnFormatter,\n} from '@deephaven/jsapi-utils';\nimport type { dh as DhType } from '@deephaven/jsapi-types';\nimport FormatContextMenuUtils, {\n FormatContextMenuOption,\n} from './FormatContextMenuUtils';\n\nclass IntegerFormatContextMenu {\n static defaultGroup = 10;\n\n static presetGroup = 20;\n\n static customGroup = 30;\n\n /**\n * Creates list of formatting options for Integer context menu\n * @param dh JSAPI instance\n * @param selectedFormat Selected format object, null for no selected format\n * @param onCustomFormatChange Callback to call when the custom format is changed\n * @returns Array of formatting options for the context menu\n */\n static getOptions(\n dh: DhType,\n selectedFormat: IntegerColumnFormat,\n onCustomFormatChange: (value: IntegerColumnFormat | null) => void\n ): FormatContextMenuOption[] {\n const formatItems = [\n {\n format: IntegerColumnFormatter.FORMAT_MILLIONS,\n group: IntegerFormatContextMenu.presetGroup,\n },\n {\n format: IntegerColumnFormatter.FORMAT_SCIENTIFIC_NOTATION,\n group: IntegerFormatContextMenu.presetGroup,\n },\n ];\n\n const defaultFormatOption = FormatContextMenuUtils.makeOption(\n 'Default',\n null,\n IntegerFormatContextMenu.defaultGroup,\n FormatContextMenuUtils.isDefaultSelected(selectedFormat)\n );\n\n const presetFormatOptions = formatItems.map(item =>\n FormatContextMenuUtils.makeOption(\n item.format.label,\n item.format,\n item.group,\n IntegerColumnFormatter.isSameFormat(item.format, selectedFormat)\n )\n );\n\n const isCustomSelected = FormatContextMenuUtils.isCustomSelected(\n selectedFormat\n );\n\n const customFormat = isCustomSelected\n ? selectedFormat\n : IntegerColumnFormatter.makeCustomFormat();\n\n const customFormatOption = FormatContextMenuUtils.makeCustomFormatOption(\n customFormat,\n IntegerFormatContextMenu.customGroup,\n IntegerColumnFormatter.DEFAULT_FORMAT_STRING,\n isCustomSelected,\n formatString => {\n if (formatString != null) {\n const newCustomFormat = IntegerColumnFormatter.makeCustomFormat(\n formatString\n );\n if (IntegerColumnFormatter.isValid(dh, newCustomFormat)) {\n onCustomFormatChange(newCustomFormat);\n }\n } else {\n onCustomFormatChange(null);\n }\n }\n );\n\n return [defaultFormatOption, ...presetFormatOptions, customFormatOption];\n }\n}\n\nexport default IntegerFormatContextMenu;\n"],"mappings":";;;AAAA,SAEEA,sBAAsB,QACjB,wBAAwB;AAAC,OAEzBC,sBAAsB;AAI7B,MAAMC,wBAAwB,CAAC;EAO7B;AACF;AACA;AACA;AACA;AACA;AACA;EACE,OAAOC,UAAU,CACfC,EAAU,EACVC,cAAmC,EACnCC,oBAAiE,EACtC;IAC3B,IAAMC,WAAW,GAAG,CAClB;MACEC,MAAM,EAAER,sBAAsB,CAACS,eAAe;MAC9CC,KAAK,EAAER,wBAAwB,CAACS;IAClC,CAAC,EACD;MACEH,MAAM,EAAER,sBAAsB,CAACY,0BAA0B;MACzDF,KAAK,EAAER,wBAAwB,CAACS;IAClC,CAAC,CACF;IAED,IAAME,mBAAmB,GAAGZ,sBAAsB,CAACa,UAAU,CAC3D,SAAS,EACT,IAAI,EACJZ,wBAAwB,CAACa,YAAY,EACrCd,sBAAsB,CAACe,iBAAiB,CAACX,cAAc,CAAC,CACzD;IAED,IAAMY,mBAAmB,GAAGV,WAAW,CAACW,GAAG,CAACC,IAAI,IAC9ClB,sBAAsB,CAACa,UAAU,CAC/BK,IAAI,CAACX,MAAM,CAACY,KAAK,EACjBD,IAAI,CAACX,MAAM,EACXW,IAAI,CAACT,KAAK,EACVV,sBAAsB,CAACqB,YAAY,CAACF,IAAI,CAACX,MAAM,EAAEH,cAAc,CAAC,CACjE,CACF;IAED,IAAMiB,gBAAgB,GAAGrB,sBAAsB,CAACqB,gBAAgB,CAC9DjB,cAAc,CACf;IAED,IAAMkB,YAAY,GAAGD,gBAAgB,GACjCjB,cAAc,GACdL,sBAAsB,CAACwB,gBAAgB,EAAE;IAE7C,IAAMC,kBAAkB,GAAGxB,sBAAsB,CAACyB,sBAAsB,CACtEH,YAAY,EACZrB,wBAAwB,CAACyB,WAAW,EACpC3B,sBAAsB,CAAC4B,qBAAqB,EAC5CN,gBAAgB,EAChBO,YAAY,IAAI;MACd,IAAIA,YAAY,IAAI,IAAI,EAAE;QACxB,IAAMC,eAAe,GAAG9B,sBAAsB,CAACwB,gBAAgB,CAC7DK,YAAY,CACb;QACD,IAAI7B,sBAAsB,CAAC+B,OAAO,CAAC3B,EAAE,EAAE0B,eAAe,CAAC,EAAE;UACvDxB,oBAAoB,CAACwB,eAAe,CAAC;QACvC;MACF,CAAC,MAAM;QACLxB,oBAAoB,CAAC,IAAI,CAAC;MAC5B;IACF,CAAC,CACF;IAED,OAAO,CAACO,mBAAmB,EAAE,GAAGI,mBAAmB,EAAEQ,kBAAkB,CAAC;EAC1E;AACF;AAAC,gBA3EKvB,wBAAwB,kBACN,EAAE;AAAA,gBADpBA,wBAAwB,iBAGP,EAAE;AAAA,gBAHnBA,wBAAwB,iBAKP,EAAE;AAwEzB,eAAeA,wBAAwB"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as DateTimeFormatContextMenu } from "./DateTimeFormatContextMenu.js";
|
|
2
|
+
export { default as DecimalFormatContextMenu } from "./DecimalFormatContextMenu.js";
|
|
3
|
+
export { default as IntegerFormatContextMenu } from "./IntegerFormatContextMenu.js";
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","DateTimeFormatContextMenu","DecimalFormatContextMenu","IntegerFormatContextMenu"],"sources":["../../src/format-context-menus/index.ts"],"sourcesContent":["export { default as DateTimeFormatContextMenu } from './DateTimeFormatContextMenu';\nexport { default as DecimalFormatContextMenu } from './DecimalFormatContextMenu';\nexport { default as IntegerFormatContextMenu } from './IntegerFormatContextMenu';\n"],"mappings":"SAASA,OAAO,IAAIC,yBAAyB;AAAA,SACpCD,OAAO,IAAIE,wBAAwB;AAAA,SACnCF,OAAO,IAAIG,wBAAwB"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import IrisGrid from "./IrisGrid.js";
|
|
2
|
+
export default IrisGrid;
|
|
3
|
+
export { IrisGrid };
|
|
4
|
+
export * from "./sidebar/index.js";
|
|
5
|
+
export * from "./AdvancedFilterCreator.js";
|
|
6
|
+
export * from "./CommonTypes.js";
|
|
7
|
+
export { default as ColumnHeaderGroup } from "./ColumnHeaderGroup.js";
|
|
8
|
+
export * from "./IrisGrid.js";
|
|
9
|
+
export { default as SHORTCUTS } from "./IrisGridShortcuts.js";
|
|
10
|
+
export { default as IrisGridModel } from "./IrisGridModel.js";
|
|
11
|
+
export { default as IrisGridTableModel } from "./IrisGridTableModel.js";
|
|
12
|
+
export * from "./IrisGridTableModel.js";
|
|
13
|
+
export { default as IrisGridTreeTableModel } from "./IrisGridTreeTableModel.js";
|
|
14
|
+
export { default as IrisGridTableModelTemplate } from "./IrisGridTableModelTemplate.js";
|
|
15
|
+
export * from "./IrisGridTableModelTemplate.js";
|
|
16
|
+
export * from "./IrisGridTreeTableModel.js";
|
|
17
|
+
export { default as IrisGridModelFactory } from "./IrisGridModelFactory.js";
|
|
18
|
+
export { default as IrisGridTheme } from "./IrisGridTheme.js";
|
|
19
|
+
export { default as IrisGridTestUtils } from "./IrisGridTestUtils.js";
|
|
20
|
+
export { default as IrisGridUtils } from "./IrisGridUtils.js";
|
|
21
|
+
export * from "./IrisGridUtils.js";
|
|
22
|
+
export { default as TableViewportUpdater } from "./TableViewportUpdater.js";
|
|
23
|
+
export { default as TreeTableViewportUpdater } from "./TreeTableViewportUpdater.js";
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["IrisGrid","default","ColumnHeaderGroup","SHORTCUTS","IrisGridModel","IrisGridTableModel","IrisGridTreeTableModel","IrisGridTableModelTemplate","IrisGridModelFactory","IrisGridTheme","IrisGridTestUtils","IrisGridUtils","TableViewportUpdater","TreeTableViewportUpdater"],"sources":["../src/index.ts"],"sourcesContent":["import IrisGrid from './IrisGrid';\n\nexport default IrisGrid;\nexport { IrisGrid };\nexport * from './sidebar';\nexport * from './AdvancedFilterCreator';\nexport * from './CommonTypes';\nexport { default as ColumnHeaderGroup } from './ColumnHeaderGroup';\nexport * from './IrisGrid';\nexport { default as SHORTCUTS } from './IrisGridShortcuts';\nexport { default as IrisGridModel } from './IrisGridModel';\nexport { default as IrisGridTableModel } from './IrisGridTableModel';\nexport * from './IrisGridTableModel';\nexport { default as IrisGridTreeTableModel } from './IrisGridTreeTableModel';\nexport { default as IrisGridTableModelTemplate } from './IrisGridTableModelTemplate';\nexport * from './IrisGridTableModelTemplate';\nexport * from './IrisGridTreeTableModel';\nexport { default as IrisGridModelFactory } from './IrisGridModelFactory';\nexport { default as IrisGridTheme } from './IrisGridTheme';\nexport type { IrisGridThemeType } from './IrisGridTheme';\nexport { default as IrisGridTestUtils } from './IrisGridTestUtils';\nexport { default as IrisGridUtils } from './IrisGridUtils';\nexport * from './IrisGridUtils';\nexport { default as TableViewportUpdater } from './TableViewportUpdater';\nexport { default as TreeTableViewportUpdater } from './TreeTableViewportUpdater';\n"],"mappings":"OAAOA,QAAQ;AAEf,eAAeA,QAAQ;AACvB,SAASA,QAAQ;AAAG;AAAA;AAAA;AAAA,SAIXC,OAAO,IAAIC,iBAAiB;AAAA;AAAA,SAE5BD,OAAO,IAAIE,SAAS;AAAA,SACpBF,OAAO,IAAIG,aAAa;AAAA,SACxBH,OAAO,IAAII,kBAAkB;AAAA;AAAA,SAE7BJ,OAAO,IAAIK,sBAAsB;AAAA,SACjCL,OAAO,IAAIM,0BAA0B;AAAA;AAAA;AAAA,SAGrCN,OAAO,IAAIO,oBAAoB;AAAA,SAC/BP,OAAO,IAAIQ,aAAa;AAAA,SAExBR,OAAO,IAAIS,iBAAiB;AAAA,SAC5BT,OAAO,IAAIU,aAAa;AAAA;AAAA,SAExBV,OAAO,IAAIW,oBAAoB;AAAA,SAC/BX,OAAO,IAAIY,wBAAwB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
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); }
|
|
4
|
+
import { KeyHandler } from '@deephaven/grid';
|
|
5
|
+
import IrisGridShortcuts from "../IrisGridShortcuts.js";
|
|
6
|
+
class ClearFilterKeyHandler extends KeyHandler {
|
|
7
|
+
constructor(irisGrid) {
|
|
8
|
+
super();
|
|
9
|
+
_defineProperty(this, "irisGrid", void 0);
|
|
10
|
+
this.irisGrid = irisGrid;
|
|
11
|
+
}
|
|
12
|
+
onDown(event) {
|
|
13
|
+
if (IrisGridShortcuts.TABLE.CLEAR_FILTERS.matchesEvent(event)) {
|
|
14
|
+
this.irisGrid.clearAllFilters();
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export default ClearFilterKeyHandler;
|
|
21
|
+
//# sourceMappingURL=ClearFilterKeyHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClearFilterKeyHandler.js","names":["KeyHandler","IrisGridShortcuts","ClearFilterKeyHandler","constructor","irisGrid","onDown","event","TABLE","CLEAR_FILTERS","matchesEvent","clearAllFilters"],"sources":["../../src/key-handlers/ClearFilterKeyHandler.ts"],"sourcesContent":["import { KeyboardEvent } from 'react';\nimport { KeyHandler } from '@deephaven/grid';\nimport { IrisGrid } from '../IrisGrid';\nimport IrisGridShortcuts from '../IrisGridShortcuts';\n\nclass ClearFilterKeyHandler extends KeyHandler {\n private irisGrid: IrisGrid;\n\n constructor(irisGrid: IrisGrid) {\n super();\n\n this.irisGrid = irisGrid;\n }\n\n onDown(event: KeyboardEvent): boolean {\n if (IrisGridShortcuts.TABLE.CLEAR_FILTERS.matchesEvent(event)) {\n this.irisGrid.clearAllFilters();\n return true;\n }\n return false;\n }\n}\n\nexport default ClearFilterKeyHandler;\n"],"mappings":";;;AACA,SAASA,UAAU,QAAQ,iBAAiB;AAAC,OAEtCC,iBAAiB;AAExB,MAAMC,qBAAqB,SAASF,UAAU,CAAC;EAG7CG,WAAW,CAACC,QAAkB,EAAE;IAC9B,KAAK,EAAE;IAAC;IAER,IAAI,CAACA,QAAQ,GAAGA,QAAQ;EAC1B;EAEAC,MAAM,CAACC,KAAoB,EAAW;IACpC,IAAIL,iBAAiB,CAACM,KAAK,CAACC,aAAa,CAACC,YAAY,CAACH,KAAK,CAAC,EAAE;MAC7D,IAAI,CAACF,QAAQ,CAACM,eAAe,EAAE;MAC/B,OAAO,IAAI;IACb;IACA,OAAO,KAAK;EACd;AACF;AAEA,eAAeR,qBAAqB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
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); }
|
|
4
|
+
/* eslint class-methods-use-this: "off" */
|
|
5
|
+
|
|
6
|
+
import { ContextActionUtils } from '@deephaven/components';
|
|
7
|
+
import { KeyHandler } from '@deephaven/grid';
|
|
8
|
+
import IrisGridUtils from "../IrisGridUtils.js";
|
|
9
|
+
class CopyKeyHandler extends KeyHandler {
|
|
10
|
+
constructor(irisGrid) {
|
|
11
|
+
super();
|
|
12
|
+
_defineProperty(this, "irisGrid", void 0);
|
|
13
|
+
this.irisGrid = irisGrid;
|
|
14
|
+
}
|
|
15
|
+
onDown(event) {
|
|
16
|
+
var {
|
|
17
|
+
selectedRanges
|
|
18
|
+
} = this.irisGrid.state;
|
|
19
|
+
if (event.key === 'c' && ContextActionUtils.isModifierKeyDown(event)) {
|
|
20
|
+
if (IrisGridUtils.isValidSnapshotRanges(selectedRanges)) {
|
|
21
|
+
this.irisGrid.copyRanges(selectedRanges);
|
|
22
|
+
} else {
|
|
23
|
+
this.irisGrid.copyRanges(selectedRanges, false, false, 'Invalid copy ranges');
|
|
24
|
+
}
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export default CopyKeyHandler;
|
|
31
|
+
//# sourceMappingURL=CopyKeyHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopyKeyHandler.js","names":["ContextActionUtils","KeyHandler","IrisGridUtils","CopyKeyHandler","constructor","irisGrid","onDown","event","selectedRanges","state","key","isModifierKeyDown","isValidSnapshotRanges","copyRanges"],"sources":["../../src/key-handlers/CopyKeyHandler.ts"],"sourcesContent":["/* eslint class-methods-use-this: \"off\" */\nimport { KeyboardEvent } from 'react';\nimport { ContextActionUtils } from '@deephaven/components';\nimport { KeyHandler } from '@deephaven/grid';\nimport { IrisGrid } from '../IrisGrid';\nimport IrisGridUtils from '../IrisGridUtils';\n\nclass CopyKeyHandler extends KeyHandler {\n private irisGrid: IrisGrid;\n\n constructor(irisGrid: IrisGrid) {\n super();\n\n this.irisGrid = irisGrid;\n }\n\n onDown(event: KeyboardEvent): boolean {\n const { selectedRanges } = this.irisGrid.state;\n if (event.key === 'c' && ContextActionUtils.isModifierKeyDown(event)) {\n if (IrisGridUtils.isValidSnapshotRanges(selectedRanges)) {\n this.irisGrid.copyRanges(selectedRanges);\n } else {\n this.irisGrid.copyRanges(\n selectedRanges,\n false,\n false,\n 'Invalid copy ranges'\n );\n }\n return true;\n }\n return false;\n }\n}\n\nexport default CopyKeyHandler;\n"],"mappings":";;;AAAA;;AAEA,SAASA,kBAAkB,QAAQ,uBAAuB;AAC1D,SAASC,UAAU,QAAQ,iBAAiB;AAAC,OAEtCC,aAAa;AAEpB,MAAMC,cAAc,SAASF,UAAU,CAAC;EAGtCG,WAAW,CAACC,QAAkB,EAAE;IAC9B,KAAK,EAAE;IAAC;IAER,IAAI,CAACA,QAAQ,GAAGA,QAAQ;EAC1B;EAEAC,MAAM,CAACC,KAAoB,EAAW;IACpC,IAAM;MAAEC;IAAe,CAAC,GAAG,IAAI,CAACH,QAAQ,CAACI,KAAK;IAC9C,IAAIF,KAAK,CAACG,GAAG,KAAK,GAAG,IAAIV,kBAAkB,CAACW,iBAAiB,CAACJ,KAAK,CAAC,EAAE;MACpE,IAAIL,aAAa,CAACU,qBAAqB,CAACJ,cAAc,CAAC,EAAE;QACvD,IAAI,CAACH,QAAQ,CAACQ,UAAU,CAACL,cAAc,CAAC;MAC1C,CAAC,MAAM;QACL,IAAI,CAACH,QAAQ,CAACQ,UAAU,CACtBL,cAAc,EACd,KAAK,EACL,KAAK,EACL,qBAAqB,CACtB;MACH;MACA,OAAO,IAAI;IACb;IACA,OAAO,KAAK;EACd;AACF;AAEA,eAAeL,cAAc"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
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); }
|
|
4
|
+
import { KeyHandler } from '@deephaven/grid';
|
|
5
|
+
import { TableUtils } from '@deephaven/jsapi-utils';
|
|
6
|
+
import IrisGridShortcuts from "../IrisGridShortcuts.js";
|
|
7
|
+
class ReverseKeyHandler extends KeyHandler {
|
|
8
|
+
constructor(irisGrid) {
|
|
9
|
+
super();
|
|
10
|
+
_defineProperty(this, "irisGrid", void 0);
|
|
11
|
+
this.irisGrid = irisGrid;
|
|
12
|
+
}
|
|
13
|
+
onDown(event) {
|
|
14
|
+
if (IrisGridShortcuts.TABLE.REVERSE.matchesEvent(event)) {
|
|
15
|
+
if (!this.irisGrid.isReversible()) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
var {
|
|
19
|
+
reverseType
|
|
20
|
+
} = this.irisGrid.state;
|
|
21
|
+
if (reverseType === TableUtils.REVERSE_TYPE.NONE) {
|
|
22
|
+
this.irisGrid.reverse(TableUtils.REVERSE_TYPE.POST_SORT);
|
|
23
|
+
} else {
|
|
24
|
+
this.irisGrid.reverse(TableUtils.REVERSE_TYPE.NONE);
|
|
25
|
+
}
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export default ReverseKeyHandler;
|
|
32
|
+
//# sourceMappingURL=ReverseKeyHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReverseKeyHandler.js","names":["KeyHandler","TableUtils","IrisGridShortcuts","ReverseKeyHandler","constructor","irisGrid","onDown","event","TABLE","REVERSE","matchesEvent","isReversible","reverseType","state","REVERSE_TYPE","NONE","reverse","POST_SORT"],"sources":["../../src/key-handlers/ReverseKeyHandler.ts"],"sourcesContent":["import { KeyboardEvent } from 'react';\nimport { KeyHandler } from '@deephaven/grid';\nimport { TableUtils } from '@deephaven/jsapi-utils';\nimport { IrisGrid } from '../IrisGrid';\nimport IrisGridShortcuts from '../IrisGridShortcuts';\n\nclass ReverseKeyHandler extends KeyHandler {\n private irisGrid: IrisGrid;\n\n constructor(irisGrid: IrisGrid) {\n super();\n\n this.irisGrid = irisGrid;\n }\n\n onDown(event: KeyboardEvent): boolean {\n if (IrisGridShortcuts.TABLE.REVERSE.matchesEvent(event)) {\n if (!this.irisGrid.isReversible()) {\n return false;\n }\n const { reverseType } = this.irisGrid.state;\n if (reverseType === TableUtils.REVERSE_TYPE.NONE) {\n this.irisGrid.reverse(TableUtils.REVERSE_TYPE.POST_SORT);\n } else {\n this.irisGrid.reverse(TableUtils.REVERSE_TYPE.NONE);\n }\n return true;\n }\n return false;\n }\n}\n\nexport default ReverseKeyHandler;\n"],"mappings":";;;AACA,SAASA,UAAU,QAAQ,iBAAiB;AAC5C,SAASC,UAAU,QAAQ,wBAAwB;AAAC,OAE7CC,iBAAiB;AAExB,MAAMC,iBAAiB,SAASH,UAAU,CAAC;EAGzCI,WAAW,CAACC,QAAkB,EAAE;IAC9B,KAAK,EAAE;IAAC;IAER,IAAI,CAACA,QAAQ,GAAGA,QAAQ;EAC1B;EAEAC,MAAM,CAACC,KAAoB,EAAW;IACpC,IAAIL,iBAAiB,CAACM,KAAK,CAACC,OAAO,CAACC,YAAY,CAACH,KAAK,CAAC,EAAE;MACvD,IAAI,CAAC,IAAI,CAACF,QAAQ,CAACM,YAAY,EAAE,EAAE;QACjC,OAAO,KAAK;MACd;MACA,IAAM;QAAEC;MAAY,CAAC,GAAG,IAAI,CAACP,QAAQ,CAACQ,KAAK;MAC3C,IAAID,WAAW,KAAKX,UAAU,CAACa,YAAY,CAACC,IAAI,EAAE;QAChD,IAAI,CAACV,QAAQ,CAACW,OAAO,CAACf,UAAU,CAACa,YAAY,CAACG,SAAS,CAAC;MAC1D,CAAC,MAAM;QACL,IAAI,CAACZ,QAAQ,CAACW,OAAO,CAACf,UAAU,CAACa,YAAY,CAACC,IAAI,CAAC;MACrD;MACA,OAAO,IAAI;IACb;IACA,OAAO,KAAK;EACd;AACF;AAEA,eAAeZ,iBAAiB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","CopyKeyHandler","ReverseKeyHandler","ClearFilterKeyHandler"],"sources":["../../src/key-handlers/index.ts"],"sourcesContent":["export { default as CopyKeyHandler } from './CopyKeyHandler';\nexport { default as ReverseKeyHandler } from './ReverseKeyHandler';\nexport { default as ClearFilterKeyHandler } from './ClearFilterKeyHandler';\n"],"mappings":"SAASA,OAAO,IAAIC,cAAc;AAAA,SACzBD,OAAO,IAAIE,iBAAiB;AAAA,SAC5BF,OAAO,IAAIG,qBAAqB"}
|