nmrium 0.20.2 → 0.23.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/ExclusionZonesAnnotations.js +1 -2
- package/lib/component/1d/FooterBanner.js +1 -1
- package/lib/component/1d/Integral.js +1 -6
- package/lib/component/1d/Viewer1D.js +4 -4
- package/lib/component/1d/ranges/RangeIntegral.js +2 -6
- package/lib/component/1d/utilities/scale.d.ts +1 -1
- package/lib/component/1d/utilities/scale.js +7 -6
- package/lib/component/2d/Viewer2D.js +5 -5
- package/lib/component/EventsTrackers/KeysListenerTracker.js +98 -81
- package/lib/component/NMRium.d.ts +10 -6
- package/lib/component/NMRium.js +3 -9
- package/lib/component/elements/EditableColumn.d.ts +1 -1
- package/lib/component/header/Header.js +13 -10
- package/lib/component/hooks/useCheckExperimentalFeature.js +2 -1
- package/lib/component/hooks/useCheckToolsVisibility.d.ts +1 -0
- package/lib/component/hooks/useCheckToolsVisibility.js +6 -0
- package/lib/component/{1d/utilities → hooks}/useIntegralPath.d.ts +0 -0
- package/lib/component/hooks/useIntegralPath.js +53 -0
- package/lib/component/hooks/useToolsFunctions.js +6 -6
- package/lib/component/hooks/useXScale.d.ts +2 -0
- package/lib/component/hooks/useXScale.js +7 -0
- package/lib/component/loader/DropZone.js +87 -87
- package/lib/component/modal/PredictSpectraModal.d.ts +0 -28
- package/lib/component/modal/PredictSpectraModal.js +2 -32
- package/lib/component/modal/changeSum/ChangeSumModal.js +4 -2
- package/lib/component/modal/editRange/forms/validation/EditRangeValidation.js +1 -1
- package/lib/component/modal/editZone/EditPathLengthFormik.d.ts +5 -0
- package/lib/component/modal/editZone/EditPathLengthFormik.js +72 -0
- package/lib/component/modal/editZone/EditZoneModal.d.ts +8 -0
- package/lib/component/modal/editZone/EditZoneModal.js +96 -0
- package/lib/component/modal/editZone/SignalFormTab.d.ts +6 -0
- package/lib/component/modal/editZone/SignalFormTab.js +6 -0
- package/lib/component/modal/editZone/SignalsForm.d.ts +2 -0
- package/lib/component/modal/editZone/SignalsForm.js +62 -0
- package/lib/component/modal/editZone/validation/EditZoneValidation.d.ts +534 -0
- package/lib/component/modal/editZone/validation/EditZoneValidation.js +17 -0
- package/lib/component/modal/editZone/validation/isDefaultPathLength.d.ts +3 -0
- package/lib/component/modal/editZone/validation/isDefaultPathLength.js +7 -0
- package/lib/component/modal/setting/ControllersTabContent.js +1 -1
- package/lib/component/modal/setting/DisplayTabContent.js +5 -1
- package/lib/component/modal/setting/GeneralSettings.d.ts +1 -2
- package/lib/component/modal/setting/GeneralSettings.js +13 -9
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.d.ts +2 -0
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +13 -0
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.d.ts +7 -0
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +38 -0
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +0 -3
- package/lib/component/panels/IntegralsPanel/IntegralsPreferences.js +4 -17
- package/lib/component/panels/MoleculesPanel/MoleculePanel.d.ts +10 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +27 -17
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts +9 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -2
- package/lib/component/panels/Panels.d.ts +1 -1
- package/lib/component/panels/Panels.js +17 -14
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +0 -3
- package/lib/component/panels/PeaksPanel/PeaksPreferences.js +5 -14
- package/lib/component/panels/RangesPanel/RangesPanel.js +2 -5
- package/lib/component/panels/RangesPanel/RangesPreferences.js +5 -18
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +13 -3
- package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +7 -2
- package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +7 -2
- package/lib/component/panels/SummaryPanel/CorrelationTable/Constants.d.ts +1 -6
- package/lib/component/panels/SummaryPanel/CorrelationTable/Constants.js +1 -7
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.d.ts +2 -3
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.js +4 -5
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.d.ts +2 -3
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +21 -25
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +24 -30
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.d.ts +8 -0
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.js +89 -0
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.d.ts +1 -1
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -1
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +39 -42
- package/lib/component/panels/SummaryPanel/utilities/IsInView.d.ts +6 -0
- package/lib/component/panels/SummaryPanel/utilities/IsInView.js +16 -0
- package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +29 -0
- package/lib/component/panels/SummaryPanel/{Utilities.js → utilities/Utilities.js} +155 -19
- package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.d.ts +1 -0
- package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +26 -3
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +12 -7
- package/lib/component/panels/ZonesPanel/ZonesPreferences.js +5 -18
- package/lib/component/panels/ZonesPanel/ZonesTable.d.ts +3 -2
- package/lib/component/panels/ZonesPanel/ZonesTable.js +5 -2
- package/lib/component/panels/databasePanel/DatabasePanel.js +0 -3
- package/lib/component/panels/databasePanel/DatabasePreferences.js +4 -17
- package/lib/component/panels/predictionPanel/PredictionOptions.d.ts +6 -0
- package/lib/component/panels/predictionPanel/PredictionOptions.js +88 -0
- package/lib/component/panels/predictionPanel/PredictionPanel.d.ts +2 -0
- package/lib/component/panels/predictionPanel/PredictionPanel.js +33 -0
- package/lib/component/reducer/IgnoreActions.js +2 -1
- package/lib/component/reducer/Reducer.d.ts +9 -23
- package/lib/component/reducer/Reducer.js +7 -8
- package/lib/component/reducer/actions/DatabaseActions.js +1 -1
- package/lib/component/reducer/actions/DomainActions.d.ts +3 -1
- package/lib/component/reducer/actions/DomainActions.js +20 -1
- package/lib/component/reducer/actions/IntegralsActions.js +2 -0
- package/lib/component/reducer/actions/LoadActions.js +29 -1
- package/lib/component/reducer/actions/MoleculeActions.js +1 -1
- package/lib/component/reducer/actions/PreferencesActions.js +0 -2
- package/lib/component/reducer/actions/RangesActions.js +3 -1
- package/lib/component/reducer/actions/SpectrumsActions.js +1 -1
- package/lib/component/reducer/actions/ToolsActions.js +43 -56
- package/lib/component/reducer/actions/ZonesActions.d.ts +3 -1
- package/lib/component/reducer/actions/ZonesActions.js +33 -2
- package/lib/component/reducer/helper/Zoom1DManager.d.ts +17 -21
- package/lib/component/reducer/helper/Zoom1DManager.js +53 -69
- package/lib/component/reducer/helper/ZoomHistoryManager.d.ts +1 -0
- package/lib/component/reducer/helper/ZoomHistoryManager.js +2 -1
- package/lib/component/reducer/preferencesReducer.d.ts +3 -8
- package/lib/component/reducer/preferencesReducer.js +86 -37
- package/lib/component/reducer/types/Types.d.ts +3 -1
- package/lib/component/reducer/types/Types.js +3 -1
- package/lib/component/toolbar/FunctionToolBar.js +7 -10
- package/lib/component/toolbar/ToolTypes.js +3 -3
- package/lib/component/workspaces/Workspace.d.ts +6 -0
- package/lib/component/workspaces/Workspace.js +1 -0
- package/lib/component/workspaces/basic.d.ts +2 -0
- package/lib/component/workspaces/basic.js +46 -0
- package/lib/component/workspaces/exercise1D.d.ts +2 -0
- package/lib/component/workspaces/exercise1D.js +46 -0
- package/lib/component/workspaces/index.d.ts +6 -0
- package/lib/component/workspaces/index.js +4 -0
- package/lib/component/workspaces/process1D.d.ts +2 -0
- package/lib/component/workspaces/process1D.js +44 -0
- package/lib/data/PredictionManager.d.ts +35 -3
- package/lib/data/PredictionManager.js +45 -7
- package/lib/data/constants/DefaultPathLengths.d.ts +6 -0
- package/lib/data/constants/DefaultPathLengths.js +8 -0
- package/lib/data/data1d/Spectrum1D/getSpectrumErrorValue.d.ts +2 -0
- package/lib/data/data1d/Spectrum1D/getSpectrumErrorValue.js +4 -0
- package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +7 -19
- package/lib/data/data1d/Spectrum1D/integrals/initiateIntegrals.d.ts +11 -0
- package/lib/data/data1d/Spectrum1D/integrals/initiateIntegrals.js +11 -0
- package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +2 -21
- package/lib/data/data1d/Spectrum1D/peaks/initiatePeaks.d.ts +9 -0
- package/lib/data/data1d/Spectrum1D/peaks/initiatePeaks.js +7 -0
- package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.d.ts +2 -0
- package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.js +29 -0
- package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +13 -0
- package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.js +14 -0
- package/lib/data/data1d/Spectrum1D/ranges/mapRanges.js +13 -8
- package/lib/data/migration/MigrationManager.js +3 -0
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +1 -2
- package/lib-cjs/component/1d/FooterBanner.js +1 -1
- package/lib-cjs/component/1d/Integral.js +1 -6
- package/lib-cjs/component/1d/Viewer1D.js +4 -4
- package/lib-cjs/component/1d/ranges/RangeIntegral.js +2 -6
- package/lib-cjs/component/1d/utilities/scale.js +7 -6
- package/lib-cjs/component/2d/Viewer2D.js +4 -4
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +98 -81
- package/lib-cjs/component/NMRium.js +3 -10
- package/lib-cjs/component/header/Header.js +13 -10
- package/lib-cjs/component/hooks/useCheckExperimentalFeature.js +5 -1
- package/lib-cjs/component/hooks/useCheckToolsVisibility.js +13 -0
- package/lib-cjs/component/hooks/useIntegralPath.js +56 -0
- package/lib-cjs/component/hooks/useToolsFunctions.js +6 -6
- package/lib-cjs/component/hooks/useXScale.js +11 -0
- package/lib-cjs/component/loader/DropZone.js +87 -87
- package/lib-cjs/component/modal/PredictSpectraModal.js +3 -33
- package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +4 -2
- package/lib-cjs/component/modal/editRange/forms/validation/EditRangeValidation.js +1 -1
- package/lib-cjs/component/modal/editZone/EditPathLengthFormik.js +77 -0
- package/lib-cjs/component/modal/editZone/EditZoneModal.js +101 -0
- package/lib-cjs/component/modal/editZone/SignalFormTab.js +11 -0
- package/lib-cjs/component/modal/editZone/SignalsForm.js +67 -0
- package/lib-cjs/component/modal/editZone/validation/EditZoneValidation.js +38 -0
- package/lib-cjs/component/modal/editZone/validation/isDefaultPathLength.js +12 -0
- package/lib-cjs/component/modal/setting/ControllersTabContent.js +1 -1
- package/lib-cjs/component/modal/setting/DisplayTabContent.js +5 -1
- package/lib-cjs/component/modal/setting/GeneralSettings.js +12 -8
- package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignment.js +18 -0
- package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +43 -0
- package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +0 -3
- package/lib-cjs/component/panels/IntegralsPanel/IntegralsPreferences.js +3 -16
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +27 -17
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -2
- package/lib-cjs/component/panels/Panels.js +18 -15
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +0 -3
- package/lib-cjs/component/panels/PeaksPanel/PeaksPreferences.js +4 -13
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +2 -5
- package/lib-cjs/component/panels/RangesPanel/RangesPreferences.js +4 -17
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +13 -3
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +7 -2
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +7 -2
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/Constants.js +1 -8
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.js +4 -5
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +21 -25
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +43 -30
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.js +94 -0
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -1
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +38 -41
- package/lib-cjs/component/panels/SummaryPanel/utilities/IsInView.js +18 -0
- package/lib-cjs/component/panels/SummaryPanel/{Utilities.js → utilities/Utilities.js} +157 -19
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +24 -1
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +12 -7
- package/lib-cjs/component/panels/ZonesPanel/ZonesPreferences.js +4 -17
- package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +5 -2
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +0 -3
- package/lib-cjs/component/panels/databasePanel/DatabasePreferences.js +3 -16
- package/lib-cjs/component/panels/predictionPanel/PredictionOptions.js +112 -0
- package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +39 -0
- package/lib-cjs/component/reducer/IgnoreActions.js +2 -1
- package/lib-cjs/component/reducer/Reducer.js +7 -8
- package/lib-cjs/component/reducer/actions/DatabaseActions.js +2 -2
- package/lib-cjs/component/reducer/actions/DomainActions.js +21 -1
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +2 -0
- package/lib-cjs/component/reducer/actions/LoadActions.js +29 -1
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +1 -1
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +0 -2
- package/lib-cjs/component/reducer/actions/RangesActions.js +2 -0
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +2 -2
- package/lib-cjs/component/reducer/actions/ToolsActions.js +50 -63
- package/lib-cjs/component/reducer/actions/ZonesActions.js +35 -2
- package/lib-cjs/component/reducer/helper/Zoom1DManager.js +55 -73
- package/lib-cjs/component/reducer/helper/ZoomHistoryManager.js +2 -1
- package/lib-cjs/component/reducer/preferencesReducer.js +87 -38
- package/lib-cjs/component/reducer/types/Types.js +6 -4
- package/lib-cjs/component/toolbar/FunctionToolBar.js +7 -10
- package/lib-cjs/component/toolbar/ToolTypes.js +3 -3
- package/lib-cjs/component/workspaces/Workspace.js +2 -0
- package/lib-cjs/component/workspaces/basic.js +49 -0
- package/lib-cjs/component/workspaces/exercise1D.js +49 -0
- package/lib-cjs/component/workspaces/index.js +6 -0
- package/lib-cjs/component/workspaces/process1D.js +47 -0
- package/lib-cjs/data/PredictionManager.js +46 -8
- package/lib-cjs/data/constants/DefaultPathLengths.js +10 -0
- package/lib-cjs/data/data1d/Spectrum1D/getSpectrumErrorValue.js +8 -0
- package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +7 -19
- package/lib-cjs/data/data1d/Spectrum1D/integrals/initiateIntegrals.js +18 -0
- package/lib-cjs/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +2 -21
- package/lib-cjs/data/data1d/Spectrum1D/peaks/initiatePeaks.js +14 -0
- package/lib-cjs/data/data1d/Spectrum1D/peaks/mapPeaks.js +36 -0
- package/lib-cjs/data/data1d/Spectrum1D/ranges/initiateRanges.js +21 -0
- package/lib-cjs/data/data1d/Spectrum1D/ranges/mapRanges.js +13 -8
- package/lib-cjs/data/migration/MigrationManager.js +3 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +1 -1
- package/lib/component/1d/utilities/useIntegralPath.js +0 -63
- package/lib/component/nmriumMode/basic.d.ts +0 -38
- package/lib/component/nmriumMode/basic.js +0 -37
- package/lib/component/nmriumMode/exercise1D.d.ts +0 -38
- package/lib/component/nmriumMode/exercise1D.js +0 -37
- package/lib/component/nmriumMode/process1D.d.ts +0 -38
- package/lib/component/nmriumMode/process1D.js +0 -37
- package/lib/component/panels/SummaryPanel/Utilities.d.ts +0 -25
- package/lib/component/reducer/actions/Zoom.d.ts +0 -16
- package/lib/component/reducer/actions/Zoom.js +0 -92
- package/lib-cjs/component/1d/utilities/useIntegralPath.js +0 -66
- package/lib-cjs/component/nmriumMode/basic.js +0 -39
- package/lib-cjs/component/nmriumMode/exercise1D.js +0 -39
- package/lib-cjs/component/nmriumMode/process1D.js +0 -39
- package/lib-cjs/component/reducer/actions/Zoom.js +0 -116
|
@@ -4,8 +4,8 @@ import lodashMap from 'lodash/map';
|
|
|
4
4
|
import { useCallback, useRef, useState } from 'react';
|
|
5
5
|
import { useDispatch } from '../context/DispatchContext';
|
|
6
6
|
import { useAlert } from '../elements/popup/Alert';
|
|
7
|
-
import {
|
|
8
|
-
import { ZoomType } from '../reducer/
|
|
7
|
+
import { TOOLS_PANELS_ACCORDION } from '../panels/Panels';
|
|
8
|
+
import { ZoomType } from '../reducer/helper/Zoom1DManager';
|
|
9
9
|
import { CHANGE_SPECTRUM_DISPLAY_VIEW_MODE, FULL_ZOOM_OUT, SET_SELECTED_TOOL, SET_SPECTRUMS_VERTICAL_ALIGN, TOGGLE_REAL_IMAGINARY_VISIBILITY, } from '../reducer/types/Types';
|
|
10
10
|
import { options } from '../toolbar/ToolTypes';
|
|
11
11
|
export default function useToolsFunctions() {
|
|
@@ -19,12 +19,12 @@ export default function useToolsFunctions() {
|
|
|
19
19
|
options.peakPicking.id,
|
|
20
20
|
options.integral.id,
|
|
21
21
|
options.zone2D.id,
|
|
22
|
+
options.exclusionZones.id,
|
|
22
23
|
].includes(selectedTool)) {
|
|
23
|
-
alert.show('Press Shift + Left Mouse button to select zone
|
|
24
|
+
alert.show('Press Shift + Left Mouse button to select zone');
|
|
24
25
|
}
|
|
25
|
-
if (
|
|
26
|
-
|
|
27
|
-
openPanel(PANELS_ACCORDION[selectedTool]);
|
|
26
|
+
if (Object.keys(TOOLS_PANELS_ACCORDION).includes(selectedTool)) {
|
|
27
|
+
openPanel(TOOLS_PANELS_ACCORDION[selectedTool]);
|
|
28
28
|
}
|
|
29
29
|
dispatch({
|
|
30
30
|
type: SET_SELECTED_TOOL,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { getXScale } from '../1d/utilities/scale';
|
|
3
|
+
import { useChartData } from '../context/ChartContext';
|
|
4
|
+
export function useXScale() {
|
|
5
|
+
const { width, margin, xDomains, xDomain, mode } = useChartData();
|
|
6
|
+
return useMemo(() => getXScale({ width, margin, xDomains, xDomain, mode }), [margin, mode, width, xDomain, xDomains]);
|
|
7
|
+
}
|
|
@@ -8,6 +8,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';
|
|
11
12
|
import { LOAD_MOL_FILE, LOAD_JSON_FILE, LOAD_JCAMP_FILE, SET_LOADING_FLAG, LOAD_ZIP_FILE, LOAD_JDF_FILE, LOAD_NMREDATA_FILE, } from '../reducer/types/Types';
|
|
12
13
|
import { FILES_TYPES, FILES_SIGNATURES, getFileExtension, getFileSignature, loadFiles, loadFilesFromZip, } from '../utility/FileUtility';
|
|
13
14
|
const style = css `
|
|
@@ -44,72 +45,75 @@ const containerStyle = css `
|
|
|
44
45
|
function DropZone(props) {
|
|
45
46
|
const { width, height } = useChartData();
|
|
46
47
|
const dispatch = useDispatch();
|
|
47
|
-
const
|
|
48
|
+
const alert = useAlert();
|
|
49
|
+
const loadSubFilesFromZip = useCallback(async (extractedfiles, uniqueFileExtensions) => {
|
|
48
50
|
for (let extension of uniqueFileExtensions) {
|
|
49
51
|
const selectedFilesByExtensions = extractedfiles.filter((file) => getFileExtension(file.name) === extension);
|
|
50
52
|
switch (extension) {
|
|
51
|
-
case FILES_TYPES.MOL:
|
|
52
|
-
|
|
53
|
+
case FILES_TYPES.MOL: {
|
|
54
|
+
const files = await loadFilesFromZip(selectedFilesByExtensions);
|
|
55
|
+
dispatch({ type: LOAD_MOL_FILE, files });
|
|
53
56
|
break;
|
|
57
|
+
}
|
|
54
58
|
case FILES_TYPES.NMRIUM:
|
|
55
|
-
case FILES_TYPES.JSON:
|
|
56
|
-
|
|
59
|
+
case FILES_TYPES.JSON: {
|
|
60
|
+
const files = await loadFilesFromZip(selectedFilesByExtensions, {
|
|
57
61
|
asBuffer: true,
|
|
58
|
-
}).then((files) => {
|
|
59
|
-
if (selectedFilesByExtensions.length === 1) {
|
|
60
|
-
const decoder = new TextDecoder('utf8');
|
|
61
|
-
files[0].binary = decoder.decode(files[0].binary);
|
|
62
|
-
dispatch({ type: LOAD_JSON_FILE, files });
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
dispatch({ type: SET_LOADING_FLAG, isLoading: false });
|
|
66
|
-
// eslint-disable-next-line no-alert
|
|
67
|
-
alert('You can add only one json file');
|
|
68
|
-
}
|
|
69
62
|
});
|
|
63
|
+
if (selectedFilesByExtensions.length === 1) {
|
|
64
|
+
const decoder = new TextDecoder('utf8');
|
|
65
|
+
files[0].binary = decoder.decode(files[0].binary);
|
|
66
|
+
dispatch({ type: LOAD_JSON_FILE, files });
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
throw new Error('You can add only one json file');
|
|
70
|
+
}
|
|
70
71
|
break;
|
|
72
|
+
}
|
|
71
73
|
case FILES_TYPES.JDX:
|
|
72
|
-
case FILES_TYPES.DX:
|
|
73
|
-
|
|
74
|
+
case FILES_TYPES.DX: {
|
|
75
|
+
const files = await loadFilesFromZip(selectedFilesByExtensions, {
|
|
74
76
|
asBuffer: true,
|
|
75
|
-
})
|
|
77
|
+
});
|
|
78
|
+
dispatch({ type: LOAD_JCAMP_FILE, files });
|
|
76
79
|
break;
|
|
77
|
-
|
|
78
|
-
|
|
80
|
+
}
|
|
81
|
+
case FILES_TYPES.JDF: {
|
|
82
|
+
const files = await loadFilesFromZip(selectedFilesByExtensions, {
|
|
79
83
|
asBuffer: true,
|
|
80
|
-
})
|
|
84
|
+
});
|
|
85
|
+
dispatch({ type: LOAD_JDF_FILE, files });
|
|
81
86
|
break;
|
|
87
|
+
}
|
|
82
88
|
default:
|
|
83
89
|
break;
|
|
84
90
|
}
|
|
85
91
|
}
|
|
86
92
|
}, [dispatch]);
|
|
87
|
-
const loadFilesHandler = useCallback((files) => {
|
|
93
|
+
const loadFilesHandler = useCallback(async (files) => {
|
|
88
94
|
const uniqueFileExtensions = [
|
|
89
95
|
...new Set(files.map((file) => getFileExtension(file.name))),
|
|
90
96
|
];
|
|
91
97
|
for (let extension of uniqueFileExtensions) {
|
|
92
98
|
const selectedFilesByExtensions = files.filter((file) => getFileExtension(file.name) === extension);
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
99
|
+
try {
|
|
100
|
+
switch (extension) {
|
|
101
|
+
case FILES_TYPES.MOL: {
|
|
102
|
+
const files = await loadFiles(selectedFilesByExtensions);
|
|
96
103
|
dispatch({ type: LOAD_MOL_FILE, files });
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
loadFiles(selectedFilesByExtensions, {
|
|
106
|
-
asBuffer: true,
|
|
107
|
-
}).then(async (files) => {
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
case FILES_TYPES.NMRIUM:
|
|
107
|
+
case FILES_TYPES.JSON:
|
|
108
|
+
if (selectedFilesByExtensions.length === 1) {
|
|
109
|
+
const files = await loadFiles(selectedFilesByExtensions, {
|
|
110
|
+
asBuffer: true,
|
|
111
|
+
});
|
|
108
112
|
// InputFileFormat
|
|
109
113
|
const fileSignature = getFileSignature(files[0].binary);
|
|
110
114
|
if (fileSignature === FILES_SIGNATURES.ZIP) {
|
|
111
115
|
const unzipResult = await Zip.loadAsync(files[0].binary);
|
|
112
|
-
|
|
116
|
+
await loadSubFilesFromZip(Object.values(unzipResult.files), [
|
|
113
117
|
FILES_TYPES.NMRIUM,
|
|
114
118
|
]);
|
|
115
119
|
}
|
|
@@ -118,35 +122,30 @@ function DropZone(props) {
|
|
|
118
122
|
files[0].binary = decoder.decode(files[0].binary);
|
|
119
123
|
dispatch({ type: LOAD_JSON_FILE, files });
|
|
120
124
|
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
throw new Error('You can add only one json file');
|
|
128
|
+
}
|
|
129
|
+
break;
|
|
130
|
+
case FILES_TYPES.JDX:
|
|
131
|
+
case FILES_TYPES.DX: {
|
|
132
|
+
const files = await loadFiles(selectedFilesByExtensions, {
|
|
133
|
+
asBuffer: true,
|
|
124
134
|
});
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
// eslint-disable-next-line no-alert
|
|
128
|
-
alert('You can add only one json file');
|
|
129
|
-
}
|
|
130
|
-
break;
|
|
131
|
-
case FILES_TYPES.JDX:
|
|
132
|
-
case FILES_TYPES.DX:
|
|
133
|
-
loadFiles(selectedFilesByExtensions, { asBuffer: true }).then((files) => {
|
|
134
135
|
dispatch({ type: LOAD_JCAMP_FILE, files });
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
loadFiles(selectedFilesByExtensions, { asBuffer: true }).then((files) => {
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
case FILES_TYPES.JDF: {
|
|
139
|
+
const files = await loadFiles(selectedFilesByExtensions, {
|
|
140
|
+
asBuffer: true,
|
|
141
|
+
});
|
|
142
142
|
dispatch({ type: LOAD_JDF_FILE, files });
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
loadFiles(selectedFilesByExtensions, { asBuffer: true }).then(async (files) => {
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
case FILES_TYPES.ZIP: {
|
|
146
|
+
const files = await loadFiles(selectedFilesByExtensions, {
|
|
147
|
+
asBuffer: true,
|
|
148
|
+
});
|
|
150
149
|
for (const zipFile of files) {
|
|
151
150
|
const unzipResult = await Zip.loadAsync(zipFile.binary);
|
|
152
151
|
const uniqueFileExtensions = [
|
|
@@ -159,38 +158,39 @@ function DropZone(props) {
|
|
|
159
158
|
});
|
|
160
159
|
if (hasBruker)
|
|
161
160
|
dispatch({ type: LOAD_ZIP_FILE, files });
|
|
162
|
-
|
|
161
|
+
await loadSubFilesFromZip(Object.values(unzipResult.files), uniqueFileExtensions);
|
|
163
162
|
}
|
|
164
163
|
else {
|
|
165
164
|
dispatch({ type: LOAD_ZIP_FILE, files });
|
|
166
165
|
}
|
|
167
166
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
case FILES_TYPES.NMREDATA:
|
|
170
|
+
void loadFiles(selectedFilesByExtensions, {
|
|
171
|
+
asBuffer: true,
|
|
172
|
+
}).then(async (files) => {
|
|
173
|
+
for (const zipFile of files) {
|
|
174
|
+
dispatch({
|
|
175
|
+
type: LOAD_NMREDATA_FILE,
|
|
176
|
+
file: zipFile,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
break;
|
|
181
|
+
default:
|
|
182
|
+
throw new Error('The file extension must be zip, dx, jdx, json, mol, nmredata or nmrium.');
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
catch (e) {
|
|
186
|
+
dispatch({ type: SET_LOADING_FLAG, isLoading: false });
|
|
187
|
+
alert.error(e.message);
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
}, [dispatch,
|
|
190
|
+
}, [alert, dispatch, loadSubFilesFromZip]);
|
|
191
191
|
const onDrop = useCallback((droppedFiles) => {
|
|
192
192
|
dispatch({ type: SET_LOADING_FLAG, isLoading: true });
|
|
193
|
-
loadFilesHandler(droppedFiles);
|
|
193
|
+
void loadFilesHandler(droppedFiles);
|
|
194
194
|
}, [dispatch, loadFilesHandler]);
|
|
195
195
|
const { getRootProps, getInputProps, isDragActive, open: openImportDialog, } = useDropzone({
|
|
196
196
|
onDrop,
|
|
@@ -1,31 +1,3 @@
|
|
|
1
|
-
export interface PredictionProps {
|
|
2
|
-
frequency: number;
|
|
3
|
-
'1d': {
|
|
4
|
-
'1H': {
|
|
5
|
-
from: number;
|
|
6
|
-
to: number;
|
|
7
|
-
};
|
|
8
|
-
'13C': {
|
|
9
|
-
from: number;
|
|
10
|
-
to: number;
|
|
11
|
-
};
|
|
12
|
-
nbPoints: number;
|
|
13
|
-
lineWidth: number;
|
|
14
|
-
};
|
|
15
|
-
'2d': {
|
|
16
|
-
nbPoints: {
|
|
17
|
-
x: number;
|
|
18
|
-
y: number;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
spectra: {
|
|
22
|
-
proton: boolean;
|
|
23
|
-
carbon: boolean;
|
|
24
|
-
cosy: boolean;
|
|
25
|
-
hsqc: boolean;
|
|
26
|
-
hmbc: boolean;
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
1
|
interface PredictSpectraModalProps {
|
|
30
2
|
onClose?: (element?: string) => void;
|
|
31
3
|
molfile: any;
|
|
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { useCallback, useRef, useState, useMemo } from 'react';
|
|
5
5
|
import * as Yup from 'yup';
|
|
6
|
+
import { defaultPredictionOptions, FREQUENCIES, } from '../../data/PredictionManager';
|
|
6
7
|
import generateNumbersPowerOfX from '../../data/utilities/generateNumbersPowerOfX';
|
|
7
8
|
import { useDispatch } from '../context/DispatchContext';
|
|
8
9
|
import CheckBox from '../elements/CheckBox';
|
|
@@ -77,41 +78,10 @@ const styles = css `
|
|
|
77
78
|
color: #005d9e;
|
|
78
79
|
}
|
|
79
80
|
`;
|
|
80
|
-
const FREQUENCIES = [
|
|
81
|
-
{ key: 1, value: 60, label: '60 MHz' },
|
|
82
|
-
{ key: 2, value: 100, label: '100 MHz' },
|
|
83
|
-
{ key: 3, value: 200, label: '200 MHz' },
|
|
84
|
-
{ key: 4, value: 300, label: '300 MHz' },
|
|
85
|
-
{ key: 5, value: 400, label: '400 MHz' },
|
|
86
|
-
{ key: 6, value: 500, label: '500 MHz' },
|
|
87
|
-
{ key: 7, value: 600, label: '600 MHz' },
|
|
88
|
-
{ key: 8, value: 800, label: '800 MHz' },
|
|
89
|
-
{ key: 9, value: 1000, label: '1000 MHz' },
|
|
90
|
-
{ key: 10, value: 1200, label: '1200 MHz' },
|
|
91
|
-
];
|
|
92
81
|
const NUMBER_OF_POINTS_1D = generateNumbersPowerOfX(12, 19);
|
|
93
82
|
const NUMBER_OF_POINTS_2D = generateNumbersPowerOfX(10, 10, {
|
|
94
83
|
format: (value) => value,
|
|
95
84
|
});
|
|
96
|
-
const INITIAL_VALUE = {
|
|
97
|
-
frequency: 400,
|
|
98
|
-
'1d': {
|
|
99
|
-
'1H': { from: -1, to: 12 },
|
|
100
|
-
'13C': { from: -5, to: 220 },
|
|
101
|
-
nbPoints: 2 ** 17,
|
|
102
|
-
lineWidth: 1,
|
|
103
|
-
},
|
|
104
|
-
'2d': {
|
|
105
|
-
nbPoints: { x: 1024, y: 1024 },
|
|
106
|
-
},
|
|
107
|
-
spectra: {
|
|
108
|
-
proton: true,
|
|
109
|
-
carbon: false,
|
|
110
|
-
cosy: false,
|
|
111
|
-
hsqc: false,
|
|
112
|
-
hmbc: false,
|
|
113
|
-
},
|
|
114
|
-
};
|
|
115
85
|
const predictionFormValidation = Yup.object().shape({
|
|
116
86
|
frequency: Yup.number().integer().required().label('Frequency'),
|
|
117
87
|
'1d': Yup.object({
|
|
@@ -157,7 +127,7 @@ function PredictSpectraModal({ onClose = () => null, molfile, }) {
|
|
|
157
127
|
const initValues = useMemo(() => {
|
|
158
128
|
const { isApproved: isAgree, ...options } = predictionPreferences;
|
|
159
129
|
setApproved(isAgree);
|
|
160
|
-
return Object.assign(
|
|
130
|
+
return Object.assign(defaultPredictionOptions, options);
|
|
161
131
|
}, [predictionPreferences]);
|
|
162
132
|
const submitHandler = useCallback(async (values) => {
|
|
163
133
|
setPredictionPreferences({ ...values, isApproved });
|
|
@@ -72,7 +72,9 @@ export default function ChangeSumModal({ onSave, onClose, header, sumOptions, })
|
|
|
72
72
|
setActiveOption(tab.tabid);
|
|
73
73
|
}, []);
|
|
74
74
|
useEffect(() => {
|
|
75
|
-
if (sumOptions.sumAuto
|
|
75
|
+
if (sumOptions.sumAuto &&
|
|
76
|
+
!general.hideSetSumFromMolecule &&
|
|
77
|
+
!panels.hideStructuresPanel) {
|
|
76
78
|
setActiveOption(SumSetOptions.Auto);
|
|
77
79
|
const { mf, moleculeKey: key } = sumOptions;
|
|
78
80
|
formRef.current.setValues({
|
|
@@ -84,7 +86,7 @@ export default function ChangeSumModal({ onSave, onClose, header, sumOptions, })
|
|
|
84
86
|
setActiveOption(SumSetOptions.Manual);
|
|
85
87
|
formRef.current.setValues({ sum: sumOptions.sum, molecule: null });
|
|
86
88
|
}
|
|
87
|
-
}, [sumOptions]);
|
|
89
|
+
}, [general.hideSetSumFromMolecule, panels.hideStructuresPanel, sumOptions]);
|
|
88
90
|
const saveHandler = useCallback((values) => {
|
|
89
91
|
switch (setOption) {
|
|
90
92
|
case SumSetOptions.Auto: {
|
|
@@ -21,7 +21,7 @@ const useValidation = () => useMemo(() => {
|
|
|
21
21
|
});
|
|
22
22
|
}),
|
|
23
23
|
}))
|
|
24
|
-
.min(1, 'There must be at least one coupling in a
|
|
24
|
+
.min(1, 'There must be at least one coupling in a signal'),
|
|
25
25
|
}))
|
|
26
26
|
.min(1, 'There must be at least one signal in a range!'),
|
|
27
27
|
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/** @jsxImportSource @emotion/react */
|
|
3
|
+
import { css } from '@emotion/react';
|
|
4
|
+
import { useFormikContext } from 'formik';
|
|
5
|
+
import DefaultPathLengths from '../../../data/constants/DefaultPathLengths';
|
|
6
|
+
import FormikNumberInput from '../../elements/formik/FormikNumberInput';
|
|
7
|
+
const editPathLengthsStyles = css `
|
|
8
|
+
width: 100%;
|
|
9
|
+
height: 100%;
|
|
10
|
+
margin-top: 10px;
|
|
11
|
+
text-align: center;
|
|
12
|
+
|
|
13
|
+
.input-container {
|
|
14
|
+
width: 100%;
|
|
15
|
+
margin-top: 5px;
|
|
16
|
+
text-align: center;
|
|
17
|
+
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
|
|
23
|
+
input::-webkit-outer-spin-button,
|
|
24
|
+
input::-webkit-inner-spin-button {
|
|
25
|
+
-webkit-appearance: none;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
button {
|
|
30
|
+
flex: 2;
|
|
31
|
+
padding: 5px;
|
|
32
|
+
border: 1px solid gray;
|
|
33
|
+
border-radius: 5px;
|
|
34
|
+
height: 30px;
|
|
35
|
+
margin: 0 auto;
|
|
36
|
+
margin-top: 15px;
|
|
37
|
+
display: block;
|
|
38
|
+
width: 60px;
|
|
39
|
+
|
|
40
|
+
color: white;
|
|
41
|
+
background-color: gray;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.warning {
|
|
45
|
+
margin-top: 5px;
|
|
46
|
+
color: red;
|
|
47
|
+
}
|
|
48
|
+
`;
|
|
49
|
+
function EditPathLengthFormik({ signalIndex }) {
|
|
50
|
+
const { errors, values, } = useFormikContext();
|
|
51
|
+
return (_jsxs("div", { css: editPathLengthsStyles, children: [_jsx("p", { children: "Setting of the minimum and maximum path length (J coupling)." }, void 0), _jsxs("div", { className: "input-container", children: [_jsx(FormikNumberInput, { name: `signals[${signalIndex}].j.pathLength.from`, defaultValue: values.signals[signalIndex].j?.pathLength?.from ||
|
|
52
|
+
DefaultPathLengths[values.experimentType]?.from ||
|
|
53
|
+
1, label: "Min: ", style: {
|
|
54
|
+
input: {
|
|
55
|
+
color: errors.signals?.[signalIndex].j?.pathLength?.from
|
|
56
|
+
? 'red'
|
|
57
|
+
: 'black',
|
|
58
|
+
},
|
|
59
|
+
}, min: 1, max: values.signals[signalIndex].j?.pathLength?.to ||
|
|
60
|
+
DefaultPathLengths[values.experimentType]?.to, pattern: "[1-9]+" }, void 0), _jsx(FormikNumberInput, { name: `signals[${signalIndex}].j.pathLength.to`, defaultValue: values.signals[signalIndex].j?.pathLength?.to ||
|
|
61
|
+
DefaultPathLengths[values.experimentType]?.to ||
|
|
62
|
+
1, label: "Max: ", style: {
|
|
63
|
+
input: {
|
|
64
|
+
color: errors.signals?.[signalIndex].j?.pathLength?.to
|
|
65
|
+
? 'red'
|
|
66
|
+
: 'black',
|
|
67
|
+
},
|
|
68
|
+
}, min: values.signals[signalIndex].j?.pathLength?.from ||
|
|
69
|
+
DefaultPathLengths[values.experimentType]?.from ||
|
|
70
|
+
1, pattern: "[1-9]+" }, void 0)] }, void 0)] }, void 0));
|
|
71
|
+
}
|
|
72
|
+
export default EditPathLengthFormik;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface EditZoneModalProps {
|
|
2
|
+
onSaveEditZoneModal: (value: any) => Promise<void> | null | void;
|
|
3
|
+
onCloseEditZoneModal: () => void;
|
|
4
|
+
onZoomEditZoneModal: (value: any) => void;
|
|
5
|
+
rowData: any;
|
|
6
|
+
}
|
|
7
|
+
declare function EditZoneModal({ onSaveEditZoneModal, onCloseEditZoneModal, onZoomEditZoneModal, rowData, }: EditZoneModalProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default EditZoneModal;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/** @jsxImportSource @emotion/react */
|
|
3
|
+
import { css } from '@emotion/react';
|
|
4
|
+
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
5
|
+
import { FaSearchPlus } from 'react-icons/fa';
|
|
6
|
+
import DefaultPathLengths from '../../../data/constants/DefaultPathLengths';
|
|
7
|
+
import Button from '../../elements/Button';
|
|
8
|
+
import CloseButton from '../../elements/CloseButton';
|
|
9
|
+
import SaveButton from '../../elements/SaveButton';
|
|
10
|
+
import FormikForm from '../../elements/formik/FormikForm';
|
|
11
|
+
import SignalsForm from './SignalsForm';
|
|
12
|
+
import useRangeFormValidation from './validation/EditZoneValidation';
|
|
13
|
+
import isDefaultPathLength from './validation/isDefaultPathLength';
|
|
14
|
+
const styles = css `
|
|
15
|
+
width: 500px;
|
|
16
|
+
height: 250px;
|
|
17
|
+
padding: 5px;
|
|
18
|
+
button:focus {
|
|
19
|
+
outline: none;
|
|
20
|
+
}
|
|
21
|
+
.header {
|
|
22
|
+
height: 24px;
|
|
23
|
+
border-bottom: 1px solid #f0f0f0;
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
span {
|
|
27
|
+
color: #464646;
|
|
28
|
+
font-size: 15px;
|
|
29
|
+
flex: 1;
|
|
30
|
+
border-left: 1px solid #ececec;
|
|
31
|
+
padding-left: 6px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
button {
|
|
35
|
+
background-color: transparent;
|
|
36
|
+
border: none;
|
|
37
|
+
padding: 5px;
|
|
38
|
+
|
|
39
|
+
svg {
|
|
40
|
+
height: 16px;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
.container {
|
|
45
|
+
display: flex;
|
|
46
|
+
margin: 30px 5px;
|
|
47
|
+
}
|
|
48
|
+
`;
|
|
49
|
+
function EditZoneModal({ onSaveEditZoneModal = () => null, onCloseEditZoneModal = () => null, onZoomEditZoneModal = () => null, rowData, }) {
|
|
50
|
+
const formRef = useRef(null);
|
|
51
|
+
const validation = useRangeFormValidation();
|
|
52
|
+
const handleOnZoom = useCallback(() => {
|
|
53
|
+
onZoomEditZoneModal(rowData);
|
|
54
|
+
}, [onZoomEditZoneModal, rowData]);
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
handleOnZoom();
|
|
57
|
+
}, [handleOnZoom]);
|
|
58
|
+
const handleOnClose = useCallback(() => {
|
|
59
|
+
onCloseEditZoneModal();
|
|
60
|
+
}, [onCloseEditZoneModal]);
|
|
61
|
+
const handleOnSave = useCallback(async (formValues) => {
|
|
62
|
+
const _rowData = {
|
|
63
|
+
...rowData,
|
|
64
|
+
signals: formValues.signals.map((signal) => {
|
|
65
|
+
if (isDefaultPathLength(signal.j?.pathLength, rowData.tableMetaInfo.experiment)) {
|
|
66
|
+
delete signal.j?.pathLength;
|
|
67
|
+
if (signal.j && Object.keys(signal.j).length === 0) {
|
|
68
|
+
delete signal.j;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return signal;
|
|
72
|
+
}),
|
|
73
|
+
};
|
|
74
|
+
await onSaveEditZoneModal(_rowData);
|
|
75
|
+
handleOnClose();
|
|
76
|
+
}, [handleOnClose, onSaveEditZoneModal, rowData]);
|
|
77
|
+
const data = useMemo(() => {
|
|
78
|
+
return {
|
|
79
|
+
activeTab: '0',
|
|
80
|
+
signals: rowData.signals.map((signal) => {
|
|
81
|
+
return {
|
|
82
|
+
...signal,
|
|
83
|
+
j: {
|
|
84
|
+
pathLength: {
|
|
85
|
+
from: DefaultPathLengths[rowData.tableMetaInfo.experiment]?.from || 1,
|
|
86
|
+
to: DefaultPathLengths[rowData.tableMetaInfo.experiment]?.to || 1,
|
|
87
|
+
},
|
|
88
|
+
...signal.j,
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
}),
|
|
92
|
+
};
|
|
93
|
+
}, [rowData.signals, rowData.tableMetaInfo.experiment]);
|
|
94
|
+
return (_jsx("div", { css: styles, children: _jsxs(FormikForm, { ref: formRef, initialValues: data, validationSchema: validation, onSubmit: handleOnSave, children: [_jsxs("div", { className: "header handle", children: [_jsx(Button, { onClick: handleOnZoom, className: "zoom-button", children: _jsx(FaSearchPlus, { title: "Set to default view on range in spectrum" }, void 0) }, void 0), _jsx("span", { children: `Zone and Signal edition` }, void 0), _jsx(SaveButton, { onClick: () => formRef.current.submitForm(), popupTitle: "Save and exit" }, void 0), _jsx(CloseButton, { onClick: handleOnClose }, void 0)] }, void 0), _jsx(SignalsForm, {}, void 0)] }, void 0) }, void 0));
|
|
95
|
+
}
|
|
96
|
+
export default EditZoneModal;
|