nmrium 0.29.0 → 0.31.0
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/README.md +12 -2
- package/lib/component/1d/ApodizationLine.d.ts +3 -0
- package/lib/component/1d/ApodizationLine.js +49 -0
- package/lib/component/1d/Chart1D.js +4 -2
- package/lib/component/1d/ExclusionZoneAnnotation.d.ts +1 -1
- package/lib/component/1d/ExclusionZoneAnnotation.js +14 -7
- package/lib/component/1d/FooterBanner.js +3 -1
- package/lib/component/1d/IntegralResizable.js +5 -4
- package/lib/component/1d/IntegralsSeries.js +3 -1
- package/lib/component/1d/LinesSeries.js +7 -5
- package/lib/component/1d/SpectraTracker.js +1 -1
- package/lib/component/1d/Viewer1D.js +10 -13
- package/lib/component/1d/database/DatabaseElements.js +2 -2
- package/lib/component/1d/database/DatabaseSpectrum.js +3 -3
- package/lib/component/1d/database/ResurrectedDatabaseRanges.js +3 -3
- package/lib/component/1d/jCouplingGraph/JGraph.js +5 -1
- package/lib/component/1d/multiAnalysis/AnalysisRange.js +16 -14
- package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib/component/1d/multiplicityTree/MultiplicityTree.js +6 -5
- package/lib/component/1d/{PeakAnnotation.d.ts → peaks/PeakAnnotation.d.ts} +1 -2
- package/lib/component/1d/{PeakAnnotation.js → peaks/PeakAnnotation.js} +8 -9
- package/lib/component/1d/{PeakAnnotations.d.ts → peaks/PeakAnnotations.d.ts} +0 -0
- package/lib/component/1d/peaks/PeakAnnotations.js +28 -0
- package/lib/component/1d/peaks/PeaksShapes.d.ts +3 -0
- package/lib/component/1d/peaks/PeaksShapes.js +37 -0
- package/lib/component/1d/peaks/usePeakShapesPath.d.ts +13 -0
- package/lib/component/1d/peaks/usePeakShapesPath.js +49 -0
- package/lib/component/1d/ranges/Range.js +4 -4
- package/lib/component/1d/ranges/Ranges.js +8 -2
- package/lib/component/1d/tool/PeakPointer.js +3 -1
- package/lib/component/1d/tool/XLabelPointer.js +3 -1
- package/lib/component/2d/Contours.js +3 -1
- package/lib/component/2d/FooterBanner.js +5 -3
- package/lib/component/2d/Viewer2D.js +6 -6
- package/lib/component/2d/XAxis.js +2 -2
- package/lib/component/2d/YAxis.js +2 -2
- package/lib/component/2d/tools/XYLabelPointer.js +3 -1
- package/lib/component/2d/tools/slicing/SlicingView.js +3 -1
- package/lib/component/2d/zones/IndicationLines.js +1 -1
- package/lib/component/2d/zones/Signal.d.ts +3 -2
- package/lib/component/2d/zones/Signal.js +3 -3
- package/lib/component/2d/zones/Zone.d.ts +1 -1
- package/lib/component/2d/zones/Zone.js +4 -4
- package/lib/component/2d/zones/Zones.js +14 -19
- package/lib/component/EventsTrackers/KeysListenerTracker.js +91 -52
- package/lib/component/NMRium.d.ts +2 -0
- package/lib/component/NMRium.js +14 -3
- package/lib/component/assignment/AssignmentsContext.d.ts +1 -1
- package/lib/component/context/GlobalContext.d.ts +1 -1
- package/lib/component/context/GlobalContext.js +3 -3
- package/lib/component/elements/ActiveButton.d.ts +17 -0
- package/lib/component/elements/ActiveButton.js +28 -0
- package/lib/component/elements/Button.d.ts +6 -6
- package/lib/component/elements/Button.js +5 -5
- package/lib/component/elements/ButtonToolTip.js +1 -1
- package/lib/component/elements/CheckBox.d.ts +2 -6
- package/lib/component/elements/CheckBox.js +4 -6
- package/lib/component/elements/Input.d.ts +5 -4
- package/lib/component/elements/Input.js +1 -1
- package/lib/component/elements/Label.d.ts +8 -6
- package/lib/component/elements/Label.js +3 -3
- package/lib/component/elements/MoleculeSelection.d.ts +2 -2
- package/lib/component/elements/MoleculeSelection.js +1 -1
- package/lib/component/elements/NextPrev.js +1 -1
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.d.ts +2 -2
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +2 -2
- package/lib/component/elements/ReactTable/ReactTable.d.ts +2 -2
- package/lib/component/elements/Select.d.ts +7 -11
- package/lib/component/elements/Select.js +6 -8
- package/lib/component/elements/Tab/Tab.js +1 -1
- package/lib/component/elements/Table/Table.d.ts +1 -2
- package/lib/component/elements/Table/Table.js +2 -2
- package/lib/component/elements/ToggleButton.d.ts +1 -2
- package/lib/component/elements/ToggleButton.js +3 -2
- package/lib/component/elements/accordion/AccordionItem.js +2 -2
- package/lib/component/elements/formik/FormikNumberInput.d.ts +1 -1
- package/lib/component/elements/formik/FormikOnChange.d.ts +3 -2
- package/lib/component/elements/formik/FormikOnChange.js +11 -5
- package/lib/component/elements/popup/Modal/ConfirmDialog.js +1 -1
- package/lib/component/elements/popup/Modal/Provider.d.ts +3 -3
- package/lib/component/elements/popup/Modal/Provider.js +8 -11
- package/lib/component/elements/resizer/DivResizer.js +3 -3
- package/lib/component/elements/resizer/Resizer.d.ts +1 -0
- package/lib/component/elements/resizer/SVGResizer.js +3 -3
- package/lib/component/header/ApodizationOptionsPanel.d.ts +2 -0
- package/lib/component/header/ApodizationOptionsPanel.js +81 -0
- package/lib/component/header/AutoPeakPickingOptionPanel.d.ts +2 -1
- package/lib/component/header/AutoPeakPickingOptionPanel.js +40 -36
- package/lib/component/header/BaseLineCorrectionPanel.d.ts +1 -2
- package/lib/component/header/BaseLineCorrectionPanel.js +84 -52
- package/lib/component/header/Header.js +5 -2
- package/lib/component/header/HeaderContainer.d.ts +7 -0
- package/lib/component/header/HeaderContainer.js +10 -0
- package/lib/component/header/ManualPhaseCorrectionPanel.js +27 -29
- package/lib/component/header/RangesPickingOptionPanel.js +19 -21
- package/lib/component/header/ZeroFillingOptionsPanel.js +52 -47
- package/lib/component/header/Zones2DOptionPanel.js +11 -13
- package/lib/component/highlight/index.d.ts +27 -10
- package/lib/component/highlight/index.js +19 -17
- package/lib/component/hooks/useActiveSpectrumStyleOptions.js +2 -2
- package/lib/component/hooks/useCheckToolsVisibility.d.ts +10 -1
- package/lib/component/hooks/useCheckToolsVisibility.js +31 -1
- package/lib/component/hooks/useDatumWithSpectraStatistics.js +3 -1
- package/lib/component/hooks/useExport.d.ts +0 -1
- package/lib/component/hooks/useExport.js +1 -17
- package/lib/component/hooks/useFilter.d.ts +1 -0
- package/lib/component/hooks/useFilter.js +7 -0
- package/lib/component/hooks/useIntegralPath.js +5 -2
- package/lib/component/hooks/useNucleus.js +4 -4
- package/lib/component/hooks/useSpectraPerNucleus.js +1 -1
- package/lib/component/hooks/useSpectrum.js +3 -1
- package/lib/component/hooks/useToolsFunctions.js +1 -1
- package/lib/component/loader/DropZone.js +8 -148
- package/lib/component/modal/AlignSpectraModal.js +1 -2
- package/lib/component/modal/EditPeakShapeModal.d.ts +9 -0
- package/lib/component/modal/EditPeakShapeModal.js +85 -0
- package/lib/component/modal/MoleculeStructureEditorModal.d.ts +3 -3
- package/lib/component/modal/MoleculeStructureEditorModal.js +2 -3
- package/lib/component/modal/MultipleSpectraFiltersModal/index.js +1 -2
- package/lib/component/modal/PredictSpectraModal.js +1 -1
- package/lib/component/modal/changeSum/ChangeSumModal.d.ts +1 -1
- package/lib/component/modal/changeSum/ChangeSumModal.js +9 -11
- package/lib/component/modal/changeSum/SelectMolecule.js +2 -2
- package/lib/component/modal/editRange/EditRangeModal.js +3 -3
- package/lib/component/modal/editRange/forms/components/CouplingsTable.js +4 -9
- package/lib/component/modal/setting/DatabasesTabContent.js +2 -2
- package/lib/component/modal/setting/DisplayTabContent.js +1 -1
- package/lib/component/modal/setting/FormattingTabContent.js +2 -2
- package/lib/component/modal/setting/GeneralSettings.js +1 -1
- package/lib/component/modal/setting/ToolsTabContent.js +17 -13
- package/lib/component/modal/setting/WorkspaceItem.d.ts +2 -2
- package/lib/component/modal/setting/WorkspaceItem.js +2 -2
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +1 -1
- package/lib/component/panels/IntegralsPanel/IntegralTable.js +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculeHeader.d.ts +3 -3
- package/lib/component/panels/MoleculesPanel/MoleculeHeader.js +3 -3
- package/lib/component/panels/MoleculesPanel/MoleculePanel.d.ts +5 -4
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +13 -10
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts +4 -2
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -6
- package/lib/component/panels/MoleculesPanel/Utilities.d.ts +1 -2
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts +5 -3
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +12 -4
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
- package/lib/component/panels/Panels.js +3 -3
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +47 -22
- package/lib/component/panels/PeaksPanel/PeaksPreferences.js +17 -0
- package/lib/component/panels/PeaksPanel/PeaksTable.js +44 -13
- package/lib/component/panels/RangesPanel/RangesHeader.d.ts +2 -1
- package/lib/component/panels/RangesPanel/RangesHeader.js +10 -9
- package/lib/component/panels/RangesPanel/RangesPanel.js +7 -3
- package/lib/component/panels/RangesPanel/RangesTableRow.js +4 -4
- package/lib/component/panels/RangesPanel/TableColumns/ActionsColumn.js +1 -1
- package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +3 -2
- package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.d.ts +3 -3
- package/lib/component/panels/RangesPanel/hooks/useMapRanges.js +3 -3
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -1
- package/lib/component/panels/SpectrumsPanel/SpectrumListItem.js +1 -1
- package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -1
- package/lib/component/panels/SpectrumsPanel/base/ColorIndicator.js +2 -2
- package/lib/component/panels/SpectrumsPanel/base/ShowHideMarkersButton.d.ts +1 -1
- package/lib/component/panels/SpectrumsPanel/base/ShowHideMarkersButton.js +4 -1
- package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +4 -4
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -2
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +2 -3
- package/lib/component/panels/SummaryPanel/utilities/useInView.js +3 -1
- package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +1 -1
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +19 -10
- package/lib/component/panels/databasePanel/DatabasePanel.js +5 -13
- package/lib/component/panels/databasePanel/DatabaseTable.js +3 -3
- package/lib/component/panels/filtersPanel/FilterPanel.js +1 -1
- package/lib/component/panels/filtersPanel/FiltersTable.js +2 -2
- package/lib/component/panels/header/DefaultPanelHeader.js +3 -12
- package/lib/component/panels/header/SpectraAutomaticPickingButton.js +1 -1
- package/lib/component/panels/predictionPanel/PredictionOptions.d.ts +2 -1
- package/lib/component/panels/predictionPanel/PredictionOptions.js +2 -2
- package/lib/component/panels/predictionPanel/PredictionPanel.js +15 -3
- package/lib/component/reducer/IgnoreActions.js +5 -0
- package/lib/component/reducer/Reducer.d.ts +141 -51
- package/lib/component/reducer/Reducer.js +69 -45
- package/lib/component/reducer/actions/DomainActions.d.ts +1 -1
- package/lib/component/reducer/actions/DomainActions.js +11 -9
- package/lib/component/reducer/actions/FiltersActions.d.ts +13 -7
- package/lib/component/reducer/actions/FiltersActions.js +326 -204
- package/lib/component/reducer/actions/IntegralsActions.js +15 -10
- package/lib/component/reducer/actions/LoadActions.d.ts +2 -5
- package/lib/component/reducer/actions/LoadActions.js +19 -34
- package/lib/component/reducer/actions/MoleculeActions.d.ts +2 -1
- package/lib/component/reducer/actions/MoleculeActions.js +48 -19
- package/lib/component/reducer/actions/PeaksActions.d.ts +4 -1
- package/lib/component/reducer/actions/PeaksActions.js +52 -13
- package/lib/component/reducer/actions/PreferencesActions.js +8 -10
- package/lib/component/reducer/actions/RangesActions.d.ts +3 -3
- package/lib/component/reducer/actions/RangesActions.js +87 -29
- package/lib/component/reducer/actions/SpectraAnalysisAction.js +5 -5
- package/lib/component/reducer/actions/SpectrumsActions.js +14 -11
- package/lib/component/reducer/actions/ToolsActions.js +47 -95
- package/lib/component/reducer/actions/ZonesActions.d.ts +4 -1
- package/lib/component/reducer/actions/ZonesActions.js +68 -17
- package/lib/component/reducer/helper/Zoom1DManager.js +2 -1
- package/lib/component/reducer/helper/getActiveSpectrumOrFail.d.ts +3 -0
- package/lib/component/reducer/helper/getActiveSpectrumOrFail.js +6 -0
- package/lib/component/reducer/helper/getSpectrum.js +3 -2
- package/lib/component/reducer/helper/getStrongestPeak.d.ts +7 -0
- package/lib/component/reducer/helper/getStrongestPeak.js +15 -0
- package/lib/component/reducer/preferences/actions/addWorkspace.js +2 -2
- package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +3 -0
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +23 -15
- package/lib/component/reducer/preferences/preferencesReducer.js +1 -1
- package/lib/component/reducer/types/Types.d.ts +12 -0
- package/lib/component/reducer/types/Types.js +12 -0
- package/lib/component/tool/BrushX.js +1 -1
- package/lib/component/tool/BrushXY.js +4 -3
- package/lib/component/tool/CrossLinePointer.js +5 -4
- package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.d.ts +8 -2
- package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.js +22 -7
- package/lib/component/tool/FloatMoleculeStructures/index.d.ts +3 -2
- package/lib/component/tool/FloatMoleculeStructures/index.js +19 -6
- package/lib/component/toolbar/BasicToolBar.js +7 -14
- package/lib/component/toolbar/FunctionToolBar.js +13 -23
- package/lib/component/toolbar/ToolTypes.d.ts +7 -1
- package/lib/component/toolbar/ToolTypes.js +119 -9
- package/lib/component/utility/assert.d.ts +1 -0
- package/lib/component/utility/assert.js +5 -0
- package/lib/component/workspaces/Workspace.d.ts +4 -1
- package/lib/component/workspaces/basic.js +12 -11
- package/lib/component/workspaces/embedded.js +14 -13
- package/lib/component/workspaces/exercise.js +10 -6
- package/lib/component/workspaces/prediction.js +14 -13
- package/lib/component/workspaces/process1D.js +20 -19
- package/lib/component/workspaces/workspaceDefaultProperties.js +14 -15
- package/lib/constants.js +1 -1
- package/lib/data/Filters.d.ts +2 -2
- package/lib/data/Filters.js +2 -2
- package/lib/data/FiltersManager.js +3 -3
- package/lib/data/PredictionManager.d.ts +0 -1
- package/lib/data/PredictionManager.js +15 -15
- package/lib/data/SpectraManager.d.ts +2 -5
- package/lib/data/SpectraManager.js +4 -95
- package/lib/data/constants/SignalsKinds.d.ts +0 -1
- package/lib/data/constants/SignalsKinds.js +0 -8
- package/lib/data/data1d/Data1DManager.js +5 -5
- package/lib/data/data1d/Spectrum1D/SumManager.d.ts +5 -5
- package/lib/data/data1d/Spectrum1D/SumManager.js +18 -12
- package/lib/data/data1d/Spectrum1D/generateJGraphData.js +2 -2
- package/lib/data/data1d/Spectrum1D/index.d.ts +2 -1
- package/lib/data/data1d/Spectrum1D/index.js +2 -1
- package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +3 -3
- package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +1 -1
- package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +5 -2
- package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.d.ts +1 -1
- package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.js +15 -16
- package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.d.ts +8 -0
- package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.js +24 -0
- package/lib/data/data1d/Spectrum1D/ranges/addRange.js +3 -3
- package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +2 -0
- package/lib/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectRange.js +2 -2
- package/lib/data/data1d/Spectrum1D/ranges/mapRanges.js +3 -3
- package/lib/data/data1d/database.js +4 -6
- package/lib/data/data1d/filter1d/apodization.d.ts +25 -0
- package/lib/data/data1d/filter1d/apodization.js +63 -0
- package/lib/data/data1d/filter1d/baselineCorrection.d.ts +24 -7
- package/lib/data/data1d/filter1d/baselineCorrection.js +10 -17
- package/lib/data/data1d/filter1d/fft.js +11 -0
- package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.d.ts +2 -0
- package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +35 -0
- package/lib/data/data1d/filter1d/zeroFillingAndApodization.d.ts +9 -0
- package/lib/data/data1d/filter1d/zeroFillingAndApodization.js +24 -0
- package/lib/data/data2d/Processing2D.d.ts +3 -3
- package/lib/data/data2d/Processing2D.js +3 -2
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +3 -3
- package/lib/data/data2d/Spectrum2D/zones/detectZones.js +3 -3
- package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.js +3 -3
- package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.d.ts +1 -1
- package/lib/data/molecules/Molecule.d.ts +20 -6
- package/lib/data/molecules/Molecule.js +5 -8
- package/lib/data/molecules/MoleculeManager.d.ts +4 -4
- package/lib/data/molecules/MoleculeManager.js +5 -5
- package/lib/data/types/data1d/SumOptions.d.ts +1 -1
- package/lib/data/utilities/generateNumbersPowerOfX.d.ts +0 -1
- package/lib/data/utilities/generateNumbersPowerOfX.js +0 -1
- package/lib/data/utilities/isInRange.d.ts +7 -0
- package/lib/data/utilities/isInRange.js +4 -0
- package/lib/types/NMRiumDataReturn.d.ts +2 -2
- package/lib/types/NMRiumGeneralPreferences.d.ts +0 -2
- package/lib/types/NMRiumToolBarPreferences.d.ts +14 -13
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/ApodizationLine.js +77 -0
- package/lib-cjs/component/1d/Chart1D.js +4 -2
- package/lib-cjs/component/1d/ExclusionZoneAnnotation.js +15 -8
- package/lib-cjs/component/1d/FooterBanner.js +3 -1
- package/lib-cjs/component/1d/IntegralResizable.js +4 -3
- package/lib-cjs/component/1d/IntegralsSeries.js +3 -1
- package/lib-cjs/component/1d/LinesSeries.js +6 -4
- package/lib-cjs/component/1d/SpectraTracker.js +1 -1
- package/lib-cjs/component/1d/Viewer1D.js +10 -13
- package/lib-cjs/component/1d/database/DatabaseElements.js +1 -1
- package/lib-cjs/component/1d/database/DatabaseSpectrum.js +2 -2
- package/lib-cjs/component/1d/database/ResurrectedDatabaseRanges.js +2 -2
- package/lib-cjs/component/1d/jCouplingGraph/JGraph.js +5 -1
- package/lib-cjs/component/1d/multiAnalysis/AnalysisRange.js +15 -13
- package/lib-cjs/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +4 -3
- package/lib-cjs/component/1d/{PeakAnnotation.js → peaks/PeakAnnotation.js} +8 -9
- package/lib-cjs/component/1d/peaks/PeakAnnotations.js +33 -0
- package/lib-cjs/component/1d/peaks/PeaksShapes.js +42 -0
- package/lib-cjs/component/1d/peaks/usePeakShapesPath.js +53 -0
- package/lib-cjs/component/1d/ranges/Range.js +3 -3
- package/lib-cjs/component/1d/ranges/Ranges.js +7 -1
- package/lib-cjs/component/1d/tool/PeakPointer.js +3 -1
- package/lib-cjs/component/1d/tool/XLabelPointer.js +3 -1
- package/lib-cjs/component/2d/Contours.js +3 -1
- package/lib-cjs/component/2d/FooterBanner.js +5 -3
- package/lib-cjs/component/2d/Viewer2D.js +6 -6
- package/lib-cjs/component/2d/XAxis.js +2 -2
- package/lib-cjs/component/2d/YAxis.js +2 -2
- package/lib-cjs/component/2d/tools/XYLabelPointer.js +3 -1
- package/lib-cjs/component/2d/tools/slicing/SlicingView.js +3 -1
- package/lib-cjs/component/2d/zones/IndicationLines.js +1 -1
- package/lib-cjs/component/2d/zones/Signal.js +3 -3
- package/lib-cjs/component/2d/zones/Zone.js +3 -3
- package/lib-cjs/component/2d/zones/Zones.js +13 -18
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +89 -50
- package/lib-cjs/component/NMRium.js +14 -3
- package/lib-cjs/component/context/GlobalContext.js +4 -4
- package/lib-cjs/component/elements/ActiveButton.js +33 -0
- package/lib-cjs/component/elements/Button.js +5 -5
- package/lib-cjs/component/elements/ButtonToolTip.js +1 -1
- package/lib-cjs/component/elements/CheckBox.js +3 -5
- package/lib-cjs/component/elements/Input.js +1 -1
- package/lib-cjs/component/elements/Label.js +3 -3
- package/lib-cjs/component/elements/MoleculeSelection.js +1 -1
- package/lib-cjs/component/elements/NextPrev.js +1 -1
- package/lib-cjs/component/elements/ReactTable/Elements/ReactTableRow.js +1 -1
- package/lib-cjs/component/elements/Select.js +6 -8
- package/lib-cjs/component/elements/Tab/Tab.js +1 -1
- package/lib-cjs/component/elements/Table/Table.js +2 -2
- package/lib-cjs/component/elements/ToggleButton.js +3 -2
- package/lib-cjs/component/elements/accordion/AccordionItem.js +2 -2
- package/lib-cjs/component/elements/formik/FormikOnChange.js +10 -4
- package/lib-cjs/component/elements/popup/Modal/ConfirmDialog.js +1 -1
- package/lib-cjs/component/elements/popup/Modal/Provider.js +8 -11
- package/lib-cjs/component/elements/resizer/DivResizer.js +3 -3
- package/lib-cjs/component/elements/resizer/SVGResizer.js +2 -2
- package/lib-cjs/component/header/ApodizationOptionsPanel.js +110 -0
- package/lib-cjs/component/header/AutoPeakPickingOptionPanel.js +39 -35
- package/lib-cjs/component/header/BaseLineCorrectionPanel.js +82 -49
- package/lib-cjs/component/header/Header.js +5 -2
- package/lib-cjs/component/header/HeaderContainer.js +14 -0
- package/lib-cjs/component/header/ManualPhaseCorrectionPanel.js +26 -28
- package/lib-cjs/component/header/RangesPickingOptionPanel.js +19 -21
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +73 -45
- package/lib-cjs/component/header/Zones2DOptionPanel.js +11 -13
- package/lib-cjs/component/highlight/index.js +20 -18
- package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +2 -2
- package/lib-cjs/component/hooks/useCheckToolsVisibility.js +31 -1
- package/lib-cjs/component/hooks/useDatumWithSpectraStatistics.js +3 -1
- package/lib-cjs/component/hooks/useExport.js +0 -16
- package/lib-cjs/component/hooks/useFilter.js +14 -0
- package/lib-cjs/component/hooks/useIntegralPath.js +5 -2
- package/lib-cjs/component/hooks/useNucleus.js +4 -4
- package/lib-cjs/component/hooks/useSpectraPerNucleus.js +1 -1
- package/lib-cjs/component/hooks/useSpectrum.js +3 -1
- package/lib-cjs/component/hooks/useToolsFunctions.js +1 -1
- package/lib-cjs/component/loader/DropZone.js +7 -150
- package/lib-cjs/component/modal/AlignSpectraModal.js +1 -2
- package/lib-cjs/component/modal/EditPeakShapeModal.js +113 -0
- package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +2 -3
- package/lib-cjs/component/modal/MultipleSpectraFiltersModal/index.js +1 -2
- package/lib-cjs/component/modal/PredictSpectraModal.js +1 -1
- package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +9 -11
- package/lib-cjs/component/modal/changeSum/SelectMolecule.js +2 -2
- package/lib-cjs/component/modal/editRange/EditRangeModal.js +3 -3
- package/lib-cjs/component/modal/editRange/forms/components/CouplingsTable.js +3 -8
- package/lib-cjs/component/modal/setting/DatabasesTabContent.js +2 -2
- package/lib-cjs/component/modal/setting/DisplayTabContent.js +1 -1
- package/lib-cjs/component/modal/setting/FormattingTabContent.js +2 -2
- package/lib-cjs/component/modal/setting/GeneralSettings.js +1 -1
- package/lib-cjs/component/modal/setting/ToolsTabContent.js +17 -13
- package/lib-cjs/component/modal/setting/WorkspaceItem.js +2 -2
- package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +1 -1
- package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +1 -1
- package/lib-cjs/component/panels/MoleculesPanel/MoleculeHeader.js +3 -3
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +12 -9
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -6
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +11 -3
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
- package/lib-cjs/component/panels/Panels.js +3 -3
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +45 -20
- package/lib-cjs/component/panels/PeaksPanel/PeaksPreferences.js +17 -0
- package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +42 -11
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +10 -9
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +7 -3
- package/lib-cjs/component/panels/RangesPanel/RangesTableRow.js +3 -3
- package/lib-cjs/component/panels/RangesPanel/TableColumns/ActionsColumn.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +2 -1
- package/lib-cjs/component/panels/RangesPanel/hooks/useMapRanges.js +3 -6
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -1
- package/lib-cjs/component/panels/SpectrumsPanel/SpectrumListItem.js +1 -1
- package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -1
- package/lib-cjs/component/panels/SpectrumsPanel/base/ColorIndicator.js +2 -2
- package/lib-cjs/component/panels/SpectrumsPanel/base/ShowHideMarkersButton.js +4 -1
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +4 -4
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -2
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +2 -3
- package/lib-cjs/component/panels/SummaryPanel/utilities/useInView.js +3 -1
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +1 -1
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +18 -9
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +5 -13
- package/lib-cjs/component/panels/databasePanel/DatabaseTable.js +2 -2
- package/lib-cjs/component/panels/filtersPanel/FilterPanel.js +1 -1
- package/lib-cjs/component/panels/filtersPanel/FiltersTable.js +2 -2
- package/lib-cjs/component/panels/header/DefaultPanelHeader.js +3 -12
- package/lib-cjs/component/panels/header/SpectraAutomaticPickingButton.js +1 -1
- package/lib-cjs/component/panels/predictionPanel/PredictionOptions.js +2 -2
- package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +15 -3
- package/lib-cjs/component/reducer/IgnoreActions.js +5 -0
- package/lib-cjs/component/reducer/Reducer.js +72 -50
- package/lib-cjs/component/reducer/actions/DomainActions.js +11 -9
- package/lib-cjs/component/reducer/actions/FiltersActions.js +332 -205
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +15 -10
- package/lib-cjs/component/reducer/actions/LoadActions.js +18 -36
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +49 -19
- package/lib-cjs/component/reducer/actions/PeaksActions.js +54 -12
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +8 -10
- package/lib-cjs/component/reducer/actions/RangesActions.js +87 -29
- package/lib-cjs/component/reducer/actions/SpectraAnalysisAction.js +5 -5
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +14 -11
- package/lib-cjs/component/reducer/actions/ToolsActions.js +46 -94
- package/lib-cjs/component/reducer/actions/ZonesActions.js +71 -17
- package/lib-cjs/component/reducer/helper/Zoom1DManager.js +2 -1
- package/lib-cjs/component/reducer/helper/getActiveSpectrumOrFail.js +10 -0
- package/lib-cjs/component/reducer/helper/getSpectrum.js +3 -2
- package/lib-cjs/component/reducer/helper/getStrongestPeak.js +19 -0
- package/lib-cjs/component/reducer/preferences/actions/addWorkspace.js +2 -5
- package/lib-cjs/component/reducer/preferences/panelsPreferencesDefaultValues.js +3 -0
- package/lib-cjs/component/reducer/preferences/preferencesReducer.js +1 -1
- package/lib-cjs/component/reducer/types/Types.js +15 -3
- package/lib-cjs/component/tool/BrushX.js +1 -1
- package/lib-cjs/component/tool/BrushXY.js +4 -3
- package/lib-cjs/component/tool/CrossLinePointer.js +5 -4
- package/lib-cjs/component/tool/FloatMoleculeStructures/DraggableStructure.js +21 -6
- package/lib-cjs/component/tool/FloatMoleculeStructures/index.js +19 -6
- package/lib-cjs/component/toolbar/BasicToolBar.js +7 -14
- package/lib-cjs/component/toolbar/FunctionToolBar.js +12 -22
- package/lib-cjs/component/toolbar/ToolTypes.js +119 -9
- package/lib-cjs/component/utility/assert.js +9 -0
- package/lib-cjs/component/workspaces/basic.js +12 -11
- package/lib-cjs/component/workspaces/embedded.js +14 -13
- package/lib-cjs/component/workspaces/exercise.js +10 -6
- package/lib-cjs/component/workspaces/prediction.js +14 -13
- package/lib-cjs/component/workspaces/process1D.js +20 -19
- package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +14 -15
- package/lib-cjs/constants.js +1 -1
- package/lib-cjs/data/Filters.js +3 -3
- package/lib-cjs/data/FiltersManager.js +3 -6
- package/lib-cjs/data/PredictionManager.js +15 -15
- package/lib-cjs/data/SpectraManager.js +5 -100
- package/lib-cjs/data/constants/SignalsKinds.js +0 -8
- package/lib-cjs/data/data1d/Data1DManager.js +5 -5
- package/lib-cjs/data/data1d/Spectrum1D/SumManager.js +18 -12
- package/lib-cjs/data/data1d/Spectrum1D/generateJGraphData.js +2 -5
- package/lib-cjs/data/data1d/Spectrum1D/index.js +3 -1
- package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +3 -3
- package/lib-cjs/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +1 -1
- package/lib-cjs/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +5 -2
- package/lib-cjs/data/data1d/Spectrum1D/peaks/mapPeaks.js +15 -19
- package/lib-cjs/data/data1d/Spectrum1D/peaks/optimizePeaks.js +28 -0
- package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +3 -3
- package/lib-cjs/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +2 -0
- package/lib-cjs/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +1 -1
- package/lib-cjs/data/data1d/Spectrum1D/ranges/detectRange.js +2 -5
- package/lib-cjs/data/data1d/Spectrum1D/ranges/mapRanges.js +3 -6
- package/lib-cjs/data/data1d/database.js +4 -6
- package/lib-cjs/data/data1d/filter1d/apodization.js +70 -0
- package/lib-cjs/data/data1d/filter1d/baselineCorrection.js +11 -18
- package/lib-cjs/data/data1d/filter1d/fft.js +11 -0
- package/lib-cjs/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +39 -0
- package/lib-cjs/data/data1d/filter1d/zeroFillingAndApodization.js +30 -0
- package/lib-cjs/data/data2d/Processing2D.js +3 -2
- package/lib-cjs/data/data2d/Spectrum2D/initiateDatum2D.js +3 -6
- package/lib-cjs/data/data2d/Spectrum2D/zones/detectZones.js +3 -6
- package/lib-cjs/data/data2d/Spectrum2D/zones/detectZonesManual.js +3 -6
- package/lib-cjs/data/molecules/Molecule.js +5 -8
- package/lib-cjs/data/molecules/MoleculeManager.js +5 -5
- package/lib-cjs/data/utilities/generateNumbersPowerOfX.js +0 -1
- package/lib-cjs/data/utilities/isInRange.js +7 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +36 -35
- package/lib/component/1d/PeakAnnotations.js +0 -41
- package/lib/component/utility/nmredataToNmrium.d.ts +0 -4
- package/lib/component/utility/nmredataToNmrium.js +0 -66
- package/lib/component/utility/nmriumToNmredata.d.ts +0 -2
- package/lib/component/utility/nmriumToNmredata.js +0 -80
- package/lib/component/utility/util/nmredata/addRanges.d.ts +0 -1
- package/lib/component/utility/util/nmredata/addRanges.js +0 -52
- package/lib/component/utility/util/nmredata/addSource.d.ts +0 -6
- package/lib/component/utility/util/nmredata/addSource.js +0 -54
- package/lib/component/utility/util/nmredata/addZones.d.ts +0 -1
- package/lib/component/utility/util/nmredata/addZones.js +0 -41
- package/lib/component/utility/util/nmredata/flat2DSignals.d.ts +0 -1
- package/lib/component/utility/util/nmredata/flat2DSignals.js +0 -7
- package/lib/component/utility/util/nmredata/get1DSignals.d.ts +0 -10
- package/lib/component/utility/util/nmredata/get1DSignals.js +0 -96
- package/lib/component/utility/util/nmredata/get2DSignals.d.ts +0 -8
- package/lib/component/utility/util/nmredata/get2DSignals.js +0 -59
- package/lib/component/utility/util/nmredata/getCouplingObserved.d.ts +0 -1
- package/lib/component/utility/util/nmredata/getCouplingObserved.js +0 -11
- package/lib/component/utility/util/nmredata/getLabels.d.ts +0 -9
- package/lib/component/utility/util/nmredata/getLabels.js +0 -66
- package/lib/component/utility/util/nmredata/getToFix.d.ts +0 -1
- package/lib/component/utility/util/nmredata/getToFix.js +0 -19
- package/lib/data/data1d/filter1d/lineBroadening.d.ts +0 -14
- package/lib/data/data1d/filter1d/lineBroadening.js +0 -57
- package/lib/data/migration/MigrationManager.d.ts +0 -2
- package/lib/data/migration/MigrationManager.js +0 -17
- package/lib/data/migration/changeKeys.d.ts +0 -1
- package/lib/data/migration/changeKeys.js +0 -9
- package/lib/data/migration/migrateToVersion1.d.ts +0 -11
- package/lib/data/migration/migrateToVersion1.js +0 -32
- package/lib/data/migration/migrateToVersion2.d.ts +0 -1
- package/lib/data/migration/migrateToVersion2.js +0 -111
- package/lib/data/utilities/generateID.d.ts +0 -1
- package/lib/data/utilities/generateID.js +0 -9
- package/lib-cjs/component/1d/PeakAnnotations.js +0 -46
- package/lib-cjs/component/utility/nmredataToNmrium.js +0 -73
- package/lib-cjs/component/utility/nmriumToNmredata.js +0 -87
- package/lib-cjs/component/utility/util/nmredata/addRanges.js +0 -56
- package/lib-cjs/component/utility/util/nmredata/addSource.js +0 -61
- package/lib-cjs/component/utility/util/nmredata/addZones.js +0 -48
- package/lib-cjs/component/utility/util/nmredata/flat2DSignals.js +0 -11
- package/lib-cjs/component/utility/util/nmredata/get1DSignals.js +0 -100
- package/lib-cjs/component/utility/util/nmredata/get2DSignals.js +0 -63
- package/lib-cjs/component/utility/util/nmredata/getCouplingObserved.js +0 -15
- package/lib-cjs/component/utility/util/nmredata/getLabels.js +0 -70
- package/lib-cjs/component/utility/util/nmredata/getToFix.js +0 -23
- package/lib-cjs/data/data1d/filter1d/lineBroadening.js +0 -63
- package/lib-cjs/data/migration/MigrationManager.js +0 -24
- package/lib-cjs/data/migration/changeKeys.js +0 -13
- package/lib-cjs/data/migration/migrateToVersion1.js +0 -35
- package/lib-cjs/data/migration/migrateToVersion2.js +0 -114
- package/lib-cjs/data/utilities/generateID.js +0 -12
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, useReducer, useMemo, useContext, useCallback, useEffect, } from 'react';
|
|
3
|
-
export var
|
|
4
|
-
(function (
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
export var HighlightEventSource;
|
|
4
|
+
(function (HighlightEventSource) {
|
|
5
|
+
HighlightEventSource["PEAK"] = "PEAK";
|
|
6
|
+
HighlightEventSource["INTEGRAL"] = "INTEGRAL";
|
|
7
|
+
HighlightEventSource["SIGNAL"] = "SIGNAL";
|
|
8
|
+
HighlightEventSource["RANGE"] = "RANGE";
|
|
9
|
+
HighlightEventSource["ZONE"] = "ZONE";
|
|
10
|
+
HighlightEventSource["EXCLUSION_ZONE"] = "EXCLUSION_ZONE";
|
|
11
|
+
HighlightEventSource["MULTIPLE_ANALYSIS_ZONE"] = "MULTIPLE_ANALYSIS_ZONE";
|
|
12
|
+
HighlightEventSource["DATABASE"] = "DATABASE";
|
|
13
|
+
HighlightEventSource["ATOM"] = "ATOM";
|
|
14
|
+
HighlightEventSource["UNKNOWN"] = "UNKNOWN";
|
|
15
|
+
})(HighlightEventSource || (HighlightEventSource = {}));
|
|
14
16
|
const emptyState = {
|
|
15
17
|
highlight: {
|
|
16
18
|
highlights: {},
|
|
@@ -25,8 +27,8 @@ const highlightContext = createContext(emptyState);
|
|
|
25
27
|
function highlightReducer(state, action) {
|
|
26
28
|
switch (action.type) {
|
|
27
29
|
case 'SHOW': {
|
|
28
|
-
const { convertedHighlights, sourceData } = action.payload;
|
|
29
|
-
const { type =
|
|
30
|
+
const { convertedHighlights = [], sourceData } = action.payload || {};
|
|
31
|
+
const { type = HighlightEventSource.UNKNOWN, extra = null } = sourceData || {};
|
|
30
32
|
const newState = {
|
|
31
33
|
...state,
|
|
32
34
|
highlights: { ...state.highlights },
|
|
@@ -41,7 +43,7 @@ function highlightReducer(state, action) {
|
|
|
41
43
|
return newState;
|
|
42
44
|
}
|
|
43
45
|
case 'HIDE': {
|
|
44
|
-
const { convertedHighlights } = action.payload;
|
|
46
|
+
const { convertedHighlights = [] } = action.payload || {};
|
|
45
47
|
const newState = {
|
|
46
48
|
...state,
|
|
47
49
|
highlights: { ...state.highlights },
|
|
@@ -60,7 +62,7 @@ function highlightReducer(state, action) {
|
|
|
60
62
|
const newState = {
|
|
61
63
|
...state,
|
|
62
64
|
// allow just one permanent highlights group at same time
|
|
63
|
-
highlightedPermanently: action.payload,
|
|
65
|
+
highlightedPermanently: action.payload?.convertedHighlights || [],
|
|
64
66
|
};
|
|
65
67
|
return newState;
|
|
66
68
|
}
|
|
@@ -72,7 +74,7 @@ function highlightReducer(state, action) {
|
|
|
72
74
|
return newState;
|
|
73
75
|
}
|
|
74
76
|
default: {
|
|
75
|
-
throw new Error(`unknown action type: ${action.type}`);
|
|
77
|
+
throw new Error(`unknown action type: ${String(action.type)}`);
|
|
76
78
|
}
|
|
77
79
|
}
|
|
78
80
|
}
|
|
@@ -168,7 +170,7 @@ export function useHighlight(highlights, sourceData = null) {
|
|
|
168
170
|
if (!isActivePermanently) {
|
|
169
171
|
dispatch({
|
|
170
172
|
type: 'SET_PERMANENT',
|
|
171
|
-
payload: convertedHighlights,
|
|
173
|
+
payload: { convertedHighlights },
|
|
172
174
|
});
|
|
173
175
|
}
|
|
174
176
|
else {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import get from 'lodash/get';
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
|
-
import { useChartData } from '../context/ChartContext';
|
|
4
3
|
import { usePreferences } from '../context/PreferencesContext';
|
|
4
|
+
import { useActiveSpectrum } from '../reducer/Reducer';
|
|
5
5
|
export default function useActiveSpectrumStyleOptions(id) {
|
|
6
|
-
const
|
|
6
|
+
const activeSpectrum = useActiveSpectrum();
|
|
7
7
|
const preferences = usePreferences();
|
|
8
8
|
return useMemo(() => {
|
|
9
9
|
const isActive = activeSpectrum === null ? true : id === activeSpectrum.id;
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
+
import { Info1D } from '../../data/types/data1d/Info1D';
|
|
2
|
+
import { Info2D } from '../../data/types/data2d';
|
|
1
3
|
import { NMRiumToolBarPreferences } from '../../types/NMRiumToolBarPreferences';
|
|
2
|
-
|
|
4
|
+
declare type SpectrumInfo = Info1D | Info2D;
|
|
5
|
+
interface CheckOptions {
|
|
6
|
+
checkSpectrumType?: boolean;
|
|
7
|
+
checkMode?: boolean;
|
|
8
|
+
extraInfoCheckParameters?: SpectrumInfo;
|
|
9
|
+
}
|
|
10
|
+
export declare function useCheckToolsVisibility(): (toolKey: keyof NMRiumToolBarPreferences, checkOptions?: CheckOptions) => boolean;
|
|
11
|
+
export {};
|
|
@@ -1,7 +1,37 @@
|
|
|
1
1
|
import lodashGet from 'lodash/get';
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
|
+
import { useChartData } from '../context/ChartContext';
|
|
3
4
|
import { usePreferences } from '../context/PreferencesContext';
|
|
5
|
+
import { options } from '../toolbar/ToolTypes';
|
|
6
|
+
import useSpectrum from './useSpectrum';
|
|
7
|
+
const emptyData = { info: {} };
|
|
4
8
|
export function useCheckToolsVisibility() {
|
|
9
|
+
const { displayerMode } = useChartData();
|
|
5
10
|
const preferences = usePreferences();
|
|
6
|
-
|
|
11
|
+
const spectrum = useSpectrum(emptyData);
|
|
12
|
+
return useCallback((toolKey, checkOptions = {}) => {
|
|
13
|
+
const { checkMode = true, checkSpectrumType = true, extraInfoCheckParameters, } = checkOptions;
|
|
14
|
+
let flag = lodashGet(preferences.current, `display.toolBarButtons.${toolKey}`, false);
|
|
15
|
+
const { spectrumType, mode } = options[toolKey];
|
|
16
|
+
const modeFlag = !checkMode || (checkMode && (!mode || displayerMode === mode));
|
|
17
|
+
const spectrumCheckFlag = !checkSpectrumType ||
|
|
18
|
+
(checkSpectrumType &&
|
|
19
|
+
(!spectrumType ||
|
|
20
|
+
!spectrum ||
|
|
21
|
+
(spectrumType === 'FID' && spectrum.info.isFid) ||
|
|
22
|
+
(spectrumType === 'FT' && !spectrum.info.isFid)));
|
|
23
|
+
return (flag &&
|
|
24
|
+
modeFlag &&
|
|
25
|
+
spectrumCheckFlag &&
|
|
26
|
+
(!extraInfoCheckParameters ||
|
|
27
|
+
checkInfo(extraInfoCheckParameters, spectrum.info)));
|
|
28
|
+
}, [displayerMode, preferences, spectrum]);
|
|
29
|
+
}
|
|
30
|
+
function checkInfo(checkParameters, data) {
|
|
31
|
+
for (const key in checkParameters) {
|
|
32
|
+
if (checkParameters[key] !== data[key]) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return true;
|
|
7
37
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { useChartData } from '../context/ChartContext';
|
|
3
|
+
import { useActiveSpectrum } from '../reducer/Reducer';
|
|
3
4
|
import nucleusToString from '../utility/nucleusToString';
|
|
4
5
|
const emptyData = { info: {}, datum: {}, ftCounter: 0, fidCounter: 0 };
|
|
5
6
|
export default function useDatumWithSpectraStatistics() {
|
|
6
|
-
const { data,
|
|
7
|
+
const { data, view: { spectra: { activeTab }, }, } = useChartData();
|
|
8
|
+
const activeSpectrum = useActiveSpectrum();
|
|
7
9
|
return useMemo(() => {
|
|
8
10
|
if (data) {
|
|
9
11
|
let info = {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export default function useExport(): {
|
|
2
2
|
saveToClipboardHandler: () => Promise<void>;
|
|
3
3
|
saveAsJSONHandler: (spaceIndent?: number, isCompressed?: boolean) => Promise<void>;
|
|
4
|
-
saveAsNMREHandler: () => Promise<void>;
|
|
5
4
|
saveAsSVGHandler: () => Promise<void>;
|
|
6
5
|
saveAsPNGHandler: () => Promise<void>;
|
|
7
6
|
saveAsHandler: () => Promise<void>;
|
|
@@ -6,8 +6,7 @@ import { useGlobal } from '../context/GlobalContext';
|
|
|
6
6
|
import { useAlert } from '../elements/popup/Alert';
|
|
7
7
|
import { positions, useModal } from '../elements/popup/Modal';
|
|
8
8
|
import SaveAsModal from '../modal/SaveAsModal';
|
|
9
|
-
import { copyPNGToClipboard, exportAsJSON,
|
|
10
|
-
import { nmriumToNmredata } from '../utility/nmriumToNmredata';
|
|
9
|
+
import { copyPNGToClipboard, exportAsJSON, exportAsPng, exportAsSVG, } from '../utility/Export';
|
|
11
10
|
export default function useExport() {
|
|
12
11
|
const { rootRef } = useGlobal();
|
|
13
12
|
const modal = useModal();
|
|
@@ -38,20 +37,6 @@ export default function useExport() {
|
|
|
38
37
|
}, 0);
|
|
39
38
|
}
|
|
40
39
|
}, [alert, state]);
|
|
41
|
-
const saveAsNMREHandler = useCallback(async () => {
|
|
42
|
-
if (state.data.length > 0) {
|
|
43
|
-
const hideLoading = await alert.showLoading('Exporting as NMRE process in progress');
|
|
44
|
-
setTimeout(() => {
|
|
45
|
-
async function handle() {
|
|
46
|
-
const fileName = state.data[0]?.display?.name;
|
|
47
|
-
const exportedData = await nmriumToNmredata(state);
|
|
48
|
-
exportAsNMRE(exportedData, fileName);
|
|
49
|
-
hideLoading();
|
|
50
|
-
}
|
|
51
|
-
void handle();
|
|
52
|
-
}, 0);
|
|
53
|
-
}
|
|
54
|
-
}, [alert, state]);
|
|
55
40
|
const saveAsSVGHandler = useCallback(async () => {
|
|
56
41
|
if (state.data.length > 0 && rootRef) {
|
|
57
42
|
const hideLoading = await alert.showLoading('Exporting as SVG process in progress');
|
|
@@ -100,7 +85,6 @@ export default function useExport() {
|
|
|
100
85
|
return {
|
|
101
86
|
saveToClipboardHandler,
|
|
102
87
|
saveAsJSONHandler,
|
|
103
|
-
saveAsNMREHandler,
|
|
104
88
|
saveAsSVGHandler,
|
|
105
89
|
saveAsPNGHandler,
|
|
106
90
|
saveAsHandler,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useFilter(filterID: string): import("../../data/FiltersManager").Filter | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import useSpectrum from './useSpectrum';
|
|
3
|
+
const emptyData = { filters: {} };
|
|
4
|
+
export function useFilter(filterID) {
|
|
5
|
+
const { filters } = useSpectrum(emptyData);
|
|
6
|
+
return useMemo(() => filters.find((filter) => filter.name === filterID) || null, [filterID, filters]);
|
|
7
|
+
}
|
|
@@ -2,10 +2,12 @@ import { xyIntegral, xyReduce } from 'ml-spectra-processing';
|
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { getIntegralYScale } from '../1d/utilities/scale';
|
|
4
4
|
import { useChartData } from '../context/ChartContext';
|
|
5
|
+
import { useActiveSpectrum } from '../reducer/Reducer';
|
|
5
6
|
import { PathBuilder } from '../utility/PathBuilder';
|
|
6
7
|
import { useXScale } from './useXScale';
|
|
7
8
|
function useIntegralYDomain() {
|
|
8
|
-
const { height, margin, verticalAlign,
|
|
9
|
+
const { height, margin, verticalAlign, integralsYDomains } = useChartData();
|
|
10
|
+
const activeSpectrum = useActiveSpectrum();
|
|
9
11
|
return useMemo(() => getIntegralYScale({
|
|
10
12
|
height,
|
|
11
13
|
margin,
|
|
@@ -15,7 +17,8 @@ function useIntegralYDomain() {
|
|
|
15
17
|
}), [activeSpectrum, height, integralsYDomains, margin, verticalAlign]);
|
|
16
18
|
}
|
|
17
19
|
export default function useIntegralPath(integralOptions) {
|
|
18
|
-
const { data
|
|
20
|
+
const { data } = useChartData();
|
|
21
|
+
const activeSpectrum = useActiveSpectrum();
|
|
19
22
|
const scaleX = useXScale();
|
|
20
23
|
const scaleY = useIntegralYDomain();
|
|
21
24
|
const integral = useMemo(() => {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { useChartData } from '../context/ChartContext';
|
|
3
3
|
export default function useNucleus() {
|
|
4
|
-
const {
|
|
4
|
+
const { view: { spectra: { activeSpectra }, }, } = useChartData();
|
|
5
5
|
return useMemo(() => {
|
|
6
|
-
if (
|
|
7
|
-
return Object.keys(
|
|
6
|
+
if (activeSpectra && Object.keys(activeSpectra).length > 0) {
|
|
7
|
+
return Object.keys(activeSpectra);
|
|
8
8
|
}
|
|
9
9
|
return [];
|
|
10
|
-
}, [
|
|
10
|
+
}, [activeSpectra]);
|
|
11
11
|
}
|
|
@@ -2,7 +2,7 @@ import { useMemo } from 'react';
|
|
|
2
2
|
import { useChartData } from '../context/ChartContext';
|
|
3
3
|
import nucleusToString from '../utility/nucleusToString';
|
|
4
4
|
export default function useSpectraByActiveNucleus() {
|
|
5
|
-
const { data, activeTab } = useChartData();
|
|
5
|
+
const { data, view: { spectra: { activeTab }, }, } = useChartData();
|
|
6
6
|
return useMemo(() => {
|
|
7
7
|
if (data) {
|
|
8
8
|
return (data.filter((spectrum) => activeTab === nucleusToString(spectrum.info.nucleus)) || []);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { useChartData } from '../context/ChartContext';
|
|
3
|
+
import { useActiveSpectrum } from '../reducer/Reducer';
|
|
3
4
|
export default function useSpectrum(defaultValue) {
|
|
4
|
-
const { data
|
|
5
|
+
const { data } = useChartData();
|
|
6
|
+
const activeSpectrum = useActiveSpectrum();
|
|
5
7
|
return useMemo(() => {
|
|
6
8
|
if (data && activeSpectrum && activeSpectrum.id) {
|
|
7
9
|
const datum = data.find((datum) => datum.id === activeSpectrum.id) || defaultValue;
|
|
@@ -18,7 +18,7 @@ export default function useToolsFunctions() {
|
|
|
18
18
|
if ([
|
|
19
19
|
options.peakPicking.id,
|
|
20
20
|
options.integral.id,
|
|
21
|
-
options.
|
|
21
|
+
options.zonePicking.id,
|
|
22
22
|
options.exclusionZones.id,
|
|
23
23
|
].includes(selectedTool)) {
|
|
24
24
|
alert.show('Press Shift + Left Mouse button to select zone');
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
|
-
import Zip from 'jszip';
|
|
5
4
|
import { useCallback } from 'react';
|
|
6
5
|
import { useDropzone } from 'react-dropzone';
|
|
7
6
|
import { FaUpload } from 'react-icons/fa';
|
|
8
7
|
import { useChartData } from '../context/ChartContext';
|
|
9
8
|
import { useDispatch } from '../context/DispatchContext';
|
|
10
9
|
import { LoaderProvider } from '../context/LoaderContext';
|
|
11
|
-
import { useAlert } from '../elements/popup/Alert';
|
|
12
10
|
import { useCheckToolsVisibility } from '../hooks/useCheckToolsVisibility';
|
|
13
|
-
import {
|
|
14
|
-
import { FILES_TYPES, FILES_SIGNATURES, getFileExtension, getFileSignature, loadFiles, loadFilesFromZip, } from '../utility/FileUtility';
|
|
11
|
+
import { SET_LOADING_FLAG, LOAD_DROP_FILES } from '../reducer/types/Types';
|
|
15
12
|
const style = css `
|
|
16
13
|
height: 100%;
|
|
17
14
|
background-color: #b5b5b599;
|
|
@@ -46,153 +43,16 @@ const containerStyle = css `
|
|
|
46
43
|
function DropZone(props) {
|
|
47
44
|
const { width, height } = useChartData();
|
|
48
45
|
const dispatch = useDispatch();
|
|
49
|
-
const alert = useAlert();
|
|
50
46
|
const isToolEnabled = useCheckToolsVisibility();
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const files = await loadFilesFromZip(selectedFilesByExtensions);
|
|
57
|
-
dispatch({ type: LOAD_MOL_FILE, files });
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
case FILES_TYPES.NMRIUM:
|
|
61
|
-
case FILES_TYPES.JSON: {
|
|
62
|
-
const files = await loadFilesFromZip(selectedFilesByExtensions, {
|
|
63
|
-
asBuffer: true,
|
|
64
|
-
});
|
|
65
|
-
if (selectedFilesByExtensions.length === 1) {
|
|
66
|
-
const decoder = new TextDecoder('utf8');
|
|
67
|
-
files[0].binary = decoder.decode(files[0].binary);
|
|
68
|
-
dispatch({ type: LOAD_JSON_FILE, files });
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
throw new Error('You can add only one json file');
|
|
72
|
-
}
|
|
73
|
-
break;
|
|
74
|
-
}
|
|
75
|
-
case FILES_TYPES.JDX:
|
|
76
|
-
case FILES_TYPES.DX: {
|
|
77
|
-
const files = await loadFilesFromZip(selectedFilesByExtensions, {
|
|
78
|
-
asBuffer: true,
|
|
79
|
-
});
|
|
80
|
-
dispatch({ type: LOAD_JCAMP_FILE, files });
|
|
81
|
-
break;
|
|
82
|
-
}
|
|
83
|
-
case FILES_TYPES.JDF: {
|
|
84
|
-
const files = await loadFilesFromZip(selectedFilesByExtensions, {
|
|
85
|
-
asBuffer: true,
|
|
86
|
-
});
|
|
87
|
-
dispatch({ type: LOAD_JDF_FILE, files });
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
default:
|
|
91
|
-
break;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
47
|
+
const loadFilesHandler = useCallback((files) => {
|
|
48
|
+
files.forEach((file) => {
|
|
49
|
+
Object.defineProperty(file, 'webkitRelativePath', { value: file.path });
|
|
50
|
+
});
|
|
51
|
+
dispatch({ type: LOAD_DROP_FILES, files });
|
|
94
52
|
}, [dispatch]);
|
|
95
|
-
const loadFilesHandler = useCallback(async (files) => {
|
|
96
|
-
const uniqueFileExtensions = [
|
|
97
|
-
...new Set(files.map((file) => getFileExtension(file.name))),
|
|
98
|
-
];
|
|
99
|
-
for (let extension of uniqueFileExtensions) {
|
|
100
|
-
const selectedFilesByExtensions = files.filter((file) => getFileExtension(file.name) === extension);
|
|
101
|
-
try {
|
|
102
|
-
switch (extension) {
|
|
103
|
-
case FILES_TYPES.MOL: {
|
|
104
|
-
const files = await loadFiles(selectedFilesByExtensions);
|
|
105
|
-
dispatch({ type: LOAD_MOL_FILE, files });
|
|
106
|
-
break;
|
|
107
|
-
}
|
|
108
|
-
case FILES_TYPES.NMRIUM:
|
|
109
|
-
case FILES_TYPES.JSON:
|
|
110
|
-
if (selectedFilesByExtensions.length === 1) {
|
|
111
|
-
const files = await loadFiles(selectedFilesByExtensions, {
|
|
112
|
-
asBuffer: true,
|
|
113
|
-
});
|
|
114
|
-
// InputFileFormat
|
|
115
|
-
const fileSignature = getFileSignature(files[0].binary);
|
|
116
|
-
if (fileSignature === FILES_SIGNATURES.ZIP) {
|
|
117
|
-
const unzipResult = await Zip.loadAsync(files[0].binary);
|
|
118
|
-
await loadSubFilesFromZip(Object.values(unzipResult.files), [
|
|
119
|
-
FILES_TYPES.NMRIUM,
|
|
120
|
-
]);
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
const decoder = new TextDecoder('utf8');
|
|
124
|
-
files[0].binary = decoder.decode(files[0].binary);
|
|
125
|
-
dispatch({ type: LOAD_JSON_FILE, files });
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
throw new Error('You can add only one json file');
|
|
130
|
-
}
|
|
131
|
-
break;
|
|
132
|
-
case FILES_TYPES.JDX:
|
|
133
|
-
case FILES_TYPES.DX: {
|
|
134
|
-
const files = await loadFiles(selectedFilesByExtensions, {
|
|
135
|
-
asBuffer: true,
|
|
136
|
-
});
|
|
137
|
-
dispatch({ type: LOAD_JCAMP_FILE, files });
|
|
138
|
-
break;
|
|
139
|
-
}
|
|
140
|
-
case FILES_TYPES.JDF: {
|
|
141
|
-
const files = await loadFiles(selectedFilesByExtensions, {
|
|
142
|
-
asBuffer: true,
|
|
143
|
-
});
|
|
144
|
-
dispatch({ type: LOAD_JDF_FILE, files });
|
|
145
|
-
break;
|
|
146
|
-
}
|
|
147
|
-
case FILES_TYPES.ZIP: {
|
|
148
|
-
const files = await loadFiles(selectedFilesByExtensions, {
|
|
149
|
-
asBuffer: true,
|
|
150
|
-
});
|
|
151
|
-
for (const zipFile of files) {
|
|
152
|
-
const unzipResult = await Zip.loadAsync(zipFile.binary);
|
|
153
|
-
const uniqueFileExtensions = [
|
|
154
|
-
...new Set(Object.values(unzipResult.files).map((file) => getFileExtension(file.name))),
|
|
155
|
-
];
|
|
156
|
-
const isNotZip = uniqueFileExtensions.some((ex) => FILES_TYPES[ex.toUpperCase()] && ex !== FILES_TYPES.ZIP);
|
|
157
|
-
if (isNotZip) {
|
|
158
|
-
const hasBruker = Object.keys(unzipResult.files).some((path) => {
|
|
159
|
-
return ['2rr', 'fid', '1r'].some((brukerFile) => path.endsWith(brukerFile));
|
|
160
|
-
});
|
|
161
|
-
if (hasBruker)
|
|
162
|
-
dispatch({ type: LOAD_ZIP_FILE, files });
|
|
163
|
-
await loadSubFilesFromZip(Object.values(unzipResult.files), uniqueFileExtensions);
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
dispatch({ type: LOAD_ZIP_FILE, files });
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
break;
|
|
170
|
-
}
|
|
171
|
-
case FILES_TYPES.NMREDATA:
|
|
172
|
-
void loadFiles(selectedFilesByExtensions, {
|
|
173
|
-
asBuffer: true,
|
|
174
|
-
}).then(async (files) => {
|
|
175
|
-
for (const zipFile of files) {
|
|
176
|
-
dispatch({
|
|
177
|
-
type: LOAD_NMREDATA_FILE,
|
|
178
|
-
file: zipFile,
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
break;
|
|
183
|
-
default:
|
|
184
|
-
throw new Error('The file extension must be zip, dx, jdx, json, mol, nmredata or nmrium.');
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
catch (e) {
|
|
188
|
-
dispatch({ type: SET_LOADING_FLAG, isLoading: false });
|
|
189
|
-
alert.error(e.message);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}, [alert, dispatch, loadSubFilesFromZip]);
|
|
193
53
|
const onDrop = useCallback((droppedFiles) => {
|
|
194
54
|
dispatch({ type: SET_LOADING_FLAG, isLoading: true });
|
|
195
|
-
|
|
55
|
+
loadFilesHandler(droppedFiles);
|
|
196
56
|
}, [dispatch, loadFilesHandler]);
|
|
197
57
|
const isImportEnabled = isToolEnabled('import');
|
|
198
58
|
const { getRootProps, getInputProps, isDragActive, open: openImportDialog, } = useDropzone({
|
|
@@ -206,7 +66,7 @@ function DropZone(props) {
|
|
|
206
66
|
openImportDialog();
|
|
207
67
|
}
|
|
208
68
|
}, [isImportEnabled, openImportDialog]);
|
|
209
|
-
return (_jsx(LoaderProvider, { value: open, children: _jsxs("div", { ...getRootProps(), role: "none", css: containerStyle, children: [_jsx("input", {
|
|
69
|
+
return (_jsx(LoaderProvider, { value: open, children: _jsxs("div", { ...getRootProps(), role: "none", css: containerStyle, children: [_jsx("input", { ...getInputProps() }), isDragActive && (_jsxs("div", { css: style, style: {
|
|
210
70
|
width: `${width}px`,
|
|
211
71
|
height: `${height}px`,
|
|
212
72
|
marginTop: '30px',
|
|
@@ -19,7 +19,6 @@ function AlignSpectraModal({ onClose = () => null, nucleus, }) {
|
|
|
19
19
|
const List = useMemo(() => {
|
|
20
20
|
const list = REFERENCES[nucleus]
|
|
21
21
|
? Object.entries(REFERENCES[nucleus]).map((item) => ({
|
|
22
|
-
key: item[0],
|
|
23
22
|
value: item[0],
|
|
24
23
|
label: item[0],
|
|
25
24
|
}), [])
|
|
@@ -52,6 +51,6 @@ function AlignSpectraModal({ onClose = () => null, nucleus, }) {
|
|
|
52
51
|
...resValues,
|
|
53
52
|
});
|
|
54
53
|
}, [nucleus]);
|
|
55
|
-
return (_jsxs("div", { css: ModalStyles, children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Spectra calibration" }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsx("div", { className: "inner-content", style: { flex: 1 }, children: _jsxs(FormikForm, { ref: refForm, initialValues: { from: -1, to: 1, nbPeaks: 1, targetX: 0 }, onSubmit: submitHandler, children: [_jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: "Options :" }), _jsx(Select, {
|
|
54
|
+
return (_jsxs("div", { css: ModalStyles, children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Spectra calibration" }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsx("div", { className: "inner-content", style: { flex: 1 }, children: _jsxs(FormikForm, { ref: refForm, initialValues: { from: -1, to: 1, nbPeaks: 1, targetX: 0 }, onSubmit: submitHandler, children: [_jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: "Options :" }), _jsx(Select, { items: List, style: { width: 270, height: 30, marginBottom: '20px' }, onChange: optionChangeHandler })] }), _jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: "Range :" }), _jsx(Label, { title: "From : ", children: _jsx(FormikInput, { name: "from", type: "number" }) }), _jsx(Label, { title: "To : ", children: _jsx(FormikInput, { name: "to", type: "number" }) })] }), _jsx("div", { className: " margin-10", children: _jsx(Label, { className: "custom-label", title: "Number of Peaks : ", children: _jsx(FormikInput, { name: "nbPeaks", type: "number" }) }) }), _jsx("div", { className: " margin-10", children: _jsx(Label, { className: "custom-label", title: "Target PPM :", children: _jsx(FormikInput, { name: "targetX", type: "number" }) }) })] }) }), _jsx("div", { className: "footer-container", children: _jsx(Button.Done, { onClick: handleSave, children: "Done" }) })] }));
|
|
56
55
|
}
|
|
57
56
|
export default AlignSpectraModal;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Peak } from '../../data/types/data1d';
|
|
2
|
+
import { PeaksNucleusPreferences } from '../workspaces/Workspace';
|
|
3
|
+
interface EditPeakShapeModalProps {
|
|
4
|
+
onClose?: (element?: string) => void;
|
|
5
|
+
peak: Peak;
|
|
6
|
+
peaksPreferences: PeaksNucleusPreferences;
|
|
7
|
+
}
|
|
8
|
+
declare function EditPeakShapeModal({ onClose, peak, peaksPreferences, }: EditPeakShapeModalProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default EditPeakShapeModal;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/** @jsxImportSource @emotion/react */
|
|
3
|
+
import { css } from '@emotion/react';
|
|
4
|
+
import { useCallback, useRef, useState } from 'react';
|
|
5
|
+
import * as Yup from 'yup';
|
|
6
|
+
import { useDispatch } from '../context/DispatchContext';
|
|
7
|
+
import ActionButtons from '../elements/ActionButtons';
|
|
8
|
+
import CloseButton from '../elements/CloseButton';
|
|
9
|
+
import Label from '../elements/Label';
|
|
10
|
+
import Select from '../elements/Select';
|
|
11
|
+
import FormikForm from '../elements/formik/FormikForm';
|
|
12
|
+
import FormikInput from '../elements/formik/FormikInput';
|
|
13
|
+
import { CHANGE_PEAK_SHAPE } from '../reducer/types/Types';
|
|
14
|
+
import { formatNumber } from '../utility/formatNumber';
|
|
15
|
+
import { ModalStyles } from './ModalStyle';
|
|
16
|
+
const styles = css `
|
|
17
|
+
width: 400px;
|
|
18
|
+
min-height: 250px;
|
|
19
|
+
|
|
20
|
+
.inner-content {
|
|
21
|
+
flex: 1;
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
const getKindDefaultValues = (kind) => {
|
|
25
|
+
return {
|
|
26
|
+
kind,
|
|
27
|
+
fwhm: 500,
|
|
28
|
+
...(kind === 'pseudoVoigt' && { mu: 0.5 }),
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
const getValues = (peak, kind) => {
|
|
32
|
+
const { shape } = peak;
|
|
33
|
+
const shapeData = (shape?.kind || '').toLocaleLowerCase() !== kind
|
|
34
|
+
? {
|
|
35
|
+
...getKindDefaultValues(kind),
|
|
36
|
+
...(shape?.fwhm && { fwhm: shape?.fwhm }),
|
|
37
|
+
}
|
|
38
|
+
: shape;
|
|
39
|
+
return shapeData;
|
|
40
|
+
};
|
|
41
|
+
const validation = (kind) => Yup.object().shape({
|
|
42
|
+
fwhm: Yup.number().required(),
|
|
43
|
+
...(kind === 'pseudoVoigt' && { mu: Yup.number().required() }),
|
|
44
|
+
});
|
|
45
|
+
const KINDS = [
|
|
46
|
+
{
|
|
47
|
+
value: 'gaussian',
|
|
48
|
+
label: 'Gaussian',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
value: 'lorentzian',
|
|
52
|
+
label: 'Lorentzian',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
value: 'pseudoVoigt',
|
|
56
|
+
label: 'PseudoVoigt',
|
|
57
|
+
},
|
|
58
|
+
];
|
|
59
|
+
const labelStyle = {
|
|
60
|
+
container: { paddingTop: '5px' },
|
|
61
|
+
label: { flex: 3, fontSize: '14px', fontWeight: 'normal' },
|
|
62
|
+
wrapper: { flex: 7, display: 'flex' },
|
|
63
|
+
};
|
|
64
|
+
const inputStyle = { input: { width: '200px', textAlign: 'left' } };
|
|
65
|
+
function EditPeakShapeModal({ onClose = () => null, peak, peaksPreferences, }) {
|
|
66
|
+
const dispatch = useDispatch();
|
|
67
|
+
const refForm = useRef();
|
|
68
|
+
const [kind, setKind] = useState(peak.shape?.kind);
|
|
69
|
+
const changePeakShapeHandler = useCallback((values) => {
|
|
70
|
+
dispatch({
|
|
71
|
+
type: CHANGE_PEAK_SHAPE,
|
|
72
|
+
payload: {
|
|
73
|
+
id: peak.id,
|
|
74
|
+
shape: {
|
|
75
|
+
...values,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
onClose();
|
|
80
|
+
}, [dispatch, onClose, peak.id]);
|
|
81
|
+
const values = getValues(peak, kind);
|
|
82
|
+
const valuePPM = formatNumber(peak.x, peaksPreferences.deltaPPM.format);
|
|
83
|
+
return (_jsxs("div", { css: [ModalStyles, styles], children: [_jsxs("div", { className: "header handle", children: [_jsxs("span", { children: [`Peak Shape Edition ( ${valuePPM} PPM)`, " "] }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsx("div", { className: "inner-content", children: _jsxs(FormikForm, { ref: refForm, initialValues: values, validationSchema: validation(kind), onSubmit: changePeakShapeHandler, children: [_jsx(Label, { title: "kind : ", style: labelStyle, children: _jsx(Select, { items: KINDS, style: { margin: 0, height: 30 }, value: kind, onChange: (kind) => setKind(kind) }) }), _jsx(Label, { title: "fwhm: ", style: labelStyle, children: _jsx(FormikInput, { name: "fwhm", style: inputStyle }) }), kind === 'pseudoVoigt' && (_jsx(Label, { title: "mu: ", style: labelStyle, children: _jsx(FormikInput, { name: "mu", style: inputStyle }) }))] }, JSON.stringify(values)) }), _jsx("div", { className: "footer-container", children: _jsx(ActionButtons, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: () => refForm.current.submitForm(), doneLabel: "Save", onCancel: () => onClose?.() }) })] }));
|
|
84
|
+
}
|
|
85
|
+
export default EditPeakShapeModal;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StateMoleculeExtended } from '../../data/molecules/Molecule';
|
|
2
2
|
interface MoleculeStructureEditorModalProps {
|
|
3
3
|
onClose?: (element?: string) => void;
|
|
4
|
-
selectedMolecule?:
|
|
4
|
+
selectedMolecule?: StateMoleculeExtended;
|
|
5
5
|
}
|
|
6
6
|
declare function MoleculeStructureEditorModal(props: MoleculeStructureEditorModalProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
7
|
-
export declare function useMoleculeEditor(): (molecule?:
|
|
7
|
+
export declare function useMoleculeEditor(): (molecule?: StateMoleculeExtended) => void;
|
|
8
8
|
export default MoleculeStructureEditorModal;
|
|
@@ -29,13 +29,12 @@ function MoleculeStructureEditorModal(props) {
|
|
|
29
29
|
}, [onClose]);
|
|
30
30
|
const handleSave = useCallback(() => {
|
|
31
31
|
if (selectedMolecule) {
|
|
32
|
-
const {
|
|
32
|
+
const { id, label } = selectedMolecule;
|
|
33
33
|
dispatch({
|
|
34
34
|
type: SET_MOLECULE,
|
|
35
35
|
payload: {
|
|
36
36
|
molfile,
|
|
37
|
-
|
|
38
|
-
isFloat,
|
|
37
|
+
id,
|
|
39
38
|
label,
|
|
40
39
|
},
|
|
41
40
|
});
|
|
@@ -67,7 +67,6 @@ function MultipleSpectraFiltersModal({ onClose = () => null, nucleus = '', }) {
|
|
|
67
67
|
const List = useMemo(() => {
|
|
68
68
|
const list = REFERENCES[nucleus]
|
|
69
69
|
? Object.entries(REFERENCES[nucleus]).map((item) => ({
|
|
70
|
-
key: item[0],
|
|
71
70
|
value: item[0],
|
|
72
71
|
label: item[0],
|
|
73
72
|
}), [])
|
|
@@ -115,6 +114,6 @@ function MultipleSpectraFiltersModal({ onClose = () => null, nucleus = '', }) {
|
|
|
115
114
|
break;
|
|
116
115
|
}
|
|
117
116
|
}, [filter, submitHandler]);
|
|
118
|
-
return (_jsxs("div", { css: [ModalStyles, styles], children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Apply filters" }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsxs("div", { className: "inner-content container", children: [_jsx("p", { className: "infoText", children: "This filter will use the exclusions zones defined in the first spectrum." }), _jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: "Filter :" }), _jsx(Select, {
|
|
117
|
+
return (_jsxs("div", { css: [ModalStyles, styles], children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Apply filters" }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsxs("div", { className: "inner-content container", children: [_jsx("p", { className: "infoText", children: "This filter will use the exclusions zones defined in the first spectrum." }), _jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: "Filter :" }), _jsx(Select, { items: List, style: { width: 275, height: 30, margin: 0 }, onChange: filterChangeHandler })] }), filterOptions] }), _jsx("div", { className: "footer-container", children: _jsx(ActionButtons, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: handleSave, doneLabel: "Save", onCancel: onClose, cancelLabel: "Close" }) })] }));
|
|
119
118
|
}
|
|
120
119
|
export default MultipleSpectraFiltersModal;
|