@anglr/common 12.0.0-beta.20220413104159 → 12.0.0-beta.20220414093434

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 (94) hide show
  1. package/changelog.md +50 -2
  2. package/es2015/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.js +53 -0
  3. package/es2015/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.js.map +1 -0
  4. package/es2015/forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.js +75 -0
  5. package/es2015/forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.js.map +1 -0
  6. package/es2015/forms/src/components/index.js +3 -0
  7. package/es2015/forms/src/components/index.js.map +1 -0
  8. package/es2015/forms/src/directives/hasError/hasError.directive.js +16 -6
  9. package/es2015/forms/src/directives/hasError/hasError.directive.js.map +1 -1
  10. package/es2015/forms/src/index.js +3 -1
  11. package/es2015/forms/src/index.js.map +1 -1
  12. package/es2015/forms/src/misc/formModel/interfaces/modelDecoratorMetadata.js.map +1 -1
  13. package/es2015/forms/src/misc/formModel/misc/utils.js +11 -8
  14. package/es2015/forms/src/misc/formModel/misc/utils.js.map +1 -1
  15. package/es2015/forms/src/misc/tokens.js +14 -0
  16. package/es2015/forms/src/misc/tokens.js.map +1 -0
  17. package/es2015/forms/src/misc/validationErrorsContainerView.js +31 -0
  18. package/es2015/forms/src/misc/validationErrorsContainerView.js.map +1 -0
  19. package/es2015/forms/src/modules/errorMessage/directives/errorMessage/errorMessage.directive.js +1 -1
  20. package/es2015/forms/src/modules/errorMessage/directives/errorMessage/errorMessage.directive.js.map +1 -1
  21. package/es2015/forms/src/modules/errorMessage/pipes/withErrorMessage/withErrorMessage.pipe.js +1 -1
  22. package/es2015/forms/src/modules/errorMessage/pipes/withErrorMessage/withErrorMessage.pipe.js.map +1 -1
  23. package/es2015/forms/src/modules/hasError.module.js +15 -4
  24. package/es2015/forms/src/modules/hasError.module.js.map +1 -1
  25. package/es2015/forms/src/services/errorMessagesExtractor/errorMessagesExtractor.service.js +18 -9
  26. package/es2015/forms/src/services/errorMessagesExtractor/errorMessagesExtractor.service.js.map +1 -1
  27. package/es2015/forms/src/services/validationErrorRenderer/validationErrorRenderer.interface.js.map +1 -1
  28. package/es2015/forms/src/services/validationErrorRenderer/validationErrorRenderer.service.js +31 -145
  29. package/es2015/forms/src/services/validationErrorRenderer/validationErrorRenderer.service.js.map +1 -1
  30. package/es2020/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.js +53 -0
  31. package/es2020/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.js.map +1 -0
  32. package/es2020/forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.js +75 -0
  33. package/es2020/forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.js.map +1 -0
  34. package/es2020/forms/src/components/index.js +3 -0
  35. package/es2020/forms/src/components/index.js.map +1 -0
  36. package/es2020/forms/src/directives/hasError/hasError.directive.js +15 -6
  37. package/es2020/forms/src/directives/hasError/hasError.directive.js.map +1 -1
  38. package/es2020/forms/src/index.js +3 -1
  39. package/es2020/forms/src/index.js.map +1 -1
  40. package/es2020/forms/src/misc/formModel/interfaces/modelDecoratorMetadata.js.map +1 -1
  41. package/es2020/forms/src/misc/formModel/misc/utils.js +8 -5
  42. package/es2020/forms/src/misc/formModel/misc/utils.js.map +1 -1
  43. package/es2020/forms/src/misc/tokens.js +14 -0
  44. package/es2020/forms/src/misc/tokens.js.map +1 -0
  45. package/es2020/forms/src/misc/validationErrorsContainerView.js +31 -0
  46. package/es2020/forms/src/misc/validationErrorsContainerView.js.map +1 -0
  47. package/es2020/forms/src/modules/errorMessage/directives/errorMessage/errorMessage.directive.js +1 -1
  48. package/es2020/forms/src/modules/errorMessage/directives/errorMessage/errorMessage.directive.js.map +1 -1
  49. package/es2020/forms/src/modules/errorMessage/pipes/withErrorMessage/withErrorMessage.pipe.js +1 -1
  50. package/es2020/forms/src/modules/errorMessage/pipes/withErrorMessage/withErrorMessage.pipe.js.map +1 -1
  51. package/es2020/forms/src/modules/hasError.module.js +15 -4
  52. package/es2020/forms/src/modules/hasError.module.js.map +1 -1
  53. package/es2020/forms/src/services/errorMessagesExtractor/errorMessagesExtractor.service.js +18 -9
  54. package/es2020/forms/src/services/errorMessagesExtractor/errorMessagesExtractor.service.js.map +1 -1
  55. package/es2020/forms/src/services/validationErrorRenderer/validationErrorRenderer.interface.js.map +1 -1
  56. package/es2020/forms/src/services/validationErrorRenderer/validationErrorRenderer.service.js +31 -143
  57. package/es2020/forms/src/services/validationErrorRenderer/validationErrorRenderer.service.js.map +1 -1
  58. package/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.css +4 -0
  59. package/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.d.ts +32 -0
  60. package/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.d.ts.map +1 -0
  61. package/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.html +3 -0
  62. package/forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.css +4 -0
  63. package/forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.d.ts +51 -0
  64. package/forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.d.ts.map +1 -0
  65. package/forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.html +0 -0
  66. package/forms/src/components/index.d.ts +3 -0
  67. package/forms/src/components/index.d.ts.map +1 -0
  68. package/forms/src/directives/hasError/hasError.directive.d.ts +6 -3
  69. package/forms/src/directives/hasError/hasError.directive.d.ts.map +1 -1
  70. package/forms/src/index.d.ts +3 -1
  71. package/forms/src/index.d.ts.map +1 -1
  72. package/forms/src/misc/formModel/interfaces/modelDecoratorMetadata.d.ts +6 -1
  73. package/forms/src/misc/formModel/interfaces/modelDecoratorMetadata.d.ts.map +1 -1
  74. package/forms/src/misc/formModel/misc/utils.d.ts.map +1 -1
  75. package/forms/src/misc/tokens.d.ts +16 -0
  76. package/forms/src/misc/tokens.d.ts.map +1 -0
  77. package/forms/src/misc/validationErrorsContainerView.d.ts +25 -0
  78. package/forms/src/misc/validationErrorsContainerView.d.ts.map +1 -0
  79. package/forms/src/modules/hasError.module.d.ts +4 -1
  80. package/forms/src/modules/hasError.module.d.ts.map +1 -1
  81. package/forms/src/services/errorMessagesExtractor/errorMessagesExtractor.service.d.ts +4 -7
  82. package/forms/src/services/errorMessagesExtractor/errorMessagesExtractor.service.d.ts.map +1 -1
  83. package/forms/src/services/validationErrorRenderer/validationErrorRenderer.interface.d.ts +43 -12
  84. package/forms/src/services/validationErrorRenderer/validationErrorRenderer.interface.d.ts.map +1 -1
  85. package/forms/src/services/validationErrorRenderer/validationErrorRenderer.service.d.ts +15 -63
  86. package/forms/src/services/validationErrorRenderer/validationErrorRenderer.service.d.ts.map +1 -1
  87. package/package.json +1 -1
  88. package/version.bak +1 -1
  89. package/es2015/forms/src/misc/types.js +0 -6
  90. package/es2015/forms/src/misc/types.js.map +0 -1
  91. package/es2020/forms/src/misc/types.js +0 -6
  92. package/es2020/forms/src/misc/types.js.map +0 -1
  93. package/forms/src/misc/types.d.ts +0 -7
  94. package/forms/src/misc/types.d.ts.map +0 -1
