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
|
@@ -48,7 +48,6 @@ const styles = {
|
|
|
48
48
|
function DatabasePreferences(props, ref) {
|
|
49
49
|
const preferences = (0, PreferencesContext_1.usePreferences)();
|
|
50
50
|
const alert = (0, Alert_1.useAlert)();
|
|
51
|
-
const [, setSettingsData] = (0, LocalStorage_1.useStateWithLocalStorage)('nmr-general-settings');
|
|
52
51
|
const formRef = (0, react_1.useRef)();
|
|
53
52
|
const updateValues = (0, react_1.useCallback)(() => {
|
|
54
53
|
const databasePreferences = (0, LocalStorage_1.getValue)(preferences, `formatting.panels.database`);
|
|
@@ -57,30 +56,18 @@ function DatabasePreferences(props, ref) {
|
|
|
57
56
|
(0, react_1.useEffect)(() => {
|
|
58
57
|
updateValues();
|
|
59
58
|
}, [updateValues]);
|
|
60
|
-
const
|
|
61
|
-
setSettingsData(values, 'formatting.panels.database');
|
|
62
|
-
};
|
|
63
|
-
const saveHandler = (0, react_1.useCallback)((values, showMessage = false) => {
|
|
59
|
+
const saveHandler = (0, react_1.useCallback)((values) => {
|
|
64
60
|
preferences.dispatch({
|
|
65
61
|
type: preferencesReducer_1.SET_PANELS_PREFERENCES,
|
|
66
62
|
payload: { key: 'database', value: values },
|
|
67
63
|
});
|
|
68
|
-
|
|
69
|
-
alert.success('database preferences saved successfully');
|
|
70
|
-
}
|
|
64
|
+
alert.success('database preferences saved successfully');
|
|
71
65
|
}, [alert, preferences]);
|
|
72
66
|
(0, react_1.useImperativeHandle)(ref, () => ({
|
|
73
67
|
saveSetting: () => {
|
|
74
68
|
formRef.current.submitForm();
|
|
75
69
|
},
|
|
76
|
-
cancelSetting: () => {
|
|
77
|
-
updateValues();
|
|
78
|
-
},
|
|
79
70
|
}));
|
|
80
|
-
|
|
81
|
-
saveHandler(values, true);
|
|
82
|
-
saveToLocalStorage(values);
|
|
83
|
-
};
|
|
84
|
-
return ((0, jsx_runtime_1.jsx)("div", { style: styles.container, children: (0, jsx_runtime_1.jsx)(FormikForm_1.default, { onSubmit: handleSubmit, ref: formRef, children: (0, jsx_runtime_1.jsxs)("div", { style: styles.groupContainer, children: [(0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: "Smiles", checkControllerName: "showSmiles", hideFormat: true }, void 0), (0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: "Solvent", checkControllerName: "showSolvent", hideFormat: true }, void 0), (0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: "Names", checkControllerName: "showNames", hideFormat: true }, void 0), (0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: "Range", checkControllerName: "showRange", hideFormat: true }, void 0), (0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: "\u03B4 (ppm)", checkControllerName: "showDelta", hideFormat: true }, void 0), (0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: "Assignment", checkControllerName: "showAssignment", hideFormat: true }, void 0), (0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: "J (Hz)", checkControllerName: "showCoupling", hideFormat: true }, void 0), (0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: "Multiplicity", checkControllerName: "showMultiplicity", hideFormat: true }, void 0)] }, void 0) }, void 0) }, void 0));
|
|
71
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: styles.container, children: (0, jsx_runtime_1.jsx)(FormikForm_1.default, { onSubmit: saveHandler, ref: formRef, children: (0, jsx_runtime_1.jsxs)("div", { style: styles.groupContainer, children: [(0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: "Smiles", checkControllerName: "showSmiles", hideFormat: true }, void 0), (0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: "Solvent", checkControllerName: "showSolvent", hideFormat: true }, void 0), (0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: "Names", checkControllerName: "showNames", hideFormat: true }, void 0), (0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: "Range", checkControllerName: "showRange", hideFormat: true }, void 0), (0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: "\u03B4 (ppm)", checkControllerName: "showDelta", hideFormat: true }, void 0), (0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: "Assignment", checkControllerName: "showAssignment", hideFormat: true }, void 0), (0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: "J (Hz)", checkControllerName: "showCoupling", hideFormat: true }, void 0), (0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: "Multiplicity", checkControllerName: "showMultiplicity", hideFormat: true }, void 0)] }, void 0) }, void 0) }, void 0));
|
|
85
72
|
}
|
|
86
73
|
exports.default = (0, react_1.forwardRef)(DatabasePreferences);
|
|
@@ -110,7 +110,6 @@ exports.initialState = {
|
|
|
110
110
|
selectedOptionPanel: null,
|
|
111
111
|
data: {
|
|
112
112
|
baseLineZones: [],
|
|
113
|
-
exclusionZones: {},
|
|
114
113
|
pivot: { value: 0, index: 0 },
|
|
115
114
|
zonesNoiseFactor: 1,
|
|
116
115
|
activeFilterID: null,
|
|
@@ -276,6 +275,10 @@ function innerSpectrumReducer(draft, action) {
|
|
|
276
275
|
return FiltersActions.filterSnapshotHandler(draft, action);
|
|
277
276
|
case types.APPLY_MULTIPLE_SPECTRA_FILTER:
|
|
278
277
|
return FiltersActions.handleMultipleSpectraFilter(draft, action);
|
|
278
|
+
case types.ADD_EXCLUSION_ZONE:
|
|
279
|
+
return FiltersActions.handleAddExclusionZone(draft, action);
|
|
280
|
+
case types.DELETE_EXCLUSION_ZONE:
|
|
281
|
+
return FiltersActions.handleDeleteExclusionZone(draft, action);
|
|
279
282
|
case types.CHANGE_VISIBILITY:
|
|
280
283
|
return SpectrumsActions.handleSpectrumVisibility(draft, action);
|
|
281
284
|
case types.CHANGE_PEAKS_MARKERS_VISIBILITY:
|
|
@@ -376,10 +379,6 @@ function innerSpectrumReducer(draft, action) {
|
|
|
376
379
|
return ToolsActions.handleAddBaseLineZone(draft, action.zone);
|
|
377
380
|
case types.DELETE_BASE_LINE_ZONE:
|
|
378
381
|
return ToolsActions.handleDeleteBaseLineZone(draft, action.id);
|
|
379
|
-
case types.ADD_EXCLUSION_ZONE:
|
|
380
|
-
return ToolsActions.handleAddExclusionZone(draft, action);
|
|
381
|
-
case types.DELETE_EXCLUSION_ZONE:
|
|
382
|
-
return ToolsActions.handleDeleteExclusionZone(draft, action);
|
|
383
382
|
case types.APPLY_BASE_LINE_CORRECTION_FILTER:
|
|
384
383
|
return FiltersActions.handleBaseLineCorrectionFilter(draft, action);
|
|
385
384
|
case types.SET_KEY_PREFERENCES:
|
|
@@ -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.resetSpectrumByFilter = exports.filterSnapshotHandler = exports.handleBaseLineCorrectionFilter = exports.deleteSpectraFilter = exports.deleteFilter = exports.enableFilter = exports.handleMultipleSpectraFilter = exports.calculateManualPhaseCorrection = exports.applyAbsoluteFilter = exports.applyAutoPhaseCorrectionFilter = exports.applyManualPhaseCorrectionFilter = exports.applyFFTFilter = exports.applyZeroFillingFilter = exports.shiftSpectrumAlongXAxis = void 0;
|
|
25
|
+
exports.handleDeleteExclusionZone = exports.handleAddExclusionZone = exports.resetSpectrumByFilter = exports.filterSnapshotHandler = exports.handleBaseLineCorrectionFilter = exports.deleteSpectraFilter = exports.deleteFilter = exports.enableFilter = exports.handleMultipleSpectraFilter = exports.calculateManualPhaseCorrection = exports.applyAbsoluteFilter = exports.applyAutoPhaseCorrectionFilter = exports.applyManualPhaseCorrectionFilter = exports.applyFFTFilter = exports.applyZeroFillingFilter = exports.shiftSpectrumAlongXAxis = void 0;
|
|
26
26
|
const immer_1 = require("immer");
|
|
27
27
|
const Filters = __importStar(require("../../../data/Filters"));
|
|
28
28
|
const FiltersManager = __importStar(require("../../../data/FiltersManager"));
|
|
@@ -30,8 +30,11 @@ const Spectrum1D_1 = require("../../../data/data1d/Spectrum1D");
|
|
|
30
30
|
const autoPhaseCorrection_1 = require("../../../data/data1d/filter1d/autoPhaseCorrection");
|
|
31
31
|
const phaseCorrection_1 = require("../../../data/data1d/filter1d/phaseCorrection");
|
|
32
32
|
const Spectrum2D_1 = require("../../../data/data2d/Spectrum2D");
|
|
33
|
+
const generateID_1 = __importDefault(require("../../../data/utilities/generateID"));
|
|
34
|
+
const getSpectraByNucleus_1 = require("../../utility/getSpectraByNucleus");
|
|
33
35
|
const nucleusToString_1 = __importDefault(require("../../utility/nucleusToString"));
|
|
34
36
|
const ZoomHistoryManager_1 = __importDefault(require("../helper/ZoomHistoryManager"));
|
|
37
|
+
const getRange_1 = __importDefault(require("../helper/getRange"));
|
|
35
38
|
const DomainActions_1 = require("./DomainActions");
|
|
36
39
|
const PreferencesActions_1 = require("./PreferencesActions");
|
|
37
40
|
const ToolsActions_1 = require("./ToolsActions");
|
|
@@ -281,25 +284,66 @@ function filterSnapshotHandler(draft, action) {
|
|
|
281
284
|
}
|
|
282
285
|
exports.filterSnapshotHandler = filterSnapshotHandler;
|
|
283
286
|
function handleMultipleSpectraFilter(draft, action) {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
FiltersManager.applyFilter(datum, filters);
|
|
300
|
-
}
|
|
287
|
+
const spectra = (0, getSpectraByNucleus_1.getSpectraByNucleus)(draft.activeTab, draft.data);
|
|
288
|
+
if (spectra && spectra.length > 0 && Array.isArray(action.payload)) {
|
|
289
|
+
const exclusions = spectra[0].filters.find((f) => f.name === Filters.exclusionZones.id)
|
|
290
|
+
?.value || [];
|
|
291
|
+
for (const spectrum of spectra) {
|
|
292
|
+
const filters = action.payload.map((filter) => {
|
|
293
|
+
if (filter.name === Filters.equallySpaced.id) {
|
|
294
|
+
return {
|
|
295
|
+
...filter,
|
|
296
|
+
options: { ...filter.options, exclusions },
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
return filter;
|
|
300
|
+
});
|
|
301
|
+
FiltersManager.applyFilter(spectrum, filters);
|
|
301
302
|
}
|
|
302
303
|
}
|
|
303
304
|
(0, DomainActions_1.setDomain)(draft);
|
|
304
305
|
}
|
|
305
306
|
exports.handleMultipleSpectraFilter = handleMultipleSpectraFilter;
|
|
307
|
+
function handleAddExclusionZone(draft, action) {
|
|
308
|
+
const { from: startX, to: endX } = action.payload;
|
|
309
|
+
const range = (0, getRange_1.default)(draft, { startX, endX });
|
|
310
|
+
let spectra;
|
|
311
|
+
if (draft.activeSpectrum?.id) {
|
|
312
|
+
const index = draft.activeSpectrum?.index;
|
|
313
|
+
spectra = [draft.data[index]];
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
spectra = (0, getSpectraByNucleus_1.getSpectraByNucleus)(draft.activeTab, draft.data);
|
|
317
|
+
}
|
|
318
|
+
for (const spectrum of spectra) {
|
|
319
|
+
FiltersManager.applyFilter(spectrum, [
|
|
320
|
+
{
|
|
321
|
+
name: Filters.exclusionZones.id,
|
|
322
|
+
options: [
|
|
323
|
+
{
|
|
324
|
+
id: (0, generateID_1.default)(),
|
|
325
|
+
from: range[0],
|
|
326
|
+
to: range[1],
|
|
327
|
+
},
|
|
328
|
+
],
|
|
329
|
+
},
|
|
330
|
+
]);
|
|
331
|
+
}
|
|
332
|
+
(0, DomainActions_1.setDomain)(draft);
|
|
333
|
+
}
|
|
334
|
+
exports.handleAddExclusionZone = handleAddExclusionZone;
|
|
335
|
+
function handleDeleteExclusionZone(draft, action) {
|
|
336
|
+
const { id, spectrumID } = action.payload;
|
|
337
|
+
const spectrumIndex = draft.data.findIndex((spectrum) => spectrum.id === spectrumID);
|
|
338
|
+
const exclusionZonesFilter = draft.data[spectrumIndex].filters.find((filter) => filter.name === Filters.exclusionZones.id);
|
|
339
|
+
if (exclusionZonesFilter) {
|
|
340
|
+
if (exclusionZonesFilter.value.length === 1) {
|
|
341
|
+
FiltersManager.deleteFilter(draft.data[spectrumIndex], exclusionZonesFilter.id);
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
exclusionZonesFilter.value = exclusionZonesFilter.value.filter((zone) => zone.id !== id);
|
|
345
|
+
FiltersManager.reapplyFilters(draft.data[spectrumIndex]);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
exports.handleDeleteExclusionZone = handleDeleteExclusionZone;
|
|
@@ -35,17 +35,16 @@ function setColors(draft, colors) {
|
|
|
35
35
|
draft.usedColors['2d'] = draft.usedColors['2d'].concat(colors['2d']);
|
|
36
36
|
}
|
|
37
37
|
function setData(draft, data) {
|
|
38
|
-
const { spectra, molecules, correlations,
|
|
38
|
+
const { spectra, molecules, correlations, usedColors } = data || {
|
|
39
39
|
spectra: [],
|
|
40
40
|
molecules: [],
|
|
41
41
|
correlations: {},
|
|
42
42
|
multipleAnalysis: {},
|
|
43
|
-
exclusionZones:
|
|
43
|
+
exclusionZones: [],
|
|
44
44
|
};
|
|
45
45
|
setColors(draft, usedColors);
|
|
46
46
|
draft.data = spectra;
|
|
47
47
|
draft.molecules = MoleculeManager.fromJSON(molecules);
|
|
48
|
-
draft.toolOptions.data.exclusionZones = exclusionZones;
|
|
49
48
|
if (!correlations || Object.keys(correlations).length === 0) {
|
|
50
49
|
draft.correlations = (0, nmr_correlation_1.buildCorrelationData)([], {
|
|
51
50
|
tolerance: Constants_1.DefaultTolerance,
|
|
@@ -38,8 +38,8 @@ function addMoleculeHandler(draft, molfile) {
|
|
|
38
38
|
* if it's the first creation of a molecule after the molecules list was empty,
|
|
39
39
|
* set the relative sum for ranges and integrals base on the first molecule
|
|
40
40
|
*/
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
const molecule = draft.molecules[0] || null;
|
|
42
|
+
if (isEmpty && molecule) {
|
|
43
43
|
(0, SumManager_1.changeSpectraRelativeSum)(draft, molecule.key, molecule);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.applyKeyPreferencesHandler = exports.setKeyPreferencesHandler = exports.changeSpectrumVerticalAlignment = void 0;
|
|
7
|
-
const immer_1 = require("immer");
|
|
8
7
|
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
9
8
|
const GroupByInfoKey_1 = __importDefault(require("../../utility/GroupByInfoKey"));
|
|
10
9
|
const nucleusToString_1 = __importDefault(require("../../utility/nucleusToString"));
|
|
@@ -50,8 +49,7 @@ function changeSpectrumVerticalAlignment(draft, options) {
|
|
|
50
49
|
}
|
|
51
50
|
exports.changeSpectrumVerticalAlignment = changeSpectrumVerticalAlignment;
|
|
52
51
|
function setKeyPreferencesHandler(draft, keyCode) {
|
|
53
|
-
const
|
|
54
|
-
const { activeTab, data, activeSpectrum, zoom, xDomain, xDomains, yDomain, yDomains, originDomain, margin, displayerMode, tabActiveSpectrum, } = state;
|
|
52
|
+
const { activeTab, data, activeSpectrum, zoom, xDomain, xDomains, yDomain, yDomains, originDomain, margin, displayerMode, tabActiveSpectrum, } = draft;
|
|
55
53
|
if (activeTab) {
|
|
56
54
|
const groupByNucleus = (0, GroupByInfoKey_1.default)('nucleus');
|
|
57
55
|
const spectrumsGroupsList = groupByNucleus(data);
|
|
@@ -89,11 +87,10 @@ function setKeyPreferencesHandler(draft, keyCode) {
|
|
|
89
87
|
}
|
|
90
88
|
exports.setKeyPreferencesHandler = setKeyPreferencesHandler;
|
|
91
89
|
function applyKeyPreferencesHandler(draft, keyCode) {
|
|
92
|
-
const
|
|
93
|
-
const preferences = state.keysPreferences[keyCode];
|
|
90
|
+
const preferences = draft.keysPreferences[keyCode];
|
|
94
91
|
if (preferences) {
|
|
95
92
|
draft.activeTab = preferences.activeTab;
|
|
96
|
-
|
|
93
|
+
draft.data.forEach((datum, index) => {
|
|
97
94
|
if ((0, nucleusToString_1.default)(datum.info.nucleus) === preferences.activeTab) {
|
|
98
95
|
draft.data[index].display = Object.assign((0, cloneDeep_1.default)(datum.display), preferences.data[datum.id].display);
|
|
99
96
|
}
|
|
@@ -111,7 +108,7 @@ function applyKeyPreferencesHandler(draft, keyCode) {
|
|
|
111
108
|
if (draft.displayerMode === Constants_1.DISPLAYER_MODE.DM_2D) {
|
|
112
109
|
for (const datumID of Object.keys(preferences.level)) {
|
|
113
110
|
const { levelPositive, levelNegative } = preferences.level[datumID];
|
|
114
|
-
const index =
|
|
111
|
+
const index = draft.data.findIndex((datum) => datum.id === datumID);
|
|
115
112
|
const processController = draft.data[index]
|
|
116
113
|
.processingController;
|
|
117
114
|
processController.setLevel(levelPositive, levelNegative);
|
|
@@ -237,7 +237,7 @@ function handleChangeRangeSum(draft, options) {
|
|
|
237
237
|
}
|
|
238
238
|
exports.handleChangeRangeSum = handleChangeRangeSum;
|
|
239
239
|
function handleAddRange(draft, action) {
|
|
240
|
-
const { startX, endX } = action;
|
|
240
|
+
const { startX, endX } = action.payload;
|
|
241
241
|
const { activeSpectrum, activeTab: nucleus, molecules } = draft;
|
|
242
242
|
const range = (0, getRange_1.default)(draft, { startX, endX });
|
|
243
243
|
if (activeSpectrum?.id) {
|
|
@@ -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.resetSpectraScale = exports.setSpectraSameTopHandler = exports.setTab = exports.setActiveTab = exports.levelChangeHandler = exports.handelSetActiveTab = exports.zoomOut = exports.handleZoom = exports.setVerticalIndicatorXPosition = exports.handleBrushEnd = exports.handleToggleRealImaginaryVisibility = exports.handleDeleteBaseLineZone = exports.handleAddBaseLineZone = exports.handleChangeSpectrumDisplayMode = exports.setSpectrumsVerticalAlign = exports.setSelectedOptionPanel = exports.setSelectedTool = exports.resetSelectedTool = void 0;
|
|
26
26
|
const d3_1 = require("d3");
|
|
27
27
|
const immer_1 = require("immer");
|
|
28
28
|
const ml_spectra_processing_1 = require("ml-spectra-processing");
|
|
@@ -213,7 +213,7 @@ function handleBrushEnd(draft, action) {
|
|
|
213
213
|
break;
|
|
214
214
|
}
|
|
215
215
|
if (brushHistory) {
|
|
216
|
-
brushHistory.push({ xDomain:
|
|
216
|
+
brushHistory.push({ xDomain: draft.xDomain, yDomain: draft.yDomain });
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
else {
|
|
@@ -278,6 +278,7 @@ function zoomOut(draft, action) {
|
|
|
278
278
|
switch (zoomType) {
|
|
279
279
|
case Zoom_1.ZoomType.HORIZONTAL: {
|
|
280
280
|
draft.xDomain = draft.originDomain.xDomain;
|
|
281
|
+
zoomHistory.clear();
|
|
281
282
|
break;
|
|
282
283
|
}
|
|
283
284
|
case Zoom_1.ZoomType.VERTICAL:
|
|
@@ -300,34 +301,16 @@ function zoomOut(draft, action) {
|
|
|
300
301
|
}
|
|
301
302
|
else {
|
|
302
303
|
const { xDomain, yDomain, yDomains } = draft.originDomain;
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
const activeSpectrum = draft.tabActiveSpectrum[draft.activeTab.split(',')[1]];
|
|
314
|
-
draft.yDomain = yDomain;
|
|
315
|
-
if (activeSpectrum?.id) {
|
|
316
|
-
draft.yDomains[activeSpectrum.id] = yDomains[activeSpectrum.id];
|
|
317
|
-
}
|
|
318
|
-
break;
|
|
319
|
-
}
|
|
320
|
-
case DimensionLayout_1.LAYOUT.CENTER_2D: {
|
|
321
|
-
const zoomValue = zoomHistory.pop();
|
|
322
|
-
draft.xDomain = zoomValue ? zoomValue.xDomain : xDomain;
|
|
323
|
-
draft.yDomain = zoomValue ? zoomValue.yDomain : yDomain;
|
|
324
|
-
break;
|
|
325
|
-
}
|
|
326
|
-
default:
|
|
327
|
-
draft.xDomain = xDomain;
|
|
328
|
-
draft.yDomain = yDomain;
|
|
329
|
-
draft.yDomains = yDomains;
|
|
330
|
-
break;
|
|
304
|
+
if ([DimensionLayout_1.LAYOUT.TOP_1D, DimensionLayout_1.LAYOUT.LEFT_1D, DimensionLayout_1.LAYOUT.CENTER_2D].includes(trackID)) {
|
|
305
|
+
const zoomValue = zoomHistory.pop();
|
|
306
|
+
draft.xDomain = zoomValue ? zoomValue.xDomain : xDomain;
|
|
307
|
+
draft.yDomain = zoomValue ? zoomValue.yDomain : yDomain;
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
zoomHistory.clear();
|
|
311
|
+
draft.xDomain = xDomain;
|
|
312
|
+
draft.yDomain = yDomain;
|
|
313
|
+
draft.yDomains = yDomains;
|
|
331
314
|
}
|
|
332
315
|
}
|
|
333
316
|
}
|
|
@@ -493,34 +476,3 @@ function resetSpectraScale(draft) {
|
|
|
493
476
|
(0, Zoom_1.setZoom)(draft, { scale: 0.8 });
|
|
494
477
|
}
|
|
495
478
|
exports.resetSpectraScale = resetSpectraScale;
|
|
496
|
-
function handleAddExclusionZone(draft, action) {
|
|
497
|
-
const { from, to } = action.payload;
|
|
498
|
-
const scaleX = (0, scale_1.getXScale)(draft);
|
|
499
|
-
const start = scaleX.invert(from);
|
|
500
|
-
const end = scaleX.invert(to);
|
|
501
|
-
let zone = [];
|
|
502
|
-
if (start > end) {
|
|
503
|
-
zone = [end, start];
|
|
504
|
-
}
|
|
505
|
-
else {
|
|
506
|
-
zone = [start, end];
|
|
507
|
-
}
|
|
508
|
-
const newExclusionZone = {
|
|
509
|
-
id: (0, generateID_1.default)(),
|
|
510
|
-
from: zone[0],
|
|
511
|
-
to: zone[1],
|
|
512
|
-
};
|
|
513
|
-
if (draft.toolOptions.data.exclusionZones[draft.activeTab]) {
|
|
514
|
-
draft.toolOptions.data.exclusionZones[draft.activeTab].push(newExclusionZone);
|
|
515
|
-
}
|
|
516
|
-
else {
|
|
517
|
-
draft.toolOptions.data.exclusionZones[draft.activeTab] = [newExclusionZone];
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
exports.handleAddExclusionZone = handleAddExclusionZone;
|
|
521
|
-
function handleDeleteExclusionZone(draft, action) {
|
|
522
|
-
const id = action.payload.id;
|
|
523
|
-
const index = draft.toolOptions.data.exclusionZones[draft.activeTab].findIndex((zone) => zone.id === id);
|
|
524
|
-
draft.toolOptions.data.exclusionZones[draft.activeTab].splice(index, 1);
|
|
525
|
-
}
|
|
526
|
-
exports.handleDeleteExclusionZone = handleDeleteExclusionZone;
|
|
@@ -7,7 +7,8 @@ function zoomHistoryManager(zoomHistory, nucleus) {
|
|
|
7
7
|
const push = preparePush(zoomHistory[nucleus]);
|
|
8
8
|
const pop = preparePop(zoomHistory[nucleus]);
|
|
9
9
|
const getLast = prepareGetLast(zoomHistory[nucleus]);
|
|
10
|
-
|
|
10
|
+
const clear = () => (zoomHistory[nucleus] = []);
|
|
11
|
+
return { historyStack: zoomHistory[nucleus], push, pop, getLast, clear };
|
|
11
12
|
}
|
|
12
13
|
exports.default = zoomHistoryManager;
|
|
13
14
|
function preparePush(historyStack) {
|
|
@@ -7,27 +7,25 @@ exports.preferencesInitialState = exports.SET_PANELS_PREFERENCES = exports.SET_P
|
|
|
7
7
|
const immer_1 = require("immer");
|
|
8
8
|
const merge_1 = __importDefault(require("lodash/merge"));
|
|
9
9
|
const NMRium_1 = require("../NMRium");
|
|
10
|
-
const basic_1 = __importDefault(require("../nmriumMode/basic"));
|
|
11
|
-
const exercise1D_1 = __importDefault(require("../nmriumMode/exercise1D"));
|
|
12
|
-
const process1D_1 = __importDefault(require("../nmriumMode/process1D"));
|
|
13
10
|
const LocalStorage_1 = require("../utility/LocalStorage");
|
|
11
|
+
const workspaces_1 = __importDefault(require("../workspaces"));
|
|
14
12
|
exports.INIT_PREFERENCES = 'INIT_PREFERENCES';
|
|
15
13
|
exports.SET_PREFERENCES = 'SET_PREFERENCES';
|
|
16
14
|
exports.SET_PANELS_PREFERENCES = 'SET_PANELS_PREFERENCES';
|
|
17
|
-
const
|
|
18
|
-
function
|
|
19
|
-
switch (
|
|
20
|
-
case NMRium_1.
|
|
21
|
-
return
|
|
22
|
-
case NMRium_1.
|
|
23
|
-
return
|
|
15
|
+
const LOCAL_STORAGE_VERSION = 3;
|
|
16
|
+
function getPreferencesByWorkspace(workspace) {
|
|
17
|
+
switch (workspace) {
|
|
18
|
+
case NMRium_1.NMRiumWorkspaces.EXERCISE_1D:
|
|
19
|
+
return workspaces_1.default.exercise1D;
|
|
20
|
+
case NMRium_1.NMRiumWorkspaces.PROCESS_1D:
|
|
21
|
+
return workspaces_1.default.process1D;
|
|
24
22
|
default:
|
|
25
|
-
return
|
|
23
|
+
return workspaces_1.default.basic;
|
|
26
24
|
}
|
|
27
25
|
}
|
|
28
26
|
exports.preferencesInitialState = {
|
|
29
27
|
basePreferences: {},
|
|
30
|
-
display:
|
|
28
|
+
display: workspaces_1.default.basic.display,
|
|
31
29
|
controllers: {
|
|
32
30
|
mws: { low: 2, high: 20 },
|
|
33
31
|
dimmedSpectraTransparency: 0.1,
|
|
@@ -45,7 +43,15 @@ exports.preferencesInitialState = {
|
|
|
45
43
|
panels: {},
|
|
46
44
|
},
|
|
47
45
|
dispatch: null,
|
|
46
|
+
workspace: 'default',
|
|
48
47
|
};
|
|
48
|
+
function getTruthyObjectValues(data) {
|
|
49
|
+
return JSON.parse(JSON.stringify(data), (key, value) => {
|
|
50
|
+
if (value) {
|
|
51
|
+
return value;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
49
55
|
function mapNucleus(draft) {
|
|
50
56
|
if (draft.formatting.nucleus && Array.isArray(draft.formatting.nucleus)) {
|
|
51
57
|
draft.formatting.nucleusByKey = draft.formatting.nucleus.reduce((acc, item) => {
|
|
@@ -56,48 +62,82 @@ function mapNucleus(draft) {
|
|
|
56
62
|
}
|
|
57
63
|
function handleInit(draft, action) {
|
|
58
64
|
const nmrLocalStorageVersion = (0, LocalStorage_1.getLocalStorage)('nmr-local-storage-version', false);
|
|
59
|
-
|
|
60
|
-
|
|
65
|
+
let localData = (0, LocalStorage_1.getLocalStorage)('nmr-general-settings');
|
|
66
|
+
// remove old nmr-local-storage-version key
|
|
67
|
+
if (nmrLocalStorageVersion && localData?.version) {
|
|
68
|
+
(0, LocalStorage_1.removeData)('nmr-local-storage-version');
|
|
69
|
+
}
|
|
70
|
+
if (!localData?.version || localData?.version !== LOCAL_STORAGE_VERSION) {
|
|
61
71
|
(0, LocalStorage_1.removeData)('nmr-general-settings');
|
|
62
|
-
(0, LocalStorage_1.storeData)('nmr-local-storage-version', LOCAL_STORGAE_VERSION);
|
|
63
72
|
}
|
|
64
|
-
const localData = (0, LocalStorage_1.getLocalStorage)('nmr-general-settings');
|
|
65
73
|
if (action.payload) {
|
|
66
|
-
const { dispatch,
|
|
67
|
-
draft.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
const { dispatch, workspace, ...resProps } = action.payload;
|
|
75
|
+
draft.workspace = workspace;
|
|
76
|
+
const workspacePreferences = getPreferencesByWorkspace(workspace);
|
|
77
|
+
if (!localData ||
|
|
78
|
+
!localData?.workspaces[workspace] ||
|
|
79
|
+
workspacePreferences.version !== localData?.workspaces[workspace]?.version) {
|
|
80
|
+
localData = localData || {};
|
|
81
|
+
localData = {
|
|
82
|
+
version: LOCAL_STORAGE_VERSION,
|
|
83
|
+
workspaces: {
|
|
84
|
+
...localData.workspaces,
|
|
85
|
+
[workspace]: {
|
|
86
|
+
...workspacePreferences,
|
|
87
|
+
controllers: draft.controllers,
|
|
88
|
+
formatting: draft.formatting,
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
(0, LocalStorage_1.storeData)('nmr-general-settings', JSON.stringify(localData));
|
|
93
|
+
}
|
|
94
|
+
draft.basePreferences = (0, merge_1.default)({}, workspacePreferences, resProps);
|
|
95
|
+
const hiddenModeFeatures = getTruthyObjectValues(draft.basePreferences.display);
|
|
96
|
+
let hiddenLocalStorageFeatures = {};
|
|
76
97
|
draft.dispatch = dispatch;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
98
|
+
const localStorageModePreferences = localData?.workspaces[workspace] || null;
|
|
99
|
+
if (localStorageModePreferences) {
|
|
100
|
+
Object.entries(localStorageModePreferences).forEach(([k, v]) => {
|
|
101
|
+
if (k === 'display') {
|
|
102
|
+
hiddenLocalStorageFeatures = getTruthyObjectValues(v);
|
|
103
|
+
}
|
|
104
|
+
else if (!['dispatch', 'basePreferences'].includes(k)) {
|
|
80
105
|
draft[k] = (0, merge_1.default)({}, resProps[k] ? resProps[k] : {}, v);
|
|
81
106
|
}
|
|
82
107
|
});
|
|
83
108
|
mapNucleus(draft);
|
|
84
109
|
}
|
|
110
|
+
draft.display = (0, merge_1.default)({}, getPreferencesByWorkspace(NMRium_1.NMRiumWorkspaces.DEFAULT).display, hiddenModeFeatures, hiddenLocalStorageFeatures);
|
|
85
111
|
}
|
|
86
112
|
}
|
|
87
113
|
function handleSetPreferences(draft, action) {
|
|
88
114
|
if (action.payload) {
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
115
|
+
const { controllers, formatting, display } = action.payload;
|
|
116
|
+
let localData = (0, LocalStorage_1.getLocalStorage)('nmr-general-settings');
|
|
117
|
+
localData.workspaces = {
|
|
118
|
+
...localData.workspaces,
|
|
119
|
+
[draft.workspace]: {
|
|
120
|
+
...localData.workspaces[draft.workspace],
|
|
121
|
+
controllers,
|
|
122
|
+
formatting,
|
|
123
|
+
display,
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
(0, LocalStorage_1.storeData)('nmr-general-settings', JSON.stringify(localData));
|
|
127
|
+
draft.controllers = controllers;
|
|
128
|
+
draft.formatting = formatting;
|
|
129
|
+
draft.display.panels = display.panels;
|
|
130
|
+
draft.display.general.hideExperimentalFeatures =
|
|
131
|
+
display.general.hideExperimentalFeatures;
|
|
95
132
|
mapNucleus(draft);
|
|
96
133
|
}
|
|
97
134
|
}
|
|
98
135
|
function handleSetPanelsPreferences(draft, action) {
|
|
99
136
|
if (action.payload) {
|
|
100
137
|
const { key, value } = action.payload;
|
|
138
|
+
let localData = (0, LocalStorage_1.getLocalStorage)('nmr-general-settings');
|
|
139
|
+
localData.workspaces[draft.workspace].formatting.panels[key] = value;
|
|
140
|
+
(0, LocalStorage_1.storeData)('nmr-general-settings', JSON.stringify(localData));
|
|
101
141
|
draft.formatting.panels[key] = value;
|
|
102
142
|
}
|
|
103
143
|
}
|
|
@@ -25,15 +25,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
25
25
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
26
26
|
const analysis_ui_components_1 = require("analysis-ui-components");
|
|
27
27
|
const cheminfo_font_1 = require("cheminfo-font");
|
|
28
|
-
const get_1 = __importDefault(require("lodash/get"));
|
|
29
28
|
const react_1 = require("react");
|
|
30
29
|
const fa_1 = require("react-icons/fa");
|
|
31
30
|
const Filters = __importStar(require("../../data/Filters"));
|
|
32
31
|
const ChartContext_1 = require("../context/ChartContext");
|
|
33
32
|
const DispatchContext_1 = require("../context/DispatchContext");
|
|
34
|
-
const PreferencesContext_1 = require("../context/PreferencesContext");
|
|
35
33
|
const ToggleButton_1 = __importDefault(require("../elements/toggle/ToggleButton"));
|
|
36
34
|
const ToggleButtonGroup_1 = __importDefault(require("../elements/toggle/ToggleButtonGroup"));
|
|
35
|
+
const useCheckToolsVisibility_1 = require("../hooks/useCheckToolsVisibility");
|
|
37
36
|
const useDatumWithSpectraStatistics_1 = __importDefault(require("../hooks/useDatumWithSpectraStatistics"));
|
|
38
37
|
const useToolsFunctions_1 = __importDefault(require("../hooks/useToolsFunctions"));
|
|
39
38
|
const Constants_1 = require("../reducer/core/Constants");
|
|
@@ -41,7 +40,7 @@ const Types_1 = require("../reducer/types/Types");
|
|
|
41
40
|
const ToolTypes_1 = require("./ToolTypes");
|
|
42
41
|
function FunctionToolBarInner({ defaultValue, activeSpectrum, info, datum, displayerMode, ftCounter, mode, }) {
|
|
43
42
|
const [option, setOption] = (0, react_1.useState)('');
|
|
44
|
-
const
|
|
43
|
+
const isButtonVisible = (0, useCheckToolsVisibility_1.useCheckToolsVisibility)();
|
|
45
44
|
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
46
45
|
const { handleChangeOption, handleFullZoomOut } = (0, useToolsFunctions_1.default)();
|
|
47
46
|
const handleChange = (0, react_1.useCallback)((selectedOption) => {
|
|
@@ -58,35 +57,30 @@ function FunctionToolBarInner({ defaultValue, activeSpectrum, info, datum, displ
|
|
|
58
57
|
});
|
|
59
58
|
dispatch({ type: Types_1.SET_SELECTED_FILTER, selectedFilter: null });
|
|
60
59
|
}, [dispatch]);
|
|
61
|
-
const isButtonVisible = (0, react_1.useCallback)((toolKey) => {
|
|
62
|
-
return !(0, get_1.default)(preferences, `display.toolBarButtons.${toolKey}`);
|
|
63
|
-
}, [preferences]);
|
|
64
|
-
const isPanelVisible = (0, react_1.useCallback)((panelKey) => {
|
|
65
|
-
return !(0, get_1.default)(preferences, `display.panels.${panelKey}`);
|
|
66
|
-
}, [preferences]);
|
|
67
60
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(ToggleButtonGroup_1.default, { value: option, onChange: handleChange, children: [isButtonVisible('hideZoomTool') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.zoom.id, id: "zoomIn", title: `${ToolTypes_1.options.zoom.label} ( Press z )`, children: (0, jsx_runtime_1.jsx)("div", { style: { fontSize: 14 }, children: (0, jsx_runtime_1.jsx)(fa_1.FaSearchPlus, {}, void 0) }, void 0) }, ToolTypes_1.options.zoom.id)), isButtonVisible('hideZoomOutTool') && ((0, jsx_runtime_1.jsx)(analysis_ui_components_1.Toolbar.Item, { id: "zoom-out", onClick: handleFullZoomOut, title: "Horizontal zoom out ( Press f ), Horizontal and Vertical zoom out, double click ( Press ff )", children: (0, jsx_runtime_1.jsx)("div", { style: { fontSize: 14 }, children: (0, jsx_runtime_1.jsx)(fa_1.FaExpand, {}, void 0) }, void 0) }, void 0)), displayerMode === Constants_1.DISPLAYER_MODE.DM_1D &&
|
|
68
61
|
isButtonVisible('hidePeakTool') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.peakPicking.id, title: `${ToolTypes_1.options.peakPicking.label} ( Press p )`, isVisible: activeSpectrum && !info?.isFid ? true : false, id: "peakPicking", children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrPeakPicking, {}, void 0) }, ToolTypes_1.options.peakPicking.id)), displayerMode === Constants_1.DISPLAYER_MODE.DM_1D &&
|
|
69
62
|
isButtonVisible('hideIntegralTool') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.integral.id, isVisible: activeSpectrum && !info?.isFid ? true : false, id: "integralPicking", title: `${ToolTypes_1.options.integral.label} ( Press i )`, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrIntegrate, {}, void 0) }, ToolTypes_1.options.integral.id)), displayerMode === Constants_1.DISPLAYER_MODE.DM_2D &&
|
|
70
|
-
isButtonVisible('
|
|
71
|
-
isButtonVisible('
|
|
63
|
+
isButtonVisible('hideZonePickingTool') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.zone2D.id, id: "zone2d", isVisible: activeSpectrum && !info?.isFid ? true : false, title: `${ToolTypes_1.options.zone2D.label} ( Press r )`, children: (0, jsx_runtime_1.jsx)(fa_1.FaDiceFour, {}, void 0) }, ToolTypes_1.options.zone2D.id)), displayerMode === Constants_1.DISPLAYER_MODE.DM_2D &&
|
|
64
|
+
isButtonVisible('hideSlicingTool') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.slicingTool.id, isVisible: activeSpectrum && !info?.isFid ? true : false, id: "slic", title: `${ToolTypes_1.options.slicingTool.label}`, children: (0, jsx_runtime_1.jsx)("p", { children: "Slic" }, void 0) }, ToolTypes_1.options.slicingTool.id)), displayerMode === Constants_1.DISPLAYER_MODE.DM_1D &&
|
|
65
|
+
isButtonVisible('hideAutoRangesTool') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.rangesPicking.id, isVisible: activeSpectrum && !info?.isFid ? true : false, title: `${ToolTypes_1.options.rangesPicking.label} ( Press r )`, id: "ranges-pick", children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrRangePicking, {}, void 0) }, ToolTypes_1.options.rangesPicking.id)), displayerMode === Constants_1.DISPLAYER_MODE.DM_1D &&
|
|
72
66
|
isButtonVisible('hideMultipleSpectraAnalysisTool') &&
|
|
73
67
|
ftCounter > 1 &&
|
|
74
68
|
mode === 'RTL' && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.multipleSpectraAnalysis.id, id: "multipleSpectraAnalysis", title: ToolTypes_1.options.multipleSpectraAnalysis.label, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrMultipleAnalysis, {}, void 0) }, ToolTypes_1.options.multipleSpectraAnalysis.id)), displayerMode === Constants_1.DISPLAYER_MODE.DM_1D &&
|
|
75
69
|
isButtonVisible('hideZeroFillingTool') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.zeroFilling.id, isVisible: Filters.zeroFilling.isApplicable({ info }), id: "zeroFilling", title: ToolTypes_1.options.zeroFilling.label, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrZeroFilling, {}, void 0) }, ToolTypes_1.options.zeroFilling.id)), displayerMode === Constants_1.DISPLAYER_MODE.DM_1D &&
|
|
76
|
-
isButtonVisible('hidePhaseCorrectionTool') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.phaseCorrection.id, id: "phaseCorrection", title: ToolTypes_1.options.phaseCorrection.label
|
|
70
|
+
isButtonVisible('hidePhaseCorrectionTool') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.phaseCorrection.id, id: "phaseCorrection", title: `${ToolTypes_1.options.phaseCorrection.label} ( Press a )`, isVisible: activeSpectrum &&
|
|
77
71
|
info &&
|
|
78
72
|
Filters.phaseCorrection.isApplicable({ info }) &&
|
|
79
73
|
datum.im
|
|
80
74
|
? true
|
|
81
75
|
: false, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrPhaseCorrection, {}, void 0) }, ToolTypes_1.options.phaseCorrection.id)), displayerMode === Constants_1.DISPLAYER_MODE.DM_1D &&
|
|
82
|
-
isButtonVisible('hideBaseLineCorrectionTool') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.baseLineCorrection.id, id: "baseLineCorrection", title: ToolTypes_1.options.baseLineCorrection.label
|
|
76
|
+
isButtonVisible('hideBaseLineCorrectionTool') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.baseLineCorrection.id, id: "baseLineCorrection", title: `${ToolTypes_1.options.baseLineCorrection.label} ( Press b )`, isVisible: activeSpectrum &&
|
|
83
77
|
info &&
|
|
84
78
|
Filters.baselineCorrection.isApplicable({ info })
|
|
85
79
|
? true
|
|
86
80
|
: false, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrBaselineCorrection, {}, void 0) }, ToolTypes_1.options.baseLineCorrection.id)), displayerMode === Constants_1.DISPLAYER_MODE.DM_1D &&
|
|
87
81
|
isButtonVisible('hideExclusionZonesTool') &&
|
|
88
|
-
|
|
89
|
-
|
|
82
|
+
!info?.isFid &&
|
|
83
|
+
ftCounter > 0 && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.exclusionZones.id, title: `${ToolTypes_1.options.exclusionZones.label} ( Press e )`, id: "exclusionZones", children: (0, jsx_runtime_1.jsx)("div", { style: { fontSize: 18 }, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrMultipleAnalysis, {}, void 0) }, void 0) }, ToolTypes_1.options.exclusionZones.id))] }, void 0), displayerMode === Constants_1.DISPLAYER_MODE.DM_1D &&
|
|
90
84
|
isButtonVisible('hideFFTTool') &&
|
|
91
85
|
info &&
|
|
92
86
|
Filters.fft.isApplicable({ info }) && ((0, jsx_runtime_1.jsx)(analysis_ui_components_1.Toolbar.Item, { id: "fft-filter", className: "cheminfo", title: "FFT Filter", onClick: handleOnFFTFilter, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrFourierTransform, {}, void 0) }, void 0))] }, void 0));
|