@rxap/forms 16.0.0-dev.2 → 16.0.0-dev.21
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 +700 -0
- package/LICENSE +621 -24
- package/LICENSE.md +621 -0
- package/README.md +7 -22
- package/esm2022/index.mjs +2 -1
- package/esm2022/lib/control-actions.mjs +7 -7
- package/esm2022/lib/control-value-accessor.mjs +10 -4
- package/esm2022/lib/decorators/control-async-validator.mjs +2 -2
- package/esm2022/lib/decorators/control-change.mjs +2 -2
- package/esm2022/lib/decorators/control-set-value.mjs +3 -3
- package/esm2022/lib/decorators/control-validator.mjs +2 -2
- package/esm2022/lib/decorators/form.mjs +1 -1
- package/esm2022/lib/decorators/metadata-keys.mjs +1 -1
- package/esm2022/lib/decorators/use-form-array.mjs +6 -3
- package/esm2022/lib/decorators/use-form-control.mjs +2 -2
- package/esm2022/lib/decorators/use-form-group.mjs +6 -3
- package/esm2022/lib/directives/form-control-error.directive.mjs +17 -22
- package/esm2022/lib/directives/form-control-mark-dirty.directive.mjs +8 -9
- package/esm2022/lib/directives/form-control-mark-pristine.directive.mjs +8 -9
- package/esm2022/lib/directives/form-control-mark-touched.directive.mjs +7 -8
- package/esm2022/lib/directives/form-control-mark-untouched.directive.mjs +8 -9
- package/esm2022/lib/directives/form-control-name.directive.mjs +12 -13
- package/esm2022/lib/directives/form-group-name.directive.mjs +12 -13
- package/esm2022/lib/directives/form-loaded.directive.mjs +8 -9
- package/esm2022/lib/directives/form-loading-error.directive.mjs +7 -8
- package/esm2022/lib/directives/form-loading.directive.mjs +8 -9
- package/esm2022/lib/directives/form-submit-failed.directive.mjs +7 -8
- package/esm2022/lib/directives/form-submit-invalid.directive.mjs +7 -8
- package/esm2022/lib/directives/form-submit-successful.directive.mjs +7 -8
- package/esm2022/lib/directives/form-submit.directive.mjs +12 -13
- package/esm2022/lib/directives/form-submitting.directive.mjs +8 -9
- package/esm2022/lib/directives/form.directive.mjs +38 -39
- package/esm2022/lib/directives/forms.module.mjs +100 -0
- package/esm2022/lib/directives/models.mjs +1 -1
- package/esm2022/lib/directives/parent-control-container.directive.mjs +11 -11
- package/esm2022/lib/directives/tokens.mjs +1 -1
- package/esm2022/lib/form-array.mjs +12 -7
- package/esm2022/lib/form-builder.mjs +27 -20
- package/esm2022/lib/form-control.mjs +10 -4
- package/esm2022/lib/form-group.mjs +9 -5
- package/esm2022/lib/model.mjs +1 -1
- package/esm2022/lib/tokens.mjs +1 -1
- package/esm2022/lib/types.mjs +1 -1
- package/esm2022/lib/validators/index.mjs +1 -1
- package/esm2022/lib/validators/is-array.mjs +3 -3
- package/esm2022/lib/validators/is-boolean.mjs +3 -3
- package/esm2022/lib/validators/is-complex.mjs +7 -9
- package/esm2022/lib/validators/is-date.mjs +3 -3
- package/esm2022/lib/validators/is-email.mjs +5 -5
- package/esm2022/lib/validators/is-enum.mjs +4 -4
- package/esm2022/lib/validators/is-int.mjs +5 -5
- package/esm2022/lib/validators/is-ip.mjs +4 -4
- package/esm2022/lib/validators/is-number.mjs +10 -5
- package/esm2022/lib/validators/is-object.mjs +7 -4
- package/esm2022/lib/validators/is-phone-number.mjs +5 -5
- package/esm2022/lib/validators/is-port.mjs +3 -3
- package/esm2022/lib/validators/is-string.mjs +3 -3
- package/esm2022/lib/validators/is-url.mjs +5 -5
- package/esm2022/lib/validators/is-uuid.mjs +4 -4
- package/esm2022/rxap-forms.mjs +1 -1
- package/fesm2022/rxap-forms.mjs +457 -337
- package/fesm2022/rxap-forms.mjs.map +1 -1
- package/index.d.ts +1 -0
- package/lib/control-actions.d.ts +1 -1
- package/lib/directives/form-control-error.directive.d.ts +3 -3
- package/lib/directives/form-control-name.directive.d.ts +1 -1
- package/lib/directives/form-group-name.directive.d.ts +1 -1
- package/lib/directives/form-loaded.directive.d.ts +1 -1
- package/lib/directives/form-loading-error.directive.d.ts +1 -1
- package/lib/directives/form-loading.directive.d.ts +1 -1
- package/lib/directives/form-submit-failed.directive.d.ts +1 -1
- package/lib/directives/form-submit-invalid.directive.d.ts +1 -1
- package/lib/directives/form-submit-successful.directive.d.ts +1 -1
- package/lib/directives/form-submit.directive.d.ts +1 -1
- package/lib/directives/form-submitting.directive.d.ts +1 -1
- package/lib/directives/form.directive.d.ts +3 -3
- package/lib/directives/forms.module.d.ts +23 -0
- package/lib/directives/models.d.ts +1 -1
- package/lib/directives/tokens.d.ts +1 -1
- package/lib/form-array.d.ts +2 -2
- package/lib/form-control.d.ts +4 -4
- package/lib/form-group.d.ts +2 -2
- package/lib/model.d.ts +8 -6
- package/lib/validators/is-complex.d.ts +1 -1
- package/lib/validators/is-email.d.ts +1 -1
- package/lib/validators/is-enum.d.ts +1 -1
- package/lib/validators/is-int.d.ts +1 -1
- package/lib/validators/is-ip.d.ts +1 -1
- package/lib/validators/is-number.d.ts +1 -1
- package/lib/validators/is-phone-number.d.ts +2 -2
- package/lib/validators/is-url.d.ts +1 -1
- package/lib/validators/is-uuid.d.ts +1 -1
- package/package.json +78 -51
- package/theme.css +1 -0
- package/collection.json +0 -10
- package/migration.json +0 -10
- package/src/migrations/v12-2-1/index.d.ts +0 -5
- package/src/migrations/v12-2-1/index.js +0 -76
- package/src/migrations/v12-2-1/index.js.map +0 -1
- package/src/schematics/ng-add/index.d.ts +0 -2
- package/src/schematics/ng-add/index.js +0 -8
- package/src/schematics/ng-add/index.js.map +0 -1
- package/src/schematics/ng-add/schema.json +0 -7
package/fesm2022/rxap-forms.mjs
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import * as i1 from '@angular/forms';
|
|
2
|
-
import { UntypedFormArray, AbstractControl, UntypedFormGroup, UntypedFormControl, Validators, FormGroupDirective, ControlContainer,
|
|
2
|
+
import { UntypedFormArray, AbstractControl, UntypedFormGroup, UntypedFormControl, Validators, FormGroupDirective, ControlContainer, FormGroupName, NG_VALIDATORS, NG_ASYNC_VALIDATORS, FormControlName, NG_VALUE_ACCESSOR, NgControl } from '@angular/forms';
|
|
3
3
|
import { map, distinctUntilChanged, debounceTime, filter, tap, startWith, take } from 'rxjs/operators';
|
|
4
4
|
import { merge, defer, of, EMPTY, Subject, isObservable, BehaviorSubject, Subscription } from 'rxjs';
|
|
5
|
-
import { equals, coerceArray, HasRxapOnInitMethod, assertIsArray, assertIsObject, assertIsFunction, isPromise, isObject, clone,
|
|
5
|
+
import { equals, coerceArray, HasRxapOnInitMethod, assertIsArray, assertIsObject, assertIsFunction, isPromise, isObject, clone, hasIndexSignature, coerceBoolean } from '@rxap/utilities';
|
|
6
6
|
import * as i0 from '@angular/core';
|
|
7
|
-
import { isDevMode, Injector, InjectionToken, EventEmitter, ChangeDetectorRef, forwardRef, Directive, Inject, Optional, SkipSelf, Input, Output, HostBinding, TemplateRef, ViewContainerRef, Host, HostListener, Self } from '@angular/core';
|
|
7
|
+
import { isDevMode, Injector, InjectionToken, EventEmitter, ChangeDetectorRef, forwardRef, Directive, Inject, Optional, SkipSelf, Input, Output, HostBinding, TemplateRef, ViewContainerRef, Host, HostListener, Self, NgModule } from '@angular/core';
|
|
8
8
|
import { GetDefinitionMetadata, DefinitionMetadata } from '@rxap/definition';
|
|
9
|
-
import { getMetadata, setMetadataMapSet, setMetadataMap } from '@rxap/
|
|
10
|
-
import { __decorate, __metadata } from 'tslib';
|
|
9
|
+
import { getMetadata, setMetadataMapSet, setMetadataMap } from '@rxap/reflect-metadata';
|
|
11
10
|
import * as i2 from '@rxap/services';
|
|
12
11
|
import { LoadingIndicatorService } from '@rxap/services';
|
|
13
|
-
import { ToggleSubject } from '@rxap/
|
|
12
|
+
import { ToggleSubject } from '@rxap/rxjs';
|
|
14
13
|
import * as i2$1 from '@angular/router';
|
|
15
14
|
import { Router } from '@angular/router';
|
|
16
15
|
import { ConfirmClick } from '@rxap/directives';
|
|
@@ -26,13 +25,13 @@ function controlValueChanges$(control) {
|
|
|
26
25
|
return merge(defer(() => of(getControlValue(control))), control.valueChanges.pipe(map(() => getControlValue(control))));
|
|
27
26
|
}
|
|
28
27
|
function controlDisabled$(control) {
|
|
29
|
-
return merge(defer(() => of(control.disabled)), merge(control.statusChanges, control.stateChanges ?? EMPTY).pipe(map(() => control.disabled), distinctUntilChanged()));
|
|
28
|
+
return merge(defer(() => of(control.disabled)), merge(control.statusChanges, control.stateChanges?.asObservable() ?? EMPTY).pipe(map(() => control.disabled), distinctUntilChanged()));
|
|
30
29
|
}
|
|
31
30
|
function controlEnabled$(control) {
|
|
32
|
-
return merge(defer(() => of(control.enabled)), merge(control.statusChanges, control.stateChanges ?? EMPTY).pipe(map(() => control.enabled), distinctUntilChanged()));
|
|
31
|
+
return merge(defer(() => of(control.enabled)), merge(control.statusChanges, control.stateChanges?.asObservable() ?? EMPTY).pipe(map(() => control.enabled), distinctUntilChanged()));
|
|
33
32
|
}
|
|
34
33
|
function controlReadonly$(control) {
|
|
35
|
-
return merge(defer(() => of(control.readonly ?? false)), merge(control.statusChanges, control.stateChanges ?? EMPTY).pipe(map(() => control.readonly ?? false), distinctUntilChanged()));
|
|
34
|
+
return merge(defer(() => of(control.readonly ?? false)), merge(control.statusChanges, control.stateChanges?.asObservable() ?? EMPTY).pipe(map(() => control.readonly ?? false), distinctUntilChanged()));
|
|
36
35
|
}
|
|
37
36
|
function controlStatusChanges$(control) {
|
|
38
37
|
return merge(defer(() => of(control.status)), control.statusChanges.pipe(map(() => control.status), distinctUntilChanged()));
|
|
@@ -239,8 +238,9 @@ class RxapFormArray extends UntypedFormArray {
|
|
|
239
238
|
// `patchValue` can be called recursively and inner data structures might have these values, so
|
|
240
239
|
// we just ignore such cases when a field containing FormArray instance receives `null` or
|
|
241
240
|
// `undefined` as a value.
|
|
242
|
-
if (value == null /* both `null` and `undefined` */)
|
|
241
|
+
if (value == null /* both `null` and `undefined` */) {
|
|
243
242
|
return;
|
|
243
|
+
}
|
|
244
244
|
if (options?.strict) {
|
|
245
245
|
if (this.length > value.length) {
|
|
246
246
|
for (let index = this.length - 1; index >= value.length; index--) {
|
|
@@ -250,7 +250,11 @@ class RxapFormArray extends UntypedFormArray {
|
|
|
250
250
|
}
|
|
251
251
|
value.forEach((newValue, index) => {
|
|
252
252
|
if (this.at(index)) {
|
|
253
|
-
this.at(index)
|
|
253
|
+
this.at(index)
|
|
254
|
+
.patchValue(newValue, {
|
|
255
|
+
...(options ?? {}),
|
|
256
|
+
onlySelf: true,
|
|
257
|
+
});
|
|
254
258
|
}
|
|
255
259
|
else if (options?.coerce) {
|
|
256
260
|
this.insertAt(index, value[index]);
|
|
@@ -443,13 +447,17 @@ class RxapFormGroup extends UntypedFormGroup {
|
|
|
443
447
|
// `patchValue` can be called recursively and inner data structures might have these values, so
|
|
444
448
|
// we just ignore such cases when a field containing FormGroup instance receives `null` or
|
|
445
449
|
// `undefined` as a value.
|
|
446
|
-
if (value == null /* both `null` and `undefined` */)
|
|
450
|
+
if (value == null /* both `null` and `undefined` */) {
|
|
447
451
|
return;
|
|
452
|
+
}
|
|
448
453
|
Object.keys(value).forEach(name => {
|
|
449
454
|
// TODO : resolve type issue
|
|
450
455
|
const controls = this.controls;
|
|
451
456
|
if (controls[name]) {
|
|
452
|
-
controls[name].patchValue(value[name], {
|
|
457
|
+
controls[name].patchValue(value[name], {
|
|
458
|
+
...(options ?? {}),
|
|
459
|
+
onlySelf: true,
|
|
460
|
+
});
|
|
453
461
|
}
|
|
454
462
|
});
|
|
455
463
|
this.updateValueAndValidity(options);
|
|
@@ -601,6 +609,12 @@ class RxapFormControl extends UntypedFormControl {
|
|
|
601
609
|
this.stateChanges = new Subject();
|
|
602
610
|
this.readonly$ = controlReadonly$(this);
|
|
603
611
|
this.controlId = options.controlId;
|
|
612
|
+
if (options.disabled) {
|
|
613
|
+
this.disable({ emitEvent: false });
|
|
614
|
+
}
|
|
615
|
+
if (options.readonly) {
|
|
616
|
+
this.readonly = true;
|
|
617
|
+
}
|
|
604
618
|
this.initialState = formState;
|
|
605
619
|
}
|
|
606
620
|
setValue(valueOrObservable, options) {
|
|
@@ -708,6 +722,7 @@ class RxapFormControl extends UntypedFormControl {
|
|
|
708
722
|
}
|
|
709
723
|
}
|
|
710
724
|
|
|
725
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
711
726
|
class FormArrayControlManager {
|
|
712
727
|
constructor(form, controlId) {
|
|
713
728
|
this.form = form;
|
|
@@ -748,15 +763,15 @@ class RxapFormBuilder {
|
|
|
748
763
|
// merge the providers from the from options with the providers from the
|
|
749
764
|
// constructor. If the provider is defined in the form options and constructor
|
|
750
765
|
// then the provider from the constructor will be used.
|
|
751
|
-
this.providers = [...providers, ...(formOptions.providers ?? [])].filter((provider, index, self) => provider
|
|
752
|
-
self.findIndex((selfProvider) => selfProvider.
|
|
766
|
+
this.providers = [...providers, ...(formOptions.providers ?? [])].filter((provider, index, self) => provider['provide'] &&
|
|
767
|
+
self.findIndex((selfProvider) => selfProvider.provide &&
|
|
753
768
|
selfProvider.provide === provider.provide) === index);
|
|
754
769
|
}
|
|
755
770
|
build(state = {}, options = {}) {
|
|
756
771
|
const injector = Injector.create({
|
|
757
772
|
name: `rxap/form-builder/${this.formOptions.id}`,
|
|
758
773
|
parent: this.injector,
|
|
759
|
-
providers: this.providers
|
|
774
|
+
providers: this.providers,
|
|
760
775
|
});
|
|
761
776
|
let form;
|
|
762
777
|
// don't use the notFoundValue feature of the injector.
|
|
@@ -766,10 +781,20 @@ class RxapFormBuilder {
|
|
|
766
781
|
form = injector.get(this.definition);
|
|
767
782
|
}
|
|
768
783
|
catch (e) {
|
|
769
|
-
if (
|
|
770
|
-
|
|
784
|
+
if (e.name === 'NullInjectorError') {
|
|
785
|
+
if (e.message.includes(`No provider for ${this.definition.name}`)) {
|
|
786
|
+
if (isDevMode()) {
|
|
787
|
+
console.warn(`Could not inject the definition instance. Fallback and call the constructor of the definition class: ${e.message}`);
|
|
788
|
+
}
|
|
789
|
+
form = new this.definition();
|
|
790
|
+
}
|
|
791
|
+
else {
|
|
792
|
+
throw e;
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
else {
|
|
796
|
+
throw new Error(`Could not inject the definition instance: ${e.message}`);
|
|
771
797
|
}
|
|
772
|
-
form = new this.definition();
|
|
773
798
|
}
|
|
774
799
|
const controls = {};
|
|
775
800
|
this.buildControls(state, form, controls);
|
|
@@ -839,7 +864,7 @@ class RxapFormBuilder {
|
|
|
839
864
|
validators: [],
|
|
840
865
|
asyncValidators: [],
|
|
841
866
|
controlInsertedFn: manager.inserted.bind(manager),
|
|
842
|
-
controlRemovedFn: manager.removed.bind(manager)
|
|
867
|
+
controlRemovedFn: manager.removed.bind(manager),
|
|
843
868
|
}));
|
|
844
869
|
// TODO : add support for injectable validators
|
|
845
870
|
formArray.setValidators(this.coerceToValidatorArray(form, options.validators, this.validators.get(controlId)), false);
|
|
@@ -931,11 +956,7 @@ class RxapFormBuilder {
|
|
|
931
956
|
* @param injectValidators Injected validator functions
|
|
932
957
|
*/
|
|
933
958
|
coerceToValidatorArray(form, optionsValidators, validatorMethodKeys, injectValidators) {
|
|
934
|
-
const validators = optionsValidators
|
|
935
|
-
? Array.isArray(optionsValidators)
|
|
936
|
-
? optionsValidators
|
|
937
|
-
: [optionsValidators]
|
|
938
|
-
: [];
|
|
959
|
+
const validators = (optionsValidators ? Array.isArray(optionsValidators) ? optionsValidators : [optionsValidators] : []).slice();
|
|
939
960
|
if (validatorMethodKeys) {
|
|
940
961
|
validatorMethodKeys.forEach((propertyKey) => {
|
|
941
962
|
assertIsFunction(form[propertyKey]);
|
|
@@ -1063,11 +1084,11 @@ class RxapFormBuilder {
|
|
|
1063
1084
|
}
|
|
1064
1085
|
extractFormOptions() {
|
|
1065
1086
|
const options = GetDefinitionMetadata(this.definition);
|
|
1066
|
-
if (!options || !options
|
|
1087
|
+
if (!options || !options['id']) {
|
|
1067
1088
|
throw new Error('Ensure that the @UseForm decorator is used.');
|
|
1068
1089
|
}
|
|
1069
|
-
if (!options
|
|
1070
|
-
options
|
|
1090
|
+
if (!options['providers']) {
|
|
1091
|
+
options['providers'] = [];
|
|
1071
1092
|
}
|
|
1072
1093
|
return options;
|
|
1073
1094
|
}
|
|
@@ -1075,9 +1096,15 @@ class RxapFormBuilder {
|
|
|
1075
1096
|
|
|
1076
1097
|
class ControlValueAccessor {
|
|
1077
1098
|
constructor() {
|
|
1078
|
-
|
|
1079
|
-
this.
|
|
1080
|
-
|
|
1099
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1100
|
+
this.onChange = (value) => {
|
|
1101
|
+
};
|
|
1102
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1103
|
+
this.onTouched = () => {
|
|
1104
|
+
};
|
|
1105
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1106
|
+
this.setDisabledState = (isDisabled) => {
|
|
1107
|
+
};
|
|
1081
1108
|
}
|
|
1082
1109
|
registerOnChange(fn) {
|
|
1083
1110
|
this.onChange = fn;
|
|
@@ -1110,7 +1137,7 @@ function ControlSetValue(controlId, options = {}) {
|
|
|
1110
1137
|
return function (target, propertyKey) {
|
|
1111
1138
|
setMetadataMapSet(controlId, {
|
|
1112
1139
|
...options,
|
|
1113
|
-
propertyKey
|
|
1140
|
+
propertyKey,
|
|
1114
1141
|
}, MetadataKeys.CONTROL_SET_VALUE, target);
|
|
1115
1142
|
};
|
|
1116
1143
|
}
|
|
@@ -1125,7 +1152,10 @@ function ControlValidator(...controlIds) {
|
|
|
1125
1152
|
|
|
1126
1153
|
function UseFormArrayGroup(definition, options = {}) {
|
|
1127
1154
|
return function (target, propertyKey) {
|
|
1128
|
-
setMetadataMap(propertyKey, {
|
|
1155
|
+
setMetadataMap(propertyKey, {
|
|
1156
|
+
...options,
|
|
1157
|
+
definition,
|
|
1158
|
+
}, MetadataKeys.FORM_ARRAY_GROUPS, target);
|
|
1129
1159
|
};
|
|
1130
1160
|
}
|
|
1131
1161
|
function UseFormArrayControl(options = {}) {
|
|
@@ -1142,7 +1172,10 @@ function UseFormControl(options = {}) {
|
|
|
1142
1172
|
|
|
1143
1173
|
function UseFormGroup(definition, options = {}) {
|
|
1144
1174
|
return function (target, propertyKey) {
|
|
1145
|
-
setMetadataMap(propertyKey, {
|
|
1175
|
+
setMetadataMap(propertyKey, {
|
|
1176
|
+
...options,
|
|
1177
|
+
definition,
|
|
1178
|
+
}, MetadataKeys.FORM_GROUPS, target);
|
|
1146
1179
|
};
|
|
1147
1180
|
}
|
|
1148
1181
|
|
|
@@ -1219,6 +1252,7 @@ class FormDirective extends FormGroupDirective {
|
|
|
1219
1252
|
*/
|
|
1220
1253
|
this.rxapSubmit = new EventEmitter();
|
|
1221
1254
|
this.invalidSubmit = new EventEmitter();
|
|
1255
|
+
// eslint-disable-next-line @angular-eslint/no-output-rename
|
|
1222
1256
|
this.submitSuccessful$ = new EventEmitter();
|
|
1223
1257
|
this.submitting$ = new ToggleSubject();
|
|
1224
1258
|
this.submitError$ = new BehaviorSubject(null);
|
|
@@ -1242,7 +1276,7 @@ class FormDirective extends FormGroupDirective {
|
|
|
1242
1276
|
}
|
|
1243
1277
|
ngOnChanges(changes) {
|
|
1244
1278
|
super.ngOnChanges(changes);
|
|
1245
|
-
const formChange = changes
|
|
1279
|
+
const formChange = changes['form'];
|
|
1246
1280
|
if (formChange && !formChange.firstChange) {
|
|
1247
1281
|
this.loadInitialState(formChange.currentValue);
|
|
1248
1282
|
}
|
|
@@ -1285,6 +1319,7 @@ class FormDirective extends FormGroupDirective {
|
|
|
1285
1319
|
this.submit();
|
|
1286
1320
|
}
|
|
1287
1321
|
else {
|
|
1322
|
+
// eslint-disable-next-line no-inner-declarations
|
|
1288
1323
|
function reduceErrors(control, errors = {}) {
|
|
1289
1324
|
if (control.invalid) {
|
|
1290
1325
|
if (control.controls) {
|
|
@@ -1313,6 +1348,7 @@ class FormDirective extends FormGroupDirective {
|
|
|
1313
1348
|
}
|
|
1314
1349
|
if (isDevMode()) {
|
|
1315
1350
|
console.log('Form submit is not valid for: ' + this.form.controlId, this.form.errors);
|
|
1351
|
+
// eslint-disable-next-line no-inner-declarations
|
|
1316
1352
|
function printErrorControls(control) {
|
|
1317
1353
|
if (!control.valid) {
|
|
1318
1354
|
console.group(control.controlId);
|
|
@@ -1507,12 +1543,12 @@ class FormDirective extends FormGroupDirective {
|
|
|
1507
1543
|
this._formDefinition.ngOnDestroy();
|
|
1508
1544
|
}
|
|
1509
1545
|
}
|
|
1510
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
1511
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.
|
|
1546
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormDirective, deps: [{ token: ChangeDetectorRef }, { token: RXAP_FORM_DEFINITION, optional: true }, { token: RXAP_FORM_SUBMIT_METHOD, optional: true, skipSelf: true }, { token: RXAP_FORM_LOAD_METHOD, optional: true, skipSelf: true }, { token: RXAP_FORM_LOAD_FAILED_METHOD, optional: true, skipSelf: true }, { token: RXAP_FORM_LOAD_SUCCESSFUL_METHOD, optional: true, skipSelf: true }, { token: RXAP_FORM_SUBMIT_FAILED_METHOD, optional: true, skipSelf: true }, { token: RXAP_FORM_SUBMIT_SUCCESSFUL_METHOD, optional: true, skipSelf: true }, { token: RXAP_FORM_DEFINITION_BUILDER, optional: true, skipSelf: true }, { token: LoadingIndicatorService, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1547
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.4", type: FormDirective, isStandalone: true, selector: "form[rxapForm]:not([formGroup]):not([ngForm]),rxap-form,form[rxapForm]", inputs: { initial: "initial", useFormDefinition: ["rxapForm", "useFormDefinition"], submitMethod: "submitMethod" }, outputs: { ngSubmit: "ngSubmit", rxapSubmit: "rxapSubmit", invalidSubmit: "invalidSubmit", submitSuccessful$: "submitSuccessful" }, host: { listeners: { "reset": "onReset()" }, properties: { "class.rxap-submitting": "this.submitting", "class.rxap-submit-error": "this.submitError", "class.rxap-loading": "this.loading", "class.rxap-loaded": "this.loaded", "class.rxap-loading-error": "this.loadingError" } }, providers: [
|
|
1512
1548
|
{
|
|
1513
1549
|
provide: ControlContainer,
|
|
1514
1550
|
// ignore coverage
|
|
1515
|
-
useExisting: forwardRef(() => FormDirective)
|
|
1551
|
+
useExisting: forwardRef(() => FormDirective),
|
|
1516
1552
|
},
|
|
1517
1553
|
// region form provider clear
|
|
1518
1554
|
// form provider that are directly associated with the current form
|
|
@@ -1523,40 +1559,36 @@ class FormDirective extends FormGroupDirective {
|
|
|
1523
1559
|
// submit
|
|
1524
1560
|
{
|
|
1525
1561
|
provide: RXAP_FORM_SUBMIT_METHOD,
|
|
1526
|
-
useValue: null
|
|
1562
|
+
useValue: null,
|
|
1527
1563
|
},
|
|
1528
1564
|
{
|
|
1529
1565
|
provide: RXAP_FORM_LOAD_METHOD,
|
|
1530
|
-
useValue: null
|
|
1566
|
+
useValue: null,
|
|
1531
1567
|
},
|
|
1532
1568
|
{
|
|
1533
1569
|
provide: RXAP_FORM_LOAD_FAILED_METHOD,
|
|
1534
|
-
useValue: null
|
|
1570
|
+
useValue: null,
|
|
1535
1571
|
},
|
|
1536
1572
|
{
|
|
1537
1573
|
provide: RXAP_FORM_LOAD_SUCCESSFUL_METHOD,
|
|
1538
|
-
useValue: null
|
|
1574
|
+
useValue: null,
|
|
1539
1575
|
},
|
|
1540
1576
|
{
|
|
1541
1577
|
provide: RXAP_FORM_SUBMIT_FAILED_METHOD,
|
|
1542
|
-
useValue: null
|
|
1578
|
+
useValue: null,
|
|
1543
1579
|
},
|
|
1544
1580
|
{
|
|
1545
1581
|
provide: RXAP_FORM_SUBMIT_SUCCESSFUL_METHOD,
|
|
1546
|
-
useValue: null
|
|
1582
|
+
useValue: null,
|
|
1547
1583
|
},
|
|
1548
1584
|
{
|
|
1549
1585
|
provide: RXAP_FORM_DEFINITION_BUILDER,
|
|
1550
|
-
useValue: null
|
|
1551
|
-
}
|
|
1586
|
+
useValue: null,
|
|
1587
|
+
},
|
|
1552
1588
|
// endregion
|
|
1553
1589
|
], exportAs: ["rxapForm"], usesInheritance: true, usesOnChanges: true, ngImport: i0 }); }
|
|
1554
1590
|
}
|
|
1555
|
-
|
|
1556
|
-
Required,
|
|
1557
|
-
__metadata("design:type", Object)
|
|
1558
|
-
], FormDirective.prototype, "_formDefinition", void 0);
|
|
1559
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: FormDirective, decorators: [{
|
|
1591
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormDirective, decorators: [{
|
|
1560
1592
|
type: Directive,
|
|
1561
1593
|
args: [{
|
|
1562
1594
|
selector: 'form[rxapForm]:not([formGroup]):not([ngForm]),rxap-form,form[rxapForm]',
|
|
@@ -1564,7 +1596,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
1564
1596
|
{
|
|
1565
1597
|
provide: ControlContainer,
|
|
1566
1598
|
// ignore coverage
|
|
1567
|
-
useExisting: forwardRef(() => FormDirective)
|
|
1599
|
+
useExisting: forwardRef(() => FormDirective),
|
|
1568
1600
|
},
|
|
1569
1601
|
// region form provider clear
|
|
1570
1602
|
// form provider that are directly associated with the current form
|
|
@@ -1575,38 +1607,40 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
1575
1607
|
// submit
|
|
1576
1608
|
{
|
|
1577
1609
|
provide: RXAP_FORM_SUBMIT_METHOD,
|
|
1578
|
-
useValue: null
|
|
1610
|
+
useValue: null,
|
|
1579
1611
|
},
|
|
1580
1612
|
{
|
|
1581
1613
|
provide: RXAP_FORM_LOAD_METHOD,
|
|
1582
|
-
useValue: null
|
|
1614
|
+
useValue: null,
|
|
1583
1615
|
},
|
|
1584
1616
|
{
|
|
1585
1617
|
provide: RXAP_FORM_LOAD_FAILED_METHOD,
|
|
1586
|
-
useValue: null
|
|
1618
|
+
useValue: null,
|
|
1587
1619
|
},
|
|
1588
1620
|
{
|
|
1589
1621
|
provide: RXAP_FORM_LOAD_SUCCESSFUL_METHOD,
|
|
1590
|
-
useValue: null
|
|
1622
|
+
useValue: null,
|
|
1591
1623
|
},
|
|
1592
1624
|
{
|
|
1593
1625
|
provide: RXAP_FORM_SUBMIT_FAILED_METHOD,
|
|
1594
|
-
useValue: null
|
|
1626
|
+
useValue: null,
|
|
1595
1627
|
},
|
|
1596
1628
|
{
|
|
1597
1629
|
provide: RXAP_FORM_SUBMIT_SUCCESSFUL_METHOD,
|
|
1598
|
-
useValue: null
|
|
1630
|
+
useValue: null,
|
|
1599
1631
|
},
|
|
1600
1632
|
{
|
|
1601
1633
|
provide: RXAP_FORM_DEFINITION_BUILDER,
|
|
1602
|
-
useValue: null
|
|
1603
|
-
}
|
|
1634
|
+
useValue: null,
|
|
1635
|
+
},
|
|
1604
1636
|
// endregion
|
|
1605
1637
|
],
|
|
1638
|
+
// eslint-disable-next-line @angular-eslint/no-host-metadata-property
|
|
1606
1639
|
host: { '(reset)': 'onReset()' },
|
|
1640
|
+
// eslint-disable-next-line @angular-eslint/no-outputs-metadata-property
|
|
1607
1641
|
outputs: ['ngSubmit'],
|
|
1608
1642
|
exportAs: 'rxapForm',
|
|
1609
|
-
standalone: true
|
|
1643
|
+
standalone: true,
|
|
1610
1644
|
}]
|
|
1611
1645
|
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef, decorators: [{
|
|
1612
1646
|
type: Inject,
|
|
@@ -1697,7 +1731,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
1697
1731
|
}], useFormDefinition: [{
|
|
1698
1732
|
type: Input,
|
|
1699
1733
|
args: ['rxapForm']
|
|
1700
|
-
}],
|
|
1734
|
+
}], submitMethod: [{
|
|
1701
1735
|
type: Input
|
|
1702
1736
|
}] } });
|
|
1703
1737
|
|
|
@@ -1718,14 +1752,14 @@ class FormSubmitFailedDirective {
|
|
|
1718
1752
|
ngOnDestroy() {
|
|
1719
1753
|
this.subscription?.unsubscribe();
|
|
1720
1754
|
}
|
|
1721
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
1722
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.
|
|
1755
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormSubmitFailedDirective, deps: [{ token: FormDirective }, { token: TemplateRef }, { token: ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1756
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.4", type: FormSubmitFailedDirective, isStandalone: true, selector: "[rxapFormSubmitFailed]", ngImport: i0 }); }
|
|
1723
1757
|
}
|
|
1724
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
1758
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormSubmitFailedDirective, decorators: [{
|
|
1725
1759
|
type: Directive,
|
|
1726
1760
|
args: [{
|
|
1727
1761
|
selector: '[rxapFormSubmitFailed]',
|
|
1728
|
-
standalone: true
|
|
1762
|
+
standalone: true,
|
|
1729
1763
|
}]
|
|
1730
1764
|
}], ctorParameters: function () { return [{ type: FormDirective, decorators: [{
|
|
1731
1765
|
type: Inject,
|
|
@@ -1755,14 +1789,14 @@ class FormLoadingDirective {
|
|
|
1755
1789
|
ngOnDestroy() {
|
|
1756
1790
|
this.subscription?.unsubscribe();
|
|
1757
1791
|
}
|
|
1758
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
1759
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.
|
|
1792
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormLoadingDirective, deps: [{ token: FormDirective }, { token: TemplateRef }, { token: ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1793
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.4", type: FormLoadingDirective, isStandalone: true, selector: "[rxapFormLoading]", ngImport: i0 }); }
|
|
1760
1794
|
}
|
|
1761
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
1795
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormLoadingDirective, decorators: [{
|
|
1762
1796
|
type: Directive,
|
|
1763
1797
|
args: [{
|
|
1764
1798
|
selector: '[rxapFormLoading]',
|
|
1765
|
-
standalone: true
|
|
1799
|
+
standalone: true,
|
|
1766
1800
|
}]
|
|
1767
1801
|
}], ctorParameters: function () { return [{ type: FormDirective, decorators: [{
|
|
1768
1802
|
type: Inject,
|
|
@@ -1792,14 +1826,14 @@ class FormSubmittingDirective {
|
|
|
1792
1826
|
ngOnDestroy() {
|
|
1793
1827
|
this.subscription?.unsubscribe();
|
|
1794
1828
|
}
|
|
1795
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
1796
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.
|
|
1829
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormSubmittingDirective, deps: [{ token: FormDirective }, { token: TemplateRef }, { token: ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1830
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.4", type: FormSubmittingDirective, isStandalone: true, selector: "[rxapFormSubmitting]", ngImport: i0 }); }
|
|
1797
1831
|
}
|
|
1798
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
1832
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormSubmittingDirective, decorators: [{
|
|
1799
1833
|
type: Directive,
|
|
1800
1834
|
args: [{
|
|
1801
1835
|
selector: '[rxapFormSubmitting]',
|
|
1802
|
-
standalone: true
|
|
1836
|
+
standalone: true,
|
|
1803
1837
|
}]
|
|
1804
1838
|
}], ctorParameters: function () { return [{ type: FormDirective, decorators: [{
|
|
1805
1839
|
type: Inject,
|
|
@@ -1812,31 +1846,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
1812
1846
|
args: [ViewContainerRef]
|
|
1813
1847
|
}] }]; } });
|
|
1814
1848
|
|
|
1815
|
-
class
|
|
1849
|
+
class FormLoadingErrorDirective {
|
|
1816
1850
|
constructor(formDirective, template, viewContainerRef) {
|
|
1817
1851
|
this.formDirective = formDirective;
|
|
1818
1852
|
this.template = template;
|
|
1819
1853
|
this.viewContainerRef = viewContainerRef;
|
|
1820
1854
|
}
|
|
1821
1855
|
ngAfterViewInit() {
|
|
1822
|
-
this.subscription = this.formDirective.
|
|
1856
|
+
this.subscription = this.formDirective.loadingError$.pipe(tap(error => {
|
|
1823
1857
|
this.viewContainerRef.clear();
|
|
1824
|
-
if (
|
|
1825
|
-
this.viewContainerRef.createEmbeddedView(this.template);
|
|
1858
|
+
if (error !== null) {
|
|
1859
|
+
this.viewContainerRef.createEmbeddedView(this.template, { $implicit: error });
|
|
1826
1860
|
}
|
|
1827
1861
|
})).subscribe();
|
|
1828
1862
|
}
|
|
1829
1863
|
ngOnDestroy() {
|
|
1830
1864
|
this.subscription?.unsubscribe();
|
|
1831
1865
|
}
|
|
1832
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
1833
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.
|
|
1866
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormLoadingErrorDirective, deps: [{ token: FormDirective }, { token: TemplateRef }, { token: ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1867
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.4", type: FormLoadingErrorDirective, isStandalone: true, selector: "[rxapFormLoadingError]", ngImport: i0 }); }
|
|
1834
1868
|
}
|
|
1835
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
1869
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormLoadingErrorDirective, decorators: [{
|
|
1836
1870
|
type: Directive,
|
|
1837
1871
|
args: [{
|
|
1838
|
-
selector: '[
|
|
1839
|
-
standalone: true
|
|
1872
|
+
selector: '[rxapFormLoadingError]',
|
|
1873
|
+
standalone: true,
|
|
1840
1874
|
}]
|
|
1841
1875
|
}], ctorParameters: function () { return [{ type: FormDirective, decorators: [{
|
|
1842
1876
|
type: Inject,
|
|
@@ -1849,31 +1883,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
1849
1883
|
args: [ViewContainerRef]
|
|
1850
1884
|
}] }]; } });
|
|
1851
1885
|
|
|
1852
|
-
class
|
|
1886
|
+
class FormLoadedDirective {
|
|
1853
1887
|
constructor(formDirective, template, viewContainerRef) {
|
|
1854
1888
|
this.formDirective = formDirective;
|
|
1855
1889
|
this.template = template;
|
|
1856
1890
|
this.viewContainerRef = viewContainerRef;
|
|
1857
1891
|
}
|
|
1858
1892
|
ngAfterViewInit() {
|
|
1859
|
-
this.subscription = this.formDirective.
|
|
1893
|
+
this.subscription = this.formDirective.loaded$.pipe(distinctUntilChanged(), tap(loading => {
|
|
1860
1894
|
this.viewContainerRef.clear();
|
|
1861
|
-
if (
|
|
1862
|
-
this.viewContainerRef.createEmbeddedView(this.template
|
|
1895
|
+
if (loading) {
|
|
1896
|
+
this.viewContainerRef.createEmbeddedView(this.template);
|
|
1863
1897
|
}
|
|
1864
1898
|
})).subscribe();
|
|
1865
1899
|
}
|
|
1866
1900
|
ngOnDestroy() {
|
|
1867
1901
|
this.subscription?.unsubscribe();
|
|
1868
1902
|
}
|
|
1869
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
1870
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.
|
|
1903
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormLoadedDirective, deps: [{ token: FormDirective }, { token: TemplateRef }, { token: ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1904
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.4", type: FormLoadedDirective, isStandalone: true, selector: "[rxapFormLoaded]", ngImport: i0 }); }
|
|
1871
1905
|
}
|
|
1872
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
1906
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormLoadedDirective, decorators: [{
|
|
1873
1907
|
type: Directive,
|
|
1874
1908
|
args: [{
|
|
1875
|
-
selector: '[
|
|
1876
|
-
standalone: true
|
|
1909
|
+
selector: '[rxapFormLoaded]',
|
|
1910
|
+
standalone: true,
|
|
1877
1911
|
}]
|
|
1878
1912
|
}], ctorParameters: function () { return [{ type: FormDirective, decorators: [{
|
|
1879
1913
|
type: Inject,
|
|
@@ -1886,20 +1920,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
1886
1920
|
args: [ViewContainerRef]
|
|
1887
1921
|
}] }]; } });
|
|
1888
1922
|
|
|
1889
|
-
function ToFormMethod(call) {
|
|
1890
|
-
return { call };
|
|
1891
|
-
}
|
|
1892
1923
|
/**
|
|
1893
|
-
* @deprecated use
|
|
1894
|
-
*
|
|
1895
|
-
* @param call the call method implementation
|
|
1896
|
-
*/
|
|
1897
|
-
function ToFormSubmitMethod(call) {
|
|
1898
|
-
return ToFormMethod(call);
|
|
1899
|
-
}
|
|
1900
|
-
|
|
1901
|
-
/**
|
|
1902
|
-
* @deprecated removed
|
|
1924
|
+
* @deprecated removed use the rxapControlError or rxapControlErrors directive
|
|
1903
1925
|
*/
|
|
1904
1926
|
class FormControlErrorDirective {
|
|
1905
1927
|
constructor(template, parent, viewContainerRef) {
|
|
@@ -1922,22 +1944,14 @@ class FormControlErrorDirective {
|
|
|
1922
1944
|
ngOnDestroy() {
|
|
1923
1945
|
this.subscription?.unsubscribe();
|
|
1924
1946
|
}
|
|
1925
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
1926
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.
|
|
1927
|
-
}
|
|
1928
|
-
|
|
1929
|
-
Required,
|
|
1930
|
-
__metadata("design:type", String)
|
|
1931
|
-
], FormControlErrorDirective.prototype, "name", void 0);
|
|
1932
|
-
__decorate([
|
|
1933
|
-
Required,
|
|
1934
|
-
__metadata("design:type", String)
|
|
1935
|
-
], FormControlErrorDirective.prototype, "errorKey", void 0);
|
|
1936
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: FormControlErrorDirective, decorators: [{
|
|
1947
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormControlErrorDirective, deps: [{ token: i0.TemplateRef }, { token: i1.ControlContainer, host: true, skipSelf: true }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1948
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.4", type: FormControlErrorDirective, isStandalone: true, selector: "[rxapFormControlError]", inputs: { name: ["rxapFormControlErrorFrom", "name"], errorKey: ["rxapFormControlErrorIf", "errorKey"] }, ngImport: i0 }); }
|
|
1949
|
+
}
|
|
1950
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormControlErrorDirective, decorators: [{
|
|
1937
1951
|
type: Directive,
|
|
1938
1952
|
args: [{
|
|
1939
1953
|
selector: '[rxapFormControlError]',
|
|
1940
|
-
standalone: true
|
|
1954
|
+
standalone: true,
|
|
1941
1955
|
}]
|
|
1942
1956
|
}], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i1.ControlContainer, decorators: [{
|
|
1943
1957
|
type: Host
|
|
@@ -1945,82 +1959,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
1945
1959
|
type: SkipSelf
|
|
1946
1960
|
}] }, { type: i0.ViewContainerRef }]; }, propDecorators: { name: [{
|
|
1947
1961
|
type: Input,
|
|
1948
|
-
args: [
|
|
1962
|
+
args: [{
|
|
1963
|
+
required: true,
|
|
1964
|
+
alias: 'rxapFormControlErrorFrom',
|
|
1965
|
+
}]
|
|
1949
1966
|
}], errorKey: [{
|
|
1950
1967
|
type: Input,
|
|
1951
|
-
args: [
|
|
1968
|
+
args: [{
|
|
1969
|
+
required: true,
|
|
1970
|
+
alias: 'rxapFormControlErrorIf',
|
|
1971
|
+
}]
|
|
1952
1972
|
}] } });
|
|
1953
1973
|
|
|
1954
|
-
class FormSubmitSuccessfulDirective {
|
|
1955
|
-
constructor(formDirective, template, viewContainerRef) {
|
|
1956
|
-
this.formDirective = formDirective;
|
|
1957
|
-
this.template = template;
|
|
1958
|
-
this.viewContainerRef = viewContainerRef;
|
|
1959
|
-
}
|
|
1960
|
-
ngAfterViewInit() {
|
|
1961
|
-
this.subscription = this.formDirective.submitSuccessful$.pipe(tap(result => {
|
|
1962
|
-
this.viewContainerRef.clear();
|
|
1963
|
-
this.viewContainerRef.createEmbeddedView(this.template, { $implicit: result });
|
|
1964
|
-
})).subscribe();
|
|
1965
|
-
}
|
|
1966
|
-
ngOnDestroy() {
|
|
1967
|
-
this.subscription?.unsubscribe();
|
|
1968
|
-
}
|
|
1969
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: FormSubmitSuccessfulDirective, deps: [{ token: FormDirective }, { token: TemplateRef }, { token: ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1970
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.2", type: FormSubmitSuccessfulDirective, isStandalone: true, selector: "[rxapFormSubmitSuccessful]", ngImport: i0 }); }
|
|
1971
|
-
}
|
|
1972
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: FormSubmitSuccessfulDirective, decorators: [{
|
|
1973
|
-
type: Directive,
|
|
1974
|
-
args: [{
|
|
1975
|
-
selector: '[rxapFormSubmitSuccessful]',
|
|
1976
|
-
standalone: true
|
|
1977
|
-
}]
|
|
1978
|
-
}], ctorParameters: function () { return [{ type: FormDirective, decorators: [{
|
|
1979
|
-
type: Inject,
|
|
1980
|
-
args: [FormDirective]
|
|
1981
|
-
}] }, { type: i0.TemplateRef, decorators: [{
|
|
1982
|
-
type: Inject,
|
|
1983
|
-
args: [TemplateRef]
|
|
1984
|
-
}] }, { type: i0.ViewContainerRef, decorators: [{
|
|
1985
|
-
type: Inject,
|
|
1986
|
-
args: [ViewContainerRef]
|
|
1987
|
-
}] }]; } });
|
|
1988
|
-
|
|
1989
|
-
class FormSubmitInvalidDirective {
|
|
1990
|
-
constructor(formDirective, template, viewContainerRef) {
|
|
1991
|
-
this.formDirective = formDirective;
|
|
1992
|
-
this.template = template;
|
|
1993
|
-
this.viewContainerRef = viewContainerRef;
|
|
1994
|
-
}
|
|
1995
|
-
ngAfterViewInit() {
|
|
1996
|
-
this.subscription = this.formDirective.invalidSubmit.pipe(tap(result => {
|
|
1997
|
-
this.viewContainerRef.clear();
|
|
1998
|
-
this.viewContainerRef.createEmbeddedView(this.template, { $implicit: result });
|
|
1999
|
-
})).subscribe();
|
|
2000
|
-
}
|
|
2001
|
-
ngOnDestroy() {
|
|
2002
|
-
this.subscription?.unsubscribe();
|
|
2003
|
-
}
|
|
2004
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: FormSubmitInvalidDirective, deps: [{ token: FormDirective }, { token: TemplateRef }, { token: ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2005
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.2", type: FormSubmitInvalidDirective, isStandalone: true, selector: "[rxapFormSubmitInvalid]", ngImport: i0 }); }
|
|
2006
|
-
}
|
|
2007
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: FormSubmitInvalidDirective, decorators: [{
|
|
2008
|
-
type: Directive,
|
|
2009
|
-
args: [{
|
|
2010
|
-
selector: '[rxapFormSubmitInvalid]',
|
|
2011
|
-
standalone: true
|
|
2012
|
-
}]
|
|
2013
|
-
}], ctorParameters: function () { return [{ type: FormDirective, decorators: [{
|
|
2014
|
-
type: Inject,
|
|
2015
|
-
args: [FormDirective]
|
|
2016
|
-
}] }, { type: i0.TemplateRef, decorators: [{
|
|
2017
|
-
type: Inject,
|
|
2018
|
-
args: [TemplateRef]
|
|
2019
|
-
}] }, { type: i0.ViewContainerRef, decorators: [{
|
|
2020
|
-
type: Inject,
|
|
2021
|
-
args: [ViewContainerRef]
|
|
2022
|
-
}] }]; } });
|
|
2023
|
-
|
|
2024
1974
|
class FormControlMarkDirtyDirective {
|
|
2025
1975
|
constructor(parent) {
|
|
2026
1976
|
this.parent = parent;
|
|
@@ -2028,95 +1978,95 @@ class FormControlMarkDirtyDirective {
|
|
|
2028
1978
|
onClick() {
|
|
2029
1979
|
const control = this.parent.control;
|
|
2030
1980
|
if (control && hasIndexSignature(control) && typeof control['markAllAsDirty'] === 'function') {
|
|
2031
|
-
control
|
|
1981
|
+
control['markAllAsDirty']();
|
|
2032
1982
|
}
|
|
2033
1983
|
else {
|
|
2034
1984
|
control?.markAsDirty();
|
|
2035
1985
|
}
|
|
2036
1986
|
}
|
|
2037
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
2038
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.
|
|
1987
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormControlMarkDirtyDirective, deps: [{ token: i1.ControlContainer }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1988
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.4", type: FormControlMarkDirtyDirective, isStandalone: true, selector: "[rxapFormControlMarkDirty]", host: { listeners: { "click": "onClick()" } }, ngImport: i0 }); }
|
|
2039
1989
|
}
|
|
2040
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
1990
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormControlMarkDirtyDirective, decorators: [{
|
|
2041
1991
|
type: Directive,
|
|
2042
1992
|
args: [{
|
|
2043
1993
|
selector: '[rxapFormControlMarkDirty]',
|
|
2044
|
-
standalone: true
|
|
1994
|
+
standalone: true,
|
|
2045
1995
|
}]
|
|
2046
1996
|
}], ctorParameters: function () { return [{ type: i1.ControlContainer }]; }, propDecorators: { onClick: [{
|
|
2047
1997
|
type: HostListener,
|
|
2048
1998
|
args: ['click']
|
|
2049
1999
|
}] } });
|
|
2050
2000
|
|
|
2051
|
-
class
|
|
2001
|
+
class FormControlMarkTouchedDirective {
|
|
2052
2002
|
constructor(parent) {
|
|
2053
2003
|
this.parent = parent;
|
|
2054
2004
|
}
|
|
2055
2005
|
onClick() {
|
|
2056
|
-
|
|
2057
|
-
if (control && hasIndexSignature(control) && typeof control['markAllAsPristine'] === 'function') {
|
|
2058
|
-
control.markAllAsPristine();
|
|
2059
|
-
}
|
|
2060
|
-
else {
|
|
2061
|
-
control?.markAsPristine();
|
|
2062
|
-
}
|
|
2006
|
+
this.parent.control?.markAllAsTouched();
|
|
2063
2007
|
}
|
|
2064
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
2065
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.
|
|
2008
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormControlMarkTouchedDirective, deps: [{ token: i1.ControlContainer }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2009
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.4", type: FormControlMarkTouchedDirective, isStandalone: true, selector: "[rxapFormControlMarkTouched]", host: { listeners: { "click": "onClick()" } }, ngImport: i0 }); }
|
|
2066
2010
|
}
|
|
2067
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
2011
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormControlMarkTouchedDirective, decorators: [{
|
|
2068
2012
|
type: Directive,
|
|
2069
2013
|
args: [{
|
|
2070
|
-
selector: '[
|
|
2071
|
-
standalone: true
|
|
2014
|
+
selector: '[rxapFormControlMarkTouched]',
|
|
2015
|
+
standalone: true,
|
|
2072
2016
|
}]
|
|
2073
2017
|
}], ctorParameters: function () { return [{ type: i1.ControlContainer }]; }, propDecorators: { onClick: [{
|
|
2074
2018
|
type: HostListener,
|
|
2075
2019
|
args: ['click']
|
|
2076
2020
|
}] } });
|
|
2077
2021
|
|
|
2078
|
-
class
|
|
2022
|
+
class FormControlMarkUntouchedDirective {
|
|
2079
2023
|
constructor(parent) {
|
|
2080
2024
|
this.parent = parent;
|
|
2081
2025
|
}
|
|
2082
2026
|
onClick() {
|
|
2083
|
-
this.parent.control
|
|
2027
|
+
const control = this.parent.control;
|
|
2028
|
+
if (control && hasIndexSignature(control) && typeof control['markAllAsUntouched'] === 'function') {
|
|
2029
|
+
control['markAllAsUntouched']();
|
|
2030
|
+
}
|
|
2031
|
+
else {
|
|
2032
|
+
control?.markAsUntouched();
|
|
2033
|
+
}
|
|
2084
2034
|
}
|
|
2085
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
2086
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.
|
|
2035
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormControlMarkUntouchedDirective, deps: [{ token: i1.ControlContainer }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2036
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.4", type: FormControlMarkUntouchedDirective, isStandalone: true, selector: "[rxapFormControlMarkUntouched]", host: { listeners: { "click": "onClick()" } }, ngImport: i0 }); }
|
|
2087
2037
|
}
|
|
2088
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
2038
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormControlMarkUntouchedDirective, decorators: [{
|
|
2089
2039
|
type: Directive,
|
|
2090
2040
|
args: [{
|
|
2091
|
-
selector: '[
|
|
2092
|
-
standalone: true
|
|
2041
|
+
selector: '[rxapFormControlMarkUntouched]',
|
|
2042
|
+
standalone: true,
|
|
2093
2043
|
}]
|
|
2094
2044
|
}], ctorParameters: function () { return [{ type: i1.ControlContainer }]; }, propDecorators: { onClick: [{
|
|
2095
2045
|
type: HostListener,
|
|
2096
2046
|
args: ['click']
|
|
2097
2047
|
}] } });
|
|
2098
2048
|
|
|
2099
|
-
class
|
|
2049
|
+
class FormControlMarkPristineDirective {
|
|
2100
2050
|
constructor(parent) {
|
|
2101
2051
|
this.parent = parent;
|
|
2102
2052
|
}
|
|
2103
2053
|
onClick() {
|
|
2104
2054
|
const control = this.parent.control;
|
|
2105
|
-
if (control && hasIndexSignature(control) && typeof control['
|
|
2106
|
-
control
|
|
2055
|
+
if (control && hasIndexSignature(control) && typeof control['markAllAsPristine'] === 'function') {
|
|
2056
|
+
control['markAllAsPristine']();
|
|
2107
2057
|
}
|
|
2108
2058
|
else {
|
|
2109
|
-
control?.
|
|
2059
|
+
control?.markAsPristine();
|
|
2110
2060
|
}
|
|
2111
2061
|
}
|
|
2112
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
2113
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.
|
|
2062
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormControlMarkPristineDirective, deps: [{ token: i1.ControlContainer }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2063
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.4", type: FormControlMarkPristineDirective, isStandalone: true, selector: "[rxapFormControlMarkPristine]", host: { listeners: { "click": "onClick()" } }, ngImport: i0 }); }
|
|
2114
2064
|
}
|
|
2115
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
2065
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormControlMarkPristineDirective, decorators: [{
|
|
2116
2066
|
type: Directive,
|
|
2117
2067
|
args: [{
|
|
2118
|
-
selector: '[
|
|
2119
|
-
standalone: true
|
|
2068
|
+
selector: '[rxapFormControlMarkPristine]',
|
|
2069
|
+
standalone: true,
|
|
2120
2070
|
}]
|
|
2121
2071
|
}], ctorParameters: function () { return [{ type: i1.ControlContainer }]; }, propDecorators: { onClick: [{
|
|
2122
2072
|
type: HostListener,
|
|
@@ -2158,18 +2108,19 @@ class FormSubmitDirective extends ConfirmClick {
|
|
|
2158
2108
|
ngOnDestroy() {
|
|
2159
2109
|
this.subscription?.unsubscribe();
|
|
2160
2110
|
}
|
|
2161
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
2162
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.
|
|
2111
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormSubmitDirective, deps: [{ token: FormDirective }, { token: Router, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2112
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.4", type: FormSubmitDirective, isStandalone: true, selector: "[rxapFormSubmit]", inputs: { type: "type", resetAfterSubmit: "resetAfterSubmit", navigateAfterSubmit: "navigateAfterSubmit" }, outputs: { afterSubmit: "afterSubmit" }, host: { listeners: { "click": "onClick()", "confirmed": "onConfirm()" }, properties: { "type": "this.type" } }, usesInheritance: true, ngImport: i0 }); }
|
|
2163
2113
|
}
|
|
2164
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
2114
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormSubmitDirective, decorators: [{
|
|
2165
2115
|
type: Directive,
|
|
2166
2116
|
args: [{
|
|
2167
2117
|
selector: '[rxapFormSubmit]',
|
|
2118
|
+
// eslint-disable-next-line @angular-eslint/no-host-metadata-property
|
|
2168
2119
|
host: {
|
|
2169
2120
|
'(click)': 'onClick()',
|
|
2170
|
-
'(confirmed)': 'onConfirm()'
|
|
2121
|
+
'(confirmed)': 'onConfirm()',
|
|
2171
2122
|
},
|
|
2172
|
-
standalone: true
|
|
2123
|
+
standalone: true,
|
|
2173
2124
|
}]
|
|
2174
2125
|
}], ctorParameters: function () { return [{ type: FormDirective, decorators: [{
|
|
2175
2126
|
type: Inject,
|
|
@@ -2185,8 +2136,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
2185
2136
|
}, {
|
|
2186
2137
|
type: Input
|
|
2187
2138
|
}], resetAfterSubmit: [{
|
|
2188
|
-
type: Input
|
|
2189
|
-
args: ['resetAfterSubmit']
|
|
2139
|
+
type: Input
|
|
2190
2140
|
}], navigateAfterSubmit: [{
|
|
2191
2141
|
type: Input
|
|
2192
2142
|
}], afterSubmit: [{
|
|
@@ -2194,147 +2144,311 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
2194
2144
|
}] } });
|
|
2195
2145
|
|
|
2196
2146
|
/**
|
|
2197
|
-
* A full exertion of
|
|
2147
|
+
* A full exertion of FormGroupName from @angular/forms. The only change is the
|
|
2198
2148
|
* ability to access the control container outside of the current component
|
|
2199
2149
|
*
|
|
2200
2150
|
* @deprecated use the ParentControlContainerDirective
|
|
2201
2151
|
*/
|
|
2202
|
-
class
|
|
2203
|
-
|
|
2204
|
-
|
|
2152
|
+
class FormGroupNameDirective extends FormGroupName {
|
|
2153
|
+
get control() {
|
|
2154
|
+
// TODO : add type check
|
|
2155
|
+
return this.formDirective.getFormGroup(this);
|
|
2156
|
+
}
|
|
2157
|
+
constructor(parent, validators, asyncValidators) {
|
|
2158
|
+
super(parent, validators, asyncValidators);
|
|
2205
2159
|
}
|
|
2206
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
2207
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.
|
|
2160
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormGroupNameDirective, deps: [{ token: i1.ControlContainer, optional: true, skipSelf: true }, { token: NG_VALIDATORS, optional: true, self: true }, { token: NG_ASYNC_VALIDATORS, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2161
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.4", type: FormGroupNameDirective, isStandalone: true, selector: "[rxapFormGroupName]", inputs: { name: ["rxapFormGroupName", "name"] }, providers: [
|
|
2208
2162
|
{
|
|
2209
|
-
provide:
|
|
2210
|
-
useExisting: forwardRef(() =>
|
|
2211
|
-
}
|
|
2212
|
-
], exportAs: ["
|
|
2163
|
+
provide: ControlContainer,
|
|
2164
|
+
useExisting: forwardRef(() => FormGroupNameDirective),
|
|
2165
|
+
},
|
|
2166
|
+
], exportAs: ["rxapFormGroup"], usesInheritance: true, ngImport: i0 }); }
|
|
2213
2167
|
}
|
|
2214
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
2168
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormGroupNameDirective, decorators: [{
|
|
2215
2169
|
type: Directive,
|
|
2216
2170
|
args: [{
|
|
2217
|
-
selector: '[
|
|
2171
|
+
selector: '[rxapFormGroupName]',
|
|
2218
2172
|
providers: [
|
|
2219
2173
|
{
|
|
2220
|
-
provide:
|
|
2221
|
-
useExisting: forwardRef(() =>
|
|
2222
|
-
}
|
|
2174
|
+
provide: ControlContainer,
|
|
2175
|
+
useExisting: forwardRef(() => FormGroupNameDirective),
|
|
2176
|
+
},
|
|
2223
2177
|
],
|
|
2224
|
-
exportAs: '
|
|
2225
|
-
standalone: true
|
|
2178
|
+
exportAs: 'rxapFormGroup',
|
|
2179
|
+
standalone: true,
|
|
2226
2180
|
}]
|
|
2227
2181
|
}], ctorParameters: function () { return [{ type: i1.ControlContainer, decorators: [{
|
|
2228
2182
|
type: Optional
|
|
2229
2183
|
}, {
|
|
2230
2184
|
type: SkipSelf
|
|
2231
|
-
}] }, { type:
|
|
2185
|
+
}] }, { type: undefined, decorators: [{
|
|
2232
2186
|
type: Optional
|
|
2233
2187
|
}, {
|
|
2234
2188
|
type: Self
|
|
2235
2189
|
}, {
|
|
2236
2190
|
type: Inject,
|
|
2237
2191
|
args: [NG_VALIDATORS]
|
|
2238
|
-
}] }, { type: Array, decorators: [{
|
|
2239
|
-
type: Optional
|
|
2240
|
-
}, {
|
|
2241
|
-
type: Self
|
|
2242
|
-
}, {
|
|
2243
|
-
type: Inject,
|
|
2244
|
-
args: [NG_ASYNC_VALIDATORS]
|
|
2245
2192
|
}] }, { type: undefined, decorators: [{
|
|
2246
2193
|
type: Optional
|
|
2247
2194
|
}, {
|
|
2248
2195
|
type: Self
|
|
2249
2196
|
}, {
|
|
2250
2197
|
type: Inject,
|
|
2251
|
-
args: [
|
|
2198
|
+
args: [NG_ASYNC_VALIDATORS]
|
|
2252
2199
|
}] }]; }, propDecorators: { name: [{
|
|
2253
2200
|
type: Input,
|
|
2254
|
-
args: ['
|
|
2201
|
+
args: ['rxapFormGroupName']
|
|
2255
2202
|
}] } });
|
|
2256
2203
|
|
|
2257
2204
|
/**
|
|
2258
|
-
* A full exertion of
|
|
2205
|
+
* A full exertion of FormControlName from @angular/forms. The only change is the
|
|
2259
2206
|
* ability to access the control container outside of the current component
|
|
2260
2207
|
*
|
|
2261
2208
|
* @deprecated use the ParentControlContainerDirective
|
|
2262
2209
|
*/
|
|
2263
|
-
class
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
return this.formDirective.getFormGroup(this);
|
|
2267
|
-
}
|
|
2268
|
-
constructor(parent, validators, asyncValidators) {
|
|
2269
|
-
super(parent, validators, asyncValidators);
|
|
2210
|
+
class FormControlNameDirective extends FormControlName {
|
|
2211
|
+
constructor(parent, validators, asyncValidators, valueAccessors) {
|
|
2212
|
+
super(parent, validators, asyncValidators, valueAccessors, null);
|
|
2270
2213
|
}
|
|
2271
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
2272
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.
|
|
2214
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormControlNameDirective, deps: [{ token: i1.ControlContainer, optional: true, skipSelf: true }, { token: NG_VALIDATORS, optional: true, self: true }, { token: NG_ASYNC_VALIDATORS, optional: true, self: true }, { token: NG_VALUE_ACCESSOR, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2215
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.4", type: FormControlNameDirective, isStandalone: true, selector: "[rxapFormControlName]", inputs: { name: ["rxapFormControlName", "name"] }, providers: [
|
|
2273
2216
|
{
|
|
2274
|
-
provide:
|
|
2275
|
-
useExisting: forwardRef(() =>
|
|
2276
|
-
}
|
|
2277
|
-
], exportAs: ["
|
|
2217
|
+
provide: NgControl,
|
|
2218
|
+
useExisting: forwardRef(() => FormControlNameDirective),
|
|
2219
|
+
},
|
|
2220
|
+
], exportAs: ["rxapFormControl"], usesInheritance: true, ngImport: i0 }); }
|
|
2278
2221
|
}
|
|
2279
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
2222
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormControlNameDirective, decorators: [{
|
|
2280
2223
|
type: Directive,
|
|
2281
2224
|
args: [{
|
|
2282
|
-
selector: '[
|
|
2225
|
+
selector: '[rxapFormControlName]',
|
|
2283
2226
|
providers: [
|
|
2284
2227
|
{
|
|
2285
|
-
provide:
|
|
2286
|
-
useExisting: forwardRef(() =>
|
|
2287
|
-
}
|
|
2228
|
+
provide: NgControl,
|
|
2229
|
+
useExisting: forwardRef(() => FormControlNameDirective),
|
|
2230
|
+
},
|
|
2288
2231
|
],
|
|
2289
|
-
exportAs: '
|
|
2290
|
-
standalone: true
|
|
2232
|
+
exportAs: 'rxapFormControl',
|
|
2233
|
+
standalone: true,
|
|
2291
2234
|
}]
|
|
2292
2235
|
}], ctorParameters: function () { return [{ type: i1.ControlContainer, decorators: [{
|
|
2293
2236
|
type: Optional
|
|
2294
2237
|
}, {
|
|
2295
2238
|
type: SkipSelf
|
|
2296
|
-
}] }, { type:
|
|
2239
|
+
}] }, { type: Array, decorators: [{
|
|
2297
2240
|
type: Optional
|
|
2298
2241
|
}, {
|
|
2299
2242
|
type: Self
|
|
2300
2243
|
}, {
|
|
2301
2244
|
type: Inject,
|
|
2302
2245
|
args: [NG_VALIDATORS]
|
|
2303
|
-
}] }, { type:
|
|
2246
|
+
}] }, { type: Array, decorators: [{
|
|
2304
2247
|
type: Optional
|
|
2305
2248
|
}, {
|
|
2306
2249
|
type: Self
|
|
2307
2250
|
}, {
|
|
2308
2251
|
type: Inject,
|
|
2309
2252
|
args: [NG_ASYNC_VALIDATORS]
|
|
2253
|
+
}] }, { type: undefined, decorators: [{
|
|
2254
|
+
type: Optional
|
|
2255
|
+
}, {
|
|
2256
|
+
type: Self
|
|
2257
|
+
}, {
|
|
2258
|
+
type: Inject,
|
|
2259
|
+
args: [NG_VALUE_ACCESSOR]
|
|
2310
2260
|
}] }]; }, propDecorators: { name: [{
|
|
2311
2261
|
type: Input,
|
|
2312
|
-
args: ['
|
|
2262
|
+
args: ['rxapFormControlName']
|
|
2313
2263
|
}] } });
|
|
2314
2264
|
|
|
2315
2265
|
class ParentControlContainerDirective {
|
|
2316
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
2317
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.
|
|
2266
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ParentControlContainerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2267
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.4", type: ParentControlContainerDirective, isStandalone: true, selector: "[formControlName][parentControlContainer],[formControlGroup][parentControlContainer]", providers: [
|
|
2318
2268
|
{
|
|
2319
2269
|
provide: ControlContainer,
|
|
2320
|
-
useExisting: ControlContainer
|
|
2321
|
-
}
|
|
2270
|
+
useExisting: ControlContainer,
|
|
2271
|
+
},
|
|
2322
2272
|
], ngImport: i0 }); }
|
|
2323
2273
|
}
|
|
2324
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
2274
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ParentControlContainerDirective, decorators: [{
|
|
2325
2275
|
type: Directive,
|
|
2326
2276
|
args: [{
|
|
2277
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
2327
2278
|
selector: '[formControlName][parentControlContainer],[formControlGroup][parentControlContainer]',
|
|
2328
2279
|
providers: [
|
|
2329
2280
|
{
|
|
2330
2281
|
provide: ControlContainer,
|
|
2331
|
-
useExisting: ControlContainer
|
|
2332
|
-
}
|
|
2282
|
+
useExisting: ControlContainer,
|
|
2283
|
+
},
|
|
2333
2284
|
],
|
|
2334
|
-
standalone: true
|
|
2285
|
+
standalone: true,
|
|
2335
2286
|
}]
|
|
2336
2287
|
}] });
|
|
2337
2288
|
|
|
2289
|
+
class FormSubmitSuccessfulDirective {
|
|
2290
|
+
constructor(formDirective, template, viewContainerRef) {
|
|
2291
|
+
this.formDirective = formDirective;
|
|
2292
|
+
this.template = template;
|
|
2293
|
+
this.viewContainerRef = viewContainerRef;
|
|
2294
|
+
}
|
|
2295
|
+
ngAfterViewInit() {
|
|
2296
|
+
this.subscription = this.formDirective.submitSuccessful$.pipe(tap(result => {
|
|
2297
|
+
this.viewContainerRef.clear();
|
|
2298
|
+
this.viewContainerRef.createEmbeddedView(this.template, { $implicit: result });
|
|
2299
|
+
})).subscribe();
|
|
2300
|
+
}
|
|
2301
|
+
ngOnDestroy() {
|
|
2302
|
+
this.subscription?.unsubscribe();
|
|
2303
|
+
}
|
|
2304
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormSubmitSuccessfulDirective, deps: [{ token: FormDirective }, { token: TemplateRef }, { token: ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2305
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.4", type: FormSubmitSuccessfulDirective, isStandalone: true, selector: "[rxapFormSubmitSuccessful]", ngImport: i0 }); }
|
|
2306
|
+
}
|
|
2307
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormSubmitSuccessfulDirective, decorators: [{
|
|
2308
|
+
type: Directive,
|
|
2309
|
+
args: [{
|
|
2310
|
+
selector: '[rxapFormSubmitSuccessful]',
|
|
2311
|
+
standalone: true,
|
|
2312
|
+
}]
|
|
2313
|
+
}], ctorParameters: function () { return [{ type: FormDirective, decorators: [{
|
|
2314
|
+
type: Inject,
|
|
2315
|
+
args: [FormDirective]
|
|
2316
|
+
}] }, { type: i0.TemplateRef, decorators: [{
|
|
2317
|
+
type: Inject,
|
|
2318
|
+
args: [TemplateRef]
|
|
2319
|
+
}] }, { type: i0.ViewContainerRef, decorators: [{
|
|
2320
|
+
type: Inject,
|
|
2321
|
+
args: [ViewContainerRef]
|
|
2322
|
+
}] }]; } });
|
|
2323
|
+
|
|
2324
|
+
class FormSubmitInvalidDirective {
|
|
2325
|
+
constructor(formDirective, template, viewContainerRef) {
|
|
2326
|
+
this.formDirective = formDirective;
|
|
2327
|
+
this.template = template;
|
|
2328
|
+
this.viewContainerRef = viewContainerRef;
|
|
2329
|
+
}
|
|
2330
|
+
ngAfterViewInit() {
|
|
2331
|
+
this.subscription = this.formDirective.invalidSubmit.pipe(tap(result => {
|
|
2332
|
+
this.viewContainerRef.clear();
|
|
2333
|
+
this.viewContainerRef.createEmbeddedView(this.template, { $implicit: result });
|
|
2334
|
+
})).subscribe();
|
|
2335
|
+
}
|
|
2336
|
+
ngOnDestroy() {
|
|
2337
|
+
this.subscription?.unsubscribe();
|
|
2338
|
+
}
|
|
2339
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormSubmitInvalidDirective, deps: [{ token: FormDirective }, { token: TemplateRef }, { token: ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2340
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.4", type: FormSubmitInvalidDirective, isStandalone: true, selector: "[rxapFormSubmitInvalid]", ngImport: i0 }); }
|
|
2341
|
+
}
|
|
2342
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormSubmitInvalidDirective, decorators: [{
|
|
2343
|
+
type: Directive,
|
|
2344
|
+
args: [{
|
|
2345
|
+
selector: '[rxapFormSubmitInvalid]',
|
|
2346
|
+
standalone: true,
|
|
2347
|
+
}]
|
|
2348
|
+
}], ctorParameters: function () { return [{ type: FormDirective, decorators: [{
|
|
2349
|
+
type: Inject,
|
|
2350
|
+
args: [FormDirective]
|
|
2351
|
+
}] }, { type: i0.TemplateRef, decorators: [{
|
|
2352
|
+
type: Inject,
|
|
2353
|
+
args: [TemplateRef]
|
|
2354
|
+
}] }, { type: i0.ViewContainerRef, decorators: [{
|
|
2355
|
+
type: Inject,
|
|
2356
|
+
args: [ViewContainerRef]
|
|
2357
|
+
}] }]; } });
|
|
2358
|
+
|
|
2359
|
+
class RxapFormsModule {
|
|
2360
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: RxapFormsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
2361
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.4", ngImport: i0, type: RxapFormsModule, imports: [FormDirective,
|
|
2362
|
+
FormSubmitFailedDirective,
|
|
2363
|
+
FormLoadingDirective,
|
|
2364
|
+
FormSubmittingDirective,
|
|
2365
|
+
FormLoadingErrorDirective,
|
|
2366
|
+
FormLoadedDirective,
|
|
2367
|
+
FormControlErrorDirective,
|
|
2368
|
+
FormControlMarkDirtyDirective,
|
|
2369
|
+
FormControlMarkTouchedDirective,
|
|
2370
|
+
FormControlMarkUntouchedDirective,
|
|
2371
|
+
FormControlMarkPristineDirective,
|
|
2372
|
+
FormSubmitDirective,
|
|
2373
|
+
FormGroupNameDirective,
|
|
2374
|
+
FormControlNameDirective,
|
|
2375
|
+
ParentControlContainerDirective,
|
|
2376
|
+
FormSubmitSuccessfulDirective,
|
|
2377
|
+
FormSubmitInvalidDirective], exports: [FormDirective,
|
|
2378
|
+
FormSubmitFailedDirective,
|
|
2379
|
+
FormLoadingDirective,
|
|
2380
|
+
FormSubmittingDirective,
|
|
2381
|
+
FormLoadingErrorDirective,
|
|
2382
|
+
FormLoadedDirective,
|
|
2383
|
+
FormControlErrorDirective,
|
|
2384
|
+
FormControlMarkDirtyDirective,
|
|
2385
|
+
FormControlMarkTouchedDirective,
|
|
2386
|
+
FormControlMarkUntouchedDirective,
|
|
2387
|
+
FormControlMarkPristineDirective,
|
|
2388
|
+
FormSubmitDirective,
|
|
2389
|
+
FormGroupNameDirective,
|
|
2390
|
+
FormControlNameDirective,
|
|
2391
|
+
ParentControlContainerDirective,
|
|
2392
|
+
FormSubmitSuccessfulDirective,
|
|
2393
|
+
FormSubmitInvalidDirective] }); }
|
|
2394
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: RxapFormsModule }); }
|
|
2395
|
+
}
|
|
2396
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: RxapFormsModule, decorators: [{
|
|
2397
|
+
type: NgModule,
|
|
2398
|
+
args: [{
|
|
2399
|
+
imports: [
|
|
2400
|
+
FormDirective,
|
|
2401
|
+
FormSubmitFailedDirective,
|
|
2402
|
+
FormLoadingDirective,
|
|
2403
|
+
FormSubmittingDirective,
|
|
2404
|
+
FormLoadingErrorDirective,
|
|
2405
|
+
FormLoadedDirective,
|
|
2406
|
+
FormControlErrorDirective,
|
|
2407
|
+
FormControlMarkDirtyDirective,
|
|
2408
|
+
FormControlMarkTouchedDirective,
|
|
2409
|
+
FormControlMarkUntouchedDirective,
|
|
2410
|
+
FormControlMarkPristineDirective,
|
|
2411
|
+
FormSubmitDirective,
|
|
2412
|
+
FormGroupNameDirective,
|
|
2413
|
+
FormControlNameDirective,
|
|
2414
|
+
ParentControlContainerDirective,
|
|
2415
|
+
FormSubmitSuccessfulDirective,
|
|
2416
|
+
FormSubmitInvalidDirective,
|
|
2417
|
+
],
|
|
2418
|
+
exports: [
|
|
2419
|
+
FormDirective,
|
|
2420
|
+
FormSubmitFailedDirective,
|
|
2421
|
+
FormLoadingDirective,
|
|
2422
|
+
FormSubmittingDirective,
|
|
2423
|
+
FormLoadingErrorDirective,
|
|
2424
|
+
FormLoadedDirective,
|
|
2425
|
+
FormControlErrorDirective,
|
|
2426
|
+
FormControlMarkDirtyDirective,
|
|
2427
|
+
FormControlMarkTouchedDirective,
|
|
2428
|
+
FormControlMarkUntouchedDirective,
|
|
2429
|
+
FormControlMarkPristineDirective,
|
|
2430
|
+
FormSubmitDirective,
|
|
2431
|
+
FormGroupNameDirective,
|
|
2432
|
+
FormControlNameDirective,
|
|
2433
|
+
ParentControlContainerDirective,
|
|
2434
|
+
FormSubmitSuccessfulDirective,
|
|
2435
|
+
FormSubmitInvalidDirective,
|
|
2436
|
+
],
|
|
2437
|
+
}]
|
|
2438
|
+
}] });
|
|
2439
|
+
|
|
2440
|
+
function ToFormMethod(call) {
|
|
2441
|
+
return { call };
|
|
2442
|
+
}
|
|
2443
|
+
/**
|
|
2444
|
+
* @deprecated use ToFormMethod instead
|
|
2445
|
+
*
|
|
2446
|
+
* @param call the call method implementation
|
|
2447
|
+
*/
|
|
2448
|
+
function ToFormSubmitMethod(call) {
|
|
2449
|
+
return ToFormMethod(call);
|
|
2450
|
+
}
|
|
2451
|
+
|
|
2338
2452
|
/**
|
|
2339
2453
|
* Checks if a given value is a number.
|
|
2340
2454
|
*/
|
|
@@ -2369,11 +2483,16 @@ function IsNumber(control) {
|
|
|
2369
2483
|
return null;
|
|
2370
2484
|
}
|
|
2371
2485
|
if (isNaN(Number(control.value))) {
|
|
2372
|
-
return {
|
|
2486
|
+
return {
|
|
2487
|
+
isNumber: {
|
|
2488
|
+
expected: 'A number or a string representing a number',
|
|
2489
|
+
actual: control.value,
|
|
2490
|
+
},
|
|
2491
|
+
};
|
|
2373
2492
|
}
|
|
2374
2493
|
return null;
|
|
2375
2494
|
}
|
|
2376
|
-
function _IsNumber({ message, options } = {}) {
|
|
2495
|
+
function _IsNumber({ message, options, } = {}) {
|
|
2377
2496
|
return (control) => {
|
|
2378
2497
|
if (control.value === null) {
|
|
2379
2498
|
return null;
|
|
@@ -2383,8 +2502,8 @@ function _IsNumber({ message, options } = {}) {
|
|
|
2383
2502
|
isNumber: {
|
|
2384
2503
|
expected: 'A number value',
|
|
2385
2504
|
actual: control.value,
|
|
2386
|
-
message
|
|
2387
|
-
}
|
|
2505
|
+
message,
|
|
2506
|
+
},
|
|
2388
2507
|
};
|
|
2389
2508
|
}
|
|
2390
2509
|
return null;
|
|
@@ -2401,8 +2520,8 @@ function IsBoolean({ message } = {}) {
|
|
|
2401
2520
|
isBoolean: {
|
|
2402
2521
|
expected: 'A boolean value',
|
|
2403
2522
|
actual: control.value,
|
|
2404
|
-
message
|
|
2405
|
-
}
|
|
2523
|
+
message,
|
|
2524
|
+
},
|
|
2406
2525
|
};
|
|
2407
2526
|
}
|
|
2408
2527
|
return null;
|
|
@@ -2414,13 +2533,16 @@ function IsObject({ message } = {}) {
|
|
|
2414
2533
|
if (control.value === null) {
|
|
2415
2534
|
return null;
|
|
2416
2535
|
}
|
|
2417
|
-
if (!(control.value !==
|
|
2536
|
+
if (!(control.value !==
|
|
2537
|
+
undefined &&
|
|
2538
|
+
(typeof control.value === 'object' || typeof control.value === 'function') &&
|
|
2539
|
+
!Array.isArray(control.value))) {
|
|
2418
2540
|
return {
|
|
2419
2541
|
isObject: {
|
|
2420
2542
|
expected: 'A object value',
|
|
2421
2543
|
actual: control.value,
|
|
2422
|
-
message
|
|
2423
|
-
}
|
|
2544
|
+
message,
|
|
2545
|
+
},
|
|
2424
2546
|
};
|
|
2425
2547
|
}
|
|
2426
2548
|
return null;
|
|
@@ -2437,15 +2559,15 @@ function IsString({ message } = {}) {
|
|
|
2437
2559
|
isString: {
|
|
2438
2560
|
expected: 'A string value',
|
|
2439
2561
|
actual: control.value,
|
|
2440
|
-
message
|
|
2441
|
-
}
|
|
2562
|
+
message,
|
|
2563
|
+
},
|
|
2442
2564
|
};
|
|
2443
2565
|
}
|
|
2444
2566
|
return null;
|
|
2445
2567
|
};
|
|
2446
2568
|
}
|
|
2447
2569
|
|
|
2448
|
-
function IsInt({ message, options } = {}) {
|
|
2570
|
+
function IsInt({ message, options, } = {}) {
|
|
2449
2571
|
return (control) => {
|
|
2450
2572
|
if (control.value === null) {
|
|
2451
2573
|
return null;
|
|
@@ -2455,15 +2577,15 @@ function IsInt({ message, options } = {}) {
|
|
|
2455
2577
|
isInt: {
|
|
2456
2578
|
expected: 'A int value',
|
|
2457
2579
|
actual: control.value,
|
|
2458
|
-
message
|
|
2459
|
-
}
|
|
2580
|
+
message,
|
|
2581
|
+
},
|
|
2460
2582
|
};
|
|
2461
2583
|
}
|
|
2462
2584
|
return null;
|
|
2463
2585
|
};
|
|
2464
2586
|
}
|
|
2465
2587
|
|
|
2466
|
-
function IsEnum({ message, entity }) {
|
|
2588
|
+
function IsEnum({ message, entity, }) {
|
|
2467
2589
|
return (control) => {
|
|
2468
2590
|
if (control.value === null) {
|
|
2469
2591
|
return null;
|
|
@@ -2473,8 +2595,8 @@ function IsEnum({ message, entity }) {
|
|
|
2473
2595
|
isEnum: {
|
|
2474
2596
|
expected: 'A enum value',
|
|
2475
2597
|
actual: control.value,
|
|
2476
|
-
message
|
|
2477
|
-
}
|
|
2598
|
+
message,
|
|
2599
|
+
},
|
|
2478
2600
|
};
|
|
2479
2601
|
}
|
|
2480
2602
|
return null;
|
|
@@ -2491,8 +2613,8 @@ function IsDate({ message } = {}) {
|
|
|
2491
2613
|
isDate: {
|
|
2492
2614
|
expected: 'A date value',
|
|
2493
2615
|
actual: control.value,
|
|
2494
|
-
message
|
|
2495
|
-
}
|
|
2616
|
+
message,
|
|
2617
|
+
},
|
|
2496
2618
|
};
|
|
2497
2619
|
}
|
|
2498
2620
|
return null;
|
|
@@ -2509,8 +2631,8 @@ function IsArray({ message } = {}) {
|
|
|
2509
2631
|
isArray: {
|
|
2510
2632
|
expected: 'A array value',
|
|
2511
2633
|
actual: control.value,
|
|
2512
|
-
message
|
|
2513
|
-
}
|
|
2634
|
+
message,
|
|
2635
|
+
},
|
|
2514
2636
|
};
|
|
2515
2637
|
}
|
|
2516
2638
|
return null;
|
|
@@ -2523,14 +2645,14 @@ const regexOptions = {
|
|
|
2523
2645
|
digit: '.*[0-9]',
|
|
2524
2646
|
lowercase: '.*[a-z]',
|
|
2525
2647
|
upperLower: '.*[a-zA-Z]',
|
|
2526
|
-
alphaNumeric: '.*[a-zA-Z0-9]'
|
|
2648
|
+
alphaNumeric: '.*[a-zA-Z0-9]',
|
|
2527
2649
|
};
|
|
2528
2650
|
const lengthOptions = {
|
|
2529
2651
|
min: '.{n,}',
|
|
2530
2652
|
max: '.{0,n}',
|
|
2531
2653
|
range: '.{min,max}',
|
|
2532
2654
|
exact: '.{n}',
|
|
2533
|
-
no_limit: '.*'
|
|
2655
|
+
no_limit: '.*',
|
|
2534
2656
|
};
|
|
2535
2657
|
function inOperator(k, o) {
|
|
2536
2658
|
return k in o;
|
|
@@ -2561,7 +2683,6 @@ function create(options) {
|
|
|
2561
2683
|
return regex;
|
|
2562
2684
|
}
|
|
2563
2685
|
function check(str, regexStringOrOptions) {
|
|
2564
|
-
let regex;
|
|
2565
2686
|
let regexString;
|
|
2566
2687
|
if (typeof regexStringOrOptions === 'object') {
|
|
2567
2688
|
regexString = create(regexStringOrOptions);
|
|
@@ -2569,8 +2690,7 @@ function check(str, regexStringOrOptions) {
|
|
|
2569
2690
|
else {
|
|
2570
2691
|
regexString = regexStringOrOptions;
|
|
2571
2692
|
}
|
|
2572
|
-
|
|
2573
|
-
return regex.test(str);
|
|
2693
|
+
return new RegExp(regexString).test(str);
|
|
2574
2694
|
}
|
|
2575
2695
|
function checkError(str, options) {
|
|
2576
2696
|
const returnObject = {};
|
|
@@ -2579,7 +2699,7 @@ function checkError(str, options) {
|
|
|
2579
2699
|
}
|
|
2580
2700
|
return returnObject;
|
|
2581
2701
|
}
|
|
2582
|
-
function IsComplex({ message, options }) {
|
|
2702
|
+
function IsComplex({ message, options, }) {
|
|
2583
2703
|
return (control) => {
|
|
2584
2704
|
if (control.value === null) {
|
|
2585
2705
|
return null;
|
|
@@ -2594,15 +2714,15 @@ function IsComplex({ message, options }) {
|
|
|
2594
2714
|
isComplex: {
|
|
2595
2715
|
expected: options,
|
|
2596
2716
|
actual: errors,
|
|
2597
|
-
message
|
|
2598
|
-
}
|
|
2717
|
+
message,
|
|
2718
|
+
},
|
|
2599
2719
|
};
|
|
2600
2720
|
}
|
|
2601
2721
|
return null;
|
|
2602
2722
|
};
|
|
2603
2723
|
}
|
|
2604
2724
|
|
|
2605
|
-
function IsPhoneNumber({ message, locale, options } = {}) {
|
|
2725
|
+
function IsPhoneNumber({ message, locale, options, } = {}) {
|
|
2606
2726
|
return (control) => {
|
|
2607
2727
|
if (control.value === null) {
|
|
2608
2728
|
return null;
|
|
@@ -2612,15 +2732,15 @@ function IsPhoneNumber({ message, locale, options } = {}) {
|
|
|
2612
2732
|
isPhoneNumber: {
|
|
2613
2733
|
expected: 'A phone number value',
|
|
2614
2734
|
actual: control.value,
|
|
2615
|
-
message
|
|
2616
|
-
}
|
|
2735
|
+
message,
|
|
2736
|
+
},
|
|
2617
2737
|
};
|
|
2618
2738
|
}
|
|
2619
2739
|
return null;
|
|
2620
2740
|
};
|
|
2621
2741
|
}
|
|
2622
2742
|
|
|
2623
|
-
function IsEmail({ message, options } = {}) {
|
|
2743
|
+
function IsEmail({ message, options, } = {}) {
|
|
2624
2744
|
return (control) => {
|
|
2625
2745
|
if (control.value === null) {
|
|
2626
2746
|
return null;
|
|
@@ -2630,15 +2750,15 @@ function IsEmail({ message, options } = {}) {
|
|
|
2630
2750
|
isEmail: {
|
|
2631
2751
|
expected: 'A email value',
|
|
2632
2752
|
actual: control.value,
|
|
2633
|
-
message
|
|
2634
|
-
}
|
|
2753
|
+
message,
|
|
2754
|
+
},
|
|
2635
2755
|
};
|
|
2636
2756
|
}
|
|
2637
2757
|
return null;
|
|
2638
2758
|
};
|
|
2639
2759
|
}
|
|
2640
2760
|
|
|
2641
|
-
function IsUrl({ message, options } = {}) {
|
|
2761
|
+
function IsUrl({ message, options, } = {}) {
|
|
2642
2762
|
return (control) => {
|
|
2643
2763
|
if (control.value === null) {
|
|
2644
2764
|
return null;
|
|
@@ -2648,15 +2768,15 @@ function IsUrl({ message, options } = {}) {
|
|
|
2648
2768
|
isURL: {
|
|
2649
2769
|
expected: 'A url value',
|
|
2650
2770
|
actual: control.value,
|
|
2651
|
-
message
|
|
2652
|
-
}
|
|
2771
|
+
message,
|
|
2772
|
+
},
|
|
2653
2773
|
};
|
|
2654
2774
|
}
|
|
2655
2775
|
return null;
|
|
2656
2776
|
};
|
|
2657
2777
|
}
|
|
2658
2778
|
|
|
2659
|
-
function IsIP({ message, version } = {}) {
|
|
2779
|
+
function IsIP({ message, version, } = {}) {
|
|
2660
2780
|
return (control) => {
|
|
2661
2781
|
if (control.value === null) {
|
|
2662
2782
|
return null;
|
|
@@ -2666,8 +2786,8 @@ function IsIP({ message, version } = {}) {
|
|
|
2666
2786
|
isIp: {
|
|
2667
2787
|
expected: `A valid IPv${version ?? '4'} value`,
|
|
2668
2788
|
actual: control.value,
|
|
2669
|
-
message
|
|
2670
|
-
}
|
|
2789
|
+
message,
|
|
2790
|
+
},
|
|
2671
2791
|
};
|
|
2672
2792
|
}
|
|
2673
2793
|
return null;
|
|
@@ -2684,15 +2804,15 @@ function IsPort({ message } = {}) {
|
|
|
2684
2804
|
isPort: {
|
|
2685
2805
|
expected: `A valid port number between 1 and 65535`,
|
|
2686
2806
|
actual: control.value,
|
|
2687
|
-
message
|
|
2688
|
-
}
|
|
2807
|
+
message,
|
|
2808
|
+
},
|
|
2689
2809
|
};
|
|
2690
2810
|
}
|
|
2691
2811
|
return null;
|
|
2692
2812
|
};
|
|
2693
2813
|
}
|
|
2694
2814
|
|
|
2695
|
-
function IsUUID({ message, version = 'all' } = {}) {
|
|
2815
|
+
function IsUUID({ message, version = 'all', } = {}) {
|
|
2696
2816
|
return (control) => {
|
|
2697
2817
|
if (control.value === null) {
|
|
2698
2818
|
return null;
|
|
@@ -2702,8 +2822,8 @@ function IsUUID({ message, version = 'all' } = {}) {
|
|
|
2702
2822
|
isUuid: {
|
|
2703
2823
|
expected: version === 'all' ? `A valid uuid` : `A valid uuid version ${version}`,
|
|
2704
2824
|
actual: control.value,
|
|
2705
|
-
message
|
|
2706
|
-
}
|
|
2825
|
+
message,
|
|
2826
|
+
},
|
|
2707
2827
|
};
|
|
2708
2828
|
}
|
|
2709
2829
|
return null;
|
|
@@ -2734,5 +2854,5 @@ const RxapValidators = {
|
|
|
2734
2854
|
* Generated bundle index. Do not edit.
|
|
2735
2855
|
*/
|
|
2736
2856
|
|
|
2737
|
-
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, 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 };
|
|
2857
|
+
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 };
|
|
2738
2858
|
//# sourceMappingURL=rxap-forms.mjs.map
|