@tsed/schema-formio 7.0.0-alpha.2 → 7.0.0-beta.11
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/jest.config.js +14 -0
- package/lib/cjs/components/anyToComponent.js +28 -0
- package/lib/cjs/components/anyToComponent.js.map +1 -0
- package/lib/cjs/components/arrayToComponent.js +40 -0
- package/lib/cjs/components/arrayToComponent.js.map +1 -0
- package/lib/cjs/components/booleanToComponent.js +14 -0
- package/lib/cjs/components/booleanToComponent.js.map +1 -0
- package/lib/cjs/components/dateToComponent.js +57 -0
- package/lib/cjs/components/dateToComponent.js.map +1 -0
- package/lib/cjs/components/defaultToComponent.js +18 -0
- package/lib/cjs/components/defaultToComponent.js.map +1 -0
- package/lib/cjs/components/enumToComponent.js +33 -0
- package/lib/cjs/components/enumToComponent.js.map +1 -0
- package/lib/cjs/components/mapToComponent.js +20 -0
- package/lib/cjs/components/mapToComponent.js.map +1 -0
- package/lib/cjs/components/nestedToComponent.js +25 -0
- package/lib/cjs/components/nestedToComponent.js.map +1 -0
- package/lib/cjs/components/numberToComponent.js +21 -0
- package/lib/cjs/components/numberToComponent.js.map +1 -0
- package/lib/cjs/components/objectToEditGrid.js +16 -0
- package/lib/cjs/components/objectToEditGrid.js.map +1 -0
- package/lib/cjs/components/panelToComponent.js +16 -0
- package/lib/cjs/components/panelToComponent.js.map +1 -0
- package/lib/cjs/components/propertiesToComponents.js +88 -0
- package/lib/cjs/components/propertiesToComponents.js.map +1 -0
- package/lib/cjs/components/stringToComponent.js +43 -0
- package/lib/cjs/components/stringToComponent.js.map +1 -0
- package/lib/cjs/decorators/component.js +35 -0
- package/lib/cjs/decorators/component.js.map +1 -0
- package/lib/cjs/decorators/conditional.js +53 -0
- package/lib/cjs/decorators/conditional.js.map +1 -0
- package/lib/cjs/decorators/currency.js +24 -0
- package/lib/cjs/decorators/currency.js.map +1 -0
- package/lib/cjs/decorators/customClass.js +18 -0
- package/lib/cjs/decorators/customClass.js.map +1 -0
- package/lib/cjs/decorators/customConditional.js +33 -0
- package/lib/cjs/decorators/customConditional.js.map +1 -0
- package/lib/cjs/decorators/dataSourceJson.js +27 -0
- package/lib/cjs/decorators/dataSourceJson.js.map +1 -0
- package/lib/cjs/decorators/dataSourceUrl.js +22 -0
- package/lib/cjs/decorators/dataSourceUrl.js.map +1 -0
- package/lib/cjs/decorators/errorLabel.js +18 -0
- package/lib/cjs/decorators/errorLabel.js.map +1 -0
- package/lib/cjs/decorators/errorMessage.js +17 -0
- package/lib/cjs/decorators/errorMessage.js.map +1 -0
- package/lib/cjs/decorators/form.js +21 -0
- package/lib/cjs/decorators/form.js.map +1 -0
- package/lib/cjs/decorators/hidden.js +22 -0
- package/lib/cjs/decorators/hidden.js.map +1 -0
- package/lib/cjs/decorators/inputTags.js +23 -0
- package/lib/cjs/decorators/inputTags.js.map +1 -0
- package/lib/cjs/decorators/label.js +19 -0
- package/lib/cjs/decorators/label.js.map +1 -0
- package/lib/cjs/decorators/mask.js +50 -0
- package/lib/cjs/decorators/mask.js.map +1 -0
- package/lib/cjs/decorators/maxWords.js +17 -0
- package/lib/cjs/decorators/maxWords.js.map +1 -0
- package/lib/cjs/decorators/minWords.js +17 -0
- package/lib/cjs/decorators/minWords.js.map +1 -0
- package/lib/cjs/decorators/modalEdit.js +18 -0
- package/lib/cjs/decorators/modalEdit.js.map +1 -0
- package/lib/cjs/decorators/multiple.js +18 -0
- package/lib/cjs/decorators/multiple.js.map +1 -0
- package/lib/cjs/decorators/openWhenEmpty.js +18 -0
- package/lib/cjs/decorators/openWhenEmpty.js.map +1 -0
- package/lib/cjs/decorators/password.js +20 -0
- package/lib/cjs/decorators/password.js.map +1 -0
- package/lib/cjs/decorators/placeholder.js +19 -0
- package/lib/cjs/decorators/placeholder.js.map +1 -0
- package/lib/cjs/decorators/prefix.js +18 -0
- package/lib/cjs/decorators/prefix.js.map +1 -0
- package/lib/cjs/decorators/select.js +22 -0
- package/lib/cjs/decorators/select.js.map +1 -0
- package/lib/cjs/decorators/suffix.js +18 -0
- package/lib/cjs/decorators/suffix.js.map +1 -0
- package/lib/cjs/decorators/tableView.js +19 -0
- package/lib/cjs/decorators/tableView.js.map +1 -0
- package/lib/cjs/decorators/tabs.js +22 -0
- package/lib/cjs/decorators/tabs.js.map +1 -0
- package/lib/cjs/decorators/textCase.js +19 -0
- package/lib/cjs/decorators/textCase.js.map +1 -0
- package/lib/cjs/decorators/textarea.js +20 -0
- package/lib/cjs/decorators/textarea.js.map +1 -0
- package/lib/cjs/decorators/tooltip.js +19 -0
- package/lib/cjs/decorators/tooltip.js.map +1 -0
- package/lib/cjs/decorators/validate.js +22 -0
- package/lib/cjs/decorators/validate.js.map +1 -0
- package/lib/cjs/domain/FormioDataResolver.js +3 -0
- package/lib/cjs/domain/FormioDataResolver.js.map +1 -0
- package/lib/cjs/index.js +56 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/package.json +3 -0
- package/lib/cjs/registries/FormioMappersContainer.js +21 -0
- package/lib/cjs/registries/FormioMappersContainer.js.map +1 -0
- package/lib/cjs/registries/FormsContainer.js +6 -0
- package/lib/cjs/registries/FormsContainer.js.map +1 -0
- package/lib/cjs/utils/getFormioProps.js +17 -0
- package/lib/cjs/utils/getFormioProps.js.map +1 -0
- package/lib/cjs/utils/getFormioSchema.js +54 -0
- package/lib/cjs/utils/getFormioSchema.js.map +1 -0
- package/lib/cjs/utils/getRef.js +12 -0
- package/lib/cjs/utils/getRef.js.map +1 -0
- package/lib/esm/components/anyToComponent.js +24 -0
- package/lib/esm/components/anyToComponent.js.map +1 -0
- package/lib/esm/components/arrayToComponent.js +36 -0
- package/lib/esm/components/arrayToComponent.js.map +1 -0
- package/lib/esm/components/booleanToComponent.js +12 -0
- package/lib/esm/components/booleanToComponent.js.map +1 -0
- package/lib/esm/components/dateToComponent.js +55 -0
- package/lib/esm/components/dateToComponent.js.map +1 -0
- package/lib/esm/components/defaultToComponent.js +14 -0
- package/lib/esm/components/defaultToComponent.js.map +1 -0
- package/lib/esm/components/enumToComponent.js +29 -0
- package/lib/esm/components/enumToComponent.js.map +1 -0
- package/lib/esm/components/mapToComponent.js +16 -0
- package/lib/esm/components/mapToComponent.js.map +1 -0
- package/lib/esm/components/nestedToComponent.js +21 -0
- package/lib/esm/components/nestedToComponent.js.map +1 -0
- package/lib/esm/components/numberToComponent.js +17 -0
- package/lib/esm/components/numberToComponent.js.map +1 -0
- package/lib/esm/components/objectToEditGrid.js +12 -0
- package/lib/esm/components/objectToEditGrid.js.map +1 -0
- package/lib/esm/components/panelToComponent.js +12 -0
- package/lib/esm/components/panelToComponent.js.map +1 -0
- package/lib/esm/components/propertiesToComponents.js +84 -0
- package/lib/esm/components/propertiesToComponents.js.map +1 -0
- package/lib/esm/components/stringToComponent.js +39 -0
- package/lib/esm/components/stringToComponent.js.map +1 -0
- package/lib/esm/decorators/component.js +31 -0
- package/lib/esm/decorators/component.js.map +1 -0
- package/lib/esm/decorators/conditional.js +47 -0
- package/lib/esm/decorators/conditional.js.map +1 -0
- package/lib/esm/decorators/currency.js +20 -0
- package/lib/esm/decorators/currency.js.map +1 -0
- package/lib/esm/decorators/customClass.js +14 -0
- package/lib/esm/decorators/customClass.js.map +1 -0
- package/lib/esm/decorators/customConditional.js +29 -0
- package/lib/esm/decorators/customConditional.js.map +1 -0
- package/lib/esm/decorators/dataSourceJson.js +23 -0
- package/lib/esm/decorators/dataSourceJson.js.map +1 -0
- package/lib/esm/decorators/dataSourceUrl.js +18 -0
- package/lib/esm/decorators/dataSourceUrl.js.map +1 -0
- package/lib/esm/decorators/errorLabel.js +14 -0
- package/lib/esm/decorators/errorLabel.js.map +1 -0
- package/lib/esm/decorators/errorMessage.js +13 -0
- package/lib/esm/decorators/errorMessage.js.map +1 -0
- package/lib/esm/decorators/form.js +17 -0
- package/lib/esm/decorators/form.js.map +1 -0
- package/lib/esm/decorators/hidden.js +18 -0
- package/lib/esm/decorators/hidden.js.map +1 -0
- package/lib/esm/decorators/inputTags.js +19 -0
- package/lib/esm/decorators/inputTags.js.map +1 -0
- package/lib/esm/decorators/label.js +15 -0
- package/lib/esm/decorators/label.js.map +1 -0
- package/lib/esm/decorators/mask.js +45 -0
- package/lib/esm/decorators/mask.js.map +1 -0
- package/lib/esm/decorators/maxWords.js +13 -0
- package/lib/esm/decorators/maxWords.js.map +1 -0
- package/lib/esm/decorators/minWords.js +13 -0
- package/lib/esm/decorators/minWords.js.map +1 -0
- package/lib/esm/decorators/modalEdit.js +14 -0
- package/lib/esm/decorators/modalEdit.js.map +1 -0
- package/lib/esm/decorators/multiple.js +14 -0
- package/lib/esm/decorators/multiple.js.map +1 -0
- package/lib/esm/decorators/openWhenEmpty.js +14 -0
- package/lib/esm/decorators/openWhenEmpty.js.map +1 -0
- package/lib/esm/decorators/password.js +16 -0
- package/lib/esm/decorators/password.js.map +1 -0
- package/lib/esm/decorators/placeholder.js +15 -0
- package/lib/esm/decorators/placeholder.js.map +1 -0
- package/lib/esm/decorators/prefix.js +14 -0
- package/lib/esm/decorators/prefix.js.map +1 -0
- package/lib/esm/decorators/select.js +18 -0
- package/lib/esm/decorators/select.js.map +1 -0
- package/lib/esm/decorators/suffix.js +14 -0
- package/lib/esm/decorators/suffix.js.map +1 -0
- package/lib/esm/decorators/tableView.js +15 -0
- package/lib/esm/decorators/tableView.js.map +1 -0
- package/lib/esm/decorators/tabs.js +18 -0
- package/lib/esm/decorators/tabs.js.map +1 -0
- package/lib/esm/decorators/textCase.js +15 -0
- package/lib/esm/decorators/textCase.js.map +1 -0
- package/lib/esm/decorators/textarea.js +16 -0
- package/lib/esm/decorators/textarea.js.map +1 -0
- package/lib/esm/decorators/tooltip.js +15 -0
- package/lib/esm/decorators/tooltip.js.map +1 -0
- package/lib/esm/decorators/validate.js +18 -0
- package/lib/esm/decorators/validate.js.map +1 -0
- package/lib/esm/domain/FormioDataResolver.js +2 -0
- package/lib/esm/domain/FormioDataResolver.js.map +1 -0
- package/lib/esm/index.js +53 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/package.json +3 -0
- package/lib/esm/registries/FormioMappersContainer.js +15 -0
- package/lib/esm/registries/FormioMappersContainer.js.map +1 -0
- package/lib/esm/registries/FormsContainer.js +3 -0
- package/lib/esm/registries/FormsContainer.js.map +1 -0
- package/lib/esm/utils/getFormioProps.js +13 -0
- package/lib/esm/utils/getFormioProps.js.map +1 -0
- package/lib/esm/utils/getFormioSchema.js +50 -0
- package/lib/esm/utils/getFormioSchema.js.map +1 -0
- package/lib/esm/utils/getRef.js +8 -0
- package/lib/esm/utils/getRef.js.map +1 -0
- package/lib/{components → types/components}/anyToComponent.d.ts +0 -0
- package/lib/{components → types/components}/arrayToComponent.d.ts +0 -0
- package/lib/{components → types/components}/booleanToComponent.d.ts +0 -0
- package/lib/{components → types/components}/dateToComponent.d.ts +0 -0
- package/lib/{components → types/components}/defaultToComponent.d.ts +0 -0
- package/lib/{components → types/components}/enumToComponent.d.ts +0 -0
- package/lib/{components → types/components}/mapToComponent.d.ts +0 -0
- package/lib/{components → types/components}/nestedToComponent.d.ts +0 -0
- package/lib/{components → types/components}/numberToComponent.d.ts +0 -0
- package/lib/{components → types/components}/objectToEditGrid.d.ts +0 -0
- package/lib/{components → types/components}/panelToComponent.d.ts +0 -0
- package/lib/{components → types/components}/propertiesToComponents.d.ts +0 -0
- package/lib/{components → types/components}/stringToComponent.d.ts +0 -0
- package/lib/{decorators → types/decorators}/component.d.ts +0 -0
- package/lib/types/decorators/conditional.d.ts +33 -0
- package/lib/{decorators → types/decorators}/currency.d.ts +0 -0
- package/lib/types/decorators/customClass.d.ts +8 -0
- package/lib/types/decorators/customConditional.d.ts +59 -0
- package/lib/types/decorators/dataSourceJson.d.ts +8 -0
- package/lib/types/decorators/dataSourceUrl.d.ts +8 -0
- package/lib/types/decorators/errorLabel.d.ts +8 -0
- package/lib/types/decorators/errorMessage.d.ts +9 -0
- package/lib/types/decorators/form.d.ts +6 -0
- package/lib/{decorators → types/decorators}/hidden.d.ts +3 -0
- package/lib/{decorators → types/decorators}/inputTags.d.ts +0 -0
- package/lib/types/decorators/label.d.ts +9 -0
- package/lib/types/decorators/mask.d.ts +37 -0
- package/lib/types/decorators/maxWords.d.ts +9 -0
- package/lib/types/decorators/minWords.d.ts +9 -0
- package/lib/types/decorators/modalEdit.d.ts +8 -0
- package/lib/{decorators → types/decorators}/multiple.d.ts +0 -0
- package/lib/types/decorators/openWhenEmpty.d.ts +8 -0
- package/lib/types/decorators/password.d.ts +12 -0
- package/lib/types/decorators/placeholder.d.ts +9 -0
- package/lib/types/decorators/prefix.d.ts +8 -0
- package/lib/types/decorators/select.d.ts +14 -0
- package/lib/types/decorators/suffix.d.ts +8 -0
- package/lib/{decorators → types/decorators}/tableView.d.ts +0 -0
- package/lib/{decorators → types/decorators}/tabs.d.ts +0 -0
- package/lib/types/decorators/textCase.d.ts +9 -0
- package/lib/types/decorators/textarea.d.ts +12 -0
- package/lib/types/decorators/tooltip.d.ts +9 -0
- package/lib/types/decorators/validate.d.ts +10 -0
- package/lib/types/domain/FormioDataResolver.d.ts +7 -0
- package/lib/types/index.d.ts +52 -0
- package/lib/{registries → types/registries}/FormioMappersContainer.d.ts +0 -0
- package/lib/types/registries/FormsContainer.d.ts +2 -0
- package/lib/{utils → types/utils}/getFormioProps.d.ts +0 -0
- package/lib/types/utils/getFormioSchema.d.ts +16 -0
- package/lib/{utils → types/utils}/getRef.d.ts +0 -0
- package/package.json +48 -21
- package/readme.md +10 -6
- package/tsconfig.compile.esm.json +12 -0
- package/.mocharc.js +0 -5
- package/.nycrc +0 -26
- package/lib/components/index.d.ts +0 -13
- package/lib/decorators/dataSourceJson.d.ts +0 -7
- package/lib/decorators/dataSourceUrl.d.ts +0 -7
- package/lib/decorators/index.d.ts +0 -11
- package/lib/decorators/password.d.ts +0 -8
- package/lib/decorators/select.d.ts +0 -8
- package/lib/decorators/textarea.d.ts +0 -8
- package/lib/index.d.ts +0 -4
- package/lib/index.js +0 -585
- package/lib/index.js.map +0 -1
- package/lib/index.modern.js +0 -562
- package/lib/index.modern.js.map +0 -1
- package/lib/utils/getFormioSchema.d.ts +0 -11
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tableView.js","sourceRoot":"","sources":["../../../src/decorators/tableView.ts"],"names":[],"mappings":";;;AAAA,2CAAsC;AAEtC;;;;;;;GAOG;AACH,SAAgB,SAAS,CAAC,IAAa;IACrC,OAAO,IAAA,qBAAS,EAAC;QACf,SAAS,EAAE,IAAI;KAChB,CAAC,CAAC;AACL,CAAC;AAJD,8BAIC","sourcesContent":["import {Component} from \"./component\";\n\n/**\n * Change the visibility of the current property on a table.\n * @param bool\n * @decorator\n * @formio\n * @property\n * @schema\n */\nexport function TableView(bool: boolean): PropertyDecorator {\n return Component({\n tableView: bool\n });\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Tabs = void 0;
|
|
4
|
+
const schema_1 = require("@tsed/schema");
|
|
5
|
+
const change_case_1 = require("change-case");
|
|
6
|
+
/**
|
|
7
|
+
* Group the current property in tabs components.
|
|
8
|
+
* @decorator
|
|
9
|
+
* @formio
|
|
10
|
+
* @property
|
|
11
|
+
* @schema
|
|
12
|
+
*/
|
|
13
|
+
function Tabs(label) {
|
|
14
|
+
return (0, schema_1.JsonEntityFn)((store) => {
|
|
15
|
+
store.schema.customKey("x-formiotabs", {
|
|
16
|
+
key: (0, change_case_1.camelCase)(label),
|
|
17
|
+
label
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
exports.Tabs = Tabs;
|
|
22
|
+
//# sourceMappingURL=tabs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.js","sourceRoot":"","sources":["../../../src/decorators/tabs.ts"],"names":[],"mappings":";;;AAAA,yCAA2D;AAC3D,6CAAsC;AAEtC;;;;;;GAMG;AACH,SAAgB,IAAI,CAAC,KAAa;IAChC,OAAO,IAAA,qBAAY,EAAC,CAAC,KAAsB,EAAE,EAAE;QAC7C,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,EAAE;YACrC,GAAG,EAAE,IAAA,uBAAS,EAAC,KAAK,CAAC;YACrB,KAAK;SACN,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAPD,oBAOC","sourcesContent":["import {JsonEntityFn, JsonEntityStore} from \"@tsed/schema\";\nimport {camelCase} from \"change-case\";\n\n/**\n * Group the current property in tabs components.\n * @decorator\n * @formio\n * @property\n * @schema\n */\nexport function Tabs(label: string) {\n return JsonEntityFn((store: JsonEntityStore) => {\n store.schema.customKey(\"x-formiotabs\", {\n key: camelCase(label),\n label\n });\n });\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextCase = void 0;
|
|
4
|
+
const component_1 = require("./component");
|
|
5
|
+
/**
|
|
6
|
+
* Force the output of this field to be sanitized in a specific format.
|
|
7
|
+
* @decorator
|
|
8
|
+
* @formio
|
|
9
|
+
* @property
|
|
10
|
+
* @schema
|
|
11
|
+
* @param textCase
|
|
12
|
+
*/
|
|
13
|
+
function TextCase(textCase) {
|
|
14
|
+
return (0, component_1.Component)({
|
|
15
|
+
case: textCase
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
exports.TextCase = TextCase;
|
|
19
|
+
//# sourceMappingURL=textCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textCase.js","sourceRoot":"","sources":["../../../src/decorators/textCase.ts"],"names":[],"mappings":";;;AAAA,2CAAsC;AAEtC;;;;;;;GAOG;AACH,SAAgB,QAAQ,CAAC,QAAmC;IAC1D,OAAO,IAAA,qBAAS,EAAC;QACf,IAAI,EAAE,QAAQ;KACf,CAAC,CAAC;AACL,CAAC;AAJD,4BAIC","sourcesContent":["import {Component} from \"./component\";\n\n/**\n * Force the output of this field to be sanitized in a specific format.\n * @decorator\n * @formio\n * @property\n * @schema\n * @param textCase\n */\nexport function TextCase(textCase: \"uppercase\" | \"lowercase\") {\n return Component({\n case: textCase\n });\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Textarea = void 0;
|
|
4
|
+
const component_1 = require("./component");
|
|
5
|
+
/**
|
|
6
|
+
* Configure the property as Textarea component.
|
|
7
|
+
* @decorator
|
|
8
|
+
* @formio
|
|
9
|
+
* @property
|
|
10
|
+
* @schema
|
|
11
|
+
*/
|
|
12
|
+
function Textarea(props = {}) {
|
|
13
|
+
return (0, component_1.Component)({
|
|
14
|
+
autoExpand: false,
|
|
15
|
+
...props,
|
|
16
|
+
type: "textarea"
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
exports.Textarea = Textarea;
|
|
20
|
+
//# sourceMappingURL=textarea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textarea.js","sourceRoot":"","sources":["../../../src/decorators/textarea.ts"],"names":[],"mappings":";;;AAAA,2CAAsC;AAOtC;;;;;;GAMG;AACH,SAAgB,QAAQ,CAAC,QAAsB,EAAE;IAC/C,OAAO,IAAA,qBAAS,EAAC;QACf,UAAU,EAAE,KAAK;QACjB,GAAG,KAAK;QACR,IAAI,EAAE,UAAU;KACjB,CAAC,CAAC;AACL,CAAC;AAND,4BAMC","sourcesContent":["import {Component} from \"./component\";\n\nexport interface TextareaOpts extends Record<string, any> {\n showCharCount?: boolean;\n showWordCount?: boolean;\n}\n\n/**\n * Configure the property as Textarea component.\n * @decorator\n * @formio\n * @property\n * @schema\n */\nexport function Textarea(props: TextareaOpts = {}): PropertyDecorator {\n return Component({\n autoExpand: false,\n ...props,\n type: \"textarea\"\n });\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Tooltip = void 0;
|
|
4
|
+
const component_1 = require("./component");
|
|
5
|
+
/**
|
|
6
|
+
* Adds a tooltip to the side of this field.
|
|
7
|
+
* @decorator
|
|
8
|
+
* @formio
|
|
9
|
+
* @property
|
|
10
|
+
* @schema
|
|
11
|
+
* @param tooltip
|
|
12
|
+
*/
|
|
13
|
+
function Tooltip(tooltip) {
|
|
14
|
+
return (0, component_1.Component)({
|
|
15
|
+
tooltip
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
exports.Tooltip = Tooltip;
|
|
19
|
+
//# sourceMappingURL=tooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltip.js","sourceRoot":"","sources":["../../../src/decorators/tooltip.ts"],"names":[],"mappings":";;;AAAA,2CAAsC;AAEtC;;;;;;;GAOG;AACH,SAAgB,OAAO,CAAC,OAAe;IACrC,OAAO,IAAA,qBAAS,EAAC;QACf,OAAO;KACR,CAAC,CAAC;AACL,CAAC;AAJD,0BAIC","sourcesContent":["import {Component} from \"./component\";\n\n/**\n * Adds a tooltip to the side of this field.\n * @decorator\n * @formio\n * @property\n * @schema\n * @param tooltip\n */\nexport function Tooltip(tooltip: string) {\n return Component({\n tooltip\n });\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Validate = void 0;
|
|
4
|
+
const component_1 = require("./component");
|
|
5
|
+
/**
|
|
6
|
+
* Add validation rules.
|
|
7
|
+
* @decorator
|
|
8
|
+
* @formio
|
|
9
|
+
* @property
|
|
10
|
+
* @schema
|
|
11
|
+
* @param key
|
|
12
|
+
* @param value
|
|
13
|
+
*/
|
|
14
|
+
function Validate(key, value) {
|
|
15
|
+
return (0, component_1.Component)({
|
|
16
|
+
validate: {
|
|
17
|
+
[key]: value
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
exports.Validate = Validate;
|
|
22
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/decorators/validate.ts"],"names":[],"mappings":";;;AAAA,2CAAsC;AAEtC;;;;;;;;GAQG;AACH,SAAgB,QAAQ,CAAC,GAAW,EAAE,KAAU;IAC9C,OAAO,IAAA,qBAAS,EAAC;QACf,QAAQ,EAAE;YACR,CAAC,GAAG,CAAC,EAAE,KAAK;SACb;KACF,CAAC,CAAC;AACL,CAAC;AAND,4BAMC","sourcesContent":["import {Component} from \"./component\";\n\n/**\n * Add validation rules.\n * @decorator\n * @formio\n * @property\n * @schema\n * @param key\n * @param value\n */\nexport function Validate(key: string, value: any) {\n return Component({\n validate: {\n [key]: value\n }\n });\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormioDataResolver.js","sourceRoot":"","sources":["../../../src/domain/FormioDataResolver.ts"],"names":[],"mappings":"","sourcesContent":["import {FormioComponent, FormioForm} from \"@tsed/formio-types\";\nimport {JsonSchemaOptions} from \"@tsed/schema\";\n\nexport type FormioDataResolverCtx = {component: FormioComponent; form: FormioForm} & JsonSchemaOptions;\nexport type FormioDataResolver = (ctx: FormioDataResolverCtx) => Promise<any> | any;\n"]}
|
package/lib/cjs/index.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file Automatically generated by barrelsby.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
7
|
+
tslib_1.__exportStar(require("./components/anyToComponent"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./components/arrayToComponent"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./components/booleanToComponent"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./components/dateToComponent"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./components/defaultToComponent"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./components/enumToComponent"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./components/mapToComponent"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./components/nestedToComponent"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./components/numberToComponent"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./components/objectToEditGrid"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./components/panelToComponent"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./components/propertiesToComponents"), exports);
|
|
19
|
+
tslib_1.__exportStar(require("./components/stringToComponent"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./decorators/component"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./decorators/conditional"), exports);
|
|
22
|
+
tslib_1.__exportStar(require("./decorators/currency"), exports);
|
|
23
|
+
tslib_1.__exportStar(require("./decorators/customClass"), exports);
|
|
24
|
+
tslib_1.__exportStar(require("./decorators/customConditional"), exports);
|
|
25
|
+
tslib_1.__exportStar(require("./decorators/dataSourceJson"), exports);
|
|
26
|
+
tslib_1.__exportStar(require("./decorators/dataSourceUrl"), exports);
|
|
27
|
+
tslib_1.__exportStar(require("./decorators/errorLabel"), exports);
|
|
28
|
+
tslib_1.__exportStar(require("./decorators/errorMessage"), exports);
|
|
29
|
+
tslib_1.__exportStar(require("./decorators/form"), exports);
|
|
30
|
+
tslib_1.__exportStar(require("./decorators/hidden"), exports);
|
|
31
|
+
tslib_1.__exportStar(require("./decorators/inputTags"), exports);
|
|
32
|
+
tslib_1.__exportStar(require("./decorators/label"), exports);
|
|
33
|
+
tslib_1.__exportStar(require("./decorators/mask"), exports);
|
|
34
|
+
tslib_1.__exportStar(require("./decorators/maxWords"), exports);
|
|
35
|
+
tslib_1.__exportStar(require("./decorators/minWords"), exports);
|
|
36
|
+
tslib_1.__exportStar(require("./decorators/modalEdit"), exports);
|
|
37
|
+
tslib_1.__exportStar(require("./decorators/multiple"), exports);
|
|
38
|
+
tslib_1.__exportStar(require("./decorators/openWhenEmpty"), exports);
|
|
39
|
+
tslib_1.__exportStar(require("./decorators/password"), exports);
|
|
40
|
+
tslib_1.__exportStar(require("./decorators/placeholder"), exports);
|
|
41
|
+
tslib_1.__exportStar(require("./decorators/prefix"), exports);
|
|
42
|
+
tslib_1.__exportStar(require("./decorators/select"), exports);
|
|
43
|
+
tslib_1.__exportStar(require("./decorators/suffix"), exports);
|
|
44
|
+
tslib_1.__exportStar(require("./decorators/tableView"), exports);
|
|
45
|
+
tslib_1.__exportStar(require("./decorators/tabs"), exports);
|
|
46
|
+
tslib_1.__exportStar(require("./decorators/textCase"), exports);
|
|
47
|
+
tslib_1.__exportStar(require("./decorators/textarea"), exports);
|
|
48
|
+
tslib_1.__exportStar(require("./decorators/tooltip"), exports);
|
|
49
|
+
tslib_1.__exportStar(require("./decorators/validate"), exports);
|
|
50
|
+
tslib_1.__exportStar(require("./domain/FormioDataResolver"), exports);
|
|
51
|
+
tslib_1.__exportStar(require("./registries/FormioMappersContainer"), exports);
|
|
52
|
+
tslib_1.__exportStar(require("./registries/FormsContainer"), exports);
|
|
53
|
+
tslib_1.__exportStar(require("./utils/getFormioProps"), exports);
|
|
54
|
+
tslib_1.__exportStar(require("./utils/getFormioSchema"), exports);
|
|
55
|
+
tslib_1.__exportStar(require("./utils/getRef"), exports);
|
|
56
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,sEAA4C;AAC5C,wEAA8C;AAC9C,0EAAgD;AAChD,uEAA6C;AAC7C,0EAAgD;AAChD,uEAA6C;AAC7C,sEAA4C;AAC5C,yEAA+C;AAC/C,yEAA+C;AAC/C,wEAA8C;AAC9C,wEAA8C;AAC9C,8EAAoD;AACpD,yEAA+C;AAC/C,iEAAuC;AACvC,mEAAyC;AACzC,gEAAsC;AACtC,mEAAyC;AACzC,yEAA+C;AAC/C,sEAA4C;AAC5C,qEAA2C;AAC3C,kEAAwC;AACxC,oEAA0C;AAC1C,4DAAkC;AAClC,8DAAoC;AACpC,iEAAuC;AACvC,6DAAmC;AACnC,4DAAkC;AAClC,gEAAsC;AACtC,gEAAsC;AACtC,iEAAuC;AACvC,gEAAsC;AACtC,qEAA2C;AAC3C,gEAAsC;AACtC,mEAAyC;AACzC,8DAAoC;AACpC,8DAAoC;AACpC,8DAAoC;AACpC,iEAAuC;AACvC,4DAAkC;AAClC,gEAAsC;AACtC,gEAAsC;AACtC,+DAAqC;AACrC,gEAAsC;AACtC,sEAA4C;AAC5C,8EAAoD;AACpD,sEAA4C;AAC5C,iEAAuC;AACvC,kEAAwC;AACxC,yDAA+B","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./components/anyToComponent\";\nexport * from \"./components/arrayToComponent\";\nexport * from \"./components/booleanToComponent\";\nexport * from \"./components/dateToComponent\";\nexport * from \"./components/defaultToComponent\";\nexport * from \"./components/enumToComponent\";\nexport * from \"./components/mapToComponent\";\nexport * from \"./components/nestedToComponent\";\nexport * from \"./components/numberToComponent\";\nexport * from \"./components/objectToEditGrid\";\nexport * from \"./components/panelToComponent\";\nexport * from \"./components/propertiesToComponents\";\nexport * from \"./components/stringToComponent\";\nexport * from \"./decorators/component\";\nexport * from \"./decorators/conditional\";\nexport * from \"./decorators/currency\";\nexport * from \"./decorators/customClass\";\nexport * from \"./decorators/customConditional\";\nexport * from \"./decorators/dataSourceJson\";\nexport * from \"./decorators/dataSourceUrl\";\nexport * from \"./decorators/errorLabel\";\nexport * from \"./decorators/errorMessage\";\nexport * from \"./decorators/form\";\nexport * from \"./decorators/hidden\";\nexport * from \"./decorators/inputTags\";\nexport * from \"./decorators/label\";\nexport * from \"./decorators/mask\";\nexport * from \"./decorators/maxWords\";\nexport * from \"./decorators/minWords\";\nexport * from \"./decorators/modalEdit\";\nexport * from \"./decorators/multiple\";\nexport * from \"./decorators/openWhenEmpty\";\nexport * from \"./decorators/password\";\nexport * from \"./decorators/placeholder\";\nexport * from \"./decorators/prefix\";\nexport * from \"./decorators/select\";\nexport * from \"./decorators/suffix\";\nexport * from \"./decorators/tableView\";\nexport * from \"./decorators/tabs\";\nexport * from \"./decorators/textCase\";\nexport * from \"./decorators/textarea\";\nexport * from \"./decorators/tooltip\";\nexport * from \"./decorators/validate\";\nexport * from \"./domain/FormioDataResolver\";\nexport * from \"./registries/FormioMappersContainer\";\nexport * from \"./registries/FormsContainer\";\nexport * from \"./utils/getFormioProps\";\nexport * from \"./utils/getFormioSchema\";\nexport * from \"./utils/getRef\";\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.execMapper = exports.getFormioMapper = exports.registerFormioMapper = void 0;
|
|
4
|
+
const FormioMappersContainer = new Map();
|
|
5
|
+
function registerFormioMapper(type, mapper) {
|
|
6
|
+
return FormioMappersContainer.set(type, mapper);
|
|
7
|
+
}
|
|
8
|
+
exports.registerFormioMapper = registerFormioMapper;
|
|
9
|
+
function getFormioMapper(type) {
|
|
10
|
+
// istanbul ignore next
|
|
11
|
+
if (!FormioMappersContainer.has(type)) {
|
|
12
|
+
throw new Error(`Formio ${type} mapper doesn't exists`);
|
|
13
|
+
}
|
|
14
|
+
return FormioMappersContainer.get(type);
|
|
15
|
+
}
|
|
16
|
+
exports.getFormioMapper = getFormioMapper;
|
|
17
|
+
function execMapper(type, schema, options) {
|
|
18
|
+
return getFormioMapper(type)(schema, options);
|
|
19
|
+
}
|
|
20
|
+
exports.execMapper = execMapper;
|
|
21
|
+
//# sourceMappingURL=FormioMappersContainer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormioMappersContainer.js","sourceRoot":"","sources":["../../../src/registries/FormioMappersContainer.ts"],"names":[],"mappings":";;;AAIA,MAAM,sBAAsB,GAA8B,IAAI,GAAG,EAAE,CAAC;AAEpE,SAAgB,oBAAoB,CAAC,IAAY,EAAE,MAAoB;IACrE,OAAO,sBAAsB,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAClD,CAAC;AAFD,oDAEC;AAED,SAAgB,eAAe,CAAC,IAAY;IAC1C,uBAAuB;IACvB,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QACrC,MAAM,IAAI,KAAK,CAAC,UAAU,IAAI,wBAAwB,CAAC,CAAC;KACzD;IACD,OAAO,sBAAsB,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC;AAC3C,CAAC;AAND,0CAMC;AAED,SAAgB,UAAU,CAAC,IAAY,EAAE,MAAW,EAAE,OAAY;IAChE,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAChD,CAAC;AAFD,gCAEC","sourcesContent":["export interface FormioMapper {\n (schema: any, options: any): any;\n}\n\nconst FormioMappersContainer: Map<string, FormioMapper> = new Map();\n\nexport function registerFormioMapper(type: string, mapper: FormioMapper) {\n return FormioMappersContainer.set(type, mapper);\n}\n\nexport function getFormioMapper(type: string): FormioMapper {\n // istanbul ignore next\n if (!FormioMappersContainer.has(type)) {\n throw new Error(`Formio ${type} mapper doesn't exists`);\n }\n return FormioMappersContainer.get(type)!;\n}\n\nexport function execMapper(type: string, schema: any, options: any): any {\n return getFormioMapper(type)(schema, options);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormsContainer.js","sourceRoot":"","sources":["../../../src/registries/FormsContainer.ts"],"names":[],"mappings":";;;AAEA,yCAAyC;AAC5B,QAAA,cAAc,GAAsB,IAAI,GAAG,EAAE,CAAC","sourcesContent":["import {Type} from \"@tsed/core\";\n\n// tslint:disable-next-line:variable-name\nexport const FormsContainer: Map<string, Type> = new Map();\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFormioProps = void 0;
|
|
4
|
+
function getFormioProps(schema) {
|
|
5
|
+
const formioProps = Object.entries(schema).reduce((props, [key, value]) => {
|
|
6
|
+
if (key.startsWith("x-formio-")) {
|
|
7
|
+
return {
|
|
8
|
+
...props,
|
|
9
|
+
[key.replace("x-formio-", "")]: value
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
return props;
|
|
13
|
+
}, {});
|
|
14
|
+
return formioProps;
|
|
15
|
+
}
|
|
16
|
+
exports.getFormioProps = getFormioProps;
|
|
17
|
+
//# sourceMappingURL=getFormioProps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getFormioProps.js","sourceRoot":"","sources":["../../../src/utils/getFormioProps.ts"],"names":[],"mappings":";;;AAAA,SAAgB,cAAc,CAAC,MAAW;IACxC,MAAM,WAAW,GAAQ,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QAC7E,IAAI,GAAG,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE;YAC/B,OAAO;gBACL,GAAG,KAAK;gBACR,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK;aACtC,CAAC;SACH;QACD,OAAO,KAAK,CAAC;IACf,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,WAAW,CAAC;AACrB,CAAC;AAXD,wCAWC","sourcesContent":["export function getFormioProps(schema: any) {\n const formioProps: any = Object.entries(schema).reduce((props, [key, value]) => {\n if (key.startsWith(\"x-formio-\")) {\n return {\n ...props,\n [key.replace(\"x-formio-\", \"\")]: value\n };\n }\n return props;\n }, {});\n return formioProps;\n}\n"]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFormioSchema = void 0;
|
|
4
|
+
const core_1 = require("@tsed/core");
|
|
5
|
+
const schema_1 = require("@tsed/schema");
|
|
6
|
+
const FormioMappersContainer_1 = require("../registries/FormioMappersContainer");
|
|
7
|
+
const FormsContainer_1 = require("../registries/FormsContainer");
|
|
8
|
+
const change_case_1 = require("change-case");
|
|
9
|
+
require("../components/anyToComponent");
|
|
10
|
+
require("../components/arrayToComponent");
|
|
11
|
+
require("../components/booleanToComponent");
|
|
12
|
+
require("../components/dateToComponent");
|
|
13
|
+
require("../components/defaultToComponent");
|
|
14
|
+
require("../components/enumToComponent");
|
|
15
|
+
require("../components/mapToComponent");
|
|
16
|
+
require("../components/nestedToComponent");
|
|
17
|
+
require("../components/numberToComponent");
|
|
18
|
+
require("../components/objectToEditGrid");
|
|
19
|
+
require("../components/panelToComponent");
|
|
20
|
+
require("../components/propertiesToComponents");
|
|
21
|
+
require("../components/stringToComponent");
|
|
22
|
+
async function getFormioSchema(model, options = {}) {
|
|
23
|
+
if (!model) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
if ((0, core_1.isString)(model)) {
|
|
27
|
+
return getFormioSchema(FormsContainer_1.FormsContainer.get(model), options);
|
|
28
|
+
}
|
|
29
|
+
const entity = schema_1.JsonEntityStore.from(model);
|
|
30
|
+
const schema = (0, schema_1.getJsonSchema)(entity, {
|
|
31
|
+
...options,
|
|
32
|
+
customKeys: true
|
|
33
|
+
});
|
|
34
|
+
const name = entity.schema.getName();
|
|
35
|
+
const machineName = (0, change_case_1.paramCase)(name);
|
|
36
|
+
const resolvers = [];
|
|
37
|
+
const components = (0, FormioMappersContainer_1.execMapper)("properties", schema, { ...options, definitions: schema.definitions, resolvers });
|
|
38
|
+
const form = {
|
|
39
|
+
title: name,
|
|
40
|
+
type: "form",
|
|
41
|
+
display: "form",
|
|
42
|
+
tags: [],
|
|
43
|
+
access: [],
|
|
44
|
+
submissionAccess: [],
|
|
45
|
+
...entity.store.get("formio:form", {}),
|
|
46
|
+
name: machineName,
|
|
47
|
+
machineName,
|
|
48
|
+
components
|
|
49
|
+
};
|
|
50
|
+
await Promise.all(resolvers.map((resolver) => resolver(form, options)));
|
|
51
|
+
return form;
|
|
52
|
+
}
|
|
53
|
+
exports.getFormioSchema = getFormioSchema;
|
|
54
|
+
//# sourceMappingURL=getFormioSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getFormioSchema.js","sourceRoot":"","sources":["../../../src/utils/getFormioSchema.ts"],"names":[],"mappings":";;;AAAA,qCAA0C;AAC1C,yCAA+E;AAE/E,iFAAgE;AAChE,iEAA4D;AAC5D,6CAAsC;AACtC,wCAAsC;AACtC,0CAAwC;AACxC,4CAA0C;AAC1C,yCAAuC;AACvC,4CAA0C;AAC1C,yCAAuC;AACvC,wCAAsC;AACtC,2CAAyC;AACzC,2CAAyC;AACzC,0CAAwC;AACxC,0CAAwC;AACxC,gDAA8C;AAC9C,2CAAyC;AAElC,KAAK,UAAU,eAAe,CACnC,KAA+B,EAC/B,UAA6B,EAAE;IAE/B,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,SAAS,CAAC;KAClB;IAED,IAAI,IAAA,eAAQ,EAAC,KAAK,CAAC,EAAE;QACnB,OAAO,eAAe,CAAC,+BAAc,CAAC,GAAG,CAAC,KAAK,CAAc,EAAE,OAAO,CAAC,CAAC;KACzE;IAED,MAAM,MAAM,GAAG,wBAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3C,MAAM,MAAM,GAAG,IAAA,sBAAa,EAAC,MAAM,EAAE;QACnC,GAAG,OAAO;QACV,UAAU,EAAE,IAAI;KACjB,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IACrC,MAAM,WAAW,GAAG,IAAA,uBAAS,EAAC,IAAI,CAAC,CAAC;IACpC,MAAM,SAAS,GAAmB,EAAE,CAAC;IACrC,MAAM,UAAU,GAAG,IAAA,mCAAU,EAAC,YAAY,EAAE,MAAM,EAAE,EAAC,GAAG,OAAO,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,SAAS,EAAC,CAAC,CAAC;IAC9G,MAAM,IAAI,GAAG;QACX,KAAK,EAAE,IAAI;QACX,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,MAAM;QACf,IAAI,EAAE,EAAE;QACR,MAAM,EAAE,EAAE;QACV,gBAAgB,EAAE,EAAE;QACpB,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAM,aAAa,EAAE,EAAE,CAAC;QAC3C,IAAI,EAAE,WAAW;QACjB,WAAW;QACX,UAAU;KACX,CAAC;IAEF,MAAM,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAa,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IAE7E,OAAO,IAA6B,CAAC;AACvC,CAAC;AAtCD,0CAsCC","sourcesContent":["import {isString, Type} from \"@tsed/core\";\nimport {getJsonSchema, JsonEntityStore, JsonSchemaOptions} from \"@tsed/schema\";\nimport {FormioForm} from \"@tsed/formio-types\";\nimport {execMapper} from \"../registries/FormioMappersContainer\";\nimport {FormsContainer} from \"../registries/FormsContainer\";\nimport {paramCase} from \"change-case\";\nimport \"../components/anyToComponent\";\nimport \"../components/arrayToComponent\";\nimport \"../components/booleanToComponent\";\nimport \"../components/dateToComponent\";\nimport \"../components/defaultToComponent\";\nimport \"../components/enumToComponent\";\nimport \"../components/mapToComponent\";\nimport \"../components/nestedToComponent\";\nimport \"../components/numberToComponent\";\nimport \"../components/objectToEditGrid\";\nimport \"../components/panelToComponent\";\nimport \"../components/propertiesToComponents\";\nimport \"../components/stringToComponent\";\n\nexport async function getFormioSchema(\n model: string | any | undefined,\n options: JsonSchemaOptions = {}\n): Promise<Omit<FormioForm, \"components\" | \"_id\" | \"deleted\" | \"owner\"> | undefined> {\n if (!model) {\n return undefined;\n }\n\n if (isString(model)) {\n return getFormioSchema(FormsContainer.get(model) as Type<any>, options);\n }\n\n const entity = JsonEntityStore.from(model);\n const schema = getJsonSchema(entity, {\n ...options,\n customKeys: true\n });\n\n const name = entity.schema.getName();\n const machineName = paramCase(name);\n const resolvers: Promise<any>[] = [];\n const components = execMapper(\"properties\", schema, {...options, definitions: schema.definitions, resolvers});\n const form = {\n title: name,\n type: \"form\",\n display: \"form\",\n tags: [],\n access: [],\n submissionAccess: [],\n ...entity.store.get<any>(\"formio:form\", {}),\n name: machineName,\n machineName,\n components\n };\n\n await Promise.all(resolvers.map((resolver: any) => resolver(form, options)));\n\n return form as unknown as FormioForm;\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRef = void 0;
|
|
4
|
+
const core_1 = require("@tsed/core");
|
|
5
|
+
function getRef(schema, options) {
|
|
6
|
+
if (schema.$ref) {
|
|
7
|
+
return (0, core_1.getValue)(options, schema.$ref.replace("#/", "").replace(/\//g, "."));
|
|
8
|
+
}
|
|
9
|
+
return schema;
|
|
10
|
+
}
|
|
11
|
+
exports.getRef = getRef;
|
|
12
|
+
//# sourceMappingURL=getRef.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getRef.js","sourceRoot":"","sources":["../../../src/utils/getRef.ts"],"names":[],"mappings":";;;AAAA,qCAAoC;AAEpC,SAAgB,MAAM,CAAC,MAAW,EAAE,OAAY;IAC9C,IAAI,MAAM,CAAC,IAAI,EAAE;QACf,OAAO,IAAA,eAAQ,EAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;KAC7E;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AALD,wBAKC","sourcesContent":["import {getValue} from \"@tsed/core\";\n\nexport function getRef(schema: any, options: any) {\n if (schema.$ref) {\n return getValue(options, schema.$ref.replace(\"#/\", \"\").replace(/\\//g, \".\"));\n }\n return schema;\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { execMapper, registerFormioMapper } from "../registries/FormioMappersContainer.js";
|
|
2
|
+
import { getRef } from "../utils/getRef.js";
|
|
3
|
+
export function anyToComponent(schema, options) {
|
|
4
|
+
schema = getRef(schema, options);
|
|
5
|
+
switch (schema === null || schema === void 0 ? void 0 : schema.type) {
|
|
6
|
+
case "object":
|
|
7
|
+
if (!schema.properties && !schema.$ref) {
|
|
8
|
+
return execMapper("map", schema, options);
|
|
9
|
+
}
|
|
10
|
+
return execMapper("nested", schema, options);
|
|
11
|
+
case "array":
|
|
12
|
+
return execMapper("array", schema, options);
|
|
13
|
+
case "string":
|
|
14
|
+
return execMapper("string", schema, options);
|
|
15
|
+
case "boolean":
|
|
16
|
+
return execMapper("boolean", schema, options);
|
|
17
|
+
case "integer":
|
|
18
|
+
case "number":
|
|
19
|
+
return execMapper("number", schema, options);
|
|
20
|
+
}
|
|
21
|
+
return {};
|
|
22
|
+
}
|
|
23
|
+
registerFormioMapper("any", anyToComponent);
|
|
24
|
+
//# sourceMappingURL=anyToComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anyToComponent.js","sourceRoot":"","sources":["../../../src/components/anyToComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AACtF,OAAO,EAAC,MAAM,EAAC,MAAM,iBAAiB,CAAC;AAEvC,MAAM,UAAU,cAAc,CAAC,MAAW,EAAE,OAAY;IACtD,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEjC,QAAQ,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,EAAE;QACpB,KAAK,QAAQ;YACX,IAAI,CAAC,MAAM,CAAC,UAAU,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;gBACtC,OAAO,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;aAC3C;YAED,OAAO,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAC/C,KAAK,OAAO;YACV,OAAO,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAC9C,KAAK,QAAQ;YACX,OAAO,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAC/C,KAAK,SAAS;YACZ,OAAO,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAChD,KAAK,SAAS,CAAC;QACf,KAAK,QAAQ;YACX,OAAO,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;KAChD;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,oBAAoB,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import {execMapper, registerFormioMapper} from \"../registries/FormioMappersContainer\";\nimport {getRef} from \"../utils/getRef\";\n\nexport function anyToComponent(schema: any, options: any) {\n schema = getRef(schema, options);\n\n switch (schema?.type) {\n case \"object\":\n if (!schema.properties && !schema.$ref) {\n return execMapper(\"map\", schema, options);\n }\n\n return execMapper(\"nested\", schema, options);\n case \"array\":\n return execMapper(\"array\", schema, options);\n case \"string\":\n return execMapper(\"string\", schema, options);\n case \"boolean\":\n return execMapper(\"boolean\", schema, options);\n case \"integer\":\n case \"number\":\n return execMapper(\"number\", schema, options);\n }\n\n return {};\n}\n\nregisterFormioMapper(\"any\", anyToComponent);\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { cleanObject } from "@tsed/core";
|
|
2
|
+
import { execMapper, registerFormioMapper } from "../registries/FormioMappersContainer.js";
|
|
3
|
+
import { getRef } from "../utils/getRef.js";
|
|
4
|
+
export function arrayToComponent(schema, options) {
|
|
5
|
+
const itemSchema = schema.items.$ref ? getRef(schema.items, options) : schema.items;
|
|
6
|
+
const { type } = itemSchema;
|
|
7
|
+
switch (type) {
|
|
8
|
+
case "object": // editgrid
|
|
9
|
+
return {
|
|
10
|
+
...execMapper("default", schema, options),
|
|
11
|
+
...execMapper("editgrid", itemSchema, options)
|
|
12
|
+
};
|
|
13
|
+
case "string": // tag or enum?
|
|
14
|
+
if (itemSchema.enum) {
|
|
15
|
+
const component = execMapper("enum", itemSchema, options);
|
|
16
|
+
return {
|
|
17
|
+
...component,
|
|
18
|
+
inline: false,
|
|
19
|
+
type: "selectboxes"
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const component = execMapper(type, itemSchema, options);
|
|
23
|
+
return cleanObject({
|
|
24
|
+
...component,
|
|
25
|
+
multiple: component.type === "tags" ? undefined : true
|
|
26
|
+
});
|
|
27
|
+
default:
|
|
28
|
+
case "number":
|
|
29
|
+
return {
|
|
30
|
+
...execMapper(type, itemSchema, options),
|
|
31
|
+
multiple: true
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
registerFormioMapper("array", arrayToComponent);
|
|
36
|
+
//# sourceMappingURL=arrayToComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrayToComponent.js","sourceRoot":"","sources":["../../../src/components/arrayToComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,YAAY,CAAC;AACvC,OAAO,EAAC,UAAU,EAAE,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AACtF,OAAO,EAAC,MAAM,EAAC,MAAM,iBAAiB,CAAC;AAEvC,MAAM,UAAU,gBAAgB,CAAC,MAAW,EAAE,OAAY;IACxD,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;IAEpF,MAAM,EAAC,IAAI,EAAC,GAAG,UAAU,CAAC;IAE1B,QAAQ,IAAI,EAAE;QACZ,KAAK,QAAQ,EAAE,WAAW;YACxB,OAAO;gBACL,GAAG,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC;gBACzC,GAAG,UAAU,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,CAAC;aAC/C,CAAC;QACJ,KAAK,QAAQ,EAAE,eAAe;YAC5B,IAAI,UAAU,CAAC,IAAI,EAAE;gBACnB,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;gBAE1D,OAAO;oBACL,GAAG,SAAS;oBACZ,MAAM,EAAE,KAAK;oBACb,IAAI,EAAE,aAAa;iBACpB,CAAC;aACH;YAED,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;YAExD,OAAO,WAAW,CAAC;gBACjB,GAAG,SAAS;gBACZ,QAAQ,EAAE,SAAS,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI;aACvD,CAAC,CAAC;QACL,QAAQ;QACR,KAAK,QAAQ;YACX,OAAO;gBACL,GAAG,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC;gBACxC,QAAQ,EAAE,IAAI;aACf,CAAC;KACL;AACH,CAAC;AAED,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["import {cleanObject} from \"@tsed/core\";\nimport {execMapper, registerFormioMapper} from \"../registries/FormioMappersContainer\";\nimport {getRef} from \"../utils/getRef\";\n\nexport function arrayToComponent(schema: any, options: any) {\n const itemSchema = schema.items.$ref ? getRef(schema.items, options) : schema.items;\n\n const {type} = itemSchema;\n\n switch (type) {\n case \"object\": // editgrid\n return {\n ...execMapper(\"default\", schema, options),\n ...execMapper(\"editgrid\", itemSchema, options)\n };\n case \"string\": // tag or enum?\n if (itemSchema.enum) {\n const component = execMapper(\"enum\", itemSchema, options);\n\n return {\n ...component,\n inline: false,\n type: \"selectboxes\"\n };\n }\n\n const component = execMapper(type, itemSchema, options);\n\n return cleanObject({\n ...component,\n multiple: component.type === \"tags\" ? undefined : true\n });\n default:\n case \"number\":\n return {\n ...execMapper(type, itemSchema, options),\n multiple: true\n };\n }\n}\n\nregisterFormioMapper(\"array\", arrayToComponent);\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { cleanObject } from "@tsed/core";
|
|
2
|
+
import { execMapper, registerFormioMapper } from "../registries/FormioMappersContainer.js";
|
|
3
|
+
function booleanToComponent(schema, options) {
|
|
4
|
+
const component = execMapper("default", schema, options);
|
|
5
|
+
return cleanObject({
|
|
6
|
+
...component,
|
|
7
|
+
input: true,
|
|
8
|
+
type: component.type || "checkbox"
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
registerFormioMapper("boolean", booleanToComponent);
|
|
12
|
+
//# sourceMappingURL=booleanToComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"booleanToComponent.js","sourceRoot":"","sources":["../../../src/components/booleanToComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,YAAY,CAAC;AACvC,OAAO,EAAC,UAAU,EAAE,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAEtF,SAAS,kBAAkB,CAAC,MAAW,EAAE,OAAY;IACnD,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAEzD,OAAO,WAAW,CAAC;QACjB,GAAG,SAAS;QACZ,KAAK,EAAE,IAAI;QACX,IAAI,EAAE,SAAS,CAAC,IAAI,IAAI,UAAU;KACnC,CAAC,CAAC;AACL,CAAC;AAED,oBAAoB,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import {cleanObject} from \"@tsed/core\";\nimport {execMapper, registerFormioMapper} from \"../registries/FormioMappersContainer\";\n\nfunction booleanToComponent(schema: any, options: any) {\n const component = execMapper(\"default\", schema, options);\n\n return cleanObject({\n ...component,\n input: true,\n type: component.type || \"checkbox\"\n });\n}\n\nregisterFormioMapper(\"boolean\", booleanToComponent);\n"]}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { execMapper, registerFormioMapper } from "../registries/FormioMappersContainer.js";
|
|
2
|
+
function dateToComponent(schema, options) {
|
|
3
|
+
const component = execMapper("default", schema, options);
|
|
4
|
+
const base = {
|
|
5
|
+
...component,
|
|
6
|
+
enableMinDateInput: false,
|
|
7
|
+
datePicker: {
|
|
8
|
+
disableWeekends: false,
|
|
9
|
+
disableWeekdays: false
|
|
10
|
+
},
|
|
11
|
+
enableMaxDateInput: false,
|
|
12
|
+
enableTime: false,
|
|
13
|
+
type: "datetime",
|
|
14
|
+
input: true,
|
|
15
|
+
widget: {
|
|
16
|
+
type: "calendar",
|
|
17
|
+
displayInTimezone: "viewer",
|
|
18
|
+
locale: "en",
|
|
19
|
+
useLocaleSettings: false,
|
|
20
|
+
allowInput: true,
|
|
21
|
+
mode: "single",
|
|
22
|
+
noCalendar: false,
|
|
23
|
+
hourIncrement: 1,
|
|
24
|
+
minuteIncrement: 1,
|
|
25
|
+
minDate: null,
|
|
26
|
+
disableWeekends: false,
|
|
27
|
+
disableWeekdays: false,
|
|
28
|
+
maxDate: null
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
if (schema.format === "date") {
|
|
32
|
+
return {
|
|
33
|
+
...base,
|
|
34
|
+
format: "yyyy-MM-dd",
|
|
35
|
+
enableTime: false,
|
|
36
|
+
widget: {
|
|
37
|
+
...base.widget,
|
|
38
|
+
enableTime: false,
|
|
39
|
+
format: "yyyy-MM-dd"
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
...base,
|
|
45
|
+
timePicker: {
|
|
46
|
+
showMeridian: false
|
|
47
|
+
},
|
|
48
|
+
widget: {
|
|
49
|
+
enableTime: true,
|
|
50
|
+
time_24hr: true
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
registerFormioMapper("date", dateToComponent);
|
|
55
|
+
//# sourceMappingURL=dateToComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dateToComponent.js","sourceRoot":"","sources":["../../../src/components/dateToComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAEtF,SAAS,eAAe,CAAC,MAAW,EAAE,OAAY;IAChD,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAEzD,MAAM,IAAI,GAAG;QACX,GAAG,SAAS;QACZ,kBAAkB,EAAE,KAAK;QACzB,UAAU,EAAE;YACV,eAAe,EAAE,KAAK;YACtB,eAAe,EAAE,KAAK;SACvB;QACD,kBAAkB,EAAE,KAAK;QACzB,UAAU,EAAE,KAAK;QACjB,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,IAAI;QACX,MAAM,EAAE;YACN,IAAI,EAAE,UAAU;YAChB,iBAAiB,EAAE,QAAQ;YAC3B,MAAM,EAAE,IAAI;YACZ,iBAAiB,EAAE,KAAK;YACxB,UAAU,EAAE,IAAI;YAChB,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,KAAK;YACjB,aAAa,EAAE,CAAC;YAChB,eAAe,EAAE,CAAC;YAClB,OAAO,EAAE,IAAI;YACb,eAAe,EAAE,KAAK;YACtB,eAAe,EAAE,KAAK;YACtB,OAAO,EAAE,IAAI;SACd;KACF,CAAC;IAEF,IAAI,MAAM,CAAC,MAAM,KAAK,MAAM,EAAE;QAC5B,OAAO;YACL,GAAG,IAAI;YACP,MAAM,EAAE,YAAY;YACpB,UAAU,EAAE,KAAK;YACjB,MAAM,EAAE;gBACN,GAAG,IAAI,CAAC,MAAM;gBACd,UAAU,EAAE,KAAK;gBACjB,MAAM,EAAE,YAAY;aACrB;SACF,CAAC;KACH;IAED,OAAO;QACL,GAAG,IAAI;QACP,UAAU,EAAE;YACV,YAAY,EAAE,KAAK;SACpB;QACD,MAAM,EAAE;YACN,UAAU,EAAE,IAAI;YAChB,SAAS,EAAE,IAAI;SAChB;KACF,CAAC;AACJ,CAAC;AAED,oBAAoB,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC","sourcesContent":["import {execMapper, registerFormioMapper} from \"../registries/FormioMappersContainer\";\n\nfunction dateToComponent(schema: any, options: any) {\n const component = execMapper(\"default\", schema, options);\n\n const base = {\n ...component,\n enableMinDateInput: false,\n datePicker: {\n disableWeekends: false,\n disableWeekdays: false\n },\n enableMaxDateInput: false,\n enableTime: false,\n type: \"datetime\",\n input: true,\n widget: {\n type: \"calendar\",\n displayInTimezone: \"viewer\",\n locale: \"en\",\n useLocaleSettings: false,\n allowInput: true,\n mode: \"single\",\n noCalendar: false,\n hourIncrement: 1,\n minuteIncrement: 1,\n minDate: null,\n disableWeekends: false,\n disableWeekdays: false,\n maxDate: null\n }\n };\n\n if (schema.format === \"date\") {\n return {\n ...base,\n format: \"yyyy-MM-dd\",\n enableTime: false,\n widget: {\n ...base.widget,\n enableTime: false,\n format: \"yyyy-MM-dd\"\n }\n };\n }\n\n return {\n ...base,\n timePicker: {\n showMeridian: false\n },\n widget: {\n enableTime: true,\n time_24hr: true\n }\n };\n}\n\nregisterFormioMapper(\"date\", dateToComponent);\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { cleanObject } from "@tsed/core";
|
|
2
|
+
import { registerFormioMapper } from "../registries/FormioMappersContainer.js";
|
|
3
|
+
import { getFormioProps } from "../utils/getFormioProps.js";
|
|
4
|
+
export function defaultToComponent(schema, options) {
|
|
5
|
+
const formioProps = getFormioProps(schema);
|
|
6
|
+
return cleanObject({
|
|
7
|
+
...formioProps,
|
|
8
|
+
disabled: !!schema.readOnly,
|
|
9
|
+
description: schema.description,
|
|
10
|
+
defaultValue: schema.default
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
registerFormioMapper("default", defaultToComponent);
|
|
14
|
+
//# sourceMappingURL=defaultToComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultToComponent.js","sourceRoot":"","sources":["../../../src/components/defaultToComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,YAAY,CAAC;AACvC,OAAO,EAAC,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AAEvD,MAAM,UAAU,kBAAkB,CAAC,MAAW,EAAE,OAAY;IAC1D,MAAM,WAAW,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IAE3C,OAAO,WAAW,CAAC;QACjB,GAAG,WAAW;QACd,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ;QAC3B,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,YAAY,EAAE,MAAM,CAAC,OAAO;KAC7B,CAAC,CAAC;AACL,CAAC;AAED,oBAAoB,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import {cleanObject} from \"@tsed/core\";\nimport {registerFormioMapper} from \"../registries/FormioMappersContainer\";\nimport {getFormioProps} from \"../utils/getFormioProps\";\n\nexport function defaultToComponent(schema: any, options: any): any {\n const formioProps = getFormioProps(schema);\n\n return cleanObject({\n ...formioProps,\n disabled: !!schema.readOnly,\n description: schema.description,\n defaultValue: schema.default\n });\n}\n\nregisterFormioMapper(\"default\", defaultToComponent);\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { cleanObject } from "@tsed/core";
|
|
2
|
+
import { execMapper, registerFormioMapper } from "../registries/FormioMappersContainer.js";
|
|
3
|
+
export function enumToComponent(schema, options) {
|
|
4
|
+
const component = execMapper("default", schema, options);
|
|
5
|
+
const values = schema.enum.map((value) => {
|
|
6
|
+
return {
|
|
7
|
+
label: value,
|
|
8
|
+
value
|
|
9
|
+
};
|
|
10
|
+
});
|
|
11
|
+
if (component.type === "select") {
|
|
12
|
+
return cleanObject({
|
|
13
|
+
...component,
|
|
14
|
+
data: {
|
|
15
|
+
json: JSON.stringify(values)
|
|
16
|
+
},
|
|
17
|
+
dataSrc: "json",
|
|
18
|
+
idPath: "value",
|
|
19
|
+
valueProperty: "value",
|
|
20
|
+
template: "<span>{{ item.label }}</span>"
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return cleanObject({
|
|
24
|
+
...component,
|
|
25
|
+
values: schema["x-values"] || values.map((value) => ({ ...value, shortcut: "" }))
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
registerFormioMapper("enum", enumToComponent);
|
|
29
|
+
//# sourceMappingURL=enumToComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enumToComponent.js","sourceRoot":"","sources":["../../../src/components/enumToComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,YAAY,CAAC;AACvC,OAAO,EAAC,UAAU,EAAE,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAEtF,MAAM,UAAU,eAAe,CAAC,MAAW,EAAE,OAAY;IACvD,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACzD,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAU,EAAE,EAAE;QAC5C,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,KAAK;SACN,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,IAAI,SAAS,CAAC,IAAI,KAAK,QAAQ,EAAE;QAC/B,OAAO,WAAW,CAAC;YACjB,GAAG,SAAS;YACZ,IAAI,EAAE;gBACJ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;aAC7B;YACD,OAAO,EAAE,MAAM;YACf,MAAM,EAAE,OAAO;YACf,aAAa,EAAE,OAAO;YACtB,QAAQ,EAAE,+BAA+B;SAC1C,CAAC,CAAC;KACJ;IAED,OAAO,WAAW,CAAC;QACjB,GAAG,SAAS;QACZ,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,KAAU,EAAE,EAAE,CAAC,CAAC,EAAC,GAAG,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAC,CAAC,CAAC;KACrF,CAAC,CAAC;AACL,CAAC;AAED,oBAAoB,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC","sourcesContent":["import {cleanObject} from \"@tsed/core\";\nimport {execMapper, registerFormioMapper} from \"../registries/FormioMappersContainer\";\n\nexport function enumToComponent(schema: any, options: any) {\n const component = execMapper(\"default\", schema, options);\n const values = schema.enum.map((value: any) => {\n return {\n label: value,\n value\n };\n });\n\n if (component.type === \"select\") {\n return cleanObject({\n ...component,\n data: {\n json: JSON.stringify(values)\n },\n dataSrc: \"json\",\n idPath: \"value\",\n valueProperty: \"value\",\n template: \"<span>{{ item.label }}</span>\"\n });\n }\n\n return cleanObject({\n ...component,\n values: schema[\"x-values\"] || values.map((value: any) => ({...value, shortcut: \"\"}))\n });\n}\n\nregisterFormioMapper(\"enum\", enumToComponent);\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { execMapper, registerFormioMapper } from "../registries/FormioMappersContainer.js";
|
|
2
|
+
export function mapToComponent(schema, options) {
|
|
3
|
+
return {
|
|
4
|
+
...execMapper("default", schema, options),
|
|
5
|
+
type: "datamap",
|
|
6
|
+
tableView: false,
|
|
7
|
+
input: true,
|
|
8
|
+
valueComponent: {
|
|
9
|
+
...(schema.additionalProperties ? execMapper("any", schema.additionalProperties, options) : {}),
|
|
10
|
+
hideLabel: true,
|
|
11
|
+
tableView: true
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
registerFormioMapper("map", mapToComponent);
|
|
16
|
+
//# sourceMappingURL=mapToComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapToComponent.js","sourceRoot":"","sources":["../../../src/components/mapToComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAEtF,MAAM,UAAU,cAAc,CAAC,MAAW,EAAE,OAAY;IACtD,OAAO;QACL,GAAG,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC;QACzC,IAAI,EAAE,SAAS;QACf,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE,IAAI;QACX,cAAc,EAAE;YACd,GAAG,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC/F,SAAS,EAAE,IAAI;YACf,SAAS,EAAE,IAAI;SAChB;KACF,CAAC;AACJ,CAAC;AAED,oBAAoB,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import {execMapper, registerFormioMapper} from \"../registries/FormioMappersContainer\";\n\nexport function mapToComponent(schema: any, options: any) {\n return {\n ...execMapper(\"default\", schema, options),\n type: \"datamap\",\n tableView: false,\n input: true,\n valueComponent: {\n ...(schema.additionalProperties ? execMapper(\"any\", schema.additionalProperties, options) : {}),\n hideLabel: true,\n tableView: true\n }\n };\n}\n\nregisterFormioMapper(\"map\", mapToComponent);\n"]}
|