@anglr/common 12.0.0-beta.20220413111906 → 12.0.0-beta.20220413122054

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 (34) hide show
  1. package/changelog.md +4 -0
  2. package/es2015/forms/src/index.js +1 -1
  3. package/es2015/forms/src/index.js.map +1 -1
  4. package/es2015/forms/src/misc/tokens.js +10 -0
  5. package/es2015/forms/src/misc/tokens.js.map +1 -0
  6. package/es2015/forms/src/modules/errorMessage/directives/errorMessage/errorMessage.directive.js +1 -1
  7. package/es2015/forms/src/modules/errorMessage/directives/errorMessage/errorMessage.directive.js.map +1 -1
  8. package/es2015/forms/src/modules/errorMessage/pipes/withErrorMessage/withErrorMessage.pipe.js +1 -1
  9. package/es2015/forms/src/modules/errorMessage/pipes/withErrorMessage/withErrorMessage.pipe.js.map +1 -1
  10. package/es2015/forms/src/services/errorMessagesExtractor/errorMessagesExtractor.service.js +12 -5
  11. package/es2015/forms/src/services/errorMessagesExtractor/errorMessagesExtractor.service.js.map +1 -1
  12. package/es2020/forms/src/index.js +1 -1
  13. package/es2020/forms/src/index.js.map +1 -1
  14. package/es2020/forms/src/misc/tokens.js +10 -0
  15. package/es2020/forms/src/misc/tokens.js.map +1 -0
  16. package/es2020/forms/src/modules/errorMessage/directives/errorMessage/errorMessage.directive.js +1 -1
  17. package/es2020/forms/src/modules/errorMessage/directives/errorMessage/errorMessage.directive.js.map +1 -1
  18. package/es2020/forms/src/modules/errorMessage/pipes/withErrorMessage/withErrorMessage.pipe.js +1 -1
  19. package/es2020/forms/src/modules/errorMessage/pipes/withErrorMessage/withErrorMessage.pipe.js.map +1 -1
  20. package/es2020/forms/src/services/errorMessagesExtractor/errorMessagesExtractor.service.js +12 -5
  21. package/es2020/forms/src/services/errorMessagesExtractor/errorMessagesExtractor.service.js.map +1 -1
  22. package/forms/src/index.d.ts +1 -1
  23. package/forms/src/index.d.ts.map +1 -1
  24. package/forms/src/misc/{types.d.ts → tokens.d.ts} +5 -1
  25. package/forms/src/misc/tokens.d.ts.map +1 -0
  26. package/forms/src/services/errorMessagesExtractor/errorMessagesExtractor.service.d.ts +3 -2
  27. package/forms/src/services/errorMessagesExtractor/errorMessagesExtractor.service.d.ts.map +1 -1
  28. package/package.json +1 -1
  29. package/version.bak +1 -1
  30. package/es2015/forms/src/misc/types.js +0 -6
  31. package/es2015/forms/src/misc/types.js.map +0 -1
  32. package/es2020/forms/src/misc/types.js +0 -6
  33. package/es2020/forms/src/misc/types.js.map +0 -1
  34. package/forms/src/misc/types.d.ts.map +0 -1
package/changelog.md CHANGED
@@ -15,6 +15,10 @@
15
15
  - **Form Model Builder**
16
16
  - updated `ModelDecoratorMetadata`
17
17
  - property `ɵArgs` object storing additional arguments for customization
18
+ - new `IGNORED_VALIDATION_ERRORS` injection token for injecting array of ignored error names when automatically processed
19
+ - updated `ErrorMessagesExtractor` service
20
+ - now supports `IGNORED_VALIDATION_ERRORS`
21
+ - now allows to display validation error 'value' if it is `string`
18
22
 
19
23
  ### BREAKING CHANGES
20
24
 
@@ -12,7 +12,7 @@ export * from './services/validationErrorRenderer/validationErrorRenderer.interf
12
12
  export * from './services/validationErrorRenderer/validationErrorRenderer.service';
13
13
  export * from './misc/validators';
14
14
  export * from './misc/utils';
15
- export * from './misc/types';
15
+ export * from './misc/tokens';
16
16
  export * from './modules/numberInput.module';
17
17
  export * from './modules/hasError.module';
18
18
  export * from './modules/requiredClass.module';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../forms/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4DAA4D,CAAC;AAC3E,cAAc,4DAA4D,CAAC;AAC3E,cAAc,yDAAyD,CAAC;AACxE,cAAc,oEAAoE,CAAC;AACnF,cAAc,0CAA0C,CAAC;AACzD,cAAc,oDAAoD,CAAC;AACnE,cAAc,oDAAoD,CAAC;AACnE,cAAc,wCAAwC,CAAC;AACvD,cAAc,oEAAoE,CAAC;AACnF,cAAc,kEAAkE,CAAC;AACjF,cAAc,sEAAsE,CAAC;AACrF,cAAc,oEAAoE,CAAC;AACnF,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC","sourcesContent":["export * from './directives/numberInput/maxValueNumberValidator.directive';\nexport * from './directives/numberInput/minValueNumberValidator.directive';\nexport * from './directives/numberInput/numberInputValidator.directive';\nexport * from './directives/numberInput/numberInputControlValueAccessor.directive';\nexport * from './directives/hasError/hasError.directive';\nexport * from './directives/groupHasError/groupHasError.directive';\nexport * from './directives/requiredClass/requiredClass.directive';\nexport * from './services/submitted/submitted.service';\nexport * from './services/errorMessagesExtractor/errorMessagesExtractor.interface';\nexport * from './services/errorMessagesExtractor/errorMessagesExtractor.service';\nexport * from './services/validationErrorRenderer/validationErrorRenderer.interface';\nexport * from './services/validationErrorRenderer/validationErrorRenderer.service';\nexport * from './misc/validators';\nexport * from './misc/utils';\nexport * from './misc/types';\nexport * from './modules/numberInput.module';\nexport * from './modules/hasError.module';\nexport * from './modules/requiredClass.module';\nexport * from './modules/formPipes';\nexport * from './modules/errorMessage';\nexport * from './misc/formModel';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../forms/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4DAA4D,CAAC;AAC3E,cAAc,4DAA4D,CAAC;AAC3E,cAAc,yDAAyD,CAAC;AACxE,cAAc,oEAAoE,CAAC;AACnF,cAAc,0CAA0C,CAAC;AACzD,cAAc,oDAAoD,CAAC;AACnE,cAAc,oDAAoD,CAAC;AACnE,cAAc,wCAAwC,CAAC;AACvD,cAAc,oEAAoE,CAAC;AACnF,cAAc,kEAAkE,CAAC;AACjF,cAAc,sEAAsE,CAAC;AACrF,cAAc,oEAAoE,CAAC;AACnF,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC","sourcesContent":["export * from './directives/numberInput/maxValueNumberValidator.directive';\nexport * from './directives/numberInput/minValueNumberValidator.directive';\nexport * from './directives/numberInput/numberInputValidator.directive';\nexport * from './directives/numberInput/numberInputControlValueAccessor.directive';\nexport * from './directives/hasError/hasError.directive';\nexport * from './directives/groupHasError/groupHasError.directive';\nexport * from './directives/requiredClass/requiredClass.directive';\nexport * from './services/submitted/submitted.service';\nexport * from './services/errorMessagesExtractor/errorMessagesExtractor.interface';\nexport * from './services/errorMessagesExtractor/errorMessagesExtractor.service';\nexport * from './services/validationErrorRenderer/validationErrorRenderer.interface';\nexport * from './services/validationErrorRenderer/validationErrorRenderer.service';\nexport * from './misc/validators';\nexport * from './misc/utils';\nexport * from './misc/tokens';\nexport * from './modules/numberInput.module';\nexport * from './modules/hasError.module';\nexport * from './modules/requiredClass.module';\nexport * from './modules/formPipes';\nexport * from './modules/errorMessage';\nexport * from './misc/formModel';\n"]}
@@ -0,0 +1,10 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ /**
3
+ * Injection token containing validation error messages
4
+ */
5
+ export const VALIDATION_ERROR_MESSAGES = new InjectionToken('VALIDATION_ERROR_MESSAGES');
6
+ /**
7
+ * Injection token for injecting array of ignored error names when automatically processed
8
+ */
9
+ export const IGNORED_VALIDATION_ERRORS = new InjectionToken('IGNORED_VALIDATION_ERRORS', { providedIn: 'root', factory: () => ['actual'] });
10
+ //# sourceMappingURL=tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../../forms/src/misc/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAG7C;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAqC,IAAI,cAAc,CAAmB,2BAA2B,CAAC,CAAC;AAE7I;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAA6B,IAAI,cAAc,CAAW,2BAA2B,EAAE,EAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAC,CAAC,CAAC","sourcesContent":["import {InjectionToken} from '@angular/core';\nimport {StringDictionary} from '@jscrpt/common';\n\n/**\n * Injection token containing validation error messages\n */\nexport const VALIDATION_ERROR_MESSAGES: InjectionToken<StringDictionary> = new InjectionToken<StringDictionary>('VALIDATION_ERROR_MESSAGES');\n\n/**\n * Injection token for injecting array of ignored error names when automatically processed\n */\nexport const IGNORED_VALIDATION_ERRORS: InjectionToken<string[]> = new InjectionToken<string[]>('IGNORED_VALIDATION_ERRORS', {providedIn: 'root', factory: () => ['actual']});\n"]}
@@ -2,7 +2,7 @@ import { Directive, ElementRef, Inject, Input } from '@angular/core';
2
2
  import { STRING_LOCALIZATION } from '@anglr/common';
