@rxap/forms 12.7.0 → 13.0.0-next.0
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/esm2020/index.mjs +53 -0
- package/esm2020/lib/control-actions.mjs +77 -0
- package/esm2020/lib/control-value-accessor.mjs +14 -0
- package/esm2020/lib/decorators/control-async-validator.mjs +10 -0
- package/esm2020/lib/decorators/control-change.mjs +10 -0
- package/esm2020/lib/decorators/control-set-value.mjs +11 -0
- package/esm2020/lib/decorators/control-validator.mjs +10 -0
- package/esm2020/lib/decorators/form.mjs +7 -0
- package/esm2020/lib/decorators/metadata-keys.mjs +12 -0
- package/esm2020/lib/decorators/use-form-array.mjs +13 -0
- package/esm2020/lib/decorators/use-form-control.mjs +8 -0
- package/esm2020/lib/decorators/use-form-group.mjs +8 -0
- package/esm2020/lib/directives/form-control-error.directive.mjs +59 -0
- package/esm2020/lib/directives/form-control-mark-dirty.directive.mjs +31 -0
- package/esm2020/lib/directives/form-control-mark-pristine.directive.mjs +31 -0
- package/esm2020/lib/directives/form-control-mark-touched.directive.mjs +24 -0
- package/esm2020/lib/directives/form-control-mark-untouched.directive.mjs +31 -0
- package/esm2020/lib/directives/form-control-name.directive.mjs +64 -0
- package/esm2020/lib/directives/form-group-name.directive.mjs +61 -0
- package/esm2020/lib/directives/form-loaded.directive.mjs +41 -0
- package/esm2020/lib/directives/form-loading-error.directive.mjs +41 -0
- package/esm2020/lib/directives/form-loading.directive.mjs +41 -0
- package/esm2020/lib/directives/form-submit-failed.directive.mjs +41 -0
- package/esm2020/lib/directives/form-submit-invalid.directive.mjs +39 -0
- package/esm2020/lib/directives/form-submit-successful.directive.mjs +39 -0
- package/esm2020/lib/directives/form-submit.directive.mjs +74 -0
- package/esm2020/lib/directives/form-submitting.directive.mjs +41 -0
- package/esm2020/lib/directives/form.directive.mjs +541 -0
- package/esm2020/lib/directives/forms.module.mjs +100 -0
- package/esm2020/lib/directives/models.mjs +12 -0
- package/esm2020/lib/directives/parent-control-container.directive.mjs +25 -0
- package/esm2020/lib/directives/tokens.mjs +10 -0
- package/esm2020/lib/form-array.mjs +216 -0
- package/esm2020/lib/form-builder.mjs +374 -0
- package/esm2020/lib/form-control.mjs +169 -0
- package/esm2020/lib/form-group.mjs +181 -0
- package/esm2020/lib/model.mjs +2 -0
- package/esm2020/lib/tokens.mjs +4 -0
- package/esm2020/lib/types.mjs +2 -0
- package/esm2020/lib/validators/index.mjs +29 -0
- package/esm2020/lib/validators/is-array.mjs +18 -0
- package/esm2020/lib/validators/is-boolean.mjs +18 -0
- package/esm2020/lib/validators/is-complex.mjs +87 -0
- package/esm2020/lib/validators/is-date.mjs +18 -0
- package/esm2020/lib/validators/is-email.mjs +19 -0
- package/esm2020/lib/validators/is-enum.mjs +18 -0
- package/esm2020/lib/validators/is-int.mjs +19 -0
- package/esm2020/lib/validators/is-ip.mjs +19 -0
- package/esm2020/lib/validators/is-number.mjs +56 -0
- package/esm2020/lib/validators/is-object.mjs +18 -0
- package/esm2020/lib/validators/is-phone-number.mjs +19 -0
- package/esm2020/lib/validators/is-string.mjs +18 -0
- package/esm2020/lib/validators/is-url.mjs +19 -0
- package/esm2020/rxap-forms.mjs +5 -0
- package/fesm2015/rxap-forms.mjs +2713 -0
- package/fesm2015/rxap-forms.mjs.map +1 -0
- package/{fesm2015/rxap-forms.js → fesm2020/rxap-forms.mjs} +176 -144
- package/fesm2020/rxap-forms.mjs.map +1 -0
- package/lib/directives/form.directive.d.ts +2 -2
- package/package.json +35 -21
- package/src/schematics/ng-add/index.js +1 -1
- package/src/schematics/ng-add/index.js.map +1 -1
- package/bundles/rxap-forms.umd.js +0 -3473
- package/bundles/rxap-forms.umd.js.map +0 -1
- package/esm2015/index.js +0 -53
- package/esm2015/index.js.map +0 -1
- package/esm2015/lib/control-actions.js +0 -80
- package/esm2015/lib/control-actions.js.map +0 -1
- package/esm2015/lib/control-value-accessor.js +0 -14
- package/esm2015/lib/control-value-accessor.js.map +0 -1
- package/esm2015/lib/decorators/control-async-validator.js +0 -10
- package/esm2015/lib/decorators/control-async-validator.js.map +0 -1
- package/esm2015/lib/decorators/control-change.js +0 -10
- package/esm2015/lib/decorators/control-change.js.map +0 -1
- package/esm2015/lib/decorators/control-set-value.js +0 -8
- package/esm2015/lib/decorators/control-set-value.js.map +0 -1
- package/esm2015/lib/decorators/control-validator.js +0 -10
- package/esm2015/lib/decorators/control-validator.js.map +0 -1
- package/esm2015/lib/decorators/form.js +0 -7
- package/esm2015/lib/decorators/form.js.map +0 -1
- package/esm2015/lib/decorators/metadata-keys.js +0 -12
- package/esm2015/lib/decorators/metadata-keys.js.map +0 -1
- package/esm2015/lib/decorators/use-form-array.js +0 -13
- package/esm2015/lib/decorators/use-form-array.js.map +0 -1
- package/esm2015/lib/decorators/use-form-control.js +0 -8
- package/esm2015/lib/decorators/use-form-control.js.map +0 -1
- package/esm2015/lib/decorators/use-form-group.js +0 -8
- package/esm2015/lib/decorators/use-form-group.js.map +0 -1
- package/esm2015/lib/directives/form-control-error.directive.js +0 -61
- package/esm2015/lib/directives/form-control-error.directive.js.map +0 -1
- package/esm2015/lib/directives/form-control-mark-dirty.directive.js +0 -31
- package/esm2015/lib/directives/form-control-mark-dirty.directive.js.map +0 -1
- package/esm2015/lib/directives/form-control-mark-pristine.directive.js +0 -31
- package/esm2015/lib/directives/form-control-mark-pristine.directive.js.map +0 -1
- package/esm2015/lib/directives/form-control-mark-touched.directive.js +0 -25
- package/esm2015/lib/directives/form-control-mark-touched.directive.js.map +0 -1
- package/esm2015/lib/directives/form-control-mark-untouched.directive.js +0 -31
- package/esm2015/lib/directives/form-control-mark-untouched.directive.js.map +0 -1
- package/esm2015/lib/directives/form-control-name.directive.js +0 -64
- package/esm2015/lib/directives/form-control-name.directive.js.map +0 -1
- package/esm2015/lib/directives/form-group-name.directive.js +0 -61
- package/esm2015/lib/directives/form-group-name.directive.js.map +0 -1
- package/esm2015/lib/directives/form-loaded.directive.js +0 -42
- package/esm2015/lib/directives/form-loaded.directive.js.map +0 -1
- package/esm2015/lib/directives/form-loading-error.directive.js +0 -42
- package/esm2015/lib/directives/form-loading-error.directive.js.map +0 -1
- package/esm2015/lib/directives/form-loading.directive.js +0 -42
- package/esm2015/lib/directives/form-loading.directive.js.map +0 -1
- package/esm2015/lib/directives/form-submit-failed.directive.js +0 -42
- package/esm2015/lib/directives/form-submit-failed.directive.js.map +0 -1
- package/esm2015/lib/directives/form-submit-invalid.directive.js +0 -40
- package/esm2015/lib/directives/form-submit-invalid.directive.js.map +0 -1
- package/esm2015/lib/directives/form-submit-successful.directive.js +0 -40
- package/esm2015/lib/directives/form-submit-successful.directive.js.map +0 -1
- package/esm2015/lib/directives/form-submit.directive.js +0 -75
- package/esm2015/lib/directives/form-submit.directive.js.map +0 -1
- package/esm2015/lib/directives/form-submitting.directive.js +0 -42
- package/esm2015/lib/directives/form-submitting.directive.js.map +0 -1
- package/esm2015/lib/directives/form.directive.js +0 -518
- package/esm2015/lib/directives/form.directive.js.map +0 -1
- package/esm2015/lib/directives/forms.module.js +0 -100
- package/esm2015/lib/directives/forms.module.js.map +0 -1
- package/esm2015/lib/directives/models.js +0 -12
- package/esm2015/lib/directives/models.js.map +0 -1
- package/esm2015/lib/directives/parent-control-container.directive.js +0 -25
- package/esm2015/lib/directives/parent-control-container.directive.js.map +0 -1
- package/esm2015/lib/directives/tokens.js +0 -10
- package/esm2015/lib/directives/tokens.js.map +0 -1
- package/esm2015/lib/form-array.js +0 -217
- package/esm2015/lib/form-array.js.map +0 -1
- package/esm2015/lib/form-builder.js +0 -349
- package/esm2015/lib/form-builder.js.map +0 -1
- package/esm2015/lib/form-control.js +0 -170
- package/esm2015/lib/form-control.js.map +0 -1
- package/esm2015/lib/form-group.js +0 -183
- package/esm2015/lib/form-group.js.map +0 -1
- package/esm2015/lib/model.js +0 -2
- package/esm2015/lib/model.js.map +0 -1
- package/esm2015/lib/tokens.js +0 -4
- package/esm2015/lib/tokens.js.map +0 -1
- package/esm2015/lib/types.js +0 -2
- package/esm2015/lib/types.js.map +0 -1
- package/esm2015/lib/validators/index.js +0 -29
- package/esm2015/lib/validators/index.js.map +0 -1
- package/esm2015/lib/validators/is-array.js +0 -18
- package/esm2015/lib/validators/is-array.js.map +0 -1
- package/esm2015/lib/validators/is-boolean.js +0 -18
- package/esm2015/lib/validators/is-boolean.js.map +0 -1
- package/esm2015/lib/validators/is-complex.js +0 -87
- package/esm2015/lib/validators/is-complex.js.map +0 -1
- package/esm2015/lib/validators/is-date.js +0 -18
- package/esm2015/lib/validators/is-date.js.map +0 -1
- package/esm2015/lib/validators/is-email.js +0 -19
- package/esm2015/lib/validators/is-email.js.map +0 -1
- package/esm2015/lib/validators/is-enum.js +0 -18
- package/esm2015/lib/validators/is-enum.js.map +0 -1
- package/esm2015/lib/validators/is-int.js +0 -19
- package/esm2015/lib/validators/is-int.js.map +0 -1
- package/esm2015/lib/validators/is-ip.js +0 -19
- package/esm2015/lib/validators/is-ip.js.map +0 -1
- package/esm2015/lib/validators/is-number.js +0 -57
- package/esm2015/lib/validators/is-number.js.map +0 -1
- package/esm2015/lib/validators/is-object.js +0 -18
- package/esm2015/lib/validators/is-object.js.map +0 -1
- package/esm2015/lib/validators/is-phone-number.js +0 -19
- package/esm2015/lib/validators/is-phone-number.js.map +0 -1
- package/esm2015/lib/validators/is-string.js +0 -18
- package/esm2015/lib/validators/is-string.js.map +0 -1
- package/esm2015/lib/validators/is-url.js +0 -19
- package/esm2015/lib/validators/is-url.js.map +0 -1
- package/esm2015/rxap-forms.js +0 -5
- package/esm2015/rxap-forms.js.map +0 -1
- package/fesm2015/rxap-forms.js.map +0 -1
|
@@ -26,16 +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
|
-
|
|
30
|
-
return merge(defer(() => of(control.disabled)), merge(control.statusChanges, (_a = control.stateChanges) !== null && _a !== void 0 ? _a : EMPTY).pipe(map(() => control.disabled), distinctUntilChanged()));
|
|
29
|
+
return merge(defer(() => of(control.disabled)), merge(control.statusChanges, control.stateChanges ?? EMPTY).pipe(map(() => control.disabled), distinctUntilChanged()));
|
|
31
30
|
}
|
|
32
31
|
function controlEnabled$(control) {
|
|
33
|
-
|
|
34
|
-
return merge(defer(() => of(control.enabled)), merge(control.statusChanges, (_a = control.stateChanges) !== null && _a !== void 0 ? _a : EMPTY).pipe(map(() => control.enabled), distinctUntilChanged()));
|
|
32
|
+
return merge(defer(() => of(control.enabled)), merge(control.statusChanges, control.stateChanges ?? EMPTY).pipe(map(() => control.enabled), distinctUntilChanged()));
|
|
35
33
|
}
|
|
36
34
|
function controlReadonly$(control) {
|
|
37
|
-
|
|
38
|
-
return merge(defer(() => { var _a; return of((_a = control.readonly) !== null && _a !== void 0 ? _a : false); }), merge(control.statusChanges, (_a = control.stateChanges) !== null && _a !== void 0 ? _a : EMPTY).pipe(map(() => { var _a; return (_a = control.readonly) !== null && _a !== void 0 ? _a : false; }), distinctUntilChanged()));
|
|
35
|
+
return merge(defer(() => of(control.readonly ?? false)), merge(control.statusChanges, control.stateChanges ?? EMPTY).pipe(map(() => control.readonly ?? false), distinctUntilChanged()));
|
|
39
36
|
}
|
|
40
37
|
function controlStatusChanges$(control) {
|
|
41
38
|
return merge(defer(() => of(control.status)), control.statusChanges.pipe(map(() => control.status), distinctUntilChanged()));
|
|
@@ -117,12 +114,11 @@ class RxapFormArray extends FormArray {
|
|
|
117
114
|
this._controlRemovedFn = options.controlRemovedFn;
|
|
118
115
|
}
|
|
119
116
|
get readonly() {
|
|
120
|
-
|
|
121
|
-
return (_b = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.readonly) !== null && _b !== void 0 ? _b : this._readonly;
|
|
117
|
+
return this.parent?.readonly ?? this._readonly;
|
|
122
118
|
}
|
|
123
119
|
set readonly(value) {
|
|
124
120
|
this._readonly = value;
|
|
125
|
-
this.controls.forEach(control =>
|
|
121
|
+
this.controls.forEach(control => control.stateChanges?.next());
|
|
126
122
|
}
|
|
127
123
|
/**
|
|
128
124
|
* @internal
|
|
@@ -174,7 +170,7 @@ class RxapFormArray extends FormArray {
|
|
|
174
170
|
* @param state (optional) the initial state of the new control
|
|
175
171
|
*/
|
|
176
172
|
insertAt(index, state) {
|
|
177
|
-
const insertIndex = index
|
|
173
|
+
const insertIndex = index ?? this.controls.length;
|
|
178
174
|
const controlOrDefinition = this._builder(state, {
|
|
179
175
|
controlId: insertIndex.toFixed(0),
|
|
180
176
|
});
|
|
@@ -346,13 +342,11 @@ class RxapFormGroup extends FormGroup {
|
|
|
346
342
|
return this.parent.rxapFormDefinition;
|
|
347
343
|
}
|
|
348
344
|
get readonly() {
|
|
349
|
-
|
|
350
|
-
return (_b = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.readonly) !== null && _b !== void 0 ? _b : this._readonly;
|
|
345
|
+
return this.parent?.readonly ?? this._readonly;
|
|
351
346
|
}
|
|
352
347
|
set readonly(value) {
|
|
353
|
-
var _a;
|
|
354
348
|
this._readonly = value;
|
|
355
|
-
Object.values(
|
|
349
|
+
Object.values(this.controls ?? {}).forEach(control => control.stateChanges?.next());
|
|
356
350
|
}
|
|
357
351
|
get controlPath() {
|
|
358
352
|
const parent = this.parent;
|
|
@@ -525,8 +519,7 @@ class RxapFormControl extends FormControl {
|
|
|
525
519
|
return this.parent.rxapFormDefinition;
|
|
526
520
|
}
|
|
527
521
|
get readonly() {
|
|
528
|
-
|
|
529
|
-
return (_b = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.readonly) !== null && _b !== void 0 ? _b : this._readonly;
|
|
522
|
+
return this.parent?.readonly ?? this._readonly;
|
|
530
523
|
}
|
|
531
524
|
set readonly(value) {
|
|
532
525
|
this._readonly = value;
|
|
@@ -608,7 +601,7 @@ class RxapFormControl extends FormControl {
|
|
|
608
601
|
this.markAsDirty({ onlySelf: true });
|
|
609
602
|
}
|
|
610
603
|
reset(formState, options) {
|
|
611
|
-
const newState = formState
|
|
604
|
+
const newState = formState ?? this.initialState;
|
|
612
605
|
if (typeof newState === 'function') {
|
|
613
606
|
super.reset(newState(), options);
|
|
614
607
|
}
|
|
@@ -686,7 +679,6 @@ class FormArrayControlManager {
|
|
|
686
679
|
}
|
|
687
680
|
class RxapFormBuilder {
|
|
688
681
|
constructor(definition, injector = Injector.NULL, providers = []) {
|
|
689
|
-
var _a;
|
|
690
682
|
this.definition = definition;
|
|
691
683
|
this.injector = injector;
|
|
692
684
|
this.formArrayGroups = this.extractArrayGroups();
|
|
@@ -701,12 +693,11 @@ class RxapFormBuilder {
|
|
|
701
693
|
// merge the providers from the from options with the providers from the
|
|
702
694
|
// constructor. If the provider is defined in the form options and constructor
|
|
703
695
|
// then the provider from the constructor will be used.
|
|
704
|
-
this.providers = [...providers, ...(
|
|
696
|
+
this.providers = [...providers, ...(formOptions.providers ?? [])].filter((provider, index, self) => provider.hasOwnProperty('provide') &&
|
|
705
697
|
self.findIndex((selfProvider) => selfProvider.hasOwnProperty('provide') &&
|
|
706
698
|
selfProvider.provide === provider.provide) === index);
|
|
707
699
|
}
|
|
708
700
|
build(state = {}, options = {}) {
|
|
709
|
-
var _a, _b;
|
|
710
701
|
const injector = Injector.create({
|
|
711
702
|
name: `rxap/form-builder/${this.formOptions.id}`,
|
|
712
703
|
parent: this.injector,
|
|
@@ -730,7 +721,11 @@ class RxapFormBuilder {
|
|
|
730
721
|
this.buildGroups(state, form, controls);
|
|
731
722
|
this.buildArrayGroups(state, form, controls);
|
|
732
723
|
this.buildArrayControls(state, form, controls);
|
|
733
|
-
const formOptions =
|
|
724
|
+
const formOptions = {
|
|
725
|
+
...this.formOptions,
|
|
726
|
+
controlId: options.controlId ?? (options.id ? options.id : this.formOptions.id),
|
|
727
|
+
...options,
|
|
728
|
+
};
|
|
734
729
|
form.rxapFormGroup = new RxapFormGroup(controls, formOptions);
|
|
735
730
|
Reflect.set(form.rxapFormGroup, '_rxapFormDefinition', form);
|
|
736
731
|
form.rxapMetadata = this.formOptions;
|
|
@@ -739,7 +734,7 @@ class RxapFormBuilder {
|
|
|
739
734
|
}
|
|
740
735
|
for (const control of Object.values(form.rxapFormGroup.controls)) {
|
|
741
736
|
if (control.controlId) {
|
|
742
|
-
const controlSetValueOnInit = Array.from(
|
|
737
|
+
const controlSetValueOnInit = Array.from(this.controlSetValue.get(control.controlId) ?? []).filter((controlSetValueOptions) => controlSetValueOptions.initial);
|
|
743
738
|
for (const onSetValue of this.coerceToFnArray(form, controlSetValueOnInit)) {
|
|
744
739
|
onSetValue(control.value, { initial: true });
|
|
745
740
|
}
|
|
@@ -757,7 +752,15 @@ class RxapFormBuilder {
|
|
|
757
752
|
controls[controlId] =
|
|
758
753
|
new RxapFormArray(
|
|
759
754
|
// TODO : add the formControlOptions property. To definition the form control options
|
|
760
|
-
formControls,
|
|
755
|
+
formControls, {
|
|
756
|
+
...options,
|
|
757
|
+
controlId,
|
|
758
|
+
validators: [],
|
|
759
|
+
asyncValidators: [],
|
|
760
|
+
controlInsertedFn: manager.inserted.bind(manager),
|
|
761
|
+
controlRemovedFn: manager.removed.bind(manager),
|
|
762
|
+
builder: (state, controlOptions) => new RxapFormControl(state, controlOptions),
|
|
763
|
+
}));
|
|
761
764
|
// TODO : add support for injectable validators
|
|
762
765
|
formArray.setValidators(this.coerceToValidatorArray(form, options.validators, this.validators.get(controlId)), false);
|
|
763
766
|
formArray.setAsyncValidators(this.coerceToValidatorArray(form, options.asyncValidators, this.asyncValidators.get(controlId)), false);
|
|
@@ -774,7 +777,15 @@ class RxapFormBuilder {
|
|
|
774
777
|
const manager = new FormArrayControlManager(form, controlId);
|
|
775
778
|
const formArray = (formGroupDefinitions.rxapFormArray =
|
|
776
779
|
controls[controlId] =
|
|
777
|
-
new RxapFormArray(formGroupDefinitions.map((fgd) => fgd.rxapFormGroup),
|
|
780
|
+
new RxapFormArray(formGroupDefinitions.map((fgd) => fgd.rxapFormGroup), {
|
|
781
|
+
...options,
|
|
782
|
+
builder: formGroupBuilder.build.bind(formGroupBuilder),
|
|
783
|
+
controlId,
|
|
784
|
+
validators: [],
|
|
785
|
+
asyncValidators: [],
|
|
786
|
+
controlInsertedFn: manager.inserted.bind(manager),
|
|
787
|
+
controlRemovedFn: manager.removed.bind(manager)
|
|
788
|
+
}));
|
|
778
789
|
// TODO : add support for injectable validators
|
|
779
790
|
formArray.setValidators(this.coerceToValidatorArray(form, options.validators, this.validators.get(controlId)), false);
|
|
780
791
|
formArray.setAsyncValidators(this.coerceToValidatorArray(form, options.asyncValidators, this.asyncValidators.get(controlId)), false);
|
|
@@ -785,7 +796,11 @@ class RxapFormBuilder {
|
|
|
785
796
|
for (const [controlId, options] of this.formGroups.entries()) {
|
|
786
797
|
const formState = this.coerceToGroupFormState(controlId, {}, builderFormState, options.state);
|
|
787
798
|
assertIsObject(formState);
|
|
788
|
-
const formGroupDefinition = new RxapFormBuilder(options.definition, this.injector, this.providers).build(formState,
|
|
799
|
+
const formGroupDefinition = new RxapFormBuilder(options.definition, this.injector, this.providers).build(formState, {
|
|
800
|
+
...options,
|
|
801
|
+
validators: [],
|
|
802
|
+
asyncValidators: [],
|
|
803
|
+
});
|
|
789
804
|
controls[controlId] = formGroupDefinition.rxapFormGroup;
|
|
790
805
|
const formGroup = formGroupDefinition.rxapFormGroup;
|
|
791
806
|
// TODO : add support for injectable validators
|
|
@@ -796,12 +811,17 @@ class RxapFormBuilder {
|
|
|
796
811
|
}
|
|
797
812
|
}
|
|
798
813
|
buildControls(builderFormState, form, controls) {
|
|
799
|
-
var _a, _b;
|
|
800
814
|
for (const [controlId, options] of this.formControls.entries()) {
|
|
801
|
-
const control = (controls[controlId] = new (
|
|
815
|
+
const control = (controls[controlId] = new (options.controlType ??
|
|
816
|
+
RxapFormControl)(this.coerceToControlFormState(controlId, null, builderFormState, options.state), {
|
|
817
|
+
...options,
|
|
818
|
+
controlId,
|
|
819
|
+
validators: [],
|
|
820
|
+
asyncValidators: [],
|
|
821
|
+
}));
|
|
802
822
|
const injectValidators = [];
|
|
803
823
|
const injectAsyncValidators = [];
|
|
804
|
-
for (const injectValidator of
|
|
824
|
+
for (const injectValidator of options.injectValidators ?? []) {
|
|
805
825
|
const injectableValidator = this.injector.get(injectValidator);
|
|
806
826
|
if (injectableValidator.validate) {
|
|
807
827
|
injectValidators.push(injectableValidator.validate.bind(injectableValidator));
|
|
@@ -887,7 +907,7 @@ class RxapFormBuilder {
|
|
|
887
907
|
formState = builderFormState[controlId];
|
|
888
908
|
}
|
|
889
909
|
else if (optionsFormState !== undefined) {
|
|
890
|
-
formState = optionsFormState
|
|
910
|
+
formState = optionsFormState ?? null;
|
|
891
911
|
}
|
|
892
912
|
if (typeof formState === 'function') {
|
|
893
913
|
formState = formState();
|
|
@@ -957,36 +977,34 @@ class RxapFormBuilder {
|
|
|
957
977
|
return formState;
|
|
958
978
|
}
|
|
959
979
|
extractControlChanges() {
|
|
960
|
-
|
|
961
|
-
|
|
980
|
+
return (getMetadata(MetadataKeys.CONTROL_CHANGES, this.definition.prototype) ??
|
|
981
|
+
new Map());
|
|
962
982
|
}
|
|
963
983
|
extractControlSetValue() {
|
|
964
|
-
|
|
965
|
-
|
|
984
|
+
return (getMetadata(MetadataKeys.CONTROL_SET_VALUE, this.definition.prototype) ??
|
|
985
|
+
new Map());
|
|
966
986
|
}
|
|
967
987
|
extractValidators() {
|
|
968
|
-
|
|
969
|
-
|
|
988
|
+
return (getMetadata(MetadataKeys.CONTROL_VALIDATORS, this.definition.prototype) ??
|
|
989
|
+
new Map());
|
|
970
990
|
}
|
|
971
991
|
extractAsyncValidators() {
|
|
972
|
-
|
|
973
|
-
return ((_a = getMetadata(MetadataKeys.CONTROL_ASYNC_VALIDATORS, this.definition.prototype)) !== null && _a !== void 0 ? _a : new Map());
|
|
992
|
+
return (getMetadata(MetadataKeys.CONTROL_ASYNC_VALIDATORS, this.definition.prototype) ?? new Map());
|
|
974
993
|
}
|
|
975
994
|
extractArrayGroups() {
|
|
976
|
-
|
|
977
|
-
|
|
995
|
+
return (getMetadata(MetadataKeys.FORM_ARRAY_GROUPS, this.definition.prototype) ??
|
|
996
|
+
new Map());
|
|
978
997
|
}
|
|
979
998
|
extractArrayControls() {
|
|
980
|
-
|
|
981
|
-
return ((_a = getMetadata(MetadataKeys.FORM_ARRAY_CONTROLS, this.definition.prototype)) !== null && _a !== void 0 ? _a : new Map());
|
|
999
|
+
return (getMetadata(MetadataKeys.FORM_ARRAY_CONTROLS, this.definition.prototype) ?? new Map());
|
|
982
1000
|
}
|
|
983
1001
|
extractGroups() {
|
|
984
|
-
|
|
985
|
-
|
|
1002
|
+
return (getMetadata(MetadataKeys.FORM_GROUPS, this.definition.prototype) ??
|
|
1003
|
+
new Map());
|
|
986
1004
|
}
|
|
987
1005
|
extractControls() {
|
|
988
|
-
|
|
989
|
-
|
|
1006
|
+
return (getMetadata(MetadataKeys.FORM_CONTROLS, this.definition.prototype) ??
|
|
1007
|
+
new Map());
|
|
990
1008
|
}
|
|
991
1009
|
extractFormOptions() {
|
|
992
1010
|
const options = GetDefinitionMetadata(this.definition);
|
|
@@ -1035,7 +1053,10 @@ function ControlChange(...controlIds) {
|
|
|
1035
1053
|
|
|
1036
1054
|
function ControlSetValue(controlId, options = {}) {
|
|
1037
1055
|
return function (target, propertyKey) {
|
|
1038
|
-
setMetadataMapSet(controlId,
|
|
1056
|
+
setMetadataMapSet(controlId, {
|
|
1057
|
+
...options,
|
|
1058
|
+
propertyKey
|
|
1059
|
+
}, MetadataKeys.CONTROL_SET_VALUE, target);
|
|
1039
1060
|
};
|
|
1040
1061
|
}
|
|
1041
1062
|
|
|
@@ -1049,7 +1070,7 @@ function ControlValidator(...controlIds) {
|
|
|
1049
1070
|
|
|
1050
1071
|
function UseFormArrayGroup(definition, options = {}) {
|
|
1051
1072
|
return function (target, propertyKey) {
|
|
1052
|
-
setMetadataMap(propertyKey,
|
|
1073
|
+
setMetadataMap(propertyKey, { ...options, definition }, MetadataKeys.FORM_ARRAY_GROUPS, target);
|
|
1053
1074
|
};
|
|
1054
1075
|
}
|
|
1055
1076
|
function UseFormArrayControl(options = {}) {
|
|
@@ -1066,7 +1087,7 @@ function UseFormControl(options = {}) {
|
|
|
1066
1087
|
|
|
1067
1088
|
function UseFormGroup(definition, options = {}) {
|
|
1068
1089
|
return function (target, propertyKey) {
|
|
1069
|
-
setMetadataMap(propertyKey,
|
|
1090
|
+
setMetadataMap(propertyKey, { ...options, definition }, MetadataKeys.FORM_GROUPS, target);
|
|
1070
1091
|
};
|
|
1071
1092
|
}
|
|
1072
1093
|
|
|
@@ -1101,7 +1122,6 @@ class FormDirective extends FormGroupDirective {
|
|
|
1101
1122
|
submitSuccessfulMethod = null,
|
|
1102
1123
|
// skip self, bc the token is set to null
|
|
1103
1124
|
formDefinitionBuilder = null, loadingIndicatorService = null) {
|
|
1104
|
-
var _a, _b;
|
|
1105
1125
|
super([], []);
|
|
1106
1126
|
this.cdr = cdr;
|
|
1107
1127
|
this.loadMethod = loadMethod;
|
|
@@ -1115,7 +1135,7 @@ class FormDirective extends FormGroupDirective {
|
|
|
1115
1135
|
* Emits when the submit method is executed without errors. The result of the
|
|
1116
1136
|
* submit method is passed as event object.
|
|
1117
1137
|
*
|
|
1118
|
-
* If no submit method is defined then emit
|
|
1138
|
+
* If no submit method is defined then emit after the submit button
|
|
1119
1139
|
* is clicked.
|
|
1120
1140
|
*/
|
|
1121
1141
|
this.rxapSubmit = new EventEmitter();
|
|
@@ -1138,8 +1158,8 @@ class FormDirective extends FormGroupDirective {
|
|
|
1138
1158
|
this._formDefinition = formDefinition;
|
|
1139
1159
|
this.form = formDefinition.rxapFormGroup;
|
|
1140
1160
|
}
|
|
1141
|
-
|
|
1142
|
-
|
|
1161
|
+
this.loadingIndicatorService?.attachLoading(this.loading$);
|
|
1162
|
+
this.loadingIndicatorService?.attachLoading(this.submitting$);
|
|
1143
1163
|
}
|
|
1144
1164
|
get submitting() {
|
|
1145
1165
|
return this.submitting$.value;
|
|
@@ -1200,6 +1220,32 @@ class FormDirective extends FormGroupDirective {
|
|
|
1200
1220
|
this.submit();
|
|
1201
1221
|
}
|
|
1202
1222
|
else {
|
|
1223
|
+
function reduceErrors(control, errors = {}) {
|
|
1224
|
+
if (control.invalid) {
|
|
1225
|
+
if (control.controls) {
|
|
1226
|
+
if (Array.isArray(control.controls)) {
|
|
1227
|
+
const errorList = [];
|
|
1228
|
+
for (const item of control.controls) {
|
|
1229
|
+
errorList.push(reduceErrors(item));
|
|
1230
|
+
}
|
|
1231
|
+
errors[control.controlId] = errorList;
|
|
1232
|
+
}
|
|
1233
|
+
else {
|
|
1234
|
+
const innerErrors = {};
|
|
1235
|
+
for (const child of Object.values(control.controls)) {
|
|
1236
|
+
reduceErrors(child, innerErrors);
|
|
1237
|
+
}
|
|
1238
|
+
errors[control.controlId] = innerErrors;
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
else {
|
|
1242
|
+
if (control.errors) {
|
|
1243
|
+
errors[control.controlId] = control.errors;
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
return errors;
|
|
1248
|
+
}
|
|
1203
1249
|
if (isDevMode()) {
|
|
1204
1250
|
console.log('Form submit is not valid for: ' + this.form.controlId, this.form.errors);
|
|
1205
1251
|
function printErrorControls(control) {
|
|
@@ -1237,7 +1283,7 @@ class FormDirective extends FormGroupDirective {
|
|
|
1237
1283
|
}
|
|
1238
1284
|
printErrorControls(this.form);
|
|
1239
1285
|
}
|
|
1240
|
-
this.invalidSubmit.emit();
|
|
1286
|
+
this.invalidSubmit.emit(reduceErrors(this.form));
|
|
1241
1287
|
}
|
|
1242
1288
|
return false;
|
|
1243
1289
|
}
|
|
@@ -1300,11 +1346,10 @@ class FormDirective extends FormGroupDirective {
|
|
|
1300
1346
|
}
|
|
1301
1347
|
}
|
|
1302
1348
|
loadFailed(error) {
|
|
1303
|
-
var _a;
|
|
1304
1349
|
console.debug('Load Error:', error);
|
|
1305
1350
|
console.error('Load Error:', error.message);
|
|
1306
1351
|
if (this.loadFailedMethod) {
|
|
1307
|
-
|
|
1352
|
+
this.loadFailedMethod?.call(error);
|
|
1308
1353
|
}
|
|
1309
1354
|
else if (isDevMode()) {
|
|
1310
1355
|
console.warn('The form loading failed for: ' + this.form.controlId);
|
|
@@ -1318,7 +1363,7 @@ class FormDirective extends FormGroupDirective {
|
|
|
1318
1363
|
else if (typeof this._formDefinition['toJSON'] === 'function') {
|
|
1319
1364
|
value = this._formDefinition.toJSON();
|
|
1320
1365
|
}
|
|
1321
|
-
value = value
|
|
1366
|
+
value = value ?? this.form.value;
|
|
1322
1367
|
return clone(value);
|
|
1323
1368
|
}
|
|
1324
1369
|
submit() {
|
|
@@ -1388,9 +1433,8 @@ class FormDirective extends FormGroupDirective {
|
|
|
1388
1433
|
}
|
|
1389
1434
|
}
|
|
1390
1435
|
ngOnDestroy() {
|
|
1391
|
-
var _a;
|
|
1392
1436
|
super.ngOnDestroy();
|
|
1393
|
-
|
|
1437
|
+
this._autoSubmitSubscription?.unsubscribe();
|
|
1394
1438
|
function HasNgOnDestroyMethod(obj) {
|
|
1395
1439
|
return obj && typeof obj.ngOnDestroy === 'function';
|
|
1396
1440
|
}
|
|
@@ -1399,8 +1443,8 @@ class FormDirective extends FormGroupDirective {
|
|
|
1399
1443
|
}
|
|
1400
1444
|
}
|
|
1401
1445
|
}
|
|
1402
|
-
FormDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1403
|
-
FormDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "
|
|
1446
|
+
FormDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", 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 });
|
|
1447
|
+
FormDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.3", type: FormDirective, 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: [
|
|
1404
1448
|
{
|
|
1405
1449
|
provide: ControlContainer,
|
|
1406
1450
|
// ignore coverage
|
|
@@ -1447,7 +1491,7 @@ __decorate([
|
|
|
1447
1491
|
Required,
|
|
1448
1492
|
__metadata("design:type", Object)
|
|
1449
1493
|
], FormDirective.prototype, "_formDefinition", void 0);
|
|
1450
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1494
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: FormDirective, decorators: [{
|
|
1451
1495
|
type: Directive,
|
|
1452
1496
|
args: [{
|
|
1453
1497
|
selector: 'form[rxapForm]:not([formGroup]):not([ngForm]),rxap-form,form[rxapForm]',
|
|
@@ -1606,13 +1650,12 @@ class FormSubmitFailedDirective {
|
|
|
1606
1650
|
})).subscribe();
|
|
1607
1651
|
}
|
|
1608
1652
|
ngOnDestroy() {
|
|
1609
|
-
|
|
1610
|
-
(_a = this.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
1653
|
+
this.subscription?.unsubscribe();
|
|
1611
1654
|
}
|
|
1612
1655
|
}
|
|
1613
|
-
FormSubmitFailedDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1614
|
-
FormSubmitFailedDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "
|
|
1615
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1656
|
+
FormSubmitFailedDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: FormSubmitFailedDirective, deps: [{ token: FormDirective }, { token: TemplateRef }, { token: ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1657
|
+
FormSubmitFailedDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.3", type: FormSubmitFailedDirective, selector: "[rxapFormSubmitFailed]", ngImport: i0 });
|
|
1658
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: FormSubmitFailedDirective, decorators: [{
|
|
1616
1659
|
type: Directive,
|
|
1617
1660
|
args: [{
|
|
1618
1661
|
selector: '[rxapFormSubmitFailed]'
|
|
@@ -1643,13 +1686,12 @@ class FormLoadingDirective {
|
|
|
1643
1686
|
})).subscribe();
|
|
1644
1687
|
}
|
|
1645
1688
|
ngOnDestroy() {
|
|
1646
|
-
|
|
1647
|
-
(_a = this.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
1689
|
+
this.subscription?.unsubscribe();
|
|
1648
1690
|
}
|
|
1649
1691
|
}
|
|
1650
|
-
FormLoadingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1651
|
-
FormLoadingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "
|
|
1652
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1692
|
+
FormLoadingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: FormLoadingDirective, deps: [{ token: FormDirective }, { token: TemplateRef }, { token: ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1693
|
+
FormLoadingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.3", type: FormLoadingDirective, selector: "[rxapFormLoading]", ngImport: i0 });
|
|
1694
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: FormLoadingDirective, decorators: [{
|
|
1653
1695
|
type: Directive,
|
|
1654
1696
|
args: [{
|
|
1655
1697
|
selector: '[rxapFormLoading]'
|
|
@@ -1680,13 +1722,12 @@ class FormSubmittingDirective {
|
|
|
1680
1722
|
})).subscribe();
|
|
1681
1723
|
}
|
|
1682
1724
|
ngOnDestroy() {
|
|
1683
|
-
|
|
1684
|
-
(_a = this.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
1725
|
+
this.subscription?.unsubscribe();
|
|
1685
1726
|
}
|
|
1686
1727
|
}
|
|
1687
|
-
FormSubmittingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1688
|
-
FormSubmittingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "
|
|
1689
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1728
|
+
FormSubmittingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: FormSubmittingDirective, deps: [{ token: FormDirective }, { token: TemplateRef }, { token: ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1729
|
+
FormSubmittingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.3", type: FormSubmittingDirective, selector: "[rxapFormSubmitting]", ngImport: i0 });
|
|
1730
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: FormSubmittingDirective, decorators: [{
|
|
1690
1731
|
type: Directive,
|
|
1691
1732
|
args: [{
|
|
1692
1733
|
selector: '[rxapFormSubmitting]'
|
|
@@ -1717,13 +1758,12 @@ class FormLoadedDirective {
|
|
|
1717
1758
|
})).subscribe();
|
|
1718
1759
|
}
|
|
1719
1760
|
ngOnDestroy() {
|
|
1720
|
-
|
|
1721
|
-
(_a = this.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
1761
|
+
this.subscription?.unsubscribe();
|
|
1722
1762
|
}
|
|
1723
1763
|
}
|
|
1724
|
-
FormLoadedDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1725
|
-
FormLoadedDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "
|
|
1726
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1764
|
+
FormLoadedDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: FormLoadedDirective, deps: [{ token: FormDirective }, { token: TemplateRef }, { token: ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1765
|
+
FormLoadedDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.3", type: FormLoadedDirective, selector: "[rxapFormLoaded]", ngImport: i0 });
|
|
1766
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: FormLoadedDirective, decorators: [{
|
|
1727
1767
|
type: Directive,
|
|
1728
1768
|
args: [{
|
|
1729
1769
|
selector: '[rxapFormLoaded]'
|
|
@@ -1754,13 +1794,12 @@ class FormLoadingErrorDirective {
|
|
|
1754
1794
|
})).subscribe();
|
|
1755
1795
|
}
|
|
1756
1796
|
ngOnDestroy() {
|
|
1757
|
-
|
|
1758
|
-
(_a = this.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
1797
|
+
this.subscription?.unsubscribe();
|
|
1759
1798
|
}
|
|
1760
1799
|
}
|
|
1761
|
-
FormLoadingErrorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1762
|
-
FormLoadingErrorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "
|
|
1763
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1800
|
+
FormLoadingErrorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: FormLoadingErrorDirective, deps: [{ token: FormDirective }, { token: TemplateRef }, { token: ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1801
|
+
FormLoadingErrorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.3", type: FormLoadingErrorDirective, selector: "[rxapFormLoadingError]", ngImport: i0 });
|
|
1802
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: FormLoadingErrorDirective, decorators: [{
|
|
1764
1803
|
type: Directive,
|
|
1765
1804
|
args: [{
|
|
1766
1805
|
selector: '[rxapFormLoadingError]'
|
|
@@ -1786,8 +1825,7 @@ class FormControlErrorDirective {
|
|
|
1786
1825
|
this.viewContainerRef = viewContainerRef;
|
|
1787
1826
|
}
|
|
1788
1827
|
ngOnInit() {
|
|
1789
|
-
|
|
1790
|
-
const control = (_a = this.parent.control) === null || _a === void 0 ? void 0 : _a.get(this.name);
|
|
1828
|
+
const control = this.parent.control?.get(this.name);
|
|
1791
1829
|
if (!control) {
|
|
1792
1830
|
throw new Error('Could not extract form control instance');
|
|
1793
1831
|
}
|
|
@@ -1799,12 +1837,11 @@ class FormControlErrorDirective {
|
|
|
1799
1837
|
})).subscribe();
|
|
1800
1838
|
}
|
|
1801
1839
|
ngOnDestroy() {
|
|
1802
|
-
|
|
1803
|
-
(_a = this.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
1840
|
+
this.subscription?.unsubscribe();
|
|
1804
1841
|
}
|
|
1805
1842
|
}
|
|
1806
|
-
FormControlErrorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1807
|
-
FormControlErrorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "
|
|
1843
|
+
FormControlErrorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: FormControlErrorDirective, deps: [{ token: i0.TemplateRef }, { token: i1.ControlContainer, host: true, skipSelf: true }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1844
|
+
FormControlErrorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.3", type: FormControlErrorDirective, selector: "[rxapFormControlError]", inputs: { name: ["rxapFormControlErrorFrom", "name"], errorKey: ["rxapFormControlErrorIf", "errorKey"] }, ngImport: i0 });
|
|
1808
1845
|
__decorate([
|
|
1809
1846
|
Required,
|
|
1810
1847
|
__metadata("design:type", String)
|
|
@@ -1813,7 +1850,7 @@ __decorate([
|
|
|
1813
1850
|
Required,
|
|
1814
1851
|
__metadata("design:type", String)
|
|
1815
1852
|
], FormControlErrorDirective.prototype, "errorKey", void 0);
|
|
1816
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1853
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: FormControlErrorDirective, decorators: [{
|
|
1817
1854
|
type: Directive,
|
|
1818
1855
|
args: [{
|
|
1819
1856
|
selector: '[rxapFormControlError]'
|
|
@@ -1840,13 +1877,13 @@ class FormControlMarkDirtyDirective {
|
|
|
1840
1877
|
control.markAllAsDirty();
|
|
1841
1878
|
}
|
|
1842
1879
|
else {
|
|
1843
|
-
control
|
|
1880
|
+
control?.markAsDirty();
|
|
1844
1881
|
}
|
|
1845
1882
|
}
|
|
1846
1883
|
}
|
|
1847
|
-
FormControlMarkDirtyDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1848
|
-
FormControlMarkDirtyDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "
|
|
1849
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1884
|
+
FormControlMarkDirtyDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: FormControlMarkDirtyDirective, deps: [{ token: i1.ControlContainer }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1885
|
+
FormControlMarkDirtyDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.3", type: FormControlMarkDirtyDirective, selector: "[rxapFormControlMarkDirty]", host: { listeners: { "click": "onClick()" } }, ngImport: i0 });
|
|
1886
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: FormControlMarkDirtyDirective, decorators: [{
|
|
1850
1887
|
type: Directive,
|
|
1851
1888
|
args: [{
|
|
1852
1889
|
selector: '[rxapFormControlMarkDirty]'
|
|
@@ -1861,13 +1898,12 @@ class FormControlMarkTouchedDirective {
|
|
|
1861
1898
|
this.parent = parent;
|
|
1862
1899
|
}
|
|
1863
1900
|
onClick() {
|
|
1864
|
-
|
|
1865
|
-
(_a = this.parent.control) === null || _a === void 0 ? void 0 : _a.markAllAsTouched();
|
|
1901
|
+
this.parent.control?.markAllAsTouched();
|
|
1866
1902
|
}
|
|
1867
1903
|
}
|
|
1868
|
-
FormControlMarkTouchedDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1869
|
-
FormControlMarkTouchedDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "
|
|
1870
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1904
|
+
FormControlMarkTouchedDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: FormControlMarkTouchedDirective, deps: [{ token: i1.ControlContainer }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1905
|
+
FormControlMarkTouchedDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.3", type: FormControlMarkTouchedDirective, selector: "[rxapFormControlMarkTouched]", host: { listeners: { "click": "onClick()" } }, ngImport: i0 });
|
|
1906
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: FormControlMarkTouchedDirective, decorators: [{
|
|
1871
1907
|
type: Directive,
|
|
1872
1908
|
args: [{
|
|
1873
1909
|
selector: '[rxapFormControlMarkTouched]'
|
|
@@ -1887,13 +1923,13 @@ class FormControlMarkUntouchedDirective {
|
|
|
1887
1923
|
control.markAllAsUntouched();
|
|
1888
1924
|
}
|
|
1889
1925
|
else {
|
|
1890
|
-
control
|
|
1926
|
+
control?.markAsUntouched();
|
|
1891
1927
|
}
|
|
1892
1928
|
}
|
|
1893
1929
|
}
|
|
1894
|
-
FormControlMarkUntouchedDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1895
|
-
FormControlMarkUntouchedDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "
|
|
1896
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1930
|
+
FormControlMarkUntouchedDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: FormControlMarkUntouchedDirective, deps: [{ token: i1.ControlContainer }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1931
|
+
FormControlMarkUntouchedDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.3", type: FormControlMarkUntouchedDirective, selector: "[rxapFormControlMarkUntouched]", host: { listeners: { "click": "onClick()" } }, ngImport: i0 });
|
|
1932
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: FormControlMarkUntouchedDirective, decorators: [{
|
|
1897
1933
|
type: Directive,
|
|
1898
1934
|
args: [{
|
|
1899
1935
|
selector: '[rxapFormControlMarkUntouched]'
|
|
@@ -1913,13 +1949,13 @@ class FormControlMarkPristineDirective {
|
|
|
1913
1949
|
control.markAllAsPristine();
|
|
1914
1950
|
}
|
|
1915
1951
|
else {
|
|
1916
|
-
control
|
|
1952
|
+
control?.markAsPristine();
|
|
1917
1953
|
}
|
|
1918
1954
|
}
|
|
1919
1955
|
}
|
|
1920
|
-
FormControlMarkPristineDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1921
|
-
FormControlMarkPristineDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "
|
|
1922
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1956
|
+
FormControlMarkPristineDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: FormControlMarkPristineDirective, deps: [{ token: i1.ControlContainer }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1957
|
+
FormControlMarkPristineDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.3", type: FormControlMarkPristineDirective, selector: "[rxapFormControlMarkPristine]", host: { listeners: { "click": "onClick()" } }, ngImport: i0 });
|
|
1958
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: FormControlMarkPristineDirective, decorators: [{
|
|
1923
1959
|
type: Directive,
|
|
1924
1960
|
args: [{
|
|
1925
1961
|
selector: '[rxapFormControlMarkPristine]'
|
|
@@ -1958,13 +1994,12 @@ class FormSubmitDirective extends ConfirmClick {
|
|
|
1958
1994
|
this.formDirective.onSubmit(new Event('submit'));
|
|
1959
1995
|
}
|
|
1960
1996
|
ngOnDestroy() {
|
|
1961
|
-
|
|
1962
|
-
(_a = this.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
1997
|
+
this.subscription?.unsubscribe();
|
|
1963
1998
|
}
|
|
1964
1999
|
}
|
|
1965
|
-
FormSubmitDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1966
|
-
FormSubmitDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "
|
|
1967
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2000
|
+
FormSubmitDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: FormSubmitDirective, deps: [{ token: FormDirective }, { token: Router, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2001
|
+
FormSubmitDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.3", type: FormSubmitDirective, 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 });
|
|
2002
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: FormSubmitDirective, decorators: [{
|
|
1968
2003
|
type: Directive,
|
|
1969
2004
|
args: [{
|
|
1970
2005
|
selector: '[rxapFormSubmit]',
|
|
@@ -2010,14 +2045,14 @@ class FormGroupNameDirective extends FormGroupName {
|
|
|
2010
2045
|
return this.formDirective.getFormGroup(this);
|
|
2011
2046
|
}
|
|
2012
2047
|
}
|
|
2013
|
-
FormGroupNameDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2014
|
-
FormGroupNameDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "
|
|
2048
|
+
FormGroupNameDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", 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 });
|
|
2049
|
+
FormGroupNameDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.3", type: FormGroupNameDirective, selector: "[rxapFormGroupName]", inputs: { name: ["rxapFormGroupName", "name"] }, providers: [
|
|
2015
2050
|
{
|
|
2016
2051
|
provide: ControlContainer,
|
|
2017
2052
|
useExisting: forwardRef(() => FormGroupNameDirective)
|
|
2018
2053
|
}
|
|
2019
2054
|
], exportAs: ["rxapFormGroup"], usesInheritance: true, ngImport: i0 });
|
|
2020
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2055
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: FormGroupNameDirective, decorators: [{
|
|
2021
2056
|
type: Directive,
|
|
2022
2057
|
args: [{
|
|
2023
2058
|
selector: '[rxapFormGroupName]',
|
|
@@ -2063,14 +2098,14 @@ class FormControlNameDirective extends FormControlName {
|
|
|
2063
2098
|
super(parent, validators, asyncValidators, valueAccessors, null);
|
|
2064
2099
|
}
|
|
2065
2100
|
}
|
|
2066
|
-
FormControlNameDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2067
|
-
FormControlNameDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "
|
|
2101
|
+
FormControlNameDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", 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 });
|
|
2102
|
+
FormControlNameDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.3", type: FormControlNameDirective, selector: "[rxapFormControlName]", inputs: { name: ["rxapFormControlName", "name"] }, providers: [
|
|
2068
2103
|
{
|
|
2069
2104
|
provide: NgControl,
|
|
2070
2105
|
useExisting: forwardRef(() => FormControlNameDirective)
|
|
2071
2106
|
}
|
|
2072
2107
|
], exportAs: ["rxapFormControl"], usesInheritance: true, ngImport: i0 });
|
|
2073
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2108
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: FormControlNameDirective, decorators: [{
|
|
2074
2109
|
type: Directive,
|
|
2075
2110
|
args: [{
|
|
2076
2111
|
selector: '[rxapFormControlName]',
|
|
@@ -2114,14 +2149,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImpor
|
|
|
2114
2149
|
|
|
2115
2150
|
class ParentControlContainerDirective {
|
|
2116
2151
|
}
|
|
2117
|
-
ParentControlContainerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2118
|
-
ParentControlContainerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "
|
|
2152
|
+
ParentControlContainerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: ParentControlContainerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2153
|
+
ParentControlContainerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.3", type: ParentControlContainerDirective, selector: "[formControlName][parentControlContainer],[formControlGroup][parentControlContainer]", providers: [
|
|
2119
2154
|
{
|
|
2120
2155
|
provide: ControlContainer,
|
|
2121
2156
|
useExisting: ControlContainer
|
|
2122
2157
|
}
|
|
2123
2158
|
], ngImport: i0 });
|
|
2124
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2159
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: ParentControlContainerDirective, decorators: [{
|
|
2125
2160
|
type: Directive,
|
|
2126
2161
|
args: [{
|
|
2127
2162
|
selector: '[formControlName][parentControlContainer],[formControlGroup][parentControlContainer]',
|
|
@@ -2147,13 +2182,12 @@ class FormSubmitSuccessfulDirective {
|
|
|
2147
2182
|
})).subscribe();
|
|
2148
2183
|
}
|
|
2149
2184
|
ngOnDestroy() {
|
|
2150
|
-
|
|
2151
|
-
(_a = this.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
2185
|
+
this.subscription?.unsubscribe();
|
|
2152
2186
|
}
|
|
2153
2187
|
}
|
|
2154
|
-
FormSubmitSuccessfulDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2155
|
-
FormSubmitSuccessfulDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "
|
|
2156
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2188
|
+
FormSubmitSuccessfulDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: FormSubmitSuccessfulDirective, deps: [{ token: FormDirective }, { token: TemplateRef }, { token: ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2189
|
+
FormSubmitSuccessfulDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.3", type: FormSubmitSuccessfulDirective, selector: "[rxapFormSubmitSuccessful]", ngImport: i0 });
|
|
2190
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: FormSubmitSuccessfulDirective, decorators: [{
|
|
2157
2191
|
type: Directive,
|
|
2158
2192
|
args: [{
|
|
2159
2193
|
selector: '[rxapFormSubmitSuccessful]'
|
|
@@ -2182,13 +2216,12 @@ class FormSubmitInvalidDirective {
|
|
|
2182
2216
|
})).subscribe();
|
|
2183
2217
|
}
|
|
2184
2218
|
ngOnDestroy() {
|
|
2185
|
-
|
|
2186
|
-
(_a = this.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
2219
|
+
this.subscription?.unsubscribe();
|
|
2187
2220
|
}
|
|
2188
2221
|
}
|
|
2189
|
-
FormSubmitInvalidDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2190
|
-
FormSubmitInvalidDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "
|
|
2191
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2222
|
+
FormSubmitInvalidDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: FormSubmitInvalidDirective, deps: [{ token: FormDirective }, { token: TemplateRef }, { token: ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2223
|
+
FormSubmitInvalidDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.3", type: FormSubmitInvalidDirective, selector: "[rxapFormSubmitInvalid]", ngImport: i0 });
|
|
2224
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: FormSubmitInvalidDirective, decorators: [{
|
|
2192
2225
|
type: Directive,
|
|
2193
2226
|
args: [{
|
|
2194
2227
|
selector: '[rxapFormSubmitInvalid]'
|
|
@@ -2206,8 +2239,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.1", ngImpor
|
|
|
2206
2239
|
|
|
2207
2240
|
class RxapFormsModule {
|
|
2208
2241
|
}
|
|
2209
|
-
RxapFormsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2210
|
-
RxapFormsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "
|
|
2242
|
+
RxapFormsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: RxapFormsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2243
|
+
RxapFormsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: RxapFormsModule, declarations: [FormDirective,
|
|
2211
2244
|
FormSubmitFailedDirective,
|
|
2212
2245
|
FormLoadingDirective,
|
|
2213
2246
|
FormSubmittingDirective,
|
|
@@ -2240,8 +2273,8 @@ RxapFormsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version
|
|
|
2240
2273
|
ParentControlContainerDirective,
|
|
2241
2274
|
FormSubmitSuccessfulDirective,
|
|
2242
2275
|
FormSubmitInvalidDirective] });
|
|
2243
|
-
RxapFormsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
2244
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2276
|
+
RxapFormsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: RxapFormsModule });
|
|
2277
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: RxapFormsModule, decorators: [{
|
|
2245
2278
|
type: NgModule,
|
|
2246
2279
|
args: [{
|
|
2247
2280
|
declarations: [
|
|
@@ -2301,15 +2334,14 @@ function ToFormSubmitMethod(call) {
|
|
|
2301
2334
|
* Checks if a given value is a number.
|
|
2302
2335
|
*/
|
|
2303
2336
|
function isNumber(value, options = {}) {
|
|
2304
|
-
var _a, _b;
|
|
2305
2337
|
if (typeof value !== 'number') {
|
|
2306
2338
|
return false;
|
|
2307
2339
|
}
|
|
2308
2340
|
if (value === Infinity || value === -Infinity) {
|
|
2309
|
-
return
|
|
2341
|
+
return options.allowInfinity ?? false;
|
|
2310
2342
|
}
|
|
2311
2343
|
if (Number.isNaN(value)) {
|
|
2312
|
-
return
|
|
2344
|
+
return options.allowNaN ?? false;
|
|
2313
2345
|
}
|
|
2314
2346
|
if (options.maxDecimalPlaces !== undefined) {
|
|
2315
2347
|
let decimalPlaces = 0;
|
|
@@ -2341,7 +2373,7 @@ function _IsNumber({ message, options } = {}) {
|
|
|
2341
2373
|
if (control.value === null) {
|
|
2342
2374
|
return null;
|
|
2343
2375
|
}
|
|
2344
|
-
if (!isNumber(!
|
|
2376
|
+
if (!isNumber(!options?.strict && typeof control.value === 'string' ? Number(control.value) : control.value, options)) {
|
|
2345
2377
|
return {
|
|
2346
2378
|
isNumber: {
|
|
2347
2379
|
expected: 'A number value',
|
|
@@ -2627,7 +2659,7 @@ function IsIP({ message, version } = {}) {
|
|
|
2627
2659
|
if (!(typeof control.value === 'string' && isIP(control.value, version))) {
|
|
2628
2660
|
return {
|
|
2629
2661
|
isIp: {
|
|
2630
|
-
expected: `A valid IPv${version
|
|
2662
|
+
expected: `A valid IPv${version ?? '4'} value`,
|
|
2631
2663
|
actual: control.value,
|
|
2632
2664
|
message
|
|
2633
2665
|
}
|
|
@@ -2660,4 +2692,4 @@ const RxapValidators = {
|
|
|
2660
2692
|
*/
|
|
2661
2693
|
|
|
2662
2694
|
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 };
|
|
2663
|
-
//# sourceMappingURL=rxap-forms.
|
|
2695
|
+
//# sourceMappingURL=rxap-forms.mjs.map
|