@rxap/forms 12.6.0 → 12.7.2
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/bundles/rxap-forms.umd.js +101 -9
- package/bundles/rxap-forms.umd.js.map +1 -1
- package/esm2015/index.js +1 -0
- package/esm2015/index.js.map +1 -1
- package/esm2015/lib/directives/form-submit-invalid.directive.js +40 -0
- package/esm2015/lib/directives/form-submit-invalid.directive.js.map +1 -0
- package/esm2015/lib/directives/form-submit-successful.directive.js.map +1 -1
- package/esm2015/lib/directives/form.directive.js +28 -2
- package/esm2015/lib/directives/form.directive.js.map +1 -1
- package/esm2015/lib/directives/forms.module.js +7 -2
- package/esm2015/lib/directives/forms.module.js.map +1 -1
- package/fesm2015/rxap-forms.js +70 -5
- package/fesm2015/rxap-forms.js.map +1 -1
- package/index.d.ts +1 -0
- package/lib/directives/form-submit-invalid.directive.d.ts +16 -0
- package/lib/directives/form-submit-successful.directive.d.ts +1 -1
- package/lib/directives/form.directive.d.ts +2 -2
- package/lib/directives/forms.module.d.ts +2 -1
- package/package.json +1 -1
package/esm2015/index.js
CHANGED
|
@@ -29,6 +29,7 @@ export * from './lib/directives/models';
|
|
|
29
29
|
export * from './lib/directives/tokens';
|
|
30
30
|
export * from './lib/directives/form-control-error.directive';
|
|
31
31
|
export * from './lib/directives/form-submit-successful.directive';
|
|
32
|
+
export * from './lib/directives/form-submit-invalid.directive';
|
|
32
33
|
export * from './lib/directives/form-control-mark-dirty.directive';
|
|
33
34
|
export * from './lib/directives/form-control-mark-pristine.directive';
|
|
34
35
|
export * from './lib/directives/form-control-mark-touched.directive';
|
package/esm2015/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/forms/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,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'./lib/form-builder';\nexport * from './lib/form-control';\nexport * from './lib/form-group';\nexport * from './lib/model';\nexport * from './lib/types';\nexport * from './lib/control-value-accessor';\nexport * from './lib/tokens';\nexport * from './lib/control-actions';\n\n// region decorators\n\nexport * from './lib/decorators/control-async-validator';\nexport * from './lib/decorators/control-change';\nexport * from './lib/decorators/control-set-value';\nexport * from './lib/decorators/control-validator';\nexport * from './lib/decorators/use-form-array';\nexport * from './lib/decorators/use-form-control';\nexport * from './lib/decorators/use-form-group';\nexport * from './lib/decorators/form';\n\n// endregion\n\n// region directives\n\nexport * from './lib/directives/form.directive';\nexport * from './lib/directives/form-submit-failed.directive';\nexport * from './lib/directives/form-loading.directive';\nexport * from './lib/directives/form-submitting.directive';\nexport * from './lib/directives/form-loaded.directive';\nexport * from './lib/directives/form-loading-error.directive';\nexport * from './lib/directives/forms.module';\nexport * from './lib/directives/models';\nexport * from './lib/directives/tokens';\nexport * from './lib/directives/form-control-error.directive';\nexport * from './lib/directives/form-submit-successful.directive';\nexport * from './lib/directives/form-control-mark-dirty.directive';\nexport * from './lib/directives/form-control-mark-pristine.directive';\nexport * from './lib/directives/form-control-mark-touched.directive';\nexport * from './lib/directives/form-control-mark-untouched.directive';\nexport * from './lib/directives/form-submit.directive';\nexport * from './lib/directives/form-control-name.directive';\nexport * from './lib/directives/form-group-name.directive';\nexport * from './lib/directives/parent-control-container.directive';\n\n// endregion\n\n// region validators\n\nexport * from './lib/validators/index';\n\nexport * from './lib/validators/is-array';\nexport * from './lib/validators/is-boolean';\nexport * from './lib/validators/is-date';\nexport * from './lib/validators/is-enum';\nexport * from './lib/validators/is-int';\nexport * from './lib/validators/is-number';\nexport * from './lib/validators/is-object';\nexport * from './lib/validators/is-string';\n\n// endregion\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/forms/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAA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CAAC;AAE3C,YAAY","sourcesContent":["export * from './lib/form-array';\nexport * from './lib/form-builder';\nexport * from './lib/form-control';\nexport * from './lib/form-group';\nexport * from './lib/model';\nexport * from './lib/types';\nexport * from './lib/control-value-accessor';\nexport * from './lib/tokens';\nexport * from './lib/control-actions';\n\n// region decorators\n\nexport * from './lib/decorators/control-async-validator';\nexport * from './lib/decorators/control-change';\nexport * from './lib/decorators/control-set-value';\nexport * from './lib/decorators/control-validator';\nexport * from './lib/decorators/use-form-array';\nexport * from './lib/decorators/use-form-control';\nexport * from './lib/decorators/use-form-group';\nexport * from './lib/decorators/form';\n\n// endregion\n\n// region directives\n\nexport * from './lib/directives/form.directive';\nexport * from './lib/directives/form-submit-failed.directive';\nexport * from './lib/directives/form-loading.directive';\nexport * from './lib/directives/form-submitting.directive';\nexport * from './lib/directives/form-loaded.directive';\nexport * from './lib/directives/form-loading-error.directive';\nexport * from './lib/directives/forms.module';\nexport * from './lib/directives/models';\nexport * from './lib/directives/tokens';\nexport * from './lib/directives/form-control-error.directive';\nexport * from './lib/directives/form-submit-successful.directive';\nexport * from './lib/directives/form-submit-invalid.directive';\nexport * from './lib/directives/form-control-mark-dirty.directive';\nexport * from './lib/directives/form-control-mark-pristine.directive';\nexport * from './lib/directives/form-control-mark-touched.directive';\nexport * from './lib/directives/form-control-mark-untouched.directive';\nexport * from './lib/directives/form-submit.directive';\nexport * from './lib/directives/form-control-name.directive';\nexport * from './lib/directives/form-group-name.directive';\nexport * from './lib/directives/parent-control-container.directive';\n\n// endregion\n\n// region validators\n\nexport * from './lib/validators/index';\n\nexport * from './lib/validators/is-array';\nexport * from './lib/validators/is-boolean';\nexport * from './lib/validators/is-date';\nexport * from './lib/validators/is-enum';\nexport * from './lib/validators/is-int';\nexport * from './lib/validators/is-number';\nexport * from './lib/validators/is-object';\nexport * from './lib/validators/is-string';\n\n// endregion\n"]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Directive, Inject, TemplateRef, ViewContainerRef } from '@angular/core';
|
|
2
|
+
import { FormDirective } from './form.directive';
|
|
3
|
+
import { tap } from 'rxjs/operators';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
import * as i1 from "./form.directive";
|
|
6
|
+
export class FormSubmitInvalidDirective {
|
|
7
|
+
constructor(formDirective, template, viewContainerRef) {
|
|
8
|
+
this.formDirective = formDirective;
|
|
9
|
+
this.template = template;
|
|
10
|
+
this.viewContainerRef = viewContainerRef;
|
|
11
|
+
}
|
|
12
|
+
ngAfterViewInit() {
|
|
13
|
+
this.subscription = this.formDirective.invalidSubmit.pipe(tap(result => {
|
|
14
|
+
this.viewContainerRef.clear();
|
|
15
|
+
this.viewContainerRef.createEmbeddedView(this.template, { $implicit: result });
|
|
16
|
+
})).subscribe();
|
|
17
|
+
}
|
|
18
|
+
ngOnDestroy() {
|
|
19
|
+
var _a;
|
|
20
|
+
(_a = this.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
FormSubmitInvalidDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: FormSubmitInvalidDirective, deps: [{ token: FormDirective }, { token: TemplateRef }, { token: ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
24
|
+
FormSubmitInvalidDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: FormSubmitInvalidDirective, selector: "[rxapFormSubmitInvalid]", ngImport: i0 });
|
|
25
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: FormSubmitInvalidDirective, decorators: [{
|
|
26
|
+
type: Directive,
|
|
27
|
+
args: [{
|
|
28
|
+
selector: '[rxapFormSubmitInvalid]'
|
|
29
|
+
}]
|
|
30
|
+
}], ctorParameters: function () { return [{ type: i1.FormDirective, decorators: [{
|
|
31
|
+
type: Inject,
|
|
32
|
+
args: [FormDirective]
|
|
33
|
+
}] }, { type: i0.TemplateRef, decorators: [{
|
|
34
|
+
type: Inject,
|
|
35
|
+
args: [TemplateRef]
|
|
36
|
+
}] }, { type: i0.ViewContainerRef, decorators: [{
|
|
37
|
+
type: Inject,
|
|
38
|
+
args: [ViewContainerRef]
|
|
39
|
+
}] }]; } });
|
|
40
|
+
//# sourceMappingURL=form-submit-invalid.directive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-submit-invalid.directive.js","sourceRoot":"","sources":["../../../../../../libs/forms/src/lib/directives/form-submit-invalid.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,MAAM,EACN,WAAW,EACX,gBAAgB,EAGjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;;;AAKrC,MAAM,OAAO,0BAA0B;IAIrC,YAC0C,aAA4B,EAC9B,QAAyC,EACpC,gBAAkC;QAFrC,kBAAa,GAAb,aAAa,CAAe;QAC9B,aAAQ,GAAR,QAAQ,CAAiC;QACpC,qBAAgB,GAAhB,gBAAgB,CAAkB;IAC5E,CAAC;IAEG,eAAe;QACpB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,IAAI,CACvD,GAAG,CAAC,MAAM,CAAC,EAAE;YACX,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;YAC9B,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC;QACjF,CAAC,CAAC,CACH,CAAC,SAAS,EAAE,CAAC;IAChB,CAAC;IAEM,WAAW;;QAChB,MAAA,IAAI,CAAC,YAAY,0CAAE,WAAW,EAAE,CAAC;IACnC,CAAC;;uHArBU,0BAA0B,kBAK3B,aAAa,aACb,WAAW,aACX,gBAAgB;2GAPf,0BAA0B;2FAA1B,0BAA0B;kBAHtC,SAAS;mBAAC;oBACT,QAAQ,EAAE,yBAAyB;iBACpC;;0BAMI,MAAM;2BAAC,aAAa;;0BACpB,MAAM;2BAAC,WAAW;;0BAClB,MAAM;2BAAC,gBAAgB","sourcesContent":["import {\n Directive,\n Inject,\n TemplateRef,\n ViewContainerRef,\n OnDestroy,\n AfterViewInit\n} from '@angular/core';\nimport { FormDirective } from './form.directive';\nimport { Subscription } from 'rxjs';\nimport { tap } from 'rxjs/operators';\n\n@Directive({\n selector: '[rxapFormSubmitInvalid]'\n})\nexport class FormSubmitInvalidDirective implements AfterViewInit, OnDestroy {\n\n private subscription?: Subscription;\n\n constructor(\n @Inject(FormDirective) private readonly formDirective: FormDirective,\n @Inject(TemplateRef) private readonly template: TemplateRef<{ $implicit: any }>,\n @Inject(ViewContainerRef) private readonly viewContainerRef: ViewContainerRef\n ) {}\n\n public ngAfterViewInit() {\n this.subscription = this.formDirective.invalidSubmit.pipe(\n tap(result => {\n this.viewContainerRef.clear();\n this.viewContainerRef.createEmbeddedView(this.template, { $implicit: result });\n })\n ).subscribe();\n }\n\n public ngOnDestroy() {\n this.subscription?.unsubscribe();\n }\n\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-submit-successful.directive.js","sourceRoot":"","sources":["../../../../../../libs/forms/src/lib/directives/form-submit-successful.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,MAAM,EACN,WAAW,EACX,gBAAgB,EAGjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;;;AAKrC,MAAM,OAAO,6BAA6B;IAIxC,YAC0C,aAA4B,EAC9B,
|
|
1
|
+
{"version":3,"file":"form-submit-successful.directive.js","sourceRoot":"","sources":["../../../../../../libs/forms/src/lib/directives/form-submit-successful.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,MAAM,EACN,WAAW,EACX,gBAAgB,EAGjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;;;AAKrC,MAAM,OAAO,6BAA6B;IAIxC,YAC0C,aAA4B,EAC9B,QAAyC,EACpC,gBAAkC;QAFrC,kBAAa,GAAb,aAAa,CAAe;QAC9B,aAAQ,GAAR,QAAQ,CAAiC;QACpC,qBAAgB,GAAhB,gBAAgB,CAAkB;IAC5E,CAAC;IAEG,eAAe;QACpB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,aAAa,CAAC,iBAAiB,CAAC,IAAI,CAC3D,GAAG,CAAC,MAAM,CAAC,EAAE;YACX,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;YAC9B,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC;QACjF,CAAC,CAAC,CACH,CAAC,SAAS,EAAE,CAAC;IAChB,CAAC;IAEM,WAAW;;QAChB,MAAA,IAAI,CAAC,YAAY,0CAAE,WAAW,EAAE,CAAC;IACnC,CAAC;;0HArBU,6BAA6B,kBAK9B,aAAa,aACb,WAAW,aACX,gBAAgB;8GAPf,6BAA6B;2FAA7B,6BAA6B;kBAHzC,SAAS;mBAAC;oBACT,QAAQ,EAAE,4BAA4B;iBACvC;;0BAMI,MAAM;2BAAC,aAAa;;0BACpB,MAAM;2BAAC,WAAW;;0BAClB,MAAM;2BAAC,gBAAgB","sourcesContent":["import {\n Directive,\n Inject,\n TemplateRef,\n ViewContainerRef,\n OnDestroy,\n AfterViewInit\n} from '@angular/core';\nimport { FormDirective } from './form.directive';\nimport { Subscription } from 'rxjs';\nimport { tap } from 'rxjs/operators';\n\n@Directive({\n selector: '[rxapFormSubmitSuccessful]'\n})\nexport class FormSubmitSuccessfulDirective implements AfterViewInit, OnDestroy {\n\n private subscription?: Subscription;\n\n constructor(\n @Inject(FormDirective) private readonly formDirective: FormDirective,\n @Inject(TemplateRef) private readonly template: TemplateRef<{ $implicit: any }>,\n @Inject(ViewContainerRef) private readonly viewContainerRef: ViewContainerRef\n ) {}\n\n public ngAfterViewInit() {\n this.subscription = this.formDirective.submitSuccessful$.pipe(\n tap(result => {\n this.viewContainerRef.clear();\n this.viewContainerRef.createEmbeddedView(this.template, { $implicit: result });\n })\n ).subscribe();\n }\n\n public ngOnDestroy() {\n this.subscription?.unsubscribe();\n }\n\n}\n"]}
|
|
@@ -40,7 +40,7 @@ export class FormDirective extends FormGroupDirective {
|
|
|
40
40
|
* Emits when the submit method is executed without errors. The result of the
|
|
41
41
|
* submit method is passed as event object.
|
|
42
42
|
*
|
|
43
|
-
* If no submit method is defined then emit
|
|
43
|
+
* If no submit method is defined then emit after the submit button
|
|
44
44
|
* is clicked.
|
|
45
45
|
*/
|
|
46
46
|
this.rxapSubmit = new EventEmitter();
|
|
@@ -125,6 +125,32 @@ export class FormDirective extends FormGroupDirective {
|
|
|
125
125
|
this.submit();
|
|
126
126
|
}
|
|
127
127
|
else {
|
|
128
|
+
function reduceErrors(control, errors = {}) {
|
|
129
|
+
if (control.invalid) {
|
|
130
|
+
if (control.controls) {
|
|
131
|
+
if (Array.isArray(control.controls)) {
|
|
132
|
+
const errorList = [];
|
|
133
|
+
for (const item of control.controls) {
|
|
134
|
+
errorList.push(reduceErrors(item));
|
|
135
|
+
}
|
|
136
|
+
errors[control.controlId] = errorList;
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
const innerErrors = {};
|
|
140
|
+
for (const child of Object.values(control.controls)) {
|
|
141
|
+
reduceErrors(child, innerErrors);
|
|
142
|
+
}
|
|
143
|
+
errors[control.controlId] = innerErrors;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
if (control.errors) {
|
|
148
|
+
errors[control.controlId] = control.errors;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return errors;
|
|
153
|
+
}
|
|
128
154
|
if (isDevMode()) {
|
|
129
155
|
console.log('Form submit is not valid for: ' + this.form.controlId, this.form.errors);
|
|
130
156
|
function printErrorControls(control) {
|
|
@@ -162,7 +188,7 @@ export class FormDirective extends FormGroupDirective {
|
|
|
162
188
|
}
|
|
163
189
|
printErrorControls(this.form);
|
|
164
190
|
}
|
|
165
|
-
this.invalidSubmit.emit();
|
|
191
|
+
this.invalidSubmit.emit(reduceErrors(this.form));
|
|
166
192
|
}
|
|
167
193
|
return false;
|
|
168
194
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.directive.js","sourceRoot":"","sources":["../../../../../../libs/forms/src/lib/directives/form.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,SAAS,EACT,MAAM,EACN,QAAQ,EACR,UAAU,EAEV,YAAY,EACZ,MAAM,EACN,WAAW,EACX,iBAAiB,EACjB,KAAK,EAGL,SAAS,EACT,QAAQ,EAET,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,4BAA4B,EAC5B,gCAAgC,EAChC,8BAA8B,EAC9B,kCAAkC,EAClC,4BAA4B,EAC7B,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,KAAK,EACN,MAAM,iBAAiB,CAAC;AAUzB,OAAO,EACL,eAAe,EACf,YAAY,EACb,MAAM,MAAM,CAAC;AAEd,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EACL,YAAY,EACZ,GAAG,EACH,MAAM,EACP,MAAM,gBAAgB,CAAC;AACxB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AAC,yBAAyB;gBAM3B,OAAO;sBADjB,WAAW;uBAAC,oBAAoB;gBAMtB,MAAM;sBADhB,WAAW;uBAAC,mBAAmB;gBAMrB,YAAY;sBADtB,WAAW;uBAAC,0BAA0B;gBAM5B,iBAAiB;sBAD3B,KAAK;uBAAC,UAAU;gBAmBP,eAAe,MAGlB,YAAY;sBADlB,KAAK","sourcesContent":["import {\n Directive,\n Inject,\n Optional,\n forwardRef,\n OnInit,\n EventEmitter,\n Output,\n HostBinding,\n ChangeDetectorRef,\n Input,\n OnChanges,\n SimpleChanges,\n isDevMode,\n SkipSelf,\n OnDestroy\n} from '@angular/core';\nimport {\n ControlContainer,\n FormGroupDirective\n} from '@angular/forms';\nimport {\n RXAP_FORM_DEFINITION,\n RXAP_FORM_SUBMIT_METHOD,\n RXAP_FORM_LOAD_METHOD,\n RXAP_FORM_LOAD_FAILED_METHOD,\n RXAP_FORM_LOAD_SUCCESSFUL_METHOD,\n RXAP_FORM_SUBMIT_FAILED_METHOD,\n RXAP_FORM_SUBMIT_SUCCESSFUL_METHOD,\n RXAP_FORM_DEFINITION_BUILDER\n} from './tokens';\nimport { RxapFormGroup } from '../form-group';\nimport {\n isPromise,\n isObject,\n Required,\n clone\n} from '@rxap/utilities';\nimport { FormDefinition } from '../model';\nimport {\n FormSubmitMethod,\n FormLoadMethod,\n FormLoadFailedMethod,\n FormLoadSuccessfulMethod,\n FormSubmitFailedMethod,\n FormSubmitSuccessfulMethod\n} from './models';\nimport {\n BehaviorSubject,\n Subscription\n} from 'rxjs';\nimport { RxapFormBuilder } from '../form-builder';\nimport { LoadingIndicatorService } from '@rxap/services';\nimport {\n debounceTime,\n tap,\n filter\n} from 'rxjs/operators';\nimport { ToggleSubject } from '@rxap/utilities/rxjs';\n\n@Directive({\n selector: 'form[rxapForm]:not([formGroup]):not([ngForm]),rxap-form,form[rxapForm]',\n providers: [\n {\n provide: ControlContainer,\n // ignore coverage\n useExisting: forwardRef(() => FormDirective)\n },\n // region form provider clear\n // form provider that are directly associated with the current form\n // are cleared to prevent that inner forms can access this providers\n // Example: The parent form has a submit method provider and the inner should\n // not have a submit method provider. If the parent submit method provider is\n // not cleared then the inner form uses the parent submit method provider on\n // submit\n {\n provide: RXAP_FORM_SUBMIT_METHOD,\n useValue: null,\n },\n {\n provide: RXAP_FORM_LOAD_METHOD,\n useValue: null,\n },\n {\n provide: RXAP_FORM_LOAD_FAILED_METHOD,\n useValue: null,\n },\n {\n provide: RXAP_FORM_LOAD_SUCCESSFUL_METHOD,\n useValue: null,\n },\n {\n provide: RXAP_FORM_SUBMIT_FAILED_METHOD,\n useValue: null,\n },\n {\n provide: RXAP_FORM_SUBMIT_SUCCESSFUL_METHOD,\n useValue: null,\n },\n {\n provide: RXAP_FORM_DEFINITION_BUILDER,\n useValue: null,\n },\n // endregion\n ],\n host: { '(reset)': 'onReset()' },\n outputs: ['ngSubmit'],\n exportAs: 'rxapForm',\n})\nexport class FormDirective<T extends Record<string, any> = any>\n extends FormGroupDirective\n implements OnInit, OnChanges, OnDestroy\n{\n public form!: RxapFormGroup<T>;\n\n @Input()\n public initial?: T;\n\n /**\n * Emits when the submit method is executed without errors. The result of the\n * submit method is passed as event object.\n *\n * If no submit method is defined then emit infidelity after the submit button\n * is clicked.\n */\n @Output()\n public rxapSubmit = new EventEmitter();\n\n @Output()\n public invalidSubmit = new EventEmitter();\n\n @Output('submitSuccessful')\n public submitSuccessful$ = new EventEmitter();\n\n @HostBinding('class.rxap-submitting')\n public get submitting(): boolean {\n return this.submitting$.value;\n }\n\n @HostBinding('class.rxap-submit-error')\n public get submitError(): Error | null {\n return this.submitError$.value;\n }\n\n @HostBinding('class.rxap-loading')\n public get loading(): boolean {\n return this.loading$.value;\n }\n\n @HostBinding('class.rxap-loaded')\n public get loaded(): boolean {\n return this.loaded$.value;\n }\n\n @HostBinding('class.rxap-loading-error')\n public get loadingError(): Error | null {\n return this.loadingError$.value;\n }\n\n @Input('rxapForm')\n public set useFormDefinition(value: FormDefinition<T> | '') {\n if (value) {\n this._formDefinition = value as any;\n this.form = value.rxapFormGroup;\n }\n }\n\n public get formDefinition(): FormDefinition<T> {\n return this._formDefinition;\n }\n\n public readonly submitting$ = new ToggleSubject();\n public readonly submitError$ = new BehaviorSubject<Error | null>(null);\n public readonly loading$ = new ToggleSubject();\n public readonly loaded$ = new ToggleSubject();\n public readonly loadingError$ = new BehaviorSubject<Error | null>(null);\n\n @Required\n protected _formDefinition!: FormDefinition<T>;\n\n @Input()\n public submitMethod: FormSubmitMethod<any> | null = null;\n\n private _autoSubmitSubscription = new Subscription();\n\n constructor(\n @Inject(ChangeDetectorRef) public readonly cdr: ChangeDetectorRef,\n @Optional()\n @Inject(RXAP_FORM_DEFINITION)\n formDefinition: FormDefinition | null = null,\n // skip self, bc the token is set to null\n @SkipSelf()\n @Optional()\n @Inject(RXAP_FORM_SUBMIT_METHOD)\n submitMethod: FormSubmitMethod<any> | null = null,\n // skip self, bc the token is set to null\n @SkipSelf()\n @Optional()\n @Inject(RXAP_FORM_LOAD_METHOD)\n protected readonly loadMethod: FormLoadMethod | null = null,\n // skip self, bc the token is set to null\n @SkipSelf()\n @Optional()\n @Inject(RXAP_FORM_LOAD_FAILED_METHOD)\n protected readonly loadFailedMethod: FormLoadFailedMethod | null = null,\n // skip self, bc the token is set to null\n @SkipSelf()\n @Optional()\n @Inject(RXAP_FORM_LOAD_SUCCESSFUL_METHOD)\n protected readonly loadSuccessfulMethod: FormLoadSuccessfulMethod | null = null,\n // skip self, bc the token is set to null\n @SkipSelf()\n @Optional()\n @Inject(RXAP_FORM_SUBMIT_FAILED_METHOD)\n protected readonly submitFailedMethod: FormSubmitFailedMethod | null = null,\n // skip self, bc the token is set to null\n @SkipSelf()\n @Optional()\n @Inject(RXAP_FORM_SUBMIT_SUCCESSFUL_METHOD)\n protected readonly submitSuccessfulMethod: FormSubmitSuccessfulMethod | null = null,\n // skip self, bc the token is set to null\n @SkipSelf()\n @Optional()\n @Inject(RXAP_FORM_DEFINITION_BUILDER)\n protected readonly formDefinitionBuilder: RxapFormBuilder | null = null,\n @Optional()\n @Inject(LoadingIndicatorService)\n protected readonly loadingIndicatorService: LoadingIndicatorService | null = null\n ) {\n super([], []);\n if (submitMethod) {\n this.submitMethod = submitMethod;\n }\n if (!formDefinition && formDefinitionBuilder) {\n formDefinition = formDefinitionBuilder.build<FormDefinition>();\n }\n if (formDefinition) {\n this._formDefinition = formDefinition;\n this.form = formDefinition.rxapFormGroup;\n }\n this.loadingIndicatorService?.attachLoading(this.loading$);\n this.loadingIndicatorService?.attachLoading(this.submitting$);\n }\n\n public ngOnChanges(changes: SimpleChanges) {\n super.ngOnChanges(changes);\n\n const formChange = changes.form;\n\n if (formChange && !formChange.firstChange) {\n this.loadInitialState(formChange.currentValue);\n }\n }\n\n public ngOnInit() {\n if (!this.form) {\n // TODO : replace with rxap error\n throw new Error('The form definition instance is not defined');\n }\n this.loadInitialState(this.form);\n\n function HasNgOnInitMethod(obj: any): obj is OnInit {\n return obj && typeof obj.ngOnInit === 'function';\n }\n\n if (HasNgOnInitMethod(this._formDefinition)) {\n this._formDefinition.ngOnInit();\n }\n\n if (this._formDefinition.rxapMetadata.autoSubmit) {\n const debounce =\n typeof this._formDefinition.rxapMetadata.autoSubmit === 'number'\n ? this._formDefinition.rxapMetadata.autoSubmit\n : 5000;\n this._autoSubmitSubscription = this.form.valueChanges\n .pipe(\n debounceTime(debounce),\n filter(() => this.form.valid),\n tap((value) =>\n console.debug(\n `Auto submit form '${this._formDefinition.rxapMetadata.id}'`,\n value\n )\n ),\n tap(() => this.submit())\n )\n .subscribe();\n }\n }\n\n public onSubmit($event: Event): boolean {\n $event.preventDefault();\n super.onSubmit($event);\n if (this.form.valid) {\n this.submit();\n } else {\n if (isDevMode()) {\n console.log(\n 'Form submit is not valid for: ' + this.form.controlId,\n this.form.errors\n );\n\n function printErrorControls(control: any) {\n if (!control.valid) {\n console.group(control.controlId);\n if (control.controls) {\n if (Array.isArray(control.controls)) {\n for (let i = 0; i < control.controls.length; i++) {\n const child = control.controls[i];\n if (!child.valid) {\n console.group(`index: ${i}`);\n printErrorControls(child);\n console.groupEnd();\n }\n }\n } else {\n for (const child of Object.values(control.controls)) {\n printErrorControls(child);\n }\n }\n } else {\n if (control.errors) {\n for (const [key, value] of Object.entries(control.errors)) {\n console.group(key);\n console.log(value);\n console.groupEnd();\n }\n }\n console.log('value: ', control.value);\n }\n console.groupEnd();\n }\n }\n\n printErrorControls(this.form);\n }\n this.invalidSubmit.emit();\n }\n\n return false;\n }\n\n protected loadInitialState(form: RxapFormGroup): void {\n if (this.initial) {\n if (isDevMode()) {\n console.log('use the value from input initial');\n }\n form.patchValue(this.initial);\n } else {\n if (this.loadMethod) {\n this.loading$.enable();\n\n try {\n const resultOrPromise = this.loadMethod.call();\n if (isPromise(resultOrPromise)) {\n resultOrPromise\n .then((value) => {\n form.patchValue(value);\n this.loaded$.enable();\n this.loadSuccessful(value);\n })\n .catch((error) => {\n this.loadingError$.next(error);\n this.loadFailed(error);\n })\n .finally(() => {\n this.loading$.disable();\n this.cdr.detectChanges();\n });\n } else if (isObject(resultOrPromise)) {\n form.patchValue(resultOrPromise);\n this.loaded$.enable();\n this.loadSuccessful(resultOrPromise);\n this.loading$.disable();\n }\n } catch (error) {\n this.loaded$.disable();\n this.loadingError$.next(error);\n this.loadFailed(error);\n this.loading$.disable();\n }\n } else {\n if (isDevMode()) {\n console.warn(\n 'The form loading method is not defined for: ' + this.form.controlId\n );\n }\n this.loaded$.enable();\n }\n }\n }\n\n protected loadSuccessful(value: any) {\n if (this.loadSuccessfulMethod) {\n this.loadSuccessfulMethod.call(value);\n } else if (isDevMode()) {\n console.warn(\n 'The load successful is not defined for: ' + this.form.controlId\n );\n }\n }\n\n protected loadFailed(error: Error) {\n console.debug('Load Error:', error);\n console.error('Load Error:', error.message);\n if (this.loadFailedMethod) {\n this.loadFailedMethod?.call(error);\n } else if (isDevMode()) {\n console.warn('The form loading failed for: ' + this.form.controlId);\n }\n }\n\n protected getSubmitValue(): T {\n let value: T = undefined as any;\n\n if (typeof this._formDefinition[ 'getSubmitValue' ] === 'function') {\n value = this._formDefinition.getSubmitValue();\n } else if (typeof this._formDefinition[ 'toJSON' ] === 'function') {\n value = this._formDefinition.toJSON();\n }\n\n value = value ?? this.form.value;\n\n return clone(value);\n }\n\n protected submit() {\n const value = this.getSubmitValue();\n if (this.submitMethod) {\n Reflect.set(this, 'submitted', false);\n this.submitting$.enable();\n this.submitError$.next(null);\n try {\n const resultOrPromise = this.submitMethod.call(value);\n if (isPromise(resultOrPromise)) {\n resultOrPromise\n .then((result) => {\n Reflect.set(this, 'submitted', true);\n this.rxapSubmit.emit(result);\n this.submitSuccessful(result);\n })\n .catch((error) => {\n this.submitError$.next(error);\n this.submitFailed(error);\n })\n .finally(() => {\n this.submitting$.disable();\n this.cdr.detectChanges();\n });\n } else {\n Reflect.set(this, 'submitted', true);\n this.rxapSubmit.emit(resultOrPromise);\n this.submitSuccessful(resultOrPromise);\n this.submitting$.disable();\n }\n } catch (error) {\n this.submitting$.disable();\n this.submitError$.next(error);\n this.submitFailed(error);\n }\n } else {\n if (isDevMode()) {\n console.warn(\n 'The form submit method is not defined for: ' + this.form.controlId\n );\n }\n\n this.rxapSubmit.emit(value);\n this.submitSuccessful(value);\n }\n }\n\n protected submitFailed(error: Error) {\n console.debug('Submit Error:', error);\n console.error('Submit Error:', error.message);\n if (this.submitFailedMethod) {\n this.submitFailedMethod.call(error);\n } else if (isDevMode()) {\n console.warn(\n 'The form submit failed method is not defined for: ' +\n this.form.controlId\n );\n }\n }\n\n protected submitSuccessful(value: any) {\n this.submitSuccessful$.next(value);\n if (this.submitSuccessfulMethod) {\n this.submitSuccessfulMethod.call(value);\n } else if (isDevMode()) {\n console.warn(\n 'The form submit successful method is not defined for: ' +\n this.form.controlId\n );\n }\n }\n\n public ngOnDestroy() {\n super.ngOnDestroy();\n this._autoSubmitSubscription?.unsubscribe();\n\n function HasNgOnDestroyMethod(obj: any): obj is OnDestroy {\n return obj && typeof obj.ngOnDestroy === 'function';\n }\n\n if (HasNgOnDestroyMethod(this._formDefinition)) {\n this._formDefinition.ngOnDestroy();\n }\n\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"form.directive.js","sourceRoot":"","sources":["../../../../../../libs/forms/src/lib/directives/form.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,SAAS,EACT,MAAM,EACN,QAAQ,EACR,UAAU,EAEV,YAAY,EACZ,MAAM,EACN,WAAW,EACX,iBAAiB,EACjB,KAAK,EAGL,SAAS,EACT,QAAQ,EAET,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,4BAA4B,EAC5B,gCAAgC,EAChC,8BAA8B,EAC9B,kCAAkC,EAClC,4BAA4B,EAC7B,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,KAAK,EACN,MAAM,iBAAiB,CAAC;AAUzB,OAAO,EACL,eAAe,EACf,YAAY,EACb,MAAM,MAAM,CAAC;AAEd,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EACL,YAAY,EACZ,GAAG,EACH,MAAM,EACP,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;;;;AAmDrD,MAAM,OAAO,aACX,SAAQ,kBAAkB;IA2E1B,YAC6C,GAAsB,EAG/D,iBAA6E,IAAI;IACnF,yCAAyC;IAIvC,eAA6E,IAAI;IACnF,yCAAyC;IAItB,aAA4D,IAAI;IACnF,yCAAyC;IAItB,mBAA4D,IAAI;IACnF,yCAAyC;IAItB,uBAA4D,IAAI;IACnF,yCAAyC;IAItB,qBAA4D,IAAI;IACnF,yCAAyC;IAItB,yBAA4D,IAAI;IACnF,yCAAyC;IAItB,wBAA4D,IA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AQ;;0BACR,QAAQ;;0BACR,MAAM;2BAAC,4BAA4B;;0BAGnC,QAAQ;;0BACR,QAAQ;;0BACR,MAAM;2BAAC,gCAAgC;;0BAGvC,QAAQ;;0BACR,QAAQ;;0BACR,MAAM;2BAAC,8BAA8B;;0BAGrC,QAAQ;;0BACR,QAAQ;;0BACR,MAAM;2BAAC,kCAAkC;;0BAGzC,QAAQ;;0BACR,QAAQ;;0BACR,MAAM;2BAAC,4BAA4B;;0BAEnC,QAAQ;;0BACR,MAAM;2BAAC,uBAAuB;4CA9G1B,OAAO;sBADb,KAAK;gBAWC,UAAU;sBADhB,MAAM;gBAIA,aAAa;sBADnB,MAAM;gBAIA,iBAAiB;sBADvB,MAAM;uBAAC,kBAAkB;gBAIf,UAAU;sBADpB,WAAW;uBAAC,uBAAuB;gBAMzB,WAAW;sBADrB,WAAW;uBAAC,yBAAyB;gBAM3B,OAAO;sBADjB,WAAW;uBAAC,oBAAoB;gBAMtB,MAAM;sBADhB,WAAW;uBAAC,mBAAmB;gBAMrB,YAAY;sBADtB,WAAW;uBAAC,0BAA0B;gBAM5B,iBAAiB;sBAD3B,KAAK;uBAAC,UAAU;gBAmBP,eAAe,MAGlB,YAAY;sBADlB,KAAK","sourcesContent":["import {\n Directive,\n Inject,\n Optional,\n forwardRef,\n OnInit,\n EventEmitter,\n Output,\n HostBinding,\n ChangeDetectorRef,\n Input,\n OnChanges,\n SimpleChanges,\n isDevMode,\n SkipSelf,\n OnDestroy\n} from '@angular/core';\nimport {\n ControlContainer,\n FormGroupDirective\n} from '@angular/forms';\nimport {\n RXAP_FORM_DEFINITION,\n RXAP_FORM_SUBMIT_METHOD,\n RXAP_FORM_LOAD_METHOD,\n RXAP_FORM_LOAD_FAILED_METHOD,\n RXAP_FORM_LOAD_SUCCESSFUL_METHOD,\n RXAP_FORM_SUBMIT_FAILED_METHOD,\n RXAP_FORM_SUBMIT_SUCCESSFUL_METHOD,\n RXAP_FORM_DEFINITION_BUILDER\n} from './tokens';\nimport { RxapFormGroup } from '../form-group';\nimport {\n isPromise,\n isObject,\n Required,\n clone\n} from '@rxap/utilities';\nimport { FormDefinition } from '../model';\nimport {\n FormSubmitMethod,\n FormLoadMethod,\n FormLoadFailedMethod,\n FormLoadSuccessfulMethod,\n FormSubmitFailedMethod,\n FormSubmitSuccessfulMethod\n} from './models';\nimport {\n BehaviorSubject,\n Subscription\n} from 'rxjs';\nimport { RxapFormBuilder } from '../form-builder';\nimport { LoadingIndicatorService } from '@rxap/services';\nimport {\n debounceTime,\n tap,\n filter\n} from 'rxjs/operators';\nimport { ToggleSubject } from '@rxap/utilities/rxjs';\n\n@Directive({\n selector: 'form[rxapForm]:not([formGroup]):not([ngForm]),rxap-form,form[rxapForm]',\n providers: [\n {\n provide: ControlContainer,\n // ignore coverage\n useExisting: forwardRef(() => FormDirective)\n },\n // region form provider clear\n // form provider that are directly associated with the current form\n // are cleared to prevent that inner forms can access this providers\n // Example: The parent form has a submit method provider and the inner should\n // not have a submit method provider. If the parent submit method provider is\n // not cleared then the inner form uses the parent submit method provider on\n // submit\n {\n provide: RXAP_FORM_SUBMIT_METHOD,\n useValue: null,\n },\n {\n provide: RXAP_FORM_LOAD_METHOD,\n useValue: null,\n },\n {\n provide: RXAP_FORM_LOAD_FAILED_METHOD,\n useValue: null,\n },\n {\n provide: RXAP_FORM_LOAD_SUCCESSFUL_METHOD,\n useValue: null,\n },\n {\n provide: RXAP_FORM_SUBMIT_FAILED_METHOD,\n useValue: null,\n },\n {\n provide: RXAP_FORM_SUBMIT_SUCCESSFUL_METHOD,\n useValue: null,\n },\n {\n provide: RXAP_FORM_DEFINITION_BUILDER,\n useValue: null,\n },\n // endregion\n ],\n host: { '(reset)': 'onReset()' },\n outputs: ['ngSubmit'],\n exportAs: 'rxapForm',\n})\nexport class FormDirective<T extends Record<string, any> = any>\n extends FormGroupDirective\n implements OnInit, OnChanges, OnDestroy\n{\n public form!: RxapFormGroup<T>;\n\n @Input()\n public initial?: T;\n\n /**\n * Emits when the submit method is executed without errors. The result of the\n * submit method is passed as event object.\n *\n * If no submit method is defined then emit after the submit button\n * is clicked.\n */\n @Output()\n public rxapSubmit = new EventEmitter();\n\n @Output()\n public invalidSubmit = new EventEmitter<Record<string, any>>();\n\n @Output('submitSuccessful')\n public submitSuccessful$ = new EventEmitter();\n\n @HostBinding('class.rxap-submitting')\n public get submitting(): boolean {\n return this.submitting$.value;\n }\n\n @HostBinding('class.rxap-submit-error')\n public get submitError(): Error | null {\n return this.submitError$.value;\n }\n\n @HostBinding('class.rxap-loading')\n public get loading(): boolean {\n return this.loading$.value;\n }\n\n @HostBinding('class.rxap-loaded')\n public get loaded(): boolean {\n return this.loaded$.value;\n }\n\n @HostBinding('class.rxap-loading-error')\n public get loadingError(): Error | null {\n return this.loadingError$.value;\n }\n\n @Input('rxapForm')\n public set useFormDefinition(value: FormDefinition<T> | '') {\n if (value) {\n this._formDefinition = value as any;\n this.form = value.rxapFormGroup;\n }\n }\n\n public get formDefinition(): FormDefinition<T> {\n return this._formDefinition;\n }\n\n public readonly submitting$ = new ToggleSubject();\n public readonly submitError$ = new BehaviorSubject<Error | null>(null);\n public readonly loading$ = new ToggleSubject();\n public readonly loaded$ = new ToggleSubject();\n public readonly loadingError$ = new BehaviorSubject<Error | null>(null);\n\n @Required\n protected _formDefinition!: FormDefinition<T>;\n\n @Input()\n public submitMethod: FormSubmitMethod<any> | null = null;\n\n private _autoSubmitSubscription = new Subscription();\n\n constructor(\n @Inject(ChangeDetectorRef) public readonly cdr: ChangeDetectorRef,\n @Optional()\n @Inject(RXAP_FORM_DEFINITION)\n formDefinition: FormDefinition | null = null,\n // skip self, bc the token is set to null\n @SkipSelf()\n @Optional()\n @Inject(RXAP_FORM_SUBMIT_METHOD)\n submitMethod: FormSubmitMethod<any> | null = null,\n // skip self, bc the token is set to null\n @SkipSelf()\n @Optional()\n @Inject(RXAP_FORM_LOAD_METHOD)\n protected readonly loadMethod: FormLoadMethod | null = null,\n // skip self, bc the token is set to null\n @SkipSelf()\n @Optional()\n @Inject(RXAP_FORM_LOAD_FAILED_METHOD)\n protected readonly loadFailedMethod: FormLoadFailedMethod | null = null,\n // skip self, bc the token is set to null\n @SkipSelf()\n @Optional()\n @Inject(RXAP_FORM_LOAD_SUCCESSFUL_METHOD)\n protected readonly loadSuccessfulMethod: FormLoadSuccessfulMethod | null = null,\n // skip self, bc the token is set to null\n @SkipSelf()\n @Optional()\n @Inject(RXAP_FORM_SUBMIT_FAILED_METHOD)\n protected readonly submitFailedMethod: FormSubmitFailedMethod | null = null,\n // skip self, bc the token is set to null\n @SkipSelf()\n @Optional()\n @Inject(RXAP_FORM_SUBMIT_SUCCESSFUL_METHOD)\n protected readonly submitSuccessfulMethod: FormSubmitSuccessfulMethod | null = null,\n // skip self, bc the token is set to null\n @SkipSelf()\n @Optional()\n @Inject(RXAP_FORM_DEFINITION_BUILDER)\n protected readonly formDefinitionBuilder: RxapFormBuilder | null = null,\n @Optional()\n @Inject(LoadingIndicatorService)\n protected readonly loadingIndicatorService: LoadingIndicatorService | null = null\n ) {\n super([], []);\n if (submitMethod) {\n this.submitMethod = submitMethod;\n }\n if (!formDefinition && formDefinitionBuilder) {\n formDefinition = formDefinitionBuilder.build<FormDefinition>();\n }\n if (formDefinition) {\n this._formDefinition = formDefinition;\n this.form = formDefinition.rxapFormGroup;\n }\n this.loadingIndicatorService?.attachLoading(this.loading$);\n this.loadingIndicatorService?.attachLoading(this.submitting$);\n }\n\n public ngOnChanges(changes: SimpleChanges) {\n super.ngOnChanges(changes);\n\n const formChange = changes.form;\n\n if (formChange && !formChange.firstChange) {\n this.loadInitialState(formChange.currentValue);\n }\n }\n\n public ngOnInit() {\n if (!this.form) {\n // TODO : replace with rxap error\n throw new Error('The form definition instance is not defined');\n }\n this.loadInitialState(this.form);\n\n function HasNgOnInitMethod(obj: any): obj is OnInit {\n return obj && typeof obj.ngOnInit === 'function';\n }\n\n if (HasNgOnInitMethod(this._formDefinition)) {\n this._formDefinition.ngOnInit();\n }\n\n if (this._formDefinition.rxapMetadata.autoSubmit) {\n const debounce =\n typeof this._formDefinition.rxapMetadata.autoSubmit === 'number'\n ? this._formDefinition.rxapMetadata.autoSubmit\n : 5000;\n this._autoSubmitSubscription = this.form.valueChanges\n .pipe(\n debounceTime(debounce),\n filter(() => this.form.valid),\n tap((value) =>\n console.debug(\n `Auto submit form '${this._formDefinition.rxapMetadata.id}'`,\n value\n )\n ),\n tap(() => this.submit())\n )\n .subscribe();\n }\n }\n\n public onSubmit($event: Event): boolean {\n $event.preventDefault();\n super.onSubmit($event);\n if (this.form.valid) {\n this.submit();\n } else {\n\n function reduceErrors(control: any, errors: Record<string, any> = {}): Record<string, any> {\n\n if (control.invalid) {\n if (control.controls) {\n if (Array.isArray(control.controls)) {\n const errorList = [];\n for (const item of control.controls) {\n errorList.push(reduceErrors(item));\n }\n errors[ control.controlId ] = errorList;\n } else {\n const innerErrors = {};\n for (const child of Object.values(control.controls)) {\n reduceErrors(child, innerErrors);\n }\n errors[ control.controlId ] = innerErrors;\n }\n } else {\n if (control.errors) {\n errors[ control.controlId ] = control.errors\n }\n }\n }\n\n return errors;\n }\n\n if (isDevMode()) {\n console.log(\n 'Form submit is not valid for: ' + this.form.controlId,\n this.form.errors\n );\n\n function printErrorControls(control: any) {\n if (!control.valid) {\n console.group(control.controlId);\n if (control.controls) {\n if (Array.isArray(control.controls)) {\n for (let i = 0; i < control.controls.length; i++) {\n const child = control.controls[i];\n if (!child.valid) {\n console.group(`index: ${i}`);\n printErrorControls(child);\n console.groupEnd();\n }\n }\n } else {\n for (const child of Object.values(control.controls)) {\n printErrorControls(child);\n }\n }\n } else {\n if (control.errors) {\n for (const [key, value] of Object.entries(control.errors)) {\n console.group(key);\n console.log(value);\n console.groupEnd();\n }\n }\n console.log('value: ', control.value);\n }\n console.groupEnd();\n }\n }\n\n printErrorControls(this.form);\n }\n this.invalidSubmit.emit(reduceErrors(this.form));\n }\n\n return false;\n }\n\n protected loadInitialState(form: RxapFormGroup): void {\n if (this.initial) {\n if (isDevMode()) {\n console.log('use the value from input initial');\n }\n form.patchValue(this.initial);\n } else {\n if (this.loadMethod) {\n this.loading$.enable();\n\n try {\n const resultOrPromise = this.loadMethod.call();\n if (isPromise(resultOrPromise)) {\n resultOrPromise\n .then((value) => {\n form.patchValue(value);\n this.loaded$.enable();\n this.loadSuccessful(value);\n })\n .catch((error) => {\n this.loadingError$.next(error);\n this.loadFailed(error);\n })\n .finally(() => {\n this.loading$.disable();\n this.cdr.detectChanges();\n });\n } else if (isObject(resultOrPromise)) {\n form.patchValue(resultOrPromise);\n this.loaded$.enable();\n this.loadSuccessful(resultOrPromise);\n this.loading$.disable();\n }\n } catch (error) {\n this.loaded$.disable();\n this.loadingError$.next(error);\n this.loadFailed(error);\n this.loading$.disable();\n }\n } else {\n if (isDevMode()) {\n console.warn(\n 'The form loading method is not defined for: ' + this.form.controlId\n );\n }\n this.loaded$.enable();\n }\n }\n }\n\n protected loadSuccessful(value: any) {\n if (this.loadSuccessfulMethod) {\n this.loadSuccessfulMethod.call(value);\n } else if (isDevMode()) {\n console.warn(\n 'The load successful is not defined for: ' + this.form.controlId\n );\n }\n }\n\n protected loadFailed(error: Error) {\n console.debug('Load Error:', error);\n console.error('Load Error:', error.message);\n if (this.loadFailedMethod) {\n this.loadFailedMethod?.call(error);\n } else if (isDevMode()) {\n console.warn('The form loading failed for: ' + this.form.controlId);\n }\n }\n\n protected getSubmitValue(): T {\n let value: T = undefined as any;\n\n if (typeof this._formDefinition[ 'getSubmitValue' ] === 'function') {\n value = this._formDefinition.getSubmitValue();\n } else if (typeof this._formDefinition[ 'toJSON' ] === 'function') {\n value = this._formDefinition.toJSON();\n }\n\n value = value ?? this.form.value;\n\n return clone(value);\n }\n\n protected submit() {\n const value = this.getSubmitValue();\n if (this.submitMethod) {\n Reflect.set(this, 'submitted', false);\n this.submitting$.enable();\n this.submitError$.next(null);\n try {\n const resultOrPromise = this.submitMethod.call(value);\n if (isPromise(resultOrPromise)) {\n resultOrPromise\n .then((result) => {\n Reflect.set(this, 'submitted', true);\n this.rxapSubmit.emit(result);\n this.submitSuccessful(result);\n })\n .catch((error) => {\n this.submitError$.next(error);\n this.submitFailed(error);\n })\n .finally(() => {\n this.submitting$.disable();\n this.cdr.detectChanges();\n });\n } else {\n Reflect.set(this, 'submitted', true);\n this.rxapSubmit.emit(resultOrPromise);\n this.submitSuccessful(resultOrPromise);\n this.submitting$.disable();\n }\n } catch (error) {\n this.submitting$.disable();\n this.submitError$.next(error);\n this.submitFailed(error);\n }\n } else {\n if (isDevMode()) {\n console.warn(\n 'The form submit method is not defined for: ' + this.form.controlId\n );\n }\n\n this.rxapSubmit.emit(value);\n this.submitSuccessful(value);\n }\n }\n\n protected submitFailed(error: Error) {\n console.debug('Submit Error:', error);\n console.error('Submit Error:', error.message);\n if (this.submitFailedMethod) {\n this.submitFailedMethod.call(error);\n } else if (isDevMode()) {\n console.warn(\n 'The form submit failed method is not defined for: ' +\n this.form.controlId\n );\n }\n }\n\n protected submitSuccessful(value: any) {\n this.submitSuccessful$.next(value);\n if (this.submitSuccessfulMethod) {\n this.submitSuccessfulMethod.call(value);\n } else if (isDevMode()) {\n console.warn(\n 'The form submit successful method is not defined for: ' +\n this.form.controlId\n );\n }\n }\n\n public ngOnDestroy() {\n super.ngOnDestroy();\n this._autoSubmitSubscription?.unsubscribe();\n\n function HasNgOnDestroyMethod(obj: any): obj is OnDestroy {\n return obj && typeof obj.ngOnDestroy === 'function';\n }\n\n if (HasNgOnDestroyMethod(this._formDefinition)) {\n this._formDefinition.ngOnDestroy();\n }\n\n }\n}\n"]}
|
|
@@ -15,6 +15,7 @@ import { FormGroupNameDirective } from './form-group-name.directive';
|
|
|
15
15
|
import { FormControlNameDirective } from './form-control-name.directive';
|
|
16
16
|
import { ParentControlContainerDirective } from './parent-control-container.directive';
|
|
17
17
|
import { FormSubmitSuccessfulDirective } from './form-submit-successful.directive';
|
|
18
|
+
import { FormSubmitInvalidDirective } from './form-submit-invalid.directive';
|
|
18
19
|
import * as i0 from "@angular/core";
|
|
19
20
|
export class RxapFormsModule {
|
|
20
21
|
}
|
|
@@ -34,7 +35,8 @@ RxapFormsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version
|
|
|
34
35
|
FormGroupNameDirective,
|
|
35
36
|
FormControlNameDirective,
|
|
36
37
|
ParentControlContainerDirective,
|
|
37
|
-
FormSubmitSuccessfulDirective
|
|
38
|
+
FormSubmitSuccessfulDirective,
|
|
39
|
+
FormSubmitInvalidDirective], exports: [FormDirective,
|
|
38
40
|
FormSubmitFailedDirective,
|
|
39
41
|
FormLoadingDirective,
|
|
40
42
|
FormSubmittingDirective,
|
|
@@ -49,7 +51,8 @@ RxapFormsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version
|
|
|
49
51
|
FormGroupNameDirective,
|
|
50
52
|
FormControlNameDirective,
|
|
51
53
|
ParentControlContainerDirective,
|
|
52
|
-
FormSubmitSuccessfulDirective
|
|
54
|
+
FormSubmitSuccessfulDirective,
|
|
55
|
+
FormSubmitInvalidDirective] });
|
|
53
56
|
RxapFormsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: RxapFormsModule });
|
|
54
57
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: RxapFormsModule, decorators: [{
|
|
55
58
|
type: NgModule,
|
|
@@ -71,6 +74,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImpor
|
|
|
71
74
|
FormControlNameDirective,
|
|
72
75
|
ParentControlContainerDirective,
|
|
73
76
|
FormSubmitSuccessfulDirective,
|
|
77
|
+
FormSubmitInvalidDirective,
|
|
74
78
|
],
|
|
75
79
|
exports: [
|
|
76
80
|
FormDirective,
|
|
@@ -89,6 +93,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImpor
|
|
|
89
93
|
FormControlNameDirective,
|
|
90
94
|
ParentControlContainerDirective,
|
|
91
95
|
FormSubmitSuccessfulDirective,
|
|
96
|
+
FormSubmitInvalidDirective,
|
|
92
97
|
]
|
|
93
98
|
}]
|
|
94
99
|
}] });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forms.module.js","sourceRoot":"","sources":["../../../../../../libs/forms/src/lib/directives/forms.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,6BAA6B,EAAE,MAAM,qCAAqC,CAAC;AACpF,OAAO,EAAE,+BAA+B,EAAE,MAAM,uCAAuC,CAAC;AACxF,OAAO,EAAE,iCAAiC,EAAE,MAAM,yCAAyC,CAAC;AAC5F,OAAO,EAAE,gCAAgC,EAAE,MAAM,wCAAwC,CAAC;AAC1F,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AACvF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;;
|
|
1
|
+
{"version":3,"file":"forms.module.js","sourceRoot":"","sources":["../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;QACnB,sBAAsB;QACtB,wBAAwB;QACxB,+BAA+B;QAC/B,6BAA6B;QAC7B,0BAA0B,aAG1B,aAAa;QACb,yBAAyB;QACzB,oBAAoB;QACpB,uBAAuB;QACvB,yBAAyB;QACzB,mBAAmB;QACnB,yBAAyB;QACzB,6BAA6B;QAC7B,+BAA+B;QAC/B,iCAAiC;QACjC,gCAAgC;QAChC,mBAAmB;QACnB,sBAAsB;QACtB,wBAAwB;QACxB,+BAA+B;QAC/B,6BAA6B;QAC7B,0BAA0B;6GAGjB,eAAe;2FAAf,eAAe;kBAxC3B,QAAQ;mBAAC;oBACR,YAAY,EAAE;wBACZ,aAAa;wBACb,yBAAyB;wBACzB,oBAAoB;wBACpB,uBAAuB;wBACvB,yBAAyB;wBACzB,mBAAmB;wBACnB,yBAAyB;wBACzB,6BAA6B;wBAC7B,+BAA+B;wBAC/B,iCAAiC;wBACjC,gCAAgC;wBAChC,mBAAmB;wBACnB,sBAAsB;wBACtB,wBAAwB;wBACxB,+BAA+B;wBAC/B,6BAA6B;wBAC7B,0BAA0B;qBAC3B;oBACD,OAAO,EAAO;wBACZ,aAAa;wBACb,yBAAyB;wBACzB,oBAAoB;wBACpB,uBAAuB;wBACvB,yBAAyB;wBACzB,mBAAmB;wBACnB,yBAAyB;wBACzB,6BAA6B;wBAC7B,+BAA+B;wBAC/B,iCAAiC;wBACjC,gCAAgC;wBAChC,mBAAmB;wBACnB,sBAAsB;wBACtB,wBAAwB;wBACxB,+BAA+B;wBAC/B,6BAA6B;wBAC7B,0BAA0B;qBAC3B;iBACF","sourcesContent":["import { NgModule } from '@angular/core';\nimport { FormDirective } from './form.directive';\nimport { FormSubmitFailedDirective } from './form-submit-failed.directive';\nimport { FormLoadingDirective } from './form-loading.directive';\nimport { FormSubmittingDirective } from './form-submitting.directive';\nimport { FormLoadingErrorDirective } from './form-loading-error.directive';\nimport { FormLoadedDirective } from './form-loaded.directive';\nimport { FormControlErrorDirective } from './form-control-error.directive';\nimport { FormControlMarkDirtyDirective } from './form-control-mark-dirty.directive';\nimport { FormControlMarkTouchedDirective } from './form-control-mark-touched.directive';\nimport { FormControlMarkUntouchedDirective } from './form-control-mark-untouched.directive';\nimport { FormControlMarkPristineDirective } from './form-control-mark-pristine.directive';\nimport { FormSubmitDirective } from './form-submit.directive';\nimport { FormGroupNameDirective } from './form-group-name.directive';\nimport { FormControlNameDirective } from './form-control-name.directive';\nimport { ParentControlContainerDirective } from './parent-control-container.directive';\nimport { FormSubmitSuccessfulDirective } from './form-submit-successful.directive';\nimport { FormSubmitInvalidDirective } from './form-submit-invalid.directive';\n\n\n@NgModule({\n declarations: [\n FormDirective,\n FormSubmitFailedDirective,\n FormLoadingDirective,\n FormSubmittingDirective,\n FormLoadingErrorDirective,\n FormLoadedDirective,\n FormControlErrorDirective,\n FormControlMarkDirtyDirective,\n FormControlMarkTouchedDirective,\n FormControlMarkUntouchedDirective,\n FormControlMarkPristineDirective,\n FormSubmitDirective,\n FormGroupNameDirective,\n FormControlNameDirective,\n ParentControlContainerDirective,\n FormSubmitSuccessfulDirective,\n FormSubmitInvalidDirective,\n ],\n exports: [\n FormDirective,\n FormSubmitFailedDirective,\n FormLoadingDirective,\n FormSubmittingDirective,\n FormLoadingErrorDirective,\n FormLoadedDirective,\n FormControlErrorDirective,\n FormControlMarkDirtyDirective,\n FormControlMarkTouchedDirective,\n FormControlMarkUntouchedDirective,\n FormControlMarkPristineDirective,\n FormSubmitDirective,\n FormGroupNameDirective,\n FormControlNameDirective,\n ParentControlContainerDirective,\n FormSubmitSuccessfulDirective,\n FormSubmitInvalidDirective,\n ]\n})\nexport class RxapFormsModule {}\n"]}
|
package/fesm2015/rxap-forms.js
CHANGED
|
@@ -1115,7 +1115,7 @@ class FormDirective extends FormGroupDirective {
|
|
|
1115
1115
|
* Emits when the submit method is executed without errors. The result of the
|
|
1116
1116
|
* submit method is passed as event object.
|
|
1117
1117
|
*
|
|
1118
|
-
* If no submit method is defined then emit
|
|
1118
|
+
* If no submit method is defined then emit after the submit button
|
|
1119
1119
|
* is clicked.
|
|
1120
1120
|
*/
|
|
1121
1121
|
this.rxapSubmit = new EventEmitter();
|
|
@@ -1200,6 +1200,32 @@ class FormDirective extends FormGroupDirective {
|
|
|
1200
1200
|
this.submit();
|
|
1201
1201
|
}
|
|
1202
1202
|
else {
|
|
1203
|
+
function reduceErrors(control, errors = {}) {
|
|
1204
|
+
if (control.invalid) {
|
|
1205
|
+
if (control.controls) {
|
|
1206
|
+
if (Array.isArray(control.controls)) {
|
|
1207
|
+
const errorList = [];
|
|
1208
|
+
for (const item of control.controls) {
|
|
1209
|
+
errorList.push(reduceErrors(item));
|
|
1210
|
+
}
|
|
1211
|
+
errors[control.controlId] = errorList;
|
|
1212
|
+
}
|
|
1213
|
+
else {
|
|
1214
|
+
const innerErrors = {};
|
|
1215
|
+
for (const child of Object.values(control.controls)) {
|
|
1216
|
+
reduceErrors(child, innerErrors);
|
|
1217
|
+
}
|
|
1218
|
+
errors[control.controlId] = innerErrors;
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
else {
|
|
1222
|
+
if (control.errors) {
|
|
1223
|
+
errors[control.controlId] = control.errors;
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
return errors;
|
|
1228
|
+
}
|
|
1203
1229
|
if (isDevMode()) {
|
|
1204
1230
|
console.log('Form submit is not valid for: ' + this.form.controlId, this.form.errors);
|
|
1205
1231
|
function printErrorControls(control) {
|
|
@@ -1237,7 +1263,7 @@ class FormDirective extends FormGroupDirective {
|
|
|
1237
1263
|
}
|
|
1238
1264
|
printErrorControls(this.form);
|
|
1239
1265
|
}
|
|
1240
|
-
this.invalidSubmit.emit();
|
|
1266
|
+
this.invalidSubmit.emit(reduceErrors(this.form));
|
|
1241
1267
|
}
|
|
1242
1268
|
return false;
|
|
1243
1269
|
}
|
|
@@ -2169,6 +2195,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImpor
|
|
|
2169
2195
|
args: [ViewContainerRef]
|
|
2170
2196
|
}] }]; } });
|
|
2171
2197
|
|
|
2198
|
+
class FormSubmitInvalidDirective {
|
|
2199
|
+
constructor(formDirective, template, viewContainerRef) {
|
|
2200
|
+
this.formDirective = formDirective;
|
|
2201
|
+
this.template = template;
|
|
2202
|
+
this.viewContainerRef = viewContainerRef;
|
|
2203
|
+
}
|
|
2204
|
+
ngAfterViewInit() {
|
|
2205
|
+
this.subscription = this.formDirective.invalidSubmit.pipe(tap(result => {
|
|
2206
|
+
this.viewContainerRef.clear();
|
|
2207
|
+
this.viewContainerRef.createEmbeddedView(this.template, { $implicit: result });
|
|
2208
|
+
})).subscribe();
|
|
2209
|
+
}
|
|
2210
|
+
ngOnDestroy() {
|
|
2211
|
+
var _a;
|
|
2212
|
+
(_a = this.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
2213
|
+
}
|
|
2214
|
+
}
|
|
2215
|
+
FormSubmitInvalidDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: FormSubmitInvalidDirective, deps: [{ token: FormDirective }, { token: TemplateRef }, { token: ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2216
|
+
FormSubmitInvalidDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.1", type: FormSubmitInvalidDirective, selector: "[rxapFormSubmitInvalid]", ngImport: i0 });
|
|
2217
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: FormSubmitInvalidDirective, decorators: [{
|
|
2218
|
+
type: Directive,
|
|
2219
|
+
args: [{
|
|
2220
|
+
selector: '[rxapFormSubmitInvalid]'
|
|
2221
|
+
}]
|
|
2222
|
+
}], ctorParameters: function () { return [{ type: FormDirective, decorators: [{
|
|
2223
|
+
type: Inject,
|
|
2224
|
+
args: [FormDirective]
|
|
2225
|
+
}] }, { type: i0.TemplateRef, decorators: [{
|
|
2226
|
+
type: Inject,
|
|
2227
|
+
args: [TemplateRef]
|
|
2228
|
+
}] }, { type: i0.ViewContainerRef, decorators: [{
|
|
2229
|
+
type: Inject,
|
|
2230
|
+
args: [ViewContainerRef]
|
|
2231
|
+
}] }]; } });
|
|
2232
|
+
|
|
2172
2233
|
class RxapFormsModule {
|
|
2173
2234
|
}
|
|
2174
2235
|
RxapFormsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: RxapFormsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
@@ -2187,7 +2248,8 @@ RxapFormsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version
|
|
|
2187
2248
|
FormGroupNameDirective,
|
|
2188
2249
|
FormControlNameDirective,
|
|
2189
2250
|
ParentControlContainerDirective,
|
|
2190
|
-
FormSubmitSuccessfulDirective
|
|
2251
|
+
FormSubmitSuccessfulDirective,
|
|
2252
|
+
FormSubmitInvalidDirective], exports: [FormDirective,
|
|
2191
2253
|
FormSubmitFailedDirective,
|
|
2192
2254
|
FormLoadingDirective,
|
|
2193
2255
|
FormSubmittingDirective,
|
|
@@ -2202,7 +2264,8 @@ RxapFormsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version
|
|
|
2202
2264
|
FormGroupNameDirective,
|
|
2203
2265
|
FormControlNameDirective,
|
|
2204
2266
|
ParentControlContainerDirective,
|
|
2205
|
-
FormSubmitSuccessfulDirective
|
|
2267
|
+
FormSubmitSuccessfulDirective,
|
|
2268
|
+
FormSubmitInvalidDirective] });
|
|
2206
2269
|
RxapFormsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: RxapFormsModule });
|
|
2207
2270
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0, type: RxapFormsModule, decorators: [{
|
|
2208
2271
|
type: NgModule,
|
|
@@ -2224,6 +2287,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImpor
|
|
|
2224
2287
|
FormControlNameDirective,
|
|
2225
2288
|
ParentControlContainerDirective,
|
|
2226
2289
|
FormSubmitSuccessfulDirective,
|
|
2290
|
+
FormSubmitInvalidDirective,
|
|
2227
2291
|
],
|
|
2228
2292
|
exports: [
|
|
2229
2293
|
FormDirective,
|
|
@@ -2242,6 +2306,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImpor
|
|
|
2242
2306
|
FormControlNameDirective,
|
|
2243
2307
|
ParentControlContainerDirective,
|
|
2244
2308
|
FormSubmitSuccessfulDirective,
|
|
2309
|
+
FormSubmitInvalidDirective,
|
|
2245
2310
|
]
|
|
2246
2311
|
}]
|
|
2247
2312
|
}] });
|
|
@@ -2620,5 +2685,5 @@ const RxapValidators = {
|
|
|
2620
2685
|
* Generated bundle index. Do not edit.
|
|
2621
2686
|
*/
|
|
2622
2687
|
|
|
2623
|
-
export { ControlAsyncValidator, ControlChange, ControlSetValue, ControlValidator, ControlValueAccessor, FormArrayControlManager, FormControlErrorDirective, FormControlMarkDirtyDirective, FormControlMarkPristineDirective, FormControlMarkTouchedDirective, FormControlMarkUntouchedDirective, FormControlNameDirective, FormDirective, FormGroupNameDirective, FormLoadedDirective, FormLoadingDirective, FormLoadingErrorDirective, FormSubmitDirective, FormSubmitFailedDirective, FormSubmitSuccessfulDirective, FormSubmittingDirective, IsArray, IsBoolean, IsDate, IsEnum, IsInt, IsNumber, IsObject, IsString, ParentControlContainerDirective, RXAP_FORM_CONTEXT, RXAP_FORM_DEFINITION, RXAP_FORM_DEFINITION_BUILDER, RXAP_FORM_INITIAL_STATE, RXAP_FORM_LOAD_FAILED_METHOD, RXAP_FORM_LOAD_METHOD, RXAP_FORM_LOAD_SUCCESSFUL_METHOD, RXAP_FORM_SUBMIT_FAILED_METHOD, RXAP_FORM_SUBMIT_METHOD, RXAP_FORM_SUBMIT_SUCCESSFUL_METHOD, RxapForm, RxapFormArray, RxapFormBuilder, RxapFormControl, RxapFormGroup, RxapFormsModule, RxapValidators, ToFormMethod, ToFormSubmitMethod, UseFormArrayControl, UseFormArrayGroup, UseFormControl, UseFormGroup, _IsNumber, controlDisabled$, controlDisabledWhile, controlEnabled$, controlEnabledWhile, controlErrorChanges$, controlReadonly$, controlStatusChanges$, controlValueChanges$, disableControl, enableControl, hasErrorAndDirty, hasErrorAndTouched, isNumber, markAllDirty, markAllPristine, markAllUntouched, mergeControlValidators, selectControlValue$, validateControlOn };
|
|
2688
|
+
export { ControlAsyncValidator, ControlChange, ControlSetValue, ControlValidator, ControlValueAccessor, FormArrayControlManager, FormControlErrorDirective, FormControlMarkDirtyDirective, FormControlMarkPristineDirective, FormControlMarkTouchedDirective, FormControlMarkUntouchedDirective, FormControlNameDirective, FormDirective, FormGroupNameDirective, FormLoadedDirective, FormLoadingDirective, FormLoadingErrorDirective, FormSubmitDirective, FormSubmitFailedDirective, FormSubmitInvalidDirective, FormSubmitSuccessfulDirective, FormSubmittingDirective, IsArray, IsBoolean, IsDate, IsEnum, IsInt, IsNumber, IsObject, IsString, ParentControlContainerDirective, RXAP_FORM_CONTEXT, RXAP_FORM_DEFINITION, RXAP_FORM_DEFINITION_BUILDER, RXAP_FORM_INITIAL_STATE, RXAP_FORM_LOAD_FAILED_METHOD, RXAP_FORM_LOAD_METHOD, RXAP_FORM_LOAD_SUCCESSFUL_METHOD, RXAP_FORM_SUBMIT_FAILED_METHOD, RXAP_FORM_SUBMIT_METHOD, RXAP_FORM_SUBMIT_SUCCESSFUL_METHOD, RxapForm, RxapFormArray, RxapFormBuilder, RxapFormControl, RxapFormGroup, RxapFormsModule, RxapValidators, ToFormMethod, ToFormSubmitMethod, UseFormArrayControl, UseFormArrayGroup, UseFormControl, UseFormGroup, _IsNumber, controlDisabled$, controlDisabledWhile, controlEnabled$, controlEnabledWhile, controlErrorChanges$, controlReadonly$, controlStatusChanges$, controlValueChanges$, disableControl, enableControl, hasErrorAndDirty, hasErrorAndTouched, isNumber, markAllDirty, markAllPristine, markAllUntouched, mergeControlValidators, selectControlValue$, validateControlOn };
|
|
2624
2689
|
//# sourceMappingURL=rxap-forms.js.map
|