@rxap/form-system 18.2.2-dev.0 → 19.0.0-dev.2

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 (180) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +1 -1
  3. package/compodoc/changelog.html +43 -0
  4. package/compodoc/classes/ExtractFunctionMixin.html +466 -0
  5. package/compodoc/classes/ExtractFunctionsMixin.html +434 -0
  6. package/compodoc/classes/ExtractIsValueFunctionMixin.html +407 -0
  7. package/compodoc/classes/ExtractToDisplayFunctionMixin.html +407 -0
  8. package/compodoc/dependencies.html +17 -17
  9. package/compodoc/directives/AutocompleteOptionsFromMethodDirective.html +162 -181
  10. package/compodoc/directives/OptionsFromMethodDirective.html +20 -19
  11. package/compodoc/index.html +1 -1
  12. package/compodoc/injectables/NoopResolveMethod.html +622 -0
  13. package/compodoc/interfaces/AutocompleteOptionsFromMethodDirectiveParameters.html +95 -18
  14. package/compodoc/interfaces/AutocompleteOptionsFromMethodDirectiveSettings.html +95 -18
  15. package/compodoc/interfaces/AutocompleteOptionsFromRemoteMethodTemplateContext.html +95 -18
  16. package/compodoc/interfaces/OptionsFromMethodDirectiveSettings.html +2 -1
  17. package/compodoc/interfaces/OptionsFromMethodTemplateContext.html +2 -1
  18. package/compodoc/interfaces/UseFunctionConfig.html +360 -0
  19. package/compodoc/interfaces/UseFunctionDefinition.html +399 -0
  20. package/compodoc/js/menu-wc.js +21 -0
  21. package/compodoc/js/menu-wc_es5.js +2 -2
  22. package/compodoc/js/search/search_index.js +2 -2
  23. package/compodoc/miscellaneous/functions.html +738 -30
  24. package/compodoc/miscellaneous/typealiases.html +59 -0
  25. package/compodoc/miscellaneous/variables.html +96 -0
  26. package/compodoc/overview.html +3 -3
  27. package/compodoc/properties.html +1 -1
  28. package/docs/assets/navigation.js +1 -1
  29. package/docs/assets/search.js +1 -1
  30. package/docs/classes/AutocompleteOptionsFromMethodDirective.html +44 -0
  31. package/docs/classes/ControlDataSource.html +12 -12
  32. package/docs/classes/ControlHideShowDirective.html +2 -2
  33. package/docs/classes/ExtractControlFromParentMixin.html +2 -2
  34. package/docs/classes/ExtractControlMixin.html +2 -2
  35. package/docs/classes/ExtractDataSourcesMixin.html +2 -2
  36. package/docs/classes/ExtractFormDefinitionMixin.html +2 -2
  37. package/docs/classes/ExtractFunctionMixin.html +5 -0
  38. package/docs/classes/ExtractFunctionsMixin.html +3 -0
  39. package/docs/classes/ExtractIsValueFunctionMixin.html +11 -0
  40. package/docs/classes/ExtractMethodMixin.html +2 -2
  41. package/docs/classes/ExtractMethodsMixin.html +2 -2
  42. package/docs/classes/ExtractOptionsDataSourceMixin.html +2 -2
  43. package/docs/classes/ExtractOptionsMethodMixin.html +2 -2
  44. package/docs/classes/ExtractRemoteMethodsMixin.html +2 -2
  45. package/docs/classes/ExtractResolveMethodMixin.html +2 -2
  46. package/docs/classes/ExtractToDisplayFunctionMixin.html +11 -0
  47. package/docs/classes/ForFormArrayItemsDirective.html +2 -2
  48. package/docs/classes/FormArrayAddItemButtonDirective.html +2 -2
  49. package/docs/classes/FormArrayItemButton.html +3 -2
  50. package/docs/classes/FormArrayItemRemoveButtonDirective.html +7 -2
  51. package/docs/classes/FormArrayItemRestoreButtonDirective.html +3 -2
  52. package/docs/classes/FormArrayRemovableDirective.html +3 -3
  53. package/docs/classes/FormSystemControlDirective.html +3 -3
  54. package/docs/classes/FormSystemDirectivesModule.html +1 -1
  55. package/docs/classes/InputSelectOptionsDirective.html +3 -3
  56. package/docs/classes/IsEqualToDirective.html +3 -3
  57. package/docs/classes/IsSelectableValueDirective.html +2 -2
  58. package/docs/classes/NoopResolveMethod.html +3 -0
  59. package/docs/classes/OptionsFromMethodDirective.html +3 -3
  60. package/docs/classes/OptionsFromRemoteMethodDirective.html +3 -3
  61. package/docs/classes/RxapFormSystemError.html +5 -15
  62. package/docs/classes/SubmitContextFormAdapter.html +9 -9
  63. package/docs/classes/TestNgControl.html +24 -24
  64. package/docs/documentation.json +17918 -8072
  65. package/docs/enums/FormSystemMetadataKeys.html +2 -2
  66. package/docs/functions/ApplyUseFunctionAdapters.html +1 -0
  67. package/docs/functions/ApplyUseMethodAdapters.html +1 -1
  68. package/docs/functions/ComposeOptionsTransformers.html +1 -1
  69. package/docs/functions/FormContextFromActivatedRouteFactory.html +1 -1
  70. package/docs/functions/ResolveByUuidParameter.html +1 -1
  71. package/docs/functions/ResolveByUuidResultFactory.html +1 -1
  72. package/docs/functions/SubmitContextFormAdapterFactory.html +1 -1
  73. package/docs/functions/UseAutocompleteIsValueFunction.html +1 -0
  74. package/docs/functions/UseAutocompleteOptionsMethod.html +1 -0
  75. package/docs/functions/UseAutocompleteResolveMethod.html +1 -0
  76. package/docs/functions/UseAutocompleteToDisplayFunction.html +1 -0
  77. package/docs/functions/UseComponent.html +1 -1
  78. package/docs/functions/UseDataSource.html +1 -1
  79. package/docs/functions/UseFormComponent.html +1 -1
  80. package/docs/functions/UseFunction.html +1 -0
  81. package/docs/functions/UseHideFunction.html +1 -1
  82. package/docs/functions/UseIsValueFunction.html +1 -0
  83. package/docs/functions/UseMethod.html +1 -1
  84. package/docs/functions/UseOptionsDataSource.html +1 -1
  85. package/docs/functions/UseOptionsMethod.html +1 -1
  86. package/docs/functions/UseOptionsRemoteMethod.html +1 -1
  87. package/docs/functions/UseRemoteMethod.html +1 -1
  88. package/docs/functions/UseResolveMethod.html +1 -1
  89. package/docs/functions/UseShowFunction.html +1 -1
  90. package/docs/functions/UseToDisplayFunction.html +1 -0
  91. package/docs/functions/controlDataSource-1.html +1 -1
  92. package/docs/hierarchy.html +1 -1
  93. package/docs/index.html +1 -1
  94. package/docs/interfaces/AutocompleteOptionsFromMethodDirectiveParameters.html +2 -0
  95. package/docs/interfaces/AutocompleteOptionsFromMethodDirectiveSettings.html +2 -0
  96. package/docs/interfaces/AutocompleteOptionsFromRemoteMethodTemplateContext.html +2 -0
  97. package/docs/interfaces/ControlHideShowOptions.html +2 -2
  98. package/docs/interfaces/ControlWithDataSource.html +2 -2
  99. package/docs/interfaces/ForFormArrayItemsDirectiveContext.html +2 -2
  100. package/docs/interfaces/InputSelectOptionsSettings.html +4 -4
  101. package/docs/interfaces/InputSelectOptionsTemplateContext.html +2 -2
  102. package/docs/interfaces/OptionsFromMethodDirectiveSettings.html +1 -1
  103. package/docs/interfaces/OptionsFromMethodTemplateContext.html +2 -2
  104. package/docs/interfaces/OptionsFromRemoteMethodTemplateContext.html +2 -2
  105. package/docs/interfaces/UseDataSourceSettings.html +2 -2
  106. package/docs/interfaces/UseDataSourceValue.html +3 -3
  107. package/docs/interfaces/UseFunctionConfig.html +2 -0
  108. package/docs/interfaces/UseFunctionDefinition.html +3 -0
  109. package/docs/interfaces/UseMethodConfig.html +2 -2
  110. package/docs/interfaces/UseMethodDefinition.html +2 -2
  111. package/docs/modules.html +28 -3
  112. package/docs/types/ControlHideShowFunction.html +1 -1
  113. package/docs/types/FunctionParameterAdapterFunction.html +1 -0
  114. package/docs/types/FunctionResultAdapterFunction.html +1 -0
  115. package/docs/types/MethodParameterAdapterFunction.html +1 -1
  116. package/docs/types/MethodResultAdapterFunction.html +1 -1
  117. package/docs/types/UseFunctionType.html +1 -0
  118. package/docs/types/UseOptionsDataSourceSettings.html +1 -1
  119. package/docs/variables/DATA_SOURCE_NAME.html +1 -1
  120. package/docs/variables/IS_VALUE_FUNCTION_NAME.html +1 -0
  121. package/docs/variables/OPTIONS_METHOD_NAME.html +1 -1
  122. package/docs/variables/REMOTE_METHOD_NAME.html +1 -1
  123. package/docs/variables/RESOLVE_METHOD_NAME.html +1 -1
  124. package/docs/variables/RXAP_FORM_CONTROL_SOURCE.html +1 -1
  125. package/docs/variables/RXAP_FORM_SYSTEM_HIDE_METADATA.html +1 -1
  126. package/docs/variables/RXAP_FORM_SYSTEM_HIDE_SHOW_OPTIONS.html +1 -1
  127. package/docs/variables/RXAP_FORM_SYSTEM_SHOW_METADATA.html +1 -1
  128. package/docs/variables/RXAP_USE_FUNCTION.html +1 -0
  129. package/docs/variables/RXAP_USE_METHOD.html +1 -1
  130. package/docs/variables/RXAP_USE_REMOTE_METHOD.html +1 -1
  131. package/docs/variables/SUBMIT_CONTEXT_FORM_ADAPTER_METHOD.html +1 -1
  132. package/docs/variables/TO_DISPLAY_FUNCTION_NAME.html +1 -0
  133. package/fesm2022/rxap-form-system.mjs +55 -55
  134. package/fesm2022/rxap-form-system.mjs.map +1 -1
  135. package/lib/directives/array/form-array-item-button.d.ts +1 -1
  136. package/package.json +42 -45
  137. package/theme.css +177 -1
  138. package/esm2022/index.mjs +0 -54
  139. package/esm2022/lib/control-data-source.mjs +0 -40
  140. package/esm2022/lib/control-with-data-source.mjs +0 -2
  141. package/esm2022/lib/decorators/metadata-keys.mjs +0 -8
  142. package/esm2022/lib/decorators/use-component.mjs +0 -9
  143. package/esm2022/lib/decorators/use-data-source.mjs +0 -12
  144. package/esm2022/lib/decorators/use-form-component.mjs +0 -13
  145. package/esm2022/lib/directives/array/for-form-array-items.directive.mjs +0 -64
  146. package/esm2022/lib/directives/array/form-array-add-item-button.directive.mjs +0 -61
  147. package/esm2022/lib/directives/array/form-array-item-button.mjs +0 -80
  148. package/esm2022/lib/directives/array/form-array-item-remove-button.directive.mjs +0 -47
  149. package/esm2022/lib/directives/array/form-array-item-restore-button.directive.mjs +0 -30
  150. package/esm2022/lib/directives/array/form-array-removable.directive.mjs +0 -68
  151. package/esm2022/lib/directives/autocomplete-options-from-method.directive.mjs +0 -182
  152. package/esm2022/lib/directives/control-hide-show.directive.mjs +0 -172
  153. package/esm2022/lib/directives/form-directives.module.mjs +0 -25
  154. package/esm2022/lib/directives/input-select-options.directive.mjs +0 -181
  155. package/esm2022/lib/directives/options-from-method.directive.mjs +0 -95
  156. package/esm2022/lib/directives/options-from-remote-method.directive.mjs +0 -132
  157. package/esm2022/lib/directives/test-ng-control.mjs +0 -14
  158. package/esm2022/lib/error.mjs +0 -7
  159. package/esm2022/lib/form-context-from-activated-route.factory.mjs +0 -4
  160. package/esm2022/lib/form-system-control.directive.mjs +0 -147
  161. package/esm2022/lib/mixins/adapters.mjs +0 -13
  162. package/esm2022/lib/mixins/apply-use-function.adapters.mjs +0 -32
  163. package/esm2022/lib/mixins/apply-use-method.adapters.mjs +0 -33
  164. package/esm2022/lib/mixins/extract-control-from-parent.mixin.mjs +0 -23
  165. package/esm2022/lib/mixins/extract-control.mixin.mjs +0 -17
  166. package/esm2022/lib/mixins/extract-data-sources.mixin.mjs +0 -16
  167. package/esm2022/lib/mixins/extract-form-definition.mixin.mjs +0 -12
  168. package/esm2022/lib/mixins/extract-function.mixin.mjs +0 -22
  169. package/esm2022/lib/mixins/extract-functions.mixin.mjs +0 -26
  170. package/esm2022/lib/mixins/extract-is-value-function.mixin.mjs +0 -22
  171. package/esm2022/lib/mixins/extract-method.mixin.mjs +0 -20
  172. package/esm2022/lib/mixins/extract-methods.mixin.mjs +0 -21
  173. package/esm2022/lib/mixins/extract-options-data-source.mixin.mjs +0 -59
  174. package/esm2022/lib/mixins/extract-options-method.mixin.mjs +0 -22
  175. package/esm2022/lib/mixins/extract-resolve-method.mixin.mjs +0 -22
  176. package/esm2022/lib/mixins/extract-to-display-function.mixin.mjs +0 -22
  177. package/esm2022/lib/submit-context-form-adapter.factory.mjs +0 -32
  178. package/esm2022/lib/validators/is-equal-to.mjs +0 -60
  179. package/esm2022/lib/validators/is-selectable-value.directive.mjs +0 -82
  180. package/esm2022/rxap-form-system.mjs +0 -5
