@rxap/schematic-angular 18.1.0-dev.4 → 18.1.0-dev.6

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 (187) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/collection.json +5 -0
  3. package/package.json +13 -47
  4. package/src/lib/accordion/header/base-accordion-header.js +1 -1
  5. package/src/lib/accordion/header/base-accordion-header.js.map +1 -1
  6. package/src/lib/accordion/item/base-accordion-item.d.ts +5 -0
  7. package/src/lib/accordion/item/base-accordion-item.js +7 -1
  8. package/src/lib/accordion/item/base-accordion-item.js.map +1 -1
  9. package/src/lib/accordion/item/nested-accordion-item.js +10 -1
  10. package/src/lib/accordion/item/nested-accordion-item.js.map +1 -1
  11. package/src/lib/accordion/item/switch-accordion-item.js +7 -5
  12. package/src/lib/accordion/item/switch-accordion-item.js.map +1 -1
  13. package/src/lib/angular-options.d.ts +1 -1
  14. package/src/lib/angular-options.js +1 -1
  15. package/src/lib/angular-options.js.map +1 -1
  16. package/src/lib/backend/backend-options.d.ts +1 -1
  17. package/src/lib/backend/backend-options.js +1 -1
  18. package/src/lib/backend/backend-options.js.map +1 -1
  19. package/src/lib/backend/backend-types.js.map +1 -0
  20. package/src/lib/backend/base-backend-options.d.ts +1 -1
  21. package/src/lib/backend/nest-js-backend-options.d.ts +1 -1
  22. package/src/lib/backend/nest-js-backend-options.js +1 -1
  23. package/src/lib/backend/nest-js-backend-options.js.map +1 -1
  24. package/src/lib/coerce-accordion-component.js +2 -12
  25. package/src/lib/coerce-accordion-component.js.map +1 -1
  26. package/src/lib/coerce-minimum-table-component.js +1 -1
  27. package/src/lib/coerce-minimum-table-component.js.map +1 -1
  28. package/src/lib/data-source/base-data-source-options.d.ts +7 -0
  29. package/src/lib/data-source/base-data-source-options.js +12 -0
  30. package/src/lib/data-source/base-data-source-options.js.map +1 -0
  31. package/src/lib/data-source/data-source-kinds.d.ts +4 -0
  32. package/src/lib/data-source/data-source-kinds.js +9 -0
  33. package/src/lib/data-source/data-source-kinds.js.map +1 -0
  34. package/src/lib/data-source/data-source-options.d.ts +7 -0
  35. package/src/lib/data-source/data-source-options.js +29 -0
  36. package/src/lib/data-source/data-source-options.js.map +1 -0
  37. package/src/lib/data-source/import-data-source-options.d.ts +13 -0
  38. package/src/lib/data-source/import-data-source-options.js +14 -0
  39. package/src/lib/data-source/import-data-source-options.js.map +1 -0
  40. package/src/lib/form/control/autocomplete-form-control.d.ts +1 -1
  41. package/src/lib/form/control/autocomplete-form-control.js +1 -1
  42. package/src/lib/form/control/autocomplete-form-control.js.map +1 -1
  43. package/src/lib/form/control/autocomplete-table-select-form-control.js +3 -2
  44. package/src/lib/form/control/autocomplete-table-select-form-control.js.map +1 -1
  45. package/src/lib/form/control/select-form-control.d.ts +4 -1
  46. package/src/lib/form/control/select-form-control.js +3 -2
  47. package/src/lib/form/control/select-form-control.js.map +1 -1
  48. package/src/lib/form/control/table-select-form-control.d.ts +15 -1
  49. package/src/lib/form/control/table-select-form-control.js +24 -3
  50. package/src/lib/form/control/table-select-form-control.js.map +1 -1
  51. package/src/lib/method/base-method-options.d.ts +7 -0
  52. package/src/lib/method/base-method-options.js +12 -0
  53. package/src/lib/method/base-method-options.js.map +1 -0
  54. package/src/lib/method/import-method-options.d.ts +13 -0
  55. package/src/lib/method/import-method-options.js +14 -0
  56. package/src/lib/method/import-method-options.js.map +1 -0
  57. package/src/lib/method/method-kinds.d.ts +5 -0
  58. package/src/lib/method/method-kinds.js +10 -0
  59. package/src/lib/method/method-kinds.js.map +1 -0
  60. package/src/lib/method/method-options.d.ts +11 -0
  61. package/src/lib/method/method-options.js +42 -0
  62. package/src/lib/method/method-options.js.map +1 -0
  63. package/src/lib/method/open-api-method-options.d.ts +12 -0
  64. package/src/lib/method/open-api-method-options.js +13 -0
  65. package/src/lib/method/open-api-method-options.js.map +1 -0
  66. package/src/lib/minimum-table-component-options.js +41 -32
  67. package/src/lib/minimum-table-component-options.js.map +1 -1
  68. package/src/lib/minimum-table-options.d.ts +2 -2
  69. package/src/lib/minimum-table-options.js +2 -2
  70. package/src/lib/minimum-table-options.js.map +1 -1
  71. package/src/lib/table/header-button/base-header-button.d.ts +16 -0
  72. package/src/lib/table/header-button/base-header-button.js +23 -0
  73. package/src/lib/table/header-button/base-header-button.js.map +1 -0
  74. package/src/lib/table/header-button/form-header-button.d.ts +14 -0
  75. package/src/lib/table/header-button/form-header-button.js +22 -0
  76. package/src/lib/table/header-button/form-header-button.js.map +1 -0
  77. package/src/lib/table/header-button/method-header-button.d.ts +14 -0
  78. package/src/lib/table/header-button/method-header-button.js +22 -0
  79. package/src/lib/table/header-button/method-header-button.js.map +1 -0
  80. package/src/lib/table/header-button/navigation-header-button.d.ts +17 -0
  81. package/src/lib/table/header-button/navigation-header-button.js +22 -0
  82. package/src/lib/table/header-button/navigation-header-button.js.map +1 -0
  83. package/src/lib/table/header-button-kind.d.ts +6 -0
  84. package/src/lib/table/header-button-kind.js +11 -0
  85. package/src/lib/table/header-button-kind.js.map +1 -0
  86. package/src/lib/table/table-header-button.d.ts +7 -0
  87. package/src/lib/table/table-header-button.js +25 -0
  88. package/src/lib/table/table-header-button.js.map +1 -0
  89. package/src/schema.json +329 -62
  90. package/src/schematic-input.schema.json +19 -0
  91. package/src/schematics/accordion/accordion-component/index.d.ts +1 -0
  92. package/src/schematics/accordion/accordion-component/index.js +48 -2
  93. package/src/schematics/accordion/accordion-component/index.js.map +1 -1
  94. package/src/schematics/accordion/accordion-component/schema.json +301 -36
  95. package/src/schematics/accordion/accordion-item-component/index.js +1 -1
  96. package/src/schematics/accordion/accordion-item-component/index.js.map +1 -1
  97. package/src/schematics/accordion/accordion-item-component/schema.json +301 -36
  98. package/src/schematics/accordion/item/accordion-item-data-grid-component/index.js +1 -1
  99. package/src/schematics/accordion/item/accordion-item-data-grid-component/index.js.map +1 -1
  100. package/src/schematics/accordion/item/accordion-item-data-grid-component/schema.json +164 -0
  101. package/src/schematics/accordion/item/accordion-item-nested-component/schema.json +301 -36
  102. package/src/schematics/accordion/item/accordion-item-switch-component/schema.json +301 -36
  103. package/src/schematics/accordion/item/accordion-item-table-component/schema.json +299 -34
  104. package/src/schematics/accordion/item/accordion-item-tree-table-component/index.js +1 -1
  105. package/src/schematics/accordion/item/accordion-item-tree-table-component/index.js.map +1 -1
  106. package/src/schematics/accordion/item/accordion-item-tree-table-component/schema.json +299 -34
  107. package/src/schematics/autocomplete-table-select-form-control.schema.json +20 -0
  108. package/src/schematics/base-data-source.schema.json +10 -0
  109. package/src/schematics/base-header-button.schema.json +41 -0
  110. package/src/schematics/base-method.schema.json +10 -0
  111. package/src/schematics/data-grid-component/index.js +1 -1
  112. package/src/schematics/data-grid-component/index.js.map +1 -1
  113. package/src/schematics/data-grid-component/schema.json +164 -0
  114. package/src/schematics/data-source.schema.json +34 -0
  115. package/src/schematics/form/control/autocomplete-form-control/index.js +3 -3
  116. package/src/schematics/form/control/autocomplete-form-control/index.js.map +1 -1
  117. package/src/schematics/form/control/autocomplete-table-select-form-control/index.d.ts +2 -1
  118. package/src/schematics/form/control/autocomplete-table-select-form-control/index.js +343 -215
  119. package/src/schematics/form/control/autocomplete-table-select-form-control/index.js.map +1 -1
  120. package/src/schematics/form/control/autocomplete-table-select-form-control/schema.json +150 -0
  121. package/src/schematics/form/control/select-form-control/index.js +72 -6
  122. package/src/schematics/form/control/select-form-control/index.js.map +1 -1
  123. package/src/schematics/form/control/table-select-form-control/schema.json +150 -0
  124. package/src/schematics/form/form-array/schema.json +164 -0
  125. package/src/schematics/form/form-component/index.js +1 -1
  126. package/src/schematics/form/form-component/index.js.map +1 -1
  127. package/src/schematics/form/form-component/schema.json +164 -0
  128. package/src/schematics/form/form-control/schema.json +164 -0
  129. package/src/schematics/form/form-definition/schema.json +164 -0
  130. package/src/schematics/form/form-group/schema.json +164 -0
  131. package/src/schematics/form-header-button.schema.json +31 -0
  132. package/src/schematics/header-button.schema.json +37 -33
  133. package/src/schematics/import-data-source.schema.json +31 -0
  134. package/src/schematics/import-method.schema.json +31 -0
  135. package/src/schematics/method-header-button.schema.json +31 -0
  136. package/src/schematics/method.schema.json +40 -0
  137. package/src/schematics/navigation-header-button.schema.json +31 -0
  138. package/src/schematics/open-api-method.schema.json +28 -0
  139. package/src/schematics/property-accordion-header.schema.json +2 -2
  140. package/src/schematics/table/action/dialog-table-action/schema.json +164 -0
  141. package/src/schematics/table/action/form-table-action/index.js +8 -2
  142. package/src/schematics/table/action/form-table-action/index.js.map +1 -1
  143. package/src/schematics/table/action/form-table-action/schema.json +164 -0
  144. package/src/schematics/table/action/navigation-table-action/schema.json +164 -0
  145. package/src/schematics/table/action/open-api-table-action/schema.json +164 -0
  146. package/src/schematics/table/action/operation-table-action/index.js +1 -1
  147. package/src/schematics/table/action/operation-table-action/index.js.map +1 -1
  148. package/src/schematics/table/action/operation-table-action/schema.json +164 -0
  149. package/src/schematics/table/header-button/form-table-header-button/index.d.ts +3 -11
  150. package/src/schematics/table/header-button/form-table-header-button/index.js +21 -24
  151. package/src/schematics/table/header-button/form-table-header-button/index.js.map +1 -1
  152. package/src/schematics/table/header-button/form-table-header-button/schema.d.ts +4 -13
  153. package/src/schematics/table/header-button/form-table-header-button/schema.json +297 -45
  154. package/src/schematics/table/header-button/form-table-header-button/template.schema.json +3 -16
  155. package/src/schematics/table/header-button/method-table-header-button/index.d.ts +8 -0
  156. package/src/schematics/table/header-button/method-table-header-button/index.js +91 -0
  157. package/src/schematics/table/header-button/method-table-header-button/index.js.map +1 -0
  158. package/src/schematics/table/header-button/method-table-header-button/schema.d.ts +6 -0
  159. package/src/schematics/table/header-button/method-table-header-button/schema.json +1502 -0
  160. package/src/schematics/table/header-button/method-table-header-button/template.schema.json +20 -0
  161. package/src/schematics/table/header-button/navigation-table-header-button/index.d.ts +3 -3
  162. package/src/schematics/table/header-button/navigation-table-header-button/index.js +9 -4
  163. package/src/schematics/table/header-button/navigation-table-header-button/index.js.map +1 -1
  164. package/src/schematics/table/header-button/navigation-table-header-button/schema.d.ts +4 -4
  165. package/src/schematics/table/header-button/navigation-table-header-button/schema.json +1342 -49
  166. package/src/schematics/table/header-button/navigation-table-header-button/template.schema.json +4 -12
  167. package/src/schematics/table/table-action/schema.json +164 -0
  168. package/src/schematics/table/table-component/index.js +1 -1
  169. package/src/schematics/table/table-component/index.js.map +1 -1
  170. package/src/schematics/table/table-component/schema.json +299 -34
  171. package/src/schematics/table/table-header-button/index.d.ts +4 -4
  172. package/src/schematics/table/table-header-button/index.js +2 -2
  173. package/src/schematics/table/table-header-button/index.js.map +1 -1
  174. package/src/schematics/table/table-header-button/schema.d.ts +2 -3
  175. package/src/schematics/table/table-header-button/schema.json +1333 -29
  176. package/src/schematics/table/tree-table-component/index.js +1 -1
  177. package/src/schematics/table/tree-table-component/index.js.map +1 -1
  178. package/src/schematics/table/tree-table-component/schema.json +299 -34
  179. package/src/schematics/table-select-form-control.schema.json +20 -0
  180. package/src/template.schema.json +36 -0
  181. package/src/lib/backend-types.js.map +0 -1
  182. package/src/lib/table-header-button.d.ts +0 -16
  183. package/src/lib/table-header-button.js +0 -78
  184. package/src/lib/table-header-button.js.map +0 -1
  185. package/src/schematics/accordion/accordion-component/files/component/__componentName__.component.stories.ts.hbs +0 -34
  186. /package/src/lib/{backend-types.d.ts → backend/backend-types.d.ts} +0 -0
  187. /package/src/lib/{backend-types.js → backend/backend-types.js} +0 -0
