@deephaven/console 0.5.2-matplotlib.2 → 0.6.1-demo.8

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.
Files changed (114) hide show
  1. package/dist/Console.d.ts +3 -0
  2. package/dist/Console.d.ts.map +1 -1
  3. package/dist/Console.js +807 -871
  4. package/dist/Console.js.map +1 -1
  5. package/dist/ConsoleInput.d.ts +1 -38
  6. package/dist/ConsoleInput.d.ts.map +1 -1
  7. package/dist/ConsoleInput.js +331 -436
  8. package/dist/ConsoleInput.js.map +1 -1
  9. package/dist/ConsoleMenu.js +159 -215
  10. package/dist/ConsoleMenu.js.map +1 -1
  11. package/dist/ConsolePropTypes.js +1 -1
  12. package/dist/ConsolePropTypes.js.map +1 -1
  13. package/dist/ConsoleShortcuts.js +2 -2
  14. package/dist/ConsoleShortcuts.js.map +1 -1
  15. package/dist/ConsoleStatusBar.js +85 -125
  16. package/dist/ConsoleStatusBar.js.map +1 -1
  17. package/dist/StoragePropTypes.js +2 -2
  18. package/dist/StoragePropTypes.js.map +1 -1
  19. package/dist/command-history/CommandHistory.css +5 -2
  20. package/dist/command-history/CommandHistory.css.map +1 -1
  21. package/dist/command-history/CommandHistory.d.ts +5 -0
  22. package/dist/command-history/CommandHistory.d.ts.map +1 -1
  23. package/dist/command-history/CommandHistory.js +303 -391
  24. package/dist/command-history/CommandHistory.js.map +1 -1
  25. package/dist/command-history/CommandHistoryActions.css +4 -0
  26. package/dist/command-history/CommandHistoryActions.css.map +1 -1
  27. package/dist/command-history/CommandHistoryActions.d.ts.map +1 -1
  28. package/dist/command-history/CommandHistoryActions.js +40 -79
  29. package/dist/command-history/CommandHistoryActions.js.map +1 -1
  30. package/dist/command-history/CommandHistoryItem.css +1 -1
  31. package/dist/command-history/CommandHistoryItem.d.ts +5 -0
  32. package/dist/command-history/CommandHistoryItem.d.ts.map +1 -1
  33. package/dist/command-history/CommandHistoryItem.js +15 -9
  34. package/dist/command-history/CommandHistoryItem.js.map +1 -1
  35. package/dist/command-history/CommandHistoryItemTooltip.d.ts +1 -40
  36. package/dist/command-history/CommandHistoryItemTooltip.d.ts.map +1 -1
  37. package/dist/command-history/CommandHistoryItemTooltip.js +139 -189
  38. package/dist/command-history/CommandHistoryItemTooltip.js.map +1 -1
  39. package/dist/command-history/CommandHistoryViewportUpdater.js +30 -35
  40. package/dist/command-history/CommandHistoryViewportUpdater.js.map +1 -1
  41. package/dist/command-history/index.js +5 -5
  42. package/dist/command-history/index.js.map +1 -1
  43. package/dist/common/Code.js +34 -70
  44. package/dist/common/Code.js.map +1 -1
  45. package/dist/common/ConsoleConstants.js +3 -24
  46. package/dist/common/ConsoleConstants.js.map +1 -1
  47. package/dist/common/ConsoleUtils.d.ts +1 -3
  48. package/dist/common/ConsoleUtils.d.ts.map +1 -1
  49. package/dist/common/ConsoleUtils.js +60 -94
  50. package/dist/common/ConsoleUtils.js.map +1 -1
  51. package/dist/common/ObjectIcon.js +4 -2
  52. package/dist/common/ObjectIcon.js.map +1 -1
  53. package/dist/common/index.d.js +1 -34
  54. package/dist/common/index.d.js.map +1 -1
  55. package/dist/common/index.js +4 -4
  56. package/dist/common/index.js.map +1 -1
  57. package/dist/console-history/ConsoleHistory.js +27 -63
  58. package/dist/console-history/ConsoleHistory.js.map +1 -1
  59. package/dist/console-history/ConsoleHistoryItem.js +116 -154
  60. package/dist/console-history/ConsoleHistoryItem.js.map +1 -1
  61. package/dist/console-history/ConsoleHistoryItemResult.js +4 -2
  62. package/dist/console-history/ConsoleHistoryItemResult.js.map +1 -1
  63. package/dist/console-history/ConsoleHistoryResultErrorMessage.js +94 -132
  64. package/dist/console-history/ConsoleHistoryResultErrorMessage.js.map +1 -1
  65. package/dist/console-history/ConsoleHistoryResultInProgress.js +42 -76
  66. package/dist/console-history/ConsoleHistoryResultInProgress.js.map +1 -1
  67. package/dist/console-history/index.js +5 -5
  68. package/dist/console-history/index.js.map +1 -1
  69. package/dist/csv/CsvFormats.js +14 -28
  70. package/dist/csv/CsvFormats.js.map +1 -1
  71. package/dist/csv/CsvInputBar.css +25 -23
  72. package/dist/csv/CsvInputBar.css.map +1 -1
  73. package/dist/csv/CsvInputBar.d.ts +2 -45
  74. package/dist/csv/CsvInputBar.d.ts.map +1 -1
  75. package/dist/csv/CsvInputBar.js +298 -372
  76. package/dist/csv/CsvInputBar.js.map +1 -1
  77. package/dist/csv/CsvOverlay.js +197 -243
  78. package/dist/csv/CsvOverlay.js.map +1 -1
  79. package/dist/csv/CsvParser.js +186 -209
  80. package/dist/csv/CsvParser.js.map +1 -1
  81. package/dist/csv/CsvTypeParser.js +185 -210
  82. package/dist/csv/CsvTypeParser.js.map +1 -1
  83. package/dist/csv/NewTableColumnTypes.js +1 -5
  84. package/dist/csv/NewTableColumnTypes.js.map +1 -1
  85. package/dist/index.js +14 -14
  86. package/dist/index.js.map +1 -1
  87. package/dist/log/LogLevelMenuItem.js +24 -58
  88. package/dist/log/LogLevelMenuItem.js.map +1 -1
  89. package/dist/log/LogView.js +429 -484
  90. package/dist/log/LogView.js.map +1 -1
  91. package/dist/monaco/MonacoCompletionProvider.js +92 -124
  92. package/dist/monaco/MonacoCompletionProvider.js.map +1 -1
  93. package/dist/monaco/MonacoUtils.js +315 -331
  94. package/dist/monaco/MonacoUtils.js.map +1 -1
  95. package/dist/monaco/index.js +2 -2
  96. package/dist/monaco/index.js.map +1 -1
  97. package/dist/monaco/lang/db.js +3 -3
  98. package/dist/monaco/lang/db.js.map +1 -1
  99. package/dist/monaco/lang/groovy.js +3 -3
  100. package/dist/monaco/lang/groovy.js.map +1 -1
  101. package/dist/monaco/lang/log.js +3 -3
  102. package/dist/monaco/lang/log.js.map +1 -1
  103. package/dist/monaco/lang/python.js +3 -3
  104. package/dist/monaco/lang/python.js.map +1 -1
  105. package/dist/monaco/lang/scala.js +5 -5
  106. package/dist/monaco/lang/scala.js.map +1 -1
  107. package/dist/notebook/Editor.js +101 -141
  108. package/dist/notebook/Editor.js.map +1 -1
  109. package/dist/notebook/ScriptEditor.js +261 -301
  110. package/dist/notebook/ScriptEditor.js.map +1 -1
  111. package/dist/notebook/ScriptEditorUtils.js +26 -42
  112. package/dist/notebook/ScriptEditorUtils.js.map +1 -1
  113. package/dist/tsconfig.tsbuildinfo +1 -1
  114. package/package.json +26 -56
