@skyux/validation 5.0.0 → 5.5.0-beta.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 (40) hide show
  1. package/README.md +6 -4
  2. package/bundles/skyux-validation.umd.js +42 -56
  3. package/documentation.json +57 -33
  4. package/esm2015/index.js +9 -0
  5. package/esm2015/index.js.map +1 -0
  6. package/esm2015/lib/modules/email-validation/email-validation.directive.js +44 -0
  7. package/esm2015/lib/modules/email-validation/email-validation.directive.js.map +1 -0
  8. package/esm2015/lib/modules/email-validation/email-validation.module.js +18 -0
  9. package/esm2015/lib/modules/email-validation/email-validation.module.js.map +1 -0
  10. package/esm2015/lib/modules/url-validation/url-validation.directive.js +44 -0
  11. package/esm2015/lib/modules/url-validation/url-validation.directive.js.map +1 -0
  12. package/esm2015/lib/modules/url-validation/url-validation.module.js +18 -0
  13. package/esm2015/lib/modules/url-validation/url-validation.module.js.map +1 -0
  14. package/esm2015/lib/modules/validation/validation.js +14 -0
  15. package/esm2015/lib/modules/validation/validation.js.map +1 -0
  16. package/esm2015/lib/modules/validators/validators.js +39 -0
  17. package/esm2015/lib/modules/validators/validators.js.map +1 -0
  18. package/esm2015/skyux-validation.js +2 -2
  19. package/esm2015/skyux-validation.js.map +1 -0
  20. package/fesm2015/skyux-validation.js +36 -48
  21. package/fesm2015/skyux-validation.js.map +1 -1
  22. package/index.d.ts +6 -0
  23. package/{modules → lib/modules}/email-validation/email-validation.directive.d.ts +0 -0
  24. package/{modules → lib/modules}/email-validation/email-validation.module.d.ts +0 -0
  25. package/{modules → lib/modules}/url-validation/url-validation.directive.d.ts +0 -0
  26. package/{modules → lib/modules}/url-validation/url-validation.module.d.ts +0 -0
  27. package/{modules → lib/modules}/validation/validation.d.ts +0 -0
  28. package/{modules → lib/modules}/validators/validators.d.ts +0 -0
  29. package/package.json +19 -5
  30. package/skyux-validation.d.ts +1 -1
  31. package/LICENSE +0 -21
  32. package/bundles/skyux-validation.umd.js.map +0 -1
  33. package/esm2015/modules/email-validation/email-validation.directive.js +0 -44
  34. package/esm2015/modules/email-validation/email-validation.module.js +0 -26
  35. package/esm2015/modules/url-validation/url-validation.directive.js +0 -44
  36. package/esm2015/modules/url-validation/url-validation.module.js +0 -26
  37. package/esm2015/modules/validation/validation.js +0 -14
  38. package/esm2015/modules/validators/validators.js +0 -35
  39. package/esm2015/public-api.js +0 -9
  40. package/public-api.d.ts +0 -6
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email-validation.directive.js","sourceRoot":"","sources":["../../../../../../../../libs/components/validation/src/lib/modules/email-validation/email-validation.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,EAAa,aAAa,EAAmB,MAAM,gBAAgB,CAAC;AAE3E,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;;AAEzD,sDAAsD;AACtD,MAAM,8BAA8B,GAAG;IACrC,OAAO,EAAE,aAAa;IACtB,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,2BAA2B,CAAC;IAC1D,KAAK,EAAE,IAAI;CACZ,CAAC;AACF,gBAAgB;AAEhB;;;;GAIG;AAKH,MAAM,OAAO,2BAA2B;IAC/B,QAAQ,CAAC,OAAwB;QACtC,IAAI,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAE1B,IAAI,CAAC,KAAK,EAAE;YACV,OAAO;SACR;QAED,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE;YAC7B,OAAO;gBACL,QAAQ,EAAE;oBACR,OAAO,EAAE,OAAO,CAAC,KAAK;iBACvB;aACF,CAAC;SACH;IACH,CAAC;IAEM,YAAY,CAAC,KAAa;QAC/B,OAAO,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;;yHAnBU,2BAA2B;6GAA3B,2BAA2B,+CAF3B,CAAC,8BAA8B,CAAC;4FAEhC,2BAA2B;kBAJvC,SAAS;mBAAC;oBACT,QAAQ,EAAE,sBAAsB;oBAChC,SAAS,EAAE,CAAC,8BAA8B,CAAC;iBAC5C","sourcesContent":["import { Directive, forwardRef } from '@angular/core';\n\nimport { Validator, NG_VALIDATORS, AbstractControl } from '@angular/forms';\n\nimport { SkyValidation } from '../validation/validation';\n\n// tslint:disable:no-forward-ref no-use-before-declare\nconst SKY_EMAIL_VALIDATION_VALIDATOR = {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => SkyEmailValidationDirective),\n multi: true,\n};\n// tslint:enable\n\n/**\n * Creates an input to validate email addresses. Place this attribute on an `input` element.\n * If users enter values that are not valid email addresses, an error message appears.\n * The directive uses `NgModel` to bind data.\n */\n@Directive({\n selector: '[skyEmailValidation]',\n providers: [SKY_EMAIL_VALIDATION_VALIDATOR],\n})\nexport class SkyEmailValidationDirective implements Validator {\n public validate(control: AbstractControl): { [key: string]: any } {\n let value = control.value;\n\n if (!value) {\n return;\n }\n\n if (!this.emailIsValid(value)) {\n return {\n skyEmail: {\n invalid: control.value,\n },\n };\n }\n }\n\n public emailIsValid(email: string): boolean {\n return SkyValidation.isEmail(email);\n }\n}\n"]}
@@ -0,0 +1,18 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { FormsModule } from '@angular/forms';
3
+ import { SkyEmailValidationDirective } from './email-validation.directive';
4
+ import * as i0 from "@angular/core";
5
+ export class SkyEmailValidationModule {
6
+ }
7
+ SkyEmailValidationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyEmailValidationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
8
+ SkyEmailValidationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyEmailValidationModule, declarations: [SkyEmailValidationDirective], imports: [FormsModule], exports: [SkyEmailValidationDirective] });
9
+ SkyEmailValidationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyEmailValidationModule, imports: [[FormsModule]] });
10
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyEmailValidationModule, decorators: [{
11
+ type: NgModule,
12
+ args: [{
13
+ declarations: [SkyEmailValidationDirective],
14
+ imports: [FormsModule],
15
+ exports: [SkyEmailValidationDirective],
16
+ }]
17
+ }] });
18
+ //# sourceMappingURL=email-validation.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email-validation.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/validation/src/lib/modules/email-validation/email-validation.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;;AAO3E,MAAM,OAAO,wBAAwB;;sHAAxB,wBAAwB;uHAAxB,wBAAwB,iBAJpB,2BAA2B,aAChC,WAAW,aACX,2BAA2B;uHAE1B,wBAAwB,YAH1B,CAAC,WAAW,CAAC;4FAGX,wBAAwB;kBALpC,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAC,2BAA2B,CAAC;oBAC3C,OAAO,EAAE,CAAC,WAAW,CAAC;oBACtB,OAAO,EAAE,CAAC,2BAA2B,CAAC;iBACvC","sourcesContent":["import { NgModule } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\n\nimport { SkyEmailValidationDirective } from './email-validation.directive';\n\n@NgModule({\n declarations: [SkyEmailValidationDirective],\n imports: [FormsModule],\n exports: [SkyEmailValidationDirective],\n})\nexport class SkyEmailValidationModule {}\n"]}
@@ -0,0 +1,44 @@
1
+ import { Directive, forwardRef } from '@angular/core';
2
+ import { NG_VALIDATORS } from '@angular/forms';
3
+ import { SkyValidation } from '../validation/validation';
4
+ import * as i0 from "@angular/core";
5
+ // tslint:disable:no-forward-ref no-use-before-declare
6
+ const SKY_URL_VALIDATION_VALIDATOR = {
7
+ provide: NG_VALIDATORS,
8
+ useExisting: forwardRef(() => SkyUrlValidationDirective),
9
+ multi: true,
10
+ };
11
+ // tslint:enable
12
+ /**
13
+ * Creates an input to validate URLs. Place this attribute on an `input` element.
14
+ * If users enters values that are not valid URLs, an error message appears.
15
+ * This directive uses `NgModel` to bind data.
16
+ */
17
+ export class SkyUrlValidationDirective {
18
+ validate(control) {
19
+ const value = control.value;
20
+ if (!value) {
21
+ return;
22
+ }
23
+ if (!this.urlIsValid(value)) {
24
+ return {
25
+ skyUrl: {
26
+ invalid: control.value,
27
+ },
28
+ };
29
+ }
30
+ }
31
+ urlIsValid(url) {
32
+ return SkyValidation.isUrl(url);
33
+ }
34
+ }
35
+ SkyUrlValidationDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyUrlValidationDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
36
+ SkyUrlValidationDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: SkyUrlValidationDirective, selector: "[skyUrlValidation]", providers: [SKY_URL_VALIDATION_VALIDATOR], ngImport: i0 });
37
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyUrlValidationDirective, decorators: [{
38
+ type: Directive,
39
+ args: [{
40
+ selector: '[skyUrlValidation]',
41
+ providers: [SKY_URL_VALIDATION_VALIDATOR],
42
+ }]
43
+ }] });
44
+ //# sourceMappingURL=url-validation.directive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url-validation.directive.js","sourceRoot":"","sources":["../../../../../../../../libs/components/validation/src/lib/modules/url-validation/url-validation.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,EAAa,aAAa,EAAmB,MAAM,gBAAgB,CAAC;AAE3E,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;;AAEzD,sDAAsD;AACtD,MAAM,4BAA4B,GAAG;IACnC,OAAO,EAAE,aAAa;IACtB,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,yBAAyB,CAAC;IACxD,KAAK,EAAE,IAAI;CACZ,CAAC;AACF,gBAAgB;AAEhB;;;;GAIG;AAKH,MAAM,OAAO,yBAAyB;IAC7B,QAAQ,CAAC,OAAwB;QACtC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAE5B,IAAI,CAAC,KAAK,EAAE;YACV,OAAO;SACR;QAED,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;YAC3B,OAAO;gBACL,MAAM,EAAE;oBACN,OAAO,EAAE,OAAO,CAAC,KAAK;iBACvB;aACF,CAAC;SACH;IACH,CAAC;IAEM,UAAU,CAAC,GAAW;QAC3B,OAAO,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;;uHAnBU,yBAAyB;2GAAzB,yBAAyB,6CAFzB,CAAC,4BAA4B,CAAC;4FAE9B,yBAAyB;kBAJrC,SAAS;mBAAC;oBACT,QAAQ,EAAE,oBAAoB;oBAC9B,SAAS,EAAE,CAAC,4BAA4B,CAAC;iBAC1C","sourcesContent":["import { Directive, forwardRef } from '@angular/core';\n\nimport { Validator, NG_VALIDATORS, AbstractControl } from '@angular/forms';\n\nimport { SkyValidation } from '../validation/validation';\n\n// tslint:disable:no-forward-ref no-use-before-declare\nconst SKY_URL_VALIDATION_VALIDATOR = {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => SkyUrlValidationDirective),\n multi: true,\n};\n// tslint:enable\n\n/**\n * Creates an input to validate URLs. Place this attribute on an `input` element.\n * If users enters values that are not valid URLs, an error message appears.\n * This directive uses `NgModel` to bind data.\n */\n@Directive({\n selector: '[skyUrlValidation]',\n providers: [SKY_URL_VALIDATION_VALIDATOR],\n})\nexport class SkyUrlValidationDirective implements Validator {\n public validate(control: AbstractControl): { [key: string]: any } {\n const value = control.value;\n\n if (!value) {\n return;\n }\n\n if (!this.urlIsValid(value)) {\n return {\n skyUrl: {\n invalid: control.value,\n },\n };\n }\n }\n\n public urlIsValid(url: string): boolean {\n return SkyValidation.isUrl(url);\n }\n}\n"]}
@@ -0,0 +1,18 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { FormsModule } from '@angular/forms';
3
+ import { SkyUrlValidationDirective } from './url-validation.directive';
4
+ import * as i0 from "@angular/core";
5
+ export class SkyUrlValidationModule {
6
+ }
7
+ SkyUrlValidationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyUrlValidationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
8
+ SkyUrlValidationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyUrlValidationModule, declarations: [SkyUrlValidationDirective], imports: [FormsModule], exports: [SkyUrlValidationDirective] });
9
+ SkyUrlValidationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyUrlValidationModule, imports: [[FormsModule]] });
10
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyUrlValidationModule, decorators: [{
11
+ type: NgModule,
12
+ args: [{
13
+ declarations: [SkyUrlValidationDirective],
14
+ imports: [FormsModule],
15
+ exports: [SkyUrlValidationDirective],
16
+ }]
17
+ }] });
18
+ //# sourceMappingURL=url-validation.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url-validation.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/validation/src/lib/modules/url-validation/url-validation.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;;AAOvE,MAAM,OAAO,sBAAsB;;oHAAtB,sBAAsB;qHAAtB,sBAAsB,iBAJlB,yBAAyB,aAC9B,WAAW,aACX,yBAAyB;qHAExB,sBAAsB,YAHxB,CAAC,WAAW,CAAC;4FAGX,sBAAsB;kBALlC,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAC,yBAAyB,CAAC;oBACzC,OAAO,EAAE,CAAC,WAAW,CAAC;oBACtB,OAAO,EAAE,CAAC,yBAAyB,CAAC;iBACrC","sourcesContent":["import { NgModule } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\n\nimport { SkyUrlValidationDirective } from './url-validation.directive';\n\n@NgModule({\n declarations: [SkyUrlValidationDirective],\n imports: [FormsModule],\n exports: [SkyUrlValidationDirective],\n})\nexport class SkyUrlValidationModule {}\n"]}
@@ -0,0 +1,14 @@
1
+ export class SkyValidation {
2
+ static isEmail(emailAddress) {
3
+ // The regex was obtained from http://emailregex.com/
4
+ // which claims to correctly handle ~99% of all email addresses.
5
+ // tslint:disable-next-line:max-line-length
6
+ let regex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
7
+ return regex.test(emailAddress);
8
+ }
9
+ static isUrl(url) {
10
+ let regex = /^((http|https):\/\/)?([\w\-]+\.)+[\w\-]+/i;
11
+ return regex.test(url);
12
+ }
13
+ }
14
+ //# sourceMappingURL=validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../../../../../../libs/components/validation/src/lib/modules/validation/validation.ts"],"names":[],"mappings":"AAAA,MAAM,OAAgB,aAAa;IAC1B,MAAM,CAAC,OAAO,CAAC,YAAoB;QACxC,qDAAqD;QACrD,gEAAgE;QAChE,2CAA2C;QAC3C,IAAI,KAAK,GACP,wJAAwJ,CAAC;QAC3J,OAAO,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAClC,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,GAAW;QAC7B,IAAI,KAAK,GAAG,2CAA2C,CAAC;QACxD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;CACF","sourcesContent":["export abstract class SkyValidation {\n public static isEmail(emailAddress: string): boolean {\n // The regex was obtained from http://emailregex.com/\n // which claims to correctly handle ~99% of all email addresses.\n // tslint:disable-next-line:max-line-length\n let regex =\n /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n return regex.test(emailAddress);\n }\n\n public static isUrl(url: string): boolean {\n let regex = /^((http|https):\\/\\/)?([\\w\\-]+\\.)+[\\w\\-]+/i;\n return regex.test(url);\n }\n}\n"]}
@@ -0,0 +1,39 @@
1
+ import { SkyValidation } from '../validation/validation';
2
+ // Need to add the following to classes which contain static methods.
3
+ // See: https://github.com/ng-packagr/ng-packagr/issues/641
4
+ // @dynamic
5
+ export class SkyValidators {
6
+ /**
7
+ * Validates email addresses in reactive forms. Add this validator directly to the form control
8
+ * model in the component class. If users enter values that are not valid email addresses, the
9
+ * validator throws an error. Since this is a sync validator, it returns a set of validation
10
+ * errors or `undefined` immediately when users enter values.
11
+ * @param control
12
+ */
13
+ static email(control) {
14
+ const value = control.value;
15
+ if (!value) {
16
+ return undefined;
17
+ }
18
+ return SkyValidation.isEmail(value)
19
+ ? undefined
20
+ : { skyEmail: { invalid: value } };
21
+ }
22
+ /**
23
+ * Validates URLs in reactive forms. Add this validator directly to the form control model in
24
+ * the component class. If users enter values that are not valid URLs, the validator throws an
25
+ * error. Since this is a sync validator, it returns a set of validation errors or `undefined`
26
+ * immediately when users enter values.
27
+ * @param control
28
+ */
29
+ static url(control) {
30
+ const value = control.value;
31
+ if (!value) {
32
+ return undefined;
33
+ }
34
+ return SkyValidation.isUrl(value)
35
+ ? undefined
36
+ : { skyUrl: { invalid: value } };
37
+ }
38
+ }
39
+ //# sourceMappingURL=validators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../../../../../../libs/components/validation/src/lib/modules/validators/validators.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,qEAAqE;AACrE,2DAA2D;AAC3D,WAAW;AACX,MAAM,OAAO,aAAa;IACxB;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAAC,OAAwB;QAC1C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAE5B,IAAI,CAAC,KAAK,EAAE;YACV,OAAO,SAAS,CAAC;SAClB;QAED,OAAO,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC;YACjC,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC;IACvC,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,GAAG,CAAC,OAAwB;QACxC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAE5B,IAAI,CAAC,KAAK,EAAE;YACV,OAAO,SAAS,CAAC;SAClB;QAED,OAAO,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC;YAC/B,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC;IACrC,CAAC;CACF","sourcesContent":["import { AbstractControl, ValidationErrors } from '@angular/forms';\n\nimport { SkyValidation } from '../validation/validation';\n\n// Need to add the following to classes which contain static methods.\n// See: https://github.com/ng-packagr/ng-packagr/issues/641\n// @dynamic\nexport class SkyValidators {\n /**\n * Validates email addresses in reactive forms. Add this validator directly to the form control\n * model in the component class. If users enter values that are not valid email addresses, the\n * validator throws an error. Since this is a sync validator, it returns a set of validation\n * errors or `undefined` immediately when users enter values.\n * @param control\n */\n public static email(control: AbstractControl): ValidationErrors | null {\n const value = control.value;\n\n if (!value) {\n return undefined;\n }\n\n return SkyValidation.isEmail(value)\n ? undefined\n : { skyEmail: { invalid: value } };\n }\n\n /**\n * Validates URLs in reactive forms. Add this validator directly to the form control model in\n * the component class. If users enter values that are not valid URLs, the validator throws an\n * error. Since this is a sync validator, it returns a set of validation errors or `undefined`\n * immediately when users enter values.\n * @param control\n */\n public static url(control: AbstractControl): ValidationErrors | null {\n const value = control.value;\n\n if (!value) {\n return undefined;\n }\n\n return SkyValidation.isUrl(value)\n ? undefined\n : { skyUrl: { invalid: value } };\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * Generated bundle index. Do not edit.
3
3
  */
