@rxap/form-system 18.2.0-dev.0 → 18.2.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 (34) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/compodoc/changelog.html +25 -0
  3. package/compodoc/dependencies.html +18 -14
  4. package/compodoc/directives/AutocompleteOptionsFromMethodDirective.html +1367 -0
  5. package/compodoc/directives/FormArrayItemButton.html +58 -19
  6. package/compodoc/directives/FormArrayItemRemoveButtonDirective.html +113 -10
  7. package/compodoc/directives/FormArrayItemRestoreButtonDirective.html +43 -5
  8. package/compodoc/directives/FormArrayRemovableDirective.html +25 -20
  9. package/compodoc/directives/OptionsFromMethodDirective.html +71 -66
  10. package/compodoc/interfaces/AutocompleteOptionsFromMethodDirectiveParameters.html +512 -0
  11. package/compodoc/interfaces/AutocompleteOptionsFromMethodDirectiveSettings.html +518 -0
  12. package/compodoc/interfaces/AutocompleteOptionsFromRemoteMethodTemplateContext.html +506 -0
  13. package/compodoc/interfaces/OptionsFromMethodDirectiveSettings.html +26 -14
  14. package/compodoc/interfaces/OptionsFromMethodTemplateContext.html +26 -14
  15. package/compodoc/js/menu-wc.js +12 -0
  16. package/compodoc/js/menu-wc_es5.js +1 -1
  17. package/compodoc/js/search/search_index.js +2 -2
  18. package/compodoc/miscellaneous/functions.html +356 -0
  19. package/compodoc/overview.html +2 -2
  20. package/compodoc/properties.html +1 -1
  21. package/esm2022/lib/directives/autocomplete-options-from-method.directive.mjs +25 -9
  22. package/esm2022/lib/directives/options-from-method.directive.mjs +2 -2
  23. package/esm2022/lib/mixins/apply-use-function.adapters.mjs +32 -0
  24. package/esm2022/lib/mixins/extract-function.mixin.mjs +24 -0
  25. package/esm2022/lib/mixins/extract-functions.mixin.mjs +21 -0
  26. package/esm2022/lib/mixins/extract-is-value-function.mixin.mjs +22 -0
  27. package/fesm2022/rxap-form-system.mjs +109 -10
  28. package/fesm2022/rxap-form-system.mjs.map +1 -1
  29. package/lib/directives/autocomplete-options-from-method.directive.d.ts +14 -3
  30. package/lib/mixins/apply-use-function.adapters.d.ts +3 -0
  31. package/lib/mixins/extract-function.mixin.d.ts +9 -0
  32. package/lib/mixins/extract-functions.mixin.d.ts +19 -0
  33. package/lib/mixins/extract-is-value-function.mixin.d.ts +13 -0
  34. package/package.json +2 -2
@@ -184,10 +184,6 @@
184
184
  <span class="modifier">Protected</span>
185
185
  <a href="#matFormField" >matFormField</a>
186
186
  </li>
187
- <li>
188
- <span class="modifier">Protected</span>
189
- <a href="#method" >method</a>
190
- </li>
191
187
  <li>
192
188
  <span class="modifier">Protected</span>
193
189
  <a href="#ngControl" >ngControl</a>
@@ -246,6 +242,9 @@
246
242
  <tr>
247
243
  <td class="col-md-4">
248
244
  <ul class="index-list">
245
+ <li>
246
+ <a href="#rxapOptionsFromMethodCall" >rxapOptionsFromMethodCall</a>
247
+ </li>
249
248
  <li>
250
249
  <a href="#rxapOptionsFromMethodParameters" >rxapOptionsFromMethodParameters</a>
251
250
  </li>
@@ -266,6 +265,27 @@
266
265
 
267
266
  <section data-compodoc="block-inputs">
268
267
  <h3 id="inputs">Inputs</h3>
268
+ <table class="table table-sm table-bordered">
269
+ <tbody>
270
+ <tr>
271
+ <td class="col-md-4">
272
+ <a name="rxapOptionsFromMethodCall"></a>
273
+ <b>rxapOptionsFromMethodCall</b>
274
+ </td>
275
+ </tr>
276
+ <tr>
277
+ <td class="col-md-4">
278
+ <i>Type : </i> <code>Method&lt;ControlOptions | Parameters&gt;</code>
279
+
280
+ </td>
281
+ </tr>
282
+ <tr>
283
+ <td class="col-md-2" colspan="2">
284
+ <div class="io-line">Defined in <a href="" data-line="66" class="link-to-prism">src/lib/directives/options-from-method.directive.ts:66</a></div>
285
+ </td>
286
+ </tr>
287
+ </tbody>
288
+ </table>
269
289
  <table class="table table-sm table-bordered">
