synapse-react-client 4.0.41 → 4.0.42

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 (313) hide show
  1. package/dist/SWC.index.js +1 -1
  2. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/AccessorRequirementHelpText.d.ts +7 -0
  3. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/AccessorRequirementHelpText.d.ts.map +1 -0
  4. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/AccessorRequirementHelpText.js +30 -0
  5. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/AccessorRequirementHelpText.js.map +1 -0
  6. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DataAccessRequestAccessorsFilesForm/DataAccessRequestAccessorsFilesForm.d.ts.map +1 -1
  7. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DataAccessRequestAccessorsFilesForm/DataAccessRequestAccessorsFilesForm.js +138 -244
  8. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DataAccessRequestAccessorsFilesForm/DataAccessRequestAccessorsFilesForm.js.map +1 -1
  9. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DucUploadSection.d.ts +13 -0
  10. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DucUploadSection.d.ts.map +1 -0
  11. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DucUploadSection.js +60 -0
  12. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DucUploadSection.js.map +1 -0
  13. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/EDucPreviewStep/EDucPreviewStep.d.ts +8 -2
  14. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/EDucPreviewStep/EDucPreviewStep.d.ts.map +1 -1
  15. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/EDucPreviewStep/EDucPreviewStep.js +179 -63
  16. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/EDucPreviewStep/EDucPreviewStep.js.map +1 -1
  17. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementFormWikiWrapper.d.ts +2 -0
  18. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementFormWikiWrapper.d.ts.map +1 -1
  19. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementFormWikiWrapper.js +13 -13
  20. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementFormWikiWrapper.js.map +1 -1
  21. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementItemView.d.ts +3 -2
  22. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementItemView.d.ts.map +1 -1
  23. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementItemView.js.map +1 -1
  24. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManualUploadDucStep/ManualUploadDucStep.d.ts +3 -2
  25. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManualUploadDucStep/ManualUploadDucStep.d.ts.map +1 -1
  26. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManualUploadDucStep/ManualUploadDucStep.js.map +1 -1
  27. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/PrincipalInvestigatorFields.d.ts +12 -0
  28. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/PrincipalInvestigatorFields.d.ts.map +1 -0
  29. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/PrincipalInvestigatorFields.js +50 -0
  30. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/PrincipalInvestigatorFields.js.map +1 -0
  31. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ResearchProjectForm/ResearchProjectForm.d.ts.map +1 -1
  32. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ResearchProjectForm/ResearchProjectForm.js +112 -143
  33. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ResearchProjectForm/ResearchProjectForm.js.map +1 -1
  34. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ReviewDucStep/ReviewDucStep.d.ts +4 -2
  35. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ReviewDucStep/ReviewDucStep.d.ts.map +1 -1
  36. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ReviewDucStep/ReviewDucStep.js +8 -7
  37. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ReviewDucStep/ReviewDucStep.js.map +1 -1
  38. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/SignatureStatusStep/SignatureStatusStep.d.ts +3 -2
  39. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/SignatureStatusStep/SignatureStatusStep.d.ts.map +1 -1
  40. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/SignatureStatusStep/SignatureStatusStep.js +79 -47
  41. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/SignatureStatusStep/SignatureStatusStep.js.map +1 -1
  42. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/SigningOfficialFields.d.ts +12 -0
  43. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/SigningOfficialFields.d.ts.map +1 -0
  44. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/SigningOfficialFields.js +51 -0
  45. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/SigningOfficialFields.js.map +1 -0
  46. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/eDucSignatureUtils.d.ts +12 -0
  47. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/eDucSignatureUtils.d.ts.map +1 -0
  48. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/eDucSignatureUtils.js +24 -0
  49. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/eDucSignatureUtils.js.map +1 -0
  50. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/requestFlowTypes.d.ts +11 -0
  51. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/requestFlowTypes.d.ts.map +1 -0
  52. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/requestFlowTypes.js +0 -0
  53. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/useInitializeRequestAccessors.d.ts +22 -0
  54. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/useInitializeRequestAccessors.d.ts.map +1 -0
  55. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/useInitializeRequestAccessors.js +32 -0
  56. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/useInitializeRequestAccessors.js.map +1 -0
  57. package/dist/components/AclEditor/AclEditor.js +20 -20
  58. package/dist/components/Authentication/TwoFactorBackupCodes.js +1 -1
  59. package/dist/components/Authentication/TwoFactorBackupCodes.js.map +1 -1
  60. package/dist/components/Authentication/TwoFactorEnrollmentForm.d.ts.map +1 -1
  61. package/dist/components/Authentication/TwoFactorEnrollmentForm.js +79 -69
  62. package/dist/components/Authentication/TwoFactorEnrollmentForm.js.map +1 -1
  63. package/dist/components/DataGrid/SynapseGrid.d.ts.map +1 -1
  64. package/dist/components/DataGrid/SynapseGrid.js +244 -246
  65. package/dist/components/DataGrid/SynapseGrid.js.map +1 -1
  66. package/dist/components/DataGrid/components/GridLoadingState.d.ts +23 -0
  67. package/dist/components/DataGrid/components/GridLoadingState.d.ts.map +1 -0
  68. package/dist/components/DataGrid/components/GridLoadingState.js +64 -0
  69. package/dist/components/DataGrid/components/GridLoadingState.js.map +1 -0
  70. package/dist/components/DataGrid/components/ReorderColumnsDialog.d.ts.map +1 -1
  71. package/dist/components/DataGrid/components/ReorderColumnsDialog.js +30 -29
  72. package/dist/components/DataGrid/components/ReorderColumnsDialog.js.map +1 -1
  73. package/dist/components/DataGrid/useDataGridWebsocket.d.ts +60 -6
  74. package/dist/components/DataGrid/useDataGridWebsocket.d.ts.map +1 -1
  75. package/dist/components/DataGrid/useDataGridWebsocket.js +71 -60
  76. package/dist/components/DataGrid/useDataGridWebsocket.js.map +1 -1
  77. package/dist/components/DataGrid/utils/getNamedColumnIndices.d.ts +11 -0
  78. package/dist/components/DataGrid/utils/getNamedColumnIndices.d.ts.map +1 -0
  79. package/dist/components/DataGrid/utils/getNamedColumnIndices.js +8 -0
  80. package/dist/components/DataGrid/utils/getNamedColumnIndices.js.map +1 -0
  81. package/dist/components/FilePreview/FileHandleContentRenderer.d.ts +6 -2
  82. package/dist/components/FilePreview/FileHandleContentRenderer.d.ts.map +1 -1
  83. package/dist/components/FilePreview/FileHandleContentRenderer.js +27 -14
  84. package/dist/components/FilePreview/FileHandleContentRenderer.js.map +1 -1
  85. package/dist/components/FilePreview/PdfPreview.d.ts +1 -1
  86. package/dist/components/FilePreview/PdfPreview.d.ts.map +1 -1
  87. package/dist/components/FilePreview/PdfPreview.js +15 -16
  88. package/dist/components/FilePreview/PdfPreview.js.map +1 -1
  89. package/dist/components/FormTemplateEditor/FieldDefinitionDrawer.d.ts.map +1 -1
  90. package/dist/components/FormTemplateEditor/FieldDefinitionDrawer.js +71 -68
  91. package/dist/components/FormTemplateEditor/FieldDefinitionDrawer.js.map +1 -1
  92. package/dist/components/FormTemplateEditor/FieldLibrary.css +1 -0
  93. package/dist/components/FormTemplateEditor/FieldLibrary.d.ts +17 -0
  94. package/dist/components/FormTemplateEditor/FieldLibrary.d.ts.map +1 -0
  95. package/dist/components/FormTemplateEditor/FieldLibrary.js +88 -0
  96. package/dist/components/FormTemplateEditor/FieldLibrary.js.map +1 -0
  97. package/dist/components/FormTemplateEditor/FieldLibrary.module.js +5 -0
  98. package/dist/components/FormTemplateEditor/FieldLibrary.module.js.map +1 -0
  99. package/dist/components/FormTemplateEditor/FieldLibrary.module.scss +12 -0
  100. package/dist/components/FormTemplateEditor/FieldLibraryRow.d.ts +19 -0
  101. package/dist/components/FormTemplateEditor/FieldLibraryRow.d.ts.map +1 -0
  102. package/dist/components/FormTemplateEditor/FieldLibraryRow.js +115 -0
  103. package/dist/components/FormTemplateEditor/FieldLibraryRow.js.map +1 -0
  104. package/dist/components/FormTemplateEditor/FieldValidationErrorAlert.css +1 -0
  105. package/dist/components/FormTemplateEditor/FieldValidationErrorAlert.d.ts +9 -0
  106. package/dist/components/FormTemplateEditor/FieldValidationErrorAlert.d.ts.map +1 -0
  107. package/dist/components/FormTemplateEditor/FieldValidationErrorAlert.js +18 -0
  108. package/dist/components/FormTemplateEditor/FieldValidationErrorAlert.js.map +1 -0
  109. package/dist/components/FormTemplateEditor/FieldValidationErrorAlert.module.js +5 -0
  110. package/dist/components/FormTemplateEditor/FieldValidationErrorAlert.module.js.map +1 -0
  111. package/dist/components/FormTemplateEditor/FieldValidationErrorAlert.module.scss +4 -0
  112. package/dist/components/FormTemplateEditor/FormStructurePanel.d.ts +21 -0
  113. package/dist/components/FormTemplateEditor/FormStructurePanel.d.ts.map +1 -0
  114. package/dist/components/FormTemplateEditor/FormStructurePanel.js +108 -0
  115. package/dist/components/FormTemplateEditor/FormStructurePanel.js.map +1 -0
  116. package/dist/components/FormTemplateEditor/FormTemplateEditor.d.ts +10 -0
  117. package/dist/components/FormTemplateEditor/FormTemplateEditor.d.ts.map +1 -0
  118. package/dist/components/FormTemplateEditor/FormTemplateEditor.js +31 -0
  119. package/dist/components/FormTemplateEditor/FormTemplateEditor.js.map +1 -0
  120. package/dist/components/FormTemplateEditor/FormTemplateEditorForm.d.ts +15 -0
  121. package/dist/components/FormTemplateEditor/FormTemplateEditorForm.d.ts.map +1 -0
  122. package/dist/components/FormTemplateEditor/FormTemplateEditorForm.js +234 -0
  123. package/dist/components/FormTemplateEditor/FormTemplateEditorForm.js.map +1 -0
  124. package/dist/components/FormTemplateEditor/FormTemplatePreview.d.ts.map +1 -1
  125. package/dist/components/FormTemplateEditor/FormTemplatePreview.js +1 -12
  126. package/dist/components/FormTemplateEditor/FormTemplatePreview.js.map +1 -1
  127. package/dist/components/FormTemplateEditor/StepCard.d.ts +25 -0
  128. package/dist/components/FormTemplateEditor/StepCard.d.ts.map +1 -0
  129. package/dist/components/FormTemplateEditor/StepCard.js +203 -0
  130. package/dist/components/FormTemplateEditor/StepCard.js.map +1 -0
  131. package/dist/components/FormTemplateEditor/StepFieldRow.d.ts +34 -0
  132. package/dist/components/FormTemplateEditor/StepFieldRow.d.ts.map +1 -0
  133. package/dist/components/FormTemplateEditor/StepFieldRow.js +128 -0
  134. package/dist/components/FormTemplateEditor/StepFieldRow.js.map +1 -0
  135. package/dist/components/FormTemplateEditor/TemplateFileHandleField.d.ts +19 -0
  136. package/dist/components/FormTemplateEditor/TemplateFileHandleField.d.ts.map +1 -0
  137. package/dist/components/FormTemplateEditor/TemplateFileHandleField.js +78 -0
  138. package/dist/components/FormTemplateEditor/TemplateFileHandleField.js.map +1 -0
  139. package/dist/components/FormTemplateEditor/dragHandle.css +1 -0
  140. package/dist/components/FormTemplateEditor/dragHandle.module.js +8 -0
  141. package/dist/components/FormTemplateEditor/dragHandle.module.js.map +1 -0
  142. package/dist/components/FormTemplateEditor/dragHandle.module.scss +22 -0
  143. package/dist/components/FormTemplateEditor/dropTarget.css +1 -0
  144. package/dist/components/FormTemplateEditor/dropTarget.module.js +5 -0
  145. package/dist/components/FormTemplateEditor/dropTarget.module.js.map +1 -0
  146. package/dist/components/FormTemplateEditor/dropTarget.module.scss +14 -0
  147. package/dist/components/FormTemplateEditor/formTemplateDraftState.d.ts +48 -0
  148. package/dist/components/FormTemplateEditor/formTemplateDraftState.d.ts.map +1 -0
  149. package/dist/components/FormTemplateEditor/formTemplateDraftState.js +126 -0
  150. package/dist/components/FormTemplateEditor/formTemplateDraftState.js.map +1 -0
  151. package/dist/components/FormTemplateEditor/formTemplateSchema.d.ts +35 -0
  152. package/dist/components/FormTemplateEditor/formTemplateSchema.d.ts.map +1 -0
  153. package/dist/components/FormTemplateEditor/formTemplateSchema.js +35 -0
  154. package/dist/components/FormTemplateEditor/formTemplateSchema.js.map +1 -0
  155. package/dist/components/FormTemplateEditor/schemaFieldUtils.d.ts +3 -1
  156. package/dist/components/FormTemplateEditor/schemaFieldUtils.d.ts.map +1 -1
  157. package/dist/components/FormTemplateEditor/schemaFieldUtils.js +26 -8
  158. package/dist/components/FormTemplateEditor/schemaFieldUtils.js.map +1 -1
  159. package/dist/components/FormTemplateEditor/sortableIds.d.ts +23 -0
  160. package/dist/components/FormTemplateEditor/sortableIds.d.ts.map +1 -0
  161. package/dist/components/FormTemplateEditor/sortableIds.js +24 -0
  162. package/dist/components/FormTemplateEditor/sortableIds.js.map +1 -0
  163. package/dist/components/FormTemplateEditor/useFormTemplateDraft.d.ts +33 -0
  164. package/dist/components/FormTemplateEditor/useFormTemplateDraft.d.ts.map +1 -0
  165. package/dist/components/FormTemplateEditor/useFormTemplateDraft.js +59 -0
  166. package/dist/components/FormTemplateEditor/useFormTemplateDraft.js.map +1 -0
  167. package/dist/components/FormTemplateEditor/useFormTemplateDrag.d.ts +9 -0
  168. package/dist/components/FormTemplateEditor/useFormTemplateDrag.d.ts.map +1 -0
  169. package/dist/components/FormTemplateEditor/useFormTemplateDrag.js +66 -0
  170. package/dist/components/FormTemplateEditor/useFormTemplateDrag.js.map +1 -0
  171. package/dist/components/FormTemplateEditor/useSaveFormTemplate.d.ts.map +1 -1
  172. package/dist/components/FormTemplateEditor/useSaveFormTemplate.js +34 -19
  173. package/dist/components/FormTemplateEditor/useSaveFormTemplate.js.map +1 -1
  174. package/dist/components/FormTemplateEditor/utils.d.ts +2 -2
  175. package/dist/components/FormTemplateEditor/utils.d.ts.map +1 -1
  176. package/dist/components/FormTemplateEditor/utils.js +7 -10
  177. package/dist/components/FormTemplateEditor/utils.js.map +1 -1
  178. package/dist/components/JsonSchemaForm/widgets/SelectWidget.d.ts +11 -0
  179. package/dist/components/JsonSchemaForm/widgets/SelectWidget.d.ts.map +1 -1
  180. package/dist/components/JsonSchemaForm/widgets/SelectWidget.js +28 -19
  181. package/dist/components/JsonSchemaForm/widgets/SelectWidget.js.map +1 -1
  182. package/dist/components/QueryBuilder/FilterConditionRow.d.ts +1 -0
  183. package/dist/components/QueryBuilder/FilterConditionRow.d.ts.map +1 -1
  184. package/dist/components/QueryBuilder/FilterConditionRow.js +102 -105
  185. package/dist/components/QueryBuilder/FilterConditionRow.js.map +1 -1
  186. package/dist/components/QueryBuilder/FilterGroupNode.js +6 -6
  187. package/dist/components/QueryBuilder/QueryBuilderControls.d.ts.map +1 -1
  188. package/dist/components/QueryBuilder/QueryBuilderControls.js +88 -81
  189. package/dist/components/QueryBuilder/QueryBuilderControls.js.map +1 -1
  190. package/dist/components/QueryBuilder/QueryBuilderInternalContext.d.ts +7 -0
  191. package/dist/components/QueryBuilder/QueryBuilderInternalContext.d.ts.map +1 -1
  192. package/dist/components/QueryBuilder/QueryBuilderInternalContext.js.map +1 -1
  193. package/dist/components/QueryBuilder/qbTreeToReadable.d.ts +2 -1
  194. package/dist/components/QueryBuilder/qbTreeToReadable.d.ts.map +1 -1
  195. package/dist/components/QueryBuilder/qbTreeToReadable.js +24 -20
  196. package/dist/components/QueryBuilder/qbTreeToReadable.js.map +1 -1
  197. package/dist/components/QueryBuilder/queryBuilderDrag.css +1 -1
  198. package/dist/components/QueryBuilder/queryBuilderDrag.module.js +2 -2
  199. package/dist/components/QueryBuilder/queryBuilderDrag.module.js.map +1 -1
  200. package/dist/components/QueryBuilder/queryBuilderDrag.module.scss +1 -1
  201. package/dist/components/QueryBuilder/queryBuilderMetadata.d.ts +16 -0
  202. package/dist/components/QueryBuilder/queryBuilderMetadata.d.ts.map +1 -1
  203. package/dist/components/QueryBuilder/queryBuilderMetadata.js +13 -5
  204. package/dist/components/QueryBuilder/queryBuilderMetadata.js.map +1 -1
  205. package/dist/components/QueryBuilder/useQBValueDisplayName.d.ts +18 -0
  206. package/dist/components/QueryBuilder/useQBValueDisplayName.d.ts.map +1 -0
  207. package/dist/components/QueryBuilder/useQBValueDisplayName.js +64 -0
  208. package/dist/components/QueryBuilder/useQBValueDisplayName.js.map +1 -0
  209. package/dist/components/SynapseTable/RowSelection/RowSelectionControls.js +6 -6
  210. package/dist/components/SynapseTable/RowSelection/RowSelectionUI.d.ts +1 -0
  211. package/dist/components/SynapseTable/RowSelection/RowSelectionUI.d.ts.map +1 -1
  212. package/dist/components/SynapseTable/RowSelection/RowSelectionUI.js +13 -11
  213. package/dist/components/SynapseTable/RowSelection/RowSelectionUI.js.map +1 -1
  214. package/dist/components/SynapseTable/SearchV2.js +4 -4
  215. package/dist/components/ToastMessage/ToastMessage.d.ts.map +1 -1
  216. package/dist/components/ToastMessage/ToastMessage.js +25 -22
  217. package/dist/components/ToastMessage/ToastMessage.js.map +1 -1
  218. package/dist/components/dataaccess/FormTemplateEditorRoute.d.ts +7 -0
  219. package/dist/components/dataaccess/FormTemplateEditorRoute.d.ts.map +1 -0
  220. package/dist/components/dataaccess/FormTemplateEditorRoute.js +26 -0
  221. package/dist/components/dataaccess/FormTemplateEditorRoute.js.map +1 -0
  222. package/dist/components/dataaccess/FormTemplateTable.d.ts +10 -0
  223. package/dist/components/dataaccess/FormTemplateTable.d.ts.map +1 -0
  224. package/dist/components/dataaccess/FormTemplateTable.js +124 -0
  225. package/dist/components/dataaccess/FormTemplateTable.js.map +1 -0
  226. package/dist/components/dataaccess/ReviewerDashboard.d.ts.map +1 -1
  227. package/dist/components/dataaccess/ReviewerDashboard.js +80 -50
  228. package/dist/components/dataaccess/ReviewerDashboard.js.map +1 -1
  229. package/dist/components/dataaccess/UserAccessRequestHistory/InFlightEDucSignaturesTable.d.ts.map +1 -1
  230. package/dist/components/dataaccess/UserAccessRequestHistory/InFlightEDucSignaturesTable.js +2 -0
  231. package/dist/components/dataaccess/UserAccessRequestHistory/InFlightEDucSignaturesTable.js.map +1 -1
  232. package/dist/components/widgets/FileHandleLink.d.ts +12 -2
  233. package/dist/components/widgets/FileHandleLink.d.ts.map +1 -1
  234. package/dist/components/widgets/FileHandleLink.js +25 -29
  235. package/dist/components/widgets/FileHandleLink.js.map +1 -1
  236. package/dist/mocks/accessRequirement/mockFormTemplates.d.ts +2 -0
  237. package/dist/mocks/accessRequirement/mockFormTemplates.d.ts.map +1 -1
  238. package/dist/mocks/accessRequirement/mockFormTemplates.js +8 -2
  239. package/dist/mocks/accessRequirement/mockFormTemplates.js.map +1 -1
  240. package/dist/mocks/accessRequirement/mockJsonSchemas.d.ts.map +1 -1
  241. package/dist/mocks/accessRequirement/mockJsonSchemas.js +17 -31
  242. package/dist/mocks/accessRequirement/mockJsonSchemas.js.map +1 -1
  243. package/dist/mocks/msw/handlers/authHandlers.d.ts +1 -0
  244. package/dist/mocks/msw/handlers/authHandlers.d.ts.map +1 -1
  245. package/dist/mocks/msw/handlers/authHandlers.js +6 -2
  246. package/dist/mocks/msw/handlers/authHandlers.js.map +1 -1
  247. package/dist/mocks/msw/handlers/dataAccessRequestHandlers.d.ts +2 -0
  248. package/dist/mocks/msw/handlers/dataAccessRequestHandlers.d.ts.map +1 -1
  249. package/dist/mocks/msw/handlers/dataAccessRequestHandlers.js +52 -46
  250. package/dist/mocks/msw/handlers/dataAccessRequestHandlers.js.map +1 -1
  251. package/dist/mocks/msw/handlers/fileHandlers.d.ts.map +1 -1
  252. package/dist/mocks/msw/handlers/fileHandlers.js +25 -21
  253. package/dist/mocks/msw/handlers/fileHandlers.js.map +1 -1
  254. package/dist/mocks/msw/handlers/formTemplateHandlers.d.ts +2 -1
  255. package/dist/mocks/msw/handlers/formTemplateHandlers.d.ts.map +1 -1
  256. package/dist/mocks/msw/handlers/formTemplateHandlers.js +18 -18
  257. package/dist/mocks/msw/handlers/formTemplateHandlers.js.map +1 -1
  258. package/dist/mocks/msw/handlers/schemaHandlers.d.ts +8 -0
  259. package/dist/mocks/msw/handlers/schemaHandlers.d.ts.map +1 -1
  260. package/dist/mocks/msw/handlers/schemaHandlers.js +20 -3
  261. package/dist/mocks/msw/handlers/schemaHandlers.js.map +1 -1
  262. package/dist/mocks/msw/handlers/twoFactorEnrollmentHandlers.d.ts +8 -0
  263. package/dist/mocks/msw/handlers/twoFactorEnrollmentHandlers.d.ts.map +1 -0
  264. package/dist/mocks/msw/handlers/twoFactorEnrollmentHandlers.js +19 -0
  265. package/dist/mocks/msw/handlers/twoFactorEnrollmentHandlers.js.map +1 -0
  266. package/dist/style/abstracts/_cssVariables.scss +13 -0
  267. package/dist/style/components/_toasts.scss +10 -1
  268. package/dist/style/main.css +1 -1
  269. package/dist/synapse-queries/KeyFactory.d.ts +8 -1
  270. package/dist/synapse-queries/KeyFactory.d.ts.map +1 -1
  271. package/dist/synapse-queries/KeyFactory.js +17 -4
  272. package/dist/synapse-queries/KeyFactory.js.map +1 -1
  273. package/dist/synapse-queries/auth/index.d.ts +1 -0
  274. package/dist/synapse-queries/auth/index.d.ts.map +1 -1
  275. package/dist/synapse-queries/auth/index.js +2 -1
  276. package/dist/synapse-queries/auth/useUnbindOAuthProviderIdentity.d.ts +11 -0
  277. package/dist/synapse-queries/auth/useUnbindOAuthProviderIdentity.d.ts.map +1 -0
  278. package/dist/synapse-queries/auth/useUnbindOAuthProviderIdentity.js +19 -0
  279. package/dist/synapse-queries/auth/useUnbindOAuthProviderIdentity.js.map +1 -0
  280. package/dist/synapse-queries/dataaccess/index.js +5 -5
  281. package/dist/synapse-queries/dataaccess/useEDuc.d.ts +18 -0
  282. package/dist/synapse-queries/dataaccess/useEDuc.d.ts.map +1 -1
  283. package/dist/synapse-queries/dataaccess/useEDuc.js +33 -1
  284. package/dist/synapse-queries/dataaccess/useEDuc.js.map +1 -1
  285. package/dist/synapse-queries/file/useDirectUploadToS3.js +6 -6
  286. package/dist/synapse-queries/file/useFileHandle.d.ts +8 -0
  287. package/dist/synapse-queries/file/useFileHandle.d.ts.map +1 -1
  288. package/dist/synapse-queries/file/useFileHandle.js +15 -6
  289. package/dist/synapse-queries/file/useFileHandle.js.map +1 -1
  290. package/dist/synapse-queries/index.js +260 -253
  291. package/dist/synapse-queries/jsonschema/index.js +2 -2
  292. package/dist/synapse-queries/jsonschema/useSchema.d.ts +5 -0
  293. package/dist/synapse-queries/jsonschema/useSchema.d.ts.map +1 -1
  294. package/dist/synapse-queries/jsonschema/useSchema.js +9 -1
  295. package/dist/synapse-queries/jsonschema/useSchema.js.map +1 -1
  296. package/dist/tsconfig.build.tsbuildinfo +1 -1
  297. package/dist/utils/APIConstants.d.ts +1 -0
  298. package/dist/utils/APIConstants.d.ts.map +1 -1
  299. package/dist/utils/APIConstants.js +2 -2
  300. package/dist/utils/APIConstants.js.map +1 -1
  301. package/dist/utils/featureflag/FeatureFlags.d.ts +1 -0
  302. package/dist/utils/featureflag/FeatureFlags.d.ts.map +1 -1
  303. package/dist/utils/featureflag/FeatureFlags.js +1 -1
  304. package/dist/utils/featureflag/FeatureFlags.js.map +1 -1
  305. package/dist/utils/functions/toPascalCase.d.ts +6 -0
  306. package/dist/utils/functions/toPascalCase.d.ts.map +1 -0
  307. package/dist/utils/functions/toPascalCase.js +8 -0
  308. package/dist/utils/functions/toPascalCase.js.map +1 -0
  309. package/dist/utils/jsonschema/submissionContext.d.ts +5 -0
  310. package/dist/utils/jsonschema/submissionContext.d.ts.map +1 -1
  311. package/dist/utils/jsonschema/submissionContext.js +22 -30
  312. package/dist/utils/jsonschema/submissionContext.js.map +1 -1
  313. package/package.json +10 -9
