@cratis/components 0.1.18 → 1.0.3

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 (294) hide show
  1. package/README.md +83 -0
  2. package/dist/cjs/CommandDialog/CommandDialog.js +14 -25
  3. package/dist/cjs/CommandDialog/CommandDialog.js.map +1 -1
  4. package/dist/cjs/CommandForm/fields/CheckboxField.js +2 -2
  5. package/dist/cjs/CommandForm/fields/CheckboxField.js.map +1 -1
  6. package/dist/cjs/CommandForm/fields/DropdownField.js +5 -5
  7. package/dist/cjs/CommandForm/fields/DropdownField.js.map +1 -1
  8. package/dist/cjs/CommandForm/fields/InputTextField.js +2 -2
  9. package/dist/cjs/CommandForm/fields/InputTextField.js.map +1 -1
  10. package/dist/cjs/CommandForm/fields/NumberField.js +2 -2
  11. package/dist/cjs/CommandForm/fields/NumberField.js.map +1 -1
  12. package/dist/cjs/CommandForm/fields/SliderField.js +5 -9
  13. package/dist/cjs/CommandForm/fields/SliderField.js.map +1 -1
  14. package/dist/cjs/CommandForm/fields/TextAreaField.js +2 -2
  15. package/dist/cjs/CommandForm/fields/TextAreaField.js.map +1 -1
  16. package/dist/cjs/CommandForm/index.js +35 -15
  17. package/dist/cjs/CommandForm/index.js.map +1 -1
  18. package/dist/cjs/Common/ErrorBoundary.js +26 -0
  19. package/dist/cjs/Common/ErrorBoundary.js.map +1 -0
  20. package/dist/cjs/Common/FormElement.js +10 -0
  21. package/dist/cjs/Common/FormElement.js.map +1 -0
  22. package/dist/cjs/Common/index.js +12 -0
  23. package/dist/cjs/Common/index.js.map +1 -0
  24. package/dist/cjs/DataTables/DataTableForObservableQuery.js +53 -1
  25. package/dist/cjs/DataTables/DataTableForObservableQuery.js.map +1 -1
  26. package/dist/cjs/DataTables/DataTableForQuery.js +19 -1
  27. package/dist/cjs/DataTables/DataTableForQuery.js.map +1 -1
  28. package/dist/cjs/Dialogs/BusyIndicatorDialog.js +2 -3
  29. package/dist/cjs/Dialogs/BusyIndicatorDialog.js.map +1 -1
  30. package/dist/cjs/Dialogs/ConfirmationDialog.js +4 -21
  31. package/dist/cjs/Dialogs/ConfirmationDialog.js.map +1 -1
  32. package/dist/cjs/Dialogs/Dialog.js +66 -0
  33. package/dist/cjs/Dialogs/Dialog.js.map +1 -0
  34. package/dist/cjs/Dialogs/index.js +4 -2
  35. package/dist/cjs/Dialogs/index.js.map +1 -1
  36. package/dist/cjs/ObjectContentEditor/ObjectContentEditor.js +156 -0
  37. package/dist/cjs/ObjectContentEditor/ObjectContentEditor.js.map +1 -0
  38. package/dist/cjs/ObjectContentEditor/index.js +8 -0
  39. package/dist/cjs/ObjectContentEditor/index.js.map +1 -0
  40. package/dist/cjs/ObjectNavigationalBar/ObjectNavigationalBar.js +45 -0
  41. package/dist/cjs/ObjectNavigationalBar/ObjectNavigationalBar.js.map +1 -0
  42. package/dist/cjs/ObjectNavigationalBar/index.js +8 -0
  43. package/dist/cjs/ObjectNavigationalBar/index.js.map +1 -0
  44. package/dist/cjs/PivotViewer/components/PivotCanvas.js.map +1 -1
  45. package/dist/cjs/PivotViewer/components/PivotViewerMain.js.map +1 -1
  46. package/dist/cjs/PivotViewer/components/pivot/groups.js +15 -15
  47. package/dist/cjs/PivotViewer/components/pivot/groups.js.map +1 -1
  48. package/dist/cjs/PivotViewer/components/pivot/sprites.js +2 -2
  49. package/dist/cjs/PivotViewer/components/pivot/sprites.js.map +1 -1
  50. package/dist/cjs/PivotViewer/types.js.map +1 -1
  51. package/dist/cjs/SchemaEditor/NameCell.js +38 -0
  52. package/dist/cjs/SchemaEditor/NameCell.js.map +1 -0
  53. package/dist/cjs/SchemaEditor/SchemaEditor.js +352 -0
  54. package/dist/cjs/SchemaEditor/SchemaEditor.js.map +1 -0
  55. package/dist/cjs/SchemaEditor/SchemaEditor.module.css +11 -0
  56. package/dist/cjs/SchemaEditor/TypeCell.js +102 -0
  57. package/dist/cjs/SchemaEditor/TypeCell.js.map +1 -0
  58. package/dist/cjs/SchemaEditor/index.js +10 -0
  59. package/dist/cjs/SchemaEditor/index.js.map +1 -0
  60. package/dist/cjs/TimeMachine/TimeMachine.js +0 -3
  61. package/dist/cjs/TimeMachine/TimeMachine.js.map +1 -1
  62. package/dist/cjs/index.js +20 -12
  63. package/dist/cjs/index.js.map +1 -1
  64. package/dist/cjs/package.json +3 -0
  65. package/dist/cjs/types/TypeFormat.js +20 -0
  66. package/dist/cjs/types/TypeFormat.js.map +1 -0
  67. package/dist/esm/CommandDialog/CommandDialog.d.ts +1 -1
  68. package/dist/esm/CommandDialog/CommandDialog.d.ts.map +1 -1
  69. package/dist/esm/CommandDialog/CommandDialog.js +15 -26
  70. package/dist/esm/CommandDialog/CommandDialog.js.map +1 -1
  71. package/dist/esm/CommandDialog/CommandDialog.stories.d.ts +1 -0
  72. package/dist/esm/CommandDialog/CommandDialog.stories.d.ts.map +1 -1
  73. package/dist/esm/CommandDialog/CommandDialog.stories.js +57 -3
  74. package/dist/esm/CommandDialog/CommandDialog.stories.js.map +1 -1
  75. package/dist/esm/CommandForm/fields/CheckboxField.d.ts +3 -2
  76. package/dist/esm/CommandForm/fields/CheckboxField.d.ts.map +1 -1
  77. package/dist/esm/CommandForm/fields/CheckboxField.js +1 -1
  78. package/dist/esm/CommandForm/fields/CheckboxField.js.map +1 -1
  79. package/dist/esm/CommandForm/fields/DropdownField.d.ts +7 -6
  80. package/dist/esm/CommandForm/fields/DropdownField.d.ts.map +1 -1
  81. package/dist/esm/CommandForm/fields/DropdownField.js +6 -6
  82. package/dist/esm/CommandForm/fields/DropdownField.js.map +1 -1
  83. package/dist/esm/CommandForm/fields/Fields.stories.d.ts +13 -0
  84. package/dist/esm/CommandForm/fields/Fields.stories.d.ts.map +1 -0
  85. package/dist/esm/CommandForm/fields/Fields.stories.js +137 -0
  86. package/dist/esm/CommandForm/fields/Fields.stories.js.map +1 -0
  87. package/dist/esm/CommandForm/fields/InputTextField.d.ts +3 -2
  88. package/dist/esm/CommandForm/fields/InputTextField.d.ts.map +1 -1
  89. package/dist/esm/CommandForm/fields/InputTextField.js +1 -1
  90. package/dist/esm/CommandForm/fields/InputTextField.js.map +1 -1
  91. package/dist/esm/CommandForm/fields/NumberField.d.ts +3 -2
  92. package/dist/esm/CommandForm/fields/NumberField.d.ts.map +1 -1
  93. package/dist/esm/CommandForm/fields/NumberField.js +1 -1
  94. package/dist/esm/CommandForm/fields/NumberField.js.map +1 -1
  95. package/dist/esm/CommandForm/fields/SliderField.d.ts +5 -4
  96. package/dist/esm/CommandForm/fields/SliderField.d.ts.map +1 -1
  97. package/dist/esm/CommandForm/fields/SliderField.js +5 -9
  98. package/dist/esm/CommandForm/fields/SliderField.js.map +1 -1
  99. package/dist/esm/CommandForm/fields/TextAreaField.d.ts +3 -2
  100. package/dist/esm/CommandForm/fields/TextAreaField.d.ts.map +1 -1
  101. package/dist/esm/CommandForm/fields/TextAreaField.js +1 -1
  102. package/dist/esm/CommandForm/fields/TextAreaField.js.map +1 -1
  103. package/dist/esm/CommandForm/fields/index.d.ts +2 -2
  104. package/dist/esm/CommandForm/fields/index.d.ts.map +1 -1
  105. package/dist/esm/CommandForm/fields/index.js +2 -2
  106. package/dist/esm/CommandForm/fields/index.js.map +1 -1
  107. package/dist/esm/CommandForm/index.d.ts +1 -5
  108. package/dist/esm/CommandForm/index.d.ts.map +1 -1
  109. package/dist/esm/CommandForm/index.js +3 -7
  110. package/dist/esm/CommandForm/index.js.map +1 -1
  111. package/dist/esm/Common/ErrorBoundary.d.ts +1 -1
  112. package/dist/esm/Common/ErrorBoundary.js +7 -4
  113. package/dist/esm/Common/ErrorBoundary.js.map +1 -1
  114. package/dist/esm/Common/ErrorBoundary.stories.d.ts +7 -7
  115. package/dist/esm/Common/ErrorBoundary.stories.d.ts.map +1 -1
  116. package/dist/esm/Common/ErrorBoundary.stories.js +21 -5
  117. package/dist/esm/Common/ErrorBoundary.stories.js.map +1 -1
  118. package/dist/esm/Common/FormElement.js +7 -4
  119. package/dist/esm/Common/FormElement.js.map +1 -1
  120. package/dist/esm/Common/FormElement.stories.d.ts +8 -7
  121. package/dist/esm/Common/FormElement.stories.d.ts.map +1 -1
  122. package/dist/esm/Common/FormElement.stories.js +25 -4
  123. package/dist/esm/Common/FormElement.stories.js.map +1 -1
  124. package/dist/esm/Common/Page.stories.d.ts +7 -7
  125. package/dist/esm/Common/Page.stories.d.ts.map +1 -1
  126. package/dist/esm/Common/Page.stories.js +20 -5
  127. package/dist/esm/Common/Page.stories.js.map +1 -1
  128. package/dist/esm/Common/index.js +4 -4
  129. package/dist/esm/Common/index.js.map +1 -1
  130. package/dist/esm/DataPage/DataPage.stories.d.ts +7 -7
  131. package/dist/esm/DataPage/DataPage.stories.d.ts.map +1 -1
  132. package/dist/esm/DataPage/DataPage.stories.js +33 -5
  133. package/dist/esm/DataPage/DataPage.stories.js.map +1 -1
  134. package/dist/esm/DataTables/DataTableForObservableQuery.d.ts +1 -0
  135. package/dist/esm/DataTables/DataTableForObservableQuery.d.ts.map +1 -1
  136. package/dist/esm/DataTables/DataTableForObservableQuery.js +55 -3
  137. package/dist/esm/DataTables/DataTableForObservableQuery.js.map +1 -1
  138. package/dist/esm/DataTables/DataTableForObservableQuery.stories.d.ts +7 -7
  139. package/dist/esm/DataTables/DataTableForObservableQuery.stories.d.ts.map +1 -1
  140. package/dist/esm/DataTables/DataTableForObservableQuery.stories.js +55 -5
  141. package/dist/esm/DataTables/DataTableForObservableQuery.stories.js.map +1 -1
  142. package/dist/esm/DataTables/DataTableForQuery.d.ts +1 -0
  143. package/dist/esm/DataTables/DataTableForQuery.d.ts.map +1 -1
  144. package/dist/esm/DataTables/DataTableForQuery.js +21 -3
  145. package/dist/esm/DataTables/DataTableForQuery.js.map +1 -1
  146. package/dist/esm/DataTables/DataTableForQuery.stories.d.ts +7 -7
  147. package/dist/esm/DataTables/DataTableForQuery.stories.d.ts.map +1 -1
  148. package/dist/esm/DataTables/DataTableForQuery.stories.js +31 -5
  149. package/dist/esm/DataTables/DataTableForQuery.stories.js.map +1 -1
  150. package/dist/esm/Dialogs/BusyIndicatorDialog.d.ts.map +1 -1
  151. package/dist/esm/Dialogs/BusyIndicatorDialog.js +3 -4
  152. package/dist/esm/Dialogs/BusyIndicatorDialog.js.map +1 -1
  153. package/dist/esm/Dialogs/ConfirmationDialog.d.ts.map +1 -1
  154. package/dist/esm/Dialogs/ConfirmationDialog.js +6 -23
  155. package/dist/esm/Dialogs/ConfirmationDialog.js.map +1 -1
  156. package/dist/esm/Dialogs/Dialog.d.ts +23 -0
  157. package/dist/esm/Dialogs/Dialog.d.ts.map +1 -0
  158. package/dist/esm/Dialogs/Dialog.js +64 -0
  159. package/dist/esm/Dialogs/Dialog.js.map +1 -0
  160. package/dist/esm/Dialogs/index.d.ts +2 -1
  161. package/dist/esm/Dialogs/index.d.ts.map +1 -1
  162. package/dist/esm/Dialogs/index.js +2 -1
  163. package/dist/esm/Dialogs/index.js.map +1 -1
  164. package/dist/esm/ObjectContentEditor/ObjectContentEditor.d.ts +8 -0
  165. package/dist/esm/ObjectContentEditor/ObjectContentEditor.d.ts.map +1 -0
  166. package/dist/esm/ObjectContentEditor/ObjectContentEditor.js +135 -0
  167. package/dist/esm/ObjectContentEditor/ObjectContentEditor.js.map +1 -0
  168. package/dist/esm/ObjectContentEditor/ObjectContentEditor.stories.d.ts +10 -0
  169. package/dist/esm/ObjectContentEditor/ObjectContentEditor.stories.d.ts.map +1 -0
  170. package/dist/esm/ObjectContentEditor/ObjectContentEditor.stories.js +144 -0
  171. package/dist/esm/ObjectContentEditor/ObjectContentEditor.stories.js.map +1 -0
  172. package/dist/esm/ObjectContentEditor/index.d.ts +2 -0
  173. package/dist/esm/ObjectContentEditor/index.d.ts.map +1 -0
  174. package/dist/esm/ObjectContentEditor/index.js +2 -0
  175. package/dist/esm/ObjectContentEditor/index.js.map +1 -0
  176. package/dist/esm/ObjectNavigationalBar/ObjectNavigationalBar.d.ts +6 -0
  177. package/dist/esm/ObjectNavigationalBar/ObjectNavigationalBar.d.ts.map +1 -0
  178. package/dist/esm/ObjectNavigationalBar/ObjectNavigationalBar.js +24 -0
  179. package/dist/esm/ObjectNavigationalBar/ObjectNavigationalBar.js.map +1 -0
  180. package/dist/esm/ObjectNavigationalBar/ObjectNavigationalBar.stories.d.ts +10 -0
  181. package/dist/esm/ObjectNavigationalBar/ObjectNavigationalBar.stories.d.ts.map +1 -0
  182. package/dist/esm/ObjectNavigationalBar/ObjectNavigationalBar.stories.js +46 -0
  183. package/dist/esm/ObjectNavigationalBar/ObjectNavigationalBar.stories.js.map +1 -0
  184. package/dist/esm/ObjectNavigationalBar/index.d.ts +2 -0
  185. package/dist/esm/ObjectNavigationalBar/index.d.ts.map +1 -0
  186. package/dist/esm/ObjectNavigationalBar/index.js +2 -0
  187. package/dist/esm/ObjectNavigationalBar/index.js.map +1 -0
  188. package/dist/esm/PivotViewer/components/PivotCanvas.d.ts +2 -2
  189. package/dist/esm/PivotViewer/components/PivotCanvas.d.ts.map +1 -1
  190. package/dist/esm/PivotViewer/components/PivotCanvas.js.map +1 -1
  191. package/dist/esm/PivotViewer/components/PivotViewerMain.d.ts +2 -2
  192. package/dist/esm/PivotViewer/components/PivotViewerMain.d.ts.map +1 -1
  193. package/dist/esm/PivotViewer/components/PivotViewerMain.js.map +1 -1
  194. package/dist/esm/PivotViewer/components/pivot/groups.d.ts.map +1 -1
  195. package/dist/esm/PivotViewer/components/pivot/groups.js +2 -2
  196. package/dist/esm/PivotViewer/components/pivot/groups.js.map +1 -1
  197. package/dist/esm/PivotViewer/components/pivot/sprites.d.ts +4 -4
  198. package/dist/esm/PivotViewer/components/pivot/sprites.d.ts.map +1 -1
  199. package/dist/esm/PivotViewer/components/pivot/sprites.js +2 -2
  200. package/dist/esm/PivotViewer/components/pivot/sprites.js.map +1 -1
  201. package/dist/esm/PivotViewer/types.d.ts +2 -2
  202. package/dist/esm/PivotViewer/types.d.ts.map +1 -1
  203. package/dist/esm/PivotViewer/types.js.map +1 -1
  204. package/dist/esm/SchemaEditor/NameCell.d.ts +9 -0
  205. package/dist/esm/SchemaEditor/NameCell.d.ts.map +1 -0
  206. package/dist/esm/SchemaEditor/NameCell.js +17 -0
  207. package/dist/esm/SchemaEditor/NameCell.js.map +1 -0
  208. package/dist/esm/SchemaEditor/SchemaEditor.d.ts +17 -0
  209. package/dist/esm/SchemaEditor/SchemaEditor.d.ts.map +1 -0
  210. package/dist/esm/SchemaEditor/SchemaEditor.js +331 -0
  211. package/dist/esm/SchemaEditor/SchemaEditor.js.map +1 -0
  212. package/dist/esm/SchemaEditor/SchemaEditor.module.css +11 -0
  213. package/dist/esm/SchemaEditor/SchemaEditor.stories.d.ts +12 -0
  214. package/dist/esm/SchemaEditor/SchemaEditor.stories.d.ts.map +1 -0
  215. package/dist/esm/SchemaEditor/SchemaEditor.stories.js +158 -0
  216. package/dist/esm/SchemaEditor/SchemaEditor.stories.js.map +1 -0
  217. package/dist/esm/SchemaEditor/TypeCell.d.ts +14 -0
  218. package/dist/esm/SchemaEditor/TypeCell.d.ts.map +1 -0
  219. package/dist/esm/SchemaEditor/TypeCell.js +81 -0
  220. package/dist/esm/SchemaEditor/TypeCell.js.map +1 -0
  221. package/dist/esm/SchemaEditor/index.d.ts +4 -0
  222. package/dist/esm/SchemaEditor/index.d.ts.map +1 -0
  223. package/dist/esm/SchemaEditor/index.js +3 -0
  224. package/dist/esm/SchemaEditor/index.js.map +1 -0
  225. package/dist/esm/TimeMachine/EventsView.stories.d.ts +8 -7
  226. package/dist/esm/TimeMachine/EventsView.stories.d.ts.map +1 -1
  227. package/dist/esm/TimeMachine/EventsView.stories.js +80 -4
  228. package/dist/esm/TimeMachine/EventsView.stories.js.map +1 -1
  229. package/dist/esm/TimeMachine/Properties.stories.d.ts +9 -7
  230. package/dist/esm/TimeMachine/Properties.stories.d.ts.map +1 -1
  231. package/dist/esm/TimeMachine/Properties.stories.js +49 -4
  232. package/dist/esm/TimeMachine/Properties.stories.js.map +1 -1
  233. package/dist/esm/TimeMachine/ReadModelView.stories.d.ts +7 -7
  234. package/dist/esm/TimeMachine/ReadModelView.stories.d.ts.map +1 -1
  235. package/dist/esm/TimeMachine/ReadModelView.stories.js +79 -5
  236. package/dist/esm/TimeMachine/ReadModelView.stories.js.map +1 -1
  237. package/dist/esm/TimeMachine/TimeMachine.js +1 -1
  238. package/dist/esm/TimeMachine/TimeMachine.stories.d.ts +8 -7
  239. package/dist/esm/TimeMachine/TimeMachine.stories.d.ts.map +1 -1
  240. package/dist/esm/TimeMachine/TimeMachine.stories.js +113 -4
  241. package/dist/esm/TimeMachine/TimeMachine.stories.js.map +1 -1
  242. package/dist/esm/index.d.ts +7 -3
  243. package/dist/esm/index.d.ts.map +1 -1
  244. package/dist/esm/index.js +20 -12
  245. package/dist/esm/index.js.map +1 -1
  246. package/dist/esm/package.json +3 -0
  247. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  248. package/dist/esm/types/JsonSchema.d.ts +32 -0
  249. package/dist/esm/types/JsonSchema.d.ts.map +1 -0
  250. package/dist/esm/types/JsonSchema.js +2 -0
  251. package/dist/esm/types/JsonSchema.js.map +1 -0
  252. package/dist/esm/types/TypeFormat.d.ts +6 -0
  253. package/dist/esm/types/TypeFormat.d.ts.map +1 -0
  254. package/dist/esm/types/TypeFormat.js +18 -0
  255. package/dist/esm/types/TypeFormat.js.map +1 -0
  256. package/package.json +41 -78
  257. package/dist/cjs/CommandForm/CommandForm.js +0 -183
  258. package/dist/cjs/CommandForm/CommandForm.js.map +0 -1
  259. package/dist/cjs/CommandForm/CommandFormField.js +0 -11
  260. package/dist/cjs/CommandForm/CommandFormField.js.map +0 -1
  261. package/dist/cjs/CommandForm/CommandFormFields.js +0 -73
  262. package/dist/cjs/CommandForm/CommandFormFields.js.map +0 -1
  263. package/dist/cjs/CommandForm/ValidationMessage.js +0 -24
  264. package/dist/cjs/CommandForm/ValidationMessage.js.map +0 -1
  265. package/dist/cjs/CommandForm/asCommandFormField.js +0 -47
  266. package/dist/cjs/CommandForm/asCommandFormField.js.map +0 -1
  267. package/dist/esm/CommandForm/CommandForm.d.ts +0 -49
  268. package/dist/esm/CommandForm/CommandForm.d.ts.map +0 -1
  269. package/dist/esm/CommandForm/CommandForm.js +0 -178
  270. package/dist/esm/CommandForm/CommandForm.js.map +0 -1
  271. package/dist/esm/CommandForm/CommandForm.stories.d.ts +0 -8
  272. package/dist/esm/CommandForm/CommandForm.stories.d.ts.map +0 -1
  273. package/dist/esm/CommandForm/CommandForm.stories.js +0 -45
  274. package/dist/esm/CommandForm/CommandForm.stories.js.map +0 -1
  275. package/dist/esm/CommandForm/CommandFormField.d.ts +0 -18
  276. package/dist/esm/CommandForm/CommandFormField.d.ts.map +0 -1
  277. package/dist/esm/CommandForm/CommandFormField.js +0 -9
  278. package/dist/esm/CommandForm/CommandFormField.js.map +0 -1
  279. package/dist/esm/CommandForm/CommandFormFields.d.ts +0 -11
  280. package/dist/esm/CommandForm/CommandFormFields.d.ts.map +0 -1
  281. package/dist/esm/CommandForm/CommandFormFields.js +0 -71
  282. package/dist/esm/CommandForm/CommandFormFields.js.map +0 -1
  283. package/dist/esm/CommandForm/UserRegistrationCommand.d.ts +0 -63
  284. package/dist/esm/CommandForm/UserRegistrationCommand.d.ts.map +0 -1
  285. package/dist/esm/CommandForm/UserRegistrationCommand.js +0 -143
  286. package/dist/esm/CommandForm/UserRegistrationCommand.js.map +0 -1
  287. package/dist/esm/CommandForm/ValidationMessage.d.ts +0 -8
  288. package/dist/esm/CommandForm/ValidationMessage.d.ts.map +0 -1
  289. package/dist/esm/CommandForm/ValidationMessage.js +0 -22
  290. package/dist/esm/CommandForm/ValidationMessage.js.map +0 -1
  291. package/dist/esm/CommandForm/asCommandFormField.d.ts +0 -32
  292. package/dist/esm/CommandForm/asCommandFormField.d.ts.map +0 -1
  293. package/dist/esm/CommandForm/asCommandFormField.js +0 -45
  294. package/dist/esm/CommandForm/asCommandFormField.js.map +0 -1
