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
|
@@ -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 };
|
|
@@ -36,10 +36,4 @@ const DefaultTolerance = {
|
|
|
36
36
|
Si: 0.25,
|
|
37
37
|
P: 0.25,
|
|
38
38
|
};
|
|
39
|
-
|
|
40
|
-
{ key: '-', value: '-', label: 'Select Action' },
|
|
41
|
-
{ key: 'delete', value: 'delete', label: 'Delete' },
|
|
42
|
-
{ key: 'move', value: 'move', label: 'Move' },
|
|
43
|
-
{ key: 'unmove', value: 'unmove', label: 'Unmove' },
|
|
44
|
-
];
|
|
45
|
-
export { DefaultTolerance, EditLinkActions, Errors, ErrorColors, Hybridizations, };
|
|
39
|
+
export { DefaultTolerance, Errors, ErrorColors, Hybridizations };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
declare function CorrelationTable({ correlationsData, filteredCorrelationsData, additionalColumnData, editEquivalencesSaveHandler,
|
|
1
|
+
declare function CorrelationTable({ correlationsData, filteredCorrelationsData, additionalColumnData, editEquivalencesSaveHandler, onSaveEditNumericValues, onEditCorrelationTableCellHandler, showProtonsAsRows, spectraData, }: {
|
|
2
2
|
correlationsData: any;
|
|
3
3
|
filteredCorrelationsData: any;
|
|
4
4
|
additionalColumnData: any;
|
|
5
5
|
editEquivalencesSaveHandler: any;
|
|
6
|
-
|
|
7
|
-
editProtonsCountSaveHandler: any;
|
|
6
|
+
onSaveEditNumericValues: any;
|
|
8
7
|
onEditCorrelationTableCellHandler: any;
|
|
9
8
|
showProtonsAsRows: any;
|
|
10
9
|
spectraData: any;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
|
-
import { getLabelColor } from '../Utilities';
|
|
5
|
+
import { getLabelColor } from '../utilities/Utilities';
|
|
6
6
|
import AdditionalColumnHeader from './AdditionalColumnHeader';
|
|
7
7
|
import CorrelationTableRow from './CorrelationTableRow';
|
|
8
8
|
const tableStyle = css `
|
|
@@ -50,7 +50,7 @@ const tableStyle = css `
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
`;
|
|
53
|
-
function CorrelationTable({ correlationsData, filteredCorrelationsData, additionalColumnData, editEquivalencesSaveHandler,
|
|
53
|
+
function CorrelationTable({ correlationsData, filteredCorrelationsData, additionalColumnData, editEquivalencesSaveHandler, onSaveEditNumericValues, onEditCorrelationTableCellHandler, showProtonsAsRows, spectraData, }) {
|
|
54
54
|
const rows = useMemo(() => {
|
|
55
55
|
if (!filteredCorrelationsData) {
|
|
56
56
|
return [];
|
|
@@ -63,15 +63,14 @@ function CorrelationTable({ correlationsData, filteredCorrelationsData, addition
|
|
|
63
63
|
? {
|
|
64
64
|
color: getLabelColor(correlationsData, correlation),
|
|
65
65
|
}
|
|
66
|
-
: {}, onSaveEditEquivalences: editEquivalencesSaveHandler,
|
|
66
|
+
: {}, onSaveEditEquivalences: editEquivalencesSaveHandler, onSaveEditNumericValues: onSaveEditNumericValues, onEditCorrelationTableCellHandler: onEditCorrelationTableCellHandler, spectraData: spectraData }, `correlation${correlation.atomType}${correlation.id}`)));
|
|
67
67
|
}, [
|
|
68
68
|
filteredCorrelationsData,
|
|
69
69
|
showProtonsAsRows,
|
|
70
70
|
additionalColumnData,
|
|
71
71
|
correlationsData,
|
|
72
72
|
editEquivalencesSaveHandler,
|
|
73
|
-
|
|
74
|
-
editProtonsCountSaveHandler,
|
|
73
|
+
onSaveEditNumericValues,
|
|
75
74
|
onEditCorrelationTableCellHandler,
|
|
76
75
|
spectraData,
|
|
77
76
|
]);
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare function CorrelationTableRow({ additionalColumnData, correlations, correlation, styleRow, styleLabel, onSaveEditEquivalences,
|
|
2
|
+
declare function CorrelationTableRow({ additionalColumnData, correlations, correlation, styleRow, styleLabel, onSaveEditEquivalences, onSaveEditNumericValues, onEditCorrelationTableCellHandler, spectraData, }: {
|
|
3
3
|
additionalColumnData: any;
|
|
4
4
|
correlations: any;
|
|
5
5
|
correlation: any;
|
|
6
6
|
styleRow: any;
|
|
7
7
|
styleLabel: any;
|
|
8
8
|
onSaveEditEquivalences: any;
|
|
9
|
-
|
|
10
|
-
onSaveEditProtonsCount: any;
|
|
9
|
+
onSaveEditNumericValues: any;
|
|
11
10
|
onEditCorrelationTableCellHandler: any;
|
|
12
11
|
spectraData: any;
|
|
13
12
|
}): JSX.Element;
|
|
@@ -5,19 +5,13 @@ import { buildID } from '../../../../data/utilities/Concatenation';
|
|
|
5
5
|
import { findRangeOrZoneID } from '../../../../data/utilities/FindUtilities';
|
|
6
6
|
import ContextMenu from '../../../elements/ContextMenu';
|
|
7
7
|
import EditableColumn from '../../../elements/EditableColumn';
|
|
8
|
-
import Select from '../../../elements/Select';
|
|
9
8
|
import { positions, useModal } from '../../../elements/popup/Modal';
|
|
10
9
|
import { useHighlight } from '../../../highlight';
|
|
10
|
+
import IsInView from '../utilities/IsInView';
|
|
11
|
+
import { convertValuesString } from '../utilities/Utilities';
|
|
11
12
|
import AdditionalColumnField from './AdditionalColumnField';
|
|
12
|
-
import { Hybridizations } from './Constants';
|
|
13
13
|
import EditLinkModal from './editLink/EditLinkModal';
|
|
14
|
-
|
|
15
|
-
marginLeft: 2,
|
|
16
|
-
marginRight: 2,
|
|
17
|
-
border: 'none',
|
|
18
|
-
height: '20px',
|
|
19
|
-
};
|
|
20
|
-
function CorrelationTableRow({ additionalColumnData, correlations, correlation, styleRow, styleLabel, onSaveEditEquivalences, onChangeHybridization, onSaveEditProtonsCount, onEditCorrelationTableCellHandler, spectraData, }) {
|
|
14
|
+
function CorrelationTableRow({ additionalColumnData, correlations, correlation, styleRow, styleLabel, onSaveEditEquivalences, onSaveEditNumericValues, onEditCorrelationTableCellHandler, spectraData, }) {
|
|
21
15
|
const contextRef = useRef();
|
|
22
16
|
const modal = useModal();
|
|
23
17
|
const highlightIDsRow = useMemo(() => {
|
|
@@ -41,9 +35,13 @@ function CorrelationTableRow({ additionalColumnData, correlations, correlation,
|
|
|
41
35
|
const onSaveEquivalencesHandler = useCallback((e) => {
|
|
42
36
|
onSaveEditEquivalences(correlation, e.target.value);
|
|
43
37
|
}, [correlation, onSaveEditEquivalences]);
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
const onSaveEditNumericValuesHandler = useCallback((e, key) => {
|
|
39
|
+
onSaveEditNumericValues({
|
|
40
|
+
correlation,
|
|
41
|
+
values: convertValuesString(e.target.value, key),
|
|
42
|
+
key,
|
|
43
|
+
});
|
|
44
|
+
}, [correlation, onSaveEditNumericValues]);
|
|
47
45
|
const additionalColumnFields = useMemo(() => {
|
|
48
46
|
return additionalColumnData.map((_correlation) => {
|
|
49
47
|
const commonLinks = [];
|
|
@@ -75,9 +73,6 @@ function CorrelationTableRow({ additionalColumnData, correlations, correlation,
|
|
|
75
73
|
onEditCorrelationTableCellHandler,
|
|
76
74
|
spectraData,
|
|
77
75
|
]);
|
|
78
|
-
const onChangeHybridizationHandler = useCallback((value) => {
|
|
79
|
-
onChangeHybridization(correlation, value);
|
|
80
|
-
}, [correlation, onChangeHybridization]);
|
|
81
76
|
const equivalenceCellStyle = useMemo(() => {
|
|
82
77
|
return correlation.edited.equivalence
|
|
83
78
|
? { color: 'blue' }
|
|
@@ -93,11 +88,16 @@ function CorrelationTableRow({ additionalColumnData, correlations, correlation,
|
|
|
93
88
|
event.currentTarget.blur();
|
|
94
89
|
highlightRow.hide();
|
|
95
90
|
}, [highlightRow]);
|
|
91
|
+
const isInView = IsInView({ correlation });
|
|
96
92
|
const tableDataProps = useMemo(() => {
|
|
97
93
|
return {
|
|
98
94
|
style: {
|
|
99
95
|
...styleRow,
|
|
100
|
-
backgroundColor: highlightRow.isActive
|
|
96
|
+
backgroundColor: highlightRow.isActive
|
|
97
|
+
? '#ff6f0057'
|
|
98
|
+
: isInView
|
|
99
|
+
? '#f5f5dc'
|
|
100
|
+
: 'inherit',
|
|
101
101
|
},
|
|
102
102
|
title: correlation.pseudo === false &&
|
|
103
103
|
correlation.link
|
|
@@ -117,6 +117,7 @@ function CorrelationTableRow({ additionalColumnData, correlations, correlation,
|
|
|
117
117
|
correlation.link,
|
|
118
118
|
correlation.pseudo,
|
|
119
119
|
highlightRow.isActive,
|
|
120
|
+
isInView,
|
|
120
121
|
mouseEnterHandler,
|
|
121
122
|
mouseLeaveHandler,
|
|
122
123
|
styleRow,
|
|
@@ -180,16 +181,11 @@ function CorrelationTableRow({ additionalColumnData, correlations, correlation,
|
|
|
180
181
|
}
|
|
181
182
|
}, children: [getLabel(correlations, correlation), _jsx(ContextMenu, { ref: contextRef, context: contextMenu }, void 0)] }, void 0), _jsx("td", { title: t, ...otherTableDataProps, children: getCorrelationDelta(correlation)
|
|
182
183
|
? getCorrelationDelta(correlation)?.toFixed(2)
|
|
183
|
-
: '' }, void 0), _jsx("td", { title: t, ...otherTableDataProps, children: correlation.pseudo === false ? (correlation.atomType !== 'H' ? (_jsx(EditableColumn, { type: "number", value: correlation.equivalence, style: equivalenceCellStyle, onSave: onSaveEquivalencesHandler }, void 0)) : (_jsx("text", { style: equivalenceCellStyle, children: correlation.equivalence }, void 0))) : ('') }, void 0), _jsx("td", { title: t, ...otherTableDataProps, children: correlation.atomType !== 'H' ? (_jsx(EditableColumn, { type: "text", value: correlation.protonsCount.join(','), style: correlation.edited.protonsCount ? { color: 'blue' } : {}, onSave:
|
|
184
|
+
: '' }, void 0), _jsx("td", { title: t, ...otherTableDataProps, children: correlation.pseudo === false ? (correlation.atomType !== 'H' ? (_jsx(EditableColumn, { type: "number", value: correlation.equivalence, style: equivalenceCellStyle, onSave: onSaveEquivalencesHandler }, void 0)) : (_jsx("text", { style: equivalenceCellStyle, children: correlation.equivalence }, void 0))) : ('') }, void 0), _jsx("td", { title: t, ...otherTableDataProps, children: correlation.atomType !== 'H' ? (_jsx(EditableColumn, { type: "text", value: correlation.protonsCount.join(','), style: correlation.edited.protonsCount ? { color: 'blue' } : {}, onSave: (e) => onSaveEditNumericValuesHandler(e, 'protonsCount') }, void 0)) : ('') }, void 0), _jsx("td", { title: t, ...{
|
|
184
185
|
...otherTableDataProps,
|
|
185
186
|
style: { ...tableDataProps.style, borderRight: '1px solid' },
|
|
186
|
-
}, children: correlation.atomType !== 'H' ? (_jsx(
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
backgroundColor: correlation.edited.hybridization
|
|
190
|
-
? 'inherit'
|
|
191
|
-
: styleRow.backgroundColor,
|
|
192
|
-
width: '50px',
|
|
193
|
-
} }, void 0)) : ('') }, void 0), additionalColumnFields] }, void 0));
|
|
187
|
+
}, children: correlation.atomType !== 'H' ? (_jsx(EditableColumn, { type: "text", value: correlation.hybridization
|
|
188
|
+
.map((hybrid) => `sp${hybrid}`)
|
|
189
|
+
.join(','), style: correlation.edited.hybridization ? { color: 'blue' } : {}, onSave: (e) => onSaveEditNumericValuesHandler(e, 'hybridization') }, void 0)) : ('') }, void 0), additionalColumnFields] }, void 0));
|
|
194
190
|
}
|
|
195
191
|
export default CorrelationTableRow;
|
|
@@ -4,20 +4,21 @@ import { css } from '@emotion/react';
|
|
|
4
4
|
import { getLinkDim } from 'nmr-correlation';
|
|
5
5
|
import { useCallback, useMemo, useState } from 'react';
|
|
6
6
|
import CloseButton from '../../../../elements/CloseButton';
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import Tab from '../../../../elements/Tab/Tab';
|
|
8
|
+
import Tabs, { PositionsEnum } from '../../../../elements/Tab/Tabs';
|
|
9
|
+
import { getEditedCorrelations } from '../../utilities/Utilities';
|
|
10
10
|
import EditLinkConfirmation from './Confirmation';
|
|
11
|
+
import EditPathLength from './EditPathLength';
|
|
11
12
|
import MoveLink from './MoveLink';
|
|
12
13
|
const modalContainer = css `
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
height: 230px;
|
|
14
|
+
width: 490px;
|
|
15
|
+
height: 220px;
|
|
16
16
|
padding: 5px;
|
|
17
17
|
|
|
18
18
|
button:focus {
|
|
19
19
|
outline: none;
|
|
20
20
|
}
|
|
21
|
+
|
|
21
22
|
.header {
|
|
22
23
|
height: 24px;
|
|
23
24
|
border-bottom: 1px solid #f0f0f0;
|
|
@@ -61,14 +62,15 @@ const modalContainer = css `
|
|
|
61
62
|
background-color: gray;
|
|
62
63
|
}
|
|
63
64
|
|
|
64
|
-
.
|
|
65
|
-
margin-top: 10px;
|
|
65
|
+
.tabs-container {
|
|
66
66
|
width: 100%;
|
|
67
|
-
|
|
67
|
+
flex: 1;
|
|
68
|
+
overflow: auto;
|
|
69
|
+
border: none;
|
|
68
70
|
}
|
|
69
71
|
`;
|
|
70
72
|
export default function EditLinkModal({ correlationDim1, correlationDim2, link, correlations, onClose, onEdit, }) {
|
|
71
|
-
const [
|
|
73
|
+
const [activeTab, setActiveTab] = useState('move');
|
|
72
74
|
const getLinkLabel = useCallback(() => {
|
|
73
75
|
const linkDim = getLinkDim(link);
|
|
74
76
|
if (linkDim === 1) {
|
|
@@ -79,37 +81,29 @@ export default function EditLinkModal({ correlationDim1, correlationDim2, link,
|
|
|
79
81
|
}
|
|
80
82
|
return '';
|
|
81
83
|
}, [correlationDim1.label.origin, link, correlationDim2]);
|
|
82
|
-
const handleOnEdit = useCallback((action,
|
|
84
|
+
const handleOnEdit = useCallback((action, selectedCorrelationIdDim1, selectedCorrelationIdDim2, editedLink) => {
|
|
83
85
|
const { editedCorrelations, buildCorrelationDataOptions } = getEditedCorrelations({
|
|
84
86
|
correlationDim1,
|
|
85
87
|
correlationDim2,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
+
selectedCorrelationIdDim1,
|
|
89
|
+
selectedCorrelationIdDim2,
|
|
88
90
|
action,
|
|
89
|
-
link,
|
|
91
|
+
link: editedLink || link,
|
|
90
92
|
correlations,
|
|
91
93
|
});
|
|
92
|
-
onEdit(editedCorrelations, action, link, buildCorrelationDataOptions);
|
|
94
|
+
onEdit(editedCorrelations, action, editedLink || link, buildCorrelationDataOptions);
|
|
93
95
|
onClose?.();
|
|
94
96
|
}, [correlationDim1, correlationDim2, correlations, link, onClose, onEdit]);
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return (_jsx(MoveLink, { correlationDim1: correlationDim1, correlationDim2: correlationDim2, link: link, correlations: correlations, onEdit: handleOnEdit }, void 0));
|
|
101
|
-
case 'unmove':
|
|
102
|
-
return (_jsx(EditLinkConfirmation, { description: "Movement of signal to its original place.", onConfirm: () => handleOnEdit('unmove', correlationDim1.id, correlationDim2.id) }, void 0));
|
|
103
|
-
default:
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
}, [
|
|
97
|
+
const tabsContainer = useMemo(() => (_jsx("div", { className: "tabs-container", children: _jsxs(Tabs, { position: PositionsEnum.TOP, activeTab: activeTab, onClick: (tab) => setActiveTab(tab.tabid), children: [_jsx(Tab, { tablabel: "Move", tabid: 'move', children: _jsx(MoveLink, { correlationDim1: correlationDim1, correlationDim2: correlationDim2, link: link, correlations: correlations, onEdit: (correlationIdDim1, correlationIdDim2) => handleOnEdit('move', correlationIdDim1, correlationIdDim2) }, void 0) }, void 0), _jsx(Tab, { tablabel: "Unmove", tabid: "unmove", children: _jsx(EditLinkConfirmation, { description: "Movement of signal to its original place.", onConfirm: () => handleOnEdit('unmove', correlationDim1.id, correlationDim2.id) }, void 0) }, void 0), _jsx(Tab, { tablabel: "Remove", tabid: 'remove', children: _jsx(EditLinkConfirmation, { description: "Deletion of signal.", onConfirm: () => handleOnEdit('remove', undefined, undefined) }, void 0) }, void 0), _jsx(Tab, { tablabel: "J Coupling", tabid: 'setPathLength', children: _jsx(EditPathLength, { signal: link.signal, experimentType: link.experimentType, onEdit: (editedSignal) => {
|
|
98
|
+
const editedLink = { ...link, signal: editedSignal };
|
|
99
|
+
handleOnEdit('setPathLength', correlationDim1, correlationDim2, editedLink);
|
|
100
|
+
} }, void 0) }, void 0)] }, void 0) }, void 0)), [
|
|
101
|
+
activeTab,
|
|
107
102
|
correlationDim1,
|
|
108
103
|
correlationDim2,
|
|
109
104
|
correlations,
|
|
110
|
-
link,
|
|
111
105
|
handleOnEdit,
|
|
112
|
-
|
|
106
|
+
link,
|
|
113
107
|
]);
|
|
114
|
-
return (_jsxs("div", { css: modalContainer, children: [_jsxs("div", { className: "header handle", children: [_jsx(CloseButton, { onClick: onClose }, void 0), _jsx("p", { className: "header-info", children: `${link.experimentType.toUpperCase()} signal at ${getLinkLabel()}` }, void 0)] }, void 0),
|
|
108
|
+
return (_jsxs("div", { css: modalContainer, children: [_jsxs("div", { className: "header handle", children: [_jsx(CloseButton, { onClick: onClose }, void 0), _jsx("p", { className: "header-info", children: `${link.experimentType.toUpperCase()} signal at ${getLinkLabel()}` }, void 0)] }, void 0), tabsContainer] }, void 0));
|
|
115
109
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Signal2D } from '../../../../../data/types/data2d';
|
|
2
|
+
interface InputProps {
|
|
3
|
+
signal: Signal2D;
|
|
4
|
+
experimentType: string;
|
|
5
|
+
onEdit: (editedSignal: Signal2D) => void;
|
|
6
|
+
}
|
|
7
|
+
declare function EditPathLength({ signal, experimentType, onEdit }: InputProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default EditPathLength;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/** @jsxImportSource @emotion/react */
|
|
3
|
+
import { css } from '@emotion/react';
|
|
4
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
5
|
+
import DefaultPathLengths from '../../../../../data/constants/DefaultPathLengths';
|
|
6
|
+
import Button from '../../../../elements/Button';
|
|
7
|
+
import Input from '../../../../elements/Input';
|
|
8
|
+
import Label from '../../../../elements/Label';
|
|
9
|
+
const editPathLengthsStyles = css `
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: 100%;
|
|
12
|
+
margin-top: 10px;
|
|
13
|
+
text-align: center;
|
|
14
|
+
|
|
15
|
+
.input-container {
|
|
16
|
+
width: 100%;
|
|
17
|
+
margin-top: 5px;
|
|
18
|
+
text-align: center;
|
|
19
|
+
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
align-items: center;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
button {
|
|
27
|
+
flex: 2;
|
|
28
|
+
padding: 5px;
|
|
29
|
+
border: 1px solid gray;
|
|
30
|
+
border-radius: 5px;
|
|
31
|
+
height: 30px;
|
|
32
|
+
margin: 0 auto;
|
|
33
|
+
margin-top: 15px;
|
|
34
|
+
display: block;
|
|
35
|
+
width: 60px;
|
|
36
|
+
|
|
37
|
+
color: white;
|
|
38
|
+
background-color: gray;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.warning {
|
|
42
|
+
margin-top: 5px;
|
|
43
|
+
color: red;
|
|
44
|
+
}
|
|
45
|
+
`;
|
|
46
|
+
function EditPathLength({ signal, experimentType, onEdit }) {
|
|
47
|
+
const [from, setFrom] = useState(signal.j?.pathLength !== undefined
|
|
48
|
+
? signal.j.pathLength.from
|
|
49
|
+
: DefaultPathLengths[experimentType]?.from || 0);
|
|
50
|
+
const [to, setTo] = useState(signal.j?.pathLength !== undefined
|
|
51
|
+
? signal.j.pathLength.to
|
|
52
|
+
: DefaultPathLengths[experimentType]?.to || 0);
|
|
53
|
+
const [isError, setIsError] = useState(false);
|
|
54
|
+
const handleOnEdit = useCallback(() => {
|
|
55
|
+
const pathLength = {
|
|
56
|
+
from,
|
|
57
|
+
to,
|
|
58
|
+
};
|
|
59
|
+
const editedSignal = {
|
|
60
|
+
...signal,
|
|
61
|
+
j: {
|
|
62
|
+
...signal.j,
|
|
63
|
+
pathLength,
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
onEdit(editedSignal);
|
|
67
|
+
}, [to, from, onEdit, signal]);
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
setIsError(from <= 0 || from > to);
|
|
70
|
+
}, [to, from]);
|
|
71
|
+
return (_jsxs("div", { css: editPathLengthsStyles, children: [_jsx("p", { children: "Setting of the minimum and maximum path length (J coupling)." }, void 0), _jsxs("div", { className: "input-container", children: [_jsx(Label, { title: "Min:", style: {
|
|
72
|
+
label: {
|
|
73
|
+
marginRight: '5px',
|
|
74
|
+
fontSize: '14px',
|
|
75
|
+
fontWeight: 'normal',
|
|
76
|
+
},
|
|
77
|
+
}, children: _jsx(Input, { type: "number", value: from, onChange: (e) => {
|
|
78
|
+
setFrom(Number(e.target.value));
|
|
79
|
+
}, style: { input: { color: isError ? 'red' : 'black' } } }, void 0) }, void 0), _jsx(Label, { title: "Max:", style: {
|
|
80
|
+
label: {
|
|
81
|
+
marginRight: '5px',
|
|
82
|
+
fontSize: '14px',
|
|
83
|
+
fontWeight: 'normal',
|
|
84
|
+
},
|
|
85
|
+
}, children: _jsx(Input, { type: "number", value: to, onChange: (e) => {
|
|
86
|
+
setTo(Number(e.target.value));
|
|
87
|
+
} }, void 0) }, void 0)] }, void 0), isError ? (_jsxs("p", { className: "warning", children: ["Minimum must not be 0 or higher than the maximum value.", ' '] }, void 0)) : (_jsx(Button, { type: "button", onClick: handleOnEdit, disabled: isError, children: "Set" }, void 0))] }, void 0));
|
|
88
|
+
}
|
|
89
|
+
export default EditPathLength;
|
|
@@ -4,7 +4,7 @@ interface MoveLinkProps {
|
|
|
4
4
|
correlationDim2: Correlation;
|
|
5
5
|
link: Link;
|
|
6
6
|
correlations: Correlation[];
|
|
7
|
-
onEdit: (
|
|
7
|
+
onEdit: (correlationIdDim1: string, correlationIdDim2: string | undefined) => void;
|
|
8
8
|
}
|
|
9
9
|
declare function MoveLink({ correlationDim1, correlationDim2, link, correlations, onEdit, }: MoveLinkProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
10
10
|
export default MoveLink;
|
|
@@ -75,6 +75,6 @@ function MoveLink({ correlationDim1, correlationDim2, link, correlations, onEdit
|
|
|
75
75
|
border: '1px solid grey',
|
|
76
76
|
} }, void 0));
|
|
77
77
|
}, [correlationDim1, correlationDim2, correlations, link.atomType]);
|
|
78
|
-
return (_jsxs("div", { css: moveLinkStyles, children: [_jsx("p", { children: "Move of signals on either one or both axes." }, void 0), _jsx("p", { children: "\"New\" means to separate into a new row or column." }, void 0), _jsxs("div", { className: "selection-container", children: [getSelection(correlationDim1, 0), correlationDim2 && getSelection(correlationDim2, 1)] }, void 0), _jsx("button", { type: "button", onClick: () => onEdit(
|
|
78
|
+
return (_jsxs("div", { css: moveLinkStyles, children: [_jsx("p", { children: "Move of signals on either one or both axes." }, void 0), _jsx("p", { children: "\"New\" means to separate into a new row or column." }, void 0), _jsxs("div", { className: "selection-container", children: [getSelection(correlationDim1, 0), correlationDim2 && getSelection(correlationDim2, 1)] }, void 0), _jsx("button", { type: "button", onClick: () => onEdit(selectedCorrelationIdDim1, selectedCorrelationIdDim2), children: "Move" }, void 0)] }, void 0));
|
|
79
79
|
}
|
|
80
80
|
export default MoveLink;
|