@rxap/forms 18.0.3 → 18.0.4-dev.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/CHANGELOG.md +4 -0
- package/README.md +1 -1
- package/compodoc/dependencies.html +9 -9
- package/compodoc/index.html +1 -1
- package/compodoc/js/search/search_index.js +2 -2
- package/docs/classes/ControlValueAccessor.html +2 -2
- package/docs/classes/FormArrayControlManager.html +2 -2
- package/docs/classes/FormControlErrorDirective.html +2 -2
- package/docs/classes/FormControlMarkDirtyDirective.html +2 -2
- package/docs/classes/FormControlMarkPristineDirective.html +2 -2
- package/docs/classes/FormControlMarkTouchedDirective.html +2 -2
- package/docs/classes/FormControlMarkUntouchedDirective.html +2 -2
- package/docs/classes/FormControlNameDirective.html +3 -3
- package/docs/classes/FormDirective.html +13 -13
- package/docs/classes/FormGroupNameDirective.html +3 -3
- package/docs/classes/FormLoadedDirective.html +2 -2
- package/docs/classes/FormLoadingDirective.html +2 -2
- package/docs/classes/FormLoadingErrorDirective.html +2 -2
- package/docs/classes/FormSubmitDirective.html +2 -2
- package/docs/classes/FormSubmitFailedDirective.html +2 -2
- package/docs/classes/FormSubmitInvalidDirective.html +2 -2
- package/docs/classes/FormSubmitSuccessfulDirective.html +2 -2
- package/docs/classes/FormSubmittingDirective.html +2 -2
- package/docs/classes/ParentControlContainerDirective.html +1 -1
- package/docs/classes/RxapFormArray.html +33 -33
- package/docs/classes/RxapFormBuilder.html +7 -7
- package/docs/classes/RxapFormControl.html +21 -21
- package/docs/classes/RxapFormGroup.html +21 -21
- package/docs/classes/RxapFormsModule.html +1 -1
- package/docs/documentation.json +1153 -1153
- package/docs/enums/MetadataKeys.html +2 -2
- package/docs/functions/ControlAsyncValidator.html +1 -1
- package/docs/functions/ControlChange.html +1 -1
- package/docs/functions/ControlSetValue.html +1 -1
- package/docs/functions/ControlValidator.html +1 -1
- package/docs/functions/IsArray.html +1 -1
- package/docs/functions/IsBoolean.html +1 -1
- package/docs/functions/IsComplex.html +1 -1
- package/docs/functions/IsDate.html +1 -1
- package/docs/functions/IsEmail.html +1 -1
- package/docs/functions/IsEnum.html +1 -1
- package/docs/functions/IsIP.html +1 -1
- package/docs/functions/IsInt.html +1 -1
- package/docs/functions/IsNumber.html +1 -1
- package/docs/functions/IsObject.html +1 -1
- package/docs/functions/IsPhoneNumber.html +1 -1
- package/docs/functions/IsPort.html +1 -1
- package/docs/functions/IsString.html +1 -1
- package/docs/functions/IsUUID.html +1 -1
- package/docs/functions/IsUrl.html +1 -1
- package/docs/functions/RxapForm.html +1 -1
- package/docs/functions/ToFormMethod.html +1 -1
- package/docs/functions/ToFormSubmitMethod.html +1 -1
- package/docs/functions/UseFormArrayControl.html +1 -1
- package/docs/functions/UseFormArrayGroup.html +1 -1
- package/docs/functions/UseFormControl.html +1 -1
- package/docs/functions/UseFormGroup.html +1 -1
- package/docs/functions/_IsNumber.html +1 -1
- package/docs/functions/controlDisabledWhile.html +1 -1
- package/docs/functions/controlDisabled_.html +1 -1
- package/docs/functions/controlEnabledWhile.html +1 -1
- package/docs/functions/controlEnabled_.html +1 -1
- package/docs/functions/controlErrorChanges_.html +1 -1
- package/docs/functions/controlReadonly_.html +1 -1
- package/docs/functions/controlStatusChanges_.html +1 -1
- package/docs/functions/controlValueChanges_.html +1 -1
- package/docs/functions/disableControl.html +1 -1
- package/docs/functions/enableControl.html +1 -1
- package/docs/functions/hasErrorAndDirty.html +1 -1
- package/docs/functions/hasErrorAndTouched.html +1 -1
- package/docs/functions/isNumber-1.html +1 -1
- package/docs/functions/markAllDirty.html +1 -1
- package/docs/functions/markAllPristine.html +1 -1
- package/docs/functions/markAllUntouched.html +1 -1
- package/docs/functions/mergeControlValidators.html +1 -1
- package/docs/functions/selectControlValue_.html +1 -1
- package/docs/functions/validateControlOn.html +1 -1
- package/docs/index.html +1 -1
- package/docs/interfaces/AbstractControl.html +5 -5
- package/docs/interfaces/AbstractControlOptions.html +3 -3
- package/docs/interfaces/BoxedValue.html +2 -2
- package/docs/interfaces/ComplexityOptions.html +2 -2
- package/docs/interfaces/ControlOptions.html +3 -3
- package/docs/interfaces/ControlSetValueOptions.html +2 -2
- package/docs/interfaces/FormArrayOptions.html +2 -2
- package/docs/interfaces/FormDefinition.html +6 -6
- package/docs/interfaces/FormDefinitionArray.html +2 -2
- package/docs/interfaces/FormDefinitionMetadata.html +2 -2
- package/docs/interfaces/FormGroupOptions.html +2 -2
- package/docs/interfaces/FormLoadFailedMethod.html +2 -2
- package/docs/interfaces/FormLoadMethod.html +2 -2
- package/docs/interfaces/FormLoadSuccessfulMethod.html +2 -2
- package/docs/interfaces/FormOptions.html +2 -2
- package/docs/interfaces/FormSubmitFailedMethod.html +2 -2
- package/docs/interfaces/FormSubmitMethod.html +2 -2
- package/docs/interfaces/FormSubmitSuccessfulMethod.html +2 -2
- package/docs/interfaces/InjectableValidator.html +2 -2
- package/docs/interfaces/IsNumberOptions.html +2 -2
- package/docs/interfaces/NgValidatorsErrors.html +2 -2
- package/docs/interfaces/RxapAbstractControlOptionsWithDefinition.html +2 -2
- package/docs/interfaces/_RxapAbstractControlOptions.html +2 -2
- package/docs/types/AsyncValidator.html +1 -1
- package/docs/types/AsyncValidatorFn.html +1 -1
- package/docs/types/ChangeFn.html +1 -1
- package/docs/types/ControlEventOptions.html +1 -1
- package/docs/types/ControlInsertedFn.html +1 -1
- package/docs/types/ControlPath.html +1 -1
- package/docs/types/ControlRemovedFn.html +1 -1
- package/docs/types/ControlState.html +1 -1
- package/docs/types/EmitEvent.html +1 -1
- package/docs/types/ExtractAbstractControl.html +1 -1
- package/docs/types/ExtractStrings.html +1 -1
- package/docs/types/FormBuilderFn.html +1 -1
- package/docs/types/FormType.html +1 -1
- package/docs/types/KeyValueControls.html +1 -1
- package/docs/types/OnlySelf.html +1 -1
- package/docs/types/OrBoxedValue.html +1 -1
- package/docs/types/RxapAbstractControlOptions.html +1 -1
- package/docs/types/SetValueFn.html +1 -1
- package/docs/types/ValidationErrors.html +1 -1
- package/docs/types/Validator.html +1 -1
- package/docs/types/ValidatorFn.html +1 -1
- package/docs/types/ValidatorOrOpts.html +1 -1
- package/docs/variables/RXAP_FORM_CONTEXT.html +1 -1
- package/docs/variables/RXAP_FORM_DEFINITION.html +1 -1
- package/docs/variables/RXAP_FORM_DEFINITION_BUILDER.html +1 -1
- package/docs/variables/RXAP_FORM_INITIAL_STATE.html +1 -1
- package/docs/variables/RXAP_FORM_LOAD_FAILED_METHOD.html +1 -1
- package/docs/variables/RXAP_FORM_LOAD_METHOD.html +1 -1
- package/docs/variables/RXAP_FORM_LOAD_SUCCESSFUL_METHOD.html +1 -1
- package/docs/variables/RXAP_FORM_SUBMIT_FAILED_METHOD.html +1 -1
- package/docs/variables/RXAP_FORM_SUBMIT_METHOD.html +1 -1
- package/docs/variables/RXAP_FORM_SUBMIT_SUCCESSFUL_METHOD.html +1 -1
- package/docs/variables/RxapValidators.html +1 -1
- 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 +2 -2
- package/esm2022/lib/decorators/control-validator.mjs +2 -2
- package/esm2022/lib/decorators/form.mjs +1 -1
- package/esm2022/lib/decorators/use-form-array.mjs +2 -2
- package/esm2022/lib/decorators/use-form-control.mjs +2 -2
- package/esm2022/lib/decorators/use-form-group.mjs +2 -2
- package/esm2022/lib/directives/form-control-error.directive.mjs +1 -1
- package/esm2022/lib/directives/form-loaded.directive.mjs +2 -2
- package/esm2022/lib/directives/form-loading-error.directive.mjs +2 -2
- package/esm2022/lib/directives/form-loading.directive.mjs +2 -2
- package/esm2022/lib/directives/form-submit-failed.directive.mjs +2 -2
- package/esm2022/lib/directives/form-submit-invalid.directive.mjs +2 -2
- package/esm2022/lib/directives/form-submit-successful.directive.mjs +2 -2
- package/esm2022/lib/directives/form-submit.directive.mjs +4 -4
- package/esm2022/lib/directives/form-submitting.directive.mjs +2 -2
- package/esm2022/lib/directives/form.directive.mjs +4 -4
- package/esm2022/lib/directives/forms.module.mjs +12 -12
- package/esm2022/lib/directives/tokens.mjs +1 -1
- package/esm2022/lib/validators/index.mjs +10 -10
- package/fesm2022/rxap-forms.mjs +132 -132
- package/fesm2022/rxap-forms.mjs.map +1 -1
- package/lib/directives/form-control-error.directive.d.ts +1 -1
- package/lib/directives/form-submit.directive.d.ts +1 -1
- package/lib/directives/form.directive.d.ts +4 -4
- package/lib/directives/tokens.d.ts +1 -1
- package/lib/validators/index.d.ts +9 -9
- package/package.json +19 -19
- package/theme.css +95 -1
package/fesm2022/rxap-forms.mjs
CHANGED
|
@@ -1,72 +1,29 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isEmail, isIP, isMobilePhone, isPort, isURL, isUUID } from '@rxap/validator';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { Directive, Host, SkipSelf, Input, HostListener, forwardRef, Optional, Self, Inject, InjectionToken, isDevMode, Injector, EventEmitter, ChangeDetectorRef, Output, HostBinding, TemplateRef, ViewContainerRef, NgModule } from '@angular/core';
|
|
4
4
|
import * as i1 from '@angular/forms';
|
|
5
5
|
import { FormControlName, NG_VALIDATORS, NG_ASYNC_VALIDATORS, NG_VALUE_ACCESSOR, NgControl, FormGroupName, ControlContainer, UntypedFormArray, AbstractControl, UntypedFormGroup, UntypedFormControl, Validators, FormGroupDirective } from '@angular/forms';
|
|
6
6
|
import { startWith, filter, tap, map, distinctUntilChanged, debounceTime, take } from 'rxjs/operators';
|
|
7
7
|
import { hasIndexSignature, equals, coerceArray, HasRxapOnInitMethod, assertIsArray, assertIsObject, assertIsFunction, isPromise, isObject, clone, coerceBoolean } from '@rxap/utilities';
|
|
8
|
-
import {
|
|
8
|
+
import { ToggleSubject } from '@rxap/rxjs';
|
|
9
9
|
import * as i2 from '@rxap/services';
|
|
10
10
|
import { LoadingIndicatorService } from '@rxap/services';
|
|
11
|
-
import {
|
|
11
|
+
import { merge, defer, of, EMPTY, Subject, isObservable, BehaviorSubject, Subscription } from 'rxjs';
|
|
12
12
|
import { GetDefinitionMetadata, DefinitionMetadata } from '@rxap/definition';
|
|
13
13
|
import { getMetadata, setMetadataMapSet, setMetadataMap } from '@rxap/reflect-metadata';
|
|
14
14
|
import * as i2$1 from '@angular/router';
|
|
15
15
|
import { Router } from '@angular/router';
|
|
16
16
|
import { ConfirmClick } from '@rxap/directives';
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
* Checks if a given value is a number.
|
|
20
|
-
*/
|
|
21
|
-
function isNumber(value, options = {}) {
|
|
22
|
-
if (typeof value !== 'number') {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
if (value === Infinity || value === -Infinity) {
|
|
26
|
-
return options.allowInfinity ?? false;
|
|
27
|
-
}
|
|
28
|
-
if (Number.isNaN(value)) {
|
|
29
|
-
return options.allowNaN ?? false;
|
|
30
|
-
}
|
|
31
|
-
if (options.maxDecimalPlaces !== undefined) {
|
|
32
|
-
let decimalPlaces = 0;
|
|
33
|
-
if (value % 1 !== 0) {
|
|
34
|
-
decimalPlaces = value.toString().split('.')[1].length;
|
|
35
|
-
}
|
|
36
|
-
if (decimalPlaces > options.maxDecimalPlaces) {
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return Number.isFinite(value);
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* @deprecated use RxapValidators.isNumber() instead
|
|
44
|
-
* @param control
|
|
45
|
-
* @constructor
|
|
46
|
-
*/
|
|
47
|
-
function IsNumber(control) {
|
|
48
|
-
if (control.value === null) {
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
if (isNaN(Number(control.value))) {
|
|
52
|
-
return {
|
|
53
|
-
isNumber: {
|
|
54
|
-
expected: 'A number or a string representing a number',
|
|
55
|
-
actual: control.value,
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
function _IsNumber({ message, options, } = {}) {
|
|
18
|
+
function IsArray({ message } = {}) {
|
|
62
19
|
return (control) => {
|
|
63
20
|
if (control.value === null) {
|
|
64
21
|
return null;
|
|
65
22
|
}
|
|
66
|
-
if (!
|
|
23
|
+
if (!Array.isArray(control.value)) {
|
|
67
24
|
return {
|
|
68
|
-
|
|
69
|
-
expected: 'A
|
|
25
|
+
isArray: {
|
|
26
|
+
expected: 'A array value',
|
|
70
27
|
actual: control.value,
|
|
71
28
|
message,
|
|
72
29
|
},
|
|
@@ -94,27 +51,6 @@ function IsBoolean({ message } = {}) {
|
|
|
94
51
|
};
|
|
95
52
|
}
|
|
96
53
|
|
|
97
|
-
function IsObject({ message } = {}) {
|
|
98
|
-
return (control) => {
|
|
99
|
-
if (control.value === null) {
|
|
100
|
-
return null;
|
|
101
|
-
}
|
|
102
|
-
if (!(control.value !==
|
|
103
|
-
undefined &&
|
|
104
|
-
(typeof control.value === 'object' || typeof control.value === 'function') &&
|
|
105
|
-
!Array.isArray(control.value))) {
|
|
106
|
-
return {
|
|
107
|
-
isObject: {
|
|
108
|
-
expected: 'A object value',
|
|
109
|
-
actual: control.value,
|
|
110
|
-
message,
|
|
111
|
-
},
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
return null;
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
|
|
118
54
|
function IsString({ message } = {}) {
|
|
119
55
|
return (control) => {
|
|
120
56
|
if (control.value === null) {
|
|
@@ -133,69 +69,58 @@ function IsString({ message } = {}) {
|
|
|
133
69
|
};
|
|
134
70
|
}
|
|
135
71
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
function IsEnum({ message, entity, }) {
|
|
155
|
-
return (control) => {
|
|
156
|
-
if (control.value === null) {
|
|
157
|
-
return null;
|
|
72
|
+
/**
|
|
73
|
+
* Checks if a given value is a number.
|
|
74
|
+
*/
|
|
75
|
+
function isNumber(value, options = {}) {
|
|
76
|
+
if (typeof value !== 'number') {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
if (value === Infinity || value === -Infinity) {
|
|
80
|
+
return options.allowInfinity ?? false;
|
|
81
|
+
}
|
|
82
|
+
if (Number.isNaN(value)) {
|
|
83
|
+
return options.allowNaN ?? false;
|
|
84
|
+
}
|
|
85
|
+
if (options.maxDecimalPlaces !== undefined) {
|
|
86
|
+
let decimalPlaces = 0;
|
|
87
|
+
if (value % 1 !== 0) {
|
|
88
|
+
decimalPlaces = value.toString().split('.')[1].length;
|
|
158
89
|
}
|
|
159
|
-
if (
|
|
160
|
-
return
|
|
161
|
-
isEnum: {
|
|
162
|
-
expected: 'A enum value',
|
|
163
|
-
actual: control.value,
|
|
164
|
-
message,
|
|
165
|
-
},
|
|
166
|
-
};
|
|
90
|
+
if (decimalPlaces > options.maxDecimalPlaces) {
|
|
91
|
+
return false;
|
|
167
92
|
}
|
|
168
|
-
|
|
169
|
-
|
|
93
|
+
}
|
|
94
|
+
return Number.isFinite(value);
|
|
170
95
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
return {
|
|
179
|
-
isDate: {
|
|
180
|
-
expected: 'A date value',
|
|
181
|
-
actual: control.value,
|
|
182
|
-
message,
|
|
183
|
-
},
|
|
184
|
-
};
|
|
185
|
-
}
|
|
96
|
+
/**
|
|
97
|
+
* @deprecated use RxapValidators.isNumber() instead
|
|
98
|
+
* @param control
|
|
99
|
+
* @constructor
|
|
100
|
+
*/
|
|
101
|
+
function IsNumber(control) {
|
|
102
|
+
if (control.value === null) {
|
|
186
103
|
return null;
|
|
187
|
-
}
|
|
104
|
+
}
|
|
105
|
+
if (isNaN(Number(control.value))) {
|
|
106
|
+
return {
|
|
107
|
+
isNumber: {
|
|
108
|
+
expected: 'A number or a string representing a number',
|
|
109
|
+
actual: control.value,
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
return null;
|
|
188
114
|
}
|
|
189
|
-
|
|
190
|
-
function IsArray({ message } = {}) {
|
|
115
|
+
function _IsNumber({ message, options, } = {}) {
|
|
191
116
|
return (control) => {
|
|
192
117
|
if (control.value === null) {
|
|
193
118
|
return null;
|
|
194
119
|
}
|
|
195
|
-
if (!
|
|
120
|
+
if (!isNumber(!options?.strict && typeof control.value === 'string' ? Number(control.value) : control.value, options)) {
|
|
196
121
|
return {
|
|
197
|
-
|
|
198
|
-
expected: 'A
|
|
122
|
+
isNumber: {
|
|
123
|
+
expected: 'A number value',
|
|
199
124
|
actual: control.value,
|
|
200
125
|
message,
|
|
201
126
|
},
|
|
@@ -288,15 +213,15 @@ function IsComplex({ message, options, }) {
|
|
|
288
213
|
};
|
|
289
214
|
}
|
|
290
215
|
|
|
291
|
-
function
|
|
216
|
+
function IsDate({ message } = {}) {
|
|
292
217
|
return (control) => {
|
|
293
218
|
if (control.value === null) {
|
|
294
219
|
return null;
|
|
295
220
|
}
|
|
296
|
-
if (!
|
|
221
|
+
if (!(control.value instanceof Date && !isNaN(control.value.getTime()))) {
|
|
297
222
|
return {
|
|
298
|
-
|
|
299
|
-
expected: 'A
|
|
223
|
+
isDate: {
|
|
224
|
+
expected: 'A date value',
|
|
300
225
|
actual: control.value,
|
|
301
226
|
message,
|
|
302
227
|
},
|
|
@@ -324,15 +249,33 @@ function IsEmail({ message, options, } = {}) {
|
|
|
324
249
|
};
|
|
325
250
|
}
|
|
326
251
|
|
|
327
|
-
function
|
|
252
|
+
function IsEnum({ message, entity, }) {
|
|
328
253
|
return (control) => {
|
|
329
254
|
if (control.value === null) {
|
|
330
255
|
return null;
|
|
331
256
|
}
|
|
332
|
-
if (
|
|
257
|
+
if (Object.keys(entity).map(k => entity[k]).indexOf(control.value) === -1) {
|
|
333
258
|
return {
|
|
334
|
-
|
|
335
|
-
expected: 'A
|
|
259
|
+
isEnum: {
|
|
260
|
+
expected: 'A enum value',
|
|
261
|
+
actual: control.value,
|
|
262
|
+
message,
|
|
263
|
+
},
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
return null;
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
function IsInt({ message, options, } = {}) {
|
|
271
|
+
return (control) => {
|
|
272
|
+
if (control.value === null) {
|
|
273
|
+
return null;
|
|
274
|
+
}
|
|
275
|
+
if (!isNumber(control.value, options) || Number.isInteger(control.value)) {
|
|
276
|
+
return {
|
|
277
|
+
isInt: {
|
|
278
|
+
expected: 'A int value',
|
|
336
279
|
actual: control.value,
|
|
337
280
|
message,
|
|
338
281
|
},
|
|
@@ -360,6 +303,45 @@ function IsIP({ message, version, } = {}) {
|
|
|
360
303
|
};
|
|
361
304
|
}
|
|
362
305
|
|
|
306
|
+
function IsObject({ message } = {}) {
|
|
307
|
+
return (control) => {
|
|
308
|
+
if (control.value === null) {
|
|
309
|
+
return null;
|
|
310
|
+
}
|
|
311
|
+
if (!(control.value !==
|
|
312
|
+
undefined &&
|
|
313
|
+
(typeof control.value === 'object' || typeof control.value === 'function') &&
|
|
314
|
+
!Array.isArray(control.value))) {
|
|
315
|
+
return {
|
|
316
|
+
isObject: {
|
|
317
|
+
expected: 'A object value',
|
|
318
|
+
actual: control.value,
|
|
319
|
+
message,
|
|
320
|
+
},
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
return null;
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function IsPhoneNumber({ message, locale, options, } = {}) {
|
|
328
|
+
return (control) => {
|
|
329
|
+
if (control.value === null) {
|
|
330
|
+
return null;
|
|
331
|
+
}
|
|
332
|
+
if (!isMobilePhone(control.value, locale, options)) {
|
|
333
|
+
return {
|
|
334
|
+
isPhoneNumber: {
|
|
335
|
+
expected: 'A phone number value',
|
|
336
|
+
actual: control.value,
|
|
337
|
+
message,
|
|
338
|
+
},
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
return null;
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
|
|
363
345
|
function IsPort({ message } = {}) {
|
|
364
346
|
return (control) => {
|
|
365
347
|
if (control.value === null) {
|
|
@@ -378,6 +360,24 @@ function IsPort({ message } = {}) {
|
|
|
378
360
|
};
|
|
379
361
|
}
|
|
380
362
|
|
|
363
|
+
function IsUrl({ message, options, } = {}) {
|
|
364
|
+
return (control) => {
|
|
365
|
+
if (control.value === null) {
|
|
366
|
+
return null;
|
|
367
|
+
}
|
|
368
|
+
if (!(typeof control.value === 'string' && isURL(control.value, options))) {
|
|
369
|
+
return {
|
|
370
|
+
isURL: {
|
|
371
|
+
expected: 'A url value',
|
|
372
|
+
actual: control.value,
|
|
373
|
+
message,
|
|
374
|
+
},
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
return null;
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
|
|
381
381
|
function IsUUID({ message, version = 'all', } = {}) {
|
|
382
382
|
return (control) => {
|
|
383
383
|
if (control.value === null) {
|