@tsed/schema-formio 7.0.0-alpha.2 → 7.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (277) hide show
  1. package/jest.config.js +14 -0
  2. package/lib/cjs/components/anyToComponent.js +28 -0
  3. package/lib/cjs/components/anyToComponent.js.map +1 -0
  4. package/lib/cjs/components/arrayToComponent.js +40 -0
  5. package/lib/cjs/components/arrayToComponent.js.map +1 -0
  6. package/lib/cjs/components/booleanToComponent.js +14 -0
  7. package/lib/cjs/components/booleanToComponent.js.map +1 -0
  8. package/lib/cjs/components/dateToComponent.js +57 -0
  9. package/lib/cjs/components/dateToComponent.js.map +1 -0
  10. package/lib/cjs/components/defaultToComponent.js +18 -0
  11. package/lib/cjs/components/defaultToComponent.js.map +1 -0
  12. package/lib/cjs/components/enumToComponent.js +33 -0
  13. package/lib/cjs/components/enumToComponent.js.map +1 -0
  14. package/lib/cjs/components/index.js +17 -0
  15. package/lib/cjs/components/index.js.map +1 -0
  16. package/lib/cjs/components/mapToComponent.js +20 -0
  17. package/lib/cjs/components/mapToComponent.js.map +1 -0
  18. package/lib/cjs/components/nestedToComponent.js +25 -0
  19. package/lib/cjs/components/nestedToComponent.js.map +1 -0
  20. package/lib/cjs/components/numberToComponent.js +21 -0
  21. package/lib/cjs/components/numberToComponent.js.map +1 -0
  22. package/lib/cjs/components/objectToEditGrid.js +16 -0
  23. package/lib/cjs/components/objectToEditGrid.js.map +1 -0
  24. package/lib/cjs/components/panelToComponent.js +16 -0
  25. package/lib/cjs/components/panelToComponent.js.map +1 -0
  26. package/lib/cjs/components/propertiesToComponents.js +88 -0
  27. package/lib/cjs/components/propertiesToComponents.js.map +1 -0
  28. package/lib/cjs/components/stringToComponent.js +43 -0
  29. package/lib/cjs/components/stringToComponent.js.map +1 -0
  30. package/lib/cjs/decorators/component.js +35 -0
  31. package/lib/cjs/decorators/component.js.map +1 -0
  32. package/lib/cjs/decorators/conditional.js +53 -0
  33. package/lib/cjs/decorators/conditional.js.map +1 -0
  34. package/lib/cjs/decorators/currency.js +24 -0
  35. package/lib/cjs/decorators/currency.js.map +1 -0
  36. package/lib/cjs/decorators/customClass.js +18 -0
  37. package/lib/cjs/decorators/customClass.js.map +1 -0
  38. package/lib/cjs/decorators/customConditional.js +33 -0
  39. package/lib/cjs/decorators/customConditional.js.map +1 -0
  40. package/lib/cjs/decorators/dataSourceJson.js +27 -0
  41. package/lib/cjs/decorators/dataSourceJson.js.map +1 -0
  42. package/lib/cjs/decorators/dataSourceUrl.js +22 -0
  43. package/lib/cjs/decorators/dataSourceUrl.js.map +1 -0
  44. package/lib/cjs/decorators/errorLabel.js +18 -0
  45. package/lib/cjs/decorators/errorLabel.js.map +1 -0
  46. package/lib/cjs/decorators/errorMessage.js +17 -0
  47. package/lib/cjs/decorators/errorMessage.js.map +1 -0
  48. package/lib/cjs/decorators/form.js +21 -0
  49. package/lib/cjs/decorators/form.js.map +1 -0
  50. package/lib/cjs/decorators/hidden.js +22 -0
  51. package/lib/cjs/decorators/hidden.js.map +1 -0
  52. package/lib/cjs/decorators/index.js +34 -0
  53. package/lib/cjs/decorators/index.js.map +1 -0
  54. package/lib/cjs/decorators/inputTags.js +23 -0
  55. package/lib/cjs/decorators/inputTags.js.map +1 -0
  56. package/lib/cjs/decorators/label.js +19 -0
  57. package/lib/cjs/decorators/label.js.map +1 -0
  58. package/lib/cjs/decorators/mask.js +50 -0
  59. package/lib/cjs/decorators/mask.js.map +1 -0
  60. package/lib/cjs/decorators/maxWords.js +17 -0
  61. package/lib/cjs/decorators/maxWords.js.map +1 -0
  62. package/lib/cjs/decorators/minWords.js +17 -0
  63. package/lib/cjs/decorators/minWords.js.map +1 -0
  64. package/lib/cjs/decorators/modalEdit.js +18 -0
  65. package/lib/cjs/decorators/modalEdit.js.map +1 -0
  66. package/lib/cjs/decorators/multiple.js +18 -0
  67. package/lib/cjs/decorators/multiple.js.map +1 -0
  68. package/lib/cjs/decorators/openWhenEmpty.js +18 -0
  69. package/lib/cjs/decorators/openWhenEmpty.js.map +1 -0
  70. package/lib/cjs/decorators/password.js +20 -0
  71. package/lib/cjs/decorators/password.js.map +1 -0
  72. package/lib/cjs/decorators/placeholder.js +19 -0
  73. package/lib/cjs/decorators/placeholder.js.map +1 -0
  74. package/lib/cjs/decorators/prefix.js +18 -0
  75. package/lib/cjs/decorators/prefix.js.map +1 -0
  76. package/lib/cjs/decorators/select.js +22 -0
  77. package/lib/cjs/decorators/select.js.map +1 -0
  78. package/lib/cjs/decorators/suffix.js +18 -0
  79. package/lib/cjs/decorators/suffix.js.map +1 -0
  80. package/lib/cjs/decorators/tableView.js +19 -0
  81. package/lib/cjs/decorators/tableView.js.map +1 -0
  82. package/lib/cjs/decorators/tabs.js +22 -0
  83. package/lib/cjs/decorators/tabs.js.map +1 -0
  84. package/lib/cjs/decorators/textCase.js +19 -0
  85. package/lib/cjs/decorators/textCase.js.map +1 -0
  86. package/lib/cjs/decorators/textarea.js +20 -0
  87. package/lib/cjs/decorators/textarea.js.map +1 -0
  88. package/lib/cjs/decorators/tooltip.js +19 -0
  89. package/lib/cjs/decorators/tooltip.js.map +1 -0
  90. package/lib/cjs/decorators/validate.js +22 -0
  91. package/lib/cjs/decorators/validate.js.map +1 -0
  92. package/lib/cjs/domain/FormioDataResolver.js +3 -0
  93. package/lib/cjs/domain/FormioDataResolver.js.map +1 -0
  94. package/lib/cjs/index.js +8 -0
  95. package/lib/cjs/index.js.map +1 -0
  96. package/lib/cjs/registries/FormioMappersContainer.js +21 -0
  97. package/lib/cjs/registries/FormioMappersContainer.js.map +1 -0
  98. package/lib/cjs/registries/FormsContainer.js +6 -0
  99. package/lib/cjs/registries/FormsContainer.js.map +1 -0
  100. package/lib/cjs/utils/getFormioProps.js +17 -0
  101. package/lib/cjs/utils/getFormioProps.js.map +1 -0
  102. package/lib/cjs/utils/getFormioSchema.js +42 -0
  103. package/lib/cjs/utils/getFormioSchema.js.map +1 -0
  104. package/lib/cjs/utils/getRef.js +12 -0
  105. package/lib/cjs/utils/getRef.js.map +1 -0
  106. package/lib/esm/components/anyToComponent.js +24 -0
  107. package/lib/esm/components/anyToComponent.js.map +1 -0
  108. package/lib/esm/components/arrayToComponent.js +36 -0
  109. package/lib/esm/components/arrayToComponent.js.map +1 -0
  110. package/lib/esm/components/booleanToComponent.js +12 -0
  111. package/lib/esm/components/booleanToComponent.js.map +1 -0
  112. package/lib/esm/components/dateToComponent.js +55 -0
  113. package/lib/esm/components/dateToComponent.js.map +1 -0
  114. package/lib/esm/components/defaultToComponent.js +14 -0
  115. package/lib/esm/components/defaultToComponent.js.map +1 -0
  116. package/lib/esm/components/enumToComponent.js +29 -0
  117. package/lib/esm/components/enumToComponent.js.map +1 -0
  118. package/lib/esm/components/index.js +14 -0
  119. package/lib/esm/components/index.js.map +1 -0
  120. package/lib/esm/components/mapToComponent.js +16 -0
  121. package/lib/esm/components/mapToComponent.js.map +1 -0
  122. package/lib/esm/components/nestedToComponent.js +21 -0
  123. package/lib/esm/components/nestedToComponent.js.map +1 -0
  124. package/lib/esm/components/numberToComponent.js +17 -0
  125. package/lib/esm/components/numberToComponent.js.map +1 -0
  126. package/lib/esm/components/objectToEditGrid.js +12 -0
  127. package/lib/esm/components/objectToEditGrid.js.map +1 -0
  128. package/lib/esm/components/panelToComponent.js +12 -0
  129. package/lib/esm/components/panelToComponent.js.map +1 -0
  130. package/lib/esm/components/propertiesToComponents.js +84 -0
  131. package/lib/esm/components/propertiesToComponents.js.map +1 -0
  132. package/lib/esm/components/stringToComponent.js +39 -0
  133. package/lib/esm/components/stringToComponent.js.map +1 -0
  134. package/lib/esm/decorators/component.js +31 -0
  135. package/lib/esm/decorators/component.js.map +1 -0
  136. package/lib/esm/decorators/conditional.js +47 -0
  137. package/lib/esm/decorators/conditional.js.map +1 -0
  138. package/lib/esm/decorators/currency.js +20 -0
  139. package/lib/esm/decorators/currency.js.map +1 -0
  140. package/lib/esm/decorators/customClass.js +14 -0
  141. package/lib/esm/decorators/customClass.js.map +1 -0
  142. package/lib/esm/decorators/customConditional.js +29 -0
  143. package/lib/esm/decorators/customConditional.js.map +1 -0
  144. package/lib/esm/decorators/dataSourceJson.js +23 -0
  145. package/lib/esm/decorators/dataSourceJson.js.map +1 -0
  146. package/lib/esm/decorators/dataSourceUrl.js +18 -0
  147. package/lib/esm/decorators/dataSourceUrl.js.map +1 -0
  148. package/lib/esm/decorators/errorLabel.js +14 -0
  149. package/lib/esm/decorators/errorLabel.js.map +1 -0
  150. package/lib/esm/decorators/errorMessage.js +13 -0
  151. package/lib/esm/decorators/errorMessage.js.map +1 -0
  152. package/lib/esm/decorators/form.js +17 -0
  153. package/lib/esm/decorators/form.js.map +1 -0
  154. package/lib/esm/decorators/hidden.js +18 -0
  155. package/lib/esm/decorators/hidden.js.map +1 -0
  156. package/lib/esm/decorators/index.js +31 -0
  157. package/lib/esm/decorators/index.js.map +1 -0
  158. package/lib/esm/decorators/inputTags.js +19 -0
  159. package/lib/esm/decorators/inputTags.js.map +1 -0
  160. package/lib/esm/decorators/label.js +15 -0
  161. package/lib/esm/decorators/label.js.map +1 -0
  162. package/lib/esm/decorators/mask.js +45 -0
  163. package/lib/esm/decorators/mask.js.map +1 -0
  164. package/lib/esm/decorators/maxWords.js +13 -0
  165. package/lib/esm/decorators/maxWords.js.map +1 -0
  166. package/lib/esm/decorators/minWords.js +13 -0
  167. package/lib/esm/decorators/minWords.js.map +1 -0
  168. package/lib/esm/decorators/modalEdit.js +14 -0
  169. package/lib/esm/decorators/modalEdit.js.map +1 -0
  170. package/lib/esm/decorators/multiple.js +14 -0
  171. package/lib/esm/decorators/multiple.js.map +1 -0
  172. package/lib/esm/decorators/openWhenEmpty.js +14 -0
  173. package/lib/esm/decorators/openWhenEmpty.js.map +1 -0
  174. package/lib/esm/decorators/password.js +16 -0
  175. package/lib/esm/decorators/password.js.map +1 -0
  176. package/lib/esm/decorators/placeholder.js +15 -0
  177. package/lib/esm/decorators/placeholder.js.map +1 -0
  178. package/lib/esm/decorators/prefix.js +14 -0
  179. package/lib/esm/decorators/prefix.js.map +1 -0
  180. package/lib/esm/decorators/select.js +18 -0
  181. package/lib/esm/decorators/select.js.map +1 -0
  182. package/lib/esm/decorators/suffix.js +14 -0
  183. package/lib/esm/decorators/suffix.js.map +1 -0
  184. package/lib/esm/decorators/tableView.js +15 -0
  185. package/lib/esm/decorators/tableView.js.map +1 -0
  186. package/lib/esm/decorators/tabs.js +18 -0
  187. package/lib/esm/decorators/tabs.js.map +1 -0
  188. package/lib/esm/decorators/textCase.js +15 -0
  189. package/lib/esm/decorators/textCase.js.map +1 -0
  190. package/lib/esm/decorators/textarea.js +16 -0
  191. package/lib/esm/decorators/textarea.js.map +1 -0
  192. package/lib/esm/decorators/tooltip.js +15 -0
  193. package/lib/esm/decorators/tooltip.js.map +1 -0
  194. package/lib/esm/decorators/validate.js +18 -0
  195. package/lib/esm/decorators/validate.js.map +1 -0
  196. package/lib/esm/domain/FormioDataResolver.js +2 -0
  197. package/lib/esm/domain/FormioDataResolver.js.map +1 -0
  198. package/lib/esm/index.js +5 -0
  199. package/lib/esm/index.js.map +1 -0
  200. package/lib/esm/registries/FormioMappersContainer.js +15 -0
  201. package/lib/esm/registries/FormioMappersContainer.js.map +1 -0
  202. package/lib/esm/registries/FormsContainer.js +3 -0
  203. package/lib/esm/registries/FormsContainer.js.map +1 -0
  204. package/lib/esm/utils/getFormioProps.js +13 -0
  205. package/lib/esm/utils/getFormioProps.js.map +1 -0
  206. package/lib/esm/utils/getFormioSchema.js +38 -0
  207. package/lib/esm/utils/getFormioSchema.js.map +1 -0
  208. package/lib/esm/utils/getRef.js +8 -0
  209. package/lib/esm/utils/getRef.js.map +1 -0
  210. package/lib/{components → types/components}/anyToComponent.d.ts +0 -0
  211. package/lib/{components → types/components}/arrayToComponent.d.ts +0 -0
  212. package/lib/{components → types/components}/booleanToComponent.d.ts +0 -0
  213. package/lib/{components → types/components}/dateToComponent.d.ts +0 -0
  214. package/lib/{components → types/components}/defaultToComponent.d.ts +0 -0
  215. package/lib/{components → types/components}/enumToComponent.d.ts +0 -0
  216. package/lib/{components → types/components}/index.d.ts +0 -0
  217. package/lib/{components → types/components}/mapToComponent.d.ts +0 -0
  218. package/lib/{components → types/components}/nestedToComponent.d.ts +0 -0
  219. package/lib/{components → types/components}/numberToComponent.d.ts +0 -0
  220. package/lib/{components → types/components}/objectToEditGrid.d.ts +0 -0
  221. package/lib/{components → types/components}/panelToComponent.d.ts +0 -0
  222. package/lib/{components → types/components}/propertiesToComponents.d.ts +0 -0
  223. package/lib/{components → types/components}/stringToComponent.d.ts +0 -0
  224. package/lib/{decorators → types/decorators}/component.d.ts +0 -0
  225. package/lib/types/decorators/conditional.d.ts +33 -0
  226. package/lib/{decorators → types/decorators}/currency.d.ts +0 -0
  227. package/lib/types/decorators/customClass.d.ts +8 -0
  228. package/lib/types/decorators/customConditional.d.ts +59 -0
  229. package/lib/types/decorators/dataSourceJson.d.ts +8 -0
  230. package/lib/types/decorators/dataSourceUrl.d.ts +8 -0
  231. package/lib/types/decorators/errorLabel.d.ts +8 -0
  232. package/lib/types/decorators/errorMessage.d.ts +9 -0
  233. package/lib/types/decorators/form.d.ts +6 -0
  234. package/lib/{decorators → types/decorators}/hidden.d.ts +3 -0
  235. package/lib/types/decorators/index.d.ts +30 -0
  236. package/lib/{decorators → types/decorators}/inputTags.d.ts +0 -0
  237. package/lib/types/decorators/label.d.ts +9 -0
  238. package/lib/types/decorators/mask.d.ts +37 -0
  239. package/lib/types/decorators/maxWords.d.ts +9 -0
  240. package/lib/types/decorators/minWords.d.ts +9 -0
  241. package/lib/types/decorators/modalEdit.d.ts +8 -0
  242. package/lib/{decorators → types/decorators}/multiple.d.ts +0 -0
  243. package/lib/types/decorators/openWhenEmpty.d.ts +8 -0
  244. package/lib/types/decorators/password.d.ts +12 -0
  245. package/lib/types/decorators/placeholder.d.ts +9 -0
  246. package/lib/types/decorators/prefix.d.ts +8 -0
  247. package/lib/types/decorators/select.d.ts +14 -0
  248. package/lib/types/decorators/suffix.d.ts +8 -0
  249. package/lib/{decorators → types/decorators}/tableView.d.ts +0 -0
  250. package/lib/{decorators → types/decorators}/tabs.d.ts +0 -0
  251. package/lib/types/decorators/textCase.d.ts +9 -0
  252. package/lib/types/decorators/textarea.d.ts +12 -0
  253. package/lib/types/decorators/tooltip.d.ts +9 -0
  254. package/lib/types/decorators/validate.d.ts +10 -0
  255. package/lib/types/domain/FormioDataResolver.d.ts +7 -0
  256. package/lib/{index.d.ts → types/index.d.ts} +0 -0
  257. package/lib/{registries → types/registries}/FormioMappersContainer.d.ts +0 -0
  258. package/lib/types/registries/FormsContainer.d.ts +2 -0
  259. package/lib/{utils → types/utils}/getFormioProps.d.ts +0 -0
  260. package/lib/types/utils/getFormioSchema.d.ts +4 -0
  261. package/lib/{utils → types/utils}/getRef.d.ts +0 -0
  262. package/package.json +24 -19
  263. package/readme.md +6 -4
  264. package/tsconfig.compile.esm.json +23 -0
  265. package/.mocharc.js +0 -5
  266. package/.nycrc +0 -26
  267. package/lib/decorators/dataSourceJson.d.ts +0 -7
  268. package/lib/decorators/dataSourceUrl.d.ts +0 -7
  269. package/lib/decorators/index.d.ts +0 -11
  270. package/lib/decorators/password.d.ts +0 -8
  271. package/lib/decorators/select.d.ts +0 -8
  272. package/lib/decorators/textarea.d.ts +0 -8
  273. package/lib/index.js +0 -585
  274. package/lib/index.js.map +0 -1
  275. package/lib/index.modern.js +0 -562
  276. package/lib/index.modern.js.map +0 -1
  277. package/lib/utils/getFormioSchema.d.ts +0 -11
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Adds a conditional display rule on the input form.
3
+ * @decorator
4
+ * @formio
5
+ * @property
6
+ * @schema
7
+ * @param conditional
8
+ */
9
+ export declare function Conditional(conditional: {
10
+ show: boolean;
11
+ when: string;
12
+ eq: any;
13
+ }): PropertyDecorator;
14
+ /**
15
+ * Adds a conditional display rule on the input form.
16
+ * @decorator
17
+ * @formio
18
+ * @property
19
+ * @schema
20
+ * @param property
21
+ * @param eq
22
+ */
23
+ export declare function ShowWhen(property: string, eq: any): PropertyDecorator;
24
+ /**
25
+ * Adds a conditional display rule on the input form.
26
+ * @decorator
27
+ * @formio
28
+ * @property
29
+ * @schema
30
+ * @param property
31
+ * @param eq
32
+ */
33
+ export declare function HideWhen(property: string, eq: any): PropertyDecorator;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Add a custom css class.
3
+ * @decorator
4
+ * @formio
5
+ * @property
6
+ * @schema
7
+ */
8
+ export declare function CustomClass(customClass: string): PropertyDecorator;
@@ -0,0 +1,59 @@
1
+ import { FormioComponent, FormioForm, FormioSubmission } from "@tsed/formio-types";
2
+ import type { Moment } from "moment";
3
+ import type { LoDashStatic } from "lodash";
4
+ import type { Utils } from "formiojs";
5
+ export interface CustomConditionalCtx<Value = any, Data = any, Row = any> {
6
+ /**
7
+ * The complete submission object.
8
+ */
9
+ form: FormioForm;
10
+ /**
11
+ * The complete submission object.
12
+ */
13
+ submission: FormioSubmission<Data>;
14
+ /**
15
+ * The complete submission data object.
16
+ */
17
+ data: Data;
18
+ /**
19
+ * Contextual "row" data, used within DataGrid, EditGrid, and Container components
20
+ */
21
+ row: Row;
22
+ /**
23
+ * The current component JSON
24
+ */
25
+ component: FormioComponent;
26
+ /**
27
+ * The current component instance.
28
+ */
29
+ instance: any;
30
+ /**
31
+ * The current value of the component.
32
+ */
33
+ value: Value;
34
+ /**
35
+ * The moment.js library for date manipulation.
36
+ */
37
+ moment: Moment;
38
+ /**
39
+ * An instance of Lodash.
40
+ */
41
+ _: LoDashStatic;
42
+ /**
43
+ * An instance of the FormioUtils object.
44
+ */
45
+ utils: typeof Utils;
46
+ /**
47
+ * An alias for "utils".
48
+ */
49
+ util: typeof Utils;
50
+ }
51
+ /**
52
+ * Adds custom conditional rule to display or not the input form.
53
+ * @decorator
54
+ * @formio
55
+ * @property
56
+ * @schema
57
+ * @param customConditional
58
+ */
59
+ export declare function CustomConditional(customConditional: string | ((ctx: CustomConditionalCtx) => any)): PropertyDecorator;
@@ -0,0 +1,8 @@
1
+ import { FormioDataResolver } from "../domain/FormioDataResolver";
2
+ /**
3
+ * Set custom json data source
4
+ * @param data
5
+ * @param props
6
+ * @constructor
7
+ */
8
+ export declare function DataSourceJson(data: any | FormioDataResolver, props?: Record<string, any>): PropertyDecorator;
@@ -0,0 +1,8 @@
1
+ import { FormioDataResolver } from "../domain/FormioDataResolver";
2
+ /**
3
+ * Set URL data on the current component.
4
+ * @param url
5
+ * @param props
6
+ * @constructor
7
+ */
8
+ export declare function DataSourceUrl(url: string | FormioDataResolver, props?: Record<string, any>): PropertyDecorator;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Set the error label when an error occur.
3
+ * @decorator
4
+ * @formio
5
+ * @property
6
+ * @schema
7
+ */
8
+ export declare function ErrorLabel(message: string): PropertyDecorator;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Add error message when an error occur.
3
+ * @decorator
4
+ * @formio
5
+ * @property
6
+ * @schema
7
+ * @param message
8
+ */
9
+ export declare function ErrorMessage(message: string): PropertyDecorator;
@@ -0,0 +1,6 @@
1
+ import { FormioForm } from "@tsed/formio-types";
2
+ /**
3
+ * Expose the model as Formio Form.
4
+ * @param form
5
+ */
6
+ export declare function Form(form?: Partial<Omit<FormioForm, "components" | "_id">>): ClassDecorator;
@@ -1,5 +1,8 @@
1
1
  /**
2
2
  * Set hidden field.
3
+ *
4
+ * A hidden field is still a part of the form, but is hidden from view.
5
+ *
3
6
  * @param bool
4
7
  * @decorator
5
8
  * @formio
@@ -0,0 +1,30 @@
1
+ export * from "./component";
2
+ export * from "./currency";
3
+ export * from "./dataSourceJson";
4
+ export * from "./dataSourceUrl";
5
+ export * from "./hidden";
6
+ export * from "./inputTags";
7
+ export * from "./multiple";
8
+ export * from "./password";
9
+ export * from "./select";
10
+ export * from "./tableView";
11
+ export * from "./textarea";
12
+ export * from "./errorMessage";
13
+ export * from "./errorLabel";
14
+ export * from "./minWords";
15
+ export * from "./maxWords";
16
+ export * from "./validate";
17
+ export * from "./form";
18
+ export * from "./tabs";
19
+ export * from "./placeholder";
20
+ export * from "./tooltip";
21
+ export * from "./label";
22
+ export * from "./customClass";
23
+ export * from "./modalEdit";
24
+ export * from "./mask";
25
+ export * from "./prefix";
26
+ export * from "./suffix";
27
+ export * from "./textCase";
28
+ export * from "./conditional";
29
+ export * from "./customConditional";
30
+ export * from "./openWhenEmpty";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Change the label field
3
+ * @decorator
4
+ * @formio
5
+ * @property
6
+ * @schema
7
+ * @param label
8
+ */
9
+ export declare function Label(label: string): PropertyDecorator;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * An input mask helps the user with input by ensuring a predefined format.
3
+ *
4
+ * - 9: numeric
5
+ * - a: alphabetical
6
+ * - *: alphanumeric
7
+ *
8
+ * Example telephone mask: (999) 999-9999
9
+ *
10
+ * See the [jquery.inputmask](https://github.com/RobinHerbots/Inputmask) documentation for more information.
11
+ *
12
+ * @decorator
13
+ * @formio
14
+ * @property
15
+ * @schema
16
+ */
17
+ export declare function Mask(inputMask: string, inputMaskPlaceholderChar?: string): PropertyDecorator;
18
+ /**
19
+ * An input mask helps the user with input by ensuring a predefined format.
20
+ *
21
+ * - 9: numeric
22
+ * - a: alphabetical
23
+ * - *: alphanumeric
24
+ *
25
+ * Example telephone mask: (999) 999-9999
26
+ *
27
+ * See the [jquery.inputmask](https://github.com/RobinHerbots/Inputmask) documentation for more information.
28
+ *
29
+ * @decorator
30
+ * @formio
31
+ * @property
32
+ * @schema
33
+ */
34
+ export declare function Masks(...inputMasks: {
35
+ label: string;
36
+ mask: string;
37
+ }[]): PropertyDecorator;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Add the minimum amount of words that can be added to this field.
3
+ * @decorator
4
+ * @formio
5
+ * @property
6
+ * @schema
7
+ * @param value
8
+ */
9
+ export declare function MaxWords(value: number): PropertyDecorator;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Add the maximum amount of words that can be added to this field.
3
+ * @decorator
4
+ * @formio
5
+ * @property
6
+ * @schema
7
+ * @param value
8
+ */
9
+ export declare function MinWords(value: number): PropertyDecorator;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Opens up a modal to edit the value of this component.
3
+ * @decorator
4
+ * @formio
5
+ * @property
6
+ * @schema
7
+ */
8
+ export declare function ModalEdit(modalEdit?: boolean): PropertyDecorator;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Open automatically the editgrid when the list is empty.
3
+ * @decorator
4
+ * @formio
5
+ * @property
6
+ * @schema
7
+ */
8
+ export declare function OpenWhenEmpty(openWhenEmpty?: boolean): PropertyDecorator;
@@ -0,0 +1,12 @@
1
+ export interface PasswordOpts extends Record<string, any> {
2
+ showCharCount?: boolean;
3
+ showWordCount?: boolean;
4
+ }
5
+ /**
6
+ * Configure the property as Password component.
7
+ * @decorator
8
+ * @formio
9
+ * @property
10
+ * @schema
11
+ */
12
+ export declare function Password(props?: PasswordOpts): PropertyDecorator;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The placeholder text that will appear when this field is empty.
3
+ * @decorator
4
+ * @formio
5
+ * @property
6
+ * @schema
7
+ * @param placeholder
8
+ */
9
+ export declare function Placeholder(placeholder: string): PropertyDecorator;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Add prefix word on the decorated field.
3
+ * @decorator
4
+ * @formio
5
+ * @property
6
+ * @schema
7
+ */
8
+ export declare function Prefix(prefix: string): PropertyDecorator;
@@ -0,0 +1,14 @@
1
+ export interface SelectOpts extends Record<string, any> {
2
+ idPath?: string;
3
+ valueProperty?: string;
4
+ template?: string;
5
+ multiple?: boolean;
6
+ }
7
+ /**
8
+ * Configure the property as Select component.
9
+ * @decorator
10
+ * @formio
11
+ * @property
12
+ * @schema
13
+ */
14
+ export declare function Select(props?: SelectOpts): PropertyDecorator;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Add suffix word on the decorated field.
3
+ * @decorator
4
+ * @formio
5
+ * @property
6
+ * @schema
7
+ */
8
+ export declare function Suffix(suffix: string): PropertyDecorator;
File without changes
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Force the output of this field to be sanitized in a specific format.
3
+ * @decorator
4
+ * @formio
5
+ * @property
6
+ * @schema
7
+ * @param textCase
8
+ */
9
+ export declare function TextCase(textCase: "uppercase" | "lowercase"): PropertyDecorator;
@@ -0,0 +1,12 @@
1
+ export interface TextareaOpts extends Record<string, any> {
2
+ showCharCount?: boolean;
3
+ showWordCount?: boolean;
4
+ }
5
+ /**
6
+ * Configure the property as Textarea component.
7
+ * @decorator
8
+ * @formio
9
+ * @property
10
+ * @schema
11
+ */
12
+ export declare function Textarea(props?: TextareaOpts): PropertyDecorator;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Adds a tooltip to the side of this field.
3
+ * @decorator
4
+ * @formio
5
+ * @property
6
+ * @schema
7
+ * @param tooltip
8
+ */
9
+ export declare function Tooltip(tooltip: string): PropertyDecorator;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Add validation rules.
3
+ * @decorator
4
+ * @formio
5
+ * @property
6
+ * @schema
7
+ * @param key
8
+ * @param value
9
+ */
10
+ export declare function Validate(key: string, value: any): 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;
File without changes
@@ -0,0 +1,2 @@
1
+ import { Type } from "@tsed/core";
2
+ export declare const FormsContainer: Map<string, Type>;
File without changes
@@ -0,0 +1,4 @@
1
+ import { JsonSchemaOptions } from "@tsed/schema";
2
+ import { FormioForm } from "@tsed/formio-types";
3
+ import "../components";
4
+ export declare function getFormioSchema(model: string | any | undefined, options?: JsonSchemaOptions): Promise<Omit<FormioForm, "components" | "_id" | "deleted" | "owner"> | undefined>;
File without changes
package/package.json CHANGED
@@ -1,14 +1,22 @@
1
1
  {
2
2
  "name": "@tsed/schema-formio",
3
- "version": "7.0.0-alpha.2",
3
+ "version": "7.0.0-beta.1",
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
- "typings": "./lib/index.d.ts",
7
+ "main": "./lib/cjs/index.js",
8
+ "typings": "./lib/types/index.d.ts",
9
9
  "exports": {
10
- "require": "./lib/index.js",
11
- "default": "./lib/index.modern.js"
10
+ "types": "./lib/types/index.d.ts",
11
+ "import": "./lib/esm/index.js",
12
+ "require": "./lib/cjs/index.js",
13
+ "default": "./lib/esm/index.js"
14
+ },
15
+ "scripts": {
16
+ "build": "yarn run build:esm && yarn run build:cjs",
17
+ "build:cjs": "tsc --build tsconfig.compile.json",
18
+ "build:esm": "tsc --build tsconfig.compile.esm.json",
19
+ "test": "cross-env NODE_ENV=test jest"
12
20
  },
13
21
  "keywords": [
14
22
  "TypeScript",
@@ -22,23 +30,23 @@
22
30
  "classes",
23
31
  "tsed"
24
32
  ],
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
33
  "dependencies": {
34
+ "@tsed/formio-types": "7.0.0-beta.1",
30
35
  "change-case": "4.1.2",
31
36
  "tslib": "2.2.0"
32
37
  },
33
38
  "devDependencies": {
34
- "@tsed/core": "7.0.0-alpha.2",
35
- "@tsed/openspec": "7.0.0-alpha.2",
36
- "@tsed/schema": "7.0.0-alpha.2"
39
+ "@tsed/core": "7.0.0-beta.1",
40
+ "@tsed/openspec": "7.0.0-beta.1",
41
+ "@tsed/schema": "7.0.0-beta.1"
37
42
  },
38
43
  "peerDependencies": {
39
- "@tsed/core": "^7.0.0-alpha.2",
40
- "@tsed/openspec": "^7.0.0-alpha.2",
41
- "@tsed/schema": "^7.0.0-alpha.2"
44
+ "@tsed/core": "^7.0.0-beta.1",
45
+ "@tsed/openspec": "^7.0.0-beta.1",
46
+ "@tsed/schema": "^7.0.0-beta.1",
47
+ "formiojs": ">=4.0.0",
48
+ "lodash": ">=4.0.0",
49
+ "moment": ">=2.0.0"
42
50
  },
43
51
  "repository": "https://github.com/tsedio/tsed",
44
52
  "bugs": {
@@ -46,8 +54,5 @@
46
54
  },
47
55
  "homepage": "https://github.com/tsedio/tsed/tree/alpha/packages/third-parties/schema-formio",
48
56
  "author": "Romain Lenzotti",
49
- "license": "MIT",
50
- "publishConfig": {
51
- "tag": "alpha"
52
- }
57
+ "license": "MIT"
53
58
  }
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:
@@ -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 {getFormioSchema} from "@tsed/schema-formio";
113
+ import {Form, Component} from "@tsed/schema-formio";
113
114
 
115
+ @Form()
114
116
  export class Model {
115
117
  @Component({
116
118
  tooltip: "MyTooltip"
@@ -133,7 +135,7 @@ export class Model {
133
135
  tags: string[];
134
136
  }
135
137
 
136
- console.log(getFormioSchema(Model))
138
+ console.log(await getFormioSchema(Model))
137
139
  ```
138
140
 
139
141
  Generates the following formio schema:
@@ -0,0 +1,23 @@
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": [
12
+ "node_modules",
13
+ "test",
14
+ "lib",
15
+ "benchmark",
16
+ "coverage",
17
+ "spec",
18
+ "**/*.benchmark.ts",
19
+ "**/*.spec.ts",
20
+ "keys",
21
+ "jest.config.js"
22
+ ]
23
+ }
package/.mocharc.js DELETED
@@ -1,5 +0,0 @@
1
- module.exports = {
2
- ...require('@tsed/mocha-config')(),
3
- spec: ["{src,test}/**/*.spec.ts"],
4
- exclude: [],
5
- };
package/.nycrc DELETED
@@ -1,26 +0,0 @@
1
- {
2
- "include": [
3
- "src/**/*.ts"
4
- ],
5
- "exclude": [
6
- "**/*.d.ts",
7
- "node_modules",
8
- "**/interfaces/**",
9
- "**/index.ts"
10
- ],
11
- "extension": [
12
- ".ts"
13
- ],
14
- "require": [],
15
- "reporter": [
16
- "text-summary",
17
- "html",
18
- "lcov",
19
- "json"
20
- ],
21
- "check-coverage": true,
22
- "statements": 100,
23
- "branches": 100,
24
- "functions": 100,
25
- "lines": 100
26
- }
@@ -1,7 +0,0 @@
1
- /**
2
- * Set custom json data source
3
- * @param data
4
- * @param props
5
- * @constructor
6
- */
7
- export declare function DataSourceJson(data: any, props?: Record<string, any>): PropertyDecorator;
@@ -1,7 +0,0 @@
1
- /**
2
- * Set URL data on the current component.
3
- * @param url
4
- * @param props
5
- * @constructor
6
- */
7
- export declare function DataSourceUrl(url: string, props?: Record<string, any>): PropertyDecorator;
@@ -1,11 +0,0 @@
1
- export * from "./component";
2
- export * from "./currency";
3
- export * from "./dataSourceJson";
4
- export * from "./dataSourceUrl";
5
- export * from "./hidden";
6
- export * from "./inputTags";
7
- export * from "./multiple";
8
- export * from "./password";
9
- export * from "./select";
10
- export * from "./tableView";
11
- export * from "./textarea";
@@ -1,8 +0,0 @@
1
- /**
2
- * Configure the property as Password component.
3
- * @decorator
4
- * @formio
5
- * @property
6
- * @schema
7
- */
8
- export declare function Password(props?: Record<string, any>): PropertyDecorator;
@@ -1,8 +0,0 @@
1
- /**
2
- * Configure the property as Select component.
3
- * @decorator
4
- * @formio
5
- * @property
6
- * @schema
7
- */
8
- export declare function Select(props?: Record<string, any>): PropertyDecorator;
@@ -1,8 +0,0 @@
1
- /**
2
- * Configure the property as Textarea component.
3
- * @decorator
4
- * @formio
5
- * @property
6
- * @schema
7
- */
8
- export declare function Textarea(props?: Record<string, any>): PropertyDecorator;