@dwidge/json-forms-expo 0.0.2

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 (301) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +30 -0
  3. package/dist/cjs/FileAttachment/AttachmentEdit.js +14 -0
  4. package/dist/cjs/FileAttachment/AttachmentEdit.js.map +1 -0
  5. package/dist/cjs/FileAttachment/AttachmentListEdit.js +21 -0
  6. package/dist/cjs/FileAttachment/AttachmentListEdit.js.map +1 -0
  7. package/dist/cjs/FileAttachment/AttachmentListView.js +13 -0
  8. package/dist/cjs/FileAttachment/AttachmentListView.js.map +1 -0
  9. package/dist/cjs/FileAttachment/AttachmentScreen.js +14 -0
  10. package/dist/cjs/FileAttachment/AttachmentScreen.js.map +1 -0
  11. package/dist/cjs/FileAttachment/AttachmentView.js +14 -0
  12. package/dist/cjs/FileAttachment/AttachmentView.js.map +1 -0
  13. package/dist/cjs/FileAttachment/index.js +24 -0
  14. package/dist/cjs/FileAttachment/index.js.map +1 -0
  15. package/dist/cjs/FileAttachment/useFileAttachmentUrl.js +12 -0
  16. package/dist/cjs/FileAttachment/useFileAttachmentUrl.js.map +1 -0
  17. package/dist/cjs/FileAttachment/useFileUrl.js +11 -0
  18. package/dist/cjs/FileAttachment/useFileUrl.js.map +1 -0
  19. package/dist/cjs/Form/EditFormAttachmentScreen.js +61 -0
  20. package/dist/cjs/Form/EditFormAttachmentScreen.js.map +1 -0
  21. package/dist/cjs/Form/FormEdit.js +12 -0
  22. package/dist/cjs/Form/FormEdit.js.map +1 -0
  23. package/dist/cjs/Form/FormEditScreen.js +29 -0
  24. package/dist/cjs/Form/FormEditScreen.js.map +1 -0
  25. package/dist/cjs/Form/FormListEdit.js +22 -0
  26. package/dist/cjs/Form/FormListEdit.js.map +1 -0
  27. package/dist/cjs/Form/FormListScreen.js +28 -0
  28. package/dist/cjs/Form/FormListScreen.js.map +1 -0
  29. package/dist/cjs/Form/FormListView.js +18 -0
  30. package/dist/cjs/Form/FormListView.js.map +1 -0
  31. package/dist/cjs/Form/FormSelectScreen.js +21 -0
  32. package/dist/cjs/Form/FormSelectScreen.js.map +1 -0
  33. package/dist/cjs/Form/FormSelectView.js +16 -0
  34. package/dist/cjs/Form/FormSelectView.js.map +1 -0
  35. package/dist/cjs/Form/FormView.js +12 -0
  36. package/dist/cjs/Form/FormView.js.map +1 -0
  37. package/dist/cjs/Form/index.js +26 -0
  38. package/dist/cjs/Form/index.js.map +1 -0
  39. package/dist/cjs/FormAttachment/FormAttachmentEdit.js +30 -0
  40. package/dist/cjs/FormAttachment/FormAttachmentEdit.js.map +1 -0
  41. package/dist/cjs/FormAttachment/FormAttachmentEditScreen.js +15 -0
  42. package/dist/cjs/FormAttachment/FormAttachmentEditScreen.js.map +1 -0
  43. package/dist/cjs/FormAttachment/FormAttachmentListEdit.js +27 -0
  44. package/dist/cjs/FormAttachment/FormAttachmentListEdit.js.map +1 -0
  45. package/dist/cjs/FormAttachment/FormAttachmentListScreen.js +31 -0
  46. package/dist/cjs/FormAttachment/FormAttachmentListScreen.js.map +1 -0
  47. package/dist/cjs/FormAttachment/FormAttachmentListView.js +21 -0
  48. package/dist/cjs/FormAttachment/FormAttachmentListView.js.map +1 -0
  49. package/dist/cjs/FormAttachment/FormAttachmentView.js +15 -0
  50. package/dist/cjs/FormAttachment/FormAttachmentView.js.map +1 -0
  51. package/dist/cjs/FormAttachment/index.js +23 -0
  52. package/dist/cjs/FormAttachment/index.js.map +1 -0
  53. package/dist/cjs/hooks/FileApi.js +15 -0
  54. package/dist/cjs/hooks/FileApi.js.map +1 -0
  55. package/dist/cjs/hooks/FileAttachmentApi.js +13 -0
  56. package/dist/cjs/hooks/FileAttachmentApi.js.map +1 -0
  57. package/dist/cjs/hooks/FormApi.js +13 -0
  58. package/dist/cjs/hooks/FormApi.js.map +1 -0
  59. package/dist/cjs/hooks/FormAttachmentApi.js +12 -0
  60. package/dist/cjs/hooks/FormAttachmentApi.js.map +1 -0
  61. package/dist/cjs/hooks/FormsContext.js +30 -0
  62. package/dist/cjs/hooks/FormsContext.js.map +1 -0
  63. package/dist/cjs/hooks/createApi.js +40 -0
  64. package/dist/cjs/hooks/createApi.js.map +1 -0
  65. package/dist/cjs/hooks/index.js +27 -0
  66. package/dist/cjs/hooks/index.js.map +1 -0
  67. package/dist/cjs/hooks/useCreateBlankAttachment.js +21 -0
  68. package/dist/cjs/hooks/useCreateBlankAttachment.js.map +1 -0
  69. package/dist/cjs/hooks/useCreateBlankForm.js +12 -0
  70. package/dist/cjs/hooks/useCreateBlankForm.js.map +1 -0
  71. package/dist/cjs/hooks/useCreateBlankFormAttachment.js +14 -0
  72. package/dist/cjs/hooks/useCreateBlankFormAttachment.js.map +1 -0
  73. package/dist/cjs/hooks/useParams.js +8 -0
  74. package/dist/cjs/hooks/useParams.js.map +1 -0
  75. package/dist/cjs/index.js +22 -0
  76. package/dist/cjs/index.js.map +1 -0
  77. package/dist/cjs/package.json +3 -0
  78. package/dist/cjs/types/File2.js +3 -0
  79. package/dist/cjs/types/File2.js.map +1 -0
  80. package/dist/cjs/types/FileAttachment.js +3 -0
  81. package/dist/cjs/types/FileAttachment.js.map +1 -0
  82. package/dist/cjs/types/Form1.js +3 -0
  83. package/dist/cjs/types/Form1.js.map +1 -0
  84. package/dist/cjs/types/FormAttachment.js +3 -0
  85. package/dist/cjs/types/FormAttachment.js.map +1 -0
  86. package/dist/cjs/types/index.js +21 -0
  87. package/dist/cjs/types/index.js.map +1 -0
  88. package/dist/esm/FileAttachment/AttachmentEdit.js +10 -0
  89. package/dist/esm/FileAttachment/AttachmentEdit.js.map +1 -0
  90. package/dist/esm/FileAttachment/AttachmentListEdit.js +14 -0
  91. package/dist/esm/FileAttachment/AttachmentListEdit.js.map +1 -0
  92. package/dist/esm/FileAttachment/AttachmentListView.js +9 -0
  93. package/dist/esm/FileAttachment/AttachmentListView.js.map +1 -0
  94. package/dist/esm/FileAttachment/AttachmentScreen.js +10 -0
  95. package/dist/esm/FileAttachment/AttachmentScreen.js.map +1 -0
  96. package/dist/esm/FileAttachment/AttachmentView.js +10 -0
  97. package/dist/esm/FileAttachment/AttachmentView.js.map +1 -0
  98. package/dist/esm/FileAttachment/index.js +8 -0
  99. package/dist/esm/FileAttachment/index.js.map +1 -0
  100. package/dist/esm/FileAttachment/useFileAttachmentUrl.js +8 -0
  101. package/dist/esm/FileAttachment/useFileAttachmentUrl.js.map +1 -0
  102. package/dist/esm/FileAttachment/useFileUrl.js +7 -0
  103. package/dist/esm/FileAttachment/useFileUrl.js.map +1 -0
  104. package/dist/esm/Form/EditFormAttachmentScreen.js +57 -0
  105. package/dist/esm/Form/EditFormAttachmentScreen.js.map +1 -0
  106. package/dist/esm/Form/FormEdit.js +8 -0
  107. package/dist/esm/Form/FormEdit.js.map +1 -0
  108. package/dist/esm/Form/FormEditScreen.js +25 -0
  109. package/dist/esm/Form/FormEditScreen.js.map +1 -0
  110. package/dist/esm/Form/FormListEdit.js +15 -0
  111. package/dist/esm/Form/FormListEdit.js.map +1 -0
  112. package/dist/esm/Form/FormListScreen.js +24 -0
  113. package/dist/esm/Form/FormListScreen.js.map +1 -0
  114. package/dist/esm/Form/FormListView.js +11 -0
  115. package/dist/esm/Form/FormListView.js.map +1 -0
  116. package/dist/esm/Form/FormSelectScreen.js +17 -0
  117. package/dist/esm/Form/FormSelectScreen.js.map +1 -0
  118. package/dist/esm/Form/FormSelectView.js +12 -0
  119. package/dist/esm/Form/FormSelectView.js.map +1 -0
  120. package/dist/esm/Form/FormView.js +8 -0
  121. package/dist/esm/Form/FormView.js.map +1 -0
  122. package/dist/esm/Form/index.js +10 -0
  123. package/dist/esm/Form/index.js.map +1 -0
  124. package/dist/esm/FormAttachment/FormAttachmentEdit.js +26 -0
  125. package/dist/esm/FormAttachment/FormAttachmentEdit.js.map +1 -0
  126. package/dist/esm/FormAttachment/FormAttachmentEditScreen.js +11 -0
  127. package/dist/esm/FormAttachment/FormAttachmentEditScreen.js.map +1 -0
  128. package/dist/esm/FormAttachment/FormAttachmentListEdit.js +20 -0
  129. package/dist/esm/FormAttachment/FormAttachmentListEdit.js.map +1 -0
  130. package/dist/esm/FormAttachment/FormAttachmentListScreen.js +27 -0
  131. package/dist/esm/FormAttachment/FormAttachmentListScreen.js.map +1 -0
  132. package/dist/esm/FormAttachment/FormAttachmentListView.js +14 -0
  133. package/dist/esm/FormAttachment/FormAttachmentListView.js.map +1 -0
  134. package/dist/esm/FormAttachment/FormAttachmentView.js +11 -0
  135. package/dist/esm/FormAttachment/FormAttachmentView.js.map +1 -0
  136. package/dist/esm/FormAttachment/index.js +7 -0
  137. package/dist/esm/FormAttachment/index.js.map +1 -0
  138. package/dist/esm/hooks/FileApi.js +12 -0
  139. package/dist/esm/hooks/FileApi.js.map +1 -0
  140. package/dist/esm/hooks/FileAttachmentApi.js +10 -0
  141. package/dist/esm/hooks/FileAttachmentApi.js.map +1 -0
  142. package/dist/esm/hooks/FormApi.js +10 -0
  143. package/dist/esm/hooks/FormApi.js.map +1 -0
  144. package/dist/esm/hooks/FormAttachmentApi.js +9 -0
  145. package/dist/esm/hooks/FormAttachmentApi.js.map +1 -0
  146. package/dist/esm/hooks/FormsContext.js +26 -0
  147. package/dist/esm/hooks/FormsContext.js.map +1 -0
  148. package/dist/esm/hooks/createApi.js +36 -0
  149. package/dist/esm/hooks/createApi.js.map +1 -0
  150. package/dist/esm/hooks/index.js +11 -0
  151. package/dist/esm/hooks/index.js.map +1 -0
  152. package/dist/esm/hooks/useCreateBlankAttachment.js +14 -0
  153. package/dist/esm/hooks/useCreateBlankAttachment.js.map +1 -0
  154. package/dist/esm/hooks/useCreateBlankForm.js +8 -0
  155. package/dist/esm/hooks/useCreateBlankForm.js.map +1 -0
  156. package/dist/esm/hooks/useCreateBlankFormAttachment.js +10 -0
  157. package/dist/esm/hooks/useCreateBlankFormAttachment.js.map +1 -0
  158. package/dist/esm/hooks/useParams.js +4 -0
  159. package/dist/esm/hooks/useParams.js.map +1 -0
  160. package/dist/esm/index.js +6 -0
  161. package/dist/esm/index.js.map +1 -0
  162. package/dist/esm/package.json +3 -0
  163. package/dist/esm/types/File2.js +2 -0
  164. package/dist/esm/types/File2.js.map +1 -0
  165. package/dist/esm/types/FileAttachment.js +2 -0
  166. package/dist/esm/types/FileAttachment.js.map +1 -0
  167. package/dist/esm/types/Form1.js +2 -0
  168. package/dist/esm/types/Form1.js.map +1 -0
  169. package/dist/esm/types/FormAttachment.js +2 -0
  170. package/dist/esm/types/FormAttachment.js.map +1 -0
  171. package/dist/esm/types/index.js +5 -0
  172. package/dist/esm/types/index.js.map +1 -0
  173. package/dist/tsconfig.cjs.tsbuildinfo +1 -0
  174. package/dist/tsconfig.tsbuildinfo +1 -0
  175. package/dist/types/FileAttachment/AttachmentEdit.d.ts +6 -0
  176. package/dist/types/FileAttachment/AttachmentEdit.d.ts.map +1 -0
  177. package/dist/types/FileAttachment/AttachmentListEdit.d.ts +9 -0
  178. package/dist/types/FileAttachment/AttachmentListEdit.d.ts.map +1 -0
  179. package/dist/types/FileAttachment/AttachmentListView.d.ts +9 -0
  180. package/dist/types/FileAttachment/AttachmentListView.d.ts.map +1 -0
  181. package/dist/types/FileAttachment/AttachmentScreen.d.ts +8 -0
  182. package/dist/types/FileAttachment/AttachmentScreen.d.ts.map +1 -0
  183. package/dist/types/FileAttachment/AttachmentView.d.ts +6 -0
  184. package/dist/types/FileAttachment/AttachmentView.d.ts.map +1 -0
  185. package/dist/types/FileAttachment/index.d.ts +8 -0
  186. package/dist/types/FileAttachment/index.d.ts.map +1 -0
  187. package/dist/types/FileAttachment/useFileAttachmentUrl.d.ts +2 -0
  188. package/dist/types/FileAttachment/useFileAttachmentUrl.d.ts.map +1 -0
  189. package/dist/types/FileAttachment/useFileUrl.d.ts +2 -0
  190. package/dist/types/FileAttachment/useFileUrl.d.ts.map +1 -0
  191. package/dist/types/Form/EditFormAttachmentScreen.d.ts +40 -0
  192. package/dist/types/Form/EditFormAttachmentScreen.d.ts.map +1 -0
  193. package/dist/types/Form/FormEdit.d.ts +4 -0
  194. package/dist/types/Form/FormEdit.d.ts.map +1 -0
  195. package/dist/types/Form/FormEditScreen.d.ts +4 -0
  196. package/dist/types/Form/FormEditScreen.d.ts.map +1 -0
  197. package/dist/types/Form/FormListEdit.d.ts +6 -0
  198. package/dist/types/Form/FormListEdit.d.ts.map +1 -0
  199. package/dist/types/Form/FormListScreen.d.ts +8 -0
  200. package/dist/types/Form/FormListScreen.d.ts.map +1 -0
  201. package/dist/types/Form/FormListView.d.ts +5 -0
  202. package/dist/types/Form/FormListView.d.ts.map +1 -0
  203. package/dist/types/Form/FormSelectScreen.d.ts +6 -0
  204. package/dist/types/Form/FormSelectScreen.d.ts.map +1 -0
  205. package/dist/types/Form/FormSelectView.d.ts +8 -0
  206. package/dist/types/Form/FormSelectView.d.ts.map +1 -0
  207. package/dist/types/Form/FormView.d.ts +5 -0
  208. package/dist/types/Form/FormView.d.ts.map +1 -0
  209. package/dist/types/Form/index.d.ts +10 -0
  210. package/dist/types/Form/index.d.ts.map +1 -0
  211. package/dist/types/FormAttachment/FormAttachmentEdit.d.ts +9 -0
  212. package/dist/types/FormAttachment/FormAttachmentEdit.d.ts.map +1 -0
  213. package/dist/types/FormAttachment/FormAttachmentEditScreen.d.ts +5 -0
  214. package/dist/types/FormAttachment/FormAttachmentEditScreen.d.ts.map +1 -0
  215. package/dist/types/FormAttachment/FormAttachmentListEdit.d.ts +11 -0
  216. package/dist/types/FormAttachment/FormAttachmentListEdit.d.ts.map +1 -0
  217. package/dist/types/FormAttachment/FormAttachmentListScreen.d.ts +7 -0
  218. package/dist/types/FormAttachment/FormAttachmentListScreen.d.ts.map +1 -0
  219. package/dist/types/FormAttachment/FormAttachmentListView.d.ts +5 -0
  220. package/dist/types/FormAttachment/FormAttachmentListView.d.ts.map +1 -0
  221. package/dist/types/FormAttachment/FormAttachmentView.d.ts +6 -0
  222. package/dist/types/FormAttachment/FormAttachmentView.d.ts.map +1 -0
  223. package/dist/types/FormAttachment/index.d.ts +7 -0
  224. package/dist/types/FormAttachment/index.d.ts.map +1 -0
  225. package/dist/types/hooks/FileApi.d.ts +35 -0
  226. package/dist/types/hooks/FileApi.d.ts.map +1 -0
  227. package/dist/types/hooks/FileAttachmentApi.d.ts +35 -0
  228. package/dist/types/hooks/FileAttachmentApi.d.ts.map +1 -0
  229. package/dist/types/hooks/FormApi.d.ts +35 -0
  230. package/dist/types/hooks/FormApi.d.ts.map +1 -0
  231. package/dist/types/hooks/FormAttachmentApi.d.ts +35 -0
  232. package/dist/types/hooks/FormAttachmentApi.d.ts.map +1 -0
  233. package/dist/types/hooks/FormsContext.d.ts +20 -0
  234. package/dist/types/hooks/FormsContext.d.ts.map +1 -0
  235. package/dist/types/hooks/createApi.d.ts +36 -0
  236. package/dist/types/hooks/createApi.d.ts.map +1 -0
  237. package/dist/types/hooks/index.d.ts +11 -0
  238. package/dist/types/hooks/index.d.ts.map +1 -0
  239. package/dist/types/hooks/useCreateBlankAttachment.d.ts +10 -0
  240. package/dist/types/hooks/useCreateBlankAttachment.d.ts.map +1 -0
  241. package/dist/types/hooks/useCreateBlankForm.d.ts +6 -0
  242. package/dist/types/hooks/useCreateBlankForm.d.ts.map +1 -0
  243. package/dist/types/hooks/useCreateBlankFormAttachment.d.ts +13 -0
  244. package/dist/types/hooks/useCreateBlankFormAttachment.d.ts.map +1 -0
  245. package/dist/types/hooks/useParams.d.ts +7 -0
  246. package/dist/types/hooks/useParams.d.ts.map +1 -0
  247. package/dist/types/index.d.ts +6 -0
  248. package/dist/types/index.d.ts.map +1 -0
  249. package/dist/types/types/File2.d.ts +16 -0
  250. package/dist/types/types/File2.d.ts.map +1 -0
  251. package/dist/types/types/FileAttachment.d.ts +10 -0
  252. package/dist/types/types/FileAttachment.d.ts.map +1 -0
  253. package/dist/types/types/Form1.d.ts +14 -0
  254. package/dist/types/types/Form1.d.ts.map +1 -0
  255. package/dist/types/types/FormAttachment.d.ts +13 -0
  256. package/dist/types/types/FormAttachment.d.ts.map +1 -0
  257. package/dist/types/types/index.d.ts +5 -0
  258. package/dist/types/types/index.d.ts.map +1 -0
  259. package/package.json +73 -0
  260. package/src/FileAttachment/AttachmentEdit.tsx +14 -0
  261. package/src/FileAttachment/AttachmentListEdit.tsx +45 -0
  262. package/src/FileAttachment/AttachmentListView.tsx +12 -0
  263. package/src/FileAttachment/AttachmentScreen.tsx +21 -0
  264. package/src/FileAttachment/AttachmentView.tsx +14 -0
  265. package/src/FileAttachment/index.ts +7 -0
  266. package/src/FileAttachment/useFileAttachmentUrl.ts +15 -0
  267. package/src/FileAttachment/useFileUrl.ts +12 -0
  268. package/src/Form/EditFormAttachmentScreen.tsx +101 -0
  269. package/src/Form/FormEdit.tsx +15 -0
  270. package/src/Form/FormEditScreen.tsx +54 -0
  271. package/src/Form/FormListEdit.tsx +32 -0
  272. package/src/Form/FormListScreen.tsx +54 -0
  273. package/src/Form/FormListView.tsx +23 -0
  274. package/src/Form/FormSelectScreen.tsx +49 -0
  275. package/src/Form/FormSelectView.tsx +31 -0
  276. package/src/Form/FormView.tsx +11 -0
  277. package/src/Form/index.ts +9 -0
  278. package/src/FormAttachment/FormAttachmentEdit.tsx +72 -0
  279. package/src/FormAttachment/FormAttachmentEditScreen.tsx +21 -0
  280. package/src/FormAttachment/FormAttachmentListEdit.tsx +40 -0
  281. package/src/FormAttachment/FormAttachmentListScreen.tsx +62 -0
  282. package/src/FormAttachment/FormAttachmentListView.tsx +30 -0
  283. package/src/FormAttachment/FormAttachmentView.tsx +25 -0
  284. package/src/FormAttachment/index.ts +6 -0
  285. package/src/hooks/FileApi.ts +13 -0
  286. package/src/hooks/FileAttachmentApi.ts +11 -0
  287. package/src/hooks/FormApi.ts +11 -0
  288. package/src/hooks/FormAttachmentApi.ts +10 -0
  289. package/src/hooks/FormsContext.ts +29 -0
  290. package/src/hooks/createApi.ts +65 -0
  291. package/src/hooks/index.ts +10 -0
  292. package/src/hooks/useCreateBlankAttachment.ts +24 -0
  293. package/src/hooks/useCreateBlankForm.ts +12 -0
  294. package/src/hooks/useCreateBlankFormAttachment.ts +20 -0
  295. package/src/hooks/useParams.ts +9 -0
  296. package/src/index.ts +5 -0
  297. package/src/types/File2.ts +19 -0
  298. package/src/types/FileAttachment.ts +9 -0
  299. package/src/types/Form1.ts +17 -0
  300. package/src/types/FormAttachment.ts +19 -0
  301. package/src/types/index.ts +4 -0
