@tsed/schema-formio 6.88.1 → 6.89.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{components → cjs/components}/anyToComponent.d.ts +0 -0
- package/lib/cjs/components/anyToComponent.js +29 -0
- package/lib/cjs/components/anyToComponent.js.map +1 -0
- package/lib/{components → cjs/components}/arrayToComponent.d.ts +0 -0
- package/lib/cjs/components/arrayToComponent.js +40 -0
- package/lib/cjs/components/arrayToComponent.js.map +1 -0
- package/lib/{components → cjs/components}/booleanToComponent.d.ts +0 -0
- package/lib/cjs/components/booleanToComponent.js +14 -0
- package/lib/cjs/components/booleanToComponent.js.map +1 -0
- package/lib/{components → cjs/components}/dateToComponent.d.ts +0 -0
- package/lib/cjs/components/dateToComponent.js +57 -0
- package/lib/cjs/components/dateToComponent.js.map +1 -0
- package/lib/{components → cjs/components}/defaultToComponent.d.ts +0 -0
- package/lib/cjs/components/defaultToComponent.js +18 -0
- package/lib/cjs/components/defaultToComponent.js.map +1 -0
- package/lib/{components → cjs/components}/enumToComponent.d.ts +0 -0
- package/lib/cjs/components/enumToComponent.js +34 -0
- package/lib/cjs/components/enumToComponent.js.map +1 -0
- package/lib/{components → cjs/components}/index.d.ts +0 -0
- package/lib/cjs/components/index.js +17 -0
- package/lib/cjs/components/index.js.map +1 -0
- package/lib/{components → cjs/components}/mapToComponent.d.ts +0 -0
- package/lib/cjs/components/mapToComponent.js +20 -0
- package/lib/cjs/components/mapToComponent.js.map +1 -0
- package/lib/{components → cjs/components}/nestedToComponent.d.ts +0 -0
- package/lib/cjs/components/nestedToComponent.js +25 -0
- package/lib/cjs/components/nestedToComponent.js.map +1 -0
- package/lib/{components → cjs/components}/numberToComponent.d.ts +0 -0
- package/lib/cjs/components/numberToComponent.js +21 -0
- package/lib/cjs/components/numberToComponent.js.map +1 -0
- package/lib/{components → cjs/components}/objectToEditGrid.d.ts +0 -0
- package/lib/cjs/components/objectToEditGrid.js +16 -0
- package/lib/cjs/components/objectToEditGrid.js.map +1 -0
- package/lib/{components → cjs/components}/panelToComponent.d.ts +0 -0
- package/lib/cjs/components/panelToComponent.js +16 -0
- package/lib/cjs/components/panelToComponent.js.map +1 -0
- package/lib/{components → cjs/components}/propertiesToComponents.d.ts +0 -0
- package/lib/cjs/components/propertiesToComponents.js +88 -0
- package/lib/cjs/components/propertiesToComponents.js.map +1 -0
- package/lib/{components → cjs/components}/stringToComponent.d.ts +0 -0
- package/lib/cjs/components/stringToComponent.js +43 -0
- package/lib/cjs/components/stringToComponent.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/component.d.ts +0 -0
- package/lib/cjs/decorators/component.js +35 -0
- package/lib/cjs/decorators/component.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/conditional.d.ts +0 -0
- package/lib/cjs/decorators/conditional.js +53 -0
- package/lib/cjs/decorators/conditional.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/currency.d.ts +0 -0
- package/lib/cjs/decorators/currency.js +24 -0
- package/lib/cjs/decorators/currency.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/customClass.d.ts +0 -0
- package/lib/cjs/decorators/customClass.js +18 -0
- package/lib/cjs/decorators/customClass.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/customConditional.d.ts +0 -0
- package/lib/cjs/decorators/customConditional.js +33 -0
- package/lib/cjs/decorators/customConditional.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/dataSourceJson.d.ts +0 -0
- package/lib/cjs/decorators/dataSourceJson.js +27 -0
- package/lib/cjs/decorators/dataSourceJson.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/dataSourceUrl.d.ts +0 -0
- package/lib/cjs/decorators/dataSourceUrl.js +22 -0
- package/lib/cjs/decorators/dataSourceUrl.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/errorLabel.d.ts +0 -0
- package/lib/cjs/decorators/errorLabel.js +18 -0
- package/lib/cjs/decorators/errorLabel.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/errorMessage.d.ts +0 -0
- package/lib/cjs/decorators/errorMessage.js +17 -0
- package/lib/cjs/decorators/errorMessage.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/form.d.ts +0 -0
- package/lib/cjs/decorators/form.js +21 -0
- package/lib/cjs/decorators/form.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/hidden.d.ts +0 -0
- package/lib/cjs/decorators/hidden.js +22 -0
- package/lib/cjs/decorators/hidden.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/index.d.ts +0 -0
- package/lib/cjs/decorators/index.js +34 -0
- package/lib/cjs/decorators/index.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/inputTags.d.ts +0 -0
- package/lib/cjs/decorators/inputTags.js +23 -0
- package/lib/cjs/decorators/inputTags.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/label.d.ts +0 -0
- package/lib/cjs/decorators/label.js +19 -0
- package/lib/cjs/decorators/label.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/mask.d.ts +0 -0
- package/lib/cjs/decorators/mask.js +50 -0
- package/lib/cjs/decorators/mask.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/maxWords.d.ts +0 -0
- package/lib/cjs/decorators/maxWords.js +17 -0
- package/lib/cjs/decorators/maxWords.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/minWords.d.ts +0 -0
- package/lib/cjs/decorators/minWords.js +17 -0
- package/lib/cjs/decorators/minWords.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/modalEdit.d.ts +0 -0
- package/lib/cjs/decorators/modalEdit.js +18 -0
- package/lib/cjs/decorators/modalEdit.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/multiple.d.ts +0 -0
- package/lib/cjs/decorators/multiple.js +18 -0
- package/lib/cjs/decorators/multiple.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/openWhenEmpty.d.ts +0 -0
- package/lib/cjs/decorators/openWhenEmpty.js +18 -0
- package/lib/cjs/decorators/openWhenEmpty.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/password.d.ts +0 -0
- package/lib/cjs/decorators/password.js +20 -0
- package/lib/cjs/decorators/password.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/placeholder.d.ts +0 -0
- package/lib/cjs/decorators/placeholder.js +19 -0
- package/lib/cjs/decorators/placeholder.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/prefix.d.ts +0 -0
- package/lib/cjs/decorators/prefix.js +18 -0
- package/lib/cjs/decorators/prefix.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/select.d.ts +0 -0
- package/lib/cjs/decorators/select.js +22 -0
- package/lib/cjs/decorators/select.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/suffix.d.ts +0 -0
- package/lib/cjs/decorators/suffix.js +18 -0
- package/lib/cjs/decorators/suffix.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/tableView.d.ts +0 -0
- package/lib/cjs/decorators/tableView.js +19 -0
- package/lib/cjs/decorators/tableView.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/tabs.d.ts +0 -0
- package/lib/cjs/decorators/tabs.js +22 -0
- package/lib/cjs/decorators/tabs.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/textCase.d.ts +0 -0
- package/lib/cjs/decorators/textCase.js +19 -0
- package/lib/cjs/decorators/textCase.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/textarea.d.ts +0 -0
- package/lib/cjs/decorators/textarea.js +20 -0
- package/lib/cjs/decorators/textarea.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/tooltip.d.ts +0 -0
- package/lib/cjs/decorators/tooltip.js +19 -0
- package/lib/cjs/decorators/tooltip.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/validate.d.ts +0 -0
- package/lib/cjs/decorators/validate.js +22 -0
- package/lib/cjs/decorators/validate.js.map +1 -0
- package/lib/{domain → cjs/domain}/FormioDataResolver.d.ts +0 -0
- package/lib/cjs/domain/FormioDataResolver.js +3 -0
- package/lib/cjs/domain/FormioDataResolver.js.map +1 -0
- package/lib/{index.d.ts → cjs/index.d.ts} +0 -0
- package/lib/cjs/index.js +8 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/{registries → cjs/registries}/FormioMappersContainer.d.ts +0 -0
- package/lib/cjs/registries/FormioMappersContainer.js +21 -0
- package/lib/cjs/registries/FormioMappersContainer.js.map +1 -0
- package/lib/{registries → cjs/registries}/FormsContainer.d.ts +0 -0
- package/lib/cjs/registries/FormsContainer.js +6 -0
- package/lib/cjs/registries/FormsContainer.js.map +1 -0
- package/lib/{utils → cjs/utils}/getFormioProps.d.ts +0 -0
- package/lib/cjs/utils/getFormioProps.js +17 -0
- package/lib/cjs/utils/getFormioProps.js.map +1 -0
- package/lib/{utils → cjs/utils}/getFormioSchema.d.ts +0 -0
- package/lib/cjs/utils/getFormioSchema.js +42 -0
- package/lib/cjs/utils/getFormioSchema.js.map +1 -0
- package/lib/{utils → cjs/utils}/getRef.d.ts +0 -0
- package/lib/cjs/utils/getRef.js +12 -0
- package/lib/cjs/utils/getRef.js.map +1 -0
- package/lib/esm/components/anyToComponent.js +25 -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 +30 -0
- package/lib/esm/components/enumToComponent.js.map +1 -0
- package/lib/esm/components/index.js +14 -0
- package/lib/esm/components/index.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/index.js +31 -0
- package/lib/esm/decorators/index.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 +5 -0
- package/lib/esm/index.js.map +1 -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 +38 -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/types/components/anyToComponent.d.ts +1 -0
- package/lib/types/components/arrayToComponent.d.ts +1 -0
- package/lib/types/components/booleanToComponent.d.ts +1 -0
- package/lib/types/components/dateToComponent.d.ts +1 -0
- package/lib/types/components/defaultToComponent.d.ts +1 -0
- package/lib/types/components/enumToComponent.d.ts +1 -0
- package/lib/types/components/index.d.ts +13 -0
- package/lib/types/components/mapToComponent.d.ts +1 -0
- package/lib/types/components/nestedToComponent.d.ts +1 -0
- package/lib/types/components/numberToComponent.d.ts +1 -0
- package/lib/types/components/objectToEditGrid.d.ts +1 -0
- package/lib/types/components/panelToComponent.d.ts +1 -0
- package/lib/types/components/propertiesToComponents.d.ts +1 -0
- package/lib/types/components/stringToComponent.d.ts +1 -0
- package/lib/types/decorators/component.d.ts +8 -0
- package/lib/types/decorators/conditional.d.ts +33 -0
- package/lib/types/decorators/currency.d.ts +8 -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/types/decorators/hidden.d.ts +12 -0
- package/lib/types/decorators/index.d.ts +30 -0
- package/lib/types/decorators/inputTags.d.ts +8 -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/types/decorators/multiple.d.ts +8 -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/types/decorators/tableView.d.ts +9 -0
- package/lib/types/decorators/tabs.d.ts +8 -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 +4 -0
- package/lib/types/registries/FormioMappersContainer.d.ts +6 -0
- package/lib/types/registries/FormsContainer.d.ts +2 -0
- package/lib/types/utils/getFormioProps.d.ts +1 -0
- package/lib/types/utils/getFormioSchema.d.ts +4 -0
- package/lib/types/utils/getRef.d.ts +1 -0
- package/package.json +20 -16
- package/tsconfig.compile.esm.json +23 -0
- package/lib/index.js +0 -1070
- package/lib/index.js.map +0 -1
- package/lib/index.modern.js +0 -1025
- package/lib/index.modern.js.map +0 -1
|
File without changes
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.anyToComponent = void 0;
|
|
4
|
+
const FormioMappersContainer_1 = require("../registries/FormioMappersContainer");
|
|
5
|
+
const getRef_1 = require("../utils/getRef");
|
|
6
|
+
function anyToComponent(schema, options) {
|
|
7
|
+
schema = (0, getRef_1.getRef)(schema, options);
|
|
8
|
+
switch (schema.type) {
|
|
9
|
+
case "object":
|
|
10
|
+
if (!schema.properties && !schema.$ref) {
|
|
11
|
+
return (0, FormioMappersContainer_1.execMapper)("map", schema, options);
|
|
12
|
+
}
|
|
13
|
+
return (0, FormioMappersContainer_1.execMapper)("nested", schema, options);
|
|
14
|
+
case "array":
|
|
15
|
+
return (0, FormioMappersContainer_1.execMapper)("array", schema, options);
|
|
16
|
+
case "string":
|
|
17
|
+
return (0, FormioMappersContainer_1.execMapper)("string", schema, options);
|
|
18
|
+
case "boolean":
|
|
19
|
+
return (0, FormioMappersContainer_1.execMapper)("boolean", schema, options);
|
|
20
|
+
case "integer":
|
|
21
|
+
case "number":
|
|
22
|
+
return (0, FormioMappersContainer_1.execMapper)("number", schema, options);
|
|
23
|
+
// default:
|
|
24
|
+
// return execMapper("default", schema, options);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.anyToComponent = anyToComponent;
|
|
28
|
+
(0, FormioMappersContainer_1.registerFormioMapper)("any", anyToComponent);
|
|
29
|
+
//# sourceMappingURL=anyToComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anyToComponent.js","sourceRoot":"","sources":["../../../src/components/anyToComponent.ts"],"names":[],"mappings":";;;AAAA,iFAAsF;AACtF,4CAAuC;AAEvC,SAAgB,cAAc,CAAC,MAAW,EAAE,OAAY;IACtD,MAAM,GAAG,IAAA,eAAM,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEjC,QAAQ,MAAM,CAAC,IAAI,EAAE;QACnB,KAAK,QAAQ;YACX,IAAI,CAAC,MAAM,CAAC,UAAU,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;gBACtC,OAAO,IAAA,mCAAU,EAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;aAC3C;YAED,OAAO,IAAA,mCAAU,EAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAC/C,KAAK,OAAO;YACV,OAAO,IAAA,mCAAU,EAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAC9C,KAAK,QAAQ;YACX,OAAO,IAAA,mCAAU,EAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAC/C,KAAK,SAAS;YACZ,OAAO,IAAA,mCAAU,EAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAChD,KAAK,SAAS,CAAC;QACf,KAAK,QAAQ;YACX,OAAO,IAAA,mCAAU,EAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAC/C,WAAW;QACX,mDAAmD;KACpD;AACH,CAAC;AAtBD,wCAsBC;AAED,IAAA,6CAAoB,EAAC,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 // default:\n // return execMapper(\"default\", schema, options);\n }\n}\n\nregisterFormioMapper(\"any\", anyToComponent);\n"]}
|
|
File without changes
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.arrayToComponent = void 0;
|
|
4
|
+
const core_1 = require("@tsed/core");
|
|
5
|
+
const FormioMappersContainer_1 = require("../registries/FormioMappersContainer");
|
|
6
|
+
const getRef_1 = require("../utils/getRef");
|
|
7
|
+
function arrayToComponent(schema, options) {
|
|
8
|
+
const itemSchema = schema.items.$ref ? (0, getRef_1.getRef)(schema.items, options) : schema.items;
|
|
9
|
+
const { type } = itemSchema;
|
|
10
|
+
switch (type) {
|
|
11
|
+
case "object": // editgrid
|
|
12
|
+
return {
|
|
13
|
+
...(0, FormioMappersContainer_1.execMapper)("default", schema, options),
|
|
14
|
+
...(0, FormioMappersContainer_1.execMapper)("editgrid", itemSchema, options)
|
|
15
|
+
};
|
|
16
|
+
case "string": // tag or enum?
|
|
17
|
+
if (itemSchema.enum) {
|
|
18
|
+
const component = (0, FormioMappersContainer_1.execMapper)("enum", itemSchema, options);
|
|
19
|
+
return {
|
|
20
|
+
...component,
|
|
21
|
+
inline: false,
|
|
22
|
+
type: "selectboxes"
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
const component = (0, FormioMappersContainer_1.execMapper)(type, itemSchema, options);
|
|
26
|
+
return (0, core_1.cleanObject)({
|
|
27
|
+
...component,
|
|
28
|
+
multiple: component.type === "tags" ? undefined : true
|
|
29
|
+
});
|
|
30
|
+
default:
|
|
31
|
+
case "number":
|
|
32
|
+
return {
|
|
33
|
+
...(0, FormioMappersContainer_1.execMapper)(type, itemSchema, options),
|
|
34
|
+
multiple: true
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.arrayToComponent = arrayToComponent;
|
|
39
|
+
(0, FormioMappersContainer_1.registerFormioMapper)("array", arrayToComponent);
|
|
40
|
+
//# sourceMappingURL=arrayToComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrayToComponent.js","sourceRoot":"","sources":["../../../src/components/arrayToComponent.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AACvC,iFAAsF;AACtF,4CAAuC;AAEvC,SAAgB,gBAAgB,CAAC,MAAW,EAAE,OAAY;IACxD,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAA,eAAM,EAAC,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,IAAA,mCAAU,EAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC;gBACzC,GAAG,IAAA,mCAAU,EAAC,UAAU,EAAE,UAAU,EAAE,OAAO,CAAC;aAC/C,CAAC;QACJ,KAAK,QAAQ,EAAE,eAAe;YAC5B,IAAI,UAAU,CAAC,IAAI,EAAE;gBACnB,MAAM,SAAS,GAAG,IAAA,mCAAU,EAAC,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,IAAA,mCAAU,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;YAExD,OAAO,IAAA,kBAAW,EAAC;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,IAAA,mCAAU,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC;gBACxC,QAAQ,EAAE,IAAI;aACf,CAAC;KACL;AACH,CAAC;AAnCD,4CAmCC;AAED,IAAA,6CAAoB,EAAC,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"]}
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@tsed/core");
|
|
4
|
+
const FormioMappersContainer_1 = require("../registries/FormioMappersContainer");
|
|
5
|
+
function booleanToComponent(schema, options) {
|
|
6
|
+
const component = (0, FormioMappersContainer_1.execMapper)("default", schema, options);
|
|
7
|
+
return (0, core_1.cleanObject)({
|
|
8
|
+
...component,
|
|
9
|
+
input: true,
|
|
10
|
+
type: component.type || "checkbox"
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
(0, FormioMappersContainer_1.registerFormioMapper)("boolean", booleanToComponent);
|
|
14
|
+
//# sourceMappingURL=booleanToComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"booleanToComponent.js","sourceRoot":"","sources":["../../../src/components/booleanToComponent.ts"],"names":[],"mappings":";;AAAA,qCAAuC;AACvC,iFAAsF;AAEtF,SAAS,kBAAkB,CAAC,MAAW,EAAE,OAAY;IACnD,MAAM,SAAS,GAAG,IAAA,mCAAU,EAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAEzD,OAAO,IAAA,kBAAW,EAAC;QACjB,GAAG,SAAS;QACZ,KAAK,EAAE,IAAI;QACX,IAAI,EAAE,SAAS,CAAC,IAAI,IAAI,UAAU;KACnC,CAAC,CAAC;AACL,CAAC;AAED,IAAA,6CAAoB,EAAC,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"]}
|
|
File without changes
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const FormioMappersContainer_1 = require("../registries/FormioMappersContainer");
|
|
4
|
+
function dateToComponent(schema, options) {
|
|
5
|
+
const component = (0, FormioMappersContainer_1.execMapper)("default", schema, options);
|
|
6
|
+
const base = {
|
|
7
|
+
...component,
|
|
8
|
+
enableMinDateInput: false,
|
|
9
|
+
datePicker: {
|
|
10
|
+
disableWeekends: false,
|
|
11
|
+
disableWeekdays: false
|
|
12
|
+
},
|
|
13
|
+
enableMaxDateInput: false,
|
|
14
|
+
enableTime: false,
|
|
15
|
+
type: "datetime",
|
|
16
|
+
input: true,
|
|
17
|
+
widget: {
|
|
18
|
+
type: "calendar",
|
|
19
|
+
displayInTimezone: "viewer",
|
|
20
|
+
locale: "en",
|
|
21
|
+
useLocaleSettings: false,
|
|
22
|
+
allowInput: true,
|
|
23
|
+
mode: "single",
|
|
24
|
+
noCalendar: false,
|
|
25
|
+
hourIncrement: 1,
|
|
26
|
+
minuteIncrement: 1,
|
|
27
|
+
minDate: null,
|
|
28
|
+
disableWeekends: false,
|
|
29
|
+
disableWeekdays: false,
|
|
30
|
+
maxDate: null
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
if (schema.format === "date") {
|
|
34
|
+
return {
|
|
35
|
+
...base,
|
|
36
|
+
format: "yyyy-MM-dd",
|
|
37
|
+
enableTime: false,
|
|
38
|
+
widget: {
|
|
39
|
+
...base.widget,
|
|
40
|
+
enableTime: false,
|
|
41
|
+
format: "yyyy-MM-dd"
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
...base,
|
|
47
|
+
timePicker: {
|
|
48
|
+
showMeridian: false
|
|
49
|
+
},
|
|
50
|
+
widget: {
|
|
51
|
+
enableTime: true,
|
|
52
|
+
time_24hr: true
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
(0, FormioMappersContainer_1.registerFormioMapper)("date", dateToComponent);
|
|
57
|
+
//# sourceMappingURL=dateToComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dateToComponent.js","sourceRoot":"","sources":["../../../src/components/dateToComponent.ts"],"names":[],"mappings":";;AAAA,iFAAsF;AAEtF,SAAS,eAAe,CAAC,MAAW,EAAE,OAAY;IAChD,MAAM,SAAS,GAAG,IAAA,mCAAU,EAAC,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,IAAA,6CAAoB,EAAC,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"]}
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defaultToComponent = void 0;
|
|
4
|
+
const core_1 = require("@tsed/core");
|
|
5
|
+
const FormioMappersContainer_1 = require("../registries/FormioMappersContainer");
|
|
6
|
+
const getFormioProps_1 = require("../utils/getFormioProps");
|
|
7
|
+
function defaultToComponent(schema, options) {
|
|
8
|
+
const formioProps = (0, getFormioProps_1.getFormioProps)(schema);
|
|
9
|
+
return (0, core_1.cleanObject)({
|
|
10
|
+
...formioProps,
|
|
11
|
+
disabled: !!schema.readOnly,
|
|
12
|
+
description: schema.description,
|
|
13
|
+
defaultValue: schema.default
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
exports.defaultToComponent = defaultToComponent;
|
|
17
|
+
(0, FormioMappersContainer_1.registerFormioMapper)("default", defaultToComponent);
|
|
18
|
+
//# sourceMappingURL=defaultToComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultToComponent.js","sourceRoot":"","sources":["../../../src/components/defaultToComponent.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AACvC,iFAA0E;AAC1E,4DAAuD;AAEvD,SAAgB,kBAAkB,CAAC,MAAW,EAAE,OAAY;IAC1D,MAAM,WAAW,GAAG,IAAA,+BAAc,EAAC,MAAM,CAAC,CAAC;IAE3C,OAAO,IAAA,kBAAW,EAAC;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;AATD,gDASC;AAED,IAAA,6CAAoB,EAAC,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"]}
|
|
File without changes
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.enumToComponent = void 0;
|
|
4
|
+
const core_1 = require("@tsed/core");
|
|
5
|
+
const change_case_1 = require("change-case");
|
|
6
|
+
const FormioMappersContainer_1 = require("../registries/FormioMappersContainer");
|
|
7
|
+
function enumToComponent(schema, options) {
|
|
8
|
+
const component = (0, FormioMappersContainer_1.execMapper)("default", schema, options);
|
|
9
|
+
const values = schema.enum.map((value) => {
|
|
10
|
+
return {
|
|
11
|
+
label: (0, change_case_1.sentenceCase)(value),
|
|
12
|
+
value
|
|
13
|
+
};
|
|
14
|
+
});
|
|
15
|
+
if (component.type === "select") {
|
|
16
|
+
return (0, core_1.cleanObject)({
|
|
17
|
+
...component,
|
|
18
|
+
data: {
|
|
19
|
+
json: JSON.stringify(values)
|
|
20
|
+
},
|
|
21
|
+
dataSrc: "json",
|
|
22
|
+
idPath: "value",
|
|
23
|
+
valueProperty: "value",
|
|
24
|
+
template: "<span>{{ item.label }}</span>"
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return (0, core_1.cleanObject)({
|
|
28
|
+
...component,
|
|
29
|
+
values: schema["x-values"] || values.map((value) => ({ ...value, shortcut: "" }))
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
exports.enumToComponent = enumToComponent;
|
|
33
|
+
(0, FormioMappersContainer_1.registerFormioMapper)("enum", enumToComponent);
|
|
34
|
+
//# sourceMappingURL=enumToComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enumToComponent.js","sourceRoot":"","sources":["../../../src/components/enumToComponent.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AACvC,6CAAyC;AACzC,iFAAsF;AAEtF,SAAgB,eAAe,CAAC,MAAW,EAAE,OAAY;IACvD,MAAM,SAAS,GAAG,IAAA,mCAAU,EAAC,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,IAAA,0BAAY,EAAC,KAAK,CAAC;YAC1B,KAAK;SACN,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,IAAI,SAAS,CAAC,IAAI,KAAK,QAAQ,EAAE;QAC/B,OAAO,IAAA,kBAAW,EAAC;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,IAAA,kBAAW,EAAC;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;AA1BD,0CA0BC;AAED,IAAA,6CAAoB,EAAC,MAAM,EAAE,eAAe,CAAC,CAAC","sourcesContent":["import {cleanObject} from \"@tsed/core\";\nimport {sentenceCase} from \"change-case\";\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: sentenceCase(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"]}
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
(0, tslib_1.__exportStar)(require("./anyToComponent"), exports);
|
|
5
|
+
(0, tslib_1.__exportStar)(require("./arrayToComponent"), exports);
|
|
6
|
+
(0, tslib_1.__exportStar)(require("./booleanToComponent"), exports);
|
|
7
|
+
(0, tslib_1.__exportStar)(require("./dateToComponent"), exports);
|
|
8
|
+
(0, tslib_1.__exportStar)(require("./defaultToComponent"), exports);
|
|
9
|
+
(0, tslib_1.__exportStar)(require("./enumToComponent"), exports);
|
|
10
|
+
(0, tslib_1.__exportStar)(require("./mapToComponent"), exports);
|
|
11
|
+
(0, tslib_1.__exportStar)(require("./nestedToComponent"), exports);
|
|
12
|
+
(0, tslib_1.__exportStar)(require("./numberToComponent"), exports);
|
|
13
|
+
(0, tslib_1.__exportStar)(require("./objectToEditGrid"), exports);
|
|
14
|
+
(0, tslib_1.__exportStar)(require("./panelToComponent"), exports);
|
|
15
|
+
(0, tslib_1.__exportStar)(require("./propertiesToComponents"), exports);
|
|
16
|
+
(0, tslib_1.__exportStar)(require("./stringToComponent"), exports);
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":";;;AAAA,gEAAiC;AACjC,kEAAmC;AACnC,oEAAqC;AACrC,iEAAkC;AAClC,oEAAqC;AACrC,iEAAkC;AAClC,gEAAiC;AACjC,mEAAoC;AACpC,mEAAoC;AACpC,kEAAmC;AACnC,kEAAmC;AACnC,wEAAyC;AACzC,mEAAoC","sourcesContent":["export * from \"./anyToComponent\";\nexport * from \"./arrayToComponent\";\nexport * from \"./booleanToComponent\";\nexport * from \"./dateToComponent\";\nexport * from \"./defaultToComponent\";\nexport * from \"./enumToComponent\";\nexport * from \"./mapToComponent\";\nexport * from \"./nestedToComponent\";\nexport * from \"./numberToComponent\";\nexport * from \"./objectToEditGrid\";\nexport * from \"./panelToComponent\";\nexport * from \"./propertiesToComponents\";\nexport * from \"./stringToComponent\";\n"]}
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapToComponent = void 0;
|
|
4
|
+
const FormioMappersContainer_1 = require("../registries/FormioMappersContainer");
|
|
5
|
+
function mapToComponent(schema, options) {
|
|
6
|
+
return {
|
|
7
|
+
...(0, FormioMappersContainer_1.execMapper)("default", schema, options),
|
|
8
|
+
type: "datamap",
|
|
9
|
+
tableView: false,
|
|
10
|
+
input: true,
|
|
11
|
+
valueComponent: {
|
|
12
|
+
...(schema.additionalProperties ? (0, FormioMappersContainer_1.execMapper)("any", schema.additionalProperties, options) : {}),
|
|
13
|
+
hideLabel: true,
|
|
14
|
+
tableView: true
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
exports.mapToComponent = mapToComponent;
|
|
19
|
+
(0, FormioMappersContainer_1.registerFormioMapper)("map", mapToComponent);
|
|
20
|
+
//# sourceMappingURL=mapToComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapToComponent.js","sourceRoot":"","sources":["../../../src/components/mapToComponent.ts"],"names":[],"mappings":";;;AAAA,iFAAsF;AAEtF,SAAgB,cAAc,CAAC,MAAW,EAAE,OAAY;IACtD,OAAO;QACL,GAAG,IAAA,mCAAU,EAAC,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,IAAA,mCAAU,EAAC,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;AAZD,wCAYC;AAED,IAAA,6CAAoB,EAAC,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"]}
|
|
File without changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.nestedToComponent = void 0;
|
|
4
|
+
const change_case_1 = require("change-case");
|
|
5
|
+
const FormioMappersContainer_1 = require("../registries/FormioMappersContainer");
|
|
6
|
+
function nestedToComponent(schema, options) {
|
|
7
|
+
return {
|
|
8
|
+
...(0, FormioMappersContainer_1.execMapper)("default", schema, options),
|
|
9
|
+
label: false,
|
|
10
|
+
tableView: false,
|
|
11
|
+
type: "form",
|
|
12
|
+
display: "form",
|
|
13
|
+
input: true,
|
|
14
|
+
components: [
|
|
15
|
+
{
|
|
16
|
+
key: "panel",
|
|
17
|
+
label: options.parentKey && (0, change_case_1.sentenceCase)(options.parentKey),
|
|
18
|
+
...(0, FormioMappersContainer_1.execMapper)("panel", schema, options)
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
exports.nestedToComponent = nestedToComponent;
|
|
24
|
+
(0, FormioMappersContainer_1.registerFormioMapper)("nested", nestedToComponent);
|
|
25
|
+
//# sourceMappingURL=nestedToComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nestedToComponent.js","sourceRoot":"","sources":["../../../src/components/nestedToComponent.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AACzC,iFAAsF;AAEtF,SAAgB,iBAAiB,CAAC,MAAW,EAAE,OAAY;IACzD,OAAO;QACL,GAAG,IAAA,mCAAU,EAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC;QACzC,KAAK,EAAE,KAAK;QACZ,SAAS,EAAE,KAAK;QAChB,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,MAAM;QACf,KAAK,EAAE,IAAI;QACX,UAAU,EAAE;YACV;gBACE,GAAG,EAAE,OAAO;gBACZ,KAAK,EAAE,OAAO,CAAC,SAAS,IAAI,IAAA,0BAAY,EAAC,OAAO,CAAC,SAAS,CAAC;gBAC3D,GAAG,IAAA,mCAAU,EAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC;aACxC;SACF;KACF,CAAC;AACJ,CAAC;AAhBD,8CAgBC;AAED,IAAA,6CAAoB,EAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["import {sentenceCase} from \"change-case\";\nimport {execMapper, registerFormioMapper} from \"../registries/FormioMappersContainer\";\n\nexport function nestedToComponent(schema: any, options: any) {\n return {\n ...execMapper(\"default\", schema, options),\n label: false,\n tableView: false,\n type: \"form\",\n display: \"form\",\n input: true,\n components: [\n {\n key: \"panel\",\n label: options.parentKey && sentenceCase(options.parentKey),\n ...execMapper(\"panel\", schema, options)\n }\n ]\n };\n}\n\nregisterFormioMapper(\"nested\", nestedToComponent);\n"]}
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.numberToComponent = void 0;
|
|
4
|
+
const core_1 = require("@tsed/core");
|
|
5
|
+
const FormioMappersContainer_1 = require("../registries/FormioMappersContainer");
|
|
6
|
+
function numberToComponent(schema, options) {
|
|
7
|
+
const component = (0, FormioMappersContainer_1.execMapper)("default", schema, options);
|
|
8
|
+
return (0, core_1.cleanObject)({
|
|
9
|
+
...component,
|
|
10
|
+
input: true,
|
|
11
|
+
delimiter: (0, core_1.getValue)(component, "delimiter", false),
|
|
12
|
+
inputFormat: (0, core_1.getValue)(component, "inputFormat", "plain"),
|
|
13
|
+
mask: (0, core_1.getValue)(component, "mask", false),
|
|
14
|
+
requireDecimal: false,
|
|
15
|
+
type: "number"
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
exports.numberToComponent = numberToComponent;
|
|
19
|
+
(0, FormioMappersContainer_1.registerFormioMapper)("number", numberToComponent);
|
|
20
|
+
(0, FormioMappersContainer_1.registerFormioMapper)("integer", numberToComponent);
|
|
21
|
+
//# sourceMappingURL=numberToComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"numberToComponent.js","sourceRoot":"","sources":["../../../src/components/numberToComponent.ts"],"names":[],"mappings":";;;AAAA,qCAAiD;AACjD,iFAAsF;AAEtF,SAAgB,iBAAiB,CAAC,MAAW,EAAE,OAAY;IACzD,MAAM,SAAS,GAAG,IAAA,mCAAU,EAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAEzD,OAAO,IAAA,kBAAW,EAAC;QACjB,GAAG,SAAS;QACZ,KAAK,EAAE,IAAI;QACX,SAAS,EAAE,IAAA,eAAQ,EAAC,SAAS,EAAE,WAAW,EAAE,KAAK,CAAC;QAClD,WAAW,EAAE,IAAA,eAAQ,EAAC,SAAS,EAAE,aAAa,EAAE,OAAO,CAAC;QACxD,IAAI,EAAE,IAAA,eAAQ,EAAC,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC;QACxC,cAAc,EAAE,KAAK;QACrB,IAAI,EAAE,QAAQ;KACf,CAAC,CAAC;AACL,CAAC;AAZD,8CAYC;AAED,IAAA,6CAAoB,EAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;AAClD,IAAA,6CAAoB,EAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["import {cleanObject, getValue} from \"@tsed/core\";\nimport {execMapper, registerFormioMapper} from \"../registries/FormioMappersContainer\";\n\nexport function numberToComponent(schema: any, options: any) {\n const component = execMapper(\"default\", schema, options);\n\n return cleanObject({\n ...component,\n input: true,\n delimiter: getValue(component, \"delimiter\", false),\n inputFormat: getValue(component, \"inputFormat\", \"plain\"),\n mask: getValue(component, \"mask\", false),\n requireDecimal: false,\n type: \"number\"\n });\n}\n\nregisterFormioMapper(\"number\", numberToComponent);\nregisterFormioMapper(\"integer\", numberToComponent);\n"]}
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.objectToEditGrid = void 0;
|
|
4
|
+
const FormioMappersContainer_1 = require("../registries/FormioMappersContainer");
|
|
5
|
+
function objectToEditGrid(schema, options) {
|
|
6
|
+
return {
|
|
7
|
+
...(0, FormioMappersContainer_1.execMapper)("default", schema, options),
|
|
8
|
+
rowDrafts: false,
|
|
9
|
+
type: "editgrid",
|
|
10
|
+
input: true,
|
|
11
|
+
components: (0, FormioMappersContainer_1.execMapper)("properties", schema, options)
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
exports.objectToEditGrid = objectToEditGrid;
|
|
15
|
+
(0, FormioMappersContainer_1.registerFormioMapper)("editgrid", objectToEditGrid);
|
|
16
|
+
//# sourceMappingURL=objectToEditGrid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objectToEditGrid.js","sourceRoot":"","sources":["../../../src/components/objectToEditGrid.ts"],"names":[],"mappings":";;;AAAA,iFAAsF;AAEtF,SAAgB,gBAAgB,CAAC,MAAW,EAAE,OAAY;IACxD,OAAO;QACL,GAAG,IAAA,mCAAU,EAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC;QACzC,SAAS,EAAE,KAAK;QAChB,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,IAAI;QACX,UAAU,EAAE,IAAA,mCAAU,EAAC,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC;KACtD,CAAC;AACJ,CAAC;AARD,4CAQC;AAED,IAAA,6CAAoB,EAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["import {execMapper, registerFormioMapper} from \"../registries/FormioMappersContainer\";\n\nexport function objectToEditGrid(schema: any, options: any) {\n return {\n ...execMapper(\"default\", schema, options),\n rowDrafts: false,\n type: \"editgrid\",\n input: true,\n components: execMapper(\"properties\", schema, options)\n };\n}\n\nregisterFormioMapper(\"editgrid\", objectToEditGrid);\n"]}
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.panelToComponent = void 0;
|
|
4
|
+
const FormioMappersContainer_1 = require("../registries/FormioMappersContainer");
|
|
5
|
+
function panelToComponent(schema, options) {
|
|
6
|
+
return {
|
|
7
|
+
...(0, FormioMappersContainer_1.execMapper)("default", schema, options),
|
|
8
|
+
collapsible: false,
|
|
9
|
+
input: false,
|
|
10
|
+
tableView: false,
|
|
11
|
+
components: (0, FormioMappersContainer_1.execMapper)("properties", schema, options)
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
exports.panelToComponent = panelToComponent;
|
|
15
|
+
(0, FormioMappersContainer_1.registerFormioMapper)("panel", panelToComponent);
|
|
16
|
+
//# sourceMappingURL=panelToComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panelToComponent.js","sourceRoot":"","sources":["../../../src/components/panelToComponent.ts"],"names":[],"mappings":";;;AAAA,iFAAsF;AAEtF,SAAgB,gBAAgB,CAAC,MAAW,EAAE,OAAY;IACxD,OAAO;QACL,GAAG,IAAA,mCAAU,EAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC;QACzC,WAAW,EAAE,KAAK;QAClB,KAAK,EAAE,KAAK;QACZ,SAAS,EAAE,KAAK;QAChB,UAAU,EAAE,IAAA,mCAAU,EAAC,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC;KACtD,CAAC;AACJ,CAAC;AARD,4CAQC;AAED,IAAA,6CAAoB,EAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["import {execMapper, registerFormioMapper} from \"../registries/FormioMappersContainer\";\n\nexport function panelToComponent(schema: any, options: any) {\n return {\n ...execMapper(\"default\", schema, options),\n collapsible: false,\n input: false,\n tableView: false,\n components: execMapper(\"properties\", schema, options)\n };\n}\n\nregisterFormioMapper(\"panel\", panelToComponent);\n"]}
|
|
File without changes
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.propertiesToComponents = void 0;
|
|
4
|
+
const core_1 = require("@tsed/core");
|
|
5
|
+
const change_case_1 = require("change-case");
|
|
6
|
+
const FormioMappersContainer_1 = require("../registries/FormioMappersContainer");
|
|
7
|
+
function bindResolvers(component, options) {
|
|
8
|
+
if (component.data) {
|
|
9
|
+
const data = component.data;
|
|
10
|
+
Object.entries(data).forEach(([key, resolver]) => {
|
|
11
|
+
if ((0, core_1.isFunction)(resolver)) {
|
|
12
|
+
options.resolvers.push(async (form) => {
|
|
13
|
+
data[key] = await resolver({ ...options, component, form });
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function mapValidation(key, base, schema, propSchema) {
|
|
20
|
+
const required = (schema.required || []).includes(key);
|
|
21
|
+
const validate = {
|
|
22
|
+
...(base.validate || {}),
|
|
23
|
+
required,
|
|
24
|
+
pattern: propSchema.pattern,
|
|
25
|
+
minLength: !required || (required && propSchema.minLength > 1) ? propSchema.minLength : undefined,
|
|
26
|
+
maxLength: propSchema.maxLength,
|
|
27
|
+
min: propSchema.minimum,
|
|
28
|
+
max: propSchema.maximum
|
|
29
|
+
};
|
|
30
|
+
switch (propSchema.type) {
|
|
31
|
+
case "string":
|
|
32
|
+
if (propSchema.minLength === 0 && validate.required) {
|
|
33
|
+
validate.minLength = undefined;
|
|
34
|
+
validate.required = false;
|
|
35
|
+
}
|
|
36
|
+
break;
|
|
37
|
+
case "boolean":
|
|
38
|
+
validate.required = false;
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
return (0, core_1.cleanObject)(validate);
|
|
42
|
+
}
|
|
43
|
+
function propertiesToComponents(schema, options) {
|
|
44
|
+
const tabs = {
|
|
45
|
+
label: "Tabs",
|
|
46
|
+
key: "tabs",
|
|
47
|
+
type: "tabs",
|
|
48
|
+
input: false,
|
|
49
|
+
tableView: false,
|
|
50
|
+
components: new Map(),
|
|
51
|
+
pushed: false
|
|
52
|
+
};
|
|
53
|
+
const components = [];
|
|
54
|
+
Object.entries(schema.properties).forEach(([key, propSchema]) => {
|
|
55
|
+
const tabsOptions = propSchema["x-formiotabs"];
|
|
56
|
+
const base = (0, FormioMappersContainer_1.execMapper)("any", propSchema, { parentKey: key, ...options });
|
|
57
|
+
const component = (0, core_1.cleanObject)({
|
|
58
|
+
key,
|
|
59
|
+
...base,
|
|
60
|
+
label: base.label == false ? undefined : base.label || propSchema.title || (0, change_case_1.sentenceCase)(key),
|
|
61
|
+
validate: mapValidation(key, base, schema, propSchema)
|
|
62
|
+
});
|
|
63
|
+
bindResolvers(component, options);
|
|
64
|
+
if (tabsOptions) {
|
|
65
|
+
if (!tabs.pushed) {
|
|
66
|
+
components.push(tabs);
|
|
67
|
+
tabs.pushed = true;
|
|
68
|
+
}
|
|
69
|
+
if (!tabs.components.has(tabsOptions.key)) {
|
|
70
|
+
tabs.components.set(tabsOptions.key, {
|
|
71
|
+
...tabsOptions,
|
|
72
|
+
components: []
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
tabs.components.get(tabsOptions.key).components.push(component);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
components.push(component);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
if (tabs.components.size) {
|
|
82
|
+
tabs.components = [...tabs.components.values()];
|
|
83
|
+
}
|
|
84
|
+
return components;
|
|
85
|
+
}
|
|
86
|
+
exports.propertiesToComponents = propertiesToComponents;
|
|
87
|
+
(0, FormioMappersContainer_1.registerFormioMapper)("properties", propertiesToComponents);
|
|
88
|
+
//# sourceMappingURL=propertiesToComponents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"propertiesToComponents.js","sourceRoot":"","sources":["../../../src/components/propertiesToComponents.ts"],"names":[],"mappings":"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","sourcesContent":["import {cleanObject, isFunction} from \"@tsed/core\";\nimport {sentenceCase} from \"change-case\";\nimport {FormioComponent, FormioForm} from \"@tsed/formio-types\";\nimport {execMapper, registerFormioMapper} from \"../registries/FormioMappersContainer\";\n\nfunction bindResolvers(component: FormioComponent, options: any) {\n if (component.data) {\n const data = component.data;\n\n Object.entries(data).forEach(([key, resolver]) => {\n if (isFunction(resolver)) {\n options.resolvers.push(async (form: FormioForm) => {\n data[key] = await resolver({...options, component, form});\n });\n }\n });\n }\n}\n\nfunction mapValidation(key: string, base: FormioComponent, schema: any, propSchema: any) {\n const required = (schema.required || []).includes(key);\n const validate = {\n ...(base.validate || {}),\n required,\n pattern: propSchema.pattern,\n minLength: !required || (required && propSchema.minLength > 1) ? propSchema.minLength : undefined,\n maxLength: propSchema.maxLength,\n min: propSchema.minimum,\n max: propSchema.maximum\n };\n\n switch (propSchema.type) {\n case \"string\":\n if (propSchema.minLength === 0 && validate.required) {\n validate.minLength = undefined;\n validate.required = false;\n }\n break;\n case \"boolean\":\n validate.required = false;\n break;\n }\n\n return cleanObject(validate);\n}\n\nexport function propertiesToComponents(schema: any, options: any): any[] {\n const tabs = {\n label: \"Tabs\",\n key: \"tabs\",\n type: \"tabs\",\n input: false,\n tableView: false,\n components: new Map<string, any>(),\n pushed: false\n };\n const components: any[] = [];\n\n Object.entries(schema.properties).forEach(([key, propSchema]: [string, any]) => {\n const tabsOptions = propSchema[\"x-formiotabs\"];\n const base = execMapper(\"any\", propSchema, {parentKey: key, ...options});\n\n const component = cleanObject({\n key,\n ...base,\n label: base.label == false ? undefined : base.label || propSchema.title || sentenceCase(key),\n validate: mapValidation(key, base, schema, propSchema)\n });\n\n bindResolvers(component, options);\n\n if (tabsOptions) {\n if (!tabs.pushed) {\n components.push(tabs);\n tabs.pushed = true;\n }\n\n if (!tabs.components.has(tabsOptions.key)) {\n tabs.components.set(tabsOptions.key, {\n ...tabsOptions,\n components: []\n });\n }\n\n tabs.components.get(tabsOptions.key).components.push(component);\n } else {\n components.push(component);\n }\n });\n\n if (tabs.components.size) {\n tabs.components = [...tabs.components.values()] as any;\n }\n\n return components;\n}\n\nregisterFormioMapper(\"properties\", propertiesToComponents);\n"]}
|
|
File without changes
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stringToComponent = void 0;
|
|
4
|
+
const core_1 = require("@tsed/core");
|
|
5
|
+
const FormioMappersContainer_1 = require("../registries/FormioMappersContainer");
|
|
6
|
+
function stringToComponent(schema, options) {
|
|
7
|
+
if (schema.format) {
|
|
8
|
+
const component = (0, FormioMappersContainer_1.execMapper)("default", schema, options);
|
|
9
|
+
switch (schema.format) {
|
|
10
|
+
case "date":
|
|
11
|
+
case "date-time":
|
|
12
|
+
return (0, FormioMappersContainer_1.execMapper)("date", schema, options);
|
|
13
|
+
case "uri":
|
|
14
|
+
return (0, core_1.cleanObject)({
|
|
15
|
+
input: true,
|
|
16
|
+
...component,
|
|
17
|
+
type: component.type || "url"
|
|
18
|
+
});
|
|
19
|
+
default:
|
|
20
|
+
return (0, core_1.cleanObject)({
|
|
21
|
+
input: true,
|
|
22
|
+
...component,
|
|
23
|
+
type: component.type || schema.format
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (schema.enum) {
|
|
28
|
+
const component = (0, FormioMappersContainer_1.execMapper)("enum", schema, options);
|
|
29
|
+
return {
|
|
30
|
+
...component,
|
|
31
|
+
type: component.type || "radio"
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
const component = (0, FormioMappersContainer_1.execMapper)("default", schema, options);
|
|
35
|
+
return (0, core_1.cleanObject)({
|
|
36
|
+
input: true,
|
|
37
|
+
type: component.type || "textfield",
|
|
38
|
+
...component
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
exports.stringToComponent = stringToComponent;
|
|
42
|
+
(0, FormioMappersContainer_1.registerFormioMapper)("string", stringToComponent);
|
|
43
|
+
//# sourceMappingURL=stringToComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stringToComponent.js","sourceRoot":"","sources":["../../../src/components/stringToComponent.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AACvC,iFAAsF;AAEtF,SAAgB,iBAAiB,CAAC,MAAW,EAAE,OAAY;IACzD,IAAI,MAAM,CAAC,MAAM,EAAE;QACjB,MAAM,SAAS,GAAG,IAAA,mCAAU,EAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QACzD,QAAQ,MAAM,CAAC,MAAM,EAAE;YACrB,KAAK,MAAM,CAAC;YACZ,KAAK,WAAW;gBACd,OAAO,IAAA,mCAAU,EAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;YAC7C,KAAK,KAAK;gBACR,OAAO,IAAA,kBAAW,EAAC;oBACjB,KAAK,EAAE,IAAI;oBACX,GAAG,SAAS;oBACZ,IAAI,EAAE,SAAS,CAAC,IAAI,IAAI,KAAK;iBAC9B,CAAC,CAAC;YACL;gBACE,OAAO,IAAA,kBAAW,EAAC;oBACjB,KAAK,EAAE,IAAI;oBACX,GAAG,SAAS;oBACZ,IAAI,EAAE,SAAS,CAAC,IAAI,IAAI,MAAM,CAAC,MAAM;iBACtC,CAAC,CAAC;SACN;KACF;IAED,IAAI,MAAM,CAAC,IAAI,EAAE;QACf,MAAM,SAAS,GAAG,IAAA,mCAAU,EAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAEtD,OAAO;YACL,GAAG,SAAS;YACZ,IAAI,EAAE,SAAS,CAAC,IAAI,IAAI,OAAO;SAChC,CAAC;KACH;IAED,MAAM,SAAS,GAAG,IAAA,mCAAU,EAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACzD,OAAO,IAAA,kBAAW,EAAC;QACjB,KAAK,EAAE,IAAI;QACX,IAAI,EAAE,SAAS,CAAC,IAAI,IAAI,WAAW;QACnC,GAAG,SAAS;KACb,CAAC,CAAC;AACL,CAAC;AArCD,8CAqCC;AAED,IAAA,6CAAoB,EAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["import {cleanObject} from \"@tsed/core\";\nimport {execMapper, registerFormioMapper} from \"../registries/FormioMappersContainer\";\n\nexport function stringToComponent(schema: any, options: any) {\n if (schema.format) {\n const component = execMapper(\"default\", schema, options);\n switch (schema.format) {\n case \"date\":\n case \"date-time\":\n return execMapper(\"date\", schema, options);\n case \"uri\":\n return cleanObject({\n input: true,\n ...component,\n type: component.type || \"url\"\n });\n default:\n return cleanObject({\n input: true,\n ...component,\n type: component.type || schema.format\n });\n }\n }\n\n if (schema.enum) {\n const component = execMapper(\"enum\", schema, options);\n\n return {\n ...component,\n type: component.type || \"radio\"\n };\n }\n\n const component = execMapper(\"default\", schema, options);\n return cleanObject({\n input: true,\n type: component.type || \"textfield\",\n ...component\n });\n}\n\nregisterFormioMapper(\"string\", stringToComponent);\n"]}
|
|
File without changes
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Component = void 0;
|
|
4
|
+
const schema_1 = require("@tsed/schema");
|
|
5
|
+
/**
|
|
6
|
+
* Declare a formio Component schema on the decorated propertyKey.
|
|
7
|
+
* @decorator
|
|
8
|
+
* @formio
|
|
9
|
+
* @property
|
|
10
|
+
* @schema
|
|
11
|
+
*/
|
|
12
|
+
function Component(component) {
|
|
13
|
+
component = Object.entries(component).reduce((component, [key, value]) => {
|
|
14
|
+
if (key === "validate") {
|
|
15
|
+
component["x-formio-validate"] = {
|
|
16
|
+
...(component["x-formio-validate"] || {}),
|
|
17
|
+
...value
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
...component,
|
|
22
|
+
[`x-formio-${key}`]: value
|
|
23
|
+
};
|
|
24
|
+
}, {});
|
|
25
|
+
return (0, schema_1.JsonEntityFn)((store) => {
|
|
26
|
+
Object.entries(component).forEach(([key, value]) => {
|
|
27
|
+
store.itemSchema.customKey(key, value);
|
|
28
|
+
if (store.isCollection) {
|
|
29
|
+
store.schema.customKey(key, value);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
exports.Component = Component;
|
|
35
|
+
//# sourceMappingURL=component.js.map
|