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