@@ -6,20 +6,7 @@
6
6
  "$ref": "#/definitions/tableHeaderButtonSchematic"
7
7
  },
8
8
  {
9
- "type": "object",
10
- "properties": {
11
- "formComponent": {
12
- "type": "string"
13
- },
14
- "customComponent": {
15
- "type": "boolean",
16
- "default": false,
17
- "description": "If true the schematic will not coerce the form component"
18
- },
19
- "formOptions": {
20
- "$ref": "#/definitions/formComponent"
21
- }
22
- }
9
+ "$ref": "#/definitions/formHeaderButton"
23
10
  }
24
11
  ],
25
12
  "definitions": {
@@ -230,6 +217,17 @@
230
217
  "type": "string",
231
218
  "const": "autocomplete-table-select"
232
219
  },
220
+ "dataSource": {
221
+ "$ref": "#/definitions/dataSource"
222
+ },
223
+ "options": {
224
+ "type": "object",
225
+ "properties": {
226
+ "method": {
227
+ "$ref": "#/definitions/method"
228
+ }
229
+ }
230
+ },
233
231
  "placeholder": {
234
232
  "type": "string"
235
233
  },
@@ -288,6 +286,9 @@
288
286
  "properties": {
289
287
  "upstream": {
290
288
  "$ref": "#/definitions/upstream"
289
+ },
290
+ "method": {
291
+ "$ref": "#/definitions/method"
291
292
  }
292
293
  }
