@open-amt-cloud-toolkit/ui-toolkit-angular 2.0.2 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,52 +1,57 @@
1
- {
2
- "name": "@open-amt-cloud-toolkit/ui-toolkit-angular",
3
- "version": "2.0.2",
4
- "license": "Apache-2.0",
5
- "scripts": {
6
- "ng": "ng",
7
- "start": "ng serve",
8
- "build": "ng build kvm && ng build sol",
9
- "test": "ng test",
10
- "test-kvm": "ng test kvm --no-watch --no-progress --browsers=ChromeHeadlessCI",
11
- "test-sol": "ng test sol --no-watch --no-progress --browsers=ChromeHeadlessCI",
12
- "test-ci": "npm run test-kvm && npm run test-sol",
13
- "lint": "ng lint",
14
- "e2e": "ng e2e",
15
- "build:kvm": "ng build kvm",
16
- "build:sol": "ng build sol"
17
- },
18
- "dependencies": {
19
- "@angular/common": "~11.2.14",
20
- "@angular/compiler": "~11.2.14",
21
- "@angular/core": "~11.2.14",
22
- "@angular/platform-browser": "~11.2.14",
23
- "@angular/platform-browser-dynamic": "~11.2.14",
24
- "@angular/router": "~11.2.14",
25
- "@open-amt-cloud-toolkit/ui-toolkit": "~2.0.3",
26
- "rxjs": "~6.6.0",
27
- "tslib": "^2.3.1",
28
- "xterm": "^4.14.1",
29
- "zone.js": "~0.11.3"
30
- },
31
- "devDependencies": {
32
- "@angular-devkit/build-angular": "~0.1102.14",
33
- "@angular/cdk": "^11.2.13",
34
- "@angular/cli": "~11.2.14",
35
- "@angular/compiler-cli": "~11.2.14",
36
- "@types/jasmine": "~3.10.2",
37
- "@types/node": "^14.0.0",
38
- "codelyzer": "^6.0.0",
39
- "jasmine-core": "~3.10.1",
40
- "jasmine-spec-reporter": "~7.0.0",
41
- "karma": "~6.3.7",
42
- "karma-chrome-launcher": "~3.1.0",
43
- "karma-coverage": "~2.0.3",
44
- "karma-jasmine": "~4.0.0",
45
- "karma-jasmine-html-reporter": "^1.5.0",
46
- "ng-packagr": "^11.0.0",
47
- "protractor": "~7.0.0",
48
- "ts-node": "~10.4.0",
49
- "tslint": "~6.1.0",
50
- "typescript": "~4.1.0"
51
- }
52
- }
1
+ {
2
+ "name": "@open-amt-cloud-toolkit/ui-toolkit-angular",
3
+ "version": "2.0.5",
4
+ "license": "Apache-2.0",
5
+ "bugs": {
6
+ "url": "https://github.com/open-amt-cloud-toolkit/ui-toolkit-angular/issues"
7
+ },
8
+ "homepage": "https://github.com/open-amt-cloud-toolkit/ui-toolkit-angular#readme",
9
+ "scripts": {
10
+ "prepublishOnly": "cp package.json dist",
11
+ "ng": "ng",
12
+ "start": "ng serve",
13
+ "build": "ng build kvm && ng build sol",
14
+ "test": "ng test",
15
+ "test-kvm": "ng test kvm --no-watch --no-progress --browsers=ChromeHeadlessCI",
16
+ "test-sol": "ng test sol --no-watch --no-progress --browsers=ChromeHeadlessCI",
17
+ "test-ci": "npm run test-kvm && npm run test-sol",
18
+ "lint": "ng lint",
19
+ "e2e": "ng e2e",
20
+ "build:kvm": "ng build kvm",
21
+ "build:sol": "ng build sol"
22
+ },
23
+ "dependencies": {
24
+ "@angular/common": "~11.2.14",
25
+ "@angular/compiler": "~11.2.14",
26
+ "@angular/core": "~11.2.14",
27
+ "@angular/platform-browser": "~11.2.14",
28
+ "@angular/platform-browser-dynamic": "~11.2.14",
29
+ "@angular/router": "~11.2.14",
30
+ "@open-amt-cloud-toolkit/ui-toolkit": "~2.0.5",
31
+ "rxjs": "~6.6.0",
32
+ "tslib": "^2.3.1",
33
+ "xterm": "^4.17.0",
34
+ "zone.js": "~0.11.5"
35
+ },
36
+ "devDependencies": {
37
+ "@angular-devkit/build-angular": "~0.1102.14",
38
+ "@angular/cdk": "^11.2.13",
39
+ "@angular/cli": "~11.2.14",
40
+ "@angular/compiler-cli": "~11.2.14",
41
+ "@types/jasmine": "~3.10.3",
42
+ "@types/node": "^14.0.0",
43
+ "codelyzer": "^6.0.0",
44
+ "jasmine-core": "~4.0.1",
45
+ "jasmine-spec-reporter": "~7.0.0",
46
+ "karma": "~6.3.17",
47
+ "karma-chrome-launcher": "~3.1.0",
48
+ "karma-coverage": "~2.2.0",
49
+ "karma-jasmine": "~4.0.0",
50
+ "karma-jasmine-html-reporter": "^1.5.0",
51
+ "ng-packagr": "^11.0.0",
52
+ "protractor": "~7.0.0",
53
+ "ts-node": "~10.7.0",
54
+ "tslint": "~6.1.0",
55
+ "typescript": "~4.1.0"
56
+ }
57
+ }
package/sol/README.md CHANGED
@@ -1,24 +1,24 @@
1
- # Sol
2
-
3
- This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.2.14.
4
-
5
- ## Code scaffolding
6
-
7
- Run `ng generate component component-name --project sol` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project sol`.
8
- > Note: Don't forget to add `--project sol` or else it will be added to the default project in your `angular.json` file.
9
-
10
- ## Build
11
-
12
- Run `ng build sol` to build the project. The build artifacts will be stored in the `dist/` directory.
13
-
14
- ## Publishing
15
-
16
- After building your library with `ng build sol`, go to the dist folder `cd dist/sol` and run `npm publish`.
17
-
18
- ## Running unit tests
19
-
20
- Run `ng test sol` to execute the unit tests via [Karma](https://karma-runner.github.io).
21
-
22
- ## Further help
23
-
24
- To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
1
+ # Sol
2
+
3
+ This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.2.14.
4
+
5
+ ## Code scaffolding
6
+
7
+ Run `ng generate component component-name --project sol` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project sol`.
8
+ > Note: Don't forget to add `--project sol` or else it will be added to the default project in your `angular.json` file.
9
+
10
+ ## Build
11
+
12
+ Run `ng build sol` to build the project. The build artifacts will be stored in the `dist/` directory.
13
+
14
+ ## Publishing
15
+
16
+ After building your library with `ng build sol`, go to the dist folder `cd dist/sol` and run `npm publish`.
17
+
18
+ ## Running unit tests
19
+
20
+ Run `ng test sol` to execute the unit tests via [Karma](https://karma-runner.github.io).
21
+
22
+ ## Further help
23
+
24
+ To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
@@ -1,237 +1,237 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('xterm'), require('@open-amt-cloud-toolkit/ui-toolkit/core'), require('@angular/common'), require('@angular/cdk/keycodes'), require('@angular/platform-browser'), require('@angular/common/http')) :
3
- typeof define === 'function' && define.amd ? define('sol', ['exports', '@angular/core', 'xterm', '@open-amt-cloud-toolkit/ui-toolkit/core', '@angular/common', '@angular/cdk/keycodes', '@angular/platform-browser', '@angular/common/http'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.sol = {}, global.ng.core, global.xterm, global['@open-amt-cloud-toolkit']['ui-toolkit'].core, global.ng.common, global.ng.cdk.keycodes, global.ng.platformBrowser, global.ng.common.http));
5
- }(this, (function (exports, i0, xterm, core, i1, keycodes, platformBrowser, http) { 'use strict';
6
-
7
- var TerminalComponent = /** @class */ (function () {
8
- function TerminalComponent() {
9
- this.handleKeyPress = new i0.EventEmitter();
10
- }
11
- TerminalComponent.prototype.ngOnInit = function () {
12
- var _this = this;
13
- this.container = document.getElementById('terminal');
14
- this.term.open(this.container);
15
- this.term.onData(function (data) {
16
- _this.handleKeyPress.emit(data);
17
- });
18
- this.term.attachCustomKeyEventHandler(function (e) {
19
- e.stopPropagation();
20
- e.preventDefault();
21
- if (e.ctrlKey === true && e.shiftKey === true && e.keyCode === keycodes.C) {
22
- return navigator.clipboard.writeText(_this.term.getSelection());
23
- }
24
- else if (e.ctrlKey === true && e.shiftKey === true && e.keyCode === keycodes.V) {
25
- return navigator.clipboard.readText().then(function (text) {
26
- _this.handleKeyPress.emit(text);
27
- });
28
- }
29
- else if (e.code === keycodes.SPACE) {
30
- return _this.handleKeyPress.emit(e.key);
31
- }
32
- });
33
- };
34
- return TerminalComponent;
35
- }());
36
- TerminalComponent.ɵfac = function TerminalComponent_Factory(t) { return new (t || TerminalComponent)(); };
37
- TerminalComponent.ɵcmp = i0.ɵɵdefineComponent({ type: TerminalComponent, selectors: [["amt-terminal"]], inputs: { term: "term" }, outputs: { handleKeyPress: "handleKeyPress" }, decls: 1, vars: 0, consts: [["id", "terminal", 1, "xtermDisplay", 2, "width", "fit-content"]], template: function TerminalComponent_Template(rf, ctx) {
38
- if (rf & 1) {
39
- i0.ɵɵelement(0, "div", 0);
40
- }
41
- }, encapsulation: 2 });
42
- (function () {
43
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TerminalComponent, [{
44
- type: i0.Component,
45
- args: [{
46
- selector: 'amt-terminal',
47
- templateUrl: './terminal.component.html'
48
- }]
49
- }], null, { term: [{
50
- type: i0.Input
51
- }], handleKeyPress: [{
52
- type: i0.Output
53
- }] });
54
- })();
55
-
56
- function SolComponent_amt_terminal_1_Template(rf, ctx) {
57
- if (rf & 1) {
58
- var _r2_1 = i0.ɵɵgetCurrentView();
59
- i0.ɵɵelementStart(0, "amt-terminal", 2);
60
- i0.ɵɵlistener("handleKeyPress", function SolComponent_amt_terminal_1_Template_amt_terminal_handleKeyPress_0_listener($event) { i0.ɵɵrestoreView(_r2_1); var ctx_r1 = i0.ɵɵnextContext(); return ctx_r1.handleKeyPress($event); });
61
- i0.ɵɵelementEnd();
62
- }
63
- if (rf & 2) {
64
- var ctx_r0 = i0.ɵɵnextContext();
65
- i0.ɵɵproperty("term", ctx_r0.term);
66
- }
67
- }
68
- var SolComponent = /** @class */ (function () {
69
- function SolComponent() {
70
- this.deviceState = 0;
71
- this.logger = new core.ConsoleLogger(core.LogLevel.ERROR);
72
- this.deviceStatus = new i0.EventEmitter();
73
- this.deviceConnection = new i0.EventEmitter();
74
- this.mpsServer = '';
75
- this.authToken = '';
76
- this.deviceId = '';
77
- }
78
- SolComponent.prototype.ngOnInit = function () {
79
- var _this = this;
80
- this.deviceConnection.subscribe(function (data) {
81
- if (data) {
82
- _this.init();
83
- }
84
- else {
85
- _this.stopSol();
86
- }
87
- });
88
- };
89
- SolComponent.prototype.ngAfterViewInit = function () {
90
- this.init();
91
- };
92
- SolComponent.prototype.init = function () {
93
- var _this = this;
94
- this.instantiate();
95
- setTimeout(function () {
96
- _this.startSol();
97
- }, 4000);
98
- };
99
- SolComponent.prototype.instantiate = function () {
100
- this.terminal = new core.AmtTerminal();
101
- this.dataProcessor = new core.TerminalDataProcessor(this.terminal);
102
- this.redirector = new core.AMTRedirector(this.logger, core.Protocol.SOL, new FileReader(), this.deviceId, 16994, '', '', 0, 0, this.authToken, this.mpsServer);
103
- this.terminal.onSend = this.redirector.send.bind(this.redirector);
104
- this.redirector.onNewState = this.terminal.StateChange.bind(this.terminal);
105
- this.redirector.onStateChanged = this.onTerminalStateChange.bind(this);
106
- this.redirector.onProcessData = this.dataProcessor.processData.bind(this);
107
- this.dataProcessor.processDataToXterm = this.handleWriteToXterm.bind(this);
108
- this.dataProcessor.clearTerminal = this.handleClearTerminal.bind(this);
109
- this.term = new xterm.Terminal({
110
- rows: 30,
111
- cols: 100,
112
- cursorStyle: 'block',
113
- fontWeight: 'bold'
114
- });
115
- };
116
- SolComponent.prototype.handleKeyPress = function (domEvent) {
117
- this.terminal.TermSendKeys(domEvent);
118
- };
119
- SolComponent.prototype.handleClearTerminal = function () {
120
- this.term.reset();
121
- };
122
- SolComponent.prototype.handleWriteToXterm = function (str) {
123
- this.term.write(str);
124
- };
125
- SolComponent.prototype.onTerminalStateChange = function (redirector, state) {
126
- this.deviceStatus.emit(state);
127
- this.deviceState = state;
128
- };
129
- SolComponent.prototype.startSol = function () {
130
- if (this.redirector !== null) {
131
- this.redirector.start(WebSocket);
132
- }
133
- };
134
- SolComponent.prototype.stopSol = function () {
135
- if (this.redirector !== null) {
136
- this.redirector.stop();
137
- this.handleClearTerminal();
138
- this.term.dispose();
139
- this.cleanup();
140
- }
141
- };
142
- SolComponent.prototype.cleanup = function () {
143
- this.terminal = null;
144
- this.redirector = null;
145
- this.dataProcessor = null;
146
- this.term = null;
147
- };
148
- SolComponent.prototype.ngOnDestroy = function () {
149
- this.stopSol();
150
- };
151
- return SolComponent;
152
- }());
153
- SolComponent.ɵfac = function SolComponent_Factory(t) { return new (t || SolComponent)(); };
154
- SolComponent.ɵcmp = i0.ɵɵdefineComponent({ type: SolComponent, selectors: [["amt-sol"]], inputs: { deviceConnection: "deviceConnection", mpsServer: "mpsServer", authToken: "authToken", deviceId: "deviceId" }, outputs: { deviceStatus: "deviceStatus" }, decls: 2, vars: 1, consts: [[1, "container"], [3, "term", "handleKeyPress", 4, "ngIf"], [3, "term", "handleKeyPress"]], template: function SolComponent_Template(rf, ctx) {
155
- if (rf & 1) {
156
- i0.ɵɵelementStart(0, "div", 0);
157
- i0.ɵɵtemplate(1, SolComponent_amt_terminal_1_Template, 1, 1, "amt-terminal", 1);
158
- i0.ɵɵelementEnd();
159
- }
160
- if (rf & 2) {
161
- i0.ɵɵadvance(1);
162
- i0.ɵɵproperty("ngIf", ctx.deviceState === 3);
163
- }
164
- }, directives: [i1.NgIf, TerminalComponent], styles: [".container{display:block;text-align:center}.xtermDisplay{display:inline-block}"], encapsulation: 2 });
165
- (function () {
166
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SolComponent, [{
167
- type: i0.Component,
168
- args: [{
169
- selector: 'amt-sol',
170
- templateUrl: './sol.component.html',
171
- styleUrls: ['./sol.component.css'],
172
- encapsulation: i0.ViewEncapsulation.None
173
- }]
174
- }], function () { return []; }, { deviceStatus: [{
175
- type: i0.Output
176
- }], deviceConnection: [{
177
- type: i0.Input
178
- }], mpsServer: [{
179
- type: i0.Input
180
- }], authToken: [{
181
- type: i0.Input
182
- }], deviceId: [{
183
- type: i0.Input
184
- }] });
185
- })();
186
-
187
- var SolModule = /** @class */ (function () {
188
- function SolModule() {
189
- }
190
- return SolModule;
191
- }());
192
- SolModule.ɵfac = function SolModule_Factory(t) { return new (t || SolModule)(); };
193
- SolModule.ɵmod = i0.ɵɵdefineNgModule({ type: SolModule });
194
- SolModule.ɵinj = i0.ɵɵdefineInjector({ imports: [[
195
- http.HttpClientModule,
196
- platformBrowser.BrowserModule
197
- ]] });
198
- (function () {
199
- (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(SolModule, { declarations: [SolComponent,
200
- TerminalComponent], imports: [http.HttpClientModule,
201
- platformBrowser.BrowserModule], exports: [SolComponent] });
202
- })();
203
- (function () {
204
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SolModule, [{
205
- type: i0.NgModule,
206
- args: [{
207
- declarations: [
208
- SolComponent,
209
- TerminalComponent
210
- ],
211
- imports: [
212
- http.HttpClientModule,
213
- platformBrowser.BrowserModule
214
- ],
215
- exports: [
216
- SolComponent
217
- ],
218
- schemas: [i0.CUSTOM_ELEMENTS_SCHEMA]
219
- }]
220
- }], null, null);
221
- })();
222
-
223
- /*
224
- * Public API Surface of sol
225
- */
226
-
227
- /**
228
- * Generated bundle index. Do not edit.
229
- */
230
-
231
- exports.SolComponent = SolComponent;
232
- exports.SolModule = SolModule;
233
-
234
- Object.defineProperty(exports, '__esModule', { value: true });
235
-
236
- })));
237
- //# sourceMappingURL=sol.umd.js.map
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('xterm'), require('@open-amt-cloud-toolkit/ui-toolkit/core'), require('@angular/common'), require('@angular/cdk/keycodes'), require('@angular/platform-browser'), require('@angular/common/http')) :
3
+ typeof define === 'function' && define.amd ? define('sol', ['exports', '@angular/core', 'xterm', '@open-amt-cloud-toolkit/ui-toolkit/core', '@angular/common', '@angular/cdk/keycodes', '@angular/platform-browser', '@angular/common/http'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.sol = {}, global.ng.core, global.xterm, global['@open-amt-cloud-toolkit']['ui-toolkit'].core, global.ng.common, global.ng.cdk.keycodes, global.ng.platformBrowser, global.ng.common.http));
5
+ }(this, (function (exports, i0, xterm, core, i1, keycodes, platformBrowser, http) { 'use strict';
6
+
7
+ var TerminalComponent = /** @class */ (function () {
8
+ function TerminalComponent() {
9
+ this.handleKeyPress = new i0.EventEmitter();
10
+ }
11
+ TerminalComponent.prototype.ngOnInit = function () {
12
+ var _this = this;
13
+ this.container = document.getElementById('terminal');
14
+ this.term.open(this.container);
15
+ this.term.onData(function (data) {
16
+ _this.handleKeyPress.emit(data);
17
+ });
18
+ this.term.attachCustomKeyEventHandler(function (e) {
19
+ e.stopPropagation();
20
+ e.preventDefault();
21
+ if (e.ctrlKey === true && e.shiftKey === true && e.keyCode === keycodes.C) {
22
+ return navigator.clipboard.writeText(_this.term.getSelection());
23
+ }
24
+ else if (e.ctrlKey === true && e.shiftKey === true && e.keyCode === keycodes.V) {
25
+ return navigator.clipboard.readText().then(function (text) {
26
+ _this.handleKeyPress.emit(text);
27
+ });
28
+ }
29
+ else if (e.code === keycodes.SPACE) {
30
+ return _this.handleKeyPress.emit(e.key);
31
+ }
32
+ });
33
+ };
34
+ return TerminalComponent;
35
+ }());
36
+ TerminalComponent.ɵfac = function TerminalComponent_Factory(t) { return new (t || TerminalComponent)(); };
37
+ TerminalComponent.ɵcmp = i0.ɵɵdefineComponent({ type: TerminalComponent, selectors: [["amt-terminal"]], inputs: { term: "term" }, outputs: { handleKeyPress: "handleKeyPress" }, decls: 1, vars: 0, consts: [["id", "terminal", 1, "xtermDisplay", 2, "width", "fit-content"]], template: function TerminalComponent_Template(rf, ctx) {
38
+ if (rf & 1) {
39
+ i0.ɵɵelement(0, "div", 0);
40
+ }
41
+ }, encapsulation: 2 });
42
+ (function () {
43
+ (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TerminalComponent, [{
44
+ type: i0.Component,
45
+ args: [{
46
+ selector: 'amt-terminal',
47
+ templateUrl: './terminal.component.html'
48
+ }]
49
+ }], null, { term: [{
50
+ type: i0.Input
51
+ }], handleKeyPress: [{
52
+ type: i0.Output
53
+ }] });
54
+ })();
55
+
56
+ function SolComponent_amt_terminal_1_Template(rf, ctx) {
57
+ if (rf & 1) {
58
+ var _r2_1 = i0.ɵɵgetCurrentView();
59
+ i0.ɵɵelementStart(0, "amt-terminal", 2);
60
+ i0.ɵɵlistener("handleKeyPress", function SolComponent_amt_terminal_1_Template_amt_terminal_handleKeyPress_0_listener($event) { i0.ɵɵrestoreView(_r2_1); var ctx_r1 = i0.ɵɵnextContext(); return ctx_r1.handleKeyPress($event); });
61
+ i0.ɵɵelementEnd();
62
+ }
63
+ if (rf & 2) {
64
+ var ctx_r0 = i0.ɵɵnextContext();
65
+ i0.ɵɵproperty("term", ctx_r0.term);
66
+ }
67
+ }
68
+ var SolComponent = /** @class */ (function () {
69
+ function SolComponent() {
70
+ this.deviceState = 0;
71
+ this.logger = new core.ConsoleLogger(core.LogLevel.ERROR);
72
+ this.deviceStatus = new i0.EventEmitter();
73
+ this.deviceConnection = new i0.EventEmitter();
74
+ this.mpsServer = '';
75
+ this.authToken = '';
76
+ this.deviceId = '';
77
+ }
78
+ SolComponent.prototype.ngOnInit = function () {
79
+ var _this = this;
80
+ this.deviceConnection.subscribe(function (data) {
81
+ if (data) {
82
+ _this.init();
83
+ }
84
+ else {
85
+ _this.stopSol();
86
+ }
87
+ });
88
+ };
89
+ SolComponent.prototype.ngAfterViewInit = function () {
90
+ this.init();
91
+ };
92
+ SolComponent.prototype.init = function () {
93
+ var _this = this;
94
+ this.instantiate();
95
+ setTimeout(function () {
96
+ _this.startSol();
97
+ }, 4000);
98
+ };
99
+ SolComponent.prototype.instantiate = function () {
100
+ this.terminal = new core.AmtTerminal();
101
+ this.dataProcessor = new core.TerminalDataProcessor(this.terminal);
102
+ this.redirector = new core.AMTRedirector(this.logger, core.Protocol.SOL, new FileReader(), this.deviceId, 16994, '', '', 0, 0, this.authToken, this.mpsServer);
103
+ this.terminal.onSend = this.redirector.send.bind(this.redirector);
104
+ this.redirector.onNewState = this.terminal.StateChange.bind(this.terminal);
105
+ this.redirector.onStateChanged = this.onTerminalStateChange.bind(this);
106
+ this.redirector.onProcessData = this.dataProcessor.processData.bind(this);
107
+ this.dataProcessor.processDataToXterm = this.handleWriteToXterm.bind(this);
108
+ this.dataProcessor.clearTerminal = this.handleClearTerminal.bind(this);
109
+ this.term = new xterm.Terminal({
110
+ rows: 30,
111
+ cols: 100,
112
+ cursorStyle: 'block',
113
+ fontWeight: 'bold'
114
+ });
115
+ };
116
+ SolComponent.prototype.handleKeyPress = function (domEvent) {
117
+ this.terminal.TermSendKeys(domEvent);
118
+ };
119
+ SolComponent.prototype.handleClearTerminal = function () {
120
+ this.term.reset();
121
+ };
122
+ SolComponent.prototype.handleWriteToXterm = function (str) {
123
+ this.term.write(str);
124
+ };
125
+ SolComponent.prototype.onTerminalStateChange = function (redirector, state) {
126
+ this.deviceStatus.emit(state);
127
+ this.deviceState = state;
128
+ };
129
+ SolComponent.prototype.startSol = function () {
130
+ if (this.redirector !== null) {
131
+ this.redirector.start(WebSocket);
132
+ }
133
+ };
134
+ SolComponent.prototype.stopSol = function () {
135
+ if (this.redirector !== null) {
136
+ this.redirector.stop();
137
+ this.handleClearTerminal();
138
+ this.term.dispose();
139
+ this.cleanup();
140
+ }
141
+ };
142
+ SolComponent.prototype.cleanup = function () {
143
+ this.terminal = null;
144
+ this.redirector = null;
145
+ this.dataProcessor = null;
146
+ this.term = null;
147
+ };
148
+ SolComponent.prototype.ngOnDestroy = function () {
149
+ this.stopSol();
150
+ };
151
+ return SolComponent;
152
+ }());
153
+ SolComponent.ɵfac = function SolComponent_Factory(t) { return new (t || SolComponent)(); };
154
+ SolComponent.ɵcmp = i0.ɵɵdefineComponent({ type: SolComponent, selectors: [["amt-sol"]], inputs: { deviceConnection: "deviceConnection", mpsServer: "mpsServer", authToken: "authToken", deviceId: "deviceId" }, outputs: { deviceStatus: "deviceStatus" }, decls: 2, vars: 1, consts: [[1, "container"], [3, "term", "handleKeyPress", 4, "ngIf"], [3, "term", "handleKeyPress"]], template: function SolComponent_Template(rf, ctx) {
155
+ if (rf & 1) {
156
+ i0.ɵɵelementStart(0, "div", 0);
157
+ i0.ɵɵtemplate(1, SolComponent_amt_terminal_1_Template, 1, 1, "amt-terminal", 1);
158
+ i0.ɵɵelementEnd();
159
+ }
160
+ if (rf & 2) {
161
+ i0.ɵɵadvance(1);
162
+ i0.ɵɵproperty("ngIf", ctx.deviceState === 3);
163
+ }
164
+ }, directives: [i1.NgIf, TerminalComponent], styles: [".container{display:block;text-align:center}.xtermDisplay{display:inline-block}"], encapsulation: 2 });
165
+ (function () {
166
+ (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SolComponent, [{
167
+ type: i0.Component,
168
+ args: [{
169
+ selector: 'amt-sol',
170
+ templateUrl: './sol.component.html',
171
+ styleUrls: ['./sol.component.css'],
172
+ encapsulation: i0.ViewEncapsulation.None
173
+ }]
174
+ }], function () { return []; }, { deviceStatus: [{
175
+ type: i0.Output
176
+ }], deviceConnection: [{
177
+ type: i0.Input
178
+ }], mpsServer: [{
179
+ type: i0.Input
180
+ }], authToken: [{
181
+ type: i0.Input
182
+ }], deviceId: [{
183
+ type: i0.Input
184
+ }] });
185
+ })();
186
+
187
+ var SolModule = /** @class */ (function () {
188
+ function SolModule() {
189
+ }
190
+ return SolModule;
191
+ }());
192
+ SolModule.ɵfac = function SolModule_Factory(t) { return new (t || SolModule)(); };
193
+ SolModule.ɵmod = i0.ɵɵdefineNgModule({ type: SolModule });
194
+ SolModule.ɵinj = i0.ɵɵdefineInjector({ imports: [[
195
+ http.HttpClientModule,
196
+ platformBrowser.BrowserModule
197
+ ]] });
198
+ (function () {
199
+ (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(SolModule, { declarations: [SolComponent,
200
+ TerminalComponent], imports: [http.HttpClientModule,
201
+ platformBrowser.BrowserModule], exports: [SolComponent] });
202
+ })();
203
+ (function () {
204
+ (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SolModule, [{
205
+ type: i0.NgModule,
206
+ args: [{
207
+ declarations: [
208
+ SolComponent,
209
+ TerminalComponent
210
+ ],
211
+ imports: [
212
+ http.HttpClientModule,
213
+ platformBrowser.BrowserModule
214
+ ],
215
+ exports: [
216
+ SolComponent
217
+ ],
218
+ schemas: [i0.CUSTOM_ELEMENTS_SCHEMA]
219
+ }]
220
+ }], null, null);
221
+ })();
222
+
223
+ /*
224
+ * Public API Surface of sol
225
+ */
226
+
227
+ /**
228
+ * Generated bundle index. Do not edit.
229
+ */
230
+
231
+ exports.SolComponent = SolComponent;
232
+ exports.SolModule = SolModule;
233
+
234
+ Object.defineProperty(exports, '__esModule', { value: true });
235
+
236
+ })));
237
+ //# sourceMappingURL=sol.umd.js.map