@@ -206,7 +206,46 @@
206
206
  </div>
207
207
 
208
208
  <div class="tab-pane fade " id="readme">
209
- <p><h1>Test</h1>
209
+ <p><h1>Autocomplete Table Select</h1>
210
+ <h1>With Rxap form System</h1>
211
+ <b>Example :</b><div><pre class="line-numbers"><code class="language-angular2html">
212
+ &lt;mat-form-field&gt;
213
+ &lt;mat-label&gt;Company&lt;/mat-label&gt;
214
+ &lt;input type=&quot;text&quot;
215
+ placeholder=&quot;Enter Company Name&quot;
216
+ matInput
217
+ formControlName=&quot;company&quot;
218
+ [matAutocomplete]=&quot;auto&quot;&gt;
219
+ &lt;!-- The autocomplete input --&gt;
220
+ &lt;mat-autocomplete #auto=&quot;matAutocomplete&quot;&gt;
221
+ &lt;mat-option *rxapAutocompleteOptionsFromMethod=&quot;let option; matAutocomplete: auto&quot;
222
+ [value]=&quot;option.value&quot;&gt;{{ option.display }}
223
+ &lt;/mat-option&gt;
224
+ &lt;/mat-autocomplete&gt;
225
+ &lt;button mat-icon-button rxapInputClearButton matSuffix&gt;
226
+ &lt;mat-icon&gt;clear&lt;/mat-icon&gt;
227
+ &lt;/button&gt;
228
+ &lt;/mat-form-field&gt;</code></pre></div><b>Example :</b><div><pre class="line-numbers"><code class="language-typescript">&#64;Injectable()
229
+ &#64;RxapForm(&#39;form&#39;)
230
+ export class Form {
231
+
232
+ // ensure the table data source is provided - in root or in the form component
233
+ &#64;UseAutocompleteOptionsMethod(SearchCompanyMethod)
234
+ // ensure the table data source is provided - in root or in the form component
235
+ &#64;UseAutocompleteResolveMethod(GetCompanyMethod)
236
+ &#64;UseFormControl()
237
+ company!: RxapFromControl&lt;Company&gt;;
238
+
239
+ }</code></pre></div><p>The DataSource <code>CompanyGuiTableDataSource</code> is used to populate the table in the selection window. Ensure that this DataSource is of the type <code>AbstractTableDataSource</code>.</p>
240
+ <p>The Method <code>SearchCompanyMethod</code> is used by the autocomplete control to search for a list of matching selection options. The Method must accept a string as the first argument and return a list of <code>ControlOption</code> objects.</p>
241
+ <p>The Method <code>GetCompanyMethod</code> is used to resolve the selected value. The Method must accept a the value of the form control as the first argument and return a <code>ControlOption</code> object.</p>
242
+ <b>Example :</b><div><pre class="line-numbers"><code class="language-typescript">export class SearchCompanyMethod implements Method&lt;ControlOptions, { parameters: { search?: string | null } }&gt; { ... }
243
+ export class GetCompanyMethod implements Method&lt;ControlOption, { parameters: { value: string } }&gt; { ... }</code></pre></div><h1>Method Parameter Adopter</h1>
244
+ <p>By default the following adopter function is used by the <code>@UseAutocompleteOptionsMethod</code> and <code>@UseAutocompleteResolveMethod</code> decorators.</p>
245
+ <b>Example :</b><div><pre class="line-numbers"><code class="language-typescript">(parameters) =&gt; ({parameters})</code></pre></div><p>To override this default adopter function use the second argument of the decorator.</p>
246
+ <b>Example :</b><div><pre class="line-numbers"><code class="language-typescript">&#64;UseAutocompleteOptionsMethod(SearchCompanyMethod, { adapter: { parameter: (parameters) =&gt; ({ search: parameters.search }) } })</code></pre></div><blockquote>
247
+ <p>The adapter function are called in an injection context, so it is possible to use the <code>inject</code> function</p>
248
+ </blockquote>
210
249
  </p>
