Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"ngx-clipboard": "^14.0.1",
"ngx-perfect-scrollbar": "^10.1.1",
"rxjs": "~6.6.0",
"simple-keyboard": "^3.3.22",
"tslib": "^2.1.0",
"zone.js": "~0.11.4"
},
Expand Down
4 changes: 4 additions & 0 deletions src/renderer/app/layout/layout.routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ const LAYOUT_ROUTES: Routes = [
{
path: 'progressbar',
loadChildren: () => import('../pages/component/progressbar/progressbar.module').then(m => m.ProgressbarComponentModule)
},
{
path: 'keyboard',
loadChildren: () => import('../pages/component/keyboard/keyboard.module').then(m => m.KeyboardModule)
}
]
},
Expand Down
3 changes: 3 additions & 0 deletions src/renderer/app/layout/navigation/navigation.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
<li routerLinkActive="navigation__active">
<a [routerLink]="['/component/progressbar']"><i class="fa fa-pagelines"></i> Progressbar</a>
</li>
<li routerLinkActive="navigation__active">
<a [routerLink]="['/component/keyboard']"><i class="fa fa-keyboard-o"></i> Keyboard</a>
</li>
</ul>
</li>
<li routerLinkActive="navigation__sub--active" class="navigation__sub">
Expand Down
19 changes: 19 additions & 0 deletions src/renderer/app/pages/component/keyboard/keyboard.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<section class="content--row">
<header class="content__title">
<h1>Keyboard</h1>
<small>This template is built using <code>simple-keyboard</code> and provides some usage examples</small>
</header>
<div class="card-demo">
<div class="card">
<div class="card-body">
<h4 class="card-title">Keyboard</h4>
<div class="form-group">
<input type="text" class="form-control form-control-lg" (input)="onInputChange($event)" value="{{value}}"
placeholder="Tap on the virtual keyboard to start">
<i class="form-group__bar"></i>
</div>
<div class="simple-keyboard"></div>
</div>
</div>
</div>
</section>
48 changes: 48 additions & 0 deletions src/renderer/app/pages/component/keyboard/keyboard.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import Keyboard from 'simple-keyboard';

@Component({
selector: 'app-root',
encapsulation: ViewEncapsulation.None,
templateUrl: './keyboard.component.html',
styleUrls: [
'../../../../../../node_modules/simple-keyboard/build/css/index.css'
]
})
export class KeyboardComponent implements OnInit {
value = '';
keyboard: Keyboard;

constructor() {
}

ngOnInit(): void {
}

// eslint-disable-next-line @angular-eslint/use-lifecycle-interface
ngAfterViewInit() {
this.keyboard = new Keyboard({
onChange: input => this.onChange(input),
onKeyPress: button => this.onKeyPress(button)
});
}

onChange = (input: string) => {
this.value = input;
};
onKeyPress = (button: string) => {
if (button === '{shift}' || button === '{lock}') {
this.handleShift();
}
};
onInputChange = (event: any) => {
this.keyboard.setInput(event.target.value);
};
handleShift = () => {
const currentLayout = this.keyboard.options.layoutName;
const shiftToggle = currentLayout === 'default' ? 'shift' : 'default';
this.keyboard.setOptions({
layoutName: shiftToggle
});
};
}
21 changes: 21 additions & 0 deletions src/renderer/app/pages/component/keyboard/keyboard.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { NgModule } from '@angular/core';
import { KeyboardComponent } from '@renderer/app/pages/component/keyboard/keyboard.component';
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';

const KEYBOARD_ROUTES = [
{path: '', component: KeyboardComponent}
];

@NgModule({
declarations: [
KeyboardComponent
],
imports: [
CommonModule,
RouterModule.forChild(KEYBOARD_ROUTES)
],
providers: []
})
export class KeyboardModule {
}
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8942,6 +8942,11 @@ signal-exit@^3.0.0, signal-exit@^3.0.2, signal-exit@^3.0.3:
resolved "https://registry.npm.taobao.org/signal-exit/download/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c"
integrity sha1-oUEMLt2PB3sItOJTyOrPyvBXRhw=

simple-keyboard@^3.3.22:
version "3.3.22"
resolved "https://registry.yarnpkg.com/simple-keyboard/-/simple-keyboard-3.3.22.tgz#33aab849cc15779b9ea174d7a75a178471929d89"
integrity sha512-dXuqORS0XbmkzAIB9lRhyDq3lbq3FManY6RgBKteC6sCirvNLT5TgMSX0v4eDLxBaBRbE/J5nV1ixQgFpzuNsw==

slash@^3.0.0:
version "3.0.0"
resolved "https://registry.npm.taobao.org/slash/download/slash-3.0.0.tgz?cache=0&sync_timestamp=1618384496016&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fslash%2Fdownload%2Fslash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634"
Expand Down