@@ -0,0 +1,75 @@
1
+ import { Component, ChangeDetectionStrategy, ViewContainerRef } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ /**
4
+ * Component that serves as container for validation errors, either component or templates
5
+ */
6
+ export class DefaultValidationErrorsContainerComponent {
7
+ //######################### constructor #########################
8
+ constructor(_viewContainer) {
9
+ this._viewContainer = _viewContainer;
10
+ }
11
+ //######################### public methods - implementation of #########################
12
+ /**
13
+ * Shows validation errors
14
+ * @param errors - Errors to be shown
15
+ * @param options - Options used for displaying validation errors
16
+ * @param errorClasses - Array of css error classes
17
+ */
18
+ show(errors, options) {
19
+ this._errors = errors;
20
+ this._options = options;
21
+ if (options.template) {
22
+ this._renderTemplate();
23
+ }
24
+ else if (options.component) {
25
+ this._renderComponent();
26
+ }
27
+ else {
28
+ throw new Error('Missing template or component for rendering validation errors!');
29
+ }
30
+ }
31
+ /**
32
+ * Hides validation errors
33
+ */
34
+ hide() {
35
+ this._viewContainer.clear();
36
+ this._component = null;
37
+ this._template = null;
38
+ }
39
+ //######################### protected methods #########################
40
+ /**
41
+ * Renders validation errors component
42
+ */
43
+ _renderComponent() {
44
+ if (!this._component) {
45
+ this._component = this._viewContainer.createComponent(this._options.component);
46
+ }
47
+ this._component.instance.show(this._errors, this._options);
48
+ }
49
+ /**
50
+ * Renders validation errors template
51
+ */
52
+ _renderTemplate() {
53
+ if (!this._template) {
54
+ this._template = this._viewContainer.createEmbeddedView(this._options.template, {
55
+ $implicit: this._errors,
56
+ options: this._options
57
+ });
58
+ }
59
+ else {
60
+ this._template.context =
61
+ {
62
+ $implicit: this._errors,
63
+ options: this._options
64
+ };
65
+ this._template.detectChanges();
66
+ }
67
+ }
68
+ }
69
+ DefaultValidationErrorsContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DefaultValidationErrorsContainerComponent, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component });
70
+ DefaultValidationErrorsContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.2", type: DefaultValidationErrorsContainerComponent, selector: "default-validation-errors-container", ngImport: i0, template: "", styles: [":host\n{\n display: contents;\n}"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
71
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DefaultValidationErrorsContainerComponent, decorators: [{
72
+ type: Component,
73
+ args: [{ selector: 'default-validation-errors-container', changeDetection: ChangeDetectionStrategy.OnPush, template: "", styles: [":host\n{\n display: contents;\n}"] }]
74
+ }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; } });
75
+ //# sourceMappingURL=defaultValidationErrorsContainer.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultValidationErrorsContainer.component.js","sourceRoot":"","sources":["../../../../../forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.ts","../../../../../forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,gBAAgB,EAAgC,MAAM,eAAe,CAAC;;AAKlH;;GAEG;AAQH,MAAM,OAAO,yCAAyC;IA0BlD,iEAAiE;IACjE,YAAsB,cAAgC;QAAhC,mBAAc,GAAd,cAAc,CAAkB;IAEtD,CAAC;IAED,yFAAyF;IAEzF;;;;;OAKG;IACI,IAAI,CAAC,MAA8B,EAAE,OAAyC;QAEjF,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QAExB,IAAG,OAAO,CAAC,QAAQ,EACnB;YACI,IAAI,CAAC,eAAe,EAAE,CAAC;SAC1B;aACI,IAAG,OAAO,CAAC,SAAS,EACzB;YACI,IAAI,CAAC,gBAAgB,EAAE,CAAC;SAC3B;aAED;YACI,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;SACrF;IACL,CAAC;IAED;;OAEG;IACI,IAAI;QAEP,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;QAC5B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IAC1B,CAAC;IAED,uEAAuE;IAEvE;;OAEG;IACO,gBAAgB;QAEtB,IAAG,CAAC,IAAI,CAAC,UAAU,EACnB;YACI,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;SAClF;QAED,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC/D,CAAC;IAED;;OAEG;IACO,eAAe;QAErB,IAAG,CAAC,IAAI,CAAC,SAAS,EAClB;YACI,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAC9E;gBACI,SAAS,EAAE,IAAI,CAAC,OAAO;gBACvB,OAAO,EAAE,IAAI,CAAC,QAAQ;aACzB,CAAC,CAAC;SACN;aAED;YACI,IAAI,CAAC,SAAS,CAAC,OAAO;gBACtB;oBACI,SAAS,EAAE,IAAI,CAAC,OAAO;oBACvB,OAAO,EAAE,IAAI,CAAC,QAAQ;iBACzB,CAAC;YAEF,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,CAAC;SAClC;IACL,CAAC;;sIA1GQ,yCAAyC;0HAAzC,yCAAyC,2ECftD,EAAA;2FDea,yCAAyC;kBAPrD,SAAS;+BAEI,qCAAqC,mBAG9B,uBAAuB,CAAC,MAAM","sourcesContent":["import {Component, ChangeDetectionStrategy, ViewContainerRef, ComponentRef, EmbeddedViewRef} from '@angular/core';\n\nimport {ValidationErrorsResult} from '../../services/errorMessagesExtractor/errorMessagesExtractor.interface';\nimport {ValidationErrorsComponent, ValidationErrorsContainerComponent, ValidationErrorsContainerOptions, ValidationErrorsTemplateContext} from '../../services/validationErrorRenderer/validationErrorRenderer.interface';\n\n/**\n * Component that serves as container for validation errors, either component or templates\n */\n@Component(\n{\n selector: 'default-validation-errors-container',\n templateUrl: 'defaultValidationErrorsContainer.component.html',\n styleUrls: ['defaultValidationErrorsContainer.component.css'],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DefaultValidationErrorsContainerComponent implements ValidationErrorsContainerComponent\n{\n //######################### protected fields #########################\n\n /**\n * Errors to be shown\n * @internal\n */\n protected _errors: ValidationErrorsResult;\n \n /**\n * Options used for displaying validation errors\n * @internal\n */\n protected _options: ValidationErrorsContainerOptions;\n\n /**\n * Instance of component reference for rendered errors\n */\n protected _component: ComponentRef<ValidationErrorsComponent>;\n\n /**\n * Instance of template reference for rendered errors\n */\n protected _template: EmbeddedViewRef<ValidationErrorsTemplateContext>;\n\n //######################### constructor #########################\n constructor(protected _viewContainer: ViewContainerRef)\n {\n }\n\n //######################### public methods - implementation of #########################\n\n /**\n * Shows validation errors\n * @param errors - Errors to be shown\n * @param options - Options used for displaying validation errors\n * @param errorClasses - Array of css error classes\n */\n public show(errors: ValidationErrorsResult, options: ValidationErrorsContainerOptions): void\n {\n this._errors = errors;\n this._options = options;\n\n if(options.template)\n {\n this._renderTemplate();\n }\n else if(options.component)\n {\n this._renderComponent();\n }\n else\n {\n throw new Error('Missing template or component for rendering validation errors!');\n }\n }\n\n /**\n * Hides validation errors\n */\n public hide(): void\n {\n this._viewContainer.clear();\n this._component = null;\n this._template = null;\n }\n\n //######################### protected methods #########################\n\n /**\n * Renders validation errors component\n */\n protected _renderComponent(): void\n {\n if(!this._component)\n {\n this._component = this._viewContainer.createComponent(this._options.component);\n }\n\n this._component.instance.show(this._errors, this._options);\n }\n\n /**\n * Renders validation errors template\n */\n protected _renderTemplate(): void\n {\n if(!this._template)\n {\n this._template = this._viewContainer.createEmbeddedView(this._options.template,\n {\n $implicit: this._errors,\n options: this._options\n });\n }\n else\n {\n this._template.context =\n {\n $implicit: this._errors,\n options: this._options\n };\n\n this._template.detectChanges();\n }\n }\n}",""]}
@@ -0,0 +1,3 @@
1
+ export * from './defaultValidationErrors/defaultValidationErrors.component';
2
+ export * from './defaultValidationErrorsContainer/defaultValidationErrorsContainer.component';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../forms/src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,6DAA6D,CAAC;AAC5E,cAAc,+EAA+E,CAAC","sourcesContent":["export * from './defaultValidationErrors/defaultValidationErrors.component';\nexport * from './defaultValidationErrorsContainer/defaultValidationErrorsContainer.component';\n"]}
@@ -1,5 +1,5 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
- import { Directive, ElementRef, Optional, SkipSelf, Inject, Input, Injector } from '@angular/core';
2
+ import { Directive, ElementRef, Optional, SkipSelf, Inject, Input, Injector, ViewContainerRef } from '@angular/core';
3
3
  import { FormControlDirective, FormControlName, NgModel } from '@angular/forms';
