@tsed/schema-formio 7.0.0-alpha.2 → 7.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/jest.config.js +14 -0
- package/lib/cjs/components/anyToComponent.js +28 -0
- package/lib/cjs/components/anyToComponent.js.map +1 -0
- package/lib/cjs/components/arrayToComponent.js +40 -0
- package/lib/cjs/components/arrayToComponent.js.map +1 -0
- package/lib/cjs/components/booleanToComponent.js +14 -0
- package/lib/cjs/components/booleanToComponent.js.map +1 -0
- package/lib/cjs/components/dateToComponent.js +57 -0
- package/lib/cjs/components/dateToComponent.js.map +1 -0
- package/lib/cjs/components/defaultToComponent.js +18 -0
- package/lib/cjs/components/defaultToComponent.js.map +1 -0
- package/lib/cjs/components/enumToComponent.js +33 -0
- package/lib/cjs/components/enumToComponent.js.map +1 -0
- package/lib/cjs/components/index.js +17 -0
- package/lib/cjs/components/index.js.map +1 -0
- package/lib/cjs/components/mapToComponent.js +20 -0
- package/lib/cjs/components/mapToComponent.js.map +1 -0
- package/lib/cjs/components/nestedToComponent.js +25 -0
- package/lib/cjs/components/nestedToComponent.js.map +1 -0
- package/lib/cjs/components/numberToComponent.js +21 -0
- package/lib/cjs/components/numberToComponent.js.map +1 -0
- package/lib/cjs/components/objectToEditGrid.js +16 -0
- package/lib/cjs/components/objectToEditGrid.js.map +1 -0
- package/lib/cjs/components/panelToComponent.js +16 -0
- package/lib/cjs/components/panelToComponent.js.map +1 -0
- package/lib/cjs/components/propertiesToComponents.js +88 -0
- package/lib/cjs/components/propertiesToComponents.js.map +1 -0
- package/lib/cjs/components/stringToComponent.js +43 -0
- package/lib/cjs/components/stringToComponent.js.map +1 -0
- package/lib/cjs/decorators/component.js +35 -0
- package/lib/cjs/decorators/component.js.map +1 -0
- package/lib/cjs/decorators/conditional.js +53 -0
- package/lib/cjs/decorators/conditional.js.map +1 -0
- package/lib/cjs/decorators/currency.js +24 -0
- package/lib/cjs/decorators/currency.js.map +1 -0
- package/lib/cjs/decorators/customClass.js +18 -0
- package/lib/cjs/decorators/customClass.js.map +1 -0
- package/lib/cjs/decorators/customConditional.js +33 -0
- package/lib/cjs/decorators/customConditional.js.map +1 -0
- package/lib/cjs/decorators/dataSourceJson.js +27 -0
- package/lib/cjs/decorators/dataSourceJson.js.map +1 -0
- package/lib/cjs/decorators/dataSourceUrl.js +22 -0
- package/lib/cjs/decorators/dataSourceUrl.js.map +1 -0
- package/lib/cjs/decorators/errorLabel.js +18 -0
- package/lib/cjs/decorators/errorLabel.js.map +1 -0
- package/lib/cjs/decorators/errorMessage.js +17 -0
- package/lib/cjs/decorators/errorMessage.js.map +1 -0
- package/lib/cjs/decorators/form.js +21 -0
- package/lib/cjs/decorators/form.js.map +1 -0
- package/lib/cjs/decorators/hidden.js +22 -0
- package/lib/cjs/decorators/hidden.js.map +1 -0
- package/lib/cjs/decorators/index.js +34 -0
- package/lib/cjs/decorators/index.js.map +1 -0
- package/lib/cjs/decorators/inputTags.js +23 -0
- package/lib/cjs/decorators/inputTags.js.map +1 -0
- package/lib/cjs/decorators/label.js +19 -0
- package/lib/cjs/decorators/label.js.map +1 -0
- package/lib/cjs/decorators/mask.js +50 -0
- package/lib/cjs/decorators/mask.js.map +1 -0
- package/lib/cjs/decorators/maxWords.js +17 -0
- package/lib/cjs/decorators/maxWords.js.map +1 -0
- package/lib/cjs/decorators/minWords.js +17 -0
- package/lib/cjs/decorators/minWords.js.map +1 -0
- package/lib/cjs/decorators/modalEdit.js +18 -0
- package/lib/cjs/decorators/modalEdit.js.map +1 -0
- package/lib/cjs/decorators/multiple.js +18 -0
- package/lib/cjs/decorators/multiple.js.map +1 -0
- package/lib/cjs/decorators/openWhenEmpty.js +18 -0
- package/lib/cjs/decorators/openWhenEmpty.js.map +1 -0
- package/lib/cjs/decorators/password.js +20 -0
- package/lib/cjs/decorators/password.js.map +1 -0
- package/lib/cjs/decorators/placeholder.js +19 -0
- package/lib/cjs/decorators/placeholder.js.map +1 -0
- package/lib/cjs/decorators/prefix.js +18 -0
- package/lib/cjs/decorators/prefix.js.map +1 -0
- package/lib/cjs/decorators/select.js +22 -0
- package/lib/cjs/decorators/select.js.map +1 -0
- package/lib/cjs/decorators/suffix.js +18 -0
- package/lib/cjs/decorators/suffix.js.map +1 -0
- package/lib/cjs/decorators/tableView.js +19 -0
- package/lib/cjs/decorators/tableView.js.map +1 -0
- package/lib/cjs/decorators/tabs.js +22 -0
- package/lib/cjs/decorators/tabs.js.map +1 -0
- package/lib/cjs/decorators/textCase.js +19 -0
- package/lib/cjs/decorators/textCase.js.map +1 -0
- package/lib/cjs/decorators/textarea.js +20 -0
- package/lib/cjs/decorators/textarea.js.map +1 -0
- package/lib/cjs/decorators/tooltip.js +19 -0
- package/lib/cjs/decorators/tooltip.js.map +1 -0
- package/lib/cjs/decorators/validate.js +22 -0
- package/lib/cjs/decorators/validate.js.map +1 -0
- package/lib/cjs/domain/FormioDataResolver.js +3 -0
- package/lib/cjs/domain/FormioDataResolver.js.map +1 -0
- package/lib/cjs/index.js +8 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/registries/FormioMappersContainer.js +21 -0
- package/lib/cjs/registries/FormioMappersContainer.js.map +1 -0
- package/lib/cjs/registries/FormsContainer.js +6 -0
- package/lib/cjs/registries/FormsContainer.js.map +1 -0
- package/lib/cjs/utils/getFormioProps.js +17 -0
- package/lib/cjs/utils/getFormioProps.js.map +1 -0
- package/lib/cjs/utils/getFormioSchema.js +42 -0
- package/lib/cjs/utils/getFormioSchema.js.map +1 -0
- package/lib/cjs/utils/getRef.js +12 -0
- package/lib/cjs/utils/getRef.js.map +1 -0
- package/lib/esm/components/anyToComponent.js +24 -0
- package/lib/esm/components/anyToComponent.js.map +1 -0
- package/lib/esm/components/arrayToComponent.js +36 -0
- package/lib/esm/components/arrayToComponent.js.map +1 -0
- package/lib/esm/components/booleanToComponent.js +12 -0
- package/lib/esm/components/booleanToComponent.js.map +1 -0
- package/lib/esm/components/dateToComponent.js +55 -0
- package/lib/esm/components/dateToComponent.js.map +1 -0
- package/lib/esm/components/defaultToComponent.js +14 -0
- package/lib/esm/components/defaultToComponent.js.map +1 -0
- package/lib/esm/components/enumToComponent.js +29 -0
- package/lib/esm/components/enumToComponent.js.map +1 -0
- package/lib/esm/components/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/{components → types/components}/anyToComponent.d.ts +0 -0
- package/lib/{components → types/components}/arrayToComponent.d.ts +0 -0
- package/lib/{components → types/components}/booleanToComponent.d.ts +0 -0
- package/lib/{components → types/components}/dateToComponent.d.ts +0 -0
- package/lib/{components → types/components}/defaultToComponent.d.ts +0 -0
- package/lib/{components → types/components}/enumToComponent.d.ts +0 -0
- package/lib/{components → types/components}/index.d.ts +0 -0
- package/lib/{components → types/components}/mapToComponent.d.ts +0 -0
- package/lib/{components → types/components}/nestedToComponent.d.ts +0 -0
- package/lib/{components → types/components}/numberToComponent.d.ts +0 -0
- package/lib/{components → types/components}/objectToEditGrid.d.ts +0 -0
- package/lib/{components → types/components}/panelToComponent.d.ts +0 -0
- package/lib/{components → types/components}/propertiesToComponents.d.ts +0 -0
- package/lib/{components → types/components}/stringToComponent.d.ts +0 -0
- package/lib/{decorators → types/decorators}/component.d.ts +0 -0
- package/lib/types/decorators/conditional.d.ts +33 -0
- package/lib/{decorators → types/decorators}/currency.d.ts +0 -0
- package/lib/types/decorators/customClass.d.ts +8 -0
- package/lib/types/decorators/customConditional.d.ts +59 -0
- package/lib/types/decorators/dataSourceJson.d.ts +8 -0
- package/lib/types/decorators/dataSourceUrl.d.ts +8 -0
- package/lib/types/decorators/errorLabel.d.ts +8 -0
- package/lib/types/decorators/errorMessage.d.ts +9 -0
- package/lib/types/decorators/form.d.ts +6 -0
- package/lib/{decorators → types/decorators}/hidden.d.ts +3 -0
- package/lib/types/decorators/index.d.ts +30 -0
- package/lib/{decorators → types/decorators}/inputTags.d.ts +0 -0
- package/lib/types/decorators/label.d.ts +9 -0
- package/lib/types/decorators/mask.d.ts +37 -0
- package/lib/types/decorators/maxWords.d.ts +9 -0
- package/lib/types/decorators/minWords.d.ts +9 -0
- package/lib/types/decorators/modalEdit.d.ts +8 -0
- package/lib/{decorators → types/decorators}/multiple.d.ts +0 -0
- package/lib/types/decorators/openWhenEmpty.d.ts +8 -0
- package/lib/types/decorators/password.d.ts +12 -0
- package/lib/types/decorators/placeholder.d.ts +9 -0
- package/lib/types/decorators/prefix.d.ts +8 -0
- package/lib/types/decorators/select.d.ts +14 -0
- package/lib/types/decorators/suffix.d.ts +8 -0
- package/lib/{decorators → types/decorators}/tableView.d.ts +0 -0
- package/lib/{decorators → types/decorators}/tabs.d.ts +0 -0
- package/lib/types/decorators/textCase.d.ts +9 -0
- package/lib/types/decorators/textarea.d.ts +12 -0
- package/lib/types/decorators/tooltip.d.ts +9 -0
- package/lib/types/decorators/validate.d.ts +10 -0
- package/lib/types/domain/FormioDataResolver.d.ts +7 -0
- package/lib/{index.d.ts → types/index.d.ts} +0 -0
- package/lib/{registries → types/registries}/FormioMappersContainer.d.ts +0 -0
- package/lib/types/registries/FormsContainer.d.ts +2 -0
- package/lib/{utils → types/utils}/getFormioProps.d.ts +0 -0
- package/lib/types/utils/getFormioSchema.d.ts +4 -0
- package/lib/{utils → types/utils}/getRef.d.ts +0 -0
- package/package.json +24 -19
- package/readme.md +6 -4
- package/tsconfig.compile.esm.json +23 -0
- package/.mocharc.js +0 -5
- package/.nycrc +0 -26
- package/lib/decorators/dataSourceJson.d.ts +0 -7
- package/lib/decorators/dataSourceUrl.d.ts +0 -7
- package/lib/decorators/index.d.ts +0 -11
- package/lib/decorators/password.d.ts +0 -8
- package/lib/decorators/select.d.ts +0 -8
- package/lib/decorators/textarea.d.ts +0 -8
- package/lib/index.js +0 -585
- package/lib/index.js.map +0 -1
- package/lib/index.modern.js +0 -562
- package/lib/index.modern.js.map +0 -1
- package/lib/utils/getFormioSchema.d.ts +0 -11
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { execMapper, registerFormioMapper } from "../registries/FormioMappersContainer";
|
|
2
|
+
export function mapToComponent(schema, options) {
|
|
3
|
+
return {
|
|
4
|
+
...execMapper("default", schema, options),
|
|
5
|
+
type: "datamap",
|
|
6
|
+
tableView: false,
|
|
7
|
+
input: true,
|
|
8
|
+
valueComponent: {
|
|
9
|
+
...(schema.additionalProperties ? execMapper("any", schema.additionalProperties, options) : {}),
|
|
10
|
+
hideLabel: true,
|
|
11
|
+
tableView: true
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
registerFormioMapper("map", mapToComponent);
|
|
16
|
+
//# sourceMappingURL=mapToComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapToComponent.js","sourceRoot":"","sources":["../../../src/components/mapToComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAEtF,MAAM,UAAU,cAAc,CAAC,MAAW,EAAE,OAAY;IACtD,OAAO;QACL,GAAG,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC;QACzC,IAAI,EAAE,SAAS;QACf,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE,IAAI;QACX,cAAc,EAAE;YACd,GAAG,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC/F,SAAS,EAAE,IAAI;YACf,SAAS,EAAE,IAAI;SAChB;KACF,CAAC;AACJ,CAAC;AAED,oBAAoB,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import {execMapper, registerFormioMapper} from \"../registries/FormioMappersContainer\";\n\nexport function mapToComponent(schema: any, options: any) {\n return {\n ...execMapper(\"default\", schema, options),\n type: \"datamap\",\n tableView: false,\n input: true,\n valueComponent: {\n ...(schema.additionalProperties ? execMapper(\"any\", schema.additionalProperties, options) : {}),\n hideLabel: true,\n tableView: true\n }\n };\n}\n\nregisterFormioMapper(\"map\", mapToComponent);\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { sentenceCase } from "change-case";
|
|
2
|
+
import { execMapper, registerFormioMapper } from "../registries/FormioMappersContainer";
|
|
3
|
+
export function nestedToComponent(schema, options) {
|
|
4
|
+
return {
|
|
5
|
+
...execMapper("default", schema, options),
|
|
6
|
+
label: false,
|
|
7
|
+
tableView: false,
|
|
8
|
+
type: "form",
|
|
9
|
+
display: "form",
|
|
10
|
+
input: true,
|
|
11
|
+
components: [
|
|
12
|
+
{
|
|
13
|
+
key: "panel",
|
|
14
|
+
label: options.parentKey && sentenceCase(options.parentKey),
|
|
15
|
+
...execMapper("panel", schema, options)
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
registerFormioMapper("nested", nestedToComponent);
|
|
21
|
+
//# sourceMappingURL=nestedToComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nestedToComponent.js","sourceRoot":"","sources":["../../../src/components/nestedToComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AACzC,OAAO,EAAC,UAAU,EAAE,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAEtF,MAAM,UAAU,iBAAiB,CAAC,MAAW,EAAE,OAAY;IACzD,OAAO;QACL,GAAG,UAAU,CAAC,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,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC;gBAC3D,GAAG,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC;aACxC;SACF;KACF,CAAC;AACJ,CAAC;AAED,oBAAoB,CAAC,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"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { cleanObject, getValue } from "@tsed/core";
|
|
2
|
+
import { execMapper, registerFormioMapper } from "../registries/FormioMappersContainer";
|
|
3
|
+
export function numberToComponent(schema, options) {
|
|
4
|
+
const component = execMapper("default", schema, options);
|
|
5
|
+
return cleanObject({
|
|
6
|
+
...component,
|
|
7
|
+
input: true,
|
|
8
|
+
delimiter: getValue(component, "delimiter", false),
|
|
9
|
+
inputFormat: getValue(component, "inputFormat", "plain"),
|
|
10
|
+
mask: getValue(component, "mask", false),
|
|
11
|
+
requireDecimal: false,
|
|
12
|
+
type: "number"
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
registerFormioMapper("number", numberToComponent);
|
|
16
|
+
registerFormioMapper("integer", numberToComponent);
|
|
17
|
+
//# sourceMappingURL=numberToComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"numberToComponent.js","sourceRoot":"","sources":["../../../src/components/numberToComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AACjD,OAAO,EAAC,UAAU,EAAE,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAEtF,MAAM,UAAU,iBAAiB,CAAC,MAAW,EAAE,OAAY;IACzD,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAEzD,OAAO,WAAW,CAAC;QACjB,GAAG,SAAS;QACZ,KAAK,EAAE,IAAI;QACX,SAAS,EAAE,QAAQ,CAAC,SAAS,EAAE,WAAW,EAAE,KAAK,CAAC;QAClD,WAAW,EAAE,QAAQ,CAAC,SAAS,EAAE,aAAa,EAAE,OAAO,CAAC;QACxD,IAAI,EAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC;QACxC,cAAc,EAAE,KAAK;QACrB,IAAI,EAAE,QAAQ;KACf,CAAC,CAAC;AACL,CAAC;AAED,oBAAoB,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;AAClD,oBAAoB,CAAC,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"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { execMapper, registerFormioMapper } from "../registries/FormioMappersContainer";
|
|
2
|
+
export function objectToEditGrid(schema, options) {
|
|
3
|
+
return {
|
|
4
|
+
...execMapper("default", schema, options),
|
|
5
|
+
rowDrafts: false,
|
|
6
|
+
type: "editgrid",
|
|
7
|
+
input: true,
|
|
8
|
+
components: execMapper("properties", schema, options)
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
registerFormioMapper("editgrid", objectToEditGrid);
|
|
12
|
+
//# sourceMappingURL=objectToEditGrid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objectToEditGrid.js","sourceRoot":"","sources":["../../../src/components/objectToEditGrid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAEtF,MAAM,UAAU,gBAAgB,CAAC,MAAW,EAAE,OAAY;IACxD,OAAO;QACL,GAAG,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC;QACzC,SAAS,EAAE,KAAK;QAChB,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,IAAI;QACX,UAAU,EAAE,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC;KACtD,CAAC;AACJ,CAAC;AAED,oBAAoB,CAAC,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"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { execMapper, registerFormioMapper } from "../registries/FormioMappersContainer";
|
|
2
|
+
export function panelToComponent(schema, options) {
|
|
3
|
+
return {
|
|
4
|
+
...execMapper("default", schema, options),
|
|
5
|
+
collapsible: false,
|
|
6
|
+
input: false,
|
|
7
|
+
tableView: false,
|
|
8
|
+
components: execMapper("properties", schema, options)
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
registerFormioMapper("panel", panelToComponent);
|
|
12
|
+
//# sourceMappingURL=panelToComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panelToComponent.js","sourceRoot":"","sources":["../../../src/components/panelToComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAEtF,MAAM,UAAU,gBAAgB,CAAC,MAAW,EAAE,OAAY;IACxD,OAAO;QACL,GAAG,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC;QACzC,WAAW,EAAE,KAAK;QAClB,KAAK,EAAE,KAAK;QACZ,SAAS,EAAE,KAAK;QAChB,UAAU,EAAE,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC;KACtD,CAAC;AACJ,CAAC;AAED,oBAAoB,CAAC,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"]}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { cleanObject, isFunction } from "@tsed/core";
|
|
2
|
+
import { sentenceCase } from "change-case";
|
|
3
|
+
import { execMapper, registerFormioMapper } from "../registries/FormioMappersContainer";
|
|
4
|
+
function bindResolvers(component, options) {
|
|
5
|
+
if (component.data) {
|
|
6
|
+
const data = component.data;
|
|
7
|
+
Object.entries(data).forEach(([key, resolver]) => {
|
|
8
|
+
if (isFunction(resolver)) {
|
|
9
|
+
options.resolvers.push(async (form) => {
|
|
10
|
+
data[key] = await resolver({ ...options, component, form });
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function mapValidation(key, base, schema, propSchema) {
|
|
17
|
+
const required = (schema.required || []).includes(key);
|
|
18
|
+
const validate = {
|
|
19
|
+
...(base.validate || {}),
|
|
20
|
+
required,
|
|
21
|
+
pattern: propSchema.pattern,
|
|
22
|
+
minLength: !required || (required && propSchema.minLength > 1) ? propSchema.minLength : undefined,
|
|
23
|
+
maxLength: propSchema.maxLength,
|
|
24
|
+
min: propSchema.minimum,
|
|
25
|
+
max: propSchema.maximum
|
|
26
|
+
};
|
|
27
|
+
switch (propSchema.type) {
|
|
28
|
+
case "string":
|
|
29
|
+
if (propSchema.minLength === 0 && validate.required) {
|
|
30
|
+
validate.minLength = undefined;
|
|
31
|
+
validate.required = false;
|
|
32
|
+
}
|
|
33
|
+
break;
|
|
34
|
+
case "boolean":
|
|
35
|
+
validate.required = false;
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
return cleanObject(validate);
|
|
39
|
+
}
|
|
40
|
+
export function propertiesToComponents(schema, options) {
|
|
41
|
+
const tabs = {
|
|
42
|
+
label: "Tabs",
|
|
43
|
+
key: "tabs",
|
|
44
|
+
type: "tabs",
|
|
45
|
+
input: false,
|
|
46
|
+
tableView: false,
|
|
47
|
+
components: new Map(),
|
|
48
|
+
pushed: false
|
|
49
|
+
};
|
|
50
|
+
const components = [];
|
|
51
|
+
Object.entries(schema.properties).forEach(([key, propSchema]) => {
|
|
52
|
+
const tabsOptions = propSchema["x-formiotabs"];
|
|
53
|
+
const base = execMapper("any", propSchema, { parentKey: key, ...options });
|
|
54
|
+
const component = cleanObject({
|
|
55
|
+
key,
|
|
56
|
+
...base,
|
|
57
|
+
label: base.label == false ? undefined : base.label || propSchema.title || sentenceCase(key),
|
|
58
|
+
validate: mapValidation(key, base, schema, propSchema)
|
|
59
|
+
});
|
|
60
|
+
bindResolvers(component, options);
|
|
61
|
+
if (tabsOptions) {
|
|
62
|
+
if (!tabs.pushed) {
|
|
63
|
+
components.push(tabs);
|
|
64
|
+
tabs.pushed = true;
|
|
65
|
+
}
|
|
66
|
+
if (!tabs.components.has(tabsOptions.key)) {
|
|
67
|
+
tabs.components.set(tabsOptions.key, {
|
|
68
|
+
...tabsOptions,
|
|
69
|
+
components: []
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
tabs.components.get(tabsOptions.key).components.push(component);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
components.push(component);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
if (tabs.components.size) {
|
|
79
|
+
tabs.components = [...tabs.components.values()];
|
|
80
|
+
}
|
|
81
|
+
return components;
|
|
82
|
+
}
|
|
83
|
+
registerFormioMapper("properties", propertiesToComponents);
|
|
84
|
+
//# 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"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { cleanObject } from "@tsed/core";
|
|
2
|
+
import { execMapper, registerFormioMapper } from "../registries/FormioMappersContainer";
|
|
3
|
+
export function stringToComponent(schema, options) {
|
|
4
|
+
if (schema.format) {
|
|
5
|
+
const component = execMapper("default", schema, options);
|
|
6
|
+
switch (schema.format) {
|
|
7
|
+
case "date":
|
|
8
|
+
case "date-time":
|
|
9
|
+
return execMapper("date", schema, options);
|
|
10
|
+
case "uri":
|
|
11
|
+
return cleanObject({
|
|
12
|
+
input: true,
|
|
13
|
+
...component,
|
|
14
|
+
type: component.type || "url"
|
|
15
|
+
});
|
|
16
|
+
default:
|
|
17
|
+
return cleanObject({
|
|
18
|
+
input: true,
|
|
19
|
+
...component,
|
|
20
|
+
type: component.type || schema.format
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
if (schema.enum) {
|
|
25
|
+
const component = execMapper("enum", schema, options);
|
|
26
|
+
return {
|
|
27
|
+
...component,
|
|
28
|
+
type: component.type || "radio"
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const component = execMapper("default", schema, options);
|
|
32
|
+
return cleanObject({
|
|
33
|
+
input: true,
|
|
34
|
+
type: component.type || "textfield",
|
|
35
|
+
...component
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
registerFormioMapper("string", stringToComponent);
|
|
39
|
+
//# sourceMappingURL=stringToComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stringToComponent.js","sourceRoot":"","sources":["../../../src/components/stringToComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,YAAY,CAAC;AACvC,OAAO,EAAC,UAAU,EAAE,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAEtF,MAAM,UAAU,iBAAiB,CAAC,MAAW,EAAE,OAAY;IACzD,IAAI,MAAM,CAAC,MAAM,EAAE;QACjB,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QACzD,QAAQ,MAAM,CAAC,MAAM,EAAE;YACrB,KAAK,MAAM,CAAC;YACZ,KAAK,WAAW;gBACd,OAAO,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;YAC7C,KAAK,KAAK;gBACR,OAAO,WAAW,CAAC;oBACjB,KAAK,EAAE,IAAI;oBACX,GAAG,SAAS;oBACZ,IAAI,EAAE,SAAS,CAAC,IAAI,IAAI,KAAK;iBAC9B,CAAC,CAAC;YACL;gBACE,OAAO,WAAW,CAAC;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,UAAU,CAAC,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,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACzD,OAAO,WAAW,CAAC;QACjB,KAAK,EAAE,IAAI;QACX,IAAI,EAAE,SAAS,CAAC,IAAI,IAAI,WAAW;QACnC,GAAG,SAAS;KACb,CAAC,CAAC;AACL,CAAC;AAED,oBAAoB,CAAC,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"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { JsonEntityFn } from "@tsed/schema";
|
|
2
|
+
/**
|
|
3
|
+
* Declare a formio Component schema on the decorated propertyKey.
|
|
4
|
+
* @decorator
|
|
5
|
+
* @formio
|
|
6
|
+
* @property
|
|
7
|
+
* @schema
|
|
8
|
+
*/
|
|
9
|
+
export function Component(component) {
|
|
10
|
+
component = Object.entries(component).reduce((component, [key, value]) => {
|
|
11
|
+
if (key === "validate") {
|
|
12
|
+
component["x-formio-validate"] = {
|
|
13
|
+
...(component["x-formio-validate"] || {}),
|
|
14
|
+
...value
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
...component,
|
|
19
|
+
[`x-formio-${key}`]: value
|
|
20
|
+
};
|
|
21
|
+
}, {});
|
|
22
|
+
return JsonEntityFn((store) => {
|
|
23
|
+
Object.entries(component).forEach(([key, value]) => {
|
|
24
|
+
store.itemSchema.customKey(key, value);
|
|
25
|
+
if (store.isCollection) {
|
|
26
|
+
store.schema.customKey(key, value);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/decorators/component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAkB,MAAM,cAAc,CAAC;AAE3D;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,SAA8B;IACtD,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,SAA8B,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QAC5F,IAAI,GAAG,KAAK,UAAU,EAAE;YACtB,SAAS,CAAC,mBAAmB,CAAC,GAAG;gBAC/B,GAAG,CAAC,SAAS,CAAC,mBAAmB,CAAC,IAAI,EAAE,CAAC;gBACzC,GAAG,KAAK;aACT,CAAC;SACH;QAED,OAAO;YACL,GAAG,SAAS;YACZ,CAAC,YAAY,GAAG,EAAE,CAAC,EAAE,KAAK;SAC3B,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,YAAY,CAAC,CAAC,KAAsB,EAAE,EAAE;QAC7C,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;YACjD,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YAEvC,IAAI,KAAK,CAAC,YAAY,EAAE;gBACtB,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;aACpC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {JsonEntityFn, JsonEntityStore} from \"@tsed/schema\";\n\n/**\n * Declare a formio Component schema on the decorated propertyKey.\n * @decorator\n * @formio\n * @property\n * @schema\n */\nexport function Component(component: Record<string, any>): PropertyDecorator {\n component = Object.entries(component).reduce((component: Record<string, any>, [key, value]) => {\n if (key === \"validate\") {\n component[\"x-formio-validate\"] = {\n ...(component[\"x-formio-validate\"] || {}),\n ...value\n };\n }\n\n return {\n ...component,\n [`x-formio-${key}`]: value\n };\n }, {});\n\n return JsonEntityFn((store: JsonEntityStore) => {\n Object.entries(component).forEach(([key, value]) => {\n store.itemSchema.customKey(key, value);\n\n if (store.isCollection) {\n store.schema.customKey(key, value);\n }\n });\n });\n}\n"]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Component } from "./component";
|
|
2
|
+
/**
|
|
3
|
+
* Adds a conditional display rule on the input form.
|
|
4
|
+
* @decorator
|
|
5
|
+
* @formio
|
|
6
|
+
* @property
|
|
7
|
+
* @schema
|
|
8
|
+
* @param conditional
|
|
9
|
+
*/
|
|
10
|
+
export function Conditional(conditional) {
|
|
11
|
+
return Component({
|
|
12
|
+
conditional
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Adds a conditional display rule on the input form.
|
|
17
|
+
* @decorator
|
|
18
|
+
* @formio
|
|
19
|
+
* @property
|
|
20
|
+
* @schema
|
|
21
|
+
* @param property
|
|
22
|
+
* @param eq
|
|
23
|
+
*/
|
|
24
|
+
export function ShowWhen(property, eq) {
|
|
25
|
+
return Conditional({
|
|
26
|
+
show: true,
|
|
27
|
+
when: property,
|
|
28
|
+
eq
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Adds a conditional display rule on the input form.
|
|
33
|
+
* @decorator
|
|
34
|
+
* @formio
|
|
35
|
+
* @property
|
|
36
|
+
* @schema
|
|
37
|
+
* @param property
|
|
38
|
+
* @param eq
|
|
39
|
+
*/
|
|
40
|
+
export function HideWhen(property, eq) {
|
|
41
|
+
return Conditional({
|
|
42
|
+
show: false,
|
|
43
|
+
when: property,
|
|
44
|
+
eq
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=conditional.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conditional.js","sourceRoot":"","sources":["../../../src/decorators/conditional.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,WAAmD;IAC7E,OAAO,SAAS,CAAC;QACf,WAAW;KACZ,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,QAAQ,CAAC,QAAgB,EAAE,EAAO;IAChD,OAAO,WAAW,CAAC;QACjB,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,QAAQ;QACd,EAAE;KACH,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,QAAQ,CAAC,QAAgB,EAAE,EAAO;IAChD,OAAO,WAAW,CAAC;QACjB,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,QAAQ;QACd,EAAE;KACH,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {Component} from \"./component\";\n\n/**\n * Adds a conditional display rule on the input form.\n * @decorator\n * @formio\n * @property\n * @schema\n * @param conditional\n */\nexport function Conditional(conditional: {show: boolean; when: string; eq: any}) {\n return Component({\n conditional\n });\n}\n\n/**\n * Adds a conditional display rule on the input form.\n * @decorator\n * @formio\n * @property\n * @schema\n * @param property\n * @param eq\n */\nexport function ShowWhen(property: string, eq: any) {\n return Conditional({\n show: true,\n when: property,\n eq\n });\n}\n\n/**\n * Adds a conditional display rule on the input form.\n * @decorator\n * @formio\n * @property\n * @schema\n * @param property\n * @param eq\n */\nexport function HideWhen(property: string, eq: any) {\n return Conditional({\n show: false,\n when: property,\n eq\n });\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Component } from "./component";
|
|
2
|
+
/**
|
|
3
|
+
* Configure the property as Currency component.
|
|
4
|
+
* @decorator
|
|
5
|
+
* @formio
|
|
6
|
+
* @property
|
|
7
|
+
* @schema
|
|
8
|
+
*/
|
|
9
|
+
export function Currency(props = {}) {
|
|
10
|
+
return Component({
|
|
11
|
+
currency: "USD",
|
|
12
|
+
inputFormat: "plain",
|
|
13
|
+
mask: false,
|
|
14
|
+
spellcheck: true,
|
|
15
|
+
delimiter: true,
|
|
16
|
+
...props,
|
|
17
|
+
type: "currency"
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=currency.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currency.js","sourceRoot":"","sources":["../../../src/decorators/currency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,QAA6B,EAAE;IACtD,OAAO,SAAS,CAAC;QACf,QAAQ,EAAE,KAAK;QACf,WAAW,EAAE,OAAO;QACpB,IAAI,EAAE,KAAK;QACX,UAAU,EAAE,IAAI;QAChB,SAAS,EAAE,IAAI;QACf,GAAG,KAAK;QACR,IAAI,EAAE,UAAU;KACjB,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {Component} from \"./component\";\n/**\n * Configure the property as Currency component.\n * @decorator\n * @formio\n * @property\n * @schema\n */\nexport function Currency(props: Record<string, any> = {}): PropertyDecorator {\n return Component({\n currency: \"USD\",\n inputFormat: \"plain\",\n mask: false,\n spellcheck: true,\n delimiter: true,\n ...props,\n type: \"currency\"\n });\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Component } from "./component";
|
|
2
|
+
/**
|
|
3
|
+
* Add a custom css class.
|
|
4
|
+
* @decorator
|
|
5
|
+
* @formio
|
|
6
|
+
* @property
|
|
7
|
+
* @schema
|
|
8
|
+
*/
|
|
9
|
+
export function CustomClass(customClass) {
|
|
10
|
+
return Component({
|
|
11
|
+
customClass
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=customClass.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customClass.js","sourceRoot":"","sources":["../../../src/decorators/customClass.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,WAAmB;IAC7C,OAAO,SAAS,CAAC;QACf,WAAW;KACZ,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {Component} from \"./component\";\n\n/**\n * Add a custom css class.\n * @decorator\n * @formio\n * @property\n * @schema\n */\nexport function CustomClass(customClass: string) {\n return Component({\n customClass\n });\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Component } from "./component";
|
|
2
|
+
import { isArrowFn } from "@tsed/core";
|
|
3
|
+
function sanitize(customConditional) {
|
|
4
|
+
const str = customConditional.toString();
|
|
5
|
+
const [signature, ...fn] = str.split("=>");
|
|
6
|
+
let content = fn.join("=>");
|
|
7
|
+
if (!signature.includes("{")) {
|
|
8
|
+
const reg = `${signature.trim()}\.`;
|
|
9
|
+
content = content.replace(new RegExp(reg, "gi"), "");
|
|
10
|
+
}
|
|
11
|
+
return `show = ${content.trim()}`;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Adds custom conditional rule to display or not the input form.
|
|
15
|
+
* @decorator
|
|
16
|
+
* @formio
|
|
17
|
+
* @property
|
|
18
|
+
* @schema
|
|
19
|
+
* @param customConditional
|
|
20
|
+
*/
|
|
21
|
+
export function CustomConditional(customConditional) {
|
|
22
|
+
if (isArrowFn(customConditional)) {
|
|
23
|
+
customConditional = sanitize(customConditional);
|
|
24
|
+
}
|
|
25
|
+
return Component({
|
|
26
|
+
customConditional
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=customConditional.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customConditional.js","sourceRoot":"","sources":["../../../src/decorators/customConditional.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAiDrC,SAAS,QAAQ,CAAC,iBAA2B;IAC3C,MAAM,GAAG,GAAG,iBAAiB,CAAC,QAAQ,EAAE,CAAC;IAEzC,MAAM,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3C,IAAI,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE5B,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QAC5B,MAAM,GAAG,GAAG,GAAG,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC;QAEpC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;KACtD;IAED,OAAO,UAAU,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;AACpC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,iBAAgE;IAChG,IAAI,SAAS,CAAC,iBAAiB,CAAC,EAAE;QAChC,iBAAiB,GAAG,QAAQ,CAAC,iBAAiB,CAAC,CAAC;KACjD;IAED,OAAO,SAAS,CAAC;QACf,iBAAiB;KAClB,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {FormioComponent, FormioForm, FormioSubmission} from \"@tsed/formio-types\";\nimport type {Moment} from \"moment\";\nimport type {LoDashStatic} from \"lodash\";\nimport type {Utils} from \"formiojs\";\nimport {Component} from \"./component\";\nimport {isArrowFn} from \"@tsed/core\";\n\nexport interface CustomConditionalCtx<Value = any, Data = any, Row = any> {\n /**\n * The complete submission object.\n */\n form: FormioForm;\n /**\n * The complete submission object.\n */\n submission: FormioSubmission<Data>;\n /**\n * The complete submission data object.\n */\n data: Data;\n /**\n * Contextual \"row\" data, used within DataGrid, EditGrid, and Container components\n */\n row: Row;\n /**\n * The current component JSON\n */\n component: FormioComponent;\n /**\n * The current component instance.\n */\n instance: any;\n /**\n * The current value of the component.\n */\n value: Value;\n /**\n * The moment.js library for date manipulation.\n */\n moment: Moment;\n /**\n * An instance of Lodash.\n */\n _: LoDashStatic;\n /**\n * An instance of the FormioUtils object.\n */\n utils: typeof Utils;\n /**\n * An alias for \"utils\".\n */\n util: typeof Utils;\n}\n\nfunction sanitize(customConditional: Function) {\n const str = customConditional.toString();\n\n const [signature, ...fn] = str.split(\"=>\");\n let content = fn.join(\"=>\");\n\n if (!signature.includes(\"{\")) {\n const reg = `${signature.trim()}\\.`;\n\n content = content.replace(new RegExp(reg, \"gi\"), \"\");\n }\n\n return `show = ${content.trim()}`;\n}\n\n/**\n * Adds custom conditional rule to display or not the input form.\n * @decorator\n * @formio\n * @property\n * @schema\n * @param customConditional\n */\nexport function CustomConditional(customConditional: string | ((ctx: CustomConditionalCtx) => any)) {\n if (isArrowFn(customConditional)) {\n customConditional = sanitize(customConditional);\n }\n\n return Component({\n customConditional\n });\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Component } from "./component";
|
|
2
|
+
import { isFunction } from "@tsed/core";
|
|
3
|
+
const wrap = (resolver) => async (opts) => {
|
|
4
|
+
const result = await resolver(opts);
|
|
5
|
+
return JSON.stringify(result);
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Set custom json data source
|
|
9
|
+
* @param data
|
|
10
|
+
* @param props
|
|
11
|
+
* @constructor
|
|
12
|
+
*/
|
|
13
|
+
export function DataSourceJson(data, props = {}) {
|
|
14
|
+
return Component({
|
|
15
|
+
...props,
|
|
16
|
+
dataSrc: "json",
|
|
17
|
+
data: {
|
|
18
|
+
...props.data,
|
|
19
|
+
json: isFunction(data) ? wrap(data) : JSON.stringify(data)
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=dataSourceJson.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataSourceJson.js","sourceRoot":"","sources":["../../../src/decorators/dataSourceJson.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AAEtC,MAAM,IAAI,GAAG,CAAC,QAA4B,EAAE,EAAE,CAAC,KAAK,EAAE,IAA2B,EAAE,EAAE;IACnF,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC;IACpC,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,IAA8B,EAAE,QAA6B,EAAE;IAC5F,OAAO,SAAS,CAAC;QACf,GAAG,KAAK;QACR,OAAO,EAAE,MAAM;QACf,IAAI,EAAE;YACJ,GAAG,KAAK,CAAC,IAAI;YACb,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;SAC3D;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {Component} from \"./component\";\nimport {FormioDataResolver, FormioDataResolverCtx} from \"../domain/FormioDataResolver\";\nimport {isFunction} from \"@tsed/core\";\n\nconst wrap = (resolver: FormioDataResolver) => async (opts: FormioDataResolverCtx) => {\n const result = await resolver(opts);\n return JSON.stringify(result);\n};\n\n/**\n * Set custom json data source\n * @param data\n * @param props\n * @constructor\n */\nexport function DataSourceJson(data: any | FormioDataResolver, props: Record<string, any> = {}) {\n return Component({\n ...props,\n dataSrc: \"json\",\n data: {\n ...props.data,\n json: isFunction(data) ? wrap(data) : JSON.stringify(data)\n }\n });\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Component } from "./component";
|
|
2
|
+
/**
|
|
3
|
+
* Set URL data on the current component.
|
|
4
|
+
* @param url
|
|
5
|
+
* @param props
|
|
6
|
+
* @constructor
|
|
7
|
+
*/
|
|
8
|
+
export function DataSourceUrl(url, props = {}) {
|
|
9
|
+
return Component({
|
|
10
|
+
...props,
|
|
11
|
+
dataSrc: "url",
|
|
12
|
+
data: {
|
|
13
|
+
...props.data,
|
|
14
|
+
url
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=dataSourceUrl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataSourceUrl.js","sourceRoot":"","sources":["../../../src/decorators/dataSourceUrl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAGtC;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,GAAgC,EAAE,QAA6B,EAAE;IAC7F,OAAO,SAAS,CAAC;QACf,GAAG,KAAK;QACR,OAAO,EAAE,KAAK;QACd,IAAI,EAAE;YACJ,GAAG,KAAK,CAAC,IAAI;YACb,GAAG;SACJ;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {Component} from \"./component\";\nimport {FormioDataResolver} from \"../domain/FormioDataResolver\";\n\n/**\n * Set URL data on the current component.\n * @param url\n * @param props\n * @constructor\n */\nexport function DataSourceUrl(url: string | FormioDataResolver, props: Record<string, any> = {}) {\n return Component({\n ...props,\n dataSrc: \"url\",\n data: {\n ...props.data,\n url\n }\n });\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Component } from "./component";
|
|
2
|
+
/**
|
|
3
|
+
* Set the error label when an error occur.
|
|
4
|
+
* @decorator
|
|
5
|
+
* @formio
|
|
6
|
+
* @property
|
|
7
|
+
* @schema
|
|
8
|
+
*/
|
|
9
|
+
export function ErrorLabel(message) {
|
|
10
|
+
return Component({
|
|
11
|
+
errorLabel: message
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=errorLabel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorLabel.js","sourceRoot":"","sources":["../../../src/decorators/errorLabel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,OAAe;IACxC,OAAO,SAAS,CAAC;QACf,UAAU,EAAE,OAAO;KACpB,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {Component} from \"./component\";\n\n/**\n * Set the error label when an error occur.\n * @decorator\n * @formio\n * @property\n * @schema\n */\nexport function ErrorLabel(message: string) {\n return Component({\n errorLabel: message\n });\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Validate } from "./validate";
|
|
2
|
+
/**
|
|
3
|
+
* Add error message when an error occur.
|
|
4
|
+
* @decorator
|
|
5
|
+
* @formio
|
|
6
|
+
* @property
|
|
7
|
+
* @schema
|
|
8
|
+
* @param message
|
|
9
|
+
*/
|
|
10
|
+
export function ErrorMessage(message) {
|
|
11
|
+
return Validate("customMessage", message);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=errorMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorMessage.js","sourceRoot":"","sources":["../../../src/decorators/errorMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,OAAe;IAC1C,OAAO,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["import {Validate} from \"./validate\";\n\n/**\n * Add error message when an error occur.\n * @decorator\n * @formio\n * @property\n * @schema\n * @param message\n */\nexport function ErrorMessage(message: string) {\n return Validate(\"customMessage\", message);\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { nameOf, StoreSet, useDecorators } from "@tsed/core";
|
|
2
|
+
import { Name } from "@tsed/schema";
|
|
3
|
+
import { paramCase } from "change-case";
|
|
4
|
+
import { FormsContainer } from "../registries/FormsContainer";
|
|
5
|
+
/**
|
|
6
|
+
* Expose the model as Formio Form.
|
|
7
|
+
* @param form
|
|
8
|
+
*/
|
|
9
|
+
export function Form(form = {}) {
|
|
10
|
+
return useDecorators((target) => {
|
|
11
|
+
const name = form.name || nameOf(target);
|
|
12
|
+
const machineName = paramCase(name);
|
|
13
|
+
FormsContainer.set(name, target);
|
|
14
|
+
FormsContainer.set(machineName, target);
|
|
15
|
+
}, form.name && Name(form.name), form && StoreSet("formio:form", form));
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.js","sourceRoot":"","sources":["../../../src/decorators/form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAC,IAAI,EAAC,MAAM,cAAc,CAAC;AAElC,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,cAAc,EAAC,MAAM,8BAA8B,CAAC;AAE5D;;;GAGG;AACH,MAAM,UAAU,IAAI,CAAC,OAAwD,EAAE;IAC7E,OAAO,aAAa,CAClB,CAAC,MAAW,EAAE,EAAE;QACd,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;QACzC,MAAM,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;QACpC,cAAc,CAAC,GAAG,CAAC,IAAI,EAAE,MAAa,CAAC,CAAC;QACxC,cAAc,CAAC,GAAG,CAAC,WAAW,EAAE,MAAa,CAAC,CAAC;IACjD,CAAC,EACD,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAC5B,IAAI,IAAI,QAAQ,CAAC,aAAa,EAAE,IAAI,CAAC,CACtC,CAAC;AACJ,CAAC","sourcesContent":["import {nameOf, StoreSet, useDecorators} from \"@tsed/core\";\nimport {Name} from \"@tsed/schema\";\nimport {FormioForm} from \"@tsed/formio-types\";\nimport {paramCase} from \"change-case\";\nimport {FormsContainer} from \"../registries/FormsContainer\";\n\n/**\n * Expose the model as Formio Form.\n * @param form\n */\nexport function Form(form: Partial<Omit<FormioForm, \"components\" | \"_id\">> = {}): ClassDecorator {\n return useDecorators(\n (target: any) => {\n const name = form.name || nameOf(target);\n const machineName = paramCase(name);\n FormsContainer.set(name, target as any);\n FormsContainer.set(machineName, target as any);\n },\n form.name && Name(form.name),\n form && StoreSet(\"formio:form\", form)\n );\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Component } from "./component";
|
|
2
|
+
/**
|
|
3
|
+
* Set hidden field.
|
|
4
|
+
*
|
|
5
|
+
* A hidden field is still a part of the form, but is hidden from view.
|
|
6
|
+
*
|
|
7
|
+
* @param bool
|
|
8
|
+
* @decorator
|
|
9
|
+
* @formio
|
|
10
|
+
* @property
|
|
11
|
+
* @schema
|
|
12
|
+
*/
|
|
13
|
+
export function Hidden(bool = true) {
|
|
14
|
+
return Component({
|
|
15
|
+
hidden: bool
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=hidden.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hidden.js","sourceRoot":"","sources":["../../../src/decorators/hidden.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,MAAM,CAAC,OAAgB,IAAI;IACzC,OAAO,SAAS,CAAC;QACf,MAAM,EAAE,IAAI;KACb,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {Component} from \"./component\";\n\n/**\n * Set hidden field.\n *\n * A hidden field is still a part of the form, but is hidden from view.\n *\n * @param bool\n * @decorator\n * @formio\n * @property\n * @schema\n */\nexport function Hidden(bool: boolean = true): PropertyDecorator {\n return Component({\n hidden: bool\n });\n}\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
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";
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decorators/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC","sourcesContent":["export * from \"./component\";\nexport * from \"./currency\";\nexport * from \"./dataSourceJson\";\nexport * from \"./dataSourceUrl\";\nexport * from \"./hidden\";\nexport * from \"./inputTags\";\nexport * from \"./multiple\";\nexport * from \"./password\";\nexport * from \"./select\";\nexport * from \"./tableView\";\nexport * from \"./textarea\";\nexport * from \"./errorMessage\";\nexport * from \"./errorLabel\";\nexport * from \"./minWords\";\nexport * from \"./maxWords\";\nexport * from \"./validate\";\nexport * from \"./form\";\nexport * from \"./tabs\";\nexport * from \"./placeholder\";\nexport * from \"./tooltip\";\nexport * from \"./label\";\nexport * from \"./customClass\";\nexport * from \"./modalEdit\";\nexport * from \"./mask\";\nexport * from \"./prefix\";\nexport * from \"./suffix\";\nexport * from \"./textCase\";\nexport * from \"./conditional\";\nexport * from \"./customConditional\";\nexport * from \"./openWhenEmpty\";\n"]}
|