3
3
  import { isBlank, nameof } from '@jscrpt/common';
4
4
  import { Subscription } from 'rxjs';
5
- import { VALIDATION_ERROR_MESSAGES } from '../../../../misc/types';
5
+ import { VALIDATION_ERROR_MESSAGES } from '../../../../misc/tokens';
6
6
  import * as i0 from "@angular/core";
7
7
  /**
8
8
  * Directive used for displaying form error message
@@ -1 +1 @@
1
- {"version":3,"file":"errorMessage.directive.js","sourceRoot":"","sources":["../../../../../../../forms/src/modules/errorMessage/directives/errorMessage/errorMessage.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAsC,MAAM,eAAe,CAAC;AACxG,OAAO,EAAqB,mBAAmB,EAAC,MAAM,eAAe,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AAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAElE,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,SAAS,GAAG,OAAO,CAAC;IACpD,CAAC;;kHAzEQ,qBAAqB,4CAyBV,mBAAmB,aACnB,yBAAyB;sGA1BpC,qBAAqB;2FAArB,qBAAqB;kBALjC,SAAS;mBACV;oBACI,QAAQ,EAAE,gBAAgB;oBAC1B,QAAQ,EAAE,cAAc;iBAC3B;;0BA0BgB,MAAM;2BAAC,mBAAmB;;0BAC1B,MAAM;2BAAC,yBAAyB;4CAXtC,SAAS;sBADf,KAAK;uBAAC,cAAc;gBAOd,MAAM;sBADZ,KAAK","sourcesContent":["import {Directive, ElementRef, Inject, Input, OnChanges, OnDestroy, SimpleChanges} from '@angular/core';\nimport {StringLocalization, STRING_LOCALIZATION} from '@anglr/common';\nimport {Dictionary, isBlank, nameof, StringDictionary} from '@jscrpt/common';\nimport {Subscription} from 'rxjs';\n\nimport {VALIDATION_ERROR_MESSAGES} from '../../../../misc/types';\n\n/**\n * Directive used for displaying form error message\n */\n@Directive(\n{\n selector: '[errorMessage]',\n exportAs: 'errorMessage'\n})\nexport class ErrorMessageDirective implements OnChanges, OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Subscriptions created during initialization\n */\n protected _initSubscriptions: Subscription = new Subscription();\n\n //######################### public properties - inputs #########################\n\n /**\n * Name/code of error message to be displayed\n */\n @Input('errorMessage')\n public errorName: string;\n\n /**\n * Object storing all errors\n */\n @Input()\n public errors: Dictionary;\n\n //######################### constructor #########################\n constructor(protected _element: ElementRef<HTMLElement>,\n @Inject(STRING_LOCALIZATION) protected _localization: StringLocalization,\n @Inject(VALIDATION_ERROR_MESSAGES) protected _errorMessages: StringDictionary,)\n {\n this._initSubscriptions.add(this._localization.textsChange.subscribe(() => this._showMessage()));\n }\n\n //######################### public methods - implementation of OnChanges #########################\n \n /**\n * Called when input value changes\n */\n public ngOnChanges(changes: SimpleChanges): void\n {\n if(nameof<ErrorMessageDirective>('errorName') in changes)\n {\n this._showMessage();\n }\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n \n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n this._initSubscriptions?.unsubscribe();\n this._initSubscriptions = null;\n }\n\n //######################### protected methods #########################\n\n /**\n * Shows message inside of element\n */\n protected _showMessage(): void\n {\n if(isBlank(this.errorName))\n {\n this._element.nativeElement.innerHTML = '';\n\n return;\n }\n\n const errorMessage = this._errorMessages[this.errorName];\n const message = this._localization.get(errorMessage, this.errors);\n\n this._element.nativeElement.innerHTML = message;\n }\n}"]}
1
+ {"version":3,"file":"errorMessage.directive.js","sourceRoot":"","sources":["../../../../../../../forms/src/modules/errorMessage/directives/errorMessage/errorMessage.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAsC,MAAM,eAAe,CAAC;AACxG,OAAO,EAAqB,mBAAmB,EAAC,MAAM,eAAe,CAAC;AACtE,OAAO,EAAa,OAAO,EAAE,MAAM,EAAmB,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAElC,OAAO,EAAC,yBAAyB,EAAC,MAAM,yBAAyB,CAAC;;AAElE;;GAEG;AAMH,MAAM,OAAO,qBAAqB;IAuB9B,iEAAiE;IACjE,YAAsB,QAAiC,EACJ,aAAiC,EAC3B,cAAgC;QAFnE,aAAQ,GAAR,QAAQ,CAAyB;QACJ,kBAAa,GAAb,aAAa,CAAoB;QAC3B,mBAAc,GAAd,cAAc,CAAkB;QAxBzF,0EAA0E;QAE1E;;WAEG;QACO,uBAAkB,GAAiB,IAAI,YAAY,EAAE,CAAC;QAqB5D,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;IACrG,CAAC;IAED,kGAAkG;IAElG;;OAEG;IACI,WAAW,CAAC,OAAsB;QAErC,IAAG,MAAM,CAAwB,WAAW,CAAC,IAAI,OAAO,EACxD;YACI,IAAI,CAAC,YAAY,EAAE,CAAC;SACvB;IACL,CAAC;IAED,kGAAkG;IAElG;;OAEG;IACI,WAAW;;QAEd,MAAA,IAAI,CAAC,kBAAkB,0CAAE,WAAW,EAAE,CAAC;QACvC,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;IACnC,CAAC;IAED,uEAAuE;IAEvE;;OAEG;IACO,YAAY;QAElB,IAAG,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,EAC1B;YACI,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,SAAS,GAAG,EAAE,CAAC;YAE3C,OAAO;SACV;QAED,MAAM,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzD,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAElE,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,SAAS,GAAG,OAAO,CAAC;IACpD,CAAC;;kHAzEQ,qBAAqB,4CAyBV,mBAAmB,aACnB,yBAAyB;sGA1BpC,qBAAqB;2FAArB,qBAAqB;kBALjC,SAAS;mBACV;oBACI,QAAQ,EAAE,gBAAgB;oBAC1B,QAAQ,EAAE,cAAc;iBAC3B;;0BA0BgB,MAAM;2BAAC,mBAAmB;;0BAC1B,MAAM;2BAAC,yBAAyB;4CAXtC,SAAS;sBADf,KAAK;uBAAC,cAAc;gBAOd,MAAM;sBADZ,KAAK","sourcesContent":["import {Directive, ElementRef, Inject, Input, OnChanges, OnDestroy, SimpleChanges} from '@angular/core';\nimport {StringLocalization, STRING_LOCALIZATION} from '@anglr/common';\nimport {Dictionary, isBlank, nameof, StringDictionary} from '@jscrpt/common';\nimport {Subscription} from 'rxjs';\n\nimport {VALIDATION_ERROR_MESSAGES} from '../../../../misc/tokens';\n\n/**\n * Directive used for displaying form error message\n */\n@Directive(\n{\n selector: '[errorMessage]',\n exportAs: 'errorMessage'\n})\nexport class ErrorMessageDirective implements OnChanges, OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Subscriptions created during initialization\n */\n protected _initSubscriptions: Subscription = new Subscription();\n\n //######################### public properties - inputs #########################\n\n /**\n * Name/code of error message to be displayed\n */\n @Input('errorMessage')\n public errorName: string;\n\n /**\n * Object storing all errors\n */\n @Input()\n public errors: Dictionary;\n\n //######################### constructor #########################\n constructor(protected _element: ElementRef<HTMLElement>,\n @Inject(STRING_LOCALIZATION) protected _localization: StringLocalization,\n @Inject(VALIDATION_ERROR_MESSAGES) protected _errorMessages: StringDictionary,)\n {\n this._initSubscriptions.add(this._localization.textsChange.subscribe(() => this._showMessage()));\n }\n\n //######################### public methods - implementation of OnChanges #########################\n \n /**\n * Called when input value changes\n */\n public ngOnChanges(changes: SimpleChanges): void\n {\n if(nameof<ErrorMessageDirective>('errorName') in changes)\n {\n this._showMessage();\n }\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n \n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n this._initSubscriptions?.unsubscribe();\n this._initSubscriptions = null;\n }\n\n //######################### protected methods #########################\n\n /**\n * Shows message inside of element\n */\n protected _showMessage(): void\n {\n if(isBlank(this.errorName))\n {\n this._element.nativeElement.innerHTML = '';\n\n return;\n }\n\n const errorMessage = this._errorMessages[this.errorName];\n const message = this._localization.get(errorMessage, this.errors);\n\n this._element.nativeElement.innerHTML = message;\n }\n}"]}
@@ -1,5 +1,5 @@
1
1
  import { Inject, Pipe } from '@angular/core';
2
- import { VALIDATION_ERROR_MESSAGES } from '../../../../misc/types';
2
+ import { VALIDATION_ERROR_MESSAGES } from '../../../../misc/tokens';
3
3
  import * as i0 from "@angular/core";
4
4
  /**
5
5
  * Filters array of errors with messages
@@ -1 +1 @@
1
- {"version":3,"file":"withErrorMessage.pipe.js","sourceRoot":"","sources":["../../../../../../../forms/src/modules/errorMessage/pipes/withErrorMessage/withErrorMessage.pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,IAAI,EAAgB,MAAM,eAAe,CAAC;AAG1D,OAAO,EAAC,yBAAyB,EAAC,MAAM,wBAAwB,CAAC;;AAEjE;;GAEG;AAEH,MAAM,OAAO,oBAAoB;IAE7B,iEAAiE;IACjE,YAAyD,cAAgC;QAAhC,mBAAc,GAAd,cAAc,CAAkB;IAEzF,CAAC;IAED,sGAAsG;IAEtG;;;OAGG;IACI,SAAS,CAAC,KAAe;QAE5B,IAAG,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,CAAA,EACjB;YACI,OAAO,KAAK,CAAC;SAChB;QAED,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;IACzD,CAAC;;iHArBQ,oBAAoB,kBAGT,yBAAyB;+GAHpC,oBAAoB;2FAApB,oBAAoB;kBADhC,IAAI;mBAAC,EAAC,IAAI,EAAE,kBAAkB,EAAC;;0BAIf,MAAM;2BAAC,yBAAyB","sourcesContent":["import {Inject, Pipe, PipeTransform} from '@angular/core';\nimport {StringDictionary} from '@jscrpt/common';\n\nimport {VALIDATION_ERROR_MESSAGES} from '../../../../misc/types';\n\n/**\n * Filters array of errors with messages\n */\n@Pipe({name: 'withErrorMessage'})\nexport class WithErrorMessagePipe implements PipeTransform\n{\n //######################### constructor #########################\n constructor(@Inject(VALIDATION_ERROR_MESSAGES) protected _errorMessages: StringDictionary)\n {\n }\n\n //######################### public methods - implementation of PipeTransform #########################\n\n /**\n * Filters array of errors with messages\n * @param value - Array of error names\n */\n public transform(value: string[]): string[]\n {\n if(!value?.length)\n {\n return value;\n }\n\n return value.filter(itm => this._errorMessages[itm]);\n }\n}"]}
1
+ {"version":3,"file":"withErrorMessage.pipe.js","sourceRoot":"","sources":["../../../../../../../forms/src/modules/errorMessage/pipes/withErrorMessage/withErrorMessage.pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,IAAI,EAAgB,MAAM,eAAe,CAAC;AAG1D,OAAO,EAAC,yBAAyB,EAAC,MAAM,yBAAyB,CAAC;;AAElE;;GAEG;AAEH,MAAM,OAAO,oBAAoB;IAE7B,iEAAiE;IACjE,YAAyD,cAAgC;QAAhC,mBAAc,GAAd,cAAc,CAAkB;IAEzF,CAAC;IAED,sGAAsG;IAEtG;;;OAGG;IACI,SAAS,CAAC,KAAe;QAE5B,IAAG,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,CAAA,EACjB;YACI,OAAO,KAAK,CAAC;SAChB;QAED,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;IACzD,CAAC;;iHArBQ,oBAAoB,kBAGT,yBAAyB;+GAHpC,oBAAoB;2FAApB,oBAAoB;kBADhC,IAAI;mBAAC,EAAC,IAAI,EAAE,kBAAkB,EAAC;;0BAIf,MAAM;2BAAC,yBAAyB","sourcesContent":["import {Inject, Pipe, PipeTransform} from '@angular/core';\nimport {StringDictionary} from '@jscrpt/common';\n\nimport {VALIDATION_ERROR_MESSAGES} from '../../../../misc/tokens';\n\n/**\n * Filters array of errors with messages\n */\n@Pipe({name: 'withErrorMessage'})\nexport class WithErrorMessagePipe implements PipeTransform\n{\n //######################### constructor #########################\n constructor(@Inject(VALIDATION_ERROR_MESSAGES) protected _errorMessages: StringDictionary)\n {\n }\n\n //######################### public methods - implementation of PipeTransform #########################\n\n /**\n * Filters array of errors with messages\n * @param value - Array of error names\n */\n public transform(value: string[]): string[]\n {\n if(!value?.length)\n {\n return value;\n }\n\n return value.filter(itm => this._errorMessages[itm]);\n }\n}"]}
@@ -1,7 +1,7 @@
1
1
  import { Injectable, Inject, Optional } from '@angular/core';
2
2
  import { STRING_LOCALIZATION } from '@anglr/common';
3
3
  import { extend, isString } from '@jscrpt/common';
4
- import { VALIDATION_ERROR_MESSAGES } from '../../misc/types';
4
+ import { IGNORED_VALIDATION_ERRORS, VALIDATION_ERROR_MESSAGES } from '../../misc/tokens';
5
5
  import * as i0 from "@angular/core";
6
6
  /**
7
7
  * Default error messages displayed
@@ -15,14 +15,14 @@ const defaultErrorMessages = {
15
15
  minlength: 'Value is short.',
16
16
  maxlength: 'Value is too long.'
17
17
  };
18
- //TODO: support exceptions for error names, allow to have string value to be used as error from error
19
18
  /**
20
19
  * Service used for extracting error messages from form control
21
20
  */
22
21
  export class ErrorMessagesExtractor {
23
22
  //######################### constructor #########################
24
- constructor(_stringLocalization, globalErrorMessages) {
23
+ constructor(_stringLocalization, _ignoredValidationErrors, globalErrorMessages) {
25
24
  this._stringLocalization = _stringLocalization;
25
+ this._ignoredValidationErrors = _ignoredValidationErrors;
26
26
  this._errorMessages = extend(true, {}, defaultErrorMessages, globalErrorMessages);
27
27
  }
28
28
  //######################### public methods #########################
@@ -38,7 +38,7 @@ export class ErrorMessagesExtractor {
38
38
  return null;
39
39
  }
40
40
  const result = {
41
- errors: Object.keys(control.errors),
41
+ errors: Object.keys(control.errors).filter(itm => this._ignoredValidationErrors.indexOf(itm) >= 0),
42
42
  errorMessages: []
43
43
  };
44
44
  result.errors.forEach(error => {
@@ -47,6 +47,10 @@ export class ErrorMessagesExtractor {
47
47
  if (errorMessages[error]) {
48
48
  result.errorMessages.push(this._stringLocalization.get(errorMessages[error], control.errors));
49
49
  }
50
+ //display error data if it is string and there is missing translation
51
+ else if (isString(errorData)) {
52
+ result.errorMessages.push(errorData);
53
+ }
50
54
  //error data are array of strings, each string is considered error message
51
55
  else if (Array.isArray(errorData)) {
52
56
  errorData.forEach(errorItm => {
@@ -59,7 +63,7 @@ export class ErrorMessagesExtractor {
59
63
  return result;
60
64
  }
61
65
  }
62
- ErrorMessagesExtractor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: ErrorMessagesExtractor, deps: [{ token: STRING_LOCALIZATION }, { token: VALIDATION_ERROR_MESSAGES, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
66
+ ErrorMessagesExtractor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: ErrorMessagesExtractor, deps: [{ token: STRING_LOCALIZATION }, { token: IGNORED_VALIDATION_ERRORS }, { token: VALIDATION_ERROR_MESSAGES, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
63
67
  ErrorMessagesExtractor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: ErrorMessagesExtractor, providedIn: 'root' });
64
68
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: ErrorMessagesExtractor, decorators: [{
65
69
  type: Injectable,
@@ -67,6 +71,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
67
71
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
68
72
  type: Inject,
69
73
  args: [STRING_LOCALIZATION]
74
+ }] }, { type: undefined, decorators: [{
75
+ type: Inject,
76
+ args: [IGNORED_VALIDATION_ERRORS]
70
77
  }] }, { type: undefined, decorators: [{
71
78
  type: Inject,
72
79
  args: [VALIDATION_ERROR_MESSAGES]
@@ -1 +1 @@
1
- {"version":3,"file":"errorMessagesExtractor.service.js","sourceRoot":"","sources":["../../../../../forms/src/services/errorMessagesExtractor/errorMessagesExtractor.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,eAAe,CAAC;AAE3D,OAAO,EAAqB,mBAAmB,EAAC,MAAM,eAAe,CAAC;AACtE,OAAO,EAAmB,MAAM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AI,CAAC,mBAAmB,CAAC,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;aACjG;YACD,0EAA0E;iBACrE,IAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAChC;gBACI,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;oBAEzB,IAAG,QAAQ,CAAC,QAAQ,CAAC,EACrB;wBACI,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;qBACrF;gBACL,CAAC,CAAC,CAAC;aACN;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAClB,CAAC;;mHA9DQ,sBAAsB,kBAUX,mBAAmB,aACnB,yBAAyB;uHAXpC,sBAAsB,cADV,MAAM;2FAClB,sBAAsB;kBADlC,UAAU;mBAAC,EAAC,UAAU,EAAE,MAAM,EAAC;;0BAWf,MAAM;2BAAC,mBAAmB;;0BAC1B,MAAM;2BAAC,yBAAyB;;0BAAG,QAAQ","sourcesContent":["import {Injectable, Inject, Optional} from '@angular/core';\nimport {FormControl} from '@angular/forms';\nimport {StringLocalization, STRING_LOCALIZATION} from '@anglr/common';\nimport {StringDictionary, extend, isString} from '@jscrpt/common';\n\nimport {VALIDATION_ERROR_MESSAGES} from '../../misc/types';\nimport {ValidationErrorsResult} from './errorMessagesExtractor.interface';\n\n/**\n * Default error messages displayed\n */\nconst defaultErrorMessages: StringDictionary =\n{\n required: 'Field is required.',\n number: 'Value must be number.',\n pattern: 'Value is not valid.',\n minValue: 'Value is too small.',\n maxValue: 'Value is too big.',\n minlength: 'Value is short.',\n maxlength: 'Value is too long.'\n};\n\n//TODO: support exceptions for error names, allow to have string value to be used as error from error\n\n/**\n * Service used for extracting error messages from form control\n */\n@Injectable({providedIn: 'root'})\nexport class ErrorMessagesExtractor\n{\n //######################### protected fields #########################\n\n /**\n * Dictionary with error names that have defined message\n */\n protected _errorMessages: StringDictionary;\n\n //######################### constructor #########################\n constructor(@Inject(STRING_LOCALIZATION) protected _stringLocalization: StringLocalization,\n @Inject(VALIDATION_ERROR_MESSAGES) @Optional() globalErrorMessages?: StringDictionary)\n {\n this._errorMessages = extend(true, {}, defaultErrorMessages, globalErrorMessages);\n }\n\n //######################### public methods #########################\n\n /**\n * Gets validation errors result for provided control, or null of no errors are present\n * @param control - Form control instance that should be inspected for errors\n * @param messages - Object containing error messages that should patch existing error messages\n */\n public getErrors(control: FormControl, messages?: StringDictionary): ValidationErrorsResult\n {\n const errorMessages: StringDictionary = extend(true, {}, this._errorMessages, messages);\n\n //no control or no errors\n if(!control || !control.errors)\n {\n return null;\n }\n\n const result: ValidationErrorsResult =\n {\n errors: Object.keys(control.errors),\n errorMessages: []\n };\n\n result.errors.forEach(error =>\n {\n const errorData = control.errors[error];\n \n //error message is present for error\n if(errorMessages[error])\n {\n result.errorMessages.push(this._stringLocalization.get(errorMessages[error], control.errors));\n }\n //error data are array of strings, each string is considered error message\n else if(Array.isArray(errorData))\n {\n errorData.forEach(errorItm =>\n {\n if(isString(errorItm))\n {\n result.errorMessages.push(this._stringLocalization.get(errorItm, control.errors));\n }\n });\n }\n });\n\n return result;\n }\n}"]}
1
+ {"version":3,"file":"errorMessagesExtractor.service.js","sourceRoot":"","sources":["../../../../../forms/src/services/errorMessagesExtractor/errorMessagesExtractor.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,eAAe,CAAC;AAE3D,OAAO,EAAqB,mBAAmB,EAAC,MAAM,eAAe,CAAC;AACtE,OAAO,EAAmB,MAAM,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAElE,OAAO,EAAC,yBAAyB,EAAE,yBAAyB,EAAC,MAAM,mBAAmB,CAAC;;AAGvF;;GAEG;AACH,MAAM,oBAAoB,GAC1B;IAC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AAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;aACjG;YACD,qEAAqE;iBAChE,IAAG,QAAQ,CAAC,SAAS,CAAC,EAC3B;gBACI,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;aACxC;YACD,0EAA0E;iBACrE,IAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAChC;gBACI,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;oBAEzB,IAAG,QAAQ,CAAC,QAAQ,CAAC,EACrB;wBACI,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;qBACrF;gBACL,CAAC,CAAC,CAAC;aACN;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAClB,CAAC;;mHApEQ,sBAAsB,kBAUX,mBAAmB,aACnB,yBAAyB,aACzB,yBAAyB;uHAZpC,sBAAsB,cADV,MAAM;2FAClB,sBAAsB;kBADlC,UAAU;mBAAC,EAAC,UAAU,EAAE,MAAM,EAAC;;0BAWf,MAAM;2BAAC,mBAAmB;;0BAC1B,MAAM;2BAAC,yBAAyB;;0BAChC,MAAM;2BAAC,yBAAyB;;0BAAG,QAAQ","sourcesContent":["import {Injectable, Inject, Optional} from '@angular/core';\nimport {FormControl} from '@angular/forms';\nimport {StringLocalization, STRING_LOCALIZATION} from '@anglr/common';\nimport {StringDictionary, extend, isString} from '@jscrpt/common';\n\nimport {IGNORED_VALIDATION_ERRORS, VALIDATION_ERROR_MESSAGES} from '../../misc/tokens';\nimport {ValidationErrorsResult} from './errorMessagesExtractor.interface';\n\n/**\n * Default error messages displayed\n */\nconst defaultErrorMessages: StringDictionary =\n{\n required: 'Field is required.',\n number: 'Value must be number.',\n pattern: 'Value is not valid.',\n minValue: 'Value is too small.',\n maxValue: 'Value is too big.',\n minlength: 'Value is short.',\n maxlength: 'Value is too long.'\n};\n\n/**\n * Service used for extracting error messages from form control\n */\n@Injectable({providedIn: 'root'})\nexport class ErrorMessagesExtractor\n{\n //######################### protected fields #########################\n\n /**\n * Dictionary with error names that have defined message\n */\n protected _errorMessages: StringDictionary;\n\n //######################### constructor #########################\n constructor(@Inject(STRING_LOCALIZATION) protected _stringLocalization: StringLocalization,\n @Inject(IGNORED_VALIDATION_ERRORS) protected _ignoredValidationErrors: string[],\n @Inject(VALIDATION_ERROR_MESSAGES) @Optional() globalErrorMessages?: StringDictionary)\n {\n this._errorMessages = extend(true, {}, defaultErrorMessages, globalErrorMessages);\n }\n\n //######################### public methods #########################\n\n /**\n * Gets validation errors result for provided control, or null of no errors are present\n * @param control - Form control instance that should be inspected for errors\n * @param messages - Object containing error messages that should patch existing error messages\n */\n public getErrors(control: FormControl, messages?: StringDictionary): ValidationErrorsResult\n {\n const errorMessages: StringDictionary = extend(true, {}, this._errorMessages, messages);\n\n //no control or no errors\n if(!control || !control.errors)\n {\n return null;\n }\n\n const result: ValidationErrorsResult =\n {\n errors: Object.keys(control.errors).filter(itm => this._ignoredValidationErrors.indexOf(itm) >= 0),\n errorMessages: []\n };\n\n result.errors.forEach(error =>\n {\n const errorData = control.errors[error];\n \n //error message is present for error\n if(errorMessages[error])\n {\n result.errorMessages.push(this._stringLocalization.get(errorMessages[error], control.errors));\n }\n //display error data if it is string and there is missing translation\n else if(isString(errorData))\n {\n result.errorMessages.push(errorData);\n }\n //error data are array of strings, each string is considered error message\n else if(Array.isArray(errorData))\n {\n errorData.forEach(errorItm =>\n {\n if(isString(errorItm))\n {\n result.errorMessages.push(this._stringLocalization.get(errorItm, control.errors));\n }\n });\n }\n });\n\n return result;\n }\n}"]}
@@ -12,7 +12,7 @@ export * from './services/validationErrorRenderer/validationErrorRenderer.interf
12
12
  export * from './services/validationErrorRenderer/validationErrorRenderer.service';
13
13
  export * from './misc/validators';
14
14
  export * from './misc/utils';
15
- export * from './misc/types';
15
+ export * from './misc/tokens';
16
16
  export * from './modules/numberInput.module';
17
17
  export * from './modules/hasError.module';
18
18
  export * from './modules/requiredClass.module';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../forms/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4DAA4D,CAAC;AAC3E,cAAc,4DAA4D,CAAC;AAC3E,cAAc,yDAAyD,CAAC;AACxE,cAAc,oEAAoE,CAAC;AACnF,cAAc,0CAA0C,CAAC;AACzD,cAAc,oDAAoD,CAAC;AACnE,cAAc,oDAAoD,CAAC;AACnE,cAAc,wCAAwC,CAAC;AACvD,cAAc,oEAAoE,CAAC;AACnF,cAAc,kEAAkE,CAAC;AACjF,cAAc,sEAAsE,CAAC;AACrF,cAAc,oEAAoE,CAAC;AACnF,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC","sourcesContent":["export * from './directives/numberInput/maxValueNumberValidator.directive';\nexport * from './directives/numberInput/minValueNumberValidator.directive';\nexport * from './directives/numberInput/numberInputValidator.directive';\nexport * from './directives/numberInput/numberInputControlValueAccessor.directive';\nexport * from './directives/hasError/hasError.directive';\nexport * from './directives/groupHasError/groupHasError.directive';\nexport * from './directives/requiredClass/requiredClass.directive';\nexport * from './services/submitted/submitted.service';\nexport * from './services/errorMessagesExtractor/errorMessagesExtractor.interface';\nexport * from './services/errorMessagesExtractor/errorMessagesExtractor.service';\nexport * from './services/validationErrorRenderer/validationErrorRenderer.interface';\nexport * from './services/validationErrorRenderer/validationErrorRenderer.service';\nexport * from './misc/validators';\nexport * from './misc/utils';\nexport * from './misc/types';\nexport * from './modules/numberInput.module';\nexport * from './modules/hasError.module';\nexport * from './modules/requiredClass.module';\nexport * from './modules/formPipes';\nexport * from './modules/errorMessage';\nexport * from './misc/formModel';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../forms/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4DAA4D,CAAC;AAC3E,cAAc,4DAA4D,CAAC;AAC3E,cAAc,yDAAyD,CAAC;AACxE,cAAc,oEAAoE,CAAC;AACnF,cAAc,0CAA0C,CAAC;AACzD,cAAc,oDAAoD,CAAC;AACnE,cAAc,oDAAoD,CAAC;AACnE,cAAc,wCAAwC,CAAC;AACvD,cAAc,oEAAoE,CAAC;AACnF,cAAc,kEAAkE,CAAC;AACjF,cAAc,sEAAsE,CAAC;AACrF,cAAc,oEAAoE,CAAC;AACnF,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC","sourcesContent":["export * from './directives/numberInput/maxValueNumberValidator.directive';\nexport * from './directives/numberInput/minValueNumberValidator.directive';\nexport * from './directives/numberInput/numberInputValidator.directive';\nexport * from './directives/numberInput/numberInputControlValueAccessor.directive';\nexport * from './directives/hasError/hasError.directive';\nexport * from './directives/groupHasError/groupHasError.directive';\nexport * from './directives/requiredClass/requiredClass.directive';\nexport * from './services/submitted/submitted.service';\nexport * from './services/errorMessagesExtractor/errorMessagesExtractor.interface';\nexport * from './services/errorMessagesExtractor/errorMessagesExtractor.service';\nexport * from './services/validationErrorRenderer/validationErrorRenderer.interface';\nexport * from './services/validationErrorRenderer/validationErrorRenderer.service';\nexport * from './misc/validators';\nexport * from './misc/utils';\nexport * from './misc/tokens';\nexport * from './modules/numberInput.module';\nexport * from './modules/hasError.module';\nexport * from './modules/requiredClass.module';\nexport * from './modules/formPipes';\nexport * from './modules/errorMessage';\nexport * from './misc/formModel';\n"]}
@@ -0,0 +1,10 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ /**
3
+ * Injection token containing validation error messages
4
+ */
5
+ export const VALIDATION_ERROR_MESSAGES = new InjectionToken('VALIDATION_ERROR_MESSAGES');
6
+ /**
7
+ * Injection token for injecting array of ignored error names when automatically processed
8
+ */
9
+ export const IGNORED_VALIDATION_ERRORS = new InjectionToken('IGNORED_VALIDATION_ERRORS', { providedIn: 'root', factory: () => ['actual'] });
10
+ //# sourceMappingURL=tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../../forms/src/misc/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAG7C;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAqC,IAAI,cAAc,CAAmB,2BAA2B,CAAC,CAAC;AAE7I;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAA6B,IAAI,cAAc,CAAW,2BAA2B,EAAE,EAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAC,CAAC,CAAC","sourcesContent":["import {InjectionToken} from '@angular/core';\nimport {StringDictionary} from '@jscrpt/common';\n\n/**\n * Injection token containing validation error messages\n */\nexport const VALIDATION_ERROR_MESSAGES: InjectionToken<StringDictionary> = new InjectionToken<StringDictionary>('VALIDATION_ERROR_MESSAGES');\n\n/**\n * Injection token for injecting array of ignored error names when automatically processed\n */\nexport const IGNORED_VALIDATION_ERRORS: InjectionToken<string[]> = new InjectionToken<string[]>('IGNORED_VALIDATION_ERRORS', {providedIn: 'root', factory: () => ['actual']});\n"]}
@@ -2,7 +2,7 @@ import { Directive, ElementRef, Inject, Input } from '@angular/core';
2
2
  import { STRING_LOCALIZATION } from '@anglr/common';
3
3
  import { isBlank, nameof } from '@jscrpt/common';
4
4
  import { Subscription } from 'rxjs';
5
- import { VALIDATION_ERROR_MESSAGES } from '../../../../misc/types';
5
+ import { VALIDATION_ERROR_MESSAGES } from '../../../../misc/tokens';
6
6
  import * as i0 from "@angular/core";
7
7
  /**
8
8
  * Directive used for displaying form error message
@@ -1 +1 @@
1
- {"version":3,"file":"errorMessage.directive.js","sourceRoot":"","sources":["../../../../../../../forms/src/modules/errorMessage/directives/errorMessage/errorMessage.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAsC,MAAM,eAAe,CAAC;AACxG,OAAO,EAAqB,mBAAmB,EAAC,MAAM,eAAe,CAAC;AACtE,OAAO,EAAa,OAAO,EAAE,MAAM,EAAmB,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAElC,OAAO,EAAC,yBAAyB,EAAC,MAAM,wBAAwB,CAAC;;AAEjE;;GAEG;AAMH,MAAM,OAAO,qBAAqB;IAuB9B,iEAAiE;IACjE,YAAsB,QAAiC,EACJ,aAAiC,EAC3B,cAAgC;QAFnE,aAAQ,GAAR,QAAQ,CAAyB;QACJ,kBAAa,GAAb,aAAa,CAAoB;QAC3B,mBAAc,GAAd,cAAc,CAAkB;QAxBzF,0EAA0E;QAE1E;;WAEG;QACO,uBAAkB,GAAiB,IAAI,YAAY,EAAE,CAAC;QAqB5D,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;IACrG,CAAC;IAED,kGAAkG;IAElG;;OAEG;IACI,WAAW,CAAC,OAAsB;QAErC,IAAG,MAAM,CAAwB,WAAW,CAAC,IAAI,OAAO,EACxD;YACI,IAAI,CAAC,YAAY,EAAE,CAAC;SACvB;IACL,CAAC;IAED,kGAAkG;IAElG;;OAEG;IACI,WAAW;QAEd,IAAI,CAAC,kBAAkB,EAAE,WAAW,EAAE,CAAC;QACvC,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;IACnC,CAAC;IAED,uEAAuE;IAEvE;;OAEG;IACO,YAAY;QAElB,IAAG,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,EAC1B;YACI,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,SAAS,GAAG,EAAE,CAAC;YAE3C,OAAO;SACV;QAED,MAAM,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzD,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAElE,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,SAAS,GAAG,OAAO,CAAC;IACpD,CAAC;;kHAzEQ,qBAAqB,4CAyBV,mBAAmB,aACnB,yBAAyB;sGA1BpC,qBAAqB;2FAArB,qBAAqB;kBALjC,SAAS;mBACV;oBACI,QAAQ,EAAE,gBAAgB;oBAC1B,QAAQ,EAAE,cAAc;iBAC3B;;0BA0BgB,MAAM;2BAAC,mBAAmB;;0BAC1B,MAAM;2BAAC,yBAAyB;4CAXtC,SAAS;sBADf,KAAK;uBAAC,cAAc;gBAOd,MAAM;sBADZ,KAAK","sourcesContent":["import {Directive, ElementRef, Inject, Input, OnChanges, OnDestroy, SimpleChanges} from '@angular/core';\nimport {StringLocalization, STRING_LOCALIZATION} from '@anglr/common';\nimport {Dictionary, isBlank, nameof, StringDictionary} from '@jscrpt/common';\nimport {Subscription} from 'rxjs';\n\nimport {VALIDATION_ERROR_MESSAGES} from '../../../../misc/types';\n\n/**\n * Directive used for displaying form error message\n */\n@Directive(\n{\n selector: '[errorMessage]',\n exportAs: 'errorMessage'\n})\nexport class ErrorMessageDirective implements OnChanges, OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Subscriptions created during initialization\n */\n protected _initSubscriptions: Subscription = new Subscription();\n\n //######################### public properties - inputs #########################\n\n /**\n * Name/code of error message to be displayed\n */\n @Input('errorMessage')\n public errorName: string;\n\n /**\n * Object storing all errors\n */\n @Input()\n public errors: Dictionary;\n\n //######################### constructor #########################\n constructor(protected _element: ElementRef<HTMLElement>,\n @Inject(STRING_LOCALIZATION) protected _localization: StringLocalization,\n @Inject(VALIDATION_ERROR_MESSAGES) protected _errorMessages: StringDictionary,)\n {\n this._initSubscriptions.add(this._localization.textsChange.subscribe(() => this._showMessage()));\n }\n\n //######################### public methods - implementation of OnChanges #########################\n \n /**\n * Called when input value changes\n */\n public ngOnChanges(changes: SimpleChanges): void\n {\n if(nameof<ErrorMessageDirective>('errorName') in changes)\n {\n this._showMessage();\n }\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n \n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n this._initSubscriptions?.unsubscribe();\n this._initSubscriptions = null;\n }\n\n //######################### protected methods #########################\n\n /**\n * Shows message inside of element\n */\n protected _showMessage(): void\n {\n if(isBlank(this.errorName))\n {\n this._element.nativeElement.innerHTML = '';\n\n return;\n }\n\n const errorMessage = this._errorMessages[this.errorName];\n const message = this._localization.get(errorMessage, this.errors);\n\n this._element.nativeElement.innerHTML = message;\n }\n}"]}
1
+ {"version":3,"file":"errorMessage.directive.js","sourceRoot":"","sources":["../../../../../../../forms/src/modules/errorMessage/directives/errorMessage/errorMessage.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAsC,MAAM,eAAe,CAAC;AACxG,OAAO,EAAqB,mBAAmB,EAAC,MAAM,eAAe,CAAC;AACtE,OAAO,EAAa,OAAO,EAAE,MAAM,EAAmB,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAElC,OAA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;kHAzEQ,qBAAqB,4CAyBV,mBAAmB,aACnB,yBAAyB;sGA1BpC,qBAAqB;2FAArB,qBAAqB;kBALjC,SAAS;mBACV;oBACI,QAAQ,EAAE,gBAAgB;oBAC1B,QAAQ,EAAE,cAAc;iBAC3B;;0BA0BgB,MAAM;2BAAC,mBAAmB;;0BAC1B,MAAM;2BAAC,yBAAyB;4CAXtC,SAAS;sBADf,KAAK;uBAAC,cAAc;gBAOd,MAAM;sBADZ,KAAK","sourcesContent":["import {Directive, ElementRef, Inject, Input, OnChanges, OnDestroy, SimpleChanges} from '@angular/core';\nimport {StringLocalization, STRING_LOCALIZATION} from '@anglr/common';\nimport {Dictionary, isBlank, nameof, StringDictionary} from '@jscrpt/common';\nimport {Subscription} from 'rxjs';\n\nimport {VALIDATION_ERROR_MESSAGES} from '../../../../misc/tokens';\n\n/**\n * Directive used for displaying form error message\n */\n@Directive(\n{\n selector: '[errorMessage]',\n exportAs: 'errorMessage'\n})\nexport class ErrorMessageDirective implements OnChanges, OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Subscriptions created during initialization\n */\n protected _initSubscriptions: Subscription = new Subscription();\n\n //######################### public properties - inputs #########################\n\n /**\n * Name/code of error message to be displayed\n */\n @Input('errorMessage')\n public errorName: string;\n\n /**\n * Object storing all errors\n */\n @Input()\n public errors: Dictionary;\n\n //######################### constructor #########################\n constructor(protected _element: ElementRef<HTMLElement>,\n @Inject(STRING_LOCALIZATION) protected _localization: StringLocalization,\n @Inject(VALIDATION_ERROR_MESSAGES) protected _errorMessages: StringDictionary,)\n {\n this._initSubscriptions.add(this._localization.textsChange.subscribe(() => this._showMessage()));\n }\n\n //######################### public methods - implementation of OnChanges #########################\n \n /**\n * Called when input value changes\n */\n public ngOnChanges(changes: SimpleChanges): void\n {\n if(nameof<ErrorMessageDirective>('errorName') in changes)\n {\n this._showMessage();\n }\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n \n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n this._initSubscriptions?.unsubscribe();\n this._initSubscriptions = null;\n }\n\n //######################### protected methods #########################\n\n /**\n * Shows message inside of element\n */\n protected _showMessage(): void\n {\n if(isBlank(this.errorName))\n {\n this._element.nativeElement.innerHTML = '';\n\n return;\n }\n\n const errorMessage = this._errorMessages[this.errorName];\n const message = this._localization.get(errorMessage, this.errors);\n\n this._element.nativeElement.innerHTML = message;\n }\n}"]}
@@ -1,5 +1,5 @@
1
1
  import { Inject, Pipe } from '@angular/core';
2
- import { VALIDATION_ERROR_MESSAGES } from '../../../../misc/types';
2
+ import { VALIDATION_ERROR_MESSAGES } from '../../../../misc/tokens';
3
3
  import * as i0 from "@angular/core";
4
4
  /**
5
5
  * Filters array of errors with messages
@@ -1 +1 @@
1
- {"version":3,"file":"withErrorMessage.pipe.js","sourceRoot":"","sources":["../../../../../../../forms/src/modules/errorMessage/pipes/withErrorMessage/withErrorMessage.pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,IAAI,EAAgB,MAAM,eAAe,CAAC;AAG1D,OAAO,EAAC,yBAAyB,EAAC,MAAM,wBAAwB,CAAC;;AAEjE;;GAEG;AAEH,MAAM,OAAO,oBAAoB;IAE7B,iEAAiE;IACjE,YAAyD,cAAgC;QAAhC,mBAAc,GAAd,cAAc,CAAkB;IAEzF,CAAC;IAED,sGAAsG;IAEtG;;;OAGG;IACI,SAAS,CAAC,KAAe;QAE5B,IAAG,CAAC,KAAK,EAAE,MAAM,EACjB;YACI,OAAO,KAAK,CAAC;SAChB;QAED,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;IACzD,CAAC;;iHArBQ,oBAAoB,kBAGT,yBAAyB;+GAHpC,oBAAoB;2FAApB,oBAAoB;kBADhC,IAAI;mBAAC,EAAC,IAAI,EAAE,kBAAkB,EAAC;;0BAIf,MAAM;2BAAC,yBAAyB","sourcesContent":["import {Inject, Pipe, PipeTransform} from '@angular/core';\nimport {StringDictionary} from '@jscrpt/common';\n\nimport {VALIDATION_ERROR_MESSAGES} from '../../../../misc/types';\n\n/**\n * Filters array of errors with messages\n */\n@Pipe({name: 'withErrorMessage'})\nexport class WithErrorMessagePipe implements PipeTransform\n{\n //######################### constructor #########################\n constructor(@Inject(VALIDATION_ERROR_MESSAGES) protected _errorMessages: StringDictionary)\n {\n }\n\n //######################### public methods - implementation of PipeTransform #########################\n\n /**\n * Filters array of errors with messages\n * @param value - Array of error names\n */\n public transform(value: string[]): string[]\n {\n if(!value?.length)\n {\n return value;\n }\n\n return value.filter(itm => this._errorMessages[itm]);\n }\n}"]}
1
+ {"version":3,"file":"withErrorMessage.pipe.js","sourceRoot":"","sources":["../../../../../../../forms/src/modules/errorMessage/pipes/withErrorMessage/withErrorMessage.pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,IAAI,EAAgB,MAAM,eAAe,CAAC;AAG1D,OAAO,EAAC,yBAAyB,EAAC,MAAM,yBAAyB,CAAC;;AAElE;;GAEG;AAEH,MAAM,OAAO,oBAAoB;IAE7B,iEAAiE;IACjE,YAAyD,cAAgC;QAAhC,mBAAc,GAAd,cAAc,CAAkB;IAEzF,CAAC;IAED,sGAAsG;IAEtG;;;OAGG;IACI,SAAS,CAAC,KAAe;QAE5B,IAAG,CAAC,KAAK,EAAE,MAAM,EACjB;YACI,OAAO,KAAK,CAAC;SAChB;QAED,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;IACzD,CAAC;;iHArBQ,oBAAoB,kBAGT,yBAAyB;+GAHpC,oBAAoB;2FAApB,oBAAoB;kBADhC,IAAI;mBAAC,EAAC,IAAI,EAAE,kBAAkB,EAAC;;0BAIf,MAAM;2BAAC,yBAAyB","sourcesContent":["import {Inject, Pipe, PipeTransform} from '@angular/core';\nimport {StringDictionary} from '@jscrpt/common';\n\nimport {VALIDATION_ERROR_MESSAGES} from '../../../../misc/tokens';\n\n/**\n * Filters array of errors with messages\n */\n@Pipe({name: 'withErrorMessage'})\nexport class WithErrorMessagePipe implements PipeTransform\n{\n //######################### constructor #########################\n constructor(@Inject(VALIDATION_ERROR_MESSAGES) protected _errorMessages: StringDictionary)\n {\n }\n\n //######################### public methods - implementation of PipeTransform #########################\n\n /**\n * Filters array of errors with messages\n * @param value - Array of error names\n */\n public transform(value: string[]): string[]\n {\n if(!value?.length)\n {\n return value;\n }\n\n return value.filter(itm => this._errorMessages[itm]);\n }\n}"]}
@@ -1,7 +1,7 @@
1
1
  import { Injectable, Inject, Optional } from '@angular/core';
2
2
  import { STRING_LOCALIZATION } from '@anglr/common';
3
3
  import { extend, isString } from '@jscrpt/common';
4
- import { VALIDATION_ERROR_MESSAGES } from '../../misc/types';
4
+ import { IGNORED_VALIDATION_ERRORS, VALIDATION_ERROR_MESSAGES } from '../../misc/tokens';
5
5
  import * as i0 from "@angular/core";
6
6
  /**
7
7
  * Default error messages displayed
@@ -15,14 +15,14 @@ const defaultErrorMessages = {
15
15
  minlength: 'Value is short.',
16
16
  maxlength: 'Value is too long.'
17
17
  };
18
- //TODO: support exceptions for error names, allow to have string value to be used as error from error
19
18
  /**
20
19
  * Service used for extracting error messages from form control
21
20
  */
22
21
  export class ErrorMessagesExtractor {
23
22
  //######################### constructor #########################
24
- constructor(_stringLocalization, globalErrorMessages) {
23
+ constructor(_stringLocalization, _ignoredValidationErrors, globalErrorMessages) {
25
24
  this._stringLocalization = _stringLocalization;
25
+ this._ignoredValidationErrors = _ignoredValidationErrors;
26
26
  this._errorMessages = extend(true, {}, defaultErrorMessages, globalErrorMessages);
27
27
  }
28
28
  //######################### public methods #########################
@@ -38,7 +38,7 @@ export class ErrorMessagesExtractor {
38
38
  return null;
39
39
  }
40
40
  const result = {
41
- errors: Object.keys(control.errors),
41
+ errors: Object.keys(control.errors).filter(itm => this._ignoredValidationErrors.indexOf(itm) >= 0),
42
42
  errorMessages: []
43
43
  };
44
44
  result.errors.forEach(error => {
@@ -47,6 +47,10 @@ export class ErrorMessagesExtractor {
47
47
  if (errorMessages[error]) {
48
48
  result.errorMessages.push(this._stringLocalization.get(errorMessages[error], control.errors));
49
49
  }
50
+ //display error data if it is string and there is missing translation
51
+ else if (isString(errorData)) {
52
+ result.errorMessages.push(errorData);
53
+ }
50
54
  //error data are array of strings, each string is considered error message
51
55
  else if (Array.isArray(errorData)) {
52
56
  errorData.forEach(errorItm => {
@@ -59,7 +63,7 @@ export class ErrorMessagesExtractor {
59
63
  return result;
60
64
  }
61
65
  }
62
- ErrorMessagesExtractor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: ErrorMessagesExtractor, deps: [{ token: STRING_LOCALIZATION }, { token: VALIDATION_ERROR_MESSAGES, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
66
+ ErrorMessagesExtractor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: ErrorMessagesExtractor, deps: [{ token: STRING_LOCALIZATION }, { token: IGNORED_VALIDATION_ERRORS }, { token: VALIDATION_ERROR_MESSAGES, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
63
67
  ErrorMessagesExtractor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: ErrorMessagesExtractor, providedIn: 'root' });
64
68
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: ErrorMessagesExtractor, decorators: [{
65
69
  type: Injectable,
@@ -67,6 +71,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
67
71
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
68
72
  type: Inject,
69
73
  args: [STRING_LOCALIZATION]
74
+ }] }, { type: undefined, decorators: [{
75
+ type: Inject,
76
+ args: [IGNORED_VALIDATION_ERRORS]
70
77
  }] }, { type: undefined, decorators: [{
71
78
  type: Inject,
72
79
  args: [VALIDATION_ERROR_MESSAGES]
@@ -1 +1 @@
1
- {"version":3,"file":"errorMessagesExtractor.service.js","sourceRoot":"","sources":["../../../../../forms/src/services/errorMessagesExtractor/errorMessagesExtractor.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,eAAe,CAAC;AAE3D,OAAO,EAAqB,mBAAmB,EAAC,MAAM,eAAe,CAAC;AACtE,OAAO,EAAmB,MAAM,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAElE,OAAO,EAAC,yBAAyB,EAAC,MAAM,kBAAkB,CAAC;;AAG3D;;GAEG;AACH,MAAM,oBAAoB,GAC1B;IACI,QAAQ,EAAE,oBAAoB;IAC9B,MAAM,EAAE,uBAAuB;IAC/B,OAAO,EAAE,qBAAqB;IAC9B,QAAQ,EAAE,qBAAqB;IAC/B,QAAQ,EAAE,mBAAmB;IAC7B,SAAS,EAAE,iBAAiB;IAC5B,SAAS,EAAE,oBAAoB;CAClC,CAAC;AAEF,qGAAqG;AAErG;;GAEG;AAEH,MAAM,OAAO,sBAAsB;IAS/B,iEAAiE;IACjE,YAAmD,mBAAuC,EAC/B,mBAAsC;QAD9C,wBAAmB,GAAnB,mBAAmB,CAAoB;QAGtF,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,IAAI,EAAE,EAAE,EAAE,oBAAoB,EAAE,mBAAmB,CAAC,CAAC;IACtF,CAAC;IAED,oEAAoE;IAEpE;;;;OAIG;IACI,SAAS,CAAC,OAAoB,EAAE,QAA2B;QAE9D,MAAM,aAAa,GAAqB,MAAM,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;QAExF,yBAAyB;QACzB,IAAG,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAC9B;YACI,OAAO,IAAI,CAAC;SACf;QAED,MAAM,MAAM,GACZ;YACI,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;YACnC,aAAa,EAAE,EAAE;SACpB,CAAC;QAEF,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YAE1B,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAExC,oCAAoC;YACpC,IAAG,aAAa,CAAC,KAAK,CAAC,EACvB;gBACI,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;aACjG;YACD,0EAA0E;iBACrE,IAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAChC;gBACI,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;oBAEzB,IAAG,QAAQ,CAAC,QAAQ,CAAC,EACrB;wBACI,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;qBACrF;gBACL,CAAC,CAAC,CAAC;aACN;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAClB,CAAC;;mHA9DQ,sBAAsB,kBAUX,mBAAmB,aACnB,yBAAyB;uHAXpC,sBAAsB,cADV,MAAM;2FAClB,sBAAsB;kBADlC,UAAU;mBAAC,EAAC,UAAU,EAAE,MAAM,EAAC;;0BAWf,MAAM;2BAAC,mBAAmB;;0BAC1B,MAAM;2BAAC,yBAAyB;;0BAAG,QAAQ","sourcesContent":["import {Injectable, Inject, Optional} from '@angular/core';\nimport {FormControl} from '@angular/forms';\nimport {StringLocalization, STRING_LOCALIZATION} from '@anglr/common';\nimport {StringDictionary, extend, isString} from '@jscrpt/common';\n\nimport {VALIDATION_ERROR_MESSAGES} from '../../misc/types';\nimport {ValidationErrorsResult} from './errorMessagesExtractor.interface';\n\n/**\n * Default error messages displayed\n */\nconst defaultErrorMessages: StringDictionary =\n{\n required: 'Field is required.',\n number: 'Value must be number.',\n pattern: 'Value is not valid.',\n minValue: 'Value is too small.',\n maxValue: 'Value is too big.',\n minlength: 'Value is short.',\n maxlength: 'Value is too long.'\n};\n\n//TODO: support exceptions for error names, allow to have string value to be used as error from error\n\n/**\n * Service used for extracting error messages from form control\n */\n@Injectable({providedIn: 'root'})\nexport class ErrorMessagesExtractor\n{\n //######################### protected fields #########################\n\n /**\n * Dictionary with error names that have defined message\n */\n protected _errorMessages: StringDictionary;\n\n //######################### constructor #########################\n constructor(@Inject(STRING_LOCALIZATION) protected _stringLocalization: StringLocalization,\n @Inject(VALIDATION_ERROR_MESSAGES) @Optional() globalErrorMessages?: StringDictionary)\n {\n this._errorMessages = extend(true, {}, defaultErrorMessages, globalErrorMessages);\n }\n\n //######################### public methods #########################\n\n /**\n * Gets validation errors result for provided control, or null of no errors are present\n * @param control - Form control instance that should be inspected for errors\n * @param messages - Object containing error messages that should patch existing error messages\n */\n public getErrors(control: FormControl, messages?: StringDictionary): ValidationErrorsResult\n {\n const errorMessages: StringDictionary = extend(true, {}, this._errorMessages, messages);\n\n //no control or no errors\n if(!control || !control.errors)\n {\n return null;\n }\n\n const result: ValidationErrorsResult =\n {\n errors: Object.keys(control.errors),\n errorMessages: []\n };\n\n result.errors.forEach(error =>\n {\n const errorData = control.errors[error];\n \n //error message is present for error\n if(errorMessages[error])\n {\n result.errorMessages.push(this._stringLocalization.get(errorMessages[error], control.errors));\n }\n //error data are array of strings, each string is considered error message\n else if(Array.isArray(errorData))\n {\n errorData.forEach(errorItm =>\n {\n if(isString(errorItm))\n {\n result.errorMessages.push(this._stringLocalization.get(errorItm, control.errors));\n }\n });\n }\n });\n\n return result;\n }\n}"]}
1
+ {"version":3,"file":"errorMessagesExtractor.service.js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BAChC,MAAM;2BAAC,yBAAyB;;0BAAG,QAAQ","sourcesContent":["import {Injectable, Inject, Optional} from '@angular/core';\nimport {FormControl} from '@angular/forms';\nimport {StringLocalization, STRING_LOCALIZATION} from '@anglr/common';\nimport {StringDictionary, extend, isString} from '@jscrpt/common';\n\nimport {IGNORED_VALIDATION_ERRORS, VALIDATION_ERROR_MESSAGES} from '../../misc/tokens';\nimport {ValidationErrorsResult} from './errorMessagesExtractor.interface';\n\n/**\n * Default error messages displayed\n */\nconst defaultErrorMessages: StringDictionary =\n{\n required: 'Field is required.',\n number: 'Value must be number.',\n pattern: 'Value is not valid.',\n minValue: 'Value is too small.',\n maxValue: 'Value is too big.',\n minlength: 'Value is short.',\n maxlength: 'Value is too long.'\n};\n\n/**\n * Service used for extracting error messages from form control\n */\n@Injectable({providedIn: 'root'})\nexport class ErrorMessagesExtractor\n{\n //######################### protected fields #########################\n\n /**\n * Dictionary with error names that have defined message\n */\n protected _errorMessages: StringDictionary;\n\n //######################### constructor #########################\n constructor(@Inject(STRING_LOCALIZATION) protected _stringLocalization: StringLocalization,\n @Inject(IGNORED_VALIDATION_ERRORS) protected _ignoredValidationErrors: string[],\n @Inject(VALIDATION_ERROR_MESSAGES) @Optional() globalErrorMessages?: StringDictionary)\n {\n this._errorMessages = extend(true, {}, defaultErrorMessages, globalErrorMessages);\n }\n\n //######################### public methods #########################\n\n /**\n * Gets validation errors result for provided control, or null of no errors are present\n * @param control - Form control instance that should be inspected for errors\n * @param messages - Object containing error messages that should patch existing error messages\n */\n public getErrors(control: FormControl, messages?: StringDictionary): ValidationErrorsResult\n {\n const errorMessages: StringDictionary = extend(true, {}, this._errorMessages, messages);\n\n //no control or no errors\n if(!control || !control.errors)\n {\n return null;\n }\n\n const result: ValidationErrorsResult =\n {\n errors: Object.keys(control.errors).filter(itm => this._ignoredValidationErrors.indexOf(itm) >= 0),\n errorMessages: []\n };\n\n result.errors.forEach(error =>\n {\n const errorData = control.errors[error];\n \n //error message is present for error\n if(errorMessages[error])\n {\n result.errorMessages.push(this._stringLocalization.get(errorMessages[error], control.errors));\n }\n //display error data if it is string and there is missing translation\n else if(isString(errorData))\n {\n result.errorMessages.push(errorData);\n }\n //error data are array of strings, each string is considered error message\n else if(Array.isArray(errorData))\n {\n errorData.forEach(errorItm =>\n {\n if(isString(errorItm))\n {\n result.errorMessages.push(this._stringLocalization.get(errorItm, control.errors));\n }\n });\n }\n });\n\n return result;\n }\n}"]}
@@ -12,7 +12,7 @@ export * from './services/validationErrorRenderer/validationErrorRenderer.interf
12
12
  export * from './services/validationErrorRenderer/validationErrorRenderer.service';
13
13
  export * from './misc/validators';
14
14
  export * from './misc/utils';
15
- export * from './misc/types';
15
+ export * from './misc/tokens';
16
16
  export * from './modules/numberInput.module';
17
17
  export * from './modules/hasError.module';
18
18
  export * from './modules/requiredClass.module';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,4DAA4D,CAAC;AAC3E,cAAc,4DAA4D,CAAC;AAC3E,cAAc,yDAAyD,CAAC;AACxE,cAAc,oEAAoE,CAAC;AACnF,cAAc,0CAA0C,CAAC;AACzD,cAAc,oDAAoD,CAAC;AACnE,cAAc,oDAAoD,CAAC;AACnE,cAAc,wCAAwC,CAAC;AACvD,cAAc,oEAAoE,CAAC;AACnF,cAAc,kEAAkE,CAAC;AACjF,cAAc,sEAAsE,CAAC;AACrF,cAAc,oEAAoE,CAAC;AACnF,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,4DAA4D,CAAC;AAC3E,cAAc,4DAA4D,CAAC;AAC3E,cAAc,yDAAyD,CAAC;AACxE,cAAc,oEAAoE,CAAC;AACnF,cAAc,0CAA0C,CAAC;AACzD,cAAc,oDAAoD,CAAC;AACnE,cAAc,oDAAoD,CAAC;AACnE,cAAc,wCAAwC,CAAC;AACvD,cAAc,oEAAoE,CAAC;AACnF,cAAc,kEAAkE,CAAC;AACjF,cAAc,sEAAsE,CAAC;AACrF,cAAc,oEAAoE,CAAC;AACnF,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC"}
@@ -4,4 +4,8 @@ import { StringDictionary } from '@jscrpt/common';
4
4
  * Injection token containing validation error messages
5
5
  */
6
6
  export declare const VALIDATION_ERROR_MESSAGES: InjectionToken<StringDictionary>;
7
- //# sourceMappingURL=types.d.ts.map
7
+ /**
8
+ * Injection token for injecting array of ignored error names when automatically processed
9
+ */
10
+ export declare const IGNORED_VALIDATION_ERRORS: InjectionToken<string[]>;
11
+ //# sourceMappingURL=tokens.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAC,gBAAgB,EAAC,MAAM,gBAAgB,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,cAAc,CAAC,gBAAgB,CAAqE,CAAC;AAE7I;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,cAAc,CAAC,MAAM,EAAE,CAA8G,CAAC"}
@@ -8,18 +8,19 @@ import * as i0 from "@angular/core";
8
8
  */
9
9
  export declare class ErrorMessagesExtractor {
10
10
  protected _stringLocalization: StringLocalization;
11
+ protected _ignoredValidationErrors: string[];
11
12
  /**
12
13
  * Dictionary with error names that have defined message
13
14
  */
14
15
  protected _errorMessages: StringDictionary;
15
- constructor(_stringLocalization: StringLocalization, globalErrorMessages?: StringDictionary);
16
+ constructor(_stringLocalization: StringLocalization, _ignoredValidationErrors: string[], globalErrorMessages?: StringDictionary);
16
17
  /**
17
18
  * Gets validation errors result for provided control, or null of no errors are present
18
19
  * @param control - Form control instance that should be inspected for errors
19
20
  * @param messages - Object containing error messages that should patch existing error messages
20
21
  */
21
22
  getErrors(control: FormControl, messages?: StringDictionary): ValidationErrorsResult;
22
- static ɵfac: i0.ɵɵFactoryDeclaration<ErrorMessagesExtractor, [null, { optional: true; }]>;
23
+ static ɵfac: i0.ɵɵFactoryDeclaration<ErrorMessagesExtractor, [null, null, { optional: true; }]>;
23
24
  static ɵprov: i0.ɵɵInjectableDeclaration<ErrorMessagesExtractor>;
24
25
  }
25
26
  //# sourceMappingURL=errorMessagesExtractor.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errorMessagesExtractor.service.d.ts","sourceRoot":"","sources":["errorMessagesExtractor.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAC,kBAAkB,EAAsB,MAAM,eAAe,CAAC;AACtE,OAAO,EAAC,gBAAgB,EAAmB,MAAM,gBAAgB,CAAC;AAGlE,OAAO,EAAC,sBAAsB,EAAC,MAAM,oCAAoC,CAAC;;AAkB1E;;GAEG;AACH,qBACa,sBAAsB;IAUU,SAAS,CAAC,mBAAmB,EAAE,kBAAkB;IAN1F;;OAEG;IACH,SAAS,CAAC,cAAc,EAAE,gBAAgB,CAAC;gBAGQ,mBAAmB,EAAE,kBAAkB,EAC/B,mBAAmB,CAAC,EAAE,gBAAgB;IAOjG;;;;OAIG;IACI,SAAS,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,CAAC,EAAE,gBAAgB,GAAG,sBAAsB;yCAvBlF,sBAAsB;6CAAtB,sBAAsB;CA+DlC"}
1
+ {"version":3,"file":"errorMessagesExtractor.service.d.ts","sourceRoot":"","sources":["errorMessagesExtractor.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAC,kBAAkB,EAAsB,MAAM,eAAe,CAAC;AACtE,OAAO,EAAC,gBAAgB,EAAmB,MAAM,gBAAgB,CAAC;AAGlE,OAAO,EAAC,sBAAsB,EAAC,MAAM,oCAAoC,CAAC;;AAgB1E;;GAEG;AACH,qBACa,sBAAsB;IAUU,SAAS,CAAC,mBAAmB,EAAE,kBAAkB;IAC3C,SAAS,CAAC,wBAAwB,EAAE,MAAM,EAAE;IAP3F;;OAEG;IACH,SAAS,CAAC,cAAc,EAAE,gBAAgB,CAAC;gBAGQ,mBAAmB,EAAE,kBAAkB,EACjC,wBAAwB,EAAE,MAAM,EAAE,EAChC,mBAAmB,CAAC,EAAE,gBAAgB;IAOjG;;;;OAIG;IACI,SAAS,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,CAAC,EAAE,gBAAgB,GAAG,sBAAsB;yCAxBlF,sBAAsB;6CAAtB,sBAAsB;CAqElC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anglr/common",
3
- "version": "12.0.0-beta.20220413111906",
3
+ "version": "12.0.0-beta.20220413122054",
4
4
  "description": "Angular module for common angular stuff",
5
5
  "type": "module",
6
6
  "sideEffects": false,
package/version.bak CHANGED
@@ -1 +1 @@
1
- 12.0.0-beta.20220413111906
1
+ 12.0.0-beta.20220413122054
@@ -1,6 +0,0 @@
1
- import { InjectionToken } from '@angular/core';
2
- /**
3
- * Injection token containing validation error messages
4
- */
5
- export const VALIDATION_ERROR_MESSAGES = new InjectionToken('VALIDATION_ERROR_MESSAGES');
6
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../forms/src/misc/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAG7C;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAqC,IAAI,cAAc,CAAmB,2BAA2B,CAAC,CAAC","sourcesContent":["import {InjectionToken} from '@angular/core';\nimport {StringDictionary} from '@jscrpt/common';\n\n/**\n * Injection token containing validation error messages\n */\nexport const VALIDATION_ERROR_MESSAGES: InjectionToken<StringDictionary> = new InjectionToken<StringDictionary>('VALIDATION_ERROR_MESSAGES');"]}
@@ -1,6 +0,0 @@
1
- import { InjectionToken } from '@angular/core';
2
- /**
3
- * Injection token containing validation error messages
4
- */
5
- export const VALIDATION_ERROR_MESSAGES = new InjectionToken('VALIDATION_ERROR_MESSAGES');
6
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../forms/src/misc/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAG7C;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAqC,IAAI,cAAc,CAAmB,2BAA2B,CAAC,CAAC","sourcesContent":["import {InjectionToken} from '@angular/core';\nimport {StringDictionary} from '@jscrpt/common';\n\n/**\n * Injection token containing validation error messages\n */\nexport const VALIDATION_ERROR_MESSAGES: InjectionToken<StringDictionary> = new InjectionToken<StringDictionary>('VALIDATION_ERROR_MESSAGES');"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAC,gBAAgB,EAAC,MAAM,gBAAgB,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,cAAc,CAAC,gBAAgB,CAAqE,CAAC"}