@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.
Files changed (29) hide show
  1. package/README.md +30 -30
  2. package/esm2022/lib/virtual-keyboard.directive.mjs +232 -0
  3. package/esm2022/lib/virtual-keyboard.module.mjs +16 -0
  4. package/esm2022/public_api.mjs +6 -0
  5. package/esm2022/sam-senior-virtual-keyboard.mjs +5 -0
  6. package/{fesm2015/sam-senior-virtual-keyboard.js → fesm2022/sam-senior-virtual-keyboard.mjs} +91 -175
  7. package/fesm2022/sam-senior-virtual-keyboard.mjs.map +1 -0
  8. package/index.d.ts +5 -0
  9. package/lib/virtual-keyboard.directive.d.ts +7 -2
  10. package/lib/virtual-keyboard.module.d.ts +5 -0
  11. package/package.json +18 -14
  12. package/public_api.d.ts +1 -0
  13. package/bundles/sam-senior-virtual-keyboard.umd.js +0 -404
  14. package/bundles/sam-senior-virtual-keyboard.umd.js.map +0 -1
  15. package/bundles/sam-senior-virtual-keyboard.umd.min.js +0 -2
  16. package/bundles/sam-senior-virtual-keyboard.umd.min.js.map +0 -1
  17. package/esm2015/lib/virtual-keyboard.directive.js +0 -355
  18. package/esm2015/lib/virtual-keyboard.module.js +0 -15
  19. package/esm2015/public_api.js +0 -9
  20. package/esm2015/sam-senior-virtual-keyboard.js +0 -10
  21. package/esm5/lib/virtual-keyboard.directive.js +0 -412
  22. package/esm5/lib/virtual-keyboard.module.js +0 -19
  23. package/esm5/public_api.js +0 -9
  24. package/esm5/sam-senior-virtual-keyboard.js +0 -10
  25. package/fesm2015/sam-senior-virtual-keyboard.js.map +0 -1
  26. package/fesm5/sam-senior-virtual-keyboard.js +0 -399
  27. package/fesm5/sam-senior-virtual-keyboard.js.map +0 -1
  28. package/sam-senior-virtual-keyboard.d.ts +0 -5
  29. package/sam-senior-virtual-keyboard.metadata.json +0 -1
