@theia/console 1.45.0 → 1.46.0-next.72

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 (34) hide show
  1. package/README.md +30 -30
  2. package/lib/browser/ansi-console-item.d.ts +12 -12
  3. package/lib/browser/ansi-console-item.js +38 -38
  4. package/lib/browser/console-content-widget.d.ts +17 -17
  5. package/lib/browser/console-content-widget.js +93 -93
  6. package/lib/browser/console-contribution.d.ts +33 -33
  7. package/lib/browser/console-contribution.js +143 -143
  8. package/lib/browser/console-frontend-module.d.ts +4 -4
  9. package/lib/browser/console-frontend-module.js +31 -31
  10. package/lib/browser/console-history.d.ts +19 -19
  11. package/lib/browser/console-history.js +74 -74
  12. package/lib/browser/console-manager.d.ts +7 -7
  13. package/lib/browser/console-manager.js +48 -48
  14. package/lib/browser/console-session-manager.d.ts +31 -31
  15. package/lib/browser/console-session-manager.js +116 -116
  16. package/lib/browser/console-session.d.ts +27 -27
  17. package/lib/browser/console-session.js +56 -56
  18. package/lib/browser/console-widget.d.ts +67 -67
  19. package/lib/browser/console-widget.d.ts.map +1 -1
  20. package/lib/browser/console-widget.js +270 -271
  21. package/lib/browser/console-widget.js.map +1 -1
  22. package/lib/package.spec.js +25 -25
  23. package/package.json +6 -6
  24. package/src/browser/ansi-console-item.tsx +48 -48
  25. package/src/browser/console-content-widget.tsx +91 -91
  26. package/src/browser/console-contribution.ts +143 -143
  27. package/src/browser/console-frontend-module.ts +32 -32
  28. package/src/browser/console-history.ts +76 -76
  29. package/src/browser/console-manager.ts +37 -37
  30. package/src/browser/console-session-manager.ts +121 -121
  31. package/src/browser/console-session.ts +61 -61
  32. package/src/browser/console-widget.ts +298 -299
  33. package/src/browser/style/index.css +49 -49
  34. package/src/package.spec.ts +28 -28
