@tsed/schema-formio 7.0.0-alpha.2 → 7.0.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/jest.config.js +14 -0
- package/lib/cjs/components/anyToComponent.js +28 -0
- package/lib/cjs/components/anyToComponent.js.map +1 -0
- package/lib/cjs/components/arrayToComponent.js +40 -0
- package/lib/cjs/components/arrayToComponent.js.map +1 -0
- package/lib/cjs/components/booleanToComponent.js +14 -0
- package/lib/cjs/components/booleanToComponent.js.map +1 -0
- package/lib/cjs/components/dateToComponent.js +57 -0
- package/lib/cjs/components/dateToComponent.js.map +1 -0
- package/lib/cjs/components/defaultToComponent.js +18 -0
- package/lib/cjs/components/defaultToComponent.js.map +1 -0
- package/lib/cjs/components/enumToComponent.js +33 -0
- package/lib/cjs/components/enumToComponent.js.map +1 -0
- package/lib/cjs/components/mapToComponent.js +20 -0
- package/lib/cjs/components/mapToComponent.js.map +1 -0
- package/lib/cjs/components/nestedToComponent.js +25 -0
- package/lib/cjs/components/nestedToComponent.js.map +1 -0
- package/lib/cjs/components/numberToComponent.js +21 -0
- package/lib/cjs/components/numberToComponent.js.map +1 -0
- package/lib/cjs/components/objectToEditGrid.js +16 -0
- package/lib/cjs/components/objectToEditGrid.js.map +1 -0
- package/lib/cjs/components/panelToComponent.js +16 -0
- package/lib/cjs/components/panelToComponent.js.map +1 -0
- package/lib/cjs/components/propertiesToComponents.js +88 -0
- package/lib/cjs/components/propertiesToComponents.js.map +1 -0
- package/lib/cjs/components/stringToComponent.js +43 -0
- package/lib/cjs/components/stringToComponent.js.map +1 -0
- package/lib/cjs/decorators/component.js +35 -0
- package/lib/cjs/decorators/component.js.map +1 -0
- package/lib/cjs/decorators/conditional.js +53 -0
- package/lib/cjs/decorators/conditional.js.map +1 -0
- package/lib/cjs/decorators/currency.js +24 -0
- package/lib/cjs/decorators/currency.js.map +1 -0
- package/lib/cjs/decorators/customClass.js +18 -0
- package/lib/cjs/decorators/customClass.js.map +1 -0
- package/lib/cjs/decorators/customConditional.js +33 -0
- package/lib/cjs/decorators/customConditional.js.map +1 -0
- package/lib/cjs/decorators/dataSourceJson.js +27 -0
- package/lib/cjs/decorators/dataSourceJson.js.map +1 -0
- package/lib/cjs/decorators/dataSourceUrl.js +22 -0
- package/lib/cjs/decorators/dataSourceUrl.js.map +1 -0
- package/lib/cjs/decorators/errorLabel.js +18 -0
- package/lib/cjs/decorators/errorLabel.js.map +1 -0
- package/lib/cjs/decorators/errorMessage.js +17 -0
- package/lib/cjs/decorators/errorMessage.js.map +1 -0
- package/lib/cjs/decorators/form.js +21 -0
- package/lib/cjs/decorators/form.js.map +1 -0
- package/lib/cjs/decorators/hidden.js +22 -0
- package/lib/cjs/decorators/hidden.js.map +1 -0
- package/lib/cjs/decorators/inputTags.js +23 -0
- package/lib/cjs/decorators/inputTags.js.map +1 -0
- package/lib/cjs/decorators/label.js +19 -0
- package/lib/cjs/decorators/label.js.map +1 -0
- package/lib/cjs/decorators/mask.js +50 -0
- package/lib/cjs/decorators/mask.js.map +1 -0
- package/lib/cjs/decorators/maxWords.js +17 -0
- package/lib/cjs/decorators/maxWords.js.map +1 -0
- package/lib/cjs/decorators/minWords.js +17 -0
- package/lib/cjs/decorators/minWords.js.map +1 -0
- package/lib/cjs/decorators/modalEdit.js +18 -0
- package/lib/cjs/decorators/modalEdit.js.map +1 -0
- package/lib/cjs/decorators/multiple.js +18 -0
- package/lib/cjs/decorators/multiple.js.map +1 -0
- package/lib/cjs/decorators/openWhenEmpty.js +18 -0
- package/lib/cjs/decorators/openWhenEmpty.js.map +1 -0
- package/lib/cjs/decorators/password.js +20 -0
- package/lib/cjs/decorators/password.js.map +1 -0
- package/lib/cjs/decorators/placeholder.js +19 -0
- package/lib/cjs/decorators/placeholder.js.map +1 -0
- package/lib/cjs/decorators/prefix.js +18 -0
- package/lib/cjs/decorators/prefix.js.map +1 -0
- package/lib/cjs/decorators/select.js +22 -0
- package/lib/cjs/decorators/select.js.map +1 -0
- package/lib/cjs/decorators/suffix.js +18 -0
- package/lib/cjs/decorators/suffix.js.map +1 -0
- package/lib/cjs/decorators/tableView.js +19 -0
- package/lib/cjs/decorators/tableView.js.map +1 -0
- package/lib/cjs/decorators/tabs.js +22 -0
- package/lib/cjs/decorators/tabs.js.map +1 -0
- package/lib/cjs/decorators/textCase.js +19 -0
- package/lib/cjs/decorators/textCase.js.map +1 -0
- package/lib/cjs/decorators/textarea.js +20 -0
- package/lib/cjs/decorators/textarea.js.map +1 -0
- package/lib/cjs/decorators/tooltip.js +19 -0
- package/lib/cjs/decorators/tooltip.js.map +1 -0
- package/lib/cjs/decorators/validate.js +22 -0
- package/lib/cjs/decorators/validate.js.map +1 -0
- package/lib/cjs/domain/FormioDataResolver.js +3 -0
- package/lib/cjs/domain/FormioDataResolver.js.map +1 -0
- package/lib/cjs/index.js +56 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/package.json +3 -0
- package/lib/cjs/registries/FormioMappersContainer.js +21 -0
- package/lib/cjs/registries/FormioMappersContainer.js.map +1 -0
- package/lib/cjs/registries/FormsContainer.js +6 -0
- package/lib/cjs/registries/FormsContainer.js.map +1 -0
- package/lib/cjs/utils/getFormioProps.js +17 -0
- package/lib/cjs/utils/getFormioProps.js.map +1 -0
- package/lib/cjs/utils/getFormioSchema.js +54 -0
- package/lib/cjs/utils/getFormioSchema.js.map +1 -0
- package/lib/cjs/utils/getRef.js +12 -0
- package/lib/cjs/utils/getRef.js.map +1 -0
- package/lib/esm/components/anyToComponent.js +24 -0
- package/lib/esm/components/anyToComponent.js.map +1 -0
- package/lib/esm/components/arrayToComponent.js +36 -0
- package/lib/esm/components/arrayToComponent.js.map +1 -0
- package/lib/esm/components/booleanToComponent.js +12 -0
- package/lib/esm/components/booleanToComponent.js.map +1 -0
- package/lib/esm/components/dateToComponent.js +55 -0
- package/lib/esm/components/dateToComponent.js.map +1 -0
- package/lib/esm/components/defaultToComponent.js +14 -0
- package/lib/esm/components/defaultToComponent.js.map +1 -0
- package/lib/esm/components/enumToComponent.js +29 -0
- package/lib/esm/components/enumToComponent.js.map +1 -0
- package/lib/esm/components/mapToComponent.js +16 -0
- package/lib/esm/components/mapToComponent.js.map +1 -0
- package/lib/esm/components/nestedToComponent.js +21 -0
- package/lib/esm/components/nestedToComponent.js.map +1 -0
- package/lib/esm/components/numberToComponent.js +17 -0
- package/lib/esm/components/numberToComponent.js.map +1 -0
- package/lib/esm/components/objectToEditGrid.js +12 -0
- package/lib/esm/components/objectToEditGrid.js.map +1 -0
- package/lib/esm/components/panelToComponent.js +12 -0
- package/lib/esm/components/panelToComponent.js.map +1 -0
- package/lib/esm/components/propertiesToComponents.js +84 -0
- package/lib/esm/components/propertiesToComponents.js.map +1 -0
- package/lib/esm/components/stringToComponent.js +39 -0
- package/lib/esm/components/stringToComponent.js.map +1 -0
- package/lib/esm/decorators/component.js +31 -0
- package/lib/esm/decorators/component.js.map +1 -0
- package/lib/esm/decorators/conditional.js +47 -0
- package/lib/esm/decorators/conditional.js.map +1 -0
- package/lib/esm/decorators/currency.js +20 -0
- package/lib/esm/decorators/currency.js.map +1 -0
- package/lib/esm/decorators/customClass.js +14 -0
- package/lib/esm/decorators/customClass.js.map +1 -0
- package/lib/esm/decorators/customConditional.js +29 -0
- package/lib/esm/decorators/customConditional.js.map +1 -0
- package/lib/esm/decorators/dataSourceJson.js +23 -0
- package/lib/esm/decorators/dataSourceJson.js.map +1 -0
- package/lib/esm/decorators/dataSourceUrl.js +18 -0
- package/lib/esm/decorators/dataSourceUrl.js.map +1 -0
- package/lib/esm/decorators/errorLabel.js +14 -0
- package/lib/esm/decorators/errorLabel.js.map +1 -0
- package/lib/esm/decorators/errorMessage.js +13 -0
- package/lib/esm/decorators/errorMessage.js.map +1 -0
- package/lib/esm/decorators/form.js +17 -0
- package/lib/esm/decorators/form.js.map +1 -0
- package/lib/esm/decorators/hidden.js +18 -0
- package/lib/esm/decorators/hidden.js.map +1 -0
- package/lib/esm/decorators/inputTags.js +19 -0
- package/lib/esm/decorators/inputTags.js.map +1 -0
- package/lib/esm/decorators/label.js +15 -0
- package/lib/esm/decorators/label.js.map +1 -0
- package/lib/esm/decorators/mask.js +45 -0
- package/lib/esm/decorators/mask.js.map +1 -0
- package/lib/esm/decorators/maxWords.js +13 -0
- package/lib/esm/decorators/maxWords.js.map +1 -0
- package/lib/esm/decorators/minWords.js +13 -0
- package/lib/esm/decorators/minWords.js.map +1 -0
- package/lib/esm/decorators/modalEdit.js +14 -0
- package/lib/esm/decorators/modalEdit.js.map +1 -0
- package/lib/esm/decorators/multiple.js +14 -0
- package/lib/esm/decorators/multiple.js.map +1 -0
- package/lib/esm/decorators/openWhenEmpty.js +14 -0
- package/lib/esm/decorators/openWhenEmpty.js.map +1 -0
- package/lib/esm/decorators/password.js +16 -0
- package/lib/esm/decorators/password.js.map +1 -0
- package/lib/esm/decorators/placeholder.js +15 -0
- package/lib/esm/decorators/placeholder.js.map +1 -0
- package/lib/esm/decorators/prefix.js +14 -0
- package/lib/esm/decorators/prefix.js.map +1 -0
- package/lib/esm/decorators/select.js +18 -0
- package/lib/esm/decorators/select.js.map +1 -0
- package/lib/esm/decorators/suffix.js +14 -0
- package/lib/esm/decorators/suffix.js.map +1 -0
- package/lib/esm/decorators/tableView.js +15 -0
- package/lib/esm/decorators/tableView.js.map +1 -0
- package/lib/esm/decorators/tabs.js +18 -0
- package/lib/esm/decorators/tabs.js.map +1 -0
- package/lib/esm/decorators/textCase.js +15 -0
- package/lib/esm/decorators/textCase.js.map +1 -0
- package/lib/esm/decorators/textarea.js +16 -0
- package/lib/esm/decorators/textarea.js.map +1 -0
- package/lib/esm/decorators/tooltip.js +15 -0
- package/lib/esm/decorators/tooltip.js.map +1 -0
- package/lib/esm/decorators/validate.js +18 -0
- package/lib/esm/decorators/validate.js.map +1 -0
- package/lib/esm/domain/FormioDataResolver.js +2 -0
- package/lib/esm/domain/FormioDataResolver.js.map +1 -0
- package/lib/esm/index.js +53 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/package.json +3 -0
- package/lib/esm/registries/FormioMappersContainer.js +15 -0
- package/lib/esm/registries/FormioMappersContainer.js.map +1 -0
- package/lib/esm/registries/FormsContainer.js +3 -0
- package/lib/esm/registries/FormsContainer.js.map +1 -0
- package/lib/esm/utils/getFormioProps.js +13 -0
- package/lib/esm/utils/getFormioProps.js.map +1 -0
- package/lib/esm/utils/getFormioSchema.js +50 -0
- package/lib/esm/utils/getFormioSchema.js.map +1 -0
- package/lib/esm/utils/getRef.js +8 -0
- package/lib/esm/utils/getRef.js.map +1 -0
- package/lib/{components → types/components}/anyToComponent.d.ts +0 -0
- package/lib/{components → types/components}/arrayToComponent.d.ts +0 -0
- package/lib/{components → types/components}/booleanToComponent.d.ts +0 -0
- package/lib/{components → types/components}/dateToComponent.d.ts +0 -0
- package/lib/{components → types/components}/defaultToComponent.d.ts +0 -0
- package/lib/{components → types/components}/enumToComponent.d.ts +0 -0
- package/lib/{components → types/components}/mapToComponent.d.ts +0 -0
- package/lib/{components → types/components}/nestedToComponent.d.ts +0 -0
- package/lib/{components → types/components}/numberToComponent.d.ts +0 -0
- package/lib/{components → types/components}/objectToEditGrid.d.ts +0 -0
- package/lib/{components → types/components}/panelToComponent.d.ts +0 -0
- package/lib/{components → types/components}/propertiesToComponents.d.ts +0 -0
- package/lib/{components → types/components}/stringToComponent.d.ts +0 -0
- package/lib/{decorators → types/decorators}/component.d.ts +0 -0
- package/lib/types/decorators/conditional.d.ts +33 -0
- package/lib/{decorators → types/decorators}/currency.d.ts +0 -0
- package/lib/types/decorators/customClass.d.ts +8 -0
- package/lib/types/decorators/customConditional.d.ts +59 -0
- package/lib/types/decorators/dataSourceJson.d.ts +8 -0
- package/lib/types/decorators/dataSourceUrl.d.ts +8 -0
- package/lib/types/decorators/errorLabel.d.ts +8 -0
- package/lib/types/decorators/errorMessage.d.ts +9 -0
- package/lib/types/decorators/form.d.ts +6 -0
- package/lib/{decorators → types/decorators}/hidden.d.ts +3 -0
- package/lib/{decorators → types/decorators}/inputTags.d.ts +0 -0
- package/lib/types/decorators/label.d.ts +9 -0
- package/lib/types/decorators/mask.d.ts +37 -0
- package/lib/types/decorators/maxWords.d.ts +9 -0
- package/lib/types/decorators/minWords.d.ts +9 -0
- package/lib/types/decorators/modalEdit.d.ts +8 -0
- package/lib/{decorators → types/decorators}/multiple.d.ts +0 -0
- package/lib/types/decorators/openWhenEmpty.d.ts +8 -0
- package/lib/types/decorators/password.d.ts +12 -0
- package/lib/types/decorators/placeholder.d.ts +9 -0
- package/lib/types/decorators/prefix.d.ts +8 -0
- package/lib/types/decorators/select.d.ts +14 -0
- package/lib/types/decorators/suffix.d.ts +8 -0
- package/lib/{decorators → types/decorators}/tableView.d.ts +0 -0
- package/lib/{decorators → types/decorators}/tabs.d.ts +0 -0
- package/lib/types/decorators/textCase.d.ts +9 -0
- package/lib/types/decorators/textarea.d.ts +12 -0
- package/lib/types/decorators/tooltip.d.ts +9 -0
- package/lib/types/decorators/validate.d.ts +10 -0
- package/lib/types/domain/FormioDataResolver.d.ts +7 -0
- package/lib/types/index.d.ts +52 -0
- package/lib/{registries → types/registries}/FormioMappersContainer.d.ts +0 -0
- package/lib/types/registries/FormsContainer.d.ts +2 -0
- package/lib/{utils → types/utils}/getFormioProps.d.ts +0 -0
- package/lib/types/utils/getFormioSchema.d.ts +16 -0
- package/lib/{utils → types/utils}/getRef.d.ts +0 -0
- package/package.json +48 -21
- package/readme.md +10 -6
- package/tsconfig.compile.esm.json +12 -0
- package/.mocharc.js +0 -5
- package/.nycrc +0 -26
- package/lib/components/index.d.ts +0 -13
- package/lib/decorators/dataSourceJson.d.ts +0 -7
- package/lib/decorators/dataSourceUrl.d.ts +0 -7
- package/lib/decorators/index.d.ts +0 -11
- package/lib/decorators/password.d.ts +0 -8
- package/lib/decorators/select.d.ts +0 -8
- package/lib/decorators/textarea.d.ts +0 -8
- package/lib/index.d.ts +0 -4
- package/lib/index.js +0 -585
- package/lib/index.js.map +0 -1
- package/lib/index.modern.js +0 -562
- package/lib/index.modern.js.map +0 -1
- package/lib/utils/getFormioSchema.d.ts +0 -11
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adds a conditional display rule on the input form.
|
|
3
|
+
* @decorator
|
|
4
|
+
* @formio
|
|
5
|
+
* @property
|
|
6
|
+
* @schema
|
|
7
|
+
* @param conditional
|
|
8
|
+
*/
|
|
9
|
+
export declare function Conditional(conditional: {
|
|
10
|
+
show: boolean;
|
|
11
|
+
when: string;
|
|
12
|
+
eq: any;
|
|
13
|
+
}): PropertyDecorator;
|
|
14
|
+
/**
|
|
15
|
+
* Adds a conditional display rule on the input form.
|
|
16
|
+
* @decorator
|
|
17
|
+
* @formio
|
|
18
|
+
* @property
|
|
19
|
+
* @schema
|
|
20
|
+
* @param property
|
|
21
|
+
* @param eq
|
|
22
|
+
*/
|
|
23
|
+
export declare function ShowWhen(property: string, eq: any): PropertyDecorator;
|
|
24
|
+
/**
|
|
25
|
+
* Adds a conditional display rule on the input form.
|
|
26
|
+
* @decorator
|
|
27
|
+
* @formio
|
|
28
|
+
* @property
|
|
29
|
+
* @schema
|
|
30
|
+
* @param property
|
|
31
|
+
* @param eq
|
|
32
|
+
*/
|
|
33
|
+
export declare function HideWhen(property: string, eq: any): PropertyDecorator;
|
|
File without changes
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { FormioComponent, FormioForm, FormioSubmission } from "@tsed/formio-types";
|
|
2
|
+
import type { Moment } from "moment";
|
|
3
|
+
import type { LoDashStatic } from "lodash";
|
|
4
|
+
import type { Utils } from "formiojs";
|
|
5
|
+
export interface CustomConditionalCtx<Value = any, Data = any, Row = any> {
|
|
6
|
+
/**
|
|
7
|
+
* The complete submission object.
|
|
8
|
+
*/
|
|
9
|
+
form: FormioForm;
|
|
10
|
+
/**
|
|
11
|
+
* The complete submission object.
|
|
12
|
+
*/
|
|
13
|
+
submission: FormioSubmission<Data>;
|
|
14
|
+
/**
|
|
15
|
+
* The complete submission data object.
|
|
16
|
+
*/
|
|
17
|
+
data: Data;
|
|
18
|
+
/**
|
|
19
|
+
* Contextual "row" data, used within DataGrid, EditGrid, and Container components
|
|
20
|
+
*/
|
|
21
|
+
row: Row;
|
|
22
|
+
/**
|
|
23
|
+
* The current component JSON
|
|
24
|
+
*/
|
|
25
|
+
component: FormioComponent;
|
|
26
|
+
/**
|
|
27
|
+
* The current component instance.
|
|
28
|
+
*/
|
|
29
|
+
instance: any;
|
|
30
|
+
/**
|
|
31
|
+
* The current value of the component.
|
|
32
|
+
*/
|
|
33
|
+
value: Value;
|
|
34
|
+
/**
|
|
35
|
+
* The moment.js library for date manipulation.
|
|
36
|
+
*/
|
|
37
|
+
moment: Moment;
|
|
38
|
+
/**
|
|
39
|
+
* An instance of Lodash.
|
|
40
|
+
*/
|
|
41
|
+
_: LoDashStatic;
|
|
42
|
+
/**
|
|
43
|
+
* An instance of the FormioUtils object.
|
|
44
|
+
*/
|
|
45
|
+
utils: typeof Utils;
|
|
46
|
+
/**
|
|
47
|
+
* An alias for "utils".
|
|
48
|
+
*/
|
|
49
|
+
util: typeof Utils;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Adds custom conditional rule to display or not the input form.
|
|
53
|
+
* @decorator
|
|
54
|
+
* @formio
|
|
55
|
+
* @property
|
|
56
|
+
* @schema
|
|
57
|
+
* @param customConditional
|
|
58
|
+
*/
|
|
59
|
+
export declare function CustomConditional(customConditional: string | ((ctx: CustomConditionalCtx) => any)): PropertyDecorator;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FormioDataResolver } from "../domain/FormioDataResolver";
|
|
2
|
+
/**
|
|
3
|
+
* Set custom json data source
|
|
4
|
+
* @param data
|
|
5
|
+
* @param props
|
|
6
|
+
* @constructor
|
|
7
|
+
*/
|
|
8
|
+
export declare function DataSourceJson(data: any | FormioDataResolver, props?: Record<string, any>): PropertyDecorator;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FormioDataResolver } from "../domain/FormioDataResolver";
|
|
2
|
+
/**
|
|
3
|
+
* Set URL data on the current component.
|
|
4
|
+
* @param url
|
|
5
|
+
* @param props
|
|
6
|
+
* @constructor
|
|
7
|
+
*/
|
|
8
|
+
export declare function DataSourceUrl(url: string | FormioDataResolver, props?: Record<string, any>): PropertyDecorator;
|
|
File without changes
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An input mask helps the user with input by ensuring a predefined format.
|
|
3
|
+
*
|
|
4
|
+
* - 9: numeric
|
|
5
|
+
* - a: alphabetical
|
|
6
|
+
* - *: alphanumeric
|
|
7
|
+
*
|
|
8
|
+
* Example telephone mask: (999) 999-9999
|
|
9
|
+
*
|
|
10
|
+
* See the [jquery.inputmask](https://github.com/RobinHerbots/Inputmask) documentation for more information.
|
|
11
|
+
*
|
|
12
|
+
* @decorator
|
|
13
|
+
* @formio
|
|
14
|
+
* @property
|
|
15
|
+
* @schema
|
|
16
|
+
*/
|
|
17
|
+
export declare function Mask(inputMask: string, inputMaskPlaceholderChar?: string): PropertyDecorator;
|
|
18
|
+
/**
|
|
19
|
+
* An input mask helps the user with input by ensuring a predefined format.
|
|
20
|
+
*
|
|
21
|
+
* - 9: numeric
|
|
22
|
+
* - a: alphabetical
|
|
23
|
+
* - *: alphanumeric
|
|
24
|
+
*
|
|
25
|
+
* Example telephone mask: (999) 999-9999
|
|
26
|
+
*
|
|
27
|
+
* See the [jquery.inputmask](https://github.com/RobinHerbots/Inputmask) documentation for more information.
|
|
28
|
+
*
|
|
29
|
+
* @decorator
|
|
30
|
+
* @formio
|
|
31
|
+
* @property
|
|
32
|
+
* @schema
|
|
33
|
+
*/
|
|
34
|
+
export declare function Masks(...inputMasks: {
|
|
35
|
+
label: string;
|
|
36
|
+
mask: string;
|
|
37
|
+
}[]): PropertyDecorator;
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface PasswordOpts extends Record<string, any> {
|
|
2
|
+
showCharCount?: boolean;
|
|
3
|
+
showWordCount?: boolean;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Configure the property as Password component.
|
|
7
|
+
* @decorator
|
|
8
|
+
* @formio
|
|
9
|
+
* @property
|
|
10
|
+
* @schema
|
|
11
|
+
*/
|
|
12
|
+
export declare function Password(props?: PasswordOpts): PropertyDecorator;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface SelectOpts extends Record<string, any> {
|
|
2
|
+
idPath?: string;
|
|
3
|
+
valueProperty?: string;
|
|
4
|
+
template?: string;
|
|
5
|
+
multiple?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Configure the property as Select component.
|
|
9
|
+
* @decorator
|
|
10
|
+
* @formio
|
|
11
|
+
* @property
|
|
12
|
+
* @schema
|
|
13
|
+
*/
|
|
14
|
+
export declare function Select(props?: SelectOpts): PropertyDecorator;
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface TextareaOpts extends Record<string, any> {
|
|
2
|
+
showCharCount?: boolean;
|
|
3
|
+
showWordCount?: boolean;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Configure the property as Textarea component.
|
|
7
|
+
* @decorator
|
|
8
|
+
* @formio
|
|
9
|
+
* @property
|
|
10
|
+
* @schema
|
|
11
|
+
*/
|
|
12
|
+
export declare function Textarea(props?: TextareaOpts): PropertyDecorator;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FormioComponent, FormioForm } from "@tsed/formio-types";
|
|
2
|
+
import { JsonSchemaOptions } from "@tsed/schema";
|
|
3
|
+
export declare type FormioDataResolverCtx = {
|
|
4
|
+
component: FormioComponent;
|
|
5
|
+
form: FormioForm;
|
|
6
|
+
} & JsonSchemaOptions;
|
|
7
|
+
export declare type FormioDataResolver = (ctx: FormioDataResolverCtx) => Promise<any> | any;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Automatically generated by barrelsby.
|
|
3
|
+
*/
|
|
4
|
+
export * from "./components/anyToComponent";
|
|
5
|
+
export * from "./components/arrayToComponent";
|
|
6
|
+
export * from "./components/booleanToComponent";
|
|
7
|
+
export * from "./components/dateToComponent";
|
|
8
|
+
export * from "./components/defaultToComponent";
|
|
9
|
+
export * from "./components/enumToComponent";
|
|
10
|
+
export * from "./components/mapToComponent";
|
|
11
|
+
export * from "./components/nestedToComponent";
|
|
12
|
+
export * from "./components/numberToComponent";
|
|
13
|
+
export * from "./components/objectToEditGrid";
|
|
14
|
+
export * from "./components/panelToComponent";
|
|
15
|
+
export * from "./components/propertiesToComponents";
|
|
16
|
+
export * from "./components/stringToComponent";
|
|
17
|
+
export * from "./decorators/component";
|
|
18
|
+
export * from "./decorators/conditional";
|
|
19
|
+
export * from "./decorators/currency";
|
|
20
|
+
export * from "./decorators/customClass";
|
|
21
|
+
export * from "./decorators/customConditional";
|
|
22
|
+
export * from "./decorators/dataSourceJson";
|
|
23
|
+
export * from "./decorators/dataSourceUrl";
|
|
24
|
+
export * from "./decorators/errorLabel";
|
|
25
|
+
export * from "./decorators/errorMessage";
|
|
26
|
+
export * from "./decorators/form";
|
|
27
|
+
export * from "./decorators/hidden";
|
|
28
|
+
export * from "./decorators/inputTags";
|
|
29
|
+
export * from "./decorators/label";
|
|
30
|
+
export * from "./decorators/mask";
|
|
31
|
+
export * from "./decorators/maxWords";
|
|
32
|
+
export * from "./decorators/minWords";
|
|
33
|
+
export * from "./decorators/modalEdit";
|
|
34
|
+
export * from "./decorators/multiple";
|
|
35
|
+
export * from "./decorators/openWhenEmpty";
|
|
36
|
+
export * from "./decorators/password";
|
|
37
|
+
export * from "./decorators/placeholder";
|
|
38
|
+
export * from "./decorators/prefix";
|
|
39
|
+
export * from "./decorators/select";
|
|
40
|
+
export * from "./decorators/suffix";
|
|
41
|
+
export * from "./decorators/tableView";
|
|
42
|
+
export * from "./decorators/tabs";
|
|
43
|
+
export * from "./decorators/textCase";
|
|
44
|
+
export * from "./decorators/textarea";
|
|
45
|
+
export * from "./decorators/tooltip";
|
|
46
|
+
export * from "./decorators/validate";
|
|
47
|
+
export * from "./domain/FormioDataResolver";
|
|
48
|
+
export * from "./registries/FormioMappersContainer";
|
|
49
|
+
export * from "./registries/FormsContainer";
|
|
50
|
+
export * from "./utils/getFormioProps";
|
|
51
|
+
export * from "./utils/getFormioSchema";
|
|
52
|
+
export * from "./utils/getRef";
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { JsonSchemaOptions } from "@tsed/schema";
|
|
2
|
+
import { FormioForm } from "@tsed/formio-types";
|
|
3
|
+
import "../components/anyToComponent";
|
|
4
|
+
import "../components/arrayToComponent";
|
|
5
|
+
import "../components/booleanToComponent";
|
|
6
|
+
import "../components/dateToComponent";
|
|
7
|
+
import "../components/defaultToComponent";
|
|
8
|
+
import "../components/enumToComponent";
|
|
9
|
+
import "../components/mapToComponent";
|
|
10
|
+
import "../components/nestedToComponent";
|
|
11
|
+
import "../components/numberToComponent";
|
|
12
|
+
import "../components/objectToEditGrid";
|
|
13
|
+
import "../components/panelToComponent";
|
|
14
|
+
import "../components/propertiesToComponents";
|
|
15
|
+
import "../components/stringToComponent";
|
|
16
|
+
export declare function getFormioSchema(model: string | any | undefined, options?: JsonSchemaOptions): Promise<Omit<FormioForm, "components" | "_id" | "deleted" | "owner"> | undefined>;
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/schema-formio",
|
|
3
|
-
"version": "7.0.0-
|
|
3
|
+
"version": "7.0.0-beta.11",
|
|
4
4
|
"description": "Transform Ts.ED Schema & JsonSchema to a valid Formio schema",
|
|
5
5
|
"private": false,
|
|
6
6
|
"source": "./src/index.ts",
|
|
7
|
-
"main": "./lib/index.js",
|
|
8
|
-
"
|
|
7
|
+
"main": "./lib/cjs/index.js",
|
|
8
|
+
"module": "./lib/esm/index.js",
|
|
9
|
+
"typings": "./lib/types/index.d.ts",
|
|
9
10
|
"exports": {
|
|
10
|
-
"
|
|
11
|
-
"
|
|
11
|
+
"types": "./lib/types/index.d.ts",
|
|
12
|
+
"import": "./lib/esm/index.js",
|
|
13
|
+
"require": "./lib/cjs/index.js",
|
|
14
|
+
"default": "./lib/esm/index.js"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "yarn barrels && yarn run build:esm && yarn run build:cjs",
|
|
18
|
+
"build:cjs": "tsc --build tsconfig.compile.json",
|
|
19
|
+
"build:esm": "tsc --build tsconfig.compile.esm.json",
|
|
20
|
+
"barrels": "yarn barrelsby --delete -d ./src -e \"\\.spec\\.ts\" -e \"__mock__\" -e \".benchmark.ts\"",
|
|
21
|
+
"test": "cross-env NODE_ENV=test jest"
|
|
12
22
|
},
|
|
13
23
|
"keywords": [
|
|
14
24
|
"TypeScript",
|
|
@@ -22,32 +32,49 @@
|
|
|
22
32
|
"classes",
|
|
23
33
|
"tsed"
|
|
24
34
|
],
|
|
25
|
-
"scripts": {
|
|
26
|
-
"build": "microbundle --target node --no-compress --format modern,cjs --tsconfig ./tsconfig.compile.json",
|
|
27
|
-
"test": "cross-env NODE_ENV=test nyc mocha"
|
|
28
|
-
},
|
|
29
35
|
"dependencies": {
|
|
36
|
+
"@tsed/formio-types": "7.0.0-beta.11",
|
|
30
37
|
"change-case": "4.1.2",
|
|
31
|
-
"tslib": "2.
|
|
38
|
+
"tslib": "2.3.1"
|
|
32
39
|
},
|
|
33
40
|
"devDependencies": {
|
|
34
|
-
"@tsed/core": "7.0.0-
|
|
35
|
-
"@tsed/openspec": "7.0.0-
|
|
36
|
-
"@tsed/schema": "7.0.0-
|
|
41
|
+
"@tsed/core": "7.0.0-beta.11",
|
|
42
|
+
"@tsed/openspec": "7.0.0-beta.11",
|
|
43
|
+
"@tsed/schema": "7.0.0-beta.11"
|
|
37
44
|
},
|
|
38
45
|
"peerDependencies": {
|
|
39
|
-
"@tsed/core": "^7.0.0-
|
|
40
|
-
"@tsed/openspec": "^7.0.0-
|
|
41
|
-
"@tsed/schema": "^7.0.0-
|
|
46
|
+
"@tsed/core": "^7.0.0-beta.11",
|
|
47
|
+
"@tsed/openspec": "^7.0.0-beta.11",
|
|
48
|
+
"@tsed/schema": "^7.0.0-beta.11",
|
|
49
|
+
"formiojs": ">=4.0.0",
|
|
50
|
+
"lodash": ">=4.0.0",
|
|
51
|
+
"moment": ">=2.0.0"
|
|
52
|
+
},
|
|
53
|
+
"peerDependenciesMeta": {
|
|
54
|
+
"@tsed/core": {
|
|
55
|
+
"optional": false
|
|
56
|
+
},
|
|
57
|
+
"@tsed/openspec": {
|
|
58
|
+
"optional": false
|
|
59
|
+
},
|
|
60
|
+
"@tsed/schema": {
|
|
61
|
+
"optional": false
|
|
62
|
+
},
|
|
63
|
+
"formiojs": {
|
|
64
|
+
"optional": false
|
|
65
|
+
},
|
|
66
|
+
"lodash": {
|
|
67
|
+
"optional": false
|
|
68
|
+
},
|
|
69
|
+
"moment": {
|
|
70
|
+
"optional": false
|
|
71
|
+
}
|
|
42
72
|
},
|
|
43
73
|
"repository": "https://github.com/tsedio/tsed",
|
|
44
74
|
"bugs": {
|
|
45
75
|
"url": "https://github.com/tsedio/tsed/issues"
|
|
46
76
|
},
|
|
47
|
-
"homepage": "https://github.com/tsedio/tsed/tree/
|
|
77
|
+
"homepage": "https://github.com/tsedio/tsed/tree/beta/packages/third-parties/schema-formio",
|
|
48
78
|
"author": "Romain Lenzotti",
|
|
49
|
-
"license": "MIT"
|
|
50
|
-
"publishConfig": {
|
|
51
|
-
"tag": "alpha"
|
|
52
|
-
}
|
|
79
|
+
"license": "MIT"
|
|
53
80
|
}
|
package/readme.md
CHANGED
|
@@ -48,14 +48,15 @@ npm install --save @tsed/schema-formio
|
|
|
48
48
|
Given the following model
|
|
49
49
|
|
|
50
50
|
```typescript
|
|
51
|
-
import {getFormioSchema} from "@tsed/schema-formio";
|
|
51
|
+
import {getFormioSchema, Form} from "@tsed/schema-formio";
|
|
52
52
|
|
|
53
|
+
@Form()
|
|
53
54
|
export class Model {
|
|
54
55
|
@Property()
|
|
55
56
|
id: string;
|
|
56
57
|
}
|
|
57
58
|
|
|
58
|
-
console.log(getFormioSchema(Model))
|
|
59
|
+
console.log(await getFormioSchema(Model));
|
|
59
60
|
```
|
|
60
61
|
|
|
61
62
|
Generates the following formio schema:
|
|
@@ -85,7 +86,7 @@ Generates the following formio schema:
|
|
|
85
86
|
## Decorators
|
|
86
87
|
|
|
87
88
|
This package support a large part of the JsonSchema decorators provided by `@tsed/schema`.
|
|
88
|
-
So you can use `Property`, `Required`, `CollectionOf`, etc... decorator to generate a valid Formio
|
|
89
|
+
So you can use `Property`, `Required`, `CollectionOf`, etc... decorator to generate a valid Formio
|
|
89
90
|
schema.
|
|
90
91
|
|
|
91
92
|
Some extra decorators have been added to customize the component generated for a class property.
|
|
@@ -109,8 +110,9 @@ Here the list:
|
|
|
109
110
|
Component decorator let you to define any extra formio metadata on a decorated property:
|
|
110
111
|
|
|
111
112
|
```typescript
|
|
112
|
-
import {
|
|
113
|
+
import {Form, Component} from "@tsed/schema-formio";
|
|
113
114
|
|
|
115
|
+
@Form()
|
|
114
116
|
export class Model {
|
|
115
117
|
@Component({
|
|
116
118
|
tooltip: "MyTooltip"
|
|
@@ -118,7 +120,8 @@ export class Model {
|
|
|
118
120
|
tags: string;
|
|
119
121
|
}
|
|
120
122
|
```
|
|
121
|
-
|
|
123
|
+
|
|
124
|
+
So with this decorator, you can define any metadata and define your own decorator to
|
|
122
125
|
wrap a complete component schema.
|
|
123
126
|
|
|
124
127
|
### InputTags
|
|
@@ -133,7 +136,7 @@ export class Model {
|
|
|
133
136
|
tags: string[];
|
|
134
137
|
}
|
|
135
138
|
|
|
136
|
-
console.log(getFormioSchema(Model))
|
|
139
|
+
console.log(await getFormioSchema(Model));
|
|
137
140
|
```
|
|
138
141
|
|
|
139
142
|
Generates the following formio schema:
|
|
@@ -163,6 +166,7 @@ Generates the following formio schema:
|
|
|
163
166
|
```
|
|
164
167
|
|
|
165
168
|
## Contributors
|
|
169
|
+
|
|
166
170
|
Please read [contributing guidelines here](https://tsed.io/CONTRIBUTING.html)
|
|
167
171
|
|
|
168
172
|
<a href="https://github.com/tsedio/ts-express-decorators/graphs/contributors"><img src="https://opencollective.com/tsed/contributors.svg?width=890" /></a>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.compile.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"baseUrl": ".",
|
|
5
|
+
"module": "ES2020",
|
|
6
|
+
"rootDir": "src",
|
|
7
|
+
"outDir": "./lib/esm",
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"declarationDir": "./lib/types"
|
|
10
|
+
},
|
|
11
|
+
"exclude": ["node_modules", "test", "lib", "benchmark", "coverage", "spec", "**/*.benchmark.ts", "**/*.spec.ts", "keys", "jest.config.js"]
|
|
12
|
+
}
|