@rxap/schematic-angular 16.2.0-dev.2 → 16.2.0-dev.20

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 (242) hide show
  1. package/CHANGELOG.md +146 -0
  2. package/README.md +1 -1
  3. package/package.json +11 -9
  4. package/src/lib/accordion-header.d.ts +5 -0
  5. package/src/lib/accordion-header.js +9 -3
  6. package/src/lib/accordion-header.js.map +1 -1
  7. package/src/lib/accordion-identifier.d.ts +4 -0
  8. package/src/lib/accordion-identifier.js.map +1 -1
  9. package/src/lib/accordion-item.d.ts +25 -17
  10. package/src/lib/accordion-item.js +72 -33
  11. package/src/lib/accordion-item.js.map +1 -1
  12. package/src/lib/accordion-itme-kinds.d.ts +8 -0
  13. package/src/lib/accordion-itme-kinds.js +16 -0
  14. package/src/lib/accordion-itme-kinds.js.map +1 -0
  15. package/src/lib/coerce-accordion-component.js +7 -3
  16. package/src/lib/coerce-accordion-component.js.map +1 -1
  17. package/src/lib/coerce-accordion-item-table-component.js +1 -1
  18. package/src/lib/coerce-accordion-item-table-component.js.map +1 -1
  19. package/src/lib/coerce-form-component.js +5 -2
  20. package/src/lib/coerce-form-component.js.map +1 -1
  21. package/src/lib/coerce-minimum-table-component.js +9 -3
  22. package/src/lib/coerce-minimum-table-component.js.map +1 -1
  23. package/src/lib/coerce-tree-table-component.js +16 -0
  24. package/src/lib/coerce-tree-table-component.js.map +1 -1
  25. package/src/lib/data-grid-item.d.ts +46 -11
  26. package/src/lib/data-grid-item.js +80 -5
  27. package/src/lib/data-grid-item.js.map +1 -1
  28. package/src/lib/data-grid-mode.d.ts +4 -0
  29. package/src/lib/data-grid-mode.js +9 -0
  30. package/src/lib/data-grid-mode.js.map +1 -0
  31. package/src/lib/data-grid-options.d.ts +12 -5
  32. package/src/lib/data-grid-options.js +43 -13
  33. package/src/lib/data-grid-options.js.map +1 -1
  34. package/src/lib/form/generate-form-template.d.ts +5 -0
  35. package/src/lib/form/generate-form-template.js +12 -0
  36. package/src/lib/form/generate-form-template.js.map +1 -0
  37. package/src/lib/form-component-control.d.ts +2 -6
  38. package/src/lib/form-component-control.js.map +1 -1
  39. package/src/lib/form-control.d.ts +136 -0
  40. package/src/lib/form-control.js +265 -0
  41. package/src/lib/form-control.js.map +1 -0
  42. package/src/lib/form-definition-control.d.ts +3 -57
  43. package/src/lib/form-definition-control.js +18 -144
  44. package/src/lib/form-definition-control.js.map +1 -1
  45. package/src/lib/load-handlebars-template.d.ts +4 -0
  46. package/src/lib/load-handlebars-template.js +28 -0
  47. package/src/lib/load-handlebars-template.js.map +1 -0
  48. package/src/lib/merge-with-column-list.js +3 -1
  49. package/src/lib/merge-with-column-list.js.map +1 -1
  50. package/src/lib/minimum-table-component-options.d.ts +12 -2
  51. package/src/lib/minimum-table-component-options.js +14 -17
  52. package/src/lib/minimum-table-component-options.js.map +1 -1
  53. package/src/lib/minimum-table-options.d.ts +1 -1
  54. package/src/lib/minimum-table-options.js +2 -2
  55. package/src/lib/minimum-table-options.js.map +1 -1
  56. package/src/lib/pipe-option.d.ts +11 -0
  57. package/src/lib/pipe-option.js +75 -0
  58. package/src/lib/pipe-option.js.map +1 -0
  59. package/src/lib/table/table-filter-column-rule.d.ts +13 -0
  60. package/src/lib/table/table-filter-column-rule.js +88 -0
  61. package/src/lib/table/table-filter-column-rule.js.map +1 -0
  62. package/src/lib/table-column.d.ts +19 -9
  63. package/src/lib/table-column.js +132 -113
  64. package/src/lib/table-column.js.map +1 -1
  65. package/src/lib/table-options.d.ts +1 -1
  66. package/src/lib/tree-table-options.d.ts +1 -1
  67. package/src/lib/use-pick-from-table-interface-as-form-type.d.ts +10 -0
  68. package/src/lib/use-pick-from-table-interface-as-form-type.js +32 -0
  69. package/src/lib/use-pick-from-table-interface-as-form-type.js.map +1 -0
  70. package/src/lib/value-option.d.ts +12 -0
  71. package/src/lib/value-option.js +66 -0
  72. package/src/lib/value-option.js.map +1 -0
  73. package/src/schema.json +2368 -0
  74. package/src/schematic-input.schema.json +607 -0
  75. package/src/schematics/accordion/accordion-component/files/component/__componentName__.component.html.hbs +25 -0
  76. package/src/schematics/accordion/accordion-component/index.d.ts +5 -2
  77. package/src/schematics/accordion/accordion-component/index.js +56 -122
  78. package/src/schematics/accordion/accordion-component/index.js.map +1 -1
  79. package/src/schematics/accordion/accordion-component/schema.d.ts +6 -0
  80. package/src/schematics/accordion/accordion-component/schema.json +314 -132
  81. package/src/schematics/accordion/accordion-component/template.schema.json +105 -0
  82. package/src/schematics/accordion/accordion-item-component/index.d.ts +9 -4
  83. package/src/schematics/accordion/accordion-item-component/index.js +112 -86
  84. package/src/schematics/accordion/accordion-item-component/index.js.map +1 -1
  85. package/src/schematics/accordion/accordion-item-component/schema.d.ts +2 -2
  86. package/src/schematics/accordion/accordion-item-component/schema.json +282 -70
  87. package/src/schematics/accordion/accordion-item-component/template.schema.json +32 -0
  88. package/src/schematics/accordion/item/accordion-item-data-grid-component/index.d.ts +1 -1
  89. package/src/schematics/accordion/item/accordion-item-data-grid-component/index.js +35 -51
  90. package/src/schematics/accordion/item/accordion-item-data-grid-component/index.js.map +1 -1
  91. package/src/schematics/accordion/item/accordion-item-data-grid-component/schema.d.ts +1 -1
  92. package/src/schematics/accordion/item/accordion-item-data-grid-component/schema.json +454 -85
  93. package/src/schematics/accordion/item/accordion-item-data-grid-component/template.schema.json +31 -0
  94. package/src/schematics/accordion/item/accordion-item-switch-component/index.d.ts +1 -1
  95. package/src/schematics/accordion/item/accordion-item-switch-component/index.js +16 -8
  96. package/src/schematics/accordion/item/accordion-item-switch-component/index.js.map +1 -1
  97. package/src/schematics/accordion/item/accordion-item-switch-component/schema.d.ts +1 -1
  98. package/src/schematics/accordion/item/accordion-item-switch-component/schema.json +322 -190
  99. package/src/schematics/accordion/item/accordion-item-switch-component/template.schema.json +81 -0
  100. package/src/schematics/accordion/item/accordion-item-table-component/index.d.ts +1 -1
  101. package/src/schematics/accordion/item/accordion-item-table-component/index.js +16 -19
  102. package/src/schematics/accordion/item/accordion-item-table-component/index.js.map +1 -1
  103. package/src/schematics/accordion/item/accordion-item-table-component/schema.d.ts +1 -1
  104. package/src/schematics/accordion/item/accordion-item-table-component/schema.json +615 -278
  105. package/src/schematics/accordion/item/accordion-item-table-component/template.schema.json +43 -0
  106. package/src/schematics/accordion/item/accordion-item-tree-table-component/index.d.ts +1 -1
  107. package/src/schematics/accordion/item/accordion-item-tree-table-component/index.js +48 -84
  108. package/src/schematics/accordion/item/accordion-item-tree-table-component/index.js.map +1 -1
  109. package/src/schematics/accordion/item/accordion-item-tree-table-component/schema.d.ts +1 -1
  110. package/src/schematics/accordion/item/accordion-item-tree-table-component/schema.json +591 -271
  111. package/src/schematics/accordion/item/accordion-item-tree-table-component/template.schema.json +43 -0
  112. package/src/schematics/accordion/templates/accordion-header.hbs +6 -0
  113. package/src/schematics/accordion/templates/data-grid-accordion-item.hbs +15 -0
  114. package/src/schematics/accordion/templates/default-accordion-item.hbs +15 -0
  115. package/src/schematics/accordion/templates/switch-accordion-item.hbs +21 -0
  116. package/src/schematics/accordion/templates/table-accordion-item.hbs +15 -0
  117. package/src/schematics/accordion/templates/tree-table-accordion-item.hbs +15 -0
  118. package/src/schematics/accordion-identifier.schema.json +25 -0
  119. package/src/schematics/accordion-item.schema.json +59 -0
  120. package/src/schematics/angular.schema.json +11 -11
  121. package/src/schematics/backend.schema.json +13 -0
  122. package/src/schematics/button.schema.json +30 -0
  123. package/src/schematics/data-grid-component/files/component/__componentName__.component.html.hbs +35 -0
  124. package/src/schematics/data-grid-component/index.d.ts +2 -4
  125. package/src/schematics/data-grid-component/index.js +83 -52
  126. package/src/schematics/data-grid-component/index.js.map +1 -1
  127. package/src/schematics/data-grid-component/schema.json +413 -141
  128. package/src/schematics/data-grid-component/template.schema.json +20 -0
  129. package/src/schematics/data-grid-component/templates/default-data-grid-item.hbs +3 -0
  130. package/src/schematics/data-grid-component/templates/link-data-grid-item.hbs +8 -0
  131. package/src/schematics/data-grid-item.schema.json +50 -0
  132. package/src/schematics/data-grid.schema.json +66 -0
  133. package/src/schematics/dialog-component/schema.json +141 -65
  134. package/src/schematics/dialog-component/template.schema.json +62 -0
  135. package/src/schematics/form/control/input-form-control/index.d.ts +2 -2
  136. package/src/schematics/form/control/input-form-control/index.js +4 -27
  137. package/src/schematics/form/control/input-form-control/index.js.map +1 -1
  138. package/src/schematics/form/control/input-form-control/schema.d.ts +2 -3
  139. package/src/schematics/form/control/input-form-control/schema.json +182 -105
  140. package/src/schematics/form/control/input-form-control/template.schema.json +20 -0
  141. package/src/schematics/form/control/select-form-control/index.d.ts +4 -2
  142. package/src/schematics/form/control/select-form-control/index.js +132 -96
  143. package/src/schematics/form/control/select-form-control/index.js.map +1 -1
  144. package/src/schematics/form/control/select-form-control/schema.d.ts +2 -3
  145. package/src/schematics/form/control/select-form-control/schema.json +194 -86
  146. package/src/schematics/form/control/select-form-control/template.schema.json +20 -0
  147. package/src/schematics/form/control/table-select-form-control/index.d.ts +9 -5
  148. package/src/schematics/form/control/table-select-form-control/index.js +199 -143
  149. package/src/schematics/form/control/table-select-form-control/index.js.map +1 -1
  150. package/src/schematics/form/control/table-select-form-control/schema.d.ts +2 -4
  151. package/src/schematics/form/control/table-select-form-control/schema.json +245 -100
  152. package/src/schematics/form/control/table-select-form-control/template.schema.json +83 -0
  153. package/src/schematics/form/form-component/files/component/{__componentName__.component.html.template → __componentName__.component.html.hbs} +3 -3
  154. package/src/schematics/form/form-component/index.d.ts +2 -0
  155. package/src/schematics/form/form-component/index.js +22 -7
  156. package/src/schematics/form/form-component/index.js.map +1 -1
  157. package/src/schematics/form/form-component/schema.d.ts +3 -1
  158. package/src/schematics/form/form-component/schema.json +275 -150
  159. package/src/schematics/form/form-component/template.schema.json +20 -0
  160. package/src/schematics/form/form-control/index.d.ts +3 -1
  161. package/src/schematics/form/form-control/index.js +19 -8
  162. package/src/schematics/form/form-control/index.js.map +1 -1
  163. package/src/schematics/form/form-control/schema.json +203 -75
  164. package/src/schematics/form/form-control/template.schema.json +34 -0
  165. package/src/schematics/form/form-definition/index.js +14 -1
  166. package/src/schematics/form/form-definition/index.js.map +1 -1
  167. package/src/schematics/form/form-definition/schema.json +210 -127
  168. package/src/schematics/form/form-definition/template.schema.json +30 -0
  169. package/src/schematics/form/templates/checkbox-form-control.hbs +9 -0
  170. package/src/schematics/form/templates/default-form-control.hbs +2 -0
  171. package/src/schematics/form/templates/input-form-control.hbs +9 -0
  172. package/src/schematics/form/templates/mat-form-field.hbs +31 -0
  173. package/src/schematics/form/templates/slide-toggle-form-control.hbs +8 -0
  174. package/src/schematics/form/templates/table-select-form-control.hbs +18 -0
  175. package/src/schematics/form-component.schema.json +45 -0
  176. package/src/schematics/form-control.schema.json +68 -0
  177. package/src/schematics/form-definition.schema.json +22 -0
  178. package/src/schematics/form-field.schema.json +24 -0
  179. package/src/schematics/general.schema.json +1 -4
  180. package/src/schematics/header-button.schema.json +42 -0
  181. package/src/schematics/input-form-control.schema.json +55 -0
  182. package/src/schematics/minimum-table.schema.json +60 -0
  183. package/src/schematics/pipe.schema.json +38 -0
  184. package/src/schematics/property.schema.json +31 -0
  185. package/src/schematics/select-form-control.schema.json +64 -0
  186. package/src/schematics/table/action/dialog-table-action/schema.json +209 -125
  187. package/src/schematics/table/action/dialog-table-action/template.schema.json +58 -0
  188. package/src/schematics/table/action/form-table-action/schema.json +383 -153
  189. package/src/schematics/table/action/form-table-action/template.schema.json +75 -0
  190. package/src/schematics/table/action/navigation-table-action/schema.json +187 -80
  191. package/src/schematics/table/action/navigation-table-action/template.schema.json +28 -0
  192. package/src/schematics/table/action/open-api-table-action/schema.json +206 -97
  193. package/src/schematics/table/action/open-api-table-action/template.schema.json +56 -0
  194. package/src/schematics/table/action/operation-table-action/schema.json +174 -84
  195. package/src/schematics/table/action/operation-table-action/template.schema.json +14 -0
  196. package/src/schematics/table/header-button/form-table-header-button/schema.json +272 -114
  197. package/src/schematics/table/header-button/form-table-header-button/template.schema.json +51 -0
  198. package/src/schematics/table/header-button/navigation-table-header-button/schema.json +167 -71
  199. package/src/schematics/table/header-button/navigation-table-header-button/template.schema.json +28 -0
  200. package/src/schematics/table/table-action/schema.json +165 -78
  201. package/src/schematics/table/table-action/template.schema.json +30 -0
  202. package/src/schematics/table/table-component/files/component/__componentName__.component.html.hbs +241 -0
  203. package/src/schematics/table/table-component/index.d.ts +1 -3
  204. package/src/schematics/table/table-component/index.js +14 -120
  205. package/src/schematics/table/table-component/index.js.map +1 -1
  206. package/src/schematics/table/table-component/schema.json +524 -277
  207. package/src/schematics/table/table-component/template.schema.json +20 -0
  208. package/src/schematics/table/table-header-button/schema.json +146 -64
  209. package/src/schematics/table/table-header-button/template.schema.json +30 -0
  210. package/src/schematics/table/templates/boolean-table-column.hbs +10 -0
  211. package/src/schematics/table/templates/component-table-column.hbs +12 -0
  212. package/src/schematics/table/templates/copy-to-clipboard-table-column.hbs +10 -0
  213. package/src/schematics/table/templates/date-table-column.hbs +11 -0
  214. package/src/schematics/table/templates/default-table-column.hbs +8 -0
  215. package/src/schematics/table/templates/icon-table-column.hbs +10 -0
  216. package/src/schematics/table/templates/link-table-column.hbs +10 -0
  217. package/src/schematics/table/tree-table-component/files/component/__componentName__.component.html.hbs +255 -0
  218. package/src/schematics/table/tree-table-component/index.d.ts +3 -0
  219. package/src/schematics/table/tree-table-component/index.js +28 -7
  220. package/src/schematics/table/tree-table-component/index.js.map +1 -1
  221. package/src/schematics/table/tree-table-component/schema.json +514 -260
  222. package/src/schematics/table/tree-table-component/template.schema.json +20 -0
  223. package/src/schematics/table-action.schema.json +61 -0
  224. package/src/schematics/table-column.schema.json +75 -0
  225. package/src/schematics/table.schema.json +57 -0
  226. package/src/schematics/templates/pipe.hbs +4 -0
  227. package/src/schematics/tree-component/schema.json +115 -70
  228. package/src/schematics/tree-component/template.schema.json +36 -0
  229. package/src/schematics/tree-table.schema.json +40 -0
  230. package/src/schematics/type.schema.json +35 -0
  231. package/src/schematics/upstream.schema.json +56 -0
  232. package/src/schematics/value.schema.json +26 -0
  233. package/src/template.schema.json +173 -0
  234. package/src/lib/accordion-itme-types.d.ts +0 -8
  235. package/src/lib/accordion-itme-types.js +0 -16
  236. package/src/lib/accordion-itme-types.js.map +0 -1
  237. package/src/schematics/accordion/accordion-component/files/component/__componentName__.component.html.template +0 -94
  238. package/src/schematics/accordion/accordion-component/files/header-component/accordion-header.component.html.template +0 -10
  239. package/src/schematics/data-grid-component/files/form/__componentName__.component.html.template +0 -42
  240. package/src/schematics/data-grid-component/files/plain/__componentName__.component.html.template +0 -25
  241. package/src/schematics/table/table-component/files/component/__componentName__.component.html.template +0 -299
  242. package/src/schematics/table/tree-table-component/files/component/__componentName__.component.html.template +0 -213