293
294
  }
@@ -335,6 +336,14 @@
335
336
  "description": "The backend that should be used to handel data",
336
337
  "default": "none"
337
338
  },
339
+ "baseDataSource": {
340
+ "type": "object",
341
+ "properties": {
342
+ "kind": {
343
+ "type": "string"
344
+ }
345
+ }
346
+ },
338
347
  "baseFormArray": {
339
348
  "allOf": [
340
349
  {
@@ -422,6 +431,53 @@
422
431
  }
423
432
  ]
424
433
  },
434
+ "baseHeaderButton": {
435
+ "type": "object",
436
+ "properties": {
437
+ "kind": {
438
+ "type": "string"
439
+ },
440
+ "permission": {
441
+ "type": "string"
442
+ },
443
+ "icon": {
444
+ "type": "string"
445
+ },
446
+ "svgIcon": {
447
+ "type": "string"
448
+ },
449
+ "refresh": {
450
+ "type": "boolean",
451
+ "description": "Whether the table action should refresh the table after execution",
452
+ "default": false
453
+ },
454
+ "confirm": {
455
+ "type": "boolean",
456
+ "description": "Whether the table action should confirm before execution",
457
+ "default": false
458
+ },
459
+ "tooltip": {
460
+ "type": "string",
461
+ "description": "The tooltip for the table action"
462
+ },
463
+ "errorMessage": {
464
+ "type": "string",
465
+ "description": "The error message for the table action"
466
+ },
467
+ "successMessage": {
468
+ "type": "string",
469
+ "description": "The success message for the table action"
470
+ }
471
+ }
472
+ },
473
+ "baseMethod": {
474
+ "type": "object",
475
+ "properties": {
476
+ "kind": {
477
+ "type": "string"
478
+ }
479
+ }
480
+ },
425
481
  "button": {
426
482
  "type": "object",
427
483
  "properties": {
@@ -516,6 +572,30 @@
516
572
  }
517
573
  ]
