UNPKG

primeng

Version:

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![npm version](https://badge.fury.io/js/primeng.svg)](https://badge.fury.io/js/primeng) [![Build Status](https://travis-ci.org/primefaces/primeng.

2 lines 4.04 kB
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@angular/core"),require("@angular/forms"),require("@angular/common"),require("primeng/dom"),require("rxjs")):"function"==typeof define&&define.amd?define("primeng/terminal",["exports","@angular/core","@angular/forms","@angular/common","primeng/dom","rxjs"],n):n(((e=e||self).primeng=e.primeng||{},e.primeng.terminal={}),e.ng.core,e.ng.forms,e.ng.common,e.primeng.dom,e.rxjs)}(this,(function(e,n,t,o,r,i){"use strict";var s=this&&this.__decorate||function(e,n,t,o){var r,i=arguments.length,s=i<3?n:null===o?o=Object.getOwnPropertyDescriptor(n,t):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,n,t,o);else for(var c=e.length-1;c>=0;c--)(r=e[c])&&(s=(i<3?r(s):i>3?r(n,t,s):r(n,t))||s);return i>3&&s&&Object.defineProperty(n,t,s),s},c=function(){function e(){this.commandSource=new i.Subject,this.responseSource=new i.Subject,this.commandHandler=this.commandSource.asObservable(),this.responseHandler=this.responseSource.asObservable()}return e.prototype.sendCommand=function(e){e&&this.commandSource.next(e)},e.prototype.sendResponse=function(e){e&&this.responseSource.next(e)},e=s([n.Injectable()],e)}(),a=this&&this.__decorate||function(e,n,t,o){var r,i=arguments.length,s=i<3?n:null===o?o=Object.getOwnPropertyDescriptor(n,t):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,n,t,o);else for(var c=e.length-1;c>=0;c--)(r=e[c])&&(s=(i<3?r(s):i>3?r(n,t,s):r(n,t))||s);return i>3&&s&&Object.defineProperty(n,t,s),s},m=function(){function e(e,n){var t=this;this.el=e,this.terminalService=n,this.commands=[],this.subscription=n.responseHandler.subscribe((function(e){t.commands[t.commands.length-1].response=e,t.commandProcessed=!0}))}return e.prototype.ngAfterViewInit=function(){this.container=r.DomHandler.find(this.el.nativeElement,".ui-terminal")[0]},e.prototype.ngAfterViewChecked=function(){this.commandProcessed&&(this.container.scrollTop=this.container.scrollHeight,this.commandProcessed=!1)},Object.defineProperty(e.prototype,"response",{set:function(e){e&&(this.commands[this.commands.length-1].response=e,this.commandProcessed=!0)},enumerable:!0,configurable:!0}),e.prototype.handleCommand=function(e){13==e.keyCode&&(this.commands.push({text:this.command}),this.terminalService.sendCommand(this.command),this.command="")},e.prototype.focus=function(e){e.focus()},e.prototype.ngOnDestroy=function(){this.subscription&&this.subscription.unsubscribe()},e.ctorParameters=function(){return[{type:n.ElementRef},{type:c}]},a([n.Input()],e.prototype,"welcomeMessage",void 0),a([n.Input()],e.prototype,"prompt",void 0),a([n.Input()],e.prototype,"style",void 0),a([n.Input()],e.prototype,"styleClass",void 0),a([n.Input()],e.prototype,"response",null),e=a([n.Component({selector:"p-terminal",template:'\n <div [ngClass]="\'ui-terminal ui-widget ui-widget-content ui-corner-all\'" [ngStyle]="style" [class]="styleClass" (click)="focus(in)">\n <div *ngIf="welcomeMessage">{{welcomeMessage}}</div>\n <div class="ui-terminal-content">\n <div *ngFor="let command of commands">\n <span>{{prompt}}</span>\n <span class="ui-terminal-command">{{command.text}}</span>\n <div>{{command.response}}</div>\n </div>\n </div>\n <div>\n <span class="ui-terminal-content-prompt">{{prompt}}</span>\n <input #in type="text" [(ngModel)]="command" class="ui-terminal-input" autocomplete="off" (keydown)="handleCommand($event)" autofocus>\n </div>\n </div>\n ',changeDetection:n.ChangeDetectionStrategy.Default})],e)}(),p=function(){function e(){}return e=a([n.NgModule({imports:[o.CommonModule,t.FormsModule],exports:[m],declarations:[m]})],e)}();e.Terminal=m,e.TerminalModule=p,e.TerminalService=c,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=primeng-terminal.umd.min.js.map