@rxap/form-system 21.0.1-dev.1 → 22.0.0-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 (317) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/compodoc/changelog.html +32 -0
  3. package/compodoc/dependencies.html +16 -16
  4. package/compodoc/js/search/search_index.js +2 -2
  5. package/compodoc/properties.html +1 -1
  6. package/docs/documentation.json +2468 -1730
  7. package/docs/html/assets/hierarchy.js +1 -1
  8. package/docs/html/classes/AbstractOptionsFromMethodDirective.html +6 -6
  9. package/docs/html/classes/AutocompleteOptionsFromMethodDirective.html +6 -6
  10. package/docs/html/classes/ControlDataSource.html +13 -13
  11. package/docs/html/classes/ControlHideShowDirective.html +4 -4
  12. package/docs/html/classes/ExtractControlFromParentMixin.html +2 -2
  13. package/docs/html/classes/ExtractControlMixin.html +2 -2
  14. package/docs/html/classes/ExtractDataSourcesMixin.html +2 -2
  15. package/docs/html/classes/ExtractFormDefinitionMixin.html +2 -2
  16. package/docs/html/classes/ExtractFunctionMixin.html +2 -2
  17. package/docs/html/classes/ExtractFunctionsMixin.html +2 -2
  18. package/docs/html/classes/ExtractIsValueFunctionMixin.html +2 -2
  19. package/docs/html/classes/ExtractMethodMixin.html +2 -2
  20. package/docs/html/classes/ExtractMethodsMixin.html +2 -2
  21. package/docs/html/classes/ExtractOptionsDataSourceMixin.html +2 -2
  22. package/docs/html/classes/ExtractOptionsMethodMixin.html +2 -2
  23. package/docs/html/classes/ExtractRemoteMethodsMixin.html +2 -2
  24. package/docs/html/classes/ExtractResolveMethodMixin.html +2 -2
  25. package/docs/html/classes/ExtractToDisplayFunctionMixin.html +2 -2
  26. package/docs/html/classes/ForFormArrayItemsDirective.html +3 -3
  27. package/docs/html/classes/FormArrayAddItemButtonDirective.html +4 -4
  28. package/docs/html/classes/FormArrayItemButton.html +4 -4
  29. package/docs/html/classes/FormArrayItemRemoveButtonDirective.html +5 -5
  30. package/docs/html/classes/FormArrayItemRestoreButtonDirective.html +4 -4
  31. package/docs/html/classes/FormArrayRemovableDirective.html +4 -4
  32. package/docs/html/classes/FormSystemControlDirective.html +8 -8
  33. package/docs/html/classes/InputSelectOptionsDirective.html +5 -5
  34. package/docs/html/classes/IsEqualToDirective.html +4 -4
  35. package/docs/html/classes/IsSelectableValueDirective.html +3 -3
  36. package/docs/html/classes/NoopResolveMethod.html +2 -2
  37. package/docs/html/classes/OptionsFromMethodDirective.html +6 -6
  38. package/docs/html/classes/OptionsFromRemoteMethodDirective.html +3 -3
  39. package/docs/html/classes/RxapFormSystemError.html +5 -5
  40. package/docs/html/classes/SubmitContextFormAdapter.html +10 -10
  41. package/docs/html/classes/TestNgControl.html +36 -27
  42. package/docs/html/enums/FormSystemMetadataKeys.html +2 -2
  43. package/docs/html/functions/ApplyUseFunctionAdapters.html +1 -1
  44. package/docs/html/functions/ApplyUseMethodAdapters.html +1 -1
  45. package/docs/html/functions/ComposeOptionsTransformers.html +1 -1
  46. package/docs/html/functions/FormContextFromActivatedRouteFactory.html +1 -1
  47. package/docs/html/functions/ResolveByUuidParameter.html +1 -1
  48. package/docs/html/functions/ResolveByUuidResultFactory.html +1 -1
  49. package/docs/html/functions/SubmitContextFormAdapterFactory.html +1 -1
  50. package/docs/html/functions/UseAutocompleteIsValueFunction.html +1 -1
  51. package/docs/html/functions/UseAutocompleteOptionsMethod.html +1 -1
  52. package/docs/html/functions/UseAutocompleteResolveMethod.html +1 -1
  53. package/docs/html/functions/UseAutocompleteToDisplayFunction.html +1 -1
  54. package/docs/html/functions/UseComponent.html +1 -1
  55. package/docs/html/functions/UseDataSource.html +1 -1
  56. package/docs/html/functions/UseFormComponent.html +2 -2
  57. package/docs/html/functions/UseFunction.html +1 -1
  58. package/docs/html/functions/UseHideFunction.html +1 -1
  59. package/docs/html/functions/UseIsValueFunction.html +1 -1
  60. package/docs/html/functions/UseMethod.html +1 -1
  61. package/docs/html/functions/UseOptionsDataSource.html +1 -1
  62. package/docs/html/functions/UseOptionsMethod.html +1 -1
  63. package/docs/html/functions/UseOptionsRemoteMethod.html +1 -1
  64. package/docs/html/functions/UseRemoteMethod.html +1 -1
  65. package/docs/html/functions/UseResolveMethod.html +1 -1
  66. package/docs/html/functions/UseShowFunction.html +1 -1
  67. package/docs/html/functions/UseToDisplayFunction.html +1 -1
  68. package/docs/html/functions/controlDataSource-1.html +1 -1
  69. package/docs/html/hierarchy.html +1 -1
  70. package/docs/html/index.html +2 -2
  71. package/docs/html/interfaces/AutocompleteOptionsFromMethodDirectiveParameters.html +2 -2
  72. package/docs/html/interfaces/AutocompleteOptionsFromMethodDirectiveSettings.html +2 -2
  73. package/docs/html/interfaces/AutocompleteOptionsFromRemoteMethodTemplateContext.html +2 -2
  74. package/docs/html/interfaces/ControlHideShowOptions.html +2 -2
  75. package/docs/html/interfaces/ControlWithDataSource.html +2 -2
  76. package/docs/html/interfaces/ForFormArrayItemsDirectiveContext.html +2 -2
  77. package/docs/html/interfaces/InputSelectOptionsSettings.html +4 -4
  78. package/docs/html/interfaces/InputSelectOptionsTemplateContext.html +2 -2
  79. package/docs/html/interfaces/OptionsFromMethodDirectiveSettings.html +1 -1
  80. package/docs/html/interfaces/OptionsFromMethodTemplateContext.html +2 -2
  81. package/docs/html/interfaces/OptionsFromRemoteMethodTemplateContext.html +2 -2
  82. package/docs/html/interfaces/UseDataSourceSettings.html +2 -2
  83. package/docs/html/interfaces/UseDataSourceValue.html +3 -3
  84. package/docs/html/interfaces/UseFunctionConfig.html +2 -2
  85. package/docs/html/interfaces/UseFunctionDefinition.html +2 -2
  86. package/docs/html/interfaces/UseMethodConfig.html +2 -2
  87. package/docs/html/interfaces/UseMethodDefinition.html +2 -2
  88. package/docs/html/modules.html +1 -1
  89. package/docs/html/types/ControlHideShowFunction.html +1 -1
  90. package/docs/html/types/FunctionParameterAdapterFunction.html +1 -1
  91. package/docs/html/types/FunctionResultAdapterFunction.html +1 -1
  92. package/docs/html/types/MethodParameterAdapterFunction.html +1 -1
  93. package/docs/html/types/MethodResultAdapterFunction.html +1 -1
  94. package/docs/html/types/OptionsMethod.html +1 -1
  95. package/docs/html/types/UseFunctionType.html +1 -1
  96. package/docs/html/types/UseOptionsDataSourceSettings.html +1 -1
  97. package/docs/html/variables/DATA_SOURCE_NAME.html +1 -1
  98. package/docs/html/variables/IS_VALUE_FUNCTION_NAME.html +1 -1
  99. package/docs/html/variables/OPTIONS_METHOD_NAME.html +1 -1
  100. package/docs/html/variables/REMOTE_METHOD_NAME.html +1 -1
  101. package/docs/html/variables/RESOLVE_METHOD_NAME.html +1 -1
  102. package/docs/html/variables/RXAP_FORM_CONTROL_SOURCE.html +1 -1
  103. package/docs/html/variables/RXAP_FORM_SYSTEM_HIDE_METADATA.html +1 -1
  104. package/docs/html/variables/RXAP_FORM_SYSTEM_HIDE_SHOW_OPTIONS.html +1 -1
  105. package/docs/html/variables/RXAP_FORM_SYSTEM_SHOW_METADATA.html +1 -1
  106. package/docs/html/variables/RXAP_USE_FUNCTION.html +1 -1
  107. package/docs/html/variables/RXAP_USE_METHOD.html +1 -1
  108. package/docs/html/variables/RXAP_USE_REMOTE_METHOD.html +1 -1
  109. package/docs/html/variables/SUBMIT_CONTEXT_FORM_ADAPTER_METHOD.html +1 -1
  110. package/docs/html/variables/TO_DISPLAY_FUNCTION_NAME.html +1 -1
  111. package/docs/markdown/README.md +1 -1
  112. package/docs/markdown/classes/AbstractOptionsFromMethodDirective.md +30 -30
  113. package/docs/markdown/classes/AutocompleteOptionsFromMethodDirective.md +43 -43
  114. package/docs/markdown/classes/ControlDataSource.md +51 -51
  115. package/docs/markdown/classes/ControlHideShowDirective.md +8 -8
  116. package/docs/markdown/classes/ExtractControlFromParentMixin.md +3 -3
  117. package/docs/markdown/classes/ExtractControlMixin.md +6 -6
  118. package/docs/markdown/classes/ExtractDataSourcesMixin.md +3 -3
  119. package/docs/markdown/classes/ExtractFormDefinitionMixin.md +3 -3
  120. package/docs/markdown/classes/ExtractFunctionMixin.md +5 -5
  121. package/docs/markdown/classes/ExtractFunctionsMixin.md +3 -3
  122. package/docs/markdown/classes/ExtractIsValueFunctionMixin.md +11 -11
  123. package/docs/markdown/classes/ExtractMethodMixin.md +5 -5
  124. package/docs/markdown/classes/ExtractMethodsMixin.md +3 -3
  125. package/docs/markdown/classes/ExtractOptionsDataSourceMixin.md +14 -14
  126. package/docs/markdown/classes/ExtractOptionsMethodMixin.md +11 -11
  127. package/docs/markdown/classes/ExtractRemoteMethodsMixin.md +3 -3
  128. package/docs/markdown/classes/ExtractResolveMethodMixin.md +11 -11
  129. package/docs/markdown/classes/ExtractToDisplayFunctionMixin.md +11 -11
  130. package/docs/markdown/classes/ForFormArrayItemsDirective.md +4 -4
  131. package/docs/markdown/classes/FormArrayAddItemButtonDirective.md +11 -11
  132. package/docs/markdown/classes/FormArrayItemButton.md +18 -18
  133. package/docs/markdown/classes/FormArrayItemRemoveButtonDirective.md +19 -19
  134. package/docs/markdown/classes/FormArrayItemRestoreButtonDirective.md +18 -18
  135. package/docs/markdown/classes/FormArrayRemovableDirective.md +9 -9
  136. package/docs/markdown/classes/FormSystemControlDirective.md +11 -11
  137. package/docs/markdown/classes/InputSelectOptionsDirective.md +27 -27
  138. package/docs/markdown/classes/IsEqualToDirective.md +6 -6
  139. package/docs/markdown/classes/IsSelectableValueDirective.md +16 -16
  140. package/docs/markdown/classes/NoopResolveMethod.md +3 -3
  141. package/docs/markdown/classes/OptionsFromMethodDirective.md +30 -30
  142. package/docs/markdown/classes/OptionsFromRemoteMethodDirective.md +9 -9
  143. package/docs/markdown/classes/RxapFormSystemError.md +16 -16
  144. package/docs/markdown/classes/SubmitContextFormAdapter.md +32 -32
  145. package/docs/markdown/classes/TestNgControl.md +145 -27
  146. package/docs/markdown/enumerations/FormSystemMetadataKeys.md +6 -6
  147. package/docs/markdown/functions/ApplyUseFunctionAdapters.md +2 -2
  148. package/docs/markdown/functions/ApplyUseMethodAdapters.md +2 -2
  149. package/docs/markdown/functions/ComposeOptionsTransformers.md +2 -2
  150. package/docs/markdown/functions/FormContextFromActivatedRouteFactory.md +2 -2
  151. package/docs/markdown/functions/ResolveByUuidParameter.md +2 -2
  152. package/docs/markdown/functions/ResolveByUuidResultFactory.md +2 -2
  153. package/docs/markdown/functions/SubmitContextFormAdapterFactory.md +2 -2
  154. package/docs/markdown/functions/UseAutocompleteIsValueFunction.md +2 -2
  155. package/docs/markdown/functions/UseAutocompleteOptionsMethod.md +4 -4
  156. package/docs/markdown/functions/UseAutocompleteResolveMethod.md +2 -2
  157. package/docs/markdown/functions/UseAutocompleteToDisplayFunction.md +2 -2
  158. package/docs/markdown/functions/UseComponent.md +2 -2
  159. package/docs/markdown/functions/UseDataSource.md +2 -2
  160. package/docs/markdown/functions/UseFormComponent.md +2 -2
  161. package/docs/markdown/functions/UseFunction.md +2 -2
  162. package/docs/markdown/functions/UseHideFunction.md +2 -2
  163. package/docs/markdown/functions/UseIsValueFunction.md +3 -3
  164. package/docs/markdown/functions/UseMethod.md +2 -2
  165. package/docs/markdown/functions/UseOptionsDataSource.md +2 -2
  166. package/docs/markdown/functions/UseOptionsMethod.md +2 -2
  167. package/docs/markdown/functions/UseOptionsRemoteMethod.md +2 -2
  168. package/docs/markdown/functions/UseRemoteMethod.md +2 -2
  169. package/docs/markdown/functions/UseResolveMethod.md +3 -3
  170. package/docs/markdown/functions/UseShowFunction.md +2 -2
  171. package/docs/markdown/functions/UseToDisplayFunction.md +3 -3
  172. package/docs/markdown/functions/controlDataSource.md +2 -2
  173. package/docs/markdown/globals.md +2 -2
  174. package/docs/markdown/interfaces/AutocompleteOptionsFromMethodDirectiveParameters.md +3 -3
  175. package/docs/markdown/interfaces/AutocompleteOptionsFromMethodDirectiveSettings.md +3 -3
  176. package/docs/markdown/interfaces/AutocompleteOptionsFromRemoteMethodTemplateContext.md +3 -3
  177. package/docs/markdown/interfaces/ControlHideShowOptions.md +3 -3
  178. package/docs/markdown/interfaces/ControlWithDataSource.md +3 -3
  179. package/docs/markdown/interfaces/ForFormArrayItemsDirectiveContext.md +9 -9
  180. package/docs/markdown/interfaces/InputSelectOptionsSettings.md +6 -6
  181. package/docs/markdown/interfaces/InputSelectOptionsTemplateContext.md +3 -3
  182. package/docs/markdown/interfaces/OptionsFromMethodDirectiveSettings.md +2 -2
  183. package/docs/markdown/interfaces/OptionsFromMethodTemplateContext.md +3 -3
  184. package/docs/markdown/interfaces/OptionsFromRemoteMethodTemplateContext.md +3 -3
  185. package/docs/markdown/interfaces/UseDataSourceSettings.md +3 -3
  186. package/docs/markdown/interfaces/UseDataSourceValue.md +5 -5
  187. package/docs/markdown/interfaces/UseFunctionConfig.md +3 -3
  188. package/docs/markdown/interfaces/UseFunctionDefinition.md +4 -4
  189. package/docs/markdown/interfaces/UseMethodConfig.md +3 -3
  190. package/docs/markdown/interfaces/UseMethodDefinition.md +4 -4
  191. package/docs/markdown/type-aliases/ControlHideShowFunction.md +2 -2
  192. package/docs/markdown/type-aliases/FunctionParameterAdapterFunction.md +2 -2
  193. package/docs/markdown/type-aliases/FunctionResultAdapterFunction.md +2 -2
  194. package/docs/markdown/type-aliases/MethodParameterAdapterFunction.md +2 -2
  195. package/docs/markdown/type-aliases/MethodResultAdapterFunction.md +2 -2
  196. package/docs/markdown/type-aliases/OptionsMethod.md +2 -2
  197. package/docs/markdown/type-aliases/UseFunctionType.md +2 -2
  198. package/docs/markdown/type-aliases/UseOptionsDataSourceSettings.md +2 -2
  199. package/docs/markdown/variables/DATA_SOURCE_NAME.md +2 -2
  200. package/docs/markdown/variables/IS_VALUE_FUNCTION_NAME.md +2 -2
  201. package/docs/markdown/variables/OPTIONS_METHOD_NAME.md +2 -2
  202. package/docs/markdown/variables/REMOTE_METHOD_NAME.md +2 -2
  203. package/docs/markdown/variables/RESOLVE_METHOD_NAME.md +2 -2
  204. package/docs/markdown/variables/RXAP_FORM_CONTROL_SOURCE.md +2 -2
  205. package/docs/markdown/variables/RXAP_FORM_SYSTEM_HIDE_METADATA.md +2 -2
  206. package/docs/markdown/variables/RXAP_FORM_SYSTEM_HIDE_SHOW_OPTIONS.md +2 -2
  207. package/docs/markdown/variables/RXAP_FORM_SYSTEM_SHOW_METADATA.md +2 -2
  208. package/docs/markdown/variables/RXAP_USE_FUNCTION.md +2 -2
  209. package/docs/markdown/variables/RXAP_USE_METHOD.md +2 -2
  210. package/docs/markdown/variables/RXAP_USE_REMOTE_METHOD.md +2 -2
  211. package/docs/markdown/variables/SUBMIT_CONTEXT_FORM_ADAPTER_METHOD.md +2 -2
  212. package/docs/markdown/variables/TO_DISPLAY_FUNCTION_NAME.md +2 -2
  213. package/docs/wiki/Class.AbstractOptionsFromMethodDirective.md +29 -29
  214. package/docs/wiki/Class.AutocompleteOptionsFromMethodDirective.md +42 -42
  215. package/docs/wiki/Class.ControlDataSource.md +50 -50
  216. package/docs/wiki/Class.ControlHideShowDirective.md +7 -7
  217. package/docs/wiki/Class.ExtractControlFromParentMixin.md +2 -2
  218. package/docs/wiki/Class.ExtractControlMixin.md +5 -5
  219. package/docs/wiki/Class.ExtractDataSourcesMixin.md +2 -2
  220. package/docs/wiki/Class.ExtractFormDefinitionMixin.md +2 -2
  221. package/docs/wiki/Class.ExtractFunctionMixin.md +4 -4
  222. package/docs/wiki/Class.ExtractFunctionsMixin.md +2 -2
  223. package/docs/wiki/Class.ExtractIsValueFunctionMixin.md +10 -10
  224. package/docs/wiki/Class.ExtractMethodMixin.md +4 -4
  225. package/docs/wiki/Class.ExtractMethodsMixin.md +2 -2
  226. package/docs/wiki/Class.ExtractOptionsDataSourceMixin.md +13 -13
  227. package/docs/wiki/Class.ExtractOptionsMethodMixin.md +10 -10
  228. package/docs/wiki/Class.ExtractRemoteMethodsMixin.md +2 -2
  229. package/docs/wiki/Class.ExtractResolveMethodMixin.md +10 -10
  230. package/docs/wiki/Class.ExtractToDisplayFunctionMixin.md +10 -10
  231. package/docs/wiki/Class.ForFormArrayItemsDirective.md +3 -3
  232. package/docs/wiki/Class.FormArrayAddItemButtonDirective.md +10 -10
  233. package/docs/wiki/Class.FormArrayItemButton.md +17 -17
  234. package/docs/wiki/Class.FormArrayItemRemoveButtonDirective.md +18 -18
  235. package/docs/wiki/Class.FormArrayItemRestoreButtonDirective.md +17 -17
  236. package/docs/wiki/Class.FormArrayRemovableDirective.md +8 -8
  237. package/docs/wiki/Class.FormSystemControlDirective.md +10 -10
  238. package/docs/wiki/Class.InputSelectOptionsDirective.md +26 -26
  239. package/docs/wiki/Class.IsEqualToDirective.md +5 -5
  240. package/docs/wiki/Class.IsSelectableValueDirective.md +15 -15
  241. package/docs/wiki/Class.NoopResolveMethod.md +2 -2
  242. package/docs/wiki/Class.OptionsFromMethodDirective.md +29 -29
  243. package/docs/wiki/Class.OptionsFromRemoteMethodDirective.md +8 -8
  244. package/docs/wiki/Class.RxapFormSystemError.md +15 -15
  245. package/docs/wiki/Class.SubmitContextFormAdapter.md +31 -31
  246. package/docs/wiki/Class.TestNgControl.md +144 -26
  247. package/docs/wiki/Enumeration.FormSystemMetadataKeys.md +5 -5
  248. package/docs/wiki/Function.ApplyUseFunctionAdapters.md +1 -1
  249. package/docs/wiki/Function.ApplyUseMethodAdapters.md +1 -1
  250. package/docs/wiki/Function.ComposeOptionsTransformers.md +1 -1
  251. package/docs/wiki/Function.FormContextFromActivatedRouteFactory.md +1 -1
  252. package/docs/wiki/Function.ResolveByUuidParameter.md +1 -1
  253. package/docs/wiki/Function.ResolveByUuidResultFactory.md +1 -1
  254. package/docs/wiki/Function.SubmitContextFormAdapterFactory.md +1 -1
  255. package/docs/wiki/Function.UseAutocompleteIsValueFunction.md +1 -1
  256. package/docs/wiki/Function.UseAutocompleteOptionsMethod.md +3 -3
  257. package/docs/wiki/Function.UseAutocompleteResolveMethod.md +1 -1
  258. package/docs/wiki/Function.UseAutocompleteToDisplayFunction.md +1 -1
  259. package/docs/wiki/Function.UseComponent.md +1 -1
  260. package/docs/wiki/Function.UseDataSource.md +1 -1
  261. package/docs/wiki/Function.UseFormComponent.md +1 -1
  262. package/docs/wiki/Function.UseFunction.md +1 -1
  263. package/docs/wiki/Function.UseHideFunction.md +1 -1
  264. package/docs/wiki/Function.UseIsValueFunction.md +2 -2
  265. package/docs/wiki/Function.UseMethod.md +1 -1
  266. package/docs/wiki/Function.UseOptionsDataSource.md +1 -1
  267. package/docs/wiki/Function.UseOptionsMethod.md +1 -1
  268. package/docs/wiki/Function.UseOptionsRemoteMethod.md +1 -1
  269. package/docs/wiki/Function.UseRemoteMethod.md +1 -1
  270. package/docs/wiki/Function.UseResolveMethod.md +2 -2
  271. package/docs/wiki/Function.UseShowFunction.md +1 -1
  272. package/docs/wiki/Function.UseToDisplayFunction.md +2 -2
  273. package/docs/wiki/Function.controlDataSource.md +1 -1
  274. package/docs/wiki/Interface.AutocompleteOptionsFromMethodDirectiveParameters.md +2 -2
  275. package/docs/wiki/Interface.AutocompleteOptionsFromMethodDirectiveSettings.md +2 -2
  276. package/docs/wiki/Interface.AutocompleteOptionsFromRemoteMethodTemplateContext.md +2 -2
  277. package/docs/wiki/Interface.ControlHideShowOptions.md +2 -2
  278. package/docs/wiki/Interface.ControlWithDataSource.md +2 -2
  279. package/docs/wiki/Interface.ForFormArrayItemsDirectiveContext.md +8 -8
  280. package/docs/wiki/Interface.InputSelectOptionsSettings.md +5 -5
  281. package/docs/wiki/Interface.InputSelectOptionsTemplateContext.md +2 -2
  282. package/docs/wiki/Interface.OptionsFromMethodDirectiveSettings.md +1 -1
  283. package/docs/wiki/Interface.OptionsFromMethodTemplateContext.md +2 -2
  284. package/docs/wiki/Interface.OptionsFromRemoteMethodTemplateContext.md +2 -2
  285. package/docs/wiki/Interface.UseDataSourceSettings.md +2 -2
  286. package/docs/wiki/Interface.UseDataSourceValue.md +4 -4
  287. package/docs/wiki/Interface.UseFunctionConfig.md +2 -2
  288. package/docs/wiki/Interface.UseFunctionDefinition.md +3 -3
  289. package/docs/wiki/Interface.UseMethodConfig.md +2 -2
  290. package/docs/wiki/Interface.UseMethodDefinition.md +3 -3
  291. package/docs/wiki/TypeAlias.ControlHideShowFunction.md +1 -1
  292. package/docs/wiki/TypeAlias.FunctionParameterAdapterFunction.md +1 -1
  293. package/docs/wiki/TypeAlias.FunctionResultAdapterFunction.md +1 -1
  294. package/docs/wiki/TypeAlias.MethodParameterAdapterFunction.md +1 -1
  295. package/docs/wiki/TypeAlias.MethodResultAdapterFunction.md +1 -1
  296. package/docs/wiki/TypeAlias.OptionsMethod.md +1 -1
  297. package/docs/wiki/TypeAlias.UseFunctionType.md +1 -1
  298. package/docs/wiki/TypeAlias.UseOptionsDataSourceSettings.md +1 -1
  299. package/docs/wiki/Variable.DATA_SOURCE_NAME.md +1 -1
  300. package/docs/wiki/Variable.IS_VALUE_FUNCTION_NAME.md +1 -1
  301. package/docs/wiki/Variable.OPTIONS_METHOD_NAME.md +1 -1
  302. package/docs/wiki/Variable.REMOTE_METHOD_NAME.md +1 -1
  303. package/docs/wiki/Variable.RESOLVE_METHOD_NAME.md +1 -1
  304. package/docs/wiki/Variable.RXAP_FORM_CONTROL_SOURCE.md +1 -1
  305. package/docs/wiki/Variable.RXAP_FORM_SYSTEM_HIDE_METADATA.md +1 -1
  306. package/docs/wiki/Variable.RXAP_FORM_SYSTEM_HIDE_SHOW_OPTIONS.md +1 -1
  307. package/docs/wiki/Variable.RXAP_FORM_SYSTEM_SHOW_METADATA.md +1 -1
  308. package/docs/wiki/Variable.RXAP_USE_FUNCTION.md +1 -1
  309. package/docs/wiki/Variable.RXAP_USE_METHOD.md +1 -1
  310. package/docs/wiki/Variable.RXAP_USE_REMOTE_METHOD.md +1 -1
  311. package/docs/wiki/Variable.SUBMIT_CONTEXT_FORM_ADAPTER_METHOD.md +1 -1
  312. package/docs/wiki/Variable.TO_DISPLAY_FUNCTION_NAME.md +1 -1
  313. package/docs/wiki/globals.md +1 -1
  314. package/fesm2022/rxap-form-system.mjs +1978 -1562
  315. package/fesm2022/rxap-form-system.mjs.map +1 -1
  316. package/package.json +41 -41
  317. package/types/rxap-form-system.d.ts +667 -610