211
250
  </div>
212
251
 
@@ -215,6 +254,7 @@
215
254
  AfterViewInit,
216
255
  Directive,
217
256
  inject,
257
+ Injectable,
218
258
  Injector,
219
259
  INJECTOR,
220
260
  Input,
@@ -231,12 +271,23 @@ import { Mixin } from &#x27;@rxap/mixin&#x27;;
231
271
  import { NgControl } from &#x27;@angular/forms&#x27;;
232
272
  import { MatFormField } from &#x27;@angular/material/form-field&#x27;;
233
273
  import { isDefined } from &#x27;@rxap/rxjs&#x27;;
274
+ import { ExtractControlMixin } from &#x27;../mixins/extract-control.mixin&#x27;;
275
+ import { ExtractFormDefinitionMixin } from &#x27;../mixins/extract-form-definition.mixin&#x27;;
276
+ import {
277
+ ExtractIsValueFunctionMixin,
278
+ UseIsValueFunction,
279
+ } from &#x27;../mixins/extract-is-value-function.mixin&#x27;;
280
+ import { ExtractMethodMixin } from &#x27;../mixins/extract-method.mixin&#x27;;
234
281
  import { UseMethodConfig } from &#x27;../mixins/extract-methods.mixin&#x27;;
235
282
  import { UseOptionsMethod } from &#x27;../mixins/extract-options-method.mixin&#x27;;
236
283
  import {
237
284
  ExtractResolveMethodMixin,
238
285
  UseResolveMethod,
239
286
  } from &#x27;../mixins/extract-resolve-method.mixin&#x27;;
287
+ import {
288
+ ExtractToDisplayFunctionMixin,
289
+ UseToDisplayFunction,
290
+ } from &#x27;../mixins/extract-to-display-function.mixin&#x27;;
240
291
  import { OptionsFromMethodDirective, OptionsFromMethodDirectiveSettings } from &#x27;./options-from-method.directive&#x27;;
241
292
  import { OpenApiRemoteMethodParameter } from &#x27;@rxap/open-api/remote-method&#x27;;
242
293
  import { controlValueChanges$ } from &#x27;@rxap/forms&#x27;;