4
4
  import { STRING_LOCALIZATION } from '@anglr/common';
5
5
  import { generateId, BindThis } from '@jscrpt/common';
@@ -7,25 +7,29 @@ import { Subscription } from 'rxjs';
7
7
  import { ValidationErrorRendererFactory } from '../../services/validationErrorRenderer/validationErrorRenderer.service';
8
8
  import { SubmittedService } from '../../services/submitted/submitted.service';
9
9
  import { GroupHasErrorDirective } from '../groupHasError/groupHasError.directive';
10
+ import { ValidationErrorsContainerView } from '../../misc/validationErrorsContainerView';
10
11
  import * as i0 from "@angular/core";
11
12
  import * as i1 from "../../services/validationErrorRenderer/validationErrorRenderer.service";
12
13
  import * as i2 from "../groupHasError/groupHasError.directive";
13
14
  import * as i3 from "@angular/forms";
14
15
  import * as i4 from "../../services/submitted/submitted.service";
16
+ import * as i5 from "../../misc/validationErrorsContainerView";
15
17
  //TODO - add support for setting renderer factory options using input
16
18
  /**
17
19
  * Directive that is attached to control element and handles css classes that are added to this element
18
20
  */
19
21
  export class HasErrorDirective {
20
22
  //######################### constructor #########################
21
- constructor(_element, _rendererFactory, _groupHasError, _formControl, _formControlName, _ngModel, _submittedSvc, _stringLocalization, _injector) {
23
+ constructor(_element, _rendererFactory, _viewContainer, _groupHasError, _formControl, _formControlName, _ngModel, _submittedSvc, _containerView, _stringLocalization, _injector) {
22
24
  this._element = _element;
23
25
  this._rendererFactory = _rendererFactory;
26
+ this._viewContainer = _viewContainer;
24
27
  this._groupHasError = _groupHasError;
25
28
  this._formControl = _formControl;
26
29
  this._formControlName = _formControlName;
27
30
  this._ngModel = _ngModel;
28
31
  this._submittedSvc = _submittedSvc;
32
+ this._containerView = _containerView;
29
33
  this._stringLocalization = _stringLocalization;
30
34
  this._injector = _injector;
31
35
  //######################### private fields #########################
@@ -58,8 +62,11 @@ export class HasErrorDirective {
58
62
  * Initialize component
59
63
  */
60
64
  ngOnInit() {
65
+ var _a;
66
+ this._containerView ?? (this._containerView = new ValidationErrorsContainerView());
67
+ (_a = this._containerView).viewContainer ?? (_a.viewContainer = this._viewContainer);
61
68
  this._registerMutationObserver();
62
- this.renderer = this._rendererFactory.create(this.control, this._element.nativeElement, this._injector, this._isSubmittedOrDirty, {});
69
+ this.renderer = this._rendererFactory.create(this.control, this._containerView, this._injector, this._isSubmittedOrDirty);
63
70
  this._subscriptions.add(this._stringLocalization.textsChange.subscribe(() => this._updateStatus()));
64
71
  this._subscriptions.add(this.control.statusChanges.subscribe(() => this._updateStatus()));
65
72
  this._updateStatus();
@@ -83,7 +90,7 @@ export class HasErrorDirective {
83
90
  */
84
91
  _updateStatus() {
85
92
  this._previousDirty = this.control.dirty;
86
- this._hasErrors = this.renderer.update(this.errorMessages);
93
+ this._hasErrors = this.renderer.update({}, this.errorMessages);
87
94
  this._toggleGroupHasError();
88
95
  }
89
96
  /**
@@ -126,7 +133,7 @@ export class HasErrorDirective {
126
133
  });
127
134
  }
128
135
  }
129
- HasErrorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: HasErrorDirective, deps: [{ token: i0.ElementRef }, { token: i1.ValidationErrorRendererFactory }, { token: i2.GroupHasErrorDirective, optional: true, skipSelf: true }, { token: i3.FormControlDirective, optional: true }, { token: i3.FormControlName, optional: true }, { token: i3.NgModel, optional: true }, { token: i4.SubmittedService, optional: true }, { token: STRING_LOCALIZATION }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Directive });
136
+ HasErrorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: HasErrorDirective, deps: [{ token: i0.ElementRef }, { token: i1.ValidationErrorRendererFactory }, { token: i0.ViewContainerRef }, { token: i2.GroupHasErrorDirective, optional: true, skipSelf: true }, { token: i3.FormControlDirective, optional: true }, { token: i3.FormControlName, optional: true }, { token: i3.NgModel, optional: true }, { token: i4.SubmittedService, optional: true }, { token: i5.ValidationErrorsContainerView, optional: true }, { token: STRING_LOCALIZATION }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Directive });
130
137
  HasErrorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.2", type: HasErrorDirective, selector: "[hasError]", inputs: { errorMessages: "errorMessages" }, ngImport: i0 });
131
138
  __decorate([
132
139
  BindThis,
@@ -139,7 +146,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
139
146
  args: [{
140
147
  selector: '[hasError]'
141
148
  }]
142
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.ValidationErrorRendererFactory }, { type: i2.GroupHasErrorDirective, decorators: [{
149
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.ValidationErrorRendererFactory }, { type: i0.ViewContainerRef }, { type: i2.GroupHasErrorDirective, decorators: [{
143
150
  type: Optional
144
151
  }, {
145
152
  type: SkipSelf
@@ -151,6 +158,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
151
158
  type: Optional
152
159
  }] }, { type: i4.SubmittedService, decorators: [{
153
160
  type: Optional
161
+ }] }, { type: i5.ValidationErrorsContainerView, decorators: [{
162
+ type: Optional
154
163
  }] }, { type: undefined, decorators: [{
155
164
  type: Inject,
156
165
  args: [STRING_LOCALIZATION]
@@ -1 +1 @@
1
- {"version":3,"file":"hasError.directive.js","sourceRoot":"","sources":["../../../../../forms/src/directives/hasError/hasError.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAqB,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAC,MAAM,eAAe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AC;YAC1B,UAAU,EAAE,IAAI;SACnB,CAAC,CAAC;IACP,CAAC;;8GA7KQ,iBAAiB,0VA8DN,mBAAmB;kGA9D9B,iBAAiB;AA4I1B;IADC,QAAQ;;;;4DAcR;2FAzJQ,iBAAiB;kBAJ7B,SAAS;mBACV;oBACI,QAAQ,EAAE,YAAY;iBACzB;;0BA0DgB,QAAQ;;0BAAI,QAAQ;;0BACpB,QAAQ;;0BACR,QAAQ;;0BACR,QAAQ;;0BACR,QAAQ;;0BACR,MAAM;2BAAC,mBAAmB;mEAVhC,aAAa;sBADnB,KAAK;gBAyFE,mBAAmB","sourcesContent":["import {Directive, ElementRef, Optional, SkipSelf, OnInit, OnDestroy, Inject, Input, Injector} from '@angular/core';\nimport {FormControlDirective, FormControlName, FormControl, NgModel} from '@angular/forms';\nimport {StringLocalization, STRING_LOCALIZATION} from '@anglr/common';\nimport {generateId, BindThis, StringDictionary} from '@jscrpt/common';\nimport {Subscription} from 'rxjs';\n\nimport {ValidationErrorRendererFactory} from '../../services/validationErrorRenderer/validationErrorRenderer.service';\nimport {ValidationErrorRenderer} from '../../services/validationErrorRenderer/validationErrorRenderer.interface';\nimport {SubmittedService} from '../../services/submitted/submitted.service';\nimport {GroupHasErrorDirective} from '../groupHasError/groupHasError.directive';\n\n//TODO - add support for setting renderer factory options using input\n\n/**\n * Directive that is attached to control element and handles css classes that are added to this element\n */\n@Directive(\n{\n selector: '[hasError]'\n})\nexport class HasErrorDirective implements OnInit, OnDestroy\n{\n //######################### private fields #########################\n\n /**\n * Subscriptions that are destroyed with destruction of this directive\n */\n private _subscriptions: Subscription = new Subscription();\n\n /**\n * Unique generated id of control\n */\n private _id: string = generateId(10);\n\n /**\n * Last value of control pristine attribute\n */\n private _previousDirty: boolean = false;\n\n /**\n * Indication whether currently are any errors rendered\n */\n private _hasErrors: boolean = false;\n\n /**\n * Mutation observer used for observing changes on class of element\n */\n private _observer: MutationObserver;\n\n //######################### private properties #########################\n\n /**\n * Gets control which was assigned to this element\n */\n private get control(): FormControl\n {\n return this._formControl?.control || this._formControlName?.control || this._ngModel?.control;\n }\n\n //######################### public properties #########################\n\n /**\n * Instance of validation error renderer\n */\n public renderer: ValidationErrorRenderer;\n\n //######################### public propeties - inputs #########################\n\n /**\n * Customized error messages\n */\n @Input()\n public errorMessages: StringDictionary;\n\n //######################### constructor #########################\n constructor(private _element: ElementRef<HTMLElement>,\n private _rendererFactory: ValidationErrorRendererFactory,\n @Optional() @SkipSelf() private _groupHasError: GroupHasErrorDirective,\n @Optional() private _formControl: FormControlDirective,\n @Optional() private _formControlName: FormControlName,\n @Optional() private _ngModel: NgModel,\n @Optional() private _submittedSvc: SubmittedService,\n @Inject(STRING_LOCALIZATION) protected _stringLocalization: StringLocalization,\n protected _injector: Injector)\n {\n }\n\n //######################### public methods - implementation of OnInit #########################\n \n /**\n * Initialize component\n */\n public ngOnInit(): void\n {\n this._registerMutationObserver();\n\n this.renderer = this._rendererFactory.create(this.control,\n this._element.nativeElement,\n this._injector,\n this._isSubmittedOrDirty,\n {\n });\n\n this._subscriptions.add(this._stringLocalization.textsChange.subscribe(() => this._updateStatus()));\n this._subscriptions.add(this.control.statusChanges.subscribe(() => this._updateStatus()));\n\n this._updateStatus();\n\n if(this._submittedSvc)\n {\n this._subscriptions.add(this._submittedSvc.submittedChange.subscribe(() => this._isSubmittedOrDirty(() => this._updateStatus())));\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._subscriptions.unsubscribe();\n\n this._groupHasError?.unregisterControl(this._id);\n this._observer?.disconnect();\n this.renderer?.destroy();\n }\n\n //######################### private methods #########################\n\n /**\n * Updates status of control and css classes\n */\n private _updateStatus(): void\n {\n this._previousDirty = this.control.dirty;\n this._hasErrors = this.renderer.update(this.errorMessages);\n this._toggleGroupHasError();\n }\n\n /**\n * Toggles registration of control in parent group\n */\n private _toggleGroupHasError(): void\n {\n if(this._groupHasError)\n {\n this._isSubmittedOrDirty(() => this._groupHasError.registerControl(this._id),\n () => this._groupHasError.unregisterControl(this._id),\n this._hasErrors);\n }\n }\n\n /**\n * Calls action when form is submitted or control is dirty\n * @param action - Action to be called when form is submitted or control dirty\n * @param falseAction - Action to be called when form is not submitted and control is not dirty\n * @param additionalCondition - Additional condition to be evaluated\n */\n @BindThis\n private _isSubmittedOrDirty(action: () => void, falseAction: () => void = () => {}, additionalCondition: boolean = true): void\n {\n //submitted form or dirty control\n if((this._submittedSvc?.submitted ||\n this.control?.dirty) &&\n additionalCondition)\n {\n action();\n }\n else\n {\n falseAction();\n }\n }\n\n /**\n * Registers mutation observer which watch for changes of class list\n */\n private _registerMutationObserver(): void\n {\n this._observer = new MutationObserver(() =>\n {\n if(this.control.dirty != this._previousDirty)\n {\n this._updateStatus();\n }\n });\n\n this._observer.observe(this._element.nativeElement, \n {\n attributeFilter: ['class'],\n attributes: true\n });\n }\n}"]}
1
+ {"version":3,"file":"hasError.directive.js","sourceRoot":"","sources":["../../../../../forms/src/directives/hasError/hasError.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAqB,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;AACtI,OAAO,EAAC,oBAAoB,EAAE,eAAe,EAAe,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAqB,mBAAmB,EAAC,MAAM,eAAe,CAAC;AACtE,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAmB,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAElC,OAAO,EAAC,8BAA8B,EAAC,MAAM,wEAAwE,CAAC;AAEtH,OAAO,EAAC,gBAAgB,EAAC,MAAM,4CAA4C,CAAC;AAC5E,OAAO,EAAC,sBAAsB,EAAC,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAC,6BA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AAQ;;;;4DAcR;2FA5JQ,iBAAiB;kBAJ7B,SAAS;mBACV;oBACI,QAAQ,EAAE,YAAY;iBACzB;;0BA2DgB,QAAQ;;0BAAI,QAAQ;;0BACpB,QAAQ;;0BACR,QAAQ;;0BACR,QAAQ;;0BACR,QAAQ;;0BACR,QAAQ;;0BACR,MAAM;2BAAC,mBAAmB;mEAZhC,aAAa;sBADnB,KAAK;gBA4FE,mBAAmB","sourcesContent":["import {Directive, ElementRef, Optional, SkipSelf, OnInit, OnDestroy, Inject, Input, Injector, ViewContainerRef} from '@angular/core';\nimport {FormControlDirective, FormControlName, FormControl, NgModel} from '@angular/forms';\nimport {StringLocalization, STRING_LOCALIZATION} from '@anglr/common';\nimport {generateId, BindThis, StringDictionary} from '@jscrpt/common';\nimport {Subscription} from 'rxjs';\n\nimport {ValidationErrorRendererFactory} from '../../services/validationErrorRenderer/validationErrorRenderer.service';\nimport {ValidationErrorRenderer} from '../../services/validationErrorRenderer/validationErrorRenderer.interface';\nimport {SubmittedService} from '../../services/submitted/submitted.service';\nimport {GroupHasErrorDirective} from '../groupHasError/groupHasError.directive';\nimport {ValidationErrorsContainerView} from '../../misc/validationErrorsContainerView';\n\n//TODO - add support for setting renderer factory options using input\n\n/**\n * Directive that is attached to control element and handles css classes that are added to this element\n */\n@Directive(\n{\n selector: '[hasError]'\n})\nexport class HasErrorDirective implements OnInit, OnDestroy\n{\n //######################### private fields #########################\n\n /**\n * Subscriptions that are destroyed with destruction of this directive\n */\n private _subscriptions: Subscription = new Subscription();\n\n /**\n * Unique generated id of control\n */\n private _id: string = generateId(10);\n\n /**\n * Last value of control pristine attribute\n */\n private _previousDirty: boolean = false;\n\n /**\n * Indication whether currently are any errors rendered\n */\n private _hasErrors: boolean = false;\n\n /**\n * Mutation observer used for observing changes on class of element\n */\n private _observer: MutationObserver;\n\n //######################### private properties #########################\n\n /**\n * Gets control which was assigned to this element\n */\n private get control(): FormControl\n {\n return this._formControl?.control || this._formControlName?.control || this._ngModel?.control;\n }\n\n //######################### public properties #########################\n\n /**\n * Instance of validation error renderer\n */\n public renderer: ValidationErrorRenderer;\n\n //######################### public propeties - inputs #########################\n\n /**\n * Customized error messages\n */\n @Input()\n public errorMessages: StringDictionary;\n\n //######################### constructor #########################\n constructor(private _element: ElementRef<HTMLElement>,\n private _rendererFactory: ValidationErrorRendererFactory,\n private _viewContainer: ViewContainerRef,\n @Optional() @SkipSelf() private _groupHasError: GroupHasErrorDirective,\n @Optional() private _formControl: FormControlDirective,\n @Optional() private _formControlName: FormControlName,\n @Optional() private _ngModel: NgModel,\n @Optional() private _submittedSvc: SubmittedService,\n @Optional() private _containerView: ValidationErrorsContainerView,\n @Inject(STRING_LOCALIZATION) protected _stringLocalization: StringLocalization,\n protected _injector: Injector)\n {\n }\n\n //######################### public methods - implementation of OnInit #########################\n \n /**\n * Initialize component\n */\n public ngOnInit(): void\n {\n this._containerView ??= new ValidationErrorsContainerView();\n this._containerView.viewContainer ??= this._viewContainer;\n\n this._registerMutationObserver();\n\n this.renderer = this._rendererFactory.create(this.control,\n this._containerView,\n this._injector,\n this._isSubmittedOrDirty);\n\n this._subscriptions.add(this._stringLocalization.textsChange.subscribe(() => this._updateStatus()));\n this._subscriptions.add(this.control.statusChanges.subscribe(() => this._updateStatus()));\n\n this._updateStatus();\n\n if(this._submittedSvc)\n {\n this._subscriptions.add(this._submittedSvc.submittedChange.subscribe(() => this._isSubmittedOrDirty(() => this._updateStatus())));\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._subscriptions.unsubscribe();\n\n this._groupHasError?.unregisterControl(this._id);\n this._observer?.disconnect();\n this.renderer?.destroy();\n }\n\n //######################### private methods #########################\n\n /**\n * Updates status of control and css classes\n */\n private _updateStatus(): void\n {\n this._previousDirty = this.control.dirty;\n this._hasErrors = this.renderer.update({}, this.errorMessages);\n this._toggleGroupHasError();\n }\n\n /**\n * Toggles registration of control in parent group\n */\n private _toggleGroupHasError(): void\n {\n if(this._groupHasError)\n {\n this._isSubmittedOrDirty(() => this._groupHasError.registerControl(this._id),\n () => this._groupHasError.unregisterControl(this._id),\n this._hasErrors);\n }\n }\n\n /**\n * Calls action when form is submitted or control is dirty\n * @param action - Action to be called when form is submitted or control dirty\n * @param falseAction - Action to be called when form is not submitted and control is not dirty\n * @param additionalCondition - Additional condition to be evaluated\n */\n @BindThis\n private _isSubmittedOrDirty(action: () => void, falseAction: () => void = () => {}, additionalCondition: boolean = true): void\n {\n //submitted form or dirty control\n if((this._submittedSvc?.submitted ||\n this.control?.dirty) &&\n additionalCondition)\n {\n action();\n }\n else\n {\n falseAction();\n }\n }\n\n /**\n * Registers mutation observer which watch for changes of class list\n */\n private _registerMutationObserver(): void\n {\n this._observer = new MutationObserver(() =>\n {\n if(this.control.dirty != this._previousDirty)\n {\n this._updateStatus();\n }\n });\n\n this._observer.observe(this._element.nativeElement, \n {\n attributeFilter: ['class'],\n attributes: true\n });\n }\n}"]}
@@ -1,3 +1,4 @@
1
+ export * from './components';
1
2
  export * from './directives/numberInput/maxValueNumberValidator.directive';
2
3
  export * from './directives/numberInput/minValueNumberValidator.directive';
3
4
  export * from './directives/numberInput/numberInputValidator.directive';
@@ -12,7 +13,8 @@ export * from './services/validationErrorRenderer/validationErrorRenderer.interf
12
13
  export * from './services/validationErrorRenderer/validationErrorRenderer.service';
13
14
  export * from './misc/validators';
14
15
  export * from './misc/utils';
15
- export * from './misc/types';
16
+ export * from './misc/tokens';
17
+ export * from './misc/validationErrorsContainerView';
16
18
  export * from './modules/numberInput.module';
17
19
  export * from './modules/hasError.module';
18
20
  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,cAAc,CAAC;AAC7B,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,sCAAsC,CAAC;AACrD,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 './components';\nexport * 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 './misc/validationErrorsContainerView';\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 +1 @@
1
- {"version":3,"file":"modelDecoratorMetadata.js","sourceRoot":"","sources":["../../../../../../forms/src/misc/formModel/interfaces/modelDecoratorMetadata.ts"],"names":[],"mappings":"","sourcesContent":["import {AsyncValidatorFn, ValidatorFn} from '@angular/forms';\n\nimport {AsyncValidatorFnFactory, ValidatorFnFactory} from '../misc/validatorFactories';\nimport {ModelPropertyDecoratorMetadata} from './modelPropertyDecoratorMetadata';\n\n/**\n * Metadata describing whole model\n */\nexport interface ModelDecoratorMetadata<TModel = any>\n{\n /**\n * Array of controls metadata\n */\n ɵControlsMetadata: Partial<Record<keyof TModel, ModelPropertyDecoratorMetadata>>;\n\n /**\n * Array of validator functions\n */\n ɵValidators?: Array<ValidatorFn|ValidatorFnFactory>;\n\n /**\n * Array of async validator functions\n */\n ɵAsyncValidators?: Array<AsyncValidatorFn|AsyncValidatorFnFactory>;\n}\n"]}
1
+ {"version":3,"file":"modelDecoratorMetadata.js","sourceRoot":"","sources":["../../../../../../forms/src/misc/formModel/interfaces/modelDecoratorMetadata.ts"],"names":[],"mappings":"","sourcesContent":["import {AsyncValidatorFn, ValidatorFn} from '@angular/forms';\nimport {Dictionary} from '@jscrpt/common';\n\nimport {AsyncValidatorFnFactory, ValidatorFnFactory} from '../misc/validatorFactories';\nimport {ModelPropertyDecoratorMetadata} from './modelPropertyDecoratorMetadata';\n\n/**\n * Metadata describing whole model\n */\nexport interface ModelDecoratorMetadata<TModel = any, TArgs extends Dictionary<any> = any>\n{\n /**\n * Array of controls metadata\n */\n ɵControlsMetadata: Partial<Record<keyof TModel, ModelPropertyDecoratorMetadata>>;\n\n /**\n * Array of validator functions\n */\n ɵValidators?: Array<ValidatorFn|ValidatorFnFactory>;\n\n /**\n * Array of async validator functions\n */\n ɵAsyncValidators?: Array<AsyncValidatorFn|AsyncValidatorFnFactory>;\n\n /**\n * Object storing additional arguments for customization\n */\n ɵArgs?: TArgs;\n}\n"]}
@@ -9,14 +9,17 @@ import { AsyncValidatorFnFactory, ValidatorFnFactory } from './validatorFactorie
9
9
  */
10
10
  function buildFormGroup(model, args) {
11
11
  if (!model) {
12
- return new FormGroup({}, {
13
- validators: model.ɵValidators?.map(validator => validator instanceof ValidatorFnFactory ? validator.valueOf()(args) : validator).filter(itm => !!itm),
14
- asyncValidators: model.ɵAsyncValidators?.map(validator => validator instanceof AsyncValidatorFnFactory ? validator.valueOf()(args) : validator).filter(itm => !!itm)
15
- });
12
+ return new FormGroup({});
16
13
  }
17
14
  const modelMetadata = model.ɵControlsMetadata ?? {};
15
+ const groupValidators = model.ɵValidators ?? [];
16
+ const groupAsyncValidators = model.ɵAsyncValidators ?? [];
17
+ const groupArgs = model.ɵArgs ?? {};
18
18
  const properties = Object.keys(model);
19
- const formGroup = new FormGroup({});
19
+ const formGroup = new FormGroup({}, {
20
+ validators: groupValidators?.map(validator => validator instanceof ValidatorFnFactory ? validator.valueOf()({ ...groupArgs, ...args }) : validator).filter(itm => !!itm),
21
+ asyncValidators: groupAsyncValidators?.map(validator => validator instanceof AsyncValidatorFnFactory ? validator.valueOf()({ ...groupArgs, ...args }) : validator).filter(itm => !!itm)
22
+ });
20
23
  for (const propertyName of properties) {
21
24
  const metadata = modelMetadata[propertyName] ?? ɵDefaultPropertyMetadata;
22
25
  const defaultValue = model[propertyName];
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../../forms/src/misc/formModel/misc/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,SAAS,EAAE,WAAW,EAAE,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAKlF,OAAO,EAAC,wBAAwB,EAAC,MAAM,YAAY,CAAC;AACpD,OAAO,EAAC,uBAAuB,EAAE,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAEjF;;;;;GAKG;AACH,SAAS,cAAc,CAAwC,KAAuD,EAAE,IAAY;IAEhI,IAAG,CAAC,KAAK,EACT;QACI,OAAO,IAAI,SAAS,CAAC,EAAE,EACF;YACI,UAAU,EAAE,KAAK,CAAC,WAAW,EAAE,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,YAAY,kBAAkB,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,C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G,IAAI,WAAW,CAAC,YAAY,EACZ;wBACI,UAAU,EAAE,UAAU;wBACtB,eAAe,EAAE,eAAe;wBAChC,GAAG,QAAQ,CAAC,cAAc;qBAC7B,CAAC,CAAC;oBAE7B,MAAM;iBACT;SACJ;QAED,IAAG,QAAQ,CAAC,QAAQ,EACpB;YACI,OAAO,CAAC,OAAO,EAAE,CAAC;SACrB;QAED,SAAS,CAAC,UAAU,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;KAC/C;IAED,OAAO,SAAS,CAAC;AACrB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAwC,KAAa,EAAE,IAAY;IAE7F,OAAO,cAAc,CAAC,KAAY,EAAE,IAAI,CAAC,CAAC;AAC9C,CAAC","sourcesContent":["import {AbstractControl, FormArray, FormControl, FormGroup} from '@angular/forms';\nimport {Dictionary} from '@jscrpt/common';\n\nimport {ModelDecoratorMetadata} from '../interfaces/modelDecoratorMetadata';\nimport {ModelPropertyDecoratorMetadata} from '../interfaces/modelPropertyDecoratorMetadata';\nimport {ɵDefaultPropertyMetadata} from './defaults';\nimport {AsyncValidatorFnFactory, ValidatorFnFactory} from './validatorFactories';\n\n/**\n * Builds form group from decorated model\n * @param model - Model that can be decorated for enhancing created form group with validation and so on\n * @param args - Object storing arguments from owning component for customization\n * @returns\n */\nfunction buildFormGroup<TModel, TArgs = Record<string, never>>(model: ModelDecoratorMetadata<TModel> & Dictionary<any>, args?: TArgs): FormGroup\n{\n if(!model)\n {\n return new FormGroup({},\n {\n validators: model.ɵValidators?.map(validator => validator instanceof ValidatorFnFactory ? validator.valueOf()(args) : validator).filter(itm => !!itm),\n asyncValidators: model.ɵAsyncValidators?.map(validator => validator instanceof AsyncValidatorFnFactory ? validator.valueOf()(args) : validator).filter(itm => !!itm)\n });\n }\n\n const modelMetadata: Dictionary<any> = model.ɵControlsMetadata ?? {};\n const properties = Object.keys(model);\n const formGroup: FormGroup = new FormGroup({});\n\n for(const propertyName of properties)\n {\n const metadata: ModelPropertyDecoratorMetadata = modelMetadata[propertyName] ?? ɵDefaultPropertyMetadata;\n const defaultValue = model[propertyName];\n\n //Skip control creation if value is undefined\n if(defaultValue === undefined)\n {\n continue;\n }\n\n const validators = metadata.validators.map(validator => validator instanceof ValidatorFnFactory ? validator.valueOf()({...metadata.args, ...args}) : validator).filter(itm => !!itm);\n const asyncValidators = metadata.asyncValidators.map(validator => validator instanceof AsyncValidatorFnFactory ? validator.valueOf()({...metadata.args, ...args}) : validator).filter(itm => !!itm);\n\n let control: AbstractControl;\n\n switch(metadata.type)\n {\n case FormGroup:\n {\n control = buildFormGroup(defaultValue, args);\n\n //TODO: think of setting metadata from property to model\n\n break;\n }\n case FormArray:\n {\n //TODO - enhance FormArray child definition and finish it\n control = new FormArray([],\n {\n validators: validators,\n asyncValidators: asyncValidators,\n ...metadata.controlOptions\n });\n\n if(defaultValue && Array.isArray(defaultValue))\n {\n const formArray = control as FormArray;\n\n for(const val of defaultValue)\n {\n switch(metadata.childType)\n {\n case FormGroup:\n {\n formArray.push(buildFormGroup(val, args));\n\n break;\n }\n case FormArray:\n {\n break;\n }\n default:\n //case FormControl:\n {\n formArray.push(new FormControl(val,\n {\n validators: validators,\n asyncValidators: asyncValidators,\n ...metadata.controlOptions\n }));\n\n break;\n }\n }\n }\n }\n\n break;\n }\n default:\n //case FormControl:\n {\n control = new FormControl(defaultValue,\n {\n validators: validators,\n asyncValidators: asyncValidators,\n ...metadata.controlOptions\n });\n\n break;\n }\n }\n\n if(metadata.disabled)\n {\n control.disable();\n }\n\n formGroup.addControl(propertyName, control);\n }\n\n return formGroup;\n}\n\n/**\n * Builds form from decorated model, only for properties with non `undefined` value\n * @param model - Model that can be decorated for enhancing created form group with validation and so on\n * @param args - Object storing arguments from owning component for customization\n * @returns\n */\nexport function buildFormModel<TModel, TArgs = Record<string, never>>(model: TModel, args?: TArgs): FormGroup\n{\n return buildFormGroup(model as any, args);\n}\n"]}
1
+ {"version":3,"file":"utils.js","source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CAAC;AAC9C,CAAC","sourcesContent":["import {AbstractControl, FormArray, FormControl, FormGroup} from '@angular/forms';\nimport {Dictionary} from '@jscrpt/common';\n\nimport {ModelDecoratorMetadata} from '../interfaces/modelDecoratorMetadata';\nimport {ModelPropertyDecoratorMetadata} from '../interfaces/modelPropertyDecoratorMetadata';\nimport {ɵDefaultPropertyMetadata} from './defaults';\nimport {AsyncValidatorFnFactory, ValidatorFnFactory} from './validatorFactories';\n\n/**\n * Builds form group from decorated model\n * @param model - Model that can be decorated for enhancing created form group with validation and so on\n * @param args - Object storing arguments from owning component for customization\n * @returns\n */\nfunction buildFormGroup<TModel, TArgs = Record<string, never>>(model: ModelDecoratorMetadata<TModel> & Dictionary<any>, args?: TArgs): FormGroup\n{\n if(!model)\n {\n return new FormGroup({});\n }\n\n const modelMetadata: Dictionary<any> = model.ɵControlsMetadata ?? {};\n const groupValidators = model.ɵValidators ?? [];\n const groupAsyncValidators = model.ɵAsyncValidators ?? [];\n const groupArgs: Dictionary<any> = model.ɵArgs ?? {};\n const properties = Object.keys(model);\n const formGroup: FormGroup = new FormGroup({},\n {\n validators: groupValidators?.map(validator => validator instanceof ValidatorFnFactory ? validator.valueOf()({...groupArgs, ...args}) : validator).filter(itm => !!itm),\n asyncValidators: groupAsyncValidators?.map(validator => validator instanceof AsyncValidatorFnFactory ? validator.valueOf()({...groupArgs, ...args}) : validator).filter(itm => !!itm)\n });\n\n for(const propertyName of properties)\n {\n const metadata: ModelPropertyDecoratorMetadata = modelMetadata[propertyName] ?? ɵDefaultPropertyMetadata;\n const defaultValue = model[propertyName];\n\n //Skip control creation if value is undefined\n if(defaultValue === undefined)\n {\n continue;\n }\n\n const validators = metadata.validators.map(validator => validator instanceof ValidatorFnFactory ? validator.valueOf()({...metadata.args, ...args}) : validator).filter(itm => !!itm);\n const asyncValidators = metadata.asyncValidators.map(validator => validator instanceof AsyncValidatorFnFactory ? validator.valueOf()({...metadata.args, ...args}) : validator).filter(itm => !!itm);\n\n let control: AbstractControl;\n\n switch(metadata.type)\n {\n case FormGroup:\n {\n control = buildFormGroup(defaultValue, args);\n\n //TODO: think of setting metadata from property to model\n\n break;\n }\n case FormArray:\n {\n //TODO - enhance FormArray child definition and finish it\n control = new FormArray([],\n {\n validators: validators,\n asyncValidators: asyncValidators,\n ...metadata.controlOptions\n });\n\n if(defaultValue && Array.isArray(defaultValue))\n {\n const formArray = control as FormArray;\n\n for(const val of defaultValue)\n {\n switch(metadata.childType)\n {\n case FormGroup:\n {\n formArray.push(buildFormGroup(val, args));\n\n break;\n }\n case FormArray:\n {\n break;\n }\n default:\n //case FormControl:\n {\n formArray.push(new FormControl(val,\n {\n validators: validators,\n asyncValidators: asyncValidators,\n ...metadata.controlOptions\n }));\n\n break;\n }\n }\n }\n }\n\n break;\n }\n default:\n //case FormControl:\n {\n control = new FormControl(defaultValue,\n {\n validators: validators,\n asyncValidators: asyncValidators,\n ...metadata.controlOptions\n });\n\n break;\n }\n }\n\n if(metadata.disabled)\n {\n control.disable();\n }\n\n formGroup.addControl(propertyName, control);\n }\n\n return formGroup;\n}\n\n/**\n * Builds form from decorated model, only for properties with non `undefined` value\n * @param model - Model that can be decorated for enhancing created form group with validation and so on\n * @param args - Object storing arguments from owning component for customization\n * @returns\n */\nexport function buildFormModel<TModel, TArgs = Record<string, never>>(model: TModel, args?: TArgs): FormGroup\n{\n return buildFormGroup(model as any, args);\n}\n"]}
@@ -0,0 +1,14 @@
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
+ /**
11
+ * Injection token used for injecting global options for ValidationErrorRendererFactory
12
+ */
13
+ export const VALIDATION_ERROR_RENDERER_FACTORY_OPTIONS = new InjectionToken('VALIDATION_ERROR_RENDERER_FACTORY_OPTIONS');
14
+ //# 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;AAK7C;;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;AAE9K;;GAEG;AACH,MAAM,CAAC,MAAM,yCAAyC,GAA0D,IAAI,cAAc,CAAwC,2CAA2C,CAAC,CAAC","sourcesContent":["import {InjectionToken} from '@angular/core';\nimport {StringDictionary} from '@jscrpt/common';\n\nimport {ValidationErrorRendererFactoryOptions} from '../services/validationErrorRenderer/validationErrorRenderer.interface';\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\n/**\n * Injection token used for injecting global options for ValidationErrorRendererFactory\n */\nexport const VALIDATION_ERROR_RENDERER_FACTORY_OPTIONS: InjectionToken<ValidationErrorRendererFactoryOptions> = new InjectionToken<ValidationErrorRendererFactoryOptions>('VALIDATION_ERROR_RENDERER_FACTORY_OPTIONS');\n"]}
@@ -0,0 +1,31 @@
1
+ import { Subject } from 'rxjs';
2
+ /**
3
+ * Class that holds validation errors view container
4
+ */
5
+ export class ValidationErrorsContainerView {
6
+ constructor() {
7
+ //######################### private fields #########################
8
+ /**
9
+ * Used for emitting viewContainer changes
10
+ */
11
+ this._viewContainerChange = new Subject();
12
+ }
13
+ //######################### public properties #########################
14
+ /**
15
+ * Gets or sets current instance of view container
16
+ */
17
+ get viewContainer() {
18
+ return this._viewContainer;
19
+ }
20
+ set viewContainer(value) {
21
+ this._viewContainer = value;
22
+ this._viewContainerChange.next();
23
+ }
24
+ /**
25
+ * Occurs when view container instance changes
26
+ */
27
+ get viewContainerChange() {
28
+ return this._viewContainerChange.asObservable();
29
+ }
30
+ }
31
+ //# sourceMappingURL=validationErrorsContainerView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validationErrorsContainerView.js","sourceRoot":"","sources":["../../../../forms/src/misc/validationErrorsContainerView.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,OAAO,EAAC,MAAM,MAAM,CAAC;AAEzC;;GAEG;AACH,MAAM,OAAO,6BAA6B;IAA1C;QAEI,oEAAoE;QAOpE;;WAEG;QACK,yBAAoB,GAAkB,IAAI,OAAO,EAAQ,CAAC;IAwBtE,CAAC;IAtBG,uEAAuE;IAEvE;;OAEG;IACH,IAAW,aAAa;QAEpB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IACD,IAAW,aAAa,CAAC,KAAuB;QAE5C,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;QAC5B,IAAI,CAAC,oBAAoB,CAAC,IAAI,EAAE,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,IAAW,mBAAmB;QAE1B,OAAO,IAAI,CAAC,oBAAoB,CAAC,YAAY,EAAE,CAAC;IACpD,CAAC;CACJ","sourcesContent":["import {ViewContainerRef} from '@angular/core';\nimport {Observable, Subject} from 'rxjs';\n\n/**\n * Class that holds validation errors view container\n */\nexport class ValidationErrorsContainerView\n{\n //######################### private fields #########################\n \n /**\n * Current instance of view container\n */\n private _viewContainer: ViewContainerRef;\n \n /**\n * Used for emitting viewContainer changes\n */\n private _viewContainerChange: Subject<void> = new Subject<void>();\n \n //######################### public properties #########################\n \n /**\n * Gets or sets current instance of view container\n */\n public get viewContainer(): ViewContainerRef\n {\n return this._viewContainer;\n }\n public set viewContainer(value: ViewContainerRef)\n {\n this._viewContainer = value;\n this._viewContainerChange.next();\n }\n\n /**\n * Occurs when view container instance changes\n */\n public get viewContainerChange(): Observable<void>\n {\n return this._viewContainerChange.asObservable();\n }\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,GA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AXtC,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,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/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,6 +1,8 @@
1
1
  import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
2
3
  import { HasErrorDirective } from '../directives/hasError/hasError.directive';
3
4
  import { GroupHasErrorDirective } from '../directives/groupHasError/groupHasError.directive';
5
+ import { DefaultValidationErrorsComponent, DefaultValidationErrorsContainerComponent } from '../components';
4
6
  import * as i0 from "@angular/core";
5
7
  /**
6
8
  * Module for input validation directives
@@ -9,19 +11,28 @@ export class HasErrorModule {
9
11
  }
10
12
  HasErrorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: HasErrorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
11
13
  HasErrorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: HasErrorModule, declarations: [HasErrorDirective,
12
- GroupHasErrorDirective], exports: [HasErrorDirective,
14
+ GroupHasErrorDirective,
15
+ DefaultValidationErrorsComponent,
16
+ DefaultValidationErrorsContainerComponent], imports: [CommonModule], exports: [HasErrorDirective,
13
17
  GroupHasErrorDirective] });
14
- HasErrorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: HasErrorModule });
18
+ HasErrorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: HasErrorModule, imports: [[
19
+ CommonModule,
20
+ ]] });
15
21
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: HasErrorModule, decorators: [{
16
22
  type: NgModule,
17
23
  args: [{
24
+ imports: [
25
+ CommonModule,
26
+ ],
18
27
  declarations: [
19
28
  HasErrorDirective,
20
- GroupHasErrorDirective
29
+ GroupHasErrorDirective,
30
+ DefaultValidationErrorsComponent,
31
+ DefaultValidationErrorsContainerComponent,
21
32
  ],
22
33
  exports: [
23
34
  HasErrorDirective,
24
- GroupHasErrorDirective
35
+ GroupHasErrorDirective,
25
36
  ]
26
37
  }]
27
38
  }] });
@@ -1 +1 @@
1
- {"version":3,"file":"hasError.module.js","sourceRoot":"","sources":["../../../../forms/src/modules/hasError.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAC,iBAAiB,EAAC,MAAM,2CAA2C,CAAC;AAC5E,OAAO,EAAC,sBAAsB,EAAC,MAAM,qDAAqD,CAAC;;AAE3F;;GAEG;AAcH,MAAM,OAAO,cAAc;;2GAAd,cAAc;4GAAd,cAAc,iBATnB,iBAAiB;QACjB,sBAAsB,aAItB,iBAAiB;QACjB,sBAAsB;4GAGjB,cAAc;2FAAd,cAAc;kBAb1B,QAAQ;mBACT;oBACI,YAAY,EACZ;wBACI,iBAAiB;wBACjB,sBAAsB;qBACzB;oBACD,OAAO,EACP;wBACI,iBAAiB;wBACjB,sBAAsB;qBACzB;iBACJ","sourcesContent":["import {NgModule} from '@angular/core';\n\nimport {HasErrorDirective} from '../directives/hasError/hasError.directive';\nimport {GroupHasErrorDirective} from '../directives/groupHasError/groupHasError.directive';\n\n/**\n * Module for input validation directives\n */\n@NgModule(\n{\n declarations: \n [\n HasErrorDirective,\n GroupHasErrorDirective\n ],\n exports: \n [\n HasErrorDirective,\n GroupHasErrorDirective\n ]\n})\nexport class HasErrorModule\n{\n}"]}
1
+ {"version":3,"file":"hasError.module.js","sourceRoot":"","sources":["../../../../forms/src/modules/hasError.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AACvC,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAC,iBAAiB,EAAC,MAAM,2CAA2C,CAAC;AAC5E,OAAO,EAAC,sBAAsB,EAAC,MAAM,qDAAqD,CAAC;AAC3F,OAAO,EAAC,gCAAgC,EAAE,yCAAyC,EAAC,MAAM,eAAe,CAAC;;AAE1G;;GAEG;AAoBH,MAAM,OAAO,cAAc;;2GAAd,cAAc;4GAAd,cAAc,iBAXnB,iBAAiB;QACjB,sBAAsB;QACtB,gCAAgC;QAChC,yCAAyC,aAPzC,YAAY,aAWZ,iBAAiB;QACjB,sBAAsB;4GAGjB,cAAc,YAhBvB;YACI,YAAY;SACf;2FAcQ,cAAc;kBAnB1B,QAAQ;mBACT;oBACI,OAAO,EACP;wBACI,YAAY;qBACf;oBACD,YAAY,EACZ;wBACI,iBAAiB;wBACjB,sBAAsB;wBACtB,gCAAgC;wBAChC,yCAAyC;qBAC5C;oBACD,OAAO,EACP;wBACI,iBAAiB;wBACjB,sBAAsB;qBACzB;iBACJ","sourcesContent":["import {NgModule} from '@angular/core';\nimport {CommonModule} from '@angular/common';\n\nimport {HasErrorDirective} from '../directives/hasError/hasError.directive';\nimport {GroupHasErrorDirective} from '../directives/groupHasError/groupHasError.directive';\nimport {DefaultValidationErrorsComponent, DefaultValidationErrorsContainerComponent} from '../components';\n\n/**\n * Module for input validation directives\n */\n@NgModule(\n{\n imports:\n [\n CommonModule,\n ],\n declarations: \n [\n HasErrorDirective,\n GroupHasErrorDirective,\n DefaultValidationErrorsComponent,\n DefaultValidationErrorsContainerComponent,\n ],\n exports: \n [\n HasErrorDirective,\n GroupHasErrorDirective,\n ]\n})\nexport class HasErrorModule\n{\n}"]}
@@ -1,7 +1,7 @@
1
- import { Injectable, Inject, Optional, Injector } from '@angular/core';
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,16 +15,15 @@ const defaultErrorMessages = {
15
15
  minlength: 'Value is short.',
16
16
  maxlength: 'Value is too long.'
17
17
  };
18
- //TODO: move string localization service into constructor, breaking change
19
- //TODO: support exceptions for error names, allow to have string value to be used as error from error
20
18
  /**
21
19
  * Service used for extracting error messages from form control
22
20
  */
23
21
  export class ErrorMessagesExtractor {
24
22
  //######################### constructor #########################
25
- constructor(injector, globalErrorMessages) {
23
+ constructor(_stringLocalization, _ignoredValidationErrors, globalErrorMessages) {
24
+ this._stringLocalization = _stringLocalization;
25
+ this._ignoredValidationErrors = _ignoredValidationErrors;
26
26
  this._errorMessages = extend(true, {}, defaultErrorMessages, globalErrorMessages);
27
- this._stringLocalization = injector.get(STRING_LOCALIZATION);
28
27
  }
29
28
  //######################### public methods #########################
30
29
  /**
@@ -39,7 +38,7 @@ export class ErrorMessagesExtractor {
39
38
  return null;
40
39
  }
41
40
  const result = {
42
- errors: Object.keys(control.errors),
41
+ errors: Object.keys(control.errors).filter(itm => this._ignoredValidationErrors.indexOf(itm) < 0),
43
42
  errorMessages: []
44
43
  };
45
44
  result.errors.forEach(error => {
@@ -48,6 +47,10 @@ export class ErrorMessagesExtractor {
48
47
  if (errorMessages[error]) {
49
48
  result.errorMessages.push(this._stringLocalization.get(errorMessages[error], control.errors));
50
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
+ }
51
54
  //error data are array of strings, each string is considered error message
52
55
  else if (Array.isArray(errorData)) {
53
56
  errorData.forEach(errorItm => {
@@ -60,12 +63,18 @@ export class ErrorMessagesExtractor {
60
63
  return result;
61
64
  }
62
65
  }
63
- ErrorMessagesExtractor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: ErrorMessagesExtractor, deps: [{ token: i0.Injector }, { 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 });
64
67
  ErrorMessagesExtractor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: ErrorMessagesExtractor, providedIn: 'root' });
65
68
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: ErrorMessagesExtractor, decorators: [{
66
69
  type: Injectable,
67
70
  args: [{ providedIn: 'root' }]
68
- }], ctorParameters: function () { return [{ type: i0.Injector }, { type: undefined, decorators: [{
71
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
72
+ type: Inject,
73
+ args: [STRING_LOCALIZATION]
74
+ }] }, { type: undefined, decorators: [{
75
+ type: Inject,
76
+ args: [IGNORED_VALIDATION_ERRORS]
77
+ }] }, { type: undefined, decorators: [{
69
78
  type: Inject,
70
79
  args: [VALIDATION_ERROR_MESSAGES]
71
80
  }, {