@@ -1,404 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms')) :
3
- typeof define === 'function' && define.amd ? define('@sam-senior/virtual-keyboard', ['exports', '@angular/core', '@angular/forms'], factory) :
4
- (factory((global['sam-senior'] = global['sam-senior'] || {}, global['sam-senior']['virtual-keyboard'] = {}),global.ng.core,global.ng.forms));
5
- }(this, (function (exports,core,forms) { 'use strict';
6
-
7
- /**
8
- * @fileoverview added by tsickle
9
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
10
- */
11
- /**
12
- * ************************************************************
13
- * Método que retonar instancia do elemento jQuery, pois
14
- * o projeto que implementa esta diretiva fica fora da lib.
15
- * Devido ficar fora, o webpack não ficará aqui, portando não
16
- * tem jQuery na lib;
17
- * **************************************************************
18
- * @type {?}
19
- */
20
- var jQueryInstance = ( /**
21
- * @param {?} element
22
- * @return {?}
23
- */function (element) {
24
- /** @type {?} */
25
- var windowInstance = ( /** @type {?} */(window));
26
- return windowInstance.jQuery ? windowInstance.jQuery(element) : null;
27
- });
28
- var VirtualKeyboardDirective = /** @class */ (function () {
29
- function VirtualKeyboardDirective(elementRef, fieldControl) {
30
- this.elementRef = elementRef;
31
- this.fieldControl = fieldControl;
32
- this.keyboardPosition = 'bottom';
33
- this.keyboardType = 'email';
34
- this.showOnFocus = true;
35
- this.keyboardValueAccepted = new core.EventEmitter();
36
- this.showKeyboardChange = new core.EventEmitter();
37
- this._showKeyboard = false;
38
- }
39
- Object.defineProperty(VirtualKeyboardDirective.prototype, "activateKeyboard", {
40
- set: /**
41
- * @param {?} activateKeyboard
42
- * @return {?}
43
- */ function (activateKeyboard) {
44
- if (activateKeyboard) {
45
- this.keyboardElement = ( /** @type {?} */(this.elementRef.nativeElement));
46
- this.keyboardjQueryElement = jQueryInstance(this.keyboardElement);
47
- if (this.keyboardjQueryElement) {
48
- this.keyboardjQueryElement.keyboard(this.createKeyboardOptions());
49
- }
50
- }
51
- },
52
- enumerable: true,
53
- configurable: true
54
- });
55
- Object.defineProperty(VirtualKeyboardDirective.prototype, "showKeyboard", {
56
- get: /**
57
- * @return {?}
58
- */ function () {
59
- return this._showKeyboard;
60
- },
61
- set: /**
62
- * @param {?} revealKeyboard
63
- * @return {?}
64
- */ function (revealKeyboard) {
65
- this._showKeyboard = revealKeyboard;
66
- this.showKeyboardChange.emit(this._showKeyboard);
67
- },
68
- enumerable: true,
69
- configurable: true
70
- });
71
- /**
72
- * @return {?}
73
- */
74
- VirtualKeyboardDirective.prototype.ngOnChanges = /**
75
- * @return {?}
76
- */
77
- function () {
78
- if (this.showKeyboard && this.isKeyboardCreated()) {
79
- this.keyboardjQueryElement.getkeyboard().reveal();
80
- }
81
- };
82
- /**
83
- * @return {?}
84
- */
85
- VirtualKeyboardDirective.prototype.ngOnDestroy = /**
86
- * @return {?}
87
- */
88
- function () {
89
- if (this.isKeyboardCreated()) {
90
- this.keyboardjQueryElement
91
- .keyboard()
92
- .getkeyboard()
93
- .destroy();
94
- }
95
- };
96
- /**
97
- * @private
98
- * @return {?}
99
- */
100
- VirtualKeyboardDirective.prototype.isKeyboardCreated = /**
101
- * @private
102
- * @return {?}
103
- */
104
- function () {
105
- return (this.keyboardjQueryElement &&
106
- this.keyboardjQueryElement.keyboard() &&
107
- this.keyboardjQueryElement.keyboard().getkeyboard());
108
- };
109
- /**
110
- * @private
111
- * @return {?}
112
- */
113
- VirtualKeyboardDirective.prototype.getDefaultKeyboardOptions = /**
114
- * @private
115
- * @return {?}
116
- */
117
- function () {
118
- /** @type {?} */
119
- var keyboardOptions = ( /** @type {?} */({}));
120
- if (!this.showOnFocus) {
121
- keyboardOptions.openOn = '';
122
- }
123
- keyboardOptions.usePreview = false;
124
- keyboardOptions.autoAccept = true;
125
- keyboardOptions.accepted = this.onValueAccepted.bind(this);
126
- keyboardOptions.visible = this.onKeyboardVisible.bind(this);
127
- keyboardOptions.beforeClose = this.onBeforeClose.bind(this);
128
- keyboardOptions.change = this.onChange.bind(this);
129
- return keyboardOptions;
130
- };
131
- /**
132
- * @private
133
- * @return {?}
134
- */
135
- VirtualKeyboardDirective.prototype.getKeyboardDisplayOptions = /**
136
- * @private
137
- * @return {?}
138
- */
139
- function () {
140
- return {
141
- bksp: '\u2190',
142
- normal: 'ABC',
143
- meta1: '%?@',
144
- meta2: '#+=',
145
- accept: 'OK'
146
- };
147
- };
148
- /**
149
- * @private
150
- * @return {?}
151
- */
152
- VirtualKeyboardDirective.prototype.getKeyboardLayout = /**
153
- * @private
154
- * @return {?}
155
- */
156
- function () {
157
- /** @type {?} */
158
- var customLayout = {};
159
- if (this.keyboardType === 'alphanumeric') {
160
- customLayout = {
161
- normal: [
162
- '1 2 3 4 5 6 7 8 9 0',
163
- 'Q W E R T Y U I O P {bksp}',
164
- 'A S D F G H J K L Ç',
165
- 'Z X C V B N M {accept}'
166
- ]
167
- };
168
- }
169
- else if (this.keyboardType === 'email') {
170
- customLayout = this.getCustomKeyboardForEmail();
171
- }
172
- return customLayout;
173
- };
174
- /**
175
- * @private
176
- * @return {?}
177
- */
178
- VirtualKeyboardDirective.prototype.getCustomKeyboardForEmail = /**
179
- * @private
180
- * @return {?}
181
- */
182
- function () {
183
- return {
184
- normal: [
185
- '1 2 3 4 5 6 7 8 9 0',
186
- 'q w e r t y u i o p {bksp}',
187
- 'a s d f g h j k l ç',
188
- '{s} z x c v b n m .',
189
- '{meta1} {space} _ - {accept}'
190
- ],
191
- shift: [
192
- '1 2 3 4 5 6 7 8 9 0',
193
- 'Q W E R T Y U I O P {bksp}',
194
- 'A S D F G H J K L Ç',
195
- '{s} Z X C V B N M .',
196
- '{meta1} {space} _ - {accept}'
197
- ],
198
- meta1: [
199
- "` | { } % ^ * / ' {bksp}",
200
- '{meta2} $ & ~ # = + @',
201
- '{normal} {space} ! ? {accept}'
202
- ],
203
- meta2: [
204
- '[ ] { } \u2039 \u203a ^ * " , {bksp}',
205
- '\\ | / < > $ \u00a3 \u00a5 \u2022',
206
- '{meta1} \u20ac & ~ # = + .',
207
- '{normal} {space} ! ? {accept}'
208
- ]
209
- };
210
- };
211
- /**
212
- * @private
213
- * @return {?}
214
- */
215
- VirtualKeyboardDirective.prototype.createKeyboardOptions = /**
216
- * @private
217
- * @return {?}
218
- */
219
- function () {
220
- /** @type {?} */
221
- var keyboardOptions = this.getDefaultKeyboardOptions();
222
- if (this.keyboardPosition !== 'relative') {
223
- keyboardOptions.position = false;
224
- }
225
- if (this.keyboardPosition === 'bottom') {
226
- this.addBottomKeyboardClass();
227
- }
228
- keyboardOptions.css = {
229
- buttonDefault: 'keyboard-button-override'
230
- };
231
- keyboardOptions.display = this.getKeyboardDisplayOptions();
232
- keyboardOptions.layout = 'custom';
233
- keyboardOptions.customLayout = this.getKeyboardLayout();
234
- return keyboardOptions;
235
- };
236
- /**
237
- * @private
238
- * @return {?}
239
- */
240
- VirtualKeyboardDirective.prototype.onKeyboardVisible = /**
241
- * @private
242
- * @return {?}
243
- */
244
- function () {
245
- this.addCustomKeyboardFocusClass();
246
- };
247
- /**
248
- * @private
249
- * @return {?}
250
- */
251
- VirtualKeyboardDirective.prototype.onBeforeClose = /**
252
- * @private
253
- * @return {?}
254
- */
255
- function () {
256
- this.showKeyboard = false;
257
- };
258
- /**
259
- * @private
260
- * @return {?}
261
- */
262
- VirtualKeyboardDirective.prototype.onValueAccepted = /**
263
- * @private
264
- * @return {?}
265
- */
266
- function () {
267
- /** @type {?} */
268
- var casted = ( /** @type {?} */(this.keyboardElement));
269
- this.keyboardValueAccepted.emit(casted.value);
270
- };
271
- /**
272
- * @private
273
- * @param {?} event
274
- * @return {?}
275
- */
276
- VirtualKeyboardDirective.prototype.onChange = /**
277
- * @private
278
- * @param {?} event
279
- * @return {?}
280
- */
281
- function (event) {
282
- /** @type {?} */
283
- var virtualkeyboardevent = new CustomEvent('virtualkeyboardevent', event);
284
- document.dispatchEvent(virtualkeyboardevent);
285
- if (this.keyboardElement instanceof HTMLInputElement) {
286
- /** @type {?} */
287
- var keyboardElement_1 = ( /** @type {?} */(this.keyboardElement));
288
- /** @type {?} */
289
- var inputVal_1 = keyboardElement_1.value;
290
- if (this.fieldControl) {
291
- /** @type {?} */
292
- var formControl = this.fieldControl.control;
293
- formControl.setValue(inputVal_1);
294
- formControl.markAsDirty();
295
- formControl.updateValueAndValidity();
296
- }
297
- // Este setTimeout é necessário para fazer com que o
298
- // cursor do input sempre esteja no final da string digitada
299
- // e o final da string sempre esteja visivel.
300
- setTimeout(( /**
301
- * @return {?}
302
- */function () {
303
- keyboardElement_1.value = inputVal_1;
304
- keyboardElement_1.scrollLeft = keyboardElement_1.scrollWidth;
305
- }));
306
- }
307
- };
308
- /**
309
- * @private
310
- * @return {?}
311
- */
312
- VirtualKeyboardDirective.prototype.addBottomKeyboardClass = /**
313
- * @private
314
- * @return {?}
315
- */
316
- function () {
317
- this.injectCssRule(".ui-keyboard {\n border-radius: 0;\n left: 0;\n top: auto;\n bottom: 0;\n position: fixed;\n width: 100%;\n }");
318
- };
319
- /**
320
- * @private
321
- * @return {?}
322
- */
323
- VirtualKeyboardDirective.prototype.addCustomKeyboardFocusClass = /**
324
- * @private
325
- * @return {?}
326
- */
327
- function () {
328
- this.injectCssRule(".ui-keyboard-has-focus {\n z-index: 900;\n }");
329
- };
330
- /**
331
- * @private
332
- * @param {?} rule
333
- * @return {?}
334
- */
335
- VirtualKeyboardDirective.prototype.injectCssRule = /**
336
- * @private
337
- * @param {?} rule
338
- * @return {?}
339
- */
340
- function (rule) {
341
- /** @type {?} */
342
- var style = ( /** @type {?} */(document.createElement('style')));
343
- style.appendChild(document.createTextNode(''));
344
- document.head.appendChild(style);
345
- style.sheet.insertRule(rule);
346
- };
347
- VirtualKeyboardDirective.decorators = [
348
- { type: core.Directive, args: [{
349
- selector: '[samVirtualKeyboard]'
350
- },] }
351
- ];
352
- /** @nocollapse */
353
- VirtualKeyboardDirective.ctorParameters = function () {
354
- return [
355
- { type: core.ElementRef },
356
- { type: forms.NgControl, decorators: [{ type: core.Optional }] }
357
- ];
358
- };
359
- VirtualKeyboardDirective.propDecorators = {
360
- keyboardPosition: [{ type: core.Input }],
361
- keyboardType: [{ type: core.Input }],
362
- activateKeyboard: [{ type: core.Input }],
363
- showOnFocus: [{ type: core.Input }],
364
- showKeyboard: [{ type: core.Input }],
365
- keyboardValueAccepted: [{ type: core.Output }],
366
- showKeyboardChange: [{ type: core.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: core.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
- exports.VirtualKeyboardModule = VirtualKeyboardModule;
398
- exports.ɵa = VirtualKeyboardDirective;
399
-
400
- Object.defineProperty(exports, '__esModule', { value: true });
401
-
402
- })));
403
-
404
- //# sourceMappingURL=sam-senior-virtual-keyboard.umd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sam-senior-virtual-keyboard.umd.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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;;;QAEO,yDAAsB;;;;YAA9B;gBACE,IAAI,CAAC,aAAa,CAChB,8JAOE,CACH,CAAC;aACH;;;;;QAEO,8DAA2B;;;;YAAnC;gBACE,IAAI,CAAC,aAAa,CAChB,0DAEE,CACH,CAAC;aACH;;;;;;QAEO,gDAAa;;;;;YAArB,UAAsB,IAAI;;oBAClB,KAAK,sBAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,EAAO;gBACpD,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC/C,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;gBACjC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;aAC9B;;oBAvNFC,cAAS,SAAC;wBACT,QAAQ,EAAE,sBAAsB;qBACjC;;;;;wBAlByCC,eAAU;wBAC3CC,eAAS,uBAqDbC,aAAQ;;;;uCAhCVC,UAAK;mCACLA,UAAK;uCACLA,UAAK;kCASLA,UAAK;mCACLA,UAAK;4CASLC,WAAM;yCACNA,WAAM;;QA4LT,+BAAC;KAxND;;;;;;AChBA;QAGA;SAIsC;;oBAJrCC,aAAQ,SAAC;wBACR,YAAY,EAAE,CAAC,wBAAwB,CAAC;wBACxC,OAAO,EAAE,CAAC,wBAAwB,CAAC;qBACpC;;QACoC,4BAAC;KAJtC;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,2 +0,0 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/forms")):"function"==typeof define&&define.amd?define("@sam-senior/virtual-keyboard",["exports","@angular/core","@angular/forms"],t):t((e["sam-senior"]=e["sam-senior"]||{},e["sam-senior"]["virtual-keyboard"]={}),e.ng.core,e.ng.forms)}(this,function(e,o,t){"use strict";var r=function(){function e(e,t){this.elementRef=e,this.fieldControl=t,this.keyboardPosition="bottom",this.keyboardType="email",this.showOnFocus=!0,this.keyboardValueAccepted=new o.EventEmitter,this.showKeyboardChange=new o.EventEmitter,this._showKeyboard=!1}return Object.defineProperty(e.prototype,"activateKeyboard",{set:function(e){var t,o;e&&(this.keyboardElement=this.elementRef.nativeElement,this.keyboardjQueryElement=(t=this.keyboardElement,(o=window).jQuery?o.jQuery(t):null),this.keyboardjQueryElement&&this.keyboardjQueryElement.keyboard(this.createKeyboardOptions()))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"showKeyboard",{get:function(){return this._showKeyboard},set:function(e){this._showKeyboard=e,this.showKeyboardChange.emit(this._showKeyboard)},enumerable:!0,configurable:!0}),e.prototype.ngOnChanges=function(){this.showKeyboard&&this.isKeyboardCreated()&&this.keyboardjQueryElement.getkeyboard().reveal()},e.prototype.ngOnDestroy=function(){this.isKeyboardCreated()&&this.keyboardjQueryElement.keyboard().getkeyboard().destroy()},e.prototype.isKeyboardCreated=function(){return this.keyboardjQueryElement&&this.keyboardjQueryElement.keyboard()&&this.keyboardjQueryElement.keyboard().getkeyboard()},e.prototype.getDefaultKeyboardOptions=function(){var e={};return this.showOnFocus||(e.openOn=""),e.usePreview=!1,e.autoAccept=!0,e.accepted=this.onValueAccepted.bind(this),e.visible=this.onKeyboardVisible.bind(this),e.beforeClose=this.onBeforeClose.bind(this),e.change=this.onChange.bind(this),e},e.prototype.getKeyboardDisplayOptions=function(){return{bksp:"←",normal:"ABC",meta1:"%?@",meta2:"#+=",accept:"OK"}},e.prototype.getKeyboardLayout=function(){var e={};return"alphanumeric"===this.keyboardType?e={normal:["1 2 3 4 5 6 7 8 9 0","Q W E R T Y U I O P {bksp}","A S D F G H J K L Ç","Z X C V B N M {accept}"]}:"email"===this.keyboardType&&(e=this.getCustomKeyboardForEmail()),e},e.prototype.getCustomKeyboardForEmail=function(){return{normal:["1 2 3 4 5 6 7 8 9 0","q w e r t y u i o p {bksp}","a s d f g h j k l ç","{s} z x c v b n m .","{meta1} {space} _ - {accept}"],shift:["1 2 3 4 5 6 7 8 9 0","Q W E R T Y U I O P {bksp}","A S D F G H J K L Ç","{s} Z X C V B N M .","{meta1} {space} _ - {accept}"],meta1:["` | { } % ^ * / ' {bksp}","{meta2} $ & ~ # = + @","{normal} {space} ! ? {accept}"],meta2:['[ ] { } ‹ › ^ * " , {bksp}',"\\ | / < > $ £ ¥ •","{meta1} € & ~ # = + .","{normal} {space} ! ? {accept}"]}},e.prototype.createKeyboardOptions=function(){var e=this.getDefaultKeyboardOptions();return"relative"!==this.keyboardPosition&&(e.position=!1),"bottom"===this.keyboardPosition&&this.addBottomKeyboardClass(),e.css={buttonDefault:"keyboard-button-override"},e.display=this.getKeyboardDisplayOptions(),e.layout="custom",e.customLayout=this.getKeyboardLayout(),e},e.prototype.onKeyboardVisible=function(){this.addCustomKeyboardFocusClass()},e.prototype.onBeforeClose=function(){this.showKeyboard=!1},e.prototype.onValueAccepted=function(){var e=this.keyboardElement;this.keyboardValueAccepted.emit(e.value)},e.prototype.onChange=function(e){var t=new CustomEvent("virtualkeyboardevent",e);if(document.dispatchEvent(t),this.keyboardElement instanceof HTMLInputElement){var o=this.keyboardElement,r=o.value;if(this.fieldControl){var a=this.fieldControl.control;a.setValue(r),a.markAsDirty(),a.updateValueAndValidity()}setTimeout(function(){o.value=r,o.scrollLeft=o.scrollWidth})}},e.prototype.addBottomKeyboardClass=function(){this.injectCssRule(".ui-keyboard {\n border-radius: 0;\n left: 0;\n top: auto;\n bottom: 0;\n position: fixed;\n width: 100%;\n }")},e.prototype.addCustomKeyboardFocusClass=function(){this.injectCssRule(".ui-keyboard-has-focus {\n z-index: 900;\n }")},e.prototype.injectCssRule=function(e){var t=document.createElement("style");t.appendChild(document.createTextNode("")),document.head.appendChild(t),t.sheet.insertRule(e)},e.decorators=[{type:o.Directive,args:[{selector:"[samVirtualKeyboard]"}]}],e.ctorParameters=function(){return[{type:o.ElementRef},{type:t.NgControl,decorators:[{type:o.Optional}]}]},e.propDecorators={keyboardPosition:[{type:o.Input}],keyboardType:[{type:o.Input}],activateKeyboard:[{type:o.Input}],showOnFocus:[{type:o.Input}],showKeyboard:[{type:o.Input}],keyboardValueAccepted:[{type:o.Output}],showKeyboardChange:[{type:o.Output}]},e}(),a=function(){function e(){}return e.decorators=[{type:o.NgModule,args:[{declarations:[r],exports:[r]}]}],e}();e.VirtualKeyboardModule=a,e.ɵa=r,Object.defineProperty(e,"__esModule",{value:!0})});
2
- //# sourceMappingURL=sam-senior-virtual-keyboard.umd.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["ng://@sam-senior/virtual-keyboard/lib/virtual-keyboard.directive.ts","ng://@sam-senior/virtual-keyboard/lib/virtual-keyboard.module.ts"],"names":["VirtualKeyboardDirective","elementRef","fieldControl","this","keyboardPosition","keyboardType","showOnFocus","keyboardValueAccepted","EventEmitter","showKeyboardChange","_showKeyboard","Object","defineProperty","prototype","activateKeyboard","element","windowInstance","keyboardElement","keyboardjQueryElement","jQuery","keyboard","createKeyboardOptions","revealKeyboard","emit","ngOnChanges","showKeyboard","isKeyboardCreated","getkeyboard","reveal","ngOnDestroy","destroy","getDefaultKeyboardOptions","keyboardOptions","openOn","usePreview","autoAccept","accepted","onValueAccepted","bind","visible","onKeyboardVisible","beforeClose","onBeforeClose","change","onChange","getKeyboardDisplayOptions","bksp","normal","meta1","meta2","accept","getKeyboardLayout","customLayout","getCustomKeyboardForEmail","shift","position","addBottomKeyboardClass","css","buttonDefault","display","layout","addCustomKeyboardFocusClass","casted","value","event","virtualkeyboardevent","CustomEvent","document","dispatchEvent","HTMLInputElement","keyboardElement_1","inputVal_1","formControl","control","setValue","markAsDirty","updateValueAndValidity","setTimeout","scrollLeft","scrollWidth","injectCssRule","rule","style","createElement","appendChild","createTextNode","head","sheet","insertRule","Directive","args","selector","ElementRef","NgControl","decorators","type","Optional","Input","Output","VirtualKeyboardModule","NgModule","declarations","exports"],"mappings":"uZAoDE,SAAAA,EACSC,EACYC,GADZC,KAAAF,WAAAA,EACYE,KAAAD,aAAAA,EAhCJC,KAA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EAAYG,cACZH,EAAYI,yBAKdC,WAAU,WACRP,EAAgBP,MAAQQ,EACxBD,EAAgBQ,WAAaR,EAAgBS,gBAK3C/E,EAAAa,UAAA2C,uBAAR,WACErD,KAAK6E,cACH,iKAWIhF,EAAAa,UAAAgD,4BAAR,WACE1D,KAAK6E,cACH,6DAMIhF,EAAAa,UAAAmE,cAAR,SAAsBC,OACdC,EAAQf,SAASgB,cAAc,SACrCD,EAAME,YAAYjB,SAASkB,eAAe,KAC1ClB,SAASmB,KAAKF,YAAYF,GAC1BA,EAAMK,MAAMC,WAAWP,wBAtN1BQ,EAAAA,UAASC,KAAA,CAAC,CACTC,SAAU,oEAjB8BC,EAAAA,kBACjCC,EAAAA,UAASC,WAAA,CAAA,CAAAC,KAqDbC,EAAAA,wDAhCFC,EAAAA,4BACAA,EAAAA,gCACAA,EAAAA,2BASAA,EAAAA,4BACAA,EAAAA,qCASAC,EAAAA,mCACAA,EAAAA,UA4LHlG,KCxOAmG,EAAA,WAGA,SAAAA,KAIqC,2BAJpCC,EAAAA,SAAQV,KAAA,CAAC,CACRW,aAAc,CAACrG,GACfsG,QAAS,CAACtG,OAEyBmG,EAPrC","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"]}