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
|
@@ -10,7 +10,7 @@ const react_1 = require("react");
|
|
|
10
10
|
const DispatchContext_1 = require("../context/DispatchContext");
|
|
11
11
|
const Alert_1 = require("../elements/popup/Alert");
|
|
12
12
|
const Panels_1 = require("../panels/Panels");
|
|
13
|
-
const
|
|
13
|
+
const Zoom1DManager_1 = require("../reducer/helper/Zoom1DManager");
|
|
14
14
|
const Types_1 = require("../reducer/types/Types");
|
|
15
15
|
const ToolTypes_1 = require("../toolbar/ToolTypes");
|
|
16
16
|
function useToolsFunctions() {
|
|
@@ -24,12 +24,12 @@ function useToolsFunctions() {
|
|
|
24
24
|
ToolTypes_1.options.peakPicking.id,
|
|
25
25
|
ToolTypes_1.options.integral.id,
|
|
26
26
|
ToolTypes_1.options.zone2D.id,
|
|
27
|
+
ToolTypes_1.options.exclusionZones.id,
|
|
27
28
|
].includes(selectedTool)) {
|
|
28
|
-
alert.show('Press Shift + Left Mouse button to select zone
|
|
29
|
+
alert.show('Press Shift + Left Mouse button to select zone');
|
|
29
30
|
}
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
openPanel(Panels_1.PANELS_ACCORDION[selectedTool]);
|
|
31
|
+
if (Object.keys(Panels_1.TOOLS_PANELS_ACCORDION).includes(selectedTool)) {
|
|
32
|
+
openPanel(Panels_1.TOOLS_PANELS_ACCORDION[selectedTool]);
|
|
33
33
|
}
|
|
34
34
|
dispatch({
|
|
35
35
|
type: Types_1.SET_SELECTED_TOOL,
|
|
@@ -40,7 +40,7 @@ function useToolsFunctions() {
|
|
|
40
40
|
if (debounceClickEventsRef.current.clicks.length === 0) {
|
|
41
41
|
dispatch({
|
|
42
42
|
type: Types_1.FULL_ZOOM_OUT,
|
|
43
|
-
zoomType:
|
|
43
|
+
zoomType: Zoom1DManager_1.ZoomType.HORIZONTAL,
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
const callback = (0, debounce_1.default)(() => {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useXScale = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const scale_1 = require("../1d/utilities/scale");
|
|
6
|
+
const ChartContext_1 = require("../context/ChartContext");
|
|
7
|
+
function useXScale() {
|
|
8
|
+
const { width, margin, xDomains, xDomain, mode } = (0, ChartContext_1.useChartData)();
|
|
9
|
+
return (0, react_1.useMemo)(() => (0, scale_1.getXScale)({ width, margin, xDomains, xDomain, mode }), [margin, mode, width, xDomain, xDomains]);
|
|
10
|
+
}
|
|
11
|
+
exports.useXScale = useXScale;
|
|
@@ -13,6 +13,7 @@ const fa_1 = require("react-icons/fa");
|
|
|
13
13
|
const ChartContext_1 = require("../context/ChartContext");
|
|
14
14
|
const DispatchContext_1 = require("../context/DispatchContext");
|
|
15
15
|
const LoaderContext_1 = require("../context/LoaderContext");
|
|
16
|
+
const Alert_1 = require("../elements/popup/Alert");
|
|
16
17
|
const Types_1 = require("../reducer/types/Types");
|
|
17
18
|
const FileUtility_1 = require("../utility/FileUtility");
|
|
18
19
|
const style = (0, react_1.css) `
|
|
@@ -49,72 +50,75 @@ const containerStyle = (0, react_1.css) `
|
|
|
49
50
|
function DropZone(props) {
|
|
50
51
|
const { width, height } = (0, ChartContext_1.useChartData)();
|
|
51
52
|
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
52
|
-
const
|
|
53
|
+
const alert = (0, Alert_1.useAlert)();
|
|
54
|
+
const loadSubFilesFromZip = (0, react_2.useCallback)(async (extractedfiles, uniqueFileExtensions) => {
|
|
53
55
|
for (let extension of uniqueFileExtensions) {
|
|
54
56
|
const selectedFilesByExtensions = extractedfiles.filter((file) => (0, FileUtility_1.getFileExtension)(file.name) === extension);
|
|
55
57
|
switch (extension) {
|
|
56
|
-
case FileUtility_1.FILES_TYPES.MOL:
|
|
57
|
-
|
|
58
|
+
case FileUtility_1.FILES_TYPES.MOL: {
|
|
59
|
+
const files = await (0, FileUtility_1.loadFilesFromZip)(selectedFilesByExtensions);
|
|
60
|
+
dispatch({ type: Types_1.LOAD_MOL_FILE, files });
|
|
58
61
|
break;
|
|
62
|
+
}
|
|
59
63
|
case FileUtility_1.FILES_TYPES.NMRIUM:
|
|
60
|
-
case FileUtility_1.FILES_TYPES.JSON:
|
|
61
|
-
|
|
64
|
+
case FileUtility_1.FILES_TYPES.JSON: {
|
|
65
|
+
const files = await (0, FileUtility_1.loadFilesFromZip)(selectedFilesByExtensions, {
|
|
62
66
|
asBuffer: true,
|
|
63
|
-
}).then((files) => {
|
|
64
|
-
if (selectedFilesByExtensions.length === 1) {
|
|
65
|
-
const decoder = new TextDecoder('utf8');
|
|
66
|
-
files[0].binary = decoder.decode(files[0].binary);
|
|
67
|
-
dispatch({ type: Types_1.LOAD_JSON_FILE, files });
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
dispatch({ type: Types_1.SET_LOADING_FLAG, isLoading: false });
|
|
71
|
-
// eslint-disable-next-line no-alert
|
|
72
|
-
alert('You can add only one json file');
|
|
73
|
-
}
|
|
74
67
|
});
|
|
68
|
+
if (selectedFilesByExtensions.length === 1) {
|
|
69
|
+
const decoder = new TextDecoder('utf8');
|
|
70
|
+
files[0].binary = decoder.decode(files[0].binary);
|
|
71
|
+
dispatch({ type: Types_1.LOAD_JSON_FILE, files });
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
throw new Error('You can add only one json file');
|
|
75
|
+
}
|
|
75
76
|
break;
|
|
77
|
+
}
|
|
76
78
|
case FileUtility_1.FILES_TYPES.JDX:
|
|
77
|
-
case FileUtility_1.FILES_TYPES.DX:
|
|
78
|
-
|
|
79
|
+
case FileUtility_1.FILES_TYPES.DX: {
|
|
80
|
+
const files = await (0, FileUtility_1.loadFilesFromZip)(selectedFilesByExtensions, {
|
|
79
81
|
asBuffer: true,
|
|
80
|
-
})
|
|
82
|
+
});
|
|
83
|
+
dispatch({ type: Types_1.LOAD_JCAMP_FILE, files });
|
|
81
84
|
break;
|
|
82
|
-
|
|
83
|
-
|
|
85
|
+
}
|
|
86
|
+
case FileUtility_1.FILES_TYPES.JDF: {
|
|
87
|
+
const files = await (0, FileUtility_1.loadFilesFromZip)(selectedFilesByExtensions, {
|
|
84
88
|
asBuffer: true,
|
|
85
|
-
})
|
|
89
|
+
});
|
|
90
|
+
dispatch({ type: Types_1.LOAD_JDF_FILE, files });
|
|
86
91
|
break;
|
|
92
|
+
}
|
|
87
93
|
default:
|
|
88
94
|
break;
|
|
89
95
|
}
|
|
90
96
|
}
|
|
91
97
|
}, [dispatch]);
|
|
92
|
-
const loadFilesHandler = (0, react_2.useCallback)((files) => {
|
|
98
|
+
const loadFilesHandler = (0, react_2.useCallback)(async (files) => {
|
|
93
99
|
const uniqueFileExtensions = [
|
|
94
100
|
...new Set(files.map((file) => (0, FileUtility_1.getFileExtension)(file.name))),
|
|
95
101
|
];
|
|
96
102
|
for (let extension of uniqueFileExtensions) {
|
|
97
103
|
const selectedFilesByExtensions = files.filter((file) => (0, FileUtility_1.getFileExtension)(file.name) === extension);
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
104
|
+
try {
|
|
105
|
+
switch (extension) {
|
|
106
|
+
case FileUtility_1.FILES_TYPES.MOL: {
|
|
107
|
+
const files = await (0, FileUtility_1.loadFiles)(selectedFilesByExtensions);
|
|
101
108
|
dispatch({ type: Types_1.LOAD_MOL_FILE, files });
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
(0, FileUtility_1.loadFiles)(selectedFilesByExtensions, {
|
|
111
|
-
asBuffer: true,
|
|
112
|
-
}).then(async (files) => {
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
case FileUtility_1.FILES_TYPES.NMRIUM:
|
|
112
|
+
case FileUtility_1.FILES_TYPES.JSON:
|
|
113
|
+
if (selectedFilesByExtensions.length === 1) {
|
|
114
|
+
const files = await (0, FileUtility_1.loadFiles)(selectedFilesByExtensions, {
|
|
115
|
+
asBuffer: true,
|
|
116
|
+
});
|
|
113
117
|
// InputFileFormat
|
|
114
118
|
const fileSignature = (0, FileUtility_1.getFileSignature)(files[0].binary);
|
|
115
119
|
if (fileSignature === FileUtility_1.FILES_SIGNATURES.ZIP) {
|
|
116
120
|
const unzipResult = await jszip_1.default.loadAsync(files[0].binary);
|
|
117
|
-
|
|
121
|
+
await loadSubFilesFromZip(Object.values(unzipResult.files), [
|
|
118
122
|
FileUtility_1.FILES_TYPES.NMRIUM,
|
|
119
123
|
]);
|
|
120
124
|
}
|
|
@@ -123,35 +127,30 @@ function DropZone(props) {
|
|
|
123
127
|
files[0].binary = decoder.decode(files[0].binary);
|
|
124
128
|
dispatch({ type: Types_1.LOAD_JSON_FILE, files });
|
|
125
129
|
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
throw new Error('You can add only one json file');
|
|
133
|
+
}
|
|
134
|
+
break;
|
|
135
|
+
case FileUtility_1.FILES_TYPES.JDX:
|
|
136
|
+
case FileUtility_1.FILES_TYPES.DX: {
|
|
137
|
+
const files = await (0, FileUtility_1.loadFiles)(selectedFilesByExtensions, {
|
|
138
|
+
asBuffer: true,
|
|
129
139
|
});
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
// eslint-disable-next-line no-alert
|
|
133
|
-
alert('You can add only one json file');
|
|
134
|
-
}
|
|
135
|
-
break;
|
|
136
|
-
case FileUtility_1.FILES_TYPES.JDX:
|
|
137
|
-
case FileUtility_1.FILES_TYPES.DX:
|
|
138
|
-
(0, FileUtility_1.loadFiles)(selectedFilesByExtensions, { asBuffer: true }).then((files) => {
|
|
139
140
|
dispatch({ type: Types_1.LOAD_JCAMP_FILE, files });
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
(0, FileUtility_1.loadFiles)(selectedFilesByExtensions, { asBuffer: true }).then((files) => {
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
case FileUtility_1.FILES_TYPES.JDF: {
|
|
144
|
+
const files = await (0, FileUtility_1.loadFiles)(selectedFilesByExtensions, {
|
|
145
|
+
asBuffer: true,
|
|
146
|
+
});
|
|
147
147
|
dispatch({ type: Types_1.LOAD_JDF_FILE, files });
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
(0, FileUtility_1.loadFiles)(selectedFilesByExtensions, { asBuffer: true }).then(async (files) => {
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
case FileUtility_1.FILES_TYPES.ZIP: {
|
|
151
|
+
const files = await (0, FileUtility_1.loadFiles)(selectedFilesByExtensions, {
|
|
152
|
+
asBuffer: true,
|
|
153
|
+
});
|
|
155
154
|
for (const zipFile of files) {
|
|
156
155
|
const unzipResult = await jszip_1.default.loadAsync(zipFile.binary);
|
|
157
156
|
const uniqueFileExtensions = [
|
|
@@ -164,38 +163,39 @@ function DropZone(props) {
|
|
|
164
163
|
});
|
|
165
164
|
if (hasBruker)
|
|
166
165
|
dispatch({ type: Types_1.LOAD_ZIP_FILE, files });
|
|
167
|
-
|
|
166
|
+
await loadSubFilesFromZip(Object.values(unzipResult.files), uniqueFileExtensions);
|
|
168
167
|
}
|
|
169
168
|
else {
|
|
170
169
|
dispatch({ type: Types_1.LOAD_ZIP_FILE, files });
|
|
171
170
|
}
|
|
172
171
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
case FileUtility_1.FILES_TYPES.NMREDATA:
|
|
175
|
+
void (0, FileUtility_1.loadFiles)(selectedFilesByExtensions, {
|
|
176
|
+
asBuffer: true,
|
|
177
|
+
}).then(async (files) => {
|
|
178
|
+
for (const zipFile of files) {
|
|
179
|
+
dispatch({
|
|
180
|
+
type: Types_1.LOAD_NMREDATA_FILE,
|
|
181
|
+
file: zipFile,
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
break;
|
|
186
|
+
default:
|
|
187
|
+
throw new Error('The file extension must be zip, dx, jdx, json, mol, nmredata or nmrium.');
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
catch (e) {
|
|
191
|
+
dispatch({ type: Types_1.SET_LOADING_FLAG, isLoading: false });
|
|
192
|
+
alert.error(e.message);
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
|
-
}, [dispatch,
|
|
195
|
+
}, [alert, dispatch, loadSubFilesFromZip]);
|
|
196
196
|
const onDrop = (0, react_2.useCallback)((droppedFiles) => {
|
|
197
197
|
dispatch({ type: Types_1.SET_LOADING_FLAG, isLoading: true });
|
|
198
|
-
loadFilesHandler(droppedFiles);
|
|
198
|
+
void loadFilesHandler(droppedFiles);
|
|
199
199
|
}, [dispatch, loadFilesHandler]);
|
|
200
200
|
const { getRootProps, getInputProps, isDragActive, open: openImportDialog, } = (0, react_dropzone_1.useDropzone)({
|
|
201
201
|
onDrop,
|
|
@@ -27,6 +27,7 @@ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
|
27
27
|
const react_1 = require("@emotion/react");
|
|
28
28
|
const react_2 = require("react");
|
|
29
29
|
const Yup = __importStar(require("yup"));
|
|
30
|
+
const PredictionManager_1 = require("../../data/PredictionManager");
|
|
30
31
|
const generateNumbersPowerOfX_1 = __importDefault(require("../../data/utilities/generateNumbersPowerOfX"));
|
|
31
32
|
const DispatchContext_1 = require("../context/DispatchContext");
|
|
32
33
|
const CheckBox_1 = __importDefault(require("../elements/CheckBox"));
|
|
@@ -101,41 +102,10 @@ const styles = (0, react_1.css) `
|
|
|
101
102
|
color: #005d9e;
|
|
102
103
|
}
|
|
103
104
|
`;
|
|
104
|
-
const FREQUENCIES = [
|
|
105
|
-
{ key: 1, value: 60, label: '60 MHz' },
|
|
106
|
-
{ key: 2, value: 100, label: '100 MHz' },
|
|
107
|
-
{ key: 3, value: 200, label: '200 MHz' },
|
|
108
|
-
{ key: 4, value: 300, label: '300 MHz' },
|
|
109
|
-
{ key: 5, value: 400, label: '400 MHz' },
|
|
110
|
-
{ key: 6, value: 500, label: '500 MHz' },
|
|
111
|
-
{ key: 7, value: 600, label: '600 MHz' },
|
|
112
|
-
{ key: 8, value: 800, label: '800 MHz' },
|
|
113
|
-
{ key: 9, value: 1000, label: '1000 MHz' },
|
|
114
|
-
{ key: 10, value: 1200, label: '1200 MHz' },
|
|
115
|
-
];
|
|
116
105
|
const NUMBER_OF_POINTS_1D = (0, generateNumbersPowerOfX_1.default)(12, 19);
|
|
117
106
|
const NUMBER_OF_POINTS_2D = (0, generateNumbersPowerOfX_1.default)(10, 10, {
|
|
118
107
|
format: (value) => value,
|
|
119
108
|
});
|
|
120
|
-
const INITIAL_VALUE = {
|
|
121
|
-
frequency: 400,
|
|
122
|
-
'1d': {
|
|
123
|
-
'1H': { from: -1, to: 12 },
|
|
124
|
-
'13C': { from: -5, to: 220 },
|
|
125
|
-
nbPoints: 2 ** 17,
|
|
126
|
-
lineWidth: 1,
|
|
127
|
-
},
|
|
128
|
-
'2d': {
|
|
129
|
-
nbPoints: { x: 1024, y: 1024 },
|
|
130
|
-
},
|
|
131
|
-
spectra: {
|
|
132
|
-
proton: true,
|
|
133
|
-
carbon: false,
|
|
134
|
-
cosy: false,
|
|
135
|
-
hsqc: false,
|
|
136
|
-
hmbc: false,
|
|
137
|
-
},
|
|
138
|
-
};
|
|
139
109
|
const predictionFormValidation = Yup.object().shape({
|
|
140
110
|
frequency: Yup.number().integer().required().label('Frequency'),
|
|
141
111
|
'1d': Yup.object({
|
|
@@ -181,7 +151,7 @@ function PredictSpectraModal({ onClose = () => null, molfile, }) {
|
|
|
181
151
|
const initValues = (0, react_2.useMemo)(() => {
|
|
182
152
|
const { isApproved: isAgree, ...options } = predictionPreferences;
|
|
183
153
|
setApproved(isAgree);
|
|
184
|
-
return Object.assign(
|
|
154
|
+
return Object.assign(PredictionManager_1.defaultPredictionOptions, options);
|
|
185
155
|
}, [predictionPreferences]);
|
|
186
156
|
const submitHandler = (0, react_2.useCallback)(async (values) => {
|
|
187
157
|
setPredictionPreferences({ ...values, isApproved });
|
|
@@ -208,6 +178,6 @@ function PredictSpectraModal({ onClose = () => null, molfile, }) {
|
|
|
208
178
|
const approveCheckHandler = (0, react_2.useCallback)((e) => {
|
|
209
179
|
setApproved(e.target.checked);
|
|
210
180
|
}, []);
|
|
211
|
-
return ((0, jsx_runtime_1.jsxs)("div", { css: [ModalStyle_1.ModalStyles, styles], children: [(0, jsx_runtime_1.jsxs)("div", { className: "header handle", children: [(0, jsx_runtime_1.jsx)("span", { children: "Prediction of NMR spectrum" }, void 0), (0, jsx_runtime_1.jsx)(CloseButton_1.default, { onClick: onClose, className: "close-bt" }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "inner-content", children: [(0, jsx_runtime_1.jsxs)(FormikForm_1.default, { ref: refForm, initialValues: initValues, validationSchema: predictionFormValidation, onSubmit: submitHandler, children: [(0, jsx_runtime_1.jsx)(FormikErrorsSummary_1.default, {}, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10", children: [(0, jsx_runtime_1.jsx)("span", { className: "custom-label", children: "Spectrometer Frequency :" }, void 0), (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { data: FREQUENCIES, style: { width: 290, height: 30, margin: 0 }, name: "frequency" }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)("span", { className: "group-label", children: "1D Options " }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10 padding-h-10", children: [(0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "1H", className: "custom-label" }, void 0), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "From", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.1H.from", type: "number" }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "To", style: { label: { padding: '0 10px' } }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.1H.to", type: "number" }, void 0) }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10 padding-h-10", children: [(0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "13C", className: "custom-label" }, void 0), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "From", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.13C.from", type: "number" }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "To", style: { label: { padding: '0 10px' } }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.13C.to", type: "number" }, void 0) }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10 padding-h-10", children: [(0, jsx_runtime_1.jsx)("span", { className: "custom-label", children: "Line Width : " }, void 0), (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.lineWidth", type: "number", style: { input: { margin: 0 } } }, void 0), (0, jsx_runtime_1.jsx)("span", { style: { paddingLeft: '0.4rem' }, children: " Hz " }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10 padding-h-10", children: [(0, jsx_runtime_1.jsx)("span", { className: "custom-label", children: "Number of Points : " }, void 0), (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { data: NUMBER_OF_POINTS_1D, name: "1d.nbPoints", style: { width: 290, height: 30, margin: 0 } }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)("span", { className: "group-label", children: "2D Options " }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10 padding-h-10", children: [(0, jsx_runtime_1.jsx)("span", { className: "custom-label", children: "Number of Points : " }, void 0), (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { data: NUMBER_OF_POINTS_2D, name: "2d.nbPoints.x", style: { margin: 0, height: 30 } }, void 0), (0, jsx_runtime_1.jsx)("span", { className: "middle-x", children: " X " }, void 0), (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { data: NUMBER_OF_POINTS_2D, name: "2d.nbPoints.y", style: { margin: 0, height: 30 } }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)("div", { className: "row margin-10", children: (0, jsx_runtime_1.jsx)("span", { className: "group-label", children: "Spectra " }, void 0) }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10 padding-h-10", style: { justifyContent: 'space-between' }, children: [(0, jsx_runtime_1.jsxs)("div", { className: "row", children: [(0, jsx_runtime_1.jsx)(FormikCheckBox_1.default, { name: "spectra.proton" }, void 0), (0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "1H", className: "nucleus-label" }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row", children: [(0, jsx_runtime_1.jsx)(FormikCheckBox_1.default, { name: "spectra.carbon" }, void 0), (0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "13C", className: "nucleus-label" }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row", children: [(0, jsx_runtime_1.jsx)(FormikCheckBox_1.default, { name: "spectra.cosy" }, void 0), (0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "COSY", className: "nucleus-label" }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row", children: [(0, jsx_runtime_1.jsx)(FormikCheckBox_1.default, { name: "spectra.hsqc" }, void 0), (0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "HSQC", className: "nucleus-label" }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row", children: [(0, jsx_runtime_1.jsx)(FormikCheckBox_1.default, { name: "spectra.hmbc" }, void 0), (0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "HMBC", className: "nucleus-label" }, void 0)] }, void 0)] }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)("p", { className: "warning", children: "In order to predict spectra we are calling an external service and the chemical structure will leave your browser! You should never predict spectra for confidential molecules." }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "warning-container", children: [(0, jsx_runtime_1.jsx)(CheckBox_1.default, { onChange: approveCheckHandler, checked: isApproved }, String(isApproved)), (0, jsx_runtime_1.jsx)("p", { children: "I confirm that the chemical structure is not confidential." }, void 0)] }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)("div", { className: "footer-container", children: (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: handleSave, className: "btn", disabled: !isApproved, children: "Predict spectrum" }, void 0) }, void 0)] }, void 0));
|
|
181
|
+
return ((0, jsx_runtime_1.jsxs)("div", { css: [ModalStyle_1.ModalStyles, styles], children: [(0, jsx_runtime_1.jsxs)("div", { className: "header handle", children: [(0, jsx_runtime_1.jsx)("span", { children: "Prediction of NMR spectrum" }, void 0), (0, jsx_runtime_1.jsx)(CloseButton_1.default, { onClick: onClose, className: "close-bt" }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "inner-content", children: [(0, jsx_runtime_1.jsxs)(FormikForm_1.default, { ref: refForm, initialValues: initValues, validationSchema: predictionFormValidation, onSubmit: submitHandler, children: [(0, jsx_runtime_1.jsx)(FormikErrorsSummary_1.default, {}, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10", children: [(0, jsx_runtime_1.jsx)("span", { className: "custom-label", children: "Spectrometer Frequency :" }, void 0), (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { data: PredictionManager_1.FREQUENCIES, style: { width: 290, height: 30, margin: 0 }, name: "frequency" }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)("span", { className: "group-label", children: "1D Options " }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10 padding-h-10", children: [(0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "1H", className: "custom-label" }, void 0), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "From", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.1H.from", type: "number" }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "To", style: { label: { padding: '0 10px' } }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.1H.to", type: "number" }, void 0) }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10 padding-h-10", children: [(0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "13C", className: "custom-label" }, void 0), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "From", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.13C.from", type: "number" }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "To", style: { label: { padding: '0 10px' } }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.13C.to", type: "number" }, void 0) }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10 padding-h-10", children: [(0, jsx_runtime_1.jsx)("span", { className: "custom-label", children: "Line Width : " }, void 0), (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.lineWidth", type: "number", style: { input: { margin: 0 } } }, void 0), (0, jsx_runtime_1.jsx)("span", { style: { paddingLeft: '0.4rem' }, children: " Hz " }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10 padding-h-10", children: [(0, jsx_runtime_1.jsx)("span", { className: "custom-label", children: "Number of Points : " }, void 0), (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { data: NUMBER_OF_POINTS_1D, name: "1d.nbPoints", style: { width: 290, height: 30, margin: 0 } }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)("span", { className: "group-label", children: "2D Options " }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10 padding-h-10", children: [(0, jsx_runtime_1.jsx)("span", { className: "custom-label", children: "Number of Points : " }, void 0), (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { data: NUMBER_OF_POINTS_2D, name: "2d.nbPoints.x", style: { margin: 0, height: 30 } }, void 0), (0, jsx_runtime_1.jsx)("span", { className: "middle-x", children: " X " }, void 0), (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { data: NUMBER_OF_POINTS_2D, name: "2d.nbPoints.y", style: { margin: 0, height: 30 } }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)("div", { className: "row margin-10", children: (0, jsx_runtime_1.jsx)("span", { className: "group-label", children: "Spectra " }, void 0) }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10 padding-h-10", style: { justifyContent: 'space-between' }, children: [(0, jsx_runtime_1.jsxs)("div", { className: "row", children: [(0, jsx_runtime_1.jsx)(FormikCheckBox_1.default, { name: "spectra.proton" }, void 0), (0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "1H", className: "nucleus-label" }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row", children: [(0, jsx_runtime_1.jsx)(FormikCheckBox_1.default, { name: "spectra.carbon" }, void 0), (0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "13C", className: "nucleus-label" }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row", children: [(0, jsx_runtime_1.jsx)(FormikCheckBox_1.default, { name: "spectra.cosy" }, void 0), (0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "COSY", className: "nucleus-label" }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row", children: [(0, jsx_runtime_1.jsx)(FormikCheckBox_1.default, { name: "spectra.hsqc" }, void 0), (0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "HSQC", className: "nucleus-label" }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row", children: [(0, jsx_runtime_1.jsx)(FormikCheckBox_1.default, { name: "spectra.hmbc" }, void 0), (0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "HMBC", className: "nucleus-label" }, void 0)] }, void 0)] }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)("p", { className: "warning", children: "In order to predict spectra we are calling an external service and the chemical structure will leave your browser! You should never predict spectra for confidential molecules." }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "warning-container", children: [(0, jsx_runtime_1.jsx)(CheckBox_1.default, { onChange: approveCheckHandler, checked: isApproved }, String(isApproved)), (0, jsx_runtime_1.jsx)("p", { children: "I confirm that the chemical structure is not confidential." }, void 0)] }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)("div", { className: "footer-container", children: (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: handleSave, className: "btn", disabled: !isApproved, children: "Predict spectrum" }, void 0) }, void 0)] }, void 0));
|
|
212
182
|
}
|
|
213
183
|
exports.default = PredictSpectraModal;
|
|
@@ -96,7 +96,9 @@ function ChangeSumModal({ onSave, onClose, header, sumOptions, }) {
|
|
|
96
96
|
setActiveOption(tab.tabid);
|
|
97
97
|
}, []);
|
|
98
98
|
(0, react_2.useEffect)(() => {
|
|
99
|
-
if (sumOptions.sumAuto
|
|
99
|
+
if (sumOptions.sumAuto &&
|
|
100
|
+
!general.hideSetSumFromMolecule &&
|
|
101
|
+
!panels.hideStructuresPanel) {
|
|
100
102
|
setActiveOption(SumSetOptions.Auto);
|
|
101
103
|
const { mf, moleculeKey: key } = sumOptions;
|
|
102
104
|
formRef.current.setValues({
|
|
@@ -108,7 +110,7 @@ function ChangeSumModal({ onSave, onClose, header, sumOptions, }) {
|
|
|
108
110
|
setActiveOption(SumSetOptions.Manual);
|
|
109
111
|
formRef.current.setValues({ sum: sumOptions.sum, molecule: null });
|
|
110
112
|
}
|
|
111
|
-
}, [sumOptions]);
|
|
113
|
+
}, [general.hideSetSumFromMolecule, panels.hideStructuresPanel, sumOptions]);
|
|
112
114
|
const saveHandler = (0, react_2.useCallback)((values) => {
|
|
113
115
|
switch (setOption) {
|
|
114
116
|
case SumSetOptions.Auto: {
|
|
@@ -42,7 +42,7 @@ const useValidation = () => (0, react_1.useMemo)(() => {
|
|
|
42
42
|
});
|
|
43
43
|
}),
|
|
44
44
|
}))
|
|
45
|
-
.min(1, 'There must be at least one coupling in a
|
|
45
|
+
.min(1, 'There must be at least one coupling in a signal'),
|
|
46
46
|
}))
|
|
47
47
|
.min(1, 'There must be at least one signal in a range!'),
|
|
48
48
|
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
7
|
+
/** @jsxImportSource @emotion/react */
|
|
8
|
+
const react_1 = require("@emotion/react");
|
|
9
|
+
const formik_1 = require("formik");
|
|
10
|
+
const DefaultPathLengths_1 = __importDefault(require("../../../data/constants/DefaultPathLengths"));
|
|
11
|
+
const FormikNumberInput_1 = __importDefault(require("../../elements/formik/FormikNumberInput"));
|
|
12
|
+
const editPathLengthsStyles = (0, react_1.css) `
|
|
13
|
+
width: 100%;
|
|
14
|
+
height: 100%;
|
|
15
|
+
margin-top: 10px;
|
|
16
|
+
text-align: center;
|
|
17
|
+
|
|
18
|
+
.input-container {
|
|
19
|
+
width: 100%;
|
|
20
|
+
margin-top: 5px;
|
|
21
|
+
text-align: center;
|
|
22
|
+
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
align-items: center;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
|
|
28
|
+
input::-webkit-outer-spin-button,
|
|
29
|
+
input::-webkit-inner-spin-button {
|
|
30
|
+
-webkit-appearance: none;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
button {
|
|
35
|
+
flex: 2;
|
|
36
|
+
padding: 5px;
|
|
37
|
+
border: 1px solid gray;
|
|
38
|
+
border-radius: 5px;
|
|
39
|
+
height: 30px;
|
|
40
|
+
margin: 0 auto;
|
|
41
|
+
margin-top: 15px;
|
|
42
|
+
display: block;
|
|
43
|
+
width: 60px;
|
|
44
|
+
|
|
45
|
+
color: white;
|
|
46
|
+
background-color: gray;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.warning {
|
|
50
|
+
margin-top: 5px;
|
|
51
|
+
color: red;
|
|
52
|
+
}
|
|
53
|
+
`;
|
|
54
|
+
function EditPathLengthFormik({ signalIndex }) {
|
|
55
|
+
const { errors, values, } = (0, formik_1.useFormikContext)();
|
|
56
|
+
return ((0, jsx_runtime_1.jsxs)("div", { css: editPathLengthsStyles, children: [(0, jsx_runtime_1.jsx)("p", { children: "Setting of the minimum and maximum path length (J coupling)." }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "input-container", children: [(0, jsx_runtime_1.jsx)(FormikNumberInput_1.default, { name: `signals[${signalIndex}].j.pathLength.from`, defaultValue: values.signals[signalIndex].j?.pathLength?.from ||
|
|
57
|
+
DefaultPathLengths_1.default[values.experimentType]?.from ||
|
|
58
|
+
1, label: "Min: ", style: {
|
|
59
|
+
input: {
|
|
60
|
+
color: errors.signals?.[signalIndex].j?.pathLength?.from
|
|
61
|
+
? 'red'
|
|
62
|
+
: 'black',
|
|
63
|
+
},
|
|
64
|
+
}, min: 1, max: values.signals[signalIndex].j?.pathLength?.to ||
|
|
65
|
+
DefaultPathLengths_1.default[values.experimentType]?.to, pattern: "[1-9]+" }, void 0), (0, jsx_runtime_1.jsx)(FormikNumberInput_1.default, { name: `signals[${signalIndex}].j.pathLength.to`, defaultValue: values.signals[signalIndex].j?.pathLength?.to ||
|
|
66
|
+
DefaultPathLengths_1.default[values.experimentType]?.to ||
|
|
67
|
+
1, label: "Max: ", style: {
|
|
68
|
+
input: {
|
|
69
|
+
color: errors.signals?.[signalIndex].j?.pathLength?.to
|
|
70
|
+
? 'red'
|
|
71
|
+
: 'black',
|
|
72
|
+
},
|
|
73
|
+
}, min: values.signals[signalIndex].j?.pathLength?.from ||
|
|
74
|
+
DefaultPathLengths_1.default[values.experimentType]?.from ||
|
|
75
|
+
1, pattern: "[1-9]+" }, void 0)] }, void 0)] }, void 0));
|
|
76
|
+
}
|
|
77
|
+
exports.default = EditPathLengthFormik;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
7
|
+
/** @jsxImportSource @emotion/react */
|
|
8
|
+
const react_1 = require("@emotion/react");
|
|
9
|
+
const react_2 = require("react");
|
|
10
|
+
const fa_1 = require("react-icons/fa");
|
|
11
|
+
const DefaultPathLengths_1 = __importDefault(require("../../../data/constants/DefaultPathLengths"));
|
|
12
|
+
const Button_1 = __importDefault(require("../../elements/Button"));
|
|
13
|
+
const CloseButton_1 = __importDefault(require("../../elements/CloseButton"));
|
|
14
|
+
const SaveButton_1 = __importDefault(require("../../elements/SaveButton"));
|
|
15
|
+
const FormikForm_1 = __importDefault(require("../../elements/formik/FormikForm"));
|
|
16
|
+
const SignalsForm_1 = __importDefault(require("./SignalsForm"));
|
|
17
|
+
const EditZoneValidation_1 = __importDefault(require("./validation/EditZoneValidation"));
|
|
18
|
+
const isDefaultPathLength_1 = __importDefault(require("./validation/isDefaultPathLength"));
|
|
19
|
+
const styles = (0, react_1.css) `
|
|
20
|
+
width: 500px;
|
|
21
|
+
height: 250px;
|
|
22
|
+
padding: 5px;
|
|
23
|
+
button:focus {
|
|
24
|
+
outline: none;
|
|
25
|
+
}
|
|
26
|
+
.header {
|
|
27
|
+
height: 24px;
|
|
28
|
+
border-bottom: 1px solid #f0f0f0;
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
span {
|
|
32
|
+
color: #464646;
|
|
33
|
+
font-size: 15px;
|
|
34
|
+
flex: 1;
|
|
35
|
+
border-left: 1px solid #ececec;
|
|
36
|
+
padding-left: 6px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
button {
|
|
40
|
+
background-color: transparent;
|
|
41
|
+
border: none;
|
|
42
|
+
padding: 5px;
|
|
43
|
+
|
|
44
|
+
svg {
|
|
45
|
+
height: 16px;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
.container {
|
|
50
|
+
display: flex;
|
|
51
|
+
margin: 30px 5px;
|
|
52
|
+
}
|
|
53
|
+
`;
|
|
54
|
+
function EditZoneModal({ onSaveEditZoneModal = () => null, onCloseEditZoneModal = () => null, onZoomEditZoneModal = () => null, rowData, }) {
|
|
55
|
+
const formRef = (0, react_2.useRef)(null);
|
|
56
|
+
const validation = (0, EditZoneValidation_1.default)();
|
|
57
|
+
const handleOnZoom = (0, react_2.useCallback)(() => {
|
|
58
|
+
onZoomEditZoneModal(rowData);
|
|
59
|
+
}, [onZoomEditZoneModal, rowData]);
|
|
60
|
+
(0, react_2.useEffect)(() => {
|
|
61
|
+
handleOnZoom();
|
|
62
|
+
}, [handleOnZoom]);
|
|
63
|
+
const handleOnClose = (0, react_2.useCallback)(() => {
|
|
64
|
+
onCloseEditZoneModal();
|
|
65
|
+
}, [onCloseEditZoneModal]);
|
|
66
|
+
const handleOnSave = (0, react_2.useCallback)(async (formValues) => {
|
|
67
|
+
const _rowData = {
|
|
68
|
+
...rowData,
|
|
69
|
+
signals: formValues.signals.map((signal) => {
|
|
70
|
+
if ((0, isDefaultPathLength_1.default)(signal.j?.pathLength, rowData.tableMetaInfo.experiment)) {
|
|
71
|
+
delete signal.j?.pathLength;
|
|
72
|
+
if (signal.j && Object.keys(signal.j).length === 0) {
|
|
73
|
+
delete signal.j;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return signal;
|
|
77
|
+
}),
|
|
78
|
+
};
|
|
79
|
+
await onSaveEditZoneModal(_rowData);
|
|
80
|
+
handleOnClose();
|
|
81
|
+
}, [handleOnClose, onSaveEditZoneModal, rowData]);
|
|
82
|
+
const data = (0, react_2.useMemo)(() => {
|
|
83
|
+
return {
|
|
84
|
+
activeTab: '0',
|
|
85
|
+
signals: rowData.signals.map((signal) => {
|
|
86
|
+
return {
|
|
87
|
+
...signal,
|
|
88
|
+
j: {
|
|
89
|
+
pathLength: {
|
|
90
|
+
from: DefaultPathLengths_1.default[rowData.tableMetaInfo.experiment]?.from || 1,
|
|
91
|
+
to: DefaultPathLengths_1.default[rowData.tableMetaInfo.experiment]?.to || 1,
|
|
92
|
+
},
|
|
93
|
+
...signal.j,
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
}),
|
|
97
|
+
};
|
|
98
|
+
}, [rowData.signals, rowData.tableMetaInfo.experiment]);
|
|
99
|
+
return ((0, jsx_runtime_1.jsx)("div", { css: styles, children: (0, jsx_runtime_1.jsxs)(FormikForm_1.default, { ref: formRef, initialValues: data, validationSchema: validation, onSubmit: handleOnSave, children: [(0, jsx_runtime_1.jsxs)("div", { className: "header handle", children: [(0, jsx_runtime_1.jsx)(Button_1.default, { onClick: handleOnZoom, className: "zoom-button", children: (0, jsx_runtime_1.jsx)(fa_1.FaSearchPlus, { title: "Set to default view on range in spectrum" }, void 0) }, void 0), (0, jsx_runtime_1.jsx)("span", { children: `Zone and Signal edition` }, void 0), (0, jsx_runtime_1.jsx)(SaveButton_1.default, { onClick: () => formRef.current.submitForm(), popupTitle: "Save and exit" }, void 0), (0, jsx_runtime_1.jsx)(CloseButton_1.default, { onClick: handleOnClose }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)(SignalsForm_1.default, {}, void 0)] }, void 0) }, void 0));
|
|
100
|
+
}
|
|
101
|
+
exports.default = EditZoneModal;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const EditPathLengthFormik_1 = __importDefault(require("./EditPathLengthFormik"));
|
|
8
|
+
function SignalFormTab({ signalIndex }) {
|
|
9
|
+
return (0, jsx_runtime_1.jsx)(EditPathLengthFormik_1.default, { signalIndex: signalIndex }, void 0);
|
|
10
|
+
}
|
|
11
|
+
exports.default = SignalFormTab;
|