@@ -269,6 +320,18 @@ export function UseAutocompleteResolveMethod&lt;Value &#x3D; unknown&gt;(
269
320
  return UseResolveMethod(method, config);
270
321
  }
271
322
 
323
+ export function UseAutocompleteIsValueFunction(
324
+ isValue: (value: any) &#x3D;&gt; boolean,
325
+ ): any {
326
+ return UseIsValueFunction(isValue);
327
+ }
328
+
329
+ export function UseAutocompleteToDisplayFunction(
330
+ toDisplay: (value: any) &#x3D;&gt; string,
331
+ ): any {
332
+ return UseToDisplayFunction(toDisplay);
333
+ }
334
+
272
335
  export interface AutocompleteOptionsFromRemoteMethodTemplateContext {
273
336
  $implicit: ControlOption;
274
337
  }
@@ -283,10 +346,19 @@ export interface AutocompleteOptionsFromMethodDirectiveParameters&lt;Value &#x3D
283
346
 
284
347
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
285
348
  export interface AutocompleteOptionsFromMethodDirective&lt;Value &#x3D; any, Parameters extends AutocompleteOptionsFromMethodDirectiveParameters&lt;Value&gt; &#x3D; AutocompleteOptionsFromMethodDirectiveParameters&lt;Value&gt;&gt;
