nmrium 0.41.0 → 0.43.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/ApodizationLine.js +1 -1
- package/lib/component/1d/Chart1D.js +3 -2
- package/lib/component/1d/Line.js +1 -1
- package/lib/component/1d/Viewer1D.js +15 -3
- package/lib/component/1d/integral/IntegralResizable.js +4 -3
- package/lib/component/1d/multiAnalysis/AnalysisRange.js +3 -1
- package/lib/component/1d/peaks/PeakAnnotations.js +20 -25
- package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.d.ts +2 -0
- package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.js +59 -0
- package/lib/component/1d/peaks/PeakEditionManager.d.ts +18 -0
- package/lib/component/1d/peaks/PeakEditionManager.js +98 -0
- package/lib/component/1d/peaks/Peaks.d.ts +1 -0
- package/lib/component/1d/peaks/Peaks.js +22 -0
- package/lib/component/1d/ranges/Range.js +3 -1
- package/lib/component/1d/tool/BaseLineZones.d.ts +1 -1
- package/lib/component/1d/tool/BaseLineZones.js +11 -31
- package/lib/component/1d/utilities/intersectionResolver.d.ts +25 -0
- package/lib/component/1d/utilities/intersectionResolver.js +71 -0
- package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +3 -2
- package/lib/component/1d-2d/components/SpectrumInfoBlock.js +4 -1
- package/lib/component/2d/SlicingView.js +1 -1
- package/lib/component/2d/ft/Contours.js +1 -1
- package/lib/component/EventsTrackers/KeysListenerTracker.d.ts +5 -1
- package/lib/component/EventsTrackers/KeysListenerTracker.js +47 -6
- package/lib/component/assignment/index.d.ts +6 -1
- package/lib/component/assignment/index.js +5 -1
- package/lib/component/context/DispatchContext.d.ts +1 -2
- package/lib/component/context/KeyModifierContext.d.ts +13 -0
- package/lib/component/context/KeyModifierContext.js +39 -0
- package/lib/component/context/PreferencesContext.d.ts +39 -39
- package/lib/component/elements/Button.js +2 -0
- package/lib/component/elements/Input.js +1 -0
- package/lib/component/elements/NumberInput.d.ts +1 -0
- package/lib/component/elements/NumberInput.js +10 -3
- package/lib/component/elements/Scroller.d.ts +15 -0
- package/lib/component/elements/Scroller.js +31 -0
- package/lib/component/elements/formik/FormikOnChange.js +1 -1
- package/lib/component/elements/popup/Modal/ConfirmDialog.js +1 -1
- package/lib/component/header/ApodizationOptionsPanel.js +23 -14
- package/lib/component/header/BaseLineCorrectionPanel.js +31 -10
- package/lib/component/header/Header.d.ts +10 -3
- package/lib/component/header/Header.js +5 -5
- package/lib/component/header/ZeroFillingOptionsPanel.js +37 -31
- package/lib/component/highlight/index.d.ts +1 -0
- package/lib/component/highlight/index.js +1 -0
- package/lib/component/hooks/useActiveSpectrumPeaksViewState.js +1 -0
- package/lib/component/hooks/useCheckToolsVisibility.js +7 -3
- package/lib/component/hooks/useResizerStatus.d.ts +2 -0
- package/lib/component/hooks/useResizerStatus.js +7 -0
- package/lib/component/hooks/useSaveSettings.js +9 -11
- package/lib/component/hooks/useSpectrum.js +1 -1
- package/lib/component/main/ErrorOverlay.js +20 -0
- package/lib/component/main/InnerNMRium.d.ts +7 -0
- package/lib/component/main/InnerNMRium.js +52 -0
- package/lib/component/main/InnerNMRiumContents.d.ts +14 -0
- package/lib/component/main/InnerNMRiumContents.js +89 -0
- package/lib/component/main/NMRium.d.ts +23 -0
- package/lib/component/main/NMRium.js +13 -0
- package/lib/component/main/NMRiumStateProvider.d.ts +9 -0
- package/lib/component/main/NMRiumStateProvider.js +74 -0
- package/lib/component/{SplitPaneWrapper.js → main/SplitPaneWrapper.js} +1 -1
- package/lib/component/main/StateError.d.ts +4 -0
- package/lib/component/main/StateError.js +16 -0
- package/lib/component/main/index.d.ts +3 -0
- package/lib/component/main/index.js +3 -0
- package/lib/component/main/types.d.ts +18 -0
- package/lib/component/main/types.js +2 -0
- package/lib/component/modal/AboutPredictionModal.js +1 -1
- package/lib/component/modal/AboutSpectrumSimulationModal.js +1 -1
- package/lib/component/modal/PredictSpectraModal.js +1 -1
- package/lib/component/modal/changeSum/ChangeSumModal.d.ts +5 -16
- package/lib/component/modal/changeSum/ChangeSumModal.js +6 -115
- package/lib/component/modal/changeSum/ChangeSumModalContents.d.ts +18 -0
- package/lib/component/modal/changeSum/ChangeSumModalContents.js +94 -0
- package/lib/component/modal/setting/GeneralSettings.js +2 -2
- package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.d.ts +1 -1
- package/lib/component/modal/setting/settings-tabs/InfoBlockTabContent.js +9 -2
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +6 -11
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -6
- package/lib/component/panels/MoleculesPanel/Utilities.d.ts +3 -9
- package/lib/component/panels/MoleculesPanel/Utilities.js +14 -10
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts +3 -3
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +4 -4
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +11 -5
- package/lib/component/panels/RangesPanel/RangesHeader.js +6 -10
- package/lib/component/panels/SpectrumsPanel/SpectraPreferences.js +4 -3
- package/lib/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +1 -1
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +4 -3
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +3 -2
- package/lib/component/panels/ZonesPanel/ZonesPreferences.js +1 -1
- package/lib/component/panels/databasePanel/DatabasePanel.js +33 -26
- package/lib/component/panels/header/DefaultPanelHeader.d.ts +3 -4
- package/lib/component/panels/header/DefaultPanelHeader.js +9 -5
- package/lib/component/panels/predictionPanel/PredictionPanel.js +1 -1
- package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +0 -1
- package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +1 -1
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -2
- package/lib/component/reducer/IgnoreActions.js +0 -1
- package/lib/component/reducer/Reducer.d.ts +1 -6
- package/lib/component/reducer/Reducer.js +32 -6
- package/lib/component/reducer/actions/FiltersActions.d.ts +32 -11
- package/lib/component/reducer/actions/FiltersActions.js +96 -28
- package/lib/component/reducer/actions/IntegralsActions.d.ts +6 -2
- package/lib/component/reducer/actions/IntegralsActions.js +44 -20
- package/lib/component/reducer/actions/MoleculeActions.d.ts +6 -2
- package/lib/component/reducer/actions/MoleculeActions.js +8 -2
- package/lib/component/reducer/actions/PeaksActions.d.ts +6 -4
- package/lib/component/reducer/actions/PeaksActions.js +19 -1
- package/lib/component/reducer/actions/RangesActions.d.ts +6 -2
- package/lib/component/reducer/actions/RangesActions.js +31 -3
- package/lib/component/reducer/preferences/actions/addWorkspace.js +19 -15
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
- package/lib/component/reducer/preferences/utilities/getPreferencesByWorkspace.d.ts +1 -1
- package/lib/component/toolbar/FunctionToolBar.js +13 -3
- package/lib/component/toolbar/ToolTypes.d.ts +1 -0
- package/lib/component/toolbar/ToolTypes.js +36 -0
- package/lib/component/utility/PathBuilder.js +11 -0
- package/lib/component/utility/export.js +7 -4
- package/lib/component/utility/filterType.d.ts +3 -0
- package/lib/component/utility/filterType.js +1 -0
- package/lib/component/workspaces/basic.js +2 -0
- package/lib/component/workspaces/embedded.js +2 -0
- package/lib/component/workspaces/exercise.js +2 -0
- package/lib/component/workspaces/prediction.js +9 -0
- package/lib/component/workspaces/process1D.js +2 -0
- package/lib/component/workspaces/workspaceDefaultProperties.js +10 -5
- package/lib/data/PredictionManager.d.ts +3 -3
- package/lib/data/PredictionManager.js +10 -10
- package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +1 -2
- package/lib/data/data1d/Spectrum1D/ranges/addRange.js +2 -8
- package/lib/data/data1d/database.d.ts +4 -2
- package/lib/data/data1d/database.js +10 -3
- package/lib/data/molecules/Molecule.js +2 -2
- package/lib/data/molecules/MoleculeManager.d.ts +1 -0
- package/lib/data/molecules/MoleculeManager.js +14 -0
- package/lib/data/utilities/checkModifierKeyActivated.d.ts +1 -1
- package/lib/data/utilities/checkModifierKeyActivated.js +8 -13
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/ApodizationLine.js +1 -1
- package/lib-cjs/component/1d/Chart1D.js +3 -2
- package/lib-cjs/component/1d/Line.js +1 -1
- package/lib-cjs/component/1d/Viewer1D.js +15 -3
- package/lib-cjs/component/1d/integral/IntegralResizable.js +4 -3
- package/lib-cjs/component/1d/multiAnalysis/AnalysisRange.js +3 -1
- package/lib-cjs/component/1d/peaks/PeakAnnotations.js +19 -24
- package/lib-cjs/component/1d/peaks/PeakAnnotationsSpreadMode.js +64 -0
- package/lib-cjs/component/1d/peaks/PeakEditionManager.js +129 -0
- package/lib-cjs/component/1d/peaks/Peaks.js +29 -0
- package/lib-cjs/component/1d/ranges/Range.js +3 -1
- package/lib-cjs/component/1d/tool/BaseLineZones.js +11 -34
- package/lib-cjs/component/1d/utilities/intersectionResolver.js +75 -0
- package/lib-cjs/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +3 -2
- package/lib-cjs/component/1d-2d/components/SpectrumInfoBlock.js +4 -1
- package/lib-cjs/component/2d/SlicingView.js +1 -1
- package/lib-cjs/component/2d/ft/Contours.js +1 -1
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +46 -5
- package/lib-cjs/component/assignment/index.js +5 -1
- package/lib-cjs/component/context/KeyModifierContext.js +44 -0
- package/lib-cjs/component/elements/Button.js +2 -0
- package/lib-cjs/component/elements/Input.js +1 -0
- package/lib-cjs/component/elements/NumberInput.js +12 -2
- package/lib-cjs/component/elements/Scroller.js +35 -0
- package/lib-cjs/component/elements/formik/FormikOnChange.js +1 -1
- package/lib-cjs/component/elements/popup/Modal/ConfirmDialog.js +1 -1
- package/lib-cjs/component/header/ApodizationOptionsPanel.js +23 -14
- package/lib-cjs/component/header/BaseLineCorrectionPanel.js +30 -9
- package/lib-cjs/component/header/Header.js +5 -5
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +35 -29
- package/lib-cjs/component/highlight/index.js +1 -0
- package/lib-cjs/component/hooks/useActiveSpectrumPeaksViewState.js +1 -0
- package/lib-cjs/component/hooks/useCheckToolsVisibility.js +7 -3
- package/lib-cjs/component/hooks/useResizerStatus.js +11 -0
- package/lib-cjs/component/hooks/useSaveSettings.js +9 -11
- package/lib-cjs/component/hooks/useSpectrum.js +1 -1
- package/lib-cjs/component/main/ErrorOverlay.js +26 -0
- package/lib-cjs/component/main/InnerNMRium.js +82 -0
- package/lib-cjs/component/main/InnerNMRiumContents.js +96 -0
- package/lib-cjs/component/main/NMRium.js +19 -0
- package/lib-cjs/component/main/NMRiumStateProvider.js +80 -0
- package/lib-cjs/component/{SplitPaneWrapper.js → main/SplitPaneWrapper.js} +1 -1
- package/lib-cjs/component/main/StateError.js +20 -0
- package/lib-cjs/component/main/index.js +21 -0
- package/lib-cjs/component/main/types.js +3 -0
- package/lib-cjs/component/modal/AboutPredictionModal.js +1 -1
- package/lib-cjs/component/modal/AboutSpectrumSimulationModal.js +1 -1
- package/lib-cjs/component/modal/PredictSpectraModal.js +1 -1
- package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +6 -141
- package/lib-cjs/component/modal/changeSum/ChangeSumModalContents.js +124 -0
- package/lib-cjs/component/modal/setting/GeneralSettings.js +2 -2
- package/lib-cjs/component/modal/setting/settings-tabs/InfoBlockTabContent.js +9 -2
- package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +29 -11
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -6
- package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +14 -10
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +4 -4
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +32 -3
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +29 -10
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPreferences.js +3 -2
- package/lib-cjs/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +1 -1
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +27 -3
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +26 -2
- package/lib-cjs/component/panels/ZonesPanel/ZonesPreferences.js +1 -1
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +33 -26
- package/lib-cjs/component/panels/header/DefaultPanelHeader.js +11 -5
- package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +1 -1
- package/lib-cjs/component/panels/predictionPanel/PredictionSimpleOptions.js +0 -1
- package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulation.js +1 -1
- package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -2
- package/lib-cjs/component/reducer/IgnoreActions.js +0 -1
- package/lib-cjs/component/reducer/Reducer.js +31 -5
- package/lib-cjs/component/reducer/actions/FiltersActions.js +98 -28
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +45 -20
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +9 -2
- package/lib-cjs/component/reducer/actions/PeaksActions.js +20 -1
- package/lib-cjs/component/reducer/actions/RangesActions.js +31 -2
- package/lib-cjs/component/reducer/preferences/actions/addWorkspace.js +19 -15
- package/lib-cjs/component/toolbar/FunctionToolBar.js +13 -3
- package/lib-cjs/component/toolbar/ToolTypes.js +36 -0
- package/lib-cjs/component/utility/PathBuilder.js +11 -0
- package/lib-cjs/component/utility/export.js +7 -4
- package/lib-cjs/component/utility/filterType.js +2 -0
- package/lib-cjs/component/workspaces/basic.js +2 -0
- package/lib-cjs/component/workspaces/embedded.js +2 -0
- package/lib-cjs/component/workspaces/exercise.js +2 -0
- package/lib-cjs/component/workspaces/prediction.js +9 -0
- package/lib-cjs/component/workspaces/process1D.js +2 -0
- package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +10 -5
- package/lib-cjs/data/PredictionManager.js +9 -9
- package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +1 -7
- package/lib-cjs/data/data1d/database.js +10 -3
- package/lib-cjs/data/molecules/Molecule.js +2 -2
- package/lib-cjs/data/molecules/MoleculeManager.js +16 -1
- package/lib-cjs/data/utilities/checkModifierKeyActivated.js +8 -13
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +26 -25
- package/lib/component/1d/peaks/PeakAnnotation.d.ts +0 -12
- package/lib/component/1d/peaks/PeakAnnotation.js +0 -116
- package/lib/component/ErrorOverlay.js +0 -27
- package/lib/component/NMRium.d.ts +0 -42
- package/lib/component/NMRium.js +0 -237
- package/lib/component/reducer/actions/GlobalActions.d.ts +0 -9
- package/lib/component/reducer/actions/GlobalActions.js +0 -4
- package/lib-cjs/component/1d/peaks/PeakAnnotation.js +0 -118
- package/lib-cjs/component/ErrorOverlay.js +0 -30
- package/lib-cjs/component/NMRium.js +0 -267
- package/lib-cjs/component/reducer/actions/GlobalActions.js +0 -7
- /package/lib/component/{ErrorOverlay.d.ts → main/ErrorOverlay.d.ts} +0 -0
- /package/lib/component/{SplitPaneWrapper.d.ts → main/SplitPaneWrapper.d.ts} +0 -0
|
@@ -18,7 +18,7 @@ import { usePanelPreferences } from '../../hooks/usePanelPreferences';
|
|
|
18
18
|
import CopyClipboardModal from '../../modal/CopyClipboardModal';
|
|
19
19
|
import ChangeSumModal from '../../modal/changeSum/ChangeSumModal';
|
|
20
20
|
import { getNumberOfDecimals } from '../../utility/formatNumber';
|
|
21
|
-
import DefaultPanelHeader from '../header/DefaultPanelHeader';
|
|
21
|
+
import DefaultPanelHeader, { createFilterLabel, } from '../header/DefaultPanelHeader';
|
|
22
22
|
const style = css `
|
|
23
23
|
.btn {
|
|
24
24
|
background-color: transparent;
|
|
@@ -48,11 +48,6 @@ function RangesHeader({ id, ranges, info, onUnlink, onFilterActivated, onSetting
|
|
|
48
48
|
dispatch({ type: 'CHANGE_RANGE_SUM', payload: { options } });
|
|
49
49
|
modal.close();
|
|
50
50
|
}
|
|
51
|
-
function showChangeRangesSumModal() {
|
|
52
|
-
modal.show(_jsx(ChangeSumModal, { onClose: () => modal.close(), onSave: changeRangesSumHandler, header: currentSum
|
|
53
|
-
? `Set new Ranges Sum (Current: ${Number(currentSum).toFixed(2)})`
|
|
54
|
-
: 'Set new Ranges Sum', sumOptions: ranges?.options }));
|
|
55
|
-
}
|
|
56
51
|
function removeAssignments() {
|
|
57
52
|
onUnlink();
|
|
58
53
|
}
|
|
@@ -112,10 +107,11 @@ function RangesHeader({ id, ranges, info, onUnlink, onFilterActivated, onSetting
|
|
|
112
107
|
});
|
|
113
108
|
}
|
|
114
109
|
const hasRanges = Array.isArray(ranges?.values) && ranges.values.length > 0;
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
110
|
+
const counter = ranges?.values?.length || 0;
|
|
111
|
+
return (_jsxs("div", { css: style, children: [_jsxs(DefaultPanelHeader, { counter: counter, counterLabel: createFilterLabel(counter, isFilterActive && filterCounter), onDelete: handleDeleteAll, deleteToolTip: "Delete All Ranges", onFilter: onFilterActivated, filterToolTip: isFilterActive ? 'Show all ranges' : 'Hide ranges out of view', showSettingButton: true, onSettingClick: onSettingClick, children: [_jsx(Button, { popupTitle: "Preview publication string", popupPlacement: "right", onClick: saveAsHTMLHandler, className: "btn preview-publication-icon", disabled: !hasRanges, children: _jsx(FaFileExport, {}) }), _jsx(ChangeSumModal, { onSave: changeRangesSumHandler, sumType: "ranges", currentSum: currentSum, sumOptions: ranges?.options, renderButton: (onClick) => (_jsx(Button, { popupTitle: currentSum
|
|
112
|
+
? `Change ranges sum (${currentSum.toFixed(2)})`
|
|
113
|
+
: 'Change ranges sum', popupPlacement: "right", className: "btn icon", onClick: onClick, children: _jsx(SvgNmrSum, {}) })) }), _jsx(Button, { popupTitle: "Remove all assignments", popupPlacement: "right", onClick: handleOnRemoveAssignments, disabled: !hasRanges, className: "btn icon", children: _jsx(FaUnlink, {}) }), _jsx(ActiveButton, { popupTitle: showMultiplicityTrees
|
|
118
114
|
? 'Hide multiplicity trees in spectrum'
|
|
119
|
-
: 'Show multiplicity trees in spectrum', popupPlacement: "right", onClick: handleSetShowMultiplicityTrees, value: showMultiplicityTrees, disabled: !hasRanges, children: _jsx(FaSitemap, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), _jsx(ActiveButton, { popupTitle: showJGraph ? 'Hide J Graph' : 'Show J Graph', popupPlacement: "right", onClick: handleShowJGraph, value: showJGraph, disabled: !hasRanges, children: _jsx(FaChartBar, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), _jsx(ActiveButton, { popupTitle: showRangesIntegrals ? 'Hide integrals' : 'Show integrals', popupPlacement: "right", onClick: handleShowIntegrals, value: showRangesIntegrals, disabled: !hasRanges, children: _jsx(SvgNmrIntegrate, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), _jsx(ActiveButton, { className: "icon", popupTitle: "
|
|
115
|
+
: 'Show multiplicity trees in spectrum', popupPlacement: "right", onClick: handleSetShowMultiplicityTrees, value: showMultiplicityTrees, disabled: !hasRanges, children: _jsx(FaSitemap, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), _jsx(ActiveButton, { popupTitle: showJGraph ? 'Hide J Graph' : 'Show J Graph', popupPlacement: "right", onClick: handleShowJGraph, value: showJGraph, disabled: !hasRanges, children: _jsx(FaChartBar, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), _jsx(ActiveButton, { popupTitle: showRangesIntegrals ? 'Hide integrals' : 'Show integrals', popupPlacement: "right", onClick: handleShowIntegrals, value: showRangesIntegrals, disabled: !hasRanges, children: _jsx(SvgNmrIntegrate, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), _jsx(ActiveButton, { className: "icon", popupTitle: "Fixed integration sum", popupPlacement: "right", onClick: changeSumConstantFlagHandler, value: ranges?.options?.isSumConstant, children: _jsx(ImLink, {}) })] }), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, text: text, label: "Preview publication string" })] }));
|
|
120
116
|
}
|
|
121
117
|
export default RangesHeader;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Formik } from 'formik';
|
|
3
3
|
import { useImperativeHandle, useRef, memo, forwardRef, useCallback, useMemo, } from 'react';
|
|
4
4
|
import { useChartData } from '../../context/ChartContext';
|
|
5
5
|
import { usePreferences } from '../../context/PreferencesContext';
|
|
6
|
+
import { Scroller } from '../../elements/Scroller';
|
|
6
7
|
import useNucleus from '../../hooks/useNucleus';
|
|
7
8
|
import { usePanelPreferencesByNuclei } from '../../hooks/usePanelPreferences';
|
|
8
9
|
import { convertPathArrayToString } from '../../utility/convertPathArrayToString';
|
|
@@ -12,7 +13,7 @@ import { PreferencesContainer } from '../extra/preferences/PreferencesContainer'
|
|
|
12
13
|
import { SpectraColumnsManager } from './base/SpectraColumnsManager';
|
|
13
14
|
function SpectraPreferences(props, ref) {
|
|
14
15
|
const formRef = useRef(null);
|
|
15
|
-
const { data } = useChartData();
|
|
16
|
+
const { data, view: { spectra: { activeTab }, }, } = useChartData();
|
|
16
17
|
const preferences = usePreferences();
|
|
17
18
|
const nuclei = useNucleus();
|
|
18
19
|
const preferencesByNuclei = usePanelPreferencesByNuclei('spectra', nuclei);
|
|
@@ -67,6 +68,6 @@ function SpectraPreferences(props, ref) {
|
|
|
67
68
|
}, []);
|
|
68
69
|
const mapOnChangeValueHandler = useCallback((key) => paths[key], [paths]);
|
|
69
70
|
const mapValue = useCallback((value) => convertPathArrayToString(value), []);
|
|
70
|
-
return (_jsx(PreferencesContainer, { children: _jsx(Formik, { innerRef: formRef, onSubmit: saveHandler, initialValues: preferencesByNuclei, children: _jsx(
|
|
71
|
+
return (_jsx(PreferencesContainer, { children: _jsx(Formik, { innerRef: formRef, onSubmit: saveHandler, initialValues: preferencesByNuclei, children: _jsx(Scroller, { scrollTo: activeTab, children: nuclei?.map((n) => (_jsx(Scroller.Item, { elementKey: n, children: _jsx(NucleusGroup, { nucleus: n, children: _jsx(SpectraColumnsManager, { nucleus: n, onAdd: handleAdd, onDelete: handleDelete, mapOnChangeValue: mapOnChangeValueHandler, mapValue: mapValue, datalist: datalist }) }) }, n))) }) }) }));
|
|
71
72
|
}
|
|
72
73
|
export default memo(forwardRef(SpectraPreferences));
|
|
@@ -28,7 +28,7 @@ function DisplayButtons1D(props) {
|
|
|
28
28
|
return null;
|
|
29
29
|
}
|
|
30
30
|
const display = data.display;
|
|
31
|
-
return (_jsx("button", { "data-
|
|
31
|
+
return (_jsx("button", { "data-testid": "hide-show-spectrum-button", style: buttonStyle, type: "button", onClick: (e) => {
|
|
32
32
|
e.stopPropagation();
|
|
33
33
|
onChangeVisibility(data, 'isVisible');
|
|
34
34
|
}, children: _jsx(FaEye, { style: {
|
|
@@ -12,7 +12,7 @@ import Select from '../../elements/Select';
|
|
|
12
12
|
import ToolTip from '../../elements/ToolTip/ToolTip';
|
|
13
13
|
import { useModal } from '../../elements/popup/Modal';
|
|
14
14
|
import { DISPLAYER_MODE } from '../../reducer/core/Constants';
|
|
15
|
-
import DefaultPanelHeader from '../header/DefaultPanelHeader';
|
|
15
|
+
import DefaultPanelHeader, { createFilterLabel, } from '../header/DefaultPanelHeader';
|
|
16
16
|
import CorrelationTable from './CorrelationTable/CorrelationTable';
|
|
17
17
|
import Overview from './Overview';
|
|
18
18
|
import SetMolecularFormulaModal from './SetMolecularFormulaModal';
|
|
@@ -309,9 +309,10 @@ function SummaryPanel() {
|
|
|
309
309
|
const handleOnFilter = useCallback(() => {
|
|
310
310
|
setFilterIsActive(!filterIsActive);
|
|
311
311
|
}, [filterIsActive]);
|
|
312
|
-
|
|
312
|
+
const counter = correlationsData ? correlationsData.values.length : 0;
|
|
313
|
+
return (_jsxs("div", { css: panelStyle, children: [_jsxs(DefaultPanelHeader, { canDelete: false, counter: counter, counterLabel: createFilterLabel(counter, filterIsActive && filteredCorrelationsData?.values.length), onFilter: handleOnFilter, filterToolTip: filterIsActive
|
|
313
314
|
? 'Show all correlations'
|
|
314
|
-
: 'Hide correlations out of view',
|
|
315
|
+
: 'Hide correlations out of view', children: [_jsx(ToolTip, { title: `Set molecular formula (${correlationsData.options.mf})`, popupPlacement: "right", children: _jsx("button", { type: "button", onClick: showSetMolecularFormulaModal, children: _jsx(FaFlask, {}) }) }), _jsx(ToolTip, { title: `Set shift tolerance`, popupPlacement: "right", children: _jsx("button", { type: "button", onClick: showSetShiftToleranceModal, children: _jsx(FaSlidersH, {}) }) }), _jsxs("div", { className: "extra-header-content", children: [_jsx("div", { className: "overview-container", children: _jsx(Overview, { correlationsData: correlationsData }) }), _jsx("div", { className: "table-view-selection", children: _jsxs("span", { children: [_jsx("label", { children: "View:" }), _jsx(Select, { onChange: (selection) => {
|
|
315
316
|
setSelectedAdditionalColumnsAtomType(selection);
|
|
316
317
|
if (selection === 'H-H') {
|
|
317
318
|
setShowProtonsAsRows(true);
|
|
@@ -13,7 +13,7 @@ import useSpectrum from '../../hooks/useSpectrum';
|
|
|
13
13
|
import { zoneStateInit } from '../../reducer/Reducer';
|
|
14
14
|
import { tablePanelStyle } from '../extra/BasicPanelStyle';
|
|
15
15
|
import NoTableData from '../extra/placeholder/NoTableData';
|
|
16
|
-
import DefaultPanelHeader from '../header/DefaultPanelHeader';
|
|
16
|
+
import DefaultPanelHeader, { createFilterLabel, } from '../header/DefaultPanelHeader';
|
|
17
17
|
import PreferencesHeader from '../header/PreferencesHeader';
|
|
18
18
|
import ZonesPreferences from './ZonesPreferences';
|
|
19
19
|
import ZonesTable from './ZonesTable';
|
|
@@ -131,6 +131,7 @@ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, experiment, showZ
|
|
|
131
131
|
const handleSetShowPeaks = () => {
|
|
132
132
|
dispatch({ type: 'SHOW_ZONES_PEAKS', payload: { id } });
|
|
133
133
|
};
|
|
134
|
+
const counter = zones?.values?.length || 0;
|
|
134
135
|
return (_jsxs("div", { css: [
|
|
135
136
|
tablePanelStyle,
|
|
136
137
|
style,
|
|
@@ -140,7 +141,7 @@ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, experiment, showZ
|
|
|
140
141
|
position: relative;
|
|
141
142
|
}
|
|
142
143
|
`,
|
|
143
|
-
], children: [!isFlipped && (_jsxs(DefaultPanelHeader, { counter:
|
|
144
|
+
], children: [!isFlipped && (_jsxs(DefaultPanelHeader, { counter: counter, counterLabel: createFilterLabel(counter, filterIsActive && tableData?.length), onDelete: handleDeleteAll, deleteToolTip: "Delete All Zones", onFilter: handleOnFilter, filterToolTip: filterIsActive ? 'Show all zones' : 'Hide zones out of view', showSettingButton: true, onSettingClick: settingsPanelHandler, children: [_jsx(ToolTip, { title: `Remove all assignments`, popupPlacement: "right", children: _jsx("button", { className: "remove-assignments-btn", type: "button", onClick: handleOnRemoveAssignments, disabled: !zones.values || zones.values.length === 0, children: _jsx(FaUnlink, {}) }) }), _jsx(ActiveButton, { popupTitle: "Show/Hide zones", popupPlacement: "right", value: showZones, onClick: handleSetShowZones, children: _jsx("span", { style: { fontSize: '12px', pointerEvents: 'none' }, children: "z" }) }), _jsx(ActiveButton, { popupTitle: "Show/Hide signals", popupPlacement: "right", value: showSignals, onClick: handleSetShowSignals, children: _jsx("span", { style: { fontSize: '12px', pointerEvents: 'none' }, children: "s" }) }), _jsx(ActiveButton, { popupTitle: "Show/Hide peaks", popupPlacement: "right", value: showPeaks, onClick: handleSetShowPeaks, children: _jsx("span", { style: { fontSize: '12px', pointerEvents: 'none' }, children: "p" }) })] })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (_jsx("div", { className: "table-container", children: tableData && tableData.length > 0 ? (_jsx(ZonesTable, { tableData: tableData, onUnlink: unlinkZoneHandler, nuclei: activeTab && activeTab.split(',').length === 2
|
|
144
145
|
? activeTab.split(',')
|
|
145
146
|
: ['?', '?'], experiment: experiment })) : (_jsx(NoTableData, {})) })) : (_jsx(ZonesPreferences, { ref: settingRef })) })] }));
|
|
146
147
|
}
|
|
@@ -23,7 +23,7 @@ function ZonesPreferences(props, ref) {
|
|
|
23
23
|
const nuclei = useMemo(() => getUniqueNuclei(nucleus), [nucleus]);
|
|
24
24
|
const zonesPreferences = usePanelPreferencesByNuclei('zones', nuclei);
|
|
25
25
|
useEffect(() => {
|
|
26
|
-
formRef.current?.setValues(zonesPreferences);
|
|
26
|
+
void formRef.current?.setValues(zonesPreferences);
|
|
27
27
|
}, [zonesPreferences]);
|
|
28
28
|
const saveHandler = useCallback((values) => {
|
|
29
29
|
preferences.dispatch({
|
|
@@ -40,6 +40,13 @@ const emptyKeywords = {
|
|
|
40
40
|
solvent: '-1',
|
|
41
41
|
searchKeywords: '',
|
|
42
42
|
};
|
|
43
|
+
function mapKeywordsToArray(searchKeywords, solvent) {
|
|
44
|
+
const values = searchKeywords ? searchKeywords.split(' ') : [];
|
|
45
|
+
if (solvent !== '-1') {
|
|
46
|
+
values.unshift(`solvent:${solvent}`);
|
|
47
|
+
}
|
|
48
|
+
return values;
|
|
49
|
+
}
|
|
43
50
|
function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase, }) {
|
|
44
51
|
const dispatch = useDispatch();
|
|
45
52
|
const alert = useAlert();
|
|
@@ -77,28 +84,34 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
|
|
|
77
84
|
}));
|
|
78
85
|
}
|
|
79
86
|
}, []);
|
|
87
|
+
const search = useCallback((solvents) => {
|
|
88
|
+
const { solvent, searchKeywords } = keywords;
|
|
89
|
+
if (databaseInstance.current) {
|
|
90
|
+
const keywords = mapKeywordsToArray(searchKeywords, solvent);
|
|
91
|
+
const data = databaseInstance.current.search({ keywords, idCode });
|
|
92
|
+
setResult((prevResult) => ({
|
|
93
|
+
...prevResult,
|
|
94
|
+
data,
|
|
95
|
+
...(solvents && { solvents }),
|
|
96
|
+
}));
|
|
97
|
+
}
|
|
98
|
+
}, [idCode, keywords]);
|
|
80
99
|
useEffect(() => {
|
|
81
100
|
const { solvent, searchKeywords } = keywords;
|
|
82
101
|
setTimeout(async () => {
|
|
83
102
|
if (databaseInstance.current) {
|
|
84
103
|
const hideLoading = await alert.showLoading(`Preparing of the Result`);
|
|
85
104
|
if (solvent === '-1' && !searchKeywords) {
|
|
86
|
-
const data = databaseInstance.current.data;
|
|
87
105
|
const solvents = mapSolventsToSelect(databaseInstance.current.getSolvents());
|
|
88
|
-
|
|
106
|
+
search(solvents);
|
|
89
107
|
}
|
|
90
108
|
else {
|
|
91
|
-
|
|
92
|
-
if (solvent !== '-1') {
|
|
93
|
-
values.unshift(`solvent:${solvent}`);
|
|
94
|
-
}
|
|
95
|
-
const data = databaseInstance.current.search(values.join(' '));
|
|
96
|
-
setResult((prevResult) => ({ ...prevResult, data }));
|
|
109
|
+
search();
|
|
97
110
|
}
|
|
98
111
|
hideLoading();
|
|
99
112
|
}
|
|
100
113
|
}, 0);
|
|
101
|
-
}, [alert, keywords]);
|
|
114
|
+
}, [alert, idCode, keywords, search]);
|
|
102
115
|
useEffect(() => {
|
|
103
116
|
function handle(event) {
|
|
104
117
|
if (selectedTool === options.databaseRangesSelection.id) {
|
|
@@ -120,6 +133,16 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
|
|
|
120
133
|
Events.off('brushEnd', handle);
|
|
121
134
|
};
|
|
122
135
|
}, [format, selectedTool]);
|
|
136
|
+
useEffect(() => {
|
|
137
|
+
setTimeout(async () => {
|
|
138
|
+
if (databaseInstance.current) {
|
|
139
|
+
const hideLoading = await alert.showLoading(`Loading the database`);
|
|
140
|
+
databaseInstance.current = initiateDatabase(databaseDataRef.current, nucleus);
|
|
141
|
+
hideLoading();
|
|
142
|
+
setKeywords({ ...emptyKeywords });
|
|
143
|
+
}
|
|
144
|
+
}, 0);
|
|
145
|
+
}, [alert, nucleus]);
|
|
123
146
|
const handleChangeDatabase = useCallback((databaseKey) => {
|
|
124
147
|
const database = databases.find((item) => item.key === databaseKey);
|
|
125
148
|
setTimeout(async () => {
|
|
@@ -151,16 +174,6 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
|
|
|
151
174
|
hideLoading();
|
|
152
175
|
}, 0);
|
|
153
176
|
}, [alert, databases, nucleus]);
|
|
154
|
-
useEffect(() => {
|
|
155
|
-
setTimeout(async () => {
|
|
156
|
-
if (databaseInstance.current) {
|
|
157
|
-
const hideLoading = await alert.showLoading(`Loading the database`);
|
|
158
|
-
databaseInstance.current = initiateDatabase(databaseDataRef.current, nucleus);
|
|
159
|
-
hideLoading();
|
|
160
|
-
setKeywords({ ...emptyKeywords });
|
|
161
|
-
}
|
|
162
|
-
}, 0);
|
|
163
|
-
}, [alert, nucleus]);
|
|
164
177
|
useEffect(() => {
|
|
165
178
|
if (item?.isOpen && defaultDatabase && !databaseInstance.current) {
|
|
166
179
|
handleChangeDatabase(defaultDatabase);
|
|
@@ -231,13 +244,7 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
|
|
|
231
244
|
handleChangeOption(tool);
|
|
232
245
|
}, [handleChangeOption]);
|
|
233
246
|
const searchByStructureHandler = (idCodeValue) => {
|
|
234
|
-
|
|
235
|
-
const hideLoading = await alert.showLoading(`Searching in progress...`);
|
|
236
|
-
const data = databaseInstance.current?.searchByStructure(idCodeValue) || [];
|
|
237
|
-
setResult((prevResult) => ({ ...prevResult, data }));
|
|
238
|
-
setIdCode(idCodeValue);
|
|
239
|
-
hideLoading();
|
|
240
|
-
}, 0);
|
|
247
|
+
setIdCode(idCodeValue);
|
|
241
248
|
};
|
|
242
249
|
const openSearchByStructure = () => {
|
|
243
250
|
modal.show(_jsx(DatabaseStructureSearchModal, { onChange: searchByStructureHandler, idCode: idCode }), {
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
interface DefaultPanelHeaderProps {
|
|
3
3
|
counter?: number;
|
|
4
|
-
|
|
4
|
+
counterLabel?: string;
|
|
5
5
|
deleteToolTip?: string;
|
|
6
6
|
filterToolTip?: string;
|
|
7
7
|
onDelete?: () => void;
|
|
8
8
|
onFilter?: () => void;
|
|
9
9
|
onSettingClick?: () => void;
|
|
10
|
-
filterIsActive?: boolean;
|
|
11
10
|
canDelete?: boolean;
|
|
12
11
|
disableDelete?: boolean;
|
|
13
12
|
showSettingButton?: boolean;
|
|
14
|
-
showCounter?: boolean;
|
|
15
13
|
children?: ReactNode;
|
|
16
14
|
style?: CSSProperties;
|
|
17
15
|
className?: string;
|
|
18
16
|
renderRightButtons?: () => ReactNode;
|
|
19
17
|
}
|
|
20
|
-
declare function
|
|
18
|
+
export declare function createFilterLabel(total: number, counter: number | false): string;
|
|
19
|
+
declare function DefaultPanelHeader({ counter, counterLabel, onDelete, deleteToolTip, onFilter, filterToolTip, children, onSettingClick, showSettingButton, canDelete, disableDelete, style, className, renderRightButtons, }: DefaultPanelHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
21
20
|
export default DefaultPanelHeader;
|
|
@@ -14,13 +14,17 @@ const styles = {
|
|
|
14
14
|
margin: 0,
|
|
15
15
|
textAlign: 'right',
|
|
16
16
|
lineHeight: '22px',
|
|
17
|
-
padding: '0
|
|
17
|
+
padding: '0 5px',
|
|
18
18
|
whiteSpace: 'nowrap',
|
|
19
19
|
},
|
|
20
20
|
};
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
export function createFilterLabel(total, counter) {
|
|
22
|
+
if (typeof counter === 'boolean') {
|
|
23
|
+
return `[ ${total || 0} ]`;
|
|
24
|
+
}
|
|
25
|
+
return `[ ${counter}/${total} ]`;
|
|
26
|
+
}
|
|
27
|
+
function DefaultPanelHeader({ counter, counterLabel, onDelete = () => null, deleteToolTip = 'Delete', onFilter = () => null, filterToolTip = '', children, onSettingClick = () => null, showSettingButton = false, canDelete = true, disableDelete = false, style = {}, className = '', renderRightButtons, }) {
|
|
28
|
+
return (_jsxs(PanelHeader, { style, className, children: [_jsxs("div", { style: styles.leftContainer, children: [canDelete && (_jsx(Button.BarButton, { color: { base: 'black', hover: 'red' }, onClick: onDelete, disabled: counter === 0 || disableDelete, toolTip: deleteToolTip, tooltipOrientation: "horizontal", children: _jsx(FaRegTrashAlt, {}) })), filterToolTip ? (_jsx(ToggleButton, { popupTitle: filterToolTip, popupPlacement: "right", onClick: onFilter, children: _jsx(FaFilter, { style: { pointerEvents: 'none', fontSize: '12px' } }) })) : null, children] }), renderRightButtons?.(), counterLabel && _jsx("p", { style: styles.counterLabel, children: counterLabel }), showSettingButton && (_jsx(ToolTip, { title: "Preferences", popupPlacement: "left", children: _jsx("button", { type: "button", onClick: onSettingClick, children: _jsx(FaCog, {}) }) }))] }));
|
|
25
29
|
}
|
|
26
30
|
export default DefaultPanelHeader;
|
|
@@ -72,7 +72,7 @@ export default function PredictionPanel() {
|
|
|
72
72
|
}
|
|
73
73
|
const hideLoading = await alert.showLoading(`Predict ${predictedSpectra.join(',')} in progress`);
|
|
74
74
|
try {
|
|
75
|
-
const data = await predictSpectra(molfile);
|
|
75
|
+
const data = await predictSpectra(molfile, predictionPreferences.spectra);
|
|
76
76
|
dispatch({
|
|
77
77
|
type: 'PREDICT_SPECTRA',
|
|
78
78
|
payload: {
|
|
@@ -37,7 +37,6 @@ function PredictionSimpleOptions() {
|
|
|
37
37
|
display: 'flex',
|
|
38
38
|
justifyContent: 'flex-end',
|
|
39
39
|
flex: '1',
|
|
40
|
-
padding: '0 10px',
|
|
41
40
|
height: '100%',
|
|
42
41
|
}, children: [_jsx(Label, { title: "Frequency", style: labelStyle, children: _jsx(FormikSelect, { items: FREQUENCIES, style: selectStyles, name: "frequency" }) }), _jsxs(Label, { title: "Line Width", style: labelStyle, children: [_jsx(FormikNumberInput, { name: "1d.lineWidth", type: "number", style: { margin: 0, width: '40px' } }), _jsx("span", { style: { padding: '0 5px' }, children: "Hz" })] }), _jsx(FormikOnChange, { enableValidation: true, onChange: optionsChangeHandler })] }) }));
|
|
43
42
|
}
|
|
@@ -64,7 +64,7 @@ export default function SpectrumSimulation() {
|
|
|
64
64
|
}
|
|
65
65
|
function saveSettingsHandler(values) {
|
|
66
66
|
simulateHandler(values);
|
|
67
|
-
formRef.current?.setValues(values);
|
|
67
|
+
void formRef.current?.setValues(values);
|
|
68
68
|
}
|
|
69
69
|
return (_jsx(Formik, { initialValues: { ...defaultSimulationOptions, data }, enableReinitialize: true,
|
|
70
70
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
@@ -20,6 +20,5 @@ export default function SpectrumSimulationSimpleOptions({ onSpinSystemChange, sp
|
|
|
20
20
|
display: 'flex',
|
|
21
21
|
justifyContent: 'flex-end',
|
|
22
22
|
flex: '1',
|
|
23
|
-
|
|
24
|
-
}, children: [_jsx(Label, { title: "Spin system", style: labelStyle, children: _jsx(Select, { items: SPIN_SYSTEMS, style: selectStyles, onChange: onSpinSystemChange, value: spinSystem }) }), _jsx(Label, { title: "Frequency", style: labelStyle, children: _jsx(FormikSelect, { items: FREQUENCIES, style: selectStyles, name: "options.frequency" }) }), _jsxs(Label, { title: "Line Width", style: labelStyle, children: [_jsx(FormikNumberInput, { name: "options.lineWidth", type: "number", style: { margin: 0, width: '40px' } }), _jsx("span", { style: { padding: '0 5px' }, children: "Hz" })] })] }));
|
|
23
|
+
}, children: [_jsx(Label, { title: "", style: labelStyle, children: _jsx(Select, { items: SPIN_SYSTEMS, style: selectStyles, onChange: onSpinSystemChange, value: spinSystem }) }), _jsx(Label, { title: "Frequency", style: labelStyle, children: _jsx(FormikSelect, { items: FREQUENCIES, style: selectStyles, name: "options.frequency" }) }), _jsxs(Label, { title: "Line Width", style: labelStyle, children: [_jsx(FormikNumberInput, { name: "options.lineWidth", type: "number", style: { margin: 0, width: '40px' } }), _jsx("span", { style: { padding: '0 5px' }, children: "Hz" })] })] }));
|
|
25
24
|
}
|
|
@@ -19,7 +19,6 @@ const ignoreActions = new Set([
|
|
|
19
19
|
'CHANGE_SPECTRUM_VISIBILITY',
|
|
20
20
|
'CHANGE_SPECTRA_VISIBILITY_BY_NUCLEUS',
|
|
21
21
|
'CHANGE_ACTIVE_SPECTRUM',
|
|
22
|
-
'SET_MOUSE_OVER_DISPLAYER',
|
|
23
22
|
'CHANGE_FLOAT_MOLECULE_POSITION',
|
|
24
23
|
'ALIGN_SPECTRA',
|
|
25
24
|
'TOGGLE_REAL_IMAGINARY_VISIBILITY',
|
|
@@ -162,12 +162,6 @@ export interface State {
|
|
|
162
162
|
zoom: {
|
|
163
163
|
history: ZoomHistory;
|
|
164
164
|
};
|
|
165
|
-
/**
|
|
166
|
-
* boolean indicator to check if the mouse over the displayer or not
|
|
167
|
-
* value change to true once the mouse come over the displayer and vice versa true once the mouse out of the displayer
|
|
168
|
-
* @default false
|
|
169
|
-
*/
|
|
170
|
-
overDisplayer: boolean;
|
|
171
165
|
/**
|
|
172
166
|
* Basic options for the tools
|
|
173
167
|
*/
|
|
@@ -193,6 +187,7 @@ export interface State {
|
|
|
193
187
|
baselineCorrection: {
|
|
194
188
|
zones: BaselineCorrectionZone[];
|
|
195
189
|
options: any;
|
|
190
|
+
livePreview: boolean;
|
|
196
191
|
};
|
|
197
192
|
apodizationOptions: ApodizationOptions;
|
|
198
193
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { v4 } from '@lukeed/uuid';
|
|
2
|
-
import { produce } from 'immer';
|
|
2
|
+
import { produce, original } from 'immer';
|
|
3
3
|
import { buildCorrelationData } from 'nmr-correlation';
|
|
4
4
|
import { DefaultTolerance } from '../panels/SummaryPanel/CorrelationTable/Constants';
|
|
5
5
|
import * as AssignmentsActions from './actions/AssignmentsActions';
|
|
@@ -8,7 +8,6 @@ import * as DatabaseActions from './actions/DatabaseActions';
|
|
|
8
8
|
import * as DimensionsActions from './actions/DimensionsActions';
|
|
9
9
|
import * as DomainActions from './actions/DomainActions';
|
|
10
10
|
import * as FiltersActions from './actions/FiltersActions';
|
|
11
|
-
import * as GlobalActions from './actions/GlobalActions';
|
|
12
11
|
import * as IntegralsActions from './actions/IntegralsActions';
|
|
13
12
|
import * as LoadActions from './actions/LoadActions';
|
|
14
13
|
import * as MoleculeActions from './actions/MoleculeActions';
|
|
@@ -92,7 +91,6 @@ export const getInitialState = () => ({
|
|
|
92
91
|
zoom: {
|
|
93
92
|
history: {},
|
|
94
93
|
},
|
|
95
|
-
overDisplayer: false,
|
|
96
94
|
toolOptions: {
|
|
97
95
|
selectedTool: 'zoom',
|
|
98
96
|
selectedOptionPanel: null,
|
|
@@ -100,6 +98,7 @@ export const getInitialState = () => ({
|
|
|
100
98
|
baselineCorrection: {
|
|
101
99
|
options: {},
|
|
102
100
|
zones: [],
|
|
101
|
+
livePreview: true,
|
|
103
102
|
},
|
|
104
103
|
apodizationOptions: {},
|
|
105
104
|
pivot: { value: 0, index: 0 },
|
|
@@ -149,6 +148,8 @@ function innerSpectrumReducer(draft, action) {
|
|
|
149
148
|
return PeaksActions.handleChangePeakShape(draft, action);
|
|
150
149
|
case 'TOGGLE_PEAKS_VIEW_PROPERTY':
|
|
151
150
|
return PeaksActions.handleTogglePeaksViewProperty(draft, action);
|
|
151
|
+
case 'TOGGLE_PEAKS_DISPLAYING_MODE':
|
|
152
|
+
return PeaksActions.handleChangePeaksDisplayingMode(draft);
|
|
152
153
|
case 'ADD_INTEGRAL':
|
|
153
154
|
return IntegralsActions.handleAddIntegral(draft, action);
|
|
154
155
|
case 'DELETE_INTEGRAL':
|
|
@@ -162,6 +163,8 @@ function innerSpectrumReducer(draft, action) {
|
|
|
162
163
|
return IntegralsActions.handleChangeIntegralsSumFlag(draft);
|
|
163
164
|
case 'CHANGE_INTEGRAL_RELATIVE':
|
|
164
165
|
return IntegralsActions.handleChangeIntegralsRelativeValue(draft, action);
|
|
166
|
+
case 'CUT_INTEGRAL':
|
|
167
|
+
return IntegralsActions.handleCutIntegral(draft, action);
|
|
165
168
|
case 'SET_X_DOMAIN':
|
|
166
169
|
return DomainActions.handleSetXDomain(draft, action);
|
|
167
170
|
case 'SET_Y_DOMAIN':
|
|
@@ -182,6 +185,10 @@ function innerSpectrumReducer(draft, action) {
|
|
|
182
185
|
return FiltersActions.handleCalculateZeroFillingFilter(draft, action);
|
|
183
186
|
case 'APPLY_FFT_FILTER':
|
|
184
187
|
return FiltersActions.handleApplyFFTFilter(draft);
|
|
188
|
+
case 'APPLY_FFT_DIMENSION_1_FILTER':
|
|
189
|
+
return FiltersActions.handleApplyFFtDimension1Filter(draft);
|
|
190
|
+
case 'APPLY_FFT_DIMENSION_2_FILTER':
|
|
191
|
+
return FiltersActions.handleApplyFFtDimension2Filter(draft);
|
|
185
192
|
case 'APPLY_MANUAL_PHASE_CORRECTION_FILTER':
|
|
186
193
|
return FiltersActions.handleApplyManualPhaseCorrectionFilter(draft, action);
|
|
187
194
|
case 'CALCULATE_MANUAL_PHASE_CORRECTION_FILTER':
|
|
@@ -266,6 +273,8 @@ function innerSpectrumReducer(draft, action) {
|
|
|
266
273
|
return ToolsActions.levelChangeHandler(draft, action);
|
|
267
274
|
case 'ADD_MOLECULE':
|
|
268
275
|
return MoleculeActions.handleAddMolecule(draft, action);
|
|
276
|
+
case 'ADD_MOLECULES':
|
|
277
|
+
return MoleculeActions.handleAddMolecules(draft, action);
|
|
269
278
|
case 'SET_MOLECULE':
|
|
270
279
|
return MoleculeActions.handleSetMolecule(draft, action);
|
|
271
280
|
case 'CHANGE_MOLECULE_LABEL':
|
|
@@ -326,6 +335,8 @@ function innerSpectrumReducer(draft, action) {
|
|
|
326
335
|
return RangesActions.handleAutoSpectraRangesDetection(draft);
|
|
327
336
|
case 'SHOW_J_GRAPH':
|
|
328
337
|
return RangesActions.handleShowJGraph(draft, action);
|
|
338
|
+
case 'CUT_RANGE':
|
|
339
|
+
return RangesActions.handleCutRange(draft, action);
|
|
329
340
|
case 'SET_KEY_PREFERENCES':
|
|
330
341
|
return PreferencesActions.handleSetKeyPreferences(draft, action);
|
|
331
342
|
case 'APPLY_KEY_PREFERENCES':
|
|
@@ -368,15 +379,30 @@ function innerSpectrumReducer(draft, action) {
|
|
|
368
379
|
return DatabaseActions.handleResurrectSpectrumFromJcamp(draft, action);
|
|
369
380
|
case 'SET_AUTOMATIC_ASSIGNMENTS':
|
|
370
381
|
return AssignmentsActions.handleSetAutomaticAssignments(draft, action);
|
|
371
|
-
case 'SET_MOUSE_OVER_DISPLAYER':
|
|
372
|
-
return GlobalActions.handleSetIsOverDisplayer(draft, action);
|
|
373
382
|
default:
|
|
374
383
|
}
|
|
375
384
|
}
|
|
376
385
|
catch (error) {
|
|
377
386
|
draft.errorAction = error;
|
|
378
|
-
error.data = { action };
|
|
387
|
+
error.data = { action, state: getDebugState(draft) };
|
|
379
388
|
reportError(error);
|
|
380
389
|
}
|
|
381
390
|
}
|
|
382
391
|
export const spectrumReducer = produce(innerSpectrumReducer);
|
|
392
|
+
function getDebugState(draft) {
|
|
393
|
+
const state = original(draft);
|
|
394
|
+
const string = JSON.stringify(state, (key, value) => {
|
|
395
|
+
if (ArrayBuffer.isView(value)) {
|
|
396
|
+
return Array.from(value).slice(0, 20);
|
|
397
|
+
}
|
|
398
|
+
if (Array.isArray(value) && typeof value[0] === 'number') {
|
|
399
|
+
return value.slice(0, 20);
|
|
400
|
+
}
|
|
401
|
+
return value;
|
|
402
|
+
});
|
|
403
|
+
if (string.length > 800000) {
|
|
404
|
+
// fallback, better to have something as a string t han nothing
|
|
405
|
+
return string.slice(0, 800000);
|
|
406
|
+
}
|
|
407
|
+
return JSON.parse(string);
|
|
408
|
+
}
|
|
@@ -7,18 +7,37 @@ import { ActionType } from '../types/ActionType';
|
|
|
7
7
|
type ShiftSpectrumAlongXAxisAction = ActionType<'SHIFT_SPECTRUM', {
|
|
8
8
|
shift: number;
|
|
9
9
|
}>;
|
|
10
|
-
type ApodizationFilterAction = ActionType<'APPLY_APODIZATION_FILTER'
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
type ApodizationFilterAction = ActionType<'APPLY_APODIZATION_FILTER', {
|
|
11
|
+
options: ApodizationOptions;
|
|
12
|
+
}>;
|
|
13
|
+
type ApodizationFilterLiveAction = ActionType<'CALCULATE_APODIZATION_FILTER', {
|
|
14
|
+
options: ApodizationOptions;
|
|
15
|
+
livePreview: boolean;
|
|
16
|
+
}>;
|
|
17
|
+
type ZeroFillingFilterAction = ActionType<'APPLY_ZERO_FILLING_FILTER', {
|
|
18
|
+
options: {
|
|
19
|
+
nbPoints: number;
|
|
20
|
+
};
|
|
21
|
+
}>;
|
|
22
|
+
type ZeroFillingFilterLiveAction = ActionType<'CALCULATE_ZERO_FILLING_FILTER', {
|
|
23
|
+
options: {
|
|
24
|
+
nbPoints: number;
|
|
25
|
+
};
|
|
26
|
+
livePreview: boolean;
|
|
13
27
|
}>;
|
|
14
28
|
type ManualPhaseCorrectionFilterAction = ActionType<'APPLY_MANUAL_PHASE_CORRECTION_FILTER' | 'CALCULATE_MANUAL_PHASE_CORRECTION_FILTER', {
|
|
15
29
|
ph0: number;
|
|
16
30
|
ph1: number;
|
|
17
31
|
}>;
|
|
18
|
-
type
|
|
32
|
+
type BaselineCorrectionFilterOptions = Omit<BaselineCorrectionOptions, 'zones'>;
|
|
33
|
+
interface BaselineCorrectionFilterProps {
|
|
34
|
+
options: BaselineCorrectionFilterOptions;
|
|
19
35
|
livePreview: boolean;
|
|
20
|
-
}
|
|
21
|
-
type BaselineCorrectionFilterAction = ActionType<'APPLY_BASE_LINE_CORRECTION_FILTER'
|
|
36
|
+
}
|
|
37
|
+
type BaselineCorrectionFilterAction = ActionType<'APPLY_BASE_LINE_CORRECTION_FILTER', {
|
|
38
|
+
options: BaselineCorrectionFilterOptions;
|
|
39
|
+
}>;
|
|
40
|
+
type BaselineCorrectionFilterLiveAction = ActionType<'CALCULATE_BASE_LINE_CORRECTION_FILTER', BaselineCorrectionFilterProps>;
|
|
22
41
|
type EnableFilterAction = ActionType<'ENABLE_FILTER', {
|
|
23
42
|
id: string;
|
|
24
43
|
enabled: boolean;
|
|
@@ -44,7 +63,7 @@ type DeleteExclusionZoneAction = ActionType<'DELETE_EXCLUSION_ZONE', {
|
|
|
44
63
|
type ApplySignalProcessingAction = ActionType<'APPLY_SIGNAL_PROCESSING_FILTER', {
|
|
45
64
|
options: MatrixOptions;
|
|
46
65
|
}>;
|
|
47
|
-
export type FiltersActions = ShiftSpectrumAlongXAxisAction | ApodizationFilterAction | ZeroFillingFilterAction | ManualPhaseCorrectionFilterAction | BaselineCorrectionFilterAction | EnableFilterAction | DeleteFilterAction | DeleteSpectraFilterAction | SetFilterSnapshotAction | AddExclusionZoneAction | DeleteExclusionZoneAction | ApplySignalProcessingAction | ActionType<'APPLY_FFT_FILTER' | 'APPLY_AUTO_PHASE_CORRECTION_FILTER' | 'APPLY_ABSOLUTE_FILTER'>;
|
|
66
|
+
export type FiltersActions = ShiftSpectrumAlongXAxisAction | ApodizationFilterAction | ApodizationFilterLiveAction | ZeroFillingFilterAction | ZeroFillingFilterLiveAction | ManualPhaseCorrectionFilterAction | BaselineCorrectionFilterAction | BaselineCorrectionFilterLiveAction | EnableFilterAction | DeleteFilterAction | DeleteSpectraFilterAction | SetFilterSnapshotAction | AddExclusionZoneAction | DeleteExclusionZoneAction | ApplySignalProcessingAction | ActionType<'APPLY_FFT_FILTER' | 'APPLY_FFT_DIMENSION_1_FILTER' | 'APPLY_FFT_DIMENSION_2_FILTER' | 'APPLY_AUTO_PHASE_CORRECTION_FILTER' | 'APPLY_ABSOLUTE_FILTER'>;
|
|
48
67
|
interface RollbackSpectrumByFilterOptions {
|
|
49
68
|
applyFilter?: boolean;
|
|
50
69
|
reset?: boolean;
|
|
@@ -62,17 +81,19 @@ interface RollbackSpectrumOptions {
|
|
|
62
81
|
declare function rollbackSpectrum(draft: Draft<State>, options: RollbackSpectrumOptions): void;
|
|
63
82
|
declare function handleShiftSpectrumAlongXAxis(draft: Draft<State>, action: ShiftSpectrumAlongXAxisAction): void;
|
|
64
83
|
declare function handleApplyZeroFillingFilter(draft: Draft<State>, action: ZeroFillingFilterAction): void;
|
|
65
|
-
declare function handleCalculateZeroFillingFilter(draft: Draft<State>, action:
|
|
66
|
-
declare function handleCalculateApodizationFilter(draft: Draft<State>, action:
|
|
84
|
+
declare function handleCalculateZeroFillingFilter(draft: Draft<State>, action: ZeroFillingFilterLiveAction): void;
|
|
85
|
+
declare function handleCalculateApodizationFilter(draft: Draft<State>, action: ApodizationFilterLiveAction): void;
|
|
67
86
|
declare function handleApplyApodizationFilter(draft: Draft<State>, action: ApodizationFilterAction): void;
|
|
68
87
|
declare function handleApplyFFTFilter(draft: Draft<State>): void;
|
|
88
|
+
declare function handleApplyFFtDimension1Filter(draft: Draft<State>): void;
|
|
89
|
+
declare function handleApplyFFtDimension2Filter(draft: Draft<State>): void;
|
|
69
90
|
declare function handleApplyManualPhaseCorrectionFilter(draft: Draft<State>, action: ManualPhaseCorrectionFilterAction): void;
|
|
70
91
|
declare function handleCalculateManualPhaseCorrection(draft: Draft<State>, action: ManualPhaseCorrectionFilterAction): void;
|
|
71
92
|
declare function handleApplyAbsoluteFilter(draft: Draft<State>): void;
|
|
72
93
|
declare function handleApplyAutoPhaseCorrectionFilter(draft: Draft<State>): void;
|
|
73
94
|
declare function handleBaseLineCorrectionFilter(draft: Draft<State>, action: BaselineCorrectionFilterAction): void;
|
|
74
95
|
declare function calculateBaseLineCorrection(draft: Draft<State>, baseLineOptions?: BaselineCorrectionFilterProps): void;
|
|
75
|
-
declare function handleCalculateBaseLineCorrection(draft: Draft<State>, action:
|
|
96
|
+
declare function handleCalculateBaseLineCorrection(draft: Draft<State>, action: BaselineCorrectionFilterLiveAction): void;
|
|
76
97
|
declare function handleEnableFilter(draft: Draft<State>, action: EnableFilterAction): void;
|
|
77
98
|
declare function handleDeleteFilter(draft: Draft<State>, action: DeleteFilterAction): void;
|
|
78
99
|
declare function handleDeleteSpectraFilter(draft: Draft<State>, action: DeleteSpectraFilterAction): void;
|
|
@@ -80,4 +101,4 @@ declare function handleSetFilterSnapshotHandler(draft: Draft<State>, action: Set
|
|
|
80
101
|
declare function handleSignalProcessingFilter(draft: Draft<State>, action: ApplySignalProcessingAction): void;
|
|
81
102
|
declare function handleAddExclusionZone(draft: Draft<State>, action: AddExclusionZoneAction): void;
|
|
82
103
|
declare function handleDeleteExclusionZone(draft: Draft<State>, action: DeleteExclusionZoneAction): void;
|
|
83
|
-
export { handleShiftSpectrumAlongXAxis, handleApplyZeroFillingFilter, handleApplyApodizationFilter, handleApplyFFTFilter, handleApplyManualPhaseCorrectionFilter, handleApplyAutoPhaseCorrectionFilter, handleApplyAbsoluteFilter, handleCalculateManualPhaseCorrection, calculateBaseLineCorrection, handleCalculateBaseLineCorrection, handleCalculateApodizationFilter, handleCalculateZeroFillingFilter, handleEnableFilter, handleDeleteFilter, handleDeleteSpectraFilter, handleBaseLineCorrectionFilter, handleSetFilterSnapshotHandler, handleAddExclusionZone, handleDeleteExclusionZone, handleSignalProcessingFilter, rollbackSpectrum, rollbackSpectrumByFilter, };
|
|
104
|
+
export { handleShiftSpectrumAlongXAxis, handleApplyZeroFillingFilter, handleApplyApodizationFilter, handleApplyFFTFilter, handleApplyFFtDimension1Filter, handleApplyFFtDimension2Filter, handleApplyManualPhaseCorrectionFilter, handleApplyAutoPhaseCorrectionFilter, handleApplyAbsoluteFilter, handleCalculateManualPhaseCorrection, calculateBaseLineCorrection, handleCalculateBaseLineCorrection, handleCalculateApodizationFilter, handleCalculateZeroFillingFilter, handleEnableFilter, handleDeleteFilter, handleDeleteSpectraFilter, handleBaseLineCorrectionFilter, handleSetFilterSnapshotHandler, handleAddExclusionZone, handleDeleteExclusionZone, handleSignalProcessingFilter, rollbackSpectrum, rollbackSpectrumByFilter, };
|