@sam-senior/virtual-keyboard 1.0.2 → 2.0.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 +30 -30
- package/esm2022/lib/virtual-keyboard.directive.mjs +232 -0
- package/esm2022/lib/virtual-keyboard.module.mjs +16 -0
- package/esm2022/public_api.mjs +6 -0
- package/esm2022/sam-senior-virtual-keyboard.mjs +5 -0
- package/{fesm2015/sam-senior-virtual-keyboard.js → fesm2022/sam-senior-virtual-keyboard.mjs} +91 -175
- package/fesm2022/sam-senior-virtual-keyboard.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/virtual-keyboard.directive.d.ts +7 -2
- package/lib/virtual-keyboard.module.d.ts +5 -0
- package/package.json +18 -14
- package/public_api.d.ts +1 -0
- package/bundles/sam-senior-virtual-keyboard.umd.js +0 -404
- package/bundles/sam-senior-virtual-keyboard.umd.js.map +0 -1
- package/bundles/sam-senior-virtual-keyboard.umd.min.js +0 -2
- package/bundles/sam-senior-virtual-keyboard.umd.min.js.map +0 -1
- package/esm2015/lib/virtual-keyboard.directive.js +0 -355
- package/esm2015/lib/virtual-keyboard.module.js +0 -15
- package/esm2015/public_api.js +0 -9
- package/esm2015/sam-senior-virtual-keyboard.js +0 -10
- package/esm5/lib/virtual-keyboard.directive.js +0 -412
- package/esm5/lib/virtual-keyboard.module.js +0 -19
- package/esm5/public_api.js +0 -9
- package/esm5/sam-senior-virtual-keyboard.js +0 -10
- package/fesm2015/sam-senior-virtual-keyboard.js.map +0 -1
- package/fesm5/sam-senior-virtual-keyboard.js +0 -399
- package/fesm5/sam-senior-virtual-keyboard.js.map +0 -1
- package/sam-senior-virtual-keyboard.d.ts +0 -5
- package/sam-senior-virtual-keyboard.metadata.json +0 -1
|
@@ -1,399 +0,0 @@
|
|
|
1
|
-
import { Directive, ElementRef, Optional, Input, Output, EventEmitter, NgModule } from '@angular/core';
|
|
2
|
-
import { NgControl } from '@angular/forms';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @fileoverview added by tsickle
|
|
6
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* ************************************************************
|
|
10
|
-
* Método que retonar instancia do elemento jQuery, pois
|
|
11
|
-
* o projeto que implementa esta diretiva fica fora da lib.
|
|
12
|
-
* Devido ficar fora, o webpack não ficará aqui, portando não
|
|
13
|
-
* tem jQuery na lib;
|
|
14
|
-
* **************************************************************
|
|
15
|
-
* @type {?}
|
|
16
|
-
*/
|
|
17
|
-
var jQueryInstance = (/**
|
|
18
|
-
* @param {?} element
|
|
19
|
-
* @return {?}
|
|
20
|
-
*/
|
|
21
|
-
function (element) {
|
|
22
|
-
/** @type {?} */
|
|
23
|
-
var windowInstance = (/** @type {?} */ (window));
|
|
24
|
-
return windowInstance.jQuery ? windowInstance.jQuery(element) : null;
|
|
25
|
-
});
|
|
26
|
-
var VirtualKeyboardDirective = /** @class */ (function () {
|
|
27
|
-
function VirtualKeyboardDirective(elementRef, fieldControl) {
|
|
28
|
-
this.elementRef = elementRef;
|
|
29
|
-
this.fieldControl = fieldControl;
|
|
30
|
-
this.keyboardPosition = 'bottom';
|
|
31
|
-
this.keyboardType = 'email';
|
|
32
|
-
this.showOnFocus = true;
|
|
33
|
-
this.keyboardValueAccepted = new EventEmitter();
|
|
34
|
-
this.showKeyboardChange = new EventEmitter();
|
|
35
|
-
this._showKeyboard = false;
|
|
36
|
-
}
|
|
37
|
-
Object.defineProperty(VirtualKeyboardDirective.prototype, "activateKeyboard", {
|
|
38
|
-
set: /**
|
|
39
|
-
* @param {?} activateKeyboard
|
|
40
|
-
* @return {?}
|
|
41
|
-
*/
|
|
42
|
-
function (activateKeyboard) {
|
|
43
|
-
if (activateKeyboard) {
|
|
44
|
-
this.keyboardElement = (/** @type {?} */ (this.elementRef.nativeElement));
|
|
45
|
-
this.keyboardjQueryElement = jQueryInstance(this.keyboardElement);
|
|
46
|
-
if (this.keyboardjQueryElement) {
|
|
47
|
-
this.keyboardjQueryElement.keyboard(this.createKeyboardOptions());
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
enumerable: true,
|
|
52
|
-
configurable: true
|
|
53
|
-
});
|
|
54
|
-
Object.defineProperty(VirtualKeyboardDirective.prototype, "showKeyboard", {
|
|
55
|
-
get: /**
|
|
56
|
-
* @return {?}
|
|
57
|
-
*/
|
|
58
|
-
function () {
|
|
59
|
-
return this._showKeyboard;
|
|
60
|
-
},
|
|
61
|
-
set: /**
|
|
62
|
-
* @param {?} revealKeyboard
|
|
63
|
-
* @return {?}
|
|
64
|
-
*/
|
|
65
|
-
function (revealKeyboard) {
|
|
66
|
-
this._showKeyboard = revealKeyboard;
|
|
67
|
-
this.showKeyboardChange.emit(this._showKeyboard);
|
|
68
|
-
},
|
|
69
|
-
enumerable: true,
|
|
70
|
-
configurable: true
|
|
71
|
-
});
|
|
72
|
-
/**
|
|
73
|
-
* @return {?}
|
|
74
|
-
*/
|
|
75
|
-
VirtualKeyboardDirective.prototype.ngOnChanges = /**
|
|
76
|
-
* @return {?}
|
|
77
|
-
*/
|
|
78
|
-
function () {
|
|
79
|
-
if (this.showKeyboard && this.isKeyboardCreated()) {
|
|
80
|
-
this.keyboardjQueryElement.getkeyboard().reveal();
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
/**
|
|
84
|
-
* @return {?}
|
|
85
|
-
*/
|
|
86
|
-
VirtualKeyboardDirective.prototype.ngOnDestroy = /**
|
|
87
|
-
* @return {?}
|
|
88
|
-
*/
|
|
89
|
-
function () {
|
|
90
|
-
if (this.isKeyboardCreated()) {
|
|
91
|
-
this.keyboardjQueryElement
|
|
92
|
-
.keyboard()
|
|
93
|
-
.getkeyboard()
|
|
94
|
-
.destroy();
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
/**
|
|
98
|
-
* @private
|
|
99
|
-
* @return {?}
|
|
100
|
-
*/
|
|
101
|
-
VirtualKeyboardDirective.prototype.isKeyboardCreated = /**
|
|
102
|
-
* @private
|
|
103
|
-
* @return {?}
|
|
104
|
-
*/
|
|
105
|
-
function () {
|
|
106
|
-
return (this.keyboardjQueryElement &&
|
|
107
|
-
this.keyboardjQueryElement.keyboard() &&
|
|
108
|
-
this.keyboardjQueryElement.keyboard().getkeyboard());
|
|
109
|
-
};
|
|
110
|
-
/**
|
|
111
|
-
* @private
|
|
112
|
-
* @return {?}
|
|
113
|
-
*/
|
|
114
|
-
VirtualKeyboardDirective.prototype.getDefaultKeyboardOptions = /**
|
|
115
|
-
* @private
|
|
116
|
-
* @return {?}
|
|
117
|
-
*/
|
|
118
|
-
function () {
|
|
119
|
-
/** @type {?} */
|
|
120
|
-
var keyboardOptions = (/** @type {?} */ ({}));
|
|
121
|
-
if (!this.showOnFocus) {
|
|
122
|
-
keyboardOptions.openOn = '';
|
|
123
|
-
}
|
|
124
|
-
keyboardOptions.usePreview = false;
|
|
125
|
-
keyboardOptions.autoAccept = true;
|
|
126
|
-
keyboardOptions.accepted = this.onValueAccepted.bind(this);
|
|
127
|
-
keyboardOptions.visible = this.onKeyboardVisible.bind(this);
|
|
128
|
-
keyboardOptions.beforeClose = this.onBeforeClose.bind(this);
|
|
129
|
-
keyboardOptions.change = this.onChange.bind(this);
|
|
130
|
-
return keyboardOptions;
|
|
131
|
-
};
|
|
132
|
-
/**
|
|
133
|
-
* @private
|
|
134
|
-
* @return {?}
|
|
135
|
-
*/
|
|
136
|
-
VirtualKeyboardDirective.prototype.getKeyboardDisplayOptions = /**
|
|
137
|
-
* @private
|
|
138
|
-
* @return {?}
|
|
139
|
-
*/
|
|
140
|
-
function () {
|
|
141
|
-
return {
|
|
142
|
-
bksp: '\u2190',
|
|
143
|
-
normal: 'ABC',
|
|
144
|
-
meta1: '%?@',
|
|
145
|
-
meta2: '#+=',
|
|
146
|
-
accept: 'OK'
|
|
147
|
-
};
|
|
148
|
-
};
|
|
149
|
-
/**
|
|
150
|
-
* @private
|
|
151
|
-
* @return {?}
|
|
152
|
-
*/
|
|
153
|
-
VirtualKeyboardDirective.prototype.getKeyboardLayout = /**
|
|
154
|
-
* @private
|
|
155
|
-
* @return {?}
|
|
156
|
-
*/
|
|
157
|
-
function () {
|
|
158
|
-
/** @type {?} */
|
|
159
|
-
var customLayout = {};
|
|
160
|
-
if (this.keyboardType === 'alphanumeric') {
|
|
161
|
-
customLayout = {
|
|
162
|
-
normal: [
|
|
163
|
-
'1 2 3 4 5 6 7 8 9 0',
|
|
164
|
-
'Q W E R T Y U I O P {bksp}',
|
|
165
|
-
'A S D F G H J K L Ç',
|
|
166
|
-
'Z X C V B N M {accept}'
|
|
167
|
-
]
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
else if (this.keyboardType === 'email') {
|
|
171
|
-
customLayout = this.getCustomKeyboardForEmail();
|
|
172
|
-
}
|
|
173
|
-
return customLayout;
|
|
174
|
-
};
|
|
175
|
-
/**
|
|
176
|
-
* @private
|
|
177
|
-
* @return {?}
|
|
178
|
-
*/
|
|
179
|
-
VirtualKeyboardDirective.prototype.getCustomKeyboardForEmail = /**
|
|
180
|
-
* @private
|
|
181
|
-
* @return {?}
|
|
182
|
-
*/
|
|
183
|
-
function () {
|
|
184
|
-
return {
|
|
185
|
-
normal: [
|
|
186
|
-
'1 2 3 4 5 6 7 8 9 0',
|
|
187
|
-
'q w e r t y u i o p {bksp}',
|
|
188
|
-
'a s d f g h j k l ç',
|
|
189
|
-
'{s} z x c v b n m .',
|
|
190
|
-
'{meta1} {space} _ - {accept}'
|
|
191
|
-
],
|
|
192
|
-
shift: [
|
|
193
|
-
'1 2 3 4 5 6 7 8 9 0',
|
|
194
|
-
'Q W E R T Y U I O P {bksp}',
|
|
195
|
-
'A S D F G H J K L Ç',
|
|
196
|
-
'{s} Z X C V B N M .',
|
|
197
|
-
'{meta1} {space} _ - {accept}'
|
|
198
|
-
],
|
|
199
|
-
meta1: [
|
|
200
|
-
"` | { } % ^ * / ' {bksp}",
|
|
201
|
-
'{meta2} $ & ~ # = + @',
|
|
202
|
-
'{normal} {space} ! ? {accept}'
|
|
203
|
-
],
|
|
204
|
-
meta2: [
|
|
205
|
-
'[ ] { } \u2039 \u203a ^ * " , {bksp}',
|
|
206
|
-
'\\ | / < > $ \u00a3 \u00a5 \u2022',
|
|
207
|
-
'{meta1} \u20ac & ~ # = + .',
|
|
208
|
-
'{normal} {space} ! ? {accept}'
|
|
209
|
-
]
|
|
210
|
-
};
|
|
211
|
-
};
|
|
212
|
-
/**
|
|
213
|
-
* @private
|
|
214
|
-
* @return {?}
|
|
215
|
-
*/
|
|
216
|
-
VirtualKeyboardDirective.prototype.createKeyboardOptions = /**
|
|
217
|
-
* @private
|
|
218
|
-
* @return {?}
|
|
219
|
-
*/
|
|
220
|
-
function () {
|
|
221
|
-
/** @type {?} */
|
|
222
|
-
var keyboardOptions = this.getDefaultKeyboardOptions();
|
|
223
|
-
if (this.keyboardPosition !== 'relative') {
|
|
224
|
-
keyboardOptions.position = false;
|
|
225
|
-
}
|
|
226
|
-
if (this.keyboardPosition === 'bottom') {
|
|
227
|
-
this.addBottomKeyboardClass();
|
|
228
|
-
}
|
|
229
|
-
keyboardOptions.css = {
|
|
230
|
-
buttonDefault: 'keyboard-button-override'
|
|
231
|
-
};
|
|
232
|
-
keyboardOptions.display = this.getKeyboardDisplayOptions();
|
|
233
|
-
keyboardOptions.layout = 'custom';
|
|
234
|
-
keyboardOptions.customLayout = this.getKeyboardLayout();
|
|
235
|
-
return keyboardOptions;
|
|
236
|
-
};
|
|
237
|
-
/**
|
|
238
|
-
* @private
|
|
239
|
-
* @return {?}
|
|
240
|
-
*/
|
|
241
|
-
VirtualKeyboardDirective.prototype.onKeyboardVisible = /**
|
|
242
|
-
* @private
|
|
243
|
-
* @return {?}
|
|
244
|
-
*/
|
|
245
|
-
function () {
|
|
246
|
-
this.addCustomKeyboardFocusClass();
|
|
247
|
-
};
|
|
248
|
-
/**
|
|
249
|
-
* @private
|
|
250
|
-
* @return {?}
|
|
251
|
-
*/
|
|
252
|
-
VirtualKeyboardDirective.prototype.onBeforeClose = /**
|
|
253
|
-
* @private
|
|
254
|
-
* @return {?}
|
|
255
|
-
*/
|
|
256
|
-
function () {
|
|
257
|
-
this.showKeyboard = false;
|
|
258
|
-
};
|
|
259
|
-
/**
|
|
260
|
-
* @private
|
|
261
|
-
* @return {?}
|
|
262
|
-
*/
|
|
263
|
-
VirtualKeyboardDirective.prototype.onValueAccepted = /**
|
|
264
|
-
* @private
|
|
265
|
-
* @return {?}
|
|
266
|
-
*/
|
|
267
|
-
function () {
|
|
268
|
-
/** @type {?} */
|
|
269
|
-
var casted = (/** @type {?} */ (this.keyboardElement));
|
|
270
|
-
this.keyboardValueAccepted.emit(casted.value);
|
|
271
|
-
};
|
|
272
|
-
/**
|
|
273
|
-
* @private
|
|
274
|
-
* @param {?} event
|
|
275
|
-
* @return {?}
|
|
276
|
-
*/
|
|
277
|
-
VirtualKeyboardDirective.prototype.onChange = /**
|
|
278
|
-
* @private
|
|
279
|
-
* @param {?} event
|
|
280
|
-
* @return {?}
|
|
281
|
-
*/
|
|
282
|
-
function (event) {
|
|
283
|
-
/** @type {?} */
|
|
284
|
-
var virtualkeyboardevent = new CustomEvent('virtualkeyboardevent', event);
|
|
285
|
-
document.dispatchEvent(virtualkeyboardevent);
|
|
286
|
-
if (this.keyboardElement instanceof HTMLInputElement) {
|
|
287
|
-
/** @type {?} */
|
|
288
|
-
var keyboardElement_1 = (/** @type {?} */ (this.keyboardElement));
|
|
289
|
-
/** @type {?} */
|
|
290
|
-
var inputVal_1 = keyboardElement_1.value;
|
|
291
|
-
if (this.fieldControl) {
|
|
292
|
-
/** @type {?} */
|
|
293
|
-
var formControl = this.fieldControl.control;
|
|
294
|
-
formControl.setValue(inputVal_1);
|
|
295
|
-
formControl.markAsDirty();
|
|
296
|
-
formControl.updateValueAndValidity();
|
|
297
|
-
}
|
|
298
|
-
// Este setTimeout é necessário para fazer com que o
|
|
299
|
-
// cursor do input sempre esteja no final da string digitada
|
|
300
|
-
// e o final da string sempre esteja visivel.
|
|
301
|
-
setTimeout((/**
|
|
302
|
-
* @return {?}
|
|
303
|
-
*/
|
|
304
|
-
function () {
|
|
305
|
-
keyboardElement_1.value = inputVal_1;
|
|
306
|
-
keyboardElement_1.scrollLeft = keyboardElement_1.scrollWidth;
|
|
307
|
-
}));
|
|
308
|
-
}
|
|
309
|
-
};
|
|
310
|
-
/**
|
|
311
|
-
* @private
|
|
312
|
-
* @return {?}
|
|
313
|
-
*/
|
|
314
|
-
VirtualKeyboardDirective.prototype.addBottomKeyboardClass = /**
|
|
315
|
-
* @private
|
|
316
|
-
* @return {?}
|
|
317
|
-
*/
|
|
318
|
-
function () {
|
|
319
|
-
this.injectCssRule(".ui-keyboard {\n border-radius: 0;\n left: 0;\n top: auto;\n bottom: 0;\n position: fixed;\n width: 100%;\n }");
|
|
320
|
-
};
|
|
321
|
-
/**
|
|
322
|
-
* @private
|
|
323
|
-
* @return {?}
|
|
324
|
-
*/
|
|
325
|
-
VirtualKeyboardDirective.prototype.addCustomKeyboardFocusClass = /**
|
|
326
|
-
* @private
|
|
327
|
-
* @return {?}
|
|
328
|
-
*/
|
|
329
|
-
function () {
|
|
330
|
-
this.injectCssRule(".ui-keyboard-has-focus {\n z-index: 900;\n }");
|
|
331
|
-
};
|
|
332
|
-
/**
|
|
333
|
-
* @private
|
|
334
|
-
* @param {?} rule
|
|
335
|
-
* @return {?}
|
|
336
|
-
*/
|
|
337
|
-
VirtualKeyboardDirective.prototype.injectCssRule = /**
|
|
338
|
-
* @private
|
|
339
|
-
* @param {?} rule
|
|
340
|
-
* @return {?}
|
|
341
|
-
*/
|
|
342
|
-
function (rule) {
|
|
343
|
-
/** @type {?} */
|
|
344
|
-
var style = (/** @type {?} */ (document.createElement('style')));
|
|
345
|
-
style.appendChild(document.createTextNode(''));
|
|
346
|
-
document.head.appendChild(style);
|
|
347
|
-
style.sheet.insertRule(rule);
|
|
348
|
-
};
|
|
349
|
-
VirtualKeyboardDirective.decorators = [
|
|
350
|
-
{ type: Directive, args: [{
|
|
351
|
-
selector: '[samVirtualKeyboard]'
|
|
352
|
-
},] }
|
|
353
|
-
];
|
|
354
|
-
/** @nocollapse */
|
|
355
|
-
VirtualKeyboardDirective.ctorParameters = function () { return [
|
|
356
|
-
{ type: ElementRef },
|
|
357
|
-
{ type: NgControl, decorators: [{ type: Optional }] }
|
|
358
|
-
]; };
|
|
359
|
-
VirtualKeyboardDirective.propDecorators = {
|
|
360
|
-
keyboardPosition: [{ type: Input }],
|
|
361
|
-
keyboardType: [{ type: Input }],
|
|
362
|
-
activateKeyboard: [{ type: Input }],
|
|
363
|
-
showOnFocus: [{ type: Input }],
|
|
364
|
-
showKeyboard: [{ type: Input }],
|
|
365
|
-
keyboardValueAccepted: [{ type: Output }],
|
|
366
|
-
showKeyboardChange: [{ type: Output }]
|
|
367
|
-
};
|
|
368
|
-
return VirtualKeyboardDirective;
|
|
369
|
-
}());
|
|
370
|
-
|
|
371
|
-
/**
|
|
372
|
-
* @fileoverview added by tsickle
|
|
373
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
374
|
-
*/
|
|
375
|
-
var VirtualKeyboardModule = /** @class */ (function () {
|
|
376
|
-
function VirtualKeyboardModule() {
|
|
377
|
-
}
|
|
378
|
-
VirtualKeyboardModule.decorators = [
|
|
379
|
-
{ type: NgModule, args: [{
|
|
380
|
-
declarations: [VirtualKeyboardDirective],
|
|
381
|
-
exports: [VirtualKeyboardDirective]
|
|
382
|
-
},] }
|
|
383
|
-
];
|
|
384
|
-
return VirtualKeyboardModule;
|
|
385
|
-
}());
|
|
386
|
-
|
|
387
|
-
/**
|
|
388
|
-
* @fileoverview added by tsickle
|
|
389
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
390
|
-
*/
|
|
391
|
-
|
|
392
|
-
/**
|
|
393
|
-
* @fileoverview added by tsickle
|
|
394
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
395
|
-
*/
|
|
396
|
-
|
|
397
|
-
export { VirtualKeyboardModule, VirtualKeyboardDirective as ɵa };
|
|
398
|
-
|
|
399
|
-
//# sourceMappingURL=sam-senior-virtual-keyboard.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sam-senior-virtual-keyboard.js.map","sources":["ng://@sam-senior/virtual-keyboard/lib/virtual-keyboard.directive.ts","ng://@sam-senior/virtual-keyboard/lib/virtual-keyboard.module.ts"],"sourcesContent":["import { Directive, OnDestroy, OnChanges, ElementRef, Optional, Input, Output, EventEmitter } from '@angular/core';\nimport { NgControl } from '@angular/forms';\n\nimport { KeyboardOptions } from '../../node_modules/virtual-keyboard';\n\n/***************************************************************\n* Método que retonar instancia do elemento jQuery, pois\n* o projeto que implementa esta diretiva fica fora da lib.\n* Devido ficar fora, o webpack não ficará aqui, portando não\n* tem jQuery na lib;\n****************************************************************/\nconst jQueryInstance = (element) => {\n const windowInstance = window as any;\n return windowInstance.jQuery ? windowInstance.jQuery(element) : null;\n};\n\n@Directive({\n selector: '[samVirtualKeyboard]'\n})\nexport class VirtualKeyboardDirective\n implements OnDestroy, OnChanges {\n\n @Input() private keyboardPosition: 'relative' | 'bottom' = 'bottom';\n @Input() private keyboardType: 'email' | 'alphanumeric' = 'email';\n @Input() public set activateKeyboard(activateKeyboard: boolean) {\n if (activateKeyboard) {\n this.keyboardElement = this.elementRef.nativeElement as HTMLElement;\n this.keyboardjQueryElement = jQueryInstance(this.keyboardElement);\n if (this.keyboardjQueryElement) {\n this.keyboardjQueryElement.keyboard(this.createKeyboardOptions());\n }\n }\n }\n @Input() private showOnFocus = true;\n @Input()\n public get showKeyboard(): boolean {\n return this._showKeyboard;\n }\n public set showKeyboard(revealKeyboard: boolean) {\n this._showKeyboard = revealKeyboard;\n this.showKeyboardChange.emit(this._showKeyboard);\n }\n\n @Output() private keyboardValueAccepted = new EventEmitter();\n @Output() public showKeyboardChange = new EventEmitter<boolean>();\n\n public _showKeyboard = false;\n private keyboardElement: HTMLElement;\n\n // Any devido a ser referência do jQuery;\n private keyboardjQueryElement: any;\n\n constructor(\n public elementRef: ElementRef,\n @Optional() public fieldControl: NgControl\n ) { }\n\n ngOnChanges() {\n if (this.showKeyboard && this.isKeyboardCreated()) {\n this.keyboardjQueryElement.getkeyboard().reveal();\n }\n }\n\n ngOnDestroy() {\n if (this.isKeyboardCreated()) {\n this.keyboardjQueryElement\n .keyboard()\n .getkeyboard()\n .destroy();\n }\n }\n\n private isKeyboardCreated(): boolean {\n return (\n this.keyboardjQueryElement &&\n this.keyboardjQueryElement.keyboard() &&\n this.keyboardjQueryElement.keyboard().getkeyboard()\n );\n }\n\n private getDefaultKeyboardOptions() {\n const keyboardOptions = {} as KeyboardOptions;\n if (!this.showOnFocus) {\n keyboardOptions.openOn = '';\n }\n keyboardOptions.usePreview = false;\n keyboardOptions.autoAccept = true;\n keyboardOptions.accepted = this.onValueAccepted.bind(this);\n keyboardOptions.visible = this.onKeyboardVisible.bind(this);\n keyboardOptions.beforeClose = this.onBeforeClose.bind(this);\n keyboardOptions.change = this.onChange.bind(this);\n return keyboardOptions;\n }\n\n private getKeyboardDisplayOptions() {\n return {\n bksp: '\\u2190',\n normal: 'ABC',\n meta1: '%?@',\n meta2: '#+=',\n accept: 'OK'\n };\n }\n\n private getKeyboardLayout() {\n let customLayout = {};\n if (this.keyboardType === 'alphanumeric') {\n customLayout = {\n normal: [\n '1 2 3 4 5 6 7 8 9 0',\n 'Q W E R T Y U I O P {bksp}',\n 'A S D F G H J K L Ã',\n 'Z X C V B N M {accept}'\n ]\n };\n } else if (this.keyboardType === 'email') {\n customLayout = this.getCustomKeyboardForEmail();\n }\n return customLayout;\n }\n\n private getCustomKeyboardForEmail() {\n return {\n normal: [\n '1 2 3 4 5 6 7 8 9 0',\n 'q w e r t y u i o p {bksp}',\n 'a s d f g h j k l ç',\n '{s} z x c v b n m .',\n '{meta1} {space} _ - {accept}'\n ],\n shift: [\n '1 2 3 4 5 6 7 8 9 0',\n 'Q W E R T Y U I O P {bksp}',\n 'A S D F G H J K L Ã',\n '{s} Z X C V B N M .',\n '{meta1} {space} _ - {accept}'\n ],\n meta1: [\n \"` | { } % ^ * / ' {bksp}\",\n '{meta2} $ & ~ # = + @',\n '{normal} {space} ! ? {accept}'\n ],\n meta2: [\n '[ ] { } \\u2039 \\u203a ^ * \" , {bksp}',\n '\\\\ | / < > $ \\u00a3 \\u00a5 \\u2022',\n '{meta1} \\u20ac & ~ # = + .',\n '{normal} {space} ! ? {accept}'\n ]\n };\n }\n\n private createKeyboardOptions(): KeyboardOptions {\n const keyboardOptions = this.getDefaultKeyboardOptions();\n if (this.keyboardPosition !== 'relative') {\n keyboardOptions.position = false;\n }\n if (this.keyboardPosition === 'bottom') {\n this.addBottomKeyboardClass();\n }\n keyboardOptions.css = {\n buttonDefault: 'keyboard-button-override'\n };\n\n keyboardOptions.display = this.getKeyboardDisplayOptions();\n keyboardOptions.layout = 'custom';\n keyboardOptions.customLayout = this.getKeyboardLayout();\n\n return keyboardOptions;\n }\n\n private onKeyboardVisible() {\n this.addCustomKeyboardFocusClass();\n }\n\n private onBeforeClose() {\n this.showKeyboard = false;\n }\n\n private onValueAccepted() {\n const casted = this.keyboardElement as any;\n this.keyboardValueAccepted.emit(casted.value);\n }\n\n private onChange(event) {\n const virtualkeyboardevent = new CustomEvent('virtualkeyboardevent', event);\n document.dispatchEvent(virtualkeyboardevent);\n if (this.keyboardElement instanceof HTMLInputElement) {\n const keyboardElement = this.keyboardElement as HTMLInputElement;\n const inputVal = keyboardElement.value;\n if (this.fieldControl) {\n const formControl = this.fieldControl.control;\n formControl.setValue(inputVal);\n formControl.markAsDirty();\n formControl.updateValueAndValidity();\n }\n // Este setTimeout é necessário para fazer com que o\n // cursor do input sempre esteja no final da string digitada\n // e o final da string sempre esteja visivel.\n setTimeout(() => {\n keyboardElement.value = inputVal;\n keyboardElement.scrollLeft = keyboardElement.scrollWidth;\n });\n }\n }\n\n private addBottomKeyboardClass() {\n this.injectCssRule(\n `.ui-keyboard {\n border-radius: 0;\n left: 0;\n top: auto;\n bottom: 0;\n position: fixed;\n width: 100%;\n }`\n );\n }\n\n private addCustomKeyboardFocusClass() {\n this.injectCssRule(\n `.ui-keyboard-has-focus {\n z-index: 900;\n }`\n );\n }\n\n private injectCssRule(rule) {\n const style = document.createElement('style') as any;\n style.appendChild(document.createTextNode(''));\n document.head.appendChild(style);\n style.sheet.insertRule(rule);\n }\n}\n\n","import { NgModule } from '@angular/core';\nimport { VirtualKeyboardDirective } from './virtual-keyboard.directive';\n\n@NgModule({\n declarations: [VirtualKeyboardDirective],\n exports: [VirtualKeyboardDirective]\n})\nexport class VirtualKeyboardModule { }\n"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;;;IAWM,cAAc;;;;AAAG,UAAC,OAAO;;QACvB,cAAc,sBAAG,MAAM,EAAO;IACpC,OAAO,cAAc,CAAC,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;CACtE,CAAA;;IAsCC,kCACS,UAAsB,EACV,YAAuB;QADnC,eAAU,GAAV,UAAU,CAAY;QACV,iBAAY,GAAZ,YAAY,CAAW;QAhC3B,qBAAgB,GAA0B,QAAQ,CAAC;QACnD,iBAAY,GAA6B,OAAO,CAAC;QAUjD,gBAAW,GAAG,IAAI,CAAC;QAUlB,0BAAqB,GAAG,IAAI,YAAY,EAAE,CAAC;QAC5C,uBAAkB,GAAG,IAAI,YAAY,EAAW,CAAC;QAE3D,kBAAa,GAAG,KAAK,CAAC;KASxB;IA/BL,sBAAoB,sDAAgB;;;;;QAApC,UAAqC,gBAAyB;YAC5D,IAAI,gBAAgB,EAAE;gBACpB,IAAI,CAAC,eAAe,sBAAG,IAAI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C;iBACpC;;IACoC,4BAAC;CAJtC;;;;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"__symbolic":"module","version":4,"metadata":{"VirtualKeyboardModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":3,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"ɵa"}],"exports":[{"__symbolic":"reference","name":"ɵa"}]}]}],"members":{}},"ɵa":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":16,"character":1},"arguments":[{"selector":"[samVirtualKeyboard]"}]}],"members":{"keyboardPosition":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":22,"character":3}}]}],"keyboardType":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":23,"character":3}}]}],"activateKeyboard":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":24,"character":3}}]}],"showOnFocus":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":33,"character":3}}]}],"showKeyboard":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":34,"character":3}}]}],"keyboardValueAccepted":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":43,"character":3}}]}],"showKeyboardChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":44,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":54,"character":5}}]],"parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":53,"character":23},{"__symbolic":"reference","module":"@angular/forms","name":"NgControl","line":54,"character":37}]}],"ngOnChanges":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"isKeyboardCreated":[{"__symbolic":"method"}],"getDefaultKeyboardOptions":[{"__symbolic":"method"}],"getKeyboardDisplayOptions":[{"__symbolic":"method"}],"getKeyboardLayout":[{"__symbolic":"method"}],"getCustomKeyboardForEmail":[{"__symbolic":"method"}],"createKeyboardOptions":[{"__symbolic":"method"}],"onKeyboardVisible":[{"__symbolic":"method"}],"onBeforeClose":[{"__symbolic":"method"}],"onValueAccepted":[{"__symbolic":"method"}],"onChange":[{"__symbolic":"method"}],"addBottomKeyboardClass":[{"__symbolic":"method"}],"addCustomKeyboardFocusClass":[{"__symbolic":"method"}],"injectCssRule":[{"__symbolic":"method"}]}}},"origins":{"VirtualKeyboardModule":"./lib/virtual-keyboard.module","ɵa":"./lib/virtual-keyboard.directive"},"importAs":"@sam-senior/virtual-keyboard"}
|