synapse-react-client 4.0.40 → 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.
- package/dist/SWC.index.d.ts +1 -0
- package/dist/SWC.index.d.ts.map +1 -1
- package/dist/SWC.index.js +2 -1
- package/dist/SWC.index.js.map +1 -1
- package/dist/components/AccessRequirement/ImposeRestrictionDialog/ImposeRestrictionDialog.d.ts +1 -0
- package/dist/components/AccessRequirement/ImposeRestrictionDialog/ImposeRestrictionDialog.d.ts.map +1 -1
- package/dist/components/AccessRequirement/ImposeRestrictionDialog/ImposeRestrictionDialog.js +12 -12
- package/dist/components/AccessRequirement/ImposeRestrictionDialog/ImposeRestrictionDialog.js.map +1 -1
- 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/DataAccessRequestAccessorsFilesForm/DataAccessRequestAccessorsFilesForm.d.ts.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DataAccessRequestAccessorsFilesForm/DataAccessRequestAccessorsFilesForm.js +138 -244
- 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 +179 -63
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/EDucPreviewStep/EDucPreviewStep.js.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementFormWikiWrapper.d.ts +2 -0
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementFormWikiWrapper.d.ts.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementFormWikiWrapper.js +13 -13
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementFormWikiWrapper.js.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementItemView.d.ts +3 -2
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementItemView.d.ts.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementItemView.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.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/ResearchProjectForm/ResearchProjectForm.d.ts.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ResearchProjectForm/ResearchProjectForm.js +112 -143
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ResearchProjectForm/ResearchProjectForm.js.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ReviewDucStep/ReviewDucStep.d.ts +4 -2
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ReviewDucStep/ReviewDucStep.d.ts.map +1 -1
- package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ReviewDucStep/ReviewDucStep.js +8 -7
- 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 +79 -47
- 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 +11 -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/AclEditor/AclEditor.js +20 -20
- package/dist/components/Aridhia/AridhiaAccessStatus.d.ts.map +1 -1
- package/dist/components/Aridhia/AridhiaAccessStatus.js +51 -48
- package/dist/components/Aridhia/AridhiaAccessStatus.js.map +1 -1
- package/dist/components/Authentication/Constants.d.ts +4 -0
- package/dist/components/Authentication/Constants.d.ts.map +1 -1
- package/dist/components/Authentication/Constants.js +5 -2
- package/dist/components/Authentication/Constants.js.map +1 -1
- package/dist/components/Authentication/RecoveryCodeGrid.d.ts.map +1 -1
- package/dist/components/Authentication/RecoveryCodeGrid.js +8 -1
- package/dist/components/Authentication/RecoveryCodeGrid.js.map +1 -1
- package/dist/components/Authentication/RegenerateBackupCodesWarning.js +4 -1
- package/dist/components/Authentication/RegenerateBackupCodesWarning.js.map +1 -1
- package/dist/components/Authentication/TOTPForm.d.ts.map +1 -1
- package/dist/components/Authentication/TOTPForm.js +20 -18
- package/dist/components/Authentication/TOTPForm.js.map +1 -1
- package/dist/components/Authentication/TwoFactorBackupCodes.d.ts.map +1 -1
- package/dist/components/Authentication/TwoFactorBackupCodes.js +41 -12
- 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 +90 -77
- 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 +52 -54
- 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/ChoiceOptionsEditor.d.ts +11 -0
- package/dist/components/FormTemplateEditor/ChoiceOptionsEditor.d.ts.map +1 -0
- package/dist/components/FormTemplateEditor/ChoiceOptionsEditor.js +61 -0
- package/dist/components/FormTemplateEditor/ChoiceOptionsEditor.js.map +1 -0
- package/dist/components/FormTemplateEditor/FieldDefinitionDrawer.d.ts +33 -0
- package/dist/components/FormTemplateEditor/FieldDefinitionDrawer.d.ts.map +1 -0
- package/dist/components/FormTemplateEditor/FieldDefinitionDrawer.js +190 -0
- package/dist/components/FormTemplateEditor/FieldDefinitionDrawer.js.map +1 -0
- 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 +14 -0
- package/dist/components/FormTemplateEditor/FormTemplatePreview.d.ts.map +1 -0
- package/dist/components/FormTemplateEditor/FormTemplatePreview.js +72 -0
- package/dist/components/FormTemplateEditor/FormTemplatePreview.js.map +1 -0
- package/dist/components/FormTemplateEditor/JsonSchemaBodyEditor.d.ts +13 -0
- package/dist/components/FormTemplateEditor/JsonSchemaBodyEditor.d.ts.map +1 -0
- package/dist/components/FormTemplateEditor/JsonSchemaBodyEditor.js +33 -0
- package/dist/components/FormTemplateEditor/JsonSchemaBodyEditor.js.map +1 -0
- 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/formTemplateValidation.d.ts +32 -0
- package/dist/components/FormTemplateEditor/formTemplateValidation.d.ts.map +1 -0
- package/dist/components/FormTemplateEditor/formTemplateValidation.js +75 -0
- package/dist/components/FormTemplateEditor/formTemplateValidation.js.map +1 -0
- package/dist/components/FormTemplateEditor/schemaFieldUtils.d.ts +27 -0
- package/dist/components/FormTemplateEditor/schemaFieldUtils.d.ts.map +1 -0
- package/dist/components/FormTemplateEditor/schemaFieldUtils.js +84 -0
- package/dist/components/FormTemplateEditor/schemaFieldUtils.js.map +1 -0
- 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 +28 -0
- package/dist/components/FormTemplateEditor/useSaveFormTemplate.d.ts.map +1 -0
- package/dist/components/FormTemplateEditor/useSaveFormTemplate.js +54 -0
- package/dist/components/FormTemplateEditor/useSaveFormTemplate.js.map +1 -0
- package/dist/components/FormTemplateEditor/utils.d.ts +21 -0
- package/dist/components/FormTemplateEditor/utils.d.ts.map +1 -0
- package/dist/components/FormTemplateEditor/utils.js +24 -0
- package/dist/components/FormTemplateEditor/utils.js.map +1 -0
- package/dist/components/JsonSchemaForm/CustomFormContext.d.ts +1 -1
- package/dist/components/JsonSchemaForm/CustomFormContext.d.ts.map +1 -1
- package/dist/components/JsonSchemaForm/JsonSchemaForm.css +1 -1
- package/dist/components/JsonSchemaForm/JsonSchemaForm.module.js +1 -1
- package/dist/components/JsonSchemaForm/JsonSchemaForm.module.js.map +1 -1
- package/dist/components/JsonSchemaForm/JsonSchemaForm.module.scss +6 -1
- package/dist/components/JsonSchemaForm/templates/RJSFInputLabel.d.ts.map +1 -1
- package/dist/components/JsonSchemaForm/templates/RJSFInputLabel.js +4 -0
- package/dist/components/JsonSchemaForm/templates/RJSFInputLabel.js.map +1 -1
- 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.css +1 -1
- package/dist/components/QueryBuilder/FilterConditionRow.d.ts +3 -0
- package/dist/components/QueryBuilder/FilterConditionRow.d.ts.map +1 -1
- package/dist/components/QueryBuilder/FilterConditionRow.js +123 -123
- package/dist/components/QueryBuilder/FilterConditionRow.js.map +1 -1
- package/dist/components/QueryBuilder/FilterConditionRow.module.js +10 -11
- package/dist/components/QueryBuilder/FilterConditionRow.module.js.map +1 -1
- package/dist/components/QueryBuilder/FilterConditionRow.module.scss +0 -5
- package/dist/components/QueryBuilder/FilterGroupNode.css +1 -1
- package/dist/components/QueryBuilder/FilterGroupNode.d.ts +4 -0
- package/dist/components/QueryBuilder/FilterGroupNode.d.ts.map +1 -1
- package/dist/components/QueryBuilder/FilterGroupNode.js +85 -51
- package/dist/components/QueryBuilder/FilterGroupNode.js.map +1 -1
- package/dist/components/QueryBuilder/FilterGroupNode.module.js +10 -9
- package/dist/components/QueryBuilder/FilterGroupNode.module.js.map +1 -1
- package/dist/components/QueryBuilder/FilterGroupNode.module.scss +9 -0
- package/dist/components/QueryBuilder/QBDragHandle.d.ts +10 -0
- package/dist/components/QueryBuilder/QBDragHandle.d.ts.map +1 -0
- package/dist/components/QueryBuilder/QBDragHandle.js +22 -0
- package/dist/components/QueryBuilder/QBDragHandle.js.map +1 -0
- package/dist/components/QueryBuilder/QueryBuilderControls.d.ts.map +1 -1
- package/dist/components/QueryBuilder/QueryBuilderControls.js +120 -108
- 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 +25 -21
- package/dist/components/QueryBuilder/qbTreeToReadable.js.map +1 -1
- package/dist/components/QueryBuilder/queryBuilderDnd.d.ts +27 -0
- package/dist/components/QueryBuilder/queryBuilderDnd.d.ts.map +1 -0
- package/dist/components/QueryBuilder/queryBuilderDnd.js +41 -0
- package/dist/components/QueryBuilder/queryBuilderDnd.js.map +1 -0
- package/dist/components/QueryBuilder/queryBuilderDrag.css +1 -0
- package/dist/components/QueryBuilder/queryBuilderDrag.module.js +8 -0
- package/dist/components/QueryBuilder/queryBuilderDrag.module.js.map +1 -0
- package/dist/components/QueryBuilder/queryBuilderDrag.module.scss +12 -0
- 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/queryBuilderOperations.d.ts +13 -0
- package/dist/components/QueryBuilder/queryBuilderOperations.d.ts.map +1 -1
- package/dist/components/QueryBuilder/queryBuilderOperations.js +39 -36
- package/dist/components/QueryBuilder/queryBuilderOperations.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/QueryWrapperPlotNav/QueryWrapperPlotNav.d.ts.map +1 -1
- package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.js +46 -47
- package/dist/components/QueryWrapperPlotNav/QueryWrapperPlotNav.js.map +1 -1
- 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 +2 -0
- package/dist/components/dataaccess/UserAccessRequestHistory/InFlightEDucSignaturesTable.js.map +1 -1
- package/dist/components/entity/page/title_bar/EntityPageTitleBar.d.ts +0 -1
- package/dist/components/entity/page/title_bar/EntityPageTitleBar.d.ts.map +1 -1
- package/dist/components/entity/page/title_bar/EntityPageTitleBar.js +35 -36
- package/dist/components/entity/page/title_bar/EntityPageTitleBar.js.map +1 -1
- package/dist/components/styled/LeftRightPanel.d.ts.map +1 -1
- package/dist/components/styled/LeftRightPanel.js +19 -2
- package/dist/components/styled/LeftRightPanel.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/mocks/accessRequirement/mockFormTemplates.d.ts +4 -2
- package/dist/mocks/accessRequirement/mockFormTemplates.d.ts.map +1 -1
- package/dist/mocks/accessRequirement/mockFormTemplates.js +13 -14
- package/dist/mocks/accessRequirement/mockFormTemplates.js.map +1 -1
- package/dist/mocks/accessRequirement/mockJsonSchemas.d.ts +4 -1
- package/dist/mocks/accessRequirement/mockJsonSchemas.d.ts.map +1 -1
- package/dist/mocks/accessRequirement/mockJsonSchemas.js +24 -17
- package/dist/mocks/accessRequirement/mockJsonSchemas.js.map +1 -1
- package/dist/mocks/msw/handlers/asyncJobHandlers.d.ts +41 -14
- package/dist/mocks/msw/handlers/asyncJobHandlers.d.ts.map +1 -1
- package/dist/mocks/msw/handlers/asyncJobHandlers.js +53 -44
- package/dist/mocks/msw/handlers/asyncJobHandlers.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/chatHandlers.d.ts.map +1 -1
- package/dist/mocks/msw/handlers/chatHandlers.js +19 -13
- package/dist/mocks/msw/handlers/chatHandlers.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 +52 -46
- 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 +10 -1
- package/dist/mocks/msw/handlers/schemaHandlers.d.ts.map +1 -1
- package/dist/mocks/msw/handlers/schemaHandlers.js +30 -7
- package/dist/mocks/msw/handlers/schemaHandlers.js.map +1 -1
- package/dist/mocks/msw/handlers/searchQueryHandlers.d.ts.map +1 -1
- package/dist/mocks/msw/handlers/searchQueryHandlers.js +24 -18
- package/dist/mocks/msw/handlers/searchQueryHandlers.js.map +1 -1
- package/dist/mocks/msw/handlers/tableQueryHandlers.d.ts.map +1 -1
- package/dist/mocks/msw/handlers/tableQueryHandlers.js +35 -16
- package/dist/mocks/msw/handlers/tableQueryHandlers.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 +9 -3
- package/dist/synapse-queries/KeyFactory.d.ts.map +1 -1
- package/dist/synapse-queries/KeyFactory.js +17 -7
- 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.d.ts +0 -1
- package/dist/synapse-queries/dataaccess/index.d.ts.map +1 -1
- package/dist/synapse-queries/dataaccess/index.js +3 -4
- 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/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 -257
- package/dist/synapse-queries/jsonschema/index.js +2 -2
- package/dist/synapse-queries/jsonschema/useCreateJsonSchema.d.ts +9 -0
- package/dist/synapse-queries/jsonschema/useCreateJsonSchema.d.ts.map +1 -0
- package/dist/synapse-queries/jsonschema/useCreateJsonSchema.js +22 -0
- package/dist/synapse-queries/jsonschema/useCreateJsonSchema.js.map +1 -0
- 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/testutils/vitest.setup.js +18 -9
- package/dist/testutils/vitest.setup.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/APIConstants.d.ts +2 -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/appendFinalQueryParamKey.d.ts.map +1 -1
- package/dist/utils/appendFinalQueryParamKey.js +4 -1
- package/dist/utils/appendFinalQueryParamKey.js.map +1 -1
- package/dist/utils/featureflag/FeatureFlags.d.ts +2 -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/ArrayUtils.d.ts +3 -0
- package/dist/utils/functions/ArrayUtils.d.ts.map +1 -1
- package/dist/utils/functions/ArrayUtils.js +7 -1
- package/dist/utils/functions/ArrayUtils.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/jsonschema/generateDataAccessSchema.d.ts +26 -0
- package/dist/utils/jsonschema/generateDataAccessSchema.d.ts.map +1 -0
- package/dist/utils/jsonschema/generateDataAccessSchema.js +28 -0
- package/dist/utils/jsonschema/generateDataAccessSchema.js.map +1 -0
- package/dist/utils/jsonschema/submissionContext.d.ts +91 -0
- package/dist/utils/jsonschema/submissionContext.d.ts.map +1 -0
- package/dist/utils/jsonschema/submissionContext.js +178 -0
- package/dist/utils/jsonschema/submissionContext.js.map +1 -0
- package/package.json +13 -10
- package/dist/components/AccessRequirement/AddConditionsForUseButton/AddConditionsForUseButton.d.ts +0 -6
- package/dist/components/AccessRequirement/AddConditionsForUseButton/AddConditionsForUseButton.d.ts.map +0 -1
- package/dist/components/AccessRequirement/AddConditionsForUseButton/AddConditionsForUseButton.js +0 -32
- package/dist/components/AccessRequirement/AddConditionsForUseButton/AddConditionsForUseButton.js.map +0 -1
- package/dist/components/entity/page/title_bar/TitleBarProperties.d.ts +0 -9
- package/dist/components/entity/page/title_bar/TitleBarProperties.d.ts.map +0 -1
- package/dist/components/entity/page/title_bar/TitleBarProperties.js +0 -24
- package/dist/components/entity/page/title_bar/TitleBarProperties.js.map +0 -1
- package/dist/synapse-queries/dataaccess/useGenerateDataAccessSchema.d.ts +0 -21
- package/dist/synapse-queries/dataaccess/useGenerateDataAccessSchema.d.ts.map +0 -1
- package/dist/synapse-queries/dataaccess/useGenerateDataAccessSchema.js +0 -34
- package/dist/synapse-queries/dataaccess/useGenerateDataAccessSchema.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formTemplateValidation.js","names":[],"sources":["../../../src/components/FormTemplateEditor/formTemplateValidation.ts"],"sourcesContent":["import { RJSFSchema } from '@rjsf/utils'\nimport {\n FormTemplateField,\n FormTemplateStep,\n} from '@sage-bionetworks/synapse-client'\nimport {\n listResolvedSchemaProperties,\n pointerToPropertyKey,\n propertyKeyToPointer,\n resolveSchemaPropertyAtPointer,\n} from '@/utils/jsonschema/submissionContext'\n\n/**\n * A property is a \"leaf\" — the only kind a `FormTemplateField.schemaPath` may address — when it\n * is not itself a nested object schema with its own `properties`. The simple editor only ever\n * authors leaves, but the raw JSON Schema escape hatch can produce a nested object.\n */\nexport function isLeafSchemaProperty(subSchema: RJSFSchema): boolean {\n return !(subSchema.type === 'object' && subSchema.properties != null)\n}\n\n/** RJSF `ui:widget` names compatible with each JSON Schema property shape. */\nconst WIDGET_COMPATIBILITY: Record<string, (subSchema: RJSFSchema) => boolean> =\n {\n textarea: s => s.type === 'string' && !s.enum,\n password: s => s.type === 'string' && !s.enum,\n radio: s =>\n ((s.type === 'string' || s.type === 'boolean') && !!s.enum) ||\n s.type === 'boolean',\n select: s => s.type === 'string' && !!s.enum,\n checkboxes: s => s.type === 'array',\n checkbox: s => s.type === 'boolean',\n updown: s => s.type === 'number' || s.type === 'integer',\n range: s => s.type === 'number' || s.type === 'integer',\n }\n\n/**\n * Whether a field's `uiDefinition` (an RJSF `UiSchema` fragment) declares a `ui:widget`\n * incompatible with the resolved property's type/format. An empty or widget-less `uiDefinition`\n * is always compatible — there is nothing to conflict with.\n */\nexport function isUiHintCompatible(\n subSchema: RJSFSchema,\n uiDefinition: unknown,\n): boolean {\n const widget = (uiDefinition as Record<string, unknown> | undefined)?.[\n 'ui:widget'\n ]\n if (typeof widget !== 'string') return true\n const isCompatible = WIDGET_COMPATIBILITY[widget]\n return isCompatible ? isCompatible(subSchema) : true\n}\n\nexport type FormTemplateFieldValidationError = {\n /** Index of the step/field slot this error is anchored to. Omitted for an error against a\n * schema-required property that isn't bound to any field -- there is no slot to anchor it to. */\n stepIndex?: number\n fieldIndex?: number\n schemaPath: string\n message: string\n}\n\n/**\n * Replicates the three rules the server enforces on `FormTemplateField` at create/update time\n * (see the `FormTemplateField` doc comment), so the editor can block save and point the error at\n * the offending field before ever reaching the server: the server only returns a flat,\n * concatenated message, not per-field errors. Also flags a schema property the server will\n * require (per its resolved submission context) that no field in the template binds to -- the\n * server accepts this silently, but the requester would then be unable to satisfy it.\n */\nexport function validateFormTemplateFields(\n steps: FormTemplateStep[],\n jsonSchema: RJSFSchema,\n): FormTemplateFieldValidationError[] {\n const errors: FormTemplateFieldValidationError[] = []\n const seenSchemaPaths = new Set<string>()\n const boundPropertyKeys = new Set<string>()\n\n steps.forEach((step, stepIndex) => {\n step.fields.forEach((field: FormTemplateField, fieldIndex: number) => {\n const { schemaPath } = field\n\n if (seenSchemaPaths.has(schemaPath)) {\n errors.push({\n stepIndex,\n fieldIndex,\n schemaPath,\n message: `\"${schemaPath}\" is already bound to another field in this template.`,\n })\n return\n }\n seenSchemaPaths.add(schemaPath)\n\n const propertyKey = pointerToPropertyKey(schemaPath)\n if (propertyKey) boundPropertyKeys.add(propertyKey)\n\n const subSchema = resolveSchemaPropertyAtPointer(\n jsonSchema,\n schemaPath,\n )?.subSchema\n if (!subSchema) {\n errors.push({\n stepIndex,\n fieldIndex,\n schemaPath,\n message: `\"${schemaPath}\" does not resolve to a property in the schema.`,\n })\n return\n }\n\n if (!isLeafSchemaProperty(subSchema)) {\n errors.push({\n stepIndex,\n fieldIndex,\n schemaPath,\n message: `\"${schemaPath}\" is a nested object, not a single field.`,\n })\n return\n }\n\n if (!isUiHintCompatible(subSchema, field.uiDefinition)) {\n errors.push({\n stepIndex,\n fieldIndex,\n schemaPath,\n message: `The UI hint for \"${schemaPath}\" is incompatible with its property type.`,\n })\n }\n })\n })\n\n for (const property of listResolvedSchemaProperties(jsonSchema)) {\n if (property.isRequired && !boundPropertyKeys.has(property.propertyKey)) {\n errors.push({\n schemaPath: propertyKeyToPointer(property.propertyKey),\n message: `\"${property.propertyKey}\" is required by the schema but is not bound to any field in this template.`,\n })\n }\n }\n\n return errors\n}\n"],"mappings":";;AAiBA,SAAgB,EAAqB,GAAgC;CACnE,OAAO,EAAE,EAAU,SAAS,YAAY,EAAU,cAAc;AAClE;AAGA,IAAM,IACJ;CACE,WAAU,MAAK,EAAE,SAAS,YAAY,CAAC,EAAE;CACzC,WAAU,MAAK,EAAE,SAAS,YAAY,CAAC,EAAE;CACzC,QAAO,OACH,EAAE,SAAS,YAAY,EAAE,SAAS,cAAc,CAAC,CAAC,EAAE,QACtD,EAAE,SAAS;CACb,SAAQ,MAAK,EAAE,SAAS,YAAY,CAAC,CAAC,EAAE;CACxC,aAAY,MAAK,EAAE,SAAS;CAC5B,WAAU,MAAK,EAAE,SAAS;CAC1B,SAAQ,MAAK,EAAE,SAAS,YAAY,EAAE,SAAS;CAC/C,QAAO,MAAK,EAAE,SAAS,YAAY,EAAE,SAAS;AAChD;AAOF,SAAgB,EACd,GACA,GACS;CACT,IAAM,IAAU,IACd;CAEF,IAAI,OAAO,KAAW,UAAU,OAAO;CACvC,IAAM,IAAe,EAAqB;CAC1C,OAAO,IAAe,EAAa,CAAS,IAAI;AAClD;AAmBA,SAAgB,EACd,GACA,GACoC;CACpC,IAAM,IAA6C,CAAC,GAC9C,oBAAkB,IAAI,IAAY,GAClC,oBAAoB,IAAI,IAAY;CAE1C,EAAM,SAAS,GAAM,MAAc;EACjC,EAAK,OAAO,SAAS,GAA0B,MAAuB;GACpE,IAAM,EAAE,kBAAe;GAEvB,IAAI,EAAgB,IAAI,CAAU,GAAG;IACnC,EAAO,KAAK;KACV;KACA;KACA;KACA,SAAS,IAAI,EAAW;IAC1B,CAAC;IACD;GACF;GACA,EAAgB,IAAI,CAAU;GAE9B,IAAM,IAAc,EAAqB,CAAU;GACnD,AAAI,KAAa,EAAkB,IAAI,CAAW;GAElD,IAAM,IAAY,EAChB,GACA,CACF,GAAG;GACH,IAAI,CAAC,GAAW;IACd,EAAO,KAAK;KACV;KACA;KACA;KACA,SAAS,IAAI,EAAW;IAC1B,CAAC;IACD;GACF;GAEA,IAAI,CAAC,EAAqB,CAAS,GAAG;IACpC,EAAO,KAAK;KACV;KACA;KACA;KACA,SAAS,IAAI,EAAW;IAC1B,CAAC;IACD;GACF;GAEA,AAAK,EAAmB,GAAW,EAAM,YAAY,KACnD,EAAO,KAAK;IACV;IACA;IACA;IACA,SAAS,oBAAoB,EAAW;GAC1C,CAAC;EAEL,CAAC;CACH,CAAC;CAED,KAAK,IAAM,KAAY,EAA6B,CAAU,GAC5D,AAAI,EAAS,cAAc,CAAC,EAAkB,IAAI,EAAS,WAAW,KACpE,EAAO,KAAK;EACV,YAAY,EAAqB,EAAS,WAAW;EACrD,SAAS,IAAI,EAAS,YAAY;CACpC,CAAC;CAIL,OAAO;AACT"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { RJSFSchema } from '@rjsf/utils';
|
|
2
|
+
/**
|
|
3
|
+
* The set of property shapes the simple editor knows how to author. Anything
|
|
4
|
+
* outside this set surfaces in the UI as "advanced" and must be edited via the
|
|
5
|
+
* raw JSON Schema view.
|
|
6
|
+
*/
|
|
7
|
+
export type SimpleFieldType = 'text' | 'number' | 'boolean' | 'choice' | 'multiChoice' | 'file';
|
|
8
|
+
export declare const FIELD_TYPE_OPTIONS: {
|
|
9
|
+
value: SimpleFieldType;
|
|
10
|
+
label: string;
|
|
11
|
+
}[];
|
|
12
|
+
export declare function detectFieldType(prop: RJSFSchema | undefined): SimpleFieldType | null;
|
|
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[];
|
|
16
|
+
/** Build a fresh schema body for the given simple type, preserving label and help text. */
|
|
17
|
+
export declare function applyFieldType(prev: RJSFSchema, type: SimpleFieldType): RJSFSchema;
|
|
18
|
+
/** Derive a unique camelCase JSON property key from a display title. */
|
|
19
|
+
export declare function generatePropertyKey(title: string, existingKeys: Set<string>): string;
|
|
20
|
+
/**
|
|
21
|
+
* Sanitize a manually-typed property key: strip characters that aren't
|
|
22
|
+
* valid in a JSON Schema property key used as a JS identifier, preserving
|
|
23
|
+
* the editor's casing (unlike `generatePropertyKey`, which derives a
|
|
24
|
+
* camelCase key from a display title).
|
|
25
|
+
*/
|
|
26
|
+
export declare function sanitizePropertyKey(raw: string): string;
|
|
27
|
+
//# sourceMappingURL=schemaFieldUtils.d.ts.map
|
|
@@ -0,0 +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,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"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
//#region src/components/FormTemplateEditor/schemaFieldUtils.ts
|
|
2
|
+
var e = [
|
|
3
|
+
{
|
|
4
|
+
value: "text",
|
|
5
|
+
label: "Text"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
value: "number",
|
|
9
|
+
label: "Number"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
value: "boolean",
|
|
13
|
+
label: "Yes / No"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
value: "choice",
|
|
17
|
+
label: "Single choice"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
value: "multiChoice",
|
|
21
|
+
label: "Multiple choice (select many)"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
value: "file",
|
|
25
|
+
label: "File upload"
|
|
26
|
+
}
|
|
27
|
+
];
|
|
28
|
+
function t(e) {
|
|
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;
|
|
34
|
+
}
|
|
35
|
+
function n(t) {
|
|
36
|
+
return t === null ? "Advanced" : e.find((e) => e.value === t)?.label ?? "Advanced";
|
|
37
|
+
}
|
|
38
|
+
function r(e) {
|
|
39
|
+
let t = e.enum ?? e.items?.enum;
|
|
40
|
+
return Array.isArray(t) ? t : [];
|
|
41
|
+
}
|
|
42
|
+
function i(e, t) {
|
|
43
|
+
let n = {
|
|
44
|
+
title: e.title,
|
|
45
|
+
description: e.description
|
|
46
|
+
}, i = r(e), a = i.length > 0 ? i : ["Option 1"];
|
|
47
|
+
switch (t) {
|
|
48
|
+
case "text":
|
|
49
|
+
n.type = "string";
|
|
50
|
+
break;
|
|
51
|
+
case "number":
|
|
52
|
+
n.type = "number";
|
|
53
|
+
break;
|
|
54
|
+
case "boolean":
|
|
55
|
+
n.type = "boolean";
|
|
56
|
+
break;
|
|
57
|
+
case "choice":
|
|
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;
|
|
65
|
+
break;
|
|
66
|
+
case "file":
|
|
67
|
+
n.type = "number", n.format = "synapse-filehandle-id";
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
return n;
|
|
71
|
+
}
|
|
72
|
+
function a(e, t) {
|
|
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;
|
|
74
|
+
for (; t.has(r);) i += 1, r = `${n}${i}`;
|
|
75
|
+
return r;
|
|
76
|
+
}
|
|
77
|
+
function o(e) {
|
|
78
|
+
let t = e.replace(/[^A-Za-z0-9_]/g, "");
|
|
79
|
+
return /^[0-9]/.test(t) ? `_${t}` : t;
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
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 };
|
|
83
|
+
|
|
84
|
+
//# sourceMappingURL=schemaFieldUtils.js.map
|
|
@@ -0,0 +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 =\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,WAAW,yBAAyB,OAAO;CACpD,IAAI,EAAK,SAAS,YAAY,MAAM,QAAQ,EAAK,IAAI,GAAG,OAAO;CAG/D,IAAM,IAAQ,EAAK;CAYnB,OAVE,EAAK,SAAS,WACd,EAAK,gBAAgB,MACrB,GAAO,SAAS,YAChB,MAAM,QAAQ,EAAM,IAAI,IAEjB,gBAEL,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,EAAc,GAA4B;CACxD,IAAM,IAAU,EAAK,QAAS,EAAK,OAAkC;CACrE,OAAO,MAAM,QAAQ,CAAO,IAAK,IAAuB,CAAC;AAC3D;AAGA,SAAgB,EACd,GACA,GACY;CACZ,IAAM,IAAmB;EACvB,OAAO,EAAK;EACZ,aAAa,EAAK;CACpB,GACM,IAAkB,EAAc,CAAI,GAEpC,IAAU,EAAgB,SAAS,IAAI,IAAkB,CAAC,UAAU;CAC1E,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,OAAO;GACZ;EACF,KAAK;GAGH,AAFA,EAAK,OAAO,SACZ,EAAK,QAAQ;IAAE,MAAM;IAAU,MAAM;GAAQ,GAC7C,EAAK,cAAc;GACnB;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"}
|
|
@@ -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,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"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { FormTemplate } from '@sage-bionetworks/synapse-client';
|
|
2
|
+
import { SynapseClientError } from '@sage-bionetworks/synapse-client/util/SynapseClientError';
|
|
3
|
+
import { RJSFSchema } from '@rjsf/utils';
|
|
4
|
+
import { UseMutationOptions } from '@tanstack/react-query';
|
|
5
|
+
import { EditableFormTemplateStep } from './utils';
|
|
6
|
+
import { FormTemplateFieldValidationError } from './formTemplateValidation';
|
|
7
|
+
export type SaveFormTemplateDraftParams = {
|
|
8
|
+
initialTemplate?: FormTemplate;
|
|
9
|
+
initialJsonSchema?: RJSFSchema;
|
|
10
|
+
name: string;
|
|
11
|
+
jsonSchema: RJSFSchema;
|
|
12
|
+
steps: EditableFormTemplateStep[];
|
|
13
|
+
};
|
|
14
|
+
export type SaveFormTemplateDraftResult = {
|
|
15
|
+
ok: true;
|
|
16
|
+
template: FormTemplate;
|
|
17
|
+
} | {
|
|
18
|
+
ok: false;
|
|
19
|
+
validationErrors: FormTemplateFieldValidationError[];
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Owns the create-schema, create-template, and update-template mutations, and sequences them
|
|
23
|
+
* into a single save mutation. A validation failure resolves as `{ ok: false, validationErrors }`
|
|
24
|
+
* rather than rejecting; a network failure (including a 412 conflict from a concurrent edit)
|
|
25
|
+
* rejects normally, surfaced via the returned mutation's `error`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function useSaveFormTemplate(options?: Omit<UseMutationOptions<SaveFormTemplateDraftResult, SynapseClientError, SaveFormTemplateDraftParams>, 'mutationFn'>): import("@tanstack/react-query").UseMutationResult<SaveFormTemplateDraftResult, SynapseClientError, SaveFormTemplateDraftParams, unknown>;
|
|
28
|
+
//# sourceMappingURL=useSaveFormTemplate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,54 @@
|
|
|
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";
|
|
10
|
+
//#region src/components/FormTemplateEditor/useSaveFormTemplate.ts
|
|
11
|
+
function p(p) {
|
|
12
|
+
let m = d(), { synapseClient: h, keyFactory: g } = e(), _ = i(), v = t(), y = n();
|
|
13
|
+
return u({
|
|
14
|
+
...p,
|
|
15
|
+
mutationFn: async (e) => {
|
|
16
|
+
let t = c(e.steps), n = l(t, e.jsonSchema);
|
|
17
|
+
if (n.length > 0) return {
|
|
18
|
+
ok: !1,
|
|
19
|
+
validationErrors: n
|
|
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 = {
|
|
36
|
+
...e.initialTemplate,
|
|
37
|
+
name: e.name,
|
|
38
|
+
schema$id: i,
|
|
39
|
+
steps: t
|
|
40
|
+
};
|
|
41
|
+
return {
|
|
42
|
+
ok: !0,
|
|
43
|
+
template: e.initialTemplate?.id ? await y.mutateAsync({
|
|
44
|
+
templateId: e.initialTemplate.id,
|
|
45
|
+
formTemplate: u
|
|
46
|
+
}) : await v.mutateAsync(u)
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export { p as useSaveFormTemplate };
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=useSaveFormTemplate.js.map
|
|
@@ -0,0 +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 { 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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FormTemplateStep } from '@sage-bionetworks/synapse-client';
|
|
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";
|
|
5
|
+
/**
|
|
6
|
+
* A `FormTemplateStep` with a client-only stable identity, used as a React
|
|
7
|
+
* key and drag-and-drop sortable id. Steps have no natural unique field
|
|
8
|
+
* (unlike fields, whose identity is their `schemaPath`), so the editor
|
|
9
|
+
* tracks one here. `uiKey` never leaves this component tree — strip it with
|
|
10
|
+
* `toFormTemplateSteps` before handing steps back to a caller.
|
|
11
|
+
*/
|
|
12
|
+
export type EditableFormTemplateStep = FormTemplateStep & {
|
|
13
|
+
uiKey: string;
|
|
14
|
+
};
|
|
15
|
+
/** Create a new empty step with a fresh identity. */
|
|
16
|
+
export declare function createEditableStep(): EditableFormTemplateStep;
|
|
17
|
+
/** Attach a fresh identity to each step loaded from outside the editor. */
|
|
18
|
+
export declare function toEditableSteps(steps: FormTemplateStep[]): EditableFormTemplateStep[];
|
|
19
|
+
/** Strip the client-only identity before handing steps back to a caller. */
|
|
20
|
+
export declare function toFormTemplateSteps(steps: EditableFormTemplateStep[]): FormTemplateStep[];
|
|
21
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +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;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"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { moveItem as e } from "../../utils/functions/ArrayUtils.js";
|
|
2
|
+
//#region src/components/FormTemplateEditor/utils.ts
|
|
3
|
+
var t = "Bind field", n = 0;
|
|
4
|
+
function r() {
|
|
5
|
+
return {
|
|
6
|
+
title: "New Step",
|
|
7
|
+
description: "",
|
|
8
|
+
fields: [],
|
|
9
|
+
uiKey: `step-${n++}`
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function i(e) {
|
|
13
|
+
return e.map((e) => ({
|
|
14
|
+
...e,
|
|
15
|
+
uiKey: `step-${n++}`
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
function a(e) {
|
|
19
|
+
return e.map(({ uiKey: e, ...t }) => t);
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { t as BIND_FIELD_LABEL, r as createEditableStep, e as moveItem, i as toEditableSteps, a as toFormTemplateSteps };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +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\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"}
|
|
@@ -13,7 +13,7 @@ export interface CustomFormContext extends FormContextType {
|
|
|
13
13
|
/**
|
|
14
14
|
* Allows varying the appearance of descriptions in the UI as either a popover or an expand/collapse control
|
|
15
15
|
*/
|
|
16
|
-
descriptionVariant?: 'popover' | 'expand';
|
|
16
|
+
descriptionVariant?: 'popover' | 'expand' | 'inline';
|
|
17
17
|
/**
|
|
18
18
|
* Allows varying the format of the description in the UI. If 'table', then the description and type are both shown
|
|
19
19
|
* in a table format. If 'string', then the description is shown as a string.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomFormContext.d.ts","sourceRoot":"","sources":["../../../src/components/JsonSchemaForm/CustomFormContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7C,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD;;;;;;;;OAQG;IACH,4BAA4B,CAAC,EAAE,OAAO,CAAA;IAEtC;;OAEG;IACH,kBAAkB,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"CustomFormContext.d.ts","sourceRoot":"","sources":["../../../src/components/JsonSchemaForm/CustomFormContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7C,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD;;;;;;;;OAQG;IACH,4BAA4B,CAAC,EAAE,OAAO,CAAA;IAEtC;;OAEG;IACH,kBAAkB,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAA;IAEpD;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;IAEtC;;OAEG;IACH,gCAAgC,CAAC,EAAE,OAAO,CAAA;IAE1C;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAE3B;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,aAAa,GAAG,UAAU,CAAA;CAC3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._jsonSchemaForm_zdhfc_1{grid-template-rows:auto auto auto auto auto;margin-bottom:15px;display:grid}._jsonSchemaForm_zdhfc_1 .react-select-container>.form-control{height:53.33px}._jsonSchemaForm_zdhfc_1 .form-group.rjsf-field-array{margin-bottom:0}._jsonSchemaForm_zdhfc_1 .form-control{height:unset}._jsonSchemaForm_zdhfc_1 .MuiTextField-root:not(.datetime-picker){display:flex}._jsonSchemaForm_zdhfc_1 .rjsf-array-item .LabelContainer{display:none!important}._jsonSchemaForm_zdhfc_1>.form-group{grid-row-start:1}._jsonSchemaForm_zdhfc_1>hr{grid-row-start:4;width:100%}._jsonSchemaForm_zdhfc_1 .row{padding:0 10px}._jsonSchemaForm_zdhfc_1 .field-description-inline{margin-bottom:8px}._jsonSchemaForm_zdhfc_1 .rjsf-field-array>.field-description{margin-top:0;margin-bottom:8px}._jsonSchemaForm_zdhfc_1 .rjsf-array-item .field-description,._jsonSchemaForm_zdhfc_1 .rjsf-array-item .field-description-inline,._jsonSchemaForm_zdhfc_1 .rjsf-array-item .HelpButton{display:none}._jsonSchemaForm_zdhfc_1 .rjsf-array-item .form-control,._jsonSchemaForm_zdhfc_1 .rjsf-array-item .react-select-container{grid-row-start:widget}._jsonSchemaForm_zdhfc_1 .rjsf-array-item div{grid-row-start:errors}._jsonSchemaForm_zdhfc_1 .LabelContainer{display:flex}._jsonSchemaForm_zdhfc_1 .LabelContainer label{flex-grow:1}._jsonSchemaForm_zdhfc_1 .LabelContainer label span.required{color:var(--synapse-red-required);margin-left:2px}._jsonSchemaForm_zdhfc_1 select{background-color:var(--synapse-gray-light)}._jsonSchemaForm_zdhfc_1 .rjsf-field-array>.rjsf-array-item>label.form-label{display:none}._jsonSchemaForm_zdhfc_1 .HelpButton{float:right;cursor:pointer;margin:0 0 .5rem}._jsonSchemaForm_zdhfc_1 table.FieldDescriptionTable tr th,._jsonSchemaForm_zdhfc_1 table.FieldDescriptionTable tr td{vertical-align:middle;padding:3px 0}._jsonSchemaForm_zdhfc_1 table.FieldDescriptionTable tr th .field-description,._jsonSchemaForm_zdhfc_1 table.FieldDescriptionTable tr td .field-description{margin-bottom:0}._jsonSchemaForm_zdhfc_1 table.FieldDescriptionTable tr th{color:var(--synapse-text-color-disabled);padding-right:25px;font-weight:400}
|