@@ -1,1645 +1,2061 @@
1
- import * as i0 from '@angular/core';
2
- import { input, effect, untracked, forwardRef, Directive, isDevMode, inject, INJECTOR, runInInjectionContext, TemplateRef, ViewContainerRef, ChangeDetectorRef, Renderer2, ElementRef, signal, linkedSignal, Injectable, InjectionToken, Inject, Optional, EnvironmentInjector, createComponent } from '@angular/core';
3
- import { NG_VALIDATORS, ControlContainer, UntypedFormGroup, UntypedFormArray, NgControl } from '@angular/forms';
4
- import { __decorate, __metadata } from 'tslib';
5
- import { PipeDataSource, DataSourceLoader, BaseDataSource, RXAP_DATA_SOURCE_METADATA } from '@rxap/data-source';
6
- import { Mixin } from '@rxap/mixin';
7
- import { RxapFormControl, RxapFormGroup, RxapFormArray, controlValueChanges$, RXAP_FORM_CONTEXT } from '@rxap/forms';
8
- import { map, tap, startWith as startWith$1, catchError, throttleTime, distinctUntilChanged as distinctUntilChanged$1, switchMap, shareReplay } from 'rxjs/operators';
9
- import { setMetadataMapMap, getMetadata, setMetadataMap, setMetadata } from '@rxap/reflect-metadata';
10
- import { RxapError, isPromiseLike, isPromise, equals } from '@rxap/utilities';
11
- import { ToMethod } from '@rxap/pattern';
12
- import { debounceTime, map as map$1, distinctUntilChanged, startWith, pairwise, tap as tap$1, isObservable, Subscription, of, EMPTY } from 'rxjs';
13
- import { MatButton } from '@angular/material/button';
14
- import { isDefined } from '@rxap/rxjs';
15
- import { isUUID } from '@rxap/validator';
16
- import { MatFormField, MAT_FORM_FIELD } from '@angular/material/form-field';
17
- import { RemoteMethodLoader, ProxyRemoteMethod } from '@rxap/remote-method';
18
-
19
- class IsEqualToDirective {
20
- constructor() {
21
- this.equalTo = input.required({ ...(ngDevMode ? { debugName: "equalTo" } : /* istanbul ignore next */ {}), alias: 'rxapIsEqualTo' });
22
- effect(() => {
23
- this.equalTo();
24
- untracked(() => this._onChange?.());
25
- });
26
- }
27
- validate(control) {
28
- const equalTo = this.equalTo();
29
- if (equalTo === null || equalTo === control.value) {
30
- return null;
31
- }
32
- return {
33
- isEqualTo: {
34
- value: equalTo,
35
- actualValue: control.value,
36
- },
37
- };
38
- }
39
- /**
40
- * @description
41
- * Registers a callback function to call when the validator inputs change.
42
- *
43
- * @param fn The callback function
44
- */
45
- registerOnValidatorChange(fn) {
46
- this._onChange = fn;
47
- }
48
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: IsEqualToDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
49
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: IsEqualToDirective, isStandalone: true, selector: "[rxapIsEqualTo]", inputs: { equalTo: { classPropertyName: "equalTo", publicName: "rxapIsEqualTo", isSignal: true, isRequired: true, transformFunction: null } }, providers: [
50
- {
51
- provide: NG_VALIDATORS,
52
- multi: true,
53
- useExisting: forwardRef(() => IsEqualToDirective),
54
- },
55
- ], ngImport: i0 }); }
56
- }
57
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: IsEqualToDirective, decorators: [{
58
- type: Directive,
59
- args: [{
60
- selector: '[rxapIsEqualTo]',
61
- providers: [
62
- {
63
- provide: NG_VALIDATORS,
64
- multi: true,
65
- useExisting: forwardRef(() => IsEqualToDirective),
66
- },
67
- ],
68
- standalone: true,
69
- }]
70
- }], ctorParameters: () => [], propDecorators: { equalTo: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapIsEqualTo", required: true }] }] } });
71
-
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectorRef, Directive, ElementRef, EnvironmentInjector, INJECTOR, Inject, Injectable, InjectionToken, Optional, Renderer2, TemplateRef, ViewContainerRef, createComponent, effect, forwardRef, inject, input, isDevMode, linkedSignal, runInInjectionContext, signal, untracked } from "@angular/core";
3
+ import { ControlContainer, NG_VALIDATORS, NgControl, UntypedFormArray, UntypedFormGroup } from "@angular/forms";
4
+ import { __decorate, __metadata } from "tslib";
5
+ import { BaseDataSource, DataSourceLoader, PipeDataSource, RXAP_DATA_SOURCE_METADATA } from "@rxap/data-source";
6
+ import { Mixin } from "@rxap/mixin";
7
+ import { RXAP_FORM_CONTEXT, RxapFormArray, RxapFormControl, RxapFormGroup, controlValueChanges$ } from "@rxap/forms";
8
+ import { catchError, distinctUntilChanged, map, shareReplay, startWith, switchMap, tap, throttleTime } from "rxjs/operators";
9
+ import { getMetadata, setMetadata, setMetadataMap, setMetadataMapMap } from "@rxap/reflect-metadata";
10
+ import { RxapError, equals, isPromise, isPromiseLike } from "@rxap/utilities";
11
+ import { ToMethod } from "@rxap/pattern";
12
+ import { EMPTY, Subscription, debounceTime, distinctUntilChanged as distinctUntilChanged$1, isObservable, map as map$1, of, pairwise, startWith as startWith$1, tap as tap$1 } from "rxjs";
13
+ import { MatButton } from "@angular/material/button";
14
+ import { isDefined } from "@rxap/rxjs";
15
+ import { isUUID } from "@rxap/validator";
16
+ import { MAT_FORM_FIELD, MatFormField } from "@angular/material/form-field";
17
+ import { ProxyRemoteMethod, RemoteMethodLoader } from "@rxap/remote-method";
18
+ var IsEqualToDirective = class IsEqualToDirective {
19
+ constructor() {
20
+ this.equalTo = input.required({
21
+ ...ngDevMode ? { debugName: "equalTo" } : /* istanbul ignore next */ {},
22
+ alias: "rxapIsEqualTo"
23
+ });
24
+ effect(() => {
25
+ this.equalTo();
26
+ untracked(() => this._onChange?.());
27
+ });
28
+ }
29
+ validate(control) {
30
+ const equalTo = this.equalTo();
31
+ if (equalTo === null || equalTo === control.value) return null;
32
+ return { isEqualTo: {
33
+ value: equalTo,
34
+ actualValue: control.value
35
+ } };
36
+ }
37
+ registerOnValidatorChange(fn) {
38
+ this._onChange = fn;
39
+ }
40
+ static {
41
+ this.ɵfac = i0.ɵɵngDeclareFactory({
42
+ minVersion: "12.0.0",
43
+ version: "22.3.0",
44
+ ngImport: i0,
45
+ type: IsEqualToDirective,
46
+ deps: [],
47
+ target: i0.ɵɵFactoryTarget.Directive
48
+ });
49
+ }
50
+ static {
51
+ this.ɵdir = i0.ɵɵngDeclareDirective({
52
+ minVersion: "17.1.0",
53
+ version: "22.3.0",
54
+ type: IsEqualToDirective,
55
+ isStandalone: true,
56
+ selector: "[rxapIsEqualTo]",
57
+ inputs: { equalTo: {
58
+ classPropertyName: "equalTo",
59
+ publicName: "rxapIsEqualTo",
60
+ isSignal: true,
61
+ isRequired: true,
62
+ transformFunction: null
63
+ } },
64
+ providers: [{
65
+ provide: NG_VALIDATORS,
66
+ multi: true,
67
+ useExisting: forwardRef(() => IsEqualToDirective)
68
+ }],
69
+ ngImport: i0
70
+ });
71
+ }
72
+ };
73
+ i0.ɵɵngDeclareClassMetadata({
74
+ minVersion: "12.0.0",
75
+ version: "22.3.0",
76
+ ngImport: i0,
77
+ type: IsEqualToDirective,
78
+ decorators: [{
79
+ type: Directive,
80
+ args: [{
81
+ selector: "[rxapIsEqualTo]",
82
+ providers: [{
83
+ provide: NG_VALIDATORS,
84
+ multi: true,
85
+ useExisting: forwardRef(() => IsEqualToDirective)
86
+ }],
87
+ standalone: true
88
+ }]
89
+ }],
90
+ ctorParameters: () => [],
91
+ propDecorators: { equalTo: [{
92
+ type: i0.Input,
93
+ args: [{
94
+ isSignal: true,
95
+ alias: "rxapIsEqualTo",
96
+ required: true
97
+ }]
98
+ }] }
99
+ });
72
100
  var FormSystemMetadataKeys;
73
- (function (FormSystemMetadataKeys) {
74
- FormSystemMetadataKeys["COMPONENTS"] = "rxap/form-system/components";
75
- FormSystemMetadataKeys["DATA_SOURCES"] = "rxap/form-system/data-sources";
76
- FormSystemMetadataKeys["COMPONENTS_PROPERTIES"] = "rxap/form-system/components-properties";
77
- FormSystemMetadataKeys["FORM_COMPONENT"] = "rxap/window-form-system/form-component";
101
+ (function(FormSystemMetadataKeys) {
102
+ FormSystemMetadataKeys["COMPONENTS"] = "rxap/form-system/components";
103
+ FormSystemMetadataKeys["DATA_SOURCES"] = "rxap/form-system/data-sources";
104
+ FormSystemMetadataKeys["COMPONENTS_PROPERTIES"] = "rxap/form-system/components-properties";
105
+ FormSystemMetadataKeys["FORM_COMPONENT"] = "rxap/window-form-system/form-component";
78
106
  })(FormSystemMetadataKeys || (FormSystemMetadataKeys = {}));
79
-
80
107
  function UseDataSource(dataSource, name, settings) {
81
- return function (target, propertyKey) {
82
- const value = {
83
- dataSource,
84
- settings,
85
- };
86
- setMetadataMapMap(propertyKey, name, value, FormSystemMetadataKeys.DATA_SOURCES, target);
87
- };
88
- }
89
-
90
- class ExtractControlMixin {
91
- extractControl(ngControl = this.ngControl ??
92
- this.matFormField?._control?.ngControl ??
93
- null) {
94
- if (!ngControl) {
95
- throw new Error('The ngControl is not defined!');
96
- }
97
- this.ngControl = ngControl;
98
- const control = this.ngControl.control;
99
- if (!(control instanceof RxapFormControl)) {
100
- throw new Error('Control is not a RxapFormControl!');
101
- }
102
- return this.control = control;
103
- }
104
- }
105
-
106
- class RxapFormSystemError extends RxapError {
107
- constructor(message, code, className) {
108
- super('@rxap/form-system', message, code, className);
109
- }
110
- }
111
-
112
- class ExtractDataSourcesMixin {
113
- extractDataSources(formDefinition, controlId) {
114
- const map = getMetadata(FormSystemMetadataKeys.DATA_SOURCES, Object.getPrototypeOf(formDefinition));
115
- if (!map) {
116
- throw new RxapFormSystemError('Could not extract the use data source map from the form definition instance', '');
117
- }
118
- if (!map.has(controlId)) {
119
- throw new RxapFormSystemError('A use data source definition does not exists in the form definition metadata', '');
120
- }
121
- return map.get(controlId);
122
- }
108
+ return function(target, propertyKey) {
109
+ setMetadataMapMap(propertyKey, name, {
110
+ dataSource,
111
+ settings
112
+ }, FormSystemMetadataKeys.DATA_SOURCES, target);
113
+ };
123
114
  }
124
-
125
- class ExtractFormDefinitionMixin {
126
- // TODO : change to AbstractControl from @rxap/forms
127
- extractFormDefinition(control) {
128
- const formDefinition = control.rxapFormDefinition;
129
- if (!formDefinition) {
130
- throw new RxapFormSystemError('Could not find the form definition instance', '');
131
- }
132
- return formDefinition;
133
- }
134
- }
135
-
136
- const DATA_SOURCE_NAME = 'options';
115
+ var ExtractControlMixin = class {
116
+ extractControl(ngControl = this.ngControl ?? this.matFormField?._control?.ngControl ?? null) {
117
+ if (!ngControl) throw new Error("The ngControl is not defined!");
118
+ this.ngControl = ngControl;
119
+ const control = this.ngControl.control;
120
+ if (!(control instanceof RxapFormControl)) throw new Error("Control is not a RxapFormControl!");
121
+ return this.control = control;
122
+ }
123
+ };
124
+ var RxapFormSystemError = class extends RxapError {
125
+ constructor(message, code, className) {
126
+ super("@rxap/form-system", message, code, className);
127
+ }
128
+ };
129
+ var ExtractDataSourcesMixin = class {
130
+ extractDataSources(formDefinition, controlId) {
131
+ const map = getMetadata(FormSystemMetadataKeys.DATA_SOURCES, Object.getPrototypeOf(formDefinition));
132
+ if (!map) throw new RxapFormSystemError("Could not extract the use data source map from the form definition instance", "");
133
+ if (!map.has(controlId)) throw new RxapFormSystemError("A use data source definition does not exists in the form definition metadata", "");
134
+ return map.get(controlId);
135
+ }
136
+ };
137
+ var ExtractFormDefinitionMixin = class {
138
+ extractFormDefinition(control) {
139
+ const formDefinition = control.rxapFormDefinition;
140
+ if (!formDefinition) throw new RxapFormSystemError("Could not find the form definition instance", "");
141
+ return formDefinition;
142
+ }
143
+ };
144
+ const DATA_SOURCE_NAME = "options";
137
145
  function ComposeOptionsTransformers(...fnc) {
138
- return base => fnc.reduce((source, transform) => transform(source), base);
146
+ return (base) => fnc.reduce((source, transform) => transform(source), base);
139
147
  }
140
148
  function UseOptionsDataSource(dataSource, settings) {
141
- return function (target, propertyKey) {
142
- UseDataSource(dataSource, DATA_SOURCE_NAME, settings)(target, propertyKey);
143
- };
149
+ return function(target, propertyKey) {
150
+ UseDataSource(dataSource, DATA_SOURCE_NAME, settings)(target, propertyKey);
151
+ };
144
152
  }
145
153
  let ExtractOptionsDataSourceMixin = class ExtractOptionsDataSourceMixin {
146
- extractOptionsDatasource(control, metadata) {
147
- control ??= this.extractControl();
148
- if (!(control instanceof RxapFormControl)) {
149
- throw new Error('Ensure to use a RxapFromControl');
150
- }
151
- const formDefinition = this.extractFormDefinition(control);
152
- const useDataSourceValueMap = this.extractDataSources(formDefinition, control.controlId);
153
- if (!useDataSourceValueMap.has('options')) {
154
- throw new Error(`The data source with the name 'options' is not defined`);
155
- }
156
- const useDataSourceValue = this.useDataSourceValue = useDataSourceValueMap.get('options');
157
- this.settings = this.useDataSourceValue.settings ?? {};
158
- let dataSource;
159
- try {
160
- dataSource = this.dataSourceLoader.load(useDataSourceValue.dataSource, metadata, this.injector);
161
- }
162
- catch (e) {
163
- // Angular >= 19 throws a RuntimeError (NG0201) instead of a NullInjectorError
164
- if (e?.name === 'NullInjectorError' || /NG0201/.test(e?.message ?? '')) {
165
- if (isDevMode()) {
166
- console.error('Cloud not inject the options data source', this.useDataSourceValue);
167
- }
168
- throw new Error('Cloud not inject the options data source:\n' + e.message);
169
- }
170
- throw e;
171
- }
172
- if (this.settings?.transformer) {
173
- dataSource = new PipeDataSource(dataSource, map(this.settings.transformer), tap(options => useDataSourceValue.lastValue = options));
174
- }
175
- else {
176
- dataSource = new PipeDataSource(dataSource, tap(options => useDataSourceValue.lastValue = options));
177
- }
178
- return this.dataSource = dataSource;
179
- }
154
+ extractOptionsDatasource(control, metadata) {
155
+ control ??= this.extractControl();
156
+ if (!(control instanceof RxapFormControl)) throw new Error("Ensure to use a RxapFromControl");
157
+ const formDefinition = this.extractFormDefinition(control);
158
+ const useDataSourceValueMap = this.extractDataSources(formDefinition, control.controlId);
159
+ if (!useDataSourceValueMap.has("options")) throw new Error(`The data source with the name 'options' is not defined`);
160
+ const useDataSourceValue = this.useDataSourceValue = useDataSourceValueMap.get("options");
161
+ this.settings = this.useDataSourceValue.settings ?? {};
162
+ let dataSource;
163
+ try {
164
+ dataSource = this.dataSourceLoader.load(useDataSourceValue.dataSource, metadata, this.injector);
165
+ } catch (e) {
166
+ if (e?.name === "NullInjectorError" || /NG0201/.test(e?.message ?? "")) {
167
+ if (isDevMode()) console.error("Cloud not inject the options data source", this.useDataSourceValue);
168
+ throw new Error("Cloud not inject the options data source:\n" + e.message);
169
+ }
170
+ throw e;
171
+ }
172
+ if (this.settings?.transformer) dataSource = new PipeDataSource(dataSource, map(this.settings.transformer), tap((options) => useDataSourceValue.lastValue = options));
173
+ else dataSource = new PipeDataSource(dataSource, tap((options) => useDataSourceValue.lastValue = options));
174
+ return this.dataSource = dataSource;
175
+ }
180
176
  };
181
- ExtractOptionsDataSourceMixin = __decorate([
182
- Mixin(ExtractControlMixin, ExtractFormDefinitionMixin, ExtractDataSourcesMixin)
183
- ], ExtractOptionsDataSourceMixin);
184
-
177
+ ExtractOptionsDataSourceMixin = __decorate([Mixin(ExtractControlMixin, ExtractFormDefinitionMixin, ExtractDataSourcesMixin)], ExtractOptionsDataSourceMixin);
185
178
  let IsSelectableValueDirective = class IsSelectableValueDirective {
186
- constructor() {
187
- this.dataSourceLoader = inject(DataSourceLoader);
188
- this.injector = inject(INJECTOR);
189
- this.viewer = input({ id: '[rxapIsSelectableValue]' }, ...(ngDevMode ? [{ debugName: "viewer" }] : /* istanbul ignore next */ []));
190
- }
191
- validate(control) {
192
- if (control.value) {
193
- this.extractOptionsDatasource(control);
194
- const data = this.useDataSourceValue?.lastValue;
195
- if (data) {
196
- let options;
197
- if (Array.isArray(data)) {
198
- options = data;
199
- }
200
- else {
201
- options = Object.entries(data)
202
- .map(([value, display]) => ({
203
- value,
204
- display,
205
- }));
206
- }
207
- if (!options.some(option => option.value === control.value)) {
208
- return {
209
- isSelectableValue: {
210
- expected: 'Value should be from the list of provided options',
211
- },
212
- };
213
- }
214
- }
215
- else if (isDevMode()) {
216
- console.warn('The last value from the OptionsDataSource is empty', this);
217
- }
218
- }
219
- return null;
220
- }
221
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: IsSelectableValueDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
222
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: IsSelectableValueDirective, isStandalone: true, selector: "[rxapIsSelectableValue]", inputs: { viewer: { classPropertyName: "viewer", publicName: "viewer", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
223
- {
224
- provide: NG_VALIDATORS,
225
- multi: true,
226
- useExisting: forwardRef(() => IsSelectableValueDirective),
227
- },
228
- ], ngImport: i0 }); }
179
+ constructor() {
180
+ this.dataSourceLoader = inject(DataSourceLoader);
181
+ this.injector = inject(INJECTOR);
182
+ this.viewer = input({ id: "[rxapIsSelectableValue]" }, ...ngDevMode ? [{ debugName: "viewer" }] : /* istanbul ignore next */ []);
183
+ }
184
+ validate(control) {
185
+ if (control.value) {
186
+ this.extractOptionsDatasource(control);
187
+ const data = this.useDataSourceValue?.lastValue;
188
+ if (data) {
189
+ let options;
190
+ if (Array.isArray(data)) options = data;
191
+ else options = Object.entries(data).map(([value, display]) => ({
192
+ value,
193
+ display
194
+ }));
195
+ if (!options.some((option) => option.value === control.value)) return { isSelectableValue: { expected: "Value should be from the list of provided options" } };
196
+ } else if (isDevMode()) console.warn("The last value from the OptionsDataSource is empty", this);
197
+ }
198
+ return null;
199
+ }
200
+ static {
201
+ this.ɵfac = i0.ɵɵngDeclareFactory({
202
+ minVersion: "12.0.0",
203
+ version: "22.3.0",
204
+ ngImport: i0,
205
+ type: IsSelectableValueDirective,
206
+ deps: [],
207
+ target: i0.ɵɵFactoryTarget.Directive
208
+ });
209
+ }
210
+ static {
211
+ this.ɵdir = i0.ɵɵngDeclareDirective({
212
+ minVersion: "17.1.0",
213
+ version: "22.3.0",
214
+ type: IsSelectableValueDirective,
215
+ isStandalone: true,
216
+ selector: "[rxapIsSelectableValue]",
217
+ inputs: { viewer: {
218
+ classPropertyName: "viewer",
219
+ publicName: "viewer",
220
+ isSignal: true,
221
+ isRequired: false,
222
+ transformFunction: null
223
+ } },
224
+ providers: [{
225
+ provide: NG_VALIDATORS,
226
+ multi: true,
227
+ useExisting: forwardRef(() => IsSelectableValueDirective)
228
+ }],
229
+ ngImport: i0
230
+ });
231
+ }
229
232
  };
