@rxap/forms 18.0.2-dev.1 → 18.0.3-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.
Files changed (281) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +1 -1
  3. package/compodoc/changelog.html +775 -0
  4. package/compodoc/classes/ControlValueAccessor.html +607 -0
  5. package/compodoc/classes/FormArrayControlManager.html +1177 -0
  6. package/compodoc/classes/RxapFormArray.html +3898 -0
  7. package/compodoc/classes/RxapFormBuilder.html +1132 -0
  8. package/compodoc/classes/RxapFormControl.html +3573 -0
  9. package/compodoc/classes/RxapFormGroup.html +6619 -0
  10. package/compodoc/dependencies.html +215 -0
  11. package/compodoc/directives/FormControlErrorDirective.html +496 -0
  12. package/compodoc/directives/FormControlMarkDirtyDirective.html +446 -0
  13. package/compodoc/directives/FormControlMarkPristineDirective.html +445 -0
  14. package/compodoc/directives/FormControlMarkTouchedDirective.html +438 -0
  15. package/compodoc/directives/FormControlMarkUntouchedDirective.html +445 -0
  16. package/compodoc/directives/FormControlNameDirective.html +527 -0
  17. package/compodoc/directives/FormDirective.html +2415 -0
  18. package/compodoc/directives/FormGroupNameDirective.html +500 -0
  19. package/compodoc/directives/FormLoadedDirective.html +374 -0
  20. package/compodoc/directives/FormLoadingDirective.html +374 -0
  21. package/compodoc/directives/FormLoadingErrorDirective.html +370 -0
  22. package/compodoc/directives/FormSubmitDirective.html +690 -0
  23. package/compodoc/directives/FormSubmitFailedDirective.html +370 -0
  24. package/compodoc/directives/FormSubmitInvalidDirective.html +368 -0
  25. package/compodoc/directives/FormSubmitSuccessfulDirective.html +368 -0
  26. package/compodoc/directives/FormSubmittingDirective.html +374 -0
  27. package/compodoc/directives/ParentControlContainerDirective.html +274 -0
  28. package/compodoc/fonts/ionicons.eot +0 -0
  29. package/compodoc/fonts/ionicons.svg +2090 -0
  30. package/compodoc/fonts/ionicons.ttf +0 -0
  31. package/compodoc/fonts/ionicons.woff +0 -0
  32. package/compodoc/fonts/ionicons.woff2 +0 -0
  33. package/compodoc/fonts/roboto-v15-latin-300.eot +0 -0
  34. package/compodoc/fonts/roboto-v15-latin-300.svg +314 -0
  35. package/compodoc/fonts/roboto-v15-latin-300.ttf +0 -0
  36. package/compodoc/fonts/roboto-v15-latin-300.woff +0 -0
  37. package/compodoc/fonts/roboto-v15-latin-300.woff2 +0 -0
  38. package/compodoc/fonts/roboto-v15-latin-700.eot +0 -0
  39. package/compodoc/fonts/roboto-v15-latin-700.svg +310 -0
  40. package/compodoc/fonts/roboto-v15-latin-700.ttf +0 -0
  41. package/compodoc/fonts/roboto-v15-latin-700.woff +0 -0
  42. package/compodoc/fonts/roboto-v15-latin-700.woff2 +0 -0
  43. package/compodoc/fonts/roboto-v15-latin-italic.eot +0 -0
  44. package/compodoc/fonts/roboto-v15-latin-italic.svg +323 -0
  45. package/compodoc/fonts/roboto-v15-latin-italic.ttf +0 -0
  46. package/compodoc/fonts/roboto-v15-latin-italic.woff +0 -0
  47. package/compodoc/fonts/roboto-v15-latin-italic.woff2 +0 -0
  48. package/compodoc/fonts/roboto-v15-latin-regular.eot +0 -0
  49. package/compodoc/fonts/roboto-v15-latin-regular.svg +308 -0
  50. package/compodoc/fonts/roboto-v15-latin-regular.ttf +0 -0
  51. package/compodoc/fonts/roboto-v15-latin-regular.woff +0 -0
  52. package/compodoc/fonts/roboto-v15-latin-regular.woff2 +0 -0
  53. package/compodoc/graph/dependencies.svg +450 -0
  54. package/compodoc/images/compodoc-vectorise-inverted.png +0 -0
  55. package/compodoc/images/compodoc-vectorise-inverted.svg +201 -0
  56. package/compodoc/images/compodoc-vectorise.png +0 -0
  57. package/compodoc/images/compodoc-vectorise.svg +201 -0
  58. package/compodoc/images/favicon.ico +0 -0
  59. package/compodoc/index.html +190 -0
  60. package/compodoc/interfaces/AbstractControl.html +622 -0
  61. package/compodoc/interfaces/AbstractControlOptions.html +448 -0
  62. package/compodoc/interfaces/BoxedValue.html +436 -0
  63. package/compodoc/interfaces/ComplexityOptions.html +819 -0
  64. package/compodoc/interfaces/ControlOptions.html +689 -0
  65. package/compodoc/interfaces/ControlSetValueOptions.html +345 -0
  66. package/compodoc/interfaces/FormArrayOptions.html +544 -0
  67. package/compodoc/interfaces/FormDefinition.html +626 -0
  68. package/compodoc/interfaces/FormDefinitionArray.html +427 -0
  69. package/compodoc/interfaces/FormDefinitionMetadata.html +486 -0
  70. package/compodoc/interfaces/FormGroupOptions.html +427 -0
  71. package/compodoc/interfaces/FormLoadFailedMethod.html +360 -0
  72. package/compodoc/interfaces/FormLoadMethod.html +330 -0
  73. package/compodoc/interfaces/FormLoadSuccessfulMethod.html +360 -0
  74. package/compodoc/interfaces/FormOptions.html +427 -0
  75. package/compodoc/interfaces/FormSubmitFailedMethod.html +360 -0
  76. package/compodoc/interfaces/FormSubmitMethod.html +360 -0
  77. package/compodoc/interfaces/FormSubmitSuccessfulMethod.html +360 -0
  78. package/compodoc/interfaces/InjectableValidator.html +472 -0
  79. package/compodoc/interfaces/IsNumberOptions.html +515 -0
  80. package/compodoc/interfaces/LengthOptions.html +564 -0
  81. package/compodoc/interfaces/NgValidatorsErrors.html +613 -0
  82. package/compodoc/interfaces/RegexOptions.html +603 -0
  83. package/compodoc/interfaces/RxapAbstractControlOptionsWithDefinition.html +427 -0
  84. package/compodoc/js/compodoc.js +14 -0
  85. package/compodoc/js/lazy-load-graphs.js +44 -0
  86. package/compodoc/js/libs/EventDispatcher.js +5 -0
  87. package/compodoc/js/libs/bootstrap-native.js +2 -0
  88. package/compodoc/js/libs/clipboard.min.js +7 -0
  89. package/compodoc/js/libs/custom-elements-es5-adapter.js +15 -0
  90. package/compodoc/js/libs/custom-elements.min.js +38 -0
  91. package/compodoc/js/libs/d3.v3.min.js +2 -0
  92. package/compodoc/js/libs/deep-iterator.js +2 -0
  93. package/compodoc/js/libs/es6-shim.min.js +12 -0
  94. package/compodoc/js/libs/htmlparser.js +23 -0
  95. package/compodoc/js/libs/innersvg.js +9 -0
  96. package/compodoc/js/libs/lit-html.js +1 -0
  97. package/compodoc/js/libs/prism.js +46 -0
  98. package/compodoc/js/libs/promise.min.js +6 -0
  99. package/compodoc/js/libs/svg-pan-zoom.min.js +3 -0
  100. package/compodoc/js/libs/tablesort.min.js +6 -0
  101. package/compodoc/js/libs/tablesort.number.min.js +6 -0
  102. package/compodoc/js/libs/vis.min.js +47 -0
  103. package/compodoc/js/libs/zepto.min.js +2 -0
  104. package/compodoc/js/menu-wc.js +339 -0
  105. package/compodoc/js/menu-wc_es5.js +40 -0
  106. package/compodoc/js/menu.js +270 -0
  107. package/compodoc/js/routes.js +301 -0
  108. package/compodoc/js/search/lunr.min.js +6 -0
  109. package/compodoc/js/search/search-lunr.js +67 -0
  110. package/compodoc/js/search/search.js +283 -0
  111. package/compodoc/js/search/search_index.js +4 -0
  112. package/compodoc/js/sourceCode.js +58 -0
  113. package/compodoc/js/svg-pan-zoom.controls.js +53 -0
  114. package/compodoc/js/tabs.js +21 -0
  115. package/compodoc/js/tree.js +147 -0
  116. package/compodoc/license.html +731 -0
  117. package/compodoc/miscellaneous/enumerations.html +291 -0
  118. package/compodoc/miscellaneous/functions.html +3756 -0
  119. package/compodoc/miscellaneous/typealiases.html +657 -0
  120. package/compodoc/miscellaneous/variables.html +554 -0
  121. package/compodoc/modules/RxapFormsModule/dependencies.svg +450 -0
  122. package/compodoc/modules/RxapFormsModule.html +864 -0
  123. package/compodoc/modules.html +200 -0
  124. package/compodoc/overview.html +681 -0
  125. package/compodoc/properties.html +195 -0
  126. package/compodoc/styles/bootstrap-card.css +219 -0
  127. package/compodoc/styles/bootstrap.min.css +6 -0
  128. package/compodoc/styles/compodoc.css +1124 -0
  129. package/compodoc/styles/dark.css +121 -0
  130. package/compodoc/styles/ionicons.min.css +11 -0
  131. package/compodoc/styles/laravel.css +113 -0
  132. package/compodoc/styles/material.css +131 -0
  133. package/compodoc/styles/original.css +51 -0
  134. package/compodoc/styles/postmark.css +238 -0
  135. package/compodoc/styles/prism.css +301 -0
  136. package/compodoc/styles/readthedocs.css +117 -0
  137. package/compodoc/styles/reset.css +129 -0
  138. package/compodoc/styles/stripe.css +106 -0
  139. package/compodoc/styles/style.css +7 -0
  140. package/compodoc/styles/tablesort.css +33 -0
  141. package/compodoc/styles/vagrant.css +130 -0
  142. package/docs/.nojekyll +1 -0
  143. package/docs/assets/highlight.css +92 -0
  144. package/docs/assets/icons.js +15 -0
  145. package/docs/assets/icons.svg +1 -0
  146. package/docs/assets/main.js +59 -0
  147. package/docs/assets/navigation.js +1 -0
  148. package/docs/assets/search.js +1 -0
  149. package/docs/assets/style.css +1412 -0
  150. package/docs/classes/ControlValueAccessor.html +8 -0
  151. package/docs/classes/FormArrayControlManager.html +6 -0
  152. package/docs/classes/FormControlErrorDirective.html +11 -0
  153. package/docs/classes/FormControlMarkDirtyDirective.html +4 -0
  154. package/docs/classes/FormControlMarkPristineDirective.html +4 -0
  155. package/docs/classes/FormControlMarkTouchedDirective.html +4 -0
  156. package/docs/classes/FormControlMarkUntouchedDirective.html +4 -0
  157. package/docs/classes/FormControlNameDirective.html +113 -0
  158. package/docs/classes/FormDirective.html +187 -0
  159. package/docs/classes/FormGroupNameDirective.html +101 -0
  160. package/docs/classes/FormLoadedDirective.html +8 -0
  161. package/docs/classes/FormLoadingDirective.html +8 -0
  162. package/docs/classes/FormLoadingErrorDirective.html +8 -0
  163. package/docs/classes/FormSubmitDirective.html +15 -0
  164. package/docs/classes/FormSubmitFailedDirective.html +8 -0
  165. package/docs/classes/FormSubmitInvalidDirective.html +8 -0
  166. package/docs/classes/FormSubmitSuccessfulDirective.html +8 -0
  167. package/docs/classes/FormSubmittingDirective.html +8 -0
  168. package/docs/classes/ParentControlContainerDirective.html +2 -0
  169. package/docs/classes/RxapFormArray.html +429 -0
  170. package/docs/classes/RxapFormBuilder.html +65 -0
  171. package/docs/classes/RxapFormControl.html +264 -0
  172. package/docs/classes/RxapFormGroup.html +260 -0
  173. package/docs/classes/RxapFormsModule.html +2 -0
  174. package/docs/documentation.json +91227 -0
  175. package/docs/enums/MetadataKeys.html +9 -0
  176. package/docs/functions/ControlAsyncValidator.html +1 -0
  177. package/docs/functions/ControlChange.html +1 -0
  178. package/docs/functions/ControlSetValue.html +1 -0
  179. package/docs/functions/ControlValidator.html +1 -0
  180. package/docs/functions/IsArray.html +1 -0
  181. package/docs/functions/IsBoolean.html +1 -0
  182. package/docs/functions/IsComplex.html +1 -0
  183. package/docs/functions/IsDate.html +1 -0
  184. package/docs/functions/IsEmail.html +1 -0
  185. package/docs/functions/IsEnum.html +1 -0
  186. package/docs/functions/IsIP.html +1 -0
  187. package/docs/functions/IsInt.html +1 -0
  188. package/docs/functions/IsNumber.html +2 -0
  189. package/docs/functions/IsObject.html +1 -0
  190. package/docs/functions/IsPhoneNumber.html +1 -0
  191. package/docs/functions/IsPort.html +1 -0
  192. package/docs/functions/IsString.html +1 -0
  193. package/docs/functions/IsUUID.html +1 -0
  194. package/docs/functions/IsUrl.html +1 -0
  195. package/docs/functions/RxapForm.html +1 -0
  196. package/docs/functions/ToFormMethod.html +1 -0
  197. package/docs/functions/ToFormSubmitMethod.html +3 -0
  198. package/docs/functions/UseFormArrayControl.html +1 -0
  199. package/docs/functions/UseFormArrayGroup.html +1 -0
  200. package/docs/functions/UseFormControl.html +1 -0
  201. package/docs/functions/UseFormGroup.html +1 -0
  202. package/docs/functions/_IsNumber.html +1 -0
  203. package/docs/functions/controlDisabledWhile.html +1 -0
  204. package/docs/functions/controlDisabled_.html +1 -0
  205. package/docs/functions/controlEnabledWhile.html +1 -0
  206. package/docs/functions/controlEnabled_.html +1 -0
  207. package/docs/functions/controlErrorChanges_.html +1 -0
  208. package/docs/functions/controlReadonly_.html +1 -0
  209. package/docs/functions/controlStatusChanges_.html +1 -0
  210. package/docs/functions/controlValueChanges_.html +1 -0
  211. package/docs/functions/disableControl.html +1 -0
  212. package/docs/functions/enableControl.html +1 -0
  213. package/docs/functions/hasErrorAndDirty.html +1 -0
  214. package/docs/functions/hasErrorAndTouched.html +1 -0
  215. package/docs/functions/isNumber-1.html +2 -0
  216. package/docs/functions/markAllDirty.html +1 -0
  217. package/docs/functions/markAllPristine.html +1 -0
  218. package/docs/functions/markAllUntouched.html +1 -0
  219. package/docs/functions/mergeControlValidators.html +1 -0
  220. package/docs/functions/selectControlValue_.html +1 -0
  221. package/docs/functions/validateControlOn.html +1 -0
  222. package/docs/hierarchy.html +1 -0
  223. package/docs/index.html +16 -0
  224. package/docs/interfaces/AbstractControl.html +373 -0
  225. package/docs/interfaces/AbstractControlOptions.html +5 -0
  226. package/docs/interfaces/BoxedValue.html +3 -0
  227. package/docs/interfaces/ComplexityOptions.html +11 -0
  228. package/docs/interfaces/ControlOptions.html +20 -0
  229. package/docs/interfaces/ControlSetValueOptions.html +3 -0
  230. package/docs/interfaces/FormArrayOptions.html +16 -0
  231. package/docs/interfaces/FormDefinition.html +13 -0
  232. package/docs/interfaces/FormDefinitionArray.html +179 -0
  233. package/docs/interfaces/FormDefinitionMetadata.html +17 -0
  234. package/docs/interfaces/FormGroupOptions.html +13 -0
  235. package/docs/interfaces/FormLoadFailedMethod.html +3 -0
  236. package/docs/interfaces/FormLoadMethod.html +3 -0
  237. package/docs/interfaces/FormLoadSuccessfulMethod.html +3 -0
  238. package/docs/interfaces/FormOptions.html +13 -0
  239. package/docs/interfaces/FormSubmitFailedMethod.html +3 -0
  240. package/docs/interfaces/FormSubmitMethod.html +3 -0
  241. package/docs/interfaces/FormSubmitSuccessfulMethod.html +3 -0
  242. package/docs/interfaces/InjectableValidator.html +3 -0
  243. package/docs/interfaces/IsNumberOptions.html +6 -0
  244. package/docs/interfaces/NgValidatorsErrors.html +8 -0
  245. package/docs/interfaces/RxapAbstractControlOptionsWithDefinition.html +13 -0
  246. package/docs/interfaces/_RxapAbstractControlOptions.html +12 -0
  247. package/docs/modules.html +128 -0
  248. package/docs/types/AsyncValidator.html +1 -0
  249. package/docs/types/AsyncValidatorFn.html +1 -0
  250. package/docs/types/ChangeFn.html +1 -0
  251. package/docs/types/ControlEventOptions.html +1 -0
  252. package/docs/types/ControlInsertedFn.html +1 -0
  253. package/docs/types/ControlPath.html +1 -0
  254. package/docs/types/ControlRemovedFn.html +1 -0
  255. package/docs/types/ControlState.html +1 -0
  256. package/docs/types/EmitEvent.html +1 -0
  257. package/docs/types/ExtractAbstractControl.html +1 -0
  258. package/docs/types/ExtractStrings.html +1 -0
  259. package/docs/types/FormBuilderFn.html +1 -0
  260. package/docs/types/FormType.html +1 -0
  261. package/docs/types/KeyValueControls.html +1 -0
  262. package/docs/types/OnlySelf.html +1 -0
  263. package/docs/types/OrBoxedValue.html +1 -0
  264. package/docs/types/RxapAbstractControlOptions.html +1 -0
  265. package/docs/types/SetValueFn.html +1 -0
  266. package/docs/types/ValidationErrors.html +1 -0
  267. package/docs/types/Validator.html +1 -0
  268. package/docs/types/ValidatorFn.html +1 -0
  269. package/docs/types/ValidatorOrOpts.html +1 -0
  270. package/docs/variables/RXAP_FORM_CONTEXT.html +1 -0
  271. package/docs/variables/RXAP_FORM_DEFINITION.html +1 -0
  272. package/docs/variables/RXAP_FORM_DEFINITION_BUILDER.html +1 -0
  273. package/docs/variables/RXAP_FORM_INITIAL_STATE.html +1 -0
  274. package/docs/variables/RXAP_FORM_LOAD_FAILED_METHOD.html +1 -0
  275. package/docs/variables/RXAP_FORM_LOAD_METHOD.html +1 -0
  276. package/docs/variables/RXAP_FORM_LOAD_SUCCESSFUL_METHOD.html +1 -0
  277. package/docs/variables/RXAP_FORM_SUBMIT_FAILED_METHOD.html +1 -0
  278. package/docs/variables/RXAP_FORM_SUBMIT_METHOD.html +1 -0
  279. package/docs/variables/RXAP_FORM_SUBMIT_SUCCESSFUL_METHOD.html +1 -0
  280. package/docs/variables/RxapValidators.html +1 -0
  281. package/package.json +18 -18
