synapse-react-client 4.0.41 → 4.0.43
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/dist/SWC.index.js +1 -1
- package/dist/components/AccessRequirementList/AccessRequirementList.d.ts +6 -20
- package/dist/components/AccessRequirementList/AccessRequirementList.d.ts.map +1 -1
- package/dist/components/AccessRequirementList/AccessRequirementList.js +165 -159
- package/dist/components/AccessRequirementList/AccessRequirementList.js.map +1 -1
- package/dist/components/AccessRequirementList/AccessRequirementListItem.d.ts +3 -2
- package/dist/components/AccessRequirementList/AccessRequirementListItem.d.ts.map +1 -1
- package/dist/components/AccessRequirementList/AccessRequirementListItem.js +23 -22
- package/dist/components/AccessRequirementList/AccessRequirementListItem.js.map +1 -1
- package/dist/components/AccessRequirementList/AccessRequirementListUtils.d.ts +4 -3
- package/dist/components/AccessRequirementList/AccessRequirementListUtils.d.ts.map +1 -1
- package/dist/components/AccessRequirementList/AccessRequirementListUtils.js +6 -4
- package/dist/components/AccessRequirementList/AccessRequirementListUtils.js.map +1 -1
- package/dist/components/AccessRequirementList/JsonSchemaAccessRequirementRequestFlow/JsonSchemaRequestWizard.d.ts +22 -0
- package/dist/components/AccessRequirementList/JsonSchemaAccessRequirementRequestFlow/JsonSchemaRequestWizard.d.ts.map +1 -0
- package/dist/components/AccessRequirementList/JsonSchemaAccessRequirementRequestFlow/JsonSchemaRequestWizard.js +166 -0
- package/dist/components/AccessRequirementList/JsonSchemaAccessRequirementRequestFlow/JsonSchemaRequestWizard.js.map +1 -0
- package/dist/components/AccessRequirementList/JsonSchemaAccessRequirementRequestFlow/RequesterInformationFields.d.ts +18 -0
- package/dist/components/AccessRequirementList/JsonSchemaAccessRequirementRequestFlow/RequesterInformationFields.d.ts.map +1 -0
- package/dist/components/AccessRequirementList/JsonSchemaAccessRequirementRequestFlow/RequesterInformationFields.js +91 -0
- package/dist/components/AccessRequirementList/JsonSchemaAccessRequirementRequestFlow/RequesterInformationFields.js.map +1 -0
- package/dist/components/AccessRequirementList/JsonSchemaAccessRequirementRequestFlow/requesterInformation.d.ts +33 -0
- package/dist/components/AccessRequirementList/JsonSchemaAccessRequirementRequestFlow/requesterInformation.d.ts.map +1 -0
- package/dist/components/AccessRequirementList/JsonSchemaAccessRequirementRequestFlow/requesterInformation.js +49 -0
- package/dist/components/AccessRequirementList/JsonSchemaAccessRequirementRequestFlow/requesterInformation.js.map +1 -0
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/AccessorRequirementHelpText.d.ts +7 -0
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/AccessorRequirementHelpText.d.ts.map +1 -0
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/AccessorRequirementHelpText.js +30 -0
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/AccessorRequirementHelpText.js.map +1 -0
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/CancelRequestDataAccess.d.ts.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/CancelRequestDataAccess.js +26 -42
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/CancelRequestDataAccess.js.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DataAccessRequestAccessorsFilesForm/DataAccessRequestAccessorsFilesForm.d.ts.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DataAccessRequestAccessorsFilesForm/DataAccessRequestAccessorsFilesForm.js +97 -218
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DataAccessRequestAccessorsFilesForm/DataAccessRequestAccessorsFilesForm.js.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DucUploadSection.d.ts +13 -0
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DucUploadSection.d.ts.map +1 -0
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DucUploadSection.js +60 -0
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DucUploadSection.js.map +1 -0
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/EDucPreviewStep/EDucPreviewStep.d.ts +8 -2
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/EDucPreviewStep/EDucPreviewStep.d.ts.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/EDucPreviewStep/EDucPreviewStep.js +177 -78
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/EDucPreviewStep/EDucPreviewStep.js.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementFormWikiWrapper.d.ts +4 -3
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementFormWikiWrapper.d.ts.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementFormWikiWrapper.js +15 -15
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementFormWikiWrapper.js.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManualUploadDucStep/ManualUploadDucStep.d.ts +3 -2
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManualUploadDucStep/ManualUploadDucStep.d.ts.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManualUploadDucStep/ManualUploadDucStep.js +88 -103
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManualUploadDucStep/ManualUploadDucStep.js.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/PrincipalInvestigatorFields.d.ts +12 -0
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/PrincipalInvestigatorFields.d.ts.map +1 -0
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/PrincipalInvestigatorFields.js +50 -0
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/PrincipalInvestigatorFields.js.map +1 -0
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/RequestDataAccessSuccess.d.ts.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/RequestDataAccessSuccess.js +14 -30
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/RequestDataAccessSuccess.js.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/{ManagedACTAccessRequirementItem.d.ts → RequestableAccessRequirementItem.d.ts} +9 -8
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/RequestableAccessRequirementItem.d.ts.map +1 -0
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/{ManagedACTAccessRequirementItem.js → RequestableAccessRequirementItem.js} +16 -16
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/RequestableAccessRequirementItem.js.map +1 -0
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/{ManagedACTAccessRequirementItemView.d.ts → RequestableAccessRequirementItemView.d.ts} +8 -7
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/RequestableAccessRequirementItemView.d.ts.map +1 -0
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/{ManagedACTAccessRequirementItemView.js → RequestableAccessRequirementItemView.js} +3 -4
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/RequestableAccessRequirementItemView.js.map +1 -0
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ResearchProjectForm/ResearchProjectForm.d.ts.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ResearchProjectForm/ResearchProjectForm.js +123 -170
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ResearchProjectForm/ResearchProjectForm.js.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ReviewDucStep/ReviewDucStep.d.ts +2 -2
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ReviewDucStep/ReviewDucStep.d.ts.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ReviewDucStep/ReviewDucStep.js +35 -51
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ReviewDucStep/ReviewDucStep.js.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/SignatureStatusStep/SignatureStatusStep.d.ts +3 -2
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/SignatureStatusStep/SignatureStatusStep.d.ts.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/SignatureStatusStep/SignatureStatusStep.js +107 -91
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/SignatureStatusStep/SignatureStatusStep.js.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/SigningOfficialFields.d.ts +12 -0
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/SigningOfficialFields.d.ts.map +1 -0
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/SigningOfficialFields.js +51 -0
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/SigningOfficialFields.js.map +1 -0
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/eDucSignatureUtils.d.ts +12 -0
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/eDucSignatureUtils.d.ts.map +1 -0
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/eDucSignatureUtils.js +24 -0
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/eDucSignatureUtils.js.map +1 -0
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/requestFlowTypes.d.ts +12 -0
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/requestFlowTypes.d.ts.map +1 -0
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/requestFlowTypes.js +0 -0
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/useInitializeRequestAccessors.d.ts +22 -0
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/useInitializeRequestAccessors.d.ts.map +1 -0
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/useInitializeRequestAccessors.js +32 -0
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/useInitializeRequestAccessors.js.map +1 -0
- package/dist/components/AccessRequirementList/RequestDataStep.d.ts +34 -0
- package/dist/components/AccessRequirementList/RequestDataStep.d.ts.map +1 -0
- package/dist/components/AccessRequirementList/RequestDataStep.js +37 -0
- package/dist/components/AccessRequirementList/RequestDataStep.js.map +1 -0
- package/dist/components/AccessRequirementList/RequirementItem/UnmanagedACTAccessRequirementItem.d.ts +1 -1
- package/dist/components/AccessRequirementList/RequirementItem/UnmanagedACTAccessRequirementItem.js.map +1 -1
- package/dist/components/AclEditor/AclEditor.js +20 -20
- package/dist/components/Authentication/TwoFactorBackupCodes.js +1 -1
- package/dist/components/Authentication/TwoFactorBackupCodes.js.map +1 -1
- package/dist/components/Authentication/TwoFactorEnrollmentForm.d.ts.map +1 -1
- package/dist/components/Authentication/TwoFactorEnrollmentForm.js +79 -69
- package/dist/components/Authentication/TwoFactorEnrollmentForm.js.map +1 -1
- package/dist/components/DataGrid/SynapseGrid.d.ts.map +1 -1
- package/dist/components/DataGrid/SynapseGrid.js +244 -246
- package/dist/components/DataGrid/SynapseGrid.js.map +1 -1
- package/dist/components/DataGrid/components/GridLoadingState.d.ts +23 -0
- package/dist/components/DataGrid/components/GridLoadingState.d.ts.map +1 -0
- package/dist/components/DataGrid/components/GridLoadingState.js +64 -0
- package/dist/components/DataGrid/components/GridLoadingState.js.map +1 -0
- package/dist/components/DataGrid/components/ReorderColumnsDialog.d.ts.map +1 -1
- package/dist/components/DataGrid/components/ReorderColumnsDialog.js +30 -29
- package/dist/components/DataGrid/components/ReorderColumnsDialog.js.map +1 -1
- package/dist/components/DataGrid/useDataGridWebsocket.d.ts +60 -6
- package/dist/components/DataGrid/useDataGridWebsocket.d.ts.map +1 -1
- package/dist/components/DataGrid/useDataGridWebsocket.js +71 -60
- package/dist/components/DataGrid/useDataGridWebsocket.js.map +1 -1
- package/dist/components/DataGrid/utils/getNamedColumnIndices.d.ts +11 -0
- package/dist/components/DataGrid/utils/getNamedColumnIndices.d.ts.map +1 -0
- package/dist/components/DataGrid/utils/getNamedColumnIndices.js +8 -0
- package/dist/components/DataGrid/utils/getNamedColumnIndices.js.map +1 -0
- package/dist/components/FilePreview/FileHandleContentRenderer.d.ts +6 -2
- package/dist/components/FilePreview/FileHandleContentRenderer.d.ts.map +1 -1
- package/dist/components/FilePreview/FileHandleContentRenderer.js +27 -14
- package/dist/components/FilePreview/FileHandleContentRenderer.js.map +1 -1
- package/dist/components/FilePreview/PdfPreview.d.ts +1 -1
- package/dist/components/FilePreview/PdfPreview.d.ts.map +1 -1
- package/dist/components/FilePreview/PdfPreview.js +15 -16
- package/dist/components/FilePreview/PdfPreview.js.map +1 -1
- package/dist/components/FormTemplateEditor/FieldDefinitionDrawer.d.ts.map +1 -1
- package/dist/components/FormTemplateEditor/FieldDefinitionDrawer.js +71 -68
- package/dist/components/FormTemplateEditor/FieldDefinitionDrawer.js.map +1 -1
- package/dist/components/FormTemplateEditor/FieldLibrary.css +1 -0
- package/dist/components/FormTemplateEditor/FieldLibrary.d.ts +17 -0
- package/dist/components/FormTemplateEditor/FieldLibrary.d.ts.map +1 -0
- package/dist/components/FormTemplateEditor/FieldLibrary.js +88 -0
- package/dist/components/FormTemplateEditor/FieldLibrary.js.map +1 -0
- package/dist/components/FormTemplateEditor/FieldLibrary.module.js +5 -0
- package/dist/components/FormTemplateEditor/FieldLibrary.module.js.map +1 -0
- package/dist/components/FormTemplateEditor/FieldLibrary.module.scss +12 -0
- package/dist/components/FormTemplateEditor/FieldLibraryRow.d.ts +19 -0
- package/dist/components/FormTemplateEditor/FieldLibraryRow.d.ts.map +1 -0
- package/dist/components/FormTemplateEditor/FieldLibraryRow.js +115 -0
- package/dist/components/FormTemplateEditor/FieldLibraryRow.js.map +1 -0
- package/dist/components/FormTemplateEditor/FieldValidationErrorAlert.css +1 -0
- package/dist/components/FormTemplateEditor/FieldValidationErrorAlert.d.ts +9 -0
- package/dist/components/FormTemplateEditor/FieldValidationErrorAlert.d.ts.map +1 -0
- package/dist/components/FormTemplateEditor/FieldValidationErrorAlert.js +18 -0
- package/dist/components/FormTemplateEditor/FieldValidationErrorAlert.js.map +1 -0
- package/dist/components/FormTemplateEditor/FieldValidationErrorAlert.module.js +5 -0
- package/dist/components/FormTemplateEditor/FieldValidationErrorAlert.module.js.map +1 -0
- package/dist/components/FormTemplateEditor/FieldValidationErrorAlert.module.scss +4 -0
- package/dist/components/FormTemplateEditor/FormStructurePanel.d.ts +21 -0
- package/dist/components/FormTemplateEditor/FormStructurePanel.d.ts.map +1 -0
- package/dist/components/FormTemplateEditor/FormStructurePanel.js +108 -0
- package/dist/components/FormTemplateEditor/FormStructurePanel.js.map +1 -0
- package/dist/components/FormTemplateEditor/FormTemplateEditor.d.ts +10 -0
- package/dist/components/FormTemplateEditor/FormTemplateEditor.d.ts.map +1 -0
- package/dist/components/FormTemplateEditor/FormTemplateEditor.js +31 -0
- package/dist/components/FormTemplateEditor/FormTemplateEditor.js.map +1 -0
- package/dist/components/FormTemplateEditor/FormTemplateEditorForm.d.ts +15 -0
- package/dist/components/FormTemplateEditor/FormTemplateEditorForm.d.ts.map +1 -0
- package/dist/components/FormTemplateEditor/FormTemplateEditorForm.js +234 -0
- package/dist/components/FormTemplateEditor/FormTemplateEditorForm.js.map +1 -0
- package/dist/components/FormTemplateEditor/FormTemplatePreview.d.ts.map +1 -1
- package/dist/components/FormTemplateEditor/FormTemplatePreview.js +29 -41
- package/dist/components/FormTemplateEditor/FormTemplatePreview.js.map +1 -1
- package/dist/components/FormTemplateEditor/StepCard.d.ts +25 -0
- package/dist/components/FormTemplateEditor/StepCard.d.ts.map +1 -0
- package/dist/components/FormTemplateEditor/StepCard.js +203 -0
- package/dist/components/FormTemplateEditor/StepCard.js.map +1 -0
- package/dist/components/FormTemplateEditor/StepFieldRow.d.ts +34 -0
- package/dist/components/FormTemplateEditor/StepFieldRow.d.ts.map +1 -0
- package/dist/components/FormTemplateEditor/StepFieldRow.js +128 -0
- package/dist/components/FormTemplateEditor/StepFieldRow.js.map +1 -0
- package/dist/components/FormTemplateEditor/TemplateFileHandleField.d.ts +19 -0
- package/dist/components/FormTemplateEditor/TemplateFileHandleField.d.ts.map +1 -0
- package/dist/components/FormTemplateEditor/TemplateFileHandleField.js +78 -0
- package/dist/components/FormTemplateEditor/TemplateFileHandleField.js.map +1 -0
- package/dist/components/FormTemplateEditor/dragHandle.css +1 -0
- package/dist/components/FormTemplateEditor/dragHandle.module.js +8 -0
- package/dist/components/FormTemplateEditor/dragHandle.module.js.map +1 -0
- package/dist/components/FormTemplateEditor/dragHandle.module.scss +22 -0
- package/dist/components/FormTemplateEditor/dropTarget.css +1 -0
- package/dist/components/FormTemplateEditor/dropTarget.module.js +5 -0
- package/dist/components/FormTemplateEditor/dropTarget.module.js.map +1 -0
- package/dist/components/FormTemplateEditor/dropTarget.module.scss +14 -0
- package/dist/components/FormTemplateEditor/formTemplateDraftState.d.ts +48 -0
- package/dist/components/FormTemplateEditor/formTemplateDraftState.d.ts.map +1 -0
- package/dist/components/FormTemplateEditor/formTemplateDraftState.js +126 -0
- package/dist/components/FormTemplateEditor/formTemplateDraftState.js.map +1 -0
- package/dist/components/FormTemplateEditor/formTemplateSchema.d.ts +35 -0
- package/dist/components/FormTemplateEditor/formTemplateSchema.d.ts.map +1 -0
- package/dist/components/FormTemplateEditor/formTemplateSchema.js +35 -0
- package/dist/components/FormTemplateEditor/formTemplateSchema.js.map +1 -0
- package/dist/components/FormTemplateEditor/schemaFieldUtils.d.ts +3 -1
- package/dist/components/FormTemplateEditor/schemaFieldUtils.d.ts.map +1 -1
- package/dist/components/FormTemplateEditor/schemaFieldUtils.js +26 -8
- package/dist/components/FormTemplateEditor/schemaFieldUtils.js.map +1 -1
- package/dist/components/FormTemplateEditor/sortableIds.d.ts +23 -0
- package/dist/components/FormTemplateEditor/sortableIds.d.ts.map +1 -0
- package/dist/components/FormTemplateEditor/sortableIds.js +24 -0
- package/dist/components/FormTemplateEditor/sortableIds.js.map +1 -0
- package/dist/components/FormTemplateEditor/useFormTemplateDraft.d.ts +33 -0
- package/dist/components/FormTemplateEditor/useFormTemplateDraft.d.ts.map +1 -0
- package/dist/components/FormTemplateEditor/useFormTemplateDraft.js +59 -0
- package/dist/components/FormTemplateEditor/useFormTemplateDraft.js.map +1 -0
- package/dist/components/FormTemplateEditor/useFormTemplateDrag.d.ts +9 -0
- package/dist/components/FormTemplateEditor/useFormTemplateDrag.d.ts.map +1 -0
- package/dist/components/FormTemplateEditor/useFormTemplateDrag.js +66 -0
- package/dist/components/FormTemplateEditor/useFormTemplateDrag.js.map +1 -0
- package/dist/components/FormTemplateEditor/useSaveFormTemplate.d.ts.map +1 -1
- package/dist/components/FormTemplateEditor/useSaveFormTemplate.js +34 -19
- package/dist/components/FormTemplateEditor/useSaveFormTemplate.js.map +1 -1
- package/dist/components/FormTemplateEditor/utils.d.ts +2 -2
- package/dist/components/FormTemplateEditor/utils.d.ts.map +1 -1
- package/dist/components/FormTemplateEditor/utils.js +7 -10
- package/dist/components/FormTemplateEditor/utils.js.map +1 -1
- package/dist/components/JsonSchemaForm/SchemaStepForm.d.ts +21 -0
- package/dist/components/JsonSchemaForm/SchemaStepForm.d.ts.map +1 -0
- package/dist/components/JsonSchemaForm/SchemaStepForm.js +29 -0
- package/dist/components/JsonSchemaForm/SchemaStepForm.js.map +1 -0
- package/dist/components/JsonSchemaForm/widgets/SelectWidget.d.ts +11 -0
- package/dist/components/JsonSchemaForm/widgets/SelectWidget.d.ts.map +1 -1
- package/dist/components/JsonSchemaForm/widgets/SelectWidget.js +28 -19
- package/dist/components/JsonSchemaForm/widgets/SelectWidget.js.map +1 -1
- package/dist/components/QueryBuilder/FilterConditionRow.d.ts +1 -0
- package/dist/components/QueryBuilder/FilterConditionRow.d.ts.map +1 -1
- package/dist/components/QueryBuilder/FilterConditionRow.js +102 -105
- package/dist/components/QueryBuilder/FilterConditionRow.js.map +1 -1
- package/dist/components/QueryBuilder/FilterGroupNode.js +6 -6
- package/dist/components/QueryBuilder/QueryBuilderControls.d.ts.map +1 -1
- package/dist/components/QueryBuilder/QueryBuilderControls.js +88 -81
- package/dist/components/QueryBuilder/QueryBuilderControls.js.map +1 -1
- package/dist/components/QueryBuilder/QueryBuilderInternalContext.d.ts +7 -0
- package/dist/components/QueryBuilder/QueryBuilderInternalContext.d.ts.map +1 -1
- package/dist/components/QueryBuilder/QueryBuilderInternalContext.js.map +1 -1
- package/dist/components/QueryBuilder/qbTreeToReadable.d.ts +2 -1
- package/dist/components/QueryBuilder/qbTreeToReadable.d.ts.map +1 -1
- package/dist/components/QueryBuilder/qbTreeToReadable.js +24 -20
- package/dist/components/QueryBuilder/qbTreeToReadable.js.map +1 -1
- package/dist/components/QueryBuilder/queryBuilderDrag.css +1 -1
- package/dist/components/QueryBuilder/queryBuilderDrag.module.js +2 -2
- package/dist/components/QueryBuilder/queryBuilderDrag.module.js.map +1 -1
- package/dist/components/QueryBuilder/queryBuilderDrag.module.scss +1 -1
- package/dist/components/QueryBuilder/queryBuilderMetadata.d.ts +16 -0
- package/dist/components/QueryBuilder/queryBuilderMetadata.d.ts.map +1 -1
- package/dist/components/QueryBuilder/queryBuilderMetadata.js +13 -5
- package/dist/components/QueryBuilder/queryBuilderMetadata.js.map +1 -1
- package/dist/components/QueryBuilder/useQBValueDisplayName.d.ts +18 -0
- package/dist/components/QueryBuilder/useQBValueDisplayName.d.ts.map +1 -0
- package/dist/components/QueryBuilder/useQBValueDisplayName.js +64 -0
- package/dist/components/QueryBuilder/useQBValueDisplayName.js.map +1 -0
- package/dist/components/SetBasicAccessRequirementFields/GovernanceUtils.d.ts +2 -2
- package/dist/components/SetBasicAccessRequirementFields/GovernanceUtils.d.ts.map +1 -1
- package/dist/components/SetBasicAccessRequirementFields/GovernanceUtils.js +11 -10
- package/dist/components/SetBasicAccessRequirementFields/GovernanceUtils.js.map +1 -1
- package/dist/components/SynapseForm/SynapseForm.js +28 -28
- package/dist/components/SynapseTable/RowSelection/RowSelectionControls.js +6 -6
- package/dist/components/SynapseTable/RowSelection/RowSelectionUI.d.ts +1 -0
- package/dist/components/SynapseTable/RowSelection/RowSelectionUI.d.ts.map +1 -1
- package/dist/components/SynapseTable/RowSelection/RowSelectionUI.js +13 -11
- package/dist/components/SynapseTable/RowSelection/RowSelectionUI.js.map +1 -1
- package/dist/components/SynapseTable/SearchV2.js +4 -4
- package/dist/components/ToastMessage/ToastMessage.d.ts.map +1 -1
- package/dist/components/ToastMessage/ToastMessage.js +25 -22
- package/dist/components/ToastMessage/ToastMessage.js.map +1 -1
- package/dist/components/dataaccess/FormTemplateEditorRoute.d.ts +7 -0
- package/dist/components/dataaccess/FormTemplateEditorRoute.d.ts.map +1 -0
- package/dist/components/dataaccess/FormTemplateEditorRoute.js +26 -0
- package/dist/components/dataaccess/FormTemplateEditorRoute.js.map +1 -0
- package/dist/components/dataaccess/FormTemplateTable.d.ts +10 -0
- package/dist/components/dataaccess/FormTemplateTable.d.ts.map +1 -0
- package/dist/components/dataaccess/FormTemplateTable.js +124 -0
- package/dist/components/dataaccess/FormTemplateTable.js.map +1 -0
- package/dist/components/dataaccess/ReviewerDashboard.d.ts.map +1 -1
- package/dist/components/dataaccess/ReviewerDashboard.js +80 -50
- package/dist/components/dataaccess/ReviewerDashboard.js.map +1 -1
- package/dist/components/dataaccess/UserAccessRequestHistory/InFlightEDucSignaturesTable.d.ts.map +1 -1
- package/dist/components/dataaccess/UserAccessRequestHistory/InFlightEDucSignaturesTable.js +7 -4
- package/dist/components/dataaccess/UserAccessRequestHistory/InFlightEDucSignaturesTable.js.map +1 -1
- package/dist/components/dataaccess/UserAccessRequestHistory/UserAccessRequestHistoryPlace.d.ts.map +1 -1
- package/dist/components/dataaccess/UserAccessRequestHistory/UserAccessRequestHistoryPlace.js +5 -4
- package/dist/components/dataaccess/UserAccessRequestHistory/UserAccessRequestHistoryPlace.js.map +1 -1
- package/dist/components/widgets/FileHandleLink.d.ts +12 -2
- package/dist/components/widgets/FileHandleLink.d.ts.map +1 -1
- package/dist/components/widgets/FileHandleLink.js +25 -29
- package/dist/components/widgets/FileHandleLink.js.map +1 -1
- package/dist/features/curator/dashboard/CuratorDashboardRouter.d.ts.map +1 -1
- package/dist/features/curator/dashboard/CuratorDashboardRouter.js +15 -15
- package/dist/features/curator/dashboard/CuratorDashboardRouter.js.map +1 -1
- package/dist/features/entity/metadata-task/components/MetadataTasksPageRouter.d.ts.map +1 -1
- package/dist/features/entity/metadata-task/components/MetadataTasksPageRouter.js +15 -14
- package/dist/features/entity/metadata-task/components/MetadataTasksPageRouter.js.map +1 -1
- package/dist/mocks/accessRequirement/mockFormTemplates.d.ts +2 -0
- package/dist/mocks/accessRequirement/mockFormTemplates.d.ts.map +1 -1
- package/dist/mocks/accessRequirement/mockFormTemplates.js +8 -2
- package/dist/mocks/accessRequirement/mockFormTemplates.js.map +1 -1
- package/dist/mocks/accessRequirement/mockJsonSchemaAccessRequirements.d.ts +7 -0
- package/dist/mocks/accessRequirement/mockJsonSchemaAccessRequirements.d.ts.map +1 -1
- package/dist/mocks/accessRequirement/mockJsonSchemaAccessRequirements.js +30 -15
- package/dist/mocks/accessRequirement/mockJsonSchemaAccessRequirements.js.map +1 -1
- package/dist/mocks/accessRequirement/mockJsonSchemas.d.ts.map +1 -1
- package/dist/mocks/accessRequirement/mockJsonSchemas.js +17 -31
- package/dist/mocks/accessRequirement/mockJsonSchemas.js.map +1 -1
- package/dist/mocks/dataaccess/MockDataAccessRequest.d.ts +3 -0
- package/dist/mocks/dataaccess/MockDataAccessRequest.d.ts.map +1 -1
- package/dist/mocks/dataaccess/MockDataAccessRequest.js +24 -12
- package/dist/mocks/dataaccess/MockDataAccessRequest.js.map +1 -1
- package/dist/mocks/msw/handlers/authHandlers.d.ts +1 -0
- package/dist/mocks/msw/handlers/authHandlers.d.ts.map +1 -1
- package/dist/mocks/msw/handlers/authHandlers.js +6 -2
- package/dist/mocks/msw/handlers/authHandlers.js.map +1 -1
- package/dist/mocks/msw/handlers/dataAccessRequestHandlers.d.ts +2 -0
- package/dist/mocks/msw/handlers/dataAccessRequestHandlers.d.ts.map +1 -1
- package/dist/mocks/msw/handlers/dataAccessRequestHandlers.js +65 -47
- package/dist/mocks/msw/handlers/dataAccessRequestHandlers.js.map +1 -1
- package/dist/mocks/msw/handlers/fileHandlers.d.ts.map +1 -1
- package/dist/mocks/msw/handlers/fileHandlers.js +25 -21
- package/dist/mocks/msw/handlers/fileHandlers.js.map +1 -1
- package/dist/mocks/msw/handlers/formTemplateHandlers.d.ts +2 -1
- package/dist/mocks/msw/handlers/formTemplateHandlers.d.ts.map +1 -1
- package/dist/mocks/msw/handlers/formTemplateHandlers.js +18 -18
- package/dist/mocks/msw/handlers/formTemplateHandlers.js.map +1 -1
- package/dist/mocks/msw/handlers/schemaHandlers.d.ts +8 -0
- package/dist/mocks/msw/handlers/schemaHandlers.d.ts.map +1 -1
- package/dist/mocks/msw/handlers/schemaHandlers.js +20 -3
- package/dist/mocks/msw/handlers/schemaHandlers.js.map +1 -1
- package/dist/mocks/msw/handlers/twoFactorEnrollmentHandlers.d.ts +8 -0
- package/dist/mocks/msw/handlers/twoFactorEnrollmentHandlers.d.ts.map +1 -0
- package/dist/mocks/msw/handlers/twoFactorEnrollmentHandlers.js +19 -0
- package/dist/mocks/msw/handlers/twoFactorEnrollmentHandlers.js.map +1 -0
- package/dist/style/abstracts/_cssVariables.scss +13 -0
- package/dist/style/components/_toasts.scss +10 -1
- package/dist/style/main.css +1 -1
- package/dist/synapse-queries/KeyFactory.d.ts +8 -1
- package/dist/synapse-queries/KeyFactory.d.ts.map +1 -1
- package/dist/synapse-queries/KeyFactory.js +17 -4
- package/dist/synapse-queries/KeyFactory.js.map +1 -1
- package/dist/synapse-queries/auth/index.d.ts +1 -0
- package/dist/synapse-queries/auth/index.d.ts.map +1 -1
- package/dist/synapse-queries/auth/index.js +2 -1
- package/dist/synapse-queries/auth/useUnbindOAuthProviderIdentity.d.ts +11 -0
- package/dist/synapse-queries/auth/useUnbindOAuthProviderIdentity.d.ts.map +1 -0
- package/dist/synapse-queries/auth/useUnbindOAuthProviderIdentity.js +19 -0
- package/dist/synapse-queries/auth/useUnbindOAuthProviderIdentity.js.map +1 -0
- package/dist/synapse-queries/dataaccess/index.js +5 -5
- package/dist/synapse-queries/dataaccess/useEDuc.d.ts +18 -0
- package/dist/synapse-queries/dataaccess/useEDuc.d.ts.map +1 -1
- package/dist/synapse-queries/dataaccess/useEDuc.js +33 -1
- package/dist/synapse-queries/dataaccess/useEDuc.js.map +1 -1
- package/dist/synapse-queries/dataaccess/useGeneratedRequestForm.d.ts +19 -0
- package/dist/synapse-queries/dataaccess/useGeneratedRequestForm.d.ts.map +1 -0
- package/dist/synapse-queries/dataaccess/useGeneratedRequestForm.js +26 -0
- package/dist/synapse-queries/dataaccess/useGeneratedRequestForm.js.map +1 -0
- package/dist/synapse-queries/file/useDirectUploadToS3.js +6 -6
- package/dist/synapse-queries/file/useFileHandle.d.ts +8 -0
- package/dist/synapse-queries/file/useFileHandle.d.ts.map +1 -1
- package/dist/synapse-queries/file/useFileHandle.js +15 -6
- package/dist/synapse-queries/file/useFileHandle.js.map +1 -1
- package/dist/synapse-queries/index.js +260 -253
- package/dist/synapse-queries/jsonschema/index.js +2 -2
- package/dist/synapse-queries/jsonschema/useSchema.d.ts +5 -0
- package/dist/synapse-queries/jsonschema/useSchema.d.ts.map +1 -1
- package/dist/synapse-queries/jsonschema/useSchema.js +9 -1
- package/dist/synapse-queries/jsonschema/useSchema.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/APIConstants.d.ts +1 -0
- package/dist/utils/APIConstants.d.ts.map +1 -1
- package/dist/utils/APIConstants.js +2 -2
- package/dist/utils/APIConstants.js.map +1 -1
- package/dist/utils/featureflag/FeatureFlags.d.ts +1 -0
- package/dist/utils/featureflag/FeatureFlags.d.ts.map +1 -1
- package/dist/utils/featureflag/FeatureFlags.js +1 -1
- package/dist/utils/featureflag/FeatureFlags.js.map +1 -1
- package/dist/utils/functions/toPascalCase.d.ts +6 -0
- package/dist/utils/functions/toPascalCase.d.ts.map +1 -0
- package/dist/utils/functions/toPascalCase.js +8 -0
- package/dist/utils/functions/toPascalCase.js.map +1 -0
- package/dist/utils/hooks/useDetectSSOCode.d.ts.map +1 -1
- package/dist/utils/hooks/useDetectSSOCode.js +31 -26
- package/dist/utils/hooks/useDetectSSOCode.js.map +1 -1
- package/dist/utils/jsonschema/schemaData.d.ts +18 -0
- package/dist/utils/jsonschema/schemaData.d.ts.map +1 -0
- package/dist/utils/jsonschema/schemaData.js +26 -0
- package/dist/utils/jsonschema/schemaData.js.map +1 -0
- package/dist/utils/jsonschema/submissionContext.d.ts +5 -0
- package/dist/utils/jsonschema/submissionContext.d.ts.map +1 -1
- package/dist/utils/jsonschema/submissionContext.js +22 -30
- package/dist/utils/jsonschema/submissionContext.js.map +1 -1
- package/package.json +10 -9
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementItem.d.ts.map +0 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementItem.js.map +0 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementItemView.d.ts.map +0 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementItemView.js.map +0 -1
|
@@ -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,EAAE,GAC7C,CAAC,CAkFD;EACA;EACA,uBAlF4B,GAC3B,MACC,GAAS,OAAS;GAAE,GAAG;GAAM,oBAAoB;EAAI,EAAE,GACzD,CAAC,CA+ED;EACA,WA7EgB,QAAc,EAAiB,CAAK,GAAG,CAAC,CAAK,CA6E7D;EACA,sBA7E2B,QACrB,EAAmB,CAAU,GACnC,CAAC,CAAU,CA2EX;EACA,mBA1EwB,QAClB,EAAsB,GAAY,CAAK,GAC7C,CAAC,GAAY,CAAK,CAwElB;EACA,mBApEwB,QAAkB,EAAS,CAAW,GAAG,CAAC,CAoElE;EACA,mBApE8B,GAC7B,GAAgB,MACf,GAAS,MAAQ,EAAkB,GAAM,GAAQ,CAAM,CAAC,GAC1D,CAAC,CAiEkB;EACnB,sBAhE2B,GAC1B,GAAa,MACZ,GAAS,MAAQ,EAAe,GAAM,GAAK,CAAK,CAAC,GACnD,CAAC,CA6DD;EACA,uBA5D4B,GAC3B,GAAa,MACZ,GAAS,MAAQ,EAAgB,GAAM,GAAK,CAAI,CAAC,GACnD,CAAC,CAyDD;EACA,sBAxD2B,GAC1B,GAAa,MACZ,GAAS,MAAQ,EAAe,GAAM,GAAK,CAAU,CAAC,GACxD,CAAC,CAqDD;EACA,qBApD0B,GACzB,GAAa,MACZ,GAAS,MAAQ,EAAc,GAAM,GAAK,CAAO,CAAC,GACpD,CAAC,CAiDD;EACA,sBAhD2B,GAC1B,MAAgB,GAAS,MAAQ,EAAe,GAAM,CAAG,CAAC,GAC3D,CAAC,CA8CD;EACA,UA7CqB,GACpB,GAAmB,MAClB,GAAS,MAAQ,EAAS,GAAM,GAAW,CAAO,CAAC,GACrD,CAAC,CA0CS;EACV,UAzCqB,GACpB,GAAoB,GAAmB,MACtC,GAAS,MAAQ,EAAS,GAAM,GAAY,GAAW,CAAO,CAAC,GACjE,CAAC,CAsCS;EACV,WArCsB,GACrB,GAAqB,MACpB,GAAS,MAAQ,EAAU,GAAM,GAAa,CAAO,CAAC,GACxD,CAAC,CAkCU;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"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { readFieldDragData as e, slotGroupId as t, slotSortableId as n, stepSortableId as r } from "./sortableIds.js";
|
|
2
|
+
import { useCallback as i, useMemo as a, useRef as o } from "react";
|
|
3
|
+
import { move as s } from "@dnd-kit/helpers";
|
|
4
|
+
//#region src/components/FormTemplateEditor/useFormTemplateDrag.ts
|
|
5
|
+
function c(e, r, i) {
|
|
6
|
+
let a = Object.fromEntries(e.map((e) => [t(e), e.fields.map(n)])), o = s(a, r);
|
|
7
|
+
if (o === a) return null;
|
|
8
|
+
for (let n of e) {
|
|
9
|
+
let e = o[t(n)]?.indexOf(i) ?? -1;
|
|
10
|
+
if (e !== -1) return {
|
|
11
|
+
stepKey: n.uiKey,
|
|
12
|
+
index: e
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
function l({ steps: t, setSteps: l, moveStep: u, moveSlot: d, bindField: f }) {
|
|
18
|
+
let p = o(null), m = i(() => {
|
|
19
|
+
p.current = t;
|
|
20
|
+
}, [t]), h = i((e) => {
|
|
21
|
+
let { source: i } = e.operation;
|
|
22
|
+
if (!i) return;
|
|
23
|
+
let a = String(i.id);
|
|
24
|
+
if (i.type === "step") {
|
|
25
|
+
let n = t.map(r), i = s(n, e);
|
|
26
|
+
if (i === n) return;
|
|
27
|
+
u(n.indexOf(a), i.indexOf(a));
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (i.type === "slot") {
|
|
31
|
+
let r = t.flatMap((e) => e.fields).find((e) => n(e) === a), i = c(t, e, a);
|
|
32
|
+
r && i && d(r.schemaPath, i.stepKey, i.index);
|
|
33
|
+
}
|
|
34
|
+
}, [
|
|
35
|
+
t,
|
|
36
|
+
u,
|
|
37
|
+
d
|
|
38
|
+
]), g = i((n) => {
|
|
39
|
+
let i = p.current;
|
|
40
|
+
if (p.current = null, n.canceled) {
|
|
41
|
+
i && l(i);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
let { source: a, target: o } = n.operation;
|
|
45
|
+
if (a?.type !== "field" || o?.type !== "step") return;
|
|
46
|
+
let s = e(a.data), c = t.find((e) => r(e) === String(o.id));
|
|
47
|
+
s && c && f(s, c.uiKey);
|
|
48
|
+
}, [
|
|
49
|
+
t,
|
|
50
|
+
l,
|
|
51
|
+
f
|
|
52
|
+
]);
|
|
53
|
+
return a(() => ({
|
|
54
|
+
onDragStart: m,
|
|
55
|
+
onDragOver: h,
|
|
56
|
+
onDragEnd: g
|
|
57
|
+
}), [
|
|
58
|
+
m,
|
|
59
|
+
h,
|
|
60
|
+
g
|
|
61
|
+
]);
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
export { l as useFormTemplateDrag };
|
|
65
|
+
|
|
66
|
+
//# sourceMappingURL=useFormTemplateDrag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFormTemplateDrag.js","names":[],"sources":["../../../src/components/FormTemplateEditor/useFormTemplateDrag.ts"],"sourcesContent":["/*\n * Drag-and-drop for the FormTemplateEditor, as handlers for `DragDropProvider`. Translates dnd-kit\n * events into the draft's intent-level moves; the geometry of where a drag lands is left to\n * `@dnd-kit/helpers`' `move`, applied to id projections of the draft.\n */\nimport { move } from '@dnd-kit/helpers'\nimport { DragEndEvent, DragOverEvent } from '@dnd-kit/react'\nimport { useCallback, useMemo, useRef } from 'react'\nimport {\n FIELD_DRAG_TYPE,\n readFieldDragData,\n slotGroupId,\n SLOT_SORTABLE_TYPE,\n slotSortableId,\n stepSortableId,\n STEP_SORTABLE_TYPE,\n} from './sortableIds'\nimport { FormTemplateDraft } from './useFormTemplateDraft'\nimport { EditableFormTemplateStep } from './utils'\n\nexport type FormTemplateDragHandlers = {\n onDragStart: () => void\n onDragOver: (event: DragOverEvent) => void\n onDragEnd: (event: DragEndEvent) => void\n}\n\n/**\n * The step a slot sortable ends up in after `move`, and its index there. `move` over the\n * `Record<slotGroupId, slotSortableId[]>` projection is what resolves a drag across steps,\n * including onto an empty step's slot list.\n */\nfunction projectSlotMove(\n steps: EditableFormTemplateStep[],\n event: DragOverEvent,\n slotId: string,\n): { stepKey: string; index: number } | null {\n const groups: Record<string, string[]> = Object.fromEntries(\n steps.map(step => [slotGroupId(step), step.fields.map(slotSortableId)]),\n )\n const moved = move(groups, event)\n if (moved === groups) return null\n for (const step of steps) {\n const index = moved[slotGroupId(step)]?.indexOf(slotId) ?? -1\n if (index !== -1) return { stepKey: step.uiKey, index }\n }\n return null\n}\n\nexport function useFormTemplateDrag({\n steps,\n setSteps,\n moveStep,\n moveSlot,\n bindField,\n}: Pick<\n FormTemplateDraft,\n 'steps' | 'setSteps' | 'moveStep' | 'moveSlot' | 'bindField'\n>): FormTemplateDragHandlers {\n // The steps as they stood before the in-flight drag. `onDragOver` rewrites the steps as the\n // pointer moves, so this snapshot is the only way back if the gesture is canceled — dnd-kit\n // reverts its own state, never ours.\n const stepsBeforeDrag = useRef<EditableFormTemplateStep[] | null>(null)\n\n const onDragStart = useCallback(() => {\n stepsBeforeDrag.current = steps\n }, [steps])\n\n // Reordering is applied while dragging rather than on drop. `useSortable` ships with\n // `OptimisticSortingPlugin`, which reorders the dragged element in the DOM behind React's back\n // unless the draft already reflects the new order by the time the drag-over render commits.\n // Letting it win moves a slot's element into another step's list while React still believes it\n // belongs to the old one, which strands the node and throws on the next removal.\n const onDragOver = useCallback(\n (event: DragOverEvent) => {\n const { source } = event.operation\n if (!source) return\n const sourceId = String(source.id)\n\n if (source.type === STEP_SORTABLE_TYPE) {\n const stepIds = steps.map(stepSortableId)\n const moved = move(stepIds, event)\n if (moved === stepIds) return\n moveStep(stepIds.indexOf(sourceId), moved.indexOf(sourceId))\n return\n }\n\n if (source.type === SLOT_SORTABLE_TYPE) {\n const field = steps\n .flatMap(step => step.fields)\n .find(f => slotSortableId(f) === sourceId)\n const destination = projectSlotMove(steps, event, sourceId)\n if (field && destination) {\n moveSlot(field.schemaPath, destination.stepKey, destination.index)\n }\n }\n },\n [steps, moveStep, moveSlot],\n )\n\n // Binding a library field to a step is the one drag that is not a reorder, so it has no\n // optimistic counterpart to keep in sync and only takes effect once the field is dropped.\n const onDragEnd = useCallback(\n (event: DragEndEvent) => {\n const snapshot = stepsBeforeDrag.current\n stepsBeforeDrag.current = null\n if (event.canceled) {\n if (snapshot) setSteps(snapshot)\n return\n }\n\n const { source, target } = event.operation\n if (\n source?.type !== FIELD_DRAG_TYPE ||\n target?.type !== STEP_SORTABLE_TYPE\n ) {\n return\n }\n const propertyKey = readFieldDragData(source.data)\n const step = steps.find(s => stepSortableId(s) === String(target.id))\n if (propertyKey && step) bindField(propertyKey, step.uiKey)\n },\n [steps, setSteps, bindField],\n )\n\n return useMemo(\n () => ({ onDragStart, onDragOver, onDragEnd }),\n [onDragStart, onDragOver, onDragEnd],\n )\n}\n"],"mappings":";;;;AA+BA,SAAS,EACP,GACA,GACA,GAC2C;CAC3C,IAAM,IAAmC,OAAO,YAC9C,EAAM,KAAI,MAAQ,CAAC,EAAY,CAAI,GAAG,EAAK,OAAO,IAAI,CAAc,CAAC,CAAC,CACxE,GACM,IAAQ,EAAK,GAAQ,CAAK;CAChC,IAAI,MAAU,GAAQ,OAAO;CAC7B,KAAK,IAAM,KAAQ,GAAO;EACxB,IAAM,IAAQ,EAAM,EAAY,CAAI,IAAI,QAAQ,CAAM,KAAK;EAC3D,IAAI,MAAU,IAAI,OAAO;GAAE,SAAS,EAAK;GAAO;EAAM;CACxD;CACA,OAAO;AACT;AAEA,SAAgB,EAAoB,EAClC,UACA,aACA,aACA,aACA,gBAI2B;CAI3B,IAAM,IAAkB,EAA0C,IAAI,GAEhE,IAAc,QAAkB;EACpC,EAAgB,UAAU;CAC5B,GAAG,CAAC,CAAK,CAAC,GAOJ,IAAa,GAChB,MAAyB;EACxB,IAAM,EAAE,cAAW,EAAM;EACzB,IAAI,CAAC,GAAQ;EACb,IAAM,IAAW,OAAO,EAAO,EAAE;EAEjC,IAAI,EAAO,SAAA,QAA6B;GACtC,IAAM,IAAU,EAAM,IAAI,CAAc,GAClC,IAAQ,EAAK,GAAS,CAAK;GACjC,IAAI,MAAU,GAAS;GACvB,EAAS,EAAQ,QAAQ,CAAQ,GAAG,EAAM,QAAQ,CAAQ,CAAC;GAC3D;EACF;EAEA,IAAI,EAAO,SAAA,QAA6B;GACtC,IAAM,IAAQ,EACX,SAAQ,MAAQ,EAAK,MAAM,EAC3B,MAAK,MAAK,EAAe,CAAC,MAAM,CAAQ,GACrC,IAAc,EAAgB,GAAO,GAAO,CAAQ;GAC1D,AAAI,KAAS,KACX,EAAS,EAAM,YAAY,EAAY,SAAS,EAAY,KAAK;EAErE;CACF,GACA;EAAC;EAAO;EAAU;CAAQ,CAC5B,GAIM,IAAY,GACf,MAAwB;EACvB,IAAM,IAAW,EAAgB;EAEjC,IADA,EAAgB,UAAU,MACtB,EAAM,UAAU;GAClB,AAAI,KAAU,EAAS,CAAQ;GAC/B;EACF;EAEA,IAAM,EAAE,WAAQ,cAAW,EAAM;EACjC,IACE,GAAQ,SAAA,WACR,GAAQ,SAAA,QAER;EAEF,IAAM,IAAc,EAAkB,EAAO,IAAI,GAC3C,IAAO,EAAM,MAAK,MAAK,EAAe,CAAC,MAAM,OAAO,EAAO,EAAE,CAAC;EACpE,AAAI,KAAe,KAAM,EAAU,GAAa,EAAK,KAAK;CAC5D,GACA;EAAC;EAAO;EAAU;CAAS,CAC7B;CAEA,OAAO,SACE;EAAE;EAAa;EAAY;CAAU,IAC5C;EAAC;EAAa;EAAY;CAAS,CACrC;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSaveFormTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/FormTemplateEditor/useSaveFormTemplate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useSaveFormTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/FormTemplateEditor/useSaveFormTemplate.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,YAAY,EAAc,MAAM,kCAAkC,CAAA;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,0DAA0D,CAAA;AAC7F,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC,OAAO,EAEL,kBAAkB,EAEnB,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,wBAAwB,EAAuB,MAAM,SAAS,CAAA;AAMvE,OAAO,EACL,gCAAgC,EAEjC,MAAM,0BAA0B,CAAA;AAEjC,MAAM,MAAM,2BAA2B,GAAG;IACxC,eAAe,CAAC,EAAE,YAAY,CAAA;IAC9B,iBAAiB,CAAC,EAAE,UAAU,CAAA;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,UAAU,CAAA;IACtB,KAAK,EAAE,wBAAwB,EAAE,CAAA;CAClC,CAAA;AAED,MAAM,MAAM,2BAA2B,GACnC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,YAAY,CAAA;CAAE,GACpC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,gBAAgB,EAAE,gCAAgC,EAAE,CAAA;CAAE,CAAA;AAEvE;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,CAAC,EAAE,IAAI,CACZ,kBAAkB,CAChB,2BAA2B,EAC3B,kBAAkB,EAClB,2BAA2B,CAC5B,EACD,YAAY,CACb,4IA2EF"}
|
|
@@ -1,39 +1,54 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
1
|
+
import { useSynapseContext as e } from "../../utils/context/SynapseContext.js";
|
|
2
|
+
import { useCreateFormTemplate as t, useUpdateFormTemplate as n } from "../../synapse-queries/dataaccess/useFormTemplate.js";
|
|
3
|
+
import { getJsonSchemaVersionsQuery as r } from "../../synapse-queries/jsonschema/useListJsonSchemaVersions.js";
|
|
4
|
+
import { useCreateJsonSchema as i } from "../../synapse-queries/jsonschema/useCreateJsonSchema.js";
|
|
5
|
+
import { formatSchema$id as a, getNextSchemaVersion as o, resolveFormTemplateSchemaName as s } from "./formTemplateSchema.js";
|
|
6
|
+
import { toFormTemplateSteps as c } from "./utils.js";
|
|
7
|
+
import { validateFormTemplateFields as l } from "./formTemplateValidation.js";
|
|
8
|
+
import { useMutation as u, useQueryClient as d } from "@tanstack/react-query";
|
|
9
|
+
import f from "lodash-es/isEqual";
|
|
7
10
|
//#region src/components/FormTemplateEditor/useSaveFormTemplate.ts
|
|
8
|
-
function
|
|
9
|
-
let
|
|
10
|
-
return
|
|
11
|
-
...
|
|
11
|
+
function p(p) {
|
|
12
|
+
let m = d(), { synapseClient: h, keyFactory: g } = e(), _ = i(), v = t(), y = n();
|
|
13
|
+
return u({
|
|
14
|
+
...p,
|
|
12
15
|
mutationFn: async (e) => {
|
|
13
|
-
let t =
|
|
16
|
+
let t = c(e.steps), n = l(t, e.jsonSchema);
|
|
14
17
|
if (n.length > 0) return {
|
|
15
18
|
ok: !1,
|
|
16
19
|
validationErrors: n
|
|
17
20
|
};
|
|
18
|
-
let
|
|
19
|
-
(!
|
|
20
|
-
|
|
21
|
+
let i = e.initialTemplate?.schema$id ?? "";
|
|
22
|
+
if (!f(e.jsonSchema, e.initialJsonSchema) || !i) {
|
|
23
|
+
let t = s(e.name, e.initialTemplate?.schema$id), n = await m.fetchQuery({
|
|
24
|
+
...r(t.organizationName, t.schemaName, {
|
|
25
|
+
synapseClient: h,
|
|
26
|
+
keyFactory: g
|
|
27
|
+
}),
|
|
28
|
+
staleTime: 0
|
|
29
|
+
});
|
|
30
|
+
i = (await _.mutateAsync({
|
|
31
|
+
...e.jsonSchema,
|
|
32
|
+
$id: a(t, o(n))
|
|
33
|
+
})).newVersionInfo.$id;
|
|
34
|
+
}
|
|
35
|
+
let u = {
|
|
21
36
|
...e.initialTemplate,
|
|
22
37
|
name: e.name,
|
|
23
|
-
schema$id:
|
|
38
|
+
schema$id: i,
|
|
24
39
|
steps: t
|
|
25
40
|
};
|
|
26
41
|
return {
|
|
27
42
|
ok: !0,
|
|
28
|
-
template: e.initialTemplate?.id ? await
|
|
43
|
+
template: e.initialTemplate?.id ? await y.mutateAsync({
|
|
29
44
|
templateId: e.initialTemplate.id,
|
|
30
|
-
formTemplate:
|
|
31
|
-
}) : await
|
|
45
|
+
formTemplate: u
|
|
46
|
+
}) : await v.mutateAsync(u)
|
|
32
47
|
};
|
|
33
48
|
}
|
|
34
49
|
});
|
|
35
50
|
}
|
|
36
51
|
//#endregion
|
|
37
|
-
export {
|
|
52
|
+
export { p as useSaveFormTemplate };
|
|
38
53
|
|
|
39
54
|
//# sourceMappingURL=useSaveFormTemplate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSaveFormTemplate.js","names":[],"sources":["../../../src/components/FormTemplateEditor/useSaveFormTemplate.ts"],"sourcesContent":["/*\n * Network orchestration for saving a FormTemplate draft: pre-flight client-side validation\n * (mirroring the server's per-field rules, since the server only returns a flat message),\n * registering a new JSON Schema version when the schema body changed, and creating or updating\n * the FormTemplate against that schema version.\n */\nimport { useCreateJsonSchema } from '@/synapse-queries/jsonschema/useCreateJsonSchema'\nimport {\n useCreateFormTemplate,\n useUpdateFormTemplate,\n} from '@/synapse-queries/dataaccess/useFormTemplate'\nimport { FormTemplate, JsonSchema } from '@sage-bionetworks/synapse-client'\nimport { SynapseClientError } from '@sage-bionetworks/synapse-client/util/SynapseClientError'\nimport { RJSFSchema } from '@rjsf/utils'\nimport isEqual from 'lodash-es/isEqual'\nimport {
|
|
1
|
+
{"version":3,"file":"useSaveFormTemplate.js","names":[],"sources":["../../../src/components/FormTemplateEditor/useSaveFormTemplate.ts"],"sourcesContent":["/*\n * Network orchestration for saving a FormTemplate draft: pre-flight client-side validation\n * (mirroring the server's per-field rules, since the server only returns a flat message),\n * registering a new JSON Schema version when the schema body changed, and creating or updating\n * the FormTemplate against that schema version.\n */\nimport { getJsonSchemaVersionsQuery } from '@/synapse-queries/jsonschema/useListJsonSchemaVersions'\nimport { useCreateJsonSchema } from '@/synapse-queries/jsonschema/useCreateJsonSchema'\nimport {\n useCreateFormTemplate,\n useUpdateFormTemplate,\n} from '@/synapse-queries/dataaccess/useFormTemplate'\nimport { FormTemplate, JsonSchema } from '@sage-bionetworks/synapse-client'\nimport { SynapseClientError } from '@sage-bionetworks/synapse-client/util/SynapseClientError'\nimport { RJSFSchema } from '@rjsf/utils'\nimport isEqual from 'lodash-es/isEqual'\nimport {\n useMutation,\n UseMutationOptions,\n useQueryClient,\n} from '@tanstack/react-query'\nimport { useSynapseContext } from '@/utils/context/SynapseContext'\nimport { EditableFormTemplateStep, toFormTemplateSteps } from './utils'\nimport {\n formatSchema$id,\n getNextSchemaVersion,\n resolveFormTemplateSchemaName,\n} from './formTemplateSchema'\nimport {\n FormTemplateFieldValidationError,\n validateFormTemplateFields,\n} from './formTemplateValidation'\n\nexport type SaveFormTemplateDraftParams = {\n initialTemplate?: FormTemplate\n initialJsonSchema?: RJSFSchema\n name: string\n jsonSchema: RJSFSchema\n steps: EditableFormTemplateStep[]\n}\n\nexport type SaveFormTemplateDraftResult =\n | { ok: true; template: FormTemplate }\n | { ok: false; validationErrors: FormTemplateFieldValidationError[] }\n\n/**\n * Owns the create-schema, create-template, and update-template mutations, and sequences them\n * into a single save mutation. A validation failure resolves as `{ ok: false, validationErrors }`\n * rather than rejecting; a network failure (including a 412 conflict from a concurrent edit)\n * rejects normally, surfaced via the returned mutation's `error`.\n */\nexport function useSaveFormTemplate(\n options?: Omit<\n UseMutationOptions<\n SaveFormTemplateDraftResult,\n SynapseClientError,\n SaveFormTemplateDraftParams\n >,\n 'mutationFn'\n >,\n) {\n const queryClient = useQueryClient()\n const { synapseClient, keyFactory } = useSynapseContext()\n const createSchema = useCreateJsonSchema()\n const createTemplate = useCreateFormTemplate()\n const updateTemplate = useUpdateFormTemplate()\n\n return useMutation<\n SaveFormTemplateDraftResult,\n SynapseClientError,\n SaveFormTemplateDraftParams\n >({\n ...options,\n mutationFn: async params => {\n const formTemplateSteps = toFormTemplateSteps(params.steps)\n\n const validationErrors = validateFormTemplateFields(\n formTemplateSteps,\n params.jsonSchema,\n )\n if (validationErrors.length > 0) {\n return { ok: false, validationErrors }\n }\n\n // The schema registry has no update operation — every save that changed the schema body\n // registers a fresh, immutable version. Re-registering an unchanged body would still create\n // an unnecessary version, so skip it when the draft's schema matches what was last resolved.\n let schema$id = params.initialTemplate?.schema$id ?? ''\n const schemaChanged = !isEqual(\n params.jsonSchema,\n params.initialJsonSchema,\n )\n if (schemaChanged || !schema$id) {\n const templateSchemaName = resolveFormTemplateSchemaName(\n params.name,\n params.initialTemplate?.schema$id,\n )\n // Registered versions are immutable, so the list is read fresh on every save to pick a\n // version that does not exist yet.\n const registeredVersions = await queryClient.fetchQuery({\n ...getJsonSchemaVersionsQuery(\n templateSchemaName.organizationName,\n templateSchemaName.schemaName,\n { synapseClient, keyFactory },\n ),\n staleTime: 0,\n })\n const response = await createSchema.mutateAsync({\n ...params.jsonSchema,\n $id: formatSchema$id(\n templateSchemaName,\n getNextSchemaVersion(registeredVersions),\n ),\n } as JsonSchema)\n schema$id = response.newVersionInfo!.$id!\n }\n\n const formTemplate: FormTemplate = {\n ...params.initialTemplate,\n name: params.name,\n schema$id,\n steps: formTemplateSteps,\n }\n\n const template = params.initialTemplate?.id\n ? await updateTemplate.mutateAsync({\n templateId: params.initialTemplate.id,\n formTemplate,\n })\n : await createTemplate.mutateAsync(formTemplate)\n\n return { ok: true, template }\n },\n })\n}\n"],"mappings":";;;;;;;;;;AAmDA,SAAgB,EACd,GAQA;CACA,IAAM,IAAc,EAAe,GAC7B,EAAE,kBAAe,kBAAe,EAAkB,GAClD,IAAe,EAAoB,GACnC,IAAiB,EAAsB,GACvC,IAAiB,EAAsB;CAE7C,OAAO,EAIL;EACA,GAAG;EACH,YAAY,OAAM,MAAU;GAC1B,IAAM,IAAoB,EAAoB,EAAO,KAAK,GAEpD,IAAmB,EACvB,GACA,EAAO,UACT;GACA,IAAI,EAAiB,SAAS,GAC5B,OAAO;IAAE,IAAI;IAAO;GAAiB;GAMvC,IAAI,IAAY,EAAO,iBAAiB,aAAa;GAKrD,IAAI,CAJmB,EACrB,EAAO,YACP,EAAO,iBACT,KACqB,CAAC,GAAW;IAC/B,IAAM,IAAqB,EACzB,EAAO,MACP,EAAO,iBAAiB,SAC1B,GAGM,IAAqB,MAAM,EAAY,WAAW;KACtD,GAAG,EACD,EAAmB,kBACnB,EAAmB,YACnB;MAAE;MAAe;KAAW,CAC9B;KACA,WAAW;IACb,CAAC;IAQD,KAAY,MAPW,EAAa,YAAY;KAC9C,GAAG,EAAO;KACV,KAAK,EACH,GACA,EAAqB,CAAkB,CACzC;IACF,CAAe,GACM,eAAgB;GACvC;GAEA,IAAM,IAA6B;IACjC,GAAG,EAAO;IACV,MAAM,EAAO;IACb;IACA,OAAO;GACT;GASA,OAAO;IAAE,IAAI;IAAM,UAPF,EAAO,iBAAiB,KACrC,MAAM,EAAe,YAAY;KAC/B,YAAY,EAAO,gBAAgB;KACnC;IACF,CAAC,IACD,MAAM,EAAe,YAAY,CAAY;GAErB;EAC9B;CACF,CAAC;AACH"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { FormTemplateStep } from '@sage-bionetworks/synapse-client';
|
|
2
2
|
export { moveItem } from '@/utils/functions/ArrayUtils';
|
|
3
|
+
/** Label for the per-step control that binds an unbound field into that step. */
|
|
4
|
+
export declare const BIND_FIELD_LABEL = "Bind field";
|
|
3
5
|
/**
|
|
4
6
|
* A `FormTemplateStep` with a client-only stable identity, used as a React
|
|
5
7
|
* key and drag-and-drop sortable id. Steps have no natural unique field
|
|
@@ -16,6 +18,4 @@ export declare function createEditableStep(): EditableFormTemplateStep;
|
|
|
16
18
|
export declare function toEditableSteps(steps: FormTemplateStep[]): EditableFormTemplateStep[];
|
|
17
19
|
/** Strip the client-only identity before handing steps back to a caller. */
|
|
18
20
|
export declare function toFormTemplateSteps(steps: EditableFormTemplateStep[]): FormTemplateStep[];
|
|
19
|
-
/** Normalize a JSON pointer (ensure leading slash). */
|
|
20
|
-
export declare function normalizePointer(p: string): string;
|
|
21
21
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/FormTemplateEditor/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AAEnE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/FormTemplateEditor/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AAEnE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AAEvD,iFAAiF;AACjF,eAAO,MAAM,gBAAgB,eAAe,CAAA;AAI5C;;;;;;GAMG;AACH,MAAM,MAAM,wBAAwB,GAAG,gBAAgB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAE3E,qDAAqD;AACrD,wBAAgB,kBAAkB,IAAI,wBAAwB,CAO7D;AAED,2EAA2E;AAC3E,wBAAgB,eAAe,CAC7B,KAAK,EAAE,gBAAgB,EAAE,GACxB,wBAAwB,EAAE,CAE5B;AAED,4EAA4E;AAC5E,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,wBAAwB,EAAE,GAChC,gBAAgB,EAAE,CAEpB"}
|
|
@@ -1,27 +1,24 @@
|
|
|
1
1
|
import { moveItem as e } from "../../utils/functions/ArrayUtils.js";
|
|
2
2
|
//#region src/components/FormTemplateEditor/utils.ts
|
|
3
|
-
var t = 0;
|
|
4
|
-
function
|
|
3
|
+
var t = "Bind field", n = 0;
|
|
4
|
+
function r() {
|
|
5
5
|
return {
|
|
6
6
|
title: "New Step",
|
|
7
7
|
description: "",
|
|
8
8
|
fields: [],
|
|
9
|
-
uiKey: `step-${
|
|
9
|
+
uiKey: `step-${n++}`
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function i(e) {
|
|
13
13
|
return e.map((e) => ({
|
|
14
14
|
...e,
|
|
15
|
-
uiKey: `step-${
|
|
15
|
+
uiKey: `step-${n++}`
|
|
16
16
|
}));
|
|
17
17
|
}
|
|
18
|
-
function i(e) {
|
|
19
|
-
return e.map(({ uiKey: e, ...t }) => t);
|
|
20
|
-
}
|
|
21
18
|
function a(e) {
|
|
22
|
-
return e
|
|
19
|
+
return e.map(({ uiKey: e, ...t }) => t);
|
|
23
20
|
}
|
|
24
21
|
//#endregion
|
|
25
|
-
export {
|
|
22
|
+
export { t as BIND_FIELD_LABEL, r as createEditableStep, e as moveItem, i as toEditableSteps, a as toFormTemplateSteps };
|
|
26
23
|
|
|
27
24
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":[],"sources":["../../../src/components/FormTemplateEditor/utils.ts"],"sourcesContent":["import { FormTemplateStep } from '@sage-bionetworks/synapse-client'\n\nexport { moveItem } from '@/utils/functions/ArrayUtils'\n\nlet nextUiKeySeq = 0\n\n/**\n * A `FormTemplateStep` with a client-only stable identity, used as a React\n * key and drag-and-drop sortable id. Steps have no natural unique field\n * (unlike fields, whose identity is their `schemaPath`), so the editor\n * tracks one here. `uiKey` never leaves this component tree — strip it with\n * `toFormTemplateSteps` before handing steps back to a caller.\n */\nexport type EditableFormTemplateStep = FormTemplateStep & { uiKey: string }\n\n/** Create a new empty step with a fresh identity. */\nexport function createEditableStep(): EditableFormTemplateStep {\n return {\n title: 'New Step',\n description: '',\n fields: [],\n uiKey: `step-${nextUiKeySeq++}`,\n }\n}\n\n/** Attach a fresh identity to each step loaded from outside the editor. */\nexport function toEditableSteps(\n steps: FormTemplateStep[],\n): EditableFormTemplateStep[] {\n return steps.map(step => ({ ...step, uiKey: `step-${nextUiKeySeq++}` }))\n}\n\n/** Strip the client-only identity before handing steps back to a caller. */\nexport function toFormTemplateSteps(\n steps: EditableFormTemplateStep[],\n): FormTemplateStep[] {\n return steps.map(({ uiKey: _uiKey, ...rest }) => rest)\n}\n
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../../../src/components/FormTemplateEditor/utils.ts"],"sourcesContent":["import { FormTemplateStep } from '@sage-bionetworks/synapse-client'\n\nexport { moveItem } from '@/utils/functions/ArrayUtils'\n\n/** Label for the per-step control that binds an unbound field into that step. */\nexport const BIND_FIELD_LABEL = 'Bind field'\n\nlet nextUiKeySeq = 0\n\n/**\n * A `FormTemplateStep` with a client-only stable identity, used as a React\n * key and drag-and-drop sortable id. Steps have no natural unique field\n * (unlike fields, whose identity is their `schemaPath`), so the editor\n * tracks one here. `uiKey` never leaves this component tree — strip it with\n * `toFormTemplateSteps` before handing steps back to a caller.\n */\nexport type EditableFormTemplateStep = FormTemplateStep & { uiKey: string }\n\n/** Create a new empty step with a fresh identity. */\nexport function createEditableStep(): EditableFormTemplateStep {\n return {\n title: 'New Step',\n description: '',\n fields: [],\n uiKey: `step-${nextUiKeySeq++}`,\n }\n}\n\n/** Attach a fresh identity to each step loaded from outside the editor. */\nexport function toEditableSteps(\n steps: FormTemplateStep[],\n): EditableFormTemplateStep[] {\n return steps.map(step => ({ ...step, uiKey: `step-${nextUiKeySeq++}` }))\n}\n\n/** Strip the client-only identity before handing steps back to a caller. */\nexport function toFormTemplateSteps(\n steps: EditableFormTemplateStep[],\n): FormTemplateStep[] {\n return steps.map(({ uiKey: _uiKey, ...rest }) => rest)\n}\n"],"mappings":";;AAKA,IAAa,IAAmB,cAE5B,IAAe;AAYnB,SAAgB,IAA+C;CAC7D,OAAO;EACL,OAAO;EACP,aAAa;EACb,QAAQ,CAAC;EACT,OAAO,QAAQ;CACjB;AACF;AAGA,SAAgB,EACd,GAC4B;CAC5B,OAAO,EAAM,KAAI,OAAS;EAAE,GAAG;EAAM,OAAO,QAAQ;CAAiB,EAAE;AACzE;AAGA,SAAgB,EACd,GACoB;CACpB,OAAO,EAAM,KAAK,EAAE,OAAO,GAAQ,GAAG,QAAW,CAAI;AACvD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { GeneratedFormStepForRjsf } from '@/utils/jsonschema/generateDataAccessSchema';
|
|
2
|
+
import { SchemaData } from '@/utils/jsonschema/schemaData';
|
|
3
|
+
import { Ref } from 'react';
|
|
4
|
+
export type SchemaStepFormHandle = {
|
|
5
|
+
/** Validates the step's answers, showing errors against invalid fields. */
|
|
6
|
+
submit: () => void;
|
|
7
|
+
};
|
|
8
|
+
export type SchemaStepFormProps = {
|
|
9
|
+
ref?: Ref<SchemaStepFormHandle>;
|
|
10
|
+
step: GeneratedFormStepForRjsf;
|
|
11
|
+
schemaData: SchemaData;
|
|
12
|
+
onSchemaDataChange: (schemaData: SchemaData) => void;
|
|
13
|
+
/** Invoked with the complete answers when the step's answers pass validation. */
|
|
14
|
+
onValid?: (schemaData: SchemaData) => void;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* A single step of a form generated from a FormTemplate, rendered as a requester sees it. The answers of all steps
|
|
18
|
+
* are kept in `schemaData`; the step shows and updates only its own.
|
|
19
|
+
*/
|
|
20
|
+
export default function SchemaStepForm(props: SchemaStepFormProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
//# sourceMappingURL=SchemaStepForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaStepForm.d.ts","sourceRoot":"","sources":["../../../src/components/JsonSchemaForm/SchemaStepForm.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,6CAA6C,CAAA;AACtF,OAAO,EAAe,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAEvE,OAAO,EAAE,GAAG,EAA+B,MAAM,OAAO,CAAA;AAExD,MAAM,MAAM,oBAAoB,GAAG;IACjC,2EAA2E;IAC3E,MAAM,EAAE,MAAM,IAAI,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,GAAG,CAAC,EAAE,GAAG,CAAC,oBAAoB,CAAC,CAAA;IAC/B,IAAI,EAAE,wBAAwB,CAAA;IAC9B,UAAU,EAAE,UAAU,CAAA;IACtB,kBAAkB,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAA;IACpD,iFAAiF;IACjF,OAAO,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAA;CAC3C,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,KAAK,EAAE,mBAAmB,2CA0BhE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { JsonSchemaForm as e } from "./JsonSchemaForm.js";
|
|
2
|
+
import { getStepData as t } from "../../utils/jsonschema/schemaData.js";
|
|
3
|
+
import { useImperativeHandle as n, useRef as r } from "react";
|
|
4
|
+
import { Fragment as i, jsx as a } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/JsonSchemaForm/SchemaStepForm.tsx
|
|
6
|
+
function o(o) {
|
|
7
|
+
let { ref: s, step: c, schemaData: l, onSchemaDataChange: u, onValid: d } = o, f = r(null);
|
|
8
|
+
return n(s, () => ({ submit: () => f.current?.submit() })), /* @__PURE__ */ a(e, {
|
|
9
|
+
formRef: f,
|
|
10
|
+
schema: c.jsonSchema,
|
|
11
|
+
uiSchema: c.uiSchema,
|
|
12
|
+
formData: t(l, c),
|
|
13
|
+
formContext: { descriptionVariant: "inline" },
|
|
14
|
+
liveValidate: !1,
|
|
15
|
+
onChange: (e) => u({
|
|
16
|
+
...l,
|
|
17
|
+
...e.formData
|
|
18
|
+
}),
|
|
19
|
+
onSubmit: (e) => d?.({
|
|
20
|
+
...l,
|
|
21
|
+
...e.formData
|
|
22
|
+
}),
|
|
23
|
+
children: /* @__PURE__ */ a(i, {})
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { o as default };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=SchemaStepForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaStepForm.js","names":[],"sources":["../../../src/components/JsonSchemaForm/SchemaStepForm.tsx"],"sourcesContent":["import { JsonSchemaForm } from '@/components/JsonSchemaForm/JsonSchemaForm'\nimport { GeneratedFormStepForRjsf } from '@/utils/jsonschema/generateDataAccessSchema'\nimport { getStepData, SchemaData } from '@/utils/jsonschema/schemaData'\nimport RJSFForm from '@rjsf/core'\nimport { Ref, useImperativeHandle, useRef } from 'react'\n\nexport type SchemaStepFormHandle = {\n /** Validates the step's answers, showing errors against invalid fields. */\n submit: () => void\n}\n\nexport type SchemaStepFormProps = {\n ref?: Ref<SchemaStepFormHandle>\n step: GeneratedFormStepForRjsf\n schemaData: SchemaData\n onSchemaDataChange: (schemaData: SchemaData) => void\n /** Invoked with the complete answers when the step's answers pass validation. */\n onValid?: (schemaData: SchemaData) => void\n}\n\n/**\n * A single step of a form generated from a FormTemplate, rendered as a requester sees it. The answers of all steps\n * are kept in `schemaData`; the step shows and updates only its own.\n */\nexport default function SchemaStepForm(props: SchemaStepFormProps) {\n const { ref, step, schemaData, onSchemaDataChange, onValid } = props\n const formRef = useRef<RJSFForm>(null)\n\n useImperativeHandle(ref, () => ({\n submit: () => formRef.current?.submit(),\n }))\n\n return (\n <JsonSchemaForm\n formRef={formRef}\n schema={step.jsonSchema}\n uiSchema={step.uiSchema}\n formData={getStepData(schemaData, step)}\n formContext={{ descriptionVariant: 'inline' }}\n liveValidate={false}\n onChange={event =>\n onSchemaDataChange({ ...schemaData, ...event.formData })\n }\n onSubmit={event =>\n onValid?.({ ...schemaData, ...(event.formData as SchemaData) })\n }\n >\n <></>\n </JsonSchemaForm>\n )\n}\n"],"mappings":";;;;;AAwBA,SAAwB,EAAe,GAA4B;CACjE,IAAM,EAAE,QAAK,SAAM,eAAY,uBAAoB,eAAY,GACzD,IAAU,EAAiB,IAAI;CAMrC,OAJA,EAAoB,UAAY,EAC9B,cAAc,EAAQ,SAAS,OAAO,EACxC,EAAE,GAGA,kBAAC,GAAD;EACW;EACT,QAAQ,EAAK;EACb,UAAU,EAAK;EACf,UAAU,EAAY,GAAY,CAAI;EACtC,aAAa,EAAE,oBAAoB,SAAS;EAC5C,cAAc;EACd,WAAU,MACR,EAAmB;GAAE,GAAG;GAAY,GAAG,EAAM;EAAS,CAAC;EAEzD,WAAU,MACR,IAAU;GAAE,GAAG;GAAY,GAAI,EAAM;EAAwB,CAAC;YAGhE,kBAAA,GAAA,CAAI,CAAA;CACU,CAAA;AAEpB"}
|
|
@@ -6,6 +6,17 @@ import { Widget, EnumOptionsType } from '@rjsf/utils';
|
|
|
6
6
|
* where the label and value are set to the provided value.
|
|
7
7
|
*/
|
|
8
8
|
export declare function findValueOption(value: string | null | undefined, options: EnumOptionsType[]): EnumOptionsType | string | null;
|
|
9
|
+
/**
|
|
10
|
+
* Maps a multi-select form value (an array of enum values) to the Autocomplete option objects it
|
|
11
|
+
* selects. Values with no matching option (e.g. free-solo input) become `{ value, label: value }`.
|
|
12
|
+
* A non-array value selects nothing.
|
|
13
|
+
*/
|
|
14
|
+
export declare function toMultipleAutocompleteValue(value: unknown, options: EnumOptionsType[]): EnumOptionsType[];
|
|
15
|
+
/**
|
|
16
|
+
* Maps a multi-select Autocomplete selection (option objects and/or free-solo strings) back to the
|
|
17
|
+
* array of enum values stored in the form data.
|
|
18
|
+
*/
|
|
19
|
+
export declare function fromMultipleAutocompleteValue(newValue: unknown): unknown[];
|
|
9
20
|
/**
|
|
10
21
|
* Select widget compatible with react-jsonschema-form enumerations
|
|
11
22
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectWidget.d.ts","sourceRoot":"","sources":["../../../../src/components/JsonSchemaForm/widgets/SelectWidget.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAe,eAAe,EAAE,MAAM,aAAa,CAAA;AAOlE;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAChC,OAAO,EAAE,eAAe,EAAE,GACzB,eAAe,GAAG,MAAM,GAAG,IAAI,CAWjC;AAMD;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"SelectWidget.d.ts","sourceRoot":"","sources":["../../../../src/components/JsonSchemaForm/widgets/SelectWidget.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAe,eAAe,EAAE,MAAM,aAAa,CAAA;AAOlE;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAChC,OAAO,EAAE,eAAe,EAAE,GACzB,eAAe,GAAG,MAAM,GAAG,IAAI,CAWjC;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,eAAe,EAAE,GACzB,eAAe,EAAE,CAWnB;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,EAAE,CAO1E;AAMD;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,MAgG1B,CAAA"}
|
|
@@ -12,36 +12,45 @@ function o(e, t) {
|
|
|
12
12
|
label: e
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
function s(e, t) {
|
|
16
|
+
return Array.isArray(e) ? e.map((e) => t.find((t) => t.value === e) ?? {
|
|
17
|
+
value: e,
|
|
18
|
+
label: String(e)
|
|
19
|
+
}) : [];
|
|
20
|
+
}
|
|
21
|
+
function c(t) {
|
|
22
|
+
return Array.isArray(t) ? t.map((t) => e(t) && "value" in t ? t.value : t) : [];
|
|
23
|
+
}
|
|
24
|
+
var l = (i) => {
|
|
25
|
+
let { id: l, options: u, value: d, required: f, disabled: p, readonly: m, multiple: h, autofocus: g, onChange: _, onBlur: v, onFocus: y, placeholder: b, isClearable: x = !0, rawErrors: S, registry: C } = i, { enumOptions: w } = u, T = ["__oneof_select", "__anyof_select"].some((e) => l.includes(e)), E = !T && !!C.formContext.allowFreeSoloEnum, D = x && !T;
|
|
17
26
|
return /* @__PURE__ */ r(t, {
|
|
18
|
-
id:
|
|
19
|
-
value: o(
|
|
20
|
-
freeSolo:
|
|
27
|
+
id: l,
|
|
28
|
+
value: h ? s(d, w) : o(d, w),
|
|
29
|
+
freeSolo: E,
|
|
21
30
|
forcePopupIcon: !0,
|
|
22
31
|
selectOnFocus: !0,
|
|
23
32
|
clearOnBlur: !0,
|
|
24
33
|
handleHomeEndKeys: !0,
|
|
25
|
-
options:
|
|
26
|
-
readOnly:
|
|
27
|
-
disabled:
|
|
28
|
-
multiple:
|
|
29
|
-
disableClearable: !
|
|
34
|
+
options: w,
|
|
35
|
+
readOnly: m,
|
|
36
|
+
disabled: p,
|
|
37
|
+
multiple: h,
|
|
38
|
+
disableClearable: !D,
|
|
30
39
|
onChange: (t, n) => {
|
|
31
|
-
e(n) && "inputValue" in n ?
|
|
40
|
+
h ? _(c(n)) : e(n) && "inputValue" in n ? _(n.inputValue) : e(n) && "value" in n ? _(n.value) : _(n);
|
|
32
41
|
},
|
|
33
42
|
renderInput: (e) => /* @__PURE__ */ r(n, {
|
|
34
43
|
...e,
|
|
35
|
-
required:
|
|
36
|
-
placeholder:
|
|
37
|
-
error:
|
|
38
|
-
autoFocus:
|
|
39
|
-
onFocus:
|
|
40
|
-
onBlur:
|
|
44
|
+
required: f,
|
|
45
|
+
placeholder: b,
|
|
46
|
+
error: S && S.length > 0,
|
|
47
|
+
autoFocus: g,
|
|
48
|
+
onFocus: y && (() => y(l, d?.value)),
|
|
49
|
+
onBlur: v && (() => v(l, d?.value))
|
|
41
50
|
}),
|
|
42
51
|
filterOptions: (e, t) => {
|
|
43
52
|
let n = a(e, t), { inputValue: r } = t, i = e.some((e) => r === e.label);
|
|
44
|
-
return
|
|
53
|
+
return E && r !== "" && !i && n.push({
|
|
45
54
|
value: r,
|
|
46
55
|
label: `Set to custom value "${r}"`
|
|
47
56
|
}), n;
|
|
@@ -49,6 +58,6 @@ var s = (i) => {
|
|
|
49
58
|
});
|
|
50
59
|
};
|
|
51
60
|
//#endregion
|
|
52
|
-
export {
|
|
61
|
+
export { l as SelectWidget, o as findValueOption, c as fromMultipleAutocompleteValue, s as toMultipleAutocompleteValue };
|
|
53
62
|
|
|
54
63
|
//# sourceMappingURL=SelectWidget.js.map
|