230
- IsSelectableValueDirective = __decorate([
231
- Mixin(ExtractOptionsDataSourceMixin)
232
- ], IsSelectableValueDirective);
233
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: IsSelectableValueDirective, decorators: [{
234
- type: Directive,
235
- args: [{
236
- selector: '[rxapIsSelectableValue]',
237
- providers: [
238
- {
239
- provide: NG_VALIDATORS,
240
- multi: true,
241
- useExisting: forwardRef(() => IsSelectableValueDirective),
242
- },
243
- ],
244
- standalone: true,
245
- }]
246
- }], propDecorators: { viewer: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewer", required: false }] }] } });
247
-
233
+ IsSelectableValueDirective = __decorate([Mixin(ExtractOptionsDataSourceMixin)], IsSelectableValueDirective);
234
+ i0.ɵɵngDeclareClassMetadata({
235
+ minVersion: "12.0.0",
236
+ version: "22.3.0",
237
+ ngImport: i0,
238
+ type: IsSelectableValueDirective,
239
+ decorators: [{
240
+ type: Directive,
241
+ args: [{
242
+ selector: "[rxapIsSelectableValue]",
243
+ providers: [{
244
+ provide: NG_VALIDATORS,
245
+ multi: true,
246
+ useExisting: forwardRef(() => IsSelectableValueDirective)
247
+ }],
248
+ standalone: true
249
+ }]
250
+ }],
251
+ propDecorators: { viewer: [{
252
+ type: i0.Input,
253
+ args: [{
254
+ isSignal: true,
255
+ alias: "viewer",
256
+ required: false
257
+ }]
258
+ }] }
259
+ });
248
260
  function ResolveByUuidParameter({ value }) {
249
- return {
250
- parameters: {
251
- uuid: value,
252
- },
253
- };
261
+ return { parameters: { uuid: value } };
254
262
  }
255
263
  function ResolveByUuidResultFactory(transformer) {
256
- return (entity) => {
257
- return transformer(entity);
258
- };
264
+ return (entity) => {
265
+ return transformer(entity);
266
+ };
259
267
  }
260
-
261
268
  function ApplyUseFunctionAdapters(injector, fnc, config) {
262
- if (config?.adapter?.result || config?.adapter?.args) {
263
- return function (...args) {
264
- return new Promise((resolve, reject) => {
265
- runInInjectionContext(injector, () => {
266
- args = config?.adapter?.args?.(args) ?? args;
267
- const result = fnc.call(this, ...args);
268
- if (isPromiseLike(result)) {
269
- const p = result.then((result) => {
270
- resolve(config?.adapter?.result?.(result) ?? result);
271
- });
272
- if (isPromise(p)) {
273
- p.catch(reject);
274
- }
275
- }
276
- else {
277
- try {
278
- resolve(config?.adapter?.result?.(result) ?? result);
279
- }
280
- catch (e) {
281
- reject(e);
282
- }
283
- }
284
- });
285
- });
286
- };
287
- }
288
- return fnc;
269
+ if (config?.adapter?.result || config?.adapter?.args) return function(...args) {
270
+ return new Promise((resolve, reject) => {
271
+ runInInjectionContext(injector, () => {
272
+ args = config?.adapter?.args?.(args) ?? args;
273
+ const result = fnc.call(this, ...args);
274
+ if (isPromiseLike(result)) {
275
+ const p = result.then((result) => {
276
+ resolve(config?.adapter?.result?.(result) ?? result);
277
+ });
278
+ if (isPromise(p)) p.catch(reject);
279
+ } else try {
280
+ resolve(config?.adapter?.result?.(result) ?? result);
281
+ } catch (e) {
282
+ reject(e);
283
+ }
284
+ });
285
+ });
286
+ };
287
+ return fnc;
289
288
  }
290
-
291
289
  function ApplyUseMethodAdapters(injector, method, config) {
292
- if (config?.adapter?.result || config?.adapter?.parameter) {
293
- return ToMethod((parameter, ...args) => {
294
- return new Promise((resolve, reject) => {
295
- runInInjectionContext(injector, () => {
296
- parameter = config?.adapter?.parameter?.(parameter) ?? parameter;
297
- const result = method.call(parameter, ...args);
298
- if (isPromiseLike(result)) {
299
- const p = result.then((result) => {
300
- resolve(config?.adapter?.result?.(result) ?? result);
301
- });
302
- if (isPromise(p)) {
303
- p.catch(reject);
304
- }
305
- }
306
- else {
307
- try {
308
- resolve(config?.adapter?.result?.(result) ?? result);
309
- }
310
- catch (e) {
311
- reject(e);
312
- }
313
- }
314
- });
315
- });
316
- });
317
- }
318
- return method;
319
- }
320
-
321
- class ExtractControlFromParentMixin {
322
- extractControlFromParent(parent, controlPath) {
323
- if (!controlPath) {
324
- throw new RxapFormSystemError('The control path is empty', '');
325
- }
326
- if (!parent.control) {
327
- throw new RxapFormSystemError('The control property of ControlContainer is not defined', '');
328
- }
329
- const control = parent.control.get(controlPath);
330
- if (!control) {
331
- throw new RxapFormSystemError('Could not find the control instance', '');
332
- }
333
- if (!(control instanceof RxapFormControl) &&
334
- !(control instanceof RxapFormGroup) &&
335
- !(control instanceof RxapFormArray)) {
336
- throw new RxapFormSystemError('The extracted control is not a RxapFormControl', '');
337
- }
338
- return control;
339
- }
290
+ if (config?.adapter?.result || config?.adapter?.parameter) return ToMethod((parameter, ...args) => {
291
+ return new Promise((resolve, reject) => {
292
+ runInInjectionContext(injector, () => {
293
+ parameter = config?.adapter?.parameter?.(parameter) ?? parameter;
294
+ const result = method.call(parameter, ...args);
295
+ if (isPromiseLike(result)) {
296
+ const p = result.then((result) => {
297
+ resolve(config?.adapter?.result?.(result) ?? result);
298
+ });
299
+ if (isPromise(p)) p.catch(reject);
300
+ } else try {
301
+ resolve(config?.adapter?.result?.(result) ?? result);
302
+ } catch (e) {
303
+ reject(e);
304
+ }
305
+ });
306
+ });
307
+ });
308
+ return method;
340
309
  }
341
-
342
- const RXAP_USE_FUNCTION = 'rxap/form-system/function/use';
310
+ var ExtractControlFromParentMixin = class {
311
+ extractControlFromParent(parent, controlPath) {
312
+ if (!controlPath) throw new RxapFormSystemError("The control path is empty", "");
313
+ if (!parent.control) throw new RxapFormSystemError("The control property of ControlContainer is not defined", "");
314
+ const control = parent.control.get(controlPath);
315
+ if (!control) throw new RxapFormSystemError("Could not find the control instance", "");
316
+ if (!(control instanceof RxapFormControl) && !(control instanceof RxapFormGroup) && !(control instanceof RxapFormArray)) throw new RxapFormSystemError("The extracted control is not a RxapFormControl", "");
317
+ return control;
318
+ }
319
+ };
320
+ const RXAP_USE_FUNCTION = "rxap/form-system/function/use";
343
321
  function UseFunction(fnc, name, config) {
344
- return function (target, propertyKey) {
345
- setMetadataMapMap(propertyKey, name, { fnc, config }, RXAP_USE_FUNCTION, target);
346
- };
347
- }
348
- class ExtractFunctionsMixin {
349
- extractFunctions(defaultMap = null, formDefinition, controlId) {
350
- const map = getMetadata(RXAP_USE_FUNCTION, Object.getPrototypeOf(formDefinition));
351
- if (!map) {
352
- if (defaultMap) {
353
- return defaultMap;
354
- }
355
- throw new Error('Could not extract the use remote function map from the form definition instance');
356
- }
357
- if (!map.has(controlId)) {
358
- if (defaultMap) {
359
- return defaultMap;
360
- }
361
- throw new Error('A use remote function definition does not exists in the form definition metadata');
362
- }
363
- return map.get(controlId);
364
- }
322
+ return function(target, propertyKey) {
323
+ setMetadataMapMap(propertyKey, name, {
324
+ fnc,
325
+ config
326
+ }, RXAP_USE_FUNCTION, target);
327
+ };
365
328
  }
366
-
329
+ var ExtractFunctionsMixin = class {
330
+ extractFunctions(defaultMap = null, formDefinition, controlId) {
331
+ const map = getMetadata(RXAP_USE_FUNCTION, Object.getPrototypeOf(formDefinition));
332
+ if (!map) {
333
+ if (defaultMap) return defaultMap;
334
+ throw new Error("Could not extract the use remote function map from the form definition instance");
335
+ }
336
+ if (!map.has(controlId)) {
337
+ if (defaultMap) return defaultMap;
338
+ throw new Error("A use remote function definition does not exists in the form definition metadata");
339
+ }
340
+ return map.get(controlId);
341
+ }
342
+ };
367
343
  let ExtractFunctionMixin = class ExtractFunctionMixin {
368
- extractFunction(defaultFunction = null, formDefinition, controlId, name) {
369
- const map = this.extractFunctions(new Map, formDefinition, controlId);
370
- if (!map.has(name)) {
371
- if (defaultFunction) {
372
- return defaultFunction;
373
- }
374
- throw new Error(`A function with the name '${name}' is not attached to the control '${controlId}' use the @UseFunction decorator to attach a function to the control`);
375
- }
376
- const { fnc, config } = map.get(name);
377
- return ApplyUseFunctionAdapters(this.injector, fnc, config);
378
- }
344
+ extractFunction(defaultFunction = null, formDefinition, controlId, name) {
345
+ const map = this.extractFunctions(/* @__PURE__ */ new Map(), formDefinition, controlId);
346
+ if (!map.has(name)) {
347
+ if (defaultFunction) return defaultFunction;
348
+ throw new Error(`A function with the name '${name}' is not attached to the control '${controlId}' use the @UseFunction decorator to attach a function to the control`);
349
+ }
350
+ const { fnc, config } = map.get(name);
351
+ return ApplyUseFunctionAdapters(this.injector, fnc, config);
352
+ }
379
353
  };
380
- ExtractFunctionMixin = __decorate([
381
- Mixin(ExtractFunctionsMixin)
382
- ], ExtractFunctionMixin);
383
-
384
- const IS_VALUE_FUNCTION_NAME = 'is-value';
354
+ ExtractFunctionMixin = __decorate([Mixin(ExtractFunctionsMixin)], ExtractFunctionMixin);
355
+ const IS_VALUE_FUNCTION_NAME = "is-value";
385
356
  function UseIsValueFunction(fnc, config) {
386
- return function (target, propertyKey) {
387
- UseFunction(fnc, IS_VALUE_FUNCTION_NAME, config)(target, propertyKey);
388
- };
357
+ return function(target, propertyKey) {
358
+ UseFunction(fnc, IS_VALUE_FUNCTION_NAME, config)(target, propertyKey);
359
+ };
389
360
  }
390
361
  let ExtractIsValueFunctionMixin = class ExtractIsValueFunctionMixin {
391
- extractIsValueFunction(defaultFunction = null, control = this.extractControl(), formDefinition = this.extractFormDefinition(control)) {
392
- return this.extractFunction(defaultFunction, formDefinition, control.controlId, IS_VALUE_FUNCTION_NAME);
393
- }
362
+ extractIsValueFunction(defaultFunction = null, control = this.extractControl(), formDefinition = this.extractFormDefinition(control)) {
363
+ return this.extractFunction(defaultFunction, formDefinition, control.controlId, IS_VALUE_FUNCTION_NAME);
364
+ }
394
365
  };
395
- ExtractIsValueFunctionMixin = __decorate([
396
- Mixin(ExtractFormDefinitionMixin, ExtractFunctionMixin, ExtractControlMixin)
397
- ], ExtractIsValueFunctionMixin);
398
-
399
- const RXAP_USE_METHOD = 'rxap/form-system/method/use';
366
+ ExtractIsValueFunctionMixin = __decorate([Mixin(ExtractFormDefinitionMixin, ExtractFunctionMixin, ExtractControlMixin)], ExtractIsValueFunctionMixin);
367
+ const RXAP_USE_METHOD = "rxap/form-system/method/use";
400
368
  function UseMethod(method, name, config) {
401
- return function (target, propertyKey) {
402
- setMetadataMapMap(propertyKey, name, { method, config }, RXAP_USE_METHOD, target);
403
- };
404
- }
405
- class ExtractMethodsMixin {
406
- extractMethods(formDefinition, controlId) {
407
- const map = getMetadata(RXAP_USE_METHOD, Object.getPrototypeOf(formDefinition));
408
- if (!map) {
409
- console.log(map);
410
- throw new Error('Could not extract the use remote method map from the form definition instance');
411
- }
412
- if (!map.has(controlId)) {
413
- throw new Error('A use remote method definition does not exists in the form definition metadata');
414
- }
415
- return map.get(controlId);
416
- }
369
+ return function(target, propertyKey) {
370
+ setMetadataMapMap(propertyKey, name, {
371
+ method,
372
+ config
373
+ }, RXAP_USE_METHOD, target);
374
+ };
417
375
  }
418
-
376
+ var ExtractMethodsMixin = class {
377
+ extractMethods(formDefinition, controlId) {
378
+ const map = getMetadata(RXAP_USE_METHOD, Object.getPrototypeOf(formDefinition));
379
+ if (!map) {
380
+ console.log(map);
381
+ throw new Error("Could not extract the use remote method map from the form definition instance");
382
+ }
383
+ if (!map.has(controlId)) throw new Error("A use remote method definition does not exists in the form definition metadata");
384
+ return map.get(controlId);
385
+ }
386
+ };
419
387
  let ExtractMethodMixin = class ExtractMethodMixin {
420
- extractMethod(formDefinition, controlId, name) {
421
- const map = this.extractMethods(formDefinition, controlId);
422
- if (!map.has(name)) {
423
- throw new Error(`A method with the name '${name}' is not attached to the control '${controlId}' use the @UseMethod decorator to attach a method to the control`);
424
- }
425
- const { method: methodToken, config } = map.get(name);
426
- const method = this.injector.get(methodToken);
427
- return ApplyUseMethodAdapters(this.injector, method, config);
428
- }
388
+ extractMethod(formDefinition, controlId, name) {
389
+ const map = this.extractMethods(formDefinition, controlId);
390
+ if (!map.has(name)) throw new Error(`A method with the name '${name}' is not attached to the control '${controlId}' use the @UseMethod decorator to attach a method to the control`);
391
+ const { method: methodToken, config } = map.get(name);
392
+ const method = this.injector.get(methodToken);
393
+ return ApplyUseMethodAdapters(this.injector, method, config);
394
+ }
429
395
  };
430
- ExtractMethodMixin = __decorate([
431
- Mixin(ExtractMethodsMixin)
432
- ], ExtractMethodMixin);
433
-
434
- const OPTIONS_METHOD_NAME = 'options';
396
+ ExtractMethodMixin = __decorate([Mixin(ExtractMethodsMixin)], ExtractMethodMixin);
397
+ const OPTIONS_METHOD_NAME = "options";
435
398
  function UseOptionsMethod(method, config) {
436
- return function (target, propertyKey) {
437
- UseMethod(method, OPTIONS_METHOD_NAME, config)(target, propertyKey);
438
- };
399
+ return function(target, propertyKey) {
400
+ UseMethod(method, OPTIONS_METHOD_NAME, config)(target, propertyKey);
401
+ };
439
402
  }
440
403
  let ExtractOptionsMethodMixin = class ExtractOptionsMethodMixin {
441
- extractOptionsMethod(control = this.extractControl(), formDefinition = this.extractFormDefinition(control)) {
442
- return this.extractMethod(formDefinition, control.controlId, OPTIONS_METHOD_NAME);
443
- }
404
+ extractOptionsMethod(control = this.extractControl(), formDefinition = this.extractFormDefinition(control)) {
405
+ return this.extractMethod(formDefinition, control.controlId, OPTIONS_METHOD_NAME);
406
+ }
444
407
  };
445
- ExtractOptionsMethodMixin = __decorate([
446
- Mixin(ExtractFormDefinitionMixin, ExtractMethodMixin, ExtractControlMixin)
447
- ], ExtractOptionsMethodMixin);
448
-
449
- const RESOLVE_METHOD_NAME = 'resolve';
408
+ ExtractOptionsMethodMixin = __decorate([Mixin(ExtractFormDefinitionMixin, ExtractMethodMixin, ExtractControlMixin)], ExtractOptionsMethodMixin);
409
+ const RESOLVE_METHOD_NAME = "resolve";
450
410
  function UseResolveMethod(method, config) {
451
- return function (target, propertyKey) {
452
- UseMethod(method, RESOLVE_METHOD_NAME, config)(target, propertyKey);
453
- };
411
+ return function(target, propertyKey) {
412
+ UseMethod(method, RESOLVE_METHOD_NAME, config)(target, propertyKey);
413
+ };
454
414
  }
455
415
  let ExtractResolveMethodMixin = class ExtractResolveMethodMixin {
456
- extractResolveMethod(control = this.extractControl(), formDefinition = this.extractFormDefinition(control)) {
457
- return this.extractMethod(formDefinition, control.controlId, RESOLVE_METHOD_NAME);
458
- }
416
+ extractResolveMethod(control = this.extractControl(), formDefinition = this.extractFormDefinition(control)) {
417
+ return this.extractMethod(formDefinition, control.controlId, RESOLVE_METHOD_NAME);
418
+ }
459
419
  };
460
- ExtractResolveMethodMixin = __decorate([
461
- Mixin(ExtractFormDefinitionMixin, ExtractMethodMixin, ExtractControlMixin)
462
- ], ExtractResolveMethodMixin);
463
-
464
- const TO_DISPLAY_FUNCTION_NAME = 'to-display';
420
+ ExtractResolveMethodMixin = __decorate([Mixin(ExtractFormDefinitionMixin, ExtractMethodMixin, ExtractControlMixin)], ExtractResolveMethodMixin);
421
+ const TO_DISPLAY_FUNCTION_NAME = "to-display";
465
422
  function UseToDisplayFunction(fnc, config) {
466
- return function (target, propertyKey) {
467
- UseFunction(fnc, TO_DISPLAY_FUNCTION_NAME, config)(target, propertyKey);
468
- };
423
+ return function(target, propertyKey) {
424
+ UseFunction(fnc, TO_DISPLAY_FUNCTION_NAME, config)(target, propertyKey);
425
+ };
469
426
  }
470
427
  let ExtractToDisplayFunctionMixin = class ExtractToDisplayFunctionMixin {
471
- extractToDisplayFunction(defaultFunction = null, control = this.extractControl(), formDefinition = this.extractFormDefinition(control)) {
472
- return this.extractFunction(defaultFunction, formDefinition, control.controlId, TO_DISPLAY_FUNCTION_NAME);
473
- }
428
+ extractToDisplayFunction(defaultFunction = null, control = this.extractControl(), formDefinition = this.extractFormDefinition(control)) {
429
+ return this.extractFunction(defaultFunction, formDefinition, control.controlId, TO_DISPLAY_FUNCTION_NAME);
430
+ }
474
431
  };
475
- ExtractToDisplayFunctionMixin = __decorate([
476
- Mixin(ExtractFormDefinitionMixin, ExtractFunctionMixin, ExtractControlMixin)
477
- ], ExtractToDisplayFunctionMixin);
478
-
479
- // TODO : move to rxap packages
480
- class ForFormArrayItemsDirective {
481
- constructor() {
482
- this.container = inject(ControlContainer, { skipSelf: true });
483
- this.template = inject(TemplateRef);
484
- this.viewContainerRef = inject(ViewContainerRef);
485
- this.cdr = inject(ChangeDetectorRef);
486
- }
487
- ngAfterViewInit() {
488
- if (this.container.control instanceof RxapFormArray) {
489
- this.formArray = this.container.control;
490
- this.container.control.value$.pipe(debounceTime(100), map$1(value => value.length), distinctUntilChanged(), startWith(0), pairwise(), tap$1(([a, b]) => {
491
- if (a !== b) {
492
- this.render(b);
493
- }
494
- })).subscribe();
495
- }
496
- else {
497
- throw new Error('The control container is not an instance of RxapFormArray');
498
- }
499
- }
500
- ngOnDestroy() {
501
- this._formArrayValueSubscription?.unsubscribe();
502
- }
503
- render(length) {
504
- this.viewContainerRef.clear();
505
- for (let index = 0; index < length; index++) {
506
- const group = this.formArray.at(index);
507
- if (group instanceof UntypedFormGroup) {
508
- this.viewContainerRef.createEmbeddedView(this.template, {
509
- $implicit: group,
510
- index,
511
- first: index === 0,
512
- last: index === length - 1,
513
- even: index % 2 === 0,
514
- odd: index % 2 !== 0,
515
- array: this.formArray,
516
- });
517
- }
518
- else {
519
- throw new Error('rxapForFormArrayItem only support FormArray with FormGroup as items');
520
- }
521
- }
522
- this.cdr.detectChanges();
523
- }
524
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: ForFormArrayItemsDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
525
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: ForFormArrayItemsDirective, isStandalone: true, selector: "[rxapForFormArrayItem]", ngImport: i0 }); }
526
- }
527
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: ForFormArrayItemsDirective, decorators: [{
528
- type: Directive,
529
- args: [{
530
- selector: '[rxapForFormArrayItem]',
531
- standalone: true,
532
- }]
533
- }] });
534
-
535
- // TODO : move to rxap packages
536
- class FormArrayAddItemButtonDirective {
537
- constructor() {
538
- this.parent = inject(ControlContainer, { skipSelf: true });
539
- this.matButton = inject(MatButton, { optional: true });
540
- this.type = 'button';
541
- }
542
- get disabled() {
543
- return this.isDisabled;
544
- }
545
- get isDisabled() {
546
- return !!this.formArray?.disabled;
547
- }
548
- ngAfterViewInit() {
549
- if (this.parent.control instanceof RxapFormArray) {
550
- this.formArray = this.parent.control;
551
- }
552
- const matButton = this.matButton;
553
- if (matButton) {
554
- this._controlDisabledSubscription = this.formArray.disabled$.pipe(tap$1(isDisabled => matButton.disabled = isDisabled)).subscribe();
555
- }
556
- }
557
- ngOnDestroy() {
558
- this._controlDisabledSubscription?.unsubscribe();
559
- }
560
- onClick() {
561
- this.formArray.insertAt();
562
- }
563
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: FormArrayAddItemButtonDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
564
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: FormArrayAddItemButtonDirective, isStandalone: true, selector: "[rxapFormArrayItemAddButton]", host: { attributes: { "type": "button" }, listeners: { "click": "onClick()" }, properties: { "disabled": "disabled" } }, ngImport: i0 }); }
565
- }
566
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: FormArrayAddItemButtonDirective, decorators: [{
567
- type: Directive,
568
- args: [{
569
- selector: '[rxapFormArrayItemAddButton]',
570
- standalone: true,
571
- host: {
572
- 'type': 'button',
573
- '[disabled]': 'disabled',
574
- '(click)': 'onClick()',
575
- },
576
- }]
577
- }] });
578
-
579
- // TODO : move to rxap packages
580
- class FormArrayItemButton {
581
- constructor() {
582
- this.type = 'button';
583
- this.parent = inject(ControlContainer, { skipSelf: true });
584
- this.matButton = inject(MatButton, { optional: true });
585
- this.renderer = inject(Renderer2);
586
- this.elementRef = inject(ElementRef);
587
- }
588
- get disabled() {
589
- return this.isDisabled;
590
- }
591
- get isDeleted() {
592
- return this.deletedControl.value;
593
- }
594
- get index() {
595
- return this.formArray.controls.findIndex(control => control === this.formGroup);
596
- }
597
- get isDisabled() {
598
- return !!this.formGroup?.parent?.disabled;
599
- }
600
- ngAfterViewInit() {
601
- if (this.parent.control instanceof RxapFormGroup) {
602
- this.formGroup = this.parent.control;
603
- if (this.formGroup.controls.deleted) {
604
- if (this.formGroup.controls.deleted instanceof RxapFormControl) {
605
- this.deletedControl = this.formGroup.controls.deleted;
606
- }
607
- else {
608
- throw new Error(`The parent FormGroup instance does have a 'deleted' control, but it is not a RxapFormControl instance`);
609
- }
610
- }
611
- else {
612
- this.deletedControl = new RxapFormControl(false, { controlId: 'deleted' });
613
- this.formGroup.addControl('deleted', this.deletedControl);
614
- }
615
- if (this.formGroup.parent instanceof RxapFormArray) {
616
- this.formArray = this.formGroup.parent;
617
- }
618
- else {
619
- throw new Error(`The parent of the FormGroup is not a RxapFormArray instance`);
620
- }
621
- }
622
- else {
623
- throw new Error(`The parent is not a form group instance`);
624
- }
625
- const matButton = this.matButton;
626
- if (matButton) {
627
- this._controlDisabledSubscription = this.formGroup.disabled$.pipe(tap$1(isDisabled => matButton.disabled = isDisabled)).subscribe();
628
- }
629
- this.deletedControl.value$.pipe(tap$1(() => this.updateDisplayStyle())).subscribe();
630
- }
631
- ngOnDestroy() {
632
- this._controlDisabledSubscription?.unsubscribe();
633
- this._deletedControlValueSubscription?.unsubscribe();
634
- }
635
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: FormArrayItemButton, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
636
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: FormArrayItemButton, isStandalone: true, host: { attributes: { "type": "button" }, listeners: { "click": "onClick()" }, properties: { "disabled": "disabled" } }, ngImport: i0 }); }
637
- }
638
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: FormArrayItemButton, decorators: [{
639
- type: Directive,
640
- args: [{
641
- host: {
642
- 'type': 'button',
643
- '[disabled]': 'disabled',
644
- '(click)': 'onClick()',
645
- },
646
- }]
647
- }] });
648
-
649
- // TODO : move to rxap packages
650
- class FormArrayItemRemoveButtonDirective extends FormArrayItemButton {
651
- constructor() {
652
- super(...arguments);
653
- /**
654
- * A function that returns if the control should be temporarily deleted.
655
- * true - in the given form group the deleted control is set to true
656
- * false - the form group is removed from the (parent) form array
657
- */
658
- this.shouldTemporarilyDeleted = input(() => false, ...(ngDevMode ? [{ debugName: "shouldTemporarilyDeleted" }] : /* istanbul ignore next */ []));
659
- }
660
- onClick() {
661
- const templateDelete = this.shouldTemporarilyDeleted()(this.formGroup);
662
- if (templateDelete) {
663
- this.deletedControl.setValue(true);
664
- }
665
- else {
666
- this.formArray.removeAt(this.index);
667
- }
668
- }
669
- updateDisplayStyle() {
670
- if (this.isDeleted) {
671
- this.renderer.setStyle(this.elementRef.nativeElement, 'display', 'none');
672
- }
673
- else {
674
- this.renderer.removeStyle(this.elementRef.nativeElement, 'display');
675
- }
676
- }
677
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: FormArrayItemRemoveButtonDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
678
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: FormArrayItemRemoveButtonDirective, isStandalone: true, selector: "button[rxapFormArrayItemRemoveButton]", inputs: { shouldTemporarilyDeleted: { classPropertyName: "shouldTemporarilyDeleted", publicName: "shouldTemporarilyDeleted", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0 }); }
679
- }
680
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: FormArrayItemRemoveButtonDirective, decorators: [{
681
- type: Directive,
682
- args: [{
683
- selector: 'button[rxapFormArrayItemRemoveButton]',
684
- standalone: true,
685
- }]
686
- }], propDecorators: { shouldTemporarilyDeleted: [{ type: i0.Input, args: [{ isSignal: true, alias: "shouldTemporarilyDeleted", required: false }] }] } });
687
-
688
- // TODO : move to rxap packages
689
- class FormArrayItemRestoreButtonDirective extends FormArrayItemButton {
690
- onClick() {
691
- this.formGroup.controls.deleted.setValue(false);
692
- }
693
- updateDisplayStyle() {
694
- if (this.isDeleted) {
695
- this.renderer.removeStyle(this.elementRef.nativeElement, 'display');
696
- }
697
- else {
698
- this.renderer.setStyle(this.elementRef.nativeElement, 'display', 'none');
699
- }
700
- }
701
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: FormArrayItemRestoreButtonDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
702
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: FormArrayItemRestoreButtonDirective, isStandalone: true, selector: "button[rxapFormArrayItemRestoreButton]", usesInheritance: true, ngImport: i0 }); }
703
- }
704
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: FormArrayItemRestoreButtonDirective, decorators: [{
705
- type: Directive,
706
- args: [{
707
- selector: 'button[rxapFormArrayItemRestoreButton]',
708
- standalone: true,
709
- }]
710
- }] });
711
-
712
- // TODO : move to rxap packages
713
- class FormArrayRemovableDirective {
714
- constructor() {
715
- this.parent = inject(ControlContainer);
716
- }
717
- get isDeleted() {
718
- return this.deletedControl.value;
719
- }
720
- get isDisabled() {
721
- return !!this.formGroup?.parent?.disabled;
722
- }
723
- ngAfterViewInit() {
724
- if (this.parent.control instanceof RxapFormGroup) {
725
- this.formGroup = this.parent.control;
726
- if (this.formGroup.controls.deleted) {
727
- if (this.formGroup.controls.deleted instanceof RxapFormControl) {
728
- this.deletedControl = this.formGroup.controls.deleted;
729
- }
730
- else {
731
- throw new Error(`The parent FormGroup instance does have a 'deleted' control, but it is not a RxapFormControl instance`);
732
- }
733
- }
734
- else {
735
- this.deletedControl = new RxapFormControl(false, { controlId: 'deleted' });
736
- this.formGroup.addControl('deleted', this.deletedControl);
737
- }
738
- if (!(this.formGroup.parent instanceof UntypedFormArray)) {
739
- throw new Error(`The parent of the FormGroup is not a FormArray instance`);
740
- }
741
- }
742
- else {
743
- throw new Error(`The parent is not a form group instance`);
744
- }
745
- this._deletedControlValueSubscription = this.deletedControl.value$.pipe(tap$1((isDeleted) => {
746
- for (const [name, control] of Object.entries(this.formGroup.controls)) {
747
- if (name !== 'deleted') {
748
- if (isDeleted) {
749
- control.disable({ onlySelf: true });
750
- }
751
- else if (!this.isDisabled) {
752
- control.enable({ onlySelf: true });
753
- }
754
- }
755
- }
756
- })).subscribe();
757
- }
758
- ngOnDestroy() {
759
- this._deletedControlValueSubscription?.unsubscribe();
760
- }
761
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: FormArrayRemovableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
762
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: FormArrayRemovableDirective, isStandalone: true, selector: "[rxapFormArrayRemovable]", ngImport: i0 }); }
763
- }
764
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: FormArrayRemovableDirective, decorators: [{
765
- type: Directive,
766
- args: [{
767
- selector: '[rxapFormArrayRemovable]',
768
- standalone: true,
769
- }]
770
- }] });
771
-
772
- /**
773
- * Shared implementation of the options from method directives. The concrete directives
774
- * only declare the (aliased) signal inputs.
775
- */
432
+ ExtractToDisplayFunctionMixin = __decorate([Mixin(ExtractFormDefinitionMixin, ExtractFunctionMixin, ExtractControlMixin)], ExtractToDisplayFunctionMixin);
433
+ var ForFormArrayItemsDirective = class ForFormArrayItemsDirective {
434
+ constructor() {
435
+ this.container = inject(ControlContainer, { skipSelf: true });
436
+ this.template = inject(TemplateRef);
437
+ this.viewContainerRef = inject(ViewContainerRef);
438
+ this.cdr = inject(ChangeDetectorRef);
439
+ }
440
+ ngAfterViewInit() {
441
+ if (this.container.control instanceof RxapFormArray) {
442
+ this.formArray = this.container.control;
443
+ this.container.control.value$.pipe(debounceTime(100), map$1((value) => value.length), distinctUntilChanged$1(), startWith$1(0), pairwise(), tap$1(([a, b]) => {
444
+ if (a !== b) this.render(b);
445
+ })).subscribe();
446
+ } else throw new Error("The control container is not an instance of RxapFormArray");
447
+ }
448
+ ngOnDestroy() {
449
+ this._formArrayValueSubscription?.unsubscribe();
450
+ }
451
+ render(length) {
452
+ this.viewContainerRef.clear();
453
+ for (let index = 0; index < length; index++) {
454
+ const group = this.formArray.at(index);
455
+ if (group instanceof UntypedFormGroup) this.viewContainerRef.createEmbeddedView(this.template, {
456
+ $implicit: group,
457
+ index,
458
+ first: index === 0,
459
+ last: index === length - 1,
460
+ even: index % 2 === 0,
461
+ odd: index % 2 !== 0,
462
+ array: this.formArray
463
+ });
464
+ else throw new Error("rxapForFormArrayItem only support FormArray with FormGroup as items");
465
+ }
466
+ this.cdr.detectChanges();
467
+ }
468
+ static {
469
+ this.ɵfac = i0.ɵɵngDeclareFactory({
470
+ minVersion: "12.0.0",
471
+ version: "22.3.0",
472
+ ngImport: i0,
473
+ type: ForFormArrayItemsDirective,
474
+ deps: [],
475
+ target: i0.ɵɵFactoryTarget.Directive
476
+ });
477
+ }
478
+ static {
479
+ this.ɵdir = i0.ɵɵngDeclareDirective({
480
+ minVersion: "14.0.0",
481
+ version: "22.3.0",
482
+ type: ForFormArrayItemsDirective,
483
+ isStandalone: true,
484
+ selector: "[rxapForFormArrayItem]",
485
+ ngImport: i0
486
+ });
487
+ }
488
+ };
489
+ i0.ɵɵngDeclareClassMetadata({
490
+ minVersion: "12.0.0",
491
+ version: "22.3.0",
492
+ ngImport: i0,
493
+ type: ForFormArrayItemsDirective,
494
+ decorators: [{
495
+ type: Directive,
496
+ args: [{
497
+ selector: "[rxapForFormArrayItem]",
498
+ standalone: true
499
+ }]
500
+ }]
501
+ });
502
+ var FormArrayAddItemButtonDirective = class FormArrayAddItemButtonDirective {
503
+ constructor() {
504
+ this.parent = inject(ControlContainer, { skipSelf: true });
505
+ this.matButton = inject(MatButton, { optional: true });
506
+ this.type = "button";
507
+ }
508
+ get disabled() {
509
+ return this.isDisabled;
510
+ }
511
+ get isDisabled() {
512
+ return !!this.formArray?.disabled;
513
+ }
514
+ ngAfterViewInit() {
515
+ if (this.parent.control instanceof RxapFormArray) this.formArray = this.parent.control;
516
+ const matButton = this.matButton;
517
+ if (matButton) this._controlDisabledSubscription = this.formArray.disabled$.pipe(tap$1((isDisabled) => matButton.disabled = isDisabled)).subscribe();
518
+ }
519
+ ngOnDestroy() {
520
+ this._controlDisabledSubscription?.unsubscribe();
521
+ }
522
+ onClick() {
523
+ this.formArray.insertAt();
524
+ }
525
+ static {
526
+ this.ɵfac = i0.ɵɵngDeclareFactory({
527
+ minVersion: "12.0.0",
528
+ version: "22.3.0",
529
+ ngImport: i0,
530
+ type: FormArrayAddItemButtonDirective,
531
+ deps: [],
532
+ target: i0.ɵɵFactoryTarget.Directive
533
+ });
534
+ }
535
+ static {
536
+ this.ɵdir = i0.ɵɵngDeclareDirective({
537
+ minVersion: "14.0.0",
538
+ version: "22.3.0",
539
+ type: FormArrayAddItemButtonDirective,
540
+ isStandalone: true,
541
+ selector: "[rxapFormArrayItemAddButton]",
542
+ host: {
543
+ attributes: { "type": "button" },
544
+ listeners: { "click": "onClick()" },
545
+ properties: { "disabled": "disabled" }
546
+ },
547
+ ngImport: i0
548
+ });
549
+ }
550
+ };
551
+ i0.ɵɵngDeclareClassMetadata({
552
+ minVersion: "12.0.0",
553
+ version: "22.3.0",
554
+ ngImport: i0,
555
+ type: FormArrayAddItemButtonDirective,
556
+ decorators: [{
557
+ type: Directive,
558
+ args: [{
559
+ selector: "[rxapFormArrayItemAddButton]",
560
+ standalone: true,
561
+ host: {
562
+ "type": "button",
563
+ "[disabled]": "disabled",
564
+ "(click)": "onClick()"
565
+ }
566
+ }]
567
+ }]
568
+ });
569
+ var FormArrayItemButton = class FormArrayItemButton {
570
+ constructor() {
571
+ this.type = "button";
572
+ this.parent = inject(ControlContainer, { skipSelf: true });
573
+ this.matButton = inject(MatButton, { optional: true });
574
+ this.renderer = inject(Renderer2);
575
+ this.elementRef = inject(ElementRef);
576
+ }
577
+ get disabled() {
578
+ return this.isDisabled;
579
+ }
580
+ get isDeleted() {
581
+ return this.deletedControl.value;
582
+ }
583
+ get index() {
584
+ return this.formArray.controls.findIndex((control) => control === this.formGroup);
585
+ }
586
+ get isDisabled() {
587
+ return !!this.formGroup?.parent?.disabled;
588
+ }
589
+ ngAfterViewInit() {
590
+ if (this.parent.control instanceof RxapFormGroup) {
591
+ this.formGroup = this.parent.control;
592
+ if (this.formGroup.controls.deleted) {
593
+ if (this.formGroup.controls.deleted instanceof RxapFormControl) this.deletedControl = this.formGroup.controls.deleted;
594
+ else throw new Error(`The parent FormGroup instance does have a 'deleted' control, but it is not a RxapFormControl instance`);
595
+ } else {
596
+ this.deletedControl = new RxapFormControl(false, { controlId: "deleted" });
597
+ this.formGroup.addControl("deleted", this.deletedControl);
598
+ }
599
+ if (this.formGroup.parent instanceof RxapFormArray) this.formArray = this.formGroup.parent;
600
+ else throw new Error(`The parent of the FormGroup is not a RxapFormArray instance`);
601
+ } else throw new Error(`The parent is not a form group instance`);
602
+ const matButton = this.matButton;
603
+ if (matButton) this._controlDisabledSubscription = this.formGroup.disabled$.pipe(tap$1((isDisabled) => matButton.disabled = isDisabled)).subscribe();
604
+ this.deletedControl.value$.pipe(tap$1(() => this.updateDisplayStyle())).subscribe();
605
+ }
606
+ ngOnDestroy() {
607
+ this._controlDisabledSubscription?.unsubscribe();
608
+ this._deletedControlValueSubscription?.unsubscribe();
609
+ }
610
+ static {
611
+ this.ɵfac = i0.ɵɵngDeclareFactory({
612
+ minVersion: "12.0.0",
613
+ version: "22.3.0",
614
+ ngImport: i0,
615
+ type: FormArrayItemButton,
616
+ deps: [],
617
+ target: i0.ɵɵFactoryTarget.Directive
618
+ });
619
+ }
620
+ static {
621
+ this.ɵdir = i0.ɵɵngDeclareDirective({
622
+ minVersion: "14.0.0",
623
+ version: "22.3.0",
624
+ type: FormArrayItemButton,
625
+ isStandalone: true,
626
+ host: {
627
+ attributes: { "type": "button" },
628
+ listeners: { "click": "onClick()" },
629
+ properties: { "disabled": "disabled" }
630
+ },
631
+ ngImport: i0
632
+ });
633
+ }
634
+ };
635
+ i0.ɵɵngDeclareClassMetadata({
636
+ minVersion: "12.0.0",
637
+ version: "22.3.0",
638
+ ngImport: i0,
639
+ type: FormArrayItemButton,
640
+ decorators: [{
641
+ type: Directive,
642
+ args: [{ host: {
643
+ "type": "button",
644
+ "[disabled]": "disabled",
645
+ "(click)": "onClick()"
646
+ } }]
647
+ }]
648
+ });
649
+ var FormArrayItemRemoveButtonDirective = class FormArrayItemRemoveButtonDirective extends FormArrayItemButton {
650
+ constructor() {
651
+ super(...arguments);
652
+ this.shouldTemporarilyDeleted = input(() => false, ...ngDevMode ? [{ debugName: "shouldTemporarilyDeleted" }] : /* istanbul ignore next */ []);
653
+ }
654
+ onClick() {
655
+ if (this.shouldTemporarilyDeleted()(this.formGroup)) this.deletedControl.setValue(true);
656
+ else this.formArray.removeAt(this.index);
657
+ }
658
+ updateDisplayStyle() {
659
+ if (this.isDeleted) this.renderer.setStyle(this.elementRef.nativeElement, "display", "none");
660
+ else this.renderer.removeStyle(this.elementRef.nativeElement, "display");
661
+ }
662
+ static {
663
+ this.ɵfac = i0.ɵɵngDeclareFactory({
664
+ minVersion: "12.0.0",
665
+ version: "22.3.0",
666
+ ngImport: i0,
667
+ type: FormArrayItemRemoveButtonDirective,
668
+ deps: null,
669
+ target: i0.ɵɵFactoryTarget.Directive
670
+ });
671
+ }
672
+ static {
673
+ this.ɵdir = i0.ɵɵngDeclareDirective({
674
+ minVersion: "17.1.0",
675
+ version: "22.3.0",
676
+ type: FormArrayItemRemoveButtonDirective,
677
+ isStandalone: true,
678
+ selector: "button[rxapFormArrayItemRemoveButton]",
679
+ inputs: { shouldTemporarilyDeleted: {
680
+ classPropertyName: "shouldTemporarilyDeleted",
681
+ publicName: "shouldTemporarilyDeleted",
682
+ isSignal: true,
683
+ isRequired: false,
684
+ transformFunction: null
685
+ } },
686
+ usesInheritance: true,
687
+ ngImport: i0
688
+ });
689
+ }
690
+ };
691
+ i0.ɵɵngDeclareClassMetadata({
692
+ minVersion: "12.0.0",
693
+ version: "22.3.0",
694
+ ngImport: i0,
695
+ type: FormArrayItemRemoveButtonDirective,
696
+ decorators: [{
697
+ type: Directive,
698
+ args: [{
699
+ selector: "button[rxapFormArrayItemRemoveButton]",
700
+ standalone: true
701
+ }]
702
+ }],
703
+ propDecorators: { shouldTemporarilyDeleted: [{
704
+ type: i0.Input,
705
+ args: [{
706
+ isSignal: true,
707
+ alias: "shouldTemporarilyDeleted",
708
+ required: false
709
+ }]
710
+ }] }
711
+ });
712
+ var FormArrayItemRestoreButtonDirective = class FormArrayItemRestoreButtonDirective extends FormArrayItemButton {
713
+ onClick() {
714
+ this.formGroup.controls.deleted.setValue(false);
715
+ }
716
+ updateDisplayStyle() {
717
+ if (this.isDeleted) this.renderer.removeStyle(this.elementRef.nativeElement, "display");
718
+ else this.renderer.setStyle(this.elementRef.nativeElement, "display", "none");
719
+ }
720
+ static {
721
+ this.ɵfac = i0.ɵɵngDeclareFactory({
722
+ minVersion: "12.0.0",
723
+ version: "22.3.0",
724
+ ngImport: i0,
725
+ type: FormArrayItemRestoreButtonDirective,
726
+ deps: null,
727
+ target: i0.ɵɵFactoryTarget.Directive
728
+ });
729
+ }
730
+ static {
731
+ this.ɵdir = i0.ɵɵngDeclareDirective({
732
+ minVersion: "14.0.0",
733
+ version: "22.3.0",
734
+ type: FormArrayItemRestoreButtonDirective,
735
+ isStandalone: true,
736
+ selector: "button[rxapFormArrayItemRestoreButton]",
737
+ usesInheritance: true,
738
+ ngImport: i0
739
+ });
740
+ }
741
+ };
742
+ i0.ɵɵngDeclareClassMetadata({
743
+ minVersion: "12.0.0",
744
+ version: "22.3.0",
745
+ ngImport: i0,
746
+ type: FormArrayItemRestoreButtonDirective,
747
+ decorators: [{
748
+ type: Directive,
749
+ args: [{
750
+ selector: "button[rxapFormArrayItemRestoreButton]",
751
+ standalone: true
752
+ }]
753
+ }]
754
+ });
755
+ var FormArrayRemovableDirective = class FormArrayRemovableDirective {
756
+ constructor() {
757
+ this.parent = inject(ControlContainer);
758
+ }
759
+ get isDeleted() {
760
+ return this.deletedControl.value;
761
+ }
762
+ get isDisabled() {
763
+ return !!this.formGroup?.parent?.disabled;
764
+ }
765
+ ngAfterViewInit() {
766
+ if (this.parent.control instanceof RxapFormGroup) {
767
+ this.formGroup = this.parent.control;
768
+ if (this.formGroup.controls.deleted) {
769
+ if (this.formGroup.controls.deleted instanceof RxapFormControl) this.deletedControl = this.formGroup.controls.deleted;
770
+ else throw new Error(`The parent FormGroup instance does have a 'deleted' control, but it is not a RxapFormControl instance`);
771
+ } else {
772
+ this.deletedControl = new RxapFormControl(false, { controlId: "deleted" });
773
+ this.formGroup.addControl("deleted", this.deletedControl);
774
+ }
775
+ if (!(this.formGroup.parent instanceof UntypedFormArray)) throw new Error(`The parent of the FormGroup is not a FormArray instance`);
776
+ } else throw new Error(`The parent is not a form group instance`);
777
+ this._deletedControlValueSubscription = this.deletedControl.value$.pipe(tap$1((isDeleted) => {
778
+ for (const [name, control] of Object.entries(this.formGroup.controls)) if (name !== "deleted") {
779
+ if (isDeleted) control.disable({ onlySelf: true });
780
+ else if (!this.isDisabled) control.enable({ onlySelf: true });
781
+ }
782
+ })).subscribe();
783
+ }
784
+ ngOnDestroy() {
785
+ this._deletedControlValueSubscription?.unsubscribe();
786
+ }
787
+ static {
788
+ this.ɵfac = i0.ɵɵngDeclareFactory({
789
+ minVersion: "12.0.0",
790
+ version: "22.3.0",
791
+ ngImport: i0,
792
+ type: FormArrayRemovableDirective,
793
+ deps: [],
794
+ target: i0.ɵɵFactoryTarget.Directive
795
+ });
796
+ }
797
+ static {
798
+ this.ɵdir = i0.ɵɵngDeclareDirective({
799
+ minVersion: "14.0.0",
800
+ version: "22.3.0",
801
+ type: FormArrayRemovableDirective,
802
+ isStandalone: true,
803
+ selector: "[rxapFormArrayRemovable]",
804
+ ngImport: i0
805
+ });
806
+ }
807
+ };
808
+ i0.ɵɵngDeclareClassMetadata({
809
+ minVersion: "12.0.0",
810
+ version: "22.3.0",
811
+ ngImport: i0,
812
+ type: FormArrayRemovableDirective,
813
+ decorators: [{
814
+ type: Directive,
815
+ args: [{
816
+ selector: "[rxapFormArrayRemovable]",
817
+ standalone: true
818
+ }]
819
+ }]
820
+ });
776
821
  let AbstractOptionsFromMethodDirective = class AbstractOptionsFromMethodDirective {
777
- static ngTemplateContextGuard(dir, ctx) {
778
- return true;
779
- }
780
- constructor() {
781
- this.loading = signal(true, ...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
782
- /**
783
- * The method used to load the options. Defaults to the method defined with the input. If the
784
- * input is not set the method is extracted from the form definition.
785
- */
786
- this.optionsMethod = linkedSignal(() => this.method(), ...(ngDevMode ? [{ debugName: "optionsMethod" }] : /* istanbul ignore next */ []));
787
- this.options = null;
788
- this.ngControl = null;
789
- this.matFormField = null;
790
- this.settings = {};
791
- this.viewContainerRef = inject(ViewContainerRef);
792
- this.injector = inject(INJECTOR);
793
- this.cdr = inject(ChangeDetectorRef);
794
- this.template = inject(TemplateRef);
795
- this.initialized = signal(false, ...(ngDevMode ? [{ debugName: "initialized" }] : /* istanbul ignore next */ []));
796
- // load the options as soon as the directive is initialized and each time the parameters change
797
- effect(() => {
798
- const parameters = this.parameters();
799
- if (!this.initialized()) {
800
- return;
801
- }
802
- untracked(() => this.load(parameters));
803
- });
804
- }
805
- ngAfterViewInit() {
806
- this.matFormField = this.injector.get(MatFormField, null);
807
- this.ngControl = this.matFormField?._control.ngControl ?? this.injector.get(NgControl, null);
808
- this.control = this.ngControl?.control ?? undefined;
809
- if (!this.optionsMethod()) {
810
- this.optionsMethod.set(this.extractOptionsMethod());
811
- }
812
- this.initialized.set(true);
813
- }
814
- ngOnDestroy() {
815
- this._loadOptionsSubscription?.unsubscribe();
816
- }
817
- async loadOptions(parameters) {
818
- return this.optionsMethod().call(parameters, this.control);
819
- }
820
- renderTemplate() {
821
- if (!this.options) {
822
- throw new Error('The options are not yet loaded');
823
- }
824
- this.viewContainerRef.clear();
825
- for (const option of this.options) {
826
- this.viewContainerRef.createEmbeddedView(this.template, { $implicit: option });
827
- }
828
- const resetOnChange = untracked(this.resetOnChange);
829
- if (resetOnChange !== undefined) {
830
- this.control?.reset(resetOnChange);
831
- }
832
- this.cdr.detectChanges();
833
- }
834
- setOptions(options) {
835
- if (!options) {
836
- this.options = null;
837
- this.viewContainerRef.clear();
838
- }
839
- else {
840
- this.options = options.slice();
841
- this.renderTemplate();
842
- }
843
- }
844
- async load(parameters = untracked(this.parameters)) {
845
- this.loading.set(true);
846
- try {
847
- const result = await this.loadOptions(parameters);
848
- if (isObservable(result)) {
849
- this._loadOptionsSubscription?.unsubscribe();
850
- this._loadOptionsSubscription = result.pipe(tap$1(options => this.setOptions(options))).subscribe();
851
- }
852
- else {
853
- this.setOptions(result);
854
- }
855
- }
856
- finally {
857
- this.loading.set(false);
858
- }
859
- }
860
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AbstractOptionsFromMethodDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
861
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: AbstractOptionsFromMethodDirective, isStandalone: true, ngImport: i0 }); }
822
+ static ngTemplateContextGuard(dir, ctx) {
823
+ return true;
824
+ }
825
+ constructor() {
826
+ this.loading = signal(true, ...ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []);
827
+ this.optionsMethod = linkedSignal(() => this.method(), ...ngDevMode ? [{ debugName: "optionsMethod" }] : /* istanbul ignore next */ []);
828
+ this.options = null;
829
+ this.ngControl = null;
830
+ this.matFormField = null;
831
+ this.settings = {};
832
+ this.viewContainerRef = inject(ViewContainerRef);
833
+ this.injector = inject(INJECTOR);
834
+ this.cdr = inject(ChangeDetectorRef);
835
+ this.template = inject(TemplateRef);
836
+ this.initialized = signal(false, ...ngDevMode ? [{ debugName: "initialized" }] : /* istanbul ignore next */ []);
837
+ effect(() => {
838
+ const parameters = this.parameters();
839
+ if (!this.initialized()) return;
840
+ untracked(() => this.load(parameters));
841
+ });
842
+ }
843
+ ngAfterViewInit() {
844
+ this.matFormField = this.injector.get(MatFormField, null);
845
+ this.ngControl = this.matFormField?._control.ngControl ?? this.injector.get(NgControl, null);
846
+ this.control = this.ngControl?.control ?? void 0;
847
+ if (!this.optionsMethod()) this.optionsMethod.set(this.extractOptionsMethod());
848
+ this.initialized.set(true);
849
+ }
850
+ ngOnDestroy() {
851
+ this._loadOptionsSubscription?.unsubscribe();
852
+ }
853
+ async loadOptions(parameters) {
854
+ return this.optionsMethod().call(parameters, this.control);
855
+ }
856
+ renderTemplate() {
857
+ if (!this.options) throw new Error("The options are not yet loaded");
858
+ this.viewContainerRef.clear();
859
+ for (const option of this.options) this.viewContainerRef.createEmbeddedView(this.template, { $implicit: option });
860
+ const resetOnChange = untracked(this.resetOnChange);
861
+ if (resetOnChange !== void 0) this.control?.reset(resetOnChange);
862
+ this.cdr.detectChanges();
863
+ }
864
+ setOptions(options) {
865
+ if (!options) {
866
+ this.options = null;
867
+ this.viewContainerRef.clear();
868
+ } else {
869
+ this.options = options.slice();
870
+ this.renderTemplate();
871
+ }
872
+ }
873
+ async load(parameters = untracked(this.parameters)) {
874
+ this.loading.set(true);
875
+ try {
876
+ const result = await this.loadOptions(parameters);
877
+ if (isObservable(result)) {
878
+ this._loadOptionsSubscription?.unsubscribe();
879
+ this._loadOptionsSubscription = result.pipe(tap$1((options) => this.setOptions(options))).subscribe();
880
+ } else this.setOptions(result);
881
+ } finally {
882
+ this.loading.set(false);
883
+ }
884
+ }
885
+ static {
886
+ this.ɵfac = i0.ɵɵngDeclareFactory({
887
+ minVersion: "12.0.0",
888
+ version: "22.3.0",
889
+ ngImport: i0,
890
+ type: AbstractOptionsFromMethodDirective,
891
+ deps: [],
892
+ target: i0.ɵɵFactoryTarget.Directive
893
+ });
894
+ }
895
+ static {
896
+ this.ɵdir = i0.ɵɵngDeclareDirective({
897
+ minVersion: "14.0.0",
898
+ version: "22.3.0",
899
+ type: AbstractOptionsFromMethodDirective,
900
+ isStandalone: true,
901
+ ngImport: i0
902
+ });
903
+ }
862
904
  };
