@tsed/schema-formio 6.87.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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getFormioProps.js","sourceRoot":"","sources":["../../../src/utils/getFormioProps.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,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","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,38 @@
|
|
|
1
|
+
import { isString } from "@tsed/core";
|
|
2
|
+
import { getJsonSchema, JsonEntityStore } from "@tsed/schema";
|
|
3
|
+
import { execMapper } from "../registries/FormioMappersContainer";
|
|
4
|
+
import "../components";
|
|
5
|
+
import { FormsContainer } from "../registries/FormsContainer";
|
|
6
|
+
import { paramCase } from "change-case";
|
|
7
|
+
export async function getFormioSchema(model, options = {}) {
|
|
8
|
+
if (!model) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
if (isString(model)) {
|
|
12
|
+
return getFormioSchema(FormsContainer.get(model), options);
|
|
13
|
+
}
|
|
14
|
+
const entity = JsonEntityStore.from(model);
|
|
15
|
+
const schema = getJsonSchema(entity, {
|
|
16
|
+
...options,
|
|
17
|
+
customKeys: true
|
|
18
|
+
});
|
|
19
|
+
const name = entity.schema.getName();
|
|
20
|
+
const machineName = paramCase(name);
|
|
21
|
+
const resolvers = [];
|
|
22
|
+
const components = execMapper("properties", schema, { ...options, definitions: schema.definitions, resolvers });
|
|
23
|
+
const form = {
|
|
24
|
+
title: name,
|
|
25
|
+
type: "form",
|
|
26
|
+
display: "form",
|
|
27
|
+
tags: [],
|
|
28
|
+
access: [],
|
|
29
|
+
submissionAccess: [],
|
|
30
|
+
...entity.store.get("formio:form", {}),
|
|
31
|
+
name: machineName,
|
|
32
|
+
machineName,
|
|
33
|
+
components
|
|
34
|
+
};
|
|
35
|
+
await Promise.all(resolvers.map((resolver) => resolver(form, options)));
|
|
36
|
+
return form;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=getFormioSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getFormioSchema.js","sourceRoot":"","sources":["../../../src/utils/getFormioSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAO,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAC,aAAa,EAAE,eAAe,EAAoB,MAAM,cAAc,CAAC;AAE/E,OAAO,EAAC,UAAU,EAAC,MAAM,sCAAsC,CAAC;AAChE,OAAO,eAAe,CAAC;AACvB,OAAO,EAAC,cAAc,EAAC,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,KAA+B,EAC/B,UAA6B,EAAE;IAE/B,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,SAAS,CAAC;KAClB;IAED,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE;QACnB,OAAO,eAAe,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,CAAc,EAAE,OAAO,CAAC,CAAC;KACzE;IAED,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3C,MAAM,MAAM,GAAG,aAAa,CAAC,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,SAAS,CAAC,IAAI,CAAC,CAAC;IACpC,MAAM,SAAS,GAAmB,EAAE,CAAC;IACrC,MAAM,UAAU,GAAG,UAAU,CAAC,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,OAAQ,IAA8B,CAAC;AACzC,CAAC","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 \"../components\";\nimport {FormsContainer} from \"../registries/FormsContainer\";\nimport {paramCase} from \"change-case\";\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 @@
|
|
|
1
|
+
{"version":3,"file":"getRef.js","sourceRoot":"","sources":["../../../src/utils/getRef.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC,MAAM,UAAU,MAAM,CAAC,MAAW,EAAE,OAAY;IAC9C,IAAI,MAAM,CAAC,IAAI,EAAE;QACf,OAAO,QAAQ,CAAC,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","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 @@
|
|
|
1
|
+
export declare function anyToComponent(schema: any, options: any): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function arrayToComponent(schema: any, options: any): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function defaultToComponent(schema: any, options: any): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function enumToComponent(schema: any, options: any): any;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from "./anyToComponent";
|
|
2
|
+
export * from "./arrayToComponent";
|
|
3
|
+
export * from "./booleanToComponent";
|
|
4
|
+
export * from "./dateToComponent";
|
|
5
|
+
export * from "./defaultToComponent";
|
|
6
|
+
export * from "./enumToComponent";
|
|
7
|
+
export * from "./mapToComponent";
|
|
8
|
+
export * from "./nestedToComponent";
|
|
9
|
+
export * from "./numberToComponent";
|
|
10
|
+
export * from "./objectToEditGrid";
|
|
11
|
+
export * from "./panelToComponent";
|
|
12
|
+
export * from "./propertiesToComponents";
|
|
13
|
+
export * from "./stringToComponent";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function mapToComponent(schema: any, options: any): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function nestedToComponent(schema: any, options: any): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function numberToComponent(schema: any, options: any): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function objectToEditGrid(schema: any, options: any): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function panelToComponent(schema: any, options: any): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function propertiesToComponents(schema: any, options: any): any[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function stringToComponent(schema: any, options: any): any;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adds a conditional display rule on the input form.
|
|
3
|
+
* @decorator
|
|
4
|
+
* @formio
|
|
5
|
+
* @property
|
|
6
|
+
* @schema
|
|
7
|
+
* @param conditional
|
|
8
|
+
*/
|
|
9
|
+
export declare function Conditional(conditional: {
|
|
10
|
+
show: boolean;
|
|
11
|
+
when: string;
|
|
12
|
+
eq: any;
|
|
13
|
+
}): PropertyDecorator;
|
|
14
|
+
/**
|
|
15
|
+
* Adds a conditional display rule on the input form.
|
|
16
|
+
* @decorator
|
|
17
|
+
* @formio
|
|
18
|
+
* @property
|
|
19
|
+
* @schema
|
|
20
|
+
* @param property
|
|
21
|
+
* @param eq
|
|
22
|
+
*/
|
|
23
|
+
export declare function ShowWhen(property: string, eq: any): PropertyDecorator;
|
|
24
|
+
/**
|
|
25
|
+
* Adds a conditional display rule on the input form.
|
|
26
|
+
* @decorator
|
|
27
|
+
* @formio
|
|
28
|
+
* @property
|
|
29
|
+
* @schema
|
|
30
|
+
* @param property
|
|
31
|
+
* @param eq
|
|
32
|
+
*/
|
|
33
|
+
export declare function HideWhen(property: string, eq: any): PropertyDecorator;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { FormioComponent, FormioForm, FormioSubmission } from "@tsed/formio-types";
|
|
2
|
+
import type { Moment } from "moment";
|
|
3
|
+
import type { LoDashStatic } from "lodash";
|
|
4
|
+
import type { Utils } from "formiojs";
|
|
5
|
+
export interface CustomConditionalCtx<Value = any, Data = any, Row = any> {
|
|
6
|
+
/**
|
|
7
|
+
* The complete submission object.
|
|
8
|
+
*/
|
|
9
|
+
form: FormioForm;
|
|
10
|
+
/**
|
|
11
|
+
* The complete submission object.
|
|
12
|
+
*/
|
|
13
|
+
submission: FormioSubmission<Data>;
|
|
14
|
+
/**
|
|
15
|
+
* The complete submission data object.
|
|
16
|
+
*/
|
|
17
|
+
data: Data;
|
|
18
|
+
/**
|
|
19
|
+
* Contextual "row" data, used within DataGrid, EditGrid, and Container components
|
|
20
|
+
*/
|
|
21
|
+
row: Row;
|
|
22
|
+
/**
|
|
23
|
+
* The current component JSON
|
|
24
|
+
*/
|
|
25
|
+
component: FormioComponent;
|
|
26
|
+
/**
|
|
27
|
+
* The current component instance.
|
|
28
|
+
*/
|
|
29
|
+
instance: any;
|
|
30
|
+
/**
|
|
31
|
+
* The current value of the component.
|
|
32
|
+
*/
|
|
33
|
+
value: Value;
|
|
34
|
+
/**
|
|
35
|
+
* The moment.js library for date manipulation.
|
|
36
|
+
*/
|
|
37
|
+
moment: Moment;
|
|
38
|
+
/**
|
|
39
|
+
* An instance of Lodash.
|
|
40
|
+
*/
|
|
41
|
+
_: LoDashStatic;
|
|
42
|
+
/**
|
|
43
|
+
* An instance of the FormioUtils object.
|
|
44
|
+
*/
|
|
45
|
+
utils: typeof Utils;
|
|
46
|
+
/**
|
|
47
|
+
* An alias for "utils".
|
|
48
|
+
*/
|
|
49
|
+
util: typeof Utils;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Adds custom conditional rule to display or not the input form.
|
|
53
|
+
* @decorator
|
|
54
|
+
* @formio
|
|
55
|
+
* @property
|
|
56
|
+
* @schema
|
|
57
|
+
* @param customConditional
|
|
58
|
+
*/
|
|
59
|
+
export declare function CustomConditional(customConditional: string | ((ctx: CustomConditionalCtx) => any)): PropertyDecorator;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FormioDataResolver } from "../domain/FormioDataResolver";
|
|
2
|
+
/**
|
|
3
|
+
* Set custom json data source
|
|
4
|
+
* @param data
|
|
5
|
+
* @param props
|
|
6
|
+
* @constructor
|
|
7
|
+
*/
|
|
8
|
+
export declare function DataSourceJson(data: any | FormioDataResolver, props?: Record<string, any>): PropertyDecorator;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FormioDataResolver } from "../domain/FormioDataResolver";
|
|
2
|
+
/**
|
|
3
|
+
* Set URL data on the current component.
|
|
4
|
+
* @param url
|
|
5
|
+
* @param props
|
|
6
|
+
* @constructor
|
|
7
|
+
*/
|
|
8
|
+
export declare function DataSourceUrl(url: string | FormioDataResolver, props?: Record<string, any>): PropertyDecorator;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export * from "./component";
|
|
2
|
+
export * from "./currency";
|
|
3
|
+
export * from "./dataSourceJson";
|
|
4
|
+
export * from "./dataSourceUrl";
|
|
5
|
+
export * from "./hidden";
|
|
6
|
+
export * from "./inputTags";
|
|
7
|
+
export * from "./multiple";
|
|
8
|
+
export * from "./password";
|
|
9
|
+
export * from "./select";
|
|
10
|
+
export * from "./tableView";
|
|
11
|
+
export * from "./textarea";
|
|
12
|
+
export * from "./errorMessage";
|
|
13
|
+
export * from "./errorLabel";
|
|
14
|
+
export * from "./minWords";
|
|
15
|
+
export * from "./maxWords";
|
|
16
|
+
export * from "./validate";
|
|
17
|
+
export * from "./form";
|
|
18
|
+
export * from "./tabs";
|
|
19
|
+
export * from "./placeholder";
|
|
20
|
+
export * from "./tooltip";
|
|
21
|
+
export * from "./label";
|
|
22
|
+
export * from "./customClass";
|
|
23
|
+
export * from "./modalEdit";
|
|
24
|
+
export * from "./mask";
|
|
25
|
+
export * from "./prefix";
|
|
26
|
+
export * from "./suffix";
|
|
27
|
+
export * from "./textCase";
|
|
28
|
+
export * from "./conditional";
|
|
29
|
+
export * from "./customConditional";
|
|
30
|
+
export * from "./openWhenEmpty";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An input mask helps the user with input by ensuring a predefined format.
|
|
3
|
+
*
|
|
4
|
+
* - 9: numeric
|
|
5
|
+
* - a: alphabetical
|
|
6
|
+
* - *: alphanumeric
|
|
7
|
+
*
|
|
8
|
+
* Example telephone mask: (999) 999-9999
|
|
9
|
+
*
|
|
10
|
+
* See the [jquery.inputmask](https://github.com/RobinHerbots/Inputmask) documentation for more information.
|
|
11
|
+
*
|
|
12
|
+
* @decorator
|
|
13
|
+
* @formio
|
|
14
|
+
* @property
|
|
15
|
+
* @schema
|
|
16
|
+
*/
|
|
17
|
+
export declare function Mask(inputMask: string, inputMaskPlaceholderChar?: string): PropertyDecorator;
|
|
18
|
+
/**
|
|
19
|
+
* An input mask helps the user with input by ensuring a predefined format.
|
|
20
|
+
*
|
|
21
|
+
* - 9: numeric
|
|
22
|
+
* - a: alphabetical
|
|
23
|
+
* - *: alphanumeric
|
|
24
|
+
*
|
|
25
|
+
* Example telephone mask: (999) 999-9999
|
|
26
|
+
*
|
|
27
|
+
* See the [jquery.inputmask](https://github.com/RobinHerbots/Inputmask) documentation for more information.
|
|
28
|
+
*
|
|
29
|
+
* @decorator
|
|
30
|
+
* @formio
|
|
31
|
+
* @property
|
|
32
|
+
* @schema
|
|
33
|
+
*/
|
|
34
|
+
export declare function Masks(...inputMasks: {
|
|
35
|
+
label: string;
|
|
36
|
+
mask: string;
|
|
37
|
+
}[]): PropertyDecorator;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface PasswordOpts extends Record<string, any> {
|
|
2
|
+
showCharCount?: boolean;
|
|
3
|
+
showWordCount?: boolean;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Configure the property as Password component.
|
|
7
|
+
* @decorator
|
|
8
|
+
* @formio
|
|
9
|
+
* @property
|
|
10
|
+
* @schema
|
|
11
|
+
*/
|
|
12
|
+
export declare function Password(props?: PasswordOpts): PropertyDecorator;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface SelectOpts extends Record<string, any> {
|
|
2
|
+
idPath?: string;
|
|
3
|
+
valueProperty?: string;
|
|
4
|
+
template?: string;
|
|
5
|
+
multiple?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Configure the property as Select component.
|
|
9
|
+
* @decorator
|
|
10
|
+
* @formio
|
|
11
|
+
* @property
|
|
12
|
+
* @schema
|
|
13
|
+
*/
|
|
14
|
+
export declare function Select(props?: SelectOpts): PropertyDecorator;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface TextareaOpts extends Record<string, any> {
|
|
2
|
+
showCharCount?: boolean;
|
|
3
|
+
showWordCount?: boolean;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Configure the property as Textarea component.
|
|
7
|
+
* @decorator
|
|
8
|
+
* @formio
|
|
9
|
+
* @property
|
|
10
|
+
* @schema
|
|
11
|
+
*/
|
|
12
|
+
export declare function Textarea(props?: TextareaOpts): PropertyDecorator;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FormioComponent, FormioForm } from "@tsed/formio-types";
|
|
2
|
+
import { JsonSchemaOptions } from "@tsed/schema";
|
|
3
|
+
export declare type FormioDataResolverCtx = {
|
|
4
|
+
component: FormioComponent;
|
|
5
|
+
form: FormioForm;
|
|
6
|
+
} & JsonSchemaOptions;
|
|
7
|
+
export declare type FormioDataResolver = (ctx: FormioDataResolverCtx) => Promise<any> | any;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface FormioMapper {
|
|
2
|
+
(schema: any, options: any): any;
|
|
3
|
+
}
|
|
4
|
+
export declare function registerFormioMapper(type: string, mapper: FormioMapper): Map<string, FormioMapper>;
|
|
5
|
+
export declare function getFormioMapper(type: string): FormioMapper;
|
|
6
|
+
export declare function execMapper(type: string, schema: any, options: any): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getFormioProps(schema: any): any;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { JsonSchemaOptions } from "@tsed/schema";
|
|
2
|
+
import { FormioForm } from "@tsed/formio-types";
|
|
3
|
+
import "../components";
|
|
4
|
+
export declare function getFormioSchema(model: string | any | undefined, options?: JsonSchemaOptions): Promise<Omit<FormioForm, "components" | "_id" | "deleted" | "owner"> | undefined>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getRef(schema: any, options: any): any;
|