nmrium 0.30.0 → 0.32.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 +3 -1
- package/lib/component/1d/FooterBanner.js +20 -11
- package/lib/component/1d/IntegralsSeries.js +3 -1
- package/lib/component/1d/LinesSeries.js +3 -1
- package/lib/component/1d/SpectraTracker.js +1 -1
- package/lib/component/1d/Viewer1D.js +3 -1
- package/lib/component/1d/jCouplingGraph/JGraph.js +5 -1
- package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib/component/1d/multiplicityTree/MultiplicityTree.js +3 -1
- package/lib/component/1d/peaks/PeakAnnotations.js +3 -1
- package/lib/component/1d/peaks/PeaksShapes.js +4 -2
- package/lib/component/1d/peaks/usePeakShapesPath.js +7 -3
- package/lib/component/1d/ranges/Ranges.js +8 -2
- package/lib/component/1d/tool/PeakPointer.js +3 -1
- package/lib/component/1d/tool/XLabelPointer.js +3 -1
- package/lib/component/2d/Contours.js +4 -2
- package/lib/component/2d/FooterBanner.js +3 -1
- package/lib/component/2d/Left1DChart.js +1 -1
- package/lib/component/2d/Top1DChart.js +1 -1
- package/lib/component/2d/Viewer2D.js +4 -4
- package/lib/component/2d/XAxis.js +2 -2
- package/lib/component/2d/YAxis.js +2 -2
- package/lib/component/2d/tools/XYLabelPointer.js +3 -1
- package/lib/component/2d/tools/slicing/SlicingView.js +3 -1
- package/lib/component/2d/zones/IndicationLines.js +1 -1
- package/lib/component/2d/zones/Zones.js +14 -19
- package/lib/component/EventsTrackers/BrushTracker.js +30 -21
- package/lib/component/NMRium.d.ts +2 -0
- package/lib/component/NMRium.js +14 -3
- package/lib/component/SplitPaneWrapper.js +1 -1
- package/lib/component/elements/EditableColumn.d.ts +3 -1
- package/lib/component/elements/EditableColumn.js +18 -3
- package/lib/component/elements/popup/Modal/Provider.d.ts +3 -3
- package/lib/component/elements/popup/Modal/Provider.js +8 -11
- package/lib/component/header/ZeroFillingOptionsPanel.js +3 -1
- package/lib/component/hooks/useActiveSpectrumStyleOptions.js +3 -3
- package/lib/component/hooks/useDatumWithSpectraStatistics.js +3 -1
- package/lib/component/hooks/useExport.d.ts +0 -1
- package/lib/component/hooks/useExport.js +1 -17
- package/lib/component/hooks/useIntegralPath.js +5 -2
- package/lib/component/hooks/useNucleus.js +4 -4
- package/lib/component/hooks/useSpectraPerNucleus.js +1 -1
- package/lib/component/hooks/useSpectrum.js +3 -1
- package/lib/component/loader/DropZone.js +15 -147
- package/lib/component/modal/changeSum/SelectMolecule.js +1 -1
- package/lib/component/modal/editRange/EditRangeModal.js +1 -1
- package/lib/component/modal/setting/GeneralTabContent.js +1 -1
- package/lib/component/modal/setting/ToolsTabContent.js +4 -0
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculeHeader.js +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +1 -1
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +1 -1
- package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
- package/lib/component/panels/RangesPanel/RangesHeader.d.ts +2 -1
- package/lib/component/panels/RangesPanel/RangesHeader.js +10 -9
- package/lib/component/panels/RangesPanel/RangesPanel.js +7 -3
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -1
- package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +3 -26
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +1 -1
- package/lib/component/panels/SummaryPanel/utilities/useInView.js +3 -1
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +19 -10
- package/lib/component/panels/databasePanel/DatabasePanel.js +1 -1
- package/lib/component/reducer/IgnoreActions.js +1 -0
- package/lib/component/reducer/Reducer.d.ts +110 -96
- package/lib/component/reducer/Reducer.js +45 -41
- package/lib/component/reducer/actions/DomainActions.d.ts +1 -1
- package/lib/component/reducer/actions/DomainActions.js +12 -9
- package/lib/component/reducer/actions/FiltersActions.d.ts +1 -1
- package/lib/component/reducer/actions/FiltersActions.js +227 -232
- package/lib/component/reducer/actions/IntegralsActions.js +14 -8
- package/lib/component/reducer/actions/LoadActions.d.ts +2 -5
- package/lib/component/reducer/actions/LoadActions.js +19 -34
- package/lib/component/reducer/actions/MoleculeActions.d.ts +2 -1
- package/lib/component/reducer/actions/MoleculeActions.js +22 -6
- package/lib/component/reducer/actions/PeaksActions.js +19 -12
- package/lib/component/reducer/actions/PreferencesActions.js +9 -10
- package/lib/component/reducer/actions/RangesActions.d.ts +4 -4
- package/lib/component/reducer/actions/RangesActions.js +89 -29
- package/lib/component/reducer/actions/SpectraAnalysisAction.js +5 -5
- package/lib/component/reducer/actions/SpectrumsActions.js +14 -10
- package/lib/component/reducer/actions/ToolsActions.d.ts +1 -1
- package/lib/component/reducer/actions/ToolsActions.js +44 -27
- package/lib/component/reducer/actions/ZonesActions.d.ts +4 -1
- package/lib/component/reducer/actions/ZonesActions.js +69 -17
- package/lib/component/reducer/helper/Zoom1DManager.js +2 -1
- package/lib/component/reducer/helper/getActiveSpectrum.d.ts +3 -0
- package/lib/component/reducer/helper/getActiveSpectrum.js +4 -0
- package/lib/component/reducer/helper/getActiveSpectrumOrFail.d.ts +3 -0
- package/lib/component/reducer/helper/getActiveSpectrumOrFail.js +6 -0
- package/lib/component/reducer/helper/getSpectrum.js +3 -2
- package/lib/component/reducer/helper/getStrongestPeak.js +2 -1
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +2 -2
- package/lib/component/reducer/types/Types.d.ts +5 -0
- package/lib/component/reducer/types/Types.js +5 -0
- package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.d.ts +6 -0
- package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.js +10 -3
- package/lib/component/tool/FloatMoleculeStructures/index.js +14 -8
- package/lib/component/toolbar/BasicToolBar.js +12 -13
- package/lib/component/toolbar/FunctionToolBar.js +3 -1
- package/lib/component/utility/Export.js +7 -1
- package/lib/component/utility/assert.d.ts +1 -0
- package/lib/component/utility/assert.js +5 -0
- package/lib/component/workspaces/Workspace.d.ts +1 -1
- package/lib/component/workspaces/exercise.js +9 -3
- package/lib/component/workspaces/workspaceDefaultProperties.js +1 -1
- package/lib/data/Filters.d.ts +1 -2
- package/lib/data/Filters.js +1 -2
- package/lib/data/SpectraManager.d.ts +0 -4
- package/lib/data/SpectraManager.js +2 -87
- package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -0
- package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +1 -0
- package/lib/data/data1d/filter1d/fft.js +11 -0
- package/lib/data/data1d/filter1d/phaseCorrection.js +11 -5
- package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.d.ts +2 -0
- package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +35 -0
- package/lib/data/data2d/Processing2D.js +3 -2
- package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.d.ts +1 -1
- package/lib/data/molecules/Molecule.d.ts +5 -0
- package/lib/data/utilities/calculateSanPlot.d.ts +8 -0
- package/lib/data/utilities/calculateSanPlot.js +31 -0
- package/lib/types/NMRiumGeneralPreferences.d.ts +2 -2
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/ApodizationLine.js +3 -1
- package/lib-cjs/component/1d/FooterBanner.js +19 -10
- package/lib-cjs/component/1d/IntegralsSeries.js +3 -1
- package/lib-cjs/component/1d/LinesSeries.js +3 -1
- package/lib-cjs/component/1d/SpectraTracker.js +1 -1
- package/lib-cjs/component/1d/Viewer1D.js +3 -1
- package/lib-cjs/component/1d/jCouplingGraph/JGraph.js +5 -1
- package/lib-cjs/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +3 -1
- package/lib-cjs/component/1d/peaks/PeakAnnotations.js +3 -1
- package/lib-cjs/component/1d/peaks/PeaksShapes.js +4 -2
- package/lib-cjs/component/1d/peaks/usePeakShapesPath.js +7 -3
- package/lib-cjs/component/1d/ranges/Ranges.js +7 -1
- package/lib-cjs/component/1d/tool/PeakPointer.js +3 -1
- package/lib-cjs/component/1d/tool/XLabelPointer.js +3 -1
- package/lib-cjs/component/2d/Contours.js +4 -2
- package/lib-cjs/component/2d/FooterBanner.js +3 -1
- package/lib-cjs/component/2d/Left1DChart.js +1 -1
- package/lib-cjs/component/2d/Top1DChart.js +1 -1
- package/lib-cjs/component/2d/Viewer2D.js +4 -4
- package/lib-cjs/component/2d/XAxis.js +2 -2
- package/lib-cjs/component/2d/YAxis.js +2 -2
- package/lib-cjs/component/2d/tools/XYLabelPointer.js +3 -1
- package/lib-cjs/component/2d/tools/slicing/SlicingView.js +3 -1
- package/lib-cjs/component/2d/zones/IndicationLines.js +1 -1
- package/lib-cjs/component/2d/zones/Zones.js +13 -18
- package/lib-cjs/component/EventsTrackers/BrushTracker.js +30 -21
- package/lib-cjs/component/NMRium.js +14 -3
- package/lib-cjs/component/SplitPaneWrapper.js +1 -1
- package/lib-cjs/component/elements/EditableColumn.js +18 -3
- package/lib-cjs/component/elements/popup/Modal/Provider.js +8 -11
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +3 -1
- package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +3 -3
- package/lib-cjs/component/hooks/useDatumWithSpectraStatistics.js +3 -1
- package/lib-cjs/component/hooks/useExport.js +0 -16
- package/lib-cjs/component/hooks/useIntegralPath.js +5 -2
- package/lib-cjs/component/hooks/useNucleus.js +4 -4
- package/lib-cjs/component/hooks/useSpectraPerNucleus.js +1 -1
- package/lib-cjs/component/hooks/useSpectrum.js +3 -1
- package/lib-cjs/component/loader/DropZone.js +14 -149
- package/lib-cjs/component/modal/changeSum/SelectMolecule.js +1 -1
- package/lib-cjs/component/modal/editRange/EditRangeModal.js +1 -1
- package/lib-cjs/component/modal/setting/GeneralTabContent.js +1 -1
- package/lib-cjs/component/modal/setting/ToolsTabContent.js +4 -0
- package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +1 -1
- package/lib-cjs/component/panels/MoleculesPanel/MoleculeHeader.js +1 -1
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +1 -1
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +1 -1
- package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +10 -9
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +7 -3
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -1
- package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -1
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -25
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +1 -1
- package/lib-cjs/component/panels/SummaryPanel/utilities/useInView.js +3 -1
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +18 -9
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +1 -1
- package/lib-cjs/component/reducer/IgnoreActions.js +1 -0
- package/lib-cjs/component/reducer/Reducer.js +48 -43
- package/lib-cjs/component/reducer/actions/DomainActions.js +12 -9
- package/lib-cjs/component/reducer/actions/FiltersActions.js +228 -233
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +14 -8
- package/lib-cjs/component/reducer/actions/LoadActions.js +18 -36
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +23 -6
- package/lib-cjs/component/reducer/actions/PeaksActions.js +19 -12
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +9 -10
- package/lib-cjs/component/reducer/actions/RangesActions.js +89 -29
- package/lib-cjs/component/reducer/actions/SpectraAnalysisAction.js +5 -5
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +14 -10
- package/lib-cjs/component/reducer/actions/ToolsActions.js +44 -27
- package/lib-cjs/component/reducer/actions/ZonesActions.js +72 -17
- package/lib-cjs/component/reducer/helper/Zoom1DManager.js +2 -1
- package/lib-cjs/component/reducer/helper/getActiveSpectrum.js +8 -0
- package/lib-cjs/component/reducer/helper/getActiveSpectrumOrFail.js +10 -0
- package/lib-cjs/component/reducer/helper/getSpectrum.js +3 -2
- package/lib-cjs/component/reducer/helper/getStrongestPeak.js +2 -1
- package/lib-cjs/component/reducer/types/Types.js +8 -3
- package/lib-cjs/component/tool/FloatMoleculeStructures/DraggableStructure.js +10 -3
- package/lib-cjs/component/tool/FloatMoleculeStructures/index.js +14 -8
- package/lib-cjs/component/toolbar/BasicToolBar.js +11 -12
- package/lib-cjs/component/toolbar/FunctionToolBar.js +3 -1
- package/lib-cjs/component/utility/Export.js +7 -1
- package/lib-cjs/component/utility/assert.js +9 -0
- package/lib-cjs/component/workspaces/exercise.js +9 -3
- package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +1 -1
- package/lib-cjs/data/Filters.js +1 -3
- package/lib-cjs/data/SpectraManager.js +3 -92
- package/lib-cjs/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -0
- package/lib-cjs/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +1 -0
- package/lib-cjs/data/data1d/filter1d/fft.js +11 -0
- package/lib-cjs/data/data1d/filter1d/phaseCorrection.js +10 -4
- package/lib-cjs/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +39 -0
- package/lib-cjs/data/data2d/Processing2D.js +3 -2
- package/lib-cjs/data/utilities/calculateSanPlot.js +35 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +26 -25
- package/lib/component/utility/nmredataToNmrium.d.ts +0 -4
- package/lib/component/utility/nmredataToNmrium.js +0 -66
- package/lib/component/utility/nmriumToNmredata.d.ts +0 -2
- package/lib/component/utility/nmriumToNmredata.js +0 -80
- package/lib/component/utility/util/nmredata/addRanges.d.ts +0 -1
- package/lib/component/utility/util/nmredata/addRanges.js +0 -52
- package/lib/component/utility/util/nmredata/addSource.d.ts +0 -6
- package/lib/component/utility/util/nmredata/addSource.js +0 -54
- package/lib/component/utility/util/nmredata/addZones.d.ts +0 -1
- package/lib/component/utility/util/nmredata/addZones.js +0 -41
- package/lib/component/utility/util/nmredata/flat2DSignals.d.ts +0 -1
- package/lib/component/utility/util/nmredata/flat2DSignals.js +0 -7
- package/lib/component/utility/util/nmredata/get1DSignals.d.ts +0 -10
- package/lib/component/utility/util/nmredata/get1DSignals.js +0 -96
- package/lib/component/utility/util/nmredata/get2DSignals.d.ts +0 -8
- package/lib/component/utility/util/nmredata/get2DSignals.js +0 -59
- package/lib/component/utility/util/nmredata/getCouplingObserved.d.ts +0 -1
- package/lib/component/utility/util/nmredata/getCouplingObserved.js +0 -11
- package/lib/component/utility/util/nmredata/getLabels.d.ts +0 -9
- package/lib/component/utility/util/nmredata/getLabels.js +0 -66
- package/lib/component/utility/util/nmredata/getToFix.d.ts +0 -1
- package/lib/component/utility/util/nmredata/getToFix.js +0 -19
- package/lib/data/data1d/filter1d/absolute.d.ts +0 -13
- package/lib/data/data1d/filter1d/absolute.js +0 -26
- package/lib/data/migration/MigrationManager.d.ts +0 -2
- package/lib/data/migration/MigrationManager.js +0 -19
- package/lib/data/migration/changeKeys.d.ts +0 -1
- package/lib/data/migration/changeKeys.js +0 -9
- package/lib/data/migration/migrateToVersion1.d.ts +0 -11
- package/lib/data/migration/migrateToVersion1.js +0 -32
- package/lib/data/migration/migrateToVersion2.d.ts +0 -1
- package/lib/data/migration/migrateToVersion2.js +0 -111
- package/lib/data/migration/migrateToVersion3.d.ts +0 -1
- package/lib/data/migration/migrateToVersion3.js +0 -55
- package/lib-cjs/component/utility/nmredataToNmrium.js +0 -73
- package/lib-cjs/component/utility/nmriumToNmredata.js +0 -87
- package/lib-cjs/component/utility/util/nmredata/addRanges.js +0 -56
- package/lib-cjs/component/utility/util/nmredata/addSource.js +0 -61
- package/lib-cjs/component/utility/util/nmredata/addZones.js +0 -45
- package/lib-cjs/component/utility/util/nmredata/flat2DSignals.js +0 -11
- package/lib-cjs/component/utility/util/nmredata/get1DSignals.js +0 -100
- package/lib-cjs/component/utility/util/nmredata/get2DSignals.js +0 -63
- package/lib-cjs/component/utility/util/nmredata/getCouplingObserved.js +0 -15
- package/lib-cjs/component/utility/util/nmredata/getLabels.js +0 -70
- package/lib-cjs/component/utility/util/nmredata/getToFix.js +0 -23
- package/lib-cjs/data/data1d/filter1d/absolute.js +0 -32
- package/lib-cjs/data/migration/MigrationManager.js +0 -26
- package/lib-cjs/data/migration/changeKeys.js +0 -13
- package/lib-cjs/data/migration/migrateToVersion1.js +0 -35
- package/lib-cjs/data/migration/migrateToVersion2.js +0 -114
- package/lib-cjs/data/migration/migrateToVersion3.js +0 -58
|
@@ -7,12 +7,14 @@ import { NMRiumDataReturn } from '../types/NMRiumDataReturn';
|
|
|
7
7
|
import { NMRiumGeneralPreferences } from '../types/NMRiumGeneralPreferences';
|
|
8
8
|
import { NMRiumPanelPreferences } from '../types/NMRiumPanelPreferences';
|
|
9
9
|
import { NMRiumToolBarPreferences } from '../types/NMRiumToolBarPreferences';
|
|
10
|
+
import { ViewState } from './reducer/Reducer';
|
|
10
11
|
import { BlobObject } from './utility/Export';
|
|
11
12
|
export type { NMRiumDataReturn } from '../types/NMRiumDataReturn';
|
|
12
13
|
export declare type NMRiumWorkspace = 'exercise' | 'process1D' | 'default' | 'prediction' | 'embedded';
|
|
13
14
|
export interface NMRiumProps {
|
|
14
15
|
data?: NMRiumData;
|
|
15
16
|
onDataChange?: (data: NMRiumDataReturn) => void;
|
|
17
|
+
onViewChange?: (view: ViewState) => void;
|
|
16
18
|
workspace?: NMRiumWorkspace;
|
|
17
19
|
preferences?: NMRiumPreferences;
|
|
18
20
|
emptyText?: ReactNode;
|
package/lib/component/NMRium.js
CHANGED
|
@@ -87,11 +87,19 @@ const defaultData = {
|
|
|
87
87
|
const NMRium = forwardRef(function NMRium(props, ref) {
|
|
88
88
|
return (_jsx(RootLayout, { style: { width: '100%' }, children: _jsx(ErrorBoundary, { FallbackComponent: ErrorOverlay, children: _jsx(InnerNMRium, { ...props, innerRef: ref }) }) }));
|
|
89
89
|
});
|
|
90
|
-
function InnerNMRium({ data: dataProp = defaultData, workspace, preferences = defaultPreferences, getSpinner = defaultGetSpinner, onDataChange, emptyText, innerRef, }) {
|
|
90
|
+
function InnerNMRium({ data: dataProp = defaultData, workspace, preferences = defaultPreferences, getSpinner = defaultGetSpinner, onDataChange, onViewChange, emptyText, innerRef, }) {
|
|
91
91
|
const rootRef = useRef(null);
|
|
92
92
|
const elementsWrapperRef = useRef(null);
|
|
93
93
|
const viewerRef = useRef(null);
|
|
94
94
|
const [show, toggle] = useToggle(false);
|
|
95
|
+
const handleDataChange = useRef(onDataChange);
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
handleDataChange.current = onDataChange;
|
|
98
|
+
}, [onDataChange]);
|
|
99
|
+
const handleViewChange = useRef(onViewChange);
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
handleViewChange.current = onViewChange;
|
|
102
|
+
}, [onViewChange]);
|
|
95
103
|
const isFullscreen = useFullscreen(rootRef, show, {
|
|
96
104
|
onClose: () => {
|
|
97
105
|
toggle(false);
|
|
@@ -102,9 +110,12 @@ function InnerNMRium({ data: dataProp = defaultData, workspace, preferences = de
|
|
|
102
110
|
const { displayerMode, data: spectraData } = state;
|
|
103
111
|
useEffect(() => {
|
|
104
112
|
if (checkActionType(state.actionType)) {
|
|
105
|
-
|
|
113
|
+
handleDataChange.current?.(toJSON(state, 'onDataChange'));
|
|
106
114
|
}
|
|
107
|
-
}, [
|
|
115
|
+
}, [state]);
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
handleViewChange.current?.(state.view);
|
|
118
|
+
}, [state.view]);
|
|
108
119
|
const dispatchMiddleWare = useMemo(() => {
|
|
109
120
|
return dispatchMiddleware(dispatch);
|
|
110
121
|
}, []);
|
|
@@ -4,5 +4,5 @@ import { usePreferences } from './context/PreferencesContext';
|
|
|
4
4
|
export function SplitPaneWrapper({ children }) {
|
|
5
5
|
const { current } = usePreferences();
|
|
6
6
|
const { hidePanelOnLoad = false, initialPanelWidth = '560px' } = current?.display?.general || {};
|
|
7
|
-
return (_jsx(SplitPane, {
|
|
7
|
+
return (_jsx(SplitPane, { initialSize: initialPanelWidth, direction: "horizontal", controlledSide: "end", initialClosed: hidePanelOnLoad ? true : 600, children: children }, hidePanelOnLoad ? 'true' : 'false'));
|
|
8
8
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
|
-
|
|
2
|
+
import { InputProps } from './Input';
|
|
3
|
+
interface EditableColumnProps extends Omit<InputProps, 'style' | 'value' | 'type'> {
|
|
3
4
|
onSave?: (element: any) => void;
|
|
4
5
|
onEditStart?: (element: any) => void;
|
|
5
6
|
type?: 'number' | 'text';
|
|
@@ -7,6 +8,7 @@ interface EditableColumnProps {
|
|
|
7
8
|
value: string | number;
|
|
8
9
|
style?: CSSProperties;
|
|
9
10
|
validate?: (value?: any) => boolean;
|
|
11
|
+
textOverFlowEllipses?: boolean;
|
|
10
12
|
}
|
|
11
13
|
declare const EditableColumn: import("react").ForwardRefExoticComponent<EditableColumnProps & import("react").RefAttributes<unknown>>;
|
|
12
14
|
export default EditableColumn;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef, useCallback, useEffect, useImperativeHandle, useState, } from 'react';
|
|
3
3
|
import Input from './Input';
|
|
4
4
|
const EditableColumn = forwardRef(function EditableColumn(props, ref) {
|
|
5
|
-
const { onSave = () => null, value, type = 'text', style, onEditStart = () => null, editStatus = false, validate = () => true, } = props;
|
|
5
|
+
const { onSave = () => null, value, type = 'text', style, onEditStart = () => null, editStatus = false, validate = () => true, textOverFlowEllipses = false, ...InputProps } = props;
|
|
6
6
|
const [enabled, enableEdit] = useState();
|
|
7
7
|
const [isValid, setValid] = useState(true);
|
|
8
8
|
useEffect(() => {
|
|
@@ -43,11 +43,26 @@ const EditableColumn = forwardRef(function EditableColumn(props, ref) {
|
|
|
43
43
|
window.removeEventListener('mousedown', mouseClickCallback);
|
|
44
44
|
}
|
|
45
45
|
}, [mouseClickCallback, onSave, validate]);
|
|
46
|
-
return (_jsxs("div", { style: {
|
|
46
|
+
return (_jsxs("div", { style: {
|
|
47
|
+
display: 'table',
|
|
48
|
+
width: '100%',
|
|
49
|
+
height: '100%',
|
|
50
|
+
...(textOverFlowEllipses
|
|
51
|
+
? { whiteSpace: 'nowrap', overflow: 'hidden', display: 'inline-flex' }
|
|
52
|
+
: {}),
|
|
53
|
+
...style,
|
|
54
|
+
}, className: "editable-column-input", onDoubleClick: startEditHandler, children: [!enabled && (_jsx("span", { style: {
|
|
55
|
+
display: 'table-cell',
|
|
56
|
+
verticalAlign: 'middle',
|
|
57
|
+
width: 'inherit',
|
|
58
|
+
...(textOverFlowEllipses
|
|
59
|
+
? { textOverflow: 'ellipsis', overflow: 'hidden' }
|
|
60
|
+
: {}),
|
|
61
|
+
}, children: value })), enabled && (_jsx("div", { style: { display: 'table-cell', verticalAlign: 'middle' }, children: _jsx(Input, { style: {
|
|
47
62
|
inputWrapper: {
|
|
48
63
|
width: '100%',
|
|
49
64
|
...(!isValid && { borderColor: 'red' }),
|
|
50
65
|
},
|
|
51
|
-
}, enableAutoSelect: true, className: "editable-column", value: value, type: type, onKeyUp: editHandler }) }))] }));
|
|
66
|
+
}, enableAutoSelect: true, className: "editable-column", value: value, type: type, onKeyUp: editHandler, ...InputProps }) }))] }));
|
|
52
67
|
});
|
|
53
68
|
export default EditableColumn;
|
|
@@ -3,9 +3,9 @@ interface ProviderProps {
|
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
style?: CSSProperties;
|
|
5
5
|
offset?: string;
|
|
6
|
-
position?:
|
|
7
|
-
transition?:
|
|
8
|
-
wrapperRef?:
|
|
6
|
+
position?: string;
|
|
7
|
+
transition?: string;
|
|
8
|
+
wrapperRef?: HTMLDivElement | null;
|
|
9
9
|
}
|
|
10
10
|
declare function Provider({ children, style, offset, position, transition, wrapperRef, }: ProviderProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
11
11
|
export default Provider;
|
|
@@ -23,7 +23,7 @@ const transitionStyles = {
|
|
|
23
23
|
exited: { transform: 'scale(0)' },
|
|
24
24
|
},
|
|
25
25
|
};
|
|
26
|
-
function Provider({ children, style
|
|
26
|
+
function Provider({ children, style, offset = '0px', position = positions.MIDDLE, transition = transitions.SCALE, wrapperRef = null, }) {
|
|
27
27
|
const root = useRef();
|
|
28
28
|
const modalRef = useRef();
|
|
29
29
|
const [modal, setModal] = useState();
|
|
@@ -44,16 +44,13 @@ function Provider({ children, style = undefined, offset = '0px', position = posi
|
|
|
44
44
|
const close = useCallback(function close() {
|
|
45
45
|
setModal(null);
|
|
46
46
|
}, [setModal]);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
height: window.innerHeight,
|
|
55
|
-
};
|
|
56
|
-
}, [wrapperRef]);
|
|
47
|
+
// todo: optimize this
|
|
48
|
+
const parentStyle = wrapperRef?.getBoundingClientRect() || {
|
|
49
|
+
top: 0,
|
|
50
|
+
left: 0,
|
|
51
|
+
width: window.innerWidth,
|
|
52
|
+
height: window.innerHeight,
|
|
53
|
+
};
|
|
57
54
|
/**
|
|
58
55
|
*
|
|
59
56
|
* @param {*} component <component />
|
|
@@ -9,13 +9,15 @@ import CheckBox from '../elements/CheckBox';
|
|
|
9
9
|
import Label from '../elements/Label';
|
|
10
10
|
import Select from '../elements/Select';
|
|
11
11
|
import { useFilter } from '../hooks/useFilter';
|
|
12
|
+
import { useActiveSpectrum } from '../reducer/Reducer';
|
|
12
13
|
import { APPLY_ZERO_FILLING_FILTER, CALCULATE_ZERO_FILLING_FILTER, DISABLE_FILTER_LIVE_PREVIEW, RESET_SELECTED_TOOL, } from '../reducer/types/Types';
|
|
13
14
|
import { options } from '../toolbar/ToolTypes';
|
|
14
15
|
import { HeaderContainer } from './HeaderContainer';
|
|
15
16
|
const Sizes = generateNumbersPowerOfX(8, 21);
|
|
16
17
|
function ZeroFillingOptionsPanel() {
|
|
17
18
|
const dispatch = useDispatch();
|
|
18
|
-
const { data
|
|
19
|
+
const { data } = useChartData();
|
|
20
|
+
const activeSpectrum = useActiveSpectrum();
|
|
19
21
|
const [size, setSize] = useState();
|
|
20
22
|
const [livePreview, setLivePreview] = useState(true);
|
|
21
23
|
const filter = useFilter(Filters.zeroFilling.id);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import get from 'lodash/get';
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
|
-
import { useChartData } from '../context/ChartContext';
|
|
4
3
|
import { usePreferences } from '../context/PreferencesContext';
|
|
4
|
+
import { useActiveSpectrum } from '../reducer/Reducer';
|
|
5
5
|
export default function useActiveSpectrumStyleOptions(id) {
|
|
6
|
-
const
|
|
6
|
+
const activeSpectrum = useActiveSpectrum();
|
|
7
7
|
const preferences = usePreferences();
|
|
8
8
|
return useMemo(() => {
|
|
9
9
|
const isActive = activeSpectrum === null ? true : id === activeSpectrum.id;
|
|
10
10
|
const opacity = isActive
|
|
11
11
|
? 1
|
|
12
|
-
: get(preferences.current, 'general.
|
|
12
|
+
: get(preferences.current, 'general.dimmedSpectraOpacity', 0.1);
|
|
13
13
|
return { isActive, opacity };
|
|
14
14
|
}, [activeSpectrum, id, preferences]);
|
|
15
15
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { useChartData } from '../context/ChartContext';
|
|
3
|
+
import { useActiveSpectrum } from '../reducer/Reducer';
|
|
3
4
|
import nucleusToString from '../utility/nucleusToString';
|
|
4
5
|
const emptyData = { info: {}, datum: {}, ftCounter: 0, fidCounter: 0 };
|
|
5
6
|
export default function useDatumWithSpectraStatistics() {
|
|
6
|
-
const { data,
|
|
7
|
+
const { data, view: { spectra: { activeTab }, }, } = useChartData();
|
|
8
|
+
const activeSpectrum = useActiveSpectrum();
|
|
7
9
|
return useMemo(() => {
|
|
8
10
|
if (data) {
|
|
9
11
|
let info = {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export default function useExport(): {
|
|
2
2
|
saveToClipboardHandler: () => Promise<void>;
|
|
3
3
|
saveAsJSONHandler: (spaceIndent?: number, isCompressed?: boolean) => Promise<void>;
|
|
4
|
-
saveAsNMREHandler: () => Promise<void>;
|
|
5
4
|
saveAsSVGHandler: () => Promise<void>;
|
|
6
5
|
saveAsPNGHandler: () => Promise<void>;
|
|
7
6
|
saveAsHandler: () => Promise<void>;
|
|
@@ -6,8 +6,7 @@ import { useGlobal } from '../context/GlobalContext';
|
|
|
6
6
|
import { useAlert } from '../elements/popup/Alert';
|
|
7
7
|
import { positions, useModal } from '../elements/popup/Modal';
|
|
8
8
|
import SaveAsModal from '../modal/SaveAsModal';
|
|
9
|
-
import { copyPNGToClipboard, exportAsJSON,
|
|
10
|
-
import { nmriumToNmredata } from '../utility/nmriumToNmredata';
|
|
9
|
+
import { copyPNGToClipboard, exportAsJSON, exportAsPng, exportAsSVG, } from '../utility/Export';
|
|
11
10
|
export default function useExport() {
|
|
12
11
|
const { rootRef } = useGlobal();
|
|
13
12
|
const modal = useModal();
|
|
@@ -38,20 +37,6 @@ export default function useExport() {
|
|
|
38
37
|
}, 0);
|
|
39
38
|
}
|
|
40
39
|
}, [alert, state]);
|
|
41
|
-
const saveAsNMREHandler = useCallback(async () => {
|
|
42
|
-
if (state.data.length > 0) {
|
|
43
|
-
const hideLoading = await alert.showLoading('Exporting as NMRE process in progress');
|
|
44
|
-
setTimeout(() => {
|
|
45
|
-
async function handle() {
|
|
46
|
-
const fileName = state.data[0]?.display?.name;
|
|
47
|
-
const exportedData = await nmriumToNmredata(state);
|
|
48
|
-
exportAsNMRE(exportedData, fileName);
|
|
49
|
-
hideLoading();
|
|
50
|
-
}
|
|
51
|
-
void handle();
|
|
52
|
-
}, 0);
|
|
53
|
-
}
|
|
54
|
-
}, [alert, state]);
|
|
55
40
|
const saveAsSVGHandler = useCallback(async () => {
|
|
56
41
|
if (state.data.length > 0 && rootRef) {
|
|
57
42
|
const hideLoading = await alert.showLoading('Exporting as SVG process in progress');
|
|
@@ -100,7 +85,6 @@ export default function useExport() {
|
|
|
100
85
|
return {
|
|
101
86
|
saveToClipboardHandler,
|
|
102
87
|
saveAsJSONHandler,
|
|
103
|
-
saveAsNMREHandler,
|
|
104
88
|
saveAsSVGHandler,
|
|
105
89
|
saveAsPNGHandler,
|
|
106
90
|
saveAsHandler,
|
|
@@ -2,10 +2,12 @@ import { xyIntegral, xyReduce } from 'ml-spectra-processing';
|
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { getIntegralYScale } from '../1d/utilities/scale';
|
|
4
4
|
import { useChartData } from '../context/ChartContext';
|
|
5
|
+
import { useActiveSpectrum } from '../reducer/Reducer';
|
|
5
6
|
import { PathBuilder } from '../utility/PathBuilder';
|
|
6
7
|
import { useXScale } from './useXScale';
|
|
7
8
|
function useIntegralYDomain() {
|
|
8
|
-
const { height, margin, verticalAlign,
|
|
9
|
+
const { height, margin, verticalAlign, integralsYDomains } = useChartData();
|
|
10
|
+
const activeSpectrum = useActiveSpectrum();
|
|
9
11
|
return useMemo(() => getIntegralYScale({
|
|
10
12
|
height,
|
|
11
13
|
margin,
|
|
@@ -15,7 +17,8 @@ function useIntegralYDomain() {
|
|
|
15
17
|
}), [activeSpectrum, height, integralsYDomains, margin, verticalAlign]);
|
|
16
18
|
}
|
|
17
19
|
export default function useIntegralPath(integralOptions) {
|
|
18
|
-
const { data
|
|
20
|
+
const { data } = useChartData();
|
|
21
|
+
const activeSpectrum = useActiveSpectrum();
|
|
19
22
|
const scaleX = useXScale();
|
|
20
23
|
const scaleY = useIntegralYDomain();
|
|
21
24
|
const integral = useMemo(() => {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { useChartData } from '../context/ChartContext';
|
|
3
3
|
export default function useNucleus() {
|
|
4
|
-
const {
|
|
4
|
+
const { view: { spectra: { activeSpectra }, }, } = useChartData();
|
|
5
5
|
return useMemo(() => {
|
|
6
|
-
if (
|
|
7
|
-
return Object.keys(
|
|
6
|
+
if (activeSpectra && Object.keys(activeSpectra).length > 0) {
|
|
7
|
+
return Object.keys(activeSpectra);
|
|
8
8
|
}
|
|
9
9
|
return [];
|
|
10
|
-
}, [
|
|
10
|
+
}, [activeSpectra]);
|
|
11
11
|
}
|
|
@@ -2,7 +2,7 @@ import { useMemo } from 'react';
|
|
|
2
2
|
import { useChartData } from '../context/ChartContext';
|
|
3
3
|
import nucleusToString from '../utility/nucleusToString';
|
|
4
4
|
export default function useSpectraByActiveNucleus() {
|
|
5
|
-
const { data, activeTab } = useChartData();
|
|
5
|
+
const { data, view: { spectra: { activeTab }, }, } = useChartData();
|
|
6
6
|
return useMemo(() => {
|
|
7
7
|
if (data) {
|
|
8
8
|
return (data.filter((spectrum) => activeTab === nucleusToString(spectrum.info.nucleus)) || []);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { useChartData } from '../context/ChartContext';
|
|
3
|
+
import { useActiveSpectrum } from '../reducer/Reducer';
|
|
3
4
|
export default function useSpectrum(defaultValue) {
|
|
4
|
-
const { data
|
|
5
|
+
const { data } = useChartData();
|
|
6
|
+
const activeSpectrum = useActiveSpectrum();
|
|
5
7
|
return useMemo(() => {
|
|
6
8
|
if (data && activeSpectrum && activeSpectrum.id) {
|
|
7
9
|
const datum = data.find((datum) => datum.id === activeSpectrum.id) || defaultValue;
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
|
-
import
|
|
4
|
+
import { fileCollectionFromFileList } from 'filelist-utils';
|
|
5
5
|
import { useCallback } from 'react';
|
|
6
6
|
import { useDropzone } from 'react-dropzone';
|
|
7
7
|
import { FaUpload } from 'react-icons/fa';
|
|
8
8
|
import { useChartData } from '../context/ChartContext';
|
|
9
9
|
import { useDispatch } from '../context/DispatchContext';
|
|
10
10
|
import { LoaderProvider } from '../context/LoaderContext';
|
|
11
|
-
import { useAlert } from '../elements/popup/Alert';
|
|
12
11
|
import { useCheckToolsVisibility } from '../hooks/useCheckToolsVisibility';
|
|
13
|
-
import {
|
|
14
|
-
import { FILES_TYPES, FILES_SIGNATURES, getFileExtension, getFileSignature, loadFiles, loadFilesFromZip, } from '../utility/FileUtility';
|
|
12
|
+
import { SET_LOADING_FLAG, LOAD_DROP_FILES } from '../reducer/types/Types';
|
|
15
13
|
const style = css `
|
|
16
14
|
height: 100%;
|
|
17
15
|
background-color: #b5b5b599;
|
|
@@ -46,153 +44,23 @@ const containerStyle = css `
|
|
|
46
44
|
function DropZone(props) {
|
|
47
45
|
const { width, height } = useChartData();
|
|
48
46
|
const dispatch = useDispatch();
|
|
49
|
-
const alert = useAlert();
|
|
50
47
|
const isToolEnabled = useCheckToolsVisibility();
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
asBuffer: true,
|
|
64
|
-
});
|
|
65
|
-
if (selectedFilesByExtensions.length === 1) {
|
|
66
|
-
const decoder = new TextDecoder('utf8');
|
|
67
|
-
files[0].binary = decoder.decode(files[0].binary);
|
|
68
|
-
dispatch({ type: LOAD_JSON_FILE, files });
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
throw new Error('You can add only one json file');
|
|
72
|
-
}
|
|
73
|
-
break;
|
|
74
|
-
}
|
|
75
|
-
case FILES_TYPES.JDX:
|
|
76
|
-
case FILES_TYPES.DX: {
|
|
77
|
-
const files = await loadFilesFromZip(selectedFilesByExtensions, {
|
|
78
|
-
asBuffer: true,
|
|
79
|
-
});
|
|
80
|
-
dispatch({ type: LOAD_JCAMP_FILE, files });
|
|
81
|
-
break;
|
|
82
|
-
}
|
|
83
|
-
case FILES_TYPES.JDF: {
|
|
84
|
-
const files = await loadFilesFromZip(selectedFilesByExtensions, {
|
|
85
|
-
asBuffer: true,
|
|
86
|
-
});
|
|
87
|
-
dispatch({ type: LOAD_JDF_FILE, files });
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
default:
|
|
91
|
-
break;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
48
|
+
const loadFilesHandler = useCallback((files) => {
|
|
49
|
+
files.forEach((file) => {
|
|
50
|
+
Object.defineProperty(file, 'webkitRelativePath', { value: file.path });
|
|
51
|
+
});
|
|
52
|
+
fileCollectionFromFileList(files)
|
|
53
|
+
.then((fileCollection) => {
|
|
54
|
+
dispatch({ type: LOAD_DROP_FILES, fileCollection });
|
|
55
|
+
})
|
|
56
|
+
.catch((e) => {
|
|
57
|
+
dispatch({ type: SET_LOADING_FLAG, isLoading: false });
|
|
58
|
+
reportError(e);
|
|
59
|
+
});
|
|
94
60
|
}, [dispatch]);
|
|
95
|
-
const loadFilesHandler = useCallback(async (files) => {
|
|
96
|
-
const uniqueFileExtensions = [
|
|
97
|
-
...new Set(files.map((file) => getFileExtension(file.name))),
|
|
98
|
-
];
|
|
99
|
-
for (let extension of uniqueFileExtensions) {
|
|
100
|
-
const selectedFilesByExtensions = files.filter((file) => getFileExtension(file.name) === extension);
|
|
101
|
-
try {
|
|
102
|
-
switch (extension) {
|
|
103
|
-
case FILES_TYPES.MOL: {
|
|
104
|
-
const files = await loadFiles(selectedFilesByExtensions);
|
|
105
|
-
dispatch({ type: LOAD_MOL_FILE, files });
|
|
106
|
-
break;
|
|
107
|
-
}
|
|
108
|
-
case FILES_TYPES.NMRIUM:
|
|
109
|
-
case FILES_TYPES.JSON:
|
|
110
|
-
if (selectedFilesByExtensions.length === 1) {
|
|
111
|
-
const files = await loadFiles(selectedFilesByExtensions, {
|
|
112
|
-
asBuffer: true,
|
|
113
|
-
});
|
|
114
|
-
// InputFileFormat
|
|
115
|
-
const fileSignature = getFileSignature(files[0].binary);
|
|
116
|
-
if (fileSignature === FILES_SIGNATURES.ZIP) {
|
|
117
|
-
const unzipResult = await Zip.loadAsync(files[0].binary);
|
|
118
|
-
await loadSubFilesFromZip(Object.values(unzipResult.files), [
|
|
119
|
-
FILES_TYPES.NMRIUM,
|
|
120
|
-
]);
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
const decoder = new TextDecoder('utf8');
|
|
124
|
-
files[0].binary = decoder.decode(files[0].binary);
|
|
125
|
-
dispatch({ type: LOAD_JSON_FILE, files });
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
throw new Error('You can add only one json file');
|
|
130
|
-
}
|
|
131
|
-
break;
|
|
132
|
-
case FILES_TYPES.JDX:
|
|
133
|
-
case FILES_TYPES.DX: {
|
|
134
|
-
const files = await loadFiles(selectedFilesByExtensions, {
|
|
135
|
-
asBuffer: true,
|
|
136
|
-
});
|
|
137
|
-
dispatch({ type: LOAD_JCAMP_FILE, files });
|
|
138
|
-
break;
|
|
139
|
-
}
|
|
140
|
-
case FILES_TYPES.JDF: {
|
|
141
|
-
const files = await loadFiles(selectedFilesByExtensions, {
|
|
142
|
-
asBuffer: true,
|
|
143
|
-
});
|
|
144
|
-
dispatch({ type: LOAD_JDF_FILE, files });
|
|
145
|
-
break;
|
|
146
|
-
}
|
|
147
|
-
case FILES_TYPES.ZIP: {
|
|
148
|
-
const files = await loadFiles(selectedFilesByExtensions, {
|
|
149
|
-
asBuffer: true,
|
|
150
|
-
});
|
|
151
|
-
for (const zipFile of files) {
|
|
152
|
-
const unzipResult = await Zip.loadAsync(zipFile.binary);
|
|
153
|
-
const uniqueFileExtensions = [
|
|
154
|
-
...new Set(Object.values(unzipResult.files).map((file) => getFileExtension(file.name))),
|
|
155
|
-
];
|
|
156
|
-
const isNotZip = uniqueFileExtensions.some((ex) => FILES_TYPES[ex.toUpperCase()] && ex !== FILES_TYPES.ZIP);
|
|
157
|
-
if (isNotZip) {
|
|
158
|
-
const hasBruker = Object.keys(unzipResult.files).some((path) => {
|
|
159
|
-
return ['2rr', 'fid', '1r'].some((brukerFile) => path.endsWith(brukerFile));
|
|
160
|
-
});
|
|
161
|
-
if (hasBruker)
|
|
162
|
-
dispatch({ type: LOAD_ZIP_FILE, files });
|
|
163
|
-
await loadSubFilesFromZip(Object.values(unzipResult.files), uniqueFileExtensions);
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
dispatch({ type: LOAD_ZIP_FILE, files });
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
break;
|
|
170
|
-
}
|
|
171
|
-
case FILES_TYPES.NMREDATA:
|
|
172
|
-
void loadFiles(selectedFilesByExtensions, {
|
|
173
|
-
asBuffer: true,
|
|
174
|
-
}).then(async (files) => {
|
|
175
|
-
for (const zipFile of files) {
|
|
176
|
-
dispatch({
|
|
177
|
-
type: LOAD_NMREDATA_FILE,
|
|
178
|
-
file: zipFile,
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
break;
|
|
183
|
-
default:
|
|
184
|
-
throw new Error('The file extension must be zip, dx, jdx, json, mol, nmredata or nmrium.');
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
catch (e) {
|
|
188
|
-
dispatch({ type: SET_LOADING_FLAG, isLoading: false });
|
|
189
|
-
alert.error(e.message);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}, [alert, dispatch, loadSubFilesFromZip]);
|
|
193
61
|
const onDrop = useCallback((droppedFiles) => {
|
|
194
62
|
dispatch({ type: SET_LOADING_FLAG, isLoading: true });
|
|
195
|
-
|
|
63
|
+
loadFilesHandler(droppedFiles);
|
|
196
64
|
}, [dispatch, loadFilesHandler]);
|
|
197
65
|
const isImportEnabled = isToolEnabled('import');
|
|
198
66
|
const { getRootProps, getInputProps, isDragActive, open: openImportDialog, } = useDropzone({
|
|
@@ -41,7 +41,7 @@ const styles = css `
|
|
|
41
41
|
export default function SelectMolecule(props) {
|
|
42
42
|
const [currentIndex, setCurrentIndex] = useState();
|
|
43
43
|
const { setFieldValue, errors, values } = useFormikContext();
|
|
44
|
-
const { molecules, activeTab } = useChartData();
|
|
44
|
+
const { molecules, view: { spectra: { activeTab }, }, } = useChartData();
|
|
45
45
|
const element = getAtom(activeTab);
|
|
46
46
|
const newSum = useMemo(() => {
|
|
47
47
|
return element &&
|
|
@@ -51,7 +51,7 @@ const styles = css `
|
|
|
51
51
|
`;
|
|
52
52
|
function EditRangeModal({ onSaveEditRangeModal = () => null, onCloseEditRangeModal = () => null, onZoomEditRangeModal = () => null, manualRange = false, range: originRange, }) {
|
|
53
53
|
const formRef = useRef(null);
|
|
54
|
-
const { activeTab } = useChartData();
|
|
54
|
+
const { view: { spectra: { activeTab }, }, } = useChartData();
|
|
55
55
|
const dispatch = useDispatch();
|
|
56
56
|
const rangesPreferences = usePanelPreferences('ranges', activeTab);
|
|
57
57
|
const validation = useRangeFormValidation();
|
|
@@ -2,6 +2,6 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import Label from '../../elements/Label';
|
|
3
3
|
import FormikInput from '../../elements/formik/FormikInput';
|
|
4
4
|
function GeneralTabContent() {
|
|
5
|
-
return (_jsxs(_Fragment, { children: [_jsx("p", { className: "section-header", children: "Spectra" }), _jsx(Label, { title: "
|
|
5
|
+
return (_jsxs(_Fragment, { children: [_jsx("p", { className: "section-header", children: "Spectra" }), _jsx(Label, { title: "Opacity of dimmed spectra [ 0 - 1 ]", children: _jsx(FormikInput, { name: "general.dimmedSpectraOpacity", checkValue: (value) => value >= 0 && value <= 1, type: "number" }) })] }));
|
|
6
6
|
}
|
|
7
7
|
export default GeneralTabContent;
|
|
@@ -110,7 +110,7 @@ function IntegralPanelInner({ integrals, info, activeTab, xDomain, }) {
|
|
|
110
110
|
const MemoizedIntegralPanel = memo(IntegralPanelInner);
|
|
111
111
|
const emptyData = { integrals: {}, info: {} };
|
|
112
112
|
export default function IntegralPanel() {
|
|
113
|
-
const { xDomain, activeTab } = useChartData();
|
|
113
|
+
const { xDomain, view: { spectra: { activeTab }, }, } = useChartData();
|
|
114
114
|
const { integrals, info } = useSpectrum(emptyData);
|
|
115
115
|
return (_jsx(MemoizedIntegralPanel, { ...{
|
|
116
116
|
integrals,
|
|
@@ -34,5 +34,5 @@ export default function MoleculeHeader(props) {
|
|
|
34
34
|
const label = event.target.value;
|
|
35
35
|
dispatch({ type: CHANGE_MOLECULE_LABEL, payload: { label, id } });
|
|
36
36
|
}, [dispatch]);
|
|
37
|
-
return (_jsxs("div", { style: styles.toolbar, children: [_jsxs("div", { style: { display: 'flex' }, children: [_jsx("span", { children: "Label" }), _jsx(EditableColumn, { value: currentMolecule.label, style: styles.labelInput, validate: validateLabel, onSave: (event) => saveLabelHandler(currentMolecule.id, event) })] }), _jsxs("span", { children: [_jsx(MF, { mf: currentMolecule.mf }), " - ", currentMolecule.mw?.toFixed(2)] })] }));
|
|
37
|
+
return (_jsxs("div", { style: styles.toolbar, children: [_jsxs("div", { style: { display: 'flex' }, children: [_jsx("span", { children: "Label" }), _jsx(EditableColumn, { value: currentMolecule.label, style: styles.labelInput, validate: validateLabel, onSave: (event) => saveLabelHandler(currentMolecule.id, event), textOverFlowEllipses: true })] }), _jsxs("span", { children: [_jsx(MF, { mf: currentMolecule.mf }), " - ", currentMolecule.mw?.toFixed(2)] })] }));
|
|
38
38
|
}
|
|
@@ -87,7 +87,7 @@ function MoleculePanelInner({ zones, ranges, molecules: moleculesProp, floatingM
|
|
|
87
87
|
const MemoizedMoleculePanel = memo(MoleculePanelInner);
|
|
88
88
|
const emptyData = { ranges: {}, zones: {} };
|
|
89
89
|
export default function MoleculePanel({ onMoleculeChange, children, actionsOptions, emptyTextStyle, }) {
|
|
90
|
-
const { molecules, view: { floatingMolecules },
|
|
90
|
+
const { molecules, view: { floatingMolecules, spectra: { activeTab }, }, displayerMode, } = useChartData();
|
|
91
91
|
const data = useSpectrum(emptyData);
|
|
92
92
|
const ranges = data?.ranges || {};
|
|
93
93
|
const zones = data?.zones || {};
|
|
@@ -82,7 +82,7 @@ function MultipleSpectraAnalysisPanelInner({ activeTab, spectraAnalysis, }) {
|
|
|
82
82
|
}
|
|
83
83
|
const MemoizedMultipleSpectraAnalysisPanel = memo(MultipleSpectraAnalysisPanelInner);
|
|
84
84
|
export default function MultipleSpectraAnalysisPanel() {
|
|
85
|
-
const { activeTab, spectraAnalysis, displayerKey } = useChartData();
|
|
85
|
+
const { view: { spectra: { activeTab }, }, spectraAnalysis, displayerKey, } = useChartData();
|
|
86
86
|
if (!activeTab) {
|
|
87
87
|
return _jsx("div", {});
|
|
88
88
|
}
|
|
@@ -109,7 +109,7 @@ function PeaksPanelInner({ peaks, info, xDomain, activeTab, peaksOptions, }) {
|
|
|
109
109
|
const MemoizedPeaksPanel = memo(PeaksPanelInner);
|
|
110
110
|
const emptyData = { peaks: null, info: {} };
|
|
111
111
|
export default function PeaksPanel() {
|
|
112
|
-
const { xDomain, activeTab, toolOptions: { data: { peaksOptions }, }, } = useChartData();
|
|
112
|
+
const { xDomain, view: { spectra: { activeTab }, }, toolOptions: { data: { peaksOptions }, }, } = useChartData();
|
|
113
113
|
const { peaks, info } = useSpectrum(emptyData);
|
|
114
114
|
const preferences = usePreferences();
|
|
115
115
|
return (_jsx(MemoizedPeaksPanel, { ...{ peaks, info, xDomain, activeTab, preferences, peaksOptions } }));
|
|
@@ -36,7 +36,7 @@ function PeaksTable({ activeTab, data }) {
|
|
|
36
36
|
});
|
|
37
37
|
}, [modal, peaksPreferences]);
|
|
38
38
|
const saveDeltaPPMRefsHandler = useCallback((event, row) => {
|
|
39
|
-
const shiftValue = parseFloat(event.target.value) - parseFloat(row.
|
|
39
|
+
const shiftValue = parseFloat(event.target.value) - parseFloat(row.x);
|
|
40
40
|
dispatch({ type: SHIFT_SPECTRUM, shiftValue });
|
|
41
41
|
}, [dispatch]);
|
|
42
42
|
const COLUMNS = useMemo(() => [
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
declare function RangesHeader({ ranges, info, onUnlink, onFilterActivated, onSettingClick, isFilterActive, filterCounter, showMultiplicityTrees, showJGraph, showRangesIntegrals, activeTab, }: {
|
|
1
|
+
declare function RangesHeader({ id, ranges, info, onUnlink, onFilterActivated, onSettingClick, isFilterActive, filterCounter, showMultiplicityTrees, showJGraph, showRangesIntegrals, activeTab, }: {
|
|
2
|
+
id: any;
|
|
2
3
|
ranges: any;
|
|
3
4
|
info: any;
|
|
4
5
|
onUnlink: any;
|