863
- AbstractOptionsFromMethodDirective = __decorate([
864
- Mixin(ExtractOptionsMethodMixin),
865
- __metadata("design:paramtypes", [])
866
- ], AbstractOptionsFromMethodDirective);
867
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AbstractOptionsFromMethodDirective, decorators: [{
868
- type: Directive
869
- }], ctorParameters: () => [] });
870
- class OptionsFromMethodDirective extends AbstractOptionsFromMethodDirective {
871
- constructor() {
872
- super(...arguments);
873
- this.parameters = input(undefined, { ...(ngDevMode ? { debugName: "parameters" } : /* istanbul ignore next */ {}), alias: 'rxapOptionsFromMethodParameters' });
874
- this.resetOnChange = input(undefined, { ...(ngDevMode ? { debugName: "resetOnChange" } : /* istanbul ignore next */ {}), alias: 'rxapOptionsFromMethodResetOnChange' });
875
- // eslint-disable-next-line @angular-eslint/no-input-rename
876
- this.method = input(undefined, { ...(ngDevMode ? { debugName: "method" } : /* istanbul ignore next */ {}), alias: 'rxapOptionsFromMethodCall' });
877
- }
878
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: OptionsFromMethodDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
879
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: OptionsFromMethodDirective, isStandalone: true, selector: "[rxapOptionsFromMethod]", inputs: { parameters: { classPropertyName: "parameters", publicName: "rxapOptionsFromMethodParameters", isSignal: true, isRequired: false, transformFunction: null }, resetOnChange: { classPropertyName: "resetOnChange", publicName: "rxapOptionsFromMethodResetOnChange", isSignal: true, isRequired: false, transformFunction: null }, method: { classPropertyName: "method", publicName: "rxapOptionsFromMethodCall", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["rxapOptionsFromMethod"], usesInheritance: true, ngImport: i0 }); }
880
- }
881
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: OptionsFromMethodDirective, decorators: [{
882
- type: Directive,
883
- args: [{
884
- // eslint-disable-next-line @angular-eslint/directive-selector
885
- selector: '[rxapOptionsFromMethod]',
886
- standalone: true,
887
- exportAs: 'rxapOptionsFromMethod',
888
- }]
889
- }], propDecorators: { parameters: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapOptionsFromMethodParameters", required: false }] }], resetOnChange: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapOptionsFromMethodResetOnChange", required: false }] }], method: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapOptionsFromMethodCall", required: false }] }] } });
890
-
905
+ AbstractOptionsFromMethodDirective = __decorate([Mixin(ExtractOptionsMethodMixin), __metadata("design:paramtypes", [])], AbstractOptionsFromMethodDirective);
906
+ i0.ɵɵngDeclareClassMetadata({
907
+ minVersion: "12.0.0",
908
+ version: "22.3.0",
909
+ ngImport: i0,
910
+ type: AbstractOptionsFromMethodDirective,
911
+ decorators: [{ type: Directive }],
912
+ ctorParameters: () => []
913
+ });
914
+ var OptionsFromMethodDirective = class OptionsFromMethodDirective extends AbstractOptionsFromMethodDirective {
915
+ constructor() {
916
+ super(...arguments);
917
+ this.parameters = input(void 0, {
918
+ ...ngDevMode ? { debugName: "parameters" } : /* istanbul ignore next */ {},
919
+ alias: "rxapOptionsFromMethodParameters"
920
+ });
921
+ this.resetOnChange = input(void 0, {
922
+ ...ngDevMode ? { debugName: "resetOnChange" } : /* istanbul ignore next */ {},
923
+ alias: "rxapOptionsFromMethodResetOnChange"
924
+ });
925
+ this.method = input(void 0, {
926
+ ...ngDevMode ? { debugName: "method" } : /* istanbul ignore next */ {},
927
+ alias: "rxapOptionsFromMethodCall"
928
+ });
929
+ }
930
+ static {
931
+ this.ɵfac = i0.ɵɵngDeclareFactory({
932
+ minVersion: "12.0.0",
933
+ version: "22.3.0",
934
+ ngImport: i0,
935
+ type: OptionsFromMethodDirective,
936
+ deps: null,
937
+ target: i0.ɵɵFactoryTarget.Directive
938
+ });
939
+ }
940
+ static {
941
+ this.ɵdir = i0.ɵɵngDeclareDirective({
942
+ minVersion: "17.1.0",
943
+ version: "22.3.0",
944
+ type: OptionsFromMethodDirective,
945
+ isStandalone: true,
946
+ selector: "[rxapOptionsFromMethod]",
947
+ inputs: {
948
+ parameters: {
949
+ classPropertyName: "parameters",
950
+ publicName: "rxapOptionsFromMethodParameters",
951
+ isSignal: true,
952
+ isRequired: false,
953
+ transformFunction: null
954
+ },
955
+ resetOnChange: {
956
+ classPropertyName: "resetOnChange",
957
+ publicName: "rxapOptionsFromMethodResetOnChange",
958
+ isSignal: true,
959
+ isRequired: false,
960
+ transformFunction: null
961
+ },
962
+ method: {
963
+ classPropertyName: "method",
964
+ publicName: "rxapOptionsFromMethodCall",
965
+ isSignal: true,
966
+ isRequired: false,
967
+ transformFunction: null
968
+ }
969
+ },
970
+ exportAs: ["rxapOptionsFromMethod"],
971
+ usesInheritance: true,
972
+ ngImport: i0
973
+ });
974
+ }
975
+ };
976
+ i0.ɵɵngDeclareClassMetadata({
977
+ minVersion: "12.0.0",
978
+ version: "22.3.0",
979
+ ngImport: i0,
980
+ type: OptionsFromMethodDirective,
981
+ decorators: [{
982
+ type: Directive,
983
+ args: [{
984
+ selector: "[rxapOptionsFromMethod]",
985
+ standalone: true,
986
+ exportAs: "rxapOptionsFromMethod"
987
+ }]
988
+ }],
989
+ propDecorators: {
990
+ parameters: [{
991
+ type: i0.Input,
992
+ args: [{
993
+ isSignal: true,
994
+ alias: "rxapOptionsFromMethodParameters",
995
+ required: false
996
+ }]
997
+ }],
998
+ resetOnChange: [{
999
+ type: i0.Input,
1000
+ args: [{
1001
+ isSignal: true,
1002
+ alias: "rxapOptionsFromMethodResetOnChange",
1003
+ required: false
1004
+ }]
1005
+ }],
1006
+ method: [{
1007
+ type: i0.Input,
1008
+ args: [{
1009
+ isSignal: true,
1010
+ alias: "rxapOptionsFromMethodCall",
1011
+ required: false
1012
+ }]
1013
+ }]
1014
+ }
1015
+ });
891
1016
  function UseAutocompleteOptionsMethod(method, config = {}) {
892
- config.adapter ??= {};
893
- config.adapter.parameter ??= (parameters) => ({ parameters });
894
- return UseOptionsMethod(method, config);
1017
+ config.adapter ??= {};
1018
+ config.adapter.parameter ??= (parameters) => ({ parameters });
1019
+ return UseOptionsMethod(method, config);
895
1020
  }