@@ -1,299 +1,298 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2018 TypeFox and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { ElementExt } from '@theia/core/shared/@phosphor/domutils';
18
- import { injectable, inject, postConstruct, interfaces, Container } from '@theia/core/shared/inversify';
19
- import { TreeSourceNode } from '@theia/core/lib/browser/source-tree';
20
- import { ContextKeyService, ContextKey } from '@theia/core/lib/browser/context-key-service';
21
- import { BaseWidget, PanelLayout, Widget, Message, MessageLoop, StatefulWidget, CompositeTreeNode } from '@theia/core/lib/browser';
22
- import { MonacoEditor } from '@theia/monaco/lib/browser/monaco-editor';
23
- import URI from '@theia/core/lib/common/uri';
24
- import { MonacoEditorProvider } from '@theia/monaco/lib/browser/monaco-editor-provider';
25
- import { ConsoleHistory } from './console-history';
26
- import { ConsoleContentWidget } from './console-content-widget';
27
- import { ConsoleSession } from './console-session';
28
- import { ConsoleSessionManager } from './console-session-manager';
29
- import * as monaco from '@theia/monaco-editor-core';
30
-
31
- export const ConsoleOptions = Symbol('ConsoleWidgetOptions');
32
- export interface ConsoleOptions {
33
- id: string
34
- title?: {
35
- label?: string
36
- iconClass?: string
37
- caption?: string
38
- }
39
- input: {
40
- uri: URI
41
- options?: MonacoEditor.IOptions
42
- }
43
- inputFocusContextKey?: ContextKey<boolean>
44
- }
45
-
46
- @injectable()
47
- export class ConsoleWidget extends BaseWidget implements StatefulWidget {
48
-
49
- static styles = {
50
- node: 'theia-console-widget',
51
- content: 'theia-console-content',
52
- input: 'theia-console-input',
53
- };
54
-
55
- static createContainer(parent: interfaces.Container, options: ConsoleOptions): Container {
56
- const child = ConsoleContentWidget.createContainer(parent);
57
- child.bind(ConsoleHistory).toSelf();
58
- child.bind(ConsoleOptions).toConstantValue(options);
59
- child.bind(ConsoleWidget).toSelf();
60
- return child;
61
- }
62
-
63
- @inject(ConsoleOptions)
64
- protected readonly options: ConsoleOptions;
65
-
66
- @inject(ConsoleContentWidget)
67
- readonly content: ConsoleContentWidget;
68
-
69
- @inject(ConsoleHistory)
70
- protected readonly history: ConsoleHistory;
71
-
72
- @inject(ConsoleSessionManager)
73
- protected readonly sessionManager: ConsoleSessionManager;
74
-
75
- @inject(MonacoEditorProvider)
76
- protected readonly editorProvider: MonacoEditorProvider;
77
-
78
- @inject(ContextKeyService)
79
- protected readonly contextKeyService: ContextKeyService;
80
-
81
- protected _input: MonacoEditor;
82
- protected _inputFocusContextKey: ContextKey<boolean>;
83
-
84
- constructor() {
85
- super();
86
- this.node.classList.add(ConsoleWidget.styles.node);
87
- }
88
-
89
- @postConstruct()
90
- protected init(): void {
91
- this.doInit();
92
- }
93
-
94
- protected async doInit(): Promise<void> {
95
- const { id, title, inputFocusContextKey } = this.options;
96
- const { label, iconClass, caption } = Object.assign({}, title);
97
- this.id = id;
98
- this.title.closable = true;
99
- this.title.label = label || id;
100
- if (iconClass) {
101
- this.title.iconClass = iconClass;
102
- }
103
- this.title.caption = caption || label || id;
104
-
105
- const layout = this.layout = new PanelLayout();
106
-
107
- this.content.node.classList.add(ConsoleWidget.styles.content);
108
- this.toDispose.push(this.content);
109
- layout.addWidget(this.content);
110
-
111
- const inputWidget = new Widget();
112
- inputWidget.node.classList.add(ConsoleWidget.styles.input);
113
- layout.addWidget(inputWidget);
114
-
115
- const input = this._input = await this.createInput(inputWidget.node);
116
- this.toDispose.push(input);
117
- this.toDispose.push(input.getControl().onDidLayoutChange(() => this.resizeContent()));
118
-
119
- this.toDispose.push(input.getControl().onDidChangeConfiguration(event => {
120
- if (event.hasChanged(monaco.editor.EditorOption.fontInfo)) {
121
- this.updateFont();
122
- }
123
- }));
124
-
125
- this.session = this.sessionManager.selectedSession;
126
- this.toDispose.push(this.sessionManager.onDidChangeSelectedSession(session => {
127
- // Do not clear the session output when `undefined`.
128
- if (session) {
129
- this.session = session;
130
- }
131
- }));
132
-
133
- this.updateFont();
134
- if (inputFocusContextKey) {
135
- this.toDispose.push(input.onFocusChanged(() => inputFocusContextKey.set(this.hasInputFocus())));
136
- this.toDispose.push(input.onCursorPositionChanged(() => input.getControl().createContextKey('consoleNavigationBackEnabled', this.consoleNavigationBackEnabled)));
137
- this.toDispose.push(input.onCursorPositionChanged(() => input.getControl().createContextKey('consoleNavigationForwardEnabled', this.consoleNavigationForwardEnabled)));
138
- }
139
- input.getControl().createContextKey('consoleInputFocus', true);
140
- const contentContext = this.contextKeyService.createScoped(this.content.node);
141
- contentContext.setContext('consoleContentFocus', true);
142
- this.toDispose.push(contentContext);
143
- }
144
-
145
- protected createInput(node: HTMLElement): Promise<MonacoEditor> {
146
- return this.editorProvider.createInline(this.options.input.uri, node, this.options.input.options);
147
- }
148
-
149
- protected updateFont(): void {
150
- const { fontFamily, fontSize, lineHeight } = this._input.getControl().getOption(monaco.editor.EditorOption.fontInfo);
151
- this.content.node.style.fontFamily = fontFamily;
152
- this.content.node.style.fontSize = fontSize + 'px';
153
- this.content.node.style.lineHeight = lineHeight + 'px';
154
- }
155
-
156
- protected _session: ConsoleSession | undefined;
157
- set session(session: ConsoleSession | undefined) {
158
- if (this._session === session) {
159
- return;
160
- }
161
- this._session = session;
162
- this.content.source = session;
163
- }
164
- get session(): ConsoleSession | undefined {
165
- return this._session;
166
- }
167
-
168
- get input(): MonacoEditor {
169
- return this._input;
170
- }
171
-
172
- get consoleNavigationBackEnabled(): boolean {
173
- const editor = this.input.getControl();
174
- return !!editor.getPosition()!.equals({ lineNumber: 1, column: 1 });
175
- }
176
-
177
- get consoleNavigationForwardEnabled(): boolean {
178
- const editor = this.input.getControl();
179
- const lineNumber = editor.getModel()!.getLineCount();
180
- const column = editor.getModel()!.getLineMaxColumn(lineNumber);
181
- return !!editor.getPosition()!.equals({ lineNumber, column });
182
- }
183
-
184
- selectAll(): void {
185
- const selection = document.getSelection();
186
- if (selection) {
187
- selection.selectAllChildren(this.content.node);
188
- }
189
- }
190
-
191
- collapseAll(): void {
192
- const { root } = this.content.model;
193
- if (CompositeTreeNode.is(root)) {
194
- this.content.model.collapseAll(root);
195
- }
196
- }
197
-
198
- clear(): void {
199
- if (this.session) {
200
- this.session.clear();
201
- }
202
- }
203
-
204
- async execute(): Promise<void> {
205
- const value = this._input.getControl().getValue();
206
- this._input.getControl().setValue('');
207
- this.history.push(value);
208
- if (this.session) {
209
- const listener = this.content.model.onNodeRefreshed(() => {
210
- listener.dispose();
211
- this.revealLastOutput();
212
- });
213
- await this.session.execute(value);
214
- }
215
- }
216
-
217
- navigateBack(): void {
218
- const value = this.history.previous;
219
- if (value === undefined) {
220
- return;
221
- }
222
- const editor = this.input.getControl();
223
- editor.setValue(value);
224
- editor.setPosition({
225
- lineNumber: 1,
226
- column: 1
227
- });
228
- }
229
-
230
- navigateForward(): void {
231
- const value = this.history.next || '';
232
- const editor = this.input.getControl();
233
- editor.setValue(value);
234
- const lineNumber = editor.getModel()!.getLineCount();
235
- const column = editor.getModel()!.getLineMaxColumn(lineNumber);
236
- editor.setPosition({ lineNumber, column });
237
- }
238
-
239
- protected revealLastOutput(): void {
240
- const { root } = this.content.model;
241
- if (TreeSourceNode.is(root)) {
242
- this.content.model.selectNode(root.children[root.children.length - 1]);
243
- }
244
- }
245
-
246
- protected override onActivateRequest(msg: Message): void {
247
- super.onActivateRequest(msg);
248
- this._input.focus();
249
- }
250
-
251
- protected totalHeight = -1;
252
- protected totalWidth = -1;
253
- protected override onResize(msg: Widget.ResizeMessage): void {
254
- super.onResize(msg);
255
- this.totalWidth = msg.width;
256
- this.totalHeight = msg.height;
257
- this._input.resizeToFit();
258
- this.resizeContent();
259
- }
260
-
261
- protected resizeContent(): void {
262
- this.totalHeight = this.totalHeight < 0 ? this.computeHeight() : this.totalHeight;
263
- const inputHeight = this._input.getControl().getLayoutInfo().height;
264
- const contentHeight = this.totalHeight - inputHeight;
265
- this.content.node.style.height = `${contentHeight}px`;
266
- MessageLoop.sendMessage(this.content, new Widget.ResizeMessage(this.totalWidth, contentHeight));
267
- }
268
-
269
- protected computeHeight(): number {
270
- const { verticalSum } = ElementExt.boxSizing(this.node);
271
- return this.node.offsetHeight - verticalSum;
272
- }
273
-
274
- storeState(): object {
275
- const history = this.history.store();
276
- const input = this.input.storeViewState();
277
- return {
278
- history,
279
- input
280
- };
281
- }
282
-
283
- restoreState(oldState: object): void {
284
- if ('history' in oldState) {
285
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
286
- this.history.restore((<any>oldState)['history']);
287
- }
288
- this.input.getControl().setValue(this.history.current || '');
289
- if ('input' in oldState) {
290
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
291
- this.input.restoreViewState((<any>oldState)['input']);
292
- }
293
- }
294
-
295
- hasInputFocus(): boolean {
296
- return this._input && this._input.isFocused({ strict: true });
297
- }
298
-
299
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2018 TypeFox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { ElementExt } from '@theia/core/shared/@phosphor/domutils';
18
+ import { injectable, inject, postConstruct, interfaces, Container } from '@theia/core/shared/inversify';
19
+ import { TreeSourceNode } from '@theia/core/lib/browser/source-tree';
20
+ import { ContextKeyService, ContextKey } from '@theia/core/lib/browser/context-key-service';
21
+ import { BaseWidget, PanelLayout, Widget, Message, MessageLoop, StatefulWidget, CompositeTreeNode } from '@theia/core/lib/browser';
22
+ import { MonacoEditor } from '@theia/monaco/lib/browser/monaco-editor';
23
+ import URI from '@theia/core/lib/common/uri';
24
+ import { MonacoEditorProvider } from '@theia/monaco/lib/browser/monaco-editor-provider';
25
+ import { ConsoleHistory } from './console-history';
26
+ import { ConsoleContentWidget } from './console-content-widget';
27
+ import { ConsoleSession } from './console-session';
28
+ import { ConsoleSessionManager } from './console-session-manager';
29
+ import * as monaco from '@theia/monaco-editor-core';
30
+
31
+ export const ConsoleOptions = Symbol('ConsoleWidgetOptions');
32
+ export interface ConsoleOptions {
33
+ id: string
34
+ title?: {
35
+ label?: string
36
+ iconClass?: string
37
+ caption?: string
38
+ }
39
+ input: {
40
+ uri: URI
41
+ options?: MonacoEditor.IOptions
42
+ }
43
+ inputFocusContextKey?: ContextKey<boolean>
44
+ }
45
+
46
+ @injectable()
47
+ export class ConsoleWidget extends BaseWidget implements StatefulWidget {
48
+
49
+ static styles = {
50
+ node: 'theia-console-widget',
51
+ content: 'theia-console-content',
52
+ input: 'theia-console-input',
53
+ };
54
+
55
+ static createContainer(parent: interfaces.Container, options: ConsoleOptions): Container {
56
+ const child = ConsoleContentWidget.createContainer(parent);
57
+ child.bind(ConsoleHistory).toSelf();
58
+ child.bind(ConsoleOptions).toConstantValue(options);
59
+ child.bind(ConsoleWidget).toSelf();
60
+ return child;
61
+ }
62
+
63
+ @inject(ConsoleOptions)
64
+ protected readonly options: ConsoleOptions;
65
+
66
+ @inject(ConsoleContentWidget)
67
+ readonly content: ConsoleContentWidget;
68
+
69
+ @inject(ConsoleHistory)
70
+ protected readonly history: ConsoleHistory;
71
+
72
+ @inject(ConsoleSessionManager)
73
+ protected readonly sessionManager: ConsoleSessionManager;
74
+
75
+ @inject(MonacoEditorProvider)
76
+ protected readonly editorProvider: MonacoEditorProvider;
77
+
78
+ @inject(ContextKeyService)
79
+ protected readonly contextKeyService: ContextKeyService;
80
+
81
+ protected _input: MonacoEditor;
82
+ protected _inputFocusContextKey: ContextKey<boolean>;
83
+
84
+ constructor() {
85
+ super();
86
+ this.node.classList.add(ConsoleWidget.styles.node);
87
+ }
88
+
89
+ @postConstruct()
90
+ protected init(): void {
91
+ this.doInit();
92
+ }
93
+
94
+ protected async doInit(): Promise<void> {
95
+ const { id, title, inputFocusContextKey } = this.options;
96
+ const { label, iconClass, caption } = Object.assign({}, title);
97
+ this.id = id;
98
+ this.title.closable = true;
99
+ this.title.label = label || id;
100
+ if (iconClass) {
101
+ this.title.iconClass = iconClass;
102
+ }
103
+ this.title.caption = caption || label || id;
104
+
105
+ const layout = this.layout = new PanelLayout();
106
+
107
+ this.content.node.classList.add(ConsoleWidget.styles.content);
108
+ this.toDispose.push(this.content);
109
+ layout.addWidget(this.content);
110
+
111
+ const inputWidget = new Widget();
112
+ inputWidget.node.classList.add(ConsoleWidget.styles.input);
113
+ layout.addWidget(inputWidget);
114
+
115
+ const input = this._input = await this.createInput(inputWidget.node);
116
+ this.toDispose.push(input);
117
+ this.toDispose.push(input.getControl().onDidLayoutChange(() => this.resizeContent()));
118
+
119
+ this.toDispose.push(input.getControl().onDidChangeConfiguration(event => {
120
+ if (event.hasChanged(monaco.editor.EditorOption.fontInfo)) {
121
+ this.updateFont();
122
+ }
123
+ }));
124
+
125
+ this.session = this.sessionManager.selectedSession;
126
+ this.toDispose.push(this.sessionManager.onDidChangeSelectedSession(session => {
127
+ // Do not clear the session output when `undefined`.
128
+ if (session) {
129
+ this.session = session;
130
+ }
131
+ }));
132
+
133
+ this.updateFont();
134
+ if (inputFocusContextKey) {
135
+ this.toDispose.push(input.onFocusChanged(() => inputFocusContextKey.set(this.hasInputFocus())));
136
+ this.toDispose.push(input.onCursorPositionChanged(() => input.getControl().createContextKey('consoleNavigationBackEnabled', this.consoleNavigationBackEnabled)));
137
+ this.toDispose.push(input.onCursorPositionChanged(() => input.getControl().createContextKey('consoleNavigationForwardEnabled', this.consoleNavigationForwardEnabled)));
138
+ }
139
+ input.getControl().createContextKey('consoleInputFocus', true);
140
+ const contentContext = this.contextKeyService.createScoped(this.content.node);
141
+ contentContext.setContext('consoleContentFocus', true);
142
+ }
143
+
144
+ protected createInput(node: HTMLElement): Promise<MonacoEditor> {
145
+ return this.editorProvider.createInline(this.options.input.uri, node, this.options.input.options);
146
+ }
147
+
148
+ protected updateFont(): void {
149
+ const { fontFamily, fontSize, lineHeight } = this._input.getControl().getOption(monaco.editor.EditorOption.fontInfo);
150
+ this.content.node.style.fontFamily = fontFamily;
151
+ this.content.node.style.fontSize = fontSize + 'px';
152
+ this.content.node.style.lineHeight = lineHeight + 'px';
153
+ }
154
+
155
+ protected _session: ConsoleSession | undefined;
156
+ set session(session: ConsoleSession | undefined) {
157
+ if (this._session === session) {
158
+ return;
159
+ }
160
+ this._session = session;
161
+ this.content.source = session;
162
+ }
163
+ get session(): ConsoleSession | undefined {
164
+ return this._session;
165
+ }
166
+
167
+ get input(): MonacoEditor {
168
+ return this._input;
169
+ }
170
+
171
+ get consoleNavigationBackEnabled(): boolean {
172
+ const editor = this.input.getControl();
173
+ return !!editor.getPosition()!.equals({ lineNumber: 1, column: 1 });
174
+ }
175
+
176
+ get consoleNavigationForwardEnabled(): boolean {
177
+ const editor = this.input.getControl();
178
+ const lineNumber = editor.getModel()!.getLineCount();
179
+ const column = editor.getModel()!.getLineMaxColumn(lineNumber);
180
+ return !!editor.getPosition()!.equals({ lineNumber, column });
181
+ }
182
+
183
+ selectAll(): void {
184
+ const selection = document.getSelection();
185
+ if (selection) {
186
+ selection.selectAllChildren(this.content.node);
187
+ }
188
+ }
189
+
190
+ collapseAll(): void {
191
+ const { root } = this.content.model;
192
+ if (CompositeTreeNode.is(root)) {
193
+ this.content.model.collapseAll(root);
194
+ }
195
+ }
196
+
197
+ clear(): void {
198
+ if (this.session) {
199
+ this.session.clear();
200
+ }
201
+ }
202
+
203
+ async execute(): Promise<void> {
204
+ const value = this._input.getControl().getValue();
205
+ this._input.getControl().setValue('');
206
+ this.history.push(value);
207
+ if (this.session) {
208
+ const listener = this.content.model.onNodeRefreshed(() => {
209
+ listener.dispose();
210
+ this.revealLastOutput();
211
+ });
212
+ await this.session.execute(value);
213
+ }
214
+ }
215
+
216
+ navigateBack(): void {
217
+ const value = this.history.previous;
218
+ if (value === undefined) {
219
+ return;
220
+ }
221
+ const editor = this.input.getControl();
222
+ editor.setValue(value);
223
+ editor.setPosition({
224
+ lineNumber: 1,
225
+ column: 1
226
+ });
227
+ }
228
+
229
+ navigateForward(): void {
230
+ const value = this.history.next || '';
231
+ const editor = this.input.getControl();
232
+ editor.setValue(value);
233
+ const lineNumber = editor.getModel()!.getLineCount();
234
+ const column = editor.getModel()!.getLineMaxColumn(lineNumber);
235
+ editor.setPosition({ lineNumber, column });
236
+ }
237
+
238
+ protected revealLastOutput(): void {
239
+ const { root } = this.content.model;
240
+ if (TreeSourceNode.is(root)) {
241
+ this.content.model.selectNode(root.children[root.children.length - 1]);
242
+ }
243
+ }
244
+
245
+ protected override onActivateRequest(msg: Message): void {
246
+ super.onActivateRequest(msg);
247
+ this._input.focus();
248
+ }
249
+
250
+ protected totalHeight = -1;
251
+ protected totalWidth = -1;
252
+ protected override onResize(msg: Widget.ResizeMessage): void {
253
+ super.onResize(msg);
254
+ this.totalWidth = msg.width;
255
+ this.totalHeight = msg.height;
256
+ this._input.resizeToFit();
257
+ this.resizeContent();
258
+ }
259
+
260
+ protected resizeContent(): void {
261
+ this.totalHeight = this.totalHeight < 0 ? this.computeHeight() : this.totalHeight;
262
+ const inputHeight = this._input.getControl().getLayoutInfo().height;
263
+ const contentHeight = this.totalHeight - inputHeight;
264
+ this.content.node.style.height = `${contentHeight}px`;
265
+ MessageLoop.sendMessage(this.content, new Widget.ResizeMessage(this.totalWidth, contentHeight));
266
+ }
267
+
268
+ protected computeHeight(): number {
269
+ const { verticalSum } = ElementExt.boxSizing(this.node);
270
+ return this.node.offsetHeight - verticalSum;
271
+ }
272
+
273
+ storeState(): object {
274
+ const history = this.history.store();
275
+ const input = this.input.storeViewState();
276
+ return {
277
+ history,
278
+ input
279
+ };
280
+ }
281
+
282
+ restoreState(oldState: object): void {
283
+ if ('history' in oldState) {
284
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
285
+ this.history.restore((<any>oldState)['history']);
286
+ }
287
+ this.input.getControl().setValue(this.history.current || '');
288
+ if ('input' in oldState) {
289
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
290
+ this.input.restoreViewState((<any>oldState)['input']);
291
+ }
292
+ }
293
+
294
+ hasInputFocus(): boolean {
295
+ return this._input && this._input.isFocused({ strict: true });
296
+ }
297
+
298
+ }