nmrium 0.19.1 → 0.21.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/Chart1D.js +3 -3
- package/lib/component/1d/ExclusionZoneAnnotation.d.ts +11 -0
- package/lib/component/1d/ExclusionZoneAnnotation.js +18 -0
- package/lib/component/1d/ExclusionZonesAnnotations.d.ts +3 -0
- package/lib/component/1d/ExclusionZonesAnnotations.js +28 -0
- package/lib/component/1d/Line.js +11 -23
- package/lib/component/1d/Viewer1D.js +36 -5
- package/lib/component/1d/ranges/Ranges.js +3 -3
- package/lib/component/1d/{BaseLineZones.d.ts → tool/BaseLineZones.d.ts} +0 -0
- package/lib/component/1d/{BaseLineZones.js → tool/BaseLineZones.js} +5 -5
- package/lib/component/1d/utilities/useIntegralPath.js +9 -10
- package/lib/component/2d/Contours.js +12 -11
- package/lib/component/2d/Left1DChart.js +7 -9
- package/lib/component/2d/Top1DChart.js +7 -7
- package/lib/component/2d/tools/slicing/HorizontalSliceChart.js +7 -7
- package/lib/component/2d/tools/slicing/VerticalSliceChart.js +7 -9
- package/lib/component/EventsTrackers/BrushTracker.js +2 -2
- package/lib/component/EventsTrackers/KeysListenerTracker.js +106 -80
- package/lib/component/NMRium.d.ts +8 -3
- package/lib/component/NMRium.js +36 -33
- package/lib/component/elements/NumberInput.d.ts +1 -2
- package/lib/component/elements/Tab/Tab.js +1 -0
- package/lib/component/header/Header.js +10 -3
- package/lib/component/hooks/useActiveSpectrumStyleOptions.d.ts +6 -0
- package/lib/component/hooks/useActiveSpectrumStyleOptions.js +15 -0
- 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/hooks/useToolsFunctions.js +2 -1
- package/lib/component/hooks/useXYReduce.d.ts +2 -1
- package/lib/component/loader/DropZone.js +88 -88
- package/lib/component/modal/ModalStyle.js +5 -2
- package/lib/component/modal/MoleculeStructureEditorModal.js +3 -2
- package/lib/component/modal/MultipleSpectraFiltersModal/index.js +10 -1
- package/lib/component/modal/changeSum/ChangeSumModal.js +4 -2
- package/lib/component/modal/setting/DisplayTabContent.js +1 -1
- package/lib/component/modal/setting/GeneralSettings.js +1 -5
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +0 -3
- package/lib/component/panels/IntegralsPanel/IntegralsPreferences.js +4 -17
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.d.ts +2 -0
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +35 -0
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +49 -67
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +3 -8
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +2 -23
- package/lib/component/panels/Panels.js +10 -0
- 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 +0 -3
- package/lib/component/panels/RangesPanel/RangesPreferences.js +5 -18
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +13 -3
- package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DHistogram.js +1 -1
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.d.ts +5 -5
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +1 -1
- package/lib/component/panels/SummaryPanel/Utilities.d.ts +7 -7
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +0 -3
- package/lib/component/panels/ZonesPanel/ZonesPreferences.js +5 -18
- package/lib/component/panels/ZonesPanel/ZonesTable.js +9 -2
- package/lib/component/panels/databasePanel/DatabasePanel.js +0 -3
- package/lib/component/panels/databasePanel/DatabasePreferences.js +4 -17
- package/lib/component/reducer/Reducer.d.ts +11 -27
- package/lib/component/reducer/Reducer.js +4 -5
- package/lib/component/reducer/actions/CorrelationsActions.d.ts +7 -7
- package/lib/component/reducer/actions/CorrelationsActions.js +1 -1
- package/lib/component/reducer/actions/FiltersActions.d.ts +3 -1
- package/lib/component/reducer/actions/FiltersActions.js +60 -18
- package/lib/component/reducer/actions/LoadActions.js +2 -3
- package/lib/component/reducer/actions/MoleculeActions.js +2 -2
- package/lib/component/reducer/actions/PreferencesActions.js +4 -7
- package/lib/component/reducer/actions/RangesActions.js +1 -1
- package/lib/component/reducer/actions/ToolsActions.d.ts +1 -3
- package/lib/component/reducer/actions/ToolsActions.js +13 -59
- package/lib/component/reducer/helper/ZoomHistoryManager.d.ts +1 -0
- package/lib/component/reducer/helper/ZoomHistoryManager.js +2 -1
- package/lib/component/reducer/helper/getRange.d.ts +6 -1
- package/lib/component/reducer/helper/getRange.js +1 -1
- package/lib/component/reducer/preferencesReducer.d.ts +2 -0
- package/lib/component/reducer/preferencesReducer.js +76 -36
- package/lib/component/toolbar/FunctionToolBar.js +9 -15
- package/lib/component/toolbar/ToolTypes.js +3 -3
- package/lib/component/utility/PathBuilder.d.ts +7 -0
- package/lib/component/utility/PathBuilder.js +17 -0
- package/lib/component/utility/getSpectraByNucleus.d.ts +3 -0
- package/lib/component/utility/getSpectraByNucleus.js +4 -0
- package/lib/component/workspaces/Workspace.d.ts +6 -0
- package/lib/component/workspaces/Workspace.js +1 -0
- package/lib/component/workspaces/basic.d.ts +2 -0
- package/lib/component/workspaces/basic.js +45 -0
- package/lib/component/workspaces/exercise1D.d.ts +2 -0
- package/lib/component/workspaces/exercise1D.js +45 -0
- package/lib/component/workspaces/index.d.ts +6 -0
- package/lib/component/workspaces/index.js +4 -0
- package/lib/component/workspaces/process1D.d.ts +2 -0
- package/lib/component/workspaces/process1D.js +43 -0
- package/lib/data/Filters.d.ts +2 -1
- package/lib/data/Filters.js +2 -1
- package/lib/data/data1d/Spectrum1D/ranges/addRange.js +5 -2
- package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +6 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectRange.js +0 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectSignal.d.ts +3 -2
- package/lib/data/data1d/Spectrum1D/ranges/detectSignal.js +23 -15
- package/lib/data/data1d/filter1d/exclusionZones.d.ts +16 -0
- package/lib/data/data1d/filter1d/exclusionZones.js +28 -0
- package/lib/data/migration/MigrationManager.js +3 -0
- package/lib/data/types/data1d/ExclusionZone.d.ts +5 -0
- package/lib/data/types/data1d/ExclusionZone.js +1 -0
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/Chart1D.js +3 -3
- package/lib-cjs/component/1d/ExclusionZoneAnnotation.js +23 -0
- package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +52 -0
- package/lib-cjs/component/1d/Line.js +11 -23
- package/lib-cjs/component/1d/Viewer1D.js +36 -5
- package/lib-cjs/component/1d/ranges/Ranges.js +1 -1
- package/lib-cjs/component/1d/{BaseLineZones.js → tool/BaseLineZones.js} +5 -5
- package/lib-cjs/component/1d/utilities/useIntegralPath.js +9 -10
- package/lib-cjs/component/2d/Contours.js +12 -11
- package/lib-cjs/component/2d/Left1DChart.js +7 -9
- package/lib-cjs/component/2d/Top1DChart.js +7 -7
- package/lib-cjs/component/2d/tools/slicing/HorizontalSliceChart.js +7 -7
- package/lib-cjs/component/2d/tools/slicing/VerticalSliceChart.js +7 -9
- package/lib-cjs/component/EventsTrackers/BrushTracker.js +2 -2
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +106 -80
- package/lib-cjs/component/NMRium.js +37 -34
- package/lib-cjs/component/elements/Tab/Tab.js +1 -0
- package/lib-cjs/component/header/Header.js +10 -3
- package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +21 -0
- package/lib-cjs/component/hooks/useCheckExperimentalFeature.js +5 -1
- package/lib-cjs/component/hooks/useCheckToolsVisibility.js +13 -0
- package/lib-cjs/component/hooks/useToolsFunctions.js +2 -1
- package/lib-cjs/component/loader/DropZone.js +88 -88
- package/lib-cjs/component/modal/ModalStyle.js +5 -2
- package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +3 -2
- package/lib-cjs/component/modal/MultipleSpectraFiltersModal/index.js +10 -1
- package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +4 -2
- package/lib-cjs/component/modal/setting/DisplayTabContent.js +1 -1
- package/lib-cjs/component/modal/setting/GeneralSettings.js +1 -5
- 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/MatrixGenerationPanel/MatrixGenerationPanel.js +40 -0
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +48 -66
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +3 -8
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -22
- package/lib-cjs/component/panels/Panels.js +10 -0
- 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 +0 -3
- 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/SpectrumsPanel/base/setting/Spectrum2DHistogram.js +1 -1
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +0 -3
- package/lib-cjs/component/panels/ZonesPanel/ZonesPreferences.js +4 -17
- package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +8 -1
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +0 -3
- package/lib-cjs/component/panels/databasePanel/DatabasePreferences.js +3 -16
- package/lib-cjs/component/reducer/Reducer.js +4 -5
- package/lib-cjs/component/reducer/actions/FiltersActions.js +62 -18
- package/lib-cjs/component/reducer/actions/LoadActions.js +2 -3
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +2 -2
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +4 -7
- package/lib-cjs/component/reducer/actions/RangesActions.js +1 -1
- package/lib-cjs/component/reducer/actions/ToolsActions.js +13 -61
- package/lib-cjs/component/reducer/helper/ZoomHistoryManager.js +2 -1
- package/lib-cjs/component/reducer/helper/getRange.js +1 -1
- package/lib-cjs/component/reducer/preferencesReducer.js +75 -35
- package/lib-cjs/component/toolbar/FunctionToolBar.js +9 -15
- package/lib-cjs/component/toolbar/ToolTypes.js +3 -3
- package/lib-cjs/component/utility/PathBuilder.js +21 -0
- package/lib-cjs/component/utility/getSpectraByNucleus.js +11 -0
- package/lib-cjs/component/workspaces/Workspace.js +2 -0
- package/lib-cjs/component/workspaces/basic.js +48 -0
- package/lib-cjs/component/workspaces/exercise1D.js +48 -0
- package/lib-cjs/component/workspaces/index.js +6 -0
- package/lib-cjs/component/workspaces/process1D.js +46 -0
- package/lib-cjs/data/Filters.js +3 -1
- package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +5 -2
- package/lib-cjs/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +6 -1
- package/lib-cjs/data/data1d/Spectrum1D/ranges/detectRange.js +0 -1
- package/lib-cjs/data/data1d/Spectrum1D/ranges/detectSignal.js +24 -15
- package/lib-cjs/data/data1d/filter1d/exclusionZones.js +34 -0
- package/lib-cjs/data/migration/MigrationManager.js +3 -0
- package/lib-cjs/data/types/data1d/ExclusionZone.js +2 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +28 -29
- package/lib/component/1d/ExclusionZone.d.ts +0 -8
- package/lib/component/1d/ExclusionZone.js +0 -30
- package/lib/component/1d/ExclusionZones.d.ts +0 -2
- package/lib/component/1d/ExclusionZones.js +0 -10
- 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-cjs/component/1d/ExclusionZone.js +0 -32
- package/lib-cjs/component/1d/ExclusionZones.js +0 -16
- 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
|
@@ -22,7 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.
|
|
25
|
+
exports.NMRiumWorkspaces = void 0;
|
|
26
26
|
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
27
27
|
/** @jsxImportSource @emotion/react */
|
|
28
28
|
const react_1 = require("@emotion/react");
|
|
@@ -121,17 +121,20 @@ const containerStyles = (0, react_1.css) `
|
|
|
121
121
|
border-right: 0.55px #bbbbbb solid;
|
|
122
122
|
}
|
|
123
123
|
`;
|
|
124
|
-
var
|
|
125
|
-
(function (
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
})(
|
|
124
|
+
var NMRiumWorkspaces;
|
|
125
|
+
(function (NMRiumWorkspaces) {
|
|
126
|
+
NMRiumWorkspaces["EXERCISE_1D"] = "exercise1D";
|
|
127
|
+
NMRiumWorkspaces["PROCESS_1D"] = "process1D";
|
|
128
|
+
NMRiumWorkspaces["DEFAULT"] = "default";
|
|
129
|
+
})(NMRiumWorkspaces = exports.NMRiumWorkspaces || (exports.NMRiumWorkspaces = {}));
|
|
130
130
|
const defaultPreferences = {};
|
|
131
131
|
const defaultData = {
|
|
132
132
|
spectra: [],
|
|
133
133
|
};
|
|
134
|
-
function NMRium(
|
|
134
|
+
function NMRium(props) {
|
|
135
|
+
return ((0, jsx_runtime_1.jsx)(analysis_ui_components_1.RootLayout, { style: { width: '100%' }, children: (0, jsx_runtime_1.jsx)(react_error_boundary_1.ErrorBoundary, { FallbackComponent: ErrorOverlay_1.default, children: (0, jsx_runtime_1.jsx)(InnerNMRium, { ...props }, void 0) }, void 0) }, void 0));
|
|
136
|
+
}
|
|
137
|
+
function InnerNMRium({ data: dataProp = defaultData, workspace = NMRiumWorkspaces.DEFAULT, preferences = defaultPreferences, getSpinner = SpinnerContext_1.defaultGetSpinner, onDataChange, emptyText, }) {
|
|
135
138
|
const rootRef = (0, react_2.useRef)(null);
|
|
136
139
|
const elementsWraperRef = (0, react_2.useRef)(null);
|
|
137
140
|
const [show, toggle] = (0, react_use_1.useToggle)(false);
|
|
@@ -159,11 +162,11 @@ function NMRium({ data: dataProp = defaultData, mode = NMRiumMode.DEFAULT, prefe
|
|
|
159
162
|
type: preferencesReducer_1.INIT_PREFERENCES,
|
|
160
163
|
payload: {
|
|
161
164
|
display: preferences,
|
|
162
|
-
|
|
165
|
+
workspace,
|
|
163
166
|
dispatch: dispatchPreferences,
|
|
164
167
|
},
|
|
165
168
|
});
|
|
166
|
-
}, [preferences,
|
|
169
|
+
}, [preferences, workspace]);
|
|
167
170
|
(0, react_2.useEffect)(() => {
|
|
168
171
|
dispatchMiddleWare({ type: Types_1.SET_LOADING_FLAG, isLoading: true });
|
|
169
172
|
if (dataProp) {
|
|
@@ -181,30 +184,30 @@ function NMRium({ data: dataProp = defaultData, mode = NMRiumMode.DEFAULT, prefe
|
|
|
181
184
|
const mouseLeaveHandler = (0, react_2.useCallback)(() => {
|
|
182
185
|
dispatchMiddleWare({ type: Types_1.SET_MOUSE_OVER_DISPLAYER, payload: false });
|
|
183
186
|
}, [dispatchMiddleWare]);
|
|
184
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
187
|
+
return ((0, jsx_runtime_1.jsx)(GlobalContext_1.GlobalProvider, { value: {
|
|
188
|
+
rootRef: rootRef.current,
|
|
189
|
+
elementsWraperRef: elementsWraperRef.current,
|
|
190
|
+
}, children: (0, jsx_runtime_1.jsx)(PreferencesContext_1.PreferencesProvider, { value: preferencesState, children: (0, jsx_runtime_1.jsx)("div", { onMouseEnter: mouseEnterHandler, onMouseLeave: mouseLeaveHandler, style: { height: '100%', position: 'relative' }, children: (0, jsx_runtime_1.jsx)(Alert_1.AlertProvider, { wrapperRef: elementsWraperRef.current, children: (0, jsx_runtime_1.jsx)(DispatchContext_1.DispatchProvider, { value: dispatchMiddleWare, children: (0, jsx_runtime_1.jsx)(ChartContext_1.ChartDataProvider, { value: state, children: (0, jsx_runtime_1.jsx)(Modal_1.ModalProvider, { wrapperRef: elementsWraperRef.current, children: (0, jsx_runtime_1.jsx)(highlight_1.HighlightProvider, { children: (0, jsx_runtime_1.jsx)(assignment_1.AssignmentProvider, { spectraData: spectraData, children: (0, jsx_runtime_1.jsx)(SpinnerContext_1.SpinnerProvider, { value: getSpinner, children: (0, jsx_runtime_1.jsx)("div", { className: "nmrium-container", ref: rootRef, css: containerStyles, onContextMenu: preventContextMenuHandler, style: { height: '100%', width: '100%' }, children: (0, jsx_runtime_1.jsx)(DropZone_1.default, { children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
191
|
+
display: 'flex',
|
|
192
|
+
flexDirection: 'column',
|
|
193
|
+
backgroundColor: 'white',
|
|
194
|
+
width: '100%',
|
|
195
|
+
}, children: [(0, jsx_runtime_1.jsx)(Header_1.default, { isFullscreen: isFullscreen, onMaximize: toggle }, void 0), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
188
196
|
display: 'flex',
|
|
189
|
-
flexDirection: '
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
left: 0,
|
|
205
|
-
right: 0,
|
|
206
|
-
top: 0,
|
|
207
|
-
bottom: 0,
|
|
208
|
-
} }, String(isFullscreen))] }, void 0)] }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0));
|
|
197
|
+
flexDirection: 'row',
|
|
198
|
+
height: '100%',
|
|
199
|
+
}, children: [(0, jsx_runtime_1.jsx)(ToolBar_1.default, {}, void 0), (0, jsx_runtime_1.jsxs)(analysis_ui_components_1.SplitPane, { initialSeparation: "590px", orientation: "horizontal", sideSeparation: "end", children: [(0, jsx_runtime_1.jsxs)("div", { css: viewerContainerStyle, children: [(0, jsx_runtime_1.jsx)(KeysListenerTracker_1.default, {}, void 0), (0, jsx_runtime_1.jsx)("div", { "data-test-id": "viewer", style: {
|
|
200
|
+
width: '100%',
|
|
201
|
+
height: '100%',
|
|
202
|
+
}, children: displayerMode ===
|
|
203
|
+
Constants_1.DISPLAYER_MODE.DM_1D ? ((0, jsx_runtime_1.jsx)(Viewer1D_1.default, { emptyText: emptyText }, void 0)) : ((0, jsx_runtime_1.jsx)(Viewer2D_1.default, { emptyText: emptyText }, void 0)) }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)(Panels_1.default, {}, void 0)] }, void 0), (0, jsx_runtime_1.jsx)("div", { ref: elementsWraperRef, id: "main-wrapper", style: {
|
|
204
|
+
position: 'absolute',
|
|
205
|
+
pointerEvents: 'none',
|
|
206
|
+
zIndex: 0,
|
|
207
|
+
left: 0,
|
|
208
|
+
right: 0,
|
|
209
|
+
top: 0,
|
|
210
|
+
bottom: 0,
|
|
211
|
+
} }, String(isFullscreen))] }, void 0)] }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0));
|
|
209
212
|
}
|
|
210
213
|
exports.default = (0, react_2.memo)(NMRium);
|
|
@@ -20,6 +20,7 @@ const styles = (styles) => (0, react_1.css) `
|
|
|
20
20
|
|
|
21
21
|
${styles}
|
|
22
22
|
`;
|
|
23
|
+
/* eslint-enable react/no-unused-prop-types */
|
|
23
24
|
function InternalTab({ tabid, tablabel, isActive, onClick = () => null, canDelete, onDelete = () => null, tabstyles, render, }) {
|
|
24
25
|
let className = 'tab-list-item';
|
|
25
26
|
// use tab identifier if given (higher priority)
|
|
@@ -10,6 +10,7 @@ const react_1 = require("react");
|
|
|
10
10
|
const fa_1 = require("react-icons/fa");
|
|
11
11
|
const constants_1 = require("../../constants");
|
|
12
12
|
const ChartContext_1 = require("../context/ChartContext");
|
|
13
|
+
const PreferencesContext_1 = require("../context/PreferencesContext");
|
|
13
14
|
const Alert_1 = require("../elements/popup/Alert");
|
|
14
15
|
const Modal_1 = require("../elements/popup/Modal");
|
|
15
16
|
const AboutUsModal_1 = __importDefault(require("../modal/AboutUsModal"));
|
|
@@ -22,7 +23,7 @@ const RangesPickingOptionPanel_1 = __importDefault(require("./RangesPickingOptio
|
|
|
22
23
|
const ZeroFillingOptionsPanel_1 = __importDefault(require("./ZeroFillingOptionsPanel"));
|
|
23
24
|
const Zones2DOptionPanel_1 = __importDefault(require("./Zones2DOptionPanel"));
|
|
24
25
|
function HeaderInner(props) {
|
|
25
|
-
const { isFullscreen, onMaximize = () => null, selectedOptionPanel } = props;
|
|
26
|
+
const { isFullscreen, onMaximize = () => null, selectedOptionPanel, hideGeneralSettings, } = props;
|
|
26
27
|
const alert = (0, Alert_1.useAlert)();
|
|
27
28
|
const modal = (0, Modal_1.useModal)();
|
|
28
29
|
const selectedPanel = (0, react_1.useMemo)(() => {
|
|
@@ -69,11 +70,17 @@ function HeaderInner(props) {
|
|
|
69
70
|
display: 'flex',
|
|
70
71
|
alignItems: 'center',
|
|
71
72
|
justifyContent: 'center',
|
|
72
|
-
}, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgLogoNmrium, {}, void 0) }, void 0) }, void 0) }, void 0) }, void 0), (0, jsx_runtime_1.jsx)("div", { className: "toolOptionsPanel", children: selectedPanel }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)(analysis_ui_components_1.Toolbar, { orientation: "horizontal", children: [(0, jsx_runtime_1.jsx)(analysis_ui_components_1.Toolbar.Item, { id: "user-manual", title: "User manual", onClick: () => window.open(constants_1.docsBaseUrl, '_blank'), children: (0, jsx_runtime_1.jsx)(fa_1.FaQuestionCircle, {}, void 0) }, void 0), (0, jsx_runtime_1.jsx)(analysis_ui_components_1.Toolbar.Item, { id: "general-settings", onClick: openGeneralSettingsHandler, title: "General settings", children: (0, jsx_runtime_1.jsx)(fa_1.FaWrench, {}, void 0) }, void 0), !isFullscreen && ((0, jsx_runtime_1.jsx)(analysis_ui_components_1.Toolbar.Item, { id: "full-screen", onClick: onMaximize, title: "Full Screen", className: "windowButton", children: (0, jsx_runtime_1.jsx)(fa_1.FaRegWindowMaximize, {}, void 0) }, void 0))] }, void 0)] }, void 0));
|
|
73
|
+
}, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgLogoNmrium, {}, void 0) }, void 0) }, void 0) }, void 0) }, void 0), (0, jsx_runtime_1.jsx)("div", { className: "toolOptionsPanel", children: selectedPanel }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)(analysis_ui_components_1.Toolbar, { orientation: "horizontal", children: [(0, jsx_runtime_1.jsx)(analysis_ui_components_1.Toolbar.Item, { id: "user-manual", title: "User manual", onClick: () => window.open(constants_1.docsBaseUrl, '_blank'), children: (0, jsx_runtime_1.jsx)(fa_1.FaQuestionCircle, {}, void 0) }, void 0), !hideGeneralSettings && ((0, jsx_runtime_1.jsx)(analysis_ui_components_1.Toolbar.Item, { id: "general-settings", onClick: openGeneralSettingsHandler, title: "General settings", children: (0, jsx_runtime_1.jsx)(fa_1.FaWrench, {}, void 0) }, void 0)), !isFullscreen && ((0, jsx_runtime_1.jsx)(analysis_ui_components_1.Toolbar.Item, { id: "full-screen", onClick: onMaximize, title: "Full Screen", className: "windowButton", children: (0, jsx_runtime_1.jsx)(fa_1.FaRegWindowMaximize, {}, void 0) }, void 0))] }, void 0)] }, void 0));
|
|
73
74
|
}
|
|
74
75
|
const MemoizedHeader = (0, react_1.memo)(HeaderInner);
|
|
75
76
|
function HeaderWrapper({ isFullscreen, onMaximize }) {
|
|
76
77
|
const { toolOptions: { selectedOptionPanel }, } = (0, ChartContext_1.useChartData)();
|
|
77
|
-
|
|
78
|
+
const { display: { general }, } = (0, PreferencesContext_1.usePreferences)();
|
|
79
|
+
return ((0, jsx_runtime_1.jsx)(MemoizedHeader, { ...{
|
|
80
|
+
selectedOptionPanel,
|
|
81
|
+
isFullscreen,
|
|
82
|
+
onMaximize,
|
|
83
|
+
hideGeneralSettings: general?.hideGeneralSettings || false,
|
|
84
|
+
} }, void 0));
|
|
78
85
|
}
|
|
79
86
|
exports.default = HeaderWrapper;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const get_1 = __importDefault(require("lodash/get"));
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const ChartContext_1 = require("../context/ChartContext");
|
|
9
|
+
const PreferencesContext_1 = require("../context/PreferencesContext");
|
|
10
|
+
function useActiveSpectrumStyleOptions(id) {
|
|
11
|
+
const { activeSpectrum } = (0, ChartContext_1.useChartData)();
|
|
12
|
+
const preferences = (0, PreferencesContext_1.usePreferences)();
|
|
13
|
+
return (0, react_1.useMemo)(() => {
|
|
14
|
+
const isActive = activeSpectrum === null ? true : id === activeSpectrum.id ? true : false;
|
|
15
|
+
const opacity = isActive
|
|
16
|
+
? 1
|
|
17
|
+
: (0, get_1.default)(preferences, 'controllers.dimmedSpectraTransparency', 0.1);
|
|
18
|
+
return { isActive, opacity };
|
|
19
|
+
}, [activeSpectrum, id, preferences]);
|
|
20
|
+
}
|
|
21
|
+
exports.default = useActiveSpectrumStyleOptions;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const get_1 = __importDefault(require("lodash/get"));
|
|
3
7
|
const react_1 = require("react");
|
|
4
8
|
const PreferencesContext_1 = require("../context/PreferencesContext");
|
|
5
9
|
function useCheckExperimentalFeature() {
|
|
6
10
|
const preferences = (0, PreferencesContext_1.usePreferences)();
|
|
7
11
|
return (0, react_1.useMemo)(() => {
|
|
8
|
-
return !preferences
|
|
12
|
+
return !(0, get_1.default)(preferences, 'display.general.hideExperimentalFeatures', false);
|
|
9
13
|
}, [preferences]);
|
|
10
14
|
}
|
|
11
15
|
exports.default = useCheckExperimentalFeature;
|
|
@@ -0,0 +1,13 @@
|
|
|
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.useCheckToolsVisibility = void 0;
|
|
7
|
+
const get_1 = __importDefault(require("lodash/get"));
|
|
8
|
+
const PreferencesContext_1 = require("../context/PreferencesContext");
|
|
9
|
+
function useCheckToolsVisibility() {
|
|
10
|
+
const preferences = (0, PreferencesContext_1.usePreferences)();
|
|
11
|
+
return (toolKey) => !(0, get_1.default)(preferences, `display.toolBarButtons.${toolKey}`, false);
|
|
12
|
+
}
|
|
13
|
+
exports.useCheckToolsVisibility = useCheckToolsVisibility;
|
|
@@ -24,8 +24,9 @@ function useToolsFunctions() {
|
|
|
24
24
|
ToolTypes_1.options.peakPicking.id,
|
|
25
25
|
ToolTypes_1.options.integral.id,
|
|
26
26
|
ToolTypes_1.options.zone2D.id,
|
|
27
|
+
ToolTypes_1.options.exclusionZones.id,
|
|
27
28
|
].includes(selectedTool)) {
|
|
28
|
-
alert.show('Press Shift + Left Mouse button to select zone
|
|
29
|
+
alert.show('Press Shift + Left Mouse button to select zone');
|
|
29
30
|
}
|
|
30
31
|
if (ToolTypes_1.options[selectedTool].hasOptionPanel &&
|
|
31
32
|
Object.keys(Panels_1.PANELS_ACCORDION).includes(selectedTool)) {
|
|
@@ -13,6 +13,7 @@ const fa_1 = require("react-icons/fa");
|
|
|
13
13
|
const ChartContext_1 = require("../context/ChartContext");
|
|
14
14
|
const DispatchContext_1 = require("../context/DispatchContext");
|
|
15
15
|
const LoaderContext_1 = require("../context/LoaderContext");
|
|
16
|
+
const Alert_1 = require("../elements/popup/Alert");
|
|
16
17
|
const Types_1 = require("../reducer/types/Types");
|
|
17
18
|
const FileUtility_1 = require("../utility/FileUtility");
|
|
18
19
|
const style = (0, react_1.css) `
|
|
@@ -49,72 +50,75 @@ const containerStyle = (0, react_1.css) `
|
|
|
49
50
|
function DropZone(props) {
|
|
50
51
|
const { width, height } = (0, ChartContext_1.useChartData)();
|
|
51
52
|
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
52
|
-
const
|
|
53
|
+
const alert = (0, Alert_1.useAlert)();
|
|
54
|
+
const loadSubFilesFromZip = (0, react_2.useCallback)(async (extractedfiles, uniqueFileExtensions) => {
|
|
53
55
|
for (let extension of uniqueFileExtensions) {
|
|
54
56
|
const selectedFilesByExtensions = extractedfiles.filter((file) => (0, FileUtility_1.getFileExtension)(file.name) === extension);
|
|
55
57
|
switch (extension) {
|
|
56
|
-
case FileUtility_1.FILES_TYPES.MOL:
|
|
57
|
-
|
|
58
|
+
case FileUtility_1.FILES_TYPES.MOL: {
|
|
59
|
+
const files = await (0, FileUtility_1.loadFilesFromZip)(selectedFilesByExtensions);
|
|
60
|
+
dispatch({ type: Types_1.LOAD_MOL_FILE, files });
|
|
58
61
|
break;
|
|
62
|
+
}
|
|
59
63
|
case FileUtility_1.FILES_TYPES.NMRIUM:
|
|
60
|
-
case FileUtility_1.FILES_TYPES.JSON:
|
|
61
|
-
|
|
64
|
+
case FileUtility_1.FILES_TYPES.JSON: {
|
|
65
|
+
const files = await (0, FileUtility_1.loadFilesFromZip)(selectedFilesByExtensions, {
|
|
62
66
|
asBuffer: true,
|
|
63
|
-
}).then((files) => {
|
|
64
|
-
if (selectedFilesByExtensions.length === 1) {
|
|
65
|
-
const decoder = new TextDecoder('utf8');
|
|
66
|
-
files[0].binary = decoder.decode(files[0].binary);
|
|
67
|
-
dispatch({ type: Types_1.LOAD_JSON_FILE, files });
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
dispatch({ type: Types_1.SET_LOADING_FLAG, isLoading: false });
|
|
71
|
-
// eslint-disable-next-line no-alert
|
|
72
|
-
alert('You can add only one json file');
|
|
73
|
-
}
|
|
74
67
|
});
|
|
68
|
+
if (selectedFilesByExtensions.length === 1) {
|
|
69
|
+
const decoder = new TextDecoder('utf8');
|
|
70
|
+
files[0].binary = decoder.decode(files[0].binary);
|
|
71
|
+
dispatch({ type: Types_1.LOAD_JSON_FILE, files });
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
throw new Error('You can add only one json file');
|
|
75
|
+
}
|
|
75
76
|
break;
|
|
77
|
+
}
|
|
76
78
|
case FileUtility_1.FILES_TYPES.JDX:
|
|
77
|
-
case FileUtility_1.FILES_TYPES.DX:
|
|
78
|
-
|
|
79
|
+
case FileUtility_1.FILES_TYPES.DX: {
|
|
80
|
+
const files = await (0, FileUtility_1.loadFilesFromZip)(selectedFilesByExtensions, {
|
|
79
81
|
asBuffer: true,
|
|
80
|
-
})
|
|
82
|
+
});
|
|
83
|
+
dispatch({ type: Types_1.LOAD_JCAMP_FILE, files });
|
|
81
84
|
break;
|
|
82
|
-
|
|
83
|
-
|
|
85
|
+
}
|
|
86
|
+
case FileUtility_1.FILES_TYPES.JDF: {
|
|
87
|
+
const files = await (0, FileUtility_1.loadFilesFromZip)(selectedFilesByExtensions, {
|
|
84
88
|
asBuffer: true,
|
|
85
|
-
})
|
|
89
|
+
});
|
|
90
|
+
dispatch({ type: Types_1.LOAD_JDF_FILE, files });
|
|
86
91
|
break;
|
|
92
|
+
}
|
|
87
93
|
default:
|
|
88
94
|
break;
|
|
89
95
|
}
|
|
90
96
|
}
|
|
91
97
|
}, [dispatch]);
|
|
92
|
-
const loadFilesHandler = (0, react_2.useCallback)((files) => {
|
|
98
|
+
const loadFilesHandler = (0, react_2.useCallback)(async (files) => {
|
|
93
99
|
const uniqueFileExtensions = [
|
|
94
100
|
...new Set(files.map((file) => (0, FileUtility_1.getFileExtension)(file.name))),
|
|
95
101
|
];
|
|
96
102
|
for (let extension of uniqueFileExtensions) {
|
|
97
103
|
const selectedFilesByExtensions = files.filter((file) => (0, FileUtility_1.getFileExtension)(file.name) === extension);
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
104
|
+
try {
|
|
105
|
+
switch (extension) {
|
|
106
|
+
case FileUtility_1.FILES_TYPES.MOL: {
|
|
107
|
+
const files = await (0, FileUtility_1.loadFiles)(selectedFilesByExtensions);
|
|
101
108
|
dispatch({ type: Types_1.LOAD_MOL_FILE, files });
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
(0, FileUtility_1.loadFiles)(selectedFilesByExtensions, {
|
|
111
|
-
asBuffer: true,
|
|
112
|
-
}).then(async (files) => {
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
case FileUtility_1.FILES_TYPES.NMRIUM:
|
|
112
|
+
case FileUtility_1.FILES_TYPES.JSON:
|
|
113
|
+
if (selectedFilesByExtensions.length === 1) {
|
|
114
|
+
const files = await (0, FileUtility_1.loadFiles)(selectedFilesByExtensions, {
|
|
115
|
+
asBuffer: true,
|
|
116
|
+
});
|
|
113
117
|
// InputFileFormat
|
|
114
118
|
const fileSignature = (0, FileUtility_1.getFileSignature)(files[0].binary);
|
|
115
119
|
if (fileSignature === FileUtility_1.FILES_SIGNATURES.ZIP) {
|
|
116
120
|
const unzipResult = await jszip_1.default.loadAsync(files[0].binary);
|
|
117
|
-
|
|
121
|
+
await loadSubFilesFromZip(Object.values(unzipResult.files), [
|
|
118
122
|
FileUtility_1.FILES_TYPES.NMRIUM,
|
|
119
123
|
]);
|
|
120
124
|
}
|
|
@@ -123,35 +127,30 @@ function DropZone(props) {
|
|
|
123
127
|
files[0].binary = decoder.decode(files[0].binary);
|
|
124
128
|
dispatch({ type: Types_1.LOAD_JSON_FILE, files });
|
|
125
129
|
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
throw new Error('You can add only one json file');
|
|
133
|
+
}
|
|
134
|
+
break;
|
|
135
|
+
case FileUtility_1.FILES_TYPES.JDX:
|
|
136
|
+
case FileUtility_1.FILES_TYPES.DX: {
|
|
137
|
+
const files = await (0, FileUtility_1.loadFiles)(selectedFilesByExtensions, {
|
|
138
|
+
asBuffer: true,
|
|
129
139
|
});
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
// eslint-disable-next-line no-alert
|
|
133
|
-
alert('You can add only one json file');
|
|
134
|
-
}
|
|
135
|
-
break;
|
|
136
|
-
case FileUtility_1.FILES_TYPES.JDX:
|
|
137
|
-
case FileUtility_1.FILES_TYPES.DX:
|
|
138
|
-
(0, FileUtility_1.loadFiles)(selectedFilesByExtensions, { asBuffer: true }).then((files) => {
|
|
139
140
|
dispatch({ type: Types_1.LOAD_JCAMP_FILE, files });
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
(0, FileUtility_1.loadFiles)(selectedFilesByExtensions, { asBuffer: true }).then((files) => {
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
case FileUtility_1.FILES_TYPES.JDF: {
|
|
144
|
+
const files = await (0, FileUtility_1.loadFiles)(selectedFilesByExtensions, {
|
|
145
|
+
asBuffer: true,
|
|
146
|
+
});
|
|
147
147
|
dispatch({ type: Types_1.LOAD_JDF_FILE, files });
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
(0, FileUtility_1.loadFiles)(selectedFilesByExtensions, { asBuffer: true }).then(async (files) => {
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
case FileUtility_1.FILES_TYPES.ZIP: {
|
|
151
|
+
const files = await (0, FileUtility_1.loadFiles)(selectedFilesByExtensions, {
|
|
152
|
+
asBuffer: true,
|
|
153
|
+
});
|
|
155
154
|
for (const zipFile of files) {
|
|
156
155
|
const unzipResult = await jszip_1.default.loadAsync(zipFile.binary);
|
|
157
156
|
const uniqueFileExtensions = [
|
|
@@ -164,38 +163,39 @@ function DropZone(props) {
|
|
|
164
163
|
});
|
|
165
164
|
if (hasBruker)
|
|
166
165
|
dispatch({ type: Types_1.LOAD_ZIP_FILE, files });
|
|
167
|
-
|
|
166
|
+
await loadSubFilesFromZip(Object.values(unzipResult.files), uniqueFileExtensions);
|
|
168
167
|
}
|
|
169
168
|
else {
|
|
170
169
|
dispatch({ type: Types_1.LOAD_ZIP_FILE, files });
|
|
171
170
|
}
|
|
172
171
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
case FileUtility_1.FILES_TYPES.NMREDATA:
|
|
175
|
+
void (0, FileUtility_1.loadFiles)(selectedFilesByExtensions, {
|
|
176
|
+
asBuffer: true,
|
|
177
|
+
}).then(async (files) => {
|
|
178
|
+
for (const zipFile of files) {
|
|
179
|
+
dispatch({
|
|
180
|
+
type: Types_1.LOAD_NMREDATA_FILE,
|
|
181
|
+
file: zipFile,
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
break;
|
|
186
|
+
default:
|
|
187
|
+
throw new Error('The file extension must be zip, dx, jdx, json, mol, nmredata or nmrium.');
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
catch (e) {
|
|
191
|
+
dispatch({ type: Types_1.SET_LOADING_FLAG, isLoading: false });
|
|
192
|
+
alert.error(e.message);
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
|
-
}, [dispatch,
|
|
195
|
+
}, [alert, dispatch, loadSubFilesFromZip]);
|
|
196
196
|
const onDrop = (0, react_2.useCallback)((droppedFiles) => {
|
|
197
197
|
dispatch({ type: Types_1.SET_LOADING_FLAG, isLoading: true });
|
|
198
|
-
loadFilesHandler(droppedFiles);
|
|
198
|
+
void loadFilesHandler(droppedFiles);
|
|
199
199
|
}, [dispatch, loadFilesHandler]);
|
|
200
200
|
const { getRootProps, getInputProps, isDragActive, open: openImportDialog, } = (0, react_dropzone_1.useDropzone)({
|
|
201
201
|
onDrop,
|
|
@@ -204,7 +204,7 @@ function DropZone(props) {
|
|
|
204
204
|
const open = (0, react_2.useCallback)(() => {
|
|
205
205
|
openImportDialog();
|
|
206
206
|
}, [openImportDialog]);
|
|
207
|
-
return ((0, jsx_runtime_1.jsx)(LoaderContext_1.LoaderProvider, { value: open, children: (0, jsx_runtime_1.jsxs)("div", { ...getRootProps(), css: containerStyle, children: [(0, jsx_runtime_1.jsx)("input", { ...getInputProps() }, void 0), isDragActive && ((0, jsx_runtime_1.jsxs)("div", { css: style, style: {
|
|
207
|
+
return ((0, jsx_runtime_1.jsx)(LoaderContext_1.LoaderProvider, { value: open, children: (0, jsx_runtime_1.jsxs)("div", { ...getRootProps(), role: "none", css: containerStyle, children: [(0, jsx_runtime_1.jsx)("input", { "data-test-id": "dropzone-input", ...getInputProps() }, void 0), isDragActive && ((0, jsx_runtime_1.jsxs)("div", { css: style, style: {
|
|
208
208
|
width: `${width}px`,
|
|
209
209
|
height: `${height}px`,
|
|
210
210
|
marginTop: '30px',
|
|
@@ -34,12 +34,15 @@ exports.ModalStyles = (0, react_1.css) `
|
|
|
34
34
|
button:focus {
|
|
35
35
|
outline: none;
|
|
36
36
|
}
|
|
37
|
-
button:hover {
|
|
37
|
+
button:not([disabled]):hover {
|
|
38
38
|
color: #007bff;
|
|
39
39
|
}
|
|
40
|
-
.btn:hover {
|
|
40
|
+
.btn:not([disabled]):hover {
|
|
41
41
|
background-color: #ffffff;
|
|
42
42
|
}
|
|
43
|
+
.btn:disabled {
|
|
44
|
+
opacity: 0.5;
|
|
45
|
+
}
|
|
43
46
|
.btn {
|
|
44
47
|
border: none;
|
|
45
48
|
padding: 0 15px;
|
|
@@ -20,7 +20,8 @@ function MoleculeStructureEditorModal(props) {
|
|
|
20
20
|
}
|
|
21
21
|
}, [selectedMolecule]);
|
|
22
22
|
const cb = (0, react_1.useCallback)((newMolfile) => {
|
|
23
|
-
|
|
23
|
+
const molText = /(?<s>M {2}V30 BEGIN BOND)(?<mol>.*?)(?<e>M {2}V30 END BOND)/gs.exec(newMolfile)?.groups?.mol;
|
|
24
|
+
setMolfile(molText?.trim() ? newMolfile : null);
|
|
24
25
|
}, [setMolfile]);
|
|
25
26
|
const handleClose = (0, react_1.useCallback)(() => {
|
|
26
27
|
onClose();
|
|
@@ -35,6 +36,6 @@ function MoleculeStructureEditorModal(props) {
|
|
|
35
36
|
onClose('new');
|
|
36
37
|
}
|
|
37
38
|
}, [dispatch, selectedMolecule, molfile, onClose]);
|
|
38
|
-
return ((0, jsx_runtime_1.jsxs)("div", { css: ModalStyle_1.ModalStyles, children: [(0, jsx_runtime_1.jsx)(full_1.StructureEditor, { initialMolfile: selectedMolecule?.molfile, svgMenu: true, fragment: false, onChange: cb }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "footer-container", children: [(0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn", onClick: handleSave, children: "Save" }, void 0), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn", onClick: handleClose, children: "Close" }, void 0)] }, void 0)] }, void 0));
|
|
39
|
+
return ((0, jsx_runtime_1.jsxs)("div", { css: ModalStyle_1.ModalStyles, children: [(0, jsx_runtime_1.jsx)(full_1.StructureEditor, { initialMolfile: selectedMolecule?.molfile, svgMenu: true, fragment: false, onChange: cb }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "footer-container", children: [(0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn", onClick: handleSave, disabled: !molfile, children: "Save" }, void 0), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn", onClick: handleClose, children: "Close" }, void 0)] }, void 0)] }, void 0));
|
|
39
40
|
}
|
|
40
41
|
exports.default = MoleculeStructureEditorModal;
|
|
@@ -73,6 +73,15 @@ const styles = (0, react_1.css) `
|
|
|
73
73
|
.container {
|
|
74
74
|
flex: 1;
|
|
75
75
|
}
|
|
76
|
+
|
|
77
|
+
.infoText {
|
|
78
|
+
padding: 10px;
|
|
79
|
+
font-size: 12px;
|
|
80
|
+
text-align: left;
|
|
81
|
+
color: white;
|
|
82
|
+
background-color: #5f5f5f;
|
|
83
|
+
border-radius: 5px;
|
|
84
|
+
}
|
|
76
85
|
`;
|
|
77
86
|
function MultipleSpectraFiltersModal({ onClose = () => null, nucleus = '', }) {
|
|
78
87
|
const refForm = (0, react_2.useRef)();
|
|
@@ -129,6 +138,6 @@ function MultipleSpectraFiltersModal({ onClose = () => null, nucleus = '', }) {
|
|
|
129
138
|
break;
|
|
130
139
|
}
|
|
131
140
|
}, [filter, submitHandler]);
|
|
132
|
-
return ((0, jsx_runtime_1.jsxs)("div", { css: [ModalStyle_1.ModalStyles, styles], children: [(0, jsx_runtime_1.jsxs)("div", { className: "header handle", children: [(0, jsx_runtime_1.jsx)("span", { children: "Apply filters" }, void 0), (0, jsx_runtime_1.jsx)(CloseButton_1.default, { onClick: onClose, className: "close-bt" }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "inner-content container", children: [(0, jsx_runtime_1.jsxs)("div", { className: "row margin-10", children: [(0, jsx_runtime_1.jsx)("span", { className: "custom-label", children: "Filter :" }, void 0), (0, jsx_runtime_1.jsx)(Select_1.default, { data: List, style: { width: 275, height: 30, margin: 0 }, onChange: filterChangeHandler }, void 0)] }, void 0), filterOptions] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "footer-container", children: [(0, jsx_runtime_1.jsx)("button", { type: "button", onClick: handleSave, className: "btn primary", children: "Apply" }, void 0), (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: onClose, className: "btn", children: "Close" }, void 0)] }, void 0)] }, void 0));
|
|
141
|
+
return ((0, jsx_runtime_1.jsxs)("div", { css: [ModalStyle_1.ModalStyles, styles], children: [(0, jsx_runtime_1.jsxs)("div", { className: "header handle", children: [(0, jsx_runtime_1.jsx)("span", { children: "Apply filters" }, void 0), (0, jsx_runtime_1.jsx)(CloseButton_1.default, { onClick: onClose, className: "close-bt" }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "inner-content container", children: [(0, jsx_runtime_1.jsx)("p", { className: "infoText", children: "This filter will use the exclusions zones defined in the first spectrum." }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10", children: [(0, jsx_runtime_1.jsx)("span", { className: "custom-label", children: "Filter :" }, void 0), (0, jsx_runtime_1.jsx)(Select_1.default, { data: List, style: { width: 275, height: 30, margin: 0 }, onChange: filterChangeHandler }, void 0)] }, void 0), filterOptions] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "footer-container", children: [(0, jsx_runtime_1.jsx)("button", { type: "button", onClick: handleSave, className: "btn primary", children: "Apply" }, void 0), (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: onClose, className: "btn", children: "Close" }, void 0)] }, void 0)] }, void 0));
|
|
133
142
|
}
|
|
134
143
|
exports.default = MultipleSpectraFiltersModal;
|
|
@@ -96,7 +96,9 @@ function ChangeSumModal({ onSave, onClose, header, sumOptions, }) {
|
|
|
96
96
|
setActiveOption(tab.tabid);
|
|
97
97
|
}, []);
|
|
98
98
|
(0, react_2.useEffect)(() => {
|
|
99
|
-
if (sumOptions.sumAuto
|
|
99
|
+
if (sumOptions.sumAuto &&
|
|
100
|
+
!general.hideSetSumFromMolecule &&
|
|
101
|
+
!panels.hideStructuresPanel) {
|
|
100
102
|
setActiveOption(SumSetOptions.Auto);
|
|
101
103
|
const { mf, moleculeKey: key } = sumOptions;
|
|
102
104
|
formRef.current.setValues({
|
|
@@ -108,7 +110,7 @@ function ChangeSumModal({ onSave, onClose, header, sumOptions, }) {
|
|
|
108
110
|
setActiveOption(SumSetOptions.Manual);
|
|
109
111
|
formRef.current.setValues({ sum: sumOptions.sum, molecule: null });
|
|
110
112
|
}
|
|
111
|
-
}, [sumOptions]);
|
|
113
|
+
}, [general.hideSetSumFromMolecule, panels.hideStructuresPanel, sumOptions]);
|
|
112
114
|
const saveHandler = (0, react_2.useCallback)((values) => {
|
|
113
115
|
switch (setOption) {
|
|
114
116
|
case SumSetOptions.Auto: {
|
|
@@ -32,7 +32,6 @@ const Tab_1 = __importDefault(require("../../elements/Tab/Tab"));
|
|
|
32
32
|
const Tabs_1 = __importStar(require("../../elements/Tab/Tabs"));
|
|
33
33
|
const FormikForm_1 = __importDefault(require("../../elements/formik/FormikForm"));
|
|
34
34
|
const preferencesReducer_1 = require("../../reducer/preferencesReducer");
|
|
35
|
-
const LocalStorage_1 = require("../../utility/LocalStorage");
|
|
36
35
|
const ControllersTabContent_1 = __importDefault(require("./ControllersTabContent"));
|
|
37
36
|
const DisplayTabContent_1 = __importDefault(require("./DisplayTabContent"));
|
|
38
37
|
const FormattingTabContent_1 = __importDefault(require("./FormattingTabContent"));
|
|
@@ -166,17 +165,14 @@ const styles = (0, react_1.css) `
|
|
|
166
165
|
function GeneralSettings({ onClose, onSave }) {
|
|
167
166
|
const [activeTab, setActiveTab] = (0, react_2.useState)('controllers');
|
|
168
167
|
const preferences = (0, PreferencesContext_1.usePreferences)();
|
|
169
|
-
const [, setSettingsData] = (0, LocalStorage_1.useStateWithLocalStorage)('nmr-general-settings');
|
|
170
168
|
const refForm = (0, react_2.useRef)();
|
|
171
169
|
const handleSave = (0, react_2.useCallback)(() => {
|
|
172
170
|
refForm.current.submitForm();
|
|
173
171
|
}, []);
|
|
174
172
|
const submitHandler = (0, react_2.useCallback)((values) => {
|
|
175
|
-
const { dispatch, basePreferences, ...resValues } = values;
|
|
176
|
-
setSettingsData(resValues);
|
|
177
173
|
preferences.dispatch({ type: preferencesReducer_1.SET_PREFERENCES, payload: values });
|
|
178
174
|
onSave?.();
|
|
179
|
-
}, [onSave, preferences
|
|
175
|
+
}, [onSave, preferences]);
|
|
180
176
|
const tabChangeHandler = (0, react_2.useCallback)((tab) => {
|
|
181
177
|
setActiveTab(tab.tabid);
|
|
182
178
|
}, []);
|
|
@@ -68,9 +68,6 @@ function IntegralPanelInner({ integrals, info, activeTab, xDomain, preferences,
|
|
|
68
68
|
}, [changeIntegralSumHandler, currentSum, integrals?.options, modal]);
|
|
69
69
|
const settingsPanelHandler = (0, react_2.useCallback)(() => {
|
|
70
70
|
setFlipStatus(!isFlipped);
|
|
71
|
-
if (!isFlipped) {
|
|
72
|
-
settingRef.current.cancelSetting();
|
|
73
|
-
}
|
|
74
71
|
}, [isFlipped]);
|
|
75
72
|
const saveSettingHandler = (0, react_2.useCallback)(() => {
|
|
76
73
|
settingRef.current.saveSetting();
|