@@ -0,0 +1,10 @@
1
+ export declare const useCreateBlankAttachment: ({ createAttachmentList, createFileList, AttachIds, }?: {
2
+ createAttachmentList?: ((list: Omit<Partial<import("..").FileAttachment>, "createdAt" | "createdBy">[]) => Promise<(Partial<import("..").FileAttachment> | null)[]>) | undefined;
3
+ createFileList?: ((list: Omit<Partial<import("..").File2>, "createdAt" | "createdBy">[]) => Promise<(Partial<import("..").File2> | null)[]>) | undefined;
4
+ AttachIds?: (import("./useParams").Params & {
5
+ AttachmentId?: string | null | undefined;
6
+ FormId?: string | null | undefined;
7
+ FormAttachmentId?: string | null | undefined;
8
+ }) | undefined;
9
+ }) => (() => Promise<Partial<import("..").FileAttachment> | null>) | undefined;
10
+ //# sourceMappingURL=useCreateBlankAttachment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCreateBlankAttachment.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCreateBlankAttachment.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,wBAAwB;;;;;;;;8EAkBtB,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const useCreateBlankForm: ({ createFormList, }?: {
2
+ createFormList?: ((list: Omit<Partial<import("..").Form1>, "createdAt" | "createdBy">[]) => Promise<(Partial<import("..").Form1> | null)[]>) | undefined;
3
+ }) => (() => Promise<{
4
+ FormId: string | undefined;
5
+ }>) | (() => undefined);
6
+ //# sourceMappingURL=useCreateBlankForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCreateBlankForm.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCreateBlankForm.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,kBAAkB;;;;uBAKV,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { Form1Key } from "../types/Form1";
2
+ export declare const useCreateBlankFormAttachment: ({ createFormList, createAttachmentList, AttachmentIds, }?: {
3
+ createFormList?: ((list: Omit<Partial<import("../types/Form1").Form1>, "createdAt" | "createdBy">[]) => Promise<(Partial<import("../types/Form1").Form1> | null)[]>) | undefined;
4
+ createAttachmentList?: ((list: Omit<Partial<import("..").FormAttachment1>, "createdAt" | "createdBy">[]) => Promise<(Partial<import("..").FormAttachment1> | null)[]>) | undefined;
5
+ AttachmentIds?: (import("./useParams").Params & {
6
+ AttachmentId?: string | null | undefined;
7
+ FormId?: string | null | undefined;
8
+ FormAttachmentId?: string | null | undefined;
9
+ }) | undefined;
10
+ }) => ((forms: Form1Key[]) => Promise<{
11
+ FormAttachmentId: string | undefined;
12
+ }>) | (() => Promise<undefined>);
13
+ //# sourceMappingURL=useCreateBlankFormAttachment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCreateBlankFormAttachment.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCreateBlankFormAttachment.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAK1C,eAAO,MAAM,4BAA4B;;;;;;;;eAMrB,QAAQ,EAAE;;gCAIH,CAAC"}
@@ -0,0 +1,7 @@
1
+ export type Params = Record<string, string | number | null | undefined>;
2
+ export declare const useParams: () => Params & {
3
+ AttachmentId?: string | null | undefined;
4
+ FormId?: string | null | undefined;
5
+ FormAttachmentId?: string | null | undefined;
6
+ };
7
+ //# sourceMappingURL=useParams.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useParams.d.ts","sourceRoot":"","sources":["../../../src/hooks/useParams.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;AACxE,eAAO,MAAM,SAAS,QAAO,MAAM,GAAG;IACpC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACnC,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACN,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from "./FileAttachment";
2
+ export * from "./Form";
3
+ export * from "./FormAttachment";
4
+ export * from "./hooks";
5
+ export * from "./types";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,QAAQ,CAAC;AACvB,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
@@ -0,0 +1,16 @@
1
+ export type File2 = {
2
+ id: string;
3
+ created: boolean;
4
+ createdAt: number;
5
+ createdBy: number | null;
6
+ size: number | null;
7
+ mime: string | null;
8
+ sha256: string | null;
9
+ getUrl: string | null;
10
+ putUrl: string | null;
11
+ };
12
+ export type File2Get = Partial<File2>;
13
+ export type File2Set = Omit<File2Get, "createdAt" | "createdBy">;
14
+ export type File2Key = Pick<File2Get, "id">;
15
+ export type File2Filter = File2Get;
16
+ //# sourceMappingURL=File2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"File2.d.ts","sourceRoot":"","sources":["../../../src/types/File2.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AAEtC,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,WAAW,GAAG,WAAW,CAAC,CAAC;AAEjE,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAE5C,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC"}
@@ -0,0 +1,10 @@
1
+ export type FileAttachment = {
2
+ id: string;
3
+ created: boolean;
4
+ createdAt: number;
5
+ createdBy: number | null;
6
+ FileId: string | null;
7
+ FormId: string | null;
8
+ FormAttachmentId: string | null;
9
+ };
10
+ //# sourceMappingURL=FileAttachment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileAttachment.d.ts","sourceRoot":"","sources":["../../../src/types/FileAttachment.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC,CAAC"}
@@ -0,0 +1,14 @@
1
+ export type Form1 = {
2
+ id: string;
3
+ created: boolean;
4
+ createdAt: number;
5
+ createdBy: number | null;
6
+ name: string | null;
7
+ type: string | null;
8
+ schema: string | null;
9
+ };
10
+ export type Form1Get = Partial<Form1>;
11
+ export type Form1Set = Omit<Form1Get, "createdAt" | "createdBy">;
12
+ export type Form1Key = Pick<Form1Get, "id">;
13
+ export type Form1Filter = Form1Get;
14
+ //# sourceMappingURL=Form1.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Form1.d.ts","sourceRoot":"","sources":["../../../src/types/Form1.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AAEtC,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,WAAW,GAAG,WAAW,CAAC,CAAC;AAEjE,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAE5C,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC"}
@@ -0,0 +1,13 @@
1
+ export type FormAttachment1 = {
2
+ id: string;
3
+ created: boolean;
4
+ createdAt: number;
5
+ createdBy: number | null;
6
+ FormId: string | null;
7
+ data: string | null;
8
+ };
9
+ export type FormAttachment1Get = Partial<FormAttachment1>;
10
+ export type FormAttachment1Set = Omit<FormAttachment1Get, "createdAt" | "createdBy">;
11
+ export type FormAttachment1Key = Pick<FormAttachment1Get, "id">;
12
+ export type FormAttachment1Filter = FormAttachment1Get;
13
+ //# sourceMappingURL=FormAttachment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormAttachment.d.ts","sourceRoot":"","sources":["../../../src/types/FormAttachment.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAE1D,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,kBAAkB,EAClB,WAAW,GAAG,WAAW,CAC1B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC;AAEhE,MAAM,MAAM,qBAAqB,GAAG,kBAAkB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from "./File2";
2
+ export * from "./FileAttachment";
3
+ export * from "./Form1";
4
+ export * from "./FormAttachment";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,73 @@
1
+ {
2
+ "name": "@dwidge/json-forms-expo",
3
+ "version": "0.0.2",
4
+ "description": "Editor for Json Forms.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/dwidge/json-forms-expo.git"
8
+ },
9
+ "main": "./dist/cjs/index.js",
10
+ "module": "./dist/esm/index.js",
11
+ "types": "./dist/types/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "require": "./dist/cjs/index.js",
15
+ "import": "./dist/esm/index.js",
16
+ "types": "./dist/types/index.d.ts"
17
+ }
18
+ },
19
+ "files": [
20
+ "dist",
21
+ "src"
22
+ ],
23
+ "peerDependencies": {
24
+ "@dwidge/class-name-rnw": "^0.0.3",
25
+ "@dwidge/fallback-rnw": "^0.0.2",
26
+ "@dwidge/json-forms-paper": "^0.0.6",
27
+ "@dwidge/trace-js": "^0.0.8",
28
+ "@dwidge/axios-interceptor": "^0.0.2",
29
+ "@dwidge/components-expo": "^0.0.11",
30
+ "@dwidge/components-rnw": "^0.0.7",
31
+ "@dwidge/crud-api-react": "^0.0.10",
32
+ "@dwidge/hooks-expo": "^0.0.6",
33
+ "@dwidge/hooks-react": "^0.0.4",
34
+ "@dwidge/json-forms-designer": "^0.0.5",
35
+ "@dwidge/json-schema-form-rnw": "^0.0.6",
36
+ "@dwidge/query-axios-zod": "^0.0.13",
37
+ "@dwidge/react-native-web-webview": "^0.0.4",
38
+ "@dwidge/utils-js": "^0.0.11",
39
+ "@dwidge/wmdb-expo": "^0.0.4",
40
+ "@dwidge/wmdb-expo-web": "^0.0.4",
41
+ "@jsonforms/core": "^3.4.0",
42
+ "@jsonforms/react": "^3.4.0",
43
+ "@rneui/base": "4.0.0-rc.7",
44
+ "@rneui/themed": "^4.0.0-rc.8",
45
+ "ajv": "^8.17.1",
46
+ "assert": "^2.1.0",
47
+ "lodash": "^4.17.21",
48
+ "react": "^18.2.0",
49
+ "react-native": "^0.74.5",
50
+ "react-native-error-boundary": "^1.2.5",
51
+ "react-native-paper": "^5.12.5",
52
+ "react-native-web": "^0.19.12",
53
+ "ts-deepmerge": "^6.2.0",
54
+ "zod": "^3.23.8"
55
+ },
56
+ "devDependencies": {
57
+ "@types/node": "^22.7.5",
58
+ "expect": "^29.7.0",
59
+ "ncp": "^2.0.0",
60
+ "prettier": "^3.3.3",
61
+ "rimraf": "^6.0.1",
62
+ "typescript": "^5.6.3"
63
+ },
64
+ "publishConfig": {
65
+ "access": "public"
66
+ },
67
+ "engines": {
68
+ "node": ">=20"
69
+ },
70
+ "scripts": {
71
+ "test": "node --enable-source-maps --test --test-name-pattern"
72
+ }
73
+ }
@@ -0,0 +1,14 @@
1
+ // Copyright DWJ 2024.
2
+ // Distributed under the Boost Software License, Version 1.0.
3
+ // https://www.boost.org/LICENSE_1_0.txt
4
+
5
+ import { FileEdit } from "@dwidge/components-expo";
6
+ import { FileApi } from "../hooks/FileApi";
7
+ import { FileAttachmentApi } from "../hooks/FileAttachmentApi";
8
+ import { useParams } from "../hooks/useParams";
9
+
10
+ export const AttachmentEdit = ({
11
+ id = useParams().AttachmentId,
12
+ attachment: [attachment] = FileAttachmentApi.useItem(id),
13
+ file: [file, setFile] = FileApi.useItem(attachment?.FileId),
14
+ }) => <FileEdit file={[file, setFile]} />;
@@ -0,0 +1,45 @@
1
+ // Copyright DWJ 2024.
2
+ // Distributed under the Boost Software License, Version 1.0.
3
+ // https://www.boost.org/LICENSE_1_0.txt
4
+
5
+ import {
6
+ StyledButton,
7
+ StyledView,
8
+ UnstyledList,
9
+ viewStyles,
10
+ } from "@dwidge/components-rnw";
11
+ import assert from "assert";
12
+ import { useState } from "react";
13
+ import { FileAttachmentApi } from "../hooks/FileAttachmentApi";
14
+ import { useCreateBlankAttachment } from "../hooks/useCreateBlankAttachment";
15
+ import { Params, useParams } from "../hooks/useParams";
16
+ import { AttachmentEdit } from "./AttachmentEdit";
17
+
18
+ export const AttachmentListEdit = ({
19
+ ids = useParams() as Params,
20
+ elements = FileAttachmentApi.useGetList(ids),
21
+ selection: [selection, setSelection] = useState<string[]>([]),
22
+ onCreateAttachment = useCreateBlankAttachment({ AttachIds: ids }),
23
+ onDeleteAttachmentList = FileAttachmentApi.useDeleteList(),
24
+ }) => (
25
+ <StyledView column>
26
+ <UnstyledList
27
+ items={elements}
28
+ keyExtractor={(item) => (assert(item.id), item.id)}
29
+ selection={[selection, setSelection]}
30
+ render={(item) => <AttachmentEdit id={item.id} />}
31
+ selectStyle={viewStyles.select}
32
+ style={viewStyles.unselect}
33
+ />
34
+ <StyledView row gap center middle>
35
+ <StyledButton icon="add" onPress={onCreateAttachment} />
36
+ <StyledButton
37
+ icon="remove"
38
+ onPress={
39
+ onDeleteAttachmentList &&
40
+ (() => onDeleteAttachmentList(selection.map((id) => ({ id }))))
41
+ }
42
+ />
43
+ </StyledView>
44
+ </StyledView>
45
+ );
@@ -0,0 +1,12 @@
1
+ // Copyright DWJ 2024.
2
+ // Distributed under the Boost Software License, Version 1.0.
3
+ // https://www.boost.org/LICENSE_1_0.txt
4
+
5
+ import { FileAttachmentApi } from "../hooks/FileAttachmentApi";
6
+ import { useParams } from "../hooks/useParams";
7
+ import { AttachmentView } from "./AttachmentView";
8
+
9
+ export const AttachmentListView = ({
10
+ ids = useParams(),
11
+ attachments = FileAttachmentApi.useGetList(ids),
12
+ }) => attachments?.map((a) => <AttachmentView key={a.id} id={a.id} />);
@@ -0,0 +1,21 @@
1
+ // Copyright DWJ 2024.
2
+ // Distributed under the Boost Software License, Version 1.0.
3
+ // https://www.boost.org/LICENSE_1_0.txt
4
+
5
+ import { StyledHeader } from "@dwidge/components-expo";
6
+ import { ScreenView, ScrollView, StyledView } from "@dwidge/components-rnw";
7
+ import { useParams } from "../hooks/useParams";
8
+ import { AttachmentListEdit } from "./AttachmentListEdit";
9
+
10
+ export const AttachmentScreen = ({ ids = useParams() }) => (
11
+ <ScreenView>
12
+ <StyledHeader title="Attachments" />
13
+ <ScrollView gap pad>
14
+ <StyledView flex column>
15
+ <StyledView>
16
+ <AttachmentListEdit ids={ids} />
17
+ </StyledView>
18
+ </StyledView>
19
+ </ScrollView>
20
+ </ScreenView>
21
+ );
@@ -0,0 +1,14 @@
1
+ // Copyright DWJ 2024.
2
+ // Distributed under the Boost Software License, Version 1.0.
3
+ // https://www.boost.org/LICENSE_1_0.txt
4
+
5
+ import { useIdStringParam } from "@dwidge/hooks-expo";
6
+ import { FileView } from "@dwidge/components-expo";
7
+ import { FileAttachmentApi } from "../hooks/FileAttachmentApi";
8
+ import { FileApi } from "../hooks/FileApi";
9
+
10
+ export const AttachmentView = ({
11
+ id = useIdStringParam(),
12
+ attachment: [attachment] = FileAttachmentApi.useItem(id),
13
+ file: [file, setFile] = FileApi.useItem(attachment?.FileId),
14
+ }) => <FileView file={[file, setFile]} />;
@@ -0,0 +1,7 @@
1
+ export * from "./AttachmentEdit";
2
+ export * from "./AttachmentListEdit";
3
+ export * from "./AttachmentListView";
4
+ export * from "./AttachmentScreen";
5
+ export * from "./AttachmentView";
6
+ export * from "./useFileAttachmentUrl";
7
+ export * from "./useFileUrl";
@@ -0,0 +1,15 @@
1
+ // Copyright DWJ 2024.
2
+ // Distributed under the Boost Software License, Version 1.0.
3
+ // https://www.boost.org/LICENSE_1_0.txt
4
+
5
+ import { FileApi } from "../hooks/FileApi";
6
+ import { FileAttachmentApi } from "../hooks/FileAttachmentApi";
7
+
8
+ export const useFileAttachmentUrl = (
9
+ attachmentId?: string,
10
+ ): string | null | undefined => useFileAttachmentUrlInternal(attachmentId);
11
+ const useFileAttachmentUrlInternal = (
12
+ attachmentId?: string,
13
+ attachment = FileAttachmentApi.useGetItem(attachmentId),
14
+ file = FileApi.useGetItem(attachment?.FileId),
15
+ ) => file?.getUrl;
@@ -0,0 +1,12 @@
1
+ // Copyright DWJ 2024.
2
+ // Distributed under the Boost Software License, Version 1.0.
3
+ // https://www.boost.org/LICENSE_1_0.txt
4
+
5
+ import { FileApi } from "../hooks/FileApi";
6
+
7
+ export const useFileUrl = (fileId?: string): string | null | undefined =>
8
+ useFileUrlInternal(fileId);
9
+ const useFileUrlInternal = (
10
+ fileId?: string,
11
+ file = FileApi.useGetItem(fileId),
12
+ ) => file?.getUrl;
@@ -0,0 +1,101 @@
1
+ // Copyright DWJ 2024.
2
+ // Distributed under the Boost Software License, Version 1.0.
3
+ // https://www.boost.org/LICENSE_1_0.txt
4
+
5
+ import { StyledHeader } from "@dwidge/components-expo";
6
+ import {
7
+ CenterView,
8
+ ScreenView,
9
+ ScrollView,
10
+ StyledText,
11
+ } from "@dwidge/components-rnw";
12
+ import { JSONSchemaForm } from "@dwidge/json-schema-form-rnw";
13
+ import * as Ajv from "ajv";
14
+ import { useState } from "react";
15
+ import { z } from "zod";
16
+
17
+ const useFormId = () => "123";
18
+ const useForm = (id?: string) =>
19
+ useState<Form | null | undefined>({
20
+ title: "untitled",
21
+ fields: [],
22
+ });
23
+
24
+ type FieldType = "string" | "number" | "boolean";
25
+
26
+ type Form = {
27
+ title: string;
28
+ fields: {
29
+ type: FieldType;
30
+ title: string;
31
+ required: boolean;
32
+ }[];
33
+ };
34
+
35
+ const formSchema: Ajv.JSONSchemaType<Form> = {
36
+ type: "object",
37
+ properties: {
38
+ title: {
39
+ type: "string",
40
+ title: "Name",
41
+ },
42
+ fields: {
43
+ type: "array",
44
+ title: "Fields",
45
+ items: {
46
+ type: "object",
47
+ properties: {
48
+ title: {
49
+ type: "string",
50
+ title: "Name",
51
+ },
52
+ type: {
53
+ type: "string",
54
+ enum: ["string", "number", "boolean"],
55
+ title: "Type",
56
+ },
57
+ required: {
58
+ type: "boolean",
59
+ title: "Required",
60
+ },
61
+ },
62
+ required: ["title", "type", "required"],
63
+ },
64
+ },
65
+ },
66
+ required: ["title", "fields"],
67
+ };
68
+
69
+ const JsonFormSchema = z.object({
70
+ jsonSchema: z.string(),
71
+ uiSchema: z.string(),
72
+ });
73
+
74
+ const Form = z.object({
75
+ id: z.string(),
76
+ schema: JsonFormSchema,
77
+ });
78
+
79
+ export const EditFormAttachmentScreen = ({
80
+ form: [form, setForm] = useForm(useFormId()),
81
+ }) => (
82
+ <ScreenView>
83
+ <StyledHeader title="Edit Form" />
84
+ {form == null || !form ? (
85
+ <CenterView>
86
+ <StyledText>
87
+ {form === null ? "The form does not exist." : "Loading..."}
88
+ </StyledText>
89
+ </CenterView>
90
+ ) : (
91
+ <ScrollView flex gap wide pad selfcenter>
92
+ <JSONSchemaForm
93
+ name="FormSchema"
94
+ schema={formSchema}
95
+ value={form}
96
+ onChange={setForm}
97
+ />
98
+ </ScrollView>
99
+ )}
100
+ </ScreenView>
101
+ );
@@ -0,0 +1,15 @@
1
+ // Copyright DWJ 2024.
2
+ // Distributed under the Boost Software License, Version 1.0.
3
+ // https://www.boost.org/LICENSE_1_0.txt
4
+
5
+ import { StyledLoader, StyledText, StyledView } from "@dwidge/components-rnw";
6
+ import { FormApi } from "../hooks/FormApi";
7
+
8
+ export const FormCard = ({ form = FormApi.useGetItem() }) =>
9
+ form ? (
10
+ <StyledView flex card row>
11
+ <StyledText>{form.name ?? "untitled"}</StyledText>
12
+ </StyledView>
13
+ ) : (
14
+ <StyledLoader />
15
+ );
@@ -0,0 +1,54 @@
1
+ // Copyright DWJ 2024.
2
+ // Distributed under the Boost Software License, Version 1.0.
3
+ // https://www.boost.org/LICENSE_1_0.txt
4
+
5
+ import { StyledHeader } from "@dwidge/components-expo";
6
+ import {
7
+ CenterView,
8
+ ScreenView,
9
+ ScrollView,
10
+ StyledText,
11
+ } from "@dwidge/components-rnw";
12
+ import {
13
+ defaultFormSchemaString,
14
+ FormDesigner,
15
+ FormSchema,
16
+ } from "@dwidge/json-forms-designer";
17
+ import { FormApi } from "../hooks/FormApi";
18
+ import { useParams } from "../hooks/useParams";
19
+
20
+ export const FormEditScreen = ({
21
+ form: [form, setForm] = FormApi.useItem(useParams().FormId),
22
+ }) => (
23
+ <ScreenView>
24
+ <StyledHeader title={["Form", form?.name].filter(Boolean).join(" - ")} />
25
+ {form == null || !form ? (
26
+ <CenterView>
27
+ <StyledText>
28
+ {form === null ? "The form does not exist." : "Loading..."}
29
+ </StyledText>
30
+ </CenterView>
31
+ ) : (
32
+ <ScrollView flex gap wide pad selfcenter>
33
+ <FormDesigner
34
+ schemaString={[
35
+ form.schema ?? defaultFormSchemaString,
36
+ setForm &&
37
+ ((updater) => {
38
+ const next =
39
+ typeof updater === "function"
40
+ ? updater(form.schema ?? defaultFormSchemaString)
41
+ : updater;
42
+ const parsed = FormSchema.parse(JSON.parse(next));
43
+ setForm?.((prev) => ({
44
+ ...prev,
45
+ name: parsed.schema.title,
46
+ schema: next,
47
+ }));
48
+ }),
49
+ ]}
50
+ />
51
+ </ScrollView>
52
+ )}
53
+ </ScreenView>
54
+ );
@@ -0,0 +1,32 @@
1
+ // Copyright DWJ 2024.
2
+ // Distributed under the Boost Software License, Version 1.0.
3
+ // https://www.boost.org/LICENSE_1_0.txt
4
+
5
+ import { UnstyledList, viewStyles } from "@dwidge/components-rnw";
6
+ import { useNavAction2 } from "@dwidge/hooks-expo";
7
+ import assert from "assert";
8
+ import { useState } from "react";
9
+ import { FormApi } from "../hooks/FormApi";
10
+ import { useNavRoutes } from "../hooks/FormsContext";
11
+ import { FormCard } from "./FormEdit";
12
+
13
+ export const FormListEdit = ({
14
+ elements = FormApi.useGetList(),
15
+ selection: [selection, setSelection] = useState<string[]>([]),
16
+ onPress = useNavAction2(
17
+ useNavRoutes().FORM_EDIT_SCREEN,
18
+ async (id: string) => ({
19
+ FormId: id,
20
+ }),
21
+ ),
22
+ }) => (
23
+ <UnstyledList
24
+ items={elements}
25
+ keyExtractor={(item) => (assert(item.id), item.id)}
26
+ selection={[selection, setSelection]}
27
+ render={(item) => <FormCard form={item} />}
28
+ selectStyle={viewStyles.select}
29
+ style={viewStyles.unselect}
30
+ onPress={onPress}
31
+ />
32
+ );
@@ -0,0 +1,54 @@
1
+ // Copyright DWJ 2024.
2
+ // Distributed under the Boost Software License, Version 1.0.
3
+ // https://www.boost.org/LICENSE_1_0.txt
4
+
5
+ import { StyledHeader } from "@dwidge/components-expo";
6
+ import {
7
+ CenterView,
8
+ ScreenView,
9
+ ScrollView,
10
+ StyledFontAwesome,
11
+ StyledView,
12
+ } from "@dwidge/components-rnw";
13
+ import { useMemoState } from "@dwidge/hooks-react";
14
+ import { TouchableOpacity } from "react-native";
15
+ import { FormApi } from "../hooks/FormApi";
16
+ import { FormListEdit } from "./FormListEdit";
17
+ import { useCreateBlankForm } from "../hooks/useCreateBlankForm";
18
+
19
+ export const FormListScreen = ({
20
+ onCreate = useCreateBlankForm(),
21
+ onDeleteList = FormApi.useDeleteList(),
22
+ selection = useMemoState<string[]>([]),
23
+ }) => (
24
+ <ScreenView>
25
+ <StyledHeader
26
+ title="Forms"
27
+ actions={[
28
+ {
29
+ icon: "remove-circle",
30
+ onPress:
31
+ onDeleteList && selection[0].length
32
+ ? () => onDeleteList(selection[0].map((id) => ({ id })))
33
+ : undefined,
34
+ },
35
+ {
36
+ icon: "add-circle",
37
+ onPress: onCreate,
38
+ },
39
+ ]}
40
+ />
41
+ <ScrollView gap pad>
42
+ <StyledView flex column>
43
+ <StyledView>
44
+ <FormListEdit selection={selection} />
45
+ </StyledView>
46
+ <TouchableOpacity style={{ flex: 1 }} onPress={onCreate}>
47
+ <CenterView row gap>
48
+ <StyledFontAwesome name="plus" size={30} />
49
+ </CenterView>
50
+ </TouchableOpacity>
51
+ </StyledView>
52
+ </ScrollView>
53
+ </ScreenView>
54
+ );