4
- export * from './public-api';
5
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2t5dXgtdmFsaWRhdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL3ZhbGlkYXRpb24vc3JjL3NreXV4LXZhbGlkYXRpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLGNBQWMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogR2VuZXJhdGVkIGJ1bmRsZSBpbmRleC4gRG8gbm90IGVkaXQuXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9wdWJsaWMtYXBpJztcbiJdfQ==
4
+ export * from './index';
5
+ //# sourceMappingURL=skyux-validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skyux-validation.js","sourceRoot":"","sources":["../../../../../libs/components/validation/src/skyux-validation.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAC","sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"]}
@@ -20,7 +20,7 @@ class SkyValidation {
20
20
  const SKY_EMAIL_VALIDATION_VALIDATOR = {
21
21
  provide: NG_VALIDATORS,
22
22
  useExisting: forwardRef(() => SkyEmailValidationDirective),
23
- multi: true
23
+ multi: true,
24
24
  };
25
25
  // tslint:enable
26
26
  /**
@@ -36,9 +36,9 @@ class SkyEmailValidationDirective {
36
36
  }
37
37
  if (!this.emailIsValid(value)) {
38
38
  return {
39
- 'skyEmail': {
40
- invalid: control.value
41
- }
39
+ skyEmail: {
40
+ invalid: control.value,
41
+ },
42
42
  };
43
43
  }
44
44
  }
@@ -46,35 +46,27 @@ class SkyEmailValidationDirective {
46
46
  return SkyValidation.isEmail(email);
47
47
  }
48
48
  }
49
- SkyEmailValidationDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: SkyEmailValidationDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
50
- SkyEmailValidationDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.7", type: SkyEmailValidationDirective, selector: "[skyEmailValidation]", providers: [SKY_EMAIL_VALIDATION_VALIDATOR], ngImport: i0 });
51
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: SkyEmailValidationDirective, decorators: [{
49
+ SkyEmailValidationDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyEmailValidationDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
50
+ SkyEmailValidationDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: SkyEmailValidationDirective, selector: "[skyEmailValidation]", providers: [SKY_EMAIL_VALIDATION_VALIDATOR], ngImport: i0 });
51
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyEmailValidationDirective, decorators: [{
52
52
  type: Directive,
53
53
  args: [{
54
54
  selector: '[skyEmailValidation]',
55
- providers: [SKY_EMAIL_VALIDATION_VALIDATOR]
55
+ providers: [SKY_EMAIL_VALIDATION_VALIDATOR],
56
56
  }]
57
57
  }] });
58
58
 
59
59
  class SkyEmailValidationModule {
60
60
  }
61
- SkyEmailValidationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: SkyEmailValidationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
62
- SkyEmailValidationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: SkyEmailValidationModule, declarations: [SkyEmailValidationDirective], imports: [FormsModule], exports: [SkyEmailValidationDirective] });
63
- SkyEmailValidationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: SkyEmailValidationModule, imports: [[
64
- FormsModule
65
- ]] });
66
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: SkyEmailValidationModule, decorators: [{
61
+ SkyEmailValidationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyEmailValidationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
62
+ SkyEmailValidationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyEmailValidationModule, declarations: [SkyEmailValidationDirective], imports: [FormsModule], exports: [SkyEmailValidationDirective] });
63
+ SkyEmailValidationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyEmailValidationModule, imports: [[FormsModule]] });
64
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyEmailValidationModule, decorators: [{
67
65
  type: NgModule,
68
66
  args: [{
69
- declarations: [
70
- SkyEmailValidationDirective
71
- ],
72
- imports: [
73
- FormsModule
74
- ],
75
- exports: [
76
- SkyEmailValidationDirective
77
- ]
67
+ declarations: [SkyEmailValidationDirective],
68
+ imports: [FormsModule],
69
+ exports: [SkyEmailValidationDirective],
78
70
  }]
79
71
  }] });
80
72
 
@@ -82,7 +74,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImpor
82
74
  const SKY_URL_VALIDATION_VALIDATOR = {
83
75
  provide: NG_VALIDATORS,
84
76
  useExisting: forwardRef(() => SkyUrlValidationDirective),
85
- multi: true
77
+ multi: true,
86
78
  };
87
79
  // tslint:enable
88
80
  /**
@@ -98,9 +90,9 @@ class SkyUrlValidationDirective {
98
90
  }
99
91
  if (!this.urlIsValid(value)) {
100
92
  return {
101
- 'skyUrl': {
102
- invalid: control.value
103
- }
93
+ skyUrl: {
94
+ invalid: control.value,
95
+ },
104
96
  };
105
97
  }
106
98
  }
@@ -108,35 +100,27 @@ class SkyUrlValidationDirective {
108
100
  return SkyValidation.isUrl(url);
109
101
  }
110
102
  }
111
- SkyUrlValidationDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: SkyUrlValidationDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
112
- SkyUrlValidationDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.7", type: SkyUrlValidationDirective, selector: "[skyUrlValidation]", providers: [SKY_URL_VALIDATION_VALIDATOR], ngImport: i0 });
113
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: SkyUrlValidationDirective, decorators: [{
103
+ SkyUrlValidationDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyUrlValidationDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
104
+ SkyUrlValidationDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: SkyUrlValidationDirective, selector: "[skyUrlValidation]", providers: [SKY_URL_VALIDATION_VALIDATOR], ngImport: i0 });
105
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyUrlValidationDirective, decorators: [{
114
106
  type: Directive,
115
107
  args: [{
116
108
  selector: '[skyUrlValidation]',
117
- providers: [SKY_URL_VALIDATION_VALIDATOR]
109
+ providers: [SKY_URL_VALIDATION_VALIDATOR],
118
110
  }]
119
111
  }] });
120
112
 
121
113
  class SkyUrlValidationModule {
122
114
  }
123
- SkyUrlValidationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: SkyUrlValidationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
124
- SkyUrlValidationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: SkyUrlValidationModule, declarations: [SkyUrlValidationDirective], imports: [FormsModule], exports: [SkyUrlValidationDirective] });
125
- SkyUrlValidationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: SkyUrlValidationModule, imports: [[
126
- FormsModule
127
- ]] });
128
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: SkyUrlValidationModule, decorators: [{
115
+ SkyUrlValidationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyUrlValidationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
116
+ SkyUrlValidationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyUrlValidationModule, declarations: [SkyUrlValidationDirective], imports: [FormsModule], exports: [SkyUrlValidationDirective] });
117
+ SkyUrlValidationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyUrlValidationModule, imports: [[FormsModule]] });
118
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyUrlValidationModule, decorators: [{
129
119
  type: NgModule,
130
120
  args: [{
131
- declarations: [
132
- SkyUrlValidationDirective
133
- ],
134
- imports: [
135
- FormsModule
136
- ],
137
- exports: [
138
- SkyUrlValidationDirective
139
- ]
121
+ declarations: [SkyUrlValidationDirective],
122
+ imports: [FormsModule],
123
+ exports: [SkyUrlValidationDirective],
140
124
  }]
141
125
  }] });
142
126
 
@@ -156,7 +140,9 @@ class SkyValidators {
156
140
  if (!value) {
157
141
  return undefined;
158
142
  }
159
- return SkyValidation.isEmail(value) ? undefined : { 'skyEmail': { invalid: value } };
143
+ return SkyValidation.isEmail(value)
144
+ ? undefined
145
+ : { skyEmail: { invalid: value } };
160
146
  }
161
147
  /**
162
148
  * Validates URLs in reactive forms. Add this validator directly to the form control model in
@@ -170,7 +156,9 @@ class SkyValidators {
170
156
  if (!value) {
171
157
  return undefined;
172
158
  }
173
- return SkyValidation.isUrl(value) ? undefined : { 'skyUrl': { invalid: value } };
159
+ return SkyValidation.isUrl(value)
160
+ ? undefined
161
+ : { skyUrl: { invalid: value } };
174
162
  }
175
163
  }
176
164
 
@@ -1 +1 @@
1
- {"version":3,"file":"skyux-validation.js","sources":["../../../projects/validation/src/modules/validation/validation.ts","../../../projects/validation/src/modules/email-validation/email-validation.directive.ts","../../../projects/validation/src/modules/email-validation/email-validation.module.ts","../../../projects/validation/src/modules/url-validation/url-validation.directive.ts","../../../projects/validation/src/modules/url-validation/url-validation.module.ts","../../../projects/validation/src/modules/validators/validators.ts","../../../projects/validation/src/skyux-validation.ts"],"sourcesContent":["export abstract class SkyValidation {\n public static isEmail(emailAddress: string): boolean {\n // The regex was obtained from http://emailregex.com/\n // which claims to correctly handle ~99% of all email addresses.\n // tslint:disable-next-line:max-line-length\n let regex = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n return regex.test(emailAddress);\n }\n\n public static isUrl(url: string): boolean {\n let regex = /^((http|https):\\/\\/)?([\\w\\-]+\\.)+[\\w\\-]+/i;\n return regex.test(url);\n }\n}\n","import {\n Directive,\n forwardRef\n} from '@angular/core';\n\nimport {\n Validator,\n NG_VALIDATORS,\n AbstractControl\n} from '@angular/forms';\n\nimport {\n SkyValidation\n} from '../validation/validation';\n\n// tslint:disable:no-forward-ref no-use-before-declare\nconst SKY_EMAIL_VALIDATION_VALIDATOR = {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => SkyEmailValidationDirective),\n multi: true\n};\n// tslint:enable\n\n/**\n * Creates an input to validate email addresses. Place this attribute on an `input` element.\n * If users enter values that are not valid email addresses, an error message appears.\n * The directive uses `NgModel` to bind data.\n */\n@Directive({\n selector: '[skyEmailValidation]',\n providers: [SKY_EMAIL_VALIDATION_VALIDATOR]\n})\n\nexport class SkyEmailValidationDirective implements Validator {\n\n public validate(control: AbstractControl): {[key: string]: any} {\n let value = control.value;\n\n if (!value) {\n return;\n }\n\n if (!this.emailIsValid(value)) {\n return {\n 'skyEmail': {\n invalid: control.value\n }\n };\n }\n\n }\n\n public emailIsValid(email: string): boolean {\n return SkyValidation.isEmail(email);\n }\n}\n","import {\n NgModule\n} from '@angular/core';\nimport {\n FormsModule\n} from '@angular/forms';\n\nimport { SkyEmailValidationDirective } from './email-validation.directive';\n\n@NgModule({\n declarations: [\n SkyEmailValidationDirective\n ],\n imports: [\n FormsModule\n ],\n exports: [\n SkyEmailValidationDirective\n ]\n})\nexport class SkyEmailValidationModule { }\n","import {\n Directive,\n forwardRef\n} from '@angular/core';\n\nimport {\n Validator,\n NG_VALIDATORS,\n AbstractControl\n} from '@angular/forms';\n\nimport {\n SkyValidation\n} from '../validation/validation';\n\n// tslint:disable:no-forward-ref no-use-before-declare\nconst SKY_URL_VALIDATION_VALIDATOR = {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => SkyUrlValidationDirective),\n multi: true\n};\n// tslint:enable\n\n/**\n * Creates an input to validate URLs. Place this attribute on an `input` element.\n * If users enters values that are not valid URLs, an error message appears.\n * This directive uses `NgModel` to bind data.\n */\n@Directive({\n selector: '[skyUrlValidation]',\n providers: [SKY_URL_VALIDATION_VALIDATOR]\n})\n\nexport class SkyUrlValidationDirective implements Validator {\n public validate(control: AbstractControl): {[key: string]: any} {\n const value = control.value;\n\n if (!value) {\n return;\n }\n\n if (!this.urlIsValid(value)) {\n return {\n 'skyUrl': {\n invalid: control.value\n }\n };\n }\n }\n\n public urlIsValid(url: string): boolean {\n return SkyValidation.isUrl(url);\n }\n}\n","import {\n NgModule\n} from '@angular/core';\nimport {\n FormsModule\n} from '@angular/forms';\n\nimport {\n SkyUrlValidationDirective\n} from './url-validation.directive';\n\n@NgModule({\n declarations: [\n SkyUrlValidationDirective\n ],\n imports: [\n FormsModule\n ],\n exports: [\n SkyUrlValidationDirective\n ]\n})\nexport class SkyUrlValidationModule { }\n","import {\n AbstractControl,\n ValidationErrors\n} from '@angular/forms';\n\nimport {\n SkyValidation\n} from '../validation/validation';\n\n// Need to add the following to classes which contain static methods.\n// See: https://github.com/ng-packagr/ng-packagr/issues/641\n// @dynamic\nexport class SkyValidators {\n\n /**\n * Validates email addresses in reactive forms. Add this validator directly to the form control\n * model in the component class. If users enter values that are not valid email addresses, the\n * validator throws an error. Since this is a sync validator, it returns a set of validation\n * errors or `undefined` immediately when users enter values.\n * @param control\n */\n public static email(control: AbstractControl): ValidationErrors | null {\n const value = control.value;\n\n if (!value) {\n return undefined;\n }\n\n return SkyValidation.isEmail(value) ? undefined : { 'skyEmail': { invalid: value } };\n }\n\n /**\n * Validates URLs in reactive forms. Add this validator directly to the form control model in\n * the component class. If users enter values that are not valid URLs, the validator throws an\n * error. Since this is a sync validator, it returns a set of validation errors or `undefined`\n * immediately when users enter values.\n * @param control\n */\n public static url(control: AbstractControl): ValidationErrors | null {\n const value = control.value;\n\n if (!value) {\n return undefined;\n }\n\n return SkyValidation.isUrl(value) ? undefined : { 'skyUrl': { invalid: value } };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAAsB,aAAa;IAC1B,OAAO,OAAO,CAAC,YAAoB;;;;QAIxC,IAAI,KAAK,GAAG,wJAAwJ,CAAC;QACrK,OAAO,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;KACjC;IAEM,OAAO,KAAK,CAAC,GAAW;QAC7B,IAAI,KAAK,GAAG,2CAA2C,CAAC;QACxD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACxB;;;ACGH;AACA,MAAM,8BAA8B,GAAG;IACrC,OAAO,EAAE,aAAa;IACtB,WAAW,EAAE,UAAU,CAAC,MAAM,2BAA2B,CAAC;IAC1D,KAAK,EAAE,IAAI;CACZ,CAAC;AACF;AAEA;;;;;MAUa,2BAA2B;IAE/B,QAAQ,CAAC,OAAwB;QACtC,IAAI,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAE1B,IAAI,CAAC,KAAK,EAAE;YACV,OAAO;SACR;QAED,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE;YAC7B,OAAO;gBACL,UAAU,EAAE;oBACV,OAAO,EAAE,OAAO,CAAC,KAAK;iBACvB;aACF,CAAC;SACH;KAEF;IAEM,YAAY,CAAC,KAAa;QAC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4B,CAAC;iBAC1C;;;MCTY,sBAAsB;;mHAAtB,sBAAsB;oHAAtB,sBAAsB,iBAT/B,yBAAyB,aAGzB,WAAW,aAGX,yBAAyB;oHAGhB,sBAAsB,YAPxB;YACP,WAAW;SACZ;2FAKU,sBAAsB;kBAXlC,QAAQ;mBAAC;oBACR,YAAY,EAAE;wBACZ,yBAAyB;qBAC1B;oBACD,OAAO,EAAE;wBACP,WAAW;qBACZ;oBACD,OAAO,EAAE;wBACP,yBAAyB;qBAC1B;iBACF;;;ACZD;AACA;AACA;MACa,aAAa;;;;;;;;IASjB,OAAO,KAAK,CAAC,OAAwB;QAC1C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAE5B,IAAI,CAAC,KAAK,EAAE;YACV,OAAO,SAAS,CAAC;SAClB;QAED,OAAO,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,SAAS,GAAG,EAAE,UAAU,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC;KACtF;;;;;;;;IASM,OAAO,GAAG,CAAC,OAAwB;QACxC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAE5B,IAAI,CAAC,KAAK,EAAE;YACV,OAAO,SAAS,CAAC;SAClB;QAED,OAAO,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,SAAS,GAAG,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC;KAClF;;;AC9CH;;;;;;"}
1
+ {"version":3,"file":"skyux-validation.js","sources":["../../../../../libs/components/validation/src/lib/modules/validation/validation.ts","../../../../../libs/components/validation/src/lib/modules/email-validation/email-validation.directive.ts","../../../../../libs/components/validation/src/lib/modules/email-validation/email-validation.module.ts","../../../../../libs/components/validation/src/lib/modules/url-validation/url-validation.directive.ts","../../../../../libs/components/validation/src/lib/modules/url-validation/url-validation.module.ts","../../../../../libs/components/validation/src/lib/modules/validators/validators.ts","../../../../../libs/components/validation/src/skyux-validation.ts"],"sourcesContent":["export abstract class SkyValidation {\n public static isEmail(emailAddress: string): boolean {\n // The regex was obtained from http://emailregex.com/\n // which claims to correctly handle ~99% of all email addresses.\n // tslint:disable-next-line:max-line-length\n let regex =\n /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n return regex.test(emailAddress);\n }\n\n public static isUrl(url: string): boolean {\n let regex = /^((http|https):\\/\\/)?([\\w\\-]+\\.)+[\\w\\-]+/i;\n return regex.test(url);\n }\n}\n","import { Directive, forwardRef } from '@angular/core';\n\nimport { Validator, NG_VALIDATORS, AbstractControl } from '@angular/forms';\n\nimport { SkyValidation } from '../validation/validation';\n\n// tslint:disable:no-forward-ref no-use-before-declare\nconst SKY_EMAIL_VALIDATION_VALIDATOR = {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => SkyEmailValidationDirective),\n multi: true,\n};\n// tslint:enable\n\n/**\n * Creates an input to validate email addresses. Place this attribute on an `input` element.\n * If users enter values that are not valid email addresses, an error message appears.\n * The directive uses `NgModel` to bind data.\n */\n@Directive({\n selector: '[skyEmailValidation]',\n providers: [SKY_EMAIL_VALIDATION_VALIDATOR],\n})\nexport class SkyEmailValidationDirective implements Validator {\n public validate(control: AbstractControl): { [key: string]: any } {\n let value = control.value;\n\n if (!value) {\n return;\n }\n\n if (!this.emailIsValid(value)) {\n return {\n skyEmail: {\n invalid: control.value,\n },\n };\n }\n }\n\n public emailIsValid(email: string): boolean {\n return SkyValidation.isEmail(email);\n }\n}\n","import { NgModule } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\n\nimport { SkyEmailValidationDirective } from './email-validation.directive';\n\n@NgModule({\n declarations: [SkyEmailValidationDirective],\n imports: [FormsModule],\n exports: [SkyEmailValidationDirective],\n})\nexport class SkyEmailValidationModule {}\n","import { Directive, forwardRef } from '@angular/core';\n\nimport { Validator, NG_VALIDATORS, AbstractControl } from '@angular/forms';\n\nimport { SkyValidation } from '../validation/validation';\n\n// tslint:disable:no-forward-ref no-use-before-declare\nconst SKY_URL_VALIDATION_VALIDATOR = {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => SkyUrlValidationDirective),\n multi: true,\n};\n// tslint:enable\n\n/**\n * Creates an input to validate URLs. Place this attribute on an `input` element.\n * If users enters values that are not valid URLs, an error message appears.\n * This directive uses `NgModel` to bind data.\n */\n@Directive({\n selector: '[skyUrlValidation]',\n providers: [SKY_URL_VALIDATION_VALIDATOR],\n})\nexport class SkyUrlValidationDirective implements Validator {\n public validate(control: AbstractControl): { [key: string]: any } {\n const value = control.value;\n\n if (!value) {\n return;\n }\n\n if (!this.urlIsValid(value)) {\n return {\n skyUrl: {\n invalid: control.value,\n },\n };\n }\n }\n\n public urlIsValid(url: string): boolean {\n return SkyValidation.isUrl(url);\n }\n}\n","import { NgModule } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\n\nimport { SkyUrlValidationDirective } from './url-validation.directive';\n\n@NgModule({\n declarations: [SkyUrlValidationDirective],\n imports: [FormsModule],\n exports: [SkyUrlValidationDirective],\n})\nexport class SkyUrlValidationModule {}\n","import { AbstractControl, ValidationErrors } from '@angular/forms';\n\nimport { SkyValidation } from '../validation/validation';\n\n// Need to add the following to classes which contain static methods.\n// See: https://github.com/ng-packagr/ng-packagr/issues/641\n// @dynamic\nexport class SkyValidators {\n /**\n * Validates email addresses in reactive forms. Add this validator directly to the form control\n * model in the component class. If users enter values that are not valid email addresses, the\n * validator throws an error. Since this is a sync validator, it returns a set of validation\n * errors or `undefined` immediately when users enter values.\n * @param control\n */\n public static email(control: AbstractControl): ValidationErrors | null {\n const value = control.value;\n\n if (!value) {\n return undefined;\n }\n\n return SkyValidation.isEmail(value)\n ? undefined\n : { skyEmail: { invalid: value } };\n }\n\n /**\n * Validates URLs in reactive forms. Add this validator directly to the form control model in\n * the component class. If users enter values that are not valid URLs, the validator throws an\n * error. Since this is a sync validator, it returns a set of validation errors or `undefined`\n * immediately when users enter values.\n * @param control\n */\n public static url(control: AbstractControl): ValidationErrors | null {\n const value = control.value;\n\n if (!value) {\n return undefined;\n }\n\n return SkyValidation.isUrl(value)\n ? undefined\n : { skyUrl: { invalid: value } };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAAsB,aAAa;IAC1B,OAAO,OAAO,CAAC,YAAoB;;;;QAIxC,IAAI,KAAK,GACP,wJAAwJ,CAAC;QAC3J,OAAO,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;KACjC;IAEM,OAAO,KAAK,CAAC,GAAW;QAC7B,IAAI,KAAK,GAAG,2CAA2C,CAAC;QACxD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACxB;;;ACPH;AACA,MAAM,8BAA8B,GAAG;IACrC,OAAO,EAAE,aAAa;IACtB,WAAW,EAAE,UAAU,CAAC,MAAM,2BAA2B,CAAC;IAC1D,KAAK,EAAE,IAAI;CACZ,CAAC;AACF;AAEA;;;;;MASa,2BAA2B;IAC/B,QAAQ,CAAC,OAAwB;QACtC,IAAI,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAE1B,IAAI,CAAC,KAAK,EAAE;YACV,OAAO;SACR;QAED,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE;YAC7B,OAAO;gBACL,QAAQ,EAAE;oBACR,OAAO,EAAE,OAAO,CAAC,KAAK;iBACvB;aACF,CAAC;SACH;KACF;IAEM,YAAY,CAAC,KAAa;QAC/B,OAAO,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;KACrC;;yHAnBU,2BAA2B;6GAA3B,2BAA2B,+CAF3B,CAAC,8BAA8B,CAAC;4FAEhC,2BAA2B;kBAJvC,SAA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;4FAGX,sBAAsB;kBALlC,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAC,yBAAyB,CAAC;oBACzC,OAAO,EAAE,CAAC,WAAW,CAAC;oBACtB,OAAO,EAAE,CAAC,yBAAyB,CAAC;iBACrC;;;ACLD;AACA;AACA;MACa,aAAa;;;;;;;;IAQjB,OAAO,KAAK,CAAC,OAAwB;QAC1C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAE5B,IAAI,CAAC,KAAK,EAAE;YACV,OAAO,SAAS,CAAC;SAClB;QAED,OAAO,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC;cAC/B,SAAS;cACT,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC;KACtC;;;;;;;;IASM,OAAO,GAAG,CAAC,OAAwB;QACxC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAE5B,IAAI,CAAC,KAAK,EAAE;YACV,OAAO,SAAS,CAAC;SAClB;QAED,OAAO,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC;cAC7B,SAAS;cACT,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC;KACpC;;;AC5CH;;;;;;"}
package/index.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ export * from './lib/modules/email-validation/email-validation.module';
2
+ export * from './lib/modules/url-validation/url-validation.module';
3
+ export * from './lib/modules/validation/validation';
4
+ export * from './lib/modules/validators/validators';
5
+ export { SkyEmailValidationDirective as λ1 } from './lib/modules/email-validation/email-validation.directive';
6
+ export { SkyUrlValidationDirective as λ2 } from './lib/modules/url-validation/url-validation.directive';
package/package.json CHANGED
@@ -1,14 +1,28 @@
1
1
  {
2
2
  "name": "@skyux/validation",
3
- "version": "5.0.0",
3
+ "version": "5.5.0-beta.0",
4
4
  "peerDependencies": {
5
- "@angular/common": "^12.2.7",
6
- "@angular/core": "^12.2.7",
7
- "@angular/forms": "^12.2.7"
5
+ "@angular/common": "^12.2.16",
6
+ "@angular/core": "^12.2.16",
7
+ "@angular/forms": "^12.2.16"
8
8
  },
9
9
  "dependencies": {
10
- "tslib": "^2.3.0"
10
+ "tslib": "^2.3.1"
11
11
  },
12
+ "author": "Blackbaud, Inc.",
13
+ "keywords": [
14
+ "blackbaud",
15
+ "skyux"
16
+ ],
17
+ "license": "MIT",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/blackbaud/skyux.git"
21
+ },
22
+ "bugs": {
23
+ "url": "https://github.com/blackbaud/skyux/issues"
24
+ },
25
+ "homepage": "https://github.com/blackbaud/skyux#readme",
12
26
  "main": "bundles/skyux-validation.umd.js",
13
27
  "module": "fesm2015/skyux-validation.js",
14
28
  "es2015": "fesm2015/skyux-validation.js",
@@ -2,4 +2,4 @@
2
2
  * Generated bundle index. Do not edit.
3
3
  */
4
4
  /// <amd-module name="@skyux/validation" />
5
- export * from './public-api';
5
+ export * from './index';
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2020 Blackbaud
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1 +0,0 @@
1
- {"version":3,"file":"skyux-validation.umd.js","sources":["../../../projects/validation/src/modules/validation/validation.ts","../../../projects/validation/src/modules/email-validation/email-validation.directive.ts","../../../projects/validation/src/modules/email-validation/email-validation.module.ts","../../../projects/validation/src/modules/url-validation/url-validation.directive.ts","../../../projects/validation/src/modules/url-validation/url-validation.module.ts","../../../projects/validation/src/modules/validators/validators.ts","../../../projects/validation/src/skyux-validation.ts"],"sourcesContent":["export abstract class SkyValidation {\n public static isEmail(emailAddress: string): boolean {\n // The regex was obtained from http://emailregex.com/\n // which claims to correctly handle ~99% of all email addresses.\n // tslint:disable-next-line:max-line-length\n let regex = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n return regex.test(emailAddress);\n }\n\n public static isUrl(url: string): boolean {\n let regex = /^((http|https):\\/\\/)?([\\w\\-]+\\.)+[\\w\\-]+/i;\n return regex.test(url);\n }\n}\n","import {\n Directive,\n forwardRef\n} from '@angular/core';\n\nimport {\n Validator,\n NG_VALIDATORS,\n AbstractControl\n} from '@angular/forms';\n\nimport {\n SkyValidation\n} from '../validation/validation';\n\n// tslint:disable:no-forward-ref no-use-before-declare\nconst SKY_EMAIL_VALIDATION_VALIDATOR = {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => SkyEmailValidationDirective),\n multi: true\n};\n// tslint:enable\n\n/**\n * Creates an input to validate email addresses. Place this attribute on an `input` element.\n * If users enter values that are not valid email addresses, an error message appears.\n * The directive uses `NgModel` to bind data.\n */\n@Directive({\n selector: '[skyEmailValidation]',\n providers: [SKY_EMAIL_VALIDATION_VALIDATOR]\n})\n\nexport class SkyEmailValidationDirective implements Validator {\n\n public validate(control: AbstractControl): {[key: string]: any} {\n let value = control.value;\n\n if (!value) {\n return;\n }\n\n if (!this.emailIsValid(value)) {\n return {\n 'skyEmail': {\n invalid: control.value\n }\n };\n }\n\n }\n\n public emailIsValid(email: string): boolean {\n return SkyValidation.isEmail(email);\n }\n}\n","import {\n NgModule\n} from '@angular/core';\nimport {\n FormsModule\n} from '@angular/forms';\n\nimport { SkyEmailValidationDirective } from './email-validation.directive';\n\n@NgModule({\n declarations: [\n SkyEmailValidationDirective\n ],\n imports: [\n FormsModule\n ],\n exports: [\n SkyEmailValidationDirective\n ]\n})\nexport class SkyEmailValidationModule { }\n","import {\n Directive,\n forwardRef\n} from '@angular/core';\n\nimport {\n Validator,\n NG_VALIDATORS,\n AbstractControl\n} from '@angular/forms';\n\nimport {\n SkyValidation\n} from '../validation/validation';\n\n// tslint:disable:no-forward-ref no-use-before-declare\nconst SKY_URL_VALIDATION_VALIDATOR = {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => SkyUrlValidationDirective),\n multi: true\n};\n// tslint:enable\n\n/**\n * Creates an input to validate URLs. Place this attribute on an `input` element.\n * If users enters values that are not valid URLs, an error message appears.\n * This directive uses `NgModel` to bind data.\n */\n@Directive({\n selector: '[skyUrlValidation]',\n providers: [SKY_URL_VALIDATION_VALIDATOR]\n})\n\nexport class SkyUrlValidationDirective implements Validator {\n public validate(control: AbstractControl): {[key: string]: any} {\n const value = control.value;\n\n if (!value) {\n return;\n }\n\n if (!this.urlIsValid(value)) {\n return {\n 'skyUrl': {\n invalid: control.value\n }\n };\n }\n }\n\n public urlIsValid(url: string): boolean {\n return SkyValidation.isUrl(url);\n }\n}\n","import {\n NgModule\n} from '@angular/core';\nimport {\n FormsModule\n} from '@angular/forms';\n\nimport {\n SkyUrlValidationDirective\n} from './url-validation.directive';\n\n@NgModule({\n declarations: [\n SkyUrlValidationDirective\n ],\n imports: [\n FormsModule\n ],\n exports: [\n SkyUrlValidationDirective\n ]\n})\nexport class SkyUrlValidationModule { }\n","import {\n AbstractControl,\n ValidationErrors\n} from '@angular/forms';\n\nimport {\n SkyValidation\n} from '../validation/validation';\n\n// Need to add the following to classes which contain static methods.\n// See: https://github.com/ng-packagr/ng-packagr/issues/641\n// @dynamic\nexport class SkyValidators {\n\n /**\n * Validates email addresses in reactive forms. Add this validator directly to the form control\n * model in the component class. If users enter values that are not valid email addresses, the\n * validator throws an error. Since this is a sync validator, it returns a set of validation\n * errors or `undefined` immediately when users enter values.\n * @param control\n */\n public static email(control: AbstractControl): ValidationErrors | null {\n const value = control.value;\n\n if (!value) {\n return undefined;\n }\n\n return SkyValidation.isEmail(value) ? undefined : { 'skyEmail': { invalid: value } };\n }\n\n /**\n * Validates URLs in reactive forms. Add this validator directly to the form control model in\n * the component class. If users enter values that are not valid URLs, the validator throws an\n * error. Since this is a sync validator, it returns a set of validation errors or `undefined`\n * immediately when users enter values.\n * @param control\n */\n public static url(control: AbstractControl): ValidationErrors | null {\n const value = control.value;\n\n if (!value) {\n return undefined;\n }\n\n return SkyValidation.isUrl(value) ? undefined : { 'skyUrl': { invalid: value } };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["NG_VALIDATORS","forwardRef","Directive","FormsModule","NgModule"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAAA;SAaC;QAZe,qBAAO,GAAd,UAAe,YAAoB;;;;YAIxC,IAAI,KAAK,GAAG,wJAAwJ,CAAC;YACrK,OAAO,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;SACjC;QAEa,mBAAK,GAAZ,UAAa,GAAW;YAC7B,IAAI,KAAK,GAAG,2CAA2C,CAAC;YACxD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACxB;4BACF;KAAA;;ICED;IACA,IAAM,8BAA8B,GAAG;QACrC,OAAO,EAAEA,mBAAa;QACtB,WAAW,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V,OAAO,SAAS,CAAC;aAClB;YAED,OAAO,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,SAAS,GAAG,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC;SAClF;4BACF;KAAA;;IC/CD;;;;;;;;;;;;;;;;;"}
@@ -1,44 +0,0 @@
1
- import { Directive, forwardRef } from '@angular/core';
2
- import { NG_VALIDATORS } from '@angular/forms';
3
- import { SkyValidation } from '../validation/validation';
4
- import * as i0 from "@angular/core";
5
- // tslint:disable:no-forward-ref no-use-before-declare
6
- const SKY_EMAIL_VALIDATION_VALIDATOR = {
7
- provide: NG_VALIDATORS,
8
- useExisting: forwardRef(() => SkyEmailValidationDirective),
9
- multi: true
10
- };
11
- // tslint:enable
12
- /**
13
- * Creates an input to validate email addresses. Place this attribute on an `input` element.
14
- * If users enter values that are not valid email addresses, an error message appears.
15
- * The directive uses `NgModel` to bind data.
16
- */
17
- export class SkyEmailValidationDirective {
18
- validate(control) {
19
- let value = control.value;
20
- if (!value) {
21
- return;
22
- }
23
- if (!this.emailIsValid(value)) {
24
- return {
25
- 'skyEmail': {
26
- invalid: control.value
27
- }
28
- };
29
- }
30
- }
31
- emailIsValid(email) {
32
- return SkyValidation.isEmail(email);
33
- }
34
- }
35
- SkyEmailValidationDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: SkyEmailValidationDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
36
- SkyEmailValidationDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.7", type: SkyEmailValidationDirective, selector: "[skyEmailValidation]", providers: [SKY_EMAIL_VALIDATION_VALIDATOR], ngImport: i0 });
37
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: SkyEmailValidationDirective, decorators: [{
38
- type: Directive,
39
- args: [{
40
- selector: '[skyEmailValidation]',
41
-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GUgb24gYW4gYGlucHV0YCBlbGVtZW50LlxuICogSWYgdXNlcnMgZW50ZXIgdmFsdWVzIHRoYXQgYXJlIG5vdCB2YWxpZCBlbWFpbCBhZGRyZXNzZXMsIGFuIGVycm9yIG1lc3NhZ2UgYXBwZWFycy5cbiAqIFRoZSBkaXJlY3RpdmUgdXNlcyBgTmdNb2RlbGAgdG8gYmluZCBkYXRhLlxuICovXG5ARGlyZWN0aXZlKHtcbiAgc2VsZWN0b3I6ICdbc2t5RW1haWxWYWxpZGF0aW9uXScsXG4gIHByb3ZpZGVyczogW1NLWV9FTUFJTF9WQUxJREFUSU9OX1ZBTElEQVRPUl1cbn0pXG5cbmV4cG9ydCBjbGFzcyBTa3lFbWFpbFZhbGlkYXRpb25EaXJlY3RpdmUgaW1wbGVtZW50cyBWYWxpZGF0b3Ige1xuXG4gIHB1YmxpYyB2YWxpZGF0ZShjb250cm9sOiBBYnN0cmFjdENvbnRyb2wpOiB7W2tleTogc3RyaW5nXTogYW55fSB7XG4gICAgbGV0IHZhbHVlID0gY29udHJvbC52YWx1ZTtcblxuICAgIGlmICghdmFsdWUpIHtcbiAgICAgIHJldHVybjtcbiAgICB9XG5cbiAgICBpZiAoIXRoaXMuZW1haWxJc1ZhbGlkKHZhbHVlKSkge1xuICAgICAgcmV0dXJuIHtcbiAgICAgICAgJ3NreUVtYWlsJzoge1xuICAgICAgICAgIGludmFsaWQ6IGNvbnRyb2wudmFsdWVcbiAgICAgICAgfVxuICAgICAgfTtcbiAgICB9XG5cbiAgfVxuXG4gIHB1YmxpYyBlbWFpbElzVmFsaWQoZW1haWw6IHN0cmluZyk6IGJvb2xlYW4ge1xuICAgIHJldHVybiBTa3lWYWxpZGF0aW9uLmlzRW1haWwoZW1haWwpO1xuICB9XG59XG4iXX0=
@@ -1,26 +0,0 @@
1
- import { NgModule } from '@angular/core';
2
- import { FormsModule } from '@angular/forms';
3
- import { SkyEmailValidationDirective } from './email-validation.directive';
4
- import * as i0 from "@angular/core";
5
- export class SkyEmailValidationModule {
6
- }
7
- SkyEmailValidationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: SkyEmailValidationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
8
- SkyEmailValidationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: SkyEmailValidationModule, declarations: [SkyEmailValidationDirective], imports: [FormsModule], exports: [SkyEmailValidationDirective] });
9
- SkyEmailValidationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: SkyEmailValidationModule, imports: [[
10
- FormsModule
11
- ]] });
12
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0, type: SkyEmailValidationModule, decorators: [{
13
- type: NgModule,
14
- args: [{
15
- declarations: [
16
- SkyEmailValidationDirective
17
- ],
18
- imports: [
19
- FormsModule
20
- ],
21
- exports: [
22
- SkyEmailValidationDirective
23
- ]
24
- }]
25
- }] });
26
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1haWwtdmFsaWRhdGlvbi5tb2R1bGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy92YWxpZGF0aW9uL3NyYy9tb2R1bGVzL2VtYWlsLXZhbGlkYXRpb24vZW1haWwtdmFsaWRhdGlvbi5tb2R1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUNMLFFBQVEsRUFDVCxNQUFNLGVBQWUsQ0FBQztBQUN2QixPQUFPLEVBQ0wsV0FBVyxFQUNaLE1BQU0sZ0JBQWdCLENBQUM7QUFFeEIsT0FBTyxFQUFFLDJCQUEyQixFQUFFLE1BQU0sOEJBQThCLENBQUM7O0FBYTNFLE1BQU0sT0FBTyx3QkFBd0I7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