@anglr/common 12.0.0-beta.20220413111906 → 12.0.0-beta.20220414120442
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +51 -2
- package/es2015/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.js +53 -0
- package/es2015/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.js.map +1 -0
- package/es2015/forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.js +75 -0
- package/es2015/forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.js.map +1 -0
- package/es2015/forms/src/components/index.js +4 -0
- package/es2015/forms/src/components/index.js.map +1 -0
- package/es2015/forms/src/components/reservedSpaceValidationErrorsContainer/reservedSpaceValidationErrorsContainer.component.js +75 -0
- package/es2015/forms/src/components/reservedSpaceValidationErrorsContainer/reservedSpaceValidationErrorsContainer.component.js.map +1 -0
- package/es2015/forms/src/directives/groupHasErrorContainer/groupHasErrorContainer.directive.js +31 -0
- package/es2015/forms/src/directives/groupHasErrorContainer/groupHasErrorContainer.directive.js.map +1 -0
- package/es2015/forms/src/directives/hasError/hasError.directive.js +38 -8
- package/es2015/forms/src/directives/hasError/hasError.directive.js.map +1 -1
- package/es2015/forms/src/directives/index.js +3 -0
- package/es2015/forms/src/directives/index.js.map +1 -0
- package/es2015/forms/src/directives/validationErrorsContainer/validationErrorsContainer.directive.js +24 -0
- package/es2015/forms/src/directives/validationErrorsContainer/validationErrorsContainer.directive.js.map +1 -0
- package/es2015/forms/src/index.js +4 -1
- package/es2015/forms/src/index.js.map +1 -1
- package/es2015/forms/src/misc/tokens.js +14 -0
- package/es2015/forms/src/misc/tokens.js.map +1 -0
- package/es2015/forms/src/misc/validationErrorsContainerView.js +31 -0
- package/es2015/forms/src/misc/validationErrorsContainerView.js.map +1 -0
- package/es2015/forms/src/modules/errorMessage/components/groupErrors/groupErrors.component.js +3 -2
- package/es2015/forms/src/modules/errorMessage/components/groupErrors/groupErrors.component.js.map +1 -1
- package/es2015/forms/src/modules/errorMessage/directives/errorMessage/errorMessage.directive.js +1 -1
- package/es2015/forms/src/modules/errorMessage/directives/errorMessage/errorMessage.directive.js.map +1 -1
- package/es2015/forms/src/modules/errorMessage/pipes/withErrorMessage/withErrorMessage.pipe.js +1 -1
- package/es2015/forms/src/modules/errorMessage/pipes/withErrorMessage/withErrorMessage.pipe.js.map +1 -1
- package/es2015/forms/src/modules/hasError.module.js +27 -5
- package/es2015/forms/src/modules/hasError.module.js.map +1 -1
- package/es2015/forms/src/services/errorMessagesExtractor/errorMessagesExtractor.service.js +12 -5
- package/es2015/forms/src/services/errorMessagesExtractor/errorMessagesExtractor.service.js.map +1 -1
- package/es2015/forms/src/services/validationErrorRenderer/validationErrorRenderer.interface.js.map +1 -1
- package/es2015/forms/src/services/validationErrorRenderer/validationErrorRenderer.service.js +31 -145
- package/es2015/forms/src/services/validationErrorRenderer/validationErrorRenderer.service.js.map +1 -1
- package/es2020/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.js +53 -0
- package/es2020/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.js.map +1 -0
- package/es2020/forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.js +75 -0
- package/es2020/forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.js.map +1 -0
- package/es2020/forms/src/components/index.js +4 -0
- package/es2020/forms/src/components/index.js.map +1 -0
- package/es2020/forms/src/components/reservedSpaceValidationErrorsContainer/reservedSpaceValidationErrorsContainer.component.js +75 -0
- package/es2020/forms/src/components/reservedSpaceValidationErrorsContainer/reservedSpaceValidationErrorsContainer.component.js.map +1 -0
- package/es2020/forms/src/directives/groupHasErrorContainer/groupHasErrorContainer.directive.js +31 -0
- package/es2020/forms/src/directives/groupHasErrorContainer/groupHasErrorContainer.directive.js.map +1 -0
- package/es2020/forms/src/directives/hasError/hasError.directive.js +37 -8
- package/es2020/forms/src/directives/hasError/hasError.directive.js.map +1 -1
- package/es2020/forms/src/directives/index.js +3 -0
- package/es2020/forms/src/directives/index.js.map +1 -0
- package/es2020/forms/src/directives/validationErrorsContainer/validationErrorsContainer.directive.js +24 -0
- package/es2020/forms/src/directives/validationErrorsContainer/validationErrorsContainer.directive.js.map +1 -0
- package/es2020/forms/src/index.js +4 -1
- package/es2020/forms/src/index.js.map +1 -1
- package/es2020/forms/src/misc/tokens.js +14 -0
- package/es2020/forms/src/misc/tokens.js.map +1 -0
- package/es2020/forms/src/misc/validationErrorsContainerView.js +31 -0
- package/es2020/forms/src/misc/validationErrorsContainerView.js.map +1 -0
- package/es2020/forms/src/modules/errorMessage/components/groupErrors/groupErrors.component.js +3 -2
- package/es2020/forms/src/modules/errorMessage/components/groupErrors/groupErrors.component.js.map +1 -1
- package/es2020/forms/src/modules/errorMessage/directives/errorMessage/errorMessage.directive.js +1 -1
- package/es2020/forms/src/modules/errorMessage/directives/errorMessage/errorMessage.directive.js.map +1 -1
- package/es2020/forms/src/modules/errorMessage/pipes/withErrorMessage/withErrorMessage.pipe.js +1 -1
- package/es2020/forms/src/modules/errorMessage/pipes/withErrorMessage/withErrorMessage.pipe.js.map +1 -1
- package/es2020/forms/src/modules/hasError.module.js +27 -5
- package/es2020/forms/src/modules/hasError.module.js.map +1 -1
- package/es2020/forms/src/services/errorMessagesExtractor/errorMessagesExtractor.service.js +12 -5
- package/es2020/forms/src/services/errorMessagesExtractor/errorMessagesExtractor.service.js.map +1 -1
- package/es2020/forms/src/services/validationErrorRenderer/validationErrorRenderer.interface.js.map +1 -1
- package/es2020/forms/src/services/validationErrorRenderer/validationErrorRenderer.service.js +31 -143
- package/es2020/forms/src/services/validationErrorRenderer/validationErrorRenderer.service.js.map +1 -1
- package/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.css +4 -0
- package/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.d.ts +32 -0
- package/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.d.ts.map +1 -0
- package/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.html +3 -0
- package/forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.css +4 -0
- package/forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.d.ts +51 -0
- package/forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.d.ts.map +1 -0
- package/forms/src/components/index.d.ts +4 -0
- package/forms/src/components/index.d.ts.map +1 -0
- package/forms/src/components/reservedSpaceValidationErrorsContainer/reservedSpaceValidationErrorsContainer.component.css +4 -0
- package/forms/src/components/reservedSpaceValidationErrorsContainer/reservedSpaceValidationErrorsContainer.component.d.ts +53 -0
- package/forms/src/components/reservedSpaceValidationErrorsContainer/reservedSpaceValidationErrorsContainer.component.d.ts.map +1 -0
- package/forms/src/components/reservedSpaceValidationErrorsContainer/reservedSpaceValidationErrorsContainer.component.html +3 -0
- package/forms/src/directives/groupHasErrorContainer/groupHasErrorContainer.directive.d.ts +10 -0
- package/forms/src/directives/groupHasErrorContainer/groupHasErrorContainer.directive.d.ts.map +1 -0
- package/forms/src/directives/hasError/hasError.directive.d.ts +21 -6
- package/forms/src/directives/hasError/hasError.directive.d.ts.map +1 -1
- package/forms/src/directives/index.d.ts +3 -0
- package/forms/src/directives/index.d.ts.map +1 -0
- package/forms/src/directives/validationErrorsContainer/validationErrorsContainer.directive.d.ts +12 -0
- package/forms/src/directives/validationErrorsContainer/validationErrorsContainer.directive.d.ts.map +1 -0
- package/forms/src/index.d.ts +4 -1
- package/forms/src/index.d.ts.map +1 -1
- package/forms/src/misc/tokens.d.ts +16 -0
- package/forms/src/misc/tokens.d.ts.map +1 -0
- package/forms/src/misc/validationErrorsContainerView.d.ts +25 -0
- package/forms/src/misc/validationErrorsContainerView.d.ts.map +1 -0
- package/forms/src/modules/errorMessage/components/groupErrors/groupErrors.component.d.ts.map +1 -1
- package/forms/src/modules/errorMessage/components/groupErrors/groupErrors.component.html +1 -1
- package/forms/src/modules/hasError.module.d.ts +7 -1
- package/forms/src/modules/hasError.module.d.ts.map +1 -1
- package/forms/src/services/errorMessagesExtractor/errorMessagesExtractor.service.d.ts +3 -2
- package/forms/src/services/errorMessagesExtractor/errorMessagesExtractor.service.d.ts.map +1 -1
- package/forms/src/services/validationErrorRenderer/validationErrorRenderer.interface.d.ts +43 -12
- package/forms/src/services/validationErrorRenderer/validationErrorRenderer.interface.d.ts.map +1 -1
- package/forms/src/services/validationErrorRenderer/validationErrorRenderer.service.d.ts +15 -63
- package/forms/src/services/validationErrorRenderer/validationErrorRenderer.service.d.ts.map +1 -1
- package/package.json +1 -1
- package/version.bak +1 -1
- package/es2015/forms/src/misc/types.js +0 -6
- package/es2015/forms/src/misc/types.js.map +0 -1
- package/es2020/forms/src/misc/types.js +0 -6
- package/es2020/forms/src/misc/types.js.map +0 -1
- package/forms/src/misc/types.d.ts +0 -7
- package/forms/src/misc/types.d.ts.map +0 -1
package/changelog.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## Version 12.0.0 (2022-04-
|
|
3
|
+
## Version 12.0.0 (2022-04-14)
|
|
4
4
|
|
|
5
5
|
### Bug Fixes
|
|
6
6
|
|
|
@@ -15,15 +15,64 @@
|
|
|
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`
|
|
22
|
+
- new `ValidationErrorsOptions` interface, that are options for displayed validation errors
|
|
23
|
+
- created super interface for `ValidationErrorsContainerOptions`
|
|
24
|
+
- property `prefix` prefix of css classes applied to element
|
|
25
|
+
- property `suffix` suffix of css classes applied to element
|
|
26
|
+
- property `wrapperDivClass` css class attached to wrapper div
|
|
27
|
+
- new `ValidationErrorsContainerOptions` interface, that are options for validation errors container
|
|
28
|
+
- created super interface for `ValidationErrorsRendererOptions`
|
|
29
|
+
- property `component` component used for rendering validation errors
|
|
30
|
+
- property `template` template used for rendering validation errors
|
|
31
|
+
- updated `ValidationErrorsTemplateContext` interface
|
|
32
|
+
- property `options` options used for displaying validation errors
|
|
33
|
+
- new `ValidationErrorsContainerComponent` interface, that is component that is used for rendering validation errors container
|
|
34
|
+
- method `show` shows validation errors
|
|
35
|
+
- method `hide` hides validation errors
|
|
36
|
+
- new `ValidationErrorsContainerView` class, that holds validation errors view container
|
|
37
|
+
- property `viewContainer` gets or sets current instance of view container
|
|
38
|
+
- property `viewContainerChange` occurs when view container instance changes
|
|
39
|
+
- new `DefaultValidationErrorsContainerComponent` component, that serves as container for validation errors, either component or templates
|
|
40
|
+
- implements `ValidationErrorsContainerComponent` interface
|
|
41
|
+
- default value for `ValidationErrorRendererFactory`
|
|
42
|
+
- new `DefaultValidationErrorsComponent` component, that is default validation errors component, displaying validation errors
|
|
43
|
+
- implements `ValidationErrorsComponent` interface
|
|
44
|
+
- default value for `ValidationErrorRendererFactory`
|
|
45
|
+
- new `GroupHasErrorContainerDirective` directive, that is attached to parent element of inputs group and handles css class that is added to this element and registers provider for ValidationErrorsContainerView
|
|
46
|
+
- new `ValidationErrorsContainerDirective` directive, that sets view container for validation errors for current element
|
|
47
|
+
- updated `HasErrorModule` module
|
|
48
|
+
- **exports**
|
|
49
|
+
- `GroupHasErrorContainerDirective` directive
|
|
50
|
+
- `ValidationErrorsContainerDirective` directive
|
|
51
|
+
- updated `HasErrorDirective` directive
|
|
52
|
+
- **inputs**
|
|
53
|
+
- `errorsComponent` custom component used for rendering validation errors
|
|
54
|
+
- `errorsTemplate` custom template used for rendering validation errors
|
|
55
|
+
- new `ReservedSpaceValidationErrorsContainerComponent` component, that serves as container for validation errors, either component or templates with reserved space for errors
|
|
18
56
|
|
|
19
57
|
### BREAKING CHANGES
|
|
20
58
|
|
|
21
59
|
- `ValidationErrorRenderer` interface
|
|
22
|
-
- `update` method, has
|
|
60
|
+
- `update` method, parameters has changed
|
|
61
|
+
- removed `wrapperElement`
|
|
23
62
|
- `ValidationErrorRendererFactory` service
|
|
63
|
+
- changed constructor parameters
|
|
64
|
+
- `DefaultValidationErrorRenderer` class
|
|
24
65
|
- now implements updated `ValidationErrorRenderer`
|
|
66
|
+
- completely refactored
|
|
67
|
+
- now using `ValidationErrorsContainerComponent` for rendering errors
|
|
25
68
|
- `ErrorMessagesExtractor` service
|
|
26
69
|
- changed constructor parameters
|
|
70
|
+
- `HasErrorDirective` directive
|
|
71
|
+
- changed constructor parameters
|
|
72
|
+
- `ValidationErrorsComponent` interface
|
|
73
|
+
- `show` now has new parameter *options*
|
|
74
|
+
- `ValidationErrorRendererCtor` interface
|
|
75
|
+
- `ctor` has changed parameters
|
|
27
76
|
|
|
28
77
|
## Version 11.3.1 (2022-04-13)
|
|
29
78
|
|
package/es2015/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Component, ChangeDetectionStrategy, ChangeDetectorRef, HostBinding } from '@angular/core';
|
|
2
|
+
import { animateChild, query, transition, trigger } from '@angular/animations';
|
|
3
|
+
import { slideInOutTrigger } from '@anglr/animations';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
import * as i1 from "@angular/common";
|
|
6
|
+
//TODO: move animation to common
|
|
7
|
+
/**
|
|
8
|
+
* Default validation errors component, displaying validation errors
|
|
9
|
+
*/
|
|
10
|
+
export class DefaultValidationErrorsComponent {
|
|
11
|
+
//######################### constructor #########################
|
|
12
|
+
constructor(_changeDetector) {
|
|
13
|
+
this._changeDetector = _changeDetector;
|
|
14
|
+
//######################### public properties - host #########################
|
|
15
|
+
/**
|
|
16
|
+
* Enables leave animations for internal stuff
|
|
17
|
+
*/
|
|
18
|
+
this.animate = true;
|
|
19
|
+
}
|
|
20
|
+
//######################### public methods - implementation of ValidationErrorsComponent #########################
|
|
21
|
+
/**
|
|
22
|
+
* @inheritdoc
|
|
23
|
+
*/
|
|
24
|
+
show(errors, options) {
|
|
25
|
+
this.errors = errors;
|
|
26
|
+
this.options = options;
|
|
27
|
+
this._changeDetector.detectChanges();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
DefaultValidationErrorsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DefaultValidationErrorsComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
31
|
+
DefaultValidationErrorsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.2", type: DefaultValidationErrorsComponent, selector: "default-validation-errors", host: { properties: { "@componentContent": "this.animate" } }, ngImport: i0, template: "<div [ngClass]=\"options?.wrapperDivClass\" *ngIf=\"errors?.errorMessages?.length\" @slideInOut>\n <div *ngFor=\"let error of errors?.errorMessages\">{{error}}</div>\n</div>", styles: [":host\n{\n display: contents;\n}"], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], animations: [
|
|
32
|
+
slideInOutTrigger,
|
|
33
|
+
trigger('componentContent', [
|
|
34
|
+
transition(':enter, :leave', [
|
|
35
|
+
query('@*', animateChild(), { optional: true })
|
|
36
|
+
])
|
|
37
|
+
])
|
|
38
|
+
], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
39
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DefaultValidationErrorsComponent, decorators: [{
|
|
40
|
+
type: Component,
|
|
41
|
+
args: [{ selector: 'default-validation-errors', animations: [
|
|
42
|
+
slideInOutTrigger,
|
|
43
|
+
trigger('componentContent', [
|
|
44
|
+
transition(':enter, :leave', [
|
|
45
|
+
query('@*', animateChild(), { optional: true })
|
|
46
|
+
])
|
|
47
|
+
])
|
|
48
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [ngClass]=\"options?.wrapperDivClass\" *ngIf=\"errors?.errorMessages?.length\" @slideInOut>\n <div *ngFor=\"let error of errors?.errorMessages\">{{error}}</div>\n</div>", styles: [":host\n{\n display: contents;\n}"] }]
|
|
49
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { animate: [{
|
|
50
|
+
type: HostBinding,
|
|
51
|
+
args: ['@componentContent']
|
|
52
|
+
}] } });
|
|
53
|
+
//# sourceMappingURL=defaultValidationErrors.component.js.map
|
package/es2015/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultValidationErrors.component.js","sourceRoot":"","sources":["../../../../../forms/src/components/defaultValidationErrors/defaultValidationErrors.component.ts","../../../../../forms/src/components/defaultValidationErrors/defaultValidationErrors.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AACjG,OAAO,EAAC,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAC,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;;;AAKpD,gCAAgC;AAEhC;;GAEG;AAmBH,MAAM,OAAO,gCAAgC;IAwBzC,iEAAiE;IACjE,YAAsB,eAAkC;QAAlC,oBAAe,GAAf,eAAe,CAAmB;QATxD,8EAA8E;QAE9E;;WAEG;QAEI,YAAO,GAAY,IAAI,CAAC;IAK/B,CAAC;IAED,kHAAkH;IAElH;;OAEG;IACI,IAAI,CAAC,MAA8B,EAAE,OAAgC;QAExE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,IAAI,CAAC,eAAe,CAAC,aAAa,EAAE,CAAC;IACzC,CAAC;;6HAxCQ,gCAAgC;iHAAhC,gCAAgC,gIC9B7C,kLAEM,mVDgBF;QACI,iBAAiB;QACjB,OAAO,CAAC,kBAAkB,EAC1B;YACI,UAAU,CAAC,gBAAgB,EAC3B;gBACI,KAAK,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;aAChD,CAAC;SACL,CAAC;KACL;2FAGQ,gCAAgC;kBAlB5C,SAAS;+BAEI,2BAA2B,cAIrC;wBACI,iBAAiB;wBACjB,OAAO,CAAC,kBAAkB,EAC1B;4BACI,UAAU,CAAC,gBAAgB,EAC3B;gCACI,KAAK,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;6BAChD,CAAC;yBACL,CAAC;qBACL,mBACgB,uBAAuB,CAAC,MAAM;wGAwBxC,OAAO;sBADb,WAAW;uBAAC,mBAAmB","sourcesContent":["import {Component, ChangeDetectionStrategy, ChangeDetectorRef, HostBinding} from '@angular/core';\nimport {animateChild, query, transition, trigger} from '@angular/animations';\nimport {slideInOutTrigger} from '@anglr/animations';\n\nimport {ValidationErrorsResult} from '../../services/errorMessagesExtractor/errorMessagesExtractor.interface';\nimport {ValidationErrorsComponent, ValidationErrorsOptions} from '../../services/validationErrorRenderer/validationErrorRenderer.interface';\n\n//TODO: move animation to common\n\n/**\n * Default validation errors component, displaying validation errors\n */\n@Component(\n{\n selector: 'default-validation-errors',\n templateUrl: 'defaultValidationErrors.component.html',\n styleUrls: ['defaultValidationErrors.component.css'],\n animations: \n [\n slideInOutTrigger,\n trigger('componentContent',\n [\n transition(':enter, :leave',\n [\n query('@*', animateChild(), {optional: true})\n ])\n ])\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DefaultValidationErrorsComponent implements ValidationErrorsComponent\n{\n //######################### public properties - template bindings #########################\n\n /**\n * Errors to be shown\n * @internal\n */\n public errors: ValidationErrorsResult;\n \n /**\n * Options used for displaying validation errors\n * @internal\n */\n public options: ValidationErrorsOptions;\n\n //######################### public properties - host #########################\n\n /**\n * Enables leave animations for internal stuff\n */\n @HostBinding('@componentContent')\n public animate: boolean = true;\n\n //######################### constructor #########################\n constructor(protected _changeDetector: ChangeDetectorRef)\n {\n }\n\n //######################### public methods - implementation of ValidationErrorsComponent #########################\n\n /**\n * @inheritdoc\n */\n public show(errors: ValidationErrorsResult, options: ValidationErrorsOptions): void\n {\n this.errors = errors;\n this.options = options;\n\n this._changeDetector.detectChanges();\n }\n}","<div [ngClass]=\"options?.wrapperDivClass\" *ngIf=\"errors?.errorMessages?.length\" @slideInOut>\n <div *ngFor=\"let error of errors?.errorMessages\">{{error}}</div>\n</div>"]}
|
|
@@ -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: '', isInline: true, 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', template: '', changeDetection: ChangeDetectionStrategy.OnPush, 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"],"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,2EAJxC,EAAE;2FAIH,yCAAyC;kBAPrD,SAAS;+BAEI,qCAAqC,YACrC,EAAE,mBAEK,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 template: '',\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,4 @@
|
|
|
1
|
+
export * from './defaultValidationErrors/defaultValidationErrors.component';
|
|
2
|
+
export * from './defaultValidationErrorsContainer/defaultValidationErrorsContainer.component';
|
|
3
|
+
export * from './reservedSpaceValidationErrorsContainer/reservedSpaceValidationErrorsContainer.component';
|
|
4
|
+
//# 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;AAC9F,cAAc,2FAA2F,CAAC","sourcesContent":["export * from './defaultValidationErrors/defaultValidationErrors.component';\nexport * from './defaultValidationErrorsContainer/defaultValidationErrorsContainer.component';\nexport * from './reservedSpaceValidationErrorsContainer/reservedSpaceValidationErrorsContainer.component';\n"]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Component, ChangeDetectionStrategy, ViewContainerRef, ViewChild } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
//TODO: optimize duplicit code
|
|
4
|
+
/**
|
|
5
|
+
* Component that serves as container for validation errors, either component or templates with reserved space for errors
|
|
6
|
+
*/
|
|
7
|
+
export class ReservedSpaceValidationErrorsContainerComponent {
|
|
8
|
+
//######################### public methods - implementation of #########################
|
|
9
|
+
/**
|
|
10
|
+
* Shows validation errors
|
|
11
|
+
* @param errors - Errors to be shown
|
|
12
|
+
* @param options - Options used for displaying validation errors
|
|
13
|
+
* @param errorClasses - Array of css error classes
|
|
14
|
+
*/
|
|
15
|
+
show(errors, options) {
|
|
16
|
+
this._errors = errors;
|
|
17
|
+
this._options = options;
|
|
18
|
+
if (options.template) {
|
|
19
|
+
this._renderTemplate();
|
|
20
|
+
}
|
|
21
|
+
else if (options.component) {
|
|
22
|
+
this._renderComponent();
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
throw new Error('Missing template or component for rendering validation errors!');
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Hides validation errors
|
|
30
|
+
*/
|
|
31
|
+
hide() {
|
|
32
|
+
this.viewContainer.clear();
|
|
33
|
+
this._component = null;
|
|
34
|
+
this._template = null;
|
|
35
|
+
}
|
|
36
|
+
//######################### protected methods #########################
|
|
37
|
+
/**
|
|
38
|
+
* Renders validation errors component
|
|
39
|
+
*/
|
|
40
|
+
_renderComponent() {
|
|
41
|
+
if (!this._component) {
|
|
42
|
+
this._component = this.viewContainer.createComponent(this._options.component);
|
|
43
|
+
}
|
|
44
|
+
this._component.instance.show(this._errors, this._options);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Renders validation errors template
|
|
48
|
+
*/
|
|
49
|
+
_renderTemplate() {
|
|
50
|
+
if (!this._template) {
|
|
51
|
+
this._template = this.viewContainer.createEmbeddedView(this._options.template, {
|
|
52
|
+
$implicit: this._errors,
|
|
53
|
+
options: this._options
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
this._template.context =
|
|
58
|
+
{
|
|
59
|
+
$implicit: this._errors,
|
|
60
|
+
options: this._options
|
|
61
|
+
};
|
|
62
|
+
this._template.detectChanges();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
ReservedSpaceValidationErrorsContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: ReservedSpaceValidationErrorsContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
67
|
+
ReservedSpaceValidationErrorsContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.2", type: ReservedSpaceValidationErrorsContainerComponent, selector: "reserved-space-validation-errors-container", viewQueries: [{ propertyName: "viewContainer", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<div>\n <ng-container #container></ng-container>\n</div>", styles: [":host\n{\n display: contents;\n}"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
68
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: ReservedSpaceValidationErrorsContainerComponent, decorators: [{
|
|
69
|
+
type: Component,
|
|
70
|
+
args: [{ selector: 'reserved-space-validation-errors-container', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div>\n <ng-container #container></ng-container>\n</div>", styles: [":host\n{\n display: contents;\n}"] }]
|
|
71
|
+
}], propDecorators: { viewContainer: [{
|
|
72
|
+
type: ViewChild,
|
|
73
|
+
args: ['container', { static: true, read: ViewContainerRef }]
|
|
74
|
+
}] } });
|
|
75
|
+
//# sourceMappingURL=reservedSpaceValidationErrorsContainer.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reservedSpaceValidationErrorsContainer.component.js","sourceRoot":"","sources":["../../../../../forms/src/components/reservedSpaceValidationErrorsContainer/reservedSpaceValidationErrorsContainer.component.ts","../../../../../forms/src/components/reservedSpaceValidationErrorsContainer/reservedSpaceValidationErrorsContainer.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,gBAAgB,EAAiC,SAAS,EAAC,MAAM,eAAe,CAAC;;AAK7H,8BAA8B;AAE9B;;GAEG;AAQH,MAAM,OAAO,+CAA+C;IAkCxD,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,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ourcesContent":["import {Component, ChangeDetectionStrategy, ViewContainerRef, ComponentRef, EmbeddedViewRef, ViewChild} from '@angular/core';\n\nimport {ValidationErrorsResult} from '../../services/errorMessagesExtractor/errorMessagesExtractor.interface';\nimport {ValidationErrorsComponent, ValidationErrorsContainerComponent, ValidationErrorsContainerOptions, ValidationErrorsTemplateContext} from '../../services/validationErrorRenderer/validationErrorRenderer.interface';\n\n//TODO: optimize duplicit code\n\n/**\n * Component that serves as container for validation errors, either component or templates with reserved space for errors\n */\n@Component(\n{\n selector: 'reserved-space-validation-errors-container',\n templateUrl: 'reservedSpaceValidationErrorsContainer.component.html',\n styleUrls: ['reservedSpaceValidationErrorsContainer.component.css'],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class ReservedSpaceValidationErrorsContainerComponent 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 //######################### public properties - children #########################\n\n /**\n * View container for rendering validation errors\n */\n @ViewChild('container', {static: true, read: ViewContainerRef})\n public viewContainer: ViewContainerRef;\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}","<div>\n <ng-container #container></ng-container>\n</div>"]}
|
package/es2015/forms/src/directives/groupHasErrorContainer/groupHasErrorContainer.directive.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Directive } from '@angular/core';
|
|
2
|
+
import { ValidationErrorsContainerView } from '../../misc/validationErrorsContainerView';
|
|
3
|
+
import { GroupHasErrorDirective } from '../groupHasError/groupHasError.directive';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* Directive that is attached to parent element of inputs group and handles css class that is added to this element and registers provider for ValidationErrorsContainerView
|
|
7
|
+
*/
|
|
8
|
+
export class GroupHasErrorContainerDirective extends GroupHasErrorDirective {
|
|
9
|
+
}
|
|
10
|
+
GroupHasErrorContainerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: GroupHasErrorContainerDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
11
|
+
GroupHasErrorContainerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.2", type: GroupHasErrorContainerDirective, selector: "[groupHasErrorContainer]", providers: [
|
|
12
|
+
{
|
|
13
|
+
provide: GroupHasErrorDirective,
|
|
14
|
+
useExisting: GroupHasErrorContainerDirective
|
|
15
|
+
},
|
|
16
|
+
ValidationErrorsContainerView
|
|
17
|
+
], usesInheritance: true, ngImport: i0 });
|
|
18
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: GroupHasErrorContainerDirective, decorators: [{
|
|
19
|
+
type: Directive,
|
|
20
|
+
args: [{
|
|
21
|
+
selector: '[groupHasErrorContainer]',
|
|
22
|
+
providers: [
|
|
23
|
+
{
|
|
24
|
+
provide: GroupHasErrorDirective,
|
|
25
|
+
useExisting: GroupHasErrorContainerDirective
|
|
26
|
+
},
|
|
27
|
+
ValidationErrorsContainerView
|
|
28
|
+
]
|
|
29
|
+
}]
|
|
30
|
+
}] });
|
|
31
|
+
//# sourceMappingURL=groupHasErrorContainer.directive.js.map
|
package/es2015/forms/src/directives/groupHasErrorContainer/groupHasErrorContainer.directive.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"groupHasErrorContainer.directive.js","sourceRoot":"","sources":["../../../../../forms/src/directives/groupHasErrorContainer/groupHasErrorContainer.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAmB,MAAM,eAAe,CAAC;AAE1D,OAAO,EAAC,6BAA6B,EAAC,MAAM,0CAA0C,CAAC;AACvF,OAAO,EAAC,sBAAsB,EAAC,MAAM,0CAA0C,CAAC;;AAEhF;;GAEG;AAcH,MAAM,OAAO,+BAAgC,SAAQ,sBAAsB;;4HAA9D,+BAA+B;gHAA/B,+BAA+B,mDATxC;QAEI;YACI,OAAO,EAAE,sBAAsB;YAC/B,WAAW,EAAE,+BAA+B;SAC/C;QACD,6BAA6B;KAChC;2FAEQ,+BAA+B;kBAb3C,SAAS;mBACV;oBACI,QAAQ,EAAE,0BAA0B;oBACpC,SAAS,EACT;wBAEI;4BACI,OAAO,EAAE,sBAAsB;4BAC/B,WAAW,iCAAiC;yBAC/C;wBACD,6BAA6B;qBAChC;iBACJ","sourcesContent":["import {Directive, ExistingProvider} from '@angular/core';\n\nimport {ValidationErrorsContainerView} from '../../misc/validationErrorsContainerView';\nimport {GroupHasErrorDirective} from '../groupHasError/groupHasError.directive';\n\n/**\n * Directive that is attached to parent element of inputs group and handles css class that is added to this element and registers provider for ValidationErrorsContainerView\n */\n@Directive(\n{\n selector: '[groupHasErrorContainer]',\n providers:\n [\n <ExistingProvider>\n {\n provide: GroupHasErrorDirective,\n useExisting: GroupHasErrorContainerDirective\n },\n ValidationErrorsContainerView\n ]\n})\nexport class GroupHasErrorContainerDirective extends GroupHasErrorDirective\n{\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, Type, TemplateRef } 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 #########################
|
|
@@ -59,15 +63,25 @@ export class HasErrorDirective {
|
|
|
59
63
|
* Initialize component
|
|
60
64
|
*/
|
|
61
65
|
ngOnInit() {
|
|
66
|
+
var _a, _b;
|
|
67
|
+
var _c;
|
|
68
|
+
(_a = this._containerView) !== null && _a !== void 0 ? _a : (this._containerView = new ValidationErrorsContainerView());
|
|
69
|
+
(_b = (_c = this._containerView).viewContainer) !== null && _b !== void 0 ? _b : (_c.viewContainer = this._viewContainer);
|
|
62
70
|
this._registerMutationObserver();
|
|
63
|
-
this.renderer = this._rendererFactory.create(this.control, this._element.nativeElement, this._injector, this._isSubmittedOrDirty, {});
|
|
64
71
|
this._subscriptions.add(this._stringLocalization.textsChange.subscribe(() => this._updateStatus()));
|
|
65
72
|
this._subscriptions.add(this.control.statusChanges.subscribe(() => this._updateStatus()));
|
|
66
|
-
this._updateStatus();
|
|
67
73
|
if (this._submittedSvc) {
|
|
68
74
|
this._subscriptions.add(this._submittedSvc.submittedChange.subscribe(() => this._isSubmittedOrDirty(() => this._updateStatus())));
|
|
69
75
|
}
|
|
70
76
|
}
|
|
77
|
+
//######################### public methods - implementation of AfterViewInit #########################
|
|
78
|
+
/**
|
|
79
|
+
* Called when view was initialized
|
|
80
|
+
*/
|
|
81
|
+
ngAfterViewInit() {
|
|
82
|
+
this.renderer = this._rendererFactory.create(this.control, this._containerView, this._injector, this._isSubmittedOrDirty);
|
|
83
|
+
this._updateStatus();
|
|
84
|
+
}
|
|
71
85
|
//######################### public methods - implementation of OnDestroy #########################
|
|
72
86
|
/**
|
|
73
87
|
* Called when component is destroyed
|
|
@@ -84,8 +98,18 @@ export class HasErrorDirective {
|
|
|
84
98
|
* Updates status of control and css classes
|
|
85
99
|
*/
|
|
86
100
|
_updateStatus() {
|
|
101
|
+
if (!this.renderer) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const opts = {};
|
|
105
|
+
if (this.errorsTemplate) {
|
|
106
|
+
opts.template = this.errorsTemplate;
|
|
107
|
+
}
|
|
108
|
+
else if (this.errorsComponent) {
|
|
109
|
+
opts.component = this.errorsComponent;
|
|
110
|
+
}
|
|
87
111
|
this._previousDirty = this.control.dirty;
|
|
88
|
-
this._hasErrors = this.renderer.update(this.errorMessages);
|
|
112
|
+
this._hasErrors = this.renderer.update(opts, this.errorMessages);
|
|
89
113
|
this._toggleGroupHasError();
|
|
90
114
|
}
|
|
91
115
|
/**
|
|
@@ -129,8 +153,8 @@ export class HasErrorDirective {
|
|
|
129
153
|
});
|
|
130
154
|
}
|
|
131
155
|
}
|
|
132
|
-
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 });
|
|
133
|
-
HasErrorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.2", type: HasErrorDirective, selector: "[hasError]", inputs: { errorMessages: "errorMessages" }, ngImport: i0 });
|
|
156
|
+
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 });
|
|
157
|
+
HasErrorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.2", type: HasErrorDirective, selector: "[hasError]", inputs: { errorMessages: "errorMessages", errorsComponent: "errorsComponent", errorsTemplate: "errorsTemplate" }, ngImport: i0 });
|
|
134
158
|
__decorate([
|
|
135
159
|
BindThis,
|
|
136
160
|
__metadata("design:type", Function),
|
|
@@ -142,7 +166,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
142
166
|
args: [{
|
|
143
167
|
selector: '[hasError]'
|
|
144
168
|
}]
|
|
145
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.ValidationErrorRendererFactory }, { type: i2.GroupHasErrorDirective, decorators: [{
|
|
169
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.ValidationErrorRendererFactory }, { type: i0.ViewContainerRef }, { type: i2.GroupHasErrorDirective, decorators: [{
|
|
146
170
|
type: Optional
|
|
147
171
|
}, {
|
|
148
172
|
type: SkipSelf
|
|
@@ -154,10 +178,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImpor
|
|
|
154
178
|
type: Optional
|
|
155
179
|
}] }, { type: i4.SubmittedService, decorators: [{
|
|
156
180
|
type: Optional
|
|
181
|
+
}] }, { type: i5.ValidationErrorsContainerView, decorators: [{
|
|
182
|
+
type: Optional
|
|
157
183
|
}] }, { type: undefined, decorators: [{
|
|
158
184
|
type: Inject,
|
|
159
185
|
args: [STRING_LOCALIZATION]
|
|
160
186
|
}] }, { type: i0.Injector }]; }, propDecorators: { errorMessages: [{
|
|
161
187
|
type: Input
|
|
188
|
+
}], errorsComponent: [{
|
|
189
|
+
type: Input
|
|
190
|
+
}], errorsTemplate: [{
|
|
191
|
+
type: Input
|
|
162
192
|
}], _isSubmittedOrDirty: [] } });
|
|
163
193
|
//# sourceMappingURL=hasError.directive.js.map
|
|
@@ -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,CAAC;AACpH,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;;;;;;AAEhF,qEAAqE;AAErE;;GAEG;AAKH,MAAM,OAAO,i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BAAmB","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,EAAiB,IAAI,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AACxK,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,6BAA6B,EAAC,MAAM,0CAA0C,CAAC;;;;;;;AAEvF,qEAAqE;AAErE;;GAEG;AAKH,MAAM,OAAO,iBAAiB;IAkE1B,iEAAiE;IACjE,YAAoB,QAAiC,EACjC,gBAAgD,EAChD,cAAgC,EACR,cAAsC,EAClD,YAAkC,EAClC,gBAAiC,EACjC,QAAiB,EACjB,aAA+B,EAC/B,cAA6C,EAC1B,mBAAuC,EACpE,SAAmB;QAVrB,aAAQ,GAAR,QAAQ,CAAyB;QACjC,qBAAgB,GAAhB,gBAAgB,CAAgC;Q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nB,CAAC,CAAC;IACP,CAAC;;8GApNQ,iBAAiB,ubA4EN,mBAAmB;kGA5E9B,iBAAiB;AAmL1B;IADC,QAAQ;;;;4DAcR;2FAhMQ,iBAAiB;kBAJ7B,SAAS;mBACV;oBACI,QAAQ,EAAE,YAAY;iBACzB;;0BAuEgB,QAAQ;;0BAAI,QAAQ;;0BACpB,QAAQ;;0BACR,QAAQ;;0BACR,QAAQ;;0BACR,QAAQ;;0BACR,QAAQ;;0BACR,MAAM;2BAAC,mBAAmB;mEAxBhC,aAAa;sBADnB,KAAK;gBAOC,eAAe;sBADrB,KAAK;gBAOC,cAAc;sBADpB,KAAK;gBAoHE,mBAAmB","sourcesContent":["import {Directive, ElementRef, Optional, SkipSelf, OnInit, OnDestroy, Inject, Input, Injector, ViewContainerRef, AfterViewInit, Type, TemplateRef} 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, ValidationErrorsComponent, ValidationErrorsRendererOptions, ValidationErrorsTemplateContext} 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, AfterViewInit, 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 /**\n * Custom component used for rendering validation errors\n */\n @Input()\n public errorsComponent?: Type<ValidationErrorsComponent>;\n\n /**\n * Custom template used for rendering validation errors\n */\n @Input()\n public errorsTemplate?: TemplateRef<ValidationErrorsTemplateContext>;\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._subscriptions.add(this._stringLocalization.textsChange.subscribe(() => this._updateStatus()));\n this._subscriptions.add(this.control.statusChanges.subscribe(() => 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 AfterViewInit #########################\n \n /**\n * Called when view was initialized\n */\n public ngAfterViewInit(): void\n {\n this.renderer = this._rendererFactory.create(this.control,\n this._containerView,\n this._injector,\n this._isSubmittedOrDirty);\n\n this._updateStatus();\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 if(!this.renderer)\n {\n return;\n }\n\n const opts: ValidationErrorsRendererOptions = {};\n\n if(this.errorsTemplate)\n {\n opts.template = this.errorsTemplate;\n }\n else if(this.errorsComponent)\n {\n opts.component = this.errorsComponent;\n }\n\n this._previousDirty = this.control.dirty;\n this._hasErrors = this.renderer.update(opts, 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}"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../forms/src/directives/index.ts"],"names":[],"mappings":"AAAA,cAAc,2DAA2D,CAAC;AAC1E,cAAc,iEAAiE,CAAC","sourcesContent":["export * from './groupHasErrorContainer/groupHasErrorContainer.directive';\nexport * from './validationErrorsContainer/validationErrorsContainer.directive';\n"]}
|
package/es2015/forms/src/directives/validationErrorsContainer/validationErrorsContainer.directive.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Directive, SkipSelf, ViewContainerRef } from '@angular/core';
|
|
2
|
+
import { ValidationErrorsContainerView } from '../../misc/validationErrorsContainerView';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
import * as i1 from "../../misc/validationErrorsContainerView";
|
|
5
|
+
/**
|
|
6
|
+
* Directive that sets view container for validation errors for current element
|
|
7
|
+
*/
|
|
8
|
+
export class ValidationErrorsContainerDirective {
|
|
9
|
+
//######################### constructor #########################
|
|
10
|
+
constructor(containerView, viewContainer) {
|
|
11
|
+
containerView.viewContainer = viewContainer;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
ValidationErrorsContainerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: ValidationErrorsContainerDirective, deps: [{ token: i1.ValidationErrorsContainerView, skipSelf: true }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
15
|
+
ValidationErrorsContainerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.2", type: ValidationErrorsContainerDirective, selector: "[validationErrorsContainer]", ngImport: i0 });
|
|
16
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: ValidationErrorsContainerDirective, decorators: [{
|
|
17
|
+
type: Directive,
|
|
18
|
+
args: [{
|
|
19
|
+
selector: '[validationErrorsContainer]'
|
|
20
|
+
}]
|
|
21
|
+
}], ctorParameters: function () { return [{ type: i1.ValidationErrorsContainerView, decorators: [{
|
|
22
|
+
type: SkipSelf
|
|
23
|
+
}] }, { type: i0.ViewContainerRef }]; } });
|
|
24
|
+
//# sourceMappingURL=validationErrorsContainer.directive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validationErrorsContainer.directive.js","sourceRoot":"","sources":["../../../../../forms/src/directives/validationErrorsContainer/validationErrorsContainer.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAEpE,OAAO,EAAC,6BAA6B,EAAC,MAAM,0CAA0C,CAAC;;;AAEvF;;GAEG;AAKH,MAAM,OAAO,kCAAkC;IAE3C,iEAAiE;IACjE,YAAwB,aAA4C,EACxD,aAA+B;QAEvC,aAAa,CAAC,aAAa,GAAG,aAAa,CAAC;IAChD,CAAC;;+HAPQ,kCAAkC;mHAAlC,kCAAkC;2FAAlC,kCAAkC;kBAJ9C,SAAS;mBACV;oBACI,QAAQ,EAAE,6BAA6B;iBAC1C;;0BAIgB,QAAQ","sourcesContent":["import {Directive, SkipSelf, ViewContainerRef} from '@angular/core';\n\nimport {ValidationErrorsContainerView} from '../../misc/validationErrorsContainerView';\n\n/**\n * Directive that sets view container for validation errors for current element\n */\n@Directive(\n{\n selector: '[validationErrorsContainer]'\n})\nexport class ValidationErrorsContainerDirective\n{\n //######################### constructor #########################\n constructor(@SkipSelf() containerView: ValidationErrorsContainerView,\n viewContainer: ViewContainerRef,)\n {\n containerView.viewContainer = viewContainer;\n }\n}"]}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export * from './components';
|
|
2
|
+
export * from './directives';
|
|
1
3
|
export * from './directives/numberInput/maxValueNumberValidator.directive';
|
|
2
4
|
export * from './directives/numberInput/minValueNumberValidator.directive';
|
|
3
5
|
export * from './directives/numberInput/numberInputValidator.directive';
|
|
@@ -12,7 +14,8 @@ export * from './services/validationErrorRenderer/validationErrorRenderer.interf
|
|
|
12
14
|
export * from './services/validationErrorRenderer/validationErrorRenderer.service';
|
|
13
15
|
export * from './misc/validators';
|
|
14
16
|
export * from './misc/utils';
|
|
15
|
-
export * from './misc/
|
|
17
|
+
export * from './misc/tokens';
|
|
18
|
+
export * from './misc/validationErrorsContainerView';
|
|
16
19
|
export * from './modules/numberInput.module';
|
|
17
20
|
export * from './modules/hasError.module';
|
|
18
21
|
export * from './modules/requiredClass.module';
|