@starley/ion-directives 1.1.0 → 1.1.2
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/dist/cjs/directives/input-mask/input-mask.directive.js +1 -3
- package/dist/cjs/directives/input-mask/input-mask.directive.js.map +1 -1
- package/dist/cjs/index.js +7 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/directives/input-mask/input-mask.directive.js +1 -3
- package/dist/directives/input-mask/input-mask.directive.js.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +5 -2
- package/dist/cjs/directives/directive.module.js +0 -34
- package/dist/cjs/directives/directive.module.js.map +0 -1
- package/dist/directives/directive.module.js +0 -31
- package/dist/directives/directive.module.js.map +0 -1
- package/src/directives/directive.module.ts +0 -28
- package/src/directives/input-mask/input-mask.directive.ts +0 -70
- package/src/directives/press-hold/press-hold.directive.ts +0 -66
- package/src/directives/tap/tap.directive.ts +0 -70
- package/src/index.ts +0 -1
- package/tsconfig.json +0 -30
- package/tslint.json +0 -17
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.IonInputMaskDirective = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
/* eslint-disable @angular-eslint/no-host-metadata-property */
|
|
6
|
-
/* eslint-disable @angular-eslint/directive-selector */
|
|
7
5
|
const core_1 = require("@angular/core");
|
|
8
6
|
const forms_1 = require("@angular/forms");
|
|
9
7
|
/**
|
|
@@ -60,7 +58,7 @@ let IonInputMaskDirective = class IonInputMaskDirective {
|
|
|
60
58
|
};
|
|
61
59
|
IonInputMaskDirective = tslib_1.__decorate([
|
|
62
60
|
(0, core_1.Directive)({
|
|
63
|
-
selector: '[
|
|
61
|
+
selector: '[appMask]',
|
|
64
62
|
host: {
|
|
65
63
|
'(keydown)': 'onKeyDown($event)'
|
|
66
64
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-mask.directive.js","sourceRoot":"","sources":["../../../../src/directives/input-mask/input-mask.directive.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"input-mask.directive.js","sourceRoot":"","sources":["../../../../src/directives/input-mask/input-mask.directive.ts"],"names":[],"mappings":";;;;AAAA,wCAAqD;AACrD,0CAAyC;AAEzC;;GAEG;AAQI,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAI9B;;;;OAIG;IACH,YAAmB,KAAc,EACV,OAAe;QADnB,UAAK,GAAL,KAAK,CAAS;QAE7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IACpC,CAAC;IAED;;;OAGG;IACH,SAAS,CAAC,KAAU;QAChB,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,EAC1B,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC3B,IAAI,KAAK,CAAC,aAAa,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,KAAK,CAAC,IAAI,KAAK,CAAC,GAAG,KAAK,WAAW,EAAE;YACtF,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,6EAA6E;gBAC7F,sDAAsD;gBACtD,OAAO,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,GAAG,EAAE;oBAC3D,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;iBAChD;gBACD,sDAAsD;gBACtD,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;oBACrD,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;iBAChD;aACJ;SACJ;aAAM;YACH,IAAI,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC;YAC7B,IAAI,SAAS,GAAG,EAAE,CAAC;YACnB,SAAS,IAAI,KAAK,CAAC;YACnB,IAAI,SAAS,GAAG,OAAO,CAAC,MAAM,EAAE;gBAC5B,2BAA2B;gBAC3B,OAAO,OAAO,CAAC,SAAS,CAAC,KAAK,GAAG,EAAE;oBAC/B,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC;oBAChC,SAAS,EAAE,CAAC;iBACf;aACJ;YACD,KAAK,GAAG,SAAS,CAAC;SACrB;QACD,KAAK,CAAC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;QAC3B,IAAI,IAAI,CAAC,KAAK,EAAE;YACZ,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACjC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CAEJ,CAAA;AAtDY,qBAAqB;IAPjC,IAAA,gBAAS,EAAC;QACP,QAAQ,EAAE,WAAW;QACrB,IAAI,EAAE;YACF,WAAW,EAAE,mBAAmB;SACnC;QACD,SAAS,EAAE,CAAC,eAAO,CAAC;KACvB,CAAC;IAWO,mBAAA,IAAA,gBAAS,EAAC,MAAM,CAAC,CAAA;GAVb,qBAAqB,CAsDjC;AAtDY,sDAAqB"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
exports.TapDirective = exports.PressHoldDirective = exports.IonInputMaskDirective = void 0;
|
|
4
|
+
var input_mask_directive_1 = require("./directives/input-mask/input-mask.directive");
|
|
5
|
+
Object.defineProperty(exports, "IonInputMaskDirective", { enumerable: true, get: function () { return input_mask_directive_1.IonInputMaskDirective; } });
|
|
6
|
+
var press_hold_directive_1 = require("./directives/press-hold/press-hold.directive");
|
|
7
|
+
Object.defineProperty(exports, "PressHoldDirective", { enumerable: true, get: function () { return press_hold_directive_1.PressHoldDirective; } });
|
|
8
|
+
var tap_directive_1 = require("./directives/tap/tap.directive");
|
|
9
|
+
Object.defineProperty(exports, "TapDirective", { enumerable: true, get: function () { return tap_directive_1.TapDirective; } });
|
|
5
10
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,qFAAqF;AAA5E,6HAAA,qBAAqB,OAAA;AAC9B,qFAAkF;AAAzE,0HAAA,kBAAkB,OAAA;AAC3B,gEAA8D;AAArD,6GAAA,YAAY,OAAA"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { __decorate, __param } from "tslib";
|
|
2
|
-
/* eslint-disable @angular-eslint/no-host-metadata-property */
|
|
3
|
-
/* eslint-disable @angular-eslint/directive-selector */
|
|
4
2
|
import { Attribute, Directive } from '@angular/core';
|
|
5
3
|
import { NgModel } from "@angular/forms";
|
|
6
4
|
/**
|
|
@@ -57,7 +55,7 @@ let IonInputMaskDirective = class IonInputMaskDirective {
|
|
|
57
55
|
};
|
|
58
56
|
IonInputMaskDirective = __decorate([
|
|
59
57
|
Directive({
|
|
60
|
-
selector: '[
|
|
58
|
+
selector: '[appMask]',
|
|
61
59
|
host: {
|
|
62
60
|
'(keydown)': 'onKeyDown($event)'
|
|
63
61
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-mask.directive.js","sourceRoot":"","sources":["../../../src/directives/input-mask/input-mask.directive.ts"],"names":[],"mappings":";AAAA,
|
|
1
|
+
{"version":3,"file":"input-mask.directive.js","sourceRoot":"","sources":["../../../src/directives/input-mask/input-mask.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC;;GAEG;AAQI,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAI9B;;;;OAIG;IACH,YAAmB,KAAc,EACV,OAAe;QADnB,UAAK,GAAL,KAAK,CAAS;QAE7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IACpC,CAAC;IAED;;;OAGG;IACH,SAAS,CAAC,KAAU;QAChB,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,EAC1B,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC3B,IAAI,KAAK,CAAC,aAAa,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,KAAK,CAAC,IAAI,KAAK,CAAC,GAAG,KAAK,WAAW,EAAE;YACtF,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,6EAA6E;gBAC7F,sDAAsD;gBACtD,OAAO,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,GAAG,EAAE;oBAC3D,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;iBAChD;gBACD,sDAAsD;gBACtD,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;oBACrD,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;iBAChD;aACJ;SACJ;aAAM;YACH,IAAI,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC;YAC7B,IAAI,SAAS,GAAG,EAAE,CAAC;YACnB,SAAS,IAAI,KAAK,CAAC;YACnB,IAAI,SAAS,GAAG,OAAO,CAAC,MAAM,EAAE;gBAC5B,2BAA2B;gBAC3B,OAAO,OAAO,CAAC,SAAS,CAAC,KAAK,GAAG,EAAE;oBAC/B,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC;oBAChC,SAAS,EAAE,CAAC;iBACf;aACJ;YACD,KAAK,GAAG,SAAS,CAAC;SACrB;QACD,KAAK,CAAC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;QAC3B,IAAI,IAAI,CAAC,KAAK,EAAE;YACZ,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACjC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CAEJ,CAAA;AAtDY,qBAAqB;IAPjC,SAAS,CAAC;QACP,QAAQ,EAAE,WAAW;QACrB,IAAI,EAAE;YACF,WAAW,EAAE,mBAAmB;SACnC;QACD,SAAS,EAAE,CAAC,OAAO,CAAC;KACvB,CAAC;IAWO,WAAA,SAAS,CAAC,MAAM,CAAC,CAAA;GAVb,qBAAqB,CAsDjC;SAtDY,qBAAqB"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { IonInputMaskDirective } from './directives/input-mask/input-mask.directive';
|
|
2
|
+
export { PressHoldDirective } from './directives/press-hold/press-hold.directive';
|
|
3
|
+
export { TapDirective } from './directives/tap/tap.directive';
|
|
2
4
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@starley/ion-directives",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Directivas internas para ionic",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
-
"
|
|
6
|
+
"module": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
7
10
|
"scripts": {
|
|
8
11
|
"build": "rm -rf dist/ && npm run build:esm && npm run build:cjs",
|
|
9
12
|
"build:esm": "tsc",
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DirectivesModule = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const core_1 = require("@angular/core");
|
|
6
|
-
const common_1 = require("@angular/common");
|
|
7
|
-
const press_hold_directive_1 = require("./press-hold/press-hold.directive");
|
|
8
|
-
const tap_directive_1 = require("./tap/tap.directive");
|
|
9
|
-
const input_mask_directive_1 = require("./input-mask/input-mask.directive");
|
|
10
|
-
/**
|
|
11
|
-
* Gerencia precionamento de enventos
|
|
12
|
-
* @author Starley Cazorla
|
|
13
|
-
*/
|
|
14
|
-
let DirectivesModule = class DirectivesModule {
|
|
15
|
-
};
|
|
16
|
-
DirectivesModule = tslib_1.__decorate([
|
|
17
|
-
(0, core_1.NgModule)({
|
|
18
|
-
declarations: [
|
|
19
|
-
press_hold_directive_1.PressHoldDirective,
|
|
20
|
-
tap_directive_1.TapDirective,
|
|
21
|
-
input_mask_directive_1.IonInputMaskDirective
|
|
22
|
-
],
|
|
23
|
-
imports: [
|
|
24
|
-
common_1.CommonModule
|
|
25
|
-
],
|
|
26
|
-
exports: [
|
|
27
|
-
press_hold_directive_1.PressHoldDirective,
|
|
28
|
-
tap_directive_1.TapDirective,
|
|
29
|
-
input_mask_directive_1.IonInputMaskDirective
|
|
30
|
-
]
|
|
31
|
-
})
|
|
32
|
-
], DirectivesModule);
|
|
33
|
-
exports.DirectivesModule = DirectivesModule;
|
|
34
|
-
//# sourceMappingURL=directive.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"directive.module.js","sourceRoot":"","sources":["../../../src/directives/directive.module.ts"],"names":[],"mappings":";;;;AAAA,wCAAyC;AACzC,4CAA+C;AAC/C,4EAAuE;AACvE,uDAAmD;AACnD,4EAA0E;AAE1E;;;GAGG;AAkBI,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAAI,CAAA;AAApB,gBAAgB;IAhB5B,IAAA,eAAQ,EAAC;QACN,YAAY,EAAE;YACV,yCAAkB;YAClB,4BAAY;YACZ,4CAAqB;SACxB;QACD,OAAO,EAAE;YACL,qBAAY;SACf;QACD,OAAO,EAAE;YACL,yCAAkB;YAClB,4BAAY;YACZ,4CAAqB;SACxB;KAEJ,CAAC;GACW,gBAAgB,CAAI;AAApB,4CAAgB"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import { NgModule } from '@angular/core';
|
|
3
|
-
import { CommonModule } from '@angular/common';
|
|
4
|
-
import { PressHoldDirective } from './press-hold/press-hold.directive';
|
|
5
|
-
import { TapDirective } from './tap/tap.directive';
|
|
6
|
-
import { IonInputMaskDirective } from './input-mask/input-mask.directive';
|
|
7
|
-
/**
|
|
8
|
-
* Gerencia precionamento de enventos
|
|
9
|
-
* @author Starley Cazorla
|
|
10
|
-
*/
|
|
11
|
-
let DirectivesModule = class DirectivesModule {
|
|
12
|
-
};
|
|
13
|
-
DirectivesModule = __decorate([
|
|
14
|
-
NgModule({
|
|
15
|
-
declarations: [
|
|
16
|
-
PressHoldDirective,
|
|
17
|
-
TapDirective,
|
|
18
|
-
IonInputMaskDirective
|
|
19
|
-
],
|
|
20
|
-
imports: [
|
|
21
|
-
CommonModule
|
|
22
|
-
],
|
|
23
|
-
exports: [
|
|
24
|
-
PressHoldDirective,
|
|
25
|
-
TapDirective,
|
|
26
|
-
IonInputMaskDirective
|
|
27
|
-
]
|
|
28
|
-
})
|
|
29
|
-
], DirectivesModule);
|
|
30
|
-
export { DirectivesModule };
|
|
31
|
-
//# sourceMappingURL=directive.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"directive.module.js","sourceRoot":"","sources":["../../src/directives/directive.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE1E;;;GAGG;AAkBI,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAAI,CAAA;AAApB,gBAAgB;IAhB5B,QAAQ,CAAC;QACN,YAAY,EAAE;YACV,kBAAkB;YAClB,YAAY;YACZ,qBAAqB;SACxB;QACD,OAAO,EAAE;YACL,YAAY;SACf;QACD,OAAO,EAAE;YACL,kBAAkB;YAClB,YAAY;YACZ,qBAAqB;SACxB;KAEJ,CAAC;GACW,gBAAgB,CAAI;SAApB,gBAAgB"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { PressHoldDirective } from './press-hold/press-hold.directive';
|
|
4
|
-
import { TapDirective } from './tap/tap.directive';
|
|
5
|
-
import { IonInputMaskDirective } from './input-mask/input-mask.directive';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Gerencia precionamento de enventos
|
|
9
|
-
* @author Starley Cazorla
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
@NgModule({
|
|
13
|
-
declarations: [
|
|
14
|
-
PressHoldDirective,
|
|
15
|
-
TapDirective,
|
|
16
|
-
IonInputMaskDirective
|
|
17
|
-
],
|
|
18
|
-
imports: [
|
|
19
|
-
CommonModule
|
|
20
|
-
],
|
|
21
|
-
exports: [
|
|
22
|
-
PressHoldDirective,
|
|
23
|
-
TapDirective,
|
|
24
|
-
IonInputMaskDirective
|
|
25
|
-
]
|
|
26
|
-
|
|
27
|
-
})
|
|
28
|
-
export class DirectivesModule { }
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @angular-eslint/no-host-metadata-property */
|
|
2
|
-
/* eslint-disable @angular-eslint/directive-selector */
|
|
3
|
-
import { Attribute, Directive } from '@angular/core';
|
|
4
|
-
import { NgModel } from "@angular/forms";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Responsavel pelo mascaramento de inputs
|
|
8
|
-
*/
|
|
9
|
-
@Directive({
|
|
10
|
-
selector: '[mask]',
|
|
11
|
-
host: {
|
|
12
|
-
'(keydown)': 'onKeyDown($event)'
|
|
13
|
-
},
|
|
14
|
-
providers: [NgModel]
|
|
15
|
-
})
|
|
16
|
-
export class IonInputMaskDirective {
|
|
17
|
-
|
|
18
|
-
pattern: string;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Construtor
|
|
22
|
-
* @param {NgModel} model
|
|
23
|
-
* @param {string} pattern
|
|
24
|
-
*/
|
|
25
|
-
constructor(public model: NgModel,
|
|
26
|
-
@Attribute('mask') pattern: string) {
|
|
27
|
-
this.pattern = pattern;
|
|
28
|
-
|
|
29
|
-
console.log('Inicou inputMask');
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Listener para mudança de valor do input
|
|
34
|
-
* @param event
|
|
35
|
-
*/
|
|
36
|
-
onKeyDown(event: any) {
|
|
37
|
-
let value = event.target.value,
|
|
38
|
-
pattern = this.pattern;
|
|
39
|
-
if (event.keyIdentifier === 'U+0008' || event.keyCode === 8 || event.key === 'Backspace') {
|
|
40
|
-
if (value.length) { //prevent fatal exception when backspacing empty value in progressive web app
|
|
41
|
-
//remove all trailing formatting then delete character
|
|
42
|
-
while (pattern[value.length] && pattern[value.length] !== '*') {
|
|
43
|
-
value = value.substring(0, value.length - 1);
|
|
44
|
-
}
|
|
45
|
-
//remove all leading formatting to restore placeholder
|
|
46
|
-
if (pattern.substring(0, value.length).indexOf('*') < 0) {
|
|
47
|
-
value = value.substring(0, value.length - 1);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
} else {
|
|
51
|
-
let maskIndex = value.length;
|
|
52
|
-
let formatted = '';
|
|
53
|
-
formatted += value;
|
|
54
|
-
if (maskIndex < pattern.length) {
|
|
55
|
-
//apply trailing formatting
|
|
56
|
-
while (pattern[maskIndex] !== '*') {
|
|
57
|
-
formatted += pattern[maskIndex];
|
|
58
|
-
maskIndex++;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
value = formatted;
|
|
62
|
-
}
|
|
63
|
-
event.target.value = value;
|
|
64
|
-
if (this.model) {
|
|
65
|
-
this.model.update.emit(value);
|
|
66
|
-
}
|
|
67
|
-
return true;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { Directive, EventEmitter, HostListener, OnInit, Output } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Gerencia pressHold
|
|
5
|
-
* @author Starley Cazorla
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
@Directive({
|
|
9
|
-
selector: '[appPressHold]'
|
|
10
|
-
})
|
|
11
|
-
export class PressHoldDirective implements OnInit {
|
|
12
|
-
|
|
13
|
-
@Output() press = new EventEmitter();
|
|
14
|
-
pressGesture = {
|
|
15
|
-
name: 'press',
|
|
16
|
-
enabled: false,
|
|
17
|
-
interval: 350
|
|
18
|
-
};
|
|
19
|
-
pressTimeout: any = null;
|
|
20
|
-
isPressing: boolean = false;
|
|
21
|
-
lastTap = 0;
|
|
22
|
-
tapCount = 0;
|
|
23
|
-
tapTimeout: any = null;
|
|
24
|
-
|
|
25
|
-
constructor() {
|
|
26
|
-
console.log('Inicou appPressHold');
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
ngOnInit(): void {
|
|
30
|
-
this.pressGesture.enabled = true;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
@HostListener('touchstart', ['$event'])
|
|
34
|
-
@HostListener('touchend', ['$event'])
|
|
35
|
-
onPress(event: { type: any; }) {
|
|
36
|
-
if (!this.pressGesture.enabled) {
|
|
37
|
-
return;
|
|
38
|
-
} // Press is not enabled, don't do anything.
|
|
39
|
-
this.handlePressing(event.type);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
private handlePressing(type: string) { // touchend or touchstart
|
|
43
|
-
if (type == 'touchstart') {
|
|
44
|
-
this.pressTimeout = setTimeout(() => {
|
|
45
|
-
this.isPressing = true;
|
|
46
|
-
}, this.pressGesture.interval); // Considered a press if it's longer than interval (default: 251).
|
|
47
|
-
} else if (type == 'touchend') {
|
|
48
|
-
clearTimeout(this.pressTimeout);
|
|
49
|
-
if (this.isPressing) {
|
|
50
|
-
this.press.emit('end');
|
|
51
|
-
this.resetTaps(); // Just incase this gets passed as a tap event too.
|
|
52
|
-
}
|
|
53
|
-
// Clicks have a natural delay of 300ms, so we have to account for that, before resetting isPressing.
|
|
54
|
-
// Otherwise a tap event is emitted.
|
|
55
|
-
setTimeout(() => this.isPressing = false, 50);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
private resetTaps() {
|
|
60
|
-
clearTimeout(this.tapTimeout); // clear the old timeout
|
|
61
|
-
this.tapCount = 0;
|
|
62
|
-
this.tapTimeout = null;
|
|
63
|
-
this.lastTap = 0;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { Directive, EventEmitter, HostListener, OnInit, Output } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Gerencia tap e doubleTap
|
|
5
|
-
* @author Starley Cazorla
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
@Directive({
|
|
9
|
-
selector: '[appTap]'
|
|
10
|
-
})
|
|
11
|
-
export class TapDirective implements OnInit {
|
|
12
|
-
|
|
13
|
-
@Output() tap = new EventEmitter();
|
|
14
|
-
@Output() doubleTap = new EventEmitter();
|
|
15
|
-
lastTap = 0;
|
|
16
|
-
tapCount = 0;
|
|
17
|
-
tapTimeout: any = null;
|
|
18
|
-
tapGesture = {
|
|
19
|
-
name: 'tap',
|
|
20
|
-
enabled: false,
|
|
21
|
-
interval: 250,
|
|
22
|
-
};
|
|
23
|
-
doubleTapGesture = {
|
|
24
|
-
name: 'doubleTap',
|
|
25
|
-
enabled: false,
|
|
26
|
-
interval: 300,
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
constructor() {
|
|
30
|
-
console.log('Inicou appTap');
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
ngOnInit(): void {
|
|
34
|
-
this.tapGesture.enabled = true;
|
|
35
|
-
this.doubleTapGesture.enabled = true;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
@HostListener('click', ['$event'])
|
|
39
|
-
handleTaps(e: { timeStamp: number; }) {
|
|
40
|
-
const tapTimestamp = Math.floor(e.timeStamp);
|
|
41
|
-
const isDoubleTap = this.lastTap + this.tapGesture.interval > tapTimestamp;
|
|
42
|
-
if (!this.tapGesture.enabled && !this.doubleTapGesture.enabled) {
|
|
43
|
-
return this.resetTaps();
|
|
44
|
-
}
|
|
45
|
-
this.tapCount++;
|
|
46
|
-
if (isDoubleTap && this.doubleTapGesture.enabled) {
|
|
47
|
-
this.emitTaps();
|
|
48
|
-
} else if (!isDoubleTap) {
|
|
49
|
-
this.tapTimeout = setTimeout(() => this.emitTaps(), this.tapGesture.interval);
|
|
50
|
-
}
|
|
51
|
-
this.lastTap = tapTimestamp;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
private emitTaps() {
|
|
55
|
-
if (this.tapCount === 1 && this.tapGesture.enabled) {
|
|
56
|
-
this.tap.emit();
|
|
57
|
-
} else if (this.tapCount === 2 && this.doubleTapGesture.enabled) {
|
|
58
|
-
this.doubleTap.emit();
|
|
59
|
-
}
|
|
60
|
-
this.resetTaps();
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
private resetTaps() {
|
|
64
|
-
clearTimeout(this.tapTimeout); // clear the old timeout
|
|
65
|
-
this.tapCount = 0;
|
|
66
|
-
this.tapTimeout = null;
|
|
67
|
-
this.lastTap = 0;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './directives/directive.module';
|
package/tsconfig.json
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
|
2
|
-
{
|
|
3
|
-
"compileOnSave": false,
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"baseUrl": "./",
|
|
6
|
-
"outDir": "./dist",
|
|
7
|
-
"forceConsistentCasingInFileNames": true,
|
|
8
|
-
"allowSyntheticDefaultImports": true,
|
|
9
|
-
"strict": true,
|
|
10
|
-
"noImplicitOverride": true,
|
|
11
|
-
"noPropertyAccessFromIndexSignature": true,
|
|
12
|
-
"noImplicitReturns": true,
|
|
13
|
-
"noFallthroughCasesInSwitch": true,
|
|
14
|
-
"sourceMap": true,
|
|
15
|
-
"declaration": false,
|
|
16
|
-
"downlevelIteration": true,
|
|
17
|
-
"experimentalDecorators": true,
|
|
18
|
-
"moduleResolution": "node",
|
|
19
|
-
"importHelpers": true,
|
|
20
|
-
"target": "es2015",
|
|
21
|
-
"module": "es2020",
|
|
22
|
-
"lib": [
|
|
23
|
-
"es2018",
|
|
24
|
-
"dom"
|
|
25
|
-
],
|
|
26
|
-
"useDefineForClassFields": false
|
|
27
|
-
},
|
|
28
|
-
"include": ["src/**/*"],
|
|
29
|
-
"exclude": ["node_modules", "**/*.test.ts"]
|
|
30
|
-
}
|
package/tslint.json
DELETED