896
1021
  function UseAutocompleteResolveMethod(method, config = {}) {
897
- config.adapter ??= {};
898
- config.adapter.parameter ??= (parameters) => ({ parameters });
899
- return UseResolveMethod(method, config);
1022
+ config.adapter ??= {};
1023
+ config.adapter.parameter ??= (parameters) => ({ parameters });
1024
+ return UseResolveMethod(method, config);
900
1025
  }
901
1026
  function UseAutocompleteIsValueFunction(isValue) {
902
- return UseIsValueFunction(isValue);
1027
+ return UseIsValueFunction(isValue);
903
1028
  }
904
1029
  function UseAutocompleteToDisplayFunction(toDisplay) {
905
- return UseToDisplayFunction(toDisplay);
906
- }
907
- class NoopResolveMethod {
908
- call({ value }) {
909
- return Promise.resolve({ value, display: value + '' });
910
- }
911
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: NoopResolveMethod, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
912
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: NoopResolveMethod, providedIn: 'root' }); }
1030
+ return UseToDisplayFunction(toDisplay);
913
1031
  }
914
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: NoopResolveMethod, decorators: [{
915
- type: Injectable,
916
- args: [{ providedIn: 'root' }]
917
- }] });
1032
+ var NoopResolveMethod = class NoopResolveMethod {
1033
+ call({ value }) {
1034
+ return Promise.resolve({
1035
+ value,
1036
+ display: value + ""
1037
+ });
1038
+ }
1039
+ static {
1040
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1041
+ minVersion: "12.0.0",
1042
+ version: "22.3.0",
1043
+ ngImport: i0,
1044
+ type: NoopResolveMethod,
1045
+ deps: [],
1046
+ target: i0.ɵɵFactoryTarget.Injectable
1047
+ });
1048
+ }
1049
+ static {
1050
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
1051
+ minVersion: "12.0.0",
1052
+ version: "22.3.0",
1053
+ ngImport: i0,
1054
+ type: NoopResolveMethod,
1055
+ providedIn: "root"
1056
+ });
1057
+ }
1058
+ };
1059
+ i0.ɵɵngDeclareClassMetadata({
1060
+ minVersion: "12.0.0",
1061
+ version: "22.3.0",
1062
+ ngImport: i0,
1063
+ type: NoopResolveMethod,
1064
+ decorators: [{
1065
+ type: Injectable,
1066
+ args: [{ providedIn: "root" }]
1067
+ }]
1068
+ });
918
1069
  let AutocompleteOptionsFromMethodDirective = class AutocompleteOptionsFromMethodDirective extends AbstractOptionsFromMethodDirective {
919
- constructor() {
920
- super(...arguments);
921
- this.parameters = input(undefined, { ...(ngDevMode ? { debugName: "parameters" } : /* istanbul ignore next */ {}), alias: 'rxapAutocompleteOptionsFromMethodParameters' });
922
- this.resetOnChange = input(undefined, { ...(ngDevMode ? { debugName: "resetOnChange" } : /* istanbul ignore next */ {}), alias: 'rxapAutocompleteOptionsFromMethodResetOnChange' });
923
- this.matAutocomplete = input(undefined, { ...(ngDevMode ? { debugName: "matAutocomplete" } : /* istanbul ignore next */ {}), alias: 'rxapAutocompleteOptionsFromMethodMatAutocomplete' });
924
- // eslint-disable-next-line @angular-eslint/no-input-rename
925
- this.method = input(undefined, { ...(ngDevMode ? { debugName: "method" } : /* istanbul ignore next */ {}), alias: 'rxapAutocompleteOptionsFromMethodCall' });
926
- // eslint-disable-next-line @angular-eslint/no-input-rename
927
- this.resolveMethod = input(undefined, { ...(ngDevMode ? { debugName: "resolveMethod" } : /* istanbul ignore next */ {}), alias: 'rxapAutocompleteOptionsFromMethodResolve' });
928
- this.isValue = input(undefined, { ...(ngDevMode ? { debugName: "isValue" } : /* istanbul ignore next */ {}), alias: 'rxapAutocompleteOptionsFromMethodIsValue' });
929
- this.toDisplay = input(undefined, { ...(ngDevMode ? { debugName: "toDisplay" } : /* istanbul ignore next */ {}), alias: 'rxapAutocompleteOptionsFromMethodToDisplay' });
930
- this.resolvedResolveMethod = linkedSignal(() => this.resolveMethod(), ...(ngDevMode ? [{ debugName: "resolvedResolveMethod" }] : /* istanbul ignore next */ []));
931
- this.resolvedIsValue = linkedSignal(() => this.isValue(), ...(ngDevMode ? [{ debugName: "resolvedIsValue" }] : /* istanbul ignore next */ []));
932
- this.resolvedToDisplay = linkedSignal(() => this.toDisplay(), ...(ngDevMode ? [{ debugName: "resolvedToDisplay" }] : /* istanbul ignore next */ []));
933
- this.ngControl = null;
934
- this.matFormField = null;
935
- this.injector = inject(INJECTOR);
936
- this.settings = {};
937
- /**
938
- * This flag is used to prevent the setValue is called for each refresh
939
- * of the options list. This is needed because the setValue method will
940
- * trigger a new refresh of the options list. This results in an endless
941
- * call stack. This flag is set to true if the setValue method is called
942
- * once.
943
- */
944
- this.isAutocompleteToDisplayTriggered = false;
945
- }
946
- static ngTemplateContextGuard(dir, ctx) {
947
- return true;
948
- }
949
- ngOnDestroy() {
950
- super.ngOnDestroy();
951
- this._subscription?.unsubscribe();
952
- }
953
- ngAfterViewInit() {
954
- const matAutocomplete = this.matAutocomplete();
955
- if (matAutocomplete) {
956
- this.settings ??= {};
957
- this.settings.filteredOptions ??= true;
958
- }
959
- super.ngAfterViewInit();
960
- if (!this.resolvedResolveMethod()) {
961
- this.resolvedResolveMethod.set(this.extractResolveMethod());
962
- }
963
- if (!this.resolvedIsValue()) {
964
- this.resolvedIsValue.set(this.extractIsValueFunction((value) => typeof value === 'string' && isUUID(value)));
965
- }
966
- if (!this.resolvedToDisplay()) {
967
- this.resolvedToDisplay.set(this.extractToDisplayFunction((value) => {
968
- if (!value) {
969
- return '';
970
- }
971
- const option = this.findOptionByValue(value);
972
- return option?.display ?? (isDevMode() ? 'to display error' : '...');
973
- }));
974
- }
975
- if (matAutocomplete) {
976
- matAutocomplete.displayWith = this.resolvedToDisplay().bind(this);
977
- }
978
- if (!this.control) {
979
- throw new Error('The control is not yet defined');
980
- }
981
- const value$ = controlValueChanges$(this.control);
982
- this._subscription = value$.pipe(isDefined(),
983
- // only trigger the load options or resolve value if the value is changed
984
- // this is required because in the resolveValue method the control value is set
985
- // to trigger the toDisplay function in the mat-autocomplete
986
- distinctUntilChanged(), tap$1(async (value) => {
987
- await this.load(untracked(this.parameters));
988
- if (this.resolvedIsValue()?.(value)) {
989
- this.triggerAutocompleteToDisplay();
990
- }
991
- })).subscribe();
992
- }
993
- loadOptions(parameters = {}) {
994
- if (!this.control) {
995
- throw new Error('The control is not yet defined');
996
- }
997
- const value = this.control?.value;
998
- const c_parameters = { ...parameters };
999
- if (this.resolvedIsValue()?.(value)) {
1000
- return this.resolveValue(value, c_parameters);
1001
- }
1002
- else {
1003
- c_parameters.search ??= value;
1004
- if (!c_parameters.search) {
1005
- return Promise.resolve([]);
1006
- }
1007
- return super.loadOptions(c_parameters);
1008
- }
1009
- }
1010
- renderTemplate() {
1011
- super.renderTemplate();
1012
- if (this.matAutocomplete() && !this.isAutocompleteToDisplayTriggered) {
1013
- this.isAutocompleteToDisplayTriggered = true;
1014
- this.triggerAutocompleteToDisplay();
1015
- }
1016
- }
1017
- async resolveValue(value, parameters = {}) {
1018
- const resolveMethod = this.resolvedResolveMethod();
1019
- if (!resolveMethod) {
1020
- if (isDevMode()) {
1021
- console.warn('The resolve method is not yet defined');
1022
- }
1023
- return null;
1024
- }
1025
- // only resolve the value if the option is not already loaded
1026
- if (!this.findOptionByValue(value)) {
1027
- const option = await resolveMethod.call({ ...parameters, value });
1028
- if (option.value !== value) {
1029
- throw new Error('The resolved value is not the same as the input value');
1030
- }
1031
- return [option];
1032
- }
1033
- return this.options;
1034
- }
1035
- triggerAutocompleteToDisplay() {
1036
- // trigger a change detection after the options are rendered
1037
- // this is needed to trigger the mat-autocomplete options to display function
1038
- this.ngControl?.control?.setValue(this.ngControl?.control?.value);
1039
- }
1040
- findOptionByValue(value) {
1041
- return this.options?.find((option) => option.value === value) ?? null;
1042
- }
1043
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AutocompleteOptionsFromMethodDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
1044
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: AutocompleteOptionsFromMethodDirective, isStandalone: true, selector: "[rxapAutocompleteOptionsFromMethod]", inputs: { parameters: { classPropertyName: "parameters", publicName: "rxapAutocompleteOptionsFromMethodParameters", isSignal: true, isRequired: false, transformFunction: null }, resetOnChange: { classPropertyName: "resetOnChange", publicName: "rxapAutocompleteOptionsFromMethodResetOnChange", isSignal: true, isRequired: false, transformFunction: null }, matAutocomplete: { classPropertyName: "matAutocomplete", publicName: "rxapAutocompleteOptionsFromMethodMatAutocomplete", isSignal: true, isRequired: false, transformFunction: null }, method: { classPropertyName: "method", publicName: "rxapAutocompleteOptionsFromMethodCall", isSignal: true, isRequired: false, transformFunction: null }, resolveMethod: { classPropertyName: "resolveMethod", publicName: "rxapAutocompleteOptionsFromMethodResolve", isSignal: true, isRequired: false, transformFunction: null }, isValue: { classPropertyName: "isValue", publicName: "rxapAutocompleteOptionsFromMethodIsValue", isSignal: true, isRequired: false, transformFunction: null }, toDisplay: { classPropertyName: "toDisplay", publicName: "rxapAutocompleteOptionsFromMethodToDisplay", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0 }); }
1070
+ constructor() {
1071
+ super(...arguments);
1072
+ this.parameters = input(void 0, {
1073
+ ...ngDevMode ? { debugName: "parameters" } : /* istanbul ignore next */ {},
1074
+ alias: "rxapAutocompleteOptionsFromMethodParameters"
1075
+ });
1076
+ this.resetOnChange = input(void 0, {
1077
+ ...ngDevMode ? { debugName: "resetOnChange" } : /* istanbul ignore next */ {},
1078
+ alias: "rxapAutocompleteOptionsFromMethodResetOnChange"
1079
+ });
1080
+ this.matAutocomplete = input(void 0, {
1081
+ ...ngDevMode ? { debugName: "matAutocomplete" } : /* istanbul ignore next */ {},
1082
+ alias: "rxapAutocompleteOptionsFromMethodMatAutocomplete"
1083
+ });
1084
+ this.method = input(void 0, {
1085
+ ...ngDevMode ? { debugName: "method" } : /* istanbul ignore next */ {},
1086
+ alias: "rxapAutocompleteOptionsFromMethodCall"
1087
+ });
1088
+ this.resolveMethod = input(void 0, {
1089
+ ...ngDevMode ? { debugName: "resolveMethod" } : /* istanbul ignore next */ {},
1090
+ alias: "rxapAutocompleteOptionsFromMethodResolve"
1091
+ });
1092
+ this.isValue = input(void 0, {
1093
+ ...ngDevMode ? { debugName: "isValue" } : /* istanbul ignore next */ {},
1094
+ alias: "rxapAutocompleteOptionsFromMethodIsValue"
1095
+ });
1096
+ this.toDisplay = input(void 0, {
1097
+ ...ngDevMode ? { debugName: "toDisplay" } : /* istanbul ignore next */ {},
1098
+ alias: "rxapAutocompleteOptionsFromMethodToDisplay"
1099
+ });
1100
+ this.resolvedResolveMethod = linkedSignal(() => this.resolveMethod(), ...ngDevMode ? [{ debugName: "resolvedResolveMethod" }] : /* istanbul ignore next */ []);
1101
+ this.resolvedIsValue = linkedSignal(() => this.isValue(), ...ngDevMode ? [{ debugName: "resolvedIsValue" }] : /* istanbul ignore next */ []);
1102
+ this.resolvedToDisplay = linkedSignal(() => this.toDisplay(), ...ngDevMode ? [{ debugName: "resolvedToDisplay" }] : /* istanbul ignore next */ []);
1103
+ this.ngControl = null;
1104
+ this.matFormField = null;
1105
+ this.injector = inject(INJECTOR);
1106
+ this.settings = {};
1107
+ this.isAutocompleteToDisplayTriggered = false;
1108
+ }
1109
+ static ngTemplateContextGuard(dir, ctx) {
1110
+ return true;
1111
+ }
1112
+ ngOnDestroy() {
1113
+ super.ngOnDestroy();
1114
+ this._subscription?.unsubscribe();
1115
+ }
1116
+ ngAfterViewInit() {
1117
+ const matAutocomplete = this.matAutocomplete();
1118
+ if (matAutocomplete) {
1119
+ this.settings ??= {};
1120
+ this.settings.filteredOptions ??= true;
1121
+ }
1122
+ super.ngAfterViewInit();
1123
+ if (!this.resolvedResolveMethod()) this.resolvedResolveMethod.set(this.extractResolveMethod());
1124
+ if (!this.resolvedIsValue()) this.resolvedIsValue.set(this.extractIsValueFunction((value) => typeof value === "string" && isUUID(value)));
1125
+ if (!this.resolvedToDisplay()) this.resolvedToDisplay.set(this.extractToDisplayFunction((value) => {
1126
+ if (!value) return "";
1127
+ return this.findOptionByValue(value)?.display ?? (isDevMode() ? "to display error" : "...");
1128
+ }));
1129
+ if (matAutocomplete) matAutocomplete.displayWith = this.resolvedToDisplay().bind(this);
1130
+ if (!this.control) throw new Error("The control is not yet defined");
1131
+ const value$ = controlValueChanges$(this.control);
1132
+ this._subscription = value$.pipe(isDefined(), distinctUntilChanged$1(), tap$1(async (value) => {
1133
+ await this.load(untracked(this.parameters));
1134
+ if (this.resolvedIsValue()?.(value)) this.triggerAutocompleteToDisplay();
1135
+ })).subscribe();
1136
+ }
1137
+ loadOptions(parameters = {}) {
1138
+ if (!this.control) throw new Error("The control is not yet defined");
1139
+ const value = this.control?.value;
1140
+ const c_parameters = { ...parameters };
1141
+ if (this.resolvedIsValue()?.(value)) return this.resolveValue(value, c_parameters);
1142
+ else {
1143
+ c_parameters.search ??= value;
1144
+ if (!c_parameters.search) return Promise.resolve([]);
1145
+ return super.loadOptions(c_parameters);
1146
+ }
1147
+ }
1148
+ renderTemplate() {
1149
+ super.renderTemplate();
1150
+ if (this.matAutocomplete() && !this.isAutocompleteToDisplayTriggered) {
1151
+ this.isAutocompleteToDisplayTriggered = true;
1152
+ this.triggerAutocompleteToDisplay();
1153
+ }
1154
+ }
1155
+ async resolveValue(value, parameters = {}) {
1156
+ const resolveMethod = this.resolvedResolveMethod();
1157
+ if (!resolveMethod) {
1158
+ if (isDevMode()) console.warn("The resolve method is not yet defined");
1159
+ return null;
1160
+ }
1161
+ if (!this.findOptionByValue(value)) {
1162
+ const option = await resolveMethod.call({
1163
+ ...parameters,
1164
+ value
1165
+ });
1166
+ if (option.value !== value) throw new Error("The resolved value is not the same as the input value");
1167
+ return [option];
1168
+ }
1169
+ return this.options;
1170
+ }
1171
+ triggerAutocompleteToDisplay() {
1172
+ this.ngControl?.control?.setValue(this.ngControl?.control?.value);
1173
+ }
1174
+ findOptionByValue(value) {
1175
+ return this.options?.find((option) => option.value === value) ?? null;
1176
+ }
1177
+ static {
1178
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1179
+ minVersion: "12.0.0",
1180
+ version: "22.3.0",
1181
+ ngImport: i0,
1182
+ type: AutocompleteOptionsFromMethodDirective,
1183
+ deps: null,
1184
+ target: i0.ɵɵFactoryTarget.Directive
1185
+ });
1186
+ }
1187
+ static {
1188
+ this.ɵdir = i0.ɵɵngDeclareDirective({
1189
+ minVersion: "17.1.0",
1190
+ version: "22.3.0",
1191
+ type: AutocompleteOptionsFromMethodDirective,
1192
+ isStandalone: true,
1193
+ selector: "[rxapAutocompleteOptionsFromMethod]",
1194
+ inputs: {
1195
+ parameters: {
1196
+ classPropertyName: "parameters",
1197
+ publicName: "rxapAutocompleteOptionsFromMethodParameters",
1198
+ isSignal: true,
1199
+ isRequired: false,
1200
+ transformFunction: null
1201
+ },
1202
+ resetOnChange: {
1203
+ classPropertyName: "resetOnChange",
1204
+ publicName: "rxapAutocompleteOptionsFromMethodResetOnChange",
1205
+ isSignal: true,
1206
+ isRequired: false,
1207
+ transformFunction: null
1208
+ },
1209
+ matAutocomplete: {
1210
+ classPropertyName: "matAutocomplete",
1211
+ publicName: "rxapAutocompleteOptionsFromMethodMatAutocomplete",
1212
+ isSignal: true,
1213
+ isRequired: false,
1214
+ transformFunction: null
1215
+ },
1216
+ method: {
1217
+ classPropertyName: "method",
1218
+ publicName: "rxapAutocompleteOptionsFromMethodCall",
1219
+ isSignal: true,
1220
+ isRequired: false,
1221
+ transformFunction: null
1222
+ },
1223
+ resolveMethod: {
1224
+ classPropertyName: "resolveMethod",
1225
+ publicName: "rxapAutocompleteOptionsFromMethodResolve",
1226
+ isSignal: true,
1227
+ isRequired: false,
1228
+ transformFunction: null
1229
+ },
1230
+ isValue: {
1231
+ classPropertyName: "isValue",
1232
+ publicName: "rxapAutocompleteOptionsFromMethodIsValue",
1233
+ isSignal: true,
1234
+ isRequired: false,
1235
+ transformFunction: null
1236
+ },
1237
+ toDisplay: {
1238
+ classPropertyName: "toDisplay",
1239
+ publicName: "rxapAutocompleteOptionsFromMethodToDisplay",
1240
+ isSignal: true,
1241
+ isRequired: false,
1242
+ transformFunction: null
1243
+ }
1244
+ },
1245
+ usesInheritance: true,
1246
+ ngImport: i0
1247
+ });
1248
+ }
1045
1249
  };
