nmrium 0.54.0 → 0.56.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 -1
- package/lib/component/1d/Viewer1D.js +36 -11
- package/lib/component/1d/XAxis.js +1 -1
- package/lib/component/1d/integral/IntegralsSeries.js +2 -2
- package/lib/component/1d/integral/Integration.d.ts +3 -1
- package/lib/component/1d/integral/Integration.js +3 -2
- package/lib/component/1d/matrix/Boxplot.d.ts +6 -0
- package/lib/component/1d/matrix/Boxplot.js +97 -0
- package/lib/component/1d/matrix/Stocsy.d.ts +5 -0
- package/lib/component/1d/matrix/Stocsy.js +101 -0
- package/lib/component/1d/matrix/useMatrix.d.ts +29 -0
- package/lib/component/1d/matrix/useMatrix.js +93 -0
- package/lib/component/1d/peaks/PeakEditionManager.js +5 -3
- package/lib/component/1d/ranges/AssignmentActionsButtons.d.ts +1 -0
- package/lib/component/1d/ranges/AssignmentActionsButtons.js +3 -3
- package/lib/component/1d/ranges/AssignmentLabel.d.ts +1 -1
- package/lib/component/1d/ranges/AssignmentLabel.js +31 -4
- package/lib/component/1d/ranges/Atoms.js +4 -5
- package/lib/component/1d/ranges/Range.js +48 -6
- package/lib/component/1d/ranges/Ranges.js +2 -1
- package/lib/component/1d/ranges/RangesIntegrals.js +11 -4
- package/lib/component/1d/utilities/scale.d.ts +2 -1
- package/lib/component/1d/utilities/scale.js +6 -1
- package/lib/component/1d-2d/FieldEdition.d.ts +13 -0
- package/lib/component/1d-2d/FieldEdition.js +42 -0
- package/lib/component/2d/Chart2D.js +5 -3
- package/lib/component/2d/zones/Zone.js +18 -2
- package/lib/component/2d/zones/ZonesAssignmentsLabels.d.ts +7 -0
- package/lib/component/2d/zones/ZonesAssignmentsLabels.js +286 -0
- package/lib/component/EventsTrackers/KeysListenerTracker.js +14 -1
- package/lib/component/context/PrepareExportContext.d.ts +21 -0
- package/lib/component/context/PrepareExportContext.js +124 -0
- package/lib/component/context/ShareDataContext.d.ts +10 -0
- package/lib/component/context/ShareDataContext.js +22 -0
- package/lib/component/elements/ActionsButtonsPopover.d.ts +10 -0
- package/lib/component/elements/ActionsButtonsPopover.js +22 -0
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +7 -5
- package/lib/component/elements/ReactTable/ReactTable.d.ts +2 -2
- package/lib/component/elements/SVGButton.d.ts +14 -0
- package/lib/component/elements/SVGButton.js +6 -0
- package/lib/component/elements/SVGGroup.js +15 -13
- package/lib/component/elements/SVGText.d.ts +8 -0
- package/lib/component/elements/SVGText.js +24 -0
- package/lib/component/elements/draggable/SVGDraggable.d.ts +2 -2
- package/lib/component/elements/formik/FormikInput.d.ts +2 -1
- package/lib/component/elements/formik/FormikInput.js +4 -3
- package/lib/component/header/Header.js +7 -10
- package/lib/component/hooks/useActiveSpectrumZonesViewState.js +1 -0
- package/lib/component/hooks/useCheckPointsNumberInWindowArea.d.ts +1 -1
- package/lib/component/hooks/useExport.d.ts +1 -1
- package/lib/component/hooks/useExport.js +4 -4
- package/lib/component/hooks/useFormatNumberByNucleus.d.ts +1 -1
- package/lib/component/hooks/useFormatNumberByNucleus.js +8 -7
- package/lib/component/hooks/useIntegralPath.d.ts +2 -0
- package/lib/component/hooks/useIntegralPath.js +3 -1
- package/lib/component/hooks/usePanelPreferences.d.ts +2 -3
- package/lib/component/hooks/usePanelPreferences.js +4 -3
- package/lib/component/hooks/useSaveSettings.js +7 -14
- package/lib/component/hooks/useToggleSpectraVisibility.d.ts +10 -0
- package/lib/component/hooks/useToggleSpectraVisibility.js +41 -0
- package/lib/component/hooks/useTriggerNewAssignmentLabel.d.ts +4 -0
- package/lib/component/hooks/useTriggerNewAssignmentLabel.js +8 -0
- package/lib/component/hooks/useWorkspaceAction.d.ts +7 -0
- package/lib/component/hooks/useWorkspaceAction.js +89 -0
- package/lib/component/loader/DropZone.js +0 -3
- package/lib/component/main/InnerNMRium.js +3 -1
- package/lib/component/main/InnerNMRiumContents.js +14 -2
- package/lib/component/main/NMRiumStateProvider.js +4 -2
- package/lib/component/modal/editRange/forms/components/DeltaInput.js +3 -3
- package/lib/component/modal/editRange/forms/components/NewSignalTab.js +17 -12
- package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.js +30 -13
- package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.js +26 -16
- package/lib/component/modal/setting/GeneralSettings.js +7 -21
- package/lib/component/modal/setting/WorkspaceItem.js +1 -1
- package/lib/component/modal/setting/settings-tabs/NucleiTabContent.d.ts +2 -0
- package/lib/component/modal/setting/settings-tabs/NucleiTabContent.js +99 -0
- package/lib/component/modal/setting/settingsValidation.js +36 -40
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.d.ts +2 -2
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +121 -36
- package/lib/component/panels/Panels.js +1 -1
- package/lib/component/panels/SpectraPanel/SpectraPanelHeader.js +4 -27
- package/lib/component/panels/SpectraPanel/SpectraPreferences.js +13 -1
- package/lib/component/panels/SpectraPanel/base/setting/PlotChart.js +1 -1
- package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DHistogram.js +1 -1
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentLabelColumn.d.ts +6 -0
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentLabelColumn.js +16 -0
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +18 -2
- package/lib/component/panels/ZonesPanel/ZonesPreferences.js +15 -9
- package/lib/component/panels/ZonesPanel/ZonesTable.js +2 -2
- package/lib/component/panels/ZonesPanel/ZonesTableRow.js +3 -2
- package/lib/component/panels/databasePanel/DatabaseTable.js +2 -2
- package/lib/component/panels/multipleAnalysisPanel/preferences/index.js +1 -1
- package/lib/component/reducer/IgnoreActions.js +1 -0
- package/lib/component/reducer/Reducer.d.ts +6 -0
- package/lib/component/reducer/Reducer.js +6 -0
- package/lib/component/reducer/actions/DomainActions.d.ts +12 -4
- package/lib/component/reducer/actions/DomainActions.js +35 -5
- package/lib/component/reducer/actions/FiltersActions.js +2 -2
- package/lib/component/reducer/actions/LoadActions.js +5 -2
- package/lib/component/reducer/actions/RangesActions.js +12 -6
- package/lib/component/reducer/actions/SpectraActions.d.ts +1 -0
- package/lib/component/reducer/actions/SpectraActions.js +7 -2
- package/lib/component/reducer/actions/ZonesActions.d.ts +15 -2
- package/lib/component/reducer/actions/ZonesActions.js +47 -13
- package/lib/component/reducer/helper/setRangesViewProperty.d.ts +1 -0
- package/lib/component/reducer/helper/setRangesViewProperty.js +11 -11
- package/lib/component/reducer/preferences/actions/addWorkspace.js +4 -23
- package/lib/component/reducer/preferences/actions/analyzeSpectra.js +4 -4
- package/lib/component/reducer/preferences/actions/initPreferences.js +2 -4
- package/lib/component/reducer/preferences/actions/matrixGeneration.d.ts +47 -2
- package/lib/component/reducer/preferences/actions/matrixGeneration.js +63 -26
- package/lib/component/reducer/preferences/actions/removeWorkspace.js +0 -5
- package/lib/component/reducer/preferences/actions/setActiveWorkspace.js +0 -4
- package/lib/component/reducer/preferences/actions/setPanelsPreferences.js +1 -1
- package/lib/component/reducer/preferences/actions/setPreferences.js +2 -16
- package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.d.ts +5 -2
- package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +17 -1
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +9 -25
- package/lib/component/reducer/preferences/preferencesReducer.js +28 -19
- package/lib/component/toolbar/ToolBar.js +23 -20
- package/lib/component/utility/PathBuilder.d.ts +1 -0
- package/lib/component/utility/PathBuilder.js +8 -1
- package/lib/component/utility/PreferencesHelper.js +5 -4
- package/lib/component/utility/export.js +4 -0
- package/lib/component/workspaces/assignment.js +0 -1
- package/lib/component/workspaces/basic.js +0 -1
- package/lib/component/workspaces/embedded.js +0 -1
- package/lib/component/workspaces/exercise.js +26 -29
- package/lib/component/workspaces/prediction.js +171 -174
- package/lib/component/workspaces/process1D.js +0 -1
- package/lib/component/workspaces/simulation.js +35 -38
- package/lib/component/workspaces/workspaceDefaultProperties.js +9 -11
- package/lib/data/types/common/DeepPartial.d.ts +3 -0
- package/lib/data/types/common/DeepPartial.js +1 -0
- package/lib/versionInfo.js +1 -1
- package/package.json +39 -39
- package/lib/component/elements/CustomToolTip.d.ts +0 -8
- package/lib/component/elements/CustomToolTip.js +0 -107
- package/lib/component/modal/setting/settings-tabs/FormattingTabContent.d.ts +0 -2
- package/lib/component/modal/setting/settings-tabs/FormattingTabContent.js +0 -80
- package/lib/component/reducer/preferences/utilities/mapNucleiFormatting.d.ts +0 -2
- package/lib/component/reducer/preferences/utilities/mapNucleiFormatting.js +0 -10
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { defaultRangesViewState } from '../../hooks/useActiveSpectrumRangesViewState';
|
|
2
2
|
import { getActiveSpectrum } from './getActiveSpectrum';
|
|
3
3
|
export function setRangesViewProperty(draft, key, value) {
|
|
4
|
-
const
|
|
4
|
+
const rangesView = draft.view.ranges;
|
|
5
5
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
6
6
|
if (!activeSpectrum?.id)
|
|
7
7
|
return;
|
|
8
8
|
const id = activeSpectrum.id;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
initializeRangeViewObject(draft, id);
|
|
10
|
+
rangesView[id][key] =
|
|
11
|
+
typeof value === 'function' ? value(rangesView[id][key]) : value;
|
|
12
|
+
}
|
|
13
|
+
export function initializeRangeViewObject(draft, spectrumID) {
|
|
14
|
+
const rangesView = draft.view.ranges;
|
|
15
|
+
if (spectrumID in rangesView)
|
|
16
|
+
return;
|
|
17
|
+
const defaultRangesView = { ...defaultRangesViewState };
|
|
18
|
+
rangesView[spectrumID] = defaultRangesView;
|
|
19
19
|
}
|
|
@@ -1,27 +1,8 @@
|
|
|
1
|
-
import { v4 } from '@lukeed/uuid';
|
|
2
|
-
import lodashMerge from 'lodash/merge';
|
|
3
|
-
import { getLocalStorage, storeData } from '../../../utility/LocalStorage';
|
|
4
|
-
import { workspaceDefaultProperties } from '../../../workspaces/workspaceDefaultProperties';
|
|
5
1
|
export function addWorkspace(draft, action) {
|
|
6
2
|
const { workspaceKey, data } = action.payload;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (workSpaceData) {
|
|
12
|
-
const newWorkSpace = lodashMerge({}, workspaceDefaultProperties, workSpaceData, {
|
|
13
|
-
version: 1,
|
|
14
|
-
label: workspaceKey,
|
|
15
|
-
source: 'user',
|
|
16
|
-
});
|
|
17
|
-
const newWorkspaceKey = v4();
|
|
18
|
-
const localData = getLocalStorage('nmr-general-settings');
|
|
19
|
-
localData.currentWorkspace = newWorkspaceKey;
|
|
20
|
-
localData.workspaces[newWorkspaceKey] = newWorkSpace;
|
|
21
|
-
storeData('nmr-general-settings', JSON.stringify(localData));
|
|
22
|
-
draft.workspaces[newWorkspaceKey] = newWorkSpace;
|
|
23
|
-
draft.originalWorkspaces[newWorkspaceKey] =
|
|
24
|
-
newWorkSpace;
|
|
25
|
-
draft.workspace.current = newWorkspaceKey;
|
|
3
|
+
if (data) {
|
|
4
|
+
draft.workspaces[workspaceKey] = data;
|
|
5
|
+
draft.originalWorkspaces[workspaceKey] = data;
|
|
6
|
+
draft.workspace.current = workspaceKey;
|
|
26
7
|
}
|
|
27
8
|
}
|
|
@@ -4,7 +4,7 @@ import { getMultipleSpectraAnalysisDefaultValues } from '../panelsPreferencesDef
|
|
|
4
4
|
import { getActiveWorkspace } from '../utilities/getActiveWorkspace';
|
|
5
5
|
export function analyzeSpectra(draft, action) {
|
|
6
6
|
const currentWorkspacePreferences = getActiveWorkspace(draft);
|
|
7
|
-
const panels = currentWorkspacePreferences.
|
|
7
|
+
const panels = currentWorkspacePreferences.panels;
|
|
8
8
|
const { start, end, nucleus, columnKey } = action.payload;
|
|
9
9
|
if (!panels.multipleSpectraAnalysis) {
|
|
10
10
|
panels.multipleSpectraAnalysis =
|
|
@@ -21,20 +21,20 @@ export function analyzeSpectra(draft, action) {
|
|
|
21
21
|
export function changeAnalysisColumnValueKey(draft, action) {
|
|
22
22
|
const { columnKey, valueKey, nucleus } = action.payload;
|
|
23
23
|
const currentWorkspacePreferences = getActiveWorkspace(draft);
|
|
24
|
-
const panels = currentWorkspacePreferences.
|
|
24
|
+
const panels = currentWorkspacePreferences.panels;
|
|
25
25
|
MultipleAnalysis.changeColumnValueKey(panels.multipleSpectraAnalysis, nucleus, columnKey, valueKey);
|
|
26
26
|
}
|
|
27
27
|
export function deleteAnalysisColumn(draft, action) {
|
|
28
28
|
const { columnKey, nucleus } = action.payload;
|
|
29
29
|
const currentWorkspacePreferences = getActiveWorkspace(draft);
|
|
30
|
-
const panels = currentWorkspacePreferences.
|
|
30
|
+
const panels = currentWorkspacePreferences.panels;
|
|
31
31
|
MultipleAnalysis.deleteSpectraAnalysis(panels.multipleSpectraAnalysis, columnKey, nucleus);
|
|
32
32
|
}
|
|
33
33
|
export function setSpectraAnalysisPanelsPreferences(draft, action) {
|
|
34
34
|
if (action.payload) {
|
|
35
35
|
const currentWorkspacePreferences = getActiveWorkspace(draft);
|
|
36
36
|
const { nucleus, data } = action.payload;
|
|
37
|
-
const panels = currentWorkspacePreferences.
|
|
37
|
+
const panels = currentWorkspacePreferences.panels;
|
|
38
38
|
if (!panels?.multipleSpectraAnalysis) {
|
|
39
39
|
panels.multipleSpectraAnalysis =
|
|
40
40
|
getMultipleSpectraAnalysisDefaultValues(nucleus);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { getLocalStorage } from '../../../utility/LocalStorage';
|
|
2
1
|
import { WORKSPACES_KEYS } from '../preferencesReducer';
|
|
3
2
|
import { initWorkspace } from '../utilities/initWorkspace';
|
|
4
3
|
import { mapWorkspaces } from '../utilities/mapWorkspaces';
|
|
@@ -7,8 +6,7 @@ function getWorkspace(draft, workspace) {
|
|
|
7
6
|
}
|
|
8
7
|
export function initPreferences(draft, action) {
|
|
9
8
|
if (action.payload) {
|
|
10
|
-
const
|
|
11
|
-
const { dispatch, workspace, customWorkspaces: cw, preferences, } = action.payload;
|
|
9
|
+
const { dispatch, workspace, customWorkspaces: cw, preferences, currentWorkspace, } = action.payload;
|
|
12
10
|
const customWorkspaces = mapWorkspaces(cw, { source: 'custom' });
|
|
13
11
|
draft.workspaces = {
|
|
14
12
|
...draft.workspaces,
|
|
@@ -39,7 +37,7 @@ export function initPreferences(draft, action) {
|
|
|
39
37
|
};
|
|
40
38
|
}
|
|
41
39
|
else {
|
|
42
|
-
const _workspace = getWorkspace(draft,
|
|
40
|
+
const _workspace = getWorkspace(draft, currentWorkspace);
|
|
43
41
|
draft.workspace = { current: _workspace, base: null };
|
|
44
42
|
}
|
|
45
43
|
if (preferences) {
|
|
@@ -1,6 +1,51 @@
|
|
|
1
1
|
import { Draft } from 'immer';
|
|
2
|
-
import {
|
|
2
|
+
import { MatrixGenerationOptions } from 'nmr-load-save';
|
|
3
|
+
import { MatrixOptions } from '../../../../data/types/data1d/MatrixOptions';
|
|
4
|
+
import { ZoomOptions } from '../../../EventsTrackers/BrushTracker';
|
|
5
|
+
import { FilterType } from '../../../utility/filterType';
|
|
6
|
+
import { ActionType } from '../../types/ActionType';
|
|
7
|
+
import { PreferencesState } from '../preferencesReducer';
|
|
8
|
+
type setMatrixGenerationOptionsAction = ActionType<'SET_MATRIX_GENERATION_OPTIONS', {
|
|
9
|
+
nucleus: string;
|
|
10
|
+
options: MatrixOptions;
|
|
11
|
+
}>;
|
|
12
|
+
type addMatrixGenerationExclusionZoneAction = ActionType<'ADD_MATRIX_GENERATION_EXCLUSION_ZONE', {
|
|
13
|
+
zone: {
|
|
14
|
+
from: number;
|
|
15
|
+
to: number;
|
|
16
|
+
};
|
|
17
|
+
range: {
|
|
18
|
+
from: number;
|
|
19
|
+
to: number;
|
|
20
|
+
};
|
|
21
|
+
nucleus: string;
|
|
22
|
+
}>;
|
|
23
|
+
type deleteMatrixGenerationExclusionZoneAction = ActionType<'DELETE_MATRIX_GENERATION_EXCLUSION_ZONE', {
|
|
24
|
+
zone: {
|
|
25
|
+
id: string;
|
|
26
|
+
from: number;
|
|
27
|
+
to: number;
|
|
28
|
+
};
|
|
29
|
+
nucleus: string;
|
|
30
|
+
}>;
|
|
31
|
+
type ToggleMatrixGenerationViewAction = ActionType<'TOGGLE_MATRIX_GENERATION_VIEW_PROPERTY', {
|
|
32
|
+
key: keyof FilterType<MatrixGenerationOptions, boolean>;
|
|
33
|
+
nucleus: string;
|
|
34
|
+
}>;
|
|
35
|
+
type ChangeMatrixGenerationScaleAction = ActionType<'CHANGE_MATRIX_GENERATION_SCALE', {
|
|
36
|
+
zoomOptions: ZoomOptions;
|
|
37
|
+
nucleus: string;
|
|
38
|
+
}>;
|
|
39
|
+
type ChangeMatrixGenerationStocsyChemicalShiftAction = ActionType<'CHANGE_MATRIX_GENERATION_STOCSY_CHEMICAL_SHIFT', {
|
|
40
|
+
nucleus: string;
|
|
41
|
+
chemicalShift: number;
|
|
42
|
+
}>;
|
|
43
|
+
export type MatrixGenerationActions = ToggleMatrixGenerationViewAction | deleteMatrixGenerationExclusionZoneAction | addMatrixGenerationExclusionZoneAction | setMatrixGenerationOptionsAction | ChangeMatrixGenerationScaleAction | ChangeMatrixGenerationStocsyChemicalShiftAction;
|
|
3
44
|
declare function addExclusionZone(draft: Draft<PreferencesState>, action: addMatrixGenerationExclusionZoneAction): void;
|
|
4
45
|
declare function deleteExclusionZone(draft: Draft<PreferencesState>, action: any): void;
|
|
5
46
|
declare function setMatrixGenerationOptions(draft: Draft<PreferencesState>, action: any): void;
|
|
6
|
-
|
|
47
|
+
declare function toggleMatrixGenerationViewProperty(draft: Draft<PreferencesState>, action: ToggleMatrixGenerationViewAction): void;
|
|
48
|
+
declare function resetDefaultViewMatrixGenerationOptions(draft: Draft<PreferencesState>, action: ToggleMatrixGenerationViewAction): void;
|
|
49
|
+
declare function changeMatrixGenerationScale(draft: Draft<PreferencesState>, action: ChangeMatrixGenerationScaleAction): void;
|
|
50
|
+
declare function changeMatrixGenerationStocsyChemicalShift(draft: Draft<PreferencesState>, action: ChangeMatrixGenerationStocsyChemicalShiftAction): null | undefined;
|
|
51
|
+
export { addExclusionZone, deleteExclusionZone, setMatrixGenerationOptions, toggleMatrixGenerationViewProperty, changeMatrixGenerationScale, changeMatrixGenerationStocsyChemicalShift, resetDefaultViewMatrixGenerationOptions, };
|
|
@@ -1,42 +1,79 @@
|
|
|
1
1
|
import { v4 } from '@lukeed/uuid';
|
|
2
|
+
import { toScaleRatio } from '../../helper/Zoom1DManager';
|
|
3
|
+
import { getMatrixGenerationDefaultOptions } from '../panelsPreferencesDefaultValues';
|
|
2
4
|
import { getActiveWorkspace } from '../utilities/getActiveWorkspace';
|
|
3
|
-
function
|
|
4
|
-
|
|
5
|
+
function getMatrixGenerationPanelOptions(draft, nucleus) {
|
|
6
|
+
initMatrixGeneration(draft, nucleus);
|
|
5
7
|
const currentWorkspacePreferences = getActiveWorkspace(draft);
|
|
6
|
-
const panels = currentWorkspacePreferences.
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const panels = currentWorkspacePreferences.panels;
|
|
9
|
+
const matrixGeneration = panels.matrixGeneration?.[nucleus];
|
|
10
|
+
return matrixGeneration;
|
|
11
|
+
}
|
|
12
|
+
function initMatrixGeneration(draft, nucleus) {
|
|
13
|
+
const currentWorkspacePreferences = getActiveWorkspace(draft);
|
|
14
|
+
const panels = currentWorkspacePreferences.panels;
|
|
11
15
|
if (!panels.matrixGeneration?.[nucleus]) {
|
|
12
|
-
const options =
|
|
13
|
-
exclusionsZones: [exclusionZone],
|
|
14
|
-
filters: [],
|
|
15
|
-
range,
|
|
16
|
-
numberOfPoints: 1024,
|
|
17
|
-
};
|
|
16
|
+
const options = getMatrixGenerationDefaultOptions();
|
|
18
17
|
panels.matrixGeneration = {
|
|
19
18
|
...panels.matrixGeneration,
|
|
20
19
|
[nucleus]: options,
|
|
21
20
|
};
|
|
22
21
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
return panels.matrixGeneration;
|
|
23
|
+
}
|
|
24
|
+
function addExclusionZone(draft, action) {
|
|
25
|
+
const { zone, range, nucleus } = action.payload;
|
|
26
|
+
const matrixGeneration = getMatrixGenerationPanelOptions(draft, nucleus);
|
|
27
|
+
if (!matrixGeneration)
|
|
28
|
+
return;
|
|
29
|
+
const exclusionZone = {
|
|
30
|
+
id: v4(),
|
|
31
|
+
...zone,
|
|
32
|
+
};
|
|
33
|
+
matrixGeneration.matrixOptions.range = range;
|
|
34
|
+
matrixGeneration.matrixOptions.exclusionsZones.push(exclusionZone);
|
|
26
35
|
}
|
|
27
36
|
function deleteExclusionZone(draft, action) {
|
|
28
37
|
const { zone, nucleus } = action.payload;
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
38
|
+
const matrixGeneration = getMatrixGenerationPanelOptions(draft, nucleus);
|
|
39
|
+
if (!matrixGeneration)
|
|
40
|
+
return;
|
|
41
|
+
const options = matrixGeneration.matrixOptions;
|
|
42
|
+
options.exclusionsZones = options.exclusionsZones.filter((_zone) => _zone.id !== zone.id);
|
|
35
43
|
}
|
|
36
44
|
function setMatrixGenerationOptions(draft, action) {
|
|
37
45
|
const { options, nucleus } = action.payload;
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
46
|
+
const matrixGeneration = getMatrixGenerationPanelOptions(draft, nucleus);
|
|
47
|
+
matrixGeneration.matrixOptions = options;
|
|
48
|
+
}
|
|
49
|
+
function toggleMatrixGenerationViewProperty(draft, action) {
|
|
50
|
+
const { key, nucleus } = action.payload;
|
|
51
|
+
const matrixGeneration = getMatrixGenerationPanelOptions(draft, nucleus);
|
|
52
|
+
if (!matrixGeneration)
|
|
53
|
+
return;
|
|
54
|
+
matrixGeneration[key] = !matrixGeneration[key];
|
|
55
|
+
}
|
|
56
|
+
function resetDefaultViewMatrixGenerationOptions(draft, action) {
|
|
57
|
+
const { nucleus } = action.payload;
|
|
58
|
+
const matrixGeneration = initMatrixGeneration(draft, nucleus);
|
|
59
|
+
const currentOptions = getMatrixGenerationPanelOptions(draft, nucleus);
|
|
60
|
+
const { matrixOptions } = currentOptions;
|
|
61
|
+
const { matrixOptions: defaultMatrixOptions, ...vewOptions } = getMatrixGenerationDefaultOptions();
|
|
62
|
+
matrixGeneration[nucleus] = { matrixOptions, ...vewOptions };
|
|
63
|
+
}
|
|
64
|
+
function changeMatrixGenerationScale(draft, action) {
|
|
65
|
+
const { zoomOptions, nucleus } = action.payload;
|
|
66
|
+
const matrixGeneration = getMatrixGenerationPanelOptions(draft, nucleus);
|
|
67
|
+
if (!matrixGeneration)
|
|
68
|
+
return;
|
|
69
|
+
const scaleRatio = toScaleRatio(zoomOptions);
|
|
70
|
+
matrixGeneration.scaleRatio *= scaleRatio;
|
|
71
|
+
}
|
|
72
|
+
function changeMatrixGenerationStocsyChemicalShift(draft, action) {
|
|
73
|
+
const { chemicalShift, nucleus } = action.payload;
|
|
74
|
+
const matrixGeneration = getMatrixGenerationPanelOptions(draft, nucleus);
|
|
75
|
+
if (!matrixGeneration)
|
|
76
|
+
return null;
|
|
77
|
+
matrixGeneration.chemicalShift = chemicalShift;
|
|
41
78
|
}
|
|
42
|
-
export { addExclusionZone, deleteExclusionZone, setMatrixGenerationOptions };
|
|
79
|
+
export { addExclusionZone, deleteExclusionZone, setMatrixGenerationOptions, toggleMatrixGenerationViewProperty, changeMatrixGenerationScale, changeMatrixGenerationStocsyChemicalShift, resetDefaultViewMatrixGenerationOptions, };
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import { getLocalStorage, storeData } from '../../../utility/LocalStorage';
|
|
2
1
|
export function removeWorkspace(draft, action) {
|
|
3
2
|
const { workspace } = action.payload;
|
|
4
3
|
if (workspace === draft.workspace.current) {
|
|
5
4
|
draft.workspace.current = 'default';
|
|
6
5
|
}
|
|
7
|
-
const localData = getLocalStorage('nmr-general-settings');
|
|
8
6
|
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
9
7
|
delete draft.workspaces[workspace];
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
11
|
-
delete localData.workspaces[workspace];
|
|
12
|
-
storeData('nmr-general-settings', JSON.stringify(localData));
|
|
13
8
|
}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { getLocalStorage, storeData } from '../../../utility/LocalStorage';
|
|
2
1
|
export function setActiveWorkspace(draft, action) {
|
|
3
2
|
if (action.payload) {
|
|
4
3
|
const { workspace } = action.payload;
|
|
5
|
-
const localData = getLocalStorage('nmr-general-settings');
|
|
6
4
|
draft.workspace.current = workspace;
|
|
7
|
-
localData.currentWorkspace = workspace;
|
|
8
|
-
storeData('nmr-general-settings', JSON.stringify(localData));
|
|
9
5
|
}
|
|
10
6
|
}
|
|
@@ -3,7 +3,7 @@ export function setPanelsPreferences(draft, action) {
|
|
|
3
3
|
if (action.payload) {
|
|
4
4
|
const currentWorkspacePreferences = getActiveWorkspace(draft);
|
|
5
5
|
const { key, value } = action.payload;
|
|
6
|
-
const panels = currentWorkspacePreferences.
|
|
6
|
+
const panels = currentWorkspacePreferences.panels;
|
|
7
7
|
if (value?.nuclei) {
|
|
8
8
|
const { nuclei, ...commonPreferences } = value;
|
|
9
9
|
panels[key] = {
|
|
@@ -1,27 +1,13 @@
|
|
|
1
1
|
import cloneDeep from 'lodash/cloneDeep';
|
|
2
|
-
import { getLocalStorage, storeData } from '../../../utility/LocalStorage';
|
|
3
2
|
import { getActiveWorkspace } from '../utilities/getActiveWorkspace';
|
|
4
|
-
import { mapNucleiFormatting } from '../utilities/mapNucleiFormatting';
|
|
5
3
|
export function setPreferences(draft, action) {
|
|
6
|
-
const localData = getLocalStorage('nmr-general-settings');
|
|
7
4
|
const currentWorkspacePreferences = getActiveWorkspace(draft);
|
|
8
5
|
if (action.payload) {
|
|
9
|
-
const
|
|
6
|
+
const preferences = action.payload;
|
|
10
7
|
draft.workspaces[draft.workspace.current] = {
|
|
11
8
|
...currentWorkspacePreferences,
|
|
12
|
-
...
|
|
13
|
-
formatting: mapNucleiFormatting(formatting),
|
|
9
|
+
...preferences,
|
|
14
10
|
};
|
|
15
11
|
}
|
|
16
|
-
if (draft.workspaces[draft.workspace.current].source === 'user') {
|
|
17
|
-
draft.workspaces[draft.workspace.current].version++;
|
|
18
|
-
storeData('nmr-general-settings', JSON.stringify({
|
|
19
|
-
...localData,
|
|
20
|
-
workspaces: {
|
|
21
|
-
...localData.workspaces,
|
|
22
|
-
[draft.workspace.current]: draft.workspaces[draft.workspace.current],
|
|
23
|
-
},
|
|
24
|
-
}));
|
|
25
|
-
}
|
|
26
12
|
draft.originalWorkspaces[draft.workspace.current] = cloneDeep(draft.workspaces[draft.workspace.current]);
|
|
27
13
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { PanelsPreferences } from 'nmr-load-save';
|
|
1
|
+
import { MatrixGenerationOptions, PanelsPreferences } from 'nmr-load-save';
|
|
2
|
+
import { DeepPartial } from '../../../data/types/common/DeepPartial';
|
|
2
3
|
declare const getSpectraDefaultValues: (nucleus?: string) => PanelsPreferences['spectra'];
|
|
3
4
|
declare const getIntegralDefaultValues: (nucleus?: string) => PanelsPreferences['integrals'];
|
|
4
5
|
declare const getZoneDefaultValues: (nucleus?: string) => PanelsPreferences['zones'];
|
|
@@ -6,4 +7,6 @@ declare const getRangeDefaultValues: (nucleus?: string) => PanelsPreferences['ra
|
|
|
6
7
|
declare const getPeaksDefaultValues: (nucleus?: string) => PanelsPreferences['peaks'];
|
|
7
8
|
declare const databaseDefaultValues: PanelsPreferences['database'];
|
|
8
9
|
declare const getMultipleSpectraAnalysisDefaultValues: (nucleus?: string) => PanelsPreferences['multipleSpectraAnalysis'];
|
|
9
|
-
|
|
10
|
+
declare function getMatrixGenerationDefaultOptions(): DeepPartial<MatrixGenerationOptions>;
|
|
11
|
+
declare const getMatrixGenerationDefaultValues: (nucleus?: string) => PanelsPreferences['matrixGeneration'];
|
|
12
|
+
export { getSpectraDefaultValues, getPeaksDefaultValues, getIntegralDefaultValues, getRangeDefaultValues, getZoneDefaultValues, databaseDefaultValues, getMultipleSpectraAnalysisDefaultValues, getMatrixGenerationDefaultOptions, getMatrixGenerationDefaultValues, };
|
|
@@ -148,4 +148,20 @@ const getMultipleSpectraAnalysisDefaultValues = (nucleus) => {
|
|
|
148
148
|
};
|
|
149
149
|
return nucleus ? { [nucleus]: preferences } : {};
|
|
150
150
|
};
|
|
151
|
-
|
|
151
|
+
function getMatrixGenerationDefaultOptions() {
|
|
152
|
+
return {
|
|
153
|
+
matrixOptions: {
|
|
154
|
+
exclusionsZones: [],
|
|
155
|
+
filters: [],
|
|
156
|
+
numberOfPoints: 1024,
|
|
157
|
+
},
|
|
158
|
+
chemicalShift: null,
|
|
159
|
+
scaleRatio: 1,
|
|
160
|
+
showBoxPlot: false,
|
|
161
|
+
showStocsy: false,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
const getMatrixGenerationDefaultValues = (nucleus) => {
|
|
165
|
+
return nucleus ? { [nucleus]: getMatrixGenerationDefaultOptions() } : {};
|
|
166
|
+
};
|
|
167
|
+
export { getSpectraDefaultValues, getPeaksDefaultValues, getIntegralDefaultValues, getRangeDefaultValues, getZoneDefaultValues, databaseDefaultValues, getMultipleSpectraAnalysisDefaultValues, getMatrixGenerationDefaultOptions, getMatrixGenerationDefaultValues, };
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { MultipleSpectraAnalysisPreferences, Workspace, WorkSpaceSource } from 'nmr-load-save';
|
|
2
2
|
import { Reducer } from 'react';
|
|
3
3
|
import { SplitPaneSize } from 'react-science/ui';
|
|
4
|
-
import { MatrixOptions } from '../../../data/types/data1d/MatrixOptions';
|
|
5
4
|
import type { NMRiumWorkspace, NMRiumPreferences } from '../../main';
|
|
6
5
|
import { ActionType } from '../types/ActionType';
|
|
6
|
+
import { MatrixGenerationActions } from './actions/matrixGeneration';
|
|
7
7
|
export declare const WORKSPACES_KEYS: {
|
|
8
8
|
componentKey: string;
|
|
9
9
|
nmriumKey: string;
|
|
10
10
|
};
|
|
11
|
+
export interface Settings {
|
|
12
|
+
version: number;
|
|
13
|
+
workspaces: Record<string, WorkspaceWithSource>;
|
|
14
|
+
currentWorkspace: any;
|
|
15
|
+
}
|
|
11
16
|
type InitPreferencesAction = ActionType<'INIT_PREFERENCES', {
|
|
12
17
|
display: NMRiumPreferences;
|
|
13
18
|
workspace: NMRiumWorkspace;
|
|
@@ -55,33 +60,10 @@ export type SetSpectraAnalysisPanelPreferencesAction = ActionType<'SET_SPECTRA_A
|
|
|
55
60
|
nucleus: string;
|
|
56
61
|
data: MultipleSpectraAnalysisPreferences;
|
|
57
62
|
}>;
|
|
58
|
-
export type setMatrixGenerationOptionsAction = ActionType<'SET_MATRIX_GENERATION_OPTIONS', {
|
|
59
|
-
nucleus: string;
|
|
60
|
-
options: MatrixOptions;
|
|
61
|
-
}>;
|
|
62
|
-
export type addMatrixGenerationExclusionZoneAction = ActionType<'ADD_MATRIX_GENERATION_EXCLUSION_ZONE', {
|
|
63
|
-
zone: {
|
|
64
|
-
from: number;
|
|
65
|
-
to: number;
|
|
66
|
-
};
|
|
67
|
-
range: {
|
|
68
|
-
from: number;
|
|
69
|
-
to: number;
|
|
70
|
-
};
|
|
71
|
-
nucleus: string;
|
|
72
|
-
}>;
|
|
73
|
-
export type deleteMatrixGenerationExclusionZoneAction = ActionType<'DELETE_MATRIX_GENERATION_EXCLUSION_ZONE', {
|
|
74
|
-
zone: {
|
|
75
|
-
id: string;
|
|
76
|
-
from: number;
|
|
77
|
-
to: number;
|
|
78
|
-
};
|
|
79
|
-
nucleus: string;
|
|
80
|
-
}>;
|
|
81
63
|
export type SetVerticalSplitterPositionAction = ActionType<'SET_VERTICAL_SPLITTER_POSITION', {
|
|
82
64
|
value: SplitPaneSize;
|
|
83
65
|
}>;
|
|
84
|
-
type PreferencesActions = InitPreferencesAction | SetPreferencesAction | SetPanelsPreferencesAction | SetWorkspaceAction | WorkspaceAction | AddWorkspaceAction | ApplyGeneralPreferences | AnalyzeSpectraAction | ChangeAnalysisColumnValueKeyAction | DeleteAnalysisColumn | SetSpectraAnalysisPanelPreferencesAction |
|
|
66
|
+
type PreferencesActions = InitPreferencesAction | SetPreferencesAction | SetPanelsPreferencesAction | SetWorkspaceAction | WorkspaceAction | AddWorkspaceAction | ApplyGeneralPreferences | AnalyzeSpectraAction | ChangeAnalysisColumnValueKeyAction | DeleteAnalysisColumn | SetSpectraAnalysisPanelPreferencesAction | MatrixGenerationActions | SetVerticalSplitterPositionAction;
|
|
85
67
|
export declare const WORKSPACES: Array<{
|
|
86
68
|
key: NMRiumWorkspace;
|
|
87
69
|
label: string;
|
|
@@ -101,6 +83,8 @@ export interface PreferencesState {
|
|
|
101
83
|
};
|
|
102
84
|
}
|
|
103
85
|
export declare const preferencesInitialState: PreferencesState;
|
|
86
|
+
export declare function readSettings(): Settings;
|
|
87
|
+
export declare function updateSettings(settings: Settings): void;
|
|
104
88
|
export declare function initPreferencesState(state: PreferencesState): PreferencesState;
|
|
105
89
|
declare const preferencesReducer: Reducer<PreferencesState, any>;
|
|
106
90
|
export default preferencesReducer;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { produce } from 'immer';
|
|
2
|
-
import {
|
|
2
|
+
import { CURRENT_EXPORT_VERSION, migrateSettings, } from 'nmr-load-save';
|
|
3
|
+
import { getLocalStorage, storeData } from '../../utility/LocalStorage';
|
|
3
4
|
import Workspaces from '../../workspaces';
|
|
4
5
|
import { addWorkspace } from './actions/addWorkspace';
|
|
5
6
|
import { analyzeSpectra, changeAnalysisColumnValueKey, deleteAnalysisColumn, setSpectraAnalysisPanelsPreferences, } from './actions/analyzeSpectra';
|
|
6
7
|
import { applyGeneralPreferences } from './actions/applyGeneralPreferences';
|
|
7
8
|
import { initPreferences } from './actions/initPreferences';
|
|
8
|
-
import { setMatrixGenerationOptions, addExclusionZone, deleteExclusionZone, } from './actions/matrixGeneration';
|
|
9
|
+
import { setMatrixGenerationOptions, addExclusionZone, deleteExclusionZone, toggleMatrixGenerationViewProperty, changeMatrixGenerationScale, changeMatrixGenerationStocsyChemicalShift, } from './actions/matrixGeneration';
|
|
9
10
|
import { removeWorkspace } from './actions/removeWorkspace';
|
|
10
11
|
import { setActiveWorkspace } from './actions/setActiveWorkspace';
|
|
11
12
|
import { setPanelsPreferences } from './actions/setPanelsPreferences';
|
|
@@ -13,7 +14,7 @@ import { setPreferences } from './actions/setPreferences';
|
|
|
13
14
|
import { setVerticalSplitterPosition } from './actions/setVerticalSplitterPosition';
|
|
14
15
|
import { setWorkspace } from './actions/setWorkspace';
|
|
15
16
|
import { mapWorkspaces } from './utilities/mapWorkspaces';
|
|
16
|
-
const
|
|
17
|
+
const LOCAL_STORAGE_SETTINGS_KEY = 'nmr-general-settings';
|
|
17
18
|
export const WORKSPACES_KEYS = {
|
|
18
19
|
componentKey: `nmrium-component-workspace`,
|
|
19
20
|
nmriumKey: `nmrium-file-workspace`,
|
|
@@ -49,7 +50,7 @@ export const WORKSPACES = [
|
|
|
49
50
|
},
|
|
50
51
|
];
|
|
51
52
|
export const preferencesInitialState = {
|
|
52
|
-
version:
|
|
53
|
+
version: CURRENT_EXPORT_VERSION,
|
|
53
54
|
workspaces: {},
|
|
54
55
|
originalWorkspaces: {},
|
|
55
56
|
dispatch: () => null,
|
|
@@ -58,26 +59,28 @@ export const preferencesInitialState = {
|
|
|
58
59
|
base: null,
|
|
59
60
|
},
|
|
60
61
|
};
|
|
62
|
+
export function readSettings() {
|
|
63
|
+
const localData = getLocalStorage(LOCAL_STORAGE_SETTINGS_KEY) || {
|
|
64
|
+
version: CURRENT_EXPORT_VERSION,
|
|
65
|
+
currentWorkspace: null,
|
|
66
|
+
workspaces: {},
|
|
67
|
+
};
|
|
68
|
+
return migrateSettings(localData);
|
|
69
|
+
}
|
|
70
|
+
export function updateSettings(settings) {
|
|
71
|
+
storeData(LOCAL_STORAGE_SETTINGS_KEY, JSON.stringify(settings));
|
|
72
|
+
}
|
|
61
73
|
export function initPreferencesState(state) {
|
|
62
|
-
const
|
|
63
|
-
const
|
|
64
|
-
// remove old nmr-local-storage-version key
|
|
65
|
-
if (nmrLocalStorageVersion && localData?.version) {
|
|
66
|
-
removeData('nmr-local-storage-version');
|
|
67
|
-
}
|
|
74
|
+
const localData = getLocalStorage(LOCAL_STORAGE_SETTINGS_KEY);
|
|
75
|
+
const settings = readSettings();
|
|
68
76
|
// if the local setting version != current settings version number
|
|
69
|
-
if (
|
|
70
|
-
|
|
71
|
-
const data = {
|
|
72
|
-
version: LOCAL_STORAGE_VERSION,
|
|
73
|
-
workspaces: {},
|
|
74
|
-
};
|
|
75
|
-
storeData('nmr-general-settings', JSON.stringify(data));
|
|
77
|
+
if (localData?.version !== CURRENT_EXPORT_VERSION) {
|
|
78
|
+
updateSettings(settings);
|
|
76
79
|
}
|
|
77
80
|
const predefinedWorkspaces = mapWorkspaces(Workspaces, {
|
|
78
81
|
source: 'predefined',
|
|
79
82
|
});
|
|
80
|
-
const localWorkspaces = mapWorkspaces(
|
|
83
|
+
const localWorkspaces = mapWorkspaces(settings?.workspaces || {}, {
|
|
81
84
|
source: 'user',
|
|
82
85
|
});
|
|
83
86
|
return {
|
|
@@ -85,7 +88,7 @@ export function initPreferencesState(state) {
|
|
|
85
88
|
originalWorkspaces: { ...predefinedWorkspaces, ...localWorkspaces },
|
|
86
89
|
workspaces: { ...predefinedWorkspaces, ...localWorkspaces },
|
|
87
90
|
workspace: {
|
|
88
|
-
current:
|
|
91
|
+
current: settings?.currentWorkspace || 'default',
|
|
89
92
|
base: null,
|
|
90
93
|
},
|
|
91
94
|
};
|
|
@@ -122,8 +125,14 @@ function innerPreferencesReducer(draft, action) {
|
|
|
122
125
|
return addExclusionZone(draft, action);
|
|
123
126
|
case 'DELETE_MATRIX_GENERATION_EXCLUSION_ZONE':
|
|
124
127
|
return deleteExclusionZone(draft, action);
|
|
128
|
+
case 'TOGGLE_MATRIX_GENERATION_VIEW_PROPERTY':
|
|
129
|
+
return toggleMatrixGenerationViewProperty(draft, action);
|
|
125
130
|
case 'SET_VERTICAL_SPLITTER_POSITION':
|
|
126
131
|
return setVerticalSplitterPosition(draft, action);
|
|
132
|
+
case 'CHANGE_MATRIX_GENERATION_SCALE':
|
|
133
|
+
return changeMatrixGenerationScale(draft, action);
|
|
134
|
+
case 'CHANGE_MATRIX_GENERATION_STOCSY_CHEMICAL_SHIFT':
|
|
135
|
+
return changeMatrixGenerationStocsyChemicalShift(draft, action);
|
|
127
136
|
default:
|
|
128
137
|
return draft;
|
|
129
138
|
}
|