nmrium 0.24.0 → 0.26.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/IntegralResizable.js +13 -13
- package/lib/component/1d/multiAnalysis/AnalysisRange.js +30 -31
- package/lib/component/1d/multiplicityTree/MultiplicityTree.js +5 -5
- package/lib/component/1d/ranges/Range.js +24 -33
- package/lib/component/2d/zones/Signal.js +8 -8
- package/lib/component/2d/zones/Zone.js +3 -3
- package/lib/component/EventsTrackers/KeysListenerTracker.js +1 -1
- package/lib/component/NMRium.js +22 -29
- package/lib/component/assignment/AssignmentsContext.d.ts +35 -0
- package/lib/component/assignment/AssignmentsContext.js +83 -0
- package/lib/component/assignment/AssignmentsReducer.d.ts +32 -0
- package/lib/component/assignment/AssignmentsReducer.js +39 -0
- package/lib/component/assignment/actions/initAssignment.d.ts +5 -0
- package/lib/component/assignment/actions/initAssignment.js +62 -0
- package/lib/component/assignment/actions/removeAssignment.d.ts +16 -0
- package/lib/component/assignment/actions/removeAssignment.js +24 -0
- package/lib/component/assignment/actions/setActiveAssignment.d.ts +10 -0
- package/lib/component/assignment/actions/setActiveAssignment.js +8 -0
- package/lib/component/assignment/actions/toggleAssignment.d.ts +7 -0
- package/lib/component/assignment/actions/toggleAssignment.js +44 -0
- package/lib/component/assignment/index.d.ts +0 -18
- package/lib/component/assignment/index.js +12 -266
- package/lib/component/assignment/utilities/filterForIDsWithAssignment.d.ts +2 -0
- package/lib/component/assignment/utilities/filterForIDsWithAssignment.js +3 -0
- package/lib/component/context/GlobalContext.d.ts +12 -3
- package/lib/component/context/GlobalContext.js +1 -1
- package/lib/component/elements/ActionButtons.d.ts +10 -0
- package/lib/component/elements/ActionButtons.js +14 -0
- package/lib/component/elements/Button.d.ts +30 -5
- package/lib/component/elements/Button.js +151 -4
- package/lib/component/elements/ContextMenu.js +6 -6
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.d.ts +5 -1
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +38 -10
- package/lib/component/elements/ReactTable/ReactTable.d.ts +3 -1
- package/lib/component/elements/ReactTable/ReactTable.js +7 -2
- package/lib/component/elements/ReactTable/Style.d.ts +1 -3
- package/lib/component/elements/ReactTable/Style.js +1 -7
- package/lib/component/elements/ToolTip/ToolTip.js +3 -2
- package/lib/component/elements/resizer/DivResizer.d.ts +2 -0
- package/lib/component/elements/resizer/DivResizer.js +107 -0
- package/lib/component/elements/resizer/Resizer.d.ts +18 -0
- package/lib/component/elements/resizer/Resizer.js +12 -0
- package/lib/component/elements/resizer/SVGResizer.d.ts +2 -0
- package/lib/component/elements/resizer/SVGResizer.js +71 -0
- package/lib/component/elements/resizer/useDraggable.d.ts +19 -0
- package/lib/component/elements/resizer/useDraggable.js +52 -0
- package/lib/component/header/AutoPeakPickingOptionPanel.js +4 -15
- package/lib/component/header/BaseLineCorrectionPanel.js +2 -9
- package/lib/component/header/ManualPhaseCorrectionPanel.js +2 -9
- package/lib/component/header/RangesPickingOptionPanel.js +3 -16
- package/lib/component/header/ZeroFillingOptionsPanel.js +2 -9
- package/lib/component/header/Zones2DOptionPanel.js +3 -14
- package/lib/component/hooks/useExport.js +11 -9
- package/lib/component/loader/DropZone.js +1 -0
- package/lib/component/modal/AlignSpectraModal.js +2 -1
- package/lib/component/modal/ExportAsMatrixModal.js +2 -1
- package/lib/component/modal/ImportPublicationStringModal.js +2 -1
- package/lib/component/modal/LoadJCAMPModal.js +7 -6
- package/lib/component/modal/ModalStyle.js +4 -26
- package/lib/component/modal/MoleculeStructureEditorModal.js +2 -1
- package/lib/component/modal/MultipleSpectraFiltersModal/index.js +2 -1
- package/lib/component/modal/PredictSpectraModal.js +2 -7
- package/lib/component/modal/SaveAsModal.d.ts +1 -1
- package/lib/component/modal/SaveAsModal.js +2 -1
- package/lib/component/modal/setting/FormattingTabContent.js +17 -11
- package/lib/component/modal/setting/GeneralSettings.js +3 -1
- package/lib/component/modal/setting/settingsValidation.d.ts +8 -0
- package/lib/component/modal/setting/settingsValidation.js +40 -0
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +6 -4
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.d.ts +4 -3
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +13 -6
- package/lib/component/panels/AutomaticAssignment/useAutoAssignments.d.ts +10 -0
- package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +60 -0
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +11 -5
- package/lib/component/panels/MoleculesPanel/Utilities.d.ts +20 -11
- package/lib/component/panels/MoleculesPanel/Utilities.js +50 -68
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts +2 -2
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +55 -60
- package/lib/component/panels/RangesPanel/RangesHeader.js +2 -2
- package/lib/component/panels/RangesPanel/RangesPanel.js +1 -1
- package/lib/component/panels/RangesPanel/RangesTableRow.js +12 -11
- package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.d.ts +16 -9
- package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +2 -2
- package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.d.ts +2 -3
- package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.js +1 -1
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +5 -18
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +1 -1
- package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +1 -1
- package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.d.ts +5 -7
- package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.js +2 -2
- package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.d.ts +4 -8
- package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.js +1 -1
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.d.ts +5 -9
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.js +4 -4
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumns.d.ts +4 -8
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +1 -1
- package/lib/component/panels/ZonesPanel/ZonesTableRow.d.ts +2 -1
- package/lib/component/panels/ZonesPanel/ZonesTableRow.js +20 -20
- package/lib/component/panels/header/SpectraAutomaticPickingButton.d.ts +2 -0
- package/lib/component/panels/header/SpectraAutomaticPickingButton.js +30 -0
- package/lib/component/panels/predictionPanel/PredictionOptions.js +2 -18
- package/lib/component/reducer/Reducer.d.ts +2 -0
- package/lib/component/reducer/Reducer.js +4 -1
- package/lib/component/reducer/actions/AssignmentsActions.d.ts +9 -0
- package/lib/component/reducer/actions/AssignmentsActions.js +18 -0
- package/lib/component/reducer/actions/LoadActions.d.ts +1 -1
- package/lib/component/reducer/actions/LoadActions.js +10 -5
- package/lib/component/reducer/preferencesReducer.d.ts +1 -8
- package/lib/component/reducer/preferencesReducer.js +16 -16
- package/lib/component/reducer/types/Types.d.ts +1 -0
- package/lib/component/reducer/types/Types.js +1 -0
- package/lib/component/utility/Export.d.ts +3 -3
- package/lib/component/utility/Export.js +10 -9
- package/lib/component/utility/FormatNumber.js +1 -1
- package/lib/component/workspaces/Workspace.d.ts +2 -4
- package/lib/component/workspaces/basic.js +8 -9
- package/lib/data/SpectraManager.js +23 -15
- package/lib/data/data1d/Data1DManager.d.ts +1 -1
- package/lib/data/data1d/Data1DManager.js +2 -1
- package/lib/data/data1d/Spectrum1D/toJSON.d.ts +2 -0
- package/lib/data/data1d/Spectrum1D/toJSON.js +1 -0
- package/lib/data/data1d/database.d.ts +1 -2
- package/lib/data/data1d/database.js +1 -1
- package/lib/data/data1d/filter1d/exclusionZones.d.ts +1 -4
- package/lib/data/data2d/Data2DManager.d.ts +1 -1
- package/lib/data/data2d/Data2DManager.js +2 -1
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +1 -1
- package/lib/data/data2d/Spectrum2D/toJSON.d.ts +2 -0
- package/lib/data/data2d/Spectrum2D/toJSON.js +1 -0
- package/lib/data/types/common/Source.d.ts +1 -0
- package/lib/data/types/data2d/Signal2DAxisData.d.ts +1 -1
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/IntegralResizable.js +12 -12
- package/lib-cjs/component/1d/multiAnalysis/AnalysisRange.js +29 -30
- package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +6 -6
- package/lib-cjs/component/1d/ranges/Range.js +26 -35
- package/lib-cjs/component/2d/zones/Signal.js +9 -9
- package/lib-cjs/component/2d/zones/Zone.js +4 -4
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +2 -2
- package/lib-cjs/component/NMRium.js +22 -29
- package/lib-cjs/component/assignment/AssignmentsContext.js +88 -0
- package/lib-cjs/component/assignment/AssignmentsReducer.js +45 -0
- package/lib-cjs/component/assignment/actions/initAssignment.js +65 -0
- package/lib-cjs/component/assignment/actions/removeAssignment.js +29 -0
- package/lib-cjs/component/assignment/actions/setActiveAssignment.js +11 -0
- package/lib-cjs/component/assignment/actions/toggleAssignment.js +47 -0
- package/lib-cjs/component/assignment/index.js +15 -269
- package/lib-cjs/component/assignment/utilities/filterForIDsWithAssignment.js +7 -0
- package/lib-cjs/component/context/GlobalContext.js +1 -1
- package/lib-cjs/component/elements/ActionButtons.js +20 -0
- package/lib-cjs/component/elements/Button.js +150 -4
- package/lib-cjs/component/elements/ContextMenu.js +6 -6
- package/lib-cjs/component/elements/ReactTable/Elements/ReactTableRow.js +42 -14
- package/lib-cjs/component/elements/ReactTable/ReactTable.js +7 -2
- package/lib-cjs/component/elements/ReactTable/Style.js +1 -9
- package/lib-cjs/component/elements/ToolTip/ToolTip.js +3 -2
- package/lib-cjs/component/elements/resizer/DivResizer.js +113 -0
- package/lib-cjs/component/elements/resizer/Resizer.js +18 -0
- package/lib-cjs/component/elements/resizer/SVGResizer.js +77 -0
- package/lib-cjs/component/elements/resizer/useDraggable.js +55 -0
- package/lib-cjs/component/header/AutoPeakPickingOptionPanel.js +3 -14
- package/lib-cjs/component/header/BaseLineCorrectionPanel.js +2 -9
- package/lib-cjs/component/header/ManualPhaseCorrectionPanel.js +2 -9
- package/lib-cjs/component/header/RangesPickingOptionPanel.js +2 -15
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +2 -9
- package/lib-cjs/component/header/Zones2DOptionPanel.js +2 -13
- package/lib-cjs/component/hooks/useExport.js +11 -9
- package/lib-cjs/component/loader/DropZone.js +1 -0
- package/lib-cjs/component/modal/AlignSpectraModal.js +2 -1
- package/lib-cjs/component/modal/ExportAsMatrixModal.js +2 -1
- package/lib-cjs/component/modal/ImportPublicationStringModal.js +2 -1
- package/lib-cjs/component/modal/LoadJCAMPModal.js +7 -6
- package/lib-cjs/component/modal/ModalStyle.js +4 -26
- package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +5 -1
- package/lib-cjs/component/modal/MultipleSpectraFiltersModal/index.js +2 -1
- package/lib-cjs/component/modal/PredictSpectraModal.js +2 -7
- package/lib-cjs/component/modal/SaveAsModal.js +2 -1
- package/lib-cjs/component/modal/setting/FormattingTabContent.js +17 -11
- package/lib-cjs/component/modal/setting/GeneralSettings.js +3 -1
- package/lib-cjs/component/modal/setting/settingsValidation.js +66 -0
- package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignment.js +6 -4
- package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +13 -6
- package/lib-cjs/component/panels/AutomaticAssignment/useAutoAssignments.js +67 -0
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +12 -6
- package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +50 -68
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +55 -60
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +3 -3
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +2 -2
- package/lib-cjs/component/panels/RangesPanel/RangesTableRow.js +15 -14
- package/lib-cjs/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +2 -2
- package/lib-cjs/component/panels/RangesPanel/hooks/useEditRangeModal.js +2 -2
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -16
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +2 -2
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +2 -2
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.js +2 -2
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.js +1 -1
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.js +4 -4
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +2 -2
- package/lib-cjs/component/panels/ZonesPanel/ZonesTableRow.js +21 -21
- package/lib-cjs/component/panels/header/SpectraAutomaticPickingButton.js +37 -0
- package/lib-cjs/component/panels/predictionPanel/PredictionOptions.js +2 -18
- package/lib-cjs/component/reducer/Reducer.js +4 -1
- package/lib-cjs/component/reducer/actions/AssignmentsActions.js +21 -0
- package/lib-cjs/component/reducer/actions/LoadActions.js +9 -4
- package/lib-cjs/component/reducer/preferencesReducer.js +16 -16
- package/lib-cjs/component/reducer/types/Types.js +2 -1
- package/lib-cjs/component/utility/Export.js +10 -9
- package/lib-cjs/component/utility/FormatNumber.js +1 -1
- package/lib-cjs/component/workspaces/basic.js +8 -9
- package/lib-cjs/data/SpectraManager.js +23 -15
- package/lib-cjs/data/data1d/Data1DManager.js +2 -1
- package/lib-cjs/data/data1d/Spectrum1D/toJSON.js +1 -0
- package/lib-cjs/data/data2d/Data2DManager.js +2 -1
- package/lib-cjs/data/data2d/Spectrum2D/initiateDatum2D.js +1 -1
- package/lib-cjs/data/data2d/Spectrum2D/toJSON.js +1 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +25 -26
- package/lib/component/1d/Resizable.d.ts +0 -12
- package/lib/component/1d/Resizable.js +0 -105
- package/lib-cjs/component/1d/Resizable.js +0 -110
|
@@ -8,7 +8,7 @@ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
|
8
8
|
const get_1 = __importDefault(require("lodash/get"));
|
|
9
9
|
const react_1 = require("react");
|
|
10
10
|
const Concatenation_1 = require("../../../data/utilities/Concatenation");
|
|
11
|
-
const
|
|
11
|
+
const AssignmentsContext_1 = require("../../assignment/AssignmentsContext");
|
|
12
12
|
const highlight_1 = require("../../highlight");
|
|
13
13
|
const ActionsColumn_1 = __importDefault(require("./TableColumns/ActionsColumn"));
|
|
14
14
|
const SignalAssignmentsColumns_1 = __importDefault(require("./TableColumns/SignalAssignmentsColumns"));
|
|
@@ -17,13 +17,13 @@ const ZoneAssignmentsColumns_1 = __importDefault(require("./TableColumns/ZoneAss
|
|
|
17
17
|
const HighlightedRowStyle = { backgroundColor: '#ff6f0057' };
|
|
18
18
|
const ConstantlyHighlightedRowStyle = { backgroundColor: '#f5f5dc' };
|
|
19
19
|
function ZonesTableRow({ rowData, onUnlink, onContextMenu, rowIndex, }) {
|
|
20
|
-
const assignmentZone = (0,
|
|
20
|
+
const assignmentZone = (0, AssignmentsContext_1.useAssignment)(rowData.id);
|
|
21
21
|
const highlightZone = (0, highlight_1.useHighlight)([assignmentZone.id]);
|
|
22
|
-
const highlightZoneX = (0, highlight_1.useHighlight)([(0, Concatenation_1.buildID)(assignmentZone.id, 'X')].concat(assignmentZone.assigned
|
|
23
|
-
const highlightZoneY = (0, highlight_1.useHighlight)([(0, Concatenation_1.buildID)(assignmentZone.id, 'Y')].concat(assignmentZone.assigned
|
|
24
|
-
const assignmentSignal = (0,
|
|
25
|
-
const highlightSignalX = (0, highlight_1.useHighlight)([(0, Concatenation_1.buildID)(assignmentSignal.id, 'X')].concat(assignmentSignal.assigned
|
|
26
|
-
const highlightSignalY = (0, highlight_1.useHighlight)([(0, Concatenation_1.buildID)(assignmentSignal.id, 'Y')].concat(assignmentSignal.assigned
|
|
22
|
+
const highlightZoneX = (0, highlight_1.useHighlight)([(0, Concatenation_1.buildID)(assignmentZone.id, 'X')].concat(assignmentZone.assigned?.x || []));
|
|
23
|
+
const highlightZoneY = (0, highlight_1.useHighlight)([(0, Concatenation_1.buildID)(assignmentZone.id, 'Y')].concat(assignmentZone.assigned?.y || []));
|
|
24
|
+
const assignmentSignal = (0, AssignmentsContext_1.useAssignment)(rowData.tableMetaInfo.id);
|
|
25
|
+
const highlightSignalX = (0, highlight_1.useHighlight)([(0, Concatenation_1.buildID)(assignmentSignal.id, 'X')].concat(assignmentSignal.assigned?.x || [], (0, Concatenation_1.buildID)(assignmentSignal.id, 'Crosshair')));
|
|
26
|
+
const highlightSignalY = (0, highlight_1.useHighlight)([(0, Concatenation_1.buildID)(assignmentSignal.id, 'Y')].concat(assignmentSignal.assigned?.y || [], (0, Concatenation_1.buildID)(assignmentSignal.id, 'Crosshair')));
|
|
27
27
|
const [showUnlinkButtonZoneX, setShowUnlinkButtonZoneX] = (0, react_1.useState)(false);
|
|
28
28
|
const [showUnlinkButtonZoneY, setShowUnlinkButtonZoneY] = (0, react_1.useState)(false);
|
|
29
29
|
const [showUnlinkButtonSignalX, setShowUnlinkButtonSignalX] = (0, react_1.useState)(false);
|
|
@@ -36,10 +36,10 @@ function ZonesTableRow({ rowData, onUnlink, onContextMenu, rowIndex, }) {
|
|
|
36
36
|
: null,
|
|
37
37
|
};
|
|
38
38
|
}, [rowData]);
|
|
39
|
-
const unlinkHandler = (0, react_1.useCallback)((
|
|
39
|
+
const unlinkHandler = (0, react_1.useCallback)((event, isOnZoneLevel, axis) => {
|
|
40
40
|
// event handling here in case of unlink button clicked
|
|
41
|
-
if (
|
|
42
|
-
|
|
41
|
+
if (event) {
|
|
42
|
+
event.stopPropagation();
|
|
43
43
|
}
|
|
44
44
|
onUnlink(rowData, isOnZoneLevel, rowData.tableMetaInfo.signalIndex, axis);
|
|
45
45
|
if (axis === 'x') {
|
|
@@ -85,18 +85,18 @@ function ZonesTableRow({ rowData, onUnlink, onContextMenu, rowIndex, }) {
|
|
|
85
85
|
assignmentSignal.removeAll('y');
|
|
86
86
|
}
|
|
87
87
|
}, [assignmentSignal, assignmentZone, onUnlink, rowData]);
|
|
88
|
-
const clickHandler = (0, react_1.useCallback)((
|
|
89
|
-
|
|
90
|
-
assignment.
|
|
88
|
+
const clickHandler = (0, react_1.useCallback)((event, assignment, axis) => {
|
|
89
|
+
event.stopPropagation();
|
|
90
|
+
assignment.setActive(axis);
|
|
91
91
|
}, []);
|
|
92
92
|
const onHoverZoneX = (0, react_1.useMemo)(() => {
|
|
93
93
|
return {
|
|
94
94
|
onMouseEnter: () => {
|
|
95
|
-
assignmentZone.
|
|
95
|
+
assignmentZone.show('x');
|
|
96
96
|
highlightZoneX.show();
|
|
97
97
|
},
|
|
98
98
|
onMouseLeave: () => {
|
|
99
|
-
assignmentZone.
|
|
99
|
+
assignmentZone.hide();
|
|
100
100
|
highlightZoneX.hide();
|
|
101
101
|
},
|
|
102
102
|
};
|
|
@@ -104,11 +104,11 @@ function ZonesTableRow({ rowData, onUnlink, onContextMenu, rowIndex, }) {
|
|
|
104
104
|
const onHoverZoneY = (0, react_1.useMemo)(() => {
|
|
105
105
|
return {
|
|
106
106
|
onMouseEnter: () => {
|
|
107
|
-
assignmentZone.
|
|
107
|
+
assignmentZone.show('y');
|
|
108
108
|
highlightZoneY.show();
|
|
109
109
|
},
|
|
110
110
|
onMouseLeave: () => {
|
|
111
|
-
assignmentZone.
|
|
111
|
+
assignmentZone.hide();
|
|
112
112
|
highlightZoneY.hide();
|
|
113
113
|
},
|
|
114
114
|
};
|
|
@@ -116,11 +116,11 @@ function ZonesTableRow({ rowData, onUnlink, onContextMenu, rowIndex, }) {
|
|
|
116
116
|
const onHoverSignalX = (0, react_1.useMemo)(() => {
|
|
117
117
|
return {
|
|
118
118
|
onMouseEnter: () => {
|
|
119
|
-
assignmentSignal.
|
|
119
|
+
assignmentSignal.show('x');
|
|
120
120
|
highlightSignalX.show();
|
|
121
121
|
},
|
|
122
122
|
onMouseLeave: () => {
|
|
123
|
-
assignmentSignal.
|
|
123
|
+
assignmentSignal.hide();
|
|
124
124
|
highlightSignalX.hide();
|
|
125
125
|
},
|
|
126
126
|
};
|
|
@@ -128,11 +128,11 @@ function ZonesTableRow({ rowData, onUnlink, onContextMenu, rowIndex, }) {
|
|
|
128
128
|
const onHoverSignalY = (0, react_1.useMemo)(() => {
|
|
129
129
|
return {
|
|
130
130
|
onMouseEnter: () => {
|
|
131
|
-
assignmentSignal.
|
|
131
|
+
assignmentSignal.show('y');
|
|
132
132
|
highlightSignalY.show();
|
|
133
133
|
},
|
|
134
134
|
onMouseLeave: () => {
|
|
135
|
-
assignmentSignal.
|
|
135
|
+
assignmentSignal.hide();
|
|
136
136
|
highlightSignalY.hide();
|
|
137
137
|
},
|
|
138
138
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SpectraAutomaticPickingButton = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const cheminfo_font_1 = require("cheminfo-font");
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const ChartContext_1 = require("../../context/ChartContext");
|
|
11
|
+
const DispatchContext_1 = require("../../context/DispatchContext");
|
|
12
|
+
const ButtonToolTip_1 = __importDefault(require("../../elements/ButtonToolTip"));
|
|
13
|
+
const Alert_1 = require("../../elements/popup/Alert");
|
|
14
|
+
const useCheckToolsVisibility_1 = require("../../hooks/useCheckToolsVisibility");
|
|
15
|
+
const Types_1 = require("../../reducer/types/Types");
|
|
16
|
+
function SpectraAutomaticPickingButton() {
|
|
17
|
+
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
18
|
+
const alert = (0, Alert_1.useAlert)();
|
|
19
|
+
const { data } = (0, ChartContext_1.useChartData)();
|
|
20
|
+
const isToolVisible = (0, useCheckToolsVisibility_1.useCheckToolsVisibility)();
|
|
21
|
+
const automaticPickingHandler = (0, react_1.useCallback)(() => {
|
|
22
|
+
void (async () => {
|
|
23
|
+
const hideLoading = await alert.showLoading('Automatic Ranges/Zones detection for all spectra in progress');
|
|
24
|
+
setTimeout(() => {
|
|
25
|
+
dispatch({ type: Types_1.AUTO_RANGES_SPECTRA_PICKING });
|
|
26
|
+
dispatch({ type: Types_1.AUTO_ZONES_SPECTRA_PICKING });
|
|
27
|
+
hideLoading();
|
|
28
|
+
}, 0);
|
|
29
|
+
})();
|
|
30
|
+
}, [dispatch, alert]);
|
|
31
|
+
if ((Array.isArray(data) && data.length === 0) ||
|
|
32
|
+
!isToolVisible('autoRangesTool')) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
return ((0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Automatic Ranges/Zones picking for all spectra", onClick: automaticPickingHandler, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrRangePicking, {}) }));
|
|
36
|
+
}
|
|
37
|
+
exports.SpectraAutomaticPickingButton = SpectraAutomaticPickingButton;
|
|
@@ -32,6 +32,7 @@ const react_1 = require("@emotion/react");
|
|
|
32
32
|
const react_2 = require("react");
|
|
33
33
|
const Yup = __importStar(require("yup"));
|
|
34
34
|
const PredictionManager_1 = require("../../../data/PredictionManager");
|
|
35
|
+
const Button_1 = __importDefault(require("../../elements/Button"));
|
|
35
36
|
const IsotopesViewer_1 = __importDefault(require("../../elements/IsotopesViewer"));
|
|
36
37
|
const Label_1 = __importDefault(require("../../elements/Label"));
|
|
37
38
|
const FormikErrorsSummary_1 = __importDefault(require("../../elements/formik/FormikErrorsSummary"));
|
|
@@ -62,23 +63,6 @@ const styles = (0, react_1.css) `
|
|
|
62
63
|
align-items: flex-end;
|
|
63
64
|
}
|
|
64
65
|
|
|
65
|
-
.btn:not([disabled]):hover {
|
|
66
|
-
background-color: #ffffff;
|
|
67
|
-
}
|
|
68
|
-
.btn:hover {
|
|
69
|
-
background-color: #f2f2f2 !important;
|
|
70
|
-
}
|
|
71
|
-
.btn:disabled {
|
|
72
|
-
opacity: 0.5;
|
|
73
|
-
}
|
|
74
|
-
.btn {
|
|
75
|
-
border: none;
|
|
76
|
-
padding: 0 15px;
|
|
77
|
-
background-color: #ffffff;
|
|
78
|
-
border-radius: 5px;
|
|
79
|
-
height: 25px;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
66
|
.input {
|
|
83
67
|
font-size: 14px;
|
|
84
68
|
border-radius: 5px;
|
|
@@ -113,6 +97,6 @@ function PredictionOptions({ onPredict = () => null }) {
|
|
|
113
97
|
onPredict(values);
|
|
114
98
|
})();
|
|
115
99
|
}, [onPredict]);
|
|
116
|
-
return ((0, jsx_runtime_1.jsxs)("div", { css: styles, children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)(FormikForm_1.default, { ref: refForm, initialValues: PredictionManager_1.defaultPredictionOptions, validationSchema: predictionFormValidation, onSubmit: submitHandler, children: [(0, jsx_runtime_1.jsx)(FormikErrorsSummary_1.default, {}), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10", children: [(0, jsx_runtime_1.jsx)("span", { className: "custom-label", children: "Frequency : " }), (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { data: PredictionManager_1.FREQUENCIES, style: { width: 290, height: 30, margin: 0 }, name: "frequency" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "row", children: [(0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "1H", className: "custom-label" }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "From", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.1H.from", type: "number" }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "To", style: { label: { padding: '0 10px' } }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.1H.to", type: "number" }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "row", children: [(0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "13C", className: "custom-label" }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "From", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.13C.from", type: "number" }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "To", style: { label: { padding: '0 10px' } }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.13C.to", type: "number" }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10 padding-h-10", children: [(0, jsx_runtime_1.jsx)("span", { className: "custom-label", children: "Line Width : " }), (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.lineWidth", type: "number", style: { input: { margin: 0 } } }), (0, jsx_runtime_1.jsx)("span", { style: { paddingLeft: '0.4rem' }, children: " Hz " })] })] }) }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(
|
|
100
|
+
return ((0, jsx_runtime_1.jsxs)("div", { css: styles, children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)(FormikForm_1.default, { ref: refForm, initialValues: PredictionManager_1.defaultPredictionOptions, validationSchema: predictionFormValidation, onSubmit: submitHandler, children: [(0, jsx_runtime_1.jsx)(FormikErrorsSummary_1.default, {}), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10", children: [(0, jsx_runtime_1.jsx)("span", { className: "custom-label", children: "Frequency : " }), (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { data: PredictionManager_1.FREQUENCIES, style: { width: 290, height: 30, margin: 0 }, name: "frequency" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "row", children: [(0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "1H", className: "custom-label" }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "From", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.1H.from", type: "number" }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "To", style: { label: { padding: '0 10px' } }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.1H.to", type: "number" }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "row", children: [(0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: "13C", className: "custom-label" }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "From", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.13C.from", type: "number" }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "To", style: { label: { padding: '0 10px' } }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.13C.to", type: "number" }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10 padding-h-10", children: [(0, jsx_runtime_1.jsx)("span", { className: "custom-label", children: "Line Width : " }), (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.lineWidth", type: "number", style: { input: { margin: 0 } } }), (0, jsx_runtime_1.jsx)("span", { style: { paddingLeft: '0.4rem' }, children: " Hz " })] })] }) }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(Button_1.default.Done, { onClick: handleSave, children: "Predict spectrum" }) })] }));
|
|
117
101
|
}
|
|
118
102
|
exports.default = PredictionOptions;
|
|
@@ -36,6 +36,7 @@ const generateID_1 = __importDefault(require("../../data/utilities/generateID"))
|
|
|
36
36
|
const Constants_1 = require("../panels/SummaryPanel/CorrelationTable/Constants");
|
|
37
37
|
const ToolTypes_1 = require("../toolbar/ToolTypes");
|
|
38
38
|
const nmredataToNmrium_1 = require("../utility/nmredataToNmrium");
|
|
39
|
+
const AssignmentsActions = __importStar(require("./actions/AssignmentsActions"));
|
|
39
40
|
const CorrelationsActions = __importStar(require("./actions/CorrelationsActions"));
|
|
40
41
|
const DatabaseActions = __importStar(require("./actions/DatabaseActions"));
|
|
41
42
|
const DimensionsActions_1 = require("./actions/DimensionsActions");
|
|
@@ -197,7 +198,7 @@ function dispatchMiddleware(dispatch) {
|
|
|
197
198
|
}
|
|
198
199
|
exports.dispatchMiddleware = dispatchMiddleware;
|
|
199
200
|
function innerSpectrumReducer(draft, action) {
|
|
200
|
-
if (![types.LOAD_JSON_FILE, types.LOAD_NMREDATA_FILE].includes(action.type)) {
|
|
201
|
+
if (![types.LOAD_JSON_FILE, types.LOAD_NMREDATA_FILE, types.INITIATE].includes(action.type)) {
|
|
201
202
|
draft.actionType = action.type;
|
|
202
203
|
}
|
|
203
204
|
switch (action.type) {
|
|
@@ -425,6 +426,8 @@ function innerSpectrumReducer(draft, action) {
|
|
|
425
426
|
return SpectraAnalysisActions.handleFilterColumn(draft, action);
|
|
426
427
|
case types.RESURRECTING_SPECTRUM_FROM_RANGES:
|
|
427
428
|
return DatabaseActions.handleRangeResurrecting(draft, action);
|
|
429
|
+
case types.SET_AUTOMATIC_ASSIGNMENTS:
|
|
430
|
+
return AssignmentsActions.setAutomaticAssignmentsHandler(draft, action);
|
|
428
431
|
case HistoryTypes_1.UNDO:
|
|
429
432
|
return (0, HistoryActions_1.handleHistoryUndo)(draft);
|
|
430
433
|
case HistoryTypes_1.REDO:
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setAutomaticAssignmentsHandler = void 0;
|
|
4
|
+
function setAutomaticAssignmentsHandler(draft, action) {
|
|
5
|
+
const assignments = action.payload.assignments;
|
|
6
|
+
for (let datum of assignments) {
|
|
7
|
+
const index = draft.data.findIndex((spectrum) => spectrum.id === datum.id);
|
|
8
|
+
if (index !== -1) {
|
|
9
|
+
const dimension = draft.data[index].info.dimension;
|
|
10
|
+
if (dimension === 1) {
|
|
11
|
+
draft.data[index].ranges.values = datum
|
|
12
|
+
.ranges;
|
|
13
|
+
}
|
|
14
|
+
else if (dimension === 2) {
|
|
15
|
+
draft.data[index].zones.values = datum
|
|
16
|
+
.zones;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.setAutomaticAssignmentsHandler = setAutomaticAssignmentsHandler;
|
|
@@ -96,11 +96,16 @@ function setPreferences(draft, data) {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
function initiate(draft, action) {
|
|
99
|
-
|
|
99
|
+
const state = (0, Reducer_1.getInitialState)();
|
|
100
|
+
setData(state, action.payload);
|
|
100
101
|
const preferences = action.payload?.preferences || {};
|
|
101
|
-
(0, ToolsActions_1.setActiveTab)(
|
|
102
|
-
setPreferences(
|
|
103
|
-
|
|
102
|
+
(0, ToolsActions_1.setActiveTab)(state, { tab: preferences?.activeTab || '' });
|
|
103
|
+
setPreferences(state, action.payload);
|
|
104
|
+
state.width = draft.width;
|
|
105
|
+
state.height = draft.height;
|
|
106
|
+
state.isLoading = false;
|
|
107
|
+
state.actionType = Types_1.INITIATE;
|
|
108
|
+
return state;
|
|
104
109
|
}
|
|
105
110
|
exports.initiate = initiate;
|
|
106
111
|
function loadJDFFile(draft, actions) {
|
|
@@ -9,7 +9,7 @@ const merge_1 = __importDefault(require("lodash/merge"));
|
|
|
9
9
|
const generateID_1 = __importDefault(require("../../data/utilities/generateID"));
|
|
10
10
|
const LocalStorage_1 = require("../utility/LocalStorage");
|
|
11
11
|
const workspaces_1 = __importDefault(require("../workspaces"));
|
|
12
|
-
const LOCAL_STORAGE_VERSION =
|
|
12
|
+
const LOCAL_STORAGE_VERSION = 6;
|
|
13
13
|
exports.WORKSPACES = [
|
|
14
14
|
{
|
|
15
15
|
key: 'default',
|
|
@@ -83,16 +83,13 @@ function checkKeysExists(sourceObject, targetObject) {
|
|
|
83
83
|
}
|
|
84
84
|
return true;
|
|
85
85
|
}
|
|
86
|
-
function
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
return { ...acc };
|
|
94
|
-
}, {});
|
|
95
|
-
}
|
|
86
|
+
function mapNucleiFormatting(formatting) {
|
|
87
|
+
const { nuclei, ...res } = formatting;
|
|
88
|
+
const _nuclei = Object.keys(nuclei).reduce((nucleusFormatting, key) => {
|
|
89
|
+
nucleusFormatting[nuclei[key].name.trim().toLowerCase()] = nuclei[key];
|
|
90
|
+
return nucleusFormatting;
|
|
91
|
+
}, {});
|
|
92
|
+
return { nuclei: _nuclei, ...res };
|
|
96
93
|
}
|
|
97
94
|
function initPreferencesState(state) {
|
|
98
95
|
const nmrLocalStorageVersion = (0, LocalStorage_1.getLocalStorage)('nmr-local-storage-version', false);
|
|
@@ -140,19 +137,22 @@ function handleInit(draft, action) {
|
|
|
140
137
|
currentWorkspacePreferences?.version ||
|
|
141
138
|
!checkKeysExists(workspacePreferences.display, currentWorkspacePreferences?.display))) ||
|
|
142
139
|
!localData) {
|
|
143
|
-
const { workspaces, version } = draft || {};
|
|
140
|
+
const { workspaces, version, workspace: { current }, } = draft || {};
|
|
144
141
|
const display = filterObject(workspacePreferences.display);
|
|
145
142
|
const data = {
|
|
146
143
|
version,
|
|
144
|
+
...(localData?.currentWorkspace && {
|
|
145
|
+
currentWorkspace: localData?.currentWorkspace,
|
|
146
|
+
}),
|
|
147
147
|
workspaces: {
|
|
148
148
|
...workspaces,
|
|
149
|
-
[
|
|
149
|
+
[current]: {
|
|
150
150
|
...workspacePreferences,
|
|
151
151
|
display,
|
|
152
152
|
},
|
|
153
153
|
},
|
|
154
154
|
};
|
|
155
|
-
draft.workspaces[
|
|
155
|
+
draft.workspaces[current] = (0, merge_1.default)({}, currentWorkspacePreferences, workspacePreferences);
|
|
156
156
|
(0, LocalStorage_1.storeData)('nmr-general-settings', JSON.stringify(data));
|
|
157
157
|
}
|
|
158
158
|
else {
|
|
@@ -164,7 +164,8 @@ function handleInit(draft, action) {
|
|
|
164
164
|
function handleSetPreferences(draft, action) {
|
|
165
165
|
if (action.payload) {
|
|
166
166
|
const currentWorkspacePreferences = getActiveWorkspace(draft);
|
|
167
|
-
|
|
167
|
+
let { controllers, formatting, display } = action.payload;
|
|
168
|
+
formatting = mapNucleiFormatting(formatting);
|
|
168
169
|
let localData = (0, LocalStorage_1.getLocalStorage)('nmr-general-settings');
|
|
169
170
|
localData.currentWorkspace = draft.workspace.current;
|
|
170
171
|
localData.workspaces = {
|
|
@@ -187,7 +188,6 @@ function handleSetPreferences(draft, action) {
|
|
|
187
188
|
experimentalFeatures: display.general.experimentalFeatures,
|
|
188
189
|
},
|
|
189
190
|
};
|
|
190
|
-
mapNucleus(draft);
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
function handleSetPanelsPreferences(draft, action) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.APPLY_MANUAL_PHASE_CORRECTION_FILTER = exports.CALCULATE_MANUAL_PHASE_CORRECTION_FILTER = exports.APPLY_FFT_FILTER = exports.APPLY_ZERO_FILLING_FILTER = exports.DELETE_SPECTRA_FILTER = exports.DELETE_FILTER = exports.ENABLE_FILTER = exports.RESET_DOMAIN = exports.BRUSH_END = exports.RESIZE_INTEGRAL = exports.CHANGE_SPECTRUM_DISPLAY_VIEW_MODE = exports.DELETE_SPECTRA = exports.SET_CORRELATIONS_TOLERANCE = exports.SET_CORRELATIONS_MF = exports.DELETE_CORRELATION = exports.SET_CORRELATIONS = exports.SET_CORRELATION = exports.DELETE_MOLECULE = exports.SET_MOLECULE = exports.ADD_MOLECULE = exports.SET_ZOOM = exports.TOGGLE_REAL_IMAGINARY_VISIBILITY = exports.DELETE_INTEGRAL = exports.ADD_INTEGRAL = exports.CHANGE_SPECTRUM_COLOR = exports.CHANGE_ACTIVE_SPECTRUM = exports.CHANGE_PEAKS_MARKERS_VISIBILITY = exports.CHANGE_VISIBILITY = exports.FULL_ZOOM_OUT = exports.CHANGE_SPECTRUM_TYPE = exports.CHANGE_SPECTRUM_SETTING = exports.SET_SELECTED_FILTER = exports.SET_SELECTED_TOOL = exports.SET_DIMENSIONS = exports.SET_WIDTH = exports.SET_ORIGINAL_DOMAIN = exports.SET_Y_DOMAIN = exports.SET_X_DOMAIN = exports.SHIFT_SPECTRUM = exports.DELETE_PEAK_NOTATION = exports.ADD_PEAKS = exports.ADD_PEAK = exports.LOAD_JDF_FILE = exports.LOAD_ZIP_FILE = exports.LOAD_MOL_FILE = exports.LOAD_NMREDATA_FILE = exports.LOAD_JCAMP_FILE = exports.LOAD_JSON_FILE = exports.SAVE_DATA_AS_JSON = exports.INITIATE = void 0;
|
|
4
4
|
exports.PREDICT_SPECTRA = exports.SET_DIAID_ZONE = exports.UNLINK_ZONE = exports.SAVE_EDITED_ZONE = exports.CHANGE_ZONE_SIGNAL_KIND = exports.CHANGE_ZONE_SIGNAL_VALUE = exports.ALIGN_SPECTRA = exports.FILTER_SPECTRA_COLUMN = exports.SET_ANALYZE_SPECTRA_COLUMNS = exports.RESIZE_ANALYZE_SPECTRA_RANGE = exports.DELETE_ANALYZE_SPECTRA_RANGE = exports.ANALYZE_SPECTRA = exports.CHANGE_INTEGRAL_RELATIVE = exports.SET_DIAID_RANGE = exports.UNLINK_RANGE = exports.SAVE_EDITED_RANGE = exports.CHANGE_RANGE_SIGNAL_KIND = exports.CHANGE_RANGE_SIGNAL_VALUE = exports.CHANGE_RANGE_RELATIVE = exports.SET_FILTER_SNAPSHOT = exports.ADD_MISSING_PROJECTION = exports.SET_2D_SIGNAL_PATH_LENGTH = exports.DELETE_2D_SIGNAL = exports.DELETE_2D_ZONE = exports.ADD_2D_ZONE = exports.SET_2D_LEVEL = exports.ADD_RANGE = exports.CHANGE_RANGE_SUM = exports.RESIZE_RANGE = exports.APPLY_KEY_PREFERENCES = exports.SET_KEY_PREFERENCES = exports.APPLY_BASE_LINE_CORRECTION_FILTER = exports.DELETE_BASE_LINE_ZONE = exports.ADD_BASE_LINE_ZONE = exports.CHANGE_INTEGRAL_SUM = exports.SET_ACTIVE_TAB = exports.CHANGE_INTEGRAL_DATA = exports.SAVE_AS_SVG = exports.SET_SPECTRUMS_VERTICAL_ALIGN = exports.RESET_SELECTED_TOOL = exports.SET_LOADING_FLAG = exports.SET_SELECTED_OPTIONS_PANEL = exports.DELETE_1D_SIGNAL = exports.DELETE_RANGE = exports.AUTO_ZONES_DETECTION = exports.AUTO_RANGES_DETECTION = exports.AUTO_PEAK_PICKING = exports.SET_VERTICAL_INDICATOR_X_POSITION = exports.APPLY_ABSOLUTE_FILTER = exports.APPLY_AUTO_PHASE_CORRECTION_FILTER = void 0;
|
|
5
|
-
exports.SHOW_J_GRAPH = exports.RESURRECTING_SPECTRUM_FROM_RANGES = exports.GENERATE_SPECTRUM_FROM_PUBLICATION_STRING = exports.AUTO_ZONES_SPECTRA_PICKING = exports.AUTO_RANGES_SPECTRA_PICKING = exports.SHOW_RANGES_INTEGRALS = exports.SHOW_MULTIPLICTY_TREES = exports.CHANGE_TEMP_RANGE = exports.CHANGE_ZONES_NOISE_FACTOR = exports.CHANGE_INTEGRALS_SUM_FLAG = exports.CHANGE_RANGES_SUM_FLAG = exports.DELETE_EXCLUSION_ZONE = exports.ADD_EXCLUSION_ZONE = exports.APPLY_MULTIPLE_SPECTRA_FILTER = exports.SET_MOUSE_OVER_DISPLAYER = exports.RESET_SPECTRA_SCALE = exports.SET_SPECTRA_SAME_TOP = void 0;
|
|
5
|
+
exports.SET_AUTOMATIC_ASSIGNMENTS = exports.SHOW_J_GRAPH = exports.RESURRECTING_SPECTRUM_FROM_RANGES = exports.GENERATE_SPECTRUM_FROM_PUBLICATION_STRING = exports.AUTO_ZONES_SPECTRA_PICKING = exports.AUTO_RANGES_SPECTRA_PICKING = exports.SHOW_RANGES_INTEGRALS = exports.SHOW_MULTIPLICTY_TREES = exports.CHANGE_TEMP_RANGE = exports.CHANGE_ZONES_NOISE_FACTOR = exports.CHANGE_INTEGRALS_SUM_FLAG = exports.CHANGE_RANGES_SUM_FLAG = exports.DELETE_EXCLUSION_ZONE = exports.ADD_EXCLUSION_ZONE = exports.APPLY_MULTIPLE_SPECTRA_FILTER = exports.SET_MOUSE_OVER_DISPLAYER = exports.RESET_SPECTRA_SCALE = exports.SET_SPECTRA_SAME_TOP = void 0;
|
|
6
6
|
exports.INITIATE = 'INITIATE';
|
|
7
7
|
exports.SAVE_DATA_AS_JSON = 'SAVE_DATA_AS_JSON';
|
|
8
8
|
exports.LOAD_JSON_FILE = 'LOAD_JSON_FILE';
|
|
@@ -120,3 +120,4 @@ exports.AUTO_ZONES_SPECTRA_PICKING = 'AUTO_ZONES_SPECTRA_PICKING';
|
|
|
120
120
|
exports.GENERATE_SPECTRUM_FROM_PUBLICATION_STRING = 'GENERATE_SPECTRUM_FROM_PUBLICATION_STRING';
|
|
121
121
|
exports.RESURRECTING_SPECTRUM_FROM_RANGES = 'RESURRECTING_SPECTRUM_FROM_RANGES';
|
|
122
122
|
exports.SHOW_J_GRAPH = 'SHOW_J_GRAPH';
|
|
123
|
+
exports.SET_AUTOMATIC_ASSIGNMENTS = 'SET_AUTOMATIC_ASSIGNMENTS';
|
|
@@ -121,13 +121,13 @@ exports.exportAsMol = exportAsMol;
|
|
|
121
121
|
/**
|
|
122
122
|
* export the vitalization result as SVG, if you need to remove some content during exportation process enclose the the content with <!-- export-remove --> ${content} <!-- export-remove -->
|
|
123
123
|
*/
|
|
124
|
-
function exportAsSVG(elementID, fileName = 'experiment') {
|
|
125
|
-
const { blob } = getBlob(elementID);
|
|
124
|
+
function exportAsSVG(rootRef, elementID, fileName = 'experiment') {
|
|
125
|
+
const { blob } = getBlob(rootRef, elementID);
|
|
126
126
|
(0, file_saver_1.saveAs)(blob, `${fileName}.svg`);
|
|
127
127
|
}
|
|
128
128
|
exports.exportAsSVG = exportAsSVG;
|
|
129
|
-
function exportAsPng(elementID, fileName = 'experiment') {
|
|
130
|
-
const { blob, width, height } = getBlob(elementID);
|
|
129
|
+
function exportAsPng(rootRef, elementID, fileName = 'experiment') {
|
|
130
|
+
const { blob, width, height } = getBlob(rootRef, elementID);
|
|
131
131
|
try {
|
|
132
132
|
let canvas = document.createElement('canvas');
|
|
133
133
|
canvas.width = width;
|
|
@@ -180,8 +180,8 @@ function copyBlobToCliboard(canvas) {
|
|
|
180
180
|
});
|
|
181
181
|
});
|
|
182
182
|
}
|
|
183
|
-
function copyPNGToClipboard(elementID) {
|
|
184
|
-
const { blob, width, height } = getBlob(elementID);
|
|
183
|
+
function copyPNGToClipboard(rootRef, elementID) {
|
|
184
|
+
const { blob, width, height } = getBlob(rootRef, elementID);
|
|
185
185
|
try {
|
|
186
186
|
let canvas = document.createElement('canvas');
|
|
187
187
|
canvas.width = width;
|
|
@@ -217,9 +217,10 @@ function copyPNGToClipboard(elementID) {
|
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
exports.copyPNGToClipboard = copyPNGToClipboard;
|
|
220
|
-
function getBlob(elementID) {
|
|
221
|
-
|
|
222
|
-
|
|
220
|
+
function getBlob(rootRef, elementID) {
|
|
221
|
+
let _svg = rootRef.getRootNode()
|
|
222
|
+
.getElementById(elementID)
|
|
223
|
+
?.cloneNode(true);
|
|
223
224
|
const width = _svg?.getAttribute('width').replace('px', '');
|
|
224
225
|
const height = _svg?.getAttribute('height').replace('px', '');
|
|
225
226
|
_svg
|
|
@@ -13,7 +13,7 @@ function FormatNumber(value, format, prefix = '', suffix = '') {
|
|
|
13
13
|
}
|
|
14
14
|
function useFormatNumberByNucleus(nucleus) {
|
|
15
15
|
const preferences = (0, PreferencesContext_1.usePreferences)();
|
|
16
|
-
const nucleusByKey = (0, get_1.default)(preferences.current, `formatting.
|
|
16
|
+
const nucleusByKey = (0, get_1.default)(preferences.current, `formatting.nuclei`, {
|
|
17
17
|
ppm: '0.0',
|
|
18
18
|
hz: '0.0',
|
|
19
19
|
});
|
|
@@ -30,15 +30,14 @@ exports.basic = {
|
|
|
30
30
|
dimmedSpectraTransparency: 0.1,
|
|
31
31
|
},
|
|
32
32
|
formatting: {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
nucleusByKey: {},
|
|
33
|
+
nuclei: {
|
|
34
|
+
'1h': { name: '1H', ppm: '0.00', hz: '0.00' },
|
|
35
|
+
'13c': { name: '13C', ppm: '0.00', hz: '0.00' },
|
|
36
|
+
'15n': { name: '15N', ppm: '0.00', hz: '0.00' },
|
|
37
|
+
'19f': { name: '19F', ppm: '0.00', hz: '0.00' },
|
|
38
|
+
'29si': { name: '29Si', ppm: '0.00', hz: '0.00' },
|
|
39
|
+
'31p': { name: '31P', ppm: '0.00', hz: '0.00' },
|
|
40
|
+
},
|
|
42
41
|
panels: {},
|
|
43
42
|
},
|
|
44
43
|
};
|
|
@@ -56,23 +56,27 @@ function addJcamp(spectra, jcamp, options, usedColors) {
|
|
|
56
56
|
if (entries.length === 0)
|
|
57
57
|
return;
|
|
58
58
|
// Should be improved when we have a more complex case
|
|
59
|
-
for (let
|
|
60
|
-
let
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
addJcampSS(spectra, entry, options, usedColors);
|
|
59
|
+
for (let index = 0; index < entries.length; index++) {
|
|
60
|
+
let entry = entries[index];
|
|
61
|
+
const components = entry.dependentVariables?.[0]?.components;
|
|
62
|
+
if (components && (components.length > 0 || components.z)) {
|
|
63
|
+
addJcampSS(spectra, { index, entry }, options, usedColors);
|
|
65
64
|
}
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
67
|
exports.addJcamp = addJcamp;
|
|
69
|
-
function addJcampSS(spectra,
|
|
70
|
-
const
|
|
71
|
-
if (
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
68
|
+
function addJcampSS(spectra, jcampDatum, options, usedColors) {
|
|
69
|
+
const source = options?.source || {};
|
|
70
|
+
if (!('jcampSpectrumIndex' in source) ||
|
|
71
|
+
source.jcampSpectrumIndex === jcampDatum.index) {
|
|
72
|
+
const dimension = jcampDatum.entry.info.dimension;
|
|
73
|
+
if (dimension === 1) {
|
|
74
|
+
spectra.push(Data1DManager.fromParsedJcamp(jcampDatum.entry, options, usedColors, jcampDatum.index));
|
|
75
|
+
}
|
|
76
|
+
if (dimension === 2) {
|
|
77
|
+
// console.log(options, jcampDatum.entry);
|
|
78
|
+
spectra.push(Data2DManager.fromParsedJcamp(jcampDatum.entry, options, usedColors, jcampDatum.index));
|
|
79
|
+
}
|
|
76
80
|
}
|
|
77
81
|
}
|
|
78
82
|
function addData(spectra, datum, usedColors) {
|
|
@@ -123,8 +127,12 @@ async function fromJSON(data = [], usedColors = {}) {
|
|
|
123
127
|
const spectra = [];
|
|
124
128
|
let promises = [];
|
|
125
129
|
for (let datum of data) {
|
|
126
|
-
|
|
127
|
-
|
|
130
|
+
const { jcamp, jcampURL } = datum?.source || {};
|
|
131
|
+
if (jcamp != null) {
|
|
132
|
+
addJcamp(spectra, jcamp, datum, usedColors);
|
|
133
|
+
}
|
|
134
|
+
else if (jcampURL != null) {
|
|
135
|
+
promises.push(addJcampFromURL(spectra, jcampURL, datum, usedColors));
|
|
128
136
|
}
|
|
129
137
|
else {
|
|
130
138
|
addData(spectra, datum, usedColors);
|
|
@@ -64,13 +64,14 @@ function fromCSD(result, options = {}, usedColors = {}) {
|
|
|
64
64
|
return datum1D;
|
|
65
65
|
}
|
|
66
66
|
exports.fromCSD = fromCSD;
|
|
67
|
-
function fromParsedJcamp(parsedJcamp, options, usedColors) {
|
|
67
|
+
function fromParsedJcamp(parsedJcamp, options, usedColors, jcampSpectrumIndex) {
|
|
68
68
|
const { dependentVariables, info, meta } = parsedJcamp;
|
|
69
69
|
let data = getData(dependentVariables[0].components);
|
|
70
70
|
if (Array.isArray(info.nucleus))
|
|
71
71
|
info.nucleus = info.nucleus[0];
|
|
72
72
|
const datum1D = (0, Spectrum1D_1.initiateDatum1D)({
|
|
73
73
|
...options,
|
|
74
|
+
source: { ...options.source, jcampSpectrumIndex },
|
|
74
75
|
info,
|
|
75
76
|
meta,
|
|
76
77
|
data,
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fromCSD = exports.fromBruker = exports.fromParsedJcamp = void 0;
|
|
4
4
|
const Spectrum2D_1 = require("./Spectrum2D");
|
|
5
|
-
function fromParsedJcamp(parsedJcamp, options, usedColors) {
|
|
5
|
+
function fromParsedJcamp(parsedJcamp, options, usedColors, jcampSpectrumIndex) {
|
|
6
6
|
const { dependentVariables, info, meta } = parsedJcamp;
|
|
7
7
|
let data = dependentVariables[0].components;
|
|
8
8
|
const ob = (0, Spectrum2D_1.initiateDatum2D)({
|
|
9
9
|
...options,
|
|
10
|
+
source: { ...options?.source, jcampSpectrumIndex },
|
|
10
11
|
info,
|
|
11
12
|
meta,
|
|
12
13
|
data,
|
|
@@ -73,7 +73,7 @@ function initiateDatum2D(options, usedColors = {}) {
|
|
|
73
73
|
exports.initiateDatum2D = initiateDatum2D;
|
|
74
74
|
function getColor(options, usedColors) {
|
|
75
75
|
let color = { positiveColor: 'red', negativeColor: 'blue' };
|
|
76
|
-
if (options?.display
|
|
76
|
+
if (options?.display?.negativeColor === undefined ||
|
|
77
77
|
options?.display?.positiveColor === undefined) {
|
|
78
78
|
color = (0, getColor_1.get2DColor)(options.info.experiment, usedColors['2d'] || []);
|
|
79
79
|
}
|
package/lib-cjs/versionInfo.js
CHANGED