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
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import * as Yup from 'yup';
|
|
3
|
+
const useValidation = () => useMemo(() => {
|
|
4
|
+
return Yup.object().shape({
|
|
5
|
+
signals: Yup.array()
|
|
6
|
+
.of(Yup.object().shape({
|
|
7
|
+
j: Yup.object().shape({
|
|
8
|
+
pathLength: Yup.object().shape({
|
|
9
|
+
from: Yup.number().required().positive().integer(),
|
|
10
|
+
to: Yup.number().required().positive().integer(),
|
|
11
|
+
}),
|
|
12
|
+
}),
|
|
13
|
+
}))
|
|
14
|
+
.min(1, 'There must be at least one signal in a zone!'),
|
|
15
|
+
});
|
|
16
|
+
}, []);
|
|
17
|
+
export default useValidation;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import DefaultPathLengths from '../../../../data/constants/DefaultPathLengths';
|
|
2
|
+
function isDefaultPathLength(pathLength, experimentType) {
|
|
3
|
+
return (DefaultPathLengths[experimentType] &&
|
|
4
|
+
pathLength.from === DefaultPathLengths[experimentType].from &&
|
|
5
|
+
pathLength.to === DefaultPathLengths[experimentType].to);
|
|
6
|
+
}
|
|
7
|
+
export default isDefaultPathLength;
|
|
@@ -2,6 +2,6 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import Label from '../../elements/Label';
|
|
3
3
|
import FormikInput from '../../elements/formik/FormikInput';
|
|
4
4
|
function ControllersTabContent() {
|
|
5
|
-
return (_jsxs(_Fragment, { children: [_jsx("p", { className: "section-header", children: "
|
|
5
|
+
return (_jsxs(_Fragment, { children: [_jsx("p", { className: "section-header", children: "Spectra" }, void 0), _jsx(Label, { title: "Transparency of Dimmed Spectra [ 0 - 1 ]", children: _jsx(FormikInput, { name: "controllers.dimmedSpectraTransparency", checkValue: (value) => value >= 0 && value <= 1, type: "number" }, void 0) }, void 0)] }, void 0));
|
|
6
6
|
}
|
|
7
7
|
export default ControllersTabContent;
|
|
@@ -46,9 +46,13 @@ const LIST = [
|
|
|
46
46
|
label: 'Database Panel',
|
|
47
47
|
name: 'display.panels.hideDatabasePanel',
|
|
48
48
|
},
|
|
49
|
+
{
|
|
50
|
+
label: 'Prediction Panel',
|
|
51
|
+
name: 'display.panels.hidePredictionPanel',
|
|
52
|
+
},
|
|
49
53
|
{
|
|
50
54
|
label: 'Experimental Features',
|
|
51
|
-
name: 'display.hideExperimentalFeatures',
|
|
55
|
+
name: 'display.general.hideExperimentalFeatures',
|
|
52
56
|
},
|
|
53
57
|
];
|
|
54
58
|
function DisplayTabContent({ preferences }) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
interface GeneralSettingsProps {
|
|
2
2
|
onClose?: () => void;
|
|
3
|
-
onSave?: () => void;
|
|
4
3
|
}
|
|
5
|
-
declare function GeneralSettings({ onClose
|
|
4
|
+
declare function GeneralSettings({ onClose }: GeneralSettingsProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
6
5
|
export default GeneralSettings;
|
|
@@ -7,8 +7,8 @@ import CloseButton from '../../elements/CloseButton';
|
|
|
7
7
|
import Tab from '../../elements/Tab/Tab';
|
|
8
8
|
import Tabs, { PositionsEnum } from '../../elements/Tab/Tabs';
|
|
9
9
|
import FormikForm from '../../elements/formik/FormikForm';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { useAlert } from '../../elements/popup/Alert';
|
|
11
|
+
import { SET_PREFERENCES, RESET_PREFERENCES, } from '../../reducer/preferencesReducer';
|
|
12
12
|
import ControllersTabContent from './ControllersTabContent';
|
|
13
13
|
import DisplayTabContent from './DisplayTabContent';
|
|
14
14
|
import FormattingTabContent from './FormattingTabContent';
|
|
@@ -139,23 +139,27 @@ const styles = css `
|
|
|
139
139
|
margin-bottom: 5px;
|
|
140
140
|
}
|
|
141
141
|
`;
|
|
142
|
-
function GeneralSettings({ onClose
|
|
142
|
+
function GeneralSettings({ onClose }) {
|
|
143
143
|
const [activeTab, setActiveTab] = useState('controllers');
|
|
144
144
|
const preferences = usePreferences();
|
|
145
|
-
const
|
|
145
|
+
const alert = useAlert();
|
|
146
146
|
const refForm = useRef();
|
|
147
147
|
const handleSave = useCallback(() => {
|
|
148
148
|
refForm.current.submitForm();
|
|
149
149
|
}, []);
|
|
150
|
+
const handleReset = useCallback(() => {
|
|
151
|
+
preferences.dispatch({ type: RESET_PREFERENCES });
|
|
152
|
+
alert.success('Settings saved successfully');
|
|
153
|
+
onClose?.();
|
|
154
|
+
}, [alert, onClose, preferences]);
|
|
150
155
|
const submitHandler = useCallback((values) => {
|
|
151
|
-
const { dispatch, basePreferences, ...resValues } = values;
|
|
152
|
-
setSettingsData(resValues);
|
|
153
156
|
preferences.dispatch({ type: SET_PREFERENCES, payload: values });
|
|
154
|
-
|
|
155
|
-
|
|
157
|
+
alert.success('Settings saved successfully');
|
|
158
|
+
onClose?.();
|
|
159
|
+
}, [alert, onClose, preferences]);
|
|
156
160
|
const tabChangeHandler = useCallback((tab) => {
|
|
157
161
|
setActiveTab(tab.tabid);
|
|
158
162
|
}, []);
|
|
159
|
-
return (_jsxs("div", { css: styles, children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "General Settings" }, void 0), _jsx(CloseButton, { onClick: onClose, className: "close-bt" }, void 0)] }, void 0), _jsx("div", { className: "main-content", children: _jsx(FormikForm, { ref: refForm, initialValues: preferences, onSubmit: submitHandler, children: _jsxs(Tabs, { position: PositionsEnum.LEFT, activeTab: activeTab, onClick: tabChangeHandler, children: [_jsx(Tab, { tablabel: "Controllers", tabid: "controllers", children: _jsx("div", { className: "inner-content", children: _jsx(ControllersTabContent, {}, void 0) }, void 0) }, void 0), _jsx(Tab, { tablabel: "Formatting", tabid: "formatting", children: _jsx("div", { className: "inner-content", children: _jsx(FormattingTabContent, {}, void 0) }, void 0) }, void 0), _jsx(Tab, { tablabel: "Display", tabid: "display", children: _jsx("div", { className: "inner-content", children: _jsx(DisplayTabContent, { preferences: preferences }, void 0) }, void 0) }, void 0)] }, void 0) }, void 0) }, void 0),
|
|
163
|
+
return (_jsxs("div", { css: styles, children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "General Settings" }, void 0), _jsx(CloseButton, { onClick: onClose, className: "close-bt" }, void 0)] }, void 0), _jsx("div", { className: "main-content", children: _jsx(FormikForm, { ref: refForm, initialValues: preferences, onSubmit: submitHandler, children: _jsxs(Tabs, { position: PositionsEnum.LEFT, activeTab: activeTab, onClick: tabChangeHandler, children: [_jsx(Tab, { tablabel: "Controllers", tabid: "controllers", children: _jsx("div", { className: "inner-content", children: _jsx(ControllersTabContent, {}, void 0) }, void 0) }, void 0), _jsx(Tab, { tablabel: "Formatting", tabid: "formatting", children: _jsx("div", { className: "inner-content", children: _jsx(FormattingTabContent, {}, void 0) }, void 0) }, void 0), _jsx(Tab, { tablabel: "Display", tabid: "display", children: _jsx("div", { className: "inner-content", children: _jsx(DisplayTabContent, { preferences: preferences }, void 0) }, void 0) }, void 0)] }, void 0) }, void 0) }, void 0), _jsxs("div", { className: "footer-container", children: [_jsx("button", { type: "button", onClick: handleReset, className: "btn", children: "Reset" }, void 0), _jsx("button", { type: "button", onClick: handleSave, className: "btn", children: "Save" }, void 0)] }, void 0)] }, void 0));
|
|
160
164
|
}
|
|
161
165
|
export default GeneralSettings;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/** @jsxImportSource @emotion/react */
|
|
3
|
+
import { SvgNmrAssignment2 } from 'cheminfo-font';
|
|
4
|
+
import { useCallback } from 'react';
|
|
5
|
+
import Button from '../../elements/ButtonToolTip';
|
|
6
|
+
import { tablePanelStyle } from '../extra/BasicPanelStyle';
|
|
7
|
+
import DefaultPanelHeader from '../header/DefaultPanelHeader';
|
|
8
|
+
function AutomaticAssignment() {
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
10
|
+
const automaticAssignmentHandler = useCallback(() => { }, []);
|
|
11
|
+
return (_jsxs("div", { css: tablePanelStyle, children: [_jsx(DefaultPanelHeader, { showSettingButton: false, canDelete: false, children: _jsx(Button, { popupTitle: "automatic assignment", onClick: automaticAssignmentHandler, children: _jsx(SvgNmrAssignment2, { style: { fontSize: '18px' } }, void 0) }, void 0) }, void 0), _jsx("div", { className: "inner-container" }, void 0)] }, void 0));
|
|
12
|
+
}
|
|
13
|
+
export default AutomaticAssignment;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface AutomaticAssignmentTableProps {
|
|
3
|
+
data: any;
|
|
4
|
+
}
|
|
5
|
+
declare function PeaksTable({ data }: AutomaticAssignmentTableProps): JSX.Element;
|
|
6
|
+
declare const _default: import("react").MemoExoticComponent<typeof PeaksTable>;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { SvgNmrAssignment } from 'cheminfo-font';
|
|
3
|
+
import { useCallback, useMemo, memo } from 'react';
|
|
4
|
+
import ReactTable from '../../elements/ReactTable/ReactTable';
|
|
5
|
+
import NoTableData from '../extra/placeholder/NoTableData';
|
|
6
|
+
function PeaksTable({ data }) {
|
|
7
|
+
const assignHandler = useCallback((e, row) => {
|
|
8
|
+
e.preventDefault();
|
|
9
|
+
e.stopPropagation();
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11
|
+
const params = row.original;
|
|
12
|
+
}, []);
|
|
13
|
+
const COLUMNS = useMemo(() => [
|
|
14
|
+
{
|
|
15
|
+
index: 1,
|
|
16
|
+
Header: '#',
|
|
17
|
+
Cell: ({ row }) => row.index + 1,
|
|
18
|
+
style: { width: '1%', maxWidth: '40px', minWidth: '40px' },
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
index: 2,
|
|
22
|
+
Header: 'Score',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
index: 3,
|
|
26
|
+
Header: '',
|
|
27
|
+
style: {
|
|
28
|
+
width: '1%',
|
|
29
|
+
maxWidth: '24px',
|
|
30
|
+
minWidth: '24px',
|
|
31
|
+
},
|
|
32
|
+
id: 'assign-button',
|
|
33
|
+
Cell: ({ row }) => (_jsx("button", { type: "button", className: "assign-button", onClick: (e) => assignHandler(e, row), children: _jsx(SvgNmrAssignment, {}, void 0) }, void 0)),
|
|
34
|
+
},
|
|
35
|
+
], [assignHandler]);
|
|
36
|
+
return data && data.length > 0 ? (_jsx(ReactTable, { data: data, columns: COLUMNS }, void 0)) : (_jsx(NoTableData, {}, void 0));
|
|
37
|
+
}
|
|
38
|
+
export default memo(PeaksTable);
|
|
@@ -63,9 +63,6 @@ function IntegralPanelInner({ integrals, info, activeTab, xDomain, preferences,
|
|
|
63
63
|
}, [changeIntegralSumHandler, currentSum, integrals?.options, modal]);
|
|
64
64
|
const settingsPanelHandler = useCallback(() => {
|
|
65
65
|
setFlipStatus(!isFlipped);
|
|
66
|
-
if (!isFlipped) {
|
|
67
|
-
settingRef.current.cancelSetting();
|
|
68
|
-
}
|
|
69
66
|
}, [isFlipped]);
|
|
70
67
|
const saveSettingHandler = useCallback(() => {
|
|
71
68
|
settingRef.current.saveSetting();
|
|
@@ -9,7 +9,7 @@ import FormikNumberInput from '../../elements/formik/FormikNumberInput';
|
|
|
9
9
|
import { useAlert } from '../../elements/popup/Alert';
|
|
10
10
|
import useNucleus from '../../hooks/useNucleus';
|
|
11
11
|
import { SET_PANELS_PREFERENCES } from '../../reducer/preferencesReducer';
|
|
12
|
-
import {
|
|
12
|
+
import { getValue as getValueByKeyPath } from '../../utility/LocalStorage';
|
|
13
13
|
import { integralDefaultValues } from '../extra/preferences/defaultValues';
|
|
14
14
|
const styles = {
|
|
15
15
|
container: {
|
|
@@ -61,7 +61,6 @@ const formatFields = [
|
|
|
61
61
|
];
|
|
62
62
|
function IntegralsPreferencesInner({ nucleus, preferences, innerRef, }) {
|
|
63
63
|
const alert = useAlert();
|
|
64
|
-
const [, setSettingsData] = useStateWithLocalStorage('nmr-general-settings');
|
|
65
64
|
const formRef = useRef();
|
|
66
65
|
const updateValues = useCallback(() => {
|
|
67
66
|
if (nucleus) {
|
|
@@ -78,31 +77,19 @@ function IntegralsPreferencesInner({ nucleus, preferences, innerRef, }) {
|
|
|
78
77
|
useEffect(() => {
|
|
79
78
|
updateValues();
|
|
80
79
|
}, [updateValues]);
|
|
81
|
-
const
|
|
82
|
-
setSettingsData(values, 'formatting.panels.integrals');
|
|
83
|
-
};
|
|
84
|
-
const saveHandler = useCallback((values, showMessage = false) => {
|
|
80
|
+
const saveHandler = useCallback((values) => {
|
|
85
81
|
preferences.dispatch({
|
|
86
82
|
type: SET_PANELS_PREFERENCES,
|
|
87
83
|
payload: { key: 'integrals', value: values },
|
|
88
84
|
});
|
|
89
|
-
|
|
90
|
-
alert.success('Integrals preferences saved successfully');
|
|
91
|
-
}
|
|
85
|
+
alert.success('Integrals preferences saved successfully');
|
|
92
86
|
}, [alert, preferences]);
|
|
93
87
|
useImperativeHandle(innerRef, () => ({
|
|
94
88
|
saveSetting: () => {
|
|
95
89
|
formRef.current.submitForm();
|
|
96
90
|
},
|
|
97
|
-
cancelSetting: () => {
|
|
98
|
-
updateValues();
|
|
99
|
-
},
|
|
100
91
|
}));
|
|
101
|
-
|
|
102
|
-
saveHandler(values, true);
|
|
103
|
-
saveToLocalStorgate(values);
|
|
104
|
-
};
|
|
105
|
-
return (_jsx("div", { style: styles.container, children: _jsxs(FormikForm, { onSubmit: handleSubmit, ref: formRef, children: [_jsxs("div", { style: styles.groupContainer, children: [_jsx("p", { style: styles.header, children: "General" }, void 0), _jsx(FormikColorInput, { name: "color" }, void 0), _jsx(FormikNumberInput, { name: "strokeWidth", label: "stroke width :", style: {
|
|
92
|
+
return (_jsx("div", { style: styles.container, children: _jsxs(FormikForm, { onSubmit: saveHandler, ref: formRef, children: [_jsxs("div", { style: styles.groupContainer, children: [_jsx("p", { style: styles.header, children: "General" }, void 0), _jsx(FormikColorInput, { name: "color" }, void 0), _jsx(FormikNumberInput, { name: "strokeWidth", label: "stroke width :", style: {
|
|
106
93
|
label: { fontSize: '11px', fontWeight: 'bold', color: '#232323' },
|
|
107
94
|
input: {
|
|
108
95
|
width: '60%',
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { Molecule } from '../../../data/molecules/Molecule';
|
|
3
|
+
import { MoleculeHeaderActionsOptions } from './MoleculePanelHeader';
|
|
4
|
+
interface MoleculePanelProps {
|
|
5
|
+
onMoleculeChange?: (molecule: Molecule) => void;
|
|
6
|
+
children?: ReactElement;
|
|
7
|
+
actionsOptions?: MoleculeHeaderActionsOptions;
|
|
8
|
+
}
|
|
9
|
+
export default function MoleculePanel({ onMoleculeChange, children, actionsOptions, }: MoleculePanelProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -18,16 +18,21 @@ import useAtomAssignment from './useAtomAssignment';
|
|
|
18
18
|
const styles = {
|
|
19
19
|
panel: css({
|
|
20
20
|
display: 'flex',
|
|
21
|
+
overflow: 'auto',
|
|
21
22
|
flexGrow: 1,
|
|
22
23
|
width: '100%',
|
|
23
24
|
height: '100%',
|
|
24
25
|
flexDirection: 'column',
|
|
25
26
|
}),
|
|
26
|
-
|
|
27
|
+
innerPanel: css({
|
|
27
28
|
display: 'flex',
|
|
28
|
-
flex: '1
|
|
29
|
+
flex: '1',
|
|
29
30
|
flexDirection: 'column',
|
|
30
|
-
|
|
31
|
+
overflow: 'auto',
|
|
32
|
+
}),
|
|
33
|
+
molecule: css({
|
|
34
|
+
display: 'flex',
|
|
35
|
+
flex: '1',
|
|
31
36
|
}),
|
|
32
37
|
toolbar: css({
|
|
33
38
|
display: 'flex',
|
|
@@ -52,7 +57,7 @@ const styles = {
|
|
|
52
57
|
minHeight: 0,
|
|
53
58
|
}),
|
|
54
59
|
};
|
|
55
|
-
function MoleculePanelInner({ zones, ranges, molecules: moleculesProp, activeTab, displayerMode, }) {
|
|
60
|
+
function MoleculePanelInner({ zones, ranges, molecules: moleculesProp, activeTab, displayerMode, onMoleculeChange, actionsOptions, children, }) {
|
|
56
61
|
const [currentIndex, setCurrentIndex] = useState(0);
|
|
57
62
|
const [molecules, setMolecules] = useState([]);
|
|
58
63
|
const dispatch = useDispatch();
|
|
@@ -68,6 +73,9 @@ function MoleculePanelInner({ zones, ranges, molecules: moleculesProp, activeTab
|
|
|
68
73
|
});
|
|
69
74
|
}
|
|
70
75
|
}, [molecules.length, moleculesProp]);
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
onMoleculeChange?.(molecules[currentIndex] || null);
|
|
78
|
+
}, [currentIndex, molecules, onMoleculeChange]);
|
|
71
79
|
const handleReplaceMolecule = useCallback((key, molfile) => {
|
|
72
80
|
dispatch({ type: SET_MOLECULE, molfile, key });
|
|
73
81
|
}, [dispatch]);
|
|
@@ -81,21 +89,21 @@ function MoleculePanelInner({ zones, ranges, molecules: moleculesProp, activeTab
|
|
|
81
89
|
const moleculeIndexHandler = useCallback((index) => {
|
|
82
90
|
setCurrentIndex(index);
|
|
83
91
|
}, []);
|
|
84
|
-
return (_jsxs("div", { css: styles.panel, children: [_jsx(MoleculePanelHeader, { currentIndex: currentIndex, molecules: molecules, onOpenMoleculeEditor: () => openMoleculeEditorHandler(), onMoleculeIndexChange: moleculeIndexHandler }, void 0), _jsx("div", { css: styles.molecule, children: _jsx(NextPrev, { onChange: (slideIndex) => setCurrentIndex(slideIndex), defaultIndex: currentIndex, children: molecules && molecules.length > 0 ? (molecules.map((mol, index) => (_jsxs("div", { css: styles.items, children: [_jsxs("span", { css: styles.toolbar, children: [_jsx(MF, { mf: mol.mf }, void 0), " - ", mol.mw?.toFixed(2)] }, void 0), _jsx("div", { css: styles.slider, className: "mol-svg-container", onDoubleClick: () => openMoleculeEditorHandler(mol), style: {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
return (_jsxs("div", { css: styles.panel, children: [_jsx(MoleculePanelHeader, { currentIndex: currentIndex, molecules: molecules, onOpenMoleculeEditor: () => openMoleculeEditorHandler(), onMoleculeIndexChange: moleculeIndexHandler, actionsOptions: actionsOptions }, void 0), _jsxs("div", { css: styles.innerPanel, children: [_jsx("div", { css: styles.molecule, children: _jsx(NextPrev, { onChange: (slideIndex) => setCurrentIndex(slideIndex), defaultIndex: currentIndex, children: molecules && molecules.length > 0 ? (molecules.map((mol, index) => (_jsxs("div", { css: styles.items, children: [_jsxs("span", { css: styles.toolbar, children: [_jsx(MF, { mf: mol.mf }, void 0), " - ", mol.mw?.toFixed(2)] }, void 0), _jsx("div", { css: styles.slider, className: "mol-svg-container", onDoubleClick: () => openMoleculeEditorHandler(mol), style: {
|
|
93
|
+
backgroundColor: (index + 1) % 2 !== 0 ? '#fafafa' : 'white',
|
|
94
|
+
}, children: _jsx(ResponsiveChart, { children: ({ height, width }) => {
|
|
95
|
+
return (_jsx(OCLnmr, { OCL: OCL, id: `molSVG${index}`, width: width, height: height, molfile: mol.molfile || '', setMolfile: (molfile) => handleReplaceMolecule(mol.key, molfile), setSelectedAtom: handleOnClickAtom, atomHighlightColor: currentDiaIDsToHighlight &&
|
|
96
|
+
currentDiaIDsToHighlight.length > 0
|
|
97
|
+
? 'red'
|
|
98
|
+
: '#FFD700', atomHighlightOpacity: 0.35, highlights: currentDiaIDsToHighlight &&
|
|
99
|
+
currentDiaIDsToHighlight.length > 0
|
|
100
|
+
? currentDiaIDsToHighlight
|
|
101
|
+
: assignedDiaIDsMerged, setHoverAtom: handleOnAtomHover }, void 0));
|
|
102
|
+
} }, void 0) }, void 0)] }, mol.key)))) : (_jsx("div", { css: styles.slider, style: { height: '100%' }, onClick: () => openMoleculeEditorHandler(), children: _jsx("span", { children: "Click to draw molecule" }, void 0) }, void 0)) }, void 0) }, void 0), children] }, void 0)] }, void 0));
|
|
95
103
|
}
|
|
96
104
|
const MemoizedMoleculePanel = memo(MoleculePanelInner);
|
|
97
105
|
const emptyData = { ranges: {}, zones: {} };
|
|
98
|
-
export default function MoleculePanel() {
|
|
106
|
+
export default function MoleculePanel({ onMoleculeChange, children, actionsOptions, }) {
|
|
99
107
|
const { molecules, displayerMode, activeTab } = useChartData();
|
|
100
108
|
const data = useSpectrum(emptyData);
|
|
101
109
|
const ranges = data?.ranges || {};
|
|
@@ -106,5 +114,7 @@ export default function MoleculePanel() {
|
|
|
106
114
|
activeTab,
|
|
107
115
|
ranges,
|
|
108
116
|
zones,
|
|
109
|
-
|
|
117
|
+
onMoleculeChange,
|
|
118
|
+
actionsOptions,
|
|
119
|
+
}, children: children }, void 0));
|
|
110
120
|
}
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
export interface MoleculeHeaderActionsOptions {
|
|
2
|
+
hidePast?: boolean;
|
|
3
|
+
hideAdd?: boolean;
|
|
4
|
+
hideExport?: boolean;
|
|
5
|
+
hideDelete?: boolean;
|
|
6
|
+
hidePredict?: boolean;
|
|
7
|
+
}
|
|
1
8
|
interface MoleculePanelHeaderProps {
|
|
2
9
|
currentIndex: number;
|
|
3
10
|
molecules: Array<any>;
|
|
4
11
|
onMoleculeIndexChange: (index: number) => void;
|
|
5
12
|
onOpenMoleculeEditor: () => void;
|
|
13
|
+
actionsOptions?: MoleculeHeaderActionsOptions;
|
|
6
14
|
}
|
|
7
|
-
export default function MoleculePanelHeader({ currentIndex, molecules, onMoleculeIndexChange, onOpenMoleculeEditor, }: MoleculePanelHeaderProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
15
|
+
export default function MoleculePanelHeader({ currentIndex, molecules, onMoleculeIndexChange, onOpenMoleculeEditor, actionsOptions, }: MoleculePanelHeaderProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
8
16
|
export {};
|
|
@@ -55,7 +55,7 @@ const MOL_EXPORT_MENU = [
|
|
|
55
55
|
label: 'Export as SVG',
|
|
56
56
|
},
|
|
57
57
|
];
|
|
58
|
-
export default function MoleculePanelHeader({ currentIndex, molecules, onMoleculeIndexChange = () => null, onOpenMoleculeEditor = () => null, }) {
|
|
58
|
+
export default function MoleculePanelHeader({ currentIndex, molecules, onMoleculeIndexChange = () => null, onOpenMoleculeEditor = () => null, actionsOptions = {}, }) {
|
|
59
59
|
const alert = useAlert();
|
|
60
60
|
const dispatch = useDispatch();
|
|
61
61
|
const modal = useModal();
|
|
@@ -121,7 +121,7 @@ export default function MoleculePanelHeader({ currentIndex, molecules, onMolecul
|
|
|
121
121
|
width: 600,
|
|
122
122
|
});
|
|
123
123
|
}, [modal, molecules, currentIndex]);
|
|
124
|
-
return (_jsxs("div", { css: toolbarStyle, children: [_jsx(MenuButton, { component: _jsx(FaFileExport, {}, void 0), toolTip: "Export As", items: MOL_EXPORT_MENU, onClick: exportHandler }, void 0), _jsx(ToolTip, { title: "Paste molfile", popupPlacement: "left", children: _jsx("button", { className: "bar-button", type: "button", onClick: handlePaste, children: _jsx(FaPaste, {}, void 0) }, void 0) }, void 0), _jsx(ToolTip, { title: "Add Molecule", popupPlacement: "left", children: _jsx("button", { className: "bar-button", type: "button", onClick: onOpenMoleculeEditor, "data-test-id": "panel-structures-button-add", children: _jsx(FaPlus, {}, void 0) }, void 0) }, void 0), _jsx(ToolTip, { title: "Delete Molecule", popupPlacement: "left", children: _jsx("button", { className: "bar-button", type: "button", onClick: handleDelete, children: _jsx(FaRegTrashAlt, {}, void 0) }, void 0) }, void 0), molecules && molecules.length > 0 && (_jsx(ButtonToolTip, { popupTitle: "Predict Spectra", popupPlacement: "left", onClick: openPredictSpectraModal, children: _jsx(SvgNmrFt, {}, void 0) }, void 0)), _jsxs("p", { children: [molecules &&
|
|
124
|
+
return (_jsxs("div", { css: toolbarStyle, children: [!actionsOptions.hideExport && (_jsx(MenuButton, { component: _jsx(FaFileExport, {}, void 0), toolTip: "Export As", items: MOL_EXPORT_MENU, onClick: exportHandler }, void 0)), !actionsOptions.hidePast && (_jsx(ToolTip, { title: "Paste molfile", popupPlacement: "left", children: _jsx("button", { className: "bar-button", type: "button", onClick: handlePaste, children: _jsx(FaPaste, {}, void 0) }, void 0) }, void 0)), !actionsOptions.hideAdd && (_jsx(ToolTip, { title: "Add Molecule", popupPlacement: "left", children: _jsx("button", { className: "bar-button", type: "button", onClick: onOpenMoleculeEditor, "data-test-id": "panel-structures-button-add", children: _jsx(FaPlus, {}, void 0) }, void 0) }, void 0)), !actionsOptions.hideDelete && (_jsx(ToolTip, { title: "Delete Molecule", popupPlacement: "left", children: _jsx("button", { className: "bar-button", type: "button", onClick: handleDelete, children: _jsx(FaRegTrashAlt, {}, void 0) }, void 0) }, void 0)), !actionsOptions.hidePredict && molecules && molecules.length > 0 && (_jsx(ButtonToolTip, { popupTitle: "Predict Spectra", popupPlacement: "left", onClick: openPredictSpectraModal, children: _jsx(SvgNmrFt, {}, void 0) }, void 0)), _jsxs("p", { children: [molecules &&
|
|
125
125
|
molecules.length > 0 &&
|
|
126
126
|
`${+(currentIndex + 1)} / ${molecules.length}`, ' '] }, void 0)] }, void 0));
|
|
127
127
|
}
|
|
@@ -6,7 +6,7 @@ import { useChartData } from '../context/ChartContext';
|
|
|
6
6
|
import { usePreferences } from '../context/PreferencesContext';
|
|
7
7
|
import useCheckExperimentalFeature from '../hooks/useCheckExperimentalFeature';
|
|
8
8
|
import { DISPLAYER_MODE } from '../reducer/core/Constants';
|
|
9
|
-
import
|
|
9
|
+
import AutomaticAssignment from './AutomaticAssignment/AutomaticAssignment';
|
|
10
10
|
import InformationPanel from './InformationPanel';
|
|
11
11
|
import IntegralPanel from './IntegralsPanel/IntegralPanel';
|
|
12
12
|
import MatrixGenerationPanel from './MatrixGenerationPanel/MatrixGenerationPanel';
|
|
@@ -19,18 +19,17 @@ import SummaryPanel from './SummaryPanel/SummaryPanel';
|
|
|
19
19
|
import ZonesPanel from './ZonesPanel/ZonesPanel';
|
|
20
20
|
import DatabasePanel from './databasePanel/DatabasePanel';
|
|
21
21
|
import FilterPanel from './filtersPanel/FilterPanel';
|
|
22
|
+
import PredictionPane from './predictionPanel/PredictionPanel';
|
|
22
23
|
const accordionItems = [
|
|
23
24
|
{
|
|
24
25
|
title: 'Spectra',
|
|
25
26
|
component: _jsx(SpectrumListPanel, {}, void 0),
|
|
26
|
-
openWhen: null,
|
|
27
27
|
hidePreferenceKey: 'hideSpectraPanel',
|
|
28
28
|
mode: null,
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
title: 'Information',
|
|
32
32
|
component: _jsx(InformationPanel, {}, void 0),
|
|
33
|
-
openWhen: null,
|
|
34
33
|
style: { overflow: 'hidden' },
|
|
35
34
|
hidePreferenceKey: 'hideInformationPanel',
|
|
36
35
|
mode: null,
|
|
@@ -38,42 +37,36 @@ const accordionItems = [
|
|
|
38
37
|
{
|
|
39
38
|
title: 'Peaks',
|
|
40
39
|
component: _jsx(PeaksPanel, {}, void 0),
|
|
41
|
-
openWhen: [options.peakPicking.id],
|
|
42
40
|
hidePreferenceKey: 'hidePeaksPanel',
|
|
43
41
|
mode: null,
|
|
44
42
|
},
|
|
45
43
|
{
|
|
46
44
|
title: 'Filters',
|
|
47
45
|
component: _jsx(FilterPanel, {}, void 0),
|
|
48
|
-
openWhen: null,
|
|
49
46
|
hidePreferenceKey: 'hideFiltersPanel',
|
|
50
47
|
mode: null,
|
|
51
48
|
},
|
|
52
49
|
{
|
|
53
50
|
title: 'Integrals',
|
|
54
51
|
component: _jsx(IntegralPanel, {}, void 0),
|
|
55
|
-
openWhen: [options.integral.id],
|
|
56
52
|
hidePreferenceKey: 'hideIntegralsPanel',
|
|
57
53
|
mode: null,
|
|
58
54
|
},
|
|
59
55
|
{
|
|
60
56
|
title: 'Ranges',
|
|
61
57
|
component: _jsx(RangesPanel, {}, void 0),
|
|
62
|
-
openWhen: [options.rangesPicking.id],
|
|
63
58
|
hidePreferenceKey: 'hideRangesPanel',
|
|
64
59
|
mode: DISPLAYER_MODE.DM_1D,
|
|
65
60
|
},
|
|
66
61
|
{
|
|
67
62
|
title: 'Multiple Spectra Analysis',
|
|
68
63
|
component: _jsx(MultipleSpectraAnalysisPanel, {}, void 0),
|
|
69
|
-
openWhen: [options.multipleSpectraAnalysis.id],
|
|
70
64
|
hidePreferenceKey: 'hideMultipleSpectraAnalysisPanel',
|
|
71
65
|
mode: null,
|
|
72
66
|
},
|
|
73
67
|
{
|
|
74
68
|
title: 'Matrix Generation',
|
|
75
69
|
component: _jsx(MatrixGenerationPanel, {}, void 0),
|
|
76
|
-
openWhen: [],
|
|
77
70
|
hidePreferenceKey: '',
|
|
78
71
|
mode: null,
|
|
79
72
|
isExperimental: true,
|
|
@@ -81,38 +74,48 @@ const accordionItems = [
|
|
|
81
74
|
{
|
|
82
75
|
title: 'Zones',
|
|
83
76
|
component: _jsx(ZonesPanel, {}, void 0),
|
|
84
|
-
openWhen: [options.zone2D.id],
|
|
85
77
|
hidePreferenceKey: 'hideZonesPanel',
|
|
86
78
|
mode: DISPLAYER_MODE.DM_2D,
|
|
87
79
|
},
|
|
88
80
|
{
|
|
89
81
|
title: 'Summary',
|
|
90
82
|
component: _jsx(SummaryPanel, {}, void 0),
|
|
91
|
-
openWhen: [],
|
|
92
83
|
hidePreferenceKey: 'hideSummaryPanel',
|
|
93
84
|
mode: null,
|
|
94
85
|
},
|
|
95
86
|
{
|
|
96
87
|
title: 'Structures',
|
|
97
88
|
component: _jsx(MoleculePanel, {}, void 0),
|
|
98
|
-
openWhen: [options.rangesPicking.id],
|
|
99
89
|
hidePreferenceKey: 'hideStructuresPanel',
|
|
100
90
|
mode: null,
|
|
101
91
|
},
|
|
102
92
|
{
|
|
103
93
|
title: 'Database',
|
|
104
94
|
component: _jsx(DatabasePanel, {}, void 0),
|
|
105
|
-
openWhen: [],
|
|
106
95
|
hidePreferenceKey: 'hideDatabasePanel',
|
|
107
96
|
mode: null,
|
|
108
97
|
},
|
|
98
|
+
{
|
|
99
|
+
title: 'Automatic Assignment',
|
|
100
|
+
component: _jsx(AutomaticAssignment, {}, void 0),
|
|
101
|
+
hidePreferenceKey: '',
|
|
102
|
+
mode: null,
|
|
103
|
+
isExperimental: true,
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
title: 'Prediction',
|
|
107
|
+
component: _jsx(PredictionPane, {}, void 0),
|
|
108
|
+
hidePreferenceKey: 'hidePredictionPanel',
|
|
109
|
+
mode: null,
|
|
110
|
+
},
|
|
109
111
|
];
|
|
110
|
-
export const
|
|
112
|
+
export const TOOLS_PANELS_ACCORDION = {
|
|
111
113
|
null: 'Spectra',
|
|
112
114
|
peakPicking: 'Peaks',
|
|
113
115
|
integral: 'Integrals',
|
|
114
116
|
rangesPicking: 'Ranges',
|
|
115
117
|
zone2D: 'Zones',
|
|
118
|
+
multipleSpectraAnalysis: 'Multiple Spectra Analysis',
|
|
116
119
|
};
|
|
117
120
|
function PanelsInner({ displayerMode }) {
|
|
118
121
|
const preferences = usePreferences();
|
|
@@ -32,9 +32,6 @@ function PeaksPanelInner({ peaks, info, xDomain, activeTab, preferences, }) {
|
|
|
32
32
|
}, [modal, yesHandler]);
|
|
33
33
|
const settingsPanelHandler = useCallback(() => {
|
|
34
34
|
setFlipStatus(!isFlipped);
|
|
35
|
-
if (!isFlipped) {
|
|
36
|
-
settingRef.current.cancelSetting();
|
|
37
|
-
}
|
|
38
35
|
}, [isFlipped]);
|
|
39
36
|
const saveSettingHandler = useCallback(() => {
|
|
40
37
|
settingRef.current.saveSetting();
|
|
@@ -7,7 +7,7 @@ import FormikForm from '../../elements/formik/FormikForm';
|
|
|
7
7
|
import { useAlert } from '../../elements/popup/Alert';
|
|
8
8
|
import useNucleus from '../../hooks/useNucleus';
|
|
9
9
|
import { SET_PANELS_PREFERENCES } from '../../reducer/preferencesReducer';
|
|
10
|
-
import {
|
|
10
|
+
import { getValue as getValueByKeyPath } from '../../utility/LocalStorage';
|
|
11
11
|
import { peaksDefaultValues } from '../extra/preferences/defaultValues';
|
|
12
12
|
const styles = {
|
|
13
13
|
container: {
|
|
@@ -83,7 +83,6 @@ const formatFields = [
|
|
|
83
83
|
];
|
|
84
84
|
function PeaksPreferencesInner({ nucleus, preferences, innerRef, }) {
|
|
85
85
|
const alert = useAlert();
|
|
86
|
-
const [, setSettingsData] = useStateWithLocalStorage('nmr-general-settings');
|
|
87
86
|
const formRef = useRef(null);
|
|
88
87
|
const updateValues = useCallback(() => {
|
|
89
88
|
if (nucleus) {
|
|
@@ -98,27 +97,19 @@ function PeaksPreferencesInner({ nucleus, preferences, innerRef, }) {
|
|
|
98
97
|
useEffect(() => {
|
|
99
98
|
updateValues();
|
|
100
99
|
}, [updateValues]);
|
|
101
|
-
const saveHandler = useCallback((values
|
|
100
|
+
const saveHandler = useCallback((values) => {
|
|
102
101
|
preferences.dispatch({
|
|
103
102
|
type: SET_PANELS_PREFERENCES,
|
|
104
103
|
payload: { key: 'peaks', value: values },
|
|
105
104
|
});
|
|
106
|
-
|
|
107
|
-
alert.success('Peaks preferences saved successfully');
|
|
105
|
+
alert.success('Peaks preferences saved successfully');
|
|
108
106
|
}, [alert, preferences]);
|
|
109
107
|
useImperativeHandle(innerRef, () => ({
|
|
110
108
|
saveSetting: () => {
|
|
111
109
|
formRef.current.submitForm();
|
|
112
110
|
},
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
},
|
|
116
|
-
}), [updateValues]);
|
|
117
|
-
const handleSubmit = useCallback((values) => {
|
|
118
|
-
saveHandler(values, true);
|
|
119
|
-
setSettingsData(values, 'formatting.panels.peaks');
|
|
120
|
-
}, [saveHandler, setSettingsData]);
|
|
121
|
-
return (_jsx("div", { style: styles.container, children: _jsx(FormikForm, { onSubmit: handleSubmit, ref: formRef, children: nucleus?.map((nucleusLabel) => (_jsxs("div", { style: styles.groupContainer, children: [_jsx(IsotopesViewer, { style: styles.header, value: nucleusLabel }, void 0), formatFields.map((field) => (_jsx(FormikColumnFormatField, { label: field.label, checkControllerName: `${nucleusLabel}.${field.checkController}`, formatControllerName: `${nucleusLabel}.${field.formatController}`, hideFormat: field.formatController === 'deltaPPMFormat' }, field.id)))] }, nucleusLabel))) }, void 0) }, void 0));
|
|
111
|
+
}), []);
|
|
112
|
+
return (_jsx("div", { style: styles.container, children: _jsx(FormikForm, { onSubmit: saveHandler, ref: formRef, children: nucleus?.map((nucleusLabel) => (_jsxs("div", { style: styles.groupContainer, children: [_jsx(IsotopesViewer, { style: styles.header, value: nucleusLabel }, void 0), formatFields.map((field) => (_jsx(FormikColumnFormatField, { label: field.label, checkControllerName: `${nucleusLabel}.${field.checkController}`, formatControllerName: `${nucleusLabel}.${field.formatController}`, hideFormat: field.formatController === 'deltaPPMFormat' }, field.id)))] }, nucleusLabel))) }, void 0) }, void 0));
|
|
122
113
|
}
|
|
123
114
|
const MemoizedPeaksPreferences = memo(PeaksPreferencesInner);
|
|
124
115
|
// TODO: remove this hacky use of ref.
|
|
@@ -71,8 +71,8 @@ function RangesTablePanelInner({ ranges, data, info, xDomain, preferences, activ
|
|
|
71
71
|
to,
|
|
72
72
|
});
|
|
73
73
|
const dataToClipboard = {
|
|
74
|
-
x: x.slice(fromIndex, toIndex),
|
|
75
|
-
y: re.slice(fromIndex, toIndex),
|
|
74
|
+
x: Array.from(x.slice(fromIndex, toIndex)),
|
|
75
|
+
y: Array.from(re.slice(fromIndex, toIndex)),
|
|
76
76
|
...value,
|
|
77
77
|
};
|
|
78
78
|
const success = await copyTextToClipboard(JSON.stringify(dataToClipboard, undefined, 2));
|
|
@@ -100,9 +100,6 @@ function RangesTablePanelInner({ ranges, data, info, xDomain, preferences, activ
|
|
|
100
100
|
}, [isFilterActive]);
|
|
101
101
|
const settingsPanelHandler = useCallback(() => {
|
|
102
102
|
setFlipStatus(!isFlipped);
|
|
103
|
-
if (!isFlipped) {
|
|
104
|
-
settingRef.current.cancelSetting();
|
|
105
|
-
}
|
|
106
103
|
}, [isFlipped]);
|
|
107
104
|
const saveSettingHandler = useCallback(() => {
|
|
108
105
|
settingRef.current.saveSetting();
|