nmrium 0.40.1 → 0.41.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/lib/component/1d/FooterBanner.js +5 -4
- package/lib/component/1d/Viewer1D.js +121 -104
- package/lib/component/1d/database/ResurrectedDatabaseRanges.js +1 -1
- package/lib/component/1d/jCouplingGraph/JGraphContext.d.ts +1 -1
- package/lib/component/1d/jCouplingGraph/JsCouplingLinks.js +1 -1
- package/lib/component/1d/multiplicityTree/TreeColors.d.ts +1 -1
- package/lib/component/1d/multiplicityTree/TreeColors.js +1 -6
- package/lib/component/1d/multiplicityTree/TreeNodes.d.ts +1 -1
- package/lib/component/1d/tool/BaseLineZones.d.ts +1 -1
- package/lib/component/1d/tool/BaseLineZones.js +7 -4
- package/lib/component/1d/tool/PeakPointer.js +1 -1
- package/lib/component/1d/utilities/scale.js +1 -3
- package/lib/component/1d-2d/components/FloatMoleculeStructures/index.d.ts +1 -1
- package/lib/component/1d-2d/tools/BrushXY.js +10 -7
- package/lib/component/1d-2d/tools/CrossLinePointer.js +1 -1
- package/lib/component/2d/FooterBanner.js +3 -2
- package/lib/component/2d/Viewer2D.js +51 -29
- package/lib/component/2d/XAxis.js +1 -1
- package/lib/component/2d/YAxis.js +1 -1
- package/lib/component/2d/utilities/SliceScale.d.ts +2 -2
- package/lib/component/2d/utilities/scale.d.ts +5 -5
- package/lib/component/2d/zones/Signal.js +1 -2
- package/lib/component/EventsTrackers/BrushTracker.d.ts +4 -1
- package/lib/component/EventsTrackers/BrushTracker.js +21 -6
- package/lib/component/NMRium.d.ts +2 -2
- package/lib/component/NMRium.js +39 -26
- package/lib/component/assignment/AssignmentsReducer.d.ts +1 -1
- package/lib/component/assignment/actions/setActiveAssignment.js +1 -1
- package/lib/component/elements/InputRange.js +1 -1
- package/lib/component/elements/MenuButton.d.ts +1 -1
- package/lib/component/elements/MoleculeSelection.d.ts +1 -1
- package/lib/component/elements/ReactTable/ReactTable.d.ts +1 -1
- package/lib/component/elements/Tab/DeleteButton.d.ts +1 -1
- package/lib/component/elements/ToolbarMenu.d.ts +1 -1
- package/lib/component/elements/accordion/Accordion.d.ts +1 -1
- package/lib/component/elements/draggable/SVGDraggable.d.ts +1 -1
- package/lib/component/elements/draggable/useDraggable.d.ts +1 -1
- package/lib/component/elements/dropDownButton/DropDownButton.d.ts +1 -1
- package/lib/component/elements/dropDownButton/DropDownList.js +3 -1
- package/lib/component/elements/formik/SelectBox.d.ts +1 -1
- package/lib/component/elements/popup/Alert/AlertBlock.d.ts +3 -2
- package/lib/component/elements/popup/Alert/AlertBlock.js +21 -15
- package/lib/component/elements/popup/Alert/Context.d.ts +26 -2
- package/lib/component/elements/popup/Alert/Context.js +6 -2
- package/lib/component/elements/popup/Alert/Provider.d.ts +4 -3
- package/lib/component/elements/popup/Alert/Provider.js +3 -3
- package/lib/component/elements/popup/Modal/ConfirmDialog.d.ts +1 -1
- package/lib/component/elements/popup/Modal/Provider.js +3 -1
- package/lib/component/elements/popup/options.d.ts +22 -19
- package/lib/component/elements/resizer/Resizer.d.ts +2 -2
- package/lib/component/elements/toggle/ToggleButton.d.ts +2 -2
- package/lib/component/elements/toggle/ToggleButton.js +1 -1
- package/lib/component/header/ZeroFillingOptionsPanel.js +3 -8
- package/lib/component/highlight/index.d.ts +1 -1
- package/lib/component/hooks/useCheckToolsVisibility.js +2 -2
- package/lib/component/hooks/useExport.js +2 -1
- package/lib/component/hooks/useFormatNumberByNucleus.d.ts +1 -1
- package/lib/component/hooks/usePanelPreferences.js +2 -2
- package/lib/component/hooks/useXScale.d.ts +1 -1
- package/lib/component/hooks/useXYReduce.d.ts +2 -2
- package/lib/component/modal/AboutSpectrumSimulationModal.d.ts +2 -0
- package/lib/component/modal/AboutSpectrumSimulationModal.js +49 -0
- package/lib/component/modal/AlignSpectraModal.js +11 -1
- package/lib/component/modal/MultipletAnalysisModal.js +2 -1
- package/lib/component/modal/PredictSpectraModal.d.ts +1 -2
- package/lib/component/modal/PredictSpectraModal.js +25 -28
- package/lib/component/modal/changeSum/ChangeSumModal.js +1 -1
- package/lib/component/modal/editRange/forms/components/SignalsForm.js +1 -1
- package/lib/component/modal/editZone/SignalsForm.js +1 -1
- package/lib/component/modal/metaImportation/MetaImportationModal.js +1 -1
- package/lib/component/modal/setting/settings-tabs/DisplayTabContent.js +4 -0
- package/lib/component/modal/setting/settings-tabs/FormattingTabContent.js +1 -1
- package/lib/component/modal/setting/settingsValidation.js +2 -2
- package/lib/component/panels/IntegralsPanel/IntegralPanel.d.ts +1 -1
- package/lib/component/panels/IntegralsPanel/IntegralTable.d.ts +1 -1
- package/lib/component/panels/IntegralsPanel/IntegralTable.js +4 -7
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -4
- package/lib/component/panels/MoleculesPanel/Utilities.d.ts +1 -1
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +3 -5
- package/lib/component/panels/Panels.js +13 -0
- package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
- package/lib/component/panels/SpectrumsPanel/SpectraTable.js +1 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +3 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
- package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +2 -1
- package/lib/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
- package/lib/component/panels/ZonesPanel/ZonesTable.d.ts +1 -1
- package/lib/component/panels/databasePanel/DatabasePanel.d.ts +1 -1
- package/lib/component/panels/databasePanel/DatabasePanel.js +1 -1
- package/lib/component/panels/databasePanel/DatabaseTable.js +1 -1
- package/lib/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
- package/lib/component/panels/extra/utilities/UseToggleStatus.js +1 -1
- package/lib/component/panels/filtersPanel/FiltersTable.js +2 -2
- package/lib/component/panels/predictionPanel/PredictionOptionsPanel.js +2 -1
- package/lib/component/panels/predictionPanel/PredictionPanel.js +3 -2
- package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +2 -2
- package/lib/component/panels/spectrumSimulation/SpectrumSimulation.d.ts +1 -0
- package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +88 -0
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.d.ts +11 -0
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.js +37 -0
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.d.ts +4 -0
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +25 -0
- package/lib/component/panels/spectrumSimulation/SpinSystemTable.d.ts +5 -0
- package/lib/component/panels/spectrumSimulation/SpinSystemTable.js +60 -0
- package/lib/component/reducer/Reducer.d.ts +13 -12
- package/lib/component/reducer/Reducer.js +251 -239
- package/lib/component/reducer/actions/AssignmentsActions.d.ts +1 -1
- package/lib/component/reducer/actions/AssignmentsActions.js +1 -1
- package/lib/component/reducer/actions/DatabaseActions.js +2 -1
- package/lib/component/reducer/actions/DomainActions.d.ts +7 -2
- package/lib/component/reducer/actions/DomainActions.js +30 -1
- package/lib/component/reducer/actions/FiltersActions.js +4 -4
- package/lib/component/reducer/actions/LoadActions.js +1 -1
- package/lib/component/reducer/actions/MoleculeActions.d.ts +2 -0
- package/lib/component/reducer/actions/MoleculeActions.js +51 -2
- package/lib/component/reducer/actions/SpectrumsActions.d.ts +8 -2
- package/lib/component/reducer/actions/SpectrumsActions.js +43 -4
- package/lib/component/reducer/actions/ToolsActions.js +2 -2
- package/lib/component/reducer/actions/ZonesActions.js +1 -1
- package/lib/component/reducer/helper/ZoomHistoryManager.d.ts +4 -6
- package/lib/component/reducer/preferences/actions/setActiveWorkspace.js +1 -1
- package/lib/component/reducer/preferences/actions/setPreferences.js +3 -4
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
- package/lib/component/reducer/preferences/preferencesReducer.js +5 -1
- package/lib/component/reducer/preferences/utilities/flatObject.js +1 -1
- package/lib/component/toolbar/ToolTypes.d.ts +4 -4
- package/lib/component/utility/export.js +9 -9
- package/lib/component/utility/getSpectraObjectPaths.js +1 -1
- package/lib/component/utility/getUniqueNuclei.js +1 -1
- package/lib/component/utility/jpathToArray.js +1 -1
- package/lib/component/workspaces/index.d.ts +1 -0
- package/lib/component/workspaces/index.js +2 -0
- package/lib/component/workspaces/simulation.d.ts +2 -0
- package/lib/component/workspaces/simulation.js +68 -0
- package/lib/component/workspaces/workspaceDefaultProperties.js +1 -0
- package/lib/data/PredictionManager.d.ts +8 -7
- package/lib/data/PredictionManager.js +95 -22
- package/lib/data/SpectraManager.js +1 -1
- package/lib/data/constants/DefaultPathLengths.d.ts +1 -3
- package/lib/data/constants/SignalsKinds.d.ts +2 -2
- package/lib/data/data1d/Spectrum1D/generateJGraphData.js +3 -3
- package/lib/data/data1d/Spectrum1D/getReferenceShift.js +5 -4
- package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.d.ts +1 -1
- package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +12 -13
- package/lib/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +10 -9
- package/lib/data/data1d/database.d.ts +5 -5
- package/lib/data/data1d/database.js +3 -3
- package/lib/data/data1d/multipleSpectraAnalysis.d.ts +1 -1
- package/lib/data/data1d/multipleSpectraAnalysis.js +1 -1
- package/lib/data/data1d/spectrumSimulation.d.ts +14 -0
- package/lib/data/data1d/spectrumSimulation.js +53 -0
- package/lib/data/data2d/Spectrum2D/contours.d.ts +8 -4
- package/lib/data/data2d/Spectrum2D/contours.js +7 -1
- package/lib/data/data2d/Spectrum2D/getMissingProjection.js +6 -6
- package/lib/data/data2d/Spectrum2D/getShift.js +1 -1
- package/lib/data/data2d/Spectrum2D/getSlice.js +4 -4
- package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.js +5 -5
- package/lib/data/getDefaultMatrixFilters.d.ts +2 -2
- package/lib/data/matrixGeneration.js +1 -1
- package/lib/data/molecules/MoleculeManager.d.ts +1 -1
- package/lib/data/molecules/MoleculeManager.js +7 -7
- package/lib/data/parseMeta/linkMetaWithSpectra.js +2 -1
- package/lib/data/types/data1d/MatrixOptions.d.ts +2 -2
- package/lib/data/utilities/FindUtilities.js +4 -4
- package/lib/data/utilities/RangeUtilities.d.ts +1 -1
- package/lib/data/utilities/ZoneUtilities.d.ts +1 -1
- package/lib/data/utilities/calculateSanPlot.js +3 -3
- package/lib/data/utilities/generateNumbersPowerOfX.js +1 -1
- package/lib/utils/clipboard/clipboard.d.ts +1 -1
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/FooterBanner.js +5 -4
- package/lib-cjs/component/1d/Viewer1D.js +120 -103
- package/lib-cjs/component/1d/database/ResurrectedDatabaseRanges.js +1 -1
- package/lib-cjs/component/1d/jCouplingGraph/JsCouplingLinks.js +1 -1
- package/lib-cjs/component/1d/multiplicityTree/TreeColors.js +1 -6
- package/lib-cjs/component/1d/tool/BaseLineZones.js +6 -3
- package/lib-cjs/component/1d/tool/PeakPointer.js +1 -1
- package/lib-cjs/component/1d/utilities/scale.js +1 -3
- package/lib-cjs/component/1d-2d/tools/BrushXY.js +10 -7
- package/lib-cjs/component/1d-2d/tools/CrossLinePointer.js +1 -1
- package/lib-cjs/component/2d/FooterBanner.js +3 -2
- package/lib-cjs/component/2d/Viewer2D.js +50 -28
- package/lib-cjs/component/2d/XAxis.js +1 -1
- package/lib-cjs/component/2d/YAxis.js +1 -1
- package/lib-cjs/component/2d/zones/Signal.js +1 -2
- package/lib-cjs/component/EventsTrackers/BrushTracker.js +21 -6
- package/lib-cjs/component/NMRium.js +37 -24
- package/lib-cjs/component/assignment/actions/setActiveAssignment.js +1 -1
- package/lib-cjs/component/elements/InputRange.js +1 -1
- package/lib-cjs/component/elements/dropDownButton/DropDownList.js +3 -1
- package/lib-cjs/component/elements/popup/Alert/AlertBlock.js +21 -15
- package/lib-cjs/component/elements/popup/Alert/Context.js +6 -2
- package/lib-cjs/component/elements/popup/Alert/Provider.js +2 -2
- package/lib-cjs/component/elements/popup/Modal/Provider.js +3 -1
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +3 -8
- package/lib-cjs/component/hooks/useCheckToolsVisibility.js +2 -2
- package/lib-cjs/component/hooks/useExport.js +2 -1
- package/lib-cjs/component/hooks/usePanelPreferences.js +1 -1
- package/lib-cjs/component/modal/AboutSpectrumSimulationModal.js +54 -0
- package/lib-cjs/component/modal/AlignSpectraModal.js +11 -1
- package/lib-cjs/component/modal/MultipletAnalysisModal.js +2 -1
- package/lib-cjs/component/modal/PredictSpectraModal.js +24 -27
- package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +1 -1
- package/lib-cjs/component/modal/editRange/forms/components/SignalsForm.js +1 -1
- package/lib-cjs/component/modal/editZone/SignalsForm.js +1 -1
- package/lib-cjs/component/modal/metaImportation/MetaImportationModal.js +1 -1
- package/lib-cjs/component/modal/setting/settings-tabs/DisplayTabContent.js +4 -0
- package/lib-cjs/component/modal/setting/settings-tabs/FormattingTabContent.js +1 -1
- package/lib-cjs/component/modal/setting/settingsValidation.js +2 -2
- package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +4 -7
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -4
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +3 -5
- package/lib-cjs/component/panels/Panels.js +13 -0
- package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraTable.js +1 -1
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +3 -1
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
- package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +1 -1
- package/lib-cjs/component/panels/databasePanel/DatabaseTable.js +1 -1
- package/lib-cjs/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
- package/lib-cjs/component/panels/extra/utilities/UseToggleStatus.js +1 -1
- package/lib-cjs/component/panels/filtersPanel/FiltersTable.js +2 -2
- package/lib-cjs/component/panels/predictionPanel/PredictionOptionsPanel.js +2 -1
- package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +3 -2
- package/lib-cjs/component/panels/predictionPanel/PredictionSimpleOptions.js +1 -1
- package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulation.js +94 -0
- package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationPreferences.js +42 -0
- package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +31 -0
- package/lib-cjs/component/panels/spectrumSimulation/SpinSystemTable.js +67 -0
- package/lib-cjs/component/reducer/Reducer.js +251 -239
- package/lib-cjs/component/reducer/actions/AssignmentsActions.js +1 -1
- package/lib-cjs/component/reducer/actions/DatabaseActions.js +2 -1
- package/lib-cjs/component/reducer/actions/DomainActions.js +31 -1
- package/lib-cjs/component/reducer/actions/FiltersActions.js +4 -4
- package/lib-cjs/component/reducer/actions/LoadActions.js +1 -1
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +54 -2
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +43 -3
- package/lib-cjs/component/reducer/actions/ToolsActions.js +2 -2
- package/lib-cjs/component/reducer/actions/ZonesActions.js +1 -1
- package/lib-cjs/component/reducer/preferences/actions/setActiveWorkspace.js +1 -1
- package/lib-cjs/component/reducer/preferences/actions/setPreferences.js +3 -4
- package/lib-cjs/component/reducer/preferences/preferencesReducer.js +5 -1
- package/lib-cjs/component/reducer/preferences/utilities/flatObject.js +1 -1
- package/lib-cjs/component/utility/export.js +9 -9
- package/lib-cjs/component/utility/getSpectraObjectPaths.js +1 -1
- package/lib-cjs/component/utility/getUniqueNuclei.js +1 -1
- package/lib-cjs/component/utility/jpathToArray.js +1 -1
- package/lib-cjs/component/workspaces/index.js +2 -0
- package/lib-cjs/component/workspaces/simulation.js +71 -0
- package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +1 -0
- package/lib-cjs/data/PredictionManager.js +96 -22
- package/lib-cjs/data/SpectraManager.js +1 -1
- package/lib-cjs/data/data1d/Spectrum1D/generateJGraphData.js +3 -3
- package/lib-cjs/data/data1d/Spectrum1D/getReferenceShift.js +5 -4
- package/lib-cjs/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +12 -13
- package/lib-cjs/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +10 -9
- package/lib-cjs/data/data1d/database.js +3 -3
- package/lib-cjs/data/data1d/multipleSpectraAnalysis.js +1 -1
- package/lib-cjs/data/data1d/spectrumSimulation.js +58 -0
- package/lib-cjs/data/data2d/Spectrum2D/contours.js +7 -1
- package/lib-cjs/data/data2d/Spectrum2D/getMissingProjection.js +6 -6
- package/lib-cjs/data/data2d/Spectrum2D/getShift.js +1 -1
- package/lib-cjs/data/data2d/Spectrum2D/getSlice.js +4 -4
- package/lib-cjs/data/data2d/Spectrum2D/zones/getDetectionZones.js +5 -5
- package/lib-cjs/data/matrixGeneration.js +1 -1
- package/lib-cjs/data/molecules/MoleculeManager.js +7 -7
- package/lib-cjs/data/parseMeta/linkMetaWithSpectra.js +2 -1
- package/lib-cjs/data/utilities/FindUtilities.js +4 -4
- package/lib-cjs/data/utilities/calculateSanPlot.js +3 -3
- package/lib-cjs/data/utilities/generateNumbersPowerOfX.js +1 -1
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +21 -20
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
export interface Position {
|
|
3
3
|
x1: number;
|
|
4
4
|
x2: number;
|
|
5
5
|
}
|
|
6
|
-
type ChildType =
|
|
6
|
+
type ChildType = React.ReactElement[] | React.ReactElement | boolean | null;
|
|
7
7
|
export interface ResizerProps {
|
|
8
8
|
children?: ChildType | ((position: Position, isActive: boolean) => ChildType);
|
|
9
9
|
initialPosition?: Position;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ReactElement
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
2
|
interface ToggleButtonProps {
|
|
3
3
|
isActive?: boolean;
|
|
4
4
|
value?: any;
|
|
5
5
|
onChange?: (value: any) => null;
|
|
6
|
-
children: ReactElement
|
|
6
|
+
children: ReactElement;
|
|
7
7
|
isVisible?: boolean;
|
|
8
8
|
}
|
|
9
9
|
export default function ToggleButton(props: ToggleButtonProps & {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useState, useEffect
|
|
2
|
+
import { useCallback, useState, useEffect } from 'react';
|
|
3
3
|
import { Toolbar } from 'react-science/ui';
|
|
4
4
|
export default function ToggleButton(props) {
|
|
5
5
|
const { children, value = null, isActive = false, onChange = () => null, isVisible = true, id, title, } = props;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Filters } from 'nmr-processing';
|
|
3
3
|
import { useEffect, useState, memo } from 'react';
|
|
4
|
+
import { Checkbox } from 'react-science/ui';
|
|
4
5
|
import generateNumbersPowerOfX from '../../data/utilities/generateNumbersPowerOfX';
|
|
5
6
|
import { useDispatch } from '../context/DispatchContext';
|
|
6
7
|
import ActionButtons from '../elements/ActionButtons';
|
|
7
|
-
import CheckBox from '../elements/CheckBox';
|
|
8
8
|
import Label from '../elements/Label';
|
|
9
9
|
import Select from '../elements/Select';
|
|
10
10
|
import { useFilter } from '../hooks/useFilter';
|
|
@@ -50,19 +50,14 @@ function ZeroFillingOptionsInnerPanel(props) {
|
|
|
50
50
|
}
|
|
51
51
|
function handleChangeSizeHandler(value) {
|
|
52
52
|
setSize(value);
|
|
53
|
-
dispatchLiveChanges(value);
|
|
54
53
|
}
|
|
55
54
|
useEffect(() => {
|
|
56
55
|
if (livePreview && size) {
|
|
57
56
|
dispatchLiveChanges(size);
|
|
58
57
|
}
|
|
59
58
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
60
|
-
}, []);
|
|
61
|
-
|
|
62
|
-
const checked = event.target.checked;
|
|
63
|
-
setLivePreview(checked);
|
|
64
|
-
}
|
|
65
|
-
return (_jsxs(HeaderContainer, { children: [_jsx(Label, { title: "Size: ", style: headerLabelStyle, children: _jsx(Select, { items: Sizes, style: { marginLeft: 10, marginRight: 10 }, value: size, onChange: handleChangeSizeHandler }) }), _jsx(Label, { title: "Live preview ", htmlFor: "livePreview", style: headerLabelStyle, children: _jsx(CheckBox, { name: "livePreview", defaultChecked: true, onChange: checkChangeHandler }) }), _jsx(ActionButtons, { onDone: handleApplyFilter, onCancel: handleCancelFilter })] }));
|
|
59
|
+
}, [size, livePreview]);
|
|
60
|
+
return (_jsxs(HeaderContainer, { children: [_jsx(Label, { title: "Size: ", style: headerLabelStyle, children: _jsx(Select, { items: Sizes, style: { marginLeft: 10, marginRight: 10 }, value: size, onChange: handleChangeSizeHandler }) }), _jsx(Checkbox, { label: "Live preview", checked: livePreview, onChange: setLivePreview }), _jsx(ActionButtons, { onDone: handleApplyFilter, onCancel: handleCancelFilter })] }));
|
|
66
61
|
}
|
|
67
62
|
const MemoizedZeroFillingOptionsPanel = memo(ZeroFillingOptionsInnerPanel);
|
|
68
63
|
export default function ZeroFillingOptionsPanel() {
|
|
@@ -53,7 +53,7 @@ export declare function useHighlightData(): HighlightContextProps;
|
|
|
53
53
|
* @param {Array<string | number>} highlights
|
|
54
54
|
* @param {SourceData = null} sourceData
|
|
55
55
|
*/
|
|
56
|
-
export declare function useHighlight(highlights:
|
|
56
|
+
export declare function useHighlight(highlights: Array<string | number>, sourceData?: SourceData | null): {
|
|
57
57
|
isActive: boolean;
|
|
58
58
|
defaultActiveStyle: CSSProperties;
|
|
59
59
|
onHover: {
|
|
@@ -10,7 +10,7 @@ export function useCheckToolsVisibility() {
|
|
|
10
10
|
const spectrum = useSpectrum(null);
|
|
11
11
|
return useCallback((toolKey, checkOptions = {}) => {
|
|
12
12
|
const { checkMode = true, checkSpectrumType = true, extraInfoCheckParameters, } = checkOptions;
|
|
13
|
-
|
|
13
|
+
const flag = lodashGet(preferences.current, `display.toolBarButtons.${toolKey}`, false);
|
|
14
14
|
const { spectraOptions, mode } = options[toolKey];
|
|
15
15
|
const modeFlag = !checkMode || (checkMode && (!mode || displayerMode === mode));
|
|
16
16
|
const spectrumCheckFlag = !checkSpectrumType ||
|
|
@@ -31,7 +31,7 @@ function checkSpectrum(spectrum, options) {
|
|
|
31
31
|
let innerConditionFlag = true;
|
|
32
32
|
if (option.active) {
|
|
33
33
|
if (spectrum) {
|
|
34
|
-
for (
|
|
34
|
+
for (const { key, value } of option.info || []) {
|
|
35
35
|
if (spectrum.info[key] !== value) {
|
|
36
36
|
innerConditionFlag = false;
|
|
37
37
|
}
|
|
@@ -41,7 +41,8 @@ export default function useExport() {
|
|
|
41
41
|
setTimeout(() => {
|
|
42
42
|
void handle();
|
|
43
43
|
}, 0);
|
|
44
|
-
})
|
|
44
|
+
})
|
|
45
|
+
.catch(reportError);
|
|
45
46
|
}, [alert, preferencesState, state]);
|
|
46
47
|
const saveAsSVGHandler = useCallback(async () => {
|
|
47
48
|
if (state.data.length > 0 && rootRef) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export type ReturnFunction = (value?: number | string, formatKey?: string, prefix?: string, suffix?: string) => string;
|
|
2
|
-
export declare function useFormatNumberByNucleus(nucleus?:
|
|
2
|
+
export declare function useFormatNumberByNucleus(nucleus?: string[]): ReturnFunction[];
|
|
3
3
|
export declare function useFormatNumberByNucleus(nucleus?: string): ReturnFunction;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import has from 'lodash/has';
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { getDefaultPredictionOptions } from '../../data/PredictionManager';
|
|
4
4
|
import { usePreferences } from '../context/PreferencesContext';
|
|
5
5
|
import { getIntegralDefaultValues, getPeaksDefaultValues, getZoneDefaultValues, getRangeDefaultValues, databaseDefaultValues, getMultipleSpectraAnalysisDefaultValues, getSpectraDefaultValues, } from '../reducer/preferences/panelsPreferencesDefaultValues';
|
|
6
6
|
import { getValue } from '../utility/LocalStorage';
|
|
@@ -22,7 +22,7 @@ function getDefaultPreferences(panelKey, nucleus) {
|
|
|
22
22
|
case 'multipleSpectraAnalysis':
|
|
23
23
|
return getMultipleSpectraAnalysisDefaultValues(nucleus);
|
|
24
24
|
case 'prediction':
|
|
25
|
-
return
|
|
25
|
+
return getDefaultPredictionOptions();
|
|
26
26
|
default:
|
|
27
27
|
return {};
|
|
28
28
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ScaleLinear } from 'd3';
|
|
2
|
-
export declare function useXScale(): ScaleLinear<any, any
|
|
2
|
+
export declare function useXScale(): ScaleLinear<any, any>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataXY
|
|
1
|
+
import { DataXY } from 'cheminfo-types';
|
|
2
2
|
export declare enum XYReducerDomainAxis {
|
|
3
3
|
XAxis = "XAxis",
|
|
4
4
|
YAxis = "YAxis"
|
|
@@ -7,5 +7,5 @@ type XYReducerDomainAxisType = keyof typeof XYReducerDomainAxis;
|
|
|
7
7
|
export default function useXYReduce(domainAxis: XYReducerDomainAxisType): (data: {
|
|
8
8
|
x: Float64Array;
|
|
9
9
|
y: Float64Array;
|
|
10
|
-
}) => DataXY
|
|
10
|
+
}) => DataXY;
|
|
11
11
|
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/** @jsxImportSource @emotion/react */
|
|
3
|
+
import { css } from '@emotion/react';
|
|
4
|
+
import { FaInfo } from 'react-icons/fa';
|
|
5
|
+
import { Modal, useOnOff } from 'react-science/ui';
|
|
6
|
+
import Button from '../elements/Button';
|
|
7
|
+
const styles = css `
|
|
8
|
+
width: 600px;
|
|
9
|
+
|
|
10
|
+
.content {
|
|
11
|
+
padding: 2em;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
ul {
|
|
15
|
+
list-style-type: disc;
|
|
16
|
+
margin-left: 25px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
p,
|
|
20
|
+
li {
|
|
21
|
+
user-select: text;
|
|
22
|
+
font-size: 1.1em;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
a {
|
|
26
|
+
color: #00bcd4;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
a:hover,
|
|
30
|
+
a:focus {
|
|
31
|
+
text-decoration: underline;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.header span {
|
|
35
|
+
color: #464646;
|
|
36
|
+
font-size: 15px;
|
|
37
|
+
flex: 1;
|
|
38
|
+
user-select: none;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
p {
|
|
42
|
+
padding: 0.8em 0;
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
45
|
+
function AboutSpectrumSimulationModal() {
|
|
46
|
+
const [isOpenDialog, openDialog, closeDialog] = useOnOff(false);
|
|
47
|
+
return (_jsxs(_Fragment, { children: [_jsx(Button.BarButton, { onClick: openDialog, tooltipOrientation: "horizontal", toolTip: "About Prediction", children: _jsx(FaInfo, {}) }), _jsx(Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: closeDialog, children: _jsxs("div", { css: styles, children: [_jsx(Modal.Header, { children: _jsx("div", { className: "header", children: _jsx("span", { children: "About spectrum simulation" }) }) }), _jsx(Modal.Body, { children: _jsxs("div", { className: "content", children: [_jsx("p", { children: "If you are using our tools please cite us:" }), _jsx("ul", { children: _jsxs("li", { children: ["Fast and Accurate Algorithm for the Simulation of NMR spectra of Large Spin Systems. Andr\u00E9s M. Castillo, Luc Patiny and Julien Wist Journal of Magnetic Resonance 2011.", _jsx("a", { href: "http://dx.doi.org/10.1016/j.jmr.2010.12.008", target: "_blank", rel: "noreferrer", children: "10.1016/j.jmr.2010.12.008" })] }) })] }) })] }) })] }));
|
|
48
|
+
}
|
|
49
|
+
export default AboutSpectrumSimulationModal;
|
|
@@ -11,6 +11,16 @@ import Select from '../elements/Select';
|
|
|
11
11
|
import FormikInput from '../elements/formik/FormikInput';
|
|
12
12
|
import Events from '../utility/Events';
|
|
13
13
|
import { ModalStyles } from './ModalStyle';
|
|
14
|
+
const labelStyle = {
|
|
15
|
+
label: { flex: 4, fontWeight: '500' },
|
|
16
|
+
wrapper: { flex: 8, display: 'flex', alignItems: 'center' },
|
|
17
|
+
container: { padding: '5px 0' },
|
|
18
|
+
};
|
|
19
|
+
const inputStyle = {
|
|
20
|
+
input: {
|
|
21
|
+
padding: '5px',
|
|
22
|
+
},
|
|
23
|
+
};
|
|
14
24
|
const baseList = [{ key: 1, value: 'manual', label: 'Manual' }];
|
|
15
25
|
function AlignSpectraModal({ onClose = () => null, nucleus, }) {
|
|
16
26
|
const refForm = useRef();
|
|
@@ -50,6 +60,6 @@ function AlignSpectraModal({ onClose = () => null, nucleus, }) {
|
|
|
50
60
|
...resValues,
|
|
51
61
|
});
|
|
52
62
|
}, [nucleus]);
|
|
53
|
-
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: _jsx(Formik, { innerRef: refForm, initialValues: { from: -1, to: 1, nbPeaks: 1, targetX: 0 }, onSubmit: submitHandler, children: _jsxs(_Fragment, { children: [
|
|
63
|
+
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: _jsx(Formik, { innerRef: refForm, initialValues: { from: -1, to: 1, nbPeaks: 1, targetX: 0 }, onSubmit: submitHandler, children: _jsxs(_Fragment, { children: [_jsx(Label, { title: "Options", style: labelStyle, children: _jsx(Select, { items: List, style: { width: '100%', height: 30 }, onChange: optionChangeHandler }) }), _jsxs(Label, { title: "Range", style: labelStyle, children: [_jsx(Label, { title: "From", children: _jsx(FormikInput, { name: "from", type: "number", style: inputStyle }) }), _jsx(Label, { title: "To", style: { label: { padding: '0 10px' } }, children: _jsx(FormikInput, { name: "to", type: "number", style: inputStyle }) })] }), _jsx(Label, { title: "Number of Peaks", style: labelStyle, children: _jsx(FormikInput, { name: "nbPeaks", type: "number", style: inputStyle }) }), _jsx(Label, { title: "Target PPM", style: labelStyle, children: _jsx(FormikInput, { name: "targetX", type: "number", style: inputStyle }) })] }) }) }), _jsx("div", { className: "footer-container", children: _jsx(Button.Done, { onClick: handleSave, children: "Done" }) })] }));
|
|
54
64
|
}
|
|
55
65
|
export default AlignSpectraModal;
|
|
@@ -151,7 +151,8 @@ export default function MultipletAnalysisModal({ data, activeSpectrum, scaleX, s
|
|
|
151
151
|
return (
|
|
152
152
|
// eslint-disable-next-line react/no-array-index-key
|
|
153
153
|
_jsxs("div", { className: "row", children: [_jsxs(Plot, { width: 400, height: 200, svgStyle: { overflow: 'visible' }, seriesViewportStyle: { stroke: 'black' }, children: [_jsx(LineSeries, { data: xyToXYObject(d.multiplet) }), _jsx(Axis, { id: "y", position: "left", tickPosition: "inner", displayPrimaryGridLines: true, hiddenTicks: true, paddingStart: 0.1, paddingEnd: 0.1 }), _jsx(Axis, { id: "x", position: "bottom", tickPosition: "inner", displayPrimaryGridLines: true })] }), _jsx("div", { className: "multiplicity", children: _jsx("p", { children: analysisData.js[index]
|
|
154
|
-
? `${analysisData.js[index]
|
|
154
|
+
? `${analysisData.js[index]
|
|
155
|
+
?.multiplicity}: ${analysisData.js[index]?.coupling.toFixed(3)} Hz`
|
|
155
156
|
: '' }) }), _jsxs(Plot, { width: 400, height: 200, seriesViewportStyle: { stroke: 'black' }, children: [_jsx(LineSeries, { data: xyToXYObject(d.errorFunction), lineStyle: { strokeWidth: 1 } }), _jsx(Axis, { id: "y", position: "left", tickPosition: "inner", displayPrimaryGridLines: true, hiddenTicks: true, paddingStart: 0.1, paddingEnd: 0.1 }), _jsx(Axis, { id: "x", position: "bottom", tickPosition: "inner", displayPrimaryGridLines: true })] })] }, index));
|
|
156
157
|
}) })] }));
|
|
157
158
|
}
|
|
@@ -3,6 +3,5 @@ interface PredictSpectraModalProps {
|
|
|
3
3
|
onClose?: (element?: string) => void;
|
|
4
4
|
molecule: StateMoleculeExtended;
|
|
5
5
|
}
|
|
6
|
-
declare function PredictSpectraModal({ onClose, molecule, }: PredictSpectraModalProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
7
|
-
export declare function usePredictSpectraModal(): (molecule: StateMoleculeExtended) => void;
|
|
6
|
+
export declare function PredictSpectraModal({ onClose, molecule, }: PredictSpectraModalProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
8
7
|
export default PredictSpectraModal;
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
|
+
import { SvgNmrFt } from 'cheminfo-font';
|
|
4
5
|
import { useCallback, useRef, useState, useMemo } from 'react';
|
|
5
|
-
import {
|
|
6
|
+
import { Checkbox, Modal, useOnOff } from 'react-science/ui';
|
|
7
|
+
import { getDefaultPredictionOptions, predictSpectra, } from '../../data/PredictionManager';
|
|
6
8
|
import { useChartData } from '../context/ChartContext';
|
|
7
9
|
import { useDispatch } from '../context/DispatchContext';
|
|
8
10
|
import { useLogger } from '../context/LoggerContext';
|
|
9
11
|
import Button from '../elements/Button';
|
|
10
|
-
import CheckBox from '../elements/CheckBox';
|
|
11
|
-
import CloseButton from '../elements/CloseButton';
|
|
12
12
|
import { useAlert } from '../elements/popup/Alert';
|
|
13
|
-
import { useModal } from '../elements/popup/Modal';
|
|
14
|
-
import { positions } from '../elements/popup/options';
|
|
15
13
|
import PredictionPreferences from '../panels/predictionPanel/PredictionOptionsPanel';
|
|
16
14
|
import { useStateWithLocalStorage } from '../utility/LocalStorage';
|
|
17
15
|
import { ModalStyles } from './ModalStyle';
|
|
@@ -36,24 +34,30 @@ const styles = css `
|
|
|
36
34
|
margin: 5px 5px 5px 0;
|
|
37
35
|
}
|
|
38
36
|
}
|
|
37
|
+
|
|
38
|
+
.header {
|
|
39
|
+
padding: 0;
|
|
40
|
+
margin: 0 30%;
|
|
41
|
+
width: 40%;
|
|
42
|
+
}
|
|
39
43
|
`;
|
|
40
|
-
function PredictSpectraModal({ onClose = () => null, molecule, }) {
|
|
44
|
+
export function PredictSpectraModal({ onClose = () => null, molecule, }) {
|
|
45
|
+
const [isOpenDialog, openDialog, closeDialog] = useOnOff(false);
|
|
41
46
|
const refForm = useRef();
|
|
42
47
|
const dispatch = useDispatch();
|
|
43
48
|
const alert = useAlert();
|
|
44
|
-
const [isApproved, setApproved] = useState(false);
|
|
45
49
|
const [predictionPreferences, setPredictionPreferences] = useStateWithLocalStorage('nmrium-prediction-preferences');
|
|
50
|
+
const { isApproved: isAgree = false, ...options } = predictionPreferences;
|
|
51
|
+
const [isApproved, setApproved] = useState(isAgree);
|
|
46
52
|
const { toolOptions: { data: { predictionIndex }, }, } = useChartData();
|
|
47
53
|
const handleSave = useCallback(() => {
|
|
48
54
|
refForm.current.submitForm();
|
|
49
55
|
}, []);
|
|
50
56
|
const initValues = useMemo(() => {
|
|
51
|
-
|
|
52
|
-
setApproved(isAgree);
|
|
53
|
-
return Object.assign(defaultPredictionOptions, options, {
|
|
57
|
+
return Object.assign(getDefaultPredictionOptions(), options, {
|
|
54
58
|
name: `Prediction ${predictionIndex + 1}`,
|
|
55
59
|
});
|
|
56
|
-
}, [
|
|
60
|
+
}, [options, predictionIndex]);
|
|
57
61
|
const { logger } = useLogger();
|
|
58
62
|
const submitHandler = useCallback((values) => {
|
|
59
63
|
void (async () => {
|
|
@@ -66,12 +70,15 @@ function PredictSpectraModal({ onClose = () => null, molecule, }) {
|
|
|
66
70
|
predictedSpectra.push(key);
|
|
67
71
|
}
|
|
68
72
|
}
|
|
73
|
+
onClose();
|
|
74
|
+
closeDialog();
|
|
69
75
|
const hideLoading = await alert.showLoading(`Predict ${predictedSpectra.join(',')} in progress`);
|
|
70
76
|
try {
|
|
71
|
-
const data = await predictSpectra(molfile
|
|
77
|
+
const data = await predictSpectra(molfile);
|
|
72
78
|
dispatch({
|
|
73
79
|
type: 'PREDICT_SPECTRA',
|
|
74
80
|
payload: {
|
|
81
|
+
logger,
|
|
75
82
|
predictedSpectra: data.spectra,
|
|
76
83
|
options: values,
|
|
77
84
|
molecule,
|
|
@@ -83,7 +90,6 @@ function PredictSpectraModal({ onClose = () => null, molecule, }) {
|
|
|
83
90
|
}
|
|
84
91
|
finally {
|
|
85
92
|
hideLoading();
|
|
86
|
-
onClose();
|
|
87
93
|
}
|
|
88
94
|
}
|
|
89
95
|
})();
|
|
@@ -95,20 +101,11 @@ function PredictSpectraModal({ onClose = () => null, molecule, }) {
|
|
|
95
101
|
onClose,
|
|
96
102
|
logger,
|
|
97
103
|
setPredictionPreferences,
|
|
104
|
+
closeDialog,
|
|
98
105
|
]);
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
export function usePredictSpectraModal() {
|
|
105
|
-
const modal = useModal();
|
|
106
|
-
return (molecule) => {
|
|
107
|
-
modal.show(_jsx(PredictSpectraModal, { molecule: molecule }), {
|
|
108
|
-
position: positions.TOP_CENTER,
|
|
109
|
-
enableResizing: true,
|
|
110
|
-
width: 600,
|
|
111
|
-
});
|
|
112
|
-
};
|
|
106
|
+
return (_jsxs(_Fragment, { children: [_jsx(Button.BarButton, { color: { base: '#4e4e4e', hover: '#4e4e4e' }, onClick: openDialog, toolTip: "Predict spectra", tooltipOrientation: "horizontal", children: _jsx(SvgNmrFt, {}) }), _jsx(Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: () => {
|
|
107
|
+
onClose();
|
|
108
|
+
closeDialog();
|
|
109
|
+
}, width: 600, maxWidth: 1000, children: _jsxs("div", { css: [ModalStyles, styles], children: [_jsx(Modal.Header, { children: _jsx("div", { className: "header handle", children: _jsx("span", { children: "Prediction of NMR spectrum" }) }) }), _jsxs("div", { className: "inner-content", children: [_jsx(PredictionPreferences, { onSubmit: submitHandler, options: initValues, ref: refForm }), _jsx("p", { className: "warning", children: "In order to predict spectra we are calling an external service and the chemical structure will leave your browser! You should never predict spectra for confidential molecules." }), _jsx("div", { className: "warning-container", children: _jsx(Checkbox, { onChange: setApproved, checked: isApproved, label: "I confirm that the chemical structure is not confidential." }, String(isApproved)) })] }), _jsx("div", { className: "footer-container", children: _jsx(Button.Done, { onClick: handleSave, disabled: !isApproved, children: "Predict spectrum" }) })] }) })] }));
|
|
113
110
|
}
|
|
114
111
|
export default PredictSpectraModal;
|
|
@@ -89,7 +89,7 @@ export default function ChangeSumModal({ onSave, onClose, header, sumOptions, })
|
|
|
89
89
|
}
|
|
90
90
|
else {
|
|
91
91
|
setActiveOption(SumSetOptions.Manual);
|
|
92
|
-
formRef.current.setValues({ sum: sumOptions?.sum
|
|
92
|
+
formRef.current.setValues({ sum: sumOptions?.sum ?? '', molecule: null });
|
|
93
93
|
}
|
|
94
94
|
}, [panels?.structuresPanel, sumOptions]);
|
|
95
95
|
function saveHandler(values) {
|
|
@@ -91,7 +91,7 @@ function SignalsForm({ range, preferences }) {
|
|
|
91
91
|
: 'addSignalTab');
|
|
92
92
|
}, [setFieldValue, values.signals.length]);
|
|
93
93
|
const tabContainsErrors = useCallback((i) => {
|
|
94
|
-
return !!
|
|
94
|
+
return !!errors?.signals?.[i];
|
|
95
95
|
}, [errors]);
|
|
96
96
|
const signalFormTabs = useMemo(() => {
|
|
97
97
|
const signalTabs = values.signals.length > 0
|
|
@@ -25,7 +25,7 @@ const tabStyles = css `
|
|
|
25
25
|
function SignalsForm() {
|
|
26
26
|
const { values, setFieldValue, errors, } = useFormikContext();
|
|
27
27
|
const tabContainsErrors = useCallback((i) => {
|
|
28
|
-
return !!
|
|
28
|
+
return !!errors?.signals?.[i];
|
|
29
29
|
}, [errors]);
|
|
30
30
|
const signalFormTabs = useMemo(() => {
|
|
31
31
|
const signalTabs = values.signals.length > 0
|
|
@@ -115,7 +115,7 @@ function MetaImportationModal({ onClose, file }) {
|
|
|
115
115
|
return columns;
|
|
116
116
|
}, [parseResult?.meta.fields]);
|
|
117
117
|
function handleLinkSpectra(fields) {
|
|
118
|
-
|
|
118
|
+
const { source, target } = fields;
|
|
119
119
|
if (data && parseResult) {
|
|
120
120
|
try {
|
|
121
121
|
const { compareResult, matches } = linkMetaWithSpectra({
|
|
@@ -53,7 +53,7 @@ function FormattingTabContent() {
|
|
|
53
53
|
const { values, setFieldValue } = useFormikContext();
|
|
54
54
|
const nuclei = lodashGet(values, 'formatting.nuclei', {});
|
|
55
55
|
function deleteHandler(key) {
|
|
56
|
-
|
|
56
|
+
const _nuclei = {};
|
|
57
57
|
for (const nucleus in nuclei) {
|
|
58
58
|
if (nucleus !== key) {
|
|
59
59
|
_nuclei[nucleus] = nuclei[nucleus];
|
|
@@ -13,7 +13,7 @@ const formattingValidation = (obj) => object().shape({
|
|
|
13
13
|
nuclei: object()
|
|
14
14
|
.shape(formattingElementValidation(obj))
|
|
15
15
|
.test('Unique', 'Nuclei need te be unique', function check(nuclei) {
|
|
16
|
-
|
|
16
|
+
const nucleusFrequencies = {};
|
|
17
17
|
for (const key of Object.keys(nuclei)) {
|
|
18
18
|
const _key = nuclei[key].name?.toLowerCase() || '';
|
|
19
19
|
if (_key) {
|
|
@@ -30,7 +30,7 @@ const formattingValidation = (obj) => object().shape({
|
|
|
30
30
|
for (const key in nucleusFrequencies) {
|
|
31
31
|
const { value, fields } = nucleusFrequencies[key];
|
|
32
32
|
if (value > 1) {
|
|
33
|
-
for (
|
|
33
|
+
for (const field of fields) {
|
|
34
34
|
errors.push(new ValidationError(`${key} nucleus must te be unique`, nuclei[key].name, `${this.path}.${field}.name`));
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Integral } from 'nmr-processing';
|
|
3
3
|
import { IntegralPanelInnerProps } from './IntegralPanel';
|
|
4
4
|
interface IntegralTableProps extends Pick<IntegralPanelInnerProps, 'activeTab'> {
|
|
5
|
-
data:
|
|
5
|
+
data: Integral[];
|
|
6
6
|
}
|
|
7
7
|
declare function IntegralTable({ activeTab, data }: IntegralTableProps): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
declare const _default: import("react").MemoExoticComponent<typeof IntegralTable>;
|
|
@@ -84,12 +84,9 @@ function IntegralTable({ activeTab, data }) {
|
|
|
84
84
|
},
|
|
85
85
|
accessor: 'integral',
|
|
86
86
|
Cell: ({ row }) => {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
const flag = checkIntegralKind(row.original);
|
|
91
|
-
integral = flag ? value : `[ ${value} ]`;
|
|
92
|
-
}
|
|
87
|
+
const value = formatNumber(row.original.integral || 0, integralsPreferences.relative.format);
|
|
88
|
+
const flag = checkIntegralKind(row.original);
|
|
89
|
+
const integral = flag ? value : `[ ${value} ]`;
|
|
93
90
|
return (_jsx(EditableColumn, { value: integral, onSave: (event) => saveRelativeHandler(event, row.original), type: "number" }));
|
|
94
91
|
},
|
|
95
92
|
},
|
|
@@ -109,7 +106,7 @@ function IntegralTable({ activeTab, data }) {
|
|
|
109
106
|
saveRelativeHandler,
|
|
110
107
|
]);
|
|
111
108
|
const tableColumns = useMemo(() => {
|
|
112
|
-
|
|
109
|
+
const columns = [...initialColumns];
|
|
113
110
|
for (const col of COLUMNS) {
|
|
114
111
|
const { showWhen, ...colParams } = col;
|
|
115
112
|
if (lodashGet(integralsPreferences, showWhen)) {
|
|
@@ -2,7 +2,7 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { MoleculesView, StateMoleculeExtended } from '../../../data/molecules/Molecule';
|
|
3
3
|
interface MoleculePanelHeaderProps {
|
|
4
4
|
currentIndex: number;
|
|
5
|
-
molecules:
|
|
5
|
+
molecules: StateMoleculeExtended[];
|
|
6
6
|
moleculesView: MoleculesView;
|
|
7
7
|
onMoleculeIndexChange?: (index: number) => void;
|
|
8
8
|
onOpenMoleculeEditor: () => void;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { SvgNmrFt } from 'cheminfo-font';
|
|
3
2
|
import { Molecule as OCLMolecule } from 'openchemlib/full';
|
|
4
3
|
import { useCallback } from 'react';
|
|
5
4
|
import { FaCog, FaCopy, FaDownload, FaFileExport, FaFileImage, FaPaste, FaPlus, FaRegTrashAlt, } from 'react-icons/fa';
|
|
@@ -14,7 +13,7 @@ import ActiveButton from '../../elements/ActiveButton';
|
|
|
14
13
|
import Button from '../../elements/Button';
|
|
15
14
|
import { useAlert } from '../../elements/popup/Alert';
|
|
16
15
|
import AboutPredictionModal from '../../modal/AboutPredictionModal';
|
|
17
|
-
import
|
|
16
|
+
import PredictSpectraModal from '../../modal/PredictSpectraModal';
|
|
18
17
|
import { copyPNGToClipboard, exportAsSVG } from '../../utility/export';
|
|
19
18
|
import PanelHeader from '../header/PanelHeader';
|
|
20
19
|
const styles = {
|
|
@@ -77,7 +76,6 @@ export default function MoleculePanelHeader({ currentIndex, molecules, molecules
|
|
|
77
76
|
const dispatch = useDispatch();
|
|
78
77
|
const assignmentData = useAssignmentData();
|
|
79
78
|
const moleculeKey = molecules?.[currentIndex]?.id;
|
|
80
|
-
const openPredictSpectraModal = usePredictSpectraModal();
|
|
81
79
|
const saveAsSVGHandler = useCallback(() => {
|
|
82
80
|
if (!rootRef)
|
|
83
81
|
return;
|
|
@@ -160,7 +158,7 @@ export default function MoleculePanelHeader({ currentIndex, molecules, molecules
|
|
|
160
158
|
});
|
|
161
159
|
}
|
|
162
160
|
const hasMolecules = molecules && molecules.length > 0;
|
|
163
|
-
return (_jsxs(PanelHeader, { children: [renderSource === 'predictionPanel' && _jsx(AboutPredictionModal, {}), renderSource === 'moleculePanel' && (_jsx(DropdownMenu, { trigger: "click", options: MOL_EXPORT_MENU, onSelect: exportHandler, children: _jsx(Button.BarButton, { as: "div", disabled: !hasMolecules, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Export As", tooltipOrientation: "horizontal", children: _jsx(FaFileExport, {}) }) })), _jsx(Button.BarButton, { onClick: handlePasteMolfileAction, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Paste molfile", tooltipOrientation: "horizontal", children: _jsx(FaPaste, {}) }), _jsx(Button.BarButton, { onClick: onOpenMoleculeEditor, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Add molecule", tooltipOrientation: "horizontal", children: _jsx(FaPlus, {}) }), renderSource === 'moleculePanel' && (_jsxs(_Fragment, { children: [_jsx(Button.BarButton, { onClick: handleDelete, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Delete molecule", tooltipOrientation: "horizontal", disabled: !hasMolecules, children: _jsx(FaRegTrashAlt, {}) }), hasMolecules && (_jsx(
|
|
161
|
+
return (_jsxs(PanelHeader, { children: [renderSource === 'predictionPanel' && _jsx(AboutPredictionModal, {}), renderSource === 'moleculePanel' && (_jsx(DropdownMenu, { trigger: "click", options: MOL_EXPORT_MENU, onSelect: exportHandler, children: _jsx(Button.BarButton, { as: "div", disabled: !hasMolecules, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Export As", tooltipOrientation: "horizontal", children: _jsx(FaFileExport, {}) }) })), _jsx(Button.BarButton, { onClick: handlePasteMolfileAction, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Paste molfile", tooltipOrientation: "horizontal", children: _jsx(FaPaste, {}) }), _jsx(Button.BarButton, { onClick: onOpenMoleculeEditor, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Add molecule", tooltipOrientation: "horizontal", children: _jsx(FaPlus, {}) }), renderSource === 'moleculePanel' && (_jsxs(_Fragment, { children: [_jsx(Button.BarButton, { onClick: handleDelete, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Delete molecule", tooltipOrientation: "horizontal", disabled: !hasMolecules, children: _jsx(FaRegTrashAlt, {}) }), hasMolecules && (_jsx(PredictSpectraModal, { molecule: molecules[currentIndex] }))] })), _jsx(ActiveButton, { value: moleculesView?.[moleculeKey]?.floating.visible || false, popupTitle: "Float molecule", popupPlacement: "left", onClick: floatMoleculeHandler, disabled: !hasMolecules, children: _jsx(IoOpenOutline, {}) }), _jsx(ActiveButton, { style: { marginLeft: '2px' }, value: moleculesView?.[moleculeKey]?.showAtomNumber || false, popupTitle: "Show atom number", popupPlacement: "left", onClick: showAtomNumbersHandler, disabled: !hasMolecules, children: _jsx("p", { style: styles.atomLabel, children: "#" }) }), _jsx("div", { style: { flex: 1 }, children: children }), _jsxs("p", { style: styles.counter, children: [molecules &&
|
|
164
162
|
molecules.length > 0 &&
|
|
165
163
|
`${+(currentIndex + 1)} / ${molecules.length}`, ' '] }), onClickPreferences && (_jsx(Button.BarButton, { color: { base: 'black', hover: 'black' }, onClick: onClickPreferences, toolTip: "Preferences", tooltipOrientation: "vertical", children: _jsx(FaCog, {}) })), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, onReadText: handlePasteMolfile, text: text, label: "Molfile" })] }));
|
|
166
164
|
}
|
|
@@ -23,7 +23,7 @@ export interface AtomData {
|
|
|
23
23
|
*
|
|
24
24
|
*/
|
|
25
25
|
export declare function extractFromAtom(atom: Atom, activeTab: string, axis?: Axis | null): AtomData;
|
|
26
|
-
export declare function findDatumAndSignalIndex(data:
|
|
26
|
+
export declare function findDatumAndSignalIndex(data: Array<Range | Zone>, id: string): {
|
|
27
27
|
datum: Range | Zone | undefined;
|
|
28
28
|
signalIndex: any;
|
|
29
29
|
};
|
|
@@ -41,12 +41,10 @@ export default function useAtomAssignment({ displayerMode, activeTab: nucleus, z
|
|
|
41
41
|
}, [onAtomHoverAction, onAtomHoverHighlights, highlightData]);
|
|
42
42
|
const data = useMemo(() => {
|
|
43
43
|
if (zones || ranges) {
|
|
44
|
-
if (displayerMode === DISPLAYER_MODE.DM_1D && ranges
|
|
44
|
+
if (displayerMode === DISPLAYER_MODE.DM_1D && ranges?.values) {
|
|
45
45
|
return ranges.values;
|
|
46
46
|
}
|
|
47
|
-
else if (displayerMode === DISPLAYER_MODE.DM_2D &&
|
|
48
|
-
zones &&
|
|
49
|
-
zones.values) {
|
|
47
|
+
else if (displayerMode === DISPLAYER_MODE.DM_2D && zones?.values) {
|
|
50
48
|
return zones.values;
|
|
51
49
|
}
|
|
52
50
|
}
|
|
@@ -58,7 +56,7 @@ export default function useAtomAssignment({ displayerMode, activeTab: nucleus, z
|
|
|
58
56
|
y: [],
|
|
59
57
|
};
|
|
60
58
|
const assignment = assignments.data.assignments;
|
|
61
|
-
for (
|
|
59
|
+
for (const id in assignment) {
|
|
62
60
|
if (assignment[id].x) {
|
|
63
61
|
assignedDiaID.x.push(...assignment[id].x);
|
|
64
62
|
}
|
|
@@ -20,6 +20,7 @@ import ZonesPanel from './ZonesPanel/ZonesPanel';
|
|
|
20
20
|
import DatabasePanel from './databasePanel/DatabasePanel';
|
|
21
21
|
import FilterPanel from './filtersPanel/FilterPanel';
|
|
22
22
|
import PredictionPane from './predictionPanel/PredictionPanel';
|
|
23
|
+
import SpectrumSimulation from './spectrumSimulation/SpectrumSimulation';
|
|
23
24
|
const accordionItems = [
|
|
24
25
|
{
|
|
25
26
|
title: 'Spectra',
|
|
@@ -106,6 +107,12 @@ const accordionItems = [
|
|
|
106
107
|
hidePreferenceKey: 'predictionPanel',
|
|
107
108
|
mode: null,
|
|
108
109
|
},
|
|
110
|
+
{
|
|
111
|
+
title: 'Spectrum Simulation',
|
|
112
|
+
component: _jsx(SpectrumSimulation, {}),
|
|
113
|
+
hidePreferenceKey: 'simulationPanel',
|
|
114
|
+
mode: DISPLAYER_MODE.DM_1D,
|
|
115
|
+
},
|
|
109
116
|
];
|
|
110
117
|
export const TOOLS_PANELS_ACCORDION = {
|
|
111
118
|
null: 'Spectra',
|
|
@@ -122,6 +129,12 @@ function usePanelPreferences() {
|
|
|
122
129
|
display: false,
|
|
123
130
|
open: false,
|
|
124
131
|
};
|
|
132
|
+
if (item?.isExperimental && !item.hidePreferenceKey) {
|
|
133
|
+
return {
|
|
134
|
+
display: true,
|
|
135
|
+
open: false,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
125
138
|
return lodashGet(preferences.current, `display.panels.${item.hidePreferenceKey}`, defaultValue);
|
|
126
139
|
}, [preferences]);
|
|
127
140
|
}
|