@rxap/forms 16.0.0-dev.1 → 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 -2
- 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 +10 -10
- package/esm2022/lib/directives/form-control-mark-dirty.directive.mjs +9 -9
- package/esm2022/lib/directives/form-control-mark-pristine.directive.mjs +9 -9
- package/esm2022/lib/directives/form-control-mark-touched.directive.mjs +8 -8
- package/esm2022/lib/directives/form-control-mark-untouched.directive.mjs +9 -9
- package/esm2022/lib/directives/form-control-name.directive.mjs +13 -13
- package/esm2022/lib/directives/form-group-name.directive.mjs +13 -13
- package/esm2022/lib/directives/form-loaded.directive.mjs +9 -9
- package/esm2022/lib/directives/form-loading-error.directive.mjs +8 -8
- package/esm2022/lib/directives/form-loading.directive.mjs +9 -9
- package/esm2022/lib/directives/form-submit-failed.directive.mjs +8 -8
- package/esm2022/lib/directives/form-submit-invalid.directive.mjs +8 -8
- package/esm2022/lib/directives/form-submit-successful.directive.mjs +8 -8
- package/esm2022/lib/directives/form-submit.directive.mjs +12 -12
- package/esm2022/lib/directives/form-submitting.directive.mjs +9 -9
- package/esm2022/lib/directives/form.directive.mjs +21 -16
- package/esm2022/lib/directives/forms.module.mjs +8 -9
- package/esm2022/lib/directives/models.mjs +1 -1
- package/esm2022/lib/directives/parent-control-container.directive.mjs +12 -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 +235 -178
- package/fesm2022/rxap-forms.mjs.map +1 -1
- package/index.d.ts +1 -1
- package/lib/control-actions.d.ts +1 -1
- package/lib/directives/form-control-error.directive.d.ts +3 -3
- package/lib/directives/form-control-mark-dirty.directive.d.ts +1 -1
- package/lib/directives/form-control-mark-pristine.directive.d.ts +1 -1
- package/lib/directives/form-control-mark-touched.directive.d.ts +1 -1
- package/lib/directives/form-control-mark-untouched.directive.d.ts +1 -1
- package/lib/directives/form-control-name.directive.d.ts +2 -2
- package/lib/directives/form-group-name.directive.d.ts +2 -2
- package/lib/directives/form-loaded.directive.d.ts +2 -2
- package/lib/directives/form-loading-error.directive.d.ts +2 -2
- package/lib/directives/form-loading.directive.d.ts +2 -2
- package/lib/directives/form-submit-failed.directive.d.ts +2 -2
- package/lib/directives/form-submit-invalid.directive.d.ts +2 -2
- package/lib/directives/form-submit-successful.directive.d.ts +2 -2
- package/lib/directives/form-submit.directive.d.ts +2 -2
- package/lib/directives/form-submitting.directive.d.ts +2 -2
- package/lib/directives/form.directive.d.ts +4 -4
- package/lib/directives/forms.module.d.ts +1 -1
- package/lib/directives/models.d.ts +1 -1
- package/lib/directives/parent-control-container.directive.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
|
@@ -6,11 +6,11 @@ import { equals, coerceArray, HasRxapOnInitMethod, assertIsArray, assertIsObject
|
|
|
6
6
|
import * as i0 from '@angular/core';
|
|
7
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
|
|
@@ -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
|
|
@@ -1603,9 +1634,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
1603
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',
|
|
1642
|
+
standalone: true,
|
|
1609
1643
|
}]
|
|
1610
1644
|
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef, decorators: [{
|
|
1611
1645
|
type: Inject,
|
|
@@ -1717,13 +1751,14 @@ class FormSubmitFailedDirective {
|
|
|
1717
1751
|
ngOnDestroy() {
|
|
1718
1752
|
this.subscription?.unsubscribe();
|
|
1719
1753
|
}
|
|
1720
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
1721
|
-
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 }); }
|
|
1722
1756
|
}
|
|
1723
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
1757
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormSubmitFailedDirective, decorators: [{
|
|
1724
1758
|
type: Directive,
|
|
1725
1759
|
args: [{
|
|
1726
|
-
selector: '[rxapFormSubmitFailed]'
|
|
1760
|
+
selector: '[rxapFormSubmitFailed]',
|
|
1761
|
+
standalone: true,
|
|
1727
1762
|
}]
|
|
1728
1763
|
}], ctorParameters: function () { return [{ type: FormDirective, decorators: [{
|
|
1729
1764
|
type: Inject,
|
|
@@ -1753,13 +1788,14 @@ class FormLoadingDirective {
|
|
|
1753
1788
|
ngOnDestroy() {
|
|
1754
1789
|
this.subscription?.unsubscribe();
|
|
1755
1790
|
}
|
|
1756
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
1757
|
-
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 }); }
|
|
1758
1793
|
}
|
|
1759
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
1794
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormLoadingDirective, decorators: [{
|
|
1760
1795
|
type: Directive,
|
|
1761
1796
|
args: [{
|
|
1762
|
-
selector: '[rxapFormLoading]'
|
|
1797
|
+
selector: '[rxapFormLoading]',
|
|
1798
|
+
standalone: true,
|
|
1763
1799
|
}]
|
|
1764
1800
|
}], ctorParameters: function () { return [{ type: FormDirective, decorators: [{
|
|
1765
1801
|
type: Inject,
|
|
@@ -1789,13 +1825,14 @@ class FormSubmittingDirective {
|
|
|
1789
1825
|
ngOnDestroy() {
|
|
1790
1826
|
this.subscription?.unsubscribe();
|
|
1791
1827
|
}
|
|
1792
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
1793
|
-
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 }); }
|
|
1794
1830
|
}
|
|
1795
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
1831
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormSubmittingDirective, decorators: [{
|
|
1796
1832
|
type: Directive,
|
|
1797
1833
|
args: [{
|
|
1798
|
-
selector: '[rxapFormSubmitting]'
|
|
1834
|
+
selector: '[rxapFormSubmitting]',
|
|
1835
|
+
standalone: true,
|
|
1799
1836
|
}]
|
|
1800
1837
|
}], ctorParameters: function () { return [{ type: FormDirective, decorators: [{
|
|
1801
1838
|
type: Inject,
|
|
@@ -1808,30 +1845,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
1808
1845
|
args: [ViewContainerRef]
|
|
1809
1846
|
}] }]; } });
|
|
1810
1847
|
|
|
1811
|
-
class
|
|
1848
|
+
class FormLoadingErrorDirective {
|
|
1812
1849
|
constructor(formDirective, template, viewContainerRef) {
|
|
1813
1850
|
this.formDirective = formDirective;
|
|
1814
1851
|
this.template = template;
|
|
1815
1852
|
this.viewContainerRef = viewContainerRef;
|
|
1816
1853
|
}
|
|
1817
1854
|
ngAfterViewInit() {
|
|
1818
|
-
this.subscription = this.formDirective.
|
|
1855
|
+
this.subscription = this.formDirective.loadingError$.pipe(tap(error => {
|
|
1819
1856
|
this.viewContainerRef.clear();
|
|
1820
|
-
if (
|
|
1821
|
-
this.viewContainerRef.createEmbeddedView(this.template);
|
|
1857
|
+
if (error !== null) {
|
|
1858
|
+
this.viewContainerRef.createEmbeddedView(this.template, { $implicit: error });
|
|
1822
1859
|
}
|
|
1823
1860
|
})).subscribe();
|
|
1824
1861
|
}
|
|
1825
1862
|
ngOnDestroy() {
|
|
1826
1863
|
this.subscription?.unsubscribe();
|
|
1827
1864
|
}
|
|
1828
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
1829
|
-
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 }); }
|
|
1830
1867
|
}
|
|
1831
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
1868
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormLoadingErrorDirective, decorators: [{
|
|
1832
1869
|
type: Directive,
|
|
1833
1870
|
args: [{
|
|
1834
|
-
selector: '[
|
|
1871
|
+
selector: '[rxapFormLoadingError]',
|
|
1872
|
+
standalone: true,
|
|
1835
1873
|
}]
|
|
1836
1874
|
}], ctorParameters: function () { return [{ type: FormDirective, decorators: [{
|
|
1837
1875
|
type: Inject,
|
|
@@ -1844,30 +1882,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
1844
1882
|
args: [ViewContainerRef]
|
|
1845
1883
|
}] }]; } });
|
|
1846
1884
|
|
|
1847
|
-
class
|
|
1885
|
+
class FormLoadedDirective {
|
|
1848
1886
|
constructor(formDirective, template, viewContainerRef) {
|
|
1849
1887
|
this.formDirective = formDirective;
|
|
1850
1888
|
this.template = template;
|
|
1851
1889
|
this.viewContainerRef = viewContainerRef;
|
|
1852
1890
|
}
|
|
1853
1891
|
ngAfterViewInit() {
|
|
1854
|
-
this.subscription = this.formDirective.
|
|
1892
|
+
this.subscription = this.formDirective.loaded$.pipe(distinctUntilChanged(), tap(loading => {
|
|
1855
1893
|
this.viewContainerRef.clear();
|
|
1856
|
-
if (
|
|
1857
|
-
this.viewContainerRef.createEmbeddedView(this.template
|
|
1894
|
+
if (loading) {
|
|
1895
|
+
this.viewContainerRef.createEmbeddedView(this.template);
|
|
1858
1896
|
}
|
|
1859
1897
|
})).subscribe();
|
|
1860
1898
|
}
|
|
1861
1899
|
ngOnDestroy() {
|
|
1862
1900
|
this.subscription?.unsubscribe();
|
|
1863
1901
|
}
|
|
1864
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
1865
|
-
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 }); }
|
|
1866
1904
|
}
|
|
1867
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
1905
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormLoadedDirective, decorators: [{
|
|
1868
1906
|
type: Directive,
|
|
1869
1907
|
args: [{
|
|
1870
|
-
selector: '[
|
|
1908
|
+
selector: '[rxapFormLoaded]',
|
|
1909
|
+
standalone: true,
|
|
1871
1910
|
}]
|
|
1872
1911
|
}], ctorParameters: function () { return [{ type: FormDirective, decorators: [{
|
|
1873
1912
|
type: Inject,
|
|
@@ -1881,7 +1920,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
1881
1920
|
}] }]; } });
|
|
1882
1921
|
|
|
1883
1922
|
/**
|
|
1884
|
-
* @deprecated removed
|
|
1923
|
+
* @deprecated removed use the rxapControlError or rxapControlErrors directive
|
|
1885
1924
|
*/
|
|
1886
1925
|
class FormControlErrorDirective {
|
|
1887
1926
|
constructor(template, parent, viewContainerRef) {
|
|
@@ -1904,8 +1943,8 @@ class FormControlErrorDirective {
|
|
|
1904
1943
|
ngOnDestroy() {
|
|
1905
1944
|
this.subscription?.unsubscribe();
|
|
1906
1945
|
}
|
|
1907
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
1908
|
-
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 }); }
|
|
1909
1948
|
}
|
|
1910
1949
|
__decorate([
|
|
1911
1950
|
Required,
|
|
@@ -1915,10 +1954,11 @@ __decorate([
|
|
|
1915
1954
|
Required,
|
|
1916
1955
|
__metadata("design:type", String)
|
|
1917
1956
|
], FormControlErrorDirective.prototype, "errorKey", void 0);
|
|
1918
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
1957
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormControlErrorDirective, decorators: [{
|
|
1919
1958
|
type: Directive,
|
|
1920
1959
|
args: [{
|
|
1921
|
-
selector: '[rxapFormControlError]'
|
|
1960
|
+
selector: '[rxapFormControlError]',
|
|
1961
|
+
standalone: true,
|
|
1922
1962
|
}]
|
|
1923
1963
|
}], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i1.ControlContainer, decorators: [{
|
|
1924
1964
|
type: Host
|
|
@@ -1939,19 +1979,20 @@ class FormControlMarkDirtyDirective {
|
|
|
1939
1979
|
onClick() {
|
|
1940
1980
|
const control = this.parent.control;
|
|
1941
1981
|
if (control && hasIndexSignature(control) && typeof control['markAllAsDirty'] === 'function') {
|
|
1942
|
-
control
|
|
1982
|
+
control['markAllAsDirty']();
|
|
1943
1983
|
}
|
|
1944
1984
|
else {
|
|
1945
1985
|
control?.markAsDirty();
|
|
1946
1986
|
}
|
|
1947
1987
|
}
|
|
1948
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
1949
|
-
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 }); }
|
|
1950
1990
|
}
|
|
1951
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
1991
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormControlMarkDirtyDirective, decorators: [{
|
|
1952
1992
|
type: Directive,
|
|
1953
1993
|
args: [{
|
|
1954
|
-
selector: '[rxapFormControlMarkDirty]'
|
|
1994
|
+
selector: '[rxapFormControlMarkDirty]',
|
|
1995
|
+
standalone: true,
|
|
1955
1996
|
}]
|
|
1956
1997
|
}], ctorParameters: function () { return [{ type: i1.ControlContainer }]; }, propDecorators: { onClick: [{
|
|
1957
1998
|
type: HostListener,
|
|
@@ -1965,13 +2006,14 @@ class FormControlMarkTouchedDirective {
|
|
|
1965
2006
|
onClick() {
|
|
1966
2007
|
this.parent.control?.markAllAsTouched();
|
|
1967
2008
|
}
|
|
1968
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
1969
|
-
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 }); }
|
|
1970
2011
|
}
|
|
1971
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
2012
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormControlMarkTouchedDirective, decorators: [{
|
|
1972
2013
|
type: Directive,
|
|
1973
2014
|
args: [{
|
|
1974
|
-
selector: '[rxapFormControlMarkTouched]'
|
|
2015
|
+
selector: '[rxapFormControlMarkTouched]',
|
|
2016
|
+
standalone: true,
|
|
1975
2017
|
}]
|
|
1976
2018
|
}], ctorParameters: function () { return [{ type: i1.ControlContainer }]; }, propDecorators: { onClick: [{
|
|
1977
2019
|
type: HostListener,
|
|
@@ -1985,19 +2027,20 @@ class FormControlMarkUntouchedDirective {
|
|
|
1985
2027
|
onClick() {
|
|
1986
2028
|
const control = this.parent.control;
|
|
1987
2029
|
if (control && hasIndexSignature(control) && typeof control['markAllAsUntouched'] === 'function') {
|
|
1988
|
-
control
|
|
2030
|
+
control['markAllAsUntouched']();
|
|
1989
2031
|
}
|
|
1990
2032
|
else {
|
|
1991
2033
|
control?.markAsUntouched();
|
|
1992
2034
|
}
|
|
1993
2035
|
}
|
|
1994
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
1995
|
-
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 }); }
|
|
1996
2038
|
}
|
|
1997
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
2039
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormControlMarkUntouchedDirective, decorators: [{
|
|
1998
2040
|
type: Directive,
|
|
1999
2041
|
args: [{
|
|
2000
|
-
selector: '[rxapFormControlMarkUntouched]'
|
|
2042
|
+
selector: '[rxapFormControlMarkUntouched]',
|
|
2043
|
+
standalone: true,
|
|
2001
2044
|
}]
|
|
2002
2045
|
}], ctorParameters: function () { return [{ type: i1.ControlContainer }]; }, propDecorators: { onClick: [{
|
|
2003
2046
|
type: HostListener,
|
|
@@ -2011,19 +2054,20 @@ class FormControlMarkPristineDirective {
|
|
|
2011
2054
|
onClick() {
|
|
2012
2055
|
const control = this.parent.control;
|
|
2013
2056
|
if (control && hasIndexSignature(control) && typeof control['markAllAsPristine'] === 'function') {
|
|
2014
|
-
control
|
|
2057
|
+
control['markAllAsPristine']();
|
|
2015
2058
|
}
|
|
2016
2059
|
else {
|
|
2017
2060
|
control?.markAsPristine();
|
|
2018
2061
|
}
|
|
2019
2062
|
}
|
|
2020
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
2021
|
-
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 }); }
|
|
2022
2065
|
}
|
|
2023
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
2066
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormControlMarkPristineDirective, decorators: [{
|
|
2024
2067
|
type: Directive,
|
|
2025
2068
|
args: [{
|
|
2026
|
-
selector: '[rxapFormControlMarkPristine]'
|
|
2069
|
+
selector: '[rxapFormControlMarkPristine]',
|
|
2070
|
+
standalone: true,
|
|
2027
2071
|
}]
|
|
2028
2072
|
}], ctorParameters: function () { return [{ type: i1.ControlContainer }]; }, propDecorators: { onClick: [{
|
|
2029
2073
|
type: HostListener,
|
|
@@ -2065,17 +2109,19 @@ class FormSubmitDirective extends ConfirmClick {
|
|
|
2065
2109
|
ngOnDestroy() {
|
|
2066
2110
|
this.subscription?.unsubscribe();
|
|
2067
2111
|
}
|
|
2068
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
2069
|
-
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 }); }
|
|
2070
2114
|
}
|
|
2071
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
2115
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormSubmitDirective, decorators: [{
|
|
2072
2116
|
type: Directive,
|
|
2073
2117
|
args: [{
|
|
2074
2118
|
selector: '[rxapFormSubmit]',
|
|
2119
|
+
// eslint-disable-next-line @angular-eslint/no-host-metadata-property
|
|
2075
2120
|
host: {
|
|
2076
2121
|
'(click)': 'onClick()',
|
|
2077
2122
|
'(confirmed)': 'onConfirm()',
|
|
2078
|
-
}
|
|
2123
|
+
},
|
|
2124
|
+
standalone: true,
|
|
2079
2125
|
}]
|
|
2080
2126
|
}], ctorParameters: function () { return [{ type: FormDirective, decorators: [{
|
|
2081
2127
|
type: Inject,
|
|
@@ -2091,8 +2137,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
2091
2137
|
}, {
|
|
2092
2138
|
type: Input
|
|
2093
2139
|
}], resetAfterSubmit: [{
|
|
2094
|
-
type: Input
|
|
2095
|
-
args: ['resetAfterSubmit']
|
|
2140
|
+
type: Input
|
|
2096
2141
|
}], navigateAfterSubmit: [{
|
|
2097
2142
|
type: Input
|
|
2098
2143
|
}], afterSubmit: [{
|
|
@@ -2113,25 +2158,26 @@ class FormGroupNameDirective extends FormGroupName {
|
|
|
2113
2158
|
constructor(parent, validators, asyncValidators) {
|
|
2114
2159
|
super(parent, validators, asyncValidators);
|
|
2115
2160
|
}
|
|
2116
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
2117
|
-
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: [
|
|
2118
2163
|
{
|
|
2119
2164
|
provide: ControlContainer,
|
|
2120
|
-
useExisting: forwardRef(() => FormGroupNameDirective)
|
|
2121
|
-
}
|
|
2165
|
+
useExisting: forwardRef(() => FormGroupNameDirective),
|
|
2166
|
+
},
|
|
2122
2167
|
], exportAs: ["rxapFormGroup"], usesInheritance: true, ngImport: i0 }); }
|
|
2123
2168
|
}
|
|
2124
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
2169
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormGroupNameDirective, decorators: [{
|
|
2125
2170
|
type: Directive,
|
|
2126
2171
|
args: [{
|
|
2127
2172
|
selector: '[rxapFormGroupName]',
|
|
2128
2173
|
providers: [
|
|
2129
2174
|
{
|
|
2130
2175
|
provide: ControlContainer,
|
|
2131
|
-
useExisting: forwardRef(() => FormGroupNameDirective)
|
|
2132
|
-
}
|
|
2176
|
+
useExisting: forwardRef(() => FormGroupNameDirective),
|
|
2177
|
+
},
|
|
2133
2178
|
],
|
|
2134
|
-
exportAs: 'rxapFormGroup'
|
|
2179
|
+
exportAs: 'rxapFormGroup',
|
|
2180
|
+
standalone: true,
|
|
2135
2181
|
}]
|
|
2136
2182
|
}], ctorParameters: function () { return [{ type: i1.ControlContainer, decorators: [{
|
|
2137
2183
|
type: Optional
|
|
@@ -2166,25 +2212,26 @@ class FormControlNameDirective extends FormControlName {
|
|
|
2166
2212
|
constructor(parent, validators, asyncValidators, valueAccessors) {
|
|
2167
2213
|
super(parent, validators, asyncValidators, valueAccessors, null);
|
|
2168
2214
|
}
|
|
2169
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
2170
|
-
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: [
|
|
2171
2217
|
{
|
|
2172
2218
|
provide: NgControl,
|
|
2173
|
-
useExisting: forwardRef(() => FormControlNameDirective)
|
|
2174
|
-
}
|
|
2219
|
+
useExisting: forwardRef(() => FormControlNameDirective),
|
|
2220
|
+
},
|
|
2175
2221
|
], exportAs: ["rxapFormControl"], usesInheritance: true, ngImport: i0 }); }
|
|
2176
2222
|
}
|
|
2177
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
2223
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormControlNameDirective, decorators: [{
|
|
2178
2224
|
type: Directive,
|
|
2179
2225
|
args: [{
|
|
2180
2226
|
selector: '[rxapFormControlName]',
|
|
2181
2227
|
providers: [
|
|
2182
2228
|
{
|
|
2183
2229
|
provide: NgControl,
|
|
2184
|
-
useExisting: forwardRef(() => FormControlNameDirective)
|
|
2185
|
-
}
|
|
2230
|
+
useExisting: forwardRef(() => FormControlNameDirective),
|
|
2231
|
+
},
|
|
2186
2232
|
],
|
|
2187
|
-
exportAs: 'rxapFormControl'
|
|
2233
|
+
exportAs: 'rxapFormControl',
|
|
2234
|
+
standalone: true,
|
|
2188
2235
|
}]
|
|
2189
2236
|
}], ctorParameters: function () { return [{ type: i1.ControlContainer, decorators: [{
|
|
2190
2237
|
type: Optional
|
|
@@ -2217,24 +2264,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
2217
2264
|
}] } });
|
|
2218
2265
|
|
|
2219
2266
|
class ParentControlContainerDirective {
|
|
2220
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
2221
|
-
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: [
|
|
2222
2269
|
{
|
|
2223
2270
|
provide: ControlContainer,
|
|
2224
|
-
useExisting: ControlContainer
|
|
2225
|
-
}
|
|
2271
|
+
useExisting: ControlContainer,
|
|
2272
|
+
},
|
|
2226
2273
|
], ngImport: i0 }); }
|
|
2227
2274
|
}
|
|
2228
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
2275
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ParentControlContainerDirective, decorators: [{
|
|
2229
2276
|
type: Directive,
|
|
2230
2277
|
args: [{
|
|
2278
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
2231
2279
|
selector: '[formControlName][parentControlContainer],[formControlGroup][parentControlContainer]',
|
|
2232
2280
|
providers: [
|
|
2233
2281
|
{
|
|
2234
2282
|
provide: ControlContainer,
|
|
2235
|
-
useExisting: ControlContainer
|
|
2236
|
-
}
|
|
2237
|
-
]
|
|
2283
|
+
useExisting: ControlContainer,
|
|
2284
|
+
},
|
|
2285
|
+
],
|
|
2286
|
+
standalone: true,
|
|
2238
2287
|
}]
|
|
2239
2288
|
}] });
|
|
2240
2289
|
|
|
@@ -2253,13 +2302,14 @@ class FormSubmitSuccessfulDirective {
|
|
|
2253
2302
|
ngOnDestroy() {
|
|
2254
2303
|
this.subscription?.unsubscribe();
|
|
2255
2304
|
}
|
|
2256
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
2257
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.
|
|
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 }); }
|
|
2258
2307
|
}
|
|
2259
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
2308
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormSubmitSuccessfulDirective, decorators: [{
|
|
2260
2309
|
type: Directive,
|
|
2261
2310
|
args: [{
|
|
2262
|
-
selector: '[rxapFormSubmitSuccessful]'
|
|
2311
|
+
selector: '[rxapFormSubmitSuccessful]',
|
|
2312
|
+
standalone: true,
|
|
2263
2313
|
}]
|
|
2264
2314
|
}], ctorParameters: function () { return [{ type: FormDirective, decorators: [{
|
|
2265
2315
|
type: Inject,
|
|
@@ -2287,13 +2337,14 @@ class FormSubmitInvalidDirective {
|
|
|
2287
2337
|
ngOnDestroy() {
|
|
2288
2338
|
this.subscription?.unsubscribe();
|
|
2289
2339
|
}
|
|
2290
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
2291
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.
|
|
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 }); }
|
|
2292
2342
|
}
|
|
2293
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
2343
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: FormSubmitInvalidDirective, decorators: [{
|
|
2294
2344
|
type: Directive,
|
|
2295
2345
|
args: [{
|
|
2296
|
-
selector: '[rxapFormSubmitInvalid]'
|
|
2346
|
+
selector: '[rxapFormSubmitInvalid]',
|
|
2347
|
+
standalone: true,
|
|
2297
2348
|
}]
|
|
2298
2349
|
}], ctorParameters: function () { return [{ type: FormDirective, decorators: [{
|
|
2299
2350
|
type: Inject,
|
|
@@ -2307,8 +2358,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
2307
2358
|
}] }]; } });
|
|
2308
2359
|
|
|
2309
2360
|
class RxapFormsModule {
|
|
2310
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
2311
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.
|
|
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,
|
|
2312
2363
|
FormSubmitFailedDirective,
|
|
2313
2364
|
FormLoadingDirective,
|
|
2314
2365
|
FormSubmittingDirective,
|
|
@@ -2341,12 +2392,12 @@ class RxapFormsModule {
|
|
|
2341
2392
|
ParentControlContainerDirective,
|
|
2342
2393
|
FormSubmitSuccessfulDirective,
|
|
2343
2394
|
FormSubmitInvalidDirective] }); }
|
|
2344
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.
|
|
2395
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: RxapFormsModule }); }
|
|
2345
2396
|
}
|
|
2346
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
2397
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: RxapFormsModule, decorators: [{
|
|
2347
2398
|
type: NgModule,
|
|
2348
2399
|
args: [{
|
|
2349
|
-
|
|
2400
|
+
imports: [
|
|
2350
2401
|
FormDirective,
|
|
2351
2402
|
FormSubmitFailedDirective,
|
|
2352
2403
|
FormLoadingDirective,
|
|
@@ -2383,7 +2434,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
2383
2434
|
ParentControlContainerDirective,
|
|
2384
2435
|
FormSubmitSuccessfulDirective,
|
|
2385
2436
|
FormSubmitInvalidDirective,
|
|
2386
|
-
]
|
|
2437
|
+
],
|
|
2387
2438
|
}]
|
|
2388
2439
|
}] });
|
|
2389
2440
|
|
|
@@ -2433,11 +2484,16 @@ function IsNumber(control) {
|
|
|
2433
2484
|
return null;
|
|
2434
2485
|
}
|
|
2435
2486
|
if (isNaN(Number(control.value))) {
|
|
2436
|
-
return {
|
|
2487
|
+
return {
|
|
2488
|
+
isNumber: {
|
|
2489
|
+
expected: 'A number or a string representing a number',
|
|
2490
|
+
actual: control.value,
|
|
2491
|
+
},
|
|
2492
|
+
};
|
|
2437
2493
|
}
|
|
2438
2494
|
return null;
|
|
2439
2495
|
}
|
|
2440
|
-
function _IsNumber({ message, options } = {}) {
|
|
2496
|
+
function _IsNumber({ message, options, } = {}) {
|
|
2441
2497
|
return (control) => {
|
|
2442
2498
|
if (control.value === null) {
|
|
2443
2499
|
return null;
|
|
@@ -2447,8 +2503,8 @@ function _IsNumber({ message, options } = {}) {
|
|
|
2447
2503
|
isNumber: {
|
|
2448
2504
|
expected: 'A number value',
|
|
2449
2505
|
actual: control.value,
|
|
2450
|
-
message
|
|
2451
|
-
}
|
|
2506
|
+
message,
|
|
2507
|
+
},
|
|
2452
2508
|
};
|
|
2453
2509
|
}
|
|
2454
2510
|
return null;
|
|
@@ -2465,8 +2521,8 @@ function IsBoolean({ message } = {}) {
|
|
|
2465
2521
|
isBoolean: {
|
|
2466
2522
|
expected: 'A boolean value',
|
|
2467
2523
|
actual: control.value,
|
|
2468
|
-
message
|
|
2469
|
-
}
|
|
2524
|
+
message,
|
|
2525
|
+
},
|
|
2470
2526
|
};
|
|
2471
2527
|
}
|
|
2472
2528
|
return null;
|
|
@@ -2478,13 +2534,16 @@ function IsObject({ message } = {}) {
|
|
|
2478
2534
|
if (control.value === null) {
|
|
2479
2535
|
return null;
|
|
2480
2536
|
}
|
|
2481
|
-
if (!(control.value !==
|
|
2537
|
+
if (!(control.value !==
|
|
2538
|
+
undefined &&
|
|
2539
|
+
(typeof control.value === 'object' || typeof control.value === 'function') &&
|
|
2540
|
+
!Array.isArray(control.value))) {
|
|
2482
2541
|
return {
|
|
2483
2542
|
isObject: {
|
|
2484
2543
|
expected: 'A object value',
|
|
2485
2544
|
actual: control.value,
|
|
2486
|
-
message
|
|
2487
|
-
}
|
|
2545
|
+
message,
|
|
2546
|
+
},
|
|
2488
2547
|
};
|
|
2489
2548
|
}
|
|
2490
2549
|
return null;
|
|
@@ -2501,15 +2560,15 @@ function IsString({ message } = {}) {
|
|
|
2501
2560
|
isString: {
|
|
2502
2561
|
expected: 'A string value',
|
|
2503
2562
|
actual: control.value,
|
|
2504
|
-
message
|
|
2505
|
-
}
|
|
2563
|
+
message,
|
|
2564
|
+
},
|
|
2506
2565
|
};
|
|
2507
2566
|
}
|
|
2508
2567
|
return null;
|
|
2509
2568
|
};
|
|
2510
2569
|
}
|
|
2511
2570
|
|
|
2512
|
-
function IsInt({ message, options } = {}) {
|
|
2571
|
+
function IsInt({ message, options, } = {}) {
|
|
2513
2572
|
return (control) => {
|
|
2514
2573
|
if (control.value === null) {
|
|
2515
2574
|
return null;
|
|
@@ -2519,15 +2578,15 @@ function IsInt({ message, options } = {}) {
|
|
|
2519
2578
|
isInt: {
|
|
2520
2579
|
expected: 'A int value',
|
|
2521
2580
|
actual: control.value,
|
|
2522
|
-
message
|
|
2523
|
-
}
|
|
2581
|
+
message,
|
|
2582
|
+
},
|
|
2524
2583
|
};
|
|
2525
2584
|
}
|
|
2526
2585
|
return null;
|
|
2527
2586
|
};
|
|
2528
2587
|
}
|
|
2529
2588
|
|
|
2530
|
-
function IsEnum({ message, entity }) {
|
|
2589
|
+
function IsEnum({ message, entity, }) {
|
|
2531
2590
|
return (control) => {
|
|
2532
2591
|
if (control.value === null) {
|
|
2533
2592
|
return null;
|
|
@@ -2537,8 +2596,8 @@ function IsEnum({ message, entity }) {
|
|
|
2537
2596
|
isEnum: {
|
|
2538
2597
|
expected: 'A enum value',
|
|
2539
2598
|
actual: control.value,
|
|
2540
|
-
message
|
|
2541
|
-
}
|
|
2599
|
+
message,
|
|
2600
|
+
},
|
|
2542
2601
|
};
|
|
2543
2602
|
}
|
|
2544
2603
|
return null;
|
|
@@ -2555,8 +2614,8 @@ function IsDate({ message } = {}) {
|
|
|
2555
2614
|
isDate: {
|
|
2556
2615
|
expected: 'A date value',
|
|
2557
2616
|
actual: control.value,
|
|
2558
|
-
message
|
|
2559
|
-
}
|
|
2617
|
+
message,
|
|
2618
|
+
},
|
|
2560
2619
|
};
|
|
2561
2620
|
}
|
|
2562
2621
|
return null;
|
|
@@ -2573,8 +2632,8 @@ function IsArray({ message } = {}) {
|
|
|
2573
2632
|
isArray: {
|
|
2574
2633
|
expected: 'A array value',
|
|
2575
2634
|
actual: control.value,
|
|
2576
|
-
message
|
|
2577
|
-
}
|
|
2635
|
+
message,
|
|
2636
|
+
},
|
|
2578
2637
|
};
|
|
2579
2638
|
}
|
|
2580
2639
|
return null;
|
|
@@ -2587,14 +2646,14 @@ const regexOptions = {
|
|
|
2587
2646
|
digit: '.*[0-9]',
|
|
2588
2647
|
lowercase: '.*[a-z]',
|
|
2589
2648
|
upperLower: '.*[a-zA-Z]',
|
|
2590
|
-
alphaNumeric: '.*[a-zA-Z0-9]'
|
|
2649
|
+
alphaNumeric: '.*[a-zA-Z0-9]',
|
|
2591
2650
|
};
|
|
2592
2651
|
const lengthOptions = {
|
|
2593
2652
|
min: '.{n,}',
|
|
2594
2653
|
max: '.{0,n}',
|
|
2595
2654
|
range: '.{min,max}',
|
|
2596
2655
|
exact: '.{n}',
|
|
2597
|
-
no_limit: '.*'
|
|
2656
|
+
no_limit: '.*',
|
|
2598
2657
|
};
|
|
2599
2658
|
function inOperator(k, o) {
|
|
2600
2659
|
return k in o;
|
|
@@ -2625,7 +2684,6 @@ function create(options) {
|
|
|
2625
2684
|
return regex;
|
|
2626
2685
|
}
|
|
2627
2686
|
function check(str, regexStringOrOptions) {
|
|
2628
|
-
let regex;
|
|
2629
2687
|
let regexString;
|
|
2630
2688
|
if (typeof regexStringOrOptions === 'object') {
|
|
2631
2689
|
regexString = create(regexStringOrOptions);
|
|
@@ -2633,8 +2691,7 @@ function check(str, regexStringOrOptions) {
|
|
|
2633
2691
|
else {
|
|
2634
2692
|
regexString = regexStringOrOptions;
|
|
2635
2693
|
}
|
|
2636
|
-
|
|
2637
|
-
return regex.test(str);
|
|
2694
|
+
return new RegExp(regexString).test(str);
|
|
2638
2695
|
}
|
|
2639
2696
|
function checkError(str, options) {
|
|
2640
2697
|
const returnObject = {};
|
|
@@ -2643,7 +2700,7 @@ function checkError(str, options) {
|
|
|
2643
2700
|
}
|
|
2644
2701
|
return returnObject;
|
|
2645
2702
|
}
|
|
2646
|
-
function IsComplex({ message, options }) {
|
|
2703
|
+
function IsComplex({ message, options, }) {
|
|
2647
2704
|
return (control) => {
|
|
2648
2705
|
if (control.value === null) {
|
|
2649
2706
|
return null;
|
|
@@ -2658,15 +2715,15 @@ function IsComplex({ message, options }) {
|
|
|
2658
2715
|
isComplex: {
|
|
2659
2716
|
expected: options,
|
|
2660
2717
|
actual: errors,
|
|
2661
|
-
message
|
|
2662
|
-
}
|
|
2718
|
+
message,
|
|
2719
|
+
},
|
|
2663
2720
|
};
|
|
2664
2721
|
}
|
|
2665
2722
|
return null;
|
|
2666
2723
|
};
|
|
2667
2724
|
}
|
|
2668
2725
|
|
|
2669
|
-
function IsPhoneNumber({ message, locale, options } = {}) {
|
|
2726
|
+
function IsPhoneNumber({ message, locale, options, } = {}) {
|
|
2670
2727
|
return (control) => {
|
|
2671
2728
|
if (control.value === null) {
|
|
2672
2729
|
return null;
|
|
@@ -2676,15 +2733,15 @@ function IsPhoneNumber({ message, locale, options } = {}) {
|
|
|
2676
2733
|
isPhoneNumber: {
|
|
2677
2734
|
expected: 'A phone number value',
|
|
2678
2735
|
actual: control.value,
|
|
2679
|
-
message
|
|
2680
|
-
}
|
|
2736
|
+
message,
|
|
2737
|
+
},
|
|
2681
2738
|
};
|
|
2682
2739
|
}
|
|
2683
2740
|
return null;
|
|
2684
2741
|
};
|
|
2685
2742
|
}
|
|
2686
2743
|
|
|
2687
|
-
function IsEmail({ message, options } = {}) {
|
|
2744
|
+
function IsEmail({ message, options, } = {}) {
|
|
2688
2745
|
return (control) => {
|
|
2689
2746
|
if (control.value === null) {
|
|
2690
2747
|
return null;
|
|
@@ -2694,15 +2751,15 @@ function IsEmail({ message, options } = {}) {
|
|
|
2694
2751
|
isEmail: {
|
|
2695
2752
|
expected: 'A email value',
|
|
2696
2753
|
actual: control.value,
|
|
2697
|
-
message
|
|
2698
|
-
}
|
|
2754
|
+
message,
|
|
2755
|
+
},
|
|
2699
2756
|
};
|
|
2700
2757
|
}
|
|
2701
2758
|
return null;
|
|
2702
2759
|
};
|
|
2703
2760
|
}
|
|
2704
2761
|
|
|
2705
|
-
function IsUrl({ message, options } = {}) {
|
|
2762
|
+
function IsUrl({ message, options, } = {}) {
|
|
2706
2763
|
return (control) => {
|
|
2707
2764
|
if (control.value === null) {
|
|
2708
2765
|
return null;
|
|
@@ -2712,15 +2769,15 @@ function IsUrl({ message, options } = {}) {
|
|
|
2712
2769
|
isURL: {
|
|
2713
2770
|
expected: 'A url value',
|
|
2714
2771
|
actual: control.value,
|
|
2715
|
-
message
|
|
2716
|
-
}
|
|
2772
|
+
message,
|
|
2773
|
+
},
|
|
2717
2774
|
};
|
|
2718
2775
|
}
|
|
2719
2776
|
return null;
|
|
2720
2777
|
};
|
|
2721
2778
|
}
|
|
2722
2779
|
|
|
2723
|
-
function IsIP({ message, version } = {}) {
|
|
2780
|
+
function IsIP({ message, version, } = {}) {
|
|
2724
2781
|
return (control) => {
|
|
2725
2782
|
if (control.value === null) {
|
|
2726
2783
|
return null;
|
|
@@ -2730,8 +2787,8 @@ function IsIP({ message, version } = {}) {
|
|
|
2730
2787
|
isIp: {
|
|
2731
2788
|
expected: `A valid IPv${version ?? '4'} value`,
|
|
2732
2789
|
actual: control.value,
|
|
2733
|
-
message
|
|
2734
|
-
}
|
|
2790
|
+
message,
|
|
2791
|
+
},
|
|
2735
2792
|
};
|
|
2736
2793
|
}
|
|
2737
2794
|
return null;
|
|
@@ -2748,15 +2805,15 @@ function IsPort({ message } = {}) {
|
|
|
2748
2805
|
isPort: {
|
|
2749
2806
|
expected: `A valid port number between 1 and 65535`,
|
|
2750
2807
|
actual: control.value,
|
|
2751
|
-
message
|
|
2752
|
-
}
|
|
2808
|
+
message,
|
|
2809
|
+
},
|
|
2753
2810
|
};
|
|
2754
2811
|
}
|
|
2755
2812
|
return null;
|
|
2756
2813
|
};
|
|
2757
2814
|
}
|
|
2758
2815
|
|
|
2759
|
-
function IsUUID({ message, version = 'all' } = {}) {
|
|
2816
|
+
function IsUUID({ message, version = 'all', } = {}) {
|
|
2760
2817
|
return (control) => {
|
|
2761
2818
|
if (control.value === null) {
|
|
2762
2819
|
return null;
|
|
@@ -2766,8 +2823,8 @@ function IsUUID({ message, version = 'all' } = {}) {
|
|
|
2766
2823
|
isUuid: {
|
|
2767
2824
|
expected: version === 'all' ? `A valid uuid` : `A valid uuid version ${version}`,
|
|
2768
2825
|
actual: control.value,
|
|
2769
|
-
message
|
|
2770
|
-
}
|
|
2826
|
+
message,
|
|
2827
|
+
},
|
|
2771
2828
|
};
|
|
2772
2829
|
}
|
|
2773
2830
|
return null;
|