@@ -1,54 +1,18 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2
-
3
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
4
-
5
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6
-
7
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
-
9
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
10
-
11
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
12
-
13
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
14
-
15
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); } }
16
2
 
17
3
  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); }); }; }
18
4
 
19
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
20
-
21
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
22
-
23
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
24
-
25
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
26
-
27
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
28
-
29
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
30
-
31
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
32
-
33
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
34
-
35
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
36
-
37
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
38
-
39
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
40
6
 
41
7
  import React, { PureComponent } from 'react';
42
8
  import PropTypes from 'prop-types';
43
9
  import classNames from 'classnames';
44
- import { connect } from 'react-redux';
45
10
  import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
46
11
  import Log from '@deephaven/log';
47
12
  import { PromiseUtils } from '@deephaven/utils';
48
- import { getCommandHistoryStorage } from '@deephaven/redux';
49
- import { MonacoCompletionProvider, MonacoTheme, MonacoUtils } from './monaco';
13
+ import { MonacoCompletionProvider, MonacoTheme, MonacoUtils } from "./monaco/index.js";
50
14
  import "./ConsoleInput.css";
51
- import StoragePropTypes from './StoragePropTypes';
15
+ import StoragePropTypes from "./StoragePropTypes.js";
52
16
  var log = Log.module('ConsoleInput');
53
17
  var LINE_HEIGHT = parseInt(MonacoTheme['line-height'], 10);
54
18
  var TOP_PADDING = 6;
@@ -59,437 +23,377 @@ var BUFFER_SIZE = 100;
59
23
  * Component for input in a console session. Handles loading the recent command history
60
24
  */
