@rxap/schematic-angular 16.2.0-dev.5 → 16.2.0-dev.7

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 (198) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +1 -1
  3. package/package.json +6 -4
  4. package/src/lib/accordion-header.d.ts +5 -0
  5. package/src/lib/accordion-header.js +8 -2
  6. package/src/lib/accordion-header.js.map +1 -1
  7. package/src/lib/accordion-item.d.ts +17 -16
  8. package/src/lib/accordion-item.js +44 -32
  9. package/src/lib/accordion-item.js.map +1 -1
  10. package/src/lib/accordion-itme-kinds.d.ts +8 -0
  11. package/src/lib/accordion-itme-kinds.js +16 -0
  12. package/src/lib/accordion-itme-kinds.js.map +1 -0
  13. package/src/lib/coerce-accordion-component.js +2 -2
  14. package/src/lib/coerce-accordion-component.js.map +1 -1
  15. package/src/lib/coerce-form-component.js +5 -2
  16. package/src/lib/coerce-form-component.js.map +1 -1
  17. package/src/lib/coerce-minimum-table-component.js +7 -3
  18. package/src/lib/coerce-minimum-table-component.js.map +1 -1
  19. package/src/lib/coerce-tree-table-component.js +16 -0
  20. package/src/lib/coerce-tree-table-component.js.map +1 -1
  21. package/src/lib/data-grid-item.d.ts +4 -7
  22. package/src/lib/data-grid-item.js.map +1 -1
  23. package/src/lib/data-grid-options.d.ts +2 -0
  24. package/src/lib/data-grid-options.js +7 -3
  25. package/src/lib/data-grid-options.js.map +1 -1
  26. package/src/lib/form/generate-form-template.d.ts +5 -0
  27. package/src/lib/form/generate-form-template.js +12 -0
  28. package/src/lib/form/generate-form-template.js.map +1 -0
  29. package/src/lib/form-component-control.d.ts +2 -6
  30. package/src/lib/form-component-control.js.map +1 -1
  31. package/src/lib/form-control.d.ts +125 -0
  32. package/src/lib/form-control.js +303 -0
  33. package/src/lib/form-control.js.map +1 -0
  34. package/src/lib/form-definition-control.d.ts +3 -57
  35. package/src/lib/form-definition-control.js +18 -144
  36. package/src/lib/form-definition-control.js.map +1 -1
  37. package/src/lib/load-handlebars-template.d.ts +3 -0
  38. package/src/lib/load-handlebars-template.js +24 -0
  39. package/src/lib/load-handlebars-template.js.map +1 -0
  40. package/src/lib/minimum-table-component-options.d.ts +1 -1
  41. package/src/lib/minimum-table-component-options.js +3 -3
  42. package/src/lib/minimum-table-component-options.js.map +1 -1
  43. package/src/lib/table-column.d.ts +8 -2
  44. package/src/lib/table-column.js +32 -15
  45. package/src/lib/table-column.js.map +1 -1
  46. package/src/schematics/accordion/accordion-component/files/component/__componentName__.component.html.hbs +25 -0
  47. package/src/schematics/accordion/accordion-component/index.js +6 -98
  48. package/src/schematics/accordion/accordion-component/index.js.map +1 -1
  49. package/src/schematics/accordion/accordion-component/template.schema.json +102 -0
  50. package/src/schematics/accordion/accordion-item-component/index.d.ts +2 -2
  51. package/src/schematics/accordion/accordion-item-component/index.js +42 -42
  52. package/src/schematics/accordion/accordion-item-component/index.js.map +1 -1
  53. package/src/schematics/accordion/accordion-item-component/schema.d.ts +2 -2
  54. package/src/schematics/accordion/accordion-item-component/template.schema.json +33 -0
  55. package/src/schematics/accordion/item/accordion-item-data-grid-component/index.d.ts +1 -1
  56. package/src/schematics/accordion/item/accordion-item-data-grid-component/index.js +17 -29
  57. package/src/schematics/accordion/item/accordion-item-data-grid-component/index.js.map +1 -1
  58. package/src/schematics/accordion/item/accordion-item-data-grid-component/schema.d.ts +1 -1
  59. package/src/schematics/accordion/item/accordion-item-data-grid-component/template.schema.json +31 -0
  60. package/src/schematics/accordion/item/accordion-item-switch-component/index.d.ts +1 -1
  61. package/src/schematics/accordion/item/accordion-item-switch-component/index.js +4 -4
  62. package/src/schematics/accordion/item/accordion-item-switch-component/index.js.map +1 -1
  63. package/src/schematics/accordion/item/accordion-item-switch-component/schema.d.ts +1 -1
  64. package/src/schematics/accordion/item/accordion-item-switch-component/template.schema.json +84 -0
  65. package/src/schematics/accordion/item/accordion-item-table-component/index.d.ts +1 -1
  66. package/src/schematics/accordion/item/accordion-item-table-component/index.js +8 -8
  67. package/src/schematics/accordion/item/accordion-item-table-component/index.js.map +1 -1
  68. package/src/schematics/accordion/item/accordion-item-table-component/schema.d.ts +1 -1
  69. package/src/schematics/accordion/item/accordion-item-table-component/template.schema.json +46 -0
  70. package/src/schematics/accordion/item/accordion-item-tree-table-component/index.d.ts +1 -1
  71. package/src/schematics/accordion/item/accordion-item-tree-table-component/index.js +10 -10
  72. package/src/schematics/accordion/item/accordion-item-tree-table-component/index.js.map +1 -1
  73. package/src/schematics/accordion/item/accordion-item-tree-table-component/schema.d.ts +1 -1
  74. package/src/schematics/accordion/item/accordion-item-tree-table-component/template.schema.json +46 -0
  75. package/src/schematics/accordion/templates/accordion-header.hbs +6 -0
  76. package/src/schematics/accordion/templates/data-grid-accordion-item.hbs +15 -0
  77. package/src/schematics/accordion/templates/default-accordion-item.hbs +15 -0
  78. package/src/schematics/accordion/templates/switch-accordion-item.hbs +21 -0
  79. package/src/schematics/accordion/templates/table-accordion-item.hbs +15 -0
  80. package/src/schematics/accordion/templates/tree-table-accordion-item.hbs +15 -0
  81. package/src/schematics/accordion-item.schema.json +35 -0
  82. package/src/schematics/angular.schema.json +2 -10
  83. package/src/schematics/backend.schema.json +13 -0
  84. package/src/schematics/button.schema.json +30 -0
  85. package/src/schematics/data-grid-component/files/component/__componentName__.component.html.hbs +34 -0
  86. package/src/schematics/data-grid-component/index.d.ts +0 -1
  87. package/src/schematics/data-grid-component/index.js +21 -7
  88. package/src/schematics/data-grid-component/index.js.map +1 -1
  89. package/src/schematics/data-grid-component/template.schema.json +23 -0
  90. package/src/schematics/data-grid-item.schema.json +23 -0
  91. package/src/schematics/data-grid.schema.json +44 -0
  92. package/src/schematics/dialog-component/template.schema.json +65 -0
  93. package/src/schematics/form/control/input-form-control/index.d.ts +2 -2
  94. package/src/schematics/form/control/input-form-control/index.js +4 -27
  95. package/src/schematics/form/control/input-form-control/index.js.map +1 -1
  96. package/src/schematics/form/control/input-form-control/schema.d.ts +2 -3
  97. package/src/schematics/form/control/input-form-control/template.schema.json +23 -0
  98. package/src/schematics/form/control/select-form-control/index.d.ts +4 -2
  99. package/src/schematics/form/control/select-form-control/index.js +132 -96
  100. package/src/schematics/form/control/select-form-control/index.js.map +1 -1
  101. package/src/schematics/form/control/select-form-control/schema.d.ts +2 -3
  102. package/src/schematics/form/control/select-form-control/template.schema.json +23 -0
  103. package/src/schematics/form/control/table-select-form-control/index.d.ts +4 -6
  104. package/src/schematics/form/control/table-select-form-control/index.js +80 -68
  105. package/src/schematics/form/control/table-select-form-control/index.js.map +1 -1
  106. package/src/schematics/form/control/table-select-form-control/schema.d.ts +2 -4
  107. package/src/schematics/form/control/table-select-form-control/template.schema.json +78 -0
  108. package/src/schematics/form/form-component/files/component/{__componentName__.component.html.template → __componentName__.component.html.hbs} +3 -3
  109. package/src/schematics/form/form-component/index.js +4 -1
  110. package/src/schematics/form/form-component/index.js.map +1 -1
  111. package/src/schematics/form/form-component/template.schema.json +23 -0
  112. package/src/schematics/form/form-control/index.d.ts +3 -1
  113. package/src/schematics/form/form-control/index.js +19 -8
  114. package/src/schematics/form/form-control/index.js.map +1 -1
  115. package/src/schematics/form/form-control/template.schema.json +37 -0
  116. package/src/schematics/form/form-definition/index.js +14 -1
  117. package/src/schematics/form/form-definition/index.js.map +1 -1
  118. package/src/schematics/form/form-definition/template.schema.json +33 -0
  119. package/src/schematics/form/templates/checkbox-form-control.hbs +9 -0
  120. package/src/schematics/form/templates/default-form-control.hbs +2 -0
  121. package/src/schematics/form/templates/input-form-control.hbs +9 -0
  122. package/src/schematics/form/templates/mat-form-field.hbs +31 -0
  123. package/src/schematics/form/templates/slide-toggle-form-control.hbs +8 -0
  124. package/src/schematics/form/templates/table-select-form-control.hbs +18 -0
  125. package/src/schematics/form-component.schema.json +39 -0
  126. package/src/schematics/form-control.schema.json +68 -0
  127. package/src/schematics/form-definition.schema.json +22 -0
  128. package/src/schematics/form-field.schema.json +24 -0
  129. package/src/schematics/header-button.schema.json +42 -0
  130. package/src/schematics/input-form-control.schema.json +47 -0
  131. package/src/schematics/minimum-table.schema.json +54 -0
  132. package/src/schematics/property.schema.json +28 -0
  133. package/src/schematics/select-form-control.schema.json +53 -0
  134. package/src/schematics/table/action/dialog-table-action/template.schema.json +61 -0
  135. package/src/schematics/table/action/form-table-action/template.schema.json +75 -0
  136. package/src/schematics/table/action/navigation-table-action/template.schema.json +31 -0
  137. package/src/schematics/table/action/open-api-table-action/template.schema.json +59 -0
  138. package/src/schematics/table/action/operation-table-action/template.schema.json +17 -0
  139. package/src/schematics/table/header-button/form-table-header-button/template.schema.json +51 -0
  140. package/src/schematics/table/header-button/navigation-table-header-button/template.schema.json +31 -0
  141. package/src/schematics/table/table-action/template.schema.json +30 -0
  142. package/src/schematics/table/table-component/files/component/__componentName__.component.html.hbs +241 -0
  143. package/src/schematics/table/table-component/index.d.ts +1 -1
  144. package/src/schematics/table/table-component/index.js +2 -2
  145. package/src/schematics/table/table-component/index.js.map +1 -1
  146. package/src/schematics/table/table-component/template.schema.json +26 -0
  147. package/src/schematics/table/table-header-button/template.schema.json +30 -0
  148. package/src/schematics/table/templates/boolean-table-column.hbs +10 -0
  149. package/src/schematics/table/templates/component-table-column.hbs +12 -0
  150. package/src/schematics/table/templates/copy-to-clipboard-table-column.hbs +10 -0
  151. package/src/schematics/table/templates/date-table-column.hbs +11 -0
  152. package/src/schematics/table/templates/default-table-column.hbs +8 -0
  153. package/src/schematics/table/templates/icon-table-column.hbs +10 -0
  154. package/src/schematics/table/templates/link-table-column.hbs +10 -0
  155. package/src/schematics/table/tree-table-component/files/component/__componentName__.component.html.hbs +249 -0
  156. package/src/schematics/table/tree-table-component/template.schema.json +26 -0
  157. package/src/schematics/table-action.schema.json +61 -0
  158. package/src/schematics/table-column.schema.json +69 -0
  159. package/src/schematics/table.schema.json +54 -0
  160. package/src/schematics/tree-component/template.schema.json +31 -0
  161. package/src/schematics/tree-table.schema.json +40 -0
  162. package/src/schematics/type.schema.json +35 -0
  163. package/src/schematics/upstream.schema.json +56 -0
  164. package/src/lib/accordion-itme-types.d.ts +0 -8
  165. package/src/lib/accordion-itme-types.js +0 -16
  166. package/src/lib/accordion-itme-types.js.map +0 -1
  167. package/src/schematics/accordion/accordion-component/files/component/__componentName__.component.html.template +0 -94
  168. package/src/schematics/accordion/accordion-component/files/header-component/accordion-header.component.html.template +0 -10
  169. package/src/schematics/accordion/accordion-component/schema.json +0 -191
  170. package/src/schematics/accordion/accordion-item-component/schema.json +0 -92
  171. package/src/schematics/accordion/item/accordion-item-data-grid-component/schema.json +0 -133
  172. package/src/schematics/accordion/item/accordion-item-switch-component/schema.json +0 -226
  173. package/src/schematics/accordion/item/accordion-item-table-component/schema.json +0 -334
  174. package/src/schematics/accordion/item/accordion-item-tree-table-component/schema.json +0 -334
  175. package/src/schematics/data-grid-component/files/form/__componentName__.component.html.template +0 -42
  176. package/src/schematics/data-grid-component/files/plain/__componentName__.component.html.template +0 -25
  177. package/src/schematics/data-grid-component/schema.json +0 -176
  178. package/src/schematics/dialog-component/schema.json +0 -81
  179. package/src/schematics/form/control/input-form-control/schema.json +0 -116
  180. package/src/schematics/form/control/select-form-control/schema.json +0 -102
  181. package/src/schematics/form/control/table-select-form-control/schema.json +0 -106
  182. package/src/schematics/form/form-component/schema.json +0 -173
  183. package/src/schematics/form/form-control/schema.json +0 -92
  184. package/src/schematics/form/form-definition/schema.json +0 -148
  185. package/src/schematics/table/action/dialog-table-action/schema.json +0 -148
  186. package/src/schematics/table/action/form-table-action/schema.json +0 -202
  187. package/src/schematics/table/action/navigation-table-action/schema.json +0 -95
  188. package/src/schematics/table/action/open-api-table-action/schema.json +0 -121
  189. package/src/schematics/table/action/operation-table-action/schema.json +0 -98
  190. package/src/schematics/table/header-button/form-table-header-button/schema.json +0 -139
  191. package/src/schematics/table/header-button/navigation-table-header-button/schema.json +0 -87
  192. package/src/schematics/table/table-action/schema.json +0 -94
  193. package/src/schematics/table/table-component/files/component/__componentName__.component.html.template +0 -299
  194. package/src/schematics/table/table-component/schema.json +0 -340
  195. package/src/schematics/table/table-header-button/schema.json +0 -80
  196. package/src/schematics/table/tree-table-component/files/component/__componentName__.component.html.template +0 -259
  197. package/src/schematics/table/tree-table-component/schema.json +0 -316
  198. package/src/schematics/tree-component/schema.json +0 -86
