@rxap/forms 18.0.3 → 18.0.4

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.
Files changed (164) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +1 -1
  3. package/compodoc/dependencies.html +9 -9
  4. package/compodoc/index.html +1 -1
  5. package/compodoc/js/search/search_index.js +2 -2
  6. package/docs/classes/ControlValueAccessor.html +2 -2
  7. package/docs/classes/FormArrayControlManager.html +2 -2
  8. package/docs/classes/FormControlErrorDirective.html +2 -2
  9. package/docs/classes/FormControlMarkDirtyDirective.html +2 -2
  10. package/docs/classes/FormControlMarkPristineDirective.html +2 -2
  11. package/docs/classes/FormControlMarkTouchedDirective.html +2 -2
  12. package/docs/classes/FormControlMarkUntouchedDirective.html +2 -2
  13. package/docs/classes/FormControlNameDirective.html +3 -3
  14. package/docs/classes/FormDirective.html +13 -13
  15. package/docs/classes/FormGroupNameDirective.html +3 -3
  16. package/docs/classes/FormLoadedDirective.html +2 -2
  17. package/docs/classes/FormLoadingDirective.html +2 -2
  18. package/docs/classes/FormLoadingErrorDirective.html +2 -2
  19. package/docs/classes/FormSubmitDirective.html +2 -2
  20. package/docs/classes/FormSubmitFailedDirective.html +2 -2
  21. package/docs/classes/FormSubmitInvalidDirective.html +2 -2
  22. package/docs/classes/FormSubmitSuccessfulDirective.html +2 -2
  23. package/docs/classes/FormSubmittingDirective.html +2 -2
  24. package/docs/classes/ParentControlContainerDirective.html +1 -1
  25. package/docs/classes/RxapFormArray.html +33 -33
  26. package/docs/classes/RxapFormBuilder.html +7 -7
  27. package/docs/classes/RxapFormControl.html +21 -21
  28. package/docs/classes/RxapFormGroup.html +21 -21
  29. package/docs/classes/RxapFormsModule.html +1 -1
  30. package/docs/documentation.json +1153 -1153
  31. package/docs/enums/MetadataKeys.html +2 -2
  32. package/docs/functions/ControlAsyncValidator.html +1 -1
  33. package/docs/functions/ControlChange.html +1 -1
  34. package/docs/functions/ControlSetValue.html +1 -1
  35. package/docs/functions/ControlValidator.html +1 -1
  36. package/docs/functions/IsArray.html +1 -1
  37. package/docs/functions/IsBoolean.html +1 -1
  38. package/docs/functions/IsComplex.html +1 -1
  39. package/docs/functions/IsDate.html +1 -1
  40. package/docs/functions/IsEmail.html +1 -1
  41. package/docs/functions/IsEnum.html +1 -1
  42. package/docs/functions/IsIP.html +1 -1
  43. package/docs/functions/IsInt.html +1 -1
  44. package/docs/functions/IsNumber.html +1 -1
  45. package/docs/functions/IsObject.html +1 -1
  46. package/docs/functions/IsPhoneNumber.html +1 -1
  47. package/docs/functions/IsPort.html +1 -1
  48. package/docs/functions/IsString.html +1 -1
  49. package/docs/functions/IsUUID.html +1 -1
  50. package/docs/functions/IsUrl.html +1 -1
  51. package/docs/functions/RxapForm.html +1 -1
  52. package/docs/functions/ToFormMethod.html +1 -1
  53. package/docs/functions/ToFormSubmitMethod.html +1 -1
  54. package/docs/functions/UseFormArrayControl.html +1 -1
  55. package/docs/functions/UseFormArrayGroup.html +1 -1
  56. package/docs/functions/UseFormControl.html +1 -1
  57. package/docs/functions/UseFormGroup.html +1 -1
  58. package/docs/functions/_IsNumber.html +1 -1
  59. package/docs/functions/controlDisabledWhile.html +1 -1
  60. package/docs/functions/controlDisabled_.html +1 -1
  61. package/docs/functions/controlEnabledWhile.html +1 -1
  62. package/docs/functions/controlEnabled_.html +1 -1
  63. package/docs/functions/controlErrorChanges_.html +1 -1
  64. package/docs/functions/controlReadonly_.html +1 -1
  65. package/docs/functions/controlStatusChanges_.html +1 -1
  66. package/docs/functions/controlValueChanges_.html +1 -1
  67. package/docs/functions/disableControl.html +1 -1
  68. package/docs/functions/enableControl.html +1 -1
  69. package/docs/functions/hasErrorAndDirty.html +1 -1
  70. package/docs/functions/hasErrorAndTouched.html +1 -1
  71. package/docs/functions/isNumber-1.html +1 -1
  72. package/docs/functions/markAllDirty.html +1 -1
  73. package/docs/functions/markAllPristine.html +1 -1
  74. package/docs/functions/markAllUntouched.html +1 -1
  75. package/docs/functions/mergeControlValidators.html +1 -1
  76. package/docs/functions/selectControlValue_.html +1 -1
  77. package/docs/functions/validateControlOn.html +1 -1
  78. package/docs/index.html +1 -1
  79. package/docs/interfaces/AbstractControl.html +5 -5
  80. package/docs/interfaces/AbstractControlOptions.html +3 -3
  81. package/docs/interfaces/BoxedValue.html +2 -2
  82. package/docs/interfaces/ComplexityOptions.html +2 -2
  83. package/docs/interfaces/ControlOptions.html +3 -3
  84. package/docs/interfaces/ControlSetValueOptions.html +2 -2
  85. package/docs/interfaces/FormArrayOptions.html +2 -2
  86. package/docs/interfaces/FormDefinition.html +6 -6
  87. package/docs/interfaces/FormDefinitionArray.html +2 -2
  88. package/docs/interfaces/FormDefinitionMetadata.html +2 -2
  89. package/docs/interfaces/FormGroupOptions.html +2 -2
  90. package/docs/interfaces/FormLoadFailedMethod.html +2 -2
  91. package/docs/interfaces/FormLoadMethod.html +2 -2
  92. package/docs/interfaces/FormLoadSuccessfulMethod.html +2 -2
  93. package/docs/interfaces/FormOptions.html +2 -2
  94. package/docs/interfaces/FormSubmitFailedMethod.html +2 -2
  95. package/docs/interfaces/FormSubmitMethod.html +2 -2
  96. package/docs/interfaces/FormSubmitSuccessfulMethod.html +2 -2
  97. package/docs/interfaces/InjectableValidator.html +2 -2
  98. package/docs/interfaces/IsNumberOptions.html +2 -2
  99. package/docs/interfaces/NgValidatorsErrors.html +2 -2
  100. package/docs/interfaces/RxapAbstractControlOptionsWithDefinition.html +2 -2
  101. package/docs/interfaces/_RxapAbstractControlOptions.html +2 -2
  102. package/docs/types/AsyncValidator.html +1 -1
  103. package/docs/types/AsyncValidatorFn.html +1 -1
  104. package/docs/types/ChangeFn.html +1 -1
  105. package/docs/types/ControlEventOptions.html +1 -1
  106. package/docs/types/ControlInsertedFn.html +1 -1
  107. package/docs/types/ControlPath.html +1 -1
  108. package/docs/types/ControlRemovedFn.html +1 -1
  109. package/docs/types/ControlState.html +1 -1
  110. package/docs/types/EmitEvent.html +1 -1
  111. package/docs/types/ExtractAbstractControl.html +1 -1
  112. package/docs/types/ExtractStrings.html +1 -1
  113. package/docs/types/FormBuilderFn.html +1 -1
  114. package/docs/types/FormType.html +1 -1
  115. package/docs/types/KeyValueControls.html +1 -1
  116. package/docs/types/OnlySelf.html +1 -1
  117. package/docs/types/OrBoxedValue.html +1 -1
  118. package/docs/types/RxapAbstractControlOptions.html +1 -1
  119. package/docs/types/SetValueFn.html +1 -1
  120. package/docs/types/ValidationErrors.html +1 -1
  121. package/docs/types/Validator.html +1 -1
  122. package/docs/types/ValidatorFn.html +1 -1
  123. package/docs/types/ValidatorOrOpts.html +1 -1
  124. package/docs/variables/RXAP_FORM_CONTEXT.html +1 -1
  125. package/docs/variables/RXAP_FORM_DEFINITION.html +1 -1
  126. package/docs/variables/RXAP_FORM_DEFINITION_BUILDER.html +1 -1
  127. package/docs/variables/RXAP_FORM_INITIAL_STATE.html +1 -1
  128. package/docs/variables/RXAP_FORM_LOAD_FAILED_METHOD.html +1 -1
  129. package/docs/variables/RXAP_FORM_LOAD_METHOD.html +1 -1
  130. package/docs/variables/RXAP_FORM_LOAD_SUCCESSFUL_METHOD.html +1 -1
  131. package/docs/variables/RXAP_FORM_SUBMIT_FAILED_METHOD.html +1 -1
  132. package/docs/variables/RXAP_FORM_SUBMIT_METHOD.html +1 -1
  133. package/docs/variables/RXAP_FORM_SUBMIT_SUCCESSFUL_METHOD.html +1 -1
  134. package/docs/variables/RxapValidators.html +1 -1
  135. package/esm2022/lib/decorators/control-async-validator.mjs +2 -2
  136. package/esm2022/lib/decorators/control-change.mjs +2 -2
  137. package/esm2022/lib/decorators/control-set-value.mjs +2 -2
  138. package/esm2022/lib/decorators/control-validator.mjs +2 -2
  139. package/esm2022/lib/decorators/form.mjs +1 -1
  140. package/esm2022/lib/decorators/use-form-array.mjs +2 -2
  141. package/esm2022/lib/decorators/use-form-control.mjs +2 -2
  142. package/esm2022/lib/decorators/use-form-group.mjs +2 -2
  143. package/esm2022/lib/directives/form-control-error.directive.mjs +1 -1
  144. package/esm2022/lib/directives/form-loaded.directive.mjs +2 -2
  145. package/esm2022/lib/directives/form-loading-error.directive.mjs +2 -2
  146. package/esm2022/lib/directives/form-loading.directive.mjs +2 -2
  147. package/esm2022/lib/directives/form-submit-failed.directive.mjs +2 -2
  148. package/esm2022/lib/directives/form-submit-invalid.directive.mjs +2 -2
  149. package/esm2022/lib/directives/form-submit-successful.directive.mjs +2 -2
  150. package/esm2022/lib/directives/form-submit.directive.mjs +4 -4
  151. package/esm2022/lib/directives/form-submitting.directive.mjs +2 -2
  152. package/esm2022/lib/directives/form.directive.mjs +4 -4
  153. package/esm2022/lib/directives/forms.module.mjs +12 -12
  154. package/esm2022/lib/directives/tokens.mjs +1 -1
  155. package/esm2022/lib/validators/index.mjs +10 -10
  156. package/fesm2022/rxap-forms.mjs +132 -132
  157. package/fesm2022/rxap-forms.mjs.map +1 -1
  158. package/lib/directives/form-control-error.directive.d.ts +1 -1
  159. package/lib/directives/form-submit.directive.d.ts +1 -1
  160. package/lib/directives/form.directive.d.ts +4 -4
  161. package/lib/directives/tokens.d.ts +1 -1
  162. package/lib/validators/index.d.ts +9 -9
  163. package/package.json +19 -19
  164. package/theme.css +95 -1
