@rxap/schematic-angular 16.2.0-dev.6 → 16.2.0-dev.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/README.md +1 -1
- package/package.json +4 -2
- 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 +2 -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 +6 -3
- package/src/lib/coerce-minimum-table-component.js.map +1 -1
- package/src/lib/coerce-tree-table-component.js +2 -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 +303 -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 +1 -1
- package/src/lib/minimum-table-component-options.js +3 -3
- package/src/lib/minimum-table-component-options.js.map +1 -1
- package/src/lib/table-column.d.ts +8 -2
- package/src/lib/table-column.js +32 -15
- package/src/lib/table-column.js.map +1 -1
- 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/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 +42 -42
- 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/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/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/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/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 +10 -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/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 +21 -7
- package/src/schematics/data-grid-component/index.js.map +1 -1
- 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/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/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/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 -68
- 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/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 +4 -1
- package/src/schematics/form/form-component/index.js.map +1 -1
- 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/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/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/template.schema.json +61 -0
- package/src/schematics/table/action/form-table-action/template.schema.json +75 -0
- package/src/schematics/table/action/navigation-table-action/template.schema.json +31 -0
- package/src/schematics/table/action/open-api-table-action/template.schema.json +59 -0
- package/src/schematics/table/action/operation-table-action/template.schema.json +17 -0
- 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/template.schema.json +31 -0
- 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 +1 -1
- package/src/schematics/table/table-component/index.js +2 -2
- package/src/schematics/table/table-component/index.js.map +1 -1
- package/src/schematics/table/table-component/template.schema.json +26 -0
- 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/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/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/accordion/accordion-component/schema.json +0 -191
- package/src/schematics/accordion/accordion-item-component/schema.json +0 -92
- package/src/schematics/accordion/item/accordion-item-data-grid-component/schema.json +0 -133
- package/src/schematics/accordion/item/accordion-item-switch-component/schema.json +0 -226
- package/src/schematics/accordion/item/accordion-item-table-component/schema.json +0 -334
- package/src/schematics/accordion/item/accordion-item-tree-table-component/schema.json +0 -334
- 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/data-grid-component/schema.json +0 -176
- package/src/schematics/dialog-component/schema.json +0 -81
- package/src/schematics/form/control/input-form-control/schema.json +0 -116
- package/src/schematics/form/control/select-form-control/schema.json +0 -102
- package/src/schematics/form/control/table-select-form-control/schema.json +0 -106
- package/src/schematics/form/form-component/schema.json +0 -173
- package/src/schematics/form/form-control/schema.json +0 -92
- package/src/schematics/form/form-definition/schema.json +0 -148
- package/src/schematics/table/action/dialog-table-action/schema.json +0 -148
- package/src/schematics/table/action/form-table-action/schema.json +0 -202
- package/src/schematics/table/action/navigation-table-action/schema.json +0 -95
- package/src/schematics/table/action/open-api-table-action/schema.json +0 -121
- package/src/schematics/table/action/operation-table-action/schema.json +0 -98
- package/src/schematics/table/header-button/form-table-header-button/schema.json +0 -139
- package/src/schematics/table/header-button/navigation-table-header-button/schema.json +0 -87
- package/src/schematics/table/table-action/schema.json +0 -94
- package/src/schematics/table/table-component/files/component/__componentName__.component.html.template +0 -299
- package/src/schematics/table/table-component/schema.json +0 -340
- package/src/schematics/table/table-header-button/schema.json +0 -80
- package/src/schematics/table/tree-table-component/files/component/__componentName__.component.html.template +0 -259
- package/src/schematics/table/tree-table-component/schema.json +0 -316
- package/src/schematics/tree-component/schema.json +0 -86
|
@@ -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,303 @@
|
|
|
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;
|
|
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
|
+
return Object.freeze(Object.assign(Object.assign({}, NormalizeBaseFormControl(control)), { importList: (0, ts_morph_1.NormalizeTypeImportList)(importList), kind: FormControlKinds.TABLE_SELECT, formField, backend: (_e = control.backend) !== null && _e !== void 0 ? _e : backend_types_1.BackendTypes.NONE, title: (_f = control.title) !== null && _f !== void 0 ? _f : null, columnList: control.columnList.map(NormalizeTableSelectColumn), toDisplay,
|
|
299
|
+
toValue, propertyList: (0, ts_morph_1.NormalizeDataPropertyList)(propertyList), upstream: (0, ts_morph_1.NormalizeUpstreamOptions)(control.upstream) }));
|
|
300
|
+
}
|
|
301
|
+
exports.NormalizeTableSelectFormControl = NormalizeTableSelectFormControl;
|
|
302
|
+
// endregion
|
|
303
|
+
//# sourceMappingURL=form-control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-control.js","sourceRoot":"","sources":["../../../../../../packages/schematic/angular/src/lib/form-control.ts"],"names":[],"mappings":";;;AAAA,qEAAsD;AACtD,6CAYwB;AACxB,+CAOyB;AAEzB,+BAA4B;AAC5B,mDAA+C;AAC/C,yEAAoE;AACpE,iDAIwB;AAExB,gCAAgC;AAEhC,IAAY,gBAOX;AAPD,WAAY,gBAAgB;IAC1B,uCAAmB,CAAA;IACnB,mCAAe,CAAA;IACf,qCAAiB,CAAA;IACjB,yCAAqB,CAAA;IACrB,iDAA6B,CAAA;IAC7B,iDAA6B,CAAA;AAC/B,CAAC,EAPW,gBAAgB,gCAAhB,gBAAgB,QAO3B;AAuBD,SAAgB,wBAAwB,CACtC,OAAwB;;IAExB,MAAM,IAAI,GAAW,OAAO,CAAC,IAAI,CAAC;IAClC,MAAM,IAAI,GAAyB,IAAA,8BAAmB,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACrE,MAAM,KAAK,GAAkB,MAAA,OAAO,CAAC,KAAK,mCAAI,IAAI,CAAC;IACnD,MAAM,UAAU,GAAY,MAAA,OAAO,CAAC,UAAU,mCAAI,KAAK,CAAC;IACxD,MAAM,aAAa,GAAa,MAAA,OAAO,CAAC,aAAa,mCAAI,EAAE,CAAC;IAC5D,MAAM,UAAU,GAAG,CAAC,MAAA,OAAO,CAAC,UAAU,mCAAI,EAAE,CAAC,CAAC;IAC9C,MAAM,UAAU,GAAY,MAAA,OAAO,CAAC,UAAU,mCAAI,KAAK,CAAC;IACxD,MAAM,UAAU,GAAY,MAAA,OAAO,CAAC,UAAU,mCAAI,KAAK,CAAC;IACxD,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;QAC5B,OAAO,GAAG,I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B,EAAC,YAAY,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC;IACpG,MAAM,SAAS,GAAG,kBAAkB,CAClC,MAAA,OAAO,CAAC,SAAS,mCAAI,EAAE,EACvB,UAAU,EACV;QACE,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,aAAa,EAAE;YACb;gBACE,IAAI,EAAE,4BAA4B;gBAClC,WAAW,EAAE,0BAA0B;gBACvC,eAAe,EAAE,iCAAiC;aACnD;SACF;KACF,CACF,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,iCACf,wBAAwB,CAAC,OAAO,CAAC,KACpC,UAAU,EAAE,IAAA,kCAAuB,EAAC,UAAU,CAAC,EAC/C,IAAI,EAAE,gBAAgB,CAAC,YAAY,EACnC,SAAS,EACT,OAAO,EAAE,MAAA,OAAO,CAAC,OAAO,mCAAI,4BAAY,CAAC,IAAI,EAC7C,KAAK,EAAE,MAAA,OAAO,CAAC,KAAK,mCAAI,IAAI,EAC5B,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,0BAA0B,CAAC,EAC9D,SAAS;QACT,OAAO,EACP,YAAY,EAAE,IAAA,oCAAyB,EAAC,YAAY,CAAC,EACrD,QAAQ,EAAE,IAAA,mCAAwB,EAAC,OAAO,CAAC,QAAQ,CAAC,IACpD,CAAC;AACL,CAAC;AA1CD,0EA0CC;AAED,YAAY"}
|
|
@@ -1,59 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { NormalizedTypeImport } from '@rxap/ts-morph';
|
|
5
|
-
export declare enum FormControlTemplateType {
|
|
6
|
-
DEFAULT = "default",
|
|
7
|
-
INPUT = "input",
|
|
8
|
-
SELECT = "select"
|
|
9
|
-
}
|
|
10
|
-
export interface BaseFormControlTemplate {
|
|
11
|
-
name: FormControlTemplateType;
|
|
12
|
-
}
|
|
13
|
-
export interface MinimalNormalizedFormDefinitionControl {
|
|
14
|
-
type: TypeImport;
|
|
15
|
-
validatorList: string[];
|
|
16
|
-
importList: TypeImport[];
|
|
17
|
-
}
|
|
18
|
-
export interface InputFormControlTemplate extends BaseFormControlTemplate {
|
|
19
|
-
type?: string;
|
|
20
|
-
placeholder?: string;
|
|
21
|
-
label?: string;
|
|
22
|
-
}
|
|
23
|
-
export interface NormalizedInputFormControlTemplate extends Readonly<Normalized<InputFormControlTemplate>>, BaseFormControlTemplate {
|
|
24
|
-
name: FormControlTemplateType.INPUT;
|
|
25
|
-
}
|
|
26
|
-
export declare function IsNormalizedInputFormControlTemplate(template: BaseFormControlTemplate): template is NormalizedInputFormControlTemplate;
|
|
27
|
-
export declare function NormalizeInputFormControlTemplate(template: InputFormControlTemplate, normalizedControl: MinimalNormalizedFormDefinitionControl): NormalizedInputFormControlTemplate;
|
|
28
|
-
export interface SelectFormControlTemplate extends BaseFormControlTemplate {
|
|
29
|
-
label?: string;
|
|
30
|
-
options?: ControlOption[];
|
|
31
|
-
backend?: BackendTypes;
|
|
32
|
-
}
|
|
33
|
-
export interface NormalizedSelectFormControlTemplate extends Readonly<Normalized<Omit<SelectFormControlTemplate, 'options'>>>, BaseFormControlTemplate {
|
|
34
|
-
name: FormControlTemplateType.SELECT;
|
|
35
|
-
options: ReadonlyArray<ControlOption> | null;
|
|
36
|
-
backend: BackendTypes;
|
|
37
|
-
}
|
|
38
|
-
export declare function IsNormalizedSelectFormControlTemplate(template: BaseFormControlTemplate): template is NormalizedSelectFormControlTemplate;
|
|
39
|
-
export declare function NormalizeSelectFormControlTemplate(template: SelectFormControlTemplate, normalizedControl: MinimalNormalizedFormDefinitionControl): NormalizedSelectFormControlTemplate;
|
|
40
|
-
export interface FormDefinitionControl {
|
|
41
|
-
name: string;
|
|
42
|
-
type?: string | TypeImport;
|
|
43
|
-
isArray?: boolean;
|
|
44
|
-
state?: string;
|
|
45
|
-
isRequired?: boolean;
|
|
46
|
-
isReadonly?: boolean;
|
|
47
|
-
isDisabled?: boolean;
|
|
48
|
-
validatorList?: string[];
|
|
49
|
-
importList?: TypeImport[];
|
|
50
|
-
template?: BaseFormControlTemplate;
|
|
51
|
-
}
|
|
52
|
-
export interface NormalizedFormDefinitionControl extends Readonly<Normalized<FormDefinitionControl>> {
|
|
53
|
-
type: NormalizedTypeImport;
|
|
54
|
-
template: BaseFormControlTemplate;
|
|
55
|
-
importList: NormalizedTypeImport[];
|
|
56
|
-
}
|
|
57
|
-
export declare function NormalizeFormControlTemplate(minimalNormalizedControl: MinimalNormalizedFormDefinitionControl, template?: BaseFormControlTemplate): BaseFormControlTemplate;
|
|
1
|
+
import { BaseFormControl, NormalizedBaseFormControl } from './form-control';
|
|
2
|
+
export type FormDefinitionControl = BaseFormControl;
|
|
3
|
+
export type NormalizedFormDefinitionControl = NormalizedBaseFormControl;
|
|
58
4
|
export declare function NormalizeFormDefinitionControl(control: FormDefinitionControl): NormalizedFormDefinitionControl;
|
|
59
5
|
export declare function NormalizeFormDefinitionControlList(controlList?: Array<FormDefinitionControl>): ReadonlyArray<NormalizedFormDefinitionControl>;
|