@@ -0,0 +1,48 @@
1
+ import { RJSFSchema } from '@rjsf/utils';
2
+ import { ResolvedSchemaProperty, SchemaPropertyContext } from '@/utils/jsonschema/submissionContext';
3
+ import { EditableFormTemplateStep } from './utils';
4
+ export type FormTemplateDraftState = {
5
+ jsonSchema: RJSFSchema;
6
+ steps: EditableFormTemplateStep[];
7
+ /** The property open in the field definition drawer, if any. */
8
+ editingPropertyKey: string | null;
9
+ };
10
+ export declare const NEW_FIELD_TITLE = "New field";
11
+ export declare function schemaPropertyKeys(jsonSchema: RJSFSchema): Set<string>;
12
+ /** The `schemaPath` of every field bound to a step. */
13
+ export declare function boundSchemaPaths(steps: EditableFormTemplateStep[]): Set<string>;
14
+ /** Schema properties that no step binds yet, in schema order. */
15
+ export declare function listUnboundProperties(jsonSchema: RJSFSchema, steps: EditableFormTemplateStep[]): ResolvedSchemaProperty[];
16
+ /** Add an unbound text property with a generated key and open it for editing. */
17
+ export declare function createField(state: FormTemplateDraftState): FormTemplateDraftState;
18
+ /**
19
+ * Rename a property's key everywhere it's referenced: the schema, every step field bound to it, and
20
+ * the drawer editing it. A no-op if `oldKey` doesn't exist or `newKey` is already taken.
21
+ */
22
+ export declare function renamePropertyKey(state: FormTemplateDraftState, oldKey: string, newKey: string): FormTemplateDraftState;
23
+ /**
24
+ * Merge `patch` into a property's definition. While the key still matches what the old title
25
+ * generates, a title change renames the key to follow it, like a slug; once the key has been
26
+ * edited by hand it stays put.
27
+ */
28
+ export declare function updateProperty(state: FormTemplateDraftState, key: string, patch: Partial<RJSFSchema>): FormTemplateDraftState;
29
+ /** Replace a property's whole definition, keeping its context and required-ness. */
30
+ export declare function replaceProperty(state: FormTemplateDraftState, key: string, next: RJSFSchema): FormTemplateDraftState;
31
+ export declare function changeRequired(state: FormTemplateDraftState, key: string, isRequired: boolean): FormTemplateDraftState;
32
+ export declare function changeContext(state: FormTemplateDraftState, key: string, context: SchemaPropertyContext): FormTemplateDraftState;
33
+ /** Remove a property from the schema, unbind it from every step, and close its drawer. */
34
+ export declare function removeProperty(state: FormTemplateDraftState, key: string): FormTemplateDraftState;
35
+ /** Move the step at `fromIndex` so it ends up at `toIndex`. A no-op for out-of-range indices. */
36
+ export declare function moveStep(state: FormTemplateDraftState, fromIndex: number, toIndex: number): FormTemplateDraftState;
37
+ /**
38
+ * Move the field bound to `schemaPath` into the step identified by `toStepKey` so it ends up at
39
+ * `toIndex` there (clamped to the end), whether or not that is the step it came from. A no-op if
40
+ * no step binds `schemaPath` or no step has `toStepKey`.
41
+ */
42
+ export declare function moveSlot(state: FormTemplateDraftState, schemaPath: string, toStepKey: string, toIndex: number): FormTemplateDraftState;
43
+ /**
44
+ * Append a field bound to `propertyKey` to the step identified by `stepKey`. A no-op if that
45
+ * property is already bound to any step (a property binds at most once) or no step has `stepKey`.
46
+ */
47
+ export declare function bindField(state: FormTemplateDraftState, propertyKey: string, stepKey: string): FormTemplateDraftState;
48
+ //# sourceMappingURL=formTemplateDraftState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formTemplateDraftState.d.ts","sourceRoot":"","sources":["../../../src/components/FormTemplateEditor/formTemplateDraftState.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAML,sBAAsB,EAEtB,qBAAqB,EAItB,MAAM,sCAAsC,CAAA;AAE7C,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAElD,MAAM,MAAM,sBAAsB,GAAG;IACnC,UAAU,EAAE,UAAU,CAAA;IACtB,KAAK,EAAE,wBAAwB,EAAE,CAAA;IACjC,gEAAgE;IAChE,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAA;CAClC,CAAA;AAED,eAAO,MAAM,eAAe,cAAc,CAAA;AAE1C,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,GAAG,CAAC,MAAM,CAAC,CAItE;AAED,uDAAuD;AACvD,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,wBAAwB,EAAE,GAChC,GAAG,CAAC,MAAM,CAAC,CAEb;AAED,iEAAiE;AACjE,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,UAAU,EACtB,KA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AsB,EAC7B,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,GACd,sBAAsB,CAsBxB"}
@@ -0,0 +1,126 @@
1
+ import { listResolvedSchemaProperties as e, propertyKeyToPointer as t, removeSchemaProperty as n, renameSchemaProperty as r, replaceSchemaPropertyDefinition as i, resolveSchemaPropertyAtPointer as a, setSchemaProperty as o, setSchemaPropertyContext as s, setSchemaPropertyRequired as c } from "../../utils/jsonschema/submissionContext.js";
2
+ import { generatePropertyKey as l } from "./schemaFieldUtils.js";
3
+ //#region src/components/FormTemplateEditor/formTemplateDraftState.ts
4
+ var u = "New field";
5
+ function d(t) {
6
+ return new Set(e(t).map((e) => e.propertyKey));
7
+ }
8
+ function f(e) {
9
+ return new Set(e.flatMap((e) => e.fields.map((e) => e.schemaPath)));
10
+ }
11
+ function p(n, r) {
12
+ let i = f(r);
13
+ return e(n).filter((e) => !i.has(t(e.propertyKey)));
14
+ }
15
+ function m(e) {
16
+ let t = l(u, d(e.jsonSchema));
17
+ return {
18
+ ...e,
19
+ jsonSchema: o(e.jsonSchema, t, {
20
+ type: "string",
21
+ title: u,
22
+ description: ""
23
+ }, "ALWAYS"),
24
+ editingPropertyKey: t
25
+ };
26
+ }
27
+ function h(e, n, i) {
28
+ let a = d(e.jsonSchema);
29
+ if (i === n || !a.has(n) || a.has(i)) return e;
30
+ let o = t(n), s = t(i);
31
+ return {
32
+ jsonSchema: r(e.jsonSchema, n, i),
33
+ steps: e.steps.map((e) => ({
34
+ ...e,
35
+ fields: e.fields.map((e) => e.schemaPath === o ? {
36
+ ...e,
37
+ schemaPath: s
38
+ } : e)
39
+ })),
40
+ editingPropertyKey: e.editingPropertyKey === n ? i : e.editingPropertyKey
41
+ };
42
+ }
43
+ function g(e, n, r) {
44
+ let o = a(e.jsonSchema, t(n));
45
+ if (!o) return e;
46
+ let s = {
47
+ ...e,
48
+ jsonSchema: i(e.jsonSchema, n, {
49
+ ...o.subSchema,
50
+ ...r
51
+ })
52
+ };
53
+ if (typeof r.title != "string") return s;
54
+ let c = d(e.jsonSchema);
55
+ return c.delete(n), l(o.subSchema.title ?? "", c) === n ? h(s, n, l(r.title, c)) : s;
56
+ }
57
+ function _(e, t, n) {
58
+ return {
59
+ ...e,
60
+ jsonSchema: i(e.jsonSchema, t, n)
61
+ };
62
+ }
63
+ function v(e, n, r) {
64
+ let i = a(e.jsonSchema, t(n))?.context ?? "ALWAYS";
65
+ return {
66
+ ...e,
67
+ jsonSchema: c(e.jsonSchema, n, i, r)
68
+ };
69
+ }
70
+ function y(e, t, n) {
71
+ return {
72
+ ...e,
73
+ jsonSchema: s(e.jsonSchema, t, n)
74
+ };
75
+ }
76
+ function b(e, r) {
77
+ let i = t(r);
78
+ return {
79
+ jsonSchema: n(e.jsonSchema, r),
80
+ steps: e.steps.map((e) => ({
81
+ ...e,
82
+ fields: e.fields.filter((e) => e.schemaPath !== i)
83
+ })),
84
+ editingPropertyKey: e.editingPropertyKey === r ? null : e.editingPropertyKey
85
+ };
86
+ }
87
+ function x(e, t, n) {
88
+ let { steps: r } = e, i = (e) => e >= 0 && e < r.length;
89
+ if (t === n || !i(t) || !i(n)) return e;
90
+ let a = r.slice();
91
+ return a.splice(n, 0, ...a.splice(t, 1)), {
92
+ ...e,
93
+ steps: a
94
+ };
95
+ }
96
+ function S(e, t, n, r) {
97
+ let i = e.steps.flatMap((e) => e.fields).find((e) => e.schemaPath === t);
98
+ return !i || !e.steps.some((e) => e.uiKey === n) ? e : {
99
+ ...e,
100
+ steps: e.steps.map((e) => {
101
+ let a = e.fields.filter((e) => e.schemaPath !== t);
102
+ return e.uiKey === n && a.splice(Math.max(0, r), 0, i), {
103
+ ...e,
104
+ fields: a
105
+ };
106
+ })
107
+ };
108
+ }
109
+ function C(e, n, r) {
110
+ let i = t(n);
111
+ return f(e.steps).has(i) || !e.steps.some((e) => e.uiKey === r) ? e : {
112
+ ...e,
113
+ steps: e.steps.map((e) => e.uiKey === r ? {
114
+ ...e,
115
+ fields: [...e.fields, {
116
+ schemaPath: i,
117
+ uiDefinition: {},
118
+ isPublic: !1
119
+ }]
120
+ } : e)
121
+ };
122
+ }
123
+ //#endregion
124
+ export { u as NEW_FIELD_TITLE, C as bindField, f as boundSchemaPaths, y as changeContext, v as changeRequired, m as createField, p as listUnboundProperties, S as moveSlot, x as moveStep, b as removeProperty, h as renamePropertyKey, _ as replaceProperty, d as schemaPropertyKeys, g as updateProperty };
125
+
126
+ //# sourceMappingURL=formTemplateDraftState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formTemplateDraftState.js","names":[],"sources":["../../../src/components/FormTemplateEditor/formTemplateDraftState.ts"],"sourcesContent":["/*\n * Pure transitions over a FormTemplate draft: the in-progress JSON Schema body, the step structure,\n * and the property open for editing. Every transition keeps the three in sync (renaming a property\n * key rewrites every step field bound to it, removing a property unbinds it from every step, etc).\n */\nimport { RJSFSchema } from '@rjsf/utils'\nimport {\n listResolvedSchemaProperties,\n propertyKeyToPointer,\n removeSchemaProperty,\n renameSchemaProperty,\n replaceSchemaPropertyDefinition,\n ResolvedSchemaProperty,\n resolveSchemaPropertyAtPointer,\n SchemaPropertyContext,\n setSchemaProperty,\n setSchemaPropertyContext,\n setSchemaPropertyRequired,\n} from '@/utils/jsonschema/submissionContext'\nimport { generatePropertyKey } from './schemaFieldUtils'\nimport { EditableFormTemplateStep } from './utils'\n\nexport type FormTemplateDraftState = {\n jsonSchema: RJSFSchema\n steps: EditableFormTemplateStep[]\n /** The property open in the field definition drawer, if any. */\n editingPropertyKey: string | null\n}\n\nexport const NEW_FIELD_TITLE = 'New field'\n\nexport function schemaPropertyKeys(jsonSchema: RJSFSchema): Set<string> {\n return new Set(\n listResolvedSchemaProperties(jsonSchema).map(p => p.propertyKey),\n )\n}\n\n/** The `schemaPath` of every field bound to a step. */\nexport function boundSchemaPaths(\n steps: EditableFormTemplateStep[],\n): Set<string> {\n return new Set(steps.flatMap(step => step.fields.map(f => f.schemaPath)))\n}\n\n/** Schema properties that no step binds yet, in schema order. */\nexport function listUnboundProperties(\n jsonSchema: RJSFSchema,\n steps: EditableFormTemplateStep[],\n): ResolvedSchemaProperty[] {\n const bound = boundSchemaPaths(steps)\n return listResolvedSchemaProperties(jsonSchema).filter(\n p => !bound.has(propertyKeyToPointer(p.propertyKey)),\n )\n}\n\n/** Add an unbound text property with a generated key and open it for editing. */\nexport function createField(\n state: FormTemplateDraftState,\n): FormTemplateDraftState {\n const key = generatePropertyKey(\n NEW_FIELD_TITLE,\n schemaPropertyKeys(state.jsonSchema),\n )\n return {\n ...state,\n jsonSchema: setSchemaProperty(\n state.jsonSchema,\n key,\n { type: 'string', title: NEW_FIELD_TITLE, description: '' },\n 'ALWAYS',\n ),\n editingPropertyKey: key,\n }\n}\n\n/**\n * Rename a property's key everywhere it's referenced: the schema, every step field bound to it, and\n * the drawer editing it. A no-op if `oldKey` doesn't exist or `newKey` is already taken.\n */\nexport function renamePropertyKey(\n state: FormTemplateDraftState,\n oldKey: string,\n newKey: string,\n): FormTemplateDraftState {\n const keys = schemaPropertyKeys(state.jsonSchema)\n if (newKey === oldKey || !keys.has(oldKey) || keys.has(newKey)) return state\n const oldPath = propertyKeyToPointer(oldKey)\n const newPath = propertyKeyToPointer(newKey)\n return {\n jsonSchema: renameSchemaProperty(state.jsonSchema, oldKey, newKey),\n steps: state.steps.map(step => ({\n ...step,\n fields: step.fields.map(f =>\n f.schemaPath === oldPath ? { ...f, schemaPath: newPath } : f,\n ),\n })),\n editingPropertyKey:\n state.editingPropertyKey === oldKey ? newKey : state.editingPropertyKey,\n }\n}\n\n/**\n * Merge `patch` into a property's definition. While the key still matches what the old title\n * generates, a title change renames the key to follow it, like a slug; once the key has been\n * edited by hand it stays put.\n */\nexport function updateProperty(\n state: FormTemplateDraftState,\n key: string,\n patch: Partial<RJSFSchema>,\n): FormTemplateDraftState {\n const resolved = resolveSchemaPropertyAtPointer(\n state.jsonSchema,\n propertyKeyToPointer(key),\n )\n if (!resolved) return state\n const updated: FormTemplateDraftState = {\n ...state,\n jsonSchema: replaceSchemaPropertyDefinition(state.jsonSchema, key, {\n ...resolved.subSchema,\n ...patch,\n }),\n }\n if (typeof patch.title !== 'string') return updated\n\n const otherKeys = schemaPropertyKeys(state.jsonSchema)\n otherKeys.delete(key)\n const keyFollowsTitle =\n generatePropertyKey(resolved.subSchema.title ?? '', otherKeys) === key\n return keyFollowsTitle\n ? renamePropertyKey(\n updated,\n key,\n generatePropertyKey(patch.title, otherKeys),\n )\n : updated\n}\n\n/** Replace a property's whole definition, keeping its context and required-ness. */\nexport function replaceProperty(\n state: FormTemplateDraftState,\n key: string,\n next: RJSFSchema,\n): FormTemplateDraftState {\n return {\n ...state,\n jsonSchema: replaceSchemaPropertyDefinition(state.jsonSchema, key, next),\n }\n}\n\nexport function changeRequired(\n state: FormTemplateDraftState,\n key: string,\n isRequired: boolean,\n): FormTemplateDraftState {\n const context =\n resolveSchemaPropertyAtPointer(state.jsonSchema, propertyKeyToPointer(key))\n ?.context ?? 'ALWAYS'\n return {\n ...state,\n jsonSchema: setSchemaPropertyRequired(\n state.jsonSchema,\n key,\n context,\n isRequired,\n ),\n }\n}\n\nexport function changeContext(\n state: FormTemplateDraftState,\n key: string,\n context: SchemaPropertyContext,\n): FormTemplateDraftState {\n return {\n ...state,\n jsonSchema: setSchemaPropertyContext(state.jsonSchema, key, context),\n }\n}\n\n/** Remove a property from the schema, unbind it from every step, and close its drawer. */\nexport function removeProperty(\n state: FormTemplateDraftState,\n key: string,\n): FormTemplateDraftState {\n const path = propertyKeyToPointer(key)\n return {\n jsonSchema: removeSchemaProperty(state.jsonSchema, key),\n steps: state.steps.map(step => ({\n ...step,\n fields: step.fields.filter(f => f.schemaPath !== path),\n })),\n editingPropertyKey:\n state.editingPropertyKey === key ? null : state.editingPropertyKey,\n }\n}\n\n/** Move the step at `fromIndex` so it ends up at `toIndex`. A no-op for out-of-range indices. */\nexport function moveStep(\n state: FormTemplateDraftState,\n fromIndex: number,\n toIndex: number,\n): FormTemplateDraftState {\n const { steps } = state\n const inRange = (i: number) => i >= 0 && i < steps.length\n if (fromIndex === toIndex || !inRange(fromIndex) || !inRange(toIndex)) {\n return state\n }\n const next = steps.slice()\n next.splice(toIndex, 0, ...next.splice(fromIndex, 1))\n return { ...state, steps: next }\n}\n\n/**\n * Move the field bound to `schemaPath` into the step identified by `toStepKey` so it ends up at\n * `toIndex` there (clamped to the end), whether or not that is the step it came from. A no-op if\n * no step binds `schemaPath` or no step has `toStepKey`.\n */\nexport function moveSlot(\n state: FormTemplateDraftState,\n schemaPath: string,\n toStepKey: string,\n toIndex: number,\n): FormTemplateDraftState {\n const field = state.steps\n .flatMap(step => step.fields)\n .find(f => f.schemaPath === schemaPath)\n if (!field || !state.steps.some(step => step.uiKey === toStepKey)) {\n return state\n }\n return {\n ...state,\n steps: state.steps.map(step => {\n const fields = step.fields.filter(f => f.schemaPath !== schemaPath)\n if (step.uiKey === toStepKey) {\n fields.splice(Math.max(0, toIndex), 0, field)\n }\n return { ...step, fields }\n }),\n }\n}\n\n/**\n * Append a field bound to `propertyKey` to the step identified by `stepKey`. A no-op if that\n * property is already bound to any step (a property binds at most once) or no step has `stepKey`.\n */\nexport function bindField(\n state: FormTemplateDraftState,\n propertyKey: string,\n stepKey: string,\n): FormTemplateDraftState {\n const path = propertyKeyToPointer(propertyKey)\n if (\n boundSchemaPaths(state.steps).has(path) ||\n !state.steps.some(step => step.uiKey === stepKey)\n ) {\n return state\n }\n return {\n ...state,\n steps: state.steps.map(step =>\n step.uiKey === stepKey\n ? {\n ...step,\n fields: [\n ...step.fields,\n { schemaPath: path, uiDefinition: {}, isPublic: false },\n ],\n }\n : step,\n ),\n }\n}\n"],"mappings":";;;AA6BA,IAAa,IAAkB;AAE/B,SAAgB,EAAmB,GAAqC;CACtE,OAAO,IAAI,IACT,EAA6B,CAAU,EAAE,KAAI,MAAK,EAAE,WAAW,CACjE;AACF;AAGA,SAAgB,EACd,GACa;CACb,OAAO,IAAI,IAAI,EAAM,SAAQ,MAAQ,EA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K,MAAK,EAAE,eAAe,CAAU;CAIxC,OAHI,CAAC,KAAS,CAAC,EAAM,MAAM,MAAK,MAAQ,EAAK,UAAU,CAAS,IACvD,IAEF;EACL,GAAG;EACH,OAAO,EAAM,MAAM,KAAI,MAAQ;GAC7B,IAAM,IAAS,EAAK,OAAO,QAAO,MAAK,EAAE,eAAe,CAAU;GAIlE,OAHI,EAAK,UAAU,KACjB,EAAO,OAAO,KAAK,IAAI,GAAG,CAAO,GAAG,GAAG,CAAK,GAEvC;IAAE,GAAG;IAAM;GAAO;EAC3B,CAAC;CACH;AACF;AAMA,SAAgB,EACd,GACA,GACA,GACwB;CACxB,IAAM,IAAO,EAAqB,CAAW;CAO7C,OALE,EAAiB,EAAM,KAAK,EAAE,IAAI,CAAI,KACtC,CAAC,EAAM,MAAM,MAAK,MAAQ,EAAK,UAAU,CAAO,IAEzC,IAEF;EACL,GAAG;EACH,OAAO,EAAM,MAAM,KAAI,MACrB,EAAK,UAAU,IACX;GACE,GAAG;GACH,QAAQ,CACN,GAAG,EAAK,QACR;IAAE,YAAY;IAAM,cAAc,CAAC;IAAG,UAAU;GAAM,CACxD;EACF,IACA,CACN;CACF;AACF"}
@@ -0,0 +1,35 @@
1
+ import { RJSFSchema } from '@rjsf/utils';
2
+ import { JsonSchemaVersionInfo } from '@sage-bionetworks/synapse-client';
3
+ /**
4
+ * The registered schema every FormTemplate schema extends. It declares the reserved
5
+ * `x-synapse-submissionContext` property. The version is pinned: moving to a newer base schema
6
+ * requires deciding how templates that reference this version are migrated.
7
+ */
8
+ export declare const ACCESS_REQUIREMENT_BASE_SCHEMA_ID = "org.sagebionetworks-AccessRequirementBaseSchema-1.0.0";
9
+ /** The JSON Schema organization that FormTemplate schemas are registered under. */
10
+ export declare const FORM_TEMPLATE_SCHEMA_ORGANIZATION = "org.sagebionetworks.act";
11
+ /** A registered schema's name, qualified by its organization; every version shares it. */
12
+ export type SchemaName = {
13
+ organizationName: string;
14
+ schemaName: string;
15
+ };
16
+ /**
17
+ * The organization and schema name that a template's schema versions are registered under.
18
+ * An existing template keeps those of the schema it already references, so renaming the
19
+ * template does not start registering under a new schema name. A new template derives the
20
+ * schema name from its name.
21
+ */
22
+ export declare function resolveFormTemplateSchemaName(templateName: string, existingSchema$id?: string): SchemaName;
23
+ /**
24
+ * The `$id` of a schema version: `<organization>-<schemaName>-<version>`. Without a version,
25
+ * the unversioned `<organization>-<schemaName>` prefix shared by every version.
26
+ */
27
+ export declare function formatSchema$id(name: SchemaName, version?: string): string;
28
+ /**
29
+ * The version to register next under a schema name: one major version above the highest
30
+ * registered version, or `1.0.0` when none is registered yet.
31
+ */
32
+ export declare function getNextSchemaVersion(registeredVersions: JsonSchemaVersionInfo[]): string;
33
+ /** The schema a new FormTemplate starts from: no fields beyond those of the base schema. */
34
+ export declare function createNewFormTemplateSchema(): RJSFSchema;
35
+ //# sourceMappingURL=formTemplateSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formTemplateSchema.d.ts","sourceRoot":"","sources":["../../../src/components/FormTemplateEditor/formTemplateSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AAExE;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,0DACW,CAAA;AAEzD,mFAAmF;AACnF,eAAO,MAAM,iCAAiC,4BAA4B,CAAA;AAI1E,0FAA0F;AAC1F,MAAM,MAAM,UAAU,GAAG;IAAE,gBAAgB,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAA;AAEzE;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAC3C,YAAY,EAAE,MAAM,EACpB,iBAAiB,CAAC,EAAE,MAAM,GACzB,UAAU,CAeZ;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,MAAM,UAGjE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,kBAAkB,EAAE,qBAAqB,EAAE,GAC1C,MAAM,CAQR;AAED,4FAA4F;AAC5F,wBAAgB,2BAA2B,IAAI,UAAU,CAMxD"}
@@ -0,0 +1,35 @@
1
+ import { toPascalCase as e } from "../../utils/functions/toPascalCase.js";
2
+ //#region src/components/FormTemplateEditor/formTemplateSchema.ts
3
+ var t = "org.sagebionetworks-AccessRequirementBaseSchema-1.0.0", n = "org.sagebionetworks.act", r = "FormTemplate";
4
+ function i(t, i) {
5
+ if (i) {
6
+ let [e, t] = i.split("-");
7
+ return {
8
+ organizationName: e,
9
+ schemaName: t
10
+ };
11
+ }
12
+ let a = e(t);
13
+ return {
14
+ organizationName: n,
15
+ schemaName: /^[A-Za-z]/.test(a) ? a : `${r}${a}`
16
+ };
17
+ }
18
+ function a(e, t) {
19
+ let n = `${e.organizationName}-${e.schemaName}`;
20
+ return t ? `${n}-${t}` : n;
21
+ }
22
+ function o(e) {
23
+ return `${Math.max(0, ...e.map((e) => Number.parseInt(e.semanticVersion?.split(".")[0] ?? "0", 10))) + 1}.0.0`;
24
+ }
25
+ function s() {
26
+ return {
27
+ $schema: "http://json-schema.org/draft-07/schema#",
28
+ type: "object",
29
+ allOf: [{ $ref: t }]
30
+ };
31
+ }
32
+ //#endregion
33
+ export { t as ACCESS_REQUIREMENT_BASE_SCHEMA_ID, n as FORM_TEMPLATE_SCHEMA_ORGANIZATION, s as createNewFormTemplateSchema, a as formatSchema$id, o as getNextSchemaVersion, i as resolveFormTemplateSchemaName };
34
+
35
+ //# sourceMappingURL=formTemplateSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formTemplateSchema.js","names":[],"sources":["../../../src/components/FormTemplateEditor/formTemplateSchema.ts"],"sourcesContent":["import { RJSFSchema } from '@rjsf/utils'\nimport { toPascalCase } from '@/utils/functions/toPascalCase'\nimport { JsonSchemaVersionInfo } from '@sage-bionetworks/synapse-client'\n\n/**\n * The registered schema every FormTemplate schema extends. It declares the reserved\n * `x-synapse-submissionContext` property. The version is pinned: moving to a newer base schema\n * requires deciding how templates that reference this version are migrated.\n */\nexport const ACCESS_REQUIREMENT_BASE_SCHEMA_ID =\n 'org.sagebionetworks-AccessRequirementBaseSchema-1.0.0'\n\n/** The JSON Schema organization that FormTemplate schemas are registered under. */\nexport const FORM_TEMPLATE_SCHEMA_ORGANIZATION = 'org.sagebionetworks.act'\n\nconst FALLBACK_SCHEMA_NAME = 'FormTemplate'\n\n/** A registered schema's name, qualified by its organization; every version shares it. */\nexport type SchemaName = { organizationName: string; schemaName: string }\n\n/**\n * The organization and schema name that a template's schema versions are registered under.\n * An existing template keeps those of the schema it already references, so renaming the\n * template does not start registering under a new schema name. A new template derives the\n * schema name from its name.\n */\nexport function resolveFormTemplateSchemaName(\n templateName: string,\n existingSchema$id?: string,\n): SchemaName {\n if (existingSchema$id) {\n // A schema $id is `<organization>-<schemaName>-<version>`; neither of the first two may\n // contain a dash.\n const [organizationName, schemaName] = existingSchema$id.split('-')\n return { organizationName, schemaName }\n }\n // Schema names only allow letters and digits and must start with a letter.\n const pascalCase = toPascalCase(templateName)\n return {\n organizationName: FORM_TEMPLATE_SCHEMA_ORGANIZATION,\n schemaName: /^[A-Za-z]/.test(pascalCase)\n ? pascalCase\n : `${FALLBACK_SCHEMA_NAME}${pascalCase}`,\n }\n}\n\n/**\n * The `$id` of a schema version: `<organization>-<schemaName>-<version>`. Without a version,\n * the unversioned `<organization>-<schemaName>` prefix shared by every version.\n */\nexport function formatSchema$id(name: SchemaName, version?: string) {\n const unversioned$id = `${name.organizationName}-${name.schemaName}`\n return version ? `${unversioned$id}-${version}` : unversioned$id\n}\n\n/**\n * The version to register next under a schema name: one major version above the highest\n * registered version, or `1.0.0` when none is registered yet.\n */\nexport function getNextSchemaVersion(\n registeredVersions: JsonSchemaVersionInfo[],\n): string {\n const highestMajor = Math.max(\n 0,\n ...registeredVersions.map(v =>\n Number.parseInt(v.semanticVersion?.split('.')[0] ?? '0', 10),\n ),\n )\n return `${highestMajor + 1}.0.0`\n}\n\n/** The schema a new FormTemplate starts from: no fields beyond those of the base schema. */\nexport function createNewFormTemplateSchema(): RJSFSchema {\n return {\n $schema: 'http://json-schema.org/draft-07/schema#',\n type: 'object',\n allOf: [{ $ref: ACCESS_REQUIREMENT_BASE_SCHEMA_ID }],\n }\n}\n"],"mappings":";;AASA,IAAa,IACX,yDAGW,IAAoC,2BAE3C,IAAuB;AAW7B,SAAgB,EACd,GACA,GACY;CACZ,IAAI,GAAmB;EAGrB,IAAM,CAAC,GAAkB,KAAc,EAAkB,MAAM,GAAG;EAClE,OAAO;GAAE;GAAkB;EAAW;CACxC;CAEA,IAAM,IAAa,EAAa,CAAY;CAC5C,OAAO;EACL,kBAAkB;EAClB,YAAY,YAAY,KAAK,CAAU,IACnC,IACA,GAAG,IAAuB;CAChC;AACF;AAMA,SAAgB,EAAgB,GAAkB,GAAkB;CAClE,IAAM,IAAiB,GAAG,EAAK,iBAAiB,GAAG,EAAK;CACxD,OAAO,IAAU,GAAG,EAAe,GAAG,MAAY;AACpD;AAMA,SAAgB,EACd,GACQ;CAOR,OAAO,GANc,KAAK,IACxB,GACA,GAAG,EAAmB,KAAI,MACxB,OAAO,SAAS,EAAE,iBAAiB,MAAM,GAAG,EAAE,MAAM,KAAK,EAAE,CAC7D,CAEQ,IAAe,EAAE;AAC7B;AAGA,SAAgB,IAA0C;CACxD,OAAO;EACL,SAAS;EACT,MAAM;EACN,OAAO,CAAC,EAAE,MAAM,EAAkC,CAAC;CACrD;AACF"}
@@ -4,13 +4,15 @@ import { RJSFSchema } from '@rjsf/utils';
4
4
  * outside this set surfaces in the UI as "advanced" and must be edited via the
