@rxap/schematic-angular 16.2.0-dev.20 → 16.2.0-dev.22
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 +19 -0
- package/README.md +1 -1
- package/collection.json +15 -0
- package/package.json +7 -7
- package/src/lib/coerce-form-component.js +15 -3
- package/src/lib/coerce-form-component.js.map +1 -1
- package/src/lib/data-grid-item.d.ts +3 -3
- package/src/lib/data-grid-item.js +2 -2
- package/src/lib/data-grid-item.js.map +1 -1
- package/src/lib/form/abstract-control.d.ts +29 -0
- package/src/lib/form/abstract-control.js +37 -0
- package/src/lib/form/abstract-control.js.map +1 -0
- package/src/lib/form/array/base-form-array.d.ts +18 -0
- package/src/lib/form/array/base-form-array.js +40 -0
- package/src/lib/form/array/base-form-array.js.map +1 -0
- package/src/lib/form/array/form-array-kind.d.ts +3 -0
- package/src/lib/form/array/form-array-kind.js +8 -0
- package/src/lib/form/array/form-array-kind.js.map +1 -0
- package/src/lib/form/array/form-array.d.ts +12 -0
- package/src/lib/form/array/form-array.js +18 -0
- package/src/lib/form/array/form-array.js.map +1 -0
- package/src/lib/form/coerce-control-component-imports.d.ts +3 -0
- package/src/lib/form/coerce-control-component-imports.js +18 -0
- package/src/lib/form/coerce-control-component-imports.js.map +1 -0
- package/src/lib/form/control/autocomplete-table-select-form-control.d.ts +6 -0
- package/src/lib/form/control/autocomplete-table-select-form-control.js +34 -0
- package/src/lib/form/control/autocomplete-table-select-form-control.js.map +1 -0
- package/src/lib/form/control/base-form-control.d.ts +14 -0
- package/src/lib/form/control/base-form-control.js +19 -0
- package/src/lib/form/control/base-form-control.js.map +1 -0
- package/src/lib/form/control/checkbox-form-control.d.ts +11 -0
- package/src/lib/form/control/checkbox-form-control.js +23 -0
- package/src/lib/form/control/checkbox-form-control.js.map +1 -0
- package/src/lib/form/control/form-control-kind.d.ts +9 -0
- package/src/lib/form/control/form-control-kind.js +14 -0
- package/src/lib/form/control/form-control-kind.js.map +1 -0
- package/src/lib/form/control/form-control.d.ts +18 -0
- package/src/lib/form/control/form-control.js +43 -0
- package/src/lib/form/control/form-control.js.map +1 -0
- package/src/lib/form/control/form-field-form-control.d.ts +33 -0
- package/src/lib/form/control/form-field-form-control.js +76 -0
- package/src/lib/form/control/form-field-form-control.js.map +1 -0
- package/src/lib/form/control/input-form-control.d.ts +14 -0
- package/src/lib/form/control/input-form-control.js +71 -0
- package/src/lib/form/control/input-form-control.js.map +1 -0
- package/src/lib/form/control/select-form-control.d.ts +18 -0
- package/src/lib/form/control/select-form-control.js +29 -0
- package/src/lib/form/control/select-form-control.js.map +1 -0
- package/src/lib/form/control/slide-toggle-form-control.d.ts +11 -0
- package/src/lib/form/control/slide-toggle-form-control.js +23 -0
- package/src/lib/form/control/slide-toggle-form-control.js.map +1 -0
- package/src/lib/form/control/table-select-form-control.d.ts +43 -0
- package/src/lib/form/control/table-select-form-control.js +69 -0
- package/src/lib/form/control/table-select-form-control.js.map +1 -0
- package/src/lib/form/control.d.ts +8 -0
- package/src/lib/form/control.js +38 -0
- package/src/lib/form/control.js.map +1 -0
- package/src/lib/form/generate-form-template.d.ts +2 -2
- package/src/lib/form/group/base-form-group.d.ts +17 -0
- package/src/lib/form/group/base-form-group.js +20 -0
- package/src/lib/form/group/base-form-group.js.map +1 -0
- package/src/lib/form/group/form-group-kind.d.ts +3 -0
- package/src/lib/form/group/form-group-kind.js +8 -0
- package/src/lib/form/group/form-group-kind.js.map +1 -0
- package/src/lib/form/group/form-group.d.ts +12 -0
- package/src/lib/form/group/form-group.js +18 -0
- package/src/lib/form/group/form-group.js.map +1 -0
- package/src/lib/table-column.d.ts +4 -3
- package/src/lib/table-column.js +5 -4
- package/src/lib/table-column.js.map +1 -1
- package/src/schema.json +1691 -1311
- package/src/schematic-input.schema.json +109 -156
- package/src/schematics/abstract-control.schema.json +78 -0
- package/src/schematics/accordion/accordion-component/schema.json +127 -127
- package/src/schematics/accordion/accordion-item-component/schema.json +18 -18
- package/src/schematics/accordion/item/accordion-item-data-grid-component/schema.json +685 -81
- package/src/schematics/accordion/item/accordion-item-switch-component/schema.json +76 -76
- package/src/schematics/accordion/item/accordion-item-table-component/schema.json +555 -97
- package/src/schematics/accordion/item/accordion-item-tree-table-component/schema.json +537 -79
- package/src/schematics/autocomplete-table-select-form-control.schema.json +96 -0
- package/src/schematics/base-form-array.schema.json +45 -0
- package/src/schematics/base-form-control.schema.json +27 -0
- package/src/schematics/base-form-group.schema.json +42 -0
- package/src/schematics/checkbox-form-control.schema.json +30 -0
- package/src/schematics/control.schema.json +26 -0
- package/src/schematics/data-grid-component/index.js +4 -0
- package/src/schematics/data-grid-component/index.js.map +1 -1
- package/src/schematics/data-grid-component/schema.json +685 -81
- package/src/schematics/data-grid-item.schema.json +3 -3
- package/src/schematics/form/control/autocomplete-table-select-form-control/index.d.ts +10 -0
- package/src/schematics/form/control/autocomplete-table-select-form-control/index.js +247 -0
- package/src/schematics/form/control/autocomplete-table-select-form-control/index.js.map +1 -0
- package/src/schematics/form/control/autocomplete-table-select-form-control/schema.d.ts +4 -0
- package/src/schematics/form/control/autocomplete-table-select-form-control/schema.json +453 -0
- package/src/schematics/form/control/autocomplete-table-select-form-control/template.schema.json +39 -0
- package/src/schematics/form/control/input-form-control/index.d.ts +1 -1
- package/src/schematics/form/control/input-form-control/index.js +4 -4
- package/src/schematics/form/control/input-form-control/index.js.map +1 -1
- package/src/schematics/form/control/input-form-control/schema.d.ts +2 -2
- package/src/schematics/form/control/input-form-control/schema.json +256 -86
- package/src/schematics/form/control/input-form-control/template.schema.json +16 -3
- package/src/schematics/form/control/select-form-control/index.d.ts +2 -2
- package/src/schematics/form/control/select-form-control/index.js +21 -14
- package/src/schematics/form/control/select-form-control/index.js.map +1 -1
- package/src/schematics/form/control/select-form-control/schema.d.ts +2 -3
- package/src/schematics/form/control/select-form-control/schema.json +249 -90
- package/src/schematics/form/control/select-form-control/template.schema.json +16 -3
- package/src/schematics/form/control/table-select-form-control/index.d.ts +3 -9
- package/src/schematics/form/control/table-select-form-control/index.js +24 -18
- package/src/schematics/form/control/table-select-form-control/index.js.map +1 -1
- package/src/schematics/form/control/table-select-form-control/schema.d.ts +2 -3
- package/src/schematics/form/control/table-select-form-control/schema.json +325 -123
- package/src/schematics/form/control/table-select-form-control/template.schema.json +16 -60
- package/src/schematics/form/form-array/index.d.ts +9 -0
- package/src/schematics/form/form-array/index.js +54 -0
- package/src/schematics/form/form-array/index.js.map +1 -0
- package/src/schematics/form/form-array/schema.d.ts +4 -0
- package/src/schematics/form/form-array/schema.json +906 -0
- package/src/schematics/form/form-array/template.schema.json +33 -0
- package/src/schematics/form/form-component/files/component/__componentName__.component.html.hbs +4 -1
- package/src/schematics/form/form-component/index.d.ts +2 -4
- package/src/schematics/form/form-component/index.js +8 -24
- package/src/schematics/form/form-component/index.js.map +1 -1
- package/src/schematics/form/form-component/schema.d.ts +2 -2
- package/src/schematics/form/form-component/schema.json +749 -86
- package/src/schematics/form/form-control/index.d.ts +3 -5
- package/src/schematics/form/form-control/index.js +8 -20
- package/src/schematics/form/form-control/index.js.map +1 -1
- package/src/schematics/form/form-control/schema.d.ts +2 -4
- package/src/schematics/form/form-control/schema.json +599 -59
- package/src/schematics/form/form-control/template.schema.json +1 -2
- package/src/schematics/form/form-definition/index.d.ts +2 -2
- package/src/schematics/form/form-definition/index.js +28 -15
- package/src/schematics/form/form-definition/index.js.map +1 -1
- package/src/schematics/form/form-definition/schema.d.ts +2 -2
- package/src/schematics/form/form-definition/schema.json +743 -56
- package/src/schematics/form/form-group/index.d.ts +9 -0
- package/src/schematics/form/form-group/index.js +54 -0
- package/src/schematics/form/form-group/index.js.map +1 -0
- package/src/schematics/form/form-group/schema.d.ts +4 -0
- package/src/schematics/form/form-group/schema.json +906 -0
- package/src/schematics/form/form-group/template.schema.json +33 -0
- package/src/schematics/form/templates/checkbox-form-control.hbs +1 -1
- package/src/schematics/form/templates/default-form-array.hbs +27 -0
- package/src/schematics/form/templates/default-form-group.hbs +13 -0
- package/src/schematics/form/templates/input-form-control.hbs +7 -7
- package/src/schematics/form/templates/select-form-control.hbs +5 -0
- package/src/schematics/form/templates/table-select-form-control.hbs +16 -16
- package/src/schematics/form-array.schema.json +40 -0
- package/src/schematics/form-control.schema.json +69 -54
- package/src/schematics/form-definition.schema.json +3 -3
- package/src/schematics/form-group.schema.json +40 -0
- package/src/schematics/input-form-control.schema.json +10 -6
- package/src/schematics/select-form-control.schema.json +8 -4
- package/src/schematics/slide-toggle-form-control.schema.json +30 -0
- package/src/schematics/table/action/dialog-table-action/schema.json +20 -20
- package/src/schematics/table/action/form-table-action/index.d.ts +2 -2
- package/src/schematics/table/action/form-table-action/index.js +3 -4
- package/src/schematics/table/action/form-table-action/index.js.map +1 -1
- package/src/schematics/table/action/form-table-action/schema.d.ts +2 -2
- package/src/schematics/table/action/form-table-action/schema.json +750 -87
- package/src/schematics/table/action/navigation-table-action/schema.json +20 -20
- package/src/schematics/table/action/open-api-table-action/schema.json +20 -20
- package/src/schematics/table/action/operation-table-action/schema.json +20 -20
- package/src/schematics/table/header-button/form-table-header-button/index.d.ts +2 -2
- package/src/schematics/table/header-button/form-table-header-button/index.js +2 -2
- package/src/schematics/table/header-button/form-table-header-button/index.js.map +1 -1
- package/src/schematics/table/header-button/form-table-header-button/schema.d.ts +2 -2
- package/src/schematics/table/header-button/form-table-header-button/schema.json +818 -81
- package/src/schematics/table/header-button/form-table-header-button/template.schema.json +4 -22
- package/src/schematics/table/header-button/navigation-table-header-button/schema.json +20 -20
- package/src/schematics/table/table-action/schema.json +47 -47
- package/src/schematics/table/table-component/index.d.ts +2 -2
- package/src/schematics/table/table-component/schema.json +537 -79
- package/src/schematics/table/table-header-button/schema.json +40 -40
- package/src/schematics/table/tree-table-component/files/component/__componentName__.component.html.hbs +1 -1
- package/src/schematics/table/tree-table-component/schema.json +521 -63
- package/src/schematics/table-select-form-control.schema.json +96 -0
- package/src/schematics/textarea-form-control.schema.json +32 -0
- package/src/template.schema.json +45 -0
- package/src/lib/form-component-control.d.ts +0 -8
- package/src/lib/form-component-control.js +0 -15
- package/src/lib/form-component-control.js.map +0 -1
- package/src/lib/form-control.d.ts +0 -136
- package/src/lib/form-control.js +0 -265
- package/src/lib/form-control.js.map +0 -1
- package/src/lib/form-definition-control.d.ts +0 -5
- package/src/lib/form-definition-control.js +0 -30
- package/src/lib/form-definition-control.js.map +0 -1
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "table-select-form-control",
|
|
4
|
+
"allOf": [
|
|
5
|
+
{
|
|
6
|
+
"$ref": "#/definitions/baseFormControl"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"type": "object",
|
|
10
|
+
"properties": {
|
|
11
|
+
"formField": {
|
|
12
|
+
"$ref": "#/definitions/formField"
|
|
13
|
+
},
|
|
14
|
+
"kind": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"const": "table-select"
|
|
17
|
+
},
|
|
18
|
+
"placeholder": {
|
|
19
|
+
"type": "string"
|
|
20
|
+
},
|
|
21
|
+
"columnList": {
|
|
22
|
+
"alias": "column",
|
|
23
|
+
"type": "array",
|
|
24
|
+
"items": {
|
|
25
|
+
"description": "table column name",
|
|
26
|
+
"type": "object",
|
|
27
|
+
"properties": {
|
|
28
|
+
"name": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"description": "table column name"
|
|
31
|
+
},
|
|
32
|
+
"title": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"description": "table column label"
|
|
35
|
+
},
|
|
36
|
+
"hasFilter": {
|
|
37
|
+
"type": "boolean",
|
|
38
|
+
"description": "Whether the column has a filter"
|
|
39
|
+
},
|
|
40
|
+
"kind": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"description": "The kind of data in the column"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"description": "List of table column names"
|
|
47
|
+
},
|
|
48
|
+
"title": {
|
|
49
|
+
"type": "string",
|
|
50
|
+
"description": "The title of the table select window"
|
|
51
|
+
},
|
|
52
|
+
"toDisplay": {
|
|
53
|
+
"type": "object",
|
|
54
|
+
"properties": {
|
|
55
|
+
"property": {
|
|
56
|
+
"$ref": "#/definitions/property"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"toValue": {
|
|
61
|
+
"type": "object",
|
|
62
|
+
"properties": {
|
|
63
|
+
"property": {
|
|
64
|
+
"$ref": "#/definitions/property"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"upstream": {
|
|
69
|
+
"$ref": "#/definitions/upstream"
|
|
70
|
+
},
|
|
71
|
+
"resolver": {
|
|
72
|
+
"type": "object",
|
|
73
|
+
"properties": {
|
|
74
|
+
"upstream": {
|
|
75
|
+
"$ref": "#/definitions/upstream"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
"definitions": {
|
|
83
|
+
"property": {
|
|
84
|
+
"$ref": "./property.schema.json"
|
|
85
|
+
},
|
|
86
|
+
"upstream": {
|
|
87
|
+
"$ref": "./upstream.schema.json"
|
|
88
|
+
},
|
|
89
|
+
"formField": {
|
|
90
|
+
"$ref": "./form-field.schema.json"
|
|
91
|
+
},
|
|
92
|
+
"baseFormControl": {
|
|
93
|
+
"$ref": "./base-form-control.schema.json"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "textarea-form-control",
|
|
4
|
+
"allOf": [
|
|
5
|
+
{
|
|
6
|
+
"$ref": "#/definitions/baseFormControl"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"type": "object",
|
|
10
|
+
"properties": {
|
|
11
|
+
"formField": {
|
|
12
|
+
"$ref": "#/definitions/formField"
|
|
13
|
+
},
|
|
14
|
+
"kind": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"const": "textarea"
|
|
17
|
+
},
|
|
18
|
+
"placeholder": {
|
|
19
|
+
"type": "string"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"definitions": {
|
|
25
|
+
"formField": {
|
|
26
|
+
"$ref": "./form-field.schema.json"
|
|
27
|
+
},
|
|
28
|
+
"baseFormControl": {
|
|
29
|
+
"$ref": "./base-form-control.schema.json"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
package/src/template.schema.json
CHANGED
|
@@ -64,9 +64,18 @@
|
|
|
64
64
|
"tableSelectFormControlSchematic": {
|
|
65
65
|
"$ref": "schematics/form/control/table-select-form-control/template.schema.json"
|
|
66
66
|
},
|
|
67
|
+
"autocompleteTableSelectFormControlSchematic": {
|
|
68
|
+
"$ref": "schematics/form/control/autocomplete-table-select-form-control/template.schema.json"
|
|
69
|
+
},
|
|
67
70
|
"formControlSchematic": {
|
|
68
71
|
"$ref": "schematics/form/form-control/template.schema.json"
|
|
69
72
|
},
|
|
73
|
+
"formGroupSchematic": {
|
|
74
|
+
"$ref": "schematics/form/form-group/template.schema.json"
|
|
75
|
+
},
|
|
76
|
+
"formArraySchematic": {
|
|
77
|
+
"$ref": "schematics/form/form-array/template.schema.json"
|
|
78
|
+
},
|
|
70
79
|
"dialogTableActionSchematic": {
|
|
71
80
|
"$ref": "schematics/table/action/dialog-table-action/template.schema.json"
|
|
72
81
|
},
|
|
@@ -91,6 +100,9 @@
|
|
|
91
100
|
"accordionItemTreeTableComponentSchematic": {
|
|
92
101
|
"$ref": "schematics/accordion/item/accordion-item-tree-table-component/template.schema.json"
|
|
93
102
|
},
|
|
103
|
+
"abstractControl": {
|
|
104
|
+
"$ref": "schematics/abstract-control.schema.json"
|
|
105
|
+
},
|
|
94
106
|
"accordionIdentifier": {
|
|
95
107
|
"$ref": "schematics/accordion-identifier.schema.json"
|
|
96
108
|
},
|
|
@@ -100,18 +112,39 @@
|
|
|
100
112
|
"angular": {
|
|
101
113
|
"$ref": "schematics/angular.schema.json"
|
|
102
114
|
},
|
|
115
|
+
"autocompleteTableSelectFormControl": {
|
|
116
|
+
"$ref": "schematics/autocomplete-table-select-form-control.schema.json"
|
|
117
|
+
},
|
|
103
118
|
"backend": {
|
|
104
119
|
"$ref": "schematics/backend.schema.json"
|
|
105
120
|
},
|
|
121
|
+
"baseFormArray": {
|
|
122
|
+
"$ref": "schematics/base-form-array.schema.json"
|
|
123
|
+
},
|
|
124
|
+
"baseFormControl": {
|
|
125
|
+
"$ref": "schematics/base-form-control.schema.json"
|
|
126
|
+
},
|
|
127
|
+
"baseFormGroup": {
|
|
128
|
+
"$ref": "schematics/base-form-group.schema.json"
|
|
129
|
+
},
|
|
106
130
|
"button": {
|
|
107
131
|
"$ref": "schematics/button.schema.json"
|
|
108
132
|
},
|
|
133
|
+
"checkboxFormControl": {
|
|
134
|
+
"$ref": "schematics/checkbox-form-control.schema.json"
|
|
135
|
+
},
|
|
136
|
+
"control": {
|
|
137
|
+
"$ref": "schematics/control.schema.json"
|
|
138
|
+
},
|
|
109
139
|
"dataGridItem": {
|
|
110
140
|
"$ref": "schematics/data-grid-item.schema.json"
|
|
111
141
|
},
|
|
112
142
|
"dataGrid": {
|
|
113
143
|
"$ref": "schematics/data-grid.schema.json"
|
|
114
144
|
},
|
|
145
|
+
"formArray": {
|
|
146
|
+
"$ref": "schematics/form-array.schema.json"
|
|
147
|
+
},
|
|
115
148
|
"formComponent": {
|
|
116
149
|
"$ref": "schematics/form-component.schema.json"
|
|
117
150
|
},
|
|
@@ -124,6 +157,9 @@
|
|
|
124
157
|
"formField": {
|
|
125
158
|
"$ref": "schematics/form-field.schema.json"
|
|
126
159
|
},
|
|
160
|
+
"formGroup": {
|
|
161
|
+
"$ref": "schematics/form-group.schema.json"
|
|
162
|
+
},
|
|
127
163
|
"general": {
|
|
128
164
|
"$ref": "schematics/general.schema.json"
|
|
129
165
|
},
|
|
@@ -145,15 +181,24 @@
|
|
|
145
181
|
"selectFormControl": {
|
|
146
182
|
"$ref": "schematics/select-form-control.schema.json"
|
|
147
183
|
},
|
|
184
|
+
"slideToggleFormControl": {
|
|
185
|
+
"$ref": "schematics/slide-toggle-form-control.schema.json"
|
|
186
|
+
},
|
|
148
187
|
"tableAction": {
|
|
149
188
|
"$ref": "schematics/table-action.schema.json"
|
|
150
189
|
},
|
|
151
190
|
"tableColumn": {
|
|
152
191
|
"$ref": "schematics/table-column.schema.json"
|
|
153
192
|
},
|
|
193
|
+
"tableSelectFormControl": {
|
|
194
|
+
"$ref": "schematics/table-select-form-control.schema.json"
|
|
195
|
+
},
|
|
154
196
|
"table": {
|
|
155
197
|
"$ref": "schematics/table.schema.json"
|
|
156
198
|
},
|
|
199
|
+
"textareaFormControl": {
|
|
200
|
+
"$ref": "schematics/textarea-form-control.schema.json"
|
|
201
|
+
},
|
|
157
202
|
"treeTable": {
|
|
158
203
|
"$ref": "schematics/tree-table.schema.json"
|
|
159
204
|
},
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Normalized } from '@rxap/utilities';
|
|
2
|
-
import { FormDefinitionControl, NormalizedFormDefinitionControl } from './form-definition-control';
|
|
3
|
-
export interface FormComponentControl extends FormDefinitionControl {
|
|
4
|
-
}
|
|
5
|
-
export interface NormalizedFormComponentControl extends Omit<Readonly<Normalized<FormComponentControl>>, 'type' | 'importList'>, NormalizedFormDefinitionControl {
|
|
6
|
-
}
|
|
7
|
-
export declare function NormalizeFormComponentControl(control: FormComponentControl): NormalizedFormComponentControl;
|
|
8
|
-
export declare function NormalizeFormComponentControlList(controlList?: Array<FormComponentControl>): ReadonlyArray<NormalizedFormComponentControl>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NormalizeFormComponentControlList = exports.NormalizeFormComponentControl = void 0;
|
|
4
|
-
const form_definition_control_1 = require("./form-definition-control");
|
|
5
|
-
function NormalizeFormComponentControl(control) {
|
|
6
|
-
const normalizedControl = (0, form_definition_control_1.NormalizeFormDefinitionControl)(control);
|
|
7
|
-
return Object.freeze(Object.assign({}, normalizedControl));
|
|
8
|
-
}
|
|
9
|
-
exports.NormalizeFormComponentControl = NormalizeFormComponentControl;
|
|
10
|
-
function NormalizeFormComponentControlList(controlList) {
|
|
11
|
-
var _a;
|
|
12
|
-
return Object.freeze((_a = controlList === null || controlList === void 0 ? void 0 : controlList.map(NormalizeFormComponentControl)) !== null && _a !== void 0 ? _a : []);
|
|
13
|
-
}
|
|
14
|
-
exports.NormalizeFormComponentControlList = NormalizeFormComponentControlList;
|
|
15
|
-
//# sourceMappingURL=form-component-control.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"form-component-control.js","sourceRoot":"","sources":["../../../../../../packages/schematic/angular/src/lib/form-component-control.ts"],"names":[],"mappings":";;;AAEA,uEAImC;AAanC,SAAgB,6BAA6B,CAC3C,OAA6B;IAE7B,MAAM,iBAAiB,GAAG,IAAA,wDAA8B,EAAC,OAAO,CAAC,CAAC;IAClE,OAAO,MAAM,CAAC,MAAM,mBACf,iBAAiB,EACpB,CAAC;AACL,CAAC;AAPD,sEAOC;AAED,SAAgB,iCAAiC,CAC/C,WAAyC;;IAEzC,OAAO,MAAM,CAAC,MAAM,CAAC,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,GAAG,CAAC,6BAA6B,CAAC,mCAAI,EAAE,CAAC,CAAC;AAC9E,CAAC;AAJD,8EAIC"}
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { DataProperty, NormalizedDataProperty, NormalizedTypeImport, NormalizedUpstreamOptions, TypeImport, UpstreamOptions } from '@rxap/ts-morph';
|
|
2
|
-
import { ControlOption, Normalized } from '@rxap/utilities';
|
|
3
|
-
import Handlebars from 'handlebars';
|
|
4
|
-
import { BackendTypes } from './backend-types';
|
|
5
|
-
import { NormalizedTableColumn, TableColumn } from './table-column';
|
|
6
|
-
export declare enum FormControlKinds {
|
|
7
|
-
DEFAULT = "default",
|
|
8
|
-
INPUT = "input",
|
|
9
|
-
SELECT = "select",
|
|
10
|
-
CHECKBOX = "checkbox",
|
|
11
|
-
SLIDE_TOGGLE = "slide-toggle",
|
|
12
|
-
TABLE_SELECT = "table-select"
|
|
13
|
-
}
|
|
14
|
-
export interface BaseFormControl extends DataProperty {
|
|
15
|
-
state?: string;
|
|
16
|
-
isRequired?: boolean;
|
|
17
|
-
isReadonly?: boolean;
|
|
18
|
-
isDisabled?: boolean;
|
|
19
|
-
validatorList?: string[];
|
|
20
|
-
importList?: TypeImport[];
|
|
21
|
-
kind: FormControlKinds;
|
|
22
|
-
template?: string;
|
|
23
|
-
label?: string;
|
|
24
|
-
}
|
|
25
|
-
export interface NormalizedBaseFormControl extends Readonly<Normalized<BaseFormControl> & NormalizedDataProperty> {
|
|
26
|
-
type: NormalizedTypeImport;
|
|
27
|
-
importList: NormalizedTypeImport[];
|
|
28
|
-
handlebars: Handlebars.TemplateDelegate<{
|
|
29
|
-
control: NormalizedBaseFormControl;
|
|
30
|
-
}>;
|
|
31
|
-
}
|
|
32
|
-
export declare function NormalizeBaseFormControl(control: BaseFormControl): NormalizedBaseFormControl;
|
|
33
|
-
export interface FormFieldButton {
|
|
34
|
-
svgIcon?: string;
|
|
35
|
-
icon?: string;
|
|
36
|
-
directiveList?: TypeImport[];
|
|
37
|
-
importList?: TypeImport[];
|
|
38
|
-
}
|
|
39
|
-
export interface FormField {
|
|
40
|
-
label?: string;
|
|
41
|
-
prefixButton?: FormFieldButton;
|
|
42
|
-
suffixButton?: FormFieldButton;
|
|
43
|
-
directiveList?: TypeImport[];
|
|
44
|
-
hasClearButton?: boolean;
|
|
45
|
-
}
|
|
46
|
-
export type NormalizedFormField = Readonly<Normalized<FormField>>;
|
|
47
|
-
export interface NormalizedFormFieldButton extends Readonly<Normalized<FormFieldButton>> {
|
|
48
|
-
directiveList: NormalizedTypeImport[];
|
|
49
|
-
importList: NormalizedTypeImport[];
|
|
50
|
-
}
|
|
51
|
-
export declare function NormalizeFormFieldButton(button?: FormFieldButton | null): NormalizedFormFieldButton | null;
|
|
52
|
-
export declare function NormalizeFormField(formField: FormField, importList?: TypeImport[], defaultFormField?: Partial<FormField>): NormalizedFormField;
|
|
53
|
-
export interface FormFieldFormControl extends BaseFormControl {
|
|
54
|
-
formField?: FormField;
|
|
55
|
-
}
|
|
56
|
-
export interface NormalizedFormFieldFormControl extends Readonly<Normalized<Omit<FormFieldFormControl, 'type' | 'importList'>>>, NormalizedBaseFormControl {
|
|
57
|
-
formField: NormalizedFormField;
|
|
58
|
-
}
|
|
59
|
-
export declare function IsFormFieldFormControl(control: BaseFormControl): control is FormFieldFormControl;
|
|
60
|
-
export declare function IsNormalizedFormFieldFormControl(control: NormalizedBaseFormControl): control is NormalizedFormFieldFormControl;
|
|
61
|
-
export interface InputFormControl extends BaseFormControl, FormFieldFormControl {
|
|
62
|
-
inputType?: string;
|
|
63
|
-
placeholder?: string;
|
|
64
|
-
formField?: FormField;
|
|
65
|
-
}
|
|
66
|
-
export interface NormalizedInputFormControl extends Omit<Readonly<Normalized<InputFormControl>>, 'type' | 'importList' | 'formField'>, NormalizedBaseFormControl, NormalizedFormFieldFormControl {
|
|
67
|
-
kind: FormControlKinds.INPUT;
|
|
68
|
-
}
|
|
69
|
-
export declare function IsNormalizedInputFormControlOptions(template: NormalizedBaseFormControl): template is NormalizedInputFormControl;
|
|
70
|
-
export declare function NormalizeInputFormControl(control: InputFormControl): NormalizedInputFormControl;
|
|
71
|
-
export interface SelectFormControl extends BaseFormControl, FormFieldFormControl {
|
|
72
|
-
options?: ControlOption[];
|
|
73
|
-
backend?: BackendTypes;
|
|
74
|
-
multiple?: boolean;
|
|
75
|
-
formField?: FormField;
|
|
76
|
-
}
|
|
77
|
-
export interface NormalizedSelectFormControl extends Readonly<Normalized<Omit<SelectFormControl, 'options' | 'type' | 'importList' | 'formField'>>>, NormalizedBaseFormControl, NormalizedFormFieldFormControl {
|
|
78
|
-
kind: FormControlKinds.SELECT;
|
|
79
|
-
options: ReadonlyArray<ControlOption> | null;
|
|
80
|
-
backend: BackendTypes;
|
|
81
|
-
}
|
|
82
|
-
export declare function IsNormalizedSelectFormControl(template: NormalizedBaseFormControl): template is NormalizedSelectFormControl;
|
|
83
|
-
export declare function NormalizeSelectFormControl(control: SelectFormControl): NormalizedSelectFormControl;
|
|
84
|
-
export interface CheckboxFormControl extends BaseFormControl {
|
|
85
|
-
labelPosition?: 'before' | 'after';
|
|
86
|
-
}
|
|
87
|
-
export interface NormalizedCheckboxFormControl extends Readonly<Normalized<Omit<CheckboxFormControl, 'type' | 'importList'>>>, NormalizedBaseFormControl {
|
|
88
|
-
kind: FormControlKinds.CHECKBOX;
|
|
89
|
-
}
|
|
90
|
-
export declare function IsNormalizedCheckboxFormControl(template: NormalizedBaseFormControl): template is NormalizedCheckboxFormControl;
|
|
91
|
-
export declare function NormalizeCheckboxFormControl(control: CheckboxFormControl): NormalizedCheckboxFormControl;
|
|
92
|
-
export interface SlideToggleFormControl extends BaseFormControl {
|
|
93
|
-
labelPosition?: 'before' | 'after';
|
|
94
|
-
}
|
|
95
|
-
export interface NormalizedSlideToggleFormControl extends Readonly<Normalized<Omit<SlideToggleFormControl, 'type' | 'importList'>>>, NormalizedBaseFormControl {
|
|
96
|
-
kind: FormControlKinds.CHECKBOX;
|
|
97
|
-
}
|
|
98
|
-
export declare function IsNormalizedSlideToggleFormControl(template: NormalizedBaseFormControl): template is NormalizedSlideToggleFormControl;
|
|
99
|
-
export declare function NormalizeSlideToggleFormControl(control: SlideToggleFormControl): NormalizedSlideToggleFormControl;
|
|
100
|
-
export type TableSelectColumn = Pick<TableColumn, 'name' | 'title' | 'hasFilter' | 'kind' | 'propertyPath'> & DataProperty;
|
|
101
|
-
export type NormalizedTableSelectColumn = Pick<NormalizedTableColumn, 'name' | 'title' | 'hasFilter' | 'kind' | 'propertyPath'> & NormalizedDataProperty;
|
|
102
|
-
export declare function NormalizeTableSelectColumn(column: TableSelectColumn): NormalizedTableSelectColumn;
|
|
103
|
-
export interface TableSelectToFunction {
|
|
104
|
-
property: DataProperty;
|
|
105
|
-
}
|
|
106
|
-
export interface NormalizedTableSelectToFunction extends Readonly<Normalized<TableSelectToFunction>> {
|
|
107
|
-
property: NormalizedDataProperty;
|
|
108
|
-
}
|
|
109
|
-
export declare function NormalizeTableSelectToFunction(toFunction: TableSelectToFunction | null | undefined, columnList: TableSelectColumn[], defaultType?: string): NormalizedTableSelectToFunction;
|
|
110
|
-
export interface TableSelectFormControl extends BaseFormControl, FormFieldFormControl {
|
|
111
|
-
backend?: BackendTypes;
|
|
112
|
-
formField?: FormField;
|
|
113
|
-
title?: string;
|
|
114
|
-
propertyList?: DataProperty[];
|
|
115
|
-
columnList?: TableSelectColumn[];
|
|
116
|
-
toDisplay?: TableSelectToFunction;
|
|
117
|
-
toValue?: TableSelectToFunction;
|
|
118
|
-
upstream?: UpstreamOptions;
|
|
119
|
-
resolver?: {
|
|
120
|
-
upstream?: UpstreamOptions;
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
export interface NormalizedTableSelectFormControl extends Readonly<Normalized<Omit<TableSelectFormControl, 'type' | 'importList' | 'columnList' | 'propertyList' | 'formField'>>>, NormalizedBaseFormControl, NormalizedFormFieldFormControl {
|
|
124
|
-
kind: FormControlKinds.TABLE_SELECT;
|
|
125
|
-
backend: BackendTypes;
|
|
126
|
-
columnList: NormalizedTableSelectColumn[];
|
|
127
|
-
propertyList: Array<NormalizedDataProperty>;
|
|
128
|
-
toDisplay: NormalizedTableSelectToFunction;
|
|
129
|
-
toValue: NormalizedTableSelectToFunction;
|
|
130
|
-
upstream: NormalizedUpstreamOptions | null;
|
|
131
|
-
resolver: {
|
|
132
|
-
upstream: NormalizedUpstreamOptions | null;
|
|
133
|
-
} | null;
|
|
134
|
-
}
|
|
135
|
-
export declare function IsNormalizedTableSelectFormControl(template: NormalizedBaseFormControl): template is NormalizedTableSelectFormControl;
|
|
136
|
-
export declare function NormalizeTableSelectFormControl(control: TableSelectFormControl): NormalizedTableSelectFormControl;
|
package/src/lib/form-control.js
DELETED
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NormalizeTableSelectFormControl = exports.IsNormalizedTableSelectFormControl = exports.NormalizeTableSelectToFunction = exports.NormalizeTableSelectColumn = exports.NormalizeSlideToggleFormControl = exports.IsNormalizedSlideToggleFormControl = exports.NormalizeCheckboxFormControl = exports.IsNormalizedCheckboxFormControl = exports.NormalizeSelectFormControl = exports.IsNormalizedSelectFormControl = exports.NormalizeInputFormControl = exports.IsNormalizedInputFormControlOptions = exports.IsNormalizedFormFieldFormControl = exports.IsFormFieldFormControl = exports.NormalizeFormField = exports.NormalizeFormFieldButton = exports.NormalizeBaseFormControl = exports.FormControlKinds = void 0;
|
|
4
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
-
const ts_morph_1 = require("@rxap/ts-morph");
|
|
6
|
-
const utilities_1 = require("@rxap/utilities");
|
|
7
|
-
const path_1 = require("path");
|
|
8
|
-
const backend_types_1 = require("./backend-types");
|
|
9
|
-
const load_handlebars_template_1 = require("./load-handlebars-template");
|
|
10
|
-
const table_column_1 = require("./table-column");
|
|
11
|
-
// region BaseFormControlOptions
|
|
12
|
-
var FormControlKinds;
|
|
13
|
-
(function (FormControlKinds) {
|
|
14
|
-
FormControlKinds["DEFAULT"] = "default";
|
|
15
|
-
FormControlKinds["INPUT"] = "input";
|
|
16
|
-
FormControlKinds["SELECT"] = "select";
|
|
17
|
-
FormControlKinds["CHECKBOX"] = "checkbox";
|
|
18
|
-
FormControlKinds["SLIDE_TOGGLE"] = "slide-toggle";
|
|
19
|
-
FormControlKinds["TABLE_SELECT"] = "table-select";
|
|
20
|
-
})(FormControlKinds || (exports.FormControlKinds = FormControlKinds = {}));
|
|
21
|
-
function NormalizeBaseFormControl(control) {
|
|
22
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
23
|
-
if (!control.name) {
|
|
24
|
-
throw new schematics_1.SchematicsException('The control name is required');
|
|
25
|
-
}
|
|
26
|
-
const state = (_a = control.state) !== null && _a !== void 0 ? _a : null;
|
|
27
|
-
const isRequired = (_b = control.isRequired) !== null && _b !== void 0 ? _b : false;
|
|
28
|
-
const validatorList = (_c = control.validatorList) !== null && _c !== void 0 ? _c : [];
|
|
29
|
-
const importList = ((_d = control.importList) !== null && _d !== void 0 ? _d : []);
|
|
30
|
-
const isReadonly = (_e = control.isReadonly) !== null && _e !== void 0 ? _e : false;
|
|
31
|
-
const isDisabled = (_f = control.isDisabled) !== null && _f !== void 0 ? _f : false;
|
|
32
|
-
const kind = (_g = control.kind) !== null && _g !== void 0 ? _g : FormControlKinds.DEFAULT;
|
|
33
|
-
const template = (_h = control.template) !== null && _h !== void 0 ? _h : kind + '-form-control.hbs';
|
|
34
|
-
return Object.freeze(Object.assign(Object.assign({}, (0, ts_morph_1.NormalizeDataProperty)(control)), { isRequired,
|
|
35
|
-
state,
|
|
36
|
-
isReadonly,
|
|
37
|
-
isDisabled,
|
|
38
|
-
validatorList, importList: (0, ts_morph_1.NormalizeTypeImportList)(importList), kind,
|
|
39
|
-
template, handlebars: (0, load_handlebars_template_1.LoadHandlebarsTemplate)(template, (0, path_1.join)(__dirname, '..', 'schematics', 'form', 'templates')), label: (_j = control.label) !== null && _j !== void 0 ? _j : null }));
|
|
40
|
-
}
|
|
41
|
-
exports.NormalizeBaseFormControl = NormalizeBaseFormControl;
|
|
42
|
-
function NormalizeFormFieldButton(button) {
|
|
43
|
-
var _a, _b, _c;
|
|
44
|
-
if ((!button || Object.keys(button).length === 0)) {
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
const importList = (_a = button.importList) !== null && _a !== void 0 ? _a : [];
|
|
48
|
-
(0, utilities_1.CoerceArrayItems)(importList, [
|
|
49
|
-
{
|
|
50
|
-
name: 'MatIconModule',
|
|
51
|
-
moduleSpecifier: '@angular/material/icon',
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
name: 'MatButtonModule',
|
|
55
|
-
moduleSpecifier: '@angular/material/button',
|
|
56
|
-
}
|
|
57
|
-
], (a, b) => a.name === b.name);
|
|
58
|
-
return Object.freeze({
|
|
59
|
-
svgIcon: (_b = button.svgIcon) !== null && _b !== void 0 ? _b : null,
|
|
60
|
-
icon: (_c = button.icon) !== null && _c !== void 0 ? _c : null,
|
|
61
|
-
directiveList: (0, ts_morph_1.NormalizeTypeImportList)(button.directiveList),
|
|
62
|
-
importList: (0, ts_morph_1.NormalizeTypeImportList)(importList),
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
exports.NormalizeFormFieldButton = NormalizeFormFieldButton;
|
|
66
|
-
function NormalizeFormField(formField, importList = [], defaultFormField = {}) {
|
|
67
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
68
|
-
defaultFormField = (0, utilities_1.DeleteEmptyProperties)(defaultFormField);
|
|
69
|
-
const directiveList = (_a = defaultFormField.directiveList) !== null && _a !== void 0 ? _a : [];
|
|
70
|
-
(0, utilities_1.CoerceArrayItems)(directiveList, (_b = defaultFormField.directiveList) !== null && _b !== void 0 ? _b : [], (a, b) => a.name === b.name);
|
|
71
|
-
const normalizedFormField = {
|
|
72
|
-
label: (_d = (_c = defaultFormField.label) !== null && _c !== void 0 ? _c : formField.label) !== null && _d !== void 0 ? _d : null,
|
|
73
|
-
prefixButton: NormalizeFormFieldButton((_e = formField.prefixButton) !== null && _e !== void 0 ? _e : defaultFormField.prefixButton),
|
|
74
|
-
suffixButton: NormalizeFormFieldButton((_f = formField.suffixButton) !== null && _f !== void 0 ? _f : defaultFormField.suffixButton),
|
|
75
|
-
hasClearButton: (_h = (_g = formField.hasClearButton) !== null && _g !== void 0 ? _g : defaultFormField.hasClearButton) !== null && _h !== void 0 ? _h : true,
|
|
76
|
-
directiveList: (0, ts_morph_1.NormalizeTypeImportList)(directiveList),
|
|
77
|
-
};
|
|
78
|
-
if (normalizedFormField.hasClearButton) {
|
|
79
|
-
(_j = normalizedFormField.suffixButton) !== null && _j !== void 0 ? _j : (normalizedFormField.suffixButton = NormalizeFormFieldButton({
|
|
80
|
-
icon: 'clear',
|
|
81
|
-
directiveList: [
|
|
82
|
-
{
|
|
83
|
-
name: 'rxapInputClearButton',
|
|
84
|
-
namedImport: 'InputClearButtonDirective',
|
|
85
|
-
moduleSpecifier: '@rxap/material-form-system',
|
|
86
|
-
},
|
|
87
|
-
],
|
|
88
|
-
}));
|
|
89
|
-
}
|
|
90
|
-
(0, utilities_1.CoerceArrayItems)(importList, (_l = (_k = normalizedFormField.prefixButton) === null || _k === void 0 ? void 0 : _k.importList) !== null && _l !== void 0 ? _l : [], (a, b) => a.name === b.name && a.namedImport === b.namedImport);
|
|
91
|
-
(0, utilities_1.CoerceArrayItems)(importList, (_o = (_m = normalizedFormField.suffixButton) === null || _m === void 0 ? void 0 : _m.importList) !== null && _o !== void 0 ? _o : [], (a, b) => a.name === b.name && a.namedImport === b.namedImport);
|
|
92
|
-
(0, utilities_1.CoerceArrayItems)(importList, (_q = (_p = normalizedFormField.prefixButton) === null || _p === void 0 ? void 0 : _p.directiveList) !== null && _q !== void 0 ? _q : [], (a, b) => a.name === b.name && a.namedImport === b.namedImport);
|
|
93
|
-
(0, utilities_1.CoerceArrayItems)(importList, (_s = (_r = normalizedFormField.suffixButton) === null || _r === void 0 ? void 0 : _r.directiveList) !== null && _s !== void 0 ? _s : [], (a, b) => a.name === b.name && a.namedImport === b.namedImport);
|
|
94
|
-
return Object.freeze(normalizedFormField);
|
|
95
|
-
}
|
|
96
|
-
exports.NormalizeFormField = NormalizeFormField;
|
|
97
|
-
function IsFormFieldFormControl(control) {
|
|
98
|
-
return control.formField !== undefined;
|
|
99
|
-
}
|
|
100
|
-
exports.IsFormFieldFormControl = IsFormFieldFormControl;
|
|
101
|
-
function IsNormalizedFormFieldFormControl(control) {
|
|
102
|
-
return control.formField !== undefined;
|
|
103
|
-
}
|
|
104
|
-
exports.IsNormalizedFormFieldFormControl = IsNormalizedFormFieldFormControl;
|
|
105
|
-
function IsNormalizedInputFormControlOptions(template) {
|
|
106
|
-
return template.kind === FormControlKinds.INPUT;
|
|
107
|
-
}
|
|
108
|
-
exports.IsNormalizedInputFormControlOptions = IsNormalizedInputFormControlOptions;
|
|
109
|
-
function NormalizeInputFormControl(control) {
|
|
110
|
-
var _a, _b, _c, _d, _e;
|
|
111
|
-
const type = (0, ts_morph_1.NormalizeTypeImport)(control.type);
|
|
112
|
-
const validatorList = (_a = control.validatorList) !== null && _a !== void 0 ? _a : [];
|
|
113
|
-
const importList = (_b = control.importList) !== null && _b !== void 0 ? _b : [];
|
|
114
|
-
importList.push({
|
|
115
|
-
name: 'MatInputModule',
|
|
116
|
-
moduleSpecifier: '@angular/material/input',
|
|
117
|
-
});
|
|
118
|
-
const inputType = (_c = control.inputType) !== null && _c !== void 0 ? _c : 'text';
|
|
119
|
-
switch (inputType) {
|
|
120
|
-
case 'checkbox':
|
|
121
|
-
type.name = 'boolean';
|
|
122
|
-
break;
|
|
123
|
-
case 'text':
|
|
124
|
-
case 'password':
|
|
125
|
-
case 'color':
|
|
126
|
-
type.name = 'string';
|
|
127
|
-
break;
|
|
128
|
-
case 'email':
|
|
129
|
-
type.name = 'string';
|
|
130
|
-
(0, utilities_1.CoerceArrayItems)(validatorList, ['IsEmail()']);
|
|
131
|
-
break;
|
|
132
|
-
case 'tel':
|
|
133
|
-
type.name = 'string';
|
|
134
|
-
(0, utilities_1.CoerceArrayItems)(validatorList, ['IsTel()']);
|
|
135
|
-
break;
|
|
136
|
-
case 'url':
|
|
137
|
-
type.name = 'string';
|
|
138
|
-
(0, utilities_1.CoerceArrayItems)(validatorList, ['IsUrl()']);
|
|
139
|
-
break;
|
|
140
|
-
case 'number':
|
|
141
|
-
type.name = 'number';
|
|
142
|
-
break;
|
|
143
|
-
case 'date':
|
|
144
|
-
case 'time':
|
|
145
|
-
case 'datetime-local':
|
|
146
|
-
type.name = 'Date';
|
|
147
|
-
(0, utilities_1.CoerceArrayItems)(validatorList, ['IsDate()']);
|
|
148
|
-
break;
|
|
149
|
-
case 'file':
|
|
150
|
-
case 'hidden':
|
|
151
|
-
case 'image':
|
|
152
|
-
case 'month':
|
|
153
|
-
case 'radio':
|
|
154
|
-
case 'reset':
|
|
155
|
-
case 'button':
|
|
156
|
-
case 'search':
|
|
157
|
-
case 'submit':
|
|
158
|
-
case 'week':
|
|
159
|
-
case 'range':
|
|
160
|
-
throw new Error(`The input type "${inputType}" is not yet supported`);
|
|
161
|
-
}
|
|
162
|
-
const formField = NormalizeFormField((_d = control.formField) !== null && _d !== void 0 ? _d : {}, importList, { label: control.label });
|
|
163
|
-
// TODO : auto add validators
|
|
164
|
-
return Object.freeze(Object.assign(Object.assign({}, NormalizeBaseFormControl(control)), { type,
|
|
165
|
-
validatorList, importList: (0, ts_morph_1.NormalizeTypeImportList)(importList), kind: FormControlKinds.INPUT, inputType, placeholder: (_e = control.placeholder) !== null && _e !== void 0 ? _e : null, formField }));
|
|
166
|
-
}
|
|
167
|
-
exports.NormalizeInputFormControl = NormalizeInputFormControl;
|
|
168
|
-
function IsNormalizedSelectFormControl(template) {
|
|
169
|
-
return template.kind === FormControlKinds.SELECT;
|
|
170
|
-
}
|
|
171
|
-
exports.IsNormalizedSelectFormControl = IsNormalizedSelectFormControl;
|
|
172
|
-
function NormalizeSelectFormControl(control) {
|
|
173
|
-
var _a, _b, _c, _d;
|
|
174
|
-
const importList = (_a = control.importList) !== null && _a !== void 0 ? _a : [];
|
|
175
|
-
importList.push({
|
|
176
|
-
name: 'MatSelectModule',
|
|
177
|
-
moduleSpecifier: '@angular/material/select',
|
|
178
|
-
});
|
|
179
|
-
const formField = NormalizeFormField((_b = control.formField) !== null && _b !== void 0 ? _b : {}, importList, { label: control.label });
|
|
180
|
-
return Object.freeze(Object.assign(Object.assign({}, NormalizeBaseFormControl(control)), { importList: (0, ts_morph_1.NormalizeTypeImportList)(importList), kind: FormControlKinds.SELECT, formField, options: control.options && control.options.length ? Object.freeze(control.options) : null, backend: (_c = control.backend) !== null && _c !== void 0 ? _c : backend_types_1.BackendTypes.NONE, multiple: (_d = control.multiple) !== null && _d !== void 0 ? _d : false }));
|
|
181
|
-
}
|
|
182
|
-
exports.NormalizeSelectFormControl = NormalizeSelectFormControl;
|
|
183
|
-
function IsNormalizedCheckboxFormControl(template) {
|
|
184
|
-
return template.kind === FormControlKinds.CHECKBOX;
|
|
185
|
-
}
|
|
186
|
-
exports.IsNormalizedCheckboxFormControl = IsNormalizedCheckboxFormControl;
|
|
187
|
-
function NormalizeCheckboxFormControl(control) {
|
|
188
|
-
var _a, _b;
|
|
189
|
-
const importList = (_a = control.importList) !== null && _a !== void 0 ? _a : [];
|
|
190
|
-
importList.push({
|
|
191
|
-
name: 'MatCheckboxModule',
|
|
192
|
-
moduleSpecifier: '@angular/material/checkbox',
|
|
193
|
-
});
|
|
194
|
-
return Object.freeze(Object.assign(Object.assign({}, NormalizeBaseFormControl(control)), { importList: (0, ts_morph_1.NormalizeTypeImportList)(importList), kind: FormControlKinds.CHECKBOX, labelPosition: (_b = control.labelPosition) !== null && _b !== void 0 ? _b : 'after' }));
|
|
195
|
-
}
|
|
196
|
-
exports.NormalizeCheckboxFormControl = NormalizeCheckboxFormControl;
|
|
197
|
-
function IsNormalizedSlideToggleFormControl(template) {
|
|
198
|
-
return template.kind === FormControlKinds.CHECKBOX;
|
|
199
|
-
}
|
|
200
|
-
exports.IsNormalizedSlideToggleFormControl = IsNormalizedSlideToggleFormControl;
|
|
201
|
-
function NormalizeSlideToggleFormControl(control) {
|
|
202
|
-
var _a;
|
|
203
|
-
return Object.freeze(Object.assign(Object.assign({}, NormalizeBaseFormControl(control)), { kind: FormControlKinds.CHECKBOX, labelPosition: (_a = control.labelPosition) !== null && _a !== void 0 ? _a : 'after' }));
|
|
204
|
-
}
|
|
205
|
-
exports.NormalizeSlideToggleFormControl = NormalizeSlideToggleFormControl;
|
|
206
|
-
function NormalizeTableSelectColumn(column) {
|
|
207
|
-
var _a, _b, _c, _d;
|
|
208
|
-
const { name, propertyPath } = (0, table_column_1.TableColumnNameToPropertyPath)(column.name, column.propertyPath);
|
|
209
|
-
const kind = (_a = column.kind) !== null && _a !== void 0 ? _a : table_column_1.TableColumnKind.DEFAULT;
|
|
210
|
-
const type = (0, table_column_1.GuessColumnTypeType)(kind, (_b = column.type) !== null && _b !== void 0 ? _b : 'unknown');
|
|
211
|
-
return Object.freeze(Object.assign(Object.assign({}, (0, ts_morph_1.NormalizeDataProperty)(Object.assign(Object.assign({}, column), { name,
|
|
212
|
-
type }))), { title: (_c = column.title) !== null && _c !== void 0 ? _c : (0, utilities_1.dasherize)(name).split('-').map(part => (0, utilities_1.capitalize)(part)).join(' '), hasFilter: (_d = column.hasFilter) !== null && _d !== void 0 ? _d : false, kind,
|
|
213
|
-
propertyPath }));
|
|
214
|
-
}
|
|
215
|
-
exports.NormalizeTableSelectColumn = NormalizeTableSelectColumn;
|
|
216
|
-
function NormalizeTableSelectToFunction(toFunction, columnList, defaultType = 'unknown') {
|
|
217
|
-
if (!toFunction || Object.keys(toFunction).length === 0) {
|
|
218
|
-
return Object.freeze({
|
|
219
|
-
property: (0, ts_morph_1.NormalizeDataProperty)(columnList[0].name, defaultType),
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
return Object.freeze({
|
|
223
|
-
property: (0, ts_morph_1.NormalizeDataProperty)(toFunction.property, defaultType),
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
exports.NormalizeTableSelectToFunction = NormalizeTableSelectToFunction;
|
|
227
|
-
function IsNormalizedTableSelectFormControl(template) {
|
|
228
|
-
return template.kind === FormControlKinds.TABLE_SELECT;
|
|
229
|
-
}
|
|
230
|
-
exports.IsNormalizedTableSelectFormControl = IsNormalizedTableSelectFormControl;
|
|
231
|
-
function NormalizeTableSelectFormControl(control) {
|
|
232
|
-
var _a, _b, _c, _d, _e, _f;
|
|
233
|
-
const importList = (_a = control.importList) !== null && _a !== void 0 ? _a : [];
|
|
234
|
-
importList.push({
|
|
235
|
-
name: 'TableSelectControlModule',
|
|
236
|
-
moduleSpecifier: '@digitaix/eurogard-table-select',
|
|
237
|
-
});
|
|
238
|
-
if (!((_b = control.columnList) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
239
|
-
throw new Error('The column list must not be empty');
|
|
240
|
-
}
|
|
241
|
-
const propertyList = (0, ts_morph_1.NormalizeDataPropertyList)(control.propertyList);
|
|
242
|
-
const toDisplay = NormalizeTableSelectToFunction(control.toDisplay, control.columnList, 'string');
|
|
243
|
-
const toValue = NormalizeTableSelectToFunction(control.toValue, control.columnList);
|
|
244
|
-
(0, utilities_1.CoerceArrayItems)(propertyList, [toDisplay.property, toValue.property], (a, b) => a.name === b.name);
|
|
245
|
-
const formField = NormalizeFormField((_c = control.formField) !== null && _c !== void 0 ? _c : {}, importList, {
|
|
246
|
-
label: control.label,
|
|
247
|
-
directiveList: [
|
|
248
|
-
{
|
|
249
|
-
name: 'eurogardTableSelectControl',
|
|
250
|
-
namedImport: 'TableSelectControlModule',
|
|
251
|
-
moduleSpecifier: '@digitaix/eurogard-table-select',
|
|
252
|
-
},
|
|
253
|
-
]
|
|
254
|
-
});
|
|
255
|
-
const columnList = control.columnList.map(NormalizeTableSelectColumn);
|
|
256
|
-
(0, utilities_1.CoerceArrayItems)(propertyList, columnList, (a, b) => a.name === b.name);
|
|
257
|
-
(_d = control.type) !== null && _d !== void 0 ? _d : (control.type = toValue.property.type);
|
|
258
|
-
return Object.freeze(Object.assign(Object.assign({}, NormalizeBaseFormControl(control)), { resolver: control.resolver ? { upstream: (0, ts_morph_1.NormalizeUpstreamOptions)(control.resolver.upstream) } : null, importList: (0, ts_morph_1.NormalizeTypeImportList)(importList), kind: FormControlKinds.TABLE_SELECT, formField, backend: (_e = control.backend) !== null && _e !== void 0 ? _e : backend_types_1.BackendTypes.NONE, title: (_f = control.title) !== null && _f !== void 0 ? _f : null, columnList,
|
|
259
|
-
toDisplay,
|
|
260
|
-
toValue,
|
|
261
|
-
propertyList, upstream: (0, ts_morph_1.NormalizeUpstreamOptions)(control.upstream) }));
|
|
262
|
-
}
|
|
263
|
-
exports.NormalizeTableSelectFormControl = NormalizeTableSelectFormControl;
|
|
264
|
-
// endregion
|
|
265
|
-
//# sourceMappingURL=form-control.js.map
|