@@ -1,5 +1,4 @@
1
+ import { InputFormControl } from '../../../../lib/form-control';
1
2
  import { FormControlOptions } from '../../form-control/schema';
2
3
 
3
- export interface InputFormControlOptions extends FormControlOptions {
4
- inputType?: string;
5
- }
4
+ export interface InputFormControlOptions extends FormControlOptions, InputFormControl {}
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "input-form-control-schematic",
4
+ "allOf": [
5
+ {
6
+ "$ref": "../../form-control/template.schema.json"
7
+ },
8
+ {
9
+ "$ref": "../../../input-form-control.schema.json"
10
+ }
11
+ ],
12
+ "definitions": {
13
+ "type": {
14
+ "$ref": "../../../type.schema.json"
15
+ },
16
+ "property": {
17
+ "$ref": "../../../property.schema.json"
18
+ },
19
+ "button": {
20
+ "$ref": "../../../button.schema.json"
21
+ }
22
+ }
23
+ }
@@ -1,6 +1,8 @@
1
+ import { Rule } from '@angular-devkit/schematics';
1
2
  import { Normalized } from '@rxap/utilities';
3
+ import { NormalizedSelectFormControl } from '../../../../lib/form-control';
2
4
  import { NormalizedFormControlOptions } from '../../form-control';