5
5
  * raw JSON Schema view.
6
6
  */
7
- export type SimpleFieldType = 'text' | 'number' | 'boolean' | 'choice' | 'file';
7
+ export type SimpleFieldType = 'text' | 'number' | 'boolean' | 'choice' | 'multiChoice' | 'file';
8
8
  export declare const FIELD_TYPE_OPTIONS: {
9
9
  value: SimpleFieldType;
10
10
  label: string;
11
11
  }[];
12
12
  export declare function detectFieldType(prop: RJSFSchema | undefined): SimpleFieldType | null;
13
13
  export declare function fieldTypeLabel(type: SimpleFieldType | null): string;
14
+ /** The options a 'choice' (`enum`) or 'multiChoice' (`items.enum`) property declares; empty if none. */
15
+ export declare function choiceOptions(prop: RJSFSchema): string[];
14
16
  /** Build a fresh schema body for the given simple type, preserving label and help text. */
15
17
  export declare function applyFieldType(prev: RJSFSchema, type: SimpleFieldType): RJSFSchema;
16
18
  /** Derive a unique camelCase JSON property key from a display title. */
@@ -1 +1 @@
1
- {"version":3,"file":"schemaFieldUtils.d.ts","sourceRoot":"","sources":["../../../src/components/FormTemplateEditor/schemaFieldUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAA;AAE/E,eAAO,MAAM,kBAAkB,EAAE;IAAE,KAAK,EAAE,eAAe,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAMzE,CAAA;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,UAAU,GAAG,SAAS,GAC3B,eAAe,GAAG,IAAI,CAQxB;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,GAAG,MAAM,CAGnE;AAED,2FAA2F;AAC3F,wBAAgB,cAAc,CAC5B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,eAAe,GACpB,UAAU,CA4BZ;AAED,wEAAwE;AACxE,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,GACxB,MAAM,CAiBR;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGvD"}
1
+ {"version":3,"file":"schemaFieldUtils.d.ts","sourceRoot":"","sources":["../../../src/components/FormTemplateEditor/schemaFieldUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC;;;;GAIG;AACH,MAAM,MAAM,eAAe,GACvB,MAAM,GACN,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,aAAa,GACb,MAAM,CAAA;AAEV,eAAO,MAAM,kBAAkB,EAAE;IAAE,KAAK,EAAE,eAAe,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAOzE,CAAA;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,UAAU,GAAG,SAAS,GAC3B,eAAe,GAAG,IAAI,CAmBxB;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,GAAG,MAAM,CAGnE;AAED,wGAAwG;AACxG,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,EAAE,CAGxD;AAED,2FAA2F;AAC3F,wBAAgB,cAAc,CAC5B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,eAAe,GACpB,UAAU,CAiCZ;AAED,wEAAwE;AACxE,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,GACxB,MAAM,CAiBR;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGvD"}
@@ -14,7 +14,11 @@ var e = [
14
14
  },
15
15
  {
16
16
  value: "choice",
17
- label: "Multiple choice"
17
+ label: "Single choice"
18
+ },
19
+ {
20
+ value: "multiChoice",
21
+ label: "Multiple choice (select many)"
18
22
  },
19
23
  {
20
24
  value: "file",
@@ -22,16 +26,24 @@ var e = [
22
26
  }
23
27
  ];
24
28
  function t(e) {
25
- return !e || typeof e != "object" ? null : e.format === "synapse-filehandle-id" ? "file" : e.type === "string" && Array.isArray(e.enum) ? "choice" : e.type === "string" && !e.format ? "text" : e.type === "number" || e.type === "integer" ? "number" : e.type === "boolean" ? "boolean" : null;
29
+ if (!e || typeof e != "object") return null;
30
+ if (e.format === "synapse-filehandle-id") return "file";
31
+ if (e.type === "string" && Array.isArray(e.enum)) return "choice";
32
+ let t = e.items;
33
+ return e.type === "array" && e.uniqueItems === !0 && t?.type === "string" && Array.isArray(t.enum) ? "multiChoice" : e.type === "string" && !e.format ? "text" : e.type === "number" || e.type === "integer" ? "number" : e.type === "boolean" ? "boolean" : null;
26
34
  }
27
35
  function n(t) {
28
36
  return t === null ? "Advanced" : e.find((e) => e.value === t)?.label ?? "Advanced";
29
37
  }
30
- function r(e, t) {
38
+ function r(e) {
39
+ let t = e.enum ?? e.items?.enum;
40
+ return Array.isArray(t) ? t : [];
41
+ }
42
+ function i(e, t) {
31
43
  let n = {
32
44
  title: e.title,
33
45
  description: e.description
34
- };
46
+ }, i = r(e), a = i.length > 0 ? i : ["Option 1"];
35
47
  switch (t) {
36
48
  case "text":
37
49
  n.type = "string";
@@ -43,7 +55,13 @@ function r(e, t) {
43
55
  n.type = "boolean";
44
56
  break;
45
57
  case "choice":
46
- n.type = "string", n.enum = Array.isArray(e.enum) && e.enum.length > 0 ? e.enum : ["Option 1"];
58
+ n.type = "string", n.enum = a;
59
+ break;
60
+ case "multiChoice":
61
+ n.type = "array", n.items = {
62
+ type: "string",
63
+ enum: a
64
+ }, n.uniqueItems = !0;
47
65
  break;
48
66
  case "file":
49
67
  n.type = "number", n.format = "synapse-filehandle-id";
@@ -51,16 +69,16 @@ function r(e, t) {
51
69
  }
52
70
  return n;
53
71
  }
54
- function i(e, t) {
72
+ function a(e, t) {
55
73
  let n = e.toLowerCase().replace(/[^a-z0-9\s]/g, "").trim().split(/\s+/).filter(Boolean).map((e, t) => t === 0 ? e : e.charAt(0).toUpperCase() + e.slice(1)).join("") || "field", r = n, i = 1;
56
74
  for (; t.has(r);) i += 1, r = `${n}${i}`;
57
75
  return r;
58
76
  }
59
- function a(e) {
77
+ function o(e) {
60
78
  let t = e.replace(/[^A-Za-z0-9_]/g, "");
61
79
  return /^[0-9]/.test(t) ? `_${t}` : t;
62
80
  }
63
81
  //#endregion
64
- export { e as FIELD_TYPE_OPTIONS, r as applyFieldType, t as detectFieldType, n as fieldTypeLabel, i as generatePropertyKey, a as sanitizePropertyKey };
82
+ export { e as FIELD_TYPE_OPTIONS, i as applyFieldType, r as choiceOptions, t as detectFieldType, n as fieldTypeLabel, a as generatePropertyKey, o as sanitizePropertyKey };
65
83
 
66
84
  //# sourceMappingURL=schemaFieldUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemaFieldUtils.js","names":[],"sources":["../../../src/components/FormTemplateEditor/schemaFieldUtils.ts"],"sourcesContent":["import { RJSFSchema } from '@rjsf/utils'\n\n/**\n * The set of property shapes the simple editor knows how to author. Anything\n * outside this set surfaces in the UI as \"advanced\" and must be edited via the\n * raw JSON Schema view.\n */\nexport type SimpleFieldType = 'text' | 'number' | 'boolean' | 'choice' | 'file'\n\nexport const FIELD_TYPE_OPTIONS: { value: SimpleFieldType; label: string }[] = [\n { value: 'text', label: 'Text' },\n { value: 'number', label: 'Number' },\n { value: 'boolean', label: 'Yes / No' },\n { value: 'choice', label: 'Multiple choice' },\n { value: 'file', label: 'File upload' },\n]\n\nexport function detectFieldType(\n prop: RJSFSchema | undefined,\n): SimpleFieldType | null {\n if (!prop || typeof prop !== 'object') return null\n if (prop.format === 'synapse-filehandle-id') return 'file'\n if (prop.type === 'string' && Array.isArray(prop.enum)) return 'choice'\n if (prop.type === 'string' && !prop.format) return 'text'\n if (prop.type === 'number' || prop.type === 'integer') return 'number'\n if (prop.type === 'boolean') return 'boolean'\n return null\n}\n\nexport function fieldTypeLabel(type: SimpleFieldType | null): string {\n if (type === null) return 'Advanced'\n return FIELD_TYPE_OPTIONS.find(opt => opt.value === type)?.label ?? 'Advanced'\n}\n\n/** Build a fresh schema body for the given simple type, preserving label and help text. */\nexport function applyFieldType(\n prev: RJSFSchema,\n type: SimpleFieldType,\n): RJSFSchema {\n const next: RJSFSchema = {\n title: prev.title,\n description: prev.description,\n }\n switch (type) {\n case 'text':\n next.type = 'string'\n break\n case 'number':\n next.type = 'number'\n break\n case 'boolean':\n next.type = 'boolean'\n break\n case 'choice':\n next.type = 'string'\n next.enum =\n Array.isArray(prev.enum) && prev.enum.length > 0\n ? prev.enum\n : ['Option 1']\n break\n case 'file':\n next.type = 'number'\n next.format = 'synapse-filehandle-id'\n break\n }\n return next\n}\n\n/** Derive a unique camelCase JSON property key from a display title. */\nexport function generatePropertyKey(\n title: string,\n existingKeys: Set<string>,\n): string {\n const base =\n title\n .toLowerCase()\n .replace(/[^a-z0-9\\s]/g, '')\n .trim()\n .split(/\\s+/)\n .filter(Boolean)\n .map((w, i) => (i === 0 ? w : w.charAt(0).toUpperCase() + w.slice(1)))\n .join('') || 'field'\n let key = base\n let i = 1\n while (existingKeys.has(key)) {\n i += 1\n key = `${base}${i}`\n }\n return key\n}\n\n/**\n * Sanitize a manually-typed property key: strip characters that aren't\n * valid in a JSON Schema property key used as a JS identifier, preserving\n * the editor's casing (unlike `generatePropertyKey`, which derives a\n * camelCase key from a display title).\n */\nexport function sanitizePropertyKey(raw: string): string {\n const stripped = raw.replace(/[^A-Za-z0-9_]/g, '')\n return /^[0-9]/.test(stripped) ? `_${stripped}` : stripped\n}\n"],"mappings":";AASA,IAAa,IAAkE;CAC7E;EAAE,OAAO;EAAQ,OAAO;CAAO;CAC/B;EAAE,OAAO;EAAU,OAAO;CAAS;CACnC;EAAE,OAAO;EAAW,OAAO;CAAW;CACtC;EAAE,OAAO;EAAU,OAAO;CAAkB;CAC5C;EAAE,OAAO;EAAQ,OAAO;CAAc;AACxC;AAEA,SAAgB,EACd,GACwB;CAOxB,OANI,CAAC,KAAQ,OAAO,KAAS,WAAiB,OAC1C,EAAK,WAAW,0BAAgC,SAChD,EAAK,SAAS,YAAY,MAAM,QAAQ,EAAK,IAAI,IAAU,WAC3D,EAAK,SAAS,YAAY,CAAC,EAAK,SAAe,SAC/C,EAAK,SAAS,YAAY,EAAK,SAAS,YAAkB,WAC1D,EAAK,SAAS,YAAkB,YAC7B;AACT;AAEA,SAAgB,EAAe,GAAsC;CAEnE,OADI,MAAS,OAAa,aACnB,EAAmB,MAAK,MAAO,EAAI,UAAU,CAAI,GAAG,SAAS;AACtE;AAGA,SAAgB,EACd,GACA,GACY;CACZ,IAAM,IAAmB;EACvB,OAAO,EAAK;EACZ,aAAa,EAAK;CACpB;CACA,QAAQ,GAAR;EACE,KAAK;GACH,EAAK,OAAO;GACZ;EACF,KAAK;GACH,EAAK,OAAO;GACZ;EACF,KAAK;GACH,EAAK,OAAO;GACZ;EACF,KAAK;GAEH,AADA,EAAK,OAAO,UACZ,EAAK,OACH,MAAM,QAAQ,EAAK,IAAI,KAAK,EAAK,KAAK,SAAS,IAC3C,EAAK,OACL,CAAC,UAAU;GACjB;EACF,KAAK;GAEH,AADA,EAAK,OAAO,UACZ,EAAK,SAAS;GACd;CACJ;CACA,OAAO;AACT;AAGA,SAAgB,EACd,GACA,GACQ;CACR,IAAM,IACJ,EACG,YAAY,EACZ,QAAQ,gBAAgB,EAAE,EAC1B,KAAK,EACL,MAAM,KAAK,EACX,OAAO,OAAO,EACd,KAAK,GAAG,MAAO,MAAM,IAAI,IAAI,EAAE,OAAO,CAAC,EAAE,YAAY,IAAI,EAAE,MAAM,CAAC,CAAE,EACpE,KAAK,EAAE,KAAK,SACb,IAAM,GACN,IAAI;CACR,OAAO,EAAa,IAAI,CAAG,IAEzB,AADA,KAAK,GACL,IAAM,GAAG,IAAO;CAElB,OAAO;AACT;AAQA,SAAgB,EAAoB,GAAqB;CACvD,IAAM,IAAW,EAAI,QAAQ,kBAAkB,EAAE;CACjD,OAAO,SAAS,KAAK,CAAQ,IAAI,IAAI,MAAa;AACpD"}
1
+ {"version":3,"file":"schemaFieldUtils.js","names":[],"sources":["../../../src/components/FormTemplateEditor/schemaFieldUtils.ts"],"sourcesContent":["import { RJSFSchema } from '@rjsf/utils'\n\n/**\n * The set of property shapes the simple editor knows how to author. Anything\n * outside this set surfaces in the UI as \"advanced\" and must be edited via the\n * raw JSON Schema view.\n */\nexport type SimpleFieldType =\n | 'text'\n | 'number'\n | 'boolean'\n | 'choice'\n | 'multiChoice'\n | 'file'\n\nexport const FIELD_TYPE_OPTIONS: { value: SimpleFieldType; label: string }[] = [\n { value: 'text', label: 'Text' },\n { value: 'number', label: 'Number' },\n { value: 'boolean', label: 'Yes / No' },\n { value: 'choice', label: 'Single choice' },\n { value: 'multiChoice', label: 'Multiple choice (select many)' },\n { value: 'file', label: 'File upload' },\n]\n\nexport function detectFieldType(\n prop: RJSFSchema | undefined,\n): SimpleFieldType | null {\n if (!prop || typeof prop !== 'object') return null\n if (prop.format === 'synapse-filehandle-id') return 'file'\n if (prop.type === 'string' && Array.isArray(prop.enum)) return 'choice'\n // RJSF renders an array as a multi-select only when `uniqueItems` is set; without it the\n // property renders as a repeatable list, which the simple editor does not author.\n const items = prop.items as RJSFSchema | undefined\n if (\n prop.type === 'array' &&\n prop.uniqueItems === true &&\n items?.type === 'string' &&\n Array.isArray(items.enum)\n ) {\n return 'multiChoice'\n }\n if (prop.type === 'string' && !prop.format) return 'text'\n if (prop.type === 'number' || prop.type === 'integer') return 'number'\n if (prop.type === 'boolean') return 'boolean'\n return null\n}\n\nexport function fieldTypeLabel(type: SimpleFieldType | null): string {\n if (type === null) return 'Advanced'\n return FIELD_TYPE_OPTIONS.find(opt => opt.value === type)?.label ?? 'Advanced'\n}\n\n/** The options a 'choice' (`enum`) or 'multiChoice' (`items.enum`) property declares; empty if none. */\nexport function choiceOptions(prop: RJSFSchema): string[] {\n const options = prop.enum ?? (prop.items as RJSFSchema | undefined)?.enum\n return Array.isArray(options) ? (options as string[]) : []\n}\n\n/** Build a fresh schema body for the given simple type, preserving label and help text. */\nexport function applyFieldType(\n prev: RJSFSchema,\n type: SimpleFieldType,\n): RJSFSchema {\n const next: RJSFSchema = {\n title: prev.title,\n description: prev.description,\n }\n const existingChoices = choiceOptions(prev)\n // A choice field needs at least one option to be answerable.\n const choices = existingChoices.length > 0 ? existingChoices : ['Option 1']\n switch (type) {\n case 'text':\n next.type = 'string'\n break\n case 'number':\n next.type = 'number'\n break\n case 'boolean':\n next.type = 'boolean'\n break\n case 'choice':\n next.type = 'string'\n next.enum = choices\n break\n case 'multiChoice':\n next.type = 'array'\n next.items = { type: 'string', enum: choices }\n next.uniqueItems = true\n break\n case 'file':\n next.type = 'number'\n next.format = 'synapse-filehandle-id'\n break\n }\n return next\n}\n\n/** Derive a unique camelCase JSON property key from a display title. */\nexport function generatePropertyKey(\n title: string,\n existingKeys: Set<string>,\n): string {\n const base =\n title\n .toLowerCase()\n .replace(/[^a-z0-9\\s]/g, '')\n .trim()\n .split(/\\s+/)\n .filter(Boolean)\n .map((w, i) => (i === 0 ? w : w.charAt(0).toUpperCase() + w.slice(1)))\n .join('') || 'field'\n let key = base\n let i = 1\n while (existingKeys.has(key)) {\n i += 1\n key = `${base}${i}`\n }\n return key\n}\n\n/**\n * Sanitize a manually-typed property key: strip characters that aren't\n * valid in a JSON Schema property key used as a JS identifier, preserving\n * the editor's casing (unlike `generatePropertyKey`, which derives a\n * camelCase key from a display title).\n */\nexport function sanitizePropertyKey(raw: string): string {\n const stripped = raw.replace(/[^A-Za-z0-9_]/g, '')\n return /^[0-9]/.test(stripped) ? `_${stripped}` : stripped\n}\n"],"mappings":";AAeA,IAAa,IAAkE;CAC7E;EAAE,OAAO;EAAQ,OAAO;CAAO;CAC/B;EAAE,OAAO;EAAU,OAAO;CAAS;CACnC;EAAE,OAAO;EAAW,OAAO;CAAW;CACtC;EAAE,OAAO;EAAU,OAAO;CAAgB;CAC1C;EAAE,OAAO;EAAe,OAAO;CAAgC;CAC/D;EAAE,OAAO;EAAQ,OAAO;CAAc;AACxC;AAEA,SAAgB,EACd,GACwB;CACxB,IAAI,CAAC,KAAQ,OAAO,KAAS,UAAU,OAAO;CAC9C,IAAI,EAAK,W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OAAO,OAAO,EACd,KAAK,GAAG,MAAO,MAAM,IAAI,IAAI,EAAE,OAAO,CAAC,EAAE,YAAY,IAAI,EAAE,MAAM,CAAC,CAAE,EACpE,KAAK,EAAE,KAAK,SACb,IAAM,GACN,IAAI;CACR,OAAO,EAAa,IAAI,CAAG,IAEzB,AADA,KAAK,GACL,IAAM,GAAG,IAAO;CAElB,OAAO;AACT;AAQA,SAAgB,EAAoB,GAAqB;CACvD,IAAM,IAAW,EAAI,QAAQ,kBAAkB,EAAE;CACjD,OAAO,SAAS,KAAK,CAAQ,IAAI,IAAI,MAAa;AACpD"}
@@ -0,0 +1,23 @@
1
+ import { FormTemplateField } from '@sage-bionetworks/synapse-client';
2
+ import { EditableFormTemplateStep } from './utils';
3
+ /** Field library rows are plain draggables, not sortables: dropping one binds it to a step. */
4
+ export declare const FIELD_DRAG_TYPE = "field";
5
+ /** `data` a field library row carries so a drop can name the property to bind. */
6
+ export declare function fieldDragData(propertyKey: string): {
7
+ propertyKey: string;
8
+ };
9
+ /** The property a dropped field library row names, or null for any other drag's `data`. */
10
+ export declare function readFieldDragData(data: unknown): string | null;
11
+ export declare const STEP_SORTABLE_TYPE = "step";
12
+ /** Every step shares one sortable group, so steps only ever reorder among themselves. */
13
+ export declare const STEP_SORTABLE_GROUP = "steps";
14
+ export declare const SLOT_SORTABLE_TYPE = "slot";
15
+ export declare function stepSortableId(step: EditableFormTemplateStep): string;
16
+ /**
17
+ * The sortable group shared by one step's slot rows. Doubles as the id of that step's slot-list
18
+ * droppable, which is what lets `@dnd-kit/helpers`' `move` resolve a drop on an empty step's list
19
+ * to the group it should insert into.
20
+ */
21
+ export declare function slotGroupId(step: EditableFormTemplateStep): string;
22
+ export declare function slotSortableId(field: FormTemplateField): string;
23
+ //# sourceMappingURL=sortableIds.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sortableIds.d.ts","sourceRoot":"","sources":["../../../src/components/FormTemplateEditor/sortableIds.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAElD,+FAA+F;AAC/F,eAAO,MAAM,eAAe,UAAU,CAAA;AAEtC,kFAAkF;AAClF,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM;;EAEhD;AAED,2FAA2F;AAC3F,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAI9D;AAED,eAAO,MAAM,kBAAkB,SAAS,CAAA;AACxC,yFAAyF;AACzF,eAAO,MAAM,mBAAmB,UAAU,CAAA;AAE1C,eAAO,MAAM,kBAAkB,SAAS,CAAA;AAExC,wBAAgB,cAAc,CAAC,IAAI,EAAE,wBAAwB,GAAG,MAAM,CAErE;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,wBAAwB,GAAG,MAAM,CAElE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,CAE/D"}
@@ -0,0 +1,24 @@
1
+ //#region src/components/FormTemplateEditor/sortableIds.ts
2
+ var e = "field";
3
+ function t(e) {
4
+ return { propertyKey: e };
5
+ }
6
+ function n(e) {
7
+ if (typeof e != "object" || !e) return null;
8
+ let { propertyKey: t } = e;
9
+ return typeof t == "string" && t ? t : null;
10
+ }
11
+ var r = "step", i = "steps", a = "slot";
12
+ function o(e) {
13
+ return `step:${e.uiKey}`;
14
+ }
15
+ function s(e) {
16
+ return `slots:${e.uiKey}`;
17
+ }
18
+ function c(e) {
19
+ return `slot:${e.schemaPath}`;
20
+ }
21
+ //#endregion
22
+ export { e as FIELD_DRAG_TYPE, a as SLOT_SORTABLE_TYPE, i as STEP_SORTABLE_GROUP, r as STEP_SORTABLE_TYPE, t as fieldDragData, n as readFieldDragData, s as slotGroupId, c as slotSortableId, o as stepSortableId };
23
+
24
+ //# sourceMappingURL=sortableIds.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sortableIds.js","names":[],"sources":["../../../src/components/FormTemplateEditor/sortableIds.ts"],"sourcesContent":["/*\n * The drag-and-drop identity scheme shared by the editor's draggables and the drag adapter that\n * resolves their events back to a step or a field. Lives apart from the components so the adapter\n * can do that without importing the component tree.\n */\nimport { FormTemplateField } from '@sage-bionetworks/synapse-client'\nimport { EditableFormTemplateStep } from './utils'\n\n/** Field library rows are plain draggables, not sortables: dropping one binds it to a step. */\nexport const FIELD_DRAG_TYPE = 'field'\n\n/** `data` a field library row carries so a drop can name the property to bind. */\nexport function fieldDragData(propertyKey: string) {\n return { propertyKey }\n}\n\n/** The property a dropped field library row names, or null for any other drag's `data`. */\nexport function readFieldDragData(data: unknown): string | null {\n if (data == null || typeof data !== 'object') return null\n const { propertyKey } = data as Record<string, unknown>\n return typeof propertyKey === 'string' && propertyKey ? propertyKey : null\n}\n\nexport const STEP_SORTABLE_TYPE = 'step'\n/** Every step shares one sortable group, so steps only ever reorder among themselves. */\nexport const STEP_SORTABLE_GROUP = 'steps'\n\nexport const SLOT_SORTABLE_TYPE = 'slot'\n\nexport function stepSortableId(step: EditableFormTemplateStep): string {\n return `step:${step.uiKey}`\n}\n\n/**\n * The sortable group shared by one step's slot rows. Doubles as the id of that step's slot-list\n * droppable, which is what lets `@dnd-kit/helpers`' `move` resolve a drop on an empty step's list\n * to the group it should insert into.\n */\nexport function slotGroupId(step: EditableFormTemplateStep): string {\n return `slots:${step.uiKey}`\n}\n\nexport function slotSortableId(field: FormTemplateField): string {\n return `slot:${field.schemaPath}`\n}\n"],"mappings":";AASA,IAAa,IAAkB;AAG/B,SAAgB,EAAc,GAAqB;CACjD,OAAO,EAAE,eAAY;AACvB;AAGA,SAAgB,EAAkB,GAA8B;CAC9D,IAAoB,OAAO,KAAS,aAAhC,GAA0C,OAAO;CACrD,IAAM,EAAE,mBAAgB;CACxB,OAAO,OAAO,KAAgB,YAAY,IAAc,IAAc;AACxE;AAEA,IAAa,IAAqB,QAErB,IAAsB,SAEtB,IAAqB;AAElC,SAAgB,EAAe,GAAwC;CACrE,OAAO,QAAQ,EAAK;AACtB;AAOA,SAAgB,EAAY,GAAwC;CAClE,OAAO,SAAS,EAAK;AACvB;AAEA,SAAgB,EAAe,GAAkC;CAC/D,OAAO,QAAQ,EAAM;AACvB"}
@@ -0,0 +1,33 @@
1
+ import { RJSFSchema } from '@rjsf/utils';
2
+ import { FormTemplate } from '@sage-bionetworks/synapse-client';
3
+ import { ResolvedSchemaProperty, SchemaPropertyContext } from '@/utils/jsonschema/submissionContext';
4
+ import { EditableFormTemplateStep } from './utils';
5
+ /** The editing state and mutations for an in-progress FormTemplate draft. */
6
+ export interface FormTemplateDraft {
7
+ name: string;
8
+ setName: (name: string) => void;
9
+ jsonSchema: RJSFSchema;
10
+ setJsonSchema: (jsonSchema: RJSFSchema) => void;
11
+ steps: EditableFormTemplateStep[];
12
+ setSteps: (steps: EditableFormTemplateStep[]) => void;
13
+ editingPropertyKey: string | null;
14
+ setEditingPropertyKey: (key: string | null) => void;
15
+ /** The `schemaPath` of every field bound to a step. */
16
+ usedPaths: Set<string>;
17
+ existingPropertyKeys: Set<string>;
18
+ /** Schema properties that no step binds yet. */
19
+ unboundProperties: ResolvedSchemaProperty[];
20
+ handleCreateField: () => void;
21
+ renamePropertyKey: (oldKey: string, newKey: string) => void;
22
+ handleUpdateProperty: (key: string, patch: Partial<RJSFSchema>) => void;
23
+ handleReplaceProperty: (key: string, next: RJSFSchema) => void;
24
+ handleChangeRequired: (key: string, isRequired: boolean) => void;
25
+ handleChangeContext: (key: string, context: SchemaPropertyContext) => void;
26
+ handleRemoveProperty: (key: string) => void;
27
+ moveStep: (fromIndex: number, toIndex: number) => void;
28
+ moveSlot: (schemaPath: string, toStepKey: string, toIndex: number) => void;
29
+ bindField: (propertyKey: string, stepKey: string) => void;
30
+ previewTemplate: FormTemplate;
31
+ }
32
+ export declare function useFormTemplateDraft(initialTemplate?: FormTemplate, initialJsonSchema?: RJSFSchema): FormTemplateDraft;
33
+ //# sourceMappingURL=useFormTemplateDraft.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFormTemplateDraft.d.ts","sourceRoot":"","sources":["../../../src/components/FormTemplateEditor/useFormTemplateDraft.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AAE/D,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,sCAAsC,CAAA;AAkB7C,OAAO,EAEL,wBAAwB,EAGzB,MAAM,SAAS,CAAA;AAEhB,6EAA6E;AAC7E,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/B,UAAU,EAAE,UAAU,CAAA;IACtB,aAAa,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAA;IAC/C,KAAK,EAAE,wBAAwB,EAAE,CAAA;IACjC,QAAQ,EAAE,CAAC,KAAK,EAAE,wBAAwB,EAAE,KAAK,IAAI,CAAA;IACrD,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,qBAAqB,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;IACnD,uDAAuD;IACvD,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACtB,oBAAoB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACjC,gDAAgD;IAChD,iBAAiB,EAAE,sBAAsB,EAAE,CAAA;IAC3C,iBAAiB,EAAE,MAAM,IAAI,CAAA;IAC7B,iBAAiB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3D,oBAAoB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,IAAI,CAAA;IACvE,qBAAqB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,KAAK,IAAI,CAAA;IAC9D,oBAAoB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,KAAK,IAAI,CAAA;IAChE,mBAAmB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,qBAAqB,KAAK,IAAI,CAAA;IAC1E,oBAAoB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3C,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IACtD,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IAC1E,SAAS,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IACzD,eAAe,EAAE,YAAY,CAAA;CAC9B;AAED,wBAAgB,oBAAoB,CAClC,eAAe,CAAC,EAAE,YAAY,EAC9B,iBAAiB,CAAC,EAAE,UAAU,GAC7B,iBAAiB,CAsHnB"}
@@ -0,0 +1,59 @@
1
+ import { createNewFormTemplateSchema as e } from "./formTemplateSchema.js";
2
+ import { createEditableStep as t, toEditableSteps as n, toFormTemplateSteps as r } from "./utils.js";
3
+ import { bindField as i, boundSchemaPaths as a, changeContext as o, changeRequired as s, createField as c, listUnboundProperties as l, moveSlot as u, moveStep as d, removeProperty as f, renamePropertyKey as p, replaceProperty as m, schemaPropertyKeys as h, updateProperty as g } from "./formTemplateDraftState.js";
4
+ import { useCallback as _, useMemo as v, useState as y } from "react";
5
+ //#region src/components/FormTemplateEditor/useFormTemplateDraft.ts
6
+ function b(b, x) {
7
+ let [S, C] = y(b?.name ?? ""), [w, T] = y(() => ({
8
+ jsonSchema: x ?? e(),
9
+ steps: b ? n(b.steps) : [t()],
10
+ editingPropertyKey: null
11
+ })), { jsonSchema: E, steps: D, editingPropertyKey: O } = w;
12
+ return {
13
+ name: S,
14
+ setName: C,
15
+ jsonSchema: E,
16
+ setJsonSchema: _((e) => T((t) => ({
17
+ ...t,
18
+ jsonSchema: e
19
+ })), []),
20
+ steps: D,
21
+ setSteps: _((e) => T((t) => ({
22
+ ...t,
23
+ steps: e
24
+ })), []),
25
+ editingPropertyKey: O,
26
+ setEditingPropertyKey: _((e) => T((t) => ({
27
+ ...t,
28
+ editingPropertyKey: e
29
+ })), []),
30
+ usedPaths: v(() => a(D), [D]),
31
+ existingPropertyKeys: v(() => h(E), [E]),
32
+ unboundProperties: v(() => l(E, D), [E, D]),
33
+ handleCreateField: _(() => T(c), []),
34
+ renamePropertyKey: _((e, t) => T((n) => p(n, e, t)), []),
35
+ handleUpdateProperty: _((e, t) => T((n) => g(n, e, t)), []),
36
+ handleReplaceProperty: _((e, t) => T((n) => m(n, e, t)), []),
37
+ handleChangeRequired: _((e, t) => T((n) => s(n, e, t)), []),
38
+ handleChangeContext: _((e, t) => T((n) => o(n, e, t)), []),
39
+ handleRemoveProperty: _((e) => T((t) => f(t, e)), []),
40
+ moveStep: _((e, t) => T((n) => d(n, e, t)), []),
41
+ moveSlot: _((e, t, n) => T((r) => u(r, e, t, n)), []),
42
+ bindField: _((e, t) => T((n) => i(n, e, t)), []),
43
+ previewTemplate: v(() => ({
44
+ ...b,
45
+ name: S,
46
+ schema$id: E.$id ?? "",
47
+ steps: r(D)
48
+ }), [
49
+ b,
50
+ S,
51
+ E.$id,
52
+ D
53
+ ])
54
+ };
55
+ }
56
+ //#endregion
57
+ export { b as useFormTemplateDraft };
58
+
59
+ //# sourceMappingURL=useFormTemplateDraft.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFormTemplateDraft.js","names":[],"sources":["../../../src/components/FormTemplateEditor/useFormTemplateDraft.ts"],"sourcesContent":["/*\n * Editing state for the FormTemplateEditor: a thin React shell over the pure transitions in\n * `formTemplateDraftState`. Has no knowledge of persistence — callers read `jsonSchema`/`name`/\n * `steps` to save, and seed the initial values from an existing template when editing one.\n */\nimport { RJSFSchema } from '@rjsf/utils'\nimport { FormTemplate } from '@sage-bionetworks/synapse-client'\nimport { useCallback, useMemo, useState } from 'react'\nimport {\n ResolvedSchemaProperty,\n SchemaPropertyContext,\n} from '@/utils/jsonschema/submissionContext'\nimport {\n bindField,\n boundSchemaPaths,\n changeContext,\n changeRequired,\n createField,\n FormTemplateDraftState,\n listUnboundProperties,\n moveSlot,\n moveStep,\n removeProperty,\n renamePropertyKey,\n replaceProperty,\n schemaPropertyKeys,\n updateProperty,\n} from './formTemplateDraftState'\nimport { createNewFormTemplateSchema } from './formTemplateSchema'\nimport {\n createEditableStep,\n EditableFormTemplateStep,\n toEditableSteps,\n toFormTemplateSteps,\n} from './utils'\n\n/** The editing state and mutations for an in-progress FormTemplate draft. */\nexport interface FormTemplateDraft {\n name: string\n setName: (name: string) => void\n jsonSchema: RJSFSchema\n setJsonSchema: (jsonSchema: RJSFSchema) => void\n steps: EditableFormTemplateStep[]\n setSteps: (steps: EditableFormTemplateStep[]) => void\n editingPropertyKey: string | null\n setEditingPropertyKey: (key: string | null) => void\n /** The `schemaPath` of every field bound to a step. */\n usedPaths: Set<string>\n existingPropertyKeys: Set<string>\n /** Schema properties that no step binds yet. */\n unboundProperties: ResolvedSchemaProperty[]\n handleCreateField: () => void\n renamePropertyKey: (oldKey: string, newKey: string) => void\n handleUpdateProperty: (key: string, patch: Partial<RJSFSchema>) => void\n handleReplaceProperty: (key: string, next: RJSFSchema) => void\n handleChangeRequired: (key: string, isRequired: boolean) => void\n handleChangeContext: (key: string, context: SchemaPropertyContext) => void\n handleRemoveProperty: (key: string) => void\n moveStep: (fromIndex: number, toIndex: number) => void\n moveSlot: (schemaPath: string, toStepKey: string, toIndex: number) => void\n bindField: (propertyKey: string, stepKey: string) => void\n previewTemplate: FormTemplate\n}\n\nexport function useFormTemplateDraft(\n initialTemplate?: FormTemplate,\n initialJsonSchema?: RJSFSchema,\n): FormTemplateDraft {\n const [name, setName] = useState(initialTemplate?.name ?? '')\n const [draft, setDraft] = useState<FormTemplateDraftState>(() => ({\n jsonSchema: initialJsonSchema ?? createNewFormTemplateSchema(),\n steps: initialTemplate\n ? toEditableSteps(initialTemplate.steps)\n : [createEditableStep()],\n editingPropertyKey: null,\n }))\n const { jsonSchema, steps, editingPropertyKey } = draft\n\n const setJsonSchema = useCallback(\n (next: RJSFSchema) => setDraft(prev => ({ ...prev, jsonSchema: next })),\n [],\n )\n const setSteps = useCallback(\n (next: EditableFormTemplateStep[]) =>\n setDraft(prev => ({ ...prev, steps: next })),\n [],\n )\n const setEditingPropertyKey = useCallback(\n (key: string | null) =>\n setDraft(prev => ({ ...prev, editingPropertyKey: key })),\n [],\n )\n\n const usedPaths = useMemo(() => boundSchemaPaths(steps), [steps])\n const existingPropertyKeys = useMemo(\n () => schemaPropertyKeys(jsonSchema),\n [jsonSchema],\n )\n const unboundProperties = useMemo(\n () => listUnboundProperties(jsonSchema, steps),\n [jsonSchema, steps],\n )\n\n // Every transition reads the latest state through the updater, so several mutations batched in\n // one event compose instead of each seeing the same render-time snapshot.\n const handleCreateField = useCallback(() => setDraft(createField), [])\n const handleRenamePropertyKey = useCallback(\n (oldKey: string, newKey: string) =>\n setDraft(prev => renamePropertyKey(prev, oldKey, newKey)),\n [],\n )\n const handleUpdateProperty = useCallback(\n (key: string, patch: Partial<RJSFSchema>) =>\n setDraft(prev => updateProperty(prev, key, patch)),\n [],\n )\n const handleReplaceProperty = useCallback(\n (key: string, next: RJSFSchema) =>\n setDraft(prev => replaceProperty(prev, key, next)),\n [],\n )\n const handleChangeRequired = useCallback(\n (key: string, isRequired: boolean) =>\n setDraft(prev => changeRequired(prev, key, isRequired)),\n [],\n )\n const handleChangeContext = useCallback(\n (key: string, context: SchemaPropertyContext) =>\n setDraft(prev => changeContext(prev, key, context)),\n [],\n )\n const handleRemoveProperty = useCallback(\n (key: string) => setDraft(prev => removeProperty(prev, key)),\n [],\n )\n const handleMoveStep = useCallback(\n (fromIndex: number, toIndex: number) =>\n setDraft(prev => moveStep(prev, fromIndex, toIndex)),\n [],\n )\n const handleMoveSlot = useCallback(\n (schemaPath: string, toStepKey: string, toIndex: number) =>\n setDraft(prev => moveSlot(prev, schemaPath, toStepKey, toIndex)),\n [],\n )\n const handleBindField = useCallback(\n (propertyKey: string, stepKey: string) =>\n setDraft(prev => bindField(prev, propertyKey, stepKey)),\n [],\n )\n\n const previewTemplate: FormTemplate = useMemo(\n () => ({\n ...initialTemplate,\n name,\n schema$id: (jsonSchema.$id as string) ?? '',\n steps: toFormTemplateSteps(steps),\n }),\n [initialTemplate, name, jsonSchema.$id, steps],\n )\n\n return {\n name,\n setName,\n jsonSchema,\n setJsonSchema,\n steps,\n setSteps,\n editingPropertyKey,\n setEditingPropertyKey,\n usedPaths,\n existingPropertyKeys,\n unboundProperties,\n handleCreateField,\n renamePropertyKey: handleRenamePropertyKey,\n handleUpdateProperty,\n handleReplaceProperty,\n handleChangeRequired,\n handleChangeContext,\n handleRemoveProperty,\n moveStep: handleMoveStep,\n moveSlot: handleMoveSlot,\n bindField: handleBindField,\n previewTemplate,\n }\n}\n"],"mappings":";;;;;AAgEA,SAAgB,EACd,GACA,GACmB;CACnB,IAAM,CAAC,GAAM,KAAW,EAAS,GAAiB,QAAQ,EAAE,GACtD,CAAC,GAAO,KAAY,SAAwC;EAChE,YAAY,KAAqB,EAA4B;EAC7D,OAAO,IACH,EAAgB,EAAgB,KAAK,IACrC,CAAC,EAAmB,CAAC;EACzB,oBAAoB;CACtB,EAAE,GACI,EAAE,eAAY,UAAO,0BAAuB;CAqFlD,OAAO;EACL;EACA;EACA;EACA,eAvFoB,GACnB,MAAqB,GAAS,OAAS;GAAE,GAAG;GAAM,YAAY;EAAK,EAAE,GACtE,CAAC,CAqFD;EACA;EACA,UArFe,GACd,MACC,GAAS,OAAS;GAAE,GAAG;GAAM,OAAO;EAAK,E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kCU;EACX,iBAhCoC,SAC7B;GACL,GAAG;GACH;GACA,WAAY,EAAW,OAAkB;GACzC,OAAO,EAAoB,CAAK;EAClC,IACA;GAAC;GAAiB;GAAM,EAAW;GAAK;EAAK,CAyB7C;CACF;AACF"}
@@ -0,0 +1,9 @@
1
+ import { DragEndEvent, DragOverEvent } from '@dnd-kit/react';
2
+ import { FormTemplateDraft } from './useFormTemplateDraft';
3
+ export type FormTemplateDragHandlers = {
4
+ onDragStart: () => void;
5
+ onDragOver: (event: DragOverEvent) => void;
6
+ onDragEnd: (event: DragEndEvent) => void;
7
+ };
8
+ export declare function useFormTemplateDrag({ steps, setSteps, moveStep, moveSlot, bindField, }: Pick<FormTemplateDraft, 'steps' | 'setSteps' | 'moveStep' | 'moveSlot' | 'bindField'>): FormTemplateDragHandlers;
9
+ //# sourceMappingURL=useFormTemplateDrag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFormTemplateDrag.d.ts","sourceRoot":"","sources":["../../../src/components/FormTemplateEditor/useFormTemplateDrag.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAW5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAG1D,MAAM,MAAM,wBAAwB,GAAG;IACrC,WAAW,EAAE,MAAM,IAAI,CAAA;IACvB,UAAU,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;IAC1C,SAAS,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAA;CACzC,CAAA;AAwBD,wBAAgB,mBAAmB,CAAC,EAClC,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,SAAS,GACV,EAAE,IAAI,CACL,iBAAiB,EACjB,OAAO,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,WAAW,CAC7D,GAAG,wBAAwB,CAuE3B"}