1046
- AutocompleteOptionsFromMethodDirective = __decorate([
1047
- Mixin(ExtractResolveMethodMixin, ExtractIsValueFunctionMixin, ExtractToDisplayFunctionMixin)
1048
- ], AutocompleteOptionsFromMethodDirective);
1049
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AutocompleteOptionsFromMethodDirective, decorators: [{
1050
- type: Directive,
1051
- args: [{
1052
- // eslint-disable-next-line @angular-eslint/directive-selector
1053
- selector: '[rxapAutocompleteOptionsFromMethod]',
1054
- standalone: true,
1055
- }]
1056
- }], propDecorators: { parameters: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapAutocompleteOptionsFromMethodParameters", required: false }] }], resetOnChange: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapAutocompleteOptionsFromMethodResetOnChange", required: false }] }], matAutocomplete: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapAutocompleteOptionsFromMethodMatAutocomplete", required: false }] }], method: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapAutocompleteOptionsFromMethodCall", required: false }] }], resolveMethod: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapAutocompleteOptionsFromMethodResolve", required: false }] }], isValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapAutocompleteOptionsFromMethodIsValue", required: false }] }], toDisplay: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapAutocompleteOptionsFromMethodToDisplay", required: false }] }] } });
1057
-
1058
- const RXAP_FORM_SYSTEM_SHOW_METADATA = 'rxap/form-system/show-function';
1059
- const RXAP_FORM_SYSTEM_HIDE_METADATA = 'rxap/form-system/hide-function';
1060
- const RXAP_FORM_SYSTEM_HIDE_SHOW_OPTIONS = 'rxap/form-system/hide-show-options';
1250
+ AutocompleteOptionsFromMethodDirective = __decorate([Mixin(ExtractResolveMethodMixin, ExtractIsValueFunctionMixin, ExtractToDisplayFunctionMixin)], AutocompleteOptionsFromMethodDirective);
1251
+ i0.ɵɵngDeclareClassMetadata({
1252
+ minVersion: "12.0.0",
1253
+ version: "22.3.0",
1254
+ ngImport: i0,
1255
+ type: AutocompleteOptionsFromMethodDirective,
1256
+ decorators: [{
1257
+ type: Directive,
1258
+ args: [{
1259
+ selector: "[rxapAutocompleteOptionsFromMethod]",
1260
+ standalone: true
1261
+ }]
1262
+ }],
1263
+ propDecorators: {
1264
+ parameters: [{
1265
+ type: i0.Input,
1266
+ args: [{
1267
+ isSignal: true,
1268
+ alias: "rxapAutocompleteOptionsFromMethodParameters",
1269
+ required: false
1270
+ }]
1271
+ }],
1272
+ resetOnChange: [{
1273
+ type: i0.Input,
1274
+ args: [{
1275
+ isSignal: true,
1276
+ alias: "rxapAutocompleteOptionsFromMethodResetOnChange",
1277
+ required: false
1278
+ }]
1279
+ }],
1280
+ matAutocomplete: [{
1281
+ type: i0.Input,
1282
+ args: [{
1283
+ isSignal: true,
1284
+ alias: "rxapAutocompleteOptionsFromMethodMatAutocomplete",
1285
+ required: false
1286
+ }]
1287
+ }],
1288
+ method: [{
1289
+ type: i0.Input,
1290
+ args: [{
1291
+ isSignal: true,
1292
+ alias: "rxapAutocompleteOptionsFromMethodCall",
1293
+ required: false
1294
+ }]
1295
+ }],
1296
+ resolveMethod: [{
1297
+ type: i0.Input,
1298
+ args: [{
1299
+ isSignal: true,
1300
+ alias: "rxapAutocompleteOptionsFromMethodResolve",
1301
+ required: false
1302
+ }]
1303
+ }],
1304
+ isValue: [{
1305
+ type: i0.Input,
1306
+ args: [{
1307
+ isSignal: true,
1308
+ alias: "rxapAutocompleteOptionsFromMethodIsValue",
1309
+ required: false
1310
+ }]
1311
+ }],
1312
+ toDisplay: [{
1313
+ type: i0.Input,
1314
+ args: [{
1315
+ isSignal: true,
1316
+ alias: "rxapAutocompleteOptionsFromMethodToDisplay",
1317
+ required: false
1318
+ }]
1319
+ }]
1320
+ }
1321
+ });
1322
+ const RXAP_FORM_SYSTEM_SHOW_METADATA = "rxap/form-system/show-function";
1323
+ const RXAP_FORM_SYSTEM_HIDE_METADATA = "rxap/form-system/hide-function";
1324
+ const RXAP_FORM_SYSTEM_HIDE_SHOW_OPTIONS = "rxap/form-system/hide-show-options";
1061
1325
  function UseHideFunction(hideFunction, options = {}) {
1062
- return function (target, propertyKey) {
1063
- setMetadataMap(propertyKey, hideFunction, RXAP_FORM_SYSTEM_HIDE_METADATA, target);
1064
- if (Object.keys(options).length) {
1065
- setMetadataMap(propertyKey, options, RXAP_FORM_SYSTEM_HIDE_SHOW_OPTIONS, target);
1066
- }
1067
- };
1326
+ return function(target, propertyKey) {
1327
+ setMetadataMap(propertyKey, hideFunction, RXAP_FORM_SYSTEM_HIDE_METADATA, target);
1328
+ if (Object.keys(options).length) setMetadataMap(propertyKey, options, RXAP_FORM_SYSTEM_HIDE_SHOW_OPTIONS, target);
1329
+ };
1068
1330
  }
1069
1331
  function UseShowFunction(showFunction, options = {}) {
1070
- return function (target, propertyKey) {
1071
- setMetadataMap(propertyKey, showFunction, RXAP_FORM_SYSTEM_SHOW_METADATA, target);
1072
- if (Object.keys(options).length) {
1073
- setMetadataMap(propertyKey, options, RXAP_FORM_SYSTEM_HIDE_SHOW_OPTIONS, target);
1074
- }
1075
- };
1332
+ return function(target, propertyKey) {
1333
+ setMetadataMap(propertyKey, showFunction, RXAP_FORM_SYSTEM_SHOW_METADATA, target);
1334
+ if (Object.keys(options).length) setMetadataMap(propertyKey, options, RXAP_FORM_SYSTEM_HIDE_SHOW_OPTIONS, target);
1335
+ };
1076
1336
  }
1077
1337
  let ControlHideShowDirective = class ControlHideShowDirective {
1078
- constructor() {
1079
- this.renderer = inject(Renderer2);
1080
- this.elementRef = inject(ElementRef);
1081
- this.parent = inject(ControlContainer, { optional: true });
1082
- this.ngControl = inject(NgControl, { self: true, optional: true });
1083
- this.controlId = input(undefined, { ...(ngDevMode ? { debugName: "controlId" } : /* istanbul ignore next */ {}), alias: "rxapControlHideShow" });
1084
- this.subscription = new Subscription();
1085
- }
1086
- ngOnInit() {
1087
- if (!this.ngControl && !this.parent) {
1088
- throw new Error('Easier the ControlContainer or NgControl must be injectable');
1089
- }
1090
- const controlId = this.controlId();
1091
- if (!this.ngControl && !controlId) {
1092
- throw new Error('If the NgControl is not injectable then the control id must be defined!');
1093
- }
1094
- const control = this.ngControl?.control ?? this.extractControlFromParent(this.parent, controlId);
1095
- if (!(control instanceof RxapFormControl)) {
1096
- throw new Error('The control is not an instance of RxapFormControl');
1097
- }
1098
- this.control = control;
1099
- const formDefinition = this.extractFormDefinition(control);
1100
- const hideFunction = this.extractHideFunction(formDefinition);
1101
- const showFunction = this.extractShowFunction(formDefinition);
1102
- const options = this.extractOptions(formDefinition);
1103
- let changeTrigger = formDefinition.rxapFormGroup.valueChanges;
1104
- if (options.rootChange) {
1105
- changeTrigger = formDefinition.rxapFormGroup.root.valueChanges;
1106
- }
1107
- changeTrigger = changeTrigger.pipe(startWith$1(null));
1108
- if (showFunction) {
1109
- this.subscription.add(changeTrigger.pipe(tap(() => {
1110
- // TODO : resubscribe if the showFunction throws an error
1111
- const show = showFunction.call(formDefinition, control);
1112
- switch (show) {
1113
- case true:
1114
- this.show();
1115
- break;
1116
- case false:
1117
- this.hide();
1118
- break;
1119
- case null:
1120
- this.reset();
1121
- break;
1122
- }
1123
- }), catchError(err => {
1124
- console.error(err);
1125
- return of(null);
1126
- })).subscribe());
1127
- }
1128
- if (hideFunction) {
1129
- this.subscription.add(changeTrigger.pipe(tap(() => {
1130
- // TODO : resubscribe if the hideFunction throws an error
1131
- const hide = hideFunction.call(formDefinition, control);
1132
- switch (hide) {
1133
- case true:
1134
- this.hide();
1135
- break;
1136
- case false:
1137
- this.show();
1138
- break;
1139
- case null:
1140
- this.reset();
1141
- break;
1142
- }
1143
- }), catchError(err => {
1144
- console.error(err);
1145
- return of(null);
1146
- })).subscribe());
1147
- }
1148
- }
1149
- ngOnDestroy() {
1150
- this.subscription.unsubscribe();
1151
- }
1152
- extractOptions(formDefinition) {
1153
- const map = getMetadata(RXAP_FORM_SYSTEM_HIDE_SHOW_OPTIONS, Object.getPrototypeOf(formDefinition)) ?? null;
1154
- if (!map || !map.has(this.control.controlId)) {
1155
- return {};
1156
- }
1157
- return map.get(this.control.controlId);
1158
- }
1159
- extractHideFunction(formDefinition) {
1160
- const map = getMetadata(RXAP_FORM_SYSTEM_HIDE_METADATA, Object.getPrototypeOf(formDefinition)) ?? null;
1161
- if (!map || !map.has(this.control.controlId)) {
1162
- return null;
1163
- }
1164
- return map.get(this.control.controlId);
1165
- }
1166
- extractShowFunction(formDefinition) {
1167
- const map = getMetadata(RXAP_FORM_SYSTEM_SHOW_METADATA, Object.getPrototypeOf(formDefinition)) ?? null;
1168
- if (!map || !map.has(this.control.controlId)) {
1169
- return null;
1170
- }
1171
- return map.get(this.control.controlId);
1172
- }
1173
- hide() {
1174
- this.renderer.setStyle(this.elementRef.nativeElement, 'display', 'none');
1175
- }
1176
- show() {
1177
- this.renderer.setStyle(this.elementRef.nativeElement, 'display', 'block');
1178
- }
1179
- reset() {
1180
- this.renderer.removeStyle(this.elementRef.nativeElement, 'display');
1181
- }
1182
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: ControlHideShowDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1183
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: ControlHideShowDirective, isStandalone: true, selector: "[rxapControlHideShow]", inputs: { controlId: { classPropertyName: "controlId", publicName: "rxapControlHideShow", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
1338
+ constructor() {
1339
+ this.renderer = inject(Renderer2);
1340
+ this.elementRef = inject(ElementRef);
1341
+ this.parent = inject(ControlContainer, { optional: true });
1342
+ this.ngControl = inject(NgControl, {
1343
+ self: true,
1344
+ optional: true
1345
+ });
1346
+ this.controlId = input(void 0, {
1347
+ ...ngDevMode ? { debugName: "controlId" } : /* istanbul ignore next */ {},
1348
+ alias: "rxapControlHideShow"
1349
+ });
1350
+ this.subscription = new Subscription();
1351
+ }
1352
+ ngOnInit() {
1353
+ if (!this.ngControl && !this.parent) throw new Error("Easier the ControlContainer or NgControl must be injectable");
1354
+ const controlId = this.controlId();
1355
+ if (!this.ngControl && !controlId) throw new Error("If the NgControl is not injectable then the control id must be defined!");
1356
+ const control = this.ngControl?.control ?? this.extractControlFromParent(this.parent, controlId);
1357
+ if (!(control instanceof RxapFormControl)) throw new Error("The control is not an instance of RxapFormControl");
1358
+ this.control = control;
1359
+ const formDefinition = this.extractFormDefinition(control);
1360
+ const hideFunction = this.extractHideFunction(formDefinition);
1361
+ const showFunction = this.extractShowFunction(formDefinition);
1362
+ const options = this.extractOptions(formDefinition);
1363
+ let changeTrigger = formDefinition.rxapFormGroup.valueChanges;
1364
+ if (options.rootChange) changeTrigger = formDefinition.rxapFormGroup.root.valueChanges;
1365
+ changeTrigger = changeTrigger.pipe(startWith(null));
1366
+ if (showFunction) this.subscription.add(changeTrigger.pipe(tap(() => {
1367
+ switch (showFunction.call(formDefinition, control)) {
1368
+ case true:
1369
+ this.show();
1370
+ break;
1371
+ case false:
1372
+ this.hide();
1373
+ break;
1374
+ case null: this.reset();
1375
+ }
1376
+ }), catchError((err) => {
1377
+ console.error(err);
1378
+ return of(null);
1379
+ })).subscribe());
1380
+ if (hideFunction) this.subscription.add(changeTrigger.pipe(tap(() => {
1381
+ switch (hideFunction.call(formDefinition, control)) {
1382
+ case true:
1383
+ this.hide();
1384
+ break;
1385
+ case false:
1386
+ this.show();
1387
+ break;
1388
+ case null: this.reset();
1389
+ }
1390
+ }), catchError((err) => {
1391
+ console.error(err);
1392
+ return of(null);
1393
+ })).subscribe());
1394
+ }
1395
+ ngOnDestroy() {
1396
+ this.subscription.unsubscribe();
1397
+ }
1398
+ extractOptions(formDefinition) {
1399
+ const map = getMetadata("rxap/form-system/hide-show-options", Object.getPrototypeOf(formDefinition)) ?? null;
1400
+ if (!map || !map.has(this.control.controlId)) return {};
1401
+ return map.get(this.control.controlId);
1402
+ }
1403
+ extractHideFunction(formDefinition) {
1404
+ const map = getMetadata("rxap/form-system/hide-function", Object.getPrototypeOf(formDefinition)) ?? null;
1405
+ if (!map || !map.has(this.control.controlId)) return null;
1406
+ return map.get(this.control.controlId);
1407
+ }
1408
+ extractShowFunction(formDefinition) {
1409
+ const map = getMetadata("rxap/form-system/show-function", Object.getPrototypeOf(formDefinition)) ?? null;
1410
+ if (!map || !map.has(this.control.controlId)) return null;
1411
+ return map.get(this.control.controlId);
1412
+ }
1413
+ hide() {
1414
+ this.renderer.setStyle(this.elementRef.nativeElement, "display", "none");
1415
+ }
1416
+ show() {
1417
+ this.renderer.setStyle(this.elementRef.nativeElement, "display", "block");
1418
+ }
1419
+ reset() {
1420
+ this.renderer.removeStyle(this.elementRef.nativeElement, "display");
1421
+ }
1422
+ static {
1423
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1424
+ minVersion: "12.0.0",
1425
+ version: "22.3.0",
1426
+ ngImport: i0,
1427
+ type: ControlHideShowDirective,
1428
+ deps: [],
1429
+ target: i0.ɵɵFactoryTarget.Directive
1430
+ });
1431
+ }
1432
+ static {
1433
+ this.ɵdir = i0.ɵɵngDeclareDirective({
1434
+ minVersion: "17.1.0",
1435
+ version: "22.3.0",
1436
+ type: ControlHideShowDirective,
1437
+ isStandalone: true,
1438
+ selector: "[rxapControlHideShow]",
1439
+ inputs: { controlId: {
1440
+ classPropertyName: "controlId",
1441
+ publicName: "rxapControlHideShow",
1442
+ isSignal: true,
1443
+ isRequired: false,
1444
+ transformFunction: null
1445
+ } },
1446
+ ngImport: i0
1447
+ });
1448
+ }
1184
1449
  };
