systelab-virtual-keyboard 19.0.0 → 20.1.0
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/README.md +11 -0
- package/fesm2022/systelab-virtual-keyboard.mjs +197 -117
- package/fesm2022/systelab-virtual-keyboard.mjs.map +1 -1
- package/index.d.ts +182 -6
- package/index.d.ts.map +1 -0
- package/package.json +6 -8
- package/scss/default-theme.scss +102 -0
- package/esm2022/lib/constants.mjs +0 -37
- package/esm2022/lib/systelab-virtual-keyboard-overlay.service.mjs +0 -177
- package/esm2022/lib/systelab-virtual-keyboard.component.mjs +0 -375
- package/esm2022/lib/systelab-virtual-keyboard.config.mjs +0 -3
- package/esm2022/lib/systelab-virtual-keyboard.directive.mjs +0 -215
- package/esm2022/lib/systelab-virtual-keyboard.module.mjs +0 -45
- package/esm2022/public-api.mjs +0 -7
- package/esm2022/systelab-virtual-keyboard.mjs +0 -5
- package/lib/constants.d.ts +0 -25
- package/lib/constants.d.ts.map +0 -1
- package/lib/systelab-virtual-keyboard-overlay.service.d.ts +0 -38
- package/lib/systelab-virtual-keyboard-overlay.service.d.ts.map +0 -1
- package/lib/systelab-virtual-keyboard.component.d.ts +0 -43
- package/lib/systelab-virtual-keyboard.component.d.ts.map +0 -1
- package/lib/systelab-virtual-keyboard.config.d.ts +0 -10
- package/lib/systelab-virtual-keyboard.config.d.ts.map +0 -1
- package/lib/systelab-virtual-keyboard.directive.d.ts +0 -44
- package/lib/systelab-virtual-keyboard.directive.d.ts.map +0 -1
- package/lib/systelab-virtual-keyboard.module.d.ts +0 -15
- package/lib/systelab-virtual-keyboard.module.d.ts.map +0 -1
- package/public-api.d.ts +0 -5
- package/public-api.d.ts.map +0 -1
- package/systelab-virtual-keyboard.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -43,3 +43,14 @@ The configuration params are describe into the interface [SystelabVirtualKeyboar
|
|
|
43
43
|
| inputMethod | SystelabVirtualKeyboardInputMethods | | The method detected for the keyboard to click or touch the keys
|
|
44
44
|
| showButton | boolean | false | Show or hide the button for showing the keyboard
|
|
45
45
|
| showOnMouseClick | boolean | false | Shows virtual keyboard upon mouse click on input field
|
|
46
|
+
|
|
47
|
+
### Styling variables
|
|
48
|
+
|
|
49
|
+
| Name | Default | Description |
|
|
50
|
+
|-----------|:----:|-------------------------------------------|
|
|
51
|
+
| --systelab-virtual-keyboard-font-family | 'SF Mono', 'Menlo', 'Consolas', 'Courier New', monospace | Font family fonts to use
|
|
52
|
+
| --systelab-virtual-keyboard-background-color | #B2B2B2 | Background of the keyboard
|
|
53
|
+
| --systelab-virtual-keyboard-button-color | #E5E5E5 | Normal button background color
|
|
54
|
+
| --systelab-virtual-keyboard-button-font-color | #000000 | Normal button font color
|
|
55
|
+
| --systelab-virtual-keyboard-active-special-button-color | #4D4D4D | Special buttons activation background color
|
|
56
|
+
| --systelab-virtual-keyboard-active-special-button-font-color | #FFFFFF | Special buttons activation font color
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, EventEmitter, Output, HostListener, Optional, Inject, Component, Injectable, Input, Directive, NgModule } from '@angular/core';
|
|
3
|
-
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
2
|
+
import { InjectionToken, EventEmitter, Output, HostListener, Optional, Inject, Component, Injectable, DOCUMENT, Input, Directive, NgModule } from '@angular/core';
|
|
4
3
|
import { ComponentPortal } from '@angular/cdk/portal';
|
|
5
4
|
import { SimpleKeyboard } from 'simple-keyboard';
|
|
6
5
|
import * as i1 from '@angular/cdk/overlay';
|
|
7
6
|
import { OverlayModule } from '@angular/cdk/overlay';
|
|
7
|
+
import { CommonModule } from '@angular/common';
|
|
8
8
|
|
|
9
9
|
/*
|
|
10
10
|
* Copyright (c) 2020 - 2024 - Instrumentation Laboratory Company and Systelab Technologies, SA. All rights reserved.
|
|
@@ -14,34 +14,80 @@ import { OverlayModule } from '@angular/cdk/overlay';
|
|
|
14
14
|
* are protected by trade secret or copyright law. Dissemination of this information or reproduction of this material is
|
|
15
15
|
* strictly forbidden unless prior written permission is Instrumentation Laboratory Company.
|
|
16
16
|
*/
|
|
17
|
-
var
|
|
18
|
-
(function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
17
|
+
var SystelabVirtualKeyboardConstants;
|
|
18
|
+
(function (SystelabVirtualKeyboardConstants) {
|
|
19
|
+
let Layouts;
|
|
20
|
+
(function (Layouts) {
|
|
21
|
+
Layouts["Default"] = "default";
|
|
22
|
+
Layouts["AlphaNumeric"] = "alpha-numeric";
|
|
23
|
+
Layouts["AlphaNumericShift"] = "alpha-numeric-shift";
|
|
24
|
+
Layouts["AlphaNumericUppercase"] = "alpha-numeric-uppercase";
|
|
25
|
+
Layouts["AlphaNumericUppercaseShift"] = "alpha-numeric-uppercase-shift";
|
|
26
|
+
Layouts["Numeric"] = "numeric";
|
|
27
|
+
Layouts["NumericShift"] = "numeric-shift";
|
|
28
|
+
})(Layouts = SystelabVirtualKeyboardConstants.Layouts || (SystelabVirtualKeyboardConstants.Layouts = {}));
|
|
29
|
+
SystelabVirtualKeyboardConstants.LayoutDefinitions = {
|
|
30
|
+
[SystelabVirtualKeyboardConstants.Layouts.Default]: [
|
|
31
|
+
'` 1 2 3 4 5 6 7 8 9 0 - = {bksp}',
|
|
32
|
+
'{tab} q w e r t y u i o p { } |',
|
|
33
|
+
'{lock} a s d f g h j k l : " {enter}',
|
|
34
|
+
'{shift} z x c v b n m < > ? {shift}',
|
|
35
|
+
'{space}',
|
|
36
|
+
],
|
|
37
|
+
[SystelabVirtualKeyboardConstants.Layouts.AlphaNumeric]: [
|
|
38
|
+
'` 1 2 3 4 5 6 7 8 9 0 - = {bksp}',
|
|
39
|
+
'{tab} q w e r t y u i o p { } |',
|
|
40
|
+
'{lock} a s d f g h j k l : " {enter}',
|
|
41
|
+
'{shift} z x c v b n m < > ? {shift}',
|
|
42
|
+
'{space}',
|
|
43
|
+
],
|
|
44
|
+
[SystelabVirtualKeyboardConstants.Layouts.AlphaNumericShift]: [
|
|
45
|
+
'~ ! @ # $ % ^ & * ( ) _ + {bksp}',
|
|
46
|
+
'{tab} Q W E R T Y U I O P [ ] \\',
|
|
47
|
+
"{lock} A S D F G H J K L ; ' {enter}",
|
|
48
|
+
'{shift} Z X C V B N M , . / {shift}',
|
|
49
|
+
'{space}',
|
|
50
|
+
],
|
|
51
|
+
[SystelabVirtualKeyboardConstants.Layouts.AlphaNumericUppercase]: [
|
|
52
|
+
'` 1 2 3 4 5 6 7 8 9 0 - = {bksp}',
|
|
53
|
+
'{tab} Q W E R T Y U I O P [ ] \\',
|
|
54
|
+
"{lock} A S D F G H J K L ; ' {enter}",
|
|
55
|
+
'{shift} Z X C V B N M , . / {shift}',
|
|
56
|
+
'{space}',
|
|
57
|
+
],
|
|
58
|
+
[SystelabVirtualKeyboardConstants.Layouts.AlphaNumericUppercaseShift]: [
|
|
59
|
+
'~ ! @ # $ % ^ & * ( ) _ + {bksp}',
|
|
60
|
+
'{tab} Q W E R T Y U I O P [ ] \\',
|
|
61
|
+
"{lock} A S D F G H J K L ; ' {enter}",
|
|
62
|
+
'{shift} Z X C V B N M , . / {shift}',
|
|
63
|
+
'{space}',
|
|
64
|
+
],
|
|
65
|
+
[SystelabVirtualKeyboardConstants.Layouts.Numeric]: ['7 8 9 {bksp}', '4 5 6 +', '1 2 3 -', '{shift} 0 . {enter}'],
|
|
66
|
+
[SystelabVirtualKeyboardConstants.Layouts.NumericShift]: ['! @ # {bksp}', '$ % _ =', '& * ( -', '{shift} ) . {enter}'],
|
|
67
|
+
};
|
|
68
|
+
let Button;
|
|
69
|
+
(function (Button) {
|
|
70
|
+
Button["Done"] = "{done}";
|
|
71
|
+
Button["Enter"] = "{enter}";
|
|
72
|
+
Button["Shift"] = "{shift}";
|
|
73
|
+
Button["Lock"] = "{lock}";
|
|
74
|
+
Button["Backspace"] = "{bksp}";
|
|
75
|
+
Button["Language"] = "{language}";
|
|
76
|
+
Button["Space"] = "{space}";
|
|
77
|
+
Button["Tab"] = "{tab}";
|
|
78
|
+
})(Button = SystelabVirtualKeyboardConstants.Button || (SystelabVirtualKeyboardConstants.Button = {}));
|
|
79
|
+
let InputMethods;
|
|
80
|
+
(function (InputMethods) {
|
|
81
|
+
InputMethods["onlyMouseEvents"] = "onlyMouseEvents";
|
|
82
|
+
InputMethods["onlyTouchEvents"] = "onlyTouchEvents";
|
|
83
|
+
})(InputMethods = SystelabVirtualKeyboardConstants.InputMethods || (SystelabVirtualKeyboardConstants.InputMethods = {}));
|
|
84
|
+
let InputModes;
|
|
85
|
+
(function (InputModes) {
|
|
86
|
+
InputModes["text"] = "text";
|
|
87
|
+
InputModes["numeric"] = "numeric";
|
|
88
|
+
InputModes["password"] = "password";
|
|
89
|
+
})(InputModes = SystelabVirtualKeyboardConstants.InputModes || (SystelabVirtualKeyboardConstants.InputModes = {}));
|
|
90
|
+
})(SystelabVirtualKeyboardConstants || (SystelabVirtualKeyboardConstants = {}));
|
|
45
91
|
|
|
46
92
|
const VIRTUAL_KEYBOARD_CONFIG = new InjectionToken('VIRTUAL_KEYBOARD_CONFIG');
|
|
47
93
|
|
|
@@ -64,36 +110,18 @@ class SystelabVirtualKeyboardComponent {
|
|
|
64
110
|
this.elementRef = elementRef;
|
|
65
111
|
this.virtualKeyboardConfig = virtualKeyboardConfig;
|
|
66
112
|
this.debug = false;
|
|
67
|
-
this.selectedLayout =
|
|
113
|
+
this.selectedLayout = SystelabVirtualKeyboardConstants.Layouts.Default;
|
|
68
114
|
this.caretPosition = null;
|
|
69
115
|
this.caretPositionEnd = null;
|
|
70
116
|
this.shiftPressed = false;
|
|
117
|
+
this.capsLockOn = false;
|
|
71
118
|
this.closePanel = new EventEmitter();
|
|
72
119
|
}
|
|
73
120
|
ngAfterViewInit() {
|
|
74
|
-
const layout = {
|
|
75
|
-
[SystelabVirtualKeyboardLayouts.default]: [
|
|
76
|
-
'` 1 2 3 4 5 6 7 8 9 0 - = {bksp}',
|
|
77
|
-
'{tab} q w e r t y u i o p [ ] \\',
|
|
78
|
-
"{lock} a s d f g h j k l ; ' {enter}",
|
|
79
|
-
'{shift} z x c v b n m , . / {shift}',
|
|
80
|
-
'{space}',
|
|
81
|
-
],
|
|
82
|
-
[SystelabVirtualKeyboardLayouts.shift]: [
|
|
83
|
-
'~ ! @ # $ % ^ & * ( ) _ + {bksp}',
|
|
84
|
-
'{tab} Q W E R T Y U I O P { } |',
|
|
85
|
-
'{lock} A S D F G H J K L : " {enter}',
|
|
86
|
-
'{shift} Z X C V B N M < > ? {shift}',
|
|
87
|
-
'{space}',
|
|
88
|
-
],
|
|
89
|
-
[SystelabVirtualKeyboardLayouts.numeric]: ['7 8 9', '4 5 6', '1 2 3', '0 {bksp}'],
|
|
90
|
-
};
|
|
91
121
|
const keyboardOptions = this.prepareKeyboardConfig();
|
|
92
122
|
this.keyboard = new SimpleKeyboard('.simple-keyboard', keyboardOptions);
|
|
123
|
+
this.setButtonClasses();
|
|
93
124
|
this.setLayout(this.selectedLayout);
|
|
94
|
-
if (this.debug) {
|
|
95
|
-
console.log('Layout: ', layout);
|
|
96
|
-
}
|
|
97
125
|
}
|
|
98
126
|
setActiveInput(input) {
|
|
99
127
|
this.activeInputElement = input;
|
|
@@ -117,46 +145,26 @@ class SystelabVirtualKeyboardComponent {
|
|
|
117
145
|
}
|
|
118
146
|
}
|
|
119
147
|
prepareKeyboardConfig() {
|
|
120
|
-
const layout = {
|
|
121
|
-
[SystelabVirtualKeyboardLayouts.default]: [
|
|
122
|
-
'` 1 2 3 4 5 6 7 8 9 0 - = {bksp}',
|
|
123
|
-
'{tab} q w e r t y u i o p [ ] \\',
|
|
124
|
-
"{lock} a s d f g h j k l ; ' {enter}",
|
|
125
|
-
'{shift} z x c v b n m , . / {shift}',
|
|
126
|
-
'{space}',
|
|
127
|
-
],
|
|
128
|
-
[SystelabVirtualKeyboardLayouts.shift]: [
|
|
129
|
-
'~ ! @ # $ % ^ & * ( ) _ + {bksp}',
|
|
130
|
-
'{tab} Q W E R T Y U I O P { } |',
|
|
131
|
-
'{lock} A S D F G H J K L : " {enter}',
|
|
132
|
-
'{shift} Z X C V B N M < > ? {shift}',
|
|
133
|
-
'{space}',
|
|
134
|
-
],
|
|
135
|
-
[SystelabVirtualKeyboardLayouts.numeric]: ['7 8 9', '4 5 6', '1 2 3', '0 {bksp}'],
|
|
136
|
-
};
|
|
137
148
|
let keyboardOptions = {
|
|
138
149
|
onKeyPress: (button) => this.handleKeyPress(button),
|
|
139
150
|
mergeDisplay: true,
|
|
140
|
-
theme: 'hg-theme-default hg-layout-default
|
|
151
|
+
theme: 'hg-theme-default hg-layout-default systelab-virtual-keyboard-theme',
|
|
141
152
|
display: {
|
|
142
|
-
[
|
|
153
|
+
[SystelabVirtualKeyboardConstants.Button.Backspace]: 'back',
|
|
154
|
+
[SystelabVirtualKeyboardConstants.Button.Enter]: 'enter',
|
|
155
|
+
[SystelabVirtualKeyboardConstants.Button.Lock]: 'lock',
|
|
143
156
|
},
|
|
144
|
-
buttonTheme:
|
|
145
|
-
|
|
146
|
-
class: 'virtual-keyboard-delete-button',
|
|
147
|
-
buttons: `${SystelabVirtualKeyboardButton.Backspace}`,
|
|
148
|
-
},
|
|
149
|
-
],
|
|
150
|
-
layout,
|
|
157
|
+
buttonTheme: this.buildButtonThemes(),
|
|
158
|
+
layout: SystelabVirtualKeyboardConstants.LayoutDefinitions,
|
|
151
159
|
};
|
|
152
160
|
if (this.virtualKeyboardConfig?.hasOwnProperty('inputMethod')) {
|
|
153
|
-
if (this.virtualKeyboardConfig.inputMethod ===
|
|
161
|
+
if (this.virtualKeyboardConfig.inputMethod === SystelabVirtualKeyboardConstants.InputMethods.onlyMouseEvents) {
|
|
154
162
|
keyboardOptions = {
|
|
155
163
|
...keyboardOptions,
|
|
156
164
|
useMouseEvents: true,
|
|
157
165
|
};
|
|
158
166
|
}
|
|
159
|
-
else if (this.virtualKeyboardConfig.inputMethod ===
|
|
167
|
+
else if (this.virtualKeyboardConfig.inputMethod === SystelabVirtualKeyboardConstants.InputMethods.onlyTouchEvents) {
|
|
160
168
|
keyboardOptions = {
|
|
161
169
|
...keyboardOptions,
|
|
162
170
|
useTouchEvents: true,
|
|
@@ -165,6 +173,25 @@ class SystelabVirtualKeyboardComponent {
|
|
|
165
173
|
}
|
|
166
174
|
return keyboardOptions;
|
|
167
175
|
}
|
|
176
|
+
buildButtonThemes() {
|
|
177
|
+
return [
|
|
178
|
+
{
|
|
179
|
+
class: 'virtual-keyboard-delete-button',
|
|
180
|
+
buttons: `${SystelabVirtualKeyboardConstants.Button.Backspace}`,
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
class: 'virtual-keyboard-enter-button',
|
|
184
|
+
buttons: `${SystelabVirtualKeyboardConstants.Button.Enter}`,
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
class: 'virtual-keyboard-function-button',
|
|
188
|
+
buttons: `${SystelabVirtualKeyboardConstants.Button.Shift} ${SystelabVirtualKeyboardConstants.Button.Lock}`,
|
|
189
|
+
}
|
|
190
|
+
];
|
|
191
|
+
}
|
|
192
|
+
setButtonClasses() {
|
|
193
|
+
this.keyboard.addButtonTheme(SystelabVirtualKeyboardConstants.Button.Shift, 'virtual-keyboard-shift-button');
|
|
194
|
+
}
|
|
168
195
|
handleKeyPress(button, e) {
|
|
169
196
|
if (this.debug) {
|
|
170
197
|
console.log('Key press:', button);
|
|
@@ -172,11 +199,31 @@ class SystelabVirtualKeyboardComponent {
|
|
|
172
199
|
if (button[0] === '&' && button.length > 1) {
|
|
173
200
|
button = new DOMParser().parseFromString(button, 'text/html').body.textContent;
|
|
174
201
|
}
|
|
175
|
-
if (button ===
|
|
176
|
-
this.shiftPressed =
|
|
202
|
+
if (button === SystelabVirtualKeyboardConstants.Button.Shift) {
|
|
203
|
+
this.shiftPressed = !this.shiftPressed;
|
|
204
|
+
this.toggleShiftLayout();
|
|
205
|
+
if (this.shiftPressed) {
|
|
206
|
+
this.keyboard.addButtonTheme(SystelabVirtualKeyboardConstants.Button.Shift, 'virtual-keyboard-shift-active');
|
|
207
|
+
this.addUppercaseClass();
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
this.keyboard.removeButtonTheme(SystelabVirtualKeyboardConstants.Button.Shift, 'virtual-keyboard-shift-active');
|
|
211
|
+
this.removeUppercaseClass();
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
else if (button === SystelabVirtualKeyboardConstants.Button.Lock) {
|
|
215
|
+
this.capsLockOn = !this.capsLockOn;
|
|
177
216
|
this.toggleShiftLayout();
|
|
217
|
+
if (this.capsLockOn) {
|
|
218
|
+
this.keyboard.addButtonTheme(SystelabVirtualKeyboardConstants.Button.Lock, 'virtual-keyboard-lock-active');
|
|
219
|
+
this.addUppercaseClass();
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
this.keyboard.removeButtonTheme(SystelabVirtualKeyboardConstants.Button.Lock, 'virtual-keyboard-lock-active');
|
|
223
|
+
this.removeUppercaseClass();
|
|
224
|
+
}
|
|
178
225
|
}
|
|
179
|
-
else if (button ===
|
|
226
|
+
else if (button === SystelabVirtualKeyboardConstants.Button.Done) {
|
|
180
227
|
this.closePanel.emit();
|
|
181
228
|
return;
|
|
182
229
|
}
|
|
@@ -193,23 +240,39 @@ class SystelabVirtualKeyboardComponent {
|
|
|
193
240
|
this.dispatchEvents(button);
|
|
194
241
|
if (this.shiftPressed) {
|
|
195
242
|
this.toggleShiftLayout();
|
|
243
|
+
this.removeUppercaseClass();
|
|
196
244
|
}
|
|
197
|
-
this.shiftPressed =
|
|
245
|
+
this.shiftPressed = false;
|
|
246
|
+
this.keyboard.removeButtonTheme(SystelabVirtualKeyboardConstants.Button.Shift, 'virtual-keyboard-shift-active');
|
|
247
|
+
}
|
|
248
|
+
addUppercaseClass() {
|
|
249
|
+
this.keyboard.addButtonTheme(SystelabVirtualKeyboardConstants.Button.Shift, 'virtual-keyboard-uppercase');
|
|
250
|
+
this.keyboard.addButtonTheme(SystelabVirtualKeyboardConstants.Button.Lock, 'virtual-keyboard-uppercase');
|
|
251
|
+
this.keyboard.addButtonTheme(SystelabVirtualKeyboardConstants.Button.Tab, 'virtual-keyboard-uppercase');
|
|
252
|
+
this.keyboard.addButtonTheme(SystelabVirtualKeyboardConstants.Button.Backspace, 'virtual-keyboard-uppercase');
|
|
253
|
+
this.keyboard.addButtonTheme(SystelabVirtualKeyboardConstants.Button.Enter, 'virtual-keyboard-uppercase');
|
|
254
|
+
}
|
|
255
|
+
removeUppercaseClass() {
|
|
256
|
+
this.keyboard.removeButtonTheme(SystelabVirtualKeyboardConstants.Button.Shift, 'virtual-keyboard-uppercase');
|
|
257
|
+
this.keyboard.removeButtonTheme(SystelabVirtualKeyboardConstants.Button.Lock, 'virtual-keyboard-uppercase');
|
|
258
|
+
this.keyboard.removeButtonTheme(SystelabVirtualKeyboardConstants.Button.Tab, 'virtual-keyboard-uppercase');
|
|
259
|
+
this.keyboard.removeButtonTheme(SystelabVirtualKeyboardConstants.Button.Backspace, 'virtual-keyboard-uppercase');
|
|
260
|
+
this.keyboard.removeButtonTheme(SystelabVirtualKeyboardConstants.Button.Enter, 'virtual-keyboard-uppercase');
|
|
198
261
|
}
|
|
199
262
|
handleButtonOutput(button) {
|
|
200
263
|
const commonParams = this.getCommonParams();
|
|
201
264
|
let output = this.activeInputElement?.value || '';
|
|
202
265
|
if (!this.isStandardButton(button)) {
|
|
203
|
-
if (button ===
|
|
266
|
+
if (button === SystelabVirtualKeyboardConstants.Button.Backspace) {
|
|
204
267
|
output = this.removeAt(output, ...commonParams);
|
|
205
268
|
}
|
|
206
|
-
else if (button ===
|
|
269
|
+
else if (button === SystelabVirtualKeyboardConstants.Button.Space) {
|
|
207
270
|
output = this.addStringAt(output, ' ', ...commonParams);
|
|
208
271
|
}
|
|
209
|
-
else if (button ===
|
|
272
|
+
else if (button === SystelabVirtualKeyboardConstants.Button.Tab) {
|
|
210
273
|
// Do nothing for tab
|
|
211
274
|
}
|
|
212
|
-
else if (button ===
|
|
275
|
+
else if (button === SystelabVirtualKeyboardConstants.Button.Enter) {
|
|
213
276
|
if (this.isTextarea) {
|
|
214
277
|
output = this.addStringAt(output, '\n', ...commonParams);
|
|
215
278
|
}
|
|
@@ -228,10 +291,10 @@ class SystelabVirtualKeyboardComponent {
|
|
|
228
291
|
}
|
|
229
292
|
isAcceptedNonStandardButton(button) {
|
|
230
293
|
return [
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
294
|
+
SystelabVirtualKeyboardConstants.Button.Backspace.toString(),
|
|
295
|
+
SystelabVirtualKeyboardConstants.Button.Space.toString(),
|
|
296
|
+
SystelabVirtualKeyboardConstants.Button.Tab.toString(),
|
|
297
|
+
SystelabVirtualKeyboardConstants.Button.Enter.toString(),
|
|
235
298
|
].includes(button);
|
|
236
299
|
}
|
|
237
300
|
dispatchEvents(button) {
|
|
@@ -239,7 +302,7 @@ class SystelabVirtualKeyboardComponent {
|
|
|
239
302
|
const eventInit = {
|
|
240
303
|
bubbles: true,
|
|
241
304
|
cancelable: true,
|
|
242
|
-
shiftKey: this.selectedLayout ===
|
|
305
|
+
shiftKey: this.selectedLayout === SystelabVirtualKeyboardConstants.Layouts.AlphaNumericShift,
|
|
243
306
|
key: key,
|
|
244
307
|
code: code,
|
|
245
308
|
location: 0,
|
|
@@ -262,7 +325,7 @@ class SystelabVirtualKeyboardComponent {
|
|
|
262
325
|
key = key.charAt(0).toUpperCase() + key.slice(1);
|
|
263
326
|
code = key;
|
|
264
327
|
// Fix to standard key code
|
|
265
|
-
if (code.toLowerCase() ===
|
|
328
|
+
if (code.toLowerCase() === SystelabVirtualKeyboardConstants.Button.Backspace.slice(1, SystelabVirtualKeyboardConstants.Button.Backspace.length - 1).toLowerCase()) {
|
|
266
329
|
code = 'Backspace';
|
|
267
330
|
}
|
|
268
331
|
}
|
|
@@ -274,8 +337,25 @@ class SystelabVirtualKeyboardComponent {
|
|
|
274
337
|
}
|
|
275
338
|
toggleShiftLayout() {
|
|
276
339
|
const currentLayout = this.keyboard.options.layoutName;
|
|
277
|
-
|
|
278
|
-
|
|
340
|
+
let selectedLayout;
|
|
341
|
+
switch (currentLayout) {
|
|
342
|
+
case SystelabVirtualKeyboardConstants.Layouts.AlphaNumeric:
|
|
343
|
+
case SystelabVirtualKeyboardConstants.Layouts.AlphaNumericShift:
|
|
344
|
+
selectedLayout = currentLayout === SystelabVirtualKeyboardConstants.Layouts.AlphaNumeric ? SystelabVirtualKeyboardConstants.Layouts.AlphaNumericShift : SystelabVirtualKeyboardConstants.Layouts.AlphaNumeric;
|
|
345
|
+
break;
|
|
346
|
+
case SystelabVirtualKeyboardConstants.Layouts.AlphaNumericUppercase:
|
|
347
|
+
case SystelabVirtualKeyboardConstants.Layouts.AlphaNumericUppercaseShift:
|
|
348
|
+
selectedLayout = currentLayout === SystelabVirtualKeyboardConstants.Layouts.AlphaNumericUppercase ? SystelabVirtualKeyboardConstants.Layouts.AlphaNumericUppercaseShift : SystelabVirtualKeyboardConstants.Layouts.AlphaNumericUppercase;
|
|
349
|
+
break;
|
|
350
|
+
case SystelabVirtualKeyboardConstants.Layouts.Numeric:
|
|
351
|
+
case SystelabVirtualKeyboardConstants.Layouts.NumericShift:
|
|
352
|
+
selectedLayout = currentLayout === SystelabVirtualKeyboardConstants.Layouts.Numeric ? SystelabVirtualKeyboardConstants.Layouts.NumericShift : SystelabVirtualKeyboardConstants.Layouts.Numeric;
|
|
353
|
+
break;
|
|
354
|
+
default:
|
|
355
|
+
}
|
|
356
|
+
if (selectedLayout) {
|
|
357
|
+
this.setLayout(selectedLayout);
|
|
358
|
+
}
|
|
279
359
|
}
|
|
280
360
|
isStandardButton(button) {
|
|
281
361
|
return button && !(button[0] === '{' && button[button.length - 1] === '}');
|
|
@@ -391,12 +471,12 @@ class SystelabVirtualKeyboardComponent {
|
|
|
391
471
|
this.caretPosition = position;
|
|
392
472
|
this.caretPositionEnd = endPosition;
|
|
393
473
|
}
|
|
394
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
395
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
474
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: SystelabVirtualKeyboardComponent, deps: [{ token: i0.ElementRef }, { token: VIRTUAL_KEYBOARD_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
475
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.3", type: SystelabVirtualKeyboardComponent, isStandalone: true, selector: "systelab-virtual-keyboard.component", outputs: { closePanel: "closePanel" }, host: { listeners: { "window:keyup": "handleKeyUp($event)", "window:pointerup": "handleMouseUp($event)", "window:mouseup": "handleMouseUp($event)" } }, ngImport: i0, template: "<!--\n ~ Copyright (c) 2020 - 2024 - Instrumentation Laboratory Company and Systelab Technologies, SA. All rights reserved.\n ~ NOTICE: All information contained herein is and remains the property of Instrumentation Laboratory Company and its\n ~ affiliates, if any. The intellectual and technical concepts contained herein are proprietary to Instrumentation\n ~ Laboratory Company and its affiliates and may be covered by U.S. and foreign patents and patent applications, and/or\n ~ are protected by trade secret or copyright law. Dissemination of this information or reproduction of this material is\n ~ strictly forbidden unless prior written permission is Instrumentation Laboratory Company.\n -->\n\n<div class=\"simple-keyboard\"></div>\n" }); }
|
|
396
476
|
}
|
|
397
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
477
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: SystelabVirtualKeyboardComponent, decorators: [{
|
|
398
478
|
type: Component,
|
|
399
|
-
args: [{ selector: 'systelab-virtual-keyboard.component', standalone: true, imports: [], template: "<!--\n ~ Copyright (c) 2020 - 2024 - Instrumentation Laboratory Company and Systelab Technologies, SA. All rights reserved.\n ~ NOTICE: All information contained herein is and remains the property of Instrumentation Laboratory Company and its\n ~ affiliates, if any. The intellectual and technical concepts contained herein are proprietary to Instrumentation\n ~ Laboratory Company and its affiliates and may be covered by U.S. and foreign patents and patent applications, and/or\n ~ are protected by trade secret or copyright law. Dissemination of this information or reproduction of this material is\n ~ strictly forbidden unless prior written permission is Instrumentation Laboratory Company.\n -->\n\n<div class=\"simple-keyboard\"></div>\n"
|
|
479
|
+
args: [{ selector: 'systelab-virtual-keyboard.component', standalone: true, imports: [], template: "<!--\n ~ Copyright (c) 2020 - 2024 - Instrumentation Laboratory Company and Systelab Technologies, SA. All rights reserved.\n ~ NOTICE: All information contained herein is and remains the property of Instrumentation Laboratory Company and its\n ~ affiliates, if any. The intellectual and technical concepts contained herein are proprietary to Instrumentation\n ~ Laboratory Company and its affiliates and may be covered by U.S. and foreign patents and patent applications, and/or\n ~ are protected by trade secret or copyright law. Dissemination of this information or reproduction of this material is\n ~ strictly forbidden unless prior written permission is Instrumentation Laboratory Company.\n -->\n\n<div class=\"simple-keyboard\"></div>\n" }]
|
|
400
480
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: undefined, decorators: [{
|
|
401
481
|
type: Optional
|
|
402
482
|
}, {
|
|
@@ -428,7 +508,7 @@ class SystelabVirtualKeyboardOverlayService {
|
|
|
428
508
|
isOpen() {
|
|
429
509
|
return this.open;
|
|
430
510
|
}
|
|
431
|
-
create(inputOrigin, showKeyboardButtonElement, fixedBottom, layout =
|
|
511
|
+
create(inputOrigin, showKeyboardButtonElement, fixedBottom, layout = SystelabVirtualKeyboardConstants.Layouts.Default) {
|
|
432
512
|
this.inputOrigin = inputOrigin;
|
|
433
513
|
this.fixedBottom = fixedBottom;
|
|
434
514
|
this.showKeyboardButtonElement = showKeyboardButtonElement;
|
|
@@ -550,7 +630,7 @@ class SystelabVirtualKeyboardOverlayService {
|
|
|
550
630
|
]);
|
|
551
631
|
}
|
|
552
632
|
getOverlaySize() {
|
|
553
|
-
const overlayWidth = this.layout ===
|
|
633
|
+
const overlayWidth = this.layout === SystelabVirtualKeyboardConstants.Layouts.Numeric ? '331px' : '1200px';
|
|
554
634
|
return {
|
|
555
635
|
width: overlayWidth,
|
|
556
636
|
maxWidth: overlayWidth,
|
|
@@ -576,10 +656,10 @@ class SystelabVirtualKeyboardOverlayService {
|
|
|
576
656
|
const extraWidth = overlayWidth - inputWidth;
|
|
577
657
|
return Math.abs(extraWidth) / 2;
|
|
578
658
|
}
|
|
579
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
580
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
659
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: SystelabVirtualKeyboardOverlayService, deps: [{ token: i1.Overlay }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
660
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: SystelabVirtualKeyboardOverlayService, providedIn: 'root' }); }
|
|
581
661
|
}
|
|
582
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
662
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: SystelabVirtualKeyboardOverlayService, decorators: [{
|
|
583
663
|
type: Injectable,
|
|
584
664
|
args: [{
|
|
585
665
|
providedIn: 'root',
|
|
@@ -714,22 +794,22 @@ class SystelabVirtualKeyboardDirective {
|
|
|
714
794
|
return this.config.layout;
|
|
715
795
|
}
|
|
716
796
|
if (this.isInputAlphabetic(activeInputElement)) {
|
|
717
|
-
return
|
|
797
|
+
return SystelabVirtualKeyboardConstants.Layouts.AlphaNumeric;
|
|
718
798
|
}
|
|
719
799
|
else if (this.isInputNumeric(activeInputElement)) {
|
|
720
|
-
return
|
|
800
|
+
return SystelabVirtualKeyboardConstants.Layouts.Numeric;
|
|
721
801
|
}
|
|
722
802
|
else {
|
|
723
|
-
return
|
|
803
|
+
return SystelabVirtualKeyboardConstants.Layouts.AlphaNumeric;
|
|
724
804
|
}
|
|
725
805
|
}
|
|
726
806
|
isInputAlphabetic(activeInputElement) {
|
|
727
807
|
const inputMode = this.getInputMode(activeInputElement);
|
|
728
|
-
return inputMode && [
|
|
808
|
+
return inputMode && [SystelabVirtualKeyboardConstants.InputModes.text, SystelabVirtualKeyboardConstants.InputModes.password].some((i) => i === inputMode);
|
|
729
809
|
}
|
|
730
810
|
isInputNumeric(activeInputElement) {
|
|
731
811
|
const inputMode = this.getInputMode(activeInputElement);
|
|
732
|
-
return inputMode && [
|
|
812
|
+
return inputMode && [SystelabVirtualKeyboardConstants.InputModes.numeric].some((i) => i === inputMode);
|
|
733
813
|
}
|
|
734
814
|
getInputMode(activeInputElement) {
|
|
735
815
|
return activeInputElement?.inputMode ?? activeInputElement?.type;
|
|
@@ -750,10 +830,10 @@ class SystelabVirtualKeyboardDirective {
|
|
|
750
830
|
this.showKeyboardButtonElement = child;
|
|
751
831
|
}
|
|
752
832
|
}
|
|
753
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
754
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
833
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: SystelabVirtualKeyboardDirective, deps: [{ token: i0.ElementRef }, { token: SystelabVirtualKeyboardOverlayService }, { token: i0.Renderer2 }, { token: DOCUMENT }, { token: VIRTUAL_KEYBOARD_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
834
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.3", type: SystelabVirtualKeyboardDirective, isStandalone: false, selector: "input[vkEnabled], textarea[vkEnabled]", inputs: { vkEnabled: "vkEnabled", vkFixedBottom: "vkFixedBottom", vkDebug: "vkDebug", vkConfig: "vkConfig" }, host: { listeners: { "window:touchmove": "onDocumentScroll($event)", "window:touchend": "onDocumentScroll($event)", "window:wheel": "onDocumentScroll($event)", "document:scroll": "onDocumentScroll($event)", "click": "onClick($event)", "touchend": "onTouchEnd($event)" } }, ngImport: i0 }); }
|
|
755
835
|
}
|
|
756
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
836
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: SystelabVirtualKeyboardDirective, decorators: [{
|
|
757
837
|
type: Directive,
|
|
758
838
|
args: [{
|
|
759
839
|
selector: 'input[vkEnabled], textarea[vkEnabled]',
|
|
@@ -820,11 +900,11 @@ class SystelabVirtualKeyboardModule {
|
|
|
820
900
|
providers: [],
|
|
821
901
|
};
|
|
822
902
|
}
|
|
823
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
824
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
825
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
903
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: SystelabVirtualKeyboardModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
904
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.3", ngImport: i0, type: SystelabVirtualKeyboardModule, declarations: [SystelabVirtualKeyboardDirective], imports: [CommonModule, OverlayModule], exports: [SystelabVirtualKeyboardDirective] }); }
|
|
905
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: SystelabVirtualKeyboardModule, imports: [CommonModule, OverlayModule] }); }
|
|
826
906
|
}
|
|
827
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
907
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: SystelabVirtualKeyboardModule, decorators: [{
|
|
828
908
|
type: NgModule,
|
|
829
909
|
args: [{
|
|
830
910
|
imports: [CommonModule, OverlayModule],
|
|
@@ -841,5 +921,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
841
921
|
* Generated bundle index. Do not edit.
|
|
842
922
|
*/
|
|
843
923
|
|
|
844
|
-
export {
|
|
924
|
+
export { SystelabVirtualKeyboardConstants, SystelabVirtualKeyboardDirective, SystelabVirtualKeyboardModule, factory };
|
|
845
925
|
//# sourceMappingURL=systelab-virtual-keyboard.mjs.map
|