@starley/ion-directives 1.1.5 → 1.1.6
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/package.json +1 -1
- package/src/index.ts +6 -6
- package/tsconfig.json +0 -1
- package/dist/directives/input-mask/input-mask.directive.d.ts +0 -19
- package/dist/directives/input-mask/input-mask.directive.js +0 -67
- package/dist/directives/input-mask/input-mask.directive.js.map +0 -1
- package/dist/directives/input-mask/input-mask.module.d.ts +0 -2
- package/dist/directives/input-mask/input-mask.module.js +0 -14
- package/dist/directives/input-mask/input-mask.module.js.map +0 -1
- package/dist/directives/press-hold/press-hold.directive.d.ts +0 -25
- package/dist/directives/press-hold/press-hold.directive.js +0 -68
- package/dist/directives/press-hold/press-hold.directive.js.map +0 -1
- package/dist/directives/press-hold/press-hold.module.d.ts +0 -2
- package/dist/directives/press-hold/press-hold.module.js +0 -14
- package/dist/directives/press-hold/press-hold.module.js.map +0 -1
- package/dist/directives/tap/tap.directive.d.ts +0 -29
- package/dist/directives/tap/tap.directive.js +0 -76
- package/dist/directives/tap/tap.directive.js.map +0 -1
- package/dist/directives/tap/tap.module.d.ts +0 -2
- package/dist/directives/tap/tap.module.js +0 -14
- package/dist/directives/tap/tap.module.js.map +0 -1
- package/dist/index.d.ts +0 -7
- package/dist/index.js +0 -8
- package/dist/index.js.map +0 -1
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
export * from './directives/input-mask/input-mask.directive';
|
|
2
|
+
export * from './directives/press-hold/press-hold.directive';
|
|
3
|
+
export * from './directives/tap/tap.directive';
|
|
4
4
|
/** Modules */
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
5
|
+
export * from './directives/input-mask/input-mask.module';
|
|
6
|
+
export * from './directives/press-hold/press-hold.module';
|
|
7
|
+
export * from './directives/tap/tap.module';
|
package/tsconfig.json
CHANGED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { NgModel } from "@angular/forms";
|
|
2
|
-
/**
|
|
3
|
-
* Responsavel pelo mascaramento de inputs
|
|
4
|
-
*/
|
|
5
|
-
export declare class IonInputMaskDirective {
|
|
6
|
-
model: NgModel;
|
|
7
|
-
pattern: string;
|
|
8
|
-
/**
|
|
9
|
-
* Construtor
|
|
10
|
-
* @param {NgModel} model
|
|
11
|
-
* @param {string} pattern
|
|
12
|
-
*/
|
|
13
|
-
constructor(model: NgModel, pattern: string);
|
|
14
|
-
/**
|
|
15
|
-
* Listener para mudança de valor do input
|
|
16
|
-
* @param event
|
|
17
|
-
*/
|
|
18
|
-
onKeyDown(event: any): boolean;
|
|
19
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from "tslib";
|
|
2
|
-
import { Attribute, Directive } from '@angular/core';
|
|
3
|
-
import { NgModel } from "@angular/forms";
|
|
4
|
-
/**
|
|
5
|
-
* Responsavel pelo mascaramento de inputs
|
|
6
|
-
*/
|
|
7
|
-
let IonInputMaskDirective = class IonInputMaskDirective {
|
|
8
|
-
/**
|
|
9
|
-
* Construtor
|
|
10
|
-
* @param {NgModel} model
|
|
11
|
-
* @param {string} pattern
|
|
12
|
-
*/
|
|
13
|
-
constructor(model, pattern) {
|
|
14
|
-
this.model = model;
|
|
15
|
-
this.pattern = pattern;
|
|
16
|
-
console.log('Inicou inputMask');
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Listener para mudança de valor do input
|
|
20
|
-
* @param event
|
|
21
|
-
*/
|
|
22
|
-
onKeyDown(event) {
|
|
23
|
-
let value = event.target.value, pattern = this.pattern;
|
|
24
|
-
if (event.keyIdentifier === 'U+0008' || event.keyCode === 8 || event.key === 'Backspace') {
|
|
25
|
-
if (value.length) { //prevent fatal exception when backspacing empty value in progressive web app
|
|
26
|
-
//remove all trailing formatting then delete character
|
|
27
|
-
while (pattern[value.length] && pattern[value.length] !== '*') {
|
|
28
|
-
value = value.substring(0, value.length - 1);
|
|
29
|
-
}
|
|
30
|
-
//remove all leading formatting to restore placeholder
|
|
31
|
-
if (pattern.substring(0, value.length).indexOf('*') < 0) {
|
|
32
|
-
value = value.substring(0, value.length - 1);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
let maskIndex = value.length;
|
|
38
|
-
let formatted = '';
|
|
39
|
-
formatted += value;
|
|
40
|
-
if (maskIndex < pattern.length) {
|
|
41
|
-
//apply trailing formatting
|
|
42
|
-
while (pattern[maskIndex] !== '*') {
|
|
43
|
-
formatted += pattern[maskIndex];
|
|
44
|
-
maskIndex++;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
value = formatted;
|
|
48
|
-
}
|
|
49
|
-
event.target.value = value;
|
|
50
|
-
if (this.model) {
|
|
51
|
-
this.model.update.emit(value);
|
|
52
|
-
}
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
IonInputMaskDirective = __decorate([
|
|
57
|
-
Directive({
|
|
58
|
-
selector: '[appMask]',
|
|
59
|
-
host: {
|
|
60
|
-
'(keydown)': 'onKeyDown($event)'
|
|
61
|
-
},
|
|
62
|
-
providers: [NgModel]
|
|
63
|
-
}),
|
|
64
|
-
__param(1, Attribute('mask'))
|
|
65
|
-
], IonInputMaskDirective);
|
|
66
|
-
export { IonInputMaskDirective };
|
|
67
|
-
//# sourceMappingURL=input-mask.directive.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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;IA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I,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"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import { NgModule } from '@angular/core';
|
|
3
|
-
import { IonInputMaskDirective } from './input-mask.directive';
|
|
4
|
-
let IonInputMaskDirectiveModule = class IonInputMaskDirectiveModule {
|
|
5
|
-
};
|
|
6
|
-
IonInputMaskDirectiveModule = __decorate([
|
|
7
|
-
NgModule({
|
|
8
|
-
declarations: [IonInputMaskDirective],
|
|
9
|
-
imports: [],
|
|
10
|
-
exports: [IonInputMaskDirective]
|
|
11
|
-
})
|
|
12
|
-
], IonInputMaskDirectiveModule);
|
|
13
|
-
export { IonInputMaskDirectiveModule };
|
|
14
|
-
//# sourceMappingURL=input-mask.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"input-mask.module.js","sourceRoot":"","sources":["../../../src/directives/input-mask/input-mask.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAQxD,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;CAAI,CAAA;AAA/B,2BAA2B;IANvC,QAAQ,CAAC;QACR,YAAY,EAAE,CAAC,qBAAqB,CAAC;QACrC,OAAO,EAAE,EACR;QACD,OAAO,EAAE,CAAC,qBAAqB,CAAC;KACjC,CAAC;GACW,2BAA2B,CAAI;SAA/B,2BAA2B"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { EventEmitter, OnInit } from '@angular/core';
|
|
2
|
-
/**
|
|
3
|
-
* Gerencia pressHold
|
|
4
|
-
* @author Starley Cazorla
|
|
5
|
-
*/
|
|
6
|
-
export declare class PressHoldDirective implements OnInit {
|
|
7
|
-
press: EventEmitter<any>;
|
|
8
|
-
pressGesture: {
|
|
9
|
-
name: string;
|
|
10
|
-
enabled: boolean;
|
|
11
|
-
interval: number;
|
|
12
|
-
};
|
|
13
|
-
pressTimeout: any;
|
|
14
|
-
isPressing: boolean;
|
|
15
|
-
lastTap: number;
|
|
16
|
-
tapCount: number;
|
|
17
|
-
tapTimeout: any;
|
|
18
|
-
constructor();
|
|
19
|
-
ngOnInit(): void;
|
|
20
|
-
onPress(event: {
|
|
21
|
-
type: any;
|
|
22
|
-
}): void;
|
|
23
|
-
private handlePressing;
|
|
24
|
-
private resetTaps;
|
|
25
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import { Directive, EventEmitter, HostListener, Output } from '@angular/core';
|
|
3
|
-
/**
|
|
4
|
-
* Gerencia pressHold
|
|
5
|
-
* @author Starley Cazorla
|
|
6
|
-
*/
|
|
7
|
-
let PressHoldDirective = class PressHoldDirective {
|
|
8
|
-
constructor() {
|
|
9
|
-
this.press = new EventEmitter();
|
|
10
|
-
this.pressGesture = {
|
|
11
|
-
name: 'press',
|
|
12
|
-
enabled: false,
|
|
13
|
-
interval: 350
|
|
14
|
-
};
|
|
15
|
-
this.pressTimeout = null;
|
|
16
|
-
this.isPressing = false;
|
|
17
|
-
this.lastTap = 0;
|
|
18
|
-
this.tapCount = 0;
|
|
19
|
-
this.tapTimeout = null;
|
|
20
|
-
console.log('Inicou appPressHold');
|
|
21
|
-
}
|
|
22
|
-
ngOnInit() {
|
|
23
|
-
this.pressGesture.enabled = true;
|
|
24
|
-
}
|
|
25
|
-
onPress(event) {
|
|
26
|
-
if (!this.pressGesture.enabled) {
|
|
27
|
-
return;
|
|
28
|
-
} // Press is not enabled, don't do anything.
|
|
29
|
-
this.handlePressing(event.type);
|
|
30
|
-
}
|
|
31
|
-
handlePressing(type) {
|
|
32
|
-
if (type == 'touchstart') {
|
|
33
|
-
this.pressTimeout = setTimeout(() => {
|
|
34
|
-
this.isPressing = true;
|
|
35
|
-
}, this.pressGesture.interval); // Considered a press if it's longer than interval (default: 251).
|
|
36
|
-
}
|
|
37
|
-
else if (type == 'touchend') {
|
|
38
|
-
clearTimeout(this.pressTimeout);
|
|
39
|
-
if (this.isPressing) {
|
|
40
|
-
this.press.emit('end');
|
|
41
|
-
this.resetTaps(); // Just incase this gets passed as a tap event too.
|
|
42
|
-
}
|
|
43
|
-
// Clicks have a natural delay of 300ms, so we have to account for that, before resetting isPressing.
|
|
44
|
-
// Otherwise a tap event is emitted.
|
|
45
|
-
setTimeout(() => this.isPressing = false, 50);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
resetTaps() {
|
|
49
|
-
clearTimeout(this.tapTimeout); // clear the old timeout
|
|
50
|
-
this.tapCount = 0;
|
|
51
|
-
this.tapTimeout = null;
|
|
52
|
-
this.lastTap = 0;
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
__decorate([
|
|
56
|
-
Output()
|
|
57
|
-
], PressHoldDirective.prototype, "press", void 0);
|
|
58
|
-
__decorate([
|
|
59
|
-
HostListener('touchstart', ['$event']),
|
|
60
|
-
HostListener('touchend', ['$event'])
|
|
61
|
-
], PressHoldDirective.prototype, "onPress", null);
|
|
62
|
-
PressHoldDirective = __decorate([
|
|
63
|
-
Directive({
|
|
64
|
-
selector: '[appPressHold]'
|
|
65
|
-
})
|
|
66
|
-
], PressHoldDirective);
|
|
67
|
-
export { PressHoldDirective };
|
|
68
|
-
//# sourceMappingURL=press-hold.directive.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"press-hold.directive.js","sourceRoot":"","sources":["../../../src/directives/press-hold/press-hold.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAU,MAAM,EAAE,MAAM,eAAe,CAAC;AAEtF;;;GAGG;AAKI,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAc3B;QAZU,UAAK,GAAG,IAAI,YAAY,EAAE,CAAC;QACrC,iBAAY,GAAG;YACX,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,KAAK;YACd,QAAQ,EAAE,GAAG;SAChB,CAAC;QACF,iBAAY,GAAQ,IAAI,CAAC;QACzB,eAAU,GAAY,KAAK,CAAC;QAC5B,YAAO,GAAG,CAAC,CAAC;QACZ,aAAQ,GAAG,CAAC,CAAC;QACb,eAAU,GAAQ,IAAI,CAAC;QAGnB,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;IACtC,CAAC;IAEF,QAAQ;QACJ,IAAI,CAAC,YAAY,CAAC,OAAO,GAAG,IAAI,CAAC;IACrC,CAAC;IAID,OAAO,CAAC,KAAqB;QACzB,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;YAC5B,OAAO;SACV,CAAC,2CAA2C;QAC7C,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IAEO,cAAc,CAAC,IAAY;QAC/B,IAAI,IAAI,IAAI,YAAY,EAAE;YACtB,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC,GAAG,EAAE;gBAChC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;YAC3B,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,kEAAkE;SACrG;aAAM,IAAI,IAAI,IAAI,UAAU,EAAE;YAC3B,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAChC,IAAI,IAAI,CAAC,UAAU,EAAE;gBACjB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACvB,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,mDAAmD;aACxE;YACD,qGAAqG;YACrG,oCAAoC;YACpC,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,GAAG,KAAK,EAAE,EAAE,CAAC,CAAC;SACjD;IACL,CAAC;IAEO,SAAS;QACb,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,wBAAwB;QACvD,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QAClB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;IACrB,CAAC;CAEJ,CAAA;AArDa;IAAT,MAAM,EAAE;iDAA4B;AAsBrC;IAFC,YAAY,CAAC,YAAY,EAAE,CAAC,QAAQ,CAAC,CAAC;IACtC,YAAY,CAAC,UAAU,EAAE,CAAC,QAAQ,CAAC,CAAC;iDAMpC;AA7BQ,kBAAkB;IAH9B,SAAS,CAAC;QACP,QAAQ,EAAE,gBAAgB;KAC7B,CAAC;GACW,kBAAkB,CAuD9B;SAvDY,kBAAkB"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import { NgModule } from '@angular/core';
|
|
3
|
-
import { PressHoldDirective } from './press-hold.directive';
|
|
4
|
-
let PressHoldDirectiveModule = class PressHoldDirectiveModule {
|
|
5
|
-
};
|
|
6
|
-
PressHoldDirectiveModule = __decorate([
|
|
7
|
-
NgModule({
|
|
8
|
-
declarations: [PressHoldDirective],
|
|
9
|
-
imports: [],
|
|
10
|
-
exports: [PressHoldDirective]
|
|
11
|
-
})
|
|
12
|
-
], PressHoldDirectiveModule);
|
|
13
|
-
export { PressHoldDirectiveModule };
|
|
14
|
-
//# sourceMappingURL=press-hold.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"press-hold.module.js","sourceRoot":"","sources":["../../../src/directives/press-hold/press-hold.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAQrD,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;CAAI,CAAA;AAA5B,wBAAwB;IANpC,QAAQ,CAAC;QACR,YAAY,EAAE,CAAC,kBAAkB,CAAC;QAClC,OAAO,EAAE,EACR;QACD,OAAO,EAAE,CAAC,kBAAkB,CAAC;KAC9B,CAAC;GACW,wBAAwB,CAAI;SAA5B,wBAAwB"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { EventEmitter, OnInit } from '@angular/core';
|
|
2
|
-
/**
|
|
3
|
-
* Gerencia tap e doubleTap
|
|
4
|
-
* @author Starley Cazorla
|
|
5
|
-
*/
|
|
6
|
-
export declare class TapDirective implements OnInit {
|
|
7
|
-
tap: EventEmitter<any>;
|
|
8
|
-
doubleTap: EventEmitter<any>;
|
|
9
|
-
lastTap: number;
|
|
10
|
-
tapCount: number;
|
|
11
|
-
tapTimeout: any;
|
|
12
|
-
tapGesture: {
|
|
13
|
-
name: string;
|
|
14
|
-
enabled: boolean;
|
|
15
|
-
interval: number;
|
|
16
|
-
};
|
|
17
|
-
doubleTapGesture: {
|
|
18
|
-
name: string;
|
|
19
|
-
enabled: boolean;
|
|
20
|
-
interval: number;
|
|
21
|
-
};
|
|
22
|
-
constructor();
|
|
23
|
-
ngOnInit(): void;
|
|
24
|
-
handleTaps(e: {
|
|
25
|
-
timeStamp: number;
|
|
26
|
-
}): void;
|
|
27
|
-
private emitTaps;
|
|
28
|
-
private resetTaps;
|
|
29
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import { Directive, EventEmitter, HostListener, Output } from '@angular/core';
|
|
3
|
-
/**
|
|
4
|
-
* Gerencia tap e doubleTap
|
|
5
|
-
* @author Starley Cazorla
|
|
6
|
-
*/
|
|
7
|
-
let TapDirective = class TapDirective {
|
|
8
|
-
constructor() {
|
|
9
|
-
this.tap = new EventEmitter();
|
|
10
|
-
this.doubleTap = new EventEmitter();
|
|
11
|
-
this.lastTap = 0;
|
|
12
|
-
this.tapCount = 0;
|
|
13
|
-
this.tapTimeout = null;
|
|
14
|
-
this.tapGesture = {
|
|
15
|
-
name: 'tap',
|
|
16
|
-
enabled: false,
|
|
17
|
-
interval: 250,
|
|
18
|
-
};
|
|
19
|
-
this.doubleTapGesture = {
|
|
20
|
-
name: 'doubleTap',
|
|
21
|
-
enabled: false,
|
|
22
|
-
interval: 300,
|
|
23
|
-
};
|
|
24
|
-
console.log('Inicou appTap');
|
|
25
|
-
}
|
|
26
|
-
ngOnInit() {
|
|
27
|
-
this.tapGesture.enabled = true;
|
|
28
|
-
this.doubleTapGesture.enabled = true;
|
|
29
|
-
}
|
|
30
|
-
handleTaps(e) {
|
|
31
|
-
const tapTimestamp = Math.floor(e.timeStamp);
|
|
32
|
-
const isDoubleTap = this.lastTap + this.tapGesture.interval > tapTimestamp;
|
|
33
|
-
if (!this.tapGesture.enabled && !this.doubleTapGesture.enabled) {
|
|
34
|
-
return this.resetTaps();
|
|
35
|
-
}
|
|
36
|
-
this.tapCount++;
|
|
37
|
-
if (isDoubleTap && this.doubleTapGesture.enabled) {
|
|
38
|
-
this.emitTaps();
|
|
39
|
-
}
|
|
40
|
-
else if (!isDoubleTap) {
|
|
41
|
-
this.tapTimeout = setTimeout(() => this.emitTaps(), this.tapGesture.interval);
|
|
42
|
-
}
|
|
43
|
-
this.lastTap = tapTimestamp;
|
|
44
|
-
}
|
|
45
|
-
emitTaps() {
|
|
46
|
-
if (this.tapCount === 1 && this.tapGesture.enabled) {
|
|
47
|
-
this.tap.emit();
|
|
48
|
-
}
|
|
49
|
-
else if (this.tapCount === 2 && this.doubleTapGesture.enabled) {
|
|
50
|
-
this.doubleTap.emit();
|
|
51
|
-
}
|
|
52
|
-
this.resetTaps();
|
|
53
|
-
}
|
|
54
|
-
resetTaps() {
|
|
55
|
-
clearTimeout(this.tapTimeout); // clear the old timeout
|
|
56
|
-
this.tapCount = 0;
|
|
57
|
-
this.tapTimeout = null;
|
|
58
|
-
this.lastTap = 0;
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
__decorate([
|
|
62
|
-
Output()
|
|
63
|
-
], TapDirective.prototype, "tap", void 0);
|
|
64
|
-
__decorate([
|
|
65
|
-
Output()
|
|
66
|
-
], TapDirective.prototype, "doubleTap", void 0);
|
|
67
|
-
__decorate([
|
|
68
|
-
HostListener('click', ['$event'])
|
|
69
|
-
], TapDirective.prototype, "handleTaps", null);
|
|
70
|
-
TapDirective = __decorate([
|
|
71
|
-
Directive({
|
|
72
|
-
selector: '[appTap]'
|
|
73
|
-
})
|
|
74
|
-
], TapDirective);
|
|
75
|
-
export { TapDirective };
|
|
76
|
-
//# sourceMappingURL=tap.directive.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tap.directive.js","sourceRoot":"","sources":["../../../src/directives/tap/tap.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAU,MAAM,EAAE,MAAM,eAAe,CAAC;AAEtF;;;GAGG;AAKI,IAAM,YAAY,GAAlB,MAAM,YAAY;IAkBrB;QAhBU,QAAG,GAAG,IAAI,YAAY,EAAE,CAAC;QACzB,cAAS,GAAG,IAAI,YAAY,EAAE,CAAC;QACzC,YAAO,GAAG,CAAC,CAAC;QACZ,aAAQ,GAAG,CAAC,CAAC;QACb,eAAU,GAAQ,IAAI,CAAC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AC,GAAG,CAAC,IAAI,EAAE,CAAC;SACnB;aAAM,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,IAAI,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE;YAC7D,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;SACzB;QACD,IAAI,CAAC,SAAS,EAAE,CAAC;IACrB,CAAC;IAEO,SAAS;QACb,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,wBAAwB;QACvD,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QAClB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;IACrB,CAAC;CAEJ,CAAA;AAzDa;IAAT,MAAM,EAAE;yCAA0B;AACzB;IAAT,MAAM,EAAE;+CAAgC;AAyBzC;IADC,YAAY,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,CAAC;8CAcjC;AAzCQ,YAAY;IAHxB,SAAS,CAAC;QACP,QAAQ,EAAE,UAAU;KACvB,CAAC;GACW,YAAY,CA2DxB;SA3DY,YAAY"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import { NgModule } from '@angular/core';
|
|
3
|
-
import { TapDirective } from './tap.directive';
|
|
4
|
-
let TapDirectiveModule = class TapDirectiveModule {
|
|
5
|
-
};
|
|
6
|
-
TapDirectiveModule = __decorate([
|
|
7
|
-
NgModule({
|
|
8
|
-
declarations: [TapDirective],
|
|
9
|
-
imports: [],
|
|
10
|
-
exports: [TapDirective]
|
|
11
|
-
})
|
|
12
|
-
], TapDirectiveModule);
|
|
13
|
-
export { TapDirectiveModule };
|
|
14
|
-
//# sourceMappingURL=tap.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tap.module.js","sourceRoot":"","sources":["../../../src/directives/tap/tap.module.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAQxC,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;CAAI,CAAA;AAAtB,kBAAkB;IAN9B,QAAQ,CAAC;QACN,YAAY,EAAE,CAAC,YAAY,CAAC;QAC5B,OAAO,EAAE,EACR;QACD,OAAO,EAAE,CAAC,YAAY,CAAC;KAC1B,CAAC;GACW,kBAAkB,CAAI;SAAtB,kBAAkB"}
|
package/dist/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
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';
|
|
4
|
-
/** Modules */
|
|
5
|
-
export { IonInputMaskDirectiveModule } from './directives/input-mask/input-mask.module';
|
|
6
|
-
export { PressHoldDirectiveModule } from './directives/press-hold/press-hold.module';
|
|
7
|
-
export { TapDirectiveModule } from './directives/tap/tap.module';
|
package/dist/index.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
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';
|
|
4
|
-
/** Modules */
|
|
5
|
-
export { IonInputMaskDirectiveModule } from './directives/input-mask/input-mask.module';
|
|
6
|
-
export { PressHoldDirectiveModule } from './directives/press-hold/press-hold.module';
|
|
7
|
-
export { TapDirectiveModule } from './directives/tap/tap.module';
|
|
8
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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;AAC9D,cAAc;AACd,OAAO,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,CAAC;AACxF,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC"}
|