1185
- ControlHideShowDirective = __decorate([
1186
- Mixin(ExtractControlFromParentMixin, ExtractFormDefinitionMixin)
1187
- ], ControlHideShowDirective);
1188
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: ControlHideShowDirective, decorators: [{
1189
- type: Directive,
1190
- args: [{
1191
- selector: '[rxapControlHideShow]',
1192
- standalone: true,
1193
- }]
1194
- }], propDecorators: { controlId: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapControlHideShow", required: false }] }] } });
1195
-
1450
+ ControlHideShowDirective = __decorate([Mixin(ExtractControlFromParentMixin, ExtractFormDefinitionMixin)], ControlHideShowDirective);
1451
+ i0.ɵɵngDeclareClassMetadata({
1452
+ minVersion: "12.0.0",
1453
+ version: "22.3.0",
1454
+ ngImport: i0,
1455
+ type: ControlHideShowDirective,
1456
+ decorators: [{
1457
+ type: Directive,
1458
+ args: [{
1459
+ selector: "[rxapControlHideShow]",
1460
+ standalone: true
1461
+ }]
1462
+ }],
1463
+ propDecorators: { controlId: [{
1464
+ type: i0.Input,
1465
+ args: [{
1466
+ isSignal: true,
1467
+ alias: "rxapControlHideShow",
1468
+ required: false
1469
+ }]
1470
+ }] }
1471
+ });
1196
1472
  let InputSelectOptionsDirective = class InputSelectOptionsDirective {
1197
- constructor() {
1198
- this.template = inject(TemplateRef);
1199
- this.dataSourceLoader = inject(DataSourceLoader);
1200
- this.viewContainerRef = inject(ViewContainerRef);
1201
- this.injector = inject(INJECTOR);
1202
- this.cdr = inject(ChangeDetectorRef);
1203
- this.ngControl = inject(NgControl, { optional: true }) ?? null;
1204
- this.matFormField = inject(MAT_FORM_FIELD, { optional: true }) ?? null;
1205
- this.viewer = input({ id: '[rxapInputSelectOptions]' }, { ...(ngDevMode ? { debugName: "viewer" } : /* istanbul ignore next */ {}), alias: "rxapInputSelectOptionsViewer" });
1206
- this.metadata = input(undefined, { ...(ngDevMode ? { debugName: "metadata" } : /* istanbul ignore next */ {}), alias: "rxapInputSelectOptionsMetadata" });
1207
- this.matAutocomplete = input(undefined, { ...(ngDevMode ? { debugName: "matAutocomplete" } : /* istanbul ignore next */ {}), alias: "rxapInputSelectOptionsMatAutocomplete" });
1208
- /**
1209
- * The viewer used to connect to the data source. Defaults to the input value, but is
1210
- * replaced with a viewer bound to the control after the view init.
1211
- */
1212
- this.currentViewer = linkedSignal(() => this.viewer(), ...(ngDevMode ? [{ debugName: "currentViewer" }] : /* istanbul ignore next */ []));
1213
- this.subscription = new Subscription();
1214
- this.options = null;
1215
- /**
1216
- * This flag is used to prevent the setValue is called for each refresh
1217
- * of the options list. This is needed because the setValue method will
1218
- * trigger a new refresh of the options list. This results in an endless
1219
- * call stack. This flag is set to true if the setValue method is called
1220
- * once.
1221
- */
1222
- this.isAutocompleteToDisplayTriggered = false;
1223
- }
1224
- ngAfterViewInit() {
1225
- this.extractOptionsDatasource(undefined, this.metadata());
1226
- this.currentViewer.set({
1227
- id: '[rxapInputSelectOptions]' + this.control.controlId,
1228
- viewChange: this.settings?.loadOnce ? EMPTY : this.control.value$.pipe(throttleTime(1000), distinctUntilChanged$1((a, b) => equals(a, b)), map(value => {
1229
- if (this.settings?.ignoreSelectedValue) {
1230
- return {};
1231
- }
1232
- return value;
1233
- })),
1234
- control: this.control,
1235
- });
1236
- const matAutocomplete = this.matAutocomplete();
1237
- if (matAutocomplete) {
1238
- matAutocomplete.displayWith = this.toDisplay.bind(this);
1239
- this.settings ??= {};
1240
- this.settings.filteredOptions ??= true;
1241
- }
1242
- this.loadOptions();
1243
- }
1244
- toDisplay(value) {
1245
- if (!value) {
1246
- return '';
1247
- }
1248
- return this.options?.find((option) => option.value === value)?.display ??
1249
- (isDevMode() ? 'to display error' : '');
1250
- }
1251
- ngOnDestroy() {
1252
- this.subscription?.unsubscribe();
1253
- }
1254
- loadOptions(dataSource = this.dataSource) {
1255
- this.subscription.add(dataSource.connect(this.currentViewer()).pipe(switchMap(options => {
1256
- if (this.settings?.filteredOptions) {
1257
- return this.control.value$.pipe(map(controlValue => {
1258
- if (typeof controlValue === 'string' && controlValue) {
1259
- controlValue = controlValue.toLowerCase();
1260
- if (Array.isArray(options)) {
1261
- return options.filter(option => option.display.toLowerCase().includes(controlValue));
1262
- }
1263
- else {
1264
- return Object.entries(options)
1265
- .filter(([value, display]) => typeof display ===
1266
- 'string' &&
1267
- display.toLowerCase().includes(controlValue))
1268
- .map(([value, display]) => ({
1269
- value,
1270
- display,
1271
- }));
1272
- }
1273
- }
1274
- return options;
1275
- }));
1276
- }
1277
- return of(options);
1278
- }), tap(options => this.renderTemplate(this.options = options)), tap(() => {
1279
- if (this.matAutocomplete() && !this.isAutocompleteToDisplayTriggered) {
1280
- this.isAutocompleteToDisplayTriggered = true;
1281
- // trigger a change detection after the options are rendered
1282
- // this is needed to trigger the mat-autocomplete options to display function
1283
- this.ngControl?.control?.setValue(this.ngControl?.control?.value);
1284
- }
1285
- })).subscribe());
1286
- }
1287
- renderTemplate(options = this.options) {
1288
- this.viewContainerRef.clear();
1289
- if (options) {
1290
- if (!Array.isArray(options)) {
1291
- for (const [value, display] of Object.entries(options)) {
1292
- this.viewContainerRef.createEmbeddedView(this.template, {
1293
- $implicit: {
1294
- value,
1295
- display,
1296
- },
1297
- });
1298
- }
1299
- }
1300
- else {
1301
- for (const option of options) {
1302
- this.viewContainerRef.createEmbeddedView(this.template, { $implicit: option });
1303
- }
1304
- }
1305
- }
1306
- else {
1307
- if (isDevMode()) {
1308
- console.warn(`The options for the control ${this.control.fullControlPath} is empty/null/undefined!`);
1309
- }
1310
- }
1311
- this.cdr.detectChanges();
1312
- }
1313
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: InputSelectOptionsDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1314
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: InputSelectOptionsDirective, isStandalone: true, selector: "[rxapInputSelectOptions]", inputs: { viewer: { classPropertyName: "viewer", publicName: "rxapInputSelectOptionsViewer", isSignal: true, isRequired: false, transformFunction: null }, metadata: { classPropertyName: "metadata", publicName: "rxapInputSelectOptionsMetadata", isSignal: true, isRequired: false, transformFunction: null }, matAutocomplete: { classPropertyName: "matAutocomplete", publicName: "rxapInputSelectOptionsMatAutocomplete", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
1473
+ constructor() {
1474
+ this.template = inject(TemplateRef);
1475
+ this.dataSourceLoader = inject(DataSourceLoader);
1476
+ this.viewContainerRef = inject(ViewContainerRef);
1477
+ this.injector = inject(INJECTOR);
1478
+ this.cdr = inject(ChangeDetectorRef);
1479
+ this.ngControl = inject(NgControl, { optional: true }) ?? null;
1480
+ this.matFormField = inject(MAT_FORM_FIELD, { optional: true }) ?? null;
1481
+ this.viewer = input({ id: "[rxapInputSelectOptions]" }, {
1482
+ ...ngDevMode ? { debugName: "viewer" } : /* istanbul ignore next */ {},
1483
+ alias: "rxapInputSelectOptionsViewer"
1484
+ });
1485
+ this.metadata = input(void 0, {
1486
+ ...ngDevMode ? { debugName: "metadata" } : /* istanbul ignore next */ {},
1487
+ alias: "rxapInputSelectOptionsMetadata"
1488
+ });
1489
+ this.matAutocomplete = input(void 0, {
1490
+ ...ngDevMode ? { debugName: "matAutocomplete" } : /* istanbul ignore next */ {},
1491
+ alias: "rxapInputSelectOptionsMatAutocomplete"
1492
+ });
1493
+ this.currentViewer = linkedSignal(() => this.viewer(), ...ngDevMode ? [{ debugName: "currentViewer" }] : /* istanbul ignore next */ []);
1494
+ this.subscription = new Subscription();
1495
+ this.options = null;
1496
+ this.isAutocompleteToDisplayTriggered = false;
1497
+ }
1498
+ ngAfterViewInit() {
1499
+ this.extractOptionsDatasource(void 0, this.metadata());
1500
+ this.currentViewer.set({
1501
+ id: "[rxapInputSelectOptions]" + this.control.controlId,
1502
+ viewChange: this.settings?.loadOnce ? EMPTY : this.control.value$.pipe(throttleTime(1e3), distinctUntilChanged((a, b) => equals(a, b)), map((value) => {
1503
+ if (this.settings?.ignoreSelectedValue) return {};
1504
+ return value;
1505
+ })),
1506
+ control: this.control
1507
+ });
1508
+ const matAutocomplete = this.matAutocomplete();
1509
+ if (matAutocomplete) {
1510
+ matAutocomplete.displayWith = this.toDisplay.bind(this);
1511
+ this.settings ??= {};
1512
+ this.settings.filteredOptions ??= true;
1513
+ }
1514
+ this.loadOptions();
1515
+ }
1516
+ toDisplay(value) {
1517
+ if (!value) return "";
1518
+ return this.options?.find((option) => option.value === value)?.display ?? (isDevMode() ? "to display error" : "");
1519
+ }
1520
+ ngOnDestroy() {
1521
+ this.subscription?.unsubscribe();
1522
+ }
1523
+ loadOptions(dataSource = this.dataSource) {
1524
+ this.subscription.add(dataSource.connect(this.currentViewer()).pipe(switchMap((options) => {
1525
+ if (this.settings?.filteredOptions) return this.control.value$.pipe(map((controlValue) => {
1526
+ if (typeof controlValue === "string" && controlValue) {
1527
+ controlValue = controlValue.toLowerCase();
1528
+ if (Array.isArray(options)) return options.filter((option) => option.display.toLowerCase().includes(controlValue));
1529
+ else return Object.entries(options).filter(([value, display]) => typeof display === "string" && display.toLowerCase().includes(controlValue)).map(([value, display]) => ({
1530
+ value,
1531
+ display
1532
+ }));
1533
+ }
1534
+ return options;
1535
+ }));
1536
+ return of(options);
1537
+ }), tap((options) => this.renderTemplate(this.options = options)), tap(() => {
1538
+ if (this.matAutocomplete() && !this.isAutocompleteToDisplayTriggered) {
1539
+ this.isAutocompleteToDisplayTriggered = true;
1540
+ this.ngControl?.control?.setValue(this.ngControl?.control?.value);
1541
+ }
1542
+ })).subscribe());
1543
+ }
1544
+ renderTemplate(options = this.options) {
1545
+ this.viewContainerRef.clear();
1546
+ if (options) {
1547
+ if (!Array.isArray(options)) for (const [value, display] of Object.entries(options)) this.viewContainerRef.createEmbeddedView(this.template, { $implicit: {
1548
+ value,
1549
+ display
1550
+ } });
1551
+ else for (const option of options) this.viewContainerRef.createEmbeddedView(this.template, { $implicit: option });
1552
+ } else if (isDevMode()) console.warn(`The options for the control ${this.control.fullControlPath} is empty/null/undefined!`);
1553
+ this.cdr.detectChanges();
1554
+ }
1555
+ static {
1556
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1557
+ minVersion: "12.0.0",
1558
+ version: "22.3.0",
1559
+ ngImport: i0,
1560
+ type: InputSelectOptionsDirective,
1561
+ deps: [],
1562
+ target: i0.ɵɵFactoryTarget.Directive
1563
+ });
1564
+ }
1565
+ static {
1566
+ this.ɵdir = i0.ɵɵngDeclareDirective({
1567
+ minVersion: "17.1.0",
1568
+ version: "22.3.0",
1569
+ type: InputSelectOptionsDirective,
1570
+ isStandalone: true,
1571
+ selector: "[rxapInputSelectOptions]",
1572
+ inputs: {
1573
+ viewer: {
1574
+ classPropertyName: "viewer",
1575
+ publicName: "rxapInputSelectOptionsViewer",
1576
+ isSignal: true,
1577
+ isRequired: false,
1578
+ transformFunction: null
1579
+ },
1580
+ metadata: {
1581
+ classPropertyName: "metadata",
1582
+ publicName: "rxapInputSelectOptionsMetadata",
1583
+ isSignal: true,
1584
+ isRequired: false,
1585
+ transformFunction: null
1586
+ },
1587
+ matAutocomplete: {
1588
+ classPropertyName: "matAutocomplete",
1589
+ publicName: "rxapInputSelectOptionsMatAutocomplete",
1590
+ isSignal: true,
1591
+ isRequired: false,
1592
+ transformFunction: null
1593
+ }
1594
+ },
1595
+ ngImport: i0
1596
+ });
1597
+ }
1315
1598
  };
1316
- InputSelectOptionsDirective = __decorate([
1317
- Mixin(ExtractOptionsDataSourceMixin)
1318
- ], InputSelectOptionsDirective);
1319
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: InputSelectOptionsDirective, decorators: [{
1320
- type: Directive,
1321
- args: [{
1322
- selector: '[rxapInputSelectOptions]',
1323
- standalone: true,
1324
- }]
1325
- }], propDecorators: { viewer: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapInputSelectOptionsViewer", required: false }] }], metadata: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapInputSelectOptionsMetadata", required: false }] }], matAutocomplete: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapInputSelectOptionsMatAutocomplete", required: false }] }] } });
1326
-
1327
- const REMOTE_METHOD_NAME = 'options';
1328
- const RXAP_USE_REMOTE_METHOD = 'rxap/form-system/remote-method/use';
1599
+ InputSelectOptionsDirective = __decorate([Mixin(ExtractOptionsDataSourceMixin)], InputSelectOptionsDirective);
1600
+ i0.ɵɵngDeclareClassMetadata({
1601
+ minVersion: "12.0.0",
1602
+ version: "22.3.0",
1603
+ ngImport: i0,
1604
+ type: InputSelectOptionsDirective,
1605
+ decorators: [{
1606
+ type: Directive,
1607
+ args: [{
1608
+ selector: "[rxapInputSelectOptions]",
1609
+ standalone: true
1610
+ }]
1611
+ }],
1612
+ propDecorators: {
1613
+ viewer: [{
1614
+ type: i0.Input,
1615
+ args: [{
1616
+ isSignal: true,
1617
+ alias: "rxapInputSelectOptionsViewer",
1618
+ required: false
1619
+ }]
1620
+ }],
1621
+ metadata: [{
1622
+ type: i0.Input,
1623
+ args: [{
1624
+ isSignal: true,
1625
+ alias: "rxapInputSelectOptionsMetadata",
1626
+ required: false
1627
+ }]
1628
+ }],
1629
+ matAutocomplete: [{
1630
+ type: i0.Input,
1631
+ args: [{
1632
+ isSignal: true,
1633
+ alias: "rxapInputSelectOptionsMatAutocomplete",
1634
+ required: false
1635
+ }]
1636
+ }]
1637
+ }
1638
+ });
1639
+ const REMOTE_METHOD_NAME = "options";
1640
+ const RXAP_USE_REMOTE_METHOD = "rxap/form-system/remote-method/use";
1329
1641
  function UseRemoteMethod(remoteMethod, name) {
1330
- return function (target, propertyKey) {
1331
- setMetadataMapMap(propertyKey, name, remoteMethod, RXAP_USE_REMOTE_METHOD, target);
1332
- };
1642
+ return function(target, propertyKey) {
1643
+ setMetadataMapMap(propertyKey, name, remoteMethod, RXAP_USE_REMOTE_METHOD, target);
1644
+ };
1333
1645
  }
1334
1646
  function UseOptionsRemoteMethod(dataSource) {
1335
- return function (target, propertyKey) {
1336
- UseRemoteMethod(dataSource, REMOTE_METHOD_NAME)(target, propertyKey);
1337
- };
1338
- }
1339
- class ExtractRemoteMethodsMixin {
1340
- extractRemoteMethods(formDefinition, controlId) {
1341
- const map = getMetadata(RXAP_USE_REMOTE_METHOD, Object.getPrototypeOf(formDefinition));
1342
- if (!map) {
1343
- throw new RxapFormSystemError('Could not extract the use remote method map from the form definition instance', '');
1344
- }
1345
- if (!map.has(controlId)) {
1346
- throw new RxapFormSystemError('A use remote method definition does not exists in the form definition metadata', '');
1347
- }
1348
- return map.get(controlId);
1349
- }
1647
+ return function(target, propertyKey) {
1648
+ UseRemoteMethod(dataSource, REMOTE_METHOD_NAME)(target, propertyKey);
1649
+ };
1350
1650
  }
1651
+ var ExtractRemoteMethodsMixin = class {
1652
+ extractRemoteMethods(formDefinition, controlId) {
1653
+ const map = getMetadata(RXAP_USE_REMOTE_METHOD, Object.getPrototypeOf(formDefinition));
1654
+ if (!map) throw new RxapFormSystemError("Could not extract the use remote method map from the form definition instance", "");
1655
+ if (!map.has(controlId)) throw new RxapFormSystemError("A use remote method definition does not exists in the form definition metadata", "");
1656
+ return map.get(controlId);
1657
+ }
1658
+ };
1351
1659
  let OptionsFromRemoteMethodDirective = class OptionsFromRemoteMethodDirective {
1352
- constructor() {
1353
- this.ngControl = inject(NgControl);
1354
- this.template = inject(TemplateRef);
1355
- this.remoteMethodLoader = inject(RemoteMethodLoader);
1356
- this.viewContainerRef = inject(ViewContainerRef);
1357
- this.injector = inject(INJECTOR);
1358
- this.cdr = inject(ChangeDetectorRef);
1359
- this.parameters = input(undefined, { ...(ngDevMode ? { debugName: "parameters" } : /* istanbul ignore next */ {}), alias: "rxapOptionsFromRemoteMethodParameters" });
1360
- this.resetOnChange = input(undefined, { ...(ngDevMode ? { debugName: "resetOnChange" } : /* istanbul ignore next */ {}), alias: "rxapOptionsFromRemoteMethodResetOnChange" });
1361
- this.withoutParameters = input(false, { ...(ngDevMode ? { debugName: "withoutParameters" } : /* istanbul ignore next */ {}), alias: "rxapOptionsFromRemoteMethodWithoutParameters" });
1362
- effect(() => {
1363
- const parameters = this.parameters();
1364
- // the parameters are only relevant if the input is bound
1365
- if (parameters === undefined) {
1366
- return;
1367
- }
1368
- untracked(() => {
1369
- this.remoteMethodToken ??= this.extractRemoteMethodToken();
1370
- return this.renderTemplate(parameters);
1371
- });
1372
- });
1373
- effect(() => {
1374
- if (!this.withoutParameters()) {
1375
- return;
1376
- }
1377
- untracked(() => {
1378
- this.remoteMethodToken ??= this.extractRemoteMethodToken();
1379
- return this.renderTemplate();
1380
- });
1381
- });
1382
- }
1383
- extractRemoteMethodToken() {
1384
- const control = this.ngControl.control;
1385
- if (!(control instanceof RxapFormControl)) {
1386
- throw new Error('Control is not a RxapFormControl!');
1387
- }
1388
- const formDefinition = this.extractFormDefinition(control);
1389
- const remoteMethodsTokens = this.extractRemoteMethods(formDefinition, control.controlId);
1390
- if (!remoteMethodsTokens.has(REMOTE_METHOD_NAME)) {
1391
- throw new Error(`The remote method with the name 'options' is not defined`);
1392
- }
1393
- return remoteMethodsTokens.get(REMOTE_METHOD_NAME);
1394
- }
1395
- async renderTemplate(parameters) {
1396
- const options = await this.remoteMethodLoader.call$(this.remoteMethodToken, parameters, undefined, this.injector);
1397
- this.viewContainerRef.clear();
1398
- for (const option of options) {
1399
- this.viewContainerRef.createEmbeddedView(this.template, { $implicit: option });
1400
- }
1401
- const resetOnChange = untracked(this.resetOnChange);
1402
- if (resetOnChange !== undefined) {
1403
- this.ngControl.reset(resetOnChange);
1404
- }
1405
- this.cdr.detectChanges();
1406
- }
1407
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: OptionsFromRemoteMethodDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1408
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: OptionsFromRemoteMethodDirective, isStandalone: true, selector: "[rxapOptionsFromRemoteMethod]", inputs: { parameters: { classPropertyName: "parameters", publicName: "rxapOptionsFromRemoteMethodParameters", isSignal: true, isRequired: false, transformFunction: null }, resetOnChange: { classPropertyName: "resetOnChange", publicName: "rxapOptionsFromRemoteMethodResetOnChange", isSignal: true, isRequired: false, transformFunction: null }, withoutParameters: { classPropertyName: "withoutParameters", publicName: "rxapOptionsFromRemoteMethodWithoutParameters", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
1660
+ constructor() {
1661
+ this.ngControl = inject(NgControl);
1662
+ this.template = inject(TemplateRef);
1663
+ this.remoteMethodLoader = inject(RemoteMethodLoader);
1664
+ this.viewContainerRef = inject(ViewContainerRef);
1665
+ this.injector = inject(INJECTOR);
1666
+ this.cdr = inject(ChangeDetectorRef);
1667
+ this.parameters = input(void 0, {
1668
+ ...ngDevMode ? { debugName: "parameters" } : /* istanbul ignore next */ {},
1669
+ alias: "rxapOptionsFromRemoteMethodParameters"
1670
+ });
1671
+ this.resetOnChange = input(void 0, {
1672
+ ...ngDevMode ? { debugName: "resetOnChange" } : /* istanbul ignore next */ {},
1673
+ alias: "rxapOptionsFromRemoteMethodResetOnChange"
1674
+ });
1675
+ this.withoutParameters = input(false, {
1676
+ ...ngDevMode ? { debugName: "withoutParameters" } : /* istanbul ignore next */ {},
1677
+ alias: "rxapOptionsFromRemoteMethodWithoutParameters"
1678
+ });
1679
+ effect(() => {
1680
+ const parameters = this.parameters();
1681
+ if (parameters === void 0) return;
1682
+ untracked(() => {
1683
+ this.remoteMethodToken ??= this.extractRemoteMethodToken();
1684
+ return this.renderTemplate(parameters);
1685
+ });
1686
+ });
1687
+ effect(() => {
1688
+ if (!this.withoutParameters()) return;
1689
+ untracked(() => {
1690
+ this.remoteMethodToken ??= this.extractRemoteMethodToken();
1691
+ return this.renderTemplate();
1692
+ });
1693
+ });
1694
+ }
1695
+ extractRemoteMethodToken() {
1696
+ const control = this.ngControl.control;
1697
+ if (!(control instanceof RxapFormControl)) throw new Error("Control is not a RxapFormControl!");
1698
+ const formDefinition = this.extractFormDefinition(control);
1699
+ const remoteMethodsTokens = this.extractRemoteMethods(formDefinition, control.controlId);
1700
+ if (!remoteMethodsTokens.has("options")) throw new Error(`The remote method with the name 'options' is not defined`);
1701
+ return remoteMethodsTokens.get(REMOTE_METHOD_NAME);
1702
+ }
1703
+ async renderTemplate(parameters) {
1704
+ const options = await this.remoteMethodLoader.call$(this.remoteMethodToken, parameters, void 0, this.injector);
1705
+ this.viewContainerRef.clear();
1706
+ for (const option of options) this.viewContainerRef.createEmbeddedView(this.template, { $implicit: option });
1707
+ const resetOnChange = untracked(this.resetOnChange);
1708
+ if (resetOnChange !== void 0) this.ngControl.reset(resetOnChange);
1709
+ this.cdr.detectChanges();
1710
+ }
1711
+ static {
1712
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1713
+ minVersion: "12.0.0",
1714
+ version: "22.3.0",
1715
+ ngImport: i0,
1716
+ type: OptionsFromRemoteMethodDirective,
1717
+ deps: [],
1718
+ target: i0.ɵɵFactoryTarget.Directive
1719
+ });
1720
+ }
1721
+ static {
1722
+ this.ɵdir = i0.ɵɵngDeclareDirective({
1723
+ minVersion: "17.1.0",
1724
+ version: "22.3.0",
1725
+ type: OptionsFromRemoteMethodDirective,
1726
+ isStandalone: true,
1727
+ selector: "[rxapOptionsFromRemoteMethod]",
1728
+ inputs: {
1729
+ parameters: {
1730
+ classPropertyName: "parameters",
1731
+ publicName: "rxapOptionsFromRemoteMethodParameters",
1732
+ isSignal: true,
1733
+ isRequired: false,
1734
+ transformFunction: null
1735
+ },
1736
+ resetOnChange: {
1737
+ classPropertyName: "resetOnChange",
1738
+ publicName: "rxapOptionsFromRemoteMethodResetOnChange",
1739
+ isSignal: true,
1740
+ isRequired: false,
1741
+ transformFunction: null
1742
+ },
1743
+ withoutParameters: {
1744
+ classPropertyName: "withoutParameters",
1745
+ publicName: "rxapOptionsFromRemoteMethodWithoutParameters",
1746
+ isSignal: true,
1747
+ isRequired: false,
1748
+ transformFunction: null
1749
+ }
1750
+ },
1751
+ ngImport: i0
1752
+ });
1753
+ }
1754
+ };
1755
+ OptionsFromRemoteMethodDirective = __decorate([Mixin(ExtractFormDefinitionMixin, ExtractRemoteMethodsMixin), __metadata("design:paramtypes", [])], OptionsFromRemoteMethodDirective);
1756
+ i0.ɵɵngDeclareClassMetadata({
1757
+ minVersion: "12.0.0",
1758
+ version: "22.3.0",
1759
+ ngImport: i0,
1760
+ type: OptionsFromRemoteMethodDirective,
1761
+ decorators: [{
1762
+ type: Directive,
1763
+ args: [{
1764
+ selector: "[rxapOptionsFromRemoteMethod]",
1765
+ standalone: true
1766
+ }]
1767
+ }],
1768
+ ctorParameters: () => [],
1769
+ propDecorators: {
1770
+ parameters: [{
1771
+ type: i0.Input,
1772
+ args: [{
1773
+ isSignal: true,
1774
+ alias: "rxapOptionsFromRemoteMethodParameters",
1775
+ required: false
1776
+ }]
1777
+ }],
1778
+ resetOnChange: [{
1779
+ type: i0.Input,
1780
+ args: [{
1781
+ isSignal: true,
1782
+ alias: "rxapOptionsFromRemoteMethodResetOnChange",
1783
+ required: false
1784
+ }]
1785
+ }],
1786
+ withoutParameters: [{
1787
+ type: i0.Input,
1788
+ args: [{
1789
+ isSignal: true,
1790
+ alias: "rxapOptionsFromRemoteMethodWithoutParameters",
1791
+ required: false
1792
+ }]
1793
+ }]
1794
+ }
1795
+ });
1796
+ var TestNgControl = class extends NgControl {
1797
+ constructor(_control) {
1798
+ super();
1799
+ this._control = _control;
1800
+ }
1801
+ get control() {
1802
+ return this._control;
1803
+ }
1804
+ viewToModelUpdate(newValue) {
1805
+ throw new Error("Method not implemented.");
1806
+ }
1409
1807
  };