270
290
  <tbody>
271
291
  <tr>
@@ -282,7 +302,7 @@
282
302
  </tr>
283
303
  <tr>
284
304
  <td class="col-md-2" colspan="2">
285
- <div class="io-line">Defined in <a href="" data-line="54" class="link-to-prism">src/lib/directives/options-from-method.directive.ts:54</a></div>
305
+ <div class="io-line">Defined in <a href="" data-line="58" class="link-to-prism">src/lib/directives/options-from-method.directive.ts:58</a></div>
286
306
  </td>
287
307
  </tr>
288
308
  </tbody>
@@ -303,7 +323,7 @@
303
323
  </tr>
304
324
  <tr>
305
325
  <td class="col-md-2" colspan="2">
306
- <div class="io-line">Defined in <a href="" data-line="57" class="link-to-prism">src/lib/directives/options-from-method.directive.ts:57</a></div>
326
+ <div class="io-line">Defined in <a href="" data-line="61" class="link-to-prism">src/lib/directives/options-from-method.directive.ts:61</a></div>
307
327
  </td>
308
328
  </tr>
309
329
  </tbody>
@@ -340,8 +360,8 @@
340
360
 
341
361
  <tr>
342
362
  <td class="col-md-4">
343
- <div class="io-line">Defined in <a href="" data-line="93"
344
- class="link-to-prism">src/lib/directives/options-from-method.directive.ts:93</a></div>
363
+ <div class="io-line">Defined in <a href="" data-line="100"
364
+ class="link-to-prism">src/lib/directives/options-from-method.directive.ts:100</a></div>
345
365
  </td>
346
366
  </tr>
347
367
 
@@ -377,7 +397,7 @@
377
397
  </table>
378
398
  </div>
379
399
  <div class="io-description">
380
- <b>Returns : </b> <code>Promise&lt;ControlOptions&gt;</code>
400
+ <b>Returns : </b> <code>Promise&lt;ControlOptions | null&gt;</code>
381
401
 
382
402
  </div>
383
403
  <div class="io-description">
@@ -409,8 +429,8 @@
409
429
 
410
430
  <tr>
411
431
  <td class="col-md-4">
412
- <div class="io-line">Defined in <a href="" data-line="46"
413
- class="link-to-prism">src/lib/directives/options-from-method.directive.ts:46</a></div>
432
+ <div class="io-line">Defined in <a href="" data-line="50"
433
+ class="link-to-prism">src/lib/directives/options-from-method.directive.ts:50</a></div>
414
434
  </td>
415
435
  </tr>
416
436
 
@@ -490,8 +510,8 @@
490
510
 
491
511
  <tr>
492
512
  <td class="col-md-4">
493
- <div class="io-line">Defined in <a href="" data-line="97"
494
- class="link-to-prism">src/lib/directives/options-from-method.directive.ts:97</a></div>
513
+ <div class="io-line">Defined in <a href="" data-line="104"
514
+ class="link-to-prism">src/lib/directives/options-from-method.directive.ts:104</a></div>
495
515
  </td>
496
516
  </tr>
497
517
 
@@ -522,15 +542,15 @@
522
542
  <tr>
523
543
  <td class="col-md-4">
524
544
  <span class="modifier-icon icon ion-ios-reset"></span>
525
- <code>setOptions(options: ControlOptions)</code>
545
+ <code>setOptions(options: ControlOptions | null)</code>
526
546
  </td>
527
547
  </tr>
528
548
 
529
549
 
530
550
  <tr>
531
551
  <td class="col-md-4">
532
- <div class="io-line">Defined in <a href="" data-line="117"
533
- class="link-to-prism">src/lib/directives/options-from-method.directive.ts:117</a></div>
552
+ <div class="io-line">Defined in <a href="" data-line="124"
553
+ class="link-to-prism">src/lib/directives/options-from-method.directive.ts:124</a></div>
534
554
  </td>
535
555
  </tr>
536
556
 
@@ -553,7 +573,7 @@
553
573
  <tr>
554
574
  <td>options</td>
555
575
  <td>
556
- <code>ControlOptions</code>
576
+ <code>ControlOptions | null</code>
557
577
  </td>
558
578
 
559
579
  <td>
@@ -608,7 +628,7 @@
608
628
  </tr>
609
629
  <tr>
610
630
  <td class="col-md-4">