3
5
  import { SelectFormControlOptions } from './schema';
4
- export type NormalizedSelectFormControlOptions = Readonly<Normalized<SelectFormControlOptions> & NormalizedFormControlOptions>;
6
+ export type NormalizedSelectFormControlOptions = Readonly<Normalized<Omit<SelectFormControlOptions, 'options'>>> & NormalizedFormControlOptions & NormalizedSelectFormControl;
5
7
  export declare function NormalizeSelectFormControlOptions(options: SelectFormControlOptions): NormalizedSelectFormControlOptions;
6
- export default function (options: SelectFormControlOptions): () => import("@angular-devkit/schematics").Rule;
8
+ export default function (options: SelectFormControlOptions): () => Rule;
@@ -7,116 +7,152 @@ const schematics_utilities_1 = require("@rxap/schematics-utilities");
7
7
  const path_1 = require("path");
8
8
  const ts_morph_1 = require("ts-morph");
9
9
  const angular_options_1 = require("../../../../lib/angular-options");
10
- const form_control_1 = require("../../form-control");
10
+ const backend_types_1 = require("../../../../lib/backend-types");
11
+ const form_control_1 = require("../../../../lib/form-control");
12
+ const form_control_2 = require("../../form-control");
11
13
  function NormalizeSelectFormControlOptions(options) {
12
- var _a, _b;
13
- const normalizedOptions = (0, form_control_1.NormalizeFormControlOptions)(options);
14
- let { isArray } = normalizedOptions;
15
- const multiple = (_a = options.multiple) !== null && _a !== void 0 ? _a : false;
16
- isArray = multiple ? true : isArray;
17
- return Object.freeze(Object.assign(Object.assign({}, normalizedOptions), { isArray,
18
- multiple, staticDataSource: (_b = options.staticDataSource) !== null && _b !== void 0 ? _b : false }));
14
+ return Object.freeze(Object.assign(Object.assign({}, (0, form_control_2.NormalizeFormControlOptions)(options)), (0, form_control_1.NormalizeSelectFormControl)(options)));
19
15
  }
