[59329aa] | 1 | import { NgModule, Component, Input, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core';
|
---|
| 2 | import { FormsModule } from '@angular/forms';
|
---|
| 3 | import { CommonModule } from '@angular/common';
|
---|
| 4 | import { DomHandler } from 'primeng/dom';
|
---|
| 5 | import * as i0 from "@angular/core";
|
---|
| 6 | import * as i1 from "./terminalservice";
|
---|
| 7 | import * as i2 from "@angular/common";
|
---|
| 8 | import * as i3 from "@angular/forms";
|
---|
| 9 | export class Terminal {
|
---|
| 10 | constructor(el, terminalService, cd) {
|
---|
| 11 | this.el = el;
|
---|
| 12 | this.terminalService = terminalService;
|
---|
| 13 | this.cd = cd;
|
---|
| 14 | this.commands = [];
|
---|
| 15 | this.subscription = terminalService.responseHandler.subscribe(response => {
|
---|
| 16 | this.commands[this.commands.length - 1].response = response;
|
---|
| 17 | this.commandProcessed = true;
|
---|
| 18 | });
|
---|
| 19 | }
|
---|
| 20 | ngAfterViewInit() {
|
---|
| 21 | this.container = DomHandler.find(this.el.nativeElement, '.p-terminal')[0];
|
---|
| 22 | }
|
---|
| 23 | ngAfterViewChecked() {
|
---|
| 24 | if (this.commandProcessed) {
|
---|
| 25 | this.container.scrollTop = this.container.scrollHeight;
|
---|
| 26 | this.commandProcessed = false;
|
---|
| 27 | }
|
---|
| 28 | }
|
---|
| 29 | set response(value) {
|
---|
| 30 | if (value) {
|
---|
| 31 | this.commands[this.commands.length - 1].response = value;
|
---|
| 32 | this.commandProcessed = true;
|
---|
| 33 | }
|
---|
| 34 | }
|
---|
| 35 | handleCommand(event) {
|
---|
| 36 | if (event.keyCode == 13) {
|
---|
| 37 | this.commands.push({ text: this.command });
|
---|
| 38 | this.terminalService.sendCommand(this.command);
|
---|
| 39 | this.command = '';
|
---|
| 40 | }
|
---|
| 41 | }
|
---|
| 42 | focus(element) {
|
---|
| 43 | element.focus();
|
---|
| 44 | }
|
---|
| 45 | ngOnDestroy() {
|
---|
| 46 | if (this.subscription) {
|
---|
| 47 | this.subscription.unsubscribe();
|
---|
| 48 | }
|
---|
| 49 | }
|
---|
| 50 | }
|
---|
| 51 | Terminal.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Terminal, deps: [{ token: i0.ElementRef }, { token: i1.TerminalService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
---|
| 52 | Terminal.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: Terminal, selector: "p-terminal", inputs: { welcomeMessage: "welcomeMessage", prompt: "prompt", style: "style", styleClass: "styleClass", response: "response" }, host: { classAttribute: "p-element" }, ngImport: i0, template: `
|
---|
| 53 | <div [ngClass]="'p-terminal p-component'" [ngStyle]="style" [class]="styleClass" (click)="focus(in)">
|
---|
| 54 | <div *ngIf="welcomeMessage">{{welcomeMessage}}</div>
|
---|
| 55 | <div class="p-terminal-content">
|
---|
| 56 | <div *ngFor="let command of commands">
|
---|
| 57 | <span class="p-terminal-prompt">{{prompt}}</span>
|
---|
| 58 | <span class="p-terminal-command">{{command.text}}</span>
|
---|
| 59 | <div class="p-terminal-response">{{command.response}}</div>
|
---|
| 60 | </div>
|
---|
| 61 | </div>
|
---|
| 62 | <div class="p-terminal-prompt-container">
|
---|
| 63 | <span class="p-terminal-content-prompt">{{prompt}}</span>
|
---|
| 64 | <input #in type="text" [(ngModel)]="command" class="p-terminal-input" autocomplete="off" (keydown)="handleCommand($event)" autofocus>
|
---|
| 65 | </div>
|
---|
| 66 | </div>
|
---|
| 67 | `, isInline: true, styles: [".p-terminal{height:18rem;overflow:auto}.p-terminal-prompt-container{display:flex;align-items:center}.p-terminal-input{flex:1 1 auto;border:0 none;background-color:transparent;color:inherit;padding:0;outline:0 none}.p-terminal-input::-ms-clear{display:none}\n"], directives: [{ type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
---|
| 68 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Terminal, decorators: [{
|
---|
| 69 | type: Component,
|
---|
| 70 | args: [{ selector: 'p-terminal', template: `
|
---|
| 71 | <div [ngClass]="'p-terminal p-component'" [ngStyle]="style" [class]="styleClass" (click)="focus(in)">
|
---|
| 72 | <div *ngIf="welcomeMessage">{{welcomeMessage}}</div>
|
---|
| 73 | <div class="p-terminal-content">
|
---|
| 74 | <div *ngFor="let command of commands">
|
---|
| 75 | <span class="p-terminal-prompt">{{prompt}}</span>
|
---|
| 76 | <span class="p-terminal-command">{{command.text}}</span>
|
---|
| 77 | <div class="p-terminal-response">{{command.response}}</div>
|
---|
| 78 | </div>
|
---|
| 79 | </div>
|
---|
| 80 | <div class="p-terminal-prompt-container">
|
---|
| 81 | <span class="p-terminal-content-prompt">{{prompt}}</span>
|
---|
| 82 | <input #in type="text" [(ngModel)]="command" class="p-terminal-input" autocomplete="off" (keydown)="handleCommand($event)" autofocus>
|
---|
| 83 | </div>
|
---|
| 84 | </div>
|
---|
| 85 | `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
---|
| 86 | 'class': 'p-element'
|
---|
| 87 | }, styles: [".p-terminal{height:18rem;overflow:auto}.p-terminal-prompt-container{display:flex;align-items:center}.p-terminal-input{flex:1 1 auto;border:0 none;background-color:transparent;color:inherit;padding:0;outline:0 none}.p-terminal-input::-ms-clear{display:none}\n"] }]
|
---|
| 88 | }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.TerminalService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { welcomeMessage: [{
|
---|
| 89 | type: Input
|
---|
| 90 | }], prompt: [{
|
---|
| 91 | type: Input
|
---|
| 92 | }], style: [{
|
---|
| 93 | type: Input
|
---|
| 94 | }], styleClass: [{
|
---|
| 95 | type: Input
|
---|
| 96 | }], response: [{
|
---|
| 97 | type: Input
|
---|
| 98 | }] } });
|
---|
| 99 | export class TerminalModule {
|
---|
| 100 | }
|
---|
| 101 | TerminalModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TerminalModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
---|
| 102 | TerminalModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TerminalModule, declarations: [Terminal], imports: [CommonModule, FormsModule], exports: [Terminal] });
|
---|
| 103 | TerminalModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TerminalModule, imports: [[CommonModule, FormsModule]] });
|
---|
| 104 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TerminalModule, decorators: [{
|
---|
| 105 | type: NgModule,
|
---|
| 106 | args: [{
|
---|
| 107 | imports: [CommonModule, FormsModule],
|
---|
| 108 | exports: [Terminal],
|
---|
| 109 | declarations: [Terminal]
|
---|
| 110 | }]
|
---|
| 111 | }] });
|
---|
| 112 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVybW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