611
- <div class="io-line">Defined in <a href="" data-line="66" class="link-to-prism">src/lib/directives/options-from-method.directive.ts:66</a></div>
631
+ <div class="io-line">Defined in <a href="" data-line="72" class="link-to-prism">src/lib/directives/options-from-method.directive.ts:72</a></div>
612
632
  </td>
613
633
  </tr>
614
634
 
@@ -641,7 +661,7 @@
641
661
  </tr>
642
662
  <tr>
643
663
  <td class="col-md-4">
644
- <div class="io-line">Defined in <a href="" data-line="65" class="link-to-prism">src/lib/directives/options-from-method.directive.ts:65</a></div>
664
+ <div class="io-line">Defined in <a href="" data-line="71" class="link-to-prism">src/lib/directives/options-from-method.directive.ts:71</a></div>
645
665
  </td>
646
666
  </tr>
647
667
 
@@ -673,34 +693,7 @@
673
693
  </tr>
674
694
  <tr>
675
695
  <td class="col-md-4">
676
- <div class="io-line">Defined in <a href="" data-line="61" class="link-to-prism">src/lib/directives/options-from-method.directive.ts:61</a></div>
677
- </td>
678
- </tr>
679
-
680
-
681
- </tbody>
682
- </table>
683
- <table class="table table-sm table-bordered">
684
- <tbody>
685
- <tr>
686
- <td class="col-md-4">
687
- <a name="method"></a>
688
- <span class="name">
689
- <span class="modifier">Protected</span>
690
- <span ><b>method</b></span>
691
- <a href="#method"><span class="icon ion-ios-link"></span></a>
692
- </span>
693
- </td>
694
- </tr>
695
- <tr>
696
- <td class="col-md-4">
697
- <i>Type : </i> <code>Method&lt;ControlOptions | Parameters&gt;</code>
698
-
699
- </td>
700
- </tr>
701
- <tr>
702
- <td class="col-md-4">
703
- <div class="io-line">Defined in <a href="" data-line="63" class="link-to-prism">src/lib/directives/options-from-method.directive.ts:63</a></div>
696
+ <div class="io-line">Defined in <a href="" data-line="68" class="link-to-prism">src/lib/directives/options-from-method.directive.ts:68</a></div>
704
697
  </td>
705
698
  </tr>
706
699
 
@@ -721,7 +714,7 @@
721
714
  </tr>
722
715
  <tr>
723
716
  <td class="col-md-4">
724
- <i>Type : </i> <code>NgControl | null</code>
717
+ <i>Type : </i> <code>NgControl | AbstractControlDirective | null</code>
725
718
 
726
719
  </td>
727
720
  </tr>
@@ -732,7 +725,7 @@
732
725
  </tr>
733
726
  <tr>
734
727
  <td class="col-md-4">
735
- <div class="io-line">Defined in <a href="" data-line="60" class="link-to-prism">src/lib/directives/options-from-method.directive.ts:60</a></div>
728
+ <div class="io-line">Defined in <a href="" data-line="67" class="link-to-prism">src/lib/directives/options-from-method.directive.ts:67</a></div>
736
729
  </td>
737
730
  </tr>
738
731
 
@@ -764,7 +757,7 @@
764
757
  </tr>
765
758
  <tr>
766
759
  <td class="col-md-4">
767
- <div class="io-line">Defined in <a href="" data-line="59" class="link-to-prism">src/lib/directives/options-from-method.directive.ts:59</a></div>
760
+ <div class="io-line">Defined in <a href="" data-line="63" class="link-to-prism">src/lib/directives/options-from-method.directive.ts:63</a></div>
768
761
  </td>
769
762
  </tr>
770
763
 
@@ -796,7 +789,7 @@
796
789
  </tr>
797
790
  <tr>
798
791
  <td class="col-md-4">
799
- <div class="io-line">Defined in <a href="" data-line="62" class="link-to-prism">src/lib/directives/options-from-method.directive.ts:62</a></div>
792
+ <div class="io-line">Defined in <a href="" data-line="69" class="link-to-prism">src/lib/directives/options-from-method.directive.ts:69</a></div>
800
793
  </td>
801
794
  </tr>
802
795
 
@@ -829,7 +822,7 @@
829
822
  </tr>
830
823
  <tr>
831
824
  <td class="col-md-4">
832
- <div class="io-line">Defined in <a href="" data-line="64" class="link-to-prism">src/lib/directives/options-from-method.directive.ts:64</a></div>
825
+ <div class="io-line">Defined in <a href="" data-line="70" class="link-to-prism">src/lib/directives/options-from-method.directive.ts:70</a></div>
833
826
  </td>