20
16
  exports.NormalizeSelectFormControlOptions = NormalizeSelectFormControlOptions;
21
17
  function printOptions(options) {
22
18
  (0, angular_options_1.PrintAngularOptions)('select-form-control', options);
23
19
  }
24
- function default_1(options) {
25
- const normalizedOptions = NormalizeSelectFormControlOptions(options);
26
- const { name, project, feature, directory, formName, type, isArray, state, isRequired, validatorList, staticDataSource, nestModule, controllerName, context, scope, } = normalizedOptions;
27
- printOptions(normalizedOptions);
28
- const optionsOperationName = ['get', name, 'options'].join('-');
20
+ function noneBackendOptionsRule(normalizedOptions) {
21
+ const { name, project, feature, directory, formName, type, isArray, state, isRequired, validatorList, } = normalizedOptions;
22
+ const optionsDataSourceDirectory = (0, path_1.join)(directory !== null && directory !== void 0 ? directory : '', 'data-sources');
23
+ const optionsDataSourceName = (0, schematics_utilities_1.classify)([name, 'options', 'data-source'].join('-'));
24
+ const optionsDataSourceImportPath = `./data-sources/${(0, schematics_utilities_1.dasherize)(name)}-options.data-source`;
25
+ return (0, schematics_1.chain)([
26
+ (0, schematics_ts_morph_1.CoerceOptionsDataSourceRule)({
27
+ project,
28
+ feature,
29
+ directory: optionsDataSourceDirectory,
30
+ name: [name, 'options'].join('-'),
31
+ }),
32
+ (0, schematics_ts_morph_1.CoerceFormProviderRule)({
33
+ project,
34
+ feature,
35
+ directory,
36
+ providerObject: optionsDataSourceName,
37
+ importStructures: [
38
+ {
39
+ namedImports: [optionsDataSourceName],
40
+ moduleSpecifier: optionsDataSourceImportPath,
41
+ },
42
+ ],
43
+ }),
44
+ (0, schematics_ts_morph_1.CoerceFormDefinitionControl)({
45
+ project,
46
+ feature,
47
+ directory,
48
+ formName,
49
+ name,
50
+ type,
51
+ isArray,
52
+ state,
53
+ isRequired,
54
+ validatorList,
55
+ coerceFormControl: (sourceFile, classDeclaration, control) => {
56
+ const { propertyDeclaration, decoratorDeclaration, } = (0, schematics_ts_morph_1.CoerceFormControl)(sourceFile, classDeclaration, control);
57
+ (0, schematics_ts_morph_1.CoerceDecorator)(propertyDeclaration, 'UseOptionsDataSource').set({
58
+ arguments: [optionsDataSourceName],
59
+ });
60
+ (0, schematics_ts_morph_1.CoerceImports)(sourceFile, {
61
+ namedImports: [optionsDataSourceName],
62
+ moduleSpecifier: optionsDataSourceImportPath,
63
+ });
64
+ (0, schematics_ts_morph_1.CoerceImports)(sourceFile, {
65
+ namedImports: ['UseOptionsDataSource'],
66
+ moduleSpecifier: '@rxap/form-system',
67
+ });
68
+ return {
69
+ propertyDeclaration,
70
+ decoratorDeclaration,
71
+ };
72
+ },
73
+ })
74
+ ]);
75
+ }
76
+ function nestJsBackendOptionsRule(normalizedOptions) {
77
+ const { name, project, feature, directory, formName, type, isArray, state, isRequired, validatorList, nestModule, controllerName, context, scope, } = normalizedOptions;
29
78
  const optionsOperationPath = ['options', name].join('/');
79
+ const optionsOperationName = ['get', name, 'options'].join('-');
30
80
  const optionsOperationId = (0, schematics_ts_morph_1.buildOperationId)(normalizedOptions, optionsOperationName, (0, schematics_ts_morph_1.BuildNestControllerName)({
31
81
  controllerName,
32
82
  nestModule,
33
83
  }));
34
- const optionsDataSourceName = (0, schematics_utilities_1.classify)([name, 'options', 'data-source'].join('-'));
35
- const optionsDataSourceImportPath = `./data-sources/${(0, schematics_utilities_1.dasherize)(name)}-options.data-source`;
36
- const optionsDataSourceDirectory = (0, path_1.join)(directory !== null && directory !== void 0 ? directory : '', 'data-sources');
84
+ return (0, schematics_1.chain)([
85
+ (0, schematics_ts_morph_1.CoerceOptionsOperationRule)({
86
+ project,
87
+ feature,
88
+ nestModule,
89
+ controllerName,
90
+ operationName: optionsOperationName,
91
+ path: optionsOperationPath,
92
+ control: normalizedOptions,
93
+ context,
94
+ }),
95
+ (0, schematics_ts_morph_1.CoerceFormDefinitionControl)({
96
+ project,
97
+ feature,
98
+ directory,
99
+ formName,
100
+ name,
101
+ type,
102
+ isArray,
103
+ state,
104
+ isRequired,
105
+ validatorList,
106
+ coerceFormControl: (sourceFile, classDeclaration, control) => {
107
+ const { propertyDeclaration, decoratorDeclaration, } = (0, schematics_ts_morph_1.CoerceFormControl)(sourceFile, classDeclaration, control);
108
+ (0, schematics_ts_morph_1.CoerceDecorator)(propertyDeclaration, 'UseOptionsMethod').set({
109
+ arguments: [
110
+ (0, schematics_ts_morph_1.OperationIdToClassName)(optionsOperationId),
111
+ ts_morph_1.Writers.object({ withoutParameters: 'true' }),
112
+ ],
113
+ });
114
+ (0, schematics_ts_morph_1.CoerceImports)(sourceFile, {
115
+ namedImports: [(0, schematics_ts_morph_1.OperationIdToClassName)(optionsOperationId)],
116
+ moduleSpecifier: (0, schematics_ts_morph_1.OperationIdToClassImportPath)(optionsOperationId, scope),
117
+ });
118
+ (0, schematics_ts_morph_1.CoerceImports)(sourceFile, {
119
+ namedImports: ['UseOptionsMethod'],
120
+ moduleSpecifier: '@rxap/form-system',
121
+ });
122
+ return {
123
+ propertyDeclaration,
124
+ decoratorDeclaration,
125
+ };
126
+ },
127
+ })
128
+ ]);
129
+ }
130
+ function openApiBackendOptionsRule(normalizedOptions) {
131
+ return () => {
132
+ throw new schematics_1.SchematicsException('The open api backend is not supported yet!');
133
+ };
134
+ }
135
+ function optionsRule(normalizedOptions) {
136
+ const { backend } = normalizedOptions;
137
+ switch (backend) {
138
+ case backend_types_1.BackendTypes.LOCAL:
139
+ case backend_types_1.BackendTypes.NONE:
140
+ return noneBackendOptionsRule(normalizedOptions);
141
+ case backend_types_1.BackendTypes.NESTJS:
142
+ return nestJsBackendOptionsRule(normalizedOptions);
143
+ case backend_types_1.BackendTypes.OPEN_API:
144
+ return openApiBackendOptionsRule(normalizedOptions);
145
+ default:
146
+ throw new schematics_1.SchematicsException(`The backend type "${backend}" is not supported!`);
147
+ }
148
+ }
149
+ function default_1(options) {
150
+ const normalizedOptions = NormalizeSelectFormControlOptions(options);
151
+ printOptions(normalizedOptions);
37
152
  return () => {
38
153
  return (0, schematics_1.chain)([
39
154
  () => console.group('\x1b[32m[@rxap/schematics-angular:select-form-control]\x1b[0m'),
40
- (0, schematics_utilities_1.ExecuteSchematic)('form-control', normalizedOptions),
41
- () => staticDataSource
42
- ? (0, schematics_1.chain)([
43
- (0, schematics_ts_morph_1.CoerceOptionsDataSourceRule)({
44
- project,
45
- feature,
46
- directory: optionsDataSourceDirectory,
47
- name: [name, 'options'].join('-'),
48
- }),
49
- (0, schematics_ts_morph_1.CoerceFormProviderRule)({
50
- project,
51
- feature,
52
- directory,
53
- providerObject: optionsDataSourceName,
54
- importStructures: [
55
- {
56
- namedImports: [optionsDataSourceName],
57
- moduleSpecifier: optionsDataSourceImportPath,
58
- },
59
- ],
60
- }),
61
- ])
62
- : (0, schematics_ts_morph_1.CoerceOptionsOperationRule)({
63
- project,
64
- feature,
65
- nestModule,
66
- controllerName,
67
- operationName: optionsOperationName,
68
- path: optionsOperationPath,
69
- control: normalizedOptions,
70
- context,
71
- }),
72
- (0, schematics_ts_morph_1.CoerceFormDefinitionControl)({
73
- project,
74
- feature,
75
- directory,
76
- formName,
77
- name,
78
- type,
79
- isArray,
80
- state,
81
- isRequired,
82
- validatorList,
83
- coerceFormControl: (sourceFile, classDeclaration, control) => {
84
- const { propertyDeclaration, decoratorDeclaration, } = (0, schematics_ts_morph_1.CoerceFormControl)(sourceFile, classDeclaration, control);
85
- if (staticDataSource) {
86
- (0, schematics_ts_morph_1.CoerceDecorator)(propertyDeclaration, 'UseOptionsDataSource').set({
87
- arguments: [optionsDataSourceName],
88
- });
89
- (0, schematics_ts_morph_1.CoerceImports)(sourceFile, {
90
- namedImports: [optionsDataSourceName],
91
- moduleSpecifier: optionsDataSourceImportPath,
92
- });
93
- (0, schematics_ts_morph_1.CoerceImports)(sourceFile, {
94
- namedImports: ['UseOptionsDataSource'],
95
- moduleSpecifier: '@rxap/form-system',
96
- });
97
- }
98
- else {
99
- (0, schematics_ts_morph_1.CoerceDecorator)(propertyDeclaration, 'UseOptionsMethod').set({
100
- arguments: [
101
- (0, schematics_ts_morph_1.OperationIdToClassName)(optionsOperationId),
102
- ts_morph_1.Writers.object({ withoutParameters: 'true' }),
103
- ],
104
- });
105
- (0, schematics_ts_morph_1.CoerceImports)(sourceFile, {
106
- namedImports: [(0, schematics_ts_morph_1.OperationIdToClassName)(optionsOperationId)],
107
- moduleSpecifier: (0, schematics_ts_morph_1.OperationIdToClassImportPath)(optionsOperationId, scope),
108
- });
109
- (0, schematics_ts_morph_1.CoerceImports)(sourceFile, {
110
- namedImports: ['UseOptionsMethod'],
111
- moduleSpecifier: '@rxap/form-system',
112
- });
113
- }
114
- return {
115
- propertyDeclaration,
116
- decoratorDeclaration,
117
- };
118
- },
119
- }),
155
+ optionsRule(normalizedOptions),
120
156
  (0, schematics_ts_morph_1.EnforceUseFormControlOrderRule)(normalizedOptions),
121
157
  () => console.groupEnd(),
122
158
  ]);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/schematic/angular/src/schematics/form/control/select-form-control/index.ts"],"names":[],"mappings":";;;AAAA,2DAAmD;AACnD,mEAcmC;AACnC,q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YAAY,EAAE,CAAE,kBAAkB,CAAE;4BACpC,eAAe,EAAE,mBAAmB;yBACrC,CAAC,CAAC;qBACJ;oBAED,OAAO;wBACL,mBAAmB;wBACnB,oBAAoB;qBACrB,CAAC;gBACJ,CAAC;aACF,CAAC;YACF,IAAA,oDAA8B,EAAC,iBAAiB,CAAC;YACjD,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE;SACzB,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAxID,4BAwIC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/schematic/angular/src/schematics/form/control/select-form-control/index.ts"],"names":[],"mappings":";;;AAAA,2DAIoC;AACpC,mEAcmC;AACnC,qEAIoC;AAEpC,+BAA4B;AAC5B,uCAIkB;AAClB,qEAAsE;AACtE,iEAA6D;AAC7D,+DAGsC;AACtC,qDAG4B;AAM5B,SAAgB,iCAAiC,CAC/C,OAAiC;IAEjC,OAAO,MAAM,CAAC,MAAM,iCACf,IAAA,0CAA2B,EAAC,OAAO,CAAC,GACpC,IAAA,yCAA0B,EAAC,OAAO,CAAC,EACtC,CAAC;AACL,CAAC;AAPD,8EAOC;AAED,SAAS,YAAY,CAAC,OAA2C;IAC/D,IAAA,qCAAmB,EAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;AACtD,CAAC;AAED,SAAS,sBAAsB,CAAC,iBAAqD;IACnF,MAAM,EACJ,IAAI,EACJ,OAAO,EACP,OAAO,EACP,SAAS,EACT,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,KAAK,EACL,UAAU,EACV,aAAa,GACd,GAAG,iBAAiB,CAAC;IACtB,MAAM,0BAA0B,GAAG,IAAA,WAAI,EAAC,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,EAAE,cAAc,CAAC,CAAC;IACzE,MAAM,qBAAqB,GAAG,IAAA,+BAAQ,EACpC,CAAE,IAAI,EAAE,SAAS,EAAE,aAAa,CAAE,CAAC,IAA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AAC;AAED,mBAAyB,OAAiC;IACxD,MAAM,iBAAiB,GAAG,iCAAiC,CAAC,OAAO,CAAC,CAAC;IACrE,YAAY,CAAC,iBAAiB,CAAC,CAAC;IAChC,OAAO,GAAG,EAAE;QACV,OAAO,IAAA,kBAAK,EAAC;YACX,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,+DAA+D,CAAC;YACpF,WAAW,CAAC,iBAAiB,CAAC;YAC9B,IAAA,oDAA8B,EAAC,iBAAiB,CAAC;YACjD,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE;SACzB,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAXD,4BAWC"}
@@ -1,6 +1,5 @@
1
+ import { SelectFormControl } from '../../../../lib/form-control';
1
2
  import { FormControlOptions } from '../../form-control/schema';
2
3
 
3
- export interface SelectFormControlOptions extends FormControlOptions {
4
- multiple?: boolean;
5
- staticDataSource?: boolean;
4
+ export interface SelectFormControlOptions extends FormControlOptions, SelectFormControl {
6
5
  }
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "select-form-control-schematic",
4
+ "allOf": [
5
+ {
6
+ "$ref": "../../form-control/template.schema.json"
7
+ },
8
+ {
9
+ "$ref": "../../../select-form-control.schema.json"
10
+ }
11
+ ],
12
+ "definitions": {
13
+ "type": {
14
+ "$ref": "../../../type.schema.json"
15
+ },
16
+ "property": {
17
+ "$ref": "../../../property.schema.json"
18
+ },
19
+ "button": {
20
+ "$ref": "../../../button.schema.json"
21
+ }
22
+ }
23
+ }
@@ -1,12 +1,10 @@
1
1
  import { Normalized } from '@rxap/utilities';
2
2
  import { WriterFunction } from 'ts-morph';
3
- import { NormalizedTableColumn } from '../../../../lib/table-column';
3
+ import { NormalizedTableSelectColumn, NormalizedTableSelectFormControl } from '../../../../lib/form-control';
4
4
  import { NormalizedFormControlOptions } from '../../form-control';
5
5
  import { TableSelectFormControlOptions } from './schema';
6
- export interface NormalizedTableSelectFormControlOptions extends Omit<Readonly<Normalized<TableSelectFormControlOptions> & NormalizedFormControlOptions>, 'columnList'> {
7
- columnList: ReadonlyArray<NormalizedTableColumn>;
8
- }
6
+ export type NormalizedTableSelectFormControlOptions = Readonly<Normalized<Omit<TableSelectFormControlOptions, 'columnList' | 'propertyList'>> & NormalizedFormControlOptions & NormalizedTableSelectFormControl>;
9
7
  export declare function NormalizeTableSelectFormControlOptions(options: TableSelectFormControlOptions): NormalizedTableSelectFormControlOptions;
10
- export declare function TableColumnToTableSelectColumn(options: NormalizedTableColumn): WriterFunction;
11
- export declare function TableColumnListToTableSelectColumnMap(columnList: ReadonlyArray<NormalizedTableColumn>): WriterFunction;
8
+ export declare function TableColumnToTableSelectColumn(column: NormalizedTableSelectColumn): WriterFunction;
9
+ export declare function TableColumnListToTableSelectColumnMap(columnList: Array<NormalizedTableSelectColumn>): WriterFunction;
12
10
  export default function (options: TableSelectFormControlOptions): () => import("@angular-devkit/schematics").Rule;
@@ -8,29 +8,21 @@ const utilities_1 = require("@rxap/utilities");
8
8
  const path_1 = require("path");
9
9
  const ts_morph_1 = require("ts-morph");
10
10
  const angular_options_1 = require("../../../../lib/angular-options");
11
- const table_column_1 = require("../../../../lib/table-column");
11
+ const form_control_1 = require("../../../../lib/form-control");
12
12
  const table_component_1 = require("../../../table/table-component");
13
- const form_control_1 = require("../../form-control");
13
+ const form_control_2 = require("../../form-control");
14
14
  function NormalizeTableSelectFormControlOptions(options) {
15
- var _a;
16
- const normalizedOptions = (0, form_control_1.NormalizeFormControlOptions)(options);
17
- let { isArray } = normalizedOptions;
18
- const multiple = (_a = options.multiple) !== null && _a !== void 0 ? _a : false;
19
- isArray = multiple ? true : isArray;
20
- const columnList = (0, table_column_1.NormalizeTableColumnList)(options.columnList);
21
- return Object.freeze(Object.assign(Object.assign({}, normalizedOptions), { isArray,
22
- multiple,
23
- columnList }));
15
+ return Object.freeze(Object.assign(Object.assign({}, (0, form_control_2.NormalizeFormControlOptions)(options)), (0, form_control_1.NormalizeTableSelectFormControl)(options)));
24
16
  }
25
17
  exports.NormalizeTableSelectFormControlOptions = NormalizeTableSelectFormControlOptions;
26
- function TableColumnToTableSelectColumn(options) {
27
- const { type, name, title, hasFilter, } = options;
18
+ function TableColumnToTableSelectColumn(column) {
19
+ const { kind, name, title, hasFilter, } = column;
28
20
  const properties = {};
29
21
  properties['label'] = `$localize\`${title !== null && title !== void 0 ? title : (0, schematics_utilities_1.capitalize)(name)}\``;
30
22
  if (hasFilter) {
31
23
  properties['filter'] = 'true';
32
24
  }
33
- properties['type'] = (w) => w.quote(type.name);
25
+ properties['type'] = (w) => w.quote(kind);
34
26
  return ts_morph_1.Writers.object(properties);
35
27
  }
36
28
  exports.TableColumnToTableSelectColumn = TableColumnToTableSelectColumn;
@@ -43,53 +35,65 @@ function printOptions(options) {
43
35
  }
44
36
  function default_1(options) {
45
37
  const normalizedOptions = NormalizeTableSelectFormControlOptions(options);
46
- const { name, project, feature, directory, formName, type, isArray, state, isRequired, validatorList, nestModule, controllerName, columnList, shared, context, scope, } = normalizedOptions;
38
+ const { name, project, feature, directory, formName, type, isArray, state, isRequired, validatorList, nestModule, controllerName, columnList, shared, context, scope, toDisplay, toValue, propertyList, upstream, } = normalizedOptions;
47
39
  printOptions(normalizedOptions);
48
- const optionsOperationName = ['get', name, 'option', 'page'].join('-');
49
- const optionsOperationPath = ['options', name, 'page'].join('/');
40
+ const optionsOperationName = ['get', name, 'control', 'table-select', 'page'].join('-');
41
+ const optionsOperationPath = ['control', name, 'table-select', 'page'].join('/');
50
42
  const optionsOperationId = (0, schematics_ts_morph_1.buildOperationId)(normalizedOptions, optionsOperationName, (0, schematics_ts_morph_1.BuildNestControllerName)({
51
43
  controllerName,
52
44
  nestModule,
53
45
  }));
54
- const resolveValueOperationName = ['resolve', name, 'option', 'value'].join('-');
55
- const resolveValueOperationPath = ['options', name, 'resolve', ':value'].join('/');
56
- const resolveValueOperationId = (0, schematics_ts_morph_1.buildOperationId)(normalizedOptions, resolveValueOperationName, (0, schematics_ts_morph_1.BuildNestControllerName)({
57
- controllerName,
58
- nestModule,
59
- }));
46
+ // const resolveValueOperationName = [ 'resolve', name, 'option', 'value' ].join(
47
+ // '-',
48
+ // );
49
+ // const resolveValueOperationPath = [ 'options', name, 'resolve', ':value' ].join(
50
+ // '/',
51
+ // );
52
+ // const resolveValueOperationId = buildOperationId(
53
+ // normalizedOptions,
54
+ // resolveValueOperationName,
55
+ // BuildNestControllerName({
56
+ // controllerName,
57
+ // nestModule,
58
+ // }),
59
+ // );
60
60
  const tableDataSourceName = (0, schematics_utilities_1.classify)([name, 'select-table', 'data-source'].join('-'));
61
61
  const tableDataSourceImportPath = `./data-sources/${(0, schematics_utilities_1.dasherize)(name)}-select-table.data-source`;
62
62
  const tableDataSourceDirectory = (0, path_1.join)(directory !== null && directory !== void 0 ? directory : '', 'data-sources');
63
- const resolveValueMethodName = (0, schematics_utilities_1.classify)([(0, schematics_utilities_1.dasherize)(name), 'table-select', 'value', 'resolver', 'method'].join('-'));
64
- const resolveValueMethodImportPath = `./methods/${(0, schematics_utilities_1.dasherize)(name)}-table-select-value-resolver.method`;
65
- const resolveValueMethodDirectory = (0, path_1.join)(directory !== null && directory !== void 0 ? directory : '', 'methods');
63
+ // const resolveValueMethodName = classify(
64
+ // [ dasherize(name), 'table-select', 'value', 'resolver', 'method' ].join('-'),
65
+ // );
66
+ // const resolveValueMethodImportPath = `./methods/${ dasherize(
67
+ // name,
68
+ // ) }-table-select-value-resolver.method`;
69
+ // const resolveValueMethodDirectory = join(directory ?? '', 'methods');
66
70
  const tableResponseDtoName = (0, utilities_1.joinWithDash)([context, name, 'table-select']);
67
71
  return () => {
68
72
  return (0, schematics_1.chain)([
69
73
  () => console.group('\x1b[32m[@rxap/schematics-angular:table-select-form-control]\x1b[0m'),
70
- (0, schematics_utilities_1.ExecuteSchematic)('form-control', normalizedOptions),
71
74
  (0, schematics_ts_morph_1.CoerceTableSelectOperationRule)({
72
75
  project,
73
76
  feature,
74
77
  nestModule,
75
78
  controllerName,
76
- propertyList: (0, table_component_1.TableColumnListAndPropertyListToGetPageOperationPropertyList)(columnList, []),
79
+ propertyList: (0, table_component_1.TableColumnListAndPropertyListToGetPageOperationPropertyList)(columnList, propertyList),
77
80
  operationName: optionsOperationName,
78
81
  path: optionsOperationPath,
79
82
  skipCoerceTableSuffix: true,
80
83
  responseDtoName: tableResponseDtoName,
81
84
  context,
85
+ upstream
82
86
  }),
83
- (0, schematics_ts_morph_1.CoerceTableSelectValueResolveOperationRule)({
84
- project,
85
- feature,
86
- nestModule,
87
- controllerName,
88
- operationName: resolveValueOperationName,
89
- path: resolveValueOperationPath,
90
- responseDtoName: tableResponseDtoName,
91
- context,
92
- }),
87
+ // CoerceTableSelectValueResolveOperationRule({
88
+ // project,
89
+ // feature,
90
+ // nestModule,
91
+ // controllerName,
92
+ // operationName: resolveValueOperationName,
93
+ // path: resolveValueOperationPath,
94
+ // responseDtoName: tableResponseDtoName,
95
+ // context,
96
+ // }),
93
97
  (0, schematics_ts_morph_1.CoerceFormProviderRule)({
94
98
  project,
95
99
  feature,
@@ -102,18 +106,18 @@ function default_1(options) {
102
106
  },
103
107
  ],
104
108
  }),
105
- (0, schematics_ts_morph_1.CoerceFormProviderRule)({
106
- project,
107
- feature,
108
- directory,
109
- providerObject: resolveValueMethodName,
110
- importStructures: [
111
- {
112
- namedImports: [resolveValueMethodName],
113
- moduleSpecifier: resolveValueMethodImportPath,
114
- },
115
- ],
116
- }),
109
+ // CoerceFormProviderRule({
110
+ // project,
111
+ // feature,
112
+ // directory,
113
+ // providerObject: resolveValueMethodName,
114
+ // importStructures: [
115
+ // {
116
+ // namedImports: [ resolveValueMethodName ],
117
+ // moduleSpecifier: resolveValueMethodImportPath,
118
+ // },
119
+ // ],
120
+ // }),
117
121
  (0, schematics_ts_morph_1.CoerceTableDataSourceRule)({
118
122
  scope,
119
123
  project,
@@ -123,15 +127,15 @@ function default_1(options) {
123
127
  name: [name, 'select-table'].join('-'),
124
128
  operationId: optionsOperationId,
125
129
  }),
126
- (0, schematics_ts_morph_1.CoerceTableSelectResolveValueMethodRule)({
127
- scope,
128
- project,
129
- feature,
130
- directory: resolveValueMethodDirectory,
131
- shared,
132
- name: [name, 'table-select', 'value', 'resolver'].join('-'),
133
- operationId: resolveValueOperationId,
134
- }),
130
+ // CoerceTableSelectResolveValueMethodRule({
131
+ // scope,
132
+ // project,
133
+ // feature,
134
+ // directory: resolveValueMethodDirectory,
135
+ // shared,
136
+ // name: [ name, 'table-select', 'value', 'resolver' ].join('-'),
137
+ // operationId: resolveValueOperationId,
138
+ // }),
135
139
  (0, schematics_ts_morph_1.CoerceFormDefinitionControl)({
136
140
  project,
137
141
  feature,
@@ -148,17 +152,23 @@ function default_1(options) {
148
152
  (0, schematics_ts_morph_1.CoerceDecorator)(propertyDeclaration, 'UseTableSelectDataSource').set({
149
153
  arguments: [tableDataSourceName],
150
154
  });
151
- (0, schematics_ts_morph_1.CoerceImports)(sourceFile, {
152
- namedImports: [tableDataSourceName],
153
- moduleSpecifier: tableDataSourceImportPath,
155
+ (0, schematics_ts_morph_1.CoerceDecorator)(propertyDeclaration, 'UseTableSelectToDisplay').set({
156
+ arguments: [`item => item.${toDisplay.property.name}`],
154
157
  });
155
- (0, schematics_ts_morph_1.CoerceDecorator)(propertyDeclaration, 'UseTableSelectMethod').set({
156
- arguments: [resolveValueMethodName],
158
+ (0, schematics_ts_morph_1.CoerceDecorator)(propertyDeclaration, 'UseTableSelectToValue').set({
159
+ arguments: [`item => item.${toValue.property.name}`],
157
160
  });
158
161
  (0, schematics_ts_morph_1.CoerceImports)(sourceFile, {
159
- namedImports: [resolveValueMethodName],
160
- moduleSpecifier: resolveValueMethodImportPath,
162
+ namedImports: [tableDataSourceName],
163
+ moduleSpecifier: tableDataSourceImportPath,
161
164
  });
165
+ // CoerceDecorator(propertyDeclaration, 'UseTableSelectMethod').set({
166
+ // arguments: [ resolveValueMethodName ],
167
+ // });
168
+ // CoerceImports(sourceFile, {
169
+ // namedImports: [ resolveValueMethodName ],
170
+ // moduleSpecifier: resolveValueMethodImportPath,
171
+ // });
162
172
  (0, schematics_ts_morph_1.CoerceDecorator)(propertyDeclaration, 'UseTableSelectColumns').set({
163
173
  arguments: [TableColumnListToTableSelectColumnMap(columnList)],
164
174
  });
@@ -166,9 +176,11 @@ function default_1(options) {
166
176
  namedImports: [
167
177
  'UseTableSelectDataSource',
168
178
  'UseTableSelectColumns',
169
- 'UseTableSelectMethod',
179
+ // 'UseTableSelectMethod',
180
+ 'UseTableSelectToDisplay',
181
+ 'UseTableSelectToValue'
170
182
  ],
171
- moduleSpecifier: '@rxap/ngx-material-table-select',
183
+ moduleSpecifier: '@digitaix/eurogard-table-select',
172
184
  });
173
185
  return {
174
186
  propertyDeclaration,