@starley/ion-directives 1.2.20 → 1.2.22
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/directive.module.d.ts +3 -2
- package/dist/directive.module.js +9 -4
- package/dist/directive.module.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/input-pattern/input-pattern.directive.d.ts +25 -0
- package/dist/input-pattern/input-pattern.directive.js +59 -0
- package/dist/input-pattern/input-pattern.directive.js.map +1 -0
- package/package.json +1 -1
|
@@ -3,7 +3,8 @@ import * as i0 from "@angular/core";
|
|
|
3
3
|
import * as i1 from "./press-hold/press-hold.directive";
|
|
4
4
|
import * as i2 from "./tap/tap.directive";
|
|
5
5
|
import * as i3 from "./input-mask/input-mask.directive";
|
|
6
|
-
import * as i4 from "
|
|
6
|
+
import * as i4 from "./input-pattern/input-pattern.directive";
|
|
7
|
+
import * as i5 from "@angular/common";
|
|
7
8
|
/**
|
|
8
9
|
* Gerencia precionamento de enventos
|
|
9
10
|
* @author Starley Cazorla
|
|
@@ -11,6 +12,6 @@ import * as i4 from "@angular/common";
|
|
|
11
12
|
export declare class DirectivesModule {
|
|
12
13
|
static forRoot(): ModuleWithProviders<DirectivesModule>;
|
|
13
14
|
static ɵfac: i0.ɵɵFactoryDeclaration<DirectivesModule, never>;
|
|
14
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<DirectivesModule, [typeof i1.PressHoldDirective, typeof i2.TapDirective, typeof i3.IonInputMaskDirective], [typeof
|
|
15
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<DirectivesModule, [typeof i1.PressHoldDirective, typeof i2.TapDirective, typeof i3.IonInputMaskDirective, typeof i4.IonInputPatternDirective], [typeof i5.CommonModule], [typeof i1.PressHoldDirective, typeof i2.TapDirective, typeof i3.IonInputMaskDirective, typeof i4.IonInputPatternDirective]>;
|
|
15
16
|
static ɵinj: i0.ɵɵInjectorDeclaration<DirectivesModule>;
|
|
16
17
|
}
|
package/dist/directive.module.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
1
2
|
import { CUSTOM_ELEMENTS_SCHEMA, NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
|
|
3
|
+
import { IonInputMaskDirective } from './input-mask/input-mask.directive';
|
|
4
|
+
import { IonInputPatternDirective } from './input-pattern/input-pattern.directive';
|
|
2
5
|
import { PressHoldDirective } from './press-hold/press-hold.directive';
|
|
3
6
|
import { TapDirective } from './tap/tap.directive';
|
|
4
|
-
import { IonInputMaskDirective } from './input-mask/input-mask.directive';
|
|
5
|
-
import { CommonModule } from '@angular/common';
|
|
6
7
|
import * as i0 from "@angular/core";
|
|
7
8
|
/**
|
|
8
9
|
* Gerencia precionamento de enventos
|
|
@@ -30,6 +31,7 @@ export { DirectivesModule };
|
|
|
30
31
|
PressHoldDirective,
|
|
31
32
|
TapDirective,
|
|
32
33
|
IonInputMaskDirective,
|
|
34
|
+
IonInputPatternDirective
|
|
33
35
|
],
|
|
34
36
|
imports: [
|
|
35
37
|
CommonModule
|
|
@@ -38,13 +40,16 @@ export { DirectivesModule };
|
|
|
38
40
|
PressHoldDirective,
|
|
39
41
|
TapDirective,
|
|
40
42
|
IonInputMaskDirective,
|
|
43
|
+
IonInputPatternDirective
|
|
41
44
|
],
|
|
42
45
|
schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA]
|
|
43
46
|
}]
|
|
44
47
|
}], null, null); })();
|
|
45
48
|
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(DirectivesModule, { declarations: [PressHoldDirective,
|
|
46
49
|
TapDirective,
|
|
47
|
-
IonInputMaskDirective
|
|
50
|
+
IonInputMaskDirective,
|
|
51
|
+
IonInputPatternDirective], imports: [CommonModule], exports: [PressHoldDirective,
|
|
48
52
|
TapDirective,
|
|
49
|
-
IonInputMaskDirective
|
|
53
|
+
IonInputMaskDirective,
|
|
54
|
+
IonInputPatternDirective] }); })();
|
|
50
55
|
//# sourceMappingURL=directive.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directive.module.js","sourceRoot":"","sources":["../src/directive.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAuB,QAAQ,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACxG,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"directive.module.js","sourceRoot":"","sources":["../src/directive.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAuB,QAAQ,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACxG,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;;AAEnD;;;GAGG;AAEH;IAAA;KA0BC;IANU,wBAAO,GAAd;QACI,OAAO;YACH,QAAQ,EAAE,gBAAgB;YAC1B,SAAS,EAAE,EAAE;SAChB,CAAC;IACN,CAAC;oFANQ,gBAAgB;sEAAhB,gBAAgB;0EAXrB,YAAY;2BApBpB;CAsCC,AA1BD,IA0BC;SAPY,gBAAgB;uFAAhB,gBAAgB;cAnB5B,QAAQ;eAAC;gBACN,YAAY,EAAE;oBACV,kBAAkB;oBAClB,YAAY;oBACZ,qBAAqB;oBACrB,wBAAwB;iBAC3B;gBACD,OAAO,EAAE;oBACL,YAAY;iBACf;gBACD,OAAO,EAAE;oBACL,kBAAkB;oBAClB,YAAY;oBACZ,qBAAqB;oBACrB,wBAAwB;iBAC3B;gBACD,OAAO,EAAE,CAAC,sBAAsB,EAAE,gBAAgB,CAAC;aAEtD;;wFACY,gBAAgB,mBAjBrB,kBAAkB;QAClB,YAAY;QACZ,qBAAqB;QACrB,wBAAwB,aAGxB,YAAY,aAGZ,kBAAkB;QAClB,YAAY;QACZ,qBAAqB;QACrB,wBAAwB","sourcesContent":["import { CommonModule } from '@angular/common';\nimport { CUSTOM_ELEMENTS_SCHEMA, ModuleWithProviders, NgModule, NO_ERRORS_SCHEMA } from '@angular/core';\nimport { IonInputMaskDirective } from './input-mask/input-mask.directive';\nimport { IonInputPatternDirective } from './input-pattern/input-pattern.directive';\nimport { PressHoldDirective } from './press-hold/press-hold.directive';\nimport { TapDirective } from './tap/tap.directive';\n\n/**\n * Gerencia precionamento de enventos\n * @author Starley Cazorla\n */\n\n@NgModule({\n declarations: [\n PressHoldDirective,\n TapDirective,\n IonInputMaskDirective,\n IonInputPatternDirective\n ],\n imports: [\n CommonModule\n ],\n exports: [\n PressHoldDirective,\n TapDirective,\n IonInputMaskDirective,\n IonInputPatternDirective\n ],\n schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA]\n\n})\nexport class DirectivesModule {\n static forRoot(): ModuleWithProviders<DirectivesModule> {\n return {\n ngModule: DirectivesModule,\n providers: [],\n };\n }\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
export * from './directive.module';
|
|
1
2
|
export * from './input-mask/input-mask.directive';
|
|
3
|
+
export * from './input-pattern/input-pattern.directive';
|
|
2
4
|
export * from './press-hold/press-hold.directive';
|
|
3
|
-
export * from './tap/tap.directive';
|
|
4
|
-
export * from './directive.module';
|
|
5
|
-
export { IonUtilsProvider } from './provider/ion-utils-provider';
|
|
6
5
|
export { ConnectorSqlitePwaProvider } from './provider/connector-sqlite-pwa.provider';
|
|
7
6
|
export { DateUtilProvider } from './provider/date-util-provider';
|
|
7
|
+
export { IonUtilsProvider } from './provider/ion-utils-provider';
|
|
8
|
+
export * from './tap/tap.directive';
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
export * from './directive.module';
|
|
1
2
|
export * from './input-mask/input-mask.directive';
|
|
3
|
+
export * from './input-pattern/input-pattern.directive';
|
|
2
4
|
export * from './press-hold/press-hold.directive';
|
|
3
|
-
export * from './tap/tap.directive';
|
|
4
|
-
export * from './directive.module';
|
|
5
|
-
export { IonUtilsProvider } from './provider/ion-utils-provider';
|
|
6
5
|
export { ConnectorSqlitePwaProvider } from './provider/connector-sqlite-pwa.provider';
|
|
7
6
|
export { DateUtilProvider } from './provider/date-util-provider';
|
|
7
|
+
export { IonUtilsProvider } from './provider/ion-utils-provider';
|
|
8
|
+
export * from './tap/tap.directive';
|
|
8
9
|
//# 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,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mCAAmC,CAAC;AAClD,cAAc,yCAAyC,CAAC;AACxD,cAAc,mCAAmC,CAAC;AAClD,OAAO,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,cAAc,qBAAqB,CAAC","sourcesContent":["export * from './directive.module';\nexport * from './input-mask/input-mask.directive';\nexport * from './input-pattern/input-pattern.directive';\nexport * from './press-hold/press-hold.directive';\nexport { ConnectorSqlitePwaProvider } from './provider/connector-sqlite-pwa.provider';\nexport { DateUtilProvider } from './provider/date-util-provider';\nexport { IonUtilsProvider } from './provider/ion-utils-provider';\nexport * from './tap/tap.directive';\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { NgModel } from "@angular/forms";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* Responsavel pelo mascaramento de inputs
|
|
5
|
+
* @author Starley Cazorla
|
|
6
|
+
*/
|
|
7
|
+
export declare class IonInputPatternDirective {
|
|
8
|
+
model: NgModel;
|
|
9
|
+
pattern: any;
|
|
10
|
+
/**
|
|
11
|
+
* Construtor
|
|
12
|
+
* @param {NgModel} model
|
|
13
|
+
* @param {string} pattern
|
|
14
|
+
*/
|
|
15
|
+
constructor(model: NgModel, pattern?: any);
|
|
16
|
+
/**
|
|
17
|
+
* Hosts listener
|
|
18
|
+
* @author Starley Cazorla
|
|
19
|
+
* @param event
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
onInput(event: any): boolean;
|
|
23
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<IonInputPatternDirective, [null, { attribute: "appPattern"; }]>;
|
|
24
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<IonInputPatternDirective, "[appPattern]", never, {}, {}, never, never, false, never>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Attribute, Directive, HostListener } from '@angular/core';
|
|
2
|
+
import { NgModel } from "@angular/forms";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
import * as i1 from "@angular/forms";
|
|
5
|
+
/**
|
|
6
|
+
* Responsavel pelo mascaramento de inputs
|
|
7
|
+
* @author Starley Cazorla
|
|
8
|
+
*/
|
|
9
|
+
var IonInputPatternDirective = /** @class */ (function () {
|
|
10
|
+
/**
|
|
11
|
+
* Construtor
|
|
12
|
+
* @param {NgModel} model
|
|
13
|
+
* @param {string} pattern
|
|
14
|
+
*/
|
|
15
|
+
function IonInputPatternDirective(model, pattern) {
|
|
16
|
+
if (pattern === void 0) { pattern = null; }
|
|
17
|
+
this.model = model;
|
|
18
|
+
this.pattern = '/[0-9]/';
|
|
19
|
+
this.pattern = pattern;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Hosts listener
|
|
23
|
+
* @author Starley Cazorla
|
|
24
|
+
* @param event
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
27
|
+
IonInputPatternDirective.prototype.onInput = function (event) {
|
|
28
|
+
var inputChar = String.fromCharCode(event.which ? event.which : event.keyCode);
|
|
29
|
+
if (!this.pattern.test(inputChar)) {
|
|
30
|
+
// invalid character, prevent input
|
|
31
|
+
event.preventDefault();
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
};
|
|
36
|
+
IonInputPatternDirective.ɵfac = function IonInputPatternDirective_Factory(t) { return new (t || IonInputPatternDirective)(i0.ɵɵdirectiveInject(i1.NgModel), i0.ɵɵinjectAttribute('appPattern')); };
|
|
37
|
+
IonInputPatternDirective.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: IonInputPatternDirective, selectors: [["", "appPattern", ""]], hostBindings: function IonInputPatternDirective_HostBindings(rf, ctx) { if (rf & 1) {
|
|
38
|
+
i0.ɵɵlistener("keydown", function IonInputPatternDirective_keydown_HostBindingHandler($event) { return ctx.onKeyDown($event); })("keypress", function IonInputPatternDirective_keypress_HostBindingHandler($event) { return ctx.onInput($event); });
|
|
39
|
+
} }, features: [i0.ɵɵProvidersFeature([NgModel])] });
|
|
40
|
+
return IonInputPatternDirective;
|
|
41
|
+
}());
|
|
42
|
+
export { IonInputPatternDirective };
|
|
43
|
+
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IonInputPatternDirective, [{
|
|
44
|
+
type: Directive,
|
|
45
|
+
args: [{
|
|
46
|
+
selector: '[appPattern]',
|
|
47
|
+
host: {
|
|
48
|
+
'(keydown)': 'onKeyDown($event)'
|
|
49
|
+
},
|
|
50
|
+
providers: [NgModel]
|
|
51
|
+
}]
|
|
52
|
+
}], function () { return [{ type: i1.NgModel }, { type: undefined, decorators: [{
|
|
53
|
+
type: Attribute,
|
|
54
|
+
args: ['appPattern']
|
|
55
|
+
}] }]; }, { onInput: [{
|
|
56
|
+
type: HostListener,
|
|
57
|
+
args: ['keypress', ['$event']]
|
|
58
|
+
}] }); })();
|
|
59
|
+
//# sourceMappingURL=input-pattern.directive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-pattern.directive.js","sourceRoot":"","sources":["../../src/input-pattern/input-pattern.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;;;AAEzC;;;GAGG;AAEH;IAWI;;;;OAIG;IACH,kCAAmB,KAAc,EACJ,OAAmB;QAA5C,wBAAA,EAAA,cAA4C;QAD7B,UAAK,GAAL,KAAK,CAAS;QAPjC,YAAO,GAAQ,SAAS,CAAC;QASrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAED;;;;;OAKG;IAEH,0CAAO,GADP,UACQ,KAAU;QACd,IAAI,SAAS,GAAG,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAE/E,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;YAC/B,mCAAmC;YACnC,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,OAAO,KAAK,CAAC;SAChB;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;oGA9BQ,wBAAwB,yDAUlB,YAAY;+EAVlB,wBAAwB;mHAAxB,qBAAiB,gGAAjB,mBAAe;8CAFb,CAAC,OAAO,CAAC;mCAbxB;CA+CC,AAvCD,IAuCC;SAhCY,wBAAwB;uFAAxB,wBAAwB;cAPpC,SAAS;eAAC;gBACP,QAAQ,EAAE,cAAc;gBACxB,IAAI,EAAE;oBACF,WAAW,EAAE,mBAAmB;iBACnC;gBACD,SAAS,EAAE,CAAC,OAAO,CAAC;aACvB;;sBAWQ,SAAS;uBAAC,YAAY;wBAW3B,OAAO;kBADN,YAAY;mBAAC,UAAU,EAAE,CAAC,QAAQ,CAAC","sourcesContent":["import { Attribute, Directive, HostListener } from '@angular/core';\nimport { NgModel } from \"@angular/forms\";\n\n/**\n * Responsavel pelo mascaramento de inputs\n * @author Starley Cazorla\n */\n\n@Directive({\n selector: '[appPattern]',\n host: {\n '(keydown)': 'onKeyDown($event)'\n },\n providers: [NgModel]\n})\nexport class IonInputPatternDirective {\n\n pattern: any = '/[0-9]/';\n\n /**\n * Construtor\n * @param {NgModel} model\n * @param {string} pattern\n */\n constructor(public model: NgModel,\n @Attribute('appPattern') pattern: any = null) {\n this.pattern = pattern;\n }\n\n /**\n * Hosts listener\n * @author Starley Cazorla\n * @param event \n * @returns \n */\n @HostListener('keypress', ['$event'])\n onInput(event: any) {\n let inputChar = String.fromCharCode(event.which ? event.which : event.keyCode);\n\n if (!this.pattern.test(inputChar)) {\n // invalid character, prevent input\n event.preventDefault();\n return false;\n }\n return true;\n }\n\n}"]}
|