nmrium 0.20.1 → 0.22.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/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 +9 -2
- package/lib/component/NMRium.js +9 -9
- package/lib/component/elements/EditableColumn.d.ts +1 -1
- package/lib/component/elements/NumberInput.d.ts +1 -2
- package/lib/component/elements/Tab/Tab.js +1 -0
- 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 +88 -88
- 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 +1 -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.js +1 -1
- package/lib/component/panels/Panels.d.ts +1 -1
- package/lib/component/panels/Panels.js +10 -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 +6 -6
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -1
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +40 -43
- 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/reducer/IgnoreActions.js +2 -1
- package/lib/component/reducer/Reducer.d.ts +20 -34
- package/lib/component/reducer/Reducer.js +7 -8
- package/lib/component/reducer/actions/CorrelationsActions.d.ts +7 -7
- package/lib/component/reducer/actions/CorrelationsActions.js +1 -1
- 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 +22 -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 +87 -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 +45 -0
- package/lib/component/workspaces/exercise1D.d.ts +2 -0
- package/lib/component/workspaces/exercise1D.js +45 -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 +43 -0
- 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/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 +10 -10
- package/lib-cjs/component/elements/Tab/Tab.js +1 -0
- 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 +88 -88
- 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 +1 -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 +1 -1
- package/lib-cjs/component/panels/Panels.js +11 -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/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 +22 -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 -37
- 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 +48 -0
- package/lib-cjs/component/workspaces/exercise1D.js +48 -0
- package/lib-cjs/component/workspaces/index.js +6 -0
- package/lib-cjs/component/workspaces/process1D.js +46 -0
- 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 +15 -16
- 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;
|
|
@@ -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%',
|
|
@@ -91,7 +91,7 @@ function MoleculePanelInner({ zones, ranges, molecules: moleculesProp, activeTab
|
|
|
91
91
|
currentDiaIDsToHighlight.length > 0
|
|
92
92
|
? currentDiaIDsToHighlight
|
|
93
93
|
: assignedDiaIDsMerged, setHoverAtom: handleOnAtomHover }, void 0));
|
|
94
|
-
} }, void 0) }, void 0)] }, mol.key)))) : (_jsx("div", {
|
|
94
|
+
} }, 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)] }, void 0));
|
|
95
95
|
}
|
|
96
96
|
const MemoizedMoleculePanel = memo(MoleculePanelInner);
|
|
97
97
|
const emptyData = { ranges: {}, zones: {} };
|
|
@@ -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';
|
|
@@ -23,14 +23,12 @@ const accordionItems = [
|
|
|
23
23
|
{
|
|
24
24
|
title: 'Spectra',
|
|
25
25
|
component: _jsx(SpectrumListPanel, {}, void 0),
|
|
26
|
-
openWhen: null,
|
|
27
26
|
hidePreferenceKey: 'hideSpectraPanel',
|
|
28
27
|
mode: null,
|
|
29
28
|
},
|
|
30
29
|
{
|
|
31
30
|
title: 'Information',
|
|
32
31
|
component: _jsx(InformationPanel, {}, void 0),
|
|
33
|
-
openWhen: null,
|
|
34
32
|
style: { overflow: 'hidden' },
|
|
35
33
|
hidePreferenceKey: 'hideInformationPanel',
|
|
36
34
|
mode: null,
|
|
@@ -38,42 +36,36 @@ const accordionItems = [
|
|
|
38
36
|
{
|
|
39
37
|
title: 'Peaks',
|
|
40
38
|
component: _jsx(PeaksPanel, {}, void 0),
|
|
41
|
-
openWhen: [options.peakPicking.id],
|
|
42
39
|
hidePreferenceKey: 'hidePeaksPanel',
|
|
43
40
|
mode: null,
|
|
44
41
|
},
|
|
45
42
|
{
|
|
46
43
|
title: 'Filters',
|
|
47
44
|
component: _jsx(FilterPanel, {}, void 0),
|
|
48
|
-
openWhen: null,
|
|
49
45
|
hidePreferenceKey: 'hideFiltersPanel',
|
|
50
46
|
mode: null,
|
|
51
47
|
},
|
|
52
48
|
{
|
|
53
49
|
title: 'Integrals',
|
|
54
50
|
component: _jsx(IntegralPanel, {}, void 0),
|
|
55
|
-
openWhen: [options.integral.id],
|
|
56
51
|
hidePreferenceKey: 'hideIntegralsPanel',
|
|
57
52
|
mode: null,
|
|
58
53
|
},
|
|
59
54
|
{
|
|
60
55
|
title: 'Ranges',
|
|
61
56
|
component: _jsx(RangesPanel, {}, void 0),
|
|
62
|
-
openWhen: [options.rangesPicking.id],
|
|
63
57
|
hidePreferenceKey: 'hideRangesPanel',
|
|
64
58
|
mode: DISPLAYER_MODE.DM_1D,
|
|
65
59
|
},
|
|
66
60
|
{
|
|
67
61
|
title: 'Multiple Spectra Analysis',
|
|
68
62
|
component: _jsx(MultipleSpectraAnalysisPanel, {}, void 0),
|
|
69
|
-
openWhen: [options.multipleSpectraAnalysis.id],
|
|
70
63
|
hidePreferenceKey: 'hideMultipleSpectraAnalysisPanel',
|
|
71
64
|
mode: null,
|
|
72
65
|
},
|
|
73
66
|
{
|
|
74
67
|
title: 'Matrix Generation',
|
|
75
68
|
component: _jsx(MatrixGenerationPanel, {}, void 0),
|
|
76
|
-
openWhen: [],
|
|
77
69
|
hidePreferenceKey: '',
|
|
78
70
|
mode: null,
|
|
79
71
|
isExperimental: true,
|
|
@@ -81,38 +73,42 @@ const accordionItems = [
|
|
|
81
73
|
{
|
|
82
74
|
title: 'Zones',
|
|
83
75
|
component: _jsx(ZonesPanel, {}, void 0),
|
|
84
|
-
openWhen: [options.zone2D.id],
|
|
85
76
|
hidePreferenceKey: 'hideZonesPanel',
|
|
86
77
|
mode: DISPLAYER_MODE.DM_2D,
|
|
87
78
|
},
|
|
88
79
|
{
|
|
89
80
|
title: 'Summary',
|
|
90
81
|
component: _jsx(SummaryPanel, {}, void 0),
|
|
91
|
-
openWhen: [],
|
|
92
82
|
hidePreferenceKey: 'hideSummaryPanel',
|
|
93
83
|
mode: null,
|
|
94
84
|
},
|
|
95
85
|
{
|
|
96
86
|
title: 'Structures',
|
|
97
87
|
component: _jsx(MoleculePanel, {}, void 0),
|
|
98
|
-
openWhen: [options.rangesPicking.id],
|
|
99
88
|
hidePreferenceKey: 'hideStructuresPanel',
|
|
100
89
|
mode: null,
|
|
101
90
|
},
|
|
102
91
|
{
|
|
103
92
|
title: 'Database',
|
|
104
93
|
component: _jsx(DatabasePanel, {}, void 0),
|
|
105
|
-
openWhen: [],
|
|
106
94
|
hidePreferenceKey: 'hideDatabasePanel',
|
|
107
95
|
mode: null,
|
|
108
96
|
},
|
|
97
|
+
{
|
|
98
|
+
title: 'Automatic Assignment',
|
|
99
|
+
component: _jsx(AutomaticAssignment, {}, void 0),
|
|
100
|
+
hidePreferenceKey: '',
|
|
101
|
+
mode: null,
|
|
102
|
+
isExperimental: true,
|
|
103
|
+
},
|
|
109
104
|
];
|
|
110
|
-
export const
|
|
105
|
+
export const TOOLS_PANELS_ACCORDION = {
|
|
111
106
|
null: 'Spectra',
|
|
112
107
|
peakPicking: 'Peaks',
|
|
113
108
|
integral: 'Integrals',
|
|
114
109
|
rangesPicking: 'Ranges',
|
|
115
110
|
zone2D: 'Zones',
|
|
111
|
+
multipleSpectraAnalysis: 'Multiple Spectra Analysis',
|
|
116
112
|
};
|
|
117
113
|
function PanelsInner({ displayerMode }) {
|
|
118
114
|
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();
|
|
@@ -9,7 +9,7 @@ import FormikInput from '../../elements/formik/FormikInput';
|
|
|
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 { getRangeDefaultValues } from '../extra/preferences/defaultValues';
|
|
14
14
|
const styles = {
|
|
15
15
|
container: {
|
|
@@ -71,7 +71,6 @@ const formatFields = [
|
|
|
71
71
|
];
|
|
72
72
|
function RangesPreferencesInner({ nucleus, preferences, innerRef, }) {
|
|
73
73
|
const alert = useAlert();
|
|
74
|
-
const [, setSettingsData] = useStateWithLocalStorage('nmr-general-settings');
|
|
75
74
|
const formRef = useRef();
|
|
76
75
|
const updateValues = useCallback(() => {
|
|
77
76
|
if (nucleus) {
|
|
@@ -86,31 +85,19 @@ function RangesPreferencesInner({ nucleus, preferences, innerRef, }) {
|
|
|
86
85
|
useEffect(() => {
|
|
87
86
|
updateValues();
|
|
88
87
|
}, [updateValues]);
|
|
89
|
-
const
|
|
90
|
-
setSettingsData(values, 'formatting.panels.ranges');
|
|
91
|
-
};
|
|
92
|
-
const saveHandler = useCallback((values, showMessage = false) => {
|
|
88
|
+
const saveHandler = useCallback((values) => {
|
|
93
89
|
preferences.dispatch({
|
|
94
90
|
type: SET_PANELS_PREFERENCES,
|
|
95
91
|
payload: { key: 'ranges', value: values },
|
|
96
92
|
});
|
|
97
|
-
|
|
98
|
-
alert.success('ranges preferences saved successfully');
|
|
99
|
-
}
|
|
93
|
+
alert.success('ranges preferences saved successfully');
|
|
100
94
|
}, [alert, preferences]);
|
|
101
95
|
useImperativeHandle(innerRef, () => ({
|
|
102
96
|
saveSetting: () => {
|
|
103
97
|
formRef.current.submitForm();
|
|
104
98
|
},
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
},
|
|
108
|
-
}), [updateValues]);
|
|
109
|
-
const handleSubmit = (values) => {
|
|
110
|
-
saveHandler(values, true);
|
|
111
|
-
saveToLocalStorgate(values);
|
|
112
|
-
};
|
|
113
|
-
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}` }, field.id))), _jsx(Label, { title: "J Graph tolerance (Hz) :", style: { label: styles.inputLabel, wrapper: styles.inputWrapper }, children: _jsx(FormikInput, { name: `${nucleusLabel}.jGraphTolerance`, type: "number" }, void 0) }, void 0)] }, nucleusLabel))) }, void 0) }, void 0));
|
|
99
|
+
}), []);
|
|
100
|
+
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}` }, field.id))), _jsx(Label, { title: "J Graph tolerance (Hz) :", style: { label: styles.inputLabel, wrapper: styles.inputWrapper }, children: _jsx(FormikInput, { name: `${nucleusLabel}.jGraphTolerance`, type: "number" }, void 0) }, void 0)] }, nucleusLabel))) }, void 0) }, void 0));
|
|
114
101
|
}
|
|
115
102
|
const MemoizedRangesPreferences = memo(RangesPreferencesInner);
|
|
116
103
|
// TODO: remove this hacky use of ref.
|
|
@@ -7,10 +7,11 @@ import { useDispatch } from '../../context/DispatchContext';
|
|
|
7
7
|
import Button from '../../elements/ButtonToolTip';
|
|
8
8
|
import { useAlert } from '../../elements/popup/Alert';
|
|
9
9
|
import { useModal } from '../../elements/popup/Modal';
|
|
10
|
+
import { useCheckToolsVisibility } from '../../hooks/useCheckToolsVisibility';
|
|
10
11
|
import { DISPLAYER_MODE } from '../../reducer/core/Constants';
|
|
11
12
|
import { ADD_MISSING_PROJECTION, CHANGE_VISIBILITY, DELETE_SPECTRA, RESET_SPECTRA_SCALE, SET_SPECTRA_SAME_TOP, AUTO_RANGES_SPECTRA_PICKING, AUTO_ZONES_SPECTRA_PICKING, } from '../../reducer/types/Types';
|
|
12
13
|
import DefaultPanelHeader from '../header/DefaultPanelHeader';
|
|
13
|
-
function SpectraPanelHeaderInner({ data, activeSpectrum, activeTab, displayerMode, spectrums, }) {
|
|
14
|
+
function SpectraPanelHeaderInner({ data, activeSpectrum, activeTab, displayerMode, spectrums, isAutomaticPickingVisible, }) {
|
|
14
15
|
const modal = useModal();
|
|
15
16
|
const alert = useAlert();
|
|
16
17
|
const dispatch = useDispatch();
|
|
@@ -72,10 +73,19 @@ function SpectraPanelHeaderInner({ data, activeSpectrum, activeTab, displayerMod
|
|
|
72
73
|
hideLoading();
|
|
73
74
|
}, 0);
|
|
74
75
|
}, [dispatch, alert]);
|
|
75
|
-
return (_jsxs(DefaultPanelHeader, { onDelete: handleDelete, counter: spectrums?.length, deleteToolTip: "Delete all spectra", children: [_jsx(Button, { popupTitle: "Hide all spectra", onClick: hideAllSpectrumsHandler, children: _jsx(FaEyeSlash, {}, void 0) }, void 0), _jsx(Button, { popupTitle: "Show all spectra", onClick: showAllSpectrumsHandler, children: _jsx(FaEye, {}, void 0) }, void 0), activeSpectrum && activeTab && activeTab.split(',').length > 1 && (_jsx(Button, { popupTitle: "Add missing projection", onClick: addMissingProjectionHandler, children: _jsx(FaCreativeCommonsSamplingPlus, {}, void 0) }, void 0)), displayerMode === DISPLAYER_MODE.DM_1D && spectrums.length > 1 && (_jsxs(_Fragment, { children: [_jsx(Button, { popupTitle: "Reset Scale", onClick: resetScaleHandler, children: _jsx(SvgNmrResetScale, {}, void 0) }, void 0), _jsx(Button, { popupTitle: "Same Top", onClick: setSameTopHandler, children: _jsx(SvgNmrSameTop, {}, void 0) }, void 0)] }, void 0)), data && data.length > 0 && (_jsx(Button, { popupTitle: "Automatic Ranges/Zones picking for all spectra", onClick: automaticPickingHandler, children: _jsx(SvgNmrRangePicking, {}, void 0) }, void 0))] }, void 0));
|
|
76
|
+
return (_jsxs(DefaultPanelHeader, { onDelete: handleDelete, counter: spectrums?.length, deleteToolTip: "Delete all spectra", children: [_jsx(Button, { popupTitle: "Hide all spectra", onClick: hideAllSpectrumsHandler, children: _jsx(FaEyeSlash, {}, void 0) }, void 0), _jsx(Button, { popupTitle: "Show all spectra", onClick: showAllSpectrumsHandler, children: _jsx(FaEye, {}, void 0) }, void 0), activeSpectrum && activeTab && activeTab.split(',').length > 1 && (_jsx(Button, { popupTitle: "Add missing projection", onClick: addMissingProjectionHandler, children: _jsx(FaCreativeCommonsSamplingPlus, {}, void 0) }, void 0)), displayerMode === DISPLAYER_MODE.DM_1D && spectrums.length > 1 && (_jsxs(_Fragment, { children: [_jsx(Button, { popupTitle: "Reset Scale", onClick: resetScaleHandler, children: _jsx(SvgNmrResetScale, {}, void 0) }, void 0), _jsx(Button, { popupTitle: "Same Top", onClick: setSameTopHandler, children: _jsx(SvgNmrSameTop, {}, void 0) }, void 0)] }, void 0)), data && data.length > 0 && isAutomaticPickingVisible && (_jsx(Button, { popupTitle: "Automatic Ranges/Zones picking for all spectra", onClick: automaticPickingHandler, children: _jsx(SvgNmrRangePicking, {}, void 0) }, void 0))] }, void 0));
|
|
76
77
|
}
|
|
77
78
|
const MemoizedSpectraPanelHeader = memo(SpectraPanelHeaderInner);
|
|
78
79
|
export default function SpectrumsTabs({ spectrums }) {
|
|
79
80
|
const { data, activeSpectrum, activeTab, displayerMode } = useChartData();
|
|
80
|
-
|
|
81
|
+
const isToolVisible = useCheckToolsVisibility();
|
|
82
|
+
const isAutomaticPickingVisible = isToolVisible('hideAutoRangesTool');
|
|
83
|
+
return (_jsx(MemoizedSpectraPanelHeader, { ...{
|
|
84
|
+
data,
|
|
85
|
+
activeSpectrum,
|
|
86
|
+
activeTab,
|
|
87
|
+
displayerMode,
|
|
88
|
+
spectrums,
|
|
89
|
+
isAutomaticPickingVisible,
|
|
90
|
+
} }, void 0));
|
|
81
91
|
}
|
|
@@ -7,7 +7,8 @@ import generateID from '../../../../data/utilities/generateID';
|
|
|
7
7
|
import ContextMenu from '../../../elements/ContextMenu';
|
|
8
8
|
import { positions, useModal } from '../../../elements/popup/Modal';
|
|
9
9
|
import { useHighlight } from '../../../highlight';
|
|
10
|
-
import
|
|
10
|
+
import IsInView from '../utilities/IsInView';
|
|
11
|
+
import { cloneCorrelationAndEditLink, getAbbreviation, } from '../utilities/Utilities';
|
|
11
12
|
import EditLinkModal from './editLink/EditLinkModal';
|
|
12
13
|
function AdditionalColumnField({ rowCorrelation, columnCorrelation, commonLinks, correlations, spectraData, onEdit, }) {
|
|
13
14
|
const contextRef = useRef();
|
|
@@ -135,6 +136,8 @@ function AdditionalColumnField({ rowCorrelation, columnCorrelation, commonLinks,
|
|
|
135
136
|
return arr;
|
|
136
137
|
}, [])
|
|
137
138
|
.join('/'), [commonLinks]);
|
|
139
|
+
const isInViewRow = IsInView({ correlation: rowCorrelation });
|
|
140
|
+
const isInViewColumn = IsInView({ correlation: columnCorrelation });
|
|
138
141
|
return (_jsxs("td", { onContextMenu: (e) => {
|
|
139
142
|
if (contextMenu.length > 0) {
|
|
140
143
|
contextMenuHandler(e);
|
|
@@ -142,7 +145,9 @@ function AdditionalColumnField({ rowCorrelation, columnCorrelation, commonLinks,
|
|
|
142
145
|
}, style: {
|
|
143
146
|
backgroundColor: highlightCommonLinks.isActive
|
|
144
147
|
? '#ff6f0057'
|
|
145
|
-
:
|
|
148
|
+
: isInViewColumn || isInViewRow
|
|
149
|
+
? '#f5f5dc'
|
|
150
|
+
: 'inherit',
|
|
146
151
|
}, title: title, onMouseEnter: mouseEnterHandler, onMouseLeave: mouseLeaveHandler, children: [contentLabel, _jsx(ContextMenu, { ref: contextRef, context: contextMenu }, void 0)] }, void 0));
|
|
147
152
|
}
|
|
148
153
|
export default AdditionalColumnField;
|
|
@@ -7,7 +7,8 @@ import { findRangeOrZoneID } from '../../../../data/utilities/FindUtilities';
|
|
|
7
7
|
import ContextMenu from '../../../elements/ContextMenu';
|
|
8
8
|
import { positions, useModal } from '../../../elements/popup/Modal';
|
|
9
9
|
import { useHighlight } from '../../../highlight';
|
|
10
|
-
import
|
|
10
|
+
import IsInView from '../utilities/IsInView';
|
|
11
|
+
import { getLabelColor } from '../utilities/Utilities';
|
|
11
12
|
import EditLinkModal from './editLink/EditLinkModal';
|
|
12
13
|
function AdditionalColumnHeader({ spectraData, correlationsData, correlation, onEdit, }) {
|
|
13
14
|
const contextRef = useRef();
|
|
@@ -38,13 +39,16 @@ function AdditionalColumnHeader({ spectraData, correlationsData, correlation, on
|
|
|
38
39
|
event.currentTarget.blur();
|
|
39
40
|
highlightAdditionalColumn.hide();
|
|
40
41
|
}, [highlightAdditionalColumn]);
|
|
42
|
+
const isInView = IsInView({ correlation });
|
|
41
43
|
const tableHeaderProps = useMemo(() => {
|
|
42
44
|
return {
|
|
43
45
|
style: {
|
|
44
46
|
...{ color: getLabelColor(correlationsData, correlation) || undefined },
|
|
45
47
|
backgroundColor: highlightAdditionalColumn.isActive
|
|
46
48
|
? '#ff6f0057'
|
|
47
|
-
:
|
|
49
|
+
: isInView
|
|
50
|
+
? '#f5f5dc'
|
|
51
|
+
: 'inherit',
|
|
48
52
|
},
|
|
49
53
|
title: correlation.pseudo === false &&
|
|
50
54
|
correlation.link
|
|
@@ -64,6 +68,7 @@ function AdditionalColumnHeader({ spectraData, correlationsData, correlation, on
|
|
|
64
68
|
correlation,
|
|
65
69
|
correlationsData,
|
|
66
70
|
highlightAdditionalColumn.isActive,
|
|
71
|
+
isInView,
|
|
67
72
|
mouseEnterHandler,
|
|
68
73
|
mouseLeaveHandler,
|
|
69
74
|
]);
|
|
@@ -16,9 +16,4 @@ declare const DefaultTolerance: {
|
|
|
16
16
|
Si: number;
|
|
17
17
|
P: number;
|
|
18
18
|
};
|
|
19
|
-
|
|
20
|
-
key: string;
|
|
21
|
-
value: string;
|
|
22
|
-
label: string;
|
|
23
|
-
}[];
|
|
24
|
-
export { DefaultTolerance, EditLinkActions, Errors, ErrorColors, Hybridizations, };
|
|
19
|
+
export { DefaultTolerance, Errors, ErrorColors, Hybridizations };
|