@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.
- package/LICENSE +23 -0
- package/README.md +30 -0
- package/dist/cjs/FileAttachment/AttachmentEdit.js +14 -0
- package/dist/cjs/FileAttachment/AttachmentEdit.js.map +1 -0
- package/dist/cjs/FileAttachment/AttachmentListEdit.js +21 -0
- package/dist/cjs/FileAttachment/AttachmentListEdit.js.map +1 -0
- package/dist/cjs/FileAttachment/AttachmentListView.js +13 -0
- package/dist/cjs/FileAttachment/AttachmentListView.js.map +1 -0
- package/dist/cjs/FileAttachment/AttachmentScreen.js +14 -0
- package/dist/cjs/FileAttachment/AttachmentScreen.js.map +1 -0
- package/dist/cjs/FileAttachment/AttachmentView.js +14 -0
- package/dist/cjs/FileAttachment/AttachmentView.js.map +1 -0
- package/dist/cjs/FileAttachment/index.js +24 -0
- package/dist/cjs/FileAttachment/index.js.map +1 -0
- package/dist/cjs/FileAttachment/useFileAttachmentUrl.js +12 -0
- package/dist/cjs/FileAttachment/useFileAttachmentUrl.js.map +1 -0
- package/dist/cjs/FileAttachment/useFileUrl.js +11 -0
- package/dist/cjs/FileAttachment/useFileUrl.js.map +1 -0
- package/dist/cjs/Form/EditFormAttachmentScreen.js +61 -0
- package/dist/cjs/Form/EditFormAttachmentScreen.js.map +1 -0
- package/dist/cjs/Form/FormEdit.js +12 -0
- package/dist/cjs/Form/FormEdit.js.map +1 -0
- package/dist/cjs/Form/FormEditScreen.js +29 -0
- package/dist/cjs/Form/FormEditScreen.js.map +1 -0
- package/dist/cjs/Form/FormListEdit.js +22 -0
- package/dist/cjs/Form/FormListEdit.js.map +1 -0
- package/dist/cjs/Form/FormListScreen.js +28 -0
- package/dist/cjs/Form/FormListScreen.js.map +1 -0
- package/dist/cjs/Form/FormListView.js +18 -0
- package/dist/cjs/Form/FormListView.js.map +1 -0
- package/dist/cjs/Form/FormSelectScreen.js +21 -0
- package/dist/cjs/Form/FormSelectScreen.js.map +1 -0
- package/dist/cjs/Form/FormSelectView.js +16 -0
- package/dist/cjs/Form/FormSelectView.js.map +1 -0
- package/dist/cjs/Form/FormView.js +12 -0
- package/dist/cjs/Form/FormView.js.map +1 -0
- package/dist/cjs/Form/index.js +26 -0
- package/dist/cjs/Form/index.js.map +1 -0
- package/dist/cjs/FormAttachment/FormAttachmentEdit.js +30 -0
- package/dist/cjs/FormAttachment/FormAttachmentEdit.js.map +1 -0
- package/dist/cjs/FormAttachment/FormAttachmentEditScreen.js +15 -0
- package/dist/cjs/FormAttachment/FormAttachmentEditScreen.js.map +1 -0
- package/dist/cjs/FormAttachment/FormAttachmentListEdit.js +27 -0
- package/dist/cjs/FormAttachment/FormAttachmentListEdit.js.map +1 -0
- package/dist/cjs/FormAttachment/FormAttachmentListScreen.js +31 -0
- package/dist/cjs/FormAttachment/FormAttachmentListScreen.js.map +1 -0
- package/dist/cjs/FormAttachment/FormAttachmentListView.js +21 -0
- package/dist/cjs/FormAttachment/FormAttachmentListView.js.map +1 -0
- package/dist/cjs/FormAttachment/FormAttachmentView.js +15 -0
- package/dist/cjs/FormAttachment/FormAttachmentView.js.map +1 -0
- package/dist/cjs/FormAttachment/index.js +23 -0
- package/dist/cjs/FormAttachment/index.js.map +1 -0
- package/dist/cjs/hooks/FileApi.js +15 -0
- package/dist/cjs/hooks/FileApi.js.map +1 -0
- package/dist/cjs/hooks/FileAttachmentApi.js +13 -0
- package/dist/cjs/hooks/FileAttachmentApi.js.map +1 -0
- package/dist/cjs/hooks/FormApi.js +13 -0
- package/dist/cjs/hooks/FormApi.js.map +1 -0
- package/dist/cjs/hooks/FormAttachmentApi.js +12 -0
- package/dist/cjs/hooks/FormAttachmentApi.js.map +1 -0
- package/dist/cjs/hooks/FormsContext.js +30 -0
- package/dist/cjs/hooks/FormsContext.js.map +1 -0
- package/dist/cjs/hooks/createApi.js +40 -0
- package/dist/cjs/hooks/createApi.js.map +1 -0
- package/dist/cjs/hooks/index.js +27 -0
- package/dist/cjs/hooks/index.js.map +1 -0
- package/dist/cjs/hooks/useCreateBlankAttachment.js +21 -0
- package/dist/cjs/hooks/useCreateBlankAttachment.js.map +1 -0
- package/dist/cjs/hooks/useCreateBlankForm.js +12 -0
- package/dist/cjs/hooks/useCreateBlankForm.js.map +1 -0
- package/dist/cjs/hooks/useCreateBlankFormAttachment.js +14 -0
- package/dist/cjs/hooks/useCreateBlankFormAttachment.js.map +1 -0
- package/dist/cjs/hooks/useParams.js +8 -0
- package/dist/cjs/hooks/useParams.js.map +1 -0
- package/dist/cjs/index.js +22 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/types/File2.js +3 -0
- package/dist/cjs/types/File2.js.map +1 -0
- package/dist/cjs/types/FileAttachment.js +3 -0
- package/dist/cjs/types/FileAttachment.js.map +1 -0
- package/dist/cjs/types/Form1.js +3 -0
- package/dist/cjs/types/Form1.js.map +1 -0
- package/dist/cjs/types/FormAttachment.js +3 -0
- package/dist/cjs/types/FormAttachment.js.map +1 -0
- package/dist/cjs/types/index.js +21 -0
- package/dist/cjs/types/index.js.map +1 -0
- package/dist/esm/FileAttachment/AttachmentEdit.js +10 -0
- package/dist/esm/FileAttachment/AttachmentEdit.js.map +1 -0
- package/dist/esm/FileAttachment/AttachmentListEdit.js +14 -0
- package/dist/esm/FileAttachment/AttachmentListEdit.js.map +1 -0
- package/dist/esm/FileAttachment/AttachmentListView.js +9 -0
- package/dist/esm/FileAttachment/AttachmentListView.js.map +1 -0
- package/dist/esm/FileAttachment/AttachmentScreen.js +10 -0
- package/dist/esm/FileAttachment/AttachmentScreen.js.map +1 -0
- package/dist/esm/FileAttachment/AttachmentView.js +10 -0
- package/dist/esm/FileAttachment/AttachmentView.js.map +1 -0
- package/dist/esm/FileAttachment/index.js +8 -0
- package/dist/esm/FileAttachment/index.js.map +1 -0
- package/dist/esm/FileAttachment/useFileAttachmentUrl.js +8 -0
- package/dist/esm/FileAttachment/useFileAttachmentUrl.js.map +1 -0
- package/dist/esm/FileAttachment/useFileUrl.js +7 -0
- package/dist/esm/FileAttachment/useFileUrl.js.map +1 -0
- package/dist/esm/Form/EditFormAttachmentScreen.js +57 -0
- package/dist/esm/Form/EditFormAttachmentScreen.js.map +1 -0
- package/dist/esm/Form/FormEdit.js +8 -0
- package/dist/esm/Form/FormEdit.js.map +1 -0
- package/dist/esm/Form/FormEditScreen.js +25 -0
- package/dist/esm/Form/FormEditScreen.js.map +1 -0
- package/dist/esm/Form/FormListEdit.js +15 -0
- package/dist/esm/Form/FormListEdit.js.map +1 -0
- package/dist/esm/Form/FormListScreen.js +24 -0
- package/dist/esm/Form/FormListScreen.js.map +1 -0
- package/dist/esm/Form/FormListView.js +11 -0
- package/dist/esm/Form/FormListView.js.map +1 -0
- package/dist/esm/Form/FormSelectScreen.js +17 -0
- package/dist/esm/Form/FormSelectScreen.js.map +1 -0
- package/dist/esm/Form/FormSelectView.js +12 -0
- package/dist/esm/Form/FormSelectView.js.map +1 -0
- package/dist/esm/Form/FormView.js +8 -0
- package/dist/esm/Form/FormView.js.map +1 -0
- package/dist/esm/Form/index.js +10 -0
- package/dist/esm/Form/index.js.map +1 -0
- package/dist/esm/FormAttachment/FormAttachmentEdit.js +26 -0
- package/dist/esm/FormAttachment/FormAttachmentEdit.js.map +1 -0
- package/dist/esm/FormAttachment/FormAttachmentEditScreen.js +11 -0
- package/dist/esm/FormAttachment/FormAttachmentEditScreen.js.map +1 -0
- package/dist/esm/FormAttachment/FormAttachmentListEdit.js +20 -0
- package/dist/esm/FormAttachment/FormAttachmentListEdit.js.map +1 -0
- package/dist/esm/FormAttachment/FormAttachmentListScreen.js +27 -0
- package/dist/esm/FormAttachment/FormAttachmentListScreen.js.map +1 -0
- package/dist/esm/FormAttachment/FormAttachmentListView.js +14 -0
- package/dist/esm/FormAttachment/FormAttachmentListView.js.map +1 -0
- package/dist/esm/FormAttachment/FormAttachmentView.js +11 -0
- package/dist/esm/FormAttachment/FormAttachmentView.js.map +1 -0
- package/dist/esm/FormAttachment/index.js +7 -0
- package/dist/esm/FormAttachment/index.js.map +1 -0
- package/dist/esm/hooks/FileApi.js +12 -0
- package/dist/esm/hooks/FileApi.js.map +1 -0
- package/dist/esm/hooks/FileAttachmentApi.js +10 -0
- package/dist/esm/hooks/FileAttachmentApi.js.map +1 -0
- package/dist/esm/hooks/FormApi.js +10 -0
- package/dist/esm/hooks/FormApi.js.map +1 -0
- package/dist/esm/hooks/FormAttachmentApi.js +9 -0
- package/dist/esm/hooks/FormAttachmentApi.js.map +1 -0
- package/dist/esm/hooks/FormsContext.js +26 -0
- package/dist/esm/hooks/FormsContext.js.map +1 -0
- package/dist/esm/hooks/createApi.js +36 -0
- package/dist/esm/hooks/createApi.js.map +1 -0
- package/dist/esm/hooks/index.js +11 -0
- package/dist/esm/hooks/index.js.map +1 -0
- package/dist/esm/hooks/useCreateBlankAttachment.js +14 -0
- package/dist/esm/hooks/useCreateBlankAttachment.js.map +1 -0
- package/dist/esm/hooks/useCreateBlankForm.js +8 -0
- package/dist/esm/hooks/useCreateBlankForm.js.map +1 -0
- package/dist/esm/hooks/useCreateBlankFormAttachment.js +10 -0
- package/dist/esm/hooks/useCreateBlankFormAttachment.js.map +1 -0
- package/dist/esm/hooks/useParams.js +4 -0
- package/dist/esm/hooks/useParams.js.map +1 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/types/File2.js +2 -0
- package/dist/esm/types/File2.js.map +1 -0
- package/dist/esm/types/FileAttachment.js +2 -0
- package/dist/esm/types/FileAttachment.js.map +1 -0
- package/dist/esm/types/Form1.js +2 -0
- package/dist/esm/types/Form1.js.map +1 -0
- package/dist/esm/types/FormAttachment.js +2 -0
- package/dist/esm/types/FormAttachment.js.map +1 -0
- package/dist/esm/types/index.js +5 -0
- package/dist/esm/types/index.js.map +1 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/FileAttachment/AttachmentEdit.d.ts +6 -0
- package/dist/types/FileAttachment/AttachmentEdit.d.ts.map +1 -0
- package/dist/types/FileAttachment/AttachmentListEdit.d.ts +9 -0
- package/dist/types/FileAttachment/AttachmentListEdit.d.ts.map +1 -0
- package/dist/types/FileAttachment/AttachmentListView.d.ts +9 -0
- package/dist/types/FileAttachment/AttachmentListView.d.ts.map +1 -0
- package/dist/types/FileAttachment/AttachmentScreen.d.ts +8 -0
- package/dist/types/FileAttachment/AttachmentScreen.d.ts.map +1 -0
- package/dist/types/FileAttachment/AttachmentView.d.ts +6 -0
- package/dist/types/FileAttachment/AttachmentView.d.ts.map +1 -0
- package/dist/types/FileAttachment/index.d.ts +8 -0
- package/dist/types/FileAttachment/index.d.ts.map +1 -0
- package/dist/types/FileAttachment/useFileAttachmentUrl.d.ts +2 -0
- package/dist/types/FileAttachment/useFileAttachmentUrl.d.ts.map +1 -0
- package/dist/types/FileAttachment/useFileUrl.d.ts +2 -0
- package/dist/types/FileAttachment/useFileUrl.d.ts.map +1 -0
- package/dist/types/Form/EditFormAttachmentScreen.d.ts +40 -0
- package/dist/types/Form/EditFormAttachmentScreen.d.ts.map +1 -0
- package/dist/types/Form/FormEdit.d.ts +4 -0
- package/dist/types/Form/FormEdit.d.ts.map +1 -0
- package/dist/types/Form/FormEditScreen.d.ts +4 -0
- package/dist/types/Form/FormEditScreen.d.ts.map +1 -0
- package/dist/types/Form/FormListEdit.d.ts +6 -0
- package/dist/types/Form/FormListEdit.d.ts.map +1 -0
- package/dist/types/Form/FormListScreen.d.ts +8 -0
- package/dist/types/Form/FormListScreen.d.ts.map +1 -0
- package/dist/types/Form/FormListView.d.ts +5 -0
- package/dist/types/Form/FormListView.d.ts.map +1 -0
- package/dist/types/Form/FormSelectScreen.d.ts +6 -0
- package/dist/types/Form/FormSelectScreen.d.ts.map +1 -0
- package/dist/types/Form/FormSelectView.d.ts +8 -0
- package/dist/types/Form/FormSelectView.d.ts.map +1 -0
- package/dist/types/Form/FormView.d.ts +5 -0
- package/dist/types/Form/FormView.d.ts.map +1 -0
- package/dist/types/Form/index.d.ts +10 -0
- package/dist/types/Form/index.d.ts.map +1 -0
- package/dist/types/FormAttachment/FormAttachmentEdit.d.ts +9 -0
- package/dist/types/FormAttachment/FormAttachmentEdit.d.ts.map +1 -0
- package/dist/types/FormAttachment/FormAttachmentEditScreen.d.ts +5 -0
- package/dist/types/FormAttachment/FormAttachmentEditScreen.d.ts.map +1 -0
- package/dist/types/FormAttachment/FormAttachmentListEdit.d.ts +11 -0
- package/dist/types/FormAttachment/FormAttachmentListEdit.d.ts.map +1 -0
- package/dist/types/FormAttachment/FormAttachmentListScreen.d.ts +7 -0
- package/dist/types/FormAttachment/FormAttachmentListScreen.d.ts.map +1 -0
- package/dist/types/FormAttachment/FormAttachmentListView.d.ts +5 -0
- package/dist/types/FormAttachment/FormAttachmentListView.d.ts.map +1 -0
- package/dist/types/FormAttachment/FormAttachmentView.d.ts +6 -0
- package/dist/types/FormAttachment/FormAttachmentView.d.ts.map +1 -0
- package/dist/types/FormAttachment/index.d.ts +7 -0
- package/dist/types/FormAttachment/index.d.ts.map +1 -0
- package/dist/types/hooks/FileApi.d.ts +35 -0
- package/dist/types/hooks/FileApi.d.ts.map +1 -0
- package/dist/types/hooks/FileAttachmentApi.d.ts +35 -0
- package/dist/types/hooks/FileAttachmentApi.d.ts.map +1 -0
- package/dist/types/hooks/FormApi.d.ts +35 -0
- package/dist/types/hooks/FormApi.d.ts.map +1 -0
- package/dist/types/hooks/FormAttachmentApi.d.ts +35 -0
- package/dist/types/hooks/FormAttachmentApi.d.ts.map +1 -0
- package/dist/types/hooks/FormsContext.d.ts +20 -0
- package/dist/types/hooks/FormsContext.d.ts.map +1 -0
- package/dist/types/hooks/createApi.d.ts +36 -0
- package/dist/types/hooks/createApi.d.ts.map +1 -0
- package/dist/types/hooks/index.d.ts +11 -0
- package/dist/types/hooks/index.d.ts.map +1 -0
- package/dist/types/hooks/useCreateBlankAttachment.d.ts +10 -0
- package/dist/types/hooks/useCreateBlankAttachment.d.ts.map +1 -0
- package/dist/types/hooks/useCreateBlankForm.d.ts +6 -0
- package/dist/types/hooks/useCreateBlankForm.d.ts.map +1 -0
- package/dist/types/hooks/useCreateBlankFormAttachment.d.ts +13 -0
- package/dist/types/hooks/useCreateBlankFormAttachment.d.ts.map +1 -0
- package/dist/types/hooks/useParams.d.ts +7 -0
- package/dist/types/hooks/useParams.d.ts.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/types/File2.d.ts +16 -0
- package/dist/types/types/File2.d.ts.map +1 -0
- package/dist/types/types/FileAttachment.d.ts +10 -0
- package/dist/types/types/FileAttachment.d.ts.map +1 -0
- package/dist/types/types/Form1.d.ts +14 -0
- package/dist/types/types/Form1.d.ts.map +1 -0
- package/dist/types/types/FormAttachment.d.ts +13 -0
- package/dist/types/types/FormAttachment.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +5 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/package.json +73 -0
- package/src/FileAttachment/AttachmentEdit.tsx +14 -0
- package/src/FileAttachment/AttachmentListEdit.tsx +45 -0
- package/src/FileAttachment/AttachmentListView.tsx +12 -0
- package/src/FileAttachment/AttachmentScreen.tsx +21 -0
- package/src/FileAttachment/AttachmentView.tsx +14 -0
- package/src/FileAttachment/index.ts +7 -0
- package/src/FileAttachment/useFileAttachmentUrl.ts +15 -0
- package/src/FileAttachment/useFileUrl.ts +12 -0
- package/src/Form/EditFormAttachmentScreen.tsx +101 -0
- package/src/Form/FormEdit.tsx +15 -0
- package/src/Form/FormEditScreen.tsx +54 -0
- package/src/Form/FormListEdit.tsx +32 -0
- package/src/Form/FormListScreen.tsx +54 -0
- package/src/Form/FormListView.tsx +23 -0
- package/src/Form/FormSelectScreen.tsx +49 -0
- package/src/Form/FormSelectView.tsx +31 -0
- package/src/Form/FormView.tsx +11 -0
- package/src/Form/index.ts +9 -0
- package/src/FormAttachment/FormAttachmentEdit.tsx +72 -0
- package/src/FormAttachment/FormAttachmentEditScreen.tsx +21 -0
- package/src/FormAttachment/FormAttachmentListEdit.tsx +40 -0
- package/src/FormAttachment/FormAttachmentListScreen.tsx +62 -0
- package/src/FormAttachment/FormAttachmentListView.tsx +30 -0
- package/src/FormAttachment/FormAttachmentView.tsx +25 -0
- package/src/FormAttachment/index.ts +6 -0
- package/src/hooks/FileApi.ts +13 -0
- package/src/hooks/FileAttachmentApi.ts +11 -0
- package/src/hooks/FormApi.ts +11 -0
- package/src/hooks/FormAttachmentApi.ts +10 -0
- package/src/hooks/FormsContext.ts +29 -0
- package/src/hooks/createApi.ts +65 -0
- package/src/hooks/index.ts +10 -0
- package/src/hooks/useCreateBlankAttachment.ts +24 -0
- package/src/hooks/useCreateBlankForm.ts +12 -0
- package/src/hooks/useCreateBlankFormAttachment.ts +20 -0
- package/src/hooks/useParams.ts +9 -0
- package/src/index.ts +5 -0
- package/src/types/File2.ts +19 -0
- package/src/types/FileAttachment.ts +9 -0
- package/src/types/Form1.ts +17 -0
- package/src/types/FormAttachment.ts +19 -0
- 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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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,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
|
+
);
|