834
827
  </tr>
835
828
 
@@ -856,8 +849,12 @@
856
849
  TemplateRef,
857
850
  ViewContainerRef,
858
851
  } from &#x27;@angular/core&#x27;;
859
- import { NgControl } from &#x27;@angular/forms&#x27;;
852
+ import {
853
+ AbstractControlDirective,
854
+ NgControl,
855
+ } from &#x27;@angular/forms&#x27;;
860
856
  import { MatFormField } from &#x27;@angular/material/form-field&#x27;;
857
+ import { RxapFormControl } from &#x27;@rxap/forms&#x27;;
861
858
  import { Mixin } from &#x27;@rxap/mixin&#x27;;
862
859
  import { Method } from &#x27;@rxap/pattern&#x27;;
863
860
  import {
@@ -901,20 +898,23 @@ export class OptionsFromMethodDirective&lt;Value &#x3D; any, Parameters &#x3D; a
901
898
  @Input(&#x27;rxapOptionsFromMethodResetOnChange&#x27;)
902
899
  public resetOnChange?: Value;
903
900
 
904
- public options: ControlOptions | null &#x3D; null;
905
- protected ngControl: NgControl | null &#x3D; null;
906
- protected matFormField: MatFormField | null &#x3D; null;
907
- protected settings: OptionsFromMethodDirectiveSettings &#x3D; {};
908
- protected method!: Method&lt;ControlOptions, Parameters&gt;;
909
- protected readonly viewContainerRef: ViewContainerRef &#x3D; inject(ViewContainerRef);
910
- protected readonly injector: Injector &#x3D; inject(INJECTOR);
901
+ public options: ControlOptions | null &#x3D; null;
902
+ // eslint-disable-next-line @angular-eslint/no-input-rename
903
+ @Input(&#x27;rxapOptionsFromMethodCall&#x27;)
904
+ public method!: Method&lt;ControlOptions, Parameters&gt;;
905
+ protected ngControl: NgControl | AbstractControlDirective | null &#x3D; null;
906
+ protected matFormField: MatFormField | null &#x3D; null;
907
+ protected settings: OptionsFromMethodDirectiveSettings &#x3D; {};
908
+ protected readonly viewContainerRef: ViewContainerRef &#x3D; inject(ViewContainerRef);
909
+ protected readonly injector: Injector &#x3D; inject(INJECTOR);
911
910
  protected readonly cdr: ChangeDetectorRef &#x3D; inject(ChangeDetectorRef);
912
911
  private readonly template: TemplateRef&lt;OptionsFromMethodTemplateContext&gt; &#x3D; inject(TemplateRef);
913
912
 
914
913
  public async ngAfterViewInit() {
915
- this.ngControl &#x3D; this.injector.get(NgControl, null);
916
914
  this.matFormField &#x3D; this.injector.get(MatFormField, null);
917
- this.method &#x3D; this.extractOptionsMethod();
915
+ this.ngControl &#x3D; this.injector.get(NgControl, this.matFormField?._control.ngControl);
916
+ this.control &#x3D; (this.ngControl?.control as RxapFormControl) ?? undefined;
917
+ this.method ??&#x3D; this.extractOptionsMethod();
918
918
  // ensure that the options are loaded. It is possible that the ngOnChange is triggered before the ngAfterViewInit
919
919
  // then the options are not loaded.
920
920
  if (!this.options) {
@@ -935,7 +935,7 @@ export class OptionsFromMethodDirective&lt;Value &#x3D; any, Parameters &#x3D; a
935
935
  }
936
936
  }
937
937
 
938
- protected async loadOptions(parameters?: Parameters): Promise&lt;ControlOptions&gt; {
938
+ protected async loadOptions(parameters?: Parameters): Promise&lt;ControlOptions | null&gt; {
939
939
  return this.method.call(parameters);
940
940
  }
941
941
 
@@ -959,9 +959,14 @@ export class OptionsFromMethodDirective&lt;Value &#x3D; any, Parameters &#x3D; a
959
959
 
960
960
  }
961
961
 
962
- protected setOptions(options: ControlOptions) {
963
- this.options &#x3D; options.slice();
964
- this.renderTemplate();
962
+ protected setOptions(options: ControlOptions | null) {
963
+ if (!options) {
964
+ this.options &#x3D; null;
965
+ this.viewContainerRef.clear();
966
+ } else {
967
+ this.options &#x3D; options.slice();
968
+ this.renderTemplate();
969
+ }
965
970
  }
966
971
 
967
972
  }