@tsed/schema-formio 6.88.0 → 6.91.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,55 @@
|
|
|
1
|
+
import { execMapper, registerFormioMapper } from "../registries/FormioMappersContainer";
|
|
2
|
+
function dateToComponent(schema, options) {
|
|
3
|
+
const component = execMapper("default", schema, options);
|
|
4
|
+
const base = {
|
|
5
|
+
...component,
|
|
6
|
+
enableMinDateInput: false,
|
|
7
|
+
datePicker: {
|
|
8
|
+
disableWeekends: false,
|
|
9
|
+
disableWeekdays: false
|
|
10
|
+
},
|
|
11
|
+
enableMaxDateInput: false,
|
|
12
|
+
enableTime: false,
|
|
13
|
+
type: "datetime",
|
|
14
|
+
input: true,
|
|
15
|
+
widget: {
|
|
16
|
+
type: "calendar",
|
|
17
|
+
displayInTimezone: "viewer",
|
|
18
|
+
locale: "en",
|
|
19
|
+
useLocaleSettings: false,
|
|
20
|
+
allowInput: true,
|
|
21
|
+
mode: "single",
|
|
22
|
+
noCalendar: false,
|
|
23
|
+
hourIncrement: 1,
|
|
24
|
+
minuteIncrement: 1,
|
|
25
|
+
minDate: null,
|
|
26
|
+
disableWeekends: false,
|
|
27
|
+
disableWeekdays: false,
|
|
28
|
+
maxDate: null
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
if (schema.format === "date") {
|
|
32
|
+
return {
|
|
33
|
+
...base,
|
|
34
|
+
format: "yyyy-MM-dd",
|
|
35
|
+
enableTime: false,
|
|
36
|
+
widget: {
|
|
37
|
+
...base.widget,
|
|
38
|
+
enableTime: false,
|
|
39
|
+
format: "yyyy-MM-dd"
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
...base,
|
|
45
|
+
timePicker: {
|
|
46
|
+
showMeridian: false
|
|
47
|
+
},
|
|
48
|
+
widget: {
|
|
49
|
+
enableTime: true,
|
|
50
|
+
time_24hr: true
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
registerFormioMapper("date", dateToComponent);
|
|
55
|
+
//# sourceMappingURL=dateToComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dateToComponent.js","sourceRoot":"","sources":["../../../src/components/dateToComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAEtF,SAAS,eAAe,CAAC,MAAW,EAAE,OAAY;IAChD,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAEzD,MAAM,IAAI,GAAG;QACX,GAAG,SAAS;QACZ,kBAAkB,EAAE,KAAK;QACzB,UAAU,EAAE;YACV,eAAe,EAAE,KAAK;YACtB,eAAe,EAAE,KAAK;SACvB;QACD,kBAAkB,EAAE,KAAK;QACzB,UAAU,EAAE,KAAK;QACjB,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,IAAI;QACX,MAAM,EAAE;YACN,IAAI,EAAE,UAAU;YAChB,iBAAiB,EAAE,QAAQ;YAC3B,MAAM,EAAE,IAAI;YACZ,iBAAiB,EAAE,KAAK;YACxB,UAAU,EAAE,IAAI;YAChB,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,KAAK;YACjB,aAAa,EAAE,CAAC;YAChB,eAAe,EAAE,CAAC;YAClB,OAAO,EAAE,IAAI;YACb,eAAe,EAAE,KAAK;YACtB,eAAe,EAAE,KAAK;YACtB,OAAO,EAAE,IAAI;SACd;KACF,CAAC;IAEF,IAAI,MAAM,CAAC,MAAM,KAAK,MAAM,EAAE;QAC5B,OAAO;YACL,GAAG,IAAI;YACP,MAAM,EAAE,YAAY;YACpB,UAAU,EAAE,KAAK;YACjB,MAAM,EAAE;gBACN,GAAG,IAAI,CAAC,MAAM;gBACd,UAAU,EAAE,KAAK;gBACjB,MAAM,EAAE,YAAY;aACrB;SACF,CAAC;KACH;IAED,OAAO;QACL,GAAG,IAAI;QACP,UAAU,EAAE;YACV,YAAY,EAAE,KAAK;SACpB;QACD,MAAM,EAAE;YACN,UAAU,EAAE,IAAI;YAChB,SAAS,EAAE,IAAI;SAChB;KACF,CAAC;AACJ,CAAC;AAED,oBAAoB,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC","sourcesContent":["import {execMapper, registerFormioMapper} from \"../registries/FormioMappersContainer\";\n\nfunction dateToComponent(schema: any, options: any) {\n const component = execMapper(\"default\", schema, options);\n\n const base = {\n ...component,\n enableMinDateInput: false,\n datePicker: {\n disableWeekends: false,\n disableWeekdays: false\n },\n enableMaxDateInput: false,\n enableTime: false,\n type: \"datetime\",\n input: true,\n widget: {\n type: \"calendar\",\n displayInTimezone: \"viewer\",\n locale: \"en\",\n useLocaleSettings: false,\n allowInput: true,\n mode: \"single\",\n noCalendar: false,\n hourIncrement: 1,\n minuteIncrement: 1,\n minDate: null,\n disableWeekends: false,\n disableWeekdays: false,\n maxDate: null\n }\n };\n\n if (schema.format === \"date\") {\n return {\n ...base,\n format: \"yyyy-MM-dd\",\n enableTime: false,\n widget: {\n ...base.widget,\n enableTime: false,\n format: \"yyyy-MM-dd\"\n }\n };\n }\n\n return {\n ...base,\n timePicker: {\n showMeridian: false\n },\n widget: {\n enableTime: true,\n time_24hr: true\n }\n };\n}\n\nregisterFormioMapper(\"date\", dateToComponent);\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { cleanObject } from "@tsed/core";
|
|
2
|
+
import { registerFormioMapper } from "../registries/FormioMappersContainer";
|
|
3
|
+
import { getFormioProps } from "../utils/getFormioProps";
|
|
4
|
+
export function defaultToComponent(schema, options) {
|
|
5
|
+
const formioProps = getFormioProps(schema);
|
|
6
|
+
return cleanObject({
|
|
7
|
+
...formioProps,
|
|
8
|
+
disabled: !!schema.readOnly,
|
|
9
|
+
description: schema.description,
|
|
10
|
+
defaultValue: schema.default
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
registerFormioMapper("default", defaultToComponent);
|
|
14
|
+
//# sourceMappingURL=defaultToComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultToComponent.js","sourceRoot":"","sources":["../../../src/components/defaultToComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,YAAY,CAAC;AACvC,OAAO,EAAC,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AAEvD,MAAM,UAAU,kBAAkB,CAAC,MAAW,EAAE,OAAY;IAC1D,MAAM,WAAW,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IAE3C,OAAO,WAAW,CAAC;QACjB,GAAG,WAAW;QACd,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ;QAC3B,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,YAAY,EAAE,MAAM,CAAC,OAAO;KAC7B,CAAC,CAAC;AACL,CAAC;AAED,oBAAoB,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import {cleanObject} from \"@tsed/core\";\nimport {registerFormioMapper} from \"../registries/FormioMappersContainer\";\nimport {getFormioProps} from \"../utils/getFormioProps\";\n\nexport function defaultToComponent(schema: any, options: any): any {\n const formioProps = getFormioProps(schema);\n\n return cleanObject({\n ...formioProps,\n disabled: !!schema.readOnly,\n description: schema.description,\n defaultValue: schema.default\n });\n}\n\nregisterFormioMapper(\"default\", defaultToComponent);\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { cleanObject } from "@tsed/core";
|
|
2
|
+
import { sentenceCase } from "change-case";
|
|
3
|
+
import { execMapper, registerFormioMapper } from "../registries/FormioMappersContainer";
|
|
4
|
+
export function enumToComponent(schema, options) {
|
|
5
|
+
const component = execMapper("default", schema, options);
|
|
6
|
+
const values = schema.enum.map((value) => {
|
|
7
|
+
return {
|
|
8
|
+
label: sentenceCase(value),
|
|
9
|
+
value
|
|
10
|
+
};
|
|
11
|
+
});
|
|
12
|
+
if (component.type === "select") {
|
|
13
|
+
return cleanObject({
|
|
14
|
+
...component,
|
|
15
|
+
data: {
|
|
16
|
+
json: JSON.stringify(values)
|
|
17
|
+
},
|
|
18
|
+
dataSrc: "json",
|
|
19
|
+
idPath: "value",
|
|
20
|
+
valueProperty: "value",
|
|
21
|
+
template: "<span>{{ item.label }}</span>"
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return cleanObject({
|
|
25
|
+
...component,
|
|
26
|
+
values: schema["x-values"] || values.map((value) => ({ ...value, shortcut: "" }))
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
registerFormioMapper("enum", enumToComponent);
|
|
30
|
+
//# sourceMappingURL=enumToComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enumToComponent.js","sourceRoot":"","sources":["../../../src/components/enumToComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,YAAY,CAAC;AACvC,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AACzC,OAAO,EAAC,UAAU,EAAE,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAEtF,MAAM,UAAU,eAAe,CAAC,MAAW,EAAE,OAAY;IACvD,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACzD,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAU,EAAE,EAAE;QAC5C,OAAO;YACL,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC;YAC1B,KAAK;SACN,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,IAAI,SAAS,CAAC,IAAI,KAAK,QAAQ,EAAE;QAC/B,OAAO,WAAW,CAAC;YACjB,GAAG,SAAS;YACZ,IAAI,EAAE;gBACJ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;aAC7B;YACD,OAAO,EAAE,MAAM;YACf,MAAM,EAAE,OAAO;YACf,aAAa,EAAE,OAAO;YACtB,QAAQ,EAAE,+BAA+B;SAC1C,CAAC,CAAC;KACJ;IAED,OAAO,WAAW,CAAC;QACjB,GAAG,SAAS;QACZ,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,KAAU,EAAE,EAAE,CAAC,CAAC,EAAC,GAAG,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAC,CAAC,CAAC;KACrF,CAAC,CAAC;AACL,CAAC;AAED,oBAAoB,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC","sourcesContent":["import {cleanObject} from \"@tsed/core\";\nimport {sentenceCase} from \"change-case\";\nimport {execMapper, registerFormioMapper} from \"../registries/FormioMappersContainer\";\n\nexport function enumToComponent(schema: any, options: any) {\n const component = execMapper(\"default\", schema, options);\n const values = schema.enum.map((value: any) => {\n return {\n label: sentenceCase(value),\n value\n };\n });\n\n if (component.type === \"select\") {\n return cleanObject({\n ...component,\n data: {\n json: JSON.stringify(values)\n },\n dataSrc: \"json\",\n idPath: \"value\",\n valueProperty: \"value\",\n template: \"<span>{{ item.label }}</span>\"\n });\n }\n\n return cleanObject({\n ...component,\n values: schema[\"x-values\"] || values.map((value: any) => ({...value, shortcut: \"\"}))\n });\n}\n\nregisterFormioMapper(\"enum\", enumToComponent);\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
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";
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC","sourcesContent":["export * from \"./anyToComponent\";\nexport * from \"./arrayToComponent\";\nexport * from \"./booleanToComponent\";\nexport * from \"./dateToComponent\";\nexport * from \"./defaultToComponent\";\nexport * from \"./enumToComponent\";\nexport * from \"./mapToComponent\";\nexport * from \"./nestedToComponent\";\nexport * from \"./numberToComponent\";\nexport * from \"./objectToEditGrid\";\nexport * from \"./panelToComponent\";\nexport * from \"./propertiesToComponents\";\nexport * from \"./stringToComponent\";\n"]}
|
|
@@ -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"]}
|