@@ -0,0 +1,1177 @@
1
+ <!doctype html>
2
+ <html class="no-js" lang="">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
6
+ <title>angular-forms</title>
7
+ <meta name="description" content="">
8
+ <meta name="viewport" content="width=device-width, initial-scale=1">
9
+
10
+ <link rel="icon" type="image/x-icon" href="../images/favicon.ico">
11
+ <link rel="stylesheet" href="../styles/style.css">
12
+ <link rel="stylesheet" href="../styles/dark.css">
13
+ </head>
14
+ <body>
15
+ <script>
16
+ // Blocking script to avoid flickering dark mode
17
+ // Dark mode toggle button
18
+ var useDark = window.matchMedia('(prefers-color-scheme: dark)');
19
+ var darkModeState = useDark.matches;
20
+ var $darkModeToggleSwitchers = document.querySelectorAll('.dark-mode-switch input');
21
+ var $darkModeToggles = document.querySelectorAll('.dark-mode-switch');
22
+ var darkModeStateLocal = localStorage.getItem('compodoc_darkmode-state');
23
+
24
+ function checkToggle(check) {
25
+ for (var i = 0; i < $darkModeToggleSwitchers.length; i++) {
26
+ $darkModeToggleSwitchers[i].checked = check;
27
+ }
28
+ }
29
+
30
+ function toggleDarkMode(state) {
31
+ if (window.localStorage) {
32
+ localStorage.setItem('compodoc_darkmode-state', state);
33
+ }
34
+
35
+ checkToggle(state);
36
+
37
+ const hasClass = document.body.classList.contains('dark');
38
+
39
+ if (state) {
40
+ for (var i = 0; i < $darkModeToggles.length; i++) {
41
+ $darkModeToggles[i].classList.add('dark');
42
+ }
43
+ if (!hasClass) {
44
+ document.body.classList.add('dark');
45
+ }
46
+ } else {
47
+ for (var i = 0; i < $darkModeToggles.length; i++) {
48
+ $darkModeToggles[i].classList.remove('dark');
49
+ }
50
+ if (hasClass) {
51
+ document.body.classList.remove('dark');
52
+ }
53
+ }
54
+ }
55
+
56
+ useDark.addEventListener('change', function (evt) {
57
+ toggleDarkMode(evt.matches);
58
+ });
59
+ if (darkModeStateLocal) {
60
+ darkModeState = darkModeStateLocal === 'true';
61
+ }
62
+ toggleDarkMode(darkModeState);
63
+ </script>
64
+
65
+ <div class="navbar navbar-default navbar-fixed-top d-md-none p-0">
66
+ <div class="d-flex">
67
+ <a href="../" class="navbar-brand">angular-forms</a>
68
+ <button type="button" class="btn btn-default btn-menu ion-ios-menu" id="btn-menu"></button>
69
+ </div>
70
+ </div>
71
+
72
+ <div class="xs-menu menu" id="mobile-menu">
73
+ <div id="book-search-input" role="search"><input type="text" placeholder="Type to search"></div> <compodoc-menu></compodoc-menu>
74
+ </div>
75
+
76
+ <div class="container-fluid main">
77
+ <div class="row main">
78
+ <div class="d-none d-md-block menu">
79
+ <compodoc-menu mode="normal"></compodoc-menu>
80
+ </div>
81
+ <!-- START CONTENT -->
82
+ <div class="content class">
83
+ <div class="content-data">
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+ <ol class="breadcrumb">
97
+ <li class="breadcrumb-item">Classes</li>
98
+ <li class="breadcrumb-item" >FormArrayControlManager</li>
99
+ </ol>
100
+
101
+ <ul class="nav nav-tabs" role="tablist">
102
+ <li class="nav-item">
103
+ <a href="#info"
104
+ class="nav-link"
105
+ class="nav-link active"
106
+ role="tab" id="info-tab" data-bs-toggle="tab" data-link="info">Info</a>
107
+ </li>
108
+ <li class="nav-item">
109
+ <a href="#source"
110
+ class="nav-link"
111
+
112
+ role="tab" id="source-tab" data-bs-toggle="tab" data-link="source">Source</a>
113
+ </li>
114
+ </ul>
115
+
116
+ <div class="tab-content">
117
+ <div class="tab-pane fade active in" id="info">
118
+ <p class="comment">
119
+ <h3>File</h3>
120
+ </p>
121
+ <p class="comment">
122
+ <code>src/lib/form-builder.ts</code>
123
+ </p>
124
+
125
+
126
+
127
+
128
+
129
+
130
+ <section data-compodoc="block-index">
131
+ <h3 id="index">Index</h3>
132
+ <table class="table table-sm table-bordered index-table">
133
+ <tbody>
134
+
135
+ <tr>
136
+ <td class="col-md-4">
137
+ <h6><b>Methods</b></h6>
138
+ </td>
139
+ </tr>
140
+ <tr>
141
+ <td class="col-md-4">
142
+ <ul class="index-list">
143
+ <li>
144
+ <span class="modifier">Public</span>
145
+ <a href="#inserted" >inserted</a>
146
+ </li>
147
+ <li>
148
+ <span class="modifier">Public</span>
149
+ <a href="#removed" >removed</a>
150
+ </li>
151
+ </ul>
152
+ </td>
153
+ </tr>
154
+
155
+
156
+
157
+
158
+
159
+ </tbody>
160
+ </table>
161
+ </section>
162
+
163
+ <section data-compodoc="block-constructor">
164
+ <h3 id="constructor">Constructor</h3>
165
+ <table class="table table-sm table-bordered">
166
+ <tbody>
167
+ <tr>
168
+ <td class="col-md-4">
169
+ <code>constructor(form: T, controlId)</code>
170
+ </td>
171
+ </tr>
172
+ <tr>
173
+ <td class="col-md-4">
174
+ <div class="io-line">Defined in <a href="" data-line="37" class="link-to-prism">src/lib/form-builder.ts:37</a></div>
175
+ </td>
176
+ </tr>
177
+
178
+ <tr>
179
+ <td class="col-md-4">
180
+ <div>
181
+ <b>Parameters :</b>
182
+ <table class="params">
183
+ <thead>
184
+ <tr>
185
+ <td>Name</td>
186
+ <td>Type</td>
187
+ <td>Optional</td>
188
+ </tr>
189
+ </thead>
190
+ <tbody>
191
+ <tr>
192
+ <td>form</td>
193
+
194
+ <td>
195
+ <code>T</code>
196
+ </td>
197
+
198
+ <td>
199
+ No
200
+ </td>
201
+
202
+ </tr>
203
+ <tr>
204
+ <td>controlId</td>
205
+
206
+ <td>
207
+ </td>
208
+
209
+ <td>
210
+ No
211
+ </td>
212
+
213
+ </tr>
214
+ </tbody>
215
+ </table>
216
+ </div>
217
+ </td>
218
+ </tr>
219
+ </tbody>
220
+ </table>
221
+ </section>
222
+
223
+
224
+ <section data-compodoc="block-methods">
225
+
226
+ <h3 id="methods">
227
+ Methods
228
+ </h3>
229
+ <table class="table table-sm table-bordered">
230
+ <tbody>
231
+ <tr>
232
+ <td class="col-md-4">
233
+ <a name="inserted"></a>
234
+ <span class="name">
235
+ <span class="modifier">Public</span>
236
+ <span ><b>inserted</b></span>
237
+ <a href="#inserted"><span class="icon ion-ios-link"></span></a>
238
+ </span>
239
+ </td>
240
+ </tr>
241
+ <tr>
242
+ <td class="col-md-4">
243
+ <span class="modifier-icon icon ion-ios-reset"></span>
244
+ <code>inserted(index: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank">number</a>, controlOrDefinition: AbstractControl | FormDefinition)</code>
245
+ </td>
246
+ </tr>
247
+
248
+
249
+ <tr>
250
+ <td class="col-md-4">
251
+ <div class="io-line">Defined in <a href="" data-line="41"
252
+ class="link-to-prism">src/lib/form-builder.ts:41</a></div>
253
+ </td>
254
+ </tr>
255
+
256
+
257
+ <tr>
258
+ <td class="col-md-4">
259
+
260
+ <div class="io-description">
261
+ <b>Parameters :</b>
262
+
263
+ <table class="params">
264
+ <thead>
265
+ <tr>
266
+ <td>Name</td>
267
+ <td>Type</td>
268
+ <td>Optional</td>
269
+ </tr>
270
+ </thead>
271
+ <tbody>
272
+ <tr>
273
+ <td>index</td>
274
+ <td>
275
+ <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
276
+ </td>
277
+
278
+ <td>
279
+ No
280
+ </td>
281
+
282
+
283
+ </tr>
284
+ <tr>
285
+ <td>controlOrDefinition</td>
286
+ <td>
287
+ <code>AbstractControl | FormDefinition</code>
288
+ </td>
289
+
290
+ <td>
291
+ No
292
+ </td>
293
+
294
+
295
+ </tr>
296
+ </tbody>
297
+ </table>
298
+ </div>
299
+ <div class="io-description">
300
+ <b>Returns : </b> <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >void</a></code>
301
+
302
+ </div>
303
+ <div class="io-description">
304
+
305
+ </div>
306
+ </td>
307
+ </tr>
308
+ </tbody>
309
+ </table>
310
+ <table class="table table-sm table-bordered">
311
+ <tbody>
312
+ <tr>
313
+ <td class="col-md-4">
314
+ <a name="removed"></a>
315
+ <span class="name">
316
+ <span class="modifier">Public</span>
317
+ <span ><b>removed</b></span>
318
+ <a href="#removed"><span class="icon ion-ios-link"></span></a>
319
+ </span>
320
+ </td>
321
+ </tr>
322
+ <tr>
323
+ <td class="col-md-4">
324
+ <span class="modifier-icon icon ion-ios-reset"></span>
325
+ <code>removed(index: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank">number</a>)</code>
326
+ </td>
327
+ </tr>
328
+
329
+
330
+ <tr>
331
+ <td class="col-md-4">
332
+ <div class="io-line">Defined in <a href="" data-line="55"
333
+ class="link-to-prism">src/lib/form-builder.ts:55</a></div>
334
+ </td>
335
+ </tr>
336
+
337
+
338
+ <tr>
339
+ <td class="col-md-4">
340
+
341
+ <div class="io-description">
342
+ <b>Parameters :</b>
343
+
344
+ <table class="params">
345
+ <thead>
346
+ <tr>
347
+ <td>Name</td>
348
+ <td>Type</td>
349
+ <td>Optional</td>
350
+ </tr>
351
+ </thead>
352
+ <tbody>
353
+ <tr>
354
+ <td>index</td>
355
+ <td>
356
+ <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
357
+ </td>
358
+
359
+ <td>
360
+ No
361
+ </td>
362
+
363
+
364
+ </tr>
365
+ </tbody>
366
+ </table>
367
+ </div>
368
+ <div class="io-description">
369
+ <b>Returns : </b> <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >void</a></code>
370
+
371
+ </div>
372
+ <div class="io-description">
373
+
374
+ </div>
375
+ </td>
376
+ </tr>
377
+ </tbody>
378
+ </table>
379
+ </section>
380
+
381
+
382
+
383
+
384
+
385
+ </div>
386
+
387
+
388
+ <div class="tab-pane fade tab-source-code" id="source">
389
+ <pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import {
390
+ Injector,
391
+ isDevMode,
392
+ StaticProvider,
393
+ } from &#x27;@angular/core&#x27;;
394
+ import {
395
+ assertIsArray,
396
+ assertIsFunction,
397
+ assertIsObject,
398
+ Constructor,
399
+ HasRxapOnInitMethod,
400
+ } from &#x27;@rxap/utilities&#x27;;
401
+ import { MetadataKeys } from &#x27;./decorators/metadata-keys&#x27;;
402
+ import {
403
+ AbstractControl,
404
+ AsyncValidatorFn,
405
+ ValidatorFn,
406
+ Validators,
407
+ } from &#x27;@angular/forms&#x27;;
408
+ import {
409
+ ChangeFn,
410
+ FormDefinition,
411
+ FormDefinitionMetadata,
412
+ FormType,
413
+ RxapAbstractControlOptions,
414
+ RxapAbstractControlOptionsWithDefinition,
415
+ SetValueFn,
416
+ } from &#x27;./model&#x27;;
417
+ import { RxapFormArray } from &#x27;./form-array&#x27;;
418
+ import { RxapFormGroup } from &#x27;./form-group&#x27;;
419
+ import { RxapFormControl } from &#x27;./form-control&#x27;;
420
+ import { GetDefinitionMetadata } from &#x27;@rxap/definition&#x27;;
421
+ import { ControlSetValueOptions } from &#x27;./decorators/control-set-value&#x27;;
422
+ import { getMetadata } from &#x27;@rxap/reflect-metadata&#x27;;
423
+
424
+ export class FormArrayControlManager&lt;T extends FormDefinition&gt; {
425
+ constructor(private readonly form: T, private readonly controlId: keyof T) {
426
+ }
427
+
428
+ public inserted(
429
+ index: number,
430
+ controlOrDefinition: AbstractControl | FormDefinition,
431
+ ): void {
432
+ const controlContainer &#x3D; this.form[this.controlId];
433
+ if (Array.isArray(controlContainer)) {
434
+ controlContainer.splice(index, 0, controlOrDefinition);
435
+ } else {
436
+ throw new Error(
437
+ &#x27;Could not register inserted control or definition. The control id does not points to an array of control or definition instance!&#x27;,
438
+ );
439
+ }
440
+ }
441
+
442
+ public removed(index: number): void {
443
+ const controlContainer &#x3D; this.form[this.controlId];
444
+ if (Array.isArray(controlContainer)) {
445
+ controlContainer.splice(index, 1);
446
+ } else {
447
+ throw new Error(
448
+ &#x27;Could not register inserted control or definition. The control id does not points to an array of control or definition instance!&#x27;,
449
+ );
450
+ }
451
+ }
452
+ }
453
+
454
+ export class RxapFormBuilder&lt;
455
+ Data extends Record&lt;string, any&gt; &#x3D; any,
456
+ Form extends FormType&lt;Data&gt; &#x3D; FormType&lt;Data&gt;
457
+ &gt; {
458
+ private readonly formArrayGroups: Map&lt;
459
+ string,
460
+ RxapAbstractControlOptionsWithDefinition
461
+ &gt;;
462
+ private readonly formArrayControls: Map&lt;string, RxapAbstractControlOptions&gt;;
463
+ private readonly formControls: Map&lt;string, RxapAbstractControlOptions&gt;;
464
+ private readonly formGroups: Map&lt;
465
+ string,
466
+ RxapAbstractControlOptionsWithDefinition
467
+ &gt;;
468
+ private readonly formOptions: FormDefinitionMetadata;
469
+ private readonly validators: Map&lt;string, Set&lt;string&gt;&gt;;
470
+ private readonly asyncValidators: Map&lt;string, Set&lt;string&gt;&gt;;
471
+ private readonly controlChanges: Map&lt;string, Set&lt;string&gt;&gt;;
472
+ private readonly controlSetValue: Map&lt;string, Set&lt;ControlSetValueOptions&gt;&gt;;
473
+
474
+ private readonly providers: StaticProvider[];
475
+
476
+ constructor(
477
+ private readonly definition: Constructor&lt;Form&gt;,
478
+ private readonly injector: Injector &#x3D; Injector.NULL,
479
+ providers: StaticProvider[] &#x3D; [],
480
+ ) {
481
+ this.formArrayGroups &#x3D; this.extractArrayGroups();
482
+ this.formArrayControls &#x3D; this.extractArrayControls();
483
+ this.formControls &#x3D; this.extractControls();
484
+ this.formGroups &#x3D; this.extractGroups();
485
+ this.validators &#x3D; this.extractValidators();
486
+ this.asyncValidators &#x3D; this.extractAsyncValidators();
487
+ this.controlChanges &#x3D; this.extractControlChanges();
488
+ this.controlSetValue &#x3D; this.extractControlSetValue();
489
+ const formOptions &#x3D; (this.formOptions &#x3D; this.extractFormOptions());
490
+
491
+ // merge the providers from the from options with the providers from the
492
+ // constructor. If the provider is defined in the form options and constructor
493
+ // then the provider from the constructor will be used.
494
+ this.providers &#x3D; [ ...providers, ...(formOptions.providers ?? []) ].filter(
495
+ (provider: any, index, self) &#x3D;&gt;
496
+ provider[&#x27;provide&#x27;] &amp;&amp;
497
+ self.findIndex(
498
+ (selfProvider: any) &#x3D;&gt;
499
+ selfProvider.provide &amp;&amp;
500
+ selfProvider.provide &#x3D;&#x3D;&#x3D; provider.provide,
501
+ ) &#x3D;&#x3D;&#x3D; index,
502
+ );
503
+ }
504
+
505
+ public build&lt;T extends (FormDefinition&lt;Data&gt; | FormType&lt;Data&gt;)&gt;(
506
+ state: Readonly&lt;any&gt; &#x3D; {},
507
+ options: Partial&lt;FormDefinitionMetadata &amp; { controlId?: string }&gt; &#x3D; {},
508
+ ): T {
509
+ const injector &#x3D; Injector.create({
510
+ name: &#x60;rxap/form-builder/${ this.formOptions.id }&#x60;,
511
+ parent: this.injector,
512
+ providers: this.providers,
513
+ });
514
+
515
+ let form: Record&lt;string, Function&gt; &amp; FormDefinition;
516
+
517
+ // don&#x27;t use the notFoundValue feature of the injector.
518
+ // if used for each call of the get method an &quot;empty&quot; or &quot;fallback&quot;
519
+ // instance is created
520
+
521
+ try {
522
+ form &#x3D; injector.get(this.definition);
523
+ } catch (e: any) {
524
+ if (e.name &#x3D;&#x3D;&#x3D; &#x27;NullInjectorError&#x27;) {
525
+ if (e.message.includes(&#x60;No provider for ${ this.definition.name }&#x60;)) {
526
+ if (isDevMode()) {
527
+ console.warn(
528
+ &#x60;Could not inject the definition instance. Fallback and call the constructor of the definition class: ${ e.message }&#x60;);
529
+ }
530
+ form &#x3D; new this.definition() as any;
531
+ } else {
532
+ throw e;
533
+ }
534
+ } else {
535
+ throw new Error(&#x60;Could not inject the definition instance: ${ e.message }&#x60;);
536
+ }
537
+ }
538
+
539
+ const controls: Record&lt;string, AbstractControl&gt; &#x3D; {};
540
+
541
+ this.buildControls(state, form, controls);
542
+ this.buildGroups(state, form, controls);
543
+ this.buildArrayGroups(state, form, controls);
544
+ this.buildArrayControls(state, form, controls);
545
+
546
+ const formOptions &#x3D; {
547
+ ...this.formOptions,
548
+ controlId:
549
+ options.controlId ?? (options.id ? options.id : this.formOptions.id),
550
+ ...options,
551
+ };
552
+
553
+ form.rxapFormGroup &#x3D; new RxapFormGroup(controls, formOptions);
554
+
555
+ Reflect.set(form.rxapFormGroup, &#x27;_rxapFormDefinition&#x27;, form);
556
+
557
+ form.rxapMetadata &#x3D; this.formOptions;
558
+
559
+ if (HasRxapOnInitMethod(form)) {
560
+ form.rxapOnInit();
561
+ }
562
+
563
+ for (const control of Object.values(form.rxapFormGroup.controls)) {
564
+ if (control.controlId) {
565
+ const controlSetValueOnInit &#x3D; Array.from(
566
+ this.controlSetValue.get(control.controlId) ?? [],
567
+ ).filter((controlSetValueOptions) &#x3D;&gt; controlSetValueOptions.initial);
568
+ for (const onSetValue of this.coerceToFnArray&lt;SetValueFn&gt;(
569
+ form,
570
+ controlSetValueOnInit,
571
+ )) {
572
+ onSetValue(control.value, { initial: true });
573
+ }
574
+ }
575
+ }
576
+
577
+ return form as any;
578
+ }
579
+
580
+ private buildArrayControls(
581
+ builderFormState: any,
582
+ form: FormDefinition &amp; Record&lt;string, Function&gt;,
583
+ controls: Record&lt;string, AbstractControl&gt;,
584
+ ): void {
585
+ for (const [ controlId, options ] of this.formArrayControls.entries()) {
586
+ const formState &#x3D; this.coerceToArrayFormState(
587
+ controlId,
588
+ [],
589
+ builderFormState,
590
+ options.state,
591
+ );
592
+
593
+ assertIsArray(formState);
594
+
595
+ const formControls: any &#x3D; formState.map(
596
+ (fs, index) &#x3D;&gt; new RxapFormControl(fs, { controlId: index.toFixed(0) }),
597
+ );
598
+
599
+ const manager &#x3D; new FormArrayControlManager(form, controlId);
600
+
601
+ const formArray &#x3D;
602
+ (formControls.rxapFormArray &#x3D;
603
+ controls[controlId] &#x3D;
604
+ new RxapFormArray(
605
+ // TODO : add the formControlOptions property. To definition the form control options
606
+ formControls,
607
+ {
608
+ ...options,
609
+ controlId,
610
+ validators: [],
611
+ asyncValidators: [],
612
+ controlInsertedFn: manager.inserted.bind(manager),
613
+ controlRemovedFn: manager.removed.bind(manager),
614
+ builder: (state, controlOptions) &#x3D;&gt;
615
+ new RxapFormControl(state, controlOptions),
616
+ },
617
+ ));
618
+
619
+ // TODO : add support for injectable validators
620
+
621
+ formArray.setValidators(
622
+ this.coerceToValidatorArray(
623
+ form,
624
+ options.validators,
625
+ this.validators.get(controlId),
626
+ ),
627
+ false,
628
+ );
629
+ formArray.setAsyncValidators(
630
+ this.coerceToValidatorArray(
631
+ form,
632
+ options.asyncValidators,
633
+ this.asyncValidators.get(controlId),
634
+ ),
635
+ false,
636
+ );
637
+
638
+ Reflect.set(form, controlId, formControls);
639
+ }
640
+ }
641
+
642
+ private buildArrayGroups(
643
+ builderFormState: any,
644
+ form: FormDefinition &amp; Record&lt;string, Function&gt;,
645
+ controls: Record&lt;string, AbstractControl&gt;,
646
+ ): void {
647
+ for (const [ controlId, options ] of this.formArrayGroups.entries()) {
648
+ const formState &#x3D; this.coerceToArrayFormState(
649
+ controlId,
650
+ [],
651
+ builderFormState,
652
+ options.state,
653
+ );
654
+
655
+ assertIsArray(formState);
656
+
657
+ const formGroupBuilder &#x3D; new RxapFormBuilder(
658
+ options.definition,
659
+ this.injector,
660
+ this.providers,
661
+ );
662
+
663
+ // TODO : add the formGroupOptions property. To definition of the form group options
664
+ const formGroupDefinitions: any &#x3D; formState.map((fs, index) &#x3D;&gt;
665
+ formGroupBuilder.build(fs, { id: index.toFixed(0) }),
666
+ );
667
+
668
+ const manager &#x3D; new FormArrayControlManager(form, controlId);
669
+
670
+ const formArray &#x3D;
671
+ (formGroupDefinitions.rxapFormArray &#x3D;
672
+ controls[controlId] &#x3D;
673
+ new RxapFormArray(
674
+ formGroupDefinitions.map(
675
+ (fgd: FormDefinition) &#x3D;&gt; fgd.rxapFormGroup,
676
+ ),
677
+ {
678
+ ...options,
679
+ builder: formGroupBuilder.build.bind(formGroupBuilder) as any,
680
+ controlId,
681
+ validators: [],
682
+ asyncValidators: [],
683
+ controlInsertedFn: manager.inserted.bind(manager),
684
+ controlRemovedFn: manager.removed.bind(manager),
685
+ },
686
+ ));
687
+
688
+ // TODO : add support for injectable validators
689
+
690
+ formArray.setValidators(
691
+ this.coerceToValidatorArray(
692
+ form,
693
+ options.validators,
694
+ this.validators.get(controlId),
695
+ ),
696
+ false,
697
+ );
698
+ formArray.setAsyncValidators(
699
+ this.coerceToValidatorArray(
700
+ form,
701
+ options.asyncValidators,
702
+ this.asyncValidators.get(controlId),
703
+ ),
704
+ false,
705
+ );
706
+
707
+ Reflect.set(form, controlId, formGroupDefinitions);
708
+ }
709
+ }
710
+
711
+ private buildGroups(
712
+ builderFormState: any,
713
+ form: Record&lt;string, Function&gt;,
714
+ controls: Record&lt;string, AbstractControl&gt;,
715
+ ): void {
716
+ for (const [ controlId, options ] of this.formGroups.entries()) {
717
+ const formState &#x3D; this.coerceToGroupFormState(
718
+ controlId,
719
+ {},
720
+ builderFormState,
721
+ options.state,
722
+ );
723
+
724
+ assertIsObject(formState);
725
+
726
+ const formGroupDefinition: FormDefinition &#x3D; new RxapFormBuilder(
727
+ options.definition,
728
+ this.injector,
729
+ this.providers,
730
+ ).build(formState, {
731
+ ...options,
732
+ validators: [],
733
+ asyncValidators: [],
734
+ });
735
+
736
+ controls[controlId] &#x3D; formGroupDefinition.rxapFormGroup!;
737
+
738
+ const formGroup &#x3D; formGroupDefinition.rxapFormGroup;
739
+
740
+ // TODO : add support for injectable validators
741
+
742
+ formGroup.setValidators(
743
+ this.coerceToValidatorArray(
744
+ form,
745
+ options.validators,
746
+ this.validators.get(controlId),
747
+ ),
748
+ false,
749
+ );
750
+ formGroup.setAsyncValidators(
751
+ this.coerceToValidatorArray(
752
+ form,
753
+ options.asyncValidators,
754
+ this.asyncValidators.get(controlId),
755
+ ),
756
+ false,
757
+ );
758
+
759
+ // set the form group definition instance to the form definition instance
760
+ Reflect.set(form, controlId, formGroupDefinition);
761
+ }
762
+ }
763
+
764
+ private buildControls(
765
+ builderFormState: any,
766
+ form: Record&lt;string, Function&gt;,
767
+ controls: Record&lt;string, AbstractControl&gt;,
768
+ ): void {
769
+ for (const [ controlId, options ] of this.formControls.entries()) {
770
+ const control &#x3D; (controls[controlId] &#x3D; new (options.controlType ??
771
+ RxapFormControl)(
772
+ this.coerceToControlFormState(
773
+ controlId,
774
+ null,
775
+ builderFormState,
776
+ options.state,
777
+ ),
778
+ {
779
+ ...options,
780
+ controlId,
781
+ validators: [],
782
+ asyncValidators: [],
783
+ },
784
+ ));
785
+
786
+ const injectValidators: ValidatorFn[] &#x3D; [];
787
+ const injectAsyncValidators: AsyncValidatorFn[] &#x3D; [];
788
+
789
+ for (const injectValidator of options.injectValidators ?? []) {
790
+ const injectableValidator &#x3D; this.injector.get(injectValidator);
791
+ if (injectableValidator.validate) {
792
+ injectValidators.push(
793
+ injectableValidator.validate.bind(injectableValidator),
794
+ );
795
+ }
796
+ if (injectableValidator.asyncValidate) {
797
+ injectAsyncValidators.push(
798
+ injectableValidator.asyncValidate.bind(injectableValidator),
799
+ );
800
+ }
801
+ }
802
+
803
+ control.setValidators(
804
+ this.coerceToValidatorArray(
805
+ form,
806
+ options.validators,
807
+ this.validators.get(controlId),
808
+ injectValidators,
809
+ ),
810
+ false,
811
+ );
812
+ control.setAsyncValidators(
813
+ this.coerceToValidatorArray(
814
+ form,
815
+ options.asyncValidators,
816
+ this.asyncValidators.get(controlId),
817
+ injectAsyncValidators,
818
+ ),
819
+ false,
820
+ );
821
+
822
+ // register all control on change function with the form control
823
+ this.coerceToFnArray&lt;ChangeFn&gt;(
824
+ form,
825
+ this.controlChanges.get(controlId),
826
+ ).forEach((changeFn) &#x3D;&gt; control.registerOnChange(changeFn));
827
+
828
+ // register all control on set value function with the form control
829
+ this.coerceToFnArray&lt;SetValueFn&gt;(
830
+ form,
831
+ this.controlSetValue.get(controlId),
832
+ ).forEach((setValueFn) &#x3D;&gt; control.registerOnSetValue(setValueFn));
833
+
834
+ if (Array.isArray(options.validators)) {
835
+ if (
836
+ options.validators.includes(Validators.required) ||
837
+ options.validators.includes(Validators.requiredTrue)
838
+ ) {
839
+ Reflect.set(control, &#x27;hasRequiredValidator&#x27;, true);
840
+ }
841
+ }
842
+
843
+ // set the form control instance to the form definition instance
844
+ Reflect.set(form, controlId, control);
845
+ }
846
+ }
847
+
848
+ /**
849
+ * Coerce to a function array.
850
+ *
851
+ * @param form the current form definition instance
852
+ * @param methodKeys A set of propertyKeys that points to form
853
+ * definition instance methods
854
+ */
855
+ private coerceToFnArray&lt;T extends Function&gt;(
856
+ form: Record&lt;string, Function&gt;,
857
+ methodKeys?: Iterable&lt;string | { propertyKey: string }&gt;,
858
+ ): Array&lt;T&gt; {
859
+ const changes: Array&lt;T&gt; &#x3D; [];
860
+
861
+ if (methodKeys) {
862
+ for (const propertyKeyOrOptions of methodKeys) {
863
+ const propertyKey &#x3D;
864
+ typeof propertyKeyOrOptions &#x3D;&#x3D;&#x3D; &#x27;string&#x27;
865
+ ? propertyKeyOrOptions
866
+ : propertyKeyOrOptions.propertyKey;
867
+ assertIsFunction(form[propertyKey]);
868
+ changes.push((form[propertyKey] as T).bind(form));
869
+ }
870
+ }
871
+
872
+ return changes;
873
+ }
874
+
875
+ /**
876
+ * Coerce to a validator function array.
877
+ *
878
+ * @param form the current form definition instance
879
+ * @param optionsValidators The options validator functions
880
+ * @param validatorMethodKeys A set of propertyKeys that points to form
881
+ * definition instance methods
882
+ * @param injectValidators Injected validator functions
883
+ */
884
+ private coerceToValidatorArray&lt;VF extends ValidatorFn | AsyncValidatorFn&gt;(
885
+ form: Record&lt;string, Function&gt;,
886
+ optionsValidators?: Array&lt;VF&gt; | VF | null,
887
+ validatorMethodKeys?: Set&lt;string&gt;,
888
+ injectValidators?: Array&lt;VF&gt;,
889
+ ): Array&lt;VF&gt; {
890
+ const validators: Array&lt;VF&gt; &#x3D; (
891
+ optionsValidators ? Array.isArray(optionsValidators) ? optionsValidators : [ optionsValidators ] : []
892
+ ).slice();
893
+
894
+ if (validatorMethodKeys) {
895
+ validatorMethodKeys.forEach((propertyKey) &#x3D;&gt; {
896
+ assertIsFunction(form[propertyKey]);
897
+
898
+ validators.push(form[propertyKey].bind(form) as VF);
899
+ });
900
+ }
901
+
902
+ if (injectValidators) {
903
+ validators.push(...injectValidators);
904
+ }
905
+
906
+ return validators;
907
+ }
908
+
909
+ /**
910
+ * Coerce to the form state for the specified controlId. If none form state is
911
+ * found the default form state will be returned.
912
+ *
913
+ * @param controlId A control id
914
+ * @param defaultFormState The default form state
915
+ * @param builderFormState The form state provides as build state parameter
916
+ * @param optionsFormState The form state set by the decorator in the form definition
917
+ */
918
+ private coerceToControlFormState(
919
+ controlId: string,
920
+ defaultFormState: any,
921
+ builderFormState: Record&lt;string, any&gt;,
922
+ optionsFormState?: any,
923
+ ): any {
924
+ let formState &#x3D; defaultFormState;
925
+
926
+ if (builderFormState &amp;&amp; builderFormState[controlId] !&#x3D;&#x3D; undefined) {
927
+ formState &#x3D; builderFormState[controlId];
928
+ } else if (optionsFormState !&#x3D;&#x3D; undefined) {
929
+ formState &#x3D; optionsFormState ?? null;
930
+ }
931
+
932
+ if (typeof formState &#x3D;&#x3D;&#x3D; &#x27;function&#x27;) {
933
+ formState &#x3D; formState();
934
+ }
935
+
936
+ return formState;
937
+ }
938
+
939
+ /**
940
+ * Coerce to the form state for the specified controlId. If none form state is
941
+ * found the default form state will be returned.
942
+ *
943
+ * The difference to the method coerceToControlFormState is that null will be
944
+ * handled as undefined and the defaultFormState is used
945
+ *
946
+ * @param controlId A control id
947
+ * @param defaultFormState The default form state
948
+ * @param builderFormState The form state provides as build state parameter
949
+ * @param optionsFormState The form state set by the decorator in the form definition
950
+ */
951
+ private coerceToGroupFormState(
952
+ controlId: string,
953
+ defaultFormState: any,
954
+ builderFormState: Record&lt;string, any&gt;,
955
+ optionsFormState?: any,
956
+ ): any {
957
+ let formState &#x3D; defaultFormState;
958
+
959
+ if (builderFormState &amp;&amp; builderFormState[controlId]) {
960
+ formState &#x3D; builderFormState[controlId];
961
+ } else if (optionsFormState) {
962
+ formState &#x3D; optionsFormState;
963
+ }
964
+
965
+ if (typeof formState &#x3D;&#x3D;&#x3D; &#x27;function&#x27;) {
966
+ formState &#x3D; formState();
967
+ if (!formState) {
968
+ throw new Error(&#x60;The form state function for the form group &#x27;${ controlId }&#x27; returns a empty value (null/undefined)&#x60;);
969
+ }
970
+ if (typeof formState !&#x3D;&#x3D; &#x27;object&#x27;) {
971
+ throw new Error(&#x60;The form state function for the form group &#x27;${ controlId }&#x27; returns a non object like value instead &#x27;${ typeof formState }&#x27;&#x60;);
972
+ }
973
+ }
974
+
975
+ return formState;
976
+ }
977
+
978
+ /**
979
+ * Coerce to the form state for the specified controlId. If none form state is
980
+ * found the default form state will be returned.
981
+ *
982
+ * The difference to the method coerceToControlFormState is that null will be
983
+ * handled as undefined and the defaultFormState is used
984
+ *
985
+ * @param controlId A control id
986
+ * @param defaultFormState The default form state
987
+ * @param builderFormState The form state provides as build state parameter
988
+ * @param optionsFormState The form state set by the decorator in the form definition
989
+ */
990
+ private coerceToArrayFormState(
991
+ controlId: string,
992
+ defaultFormState: any[] | (() &#x3D;&gt; any[]),
993
+ builderFormState: Record&lt;string, any&gt;,
994
+ optionsFormState?: any,
995
+ ): any[] {
996
+ let formState &#x3D; defaultFormState;
997
+
998
+ if (builderFormState &amp;&amp; builderFormState[controlId] &amp;&amp; Array.isArray(builderFormState[controlId])) {
999
+ formState &#x3D; builderFormState[controlId];
1000
+ } else if (optionsFormState &amp;&amp; Array.isArray(optionsFormState)) {
1001
+ formState &#x3D; optionsFormState;
1002
+ }
1003
+
1004
+ if (typeof formState &#x3D;&#x3D;&#x3D; &#x27;function&#x27;) {
1005
+ formState &#x3D; formState();
1006
+ if (!formState) {
1007
+ throw new Error(&#x60;The form state function for the form array &#x27;${ controlId }&#x27; returns a empty value (null/undefined)&#x60;);
1008
+ }
1009
+ if (!Array.isArray(formState)) {
1010
+ throw new Error(&#x60;The form state function for the form array &#x27;${ controlId }&#x27; returns a non array like value instead &#x27;${ typeof formState }&#x27;&#x60;);
1011
+ }
1012
+ }
1013
+
1014
+ return formState;
1015
+ }
1016
+
1017
+ private extractControlChanges(): Map&lt;string, Set&lt;string&gt;&gt; {
1018
+ return (
1019
+ getMetadata(MetadataKeys.CONTROL_CHANGES, this.definition.prototype) ??
1020
+ new Map&lt;string, Set&lt;string&gt;&gt;()
1021
+ );
1022
+ }
1023
+
1024
+ private extractControlSetValue(): Map&lt;string, Set&lt;ControlSetValueOptions&gt;&gt; {
1025
+ return (
1026
+ getMetadata(MetadataKeys.CONTROL_SET_VALUE, this.definition.prototype) ??
1027
+ new Map&lt;string, Set&lt;ControlSetValueOptions&gt;&gt;()
1028
+ );
1029
+ }
1030
+
1031
+ private extractValidators(): Map&lt;string, Set&lt;string&gt;&gt; {
1032
+ return (
1033
+ getMetadata(MetadataKeys.CONTROL_VALIDATORS, this.definition.prototype) ??
1034
+ new Map&lt;string, Set&lt;string&gt;&gt;()
1035
+ );
1036
+ }
1037
+
1038
+ private extractAsyncValidators(): Map&lt;string, Set&lt;string&gt;&gt; {
1039
+ return (
1040
+ getMetadata(
1041
+ MetadataKeys.CONTROL_ASYNC_VALIDATORS,
1042
+ this.definition.prototype,
1043
+ ) ?? new Map&lt;string, Set&lt;string&gt;&gt;()
1044
+ );
1045
+ }
1046
+
1047
+ private extractArrayGroups(): Map&lt;
1048
+ string,
1049
+ RxapAbstractControlOptionsWithDefinition
1050
+ &gt; {
1051
+ return (
1052
+ getMetadata(MetadataKeys.FORM_ARRAY_GROUPS, this.definition.prototype) ??
1053
+ new Map&lt;string, RxapAbstractControlOptionsWithDefinition&gt;()
1054
+ );
1055
+ }
1056
+
1057
+ private extractArrayControls(): Map&lt;string, RxapAbstractControlOptions&gt; {
1058
+ return (
1059
+ getMetadata(
1060
+ MetadataKeys.FORM_ARRAY_CONTROLS,
1061
+ this.definition.prototype,
1062
+ ) ?? new Map&lt;string, RxapAbstractControlOptions&gt;()
1063
+ );
1064
+ }
1065
+
1066
+ private extractGroups(): Map&lt;
1067
+ string,
1068
+ RxapAbstractControlOptionsWithDefinition
1069
+ &gt; {
1070
+ return (
1071
+ getMetadata(MetadataKeys.FORM_GROUPS, this.definition.prototype) ??
1072
+ new Map&lt;string, RxapAbstractControlOptionsWithDefinition&gt;()
1073
+ );
1074
+ }
1075
+
1076
+ private extractControls(): Map&lt;string, RxapAbstractControlOptions&gt; {
1077
+ return (
1078
+ getMetadata(MetadataKeys.FORM_CONTROLS, this.definition.prototype) ??
1079
+ new Map&lt;string, RxapAbstractControlOptions&gt;()
1080
+ );
1081
+ }
1082
+
1083
+ private extractFormOptions(): FormDefinitionMetadata {
1084
+ const options &#x3D; GetDefinitionMetadata(this.definition);
1085
+ if (!options || !options[&#x27;id&#x27;]) {
1086
+ throw new Error(&#x27;Ensure that the @UseForm decorator is used.&#x27;);
1087
+ }
1088
+ if (!options[&#x27;providers&#x27;]) {
1089
+ options[&#x27;providers&#x27;] &#x3D; [];
1090
+ }
1091
+ return options;
1092
+ }
1093
+ }
1094
+ </code></pre>
1095
+ </div>
1096
+ </div>
1097
+
1098
+
1099
+
1100
+
1101
+
1102
+
1103
+
1104
+
1105
+
1106
+ </div><div class="search-results">
1107
+ <div class="has-results">
1108
+ <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
1109
+ <ul class="search-results-list"></ul>
1110
+ </div>
1111
+ <div class="no-results">
1112
+ <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
1113
+ </div>
1114
+ </div>
1115
+ </div>
1116
+ <!-- END CONTENT -->
1117
+ </div>
1118
+ </div>
1119
+
1120
+ <label class="dark-mode-switch">
1121
+ <input type="checkbox">
1122
+ <span class="slider">
1123
+ <svg class="slider-icon" viewBox="0 0 24 24" fill="none" height="20" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" width="20" xmlns="http://www.w3.org/2000/svg">
1124
+ <path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"></path>
1125
+ </svg>
1126
+ </span>
1127
+ </label>
1128
+
1129
+ <script>
1130
+ var COMPODOC_CURRENT_PAGE_DEPTH = 1;
1131
+ var COMPODOC_CURRENT_PAGE_CONTEXT = 'class';
1132
+ var COMPODOC_CURRENT_PAGE_URL = 'FormArrayControlManager.html';
1133
+ var MAX_SEARCH_RESULTS = 15;
1134
+ </script>
1135
+
1136
+ <script>
1137
+ $darkModeToggleSwitchers = document.querySelectorAll('.dark-mode-switch input');
1138
+ checkToggle(darkModeState);
1139
+ if ($darkModeToggleSwitchers.length > 0) {
1140
+ for (var i = 0; i < $darkModeToggleSwitchers.length; i++) {
1141
+ $darkModeToggleSwitchers[i].addEventListener('change', function (event) {
1142
+ darkModeState = !darkModeState;
1143
+ toggleDarkMode(darkModeState);
1144
+ });
1145
+ }
1146
+ }
1147
+ </script>
1148
+
1149
+ <script src="../js/libs/custom-elements.min.js"></script>
1150
+ <script src="../js/libs/lit-html.js"></script>
1151
+
1152
+ <script src="../js/menu-wc.js" defer></script>
1153
+ <script nomodule src="../js/menu-wc_es5.js" defer></script>
1154
+
1155
+ <script src="../js/libs/bootstrap-native.js"></script>
1156
+
1157
+ <script src="../js/libs/es6-shim.min.js"></script>
1158
+ <script src="../js/libs/EventDispatcher.js"></script>
1159
+ <script src="../js/libs/promise.min.js"></script>
1160
+ <script src="../js/libs/zepto.min.js"></script>
1161
+
1162
+ <script src="../js/compodoc.js"></script>
1163
+
1164
+ <script src="../js/tabs.js"></script>
1165
+ <script src="../js/menu.js"></script>
1166
+ <script src="../js/libs/clipboard.min.js"></script>
1167
+ <script src="../js/libs/prism.js"></script>
1168
+ <script src="../js/sourceCode.js"></script>
1169
+ <script src="../js/search/search.js"></script>
1170
+ <script src="../js/search/lunr.min.js"></script>
1171
+ <script src="../js/search/search-lunr.js"></script>
1172
+ <script src="../js/search/search_index.js"></script>
1173
+ <script src="../js/lazy-load-graphs.js"></script>
1174
+
1175
+
1176
+ </body>
1177
+ </html>