286
- extends ExtractResolveMethodMixin, AfterViewInit, OnDestroy {
349
+ extends ExtractResolveMethodMixin, ExtractIsValueFunctionMixin, ExtractToDisplayFunctionMixin, AfterViewInit, OnDestroy {
287
350
  }
288
351
 
289
- @Mixin(ExtractResolveMethodMixin)
352
+ @Injectable({ providedIn: &#x27;root&#x27; })
353
+ export class NoopResolveMethod&lt;Value&gt; implements Method&lt;ControlOption, { value: Value }&gt; {
354
+
355
+ call({ value } : { value: Value }): Promise&lt;ControlOption&gt; {
356
+ return Promise.resolve({ value, display: value + &#x27;&#x27; });
357
+ }
358
+
359
+ }
360
+
361
+ @Mixin(ExtractResolveMethodMixin, ExtractIsValueFunctionMixin, ExtractToDisplayFunctionMixin)
290
362
  @Directive({
291
363
  // eslint-disable-next-line @angular-eslint/directive-selector
292
364
  selector: &#x27;[rxapAutocompleteOptionsFromMethod]&#x27;,
@@ -315,6 +387,13 @@ export class AutocompleteOptionsFromMethodDirective&lt;Value &#x3D; any, Paramet
315
387
  // eslint-disable-next-line @angular-eslint/no-input-rename
316
388
  @Input(&#x27;rxapAutocompleteOptionsFromMethodResolve&#x27;)
317
389
  public resolveMethod?: MethodWithParameters&lt;ControlOption, { value: Value } &amp; Parameters&gt;;
390
+
391
+ @Input(&#x27;rxapAutocompleteOptionsFromMethodIsValue&#x27;)
392
+ public isValue?: (value: any) &#x3D;&gt; boolean;
393
+
394
+ @Input(&#x27;rxapAutocompleteOptionsFromMethodToDisplay&#x27;)
395
+ public toDisplay?: (value: any) &#x3D;&gt; string;
396
+
318
397
  protected override ngControl: NgControl | null &#x3D; null;
319
398
  protected override matFormField: MatFormField | null &#x3D; null;
320
399
  protected override injector: Injector &#x3D; inject(INJECTOR);
@@ -336,12 +415,22 @@ export class AutocompleteOptionsFromMethodDirective&lt;Value &#x3D; any, Paramet
336
415
 
337
416
  public override async ngAfterViewInit() {
338
417
  if (this.matAutocomplete) {
339
- this.matAutocomplete.displayWith &#x3D; this.toDisplay.bind(this);
340
418
  this.settings ??&#x3D; {};
341
419
  this.settings.filteredOptions ??&#x3D; true;
342
420
  }
343
421
  await super.ngAfterViewInit();
344
422
  this.resolveMethod ??&#x3D; this.extractResolveMethod();
423
+ this.isValue ??&#x3D; this.extractIsValueFunction((value: any) &#x3D;&gt; typeof value &#x3D;&#x3D;&#x3D; &#x27;string&#x27; &amp;&amp; isUUID(value));
424
+ this.toDisplay ??&#x3D; this.extractToDisplayFunction((value: any): string &#x3D;&gt; {
425
+ if (!value) {
426
+ return &#x27;&#x27;;
427
+ }
428
+ const option &#x3D; this.findOptionByValue(value);
429
+ return option?.display ?? (isDevMode() ? &#x27;to display error&#x27; : &#x27;...&#x27;);
430
+ });
431
+ if (this.matAutocomplete) {
432
+ this.matAutocomplete.displayWith &#x3D; this.toDisplay.bind(this);
433
+ }
345
434
  if (!this.control) {
346
435
  throw new Error(&#x27;The control is not yet defined&#x27;);
347
436
  }
@@ -354,32 +443,20 @@ export class AutocompleteOptionsFromMethodDirective&lt;Value &#x3D; any, Paramet
354
443
  distinctUntilChanged(),
355
444
  tap(async value &#x3D;&gt; {
356
445
  this.setOptions(await this.loadOptions(this.parameters));
357
- if (this.isValue(value)) {
446
+ if (this.isValue?.(value)) {
358
447
  this.triggerAutocompleteToDisplay();
359
448
  }
360
449
  }),
361
450
  ).subscribe();
362
451
  }
363
452
 
364
- public toDisplay(value: any): string {
365
- if (!value) {
366
- return &#x27;&#x27;;
367
- }
368
- const option &#x3D; this.findOptionByValue(value);
369
- return option?.display ?? (isDevMode() ? &#x27;to display error&#x27; : &#x27;...&#x27;);
370
- }
371
-
372
- public isValue(value: any): boolean {
373
- return typeof value &#x3D;&#x3D;&#x3D; &#x27;string&#x27; &amp;&amp; isUUID(value);
374
- }
375
-
376
453
  protected override loadOptions(parameters: Parameters &#x3D; {} as Parameters): Promise&lt;ControlOptions | null&gt; {
377
454
  if (!this.control) {
378
455
  throw new Error(&#x27;The control is not yet defined&#x27;);
379
456
  }
380
457
  const value &#x3D; this.control?.value;
381
458
  const c_parameters &#x3D; {...parameters};
382
- if (this.isValue(value)) {
459
+ if (this.isValue?.(value)) {
383
460
  return this.resolveValue(value, c_parameters);
384
461
  } else {
385
462
  c_parameters.search ??&#x3D; value;
@@ -212,7 +212,46 @@
212
212
  </div>
213
213
 
214
214
  <div class="tab-pane fade " id="readme">
215
- <p><h1>Test</h1>
215
+ <p><h1>Autocomplete Table Select</h1>
216
+ <h1>With Rxap form System</h1>
217
+ <b>Example :</b><div><pre class="line-numbers"><code class="language-angular2html">
218
+ &lt;mat-form-field&gt;
219
+ &lt;mat-label&gt;Company&lt;/mat-label&gt;
220
+ &lt;input type=&quot;text&quot;
221
+ placeholder=&quot;Enter Company Name&quot;
222
+ matInput
223
+ formControlName=&quot;company&quot;
224
+ [matAutocomplete]=&quot;auto&quot;&gt;
225
+ &lt;!-- The autocomplete input --&gt;
226
+ &lt;mat-autocomplete #auto=&quot;matAutocomplete&quot;&gt;
227
+ &lt;mat-option *rxapAutocompleteOptionsFromMethod=&quot;let option; matAutocomplete: auto&quot;
228
+ [value]=&quot;option.value&quot;&gt;{{ option.display }}
229
+ &lt;/mat-option&gt;
230
+ &lt;/mat-autocomplete&gt;
231
+ &lt;button mat-icon-button rxapInputClearButton matSuffix&gt;
232
+ &lt;mat-icon&gt;clear&lt;/mat-icon&gt;
233
+ &lt;/button&gt;
234
+ &lt;/mat-form-field&gt;</code></pre></div><b>Example :</b><div><pre class="line-numbers"><code class="language-typescript">&#64;Injectable()
235
+ &#64;RxapForm(&#39;form&#39;)
236
+ export class Form {
237
+
238
+ // ensure the table data source is provided - in root or in the form component
239
+ &#64;UseAutocompleteOptionsMethod(SearchCompanyMethod)
240
+ // ensure the table data source is provided - in root or in the form component
241
+ &#64;UseAutocompleteResolveMethod(GetCompanyMethod)
242
+ &#64;UseFormControl()
243
+ company!: RxapFromControl&lt;Company&gt;;
244
+
245
+ }</code></pre></div><p>The DataSource <code>CompanyGuiTableDataSource</code> is used to populate the table in the selection window. Ensure that this DataSource is of the type <code>AbstractTableDataSource</code>.</p>
246
+ <p>The Method <code>SearchCompanyMethod</code> is used by the autocomplete control to search for a list of matching selection options. The Method must accept a string as the first argument and return a list of <code>ControlOption</code> objects.</p>
247
+ <p>The Method <code>GetCompanyMethod</code> is used to resolve the selected value. The Method must accept a the value of the form control as the first argument and return a <code>ControlOption</code> object.</p>
248
+ <b>Example :</b><div><pre class="line-numbers"><code class="language-typescript">export class SearchCompanyMethod implements Method&lt;ControlOptions, { parameters: { search?: string | null } }&gt; { ... }
249
+ export class GetCompanyMethod implements Method&lt;ControlOption, { parameters: { value: string } }&gt; { ... }</code></pre></div><h1>Method Parameter Adopter</h1>
250
+ <p>By default the following adopter function is used by the <code>@UseAutocompleteOptionsMethod</code> and <code>@UseAutocompleteResolveMethod</code> decorators.</p>
251
+ <b>Example :</b><div><pre class="line-numbers"><code class="language-typescript">(parameters) =&gt; ({parameters})</code></pre></div><p>To override this default adopter function use the second argument of the decorator.</p>
252
+ <b>Example :</b><div><pre class="line-numbers"><code class="language-typescript">&#64;UseAutocompleteOptionsMethod(SearchCompanyMethod, { adapter: { parameter: (parameters) =&gt; ({ search: parameters.search }) } })</code></pre></div><blockquote>
253
+ <p>The adapter function are called in an injection context, so it is possible to use the <code>inject</code> function</p>
254
+ </blockquote>
216
255
  </p>
217
256
  </div>
218
257
 
@@ -221,6 +260,7 @@
221
260
  AfterViewInit,
222
261
  Directive,
223
262
  inject,
263
+ Injectable,
224
264
  Injector,
225
265
  INJECTOR,
226
266
  Input,
@@ -237,12 +277,23 @@ import { Mixin } from &#x27;@rxap/mixin&#x27;;
237
277
  import { NgControl } from &#x27;@angular/forms&#x27;;
238
278
  import { MatFormField } from &#x27;@angular/material/form-field&#x27;;
239
279
  import { isDefined } from &#x27;@rxap/rxjs&#x27;;
280
+ import { ExtractControlMixin } from &#x27;../mixins/extract-control.mixin&#x27;;
281
+ import { ExtractFormDefinitionMixin } from &#x27;../mixins/extract-form-definition.mixin&#x27;;
282
+ import {
283
+ ExtractIsValueFunctionMixin,
284
+ UseIsValueFunction,
285
+ } from &#x27;../mixins/extract-is-value-function.mixin&#x27;;
286
+ import { ExtractMethodMixin } from &#x27;../mixins/extract-method.mixin&#x27;;
240
287
  import { UseMethodConfig } from &#x27;../mixins/extract-methods.mixin&#x27;;
241
288
  import { UseOptionsMethod } from &#x27;../mixins/extract-options-method.mixin&#x27;;
242
289
  import {
243
290
  ExtractResolveMethodMixin,
244
291
  UseResolveMethod,
245
292
  } from &#x27;../mixins/extract-resolve-method.mixin&#x27;;
293
+ import {
294
+ ExtractToDisplayFunctionMixin,
295
+ UseToDisplayFunction,
296
+ } from &#x27;../mixins/extract-to-display-function.mixin&#x27;;
246
297
  import { OptionsFromMethodDirective, OptionsFromMethodDirectiveSettings } from &#x27;./options-from-method.directive&#x27;;
247
298
  import { OpenApiRemoteMethodParameter } from &#x27;@rxap/open-api/remote-method&#x27;;
248
299
  import { controlValueChanges$ } from &#x27;@rxap/forms&#x27;;
@@ -275,6 +326,18 @@ export function UseAutocompleteResolveMethod&lt;Value &#x3D; unknown&gt;(
275
326
  return UseResolveMethod(method, config);
276
327
  }
277
328
 
329
+ export function UseAutocompleteIsValueFunction(
330
+ isValue: (value: any) &#x3D;&gt; boolean,
331
+ ): any {
332
+ return UseIsValueFunction(isValue);
333
+ }
334
+
335
+ export function UseAutocompleteToDisplayFunction(
336
+ toDisplay: (value: any) &#x3D;&gt; string,
337
+ ): any {
338
+ return UseToDisplayFunction(toDisplay);
339
+ }
340
+
278
341
  export interface AutocompleteOptionsFromRemoteMethodTemplateContext {
279
342
  $implicit: ControlOption;
280
343
  }
@@ -289,10 +352,19 @@ export interface AutocompleteOptionsFromMethodDirectiveParameters&lt;Value &#x3D
289
352
 
290
353
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
291
354
  export interface AutocompleteOptionsFromMethodDirective&lt;Value &#x3D; any, Parameters extends AutocompleteOptionsFromMethodDirectiveParameters&lt;Value&gt; &#x3D; AutocompleteOptionsFromMethodDirectiveParameters&lt;Value&gt;&gt;
292
- extends ExtractResolveMethodMixin, AfterViewInit, OnDestroy {
355
+ extends ExtractResolveMethodMixin, ExtractIsValueFunctionMixin, ExtractToDisplayFunctionMixin, AfterViewInit, OnDestroy {
293
356
  }
294
357
 
295
- @Mixin(ExtractResolveMethodMixin)
358
+ @Injectable({ providedIn: &#x27;root&#x27; })
359
+ export class NoopResolveMethod&lt;Value&gt; implements Method&lt;ControlOption, { value: Value }&gt; {
360
+
361
+ call({ value } : { value: Value }): Promise&lt;ControlOption&gt; {
362
+ return Promise.resolve({ value, display: value + &#x27;&#x27; });
363
+ }
364
+
365
+ }
366
+
367
+ @Mixin(ExtractResolveMethodMixin, ExtractIsValueFunctionMixin, ExtractToDisplayFunctionMixin)
296
368
  @Directive({
297
369
  // eslint-disable-next-line @angular-eslint/directive-selector
298
370
  selector: &#x27;[rxapAutocompleteOptionsFromMethod]&#x27;,
@@ -321,6 +393,13 @@ export class AutocompleteOptionsFromMethodDirective&lt;Value &#x3D; any, Paramet
321
393
  // eslint-disable-next-line @angular-eslint/no-input-rename
322
394
  @Input(&#x27;rxapAutocompleteOptionsFromMethodResolve&#x27;)
323
395
  public resolveMethod?: MethodWithParameters&lt;ControlOption, { value: Value } &amp; Parameters&gt;;
396
+
397
+ @Input(&#x27;rxapAutocompleteOptionsFromMethodIsValue&#x27;)
398
+ public isValue?: (value: any) &#x3D;&gt; boolean;
399
+
400
+ @Input(&#x27;rxapAutocompleteOptionsFromMethodToDisplay&#x27;)
401
+ public toDisplay?: (value: any) &#x3D;&gt; string;
402
+
324
403
  protected override ngControl: NgControl | null &#x3D; null;
325
404
  protected override matFormField: MatFormField | null &#x3D; null;
326
405
  protected override injector: Injector &#x3D; inject(INJECTOR);
@@ -342,12 +421,22 @@ export class AutocompleteOptionsFromMethodDirective&lt;Value &#x3D; any, Paramet
342
421
 
343
422
  public override async ngAfterViewInit() {
344
423
  if (this.matAutocomplete) {
345
- this.matAutocomplete.displayWith &#x3D; this.toDisplay.bind(this);
346
424
  this.settings ??&#x3D; {};
347
425
  this.settings.filteredOptions ??&#x3D; true;
348
426
  }
349
427
  await super.ngAfterViewInit();
350
428
  this.resolveMethod ??&#x3D; this.extractResolveMethod();
429
+ this.isValue ??&#x3D; this.extractIsValueFunction((value: any) &#x3D;&gt; typeof value &#x3D;&#x3D;&#x3D; &#x27;string&#x27; &amp;&amp; isUUID(value));
430
+ this.toDisplay ??&#x3D; this.extractToDisplayFunction((value: any): string &#x3D;&gt; {
431
+ if (!value) {
432
+ return &#x27;&#x27;;
433
+ }
434
+ const option &#x3D; this.findOptionByValue(value);
435
+ return option?.display ?? (isDevMode() ? &#x27;to display error&#x27; : &#x27;...&#x27;);
436
+ });
437
+ if (this.matAutocomplete) {
438
+ this.matAutocomplete.displayWith &#x3D; this.toDisplay.bind(this);
439
+ }
351
440
  if (!this.control) {
352
441
  throw new Error(&#x27;The control is not yet defined&#x27;);
353
442
  }
@@ -360,32 +449,20 @@ export class AutocompleteOptionsFromMethodDirective&lt;Value &#x3D; any, Paramet
360
449
  distinctUntilChanged(),
361
450
  tap(async value &#x3D;&gt; {
362
451
  this.setOptions(await this.loadOptions(this.parameters));
363
- if (this.isValue(value)) {
452
+ if (this.isValue?.(value)) {
364
453
  this.triggerAutocompleteToDisplay();
365
454
  }
366
455
  }),
367
456
  ).subscribe();
368
457
  }
369
458
 
370
- public toDisplay(value: any): string {
371
- if (!value) {
372
- return &#x27;&#x27;;
373
- }
374
- const option &#x3D; this.findOptionByValue(value);
375
- return option?.display ?? (isDevMode() ? &#x27;to display error&#x27; : &#x27;...&#x27;);
376
- }
377
-
378
- public isValue(value: any): boolean {
379
- return typeof value &#x3D;&#x3D;&#x3D; &#x27;string&#x27; &amp;&amp; isUUID(value);
380
- }
381
-
382
459
  protected override loadOptions(parameters: Parameters &#x3D; {} as Parameters): Promise&lt;ControlOptions | null&gt; {
383
460
  if (!this.control) {
384
461
  throw new Error(&#x27;The control is not yet defined&#x27;);
385
462
  }
386
463
  const value &#x3D; this.control?.value;
387
464
  const c_parameters &#x3D; {...parameters};
388
- if (this.isValue(value)) {
465
+ if (this.isValue?.(value)) {
389
466
  return this.resolveValue(value, c_parameters);
390
467
  } else {
391
468
  c_parameters.search ??&#x3D; value;
@@ -200,7 +200,46 @@
200
200
  </div>
201
201
 
202
202
  <div class="tab-pane fade " id="readme">
203
- <p><h1>Test</h1>
203
+ <p><h1>Autocomplete Table Select</h1>
204
+ <h1>With Rxap form System</h1>
205
+ <b>Example :</b><div><pre class="line-numbers"><code class="language-angular2html">
206
+ &lt;mat-form-field&gt;
207
+ &lt;mat-label&gt;Company&lt;/mat-label&gt;
208
+ &lt;input type=&quot;text&quot;
209
+ placeholder=&quot;Enter Company Name&quot;
210
+ matInput
211
+ formControlName=&quot;company&quot;
212
+ [matAutocomplete]=&quot;auto&quot;&gt;
213
+ &lt;!-- The autocomplete input --&gt;
214
+ &lt;mat-autocomplete #auto=&quot;matAutocomplete&quot;&gt;
215
+ &lt;mat-option *rxapAutocompleteOptionsFromMethod=&quot;let option; matAutocomplete: auto&quot;
216
+ [value]=&quot;option.value&quot;&gt;{{ option.display }}
217
+ &lt;/mat-option&gt;
218
+ &lt;/mat-autocomplete&gt;
219
+ &lt;button mat-icon-button rxapInputClearButton matSuffix&gt;
220
+ &lt;mat-icon&gt;clear&lt;/mat-icon&gt;
221
+ &lt;/button&gt;
222
+ &lt;/mat-form-field&gt;</code></pre></div><b>Example :</b><div><pre class="line-numbers"><code class="language-typescript">&#64;Injectable()
223
+ &#64;RxapForm(&#39;form&#39;)
224
+ export class Form {
225
+
226
+ // ensure the table data source is provided - in root or in the form component
227
+ &#64;UseAutocompleteOptionsMethod(SearchCompanyMethod)
228
+ // ensure the table data source is provided - in root or in the form component
229
+ &#64;UseAutocompleteResolveMethod(GetCompanyMethod)
230
+ &#64;UseFormControl()
231
+ company!: RxapFromControl&lt;Company&gt;;
232
+
233
+ }</code></pre></div><p>The DataSource <code>CompanyGuiTableDataSource</code> is used to populate the table in the selection window. Ensure that this DataSource is of the type <code>AbstractTableDataSource</code>.</p>
234
+ <p>The Method <code>SearchCompanyMethod</code> is used by the autocomplete control to search for a list of matching selection options. The Method must accept a string as the first argument and return a list of <code>ControlOption</code> objects.</p>
235
+ <p>The Method <code>GetCompanyMethod</code> is used to resolve the selected value. The Method must accept a the value of the form control as the first argument and return a <code>ControlOption</code> object.</p>
236
+ <b>Example :</b><div><pre class="line-numbers"><code class="language-typescript">export class SearchCompanyMethod implements Method&lt;ControlOptions, { parameters: { search?: string | null } }&gt; { ... }
237
+ export class GetCompanyMethod implements Method&lt;ControlOption, { parameters: { value: string } }&gt; { ... }</code></pre></div><h1>Method Parameter Adopter</h1>
238
+ <p>By default the following adopter function is used by the <code>@UseAutocompleteOptionsMethod</code> and <code>@UseAutocompleteResolveMethod</code> decorators.</p>
239
+ <b>Example :</b><div><pre class="line-numbers"><code class="language-typescript">(parameters) =&gt; ({parameters})</code></pre></div><p>To override this default adopter function use the second argument of the decorator.</p>
240
+ <b>Example :</b><div><pre class="line-numbers"><code class="language-typescript">&#64;UseAutocompleteOptionsMethod(SearchCompanyMethod, { adapter: { parameter: (parameters) =&gt; ({ search: parameters.search }) } })</code></pre></div><blockquote>
241
+ <p>The adapter function are called in an injection context, so it is possible to use the <code>inject</code> function</p>
242
+ </blockquote>
204
243
  </p>
205
244
  </div>
206
245
 
@@ -209,6 +248,7 @@
209
248
  AfterViewInit,
210
249
  Directive,
211
250
  inject,
251
+ Injectable,
212
252
  Injector,
213
253
  INJECTOR,
214
254
  Input,
@@ -225,12 +265,23 @@ import { Mixin } from &#x27;@rxap/mixin&#x27;;
225
265
  import { NgControl } from &#x27;@angular/forms&#x27;;
226
266
  import { MatFormField } from &#x27;@angular/material/form-field&#x27;;
227
267
  import { isDefined } from &#x27;@rxap/rxjs&#x27;;
268
+ import { ExtractControlMixin } from &#x27;../mixins/extract-control.mixin&#x27;;
269
+ import { ExtractFormDefinitionMixin } from &#x27;../mixins/extract-form-definition.mixin&#x27;;
270
+ import {
271
+ ExtractIsValueFunctionMixin,
272
+ UseIsValueFunction,
273
+ } from &#x27;../mixins/extract-is-value-function.mixin&#x27;;
274
+ import { ExtractMethodMixin } from &#x27;../mixins/extract-method.mixin&#x27;;
228
275
  import { UseMethodConfig } from &#x27;../mixins/extract-methods.mixin&#x27;;
229
276
  import { UseOptionsMethod } from &#x27;../mixins/extract-options-method.mixin&#x27;;
230
277
  import {
231
278
  ExtractResolveMethodMixin,
232
279
  UseResolveMethod,
233
280
  } from &#x27;../mixins/extract-resolve-method.mixin&#x27;;
281
+ import {
282
+ ExtractToDisplayFunctionMixin,
283
+ UseToDisplayFunction,
284
+ } from &#x27;../mixins/extract-to-display-function.mixin&#x27;;
234
285
  import { OptionsFromMethodDirective, OptionsFromMethodDirectiveSettings } from &#x27;./options-from-method.directive&#x27;;
235
286
  import { OpenApiRemoteMethodParameter } from &#x27;@rxap/open-api/remote-method&#x27;;
236
287
  import { controlValueChanges$ } from &#x27;@rxap/forms&#x27;;
@@ -263,6 +314,18 @@ export function UseAutocompleteResolveMethod&lt;Value &#x3D; unknown&gt;(
263
314
  return UseResolveMethod(method, config);
264
315
  }
265
316
 
317
+ export function UseAutocompleteIsValueFunction(
318
+ isValue: (value: any) &#x3D;&gt; boolean,
319
+ ): any {
320
+ return UseIsValueFunction(isValue);
321
+ }
322
+
323
+ export function UseAutocompleteToDisplayFunction(
324
+ toDisplay: (value: any) &#x3D;&gt; string,
325
+ ): any {
326
+ return UseToDisplayFunction(toDisplay);
327
+ }
328
+
266
329
  export interface AutocompleteOptionsFromRemoteMethodTemplateContext {
267
330
  $implicit: ControlOption;
268
331
  }
@@ -277,10 +340,19 @@ export interface AutocompleteOptionsFromMethodDirectiveParameters&lt;Value &#x3D
277
340
 
278
341
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
279
342
  export interface AutocompleteOptionsFromMethodDirective&lt;Value &#x3D; any, Parameters extends AutocompleteOptionsFromMethodDirectiveParameters&lt;Value&gt; &#x3D; AutocompleteOptionsFromMethodDirectiveParameters&lt;Value&gt;&gt;
280
- extends ExtractResolveMethodMixin, AfterViewInit, OnDestroy {
343
+ extends ExtractResolveMethodMixin, ExtractIsValueFunctionMixin, ExtractToDisplayFunctionMixin, AfterViewInit, OnDestroy {
281
344
  }
282
345
 
283
- @Mixin(ExtractResolveMethodMixin)
346
+ @Injectable({ providedIn: &#x27;root&#x27; })
347
+ export class NoopResolveMethod&lt;Value&gt; implements Method&lt;ControlOption, { value: Value }&gt; {
348
+
349
+ call({ value } : { value: Value }): Promise&lt;ControlOption&gt; {
350
+ return Promise.resolve({ value, display: value + &#x27;&#x27; });
351
+ }
352
+
353
+ }
354
+
355
+ @Mixin(ExtractResolveMethodMixin, ExtractIsValueFunctionMixin, ExtractToDisplayFunctionMixin)
284
356
  @Directive({
285
357
  // eslint-disable-next-line @angular-eslint/directive-selector
286
358
  selector: &#x27;[rxapAutocompleteOptionsFromMethod]&#x27;,
@@ -309,6 +381,13 @@ export class AutocompleteOptionsFromMethodDirective&lt;Value &#x3D; any, Paramet
309
381
  // eslint-disable-next-line @angular-eslint/no-input-rename
310
382
  @Input(&#x27;rxapAutocompleteOptionsFromMethodResolve&#x27;)
311
383
  public resolveMethod?: MethodWithParameters&lt;ControlOption, { value: Value } &amp; Parameters&gt;;
384
+
385
+ @Input(&#x27;rxapAutocompleteOptionsFromMethodIsValue&#x27;)
386
+ public isValue?: (value: any) &#x3D;&gt; boolean;
387
+
388
+ @Input(&#x27;rxapAutocompleteOptionsFromMethodToDisplay&#x27;)
389
+ public toDisplay?: (value: any) &#x3D;&gt; string;
390
+
312
391
  protected override ngControl: NgControl | null &#x3D; null;
313
392
  protected override matFormField: MatFormField | null &#x3D; null;
314
393
  protected override injector: Injector &#x3D; inject(INJECTOR);
@@ -330,12 +409,22 @@ export class AutocompleteOptionsFromMethodDirective&lt;Value &#x3D; any, Paramet
330
409
 
331
410
  public override async ngAfterViewInit() {
332
411
  if (this.matAutocomplete) {
333
- this.matAutocomplete.displayWith &#x3D; this.toDisplay.bind(this);
334
412
  this.settings ??&#x3D; {};
335
413
  this.settings.filteredOptions ??&#x3D; true;
336
414
  }
337
415
  await super.ngAfterViewInit();
338
416
  this.resolveMethod ??&#x3D; this.extractResolveMethod();
417
+ this.isValue ??&#x3D; this.extractIsValueFunction((value: any) &#x3D;&gt; typeof value &#x3D;&#x3D;&#x3D; &#x27;string&#x27; &amp;&amp; isUUID(value));
418
+ this.toDisplay ??&#x3D; this.extractToDisplayFunction((value: any): string &#x3D;&gt; {
419
+ if (!value) {
420
+ return &#x27;&#x27;;
421
+ }
422
+ const option &#x3D; this.findOptionByValue(value);
423
+ return option?.display ?? (isDevMode() ? &#x27;to display error&#x27; : &#x27;...&#x27;);
424
+ });
425
+ if (this.matAutocomplete) {
426
+ this.matAutocomplete.displayWith &#x3D; this.toDisplay.bind(this);
427
+ }
339
428
  if (!this.control) {
340
429
  throw new Error(&#x27;The control is not yet defined&#x27;);
341
430
  }
@@ -348,32 +437,20 @@ export class AutocompleteOptionsFromMethodDirective&lt;Value &#x3D; any, Paramet
348
437
  distinctUntilChanged(),
349
438
  tap(async value &#x3D;&gt; {
350
439
  this.setOptions(await this.loadOptions(this.parameters));
351
- if (this.isValue(value)) {
440
+ if (this.isValue?.(value)) {
352
441
  this.triggerAutocompleteToDisplay();
353
442
  }
354
443
  }),
355
444
  ).subscribe();
356
445
  }
357
446
 
358
- public toDisplay(value: any): string {
359
- if (!value) {
360
- return &#x27;&#x27;;
361
- }
362
- const option &#x3D; this.findOptionByValue(value);
363
- return option?.display ?? (isDevMode() ? &#x27;to display error&#x27; : &#x27;...&#x27;);
364
- }
365
-
366
- public isValue(value: any): boolean {
367
- return typeof value &#x3D;&#x3D;&#x3D; &#x27;string&#x27; &amp;&amp; isUUID(value);
368
- }
369
-
370
447
  protected override loadOptions(parameters: Parameters &#x3D; {} as Parameters): Promise&lt;ControlOptions | null&gt; {
371
448
  if (!this.control) {
372
449
  throw new Error(&#x27;The control is not yet defined&#x27;);
373
450
  }
374
451
  const value &#x3D; this.control?.value;
375
452
  const c_parameters &#x3D; {...parameters};
376
- if (this.isValue(value)) {
453
+ if (this.isValue?.(value)) {
377
454
  return this.resolveValue(value, c_parameters);
378
455
  } else {
379
456
  c_parameters.search ??&#x3D; value;
@@ -140,6 +140,7 @@
140
140
  ChangeDetectorRef,
141
141
  Directive,
142
142
  inject,
143
+ InjectFlags,
143
144
  INJECTOR,
144
145
  Injector,
145
146
  Input,
@@ -211,7 +212,7 @@ export class OptionsFromMethodDirective&lt;Value &#x3D; any, Parameters &#x3D; a
211
212
 
212
213
  public async ngAfterViewInit() {
213
214
  this.matFormField &#x3D; this.injector.get(MatFormField, null);
214
- this.ngControl &#x3D; this.injector.get(NgControl, this.matFormField?._control.ngControl);
215
+ this.ngControl &#x3D; this.matFormField?._control.ngControl ?? this.injector.get(NgControl, null);
215
216
  this.control &#x3D; (this.ngControl?.control as RxapFormControl) ?? undefined;
216
217
  this.method ??&#x3D; this.extractOptionsMethod();
217
218
  // ensure that the options are loaded. It is possible that the ngOnChange is triggered before the ngAfterViewInit
@@ -200,6 +200,7 @@
200
200
  ChangeDetectorRef,
201
201
  Directive,
202
202
  inject,
203
+ InjectFlags,
203
204
  INJECTOR,
204
205
  Injector,
205
206
  Input,
@@ -271,7 +272,7 @@ export class OptionsFromMethodDirective&lt;Value &#x3D; any, Parameters &#x3D; a
271
272
 
272
273
  public async ngAfterViewInit() {
273
274
  this.matFormField &#x3D; this.injector.get(MatFormField, null);
274
- this.ngControl &#x3D; this.injector.get(NgControl, this.matFormField?._control.ngControl);
275
+ this.ngControl &#x3D; this.matFormField?._control.ngControl ?? this.injector.get(NgControl, null);
275
276
  this.control &#x3D; (this.ngControl?.control as RxapFormControl) ?? undefined;
276
277
  this.method ??&#x3D; this.extractOptionsMethod();
277
278
  // ensure that the options are loaded. It is possible that the ngOnChange is triggered before the ngAfterViewInit