source: trip-planner-front/node_modules/primeng/fesm2015/primeng-terminal.mjs@ 6fe77af

Last change on this file since 6fe77af was 59329aa, checked in by Ema <ema_spirova@…>, 3 years ago

adding photos

  • Property mode set to 100644
File size: 8.2 KB
Line 
1import * as i0 from '@angular/core';
2import { Injectable, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, NgModule } from '@angular/core';
3import * as i3 from '@angular/forms';
4import { FormsModule } from '@angular/forms';
5import * as i2 from '@angular/common';
6import { CommonModule } from '@angular/common';
7import { DomHandler } from 'primeng/dom';
8import { Subject } from 'rxjs';
9
10class TerminalService {
11 constructor() {
12 this.commandSource = new Subject();
13 this.responseSource = new Subject();
14 this.commandHandler = this.commandSource.asObservable();
15 this.responseHandler = this.responseSource.asObservable();
16 }
17 sendCommand(command) {
18 if (command) {
19 this.commandSource.next(command);
20 }
21 }
22 sendResponse(response) {
23 if (response) {
24 this.responseSource.next(response);
25 }
26 }
27}
28TerminalService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TerminalService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
29TerminalService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TerminalService });
30i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TerminalService, decorators: [{
31 type: Injectable
32 }] });
33
34class Terminal {
35 constructor(el, terminalService, cd) {
36 this.el = el;
37 this.terminalService = terminalService;
38 this.cd = cd;
39 this.commands = [];
40 this.subscription = terminalService.responseHandler.subscribe(response => {
41 this.commands[this.commands.length - 1].response = response;
42 this.commandProcessed = true;
43 });
44 }
45 ngAfterViewInit() {
46 this.container = DomHandler.find(this.el.nativeElement, '.p-terminal')[0];
47 }
48 ngAfterViewChecked() {
49 if (this.commandProcessed) {
50 this.container.scrollTop = this.container.scrollHeight;
51 this.commandProcessed = false;
52 }
53 }
54 set response(value) {
55 if (value) {
56 this.commands[this.commands.length - 1].response = value;
57 this.commandProcessed = true;
58 }
59 }
60 handleCommand(event) {
61 if (event.keyCode == 13) {
62 this.commands.push({ text: this.command });
63 this.terminalService.sendCommand(this.command);
64 this.command = '';
65 }
66 }
67 focus(element) {
68 element.focus();
69 }
70 ngOnDestroy() {
71 if (this.subscription) {
72 this.subscription.unsubscribe();
73 }
74 }
75}
76Terminal.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Terminal, deps: [{ token: i0.ElementRef }, { token: TerminalService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
77Terminal.ɵ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: `
78 <div [ngClass]="'p-terminal p-component'" [ngStyle]="style" [class]="styleClass" (click)="focus(in)">
79 <div *ngIf="welcomeMessage">{{welcomeMessage}}</div>
80 <div class="p-terminal-content">
81 <div *ngFor="let command of commands">
82 <span class="p-terminal-prompt">{{prompt}}</span>
83 <span class="p-terminal-command">{{command.text}}</span>
84 <div class="p-terminal-response">{{command.response}}</div>
85 </div>
86 </div>
87 <div class="p-terminal-prompt-container">
88 <span class="p-terminal-content-prompt">{{prompt}}</span>
89 <input #in type="text" [(ngModel)]="command" class="p-terminal-input" autocomplete="off" (keydown)="handleCommand($event)" autofocus>
90 </div>
91 </div>
92 `, 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 });
93i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Terminal, decorators: [{
94 type: Component,
95 args: [{ selector: 'p-terminal', template: `
96 <div [ngClass]="'p-terminal p-component'" [ngStyle]="style" [class]="styleClass" (click)="focus(in)">
97 <div *ngIf="welcomeMessage">{{welcomeMessage}}</div>
98 <div class="p-terminal-content">
99 <div *ngFor="let command of commands">
100 <span class="p-terminal-prompt">{{prompt}}</span>
101 <span class="p-terminal-command">{{command.text}}</span>
102 <div class="p-terminal-response">{{command.response}}</div>
103 </div>
104 </div>
105 <div class="p-terminal-prompt-container">
106 <span class="p-terminal-content-prompt">{{prompt}}</span>
107 <input #in type="text" [(ngModel)]="command" class="p-terminal-input" autocomplete="off" (keydown)="handleCommand($event)" autofocus>
108 </div>
109 </div>
110 `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
111 'class': 'p-element'
112 }, 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"] }]
113 }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: TerminalService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { welcomeMessage: [{
114 type: Input
115 }], prompt: [{
116 type: Input
117 }], style: [{
118 type: Input
119 }], styleClass: [{
120 type: Input
121 }], response: [{
122 type: Input
123 }] } });
124class TerminalModule {
125}
126TerminalModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TerminalModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
127TerminalModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TerminalModule, declarations: [Terminal], imports: [CommonModule, FormsModule], exports: [Terminal] });
128TerminalModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TerminalModule, imports: [[CommonModule, FormsModule]] });
129i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TerminalModule, decorators: [{
130 type: NgModule,
131 args: [{
132 imports: [CommonModule, FormsModule],
133 exports: [Terminal],
134 declarations: [Terminal]
135 }]
136 }] });
137
138/**
139 * Generated bundle index. Do not edit.
140 */
141
142export { Terminal, TerminalModule, TerminalService };
Note: See TracBrowser for help on using the repository browser.