nmrium 0.48.0 → 0.50.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/LinesSeries.js +1 -1
- package/lib/component/1d/SimilarityTree.d.ts +1 -0
- package/lib/component/1d/SimilarityTree.js +60 -0
- package/lib/component/1d/SpectraLegends.js +1 -1
- package/lib/component/1d/Viewer1D.js +142 -124
- package/lib/component/1d/jCouplingGraph/JsCoupling.js +1 -1
- package/lib/component/1d/multiplicityTree/MultiplicityTree.d.ts +1 -7
- package/lib/component/1d/multiplicityTree/MultiplicityTree.js +114 -125
- package/lib/component/1d/multiplicityTree/MultiplicityTrees.d.ts +1 -0
- package/lib/component/1d/multiplicityTree/MultiplicityTrees.js +23 -0
- package/lib/component/1d/multiplicityTree/generateTreeNodes.d.ts +18 -0
- package/lib/component/1d/multiplicityTree/generateTreeNodes.js +66 -0
- package/lib/component/1d/ranges/Atoms.d.ts +7 -0
- package/lib/component/1d/ranges/Atoms.js +43 -0
- package/lib/component/1d/ranges/Range.d.ts +1 -1
- package/lib/component/1d/ranges/Range.js +10 -9
- package/lib/component/1d/tool/BaseLine.d.ts +2 -0
- package/lib/component/1d/tool/BaseLine.js +26 -0
- package/lib/component/1d/tool/BaseLineZones.js +18 -3
- package/lib/component/2d/Chart2D.js +6 -4
- package/lib/component/2d/Viewer2D.js +35 -26
- package/lib/component/context/KeyModifierContext.d.ts +13 -2
- package/lib/component/context/KeyModifierContext.js +35 -4
- package/lib/component/context/LoggerContext.d.ts +9 -0
- package/lib/component/context/LoggerContext.js +21 -7
- package/lib/component/context/PreferencesContext.d.ts +1 -108
- package/lib/component/context/TopicMoleculeContext.d.ts +8 -0
- package/lib/component/context/TopicMoleculeContext.js +30 -0
- package/lib/component/elements/CloseButton.d.ts +2 -10
- package/lib/component/elements/CloseButton.js +3 -20
- package/lib/component/elements/CounterLabel.js +0 -1
- package/lib/component/elements/DeleteButton.d.ts +5 -7
- package/lib/component/elements/DeleteButton.js +7 -5
- package/lib/component/elements/FilterButton.d.ts +6 -0
- package/lib/component/elements/FilterButton.js +8 -0
- package/lib/component/elements/Input.js +4 -1
- package/lib/component/elements/PreferencesButton.d.ts +2 -4
- package/lib/component/elements/PreferencesButton.js +5 -3
- package/lib/component/elements/ReactTable/ReactTable.js +5 -2
- package/lib/component/elements/ResizerWithScale.js +19 -2
- package/lib/component/elements/SVGGroup.js +2 -2
- package/lib/component/elements/SaveButton.d.ts +2 -11
- package/lib/component/elements/SaveButton.js +4 -19
- package/lib/component/elements/ToolBarButton.d.ts +9 -0
- package/lib/component/elements/ToolBarButton.js +14 -0
- package/lib/component/elements/formik/FormikTextarea.js +8 -9
- package/lib/component/elements/linearAxis/LinearVerticalAxis.js +1 -1
- package/lib/component/elements/popup/Modal/ConfirmDialog.d.ts +2 -1
- package/lib/component/elements/popup/Modal/ConfirmDialog.js +11 -8
- package/lib/component/elements/resizer/SVGResizer.js +1 -1
- package/lib/component/header/BaseLineCorrectionPanel.js +3 -2
- package/lib/component/header/Header.js +2 -2
- package/lib/component/hooks/useCheckToolsVisibility.js +1 -1
- package/lib/component/hooks/useSaveSettings.js +3 -2
- package/lib/component/hooks/useToolsFunctions.js +4 -2
- package/lib/component/main/InnerNMRium.js +2 -1
- package/lib/component/main/InnerNMRiumContents.js +1 -1
- package/lib/component/modal/AboutPredictionModal.js +4 -8
- package/lib/component/modal/AboutSpectrumSimulationModal.js +4 -8
- package/lib/component/modal/CopyClipboardModal.js +1 -1
- package/lib/component/modal/EditPeakShapeModal.js +2 -2
- package/lib/component/modal/ExportAsJcampModal.d.ts +1 -1
- package/lib/component/modal/ExportAsJcampModal.js +8 -4
- package/lib/component/modal/ImportPublicationStringModal.d.ts +2 -1
- package/lib/component/modal/ImportPublicationStringModal.js +80 -32
- package/lib/component/modal/LoadJCAMPModal.js +12 -9
- package/lib/component/modal/LogsHistoryModal.d.ts +1 -1
- package/lib/component/modal/LogsHistoryModal.js +9 -4
- package/lib/component/modal/MoleculeStructureEditorModal.js +10 -3
- package/lib/component/modal/MultipletAnalysisModal.js +8 -8
- package/lib/component/modal/PredictSpectraModal.js +6 -5
- package/lib/component/modal/SaveAsModal.js +2 -2
- package/lib/component/modal/aboutUs/AboutUsModal.js +11 -26
- package/lib/component/modal/changeSum/ChangeSumModal.d.ts +4 -3
- package/lib/component/modal/changeSum/ChangeSumModal.js +10 -3
- package/lib/component/modal/changeSum/ChangeSumModalContents.d.ts +1 -3
- package/lib/component/modal/changeSum/ChangeSumModalContents.js +9 -6
- package/lib/component/modal/editRange/EditRangeModal.js +8 -6
- package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +1 -0
- package/lib/component/modal/editRange/forms/components/CouplingsTable.js +13 -10
- package/lib/component/modal/editRange/forms/components/SignalFormTab.js +1 -1
- package/lib/component/modal/editRange/forms/components/SignalsForm.js +1 -0
- package/lib/component/modal/editZone/EditZoneModal.js +3 -3
- package/lib/component/modal/metaImportation/MetaImportationModal.js +1 -1
- package/lib/component/modal/setting/GeneralSettings.js +17 -38
- package/lib/component/modal/setting/settings-tabs/GeneralTabContent.js +9 -11
- package/lib/component/modal/setting/settings-tabs/OnLoadProcessingTabContent.js +2 -4
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +2 -2
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +6 -23
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +3 -3
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -4
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +7 -8
- package/lib/component/panels/PeaksPanel/PeaksToggleActions.d.ts +8 -6
- package/lib/component/panels/PeaksPanel/PeaksToggleActions.js +3 -6
- package/lib/component/panels/RangesPanel/RangesHeader.d.ts +1 -1
- package/lib/component/panels/RangesPanel/RangesHeader.js +8 -31
- package/lib/component/panels/RangesPanel/RangesTable.js +1 -1
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +2 -2
- package/lib/component/panels/SpectrumsPanel/SpectraPreferences.js +39 -5
- package/lib/component/panels/SpectrumsPanel/SpectraTable.js +42 -11
- package/lib/component/panels/SpectrumsPanel/SpectrumListPanel.js +4 -2
- package/lib/component/panels/SpectrumsPanel/base/SpectraColumnsManager.js +19 -16
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +1 -1
- package/lib/component/panels/SummaryPanel/SetMolecularFormulaModal.js +1 -1
- package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.js +1 -1
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +4 -3
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +2 -26
- package/lib/component/panels/databasePanel/DatabasePanel.js +6 -6
- package/lib/component/panels/databasePanel/DatabaseSearchOptions.d.ts +4 -6
- package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +12 -13
- package/lib/component/panels/databasePanel/DatabaseStructureSearchModal.js +7 -8
- package/lib/component/panels/filtersPanel/FiltersTable.js +1 -1
- package/lib/component/panels/header/DefaultPanelHeader.js +9 -4
- package/lib/component/panels/header/PanelHeader.js +0 -1
- package/lib/component/panels/header/PreferencesHeader.d.ts +2 -4
- package/lib/component/panels/header/PreferencesHeader.js +9 -23
- package/lib/component/panels/header/SpectraAutomaticPickingButton.js +2 -2
- package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js +9 -9
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +3 -3
- package/lib/component/reducer/Reducer.js +5 -0
- package/lib/component/reducer/actions/DatabaseActions.d.ts +3 -2
- package/lib/component/reducer/actions/DatabaseActions.js +5 -1
- package/lib/component/reducer/actions/FiltersActions.d.ts +3 -4
- package/lib/component/reducer/actions/FiltersActions.js +92 -55
- package/lib/component/reducer/actions/LoadActions.js +10 -8
- package/lib/component/reducer/actions/SpectrumsActions.d.ts +8 -1
- package/lib/component/reducer/actions/SpectrumsActions.js +3 -3
- package/lib/component/reducer/actions/ToolsActions.d.ts +8 -5
- package/lib/component/reducer/actions/ToolsActions.js +51 -44
- package/lib/component/toolbar/BasicToolBar.js +11 -29
- package/lib/component/utility/export.js +3 -0
- package/lib/component/workspaces/exercise.js +1 -0
- package/lib/component/workspaces/prediction.js +1 -16
- package/lib/component/workspaces/simulation.js +1 -2
- package/lib/component/workspaces/workspaceDefaultProperties.js +4 -3
- package/lib/data/data1d/Spectrum1D/index.d.ts +0 -1
- package/lib/data/data1d/Spectrum1D/index.js +0 -1
- package/lib/utils/clipboard/clipboardComponents.d.ts +2 -2
- package/lib/utils/clipboard/clipboardComponents.js +8 -3
- package/lib/versionInfo.js +1 -1
- package/package.json +25 -23
- package/lib/component/1d/multiplicityTree/LevelNode.d.ts +0 -8
- package/lib/component/1d/multiplicityTree/LevelNode.js +0 -8
- package/lib/component/1d/multiplicityTree/StringNode.d.ts +0 -11
- package/lib/component/1d/multiplicityTree/StringNode.js +0 -7
- package/lib/component/1d/multiplicityTree/TreeColors.d.ts +0 -1
- package/lib/component/1d/multiplicityTree/TreeColors.js +0 -1
- package/lib/component/1d/multiplicityTree/TreeNodes.d.ts +0 -21
- package/lib/component/1d/multiplicityTree/TreeNodes.js +0 -23
- package/lib/component/1d/multiplicityTree/buildTreeNode.d.ts +0 -11
- package/lib/component/1d/multiplicityTree/buildTreeNode.js +0 -57
- package/lib/data/data1d/Spectrum1D/generateSpectrumFromPublicationString.d.ts +0 -2
- package/lib/data/data1d/Spectrum1D/generateSpectrumFromPublicationString.js +0 -6
|
@@ -8,6 +8,7 @@ import { BrushTracker, } from '../EventsTrackers/BrushTracker';
|
|
|
8
8
|
import { MouseTracker } from '../EventsTrackers/MouseTracker';
|
|
9
9
|
import { useChartData } from '../context/ChartContext';
|
|
10
10
|
import { useDispatch } from '../context/DispatchContext';
|
|
11
|
+
import { useMapKeyModifiers } from '../context/KeyModifierContext';
|
|
11
12
|
import Spinner from '../loader/Spinner';
|
|
12
13
|
import { options } from '../toolbar/ToolTypes';
|
|
13
14
|
import { PhaseTraces } from './1d-tracer/phase-correction-traces';
|
|
@@ -23,6 +24,7 @@ function Viewer2D({ emptyText = undefined }) {
|
|
|
23
24
|
const { toolOptions: { selectedTool }, isLoading, data, margin, view: { spectra: { activeSpectra, activeTab }, }, } = state;
|
|
24
25
|
const dispatch = useDispatch();
|
|
25
26
|
const brushStartRef = useRef(null);
|
|
27
|
+
const { getModifiersKey, primaryKeyIdentifier } = useMapKeyModifiers();
|
|
26
28
|
const spectrumData = useMemo(() => {
|
|
27
29
|
const nuclei = activeTab.split(',');
|
|
28
30
|
return nuclei
|
|
@@ -58,41 +60,48 @@ function Viewer2D({ emptyText = undefined }) {
|
|
|
58
60
|
const handelBrushEnd = useCallback((brushData) => {
|
|
59
61
|
//reset the brush start
|
|
60
62
|
brushStartRef.current = null;
|
|
63
|
+
const modifierKey = getModifiersKey(brushData);
|
|
64
|
+
let executeDefaultAction = false;
|
|
61
65
|
if (brushData.mouseButton === 'main') {
|
|
62
66
|
const trackID = getLayoutID(DIMENSION, brushData);
|
|
63
67
|
if (trackID) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
+
switch (modifierKey) {
|
|
69
|
+
case primaryKeyIdentifier: {
|
|
70
|
+
switch (selectedTool) {
|
|
71
|
+
case options.zoom.id: {
|
|
72
|
+
executeDefaultAction = true;
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
case options.zonePicking.id: {
|
|
76
|
+
dispatch({ type: 'ADD_2D_ZONE', payload: brushData });
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
default:
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
break;
|
|
68
83
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
case options.zonePicking.id:
|
|
73
|
-
dispatch({ type: 'ADD_2D_ZONE', payload: brushData });
|
|
74
|
-
break;
|
|
75
|
-
default:
|
|
76
|
-
break;
|
|
84
|
+
default: {
|
|
85
|
+
executeDefaultAction = true;
|
|
86
|
+
break;
|
|
77
87
|
}
|
|
78
88
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
89
|
+
const isNotDistanceMeasurementTool = selectedTool !== 'zoom' ||
|
|
90
|
+
(selectedTool === 'zoom' && !brushData.shiftKey);
|
|
91
|
+
if (executeDefaultAction &&
|
|
92
|
+
selectedTool != null &&
|
|
93
|
+
isNotDistanceMeasurementTool) {
|
|
94
|
+
return dispatch({
|
|
95
|
+
type: 'BRUSH_END',
|
|
96
|
+
payload: {
|
|
97
|
+
...brushData,
|
|
98
|
+
trackID: getLayoutID(DIMENSION, brushData),
|
|
99
|
+
},
|
|
100
|
+
});
|
|
92
101
|
}
|
|
93
102
|
}
|
|
94
103
|
}
|
|
95
|
-
}, [selectedTool,
|
|
104
|
+
}, [getModifiersKey, DIMENSION, selectedTool, primaryKeyIdentifier, dispatch]);
|
|
96
105
|
const handelOnDoubleClick = useCallback((e) => {
|
|
97
106
|
const { x: startX, y: startY } = e;
|
|
98
107
|
const trackID = getLayoutID(DIMENSION, { startX, startY });
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
type ModifiersKey = `shift[${boolean}]_ctrl[${boolean}]_alt[${boolean}]`;
|
|
3
|
+
type PrimaryKey = 'shift[true]_ctrl[false]_alt[false]' | 'shift[false]_ctrl[false]_alt[false]';
|
|
2
4
|
interface KeyModifiers {
|
|
3
5
|
ctrlKey: boolean;
|
|
4
6
|
shiftKey: boolean;
|
|
5
7
|
altKey: boolean;
|
|
6
8
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
interface KeyModifiersState extends KeyModifiers {
|
|
10
|
+
modifiersKey: ModifiersKey | null;
|
|
11
|
+
}
|
|
12
|
+
export declare const KeyModifierContext: import("react").Context<KeyModifiersState>;
|
|
13
|
+
export declare function useKeyModifiers(): KeyModifiersState;
|
|
9
14
|
interface KeyModifierProviderProps {
|
|
10
15
|
children: ReactNode;
|
|
11
16
|
}
|
|
@@ -14,5 +19,11 @@ export declare function getModifiers(event: KeyboardEvent | MouseEvent): {
|
|
|
14
19
|
shiftKey: boolean;
|
|
15
20
|
altKey: boolean;
|
|
16
21
|
};
|
|
22
|
+
export declare function toModifiersKey(keyModifiers: KeyModifiers): ModifiersKey;
|
|
23
|
+
declare function getModifiersKey(event: MouseEvent | KeyboardEvent): "shift[false]_ctrl[false]_alt[false]" | "shift[false]_ctrl[false]_alt[true]" | "shift[false]_ctrl[true]_alt[false]" | "shift[false]_ctrl[true]_alt[true]" | "shift[true]_ctrl[false]_alt[false]" | "shift[true]_ctrl[false]_alt[true]" | "shift[true]_ctrl[true]_alt[false]" | "shift[true]_ctrl[true]_alt[true]";
|
|
24
|
+
export declare function useMapKeyModifiers(): {
|
|
25
|
+
primaryKeyIdentifier: PrimaryKey;
|
|
26
|
+
getModifiersKey: typeof getModifiersKey;
|
|
27
|
+
};
|
|
17
28
|
export declare function KeyModifiersProvider({ children }: KeyModifierProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
18
29
|
export {};
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useContext, useEffect, useState, } from 'react';
|
|
2
|
+
import { createContext, useContext, useEffect, useMemo, useState, } from 'react';
|
|
3
|
+
import { usePreferences } from './PreferencesContext';
|
|
4
|
+
function getPrimaryKey(invert) {
|
|
5
|
+
if (invert) {
|
|
6
|
+
return 'shift[false]_ctrl[false]_alt[false]';
|
|
7
|
+
}
|
|
8
|
+
return 'shift[true]_ctrl[false]_alt[false]';
|
|
9
|
+
}
|
|
3
10
|
const defaultKeyModifiersState = {
|
|
4
11
|
ctrlKey: false,
|
|
5
12
|
shiftKey: false,
|
|
6
13
|
altKey: false,
|
|
14
|
+
modifiersKey: null,
|
|
7
15
|
};
|
|
8
16
|
export const KeyModifierContext = createContext(defaultKeyModifiersState);
|
|
9
17
|
export function useKeyModifiers() {
|
|
@@ -19,14 +27,37 @@ export function getModifiers(event) {
|
|
|
19
27
|
const ctrlKey = isMac ? metaKey : event.ctrlKey;
|
|
20
28
|
return { ctrlKey, shiftKey, altKey };
|
|
21
29
|
}
|
|
30
|
+
export function toModifiersKey(keyModifiers) {
|
|
31
|
+
const { shiftKey, altKey, ctrlKey } = keyModifiers;
|
|
32
|
+
return `shift[${shiftKey ? 'true' : 'false'}]_ctrl[${ctrlKey ? 'true' : 'false'}]_alt[${altKey ? 'true' : 'false'}]`;
|
|
33
|
+
}
|
|
34
|
+
function getModifiersKey(event) {
|
|
35
|
+
const keyModifiers = getModifiers(event);
|
|
36
|
+
return toModifiersKey(keyModifiers);
|
|
37
|
+
}
|
|
38
|
+
export function useMapKeyModifiers() {
|
|
39
|
+
const { current: { general: { invert }, }, } = usePreferences();
|
|
40
|
+
return useMemo(() => {
|
|
41
|
+
const primaryKeyIdentifier = getPrimaryKey(invert);
|
|
42
|
+
return {
|
|
43
|
+
primaryKeyIdentifier,
|
|
44
|
+
getModifiersKey,
|
|
45
|
+
};
|
|
46
|
+
}, [invert]);
|
|
47
|
+
}
|
|
22
48
|
export function KeyModifiersProvider({ children }) {
|
|
23
49
|
const [modifiers, setModifiers] = useState(defaultKeyModifiersState);
|
|
50
|
+
const { current: { general: { invert }, }, } = usePreferences();
|
|
24
51
|
useEffect(() => {
|
|
25
52
|
function handleKeyDown(event) {
|
|
26
|
-
|
|
53
|
+
const keyModifiers = getModifiers(event);
|
|
54
|
+
const modifiersKey = toModifiersKey(keyModifiers);
|
|
55
|
+
setModifiers({ ...keyModifiers, modifiersKey });
|
|
27
56
|
}
|
|
28
57
|
function handleKeyUp(event) {
|
|
29
|
-
|
|
58
|
+
const keyModifiers = getModifiers(event);
|
|
59
|
+
const modifiersKey = toModifiersKey(keyModifiers);
|
|
60
|
+
setModifiers({ ...keyModifiers, modifiersKey });
|
|
30
61
|
}
|
|
31
62
|
document.addEventListener('keydown', handleKeyDown);
|
|
32
63
|
document.addEventListener('keyup', handleKeyUp);
|
|
@@ -34,6 +65,6 @@ export function KeyModifiersProvider({ children }) {
|
|
|
34
65
|
document.removeEventListener('keydown', handleKeyDown);
|
|
35
66
|
document.removeEventListener('keyup', handleKeyUp);
|
|
36
67
|
};
|
|
37
|
-
}, []);
|
|
68
|
+
}, [invert]);
|
|
38
69
|
return (_jsx(KeyModifierContext.Provider, { value: modifiers, children: children }));
|
|
39
70
|
}
|
|
@@ -15,5 +15,14 @@ export declare function useLogger(): {
|
|
|
15
15
|
interface LoggerProviderProps {
|
|
16
16
|
children: ReactNode;
|
|
17
17
|
}
|
|
18
|
+
export declare const LOGGER_LEVELS: {
|
|
19
|
+
readonly fatal: 60;
|
|
20
|
+
readonly error: 50;
|
|
21
|
+
readonly warn: 40;
|
|
22
|
+
readonly info: 30;
|
|
23
|
+
readonly debug: 20;
|
|
24
|
+
readonly trace: 10;
|
|
25
|
+
readonly silent: 0;
|
|
26
|
+
};
|
|
18
27
|
export declare function LoggerProvider({ children }: LoggerProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
19
28
|
export {};
|
|
@@ -11,20 +11,31 @@ export function useLogger() {
|
|
|
11
11
|
}
|
|
12
12
|
return context;
|
|
13
13
|
}
|
|
14
|
+
export const LOGGER_LEVELS = {
|
|
15
|
+
fatal: 60,
|
|
16
|
+
error: 50,
|
|
17
|
+
warn: 40,
|
|
18
|
+
info: 30,
|
|
19
|
+
debug: 20,
|
|
20
|
+
trace: 10,
|
|
21
|
+
silent: 0,
|
|
22
|
+
};
|
|
14
23
|
export function LoggerProvider({ children }) {
|
|
15
|
-
const { current: { general: { loggingLevel }, }, } = usePreferences();
|
|
24
|
+
const { current: { general: { loggingLevel, popupLoggingLevel }, }, } = usePreferences();
|
|
16
25
|
const [lastReadLogId, setLastLogId] = useState(0);
|
|
17
26
|
const [logsHistory, setLogsHistory] = useState([]);
|
|
18
27
|
const [isLogHistoryOpened, openLogHistory] = useState(false);
|
|
28
|
+
const popupLoggingLevelRef = useRef();
|
|
19
29
|
const loggerRef = useRef(new FifoLogger({
|
|
20
30
|
onChange: (log, logs) => {
|
|
21
|
-
if (log &&
|
|
22
|
-
|
|
31
|
+
if (log &&
|
|
32
|
+
popupLoggingLevelRef.current &&
|
|
33
|
+
log.level === LOGGER_LEVELS[popupLoggingLevelRef.current]) {
|
|
23
34
|
openLogHistory(true);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
35
|
+
}
|
|
36
|
+
if (log?.error) {
|
|
37
|
+
// eslint-disable-next-line no-console
|
|
38
|
+
console.error(log.error);
|
|
28
39
|
}
|
|
29
40
|
setLogsHistory(logs.slice());
|
|
30
41
|
},
|
|
@@ -48,5 +59,8 @@ export function LoggerProvider({ children }) {
|
|
|
48
59
|
lastReadLogId,
|
|
49
60
|
};
|
|
50
61
|
}, [lastReadLogId, logsHistory, markAsRead]);
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
popupLoggingLevelRef.current = popupLoggingLevel;
|
|
64
|
+
}, [logsHistory, popupLoggingLevel]);
|
|
51
65
|
return (_jsxs(LoggerContext.Provider, { value: loggerState, children: [isLogHistoryOpened && (_jsx(LogsHistoryModal, { autoOpen: true, onClose: () => openLogHistory(false) })), children] }));
|
|
52
66
|
}
|
|
@@ -6,112 +6,5 @@ export interface PreferencesContextData extends PreferencesState {
|
|
|
6
6
|
}
|
|
7
7
|
export declare const PreferencesContext: import("react").Context<PreferencesState>;
|
|
8
8
|
export declare const PreferencesProvider: import("react").Provider<PreferencesState>;
|
|
9
|
-
export declare function usePreferences():
|
|
10
|
-
current: any;
|
|
11
|
-
isCurrentWorkspaceReadOnly: boolean;
|
|
12
|
-
version: number;
|
|
13
|
-
workspaces: import("../reducer/preferences/preferencesReducer").WorkspacesWithSource;
|
|
14
|
-
originalWorkspaces: import("../reducer/preferences/preferencesReducer").WorkspacesWithSource;
|
|
15
|
-
dispatch: (action?: ({
|
|
16
|
-
type: "INIT_PREFERENCES";
|
|
17
|
-
payload: {
|
|
18
|
-
display: import("nmr-load-save").WorkspacePreferences;
|
|
19
|
-
workspace: import("../main/types").NMRiumWorkspace;
|
|
20
|
-
customWorkspaces: Record<string, import("nmr-load-save").Workspace>;
|
|
21
|
-
dispatch: any;
|
|
22
|
-
};
|
|
23
|
-
} | ({
|
|
24
|
-
type: "SET_PREFERENCES";
|
|
25
|
-
payload: Partial<import("nmr-load-save").Workspace>;
|
|
26
|
-
} | {
|
|
27
|
-
type: "SET_PREFERENCES";
|
|
28
|
-
}) | {
|
|
29
|
-
type: "SET_PANELS_PREFERENCES";
|
|
30
|
-
payload: {
|
|
31
|
-
key: string;
|
|
32
|
-
value: string;
|
|
33
|
-
};
|
|
34
|
-
} | import("../reducer/preferences/preferencesReducer").SetWorkspaceAction | {
|
|
35
|
-
type: "REMOVE_WORKSPACE" | "SET_ACTIVE_WORKSPACE";
|
|
36
|
-
payload: {
|
|
37
|
-
workspace: string;
|
|
38
|
-
};
|
|
39
|
-
} | {
|
|
40
|
-
type: "ADD_WORKSPACE";
|
|
41
|
-
payload: {
|
|
42
|
-
workspaceKey: string;
|
|
43
|
-
data?: Omit<import("nmr-load-save").Workspace, "label" | "version"> | undefined;
|
|
44
|
-
};
|
|
45
|
-
} | {
|
|
46
|
-
type: "APPLY_General_PREFERENCES";
|
|
47
|
-
payload: {
|
|
48
|
-
data: Omit<import("nmr-load-save").Workspace, "label" | "version">;
|
|
49
|
-
};
|
|
50
|
-
} | {
|
|
51
|
-
type: "ANALYZE_SPECTRA";
|
|
52
|
-
payload: {
|
|
53
|
-
start: number;
|
|
54
|
-
end: number;
|
|
55
|
-
nucleus: string;
|
|
56
|
-
columnKey?: string | undefined;
|
|
57
|
-
};
|
|
58
|
-
} | {
|
|
59
|
-
type: "CHANGE_ANALYSIS_COLUMN_VALUE_KEY";
|
|
60
|
-
payload: {
|
|
61
|
-
columnKey: string;
|
|
62
|
-
valueKey: string;
|
|
63
|
-
nucleus: string;
|
|
64
|
-
};
|
|
65
|
-
} | {
|
|
66
|
-
type: "DELETE_ANALYSIS_COLUMN";
|
|
67
|
-
payload: {
|
|
68
|
-
columnKey: string;
|
|
69
|
-
nucleus: string;
|
|
70
|
-
};
|
|
71
|
-
} | {
|
|
72
|
-
type: "SET_SPECTRA_ANALYSIS_PREFERENCES";
|
|
73
|
-
payload: {
|
|
74
|
-
nucleus: string;
|
|
75
|
-
data: import("nmr-load-save").MultipleSpectraAnalysisPreferences;
|
|
76
|
-
};
|
|
77
|
-
} | {
|
|
78
|
-
type: "SET_MATRIX_GENERATION_OPTIONS";
|
|
79
|
-
payload: {
|
|
80
|
-
nucleus: string;
|
|
81
|
-
options: import("../../data/types/data1d/MatrixOptions").MatrixOptions;
|
|
82
|
-
};
|
|
83
|
-
} | {
|
|
84
|
-
type: "ADD_MATRIX_GENERATION_EXCLUSION_ZONE";
|
|
85
|
-
payload: {
|
|
86
|
-
zone: {
|
|
87
|
-
from: number;
|
|
88
|
-
to: number;
|
|
89
|
-
};
|
|
90
|
-
range: {
|
|
91
|
-
from: number;
|
|
92
|
-
to: number;
|
|
93
|
-
};
|
|
94
|
-
nucleus: string;
|
|
95
|
-
};
|
|
96
|
-
} | {
|
|
97
|
-
type: "DELETE_MATRIX_GENERATION_EXCLUSION_ZONE";
|
|
98
|
-
payload: {
|
|
99
|
-
zone: {
|
|
100
|
-
id: string;
|
|
101
|
-
from: number;
|
|
102
|
-
to: number;
|
|
103
|
-
};
|
|
104
|
-
nucleus: string;
|
|
105
|
-
};
|
|
106
|
-
} | {
|
|
107
|
-
type: "SET_VERTICAL_SPLITTER_POSITION";
|
|
108
|
-
payload: {
|
|
109
|
-
value: import("react-science/ui").SplitPaneSize;
|
|
110
|
-
};
|
|
111
|
-
}) | undefined) => void;
|
|
112
|
-
workspace: {
|
|
113
|
-
current: import("../main/types").NMRiumWorkspace;
|
|
114
|
-
base: import("../main/types").NMRiumWorkspace | null;
|
|
115
|
-
};
|
|
116
|
-
};
|
|
9
|
+
export declare function usePreferences(): PreferencesContextData;
|
|
117
10
|
export declare function useWorkspacesList(): any[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TopicMolecule } from 'openchemlib-utils';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export declare function useTopicMolecule(): Record<string, TopicMolecule>;
|
|
4
|
+
interface TopicMoleculeProviderProps {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare function TopicMoleculeProvider({ children, }: TopicMoleculeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import OCL from 'openchemlib/full';
|
|
3
|
+
import { TopicMolecule } from 'openchemlib-utils';
|
|
4
|
+
import { createContext, useContext, useEffect, useRef } from 'react';
|
|
5
|
+
import { useChartData } from './ChartContext';
|
|
6
|
+
const TopicMoleculeContext = createContext({});
|
|
7
|
+
export function useTopicMolecule() {
|
|
8
|
+
const context = useContext(TopicMoleculeContext);
|
|
9
|
+
if (!context) {
|
|
10
|
+
throw new Error('Topic Molecule context was not found');
|
|
11
|
+
}
|
|
12
|
+
return context;
|
|
13
|
+
}
|
|
14
|
+
export function TopicMoleculeProvider({ children, }) {
|
|
15
|
+
const moleculesRef = useRef({});
|
|
16
|
+
const { molecules } = useChartData();
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
for (const { id, molfile } of molecules) {
|
|
19
|
+
const topicMolecule = moleculesRef.current?.[id];
|
|
20
|
+
const molecule = OCL.Molecule.fromMolfile(molfile);
|
|
21
|
+
if (topicMolecule) {
|
|
22
|
+
moleculesRef.current[id] = topicMolecule.fromMolecule(molecule);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
moleculesRef.current[id] = new TopicMolecule(molecule);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}, [molecules]);
|
|
29
|
+
return (_jsx(TopicMoleculeContext.Provider, { value: moleculesRef.current, children: children }));
|
|
30
|
+
}
|
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
onClick?: () => void;
|
|
4
|
-
popupTitle?: string;
|
|
5
|
-
popupPlacement?: string;
|
|
6
|
-
className?: string;
|
|
7
|
-
}
|
|
8
|
-
declare function CloseButton(props: CloseButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
declare const _default: import("react").MemoExoticComponent<typeof CloseButton>;
|
|
10
|
-
export default _default;
|
|
1
|
+
import { ToolBarButtonProps } from './ToolBarButton';
|
|
2
|
+
export declare function CloseButton(props: Pick<ToolBarButtonProps, 'onClick' | 'title' | 'className'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,23 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { memo } from 'react';
|
|
3
2
|
import { FaTimes } from 'react-icons/fa';
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
button: {
|
|
7
|
-
backgroundColor: 'transparent',
|
|
8
|
-
border: 'none',
|
|
9
|
-
height: '100%',
|
|
10
|
-
display: 'flex',
|
|
11
|
-
justifyContent: 'center',
|
|
12
|
-
alignItems: 'center',
|
|
13
|
-
},
|
|
14
|
-
svg: {
|
|
15
|
-
fill: '#ca0000',
|
|
16
|
-
fontSize: '16px',
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
function CloseButton(props) {
|
|
20
|
-
const { onClick = () => null, popupTitle = 'Close', popupPlacement = 'left', className = '', } = props;
|
|
21
|
-
return (_jsx("div", { className: className, children: _jsx(ToolTip, { title: popupTitle, popupPlacement: popupPlacement, children: _jsx("button", { style: styles.button, type: "button", onClick: onClick, children: _jsx(FaTimes, { style: styles.svg }) }) }) }));
|
|
3
|
+
import { ToolBarButton } from './ToolBarButton';
|
|
4
|
+
export function CloseButton(props) {
|
|
5
|
+
return (_jsx(ToolBarButton, { id: "close-button", ...props, intent: "danger", icon: _jsx(FaTimes, {}), placement: "bottom-start" }));
|
|
22
6
|
}
|
|
23
|
-
export default memo(CloseButton);
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
x: string | number;
|
|
5
|
-
y: string | number;
|
|
1
|
+
import { ButtonProps } from '@blueprintjs/core';
|
|
2
|
+
interface DeleteButtonProps extends Pick<ButtonProps, 'onClick' | 'title' | 'disabled' | 'active'> {
|
|
3
|
+
title: string;
|
|
6
4
|
}
|
|
7
|
-
declare function DeleteButton(props: DeleteButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export
|
|
5
|
+
export declare function DeleteButton(props: DeleteButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { FaRegTrashAlt } from 'react-icons/fa';
|
|
3
|
+
import { ToolBarButton } from './ToolBarButton';
|
|
4
|
+
export function DeleteButton(props) {
|
|
5
|
+
return (_jsx(ToolBarButton, { intent: "danger", style: {
|
|
6
|
+
fontSize: '1.125em',
|
|
7
|
+
}, ...props, id: "delete-button", icon: _jsx(FaRegTrashAlt, {}) }));
|
|
5
8
|
}
|
|
6
|
-
export default DeleteButton;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ButtonProps } from '@blueprintjs/core';
|
|
2
|
+
interface FilterButtonProps extends Pick<ButtonProps, 'onClick' | 'title' | 'disabled' | 'active'> {
|
|
3
|
+
title: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function FilterButton(props: FilterButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { FaFilter } from 'react-icons/fa';
|
|
3
|
+
import { ToolBarButton } from './ToolBarButton';
|
|
4
|
+
export function FilterButton(props) {
|
|
5
|
+
return (_jsx(ToolBarButton, { id: "filter-button", ...props, style: {
|
|
6
|
+
fontSize: '1.125em',
|
|
7
|
+
}, icon: _jsx(FaFilter, {}) }));
|
|
8
|
+
}
|
|
@@ -41,8 +41,10 @@ const Input = forwardRef((props, ref) => {
|
|
|
41
41
|
const value = debounceTime ? internalValue : externalValue;
|
|
42
42
|
const localRef = useRef();
|
|
43
43
|
const combinedRef = useCombinedRefs([ref, localRef]);
|
|
44
|
+
const [isDebounced, setDebouncedStatus] = useState(false);
|
|
44
45
|
const debounceOnChange = useMemo(() => debounce((e) => {
|
|
45
46
|
onChange?.(e);
|
|
47
|
+
setDebouncedStatus(true);
|
|
46
48
|
}, debounceTime), [debounceTime, onChange]);
|
|
47
49
|
useEffect(() => {
|
|
48
50
|
if (autoSelect) {
|
|
@@ -58,6 +60,7 @@ const Input = forwardRef((props, ref) => {
|
|
|
58
60
|
e.stopPropagation();
|
|
59
61
|
e.preventDefault();
|
|
60
62
|
const val = e.target.value;
|
|
63
|
+
setDebouncedStatus(false);
|
|
61
64
|
if (checkValue(val)) {
|
|
62
65
|
if (debounceTime) {
|
|
63
66
|
setInternalValue(val);
|
|
@@ -76,7 +79,7 @@ const Input = forwardRef((props, ref) => {
|
|
|
76
79
|
...((renderIcon || canClear) && { padding: '0 5px' }),
|
|
77
80
|
...styles.inputWrapper,
|
|
78
81
|
...style?.inputWrapper,
|
|
79
|
-
}, className: `input ${className || ''}`, children: [renderIcon?.(), _jsx("input", { ...otherProps, ref: combinedRef, name: name, style: {
|
|
82
|
+
}, className: `input ${className || ''} `, children: [renderIcon?.(), _jsx("input", { ...otherProps, className: isDebounced ? 'debounce-end' : '', ref: combinedRef, name: name, style: {
|
|
80
83
|
...styles.input,
|
|
81
84
|
...style?.input,
|
|
82
85
|
}, type: type, value: mapValue(value), onChange: onChangeHandler, list: `${name || ''}-data-list` }), canClear && value && (_jsx("button", { type: "button", style: styles.clearButton, onClick: clearHandler, children: _jsx("span", { style: { display: 'block', margin: '0 auto' }, children: "\u2715" }) })), _jsx("datalist", { id: `${name || ''}-data-list`, children: datalist.map((value) => (_jsx("option", { value: value }, value))) })] }));
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare function PreferencesButton({ onClick }: PreferencesButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
export {};
|
|
1
|
+
import { ToolBarButtonProps } from './ToolBarButton';
|
|
2
|
+
export declare function PreferencesButton({ onClick, }: Pick<ToolBarButtonProps, 'onClick'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { FaCog } from 'react-icons/fa';
|
|
3
|
-
import
|
|
4
|
-
export function PreferencesButton({ onClick }) {
|
|
5
|
-
return (_jsx(
|
|
3
|
+
import { ToolBarButton } from './ToolBarButton';
|
|
4
|
+
export function PreferencesButton({ onClick, }) {
|
|
5
|
+
return (_jsx(ToolBarButton, { style: {
|
|
6
|
+
fontSize: '1.125em',
|
|
7
|
+
}, id: "preferences-button", icon: _jsx(FaCog, {}), onClick: onClick }));
|
|
6
8
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/* eslint-disable unicorn/prefer-logical-operator-over-ternary */
|
|
3
|
+
/** @jsxImportSource @emotion/react */
|
|
4
|
+
import { css } from '@emotion/react';
|
|
2
5
|
import { useRef, memo, forwardRef, useState, useLayoutEffect, useEffect, useMemo, } from 'react';
|
|
3
6
|
import { useTable, useSortBy, } from 'react-table';
|
|
4
7
|
import { useMeasure } from 'react-use';
|
|
@@ -224,9 +227,9 @@ function ReactTable(props) {
|
|
|
224
227
|
});
|
|
225
228
|
}
|
|
226
229
|
}
|
|
227
|
-
return (_jsx(ReactTableProvider, { value: tableVirtualBoundary, children: _jsx("div", { ref: mRef,
|
|
230
|
+
return (_jsx(ReactTableProvider, { value: tableVirtualBoundary, children: _jsx("div", { ref: mRef, css: css({
|
|
228
231
|
position: 'relative',
|
|
229
232
|
height: '100%',
|
|
230
|
-
},
|
|
233
|
+
}, style), children: _jsx(ReactTableInner, { onScroll: scrollHandler, onSortEnd: onSortEnd, ref: containerRef, ...props }) }) }));
|
|
231
234
|
}
|
|
232
235
|
export default memo(ReactTable);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useState } from 'react';
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { useScaleX } from '../1d/utilities/scale';
|
|
4
4
|
import { useGlobal } from '../context/GlobalContext';
|
|
5
5
|
import SVGResizer from './resizer/SVGResizer';
|
|
@@ -10,10 +10,27 @@ export function ResizerWithScale(props) {
|
|
|
10
10
|
const x2 = scaleX()(from);
|
|
11
11
|
const x1 = scaleX()(to);
|
|
12
12
|
const [position, setPosition] = useState({ x1, x2 });
|
|
13
|
+
const startPositionRef = useRef();
|
|
13
14
|
useEffect(() => {
|
|
14
15
|
const x2 = scaleX()(from);
|
|
15
16
|
const x1 = scaleX()(to);
|
|
16
17
|
setPosition({ x1, x2 });
|
|
17
18
|
}, [from, scaleX, to]);
|
|
18
|
-
|
|
19
|
+
function handleMove(p) {
|
|
20
|
+
if (p.x2 >= p.x1) {
|
|
21
|
+
setPosition(p);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function handleEndMove(p) {
|
|
25
|
+
if (p.x2 >= p.x1) {
|
|
26
|
+
onEnd?.(p);
|
|
27
|
+
}
|
|
28
|
+
else if (startPositionRef.current) {
|
|
29
|
+
setPosition({ ...startPositionRef.current });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function handleStartResize(p) {
|
|
33
|
+
startPositionRef.current = p;
|
|
34
|
+
}
|
|
35
|
+
return (_jsx(SVGResizer, { position: position, onStart: handleStartResize, onEnd: handleEndMove, parentElement: viewerRef, disabled: disabled, onMove: handleMove, children: children }));
|
|
19
36
|
}
|
|
@@ -10,11 +10,11 @@ export function SVGGroup(props) {
|
|
|
10
10
|
if (element) {
|
|
11
11
|
const boundary = element.getBoundingClientRect();
|
|
12
12
|
if (direction === 'row') {
|
|
13
|
-
element.
|
|
13
|
+
element.setAttribute('transform', `translate(${shift} 0)`);
|
|
14
14
|
shift += boundary.width + space;
|
|
15
15
|
}
|
|
16
16
|
else {
|
|
17
|
-
element.
|
|
17
|
+
element.setAttribute('transform', `translate(0 ${shift})`);
|
|
18
18
|
shift += boundary.height + space;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
popupTitle?: string;
|
|
4
|
-
popupPlacement?: string;
|
|
5
|
-
disabled?: boolean;
|
|
6
|
-
className?: string;
|
|
7
|
-
onClick?: () => void;
|
|
8
|
-
}
|
|
9
|
-
declare function SaveButton(props: SaveButtonProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
10
|
-
declare const _default: import("react").MemoExoticComponent<typeof SaveButton>;
|
|
11
|
-
export default _default;
|
|
1
|
+
import { ToolBarButtonProps } from './ToolBarButton';
|
|
2
|
+
export declare function SaveButton(props: Pick<ToolBarButtonProps, 'onClick' | 'title'>): import("react/jsx-runtime").JSX.Element;
|