@rxap/schematic-angular 16.2.0-dev.1 → 16.2.0-dev.10
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 +73 -0
- package/README.md +1 -1
- package/package.json +13 -11
- package/src/lib/accordion-header.d.ts +5 -0
- package/src/lib/accordion-header.js +8 -2
- package/src/lib/accordion-header.js.map +1 -1
- package/src/lib/accordion-item.d.ts +17 -16
- package/src/lib/accordion-item.js +44 -32
- package/src/lib/accordion-item.js.map +1 -1
- package/src/lib/accordion-itme-kinds.d.ts +8 -0
- package/src/lib/accordion-itme-kinds.js +16 -0
- package/src/lib/accordion-itme-kinds.js.map +1 -0
- package/src/lib/coerce-accordion-component.js +4 -2
- package/src/lib/coerce-accordion-component.js.map +1 -1
- package/src/lib/coerce-form-component.js +5 -2
- package/src/lib/coerce-form-component.js.map +1 -1
- package/src/lib/coerce-minimum-table-component.js +9 -3
- package/src/lib/coerce-minimum-table-component.js.map +1 -1
- package/src/lib/coerce-tree-table-component.js +16 -0
- package/src/lib/coerce-tree-table-component.js.map +1 -1
- package/src/lib/data-grid-item.d.ts +4 -7
- package/src/lib/data-grid-item.js.map +1 -1
- package/src/lib/data-grid-options.d.ts +2 -0
- package/src/lib/data-grid-options.js +7 -3
- package/src/lib/data-grid-options.js.map +1 -1
- package/src/lib/form/generate-form-template.d.ts +5 -0
- package/src/lib/form/generate-form-template.js +12 -0
- package/src/lib/form/generate-form-template.js.map +1 -0
- package/src/lib/form-component-control.d.ts +2 -6
- package/src/lib/form-component-control.js.map +1 -1
- package/src/lib/form-control.d.ts +125 -0
- package/src/lib/form-control.js +304 -0
- package/src/lib/form-control.js.map +1 -0
- package/src/lib/form-definition-control.d.ts +3 -57
- package/src/lib/form-definition-control.js +18 -144
- package/src/lib/form-definition-control.js.map +1 -1
- package/src/lib/load-handlebars-template.d.ts +3 -0
- package/src/lib/load-handlebars-template.js +24 -0
- package/src/lib/load-handlebars-template.js.map +1 -0
- package/src/lib/minimum-table-component-options.d.ts +12 -2
- package/src/lib/minimum-table-component-options.js +14 -17
- package/src/lib/minimum-table-component-options.js.map +1 -1
- package/src/lib/table/table-filter-column-rule.d.ts +13 -0
- package/src/lib/table/table-filter-column-rule.js +88 -0
- package/src/lib/table/table-filter-column-rule.js.map +1 -0
- package/src/lib/table-column.d.ts +8 -2
- package/src/lib/table-column.js +110 -43
- package/src/lib/table-column.js.map +1 -1
- package/src/lib/use-pick-from-table-interface-as-form-type.d.ts +10 -0
- package/src/lib/use-pick-from-table-interface-as-form-type.js +32 -0
- package/src/lib/use-pick-from-table-interface-as-form-type.js.map +1 -0
- package/src/schematics/accordion/accordion-component/files/component/__componentName__.component.html.hbs +25 -0
- package/src/schematics/accordion/accordion-component/index.js +6 -98
- package/src/schematics/accordion/accordion-component/index.js.map +1 -1
- package/src/schematics/accordion/accordion-component/schema.json +313 -132
- package/src/schematics/accordion/accordion-component/template.schema.json +102 -0
- package/src/schematics/accordion/accordion-item-component/index.d.ts +2 -2
- package/src/schematics/accordion/accordion-item-component/index.js +49 -44
- package/src/schematics/accordion/accordion-item-component/index.js.map +1 -1
- package/src/schematics/accordion/accordion-item-component/schema.d.ts +2 -2
- package/src/schematics/accordion/accordion-item-component/schema.json +281 -78
- package/src/schematics/accordion/accordion-item-component/template.schema.json +33 -0
- package/src/schematics/accordion/item/accordion-item-data-grid-component/index.d.ts +1 -1
- package/src/schematics/accordion/item/accordion-item-data-grid-component/index.js +17 -29
- package/src/schematics/accordion/item/accordion-item-data-grid-component/index.js.map +1 -1
- package/src/schematics/accordion/item/accordion-item-data-grid-component/schema.d.ts +1 -1
- package/src/schematics/accordion/item/accordion-item-data-grid-component/schema.json +366 -103
- package/src/schematics/accordion/item/accordion-item-data-grid-component/template.schema.json +31 -0
- package/src/schematics/accordion/item/accordion-item-switch-component/index.d.ts +1 -1
- package/src/schematics/accordion/item/accordion-item-switch-component/index.js +4 -4
- package/src/schematics/accordion/item/accordion-item-switch-component/index.js.map +1 -1
- package/src/schematics/accordion/item/accordion-item-switch-component/schema.d.ts +1 -1
- package/src/schematics/accordion/item/accordion-item-switch-component/schema.json +317 -191
- package/src/schematics/accordion/item/accordion-item-switch-component/template.schema.json +84 -0
- package/src/schematics/accordion/item/accordion-item-table-component/index.d.ts +1 -1
- package/src/schematics/accordion/item/accordion-item-table-component/index.js +8 -8
- package/src/schematics/accordion/item/accordion-item-table-component/index.js.map +1 -1
- package/src/schematics/accordion/item/accordion-item-table-component/schema.d.ts +1 -1
- package/src/schematics/accordion/item/accordion-item-table-component/schema.json +584 -264
- package/src/schematics/accordion/item/accordion-item-table-component/template.schema.json +46 -0
- package/src/schematics/accordion/item/accordion-item-tree-table-component/index.d.ts +1 -1
- package/src/schematics/accordion/item/accordion-item-tree-table-component/index.js +11 -10
- package/src/schematics/accordion/item/accordion-item-tree-table-component/index.js.map +1 -1
- package/src/schematics/accordion/item/accordion-item-tree-table-component/schema.d.ts +1 -1
- package/src/schematics/accordion/item/accordion-item-tree-table-component/schema.json +556 -253
- package/src/schematics/accordion/item/accordion-item-tree-table-component/template.schema.json +46 -0
- package/src/schematics/accordion/templates/accordion-header.hbs +6 -0
- package/src/schematics/accordion/templates/data-grid-accordion-item.hbs +15 -0
- package/src/schematics/accordion/templates/default-accordion-item.hbs +15 -0
- package/src/schematics/accordion/templates/switch-accordion-item.hbs +21 -0
- package/src/schematics/accordion/templates/table-accordion-item.hbs +15 -0
- package/src/schematics/accordion/templates/tree-table-accordion-item.hbs +15 -0
- package/src/schematics/accordion-item.schema.json +35 -0
- package/src/schematics/angular.schema.json +2 -10
- package/src/schematics/backend.schema.json +13 -0
- package/src/schematics/button.schema.json +30 -0
- package/src/schematics/data-grid-component/files/component/__componentName__.component.html.hbs +34 -0
- package/src/schematics/data-grid-component/index.d.ts +0 -1
- package/src/schematics/data-grid-component/index.js +31 -25
- package/src/schematics/data-grid-component/index.js.map +1 -1
- package/src/schematics/data-grid-component/schema.json +326 -144
- package/src/schematics/data-grid-component/template.schema.json +23 -0
- package/src/schematics/data-grid-item.schema.json +23 -0
- package/src/schematics/data-grid.schema.json +44 -0
- package/src/schematics/dialog-component/schema.json +225 -66
- package/src/schematics/dialog-component/template.schema.json +65 -0
- package/src/schematics/form/control/input-form-control/index.d.ts +2 -2
- package/src/schematics/form/control/input-form-control/index.js +4 -27
- 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 -3
- package/src/schematics/form/control/input-form-control/schema.json +380 -108
- package/src/schematics/form/control/input-form-control/template.schema.json +23 -0
- package/src/schematics/form/control/select-form-control/index.d.ts +4 -2
- package/src/schematics/form/control/select-form-control/index.js +132 -96
- 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 +386 -94
- package/src/schematics/form/control/select-form-control/template.schema.json +23 -0
- package/src/schematics/form/control/table-select-form-control/index.d.ts +4 -6
- package/src/schematics/form/control/table-select-form-control/index.js +80 -69
- 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 -4
- package/src/schematics/form/control/table-select-form-control/schema.json +434 -97
- package/src/schematics/form/control/table-select-form-control/template.schema.json +78 -0
- package/src/schematics/form/form-component/files/component/{__componentName__.component.html.template → __componentName__.component.html.hbs} +3 -3
- package/src/schematics/form/form-component/index.js +9 -3
- package/src/schematics/form/form-component/index.js.map +1 -1
- package/src/schematics/form/form-component/schema.json +325 -146
- package/src/schematics/form/form-component/template.schema.json +23 -0
- package/src/schematics/form/form-control/index.d.ts +3 -1
- package/src/schematics/form/form-control/index.js +19 -8
- package/src/schematics/form/form-control/index.js.map +1 -1
- package/src/schematics/form/form-control/schema.json +316 -83
- package/src/schematics/form/form-control/template.schema.json +37 -0
- package/src/schematics/form/form-definition/index.js +14 -1
- package/src/schematics/form/form-definition/index.js.map +1 -1
- package/src/schematics/form/form-definition/schema.json +312 -127
- package/src/schematics/form/form-definition/template.schema.json +33 -0
- package/src/schematics/form/templates/checkbox-form-control.hbs +9 -0
- package/src/schematics/form/templates/default-form-control.hbs +2 -0
- package/src/schematics/form/templates/input-form-control.hbs +9 -0
- package/src/schematics/form/templates/mat-form-field.hbs +31 -0
- package/src/schematics/form/templates/slide-toggle-form-control.hbs +8 -0
- package/src/schematics/form/templates/table-select-form-control.hbs +18 -0
- package/src/schematics/form-component.schema.json +39 -0
- package/src/schematics/form-control.schema.json +68 -0
- package/src/schematics/form-definition.schema.json +22 -0
- package/src/schematics/form-field.schema.json +24 -0
- package/src/schematics/header-button.schema.json +42 -0
- package/src/schematics/input-form-control.schema.json +47 -0
- package/src/schematics/minimum-table.schema.json +54 -0
- package/src/schematics/property.schema.json +28 -0
- package/src/schematics/select-form-control.schema.json +53 -0
- package/src/schematics/table/action/dialog-table-action/schema.json +294 -133
- package/src/schematics/table/action/dialog-table-action/template.schema.json +61 -0
- package/src/schematics/table/action/form-table-action/schema.json +392 -172
- package/src/schematics/table/action/form-table-action/template.schema.json +75 -0
- package/src/schematics/table/action/navigation-table-action/schema.json +272 -88
- package/src/schematics/table/action/navigation-table-action/template.schema.json +31 -0
- package/src/schematics/table/action/open-api-table-action/schema.json +288 -102
- package/src/schematics/table/action/open-api-table-action/template.schema.json +59 -0
- package/src/schematics/table/action/operation-table-action/schema.json +259 -92
- package/src/schematics/table/action/operation-table-action/template.schema.json +17 -0
- package/src/schematics/table/header-button/form-table-header-button/schema.json +325 -126
- package/src/schematics/table/header-button/form-table-header-button/template.schema.json +51 -0
- package/src/schematics/table/header-button/navigation-table-header-button/schema.json +254 -81
- package/src/schematics/table/header-button/navigation-table-header-button/template.schema.json +31 -0
- package/src/schematics/table/table-action/schema.json +254 -87
- package/src/schematics/table/table-action/template.schema.json +30 -0
- package/src/schematics/table/table-component/files/component/__componentName__.component.html.hbs +241 -0
- package/src/schematics/table/table-component/index.d.ts +2 -2
- package/src/schematics/table/table-component/index.js +11 -104
- package/src/schematics/table/table-component/index.js.map +1 -1
- package/src/schematics/table/table-component/schema.json +461 -197
- package/src/schematics/table/table-component/template.schema.json +26 -0
- package/src/schematics/table/table-header-button/schema.json +235 -73
- package/src/schematics/table/table-header-button/template.schema.json +30 -0
- package/src/schematics/table/templates/boolean-table-column.hbs +10 -0
- package/src/schematics/table/templates/component-table-column.hbs +12 -0
- package/src/schematics/table/templates/copy-to-clipboard-table-column.hbs +10 -0
- package/src/schematics/table/templates/date-table-column.hbs +11 -0
- package/src/schematics/table/templates/default-table-column.hbs +8 -0
- package/src/schematics/table/templates/icon-table-column.hbs +10 -0
- package/src/schematics/table/templates/link-table-column.hbs +10 -0
- package/src/schematics/table/tree-table-component/files/component/__componentName__.component.html.hbs +249 -0
- package/src/schematics/table/tree-table-component/index.js +11 -4
- package/src/schematics/table/tree-table-component/index.js.map +1 -1
- package/src/schematics/table/tree-table-component/schema.json +521 -250
- package/src/schematics/table/tree-table-component/template.schema.json +26 -0
- package/src/schematics/table-action.schema.json +61 -0
- package/src/schematics/table-column.schema.json +69 -0
- package/src/schematics/table.schema.json +54 -0
- package/src/schematics/tree-component/schema.json +113 -76
- package/src/schematics/tree-component/template.schema.json +31 -0
- package/src/schematics/tree-table.schema.json +40 -0
- package/src/schematics/type.schema.json +35 -0
- package/src/schematics/upstream.schema.json +56 -0
- package/src/lib/accordion-itme-types.d.ts +0 -8
- package/src/lib/accordion-itme-types.js +0 -16
- package/src/lib/accordion-itme-types.js.map +0 -1
- package/src/schematics/accordion/accordion-component/files/component/__componentName__.component.html.template +0 -94
- package/src/schematics/accordion/accordion-component/files/header-component/accordion-header.component.html.template +0 -10
- package/src/schematics/data-grid-component/files/form/__componentName__.component.html.template +0 -42
- package/src/schematics/data-grid-component/files/plain/__componentName__.component.html.template +0 -25
- package/src/schematics/table/table-component/files/component/__componentName__.component.html.template +0 -299
- package/src/schematics/table/tree-table-component/files/component/__componentName__.component.html.template +0 -213
|
@@ -4,10 +4,14 @@ exports.CoerceMinimumTableComponentRule = void 0;
|
|
|
4
4
|
const schematics_ts_morph_1 = require("@rxap/schematics-ts-morph");
|
|
5
5
|
const ts_morph_1 = require("@rxap/ts-morph");
|
|
6
6
|
const utilities_1 = require("@rxap/utilities");
|
|
7
|
+
const load_handlebars_template_1 = require("./load-handlebars-template");
|
|
7
8
|
const table_options_1 = require("./table-options");
|
|
8
9
|
function CoerceMinimumTableComponentRule(options) {
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
var _a, _b;
|
|
11
|
+
const { tsMorphTransform = utilities_1.noop, table: { columnList, actionList, headerButton, modifiers, }, handlebars: { partials = {} } = {}, } = options;
|
|
12
|
+
(_a = partials['matFormField']) !== null && _a !== void 0 ? _a : (partials['matFormField'] = (0, load_handlebars_template_1.LoadMatFormFieldHandlebarsTemplate)());
|
|
13
|
+
return (0, schematics_ts_morph_1.CoerceComponentRule)(Object.assign(Object.assign({}, options), { handlebars: Object.assign(Object.assign({}, (_b = options.handlebars) !== null && _b !== void 0 ? _b : {}), { partials }), tsMorphTransform: (project, [sourceFile], [classDeclaration]) => {
|
|
14
|
+
(0, schematics_ts_morph_1.AddComponentAnimations)(sourceFile, 'RowAnimation', '@rxap/material-table-system');
|
|
11
15
|
(0, ts_morph_1.CoerceImports)(sourceFile, [
|
|
12
16
|
{
|
|
13
17
|
moduleSpecifier: '@rxap/material-table-system',
|
|
@@ -87,7 +91,9 @@ function CoerceMinimumTableComponentRule(options) {
|
|
|
87
91
|
(0, ts_morph_1.CoerceComponentImport)(classDeclaration, { name: 'NavigateBackButtonComponent', moduleSpecifier: '@rxap/components' });
|
|
88
92
|
}
|
|
89
93
|
// endregion
|
|
90
|
-
(
|
|
94
|
+
if (!!options.feature && (!options.directory || !options.directory.includes('/'))) {
|
|
95
|
+
(0, ts_morph_1.CoerceDefaultClassExport)(classDeclaration, true);
|
|
96
|
+
}
|
|
91
97
|
tsMorphTransform(project, [sourceFile], [classDeclaration], options);
|
|
92
98
|
} }));
|
|
93
99
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-minimum-table-component.js","sourceRoot":"","sources":["../../../../../../packages/schematic/angular/src/lib/coerce-minimum-table-component.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"coerce-minimum-table-component.js","sourceRoot":"","sources":["../../../../../../packages/schematic/angular/src/lib/coerce-minimum-table-component.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,11 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CoerceTreeTableComponentRule = void 0;
|
|
4
|
+
const schematics_ts_morph_1 = require("@rxap/schematics-ts-morph");
|
|
4
5
|
const ts_morph_1 = require("@rxap/ts-morph");
|
|
5
6
|
const coerce_minimum_table_component_1 = require("./coerce-minimum-table-component");
|
|
6
7
|
function CoerceTreeTableComponentRule(options) {
|
|
7
8
|
return (0, coerce_minimum_table_component_1.CoerceMinimumTableComponentRule)(Object.assign(Object.assign({}, options), { tsMorphTransform: (project, [sourceFile], [classDeclaration]) => {
|
|
8
9
|
(0, ts_morph_1.CoerceComponentImport)(classDeclaration, { name: 'TreeControlCellComponent', moduleSpecifier: '@rxap/material-table-system' });
|
|
10
|
+
(0, ts_morph_1.CoerceComponentImport)(classDeclaration, { name: 'MatProgressSpinnerModule', moduleSpecifier: '@angular/material/progress-spinner' });
|
|
11
|
+
(0, ts_morph_1.CoerceComponentImport)(classDeclaration, { name: 'NgIf', moduleSpecifier: '@angular/common' });
|
|
12
|
+
(0, schematics_ts_morph_1.AddComponentProvider)(sourceFile, {
|
|
13
|
+
provide: 'TABLE_DATA_SOURCE',
|
|
14
|
+
useClass: 'TreeTableDataSource',
|
|
15
|
+
}, [
|
|
16
|
+
{
|
|
17
|
+
namedImports: ['TreeTableDataSource'],
|
|
18
|
+
moduleSpecifier: '@rxap/data-source/table/tree',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
namedImports: ['TABLE_DATA_SOURCE'],
|
|
22
|
+
moduleSpecifier: '@rxap/material-table-system',
|
|
23
|
+
}
|
|
24
|
+
]);
|
|
9
25
|
} }));
|
|
10
26
|
}
|
|
11
27
|
exports.CoerceTreeTableComponentRule = CoerceTreeTableComponentRule;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-tree-table-component.js","sourceRoot":"","sources":["../../../../../../packages/schematic/angular/src/lib/coerce-tree-table-component.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"coerce-tree-table-component.js","sourceRoot":"","sources":["../../../../../../packages/schematic/angular/src/lib/coerce-tree-table-component.ts"],"names":[],"mappings":";;;AAAA,mEAGmC;AACnC,6CAAuD;AACvD,qFAAmF;AAOnF,SAAgB,4BAA4B,CAAC,OAAkD;IAE7F,OAAO,IAAA,gEAA+B,kCACjC,OAAO,KACV,gBAAgB,EAAE,CAAC,OAAO,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,gBAAgB,CAAC,EAAE,EAAE;YAC9D,IAAA,gCAAqB,EAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,0BAA0B,EAAE,eAAe,EAAE,6BAA6B,EAAE,CAAC,CAAC;YAC9H,IAAA,gCAAqB,EAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,0BAA0B,EAAE,eAAe,EAAE,oCAAoC,EAAE,CAAC,CAAC;YACrI,IAAA,gCAAqB,EAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,iBAAiB,EAAE,CAAC,CAAC;YAC9F,IAAA,0CAAoB,EAAC,UAAU,EAAE;gBAC/B,OAAO,EAAE,mBAAmB;gBAC5B,QAAQ,EAAE,qBAAqB;aAChC,EAAE;gBACD;oBACE,YAAY,EAAE,CAAE,qBAAqB,CAAE;oBACvC,eAAe,EAAE,8BAA8B;iBAChD;gBACD;oBACE,YAAY,EAAE,CAAC,mBAAmB,CAAC;oBACnC,eAAe,EAAE,6BAA6B;iBAC/C;aACF,CAAC,CAAC;QACL,CAAC,IACD,CAAC;AAEL,CAAC;AAxBD,oEAwBC"}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { TypeImport } from '@rxap/ts-morph';
|
|
2
|
+
import { Normalized } from '@rxap/utilities';
|
|
3
|
+
import { FormDefinitionControl, NormalizedFormDefinitionControl } from './form-definition-control';
|
|
4
4
|
export interface DataGridItem extends FormDefinitionControl {
|
|
5
5
|
name: string;
|
|
6
6
|
type?: string | TypeImport;
|
|
7
7
|
header?: string;
|
|
8
8
|
}
|
|
9
|
-
export interface NormalizedDataGridItem extends Readonly<
|
|
10
|
-
type: NormalizedTypeImport;
|
|
11
|
-
template: BaseFormControlTemplate;
|
|
12
|
-
importList: NormalizedTypeImport[];
|
|
9
|
+
export interface NormalizedDataGridItem extends Omit<Readonly<Normalized<DataGridItem>>, 'type' | 'importList'>, NormalizedFormDefinitionControl {
|
|
13
10
|
}
|
|
14
11
|
export declare function NormalizeDataGridItem(item: Readonly<DataGridItem>): NormalizedDataGridItem;
|
|
15
12
|
export declare function NormalizeDataGridItemList(itemList?: Array<Readonly<DataGridItem>>): ReadonlyArray<NormalizedDataGridItem>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-grid-item.js","sourceRoot":"","sources":["../../../../../../packages/schematic/angular/src/lib/data-grid-item.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"data-grid-item.js","sourceRoot":"","sources":["../../../../../../packages/schematic/angular/src/lib/data-grid-item.ts"],"names":[],"mappings":";;;AASA,uEAImC;AAUnC,SAAgB,qBAAqB,CAAC,IAA4B;;IAChE,IAAI,MAAM,GAAkB,IAAI,CAAC;IACjC,MAAM,GAAG,MAAA,IAAI,CAAC,MAAM,mCAAI,IAAI,CAAC;IAC7B,OAAO,MAAM,CAAC,MAAM,iCACf,IAAA,wDAA8B,EAAC,IAAI,CAAC,KACvC,MAAM,IACN,CAAC;AACL,CAAC;AAPD,sDAOC;AAED,SAAgB,yBAAyB,CACvC,QAAwC;;IAExC,OAAO,MAAM,CAAC,MAAM,CAAC,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,GAAG,CAAC,qBAAqB,CAAC,mCAAI,EAAE,CAAC,CAAC;AACnE,CAAC;AAJD,8DAIC"}
|
|
@@ -10,9 +10,11 @@ export interface DataGridOptions {
|
|
|
10
10
|
collection?: boolean;
|
|
11
11
|
title?: string;
|
|
12
12
|
subtitle?: string;
|
|
13
|
+
inCard?: boolean;
|
|
13
14
|
}
|
|
14
15
|
export interface NormalizedDataGridOptions extends Omit<Readonly<Normalized<DataGridOptions>>, 'itemList'> {
|
|
15
16
|
mode: DataGridMode;
|
|
16
17
|
itemList: ReadonlyArray<NormalizedDataGridItem>;
|
|
18
|
+
isForm: boolean;
|
|
17
19
|
}
|
|
18
20
|
export declare function NormalizeDataGridOptions(options: Readonly<DataGridOptions>): Readonly<NormalizedDataGridOptions>;
|
|
@@ -11,14 +11,18 @@ function IsDataGridMode(value) {
|
|
|
11
11
|
return Object.values(DataGridMode).includes(value);
|
|
12
12
|
}
|
|
13
13
|
function NormalizeDataGridOptions(options) {
|
|
14
|
-
var _a, _b;
|
|
15
|
-
const { itemList,
|
|
14
|
+
var _a, _b, _c;
|
|
15
|
+
const { itemList, collection, } = options;
|
|
16
|
+
let { mode } = options;
|
|
17
|
+
mode = IsDataGridMode(mode) ? mode : DataGridMode.Plain;
|
|
16
18
|
return Object.freeze({
|
|
17
19
|
itemList: (0, data_grid_item_1.NormalizeDataGridItemList)(itemList),
|
|
18
|
-
mode
|
|
20
|
+
mode,
|
|
19
21
|
collection: collection !== null && collection !== void 0 ? collection : false,
|
|
20
22
|
title: (_a = options.title) !== null && _a !== void 0 ? _a : null,
|
|
21
23
|
subtitle: (_b = options.subtitle) !== null && _b !== void 0 ? _b : null,
|
|
24
|
+
inCard: (_c = options.inCard) !== null && _c !== void 0 ? _c : true,
|
|
25
|
+
isForm: mode === DataGridMode.Form,
|
|
22
26
|
});
|
|
23
27
|
}
|
|
24
28
|
exports.NormalizeDataGridOptions = NormalizeDataGridOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-grid-options.js","sourceRoot":"","sources":["../../../../../../packages/schematic/angular/src/lib/data-grid-options.ts"],"names":[],"mappings":";;;AACA,qDAI0B;AAE1B,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb,+BAAe,CAAA;AACjB,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB;AAED,SAAS,cAAc,CAAC,KAAU;IAChC,OAAO,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACrD,CAAC;
|
|
1
|
+
{"version":3,"file":"data-grid-options.js","sourceRoot":"","sources":["../../../../../../packages/schematic/angular/src/lib/data-grid-options.ts"],"names":[],"mappings":";;;AACA,qDAI0B;AAE1B,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb,+BAAe,CAAA;AACjB,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB;AAED,SAAS,cAAc,CAAC,KAAU;IAChC,OAAO,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACrD,CAAC;AAiBD,SAAgB,wBAAwB,CAAC,OAAkC;;IACzE,MAAM,EACJ,QAAQ,EACR,UAAU,GACX,GAAG,OAAO,CAAC;IACZ,IAAI,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IACvB,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC;IACxD,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,QAAQ,EAAE,IAAA,0CAAyB,EAAC,QAAQ,CAAC;QAC7C,IAAI;QACJ,UAAU,EAAE,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,KAAK;QAC/B,KAAK,EAAE,MAAA,OAAO,CAAC,KAAK,mCAAI,IAAI;QAC5B,QAAQ,EAAE,MAAA,OAAO,CAAC,QAAQ,mCAAI,IAAI;QAClC,MAAM,EAAE,MAAA,OAAO,CAAC,MAAM,mCAAI,IAAI;QAC9B,MAAM,EAAE,IAAI,KAAK,YAAY,CAAC,IAAI;KACnC,CAAC,CAAC;AACL,CAAC;AAhBD,4DAgBC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GenerateFormTemplate = void 0;
|
|
4
|
+
function GenerateFormTemplate(options) {
|
|
5
|
+
let content = '';
|
|
6
|
+
for (const control of options.controlList) {
|
|
7
|
+
content += control.handlebars({ control });
|
|
8
|
+
}
|
|
9
|
+
return content;
|
|
10
|
+
}
|
|
11
|
+
exports.GenerateFormTemplate = GenerateFormTemplate;
|
|
12
|
+
//# sourceMappingURL=generate-form-template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-form-template.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/angular/src/lib/form/generate-form-template.ts"],"names":[],"mappings":";;;AAMA,SAAgB,oBAAoB,CAAC,OAAoC;IACvE,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,KAAK,MAAM,OAAO,IAAI,OAAO,CAAC,WAAW,EAAE;QACzC,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;KAC5C;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAND,oDAMC"}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { Normalized } from '@rxap/utilities';
|
|
2
|
-
import {
|
|
3
|
-
import { NormalizedTypeImport } from '@rxap/ts-morph';
|
|
2
|
+
import { FormDefinitionControl, NormalizedFormDefinitionControl } from './form-definition-control';
|
|
4
3
|
export interface FormComponentControl extends FormDefinitionControl {
|
|
5
4
|
}
|
|
6
|
-
export interface NormalizedFormComponentControl extends Readonly<Normalized<FormComponentControl>>, NormalizedFormDefinitionControl {
|
|
7
|
-
type: NormalizedTypeImport;
|
|
8
|
-
template: BaseFormControlTemplate;
|
|
9
|
-
importList: NormalizedTypeImport[];
|
|
5
|
+
export interface NormalizedFormComponentControl extends Omit<Readonly<Normalized<FormComponentControl>>, 'type' | 'importList'>, NormalizedFormDefinitionControl {
|
|
10
6
|
}
|
|
11
7
|
export declare function NormalizeFormComponentControl(control: FormComponentControl): NormalizedFormComponentControl;
|
|
12
8
|
export declare function NormalizeFormComponentControlList(controlList?: Array<FormComponentControl>): ReadonlyArray<NormalizedFormComponentControl>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-component-control.js","sourceRoot":"","sources":["../../../../../../packages/schematic/angular/src/lib/form-component-control.ts"],"names":[],"mappings":";;;
|
|
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"}
|
|
@@ -0,0 +1,125 @@
|
|
|
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 {
|
|
15
|
+
name: string;
|
|
16
|
+
type?: string | TypeImport;
|
|
17
|
+
isArray?: boolean;
|
|
18
|
+
state?: string;
|
|
19
|
+
isRequired?: boolean;
|
|
20
|
+
isReadonly?: boolean;
|
|
21
|
+
isDisabled?: boolean;
|
|
22
|
+
validatorList?: string[];
|
|
23
|
+
importList?: TypeImport[];
|
|
24
|
+
kind: FormControlKinds;
|
|
25
|
+
template?: string;
|
|
26
|
+
label?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface NormalizedBaseFormControl extends Readonly<Normalized<BaseFormControl>> {
|
|
29
|
+
type: NormalizedTypeImport;
|
|
30
|
+
importList: NormalizedTypeImport[];
|
|
31
|
+
handlebars: Handlebars.TemplateDelegate<{
|
|
32
|
+
control: NormalizedBaseFormControl;
|
|
33
|
+
}>;
|
|
34
|
+
}
|
|
35
|
+
export declare function NormalizeBaseFormControl(control: BaseFormControl): NormalizedBaseFormControl;
|
|
36
|
+
export interface FormFieldButton {
|
|
37
|
+
svgIcon?: string;
|
|
38
|
+
icon?: string;
|
|
39
|
+
directiveList?: TypeImport[];
|
|
40
|
+
importList?: TypeImport[];
|
|
41
|
+
}
|
|
42
|
+
export interface FormField {
|
|
43
|
+
label?: string;
|
|
44
|
+
prefixButton?: FormFieldButton;
|
|
45
|
+
suffixButton?: FormFieldButton;
|
|
46
|
+
directiveList?: TypeImport[];
|
|
47
|
+
hasClearButton?: boolean;
|
|
48
|
+
}
|
|
49
|
+
export type NormalizedFormField = Readonly<Normalized<FormField>>;
|
|
50
|
+
export interface NormalizedFormFieldButton extends Readonly<Normalized<FormFieldButton>> {
|
|
51
|
+
directiveList: NormalizedTypeImport[];
|
|
52
|
+
importList: NormalizedTypeImport[];
|
|
53
|
+
}
|
|
54
|
+
export declare function NormalizeFormFieldButton(button?: FormFieldButton | null): NormalizedFormFieldButton | null;
|
|
55
|
+
export declare function NormalizeFormField(formField: FormField, importList?: TypeImport[], defaultFormField?: Partial<FormField>): NormalizedFormField;
|
|
56
|
+
export interface InputFormControl extends BaseFormControl {
|
|
57
|
+
inputType?: string;
|
|
58
|
+
placeholder?: string;
|
|
59
|
+
formField?: FormField;
|
|
60
|
+
}
|
|
61
|
+
export interface NormalizedInputFormControl extends Omit<Readonly<Normalized<InputFormControl>>, 'type' | 'importList'>, NormalizedBaseFormControl {
|
|
62
|
+
kind: FormControlKinds.INPUT;
|
|
63
|
+
}
|
|
64
|
+
export declare function IsNormalizedInputFormControlOptions(template: NormalizedBaseFormControl): template is NormalizedInputFormControl;
|
|
65
|
+
export declare function NormalizeInputFormControl(control: InputFormControl): NormalizedInputFormControl;
|
|
66
|
+
export interface SelectFormControl extends BaseFormControl {
|
|
67
|
+
options?: ControlOption[];
|
|
68
|
+
backend?: BackendTypes;
|
|
69
|
+
multiple?: boolean;
|
|
70
|
+
formField?: FormField;
|
|
71
|
+
}
|
|
72
|
+
export interface NormalizedSelectFormControl extends Readonly<Normalized<Omit<SelectFormControl, 'options' | 'type' | 'importList'>>>, NormalizedBaseFormControl {
|
|
73
|
+
kind: FormControlKinds.SELECT;
|
|
74
|
+
options: ReadonlyArray<ControlOption> | null;
|
|
75
|
+
backend: BackendTypes;
|
|
76
|
+
}
|
|
77
|
+
export declare function IsNormalizedSelectFormControl(template: NormalizedBaseFormControl): template is NormalizedSelectFormControl;
|
|
78
|
+
export declare function NormalizeSelectFormControl(control: SelectFormControl): NormalizedSelectFormControl;
|
|
79
|
+
export interface CheckboxFormControl extends BaseFormControl {
|
|
80
|
+
labelPosition?: 'before' | 'after';
|
|
81
|
+
}
|
|
82
|
+
export interface NormalizedCheckboxFormControl extends Readonly<Normalized<Omit<CheckboxFormControl, 'type' | 'importList'>>>, NormalizedBaseFormControl {
|
|
83
|
+
kind: FormControlKinds.CHECKBOX;
|
|
84
|
+
}
|
|
85
|
+
export declare function IsNormalizedCheckboxFormControl(template: NormalizedBaseFormControl): template is NormalizedCheckboxFormControl;
|
|
86
|
+
export declare function NormalizeCheckboxFormControl(control: CheckboxFormControl): NormalizedCheckboxFormControl;
|
|
87
|
+
export interface SlideToggleFormControl extends BaseFormControl {
|
|
88
|
+
labelPosition?: 'before' | 'after';
|
|
89
|
+
}
|
|
90
|
+
export interface NormalizedSlideToggleFormControl extends Readonly<Normalized<Omit<SlideToggleFormControl, 'type' | 'importList'>>>, NormalizedBaseFormControl {
|
|
91
|
+
kind: FormControlKinds.CHECKBOX;
|
|
92
|
+
}
|
|
93
|
+
export declare function IsNormalizedSlideToggleFormControl(template: NormalizedBaseFormControl): template is NormalizedSlideToggleFormControl;
|
|
94
|
+
export declare function NormalizeSlideToggleFormControl(control: SlideToggleFormControl): NormalizedSlideToggleFormControl;
|
|
95
|
+
export type TableSelectColumn = Pick<TableColumn, 'name' | 'title' | 'hasFilter' | 'kind' | 'propertyPath' | 'type'>;
|
|
96
|
+
export type NormalizedTableSelectColumn = Pick<NormalizedTableColumn, 'name' | 'title' | 'hasFilter' | 'kind' | 'propertyPath' | 'type'>;
|
|
97
|
+
export declare function NormalizeTableSelectColumn(column: TableSelectColumn): NormalizedTableSelectColumn;
|
|
98
|
+
export interface TableSelectToFunction {
|
|
99
|
+
property: DataProperty;
|
|
100
|
+
}
|
|
101
|
+
export interface NormalizedTableSelectToFunction extends Readonly<Normalized<TableSelectToFunction>> {
|
|
102
|
+
property: NormalizedDataProperty;
|
|
103
|
+
}
|
|
104
|
+
export declare function NormalizeTableSelectToFunction(toFunction: TableSelectToFunction | null | undefined, columnList: TableSelectColumn[]): NormalizedTableSelectToFunction;
|
|
105
|
+
export interface TableSelectFormControl extends BaseFormControl {
|
|
106
|
+
backend?: BackendTypes;
|
|
107
|
+
formField?: FormField;
|
|
108
|
+
title?: string;
|
|
109
|
+
propertyList?: DataProperty[];
|
|
110
|
+
columnList?: TableSelectColumn[];
|
|
111
|
+
toDisplay?: TableSelectToFunction;
|
|
112
|
+
toValue?: TableSelectToFunction;
|
|
113
|
+
upstream?: UpstreamOptions;
|
|
114
|
+
}
|
|
115
|
+
export interface NormalizedTableSelectFormControl extends Readonly<Normalized<Omit<TableSelectFormControl, 'type' | 'importList' | 'columnList' | 'propertyList'>>>, NormalizedBaseFormControl {
|
|
116
|
+
kind: FormControlKinds.TABLE_SELECT;
|
|
117
|
+
backend: BackendTypes;
|
|
118
|
+
columnList: NormalizedTableSelectColumn[];
|
|
119
|
+
propertyList: ReadonlyArray<NormalizedDataProperty>;
|
|
120
|
+
toDisplay: NormalizedTableSelectToFunction;
|
|
121
|
+
toValue: NormalizedTableSelectToFunction;
|
|
122
|
+
upstream: NormalizedUpstreamOptions | null;
|
|
123
|
+
}
|
|
124
|
+
export declare function IsNormalizedTableSelectFormControl(template: NormalizedBaseFormControl): template is NormalizedTableSelectFormControl;
|
|
125
|
+
export declare function NormalizeTableSelectFormControl(control: TableSelectFormControl): NormalizedTableSelectFormControl;
|
|
@@ -0,0 +1,304 @@
|
|
|
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.NormalizeFormField = exports.NormalizeFormFieldButton = exports.NormalizeBaseFormControl = exports.FormControlKinds = void 0;
|
|
4
|
+
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
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
|
+
const name = control.name;
|
|
24
|
+
const type = (0, ts_morph_1.NormalizeTypeImport)(control.type);
|
|
25
|
+
const state = (_a = control.state) !== null && _a !== void 0 ? _a : null;
|
|
26
|
+
const isRequired = (_b = control.isRequired) !== null && _b !== void 0 ? _b : false;
|
|
27
|
+
const validatorList = (_c = control.validatorList) !== null && _c !== void 0 ? _c : [];
|
|
28
|
+
const importList = ((_d = control.importList) !== null && _d !== void 0 ? _d : []);
|
|
29
|
+
const isReadonly = (_e = control.isReadonly) !== null && _e !== void 0 ? _e : false;
|
|
30
|
+
const isDisabled = (_f = control.isDisabled) !== null && _f !== void 0 ? _f : false;
|
|
31
|
+
let isArray = false;
|
|
32
|
+
if (type.name.endsWith('[]')) {
|
|
33
|
+
isArray = true;
|
|
34
|
+
type.name = type.name.slice(0, -2);
|
|
35
|
+
}
|
|
36
|
+
if (type.name.startsWith('Array<') && type.name.endsWith('>')) {
|
|
37
|
+
isArray = true;
|
|
38
|
+
type.name = type.name.slice(6, -1);
|
|
39
|
+
}
|
|
40
|
+
const kind = (_g = control.kind) !== null && _g !== void 0 ? _g : FormControlKinds.DEFAULT;
|
|
41
|
+
const template = (_h = control.template) !== null && _h !== void 0 ? _h : kind + '-form-control.hbs';
|
|
42
|
+
return Object.freeze({
|
|
43
|
+
name,
|
|
44
|
+
type,
|
|
45
|
+
isArray,
|
|
46
|
+
isRequired,
|
|
47
|
+
state,
|
|
48
|
+
isReadonly,
|
|
49
|
+
isDisabled,
|
|
50
|
+
validatorList,
|
|
51
|
+
importList: importList.map(ts_morph_1.NormalizeTypeImport),
|
|
52
|
+
kind,
|
|
53
|
+
template,
|
|
54
|
+
handlebars: (0, load_handlebars_template_1.LoadHandlebarsTemplate)(template, (0, path_1.join)(__dirname, '..', 'schematics', 'form', 'templates')),
|
|
55
|
+
label: (_j = control.label) !== null && _j !== void 0 ? _j : null,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
exports.NormalizeBaseFormControl = NormalizeBaseFormControl;
|
|
59
|
+
function NormalizeFormFieldButton(button) {
|
|
60
|
+
var _a, _b, _c;
|
|
61
|
+
if ((!button || Object.keys(button).length === 0)) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
const importList = (_a = button.importList) !== null && _a !== void 0 ? _a : [];
|
|
65
|
+
(0, utilities_1.CoerceArrayItems)(importList, [
|
|
66
|
+
{
|
|
67
|
+
name: 'MatIconModule',
|
|
68
|
+
moduleSpecifier: '@angular/material/icon',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'MatButtonModule',
|
|
72
|
+
moduleSpecifier: '@angular/material/button',
|
|
73
|
+
}
|
|
74
|
+
], (a, b) => a.name === b.name);
|
|
75
|
+
return Object.freeze({
|
|
76
|
+
svgIcon: (_b = button.svgIcon) !== null && _b !== void 0 ? _b : null,
|
|
77
|
+
icon: (_c = button.icon) !== null && _c !== void 0 ? _c : null,
|
|
78
|
+
directiveList: (0, ts_morph_1.NormalizeTypeImportList)(button.directiveList),
|
|
79
|
+
importList: (0, ts_morph_1.NormalizeTypeImportList)(importList),
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
exports.NormalizeFormFieldButton = NormalizeFormFieldButton;
|
|
83
|
+
function NormalizeFormField(formField, importList = [], defaultFormField = {}) {
|
|
84
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
85
|
+
defaultFormField = (0, utilities_1.DeleteEmptyProperties)(defaultFormField);
|
|
86
|
+
const directiveList = (_a = defaultFormField.directiveList) !== null && _a !== void 0 ? _a : [];
|
|
87
|
+
(0, utilities_1.CoerceArrayItems)(directiveList, (_b = defaultFormField.directiveList) !== null && _b !== void 0 ? _b : [], (a, b) => a.name === b.name);
|
|
88
|
+
const normalizedFormField = {
|
|
89
|
+
label: (_d = (_c = defaultFormField.label) !== null && _c !== void 0 ? _c : formField.label) !== null && _d !== void 0 ? _d : null,
|
|
90
|
+
prefixButton: NormalizeFormFieldButton((_e = formField.prefixButton) !== null && _e !== void 0 ? _e : defaultFormField.prefixButton),
|
|
91
|
+
suffixButton: NormalizeFormFieldButton((_f = formField.suffixButton) !== null && _f !== void 0 ? _f : defaultFormField.suffixButton),
|
|
92
|
+
hasClearButton: (_h = (_g = formField.hasClearButton) !== null && _g !== void 0 ? _g : defaultFormField.hasClearButton) !== null && _h !== void 0 ? _h : true,
|
|
93
|
+
directiveList: (0, ts_morph_1.NormalizeTypeImportList)(directiveList),
|
|
94
|
+
};
|
|
95
|
+
if (normalizedFormField.hasClearButton) {
|
|
96
|
+
(_j = normalizedFormField.suffixButton) !== null && _j !== void 0 ? _j : (normalizedFormField.suffixButton = NormalizeFormFieldButton({
|
|
97
|
+
icon: 'clear',
|
|
98
|
+
directiveList: [
|
|
99
|
+
{
|
|
100
|
+
name: 'rxapInputClearButton',
|
|
101
|
+
namedImport: 'InputClearButtonDirective',
|
|
102
|
+
moduleSpecifier: '@rxap/material-form-system',
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
}));
|
|
106
|
+
}
|
|
107
|
+
(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);
|
|
108
|
+
(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);
|
|
109
|
+
(0, utilities_1.CoerceArrayItems)(importList, (_q = (_p = normalizedFormField.prefixButton) === null || _p === void 0 ? void 0 : _p.importList) !== null && _q !== void 0 ? _q : [], (a, b) => a.name === b.name && a.namedImport === b.namedImport);
|
|
110
|
+
(0, utilities_1.CoerceArrayItems)(importList, (_s = (_r = normalizedFormField.suffixButton) === null || _r === void 0 ? void 0 : _r.importList) !== null && _s !== void 0 ? _s : [], (a, b) => a.name === b.name && a.namedImport === b.namedImport);
|
|
111
|
+
return Object.freeze(normalizedFormField);
|
|
112
|
+
}
|
|
113
|
+
exports.NormalizeFormField = NormalizeFormField;
|
|
114
|
+
function IsNormalizedInputFormControlOptions(template) {
|
|
115
|
+
return template.kind === FormControlKinds.INPUT;
|
|
116
|
+
}
|
|
117
|
+
exports.IsNormalizedInputFormControlOptions = IsNormalizedInputFormControlOptions;
|
|
118
|
+
function NormalizeInputFormControl(control) {
|
|
119
|
+
var _a, _b, _c, _d, _e;
|
|
120
|
+
const type = (0, ts_morph_1.NormalizeTypeImport)(control.type);
|
|
121
|
+
const validatorList = (_a = control.validatorList) !== null && _a !== void 0 ? _a : [];
|
|
122
|
+
const importList = (_b = control.importList) !== null && _b !== void 0 ? _b : [];
|
|
123
|
+
importList.push({
|
|
124
|
+
name: 'MatInputModule',
|
|
125
|
+
moduleSpecifier: '@angular/material/input',
|
|
126
|
+
});
|
|
127
|
+
const inputType = (_c = control.inputType) !== null && _c !== void 0 ? _c : 'text';
|
|
128
|
+
switch (inputType) {
|
|
129
|
+
case 'checkbox':
|
|
130
|
+
type.name = 'boolean';
|
|
131
|
+
break;
|
|
132
|
+
case 'text':
|
|
133
|
+
case 'password':
|
|
134
|
+
case 'color':
|
|
135
|
+
type.name = 'string';
|
|
136
|
+
break;
|
|
137
|
+
case 'email':
|
|
138
|
+
type.name = 'string';
|
|
139
|
+
(0, utilities_1.CoerceArrayItems)(validatorList, ['IsEmail()']);
|
|
140
|
+
break;
|
|
141
|
+
case 'tel':
|
|
142
|
+
type.name = 'string';
|
|
143
|
+
(0, utilities_1.CoerceArrayItems)(validatorList, ['IsTel()']);
|
|
144
|
+
break;
|
|
145
|
+
case 'url':
|
|
146
|
+
type.name = 'string';
|
|
147
|
+
(0, utilities_1.CoerceArrayItems)(validatorList, ['IsUrl()']);
|
|
148
|
+
break;
|
|
149
|
+
case 'number':
|
|
150
|
+
type.name = 'number';
|
|
151
|
+
break;
|
|
152
|
+
case 'date':
|
|
153
|
+
case 'time':
|
|
154
|
+
case 'datetime-local':
|
|
155
|
+
type.name = 'Date';
|
|
156
|
+
(0, utilities_1.CoerceArrayItems)(validatorList, ['IsDate()']);
|
|
157
|
+
break;
|
|
158
|
+
case 'file':
|
|
159
|
+
case 'hidden':
|
|
160
|
+
case 'image':
|
|
161
|
+
case 'month':
|
|
162
|
+
case 'radio':
|
|
163
|
+
case 'reset':
|
|
164
|
+
case 'button':
|
|
165
|
+
case 'search':
|
|
166
|
+
case 'submit':
|
|
167
|
+
case 'week':
|
|
168
|
+
case 'range':
|
|
169
|
+
throw new Error(`The input type "${inputType}" is not yet supported`);
|
|
170
|
+
}
|
|
171
|
+
const formField = NormalizeFormField((_d = control.formField) !== null && _d !== void 0 ? _d : {}, importList, { label: control.label });
|
|
172
|
+
// TODO : auto add validators
|
|
173
|
+
return Object.freeze(Object.assign(Object.assign({}, NormalizeBaseFormControl(control)), { type,
|
|
174
|
+
validatorList, importList: (0, ts_morph_1.NormalizeTypeImportList)(importList), kind: FormControlKinds.INPUT, inputType, placeholder: (_e = control.placeholder) !== null && _e !== void 0 ? _e : null, formField }));
|
|
175
|
+
}
|
|
176
|
+
exports.NormalizeInputFormControl = NormalizeInputFormControl;
|
|
177
|
+
function IsNormalizedSelectFormControl(template) {
|
|
178
|
+
return template.kind === FormControlKinds.SELECT;
|
|
179
|
+
}
|
|
180
|
+
exports.IsNormalizedSelectFormControl = IsNormalizedSelectFormControl;
|
|
181
|
+
function NormalizeSelectFormControl(control) {
|
|
182
|
+
var _a, _b, _c, _d;
|
|
183
|
+
const importList = (_a = control.importList) !== null && _a !== void 0 ? _a : [];
|
|
184
|
+
importList.push({
|
|
185
|
+
name: 'MatSelectModule',
|
|
186
|
+
moduleSpecifier: '@angular/material/select',
|
|
187
|
+
});
|
|
188
|
+
const formField = NormalizeFormField((_b = control.formField) !== null && _b !== void 0 ? _b : {}, importList, { label: control.label });
|
|
189
|
+
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 }));
|
|
190
|
+
}
|
|
191
|
+
exports.NormalizeSelectFormControl = NormalizeSelectFormControl;
|
|
192
|
+
function IsNormalizedCheckboxFormControl(template) {
|
|
193
|
+
return template.kind === FormControlKinds.CHECKBOX;
|
|
194
|
+
}
|
|
195
|
+
exports.IsNormalizedCheckboxFormControl = IsNormalizedCheckboxFormControl;
|
|
196
|
+
function NormalizeCheckboxFormControl(control) {
|
|
197
|
+
var _a;
|
|
198
|
+
return Object.freeze(Object.assign(Object.assign({}, NormalizeBaseFormControl(control)), { kind: FormControlKinds.CHECKBOX, labelPosition: (_a = control.labelPosition) !== null && _a !== void 0 ? _a : 'after' }));
|
|
199
|
+
}
|
|
200
|
+
exports.NormalizeCheckboxFormControl = NormalizeCheckboxFormControl;
|
|
201
|
+
function IsNormalizedSlideToggleFormControl(template) {
|
|
202
|
+
return template.kind === FormControlKinds.CHECKBOX;
|
|
203
|
+
}
|
|
204
|
+
exports.IsNormalizedSlideToggleFormControl = IsNormalizedSlideToggleFormControl;
|
|
205
|
+
function NormalizeSlideToggleFormControl(control) {
|
|
206
|
+
var _a;
|
|
207
|
+
return Object.freeze(Object.assign(Object.assign({}, NormalizeBaseFormControl(control)), { kind: FormControlKinds.CHECKBOX, labelPosition: (_a = control.labelPosition) !== null && _a !== void 0 ? _a : 'after' }));
|
|
208
|
+
}
|
|
209
|
+
exports.NormalizeSlideToggleFormControl = NormalizeSlideToggleFormControl;
|
|
210
|
+
function NormalizeTableSelectColumn(column) {
|
|
211
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
212
|
+
let propertyPath = (_a = column.propertyPath) !== null && _a !== void 0 ? _a : null;
|
|
213
|
+
let name = column.name;
|
|
214
|
+
const namePrefix = (_c = (_b = name.match(/^(_+)/)) === null || _b === void 0 ? void 0 : _b[1]) !== null && _c !== void 0 ? _c : '';
|
|
215
|
+
propertyPath !== null && propertyPath !== void 0 ? propertyPath : (propertyPath = name
|
|
216
|
+
.replace(/\?\./g, '.')
|
|
217
|
+
.split('.')
|
|
218
|
+
.map((part) => (0, schematics_utilities_1.camelize)(part))
|
|
219
|
+
.join('?.'));
|
|
220
|
+
name = (0, utilities_1.dasherize)(name.replace(/\??\./g, '_'));
|
|
221
|
+
if (namePrefix) {
|
|
222
|
+
name = namePrefix + name;
|
|
223
|
+
propertyPath = namePrefix + propertyPath;
|
|
224
|
+
}
|
|
225
|
+
const kind = (_d = column.kind) !== null && _d !== void 0 ? _d : table_column_1.TableColumnKind.DEFAULT;
|
|
226
|
+
let type = (_e = column.type) !== null && _e !== void 0 ? _e : 'unknown';
|
|
227
|
+
const autoType = type ? typeof type === 'string' ? type : type.name : null;
|
|
228
|
+
if (!autoType || autoType === 'unknown') {
|
|
229
|
+
switch (kind) {
|
|
230
|
+
case table_column_1.TableColumnKind.DATE:
|
|
231
|
+
type = 'number | Date';
|
|
232
|
+
break;
|
|
233
|
+
case table_column_1.TableColumnKind.LINK:
|
|
234
|
+
type = 'string';
|
|
235
|
+
break;
|
|
236
|
+
case table_column_1.TableColumnKind.ICON:
|
|
237
|
+
// TODO : use the IconConfig type
|
|
238
|
+
type = {
|
|
239
|
+
name: 'IconConfig',
|
|
240
|
+
moduleSpecifier: '@rxap/utilities',
|
|
241
|
+
};
|
|
242
|
+
break;
|
|
243
|
+
case table_column_1.TableColumnKind.BOOLEAN:
|
|
244
|
+
type = 'boolean';
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
type !== null && type !== void 0 ? type : (type = 'unknown');
|
|
249
|
+
return Object.freeze({
|
|
250
|
+
name,
|
|
251
|
+
type: (0, ts_morph_1.NormalizeTypeImport)(type),
|
|
252
|
+
title: (_f = column.title) !== null && _f !== void 0 ? _f : (0, utilities_1.dasherize)(name).split('-').map(part => (0, utilities_1.capitalize)(part)).join(' '),
|
|
253
|
+
hasFilter: (_g = column.hasFilter) !== null && _g !== void 0 ? _g : false,
|
|
254
|
+
kind,
|
|
255
|
+
propertyPath,
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
exports.NormalizeTableSelectColumn = NormalizeTableSelectColumn;
|
|
259
|
+
function NormalizeTableSelectToFunction(toFunction, columnList) {
|
|
260
|
+
if (!toFunction || Object.keys(toFunction).length === 0) {
|
|
261
|
+
return Object.freeze({
|
|
262
|
+
property: (0, ts_morph_1.NormalizeDataProperty)(columnList[0].name),
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
return Object.freeze({
|
|
266
|
+
property: (0, ts_morph_1.NormalizeDataProperty)(toFunction.property),
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
exports.NormalizeTableSelectToFunction = NormalizeTableSelectToFunction;
|
|
270
|
+
function IsNormalizedTableSelectFormControl(template) {
|
|
271
|
+
return template.kind === FormControlKinds.TABLE_SELECT;
|
|
272
|
+
}
|
|
273
|
+
exports.IsNormalizedTableSelectFormControl = IsNormalizedTableSelectFormControl;
|
|
274
|
+
function NormalizeTableSelectFormControl(control) {
|
|
275
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
276
|
+
const importList = (_a = control.importList) !== null && _a !== void 0 ? _a : [];
|
|
277
|
+
importList.push({
|
|
278
|
+
name: 'TableSelectControlModule',
|
|
279
|
+
moduleSpecifier: '@digitaix/eurogard-table-select',
|
|
280
|
+
});
|
|
281
|
+
if (!((_b = control.columnList) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
282
|
+
throw new Error('The column list must not be empty');
|
|
283
|
+
}
|
|
284
|
+
const propertyList = (_c = control.propertyList) !== null && _c !== void 0 ? _c : [];
|
|
285
|
+
const toDisplay = NormalizeTableSelectToFunction(control.toDisplay, control.columnList);
|
|
286
|
+
const toValue = NormalizeTableSelectToFunction(control.toValue, control.columnList);
|
|
287
|
+
(0, utilities_1.CoerceArrayItems)(propertyList, [toDisplay.property, toValue.property], (a, b) => a.name === b.name);
|
|
288
|
+
const formField = NormalizeFormField((_d = control.formField) !== null && _d !== void 0 ? _d : {}, importList, {
|
|
289
|
+
label: control.label,
|
|
290
|
+
directiveList: [
|
|
291
|
+
{
|
|
292
|
+
name: 'eurogardTableSelectControl',
|
|
293
|
+
namedImport: 'TableSelectControlModule',
|
|
294
|
+
moduleSpecifier: '@digitaix/eurogard-table-select',
|
|
295
|
+
},
|
|
296
|
+
]
|
|
297
|
+
});
|
|
298
|
+
(_e = control.type) !== null && _e !== void 0 ? _e : (control.type = toValue.property.type);
|
|
299
|
+
return Object.freeze(Object.assign(Object.assign({}, NormalizeBaseFormControl(control)), { importList: (0, ts_morph_1.NormalizeTypeImportList)(importList), kind: FormControlKinds.TABLE_SELECT, formField, backend: (_f = control.backend) !== null && _f !== void 0 ? _f : backend_types_1.BackendTypes.NONE, title: (_g = control.title) !== null && _g !== void 0 ? _g : null, columnList: control.columnList.map(NormalizeTableSelectColumn), toDisplay,
|
|
300
|
+
toValue, propertyList: (0, ts_morph_1.NormalizeDataPropertyList)(propertyList), upstream: (0, ts_morph_1.NormalizeUpstreamOptions)(control.upstream) }));
|
|
301
|
+
}
|
|
302
|
+
exports.NormalizeTableSelectFormControl = NormalizeTableSelectFormControl;
|
|
303
|
+
// endregion
|
|
304
|
+
//# sourceMappingURL=form-control.js.map
|