@rxap/schematic-angular 16.0.1-dev.0
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.
- package/CHANGELOG.md +8 -0
- package/GETSTARTED.md +0 -0
- package/GUIDES.md +0 -0
- package/README.md +21 -0
- package/collection.json +109 -0
- package/package.json +70 -0
- package/src/index.d.ts +0 -0
- package/src/index.js +2 -0
- package/src/index.js.map +1 -0
- package/src/lib/accordion-item.d.ts +10 -0
- package/src/lib/accordion-item.js +36 -0
- package/src/lib/accordion-item.js.map +1 -0
- package/src/lib/accordion-itme-types.d.ts +7 -0
- package/src/lib/accordion-itme-types.js +15 -0
- package/src/lib/accordion-itme-types.js.map +1 -0
- package/src/lib/angular-options.d.ts +20 -0
- package/src/lib/angular-options.js +57 -0
- package/src/lib/angular-options.js.map +1 -0
- package/src/lib/assert-table-component-exists.d.ts +8 -0
- package/src/lib/assert-table-component-exists.js +18 -0
- package/src/lib/assert-table-component-exists.js.map +1 -0
- package/src/lib/backend-types.d.ts +5 -0
- package/src/lib/backend-types.js +10 -0
- package/src/lib/backend-types.js.map +1 -0
- package/src/lib/data-grid-item.d.ts +9 -0
- package/src/lib/data-grid-item.js +31 -0
- package/src/lib/data-grid-item.js.map +1 -0
- package/src/lib/data-grid-options.d.ts +18 -0
- package/src/lib/data-grid-options.js +25 -0
- package/src/lib/data-grid-options.js.map +1 -0
- package/src/lib/dialog-action.d.ts +9 -0
- package/src/lib/dialog-action.js +33 -0
- package/src/lib/dialog-action.js.map +1 -0
- package/src/lib/existing-method.d.ts +5 -0
- package/src/lib/existing-method.js +11 -0
- package/src/lib/existing-method.js.map +1 -0
- package/src/lib/form-component-control.d.ts +13 -0
- package/src/lib/form-component-control.js +46 -0
- package/src/lib/form-component-control.js.map +1 -0
- package/src/lib/form-definition-control.d.ts +15 -0
- package/src/lib/form-definition-control.js +59 -0
- package/src/lib/form-definition-control.js.map +1 -0
- package/src/lib/minimum-table-component-options.d.ts +17 -0
- package/src/lib/minimum-table-component-options.js +343 -0
- package/src/lib/minimum-table-component-options.js.map +1 -0
- package/src/lib/minimum-table-options.d.ts +18 -0
- package/src/lib/minimum-table-options.js +27 -0
- package/src/lib/minimum-table-options.js.map +1 -0
- package/src/lib/table-action.d.ts +11 -0
- package/src/lib/table-action.js +93 -0
- package/src/lib/table-action.js.map +1 -0
- package/src/lib/table-column.d.ts +18 -0
- package/src/lib/table-column.js +73 -0
- package/src/lib/table-column.js.map +1 -0
- package/src/lib/table-header-button.d.ts +9 -0
- package/src/lib/table-header-button.js +58 -0
- package/src/lib/table-header-button.js.map +1 -0
- package/src/lib/table-options.d.ts +15 -0
- package/src/lib/table-options.js +16 -0
- package/src/lib/table-options.js.map +1 -0
- package/src/lib/table-row-action.d.ts +14 -0
- package/src/lib/table-row-action.js +21 -0
- package/src/lib/table-row-action.js.map +1 -0
- package/src/lib/to-title.d.ts +1 -0
- package/src/lib/to-title.js +12 -0
- package/src/lib/to-title.js.map +1 -0
- package/src/lib/tree-table-options.d.ts +15 -0
- package/src/lib/tree-table-options.js +15 -0
- package/src/lib/tree-table-options.js.map +1 -0
- package/src/schematics/accordion/accordion-component/files/component/__componentName__.component.html.template +30 -0
- package/src/schematics/accordion/accordion-component/files/component/__componentName__.component.ts.template +54 -0
- package/src/schematics/accordion/accordion-component/files/header-component/accordion-header.component.html.template +5 -0
- package/src/schematics/accordion/accordion-component/files/header-component/accordion-header.component.ts.template +14 -0
- package/src/schematics/accordion/accordion-component/index.d.ts +8 -0
- package/src/schematics/accordion/accordion-component/index.js +350 -0
- package/src/schematics/accordion/accordion-component/index.js.map +1 -0
- package/src/schematics/accordion/accordion-component/schema.d.ts +7 -0
- package/src/schematics/accordion/accordion-component/schema.json +90 -0
- package/src/schematics/accordion/accordion-item-component/files/component/__componentName__.component.html.template +7 -0
- package/src/schematics/accordion/accordion-item-component/files/component/__componentName__.component.ts.template +32 -0
- package/src/schematics/accordion/accordion-item-component/index.d.ts +21 -0
- package/src/schematics/accordion/accordion-item-component/index.js +319 -0
- package/src/schematics/accordion/accordion-item-component/index.js.map +1 -0
- package/src/schematics/accordion/accordion-item-component/schema.d.ts +9 -0
- package/src/schematics/accordion/accordion-item-component/schema.json +73 -0
- package/src/schematics/accordion/item/accordion-item-data-grid-component/files/data-grid/__componentName__.component.html.template +1 -0
- package/src/schematics/accordion/item/accordion-item-data-grid-component/files/data-grid/__componentName__.component.ts.template +14 -0
- package/src/schematics/accordion/item/accordion-item-data-grid-component/files/data-grid-collection/__componentName__.component.html.template +10 -0
- package/src/schematics/accordion/item/accordion-item-data-grid-component/files/data-grid-collection/__componentName__.component.ts.template +32 -0
- package/src/schematics/accordion/item/accordion-item-data-grid-component/index.d.ts +10 -0
- package/src/schematics/accordion/item/accordion-item-data-grid-component/index.js +211 -0
- package/src/schematics/accordion/item/accordion-item-data-grid-component/index.js.map +1 -0
- package/src/schematics/accordion/item/accordion-item-data-grid-component/schema.d.ts +7 -0
- package/src/schematics/accordion/item/accordion-item-data-grid-component/schema.json +122 -0
- package/src/schematics/accordion/item/accordion-item-table-component/files/component/__componentName__.component.html.template +1 -0
- package/src/schematics/accordion/item/accordion-item-table-component/files/component/__componentName__.component.ts.template +35 -0
- package/src/schematics/accordion/item/accordion-item-table-component/index.d.ts +7 -0
- package/src/schematics/accordion/item/accordion-item-table-component/index.js +108 -0
- package/src/schematics/accordion/item/accordion-item-table-component/index.js.map +1 -0
- package/src/schematics/accordion/item/accordion-item-table-component/schema.d.ts +7 -0
- package/src/schematics/accordion/item/accordion-item-table-component/schema.json +248 -0
- package/src/schematics/accordion/item/accordion-item-tree-table-component/files/component/__componentName__.component.html.template +1 -0
- package/src/schematics/accordion/item/accordion-item-tree-table-component/files/component/__componentName__.component.ts.template +34 -0
- package/src/schematics/accordion/item/accordion-item-tree-table-component/index.d.ts +7 -0
- package/src/schematics/accordion/item/accordion-item-tree-table-component/index.js +182 -0
- package/src/schematics/accordion/item/accordion-item-tree-table-component/index.js.map +1 -0
- package/src/schematics/accordion/item/accordion-item-tree-table-component/schema.d.ts +7 -0
- package/src/schematics/accordion/item/accordion-item-tree-table-component/schema.json +257 -0
- package/src/schematics/data-grid-component/files/form/__componentName__.component.html.template +42 -0
- package/src/schematics/data-grid-component/files/form/__componentName__.component.ts.template +43 -0
- package/src/schematics/data-grid-component/files/plain/__componentName__.component.html.template +25 -0
- package/src/schematics/data-grid-component/files/plain/__componentName__.component.ts.template +36 -0
- package/src/schematics/data-grid-component/index.d.ts +16 -0
- package/src/schematics/data-grid-component/index.js +320 -0
- package/src/schematics/data-grid-component/index.js.map +1 -0
- package/src/schematics/data-grid-component/schema.d.ts +4 -0
- package/src/schematics/data-grid-component/schema.json +112 -0
- package/src/schematics/dialog-component/files/component/__componentName__.component.html.template +23 -0
- package/src/schematics/dialog-component/index.d.ts +2 -0
- package/src/schematics/dialog-component/index.js +43 -0
- package/src/schematics/dialog-component/index.js.map +1 -0
- package/src/schematics/dialog-component/schema.d.ts +9 -0
- package/src/schematics/dialog-component/schema.json +71 -0
- package/src/schematics/form/control/input-form-control/index.d.ts +7 -0
- package/src/schematics/form/control/input-form-control/index.js +40 -0
- package/src/schematics/form/control/input-form-control/index.js.map +1 -0
- package/src/schematics/form/control/input-form-control/schema.d.ts +5 -0
- package/src/schematics/form/control/input-form-control/schema.json +115 -0
- package/src/schematics/form/control/select-form-control/index.d.ts +6 -0
- package/src/schematics/form/control/select-form-control/index.js +124 -0
- package/src/schematics/form/control/select-form-control/index.js.map +1 -0
- package/src/schematics/form/control/select-form-control/schema.d.ts +6 -0
- package/src/schematics/form/control/select-form-control/schema.json +101 -0
- package/src/schematics/form/control/table-select-form-control/index.d.ts +12 -0
- package/src/schematics/form/control/table-select-form-control/index.js +183 -0
- package/src/schematics/form/control/table-select-form-control/index.js.map +1 -0
- package/src/schematics/form/control/table-select-form-control/schema.d.ts +7 -0
- package/src/schematics/form/control/table-select-form-control/schema.json +105 -0
- package/src/schematics/form/form-component/files/component/__componentName__.component.html.template +12 -0
- package/src/schematics/form/form-component/files/component/__componentName__.component.ts.template +52 -0
- package/src/schematics/form/form-component/files/window/open-__name__-form-window.method.ts.template +29 -0
- package/src/schematics/form/form-component/index.d.ts +16 -0
- package/src/schematics/form/form-component/index.js +149 -0
- package/src/schematics/form/form-component/index.js.map +1 -0
- package/src/schematics/form/form-component/schema.d.ts +8 -0
- package/src/schematics/form/form-component/schema.json +107 -0
- package/src/schematics/form/form-control/index.d.ts +9 -0
- package/src/schematics/form/form-control/index.js +54 -0
- package/src/schematics/form/form-control/index.js.map +1 -0
- package/src/schematics/form/form-control/schema.d.ts +6 -0
- package/src/schematics/form/form-control/schema.json +91 -0
- package/src/schematics/form/form-definition/index.d.ts +10 -0
- package/src/schematics/form/form-definition/index.js +43 -0
- package/src/schematics/form/form-definition/index.js.map +1 -0
- package/src/schematics/form/form-definition/schema.d.ts +6 -0
- package/src/schematics/form/form-definition/schema.json +97 -0
- package/src/schematics/table/action/dialog-table-action/index.d.ts +8 -0
- package/src/schematics/table/action/dialog-table-action/index.js +99 -0
- package/src/schematics/table/action/dialog-table-action/index.js.map +1 -0
- package/src/schematics/table/action/dialog-table-action/schema.d.ts +8 -0
- package/src/schematics/table/action/dialog-table-action/schema.json +133 -0
- package/src/schematics/table/action/form-table-action/index.d.ts +9 -0
- package/src/schematics/table/action/form-table-action/index.js +146 -0
- package/src/schematics/table/action/form-table-action/index.js.map +1 -0
- package/src/schematics/table/action/form-table-action/schema.d.ts +4 -0
- package/src/schematics/table/action/form-table-action/schema.json +94 -0
- package/src/schematics/table/action/navigation-table-action/index.d.ts +7 -0
- package/src/schematics/table/action/navigation-table-action/index.js +46 -0
- package/src/schematics/table/action/navigation-table-action/index.js.map +1 -0
- package/src/schematics/table/action/navigation-table-action/schema.d.ts +5 -0
- package/src/schematics/table/action/navigation-table-action/schema.json +85 -0
- package/src/schematics/table/action/operation-table-action/index.d.ts +11 -0
- package/src/schematics/table/action/operation-table-action/index.js +87 -0
- package/src/schematics/table/action/operation-table-action/index.js.map +1 -0
- package/src/schematics/table/action/operation-table-action/schema.d.ts +4 -0
- package/src/schematics/table/action/operation-table-action/schema.json +93 -0
- package/src/schematics/table/table-action/index.d.ts +7 -0
- package/src/schematics/table/table-action/index.js +46 -0
- package/src/schematics/table/table-action/index.js.map +1 -0
- package/src/schematics/table/table-action/schema.d.ts +7 -0
- package/src/schematics/table/table-action/schema.json +81 -0
- package/src/schematics/table/table-component/files/component/__componentName__.component.html.template +311 -0
- package/src/schematics/table/table-component/files/component/__componentName__.component.ts.template +100 -0
- package/src/schematics/table/table-component/index.d.ts +17 -0
- package/src/schematics/table/table-component/index.js +329 -0
- package/src/schematics/table/table-component/index.js.map +1 -0
- package/src/schematics/table/table-component/schema.d.ts +4 -0
- package/src/schematics/table/table-component/schema.json +230 -0
- package/src/schematics/table/tree-table-component/files/component/__componentName__.component.html.template +201 -0
- package/src/schematics/table/tree-table-component/files/component/__componentName__.component.ts.template +102 -0
- package/src/schematics/table/tree-table-component/index.d.ts +9 -0
- package/src/schematics/table/tree-table-component/index.js +314 -0
- package/src/schematics/table/tree-table-component/index.js.map +1 -0
- package/src/schematics/table/tree-table-component/schema.d.ts +4 -0
- package/src/schematics/table/tree-table-component/schema.json +239 -0
- package/src/schematics/tree-component/index.d.ts +10 -0
- package/src/schematics/tree-component/index.js +33 -0
- package/src/schematics/tree-component/index.js.map +1 -0
- package/src/schematics/tree-component/schema.d.ts +6 -0
- package/src/schematics/tree-component/schema.json +75 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "table-select-form-control",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"name": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"description": "The name of form control",
|
|
9
|
+
"x-prompt": "Enter the name of the form control?"
|
|
10
|
+
},
|
|
11
|
+
"formName": {
|
|
12
|
+
"alias": "form",
|
|
13
|
+
"type": "string",
|
|
14
|
+
"description": "The name of the form where the form control should be added",
|
|
15
|
+
"x-prompt": "Enter the name of the form where the form control should be added"
|
|
16
|
+
},
|
|
17
|
+
"project": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"description": "The project where the form control should be added",
|
|
20
|
+
"x-prompt": "Enter project name where the form control should be added"
|
|
21
|
+
},
|
|
22
|
+
"backend": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"description": "The backend that should be used to handel data",
|
|
25
|
+
"enum": [
|
|
26
|
+
"none",
|
|
27
|
+
"local",
|
|
28
|
+
"nestjs"
|
|
29
|
+
],
|
|
30
|
+
"default": "none"
|
|
31
|
+
},
|
|
32
|
+
"feature": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"description": "The feature where the form control should be added",
|
|
35
|
+
"x-prompt": "Enter feature name where the form control should be added"
|
|
36
|
+
},
|
|
37
|
+
"shared": {
|
|
38
|
+
"type": "boolean",
|
|
39
|
+
"description": "Whether the form is shared across applications",
|
|
40
|
+
"default": false
|
|
41
|
+
},
|
|
42
|
+
"directory": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"description": "A path suffix added to the base path"
|
|
45
|
+
},
|
|
46
|
+
"nestModule": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"description": "Name of the nest module where the controller is created"
|
|
49
|
+
},
|
|
50
|
+
"controllerName": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"description": "Name of the nest controller"
|
|
53
|
+
},
|
|
54
|
+
"type": {
|
|
55
|
+
"type": "string",
|
|
56
|
+
"description": "The data type of the form control"
|
|
57
|
+
},
|
|
58
|
+
"validatorList": {
|
|
59
|
+
"alias": "validator",
|
|
60
|
+
"type": "array",
|
|
61
|
+
"items": {
|
|
62
|
+
"type": "string"
|
|
63
|
+
},
|
|
64
|
+
"description": "List of validators to be added to the form control"
|
|
65
|
+
},
|
|
66
|
+
"isRequired": {
|
|
67
|
+
"alias": "required",
|
|
68
|
+
"type": "boolean",
|
|
69
|
+
"description": "Whether the form control value is required"
|
|
70
|
+
},
|
|
71
|
+
"state": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"description": "The initial state of the form control"
|
|
74
|
+
},
|
|
75
|
+
"isArray": {
|
|
76
|
+
"alias": "array",
|
|
77
|
+
"type": "boolean",
|
|
78
|
+
"description": "Whether the form control is an array"
|
|
79
|
+
},
|
|
80
|
+
"multiple": {
|
|
81
|
+
"alias": "multi",
|
|
82
|
+
"type": "boolean",
|
|
83
|
+
"description": "Whether the select form control is multiple mode"
|
|
84
|
+
},
|
|
85
|
+
"columnList": {
|
|
86
|
+
"alias": "column",
|
|
87
|
+
"type": "array",
|
|
88
|
+
"items": {
|
|
89
|
+
"type": "string",
|
|
90
|
+
"description": "table column name"
|
|
91
|
+
},
|
|
92
|
+
"description": "List of table column names"
|
|
93
|
+
},
|
|
94
|
+
"context": {
|
|
95
|
+
"type": "string",
|
|
96
|
+
"description": "The context use to generate proper names for class, files, etc"
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"required": [
|
|
100
|
+
"name",
|
|
101
|
+
"formName",
|
|
102
|
+
"project",
|
|
103
|
+
"feature"
|
|
104
|
+
]
|
|
105
|
+
}
|
package/src/schematics/form/form-component/files/component/__componentName__.component.html.template
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<form rxapForm>
|
|
2
|
+
<% if (window) { %>
|
|
3
|
+
<ng-template rxapFormWindowFooter let-windowRef>
|
|
4
|
+
<rxap-form-controls
|
|
5
|
+
(close)="windowRef.complete()"
|
|
6
|
+
(submitted)="windowRef.next($event)"
|
|
7
|
+
></rxap-form-controls>
|
|
8
|
+
</ng-template>
|
|
9
|
+
<% } else { %>
|
|
10
|
+
<rxap-form-controls></rxap-form-controls>
|
|
11
|
+
<% } %>
|
|
12
|
+
</form>
|
package/src/schematics/form/form-component/files/component/__componentName__.component.ts.template
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
|
|
3
|
+
<% if (window) { %>
|
|
4
|
+
import { RXAP_WINDOW_SETTINGS } from '@rxap/window-system';
|
|
5
|
+
<% } %>
|
|
6
|
+
import { FormComponentProviders, FormProviders } from './form.providers';
|
|
7
|
+
import { FormControlsComponent, MaterialFormSystemModule } from '@rxap/material-form-system';
|
|
8
|
+
import { FlexLayoutModule } from '@angular/flex-layout';
|
|
9
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
10
|
+
import { RxapFormsModule } from '@rxap/forms';
|
|
11
|
+
import { CommonModule } from '@angular/common';
|
|
12
|
+
<% if (window) { %>
|
|
13
|
+
import { FormWindowFooterDirective } from '@rxap/form-window-system';
|
|
14
|
+
<% } %>
|
|
15
|
+
|
|
16
|
+
@Component({
|
|
17
|
+
selector: '<%= prefix%>-<%= name %>-form',
|
|
18
|
+
templateUrl: './<%= componentName %>.component.html',
|
|
19
|
+
styleUrls: [ './<%= componentName %>.component.scss' ],
|
|
20
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
21
|
+
standalone: true,
|
|
22
|
+
imports: [
|
|
23
|
+
CommonModule,
|
|
24
|
+
ReactiveFormsModule,
|
|
25
|
+
FlexLayoutModule,
|
|
26
|
+
MaterialFormSystemModule,
|
|
27
|
+
FormControlsComponent,
|
|
28
|
+
RxapFormsModule,
|
|
29
|
+
<% if (window) { %>
|
|
30
|
+
FormWindowFooterDirective,
|
|
31
|
+
<% } %>
|
|
32
|
+
],
|
|
33
|
+
providers: [
|
|
34
|
+
FormProviders,
|
|
35
|
+
FormComponentProviders,
|
|
36
|
+
{
|
|
37
|
+
provide: MAT_FORM_FIELD_DEFAULT_OPTIONS,
|
|
38
|
+
useValue: {
|
|
39
|
+
appearance: 'fill',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
<% if (window) { %>
|
|
43
|
+
{
|
|
44
|
+
provide: RXAP_WINDOW_SETTINGS,
|
|
45
|
+
useValue: {
|
|
46
|
+
title: $localize`<%= classify(name) %>`,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
<% } %>
|
|
50
|
+
],
|
|
51
|
+
})
|
|
52
|
+
export class <%= classify(componentName) %>Component {}
|
package/src/schematics/form/form-component/files/window/open-__name__-form-window.method.ts.template
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Inject, Injectable, Injector, INJECTOR, Optional } from '@angular/core';
|
|
2
|
+
import {
|
|
3
|
+
FormWindowOptions,
|
|
4
|
+
FormWindowService,
|
|
5
|
+
OpenFormWindowMethod,
|
|
6
|
+
RXAP_FORM_WINDOW_SYSTEM_OPEN_FORM_DEFAULT_OPTIONS,
|
|
7
|
+
} from '@rxap/form-window-system';
|
|
8
|
+
import { <%= classify(name) %>FormComponent } from './<%= name %>-form.component';
|
|
9
|
+
import { <%= classify(name) %>Form, I<%= classify(name) %>Form } from './<%= name %>.form';
|
|
10
|
+
|
|
11
|
+
@Injectable()
|
|
12
|
+
export class Open<%= classify(name) %>FormWindowMethod extends OpenFormWindowMethod<I<%= classify(name) %>Form> {
|
|
13
|
+
constructor(
|
|
14
|
+
@Inject(FormWindowService) formWindowService: FormWindowService,
|
|
15
|
+
@Inject(INJECTOR)
|
|
16
|
+
injector: Injector,
|
|
17
|
+
@Optional()
|
|
18
|
+
@Inject(RXAP_FORM_WINDOW_SYSTEM_OPEN_FORM_DEFAULT_OPTIONS)
|
|
19
|
+
defaultOptions: FormWindowOptions<I<%= classify(name) %>Form> | null = null,
|
|
20
|
+
) {
|
|
21
|
+
super(
|
|
22
|
+
formWindowService,
|
|
23
|
+
<%= classify(name) %>Form,
|
|
24
|
+
injector,
|
|
25
|
+
<%= classify(name) %>FormComponent,
|
|
26
|
+
defaultOptions,
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Rule } from '@angular-devkit/schematics';
|
|
2
|
+
import { DtoClassProperty } from '@rxap/schematics-ts-morph';
|
|
3
|
+
import { Normalized } from '@rxap/utilities';
|
|
4
|
+
import { NormalizedAngularOptions } from '../../../lib/angular-options';
|
|
5
|
+
import { NormalizedFormComponentControl } from '../../../lib/form-component-control';
|
|
6
|
+
import { FormComponentOptions } from './schema';
|
|
7
|
+
interface NormalizedFormComponentOptions extends Omit<Readonly<Normalized<FormComponentOptions> & NormalizedAngularOptions>, 'controlList'> {
|
|
8
|
+
componentName: string;
|
|
9
|
+
controllerName: string;
|
|
10
|
+
controlList: Array<NormalizedFormComponentControl>;
|
|
11
|
+
context: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function NormalizeFormComponentOptions(options: Readonly<FormComponentOptions>): Readonly<NormalizedFormComponentOptions>;
|
|
14
|
+
export declare function FormComponentControlToDtoClassProperty(control: NormalizedFormComponentControl): DtoClassProperty;
|
|
15
|
+
export default function (options: FormComponentOptions): () => Rule;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormComponentControlToDtoClassProperty = exports.NormalizeFormComponentOptions = void 0;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const schematics_ts_morph_1 = require("@rxap/schematics-ts-morph");
|
|
6
|
+
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
7
|
+
const utilities_1 = require("@rxap/utilities");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const angular_options_1 = require("../../../lib/angular-options");
|
|
10
|
+
const backend_types_1 = require("../../../lib/backend-types");
|
|
11
|
+
const form_component_control_1 = require("../../../lib/form-component-control");
|
|
12
|
+
function NormalizeFormComponentOptions(options) {
|
|
13
|
+
var _a, _b, _c, _d, _e;
|
|
14
|
+
const normalizedAngularOptions = (0, angular_options_1.NormalizeAngularOptions)(options);
|
|
15
|
+
(0, angular_options_1.AssertAngularOptionsNameProperty)(normalizedAngularOptions);
|
|
16
|
+
const { name, nestModule, } = normalizedAngularOptions;
|
|
17
|
+
const componentName = (0, schematics_utilities_1.CoerceSuffix)(name, '-form');
|
|
18
|
+
const controllerName = (_a = options.controllerName) !== null && _a !== void 0 ? _a : componentName;
|
|
19
|
+
const context = (_b = options.context) !== null && _b !== void 0 ? _b : (0, utilities_1.joinWithDash)([nestModule, controllerName], { removeDuplicated: true });
|
|
20
|
+
return Object.seal(Object.assign(Object.assign({}, normalizedAngularOptions), { window: (_c = options.window) !== null && _c !== void 0 ? _c : false, directory: (0, path_1.join)((_d = options.directory) !== null && _d !== void 0 ? _d : '', componentName), role: (_e = options.role) !== null && _e !== void 0 ? _e : null, componentName,
|
|
21
|
+
controllerName, controlList: (0, form_component_control_1.NormalizeFormComponentControlList)(options.controlList), context }));
|
|
22
|
+
}
|
|
23
|
+
exports.NormalizeFormComponentOptions = NormalizeFormComponentOptions;
|
|
24
|
+
function FormComponentControlToDtoClassProperty(control) {
|
|
25
|
+
return {
|
|
26
|
+
name: control.name,
|
|
27
|
+
type: control.type,
|
|
28
|
+
isOptional: !control.isRequired,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
exports.FormComponentControlToDtoClassProperty = FormComponentControlToDtoClassProperty;
|
|
32
|
+
function componentRule(normalizedOptions) {
|
|
33
|
+
const { componentName, project, feature, directory, overwrite, } = normalizedOptions;
|
|
34
|
+
return (0, schematics_1.chain)([
|
|
35
|
+
() => console.log(`Coerce form component '${componentName}'`),
|
|
36
|
+
(0, schematics_ts_morph_1.CoerceComponentRule)({
|
|
37
|
+
project,
|
|
38
|
+
feature,
|
|
39
|
+
name: componentName,
|
|
40
|
+
directory,
|
|
41
|
+
overwrite,
|
|
42
|
+
template: {
|
|
43
|
+
options: Object.assign(Object.assign({}, normalizedOptions), { OperationIdToClassName: schematics_ts_morph_1.OperationIdToClassName,
|
|
44
|
+
OperationIdToClassImportPath: schematics_ts_morph_1.OperationIdToClassImportPath }),
|
|
45
|
+
},
|
|
46
|
+
}),
|
|
47
|
+
]);
|
|
48
|
+
}
|
|
49
|
+
function formDefinitionRule(normalizedOptions) {
|
|
50
|
+
const { name, project, feature, directory, controlList, overwrite, } = normalizedOptions;
|
|
51
|
+
return (0, schematics_1.chain)([
|
|
52
|
+
() => console.log(`Coerce form definition files`),
|
|
53
|
+
(0, schematics_utilities_1.ExecuteSchematic)('form-definition', {
|
|
54
|
+
name,
|
|
55
|
+
project,
|
|
56
|
+
directory,
|
|
57
|
+
feature,
|
|
58
|
+
controlList,
|
|
59
|
+
overwrite,
|
|
60
|
+
}),
|
|
61
|
+
]);
|
|
62
|
+
}
|
|
63
|
+
function formSubmitProviderRule(normalizedOptions, submitOperationId) {
|
|
64
|
+
const { project, feature, directory, scope, } = normalizedOptions;
|
|
65
|
+
return (0, schematics_1.chain)([
|
|
66
|
+
() => console.log(`Coerce form submit method`),
|
|
67
|
+
(0, schematics_ts_morph_1.CoerceFormComponentProviderRule)({
|
|
68
|
+
project,
|
|
69
|
+
feature,
|
|
70
|
+
directory,
|
|
71
|
+
providerObject: {
|
|
72
|
+
provide: 'RXAP_FORM_SUBMIT_METHOD',
|
|
73
|
+
useFactory: 'SubmitContextFormAdapterFactory',
|
|
74
|
+
deps: [
|
|
75
|
+
(0, schematics_ts_morph_1.OperationIdToClassName)(submitOperationId),
|
|
76
|
+
'[ new Optional(), RXAP_FORM_CONTEXT ]',
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
importStructures: [
|
|
80
|
+
{
|
|
81
|
+
moduleSpecifier: '@rxap/form-system',
|
|
82
|
+
namedImports: ['SubmitContextFormAdapterFactory'],
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
moduleSpecifier: '@rxap/forms',
|
|
86
|
+
namedImports: ['RXAP_FORM_SUBMIT_METHOD', 'RXAP_FORM_CONTEXT'],
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
moduleSpecifier: '@angular/core',
|
|
90
|
+
namedImports: ['Optional'],
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
moduleSpecifier: (0, schematics_ts_morph_1.OperationIdToClassImportPath)(submitOperationId, scope),
|
|
94
|
+
namedImports: [(0, schematics_ts_morph_1.OperationIdToClassName)(submitOperationId)],
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
}),
|
|
98
|
+
]);
|
|
99
|
+
}
|
|
100
|
+
function formSubmitBackendRule(normalizedOptions) {
|
|
101
|
+
const { backend, project, feature, controlList, context, componentName, controllerName, nestModule, shared, } = normalizedOptions;
|
|
102
|
+
switch (backend) {
|
|
103
|
+
case backend_types_1.BackendTypes.NESTJS:
|
|
104
|
+
return (0, schematics_1.chain)([
|
|
105
|
+
() => console.log(`Coerce form submit operation`),
|
|
106
|
+
(0, schematics_ts_morph_1.CoerceFormSubmitOperation)({
|
|
107
|
+
controllerName,
|
|
108
|
+
project,
|
|
109
|
+
feature,
|
|
110
|
+
shared,
|
|
111
|
+
nestModule,
|
|
112
|
+
propertyList: controlList.map(FormComponentControlToDtoClassProperty),
|
|
113
|
+
bodyDtoName: (0, schematics_utilities_1.CoerceSuffix)(context, '-' + componentName),
|
|
114
|
+
}),
|
|
115
|
+
]);
|
|
116
|
+
}
|
|
117
|
+
return (0, schematics_1.noop)();
|
|
118
|
+
}
|
|
119
|
+
function formSubmitRule(normalizedOptions) {
|
|
120
|
+
const { backend, controllerName, nestModule, } = normalizedOptions;
|
|
121
|
+
if ([backend_types_1.BackendTypes.NESTJS].includes(backend)) {
|
|
122
|
+
const submitOperationId = (0, schematics_ts_morph_1.buildOperationId)(normalizedOptions, 'submit', (0, schematics_ts_morph_1.BuildNestControllerName)({
|
|
123
|
+
controllerName,
|
|
124
|
+
nestModule,
|
|
125
|
+
}));
|
|
126
|
+
return (0, schematics_1.chain)([
|
|
127
|
+
formSubmitBackendRule(normalizedOptions),
|
|
128
|
+
formSubmitProviderRule(normalizedOptions, submitOperationId),
|
|
129
|
+
]);
|
|
130
|
+
}
|
|
131
|
+
return (0, schematics_1.noop)();
|
|
132
|
+
}
|
|
133
|
+
function printFormComponentOptions(options) {
|
|
134
|
+
(0, angular_options_1.PrintAngularOptions)('form-component', options);
|
|
135
|
+
console.log(`=== controls: ${options.controlList.map((c) => c.name).join(', ')}`);
|
|
136
|
+
}
|
|
137
|
+
function default_1(options) {
|
|
138
|
+
const normalizedOptions = NormalizeFormComponentOptions(options);
|
|
139
|
+
printFormComponentOptions(normalizedOptions);
|
|
140
|
+
return function () {
|
|
141
|
+
return (0, schematics_1.chain)([
|
|
142
|
+
componentRule(normalizedOptions),
|
|
143
|
+
formDefinitionRule(normalizedOptions),
|
|
144
|
+
formSubmitRule(normalizedOptions),
|
|
145
|
+
]);
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
exports.default = default_1;
|
|
149
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/schematic/angular/src/schematics/form/form-component/index.ts"],"names":[],"mappings":";;;AAAA,2DAIoC;AACpC,mEASmC;AACnC,qEAGoC;AACpC,+CAGyB;AACzB,+BAA4B;AAC5B,kEAKsC;AACtC,8DAA0D;AAC1D,gFAG6C;AAa7C,SAAgB,6BAA6B,CAC3C,OAAuC;;IAEvC,MAAM,wBAAwB,GAAG,IAAA,yCAAuB,EAAC,OAAO,CAAC,CAAC;IAClE,IAAA,kDAAgC,EAAC,wBAAwB,CAAC,CAAC;IAC3D,MAAM,EACJ,IAAI,EACJ,UAAU,GACX,GAAG,wBAAwB,CAAC;IAC7B,MAAM,aAAa,GAAG,IAAA,mCAAY,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAClD,MAAM,cAAc,GAAG,MAAA,OAAO,CAAC,cAAc,mCAAI,aAAa,CAAC;IAC/D,MAAM,OAAO,GAAG,MAAA,OAAO,CAAC,OAAO,mCAC7B,IAAA,wBAAY,EAAC,CAAE,UAAU,EAAE,cAAc,CA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AC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAE,EAAE,CAAC,CAAC;AACtF,CAAC;AAED,mBAAyB,OAA6B;IACpD,MAAM,iBAAiB,GAAG,6BAA6B,CAAC,OAAO,CAAC,CAAC;IACjE,yBAAyB,CAAC,iBAAiB,CAAC,CAAC;IAC7C,OAAO;QACL,OAAO,IAAA,kBAAK,EAAC;YACX,aAAa,CAAC,iBAAiB,CAAC;YAChC,kBAAkB,CAAC,iBAAiB,CAAC;YACrC,cAAc,CAAC,iBAAiB,CAAC;SAClC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAVD,4BAUC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FormComponentControl } from '../../../lib/form-component-control';
|
|
2
|
+
import { AngularOptions } from '../../../lib/angular-options';
|
|
3
|
+
|
|
4
|
+
export interface FormComponentOptions extends AngularOptions {
|
|
5
|
+
window?: boolean;
|
|
6
|
+
controlList?: Array<string | FormComponentControl>;
|
|
7
|
+
role?: string;
|
|
8
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
{
|
|
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?"
|
|
10
|
+
},
|
|
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"
|
|
15
|
+
},
|
|
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"
|
|
20
|
+
},
|
|
21
|
+
"backend": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "The backend that should be used to handel data",
|
|
24
|
+
"enum": [
|
|
25
|
+
"none",
|
|
26
|
+
"local",
|
|
27
|
+
"nestjs"
|
|
28
|
+
],
|
|
29
|
+
"default": "none"
|
|
30
|
+
},
|
|
31
|
+
"shared": {
|
|
32
|
+
"type": "boolean",
|
|
33
|
+
"description": "Whether the form is shared across applications",
|
|
34
|
+
"default": false
|
|
35
|
+
},
|
|
36
|
+
"window": {
|
|
37
|
+
"type": "boolean",
|
|
38
|
+
"description": "Whether the form can be opened in a window",
|
|
39
|
+
"default": false
|
|
40
|
+
},
|
|
41
|
+
"directory": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"description": "A path suffix added to the base path"
|
|
44
|
+
},
|
|
45
|
+
"role": {
|
|
46
|
+
"type": "string",
|
|
47
|
+
"description": "Define the role of the form"
|
|
48
|
+
},
|
|
49
|
+
"nestModule": {
|
|
50
|
+
"type": "string",
|
|
51
|
+
"description": "Name of the nest module where the controller is created"
|
|
52
|
+
},
|
|
53
|
+
"controllerName": {
|
|
54
|
+
"type": "string",
|
|
55
|
+
"description": "Name of the nest controller"
|
|
56
|
+
},
|
|
57
|
+
"controlList": {
|
|
58
|
+
"alias": "control",
|
|
59
|
+
"type": "array",
|
|
60
|
+
"items": {
|
|
61
|
+
"oneOf": [
|
|
62
|
+
{
|
|
63
|
+
"type": "string"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"type": "object",
|
|
67
|
+
"properties": {
|
|
68
|
+
"type": {
|
|
69
|
+
"type": "string"
|
|
70
|
+
},
|
|
71
|
+
"name": {
|
|
72
|
+
"type": "string"
|
|
73
|
+
},
|
|
74
|
+
"state": {
|
|
75
|
+
"type": "string",
|
|
76
|
+
"description": "The initial state of the control"
|
|
77
|
+
},
|
|
78
|
+
"isRequired": {
|
|
79
|
+
"type": "boolean",
|
|
80
|
+
"description": "Whether the control value is required",
|
|
81
|
+
"default": false
|
|
82
|
+
},
|
|
83
|
+
"validatorList": {
|
|
84
|
+
"type": "array",
|
|
85
|
+
"items": {
|
|
86
|
+
"type": "string"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"required": [
|
|
91
|
+
"name"
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"context": {
|
|
98
|
+
"type": "string",
|
|
99
|
+
"description": "The context use to generate proper names for class, files, etc"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"required": [
|
|
103
|
+
"name",
|
|
104
|
+
"project",
|
|
105
|
+
"feature"
|
|
106
|
+
]
|
|
107
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FormControlOptions } from './schema';
|
|
2
|
+
import { Normalized } from '@rxap/utilities';
|
|
3
|
+
import { NormalizedFormDefinitionControl } from '../../../lib/form-definition-control';
|
|
4
|
+
import { NormalizedAngularOptions } from '../../../lib/angular-options';
|
|
5
|
+
export interface NormalizedFormControlOptions extends Readonly<Normalized<FormControlOptions> & NormalizedAngularOptions & NormalizedFormDefinitionControl> {
|
|
6
|
+
controllerName: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function NormalizeFormControlOptions(options: Readonly<FormControlOptions>): NormalizedFormControlOptions;
|
|
9
|
+
export default function (options: FormControlOptions): () => import("@angular-devkit/schematics").Rule;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NormalizeFormControlOptions = void 0;
|
|
4
|
+
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
5
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
|
+
const utilities_1 = require("@rxap/utilities");
|
|
7
|
+
const schematics_ts_morph_1 = require("@rxap/schematics-ts-morph");
|
|
8
|
+
const form_definition_control_1 = require("../../../lib/form-definition-control");
|
|
9
|
+
const angular_options_1 = require("../../../lib/angular-options");
|
|
10
|
+
function NormalizeFormControlOptions(options) {
|
|
11
|
+
var _a, _b, _c;
|
|
12
|
+
const normalizedAngularOptions = (0, angular_options_1.NormalizeAngularOptions)(options);
|
|
13
|
+
const normalizedFormDefinitionControl = (0, form_definition_control_1.NormalizeFormDefinitionControl)(options);
|
|
14
|
+
const { nestModule } = normalizedAngularOptions;
|
|
15
|
+
const formName = (0, schematics_utilities_1.dasherize)(options.formName);
|
|
16
|
+
let directory = (_a = options.directory) !== null && _a !== void 0 ? _a : '';
|
|
17
|
+
if (!directory.endsWith('/' + formName + '-form')) {
|
|
18
|
+
directory += '/' + formName + '-form';
|
|
19
|
+
}
|
|
20
|
+
const controllerName = (_b = options.controllerName) !== null && _b !== void 0 ? _b : formName;
|
|
21
|
+
const context = (_c = options.context) !== null && _c !== void 0 ? _c : (0, utilities_1.joinWithDash)([nestModule, controllerName], { removeDuplicated: true });
|
|
22
|
+
return Object.assign(Object.assign(Object.assign({}, normalizedAngularOptions), normalizedFormDefinitionControl), { formName,
|
|
23
|
+
directory,
|
|
24
|
+
controllerName,
|
|
25
|
+
context });
|
|
26
|
+
}
|
|
27
|
+
exports.NormalizeFormControlOptions = NormalizeFormControlOptions;
|
|
28
|
+
function printOptions(options) {
|
|
29
|
+
(0, angular_options_1.PrintAngularOptions)('form-control', options);
|
|
30
|
+
}
|
|
31
|
+
function default_1(options) {
|
|
32
|
+
const normalizedOptions = NormalizeFormControlOptions(options);
|
|
33
|
+
const { name, project, feature, directory, formName, type, isArray, state, isRequired, validatorList, } = normalizedOptions;
|
|
34
|
+
printOptions(normalizedOptions);
|
|
35
|
+
return () => {
|
|
36
|
+
return (0, schematics_1.chain)([
|
|
37
|
+
() => console.log('Coerce control in form definition class ...'),
|
|
38
|
+
(0, schematics_ts_morph_1.CoerceFormDefinitionControl)({
|
|
39
|
+
project,
|
|
40
|
+
feature,
|
|
41
|
+
directory,
|
|
42
|
+
formName,
|
|
43
|
+
name,
|
|
44
|
+
type,
|
|
45
|
+
isArray,
|
|
46
|
+
state,
|
|
47
|
+
isRequired,
|
|
48
|
+
validatorList,
|
|
49
|
+
}),
|
|
50
|
+
]);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
exports.default = default_1;
|
|
54
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/schematic/angular/src/schematics/form/form-control/index.ts"],"names":[],"mappings":";;;AACA,qEAAuD;AACvD,2DAAmD;AACnD,+CAGyB;AACzB,mEAAwE;AACxE,kFAG8C;AAC9C,kEAIsC;AAOtC,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,QAAQ,GAAG,IAAA,gCAAS,EAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7C,IAAI,SAAS,GAAG,MAAA,OAAO,CAAC,SAAS,mCAAI,EAAE,CAAC;IACxC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,GAAG,QAAQ,GAAG,OAAO,CAAC,EAAE;QACjD,SAAS,IAAI,GAAG,GAAG,QAAQ,GAAG,OAAO,CAAC;KACvC;IACD,MAAM,cAAc,GAAG,MAAA,OAAO,CAAC,cAAc,mCAAI,QAAQ,CAAC;IAC1D,MAAM,OAAO,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,IAAA,wBAAY,EAAC,CAAE,UAAU,EAAE,cAAc,CAAE,EAAE,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5G,qDACK,wBAAwB,GACxB,+BAA+B,KAClC,QAAQ;QACR,SAAS;QACT,cAAc;QACd,OAAO,IACP;AACJ,CAAC;AArBD,kEAqBC;AAED,SAAS,YAAY,CAAC,OAAqC;IACzD,IAAA,qCAAmB,EAAC,cAAc,EAAE,OAAO,CAAC,CAAC;AAC/C,CAAC;AAED,mBAAyB,OAA2B;IAClD,MAAM,iBAAiB,GAAG,2BAA2B,CAAC,OAAO,CAAC,CAAC;IAC/D,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,YAAY,CAAC,iBAAiB,CAAC,CAAC;IAEhC,OAAO,GAAG,EAAE;QACV,OAAO,IAAA,kBAAK,EAAC;YACX,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,6CAA6C,CAAC;YAChE,IAAA,iDAA2B,EAAC;gBAC1B,OAAO;gBACP,OAAO;gBACP,SAAS;gBACT,QAAQ;gBACR,IAAI;gBACJ,IAAI;gBACJ,OAAO;gBACP,KAAK;gBACL,UAAU;gBACV,aAAa;aACd,CAAC;SACH,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAjCD,4BAiCC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "form-control",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"name": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"description": "The name of form control",
|
|
9
|
+
"x-prompt": "Enter the name of the form control?"
|
|
10
|
+
},
|
|
11
|
+
"formName": {
|
|
12
|
+
"alias": "form",
|
|
13
|
+
"type": "string",
|
|
14
|
+
"description": "The name of the form where the form control should be added",
|
|
15
|
+
"x-prompt": "Enter the name of the form where the form control should be added"
|
|
16
|
+
},
|
|
17
|
+
"project": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"description": "The project where the form control should be added",
|
|
20
|
+
"x-prompt": "Enter project name where the form control should be added"
|
|
21
|
+
},
|
|
22
|
+
"backend": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"description": "The backend that should be used to handel data",
|
|
25
|
+
"enum": [
|
|
26
|
+
"none",
|
|
27
|
+
"local",
|
|
28
|
+
"nestjs"
|
|
29
|
+
],
|
|
30
|
+
"default": "none"
|
|
31
|
+
},
|
|
32
|
+
"feature": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"description": "The feature where the form control should be added",
|
|
35
|
+
"x-prompt": "Enter feature name where the form control should be added"
|
|
36
|
+
},
|
|
37
|
+
"shared": {
|
|
38
|
+
"type": "boolean",
|
|
39
|
+
"description": "Whether the form is shared across applications",
|
|
40
|
+
"default": false
|
|
41
|
+
},
|
|
42
|
+
"directory": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"description": "A path suffix added to the base path"
|
|
45
|
+
},
|
|
46
|
+
"nestModule": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"description": "Name of the nest module where the controller is created"
|
|
49
|
+
},
|
|
50
|
+
"controllerName": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"description": "Name of the nest controller"
|
|
53
|
+
},
|
|
54
|
+
"type": {
|
|
55
|
+
"type": "string",
|
|
56
|
+
"description": "The data type of the form control"
|
|
57
|
+
},
|
|
58
|
+
"validatorList": {
|
|
59
|
+
"alias": "validator",
|
|
60
|
+
"type": "array",
|
|
61
|
+
"items": {
|
|
62
|
+
"type": "string"
|
|
63
|
+
},
|
|
64
|
+
"description": "List of validators to be added to the form control"
|
|
65
|
+
},
|
|
66
|
+
"isRequired": {
|
|
67
|
+
"alias": "required",
|
|
68
|
+
"type": "boolean",
|
|
69
|
+
"description": "Whether the form control value is required"
|
|
70
|
+
},
|
|
71
|
+
"state": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"description": "The initial state of the form control"
|
|
74
|
+
},
|
|
75
|
+
"isArray": {
|
|
76
|
+
"alias": "array",
|
|
77
|
+
"type": "boolean",
|
|
78
|
+
"description": "Whether the form control is an array"
|
|
79
|
+
},
|
|
80
|
+
"context": {
|
|
81
|
+
"type": "string",
|
|
82
|
+
"description": "The context use to generate proper names for class, files, etc"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"required": [
|
|
86
|
+
"name",
|
|
87
|
+
"formName",
|
|
88
|
+
"project",
|
|
89
|
+
"feature"
|
|
90
|
+
]
|
|
91
|
+
}
|