1410
- OptionsFromRemoteMethodDirective = __decorate([
1411
- Mixin(ExtractFormDefinitionMixin, ExtractRemoteMethodsMixin),
1412
- __metadata("design:paramtypes", [])
1413
- ], OptionsFromRemoteMethodDirective);
1414
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: OptionsFromRemoteMethodDirective, decorators: [{
1415
- type: Directive,
1416
- args: [{
1417
- selector: '[rxapOptionsFromRemoteMethod]',
1418
- standalone: true,
1419
- }]
1420
- }], ctorParameters: () => [], propDecorators: { parameters: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapOptionsFromRemoteMethodParameters", required: false }] }], resetOnChange: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapOptionsFromRemoteMethodResetOnChange", required: false }] }], withoutParameters: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapOptionsFromRemoteMethodWithoutParameters", required: false }] }] } });
1421
-
1422
- class TestNgControl extends NgControl {
1423
- constructor(_control) {
1424
- super();
1425
- this._control = _control;
1426
- }
1427
- get control() {
1428
- return this._control;
1429
- }
1430
- viewToModelUpdate(newValue) {
1431
- throw new Error('Method not implemented.');
1432
- }
1433
- }
1434
-
1435
1808
  function UseComponent(component, setProperties = {}) {
1436
- return function (target, propertyKey) {
1437
- setMetadataMap(propertyKey, component, FormSystemMetadataKeys.COMPONENTS, target);
1438
- setMetadataMap(propertyKey, setProperties, FormSystemMetadataKeys.COMPONENTS_PROPERTIES, target);
1439
- };
1809
+ return function(target, propertyKey) {
1810
+ setMetadataMap(propertyKey, component, FormSystemMetadataKeys.COMPONENTS, target);
1811
+ setMetadataMap(propertyKey, setProperties, FormSystemMetadataKeys.COMPONENTS_PROPERTIES, target);
1812
+ };
1440
1813
  }
1441
-
1442
- /**
1443
- * Links a component with a form definition
1444
- *
1445
- * @param component
1446
- */
1447
1814
  function UseFormComponent(component) {
1448
- return function (target) {
1449
- setMetadata(FormSystemMetadataKeys.FORM_COMPONENT, component, target);
1450
- };
1451
- }
1452
-
1453
- const RXAP_FORM_CONTROL_SOURCE = new InjectionToken('rxap/forms/data-source');
1454
- class ControlDataSource extends BaseDataSource {
1455
- constructor(control, metadata = null) {
1456
- super(metadata);
1457
- this.control = control;
1458
- }
1459
- init() {
1460
- if (this._initialised) {
1461
- return;
1462
- }
1463
- super.init();
1464
- if (isDevMode()) {
1465
- console.log(this.control);
1466
- }
1467
- this._data$ = this.control.valueChanges.pipe(startWith$1(this.control.value), distinctUntilChanged$1((a, b) => equals(a, b)), shareReplay(1));
1468
- }
1469
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: ControlDataSource, deps: [{ token: RXAP_FORM_CONTROL_SOURCE }, { token: RXAP_DATA_SOURCE_METADATA, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
1470
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: ControlDataSource }); }
1815
+ return function(target) {
1816
+ setMetadata(FormSystemMetadataKeys.FORM_COMPONENT, component, target);
1817
+ };
1471
1818
  }
1472
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: ControlDataSource, decorators: [{
1473
- type: Injectable
1474
- }], ctorParameters: () => [{ type: undefined, decorators: [{
1475
- type: Inject,
1476
- args: [RXAP_FORM_CONTROL_SOURCE]
1477
- }] }, { type: undefined, decorators: [{
1478
- type: Optional
1479
- }, {
1480
- type: Inject,
1481
- args: [RXAP_DATA_SOURCE_METADATA]
1482
- }] }] });
1819
+ const RXAP_FORM_CONTROL_SOURCE = new InjectionToken("rxap/forms/data-source");
1820
+ var ControlDataSource = class ControlDataSource extends BaseDataSource {
1821
+ constructor(control, metadata = null) {
1822
+ super(metadata);
1823
+ this.control = control;
1824
+ }
1825
+ init() {
1826
+ if (this._initialised) return;
1827
+ super.init();
1828
+ if (isDevMode()) console.log(this.control);
1829
+ this._data$ = this.control.valueChanges.pipe(startWith(this.control.value), distinctUntilChanged((a, b) => equals(a, b)), shareReplay(1));
1830
+ }
1831
+ static {
1832
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1833
+ minVersion: "12.0.0",
1834
+ version: "22.3.0",
1835
+ ngImport: i0,
1836
+ type: ControlDataSource,
1837
+ deps: [{ token: RXAP_FORM_CONTROL_SOURCE }, {
1838
+ token: RXAP_DATA_SOURCE_METADATA,
1839
+ optional: true
1840
+ }],
1841
+ target: i0.ɵɵFactoryTarget.Injectable
1842
+ });
1843
+ }
1844
+ static {
1845
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
1846
+ minVersion: "12.0.0",
1847
+ version: "22.3.0",
1848
+ ngImport: i0,
1849
+ type: ControlDataSource
1850
+ });
1851
+ }
1852
+ };
1853
+ i0.ɵɵngDeclareClassMetadata({
1854
+ minVersion: "12.0.0",
1855
+ version: "22.3.0",
1856
+ ngImport: i0,
1857
+ type: ControlDataSource,
1858
+ decorators: [{ type: Injectable }],
1859
+ ctorParameters: () => [{
1860
+ type: void 0,
1861
+ decorators: [{
1862
+ type: Inject,
1863
+ args: [RXAP_FORM_CONTROL_SOURCE]
1864
+ }]
1865
+ }, {
1866
+ type: void 0,
1867
+ decorators: [{ type: Optional }, {
1868
+ type: Inject,
1869
+ args: [RXAP_DATA_SOURCE_METADATA]
1870
+ }]
1871
+ }]
1872
+ });
1483
1873
  function controlDataSource(control) {
1484
- // TODO : remove as any (wait for @rxap/forms update)
1485
- return new ControlDataSource(control, { id: control.controlId });
1874
+ return new ControlDataSource(control, { id: control.controlId });
1486
1875
  }
1487
-
1488
1876
  function FormContextFromActivatedRouteFactory(route) {
1489
- return route.snapshot.params;
1877
+ return route.snapshot.params;
1490
1878
  }
1491
-
1492
1879
  let FormSystemControlDirective = class FormSystemControlDirective {
1493
- constructor() {
1494
- this.parent = inject(ControlContainer);
1495
- this.environmentInjector = inject(EnvironmentInjector);
1496
- this.viewContainerRef = inject(ViewContainerRef);
1497
- this.dataSourceLoader = inject(DataSourceLoader);
1498
- this.injector = inject(INJECTOR);
1499
- /**
1500
- * Defines the form control id
1501
- */
1502
- this.controlId = input.required(...(ngDevMode ? [{ debugName: "controlId" }] : /* istanbul ignore next */ []));
1503
- }
1504
- ngOnInit() {
1505
- this.control = this.extractControl();
1506
- const formDefinition = this.extractFormDefinition();
1507
- this.componentRef = this.createComponent(formDefinition);
1508
- this.setDataSources(formDefinition, this.componentRef.instance);
1509
- this.setComponentProperties(formDefinition, this.componentRef.instance);
1510
- this.viewContainerRef.insert(this.componentRef.hostView);
1511
- }
1512
- registerOnChange(fn) {
1513
- this.componentRef.instance.registerOnChange(fn);
1514
- }
1515
- registerOnTouched(fn) {
1516
- this.componentRef.instance.registerOnTouched(fn);
1517
- }
1518
- writeValue(value) {
1519
- this.componentRef.instance.writeValue(value);
1520
- }
1521
- setDisabledState(isDisabled) {
1522
- if (this.componentRef.instance.setDisabledState) {
1523
- this.componentRef.instance.setDisabledState(isDisabled);
1524
- }
1525
- }
1526
- setDataSources(formDefinition, component) {
1527
- if (!component.setDataSource) {
1528
- throw new RxapFormSystemError('The ControlWithDataSource interface is not implemented for the control component, but the control has defined data sources', '');
1529
- }
1530
- const useDataSourceValueMap = this.extractDataSources(formDefinition, this.controlId());
1531
- for (const [name, useDataSourceValue] of useDataSourceValueMap.entries()) {
1532
- let dataSource = this.dataSourceLoader.load(useDataSourceValue.dataSource);
1533
- const settings = useDataSourceValue.settings;
1534
- if (settings?.transformer) {
1535
- dataSource = new PipeDataSource(dataSource, map(settings.transformer));
1536
- }
1537
- component.setDataSource(name, dataSource, useDataSourceValue.settings);
1538
- }
1539
- }
1540
- setComponentProperties(formDefinition, component) {
1541
- const componentProperties = this.extractComponentProperties(formDefinition);
1542
- for (const [key, value] of Object.entries(componentProperties)) {
1543
- Reflect.set(component, key, value);
1544
- }
1545
- }
1546
- createComponent(formDefinition) {
1547
- const component = this.extractComponent(formDefinition);
1548
- return createComponent(component, {
1549
- environmentInjector: this.environmentInjector,
1550
- elementInjector: this.injector,
1551
- });
1552
- }
1553
- extractControl() {
1554
- if (!this.parent.control) {
1555
- throw new RxapFormSystemError('The control property of ControlContainer is not defined', '');
1556
- }
1557
- const control = this.parent.control.get(this.controlId());
1558
- if (!control) {
1559
- throw new RxapFormSystemError('Could not find the control instance', '');
1560
- }
1561
- if (!(control instanceof RxapFormControl)) {
1562
- throw new RxapFormSystemError('The extracted control is not a RxapFormControl', '');
1563
- }
1564
- return control;
1565
- }
1566
- extractFormDefinition() {
1567
- const formDefinition = this.control.rxapFormDefinition;
1568
- if (!formDefinition) {
1569
- throw new RxapFormSystemError('Could not find the form definition instance', '');
1570
- }
1571
- return formDefinition;
1572
- }
1573
- extractComponent(formDefinition) {
1574
- const map = getMetadata(FormSystemMetadataKeys.COMPONENTS, Object.getPrototypeOf(formDefinition));
1575
- if (!map) {
1576
- throw new RxapFormSystemError('Could not extract the use component map from the form definition instance', '');
1577
- }
1578
- const controlId = this.controlId();
1579
- if (!map.has(controlId)) {
1580
- throw new RxapFormSystemError('A use component definition does not exists in the form definition metadata', '');
1581
- }
1582
- return map.get(controlId);
1583
- }
1584
- extractComponentProperties(formDefinition) {
1585
- const map = getMetadata(FormSystemMetadataKeys.COMPONENTS_PROPERTIES, Object.getPrototypeOf(formDefinition));
1586
- if (!map) {
1587
- throw new RxapFormSystemError('Could not extract the use component properties map from the form definition instance', '');
1588
- }
1589
- const controlId = this.controlId();
1590
- if (!map.has(controlId)) {
1591
- throw new RxapFormSystemError('A use component definition does not exists in the form definition metadata', '');
1592
- }
1593
- return map.get(controlId);
1594
- }
1595
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: FormSystemControlDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1596
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: FormSystemControlDirective, isStandalone: true, selector: "[rxapFormSystemControl]", inputs: { controlId: { classPropertyName: "controlId", publicName: "controlId", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 }); }
1880
+ constructor() {
1881
+ this.parent = inject(ControlContainer);
1882
+ this.environmentInjector = inject(EnvironmentInjector);
1883
+ this.viewContainerRef = inject(ViewContainerRef);
1884
+ this.dataSourceLoader = inject(DataSourceLoader);
1885
+ this.injector = inject(INJECTOR);
1886
+ this.controlId = input.required(...ngDevMode ? [{ debugName: "controlId" }] : /* istanbul ignore next */ []);
1887
+ }
1888
+ ngOnInit() {
1889
+ this.control = this.extractControl();
1890
+ const formDefinition = this.extractFormDefinition();
1891
+ this.componentRef = this.createComponent(formDefinition);
1892
+ this.setDataSources(formDefinition, this.componentRef.instance);
1893
+ this.setComponentProperties(formDefinition, this.componentRef.instance);
1894
+ this.viewContainerRef.insert(this.componentRef.hostView);
1895
+ }
1896
+ registerOnChange(fn) {
1897
+ this.componentRef.instance.registerOnChange(fn);
1898
+ }
1899
+ registerOnTouched(fn) {
1900
+ this.componentRef.instance.registerOnTouched(fn);
1901
+ }
1902
+ writeValue(value) {
1903
+ this.componentRef.instance.writeValue(value);
1904
+ }
1905
+ setDisabledState(isDisabled) {
1906
+ if (this.componentRef.instance.setDisabledState) this.componentRef.instance.setDisabledState(isDisabled);
1907
+ }
1908
+ setDataSources(formDefinition, component) {
1909
+ if (!component.setDataSource) throw new RxapFormSystemError("The ControlWithDataSource interface is not implemented for the control component, but the control has defined data sources", "");
1910
+ const useDataSourceValueMap = this.extractDataSources(formDefinition, this.controlId());
1911
+ for (const [name, useDataSourceValue] of useDataSourceValueMap.entries()) {
1912
+ let dataSource = this.dataSourceLoader.load(useDataSourceValue.dataSource);
1913
+ const settings = useDataSourceValue.settings;
1914
+ if (settings?.transformer) dataSource = new PipeDataSource(dataSource, map(settings.transformer));
1915
+ component.setDataSource(name, dataSource, useDataSourceValue.settings);
1916
+ }
1917
+ }
1918
+ setComponentProperties(formDefinition, component) {
1919
+ const componentProperties = this.extractComponentProperties(formDefinition);
1920
+ for (const [key, value] of Object.entries(componentProperties)) Reflect.set(component, key, value);
1921
+ }
1922
+ createComponent(formDefinition) {
1923
+ const component = this.extractComponent(formDefinition);
1924
+ return createComponent(component, {
1925
+ environmentInjector: this.environmentInjector,
1926
+ elementInjector: this.injector
1927
+ });
1928
+ }
1929
+ extractControl() {
1930
+ if (!this.parent.control) throw new RxapFormSystemError("The control property of ControlContainer is not defined", "");
1931
+ const control = this.parent.control.get(this.controlId());
1932
+ if (!control) throw new RxapFormSystemError("Could not find the control instance", "");
1933
+ if (!(control instanceof RxapFormControl)) throw new RxapFormSystemError("The extracted control is not a RxapFormControl", "");
1934
+ return control;
1935
+ }
1936
+ extractFormDefinition() {
1937
+ const formDefinition = this.control.rxapFormDefinition;
1938
+ if (!formDefinition) throw new RxapFormSystemError("Could not find the form definition instance", "");
1939
+ return formDefinition;
1940
+ }
1941
+ extractComponent(formDefinition) {
1942
+ const map = getMetadata(FormSystemMetadataKeys.COMPONENTS, Object.getPrototypeOf(formDefinition));
1943
+ if (!map) throw new RxapFormSystemError("Could not extract the use component map from the form definition instance", "");
1944
+ const controlId = this.controlId();
1945
+ if (!map.has(controlId)) throw new RxapFormSystemError("A use component definition does not exists in the form definition metadata", "");
1946
+ return map.get(controlId);
1947
+ }
1948
+ extractComponentProperties(formDefinition) {
1949
+ const map = getMetadata(FormSystemMetadataKeys.COMPONENTS_PROPERTIES, Object.getPrototypeOf(formDefinition));
1950
+ if (!map) throw new RxapFormSystemError("Could not extract the use component properties map from the form definition instance", "");
1951
+ const controlId = this.controlId();
1952
+ if (!map.has(controlId)) throw new RxapFormSystemError("A use component definition does not exists in the form definition metadata", "");
1953
+ return map.get(controlId);
1954
+ }
1955
+ static {
1956
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1957
+ minVersion: "12.0.0",
1958
+ version: "22.3.0",
1959
+ ngImport: i0,
1960
+ type: FormSystemControlDirective,
1961
+ deps: [],
1962
+ target: i0.ɵɵFactoryTarget.Directive
1963
+ });
1964
+ }
1965
+ static {
1966
+ this.ɵdir = i0.ɵɵngDeclareDirective({
1967
+ minVersion: "17.1.0",
1968
+ version: "22.3.0",
1969
+ type: FormSystemControlDirective,
1970
+ isStandalone: true,
1971
+ selector: "[rxapFormSystemControl]",
1972
+ inputs: { controlId: {
1973
+ classPropertyName: "controlId",
1974
+ publicName: "controlId",
1975
+ isSignal: true,
1976
+ isRequired: true,
1977
+ transformFunction: null
1978
+ } },
1979
+ ngImport: i0
1980
+ });
1981
+ }
1597
1982
  };
1598
- FormSystemControlDirective = __decorate([
1599
- Mixin(ExtractDataSourcesMixin)
1600
- ], FormSystemControlDirective);
1601
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: FormSystemControlDirective, decorators: [{
1602
- type: Directive,
1603
- args: [{
1604
- selector: '[rxapFormSystemControl]',
1605
- standalone: true,
1606
- }]
1607
- }], propDecorators: { controlId: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlId", required: true }] }] } });
1608
-
1609
- const SUBMIT_CONTEXT_FORM_ADAPTER_METHOD = new InjectionToken('submit-context-form-adapter-method');
1610
- class SubmitContextFormAdapter extends ProxyRemoteMethod {
1611
- constructor(remoteMethod, context) {
1612
- super(remoteMethod);
1613
- this.context = context;
1614
- }
1615
- transformParameters(value) {
1616
- return {
1617
- parameters: this.context ?? {},
1618
- requestBody: value,
1619
- };
1620
- }
1621
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: SubmitContextFormAdapter, deps: [{ token: SUBMIT_CONTEXT_FORM_ADAPTER_METHOD }, { token: RXAP_FORM_CONTEXT }], target: i0.ɵɵFactoryTarget.Injectable }); }
1622
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: SubmitContextFormAdapter }); }
1623
- }
1624
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: SubmitContextFormAdapter, decorators: [{
1625
- type: Injectable
1626
- }], ctorParameters: () => [{ type: undefined, decorators: [{
1627
- type: Inject,
1628
- args: [SUBMIT_CONTEXT_FORM_ADAPTER_METHOD]
1629
- }] }, { type: undefined, decorators: [{
1630
- type: Inject,
1631
- args: [RXAP_FORM_CONTEXT]
1632
- }] }] });
1983
+ FormSystemControlDirective = __decorate([Mixin(ExtractDataSourcesMixin)], FormSystemControlDirective);
1984
+ i0.ɵɵngDeclareClassMetadata({
1985
+ minVersion: "12.0.0",
1986
+ version: "22.3.0",
1987
+ ngImport: i0,
1988
+ type: FormSystemControlDirective,
1989
+ decorators: [{
1990
+ type: Directive,
1991
+ args: [{
1992
+ selector: "[rxapFormSystemControl]",
1993
+ standalone: true
1994
+ }]
1995
+ }],
1996
+ propDecorators: { controlId: [{
1997
+ type: i0.Input,
1998
+ args: [{
1999
+ isSignal: true,
2000
+ alias: "controlId",
2001
+ required: true
2002
+ }]
2003
+ }] }
2004
+ });
2005
+ const SUBMIT_CONTEXT_FORM_ADAPTER_METHOD = new InjectionToken("submit-context-form-adapter-method");
2006
+ var SubmitContextFormAdapter = class SubmitContextFormAdapter extends ProxyRemoteMethod {
2007
+ constructor(remoteMethod, context) {
2008
+ super(remoteMethod);
2009
+ this.context = context;
2010
+ }
2011
+ transformParameters(value) {
2012
+ return {
2013
+ parameters: this.context ?? {},
2014
+ requestBody: value
2015
+ };
2016
+ }
2017
+ static {
2018
+ this.ɵfac = i0.ɵɵngDeclareFactory({
2019
+ minVersion: "12.0.0",
2020
+ version: "22.3.0",
2021
+ ngImport: i0,
2022
+ type: SubmitContextFormAdapter,
2023
+ deps: [{ token: SUBMIT_CONTEXT_FORM_ADAPTER_METHOD }, { token: RXAP_FORM_CONTEXT }],
2024
+ target: i0.ɵɵFactoryTarget.Injectable
2025
+ });
2026
+ }
2027
+ static {
2028
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
2029
+ minVersion: "12.0.0",
2030
+ version: "22.3.0",
2031
+ ngImport: i0,
2032
+ type: SubmitContextFormAdapter
2033
+ });
2034
+ }
2035
+ };
2036
+ i0.ɵɵngDeclareClassMetadata({
2037
+ minVersion: "12.0.0",
2038
+ version: "22.3.0",
2039
+ ngImport: i0,
2040
+ type: SubmitContextFormAdapter,
2041
+ decorators: [{ type: Injectable }],
2042
+ ctorParameters: () => [{
2043
+ type: void 0,
2044
+ decorators: [{
2045
+ type: Inject,
2046
+ args: [SUBMIT_CONTEXT_FORM_ADAPTER_METHOD]
2047
+ }]
2048
+ }, {
2049
+ type: void 0,
2050
+ decorators: [{
2051
+ type: Inject,
2052
+ args: [RXAP_FORM_CONTEXT]
2053
+ }]
2054
+ }]
2055
+ });
1633
2056
  function SubmitContextFormAdapterFactory(remoteMethod, context) {
1634
- return new SubmitContextFormAdapter(remoteMethod, context);
2057
+ return new SubmitContextFormAdapter(remoteMethod, context);
1635
2058
  }
1636
-
1637
- // region validators
1638
- // endregion
1639
-
1640
- /**
1641
- * Generated bundle index. Do not edit.
1642
- */
1643
-
1644
2059
  export { AbstractOptionsFromMethodDirective, ApplyUseFunctionAdapters, ApplyUseMethodAdapters, AutocompleteOptionsFromMethodDirective, ComposeOptionsTransformers, ControlDataSource, ControlHideShowDirective, DATA_SOURCE_NAME, ExtractControlFromParentMixin, ExtractControlMixin, ExtractDataSourcesMixin, ExtractFormDefinitionMixin, ExtractFunctionMixin, ExtractFunctionsMixin, ExtractIsValueFunctionMixin, ExtractMethodMixin, ExtractMethodsMixin, ExtractOptionsDataSourceMixin, ExtractOptionsMethodMixin, ExtractRemoteMethodsMixin, ExtractResolveMethodMixin, ExtractToDisplayFunctionMixin, ForFormArrayItemsDirective, FormArrayAddItemButtonDirective, FormArrayItemButton, FormArrayItemRemoveButtonDirective, FormArrayItemRestoreButtonDirective, FormArrayRemovableDirective, FormContextFromActivatedRouteFactory, FormSystemControlDirective, FormSystemMetadataKeys, IS_VALUE_FUNCTION_NAME, InputSelectOptionsDirective, IsEqualToDirective, IsSelectableValueDirective, NoopResolveMethod, OPTIONS_METHOD_NAME, OptionsFromMethodDirective, OptionsFromRemoteMethodDirective, REMOTE_METHOD_NAME, RESOLVE_METHOD_NAME, RXAP_FORM_CONTROL_SOURCE, RXAP_FORM_SYSTEM_HIDE_METADATA, RXAP_FORM_SYSTEM_HIDE_SHOW_OPTIONS, RXAP_FORM_SYSTEM_SHOW_METADATA, RXAP_USE_FUNCTION, RXAP_USE_METHOD, RXAP_USE_REMOTE_METHOD, ResolveByUuidParameter, ResolveByUuidResultFactory, RxapFormSystemError, SUBMIT_CONTEXT_FORM_ADAPTER_METHOD, SubmitContextFormAdapter, SubmitContextFormAdapterFactory, TO_DISPLAY_FUNCTION_NAME, TestNgControl, UseAutocompleteIsValueFunction, UseAutocompleteOptionsMethod, UseAutocompleteResolveMethod, UseAutocompleteToDisplayFunction, UseComponent, UseDataSource, UseFormComponent, UseFunction, UseHideFunction, UseIsValueFunction, UseMethod, UseOptionsDataSource, UseOptionsMethod, UseOptionsRemoteMethod, UseRemoteMethod, UseResolveMethod, UseShowFunction, UseToDisplayFunction, controlDataSource };
1645
- //# sourceMappingURL=rxap-form-system.mjs.map
2060
+
2061
+ //# sourceMappingURL=rxap-form-system.mjs.map