@@ -1,72 +1,29 @@
1
- import { isMobilePhone, isEmail, isURL, isIP, isPort, isUUID } from '@rxap/validator';
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 { merge, defer, of, EMPTY, Subject, isObservable, BehaviorSubject, Subscription } from 'rxjs';
8
+ import { ToggleSubject } from '@rxap/rxjs';
9
9
  import * as i2 from '@rxap/services';
10
10
  import { LoadingIndicatorService } from '@rxap/services';
11
- import { ToggleSubject } from '@rxap/rxjs';
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 (!isNumber(!options?.strict && typeof control.value === 'string' ? Number(control.value) : control.value, options)) {
23
+ if (!Array.isArray(control.value)) {
67
24
  return {
68
- isNumber: {
69
- expected: 'A number value',
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
- function IsInt({ message, options, } = {}) {
137
- return (control) => {
138
- if (control.value === null) {
139
- return null;
140
- }
141
- if (!isNumber(control.value, options) || Number.isInteger(control.value)) {
142
- return {
143
- isInt: {
144
- expected: 'A int value',
145
- actual: control.value,
146
- message,
147
- },
148
- };
149
- }
150
- return null;
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 (Object.keys(entity).map(k => entity[k]).indexOf(control.value) === -1) {
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
- return null;
169
- };
93
+ }
94
+ return Number.isFinite(value);
170
95
  }
171
-
172
- function IsDate({ message } = {}) {
173
- return (control) => {
174
- if (control.value === null) {
175
- return null;
176
- }
177
- if (!(control.value instanceof Date && !isNaN(control.value.getTime()))) {
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 (!Array.isArray(control.value)) {
120
+ if (!isNumber(!options?.strict && typeof control.value === 'string' ? Number(control.value) : control.value, options)) {
196
121
  return {
197
- isArray: {
198
- expected: 'A array value',
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 IsPhoneNumber({ message, locale, options, } = {}) {
216
+ function IsDate({ message } = {}) {
292
217
  return (control) => {
293
218
  if (control.value === null) {
294
219
  return null;
295
220
  }
296
- if (!isMobilePhone(control.value, locale, options)) {
221
+ if (!(control.value instanceof Date && !isNaN(control.value.getTime()))) {
297
222
  return {
298
- isPhoneNumber: {
299
- expected: 'A phone number value',
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 IsUrl({ message, options, } = {}) {
252
+ function IsEnum({ message, entity, }) {
328
253
  return (control) => {
329
254
  if (control.value === null) {
330
255
  return null;
331
256
  }
332
- if (!(typeof control.value === 'string' && isURL(control.value, options))) {
257
+ if (Object.keys(entity).map(k => entity[k]).indexOf(control.value) === -1) {
333
258
  return {
334
- isURL: {
335
- expected: 'A url value',
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) {