61
25
 
62
- export var ConsoleInput = /*#__PURE__*/function (_PureComponent) {
63
- _inherits(ConsoleInput, _PureComponent);
64
-
65
- var _super = _createSuper(ConsoleInput);
66
-
67
- function ConsoleInput(props) {
68
- var _this;
69
-
70
- _classCallCheck(this, ConsoleInput);
71
-
72
- _this = _super.call(this, props);
73
- _this.handleWindowResize = _this.handleWindowResize.bind(_assertThisInitialized(_this));
74
- _this.cancelListener = null;
75
- _this.commandContainer = /*#__PURE__*/React.createRef();
76
- _this.commandEditor = null;
77
- _this.commandHistoryIndex = null;
78
- _this.commandSuggestionContainer = null;
79
- _this.isCommandModified = false;
80
- _this.loadingPromise = null;
81
- _this.timestamp = Date.now();
82
- _this.bufferIndex = 0;
83
- _this.history = [];
84
- _this.state = {
26
+ export class ConsoleInput extends PureComponent {
27
+ constructor(props) {
28
+ super(props);
29
+ this.handleWindowResize = this.handleWindowResize.bind(this);
30
+ this.cancelListener = null;
31
+ this.commandContainer = /*#__PURE__*/React.createRef();
32
+ this.commandEditor = null;
33
+ this.commandHistoryIndex = null;
34
+ this.commandSuggestionContainer = null;
35
+ this.isCommandModified = false;
36
+ this.loadingPromise = null;
37
+ this.timestamp = Date.now();
38
+ this.bufferIndex = 0;
39
+ this.history = [];
40
+ this.state = {
85
41
  commandEditorHeight: LINE_HEIGHT,
86
42
  isFocused: false,
87
43
  model: null
88
44
  };
89
- return _this;
90
45
  }
91
46
 
92
- _createClass(ConsoleInput, [{
93
- key: "componentDidMount",
94
- value: function componentDidMount() {
95
- this.initCommandEditor();
96
- window.addEventListener('resize', this.handleWindowResize);
97
- this.loadMoreHistory();
98
- }
99
- }, {
100
- key: "componentDidUpdate",
101
- value: function componentDidUpdate() {
102
- this.layoutEditor();
47
+ componentDidMount() {
48
+ this.initCommandEditor();
49
+ window.addEventListener('resize', this.handleWindowResize);
50
+ this.loadMoreHistory();
51
+ }
52
+
53
+ componentDidUpdate() {
54
+ this.layoutEditor();
55
+ }
56
+
57
+ componentWillUnmount() {
58
+ window.removeEventListener('resize', this.handleWindowResize);
59
+
60
+ if (this.loadingPromise != null) {
61
+ this.loadingPromise.cancel();
103
62
  }
104
- }, {
105
- key: "componentWillUnmount",
106
- value: function componentWillUnmount() {
107
- window.removeEventListener('resize', this.handleWindowResize);
108
63
 
109
- if (this.loadingPromise != null) {
110
- this.loadingPromise.cancel();
111
- }
64
+ this.destroyCommandEditor();
65
+ }
112
66
 
113
- this.destroyCommandEditor();
67
+ setConsoleText(text) {
68
+ var focus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
69
+ var execute = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
70
+
71
+ if (!text) {
72
+ return;
114
73
  }
115
- }, {
116
- key: "setConsoleText",
117
- value: function setConsoleText(text) {
118
- var focus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
119
- var execute = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
120
-
121
- if (!text) {
122
- return;
123
- }
124
74
 
125
- log.debug('Command received: ', text);
126
- this.commandEditor.setValue(text);
75
+ log.debug('Command received: ', text);
76
+ this.commandEditor.setValue(text);
127
77
 
128
- if (focus) {
129
- this.focusEnd();
130
- }
78
+ if (focus) {
79
+ this.focusEnd();
80
+ }
131
81
 
132
- this.updateDimensions();
82
+ this.updateDimensions();
133
83
 
134
- if (execute) {
135
- this.processCommand();
136
- }
84
+ if (execute) {
85
+ this.processCommand();
137
86
  }
138
- }, {
139
- key: "initCommandEditor",
140
- value: function initCommandEditor() {
141
- var _this2 = this;
142
-
143
- var _this$props = this.props,
144
- language = _this$props.language,
145
- session = _this$props.session;
146
- var commandSettings = {
147
- copyWithSyntaxHighlighting: 'false',
148
- cursorStyle: 'block',
149
- fixedOverflowWidgets: true,
150
- folding: false,
151
- fontFamily: 'Fira Mono',
152
- glyphMargin: false,
153
- language: language,
154
- lineHeight: LINE_HEIGHT,
155
- lineDecorationsWidth: 3,
156
- lineNumbers: 'off',
157
- minimap: {
158
- enabled: false
159
- },
160
- renderLineHighlight: 'none',
161
- scrollBeyondLastLine: false,
162
- scrollbar: {
163
- arrowSize: 0,
164
- horizontal: 'hidden',
165
- horizontalScrollbarSize: 0
166
- },
167
- padding: {
168
- top: TOP_PADDING,
169
- bottom: BOTTOM_PADDING
170
- },
171
- tabCompletion: 'on',
172
- value: '',
173
- wordWrap: 'on'
174
- };
175
- this.commandEditor = monaco.editor.create(this.commandContainer.current, commandSettings);
176
- MonacoUtils.setEOL(this.commandEditor);
177
- MonacoUtils.openDocument(this.commandEditor, session);
178
- this.commandEditor.onDidChangeModelContent(function () {
179
- _this2.isCommandModified = true;
180
-
181
- _this2.updateDimensions();
182
- });
183
- this.commandEditor.onDidFocusEditorText(function () {
184
- _this2.setState({
185
- isFocused: true
186
- });
87
+ }
88
+
89
+ initCommandEditor() {
90
+ var {
91
+ language,
92
+ session
93
+ } = this.props;
94
+ var commandSettings = {
95
+ copyWithSyntaxHighlighting: 'false',
96
+ cursorStyle: 'block',
97
+ fixedOverflowWidgets: true,
98
+ folding: false,
99
+ fontFamily: 'Fira Mono',
100
+ glyphMargin: false,
101
+ language,
102
+ lineHeight: LINE_HEIGHT,
103
+ lineDecorationsWidth: 3,
104
+ lineNumbers: 'off',
105
+ minimap: {
106
+ enabled: false
107
+ },
108
+ renderLineHighlight: 'none',
109
+ scrollBeyondLastLine: false,
110
+ scrollbar: {
111
+ arrowSize: 0,
112
+ horizontal: 'hidden',
113
+ horizontalScrollbarSize: 0
114
+ },
115
+ padding: {
116
+ top: TOP_PADDING,
117
+ bottom: BOTTOM_PADDING
118
+ },
119
+ tabCompletion: 'on',
120
+ value: '',
121
+ wordWrap: 'on'
122
+ };
123
+ this.commandEditor = monaco.editor.create(this.commandContainer.current, commandSettings);
124
+ MonacoUtils.setEOL(this.commandEditor);
125
+ MonacoUtils.openDocument(this.commandEditor, session);
126
+ this.commandEditor.onDidChangeModelContent(() => {
127
+ this.isCommandModified = true;
128
+ this.updateDimensions();
129
+ });
130
+ this.commandEditor.onDidFocusEditorText(() => {
131
+ this.setState({
132
+ isFocused: true
187
133
  });
188
- this.commandEditor.onDidBlurEditorText(function () {
189
- _this2.setState({
190
- isFocused: false
191
- });
134
+ });
135
+ this.commandEditor.onDidBlurEditorText(() => {
136
+ this.setState({
137
+ isFocused: false
192
138
  });
193
- /**
194
- * Register for keydown events to capture the `Enter` key.
195
- * Need to do it this way instead of using `addCommand`, because that would eat the Enter key in all situations, which is not what we want.
196
- * Can't do it in `onDidChangeModelContent` either, since we want to stop the Enter action from modifying the command.
197
- */
198
-
199
- this.commandEditor.onKeyDown(function (keyEvent) {
200
- if (!_this2.isCommandModified || _this2.commandEditor.getModel().getValueLength() === 0) {
201
- if (keyEvent.keyCode === monaco.KeyCode.UpArrow) {
202
- var commandHistoryIndex = _this2.commandHistoryIndex;
203
-
204
- if (commandHistoryIndex != null) {
205
- _this2.loadCommand(commandHistoryIndex + 1);
206
- } else {
207
- _this2.loadCommand(0);
208
- }
209
-
210
- keyEvent.stopPropagation();
211
- keyEvent.preventDefault();
212
- return;
139
+ });
140
+ /**
141
+ * Register for keydown events to capture the `Enter` key.
142
+ * Need to do it this way instead of using `addCommand`, because that would eat the Enter key in all situations, which is not what we want.
143
+ * Can't do it in `onDidChangeModelContent` either, since we want to stop the Enter action from modifying the command.
144
+ */
145
+
146
+ this.commandEditor.onKeyDown(keyEvent => {
147
+ if (!this.isCommandModified || this.commandEditor.getModel().getValueLength() === 0) {
148
+ if (keyEvent.keyCode === monaco.KeyCode.UpArrow) {
149
+ var {
150
+ commandHistoryIndex
151
+ } = this;
152
+
153
+ if (commandHistoryIndex != null) {
154
+ this.loadCommand(commandHistoryIndex + 1);
155
+ } else {
156
+ this.loadCommand(0);
213
157
  }
214
158
 
215
- if (keyEvent.keyCode === monaco.KeyCode.DownArrow) {
216
- var _commandHistoryIndex = _this2.commandHistoryIndex;
159
+ keyEvent.stopPropagation();
160
+ keyEvent.preventDefault();
161
+ return;
162
+ }
163
+
164
+ if (keyEvent.keyCode === monaco.KeyCode.DownArrow) {
165
+ var {
166
+ commandHistoryIndex: _commandHistoryIndex
167
+ } = this;
168
+
169
+ if (_commandHistoryIndex != null && _commandHistoryIndex >= 0) {
170
+ this.loadCommand(_commandHistoryIndex - 1);
171
+ } else {
172
+ this.commandHistoryIndex = null;
173
+ }
217
174
 
218
- if (_commandHistoryIndex != null && _commandHistoryIndex >= 0) {
219
- _this2.loadCommand(_commandHistoryIndex - 1);
220
- } else {
221
- _this2.commandHistoryIndex = null;
222
- }
175
+ keyEvent.stopPropagation();
176
+ keyEvent.preventDefault();
177
+ return;
178
+ }
179
+ }
223
180
 
181
+ if (!keyEvent.altKey && !keyEvent.shiftKey && !keyEvent.metaKey) {
182
+ if (keyEvent.keyCode === monaco.KeyCode.Enter) {
183
+ if (!this.isSuggestionMenuPopulated()) {
224
184
  keyEvent.stopPropagation();
225
185
  keyEvent.preventDefault();
226
- return;
186
+ this.processCommand();
227
187
  }
228
- }
229
-
230
- if (!keyEvent.altKey && !keyEvent.shiftKey && !keyEvent.metaKey) {
231
- if (keyEvent.keyCode === monaco.KeyCode.Enter) {
232
- if (!_this2.isSuggestionMenuPopulated()) {
233
- keyEvent.stopPropagation();
234
- keyEvent.preventDefault();
235
-
236
- _this2.processCommand();
237
- }
238
- } else if (keyEvent.keyCode === monaco.KeyCode.Tab) {
239
- if (!_this2.isSuggestionMenuActive()) {
240
- keyEvent.stopPropagation();
241
- keyEvent.preventDefault();
242
-
243
- _this2.commandEditor.trigger('Tab key trigger suggestions', 'editor.action.triggerSuggest', {});
244
- } else if (!_this2.isSuggestionMenuPopulated()) {
245
- keyEvent.stopPropagation();
246
- keyEvent.preventDefault();
247
- }
188
+ } else if (keyEvent.keyCode === monaco.KeyCode.Tab) {
189
+ if (!this.isSuggestionMenuActive()) {
190
+ keyEvent.stopPropagation();
191
+ keyEvent.preventDefault();
192
+ this.commandEditor.trigger('Tab key trigger suggestions', 'editor.action.triggerSuggest', {});
193
+ } else if (!this.isSuggestionMenuPopulated()) {
194
+ keyEvent.stopPropagation();
195
+ keyEvent.preventDefault();
248
196
  }
249
197
  }
250
- }); // Override the Ctrl+F functionality so that the find window doesn't appear
251
-
252
- this.commandEditor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KEY_F, // eslint-disable-line no-bitwise
253
- function () {});
254
- MonacoUtils.removeConflictingKeybindings(this.commandEditor);
255
- MonacoUtils.registerPasteHandler(this.commandEditor);
256
- this.commandEditor.focus();
257
- this.updateDimensions();
258
- this.setState({
259
- model: this.commandEditor.getModel()
260
- });
261
- }
262
- }, {
263
- key: "destroyCommandEditor",
264
- value: function destroyCommandEditor() {
265
- var session = this.props.session;
266
-
267
- if (this.commandEditor) {
268
- MonacoUtils.closeDocument(this.commandEditor, session);
269
- this.commandEditor.dispose();
270
- this.commandEditor = null;
271
- }
272
- }
273
- }, {
274
- key: "handleWindowResize",
275
- value: function handleWindowResize() {
276
- this.updateDimensions();
277
- }
278
- }, {
279
- key: "isSuggestionMenuActive",
280
- value: function isSuggestionMenuActive() {
281
- if (!this.commandSuggestionContainer) {
282
- this.commandSuggestionContainer = this.commandEditor.getDomNode().querySelector('.suggest-widget');
283
198
  }
199
+ }); // Override the Ctrl+F functionality so that the find window doesn't appear
200
+
201
+ this.commandEditor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KEY_F, // eslint-disable-line no-bitwise
202
+ () => {});
203
+ MonacoUtils.removeConflictingKeybindings(this.commandEditor);
204
+ MonacoUtils.registerPasteHandler(this.commandEditor);
205
+ this.commandEditor.focus();
206
+ this.updateDimensions();
207
+ this.setState({
208
+ model: this.commandEditor.getModel()
209
+ });
210
+ }
284
211
 
285
- return this.commandSuggestionContainer && this.commandSuggestionContainer.classList.contains('visible');
286
- }
287
- }, {
288
- key: "isSuggestionMenuPopulated",
289
- value: function isSuggestionMenuPopulated() {
290
- return this.isSuggestionMenuActive() && this.commandSuggestionContainer.querySelector('.monaco-list-rows').childElementCount > 0;
212
+ destroyCommandEditor() {
213
+ var {
214
+ session
215
+ } = this.props;
216
+
217
+ if (this.commandEditor) {
218
+ MonacoUtils.closeDocument(this.commandEditor, session);
219
+ this.commandEditor.dispose();
220
+ this.commandEditor = null;
291
221
  }
292
- }, {
293
- key: "focus",
294
- value: function focus() {
295
- this.commandEditor.focus();
222
+ }
223
+
224
+ handleWindowResize() {
225
+ this.updateDimensions();
226
+ }
227
+
228
+ isSuggestionMenuActive() {
229
+ if (!this.commandSuggestionContainer) {
230
+ this.commandSuggestionContainer = this.commandEditor.getDomNode().querySelector('.suggest-widget');
296
231
  }
297
- }, {
298
- key: "focusEnd",
299
- value: function focusEnd() {
300
- var model = this.commandEditor.getModel();
301
- var lastLine = model.getLineCount();
302
- var column = model.getLineLength(lastLine) + 1;
303
- var lastCharTop = this.commandEditor.getTopForPosition(lastLine, column);
304
- this.commandEditor.setPosition({
305
- lineNumber: lastLine,
306
- column: column
307
- });
308
- this.commandEditor.setScrollTop(lastCharTop);
309
- this.commandEditor.focus();
232
+
233
+ return this.commandSuggestionContainer && this.commandSuggestionContainer.classList.contains('visible');
234
+ }
235
+
236
+ isSuggestionMenuPopulated() {
237
+ return this.isSuggestionMenuActive() && this.commandSuggestionContainer.querySelector('.monaco-list-rows').childElementCount > 0;
238
+ }
239
+
240
+ focus() {
241
+ this.commandEditor.focus();
242
+ }
243
+
244
+ focusEnd() {
245
+ var model = this.commandEditor.getModel();
246
+ var lastLine = model.getLineCount();
247
+ var column = model.getLineLength(lastLine) + 1;
248
+ var lastCharTop = this.commandEditor.getTopForPosition(lastLine, column);
249
+ this.commandEditor.setPosition({
250
+ lineNumber: lastLine,
251
+ column
252
+ });
253
+ this.commandEditor.setScrollTop(lastCharTop);
254
+ this.commandEditor.focus();
255
+ }
256
+
257
+ clear() {
258
+ this.commandEditor.focus();
259
+ this.commandEditor.getModel().setValue('');
260
+ this.commandHistoryIndex = null;
261
+ }
262
+
263
+ layoutEditor() {
264
+ if (this.commandEditor) {
265
+ this.commandEditor.layout();
310
266
  }
311
- }, {
312
- key: "clear",
313
- value: function clear() {
314
- this.commandEditor.focus();
315
- this.commandEditor.getModel().setValue('');
267
+ }
268
+
269
+ loadCommand(index) {
270
+ if (index < 0) {
316
271
  this.commandHistoryIndex = null;
317
- }
318
- }, {
319
- key: "layoutEditor",
320
- value: function layoutEditor() {
321
- if (this.commandEditor) {
322
- this.commandEditor.layout();
272
+ this.commandEditor.getModel().setValue('');
273
+ } else if (index < this.history.length) {
274
+ this.commandHistoryIndex = index;
275
+ this.commandEditor.getModel().setValue(this.history[this.history.length - index - 1]);
276
+
277
+ if (index > this.history.length - BUFFER_SIZE) {
278
+ this.loadMoreHistory();
323
279
  }
324
280
  }
325
- }, {
326
- key: "loadCommand",
327
- value: function loadCommand(index) {
328
- if (index < 0) {
329
- this.commandHistoryIndex = null;
330
- this.commandEditor.getModel().setValue('');
331
- } else if (index < this.history.length) {
332
- this.commandHistoryIndex = index;
333
- this.commandEditor.getModel().setValue(this.history[this.history.length - index - 1]);
334
-
335
- if (index > this.history.length - BUFFER_SIZE) {
336
- this.loadMoreHistory();
281
+
282
+ this.isCommandModified = false;
283
+ this.focusEnd();
284
+ }
285
+
286
+ loadMoreHistory() {
287
+ var _this = this;
288
+
289
+ return _asyncToGenerator(function* () {
290
+ try {
291
+ if (_this.loadingPromise != null || _this.bufferIndex == null) {
292
+ return;
337
293
  }
338
- }
339
294
 
340
- this.isCommandModified = false;
341
- this.focusEnd();
342
- }
343
- }, {
344
- key: "loadMoreHistory",
345
- value: function () {
346
- var _loadMoreHistory = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
347
- var _this$props2, commandHistoryStorage, language, scope, table, viewportData;
348
-
349
- return regeneratorRuntime.wrap(function _callee$(_context) {
350
- while (1) {
351
- switch (_context.prev = _context.next) {
352
- case 0:
353
- _context.prev = 0;
354
-
355
- if (!(this.loadingPromise != null || this.bufferIndex == null)) {
356
- _context.next = 3;
357
- break;
358
- }
359
-
360
- return _context.abrupt("return");
361
-
362
- case 3:
363
- _this$props2 = this.props, commandHistoryStorage = _this$props2.commandHistoryStorage, language = _this$props2.language, scope = _this$props2.scope;
364
- this.loadingPromise = PromiseUtils.makeCancelable(commandHistoryStorage.getTable(language, scope, this.timestamp), function (resolved) {
365
- return resolved.close();
366
- });
367
- _context.next = 7;
368
- return this.loadingPromise;
369
-
370
- case 7:
371
- table = _context.sent;
372
- table.setReversed(true);
373
- table.setViewport({
374
- top: this.bufferIndex,
375
- bottom: this.bufferIndex + BUFFER_SIZE - 1
376
- });
377
- this.loadingPromise = PromiseUtils.makeCancelable(table.getViewportData(), function () {
378
- return table.close();
379
- });
380
- _context.next = 13;
381
- return this.loadingPromise;
382
-
383
- case 13:
384
- viewportData = _context.sent;
385
- this.bufferIndex += BUFFER_SIZE;
386
-
387
- if (this.bufferIndex >= table.size) {
388
- // We've loaded the full history, no need to load any more
389
- this.bufferIndex = null;
390
- }
391
-
392
- this.history = [].concat(_toConsumableArray(viewportData.items.map(function (_ref) {
393
- var name = _ref.name;
394
- return name;
395
- }).reverse()), _toConsumableArray(this.history));
396
- this.loadingPromise = null;
397
- table.close();
398
- _context.next = 28;
399
- break;
400
-
401
- case 21:
402
- _context.prev = 21;
403
- _context.t0 = _context["catch"](0);
404
- this.loadingPromise = null;
405
-
406
- if (!PromiseUtils.isCanceled(_context.t0)) {
407
- _context.next = 27;
408
- break;
409
- }
410
-
411
- log.debug2('Promise canceled, not loading history');
412
- return _context.abrupt("return");
413
-
414
- case 27:
415
- log.error('Error fetching history', _context.t0);
416
-
417
- case 28:
418
- case "end":
419
- return _context.stop();
420
- }
421
- }
422
- }, _callee, this, [[0, 21]]);
423
- }));
295
+ var {
296
+ commandHistoryStorage,
297
+ language,
298
+ scope
299
+ } = _this.props;
300
+ _this.loadingPromise = PromiseUtils.makeCancelable(commandHistoryStorage.getTable(language, scope, _this.timestamp), resolved => resolved.close());
301
+ var table = yield _this.loadingPromise;
302
+ table.setReversed(true);
303
+ table.setViewport({
304
+ top: _this.bufferIndex,
305
+ bottom: _this.bufferIndex + BUFFER_SIZE - 1
306
+ });
307
+ _this.loadingPromise = PromiseUtils.makeCancelable(table.getViewportData(), () => table.close());
308
+ var viewportData = yield _this.loadingPromise;
309
+ _this.bufferIndex += BUFFER_SIZE;
424
310
 
425
- function loadMoreHistory() {
426
- return _loadMoreHistory.apply(this, arguments);
427
- }
311
+ if (_this.bufferIndex >= table.size) {
312
+ // We've loaded the full history, no need to load any more
313
+ _this.bufferIndex = null;
314
+ }
428
315
 
429
- return loadMoreHistory;
430
- }()
431
- }, {
432
- key: "processCommand",
433
- value: function processCommand() {
434
- this.isCommandModified = false;
435
- this.commandHistoryIndex = null;
436
- var command = this.commandEditor.getValue().trim();
437
- this.history.push(command);
438
- this.commandEditor.setValue('');
439
- this.updateDimensions();
440
- var onSubmit = this.props.onSubmit;
441
- onSubmit(command);
442
- }
443
- }, {
444
- key: "updateDimensions",
445
- value: function updateDimensions() {
446
- var _this3 = this;
316
+ _this.history = [...viewportData.items.map((_ref) => {
317
+ var {
318
+ name
319
+ } = _ref;
320
+ return name;
321
+ }).reverse(), ..._this.history];
322
+ _this.loadingPromise = null;
323
+ table.close();
324
+ } catch (err) {
325
+ _this.loadingPromise = null;
326
+
327
+ if (PromiseUtils.isCanceled(err)) {
328
+ log.debug2('Promise canceled, not loading history');
329
+ return;
330
+ }
447
331
 
448
- if (!this.commandEditor) {
449
- return;
332
+ log.error('Error fetching history', err);
450
333
  }
334
+ })();
335
+ }
451
336
 
452
- var maxHeight = this.props.maxHeight;
453
- var contentHeight = this.commandEditor.getContentHeight();
454
- var commandEditorHeight = Math.max(Math.min(contentHeight, maxHeight), MIN_INPUT_HEIGHT);
455
- this.setState({
456
- commandEditorHeight: commandEditorHeight
457
- }, function () {
458
- _this3.commandEditor.layout();
459
- });
460
- }
461
- }, {
462
- key: "render",
463
- value: function render() {
464
- var _this$props3 = this.props,
465
- language = _this$props3.language,
466
- session = _this$props3.session;
467
- var _this$state = this.state,
468
- commandEditorHeight = _this$state.commandEditorHeight,
469
- isFocused = _this$state.isFocused,
470
- model = _this$state.model;
471
- return /*#__PURE__*/React.createElement("div", {
472
- className: "console-input-wrapper"
473
- }, /*#__PURE__*/React.createElement("div", {
474
- className: classNames('console-input-inner-wrapper', {
475
- focus: isFocused
476
- })
477
- }, /*#__PURE__*/React.createElement("div", {
478
- className: ConsoleInput.INPUT_CLASS_NAME,
479
- ref: this.commandContainer,
480
- style: {
481
- height: commandEditorHeight
482
- }
483
- }), model && /*#__PURE__*/React.createElement(MonacoCompletionProvider, {
484
- model: model,
485
- language: language,
486
- session: session
487
- })));
337
+ processCommand() {
338
+ this.isCommandModified = false;
339
+ this.commandHistoryIndex = null;
340
+ var command = this.commandEditor.getValue().trim();
341
+ this.history.push(command);
342
+ this.commandEditor.setValue('');
343
+ this.updateDimensions();
344
+ var {
345
+ onSubmit
346
+ } = this.props;
347
+ onSubmit(command);
348
+ }
349
+
350
+ updateDimensions() {
351
+ if (!this.commandEditor) {
352
+ return;
488
353
  }
489
- }]);
490
354
 
491
- return ConsoleInput;
492
- }(PureComponent);
355
+ var {
356
+ maxHeight
357
+ } = this.props;
358
+ var contentHeight = this.commandEditor.getContentHeight();
359
+ var commandEditorHeight = Math.max(Math.min(contentHeight, maxHeight), MIN_INPUT_HEIGHT);
360
+ this.setState({
361
+ commandEditorHeight
362
+ }, () => {
363
+ this.commandEditor.layout();
364
+ });
365
+ }
366
+
367
+ render() {
368
+ var {
369
+ language,
370
+ session
371
+ } = this.props;
372
+ var {
373
+ commandEditorHeight,
374
+ isFocused,
375
+ model
376
+ } = this.state;
377
+ return /*#__PURE__*/React.createElement("div", {
378
+ className: "console-input-wrapper"
379
+ }, /*#__PURE__*/React.createElement("div", {
380
+ className: classNames('console-input-inner-wrapper', {
381
+ focus: isFocused
382
+ })
383
+ }, /*#__PURE__*/React.createElement("div", {
384
+ className: ConsoleInput.INPUT_CLASS_NAME,
385
+ ref: this.commandContainer,
386
+ style: {
387
+ height: commandEditorHeight
388
+ }
389
+ }), model && /*#__PURE__*/React.createElement(MonacoCompletionProvider, {
390
+ model: model,
391
+ language: language,
392
+ session: session
393
+ })));
394
+ }
395
+
396
+ }
493
397
 
494
398
  _defineProperty(ConsoleInput, "INPUT_CLASS_NAME", 'console-input');
495
399
 
@@ -505,14 +409,5 @@ ConsoleInput.defaultProps = {
505
409
  maxHeight: LINE_HEIGHT * 10,
506
410
  scope: null
507
411
  };
508
-
509
- var mapStateToProps = function mapStateToProps(state) {
510
- return {
511
- commandHistoryStorage: getCommandHistoryStorage(state)
512
- };
513
- };
514
-
515
- export default connect(mapStateToProps, null, null, {
516
- forwardRef: true
517
- })(ConsoleInput);
412
+ export default ConsoleInput;
518
413
  //# sourceMappingURL=ConsoleInput.js.map