@@ -1,63 +0,0 @@
1
- import { Command, CommandValidator } from '@cratis/arc/commands';
2
- import { SetCommandValues, ClearCommandValues } from '@cratis/arc.react/commands';
3
- import { PropertyDescriptor } from '@cratis/arc/reflection';
4
- import '@cratis/arc/validation';
5
- export interface IUserRegistrationCommand {
6
- username?: string;
7
- email?: string;
8
- password?: string;
9
- confirmPassword?: string;
10
- age?: number;
11
- bio?: string;
12
- favoriteColor?: string;
13
- birthDate?: string;
14
- agreeToTerms?: boolean;
15
- experienceLevel?: number;
16
- role?: string;
17
- }
18
- export declare class UserRegistrationCommandValidator extends CommandValidator<IUserRegistrationCommand> {
19
- constructor();
20
- }
21
- export declare class UserRegistrationCommand extends Command<IUserRegistrationCommand, object> implements IUserRegistrationCommand {
22
- readonly route: string;
23
- readonly validation: CommandValidator;
24
- readonly propertyDescriptors: PropertyDescriptor[];
25
- private _username;
26
- private _email;
27
- private _password;
28
- private _confirmPassword;
29
- private _age;
30
- private _bio;
31
- private _favoriteColor;
32
- private _birthDate;
33
- private _agreeToTerms;
34
- private _experienceLevel;
35
- private _role;
36
- constructor();
37
- get requestParameters(): string[];
38
- get properties(): string[];
39
- get username(): string;
40
- set username(value: string);
41
- get email(): string;
42
- set email(value: string);
43
- get password(): string;
44
- set password(value: string);
45
- get confirmPassword(): string;
46
- set confirmPassword(value: string);
47
- get age(): number;
48
- set age(value: number);
49
- get bio(): string;
50
- set bio(value: string);
51
- get favoriteColor(): string;
52
- set favoriteColor(value: string);
53
- get birthDate(): string;
54
- set birthDate(value: string);
55
- get agreeToTerms(): boolean;
56
- set agreeToTerms(value: boolean);
57
- get experienceLevel(): number;
58
- set experienceLevel(value: number);
59
- get role(): string;
60
- set role(value: string);
61
- static use(initialValues?: IUserRegistrationCommand): [UserRegistrationCommand, SetCommandValues<IUserRegistrationCommand>, ClearCommandValues];
62
- }
63
- //# sourceMappingURL=UserRegistrationCommand.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UserRegistrationCommand.d.ts","sourceRoot":"","sources":["../../../CommandForm/UserRegistrationCommand.ts"],"names":[],"mappings":"AAGA,OA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ator } from '@cratis/arc/commands';
2
- import { useCommand } from '@cratis/arc.react/commands';
3
- import { PropertyDescriptor } from '@cratis/arc/reflection';
4
- import '@cratis/arc/validation';
5
- export class UserRegistrationCommandValidator extends CommandValidator {
6
- constructor() {
7
- super();
8
- this.ruleFor(c => c.username).notEmpty().minLength(3).maxLength(20);
9
- this.ruleFor(c => c.email).notEmpty().emailAddress();
10
- this.ruleFor(c => c.password).notEmpty().minLength(8);
11
- this.ruleFor(c => c.age).greaterThanOrEqual(13).lessThanOrEqual(120);
12
- }
13
- }
14
- export class UserRegistrationCommand extends Command {
15
- route = '/api/users/register';
16
- validation = new UserRegistrationCommandValidator();
17
- propertyDescriptors = [
18
- new PropertyDescriptor('username', String),
19
- new PropertyDescriptor('email', String),
20
- new PropertyDescriptor('password', String),
21
- new PropertyDescriptor('confirmPassword', String),
22
- new PropertyDescriptor('age', Number),
23
- new PropertyDescriptor('bio', String),
24
- new PropertyDescriptor('favoriteColor', String),
25
- new PropertyDescriptor('birthDate', String),
26
- new PropertyDescriptor('agreeToTerms', Boolean),
27
- new PropertyDescriptor('experienceLevel', Number),
28
- new PropertyDescriptor('role', String),
29
- ];
30
- _username;
31
- _email;
32
- _password;
33
- _confirmPassword;
34
- _age;
35
- _bio;
36
- _favoriteColor;
37
- _birthDate;
38
- _agreeToTerms;
39
- _experienceLevel;
40
- _role;
41
- constructor() {
42
- super(Object, false);
43
- }
44
- get requestParameters() {
45
- return [];
46
- }
47
- get properties() {
48
- return [
49
- 'username',
50
- 'email',
51
- 'password',
52
- 'confirmPassword',
53
- 'age',
54
- 'bio',
55
- 'favoriteColor',
56
- 'birthDate',
57
- 'agreeToTerms',
58
- 'experienceLevel',
59
- 'role',
60
- ];
61
- }
62
- get username() {
63
- return this._username;
64
- }
65
- set username(value) {
66
- this._username = value;
67
- this.propertyChanged('username');
68
- }
69
- get email() {
70
- return this._email;
71
- }
72
- set email(value) {
73
- this._email = value;
74
- this.propertyChanged('email');
75
- }
76
- get password() {
77
- return this._password;
78
- }
79
- set password(value) {
80
- this._password = value;
81
- this.propertyChanged('password');
82
- }
83
- get confirmPassword() {
84
- return this._confirmPassword;
85
- }
86
- set confirmPassword(value) {
87
- this._confirmPassword = value;
88
- this.propertyChanged('confirmPassword');
89
- }
90
- get age() {
91
- return this._age;
92
- }
93
- set age(value) {
94
- this._age = value;
95
- this.propertyChanged('age');
96
- }
97
- get bio() {
98
- return this._bio;
99
- }
100
- set bio(value) {
101
- this._bio = value;
102
- this.propertyChanged('bio');
103
- }
104
- get favoriteColor() {
105
- return this._favoriteColor;
106
- }
107
- set favoriteColor(value) {
108
- this._favoriteColor = value;
109
- this.propertyChanged('favoriteColor');
110
- }
111
- get birthDate() {
112
- return this._birthDate;
113
- }
114
- set birthDate(value) {
115
- this._birthDate = value;
116
- this.propertyChanged('birthDate');
117
- }
118
- get agreeToTerms() {
119
- return this._agreeToTerms;
120
- }
121
- set agreeToTerms(value) {
122
- this._agreeToTerms = value;
123
- this.propertyChanged('agreeToTerms');
124
- }
125
- get experienceLevel() {
126
- return this._experienceLevel;
127
- }
128
- set experienceLevel(value) {
129
- this._experienceLevel = value;
130
- this.propertyChanged('experienceLevel');
131
- }
132
- get role() {
133
- return this._role;
134
- }
135
- set role(value) {
136
- this._role = value;
137
- this.propertyChanged('role');
138
- }
139
- static use(initialValues) {
140
- return useCommand(UserRegistrationCommand, initialValues);
141
- }
142
- }
143
- //# sourceMappingURL=UserRegistrationCommand.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UserRegistrationCommand.js","sourceRoot":"","sources":["../../../CommandForm/UserRegistrationCommand.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,UAAU,EAAwC,MAAM,4BAA4B,CAAC;AAC9F,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,wBAAwB,CAAC;AAgBhC,MAAM,OAAO,gCAAi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AC;IAED,IAAI,eAAe,CAAC,KAAa;QAC7B,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;QAC9B,IAAI,CAAC,eAAe,CAAC,iBAAiB,CAAC,CAAC;IAC5C,CAAC;IAED,IAAI,IAAI;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAED,IAAI,IAAI,CAAC,KAAa;QAClB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;IAED,MAAM,CAAC,GAAG,CAAC,aAAwC;QAC/C,OAAO,UAAU,CAAoD,uBAAuB,EAAE,aAAa,CAAC,CAAC;IACjH,CAAC;CACJ"}
@@ -1,8 +0,0 @@
1
- export interface ValidationMessageProps<TCommand> {
2
- value: (command: TCommand) => unknown;
3
- }
4
- export declare const ValidationMessage: {
5
- <TCommand>(props: ValidationMessageProps<TCommand>): import("react/jsx-runtime").JSX.Element | null;
6
- displayName: string;
7
- };
8
- //# sourceMappingURL=ValidationMessage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ValidationMessage.d.ts","sourceRoot":"","sources":["../../../CommandForm/ValidationMessage.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,sBAAsB,CAAC,QAAQ;IAC5C,KAAK,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC;CACzC;AAED,eAAO,MAAM,iBAAiB;KAAI,QAAQ,SAAU,sBAAsB,CAAC,QAAQ,CAAC;;CAqBnF,CAAC"}
@@ -1,22 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { useCommandFormContext } from './CommandForm.js';
3
-
4
- const ValidationMessage = (props) => {
5
- const context = useCommandFormContext();
6
- const propertyAccessor = props.value;
7
- const getPropertyName = (accessor) => {
8
- const fnStr = accessor.toString();
9
- const match = fnStr.match(/\.([a-zA-Z_$][a-zA-Z0-9_$]*)/);
10
- return match ? match[1] : '';
11
- };
12
- const propertyName = getPropertyName(propertyAccessor);
13
- const errorMessage = propertyName ? context.getFieldError(propertyName) : undefined;
14
- if (!errorMessage) {
15
- return null;
16
- }
17
- return (jsx("small", { className: "p-error block mt-1", children: errorMessage }));
18
- };
19
- ValidationMessage.displayName = 'ValidationMessage';
20
-
21
- export { ValidationMessage };
22
- //# sourceMappingURL=ValidationMessage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ValidationMessage.js","sources":["../../../CommandForm/ValidationMessage.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport React from 'react';\nimport { useCommandFormContext } from './CommandForm';\n\nexport interface ValidationMessageProps<TCommand> {\n value: (command: TCommand) => unknown;\n}\n\nexport const ValidationMessage = <TCommand,>(props: ValidationMessageProps<TCommand>) => {\n const context = useCommandFormContext<TCommand>();\n const propertyAccessor = props.value;\n \n // Get the property name from the accessor function\n const getPropertyName = (accessor: (obj: TCommand) => unknown): string => {\n const fnStr = accessor.toString();\n const match = fnStr.match(/\\.([a-zA-Z_$][a-zA-Z0-9_$]*)/);\n return match ? match[1] : '';\n };\n \n const propertyName = getPropertyName(propertyAccessor);\n const errorMessage = propertyName ? context.getFieldError(propertyName) : undefined;\n \n if (!errorMessage) {\n return null;\n }\n \n return (\n <small className=\"p-error block mt-1\">{errorMessage}</small>\n );\n};\n\nValidationMessage.displayName = 'ValidationMessage';\n"],"names":["_jsx"],"mappings":";;;AAUO,MAAM,iBAAiB,GAAG,CAAY,KAAuC,KAAI;AACpF,IAAA,MAAM,OAAO,GAAG,qBAAqB,EAAY;AACjD,IAAA,MAAM,gBAAgB,GAAG,KAAK,CAAC,KAAK;AAGpC,IAAA,MAAM,eAAe,GAAG,CAAC,QAAoC,KAAY;AACrE,QAAA,MAAM,KAAK,GAAG,QAAQ,CAAC,QAAQ,EAAE;QACjC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,8BAA8B,CAAC;AACzD,QAAA,OAAO,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE;AAChC,IAAA,CAAC;AAED,IAAA,MAAM,YAAY,GAAG,eAAe,CAAC,gBAAgB,CAAC;AACtD,IAAA,MAAM,YAAY,GAAG,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,GAAG,SAAS;IAEnF,IAAI,CAAC,YAAY,EAAE;AACf,QAAA,OAAO,IAAI;IACf;IAEA,QACIA,eAAO,SAAS,EAAC,oBAAoB,EAAA,QAAA,EAAE,YAAY,EAAA,CAAS;AAEpE;AAEA,iBAAiB,CAAC,WAAW,GAAG,mBAAmB;;;;"}
@@ -1,32 +0,0 @@
1
- import { PropertyAccessor } from '@cratis/fundamentals';
2
- import { PropertyDescriptor } from '@cratis/arc/reflection';
3
- import React, { ComponentType } from 'react';
4
- export interface InjectedCommandFormFieldProps {
5
- currentValue?: unknown;
6
- onValueChange?: (value: unknown) => void;
7
- propertyDescriptor?: PropertyDescriptor;
8
- fieldName?: string;
9
- }
10
- export interface BaseCommandFormFieldProps<TCommand> {
11
- icon?: React.ReactElement;
12
- value: PropertyAccessor<TCommand>;
13
- required?: boolean;
14
- title?: string;
15
- description?: string;
16
- }
17
- export interface CommandFormFieldConfig<TValue = unknown> {
18
- defaultValue: TValue;
19
- extractValue?: (event: unknown) => TValue;
20
- }
21
- export interface WrappedFieldProps<TValue = unknown> {
22
- value: TValue;
23
- onChange: (valueOrEvent: TValue | unknown) => void;
24
- invalid: boolean;
25
- required: boolean;
26
- errors: string[];
27
- }
28
- export declare function asCommandFormField<TComponentProps extends WrappedFieldProps<unknown>>(component: ComponentType<TComponentProps> | ((props: TComponentProps) => React.ReactElement), config: CommandFormFieldConfig<TComponentProps['value']>): {
29
- <TCommand>(props: Omit<TComponentProps, keyof WrappedFieldProps> & BaseCommandFormFieldProps<TCommand> & InjectedCommandFormFieldProps): import("react/jsx-runtime").JSX.Element;
30
- displayName: string;
31
- };
32
- //# sourceMappingUR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OAAO,CAAC,EACjF,SAAS,EAAE,aAAa,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,eAAe,KAAK,KAAK,CAAC,YAAY,CAAC,EAC5F,MAAM,EAAE,sBAAsB,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;KAOlC,QAAQ,SACnB,IAAI,CAAC,eAAe,EAAE,MAAM,iBAAiB,CAAC,GAC9C,yBAAyB,CAAC,QAAQ,CAAC,GACnC,6BAA6B;;EA+C3C"}
@@ -1,45 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { useState, useEffect } from 'react';
3
- import { useCommandFormContext } from './CommandForm.js';
4
-
5
- function asCommandFormField(component, config) {
6
- const { defaultValue, extractValue } = config;
7
- const Component = typeof component === 'function' && !component.prototype?.render
8
- ? component
9
- : component;
10
- const WrappedField = (props) => {
11
- const { currentValue, onValueChange, fieldName, required = true, ...componentProps } = props;
12
- const [localValue, setLocalValue] = useState(currentValue ?? defaultValue);
13
- const { getFieldError, customFieldErrors } = useCommandFormContext();
14
- const serverError = fieldName ? getFieldError(fieldName) : undefined;
15
- const customError = fieldName ? customFieldErrors[fieldName] : undefined;
16
- const errors = [];
17
- if (serverError)
18
- errors.push(serverError);
19
- if (customError)
20
- errors.push(customError);
21
- const isInvalid = errors.length > 0;
22
- useEffect(() => {
23
- setLocalValue(currentValue ?? defaultValue);
24
- }, [currentValue]);
25
- const handleChange = (valueOrEvent) => {
26
- const newValue = extractValue ? extractValue(valueOrEvent) : valueOrEvent;
27
- setLocalValue(newValue);
28
- onValueChange?.(newValue);
29
- };
30
- const wrappedProps = {
31
- ...componentProps,
32
- value: localValue,
33
- onChange: handleChange,
34
- invalid: isInvalid,
35
- required,
36
- errors
37
- };
38
- return jsx(Component, { ...wrappedProps });
39
- };
40
- WrappedField.displayName = 'CommandFormField';
41
- return WrappedField;
42
- }
43
-
44
- export { asCommandFormField };
45
- //# sourceMappingURL=asCommandFormField.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"asCommandFormField.js","sources":["../../../CommandForm/asCommandFormField.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { PropertyAccessor } from '@cratis/fundamentals';\nimport { PropertyDescriptor } from '@cratis/arc/reflection';\nimport React, { useState, useEffect, ComponentType } from 'react';\nimport { useCommandFormContext } from './CommandForm';\n\n/**\n * Props that will be injected by CommandFormFields into your wrapped component\n */\nexport interface InjectedCommandFormFieldProps {\n currentValue?: unknown;\n onValueChange?: (value: unknown) => void;\n propertyDescriptor?: PropertyDescriptor;\n fieldName?: string;\n}\n\n/**\n * Props that your field component should accept (excluding the injected ones)\n */\nexport interface BaseCommandFormFieldProps<TCommand> {\n icon?: React.ReactElement;\n value: PropertyAccessor<TCommand>;\n required?: boolean;\n title?: string;\n description?: string;\n}\n\n/**\n * Configuration for the field wrapper\n */\nexport interface CommandFormFieldConfig<TValue = unknown> {\n /** Default value when currentValue is undefined */\n defaultValue: TValue;\n /** Value extractor from the change event */\n extractValue?: (event: unknown) => TValue;\n}\n\n/**\n * Props that your wrapped component will receive\n */\nexport interface WrappedFieldProps<TValue = unknown> {\n value: TValue;\n onChange: (valueOrEvent: TValue | unknown) => void;\n invalid: boolean;\n required: boolean;\n errors: string[];\n}\n\n/**\n * Wraps a field component to work with CommandForm, handling all integration automatically.\n * \n * @example\n * ```typescript\n * interface MyInputProps extends WrappedFieldProps<string> {\n * placeholder?: string;\n * }\n * \n * export const MyInputField = asCommandFormField<MyInputProps>(\n * (props) => (\n * <div>\n * <input\n * value={props.value}\n * onChange={props.onChange}\n * placeholder={props.placeholder}\n * className={props.invalid ? 'invalid' : ''}\n * />\n * {props.errors.length > 0 && (\n * <div className=\"error-messages\">\n * {props.errors.map((error, idx) => (\n * <small key={idx} className=\"p-error\">{error}</small>\n * ))}\n * </div>\n * )}\n * </div>\n * ),\n * {\n * defaultValue: '',\n * extractValue: (e) => e.target.value\n * }\n * );\n * ```\n */\nexport function asCommandFormField<TComponentProps extends WrappedFieldProps<unknown>>(\n component: ComponentType<TComponentProps> | ((props: TComponentProps) => React.ReactElement),\n config: CommandFormFieldConfig<TComponentProps['value']>\n) {\n const { defaultValue, extractValue } = config;\n const Component = typeof component === 'function' && !component.prototype?.render \n ? component \n : component as ComponentType<TComponentProps>;\n\n const WrappedField = <TCommand,>(\n props: Omit<TComponentProps, keyof WrappedFieldProps> & \n BaseCommandFormFieldProps<TCommand> & \n InjectedCommandFormFieldProps\n ) => {\n const { \n currentValue, \n onValueChange, \n fieldName, \n required = true,\n ...componentProps \n } = props;\n\n const [localValue, setLocalValue] = useState(currentValue ?? defaultValue);\n const { getFieldError, customFieldErrors } = useCommandFormContext();\n\n const serverError = fieldName ? getFieldError(fieldName) : undefined;\n const customError = fieldName ? customFieldErrors[fieldName] : undefined;\n \n const errors: string[] = [];\n if (serverError) errors.push(serverError);\n if (customError) errors.push(customError);\n\n const isInvalid = errors.length > 0;\n\n useEffect(() => {\n setLocalValue(currentValue ?? defaultValue);\n }, [currentValue]);\n\n const handleChange = (valueOrEvent: unknown) => {\n const newValue = extractValue ? extractValue(valueOrEvent) : valueOrEvent;\n setLocalValue(newValue);\n onValueChange?.(newValue);\n };\n\n const wrappedProps = {\n ...componentProps,\n value: localValue,\n onChange: handleChange,\n invalid: isInvalid,\n required,\n errors\n } as TComponentProps;\n\n return <Component {...wrappedProps} />;\n };\n\n WrappedField.displayName = 'CommandFormField';\n\n return WrappedField;\n}\n"],"names":["_jsx"],"mappings":";;;;AAoFM,SAAU,kBAAkB,CAC9B,SAA4F,EAC5F,MAAwD,EAAA;AAExD,IAAA,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,GAAG,MAAM;AAC7C,IAAA,MAAM,SAAS,GAAG,OAAO,SAAS,KAAK,UAAU,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE;AACvE,UAAE;UACA,SAA2C;AAEjD,IAAA,MAAM,YAAY,GAAG,CACjB,KAEoC,KAC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