@@ -1,173 +1,298 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/schema",
3
- "$id": "form-component",
4
- "type": "object",
5
- "properties": {
6
- "name": {
7
- "type": "string",
8
- "description": "The name of form",
9
- "x-prompt": "Enter the name of the form?"
3
+ "$id": "form-component-schematic",
4
+ "allOf": [
5
+ {
6
+ "$ref": "#/definitions/angular"
10
7
  },
11
- "project": {
12
- "type": "string",
13
- "description": "The project where the module should be created",
14
- "x-prompt": "Enter project name where the module should be created"
8
+ {
9
+ "$ref": "#/definitions/formComponent"
10
+ }
11
+ ],
12
+ "definitions": {
13
+ "angular": {
14
+ "allOf": [
15
+ {
16
+ "$ref": "#/definitions/general"
17
+ },
18
+ {
19
+ "type": "object",
20
+ "properties": {
21
+ "componentName": {
22
+ "type": "string"
23
+ },
24
+ "name": {
25
+ "type": "string"
26
+ },
27
+ "context": {
28
+ "type": "string",
29
+ "description": "The context use to generate proper names for class, files, etc"
30
+ },
31
+ "nestModule": {
32
+ "type": "string",
33
+ "description": "The module name for the table nest operations"
34
+ },
35
+ "controllerName": {
36
+ "type": "string"
37
+ },
38
+ "backend": {
39
+ "$ref": "#/definitions/backend"
40
+ },
41
+ "directory": {
42
+ "type": "string",
43
+ "description": "A directory name or absolute path where the files should be generated. Relative to the project and feature base path if a feature is defined"
44
+ },
45
+ "shared": {
46
+ "type": "boolean",
47
+ "description": "Whether the generated code is used across the project",
48
+ "default": false
49
+ },
50
+ "scope": {
51
+ "type": "string"
52
+ },
53
+ "prefix": {
54
+ "type": "string"
55
+ },
56
+ "openApi": {
57
+ "type": "object",
58
+ "additionalProperties": true
59
+ }
60
+ }
61
+ }
62
+ ]
15
63
  },
16
- "feature": {
17
- "type": "string",
18
- "description": "The feature where the module should be created",
19
- "x-prompt": "Enter feature name where the module should be created"
64
+ "formComponent": {
65
+ "allOf": [
66
+ {
67
+ "$ref": "#/definitions/formDefinition"
68
+ },
69
+ {
70
+ "type": "object",
71
+ "properties": {
72
+ "window": {
73
+ "type": "boolean",
74
+ "description": "Whether the form can be opened in a window"
75
+ },
76
+ "role": {
77
+ "type": "string",
78
+ "description": "Define the role of the form"
79
+ },
80
+ "matFormFieldDefaultOptions": {
81
+ "appearance": {
82
+ "type": "string",
83
+ "description": "The appearance of the mat form field",
84
+ "enum": [
85
+ "legacy",
86
+ "standard",
87
+ "fill",
88
+ "outline"
89
+ ]
90
+ }
91
+ },
92
+ "identifier": {
93
+ "$ref": "#/definitions/accordionIdentifier"
94
+ }
95
+ }
96
+ }
97
+ ]
98
+ },
99
+ "accordionIdentifier": {
100
+ "type": "object",
101
+ "properties": {
102
+ "property": {
103
+ "$ref": "#/definitions/property"
104
+ },
105
+ "source": {
106
+ "type": "string",
107
+ "enum": [
108
+ "route"
109
+ ],
110
+ "default": "route"
111
+ }
112
+ },
113
+ "required": [
114
+ "property"
115
+ ]
20
116
  },
21
117
  "backend": {
22
118
  "type": "string",
23
119
  "description": "The backend that should be used to handel data",
24
120
  "enum": [
25
121
  "none",
26
- "local",
27
122
  "nestjs",
28
- "open-api"
123
+ "open-api",
124
+ "local"
29
125
  ],
30
126
  "default": "none"
31
127
  },
32
- "shared": {
33
- "type": "boolean",
34
- "description": "Whether the form is shared across applications"
35
- },
36
- "window": {
37
- "type": "boolean",
38
- "description": "Whether the form can be opened in a window"
39
- },
40
- "directory": {
41
- "type": "string",
42
- "description": "A path suffix added to the base path"
43
- },
44
- "role": {
45
- "type": "string",
46
- "description": "Define the role of the form"
47
- },
48
- "nestModule": {
49
- "type": "string",
50
- "description": "Name of the nest module where the controller is created"
51
- },
52
- "controllerName": {
53
- "type": "string",
54
- "description": "Name of the nest controller"
128
+ "formControl": {
129
+ "type": "object",
130
+ "properties": {
131
+ "name": {
132
+ "type": "string",
133
+ "description": "The name of the control"
134
+ },
135
+ "type": {
136
+ "$ref": "#/definitions/type"
137
+ },
138
+ "isArray": {
139
+ "type": "boolean",
140
+ "description": "Whether the control value is an array",
141
+ "default": false
142
+ },
143
+ "state": {
144
+ "type": "string",
145
+ "description": "The initial state of the control"
146
+ },
147
+ "isRequired": {
148
+ "type": "boolean",
149
+ "description": "Whether the control value is required",
150
+ "default": false
151
+ },
152
+ "isReadonly": {
153
+ "type": "boolean",
154
+ "description": "Whether the control value is readonly",
155
+ "default": false
156
+ },
157
+ "isDisabled": {
158
+ "type": "boolean",
159
+ "description": "Whether the control value is disabled",
160
+ "default": false
161
+ },
162
+ "validatorList": {
163
+ "type": "array",
164
+ "items": {
165
+ "type": "string"
166
+ }
167
+ },
168
+ "kind": {
169
+ "type": "string",
170
+ "description": "The name of the template",
171
+ "enum": [
172
+ "default",
173
+ "input",
174
+ "select",
175
+ "checkbox",
176
+ "autocomplete-table-select",
177
+ "table-select",
178
+ "textarea",
179
+ "slide-toggle"
180
+ ],
181
+ "default": "default"
182
+ }
183
+ },
184
+ "required": [
185
+ "name"
186
+ ],
187
+ "additionalProperties": true
55
188
  },
56
- "matFormFieldDefaultOptions": {
57
- "appearance": {
58
- "type": "string",
59
- "description": "The appearance of the mat form field",
60
- "enum": [
61
- "legacy",
62
- "standard",
63
- "fill",
64
- "outline"
65
- ]
66
- }
189
+ "formDefinition": {
190
+ "type": "object",
191
+ "properties": {
192
+ "controlList": {
193
+ "alias": "control",
194
+ "type": "array",
195
+ "items": {
196
+ "$ref": "#/definitions/formControl"
197
+ }
198
+ }
199
+ },
200
+ "required": [
201
+ "controlList"
202
+ ]
67
203
  },
68
- "controlList": {
69
- "alias": "control",
70
- "type": "array",
71
- "items": {
72
- "type": "object",
73
- "properties": {
74
- "name": {
75
- "type": "string",
76
- "description": "The name of the control"
77
- },
78
- "type": {
79
- "oneOf": [
80
- {
204
+ "general": {
205
+ "type": "object",
206
+ "properties": {
207
+ "project": {
208
+ "type": "string",
209
+ "description": "Project name where the files should be generated"
210
+ },
211
+ "feature": {
212
+ "type": "string",
213
+ "description": "Feature name where the files should be generated"
214
+ },
215
+ "overwrite": {
216
+ "anyOf": [
217
+ {
218
+ "type": "boolean"
219
+ },
220
+ {
221
+ "type": "array",
222
+ "items": {
81
223
  "type": "string"
82
- },
83
- {
84
- "type": "object",
85
- "properties": {
86
- "name": {
87
- "type": "string"
88
- },
89
- "isTypeOnly": {
90
- "type": "boolean"
91
- },
92
- "moduleSpecifier": {
93
- "type": "string"
94
- },
95
- "namedImport": {
96
- "type": "string"
97
- },
98
- "namespaceImport": {
99
- "type": "string"
100
- },
101
- "defaultImport": {
102
- "type": "string"
103
- }
104
- },
105
- "required": [
106
- "name"
107
- ]
108
224
  }
109
- ]
110
- },
111
- "isArray": {
112
- "type": "boolean",
113
- "description": "Whether the control value is an array",
114
- "default": false
115
- },
116
- "state": {
117
- "type": "string",
118
- "description": "The initial state of the control"
119
- },
120
- "isRequired": {
121
- "type": "boolean",
122
- "description": "Whether the control value is required",
123
- "default": false
124
- },
125
- "isReadonly": {
126
- "type": "boolean",
127
- "description": "Whether the control value is readonly",
128
- "default": false
129
- },
130
- "isDisabled": {
131
- "type": "boolean",
132
- "description": "Whether the control value is disabled",
133
- "default": false
134
- },
135
- "validatorList": {
136
- "type": "array",
137
- "items": {
138
- "type": "string"
139
225
  }
140
- },
141
- "template": {
142
- "type": "object",
143
- "properties": {
144
- "name": {
145
- "type": "string",
146
- "description": "The name of the template",
147
- "enum": [
148
- "default",
149
- "input",
150
- "select"
151
- ]
152
- }
153
- },
154
- "additionalProperties": true,
155
- "required": ["name"]
156
- }
226
+ ],
227
+ "description": "Overwrite existing files",
228
+ "default": false
229
+ },
230
+ "overwriteHtml": {
231
+ "type": "boolean",
232
+ "default": false
157
233
  },
158
- "required": [
159
- "name"
160
- ]
234
+ "replace": {
235
+ "type": "boolean",
236
+ "default": false
237
+ }
161
238
  }
162
239
  },
163
- "context": {
164
- "type": "string",
165
- "description": "The context use to generate proper names for class, files, etc"
240
+ "property": {
241
+ "oneOf": [
242
+ {
243
+ "type": "string"
244
+ },
245
+ {
246
+ "type": "object",
247
+ "properties": {
248
+ "name": {
249
+ "type": "string"
250
+ },
251
+ "type": {
252
+ "$ref": "#/definitions/type"
253
+ },
254
+ "isArray": {
255
+ "type": "boolean"
256
+ }
257
+ },
258
+ "required": [
259
+ "name"
260
+ ]
261
+ }
262
+ ]
263
+ },
264
+ "type": {
265
+ "oneOf": [
266
+ {
267
+ "type": "string"
268
+ },
269
+ {
270
+ "type": "object",
271
+ "properties": {
272
+ "name": {
273
+ "type": "string"
274
+ },
275
+ "isTypeOnly": {
276
+ "type": "boolean"
277
+ },
278
+ "moduleSpecifier": {
279
+ "type": "string"
280
+ },
281
+ "namedImport": {
282
+ "type": "string"
283
+ },
284
+ "namespaceImport": {
285
+ "type": "string"
286
+ },
287
+ "defaultImport": {
288
+ "type": "string"
289
+ }
290
+ },
291
+ "required": [
292
+ "name"
293
+ ]
294
+ }
295
+ ]
166
296
  }
167
- },
168
- "required": [
169
- "name",
170
- "project",
171
- "feature"
172
- ]
173
- }
297
+ }
298
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "form-component-schematic",
4
+ "allOf": [
5
+ {
6
+ "$ref": "#/definitions/angular"
7
+ },
8
+ {
9
+ "$ref": "#/definitions/formComponent"
10
+ }
11
+ ],
12
+ "definitions": {
13
+ "angular": {
14
+ "$ref": "../../angular.schema.json"
15
+ },
16
+ "formComponent": {
17
+ "$ref": "../../form-component.schema.json"
18
+ }
19
+ }
20
+ }
@@ -1,9 +1,11 @@
1
+ import { Rule } from '@angular-devkit/schematics';
1
2
  import { Normalized } from '@rxap/utilities';
2
3
  import { NormalizedAngularOptions } from '../../../lib/angular-options';
3
4
  import { NormalizedFormDefinitionControl } from '../../../lib/form-definition-control';
4
5
  import { FormControlOptions } from './schema';
6
+ import 'colors';
5
7
  export interface NormalizedFormControlOptions extends Readonly<Normalized<FormControlOptions> & NormalizedAngularOptions & NormalizedFormDefinitionControl> {
6
8
  controllerName: string;
7
9
  }
8
10
  export declare function NormalizeFormControlOptions(options: Readonly<FormControlOptions>): NormalizedFormControlOptions;
9
- export default function (options: FormControlOptions): () => import("@angular-devkit/schematics").Rule;
11
+ export default function (options: FormControlOptions): () => Rule;
@@ -5,25 +5,35 @@ const schematics_1 = require("@angular-devkit/schematics");
5
5
  const schematics_ts_morph_1 = require("@rxap/schematics-ts-morph");
6
6
  const schematics_utilities_1 = require("@rxap/schematics-utilities");
7
7
  const angular_options_1 = require("../../../lib/angular-options");
8
+ const form_control_1 = require("../../../lib/form-control");
8
9
  const form_definition_control_1 = require("../../../lib/form-definition-control");
10
+ require("colors");
9
11
  function NormalizeFormControlOptions(options) {
10
- var _a, _b;
12
+ var _a;
11
13
  const normalizedAngularOptions = (0, angular_options_1.NormalizeAngularOptions)(options);
12
14
  const normalizedFormDefinitionControl = (0, form_definition_control_1.NormalizeFormDefinitionControl)(options);
13
- const { nestModule } = normalizedAngularOptions;
14
15
  const formName = (0, schematics_utilities_1.dasherize)(options.formName);
15
- let directory = (_a = options.directory) !== null && _a !== void 0 ? _a : '';
16
- if (!directory.endsWith('/' + formName + '-form')) {
17
- directory += '/' + formName + '-form';
18
- }
19
- const controllerName = (_b = options.controllerName) !== null && _b !== void 0 ? _b : formName;
16
+ const controllerName = (_a = options.controllerName) !== null && _a !== void 0 ? _a : formName;
20
17
  return Object.freeze(Object.assign(Object.assign(Object.assign({}, normalizedAngularOptions), normalizedFormDefinitionControl), { formName,
21
- directory,
22
18
  controllerName, context: options.context ? (0, schematics_utilities_1.dasherize)(options.context) : null }));
23
19
  }
24
20
  exports.NormalizeFormControlOptions = NormalizeFormControlOptions;
25
21
  function printOptions(options) {
26
22
  (0, angular_options_1.PrintAngularOptions)('form-control', options);
23
+ console.log(`=== form: ${options.formName}`.blue);
24
+ }
25
+ function formControlKind(normalizedOptions) {
26
+ switch (normalizedOptions.kind) {
27
+ case form_control_1.FormControlKinds.INPUT:
28
+ return (0, schematics_utilities_1.ExecuteSchematic)('input-form-control', normalizedOptions);
29
+ case form_control_1.FormControlKinds.SELECT:
30
+ return (0, schematics_utilities_1.ExecuteSchematic)('select-form-control', normalizedOptions);
31
+ case form_control_1.FormControlKinds.TABLE_SELECT:
32
+ return (0, schematics_utilities_1.ExecuteSchematic)('table-select-form-control', normalizedOptions);
33
+ default:
34
+ return () => console.log(`No schematic for form control kind: ${normalizedOptions.kind}`.yellow);
35
+ }
36
+ return (0, schematics_1.noop)();
27
37
  }
28
38
  function default_1(options) {
29
39
  const normalizedOptions = NormalizeFormControlOptions(options);
@@ -45,6 +55,7 @@ function default_1(options) {
45
55
  isRequired,
46
56
  validatorList,
47
57
  }),
58
+ formControlKind(normalizedOptions),
48
59
  () => console.groupEnd(),
49
60
  ]);
50
61
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/schematic/angular/src/schematics/form/form-control/index.ts"],"names":[],"mappings":";;;AAAA,2DAAmD;AACnD,mEAAwE;AACxE,qEAAuD;AAEvD,kEAIsC;AACtC,kFAG8C;AAQ9C,SAAgB,2BAA2B,CACzC,OAAqC;;IAErC,MAAM,wBAAwB,GAAG,IAAA,yCAAuB,EAAC,OAAO,CAAC,CAAC;IAClE,MAAM,+BAA+B,GAAG,IAAA,wDAA8B,EAAC,OAAO,CAAC,CAAC;IAChF,MAAM,EAAE,UAAU,EAAE,GAAG,wBAAwB,CAAC;IAChD,MAAM,QA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,IAAI;gBACJ,IAAI;gBACJ,OAAO;gBACP,KAAK;gBACL,UAAU;gBACV,aAAa;aACd,CAAC;YACF,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE;SACzB,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAnCD,4BAmCC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/schematic/angular/src/schematics/form/form-control/index.ts"],"names":[],"mappings":";;;AAAA,2DAIoC;AACpC,mEAAwE;AACxE,qEAGoC;AAEpC,kEAIsC;AACtC,4DAA6D;AAC7D,kFAG8C;AAE9C,kBAAgB;AAOhB,SAAgB,2BAA2B,CACzC,OAAqC;;IAErC,MAAM,wBAAwB,GAAG,IAAA,yCAAuB,EAAC,OAAO,CAAC,CAAC;IAClE,MAAM,+BAA+B,GAAG,IAAA,wDAA8B,EAAC,OAAO,CAAC,CAAC;IAChF,MAAM,QAAQ,GAAG,IAAA,gCAAS,EAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7C,MAAM,cAAc,GAAG,MAAA,OAAO,CAAC,cAAc,mCAAI,QAAQ,CAAC;IAC1D,OAAO,MAAM,CAAC,MAAM,+CACf,wBAAwB,GACxB,+BAA+B,KAClC,QAAQ;QACR,cAAc,EACd,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,IAAA,gCAAS,EAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,IAC5D,CAAC;AACL,CAAC;AAdD,kEAcC;AAED,SAAS,YAAY,CAAC,OAAqC;IACzD,IAAA,qCAAmB,EAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAC7C,OAAO,CAAC,GAAG,CAAC,aAAa,OAAO,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC;AACpD,CAAC;AAED,SAAS,eAAe,CAAC,iBAA+C;IACtE,QAAQ,iBAAiB,CAAC,IAAI,EAAE;QAE9B,KAAK,+BAAgB,CAAC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