518
574
  },
575
+ "dataSource": {
576
+ "oneOf": [
577
+ {
578
+ "allOf": [
579
+ {
580
+ "$ref": "#/definitions/baseDataSource"
581
+ },
582
+ {
583
+ "type": "object",
584
+ "properties": {
585
+ "kind": {
586
+ "type": "string",
587
+ "const": "default",
588
+ "default": "default"
589
+ }
590
+ }
591
+ }
592
+ ]
593
+ },
594
+ {
595
+ "$ref": "#/definitions/importDataSource"
596
+ }
597
+ ]
598
+ },
519
599
  "formArray": {
520
600
  "allOf": [
521
601
  {
@@ -719,6 +799,29 @@
719
799
  }
720
800
  ]
721
801
  },
802
+ "formHeaderButton": {
803
+ "allOf": [
804
+ {
805
+ "$ref": "#/definitions/baseHeaderButton"
806
+ },
807
+ {
808
+ "type": "object",
809
+ "properties": {
810
+ "kind": {
811
+ "type": "string",
812
+ "const": "form",
813
+ "default": "form"
814
+ },
815
+ "form": {
816
+ "$ref": "#/definitions/formComponent"
817
+ }
818
+ },
819
+ "required": [
820
+ "form"
821
+ ]
822
+ }
823
+ ]
824
+ },
722
825
  "general": {
723
826
  "type": "object",
724
827
  "properties": {
@@ -756,44 +859,80 @@
756
859
  }
757
860
  },
