@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,320 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NormalizeDataGridComponentOptions = void 0;
|
|
4
|
+
const core_1 = require("@angular-devkit/core");
|
|
5
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
|
+
const schematics_ts_morph_1 = require("@rxap/schematics-ts-morph");
|
|
7
|
+
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const ts_morph_1 = require("ts-morph");
|
|
10
|
+
const angular_options_1 = require("../../lib/angular-options");
|
|
11
|
+
const backend_types_1 = require("../../lib/backend-types");
|
|
12
|
+
const data_grid_options_1 = require("../../lib/data-grid-options");
|
|
13
|
+
const form_definition_control_1 = require("../../lib/form-definition-control");
|
|
14
|
+
function NormalizeDataGridComponentOptions(options) {
|
|
15
|
+
const normalizedAngularOptions = (0, angular_options_1.NormalizeAngularOptions)(options);
|
|
16
|
+
const normalizedDataGridOptions = (0, data_grid_options_1.NormalizeDataGridOptions)(options);
|
|
17
|
+
(0, angular_options_1.AssertAngularOptionsNameProperty)(normalizedAngularOptions);
|
|
18
|
+
const { name, directory, } = normalizedAngularOptions;
|
|
19
|
+
const componentName = (0, schematics_utilities_1.CoerceSuffix)((0, schematics_utilities_1.dasherize)(name), '-data-grid');
|
|
20
|
+
return Object.seal(Object.assign(Object.assign(Object.assign({}, normalizedAngularOptions), normalizedDataGridOptions), { directory: (0, path_1.join)(directory !== null && directory !== void 0 ? directory : '', componentName), componentName, nestController: componentName, dataSourceClassName: (0, schematics_utilities_1.CoerceSuffix)((0, schematics_utilities_1.classify)(name), 'DataGridDataSource'), dataSourceFileName: (0, schematics_utilities_1.CoerceSuffix)(name, '-data-grid.data-source') }));
|
|
21
|
+
}
|
|
22
|
+
exports.NormalizeDataGridComponentOptions = NormalizeDataGridComponentOptions;
|
|
23
|
+
function getControllerName(normalizedOptions) {
|
|
24
|
+
const { componentName, nestModule, } = normalizedOptions;
|
|
25
|
+
return (0, schematics_ts_morph_1.BuildNestControllerName)({
|
|
26
|
+
controllerName: componentName,
|
|
27
|
+
nestModule,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function componentRule(normalizedOptions) {
|
|
31
|
+
const { project, feature, directory, mode, componentName, overwrite, } = normalizedOptions;
|
|
32
|
+
const templateOptions = Object.assign(Object.assign({}, core_1.strings), normalizedOptions);
|
|
33
|
+
return (0, schematics_1.chain)([
|
|
34
|
+
() => console.log('Coerce data source component ...'),
|
|
35
|
+
(0, schematics_ts_morph_1.CoerceComponentRule)({
|
|
36
|
+
project,
|
|
37
|
+
feature,
|
|
38
|
+
name: componentName,
|
|
39
|
+
directory,
|
|
40
|
+
overwrite,
|
|
41
|
+
template: {
|
|
42
|
+
url: `./files/${mode}`,
|
|
43
|
+
options: templateOptions,
|
|
44
|
+
},
|
|
45
|
+
}),
|
|
46
|
+
]);
|
|
47
|
+
}
|
|
48
|
+
function nestjsFormModeRule(normalizedOptions) {
|
|
49
|
+
const { project, feature, nestModule, name, componentName, directory, shared, itemList, collection, scope, } = normalizedOptions;
|
|
50
|
+
const controllerName = getControllerName(normalizedOptions);
|
|
51
|
+
const submitOperationId = (0, schematics_ts_morph_1.buildOperationId)(normalizedOptions, 'submit', controllerName);
|
|
52
|
+
const dataGridDtoClassName = (0, schematics_utilities_1.CoerceSuffix)((0, schematics_utilities_1.classify)([nestModule, componentName].filter(Boolean).join('-')), 'DataGridDtoResponse');
|
|
53
|
+
return (0, schematics_1.chain)([
|
|
54
|
+
() => console.log('Coerce form provider rule for the data grid data source submit method ...'),
|
|
55
|
+
(0, schematics_ts_morph_1.CoerceFormProviderRule)({
|
|
56
|
+
project,
|
|
57
|
+
feature,
|
|
58
|
+
directory,
|
|
59
|
+
providerObject: {
|
|
60
|
+
provide: 'RXAP_FORM_SUBMIT_METHOD',
|
|
61
|
+
useFactory: 'SubmitContextFormAdapterFactory',
|
|
62
|
+
deps: [
|
|
63
|
+
(0, schematics_ts_morph_1.OperationIdToClassName)(submitOperationId),
|
|
64
|
+
'[ new Optional(), RXAP_FORM_CONTEXT ]',
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
importStructures: [
|
|
68
|
+
{
|
|
69
|
+
namedImports: ['Optional'],
|
|
70
|
+
moduleSpecifier: '@angular/core',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
namedImports: [
|
|
74
|
+
'RXAP_FORM_SUBMIT_METHOD',
|
|
75
|
+
'RXAP_FORM_CONTEXT',
|
|
76
|
+
],
|
|
77
|
+
moduleSpecifier: '@rxap/forms',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
namedImports: ['SubmitContextFormAdapterFactory'],
|
|
81
|
+
moduleSpecifier: '@rxap/form-system',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
namedImports: [(0, schematics_ts_morph_1.OperationIdToClassName)(submitOperationId)],
|
|
85
|
+
moduleSpecifier: (0, schematics_ts_morph_1.OperationIdToClassImportPath)(submitOperationId, scope),
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
}),
|
|
89
|
+
(0, schematics_ts_morph_1.CoerceFormDefinitionTypeRule)({
|
|
90
|
+
project,
|
|
91
|
+
feature,
|
|
92
|
+
directory,
|
|
93
|
+
name,
|
|
94
|
+
coerceFormType: (sourceFile, classDeclaration, formTypeName) => {
|
|
95
|
+
var _a;
|
|
96
|
+
const typeAliasDeclaration = (_a = sourceFile.getTypeAlias(formTypeName)) !== null && _a !== void 0 ? _a : sourceFile.addTypeAlias({
|
|
97
|
+
name: formTypeName,
|
|
98
|
+
type: 'unknown',
|
|
99
|
+
});
|
|
100
|
+
typeAliasDeclaration.setIsExported(true);
|
|
101
|
+
typeAliasDeclaration.setType(dataGridDtoClassName);
|
|
102
|
+
(0, schematics_ts_morph_1.CoerceImports)(sourceFile, {
|
|
103
|
+
namedImports: [dataGridDtoClassName],
|
|
104
|
+
moduleSpecifier: (0, schematics_ts_morph_1.OpenApiResponseClassImportPath)(dataGridDtoClassName, (0, schematics_ts_morph_1.buildNestProjectName)(normalizedOptions), scope),
|
|
105
|
+
});
|
|
106
|
+
},
|
|
107
|
+
}),
|
|
108
|
+
() => console.log('Coerce submit operation for the data grid data source ...'),
|
|
109
|
+
(0, schematics_ts_morph_1.CoerceSubmitDataGridOperation)({
|
|
110
|
+
controllerName: name,
|
|
111
|
+
nestModule,
|
|
112
|
+
project,
|
|
113
|
+
feature,
|
|
114
|
+
shared,
|
|
115
|
+
propertyList: itemList
|
|
116
|
+
.map(item => ({
|
|
117
|
+
name: item.name,
|
|
118
|
+
type: item.type,
|
|
119
|
+
})),
|
|
120
|
+
skipCoerce: true,
|
|
121
|
+
collection,
|
|
122
|
+
}),
|
|
123
|
+
]);
|
|
124
|
+
}
|
|
125
|
+
function nestjsModeRule(normalizedOptions) {
|
|
126
|
+
const { mode } = normalizedOptions;
|
|
127
|
+
switch (mode) {
|
|
128
|
+
case data_grid_options_1.DataGridMode.Form:
|
|
129
|
+
return nestjsFormModeRule(normalizedOptions);
|
|
130
|
+
}
|
|
131
|
+
return (0, schematics_1.noop)();
|
|
132
|
+
}
|
|
133
|
+
function nestjsBackendRule(normalizedOptions) {
|
|
134
|
+
const { project, feature, collection, shared, nestModule, name, itemList, directory, scope, } = normalizedOptions;
|
|
135
|
+
const controllerName = getControllerName(normalizedOptions);
|
|
136
|
+
const getOperationId = (0, schematics_ts_morph_1.buildOperationId)(normalizedOptions, 'get', controllerName);
|
|
137
|
+
return (0, schematics_1.chain)([
|
|
138
|
+
() => console.log('Coerce get operation for the data grid data source ...'),
|
|
139
|
+
(0, schematics_ts_morph_1.CoerceGetDataGridOperation)({
|
|
140
|
+
project,
|
|
141
|
+
feature,
|
|
142
|
+
shared,
|
|
143
|
+
nestModule,
|
|
144
|
+
collection,
|
|
145
|
+
controllerName: name,
|
|
146
|
+
propertyList: itemList
|
|
147
|
+
.map((item) => ({
|
|
148
|
+
name: item.name,
|
|
149
|
+
type: item.type,
|
|
150
|
+
})),
|
|
151
|
+
}),
|
|
152
|
+
() => console.log('Coerce data grid data source class'),
|
|
153
|
+
(0, schematics_ts_morph_1.CoerceDataSourceClass)({
|
|
154
|
+
project,
|
|
155
|
+
feature,
|
|
156
|
+
shared,
|
|
157
|
+
directory,
|
|
158
|
+
name: (0, schematics_utilities_1.CoerceSuffix)(name, '-data-grid'),
|
|
159
|
+
tsMorphTransform: (project, sourceFile, classDeclaration) => {
|
|
160
|
+
classDeclaration.setExtends(`DataGridDataSource<${(0, schematics_ts_morph_1.OperationIdToResponseClassName)(getOperationId)}>`);
|
|
161
|
+
(0, schematics_ts_morph_1.CoerceImports)(sourceFile, {
|
|
162
|
+
namedImports: [(0, schematics_ts_morph_1.OperationIdToResponseClassName)(getOperationId)],
|
|
163
|
+
moduleSpecifier: (0, schematics_ts_morph_1.OperationIdToResponseClassImportPath)(getOperationId, scope),
|
|
164
|
+
});
|
|
165
|
+
(0, schematics_ts_morph_1.CoerceImports)(sourceFile, {
|
|
166
|
+
namedImports: [(0, schematics_ts_morph_1.OperationIdToClassName)(getOperationId)],
|
|
167
|
+
moduleSpecifier: (0, schematics_ts_morph_1.OperationIdToClassImportPath)(getOperationId, scope),
|
|
168
|
+
});
|
|
169
|
+
(0, schematics_ts_morph_1.CoerceImports)(sourceFile, {
|
|
170
|
+
namedImports: ['DataGridDataSource'],
|
|
171
|
+
moduleSpecifier: '@rxap/data-grid',
|
|
172
|
+
});
|
|
173
|
+
const [constructorDeclaration] = (0, schematics_ts_morph_1.CoerceClassConstructor)(classDeclaration);
|
|
174
|
+
(0, schematics_ts_morph_1.CoerceParameterDeclaration)(constructorDeclaration, 'method').set({
|
|
175
|
+
type: (0, schematics_ts_morph_1.OperationIdToClassName)(getOperationId),
|
|
176
|
+
});
|
|
177
|
+
(0, schematics_ts_morph_1.CoerceStatements)(constructorDeclaration, [`super(method);`]);
|
|
178
|
+
},
|
|
179
|
+
}),
|
|
180
|
+
nestjsModeRule(normalizedOptions),
|
|
181
|
+
]);
|
|
182
|
+
}
|
|
183
|
+
function localBackendRule(normalizedOptions) {
|
|
184
|
+
const { project, feature, shared, directory, name, collection, } = normalizedOptions;
|
|
185
|
+
return (0, schematics_1.chain)([
|
|
186
|
+
() => console.log('Coerce data grid data source class'),
|
|
187
|
+
(0, schematics_ts_morph_1.CoerceDataSourceClass)({
|
|
188
|
+
project,
|
|
189
|
+
feature,
|
|
190
|
+
shared,
|
|
191
|
+
directory,
|
|
192
|
+
decorator: {
|
|
193
|
+
name: 'RxapStaticDataSource',
|
|
194
|
+
moduleSpecifier: '@rxap/data-source',
|
|
195
|
+
argument: ts_morph_1.Writers.object({
|
|
196
|
+
id: w => w.quote(name),
|
|
197
|
+
data: collection ? '[]' : '{}',
|
|
198
|
+
}),
|
|
199
|
+
},
|
|
200
|
+
extends: {
|
|
201
|
+
name: 'StaticDataSource',
|
|
202
|
+
moduleSpecifier: '@rxap/data-source',
|
|
203
|
+
},
|
|
204
|
+
name: (0, schematics_utilities_1.CoerceSuffix)(name, '-data-grid'),
|
|
205
|
+
}),
|
|
206
|
+
]);
|
|
207
|
+
}
|
|
208
|
+
function backendRule(normalizedOptions) {
|
|
209
|
+
const { backend } = normalizedOptions;
|
|
210
|
+
switch (backend) {
|
|
211
|
+
case backend_types_1.BackendTypes.NESTJS:
|
|
212
|
+
return nestjsBackendRule(normalizedOptions);
|
|
213
|
+
case backend_types_1.BackendTypes.LOCAL:
|
|
214
|
+
return localBackendRule(normalizedOptions);
|
|
215
|
+
}
|
|
216
|
+
return (0, schematics_1.noop)();
|
|
217
|
+
}
|
|
218
|
+
function formModeRule(normalizedOptions) {
|
|
219
|
+
const { project, feature, directory, name, itemList, dataSourceClassName, dataSourceFileName, componentName, overwrite, } = normalizedOptions;
|
|
220
|
+
return (0, schematics_1.chain)([
|
|
221
|
+
() => console.log('Coerce form definition ...'),
|
|
222
|
+
(0, schematics_ts_morph_1.CoerceFormDefinition)({
|
|
223
|
+
name,
|
|
224
|
+
project,
|
|
225
|
+
feature,
|
|
226
|
+
directory,
|
|
227
|
+
controlList: itemList
|
|
228
|
+
.map(item => ({
|
|
229
|
+
name: item.name,
|
|
230
|
+
type: item.type,
|
|
231
|
+
}))
|
|
232
|
+
.map((item) => (0, form_definition_control_1.NormalizeFormDefinitionControl)(item)),
|
|
233
|
+
}),
|
|
234
|
+
() => console.log('Coerce form providers ...'),
|
|
235
|
+
(0, schematics_ts_morph_1.CoerceFormProvidersFile)({
|
|
236
|
+
name,
|
|
237
|
+
project,
|
|
238
|
+
feature,
|
|
239
|
+
directory,
|
|
240
|
+
}),
|
|
241
|
+
() => console.log('Coerce form provider rule for the data grid data source refresh after submit ...'),
|
|
242
|
+
(0, schematics_ts_morph_1.CoerceFormProviderRule)({
|
|
243
|
+
project,
|
|
244
|
+
feature,
|
|
245
|
+
directory,
|
|
246
|
+
providerObject: {
|
|
247
|
+
provide: 'RXAP_FORM_SUBMIT_SUCCESSFUL_METHOD',
|
|
248
|
+
useFactory: 'DataSourceRefreshToMethodAdapterFactory',
|
|
249
|
+
deps: [dataSourceClassName],
|
|
250
|
+
},
|
|
251
|
+
importStructures: [
|
|
252
|
+
{
|
|
253
|
+
namedImports: ['RXAP_FORM_SUBMIT_SUCCESSFUL_METHOD'],
|
|
254
|
+
moduleSpecifier: '@rxap/forms',
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
namedImports: ['DataSourceRefreshToMethodAdapterFactory'],
|
|
258
|
+
moduleSpecifier: '@rxap/data-source',
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
namedImports: [dataSourceClassName],
|
|
262
|
+
moduleSpecifier: `./${dataSourceFileName}`,
|
|
263
|
+
},
|
|
264
|
+
],
|
|
265
|
+
}),
|
|
266
|
+
() => console.log('Add Component imports ...'),
|
|
267
|
+
(0, schematics_ts_morph_1.CoerceComponentRule)({
|
|
268
|
+
project,
|
|
269
|
+
feature,
|
|
270
|
+
name: componentName,
|
|
271
|
+
directory,
|
|
272
|
+
overwrite,
|
|
273
|
+
tsMorphTransform: (project, [sourceFile], [classDeclaration]) => {
|
|
274
|
+
for (const item of itemList) {
|
|
275
|
+
switch (item.type) {
|
|
276
|
+
case 'boolean':
|
|
277
|
+
(0, schematics_ts_morph_1.AddComponentImport)(sourceFile, 'MatSlideToggleModule', '@angular/material/slide-toggle');
|
|
278
|
+
break;
|
|
279
|
+
case 'number':
|
|
280
|
+
(0, schematics_ts_morph_1.AddComponentImport)(sourceFile, 'MatInputModule', '@angular/material/input');
|
|
281
|
+
break;
|
|
282
|
+
case 'string':
|
|
283
|
+
(0, schematics_ts_morph_1.AddComponentImport)(sourceFile, 'MatInputModule', '@angular/material/input');
|
|
284
|
+
break;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
}),
|
|
289
|
+
]);
|
|
290
|
+
}
|
|
291
|
+
function modeRule(normalizedOptions) {
|
|
292
|
+
const { mode } = normalizedOptions;
|
|
293
|
+
switch (mode) {
|
|
294
|
+
case data_grid_options_1.DataGridMode.Form:
|
|
295
|
+
return formModeRule(normalizedOptions);
|
|
296
|
+
}
|
|
297
|
+
return (0, schematics_1.noop)();
|
|
298
|
+
}
|
|
299
|
+
function printOptions(options) {
|
|
300
|
+
(0, angular_options_1.PrintAngularOptions)('data-grid-component', options);
|
|
301
|
+
if (options.itemList.length) {
|
|
302
|
+
console.log(`=== items: \x1b[34m${options.itemList.map((item) => item.name).join(', ')}\x1b[0m`);
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
console.log('=== items: \x1b[31mempty\x1b[0m');
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
function default_1(options) {
|
|
309
|
+
const normalizedOptions = NormalizeDataGridComponentOptions(options);
|
|
310
|
+
printOptions(normalizedOptions);
|
|
311
|
+
return () => {
|
|
312
|
+
return (0, schematics_1.chain)([
|
|
313
|
+
componentRule(normalizedOptions),
|
|
314
|
+
modeRule(normalizedOptions),
|
|
315
|
+
backendRule(normalizedOptions),
|
|
316
|
+
]);
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
exports.default = default_1;
|
|
320
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/angular/src/schematics/data-grid-component/index.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAC/C,2DAIoC;AACpC,mEAsBmC;AACnC,qEAIoC;AA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AC;IACrE,YAAY,CAAC,iBAAiB,CAAC,CAAC;IAChC,OAAO,GAAG,EAAE;QACV,OAAO,IAAA,kBAAK,EAAC;YACX,aAAa,CAAC,iBAAiB,CAAC;YAChC,QAAQ,CAAC,iBAAiB,CAAC;YAC3B,WAAW,CAAC,iBAAiB,CAAC;SAC/B,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAVD,4BAUC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "data-grid-component",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"name": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"description": "The name of the form definition",
|
|
9
|
+
"x-prompt": "Which name should the form definition have?"
|
|
10
|
+
},
|
|
11
|
+
"project": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"description": "The target project where the accordion module should be added.",
|
|
14
|
+
"x-prompt": "To which project should the accordion module be added?"
|
|
15
|
+
},
|
|
16
|
+
"directory": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"description": "Relative path to the directory where the form definition should be created."
|
|
19
|
+
},
|
|
20
|
+
"feature": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"description": "The feature name where the accordion module should be added.",
|
|
23
|
+
"x-prompt": "To which feature should the accordion module be added?"
|
|
24
|
+
},
|
|
25
|
+
"backend": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"description": "The backend that should be used to handel data",
|
|
28
|
+
"enum": [
|
|
29
|
+
"none",
|
|
30
|
+
"local",
|
|
31
|
+
"nestjs"
|
|
32
|
+
],
|
|
33
|
+
"default": "none"
|
|
34
|
+
},
|
|
35
|
+
"mode": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"description": "The mode of the form",
|
|
38
|
+
"enum": [
|
|
39
|
+
"form",
|
|
40
|
+
"plain"
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
"collection": {
|
|
44
|
+
"type": "boolean",
|
|
45
|
+
"description": "Whether the data grid is used as collection."
|
|
46
|
+
},
|
|
47
|
+
"nestModule": {
|
|
48
|
+
"type": "string",
|
|
49
|
+
"description": "The name of the nest module where the form definition should be created."
|
|
50
|
+
},
|
|
51
|
+
"overwrite": {
|
|
52
|
+
"type": "boolean",
|
|
53
|
+
"default": false,
|
|
54
|
+
"description": "Whether to overwrite existing files"
|
|
55
|
+
},
|
|
56
|
+
"title": {
|
|
57
|
+
"type": "string",
|
|
58
|
+
"description": "The title of the data grid card component"
|
|
59
|
+
},
|
|
60
|
+
"subtitle": {
|
|
61
|
+
"type": "string",
|
|
62
|
+
"description": "The subtitle of the data grid card component"
|
|
63
|
+
},
|
|
64
|
+
"itemList": {
|
|
65
|
+
"alias": "item",
|
|
66
|
+
"anyOf": [
|
|
67
|
+
{
|
|
68
|
+
"type": "array",
|
|
69
|
+
"items": {
|
|
70
|
+
"type": "object",
|
|
71
|
+
"properties": {
|
|
72
|
+
"name": {
|
|
73
|
+
"type": "string",
|
|
74
|
+
"description": "The name of the control"
|
|
75
|
+
},
|
|
76
|
+
"header": {
|
|
77
|
+
"type": "string",
|
|
78
|
+
"description": "The name of the control"
|
|
79
|
+
},
|
|
80
|
+
"type": {
|
|
81
|
+
"type": "string",
|
|
82
|
+
"description": "The type of the control",
|
|
83
|
+
"enum": [
|
|
84
|
+
"string",
|
|
85
|
+
"number",
|
|
86
|
+
"boolean"
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"required": [
|
|
91
|
+
"name"
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"type": "array",
|
|
97
|
+
"items": {
|
|
98
|
+
"type": "string"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"type": "array"
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"required": [
|
|
108
|
+
"project",
|
|
109
|
+
"feature",
|
|
110
|
+
"name"
|
|
111
|
+
]
|
|
112
|
+
}
|
package/src/schematics/dialog-component/files/component/__componentName__.component.html.template
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<h2 mat-dialog-title i18n><%= title %></h2>
|
|
2
|
+
<mat-dialog-content>
|
|
3
|
+
|
|
4
|
+
<div fxLayout="column">
|
|
5
|
+
|
|
6
|
+
<mat-progress-bar *ngIf="loading$ | async" class="progress-bar" mode="indeterminate"></mat-progress-bar>
|
|
7
|
+
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
</mat-dialog-content>
|
|
11
|
+
<mat-dialog-actions>
|
|
12
|
+
<% for (const action of actionList) { %>
|
|
13
|
+
<% if (action.role === 'close') { %>
|
|
14
|
+
<button mat-button mat-dialog-close>
|
|
15
|
+
<ng-container i18n><%= action.label %></ng-container>
|
|
16
|
+
</button>
|
|
17
|
+
<% } else { %>
|
|
18
|
+
<button mat-raised-button color="<% if (action.color) { %><%= action.color %><% } else { %>primary<% } %>" [disabled]="(invalid$ | async) || (loading$ | async)" (click)="submit()">
|
|
19
|
+
<ng-container i18n><%= action.label %></ng-container>
|
|
20
|
+
</button>
|
|
21
|
+
<% } %>
|
|
22
|
+
<% } %>
|
|
23
|
+
</mat-dialog-actions>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
4
|
+
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const schematics_ts_morph_1 = require("@rxap/schematics-ts-morph");
|
|
7
|
+
const angular_options_1 = require("../../lib/angular-options");
|
|
8
|
+
const to_title_1 = require("../../lib/to-title");
|
|
9
|
+
const dialog_action_1 = require("../../lib/dialog-action");
|
|
10
|
+
function NormalizeOptions(options) {
|
|
11
|
+
var _a;
|
|
12
|
+
const normalizedAngularOptions = (0, angular_options_1.NormalizeAngularOptions)(options);
|
|
13
|
+
const { directory } = normalizedAngularOptions;
|
|
14
|
+
const dialogName = (0, schematics_utilities_1.CoerceSuffix)((0, schematics_utilities_1.dasherize)(options.dialogName), '-dialog');
|
|
15
|
+
const title = (_a = options.title) !== null && _a !== void 0 ? _a : (0, to_title_1.ToTitle)(dialogName);
|
|
16
|
+
return Object.seal(Object.assign(Object.assign({}, normalizedAngularOptions), { directory: (0, path_1.join)(directory !== null && directory !== void 0 ? directory : '', dialogName), dialogName,
|
|
17
|
+
title, actionList: (0, dialog_action_1.NormalizeDialogActionList)(options.actionList) }));
|
|
18
|
+
}
|
|
19
|
+
function printDialogComponentOptions(options) {
|
|
20
|
+
(0, angular_options_1.PrintAngularOptions)('dialog-component', options);
|
|
21
|
+
}
|
|
22
|
+
function default_1(options) {
|
|
23
|
+
const normalizedOptions = NormalizeOptions(options);
|
|
24
|
+
const { overwrite, project, feature, dialogName, directory, } = normalizedOptions;
|
|
25
|
+
printDialogComponentOptions(normalizedOptions);
|
|
26
|
+
return function () {
|
|
27
|
+
return (0, schematics_1.chain)([
|
|
28
|
+
() => console.log('Coerce dialog component ...'),
|
|
29
|
+
(0, schematics_ts_morph_1.CoerceDialogComponentRule)({
|
|
30
|
+
project,
|
|
31
|
+
dialogName,
|
|
32
|
+
feature,
|
|
33
|
+
directory,
|
|
34
|
+
overwrite,
|
|
35
|
+
template: {
|
|
36
|
+
options: normalizedOptions,
|
|
37
|
+
},
|
|
38
|
+
}),
|
|
39
|
+
]);
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
exports.default = default_1;
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/angular/src/schematics/dialog-component/index.ts"],"names":[],"mappings":";;AACA,2DAAmD;AACnD,qEAGoC;AACpC,+BAA4B;AA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ACF,CAAC;SACH,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAzBD,4BAyBC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AngularOptions } from '../../lib/angular-options';
|
|
2
|
+
import { DialogAction } from '../../lib/dialog-action';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export interface DialogComponentOptions extends AngularOptions {
|
|
6
|
+
dialogName: string;
|
|
7
|
+
title?: string;
|
|
8
|
+
actionList?: Array<string | DialogAction>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "dialog-module",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"dialogName": {
|
|
7
|
+
"alias": "name",
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The name of the dialog",
|
|
10
|
+
"x-prompt": "Which name should the dialog module have?"
|
|
11
|
+
},
|
|
12
|
+
"project": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"description": "The target project where the dialog module should be added.",
|
|
15
|
+
"x-prompt": "To which project should the dialog module be added?"
|
|
16
|
+
},
|
|
17
|
+
"directory": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"description": "The directory where the dialog module should be added."
|
|
20
|
+
},
|
|
21
|
+
"feature": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "The feature name where the dialog module should be added.",
|
|
24
|
+
"x-prompt": "To which feature should the dialog module be added?"
|
|
25
|
+
},
|
|
26
|
+
"overwrite": {
|
|
27
|
+
"type": "boolean",
|
|
28
|
+
"default": false,
|
|
29
|
+
"description": "Whether to overwrite existing files"
|
|
30
|
+
},
|
|
31
|
+
"title": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"description": "The title of the dialog"
|
|
34
|
+
},
|
|
35
|
+
"actionList": {
|
|
36
|
+
"alias": "action",
|
|
37
|
+
"type": "array",
|
|
38
|
+
"description": "The list of actions to be added to the dialog",
|
|
39
|
+
"items": {
|
|
40
|
+
"oneOf": [
|
|
41
|
+
{
|
|
42
|
+
"type": "string"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"type": "object",
|
|
46
|
+
"properties": {
|
|
47
|
+
"label": {
|
|
48
|
+
"type": "string"
|
|
49
|
+
},
|
|
50
|
+
"color": {
|
|
51
|
+
"type": "string"
|
|
52
|
+
},
|
|
53
|
+
"role": {
|
|
54
|
+
"type": "string",
|
|
55
|
+
"enum": [
|
|
56
|
+
"submit",
|
|
57
|
+
"close"
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"required": [
|
|
67
|
+
"dialogName",
|
|
68
|
+
"project",
|
|
69
|
+
"feature"
|
|
70
|
+
]
|
|
71
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { InputFormControlOptions } from './schema';
|
|
2
|
+
import { NormalizedFormControlOptions } from '../../form-control';
|
|
3
|
+
import { Normalized } from '@rxap/utilities';
|
|
4
|
+
export declare function GuessInputType(type: string): string;
|
|
5
|
+
export type NormalizedInputFormControlOptions = Readonly<Normalized<InputFormControlOptions> & NormalizedFormControlOptions>;
|
|
6
|
+
export declare function NormalizeInputFormControlOptions(options: InputFormControlOptions): NormalizedInputFormControlOptions;
|
|
7
|
+
export default function (options: InputFormControlOptions): () => import("@angular-devkit/schematics").Rule;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NormalizeInputFormControlOptions = exports.GuessInputType = void 0;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const form_control_1 = require("../../form-control");
|
|
6
|
+
const angular_options_1 = require("../../../../lib/angular-options");
|
|
7
|
+
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
8
|
+
function GuessInputType(type) {
|
|
9
|
+
switch (type) {
|
|
10
|
+
case 'boolean':
|
|
11
|
+
return 'checkbox';
|
|
12
|
+
case 'number':
|
|
13
|
+
return 'number';
|
|
14
|
+
case 'date':
|
|
15
|
+
return 'date';
|
|
16
|
+
case 'string':
|
|
17
|
+
default:
|
|
18
|
+
return 'text';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.GuessInputType = GuessInputType;
|
|
22
|
+
function NormalizeInputFormControlOptions(options) {
|
|
23
|
+
const normalizedOptions = (0, form_control_1.NormalizeFormControlOptions)(options);
|
|
24
|
+
const { type } = normalizedOptions;
|
|
25
|
+
const inputType = GuessInputType(type);
|
|
26
|
+
return Object.seal(Object.assign(Object.assign({}, normalizedOptions), { inputType }));
|
|
27
|
+
}
|
|
28
|
+
exports.NormalizeInputFormControlOptions = NormalizeInputFormControlOptions;
|
|
29
|
+
function printOptions(options) {
|
|
30
|
+
(0, angular_options_1.PrintAngularOptions)('input-form-control', options);
|
|
31
|
+
}
|
|
32
|
+
function default_1(options) {
|
|
33
|
+
const normalizedOptions = NormalizeInputFormControlOptions(options);
|
|
34
|
+
printOptions(normalizedOptions);
|
|
35
|
+
return () => {
|
|
36
|
+
return (0, schematics_1.chain)([(0, schematics_utilities_1.ExecuteSchematic)('form-control', normalizedOptions)]);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
exports.default = default_1;
|
|
40
|
+
//# sourceMappingURL=index.js.map
|