758
861
  "headerButton": {
759
- "type": "object",
760
- "properties": {
761
- "permission": {
762
- "type": "string"
763
- },
764
- "icon": {
765
- "type": "string"
766
- },
767
- "svgIcon": {
768
- "type": "string"
769
- },
770
- "refresh": {
771
- "type": "boolean",
772
- "description": "Whether the table action should refresh the table after execution",
773
- "default": false
862
+ "oneOf": [
863
+ {
864
+ "allOf": [
865
+ {
866
+ "$ref": "#/definitions/baseHeaderButton"
867
+ },
868
+ {
869
+ "type": "object",
870
+ "properties": {
871
+ "kind": {
872
+ "type": "string",
873
+ "const": "default",
874
+ "default": "default"
875
+ }
876
+ }
877
+ }
878
+ ]
774
879
  },
775
- "confirm": {
776
- "type": "boolean",
777
- "description": "Whether the table action should confirm before execution",
778
- "default": false
880
+ {
881
+ "$ref": "#/definitions/formHeaderButton"
779
882
  },
780
- "tooltip": {
781
- "type": "string",
782
- "description": "The tooltip for the table action"
883
+ {
884
+ "$ref": "#/definitions/navigationHeaderButton"
783
885
  },
784
- "errorMessage": {
785
- "type": "string",
786
- "description": "The error message for the table action"
886
+ {
887
+ "$ref": "#/definitions/methodHeaderButton"
888
+ }
889
+ ]
890
+ },
891
+ "importDataSource": {
892
+ "allOf": [
893
+ {
894
+ "$ref": "#/definitions/baseDataSource"
787
895
  },
788
- "successMessage": {
789
- "type": "string",
790
- "description": "The success message for the table action"
896
+ {
897
+ "type": "object",
898
+ "properties": {
899
+ "kind": {
900
+ "type": "string",
901
+ "const": "import",
902
+ "default": "import"
903
+ },
904
+ "import": {
905
+ "$ref": "#/definitions/type"
906
+ }
907
+ },
908
+ "required": [
909
+ "import"
910
+ ]
911
+ }
912
+ ]
913
+ },
914
+ "importMethod": {
915
+ "allOf": [
916
+ {
917
+ "$ref": "#/definitions/baseMethod"
791
918
  },
792
- "options": {
919
+ {
793
920
  "type": "object",
794
- "additionalProperties": true
921
+ "properties": {
922
+ "kind": {
923
+ "type": "string",
924
+ "const": "import",
925
+ "default": "import"
926
+ },
927
+ "import": {
928
+ "$ref": "#/definitions/type"
929
+ }
930
+ },
931
+ "required": [
932
+ "import"
933
+ ]
795
934
  }
796
- }
935
+ ]
797
936
  },
798
937
  "inputFormControl": {
799
938
  "allOf": [
@@ -847,6 +986,105 @@
847
986
  }
848
987
  ]
849
988
  },
989
+ "method": {
990
+ "oneOf": [
991
+ {
992
+ "allOf": [
993
+ {
994
+ "$ref": "#/definitions/baseMethod"
995
+ },
996
+ {
997
+ "type": "object",
998
+ "properties": {
999
+ "kind": {
1000
+ "type": "string",
1001
+ "const": "default",
1002
+ "default": "default"
1003
+ }
1004
+ }
1005
+ }
1006
+ ]
1007
+ },
1008
+ {
1009
+ "$ref": "#/definitions/importMethod"
1010
+ },
1011
+ {
1012
+ "$ref": "#/definitions/openApiMethod"
1013
+ }
1014
+ ]
1015
+ },
1016
+ "methodHeaderButton": {
1017
+ "allOf": [
1018
+ {
1019
+ "$ref": "#/definitions/baseHeaderButton"
1020
+ },
1021
+ {
1022
+ "type": "object",
1023
+ "properties": {
1024
+ "kind": {
1025
+ "type": "string",
1026
+ "const": "method",
1027
+ "default": "method"
1028
+ },
1029
+ "method": {
1030
+ "$ref": "#/definitions/method"
1031
+ }
1032
+ },
1033
+ "required": [
1034
+ "method"
1035
+ ]
1036
+ }
1037
+ ]
1038
+ },
1039
+ "navigationHeaderButton": {
1040
+ "allOf": [
1041
+ {
1042
+ "$ref": "#/definitions/baseHeaderButton"
1043
+ },
1044
+ {
1045
+ "type": "object",
1046
+ "properties": {
1047
+ "kind": {
1048
+ "type": "string",
1049
+ "const": "navigation",
1050
+ "default": "navigation"
1051
+ },
1052
+ "route": {
1053
+ "type": "string"
1054
+ },
1055
+ "relativeTo": {
1056
+ "type": "boolean"
1057
+ }
1058
+ },
1059
+ "required": [
1060
+ "route"
1061
+ ]
1062
+ }
1063
+ ]
1064
+ },
1065
+ "openApiMethod": {
1066
+ "allOf": [
1067
+ {
1068
+ "$ref": "#/definitions/baseMethod"
1069
+ },
1070
+ {
1071
+ "type": "object",
1072
+ "properties": {
1073
+ "kind": {
1074
+ "type": "string",
1075
+ "const": "open-api",
1076
+ "default": "open-api"
1077
+ },
1078
+ "operationId": {
1079
+ "type": "string"
1080
+ }
1081
+ },
1082
+ "required": [
1083
+ "operationId"
1084
+ ]
1085
+ }
1086
+ ]
1087
+ },
850
1088
  "option": {
851
1089
  "type": "object",
852
1090
  "properties": {
@@ -1005,6 +1243,17 @@
1005
1243
  "type": "string",
1006
1244
  "const": "table-select"
1007
1245
  },
1246
+ "dataSource": {
1247
+ "$ref": "#/definitions/dataSource"
1248
+ },
1249
+ "options": {
1250
+ "type": "object",
1251
+ "properties": {
1252
+ "method": {
1253
+ "$ref": "#/definitions/method"
1254
+ }
1255
+ }
1256
+ },
1008
1257
  "placeholder": {
1009
1258
  "type": "string"
1010
1259
  },
@@ -1063,6 +1312,9 @@
1063
1312
  "properties": {
1064
1313
  "upstream": {
1065
1314
  "$ref": "#/definitions/upstream"
1315
+ },
1316
+ "method": {
1317
+ "$ref": "#/definitions/method"
1066
1318
  }
1067
1319
  }
1068
1320
  },
@@ -6,28 +6,15 @@
6
6
  "$ref": "#/definitions/tableHeaderButtonSchematic"
7
7
  },
8
8
  {
9
- "type": "object",
10
- "properties": {
11
- "formComponent": {
12
- "type": "string"
13
- },
14
- "customComponent": {
15
- "type": "boolean",
16
- "default": false,
17
- "description": "If true the schematic will not coerce the form component"
18
- },
19
- "formOptions": {
20
- "$ref": "#/definitions/formComponent"
21
- }
22
- }
9
+ "$ref": "#/definitions/formHeaderButton"
23
10
  }
24
11
  ],
25
12
  "definitions": {
26
13
  "tableHeaderButtonSchematic": {
27
14
  "$ref": "../../table-header-button/template.schema.json"
28
15
  },
29
- "formComponent": {
30
- "$ref": "../../../form-component.schema.json"
16
+ "formHeaderButton": {
17
+ "$ref": "../../../form-header-button.schema.json"
31
18
  }
32
19
  }
33
20
  }
@@ -0,0 +1,8 @@
1
+ import { Rule, Tree } from '@angular-devkit/schematics';
2
+ import { Normalized } from '@rxap/utilities';
3
+ import { AngularOptions, NormalizedAngularOptions } from '../../../../lib/angular-options';
4
+ import { MethodHeaderButton, NormalizedMethodHeaderButton } from '../../../../lib/table/header-button/method-header-button';
5
+ import { MethodTableHeaderButtonOptions } from './schema';
6
+ export type NormalizedFormTableHeaderButtonOptions = Readonly<Normalized<Omit<MethodTableHeaderButtonOptions, keyof AngularOptions | keyof MethodHeaderButton>> & NormalizedAngularOptions & NormalizedMethodHeaderButton>;
7
+ export declare function NormalizeMethodTableHeaderButtonOptions(options: Readonly<MethodTableHeaderButtonOptions>): NormalizedFormTableHeaderButtonOptions;
8
+ export default function (options: MethodTableHeaderButtonOptions): (host: Tree) => Rule;
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NormalizeMethodTableHeaderButtonOptions = void 0;
4
+ const schematics_1 = require("@angular-devkit/schematics");
5
+ const schematics_ts_morph_1 = require("@rxap/schematics-ts-morph");
6
+ const ts_morph_1 = require("@rxap/ts-morph");
7
+ const utilities_1 = require("@rxap/utilities");
8
+ const path_1 = require("path");
9
+ const angular_options_1 = require("../../../../lib/angular-options");
10
+ const assert_table_component_exists_1 = require("../../../../lib/assert-table-component-exists");
11
+ const method_kinds_1 = require("../../../../lib/method/method-kinds");
12
+ const method_options_1 = require("../../../../lib/method/method-options");
13
+ const method_header_button_1 = require("../../../../lib/table/header-button/method-header-button");
14
+ function NormalizeMethodTableHeaderButtonOptions(options) {
15
+ const normalizedAngularOptions = (0, angular_options_1.NormalizeAngularOptions)(options);
16
+ const normalizedTableHeaderButton = (0, method_header_button_1.NormalizeMethodHeaderButton)(options, options.tableName);
17
+ if (!normalizedTableHeaderButton) {
18
+ throw new Error('FATAL: should never happen');
19
+ }
20
+ const tableName = (0, utilities_1.CoerceSuffix)((0, utilities_1.dasherize)(options.tableName), '-table');
21
+ return Object.freeze(Object.assign(Object.assign(Object.assign({}, normalizedAngularOptions), normalizedTableHeaderButton), { tableName }));
22
+ }
23
+ exports.NormalizeMethodTableHeaderButtonOptions = NormalizeMethodTableHeaderButtonOptions;
24
+ function printOptions(options) {
25
+ (0, angular_options_1.PrintAngularOptions)('method-table-header-button', options);
26
+ }
27
+ function default_1(options) {
28
+ const normalizedOptions = NormalizeMethodTableHeaderButtonOptions(options);
29
+ const { refresh, confirm, tooltip, errorMessage, successMessage, tableName, project, feature, shared, directory, overwrite, context, backend, nestModule, controllerName, method, } = normalizedOptions;
30
+ printOptions(normalizedOptions);
31
+ return (host) => {
32
+ (0, assert_table_component_exists_1.AssertTableComponentExists)(host, normalizedOptions);
33
+ const ruleList = [
34
+ () => console.group('\x1b[32m[@rxap/schematics-angular:form-table-header-button]\x1b[0m'),
35
+ ];
36
+ let methodName = null;
37
+ let methodModuleSpecifier = null;
38
+ switch (method.kind) {
39
+ case method_kinds_1.MethodKinds.IMPORT:
40
+ (0, method_options_1.AssertIsNormalizedImportMethodOptions)(method);
41
+ methodName = method.import.name;
42
+ methodModuleSpecifier = method.import.moduleSpecifier;
43
+ break;
44
+ default:
45
+ throw new Error(`Unsupported method kind: ${method.kind}`);
46
+ }
47
+ if (!methodName || !methodModuleSpecifier) {
48
+ throw new Error('FATAL: should never happen');
49
+ }
50
+ ruleList.push(() => console.log('Coerce table header button method ...'), (0, schematics_ts_morph_1.CoerceTableHeaderButtonMethodRule)({
51
+ project,
52
+ feature,
53
+ shared,
54
+ directory,
55
+ overwrite,
56
+ tableName,
57
+ refresh,
58
+ confirm,
59
+ tooltip,
60
+ errorMessage,
61
+ successMessage,
62
+ tsMorphTransform: (_, sourceFile) => {
63
+ (0, ts_morph_1.CoerceDependencyInjection)(sourceFile, {
64
+ injectionToken: methodName,
65
+ parameterName: 'method',
66
+ module: ts_morph_1.Module.ANGULAR,
67
+ });
68
+ (0, ts_morph_1.CoerceImports)(sourceFile, [
69
+ {
70
+ moduleSpecifier: methodModuleSpecifier.startsWith('.') ? (0, path_1.join)('..', methodModuleSpecifier) : methodModuleSpecifier,
71
+ namedImports: [methodName],
72
+ },
73
+ ]);
74
+ return {
75
+ statements: ['return this.method.call(parameters).toPromise();'],
76
+ };
77
+ },
78
+ tsMorphTransformComponent: (project, [sourceFile]) => {
79
+ (0, schematics_ts_morph_1.AddComponentProvider)(sourceFile, methodName, [
80
+ {
81
+ moduleSpecifier: methodModuleSpecifier,
82
+ namedImports: [methodName],
83
+ },
84
+ ]);
85
+ },
86
+ }), () => console.groupEnd());
87
+ return (0, schematics_1.chain)(ruleList);
88
+ };
89
+ }
90
+ exports.default = default_1;
91
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/schematic/angular/src/schematics/table/header-button/method-table-header-button/index.ts"],"names":[],"mappings":";;;AAAA,2DAIoC;AACpC,mEAImC;AACnC,6CAKwB;AACxB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BACF,CAAC,CAAC;gBACH,OAAO;oBACL,UAAU,EAAE,CAAE,kDAAkD,CAAE;iBACnE,CAAC;YACJ,CAAC;YACD,yBAAyB,EAAE,CACzB,OAAgB,EAChB,CAAE,UAAU,CAAkB,EAC9B,EAAE;gBACF,IAAA,0CAAoB,EAClB,UAAU,EACV,UAAU,EACV;oBACE;wBACE,eAAe,EAAE,qBAAqB;wBACtC,YAAY,EAAE,CAAE,UAAU,CAAE;qBAC7B;iBACF,CACF,CAAC;YACJ,CAAC;SACF,CAAC,EACF,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,CACzB,CAAC;QAEF,OAAO,IAAA,kBAAK,EAAC,QAAQ,CAAC,CAAC;IACzB,CAAC,CAAC;AACJ,CAAC;AAtGD,4BAsGC"}
@@ -0,0 +1,6 @@
1
+ import { AngularOptions } from '../../../../lib/angular-options';
2
+ import { MethodHeaderButton } from '../../../../lib/table/header-button/method-header-button';
3
+
4
+ export type MethodTableHeaderButtonOptions = AngularOptions & MethodHeaderButton & {
5
+ tableName: string;
6
+ }